Skip to content

Commit

Permalink
[Kernel] Restore assigning pointer to object_type_ptr.
Browse files Browse the repository at this point in the history
This should at least help with latest requirement for protect_zero in many titles.
+ Removed useless comment
  • Loading branch information
Gliniak committed Nov 13, 2023
1 parent 355e254 commit 50b4237
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/xenia/kernel/xobject.cc
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,16 @@ uint8_t* XObject::CreateNative(uint32_t size) {
SetNativePointer(mem + sizeof(X_OBJECT_HEADER), true);

auto header = memory()->TranslateVirtual<X_OBJECT_HEADER*>(mem);
// todo: should check whether
header->flags = OBJECT_HEADER_IS_TITLE_OBJECT;
header->pointer_count = 1;
header->handle_count = 0;
header->object_type_ptr = 0;

// Added to prevent having nullptr crashes on semaphore.
// This should probably work differently, but for now it is good enough (hopefully).
auto object_type = memory()->SystemHeapAlloc(sizeof(X_OBJECT_TYPE));
if (object_type) {
header->object_type_ptr = object_type;
}

return memory()->TranslateVirtual(guest_object_ptr_);
}
Expand Down

0 comments on commit 50b4237

Please sign in to comment.