This commit is contained in:
Fire Cube 2025-06-04 22:21:55 +02:00
parent 0242a60dc9
commit c975b7ac16
4 changed files with 24 additions and 20 deletions

View File

@ -139,7 +139,7 @@ std::filesystem::path MntPoints::GetHostPath(std::string_view path, bool* is_rea
return std::optional<std::filesystem::path>(current_path);
};
if (!force_base_path) {
if (!force_base_path && !ignore_game_patches) {
if (const auto path = search(patch_path)) {
return *path;
}

View File

@ -4,6 +4,7 @@
#include <filesystem>
#include <set>
#include <fmt/core.h>
#include <string_view>
#include "common/config.h"
#include "common/debug.h"
@ -63,7 +64,8 @@ Emulator::~Emulator() {
Config::saveMainWindow(config_dir / "config.toml");
}
void Emulator::Run(std::filesystem::path file, const std::vector<std::string> args, bool ignore_game_patch) {
void Emulator::Run(std::filesystem::path file, const std::vector<std::string> args,
bool ignore_game_patch) {
if (std::filesystem::is_directory(file)) {
file /= "eboot.bin";
}
@ -75,7 +77,7 @@ void Emulator::Run(std::filesystem::path file, const std::vector<std::string> ar
game_folder_name.ends_with("-UPDATE") || game_folder_name.ends_with("-patch")) {
// If an executable was launched from a separate update directory,
// use the base game directory as the game folder.
const auto base_name = game_folder_name.substr(0, game_folder_name.size() - 7);
const std::string base_name = game_folder_name.substr(0, game_folder_name.rfind('-'));
const auto base_path = game_folder.parent_path() / base_name;
if (std::filesystem::is_directory(base_path)) {
game_folder = base_path;
@ -84,7 +86,7 @@ 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.
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
mnt->ignore_game_patches = ignore_game_patch;
Core::FileSys::MntPoints::ignore_game_patches = ignore_game_patch;
mnt->Mount(game_folder, "/app0", true);
// Certain games may use /hostapp as well such as CUSA001100

View File

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

View File

@ -42,21 +42,22 @@ int main(int argc, char* argv[]) {
std::unordered_map<std::string, std::function<void(int&)>> arg_map = {
{"-h",
[&](int&) {
std::cout << "Usage: shadps4 [options]\n"
"Options:\n"
" No arguments: Opens the GUI.\n"
" -g, --game <path|ID> Specify <eboot.bin or elf path> or "
"<game ID (CUSAXXXXX)> to launch\n"
" -- ... Parameters passed to the game ELF. "
"Needs to be at the end of the line, and everything after \"--\" is a "
"game argument.\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"
" -f, --fullscreen <true|false> Specify window initial fullscreen "
"state. Does not overwrite the config file.\n"
" --add-game-folder <folder> Adds a new game folder to the config.\n"
" -h, --help Display this help message\n";
std::cout
<< "Usage: shadps4 [options]\n"
"Options:\n"
" No arguments: Opens the GUI.\n"
" -g, --game <path|ID> Specify <eboot.bin or elf path> or "
"<game ID (CUSAXXXXX)> to launch\n"
" -- ... Parameters passed to the game ELF. "
"Needs to be at the end of the line, and everything after \"--\" is a "
"game argument.\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"
" -f, --fullscreen <true|false> Specify window initial fullscreen "
"state. Does not overwrite the config file.\n"
" --add-game-folder <folder> Adds a new game folder to the config.\n"
" -h, --help Display this help message\n";
exit(0);
}},
{"--help", [&](int& i) { arg_map["-h"](i); }}, // Redirect --help to -h