Stubbing input a little better.

This commit is contained in:
Ben Vanik 2013-10-23 21:10:41 -07:00
parent 6e60aef72f
commit 93e4b70133
2 changed files with 47 additions and 1 deletions

View File

@ -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);
}

View File

@ -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