diff --git a/trunk/src/drivers/win/ntview.cpp b/trunk/src/drivers/win/ntview.cpp index 7debd096..a59a5185 100644 --- a/trunk/src/drivers/win/ntview.cpp +++ b/trunk/src/drivers/win/ntview.cpp @@ -46,10 +46,10 @@ HWND hNTView; int NTViewPosX,NTViewPosY; -static uint8 palcache[32]; //palette cache //mbg merge 7/19/06 needed to be static +static uint8 palcache[36]; //palette cache int NTViewScanline=0,NTViewer=0; int NTViewSkip; -int NTViewRefresh = 15; +int NTViewRefresh = 0; static int mouse_x,mouse_y; //todo: is static needed here? --mbg 7/19/06 - i think so bool redrawtables = false; int chrchanged = 0; @@ -108,6 +108,7 @@ extern uint8 XOffset; int xpos, ypos; int scrolllines = 1; int attview = 0; +int hidepal = 0; // checkerboard tile for attribute view const uint8 ATTRIBUTE_VIEW_TILE[16] = { 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF }; @@ -283,6 +284,7 @@ void DrawNameTable(int scanline, int ntnum, bool invalidateCache) { int refreshaddr = (x)+(y)*32; a = FCEUPPU_GetAttr(ntnum,x,y); + if (hidepal) a = 8; const uint8* chrp = FCEUPPU_GetCHR(ptable+chr,refreshaddr); if (attview) chrp = ATTRIBUTE_VIEW_TILE; @@ -419,12 +421,16 @@ BOOL CALLBACK NTViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) CheckDlgButton(hwndDlg, IDC_NTVIEW_SHOW_SCROLL_LINES, BST_CHECKED); CheckDlgButton(hwndDlg, IDC_NTVIEW_SHOW_ATTRIBUTES, BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_NTVIEW_HIDE_PALETTES, BST_UNCHECKED); + //clear cache - //memset(palcache,0,32); - //memset(ntcache0,0,0x400); - //memset(ntcache1,0,0x400); - //memset(ntcache2,0,0x400); - //memset(ntcache3,0,0x400); + memset(palcache,0,32); + + // forced palette (e.g. for debugging nametables when palettes are all-black) + palcache[(8*4)+0] = 0x0F; + palcache[(8*4)+1] = 0x00; + palcache[(8*4)+2] = 0x10; + palcache[(8*4)+3] = 0x20; NTViewer=1; break; @@ -549,6 +555,10 @@ BOOL CALLBACK NTViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) attview ^= 1; chrchanged = 1; break; + case IDC_NTVIEW_HIDE_PALETTES : + hidepal ^= 1; + chrchanged = 1; + break; } break; } diff --git a/trunk/src/drivers/win/ppuview.cpp b/trunk/src/drivers/win/ppuview.cpp index 331280b7..2a083466 100644 --- a/trunk/src/drivers/win/ppuview.cpp +++ b/trunk/src/drivers/win/ppuview.cpp @@ -35,14 +35,14 @@ bool PPUView_maskUnusedGraphics = true; bool PPUView_invertTheMask = false; int PPUView_sprite16Mode = 0; -uint8 palcache[32] = { 0xFF }; //palette cache +static uint8 palcache[36] = { 0xFF }; //palette cache 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; int PPUViewScanline = 0, PPUViewer = 0; int PPUViewSkip; -int PPUViewRefresh = 15; +int PPUViewRefresh = 0; int mouse_x, mouse_y; #define PATTERNWIDTH 128 @@ -333,6 +333,12 @@ BOOL CALLBACK PPUViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam memset(logcache0,0,0x1000); memset(logcache1,0,0x1000); + // forced palette (e.g. for debugging CHR when palettes are all-black) + palcache[(8*4)+0] = 0x0F; + palcache[(8*4)+1] = 0x00; + palcache[(8*4)+2] = 0x10; + palcache[(8*4)+3] = 0x20; + PPUViewer=1; break; } @@ -372,13 +378,13 @@ BOOL CALLBACK PPUViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam mouse_y = GET_Y_LPARAM(lParam); if(((mouse_x >= patternDestX) && (mouse_x < (patternDestX + (PATTERNWIDTH * ZOOM)))) && (mouse_y >= patternDestY) && (mouse_y < (patternDestY + (PATTERNHEIGHT * ZOOM)))) { - if (pindex0 == 7) + if (pindex0 == 8) pindex0 = 0; else pindex0++; } else if(((mouse_x >= patternDestX + (PATTERNWIDTH * ZOOM) + 1) && (mouse_x < (patternDestX + (PATTERNWIDTH * ZOOM) * 2 + 1))) && (mouse_y >= patternDestY) && (mouse_y < (patternDestY + (PATTERNHEIGHT * ZOOM)))) { - if (pindex1 == 7) + if (pindex1 == 8) pindex1 = 0; else pindex1++; diff --git a/trunk/src/drivers/win/res.rc b/trunk/src/drivers/win/res.rc index 8437e2a7..69e2b46c 100644 --- a/trunk/src/drivers/win/res.rc +++ b/trunk/src/drivers/win/res.rc @@ -856,36 +856,33 @@ BEGIN GROUPBOX "",112,3,18,185,50,WS_TABSTOP END -NTVIEW DIALOGEX 44, 38, 355, 402 +NTVIEW DIALOGEX 44, 38, 355, 365 STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Name Table Viewer" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN - GROUPBOX "Name Tables",IDC_NTVIEW_TABLE_BOX,0,0,354,310,WS_TABSTOP - CONTROL "",IDC_NTVIEW_REFRESH_TRACKBAR,"msctls_trackbar32",WS_TABSTOP,227,318,106,11 - LTEXT "Refresh: More",-1,177,318,50,10 - LTEXT "Less",65534,333,318,18,10 - LTEXT "Display on scanline:",65533,7,318,65,10 - EDITTEXT IDC_NTVIEW_SCANLINE,73,315,24,12 - CONTROL "Vertical",IDC_NTVIEW_MIRROR_VERTICAL,"Button",BS_AUTORADIOBUTTON,15,355,39,10 - CONTROL "Four Screen",IDC_NTVIEW_MIRROR_FOUR_SCREEN,"Button",BS_AUTORADIOBUTTON,15,367,55,10 - CONTROL "Single Screen (Table 0)",IDC_NTVIEW_MIRROR_SS_TABLE_0, - "Button",BS_AUTORADIOBUTTON,113,345,90,10 - CONTROL "Single Screen (Table 1)",IDC_NTVIEW_MIRROR_SS_TABLE_1, - "Button",BS_AUTORADIOBUTTON,113,356,90,10 - CONTROL "Single Screen (Table 2)",IDC_NTVIEW_MIRROR_SS_TABLE_2, - "Button",BS_AUTORADIOBUTTON,113,366,90,10 - CONTROL "Single Screen (Table 3)",IDC_NTVIEW_MIRROR_SS_TABLE_3, - "Button",BS_AUTORADIOBUTTON,113,377,90,10 - GROUPBOX "Current Mirroring",65532,7,332,214,58 - CONTROL "Show Scroll Lines",IDC_NTVIEW_SHOW_SCROLL_LINES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,101,313,69,10 - CONTROL "Show Attributes", IDC_NTVIEW_SHOW_ATTRIBUTES, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,101,324,69,10 - CONTROL "Horizontal",IDC_NTVIEW_MIRROR_HORIZONTAL,"Button",BS_AUTORADIOBUTTON,15,344,47,10 - GROUPBOX "Properties",65531,227,336,122,60 - LTEXT "Tile ID:", IDC_NTVIEW_PROPERTIES_LINE_1,237,346,110,10 - LTEXT "X / Y:", IDC_NTVIEW_PROPERTIES_LINE_2,238,356,110,10 - LTEXT "PPU Address:",IDC_NTVIEW_PROPERTIES_LINE_3,237,366,110,10 - LTEXT "Attribute:", IDC_NTVIEW_PROPERTIES_LINE_4,237,376,110,10 + GROUPBOX "Name Tables",IDC_NTVIEW_TABLE_BOX,0,0,267,255,WS_TABSTOP + LTEXT "Display on scanline:",65533, 7,268,65,10 + EDITTEXT IDC_NTVIEW_SCANLINE, 70,266,24,12 + CONTROL "Show Scroll Lines",IDC_NTVIEW_SHOW_SCROLL_LINES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,101,263,69,10 + CONTROL "Show Attributes", IDC_NTVIEW_SHOW_ATTRIBUTES, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,101,274,69,10 + CONTROL "Ignore Palettes", IDC_NTVIEW_HIDE_PALETTES, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,101,285,69,10 + LTEXT "Refresh: More",-1,177,268,50,10 + CONTROL "",IDC_NTVIEW_REFRESH_TRACKBAR,"msctls_trackbar32",WS_TABSTOP,227,268,106,11 + LTEXT "Less",65534,333,268,18,10 + GROUPBOX "Current Mirroring",65532,7,298,214,63 + CONTROL "Horizontal", IDC_NTVIEW_MIRROR_HORIZONTAL, "Button",BS_AUTORADIOBUTTON,15,311,47,10 + CONTROL "Vertical", IDC_NTVIEW_MIRROR_VERTICAL, "Button",BS_AUTORADIOBUTTON,15,322,39,10 + CONTROL "Four Screen",IDC_NTVIEW_MIRROR_FOUR_SCREEN,"Button",BS_AUTORADIOBUTTON,15,333,55,10 + CONTROL "Single Screen (Table 0)",IDC_NTVIEW_MIRROR_SS_TABLE_0,"Button",BS_AUTORADIOBUTTON,113,311,90,10 + CONTROL "Single Screen (Table 1)",IDC_NTVIEW_MIRROR_SS_TABLE_1,"Button",BS_AUTORADIOBUTTON,113,322,90,10 + CONTROL "Single Screen (Table 2)",IDC_NTVIEW_MIRROR_SS_TABLE_2,"Button",BS_AUTORADIOBUTTON,113,333,90,10 + CONTROL "Single Screen (Table 3)",IDC_NTVIEW_MIRROR_SS_TABLE_3,"Button",BS_AUTORADIOBUTTON,113,344,90,10 + GROUPBOX "Properties",65531,227,298,122,63 + LTEXT "Tile ID:", IDC_NTVIEW_PROPERTIES_LINE_1,237,311,110,10 + LTEXT "X / Y:", IDC_NTVIEW_PROPERTIES_LINE_2,238,322,110,10 + LTEXT "PPU Address:",IDC_NTVIEW_PROPERTIES_LINE_3,237,333,110,10 + LTEXT "Attribute:", IDC_NTVIEW_PROPERTIES_LINE_4,237,344,110,10 END ROMPATCHER DIALOGEX 84, 67, 304, 135 diff --git a/trunk/src/drivers/win/resource.h b/trunk/src/drivers/win/resource.h index 77fd5f4f..87fc8523 100644 --- a/trunk/src/drivers/win/resource.h +++ b/trunk/src/drivers/win/resource.h @@ -506,6 +506,7 @@ #define IDC_NTVIEW_MIRROR_SS_TABLE_3 1007 #define IDC_NTVIEW_SHOW_SCROLL_LINES 1008 #define IDC_NTVIEW_SHOW_ATTRIBUTES 1009 +#define IDC_NTVIEW_HIDE_PALETTES 1010 #define MW_ADDR03 1010 #define MW_ADDR04 1013 #define MW_ADDR05 1016