[App] Add "Open Combo" File Menu for Combo N64 + 64DD Loading.

Also added seperate functions for generic game loading, N64 ROM loading, and 64DD Disk loading.
This commit is contained in:
LuigiBlood 2019-08-22 13:44:30 +02:00
parent 3cca0e5549
commit f43201fdea
5 changed files with 55 additions and 6 deletions

View File

@ -64,6 +64,7 @@ enum LanguageStringID
MENU_RECENT_ROM = 107,
MENU_RECENT_DIR = 108,
MENU_EXIT = 109,
MENU_OPEN_COMBO = 110,
//System Menu
MENU_SYSTEM = 120,

View File

@ -71,6 +71,7 @@ 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_OPEN_COMBO, "Open &Combo");
//System Menu
DEF_STR(MENU_SYSTEM, "&System");

View File

@ -96,7 +96,29 @@ int CMainMenu::ProcessAccelerator(HWND hWnd, void * lpMsg)
std::string CMainMenu::ChooseFileToOpen(HWND hParent)
{
CPath FileName;
const char * Filter = "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";
const char * Filter = "N64 ROMs & Disks (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin, *.ndd, *.d64)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal;*.ndd;*.d64\0All files (*.*)\0*.*\0";
if (FileName.SelectFile(hParent, g_Settings->LoadStringVal(RomList_GameDir).c_str(), Filter, true))
{
return FileName;
}
return "";
}
std::string CMainMenu::ChooseROMFileToOpen(HWND hParent)
{
CPath FileName;
const char * Filter = "N64 ROMs (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal\0All files (*.*)\0*.*\0";
if (FileName.SelectFile(hParent, g_Settings->LoadStringVal(RomList_GameDir).c_str(), Filter, true))
{
return FileName;
}
return "";
}
std::string CMainMenu::ChooseDiskFileToOpen(HWND hParent)
{
CPath FileName;
const char * Filter = "N64DD Disk Image (*.ndd, *.d64)\0*.ndd;*.d64\0All files (*.*)\0*.*\0";
if (FileName.SelectFile(hParent, g_Settings->LoadStringVal(RomList_GameDir).c_str(), Filter, true))
{
return FileName;
@ -130,6 +152,23 @@ void CMainMenu::OnOpenRom(HWND hWnd)
}
}
void CMainMenu::OnOpenCombo(HWND hWnd)
{
std::string FileROM = ChooseROMFileToOpen(hWnd);
if (FileROM.length() == 0)
{
return;
}
std::string FileDisk = ChooseDiskFileToOpen(hWnd);
if (FileDisk.length() == 0)
{
return;
}
g_BaseSystem->RunDiskComboImage(FileROM.c_str(), FileDisk.c_str());
}
void CMainMenu::OnRomInfo(HWND hWnd)
{
if (g_Disk)
@ -245,6 +284,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
switch (MenuID)
{
case ID_FILE_OPEN_ROM: OnOpenRom(hWnd); break;
case ID_FILE_OPEN_COMBO: OnOpenCombo(hWnd); break;
case ID_FILE_ROM_INFO: OnRomInfo(hWnd); break;
case ID_FILE_STARTEMULATION:
m_Gui->SaveWindowLoc();
@ -293,12 +333,11 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
WriteTrace(TraceUserInterface, TraceDebug, "ID_SYSTEM_SWAPDISK");
{
// Open Disk
CPath FileName;
const char * Filter = "N64DD Disk Image (*.ndd, *.d64)\0*.ndd;*.d64\0All files (*.*)\0*.*\0";
if (FileName.SelectFile(hWnd, g_Settings->LoadStringVal(RomList_GameDir).c_str(), Filter, true))
stdstr FileName = ChooseDiskFileToOpen(hWnd);
if (FileName.length() != 0)
{
g_Disk->SaveDiskImage();
g_Disk->SwapDiskImage(FileName);
g_Disk->SwapDiskImage(FileName.c_str());
}
}
break;
@ -752,6 +791,8 @@ void CMainMenu::FillOutMenu(HMENU hMenu)
MenuItemList FileMenu;
Item.Reset(ID_FILE_OPEN_ROM, MENU_OPEN, m_ShortCuts.ShortCutString(ID_FILE_OPEN_ROM, RunningState));
FileMenu.push_back(Item);
Item.Reset(ID_FILE_OPEN_COMBO, MENU_OPEN_COMBO, m_ShortCuts.ShortCutString(ID_FILE_OPEN_COMBO, RunningState));
FileMenu.push_back(Item);
if (!inBasicMode)
{
Item.Reset(ID_FILE_ROM_INFO, MENU_ROM_INFO, m_ShortCuts.ShortCutString(ID_FILE_ROM_INFO, RunningState));

View File

@ -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_OPEN_ROM = 4000, ID_FILE_OPEN_COMBO, ID_FILE_ROM_INFO, ID_FILE_STARTEMULATION, ID_FILE_ENDEMULATION,
ID_FILE_ROMDIRECTORY, ID_FILE_REFRESHROMLIST, ID_FILE_EXIT,
//language
@ -75,6 +75,7 @@ private:
CMainMenu& operator=(const CMainMenu&); // Disable assignment
void OnOpenRom(HWND hWnd);
void OnOpenCombo(HWND hWnd);
void OnRomInfo(HWND hWnd);
void OnEndEmulation(void);
void OnScreenShot(void);
@ -88,6 +89,8 @@ private:
stdstr GetFileLastMod(const CPath & FileName);
void RebuildAccelerators(void);
std::string ChooseFileToOpen(HWND hParent);
std::string ChooseROMFileToOpen(HWND hParent);
std::string ChooseDiskFileToOpen(HWND hParent);
void SetTraceModuleSetttings(SettingID Type);
static void SettingsChanged(CMainMenu * _this);

View File

@ -379,6 +379,7 @@ void CShortCuts::Load(bool InitialValues)
m_ShortCuts.clear();
AddShortCut(ID_FILE_OPEN_ROM, STR_SHORTCUT_FILEMENU, MENU_OPEN, CMenuShortCutKey::ACCESS_NOT_IN_FULLSCREEN);
AddShortCut(ID_FILE_OPEN_COMBO, STR_SHORTCUT_FILEMENU, MENU_OPEN_COMBO, CMenuShortCutKey::ACCESS_NOT_IN_FULLSCREEN);
AddShortCut(ID_FILE_ROM_INFO, STR_SHORTCUT_FILEMENU, MENU_ROM_INFO, CMenuShortCutKey::ACCESS_NOT_IN_FULLSCREEN);
AddShortCut(ID_FILE_STARTEMULATION, STR_SHORTCUT_FILEMENU, MENU_START, CMenuShortCutKey::ACCESS_NOT_IN_FULLSCREEN);
AddShortCut(ID_FILE_ENDEMULATION, STR_SHORTCUT_FILEMENU, MENU_END, CMenuShortCutKey::ACCESS_GAME_RUNNING);
@ -431,6 +432,8 @@ void CShortCuts::Load(bool InitialValues)
{
m_ShortCuts.find(ID_FILE_OPEN_ROM)->second.AddShortCut('O', TRUE, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_FILE_OPEN_ROM)->second.AddShortCut('O', TRUE, false, false, CMenuShortCutKey::ACCESS_GAME_NOT_RUNNING);
m_ShortCuts.find(ID_FILE_OPEN_COMBO)->second.AddShortCut('O', TRUE, false, TRUE, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_FILE_OPEN_COMBO)->second.AddShortCut('O', TRUE, false, TRUE, CMenuShortCutKey::ACCESS_GAME_NOT_RUNNING);
m_ShortCuts.find(ID_FILE_STARTEMULATION)->second.AddShortCut(VK_F11, false, false, false, CMenuShortCutKey::ACCESS_GAME_NOT_RUNNING);
m_ShortCuts.find(ID_FILE_ENDEMULATION)->second.AddShortCut(VK_F12, false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_FILE_REFRESHROMLIST)->second.AddShortCut(VK_F5, false, false, false, CMenuShortCutKey::ACCESS_GAME_NOT_RUNNING);