mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-05 00:42:48 +00:00
make sce_module module loading take both paths into account
This commit is contained in:
parent
34dd690a7a
commit
8bac54799b
@ -715,7 +715,7 @@ static int HandleSeparateUpdateDents(int fd, char* buf, int nbytes, s64* basep)
|
||||
if (!existent_folder) {
|
||||
u32 handle = h->CreateHandle();
|
||||
auto* new_file = h->GetFile(handle);
|
||||
new_file->is_directory = true;
|
||||
new_file->type = Core::FileSys::FileType::Directory;
|
||||
new_file->m_guest_name = guest_name;
|
||||
new_file->m_host_name = update_dir_name;
|
||||
if (!std::filesystem::is_directory(new_file->m_host_name)) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <set>
|
||||
#include <fmt/core.h>
|
||||
|
||||
#include "common/config.h"
|
||||
@ -108,7 +109,6 @@ void Emulator::Run(const std::filesystem::path& file) {
|
||||
// Use the eboot from the separated updates folder if it's there
|
||||
std::filesystem::path game_patch_folder = file.parent_path();
|
||||
game_patch_folder += "-UPDATE";
|
||||
bool use_game_patch = std::filesystem::exists(game_patch_folder / "sce_sys");
|
||||
std::filesystem::path eboot_path = std::filesystem::exists(game_patch_folder / file.filename())
|
||||
? game_patch_folder / file.filename()
|
||||
: file;
|
||||
@ -229,20 +229,37 @@ void Emulator::Run(const std::filesystem::path& file) {
|
||||
LoadSystemModules(eboot_path, game_info.game_serial);
|
||||
|
||||
// Load all prx from game's sce_module folder
|
||||
std::filesystem::path sce_module_folder = file.parent_path() / "sce_module";
|
||||
if (std::filesystem::is_directory(sce_module_folder)) {
|
||||
for (const auto& entry : std::filesystem::directory_iterator(sce_module_folder)) {
|
||||
std::filesystem::path module_path = entry.path();
|
||||
std::filesystem::path update_module_path =
|
||||
eboot_path.parent_path() / "sce_module" / entry.path().filename();
|
||||
if (std::filesystem::exists(update_module_path) && use_game_patch) {
|
||||
module_path = update_module_path;
|
||||
std::vector<std::filesystem::path> modules_to_load;
|
||||
std::filesystem::path game_module_folder = file.parent_path() / "sce_module";
|
||||
if (std::filesystem::is_directory(game_module_folder)) {
|
||||
for (const auto& entry : std::filesystem::directory_iterator(game_module_folder)) {
|
||||
if (entry.is_regular_file()) {
|
||||
modules_to_load.push_back(entry.path());
|
||||
}
|
||||
LOG_INFO(Loader, "Loading {}", fmt::UTF(module_path.u8string()));
|
||||
linker->LoadModule(module_path);
|
||||
}
|
||||
}
|
||||
|
||||
// Load all prx from separate update's sce_module folder
|
||||
std::filesystem::path update_module_folder = game_patch_folder / "sce_module";
|
||||
if (std::filesystem::is_directory(update_module_folder)) {
|
||||
for (const auto& entry : std::filesystem::directory_iterator(update_module_folder)) {
|
||||
auto it = std::find_if(modules_to_load.begin(), modules_to_load.end(),
|
||||
[&entry](const std::filesystem::path& p) {
|
||||
return p.filename() == entry.path().filename();
|
||||
});
|
||||
if (it != modules_to_load.end()) {
|
||||
*it = entry.path();
|
||||
} else {
|
||||
modules_to_load.push_back(entry.path());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& module_path : modules_to_load) {
|
||||
LOG_INFO(Loader, "Loading {}", fmt::UTF(module_path.u8string()));
|
||||
linker->LoadModule(module_path);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DISCORD_RPC
|
||||
// Discord RPC
|
||||
if (Config::getEnableDiscordRPC()) {
|
||||
|
Loading…
Reference in New Issue
Block a user