From c09d1c3cffa8591db056347c05063a9cd2b6c84e Mon Sep 17 00:00:00 2001 From: Fire Cube Date: Tue, 3 Jun 2025 12:34:29 +0200 Subject: [PATCH] Add support for game folder and fail early if eboot.bin is missing or corrupt (#3027) --- src/emulator.cpp | 19 +++++++++++++++++-- src/emulator.h | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/emulator.cpp b/src/emulator.cpp index 4fcb0cfc2..bb50b8686 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include #include #include @@ -62,8 +63,13 @@ Emulator::~Emulator() { Config::saveMainWindow(config_dir / "config.toml"); } -void Emulator::Run(const std::filesystem::path& file, const std::vector args) { +void Emulator::Run(std::filesystem::path file, const std::vector args) { + if (std::filesystem::is_directory(file)) { + file /= "eboot.bin"; + } + const auto eboot_name = file.filename().string(); + auto game_folder = file.parent_path(); if (const auto game_folder_name = game_folder.filename().string(); game_folder_name.ends_with("-UPDATE") || game_folder_name.ends_with("-patch")) { @@ -114,6 +120,11 @@ void Emulator::Run(const std::filesystem::path& file, const std::vectorGetHostPath("/app0/" + eboot_name); - linker->LoadModule(eboot_path); + if (linker->LoadModule(eboot_path) == -1) { + LOG_CRITICAL(Loader, "Failed to load game's eboot.bin: {}", + std::filesystem::absolute(eboot_path).string()); + std::quick_exit(0); + } // check if we have system modules to load LoadSystemModules(game_info.game_serial); diff --git a/src/emulator.h b/src/emulator.h index 08c2807a1..257ccd694 100644 --- a/src/emulator.h +++ b/src/emulator.h @@ -25,7 +25,7 @@ public: Emulator(); ~Emulator(); - void Run(const std::filesystem::path& file, const std::vector args = {}); + void Run(std::filesystem::path file, const std::vector args = {}); void UpdatePlayTime(const std::string& serial); private: