Cemu/src/config/LaunchSettings.h

63 lines
2.0 KiB
C
Raw Normal View History

2022-08-22 22:21:23 +02:00
#pragma once
#include <optional>
#include <string>
class LaunchSettings
{
public:
// winmain
static bool HandleCommandline(const wchar_t* lpCmdLine);
// wmain
static bool HandleCommandline(int argc, wchar_t* argv[]);
// main (unix)
static bool HandleCommandline(int argc, char* argv[]);
static bool HandleCommandline(const std::vector<std::wstring>& args);
static std::optional<fs::path> GetLoadFile() { return s_load_game_file; }
static std::optional<uint64> GetLoadTitleID() {return s_load_title_id;}
2022-08-22 22:21:23 +02:00
static std::optional<fs::path> GetMLCPath() { return s_mlc_path; }
static std::optional<bool> RenderUpsideDownEnabled() { return s_render_upside_down; }
static std::optional<bool> FullscreenEnabled() { return s_fullscreen; }
Add GDB stub for debugging (#657) * Implement GDB stub debugger Can be enabled by using the "--enable-gdbstub" option (and the debugger GUI, although that's untested) which'll pause any game you launch at start-up. Will start at port 1337 although it'll eventually be user-editable. The code is a bit weirdly sorted and also just needs a general cleanup, so expect that eventually too. And uses egyptian braces but formatting was easier to do at the end, so that's also something to do. It has been tested to work with IDA Pro, Clion and the standalone interface for now, but I plan on writing some instructions in the PR to follow for people who want to use this. Memory breakpoints aren't possible yet, only execution breakpoints. This code was aimed to be decoupled from the existing debugger to be able to be ported to the Wii U for an equal debugging experience. That's also why it uses the Cafe OS's thread sleep and resuming functions whenever possible instead of using recompiler/interpreter controls. * Add memory writing and floating point registers support * Reformat code a bit * Format code to adhere to Cemu's coding style * Rework GDB Stub settings in GUI * Small styling fixes * Rework execution breakpoints Should work better in some edge cases now. But this should also allow for adding access breakpoints since it's now more separated. * Implement access breakpoints * Fix some issues with breakpoints * Fix includes for Linux * Fix unnecessary include * Tweaks for Linux compatibility * Use std::thread instead of std::jthread to fix MacOS support * Enable GDB read/write breakpoints on x86 only * Fix compilation for GCC compilers at least The thread type varies on some platforms, so supporting this is hell... but let's get it to compile on MacOS first. * Disable them for MacOS due to lack of ptrace --------- Co-authored-by: Exzap <13877693+Exzap@users.noreply.github.com>
2023-02-19 15:41:49 +01:00
static bool GDBStubEnabled() { return s_enable_gdbstub; }
2022-08-22 22:21:23 +02:00
static bool NSightModeEnabled() { return s_nsight_mode; }
static bool ForceIntelLegacyEnabled() { return s_force_intel_legacy; }
static bool ForceInterpreter() { return s_force_interpreter; };
static std::optional<uint32> GetPersistentId() { return s_persistent_id; }
static std::string GetActURLPrefix() { return serviceURL_ACT; }
static std::string GetServiceURL_ecs() { return serviceURL_ECS; }
static void ChangeNetworkServiceURL(int ID);
2022-08-22 22:21:23 +02:00
private:
inline static std::optional<fs::path> s_load_game_file{};
inline static std::optional<uint64> s_load_title_id{};
2022-08-22 22:21:23 +02:00
inline static std::optional<fs::path> s_mlc_path{};
inline static std::optional<bool> s_render_upside_down{};
inline static std::optional<bool> s_fullscreen{};
Add GDB stub for debugging (#657) * Implement GDB stub debugger Can be enabled by using the "--enable-gdbstub" option (and the debugger GUI, although that's untested) which'll pause any game you launch at start-up. Will start at port 1337 although it'll eventually be user-editable. The code is a bit weirdly sorted and also just needs a general cleanup, so expect that eventually too. And uses egyptian braces but formatting was easier to do at the end, so that's also something to do. It has been tested to work with IDA Pro, Clion and the standalone interface for now, but I plan on writing some instructions in the PR to follow for people who want to use this. Memory breakpoints aren't possible yet, only execution breakpoints. This code was aimed to be decoupled from the existing debugger to be able to be ported to the Wii U for an equal debugging experience. That's also why it uses the Cafe OS's thread sleep and resuming functions whenever possible instead of using recompiler/interpreter controls. * Add memory writing and floating point registers support * Reformat code a bit * Format code to adhere to Cemu's coding style * Rework GDB Stub settings in GUI * Small styling fixes * Rework execution breakpoints Should work better in some edge cases now. But this should also allow for adding access breakpoints since it's now more separated. * Implement access breakpoints * Fix some issues with breakpoints * Fix includes for Linux * Fix unnecessary include * Tweaks for Linux compatibility * Use std::thread instead of std::jthread to fix MacOS support * Enable GDB read/write breakpoints on x86 only * Fix compilation for GCC compilers at least The thread type varies on some platforms, so supporting this is hell... but let's get it to compile on MacOS first. * Disable them for MacOS due to lack of ptrace --------- Co-authored-by: Exzap <13877693+Exzap@users.noreply.github.com>
2023-02-19 15:41:49 +01:00
inline static bool s_enable_gdbstub = false;
2022-08-22 22:21:23 +02:00
inline static bool s_nsight_mode = false;
inline static bool s_force_intel_legacy = false;
inline static bool s_force_interpreter = false;
inline static std::optional<uint32> s_persistent_id{};
// service URLS
inline static std::string serviceURL_ACT;
inline static std::string serviceURL_ECS;
2022-08-22 22:21:23 +02:00
// todo - npts and other boss urls
static bool ExtractorTool(std::wstring_view wud_path, std::string_view output_path, std::wstring_view log_path);
};