Mini: Add duckstation-mini interface

This commit is contained in:
Stenzek 2025-01-04 15:33:48 +10:00
parent 3b4f5e2523
commit ad6c2b507f
No known key found for this signature in database
13 changed files with 2329 additions and 5 deletions

View File

@ -1,8 +1,8 @@
# Renderer options. # Renderer options.
option(ENABLE_OPENGL "Build with OpenGL renderer" ON) option(ENABLE_OPENGL "Build with OpenGL renderer" ON)
option(ENABLE_VULKAN "Build with Vulkan renderer" ON) option(ENABLE_VULKAN "Build with Vulkan renderer" ON)
option(BUILD_NOGUI_FRONTEND "Build the NoGUI frontend" OFF)
option(BUILD_QT_FRONTEND "Build the Qt frontend" ON) option(BUILD_QT_FRONTEND "Build the Qt frontend" ON)
option(BUILD_MINI_FRONTEND "Build the Mini frontend" OFF)
option(BUILD_REGTEST "Build regression test runner" OFF) option(BUILD_REGTEST "Build regression test runner" OFF)
option(BUILD_TESTS "Build unit tests" OFF) option(BUILD_TESTS "Build unit tests" OFF)
option(DISABLE_SSE4 "Build with SSE4 instructions disabled, reduces performance" OFF) option(DISABLE_SSE4 "Build with SSE4 instructions disabled, reduces performance" OFF)

View File

@ -55,6 +55,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reshadefx", "dep\reshadefx\
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rapidyaml", "dep\rapidyaml\rapidyaml.vcxproj", "{1AD23A8A-4C20-434C-AE6B-0E07759EEB1E}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rapidyaml", "dep\rapidyaml\rapidyaml.vcxproj", "{1AD23A8A-4C20-434C-AE6B-0E07759EEB1E}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "duckstation-mini", "src\duckstation-mini\duckstation-mini.vcxproj", "{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64 Debug|ARM64 = Debug|ARM64
@ -967,6 +969,28 @@ Global
{1AD23A8A-4C20-434C-AE6B-0E07759EEB1E}.ReleaseLTCG-Clang-SSE2|ARM64.ActiveCfg = ReleaseLTCG-Clang|ARM64 {1AD23A8A-4C20-434C-AE6B-0E07759EEB1E}.ReleaseLTCG-Clang-SSE2|ARM64.ActiveCfg = ReleaseLTCG-Clang|ARM64
{1AD23A8A-4C20-434C-AE6B-0E07759EEB1E}.ReleaseLTCG-Clang-SSE2|x64.ActiveCfg = ReleaseLTCG-Clang-SSE2|x64 {1AD23A8A-4C20-434C-AE6B-0E07759EEB1E}.ReleaseLTCG-Clang-SSE2|x64.ActiveCfg = ReleaseLTCG-Clang-SSE2|x64
{1AD23A8A-4C20-434C-AE6B-0E07759EEB1E}.ReleaseLTCG-Clang-SSE2|x64.Build.0 = ReleaseLTCG-Clang-SSE2|x64 {1AD23A8A-4C20-434C-AE6B-0E07759EEB1E}.ReleaseLTCG-Clang-SSE2|x64.Build.0 = ReleaseLTCG-Clang-SSE2|x64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.Debug|ARM64.ActiveCfg = Debug-Clang|ARM64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.Debug|x64.ActiveCfg = Debug|x64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.Debug-Clang|ARM64.ActiveCfg = Debug-Clang|ARM64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.Debug-Clang|x64.ActiveCfg = Debug-Clang|x64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.Debug-Clang-SSE2|ARM64.ActiveCfg = Debug-Clang|ARM64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.Debug-Clang-SSE2|x64.ActiveCfg = Debug-Clang-SSE2|x64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.DebugFast|ARM64.ActiveCfg = DebugFast-Clang|ARM64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.DebugFast|x64.ActiveCfg = DebugFast|x64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.DebugFast-Clang|ARM64.ActiveCfg = DebugFast-Clang|ARM64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.DebugFast-Clang|x64.ActiveCfg = DebugFast-Clang|x64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.Devel-Clang|ARM64.ActiveCfg = Devel-Clang|ARM64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.Devel-Clang|x64.ActiveCfg = Devel-Clang|x64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.Release|ARM64.ActiveCfg = Release-Clang|ARM64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.Release|x64.ActiveCfg = Release|x64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.Release-Clang|ARM64.ActiveCfg = Release-Clang|ARM64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.Release-Clang|x64.ActiveCfg = Release-Clang|x64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.ReleaseLTCG|ARM64.ActiveCfg = ReleaseLTCG-Clang|ARM64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.ReleaseLTCG|x64.ActiveCfg = ReleaseLTCG|x64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.ReleaseLTCG-Clang|ARM64.ActiveCfg = ReleaseLTCG-Clang|ARM64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.ReleaseLTCG-Clang|x64.ActiveCfg = ReleaseLTCG-Clang|x64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.ReleaseLTCG-Clang-SSE2|ARM64.ActiveCfg = ReleaseLTCG-Clang|ARM64
{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}.ReleaseLTCG-Clang-SSE2|x64.ActiveCfg = ReleaseLTCG-Clang-SSE2|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -7,14 +7,14 @@ if(WIN32 OR APPLE)
add_subdirectory(updater) add_subdirectory(updater)
endif() endif()
if(BUILD_NOGUI_FRONTEND)
add_subdirectory(duckstation-nogui)
endif()
if(BUILD_QT_FRONTEND) if(BUILD_QT_FRONTEND)
add_subdirectory(duckstation-qt) add_subdirectory(duckstation-qt)
endif() endif()
if(BUILD_MINI_FRONTEND)
add_subdirectory(duckstation-mini)
endif()
if(BUILD_REGTEST) if(BUILD_REGTEST)
add_subdirectory(duckstation-regtest) add_subdirectory(duckstation-regtest)
endif() endif()

