Add an initial GE debugger interface on Windows.

This commit is contained in:
Unknown W. Brackets 2013-09-22 10:27:09 -07:00
parent 3787471791
commit 18b70c89ef
10 changed files with 172 additions and 2 deletions

View File

@ -0,0 +1,94 @@
// Copyright (c) 2012- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "native/base/mutex.h"
#include "Windows/Debugger/GEDebugger.h"
#include "Windows/WindowsHost.h"
#include "GPU/GPUInterface.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUState.h"
static bool attached = false;
// TODO
static bool textureCaching = true;
static recursive_mutex pauseLock;
static condition_variable pauseWait;
static bool breakNext = false;
CGEDebugger::CGEDebugger(HINSTANCE _hInstance, HWND _hParent)
: Dialog((LPCSTR)IDD_GEDEBUGGER, _hInstance, _hParent) {
}
BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
switch (message) {
case WM_INITDIALOG:
return TRUE;
case WM_SIZE:
// TODO
return TRUE;
case WM_CLOSE:
Show(false);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_GEDBG_BREAK:
attached = true;
breakNext = true;
break;
case IDC_GEDBG_RESUME:
// TODO: detach? Should probably have separate UI, or just on activate?
breakNext = false;
pauseWait.notify_one();
break;
}
}
return FALSE;
}
// The below WindowsHost methods are called on the GPU thread.
bool WindowsHost::GPUDebuggingActive() {
return attached;
}
void WindowsHost::GPUNotifyCommand(u32 pc) {
if (breakNext) {
auto info = gpuDebug->DissassembleOp(pc);
NOTICE_LOG(HLE, "waiting at %08x, %s", pc, info.desc.c_str());
lock_guard guard(pauseLock);
pauseWait.wait(pauseLock);
}
}
void WindowsHost::GPUNotifyDisplay(u32 framebuf, u32 stride, int format) {
}
void WindowsHost::GPUNotifyDraw() {
}
void WindowsHost::GPUNotifyTextureAttachment(u32 addr) {
}
bool WindowsHost::GPUAllowTextureCache(u32 addr) {
return textureCaching;
}

View File

@ -0,0 +1,31 @@
// Copyright (c) 2012- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#pragma once
#include "Common/CommonWindows.h"
#include "Globals.h"
#include "Windows/resource.h"
#include "Windows/W32Util/DialogManager.h"
class CGEDebugger : public Dialog {
public:
CGEDebugger(HINSTANCE _hInstance, HWND _hParent);
protected:
BOOL DlgProc(UINT message, WPARAM wParam, LPARAM lParam);
};

View File

@ -279,6 +279,7 @@
<ClCompile Include="Debugger\Debugger_Lists.cpp" />
<ClCompile Include="Debugger\Debugger_MemoryDlg.cpp" />
<ClCompile Include="Debugger\Debugger_VFPUDlg.cpp" />
<ClCompile Include="Debugger\GEDebugger.cpp" />
<ClCompile Include="DinputDevice.cpp" />
<ClCompile Include="EmuThread.cpp" />
<ClCompile Include="InputDevice.cpp" />
@ -320,6 +321,7 @@
<ClInclude Include="Debugger\Debugger_Lists.h" />
<ClInclude Include="Debugger\Debugger_MemoryDlg.h" />
<ClInclude Include="Debugger\Debugger_VFPUDlg.h" />
<ClInclude Include="Debugger\GEDebugger.h" />
<ClInclude Include="DinputDevice.h" />
<ClInclude Include="EmuThread.h" />
<ClInclude Include="InputDevice.h" />

View File

@ -110,6 +110,9 @@
<ClCompile Include="Debugger\Debugger_Lists.cpp">
<Filter>Windows\Debugger</Filter>
</ClCompile>
<ClCompile Include="Debugger\GEDebugger.cpp">
<Filter>Windows\Debugger</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Debugger\CtrlDisAsmView.h">
@ -197,6 +200,9 @@
<ClInclude Include="Debugger\Debugger_Lists.h">
<Filter>Windows\Debugger</Filter>
</ClInclude>
<ClInclude Include="Debugger\GEDebugger.h">
<Filter>Windows\Debugger</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="icon1.ico">

View File

@ -56,6 +56,13 @@ public:
void SaveSymbolMap();
void SetWindowTitle(const char *message);
virtual bool GPUDebuggingActive();
virtual void GPUNotifyCommand(u32 pc);
virtual void GPUNotifyDisplay(u32 framebuf, u32 stride, int format);
virtual void GPUNotifyDraw();
virtual void GPUNotifyTextureAttachment(u32 addr);
virtual bool GPUAllowTextureCache(u32 addr);
virtual bool CanCreateShortcut() {return false;} // Turn on when fixed
virtual bool CreateDesktopShortcut(std::string argumentPath, std::string title);

View File

