Fix XInput query.

This commit is contained in:
Ben Vanik 2014-01-04 22:41:23 -08:00
parent 9b02cfb560
commit 21efe58254
1 changed files with 4 additions and 5 deletions

View File

@ -66,17 +66,16 @@ SHIM_CALL XamInputGetState_shim(
user_index, user_index,
state_ptr); state_ptr);
if (!state_ptr) { // Games call this with a NULL state ptr, probably as a query.
SHIM_SET_RETURN(X_ERROR_BAD_ARGUMENTS);
return;
}
InputSystem* input_system = state->emulator()->input_system(); InputSystem* input_system = state->emulator()->input_system();
X_INPUT_STATE input_state; X_INPUT_STATE input_state;
X_RESULT result = input_system->GetState(user_index, input_state); X_RESULT result = input_system->GetState(user_index, input_state);
if (XSUCCEEDED(result)) { if (XSUCCEEDED(result)) {
input_state.Write(SHIM_MEM_BASE, state_ptr); if (state_ptr) {
input_state.Write(SHIM_MEM_BASE, state_ptr);
}
} }
SHIM_SET_RETURN(result); SHIM_SET_RETURN(result);
} }