Core: Do not end emulation by default on perm loop

This commit is contained in:
zilmar 2022-08-01 10:59:16 +09:30
parent 10d23486c6
commit b987a1693c
8 changed files with 27 additions and 13 deletions

View File

@ -245,6 +245,7 @@ CJniBridegSettings::CJniBridegSettings()
// Debugger
ADD_SETTING(Debugger_Enabled);
ADD_SETTING(Debugger_EndOnPermLoop);
ADD_SETTING(Debugger_BreakOnUnhandledMemory);
ADD_SETTING(Debugger_BreakOnAddressError);
ADD_SETTING(Debugger_ShowPifErrors);

View File

@ -34,30 +34,24 @@ void CInterpreterCPU::BuildCPU()
void CInterpreterCPU::InPermLoop()
{
// Interrupts enabled
if ((g_Reg->STATUS_REGISTER & STATUS_IE) == 0 ||
if (EndOnPermLoop() &&
((g_Reg->STATUS_REGISTER & STATUS_IE) == 0 ||
(g_Reg->STATUS_REGISTER & STATUS_EXL) != 0 ||
(g_Reg->STATUS_REGISTER & STATUS_ERL) != 0 ||
(g_Reg->STATUS_REGISTER & 0xFF00) == 0)
(g_Reg->STATUS_REGISTER & 0xFF00) == 0))
{
if (g_Plugins->Gfx()->UpdateScreen != nullptr)
{
g_Plugins->Gfx()->UpdateScreen();
}
//CurrentFrame = 0;
//CurrentPercent = 0;
//DisplayFPS();
g_Notify->DisplayError(GS(MSG_PERM_LOOP));
g_System->CloseCpu();
}
else
else if (*g_NextTimer > 0)
{
if (*g_NextTimer > 0)
{
g_SystemTimer->UpdateTimers();
*g_NextTimer = 0 - g_System->CountPerOp();
g_SystemTimer->UpdateTimers();
}
g_SystemTimer->UpdateTimers();
*g_NextTimer = 0 - g_System->CountPerOp();
g_SystemTimer->UpdateTimers();
}
}

View File

@ -319,6 +319,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(File_DiskIPLTOOLPath, new CSettingTypeApplicationPath("Settings", "Disk IPL TOOL ROM Path", Default_None));
AddHandler(Debugger_Enabled, new CSettingTypeApplication("Debugger", "Debugger", false));
AddHandler(Debugger_EndOnPermLoop, new CSettingTypeApplication("Debugger", "End On Perm Loop", false));
AddHandler(Debugger_BreakOnUnhandledMemory, new CSettingTypeApplication("Debugger", "Break On Unhandled Memory", false));
AddHandler(Debugger_BreakOnAddressError, new CSettingTypeApplication("Debugger", "Break On Address Error", false));
AddHandler(Debugger_ShowPifErrors, new CSettingTypeApplication("Debugger", "Show Pif Errors", false));

View File

