parent
883126d497
commit
b38bf5c132
|
@ -392,7 +392,6 @@
|
|||
<ClInclude Include="src\xenia\gpu\ucode_disassembler.h" />
|
||||
<ClInclude Include="src\xenia\gpu\xenos.h" />
|
||||
<ClInclude Include="src\xenia\hid\hid-private.h" />
|
||||
<ClInclude Include="src\xenia\hid\hid.h" />
|
||||
<ClInclude Include="src\xenia\hid\input_driver.h" />
|
||||
<ClInclude Include="src\xenia\hid\input_system.h" />
|
||||
<ClInclude Include="src\xenia\hid\nop\nop_hid-private.h" />
|
||||
|
|
|
@ -1125,9 +1125,6 @@
|
|||
<ClInclude Include="src\xenia\gpu\gl4\gl4_shader_translator.h">
|
||||
<Filter>src\xenia\gpu\gl4</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\xenia\hid\hid.h">
|
||||
<Filter>src\xenia\hid</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\xenia\hid\hid-private.h">
|
||||
<Filter>src\xenia\hid</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "xenia/base/clock.h"
|
||||
#include "xenia/base/string.h"
|
||||
#include "xenia/gpu/graphics_system.h"
|
||||
#include "xenia/hid/hid.h"
|
||||
#include "xenia/hid/input_system.h"
|
||||
#include "xenia/kernel/kernel.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/modules.h"
|
||||
|
@ -127,7 +127,7 @@ X_STATUS Emulator::Setup() {
|
|||
}
|
||||
|
||||
// Initialize the HID.
|
||||
input_system_ = std::move(xe::hid::Create(this));
|
||||
input_system_ = std::move(xe::hid::InputSystem::Create(this));
|
||||
if (!input_system_) {
|
||||
return X_STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
|
@ -7,57 +7,6 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/hid/hid.h"
|
||||
#include "xenia/hid/hid-private.h"
|
||||
#include "xenia/hid/input_driver.h"
|
||||
|
||||
using namespace xe;
|
||||
using namespace xe::hid;
|
||||
|
||||
DEFINE_string(hid, "any", "Input system. Use: [any, nop, winkey, xinput]");
|
||||
|
||||
#include "xenia/hid/nop/nop_hid.h"
|
||||
#if XE_PLATFORM_WIN32
|
||||
#include "xenia/hid/winkey/winkey_hid.h"
|
||||
#include "xenia/hid/xinput/xinput_hid.h"
|
||||
#endif // WIN32
|
||||
|
||||
std::unique_ptr<InputSystem> xe::hid::Create(Emulator* emulator) {
|
||||
std::unique_ptr<InputSystem> input_system =
|
||||
std::make_unique<InputSystem>(emulator);
|
||||
|
||||
if (FLAGS_hid.compare("nop") == 0) {
|
||||
input_system->AddDriver(xe::hid::nop::Create(input_system.get()));
|
||||
#if XE_PLATFORM_WIN32
|
||||
} else if (FLAGS_hid.compare("winkey") == 0) {
|
||||
input_system->AddDriver(xe::hid::winkey::Create(input_system.get()));
|
||||
} else if (FLAGS_hid.compare("xinput") == 0) {
|
||||
input_system->AddDriver(xe::hid::xinput::Create(input_system.get()));
|
||||
#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
|
||||
auto xinput_driver = xe::hid::xinput::Create(input_system.get());
|
||||
if (xinput_driver) {
|
||||
input_system->AddDriver(std::move(xinput_driver));
|
||||
any_created = true;
|
||||
}
|
||||
auto winkey_driver = xe::hid::winkey::Create(input_system.get());
|
||||
if (winkey_driver) {
|
||||
input_system->AddDriver(std::move(winkey_driver));
|
||||
any_created = true;
|
||||
}
|
||||
#endif // WIN32
|
||||
|
||||
// Fallback to nop if none created.
|
||||
if (!any_created) {
|
||||
input_system->AddDriver(xe::hid::nop::Create(input_system.get()));
|
||||
}
|
||||
}
|
||||
|
||||
return input_system;
|
||||
}
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* 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 <memory>
|
||||
|
||||
#include "xenia/hid/input_system.h"
|
||||
|
||||
namespace xe {
|
||||
class Emulator;
|
||||
} // namespace xe
|
||||
|
||||
namespace xe {
|
||||
namespace hid {
|
||||
|
||||
std::unique_ptr<InputSystem> Create(Emulator* emulator);
|
||||
|
||||
} // namespace hid
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_HID_HID_H_
|
|
@ -12,11 +12,57 @@
|
|||
#include "xenia/emulator.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/hid/input_driver.h"
|
||||
#include "xenia/hid/hid-private.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
#include "xenia/hid/nop/nop_hid.h"
|
||||
#if XE_PLATFORM_WIN32
|
||||
#include "xenia/hid/winkey/winkey_hid.h"
|
||||
#include "xenia/hid/xinput/xinput_hid.h"
|
||||
#endif // WIN32
|
||||
|
||||
namespace xe {
|
||||
namespace hid {
|
||||
|
||||
std::unique_ptr<InputSystem> InputSystem::Create(Emulator* emulator) {
|
||||
auto input_system = std::make_unique<InputSystem>(emulator);
|
||||
|
||||
if (FLAGS_hid.compare("nop") == 0) {
|
||||
input_system->AddDriver(xe::hid::nop::Create(input_system.get()));
|
||||
#if XE_PLATFORM_WIN32
|
||||
} else if (FLAGS_hid.compare("winkey") == 0) {
|
||||
input_system->AddDriver(xe::hid::winkey::Create(input_system.get()));
|
||||
} else if (FLAGS_hid.compare("xinput") == 0) {
|
||||
input_system->AddDriver(xe::hid::xinput::Create(input_system.get()));
|
||||
#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
|
||||
auto xinput_driver = xe::hid::xinput::Create(input_system.get());
|
||||
if (xinput_driver) {
|
||||
input_system->AddDriver(std::move(xinput_driver));
|
||||
any_created = true;
|
||||
}
|
||||
auto winkey_driver = xe::hid::winkey::Create(input_system.get());
|
||||
if (winkey_driver) {
|
||||
input_system->AddDriver(std::move(winkey_driver));
|
||||
any_created = true;
|
||||
}
|
||||
#endif // WIN32
|
||||
|
||||
// Fallback to nop if none created.
|
||||
if (!any_created) {
|
||||
input_system->AddDriver(xe::hid::nop::Create(input_system.get()));
|
||||
}
|
||||
}
|
||||
|
||||
return input_system;
|
||||
}
|
||||
|
||||
InputSystem::InputSystem(Emulator* emulator)
|
||||
: emulator_(emulator), memory_(emulator->memory()) {}
|
||||
|
||||
|
|
|
@ -13,9 +13,14 @@
|
|||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/memory.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
class Emulator;
|
||||
} // namespace xe
|
||||
|
||||
namespace xe {
|
||||
namespace hid {
|
||||
|
||||
|
@ -26,6 +31,8 @@ class InputSystem {
|
|||
InputSystem(Emulator* emulator);
|
||||
~InputSystem();
|
||||
|
||||
static std::unique_ptr<InputSystem> Create(Emulator* emulator);
|
||||
|
||||
Emulator* emulator() const { return emulator_; }
|
||||
Memory* memory() const { return memory_; }
|
||||
cpu::Processor* processor() const { return processor_; }
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/emulator.h"
|
||||
#include "xenia/hid/hid.h"
|
||||
#include "xenia/hid/input_system.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam_private.h"
|
||||
|
|
Loading…
Reference in New Issue