[XAM] Simplified loader_data structure.
- Removed launch_data_present replaced with empty check
Fixed regression introduced in 269ee61845
This commit is contained in:
@@ -762,7 +762,7 @@ void EmulatorApp::EmulatorThread() {
|
||||
if (xam) {
|
||||
xam->LoadLoaderData();
|
||||
|
||||
if (xam->loader_data().launch_data_present) {
|
||||
if (!xam->loader_data().host_path.empty()) {
|
||||
const std::filesystem::path host_path = xam->loader_data().host_path;
|
||||
app_context().CallInUIThread([this, host_path]() {
|
||||
return emulator_window_->RunTitle(host_path);
|
||||
|
||||
@@ -247,7 +247,6 @@ DECLARE_XAM_EXPORT1(XamGetExecutionId, kNone, kImplemented);
|
||||
dword_result_t XamLoaderSetLaunchData_entry(lpvoid_t data, dword_t size) {
|
||||
auto xam = kernel_state()->GetKernelModule<XamModule>("xam.xex");
|
||||
auto& loader_data = xam->loader_data();
|
||||
loader_data.launch_data_present = size ? true : false;
|
||||
loader_data.launch_data.resize(size);
|
||||
std::memcpy(loader_data.launch_data.data(), data, size);
|
||||
return 0;
|
||||
@@ -275,7 +274,7 @@ dword_result_t XamLoaderGetLaunchData_entry(lpvoid_t buffer_ptr,
|
||||
dword_t buffer_size) {
|
||||
auto xam = kernel_state()->GetKernelModule<XamModule>("xam.xex");
|
||||
auto& loader_data = xam->loader_data();
|
||||
if (!buffer_size) {
|
||||
if (loader_data.launch_data.empty()) {
|
||||
return X_ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -298,7 +297,6 @@ void XamLoaderLaunchTitle_entry(lpstring_t raw_name_ptr, dword_t flags) {
|
||||
// Translate the launch path to a full path.
|
||||
if (raw_name_ptr && !raw_name_ptr.value().empty()) {
|
||||
loader_data.launch_path = xe::path_to_utf8(raw_name_ptr.value());
|
||||
loader_data.launch_data_present = true;
|
||||
xam->SaveLoaderData();
|
||||
title = "Title was restarted";
|
||||
message =
|
||||
|
||||
@@ -66,12 +66,10 @@ void XamModule::LoadLoaderData() {
|
||||
FILE* file = xe::filesystem::OpenFile(kXamModuleLoaderDataFileName, "rb");
|
||||
|
||||
if (!file) {
|
||||
loader_data_.launch_data_present = false;
|
||||
loader_data_.launch_data.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
loader_data_.launch_data_present = true;
|
||||
|
||||
auto string_read = [file]() {
|
||||
uint16_t string_size = 0;
|
||||
fread(&string_size, sizeof(string_size), 1, file);
|
||||
|
||||
@@ -31,7 +31,6 @@ class XamModule : public KernelModule {
|
||||
static void RegisterExportTable(xe::cpu::ExportResolver* export_resolver);
|
||||
|
||||
struct LoaderData {
|
||||
bool launch_data_present = false;
|
||||
std::string host_path; // Full host path to next title to load
|
||||
std::string
|
||||
launch_path; // Full guest path to next xex. might be default.xex
|
||||
|
||||
Reference in New Issue
Block a user