From b1a3724fda6d7a24b0212ec1b6ddb8305c76e840 Mon Sep 17 00:00:00 2001 From: pagefault <> Date: Fri, 4 Feb 2005 01:46:49 +0000 Subject: [PATCH] This is ZSNES Debugger v0.01, it doesn't do much but it's a start --- zsnes/src/win/winintrf.asm | 4 ++-- zsnes/src/win/winlink.cpp | 24 +++++++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/zsnes/src/win/winintrf.asm b/zsnes/src/win/winintrf.asm index ae95a02a..7e29f2a8 100644 --- a/zsnes/src/win/winintrf.asm +++ b/zsnes/src/win/winintrf.asm @@ -285,8 +285,8 @@ NEWSYM OSExit call exit jmp DosExit -SECTION .bss -NEWSYM TempHandle, resd 1 +SECTION .data +NEWSYM TempHandle, dd 0 SECTION .text NEWSYM Open_File diff --git a/zsnes/src/win/winlink.cpp b/zsnes/src/win/winlink.cpp index 94b6598c..b8ce5803 100644 --- a/zsnes/src/win/winlink.cpp +++ b/zsnes/src/win/winlink.cpp @@ -92,10 +92,8 @@ _asm popad #endif - DWORD WindowWidth = 256; DWORD WindowHeight = 224; - DWORD FullScreen=0; DWORD Moving=0; DWORD SoundBufferSize=1024*18; @@ -111,6 +109,7 @@ DWORD FirstActivate = 1; #define DWORD unsigned long HWND hMainWindow; +HANDLE debugWindow = 0; extern "C" { @@ -203,6 +202,7 @@ extern "C" { int SemaphoreMax = 5; void InitSemaphore(); void ShutdownSemaphore(); +void InitDebugger(); } static char dinput8_dll[] = {"dinput8.dll\0"}; @@ -438,6 +438,7 @@ extern signed short int MainWindowY; extern int CurKeyPos; extern int CurKeyReadPos; extern int KeyBuffer[16]; +extern BYTE debugger; } extern "C" void CheckPriority() @@ -532,6 +533,11 @@ void ExitFunction() asm_call(SaveSramData); asm_call(GUISaveVars); } + + // We need to clean up the debug window if it's running + + if (debugWindow) FreeConsole(); + IsActivated = 0; ReleaseDirectInput(); ReleaseDirectSound(); @@ -2067,6 +2073,9 @@ void initwinvideo(void) InitInput(); InitSound(); TestJoy(); + + if (debugger) InitDebugger(); // Start debugger + } if (FirstVid == 1) @@ -3039,7 +3048,7 @@ void SetMouseY(int Y) void FrameSemaphore() { - if (T60HZEnabled == 1) + if (T60HZEnabled) { double delay; QueryPerformanceCounter((LARGE_INTEGER*)&end); @@ -3058,5 +3067,14 @@ void ZsnesPage() MouseY = 0; } +// This function creates the debug console +void InitDebugger() +{ + if(AllocConsole()) + { + debugWindow = GetStdHandle(STD_OUTPUT_HANDLE); + WriteConsole(debugWindow, "Welcome to the ZSNES Debugger v0.01\n", sizeof("Welcome to the ZSNES Debugger v0.01\n"), NULL, NULL); + } } +}