diff --git a/src/duckstation-nogui/CMakeLists.txt b/src/duckstation-nogui/CMakeLists.txt
index 2615eed09..d5feb7387 100644
--- a/src/duckstation-nogui/CMakeLists.txt
+++ b/src/duckstation-nogui/CMakeLists.txt
@@ -86,3 +86,12 @@ if(ENABLE_WAYLAND)
X11::xkbcommon
)
endif()
+
+if(ENABLE_SDL2)
+ message(STATUS "Building SDL NoGUI Platform.")
+ target_sources(duckstation-nogui PRIVATE
+ sdl_nogui_platform.cpp
+ sdl_nogui_platform.h
+ )
+ target_link_libraries(duckstation-nogui PUBLIC SDL2::SDL2)
+endif()
diff --git a/src/duckstation-nogui/duckstation-nogui.vcxproj b/src/duckstation-nogui/duckstation-nogui.vcxproj
index cc5525a36..fbbb40c64 100644
--- a/src/duckstation-nogui/duckstation-nogui.vcxproj
+++ b/src/duckstation-nogui/duckstation-nogui.vcxproj
@@ -6,6 +6,7 @@
Create
+
true
@@ -19,6 +20,7 @@
+
true
diff --git a/src/duckstation-nogui/duckstation-nogui.vcxproj.filters b/src/duckstation-nogui/duckstation-nogui.vcxproj.filters
index d08b60d6b..5cdac5f86 100644
--- a/src/duckstation-nogui/duckstation-nogui.vcxproj.filters
+++ b/src/duckstation-nogui/duckstation-nogui.vcxproj.filters
@@ -6,6 +6,7 @@
+
@@ -15,6 +16,7 @@
+
diff --git a/src/duckstation-nogui/nogui_host.cpp b/src/duckstation-nogui/nogui_host.cpp
index 126ac4de7..7e3c6ab1a 100644
--- a/src/duckstation-nogui/nogui_host.cpp
+++ b/src/duckstation-nogui/nogui_host.cpp
@@ -870,13 +870,20 @@ std::unique_ptr NoGUIHost::CreatePlatform()
{
std::unique_ptr ret;
+ const char* platform = std::getenv("DUCKSTATION_NOGUI_PLATFORM");
+#ifdef ENABLE_SDL2
+ if (platform && StringUtil::Strcasecmp(platform, "sdl") == 0)
+ ret = NoGUIPlatform::CreateSDLPlatform();
+#endif
+
#if defined(_WIN32)
- ret = NoGUIPlatform::CreateWin32Platform();
+ if (!ret)
+ ret = NoGUIPlatform::CreateWin32Platform();
#elif defined(__APPLE__)
- ret = NoGUIPlatform::CreateCocoaPlatform();
+ if (!ret)
+ ret = NoGUIPlatform::CreateCocoaPlatform();
#else
// linux
- const char* platform = std::getenv("DUCKSTATION_NOGUI_PLATFORM");
#ifdef NOGUI_PLATFORM_WAYLAND
if (!ret && (!platform || StringUtil::Strcasecmp(platform, "wayland") == 0) && std::getenv("WAYLAND_DISPLAY"))
ret = NoGUIPlatform::CreateWaylandPlatform();
diff --git a/src/duckstation-nogui/nogui_platform.h b/src/duckstation-nogui/nogui_platform.h
index 2810d2e68..452e545e5 100644
--- a/src/duckstation-nogui/nogui_platform.h
+++ b/src/duckstation-nogui/nogui_platform.h
@@ -52,6 +52,9 @@ public:
#ifdef __APPLE__
static std::unique_ptr CreateCocoaPlatform();
#endif
+#ifdef ENABLE_SDL2
+ static std::unique_ptr CreateSDLPlatform();
+#endif
#ifdef NOGUI_PLATFORM_WAYLAND
static std::unique_ptr CreateWaylandPlatform();
#endif
diff --git a/src/duckstation-nogui/sdl_key_names.h b/src/duckstation-nogui/sdl_key_names.h
new file mode 100644
index 000000000..efc587ea7
--- /dev/null
+++ b/src/duckstation-nogui/sdl_key_names.h
@@ -0,0 +1,274 @@
+// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin
+// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
+
+#pragma once
+
+#include "common/types.h"
+#include "common/windows_headers.h"
+
+#include
+#include
+#include