Compare commits

...

4 Commits

Author SHA1 Message Date
GalaxyShard
75368dc523
Merge b6b70c4147 into 7c1d2a64f4 2024-11-11 19:32:15 +03:00
Nadia Holmquist Pedersen
7c1d2a64f4 Set WIN32_LEAN_AND_MEAN, gets rid of the winsock2 warnings and probably
Some checks failed
macOS / ${{ matrix.arch }} (arm64) (push) Has been cancelled
macOS / ${{ matrix.arch }} (x86_64) (push) Has been cancelled
Ubuntu / x86_64 (push) Has been cancelled
Ubuntu / aarch64 (push) Has been cancelled
Windows / build (push) Has been cancelled
macOS / Universal binary (push) Has been cancelled
speeds up compilation a tiny bit

oh and NOMINMAX too for good measure while we're at it
2024-11-11 14:18:05 +01:00
Nadia Holmquist Pedersen
b2f6fab6f4 cmake: use interface include directories properly
and fix an indent I guess
2024-11-11 12:06:12 +01:00
GalaxyShard
b6b70c4147
cli option to toggle gdb breakOnStart 2024-10-29 01:41:32 -04:00
10 changed files with 74 additions and 19 deletions

View File

@ -127,6 +127,8 @@ if (ENABLE_JIT)
endif()
endif()
target_include_directories(core INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
set(MELONDS_VERSION_SUFFIX "$ENV{MELONDS_VERSION_SUFFIX}" CACHE STRING "Suffix to add to displayed melonDS version")
option(MELONDS_EMBED_BUILD_INFO "Embed detailed build info into the binary" OFF)
set(MELONDS_GIT_BRANCH "$ENV{MELONDS_GIT_BRANCH}" CACHE STRING "The Git branch used for this build")
@ -178,13 +180,14 @@ endif()
if (WIN32)
target_link_libraries(core PRIVATE ole32 comctl32 wsock32 ws2_32)
target_compile_definitions(core PUBLIC WIN32_LEAN_AND_MEAN NOMINMAX)
elseif(NOT APPLE AND NOT HAIKU)
check_library_exists(rt shm_open "" NEED_LIBRT)
if (NEED_LIBRT)
target_link_libraries(core PRIVATE rt)
endif()
elseif(HAIKU)
target_link_libraries(core PRIVATE network)
target_link_libraries(core PRIVATE network)
endif()
if (ENABLE_JIT_PROFILING)

View File

@ -44,6 +44,13 @@ CommandLineOptions* ManageArgs(QApplication& melon)
parser.addOption(QCommandLineOption({"b", "boot"}, "Whether to boot firmware on startup. Defaults to \"auto\" (boot if NDS rom given)", "auto/always/never", "auto"));
parser.addOption(QCommandLineOption({"f", "fullscreen"}, "Start melonDS in fullscreen mode"));
#ifdef GDBSTUB_ENABLED
parser.addOption(QCommandLineOption("break-arm9", "Yield ARM9 execution to the GDB stub immediately on startup"));
parser.addOption(QCommandLineOption("break-arm7", "Yield ARM7 execution to the GDB stub immediately on startup"));
parser.addOption(QCommandLineOption("no-break-arm9", "Do not wait for GDB on ARM9 startup, even if the option to do so is enabled"));
parser.addOption(QCommandLineOption("no-break-arm7", "Do not wait for GDB on ARM9 startup, even if the option to do so is enabled"));
#endif
#ifdef ARCHIVE_SUPPORT_ENABLED
parser.addOption(QCommandLineOption({"a", "archive-file"}, "Specify file to load inside an archive given (NDS)", "rom"));
parser.addOption(QCommandLineOption({"A", "archive-file-gba"}, "Specify file to load inside an archive given (GBA)", "rom"));
@ -55,6 +62,25 @@ CommandLineOptions* ManageArgs(QApplication& melon)
options->fullscreen = parser.isSet("fullscreen");
#ifdef GDBSTUB_ENABLED
if (parser.isSet("break-arm9"))
{
options->arm9BreakOnStartup = true;
}
if (parser.isSet("no-break-arm9"))
{
options->arm9BreakOnStartup = false;
}
if (parser.isSet("break-arm7"))
{
options->arm7BreakOnStartup = true;
}
if (parser.isSet("no-break-arm7"))
{
options->arm7BreakOnStartup = false;
}
#endif
QStringList posargs = parser.positionalArguments();
switch (posargs.size())
{

View File

@ -34,6 +34,10 @@ struct CommandLineOptions
std::optional<QString> gbaRomArchivePath;
bool fullscreen;
bool boot;
#ifdef GDBSTUB_ENABLED
std::optional<bool> arm9BreakOnStartup;
std::optional<bool> arm7BreakOnStartup;
#endif
};
extern CommandLineOptions* ManageArgs(QApplication& melon);

View File

@ -91,8 +91,7 @@ add_compile_definitions(ARCHIVE_SUPPORT_ENABLED)
add_executable(melonDS ${SOURCES_QT_SDL})
add_subdirectory("../../net"
"${CMAKE_BINARY_DIR}/net"
)
${CMAKE_BINARY_DIR}/net)
target_link_libraries(melonDS PRIVATE net-utils)
@ -171,10 +170,10 @@ if (BUILD_STATIC)
endif()
endif()
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../..")
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../../net")
target_include_directories(melonDS PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/..")
if (USE_QT6)
target_include_directories(melonDS PUBLIC ${Qt6Gui_PRIVATE_INCLUDE_DIRS})
else()

View File

@ -65,7 +65,12 @@ const string kWifiSettingsPath = "wfcsettings.bin";
extern Net net;
EmuInstance::EmuInstance(int inst) : deleting(false),
EmuInstance::EmuInstance(int inst, std::optional<bool> arm9BreakOnStart, std::optional<bool> arm7BreakOnStart) :
#ifdef GDBSTUB_ENABLED
overrideArm9BreakOnStart(arm9BreakOnStart),
overrideArm7BreakOnStart(arm7BreakOnStart),
#endif
deleting(false),
instanceID(inst),
globalCfg(Config::GetGlobalTable()),
localCfg(Config::GetLocalTable(inst))
@ -147,6 +152,12 @@ EmuInstance::EmuInstance(int inst) : deleting(false),
}
}
EmuInstance::EmuInstance(int inst) :
EmuInstance(inst, std::nullopt, std::nullopt)
{
}
EmuInstance::~EmuInstance()
{
deleting = true;
@ -1283,8 +1294,8 @@ bool EmuInstance::updateConsole(UpdateConsoleNDSArgs&& _ndsargs, UpdateConsoleGB
GDBArgs _gdbargs {
static_cast<u16>(gdbopt.GetInt("ARM7.Port")),
static_cast<u16>(gdbopt.GetInt("ARM9.Port")),
gdbopt.GetBool("ARM7.BreakOnStartup"),
gdbopt.GetBool("ARM9.BreakOnStartup"),
overrideArm7BreakOnStart.value_or(gdbopt.GetBool("ARM7.BreakOnStartup")),
overrideArm9BreakOnStart.value_or(gdbopt.GetBool("ARM9.BreakOnStartup")),
};
auto gdbargs = gdbopt.GetBool("Enabled") ? std::make_optional(_gdbargs) : std::nullopt;
#else

View File

@ -79,6 +79,7 @@ class EmuInstance
{
public:
EmuInstance(int inst);
EmuInstance(int inst, std::optional<bool> arm9BreakOnStart, std::optional<bool> arm7BreakOnStart);
~EmuInstance();
int getInstanceID() { return instanceID; }
@ -265,6 +266,11 @@ private:
std::string baseGBAROMName;
std::string baseGBAAssetName;
#ifdef GDBSTUB_ENABLED
std::optional<bool> overrideArm9BreakOnStart = std::nullopt;
std::optional<bool> overrideArm7BreakOnStart = std::nullopt;
#endif
// HACK
public:
std::unique_ptr<SaveManager> ndsSave;

View File

@ -1709,7 +1709,7 @@ void MainWindow::onOpenTitleManager()
void MainWindow::onMPNewInstance()
{
createEmuInstance();
createEmuInstance(std::nullopt, std::nullopt);
}
void MainWindow::onLANStartHost()

View File

@ -118,7 +118,7 @@ void NetInit()
}
bool createEmuInstance()
bool createEmuInstance(std::optional<bool> arm9BreakOnStartup, std::optional<bool> arm7BreakOnStartup)
{
int id = -1;
for (int i = 0; i < kMaxEmuInstances; i++)
@ -133,7 +133,11 @@ bool createEmuInstance()
if (id == -1)
return false;
#ifdef GDBSTUB_ENABLED
auto inst = new EmuInstance(id, arm9BreakOnStartup, arm7BreakOnStartup);
#else
auto inst = new EmuInstance(id);
#endif
emuInstances[id] = inst;
return true;
@ -348,9 +352,11 @@ int main(int argc, char** argv)
setMPInterface(MPInterface_Local);
NetInit();
createEmuInstance();
#ifdef GDBSTUB_ENABLED
createEmuInstance(options->arm9BreakOnStartup, options->arm7BreakOnStartup);
#else
createEmuInstance(std::nullopt, std::nullopt);
#endif
{
MainWindow* win = emuInstances[0]->getMainWindow();
bool memberSyntaxUsed = false;

View File

@ -54,7 +54,7 @@ extern QString emuDirectory;
extern QElapsedTimer sysTimer;
bool createEmuInstance();
bool createEmuInstance(std::optional<bool> arm9BreakOnStartup, std::optional<bool> arm7BreakOnStartup);
void deleteEmuInstance(int id);
void deleteAllEmuInstances(int first = 0);
int numEmuInstances();

View File

@ -11,9 +11,9 @@ add_library(net-utils STATIC
MPInterface.cpp
)
target_include_directories(net-utils PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
target_include_directories(net-utils PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_include_directories(net-utils PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/..")
option(USE_SYSTEM_LIBSLIRP "Use system libslirp instead of the bundled version" OFF)
if (USE_SYSTEM_LIBSLIRP)