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
|
#ifdef GDBSTUB_ENABLED
|
||||||
if (parser.isSet("break-arm9"))
|
if (parser.isSet("break-arm9"))
|
||||||
{
|
{
|
||||||
options->arm9BreakOnStartup = true;
|
options->arm9BreakOnStart = true;
|
||||||
}
|
}
|
||||||
if (parser.isSet("no-break-arm9"))
|
if (parser.isSet("no-break-arm9"))
|
||||||
{
|
{
|
||||||
options->arm9BreakOnStartup = false;
|
options->arm9BreakOnStart = false;
|
||||||
}
|
}
|
||||||
if (parser.isSet("break-arm7"))
|
if (parser.isSet("break-arm7"))
|
||||||
{
|
{
|
||||||
options->arm7BreakOnStartup = true;
|
options->arm7BreakOnStart = true;
|
||||||
}
|
}
|
||||||
if (parser.isSet("no-break-arm7"))
|
if (parser.isSet("no-break-arm7"))
|
||||||
{
|
{
|
||||||
options->arm7BreakOnStartup = false;
|
options->arm7BreakOnStart = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,8 @@ struct CommandLineOptions
|
||||||
bool fullscreen;
|
bool fullscreen;
|
||||||
bool boot;
|
bool boot;
|
||||||
#ifdef GDBSTUB_ENABLED
|
#ifdef GDBSTUB_ENABLED
|
||||||
std::optional<bool> arm9BreakOnStartup;
|
std::optional<bool> arm9BreakOnStart;
|
||||||
std::optional<bool> arm7BreakOnStartup;
|
std::optional<bool> arm7BreakOnStart;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -65,10 +65,10 @@ const string kWifiSettingsPath = "wfcsettings.bin";
|
||||||
extern Net net;
|
extern Net net;
|
||||||
|
|
||||||
|
|
||||||
EmuInstance::EmuInstance(int inst, std::optional<bool> arm9BreakOnStart, std::optional<bool> arm7BreakOnStart) :
|
EmuInstance::EmuInstance(int inst, InstanceStartupOptions options) :
|
||||||
#ifdef GDBSTUB_ENABLED
|
#ifdef GDBSTUB_ENABLED
|
||||||
overrideArm9BreakOnStart(arm9BreakOnStart),
|
overrideArm9BreakOnStart(options.arm9BreakOnStart),
|
||||||
overrideArm7BreakOnStart(arm7BreakOnStart),
|
overrideArm7BreakOnStart(options.arm7BreakOnStart),
|
||||||
#endif
|
#endif
|
||||||
deleting(false),
|
deleting(false),
|
||||||
instanceID(inst),
|
instanceID(inst),
|
||||||
|
@ -155,7 +155,7 @@ EmuInstance::EmuInstance(int inst, std::optional<bool> arm9BreakOnStart, std::op
|
||||||
}
|
}
|
||||||
|
|
||||||
EmuInstance::EmuInstance(int inst) :
|
EmuInstance::EmuInstance(int inst) :
|
||||||
EmuInstance(inst, std::nullopt, std::nullopt)
|
EmuInstance(inst, {})
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,12 @@
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
|
||||||
|
struct InstanceStartupOptions
|
||||||
|
{
|
||||||
|
std::optional<bool> arm9BreakOnStart;
|
||||||
|
std::optional<bool> arm7BreakOnStart;
|
||||||
|
};
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "NDS.h"
|
#include "NDS.h"
|
||||||
#include "EmuThread.h"
|
#include "EmuThread.h"
|
||||||
|
@ -79,7 +85,7 @@ class EmuInstance
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EmuInstance(int inst);
|
EmuInstance(int inst);
|
||||||
EmuInstance(int inst, std::optional<bool> arm9BreakOnStart, std::optional<bool> arm7BreakOnStart);
|
EmuInstance(int inst, InstanceStartupOptions options);
|
||||||
~EmuInstance();
|
~EmuInstance();
|
||||||
|
|
||||||
int getInstanceID() { return instanceID; }
|
int getInstanceID() { return instanceID; }
|
||||||
|
|
|
@ -1688,7 +1688,7 @@ void MainWindow::onOpenTitleManager()
|
||||||
|
|
||||||
void MainWindow::onMPNewInstance()
|
void MainWindow::onMPNewInstance()
|
||||||
{
|
{
|
||||||
createEmuInstance(std::nullopt, std::nullopt);
|
createEmuInstance({});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onLANStartHost()
|
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;
|
int id = -1;
|
||||||
for (int i = 0; i < kMaxEmuInstances; i++)
|
for (int i = 0; i < kMaxEmuInstances; i++)
|
||||||
|
@ -133,11 +133,7 @@ bool createEmuInstance(std::optional<bool> arm9BreakOnStartup, std::optional<boo
|
||||||
if (id == -1)
|
if (id == -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifdef GDBSTUB_ENABLED
|
auto inst = new EmuInstance(id, options);
|
||||||
auto inst = new EmuInstance(id, arm9BreakOnStartup, arm7BreakOnStartup);
|
|
||||||
#else
|
|
||||||
auto inst = new EmuInstance(id);
|
|
||||||
#endif
|
|
||||||
emuInstances[id] = inst;
|
emuInstances[id] = inst;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -352,11 +348,14 @@ int main(int argc, char** argv)
|
||||||
setMPInterface(MPInterface_Local);
|
setMPInterface(MPInterface_Local);
|
||||||
|
|
||||||
NetInit();
|
NetInit();
|
||||||
|
|
||||||
|
InstanceStartupOptions instanceOptions;
|
||||||
#ifdef GDBSTUB_ENABLED
|
#ifdef GDBSTUB_ENABLED
|
||||||
createEmuInstance(options->arm9BreakOnStartup, options->arm7BreakOnStartup);
|
instanceOptions.arm9BreakOnStart = options->arm9BreakOnStart;
|
||||||
#else
|
instanceOptions.arm7BreakOnStart = options->arm7BreakOnStart;
|
||||||
createEmuInstance(std::nullopt, std::nullopt);
|
|
||||||
#endif
|
#endif
|
||||||
|
createEmuInstance(instanceOptions);
|
||||||
|
|
||||||
{
|
{
|
||||||
MainWindow* win = emuInstances[0]->getMainWindow();
|
MainWindow* win = emuInstances[0]->getMainWindow();
|
||||||
bool memberSyntaxUsed = false;
|
bool memberSyntaxUsed = false;
|
||||||
|
|
|
@ -54,7 +54,7 @@ extern QString emuDirectory;
|
||||||
|
|
||||||
extern QElapsedTimer sysTimer;
|
extern QElapsedTimer sysTimer;
|
||||||
|
|
||||||
bool createEmuInstance(std::optional<bool> arm9BreakOnStartup, std::optional<bool> arm7BreakOnStartup);
|
bool createEmuInstance(InstanceStartupOptions options);
|
||||||
void deleteEmuInstance(int id);
|
void deleteEmuInstance(int id);
|
||||||
void deleteAllEmuInstances(int first = 0);
|
void deleteAllEmuInstances(int first = 0);
|
||||||
int numEmuInstances();
|
int numEmuInstances();
|
||||||
|
|
Loading…
Add table
Reference in a new issue