Review Changes 10

This commit is contained in:
Daniel Stuart Baxter 2015-05-31 11:11:14 -05:00
parent ae7c967941
commit a8f3b1739d
5 changed files with 15 additions and 13 deletions

View file

@ -75,6 +75,7 @@ enum class Class : ClassType {
Render_Software, ///< Software renderer backend
Render_OpenGL, ///< OpenGL backend
Loader, ///< ROM loader
Input, ///< User input system
Count ///< Total number of logging classes
};

View file

@ -24,7 +24,7 @@ void Init(EmuWindow* emu_window) {
Kernel::Init();
HLE::Init();
VideoCore::Init(emu_window);
InputCommon::Init(InputCommon::SDL2);
InputCommon::Init(InputCommon::ControllerBackends::SDL2);
}
void Shutdown() {

View file

@ -14,7 +14,7 @@
namespace InputCommon {
// Set to nullptr until initialized by a backend
ControllerBase* g_user_input = nullptr;
InputBase* g_user_input = nullptr;
// Event id for CoreTiming
static int input_event;
@ -32,11 +32,11 @@ static void InputCallback(u64 userdata, int cycles_late) {
CoreTiming::ScheduleEvent(frame_ticks - cycles_late, input_event);
}
std::string ControllerBase::GetDeviceName() const {
std::string InputBase::GetDeviceName() const {
return device_name;
}
Service::HID::PadState ControllerBase::GetPadState() const {
Service::HID::PadState InputBase::GetPadState() const {
return controller.pad_state;
}
@ -44,17 +44,18 @@ void Init(ControllerBackends backend) {
switch (backend) {
#ifdef HAS_SDL
// SDL2 backend selected
case SDL2:
case ControllerBackends::SDL2:
g_user_input = new SDLController();
break;
#endif
// No backend selected
case NONE:
case ControllerBackends::NONE:
break;
// What?
// If no backend whatsoever inits, launch a critical log
default:
LOG_CRITICAL(Input, "Input backend initialization failed!");
break;
}

View file

@ -10,15 +10,15 @@
namespace InputCommon {
/// Enum defining available backends
enum ControllerBackends {
enum class ControllerBackends {
NONE,
SDL2
};
class ControllerBase {
class InputBase {
public:
ControllerBase() {}
virtual ~ControllerBase() {}
InputBase() {}
virtual ~InputBase() {}
/// Initializes input based on specific backends
virtual bool Init() = 0;
@ -55,6 +55,6 @@ void Init(ControllerBackends backend);
void Shutdown();
/// InputCommon 'plugin'
extern ControllerBase* g_user_input;
extern InputBase* g_user_input;
} // namespace

View file

@ -10,7 +10,7 @@
namespace InputCommon {
class SDLController final : public ControllerBase {
class SDLController final : public InputBase {
public:
SDLController();
~SDLController();