diff --git a/src/duckstation-nogui/CMakeLists.txt b/src/duckstation-nogui/CMakeLists.txt index cbfad2364..3e63565d3 100644 --- a/src/duckstation-nogui/CMakeLists.txt +++ b/src/duckstation-nogui/CMakeLists.txt @@ -22,10 +22,10 @@ if(USE_DRMKMS) find_package(LIBEVDEV REQUIRED) target_sources(duckstation-nogui PRIVATE - drm_host_interface.cpp - drm_host_interface.h + vty_host_interface.cpp + vty_host_interface.h ) - target_compile_definitions(duckstation-nogui PRIVATE "-DUSE_DRMKMS=1") + target_compile_definitions(duckstation-nogui PRIVATE "-DWITH_VTY=1") target_compile_definitions(duckstation-nogui PRIVATE "-DUSE_LIBEVDEV=1") target_include_directories(duckstation-nogui PRIVATE ${LIBEVDEV_INCLUDE_DIRS}) target_link_libraries(duckstation-nogui PRIVATE ${LIBEVDEV_LIBRARIES}) diff --git a/src/duckstation-nogui/duckstation-nogui.vcxproj b/src/duckstation-nogui/duckstation-nogui.vcxproj index d5522c346..78033233b 100644 --- a/src/duckstation-nogui/duckstation-nogui.vcxproj +++ b/src/duckstation-nogui/duckstation-nogui.vcxproj @@ -68,7 +68,7 @@ - + true true true @@ -89,7 +89,7 @@ - + true true true diff --git a/src/duckstation-nogui/duckstation-nogui.vcxproj.filters b/src/duckstation-nogui/duckstation-nogui.vcxproj.filters index 553f62864..f33e4fbc0 100644 --- a/src/duckstation-nogui/duckstation-nogui.vcxproj.filters +++ b/src/duckstation-nogui/duckstation-nogui.vcxproj.filters @@ -6,7 +6,7 @@ - + @@ -15,8 +15,8 @@ - + diff --git a/src/duckstation-nogui/main.cpp b/src/duckstation-nogui/main.cpp index ecc17526c..e13d40b43 100644 --- a/src/duckstation-nogui/main.cpp +++ b/src/duckstation-nogui/main.cpp @@ -8,8 +8,8 @@ #include #include -#ifdef USE_DRMKMS -#include "drm_host_interface.h" +#ifdef WITH_VTY +#include "vty_host_interface.h" #endif #ifdef WITH_SDL2 @@ -46,9 +46,9 @@ static std::unique_ptr CreateHostInterface() host_interface = SDLHostInterface::Create(); #endif -#ifdef USE_DRMKMS - if (!host_interface && (!platform || StringUtil::Strcasecmp(platform, "drm") == 0)) - host_interface = DRMHostInterface::Create(); +#ifdef WITH_VTY + if (!host_interface && (!platform || StringUtil::Strcasecmp(platform, "vty") == 0)) + host_interface = VTYHostInterface::Create(); #endif #ifdef _WIN32 diff --git a/src/duckstation-nogui/drm_host_interface.cpp b/src/duckstation-nogui/vty_host_interface.cpp similarity index 81% rename from src/duckstation-nogui/drm_host_interface.cpp rename to src/duckstation-nogui/vty_host_interface.cpp index 3ac5daf94..7b313e943 100644 --- a/src/duckstation-nogui/drm_host_interface.cpp +++ b/src/duckstation-nogui/vty_host_interface.cpp @@ -1,4 +1,4 @@ -#include "drm_host_interface.h" +#include "vty_host_interface.h" #include "common/log.h" #include "common/string_util.h" #include "evdev_key_names.h" @@ -8,21 +8,21 @@ #include #include #include -Log_SetChannel(DRMHostInterface); +Log_SetChannel(VTYHostInterface); -DRMHostInterface::DRMHostInterface() = default; +VTYHostInterface::VTYHostInterface() = default; -DRMHostInterface::~DRMHostInterface() +VTYHostInterface::~VTYHostInterface() { CloseEVDevFDs(); } -std::unique_ptr DRMHostInterface::Create() +std::unique_ptr VTYHostInterface::Create() { - return std::make_unique(); + return std::make_unique(); } -bool DRMHostInterface::Initialize() +bool VTYHostInterface::Initialize() { if (!NoGUIHostInterface::Initialize()) return false; @@ -35,23 +35,23 @@ bool DRMHostInterface::Initialize() return true; } -void DRMHostInterface::Shutdown() +void VTYHostInterface::Shutdown() { CloseEVDevFDs(); NoGUIHostInterface::Shutdown(); } -bool DRMHostInterface::IsFullscreen() const +bool VTYHostInterface::IsFullscreen() const { return true; } -bool DRMHostInterface::SetFullscreen(bool enabled) +bool VTYHostInterface::SetFullscreen(bool enabled) { return enabled; } -void DRMHostInterface::FixIncompatibleSettings(bool display_osd_messages) +void VTYHostInterface::FixIncompatibleSettings(bool display_osd_messages) { NoGUIHostInterface::FixIncompatibleSettings(display_osd_messages); @@ -59,18 +59,18 @@ void DRMHostInterface::FixIncompatibleSettings(bool display_osd_messages) g_settings.confim_power_off = false; } -bool DRMHostInterface::CreatePlatformWindow(bool fullscreen) +bool VTYHostInterface::CreatePlatformWindow(bool fullscreen) { SetImGuiKeyMap(); return true; } -void DRMHostInterface::DestroyPlatformWindow() +void VTYHostInterface::DestroyPlatformWindow() { // nothing to destroy, it's all in the context } -std::optional DRMHostInterface::GetPlatformWindowInfo() +std::optional VTYHostInterface::GetPlatformWindowInfo() { WindowInfo wi; wi.type = WindowInfo::Type::Display; @@ -91,14 +91,14 @@ std::optional DRMHostInterface::GetPlatformWindowInfo() return wi; } -void DRMHostInterface::PollAndUpdate() +void VTYHostInterface::PollAndUpdate() { PollEvDevKeyboards(); NoGUIHostInterface::PollAndUpdate(); } -void DRMHostInterface::OpenEVDevFDs() +void VTYHostInterface::OpenEVDevFDs() { for (int i = 0; i < 1000; i++) { @@ -137,7 +137,7 @@ void DRMHostInterface::OpenEVDevFDs() } } -void DRMHostInterface::CloseEVDevFDs() +void VTYHostInterface::CloseEVDevFDs() { for (const EvDevKeyboard& kb : m_evdev_keyboards) { @@ -148,7 +148,7 @@ void DRMHostInterface::CloseEVDevFDs() m_evdev_keyboards.clear(); } -void DRMHostInterface::PollEvDevKeyboards() +void VTYHostInterface::PollEvDevKeyboards() { for (const EvDevKeyboard& kb : m_evdev_keyboards) { @@ -169,7 +169,7 @@ void DRMHostInterface::PollEvDevKeyboards() } } -void DRMHostInterface::SetImGuiKeyMap() +void VTYHostInterface::SetImGuiKeyMap() { ImGuiIO& io = ImGui::GetIO(); @@ -197,7 +197,7 @@ void DRMHostInterface::SetImGuiKeyMap() io.KeyMap[ImGuiKey_Z] = KEY_Z; } -std::optional DRMHostInterface::GetHostKeyCode(const std::string_view key_code) const +std::optional VTYHostInterface::GetHostKeyCode(const std::string_view key_code) const { std::optional kc = EvDevKeyNames::GetKeyCodeForName(key_code); if (!kc.has_value()) @@ -206,9 +206,9 @@ std::optional DRMHostInterface::GetHostKeyCode(co return static_cast(kc.value()); } -void DRMHostInterface::SIGTERMHandler(int sig) +void VTYHostInterface::SIGTERMHandler(int sig) { Log_InfoPrintf("Recieved SIGTERM"); - static_cast(g_host_interface)->m_quit_request = true; + static_cast(g_host_interface)->m_quit_request = true; signal(sig, SIG_DFL); } diff --git a/src/duckstation-nogui/drm_host_interface.h b/src/duckstation-nogui/vty_host_interface.h similarity index 90% rename from src/duckstation-nogui/drm_host_interface.h rename to src/duckstation-nogui/vty_host_interface.h index dbda2b213..826e767e3 100644 --- a/src/duckstation-nogui/drm_host_interface.h +++ b/src/duckstation-nogui/vty_host_interface.h @@ -4,11 +4,11 @@ #include #include -class DRMHostInterface final : public NoGUIHostInterface +class VTYHostInterface final : public NoGUIHostInterface { public: - DRMHostInterface(); - ~DRMHostInterface(); + VTYHostInterface(); + ~VTYHostInterface(); bool Initialize(); void Shutdown();