diff --git a/driver.h b/driver.h index d0d74117..5209f8d3 100644 --- a/driver.h +++ b/driver.h @@ -325,5 +325,10 @@ void FCEUD_DebugBreakpoint(); //(we should move the code in the win driver that does this to the shared area) void FCEUD_TraceInstruction(); +//the driver might should update its NTView +void FCEUD_UpdateNTView(int scanline, int drawall); + +//the driver might should update its PPUView +void FCEUD_UpdatePPUView(int scanline, int drawall); #endif /* __DRIVER_H_ */ diff --git a/drivers/win/cheat.cpp b/drivers/win/cheat.cpp index 71e9329e..0e7409f3 100644 --- a/drivers/win/cheat.cpp +++ b/drivers/win/cheat.cpp @@ -20,7 +20,7 @@ #include "common.h" #include "cheat.h" -#include "..\..\memview.h" +#include "memview.h" #include "debugger.h" #include "..\..\fceu.h" #include "..\..\cart.h" diff --git a/drivers/win/debugger.cpp b/drivers/win/debugger.cpp index 723aee98..2493a44f 100644 --- a/drivers/win/debugger.cpp +++ b/drivers/win/debugger.cpp @@ -28,7 +28,7 @@ #include "..\..\cart.h" #include "..\..\ines.h" #include "tracer.h" -#include "..\..\memview.h" +#include "memview.h" #include "cheat.h" #include diff --git a/drivers/win/main.cpp b/drivers/win/main.cpp index 143b645b..b734bf75 100644 --- a/drivers/win/main.cpp +++ b/drivers/win/main.cpp @@ -33,25 +33,21 @@ #include // For directories configuration dialog. #undef uint8 -#include "../../ppuview.h" //mbg merge 7/19/06 added -#include "../../types.h" //mbg merge 7/17/06 added -#include "../../fceu.h" //mbg merge 7/17/06 added -#include "debugger.h" //mbg merge 7/18/06 added +#include "../../types.h" +#include "../../fceu.h" +#include "ppuview.h" +#include "debugger.h" #include "input.h" #include "netplay.h" #include "joystick.h" #include "keyboard.h" #include "cheat.h" #include "debug.h" - -//------ -//mbg merge 7/19/06 added -#include "..\..\ppuview.h" -#include "..\..\ntview.h" -#include "..\..\memview.h" +#include "ppuview.h" +#include "ntview.h" +#include "memview.h" #include "tracer.h" #include "cdlogger.h" -//----- //#include "memwatch.h" //mbg merge 7/19/06 removed-memwatch is gone #include "basicbot.h" diff --git a/drivers/win/memview.cpp b/drivers/win/memview.cpp index 7aded6ad..c700ead9 100644 --- a/drivers/win/memview.cpp +++ b/drivers/win/memview.cpp @@ -20,7 +20,7 @@ #include "common.h" #include "..\..\types.h" -#include "..\..\memview.h" +#include "memview.h" #include "..\..\debug.h" #include "debugger.h" #include "cdlogger.h" diff --git a/memview.h b/drivers/win/memview.h similarity index 100% rename from memview.h rename to drivers/win/memview.h diff --git a/drivers/win/ntview.cpp b/drivers/win/ntview.cpp index 7fb38480..b6dd1bb0 100644 --- a/drivers/win/ntview.cpp +++ b/drivers/win/ntview.cpp @@ -19,7 +19,7 @@ */ #include "common.h" -#include "..\..\ntview.h" +#include "ntview.h" #include "..\..\fceu.h" #include "..\..\debug.h" #define INESPRIV @@ -313,7 +313,9 @@ void DrawNameTable(uint8 *bitmap, uint8 *table, uint8 *tablecache) { } } -void UpdateNTView(int drawall) { +void FCEUD_UpdateNTView(int scanline, int drawall) { + if(!NTViewer) return; + if(scanline != -1 && scanline != NTViewScanline) return; //uint8 *pbitmap = ppuv_palette; if (!hNTView) return; @@ -594,7 +596,7 @@ void DoNTView() { if (!hNTView) hNTView = CreateDialog(fceu_hInstance,"NTVIEW",NULL,NTViewCallB); if (hNTView) { SetWindowPos(hNTView,HWND_TOP,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOOWNERZORDER); - UpdateNTView(1); + FCEUD_UpdateNTView(-1,1); NTViewDoBlit(1); } } diff --git a/ntview.h b/drivers/win/ntview.h similarity index 81% rename from ntview.h rename to drivers/win/ntview.h index e19e2b83..67dd803d 100644 --- a/ntview.h +++ b/drivers/win/ntview.h @@ -4,6 +4,5 @@ extern int chrchanged; extern int horzscroll, vertscroll; void NTViewDoBlit(int autorefresh); -void UpdateNTView(int drawall); void KillNTView(); void DoNTView(); diff --git a/drivers/win/ppuview.cpp b/drivers/win/ppuview.cpp index b2111386..0bd8c4a4 100644 --- a/drivers/win/ppuview.cpp +++ b/drivers/win/ppuview.cpp @@ -113,7 +113,10 @@ void DrawPatternTable(uint8 *bitmap, uint8 *table, uint8 pal) { } -void UpdatePPUView(int refreshchr) { +void FCEUD_UpdatePPUView(int scanline, int refreshchr) { + if(!PPUViewer) return; + if(scanline != -1 && scanline != PPUViewScanline) return; + int x,y,i; uint8 *pbitmap = ppuv_palette; @@ -274,7 +277,7 @@ BOOL CALLBACK PPUViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam if(pindex1 == 7) pindex1 = 0; else pindex1++; } - UpdatePPUView(0); + FCEUD_UpdatePPUView(-1, 0); PPUViewDoBlit(); break; case WM_MOUSEMOVE: @@ -346,7 +349,7 @@ void DoPPUView() { if(!hPPUView) hPPUView = CreateDialog(fceu_hInstance,"PPUVIEW",NULL,PPUViewCallB); if(hPPUView) { SetWindowPos(hPPUView,HWND_TOP,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOOWNERZORDER); - UpdatePPUView(1); + FCEUD_UpdatePPUView(-1,1); PPUViewDoBlit(); } } diff --git a/drivers/win/ppuview.h b/drivers/win/ppuview.h index e69de29b..eeb21562 100644 --- a/drivers/win/ppuview.h +++ b/drivers/win/ppuview.h @@ -0,0 +1,6 @@ +extern int PPUViewScanline; +extern int PPUViewer; +extern int scanline; + +void PPUViewDoBlit(); + diff --git a/drivers/win/tracer.cpp b/drivers/win/tracer.cpp index 414111b8..feb45688 100644 --- a/drivers/win/tracer.cpp +++ b/drivers/win/tracer.cpp @@ -27,7 +27,7 @@ #include "..\..\file.h" #include "..\..\debug.h" #include "tracer.h" -#include "..\..\memview.h" +#include "memview.h" //#define LOG_SKIP_UNMAPPED 4 //#define LOG_ADD_PERIODS 8 diff --git a/ppu.cpp b/ppu.cpp index ecc3c323..0b7f4ae8 100644 --- a/ppu.cpp +++ b/ppu.cpp @@ -32,17 +32,12 @@ #include "general.h" #include "endian.h" #include "memory.h" -#ifdef WIN32 -#include "ppuview.h" -#endif #include "cart.h" #include "palette.h" #include "state.h" #include "video.h" #include "input.h" -#include "ppuview.h" //bbit edited: this line added -#include "ntview.h" //bbit edited: this line added #define VBlankON (PPU[0]&0x80) /* Generate VBlank NMI */ #define Sprite16 (PPU[0]&0x20) /* Sprites 8x16/8x8 */ @@ -813,7 +808,7 @@ static void DoLine(void) GameHBIRQHook(); } - if ((NTViewer) && (scanline == NTViewScanline)) UpdateNTView(0); //bbit edited:this line added + DEBUG(FCEUD_UpdateNTView(scanline,0)); if(SpriteON) RefreshSprites(); @@ -1364,9 +1359,7 @@ int FCEUPPU_Loop(int skip) for(scanline=0;scanline<240;) //scanline is incremented in DoLine. Evil. :/ { deempcnt[deemp]++; -//#ifdef WIN32 //mbg merge 7/19/06 ideally this kind of code should work in every driver and just eval to nothing in drivers that dont support it - if((PPUViewer) && (scanline == PPUViewScanline)) UpdatePPUView(1); -//#endif + DEBUG(FCEUD_UpdatePPUView(scanline, 1)); DoLine(); } if(MMC5Hack && (ScreenON || SpriteON)) MMC5_hb(scanline); diff --git a/ppuview.h b/ppuview.h deleted file mode 100644 index 163479b0..00000000 --- a/ppuview.h +++ /dev/null @@ -1,7 +0,0 @@ -extern int PPUViewScanline; -extern int PPUViewer; -extern int scanline; - -void PPUViewDoBlit(); //mbg merge 7/19/06 -void UpdatePPUView(int refreshchr); - diff --git a/types.h b/types.h index 19ca2f64..6aec9620 100644 --- a/types.h +++ b/types.h @@ -33,6 +33,13 @@ //#define FCEUXD_VERSION_STRING "1.0a" //#define FCEUXDSP_VERSION_STRING "1.07" +//causes the code fragment argument to be compiled in if the build includes debugging +#ifdef FCEUDEF_DEBUGGER +#define DEBUG(X) X; +#else +#define DEBUG(X) +#endif + #ifdef MSVC typedef unsigned char uint8; typedef unsigned short uint16; diff --git a/x6502.cpp b/x6502.cpp index 4d906382..bb1d9de7 100644 --- a/x6502.cpp +++ b/x6502.cpp @@ -382,13 +382,6 @@ void X6502_Power(void) X6502_Reset(); } -//causes the code fragment argument to be compiled in if the build includes debugging -#ifdef FCEUDEF_DEBUGGER -#define DEBUG(X) X; -#else -#define DEBUG(X) -#endif - void X6502_Run(int32 cycles) { if(PAL)