diff --git a/src/xenia/kernel/util/shim_utils.h b/src/xenia/kernel/util/shim_utils.h index 8e06cdff3..e5eb082fe 100644 --- a/src/xenia/kernel/util/shim_utils.h +++ b/src/xenia/kernel/util/shim_utils.h @@ -56,7 +56,8 @@ using PPCContext = alloy::frontend::ppc::PPCContext; #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(v) SHIM_SET_GPR_64(3, v) +#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 IMPL_MEM_ADDR(a) (a ? state->memory()->Translate(a) : NULL) diff --git a/src/xenia/kernel/xam_content.cc b/src/xenia/kernel/xam_content.cc index 20670251f..9b711f016 100644 --- a/src/xenia/kernel/xam_content.cc +++ b/src/xenia/kernel/xam_content.cc @@ -40,7 +40,7 @@ SHIM_CALL XamContentGetLicenseMask_shim( // To be clever, let's just try setting all the bits. SHIM_SET_MEM_32(mask_ptr, 0xFFFFFFFF); - SHIM_SET_RETURN(X_ERROR_SUCCESS); + SHIM_SET_RETURN_32(X_ERROR_SUCCESS); } @@ -57,7 +57,7 @@ SHIM_CALL XamContentCreateEnumerator_shim( XELOGD( "XamContentCreateEnumerator(%.8X, %.8X, %.8X, %.8X, %.8X, %.8X, %.8X)", arg0, arg1, arg2, arg3, arg4, arg5, arg6); - SHIM_SET_RETURN(X_ERROR_DEVICE_NOT_CONNECTED); + SHIM_SET_RETURN_32(X_ERROR_DEVICE_NOT_CONNECTED); } } // namespace kernel diff --git a/src/xenia/kernel/xam_info.cc b/src/xenia/kernel/xam_info.cc index 0bc375bbb..a8c1b1b22 100644 --- a/src/xenia/kernel/xam_info.cc +++ b/src/xenia/kernel/xam_info.cc @@ -32,7 +32,7 @@ SHIM_CALL XamGetSystemVersion_shim( // we pretend to be old we have less to worry with implementing. // 0x200A3200 // 0x20096B00 - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); } @@ -43,7 +43,7 @@ SHIM_CALL XGetAVPack_shim( // 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(6); + SHIM_SET_RETURN_64(6); } @@ -51,7 +51,7 @@ SHIM_CALL XGetGameRegion_shim( PPCContext* ppc_state, KernelState* state) { XELOGD("XGetGameRegion()"); - SHIM_SET_RETURN(XEX_REGION_ALL); + SHIM_SET_RETURN_64(XEX_REGION_ALL); } @@ -71,7 +71,7 @@ SHIM_CALL XGetLanguage_shim( } // Add more overrides? - SHIM_SET_RETURN(desired_language); + SHIM_SET_RETURN_64(desired_language); } @@ -85,7 +85,7 @@ SHIM_CALL XamLoaderGetLaunchDataSize_shim( SHIM_SET_MEM_32(size_ptr, 0); - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); } @@ -98,7 +98,7 @@ SHIM_CALL XamLoaderGetLaunchData_shim( "XamLoaderGetLaunchData(%.8X, %d)", buffer_ptr, buffer_size); - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); } diff --git a/src/xenia/kernel/xam_input.cc b/src/xenia/kernel/xam_input.cc index af98d26ba..4d5a8e4eb 100644 --- a/src/xenia/kernel/xam_input.cc +++ b/src/xenia/kernel/xam_input.cc @@ -35,7 +35,7 @@ SHIM_CALL XamResetInactivity_shim( unk); // Result ignored. - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); } @@ -50,7 +50,7 @@ SHIM_CALL XamEnableInactivityProcessing_shim( unk); // Expects 0. - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); } @@ -68,7 +68,7 @@ SHIM_CALL XamInputGetCapabilities_shim( caps_ptr); if (!caps_ptr) { - SHIM_SET_RETURN(X_ERROR_BAD_ARGUMENTS); + SHIM_SET_RETURN_32(X_ERROR_BAD_ARGUMENTS); return; } @@ -79,7 +79,7 @@ SHIM_CALL XamInputGetCapabilities_shim( if (XSUCCEEDED(result)) { caps.Write(SHIM_MEM_BASE, caps_ptr); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -107,7 +107,7 @@ SHIM_CALL XamInputGetState_shim( input_state.Write(SHIM_MEM_BASE, state_ptr); } } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -123,7 +123,7 @@ SHIM_CALL XamInputSetState_shim( vibration_ptr); if (!vibration_ptr) { - SHIM_SET_RETURN(X_ERROR_BAD_ARGUMENTS); + SHIM_SET_RETURN_32(X_ERROR_BAD_ARGUMENTS); return; } @@ -131,7 +131,7 @@ SHIM_CALL XamInputSetState_shim( X_INPUT_VIBRATION vibration(SHIM_MEM_BASE, vibration_ptr); X_RESULT result = input_system->SetState(user_index, vibration); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -153,7 +153,7 @@ SHIM_CALL XamInputGetKeystroke_shim( keystroke_ptr); if (!keystroke_ptr) { - SHIM_SET_RETURN(X_ERROR_BAD_ARGUMENTS); + SHIM_SET_RETURN_32(X_ERROR_BAD_ARGUMENTS); return; } @@ -164,7 +164,7 @@ SHIM_CALL XamInputGetKeystroke_shim( if (XSUCCEEDED(result)) { keystroke.Write(SHIM_MEM_BASE, keystroke_ptr); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -184,7 +184,7 @@ SHIM_CALL XamInputGetKeystrokeEx_shim( keystroke_ptr); if (!keystroke_ptr) { - SHIM_SET_RETURN(X_ERROR_BAD_ARGUMENTS); + SHIM_SET_RETURN_32(X_ERROR_BAD_ARGUMENTS); return; } @@ -196,7 +196,7 @@ SHIM_CALL XamInputGetKeystrokeEx_shim( SHIM_SET_MEM_32(user_index_ptr, keystroke.user_index); keystroke.Write(SHIM_MEM_BASE, keystroke_ptr); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } diff --git a/src/xenia/kernel/xam_msg.cc b/src/xenia/kernel/xam_msg.cc index 260fa4294..7c288c492 100644 --- a/src/xenia/kernel/xam_msg.cc +++ b/src/xenia/kernel/xam_msg.cc @@ -67,7 +67,7 @@ SHIM_CALL XMsgInProcessCall_shim( XELOGE("Unimplemented XMsgInProcessCall message!"); } - SHIM_SET_RETURN(handled ? X_ERROR_SUCCESS : X_ERROR_NOT_FOUND); + SHIM_SET_RETURN_32(handled ? X_ERROR_SUCCESS : X_ERROR_NOT_FOUND); } @@ -83,7 +83,7 @@ SHIM_CALL XMsgCancelIORequest_shim( // ? XELOGW("XMsgCancelIORequest NOT IMPLEMENTED (wait?)"); - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_32(0); } diff --git a/src/xenia/kernel/xam_net.cc b/src/xenia/kernel/xam_net.cc index e445b914e..4ca580cce 100644 --- a/src/xenia/kernel/xam_net.cc +++ b/src/xenia/kernel/xam_net.cc @@ -35,7 +35,7 @@ SHIM_CALL NetDll_XNetStartup_shim( arg0, params_ptr); - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); } SHIM_CALL NetDll_WSAStartup_shim( @@ -60,13 +60,13 @@ SHIM_CALL NetDll_WSAStartup_shim( SHIM_SET_MEM_32(data_ptr + 0x190, 0); } - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); } SHIM_CALL NetDll_WSAGetLastError_shim( PPCContext* ppc_state, KernelState* state) { XELOGD("NetDll_WSAGetLastError()"); - SHIM_SET_RETURN(WSAENETDOWN); + SHIM_SET_RETURN_32(WSAENETDOWN); } SHIM_CALL NetDll_XNetGetEthernetLinkStatus_shim( @@ -77,7 +77,7 @@ SHIM_CALL NetDll_XNetGetEthernetLinkStatus_shim( XELOGD( "NetDll_XNetGetEthernetLinkStatus(%d)", arg0); - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_32(0); } SHIM_CALL NetDll_inet_addr_shim( @@ -86,7 +86,7 @@ SHIM_CALL NetDll_inet_addr_shim( XELOGD( "NetDll_inet_addr(%.8X)", cp_ptr); - SHIM_SET_RETURN(INADDR_NONE); + SHIM_SET_RETURN_32(INADDR_NONE); } SHIM_CALL NetDll_socket_shim( @@ -101,7 +101,7 @@ SHIM_CALL NetDll_socket_shim( af, type, protocol); - SHIM_SET_RETURN(SOCKET_ERROR); + SHIM_SET_RETURN_32(SOCKET_ERROR); } SHIM_CALL NetDll_setsockopt_shim( @@ -120,7 +120,7 @@ SHIM_CALL NetDll_setsockopt_shim( optname, optval_ptr, optlen); - SHIM_SET_RETURN(SOCKET_ERROR); + SHIM_SET_RETURN_32(SOCKET_ERROR); } SHIM_CALL NetDll_connect_shim( @@ -133,7 +133,7 @@ SHIM_CALL NetDll_connect_shim( socket_ptr, sockaddr_ptr, namelen); - SHIM_SET_RETURN(SOCKET_ERROR); + SHIM_SET_RETURN_32(SOCKET_ERROR); } SHIM_CALL NetDll_recv_shim( @@ -150,7 +150,7 @@ SHIM_CALL NetDll_recv_shim( buf_ptr, len, flags); - SHIM_SET_RETURN(SOCKET_ERROR); + SHIM_SET_RETURN_32(SOCKET_ERROR); } SHIM_CALL NetDll_recvfrom_shim( @@ -171,7 +171,7 @@ SHIM_CALL NetDll_recvfrom_shim( flags, from_ptr, fromlen_ptr); - SHIM_SET_RETURN(SOCKET_ERROR); + SHIM_SET_RETURN_32(SOCKET_ERROR); } SHIM_CALL NetDll_send_shim( @@ -186,7 +186,7 @@ SHIM_CALL NetDll_send_shim( buf_ptr, len, flags); - SHIM_SET_RETURN(SOCKET_ERROR); + SHIM_SET_RETURN_32(SOCKET_ERROR); } diff --git a/src/xenia/kernel/xam_notify.cc b/src/xenia/kernel/xam_notify.cc index 0fce7ba96..6521f9876 100644 --- a/src/xenia/kernel/xam_notify.cc +++ b/src/xenia/kernel/xam_notify.cc @@ -43,7 +43,7 @@ SHIM_CALL XamNotifyCreateListener_shim( uint32_t handle = listener->handle(); listener->Release(); - SHIM_SET_RETURN(handle); + SHIM_SET_RETURN_64(handle); } @@ -63,7 +63,7 @@ SHIM_CALL XNotifyGetNext_shim( param_ptr); if (!handle) { - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); return; } @@ -71,7 +71,7 @@ SHIM_CALL XNotifyGetNext_shim( XNotifyListener* listener = NULL; if (XFAILED(state->object_table()->GetObject( handle, (XObject**)&listener))) { - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); return; } @@ -96,7 +96,7 @@ SHIM_CALL XNotifyGetNext_shim( SHIM_SET_MEM_32(param_ptr, param); } - SHIM_SET_RETURN(dequeued ? 1 : 0); + SHIM_SET_RETURN_64(dequeued ? 1 : 0); } diff --git a/src/xenia/kernel/xam_user.cc b/src/xenia/kernel/xam_user.cc index 2eb8cdcba..b0de9458a 100644 --- a/src/xenia/kernel/xam_user.cc +++ b/src/xenia/kernel/xam_user.cc @@ -39,9 +39,9 @@ SHIM_CALL XamUserGetXUID_shim( if (xuid_ptr) { SHIM_SET_MEM_32(xuid_ptr, 0xBABEBABE); } - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_32(0); } else { - SHIM_SET_RETURN(X_ERROR_NO_SUCH_USER); + SHIM_SET_RETURN_32(X_ERROR_NO_SUCH_USER); } } @@ -58,9 +58,9 @@ SHIM_CALL XamUserGetSigninState_shim( // This should keep games from asking us to sign in and also keep them // from initializing the network. if (user_index == 0) { - SHIM_SET_RETURN(1); + SHIM_SET_RETURN_64(1); } else { - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); } } @@ -83,9 +83,9 @@ SHIM_CALL XamUserGetSigninInfo_shim( SHIM_SET_MEM_32(info_ptr + 16, 0); // ? char* buffer = (char*)SHIM_MEM_ADDR(info_ptr + 20); xestrncpya(buffer, 0x10, "User0", 5); - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_32(0); } else { - SHIM_SET_RETURN(X_ERROR_NO_SUCH_USER); + SHIM_SET_RETURN_32(X_ERROR_NO_SUCH_USER); } } @@ -103,9 +103,9 @@ SHIM_CALL XamUserGetName_shim( if (user_index == 0) { char* buffer = (char*)SHIM_MEM_ADDR(buffer_ptr); xestrncpya(buffer, buffer_len, "User0", 5); - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_32(0); } else { - SHIM_SET_RETURN(X_ERROR_NO_SUCH_USER); + SHIM_SET_RETURN_32(X_ERROR_NO_SUCH_USER); } } @@ -164,13 +164,13 @@ SHIM_CALL XamUserReadProfileSettings_shim( } SHIM_SET_MEM_32(buffer_size_ptr, size_needed); if (buffer_size < size_needed) { - SHIM_SET_RETURN(X_ERROR_INSUFFICIENT_BUFFER); + SHIM_SET_RETURN_32(X_ERROR_INSUFFICIENT_BUFFER); return; } // TODO(benvanik): read profile data. // For now, just return signed out. - SHIM_SET_RETURN(X_ERROR_NOT_FOUND); + SHIM_SET_RETURN_32(X_ERROR_NOT_FOUND); } diff --git a/src/xenia/kernel/xboxkrnl_audio.cc b/src/xenia/kernel/xboxkrnl_audio.cc index 3f8c2dca6..727792761 100644 --- a/src/xenia/kernel/xboxkrnl_audio.cc +++ b/src/xenia/kernel/xboxkrnl_audio.cc @@ -36,7 +36,7 @@ SHIM_CALL XMACreateContext_shim( // TODO(benvanik): allocate and return -- see if size required or just dummy? - SHIM_SET_RETURN(X_ERROR_ACCESS_DENIED); + SHIM_SET_RETURN_32(X_ERROR_ACCESS_DENIED); } @@ -62,7 +62,7 @@ SHIM_CALL XAudioGetSpeakerConfig_shim( SHIM_SET_MEM_32(config_ptr, 0x00010001); - SHIM_SET_RETURN(X_ERROR_SUCCESS); + SHIM_SET_RETURN_32(X_ERROR_SUCCESS); } @@ -81,7 +81,7 @@ SHIM_CALL XAudioGetVoiceCategoryVolumeChangeMask_shim( // I think. SHIM_SET_MEM_32(out_ptr, 0); - SHIM_SET_RETURN(X_ERROR_SUCCESS); + SHIM_SET_RETURN_32(X_ERROR_SUCCESS); } @@ -97,7 +97,7 @@ SHIM_CALL XAudioGetVoiceCategoryVolume_shim( // Expects a floating point single. Volume %? SHIM_SET_MEM_F32(out_ptr, 1.0f); - SHIM_SET_RETURN(X_ERROR_SUCCESS); + SHIM_SET_RETURN_32(X_ERROR_SUCCESS); } @@ -118,7 +118,7 @@ SHIM_CALL XAudioRegisterRenderDriverClient_shim( SHIM_SET_MEM_32(driver_ptr, 0xAADD1100); - SHIM_SET_RETURN(X_ERROR_SUCCESS); + SHIM_SET_RETURN_32(X_ERROR_SUCCESS); } @@ -135,7 +135,7 @@ SHIM_CALL XAudioUnregisterRenderDriverClient_shim( auto audio_system = state->emulator()->audio_system(); audio_system->UnregisterClient(); - SHIM_SET_RETURN(X_ERROR_SUCCESS); + SHIM_SET_RETURN_32(X_ERROR_SUCCESS); } @@ -153,7 +153,7 @@ SHIM_CALL XAudioSubmitRenderDriverFrame_shim( auto audio_system = state->emulator()->audio_system(); audio_system->SubmitFrame(samples_ptr); - SHIM_SET_RETURN(X_ERROR_SUCCESS); + SHIM_SET_RETURN_32(X_ERROR_SUCCESS); } diff --git a/src/xenia/kernel/xboxkrnl_debug.cc b/src/xenia/kernel/xboxkrnl_debug.cc index 5b709cbb5..e6cc023c3 100644 --- a/src/xenia/kernel/xboxkrnl_debug.cc +++ b/src/xenia/kernel/xboxkrnl_debug.cc @@ -30,7 +30,7 @@ SHIM_CALL DbgPrint_shim( uint32_t format_ptr = SHIM_GET_ARG_32(0); if (format_ptr == 0) { - SHIM_SET_RETURN(-1); + SHIM_SET_RETURN_64(-1); return; } diff --git a/src/xenia/kernel/xboxkrnl_io.cc b/src/xenia/kernel/xboxkrnl_io.cc index de57f0c50..f65dda9ca 100644 --- a/src/xenia/kernel/xboxkrnl_io.cc +++ b/src/xenia/kernel/xboxkrnl_io.cc @@ -114,7 +114,7 @@ SHIM_CALL NtCreateFile_shim( } xe_free(object_name); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } SHIM_CALL NtOpenFile_shim( @@ -187,7 +187,7 @@ SHIM_CALL NtOpenFile_shim( } xe_free(object_name); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } class xeNtReadFileState { @@ -303,7 +303,7 @@ SHIM_CALL NtReadFile_shim( ev->Release(); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } SHIM_CALL NtSetInformationFile_shim( @@ -361,7 +361,7 @@ SHIM_CALL NtSetInformationFile_shim( file->Release(); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } SHIM_CALL NtQueryInformationFile_shim( @@ -449,7 +449,7 @@ SHIM_CALL NtQueryInformationFile_shim( file->Release(); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } SHIM_CALL NtQueryFullAttributesFile_shim( @@ -491,7 +491,7 @@ SHIM_CALL NtQueryFullAttributesFile_shim( } xe_free(object_name); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } SHIM_CALL NtQueryVolumeInformationFile_shim( @@ -501,7 +501,7 @@ SHIM_CALL NtQueryVolumeInformationFile_shim( "NtQueryVolumeInformationFile(?)"); XEASSERTALWAYS(); - SHIM_SET_RETURN(X_STATUS_NO_SUCH_FILE); + SHIM_SET_RETURN_32(X_STATUS_NO_SUCH_FILE); } SHIM_CALL NtQueryDirectoryFile_shim( @@ -530,7 +530,7 @@ SHIM_CALL NtQueryDirectoryFile_shim( restart_scan); if (length < 72) { - SHIM_SET_RETURN(X_STATUS_INFO_LENGTH_MISMATCH); + SHIM_SET_RETURN_32(X_STATUS_INFO_LENGTH_MISMATCH); return; } @@ -571,7 +571,7 @@ SHIM_CALL NtQueryDirectoryFile_shim( file->Release(); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } SHIM_CALL FscSetCacheElementCount_shim( @@ -585,7 +585,7 @@ SHIM_CALL FscSetCacheElementCount_shim( "FscSetCacheElementCount(%.8X, %.8X)", unk_0, unk_1); - SHIM_SET_RETURN(X_STATUS_SUCCESS); + SHIM_SET_RETURN_32(X_STATUS_SUCCESS); } diff --git a/src/xenia/kernel/xboxkrnl_memory.cc b/src/xenia/kernel/xboxkrnl_memory.cc index 45b8342bd..5b1c8c579 100644 --- a/src/xenia/kernel/xboxkrnl_memory.cc +++ b/src/xenia/kernel/xboxkrnl_memory.cc @@ -119,7 +119,7 @@ SHIM_CALL NtAllocateVirtualMemory_shim( SHIM_SET_MEM_32(base_addr_ptr, base_addr_value); SHIM_SET_MEM_32(region_size_ptr, region_size_value); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -185,7 +185,7 @@ SHIM_CALL NtFreeVirtualMemory_shim( SHIM_SET_MEM_32(base_addr_ptr, base_addr_value); SHIM_SET_MEM_32(region_size_ptr, region_size_value); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -274,7 +274,7 @@ SHIM_CALL MmAllocatePhysicalMemoryEx_shim( type, region_size, protect_bits, min_addr_range, max_addr_range, alignment); - SHIM_SET_RETURN(base_address); + SHIM_SET_RETURN_32(base_address); } @@ -328,7 +328,7 @@ SHIM_CALL MmQueryAddressProtect_shim( uint32_t result = xeMmQueryAddressProtect(base_address); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -352,7 +352,7 @@ SHIM_CALL MmQueryAllocationSize_shim( uint32_t result = xeMmQueryAllocationSize(base_address); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -366,7 +366,7 @@ SHIM_CALL MmQueryStatistics_shim( uint32_t size = SHIM_MEM_32(stats_ptr + 0); if (size != 104) { - SHIM_SET_RETURN(X_STATUS_BUFFER_TOO_SMALL); + SHIM_SET_RETURN_32(X_STATUS_BUFFER_TOO_SMALL); return; } @@ -407,7 +407,7 @@ uint32_t size = SHIM_MEM_32(stats_ptr + 0); SHIM_SET_MEM_32(stats_ptr + 4 * 24, 0x00000000); // SystemCachePages SHIM_SET_MEM_32(stats_ptr + 4 * 25, 0x0001FFFF); // HighestPhysicalPage - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -444,7 +444,7 @@ SHIM_CALL MmGetPhysicalAddress_shim( uint32_t result = xeMmGetPhysicalAddress(base_address); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -456,7 +456,7 @@ SHIM_CALL KeLockL2_shim( XELOGD( "KeLockL2(?)"); - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_32(0); } diff --git a/src/xenia/kernel/xboxkrnl_modules.cc b/src/xenia/kernel/xboxkrnl_modules.cc index bcd5e5c49..4539d86d8 100644 --- a/src/xenia/kernel/xboxkrnl_modules.cc +++ b/src/xenia/kernel/xboxkrnl_modules.cc @@ -116,7 +116,7 @@ SHIM_CALL ExGetXConfigSetting_shim( SHIM_SET_MEM_16(required_size_ptr, required_size); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -157,7 +157,7 @@ SHIM_CALL XexCheckExecutablePrivilege_shim( int result = xeXexCheckExecutablePriviledge(privilege); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -200,7 +200,7 @@ SHIM_CALL XexGetModuleHandle_shim( SHIM_SET_MEM_32(module_handle_ptr, module_handle); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -231,7 +231,7 @@ SHIM_CALL XexGetModuleSection_shim( module->Release(); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -260,7 +260,7 @@ SHIM_CALL XexLoadImage_shim( result = X_STATUS_NO_SUCH_FILE; } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -276,7 +276,7 @@ SHIM_CALL XexUnloadImage_shim( result = state->object_table()->RemoveHandle(handle); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -310,7 +310,7 @@ SHIM_CALL XexGetProcedureAddress_shim( module->Release(); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } diff --git a/src/xenia/kernel/xboxkrnl_ob.cc b/src/xenia/kernel/xboxkrnl_ob.cc index aacbfb8fc..a1e1c573c 100644 --- a/src/xenia/kernel/xboxkrnl_ob.cc +++ b/src/xenia/kernel/xboxkrnl_ob.cc @@ -60,7 +60,7 @@ SHIM_CALL ObReferenceObjectByHandle_shim( } } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -74,7 +74,7 @@ SHIM_CALL ObDereferenceObject_shim( // Check if a dummy value from ObReferenceObjectByHandle. if (native_ptr == 0xDEADF00D) { - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_32(0); return; } @@ -84,7 +84,7 @@ SHIM_CALL ObDereferenceObject_shim( object->Release(); } - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_32(0); } @@ -124,7 +124,7 @@ SHIM_CALL NtDuplicateObject_shim( obj->Release(); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -140,7 +140,7 @@ SHIM_CALL NtClose_shim( result = state->object_table()->RemoveHandle(handle); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } diff --git a/src/xenia/kernel/xboxkrnl_rtl.cc b/src/xenia/kernel/xboxkrnl_rtl.cc index 840b3d240..18310e6a7 100644 --- a/src/xenia/kernel/xboxkrnl_rtl.cc +++ b/src/xenia/kernel/xboxkrnl_rtl.cc @@ -66,7 +66,7 @@ SHIM_CALL RtlCompareMemory_shim( source1, source2, length); uint32_t result = xeRtlCompareMemory(source1, source2, length); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_64(result); } @@ -116,7 +116,7 @@ SHIM_CALL RtlCompareMemoryUlong_shim( source, length, pattern); uint32_t result = xeRtlCompareMemoryUlong(source, length, pattern); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_64(result); } @@ -343,7 +343,7 @@ SHIM_CALL RtlUnicodeStringToAnsiString_shim( X_STATUS result = xeRtlUnicodeStringToAnsiString( destination_ptr, source_ptr, alloc_dest); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -372,7 +372,7 @@ SHIM_CALL RtlMultiByteToUnicodeN_shim( SHIM_SET_MEM_32(written_ptr, copy_len << 1); } - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_32(0); } @@ -402,7 +402,7 @@ SHIM_CALL RtlUnicodeToMultiByteN_shim( SHIM_SET_MEM_32(written_ptr, copy_len); } - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_32(0); } @@ -431,7 +431,7 @@ SHIM_CALL RtlNtStatusToDosError_shim( status); uint32_t result = xeRtlNtStatusToDosError(status); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -488,7 +488,7 @@ SHIM_CALL RtlImageXexHeaderField_shim( xex_header_base, image_field); uint32_t result = xeRtlImageXexHeaderField(xex_header_base, image_field); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_64(result); } @@ -590,7 +590,7 @@ SHIM_CALL RtlInitializeCriticalSectionAndSpinCount_shim( X_STATUS result = xeRtlInitializeCriticalSectionAndSpinCount( cs_ptr, spin_count); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -682,7 +682,7 @@ SHIM_CALL RtlTryEnterCriticalSection_shim( uint32_t thread_id = XThread::GetCurrentThreadId(thread_state_block); uint32_t result = xeRtlTryEnterCriticalSection(cs_ptr, thread_id); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_64(result); } @@ -766,13 +766,13 @@ SHIM_CALL RtlTimeFieldsToTime_shim( FILETIME ft; if (!SystemTimeToFileTime(&st, &ft)) { // set last error = ERROR_INVALID_PARAMETER - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); return; } uint64_t time = (uint64_t(ft.dwHighDateTime) << 32) | ft.dwLowDateTime; SHIM_SET_MEM_64(time_ptr, time); - SHIM_SET_RETURN(1); + SHIM_SET_RETURN_64(1); } diff --git a/src/xenia/kernel/xboxkrnl_strings.cc b/src/xenia/kernel/xboxkrnl_strings.cc index 6837caae9..017f7a7fc 100644 --- a/src/xenia/kernel/xboxkrnl_strings.cc +++ b/src/xenia/kernel/xboxkrnl_strings.cc @@ -36,7 +36,7 @@ SHIM_CALL _vsnprintf_shim( uint32_t arg_ptr = SHIM_GET_ARG_32(3); if (format_ptr == 0) { - SHIM_SET_RETURN(-1); + SHIM_SET_RETURN_32(-1); return; } @@ -235,7 +235,7 @@ SHIM_CALL _vsnprintf_shim( format = end; } *b = '\0'; - SHIM_SET_RETURN((uint32_t)(b - buffer)); + SHIM_SET_RETURN_32((uint32_t)(b - buffer)); } @@ -248,7 +248,7 @@ SHIM_CALL _vswprintf_shim( uint32_t arg_ptr = SHIM_GET_ARG_32(2); if (format_ptr == 0) { - SHIM_SET_RETURN(-1); + SHIM_SET_RETURN_32(-1); return; } @@ -494,7 +494,7 @@ SHIM_CALL _vswprintf_shim( *swap = XESWAP16(*swap); } - SHIM_SET_RETURN((uint32_t)((b - buffer) / sizeof(wchar_t))); + SHIM_SET_RETURN_32((uint32_t)((b - buffer) / sizeof(wchar_t))); } diff --git a/src/xenia/kernel/xboxkrnl_threading.cc b/src/xenia/kernel/xboxkrnl_threading.cc index 2b7450703..533a05d2c 100644 --- a/src/xenia/kernel/xboxkrnl_threading.cc +++ b/src/xenia/kernel/xboxkrnl_threading.cc @@ -136,7 +136,7 @@ SHIM_CALL ExCreateThread_shim( SHIM_SET_MEM_32(thread_id_ptr, thread_id); } } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -152,7 +152,7 @@ SHIM_CALL ExTerminateThread_shim( // NOTE: this kills us right now. We won't return from it. X_STATUS result = thread->Exit(exit_code); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -192,7 +192,7 @@ SHIM_CALL NtResumeThread_shim( } } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -230,7 +230,7 @@ SHIM_CALL KeResumeThread_shim( } } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -270,7 +270,7 @@ SHIM_CALL NtSuspendThread_shim( } } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -300,7 +300,7 @@ SHIM_CALL KeSetAffinityThread_shim( void* thread_ptr = SHIM_MEM_ADDR(thread); uint32_t result = xeKeSetAffinityThread(thread_ptr, affinity); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -320,7 +320,7 @@ SHIM_CALL KeQueryBasePriorityThread_shim( priority = thread->QueryPriority(); } - SHIM_SET_RETURN(priority); + SHIM_SET_RETURN_32(priority); } @@ -352,7 +352,7 @@ SHIM_CALL KeSetBasePriorityThread_shim( void* thread_ptr = SHIM_MEM_ADDR(thread); uint32_t result = xeKeSetBasePriorityThread(thread_ptr, increment); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -372,7 +372,7 @@ SHIM_CALL KeGetCurrentProcessType_shim( "KeGetCurrentProcessType()"); int result = xeKeGetCurrentProcessType(); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_64(result); } @@ -392,7 +392,7 @@ SHIM_CALL KeQueryPerformanceFrequency_shim( "KeQueryPerformanceFrequency()"); uint64_t result = xeKeQueryPerformanceFrequency(); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_64(result); } @@ -417,7 +417,7 @@ SHIM_CALL KeDelayExecutionThread_shim( X_STATUS result = xeKeDelayExecutionThread( processor_mode, alertable, interval); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -425,7 +425,7 @@ SHIM_CALL NtYieldExecution_shim( PPCContext* ppc_state, KernelState* state) { XELOGD("NtYieldExecution()"); xeKeDelayExecutionThread(0, 0, 0); - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); } @@ -486,7 +486,7 @@ SHIM_CALL KeTlsAlloc_shim( "KeTlsAlloc()"); uint32_t result = xeKeTlsAlloc(); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_64(result); } @@ -520,7 +520,7 @@ SHIM_CALL KeTlsFree_shim( tls_index); int result = xeKeTlsAlloc(); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_64(result); } @@ -555,7 +555,7 @@ SHIM_CALL KeTlsGetValue_shim( tls_index); uint64_t result = xeKeTlsGetValue(tls_index); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_64(result); } @@ -587,7 +587,7 @@ SHIM_CALL KeTlsSetValue_shim( tls_index, tls_value); int result = xeKeTlsSetValue(tls_index, tls_value); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_64(result); } @@ -631,7 +631,7 @@ SHIM_CALL NtCreateEvent_shim( SHIM_SET_MEM_32(handle_ptr, handle); } } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -662,7 +662,7 @@ SHIM_CALL KeSetEvent_shim( void* event_ptr = SHIM_MEM_ADDR(event_ref); int32_t result = xeKeSetEvent(event_ptr, increment, wait); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_64(result); } @@ -689,7 +689,7 @@ SHIM_CALL NtSetEvent_shim( ev->Release(); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -712,7 +712,7 @@ SHIM_CALL KePulseEvent_shim( result = ev->Pulse(increment, !!wait); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_64(result); } @@ -739,7 +739,7 @@ SHIM_CALL NtPulseEvent_shim( ev->Release(); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -768,7 +768,7 @@ SHIM_CALL KeResetEvent_shim( void* event_ptr = SHIM_MEM_ADDR(event_ref); int32_t result = xeKeResetEvent(event_ptr); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_64(result); } @@ -790,7 +790,7 @@ SHIM_CALL NtClearEvent_shim( ev->Release(); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -817,7 +817,7 @@ SHIM_CALL NtCreateSemaphore_shim( SHIM_SET_MEM_32(handle_ptr, sem->handle()); } - SHIM_SET_RETURN(X_STATUS_SUCCESS); + SHIM_SET_RETURN_32(X_STATUS_SUCCESS); } @@ -885,7 +885,7 @@ SHIM_CALL KeReleaseSemaphore_shim( int32_t result = xeKeReleaseSemaphore( semaphore_ptr, increment, adjustment, wait == 1); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_64(result); } @@ -913,7 +913,7 @@ SHIM_CALL NtReleaseSemaphore_shim( } } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -939,7 +939,7 @@ SHIM_CALL NtCreateMutant_shim( SHIM_SET_MEM_32(handle_ptr, mutant->handle()); } - SHIM_SET_RETURN(X_STATUS_SUCCESS); + SHIM_SET_RETURN_32(X_STATUS_SUCCESS); } @@ -972,7 +972,7 @@ SHIM_CALL NtReleaseMutant_shim( mutant->Release(); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -1000,7 +1000,7 @@ SHIM_CALL NtCreateTimer_shim( SHIM_SET_MEM_32(handle_ptr, timer->handle()); } - SHIM_SET_RETURN(X_STATUS_SUCCESS); + SHIM_SET_RETURN_32(X_STATUS_SUCCESS); } @@ -1036,7 +1036,7 @@ SHIM_CALL NtSetTimerEx_shim( timer->Release(); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -1066,7 +1066,7 @@ SHIM_CALL NtCancelTimer_shim( } } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -1104,7 +1104,7 @@ SHIM_CALL KeWaitForSingleObject_shim( object_ptr, wait_reason, processor_mode, alertable, timeout_ptr ? &timeout : NULL); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -1132,7 +1132,7 @@ SHIM_CALL NtWaitForSingleObjectEx_shim( object->Release(); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -1162,7 +1162,7 @@ SHIM_CALL KeWaitForMultipleObjects_shim( void* object_ptr = SHIM_MEM_ADDR(object_ptr_ptr); objects[n] = XObject::GetObject(state, object_ptr); if (!objects[n]) { - SHIM_SET_RETURN(X_STATUS_INVALID_PARAMETER); + SHIM_SET_RETURN_32(X_STATUS_INVALID_PARAMETER); return; } } @@ -1173,7 +1173,7 @@ SHIM_CALL KeWaitForMultipleObjects_shim( wait_type, wait_reason, processor_mode, alertable, timeout_ptr ? &timeout : NULL); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -1201,10 +1201,10 @@ SHIM_CALL NtWaitForMultipleObjectsEx_shim( XObject* object = NULL; result = state->object_table()->GetObject(object_handle, &object); if (XFAILED(result)) { - SHIM_SET_RETURN(X_STATUS_INVALID_PARAMETER); + SHIM_SET_RETURN_32(X_STATUS_INVALID_PARAMETER); return; } - objects[n] = object; + objects[n] = object; } uint64_t timeout = timeout_ptr ? SHIM_MEM_64(timeout_ptr) : 0; @@ -1213,7 +1213,7 @@ SHIM_CALL NtWaitForMultipleObjectsEx_shim( wait_type, 6, wait_mode, alertable, timeout_ptr ? &timeout : NULL); - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -1253,7 +1253,7 @@ SHIM_CALL NtSignalAndWaitForSingleObjectEx_shim( wait_object->Release(); } - SHIM_SET_RETURN(result); + SHIM_SET_RETURN_32(result); } @@ -1280,7 +1280,7 @@ SHIM_CALL KfAcquireSpinLock_shim( uint32_t old_irql = xeKfAcquireSpinLock(SHIM_MEM_ADDR(lock_ptr)); - SHIM_SET_RETURN(old_irql); + SHIM_SET_RETURN_64(old_irql); } @@ -1434,7 +1434,7 @@ SHIM_CALL KeInsertQueueApc_shim( XThread* thread = (XThread*)XObject::GetObject( state, SHIM_MEM_ADDR(thread_ptr)); if (!thread) { - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); return; } @@ -1444,7 +1444,7 @@ SHIM_CALL KeInsertQueueApc_shim( // Fail if already inserted. if (SHIM_MEM_32(apc_ptr + 40) & 0xFF00) { thread->UnlockApc(); - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); return; } @@ -1462,7 +1462,7 @@ SHIM_CALL KeInsertQueueApc_shim( // Unlock thread. thread->UnlockApc(); - SHIM_SET_RETURN(1); + SHIM_SET_RETURN_64(1); } @@ -1480,7 +1480,7 @@ SHIM_CALL KeRemoveQueueApc_shim( XThread* thread = (XThread*)XObject::GetObject( state, SHIM_MEM_ADDR(thread_ptr)); if (!thread) { - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); return; } @@ -1488,7 +1488,7 @@ SHIM_CALL KeRemoveQueueApc_shim( if (!(SHIM_MEM_32(apc_ptr + 40) & 0xFF00)) { thread->UnlockApc(); - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); return; } @@ -1501,7 +1501,7 @@ SHIM_CALL KeRemoveQueueApc_shim( thread->UnlockApc(); - SHIM_SET_RETURN(result ? 1 : 0); + SHIM_SET_RETURN_64(result ? 1 : 0); } @@ -1514,7 +1514,7 @@ SHIM_CALL KiApcNormalRoutineNop_shim( "KiApcNormalRoutineNop(%.8X, %.8X)", unk0, unk1); - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); } @@ -1563,7 +1563,7 @@ SHIM_CALL KeInsertQueueDpc_shim( // If already in a queue, abort. if (dpc_list->IsQueued(list_entry_ptr)) { - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); dispatcher->Unlock(); return; } @@ -1576,7 +1576,7 @@ SHIM_CALL KeInsertQueueDpc_shim( dispatcher->Unlock(); - SHIM_SET_RETURN(1); + SHIM_SET_RETURN_64(1); } @@ -1603,7 +1603,7 @@ SHIM_CALL KeRemoveQueueDpc_shim( dispatcher->Unlock(); - SHIM_SET_RETURN(result ? 1 : 0); + SHIM_SET_RETURN_64(result ? 1 : 0); } diff --git a/src/xenia/kernel/xboxkrnl_video.cc b/src/xenia/kernel/xboxkrnl_video.cc index dfd39763e..951606bde 100644 --- a/src/xenia/kernel/xboxkrnl_video.cc +++ b/src/xenia/kernel/xboxkrnl_video.cc @@ -95,7 +95,7 @@ SHIM_CALL VdQueryVideoFlags_shim( XELOGD( "VdQueryVideoFlags()"); - SHIM_SET_RETURN(xeVdQueryVideoFlags()); + SHIM_SET_RETURN_64(xeVdQueryVideoFlags()); } @@ -357,7 +357,7 @@ SHIM_CALL VdIsHSIOTrainingSucceeded_shim( // Not really sure what this should be - code does weird stuff here: // (cntlzw r11, r3 / extrwi r11, r11, 1, 26) - SHIM_SET_RETURN(1); + SHIM_SET_RETURN_64(1); } @@ -367,7 +367,7 @@ SHIM_CALL VdPersistDisplay_shim( "VdPersistDisplay(?)"); // ? - SHIM_SET_RETURN(1); + SHIM_SET_RETURN_64(1); } @@ -379,7 +379,7 @@ SHIM_CALL VdRetrainEDRAMWorker_shim( "VdRetrainEDRAMWorker(%.8X)", unk0); - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); } @@ -396,7 +396,7 @@ SHIM_CALL VdRetrainEDRAM_shim( "VdRetrainEDRAM(%.8X, %.8X, %.8X, %.8X, %.8X, %.8X)", unk0, unk1, unk2, unk3, unk4, unk5); - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); } @@ -436,7 +436,7 @@ SHIM_CALL VdSwap_shim( // encode the parameters in the stream for the ringbuffer, if needed. xe_zero_struct(SHIM_MEM_ADDR(unk0), 64 * 4); - SHIM_SET_RETURN(0); + SHIM_SET_RETURN_64(0); }