kernel: separate host objects from regular handle range

Burnout Paradise statically expects certain thread handle values based on how many objects it knows it is allocating ahead of time.
From this, it calculates an ID by subtracting the thread handle from a base handle of what it expects the first such thread to be assigned.
The value is statically declared in the executable and is not determined automatically.

The host objects in the handle range made these thread handles higher than what the game expects.
Removing these, and allowing 0xF8000000 to be assigned, allows the thread handles to fit perfectly in the range the game expects.

It is not clear what handle range the host objects should be taking. For now though, they're 0-based rather than 0xF8000000-based.
This commit is contained in:
Bo Anderson
2022-12-06 15:10:09 +00:00
committed by JeBobs
parent da2710f18c
commit 9489161d0b
8 changed files with 116 additions and 51 deletions

View File

@@ -21,7 +21,7 @@ namespace kernel {
KernelModule::KernelModule(KernelState* kernel_state,
const std::string_view path)
: XModule(kernel_state, ModuleType::kKernelModule) {
: XModule(kernel_state, ModuleType::kKernelModule, true) {
emulator_ = kernel_state->emulator();
memory_ = emulator_->memory();
export_resolver_ = kernel_state->emulator()->export_resolver();
@@ -29,9 +29,6 @@ KernelModule::KernelModule(KernelState* kernel_state,
path_ = path;
name_ = utf8::find_base_name_from_guest_path(path);
// Persist this object through reloads.
host_object_ = true;
// HACK: Allocates memory where xboxkrnl.exe would be!
// TODO: Need to free this memory when necessary.
auto heap = memory()->LookupHeap(0x80040000);