This commit is contained in:
Adrian 2024-03-14 20:06:39 -03:00 committed by GitHub
commit 65ae0e3904
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View File

@ -508,7 +508,19 @@ X_RESULT KernelState::ApplyTitleUpdate(const object_ref<UserModule> module) {
content_manager()->OpenContent("UPDATE", title_update, disc_number);
// Use the corresponding patch for the launch module
std::filesystem::path patch_xexp = fmt::format("{0}.xexp", module->name());
std::filesystem::path patch_xexp;
std::string mount_path = "";
file_system()->FindSymbolicLink("game:", mount_path);
auto is_relative = std::filesystem::relative(module->path(), mount_path);
if (is_relative.empty()) {
return X_STATUS_UNSUCCESSFUL;
}
patch_xexp =
is_relative.replace_extension(is_relative.extension().string() + "p");
std::string resolved_path = "";
file_system()->FindSymbolicLink("UPDATE:", resolved_path);

View File

@ -105,6 +105,7 @@ dword_result_t XexLoadImage_entry(lpstring_t module_name, dword_t module_flags,
// Not found; attempt to load as a user module.
auto user_module = kernel_state()->LoadUserModule(module_name.value());
if (user_module) {
kernel_state()->ApplyTitleUpdate(user_module);
kernel_state()->FinishLoadingUserModule(user_module);
// Give up object ownership, this reference will be released by the last
// XexUnloadImage call