@ -38,6 +38,7 @@
#include "Windows/OpenGLBase.h"
#include "Windows/Debugger/Debugger_Disasm.h"
#include "Windows/Debugger/Debugger_MemoryDlg.h"
#include "Windows/Debugger/GEDebugger.h"
#include "main.h"
#include "Core/Core.h"
@ -499,6 +500,7 @@ namespace MainWindow
TranslateMenuItem(ID_DEBUG_IGNOREILLEGALREADS);
TranslateMenuItem(ID_DEBUG_RUNONLOAD);
TranslateMenuItem(ID_DEBUG_DISASSEMBLY, L"\tCtrl+D");
TranslateMenuItem(ID_DEBUG_GEDEBUGGER);
TranslateMenuItem(ID_DEBUG_LOG, L"\tCtrl+L");
TranslateMenuItem(ID_DEBUG_MEMORYVIEW, L"\tCtrl+M");
@ -739,6 +741,9 @@ namespace MainWindow
DialogManager::AddDlg(disasmWindow[0]);
disasmWindow[0]->Show(g_Config.bShowDebuggerOnLoad);
geDebuggerWindow = new CGEDebugger(MainWindow::GetHInstance(), MainWindow::GetHWND());
DialogManager::AddDlg(geDebuggerWindow);
memoryWindow[0] = new CMemoryDlg(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
DialogManager::AddDlg(memoryWindow[0]);
}
@ -1268,6 +1273,10 @@ namespace MainWindow
disasmWindow[0]->Show(true);
break;
case ID_DEBUG_GEDEBUGGER:
geDebuggerWindow->Show(true);
break;
case ID_DEBUG_MEMORYVIEW:
memoryWindow[0]->Show(true);
break;

View File

@ -37,8 +37,10 @@
#include "Windows/resource.h"
#include "Windows/WndMainWindow.h"
#include "Windows/Debugger/Debugger_Disasm.h"
#include "Windows/Debugger/Debugger_MemoryDlg.h"
#include "Windows/Debugger/Debugger_VFPUDlg.h"
#include "Windows/Debugger/GEDebugger.h"
#include "Windows/W32Util/DialogManager.h"
@ -50,6 +52,7 @@
#include "Windows/main.h"
CDisasm *disasmWindow[MAX_CPUCOUNT] = {0};
CGEDebugger *geDebuggerWindow = 0;
CMemoryDlg *memoryWindow[MAX_CPUCOUNT] = {0};
static std::string langRegion;

View File

@ -20,12 +20,14 @@
#include "Debugger/Debugger_Disasm.h"
#include "Debugger/Debugger_MemoryDlg.h"
#include "Windows/Debugger/GEDebugger.h"
#include "Common/CommonWindows.h"
#define MAX_CPUCOUNT 1
extern CDisasm *disasmWindow[MAX_CPUCOUNT];
extern CGEDebugger *geDebuggerWindow ;
extern CMemoryDlg *memoryWindow[MAX_CPUCOUNT];
extern HMENU g_hPopupMenus;

View File

@ -163,6 +163,17 @@ BEGIN
CONTROL "",IDC_STACKFRAMES,"SysListView32",LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_REPORT | WS_BORDER,1,338,513,93
END
IDD_GEDEBUGGER DIALOGEX 0, 0, 500, 400
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_ACCEPTFILES | WS_EX_TOOLWINDOW
CAPTION "GE"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
PUSHBUTTON "Break",IDC_GEDBG_BREAK,0,0,48,14
PUSHBUTTON "Resume",IDC_GEDBG_RESUME,52,0,48,14
CTEXT "Not yet implemented",IDC_STATIC,20,100,460,14
END
#include "aboutbox.rc"
IDD_MEMORY DIALOGEX 0, 0, 566, 287
@ -341,6 +352,7 @@ BEGIN
MENUITEM "Run on Load", ID_DEBUG_RUNONLOAD
MENUITEM SEPARATOR
MENUITEM "Disassembly", ID_DEBUG_DISASSEMBLY
MENUITEM "GE Debugger...", ID_DEBUG_GEDEBUGGER
MENUITEM "Log Console", ID_DEBUG_LOG
MENUITEM "Memory View...", ID_DEBUG_MEMORYVIEW
END

View File

@ -76,6 +76,7 @@
#define ID_DEBUG_DSIPLAYREGISTERLIST 247
#define ID_DEBUG_DSIPLAYFUNCTIONLIST 248
#define ID_MEMVIEW_COPYADDRESS 249
#define IDD_GEDEBUGGER 250
#define IDC_STOPGO 1001
#define IDC_ADDRESS 1002
@ -257,6 +258,9 @@
#define ID_OPTIONS_SCREEN8X 40113
#define ID_OPTIONS_SCREEN9X 40114
#define ID_OPTIONS_SCREEN10X 40115
#define ID_DEBUG_GEDEBUGGER 40116
#define IDC_GEDBG_BREAK 40117
#define IDC_GEDBG_RESUME 40118
// Dummy option to let the buffered rendering hotkey cycle through all the options.
#define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500
@ -268,8 +272,8 @@
// Next default values for new objects
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 236
#define _APS_NEXT_COMMAND_VALUE 40193
#define _APS_NEXT_RESOURCE_VALUE 251
#define _APS_NEXT_COMMAND_VALUE 40119
#define _APS_NEXT_CONTROL_VALUE 1181
#define _APS_NEXT_SYMED_VALUE 101
#endif