[App] Add Command Line Combo N64 + 64DD Image Loading

With --combo <Disk Image> <ROM Image>
This commit is contained in:
LuigiBlood 2019-08-22 13:16:58 +02:00
parent c78260ce54
commit 3cca0e5549
4 changed files with 46 additions and 6 deletions

View File

@ -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]));

View File

@ -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));

View File

@ -24,6 +24,7 @@ enum SettingID
//Command Settings
Cmd_BaseDirectory,
Cmd_RomFile,
Cmd_ComboDiskFile,
Cmd_ShowHelp,
//Support Files

View File

@ -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))