[Project64] Add OnEndEmulation to handle ID_FILE_ENDEMULATION

This commit is contained in:
zilmar 2016-09-17 16:33:05 +10:00
parent eb0335bc1e
commit b8bd3b1556
2 changed files with 24 additions and 20 deletions

View File

@ -166,20 +166,32 @@ void CMainMenu::OnOpenRom(HWND hWnd)
} }
} }
void CMainMenu::OnRomInfo(HWND hWnd)
{
if (g_Rom)
{
RomInformation Info(g_Rom);
Info.DisplayInformation(hWnd);
}
}
void CMainMenu::OnEndEmulation(void)
{
CGuard Guard(m_CS);
WriteTrace(TraceUserInterface, TraceDebug, "ID_FILE_ENDEMULATION");
if (g_BaseSystem)
{
g_BaseSystem->CloseCpu();
}
m_Gui->SaveWindowLoc();
}
bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuID) bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuID)
{ {
switch (MenuID) switch (MenuID)
{ {
case ID_FILE_OPEN_ROM: OnOpenRom(hWnd); break; case ID_FILE_OPEN_ROM: OnOpenRom(hWnd); break;
case ID_FILE_ROM_INFO: case ID_FILE_ROM_INFO: OnRomInfo(hWnd); break;
{
if (g_Rom)
{
RomInformation Info(g_Rom);
Info.DisplayInformation(hWnd);
}
}
break;
case ID_FILE_STARTEMULATION: case ID_FILE_STARTEMULATION:
m_Gui->SaveWindowLoc(); m_Gui->SaveWindowLoc();
//Now we have created again, we can start up emulation //Now we have created again, we can start up emulation
@ -192,17 +204,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
break; break;
case ID_FILE_ENDEMULATION: case ID_FILE_ENDEMULATION: OnEndEmulation(); break;
{
CGuard Guard(m_CS);
WriteTrace(TraceUserInterface, TraceDebug, "ID_FILE_ENDEMULATION");
if (g_BaseSystem)
{
g_BaseSystem->CloseCpu();
}
m_Gui->SaveWindowLoc();
}
break;
case ID_FILE_ROMDIRECTORY: case ID_FILE_ROMDIRECTORY:
WriteTrace(TraceUserInterface, TraceDebug, "ID_FILE_ROMDIRECTORY 1"); WriteTrace(TraceUserInterface, TraceDebug, "ID_FILE_ROMDIRECTORY 1");
m_Gui->SelectRomDir(); m_Gui->SelectRomDir();

View File

@ -74,6 +74,8 @@ private:
CMainMenu& operator=(const CMainMenu&); // Disable assignment CMainMenu& operator=(const CMainMenu&); // Disable assignment
void OnOpenRom(HWND hWnd); void OnOpenRom(HWND hWnd);
void OnRomInfo(HWND hWnd);
void OnEndEmulation(void);
void FillOutMenu(HMENU hMenu); void FillOutMenu(HMENU hMenu);
std::wstring GetSaveSlotString(int Slot); std::wstring GetSaveSlotString(int Slot);
stdstr GetFileLastMod(const CPath & FileName); stdstr GetFileLastMod(const CPath & FileName);