diff --git a/src/xenia/kernel/xobject.h b/src/xenia/kernel/xobject.h index c9ddfd54c..9017422e8 100644 --- a/src/xenia/kernel/xobject.h +++ b/src/xenia/kernel/xobject.h @@ -54,6 +54,7 @@ typedef struct { xe::be wait_list_flink; xe::be wait_list_blink; } X_DISPATCH_HEADER; +static_assert_size(X_DISPATCH_HEADER, 0x10); // http://www.nirsoft.net/kernel_struct/vista/OBJECT_HEADER.html struct X_OBJECT_HEADER { @@ -118,6 +119,11 @@ class XObject { const std::string& name() const { return name_; } uint32_t guest_object() const { return guest_object_ptr_; } + template + T* guest_object() { + return memory()->TranslateVirtual(guest_object_ptr_); + } + void RetainHandle(); bool ReleaseHandle(); void Retain(); @@ -157,8 +163,8 @@ class XObject { void SetNativePointer(uint32_t native_ptr, bool uninitialized = false); template - T* CreateNative(uint32_t size) { - return reinterpret_cast(CreateNative(size)); + T* CreateNative() { + return reinterpret_cast(CreateNative(sizeof(T))); } // Stash native pointer into X_DISPATCH_HEADER