HID system skeleton.
This commit is contained in:
parent
20bd15e7fe
commit
74803ae174
|
@ -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 <xenia/core.h>
|
||||
|
||||
|
@ -30,4 +30,4 @@ AudioSystem* Create(Emulator* emulator);
|
|||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_GPU_NOP_NOP_H_
|
||||
#endif // XENIA_APU_NOP_NOP_APU_H_
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <xenia/cpu/cpu.h>
|
||||
#include <xenia/dbg/debugger.h>
|
||||
#include <xenia/gpu/gpu.h>
|
||||
#include <xenia/hid/hid.h>
|
||||
#include <xenia/kernel/kernel.h>
|
||||
#include <xenia/kernel/modules.h>
|
||||
#include <xenia/kernel/xboxkrnl/fs/filesystem.h>
|
||||
|
@ -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();
|
||||
|
|
|
@ -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_;
|
||||
|
|
|
@ -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 <gflags/gflags.h>
|
||||
|
||||
|
||||
DECLARE_string(hid);
|
||||
|
||||
|
||||
#endif // XENIA_HID_HID_PRIVATE_H_
|
|
@ -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 <xenia/hid/hid.h>
|
||||
#include <xenia/hid/hid-private.h>
|
||||
|
||||
|
||||
|
||||
using namespace xe;
|
||||
using namespace xe::hid;
|
||||
|
||||
|
||||
DEFINE_string(hid, "any",
|
||||
"Input system. Use: [any, nop, xinput]");
|
||||
|
||||
|
||||
#include <xenia/hid/nop/nop_hid.h>
|
||||
#if XE_PLATFORM(WIN32)
|
||||
#include <xenia/hid/xinput/xinput_hid.h>
|
||||
#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;
|
||||
}
|
|
@ -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 <xenia/hid/input_system.h>
|
||||
|
||||
|
||||
XEDECLARECLASS1(xe, Emulator);
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace hid {
|
||||
|
||||
|
||||
InputSystem* Create(Emulator* emulator);
|
||||
|
||||
|
||||
} // namespace hid
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_HID_HID_H_
|
|
@ -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 <xenia/hid/input_driver.h>
|
||||
|
||||
|
||||
using namespace xe;
|
||||
using namespace xe::hid;
|
||||
|
||||
|
||||
InputDriver::InputDriver(InputSystem* input_system) :
|
||||
input_system_(input_system) {
|
||||
}
|
||||
|
||||
InputDriver::~InputDriver() {
|
||||
}
|
|
@ -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 <xenia/core.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
|
||||
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_
|
|
@ -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 <xenia/hid/input_system.h>
|
||||
|
||||
#include <xenia/emulator.h>
|
||||
#include <xenia/cpu/processor.h>
|
||||
#include <xenia/hid/input_driver.h>
|
||||
|
||||
|
||||
using namespace xe;
|
||||
using namespace xe::hid;
|
||||
|
||||
|
||||
InputSystem::InputSystem(Emulator* emulator) :
|
||||
emulator_(emulator) {
|
||||
memory_ = xe_memory_retain(emulator->memory());
|
||||
}
|
||||
|
||||
InputSystem::~InputSystem() {
|
||||
for (std::vector<InputDriver*>::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);
|
||||
}
|
|
@ -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 <xenia/core.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
|
||||
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<InputDriver*> drivers_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace hid
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_HID_INPUT_SYSTEM_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 <xenia/core.h>
|
||||
|
||||
#include <xenia/hid/nop/nop_hid.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace hid {
|
||||
namespace nop {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace nop
|
||||
} // namespace hid
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_HID_NOP_NOP_HID_PRIVATE_H_
|
|
@ -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 <xenia/hid/nop/nop_hid.h>
|
||||
|
||||
#include <xenia/hid/nop/nop_input_driver.h>
|
||||
|
||||
|
||||
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);
|
||||
}
|
|
@ -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 <xenia/core.h>
|
||||
|
||||
|
||||
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_
|
|
@ -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 <xenia/hid/nop/nop_input_driver.h>
|
||||
|
||||
#include <xenia/hid/hid-private.h>
|
||||
|
||||
|
||||
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;
|
||||
}
|
|
@ -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 <xenia/core.h>
|
||||
|
||||
#include <xenia/hid/input_driver.h>
|
||||
#include <xenia/hid/nop/nop_hid-private.h>
|
||||
|
||||
|
||||
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_
|
|
@ -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',
|
||||
],
|
||||
}
|
|
@ -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',
|
||||
],
|
||||
}],
|
||||
],
|
||||
}
|
|
@ -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',
|
||||
],
|
||||
}
|
|
@ -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 <xenia/core.h>
|
||||
|
||||
#include <xenia/hid/xinput/xinput_hid.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace hid {
|
||||
namespace xinput {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace xinput
|
||||
} // namespace hid
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_HID_XINPUT_XINPUT_HID_PRIVATE_H_
|
|
@ -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 <xenia/hid/xinput/xinput_hid.h>
|
||||
|
||||
#include <xenia/hid/xinput/xinput_input_driver.h>
|
||||
|
||||
|
||||
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);
|
||||
}
|
|
@ -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 <xenia/core.h>
|
||||
|
||||
|
||||
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_
|
|
@ -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 <xenia/hid/xinput/xinput_input_driver.h>
|
||||
|
||||
#include <xenia/hid/hid-private.h>
|
||||
|
||||
|
||||
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;
|
||||
}
|
|
@ -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 <xenia/core.h>
|
||||
|
||||
#include <xenia/hid/input_driver.h>
|
||||
#include <xenia/hid/nop/nop_hid-private.h>
|
||||
|
||||
|
||||
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_
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
'cpu/sources.gypi',
|
||||
'dbg/sources.gypi',
|
||||
'gpu/sources.gypi',
|
||||
'hid/sources.gypi',
|
||||
'kernel/sources.gypi',
|
||||
],
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue