From 74803ae17460f71617d96ff6e06418ec9f40f155 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Wed, 23 Oct 2013 21:47:36 -0700 Subject: [PATCH] HID system skeleton. --- src/xenia/apu/nop/nop_apu.h | 6 +-- src/xenia/emulator.cc | 12 ++++- src/xenia/emulator.h | 3 ++ src/xenia/hid/hid-private.h | 19 +++++++ src/xenia/hid/hid.cc | 60 +++++++++++++++++++++ src/xenia/hid/hid.h | 30 +++++++++++ src/xenia/hid/input_driver.cc | 22 ++++++++ src/xenia/hid/input_driver.h | 40 ++++++++++++++ src/xenia/hid/input_system.cc | 43 +++++++++++++++ src/xenia/hid/input_system.h | 53 ++++++++++++++++++ src/xenia/hid/nop/nop_hid-private.h | 31 +++++++++++ src/xenia/hid/nop/nop_hid.cc | 44 +++++++++++++++ src/xenia/hid/nop/nop_hid.h | 33 ++++++++++++ src/xenia/hid/nop/nop_input_driver.cc | 29 ++++++++++ src/xenia/hid/nop/nop_input_driver.h | 40 ++++++++++++++ src/xenia/hid/nop/sources.gypi | 10 ++++ src/xenia/hid/sources.gypi | 24 +++++++++ src/xenia/hid/xinput/sources.gypi | 10 ++++ src/xenia/hid/xinput/xinput_hid-private.h | 31 +++++++++++ src/xenia/hid/xinput/xinput_hid.cc | 44 +++++++++++++++ src/xenia/hid/xinput/xinput_hid.h | 33 ++++++++++++ src/xenia/hid/xinput/xinput_input_driver.cc | 29 ++++++++++ src/xenia/hid/xinput/xinput_input_driver.h | 40 ++++++++++++++ src/xenia/kernel/xam/xam_input.cc | 2 +- src/xenia/sources.gypi | 1 + 25 files changed, 684 insertions(+), 5 deletions(-) create mode 100644 src/xenia/hid/hid-private.h create mode 100644 src/xenia/hid/hid.cc create mode 100644 src/xenia/hid/hid.h create mode 100644 src/xenia/hid/input_driver.cc create mode 100644 src/xenia/hid/input_driver.h create mode 100644 src/xenia/hid/input_system.cc create mode 100644 src/xenia/hid/input_system.h create mode 100644 src/xenia/hid/nop/nop_hid-private.h create mode 100644 src/xenia/hid/nop/nop_hid.cc create mode 100644 src/xenia/hid/nop/nop_hid.h create mode 100644 src/xenia/hid/nop/nop_input_driver.cc create mode 100644 src/xenia/hid/nop/nop_input_driver.h create mode 100644 src/xenia/hid/nop/sources.gypi create mode 100644 src/xenia/hid/sources.gypi create mode 100644 src/xenia/hid/xinput/sources.gypi create mode 100644 src/xenia/hid/xinput/xinput_hid-private.h create mode 100644 src/xenia/hid/xinput/xinput_hid.cc create mode 100644 src/xenia/hid/xinput/xinput_hid.h create mode 100644 src/xenia/hid/xinput/xinput_input_driver.cc create mode 100644 src/xenia/hid/xinput/xinput_input_driver.h diff --git a/src/xenia/apu/nop/nop_apu.h b/src/xenia/apu/nop/nop_apu.h index e6e49f2fe..2ff51b89f 100644 --- a/src/xenia/apu/nop/nop_apu.h +++ b/src/xenia/apu/nop/nop_apu.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_GPU_NOP_NOP_H_ -#define XENIA_GPU_NOP_NOP_H_ +#ifndef XENIA_APU_NOP_NOP_APU_H_ +#define XENIA_APU_NOP_NOP_APU_H_ #include @@ -30,4 +30,4 @@ AudioSystem* Create(Emulator* emulator); } // namespace xe -#endif // XENIA_GPU_NOP_NOP_H_ +#endif // XENIA_APU_NOP_NOP_APU_H_ diff --git a/src/xenia/emulator.cc b/src/xenia/emulator.cc index 54686d4cf..638cfafa2 100644 --- a/src/xenia/emulator.cc +++ b/src/xenia/emulator.cc @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -23,6 +24,7 @@ using namespace xe::apu; using namespace xe::cpu; using namespace xe::dbg; using namespace xe::gpu; +using namespace xe::hid; using namespace xe::kernel; using namespace xe::kernel::xam; using namespace xe::kernel::xboxkrnl; @@ -32,7 +34,8 @@ using namespace xe::kernel::xboxkrnl::fs; Emulator::Emulator(const xechar_t* command_line) : memory_(0), debugger_(0), - cpu_backend_(0), processor_(0), audio_system_(0), graphics_system_(0), + cpu_backend_(0), processor_(0), + audio_system_(0), graphics_system_(0), input_system_(0), export_resolver_(0), file_system_(0), xboxkrnl_(0), xam_(0) { XEIGNORE(xestrcpy(command_line_, XECOUNT(command_line_), command_line)); @@ -46,6 +49,7 @@ Emulator::~Emulator() { delete file_system_; + delete input_system_; delete graphics_system_; delete audio_system_; delete processor_; @@ -88,6 +92,10 @@ X_STATUS Emulator::Setup() { // Initialize the GPU. graphics_system_ = xe::gpu::Create(this); XEEXPECTNOTNULL(graphics_system_); + + // Initialize the HID. + input_system_ = xe::hid::Create(this); + XEEXPECTNOTNULL(input_system_); // Setup the core components. result = processor_->Setup(); @@ -96,6 +104,8 @@ X_STATUS Emulator::Setup() { XEEXPECTZERO(result); result = graphics_system_->Setup(); XEEXPECTZERO(result); + result = input_system_->Setup(); + XEEXPECTZERO(result); // Bring up the virtual filesystem used by the kernel. file_system_ = new FileSystem(); diff --git a/src/xenia/emulator.h b/src/xenia/emulator.h index 6573a82bb..871270de6 100644 --- a/src/xenia/emulator.h +++ b/src/xenia/emulator.h @@ -21,6 +21,7 @@ XEDECLARECLASS2(xe, cpu, Backend); XEDECLARECLASS2(xe, cpu, Processor); XEDECLARECLASS2(xe, dbg, Debugger); XEDECLARECLASS2(xe, gpu, GraphicsSystem); +XEDECLARECLASS2(xe, hid, InputSystem); XEDECLARECLASS3(xe, kernel, xam, XamModule); XEDECLARECLASS3(xe, kernel, xboxkrnl, XboxkrnlModule); XEDECLARECLASS4(xe, kernel, xboxkrnl, fs, FileSystem); @@ -42,6 +43,7 @@ public: cpu::Processor* processor() const { return processor_; } apu::AudioSystem* audio_system() const { return audio_system_; } gpu::GraphicsSystem* graphics_system() const { return graphics_system_; } + hid::InputSystem* input_system() const { return input_system_; } ExportResolver* export_resolver() const { return export_resolver_; } kernel::xboxkrnl::fs::FileSystem* file_system() const { return file_system_; } @@ -62,6 +64,7 @@ private: cpu::Processor* processor_; apu::AudioSystem* audio_system_; gpu::GraphicsSystem* graphics_system_; + hid::InputSystem* input_system_; ExportResolver* export_resolver_; kernel::xboxkrnl::fs::FileSystem* file_system_; diff --git a/src/xenia/hid/hid-private.h b/src/xenia/hid/hid-private.h new file mode 100644 index 000000000..1326d7fdf --- /dev/null +++ b/src/xenia/hid/hid-private.h @@ -0,0 +1,19 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_HID_HID_PRIVATE_H_ +#define XENIA_HID_HID_PRIVATE_H_ + +#include + + +DECLARE_string(hid); + + +#endif // XENIA_HID_HID_PRIVATE_H_ diff --git a/src/xenia/hid/hid.cc b/src/xenia/hid/hid.cc new file mode 100644 index 000000000..f55fc3735 --- /dev/null +++ b/src/xenia/hid/hid.cc @@ -0,0 +1,60 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include +#include + + + +using namespace xe; +using namespace xe::hid; + + +DEFINE_string(hid, "any", + "Input system. Use: [any, nop, xinput]"); + + +#include +#if XE_PLATFORM(WIN32) +#include +#endif // WIN32 + + +InputSystem* xe::hid::Create(Emulator* emulator) { + //return xe::hid::nop::Create(emulator); + InputSystem* input_system = new InputSystem(emulator); + + if (FLAGS_hid.compare("nop") == 0) { + input_system->AddDriver(xe::hid::nop::Create(input_system)); +#if XE_PLATFORM(WIN32) + } else if (FLAGS_hid.compare("xinput") == 0) { + input_system->AddDriver(xe::hid::xinput::Create(input_system)); +#endif // WIN32 + } else { + // Create all available. + bool any_created = false; + + // NOTE: in any mode we create as many as we can, falling back to nop. + +#if XE_PLATFORM(WIN32) + InputDriver* xinput_driver = xe::hid::xinput::Create(input_system); + if (xinput_driver) { + input_system->AddDriver(xinput_driver); + any_created = true; + } +#endif // WIN32 + + // Fallback to nop if none created. + if (!any_created) { + input_system->AddDriver(xe::hid::nop::Create(input_system)); + } + } + + return input_system; +} diff --git a/src/xenia/hid/hid.h b/src/xenia/hid/hid.h new file mode 100644 index 000000000..cd3fe887a --- /dev/null +++ b/src/xenia/hid/hid.h @@ -0,0 +1,30 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_HID_HID_H_ +#define XENIA_HID_HID_H_ + +#include + + +XEDECLARECLASS1(xe, Emulator); + + +namespace xe { +namespace hid { + + +InputSystem* Create(Emulator* emulator); + + +} // namespace hid +} // namespace xe + + +#endif // XENIA_HID_HID_H_ diff --git a/src/xenia/hid/input_driver.cc b/src/xenia/hid/input_driver.cc new file mode 100644 index 000000000..fb6474c6f --- /dev/null +++ b/src/xenia/hid/input_driver.cc @@ -0,0 +1,22 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include + + +using namespace xe; +using namespace xe::hid; + + +InputDriver::InputDriver(InputSystem* input_system) : + input_system_(input_system) { +} + +InputDriver::~InputDriver() { +} diff --git a/src/xenia/hid/input_driver.h b/src/xenia/hid/input_driver.h new file mode 100644 index 000000000..15c0f24a1 --- /dev/null +++ b/src/xenia/hid/input_driver.h @@ -0,0 +1,40 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_HID_INPUT_DRIVER_H_ +#define XENIA_HID_INPUT_DRIVER_H_ + +#include +#include + + +namespace xe { +namespace hid { + +class InputSystem; + + +class InputDriver { +public: + virtual ~InputDriver(); + + virtual X_STATUS Setup() = 0; + +protected: + InputDriver(InputSystem* input_system); + + InputSystem* input_system_; +}; + + +} // namespace hid +} // namespace xe + + +#endif // XENIA_HID_INPUT_DRIVER_H_ diff --git a/src/xenia/hid/input_system.cc b/src/xenia/hid/input_system.cc new file mode 100644 index 000000000..50c9afed8 --- /dev/null +++ b/src/xenia/hid/input_system.cc @@ -0,0 +1,43 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include + +#include +#include +#include + + +using namespace xe; +using namespace xe::hid; + + +InputSystem::InputSystem(Emulator* emulator) : + emulator_(emulator) { + memory_ = xe_memory_retain(emulator->memory()); +} + +InputSystem::~InputSystem() { + for (std::vector::iterator it = drivers_.begin(); + it != drivers_.end(); ++it) { + InputDriver* driver = *it; + delete driver; + } + xe_memory_release(memory_); +} + +X_STATUS InputSystem::Setup() { + processor_ = emulator_->processor(); + + return X_STATUS_SUCCESS; +} + +void InputSystem::AddDriver(InputDriver* driver) { + drivers_.push_back(driver); +} diff --git a/src/xenia/hid/input_system.h b/src/xenia/hid/input_system.h new file mode 100644 index 000000000..179f51949 --- /dev/null +++ b/src/xenia/hid/input_system.h @@ -0,0 +1,53 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_HID_INPUT_SYSTEM_H_ +#define XENIA_HID_INPUT_SYSTEM_H_ + +#include +#include + + +XEDECLARECLASS1(xe, Emulator); +XEDECLARECLASS2(xe, cpu, Processor); + + +namespace xe { +namespace hid { + +class InputDriver; + + +class InputSystem { +public: + InputSystem(Emulator* emulator); + ~InputSystem(); + + Emulator* emulator() const { return emulator_; } + xe_memory_ref memory() const { return memory_; } + cpu::Processor* processor() const { return processor_; } + + X_STATUS Setup(); + + void AddDriver(InputDriver* driver); + +private: + Emulator* emulator_; + xe_memory_ref memory_; + cpu::Processor* processor_; + + std::vector drivers_; +}; + + +} // namespace hid +} // namespace xe + + +#endif // XENIA_HID_INPUT_SYSTEM_H_ diff --git a/src/xenia/hid/nop/nop_hid-private.h b/src/xenia/hid/nop/nop_hid-private.h new file mode 100644 index 000000000..4fbb1b662 --- /dev/null +++ b/src/xenia/hid/nop/nop_hid-private.h @@ -0,0 +1,31 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_HID_NOP_NOP_HID_PRIVATE_H_ +#define XENIA_HID_NOP_NOP_HID_PRIVATE_H_ + +#include + +#include + + +namespace xe { +namespace hid { +namespace nop { + + + + + +} // namespace nop +} // namespace hid +} // namespace xe + + +#endif // XENIA_HID_NOP_NOP_HID_PRIVATE_H_ diff --git a/src/xenia/hid/nop/nop_hid.cc b/src/xenia/hid/nop/nop_hid.cc new file mode 100644 index 000000000..1d17c23e5 --- /dev/null +++ b/src/xenia/hid/nop/nop_hid.cc @@ -0,0 +1,44 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include + +#include + + +using namespace xe; +using namespace xe::hid; +using namespace xe::hid::nop; + + +namespace { + void InitializeIfNeeded(); + void CleanupOnShutdown(); + + void InitializeIfNeeded() { + static bool has_initialized = false; + if (has_initialized) { + return; + } + has_initialized = true; + + // + + atexit(CleanupOnShutdown); + } + + void CleanupOnShutdown() { + } +} + + +InputDriver* xe::hid::nop::Create(InputSystem* input_system) { + InitializeIfNeeded(); + return new NopInputDriver(input_system); +} diff --git a/src/xenia/hid/nop/nop_hid.h b/src/xenia/hid/nop/nop_hid.h new file mode 100644 index 000000000..79b461566 --- /dev/null +++ b/src/xenia/hid/nop/nop_hid.h @@ -0,0 +1,33 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_HID_NOP_NOP_HID_H_ +#define XENIA_HID_NOP_NOP_HID_H_ + +#include + + +XEDECLARECLASS2(xe, hid, InputDriver); +XEDECLARECLASS2(xe, hid, InputSystem); + + +namespace xe { +namespace hid { +namespace nop { + + +InputDriver* Create(InputSystem* input_system); + + +} // namespace nop +} // namespace hid +} // namespace xe + + +#endif // XENIA_HID_NOP_NOP_HID_H_ diff --git a/src/xenia/hid/nop/nop_input_driver.cc b/src/xenia/hid/nop/nop_input_driver.cc new file mode 100644 index 000000000..1fde3ad7e --- /dev/null +++ b/src/xenia/hid/nop/nop_input_driver.cc @@ -0,0 +1,29 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include + +#include + + +using namespace xe; +using namespace xe::hid; +using namespace xe::hid::nop; + + +NopInputDriver::NopInputDriver(InputSystem* input_system) : + InputDriver(input_system) { +} + +NopInputDriver::~NopInputDriver() { +} + +X_STATUS NopInputDriver::Setup() { + return X_STATUS_SUCCESS; +} diff --git a/src/xenia/hid/nop/nop_input_driver.h b/src/xenia/hid/nop/nop_input_driver.h new file mode 100644 index 000000000..2dd78e312 --- /dev/null +++ b/src/xenia/hid/nop/nop_input_driver.h @@ -0,0 +1,40 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_HID_NOP_NOP_INPUT_DRIVER_H_ +#define XENIA_HID_NOP_NOP_INPUT_DRIVER_H_ + +#include + +#include +#include + + +namespace xe { +namespace hid { +namespace nop { + + +class NopInputDriver : public InputDriver { +public: + NopInputDriver(InputSystem* input_system); + virtual ~NopInputDriver(); + + virtual X_STATUS Setup(); + +protected: +}; + + +} // namespace nop +} // namespace hid +} // namespace xe + + +#endif // XENIA_HID_NOP_NOP_INPUT_DRIVER_H_ diff --git a/src/xenia/hid/nop/sources.gypi b/src/xenia/hid/nop/sources.gypi new file mode 100644 index 000000000..92497b41d --- /dev/null +++ b/src/xenia/hid/nop/sources.gypi @@ -0,0 +1,10 @@ +# Copyright 2013 Ben Vanik. All Rights Reserved. +{ + 'sources': [ + 'nop_hid-private.h', + 'nop_hid.cc', + 'nop_hid.h', + 'nop_input_driver.cc', + 'nop_input_driver.h', + ], +} diff --git a/src/xenia/hid/sources.gypi b/src/xenia/hid/sources.gypi new file mode 100644 index 000000000..e166ec3f0 --- /dev/null +++ b/src/xenia/hid/sources.gypi @@ -0,0 +1,24 @@ +# Copyright 2013 Ben Vanik. All Rights Reserved. +{ + 'sources': [ + 'hid-private.h', + 'hid.cc', + 'hid.h', + 'input_driver.cc', + 'input_driver.h', + 'input_system.cc', + 'input_system.h', + ], + + 'includes': [ + 'nop/sources.gypi', + ], + + 'conditions': [ + ['OS == "win"', { + 'includes': [ + 'xinput/sources.gypi', + ], + }], + ], +} diff --git a/src/xenia/hid/xinput/sources.gypi b/src/xenia/hid/xinput/sources.gypi new file mode 100644 index 000000000..e4801bdf0 --- /dev/null +++ b/src/xenia/hid/xinput/sources.gypi @@ -0,0 +1,10 @@ +# Copyright 2013 Ben Vanik. All Rights Reserved. +{ + 'sources': [ + 'xinput_hid-private.h', + 'xinput_hid.cc', + 'xinput_hid.h', + 'xinput_input_driver.cc', + 'xinput_input_driver.h', + ], +} diff --git a/src/xenia/hid/xinput/xinput_hid-private.h b/src/xenia/hid/xinput/xinput_hid-private.h new file mode 100644 index 000000000..264fbfd37 --- /dev/null +++ b/src/xenia/hid/xinput/xinput_hid-private.h @@ -0,0 +1,31 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_HID_XINPUT_XINPUT_HID_PRIVATE_H_ +#define XENIA_HID_XINPUT_XINPUT_HID_PRIVATE_H_ + +#include + +#include + + +namespace xe { +namespace hid { +namespace xinput { + + + + + +} // namespace xinput +} // namespace hid +} // namespace xe + + +#endif // XENIA_HID_XINPUT_XINPUT_HID_PRIVATE_H_ diff --git a/src/xenia/hid/xinput/xinput_hid.cc b/src/xenia/hid/xinput/xinput_hid.cc new file mode 100644 index 000000000..960242765 --- /dev/null +++ b/src/xenia/hid/xinput/xinput_hid.cc @@ -0,0 +1,44 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include + +#include + + +using namespace xe; +using namespace xe::hid; +using namespace xe::hid::xinput; + + +namespace { + void InitializeIfNeeded(); + void CleanupOnShutdown(); + + void InitializeIfNeeded() { + static bool has_initialized = false; + if (has_initialized) { + return; + } + has_initialized = true; + + // + + atexit(CleanupOnShutdown); + } + + void CleanupOnShutdown() { + } +} + + +InputDriver* xe::hid::xinput::Create(InputSystem* input_system) { + InitializeIfNeeded(); + return new XInputInputDriver(input_system); +} diff --git a/src/xenia/hid/xinput/xinput_hid.h b/src/xenia/hid/xinput/xinput_hid.h new file mode 100644 index 000000000..a1522d830 --- /dev/null +++ b/src/xenia/hid/xinput/xinput_hid.h @@ -0,0 +1,33 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_HID_XINPUT_XINPUT_HID_H_ +#define XENIA_HID_XINPUT_XINPUT_HID_H_ + +#include + + +XEDECLARECLASS2(xe, hid, InputDriver); +XEDECLARECLASS2(xe, hid, InputSystem); + + +namespace xe { +namespace hid { +namespace xinput { + + +InputDriver* Create(InputSystem* input_system); + + +} // namespace xinput +} // namespace hid +} // namespace xe + + +#endif // XENIA_HID_XINPUT_XINPUT_HID_H_ diff --git a/src/xenia/hid/xinput/xinput_input_driver.cc b/src/xenia/hid/xinput/xinput_input_driver.cc new file mode 100644 index 000000000..bb7625c67 --- /dev/null +++ b/src/xenia/hid/xinput/xinput_input_driver.cc @@ -0,0 +1,29 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include + +#include + + +using namespace xe; +using namespace xe::hid; +using namespace xe::hid::xinput; + + +XInputInputDriver::XInputInputDriver(InputSystem* input_system) : + InputDriver(input_system) { +} + +XInputInputDriver::~XInputInputDriver() { +} + +X_STATUS XInputInputDriver::Setup() { + return X_STATUS_SUCCESS; +} diff --git a/src/xenia/hid/xinput/xinput_input_driver.h b/src/xenia/hid/xinput/xinput_input_driver.h new file mode 100644 index 000000000..5c2fb4056 --- /dev/null +++ b/src/xenia/hid/xinput/xinput_input_driver.h @@ -0,0 +1,40 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_HID_XINPUT_XINPUT_DRIVER_H_ +#define XENIA_HID_XINPUT_XINPUT_DRIVER_H_ + +#include + +#include +#include + + +namespace xe { +namespace hid { +namespace xinput { + + +class XInputInputDriver : public InputDriver { +public: + XInputInputDriver(InputSystem* input_system); + virtual ~XInputInputDriver(); + + virtual X_STATUS Setup(); + +protected: +}; + + +} // namespace xinput +} // namespace hid +} // namespace xe + + +#endif // XENIA_HID_XINPUT_XINPUT_DRIVER_H_ diff --git a/src/xenia/kernel/xam/xam_input.cc b/src/xenia/kernel/xam/xam_input.cc index 8740abe18..046440a6e 100644 --- a/src/xenia/kernel/xam/xam_input.cc +++ b/src/xenia/kernel/xam/xam_input.cc @@ -80,7 +80,7 @@ SHIM_CALL XamInputSetState_shim( void xe::kernel::xam::RegisterInputExports( ExportResolver* export_resolver, XamState* state) { - SHIM_SET_MAPPING("xam.exe", XamInputGetCapabilities, state); + SHIM_SET_MAPPING("xam.xex", XamInputGetCapabilities, state); SHIM_SET_MAPPING("xam.xex", XamInputGetState, state); SHIM_SET_MAPPING("xam.xex", XamInputSetState, state); } diff --git a/src/xenia/sources.gypi b/src/xenia/sources.gypi index 4977a09f6..1f24ca16f 100644 --- a/src/xenia/sources.gypi +++ b/src/xenia/sources.gypi @@ -33,6 +33,7 @@ 'cpu/sources.gypi', 'dbg/sources.gypi', 'gpu/sources.gypi', + 'hid/sources.gypi', 'kernel/sources.gypi', ], }