mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Debugger: Option to skip mem hacks in memory dump.
This commit is contained in:
parent
c1fa4958d9
commit
f66b0ff56c
3 changed files with 40 additions and 14 deletions
|
@ -2,7 +2,9 @@
|
|||
#include <cstdio>
|
||||
#include "Common/Data/Encoding/Utf8.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HLE/ReplaceTables.h"
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/MIPS/JitCommon/JitBlockCache.h"
|
||||
#include "Windows/Debugger/DumpMemoryWindow.h"
|
||||
#include "Windows/resource.h"
|
||||
#include "Windows/W32Util/ShellUtil.h"
|
||||
|
@ -75,27 +77,49 @@ INT_PTR CALLBACK DumpMemoryWindow::dlgFunc(HWND hwnd, UINT iMsg, WPARAM wParam,
|
|||
}
|
||||
break;
|
||||
case IDOK:
|
||||
if (bp->fetchDialogData(hwnd))
|
||||
{
|
||||
if (bp->fetchDialogData(hwnd)) {
|
||||
bool priorDumpWasStepping = Core_IsStepping();
|
||||
if (!priorDumpWasStepping && PSP_IsInited()) {
|
||||
// If emulator isn't paused force paused state, but wait before locking.
|
||||
Core_EnableStepping(true);
|
||||
Core_WaitInactive();
|
||||
}
|
||||
|
||||
auto memLock = Memory::Lock();
|
||||
if (!PSP_IsInited())
|
||||
break;
|
||||
|
||||
FILE *output = _wfopen(bp->fileName_.c_str(), L"wb");
|
||||
if (output == NULL) {
|
||||
if (output == nullptr) {
|
||||
char errorMessage[2048];
|
||||
snprintf(errorMessage, sizeof(errorMessage), "Could not open file \"%S\".", bp->fileName_.c_str());
|
||||
MessageBoxA(hwnd,errorMessage,"Error",MB_OK);
|
||||
MessageBoxA(hwnd, errorMessage, "Error", MB_OK);
|
||||
break;
|
||||
}
|
||||
|
||||
bool priorDumpWasStepping = Core_IsStepping();
|
||||
if (!priorDumpWasStepping) Core_EnableStepping(true); // If emulator isn't paused force paused state
|
||||
fwrite(Memory::GetPointer(bp->start), 1, bp->size, output);
|
||||
|
||||
bool includeReplacements = SendMessage(GetDlgItem(hwnd, IDC_DUMP_INCLUDEHACKS), BM_GETCHECK, 0, 0) != 0;
|
||||
if (includeReplacements) {
|
||||
fwrite(Memory::GetPointer(bp->start), 1, bp->size, output);
|
||||
} else {
|
||||
auto savedReplacements = SaveAndClearReplacements();
|
||||
if (MIPSComp::jit) {
|
||||
auto savedBlocks = MIPSComp::jit->SaveAndClearEmuHackOps();
|
||||
fwrite(Memory::GetPointer(bp->start), 1, bp->size, output);
|
||||
MIPSComp::jit->RestoreSavedEmuHackOps(savedBlocks);
|
||||
} else {
|
||||
fwrite(Memory::GetPointer(bp->start), 1, bp->size, output);
|
||||
}
|
||||
RestoreSavedReplacements(savedReplacements);
|
||||
}
|
||||
|
||||
fclose(output);
|
||||
if (!priorDumpWasStepping) Core_EnableStepping(false); // If emulator wasn't paused before memory dump resume emulation automatically.
|
||||
MessageBoxA(hwnd,"Done.","Information",MB_OK);
|
||||
EndDialog(hwnd,true);
|
||||
if (!priorDumpWasStepping) {
|
||||
// If emulator wasn't paused before memory dump resume emulation automatically.
|
||||
Core_EnableStepping(false);
|
||||
}
|
||||
|
||||
MessageBoxA(hwnd, "Done.", "Information", MB_OK);
|
||||
EndDialog(hwnd, true);
|
||||
}
|
||||
break;
|
||||
case IDCANCEL:
|
||||
|
|
|
@ -376,7 +376,7 @@ BEGIN
|
|||
PUSHBUTTON "Cancel",IDC_BREAKPOINT_CANCEL,186,98,42,14
|
||||
END
|
||||
|
||||
IDD_DUMPMEMORY DIALOGEX 0, 0, 230, 85
|
||||
IDD_DUMPMEMORY DIALOGEX 0, 0, 230, 100
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Dump memory"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
|
@ -393,8 +393,9 @@ BEGIN
|
|||
CONTROL "VRAM",IDC_DUMP_VRAM,"Button",BS_AUTORADIOBUTTON,152,22,35,10
|
||||
CONTROL "Scratchpad",IDC_DUMP_SCRATCHPAD,"Button",BS_AUTORADIOBUTTON,152,34,52,10
|
||||
CONTROL "Custom range",IDC_DUMP_CUSTOMRANGE,"Button",BS_AUTORADIOBUTTON,152,46,61,10
|
||||
DEFPUSHBUTTON "OK",IDOK,117,64,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,173,64,50,14
|
||||
CONTROL "Include jit checks and replacements",IDC_DUMP_INCLUDEHACKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,58,120,14
|
||||
DEFPUSHBUTTON "OK",IDOK,117,79,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,173,79,50,14
|
||||
END
|
||||
|
||||
|
||||
|
|
|
@ -263,6 +263,7 @@
|
|||
#define ID_DISASM_ASSEMBLE 40091
|
||||
#define ID_DISASM_ADDNEWBREAKPOINT 40092
|
||||
#define ID_DISASM_EDITBREAKPOINT 40093
|
||||
#define IDC_DUMP_INCLUDEHACKS 40094
|
||||
#define ID_EMULATION_CHEATS 40096
|
||||
#define ID_HELP_CHINESE_FORUM 40097
|
||||
#define ID_OPTIONS_MORE_SETTINGS 40098
|
||||
|
|
Loading…
Add table
Reference in a new issue