ppuview + cdlogger little improvement

This commit is contained in:
CaH4e3 2013-06-20 21:51:01 +00:00
parent 3eadc227f7
commit a9f25bd500
2 changed files with 51 additions and 19 deletions

View File

@ -229,7 +229,6 @@ void FCEUI_GetIVectors(uint16 *reset, uint16 *irq, uint16 *nmi);
uint32 FCEUI_CRC32(uint32 crc, uint8 *buf, uint32 len);
void FCEUI_ToggleTileView(void);
void FCEUI_SetLowPass(int q);
void FCEUI_NSFSetVis(int mode);

View File

@ -21,6 +21,7 @@
#include "common.h"
#include "../../palette.h"
#include "../../fceu.h"
#include "../../cart.h"
HWND hPPUView;
@ -29,7 +30,7 @@ extern uint8 PALRAM[0x20];
int PPUViewPosX,PPUViewPosY;
uint8 palcache[32] = { 0xFF }; //palette cache
uint8 chrcache0[0x1000],chrcache1[0x1000]; //cache CHR, fixes a refresh problem when right-clicking
uint8 chrcache0[0x1000],chrcache1[0x1000],logcache0[0x1000],logcache1[0x1000]; //cache CHR, fixes a refresh problem when right-clicking
uint8 *pattern0,*pattern1; //pattern table bitmap arrays
uint8 *ppuv_palette;
static int pindex0=0,pindex1=0;
@ -79,10 +80,15 @@ void PPUViewDoBlit() {
StretchBlt(pDC,PALETTEDESTX,PALETTEDESTY,PALETTEWIDTH,PALETTEHEIGHT,TmpDC2,0,PALETTEHEIGHT-1,PALETTEWIDTH,-PALETTEHEIGHT,SRCCOPY);
}
void DrawPatternTable(uint8 *bitmap, uint8 *table, uint8 pal) {
//---------CDLogger VROM
extern unsigned char *cdloggervdata;
extern unsigned int cdloggerVideoDataSize;
extern int debug_loggingCD;
void DrawPatternTable(uint8 *bitmap, uint8 *table, uint8 *log, uint8 pal) {
int i,j,x,y,index=0;
int p=0,tmp;
uint8 chr0,chr1;
uint8 chr0,chr1,logs;
uint8 *pbitmap = bitmap;
pal <<= 2;
@ -95,19 +101,32 @@ void DrawPatternTable(uint8 *bitmap, uint8 *table, uint8 pal) {
for (y = 0; y < 8; y++)
{
chr0 = table[index];
chr1 = table[index+8];
tmp=7;
for (x = 0; x < 8; x++)
{
p = (chr0>>tmp)&1;
p |= ((chr1>>tmp)&1)<<1;
p = palcache[p|pal];
tmp--;
*(uint8*)(pbitmap++) = palo[p].b;
*(uint8*)(pbitmap++) = palo[p].g;
*(uint8*)(pbitmap++) = palo[p].r;
}
chr1 = table[index + 8];
logs = log[index] & log[index + 8];
tmp = 7;
if(debug_loggingCD && cdloggerVideoDataSize && ((logs & 3) == 0)) {
for (x = 0; x < 8; x++)
{
p = (chr0 >> tmp) & 1;
p |= ((chr1 >> tmp) & 1) << 1;
p = palcache[p | pal];
tmp--;
*(uint8*)(pbitmap++) = palo[p].b >> 2;
*(uint8*)(pbitmap++) = palo[p].g >> 2;
*(uint8*)(pbitmap++) = palo[p].r >> 2;
}
} else {
for (x = 0; x < 8; x++)
{
p = (chr0 >> tmp) & 1;
p |= ((chr1 >> tmp) & 1) << 1;
p = palcache[p | pal];
tmp--;
*(uint8*)(pbitmap++) = palo[p].b;
*(uint8*)(pbitmap++) = palo[p].g;
*(uint8*)(pbitmap++) = palo[p].r;
}
}
index++;
pbitmap += ((PALETTEBITWIDTH>>2)-24);
}
@ -134,6 +153,18 @@ void FCEUD_UpdatePPUView(int scanline, int refreshchr) {
for (i = 0, x=0x1000; i < 0x1000; i++, x++) {
chrcache0[i] = VPage[i>>10][i];
chrcache1[i] = VPage[x>>10][x];
if(debug_loggingCD && cdloggerVideoDataSize) {
int addr;
addr = &VPage[i >> 10][i] - CHRptr[0];
if ((addr >= 0) && (addr < (int)cdloggerVideoDataSize))
logcache0[i] = cdloggervdata[addr];
addr = &VPage[x >> 10][x] - CHRptr[0];
if ((addr >= 0) && (addr < (int)cdloggerVideoDataSize))
logcache1[i] = cdloggervdata[addr];
} else {
logcache0[i] = 0;
logcache1[i] = 0;
}
}
}
@ -174,8 +205,8 @@ void FCEUD_UpdatePPUView(int scanline, int refreshchr) {
memcpy(palcache,PALRAM,32); //palcache which will make it not equal next time
}
DrawPatternTable(pattern0,chrcache0,pindex0);
DrawPatternTable(pattern1,chrcache1,pindex1);
DrawPatternTable(pattern0,chrcache0,logcache0,pindex0);
DrawPatternTable(pattern1,chrcache1,logcache1,pindex1);
//PPUViewDoBlit();
}
@ -254,6 +285,8 @@ BOOL CALLBACK PPUViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
memset(palcache,0,32);
memset(chrcache0,0,0x1000);
memset(chrcache1,0,0x1000);
memset(logcache0,0,0x1000);
memset(logcache1,0,0x1000);
PPUViewer=1;
break;