Validate arguments on input.
This commit is contained in:
@@ -40,14 +40,17 @@ SHIM_CALL XamInputGetCapabilities_shim(
|
||||
flags,
|
||||
caps_ptr);
|
||||
|
||||
if (!caps_ptr) {
|
||||
SHIM_SET_RETURN(X_ERROR_BAD_ARGUMENTS);
|
||||
return;
|
||||
}
|
||||
|
||||
InputSystem* input_system = state->emulator()->input_system();
|
||||
|
||||
X_INPUT_CAPABILITIES caps;
|
||||
XRESULT result = input_system->GetCapabilities(user_index, flags, caps);
|
||||
if (XSUCCEEDED(result)) {
|
||||
if (caps_ptr) {
|
||||
caps.Write(SHIM_MEM_BASE, caps_ptr);
|
||||
}
|
||||
caps.Write(SHIM_MEM_BASE, caps_ptr);
|
||||
}
|
||||
SHIM_SET_RETURN(result);
|
||||
}
|
||||
@@ -64,14 +67,17 @@ SHIM_CALL XamInputGetState_shim(
|
||||
user_index,
|
||||
state_ptr);
|
||||
|
||||
if (!state_ptr) {
|
||||
SHIM_SET_RETURN(X_ERROR_BAD_ARGUMENTS);
|
||||
return;
|
||||
}
|
||||
|
||||
InputSystem* input_system = state->emulator()->input_system();
|
||||
|
||||
X_INPUT_STATE input_state;
|
||||
XRESULT result = input_system->GetState(user_index, input_state);
|
||||
if (XSUCCEEDED(result)) {
|
||||
if (state_ptr) {
|
||||
input_state.Write(SHIM_MEM_BASE, state_ptr);
|
||||
}
|
||||
input_state.Write(SHIM_MEM_BASE, state_ptr);
|
||||
}
|
||||
SHIM_SET_RETURN(result);
|
||||
}
|
||||
@@ -88,12 +94,14 @@ SHIM_CALL XamInputSetState_shim(
|
||||
user_index,
|
||||
vibration_ptr);
|
||||
|
||||
if (!vibration_ptr) {
|
||||
SHIM_SET_RETURN(X_ERROR_BAD_ARGUMENTS);
|
||||
return;
|
||||
}
|
||||
|
||||
InputSystem* input_system = state->emulator()->input_system();
|
||||
|
||||
X_INPUT_VIBRATION vibration;
|
||||
if (vibration_ptr) {
|
||||
vibration.Read(SHIM_MEM_BASE, vibration_ptr);
|
||||
}
|
||||
X_INPUT_VIBRATION vibration(SHIM_MEM_BASE, vibration_ptr);
|
||||
XRESULT result = input_system->SetState(user_index, vibration);
|
||||
SHIM_SET_RETURN(result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user