mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-03-06 21:00:31 +01:00
add InstanceStartupOptions for argument passing
Currently is used to pass GDB stub options to the EmuInstance
This commit is contained in:
parent
b6b70c4147
commit
fceb46195f
7 changed files with 27 additions and 22 deletions
|
@ -65,19 +65,19 @@ CommandLineOptions* ManageArgs(QApplication& melon)
|
|||
#ifdef GDBSTUB_ENABLED
|
||||
if (parser.isSet("break-arm9"))
|
||||
{
|
||||
options->arm9BreakOnStartup = true;
|
||||
options->arm9BreakOnStart = true;
|
||||
}
|
||||
if (parser.isSet("no-break-arm9"))
|
||||
{
|
||||
options->arm9BreakOnStartup = false;
|
||||
options->arm9BreakOnStart = false;
|
||||
}
|
||||
if (parser.isSet("break-arm7"))
|
||||
{
|
||||
options->arm7BreakOnStartup = true;
|
||||
options->arm7BreakOnStart = true;
|
||||
}
|
||||
if (parser.isSet("no-break-arm7"))
|
||||
{
|
||||
options->arm7BreakOnStartup = false;
|
||||
options->arm7BreakOnStart = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ struct CommandLineOptions
|
|||
bool fullscreen;
|
||||
bool boot;
|
||||
#ifdef GDBSTUB_ENABLED
|
||||
std::optional<bool> arm9BreakOnStartup;
|
||||
std::optional<bool> arm7BreakOnStartup;
|
||||
std::optional<bool> arm9BreakOnStart;
|
||||
std::optional<bool> arm7BreakOnStart;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -65,10 +65,10 @@ const string kWifiSettingsPath = "wfcsettings.bin";
|
|||
extern Net net;
|
||||
|
||||
|
||||
EmuInstance::EmuInstance(int inst, std::optional<bool> arm9BreakOnStart, std::optional<bool> arm7BreakOnStart) :
|
||||
EmuInstance::EmuInstance(int inst, InstanceStartupOptions options) :
|
||||
#ifdef GDBSTUB_ENABLED
|
||||
overrideArm9BreakOnStart(arm9BreakOnStart),
|
||||
overrideArm7BreakOnStart(arm7BreakOnStart),
|
||||
overrideArm9BreakOnStart(options.arm9BreakOnStart),
|
||||
overrideArm7BreakOnStart(options.arm7BreakOnStart),
|
||||
#endif
|
||||
deleting(false),
|
||||
instanceID(inst),
|
||||
|
@ -155,7 +155,7 @@ EmuInstance::EmuInstance(int inst, std::optional<bool> arm9BreakOnStart, std::op
|
|||
}
|
||||
|
||||
EmuInstance::EmuInstance(int inst) :
|
||||
EmuInstance(inst, std::nullopt, std::nullopt)
|
||||
EmuInstance(inst, {})
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,12 @@
|
|||
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
struct InstanceStartupOptions
|
||||
{
|
||||
std::optional<bool> arm9BreakOnStart;
|
||||
std::optional<bool> arm7BreakOnStart;
|
||||
};
|
||||
|
||||
#include "main.h"
|
||||
#include "NDS.h"
|
||||
#include "EmuThread.h"
|
||||
|
@ -79,7 +85,7 @@ class EmuInstance
|
|||
{
|
||||
public:
|
||||
EmuInstance(int inst);
|
||||
EmuInstance(int inst, std::optional<bool> arm9BreakOnStart, std::optional<bool> arm7BreakOnStart);
|
||||
EmuInstance(int inst, InstanceStartupOptions options);
|
||||
~EmuInstance();
|
||||
|
||||
int getInstanceID() { return instanceID; }
|
||||
|
|
|
@ -1688,7 +1688,7 @@ void MainWindow::onOpenTitleManager()
|
|||
|
||||
void MainWindow::onMPNewInstance()
|
||||
{
|
||||
createEmuInstance(std::nullopt, std::nullopt);
|
||||
createEmuInstance({});
|
||||
}
|
||||
|
||||
void MainWindow::onLANStartHost()
|
||||
|
|
|
@ -118,7 +118,7 @@ void NetInit()
|
|||
}
|
||||
|
||||
|
||||
bool createEmuInstance(std::optional<bool> arm9BreakOnStartup, std::optional<bool> arm7BreakOnStartup)
|
||||
bool createEmuInstance(InstanceStartupOptions options)
|
||||
{
|
||||
int id = -1;
|
||||
for (int i = 0; i < kMaxEmuInstances; i++)
|
||||
|
@ -133,11 +133,7 @@ bool createEmuInstance(std::optional<bool> arm9BreakOnStartup, std::optional<boo
|
|||
if (id == -1)
|
||||
return false;
|
||||
|
||||
#ifdef GDBSTUB_ENABLED
|
||||
auto inst = new EmuInstance(id, arm9BreakOnStartup, arm7BreakOnStartup);
|
||||
#else
|
||||
auto inst = new EmuInstance(id);
|
||||
#endif
|
||||
auto inst = new EmuInstance(id, options);
|
||||
emuInstances[id] = inst;
|
||||
|
||||
return true;
|
||||
|
@ -352,11 +348,14 @@ int main(int argc, char** argv)
|
|||
setMPInterface(MPInterface_Local);
|
||||
|
||||
NetInit();
|
||||
|
||||
InstanceStartupOptions instanceOptions;
|
||||
#ifdef GDBSTUB_ENABLED
|
||||
createEmuInstance(options->arm9BreakOnStartup, options->arm7BreakOnStartup);
|
||||
#else
|
||||
createEmuInstance(std::nullopt, std::nullopt);
|
||||
instanceOptions.arm9BreakOnStart = options->arm9BreakOnStart;
|
||||
instanceOptions.arm7BreakOnStart = options->arm7BreakOnStart;
|
||||
#endif
|
||||
createEmuInstance(instanceOptions);
|
||||
|
||||
{
|
||||
MainWindow* win = emuInstances[0]->getMainWindow();
|
||||
bool memberSyntaxUsed = false;
|
||||
|
|
|
@ -54,7 +54,7 @@ extern QString emuDirectory;
|
|||
|
||||
extern QElapsedTimer sysTimer;
|
||||
|
||||
bool createEmuInstance(std::optional<bool> arm9BreakOnStartup, std::optional<bool> arm7BreakOnStartup);
|
||||
bool createEmuInstance(InstanceStartupOptions options);
|
||||
void deleteEmuInstance(int id);
|
||||
void deleteAllEmuInstances(int first = 0);
|
||||
int numEmuInstances();
|
||||
|
|
Loading…
Add table
Reference in a new issue