Permalink
Browse files

Merge pull request #11208 from unknownbrackets/ui-break

Windows: Separate Pause and Break actions
  • Loading branch information...
hrydgard committed Jun 23, 2018
2 parents 9f307fd + 265611c commit 1b97821f36f602339a2dad4ed31f69b2de6b6d62
@@ -56,7 +56,7 @@ struct CoreParameter {
std::string mountRoot; // If non-empty, and fileToStart is an ELF or PBP, mount this as host0: / umd0:.
std::string errorString;
bool startPaused;
bool startBreak;
bool printfEmuLog; // writes "emulator:" logging to stdout
std::string *collectEmuLog;
bool headLess; // Try to avoid messageboxes etc
@@ -260,7 +260,7 @@ bool Load_PSP_ISO(FileLoader *fileLoader, std::string *error_string) {
// TODO: We can't use the initial error_string pointer.
bool success = __KernelLoadExec(bootpath.c_str(), 0, &PSP_CoreParameter().errorString);
if (success && coreState == CORE_POWERUP) {
coreState = PSP_CoreParameter().startPaused ? CORE_STEPPING : CORE_RUNNING;
coreState = PSP_CoreParameter().startBreak ? CORE_STEPPING : CORE_RUNNING;
} else {
coreState = CORE_ERROR;
// TODO: This is a crummy way to communicate the error...
@@ -375,7 +375,7 @@ bool Load_PSP_ELF_PBP(FileLoader *fileLoader, std::string *error_string) {
std::thread th([finalName] {
bool success = __KernelLoadExec(finalName.c_str(), 0, &PSP_CoreParameter().errorString);
if (success && coreState == CORE_POWERUP) {
coreState = PSP_CoreParameter().startPaused ? CORE_STEPPING : CORE_RUNNING;
coreState = PSP_CoreParameter().startBreak ? CORE_STEPPING : CORE_RUNNING;
} else {
coreState = CORE_ERROR;
// TODO: This is a crummy way to communicate the error...
@@ -393,7 +393,7 @@ bool Load_PSP_GE_Dump(FileLoader *fileLoader, std::string *error_string) {
std::thread th([] {
bool success = __KernelLoadGEDump("disc0:/data.ppdmp", &PSP_CoreParameter().errorString);
if (success && coreState == CORE_POWERUP) {
coreState = PSP_CoreParameter().startPaused ? CORE_STEPPING : CORE_RUNNING;
coreState = PSP_CoreParameter().startBreak ? CORE_STEPPING : CORE_RUNNING;
} else {
coreState = CORE_ERROR;
// TODO: This is a crummy way to communicate the error...
@@ -224,7 +224,7 @@ void EmuScreen::bootGame(const std::string &filename) {
coreParam.fileToStart = filename;
coreParam.mountIso = "";
coreParam.mountRoot = "";
coreParam.startPaused = false;
coreParam.startBreak = !g_Config.bAutoRun;
coreParam.printfEmuLog = false;
coreParam.headLess = false;
@@ -393,10 +393,9 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
CtrlRegisterList *reglist = CtrlRegisterList::getFrom(GetDlgItem(m_hDlg,IDC_REGLIST));
switch(LOWORD(wParam))
{
case ID_TOGGLE_PAUSE:
SendMessage(MainWindow::GetHWND(),WM_COMMAND,ID_TOGGLE_PAUSE,0);
switch (LOWORD(wParam)) {
case ID_TOGGLE_BREAK:
SendMessage(MainWindow::GetHWND(), WM_COMMAND, ID_TOGGLE_BREAK, 0);
break;
case ID_DEBUG_DISPLAYMEMVIEW:
@@ -842,7 +841,7 @@ void CDisasm::SetDebugMode(bool _bDebug, bool switchPC)
if (GetUIState() == UISTATE_INGAME && PSP_IsInited())
{
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Stop");
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Break");
EnableWindow(GetDlgItem(hDlg, IDC_STOPGO), TRUE);
}
else
@@ -60,10 +60,11 @@ namespace MainWindow {
EnableMenuItem(menu, ID_FILE_LOADSTATEFILE, menuEnable);
EnableMenuItem(menu, ID_FILE_QUICKSAVESTATE, menuEnable);
EnableMenuItem(menu, ID_FILE_QUICKLOADSTATE, menuEnable);
EnableMenuItem(menu, ID_TOGGLE_PAUSE, menuEnable);
EnableMenuItem(menu, ID_EMULATION_PAUSE, menuEnable);
EnableMenuItem(menu, ID_EMULATION_STOP, menuEnable);
EnableMenuItem(menu, ID_EMULATION_RESET, menuEnable);
EnableMenuItem(menu, ID_EMULATION_SWITCH_UMD, umdSwitchEnable);
EnableMenuItem(menu, ID_TOGGLE_BREAK, menuEnable);
EnableMenuItem(menu, ID_DEBUG_LOADMAPFILE, menuEnable);
EnableMenuItem(menu, ID_DEBUG_SAVEMAPFILE, menuEnable);
EnableMenuItem(menu, ID_DEBUG_LOADSYMFILE, menuEnable);
@@ -270,7 +271,7 @@ namespace MainWindow {
TranslateMenuItem(menu, ID_FILE_EXIT, L"\tAlt+F4");
// Emulation menu
TranslateMenuItem(menu, ID_TOGGLE_PAUSE, L"\tF8", "Pause");
TranslateMenuItem(menu, ID_EMULATION_PAUSE);
TranslateMenuItem(menu, ID_EMULATION_STOP, L"\tCtrl+W");
TranslateMenuItem(menu, ID_EMULATION_RESET, L"\tCtrl+B");
TranslateMenuItem(menu, ID_EMULATION_SWITCH_UMD, L"\tCtrl+U", "Switch UMD");
@@ -281,16 +282,17 @@ namespace MainWindow {
TranslateMenuItem(menu, ID_EMULATION_ROTATION_V_R);
// Debug menu
TranslateMenuItem(menu, ID_TOGGLE_BREAK, L"\tF8", "Break");
TranslateMenuItem(menu, ID_DEBUG_BREAKONLOAD);
TranslateMenuItem(menu, ID_DEBUG_IGNOREILLEGALREADS);
TranslateMenuItem(menu, ID_DEBUG_LOADMAPFILE);
TranslateMenuItem(menu, ID_DEBUG_SAVEMAPFILE);
TranslateMenuItem(menu, ID_DEBUG_LOADSYMFILE);
TranslateMenuItem(menu, ID_DEBUG_SAVESYMFILE);
TranslateMenuItem(menu, ID_DEBUG_RESETSYMBOLTABLE);
TranslateMenuItem(menu, ID_DEBUG_DUMPNEXTFRAME);
TranslateMenuItem(menu, ID_DEBUG_TAKESCREENSHOT, L"\tF12");
TranslateMenuItem(menu, ID_DEBUG_DUMPNEXTFRAME);
TranslateMenuItem(menu, ID_DEBUG_SHOWDEBUGSTATISTICS);
TranslateMenuItem(menu, ID_DEBUG_IGNOREILLEGALREADS);
TranslateMenuItem(menu, ID_DEBUG_RUNONLOAD);
TranslateMenuItem(menu, ID_DEBUG_DISASSEMBLY, L"\tCtrl+D");
TranslateMenuItem(menu, ID_DEBUG_GEDEBUGGER, L"\tCtrl+G");
TranslateMenuItem(menu, ID_DEBUG_EXTRACTFILE);
@@ -582,7 +584,7 @@ namespace MainWindow {
ShellExecute(NULL, L"open", ConvertUTF8ToWString(g_Config.memStickDirectory).c_str(), 0, 0, SW_SHOW);
break;
case ID_TOGGLE_PAUSE:
case ID_TOGGLE_BREAK:
if (GetUIState() == UISTATE_PAUSEMENU) {
// Causes hang
//NativeMessageReceived("run", "");
@@ -603,6 +605,11 @@ namespace MainWindow {
noFocusPause = !noFocusPause; // If we pause, override pause on lost focus
break;
case ID_EMULATION_PAUSE:
NativeMessageReceived("pause", "");
Core_EnableStepping(false);
break;
case ID_EMULATION_STOP:
if (Core_IsStepping())
Core_EnableStepping(false);
@@ -821,7 +828,7 @@ namespace MainWindow {
PostMessage(hWnd, WM_CLOSE, 0, 0);
break;
case ID_DEBUG_RUNONLOAD:
case ID_DEBUG_BREAKONLOAD:
g_Config.bAutoRun = !g_Config.bAutoRun;
break;
@@ -1055,7 +1062,7 @@ namespace MainWindow {
CHECKITEM(ID_DEBUG_IGNOREILLEGALREADS, g_Config.bIgnoreBadMemAccess);
CHECKITEM(ID_DEBUG_SHOWDEBUGSTATISTICS, g_Config.bShowDebugStats);
CHECKITEM(ID_OPTIONS_HARDWARETRANSFORM, g_Config.bHardwareTransform);
CHECKITEM(ID_DEBUG_RUNONLOAD, g_Config.bAutoRun);
CHECKITEM(ID_DEBUG_BREAKONLOAD, !g_Config.bAutoRun);
CHECKITEM(ID_OPTIONS_VERTEXCACHE, g_Config.bVertexCache);
CHECKITEM(ID_OPTIONS_SHOWFPS, g_Config.iShowFPSCounter);
CHECKITEM(ID_OPTIONS_FRAMESKIP_AUTO, g_Config.bAutoFrameSkip);
@@ -1322,7 +1329,7 @@ namespace MainWindow {
lastGlobalUIState = GetUIState();
bool isPaused = Core_IsStepping() && GetUIState() == UISTATE_INGAME;
TranslateMenuItem(menu, ID_TOGGLE_PAUSE, L"\tF8", isPaused ? "Run" : "Pause");
TranslateMenuItem(menu, ID_TOGGLE_BREAK, L"\tF8", isPaused ? "Run" : "Break");
}
// Message handler for about box.
@@ -244,7 +244,6 @@ void WindowsHost::BootDone() {
PostMessage(mainWindow_, WM_USER + 1, 0, 0);
SetDebugMode(!g_Config.bAutoRun);
Core_EnableStepping(!g_Config.bAutoRun);
}
static std::string SymbolMapFilename(const char *currentFilename, const char* ext) {
@@ -79,7 +79,7 @@ BEGIN
"1", ID_OPTIONS_RESOLUTIONDUMMY, VIRTKEY, CONTROL, NOINVERT
VK_F7, ID_OPTIONS_FRAMESKIPDUMMY, VIRTKEY, NOINVERT
VK_F12, ID_DEBUG_TAKESCREENSHOT, VIRTKEY, NOINVERT
VK_F8, ID_TOGGLE_PAUSE, VIRTKEY, NOINVERT
VK_F8, ID_TOGGLE_BREAK, VIRTKEY, NOINVERT
VK_RETURN, ID_OPTIONS_FULLSCREEN, ALT, VIRTKEY, NOINVERT
VK_F11, ID_OPTIONS_FULLSCREEN, VIRTKEY, NOINVERT
END
@@ -94,7 +94,7 @@ BEGIN
"2", ID_DEBUG_DISPLAYBREAKPOINTLIST, VIRTKEY, CONTROL, NOINVERT
"3", ID_DEBUG_DISPLAYTHREADLIST, VIRTKEY, CONTROL, NOINVERT
"4", ID_DEBUG_DISPLAYSTACKFRAMELIST, VIRTKEY, CONTROL, NOINVERT
VK_F7, ID_TOGGLE_PAUSE, VIRTKEY, NOINVERT
VK_F7, ID_TOGGLE_BREAK, VIRTKEY, NOINVERT
VK_F8, ID_DEBUG_STEPOUT, VIRTKEY, NOINVERT
VK_F9, ID_DEBUG_RUNTOLINE, VIRTKEY, NOINVERT
VK_F10, ID_DEBUG_STEPOVER, VIRTKEY, NOINVERT
@@ -179,13 +179,13 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
LTEXT "Ctr:",IDC_STATIC,6,2,12,8
EDITTEXT IDC_DEBUG_COUNT,30,2,39,12,ES_UPPERCASE | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
PUSHBUTTON "Stop",IDC_STOPGO,111,0,24,14
PUSHBUTTON "Step Into",IDC_STEP,143,0,39,14
PUSHBUTTON "Step Over",IDC_STEPOVER,183,0,40,14
PUSHBUTTON "Step Out",IDC_STEPOUT,224,0,40,14
PUSHBUTTON "Next HLE",IDC_STEPHLE,272,0,40,14
PUSHBUTTON "Breakpoint",IDC_MEMCHECK,313,0,45,14
EDITTEXT IDC_THREADNAME,366,3,150,10,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
PUSHBUTTON "Break",IDC_STOPGO,111,0,28,14
PUSHBUTTON "Step Into",IDC_STEP,147,0,39,14
PUSHBUTTON "Step Over",IDC_STEPOVER,187,0,40,14
PUSHBUTTON "Step Out",IDC_STEPOUT,228,0,40,14
PUSHBUTTON "Next HLE",IDC_STEPHLE,276,0,40,14
PUSHBUTTON "Breakpoint",IDC_MEMCHECK,317,0,45,14
EDITTEXT IDC_THREADNAME,370,3,150,10,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
EDITTEXT IDC_ADDRESS,11,24,91,13,ES_AUTOHSCROLL | ES_WANTRETURN
PUSHBUTTON "PC",IDC_GOTOPC,11,40,15,13
PUSHBUTTON "RA",IDC_GOTOLR,28,40,14,13
@@ -483,7 +483,7 @@ BEGIN
POPUP "Emulation"
BEGIN
MENUITEM "Run", ID_TOGGLE_PAUSE
MENUITEM "Pause", ID_EMULATION_PAUSE
MENUITEM "Stop", ID_EMULATION_STOP
MENUITEM "Reset", ID_EMULATION_RESET
MENUITEM "Switch UMD", ID_EMULATION_SWITCH_UMD
@@ -498,18 +498,19 @@ BEGIN
POPUP "Debug"
BEGIN
MENUITEM "Run", ID_TOGGLE_BREAK
MENUITEM "Break on Load", ID_DEBUG_BREAKONLOAD
MENUITEM "Ignore Illegal Reads/Writes", ID_DEBUG_IGNOREILLEGALREADS
MENUITEM SEPARATOR
MENUITEM "Load Map File...", ID_DEBUG_LOADMAPFILE
MENUITEM "Save Map File...", ID_DEBUG_SAVEMAPFILE
MENUITEM "Load .sym File...", ID_DEBUG_LOADSYMFILE
MENUITEM "Save .sym File...", ID_DEBUG_SAVESYMFILE
MENUITEM "Reset Symbol Table", ID_DEBUG_RESETSYMBOLTABLE
MENUITEM SEPARATOR
MENUITEM "Dump Next Frame to Log", ID_DEBUG_DUMPNEXTFRAME
MENUITEM "Take Screenshot", ID_DEBUG_TAKESCREENSHOT
MENUITEM SEPARATOR
MENUITEM "Dump Next Frame to Log", ID_DEBUG_DUMPNEXTFRAME
MENUITEM "Show Debug Statistics", ID_DEBUG_SHOWDEBUGSTATISTICS
MENUITEM "Ignore Illegal Reads/Writes", ID_DEBUG_IGNOREILLEGALREADS
MENUITEM "Run on Load", ID_DEBUG_RUNONLOAD
MENUITEM SEPARATOR
MENUITEM "Disassembly", ID_DEBUG_DISASSEMBLY
MENUITEM "GE Debugger...", ID_DEBUG_GEDEBUGGER
@@ -176,7 +176,7 @@
#define ID_DISASM_COPYINSTRUCTIONDISASM 40006
#define ID_DISASM_COPYINSTRUCTIONHEX 40007
#define ID_EMULATION_SPEEDLIMIT 40008
#define ID_TOGGLE_PAUSE 40009
#define ID_TOGGLE_BREAK 40009
#define ID_EMULATION_STOP 40010
#define ID_FILE_LOAD 40011
#define ID_HELP_ABOUT 40012
@@ -205,7 +205,7 @@
#define ID_FILE_QUICKSAVESTATE_HC 40036
#define ID_FILE_QUICKLOADSTATE_HC 40037
#define ID_OPTIONS_CONTROLS 40038
#define ID_DEBUG_RUNONLOAD 40039
#define ID_DEBUG_BREAKONLOAD 40039
#define ID_DEBUG_DUMPNEXTFRAME 40040
#define ID_OPTIONS_VERTEXCACHE 40041
#define ID_OPTIONS_SHOWFPS 40042
@@ -339,6 +339,7 @@
#define ID_OPTIONS_WINDOW8X 40174
#define ID_OPTIONS_WINDOW9X 40175
#define ID_OPTIONS_WINDOW10X 40176
#define ID_EMULATION_PAUSE 40177
// Dummy option to let the buffered rendering hotkey cycle through all the options.
#define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500
@@ -351,7 +352,7 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 256
#define _APS_NEXT_COMMAND_VALUE 40177
#define _APS_NEXT_COMMAND_VALUE 40178
#define _APS_NEXT_CONTROL_VALUE 1200
#define _APS_NEXT_SYMED_VALUE 101
#endif
@@ -92,7 +92,7 @@ bool RunTests() {
coreParam.graphicsContext = nullptr;
coreParam.mountIso = "";
coreParam.mountRoot = baseDirectory + "pspautotests/";
coreParam.startPaused = false;
coreParam.startBreak = false;
coreParam.printfEmuLog = false;
coreParam.headLess = true;
coreParam.renderWidth = 480;
@@ -333,7 +333,7 @@ int main(int argc, const char* argv[])
coreParameter.enableSound = false;
coreParameter.mountIso = mountIso ? mountIso : "";
coreParameter.mountRoot = mountRoot ? mountRoot : "";
coreParameter.startPaused = false;
coreParameter.startBreak = false;
coreParameter.printfEmuLog = !autoCompare;
coreParameter.headLess = true;
coreParameter.renderWidth = 480;
@@ -549,7 +549,7 @@ bool retro_load_game(const struct retro_game_info *game) {
coreParam.enableSound = true;
coreParam.fileToStart = std::string(game->path);
coreParam.mountIso = "";
coreParam.startPaused = false;
coreParam.startBreak = false;
coreParam.printfEmuLog = true;
coreParam.headLess = true;
coreParam.unthrottle = true;

0 comments on commit 1b97821

Please sign in to comment.