mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +00:00
Remove legacy debugger.
This commit is contained in:
parent
581849944d
commit
0103c92741
|
@ -65,7 +65,6 @@ else(MUPENPLUSAPI)
|
|||
ZilmarPluginAPI.cpp
|
||||
common/ZilmarAPIImpl_common.cpp
|
||||
windows/Config_windows.cpp
|
||||
windows/Debug.cpp
|
||||
windows/CommonAPIImpl_windows.cpp
|
||||
windows/GLideN64_windows.cpp
|
||||
windows/GLFunctions.cpp
|
||||
|
@ -76,7 +75,6 @@ else(MUPENPLUSAPI)
|
|||
ZilmarPluginAPI.cpp
|
||||
common/ZilmarAPIImpl_common.cpp
|
||||
posix/Config_posix.cpp
|
||||
posix/Debug.cpp
|
||||
posix/CommonAPIImpl_posix.cpp
|
||||
posix/OpenGL_posix.cpp
|
||||
posix/ZilmarAPIImpl_posix.cpp
|
||||
|
|
47
Debug.h
47
Debug.h
|
@ -1,53 +1,8 @@
|
|||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
|
||||
#ifdef USE_DEBUG
|
||||
|
||||
#include "Types.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define DEBUG_LOW 0x1000
|
||||
#define DEBUG_MEDIUM 0x2000
|
||||
#define DEBUG_HIGH 0x4000
|
||||
#define DEBUG_DETAIL 0x8000
|
||||
|
||||
#define DEBUG_HANDLED 0x0001
|
||||
#define DEBUG_UNHANDLED 0x0002
|
||||
#define DEBUG_IGNORED 0x0004
|
||||
#define DEBUG_UNKNOWN 0x0008
|
||||
#define DEBUG_ERROR 0x0010
|
||||
#define DEBUG_COMBINE 0x0020
|
||||
#define DEBUG_TEXTURE 0x0040
|
||||
#define DEBUG_VERTEX 0x0080
|
||||
#define DEBUG_TRIANGLE 0x0100
|
||||
#define DEBUG_MATRIX 0x0200
|
||||
|
||||
struct DebugInfo
|
||||
{
|
||||
u16 show, level;
|
||||
u8 detail, paused, step;
|
||||
struct
|
||||
{
|
||||
u32 pci, pc, cmd, w0, w1;
|
||||
} rsp;
|
||||
};
|
||||
|
||||
extern DebugInfo Debug;
|
||||
|
||||
void OpenDebugDlg();
|
||||
void CloseDebugDlg();
|
||||
void DebugRSPState( u32 pci, u32 pc, u32 cmd, u32 w0, u32 w1 );
|
||||
void DebugMsg( u16 type, const char * format, ... );
|
||||
void StartDump( char *filename );
|
||||
void EndDump();
|
||||
|
||||
#else // USE_DEBUG
|
||||
|
||||
// TODO Debug log.
|
||||
#define DebugMsg(A, ...)
|
||||
#define DebugRSPState(A, ...)
|
||||
|
||||
#endif // USE_DEBUG
|
||||
|
||||
void debugPrint(const char * format, ...);
|
||||
|
||||
#endif // DEBUG_H
|
||||
|
|
|
@ -319,10 +319,6 @@
|
|||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_mupenplus|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_mupenplus|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="windows\Debug.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_mupenplus|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_mupenplus|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="windows\GLFunctions.cpp" />
|
||||
<ClCompile Include="windows\GLideN64_windows.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_mupenplus|Win32'">true</ExcludedFromBuild>
|
||||
|
|
|
@ -150,9 +150,6 @@
|
|||
<ClCompile Include="windows\CommonAPIImpl_windows.cpp">
|
||||
<Filter>Source Files\windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="windows\Debug.cpp">
|
||||
<Filter>Source Files\windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="windows\GLFunctions.cpp">
|
||||
<Filter>Source Files\windows</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
#ifdef DEBUG
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../Debug.h"
|
||||
|
||||
DebugInfo Debug;
|
||||
static bool dumpMessages = FALSE;
|
||||
static char dumpFilename[1024];
|
||||
|
||||
void
|
||||
OpenDebugDlg()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CloseDebugDlg()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DebugRSPState( DWORD pci, DWORD pc, DWORD cmd, DWORD w0, DWORD w1 )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DebugMsg( WORD type, LPCSTR format, ... )
|
||||
{
|
||||
char text[1024];
|
||||
|
||||
va_list va;
|
||||
va_start( va, format );
|
||||
vsprintf( text, format, va );
|
||||
va_end( va );
|
||||
|
||||
if (dumpMessages)
|
||||
{
|
||||
FILE *f = fopen( dumpFilename, "a" );
|
||||
if (f != 0)
|
||||
{
|
||||
fprintf( f, text );
|
||||
fclose( f );
|
||||
}
|
||||
}
|
||||
fprintf( stderr, "glN64 Debug: %s", text );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StartDump( char *filename )
|
||||
{
|
||||
dumpMessages = TRUE;
|
||||
strcpy( dumpFilename, filename );
|
||||
FILE *f = fopen( dumpFilename, "w" );
|
||||
if (f != 0)
|
||||
fclose( f );
|
||||
}
|
||||
|
||||
|
||||
void EndDump()
|
||||
{
|
||||
dumpMessages = FALSE;
|
||||
}
|
||||
|
||||
#endif // DEBUG
|
|
@ -1,328 +0,0 @@
|
|||
#if defined(USE_DEBUG) && defined(OS_WINDOWS)
|
||||
|
||||
#include "GLideN64_Windows.h"
|
||||
#include <stdio.h>
|
||||
#include <process.h>
|
||||
#include <RichEdit.h>
|
||||
|
||||
#include "../GLideN64.h"
|
||||
#include "../Debug.h"
|
||||
#include "../resource.h"
|
||||
#include "../RDP.h"
|
||||
#include "../RSP.h"
|
||||
|
||||
DebugInfo Debug;
|
||||
|
||||
CHARFORMAT handledFormat =
|
||||
{
|
||||
sizeof( CHARFORMAT ),
|
||||
CFM_BOLD | CFM_COLOR | CFM_FACE | CFM_ITALIC | CFM_SIZE,
|
||||
NULL,
|
||||
200,
|
||||
0,
|
||||
RGB( 0, 0, 0 ),
|
||||
NULL,
|
||||
NULL,
|
||||
(TCHAR*)"Courier New"
|
||||
};
|
||||
|
||||
CHARFORMAT unknownFormat =
|
||||
{
|
||||
sizeof( CHARFORMAT ),
|
||||
CFM_BOLD | CFM_COLOR | CFM_FACE | CFM_ITALIC | CFM_SIZE,
|
||||
NULL,
|
||||
200,
|
||||
0,
|
||||
RGB( 128, 128, 0 ),
|
||||
NULL,
|
||||
NULL,
|
||||
(TCHAR*)"Courier New"
|
||||
};
|
||||
|
||||
CHARFORMAT errorFormat =
|
||||
{
|
||||
sizeof( CHARFORMAT ),
|
||||
CFM_BOLD | CFM_COLOR | CFM_FACE | CFM_ITALIC | CFM_SIZE,
|
||||
NULL,
|
||||
200,
|
||||
0,
|
||||
RGB( 128, 0, 0 ),
|
||||
NULL,
|
||||
NULL,
|
||||
(TCHAR*)"Courier New"
|
||||
};
|
||||
|
||||
CHARFORMAT detailFormat =
|
||||
{
|
||||
sizeof( CHARFORMAT ),
|
||||
CFM_BOLD | CFM_COLOR | CFM_FACE | CFM_ITALIC | CFM_SIZE,
|
||||
NULL,
|
||||
200,
|
||||
0,
|
||||
RGB( 0, 128, 0 ),
|
||||
NULL,
|
||||
NULL,
|
||||
(TCHAR*)"Courier New"
|
||||
};
|
||||
|
||||
HWND hDebugDlg;
|
||||
BOOL DumpMessages;
|
||||
FILE *dumpFile;
|
||||
char dumpFilename[256];
|
||||
|
||||
BOOL CALLBACK DebugDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
SendDlgItemMessage( hDlg, IDC_DEBUGEDIT, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&handledFormat );
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
/* case IDC_DUMP:
|
||||
RSP.dumpNextDL = TRUE;
|
||||
return TRUE;
|
||||
case IDC_VERIFYCACHE:
|
||||
if (!TextureCache_Verify())
|
||||
MessageBox( NULL, "Texture cache chain is currupted!", "glNintendo64()", MB_OK );
|
||||
else
|
||||
MessageBox( NULL, "Texture cache chain verified", "glNintendo64()", MB_OK );
|
||||
return TRUE;*/
|
||||
case IDC_DEBUGDETAIL:
|
||||
Debug.detail = (SendDlgItemMessage( hDlg, IDC_DEBUGDETAIL, BM_GETCHECK, NULL, NULL ) == BST_CHECKED);
|
||||
break;
|
||||
case IDC_DEBUGHIGH:
|
||||
if (SendDlgItemMessage( hDlg, IDC_DEBUGHIGH, BM_GETCHECK, NULL, NULL ) == BST_CHECKED)
|
||||
Debug.level = DEBUG_HIGH;
|
||||
break;
|
||||
case IDC_DEBUGMEDIUM:
|
||||
if (SendDlgItemMessage( hDlg, IDC_DEBUGMEDIUM, BM_GETCHECK, NULL, NULL ) == BST_CHECKED)
|
||||
Debug.level = DEBUG_MEDIUM;
|
||||
break;
|
||||
case IDC_DEBUGLOW:
|
||||
if (SendDlgItemMessage( hDlg, IDC_DEBUGLOW, BM_GETCHECK, NULL, NULL ) == BST_CHECKED)
|
||||
Debug.level = DEBUG_LOW;
|
||||
break;
|
||||
case IDC_SHOWHANDLED:
|
||||
if (SendDlgItemMessage( hDlg, IDC_SHOWHANDLED, BM_GETCHECK, NULL, NULL ) == BST_CHECKED)
|
||||
Debug.show |= DEBUG_HANDLED;
|
||||
else
|
||||
Debug.show &= ~DEBUG_HANDLED;
|
||||
break;
|
||||
case IDC_SHOWUNHANDLED:
|
||||
if (SendDlgItemMessage( hDlg, IDC_SHOWUNHANDLED, BM_GETCHECK, NULL, NULL ) == BST_CHECKED)
|
||||
Debug.show |= DEBUG_UNHANDLED;
|
||||
else
|
||||
Debug.show &= ~DEBUG_UNHANDLED;
|
||||
break;
|
||||
case IDC_SHOWUNKNOWN:
|
||||
if (SendDlgItemMessage( hDlg, IDC_SHOWUNKNOWN, BM_GETCHECK, NULL, NULL ) == BST_CHECKED)
|
||||
Debug.show |= DEBUG_UNKNOWN;
|
||||
else
|
||||
Debug.show &= ~DEBUG_UNKNOWN;
|
||||
break;
|
||||
case IDC_SHOWIGNORED:
|
||||
if (SendDlgItemMessage( hDlg, IDC_SHOWIGNORED, BM_GETCHECK, NULL, NULL ) == BST_CHECKED)
|
||||
Debug.show |= DEBUG_IGNORED;
|
||||
else
|
||||
Debug.show &= ~DEBUG_IGNORED;
|
||||
break;
|
||||
case IDC_SHOWERRORS:
|
||||
if (SendDlgItemMessage( hDlg, IDC_SHOWERRORS, BM_GETCHECK, NULL, NULL ) == BST_CHECKED)
|
||||
Debug.show |= DEBUG_ERROR;
|
||||
else
|
||||
Debug.show &= ~DEBUG_ERROR;
|
||||
break;
|
||||
case IDC_SHOWCOMBINE:
|
||||
if (SendDlgItemMessage( hDlg, IDC_SHOWCOMBINE, BM_GETCHECK, NULL, NULL ) == BST_CHECKED)
|
||||
Debug.show |= DEBUG_COMBINE;
|
||||
else
|
||||
Debug.show &= ~DEBUG_COMBINE;
|
||||
break;
|
||||
case IDC_SHOWTEXTURE:
|
||||
if (SendDlgItemMessage( hDlg, IDC_SHOWTEXTURE, BM_GETCHECK, NULL, NULL ) == BST_CHECKED)
|
||||
Debug.show |= DEBUG_TEXTURE;
|
||||
else
|
||||
Debug.show &= ~DEBUG_TEXTURE;
|
||||
break;
|
||||
case IDC_SHOWVERTEX:
|
||||
if (SendDlgItemMessage( hDlg, IDC_SHOWVERTEX, BM_GETCHECK, NULL, NULL ) == BST_CHECKED)
|
||||
Debug.show |= DEBUG_VERTEX;
|
||||
else
|
||||
Debug.show &= ~DEBUG_VERTEX;
|
||||
break;
|
||||
case IDC_SHOWTRIANGLE:
|
||||
if (SendDlgItemMessage( hDlg, IDC_SHOWTRIANGLE, BM_GETCHECK, NULL, NULL ) == BST_CHECKED)
|
||||
Debug.show |= DEBUG_TRIANGLE;
|
||||
else
|
||||
Debug.show &= ~DEBUG_TRIANGLE;
|
||||
break;
|
||||
case IDC_SHOWMATRIX:
|
||||
if (SendDlgItemMessage( hDlg, IDC_SHOWMATRIX, BM_GETCHECK, NULL, NULL ) == BST_CHECKED)
|
||||
Debug.show |= DEBUG_MATRIX;
|
||||
else
|
||||
Debug.show &= ~DEBUG_MATRIX;
|
||||
break;
|
||||
case IDC_DUMP:
|
||||
if (SendDlgItemMessage( hDlg, IDC_DUMP, BM_GETCHECK, NULL, NULL ) == BST_CHECKED)
|
||||
StartDump("GLideN64.log");
|
||||
else
|
||||
EndDump();
|
||||
break;
|
||||
case IDC_PAUSE:
|
||||
Debug.paused = TRUE;
|
||||
break;
|
||||
case IDC_RUN:
|
||||
Debug.paused = FALSE;
|
||||
break;
|
||||
case IDC_STEP:
|
||||
Debug.step = TRUE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage( 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void DebugDlgThreadFunc( void* )
|
||||
{
|
||||
LoadLibrary( "RichEd20.dll" );
|
||||
hDebugDlg = CreateDialog( hInstance, MAKEINTRESOURCE(IDD_DEBUGDLG), hWnd, DebugDlgProc );
|
||||
|
||||
MSG msg;
|
||||
|
||||
while (GetMessage( &msg, hDebugDlg, 0, 0 ) != 0)
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenDebugDlg()
|
||||
{
|
||||
DumpMessages = FALSE;
|
||||
/* hDebugDlg = CreateDialog( hInstance, MAKEINTRESOURCE(IDD_DEBUGDLG), NULL, DebugDlgProc );
|
||||
|
||||
MSG msg;
|
||||
|
||||
while (GetMessage( &msg, NULL, 0, 0)
|
||||
{
|
||||
if (IsWindow(hwndGoto)
|
||||
IsDialogMessage( hwndGoto, &msg );
|
||||
}
|
||||
_endthread();*/
|
||||
_beginthread( DebugDlgThreadFunc, 255, NULL );
|
||||
}
|
||||
|
||||
void CloseDebugDlg()
|
||||
{
|
||||
DestroyWindow( hDebugDlg );
|
||||
}
|
||||
|
||||
void StartDump( char *filename )
|
||||
{
|
||||
DumpMessages = TRUE;
|
||||
strcpy( dumpFilename, filename );
|
||||
dumpFile = fopen( filename, "w" );
|
||||
fclose( dumpFile );
|
||||
}
|
||||
|
||||
void EndDump()
|
||||
{
|
||||
DumpMessages = FALSE;
|
||||
fclose( dumpFile );
|
||||
}
|
||||
|
||||
void DebugRSPState( u32 pci, u32 pc, u32 cmd, u32 w0, u32 w1 )
|
||||
{
|
||||
Debug.rsp.pci = pci;
|
||||
Debug.rsp.pc = pc;
|
||||
Debug.rsp.cmd = cmd;
|
||||
Debug.rsp.w0 = w0;
|
||||
Debug.rsp.w1 = w1;
|
||||
}
|
||||
|
||||
void DebugMsg( u16 type, const char * format, ... )
|
||||
{
|
||||
char text[256];
|
||||
|
||||
va_list va;
|
||||
va_start( va, format );
|
||||
|
||||
if (DumpMessages)
|
||||
{
|
||||
dumpFile = fopen( dumpFilename, "a+" );
|
||||
vfprintf( dumpFile, format, va );
|
||||
fclose( dumpFile );
|
||||
}
|
||||
|
||||
if ((((type & DEBUG_DETAIL) && Debug.detail) || ((type & 0xF000) == Debug.level)) && (type & 0x0FFF & Debug.show))
|
||||
{
|
||||
for (u32 i = 0; i < 4 * RSP.PCi; i++)
|
||||
text[i] = ' ';
|
||||
|
||||
vsprintf( text + 4 * RSP.PCi, format, va );
|
||||
|
||||
LRESULT length = SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, WM_GETTEXTLENGTH, 0, 0 );
|
||||
LRESULT lengthLimit = SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, EM_GETLIMITTEXT, 0, 0 );
|
||||
|
||||
if ((length + strlen( text )) > lengthLimit)
|
||||
{
|
||||
LRESULT lineLength = SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, EM_LINELENGTH, 0, 0 );
|
||||
SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, EM_SETSEL, 0, lineLength + 1 );
|
||||
SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)"" );
|
||||
}
|
||||
|
||||
SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, EM_SETSEL, length, length );
|
||||
|
||||
if (type & DEBUG_DETAIL)
|
||||
SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&detailFormat );
|
||||
else if (type & DEBUG_ERROR)
|
||||
SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&errorFormat );
|
||||
else if (type & DEBUG_UNKNOWN)
|
||||
SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&unknownFormat );
|
||||
else
|
||||
SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&handledFormat );
|
||||
|
||||
SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)text );
|
||||
SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, EM_LINESCROLL, 0, 1 );
|
||||
|
||||
sprintf( text, "%02X", Debug.rsp.pci );
|
||||
SendDlgItemMessage( hDebugDlg, IDC_PCI, WM_SETTEXT, NULL, (LPARAM)text );
|
||||
|
||||
sprintf( text, "%08X", Debug.rsp.pc );
|
||||
SendDlgItemMessage( hDebugDlg, IDC_PC, WM_SETTEXT, NULL, (LPARAM)text );
|
||||
|
||||
sprintf( text, "%02X", Debug.rsp.cmd );
|
||||
SendDlgItemMessage( hDebugDlg, IDC_CMD, WM_SETTEXT, NULL, (LPARAM)text );
|
||||
|
||||
sprintf( text, "%08X", Debug.rsp.w0 );
|
||||
SendDlgItemMessage( hDebugDlg, IDC_W0, WM_SETTEXT, NULL, (LPARAM)text );
|
||||
|
||||
sprintf( text, "%08X", Debug.rsp.w1 );
|
||||
SendDlgItemMessage( hDebugDlg, IDC_W1, WM_SETTEXT, NULL, (LPARAM)text );
|
||||
}
|
||||
va_end( va );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef OS_WINDOWS
|
||||
#include "GLideN64_Windows.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void debugPrint(const char * format, ...)
|
||||
{
|
||||
char text[256];
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
vsprintf(text, format, va);
|
||||
OutputDebugString(text);
|
||||
}
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user