summaryrefslogtreecommitdiff
path: root/src/m_controls.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/m_controls.c')
-rw-r--r--src/m_controls.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/m_controls.c b/src/m_controls.c
index 1cca6263..98b1e51b 100644
--- a/src/m_controls.c
+++ b/src/m_controls.c
@@ -272,3 +272,79 @@ void M_BindMenuControls(void)
M_BindVariable("key_menu_decscreen", &key_menu_decscreen);
}
+#ifdef _WIN32_WCE
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+static int SystemHasKeyboard(void)
+{
+ HKEY key;
+ DWORD valtype;
+ DWORD valsize;
+ DWORD result;
+
+ if (RegOpenKeyExW(HKEY_CURRENT_USER,
+ L"\\Software\\Microsoft\\Shell", 0,
+ KEY_READ, &key) != ERROR_SUCCESS)
+ {
+ return 0;
+ }
+
+ valtype = REG_SZ;
+ valsize = sizeof(DWORD);
+
+ if (RegQueryValueExW(key, L"HasKeyboard", NULL, &valtype,
+ (LPBYTE) &result, &valsize) != ERROR_SUCCESS)
+ {
+ result = 0;
+ }
+
+ // Close the key
+
+ RegCloseKey(key);
+
+ return result;
+}
+
+//
+// Apply custom defaults for Windows CE.
+//
+
+static void M_ApplyWindowsCEDefaults(void)
+{
+ // If the system doesn't have a keyboard, patch the default
+ // configuration to use the hardware keys.
+
+ if (!SystemHasKeyboard())
+ {
+ key_use = KEY_F1;
+ key_fire = KEY_F2;
+ key_menu_activate = KEY_F3;
+ key_map_toggle = KEY_F4;
+
+ key_menu_help = 0;
+ key_menu_save = 0;
+ key_menu_load = 0;
+ key_menu_volume = 0;
+
+ key_menu_confirm = KEY_ENTER;
+ key_menu_back = KEY_F2;
+ key_menu_abort = KEY_F2;
+ }
+}
+
+#endif
+
+//
+// Apply custom patches to the default values depending on the
+// platform we are running on.
+//
+
+void M_ApplyPlatformDefaults(void)
+{
+#ifdef _WIN32_WCE
+ M_ApplyWindowsCEDefaults();
+#endif
+}
+