[Emulator] Improvements to launch_data

Added support for autoload titles on boot with:
- Specific launch data
- Specific xex
- Restarting into packages: XamContentLaunchImageFromFileInternal
This commit is contained in:
Gliniak
2024-02-10 22:38:21 +01:00
committed by Radosław Gliński
parent 7e7784347b
commit 6f287a9597
10 changed files with 275 additions and 116 deletions

View File

@@ -34,6 +34,7 @@
#include "xenia/gpu/d3d12/d3d12_command_processor.h"
#include "xenia/gpu/graphics_system.h"
#include "xenia/hid/input_system.h"
#include "xenia/kernel/xam/xam_module.h"
#include "xenia/ui/file_picker.h"
#include "xenia/ui/graphics_provider.h"
#include "xenia/ui/imgui_dialog.h"
@@ -1451,7 +1452,7 @@ void EmulatorWindow::ToggleGPUSetting(gpu_cvar value) {
switch (value) {
case gpu_cvar::ClearMemoryPageState:
CommonSaveGPUSetting(CommonGPUSetting::ClearMemoryPageState,
!cvars::clear_memory_page_state);
!cvars::clear_memory_page_state);
break;
case gpu_cvar::ReadbackResolve:
D3D12SaveGPUSetting(D3D12GPUSetting::ReadbackResolve,
@@ -1575,6 +1576,12 @@ xe::X_STATUS EmulatorWindow::RunTitle(std::filesystem::path path_to_file) {
"Failed to launch title.\n\nCheck xenia.log for technical details.");
} else {
AddRecentlyLaunchedTitle(path_to_file, emulator_->title_name());
auto xam =
emulator_->kernel_state()->GetKernelModule<kernel::xam::XamModule>(
"xam.xex");
xam->loader_data().host_path = xe::path_to_utf8(abs_path);
}
return result;

View File

@@ -27,6 +27,7 @@
#include "xenia/config.h"
#include "xenia/debug/ui/debug_window.h"
#include "xenia/emulator.h"
#include "xenia/kernel/xam/xam_module.h"
#include "xenia/ui/file_picker.h"
#include "xenia/ui/window.h"
#include "xenia/ui/window_listener.h"
@@ -624,6 +625,20 @@ void EmulatorApp::EmulatorThread() {
}
}
auto xam = emulator_->kernel_state()->GetKernelModule<kernel::xam::XamModule>(
"xam.xex");
if (xam) {
xam->LoadLoaderData();
if (xam->loader_data().launch_data_present) {
const std::filesystem::path host_path = xam->loader_data().host_path;
app_context().CallInUIThread([this, host_path]() {
return emulator_window_->RunTitle(host_path);
});
}
}
// Now, we're going to use this thread to drive events related to emulation.
while (!emulator_thread_quit_requested_.load(std::memory_order_relaxed)) {
xe::threading::Wait(emulator_thread_event_.get(), false);