mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-24 19:41:04 +00:00
Review Changes 10
This commit is contained in:
parent
ae7c967941
commit
a8f3b1739d
@ -75,6 +75,7 @@ enum class Class : ClassType {
|
|||||||
Render_Software, ///< Software renderer backend
|
Render_Software, ///< Software renderer backend
|
||||||
Render_OpenGL, ///< OpenGL backend
|
Render_OpenGL, ///< OpenGL backend
|
||||||
Loader, ///< ROM loader
|
Loader, ///< ROM loader
|
||||||
|
Input, ///< User input system
|
||||||
|
|
||||||
Count ///< Total number of logging classes
|
Count ///< Total number of logging classes
|
||||||
};
|
};
|
||||||
|
@ -24,7 +24,7 @@ void Init(EmuWindow* emu_window) {
|
|||||||
Kernel::Init();
|
Kernel::Init();
|
||||||
HLE::Init();
|
HLE::Init();
|
||||||
VideoCore::Init(emu_window);
|
VideoCore::Init(emu_window);
|
||||||
InputCommon::Init(InputCommon::SDL2);
|
InputCommon::Init(InputCommon::ControllerBackends::SDL2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shutdown() {
|
void Shutdown() {
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
namespace InputCommon {
|
namespace InputCommon {
|
||||||
|
|
||||||
// Set to nullptr until initialized by a backend
|
// Set to nullptr until initialized by a backend
|
||||||
ControllerBase* g_user_input = nullptr;
|
InputBase* g_user_input = nullptr;
|
||||||
|
|
||||||
// Event id for CoreTiming
|
// Event id for CoreTiming
|
||||||
static int input_event;
|
static int input_event;
|
||||||
@ -32,11 +32,11 @@ static void InputCallback(u64 userdata, int cycles_late) {
|
|||||||
CoreTiming::ScheduleEvent(frame_ticks - cycles_late, input_event);
|
CoreTiming::ScheduleEvent(frame_ticks - cycles_late, input_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ControllerBase::GetDeviceName() const {
|
std::string InputBase::GetDeviceName() const {
|
||||||
return device_name;
|
return device_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
Service::HID::PadState ControllerBase::GetPadState() const {
|
Service::HID::PadState InputBase::GetPadState() const {
|
||||||
return controller.pad_state;
|
return controller.pad_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,17 +44,18 @@ void Init(ControllerBackends backend) {
|
|||||||
switch (backend) {
|
switch (backend) {
|
||||||
#ifdef HAS_SDL
|
#ifdef HAS_SDL
|
||||||
// SDL2 backend selected
|
// SDL2 backend selected
|
||||||
case SDL2:
|
case ControllerBackends::SDL2:
|
||||||
g_user_input = new SDLController();
|
g_user_input = new SDLController();
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// No backend selected
|
// No backend selected
|
||||||
case NONE:
|
case ControllerBackends::NONE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// What?
|
// If no backend whatsoever inits, launch a critical log
|
||||||
default:
|
default:
|
||||||
|
LOG_CRITICAL(Input, "Input backend initialization failed!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,15 +10,15 @@
|
|||||||
namespace InputCommon {
|
namespace InputCommon {
|
||||||
|
|
||||||
/// Enum defining available backends
|
/// Enum defining available backends
|
||||||
enum ControllerBackends {
|
enum class ControllerBackends {
|
||||||
NONE,
|
NONE,
|
||||||
SDL2
|
SDL2
|
||||||
};
|
};
|
||||||
|
|
||||||
class ControllerBase {
|
class InputBase {
|
||||||
public:
|
public:
|
||||||
ControllerBase() {}
|
InputBase() {}
|
||||||
virtual ~ControllerBase() {}
|
virtual ~InputBase() {}
|
||||||
|
|
||||||
/// Initializes input based on specific backends
|
/// Initializes input based on specific backends
|
||||||
virtual bool Init() = 0;
|
virtual bool Init() = 0;
|
||||||
@ -55,6 +55,6 @@ void Init(ControllerBackends backend);
|
|||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
/// InputCommon 'plugin'
|
/// InputCommon 'plugin'
|
||||||
extern ControllerBase* g_user_input;
|
extern InputBase* g_user_input;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
namespace InputCommon {
|
namespace InputCommon {
|
||||||
|
|
||||||
class SDLController final : public ControllerBase {
|
class SDLController final : public InputBase {
|
||||||
public:
|
public:
|
||||||
SDLController();
|
SDLController();
|
||||||
~SDLController();
|
~SDLController();
|
||||||
|
Loading…
Reference in New Issue
Block a user