Enable the debug windows always, disable buttons.

This way you can close them/whatever, and hopefully should avoid crashes.

Only downside is you can't pause the game now and then hit stop in the
debugger.
This commit is contained in:
Unknown W. Brackets 2013-09-15 09:35:58 -07:00
parent 301884428f
commit 8902e85f0a
7 changed files with 34 additions and 31 deletions

View file

@ -18,10 +18,11 @@
#pragma once
#include "../Globals.h"
#include "MemMap.h"
#include "FileSystems/MetaFileSystem.h"
#include "CoreParameter.h"
#include "ELF/ParamSFO.h"
#include "Core/MemMap.h"
#include "Core/Host.h"
#include "Core/FileSystems/MetaFileSystem.h"
#include "Core/CoreParameter.h"
#include "Core/ELF/ParamSFO.h"
extern MetaFileSystem pspFileSystem;
extern ParamSFOData g_paramSFO;
@ -38,6 +39,13 @@ enum GlobalUIState {
extern GlobalUIState globalUIState;
inline static void UpdateUIState(GlobalUIState newState) {
if (globalUIState != newState) {
globalUIState = newState;
host->UpdateDisassembly();
}
}
bool PSP_Init(const CoreParameter &coreParam, std::string *error_string);
bool PSP_IsInited();
void PSP_Shutdown();

View file

@ -166,11 +166,11 @@ void EmuScreen::sendMessage(const char *message, const char *value) {
bootGame(value);
}
else if (!strcmp(message, "control mapping")) {
globalUIState = UISTATE_MENU;
UpdateUIState(UISTATE_MENU);
screenManager()->push(new ControlMappingScreen());
}
else if (!strcmp(message, "settings")) {
globalUIState = UISTATE_MENU;
UpdateUIState(UISTATE_MENU);
screenManager()->push(new GameSettingsScreen(gamePath_));
}
}
@ -423,7 +423,7 @@ void EmuScreen::update(InputState &input) {
PSP_CoreParameter().pixelWidth = pixel_xres;
PSP_CoreParameter().pixelHeight = pixel_yres;
globalUIState = UISTATE_INGAME;
UpdateUIState(UISTATE_INGAME);
if (errorMessage_.size()) {
I18NCategory *g = GetI18NCategory("Error");

View file

@ -559,18 +559,18 @@ void MainScreen::sendMessage(const char *message, const char *value) {
screenManager()->RecreateAllViews();
}
if (!strcmp(message, "control mapping")) {
globalUIState = UISTATE_MENU;
UpdateUIState(UISTATE_MENU);
screenManager()->push(new ControlMappingScreen());
}
if (!strcmp(message, "settings")) {
globalUIState = UISTATE_MENU;
UpdateUIState(UISTATE_MENU);
screenManager()->push(new GameSettingsScreen(""));
}
}
void MainScreen::update(InputState &input) {
UIScreen::update(input);
globalUIState = UISTATE_MENU;
UpdateUIState(UISTATE_MENU);
}
UI::EventReturn MainScreen::OnLoadFile(UI::EventParams &e) {
@ -665,7 +665,7 @@ UI::EventReturn MainScreen::OnExit(UI::EventParams &e) {
}
void GamePauseScreen::update(InputState &input) {
globalUIState = UISTATE_PAUSEMENU;
UpdateUIState(UISTATE_PAUSEMENU);
UIScreen::update(input);
}

View file

@ -389,7 +389,7 @@ UI::EventReturn CreditsScreen::OnOK(UI::EventParams &e) {
void CreditsScreen::update(InputState &input_state) {
UIScreen::update(input_state);
globalUIState = UISTATE_MENU;
UpdateUIState(UISTATE_MENU);
if (input_state.pad_buttons_down & PAD_BUTTON_BACK) {
screenManager()->finishDialog(this, DR_OK);
}

View file

@ -230,7 +230,7 @@ void CDisasm::changeSubWindow(SubWindowType type)
void CDisasm::stepInto()
{
if (Core_IsActive()) return;
if (!Core_IsStepping()) return;
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
lastTicks = CoreTiming::GetTicks();
@ -790,7 +790,7 @@ void CDisasm::SetDebugMode(bool _bDebug)
HWND hDlg = m_hDlg;
// Update Dialog Windows
if (_bDebug)
if (_bDebug && globalUIState == UISTATE_INGAME)
{
Core_WaitInactive(TEMP_BREAKPOINT_WAIT_MS);
CBreakPoints::ClearTemporaryBreakPoints();
@ -800,6 +800,7 @@ void CDisasm::SetDebugMode(bool _bDebug)
updateThreadLabel(false);
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Go");
EnableWindow( GetDlgItem(hDlg, IDC_STOPGO), TRUE);
EnableWindow( GetDlgItem(hDlg, IDC_STEP), TRUE);
EnableWindow( GetDlgItem(hDlg, IDC_STEPOVER), TRUE);
EnableWindow( GetDlgItem(hDlg, IDC_STEPHLE), TRUE);
@ -819,7 +820,16 @@ void CDisasm::SetDebugMode(bool _bDebug)
{
updateThreadLabel(true);
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Stop");
if (globalUIState == UISTATE_INGAME)
{
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Stop");
EnableWindow( GetDlgItem(hDlg, IDC_STOPGO), TRUE);
}
else
{
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Go");
EnableWindow( GetDlgItem(hDlg, IDC_STOPGO), FALSE);
}
EnableWindow( GetDlgItem(hDlg, IDC_STEP), FALSE);
EnableWindow( GetDlgItem(hDlg, IDC_STEPOVER), FALSE);
EnableWindow( GetDlgItem(hDlg, IDC_STEPHLE), FALSE);

View file

@ -60,6 +60,7 @@ public:
virtual void Update()
{
UpdateDialog(true);
SetDebugMode(Core_IsStepping());
breakpointList->update();
};
void UpdateDialog(bool _bComplete = false);

View file

@ -742,12 +742,10 @@ namespace MainWindow
void CreateDebugWindows() {
disasmWindow[0] = new CDisasm(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
DialogManager::AddDlg(disasmWindow[0]);
EnableWindow(disasmWindow[0]->GetDlgHandle(),FALSE);
disasmWindow[0]->Show(g_Config.bShowDebuggerOnLoad);
memoryWindow[0] = new CMemoryDlg(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
DialogManager::AddDlg(memoryWindow[0]);
EnableWindow(memoryWindow[0]->GetDlgHandle(),FALSE);
}
void BrowseAndBoot(std::string defaultPath, bool browseDirectory) {
@ -1071,9 +1069,6 @@ namespace MainWindow
break;
case ID_EMULATION_STOP:
EnableWindow(disasmWindow[0]->GetDlgHandle(),FALSE);
EnableWindow(memoryWindow[0]->GetDlgHandle(),FALSE);
if (Core_IsStepping()) {
// If the current PC is on a breakpoint, disabling stepping doesn't work without
// explicitly skipping it
@ -1085,9 +1080,6 @@ namespace MainWindow
break;
case ID_EMULATION_RESET:
EnableWindow(disasmWindow[0]->GetDlgHandle(),FALSE);
EnableWindow(memoryWindow[0]->GetDlgHandle(),FALSE);
if (Core_IsStepping()) {
// If the current PC is on a breakpoint, disabling stepping doesn't work without
// explicitly skipping it
@ -1100,9 +1092,6 @@ namespace MainWindow
case ID_EMULATION_CHEATS:
g_Config.bEnableCheats = !g_Config.bEnableCheats;
osm.ShowOnOff(g->T("Cheats"), g_Config.bEnableCheats);
EnableWindow(disasmWindow[0]->GetDlgHandle(),FALSE);
EnableWindow(memoryWindow[0]->GetDlgHandle(),FALSE);
if (Core_IsStepping()) {
// If the current PC is on a breakpoint, disabling stepping doesn't work without
@ -1283,12 +1272,10 @@ namespace MainWindow
break;
case ID_DEBUG_DISASSEMBLY:
EnableWindow(disasmWindow[0]->GetDlgHandle(),TRUE);
disasmWindow[0]->Show(true);
break;
case ID_DEBUG_MEMORYVIEW:
EnableWindow(memoryWindow[0]->GetDlgHandle(),TRUE);
memoryWindow[0]->Show(true);
break;
@ -1492,9 +1479,6 @@ namespace MainWindow
case WM_USER+1:
if (g_Config.bFullScreen)
_ViewFullScreen(hWnd);
EnableWindow (disasmWindow[0]->GetDlgHandle(),TRUE);
EnableWindow (memoryWindow[0]->GetDlgHandle(),TRUE);
disasmWindow[0]->NotifyMapLoaded();
memoryWindow[0]->NotifyMapLoaded();