input_common: Eliminate most global state

Abstracts most of the input mechanisms under an InputSubsystem class
that is managed by the frontends, eliminating any static constructors
and destructors. This gets rid of global accessor functions and also
allows the frontends to have a more fine-grained control over the
lifecycle of the input subsystem.

This also makes it explicit which interfaces rely on the input subsystem
instead of making it opaque in the interface functions. All that remains
to migrate over is the factories, which can be done in a separate
change.
This commit is contained in:
Lioncash 2020-08-27 15:16:47 -04:00
parent 3db9a25977
commit 9e1b0af259
25 changed files with 397 additions and 243 deletions

View file

@ -14,9 +14,14 @@ namespace Core {
class System;
}
namespace InputCommon {
class InputSubsystem;
}
class EmuWindow_SDL2 : public Core::Frontend::EmuWindow {
public:
explicit EmuWindow_SDL2(Core::System& system, bool fullscreen);
explicit EmuWindow_SDL2(Core::System& system, bool fullscreen,
InputCommon::InputSubsystem* input_subsystem);
~EmuWindow_SDL2();
/// Polls window events
@ -76,4 +81,7 @@ protected:
/// Keeps track of how often to update the title bar during gameplay
u32 last_time = 0;
/// Input subsystem to use with this window.
InputCommon::InputSubsystem* input_subsystem;
};