[App] Add Command Line Combo N64 + 64DD Image Loading
With --combo <Disk Image> <ROM Image>
This commit is contained in:
parent
c78260ce54
commit
3cca0e5549
|
@ -186,6 +186,19 @@ static bool ParseCommand(int32_t argc, char **argv)
|
||||||
g_Settings->SaveBool(Cmd_ShowHelp, true);
|
g_Settings->SaveBool(Cmd_ShowHelp, true);
|
||||||
return false;
|
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] != '-')
|
else if (ArgsLeft == 0 && argv[i][0] != '-')
|
||||||
{
|
{
|
||||||
g_Settings->SaveString(Cmd_RomFile, &(argv[i][0]));
|
g_Settings->SaveString(Cmd_RomFile, &(argv[i][0]));
|
||||||
|
|
|
@ -90,6 +90,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
|
||||||
AddHandler(Cmd_BaseDirectory, new CSettingTypeTempString(BaseDirectory));
|
AddHandler(Cmd_BaseDirectory, new CSettingTypeTempString(BaseDirectory));
|
||||||
AddHandler(Cmd_ShowHelp, new CSettingTypeTempBool(false));
|
AddHandler(Cmd_ShowHelp, new CSettingTypeTempBool(false));
|
||||||
AddHandler(Cmd_RomFile, new CSettingTypeTempString(""));
|
AddHandler(Cmd_RomFile, new CSettingTypeTempString(""));
|
||||||
|
AddHandler(Cmd_ComboDiskFile, new CSettingTypeTempString(""));
|
||||||
|
|
||||||
//Support Files
|
//Support Files
|
||||||
AddHandler(SupportFile_Settings, new CSettingTypeApplicationPath("Settings", "ConfigFile", SupportFile_SettingsDefault));
|
AddHandler(SupportFile_Settings, new CSettingTypeApplicationPath("Settings", "ConfigFile", SupportFile_SettingsDefault));
|
||||||
|
|
|
@ -24,6 +24,7 @@ enum SettingID
|
||||||
//Command Settings
|
//Command Settings
|
||||||
Cmd_BaseDirectory,
|
Cmd_BaseDirectory,
|
||||||
Cmd_RomFile,
|
Cmd_RomFile,
|
||||||
|
Cmd_ComboDiskFile,
|
||||||
Cmd_ShowHelp,
|
Cmd_ShowHelp,
|
||||||
|
|
||||||
//Support Files
|
//Support Files
|
||||||
|
|
|
@ -23,24 +23,49 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /
|
||||||
g_Plugins->SetRenderWindows(&MainWindow, &HiddenWindow);
|
g_Plugins->SetRenderWindows(&MainWindow, &HiddenWindow);
|
||||||
Notify().SetMainWindow(&MainWindow);
|
Notify().SetMainWindow(&MainWindow);
|
||||||
CSupportWindow SupportWindow;
|
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
|
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();
|
stdstr ext = CPath(g_Settings->LoadStringVal(Cmd_RomFile)).GetExtension();
|
||||||
if ((!(_stricmp(ext.c_str(), "ndd") == 0)) && (!(_stricmp(ext.c_str(), "d64") == 0)))
|
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
|
//File Extension is not *.ndd/*.d64 so it should be a N64 ROM
|
||||||
CN64System::RunFileImage(g_Settings->LoadStringVal(Cmd_RomFile).c_str());
|
isROMLoaded = CN64System::RunFileImage(g_Settings->LoadStringVal(Cmd_RomFile).c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Ext is *.ndd/*.d64, so it should be a disk file.
|
//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()));
|
SupportWindow.Show(reinterpret_cast<HWND>(MainWindow.GetWindowHandle()));
|
||||||
if (UISettingsLoadBool(RomBrowser_Enabled))
|
if (UISettingsLoadBool(RomBrowser_Enabled))
|
||||||
|
|
Loading…
Reference in New Issue