diff --git a/src/xenia/kernel/objects/xthread.cc b/src/xenia/kernel/objects/xthread.cc index cd0e431a6..ab12f53db 100644 --- a/src/xenia/kernel/objects/xthread.cc +++ b/src/xenia/kernel/objects/xthread.cc @@ -171,8 +171,18 @@ X_STATUS XThread::Create() { uint8_t* p = memory()->TranslateVirtual(thread_state_address_); xe::store_and_swap(p + 0x000, tls_address_); xe::store_and_swap(p + 0x100, thread_state_address_); + + FILETIME t; + GetSystemTimeAsFileTime(&t); + xe::store_and_swap( + p + 0x130, ((uint64_t)t.dwHighDateTime << 32) | t.dwLowDateTime); + + xe::store_and_swap(p + 0x144, thread_state_address_ + 0x144); + xe::store_and_swap(p + 0x148, thread_state_address_ + 0x144); xe::store_and_swap(p + 0x14C, thread_id_); xe::store_and_swap(p + 0x150, 0); // ? + xe::store_and_swap(p + 0x154, thread_state_address_ + 0x154); + xe::store_and_swap(p + 0x158, thread_state_address_ + 0x154); xe::store_and_swap(p + 0x160, 0); // last error // Allocate processor thread state. @@ -242,6 +252,11 @@ X_STATUS XThread::PlatformCreate() { return last_error; } + if (creation_params_.creation_flags & 0x60) { + SetThreadPriority(thread_handle_, + creation_params_.creation_flags & 0x20 ? 1 : 0); + } + return X_STATUS_SUCCESS; }