@ -23,6 +23,7 @@ uint32_t CDebugSettings::m_ExceptionBreakpoints = 0;
uint32_t CDebugSettings::m_FpExceptionBreakpoints = 0;
uint32_t CDebugSettings::m_IntrBreakpoints = 0;
uint32_t CDebugSettings::m_RcpIntrBreakpoints = 0;
bool CDebugSettings::m_EndOnPermLoop = false;
bool CDebugSettings::m_BreakOnUnhandledMemory = false;
bool CDebugSettings::m_BreakOnAddressError = false;
@ -48,6 +49,7 @@ CDebugSettings::CDebugSettings()
g_Settings->RegisterChangeCB(Debugger_FpExceptionBreakpoints, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->RegisterChangeCB(Debugger_IntrBreakpoints, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->RegisterChangeCB(Debugger_RcpIntrBreakpoints, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->RegisterChangeCB(Debugger_EndOnPermLoop, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->RegisterChangeCB(Debugger_BreakOnUnhandledMemory, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->RegisterChangeCB(Debugger_BreakOnAddressError, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
@ -75,6 +77,7 @@ CDebugSettings::~CDebugSettings()
g_Settings->UnregisterChangeCB(Debugger_FpExceptionBreakpoints, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->UnregisterChangeCB(Debugger_IntrBreakpoints, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->UnregisterChangeCB(Debugger_RcpIntrBreakpoints, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->UnregisterChangeCB(Debugger_EndOnPermLoop, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->UnregisterChangeCB(Debugger_BreakOnUnhandledMemory, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
g_Settings->UnregisterChangeCB(Debugger_BreakOnAddressError, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
}
@ -98,6 +101,7 @@ void CDebugSettings::RefreshSettings()
m_FpExceptionBreakpoints = m_HaveDebugger ? g_Settings->LoadDword(Debugger_FpExceptionBreakpoints) : 0;
m_IntrBreakpoints = m_HaveDebugger ? g_Settings->LoadDword(Debugger_IntrBreakpoints) : 0;
m_RcpIntrBreakpoints = m_HaveDebugger ? g_Settings->LoadDword(Debugger_RcpIntrBreakpoints) : 0;
m_EndOnPermLoop = m_HaveDebugger && g_Settings->LoadBool(Debugger_EndOnPermLoop);
m_BreakOnUnhandledMemory = m_HaveDebugger && g_Settings->LoadBool(Debugger_BreakOnUnhandledMemory);
m_BreakOnAddressError = m_HaveDebugger && g_Settings->LoadBool(Debugger_BreakOnAddressError);

View File

@ -26,6 +26,7 @@ public:
static inline uint32_t FpExceptionBreakpoints(void) { return m_FpExceptionBreakpoints; }
static inline uint32_t IntrBreakpoints(void) { return m_IntrBreakpoints; }
static inline uint32_t RcpIntrBreakpoints(void) { return m_RcpIntrBreakpoints; }
static inline bool EndOnPermLoop(void) { return m_EndOnPermLoop; }
static inline bool BreakOnUnhandledMemory(void) { return m_BreakOnUnhandledMemory; }
static inline bool BreakOnAddressError(void) { return m_BreakOnAddressError; }
@ -55,6 +56,7 @@ private:
static uint32_t m_FpExceptionBreakpoints;
static uint32_t m_IntrBreakpoints;
static uint32_t m_RcpIntrBreakpoints;
static bool m_EndOnPermLoop;
static bool m_BreakOnUnhandledMemory;
static bool m_BreakOnAddressError;

View File

@ -236,6 +236,7 @@ enum SettingID
// Debugger
Debugger_Enabled,
Debugger_EndOnPermLoop,
Debugger_BreakOnUnhandledMemory,
Debugger_BreakOnAddressError,
Debugger_ShowPifErrors,

View File

@ -24,6 +24,7 @@ CMainMenu::CMainMenu(CMainGui * hMainWindow) :
m_ChangeSettingList.push_back(UserInterface_ShowCPUPer);
m_ChangeSettingList.push_back(Logging_GenerateLog);
m_ChangeSettingList.push_back(Debugger_RecordExecutionTimes);
m_ChangeSettingList.push_back(Debugger_EndOnPermLoop);
m_ChangeSettingList.push_back(Debugger_BreakOnUnhandledMemory);
m_ChangeSettingList.push_back(Debugger_BreakOnAddressError);
m_ChangeSettingList.push_back(Debugger_ShowPifErrors);
@ -497,6 +498,9 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
break;
case ID_PROFILE_RESETCOUNTER: g_BaseSystem->ExternalEvent(SysEvent_ResetFunctionTimes); break;
case ID_PROFILE_GENERATELOG: g_BaseSystem->ExternalEvent(SysEvent_DumpFunctionTimes); break;
case ID_DEBUG_END_ON_PERM_LOOP:
g_Settings->SaveBool(Debugger_EndOnPermLoop, !g_Settings->LoadBool(Debugger_EndOnPermLoop));
break;
case ID_DEBUG_BREAK_ON_UNHANDLED_MEM:
g_Settings->SaveBool(Debugger_BreakOnUnhandledMemory, !g_Settings->LoadBool(Debugger_BreakOnUnhandledMemory));
break;
@ -1221,6 +1225,12 @@ void CMainMenu::FillOutMenu(HMENU hMenu)
}
// Notification menu
Item.Reset(ID_DEBUG_END_ON_PERM_LOOP, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"End on perm loop");
if (g_Settings->LoadBool(Debugger_EndOnPermLoop))
{
Item.SetItemTicked(true);
}
DebugNotificationMenu.push_back(Item);
Item.Reset(ID_DEBUG_BREAK_ON_UNHANDLED_MEM, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Break on unhandled memory actions");
if (g_Settings->LoadBool(Debugger_BreakOnUnhandledMemory))
{

View File

@ -33,6 +33,7 @@ enum MainMenuID
ID_OPTIONS_DECREASE_SPEED,
// Debugger menu
ID_DEBUG_END_ON_PERM_LOOP,
ID_DEBUG_BREAK_ON_UNHANDLED_MEM, ID_DEBUG_BREAK_ON_ADDRESS_ERROR, ID_DEBUG_SHOW_PIF_ERRORS,
ID_DEBUG_SHOW_DLIST_COUNT, ID_DEBUG_SHOW_RECOMP_MEM_SIZE, ID_DEBUG_SHOW_DIV_BY_ZERO,
ID_DEBUG_RECORD_RECOMPILER_ASM, ID_DEBUG_DISABLE_GAMEFIX, ID_DEBUG_LANGUAGE,