[Kernel] Improved TUs Support

- Changed name of config option to apply_title_update to better reflect what that option does
- Mount TU package to UPDATE: partition
- Simplified UserModule::title_id()
- Splitted loading module into two parts to allow applying TUs and custom patches
This commit is contained in:
Gliniak
2022-04-30 14:38:42 +02:00
parent 0fd578cafd
commit c65f240c0b
8 changed files with 132 additions and 59 deletions

View File

@@ -751,13 +751,25 @@ X_STATUS Emulator::CompleteLaunch(const std::filesystem::path& path,
// Allow xam to request module loads.
auto xam = kernel_state()->GetKernelModule<kernel::xam::XamModule>("xam.xex");
XELOGI("Launching module {}", module_path);
XELOGI("Loading module {}", module_path);
auto module = kernel_state_->LoadUserModule(module_path);
if (!module) {
XELOGE("Failed to load user module {}", xe::path_to_utf8(path));
return X_STATUS_NOT_FOUND;
}
X_RESULT result = kernel_state_->ApplyTitleUpdate(module);
if (XFAILED(result)) {
XELOGE("Failed to apply title update! Cannot run module {}",
xe::path_to_utf8(path));
return result;
}
result = kernel_state_->FinishLoadingUserModule(module);
if (XFAILED(result)) {
XELOGE("Failed to initialize user module {}", xe::path_to_utf8(path));
return result;
}
// Grab the current title ID.
xex2_opt_execution_info* info = nullptr;
module->GetOptHeader(XEX_HEADER_EXECUTION_INFO, &info);