Better handling of title workspace

This commit is contained in:
Gliniak
2022-02-28 14:20:13 +01:00
parent 4bfd3a6506
commit b759cb23a5
3 changed files with 17 additions and 0 deletions

View File

@@ -783,8 +783,16 @@ X_STATUS Emulator::CompleteLaunch(const std::filesystem::path& path,
}
// Grab the current title ID.
xex2_opt_execution_info* info = nullptr;
uint32_t workspace_address = 0;
module->GetOptHeader(XEX_HEADER_EXECUTION_INFO, &info);
kernel_state_->memory()
->LookupHeapByType(false, 0x1000)
->Alloc(module->workspace_size(), 0x1000,
kMemoryAllocationReserve | kMemoryAllocationCommit,
kMemoryProtectRead | kMemoryProtectWrite, false,
&workspace_address);
if (!info) {
title_id_ = 0;
} else {