[Project64] Add ability to monitor Game Cpu Running to Gui
This commit is contained in:
parent
8aa5b6ef47
commit
7d7026c33d
|
@ -321,12 +321,9 @@ void CN64System::StartEmulation2(bool NewThread)
|
|||
{
|
||||
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
|
||||
g_Notify->DisplayError(MSG_PLUGIN_NOT_INIT);
|
||||
|
||||
Notify().ShowRomBrowser();
|
||||
}
|
||||
|
||||
Notify().MakeWindowOnTop(g_Settings->LoadBool(UserInterface_AlwaysOnTop));
|
||||
|
||||
else
|
||||
{
|
||||
ThreadInfo * Info = new ThreadInfo;
|
||||
HANDLE * hThread = new HANDLE;
|
||||
*hThread = NULL;
|
||||
|
@ -337,24 +334,12 @@ void CN64System::StartEmulation2(bool NewThread)
|
|||
|
||||
*hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)StartEmulationThread, Info, 0, &Info->ThreadID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//mark the emulation as starting and fix up menus
|
||||
g_Notify->DisplayMessage(5, MSG_EMULATION_STARTED);
|
||||
|
||||
if (g_Settings->LoadBool(Setting_AutoFullscreen))
|
||||
{
|
||||
WriteTrace(TraceDebug, __FUNCTION__ " 15");
|
||||
CIniFile RomIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
|
||||
stdstr Status = g_Settings->LoadStringVal(Rdb_Status);
|
||||
|
||||
char String[100];
|
||||
RomIniFile.GetString("Rom Status", stdstr_f("%s.AutoFullScreen", Status.c_str()).c_str(), "true", String, sizeof(String));
|
||||
if (_stricmp(String, "true") == 0)
|
||||
{
|
||||
Notify().ChangeFullScreen();
|
||||
}
|
||||
}
|
||||
ExecuteCPU();
|
||||
}
|
||||
}
|
||||
|
@ -887,23 +872,15 @@ void CN64System::ExecuteRecompiler()
|
|||
|
||||
void CN64System::ExecuteSyncCPU()
|
||||
{
|
||||
Notify().BringToTop();
|
||||
m_Recomp->Run();
|
||||
}
|
||||
|
||||
void CN64System::CpuStopped()
|
||||
{
|
||||
g_Settings->SaveBool(GameRunning_CPU_Running, (DWORD)false);
|
||||
Notify().WindowMode();
|
||||
if (!m_InReset)
|
||||
{
|
||||
Notify().RefreshMenu();
|
||||
Notify().MakeWindowOnTop(false);
|
||||
g_Settings->SaveBool(GameRunning_CPU_Running, (uint32_t)false);
|
||||
g_Notify->DisplayMessage(5, MSG_EMULATION_ENDED);
|
||||
if (g_Settings->LoadDword(RomBrowser_Enabled))
|
||||
{
|
||||
Notify().ShowRomBrowser();
|
||||
}
|
||||
}
|
||||
if (m_SyncCPU)
|
||||
{
|
||||
|
@ -963,7 +940,7 @@ void CN64System::SyncCPU(CN64System * const SecondCPU)
|
|||
#ifdef TEST_SP_TRACKING
|
||||
if (m_CurrentSP != GPR[29].UW[0]) {
|
||||
ErrorFound = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (m_Reg.m_PROGRAM_COUNTER != SecondCPU->m_Reg.m_PROGRAM_COUNTER)
|
||||
{
|
||||
|
@ -1082,7 +1059,7 @@ void CN64System::SyncCPU(CN64System * const SecondCPU)
|
|||
// if (PROGRAM_COUNTER == 0x8009BBD8) {
|
||||
// g_Notify->BreakPoint(__FILEW__,__LINE__);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
void CN64System::SyncSystem()
|
||||
{
|
||||
|
@ -1324,7 +1301,7 @@ void CN64System::DumpSyncErrors(CN64System * SecondCPU)
|
|||
Error.LogF("%X: %s\r\n", Addr, R4300iOpcodeName(OpcodeValue, Addr));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_Notify->DisplayError(L"Sync Error");
|
||||
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||
|
@ -2011,9 +1988,9 @@ bool CN64System::WriteToProtectedMemory(uint32_t Address, int length)
|
|||
#ifdef tofix
|
||||
return m_Recomp->ClearRecompCode_Phys(Address, length, CRecompiler::Remove_ProtectedMem);
|
||||
#endif
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CN64System::TLB_Mapped(uint32_t VAddr, uint32_t Len, uint32_t PAddr, bool bReadOnly)
|
||||
{
|
||||
|
|
|
@ -50,6 +50,7 @@ m_ResetInfo(NULL)
|
|||
g_Settings->RegisterChangeCB(RomBrowser_ColoumnsChanged, this, (CSettings::SettingChangedFunc)RomBowserColoumnsChanged);
|
||||
g_Settings->RegisterChangeCB(RomBrowser_Recursive, this, (CSettings::SettingChangedFunc)RomBrowserRecursiveChanged);
|
||||
g_Settings->RegisterChangeCB(GameRunning_LoadingInProgress, this, (CSettings::SettingChangedFunc)LoadingInProgressChanged);
|
||||
g_Settings->RegisterChangeCB(GameRunning_CPU_Running, this, (CSettings::SettingChangedFunc)GameCpuRunning);
|
||||
g_Settings->RegisterChangeCB(GameRunning_CPU_Paused, this, (CSettings::SettingChangedFunc)GamePaused);
|
||||
g_Settings->RegisterChangeCB(Game_File, this, (CSettings::SettingChangedFunc)GameLoaded);
|
||||
}
|
||||
|
@ -68,6 +69,7 @@ CMainGui::~CMainGui(void)
|
|||
g_Settings->UnregisterChangeCB(RomBrowser_ColoumnsChanged, this, (CSettings::SettingChangedFunc)RomBowserColoumnsChanged);
|
||||
g_Settings->UnregisterChangeCB(RomBrowser_Recursive, this, (CSettings::SettingChangedFunc)RomBrowserRecursiveChanged);
|
||||
g_Settings->UnregisterChangeCB(GameRunning_LoadingInProgress, this, (CSettings::SettingChangedFunc)LoadingInProgressChanged);
|
||||
g_Settings->UnregisterChangeCB(GameRunning_CPU_Running, this, (CSettings::SettingChangedFunc)GameCpuRunning);
|
||||
g_Settings->UnregisterChangeCB(GameRunning_CPU_Paused, this, (CSettings::SettingChangedFunc)GamePaused);
|
||||
g_Settings->UnregisterChangeCB(Game_File, this, (CSettings::SettingChangedFunc)GameLoaded);
|
||||
}
|
||||
|
@ -150,6 +152,15 @@ void CMainGui::SetWindowCaption(const wchar_t * title)
|
|||
Caption(WinTitle);
|
||||
}
|
||||
|
||||
void CMainGui::ShowRomBrowser(void)
|
||||
{
|
||||
if (g_Settings->LoadDword(RomBrowser_Enabled))
|
||||
{
|
||||
ShowRomList();
|
||||
HighLightLastRom();
|
||||
}
|
||||
}
|
||||
|
||||
void RomBowserEnabledChanged(CMainGui * Gui)
|
||||
{
|
||||
if (Gui && g_Settings->LoadBool(RomBrowser_Enabled))
|
||||
|
@ -171,6 +182,15 @@ void RomBowserEnabledChanged(CMainGui * Gui)
|
|||
void CMainGui::LoadingInProgressChanged(CMainGui * Gui)
|
||||
{
|
||||
Gui->RefreshMenu();
|
||||
if (!g_Settings->LoadBool(GameRunning_LoadingInProgress) && g_Settings->LoadStringVal(Game_File).length() == 0)
|
||||
{
|
||||
Notify().WindowMode();
|
||||
if (g_Settings->LoadDword(RomBrowser_Enabled))
|
||||
{
|
||||
Gui->ShowRomBrowser();
|
||||
}
|
||||
Gui->MakeWindowOnTop(false);
|
||||
}
|
||||
}
|
||||
|
||||
void CMainGui::GameLoaded(CMainGui * Gui)
|
||||
|
@ -181,7 +201,6 @@ void CMainGui::GameLoaded(CMainGui * Gui)
|
|||
WriteTrace(TraceDebug, __FUNCTION__ ": Add Recent Rom");
|
||||
Gui->AddRecentRom(FileLoc.c_str());
|
||||
Gui->SetWindowCaption(g_Settings->LoadStringVal(Game_GoodName).ToUTF16().c_str());
|
||||
|
||||
Gui->HideRomList();
|
||||
}
|
||||
}
|
||||
|
@ -191,6 +210,33 @@ void CMainGui::GamePaused(CMainGui * Gui)
|
|||
Gui->RefreshMenu();
|
||||
}
|
||||
|
||||
void CMainGui::GameCpuRunning(CMainGui * Gui)
|
||||
{
|
||||
if (g_Settings->LoadBool(GameRunning_CPU_Running))
|
||||
{
|
||||
Gui->MakeWindowOnTop(g_Settings->LoadBool(UserInterface_AlwaysOnTop));
|
||||
if (g_Settings->LoadBool(Setting_AutoFullscreen))
|
||||
{
|
||||
WriteTrace(TraceDebug, __FUNCTION__ " 15");
|
||||
CIniFile RomIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
|
||||
stdstr Status = g_Settings->LoadStringVal(Rdb_Status);
|
||||
|
||||
char String[100];
|
||||
RomIniFile.GetString("Rom Status", stdstr_f("%s.AutoFullScreen", Status.c_str()).c_str(), "true", String, sizeof(String));
|
||||
if (_stricmp(String, "true") == 0)
|
||||
{
|
||||
g_Notify->ChangeFullScreen();
|
||||
}
|
||||
}
|
||||
Gui->RefreshMenu();
|
||||
Gui->BringToTop();
|
||||
}
|
||||
else
|
||||
{
|
||||
PostMessage(Gui->m_hMainWindow, WM_GAME_CLOSED, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void RomBowserColoumnsChanged(CMainGui * Gui)
|
||||
{
|
||||
Gui->ResetRomBrowserColomuns();
|
||||
|
@ -375,6 +421,7 @@ bool CMainGui::ResetPluginsInUiThread(CPlugins * plugins, CN64System * System)
|
|||
WriteTrace(TraceError, __FUNCTION__ ": Failed to create event");
|
||||
bRes = false;
|
||||
}
|
||||
Notify().RefreshMenu();
|
||||
return bRes;
|
||||
}
|
||||
|
||||
|
@ -908,6 +955,20 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
|
|||
_this->m_ResetPlugins = true;
|
||||
}
|
||||
break;
|
||||
case WM_GAME_CLOSED:
|
||||
{
|
||||
CMainGui * _this = (CMainGui *)GetProp((HWND)hWnd, "Class");
|
||||
Notify().WindowMode();
|
||||
if (g_Settings->LoadDword(RomBrowser_Enabled))
|
||||
{
|
||||
_this->ShowRomBrowser();
|
||||
}
|
||||
_this->RefreshMenu();
|
||||
_this->MakeWindowOnTop(false);
|
||||
_this->SetStatusText(0, L"");
|
||||
_this->SetStatusText(1, L"");
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
{
|
||||
CMainGui * _this = (CMainGui *)GetProp((HWND)hWnd, "Class");
|
||||
|
|
|
@ -26,6 +26,7 @@ enum
|
|||
WM_HIDE_CUROSR = WM_USER + 10,
|
||||
WM_MAKE_FOCUS = WM_USER + 17,
|
||||
WM_RESET_PLUGIN = WM_USER + 18,
|
||||
WM_GAME_CLOSED = WM_USER + 19,
|
||||
WM_BORWSER_TOP = WM_USER + 40,
|
||||
};
|
||||
|
||||
|
@ -105,6 +106,7 @@ private:
|
|||
void Resize(DWORD fwSizeType, WORD nWidth, WORD nHeight); //responding to WM_SIZE
|
||||
void AddRecentRom(const char * ImagePath);
|
||||
void SetWindowCaption(const wchar_t * Caption);
|
||||
void ShowRomBrowser(void);
|
||||
|
||||
friend DWORD CALLBACK AboutBoxProc(HWND, DWORD, DWORD, DWORD);
|
||||
friend DWORD CALLBACK AboutIniBoxProc(HWND, DWORD, DWORD, DWORD);
|
||||
|
@ -116,6 +118,7 @@ private:
|
|||
static void LoadingInProgressChanged(CMainGui * Gui);
|
||||
static void GameLoaded(CMainGui * Gui);
|
||||
static void GamePaused(CMainGui * Gui);
|
||||
static void GameCpuRunning(CMainGui * Gui);
|
||||
|
||||
CBaseMenu * m_Menu;
|
||||
|
||||
|
|
Loading…
Reference in New Issue