UI: Use a UIState for exceptions.

This makes it so we can enable Stop/Reset/etc. during them in the menus.
This commit is contained in:
Unknown W. Brackets committed 2021-08-08 23:40:41 -07:00
1 parent 32c7ff8436
commit 75eeb55617
5 files changed
+11 -7

No files matched your search

+1
View File
@@ -131,6 +131,7 @@ void UpdateUIState(GlobalUIState newState) {
case UISTATE_INGAME: state = "ingame"; break;
case UISTATE_MENU: state = "menu"; break;
case UISTATE_PAUSEMENU: state = "pausemenu"; break;
case UISTATE_EXCEPTION: state = "exception"; break;
}
if (state) {
System_SendMessage("uistate", state);
+1
View File
@@ -33,6 +33,7 @@ enum GlobalUIState {
UISTATE_PAUSEMENU,
UISTATE_INGAME,
UISTATE_EXIT,
UISTATE_EXCEPTION,
};
// Use these in conjunction with GetSysDirectory.
+2 -2
View File
@@ -952,8 +952,8 @@ void EmuScreen::update() {
PSP_CoreParameter().pixelHeight = pixel_yres * bounds.h / dp_yres;
#endif
if (!invalid_ && coreState != CORE_RUNTIME_ERROR) {
UpdateUIState(UISTATE_INGAME);
if (!invalid_) {
UpdateUIState(coreState != CORE_RUNTIME_ERROR ? UISTATE_INGAME : UISTATE_EXCEPTION);
}
if (errorMessage_.size()) {
+3 -2
View File
@@ -791,9 +791,10 @@ void CDisasm::SavePosition()
void CDisasm::SetDebugMode(bool _bDebug, bool switchPC)
{
HWND hDlg = m_hDlg;
bool ingame = (GetUIState() == UISTATE_INGAME || GetUIState() == UISTATE_EXCEPTION) && PSP_IsInited();
// Update Dialog Windows
if (_bDebug && GetUIState() == UISTATE_INGAME && PSP_IsInited())
if (_bDebug && ingame)
{
Core_WaitInactive(TEMP_BREAKPOINT_WAIT_MS);
breakpointList->reloadBreakpoints();
@@ -827,7 +828,7 @@ void CDisasm::SetDebugMode(bool _bDebug, bool switchPC)
{
updateThreadLabel(true);
if (GetUIState() == UISTATE_INGAME && PSP_IsInited())
if (ingame)
{
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Break");
EnableWindow(GetDlgItem(hDlg, IDC_STOPGO), TRUE);
+4 -3
View File
@@ -68,7 +68,8 @@ namespace MainWindow {
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
void SetIngameMenuItemStates(HMENU menu, const GlobalUIState state) {
UINT menuEnable = state == UISTATE_INGAME ? MF_ENABLED : MF_GRAYED;
UINT menuEnable = state == UISTATE_INGAME || state == UISTATE_EXCEPTION ? MF_ENABLED : MF_GRAYED;
UINT menuInGameEnable = state == UISTATE_INGAME ? MF_ENABLED : MF_GRAYED;
UINT umdSwitchEnable = state == UISTATE_INGAME && getUMDReplacePermit() ? MF_ENABLED : MF_GRAYED;
EnableMenuItem(menu, ID_FILE_SAVESTATEFILE, menuEnable);
@@ -86,7 +87,7 @@ namespace MainWindow {
EnableMenuItem(menu, ID_DEBUG_SAVESYMFILE, menuEnable);
EnableMenuItem(menu, ID_DEBUG_RESETSYMBOLTABLE, menuEnable);
EnableMenuItem(menu, ID_DEBUG_TAKESCREENSHOT, menuEnable);
EnableMenuItem(menu, ID_DEBUG_SHOWDEBUGSTATISTICS, menuEnable);
EnableMenuItem(menu, ID_DEBUG_SHOWDEBUGSTATISTICS, menuInGameEnable);
EnableMenuItem(menu, ID_DEBUG_EXTRACTFILE, menuEnable);
// While playing, this pop up doesn't work - and probably doesn't make sense.
@@ -394,7 +395,7 @@ namespace MainWindow {
Core_EnableStepping(false);
}
} else {
if (GetUIState() == UISTATE_INGAME || GetUIState() == UISTATE_PAUSEMENU) {
if (GetUIState() == UISTATE_INGAME || GetUIState() == UISTATE_EXCEPTION || GetUIState() == UISTATE_PAUSEMENU) {
Core_EnableStepping(false);
}