diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 651c220b60..006c0264c3 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -34,6 +34,7 @@ #include "Loader/PSF.h" #include "Loader/TAR.h" +#include "Loader/ISO.h" #include "Loader/ELF.h" #include "Loader/disc.h" @@ -1078,6 +1079,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool is_disc_patch, sys_log.notice("Path: %s", m_path); std::string inherited_ps3_game_path; + bool launching_from_disc_archive = false; { Init(); @@ -1421,6 +1423,28 @@ game_boot_result Emulator::Load(const std::string& title_id, bool is_disc_patch, } const std::string resolved_path = GetCallbacks().resolve_path(m_path); + if (is_file_iso(m_path)) + { + load_iso(m_path); + + std::string path = iso_device::virtual_device_name + "/"; + + vfs::mount("/dev_bdvd/"sv, path); + + // ISOs that are install discs will error if set to EBOOT.BIN + // so this should cover both of them + if (fs::exists(path + "PS3_GAME/USRDIR/EBOOT.BIN")) + { + path = path + "PS3_GAME/USRDIR/EBOOT.BIN"; + } + + m_path = path; + + m_dir = "/dev_bdvd/PS3_GAME/"; + m_cat = "DG"sv; + + launching_from_disc_archive = true; + } const std::string elf_dir = fs::get_parent_dir(m_path); @@ -1595,8 +1619,14 @@ game_boot_result Emulator::Load(const std::string& title_id, bool is_disc_patch, } } + // ISO PKG INSTALL HACK! + if (!m_path.ends_with("EBOOT.BIN") && launching_from_disc_archive) + { + bdvd_dir = m_path; + } + // Special boot mode (directory scan) - if (fs::is_dir(m_path)) + if (fs::is_dir(m_path) && !launching_from_disc_archive) { m_state = system_state::ready; GetCallbacks().on_ready(); @@ -2076,6 +2106,13 @@ game_boot_result Emulator::Load(const std::string& title_id, bool is_disc_patch, } } + // ISO has no USRDIR/EBOOT.BIN, and we've examined its PKGDIR and extras. + // time to wrap up + if (!m_path.ends_with("EBOOT.BIN") && launching_from_disc_archive) + { + return game_boot_result::nothing_to_boot; + } + // Check firmware version if (const std::string_view game_fw_version = psf::get_string(_psf, "PS3_SYSTEM_VER", ""); !game_fw_version.empty()) { diff --git a/rpcs3/main_application.cpp b/rpcs3/main_application.cpp index ff3b70f952..aa4d035f27 100644 --- a/rpcs3/main_application.cpp +++ b/rpcs3/main_application.cpp @@ -345,7 +345,8 @@ EmuCallbacks main_application::CreateCallbacks() callbacks.resolve_path = [](std::string_view sv) { // May result in an empty string if path does not exist - return QFileInfo(QString::fromUtf8(sv.data(), static_cast(sv.size()))).canonicalFilePath().toStdString(); + std::string result = QFileInfo(QString::fromUtf8(sv.data(), static_cast(sv.size()))).canonicalFilePath().toStdString(); + return !result.empty() ? result : std::string(sv); }; callbacks.get_font_dirs = []()