Merge pull request #1646 from LuigiBlood/ddcomboload
Add Combo Loading in Command Line & Main Menu
This commit is contained in:
commit
546ae42bbc
|
@ -34,6 +34,7 @@
|
|||
#107# "Recent ROM"
|
||||
#108# "Recent ROM Directories"
|
||||
#109# "E&xit"
|
||||
#110# "Open &Combo"
|
||||
|
||||
//System Menu
|
||||
#120# "&System"
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#107# "ROM récentes"
|
||||
#108# "Répertoires des ROM récentes"
|
||||
#109# "&Quitter"
|
||||
#110# "Ouvrir &Combo"
|
||||
|
||||
//System Menu
|
||||
#120# "&Système"
|
||||
|
|
|
@ -186,6 +186,19 @@ static bool ParseCommand(int32_t argc, char **argv)
|
|||
g_Settings->SaveBool(Cmd_ShowHelp, true);
|
||||
return false;
|
||||
}
|
||||
else if (strcmp(argv[i], "--combo") == 0)
|
||||
{
|
||||
if (ArgsLeft >= 2)
|
||||
{
|
||||
g_Settings->SaveString(Cmd_ComboDiskFile, &(argv[i + 1][0]));
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceAppInit, TraceError, "not enough parameters for '%d: %s'", i, argv[i]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (ArgsLeft == 0 && argv[i][0] != '-')
|
||||
{
|
||||
g_Settings->SaveString(Cmd_RomFile, &(argv[i][0]));
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -90,6 +90,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
|
|||
AddHandler(Cmd_BaseDirectory, new CSettingTypeTempString(BaseDirectory));
|
||||
AddHandler(Cmd_ShowHelp, new CSettingTypeTempBool(false));
|
||||
AddHandler(Cmd_RomFile, new CSettingTypeTempString(""));
|
||||
AddHandler(Cmd_ComboDiskFile, new CSettingTypeTempString(""));
|
||||
|
||||
//Support Files
|
||||
AddHandler(SupportFile_Settings, new CSettingTypeApplicationPath("Settings", "ConfigFile", SupportFile_SettingsDefault));
|
||||
|
|
|
@ -24,6 +24,7 @@ enum SettingID
|
|||
//Command Settings
|
||||
Cmd_BaseDirectory,
|
||||
Cmd_RomFile,
|
||||
Cmd_ComboDiskFile,
|
||||
Cmd_ShowHelp,
|
||||
|
||||
//Support Files
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -23,24 +23,49 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /
|
|||
g_Plugins->SetRenderWindows(&MainWindow, &HiddenWindow);
|
||||
Notify().SetMainWindow(&MainWindow);
|
||||
CSupportWindow SupportWindow;
|
||||
bool isROMLoaded = false;
|
||||
|
||||
if (g_Settings->LoadStringVal(Cmd_RomFile).length() > 0)
|
||||
if (g_Settings->LoadStringVal(Cmd_RomFile).length() > 0 && g_Settings->LoadStringVal(Cmd_ComboDiskFile).length() > 0)
|
||||
{
|
||||
//Handle Combo Loading (N64 ROM AND 64DD Disk)
|
||||
|
||||
MainWindow.Show(true); //Show the main window
|
||||
//N64 ROM or 64DD Disk
|
||||
|
||||
stdstr extcombo = CPath(g_Settings->LoadStringVal(Cmd_ComboDiskFile)).GetExtension();
|
||||
stdstr ext = CPath(g_Settings->LoadStringVal(Cmd_RomFile)).GetExtension();
|
||||
|
||||
if (g_Settings->LoadStringVal(Cmd_ComboDiskFile).length() > 0
|
||||
&& ((_stricmp(extcombo.c_str(), "ndd") == 0) || (_stricmp(extcombo.c_str(), "d64") == 0)))
|
||||
{
|
||||
if ((!(_stricmp(ext.c_str(), "ndd") == 0)) && (!(_stricmp(ext.c_str(), "d64") == 0)))
|
||||
{
|
||||
//Cmd_ComboDiskFile must be a 64DD disk image
|
||||
//Cmd_RomFile must be a N64 ROM image
|
||||
isROMLoaded = CN64System::RunDiskComboImage(g_Settings->LoadStringVal(Cmd_RomFile).c_str(), g_Settings->LoadStringVal(Cmd_ComboDiskFile).c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (g_Settings->LoadStringVal(Cmd_RomFile).length() > 0)
|
||||
{
|
||||
//Handle Single Game (N64 ROM or 64DD Disk)
|
||||
|
||||
MainWindow.Show(true); //Show the main window
|
||||
|
||||
stdstr ext = CPath(g_Settings->LoadStringVal(Cmd_RomFile)).GetExtension();
|
||||
if ((!(_stricmp(ext.c_str(), "ndd") == 0)) && (!(_stricmp(ext.c_str(), "d64") == 0)))
|
||||
{
|
||||
//File Extension is not *.ndd so it should be a N64 ROM
|
||||
CN64System::RunFileImage(g_Settings->LoadStringVal(Cmd_RomFile).c_str());
|
||||
//File Extension is not *.ndd/*.d64 so it should be a N64 ROM
|
||||
isROMLoaded = CN64System::RunFileImage(g_Settings->LoadStringVal(Cmd_RomFile).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
//Ext is *.ndd/*.d64, so it should be a disk file.
|
||||
CN64System::RunDiskImage(g_Settings->LoadStringVal(Cmd_RomFile).c_str());
|
||||
isROMLoaded = CN64System::RunDiskImage(g_Settings->LoadStringVal(Cmd_RomFile).c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
//Handle Main Window if ROM is not loaded and running
|
||||
if (!isROMLoaded)
|
||||
{
|
||||
SupportWindow.Show(reinterpret_cast<HWND>(MainWindow.GetWindowHandle()));
|
||||
if (UISettingsLoadBool(RomBrowser_Enabled))
|
||||
|
|
Loading…
Reference in New Issue