diff --git a/src/core/file_sys/fs.cpp b/src/core/file_sys/fs.cpp index 4dad44874..c24304430 100644 --- a/src/core/file_sys/fs.cpp +++ b/src/core/file_sys/fs.cpp @@ -10,6 +10,8 @@ namespace Core::FileSys { +bool MntPoints::ignore_game_patches = false; + std::string RemoveTrailingSlashes(const std::string& path) { // Remove trailing slashes to make comparisons simpler. std::string path_sanitized = path; @@ -77,7 +79,7 @@ std::filesystem::path MntPoints::GetHostPath(std::string_view path, bool* is_rea patch_path /= rel_path; if ((corrected_path.starts_with("/app0") || corrected_path.starts_with("/hostapp")) && - !force_base_path && std::filesystem::exists(patch_path)) { + !force_base_path && !ignore_game_patches && std::filesystem::exists(patch_path)) { return patch_path; } diff --git a/src/core/file_sys/fs.h b/src/core/file_sys/fs.h index 6638b48e8..4a2aa56c1 100644 --- a/src/core/file_sys/fs.h +++ b/src/core/file_sys/fs.h @@ -21,6 +21,7 @@ class MntPoints { static constexpr bool NeedsCaseInsensitiveSearch = true; #endif public: + static bool ignore_game_patches; struct MntPair { std::filesystem::path host_path; std::string mount; // e.g /app0 diff --git a/src/emulator.cpp b/src/emulator.cpp index bb50b8686..9e97155d5 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -63,7 +63,7 @@ Emulator::~Emulator() { Config::saveMainWindow(config_dir / "config.toml"); } -void Emulator::Run(std::filesystem::path file, const std::vector args) { +void Emulator::Run(std::filesystem::path file, const std::vector args, bool ignore_game_patch) { if (std::filesystem::is_directory(file)) { file /= "eboot.bin"; } @@ -84,6 +84,8 @@ void Emulator::Run(std::filesystem::path file, const std::vector ar // Applications expect to be run from /app0 so mount the file's parent path as app0. auto* mnt = Common::Singleton::Instance(); + mnt->ignore_game_patches = ignore_game_patch; + mnt->Mount(game_folder, "/app0", true); // Certain games may use /hostapp as well such as CUSA001100 mnt->Mount(game_folder, "/hostapp", true); diff --git a/src/emulator.h b/src/emulator.h index 257ccd694..e904d9f1d 100644 --- a/src/emulator.h +++ b/src/emulator.h @@ -25,7 +25,7 @@ public: Emulator(); ~Emulator(); - void Run(std::filesystem::path file, const std::vector args = {}); + void Run(std::filesystem::path file, const std::vector args = {}, bool use_game_patch=false); void UpdatePlayTime(const std::string& serial); private: diff --git a/src/main.cpp b/src/main.cpp index 85581774b..7fb0c23b6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,6 +28,7 @@ int main(int argc, char* argv[]) { Config::load(user_dir / "config.toml"); bool has_game_argument = false; + bool ignore_game_patch = false; std::string game_path; std::vector game_args{}; @@ -42,6 +43,7 @@ int main(int argc, char* argv[]) { "Needs to be at the end of the line, and everything after \"--\" is a " "game argument.\n" " -p, --patch Apply specified patch file\n" + " -i, --ignore-game-patch Disable automatic loading of game patch\n" " -f, --fullscreen Specify window initial fullscreen " "state. Does not overwrite the config file.\n" " --add-game-folder Adds a new game folder to the config.\n" @@ -72,6 +74,8 @@ int main(int argc, char* argv[]) { } }}, {"--patch", [&](int& i) { arg_map["-p"](i); }}, + {"-i", [&](int&) { ignore_game_patch = true; }}, + {"--ignore-game-patch", [&](int& i) { arg_map["-i"](i); }}, {"-f", [&](int& i) { if (++i >= argc) { @@ -185,7 +189,7 @@ int main(int argc, char* argv[]) { // Run the emulator with the resolved eboot path Core::Emulator emulator; - emulator.Run(eboot_path, game_args); + emulator.Run(eboot_path, game_args, ignore_game_patch); return 0; } diff --git a/src/qt_gui/main.cpp b/src/qt_gui/main.cpp index bd9dca6ce..b634981a0 100644 --- a/src/qt_gui/main.cpp +++ b/src/qt_gui/main.cpp @@ -34,6 +34,7 @@ int main(int argc, char* argv[]) { bool has_command_line_argument = argc > 1; bool show_gui = false, has_game_argument = false; + bool ignore_game_patch = false; std::string game_path; std::vector game_args{}; @@ -50,6 +51,7 @@ int main(int argc, char* argv[]) { "Needs to be at the end of the line, and everything after \"--\" is a " "game argument.\n" " -p, --patch Apply specified patch file\n" + " -i, --ignore-game-patch Disable automatic loading of game patch\n" " -s, --show-gui Show the GUI\n" " -f, --fullscreen Specify window initial fullscreen " "state. Does not overwrite the config file.\n" @@ -84,6 +86,8 @@ int main(int argc, char* argv[]) { } }}, {"--patch", [&](int& i) { arg_map["-p"](i); }}, + {"-i", [&](int&) { ignore_game_patch = true; }}, + {"--ignore-game-patch", [&](int& i) { arg_map["-i"](i); }}, {"-f", [&](int& i) { if (++i >= argc) { @@ -201,7 +205,7 @@ int main(int argc, char* argv[]) { // Run the emulator with the resolved game path Core::Emulator emulator; - emulator.Run(game_file_path.string(), game_args); + emulator.Run(game_file_path.string(), game_args, ignore_game_patch); if (!show_gui) { return 0; // Exit after running the emulator without showing the GUI }