This commit is contained in:
Fire Cube 2025-06-04 19:34:46 +02:00
parent 23710f397e
commit 0242a60dc9
6 changed files with 18 additions and 5 deletions

View File

@ -10,6 +10,8 @@
namespace Core::FileSys { namespace Core::FileSys {
bool MntPoints::ignore_game_patches = false;
std::string RemoveTrailingSlashes(const std::string& path) { std::string RemoveTrailingSlashes(const std::string& path) {
// Remove trailing slashes to make comparisons simpler. // Remove trailing slashes to make comparisons simpler.
std::string path_sanitized = path; 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; patch_path /= rel_path;
if ((corrected_path.starts_with("/app0") || corrected_path.starts_with("/hostapp")) && 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; return patch_path;
} }

View File

@ -21,6 +21,7 @@ class MntPoints {
static constexpr bool NeedsCaseInsensitiveSearch = true; static constexpr bool NeedsCaseInsensitiveSearch = true;
#endif #endif
public: public:
static bool ignore_game_patches;
struct MntPair { struct MntPair {
std::filesystem::path host_path; std::filesystem::path host_path;
std::string mount; // e.g /app0 std::string mount; // e.g /app0

View File

@ -63,7 +63,7 @@ Emulator::~Emulator() {
Config::saveMainWindow(config_dir / "config.toml"); Config::saveMainWindow(config_dir / "config.toml");
} }
void Emulator::Run(std::filesystem::path file, const std::vector<std::string> args) { void Emulator::Run(std::filesystem::path file, const std::vector<std::string> args, bool ignore_game_patch) {
if (std::filesystem::is_directory(file)) { if (std::filesystem::is_directory(file)) {
file /= "eboot.bin"; file /= "eboot.bin";
} }
@ -84,6 +84,8 @@ void Emulator::Run(std::filesystem::path file, const std::vector<std::string> ar
// Applications expect to be run from /app0 so mount the file's parent path as app0. // Applications expect to be run from /app0 so mount the file's parent path as app0.
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance(); auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
mnt->ignore_game_patches = ignore_game_patch;
mnt->Mount(game_folder, "/app0", true); mnt->Mount(game_folder, "/app0", true);
// Certain games may use /hostapp as well such as CUSA001100 // Certain games may use /hostapp as well such as CUSA001100
mnt->Mount(game_folder, "/hostapp", true); mnt->Mount(game_folder, "/hostapp", true);

View File

@ -25,7 +25,7 @@ public:
Emulator(); Emulator();
~Emulator(); ~Emulator();
void Run(std::filesystem::path file, const std::vector<std::string> args = {}); void Run(std::filesystem::path file, const std::vector<std::string> args = {}, bool use_game_patch=false);
void UpdatePlayTime(const std::string& serial); void UpdatePlayTime(const std::string& serial);
private: private:

View File

@ -28,6 +28,7 @@ int main(int argc, char* argv[]) {
Config::load(user_dir / "config.toml"); Config::load(user_dir / "config.toml");
bool has_game_argument = false; bool has_game_argument = false;
bool ignore_game_patch = false;
std::string game_path; std::string game_path;
std::vector<std::string> game_args{}; std::vector<std::string> 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 " "Needs to be at the end of the line, and everything after \"--\" is a "
"game argument.\n" "game argument.\n"
" -p, --patch <patch_file> Apply specified patch file\n" " -p, --patch <patch_file> Apply specified patch file\n"
" -i, --ignore-game-patch Disable automatic loading of game patch\n"
" -f, --fullscreen <true|false> Specify window initial fullscreen " " -f, --fullscreen <true|false> Specify window initial fullscreen "
"state. Does not overwrite the config file.\n" "state. Does not overwrite the config file.\n"
" --add-game-folder <folder> Adds a new game folder to the config.\n" " --add-game-folder <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); }}, {"--patch", [&](int& i) { arg_map["-p"](i); }},
{"-i", [&](int&) { ignore_game_patch = true; }},
{"--ignore-game-patch", [&](int& i) { arg_map["-i"](i); }},
{"-f", {"-f",
[&](int& i) { [&](int& i) {
if (++i >= argc) { if (++i >= argc) {
@ -185,7 +189,7 @@ int main(int argc, char* argv[]) {
// Run the emulator with the resolved eboot path // Run the emulator with the resolved eboot path
Core::Emulator emulator; Core::Emulator emulator;
emulator.Run(eboot_path, game_args); emulator.Run(eboot_path, game_args, ignore_game_patch);
return 0; return 0;
} }

View File

@ -34,6 +34,7 @@ int main(int argc, char* argv[]) {
bool has_command_line_argument = argc > 1; bool has_command_line_argument = argc > 1;
bool show_gui = false, has_game_argument = false; bool show_gui = false, has_game_argument = false;
bool ignore_game_patch = false;
std::string game_path; std::string game_path;
std::vector<std::string> game_args{}; std::vector<std::string> 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 " "Needs to be at the end of the line, and everything after \"--\" is a "
"game argument.\n" "game argument.\n"
" -p, --patch <patch_file> Apply specified patch file\n" " -p, --patch <patch_file> Apply specified patch file\n"
" -i, --ignore-game-patch Disable automatic loading of game patch\n"
" -s, --show-gui Show the GUI\n" " -s, --show-gui Show the GUI\n"
" -f, --fullscreen <true|false> Specify window initial fullscreen " " -f, --fullscreen <true|false> Specify window initial fullscreen "
"state. Does not overwrite the config file.\n" "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); }}, {"--patch", [&](int& i) { arg_map["-p"](i); }},
{"-i", [&](int&) { ignore_game_patch = true; }},
{"--ignore-game-patch", [&](int& i) { arg_map["-i"](i); }},
{"-f", {"-f",
[&](int& i) { [&](int& i) {
if (++i >= argc) { if (++i >= argc) {
@ -201,7 +205,7 @@ int main(int argc, char* argv[]) {
// Run the emulator with the resolved game path // Run the emulator with the resolved game path
Core::Emulator emulator; 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) { if (!show_gui) {
return 0; // Exit after running the emulator without showing the GUI return 0; // Exit after running the emulator without showing the GUI
} }