diff --git a/src/xenia/kernel/xam/xam_input.cc b/src/xenia/kernel/xam/xam_input.cc index 60927a62b..8740abe18 100644 --- a/src/xenia/kernel/xam/xam_input.cc +++ b/src/xenia/kernel/xam/xam_input.cc @@ -24,6 +24,24 @@ namespace kernel { namespace xam { +// http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.reference.xinputgetcapabilities(v=vs.85).aspx +SHIM_CALL XamInputGetCapabilities_shim( + xe_ppc_state_t* ppc_state, XamState* state) { + uint32_t user_index = SHIM_GET_ARG_32(0); + uint32_t flags = SHIM_GET_ARG_32(1); + uint32_t caps_ptr = SHIM_GET_ARG_32(2); + + XELOGD( + "XamInputGetCapabilities(%d, %.8X, %.8X)", + user_index, + flags, + caps_ptr); + + SHIM_SET_RETURN(X_ERROR_DEVICE_NOT_CONNECTED); +} + + +// http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.reference.xinputgetstate(v=vs.85).aspx SHIM_CALL XamInputGetState_shim( xe_ppc_state_t* ppc_state, XamState* state) { uint32_t user_index = SHIM_GET_ARG_32(0); @@ -34,7 +52,24 @@ SHIM_CALL XamInputGetState_shim( user_index, state_ptr); - SHIM_SET_RETURN(X_STATUS_NOT_IMPLEMENTED); + SHIM_SET_RETURN(X_ERROR_DEVICE_NOT_CONNECTED); +} + + +// http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.reference.xinputsetstate(v=vs.85).aspx +SHIM_CALL XamInputSetState_shim( + xe_ppc_state_t* ppc_state, XamState* state) { + uint32_t user_index = SHIM_GET_ARG_32(0); + uint32_t vibration_ptr = SHIM_GET_ARG_32(1); + + XELOGD( + "XamInputSetState(%d, %.8X)", + user_index, + vibration_ptr); + + // or X_ERROR_BUSY + + SHIM_SET_RETURN(X_ERROR_DEVICE_NOT_CONNECTED); } @@ -45,5 +80,7 @@ SHIM_CALL XamInputGetState_shim( void xe::kernel::xam::RegisterInputExports( ExportResolver* export_resolver, XamState* state) { + SHIM_SET_MAPPING("xam.exe", XamInputGetCapabilities, state); SHIM_SET_MAPPING("xam.xex", XamInputGetState, state); + SHIM_SET_MAPPING("xam.xex", XamInputSetState, state); } diff --git a/src/xenia/xbox.h b/src/xenia/xbox.h index 2321c46d8..51a53efee 100644 --- a/src/xenia/xbox.h +++ b/src/xenia/xbox.h @@ -50,6 +50,15 @@ typedef uint32_t X_STATUS; #define X_STATUS_INVALID_PARAMETER_2 ((uint32_t)0xC00000F0L) #define X_STATUS_INVALID_PARAMETER_3 ((uint32_t)0xC00000F1L) +// HRESULT (ERROR_*) +// Adding as needed. +typedef uint32_t X_RESULT; +#define X_ERROR_SUCCESS ((uint32_t)0x00000000L) +#define X_ERROR_ACCESS_DENIED ((uint32_t)0x80070005L) +#define X_ERROR_BUSY ((uint32_t)0x800700AAL) +#define X_ERROR_DEVICE_NOT_CONNECTED ((uint32_t)0x8007048FL) +#define X_ERROR_CANCELLED ((uint32_t)0x800704C7L) + // MEM_*, used by NtAllocateVirtualMemory #define X_MEM_COMMIT 0x00001000 #define X_MEM_RESERVE 0x00002000