NoGUI: Rename DRMHostInterface to VTYHostInterface

This commit is contained in:
Connor McLaughlin 2021-02-14 01:19:44 +10:00
parent d4143399eb
commit f5d7fec914
6 changed files with 37 additions and 37 deletions

View file

@ -22,10 +22,10 @@ if(USE_DRMKMS)
find_package(LIBEVDEV REQUIRED) find_package(LIBEVDEV REQUIRED)
target_sources(duckstation-nogui PRIVATE target_sources(duckstation-nogui PRIVATE
drm_host_interface.cpp vty_host_interface.cpp
drm_host_interface.h 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_compile_definitions(duckstation-nogui PRIVATE "-DUSE_LIBEVDEV=1")
target_include_directories(duckstation-nogui PRIVATE ${LIBEVDEV_INCLUDE_DIRS}) target_include_directories(duckstation-nogui PRIVATE ${LIBEVDEV_INCLUDE_DIRS})
target_link_libraries(duckstation-nogui PRIVATE ${LIBEVDEV_LIBRARIES}) target_link_libraries(duckstation-nogui PRIVATE ${LIBEVDEV_LIBRARIES})

View file

@ -68,7 +68,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="drm_host_interface.cpp"> <ClCompile Include="vty_host_interface.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseLTCG|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseLTCG|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'">true</ExcludedFromBuild>
@ -89,7 +89,7 @@
<ClCompile Include="win32_host_interface.cpp" /> <ClCompile Include="win32_host_interface.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="drm_host_interface.h"> <ClInclude Include="vty_host_interface.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseLTCG|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseLTCG|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'">true</ExcludedFromBuild>

View file

@ -6,7 +6,7 @@
<ClCompile Include="imgui_impl_sdl.cpp" /> <ClCompile Include="imgui_impl_sdl.cpp" />
<ClCompile Include="nogui_host_interface.cpp" /> <ClCompile Include="nogui_host_interface.cpp" />
<ClCompile Include="win32_host_interface.cpp" /> <ClCompile Include="win32_host_interface.cpp" />
<ClCompile Include="drm_host_interface.cpp" /> <ClCompile Include="vty_host_interface.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="sdl_host_interface.h" /> <ClInclude Include="sdl_host_interface.h" />
@ -15,8 +15,8 @@
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<ClInclude Include="nogui_host_interface.h" /> <ClInclude Include="nogui_host_interface.h" />
<ClInclude Include="win32_host_interface.h" /> <ClInclude Include="win32_host_interface.h" />
<ClInclude Include="drm_host_interface.h" />
<ClInclude Include="evdev_key_names.h" /> <ClInclude Include="evdev_key_names.h" />
<ClInclude Include="vty_host_interface.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Manifest Include="duckstation-nogui.manifest" /> <Manifest Include="duckstation-nogui.manifest" />

View file

@ -8,8 +8,8 @@
#include <cstring> #include <cstring>
#include <vector> #include <vector>
#ifdef USE_DRMKMS #ifdef WITH_VTY
#include "drm_host_interface.h" #include "vty_host_interface.h"
#endif #endif
#ifdef WITH_SDL2 #ifdef WITH_SDL2
@ -46,9 +46,9 @@ static std::unique_ptr<NoGUIHostInterface> CreateHostInterface()
host_interface = SDLHostInterface::Create(); host_interface = SDLHostInterface::Create();
#endif #endif
#ifdef USE_DRMKMS #ifdef WITH_VTY
if (!host_interface && (!platform || StringUtil::Strcasecmp(platform, "drm") == 0)) if (!host_interface && (!platform || StringUtil::Strcasecmp(platform, "vty") == 0))
host_interface = DRMHostInterface::Create(); host_interface = VTYHostInterface::Create();
#endif #endif
#ifdef _WIN32 #ifdef _WIN32

View file

@ -1,4 +1,4 @@
#include "drm_host_interface.h" #include "vty_host_interface.h"
#include "common/log.h" #include "common/log.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "evdev_key_names.h" #include "evdev_key_names.h"
@ -8,21 +8,21 @@
#include <linux/input-event-codes.h> #include <linux/input-event-codes.h>
#include <signal.h> #include <signal.h>
#include <unistd.h> #include <unistd.h>
Log_SetChannel(DRMHostInterface); Log_SetChannel(VTYHostInterface);
DRMHostInterface::DRMHostInterface() = default; VTYHostInterface::VTYHostInterface() = default;
DRMHostInterface::~DRMHostInterface() VTYHostInterface::~VTYHostInterface()
{ {
CloseEVDevFDs(); CloseEVDevFDs();
} }
std::unique_ptr<NoGUIHostInterface> DRMHostInterface::Create() std::unique_ptr<NoGUIHostInterface> VTYHostInterface::Create()
{ {
return std::make_unique<DRMHostInterface>(); return std::make_unique<VTYHostInterface>();
} }
bool DRMHostInterface::Initialize() bool VTYHostInterface::Initialize()
{ {
if (!NoGUIHostInterface::Initialize()) if (!NoGUIHostInterface::Initialize())
return false; return false;
@ -35,23 +35,23 @@ bool DRMHostInterface::Initialize()
return true; return true;
} }
void DRMHostInterface::Shutdown() void VTYHostInterface::Shutdown()
{ {
CloseEVDevFDs(); CloseEVDevFDs();
NoGUIHostInterface::Shutdown(); NoGUIHostInterface::Shutdown();
} }
bool DRMHostInterface::IsFullscreen() const bool VTYHostInterface::IsFullscreen() const
{ {
return true; return true;
} }
bool DRMHostInterface::SetFullscreen(bool enabled) bool VTYHostInterface::SetFullscreen(bool enabled)
{ {
return enabled; return enabled;
} }
void DRMHostInterface::FixIncompatibleSettings(bool display_osd_messages) void VTYHostInterface::FixIncompatibleSettings(bool display_osd_messages)
{ {
NoGUIHostInterface::FixIncompatibleSettings(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; g_settings.confim_power_off = false;
} }
bool DRMHostInterface::CreatePlatformWindow(bool fullscreen) bool VTYHostInterface::CreatePlatformWindow(bool fullscreen)
{ {
SetImGuiKeyMap(); SetImGuiKeyMap();
return true; return true;
} }
void DRMHostInterface::DestroyPlatformWindow() void VTYHostInterface::DestroyPlatformWindow()
{ {
// nothing to destroy, it's all in the context // nothing to destroy, it's all in the context
} }
std::optional<WindowInfo> DRMHostInterface::GetPlatformWindowInfo() std::optional<WindowInfo> VTYHostInterface::GetPlatformWindowInfo()
{ {
WindowInfo wi; WindowInfo wi;
wi.type = WindowInfo::Type::Display; wi.type = WindowInfo::Type::Display;
@ -91,14 +91,14 @@ std::optional<WindowInfo> DRMHostInterface::GetPlatformWindowInfo()
return wi; return wi;
} }
void DRMHostInterface::PollAndUpdate() void VTYHostInterface::PollAndUpdate()
{ {
PollEvDevKeyboards(); PollEvDevKeyboards();
NoGUIHostInterface::PollAndUpdate(); NoGUIHostInterface::PollAndUpdate();
} }
void DRMHostInterface::OpenEVDevFDs() void VTYHostInterface::OpenEVDevFDs()
{ {
for (int i = 0; i < 1000; i++) 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) for (const EvDevKeyboard& kb : m_evdev_keyboards)
{ {
@ -148,7 +148,7 @@ void DRMHostInterface::CloseEVDevFDs()
m_evdev_keyboards.clear(); m_evdev_keyboards.clear();
} }
void DRMHostInterface::PollEvDevKeyboards() void VTYHostInterface::PollEvDevKeyboards()
{ {
for (const EvDevKeyboard& kb : m_evdev_keyboards) for (const EvDevKeyboard& kb : m_evdev_keyboards)
{ {
@ -169,7 +169,7 @@ void DRMHostInterface::PollEvDevKeyboards()
} }
} }
void DRMHostInterface::SetImGuiKeyMap() void VTYHostInterface::SetImGuiKeyMap()
{ {
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
@ -197,7 +197,7 @@ void DRMHostInterface::SetImGuiKeyMap()
io.KeyMap[ImGuiKey_Z] = KEY_Z; io.KeyMap[ImGuiKey_Z] = KEY_Z;
} }
std::optional<DRMHostInterface::HostKeyCode> DRMHostInterface::GetHostKeyCode(const std::string_view key_code) const std::optional<VTYHostInterface::HostKeyCode> VTYHostInterface::GetHostKeyCode(const std::string_view key_code) const
{ {
std::optional<int> kc = EvDevKeyNames::GetKeyCodeForName(key_code); std::optional<int> kc = EvDevKeyNames::GetKeyCodeForName(key_code);
if (!kc.has_value()) if (!kc.has_value())
@ -206,9 +206,9 @@ std::optional<DRMHostInterface::HostKeyCode> DRMHostInterface::GetHostKeyCode(co
return static_cast<HostKeyCode>(kc.value()); return static_cast<HostKeyCode>(kc.value());
} }
void DRMHostInterface::SIGTERMHandler(int sig) void VTYHostInterface::SIGTERMHandler(int sig)
{ {
Log_InfoPrintf("Recieved SIGTERM"); Log_InfoPrintf("Recieved SIGTERM");
static_cast<DRMHostInterface*>(g_host_interface)->m_quit_request = true; static_cast<VTYHostInterface*>(g_host_interface)->m_quit_request = true;
signal(sig, SIG_DFL); signal(sig, SIG_DFL);
} }

View file

@ -4,11 +4,11 @@
#include <vector> #include <vector>
#include <libevdev/libevdev.h> #include <libevdev/libevdev.h>
class DRMHostInterface final : public NoGUIHostInterface class VTYHostInterface final : public NoGUIHostInterface
{ {
public: public:
DRMHostInterface(); VTYHostInterface();
~DRMHostInterface(); ~VTYHostInterface();
bool Initialize(); bool Initialize();
void Shutdown(); void Shutdown();