[Project64] Move handling of ID_FILE_OPEN_ROM to OnOpenRom

This commit is contained in:
zilmar 2016-09-17 16:25:49 +10:00
parent bf4b301973
commit eb0335bc1e
2 changed files with 49 additions and 46 deletions

View File

@ -121,26 +121,26 @@ void CMainMenu::SetTraceModuleSetttings(SettingID Type)
g_Settings->SaveDword(Type, value); g_Settings->SaveDword(Type, value);
} }
bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuID) void CMainMenu::OnOpenRom(HWND hWnd)
{ {
switch (MenuID) {
case ID_FILE_OPEN_ROM:
{
stdstr File = ChooseFileToOpen(hWnd); stdstr File = ChooseFileToOpen(hWnd);
if (File.length() > 0) if (File.length() == 0)
{ {
return;
}
stdstr ext = CPath(File).GetExtension(); stdstr ext = CPath(File).GetExtension();
if (!(_stricmp(ext.c_str(), "ndd") == 0)) if (_stricmp(ext.c_str(), "ndd") != 0)
{ {
delete g_DDRom; delete g_DDRom;
g_DDRom = NULL; g_DDRom = NULL;
g_BaseSystem->RunFileImage(File.c_str()); g_BaseSystem->RunFileImage(File.c_str());
return;
} }
else
{
// Open Disk // Open Disk
if (g_BaseSystem->RunDiskImage(File.c_str())) if (!g_BaseSystem->RunDiskImage(File.c_str()))
{ {
return;
}
stdstr IPLROM = g_Settings->LoadStringVal(File_DiskIPLPath); stdstr IPLROM = g_Settings->LoadStringVal(File_DiskIPLPath);
if ((IPLROM.length() <= 0) || (!g_BaseSystem->RunFileImage(IPLROM.c_str()))) if ((IPLROM.length() <= 0) || (!g_BaseSystem->RunFileImage(IPLROM.c_str())))
{ {
@ -164,11 +164,13 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
g_BaseSystem->RunFileImage(FileName); g_BaseSystem->RunFileImage(FileName);
} }
} }
} }
}
} bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuID)
} {
break; switch (MenuID)
{
case ID_FILE_OPEN_ROM: OnOpenRom(hWnd); break;
case ID_FILE_ROM_INFO: case ID_FILE_ROM_INFO:
{ {
if (g_Rom) if (g_Rom)

View File

@ -73,6 +73,7 @@ private:
CMainMenu(const CMainMenu&); // Disable copy constructor CMainMenu(const CMainMenu&); // Disable copy constructor
CMainMenu& operator=(const CMainMenu&); // Disable assignment CMainMenu& operator=(const CMainMenu&); // Disable assignment
void OnOpenRom(HWND hWnd);
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);