Converting HID API to use be<> auto swapping type.

This commit is contained in:
Ben Vanik
2014-08-19 22:50:21 -07:00
parent 48a0e5c601
commit fb98683ed3
24 changed files with 325 additions and 518 deletions

View File

@@ -13,18 +13,14 @@
#include <xenia/cpu/processor.h>
#include <xenia/hid/input_driver.h>
namespace xe {
namespace hid {
using namespace xe;
using namespace xe::hid;
InputSystem::InputSystem(Emulator* emulator) :
emulator_(emulator), memory_(emulator->memory()) {
}
InputSystem::InputSystem(Emulator* emulator)
: emulator_(emulator), memory_(emulator->memory()) {}
InputSystem::~InputSystem() {
for (auto it = drivers_.begin();
it != drivers_.end(); ++it) {
for (auto it = drivers_.begin(); it != drivers_.end(); ++it) {
InputDriver* driver = *it;
delete driver;
}
@@ -36,12 +32,10 @@ X_STATUS InputSystem::Setup() {
return X_STATUS_SUCCESS;
}
void InputSystem::AddDriver(InputDriver* driver) {
drivers_.push_back(driver);
}
void InputSystem::AddDriver(InputDriver* driver) { drivers_.push_back(driver); }
X_RESULT InputSystem::GetCapabilities(
uint32_t user_index, uint32_t flags, X_INPUT_CAPABILITIES& out_caps) {
X_RESULT InputSystem::GetCapabilities(uint32_t user_index, uint32_t flags,
X_INPUT_CAPABILITIES* out_caps) {
SCOPE_profile_cpu_f("hid");
for (auto it = drivers_.begin(); it != drivers_.end(); ++it) {
@@ -53,7 +47,7 @@ X_RESULT InputSystem::GetCapabilities(
return X_ERROR_DEVICE_NOT_CONNECTED;
}
X_RESULT InputSystem::GetState(uint32_t user_index, X_INPUT_STATE& out_state) {
X_RESULT InputSystem::GetState(uint32_t user_index, X_INPUT_STATE* out_state) {
SCOPE_profile_cpu_f("hid");
for (auto it = drivers_.begin(); it != drivers_.end(); ++it) {
@@ -65,8 +59,8 @@ X_RESULT InputSystem::GetState(uint32_t user_index, X_INPUT_STATE& out_state) {
return X_ERROR_DEVICE_NOT_CONNECTED;
}
X_RESULT InputSystem::SetState(
uint32_t user_index, X_INPUT_VIBRATION& vibration) {
X_RESULT InputSystem::SetState(uint32_t user_index,
X_INPUT_VIBRATION* vibration) {
SCOPE_profile_cpu_f("hid");
for (auto it = drivers_.begin(); it != drivers_.end(); ++it) {
@@ -78,8 +72,8 @@ X_RESULT InputSystem::SetState(
return X_ERROR_DEVICE_NOT_CONNECTED;
}
X_RESULT InputSystem::GetKeystroke(
uint32_t user_index, uint32_t flags, X_INPUT_KEYSTROKE& out_keystroke) {
X_RESULT InputSystem::GetKeystroke(uint32_t user_index, uint32_t flags,
X_INPUT_KEYSTROKE* out_keystroke) {
SCOPE_profile_cpu_f("hid");
for (auto it = drivers_.begin(); it != drivers_.end(); ++it) {
@@ -89,4 +83,7 @@ X_RESULT InputSystem::GetKeystroke(
}
}
return X_ERROR_DEVICE_NOT_CONNECTED;
}
}
} // namespace hid
} // namespace xe