Input bouncing through to input system.

This commit is contained in:
Ben Vanik
2013-10-23 22:13:05 -07:00
parent 74803ae174
commit c4fe2e6926
5 changed files with 183 additions and 7 deletions

View File

@@ -9,12 +9,15 @@
#include <xenia/kernel/xam/xam_input.h>
#include <xenia/emulator.h>
#include <xenia/hid/hid.h>
#include <xenia/kernel/shim_utils.h>
#include <xenia/kernel/xam/xam_private.h>
#include <xenia/kernel/xam/xam_state.h>
using namespace xe;
using namespace xe::hid;
using namespace xe::kernel;
using namespace xe::kernel::xam;
@@ -37,7 +40,16 @@ SHIM_CALL XamInputGetCapabilities_shim(
flags,
caps_ptr);
SHIM_SET_RETURN(X_ERROR_DEVICE_NOT_CONNECTED);
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);
}
}
SHIM_SET_RETURN(result);
}
@@ -52,7 +64,16 @@ SHIM_CALL XamInputGetState_shim(
user_index,
state_ptr);
SHIM_SET_RETURN(X_ERROR_DEVICE_NOT_CONNECTED);
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);
}
}
SHIM_SET_RETURN(result);
}
@@ -67,9 +88,14 @@ SHIM_CALL XamInputSetState_shim(
user_index,
vibration_ptr);
// or X_ERROR_BUSY
InputSystem* input_system = state->emulator()->input_system();
SHIM_SET_RETURN(X_ERROR_DEVICE_NOT_CONNECTED);
X_INPUT_VIBRATION vibration;
if (vibration_ptr) {
vibration.Read(SHIM_MEM_BASE, vibration_ptr);
}
XRESULT result = input_system->SetState(user_index, vibration);
SHIM_SET_RETURN(result);
}

View File

@@ -27,6 +27,7 @@ public:
XamState(Emulator* emulator);
~XamState();
Emulator* emulator() const { return emulator_; }
xe_memory_ref memory() const { return memory_; }
private: