From a4edb7f9e1241781b376daba5cd1e8ab1b617068 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Fri, 29 May 2015 17:12:30 -0700 Subject: [PATCH] Removing 64bit return type and cleaning up some SHIM* stuff pre-refactor. --- src/xenia/kernel/util/shim_utils.h | 22 +++-------- src/xenia/kernel/xam_info.cc | 8 ++-- src/xenia/kernel/xam_input.cc | 4 +- src/xenia/kernel/xam_notify.cc | 8 ++-- src/xenia/kernel/xam_user.cc | 4 +- src/xenia/kernel/xboxkrnl_audio.cc | 2 +- src/xenia/kernel/xboxkrnl_debug.cc | 4 +- src/xenia/kernel/xboxkrnl_memory.cc | 8 ++-- src/xenia/kernel/xboxkrnl_rtl.cc | 16 ++++---- src/xenia/kernel/xboxkrnl_threading.cc | 52 +++++++++++++------------- src/xenia/kernel/xboxkrnl_video.cc | 22 +++++------ 11 files changed, 71 insertions(+), 79 deletions(-) diff --git a/src/xenia/kernel/util/shim_utils.h b/src/xenia/kernel/util/shim_utils.h index 2bf8ea205..7b532d998 100644 --- a/src/xenia/kernel/util/shim_utils.h +++ b/src/xenia/kernel/util/shim_utils.h @@ -18,7 +18,7 @@ namespace kernel { using PPCContext = xe::cpu::frontend::PPCContext; -#define SHIM_CALL void _cdecl +#define SHIM_CALL void _cdecl #define SHIM_SET_MAPPING(library_name, export_name, shim_data) \ export_resolver->SetFunctionMapping( \ library_name, ordinals::##export_name, shim_data, \ @@ -35,22 +35,12 @@ using PPCContext = xe::cpu::frontend::PPCContext; #define SHIM_SET_MEM_16(a, v) xe::store_and_swap(SHIM_MEM_ADDR(a), v) #define SHIM_SET_MEM_32(a, v) xe::store_and_swap(SHIM_MEM_ADDR(a), v) #define SHIM_SET_MEM_64(a, v) xe::store_and_swap(SHIM_MEM_ADDR(a), v) -#define SHIM_SET_MEM_F32(a, v) xe::store_and_swap(SHIM_MEM_ADDR(a), v) -#define SHIM_SET_MEM_F64(a, v) xe::store_and_swap(SHIM_MEM_ADDR(a), v) -#define SHIM_GPR_8(n) (uint8_t)(ppc_state->r[n]) -#define SHIM_GPR_16(n) (uint16_t)(ppc_state->r[n]) -#define SHIM_GPR_32(n) (uint32_t)(ppc_state->r[n]) -#define SHIM_SET_GPR_32(n, v) ppc_state->r[n] = (uint64_t)((v) & UINT32_MAX) -#define SHIM_GPR_64(n) ppc_state->r[n] -#define SHIM_SET_GPR_64(n, v) ppc_state->r[n] = (uint64_t)(v) - -#define SHIM_GET_ARG_8(n) SHIM_GPR_8(3 + n) -#define SHIM_GET_ARG_16(n) SHIM_GPR_16(3 + n) -#define SHIM_GET_ARG_32(n) SHIM_GPR_32(3 + n) -#define SHIM_GET_ARG_64(n) SHIM_GPR_64(3 + n) -#define SHIM_SET_RETURN_32(v) SHIM_SET_GPR_64(3, (uint64_t)(int32_t)v) -#define SHIM_SET_RETURN_64(v) SHIM_SET_GPR_64(3, v) +#define SHIM_GET_ARG_8(n) (uint8_t)(ppc_state->r[3 + n]) +#define SHIM_GET_ARG_16(n) (uint16_t)(ppc_state->r[3 + n]) +#define SHIM_GET_ARG_32(n) (uint32_t)(ppc_state->r[3 + n]) +#define SHIM_GET_ARG_64(n) ppc_state->r[3 + n] +#define SHIM_SET_RETURN_32(v) ppc_state->r[3] = (uint64_t)((int32_t)v) #define SHIM_STRUCT(type, address) \ reinterpret_cast(SHIM_MEM_ADDR(address)) diff --git a/src/xenia/kernel/xam_info.cc b/src/xenia/kernel/xam_info.cc index e28288b41..ab9fc47bf 100644 --- a/src/xenia/kernel/xam_info.cc +++ b/src/xenia/kernel/xam_info.cc @@ -26,7 +26,7 @@ SHIM_CALL XamGetSystemVersion_shim(PPCContext* ppc_state, KernelState* state) { // we pretend to be old we have less to worry with implementing. // 0x200A3200 // 0x20096B00 - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); } SHIM_CALL XGetAVPack_shim(PPCContext* ppc_state, KernelState* state) { @@ -35,13 +35,13 @@ SHIM_CALL XGetAVPack_shim(PPCContext* ppc_state, KernelState* state) { // Other likely values are 3/4/8 for HDMI or something. // Games seem to use this as a PAL check - if the result is not 3/4/6/8 // they explode with errors if not in PAL mode. - SHIM_SET_RETURN_64(6); + SHIM_SET_RETURN_32(6); } SHIM_CALL XGetGameRegion_shim(PPCContext* ppc_state, KernelState* state) { XELOGD("XGetGameRegion()"); - SHIM_SET_RETURN_64(0xFFFF); + SHIM_SET_RETURN_32(0xFFFF); } SHIM_CALL XGetLanguage_shim(PPCContext* ppc_state, KernelState* state) { @@ -59,7 +59,7 @@ SHIM_CALL XGetLanguage_shim(PPCContext* ppc_state, KernelState* state) { } // Add more overrides? - SHIM_SET_RETURN_64(desired_language); + SHIM_SET_RETURN_32(desired_language); } SHIM_CALL XamVoiceIsActiveProcess_shim(PPCContext* ppc_state, diff --git a/src/xenia/kernel/xam_input.cc b/src/xenia/kernel/xam_input.cc index 0d561b9ca..10c446f82 100644 --- a/src/xenia/kernel/xam_input.cc +++ b/src/xenia/kernel/xam_input.cc @@ -26,7 +26,7 @@ SHIM_CALL XamResetInactivity_shim(PPCContext* ppc_state, KernelState* state) { XELOGD("XamResetInactivity(%d)", unk); // Result ignored. - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); } SHIM_CALL XamEnableInactivityProcessing_shim(PPCContext* ppc_state, @@ -37,7 +37,7 @@ SHIM_CALL XamEnableInactivityProcessing_shim(PPCContext* ppc_state, XELOGD("XamEnableInactivityProcessing(%d, %d)", zero, unk); // Expects 0. - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); } // http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.reference.xinputgetcapabilities(v=vs.85).aspx diff --git a/src/xenia/kernel/xam_notify.cc b/src/xenia/kernel/xam_notify.cc index 442ea4884..d38b9e169 100644 --- a/src/xenia/kernel/xam_notify.cc +++ b/src/xenia/kernel/xam_notify.cc @@ -32,7 +32,7 @@ SHIM_CALL XamNotifyCreateListener_shim(PPCContext* ppc_state, // Handle ref is incremented, so return that. uint32_t handle = listener->handle(); - SHIM_SET_RETURN_64(handle); + SHIM_SET_RETURN_32(handle); } // http://ffplay360.googlecode.com/svn/Test/Common/AtgSignIn.cpp @@ -46,14 +46,14 @@ SHIM_CALL XNotifyGetNext_shim(PPCContext* ppc_state, KernelState* state) { param_ptr); if (!handle) { - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); return; } // Grab listener. auto listener = state->object_table()->LookupObject(handle); if (!listener) { - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); return; } @@ -74,7 +74,7 @@ SHIM_CALL XNotifyGetNext_shim(PPCContext* ppc_state, KernelState* state) { SHIM_SET_MEM_32(param_ptr, param); } - SHIM_SET_RETURN_64(dequeued ? 1 : 0); + SHIM_SET_RETURN_32(dequeued ? 1 : 0); } SHIM_CALL XNotifyDelayUI_shim(PPCContext* ppc_state, KernelState* state) { diff --git a/src/xenia/kernel/xam_user.cc b/src/xenia/kernel/xam_user.cc index dad71c4d6..276367dd5 100644 --- a/src/xenia/kernel/xam_user.cc +++ b/src/xenia/kernel/xam_user.cc @@ -48,9 +48,9 @@ SHIM_CALL XamUserGetSigninState_shim(PPCContext* ppc_state, if (user_index == 0 || (user_index & 0xFF) == 0xFF) { const auto& user_profile = state->user_profile(); auto signin_state = user_profile->signin_state(); - SHIM_SET_RETURN_64(signin_state); + SHIM_SET_RETURN_32(signin_state); } else { - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); } } diff --git a/src/xenia/kernel/xboxkrnl_audio.cc b/src/xenia/kernel/xboxkrnl_audio.cc index e489c048c..2bd8b96e8 100644 --- a/src/xenia/kernel/xboxkrnl_audio.cc +++ b/src/xenia/kernel/xboxkrnl_audio.cc @@ -56,7 +56,7 @@ SHIM_CALL XAudioGetVoiceCategoryVolume_shim(PPCContext* ppc_state, XELOGD("XAudioGetVoiceCategoryVolume(%.8X, %.8X)", unk, out_ptr); // Expects a floating point single. Volume %? - SHIM_SET_MEM_F32(out_ptr, 1.0f); + xe::store_and_swap(SHIM_MEM_ADDR(out_ptr), 1.0f); SHIM_SET_RETURN_32(X_ERROR_SUCCESS); } diff --git a/src/xenia/kernel/xboxkrnl_debug.cc b/src/xenia/kernel/xboxkrnl_debug.cc index e021e8efe..8ee398c3d 100644 --- a/src/xenia/kernel/xboxkrnl_debug.cc +++ b/src/xenia/kernel/xboxkrnl_debug.cc @@ -17,11 +17,13 @@ namespace xe { namespace kernel { +#define SHIM_GPR_32(n) (uint32_t)(ppc_state->r[n]) + // TODO: clean me up! SHIM_CALL DbgPrint_shim(PPCContext* ppc_state, KernelState* state) { uint32_t format_ptr = SHIM_GET_ARG_32(0); if (format_ptr == 0) { - SHIM_SET_RETURN_64(-1); + SHIM_SET_RETURN_32(-1); return; } diff --git a/src/xenia/kernel/xboxkrnl_memory.cc b/src/xenia/kernel/xboxkrnl_memory.cc index f6d5b5f26..2c909c1e8 100644 --- a/src/xenia/kernel/xboxkrnl_memory.cc +++ b/src/xenia/kernel/xboxkrnl_memory.cc @@ -321,7 +321,7 @@ SHIM_CALL MmAllocatePhysicalMemoryEx_shim(PPCContext* ppc_state, } XELOGD("MmAllocatePhysicalMemoryEx = %.8X", base_address); - SHIM_SET_RETURN_64(base_address); + SHIM_SET_RETURN_32(base_address); } SHIM_CALL MmFreePhysicalMemory_shim(PPCContext* ppc_state, KernelState* state) { @@ -440,7 +440,7 @@ SHIM_CALL MmGetPhysicalAddress_shim(PPCContext* ppc_state, KernelState* state) { physical_address += 0x1000; } - SHIM_SET_RETURN_64(physical_address); + SHIM_SET_RETURN_32(physical_address); } SHIM_CALL MmMapIoSpace_shim(PPCContext* ppc_state, KernelState* state) { @@ -458,7 +458,7 @@ SHIM_CALL MmMapIoSpace_shim(PPCContext* ppc_state, KernelState* state) { assert_true(size == 0x40); assert_true(flags == 0x404); - SHIM_SET_RETURN_64(src_address); + SHIM_SET_RETURN_32(src_address); } SHIM_CALL ExAllocatePoolTypeWithTag_shim(PPCContext* ppc_state, @@ -479,7 +479,7 @@ SHIM_CALL ExAllocatePoolTypeWithTag_shim(PPCContext* ppc_state, uint32_t addr = state->memory()->SystemHeapAlloc(adjusted_size, alignment); - SHIM_SET_RETURN_64(addr); + SHIM_SET_RETURN_32(addr); } SHIM_CALL ExFreePool_shim(PPCContext* ppc_state, KernelState* state) { diff --git a/src/xenia/kernel/xboxkrnl_rtl.cc b/src/xenia/kernel/xboxkrnl_rtl.cc index 2b86a563f..1da742c89 100644 --- a/src/xenia/kernel/xboxkrnl_rtl.cc +++ b/src/xenia/kernel/xboxkrnl_rtl.cc @@ -51,7 +51,7 @@ SHIM_CALL RtlCompareMemory_shim(PPCContext* ppc_state, KernelState* state) { } } - SHIM_SET_RETURN_64(c); + SHIM_SET_RETURN_32(c); } // http://msdn.microsoft.com/en-us/library/ff552123 @@ -69,7 +69,7 @@ SHIM_CALL RtlCompareMemoryUlong_shim(PPCContext* ppc_state, // _In_ ULONG Pattern if ((source_ptr % 4) || (length % 4)) { - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); return; } @@ -89,7 +89,7 @@ SHIM_CALL RtlCompareMemoryUlong_shim(PPCContext* ppc_state, } } - SHIM_SET_RETURN_64(c); + SHIM_SET_RETURN_32(c); } // http://msdn.microsoft.com/en-us/library/ff552263 @@ -406,12 +406,12 @@ SHIM_CALL RtlImageXexHeaderField_shim(PPCContext* ppc_state, for (size_t n = 0; n < xex_header->header_count; n++) { if (xex_header->headers[n].key == image_field) { uint32_t value = xex_header->headers[n].value; - SHIM_SET_RETURN_64(value); + SHIM_SET_RETURN_32(value); return; } } - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); } // Unfortunately the Windows RTL_CRITICAL_SECTION object is bigger than the one @@ -576,7 +576,7 @@ SHIM_CALL RtlTryEnterCriticalSection_shim(PPCContext* ppc_state, ++cs->recursion_count; result = 1; } - SHIM_SET_RETURN_64(result); + SHIM_SET_RETURN_32(result); } SHIM_CALL RtlLeaveCriticalSection_shim(PPCContext* ppc_state, @@ -646,13 +646,13 @@ SHIM_CALL RtlTimeFieldsToTime_shim(PPCContext* ppc_state, KernelState* state) { FILETIME ft; if (!SystemTimeToFileTime(&st, &ft)) { // set last error = ERROR_INVALID_PARAMETER - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); return; } uint64_t time = (uint64_t(ft.dwHighDateTime) << 32) | ft.dwLowDateTime; SHIM_SET_MEM_64(time_ptr, time); - SHIM_SET_RETURN_64(1); + SHIM_SET_RETURN_32(1); } } // namespace kernel diff --git a/src/xenia/kernel/xboxkrnl_threading.cc b/src/xenia/kernel/xboxkrnl_threading.cc index 3827927aa..69d39de2e 100644 --- a/src/xenia/kernel/xboxkrnl_threading.cc +++ b/src/xenia/kernel/xboxkrnl_threading.cc @@ -293,7 +293,7 @@ SHIM_CALL KeGetCurrentProcessType_shim(PPCContext* ppc_state, // DWORD - SHIM_SET_RETURN_64(state->process_type()); + SHIM_SET_RETURN_32(state->process_type()); } SHIM_CALL KeSetCurrentProcessType_shim(PPCContext* ppc_state, @@ -314,7 +314,7 @@ SHIM_CALL KeQueryPerformanceFrequency_shim(PPCContext* ppc_state, // "KeQueryPerformanceFrequency()"); uint64_t result = Clock::guest_tick_frequency(); - SHIM_SET_RETURN_64(result); + SHIM_SET_RETURN_32(result); } SHIM_CALL KeDelayExecutionThread_shim(PPCContext* ppc_state, @@ -338,7 +338,7 @@ SHIM_CALL NtYieldExecution_shim(PPCContext* ppc_state, KernelState* state) { // XELOGD("NtYieldExecution()"); XThread* thread = XThread::GetCurrentThread(); X_STATUS result = thread->Delay(0, 0, 0); - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); } SHIM_CALL KeQuerySystemTime_shim(PPCContext* ppc_state, KernelState* state) { @@ -375,7 +375,7 @@ SHIM_CALL KeTlsAlloc_shim(PPCContext* ppc_state, KernelState* state) { } #endif // WIN32 - SHIM_SET_RETURN_64(tls_index); + SHIM_SET_RETURN_32(tls_index); } // http://msdn.microsoft.com/en-us/library/ms686804 @@ -385,7 +385,7 @@ SHIM_CALL KeTlsFree_shim(PPCContext* ppc_state, KernelState* state) { XELOGD("KeTlsFree(%.8X)", tls_index); if (tls_index == X_TLS_OUT_OF_INDEXES) { - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); return; } @@ -397,7 +397,7 @@ SHIM_CALL KeTlsFree_shim(PPCContext* ppc_state, KernelState* state) { result = pthread_key_delete(tls_index) == 0; #endif // WIN32 - SHIM_SET_RETURN_64(result); + SHIM_SET_RETURN_32(result); } // http://msdn.microsoft.com/en-us/library/ms686812 @@ -422,7 +422,7 @@ SHIM_CALL KeTlsGetValue_shim(PPCContext* ppc_state, KernelState* state) { // TODO(benvanik): SetLastError } - SHIM_SET_RETURN_64(value); + SHIM_SET_RETURN_32(value); } // http://msdn.microsoft.com/en-us/library/ms686818 @@ -441,7 +441,7 @@ SHIM_CALL KeTlsSetValue_shim(PPCContext* ppc_state, KernelState* state) { result = pthread_setspecific(tls_index, (void*)tls_value) == 0; #endif // WIN32 - SHIM_SET_RETURN_64(result); + SHIM_SET_RETURN_32(result); } SHIM_CALL NtCreateEvent_shim(PPCContext* ppc_state, KernelState* state) { @@ -482,12 +482,12 @@ SHIM_CALL KeSetEvent_shim(PPCContext* ppc_state, KernelState* state) { auto ev = XObject::GetNativeObject(state, event_ptr); if (!ev) { - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); return; } auto result = ev->Set(increment, !!wait); - SHIM_SET_RETURN_64(result); + SHIM_SET_RETURN_32(result); } SHIM_CALL NtSetEvent_shim(PPCContext* ppc_state, KernelState* state) { @@ -526,7 +526,7 @@ SHIM_CALL KePulseEvent_shim(PPCContext* ppc_state, KernelState* state) { result = ev->Pulse(increment, !!wait); } - SHIM_SET_RETURN_64(result); + SHIM_SET_RETURN_32(result); } SHIM_CALL NtPulseEvent_shim(PPCContext* ppc_state, KernelState* state) { @@ -558,12 +558,12 @@ SHIM_CALL KeResetEvent_shim(PPCContext* ppc_state, KernelState* state) { void* event_ptr = SHIM_MEM_ADDR(event_ref); auto ev = XObject::GetNativeObject(state, event_ptr); if (!ev) { - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); return; } auto result = ev->Reset(); - SHIM_SET_RETURN_64(result); + SHIM_SET_RETURN_32(result); } SHIM_CALL NtClearEvent_shim(PPCContext* ppc_state, KernelState* state) { @@ -643,7 +643,7 @@ SHIM_CALL KeReleaseSemaphore_shim(PPCContext* ppc_state, KernelState* state) { void* semaphore_ptr = SHIM_MEM_ADDR(semaphore_ref); auto sem = XObject::GetNativeObject(state, semaphore_ptr); if (!sem) { - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); return; } @@ -651,7 +651,7 @@ SHIM_CALL KeReleaseSemaphore_shim(PPCContext* ppc_state, KernelState* state) { // TODO(benvanik): wait? int32_t result = sem->ReleaseSemaphore(adjustment); - SHIM_SET_RETURN_64(result); + SHIM_SET_RETURN_32(result); } SHIM_CALL NtReleaseSemaphore_shim(PPCContext* ppc_state, KernelState* state) { @@ -992,7 +992,7 @@ SHIM_CALL KfAcquireSpinLock_shim(PPCContext* ppc_state, KernelState* state) { XThread* thread = XThread::GetCurrentThread(); auto old_irql = thread->RaiseIrql(2); - SHIM_SET_RETURN_64(old_irql); + SHIM_SET_RETURN_32(old_irql); } SHIM_CALL KfReleaseSpinLock_shim(PPCContext* ppc_state, KernelState* state) { @@ -1133,7 +1133,7 @@ SHIM_CALL KeInsertQueueApc_shim(PPCContext* ppc_state, KernelState* state) { auto thread = XObject::GetNativeObject(state, SHIM_MEM_ADDR(thread_ptr)); if (!thread) { - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); return; } @@ -1143,7 +1143,7 @@ SHIM_CALL KeInsertQueueApc_shim(PPCContext* ppc_state, KernelState* state) { // Fail if already inserted. if (SHIM_MEM_32(apc_ptr + 40) & 0xFF00) { thread->UnlockApc(); - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); return; } @@ -1161,7 +1161,7 @@ SHIM_CALL KeInsertQueueApc_shim(PPCContext* ppc_state, KernelState* state) { // Unlock thread. thread->UnlockApc(); - SHIM_SET_RETURN_64(1); + SHIM_SET_RETURN_32(1); } SHIM_CALL KeRemoveQueueApc_shim(PPCContext* ppc_state, KernelState* state) { @@ -1175,7 +1175,7 @@ SHIM_CALL KeRemoveQueueApc_shim(PPCContext* ppc_state, KernelState* state) { auto thread = XObject::GetNativeObject(state, SHIM_MEM_ADDR(thread_ptr)); if (!thread) { - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); return; } @@ -1183,7 +1183,7 @@ SHIM_CALL KeRemoveQueueApc_shim(PPCContext* ppc_state, KernelState* state) { if (!(SHIM_MEM_32(apc_ptr + 40) & 0xFF00)) { thread->UnlockApc(); - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); return; } @@ -1196,7 +1196,7 @@ SHIM_CALL KeRemoveQueueApc_shim(PPCContext* ppc_state, KernelState* state) { thread->UnlockApc(); - SHIM_SET_RETURN_64(result ? 1 : 0); + SHIM_SET_RETURN_32(result ? 1 : 0); } SHIM_CALL KiApcNormalRoutineNop_shim(PPCContext* ppc_state, @@ -1206,7 +1206,7 @@ SHIM_CALL KiApcNormalRoutineNop_shim(PPCContext* ppc_state, XELOGD("KiApcNormalRoutineNop(%.8X, %.8X)", unk0, unk1); - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); } SHIM_CALL KeInitializeDpc_shim(PPCContext* ppc_state, KernelState* state) { @@ -1248,7 +1248,7 @@ SHIM_CALL KeInsertQueueDpc_shim(PPCContext* ppc_state, KernelState* state) { // If already in a queue, abort. if (dpc_list->IsQueued(list_entry_ptr)) { - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); dispatcher->Unlock(); return; } @@ -1261,7 +1261,7 @@ SHIM_CALL KeInsertQueueDpc_shim(PPCContext* ppc_state, KernelState* state) { dispatcher->Unlock(); - SHIM_SET_RETURN_64(1); + SHIM_SET_RETURN_32(1); } SHIM_CALL KeRemoveQueueDpc_shim(PPCContext* ppc_state, KernelState* state) { @@ -1284,7 +1284,7 @@ SHIM_CALL KeRemoveQueueDpc_shim(PPCContext* ppc_state, KernelState* state) { dispatcher->Unlock(); - SHIM_SET_RETURN_64(result ? 1 : 0); + SHIM_SET_RETURN_32(result ? 1 : 0); } xe::mutex global_list_mutex_; diff --git a/src/xenia/kernel/xboxkrnl_video.cc b/src/xenia/kernel/xboxkrnl_video.cc index c2c7e166e..333e8def1 100644 --- a/src/xenia/kernel/xboxkrnl_video.cc +++ b/src/xenia/kernel/xboxkrnl_video.cc @@ -44,7 +44,7 @@ SHIM_CALL VdGetCurrentDisplayGamma_shim(PPCContext* ppc_state, XELOGD("VdGetCurrentDisplayGamma(%.8X, %.8X)", arg0_ptr, arg1_ptr); SHIM_SET_MEM_32(arg0_ptr, 2); - SHIM_SET_MEM_F32(arg1_ptr, 2.22222233f); + xe::store_and_swap(SHIM_MEM_ADDR(arg1_ptr), 2.22222233f); } SHIM_CALL VdGetCurrentDisplayInformation_shim(PPCContext* ppc_state, @@ -128,7 +128,7 @@ SHIM_CALL VdSetDisplayMode_shim(PPCContext* ppc_state, KernelState* state) { // 40000000 XELOGD("VdSetDisplayMode(%.8X)", mode); - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); } SHIM_CALL VdSetDisplayModeOverride_shim(PPCContext* ppc_state, @@ -143,7 +143,7 @@ SHIM_CALL VdSetDisplayModeOverride_shim(PPCContext* ppc_state, XELOGD("VdSetDisplayModeOverride(%.8X, %.8X, %g, %.8X, %.8X)", unk0, unk1, refresh_rate, unk3, unk4); - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); } SHIM_CALL VdInitializeEngines_shim(PPCContext* ppc_state, KernelState* state) { @@ -177,7 +177,7 @@ SHIM_CALL VdGetGraphicsAsicID_shim(PPCContext* ppc_state, KernelState* state) { // Games compare for < 0x10 and do VdInitializeEDRAM, else other // (retrain/etc). - SHIM_SET_RETURN_64(0x11); + SHIM_SET_RETURN_32(0x11); } SHIM_CALL VdEnableDisableClockGating_shim(PPCContext* ppc_state, @@ -188,7 +188,7 @@ SHIM_CALL VdEnableDisableClockGating_shim(PPCContext* ppc_state, // Ignored, as it really doesn't matter. - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); } SHIM_CALL VdSetGraphicsInterruptCallback_shim(PPCContext* ppc_state, @@ -326,7 +326,7 @@ SHIM_CALL VdInitializeScalerCommandBuffer_shim(PPCContext* ppc_state, } // returns memcpy size >> 2 for memcpy(...,...,ret << 2) - SHIM_SET_RETURN_64(total_words >> 2); + SHIM_SET_RETURN_32(total_words >> 2); } // We use these to shuffle data to VdSwap. @@ -356,7 +356,7 @@ SHIM_CALL VdCallGraphicsNotificationRoutines_shim(PPCContext* ppc_state, last_frontbuffer_width_ = fb_width; last_frontbuffer_height_ = fb_height; - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); } SHIM_CALL VdIsHSIOTrainingSucceeded_shim(PPCContext* ppc_state, @@ -365,7 +365,7 @@ SHIM_CALL VdIsHSIOTrainingSucceeded_shim(PPCContext* ppc_state, // Not really sure what this should be - code does weird stuff here: // (cntlzw r11, r3 / extrwi r11, r11, 1, 26) - SHIM_SET_RETURN_64(1); + SHIM_SET_RETURN_32(1); } SHIM_CALL VdPersistDisplay_shim(PPCContext* ppc_state, KernelState* state) { @@ -385,7 +385,7 @@ SHIM_CALL VdPersistDisplay_shim(PPCContext* ppc_state, KernelState* state) { } // ? - SHIM_SET_RETURN_64(1); + SHIM_SET_RETURN_32(1); } SHIM_CALL VdRetrainEDRAMWorker_shim(PPCContext* ppc_state, KernelState* state) { @@ -393,7 +393,7 @@ SHIM_CALL VdRetrainEDRAMWorker_shim(PPCContext* ppc_state, KernelState* state) { XELOGD("VdRetrainEDRAMWorker(%.8X)", unk0); - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); } SHIM_CALL VdRetrainEDRAM_shim(PPCContext* ppc_state, KernelState* state) { @@ -407,7 +407,7 @@ SHIM_CALL VdRetrainEDRAM_shim(PPCContext* ppc_state, KernelState* state) { XELOGD("VdRetrainEDRAM(%.8X, %.8X, %.8X, %.8X, %.8X, %.8X)", unk0, unk1, unk2, unk3, unk4, unk5); - SHIM_SET_RETURN_64(0); + SHIM_SET_RETURN_32(0); } SHIM_CALL VdSwap_shim(PPCContext* ppc_state, KernelState* state) {