[Project64] Move handling of ID_FILE_OPEN_ROM to OnOpenRom
This commit is contained in:
parent
bf4b301973
commit
eb0335bc1e
|
@ -121,54 +121,56 @@ void CMainMenu::SetTraceModuleSetttings(SettingID Type)
|
|||
g_Settings->SaveDword(Type, value);
|
||||
}
|
||||
|
||||
void CMainMenu::OnOpenRom(HWND hWnd)
|
||||
{
|
||||
stdstr File = ChooseFileToOpen(hWnd);
|
||||
if (File.length() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
stdstr ext = CPath(File).GetExtension();
|
||||
if (_stricmp(ext.c_str(), "ndd") != 0)
|
||||
{
|
||||
delete g_DDRom;
|
||||
g_DDRom = NULL;
|
||||
g_BaseSystem->RunFileImage(File.c_str());
|
||||
return;
|
||||
}
|
||||
// Open Disk
|
||||
if (!g_BaseSystem->RunDiskImage(File.c_str()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
stdstr IPLROM = g_Settings->LoadStringVal(File_DiskIPLPath);
|
||||
if ((IPLROM.length() <= 0) || (!g_BaseSystem->RunFileImage(IPLROM.c_str())))
|
||||
{
|
||||
// Open DDROM
|
||||
OPENFILENAME openfilename;
|
||||
char FileName[_MAX_PATH], Directory[_MAX_PATH];
|
||||
memset(&FileName, 0, sizeof(FileName));
|
||||
memset(&openfilename, 0, sizeof(openfilename));
|
||||
|
||||
strcpy(Directory, g_Settings->LoadStringVal(RomList_GameDir).c_str());
|
||||
openfilename.lStructSize = sizeof(openfilename);
|
||||
openfilename.hwndOwner = (HWND)hWnd;
|
||||
openfilename.lpstrFilter = "64DD IPL ROM Image (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal\0All files (*.*)\0*.*\0";
|
||||
openfilename.lpstrFile = FileName;
|
||||
openfilename.lpstrInitialDir = Directory;
|
||||
openfilename.nMaxFile = MAX_PATH;
|
||||
openfilename.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
|
||||
|
||||
if (GetOpenFileName(&openfilename))
|
||||
{
|
||||
g_BaseSystem->RunFileImage(FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuID)
|
||||
{
|
||||
switch (MenuID) {
|
||||
case ID_FILE_OPEN_ROM:
|
||||
{
|
||||
stdstr File = ChooseFileToOpen(hWnd);
|
||||
if (File.length() > 0)
|
||||
{
|
||||
stdstr ext = CPath(File).GetExtension();
|
||||
if (!(_stricmp(ext.c_str(), "ndd") == 0))
|
||||
{
|
||||
delete g_DDRom;
|
||||
g_DDRom = NULL;
|
||||
g_BaseSystem->RunFileImage(File.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Open Disk
|
||||
if (g_BaseSystem->RunDiskImage(File.c_str()))
|
||||
{
|
||||
stdstr IPLROM = g_Settings->LoadStringVal(File_DiskIPLPath);
|
||||
if ((IPLROM.length() <= 0) || (!g_BaseSystem->RunFileImage(IPLROM.c_str())))
|
||||
{
|
||||
// Open DDROM
|
||||
OPENFILENAME openfilename;
|
||||
char FileName[_MAX_PATH], Directory[_MAX_PATH];
|
||||
memset(&FileName, 0, sizeof(FileName));
|
||||
memset(&openfilename, 0, sizeof(openfilename));
|
||||
|
||||
strcpy(Directory, g_Settings->LoadStringVal(RomList_GameDir).c_str());
|
||||
openfilename.lStructSize = sizeof(openfilename);
|
||||
openfilename.hwndOwner = (HWND)hWnd;
|
||||
openfilename.lpstrFilter = "64DD IPL ROM Image (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal\0All files (*.*)\0*.*\0";
|
||||
openfilename.lpstrFile = FileName;
|
||||
openfilename.lpstrInitialDir = Directory;
|
||||
openfilename.nMaxFile = MAX_PATH;
|
||||
openfilename.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
|
||||
|
||||
if (GetOpenFileName(&openfilename))
|
||||
{
|
||||
g_BaseSystem->RunFileImage(FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
switch (MenuID)
|
||||
{
|
||||
case ID_FILE_OPEN_ROM: OnOpenRom(hWnd); break;
|
||||
case ID_FILE_ROM_INFO:
|
||||
{
|
||||
if (g_Rom)
|
||||
|
|
|
@ -73,6 +73,7 @@ private:
|
|||
CMainMenu(const CMainMenu&); // Disable copy constructor
|
||||
CMainMenu& operator=(const CMainMenu&); // Disable assignment
|
||||
|
||||
void OnOpenRom(HWND hWnd);
|
||||
void FillOutMenu(HMENU hMenu);
|
||||
std::wstring GetSaveSlotString(int Slot);
|
||||
stdstr GetFileLastMod(const CPath & FileName);
|
||||
|
|
Loading…
Reference in New Issue