From 663a2daf08d1e5cb50020cea0f7dec1257ada96d Mon Sep 17 00:00:00 2001 From: adelikat Date: Mon, 7 Jul 2008 15:54:38 +0000 Subject: [PATCH] 1) Lag Counter setting remembered by config. 2) MapHokeys now includes many tools such as debugger, ppu viewer, etc. --- src/drivers/win/config.cpp | 2 ++ src/drivers/win/ppuview.h | 2 +- src/drivers/win/window.cpp | 1 - src/fceu.cpp | 2 +- src/input.cpp | 67 ++++++++++++++++++++++++++++++++++++-- src/input.h | 7 ++++ 6 files changed, 76 insertions(+), 5 deletions(-) diff --git a/src/drivers/win/config.cpp b/src/drivers/win/config.cpp index 4548c8ed..4ed624a9 100644 --- a/src/drivers/win/config.cpp +++ b/src/drivers/win/config.cpp @@ -59,6 +59,7 @@ extern int TasEdit_wndx, TasEdit_wndy; extern int EnableAutosave; extern int AFon, AFoff, AutoFireOffset; extern int DesynchAutoFire; +extern bool lagCounterDisplay; //Structure that contains configuration information static CFGSTRUCT fceuconfig[] = { @@ -195,6 +196,7 @@ static CFGSTRUCT fceuconfig[] = { AC(AFoff), AC(AutoFireOffset), AC(DesynchAutoFire), + AC(lagCounterDisplay), //ACS(memwLastfile[2048]), ENDCFGSTRUCT diff --git a/src/drivers/win/ppuview.h b/src/drivers/win/ppuview.h index eeb21562..9ea092dd 100644 --- a/src/drivers/win/ppuview.h +++ b/src/drivers/win/ppuview.h @@ -1,6 +1,6 @@ extern int PPUViewScanline; extern int PPUViewer; extern int scanline; - +void DoPPUView(); void PPUViewDoBlit(); diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index 0e8cdfd6..0390b015 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -75,7 +75,6 @@ void SetAutoFirePattern(int onframes, int offframes); void SetAutoFireOffset(int offset); void ShowNetplayConsole(void); //mbg merge 7/17/06 YECH had to add -void DoPPUView();//mbg merge 7/19/06 yech had to add void MapInput(void); diff --git a/src/fceu.cpp b/src/fceu.cpp index 2a609e6d..e92c274d 100644 --- a/src/fceu.cpp +++ b/src/fceu.cpp @@ -60,7 +60,7 @@ int AFon, AFoff, AutoFireOffset = 0; //For keeping track of autofire settings unsigned int LagCounter = 0; //This will increment everytime input is not polled by the game -bool lagCounterDisplay = true; +bool lagCounterDisplay = false; bool lagFlag = true; static void CloseGame(void) diff --git a/src/input.cpp b/src/input.cpp index 2768ac40..a9f6e68b 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -42,7 +42,16 @@ // qfox: For UpdateExternalButton(), called when the // botmode state changes, to update a label in gui. #ifdef WIN32 +#include "drivers/win/main.h" #include "drivers/win/basicbot.h" +#include "drivers/win/memwatch.h" +#include "drivers/win/cheat.h" +#include "drivers/win/debugger.h" +#include "drivers/win/ppuview.h" +#include "drivers/win/cdlogger.h" +#include "drivers/win/tracer.h" +#include "drivers/win/memview.h" + #endif // WIN32 //it is easier to declare these input drivers extern here than include a bunch of files @@ -609,6 +618,7 @@ const char* FCEUI_CommandTypeNames[]= "AVI", "FDS", "VS Sys", + "Tools", }; static void CommandUnImpl(void); @@ -627,6 +637,12 @@ static void ObjectDisplayToggle(void); static void LagCounterReset(void); static void LagCounterToggle(void); static void ViewSlots(void); +static void LaunchMemoryWatch(void); +static void LaunchDebugger(void); +static void LaunchPPU(void); +static void LaunchHex(void); +static void LaunchTraceLogger(void); +static void LaunchCodeDataLogger(void); struct EMUCMDTABLE FCEUI_CommandTable[]= { @@ -756,8 +772,13 @@ struct EMUCMDTABLE FCEUI_CommandTable[]= { EMUCMD_MISC_DISPLAY_BG_TOGGLE, EMUCMDTYPE_MISC, BackgroundDisplayToggle, 0, 0, "Toggle Background Display", 0 }, { EMUCMD_MISC_DISPLAY_OBJ_TOGGLE, EMUCMDTYPE_MISC, ObjectDisplayToggle, 0, 0, "Toggle Object Display", 0 }, { EMUCMD_MISC_DISPLAY_LAGCOUNTER_TOGGLE, EMUCMDTYPE_MISC, LagCounterToggle, 0, 0, "Lag Counter Toggle", 0 }, - { EMUCMD_MISC_LAGCOUNTER_RESET, EMUCMDTYPE_MISC, LagCounterReset, 0, 0, "Lag Counter Reset", 0} - //memory watch, cheat search, debugger, ppu, hex editor, trace logger, code/data logger, + { EMUCMD_MISC_LAGCOUNTER_RESET, EMUCMDTYPE_MISC, LagCounterReset, 0, 0, "Lag Counter Reset", 0}, + { EMUCMD_TOOL_OPENMEMORYWATCH, EMUCMDTYPE_TOOL, LaunchMemoryWatch, 0, 0, "Open Memory Watch", 0}, + { EMUCMD_TOOL_OPENDEBUGGER, EMUCMDTYPE_TOOL, LaunchDebugger, 0, 0, "Open Debugger", 0}, + { EMUCMD_TOOL_OPENHEX, EMUCMDTYPE_TOOL, LaunchHex, 0, 0, "Open Hex Editor", 0}, + { EMUCMD_TOOL_OPENPPU, EMUCMDTYPE_TOOL, LaunchPPU, 0, 0, "Open PPU Viewer", 0}, + { EMUCMD_TOOL_OPENTRACELOGGER, EMUCMDTYPE_TOOL, LaunchTraceLogger, 0, 0, "Open Trace Logger", 0}, + { EMUCMD_TOOL_OPENCDLOGGER, EMUCMDTYPE_TOOL, LaunchCodeDataLogger, 0, 0, "Open Code/Data Logger", 0} }; #define NUM_EMU_CMDS (sizeof(FCEUI_CommandTable)/sizeof(FCEUI_CommandTable[0])) @@ -899,3 +920,45 @@ static void LagCounterToggle(void) { lagCounterDisplay ^= 1; } + +static void LaunchMemoryWatch(void) +{ +#ifdef WIN32 + CreateMemWatch(); +#endif +} + +static void LaunchDebugger(void) +{ +#ifdef WIN32 + DoDebug(0); +#endif +} + +static void LaunchPPU(void) +{ +#ifdef WIN32 + DoPPUView(); +#endif +} + +static void LaunchHex(void) +{ +#ifdef WIN32 + DoMemView(); +#endif +} + +static void LaunchTraceLogger(void) +{ +#ifdef WIN32 + DoTracer(); +#endif +} + +static void LaunchCodeDataLogger(void) +{ +#ifdef WIN32 + DoCDLogger(); +#endif +} \ No newline at end of file diff --git a/src/input.h b/src/input.h index 8ed4c6d6..0043fcfb 100644 --- a/src/input.h +++ b/src/input.h @@ -230,6 +230,12 @@ enum EMUCMD EMUCMD_MISC_DISPLAY_OBJ_TOGGLE, EMUCMD_MISC_DISPLAY_LAGCOUNTER_TOGGLE, EMUCMD_MISC_LAGCOUNTER_RESET, + EMUCMD_TOOL_OPENMEMORYWATCH, //Windows only (currently) + EMUCMD_TOOL_OPENDEBUGGER, + EMUCMD_TOOL_OPENHEX, + EMUCMD_TOOL_OPENPPU, + EMUCMD_TOOL_OPENTRACELOGGER, + EMUCMD_TOOL_OPENCDLOGGER, EMUCMD_MAX }; @@ -244,6 +250,7 @@ enum EMUCMDTYPE EMUCMDTYPE_AVI, EMUCMDTYPE_FDS, EMUCMDTYPE_VSUNI, + EMUCMDTYPE_TOOL, //All Tools type are currenty windows only programs EMUCMDTYPE_MAX };