View File

@ -0,0 +1,20 @@
add_executable(duckstation-mini
mini_host.cpp
sdl_key_names.h
)
target_link_libraries(duckstation-mini PRIVATE core util common imgui scmversion SDL2::SDL2 SDL2::SDL2main)
add_core_resources(duckstation-mini)
if(WIN32)
target_sources(duckstation-mini PRIVATE
duckstation-mini.manifest
resource.h
)
# We want a Windows subsystem application not console.
set_target_properties(duckstation-mini PROPERTIES
WIN32_EXECUTABLE TRUE
DEBUG_POSTFIX "-debug")
endif()

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv3:application>
<asmv3:windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
</assembly>

View File

@ -0,0 +1,110 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (Australia) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "0c0904b0"
BEGIN
VALUE "CompanyName", "https://github.com/stenzek/duckstation"
VALUE "FileDescription", "DuckStation PS1 Emulator"
VALUE "FileVersion", "1.0.0.1"
VALUE "InternalName", "duckstation-mini.exe"
VALUE "LegalCopyright", "Copyright (C) 2020-2025 Stenzek and collaborators"
VALUE "OriginalFilename", "duckstation-mini.exe"
VALUE "ProductName", "DuckStation"
VALUE "ProductVersion", "1.0.0.1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0xc09, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON "duckstation-mini.ico"
#endif // English (Australia) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\dep\msvc\vsprops\Configurations.props" />
<ItemGroup>
<ClInclude Include="resource.h" />
<ClInclude Include="sdl_key_names.h" />
</ItemGroup>
<ItemGroup>
<Manifest Include="duckstation-mini.manifest" />
</ItemGroup>
<ItemGroup>
<Image Include="duckstation-mini.ico" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="duckstation-mini.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\common\common.vcxproj">
<Project>{ee054e08-3799-4a59-a422-18259c105ffd}</Project>
</ProjectReference>
<ProjectReference Include="..\core\core.vcxproj">
<Project>{868b98c8-65a1-494b-8346-250a73a48c0a}</Project>
</ProjectReference>
<ProjectReference Include="..\util\util.vcxproj">
<Project>{57f6206d-f264-4b07-baf8-11b9bbe1f455}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="mini_host.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{FA259BC0-1007-4FD9-8A47-87CC0ECB8445}</ProjectGuid>
<ProjectName>duckstation-mini</ProjectName>
</PropertyGroup>
<Import Project="..\..\dep\msvc\vsprops\Win32Application.props" />
<Import Project="..\core\core.props" />
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>%(AdditionalDependencies);SDL2main.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<Import Project="..\..\dep\msvc\vsprops\Targets.props" />
</Project>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClInclude Include="resource.h" />
<ClInclude Include="sdl_key_names.h" />
</ItemGroup>
<ItemGroup>
<Manifest Include="duckstation-mini.manifest" />
</ItemGroup>
<ItemGroup>
<Image Include="duckstation-mini.ico" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="duckstation-mini.rc" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="mini_host.cpp" />
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by duckstation-sdl.rc
//
#define IDI_ICON1 102
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -0,0 +1,266 @@
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
#pragma once
#include "common/types.h"
#include <array>
#include <cstring>
#include <map>
#include <optional>
#include <string_view>
#include "SDL3/SDL.h"
namespace SDLKeyNames {
static const std::map<int, const char*> s_sdl_key_names = {
{SDLK_RETURN, "Return"},
{SDLK_ESCAPE, "Escape"},
{SDLK_BACKSPACE, "Backspace"},
{SDLK_TAB, "Tab"},
{SDLK_SPACE, "Space"},
{SDLK_EXCLAIM, "Exclam"},
{SDLK_DBLAPOSTROPHE, "QuoteDbl"},
{SDLK_HASH, "Hash"},
{SDLK_PERCENT, "Percent"},
{SDLK_DOLLAR, "Dollar"},
{SDLK_AMPERSAND, "Ampersand"},
{SDLK_APOSTROPHE, "Apostrophe"},
{SDLK_LEFTPAREN, "ParenLeft"},
{SDLK_RIGHTPAREN, "ParenRight"},
{SDLK_ASTERISK, "Asterisk"},
{SDLK_PLUS, "PLus"},
{SDLK_COMMA, "Comma"},
{SDLK_MINUS, "Minus"},
{SDLK_PERIOD, "Period"},
{SDLK_SLASH, "Slash"},
{SDLK_0, "0"},
{SDLK_1, "1"},
{SDLK_2, "2"},
{SDLK_3, "3"},
{SDLK_4, "4"},
{SDLK_5, "5"},
{SDLK_6, "6"},
{SDLK_7, "7"},
{SDLK_8, "8"},
{SDLK_9, "9"},
{SDLK_COLON, "Colon"},
{SDLK_SEMICOLON, "Semcolon"},
{SDLK_LESS, "Less"},
{SDLK_EQUALS, "Equal"},
{SDLK_GREATER, "Greater"},
{SDLK_QUESTION, "Question"},
{SDLK_AT, "AT"},
{SDLK_LEFTBRACKET, "BracketLeft"},
{SDLK_BACKSLASH, "Backslash"},
{SDLK_RIGHTBRACKET, "BracketRight"},
{SDLK_CARET, "Caret"},
{SDLK_UNDERSCORE, "Underscore"},
{SDLK_GRAVE, "Backquote"},
{SDLK_A, "A"},
{SDLK_B, "B"},
{SDLK_C, "C"},
{SDLK_D, "D"},
{SDLK_E, "E"},
{SDLK_F, "F"},
{SDLK_G, "G"},
{SDLK_H, "H"},
{SDLK_I, "I"},
{SDLK_J, "J"},
{SDLK_K, "K"},
{SDLK_L, "L"},
{SDLK_M, "M"},
{SDLK_N, "N"},
{SDLK_O, "O"},
{SDLK_P, "P"},
{SDLK_Q, "Q"},
{SDLK_R, "R"},
{SDLK_S, "S"},
{SDLK_T, "T"},
{SDLK_U, "U"},
{SDLK_V, "V"},
{SDLK_W, "W"},
{SDLK_X, "X"},
{SDLK_Y, "Y"},
{SDLK_Z, "Z"},
{SDLK_CAPSLOCK, "CapsLock"},
{SDLK_F1, "F1"},
{SDLK_F2, "F2"},
{SDLK_F3, "F3"},
{SDLK_F4, "F4"},
{SDLK_F5, "F5"},
{SDLK_F6, "F6"},
{SDLK_F7, "F7"},
{SDLK_F8, "F8"},
{SDLK_F9, "F9"},
{SDLK_F10, "F10"},
{SDLK_F11, "F11"},
{SDLK_F12, "F12"},
{SDLK_PRINTSCREEN, "Print"},
{SDLK_SCROLLLOCK, "ScrollLock"},
{SDLK_PAUSE, "Pause"},
{SDLK_INSERT, "Insert"},
{SDLK_HOME, "Home"},
{SDLK_PAGEUP, "PageUp"},
{SDLK_DELETE, "Delete"},
{SDLK_END, "End"},
{SDLK_PAGEDOWN, "PageDown"},
{SDLK_RIGHT, "Right"},
{SDLK_LEFT, "Left"},
{SDLK_DOWN, "Down"},
{SDLK_UP, "Up"},
{SDLK_NUMLOCKCLEAR, "NumLock"},
{SDLK_KP_DIVIDE, "Keypad+Divide"},
{SDLK_KP_MULTIPLY, "Keypad+Multiply"},
{SDLK_KP_MINUS, "Keypad+Minus"},
{SDLK_KP_PLUS, "Keypad+Plus"},
{SDLK_KP_ENTER, "Keypad+Return"},
{SDLK_KP_1, "Keypad+1"},
{SDLK_KP_2, "Keypad+2"},
{SDLK_KP_3, "Keypad+3"},
{SDLK_KP_4, "Keypad+4"},
{SDLK_KP_5, "Keypad+5"},
{SDLK_KP_6, "Keypad+6"},
{SDLK_KP_7, "Keypad+7"},
{SDLK_KP_8, "Keypad+8"},
{SDLK_KP_9, "Keypad+9"},
{SDLK_KP_0, "Keypad+0"},
{SDLK_KP_PERIOD, "Keypad+Period"},
{SDLK_APPLICATION, "Application"},
{SDLK_POWER, "Power"},
{SDLK_KP_EQUALS, "Keypad+Equal"},
{SDLK_F13, "F13"},
{SDLK_F14, "F14"},
{SDLK_F15, "F15"},
{SDLK_F16, "F16"},
{SDLK_F17, "F17"},
{SDLK_F18, "F18"},
{SDLK_F19, "F19"},
{SDLK_F20, "F20"},
{SDLK_F21, "F21"},
{SDLK_F22, "F22"},
{SDLK_F23, "F23"},
{SDLK_F24, "F24"},
{SDLK_EXECUTE, "Execute"},
{SDLK_HELP, "Help"},
{SDLK_MENU, "Menu"},
{SDLK_SELECT, "Select"},
{SDLK_STOP, "Stop"},
{SDLK_AGAIN, "Again"},
{SDLK_UNDO, "Undo"},
{SDLK_CUT, "Cut"},
{SDLK_COPY, "Copy"},
{SDLK_PASTE, "Paste"},
{SDLK_FIND, "Find"},
{SDLK_MUTE, "Mute"},
{SDLK_VOLUMEUP, "VolumeUp"},
{SDLK_VOLUMEDOWN, "VolumeDown"},
{SDLK_KP_COMMA, "Keypad+Comma"},
{SDLK_KP_EQUALSAS400, "Keypad+EqualAS400"},
{SDLK_ALTERASE, "AltErase"},
{SDLK_SYSREQ, "SysReq"},
{SDLK_CANCEL, "Cancel"},
{SDLK_CLEAR, "Clear"},
{SDLK_PRIOR, "Prior"},
{SDLK_RETURN2, "Return2"},
{SDLK_SEPARATOR, "Separator"},
{SDLK_OUT, "Out"},
{SDLK_OPER, "Oper"},
{SDLK_CLEARAGAIN, "ClearAgain"},
{SDLK_CRSEL, "CrSel"},
{SDLK_EXSEL, "ExSel"},
{SDLK_KP_00, "Keypad+00"},
{SDLK_KP_000, "Keypad+000"},
{SDLK_THOUSANDSSEPARATOR, "ThousandsSeparator"},
{SDLK_DECIMALSEPARATOR, "DecimalSeparator"},
{SDLK_CURRENCYUNIT, "CurrencyUnit"},
{SDLK_CURRENCYSUBUNIT, "CurrencySubunit"},
{SDLK_KP_LEFTPAREN, "Keypad+ParenLeft"},
{SDLK_KP_RIGHTPAREN, "Keypad+ParenRight"},
{SDLK_KP_LEFTBRACE, "Keypad+LeftBrace"},
{SDLK_KP_RIGHTBRACE, "Keypad+RightBrace"},
{SDLK_KP_TAB, "Keypad+Tab"},
{SDLK_KP_BACKSPACE, "Keypad+Backspace"},
{SDLK_KP_A, "Keypad+A"},
{SDLK_KP_B, "Keypad+B"},
{SDLK_KP_C, "Keypad+C"},
{SDLK_KP_D, "Keypad+D"},
{SDLK_KP_E, "Keypad+E"},
{SDLK_KP_F, "Keypad+F"},
{SDLK_KP_XOR, "Keypad+XOR"},
{SDLK_KP_POWER, "Keypad+Power"},
{SDLK_KP_PERCENT, "Keypad+Percent"},
{SDLK_KP_LESS, "Keypad+Less"},
{SDLK_KP_GREATER, "Keypad+Greater"},
{SDLK_KP_AMPERSAND, "Keypad+Ampersand"},
{SDLK_KP_DBLAMPERSAND, "Keypad+AmpersandDbl"},
{SDLK_KP_VERTICALBAR, "Keypad+Bar"},
{SDLK_KP_DBLVERTICALBAR, "Keypad+BarDbl"},
{SDLK_KP_COLON, "Keypad+Colon"},
{SDLK_KP_HASH, "Keypad+Hash"},
{SDLK_KP_SPACE, "Keypad+Space"},
{SDLK_KP_AT, "Keypad+At"},
{SDLK_KP_EXCLAM, "Keypad+Exclam"},
{SDLK_KP_MEMSTORE, "Keypad+MemStore"},
{SDLK_KP_MEMRECALL, "Keypad+MemRecall"},
{SDLK_KP_MEMCLEAR, "Keypad+MemClear"},
{SDLK_KP_MEMADD, "Keypad+MemAdd"},
{SDLK_KP_MEMSUBTRACT, "Keypad+MemSubtract"},
{SDLK_KP_MEMMULTIPLY, "Keypad+MemMultiply"},
{SDLK_KP_MEMDIVIDE, "Keypad+MemDivide"},
{SDLK_KP_PLUSMINUS, "Keypad+PlusMinus"},
{SDLK_KP_CLEAR, "Keypad+Clear"},
{SDLK_KP_CLEARENTRY, "Keypad+ClearEntry"},
{SDLK_KP_BINARY, "Keypad+Binary"},
{SDLK_KP_OCTAL, "Keypad+Octal"},
{SDLK_KP_DECIMAL, "Keypad+Decimal"},
{SDLK_KP_HEXADECIMAL, "Keypad+Hexadecimal"},
{SDLK_LCTRL, "LeftControl"},
{SDLK_LSHIFT, "LeftShift"},
{SDLK_LALT, "LeftAlt"},
{SDLK_LGUI, "Super_L"},
{SDLK_RCTRL, "RightCtrl"},
{SDLK_RSHIFT, "RightShift"},
{SDLK_RALT, "RightAlt"},
{SDLK_RGUI, "RightSuper"},
{SDLK_MODE, "Mode"},
{SDLK_MEDIA_NEXT_TRACK, "MediaNext"},
{SDLK_MEDIA_PREVIOUS_TRACK, "MediaPrevious"},
{SDLK_MEDIA_STOP, "MediaStop"},
{SDLK_MEDIA_PLAY, "MediaPlay"},
{SDLK_MEDIA_PLAY_PAUSE, "MediaPlayPause"},
{SDLK_MEDIA_SELECT, "MediaSelect"},
{SDLK_MEDIA_REWIND, "MediaRewind"},
{SDLK_MEDIA_FAST_FORWARD, "MediaFastForward"},
{SDLK_MUTE, "VolumeMute"},
{SDLK_AC_SEARCH, "Search"},
{SDLK_AC_HOME, "Home"},
{SDLK_AC_BACK, "Back"},
{SDLK_AC_FORWARD, "Forward"},
{SDLK_AC_STOP, "Stop"},
{SDLK_AC_REFRESH, "Refresh"},
{SDLK_AC_BOOKMARKS, "Bookmarks"},
{SDLK_MEDIA_EJECT, "Eject"},
{SDLK_SLEEP, "Sleep"},
};
static const char* GetKeyName(u32 key)
{
const auto it = s_sdl_key_names.find(key);
return it == s_sdl_key_names.end() ? nullptr : it->second;
}
static std::optional<u32> GetKeyCodeForName(const std::string_view& key_name)
{
for (const auto& it : s_sdl_key_names)
{
if (key_name == it.second)
return it.first;
}
return std::nullopt;
}
} // namespace SDLKeyNames