mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-01-31 00:55:19 +01:00
Misc (#3979)
* improved trophy key save on new keymanager * updated CLI11 and sdl3 * delete so stupid git will know * fixed? * fix2 * fixed sdl3 * Fix missing CLI11 submodule
This commit is contained in:
15
.gitmodules
vendored
15
.gitmodules
vendored
@@ -2,10 +2,6 @@
|
|||||||
path = externals/zlib-ng
|
path = externals/zlib-ng
|
||||||
url = https://github.com/shadps4-emu/ext-zlib-ng.git
|
url = https://github.com/shadps4-emu/ext-zlib-ng.git
|
||||||
shallow = true
|
shallow = true
|
||||||
[submodule "externals/sdl3"]
|
|
||||||
path = externals/sdl3
|
|
||||||
url = https://github.com/shadps4-emu/ext-SDL.git
|
|
||||||
shallow = true
|
|
||||||
[submodule "externals/fmt"]
|
[submodule "externals/fmt"]
|
||||||
path = externals/fmt
|
path = externals/fmt
|
||||||
url = https://github.com/shadps4-emu/ext-fmt.git
|
url = https://github.com/shadps4-emu/ext-fmt.git
|
||||||
@@ -123,7 +119,10 @@
|
|||||||
[submodule "externals/aacdec/fdk-aac"]
|
[submodule "externals/aacdec/fdk-aac"]
|
||||||
path = externals/aacdec/fdk-aac
|
path = externals/aacdec/fdk-aac
|
||||||
url = https://android.googlesource.com/platform/external/aac
|
url = https://android.googlesource.com/platform/external/aac
|
||||||
[submodule "externals/ext-CLI11"]
|
[submodule "externals/CLI11"]
|
||||||
path = externals/ext-CLI11
|
path = externals/CLI11
|
||||||
url = https://github.com/shadexternals/ext-CLI11.git
|
url = https://github.com/shadexternals/CLI11.git
|
||||||
branch = main
|
[submodule "externals/sdl3"]
|
||||||
|
path = externals/sdl3
|
||||||
|
url = https://github.com/shadexternals/sdl3.git
|
||||||
|
|
||||||
|
|||||||
1
externals/CLI11
vendored
Submodule
1
externals/CLI11
vendored
Submodule
Submodule externals/CLI11 added at bf5a16a26a
2
externals/CMakeLists.txt
vendored
2
externals/CMakeLists.txt
vendored
@@ -274,4 +274,4 @@ add_subdirectory(miniz)
|
|||||||
set(CLI11_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
set(CLI11_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||||
set(CLI11_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
set(CLI11_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||||
|
|
||||||
add_subdirectory(ext-CLI11)
|
add_subdirectory(CLI11)
|
||||||
1
externals/ext-CLI11
vendored
1
externals/ext-CLI11
vendored
Submodule externals/ext-CLI11 deleted from 1cce148334
138
src/main.cpp
138
src/main.cpp
@@ -39,11 +39,16 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
// ---- Trophy key migration ----
|
// ---- Trophy key migration ----
|
||||||
auto key_manager = KeyManager::GetInstance();
|
auto key_manager = KeyManager::GetInstance();
|
||||||
|
key_manager->LoadFromFile();
|
||||||
if (key_manager->GetAllKeys().TrophyKeySet.ReleaseTrophyKey.empty() &&
|
if (key_manager->GetAllKeys().TrophyKeySet.ReleaseTrophyKey.empty() &&
|
||||||
!Config::getTrophyKey().empty()) {
|
!Config::getTrophyKey().empty()) {
|
||||||
key_manager->SetAllKeys({.TrophyKeySet = {.ReleaseTrophyKey = KeyManager::HexStringToBytes(
|
auto keys = key_manager->GetAllKeys();
|
||||||
Config::getTrophyKey())}});
|
if (keys.TrophyKeySet.ReleaseTrophyKey.empty() && !Config::getTrophyKey().empty()) {
|
||||||
key_manager->SaveToFile();
|
keys.TrophyKeySet.ReleaseTrophyKey =
|
||||||
|
KeyManager::HexStringToBytes(Config::getTrophyKey());
|
||||||
|
key_manager->SetAllKeys(keys);
|
||||||
|
key_manager->SaveToFile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CLI::App app{"shadPS4 Emulator CLI"};
|
CLI::App app{"shadPS4 Emulator CLI"};
|
||||||
@@ -66,128 +71,11 @@ int main(int argc, char* argv[]) {
|
|||||||
std::optional<std::filesystem::path> setAddonFolder;
|
std::optional<std::filesystem::path> setAddonFolder;
|
||||||
std::optional<std::string> patchFile;
|
std::optional<std::string> patchFile;
|
||||||
|
|
||||||
// ---- Options ----
|
// const char* const ebootPath = "M:/PS4/dumpedgames/CUSA00207/eboot.bin"; // bloodborne
|
||||||
app.add_option("-g,--game", gamePath, "Game path or ID");
|
// const char* const eboot_path = "D:/ps4/shadps4games/CUSA07010/eboot.bin";//sonic mania
|
||||||
app.add_option("-p,--patch", patchFile, "Patch file to apply");
|
// const char* const eboot_path = "C:/ps4tests/CUSA03318/eboot.bin";//carmageddon
|
||||||
app.add_flag("-i,--ignore-game-patch", ignoreGamePatch,
|
const char* const ebootPath = "C:/ps4tests/CUSA04518/eboot.bin"; // project diva x
|
||||||
"Disable automatic loading of game patches");
|
// const char* const ebootPath = "D:/ps4sdk/rain.elf";
|
||||||
|
|
||||||
// FULLSCREEN: behavior-identical
|
|
||||||
app.add_option("-f,--fullscreen", fullscreenStr, "Fullscreen mode (true|false)");
|
|
||||||
|
|
||||||
app.add_option("--override-root", overrideRoot)->check(CLI::ExistingDirectory);
|
|
||||||
|
|
||||||
app.add_flag("--wait-for-debugger", waitForDebugger);
|
|
||||||
app.add_option("--wait-for-pid", waitPid);
|
|
||||||
|
|
||||||
app.add_flag("--show-fps", showFps);
|
|
||||||
app.add_flag("--config-clean", configClean);
|
|
||||||
app.add_flag("--config-global", configGlobal);
|
|
||||||
app.add_flag("--log-append", logAppend);
|
|
||||||
|
|
||||||
app.add_option("--add-game-folder", addGameFolder)->check(CLI::ExistingDirectory);
|
|
||||||
app.add_option("--set-addon-folder", setAddonFolder)->check(CLI::ExistingDirectory);
|
|
||||||
|
|
||||||
// ---- Capture args after `--` verbatim ----
|
|
||||||
app.allow_extras();
|
|
||||||
app.parse_complete_callback([&]() {
|
|
||||||
const auto& extras = app.remaining();
|
|
||||||
if (!extras.empty()) {
|
|
||||||
gameArgs = extras;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// ---- No-args behavior ----
|
|
||||||
if (argc == 1) {
|
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "shadPS4",
|
|
||||||
"This is a CLI application. Please use the QTLauncher for a GUI:\n"
|
|
||||||
"https://github.com/shadps4-emu/shadps4-qtlauncher/releases",
|
|
||||||
nullptr);
|
|
||||||
std::cout << app.help();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
app.parse(argc, argv);
|
|
||||||
} catch (const CLI::ParseError& e) {
|
|
||||||
return app.exit(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---- Utility commands ----
|
|
||||||
if (addGameFolder) {
|
|
||||||
Config::addGameInstallDir(*addGameFolder);
|
|
||||||
Config::save(user_dir / "config.toml");
|
|
||||||
std::cout << "Game folder successfully saved.\n";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (setAddonFolder) {
|
|
||||||
Config::setAddonInstallDir(*setAddonFolder);
|
|
||||||
Config::save(user_dir / "config.toml");
|
|
||||||
std::cout << "Addon folder successfully saved.\n";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gamePath.has_value()) {
|
|
||||||
if (!gameArgs.empty()) {
|
|
||||||
gamePath = gameArgs.front();
|
|
||||||
gameArgs.erase(gameArgs.begin());
|
|
||||||
} else {
|
|
||||||
std::cerr << "Error: Please provide a game path or ID.\n";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---- Apply flags ----
|
|
||||||
if (patchFile)
|
|
||||||
MemoryPatcher::patch_file = *patchFile;
|
|
||||||
|
|
||||||
if (ignoreGamePatch)
|
|
||||||
Core::FileSys::MntPoints::ignore_game_patches = true;
|
|
||||||
|
|
||||||
if (fullscreenStr) {
|
|
||||||
if (*fullscreenStr == "true") {
|
|
||||||
Config::setIsFullscreen(true);
|
|
||||||
} else if (*fullscreenStr == "false") {
|
|
||||||
Config::setIsFullscreen(false);
|
|
||||||
} else {
|
|
||||||
std::cerr << "Error: Invalid argument for --fullscreen (use true|false)\n";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showFps)
|
|
||||||
Config::setShowFpsCounter(true);
|
|
||||||
|
|
||||||
if (configClean)
|
|
||||||
Config::setConfigMode(Config::ConfigMode::Clean);
|
|
||||||
|
|
||||||
if (configGlobal)
|
|
||||||
Config::setConfigMode(Config::ConfigMode::Global);
|
|
||||||
|
|
||||||
if (logAppend)
|
|
||||||
Common::Log::SetAppend();
|
|
||||||
|
|
||||||
// ---- Resolve game path or ID ----
|
|
||||||
std::filesystem::path ebootPath(*gamePath);
|
|
||||||
if (!std::filesystem::exists(ebootPath)) {
|
|
||||||
bool found = false;
|
|
||||||
constexpr int maxDepth = 5;
|
|
||||||
for (const auto& installDir : Config::getGameInstallDirs()) {
|
|
||||||
if (auto foundPath = Common::FS::FindGameByID(installDir, *gamePath, maxDepth)) {
|
|
||||||
ebootPath = *foundPath;
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
std::cerr << "Error: Game ID or file path not found: " << *gamePath << "\n";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (waitPid)
|
|
||||||
Core::Debugger::WaitForPid(*waitPid);
|
|
||||||
|
|
||||||
auto* emulator = Common::Singleton<Core::Emulator>::Instance();
|
auto* emulator = Common::Singleton<Core::Emulator>::Instance();
|
||||||
emulator->executableName = argv[0];
|
emulator->executableName = argv[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user