From 96a6862c80dc8f2cfc987b809b97c539dc578edd Mon Sep 17 00:00:00 2001 From: luigiblood Date: Tue, 26 Jan 2016 03:04:48 +0100 Subject: [PATCH] Use Open ROM to open Disk instead It's a much better idea anyway. --- Source/Project64-core/Multilanguage.h | 1 - .../Multilanguage/LanguageClass.cpp | 1 - .../Project64/UserInterface/MainMenuClass.cpp | 100 +++++++----------- .../Project64/UserInterface/MainMenuClass.h | 2 +- 4 files changed, 40 insertions(+), 64 deletions(-) diff --git a/Source/Project64-core/Multilanguage.h b/Source/Project64-core/Multilanguage.h index f3d8ab7f7..64bf79658 100644 --- a/Source/Project64-core/Multilanguage.h +++ b/Source/Project64-core/Multilanguage.h @@ -63,7 +63,6 @@ enum LanguageStringID{ MENU_RECENT_ROM = 107, MENU_RECENT_DIR = 108, MENU_EXIT = 109, - MENU_DISK = 110, //System Menu MENU_SYSTEM = 120, diff --git a/Source/Project64-core/Multilanguage/LanguageClass.cpp b/Source/Project64-core/Multilanguage/LanguageClass.cpp index 50a4b34c1..861c1f186 100644 --- a/Source/Project64-core/Multilanguage/LanguageClass.cpp +++ b/Source/Project64-core/Multilanguage/LanguageClass.cpp @@ -71,7 +71,6 @@ void CLanguage::LoadDefaultStrings(void) DEF_STR(MENU_RECENT_ROM, "Recent ROM"); DEF_STR(MENU_RECENT_DIR, "Recent ROM Directories"); DEF_STR(MENU_EXIT, "E&xit"); - DEF_STR(MENU_DISK, "Open Disk"); //System Menu DEF_STR(MENU_SYSTEM, "&System"); diff --git a/Source/Project64/UserInterface/MainMenuClass.cpp b/Source/Project64/UserInterface/MainMenuClass.cpp index 0ad307fa5..cefc90b03 100644 --- a/Source/Project64/UserInterface/MainMenuClass.cpp +++ b/Source/Project64/UserInterface/MainMenuClass.cpp @@ -92,7 +92,7 @@ stdstr CMainMenu::ChooseFileToOpen(HWND hParent) openfilename.lStructSize = sizeof(openfilename); openfilename.hwndOwner = (HWND)hParent; - openfilename.lpstrFilter = "N64 ROMs (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal\0All files (*.*)\0*.*\0"; + openfilename.lpstrFilter = "N64 ROMs (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin, *.ndd)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal;*.ndd\0All files (*.*)\0*.*\0"; openfilename.lpstrFile = FileName; openfilename.lpstrInitialDir = Directory; openfilename.nMaxFile = MAX_PATH; @@ -119,67 +119,47 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI stdstr File = ChooseFileToOpen(hWnd); if (File.length() > 0) { - g_BaseSystem->RunFileImage(File.c_str()); - } - } - break; - case ID_FILE_DISK: - { - stdstr IPLROM = g_Settings->LoadStringVal(File_DiskIPLPath); - if ((IPLROM.length() <= 0) || (!g_BaseSystem->RunFileImageIPL(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(Directory_Game).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)) + stdstr Test = File.substr(File.length() - 3, 4); + Test.ToLower(); + if (!Test.compare(".ndd")) { - g_BaseSystem->RunFileImageIPL(FileName); - // Open Disk - openfilename.lpstrFilter = "N64DD Disk Image (*.ndd)\0*.ndd\0All files (*.*)\0*.*\0"; - if (GetOpenFileName(&openfilename)) - { - if (g_BaseSystem->RunDiskImage(FileName)) - g_BaseSystem->RunFileImage(g_Settings->LoadStringVal(File_DiskIPLPath).c_str()); - } + g_BaseSystem->RunFileImage(File.c_str()); } - } - else - { - // Open Disk - OPENFILENAME openfilename; - char FileName[_MAX_PATH], Directory[_MAX_PATH]; - - memset(&FileName, 0, sizeof(FileName)); - memset(&openfilename, 0, sizeof(openfilename)); - - strcpy(Directory, g_Settings->LoadStringVal(Directory_Game).c_str()); - - openfilename.lStructSize = sizeof(openfilename); - openfilename.hwndOwner = (HWND)hWnd; - openfilename.lpstrFilter = "N64DD Disk Image (*.ndd)\0*.ndd\0All files (*.*)\0*.*\0"; - openfilename.lpstrFile = FileName; - openfilename.lpstrInitialDir = Directory; - openfilename.nMaxFile = MAX_PATH; - openfilename.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - - if (GetOpenFileName(&openfilename)) + else { - if (g_BaseSystem->RunDiskImage(FileName)) - g_BaseSystem->RunFileImage(g_Settings->LoadStringVal(File_DiskIPLPath).c_str()); + // 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(Directory_Game).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); + } + } + else + { + g_BaseSystem->RunFileImage(IPLROM.c_str()); + } + } } } } @@ -752,8 +732,6 @@ void CMainMenu::FillOutMenu(HMENU hMenu) MenuItemList FileMenu; Item.Reset(ID_FILE_OPEN_ROM, MENU_OPEN, m_ShortCuts.ShortCutString(ID_FILE_OPEN_ROM, AccessLevel)); FileMenu.push_back(Item); - Item.Reset(ID_FILE_DISK, MENU_DISK, m_ShortCuts.ShortCutString(ID_FILE_DISK, AccessLevel)); - FileMenu.push_back(Item); if (!inBasicMode) { Item.Reset(ID_FILE_ROM_INFO, MENU_ROM_INFO, m_ShortCuts.ShortCutString(ID_FILE_ROM_INFO, AccessLevel)); diff --git a/Source/Project64/UserInterface/MainMenuClass.h b/Source/Project64/UserInterface/MainMenuClass.h index 32540c725..dafda79c5 100644 --- a/Source/Project64/UserInterface/MainMenuClass.h +++ b/Source/Project64/UserInterface/MainMenuClass.h @@ -4,7 +4,7 @@ enum MainMenuID { //File Menu ID_FILE_OPEN_ROM = 4000, ID_FILE_ROM_INFO, ID_FILE_STARTEMULATION, ID_FILE_ENDEMULATION, - ID_FILE_ROMDIRECTORY, ID_FILE_REFRESHROMLIST, ID_FILE_EXIT, ID_FILE_DISK, + ID_FILE_ROMDIRECTORY, ID_FILE_REFRESHROMLIST, ID_FILE_EXIT, //language ID_LANG_START, ID_LANG_END = ID_LANG_START + 100,