From 9e1b0af25907f7a8b960aa5c1e7d931691f40196 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 27 Aug 2020 15:16:47 -0400 Subject: 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. --- src/yuzu_cmd/yuzu.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/yuzu_cmd/yuzu.cpp') diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 8efe49390..4f00c804d 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -23,12 +23,14 @@ #include "common/telemetry.h" #include "core/core.h" #include "core/crypto/key_manager.h" +#include "core/file_sys/registered_cache.h" #include "core/file_sys/vfs_real.h" #include "core/gdbstub/gdbstub.h" #include "core/hle/service/filesystem/filesystem.h" #include "core/loader/loader.h" #include "core/settings.h" #include "core/telemetry_session.h" +#include "input_common/main.h" #include "video_core/renderer_base.h" #include "yuzu_cmd/config.h" #include "yuzu_cmd/emu_window/emu_window_sdl2.h" @@ -37,8 +39,6 @@ #include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h" #endif -#include "core/file_sys/registered_cache.h" - #ifdef _WIN32 // windows.h needs to be included before shellapi.h #include @@ -179,15 +179,16 @@ int main(int argc, char** argv) { Settings::Apply(); Core::System& system{Core::System::GetInstance()}; + InputCommon::InputSubsystem input_subsystem; std::unique_ptr emu_window; switch (Settings::values.renderer_backend.GetValue()) { case Settings::RendererBackend::OpenGL: - emu_window = std::make_unique(system, fullscreen); + emu_window = std::make_unique(system, fullscreen, &input_subsystem); break; case Settings::RendererBackend::Vulkan: #ifdef HAS_VULKAN - emu_window = std::make_unique(system, fullscreen); + emu_window = std::make_unique(system, fullscreen, &input_subsystem); break; #else LOG_CRITICAL(Frontend, "Vulkan backend has not been compiled!"); -- cgit v1.2.3