diff options
| author | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
| commit | 5a079a2d114f96d4847d1ee305d5b7c16eeec50e (patch) | |
| tree | 8926ab44f168acf787d8e19608857b3af0f82758 /contrib/SDL-3.2.8/src/core | |
Initial commit
Diffstat (limited to 'contrib/SDL-3.2.8/src/core')
52 files changed, 19263 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/core/SDL_core_unsupported.c b/contrib/SDL-3.2.8/src/core/SDL_core_unsupported.c new file mode 100644 index 0000000..af963ed --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/SDL_core_unsupported.c | |||
| @@ -0,0 +1,213 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifndef SDL_VIDEO_DRIVER_X11 | ||
| 24 | |||
| 25 | SDL_DECLSPEC void SDLCALL SDL_SetX11EventHook(SDL_X11EventHook callback, void *userdata); | ||
| 26 | void SDL_SetX11EventHook(SDL_X11EventHook callback, void *userdata) | ||
| 27 | { | ||
| 28 | } | ||
| 29 | |||
| 30 | #endif | ||
| 31 | |||
| 32 | #ifndef SDL_PLATFORM_LINUX | ||
| 33 | |||
| 34 | SDL_DECLSPEC bool SDLCALL SDL_SetLinuxThreadPriority(Sint64 threadID, int priority); | ||
| 35 | bool SDL_SetLinuxThreadPriority(Sint64 threadID, int priority) | ||
| 36 | { | ||
| 37 | (void)threadID; | ||
| 38 | (void)priority; | ||
| 39 | return SDL_Unsupported(); | ||
| 40 | } | ||
| 41 | |||
| 42 | SDL_DECLSPEC bool SDLCALL SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy); | ||
| 43 | bool SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy) | ||
| 44 | { | ||
| 45 | (void)threadID; | ||
| 46 | (void)sdlPriority; | ||
| 47 | (void)schedPolicy; | ||
| 48 | return SDL_Unsupported(); | ||
| 49 | } | ||
| 50 | |||
| 51 | #endif | ||
| 52 | |||
| 53 | #ifndef SDL_PLATFORM_GDK | ||
| 54 | |||
| 55 | SDL_DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void); | ||
| 56 | void SDL_GDKSuspendComplete(void) | ||
| 57 | { | ||
| 58 | SDL_Unsupported(); | ||
| 59 | } | ||
| 60 | |||
| 61 | SDL_DECLSPEC bool SDLCALL SDL_GetGDKDefaultUser(void *outUserHandle); /* XUserHandle *outUserHandle */ | ||
| 62 | bool SDL_GetGDKDefaultUser(void *outUserHandle) | ||
| 63 | { | ||
| 64 | return SDL_Unsupported(); | ||
| 65 | } | ||
| 66 | |||
| 67 | SDL_DECLSPEC void SDLCALL SDL_GDKSuspendGPU(SDL_GPUDevice *device); | ||
| 68 | void SDL_GDKSuspendGPU(SDL_GPUDevice *device) | ||
| 69 | { | ||
| 70 | } | ||
| 71 | |||
| 72 | SDL_DECLSPEC void SDLCALL SDL_GDKResumeGPU(SDL_GPUDevice *device); | ||
| 73 | void SDL_GDKResumeGPU(SDL_GPUDevice *device) | ||
| 74 | { | ||
| 75 | } | ||
| 76 | |||
| 77 | #endif | ||
| 78 | |||
| 79 | #if !defined(SDL_PLATFORM_WINDOWS) | ||
| 80 | |||
| 81 | SDL_DECLSPEC bool SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst); | ||
| 82 | bool SDL_RegisterApp(const char *name, Uint32 style, void *hInst) | ||
| 83 | { | ||
| 84 | (void)name; | ||
| 85 | (void)style; | ||
| 86 | (void)hInst; | ||
| 87 | return SDL_Unsupported(); | ||
| 88 | } | ||
| 89 | |||
| 90 | SDL_DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(void *callback, void *userdata); // SDL_WindowsMessageHook callback | ||
| 91 | void SDL_SetWindowsMessageHook(void *callback, void *userdata) | ||
| 92 | { | ||
| 93 | (void)callback; | ||
| 94 | (void)userdata; | ||
| 95 | SDL_Unsupported(); | ||
| 96 | } | ||
| 97 | |||
| 98 | SDL_DECLSPEC void SDLCALL SDL_UnregisterApp(void); | ||
| 99 | void SDL_UnregisterApp(void) | ||
| 100 | { | ||
| 101 | SDL_Unsupported(); | ||
| 102 | } | ||
| 103 | |||
| 104 | #endif | ||
| 105 | |||
| 106 | #ifndef SDL_PLATFORM_ANDROID | ||
| 107 | |||
| 108 | SDL_DECLSPEC void SDLCALL SDL_SendAndroidBackButton(void); | ||
| 109 | void SDL_SendAndroidBackButton(void) | ||
| 110 | { | ||
| 111 | SDL_Unsupported(); | ||
| 112 | } | ||
| 113 | |||
| 114 | SDL_DECLSPEC void * SDLCALL SDL_GetAndroidActivity(void); | ||
| 115 | void *SDL_GetAndroidActivity(void) | ||
| 116 | { | ||
| 117 | SDL_Unsupported(); | ||
| 118 | return NULL; | ||
| 119 | } | ||
| 120 | |||
| 121 | SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidCachePath(void); | ||
| 122 | const char* SDL_GetAndroidCachePath(void) | ||
| 123 | { | ||
| 124 | SDL_Unsupported(); | ||
| 125 | return NULL; | ||
| 126 | } | ||
| 127 | |||
| 128 | |||
| 129 | SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidExternalStoragePath(void); | ||
| 130 | const char* SDL_GetAndroidExternalStoragePath(void) | ||
| 131 | { | ||
| 132 | SDL_Unsupported(); | ||
| 133 | return NULL; | ||
| 134 | } | ||
| 135 | |||
| 136 | SDL_DECLSPEC Uint32 SDLCALL SDL_GetAndroidExternalStorageState(void); | ||
| 137 | Uint32 SDL_GetAndroidExternalStorageState(void) | ||
| 138 | { | ||
| 139 | SDL_Unsupported(); | ||
| 140 | return 0; | ||
| 141 | } | ||
| 142 | SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidInternalStoragePath(void); | ||
| 143 | const char *SDL_GetAndroidInternalStoragePath(void) | ||
| 144 | { | ||
| 145 | SDL_Unsupported(); | ||
| 146 | return NULL; | ||
| 147 | } | ||
| 148 | |||
| 149 | SDL_DECLSPEC void * SDLCALL SDL_GetAndroidJNIEnv(void); | ||
| 150 | void *SDL_GetAndroidJNIEnv(void) | ||
| 151 | { | ||
| 152 | SDL_Unsupported(); | ||
| 153 | return NULL; | ||
| 154 | } | ||
| 155 | |||
| 156 | typedef void (SDLCALL *SDL_RequestAndroidPermissionCallback)(void *userdata, const char *permission, bool granted); | ||
| 157 | SDL_DECLSPEC bool SDLCALL SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata); | ||
| 158 | bool SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata) | ||
| 159 | { | ||
| 160 | (void)permission; | ||
| 161 | (void)cb; | ||
| 162 | (void)userdata; | ||
| 163 | return SDL_Unsupported(); | ||
| 164 | } | ||
| 165 | |||
| 166 | SDL_DECLSPEC bool SDLCALL SDL_SendAndroidMessage(Uint32 command, int param); | ||
| 167 | bool SDL_SendAndroidMessage(Uint32 command, int param) | ||
| 168 | { | ||
| 169 | (void)command; | ||
| 170 | (void)param; | ||
| 171 | return SDL_Unsupported(); | ||
| 172 | } | ||
| 173 | |||
| 174 | SDL_DECLSPEC bool SDLCALL SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xoffset, int yoffset); | ||
| 175 | bool SDL_ShowAndroidToast(const char* message, int duration, int gravity, int xoffset, int yoffset) | ||
| 176 | { | ||
| 177 | (void)message; | ||
| 178 | (void)duration; | ||
| 179 | (void)gravity; | ||
| 180 | (void)xoffset; | ||
| 181 | (void)yoffset; | ||
| 182 | return SDL_Unsupported(); | ||
| 183 | } | ||
| 184 | |||
| 185 | SDL_DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void); | ||
| 186 | int SDL_GetAndroidSDKVersion(void) | ||
| 187 | { | ||
| 188 | return SDL_Unsupported(); | ||
| 189 | } | ||
| 190 | |||
| 191 | SDL_DECLSPEC bool SDLCALL SDL_IsChromebook(void); | ||
| 192 | bool SDL_IsChromebook(void) | ||
| 193 | { | ||
| 194 | SDL_Unsupported(); | ||
| 195 | return false; | ||
| 196 | } | ||
| 197 | |||
| 198 | SDL_DECLSPEC bool SDLCALL SDL_IsDeXMode(void); | ||
| 199 | bool SDL_IsDeXMode(void) | ||
| 200 | { | ||
| 201 | SDL_Unsupported(); | ||
| 202 | return false; | ||
| 203 | } | ||
| 204 | |||
| 205 | SDL_DECLSPEC Sint32 SDLCALL JNI_OnLoad(void *vm, void *reserved); | ||
| 206 | Sint32 JNI_OnLoad(void *vm, void *reserved) | ||
| 207 | { | ||
| 208 | (void)vm; | ||
| 209 | (void)reserved; | ||
| 210 | SDL_Unsupported(); | ||
| 211 | return -1; // JNI_ERR | ||
| 212 | } | ||
| 213 | #endif | ||
diff --git a/contrib/SDL-3.2.8/src/core/android/SDL_android.c b/contrib/SDL-3.2.8/src/core/android/SDL_android.c new file mode 100644 index 0000000..daf0f29 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/android/SDL_android.c | |||
| @@ -0,0 +1,2824 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifdef SDL_PLATFORM_ANDROID | ||
| 24 | |||
| 25 | #include "SDL_android.h" | ||
| 26 | |||
| 27 | #include "../../events/SDL_events_c.h" | ||
| 28 | #include "../../video/android/SDL_androidkeyboard.h" | ||
| 29 | #include "../../video/android/SDL_androidmouse.h" | ||
| 30 | #include "../../video/android/SDL_androidtouch.h" | ||
| 31 | #include "../../video/android/SDL_androidpen.h" | ||
| 32 | #include "../../video/android/SDL_androidvideo.h" | ||
| 33 | #include "../../video/android/SDL_androidwindow.h" | ||
| 34 | #include "../../joystick/android/SDL_sysjoystick_c.h" | ||
| 35 | #include "../../haptic/android/SDL_syshaptic_c.h" | ||
| 36 | #include "../../hidapi/android/hid.h" | ||
| 37 | #include "../../SDL_hints_c.h" | ||
| 38 | |||
| 39 | #include <android/log.h> | ||
| 40 | #include <android/configuration.h> | ||
| 41 | #include <android/asset_manager_jni.h> | ||
| 42 | #include <sys/system_properties.h> | ||
| 43 | #include <pthread.h> | ||
| 44 | #include <sys/types.h> | ||
| 45 | #include <unistd.h> | ||
| 46 | #include <dlfcn.h> | ||
| 47 | |||
| 48 | #define SDL_JAVA_PREFIX org_libsdl_app | ||
| 49 | #define CONCAT1(prefix, class, function) CONCAT2(prefix, class, function) | ||
| 50 | #define CONCAT2(prefix, class, function) Java_##prefix##_##class##_##function | ||
| 51 | #define SDL_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLActivity, function) | ||
| 52 | #define SDL_JAVA_AUDIO_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLAudioManager, function) | ||
| 53 | #define SDL_JAVA_CONTROLLER_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLControllerManager, function) | ||
| 54 | #define SDL_JAVA_INTERFACE_INPUT_CONNECTION(function) CONCAT1(SDL_JAVA_PREFIX, SDLInputConnection, function) | ||
| 55 | |||
| 56 | // Audio encoding definitions | ||
| 57 | #define ENCODING_PCM_8BIT 3 | ||
| 58 | #define ENCODING_PCM_16BIT 2 | ||
| 59 | #define ENCODING_PCM_FLOAT 4 | ||
| 60 | |||
| 61 | // Java class SDLActivity | ||
| 62 | JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetVersion)( | ||
| 63 | JNIEnv *env, jclass cls); | ||
| 64 | |||
| 65 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)( | ||
| 66 | JNIEnv *env, jclass cls); | ||
| 67 | |||
| 68 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeInitMainThread)( | ||
| 69 | JNIEnv *env, jclass cls); | ||
| 70 | |||
| 71 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeCleanupMainThread)( | ||
| 72 | JNIEnv *env, jclass cls); | ||
| 73 | |||
| 74 | JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)( | ||
| 75 | JNIEnv *env, jclass cls, | ||
| 76 | jstring library, jstring function, jobject array); | ||
| 77 | |||
| 78 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)( | ||
| 79 | JNIEnv *env, jclass jcls, | ||
| 80 | jstring filename); | ||
| 81 | |||
| 82 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetScreenResolution)( | ||
| 83 | JNIEnv *env, jclass jcls, | ||
| 84 | jint surfaceWidth, jint surfaceHeight, | ||
| 85 | jint deviceWidth, jint deviceHeight, jfloat density, jfloat rate); | ||
| 86 | |||
| 87 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)( | ||
| 88 | JNIEnv *env, jclass cls); | ||
| 89 | |||
| 90 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceCreated)( | ||
| 91 | JNIEnv *env, jclass jcls); | ||
| 92 | |||
| 93 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)( | ||
| 94 | JNIEnv *env, jclass jcls); | ||
| 95 | |||
| 96 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)( | ||
| 97 | JNIEnv *env, jclass jcls); | ||
| 98 | |||
| 99 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyDown)( | ||
| 100 | JNIEnv *env, jclass jcls, | ||
| 101 | jint keycode); | ||
| 102 | |||
| 103 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyUp)( | ||
| 104 | JNIEnv *env, jclass jcls, | ||
| 105 | jint keycode); | ||
| 106 | |||
| 107 | JNIEXPORT jboolean JNICALL SDL_JAVA_INTERFACE(onNativeSoftReturnKey)( | ||
| 108 | JNIEnv *env, jclass jcls); | ||
| 109 | |||
| 110 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost)( | ||
| 111 | JNIEnv *env, jclass jcls); | ||
| 112 | |||
| 113 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeTouch)( | ||
| 114 | JNIEnv *env, jclass jcls, | ||
| 115 | jint touch_device_id_in, jint pointer_finger_id_in, | ||
| 116 | jint action, jfloat x, jfloat y, jfloat p); | ||
| 117 | |||
| 118 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeMouse)( | ||
| 119 | JNIEnv *env, jclass jcls, | ||
| 120 | jint button, jint action, jfloat x, jfloat y, jboolean relative); | ||
| 121 | |||
| 122 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativePen)( | ||
| 123 | JNIEnv *env, jclass jcls, | ||
| 124 | jint pen_id_in, jint button, jint action, jfloat x, jfloat y, jfloat p); | ||
| 125 | |||
| 126 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)( | ||
| 127 | JNIEnv *env, jclass jcls, | ||
| 128 | jfloat x, jfloat y, jfloat z); | ||
| 129 | |||
| 130 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)( | ||
| 131 | JNIEnv *env, jclass jcls); | ||
| 132 | |||
| 133 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)( | ||
| 134 | JNIEnv *env, jclass cls); | ||
| 135 | |||
| 136 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeLocaleChanged)( | ||
| 137 | JNIEnv *env, jclass cls); | ||
| 138 | |||
| 139 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDarkModeChanged)( | ||
| 140 | JNIEnv *env, jclass cls, jboolean enabled); | ||
| 141 | |||
| 142 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSendQuit)( | ||
| 143 | JNIEnv *env, jclass cls); | ||
| 144 | |||
| 145 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)( | ||
| 146 | JNIEnv *env, jclass cls); | ||
| 147 | |||
| 148 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)( | ||
| 149 | JNIEnv *env, jclass cls); | ||
| 150 | |||
| 151 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)( | ||
| 152 | JNIEnv *env, jclass cls); | ||
| 153 | |||
| 154 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeFocusChanged)( | ||
| 155 | JNIEnv *env, jclass cls, jboolean hasFocus); | ||
| 156 | |||
| 157 | JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)( | ||
| 158 | JNIEnv *env, jclass cls, | ||
| 159 | jstring name); | ||
| 160 | |||
| 161 | JNIEXPORT jboolean JNICALL SDL_JAVA_INTERFACE(nativeGetHintBoolean)( | ||
| 162 | JNIEnv *env, jclass cls, | ||
| 163 | jstring name, jboolean default_value); | ||
| 164 | |||
| 165 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)( | ||
| 166 | JNIEnv *env, jclass cls, | ||
| 167 | jstring name, jstring value); | ||
| 168 | |||
| 169 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetNaturalOrientation)( | ||
| 170 | JNIEnv *env, jclass cls, | ||
| 171 | jint orientation); | ||
| 172 | |||
| 173 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeRotationChanged)( | ||
| 174 | JNIEnv *env, jclass cls, | ||
| 175 | jint rotation); | ||
| 176 | |||
| 177 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeInsetsChanged)( | ||
| 178 | JNIEnv *env, jclass cls, | ||
| 179 | jint left, jint right, jint top, jint bottom); | ||
| 180 | |||
| 181 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeAddTouch)( | ||
| 182 | JNIEnv *env, jclass cls, | ||
| 183 | jint touchId, jstring name); | ||
| 184 | |||
| 185 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePermissionResult)( | ||
| 186 | JNIEnv *env, jclass cls, | ||
| 187 | jint requestCode, jboolean result); | ||
| 188 | |||
| 189 | JNIEXPORT jboolean JNICALL SDL_JAVA_INTERFACE(nativeAllowRecreateActivity)( | ||
| 190 | JNIEnv *env, jclass jcls); | ||
| 191 | |||
| 192 | JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeCheckSDLThreadCounter)( | ||
| 193 | JNIEnv *env, jclass jcls); | ||
| 194 | |||
| 195 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeFileDialog)( | ||
| 196 | JNIEnv *env, jclass jcls, | ||
| 197 | jint requestCode, jobjectArray fileList, jint filter); | ||
| 198 | |||
| 199 | static JNINativeMethod SDLActivity_tab[] = { | ||
| 200 | { "nativeGetVersion", "()Ljava/lang/String;", SDL_JAVA_INTERFACE(nativeGetVersion) }, | ||
| 201 | { "nativeSetupJNI", "()I", SDL_JAVA_INTERFACE(nativeSetupJNI) }, | ||
| 202 | { "nativeInitMainThread", "()V", SDL_JAVA_INTERFACE(nativeInitMainThread) }, | ||
| 203 | { "nativeCleanupMainThread", "()V", SDL_JAVA_INTERFACE(nativeCleanupMainThread) }, | ||
| 204 | { "nativeRunMain", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)I", SDL_JAVA_INTERFACE(nativeRunMain) }, | ||
| 205 | { "onNativeDropFile", "(Ljava/lang/String;)V", SDL_JAVA_INTERFACE(onNativeDropFile) }, | ||
| 206 | { "nativeSetScreenResolution", "(IIIIFF)V", SDL_JAVA_INTERFACE(nativeSetScreenResolution) }, | ||
| 207 | { "onNativeResize", "()V", SDL_JAVA_INTERFACE(onNativeResize) }, | ||
| 208 | { "onNativeSurfaceCreated", "()V", SDL_JAVA_INTERFACE(onNativeSurfaceCreated) }, | ||
| 209 | { "onNativeSurfaceChanged", "()V", SDL_JAVA_INTERFACE(onNativeSurfaceChanged) }, | ||
| 210 | { "onNativeSurfaceDestroyed", "()V", SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed) }, | ||
| 211 | { "onNativeKeyDown", "(I)V", SDL_JAVA_INTERFACE(onNativeKeyDown) }, | ||
| 212 | { "onNativeKeyUp", "(I)V", SDL_JAVA_INTERFACE(onNativeKeyUp) }, | ||
| 213 | { "onNativeSoftReturnKey", "()Z", SDL_JAVA_INTERFACE(onNativeSoftReturnKey) }, | ||
| 214 | { "onNativeKeyboardFocusLost", "()V", SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost) }, | ||
| 215 | { "onNativeTouch", "(IIIFFF)V", SDL_JAVA_INTERFACE(onNativeTouch) }, | ||
| 216 | { "onNativeMouse", "(IIFFZ)V", SDL_JAVA_INTERFACE(onNativeMouse) }, | ||
| 217 | { "onNativePen", "(IIIFFF)V", SDL_JAVA_INTERFACE(onNativePen) }, | ||
| 218 | { "onNativeAccel", "(FFF)V", SDL_JAVA_INTERFACE(onNativeAccel) }, | ||
| 219 | { "onNativeClipboardChanged", "()V", SDL_JAVA_INTERFACE(onNativeClipboardChanged) }, | ||
| 220 | { "nativeLowMemory", "()V", SDL_JAVA_INTERFACE(nativeLowMemory) }, | ||
| 221 | { "onNativeLocaleChanged", "()V", SDL_JAVA_INTERFACE(onNativeLocaleChanged) }, | ||
| 222 | { "onNativeDarkModeChanged", "(Z)V", SDL_JAVA_INTERFACE(onNativeDarkModeChanged) }, | ||
| 223 | { "nativeSendQuit", "()V", SDL_JAVA_INTERFACE(nativeSendQuit) }, | ||
| 224 | { "nativeQuit", "()V", SDL_JAVA_INTERFACE(nativeQuit) }, | ||
| 225 | { "nativePause", "()V", SDL_JAVA_INTERFACE(nativePause) }, | ||
| 226 | { "nativeResume", "()V", SDL_JAVA_INTERFACE(nativeResume) }, | ||
| 227 | { "nativeFocusChanged", "(Z)V", SDL_JAVA_INTERFACE(nativeFocusChanged) }, | ||
| 228 | { "nativeGetHint", "(Ljava/lang/String;)Ljava/lang/String;", SDL_JAVA_INTERFACE(nativeGetHint) }, | ||
| 229 | { "nativeGetHintBoolean", "(Ljava/lang/String;Z)Z", SDL_JAVA_INTERFACE(nativeGetHintBoolean) }, | ||
| 230 | { "nativeSetenv", "(Ljava/lang/String;Ljava/lang/String;)V", SDL_JAVA_INTERFACE(nativeSetenv) }, | ||
| 231 | { "nativeSetNaturalOrientation", "(I)V", SDL_JAVA_INTERFACE(nativeSetNaturalOrientation) }, | ||
| 232 | { "onNativeRotationChanged", "(I)V", SDL_JAVA_INTERFACE(onNativeRotationChanged) }, | ||
| 233 | { "onNativeInsetsChanged", "(IIII)V", SDL_JAVA_INTERFACE(onNativeInsetsChanged) }, | ||
| 234 | { "nativeAddTouch", "(ILjava/lang/String;)V", SDL_JAVA_INTERFACE(nativeAddTouch) }, | ||
| 235 | { "nativePermissionResult", "(IZ)V", SDL_JAVA_INTERFACE(nativePermissionResult) }, | ||
| 236 | { "nativeAllowRecreateActivity", "()Z", SDL_JAVA_INTERFACE(nativeAllowRecreateActivity) }, | ||
| 237 | { "nativeCheckSDLThreadCounter", "()I", SDL_JAVA_INTERFACE(nativeCheckSDLThreadCounter) }, | ||
| 238 | { "onNativeFileDialog", "(I[Ljava/lang/String;I)V", SDL_JAVA_INTERFACE(onNativeFileDialog) } | ||
| 239 | }; | ||
| 240 | |||
| 241 | // Java class SDLInputConnection | ||
| 242 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)( | ||
| 243 | JNIEnv *env, jclass cls, | ||
| 244 | jstring text, jint newCursorPosition); | ||
| 245 | |||
| 246 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancodeForUnichar)( | ||
| 247 | JNIEnv *env, jclass cls, | ||
| 248 | jchar chUnicode); | ||
| 249 | |||
| 250 | static JNINativeMethod SDLInputConnection_tab[] = { | ||
| 251 | { "nativeCommitText", "(Ljava/lang/String;I)V", SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText) }, | ||
| 252 | { "nativeGenerateScancodeForUnichar", "(C)V", SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancodeForUnichar) } | ||
| 253 | }; | ||
| 254 | |||
| 255 | // Java class SDLAudioManager | ||
| 256 | JNIEXPORT void JNICALL SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI)( | ||
| 257 | JNIEnv *env, jclass jcls); | ||
| 258 | |||
| 259 | JNIEXPORT void JNICALL | ||
| 260 | SDL_JAVA_AUDIO_INTERFACE(addAudioDevice)(JNIEnv *env, jclass jcls, jboolean recording, jstring name, | ||
| 261 | jint device_id); | ||
| 262 | |||
| 263 | JNIEXPORT void JNICALL | ||
| 264 | SDL_JAVA_AUDIO_INTERFACE(removeAudioDevice)(JNIEnv *env, jclass jcls, jboolean recording, | ||
| 265 | jint device_id); | ||
| 266 | |||
| 267 | static JNINativeMethod SDLAudioManager_tab[] = { | ||
| 268 | { "nativeSetupJNI", "()I", SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI) }, | ||
| 269 | { "addAudioDevice", "(ZLjava/lang/String;I)V", SDL_JAVA_AUDIO_INTERFACE(addAudioDevice) }, | ||
| 270 | { "removeAudioDevice", "(ZI)V", SDL_JAVA_AUDIO_INTERFACE(removeAudioDevice) } | ||
| 271 | }; | ||
| 272 | |||
| 273 | // Java class SDLControllerManager | ||
| 274 | JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI)( | ||
| 275 | JNIEnv *env, jclass jcls); | ||
| 276 | |||
| 277 | JNIEXPORT jboolean JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown)( | ||
| 278 | JNIEnv *env, jclass jcls, | ||
| 279 | jint device_id, jint keycode); | ||
| 280 | |||
| 281 | JNIEXPORT jboolean JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadUp)( | ||
| 282 | JNIEnv *env, jclass jcls, | ||
| 283 | jint device_id, jint keycode); | ||
| 284 | |||
| 285 | JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeJoy)( | ||
| 286 | JNIEnv *env, jclass jcls, | ||
| 287 | jint device_id, jint axis, jfloat value); | ||
| 288 | |||
| 289 | JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeHat)( | ||
| 290 | JNIEnv *env, jclass jcls, | ||
| 291 | jint device_id, jint hat_id, jint x, jint y); | ||
| 292 | |||
| 293 | JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddJoystick)( | ||
| 294 | JNIEnv *env, jclass jcls, | ||
| 295 | jint device_id, jstring device_name, jstring device_desc, jint vendor_id, jint product_id, | ||
| 296 | jint button_mask, jint naxes, jint axis_mask, jint nhats, jboolean can_rumble); | ||
| 297 | |||
| 298 | JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveJoystick)( | ||
| 299 | JNIEnv *env, jclass jcls, | ||
| 300 | jint device_id); | ||
| 301 | |||
| 302 | JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddHaptic)( | ||
| 303 | JNIEnv *env, jclass jcls, | ||
| 304 | jint device_id, jstring device_name); | ||
| 305 | |||
| 306 | JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic)( | ||
| 307 | JNIEnv *env, jclass jcls, | ||
| 308 | jint device_id); | ||
| 309 | |||
| 310 | static JNINativeMethod SDLControllerManager_tab[] = { | ||
| 311 | { "nativeSetupJNI", "()I", SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI) }, | ||
| 312 | { "onNativePadDown", "(II)Z", SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown) }, | ||
| 313 | { "onNativePadUp", "(II)Z", SDL_JAVA_CONTROLLER_INTERFACE(onNativePadUp) }, | ||
| 314 | { "onNativeJoy", "(IIF)V", SDL_JAVA_CONTROLLER_INTERFACE(onNativeJoy) }, | ||
| 315 | { "onNativeHat", "(IIII)V", SDL_JAVA_CONTROLLER_INTERFACE(onNativeHat) }, | ||
| 316 | { "nativeAddJoystick", "(ILjava/lang/String;Ljava/lang/String;IIIIIIZ)V", SDL_JAVA_CONTROLLER_INTERFACE(nativeAddJoystick) }, | ||
| 317 | { "nativeRemoveJoystick", "(I)V", SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveJoystick) }, | ||
| 318 | { "nativeAddHaptic", "(ILjava/lang/String;)V", SDL_JAVA_CONTROLLER_INTERFACE(nativeAddHaptic) }, | ||
| 319 | { "nativeRemoveHaptic", "(I)V", SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic) } | ||
| 320 | }; | ||
| 321 | |||
| 322 | // Uncomment this to log messages entering and exiting methods in this file | ||
| 323 | // #define DEBUG_JNI | ||
| 324 | |||
| 325 | static void checkJNIReady(void); | ||
| 326 | |||
| 327 | /******************************************************************************* | ||
| 328 | This file links the Java side of Android with libsdl | ||
| 329 | *******************************************************************************/ | ||
| 330 | #include <jni.h> | ||
| 331 | |||
| 332 | /******************************************************************************* | ||
| 333 | Globals | ||
| 334 | *******************************************************************************/ | ||
| 335 | static pthread_key_t mThreadKey; | ||
| 336 | static pthread_once_t key_once = PTHREAD_ONCE_INIT; | ||
| 337 | static JavaVM *mJavaVM = NULL; | ||
| 338 | |||
| 339 | // Main activity | ||
| 340 | static jclass mActivityClass; | ||
| 341 | |||
| 342 | // method signatures | ||
| 343 | static jmethodID midClipboardGetText; | ||
| 344 | static jmethodID midClipboardHasText; | ||
| 345 | static jmethodID midClipboardSetText; | ||
| 346 | static jmethodID midCreateCustomCursor; | ||
| 347 | static jmethodID midDestroyCustomCursor; | ||
| 348 | static jmethodID midGetContext; | ||
| 349 | static jmethodID midGetManifestEnvironmentVariables; | ||
| 350 | static jmethodID midGetNativeSurface; | ||
| 351 | static jmethodID midInitTouch; | ||
| 352 | static jmethodID midIsAndroidTV; | ||
| 353 | static jmethodID midIsChromebook; | ||
| 354 | static jmethodID midIsDeXMode; | ||
| 355 | static jmethodID midIsScreenKeyboardShown; | ||
| 356 | static jmethodID midIsTablet; | ||
| 357 | static jmethodID midManualBackButton; | ||
| 358 | static jmethodID midMinimizeWindow; | ||
| 359 | static jmethodID midOpenURL; | ||
| 360 | static jmethodID midRequestPermission; | ||
| 361 | static jmethodID midShowToast; | ||
| 362 | static jmethodID midSendMessage; | ||
| 363 | static jmethodID midSetActivityTitle; | ||
| 364 | static jmethodID midSetCustomCursor; | ||
| 365 | static jmethodID midSetOrientation; | ||
| 366 | static jmethodID midSetRelativeMouseEnabled; | ||
| 367 | static jmethodID midSetSystemCursor; | ||
| 368 | static jmethodID midSetWindowStyle; | ||
| 369 | static jmethodID midShouldMinimizeOnFocusLoss; | ||
| 370 | static jmethodID midShowTextInput; | ||
| 371 | static jmethodID midSupportsRelativeMouse; | ||
| 372 | static jmethodID midOpenFileDescriptor; | ||
| 373 | static jmethodID midShowFileDialog; | ||
| 374 | |||
| 375 | // audio manager | ||
| 376 | static jclass mAudioManagerClass; | ||
| 377 | |||
| 378 | // method signatures | ||
| 379 | static jmethodID midRegisterAudioDeviceCallback; | ||
| 380 | static jmethodID midUnregisterAudioDeviceCallback; | ||
| 381 | static jmethodID midAudioSetThreadPriority; | ||
| 382 | |||
| 383 | // controller manager | ||
| 384 | static jclass mControllerManagerClass; | ||
| 385 | |||
| 386 | // method signatures | ||
| 387 | static jmethodID midPollInputDevices; | ||
| 388 | static jmethodID midPollHapticDevices; | ||
| 389 | static jmethodID midHapticRun; | ||
| 390 | static jmethodID midHapticRumble; | ||
| 391 | static jmethodID midHapticStop; | ||
| 392 | |||
| 393 | // Accelerometer data storage | ||
| 394 | static SDL_DisplayOrientation displayNaturalOrientation; | ||
| 395 | static SDL_DisplayOrientation displayCurrentOrientation; | ||
| 396 | static float fLastAccelerometer[3]; | ||
| 397 | static bool bHasNewData; | ||
| 398 | |||
| 399 | static bool bHasEnvironmentVariables; | ||
| 400 | |||
| 401 | // Android AssetManager | ||
| 402 | static void Internal_Android_Create_AssetManager(void); | ||
| 403 | static void Internal_Android_Destroy_AssetManager(void); | ||
| 404 | static AAssetManager *asset_manager = NULL; | ||
| 405 | static jobject javaAssetManagerRef = 0; | ||
| 406 | |||
| 407 | static SDL_Mutex *Android_ActivityMutex = NULL; | ||
| 408 | static SDL_Mutex *Android_LifecycleMutex = NULL; | ||
| 409 | static SDL_Semaphore *Android_LifecycleEventSem = NULL; | ||
| 410 | static SDL_AndroidLifecycleEvent Android_LifecycleEvents[SDL_NUM_ANDROID_LIFECYCLE_EVENTS]; | ||
| 411 | static int Android_NumLifecycleEvents; | ||
| 412 | |||
| 413 | /******************************************************************************* | ||
| 414 | Functions called by JNI | ||
| 415 | *******************************************************************************/ | ||
| 416 | |||
| 417 | /* From http://developer.android.com/guide/practices/jni.html | ||
| 418 | * All threads are Linux threads, scheduled by the kernel. | ||
| 419 | * They're usually started from managed code (using Thread.start), but they can also be created elsewhere and then | ||
| 420 | * attached to the JavaVM. For example, a thread started with pthread_create can be attached with the | ||
| 421 | * JNI AttachCurrentThread or AttachCurrentThreadAsDaemon functions. Until a thread is attached, it has no JNIEnv, | ||
| 422 | * and cannot make JNI calls. | ||
| 423 | * Attaching a natively-created thread causes a java.lang.Thread object to be constructed and added to the "main" | ||
| 424 | * ThreadGroup, making it visible to the debugger. Calling AttachCurrentThread on an already-attached thread | ||
| 425 | * is a no-op. | ||
| 426 | * Note: You can call this function any number of times for the same thread, there's no harm in it | ||
| 427 | */ | ||
| 428 | |||
| 429 | /* From http://developer.android.com/guide/practices/jni.html | ||
| 430 | * Threads attached through JNI must call DetachCurrentThread before they exit. If coding this directly is awkward, | ||
| 431 | * in Android 2.0 (Eclair) and higher you can use pthread_key_create to define a destructor function that will be | ||
| 432 | * called before the thread exits, and call DetachCurrentThread from there. (Use that key with pthread_setspecific | ||
| 433 | * to store the JNIEnv in thread-local-storage; that way it'll be passed into your destructor as the argument.) | ||
| 434 | * Note: The destructor is not called unless the stored value is != NULL | ||
| 435 | * Note: You can call this function any number of times for the same thread, there's no harm in it | ||
| 436 | * (except for some lost CPU cycles) | ||
| 437 | */ | ||
| 438 | |||
| 439 | // Set local storage value | ||
| 440 | static bool Android_JNI_SetEnv(JNIEnv *env) | ||
| 441 | { | ||
| 442 | int status = pthread_setspecific(mThreadKey, env); | ||
| 443 | if (status < 0) { | ||
| 444 | __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed pthread_setspecific() in Android_JNI_SetEnv() (err=%d)", status); | ||
| 445 | return false; | ||
| 446 | } | ||
| 447 | return true; | ||
| 448 | } | ||
| 449 | |||
| 450 | // Get local storage value | ||
| 451 | JNIEnv *Android_JNI_GetEnv(void) | ||
| 452 | { | ||
| 453 | // Get JNIEnv from the Thread local storage | ||
| 454 | JNIEnv *env = pthread_getspecific(mThreadKey); | ||
| 455 | if (!env) { | ||
| 456 | // If it fails, try to attach ! (e.g the thread isn't created with SDL_CreateThread() | ||
| 457 | int status; | ||
| 458 | |||
| 459 | // There should be a JVM | ||
| 460 | if (!mJavaVM) { | ||
| 461 | __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed, there is no JavaVM"); | ||
| 462 | return NULL; | ||
| 463 | } | ||
| 464 | |||
| 465 | /* Attach the current thread to the JVM and get a JNIEnv. | ||
| 466 | * It will be detached by pthread_create destructor 'Android_JNI_ThreadDestroyed' */ | ||
| 467 | status = (*mJavaVM)->AttachCurrentThread(mJavaVM, &env, NULL); | ||
| 468 | if (status < 0) { | ||
| 469 | __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed to attach current thread (err=%d)", status); | ||
| 470 | return NULL; | ||
| 471 | } | ||
| 472 | |||
| 473 | // Save JNIEnv into the Thread local storage | ||
| 474 | if (!Android_JNI_SetEnv(env)) { | ||
| 475 | return NULL; | ||
| 476 | } | ||
| 477 | } | ||
| 478 | |||
| 479 | return env; | ||
| 480 | } | ||
| 481 | |||
| 482 | // Set up an external thread for using JNI with Android_JNI_GetEnv() | ||
| 483 | bool Android_JNI_SetupThread(void) | ||
| 484 | { | ||
| 485 | JNIEnv *env; | ||
| 486 | int status; | ||
| 487 | |||
| 488 | // There should be a JVM | ||
| 489 | if (!mJavaVM) { | ||
| 490 | __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed, there is no JavaVM"); | ||
| 491 | return false; | ||
| 492 | } | ||
| 493 | |||
| 494 | /* Attach the current thread to the JVM and get a JNIEnv. | ||
| 495 | * It will be detached by pthread_create destructor 'Android_JNI_ThreadDestroyed' */ | ||
| 496 | status = (*mJavaVM)->AttachCurrentThread(mJavaVM, &env, NULL); | ||
| 497 | if (status < 0) { | ||
| 498 | __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed to attach current thread (err=%d)", status); | ||
| 499 | return false; | ||
| 500 | } | ||
| 501 | |||
| 502 | // Save JNIEnv into the Thread local storage | ||
| 503 | if (!Android_JNI_SetEnv(env)) { | ||
| 504 | return false; | ||
| 505 | } | ||
| 506 | |||
| 507 | return true; | ||
| 508 | } | ||
| 509 | |||
| 510 | // Destructor called for each thread where mThreadKey is not NULL | ||
| 511 | static void Android_JNI_ThreadDestroyed(void *value) | ||
| 512 | { | ||
| 513 | // The thread is being destroyed, detach it from the Java VM and set the mThreadKey value to NULL as required | ||
| 514 | JNIEnv *env = (JNIEnv *)value; | ||
| 515 | if (env) { | ||
| 516 | (*mJavaVM)->DetachCurrentThread(mJavaVM); | ||
| 517 | Android_JNI_SetEnv(NULL); | ||
| 518 | } | ||
| 519 | } | ||
| 520 | |||
| 521 | // Creation of local storage mThreadKey | ||
| 522 | static void Android_JNI_CreateKey(void) | ||
| 523 | { | ||
| 524 | int status = pthread_key_create(&mThreadKey, Android_JNI_ThreadDestroyed); | ||
| 525 | if (status < 0) { | ||
| 526 | __android_log_print(ANDROID_LOG_ERROR, "SDL", "Error initializing mThreadKey with pthread_key_create() (err=%d)", status); | ||
| 527 | } | ||
| 528 | } | ||
| 529 | |||
| 530 | static void Android_JNI_CreateKey_once(void) | ||
| 531 | { | ||
| 532 | int status = pthread_once(&key_once, Android_JNI_CreateKey); | ||
| 533 | if (status < 0) { | ||
| 534 | __android_log_print(ANDROID_LOG_ERROR, "SDL", "Error initializing mThreadKey with pthread_once() (err=%d)", status); | ||
| 535 | } | ||
| 536 | } | ||
| 537 | |||
| 538 | static void register_methods(JNIEnv *env, const char *classname, JNINativeMethod *methods, int nb) | ||
| 539 | { | ||
| 540 | jclass clazz = (*env)->FindClass(env, classname); | ||
| 541 | if (!clazz || (*env)->RegisterNatives(env, clazz, methods, nb) < 0) { | ||
| 542 | __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed to register methods of %s", classname); | ||
| 543 | return; | ||
| 544 | } | ||
| 545 | } | ||
| 546 | |||
| 547 | // Library init | ||
| 548 | JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) | ||
| 549 | { | ||
| 550 | JNIEnv *env = NULL; | ||
| 551 | |||
| 552 | mJavaVM = vm; | ||
| 553 | |||
| 554 | if ((*mJavaVM)->GetEnv(mJavaVM, (void **)&env, JNI_VERSION_1_4) != JNI_OK) { | ||
| 555 | __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed to get JNI Env"); | ||
| 556 | return JNI_VERSION_1_4; | ||
| 557 | } | ||
| 558 | |||
| 559 | register_methods(env, "org/libsdl/app/SDLActivity", SDLActivity_tab, SDL_arraysize(SDLActivity_tab)); | ||
| 560 | register_methods(env, "org/libsdl/app/SDLInputConnection", SDLInputConnection_tab, SDL_arraysize(SDLInputConnection_tab)); | ||
| 561 | register_methods(env, "org/libsdl/app/SDLAudioManager", SDLAudioManager_tab, SDL_arraysize(SDLAudioManager_tab)); | ||
| 562 | register_methods(env, "org/libsdl/app/SDLControllerManager", SDLControllerManager_tab, SDL_arraysize(SDLControllerManager_tab)); | ||
| 563 | register_methods(env, "org/libsdl/app/HIDDeviceManager", HIDDeviceManager_tab, SDL_arraysize(HIDDeviceManager_tab)); | ||
| 564 | |||
| 565 | return JNI_VERSION_1_4; | ||
| 566 | } | ||
| 567 | |||
| 568 | void checkJNIReady(void) | ||
| 569 | { | ||
| 570 | if (!mActivityClass || !mAudioManagerClass || !mControllerManagerClass) { | ||
| 571 | // We aren't fully initialized, let's just return. | ||
| 572 | return; | ||
| 573 | } | ||
| 574 | |||
| 575 | SDL_SetMainReady(); | ||
| 576 | } | ||
| 577 | |||
| 578 | // Get SDL version -- called before SDL_main() to verify JNI bindings | ||
| 579 | JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetVersion)(JNIEnv *env, jclass cls) | ||
| 580 | { | ||
| 581 | char version[128]; | ||
| 582 | |||
| 583 | SDL_snprintf(version, sizeof(version), "%d.%d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION); | ||
| 584 | |||
| 585 | return (*env)->NewStringUTF(env, version); | ||
| 586 | } | ||
| 587 | |||
| 588 | // Activity initialization -- called before SDL_main() to initialize JNI bindings | ||
| 589 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cls) | ||
| 590 | { | ||
| 591 | __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeSetupJNI()"); | ||
| 592 | |||
| 593 | // Start with a clean slate | ||
| 594 | SDL_ClearError(); | ||
| 595 | |||
| 596 | /* | ||
| 597 | * Create mThreadKey so we can keep track of the JNIEnv assigned to each thread | ||
| 598 | * Refer to http://developer.android.com/guide/practices/design/jni.html for the rationale behind this | ||
| 599 | */ | ||
| 600 | Android_JNI_CreateKey_once(); | ||
| 601 | |||
| 602 | // Save JNIEnv of SDLActivity | ||
| 603 | Android_JNI_SetEnv(env); | ||
| 604 | |||
| 605 | if (!mJavaVM) { | ||
| 606 | __android_log_print(ANDROID_LOG_ERROR, "SDL", "failed to found a JavaVM"); | ||
| 607 | } | ||
| 608 | |||
| 609 | /* Use a mutex to prevent concurrency issues between Java Activity and Native thread code, when using 'Android_Window'. | ||
| 610 | * (Eg. Java sending Touch events, while native code is destroying the main SDL_Window. ) | ||
| 611 | */ | ||
| 612 | if (!Android_ActivityMutex) { | ||
| 613 | Android_ActivityMutex = SDL_CreateMutex(); // Could this be created twice if onCreate() is called a second time ? | ||
| 614 | } | ||
| 615 | |||
| 616 | if (!Android_ActivityMutex) { | ||
| 617 | __android_log_print(ANDROID_LOG_ERROR, "SDL", "failed to create Android_ActivityMutex mutex"); | ||
| 618 | } | ||
| 619 | |||
| 620 | Android_LifecycleMutex = SDL_CreateMutex(); | ||
| 621 | if (!Android_LifecycleMutex) { | ||
| 622 | __android_log_print(ANDROID_LOG_ERROR, "SDL", "failed to create Android_LifecycleMutex mutex"); | ||
| 623 | } | ||
| 624 | |||
| 625 | Android_LifecycleEventSem = SDL_CreateSemaphore(0); | ||
| 626 | if (!Android_LifecycleEventSem) { | ||
| 627 | __android_log_print(ANDROID_LOG_ERROR, "SDL", "failed to create Android_LifecycleEventSem semaphore"); | ||
| 628 | } | ||
| 629 | |||
| 630 | mActivityClass = (jclass)((*env)->NewGlobalRef(env, cls)); | ||
| 631 | |||
| 632 | midClipboardGetText = (*env)->GetStaticMethodID(env, mActivityClass, "clipboardGetText", "()Ljava/lang/String;"); | ||
| 633 | midClipboardHasText = (*env)->GetStaticMethodID(env, mActivityClass, "clipboardHasText", "()Z"); | ||
| 634 | midClipboardSetText = (*env)->GetStaticMethodID(env, mActivityClass, "clipboardSetText", "(Ljava/lang/String;)V"); | ||
| 635 | midCreateCustomCursor = (*env)->GetStaticMethodID(env, mActivityClass, "createCustomCursor", "([IIIII)I"); | ||
| 636 | midDestroyCustomCursor = (*env)->GetStaticMethodID(env, mActivityClass, "destroyCustomCursor", "(I)V"); | ||
| 637 | midGetContext = (*env)->GetStaticMethodID(env, mActivityClass, "getContext", "()Landroid/content/Context;"); | ||
| 638 | midGetManifestEnvironmentVariables = (*env)->GetStaticMethodID(env, mActivityClass, "getManifestEnvironmentVariables", "()Z"); | ||
| 639 | midGetNativeSurface = (*env)->GetStaticMethodID(env, mActivityClass, "getNativeSurface", "()Landroid/view/Surface;"); | ||
| 640 | midInitTouch = (*env)->GetStaticMethodID(env, mActivityClass, "initTouch", "()V"); | ||
| 641 | midIsAndroidTV = (*env)->GetStaticMethodID(env, mActivityClass, "isAndroidTV", "()Z"); | ||
| 642 | midIsChromebook = (*env)->GetStaticMethodID(env, mActivityClass, "isChromebook", "()Z"); | ||
| 643 | midIsDeXMode = (*env)->GetStaticMethodID(env, mActivityClass, "isDeXMode", "()Z"); | ||
| 644 | midIsScreenKeyboardShown = (*env)->GetStaticMethodID(env, mActivityClass, "isScreenKeyboardShown", "()Z"); | ||
| 645 | midIsTablet = (*env)->GetStaticMethodID(env, mActivityClass, "isTablet", "()Z"); | ||
| 646 | midManualBackButton = (*env)->GetStaticMethodID(env, mActivityClass, "manualBackButton", "()V"); | ||
| 647 | midMinimizeWindow = (*env)->GetStaticMethodID(env, mActivityClass, "minimizeWindow", "()V"); | ||
| 648 | midOpenURL = (*env)->GetStaticMethodID(env, mActivityClass, "openURL", "(Ljava/lang/String;)Z"); | ||
| 649 | midRequestPermission = (*env)->GetStaticMethodID(env, mActivityClass, "requestPermission", "(Ljava/lang/String;I)V"); | ||
| 650 | midShowToast = (*env)->GetStaticMethodID(env, mActivityClass, "showToast", "(Ljava/lang/String;IIII)Z"); | ||
| 651 | midSendMessage = (*env)->GetStaticMethodID(env, mActivityClass, "sendMessage", "(II)Z"); | ||
| 652 | midSetActivityTitle = (*env)->GetStaticMethodID(env, mActivityClass, "setActivityTitle", "(Ljava/lang/String;)Z"); | ||
| 653 | midSetCustomCursor = (*env)->GetStaticMethodID(env, mActivityClass, "setCustomCursor", "(I)Z"); | ||
| 654 | midSetOrientation = (*env)->GetStaticMethodID(env, mActivityClass, "setOrientation", "(IIZLjava/lang/String;)V"); | ||
| 655 | midSetRelativeMouseEnabled = (*env)->GetStaticMethodID(env, mActivityClass, "setRelativeMouseEnabled", "(Z)Z"); | ||
| 656 | midSetSystemCursor = (*env)->GetStaticMethodID(env, mActivityClass, "setSystemCursor", "(I)Z"); | ||
| 657 | midSetWindowStyle = (*env)->GetStaticMethodID(env, mActivityClass, "setWindowStyle", "(Z)V"); | ||
| 658 | midShouldMinimizeOnFocusLoss = (*env)->GetStaticMethodID(env, mActivityClass, "shouldMinimizeOnFocusLoss", "()Z"); | ||
| 659 | midShowTextInput = (*env)->GetStaticMethodID(env, mActivityClass, "showTextInput", "(IIIII)Z"); | ||
| 660 | midSupportsRelativeMouse = (*env)->GetStaticMethodID(env, mActivityClass, "supportsRelativeMouse", "()Z"); | ||
| 661 | midOpenFileDescriptor = (*env)->GetStaticMethodID(env, mActivityClass, "openFileDescriptor", "(Ljava/lang/String;Ljava/lang/String;)I"); | ||
| 662 | midShowFileDialog = (*env)->GetStaticMethodID(env, mActivityClass, "showFileDialog", "([Ljava/lang/String;ZZI)Z"); | ||
| 663 | |||
| 664 | if (!midClipboardGetText || | ||
| 665 | !midClipboardHasText || | ||
| 666 | !midClipboardSetText || | ||
| 667 | !midCreateCustomCursor || | ||
| 668 | !midDestroyCustomCursor || | ||
| 669 | !midGetContext || | ||
| 670 | !midGetManifestEnvironmentVariables || | ||
| 671 | !midGetNativeSurface || | ||
| 672 | !midInitTouch || | ||
| 673 | !midIsAndroidTV || | ||
| 674 | !midIsChromebook || | ||
| 675 | !midIsDeXMode || | ||
| 676 | !midIsScreenKeyboardShown || | ||
| 677 | !midIsTablet || | ||
| 678 | !midManualBackButton || | ||
| 679 | !midMinimizeWindow || | ||
| 680 | !midOpenURL || | ||
| 681 | !midRequestPermission || | ||
| 682 | !midShowToast || | ||
| 683 | !midSendMessage || | ||
| 684 | !midSetActivityTitle || | ||
| 685 | !midSetCustomCursor || | ||
| 686 | !midSetOrientation || | ||
| 687 | !midSetRelativeMouseEnabled || | ||
| 688 | !midSetSystemCursor || | ||
| 689 | !midSetWindowStyle || | ||
| 690 | !midShouldMinimizeOnFocusLoss || | ||
| 691 | !midShowTextInput || | ||
| 692 | !midSupportsRelativeMouse || | ||
| 693 | !midOpenFileDescriptor || | ||
| 694 | !midShowFileDialog) { | ||
| 695 | __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLActivity.java?"); | ||
| 696 | } | ||
| 697 | |||
| 698 | checkJNIReady(); | ||
| 699 | } | ||
| 700 | |||
| 701 | // Audio initialization -- called before SDL_main() to initialize JNI bindings | ||
| 702 | JNIEXPORT void JNICALL SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cls) | ||
| 703 | { | ||
| 704 | __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "AUDIO nativeSetupJNI()"); | ||
| 705 | |||
| 706 | mAudioManagerClass = (jclass)((*env)->NewGlobalRef(env, cls)); | ||
| 707 | |||
| 708 | midRegisterAudioDeviceCallback = (*env)->GetStaticMethodID(env, mAudioManagerClass, | ||
| 709 | "registerAudioDeviceCallback", | ||
| 710 | "()V"); | ||
| 711 | midUnregisterAudioDeviceCallback = (*env)->GetStaticMethodID(env, mAudioManagerClass, | ||
| 712 | "unregisterAudioDeviceCallback", | ||
| 713 | "()V"); | ||
| 714 | midAudioSetThreadPriority = (*env)->GetStaticMethodID(env, mAudioManagerClass, | ||
| 715 | "audioSetThreadPriority", "(ZI)V"); | ||
| 716 | |||
| 717 | if (!midRegisterAudioDeviceCallback || !midUnregisterAudioDeviceCallback || !midAudioSetThreadPriority) { | ||
| 718 | __android_log_print(ANDROID_LOG_WARN, "SDL", | ||
| 719 | "Missing some Java callbacks, do you have the latest version of SDLAudioManager.java?"); | ||
| 720 | } | ||
| 721 | |||
| 722 | checkJNIReady(); | ||
| 723 | } | ||
| 724 | |||
| 725 | // Controller initialization -- called before SDL_main() to initialize JNI bindings | ||
| 726 | JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cls) | ||
| 727 | { | ||
| 728 | __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "CONTROLLER nativeSetupJNI()"); | ||
| 729 | |||
| 730 | mControllerManagerClass = (jclass)((*env)->NewGlobalRef(env, cls)); | ||
| 731 | |||
| 732 | midPollInputDevices = (*env)->GetStaticMethodID(env, mControllerManagerClass, | ||
| 733 | "pollInputDevices", "()V"); | ||
| 734 | midPollHapticDevices = (*env)->GetStaticMethodID(env, mControllerManagerClass, | ||
| 735 | "pollHapticDevices", "()V"); | ||
| 736 | midHapticRun = (*env)->GetStaticMethodID(env, mControllerManagerClass, | ||
| 737 | "hapticRun", "(IFI)V"); | ||
| 738 | midHapticRumble = (*env)->GetStaticMethodID(env, mControllerManagerClass, | ||
| 739 | "hapticRumble", "(IFFI)V"); | ||
| 740 | midHapticStop = (*env)->GetStaticMethodID(env, mControllerManagerClass, | ||
| 741 | "hapticStop", "(I)V"); | ||
| 742 | |||
| 743 | if (!midPollInputDevices || !midPollHapticDevices || !midHapticRun || !midHapticRumble || !midHapticStop) { | ||
| 744 | __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLControllerManager.java?"); | ||
| 745 | } | ||
| 746 | |||
| 747 | checkJNIReady(); | ||
| 748 | } | ||
| 749 | |||
| 750 | // SDL main function prototype | ||
| 751 | typedef int (*SDL_main_func)(int argc, char *argv[]); | ||
| 752 | |||
| 753 | static int run_count = 0; | ||
| 754 | |||
| 755 | JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeCheckSDLThreadCounter)( | ||
| 756 | JNIEnv *env, jclass jcls) | ||
| 757 | { | ||
| 758 | int tmp = run_count; | ||
| 759 | run_count += 1; | ||
| 760 | return tmp; | ||
| 761 | } | ||
| 762 | |||
| 763 | JNIEXPORT jboolean JNICALL SDL_JAVA_INTERFACE(nativeAllowRecreateActivity)( | ||
| 764 | JNIEnv *env, jclass jcls) | ||
| 765 | { | ||
| 766 | return SDL_GetHintBoolean(SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY, false); | ||
| 767 | } | ||
| 768 | |||
| 769 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeInitMainThread)( | ||
| 770 | JNIEnv *env, jclass jcls) | ||
| 771 | { | ||
| 772 | __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeInitSDLThread() %d time", run_count); | ||
| 773 | run_count += 1; | ||
| 774 | |||
| 775 | // Save JNIEnv of SDLThread | ||
| 776 | Android_JNI_SetEnv(env); | ||
| 777 | } | ||
| 778 | |||
| 779 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeCleanupMainThread)( | ||
| 780 | JNIEnv *env, jclass jcls) | ||
| 781 | { | ||
| 782 | /* This is a Java thread, it doesn't need to be Detached from the JVM. | ||
| 783 | * Set to mThreadKey value to NULL not to call pthread_create destructor 'Android_JNI_ThreadDestroyed' */ | ||
| 784 | Android_JNI_SetEnv(NULL); | ||
| 785 | } | ||
| 786 | |||
| 787 | // Start up the SDL app | ||
| 788 | JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv *env, jclass cls, jstring library, jstring function, jobject array) | ||
| 789 | { | ||
| 790 | int status = -1; | ||
| 791 | const char *library_file; | ||
| 792 | void *library_handle; | ||
| 793 | |||
| 794 | library_file = (*env)->GetStringUTFChars(env, library, NULL); | ||
| 795 | library_handle = dlopen(library_file, RTLD_GLOBAL); | ||
| 796 | |||
| 797 | if (library_handle == NULL) { | ||
| 798 | /* When deploying android app bundle format uncompressed native libs may not extract from apk to filesystem. | ||
| 799 | In this case we should use lib name without path. https://bugzilla.libsdl.org/show_bug.cgi?id=4739 */ | ||
| 800 | const char *library_name = SDL_strrchr(library_file, '/'); | ||
| 801 | if (library_name && *library_name) { | ||
| 802 | library_name += 1; | ||
| 803 | library_handle = dlopen(library_name, RTLD_GLOBAL); | ||
| 804 | } | ||
| 805 | } | ||
| 806 | |||
| 807 | if (library_handle) { | ||
| 808 | const char *function_name; | ||
| 809 | SDL_main_func SDL_main; | ||
| 810 | |||
| 811 | function_name = (*env)->GetStringUTFChars(env, function, NULL); | ||
| 812 | SDL_main = (SDL_main_func)dlsym(library_handle, function_name); | ||
| 813 | if (SDL_main) { | ||
| 814 | int i; | ||
| 815 | int argc; | ||
| 816 | int len; | ||
| 817 | char **argv; | ||
| 818 | bool isstack; | ||
| 819 | |||
| 820 | // Prepare the arguments. | ||
| 821 | len = (*env)->GetArrayLength(env, array); | ||
| 822 | argv = SDL_small_alloc(char *, 1 + len + 1, &isstack); // !!! FIXME: check for NULL | ||
| 823 | argc = 0; | ||
| 824 | /* Use the name "app_process" so PHYSFS_platformCalcBaseDir() works. | ||
| 825 | https://github.com/love2d/love-android/issues/24 | ||
| 826 | */ | ||
| 827 | argv[argc++] = SDL_strdup("app_process"); | ||
| 828 | for (i = 0; i < len; ++i) { | ||
| 829 | char *arg = NULL; | ||
| 830 | jstring string = (*env)->GetObjectArrayElement(env, array, i); | ||
| 831 | if (string) { | ||
| 832 | const char *utf = (*env)->GetStringUTFChars(env, string, 0); | ||
| 833 | if (utf) { | ||
| 834 | arg = SDL_strdup(utf); | ||
| 835 | (*env)->ReleaseStringUTFChars(env, string, utf); | ||
| 836 | } | ||
| 837 | (*env)->DeleteLocalRef(env, string); | ||
| 838 | } | ||
| 839 | if (arg == NULL) { | ||
| 840 | arg = SDL_strdup(""); | ||
| 841 | } | ||
| 842 | argv[argc++] = arg; | ||
| 843 | } | ||
| 844 | argv[argc] = NULL; | ||
| 845 | |||
| 846 | // Run the application. | ||
| 847 | status = SDL_main(argc, argv); | ||
| 848 | |||
| 849 | // Release the arguments. | ||
| 850 | for (i = 0; i < argc; ++i) { | ||
| 851 | SDL_free(argv[i]); | ||
| 852 | } | ||
| 853 | SDL_small_free(argv, isstack); | ||
| 854 | |||
| 855 | } else { | ||
| 856 | __android_log_print(ANDROID_LOG_ERROR, "SDL", "nativeRunMain(): Couldn't find function %s in library %s", function_name, library_file); | ||
| 857 | } | ||
| 858 | (*env)->ReleaseStringUTFChars(env, function, function_name); | ||
| 859 | |||
| 860 | dlclose(library_handle); | ||
| 861 | |||
| 862 | } else { | ||
| 863 | __android_log_print(ANDROID_LOG_ERROR, "SDL", "nativeRunMain(): Couldn't load library %s", library_file); | ||
| 864 | } | ||
| 865 | (*env)->ReleaseStringUTFChars(env, library, library_file); | ||
| 866 | |||
| 867 | // Do not issue an exit or the whole application will terminate instead of just the SDL thread | ||
| 868 | // exit(status); | ||
| 869 | |||
| 870 | return status; | ||
| 871 | } | ||
| 872 | |||
| 873 | static int FindLifecycleEvent(SDL_AndroidLifecycleEvent event) | ||
| 874 | { | ||
| 875 | for (int index = 0; index < Android_NumLifecycleEvents; ++index) { | ||
| 876 | if (Android_LifecycleEvents[index] == event) { | ||
| 877 | return index; | ||
| 878 | } | ||
| 879 | } | ||
| 880 | return -1; | ||
| 881 | } | ||
| 882 | |||
| 883 | static void RemoveLifecycleEvent(int index) | ||
| 884 | { | ||
| 885 | if (index < Android_NumLifecycleEvents - 1) { | ||
| 886 | SDL_memmove(&Android_LifecycleEvents[index], &Android_LifecycleEvents[index+1], (Android_NumLifecycleEvents - index - 1) * sizeof(Android_LifecycleEvents[index])); | ||
| 887 | } | ||
| 888 | --Android_NumLifecycleEvents; | ||
| 889 | } | ||
| 890 | |||
| 891 | void Android_SendLifecycleEvent(SDL_AndroidLifecycleEvent event) | ||
| 892 | { | ||
| 893 | SDL_LockMutex(Android_LifecycleMutex); | ||
| 894 | { | ||
| 895 | int index; | ||
| 896 | bool add_event = true; | ||
| 897 | |||
| 898 | switch (event) { | ||
| 899 | case SDL_ANDROID_LIFECYCLE_WAKE: | ||
| 900 | // We don't need more than one wake queued | ||
| 901 | index = FindLifecycleEvent(SDL_ANDROID_LIFECYCLE_WAKE); | ||
| 902 | if (index >= 0) { | ||
| 903 | add_event = false; | ||
| 904 | } | ||
| 905 | break; | ||
| 906 | case SDL_ANDROID_LIFECYCLE_PAUSE: | ||
| 907 | // If we have a resume queued, just stay in the paused state | ||
| 908 | index = FindLifecycleEvent(SDL_ANDROID_LIFECYCLE_RESUME); | ||
| 909 | if (index >= 0) { | ||
| 910 | RemoveLifecycleEvent(index); | ||
| 911 | add_event = false; | ||
| 912 | } | ||
| 913 | break; | ||
| 914 | case SDL_ANDROID_LIFECYCLE_RESUME: | ||
| 915 | // If we have a pause queued, just stay in the resumed state | ||
| 916 | index = FindLifecycleEvent(SDL_ANDROID_LIFECYCLE_PAUSE); | ||
| 917 | if (index >= 0) { | ||
| 918 | RemoveLifecycleEvent(index); | ||
| 919 | add_event = false; | ||
| 920 | } | ||
| 921 | break; | ||
| 922 | case SDL_ANDROID_LIFECYCLE_LOWMEMORY: | ||
| 923 | // We don't need more than one low memory event queued | ||
| 924 | index = FindLifecycleEvent(SDL_ANDROID_LIFECYCLE_LOWMEMORY); | ||
| 925 | if (index >= 0) { | ||
| 926 | add_event = false; | ||
| 927 | } | ||
| 928 | break; | ||
| 929 | case SDL_ANDROID_LIFECYCLE_DESTROY: | ||
| 930 | // Remove all other events, we're done! | ||
| 931 | while (Android_NumLifecycleEvents > 0) { | ||
| 932 | RemoveLifecycleEvent(0); | ||
| 933 | } | ||
| 934 | break; | ||
| 935 | default: | ||
| 936 | SDL_assert(!"Sending unexpected lifecycle event"); | ||
| 937 | add_event = false; | ||
| 938 | break; | ||
| 939 | } | ||
| 940 | |||
| 941 | if (add_event) { | ||
| 942 | SDL_assert(Android_NumLifecycleEvents < SDL_arraysize(Android_LifecycleEvents)); | ||
| 943 | Android_LifecycleEvents[Android_NumLifecycleEvents++] = event; | ||
| 944 | SDL_SignalSemaphore(Android_LifecycleEventSem); | ||
| 945 | } | ||
| 946 | } | ||
| 947 | SDL_UnlockMutex(Android_LifecycleMutex); | ||
| 948 | } | ||
| 949 | |||
| 950 | bool Android_WaitLifecycleEvent(SDL_AndroidLifecycleEvent *event, Sint64 timeoutNS) | ||
| 951 | { | ||
| 952 | bool got_event = false; | ||
| 953 | |||
| 954 | while (!got_event && SDL_WaitSemaphoreTimeoutNS(Android_LifecycleEventSem, timeoutNS)) { | ||
| 955 | SDL_LockMutex(Android_LifecycleMutex); | ||
| 956 | { | ||
| 957 | if (Android_NumLifecycleEvents > 0) { | ||
| 958 | *event = Android_LifecycleEvents[0]; | ||
| 959 | RemoveLifecycleEvent(0); | ||
| 960 | got_event = true; | ||
| 961 | } | ||
| 962 | } | ||
| 963 | SDL_UnlockMutex(Android_LifecycleMutex); | ||
| 964 | } | ||
| 965 | return got_event; | ||
| 966 | } | ||
| 967 | |||
| 968 | void Android_LockActivityMutex(void) | ||
| 969 | { | ||
| 970 | SDL_LockMutex(Android_ActivityMutex); | ||
| 971 | } | ||
| 972 | |||
| 973 | void Android_UnlockActivityMutex(void) | ||
| 974 | { | ||
| 975 | SDL_UnlockMutex(Android_ActivityMutex); | ||
| 976 | } | ||
| 977 | |||
| 978 | // Drop file | ||
| 979 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)( | ||
| 980 | JNIEnv *env, jclass jcls, | ||
| 981 | jstring filename) | ||
| 982 | { | ||
| 983 | const char *path = (*env)->GetStringUTFChars(env, filename, NULL); | ||
| 984 | SDL_SendDropFile(NULL, NULL, path); | ||
| 985 | (*env)->ReleaseStringUTFChars(env, filename, path); | ||
| 986 | SDL_SendDropComplete(NULL); | ||
| 987 | } | ||
| 988 | |||
| 989 | // Set screen resolution | ||
| 990 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetScreenResolution)( | ||
| 991 | JNIEnv *env, jclass jcls, | ||
| 992 | jint surfaceWidth, jint surfaceHeight, | ||
| 993 | jint deviceWidth, jint deviceHeight, jfloat density, jfloat rate) | ||
| 994 | { | ||
| 995 | SDL_LockMutex(Android_ActivityMutex); | ||
| 996 | |||
| 997 | Android_SetScreenResolution(surfaceWidth, surfaceHeight, deviceWidth, deviceHeight, density, rate); | ||
| 998 | |||
| 999 | SDL_UnlockMutex(Android_ActivityMutex); | ||
| 1000 | } | ||
| 1001 | |||
| 1002 | // Resize | ||
| 1003 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)( | ||
| 1004 | JNIEnv *env, jclass jcls) | ||
| 1005 | { | ||
| 1006 | SDL_LockMutex(Android_ActivityMutex); | ||
| 1007 | |||
| 1008 | if (Android_Window) { | ||
| 1009 | Android_SendResize(Android_Window); | ||
| 1010 | } | ||
| 1011 | |||
| 1012 | SDL_UnlockMutex(Android_ActivityMutex); | ||
| 1013 | } | ||
| 1014 | |||
| 1015 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetNaturalOrientation)( | ||
| 1016 | JNIEnv *env, jclass jcls, | ||
| 1017 | jint orientation) | ||
| 1018 | { | ||
| 1019 | displayNaturalOrientation = (SDL_DisplayOrientation)orientation; | ||
| 1020 | } | ||
| 1021 | |||
| 1022 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeRotationChanged)( | ||
| 1023 | JNIEnv *env, jclass jcls, | ||
| 1024 | jint rotation) | ||
| 1025 | { | ||
| 1026 | SDL_LockMutex(Android_ActivityMutex); | ||
| 1027 | |||
| 1028 | if (displayNaturalOrientation == SDL_ORIENTATION_LANDSCAPE) { | ||
| 1029 | rotation += 90; | ||
| 1030 | } | ||
| 1031 | |||
| 1032 | switch (rotation % 360) { | ||
| 1033 | case 0: | ||
| 1034 | displayCurrentOrientation = SDL_ORIENTATION_PORTRAIT; | ||
| 1035 | break; | ||
| 1036 | case 90: | ||
| 1037 | displayCurrentOrientation = SDL_ORIENTATION_LANDSCAPE; | ||
| 1038 | break; | ||
| 1039 | case 180: | ||
| 1040 | displayCurrentOrientation = SDL_ORIENTATION_PORTRAIT_FLIPPED; | ||
| 1041 | break; | ||
| 1042 | case 270: | ||
| 1043 | displayCurrentOrientation = SDL_ORIENTATION_LANDSCAPE_FLIPPED; | ||
| 1044 | break; | ||
| 1045 | default: | ||
| 1046 | displayCurrentOrientation = SDL_ORIENTATION_UNKNOWN; | ||
| 1047 | break; | ||
| 1048 | } | ||
| 1049 | |||
| 1050 | Android_SetOrientation(displayCurrentOrientation); | ||
| 1051 | |||
| 1052 | SDL_UnlockMutex(Android_ActivityMutex); | ||
| 1053 | } | ||
| 1054 | |||
| 1055 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeInsetsChanged)( | ||
| 1056 | JNIEnv *env, jclass jcls, | ||
| 1057 | jint left, jint right, jint top, jint bottom) | ||
| 1058 | { | ||
| 1059 | SDL_LockMutex(Android_ActivityMutex); | ||
| 1060 | |||
| 1061 | Android_SetWindowSafeAreaInsets(left, right, top, bottom); | ||
| 1062 | |||
| 1063 | SDL_UnlockMutex(Android_ActivityMutex); | ||
| 1064 | } | ||
| 1065 | |||
| 1066 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeAddTouch)( | ||
| 1067 | JNIEnv *env, jclass cls, | ||
| 1068 | jint touchId, jstring name) | ||
| 1069 | { | ||
| 1070 | const char *utfname = (*env)->GetStringUTFChars(env, name, NULL); | ||
| 1071 | |||
| 1072 | SDL_AddTouch((SDL_TouchID)touchId, SDL_TOUCH_DEVICE_DIRECT, utfname); | ||
| 1073 | |||
| 1074 | (*env)->ReleaseStringUTFChars(env, name, utfname); | ||
| 1075 | } | ||
| 1076 | |||
| 1077 | JNIEXPORT void JNICALL | ||
| 1078 | SDL_JAVA_AUDIO_INTERFACE(addAudioDevice)(JNIEnv *env, jclass jcls, jboolean recording, | ||
| 1079 | jstring name, jint device_id) | ||
| 1080 | { | ||
| 1081 | #if ALLOW_MULTIPLE_ANDROID_AUDIO_DEVICES | ||
| 1082 | if (SDL_GetCurrentAudioDriver() != NULL) { | ||
| 1083 | void *handle = (void *)((size_t)device_id); | ||
| 1084 | if (!SDL_FindPhysicalAudioDeviceByHandle(handle)) { | ||
| 1085 | const char *utf8name = (*env)->GetStringUTFChars(env, name, NULL); | ||
| 1086 | SDL_AddAudioDevice(recording, SDL_strdup(utf8name), NULL, handle); | ||
| 1087 | (*env)->ReleaseStringUTFChars(env, name, utf8name); | ||
| 1088 | } | ||
| 1089 | } | ||
| 1090 | #endif | ||
| 1091 | } | ||
| 1092 | |||
| 1093 | JNIEXPORT void JNICALL | ||
| 1094 | SDL_JAVA_AUDIO_INTERFACE(removeAudioDevice)(JNIEnv *env, jclass jcls, jboolean recording, | ||
| 1095 | jint device_id) | ||
| 1096 | { | ||
| 1097 | #if ALLOW_MULTIPLE_ANDROID_AUDIO_DEVICES | ||
| 1098 | if (SDL_GetCurrentAudioDriver() != NULL) { | ||
| 1099 | SDL_Log("Removing device with handle %d, recording %d", device_id, recording); | ||
| 1100 | SDL_AudioDeviceDisconnected(SDL_FindPhysicalAudioDeviceByHandle((void *)((size_t)device_id))); | ||
| 1101 | } | ||
| 1102 | #endif | ||
| 1103 | } | ||
| 1104 | |||
| 1105 | // Paddown | ||
| 1106 | JNIEXPORT jboolean JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown)( | ||
| 1107 | JNIEnv *env, jclass jcls, | ||
| 1108 | jint device_id, jint keycode) | ||
| 1109 | { | ||
| 1110 | #ifdef SDL_JOYSTICK_ANDROID | ||
| 1111 | return Android_OnPadDown(device_id, keycode); | ||
| 1112 | #else | ||
| 1113 | return false; | ||
| 1114 | #endif // SDL_JOYSTICK_ANDROID | ||
| 1115 | } | ||
| 1116 | |||
| 1117 | // Padup | ||
| 1118 | JNIEXPORT jboolean JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadUp)( | ||
| 1119 | JNIEnv *env, jclass jcls, | ||
| 1120 | jint device_id, jint keycode) | ||
| 1121 | { | ||
| 1122 | #ifdef SDL_JOYSTICK_ANDROID | ||
| 1123 | return Android_OnPadUp(device_id, keycode); | ||
| 1124 | #else | ||
| 1125 | return false; | ||
| 1126 | #endif // SDL_JOYSTICK_ANDROID | ||
| 1127 | } | ||
| 1128 | |||
| 1129 | // Joy | ||
| 1130 | JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeJoy)( | ||
| 1131 | JNIEnv *env, jclass jcls, | ||
| 1132 | jint device_id, jint axis, jfloat value) | ||
| 1133 | { | ||
| 1134 | #ifdef SDL_JOYSTICK_ANDROID | ||
| 1135 | Android_OnJoy(device_id, axis, value); | ||
| 1136 | #endif // SDL_JOYSTICK_ANDROID | ||
| 1137 | } | ||
| 1138 | |||
| 1139 | // POV Hat | ||
| 1140 | JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeHat)( | ||
| 1141 | JNIEnv *env, jclass jcls, | ||
| 1142 | jint device_id, jint hat_id, jint x, jint y) | ||
| 1143 | { | ||
| 1144 | #ifdef SDL_JOYSTICK_ANDROID | ||
| 1145 | Android_OnHat(device_id, hat_id, x, y); | ||
| 1146 | #endif // SDL_JOYSTICK_ANDROID | ||
| 1147 | } | ||
| 1148 | |||
| 1149 | JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddJoystick)( | ||
| 1150 | JNIEnv *env, jclass jcls, | ||
| 1151 | jint device_id, jstring device_name, jstring device_desc, | ||
| 1152 | jint vendor_id, jint product_id, | ||
| 1153 | jint button_mask, jint naxes, jint axis_mask, jint nhats, jboolean can_rumble) | ||
| 1154 | { | ||
| 1155 | #ifdef SDL_JOYSTICK_ANDROID | ||
| 1156 | const char *name = (*env)->GetStringUTFChars(env, device_name, NULL); | ||
| 1157 | const char *desc = (*env)->GetStringUTFChars(env, device_desc, NULL); | ||
| 1158 | |||
| 1159 | Android_AddJoystick(device_id, name, desc, vendor_id, product_id, button_mask, naxes, axis_mask, nhats, can_rumble); | ||
| 1160 | |||
| 1161 | (*env)->ReleaseStringUTFChars(env, device_name, name); | ||
| 1162 | (*env)->ReleaseStringUTFChars(env, device_desc, desc); | ||
| 1163 | #endif // SDL_JOYSTICK_ANDROID | ||
| 1164 | } | ||
| 1165 | |||
| 1166 | JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveJoystick)( | ||
| 1167 | JNIEnv *env, jclass jcls, | ||
| 1168 | jint device_id) | ||
| 1169 | { | ||
| 1170 | #ifdef SDL_JOYSTICK_ANDROID | ||
| 1171 | Android_RemoveJoystick(device_id); | ||
| 1172 | #endif // SDL_JOYSTICK_ANDROID | ||
| 1173 | } | ||
| 1174 | |||
| 1175 | JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddHaptic)( | ||
| 1176 | JNIEnv *env, jclass jcls, jint device_id, jstring device_name) | ||
| 1177 | { | ||
| 1178 | #ifdef SDL_HAPTIC_ANDROID | ||
| 1179 | const char *name = (*env)->GetStringUTFChars(env, device_name, NULL); | ||
| 1180 | |||
| 1181 | Android_AddHaptic(device_id, name); | ||
| 1182 | |||
| 1183 | (*env)->ReleaseStringUTFChars(env, device_name, name); | ||
| 1184 | #endif // SDL_HAPTIC_ANDROID | ||
| 1185 | } | ||
| 1186 | |||
| 1187 | JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic)( | ||
| 1188 | JNIEnv *env, jclass jcls, jint device_id) | ||
| 1189 | { | ||
| 1190 | #ifdef SDL_HAPTIC_ANDROID | ||
| 1191 | Android_RemoveHaptic(device_id); | ||
| 1192 | #endif | ||
| 1193 | } | ||
| 1194 | |||
| 1195 | // Called from surfaceCreated() | ||
| 1196 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceCreated)(JNIEnv *env, jclass jcls) | ||
| 1197 | { | ||
| 1198 | SDL_LockMutex(Android_ActivityMutex); | ||
| 1199 | |||
| 1200 | if (Android_Window) { | ||
| 1201 | SDL_WindowData *data = Android_Window->internal; | ||
| 1202 | |||
| 1203 | data->native_window = Android_JNI_GetNativeWindow(); | ||
| 1204 | SDL_SetPointerProperty(SDL_GetWindowProperties(Android_Window), SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER, data->native_window); | ||
| 1205 | if (data->native_window == NULL) { | ||
| 1206 | SDL_SetError("Could not fetch native window from UI thread"); | ||
| 1207 | } | ||
| 1208 | } | ||
| 1209 | |||
| 1210 | SDL_UnlockMutex(Android_ActivityMutex); | ||
| 1211 | } | ||
| 1212 | |||
| 1213 | // Called from surfaceChanged() | ||
| 1214 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, jclass jcls) | ||
| 1215 | { | ||
| 1216 | SDL_LockMutex(Android_ActivityMutex); | ||
| 1217 | |||
| 1218 | #ifdef SDL_VIDEO_OPENGL_EGL | ||
| 1219 | if (Android_Window && (Android_Window->flags & SDL_WINDOW_OPENGL)) { | ||
| 1220 | SDL_VideoDevice *_this = SDL_GetVideoDevice(); | ||
| 1221 | SDL_WindowData *data = Android_Window->internal; | ||
| 1222 | |||
| 1223 | // If the surface has been previously destroyed by onNativeSurfaceDestroyed, recreate it here | ||
| 1224 | if (data->egl_surface == EGL_NO_SURFACE) { | ||
| 1225 | data->egl_surface = SDL_EGL_CreateSurface(_this, Android_Window, (NativeWindowType)data->native_window); | ||
| 1226 | SDL_SetPointerProperty(SDL_GetWindowProperties(Android_Window), SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER, data->egl_surface); | ||
| 1227 | } | ||
| 1228 | |||
| 1229 | // GL Context handling is done in the event loop because this function is run from the Java thread | ||
| 1230 | } | ||
| 1231 | #endif | ||
| 1232 | |||
| 1233 | SDL_UnlockMutex(Android_ActivityMutex); | ||
| 1234 | } | ||
| 1235 | |||
| 1236 | // Called from surfaceDestroyed() | ||
| 1237 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)(JNIEnv *env, jclass jcls) | ||
| 1238 | { | ||
| 1239 | int nb_attempt = 50; | ||
| 1240 | |||
| 1241 | retry: | ||
| 1242 | |||
| 1243 | SDL_LockMutex(Android_ActivityMutex); | ||
| 1244 | |||
| 1245 | if (Android_Window) { | ||
| 1246 | SDL_WindowData *data = Android_Window->internal; | ||
| 1247 | |||
| 1248 | // Wait for Main thread being paused and context un-activated to release 'egl_surface' | ||
| 1249 | if ((Android_Window->flags & SDL_WINDOW_OPENGL) && !data->backup_done) { | ||
| 1250 | nb_attempt -= 1; | ||
| 1251 | if (nb_attempt == 0) { | ||
| 1252 | SDL_SetError("Try to release egl_surface with context probably still active"); | ||
| 1253 | } else { | ||
| 1254 | SDL_UnlockMutex(Android_ActivityMutex); | ||
| 1255 | SDL_Delay(10); | ||
| 1256 | goto retry; | ||
| 1257 | } | ||
| 1258 | } | ||
| 1259 | |||
| 1260 | #ifdef SDL_VIDEO_OPENGL_EGL | ||
| 1261 | if (data->egl_surface != EGL_NO_SURFACE) { | ||
| 1262 | SDL_EGL_DestroySurface(SDL_GetVideoDevice(), data->egl_surface); | ||
| 1263 | data->egl_surface = EGL_NO_SURFACE; | ||
| 1264 | } | ||
| 1265 | #endif | ||
| 1266 | |||
| 1267 | if (data->native_window) { | ||
| 1268 | ANativeWindow_release(data->native_window); | ||
| 1269 | data->native_window = NULL; | ||
| 1270 | } | ||
| 1271 | |||
| 1272 | // GL Context handling is done in the event loop because this function is run from the Java thread | ||
| 1273 | } | ||
| 1274 | |||
| 1275 | SDL_UnlockMutex(Android_ActivityMutex); | ||
| 1276 | } | ||
| 1277 | |||
| 1278 | // Keydown | ||
| 1279 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyDown)( | ||
| 1280 | JNIEnv *env, jclass jcls, | ||
| 1281 | jint keycode) | ||
| 1282 | { | ||
| 1283 | SDL_LockMutex(Android_ActivityMutex); | ||
| 1284 | |||
| 1285 | if (Android_Window) { | ||
| 1286 | Android_OnKeyDown(keycode); | ||
| 1287 | } | ||
| 1288 | |||
| 1289 | SDL_UnlockMutex(Android_ActivityMutex); | ||
| 1290 | } | ||
| 1291 | |||
| 1292 | // Keyup | ||
| 1293 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyUp)( | ||
| 1294 | JNIEnv *env, jclass jcls, | ||
| 1295 | jint keycode) | ||
| 1296 | { | ||
| 1297 | SDL_LockMutex(Android_ActivityMutex); | ||
| 1298 | |||
| 1299 | if (Android_Window) { | ||
| 1300 | Android_OnKeyUp(keycode); | ||
| 1301 | } | ||
| 1302 | |||
| 1303 | SDL_UnlockMutex(Android_ActivityMutex); | ||
| 1304 | } | ||
| 1305 | |||
| 1306 | // Virtual keyboard return key might stop text input | ||
| 1307 | JNIEXPORT jboolean JNICALL SDL_JAVA_INTERFACE(onNativeSoftReturnKey)( | ||
| 1308 | JNIEnv *env, jclass jcls) | ||
| 1309 | { | ||
| 1310 | if (SDL_GetHintBoolean(SDL_HINT_RETURN_KEY_HIDES_IME, false)) { | ||
| 1311 | SDL_StopTextInput(Android_Window); | ||
| 1312 | return JNI_TRUE; | ||
| 1313 | } | ||
| 1314 | return JNI_FALSE; | ||
| 1315 | } | ||
| 1316 | |||
| 1317 | // Keyboard Focus Lost | ||
| 1318 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost)( | ||
| 1319 | JNIEnv *env, jclass jcls) | ||
| 1320 | { | ||
| 1321 | // Calling SDL_StopTextInput will take care of hiding the keyboard and cleaning up the DummyText widget | ||
| 1322 | SDL_StopTextInput(Android_Window); | ||
| 1323 | } | ||
| 1324 | |||
| 1325 | // Touch | ||
| 1326 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeTouch)( | ||
| 1327 | JNIEnv *env, jclass jcls, | ||
| 1328 | jint touch_device_id_in, jint pointer_finger_id_in, | ||
| 1329 | jint action, jfloat x, jfloat y, jfloat p) | ||
| 1330 | { | ||
| 1331 | SDL_LockMutex(Android_ActivityMutex); | ||
| 1332 | |||
| 1333 | Android_OnTouch(Android_Window, touch_device_id_in, pointer_finger_id_in, action, x, y, p); | ||
| 1334 | |||
| 1335 | SDL_UnlockMutex(Android_ActivityMutex); | ||
| 1336 | } | ||
| 1337 | |||
| 1338 | // Mouse | ||
| 1339 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeMouse)( | ||
| 1340 | JNIEnv *env, jclass jcls, | ||
| 1341 | jint button, jint action, jfloat x, jfloat y, jboolean relative) | ||
| 1342 | { | ||
| 1343 | SDL_LockMutex(Android_ActivityMutex); | ||
| 1344 | |||
| 1345 | Android_OnMouse(Android_Window, button, action, x, y, relative); | ||
| 1346 | |||
| 1347 | SDL_UnlockMutex(Android_ActivityMutex); | ||
| 1348 | } | ||
| 1349 | |||
| 1350 | // Pen | ||
| 1351 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativePen)( | ||
| 1352 | JNIEnv *env, jclass jcls, | ||
| 1353 | jint pen_id_in, jint button, jint action, jfloat x, jfloat y, jfloat p) | ||
| 1354 | { | ||
| 1355 | SDL_LockMutex(Android_ActivityMutex); | ||
| 1356 | |||
| 1357 | Android_OnPen(Android_Window, pen_id_in, button, action, x, y, p); | ||
| 1358 | |||
| 1359 | SDL_UnlockMutex(Android_ActivityMutex); | ||
| 1360 | } | ||
| 1361 | |||
| 1362 | // Accelerometer | ||
| 1363 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)( | ||
| 1364 | JNIEnv *env, jclass jcls, | ||
| 1365 | jfloat x, jfloat y, jfloat z) | ||
| 1366 | { | ||
| 1367 | fLastAccelerometer[0] = x; | ||
| 1368 | fLastAccelerometer[1] = y; | ||
| 1369 | fLastAccelerometer[2] = z; | ||
| 1370 | bHasNewData = true; | ||
| 1371 | } | ||
| 1372 | |||
| 1373 | // Clipboard | ||
| 1374 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)( | ||
| 1375 | JNIEnv *env, jclass jcls) | ||
| 1376 | { | ||
| 1377 | // TODO: compute new mime types | ||
| 1378 | SDL_SendClipboardUpdate(false, NULL, 0); | ||
| 1379 | } | ||
| 1380 | |||
| 1381 | // Low memory | ||
| 1382 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)( | ||
| 1383 | JNIEnv *env, jclass cls) | ||
| 1384 | { | ||
| 1385 | Android_SendLifecycleEvent(SDL_ANDROID_LIFECYCLE_LOWMEMORY); | ||
| 1386 | } | ||
| 1387 | |||
| 1388 | /* Locale | ||
| 1389 | * requires android:configChanges="layoutDirection|locale" in AndroidManifest.xml */ | ||
| 1390 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeLocaleChanged)( | ||
| 1391 | JNIEnv *env, jclass cls) | ||
| 1392 | { | ||
| 1393 | SDL_SendAppEvent(SDL_EVENT_LOCALE_CHANGED); | ||
| 1394 | } | ||
| 1395 | |||
| 1396 | // Dark mode | ||
| 1397 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDarkModeChanged)( | ||
| 1398 | JNIEnv *env, jclass cls, jboolean enabled) | ||
| 1399 | { | ||
| 1400 | Android_SetDarkMode(enabled); | ||
| 1401 | } | ||
| 1402 | |||
| 1403 | // Send Quit event to "SDLThread" thread | ||
| 1404 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSendQuit)( | ||
| 1405 | JNIEnv *env, jclass cls) | ||
| 1406 | { | ||
| 1407 | Android_SendLifecycleEvent(SDL_ANDROID_LIFECYCLE_DESTROY); | ||
| 1408 | } | ||
| 1409 | |||
| 1410 | // Activity ends | ||
| 1411 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)( | ||
| 1412 | JNIEnv *env, jclass cls) | ||
| 1413 | { | ||
| 1414 | const char *str; | ||
| 1415 | |||
| 1416 | if (Android_ActivityMutex) { | ||
| 1417 | SDL_DestroyMutex(Android_ActivityMutex); | ||
| 1418 | Android_ActivityMutex = NULL; | ||
| 1419 | } | ||
| 1420 | |||
| 1421 | if (Android_LifecycleMutex) { | ||
| 1422 | SDL_DestroyMutex(Android_LifecycleMutex); | ||
| 1423 | Android_LifecycleMutex = NULL; | ||
| 1424 | } | ||
| 1425 | |||
| 1426 | if (Android_LifecycleEventSem) { | ||
| 1427 | SDL_DestroySemaphore(Android_LifecycleEventSem); | ||
| 1428 | Android_LifecycleEventSem = NULL; | ||
| 1429 | } | ||
| 1430 | |||
| 1431 | Android_NumLifecycleEvents = 0; | ||
| 1432 | |||
| 1433 | Internal_Android_Destroy_AssetManager(); | ||
| 1434 | |||
| 1435 | str = SDL_GetError(); | ||
| 1436 | if (str && str[0]) { | ||
| 1437 | __android_log_print(ANDROID_LOG_ERROR, "SDL", "SDLActivity thread ends (error=%s)", str); | ||
| 1438 | } else { | ||
| 1439 | __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDLActivity thread ends"); | ||
| 1440 | } | ||
| 1441 | } | ||
| 1442 | |||
| 1443 | // Pause | ||
| 1444 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)( | ||
| 1445 | JNIEnv *env, jclass cls) | ||
| 1446 | { | ||
| 1447 | __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativePause()"); | ||
| 1448 | |||
| 1449 | Android_SendLifecycleEvent(SDL_ANDROID_LIFECYCLE_PAUSE); | ||
| 1450 | } | ||
| 1451 | |||
| 1452 | // Resume | ||
| 1453 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)( | ||
| 1454 | JNIEnv *env, jclass cls) | ||
| 1455 | { | ||
| 1456 | __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeResume()"); | ||
| 1457 | |||
| 1458 | Android_SendLifecycleEvent(SDL_ANDROID_LIFECYCLE_RESUME); | ||
| 1459 | } | ||
| 1460 | |||
| 1461 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeFocusChanged)( | ||
| 1462 | JNIEnv *env, jclass cls, jboolean hasFocus) | ||
| 1463 | { | ||
| 1464 | SDL_LockMutex(Android_ActivityMutex); | ||
| 1465 | |||
| 1466 | if (Android_Window) { | ||
| 1467 | __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeFocusChanged()"); | ||
| 1468 | SDL_SendWindowEvent(Android_Window, (hasFocus ? SDL_EVENT_WINDOW_FOCUS_GAINED : SDL_EVENT_WINDOW_FOCUS_LOST), 0, 0); | ||
| 1469 | } | ||
| 1470 | |||
| 1471 | SDL_UnlockMutex(Android_ActivityMutex); | ||
| 1472 | } | ||
| 1473 | |||
| 1474 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)( | ||
| 1475 | JNIEnv *env, jclass cls, | ||
| 1476 | jstring text, jint newCursorPosition) | ||
| 1477 | { | ||
| 1478 | const char *utftext = (*env)->GetStringUTFChars(env, text, NULL); | ||
| 1479 | |||
| 1480 | SDL_SendKeyboardText(utftext); | ||
| 1481 | |||
| 1482 | (*env)->ReleaseStringUTFChars(env, text, utftext); | ||
| 1483 | } | ||
| 1484 | |||
| 1485 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancodeForUnichar)( | ||
| 1486 | JNIEnv *env, jclass cls, | ||
| 1487 | jchar chUnicode) | ||
| 1488 | { | ||
| 1489 | SDL_SendKeyboardUnicodeKey(0, chUnicode); | ||
| 1490 | } | ||
| 1491 | |||
| 1492 | JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)( | ||
| 1493 | JNIEnv *env, jclass cls, | ||
| 1494 | jstring name) | ||
| 1495 | { | ||
| 1496 | const char *utfname = (*env)->GetStringUTFChars(env, name, NULL); | ||
| 1497 | const char *hint = SDL_GetHint(utfname); | ||
| 1498 | |||
| 1499 | jstring result = (*env)->NewStringUTF(env, hint); | ||
| 1500 | (*env)->ReleaseStringUTFChars(env, name, utfname); | ||
| 1501 | |||
| 1502 | return result; | ||
| 1503 | } | ||
| 1504 | |||
| 1505 | JNIEXPORT jboolean JNICALL SDL_JAVA_INTERFACE(nativeGetHintBoolean)( | ||
| 1506 | JNIEnv *env, jclass cls, | ||
| 1507 | jstring name, jboolean default_value) | ||
| 1508 | { | ||
| 1509 | jboolean result; | ||
| 1510 | |||
| 1511 | const char *utfname = (*env)->GetStringUTFChars(env, name, NULL); | ||
| 1512 | result = SDL_GetHintBoolean(utfname, default_value); | ||
| 1513 | (*env)->ReleaseStringUTFChars(env, name, utfname); | ||
| 1514 | |||
| 1515 | return result; | ||
| 1516 | } | ||
| 1517 | |||
| 1518 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)( | ||
| 1519 | JNIEnv *env, jclass cls, | ||
| 1520 | jstring name, jstring value) | ||
| 1521 | { | ||
| 1522 | const char *utfname = (*env)->GetStringUTFChars(env, name, NULL); | ||
| 1523 | const char *utfvalue = (*env)->GetStringUTFChars(env, value, NULL); | ||
| 1524 | |||
| 1525 | // This is only called at startup, to initialize the environment | ||
| 1526 | // Note that we call setenv() directly to avoid affecting SDL environments | ||
| 1527 | setenv(utfname, utfvalue, 1); // This should NOT be SDL_setenv() | ||
| 1528 | |||
| 1529 | (*env)->ReleaseStringUTFChars(env, name, utfname); | ||
| 1530 | (*env)->ReleaseStringUTFChars(env, value, utfvalue); | ||
| 1531 | } | ||
| 1532 | |||
| 1533 | /******************************************************************************* | ||
| 1534 | Functions called by SDL into Java | ||
| 1535 | *******************************************************************************/ | ||
| 1536 | |||
| 1537 | static SDL_AtomicInt s_active; | ||
| 1538 | struct LocalReferenceHolder | ||
| 1539 | { | ||
| 1540 | JNIEnv *m_env; | ||
| 1541 | const char *m_func; | ||
| 1542 | }; | ||
| 1543 | |||
| 1544 | static struct LocalReferenceHolder LocalReferenceHolder_Setup(const char *func) | ||
| 1545 | { | ||
| 1546 | struct LocalReferenceHolder refholder; | ||
| 1547 | refholder.m_env = NULL; | ||
| 1548 | refholder.m_func = func; | ||
| 1549 | #ifdef DEBUG_JNI | ||
| 1550 | SDL_Log("Entering function %s", func); | ||
| 1551 | #endif | ||
| 1552 | return refholder; | ||
| 1553 | } | ||
| 1554 | |||
| 1555 | static bool LocalReferenceHolder_Init(struct LocalReferenceHolder *refholder, JNIEnv *env) | ||
| 1556 | { | ||
| 1557 | const int capacity = 16; | ||
| 1558 | if ((*env)->PushLocalFrame(env, capacity) < 0) { | ||
| 1559 | SDL_SetError("Failed to allocate enough JVM local references"); | ||
| 1560 | return false; | ||
| 1561 | } | ||
| 1562 | SDL_AtomicIncRef(&s_active); | ||
| 1563 | refholder->m_env = env; | ||
| 1564 | return true; | ||
| 1565 | } | ||
| 1566 | |||
| 1567 | static void LocalReferenceHolder_Cleanup(struct LocalReferenceHolder *refholder) | ||
| 1568 | { | ||
| 1569 | #ifdef DEBUG_JNI | ||
| 1570 | SDL_Log("Leaving function %s", refholder->m_func); | ||
| 1571 | #endif | ||
| 1572 | if (refholder->m_env) { | ||
| 1573 | JNIEnv *env = refholder->m_env; | ||
| 1574 | (*env)->PopLocalFrame(env, NULL); | ||
| 1575 | SDL_AtomicDecRef(&s_active); | ||
| 1576 | } | ||
| 1577 | } | ||
| 1578 | |||
| 1579 | ANativeWindow *Android_JNI_GetNativeWindow(void) | ||
| 1580 | { | ||
| 1581 | ANativeWindow *anw = NULL; | ||
| 1582 | jobject s; | ||
| 1583 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 1584 | |||
| 1585 | s = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetNativeSurface); | ||
| 1586 | if (s) { | ||
| 1587 | anw = ANativeWindow_fromSurface(env, s); | ||
| 1588 | (*env)->DeleteLocalRef(env, s); | ||
| 1589 | } | ||
| 1590 | |||
| 1591 | return anw; | ||
| 1592 | } | ||
| 1593 | |||
| 1594 | void Android_JNI_SetActivityTitle(const char *title) | ||
| 1595 | { | ||
| 1596 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 1597 | |||
| 1598 | jstring jtitle = (*env)->NewStringUTF(env, title); | ||
| 1599 | (*env)->CallStaticBooleanMethod(env, mActivityClass, midSetActivityTitle, jtitle); | ||
| 1600 | (*env)->DeleteLocalRef(env, jtitle); | ||
| 1601 | } | ||
| 1602 | |||
| 1603 | void Android_JNI_SetWindowStyle(bool fullscreen) | ||
| 1604 | { | ||
| 1605 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 1606 | (*env)->CallStaticVoidMethod(env, mActivityClass, midSetWindowStyle, fullscreen ? 1 : 0); | ||
| 1607 | } | ||
| 1608 | |||
| 1609 | void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint) | ||
| 1610 | { | ||
| 1611 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 1612 | |||
| 1613 | jstring jhint = (*env)->NewStringUTF(env, (hint ? hint : "")); | ||
| 1614 | (*env)->CallStaticVoidMethod(env, mActivityClass, midSetOrientation, w, h, (resizable ? 1 : 0), jhint); | ||
| 1615 | (*env)->DeleteLocalRef(env, jhint); | ||
| 1616 | } | ||
| 1617 | |||
| 1618 | SDL_DisplayOrientation Android_JNI_GetDisplayNaturalOrientation(void) | ||
| 1619 | { | ||
| 1620 | return displayNaturalOrientation; | ||
| 1621 | } | ||
| 1622 | |||
| 1623 | SDL_DisplayOrientation Android_JNI_GetDisplayCurrentOrientation(void) | ||
| 1624 | { | ||
| 1625 | return displayCurrentOrientation; | ||
| 1626 | } | ||
| 1627 | |||
| 1628 | void Android_JNI_MinizeWindow(void) | ||
| 1629 | { | ||
| 1630 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 1631 | (*env)->CallStaticVoidMethod(env, mActivityClass, midMinimizeWindow); | ||
| 1632 | } | ||
| 1633 | |||
| 1634 | bool Android_JNI_ShouldMinimizeOnFocusLoss(void) | ||
| 1635 | { | ||
| 1636 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 1637 | return (*env)->CallStaticBooleanMethod(env, mActivityClass, midShouldMinimizeOnFocusLoss); | ||
| 1638 | } | ||
| 1639 | |||
| 1640 | bool Android_JNI_GetAccelerometerValues(float values[3]) | ||
| 1641 | { | ||
| 1642 | bool result = false; | ||
| 1643 | |||
| 1644 | if (bHasNewData) { | ||
| 1645 | int i; | ||
| 1646 | for (i = 0; i < 3; ++i) { | ||
| 1647 | values[i] = fLastAccelerometer[i]; | ||
| 1648 | } | ||
| 1649 | bHasNewData = false; | ||
| 1650 | result = true; | ||
| 1651 | } | ||
| 1652 | |||
| 1653 | return result; | ||
| 1654 | } | ||
| 1655 | |||
| 1656 | /* | ||
| 1657 | * Audio support | ||
| 1658 | */ | ||
| 1659 | void Android_StartAudioHotplug(SDL_AudioDevice **default_playback, SDL_AudioDevice **default_recording) | ||
| 1660 | { | ||
| 1661 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 1662 | // this will fire the callback for each existing device right away (which will eventually SDL_AddAudioDevice), and again later when things change. | ||
| 1663 | (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midRegisterAudioDeviceCallback); | ||
| 1664 | *default_playback = *default_recording = NULL; // !!! FIXME: how do you decide the default device id? | ||
| 1665 | } | ||
| 1666 | |||
| 1667 | void Android_StopAudioHotplug(void) | ||
| 1668 | { | ||
| 1669 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 1670 | (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midUnregisterAudioDeviceCallback); | ||
| 1671 | } | ||
| 1672 | |||
| 1673 | static void Android_JNI_AudioSetThreadPriority(int recording, int device_id) | ||
| 1674 | { | ||
| 1675 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 1676 | (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midAudioSetThreadPriority, recording, device_id); | ||
| 1677 | } | ||
| 1678 | |||
| 1679 | void Android_AudioThreadInit(SDL_AudioDevice *device) | ||
| 1680 | { | ||
| 1681 | Android_JNI_AudioSetThreadPriority((int) device->recording, (int)device->instance_id); | ||
| 1682 | } | ||
| 1683 | |||
| 1684 | // Test for an exception and call SDL_SetError with its detail if one occurs | ||
| 1685 | // If the parameter silent is truthy then SDL_SetError() will not be called. | ||
| 1686 | static bool Android_JNI_ExceptionOccurred(bool silent) | ||
| 1687 | { | ||
| 1688 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 1689 | jthrowable exception; | ||
| 1690 | |||
| 1691 | // Detect mismatch LocalReferenceHolder_Init/Cleanup | ||
| 1692 | SDL_assert(SDL_GetAtomicInt(&s_active) > 0); | ||
| 1693 | |||
| 1694 | exception = (*env)->ExceptionOccurred(env); | ||
| 1695 | if (exception != NULL) { | ||
| 1696 | jmethodID mid; | ||
| 1697 | |||
| 1698 | // Until this happens most JNI operations have undefined behaviour | ||
| 1699 | (*env)->ExceptionClear(env); | ||
| 1700 | |||
| 1701 | if (!silent) { | ||
| 1702 | jclass exceptionClass = (*env)->GetObjectClass(env, exception); | ||
| 1703 | jclass classClass = (*env)->FindClass(env, "java/lang/Class"); | ||
| 1704 | jstring exceptionName; | ||
| 1705 | const char *exceptionNameUTF8; | ||
| 1706 | jstring exceptionMessage; | ||
| 1707 | |||
| 1708 | mid = (*env)->GetMethodID(env, classClass, "getName", "()Ljava/lang/String;"); | ||
| 1709 | exceptionName = (jstring)(*env)->CallObjectMethod(env, exceptionClass, mid); | ||
| 1710 | exceptionNameUTF8 = (*env)->GetStringUTFChars(env, exceptionName, 0); | ||
| 1711 | |||
| 1712 | mid = (*env)->GetMethodID(env, exceptionClass, "getMessage", "()Ljava/lang/String;"); | ||
| 1713 | exceptionMessage = (jstring)(*env)->CallObjectMethod(env, exception, mid); | ||
| 1714 | |||
| 1715 | if (exceptionMessage != NULL) { | ||
| 1716 | const char *exceptionMessageUTF8 = (*env)->GetStringUTFChars(env, exceptionMessage, 0); | ||
| 1717 | SDL_SetError("%s: %s", exceptionNameUTF8, exceptionMessageUTF8); | ||
| 1718 | (*env)->ReleaseStringUTFChars(env, exceptionMessage, exceptionMessageUTF8); | ||
| 1719 | } else { | ||
| 1720 | SDL_SetError("%s", exceptionNameUTF8); | ||
| 1721 | } | ||
| 1722 | |||
| 1723 | (*env)->ReleaseStringUTFChars(env, exceptionName, exceptionNameUTF8); | ||
| 1724 | } | ||
| 1725 | |||
| 1726 | return true; | ||
| 1727 | } | ||
| 1728 | |||
| 1729 | return false; | ||
| 1730 | } | ||
| 1731 | |||
| 1732 | static void Internal_Android_Create_AssetManager(void) | ||
| 1733 | { | ||
| 1734 | |||
| 1735 | struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); | ||
| 1736 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 1737 | jmethodID mid; | ||
| 1738 | jobject context; | ||
| 1739 | jobject javaAssetManager; | ||
| 1740 | |||
| 1741 | if (!LocalReferenceHolder_Init(&refs, env)) { | ||
| 1742 | LocalReferenceHolder_Cleanup(&refs); | ||
| 1743 | return; | ||
| 1744 | } | ||
| 1745 | |||
| 1746 | // context = SDLActivity.getContext(); | ||
| 1747 | context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); | ||
| 1748 | |||
| 1749 | // javaAssetManager = context.getAssets(); | ||
| 1750 | mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context), | ||
| 1751 | "getAssets", "()Landroid/content/res/AssetManager;"); | ||
| 1752 | javaAssetManager = (*env)->CallObjectMethod(env, context, mid); | ||
| 1753 | |||
| 1754 | /** | ||
| 1755 | * Given a Dalvik AssetManager object, obtain the corresponding native AAssetManager | ||
| 1756 | * object. Note that the caller is responsible for obtaining and holding a VM reference | ||
| 1757 | * to the jobject to prevent its being garbage collected while the native object is | ||
| 1758 | * in use. | ||
| 1759 | */ | ||
| 1760 | javaAssetManagerRef = (*env)->NewGlobalRef(env, javaAssetManager); | ||
| 1761 | asset_manager = AAssetManager_fromJava(env, javaAssetManagerRef); | ||
| 1762 | |||
| 1763 | if (!asset_manager) { | ||
| 1764 | (*env)->DeleteGlobalRef(env, javaAssetManagerRef); | ||
| 1765 | Android_JNI_ExceptionOccurred(true); | ||
| 1766 | } | ||
| 1767 | |||
| 1768 | LocalReferenceHolder_Cleanup(&refs); | ||
| 1769 | } | ||
| 1770 | |||
| 1771 | static void Internal_Android_Destroy_AssetManager(void) | ||
| 1772 | { | ||
| 1773 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 1774 | |||
| 1775 | if (asset_manager) { | ||
| 1776 | (*env)->DeleteGlobalRef(env, javaAssetManagerRef); | ||
| 1777 | asset_manager = NULL; | ||
| 1778 | } | ||
| 1779 | } | ||
| 1780 | |||
| 1781 | bool Android_JNI_FileOpen(void **puserdata, const char *fileName, const char *mode) | ||
| 1782 | { | ||
| 1783 | SDL_assert(puserdata != NULL); | ||
| 1784 | |||
| 1785 | AAsset *asset = NULL; | ||
| 1786 | *puserdata = NULL; | ||
| 1787 | |||
| 1788 | if (!asset_manager) { | ||
| 1789 | Internal_Android_Create_AssetManager(); | ||
| 1790 | } | ||
| 1791 | |||
| 1792 | if (!asset_manager) { | ||
| 1793 | return SDL_SetError("Couldn't create asset manager"); | ||
| 1794 | } | ||
| 1795 | |||
| 1796 | asset = AAssetManager_open(asset_manager, fileName, AASSET_MODE_UNKNOWN); | ||
| 1797 | if (!asset) { | ||
| 1798 | return SDL_SetError("Couldn't open asset '%s'", fileName); | ||
| 1799 | } | ||
| 1800 | |||
| 1801 | *puserdata = (void *)asset; | ||
| 1802 | return true; | ||
| 1803 | } | ||
| 1804 | |||
| 1805 | size_t Android_JNI_FileRead(void *userdata, void *buffer, size_t size, SDL_IOStatus *status) | ||
| 1806 | { | ||
| 1807 | const int bytes = AAsset_read((AAsset *)userdata, buffer, size); | ||
| 1808 | if (bytes < 0) { | ||
| 1809 | SDL_SetError("AAsset_read() failed"); | ||
| 1810 | return 0; | ||
| 1811 | } | ||
| 1812 | return (size_t)bytes; | ||
| 1813 | } | ||
| 1814 | |||
| 1815 | size_t Android_JNI_FileWrite(void *userdata, const void *buffer, size_t size, SDL_IOStatus *status) | ||
| 1816 | { | ||
| 1817 | SDL_SetError("Cannot write to Android package filesystem"); | ||
| 1818 | return 0; | ||
| 1819 | } | ||
| 1820 | |||
| 1821 | Sint64 Android_JNI_FileSize(void *userdata) | ||
| 1822 | { | ||
| 1823 | return (Sint64) AAsset_getLength64((AAsset *)userdata); | ||
| 1824 | } | ||
| 1825 | |||
| 1826 | Sint64 Android_JNI_FileSeek(void *userdata, Sint64 offset, SDL_IOWhence whence) | ||
| 1827 | { | ||
| 1828 | return (Sint64) AAsset_seek64((AAsset *)userdata, offset, (int)whence); | ||
| 1829 | } | ||
| 1830 | |||
| 1831 | bool Android_JNI_FileClose(void *userdata) | ||
| 1832 | { | ||
| 1833 | AAsset_close((AAsset *)userdata); | ||
| 1834 | return true; | ||
| 1835 | } | ||
| 1836 | |||
| 1837 | bool Android_JNI_SetClipboardText(const char *text) | ||
| 1838 | { | ||
| 1839 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 1840 | jstring string = (*env)->NewStringUTF(env, text); | ||
| 1841 | (*env)->CallStaticVoidMethod(env, mActivityClass, midClipboardSetText, string); | ||
| 1842 | (*env)->DeleteLocalRef(env, string); | ||
| 1843 | return true; | ||
| 1844 | } | ||
| 1845 | |||
| 1846 | char *Android_JNI_GetClipboardText(void) | ||
| 1847 | { | ||
| 1848 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 1849 | char *text = NULL; | ||
| 1850 | jstring string; | ||
| 1851 | |||
| 1852 | string = (*env)->CallStaticObjectMethod(env, mActivityClass, midClipboardGetText); | ||
| 1853 | if (string) { | ||
| 1854 | const char *utf = (*env)->GetStringUTFChars(env, string, 0); | ||
| 1855 | if (utf) { | ||
| 1856 | text = SDL_strdup(utf); | ||
| 1857 | (*env)->ReleaseStringUTFChars(env, string, utf); | ||
| 1858 | } | ||
| 1859 | (*env)->DeleteLocalRef(env, string); | ||
| 1860 | } | ||
| 1861 | |||
| 1862 | return (!text) ? SDL_strdup("") : text; | ||
| 1863 | } | ||
| 1864 | |||
| 1865 | bool Android_JNI_HasClipboardText(void) | ||
| 1866 | { | ||
| 1867 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 1868 | return (*env)->CallStaticBooleanMethod(env, mActivityClass, midClipboardHasText); | ||
| 1869 | } | ||
| 1870 | |||
| 1871 | /* returns 0 on success or -1 on error (others undefined then) | ||
| 1872 | * returns truthy or falsy value in plugged, charged and battery | ||
| 1873 | * returns the value in seconds and percent or -1 if not available | ||
| 1874 | */ | ||
| 1875 | int Android_JNI_GetPowerInfo(int *plugged, int *charged, int *battery, int *seconds, int *percent) | ||
| 1876 | { | ||
| 1877 | struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); | ||
| 1878 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 1879 | jmethodID mid; | ||
| 1880 | jobject context; | ||
| 1881 | jstring action; | ||
| 1882 | jclass cls; | ||
| 1883 | jobject filter; | ||
| 1884 | jobject intent; | ||
| 1885 | jstring iname; | ||
| 1886 | jmethodID imid; | ||
| 1887 | jstring bname; | ||
| 1888 | jmethodID bmid; | ||
| 1889 | if (!LocalReferenceHolder_Init(&refs, env)) { | ||
| 1890 | LocalReferenceHolder_Cleanup(&refs); | ||
| 1891 | return -1; | ||
| 1892 | } | ||
| 1893 | |||
| 1894 | // context = SDLActivity.getContext(); | ||
| 1895 | context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); | ||
| 1896 | |||
| 1897 | action = (*env)->NewStringUTF(env, "android.intent.action.BATTERY_CHANGED"); | ||
| 1898 | |||
| 1899 | cls = (*env)->FindClass(env, "android/content/IntentFilter"); | ||
| 1900 | |||
| 1901 | mid = (*env)->GetMethodID(env, cls, "<init>", "(Ljava/lang/String;)V"); | ||
| 1902 | filter = (*env)->NewObject(env, cls, mid, action); | ||
| 1903 | |||
| 1904 | (*env)->DeleteLocalRef(env, action); | ||
| 1905 | |||
| 1906 | mid = (*env)->GetMethodID(env, mActivityClass, "registerReceiver", "(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;"); | ||
| 1907 | intent = (*env)->CallObjectMethod(env, context, mid, NULL, filter); | ||
| 1908 | |||
| 1909 | (*env)->DeleteLocalRef(env, filter); | ||
| 1910 | |||
| 1911 | cls = (*env)->GetObjectClass(env, intent); | ||
| 1912 | |||
| 1913 | imid = (*env)->GetMethodID(env, cls, "getIntExtra", "(Ljava/lang/String;I)I"); | ||
| 1914 | |||
| 1915 | // Watch out for C89 scoping rules because of the macro | ||
| 1916 | #define GET_INT_EXTRA(var, key) \ | ||
| 1917 | int var; \ | ||
| 1918 | iname = (*env)->NewStringUTF(env, key); \ | ||
| 1919 | (var) = (*env)->CallIntMethod(env, intent, imid, iname, -1); \ | ||
| 1920 | (*env)->DeleteLocalRef(env, iname); | ||
| 1921 | |||
| 1922 | bmid = (*env)->GetMethodID(env, cls, "getBooleanExtra", "(Ljava/lang/String;Z)Z"); | ||
| 1923 | |||
| 1924 | // Watch out for C89 scoping rules because of the macro | ||
| 1925 | #define GET_BOOL_EXTRA(var, key) \ | ||
| 1926 | int var; \ | ||
| 1927 | bname = (*env)->NewStringUTF(env, key); \ | ||
| 1928 | (var) = (*env)->CallBooleanMethod(env, intent, bmid, bname, JNI_FALSE); \ | ||
| 1929 | (*env)->DeleteLocalRef(env, bname); | ||
| 1930 | |||
| 1931 | if (plugged) { | ||
| 1932 | // Watch out for C89 scoping rules because of the macro | ||
| 1933 | GET_INT_EXTRA(plug, "plugged") // == BatteryManager.EXTRA_PLUGGED (API 5) | ||
| 1934 | if (plug == -1) { | ||
| 1935 | LocalReferenceHolder_Cleanup(&refs); | ||
| 1936 | return -1; | ||
| 1937 | } | ||
| 1938 | // 1 == BatteryManager.BATTERY_PLUGGED_AC | ||
| 1939 | // 2 == BatteryManager.BATTERY_PLUGGED_USB | ||
| 1940 | *plugged = (0 < plug) ? 1 : 0; | ||
| 1941 | } | ||
| 1942 | |||
| 1943 | if (charged) { | ||
| 1944 | // Watch out for C89 scoping rules because of the macro | ||
| 1945 | GET_INT_EXTRA(status, "status") // == BatteryManager.EXTRA_STATUS (API 5) | ||
| 1946 | if (status == -1) { | ||
| 1947 | LocalReferenceHolder_Cleanup(&refs); | ||
| 1948 | return -1; | ||
| 1949 | } | ||
| 1950 | // 5 == BatteryManager.BATTERY_STATUS_FULL | ||
| 1951 | *charged = (status == 5) ? 1 : 0; | ||
| 1952 | } | ||
| 1953 | |||
| 1954 | if (battery) { | ||
| 1955 | GET_BOOL_EXTRA(present, "present") // == BatteryManager.EXTRA_PRESENT (API 5) | ||
| 1956 | *battery = present ? 1 : 0; | ||
| 1957 | } | ||
| 1958 | |||
| 1959 | if (seconds) { | ||
| 1960 | *seconds = -1; // not possible | ||
| 1961 | } | ||
| 1962 | |||
| 1963 | if (percent) { | ||
| 1964 | int level; | ||
| 1965 | int scale; | ||
| 1966 | |||
| 1967 | // Watch out for C89 scoping rules because of the macro | ||
| 1968 | { | ||
| 1969 | GET_INT_EXTRA(level_temp, "level") // == BatteryManager.EXTRA_LEVEL (API 5) | ||
| 1970 | level = level_temp; | ||
| 1971 | } | ||
| 1972 | // Watch out for C89 scoping rules because of the macro | ||
| 1973 | { | ||
| 1974 | GET_INT_EXTRA(scale_temp, "scale") // == BatteryManager.EXTRA_SCALE (API 5) | ||
| 1975 | scale = scale_temp; | ||
| 1976 | } | ||
| 1977 | |||
| 1978 | if ((level == -1) || (scale == -1)) { | ||
| 1979 | LocalReferenceHolder_Cleanup(&refs); | ||
| 1980 | return -1; | ||
| 1981 | } | ||
| 1982 | *percent = level * 100 / scale; | ||
| 1983 | } | ||
| 1984 | |||
| 1985 | (*env)->DeleteLocalRef(env, intent); | ||
| 1986 | |||
| 1987 | LocalReferenceHolder_Cleanup(&refs); | ||
| 1988 | return 0; | ||
| 1989 | } | ||
| 1990 | |||
| 1991 | // Add all touch devices | ||
| 1992 | void Android_JNI_InitTouch(void) | ||
| 1993 | { | ||
| 1994 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 1995 | (*env)->CallStaticVoidMethod(env, mActivityClass, midInitTouch); | ||
| 1996 | } | ||
| 1997 | |||
| 1998 | void Android_JNI_PollInputDevices(void) | ||
| 1999 | { | ||
| 2000 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2001 | (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midPollInputDevices); | ||
| 2002 | } | ||
| 2003 | |||
| 2004 | void Android_JNI_PollHapticDevices(void) | ||
| 2005 | { | ||
| 2006 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2007 | (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midPollHapticDevices); | ||
| 2008 | } | ||
| 2009 | |||
| 2010 | void Android_JNI_HapticRun(int device_id, float intensity, int length) | ||
| 2011 | { | ||
| 2012 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2013 | (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midHapticRun, device_id, intensity, length); | ||
| 2014 | } | ||
| 2015 | |||
| 2016 | void Android_JNI_HapticRumble(int device_id, float low_frequency_intensity, float high_frequency_intensity, int length) | ||
| 2017 | { | ||
| 2018 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2019 | (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midHapticRumble, device_id, low_frequency_intensity, high_frequency_intensity, length); | ||
| 2020 | } | ||
| 2021 | |||
| 2022 | void Android_JNI_HapticStop(int device_id) | ||
| 2023 | { | ||
| 2024 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2025 | (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midHapticStop, device_id); | ||
| 2026 | } | ||
| 2027 | |||
| 2028 | // See SDLActivity.java for constants. | ||
| 2029 | #define COMMAND_SET_KEEP_SCREEN_ON 5 | ||
| 2030 | |||
| 2031 | bool SDL_SendAndroidMessage(Uint32 command, int param) | ||
| 2032 | { | ||
| 2033 | if (command < 0x8000) { | ||
| 2034 | return SDL_InvalidParamError("command"); | ||
| 2035 | } | ||
| 2036 | return Android_JNI_SendMessage(command, param); | ||
| 2037 | } | ||
| 2038 | |||
| 2039 | // sends message to be handled on the UI event dispatch thread | ||
| 2040 | bool Android_JNI_SendMessage(int command, int param) | ||
| 2041 | { | ||
| 2042 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2043 | return (*env)->CallStaticBooleanMethod(env, mActivityClass, midSendMessage, command, param); | ||
| 2044 | } | ||
| 2045 | |||
| 2046 | bool Android_JNI_SuspendScreenSaver(bool suspend) | ||
| 2047 | { | ||
| 2048 | return Android_JNI_SendMessage(COMMAND_SET_KEEP_SCREEN_ON, (suspend == false) ? 0 : 1); | ||
| 2049 | } | ||
| 2050 | |||
| 2051 | void Android_JNI_ShowScreenKeyboard(int input_type, SDL_Rect *inputRect) | ||
| 2052 | { | ||
| 2053 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2054 | (*env)->CallStaticBooleanMethod(env, mActivityClass, midShowTextInput, | ||
| 2055 | input_type, | ||
| 2056 | inputRect->x, | ||
| 2057 | inputRect->y, | ||
| 2058 | inputRect->w, | ||
| 2059 | inputRect->h); | ||
| 2060 | } | ||
| 2061 | |||
| 2062 | void Android_JNI_HideScreenKeyboard(void) | ||
| 2063 | { | ||
| 2064 | // has to match Activity constant | ||
| 2065 | const int COMMAND_TEXTEDIT_HIDE = 3; | ||
| 2066 | Android_JNI_SendMessage(COMMAND_TEXTEDIT_HIDE, 0); | ||
| 2067 | } | ||
| 2068 | |||
| 2069 | bool Android_JNI_IsScreenKeyboardShown(void) | ||
| 2070 | { | ||
| 2071 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2072 | jboolean is_shown = 0; | ||
| 2073 | is_shown = (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsScreenKeyboardShown); | ||
| 2074 | return is_shown; | ||
| 2075 | } | ||
| 2076 | |||
| 2077 | bool Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID) | ||
| 2078 | { | ||
| 2079 | JNIEnv *env; | ||
| 2080 | jclass clazz; | ||
| 2081 | jmethodID mid; | ||
| 2082 | jobject context; | ||
| 2083 | jstring title; | ||
| 2084 | jstring message; | ||
| 2085 | jintArray button_flags; | ||
| 2086 | jintArray button_ids; | ||
| 2087 | jobjectArray button_texts; | ||
| 2088 | jintArray colors; | ||
| 2089 | jobject text; | ||
| 2090 | jint temp; | ||
| 2091 | int i; | ||
| 2092 | |||
| 2093 | env = Android_JNI_GetEnv(); | ||
| 2094 | |||
| 2095 | // convert parameters | ||
| 2096 | |||
| 2097 | clazz = (*env)->FindClass(env, "java/lang/String"); | ||
| 2098 | |||
| 2099 | title = (*env)->NewStringUTF(env, messageboxdata->title); | ||
| 2100 | message = (*env)->NewStringUTF(env, messageboxdata->message); | ||
| 2101 | |||
| 2102 | button_flags = (*env)->NewIntArray(env, messageboxdata->numbuttons); | ||
| 2103 | button_ids = (*env)->NewIntArray(env, messageboxdata->numbuttons); | ||
| 2104 | button_texts = (*env)->NewObjectArray(env, messageboxdata->numbuttons, | ||
| 2105 | clazz, NULL); | ||
| 2106 | for (i = 0; i < messageboxdata->numbuttons; ++i) { | ||
| 2107 | const SDL_MessageBoxButtonData *sdlButton; | ||
| 2108 | |||
| 2109 | if (messageboxdata->flags & SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT) { | ||
| 2110 | sdlButton = &messageboxdata->buttons[messageboxdata->numbuttons - 1 - i]; | ||
| 2111 | } else { | ||
| 2112 | sdlButton = &messageboxdata->buttons[i]; | ||
| 2113 | } | ||
| 2114 | |||
| 2115 | temp = sdlButton->flags; | ||
| 2116 | (*env)->SetIntArrayRegion(env, button_flags, i, 1, &temp); | ||
| 2117 | temp = sdlButton->buttonID; | ||
| 2118 | (*env)->SetIntArrayRegion(env, button_ids, i, 1, &temp); | ||
| 2119 | text = (*env)->NewStringUTF(env, sdlButton->text); | ||
| 2120 | (*env)->SetObjectArrayElement(env, button_texts, i, text); | ||
| 2121 | (*env)->DeleteLocalRef(env, text); | ||
| 2122 | } | ||
| 2123 | |||
| 2124 | if (messageboxdata->colorScheme) { | ||
| 2125 | colors = (*env)->NewIntArray(env, SDL_MESSAGEBOX_COLOR_COUNT); | ||
| 2126 | for (i = 0; i < SDL_MESSAGEBOX_COLOR_COUNT; ++i) { | ||
| 2127 | temp = (0xFFU << 24) | | ||
| 2128 | (messageboxdata->colorScheme->colors[i].r << 16) | | ||
| 2129 | (messageboxdata->colorScheme->colors[i].g << 8) | | ||
| 2130 | (messageboxdata->colorScheme->colors[i].b << 0); | ||
| 2131 | (*env)->SetIntArrayRegion(env, colors, i, 1, &temp); | ||
| 2132 | } | ||
| 2133 | } else { | ||
| 2134 | colors = NULL; | ||
| 2135 | } | ||
| 2136 | |||
| 2137 | (*env)->DeleteLocalRef(env, clazz); | ||
| 2138 | |||
| 2139 | // context = SDLActivity.getContext(); | ||
| 2140 | context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); | ||
| 2141 | |||
| 2142 | clazz = (*env)->GetObjectClass(env, context); | ||
| 2143 | |||
| 2144 | mid = (*env)->GetMethodID(env, clazz, | ||
| 2145 | "messageboxShowMessageBox", "(ILjava/lang/String;Ljava/lang/String;[I[I[Ljava/lang/String;[I)I"); | ||
| 2146 | *buttonID = (*env)->CallIntMethod(env, context, mid, | ||
| 2147 | messageboxdata->flags, | ||
| 2148 | title, | ||
| 2149 | message, | ||
| 2150 | button_flags, | ||
| 2151 | button_ids, | ||
| 2152 | button_texts, | ||
| 2153 | colors); | ||
| 2154 | |||
| 2155 | (*env)->DeleteLocalRef(env, context); | ||
| 2156 | (*env)->DeleteLocalRef(env, clazz); | ||
| 2157 | |||
| 2158 | // delete parameters | ||
| 2159 | |||
| 2160 | (*env)->DeleteLocalRef(env, title); | ||
| 2161 | (*env)->DeleteLocalRef(env, message); | ||
| 2162 | (*env)->DeleteLocalRef(env, button_flags); | ||
| 2163 | (*env)->DeleteLocalRef(env, button_ids); | ||
| 2164 | (*env)->DeleteLocalRef(env, button_texts); | ||
| 2165 | (*env)->DeleteLocalRef(env, colors); | ||
| 2166 | |||
| 2167 | return true; | ||
| 2168 | } | ||
| 2169 | |||
| 2170 | /* | ||
| 2171 | ////////////////////////////////////////////////////////////////////////////// | ||
| 2172 | // | ||
| 2173 | // Functions exposed to SDL applications in SDL_system.h | ||
| 2174 | ////////////////////////////////////////////////////////////////////////////// | ||
| 2175 | */ | ||
| 2176 | |||
| 2177 | void *SDL_GetAndroidJNIEnv(void) | ||
| 2178 | { | ||
| 2179 | return Android_JNI_GetEnv(); | ||
| 2180 | } | ||
| 2181 | |||
| 2182 | void *SDL_GetAndroidActivity(void) | ||
| 2183 | { | ||
| 2184 | // See SDL_system.h for caveats on using this function. | ||
| 2185 | |||
| 2186 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2187 | if (!env) { | ||
| 2188 | return NULL; | ||
| 2189 | } | ||
| 2190 | |||
| 2191 | // return SDLActivity.getContext(); | ||
| 2192 | return (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); | ||
| 2193 | } | ||
| 2194 | |||
| 2195 | int SDL_GetAndroidSDKVersion(void) | ||
| 2196 | { | ||
| 2197 | static int sdk_version; | ||
| 2198 | if (!sdk_version) { | ||
| 2199 | char sdk[PROP_VALUE_MAX] = { 0 }; | ||
| 2200 | if (__system_property_get("ro.build.version.sdk", sdk) != 0) { | ||
| 2201 | sdk_version = SDL_atoi(sdk); | ||
| 2202 | } | ||
| 2203 | } | ||
| 2204 | return sdk_version; | ||
| 2205 | } | ||
| 2206 | |||
| 2207 | bool SDL_IsAndroidTablet(void) | ||
| 2208 | { | ||
| 2209 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2210 | return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsTablet); | ||
| 2211 | } | ||
| 2212 | |||
| 2213 | bool SDL_IsAndroidTV(void) | ||
| 2214 | { | ||
| 2215 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2216 | return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsAndroidTV); | ||
| 2217 | } | ||
| 2218 | |||
| 2219 | bool SDL_IsChromebook(void) | ||
| 2220 | { | ||
| 2221 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2222 | return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsChromebook); | ||
| 2223 | } | ||
| 2224 | |||
| 2225 | bool SDL_IsDeXMode(void) | ||
| 2226 | { | ||
| 2227 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2228 | return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsDeXMode); | ||
| 2229 | } | ||
| 2230 | |||
| 2231 | void SDL_SendAndroidBackButton(void) | ||
| 2232 | { | ||
| 2233 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2234 | (*env)->CallStaticVoidMethod(env, mActivityClass, midManualBackButton); | ||
| 2235 | } | ||
| 2236 | |||
| 2237 | const char *SDL_GetAndroidInternalStoragePath(void) | ||
| 2238 | { | ||
| 2239 | static char *s_AndroidInternalFilesPath = NULL; | ||
| 2240 | |||
| 2241 | if (!s_AndroidInternalFilesPath) { | ||
| 2242 | struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); | ||
| 2243 | jmethodID mid; | ||
| 2244 | jobject context; | ||
| 2245 | jobject fileObject; | ||
| 2246 | jstring pathString; | ||
| 2247 | const char *path; | ||
| 2248 | |||
| 2249 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2250 | if (!LocalReferenceHolder_Init(&refs, env)) { | ||
| 2251 | LocalReferenceHolder_Cleanup(&refs); | ||
| 2252 | return NULL; | ||
| 2253 | } | ||
| 2254 | |||
| 2255 | // context = SDLActivity.getContext(); | ||
| 2256 | context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); | ||
| 2257 | if (!context) { | ||
| 2258 | SDL_SetError("Couldn't get Android context!"); | ||
| 2259 | LocalReferenceHolder_Cleanup(&refs); | ||
| 2260 | return NULL; | ||
| 2261 | } | ||
| 2262 | |||
| 2263 | // fileObj = context.getFilesDir(); | ||
| 2264 | mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context), | ||
| 2265 | "getFilesDir", "()Ljava/io/File;"); | ||
| 2266 | fileObject = (*env)->CallObjectMethod(env, context, mid); | ||
| 2267 | if (!fileObject) { | ||
| 2268 | SDL_SetError("Couldn't get internal directory"); | ||
| 2269 | LocalReferenceHolder_Cleanup(&refs); | ||
| 2270 | return NULL; | ||
| 2271 | } | ||
| 2272 | |||
| 2273 | // path = fileObject.getCanonicalPath(); | ||
| 2274 | mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, fileObject), | ||
| 2275 | "getCanonicalPath", "()Ljava/lang/String;"); | ||
| 2276 | pathString = (jstring)(*env)->CallObjectMethod(env, fileObject, mid); | ||
| 2277 | if (Android_JNI_ExceptionOccurred(false)) { | ||
| 2278 | LocalReferenceHolder_Cleanup(&refs); | ||
| 2279 | return NULL; | ||
| 2280 | } | ||
| 2281 | |||
| 2282 | path = (*env)->GetStringUTFChars(env, pathString, NULL); | ||
| 2283 | s_AndroidInternalFilesPath = SDL_strdup(path); | ||
| 2284 | (*env)->ReleaseStringUTFChars(env, pathString, path); | ||
| 2285 | |||
| 2286 | LocalReferenceHolder_Cleanup(&refs); | ||
| 2287 | } | ||
| 2288 | return s_AndroidInternalFilesPath; | ||
| 2289 | } | ||
| 2290 | |||
| 2291 | Uint32 SDL_GetAndroidExternalStorageState(void) | ||
| 2292 | { | ||
| 2293 | struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); | ||
| 2294 | jmethodID mid; | ||
| 2295 | jclass cls; | ||
| 2296 | jstring stateString; | ||
| 2297 | const char *state_string; | ||
| 2298 | Uint32 stateFlags; | ||
| 2299 | |||
| 2300 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2301 | if (!LocalReferenceHolder_Init(&refs, env)) { | ||
| 2302 | LocalReferenceHolder_Cleanup(&refs); | ||
| 2303 | return 0; | ||
| 2304 | } | ||
| 2305 | |||
| 2306 | cls = (*env)->FindClass(env, "android/os/Environment"); | ||
| 2307 | mid = (*env)->GetStaticMethodID(env, cls, | ||
| 2308 | "getExternalStorageState", "()Ljava/lang/String;"); | ||
| 2309 | stateString = (jstring)(*env)->CallStaticObjectMethod(env, cls, mid); | ||
| 2310 | |||
| 2311 | state_string = (*env)->GetStringUTFChars(env, stateString, NULL); | ||
| 2312 | |||
| 2313 | // Print an info message so people debugging know the storage state | ||
| 2314 | __android_log_print(ANDROID_LOG_INFO, "SDL", "external storage state: %s", state_string); | ||
| 2315 | |||
| 2316 | if (SDL_strcmp(state_string, "mounted") == 0) { | ||
| 2317 | stateFlags = SDL_ANDROID_EXTERNAL_STORAGE_READ | | ||
| 2318 | SDL_ANDROID_EXTERNAL_STORAGE_WRITE; | ||
| 2319 | } else if (SDL_strcmp(state_string, "mounted_ro") == 0) { | ||
| 2320 | stateFlags = SDL_ANDROID_EXTERNAL_STORAGE_READ; | ||
| 2321 | } else { | ||
| 2322 | stateFlags = 0; | ||
| 2323 | } | ||
| 2324 | (*env)->ReleaseStringUTFChars(env, stateString, state_string); | ||
| 2325 | |||
| 2326 | LocalReferenceHolder_Cleanup(&refs); | ||
| 2327 | |||
| 2328 | return stateFlags; | ||
| 2329 | } | ||
| 2330 | |||
| 2331 | const char *SDL_GetAndroidExternalStoragePath(void) | ||
| 2332 | { | ||
| 2333 | static char *s_AndroidExternalFilesPath = NULL; | ||
| 2334 | |||
| 2335 | if (!s_AndroidExternalFilesPath) { | ||
| 2336 | struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); | ||
| 2337 | jmethodID mid; | ||
| 2338 | jobject context; | ||
| 2339 | jobject fileObject; | ||
| 2340 | jstring pathString; | ||
| 2341 | const char *path; | ||
| 2342 | |||
| 2343 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2344 | if (!LocalReferenceHolder_Init(&refs, env)) { | ||
| 2345 | LocalReferenceHolder_Cleanup(&refs); | ||
| 2346 | return NULL; | ||
| 2347 | } | ||
| 2348 | |||
| 2349 | // context = SDLActivity.getContext(); | ||
| 2350 | context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); | ||
| 2351 | |||
| 2352 | // fileObj = context.getExternalFilesDir(); | ||
| 2353 | mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context), | ||
| 2354 | "getExternalFilesDir", "(Ljava/lang/String;)Ljava/io/File;"); | ||
| 2355 | fileObject = (*env)->CallObjectMethod(env, context, mid, NULL); | ||
| 2356 | if (!fileObject) { | ||
| 2357 | SDL_SetError("Couldn't get external directory"); | ||
| 2358 | LocalReferenceHolder_Cleanup(&refs); | ||
| 2359 | return NULL; | ||
| 2360 | } | ||
| 2361 | |||
| 2362 | // path = fileObject.getAbsolutePath(); | ||
| 2363 | mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, fileObject), | ||
| 2364 | "getAbsolutePath", "()Ljava/lang/String;"); | ||
| 2365 | pathString = (jstring)(*env)->CallObjectMethod(env, fileObject, mid); | ||
| 2366 | |||
| 2367 | path = (*env)->GetStringUTFChars(env, pathString, NULL); | ||
| 2368 | s_AndroidExternalFilesPath = SDL_strdup(path); | ||
| 2369 | (*env)->ReleaseStringUTFChars(env, pathString, path); | ||
| 2370 | |||
| 2371 | LocalReferenceHolder_Cleanup(&refs); | ||
| 2372 | } | ||
| 2373 | return s_AndroidExternalFilesPath; | ||
| 2374 | } | ||
| 2375 | |||
| 2376 | const char *SDL_GetAndroidCachePath(void) | ||
| 2377 | { | ||
| 2378 | // !!! FIXME: lots of duplication with SDL_GetAndroidExternalStoragePath and SDL_GetAndroidInternalStoragePath; consolidate these functions! | ||
| 2379 | static char *s_AndroidCachePath = NULL; | ||
| 2380 | |||
| 2381 | if (!s_AndroidCachePath) { | ||
| 2382 | struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); | ||
| 2383 | jmethodID mid; | ||
| 2384 | jobject context; | ||
| 2385 | jobject fileObject; | ||
| 2386 | jstring pathString; | ||
| 2387 | const char *path; | ||
| 2388 | |||
| 2389 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2390 | if (!LocalReferenceHolder_Init(&refs, env)) { | ||
| 2391 | LocalReferenceHolder_Cleanup(&refs); | ||
| 2392 | return NULL; | ||
| 2393 | } | ||
| 2394 | |||
| 2395 | // context = SDLActivity.getContext(); | ||
| 2396 | context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); | ||
| 2397 | |||
| 2398 | // fileObj = context.getExternalFilesDir(); | ||
| 2399 | mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context), | ||
| 2400 | "getCacheDir", "()Ljava/io/File;"); | ||
| 2401 | fileObject = (*env)->CallObjectMethod(env, context, mid, NULL); | ||
| 2402 | if (!fileObject) { | ||
| 2403 | SDL_SetError("Couldn't get cache directory"); | ||
| 2404 | LocalReferenceHolder_Cleanup(&refs); | ||
| 2405 | return NULL; | ||
| 2406 | } | ||
| 2407 | |||
| 2408 | // path = fileObject.getAbsolutePath(); | ||
| 2409 | mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, fileObject), | ||
| 2410 | "getAbsolutePath", "()Ljava/lang/String;"); | ||
| 2411 | pathString = (jstring)(*env)->CallObjectMethod(env, fileObject, mid); | ||
| 2412 | |||
| 2413 | path = (*env)->GetStringUTFChars(env, pathString, NULL); | ||
| 2414 | s_AndroidCachePath = SDL_strdup(path); | ||
| 2415 | (*env)->ReleaseStringUTFChars(env, pathString, path); | ||
| 2416 | |||
| 2417 | LocalReferenceHolder_Cleanup(&refs); | ||
| 2418 | } | ||
| 2419 | return s_AndroidCachePath; | ||
| 2420 | } | ||
| 2421 | |||
| 2422 | bool SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xOffset, int yOffset) | ||
| 2423 | { | ||
| 2424 | return Android_JNI_ShowToast(message, duration, gravity, xOffset, yOffset); | ||
| 2425 | } | ||
| 2426 | |||
| 2427 | void Android_JNI_GetManifestEnvironmentVariables(void) | ||
| 2428 | { | ||
| 2429 | if (!mActivityClass || !midGetManifestEnvironmentVariables) { | ||
| 2430 | __android_log_print(ANDROID_LOG_WARN, "SDL", "Request to get environment variables before JNI is ready"); | ||
| 2431 | return; | ||
| 2432 | } | ||
| 2433 | |||
| 2434 | if (!bHasEnvironmentVariables) { | ||
| 2435 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2436 | bool ret = (*env)->CallStaticBooleanMethod(env, mActivityClass, midGetManifestEnvironmentVariables); | ||
| 2437 | if (ret) { | ||
| 2438 | bHasEnvironmentVariables = true; | ||
| 2439 | } | ||
| 2440 | } | ||
| 2441 | } | ||
| 2442 | |||
| 2443 | int Android_JNI_CreateCustomCursor(SDL_Surface *surface, int hot_x, int hot_y) | ||
| 2444 | { | ||
| 2445 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2446 | int custom_cursor = 0; | ||
| 2447 | jintArray pixels; | ||
| 2448 | pixels = (*env)->NewIntArray(env, surface->w * surface->h); | ||
| 2449 | if (pixels) { | ||
| 2450 | (*env)->SetIntArrayRegion(env, pixels, 0, surface->w * surface->h, (int *)surface->pixels); | ||
| 2451 | custom_cursor = (*env)->CallStaticIntMethod(env, mActivityClass, midCreateCustomCursor, pixels, surface->w, surface->h, hot_x, hot_y); | ||
| 2452 | (*env)->DeleteLocalRef(env, pixels); | ||
| 2453 | } else { | ||
| 2454 | SDL_OutOfMemory(); | ||
| 2455 | } | ||
| 2456 | return custom_cursor; | ||
| 2457 | } | ||
| 2458 | |||
| 2459 | void Android_JNI_DestroyCustomCursor(int cursorID) | ||
| 2460 | { | ||
| 2461 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2462 | (*env)->CallStaticVoidMethod(env, mActivityClass, midDestroyCustomCursor, cursorID); | ||
| 2463 | } | ||
| 2464 | |||
| 2465 | bool Android_JNI_SetCustomCursor(int cursorID) | ||
| 2466 | { | ||
| 2467 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2468 | return (*env)->CallStaticBooleanMethod(env, mActivityClass, midSetCustomCursor, cursorID); | ||
| 2469 | } | ||
| 2470 | |||
| 2471 | bool Android_JNI_SetSystemCursor(int cursorID) | ||
| 2472 | { | ||
| 2473 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2474 | return (*env)->CallStaticBooleanMethod(env, mActivityClass, midSetSystemCursor, cursorID); | ||
| 2475 | } | ||
| 2476 | |||
| 2477 | bool Android_JNI_SupportsRelativeMouse(void) | ||
| 2478 | { | ||
| 2479 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2480 | return (*env)->CallStaticBooleanMethod(env, mActivityClass, midSupportsRelativeMouse); | ||
| 2481 | } | ||
| 2482 | |||
| 2483 | bool Android_JNI_SetRelativeMouseEnabled(bool enabled) | ||
| 2484 | { | ||
| 2485 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2486 | return (*env)->CallStaticBooleanMethod(env, mActivityClass, midSetRelativeMouseEnabled, (enabled == 1)); | ||
| 2487 | } | ||
| 2488 | |||
| 2489 | typedef struct NativePermissionRequestInfo | ||
| 2490 | { | ||
| 2491 | int request_code; | ||
| 2492 | char *permission; | ||
| 2493 | SDL_RequestAndroidPermissionCallback callback; | ||
| 2494 | void *userdata; | ||
| 2495 | struct NativePermissionRequestInfo *next; | ||
| 2496 | } NativePermissionRequestInfo; | ||
| 2497 | |||
| 2498 | static NativePermissionRequestInfo pending_permissions; | ||
| 2499 | |||
| 2500 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePermissionResult)( | ||
| 2501 | JNIEnv *env, jclass cls, | ||
| 2502 | jint requestCode, jboolean result) | ||
| 2503 | { | ||
| 2504 | SDL_LockMutex(Android_ActivityMutex); | ||
| 2505 | NativePermissionRequestInfo *prev = &pending_permissions; | ||
| 2506 | for (NativePermissionRequestInfo *info = prev->next; info != NULL; info = info->next) { | ||
| 2507 | if (info->request_code == (int) requestCode) { | ||
| 2508 | prev->next = info->next; | ||
| 2509 | SDL_UnlockMutex(Android_ActivityMutex); | ||
| 2510 | info->callback(info->userdata, info->permission, result ? true : false); | ||
| 2511 | SDL_free(info->permission); | ||
| 2512 | SDL_free(info); | ||
| 2513 | return; | ||
| 2514 | } | ||
| 2515 | prev = info; | ||
| 2516 | } | ||
| 2517 | |||
| 2518 | SDL_UnlockMutex(Android_ActivityMutex); | ||
| 2519 | } | ||
| 2520 | |||
| 2521 | bool SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata) | ||
| 2522 | { | ||
| 2523 | if (!permission) { | ||
| 2524 | return SDL_InvalidParamError("permission"); | ||
| 2525 | } else if (!cb) { | ||
| 2526 | return SDL_InvalidParamError("cb"); | ||
| 2527 | } | ||
| 2528 | |||
| 2529 | NativePermissionRequestInfo *info = (NativePermissionRequestInfo *) SDL_calloc(1, sizeof (NativePermissionRequestInfo)); | ||
| 2530 | if (!info) { | ||
| 2531 | return false; | ||
| 2532 | } | ||
| 2533 | |||
| 2534 | info->permission = SDL_strdup(permission); | ||
| 2535 | if (!info->permission) { | ||
| 2536 | SDL_free(info); | ||
| 2537 | return false; | ||
| 2538 | } | ||
| 2539 | |||
| 2540 | static SDL_AtomicInt next_request_code; | ||
| 2541 | info->request_code = SDL_AddAtomicInt(&next_request_code, 1); | ||
| 2542 | |||
| 2543 | info->callback = cb; | ||
| 2544 | info->userdata = userdata; | ||
| 2545 | |||
| 2546 | SDL_LockMutex(Android_ActivityMutex); | ||
| 2547 | info->next = pending_permissions.next; | ||
| 2548 | pending_permissions.next = info; | ||
| 2549 | SDL_UnlockMutex(Android_ActivityMutex); | ||
| 2550 | |||
| 2551 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2552 | jstring jpermission = (*env)->NewStringUTF(env, permission); | ||
| 2553 | (*env)->CallStaticVoidMethod(env, mActivityClass, midRequestPermission, jpermission, info->request_code); | ||
| 2554 | (*env)->DeleteLocalRef(env, jpermission); | ||
| 2555 | |||
| 2556 | return true; | ||
| 2557 | } | ||
| 2558 | |||
| 2559 | // Show toast notification | ||
| 2560 | bool Android_JNI_ShowToast(const char *message, int duration, int gravity, int xOffset, int yOffset) | ||
| 2561 | { | ||
| 2562 | bool result; | ||
| 2563 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2564 | jstring jmessage = (*env)->NewStringUTF(env, message); | ||
| 2565 | result = (*env)->CallStaticBooleanMethod(env, mActivityClass, midShowToast, jmessage, duration, gravity, xOffset, yOffset); | ||
| 2566 | (*env)->DeleteLocalRef(env, jmessage); | ||
| 2567 | return result; | ||
| 2568 | } | ||
| 2569 | |||
| 2570 | bool Android_JNI_GetLocale(char *buf, size_t buflen) | ||
| 2571 | { | ||
| 2572 | AConfiguration *cfg; | ||
| 2573 | |||
| 2574 | SDL_assert(buflen > 6); | ||
| 2575 | |||
| 2576 | // Need to re-create the asset manager if locale has changed (SDL_EVENT_LOCALE_CHANGED) | ||
| 2577 | Internal_Android_Destroy_AssetManager(); | ||
| 2578 | |||
| 2579 | if (!asset_manager) { | ||
| 2580 | Internal_Android_Create_AssetManager(); | ||
| 2581 | } | ||
| 2582 | |||
| 2583 | if (!asset_manager) { | ||
| 2584 | return false; | ||
| 2585 | } | ||
| 2586 | |||
| 2587 | cfg = AConfiguration_new(); | ||
| 2588 | if (!cfg) { | ||
| 2589 | return false; | ||
| 2590 | } | ||
| 2591 | |||
| 2592 | { | ||
| 2593 | char language[2] = {}; | ||
| 2594 | char country[2] = {}; | ||
| 2595 | size_t id = 0; | ||
| 2596 | |||
| 2597 | AConfiguration_fromAssetManager(cfg, asset_manager); | ||
| 2598 | AConfiguration_getLanguage(cfg, language); | ||
| 2599 | AConfiguration_getCountry(cfg, country); | ||
| 2600 | |||
| 2601 | // Indonesian is "id" according to ISO 639.2, but on Android is "in" because of Java backwards compatibility | ||
| 2602 | if (language[0] == 'i' && language[1] == 'n') { | ||
| 2603 | language[1] = 'd'; | ||
| 2604 | } | ||
| 2605 | |||
| 2606 | // copy language (not null terminated) | ||
| 2607 | if (language[0]) { | ||
| 2608 | buf[id++] = language[0]; | ||
| 2609 | if (language[1]) { | ||
| 2610 | buf[id++] = language[1]; | ||
| 2611 | } | ||
| 2612 | } | ||
| 2613 | |||
| 2614 | buf[id++] = '_'; | ||
| 2615 | |||
| 2616 | // copy country (not null terminated) | ||
| 2617 | if (country[0]) { | ||
| 2618 | buf[id++] = country[0]; | ||
| 2619 | if (country[1]) { | ||
| 2620 | buf[id++] = country[1]; | ||
| 2621 | } | ||
| 2622 | } | ||
| 2623 | |||
| 2624 | buf[id++] = '\0'; | ||
| 2625 | SDL_assert(id <= buflen); | ||
| 2626 | } | ||
| 2627 | |||
| 2628 | AConfiguration_delete(cfg); | ||
| 2629 | |||
| 2630 | return true; | ||
| 2631 | } | ||
| 2632 | |||
| 2633 | bool Android_JNI_OpenURL(const char *url) | ||
| 2634 | { | ||
| 2635 | bool result; | ||
| 2636 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2637 | jstring jurl = (*env)->NewStringUTF(env, url); | ||
| 2638 | result = (*env)->CallStaticBooleanMethod(env, mActivityClass, midOpenURL, jurl); | ||
| 2639 | (*env)->DeleteLocalRef(env, jurl); | ||
| 2640 | return result; | ||
| 2641 | } | ||
| 2642 | |||
| 2643 | int Android_JNI_OpenFileDescriptor(const char *uri, const char *mode) | ||
| 2644 | { | ||
| 2645 | // Get fopen-style modes | ||
| 2646 | int moderead = 0, modewrite = 0, modeappend = 0, modeupdate = 0; | ||
| 2647 | |||
| 2648 | for (const char *cmode = mode; *cmode; cmode++) { | ||
| 2649 | switch (*cmode) { | ||
| 2650 | case 'a': | ||
| 2651 | modeappend = 1; | ||
| 2652 | break; | ||
| 2653 | case 'r': | ||
| 2654 | moderead = 1; | ||
| 2655 | break; | ||
| 2656 | case 'w': | ||
| 2657 | modewrite = 1; | ||
| 2658 | break; | ||
| 2659 | case '+': | ||
| 2660 | modeupdate = 1; | ||
| 2661 | break; | ||
| 2662 | default: | ||
| 2663 | break; | ||
| 2664 | } | ||
| 2665 | } | ||
| 2666 | |||
| 2667 | // Translate fopen-style modes to ContentResolver modes. | ||
| 2668 | // Android only allows "r", "w", "wt", "wa", "rw" or "rwt". | ||
| 2669 | const char *contentResolverMode = "r"; | ||
| 2670 | |||
| 2671 | if (moderead) { | ||
| 2672 | if (modewrite) { | ||
| 2673 | contentResolverMode = "rwt"; | ||
| 2674 | } else { | ||
| 2675 | contentResolverMode = modeupdate ? "rw" : "r"; | ||
| 2676 | } | ||
| 2677 | } else if (modewrite) { | ||
| 2678 | contentResolverMode = modeupdate ? "rwt" : "wt"; | ||
| 2679 | } else if (modeappend) { | ||
| 2680 | contentResolverMode = modeupdate ? "rw" : "wa"; | ||
| 2681 | } | ||
| 2682 | |||
| 2683 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2684 | jstring jstringUri = (*env)->NewStringUTF(env, uri); | ||
| 2685 | jstring jstringMode = (*env)->NewStringUTF(env, contentResolverMode); | ||
| 2686 | jint fd = (*env)->CallStaticIntMethod(env, mActivityClass, midOpenFileDescriptor, jstringUri, jstringMode); | ||
| 2687 | (*env)->DeleteLocalRef(env, jstringUri); | ||
| 2688 | (*env)->DeleteLocalRef(env, jstringMode); | ||
| 2689 | |||
| 2690 | if (fd == -1) { | ||
| 2691 | SDL_SetError("Unspecified error in JNI"); | ||
| 2692 | } | ||
| 2693 | |||
| 2694 | return fd; | ||
| 2695 | } | ||
| 2696 | |||
| 2697 | static struct AndroidFileDialog | ||
| 2698 | { | ||
| 2699 | int request_code; | ||
| 2700 | SDL_DialogFileCallback callback; | ||
| 2701 | void *userdata; | ||
| 2702 | } mAndroidFileDialogData; | ||
| 2703 | |||
| 2704 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeFileDialog)( | ||
| 2705 | JNIEnv *env, jclass jcls, | ||
| 2706 | jint requestCode, jobjectArray fileList, jint filter) | ||
| 2707 | { | ||
| 2708 | if (mAndroidFileDialogData.callback != NULL && mAndroidFileDialogData.request_code == requestCode) { | ||
| 2709 | if (fileList == NULL) { | ||
| 2710 | SDL_SetError("Unspecified error in JNI"); | ||
| 2711 | mAndroidFileDialogData.callback(mAndroidFileDialogData.userdata, NULL, -1); | ||
| 2712 | mAndroidFileDialogData.callback = NULL; | ||
| 2713 | return; | ||
| 2714 | } | ||
| 2715 | |||
| 2716 | // Convert fileList to string | ||
| 2717 | size_t count = (*env)->GetArrayLength(env, fileList); | ||
| 2718 | char **charFileList = SDL_calloc(count + 1, sizeof(char*)); | ||
| 2719 | |||
| 2720 | if (charFileList == NULL) { | ||
| 2721 | mAndroidFileDialogData.callback(mAndroidFileDialogData.userdata, NULL, -1); | ||
| 2722 | mAndroidFileDialogData.callback = NULL; | ||
| 2723 | return; | ||
| 2724 | } | ||
| 2725 | |||
| 2726 | // Convert to UTF-8 | ||
| 2727 | // TODO: Fix modified UTF-8 to classic UTF-8 | ||
| 2728 | for (int i = 0; i < count; i++) { | ||
| 2729 | jstring string = (*env)->GetObjectArrayElement(env, fileList, i); | ||
| 2730 | if (!string) { | ||
| 2731 | continue; | ||
| 2732 | } | ||
| 2733 | |||
| 2734 | const char *utf8string = (*env)->GetStringUTFChars(env, string, NULL); | ||
| 2735 | if (!utf8string) { | ||
| 2736 | (*env)->DeleteLocalRef(env, string); | ||
| 2737 | continue; | ||
| 2738 | } | ||
| 2739 | |||
| 2740 | char *newFile = SDL_strdup(utf8string); | ||
| 2741 | if (!newFile) { | ||
| 2742 | (*env)->ReleaseStringUTFChars(env, string, utf8string); | ||
| 2743 | (*env)->DeleteLocalRef(env, string); | ||
| 2744 | mAndroidFileDialogData.callback(mAndroidFileDialogData.userdata, NULL, -1); | ||
| 2745 | mAndroidFileDialogData.callback = NULL; | ||
| 2746 | |||
| 2747 | // Cleanup memory | ||
| 2748 | for (int j = 0; j < i; j++) { | ||
| 2749 | SDL_free(charFileList[j]); | ||
| 2750 | } | ||
| 2751 | SDL_free(charFileList); | ||
| 2752 | return; | ||
| 2753 | } | ||
| 2754 | |||
| 2755 | charFileList[i] = newFile; | ||
| 2756 | (*env)->ReleaseStringUTFChars(env, string, utf8string); | ||
| 2757 | (*env)->DeleteLocalRef(env, string); | ||
| 2758 | } | ||
| 2759 | |||
| 2760 | // Call user-provided callback | ||
| 2761 | SDL_ClearError(); | ||
| 2762 | mAndroidFileDialogData.callback(mAndroidFileDialogData.userdata, (const char *const *) charFileList, filter); | ||
| 2763 | mAndroidFileDialogData.callback = NULL; | ||
| 2764 | |||
| 2765 | // Cleanup memory | ||
| 2766 | for (int i = 0; i < count; i++) { | ||
| 2767 | SDL_free(charFileList[i]); | ||
| 2768 | } | ||
| 2769 | SDL_free(charFileList); | ||
| 2770 | } | ||
| 2771 | } | ||
| 2772 | |||
| 2773 | bool Android_JNI_OpenFileDialog( | ||
| 2774 | SDL_DialogFileCallback callback, void* userdata, | ||
| 2775 | const SDL_DialogFileFilter *filters, int nfilters, bool forwrite, | ||
| 2776 | bool multiple) | ||
| 2777 | { | ||
| 2778 | if (mAndroidFileDialogData.callback != NULL) { | ||
| 2779 | SDL_SetError("Only one file dialog can be run at a time."); | ||
| 2780 | return false; | ||
| 2781 | } | ||
| 2782 | |||
| 2783 | if (forwrite) { | ||
| 2784 | multiple = false; | ||
| 2785 | } | ||
| 2786 | |||
| 2787 | JNIEnv *env = Android_JNI_GetEnv(); | ||
| 2788 | |||
| 2789 | // Setup filters | ||
| 2790 | jobjectArray filtersArray = NULL; | ||
| 2791 | if (filters) { | ||
| 2792 | jclass stringClass = (*env)->FindClass(env, "java/lang/String"); | ||
| 2793 | filtersArray = (*env)->NewObjectArray(env, nfilters, stringClass, NULL); | ||
| 2794 | |||
| 2795 | // Convert to string | ||
| 2796 | for (int i = 0; i < nfilters; i++) { | ||
| 2797 | jstring str = (*env)->NewStringUTF(env, filters[i].pattern); | ||
| 2798 | (*env)->SetObjectArrayElement(env, filtersArray, i, str); | ||
| 2799 | (*env)->DeleteLocalRef(env, str); | ||
| 2800 | } | ||
| 2801 | } | ||
| 2802 | |||
| 2803 | // Setup data | ||
| 2804 | static SDL_AtomicInt next_request_code; | ||
| 2805 | mAndroidFileDialogData.request_code = SDL_AddAtomicInt(&next_request_code, 1); | ||
| 2806 | mAndroidFileDialogData.userdata = userdata; | ||
| 2807 | mAndroidFileDialogData.callback = callback; | ||
| 2808 | |||
| 2809 | // Invoke JNI | ||
| 2810 | jboolean success = (*env)->CallStaticBooleanMethod(env, mActivityClass, | ||
| 2811 | midShowFileDialog, filtersArray, (jboolean) multiple, (jboolean) forwrite, mAndroidFileDialogData.request_code); | ||
| 2812 | (*env)->DeleteLocalRef(env, filtersArray); | ||
| 2813 | if (!success) { | ||
| 2814 | mAndroidFileDialogData.callback = NULL; | ||
| 2815 | SDL_AddAtomicInt(&next_request_code, -1); | ||
| 2816 | SDL_SetError("Unspecified error in JNI"); | ||
| 2817 | |||
| 2818 | return false; | ||
| 2819 | } | ||
| 2820 | |||
| 2821 | return true; | ||
| 2822 | } | ||
| 2823 | |||
| 2824 | #endif // SDL_PLATFORM_ANDROID | ||
diff --git a/contrib/SDL-3.2.8/src/core/android/SDL_android.h b/contrib/SDL-3.2.8/src/core/android/SDL_android.h new file mode 100644 index 0000000..3541c2a --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/android/SDL_android.h | |||
| @@ -0,0 +1,163 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifndef SDL_android_h | ||
| 24 | #define SDL_android_h | ||
| 25 | |||
| 26 | // Set up for C function definitions, even when using C++ | ||
| 27 | #ifdef __cplusplus | ||
| 28 | /* *INDENT-OFF* */ | ||
| 29 | extern "C" { | ||
| 30 | /* *INDENT-ON* */ | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <EGL/eglplatform.h> | ||
| 34 | #include <android/native_window_jni.h> | ||
| 35 | |||
| 36 | #include "../../audio/SDL_sysaudio.h" | ||
| 37 | |||
| 38 | // this appears to be broken right now (on Android, not SDL, I think...?). | ||
| 39 | #define ALLOW_MULTIPLE_ANDROID_AUDIO_DEVICES 0 | ||
| 40 | |||
| 41 | // Life cycle | ||
| 42 | typedef enum | ||
| 43 | { | ||
| 44 | SDL_ANDROID_LIFECYCLE_WAKE, | ||
| 45 | SDL_ANDROID_LIFECYCLE_PAUSE, | ||
| 46 | SDL_ANDROID_LIFECYCLE_RESUME, | ||
| 47 | SDL_ANDROID_LIFECYCLE_LOWMEMORY, | ||
| 48 | SDL_ANDROID_LIFECYCLE_DESTROY, | ||
| 49 | SDL_NUM_ANDROID_LIFECYCLE_EVENTS | ||
| 50 | } SDL_AndroidLifecycleEvent; | ||
| 51 | |||
| 52 | void Android_SendLifecycleEvent(SDL_AndroidLifecycleEvent event); | ||
| 53 | bool Android_WaitLifecycleEvent(SDL_AndroidLifecycleEvent *event, Sint64 timeoutNS); | ||
| 54 | |||
| 55 | void Android_LockActivityMutex(void); | ||
| 56 | void Android_UnlockActivityMutex(void); | ||
| 57 | |||
| 58 | // Interface from the SDL library into the Android Java activity | ||
| 59 | extern void Android_JNI_SetActivityTitle(const char *title); | ||
| 60 | extern void Android_JNI_SetWindowStyle(bool fullscreen); | ||
| 61 | extern void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint); | ||
| 62 | extern void Android_JNI_MinizeWindow(void); | ||
| 63 | extern bool Android_JNI_ShouldMinimizeOnFocusLoss(void); | ||
| 64 | |||
| 65 | extern bool Android_JNI_GetAccelerometerValues(float values[3]); | ||
| 66 | extern void Android_JNI_ShowScreenKeyboard(int input_type, SDL_Rect *inputRect); | ||
| 67 | extern void Android_JNI_HideScreenKeyboard(void); | ||
| 68 | extern bool Android_JNI_IsScreenKeyboardShown(void); | ||
| 69 | extern ANativeWindow *Android_JNI_GetNativeWindow(void); | ||
| 70 | |||
| 71 | extern SDL_DisplayOrientation Android_JNI_GetDisplayNaturalOrientation(void); | ||
| 72 | extern SDL_DisplayOrientation Android_JNI_GetDisplayCurrentOrientation(void); | ||
| 73 | |||
| 74 | // Audio support | ||
| 75 | void Android_StartAudioHotplug(SDL_AudioDevice **default_playback, SDL_AudioDevice **default_recording); | ||
| 76 | void Android_StopAudioHotplug(void); | ||
| 77 | extern void Android_AudioThreadInit(SDL_AudioDevice *device); | ||
| 78 | |||
| 79 | // Detecting device type | ||
| 80 | extern bool Android_IsDeXMode(void); | ||
| 81 | extern bool Android_IsChromebook(void); | ||
| 82 | |||
| 83 | bool Android_JNI_FileOpen(void **puserdata, const char *fileName, const char *mode); | ||
| 84 | Sint64 Android_JNI_FileSize(void *userdata); | ||
| 85 | Sint64 Android_JNI_FileSeek(void *userdata, Sint64 offset, SDL_IOWhence whence); | ||
| 86 | size_t Android_JNI_FileRead(void *userdata, void *buffer, size_t size, SDL_IOStatus *status); | ||
| 87 | size_t Android_JNI_FileWrite(void *userdata, const void *buffer, size_t size, SDL_IOStatus *status); | ||
| 88 | bool Android_JNI_FileClose(void *userdata); | ||
| 89 | |||
| 90 | // Environment support | ||
| 91 | void Android_JNI_GetManifestEnvironmentVariables(void); | ||
| 92 | int Android_JNI_OpenFileDescriptor(const char *uri, const char *mode); | ||
| 93 | |||
| 94 | // Clipboard support | ||
| 95 | bool Android_JNI_SetClipboardText(const char *text); | ||
| 96 | char *Android_JNI_GetClipboardText(void); | ||
| 97 | bool Android_JNI_HasClipboardText(void); | ||
| 98 | |||
| 99 | // Power support | ||
| 100 | int Android_JNI_GetPowerInfo(int *plugged, int *charged, int *battery, int *seconds, int *percent); | ||
| 101 | |||
| 102 | // Joystick support | ||
| 103 | void Android_JNI_PollInputDevices(void); | ||
| 104 | |||
| 105 | // Haptic support | ||
| 106 | void Android_JNI_PollHapticDevices(void); | ||
| 107 | void Android_JNI_HapticRun(int device_id, float intensity, int length); | ||
| 108 | void Android_JNI_HapticRumble(int device_id, float low_frequency_intensity, float high_frequency_intensity, int length); | ||
| 109 | void Android_JNI_HapticStop(int device_id); | ||
| 110 | |||
| 111 | // Video | ||
| 112 | bool Android_JNI_SuspendScreenSaver(bool suspend); | ||
| 113 | |||
| 114 | // Touch support | ||
| 115 | void Android_JNI_InitTouch(void); | ||
| 116 | |||
| 117 | // Threads | ||
| 118 | #include <jni.h> | ||
| 119 | JNIEnv *Android_JNI_GetEnv(void); | ||
| 120 | bool Android_JNI_SetupThread(void); | ||
| 121 | |||
| 122 | // Locale | ||
| 123 | bool Android_JNI_GetLocale(char *buf, size_t buflen); | ||
| 124 | |||
| 125 | // Generic messages | ||
| 126 | bool Android_JNI_SendMessage(int command, int param); | ||
| 127 | |||
| 128 | // MessageBox | ||
| 129 | bool Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID); | ||
| 130 | |||
| 131 | // Cursor support | ||
| 132 | int Android_JNI_CreateCustomCursor(SDL_Surface *surface, int hot_x, int hot_y); | ||
| 133 | void Android_JNI_DestroyCustomCursor(int cursorID); | ||
| 134 | bool Android_JNI_SetCustomCursor(int cursorID); | ||
| 135 | bool Android_JNI_SetSystemCursor(int cursorID); | ||
| 136 | |||
| 137 | // Relative mouse support | ||
| 138 | bool Android_JNI_SupportsRelativeMouse(void); | ||
| 139 | bool Android_JNI_SetRelativeMouseEnabled(bool enabled); | ||
| 140 | |||
| 141 | // Show toast notification | ||
| 142 | bool Android_JNI_ShowToast(const char *message, int duration, int gravity, int xOffset, int yOffset); | ||
| 143 | |||
| 144 | bool Android_JNI_OpenURL(const char *url); | ||
| 145 | |||
| 146 | int SDL_GetAndroidSDKVersion(void); | ||
| 147 | |||
| 148 | bool SDL_IsAndroidTablet(void); | ||
| 149 | bool SDL_IsAndroidTV(void); | ||
| 150 | |||
| 151 | // File Dialogs | ||
| 152 | bool Android_JNI_OpenFileDialog(SDL_DialogFileCallback callback, void* userdata, | ||
| 153 | const SDL_DialogFileFilter *filters, int nfilters, bool forwrite, | ||
| 154 | bool multiple); | ||
| 155 | |||
| 156 | // Ends C function definitions when using C++ | ||
| 157 | #ifdef __cplusplus | ||
| 158 | /* *INDENT-OFF* */ | ||
| 159 | } | ||
| 160 | /* *INDENT-ON* */ | ||
| 161 | #endif | ||
| 162 | |||
| 163 | #endif // SDL_android_h | ||
diff --git a/contrib/SDL-3.2.8/src/core/freebsd/SDL_evdev_kbd_default_keyaccmap.h b/contrib/SDL-3.2.8/src/core/freebsd/SDL_evdev_kbd_default_keyaccmap.h new file mode 100644 index 0000000..fc6e5e8 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/freebsd/SDL_evdev_kbd_default_keyaccmap.h | |||
| @@ -0,0 +1,167 @@ | |||
| 1 | #include <sys/kbio.h> | ||
| 2 | |||
| 3 | /* *INDENT-OFF* */ // clang-format off | ||
| 4 | /* | ||
| 5 | * Automatically generated from /usr/share/vt/keymaps/us.acc.kbd. | ||
| 6 | * DO NOT EDIT! | ||
| 7 | */ | ||
| 8 | static keymap_t keymap_default_us_acc = { 0x6d, { | ||
| 9 | /* alt | ||
| 10 | * scan cntrl alt alt cntrl | ||
| 11 | * code base shift cntrl shift alt shift cntrl shift spcl flgs | ||
| 12 | * --------------------------------------------------------------------------- | ||
| 13 | */ | ||
| 14 | /*00*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, | ||
| 15 | /*01*/{{ 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, DBG, DBG, }, 0x03,0x00 }, | ||
| 16 | /*02*/{{ '1', '!', NOP, NOP, '1', '!', NOP, NOP, }, 0x33,0x00 }, | ||
| 17 | /*03*/{{ '2', '@', 0x00, 0x00, '2', '@', 0x00, 0x00, }, 0x00,0x00 }, | ||
| 18 | /*04*/{{ '3', '#', NOP, NOP, '3', '#', NOP, NOP, }, 0x33,0x00 }, | ||
| 19 | /*05*/{{ '4', '$', NOP, NOP, '4', '$', NOP, NOP, }, 0x33,0x00 }, | ||
| 20 | /*06*/{{ '5', '%', NOP, NOP, '5', '%', NOP, NOP, }, 0x33,0x00 }, | ||
| 21 | /*07*/{{ '6', '^', 0x1E, 0x1E, '6', DCIR, 0x1E, 0x1E, }, 0x04,0x00 }, | ||
| 22 | /*08*/{{ '7', '&', NOP, NOP, '7', '&', NOP, NOP, }, 0x33,0x00 }, | ||
| 23 | /*09*/{{ '8', '*', NOP, NOP, '8', DRIN, NOP, NOP, }, 0x37,0x00 }, | ||
| 24 | /*0a*/{{ '9', '(', NOP, NOP, '9', '(', NOP, NOP, }, 0x33,0x00 }, | ||
| 25 | /*0b*/{{ '0', ')', NOP, NOP, '0', ')', NOP, NOP, }, 0x33,0x00 }, | ||
| 26 | /*0c*/{{ '-', '_', 0x1F, 0x1F, '-', '_', 0x1F, 0x1F, }, 0x00,0x00 }, | ||
| 27 | /*0d*/{{ '=', '+', NOP, NOP, '=', '+', NOP, NOP, }, 0x33,0x00 }, | ||
| 28 | /*0e*/{{ 0x08, 0x08, 0x7F, 0x7F, 0x08, 0x08, 0x7F, 0x7F, }, 0x00,0x00 }, | ||
| 29 | /*0f*/{{ 0x09, BTAB, NEXT, NEXT, 0x09, BTAB, NOP, NOP, }, 0x77,0x00 }, | ||
| 30 | /*10*/{{ 'q', 'Q', 0x11, 0x11, 'q', 'Q', 0x11, 0x11, }, 0x00,0x01 }, | ||
| 31 | /*11*/{{ 'w', 'W', 0x17, 0x17, 'w', 'W', 0x17, 0x17, }, 0x00,0x01 }, | ||
| 32 | /*12*/{{ 'e', 'E', 0x05, 0x05, 'e', 'E', 0x05, 0x05, }, 0x00,0x01 }, | ||
| 33 | /*13*/{{ 'r', 'R', 0x12, 0x12, 'r', 'R', 0x12, 0x12, }, 0x00,0x01 }, | ||
| 34 | /*14*/{{ 't', 'T', 0x14, 0x14, 't', 'T', 0x14, 0x14, }, 0x00,0x01 }, | ||
| 35 | /*15*/{{ 'y', 'Y', 0x19, 0x19, 'y', 'Y', 0x19, 0x19, }, 0x00,0x01 }, | ||
| 36 | /*16*/{{ 'u', 'U', 0x15, 0x15, 'u', 'U', 0x15, 0x15, }, 0x00,0x01 }, | ||
| 37 | /*17*/{{ 'i', 'I', 0x09, 0x09, 'i', 'I', 0x09, 0x09, }, 0x00,0x01 }, | ||
| 38 | /*18*/{{ 'o', 'O', 0x0F, 0x0F, 'o', 'O', 0x0F, 0x0F, }, 0x00,0x01 }, | ||
| 39 | /*19*/{{ 'p', 'P', 0x10, 0x10, 'p', 'P', 0x10, 0x10, }, 0x00,0x01 }, | ||
| 40 | /*1a*/{{ '[', '{', 0x1B, 0x1B, '[', '{', 0x1B, 0x1B, }, 0x00,0x00 }, | ||
| 41 | /*1b*/{{ ']', '}', 0x1D, 0x1D, ']', '}', 0x1D, 0x1D, }, 0x00,0x00 }, | ||
| 42 | /*1c*/{{ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, }, 0x00,0x00 }, | ||
| 43 | /*1d*/{{ LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, }, 0xFF,0x00 }, | ||
| 44 | /*1e*/{{ 'a', 'A', 0x01, 0x01, 'a', 'A', 0x01, 0x01, }, 0x00,0x01 }, | ||
| 45 | /*1f*/{{ 's', 'S', 0x13, 0x13, 's', 'S', 0x13, 0x13, }, 0x00,0x01 }, | ||
| 46 | /*20*/{{ 'd', 'D', 0x04, 0x04, 'd', 'D', 0x04, 0x04, }, 0x00,0x01 }, | ||
| 47 | /*21*/{{ 'f', 'F', 0x06, 0x06, 'f', 'F', 0x06, 0x06, }, 0x00,0x01 }, | ||
| 48 | /*22*/{{ 'g', 'G', 0x07, 0x07, 'g', 'G', 0x07, 0x07, }, 0x00,0x01 }, | ||
| 49 | /*23*/{{ 'h', 'H', 0x08, 0x08, 'h', 'H', 0x08, 0x08, }, 0x00,0x01 }, | ||
| 50 | /*24*/{{ 'j', 'J', 0x0A, 0x0A, 'j', 'J', 0x0A, 0x0A, }, 0x00,0x01 }, | ||
| 51 | /*25*/{{ 'k', 'K', 0x0B, 0x0B, 'k', 'K', 0x0B, 0x0B, }, 0x00,0x01 }, | ||
| 52 | /*26*/{{ 'l', 'L', 0x0C, 0x0C, 'l', 'L', 0x0C, 0x0C, }, 0x00,0x01 }, | ||
| 53 | /*27*/{{ ';', ':', NOP, NOP, ';', ':', NOP, NOP, }, 0x33,0x00 }, | ||
| 54 | /*28*/{{ '\'', '"', NOP, NOP, DACU, DUML, NOP, NOP, }, 0x3F,0x00 }, | ||
| 55 | /*29*/{{ '`', '~', NOP, NOP, DGRA, DTIL, NOP, NOP, }, 0x3F,0x00 }, | ||
| 56 | /*2a*/{{ LSH, LSH, LSH, LSH, LSH, LSH, LSH, LSH, }, 0xFF,0x00 }, | ||
| 57 | /*2b*/{{ '\\', '|', 0x1C, 0x1C, '\\', '|', 0x1C, 0x1C, }, 0x00,0x00 }, | ||
| 58 | /*2c*/{{ 'z', 'Z', 0x1A, 0x1A, 'z', 'Z', 0x1A, 0x1A, }, 0x00,0x01 }, | ||
| 59 | /*2d*/{{ 'x', 'X', 0x18, 0x18, 'x', 'X', 0x18, 0x18, }, 0x00,0x01 }, | ||
| 60 | /*2e*/{{ 'c', 'C', 0x03, 0x03, 'c', 'C', 0x03, 0x03, }, 0x00,0x01 }, | ||
| 61 | /*2f*/{{ 'v', 'V', 0x16, 0x16, 'v', 'V', 0x16, 0x16, }, 0x00,0x01 }, | ||
| 62 | /*30*/{{ 'b', 'B', 0x02, 0x02, 'b', 'B', 0x02, 0x02, }, 0x00,0x01 }, | ||
| 63 | /*31*/{{ 'n', 'N', 0x0E, 0x0E, 'n', 'N', 0x0E, 0x0E, }, 0x00,0x01 }, | ||
| 64 | /*32*/{{ 'm', 'M', 0x0D, 0x0D, 'm', 'M', 0x0D, 0x0D, }, 0x00,0x01 }, | ||
| 65 | /*33*/{{ ',', '<', NOP, NOP, DCED, '<', NOP, NOP, }, 0x3B,0x00 }, | ||
| 66 | /*34*/{{ '.', '>', NOP, NOP, '.', '>', NOP, NOP, }, 0x33,0x00 }, | ||
| 67 | /*35*/{{ '/', '?', NOP, NOP, '/', '?', NOP, NOP, }, 0x33,0x00 }, | ||
| 68 | /*36*/{{ RSH, RSH, RSH, RSH, RSH, RSH, RSH, RSH, }, 0xFF,0x00 }, | ||
| 69 | /*37*/{{ '*', '*', '*', '*', '*', '*', '*', '*', }, 0x00,0x00 }, | ||
| 70 | /*38*/{{ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT, }, 0xFF,0x00 }, | ||
| 71 | /*39*/{{ ' ', ' ', 0x00, 0x00, ' ', ' ', SUSP, SUSP, }, 0x03,0x00 }, | ||
| 72 | /*3a*/{{ CLK, CLK, CLK, CLK, CLK, CLK, CLK, CLK, }, 0xFF,0x00 }, | ||
| 73 | /*3b*/{{ F( 1), F(13), F(25), F(37), S( 1), S(11), S( 1), S(11),}, 0xFF,0x00 }, | ||
| 74 | /*3c*/{{ F( 2), F(14), F(26), F(38), S( 2), S(12), S( 2), S(12),}, 0xFF,0x00 }, | ||
| 75 | /*3d*/{{ F( 3), F(15), F(27), F(39), S( 3), S(13), S( 3), S(13),}, 0xFF,0x00 }, | ||
| 76 | /*3e*/{{ F( 4), F(16), F(28), F(40), S( 4), S(14), S( 4), S(14),}, 0xFF,0x00 }, | ||
| 77 | /*3f*/{{ F( 5), F(17), F(29), F(41), S( 5), S(15), S( 5), S(15),}, 0xFF,0x00 }, | ||
| 78 | /*40*/{{ F( 6), F(18), F(30), F(42), S( 6), S(16), S( 6), S(16),}, 0xFF,0x00 }, | ||
| 79 | /*41*/{{ F( 7), F(19), F(31), F(43), S( 7), S( 7), S( 7), S( 7),}, 0xFF,0x00 }, | ||
| 80 | /*42*/{{ F( 8), F(20), F(32), F(44), S( 8), S( 8), S( 8), S( 8),}, 0xFF,0x00 }, | ||
| 81 | /*43*/{{ F( 9), F(21), F(33), F(45), S( 9), S( 9), S( 9), S( 9),}, 0xFF,0x00 }, | ||
| 82 | /*44*/{{ F(10), F(22), F(34), F(46), S(10), S(10), S(10), S(10),}, 0xFF,0x00 }, | ||
| 83 | /*45*/{{ NLK, NLK, NLK, NLK, NLK, NLK, NLK, NLK, }, 0xFF,0x00 }, | ||
| 84 | /*46*/{{ SLK, SLK, SLK, SLK, SLK, SLK, SLK, SLK, }, 0xFF,0x00 }, | ||
| 85 | /*47*/{{ F(49), '7', '7', '7', '7', '7', '7', '7', }, 0x80,0x02 }, | ||
| 86 | /*48*/{{ F(50), '8', '8', '8', '8', '8', '8', '8', }, 0x80,0x02 }, | ||
| 87 | /*49*/{{ F(51), '9', '9', '9', '9', '9', '9', '9', }, 0x80,0x02 }, | ||
| 88 | /*4a*/{{ F(52), '-', '-', '-', '-', '-', '-', '-', }, 0x80,0x02 }, | ||
| 89 | /*4b*/{{ F(53), '4', '4', '4', '4', '4', '4', '4', }, 0x80,0x02 }, | ||
| 90 | /*4c*/{{ F(54), '5', '5', '5', '5', '5', '5', '5', }, 0x80,0x02 }, | ||
| 91 | /*4d*/{{ F(55), '6', '6', '6', '6', '6', '6', '6', }, 0x80,0x02 }, | ||
| 92 | /*4e*/{{ F(56), '+', '+', '+', '+', '+', '+', '+', }, 0x80,0x02 }, | ||
| 93 | /*4f*/{{ F(57), '1', '1', '1', '1', '1', '1', '1', }, 0x80,0x02 }, | ||
| 94 | /*50*/{{ F(58), '2', '2', '2', '2', '2', '2', '2', }, 0x80,0x02 }, | ||
| 95 | /*51*/{{ F(59), '3', '3', '3', '3', '3', '3', '3', }, 0x80,0x02 }, | ||
| 96 | /*52*/{{ F(60), '0', '0', '0', '0', '0', '0', '0', }, 0x80,0x02 }, | ||
| 97 | /*53*/{{ 0x7F, '.', '.', '.', '.', '.', RBT, RBT, }, 0x03,0x02 }, | ||
| 98 | /*54*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, | ||
| 99 | /*55*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, | ||
| 100 | /*56*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, | ||
| 101 | /*57*/{{ F(11), F(23), F(35), F(47), S(11), S(11), S(11), S(11),}, 0xFF,0x00 }, | ||
| 102 | /*58*/{{ F(12), F(24), F(36), F(48), S(12), S(12), S(12), S(12),}, 0xFF,0x00 }, | ||
| 103 | /*59*/{{ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, }, 0x00,0x00 }, | ||
| 104 | /*5a*/{{ RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, }, 0xFF,0x00 }, | ||
| 105 | /*5b*/{{ '/', '/', '/', '/', '/', '/', '/', '/', }, 0x00,0x02 }, | ||
| 106 | /*5c*/{{ NEXT, NEXT, NOP, NOP, DBG, DBG, DBG, DBG, }, 0xFF,0x00 }, | ||
| 107 | /*5d*/{{ RALT, RALT, RALT, RALT, RALT, RALT, RALT, RALT, }, 0xFF,0x00 }, | ||
| 108 | /*5e*/{{ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49),}, 0xFF,0x00 }, | ||
| 109 | /*5f*/{{ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50),}, 0xFF,0x00 }, | ||
| 110 | /*60*/{{ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51),}, 0xFF,0x00 }, | ||
| 111 | /*61*/{{ F(53), F(53), F(53), F(53), F(53), F(53), F(53), F(53),}, 0xFF,0x00 }, | ||
| 112 | /*62*/{{ F(55), F(55), F(55), F(55), F(55), F(55), F(55), F(55),}, 0xFF,0x00 }, | ||
| 113 | /*63*/{{ F(57), F(57), F(57), F(57), F(57), F(57), F(57), F(57),}, 0xFF,0x00 }, | ||
| 114 | /*64*/{{ F(58), F(58), F(58), F(58), F(58), F(58), F(58), F(58),}, 0xFF,0x00 }, | ||
| 115 | /*65*/{{ F(59), F(59), F(59), F(59), F(59), F(59), F(59), F(59),}, 0xFF,0x00 }, | ||
| 116 | /*66*/{{ F(60), F(60), F(60), F(60), F(60), F(60), F(60), F(60),}, 0xFF,0x00 }, | ||
| 117 | /*67*/{{ F(61), F(61), F(61), F(61), F(61), F(61), RBT, F(61),}, 0xFF,0x00 }, | ||
| 118 | /*68*/{{ SPSC, SPSC, SUSP, SUSP, NOP, NOP, SUSP, SUSP, }, 0xFF,0x00 }, | ||
| 119 | /*69*/{{ F(62), F(62), F(62), F(62), F(62), F(62), F(62), F(62),}, 0xFF,0x00 }, | ||
| 120 | /*6a*/{{ F(63), F(63), F(63), F(63), F(63), F(63), F(63), F(63),}, 0xFF,0x00 }, | ||
| 121 | /*6b*/{{ F(64), F(64), F(64), F(64), F(64), F(64), F(64), F(64),}, 0xFF,0x00 }, | ||
| 122 | /*6c*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, | ||
| 123 | } }; | ||
| 124 | |||
| 125 | static accentmap_t accentmap_default_us_acc = { 11, { | ||
| 126 | // dgra=0 | ||
| 127 | { '`', { { 'a',0xe0 }, { 'A',0xc0 }, { 'e',0xe8 }, { 'E',0xc8 }, | ||
| 128 | { 'i',0xec }, { 'I',0xcc }, { 'o',0xf2 }, { 'O',0xd2 }, | ||
| 129 | { 'u',0xf9 }, { 'U',0xd9 }, }, }, | ||
| 130 | // dacu=1 | ||
| 131 | { 0xb4, { { 'a',0xe1 }, { 'A',0xc1 }, { 'e',0xe9 }, { 'E',0xc9 }, | ||
| 132 | { 'i',0xed }, { 'I',0xcd }, { 'o',0xf3 }, { 'O',0xd3 }, | ||
| 133 | { 'u',0xfa }, { 'U',0xda }, { 'y',0xfd }, { 'Y',0xdd }, }, }, | ||
| 134 | // dcir=2 | ||
| 135 | { '^', { { 'a',0xe2 }, { 'A',0xc2 }, { 'e',0xea }, { 'E',0xca }, | ||
| 136 | { 'i',0xee }, { 'I',0xce }, { 'o',0xf4 }, { 'O',0xd4 }, | ||
| 137 | { 'u',0xfb }, { 'U',0xdb }, }, }, | ||
| 138 | // dtil=3 | ||
| 139 | { '~', { { 'a',0xe3 }, { 'A',0xc3 }, { 'n',0xf1 }, { 'N',0xd1 }, | ||
| 140 | { 'o',0xf5 }, { 'O',0xd5 }, }, }, | ||
| 141 | // dmac=4 | ||
| 142 | { 0x00 }, | ||
| 143 | // dbre=5 | ||
| 144 | { 0x00 }, | ||
| 145 | // ddot=6 | ||
| 146 | { 0x00 }, | ||
| 147 | // duml=7 | ||
| 148 | { 0xa8, { { 'a',0xe4 }, { 'A',0xc4 }, { 'e',0xeb }, { 'E',0xcb }, | ||
| 149 | { 'i',0xef }, { 'I',0xcf }, { 'o',0xf6 }, { 'O',0xd6 }, | ||
| 150 | { 'u',0xfc }, { 'U',0xdc }, { 'y',0xff }, }, }, | ||
| 151 | // dsla=8 | ||
| 152 | { 0x00 }, | ||
| 153 | // drin=9 | ||
| 154 | { 0xb0, { { 'a',0xe5 }, { 'A',0xc5 }, }, }, | ||
| 155 | // dced=10 | ||
| 156 | { 0xb8, { { 'c',0xe7 }, { 'C',0xc7 }, }, }, | ||
| 157 | // dapo=11 | ||
| 158 | { 0x00 }, | ||
| 159 | // ddac=12 | ||
| 160 | { 0x00 }, | ||
| 161 | // dogo=13 | ||
| 162 | { 0x00 }, | ||
| 163 | // dcar=14 | ||
| 164 | { 0x00 }, | ||
| 165 | } }; | ||
| 166 | |||
| 167 | /* *INDENT-ON* */ // clang-format on | ||
diff --git a/contrib/SDL-3.2.8/src/core/freebsd/SDL_evdev_kbd_freebsd.c b/contrib/SDL-3.2.8/src/core/freebsd/SDL_evdev_kbd_freebsd.c new file mode 100644 index 0000000..16a2171 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/freebsd/SDL_evdev_kbd_freebsd.c | |||
| @@ -0,0 +1,613 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "SDL_internal.h" | ||
| 23 | |||
| 24 | #include "../linux/SDL_evdev_kbd.h" | ||
| 25 | |||
| 26 | #ifdef SDL_INPUT_FBSDKBIO | ||
| 27 | |||
| 28 | // This logic is adapted from drivers/tty/vt/keyboard.c in the Linux kernel source, slightly modified to work with FreeBSD | ||
| 29 | |||
| 30 | #include <unistd.h> | ||
| 31 | #include <fcntl.h> | ||
| 32 | #include <sys/ioctl.h> | ||
| 33 | #include <sys/kbio.h> | ||
| 34 | #include <sys/consio.h> | ||
| 35 | |||
| 36 | #include <signal.h> | ||
| 37 | |||
| 38 | #include "../../events/SDL_events_c.h" | ||
| 39 | #include "SDL_evdev_kbd_default_keyaccmap.h" | ||
| 40 | |||
| 41 | typedef void(fn_handler_fn)(SDL_EVDEV_keyboard_state *kbd); | ||
| 42 | |||
| 43 | /* | ||
| 44 | * Keyboard State | ||
| 45 | */ | ||
| 46 | |||
| 47 | struct SDL_EVDEV_keyboard_state | ||
| 48 | { | ||
| 49 | int console_fd; | ||
| 50 | int keyboard_fd; | ||
| 51 | unsigned long old_kbd_mode; | ||
| 52 | unsigned short **key_maps; | ||
| 53 | keymap_t *key_map; | ||
| 54 | keyboard_info_t *kbInfo; | ||
| 55 | unsigned char shift_down[4]; // shift state counters.. | ||
| 56 | bool dead_key_next; | ||
| 57 | int npadch; // -1 or number assembled on pad | ||
| 58 | accentmap_t *accents; | ||
| 59 | unsigned int diacr; | ||
| 60 | bool rep; // flag telling character repeat | ||
| 61 | unsigned char lockstate; | ||
| 62 | unsigned char ledflagstate; | ||
| 63 | char shift_state; | ||
| 64 | char text[128]; | ||
| 65 | unsigned int text_len; | ||
| 66 | }; | ||
| 67 | |||
| 68 | static bool SDL_EVDEV_kbd_load_keymaps(SDL_EVDEV_keyboard_state *kbd) | ||
| 69 | { | ||
| 70 | return ioctl(kbd->keyboard_fd, GIO_KEYMAP, kbd->key_map) >= 0; | ||
| 71 | } | ||
| 72 | |||
| 73 | static SDL_EVDEV_keyboard_state *kbd_cleanup_state = NULL; | ||
| 74 | static int kbd_cleanup_sigactions_installed = 0; | ||
| 75 | static int kbd_cleanup_atexit_installed = 0; | ||
| 76 | |||
| 77 | static struct sigaction old_sigaction[NSIG]; | ||
| 78 | |||
| 79 | static int fatal_signals[] = { | ||
| 80 | // Handlers for SIGTERM and SIGINT are installed in SDL_InitQuit. | ||
| 81 | SIGHUP, SIGQUIT, SIGILL, SIGABRT, | ||
| 82 | SIGFPE, SIGSEGV, SIGPIPE, SIGBUS, | ||
| 83 | SIGSYS | ||
| 84 | }; | ||
| 85 | |||
| 86 | static void kbd_cleanup(void) | ||
| 87 | { | ||
| 88 | struct mouse_info mData; | ||
| 89 | SDL_EVDEV_keyboard_state *kbd = kbd_cleanup_state; | ||
| 90 | if (!kbd) { | ||
| 91 | return; | ||
| 92 | } | ||
| 93 | kbd_cleanup_state = NULL; | ||
| 94 | SDL_zero(mData); | ||
| 95 | mData.operation = MOUSE_SHOW; | ||
| 96 | ioctl(kbd->keyboard_fd, KDSKBMODE, kbd->old_kbd_mode); | ||
| 97 | if (kbd->keyboard_fd != kbd->console_fd) { | ||
| 98 | close(kbd->keyboard_fd); | ||
| 99 | } | ||
| 100 | ioctl(kbd->console_fd, CONS_SETKBD, (unsigned long)(kbd->kbInfo->kb_index)); | ||
| 101 | ioctl(kbd->console_fd, CONS_MOUSECTL, &mData); | ||
| 102 | } | ||
| 103 | |||
| 104 | void SDL_EVDEV_kbd_reraise_signal(int sig) | ||
| 105 | { | ||
| 106 | raise(sig); | ||
| 107 | } | ||
| 108 | |||
| 109 | siginfo_t *SDL_EVDEV_kdb_cleanup_siginfo = NULL; | ||
| 110 | void *SDL_EVDEV_kdb_cleanup_ucontext = NULL; | ||
| 111 | |||
| 112 | static void kbd_cleanup_signal_action(int signum, siginfo_t *info, void *ucontext) | ||
| 113 | { | ||
| 114 | struct sigaction *old_action_p = &(old_sigaction[signum]); | ||
| 115 | sigset_t sigset; | ||
| 116 | |||
| 117 | // Restore original signal handler before going any further. | ||
| 118 | sigaction(signum, old_action_p, NULL); | ||
| 119 | |||
| 120 | // Unmask current signal. | ||
| 121 | sigemptyset(&sigset); | ||
| 122 | sigaddset(&sigset, signum); | ||
| 123 | sigprocmask(SIG_UNBLOCK, &sigset, NULL); | ||
| 124 | |||
| 125 | // Save original signal info and context for archeologists. | ||
| 126 | SDL_EVDEV_kdb_cleanup_siginfo = info; | ||
| 127 | SDL_EVDEV_kdb_cleanup_ucontext = ucontext; | ||
| 128 | |||
| 129 | // Restore keyboard. | ||
| 130 | kbd_cleanup(); | ||
| 131 | |||
| 132 | // Reraise signal. | ||
| 133 | SDL_EVDEV_kbd_reraise_signal(signum); | ||
| 134 | } | ||
| 135 | |||
| 136 | static void kbd_unregister_emerg_cleanup(void) | ||
| 137 | { | ||
| 138 | int tabidx; | ||
| 139 | |||
| 140 | kbd_cleanup_state = NULL; | ||
| 141 | |||
| 142 | if (!kbd_cleanup_sigactions_installed) { | ||
| 143 | return; | ||
| 144 | } | ||
| 145 | kbd_cleanup_sigactions_installed = 0; | ||
| 146 | |||
| 147 | for (tabidx = 0; tabidx < sizeof(fatal_signals) / sizeof(fatal_signals[0]); ++tabidx) { | ||
| 148 | struct sigaction *old_action_p; | ||
| 149 | struct sigaction cur_action; | ||
| 150 | int signum = fatal_signals[tabidx]; | ||
| 151 | old_action_p = &(old_sigaction[signum]); | ||
| 152 | |||
| 153 | // Examine current signal action | ||
| 154 | if (sigaction(signum, NULL, &cur_action)) { | ||
| 155 | continue; | ||
| 156 | } | ||
| 157 | |||
| 158 | // Check if action installed and not modified | ||
| 159 | if (!(cur_action.sa_flags & SA_SIGINFO) || cur_action.sa_sigaction != &kbd_cleanup_signal_action) { | ||
| 160 | continue; | ||
| 161 | } | ||
| 162 | |||
| 163 | // Restore original action | ||
| 164 | sigaction(signum, old_action_p, NULL); | ||
| 165 | } | ||
| 166 | } | ||
| 167 | |||
| 168 | static void kbd_cleanup_atexit(void) | ||
| 169 | { | ||
| 170 | // Restore keyboard. | ||
| 171 | kbd_cleanup(); | ||
| 172 | |||
| 173 | // Try to restore signal handlers in case shared library is being unloaded | ||
| 174 | kbd_unregister_emerg_cleanup(); | ||
| 175 | } | ||
| 176 | |||
| 177 | static void kbd_register_emerg_cleanup(SDL_EVDEV_keyboard_state *kbd) | ||
| 178 | { | ||
| 179 | int tabidx; | ||
| 180 | |||
| 181 | if (kbd_cleanup_state) { | ||
| 182 | return; | ||
| 183 | } | ||
| 184 | kbd_cleanup_state = kbd; | ||
| 185 | |||
| 186 | if (!kbd_cleanup_atexit_installed) { | ||
| 187 | /* Since glibc 2.2.3, atexit() (and on_exit(3)) can be used within a shared library to establish | ||
| 188 | * functions that are called when the shared library is unloaded. | ||
| 189 | * -- man atexit(3) | ||
| 190 | */ | ||
| 191 | atexit(kbd_cleanup_atexit); | ||
| 192 | kbd_cleanup_atexit_installed = 1; | ||
| 193 | } | ||
| 194 | |||
| 195 | if (kbd_cleanup_sigactions_installed) { | ||
| 196 | return; | ||
| 197 | } | ||
| 198 | kbd_cleanup_sigactions_installed = 1; | ||
| 199 | |||
| 200 | for (tabidx = 0; tabidx < sizeof(fatal_signals) / sizeof(fatal_signals[0]); ++tabidx) { | ||
| 201 | struct sigaction *old_action_p; | ||
| 202 | struct sigaction new_action; | ||
| 203 | int signum = fatal_signals[tabidx]; | ||
| 204 | old_action_p = &(old_sigaction[signum]); | ||
| 205 | if (sigaction(signum, NULL, old_action_p)) { | ||
| 206 | continue; | ||
| 207 | } | ||
| 208 | |||
| 209 | /* Skip SIGHUP and SIGPIPE if handler is already installed | ||
| 210 | * - assume the handler will do the cleanup | ||
| 211 | */ | ||
| 212 | if ((signum == SIGHUP || signum == SIGPIPE) && (old_action_p->sa_handler != SIG_DFL || (void (*)(int))old_action_p->sa_sigaction != SIG_DFL)) { | ||
| 213 | continue; | ||
| 214 | } | ||
| 215 | |||
| 216 | new_action = *old_action_p; | ||
| 217 | new_action.sa_flags |= SA_SIGINFO; | ||
| 218 | new_action.sa_sigaction = &kbd_cleanup_signal_action; | ||
| 219 | sigaction(signum, &new_action, NULL); | ||
| 220 | } | ||
| 221 | } | ||
| 222 | |||
| 223 | SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void) | ||
| 224 | { | ||
| 225 | SDL_EVDEV_keyboard_state *kbd; | ||
| 226 | struct mouse_info mData; | ||
| 227 | char flag_state; | ||
| 228 | char *devicePath; | ||
| 229 | |||
| 230 | SDL_zero(mData); | ||
| 231 | mData.operation = MOUSE_HIDE; | ||
| 232 | kbd = (SDL_EVDEV_keyboard_state *)SDL_calloc(1, sizeof(SDL_EVDEV_keyboard_state)); | ||
| 233 | if (!kbd) { | ||
| 234 | return NULL; | ||
| 235 | } | ||
| 236 | |||
| 237 | kbd->npadch = -1; | ||
| 238 | |||
| 239 | // This might fail if we're not connected to a tty (e.g. on the Steam Link) | ||
| 240 | kbd->keyboard_fd = kbd->console_fd = open("/dev/tty", O_RDONLY | O_CLOEXEC); | ||
| 241 | |||
| 242 | kbd->shift_state = 0; | ||
| 243 | |||
| 244 | kbd->accents = SDL_calloc(1, sizeof(accentmap_t)); | ||
| 245 | kbd->key_map = SDL_calloc(1, sizeof(keymap_t)); | ||
| 246 | kbd->kbInfo = SDL_calloc(1, sizeof(keyboard_info_t)); | ||
| 247 | |||
| 248 | ioctl(kbd->console_fd, KDGKBINFO, kbd->kbInfo); | ||
| 249 | ioctl(kbd->console_fd, CONS_MOUSECTL, &mData); | ||
| 250 | |||
| 251 | if (ioctl(kbd->console_fd, KDGKBSTATE, &flag_state) == 0) { | ||
| 252 | kbd->ledflagstate = flag_state; | ||
| 253 | } | ||
| 254 | |||
| 255 | if (ioctl(kbd->console_fd, GIO_DEADKEYMAP, kbd->accents) < 0) { | ||
| 256 | SDL_free(kbd->accents); | ||
| 257 | kbd->accents = &accentmap_default_us_acc; | ||
| 258 | } | ||
| 259 | |||
| 260 | if (ioctl(kbd->console_fd, KDGKBMODE, &kbd->old_kbd_mode) == 0) { | ||
| 261 | // Set the keyboard in XLATE mode and load the keymaps | ||
| 262 | ioctl(kbd->console_fd, KDSKBMODE, (unsigned long)(K_XLATE)); | ||
| 263 | if (!SDL_EVDEV_kbd_load_keymaps(kbd)) { | ||
| 264 | SDL_free(kbd->key_map); | ||
| 265 | kbd->key_map = &keymap_default_us_acc; | ||
| 266 | } | ||
| 267 | |||
| 268 | if (SDL_GetHintBoolean(SDL_HINT_MUTE_CONSOLE_KEYBOARD, true)) { | ||
| 269 | /* Take keyboard from console and open the actual keyboard device. | ||
| 270 | * Ensures that the keystrokes do not leak through to the console. | ||
| 271 | */ | ||
| 272 | ioctl(kbd->console_fd, CONS_RELKBD, 1ul); | ||
| 273 | SDL_asprintf(&devicePath, "/dev/kbd%d", kbd->kbInfo->kb_index); | ||
| 274 | kbd->keyboard_fd = open(devicePath, O_WRONLY | O_CLOEXEC); | ||
| 275 | if (kbd->keyboard_fd == -1) { | ||
| 276 | // Give keyboard back. | ||
| 277 | ioctl(kbd->console_fd, CONS_SETKBD, (unsigned long)(kbd->kbInfo->kb_index)); | ||
| 278 | kbd->keyboard_fd = kbd->console_fd; | ||
| 279 | } | ||
| 280 | |||
| 281 | /* Make sure to restore keyboard if application fails to call | ||
| 282 | * SDL_Quit before exit or fatal signal is raised. | ||
| 283 | */ | ||
| 284 | if (!SDL_GetHintBoolean(SDL_HINT_NO_SIGNAL_HANDLERS, false)) { | ||
| 285 | kbd_register_emerg_cleanup(kbd); | ||
| 286 | } | ||
| 287 | SDL_free(devicePath); | ||
| 288 | } else | ||
| 289 | kbd->keyboard_fd = kbd->console_fd; | ||
| 290 | } | ||
| 291 | |||
| 292 | return kbd; | ||
| 293 | } | ||
| 294 | |||
| 295 | void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *kbd) | ||
| 296 | { | ||
| 297 | struct mouse_info mData; | ||
| 298 | |||
| 299 | if (!kbd) { | ||
| 300 | return; | ||
| 301 | } | ||
| 302 | SDL_zero(mData); | ||
| 303 | mData.operation = MOUSE_SHOW; | ||
| 304 | ioctl(kbd->console_fd, CONS_MOUSECTL, &mData); | ||
| 305 | |||
| 306 | kbd_unregister_emerg_cleanup(); | ||
| 307 | |||
| 308 | if (kbd->keyboard_fd >= 0) { | ||
| 309 | // Restore the original keyboard mode | ||
| 310 | ioctl(kbd->keyboard_fd, KDSKBMODE, kbd->old_kbd_mode); | ||
| 311 | |||
| 312 | close(kbd->keyboard_fd); | ||
| 313 | if (kbd->console_fd != kbd->keyboard_fd && kbd->console_fd >= 0) { | ||
| 314 | // Give back keyboard. | ||
| 315 | ioctl(kbd->console_fd, CONS_SETKBD, (unsigned long)(kbd->kbInfo->kb_index)); | ||
| 316 | } | ||
| 317 | kbd->console_fd = kbd->keyboard_fd = -1; | ||
| 318 | } | ||
| 319 | |||
| 320 | SDL_free(kbd); | ||
| 321 | } | ||
| 322 | |||
| 323 | void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, bool muted) | ||
| 324 | { | ||
| 325 | } | ||
| 326 | |||
| 327 | void SDL_EVDEV_kbd_set_vt_switch_callbacks(SDL_EVDEV_keyboard_state *state, void (*release_callback)(void*), void *release_callback_data, void (*acquire_callback)(void*), void *acquire_callback_data) | ||
| 328 | { | ||
| 329 | } | ||
| 330 | |||
| 331 | void SDL_EVDEV_kbd_update(SDL_EVDEV_keyboard_state *state) | ||
| 332 | { | ||
| 333 | } | ||
| 334 | |||
| 335 | /* | ||
| 336 | * Helper Functions. | ||
| 337 | */ | ||
| 338 | static void put_queue(SDL_EVDEV_keyboard_state *kbd, uint c) | ||
| 339 | { | ||
| 340 | // c is already part of a UTF-8 sequence and safe to add as a character | ||
| 341 | if (kbd->text_len < (sizeof(kbd->text) - 1)) { | ||
| 342 | kbd->text[kbd->text_len++] = (char)c; | ||
| 343 | } | ||
| 344 | } | ||
| 345 | |||
| 346 | static void put_utf8(SDL_EVDEV_keyboard_state *kbd, uint c) | ||
| 347 | { | ||
| 348 | if (c < 0x80) | ||
| 349 | /* 0******* */ | ||
| 350 | put_queue(kbd, c); | ||
| 351 | else if (c < 0x800) { | ||
| 352 | /* 110***** 10****** */ | ||
| 353 | put_queue(kbd, 0xc0 | (c >> 6)); | ||
| 354 | put_queue(kbd, 0x80 | (c & 0x3f)); | ||
| 355 | } else if (c < 0x10000) { | ||
| 356 | if (c >= 0xD800 && c < 0xE000) { | ||
| 357 | return; | ||
| 358 | } | ||
| 359 | if (c == 0xFFFF) { | ||
| 360 | return; | ||
| 361 | } | ||
| 362 | /* 1110**** 10****** 10****** */ | ||
| 363 | put_queue(kbd, 0xe0 | (c >> 12)); | ||
| 364 | put_queue(kbd, 0x80 | ((c >> 6) & 0x3f)); | ||
| 365 | put_queue(kbd, 0x80 | (c & 0x3f)); | ||
| 366 | } else if (c < 0x110000) { | ||
| 367 | /* 11110*** 10****** 10****** 10****** */ | ||
| 368 | put_queue(kbd, 0xf0 | (c >> 18)); | ||
| 369 | put_queue(kbd, 0x80 | ((c >> 12) & 0x3f)); | ||
| 370 | put_queue(kbd, 0x80 | ((c >> 6) & 0x3f)); | ||
| 371 | put_queue(kbd, 0x80 | (c & 0x3f)); | ||
| 372 | } | ||
| 373 | } | ||
| 374 | |||
| 375 | /* | ||
| 376 | * We have a combining character DIACR here, followed by the character CH. | ||
| 377 | * If the combination occurs in the table, return the corresponding value. | ||
| 378 | * Otherwise, if CH is a space or equals DIACR, return DIACR. | ||
| 379 | * Otherwise, conclude that DIACR was not combining after all, | ||
| 380 | * queue it and return CH. | ||
| 381 | */ | ||
| 382 | static unsigned int handle_diacr(SDL_EVDEV_keyboard_state *kbd, unsigned int ch) | ||
| 383 | { | ||
| 384 | unsigned int d = kbd->diacr; | ||
| 385 | unsigned int i, j; | ||
| 386 | |||
| 387 | kbd->diacr = 0; | ||
| 388 | |||
| 389 | for (i = 0; i < kbd->accents->n_accs; i++) { | ||
| 390 | if (kbd->accents->acc[i].accchar == d) { | ||
| 391 | for (j = 0; j < NUM_ACCENTCHARS; ++j) { | ||
| 392 | if (kbd->accents->acc[i].map[j][0] == 0) { // end of table | ||
| 393 | break; | ||
| 394 | } | ||
| 395 | if (kbd->accents->acc[i].map[j][0] == ch) { | ||
| 396 | return kbd->accents->acc[i].map[j][1]; | ||
| 397 | } | ||
| 398 | } | ||
| 399 | } | ||
| 400 | } | ||
| 401 | |||
| 402 | if (ch == ' ' || ch == d) { | ||
| 403 | put_utf8(kbd, d); | ||
| 404 | return 0; | ||
| 405 | } | ||
| 406 | put_utf8(kbd, d); | ||
| 407 | |||
| 408 | return ch; | ||
| 409 | } | ||
| 410 | |||
| 411 | static bool vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) | ||
| 412 | { | ||
| 413 | return (kbd->ledflagstate & flag) != 0; | ||
| 414 | } | ||
| 415 | |||
| 416 | static void chg_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) | ||
| 417 | { | ||
| 418 | kbd->ledflagstate ^= flag; | ||
| 419 | ioctl(kbd->keyboard_fd, KDSKBSTATE, (unsigned long)(kbd->ledflagstate)); | ||
| 420 | } | ||
| 421 | |||
| 422 | /* | ||
| 423 | * Special function handlers | ||
| 424 | */ | ||
| 425 | |||
| 426 | static void k_self(SDL_EVDEV_keyboard_state *kbd, unsigned int value, char up_flag) | ||
| 427 | { | ||
| 428 | if (up_flag) { | ||
| 429 | return; // no action, if this is a key release | ||
| 430 | } | ||
| 431 | |||
| 432 | if (kbd->diacr) { | ||
| 433 | value = handle_diacr(kbd, value); | ||
| 434 | } | ||
| 435 | |||
| 436 | if (kbd->dead_key_next) { | ||
| 437 | kbd->dead_key_next = false; | ||
| 438 | kbd->diacr = value; | ||
| 439 | return; | ||
| 440 | } | ||
| 441 | put_utf8(kbd, value); | ||
| 442 | } | ||
| 443 | |||
| 444 | static void k_deadunicode(SDL_EVDEV_keyboard_state *kbd, unsigned int value, char up_flag) | ||
| 445 | { | ||
| 446 | if (up_flag) | ||
| 447 | return; | ||
| 448 | |||
| 449 | kbd->diacr = (kbd->diacr ? handle_diacr(kbd, value) : value); | ||
| 450 | } | ||
| 451 | |||
| 452 | static void k_shift(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) | ||
| 453 | { | ||
| 454 | int old_state = kbd->shift_state; | ||
| 455 | |||
| 456 | if (kbd->rep) | ||
| 457 | return; | ||
| 458 | |||
| 459 | if (up_flag) { | ||
| 460 | /* | ||
| 461 | * handle the case that two shift or control | ||
| 462 | * keys are depressed simultaneously | ||
| 463 | */ | ||
| 464 | if (kbd->shift_down[value]) { | ||
| 465 | kbd->shift_down[value]--; | ||
| 466 | } | ||
| 467 | } else | ||
| 468 | kbd->shift_down[value]++; | ||
| 469 | |||
| 470 | if (kbd->shift_down[value]) | ||
| 471 | kbd->shift_state |= (1 << value); | ||
| 472 | else | ||
| 473 | kbd->shift_state &= ~(1 << value); | ||
| 474 | |||
| 475 | // kludge | ||
| 476 | if (up_flag && kbd->shift_state != old_state && kbd->npadch != -1) { | ||
| 477 | put_utf8(kbd, kbd->npadch); | ||
| 478 | kbd->npadch = -1; | ||
| 479 | } | ||
| 480 | } | ||
| 481 | |||
| 482 | void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int down) | ||
| 483 | { | ||
| 484 | keymap_t key_map; | ||
| 485 | struct keyent_t keysym; | ||
| 486 | unsigned int final_key_state; | ||
| 487 | unsigned int map_from_key_sym; | ||
| 488 | |||
| 489 | if (!kbd) { | ||
| 490 | return; | ||
| 491 | } | ||
| 492 | |||
| 493 | key_map = *kbd->key_map; | ||
| 494 | |||
| 495 | kbd->rep = (down == 2); | ||
| 496 | |||
| 497 | if (keycode < NUM_KEYS) { | ||
| 498 | if (keycode >= 89 && keycode <= 95) { | ||
| 499 | // These constitute unprintable language-related keys, so ignore them. | ||
| 500 | return; | ||
| 501 | } | ||
| 502 | if (keycode > 95) { | ||
| 503 | keycode -= 7; | ||
| 504 | } | ||
| 505 | if (vc_kbd_led(kbd, ALKED) || (kbd->shift_state & 0x8)) { | ||
| 506 | keycode += ALTGR_OFFSET; | ||
| 507 | } | ||
| 508 | keysym = key_map.key[keycode]; | ||
| 509 | } else { | ||
| 510 | return; | ||
| 511 | } | ||
| 512 | |||
| 513 | final_key_state = kbd->shift_state & 0x7; | ||
| 514 | if ((keysym.flgs & FLAG_LOCK_C) && vc_kbd_led(kbd, LED_CAP)) { | ||
| 515 | final_key_state ^= 0x1; | ||
| 516 | } | ||
| 517 | if ((keysym.flgs & FLAG_LOCK_N) && vc_kbd_led(kbd, LED_NUM)) { | ||
| 518 | final_key_state ^= 0x1; | ||
| 519 | } | ||
| 520 | |||
| 521 | map_from_key_sym = keysym.map[final_key_state]; | ||
| 522 | if ((keysym.spcl & (0x80 >> final_key_state)) || (map_from_key_sym & SPCLKEY)) { | ||
| 523 | // Special function. | ||
| 524 | if (map_from_key_sym == 0) | ||
| 525 | return; // Nothing to do. | ||
| 526 | if (map_from_key_sym & SPCLKEY) { | ||
| 527 | map_from_key_sym &= ~SPCLKEY; | ||
| 528 | } | ||
| 529 | if (map_from_key_sym >= F_ACC && map_from_key_sym <= L_ACC) { | ||
| 530 | // Accent function. | ||
| 531 | unsigned int accent_index = map_from_key_sym - F_ACC; | ||
| 532 | if (kbd->accents->acc[accent_index].accchar != 0) { | ||
| 533 | k_deadunicode(kbd, kbd->accents->acc[accent_index].accchar, !down); | ||
| 534 | } | ||
| 535 | } else { | ||
| 536 | switch (map_from_key_sym) { | ||
| 537 | case ASH: // alt/meta shift | ||
| 538 | k_shift(kbd, 3, down == 0); | ||
| 539 | break; | ||
| 540 | case LSHA: // left shift + alt lock | ||
| 541 | case RSHA: // right shift + alt lock | ||
| 542 | if (down == 0) { | ||
| 543 | chg_vc_kbd_led(kbd, ALKED); | ||
| 544 | } | ||
| 545 | SDL_FALLTHROUGH; | ||
| 546 | case LSH: // left shift | ||
| 547 | case RSH: // right shift | ||
| 548 | k_shift(kbd, 0, down == 0); | ||
| 549 | break; | ||
| 550 | case LCTRA: // left ctrl + alt lock | ||
| 551 | case RCTRA: // right ctrl + alt lock | ||
| 552 | if (down == 0) { | ||
| 553 | chg_vc_kbd_led(kbd, ALKED); | ||
| 554 | } | ||
| 555 | SDL_FALLTHROUGH; | ||
| 556 | case LCTR: // left ctrl | ||
| 557 | case RCTR: // right ctrl | ||
| 558 | k_shift(kbd, 1, down == 0); | ||
| 559 | break; | ||
| 560 | case LALTA: // left alt + alt lock | ||
| 561 | case RALTA: // right alt + alt lock | ||
| 562 | if (down == 0) { | ||
| 563 | chg_vc_kbd_led(kbd, ALKED); | ||
| 564 | } | ||
| 565 | SDL_FALLTHROUGH; | ||
| 566 | case LALT: // left alt | ||
| 567 | case RALT: // right alt | ||
| 568 | k_shift(kbd, 2, down == 0); | ||
| 569 | break; | ||
| 570 | case ALK: // alt lock | ||
| 571 | if (down == 1) { | ||
| 572 | chg_vc_kbd_led(kbd, ALKED); | ||
| 573 | } | ||
| 574 | break; | ||
| 575 | case CLK: // caps lock | ||
| 576 | if (down == 1) { | ||
| 577 | chg_vc_kbd_led(kbd, CLKED); | ||
| 578 | } | ||
| 579 | break; | ||
| 580 | case NLK: // num lock | ||
| 581 | if (down == 1) { | ||
| 582 | chg_vc_kbd_led(kbd, NLKED); | ||
| 583 | } | ||
| 584 | break; | ||
| 585 | case SLK: // scroll lock | ||
| 586 | if (down == 1) { | ||
| 587 | chg_vc_kbd_led(kbd, SLKED); | ||
| 588 | } | ||
| 589 | break; | ||
| 590 | default: | ||
| 591 | return; | ||
| 592 | } | ||
| 593 | } | ||
| 594 | } else { | ||
| 595 | if (map_from_key_sym == '\n' || map_from_key_sym == '\r') { | ||
| 596 | if (kbd->diacr) { | ||
| 597 | kbd->diacr = 0; | ||
| 598 | return; | ||
| 599 | } | ||
| 600 | } | ||
| 601 | if (map_from_key_sym >= ' ' && map_from_key_sym != 127) { | ||
| 602 | k_self(kbd, map_from_key_sym, !down); | ||
| 603 | } | ||
| 604 | } | ||
| 605 | |||
| 606 | if (kbd->text_len > 0) { | ||
| 607 | kbd->text[kbd->text_len] = '\0'; | ||
| 608 | SDL_SendKeyboardText(kbd->text); | ||
| 609 | kbd->text_len = 0; | ||
| 610 | } | ||
| 611 | } | ||
| 612 | |||
| 613 | #endif // SDL_INPUT_FBSDKBIO | ||
diff --git a/contrib/SDL-3.2.8/src/core/gdk/SDL_gdk.cpp b/contrib/SDL-3.2.8/src/core/gdk/SDL_gdk.cpp new file mode 100644 index 0000000..738daa5 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/gdk/SDL_gdk.cpp | |||
| @@ -0,0 +1,159 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | extern "C" { | ||
| 24 | #include "../windows/SDL_windows.h" | ||
| 25 | #include "../../events/SDL_events_c.h" | ||
| 26 | } | ||
| 27 | #include <XGameRuntime.h> | ||
| 28 | #include <xsapi-c/services_c.h> | ||
| 29 | #include <appnotify.h> | ||
| 30 | |||
| 31 | static XTaskQueueHandle GDK_GlobalTaskQueue; | ||
| 32 | |||
| 33 | PAPPSTATE_REGISTRATION hPLM = {}; | ||
| 34 | PAPPCONSTRAIN_REGISTRATION hCPLM = {}; | ||
| 35 | HANDLE plmSuspendComplete = nullptr; | ||
| 36 | |||
| 37 | extern "C" | ||
| 38 | bool SDL_GetGDKTaskQueue(XTaskQueueHandle *outTaskQueue) | ||
| 39 | { | ||
| 40 | // If this is the first call, first create the global task queue. | ||
| 41 | if (!GDK_GlobalTaskQueue) { | ||
| 42 | HRESULT hr; | ||
| 43 | |||
| 44 | hr = XTaskQueueCreate(XTaskQueueDispatchMode::ThreadPool, | ||
| 45 | XTaskQueueDispatchMode::Manual, | ||
| 46 | &GDK_GlobalTaskQueue); | ||
| 47 | if (FAILED(hr)) { | ||
| 48 | return SDL_SetError("[GDK] Could not create global task queue"); | ||
| 49 | } | ||
| 50 | |||
| 51 | // The initial call gets the non-duplicated handle so they can clean it up | ||
| 52 | *outTaskQueue = GDK_GlobalTaskQueue; | ||
| 53 | } else { | ||
| 54 | // Duplicate the global task queue handle into outTaskQueue | ||
| 55 | if (FAILED(XTaskQueueDuplicateHandle(GDK_GlobalTaskQueue, outTaskQueue))) { | ||
| 56 | return SDL_SetError("[GDK] Unable to acquire global task queue"); | ||
| 57 | } | ||
| 58 | } | ||
| 59 | |||
| 60 | return true; | ||
| 61 | } | ||
| 62 | |||
| 63 | extern "C" | ||
| 64 | void GDK_DispatchTaskQueue(void) | ||
| 65 | { | ||
| 66 | /* If there is no global task queue, don't do anything. | ||
| 67 | * This gives the option to opt-out for those who want to handle everything themselves. | ||
| 68 | */ | ||
| 69 | if (GDK_GlobalTaskQueue) { | ||
| 70 | // Dispatch any callbacks which are ready. | ||
| 71 | while (XTaskQueueDispatch(GDK_GlobalTaskQueue, XTaskQueuePort::Completion, 0)) | ||
| 72 | ; | ||
| 73 | } | ||
| 74 | } | ||
| 75 | |||
| 76 | extern "C" | ||
| 77 | bool GDK_RegisterChangeNotifications(void) | ||
| 78 | { | ||
| 79 | // Register suspend/resume handling | ||
| 80 | plmSuspendComplete = CreateEventEx(nullptr, nullptr, 0, EVENT_MODIFY_STATE | SYNCHRONIZE); | ||
| 81 | if (!plmSuspendComplete) { | ||
| 82 | return SDL_SetError("[GDK] Unable to create plmSuspendComplete event"); | ||
| 83 | } | ||
| 84 | auto rascn = [](BOOLEAN quiesced, PVOID context) { | ||
| 85 | SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "[GDK] in RegisterAppStateChangeNotification handler"); | ||
| 86 | if (quiesced) { | ||
| 87 | ResetEvent(plmSuspendComplete); | ||
| 88 | SDL_SendAppEvent(SDL_EVENT_DID_ENTER_BACKGROUND); | ||
| 89 | |||
| 90 | // To defer suspension, we must wait to exit this callback. | ||
| 91 | // IMPORTANT: The app must call SDL_GDKSuspendComplete() to release this lock. | ||
| 92 | (void)WaitForSingleObject(plmSuspendComplete, INFINITE); | ||
| 93 | |||
| 94 | SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "[GDK] in RegisterAppStateChangeNotification handler: plmSuspendComplete event signaled."); | ||
| 95 | } else { | ||
| 96 | SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_FOREGROUND); | ||
| 97 | } | ||
| 98 | }; | ||
| 99 | if (RegisterAppStateChangeNotification(rascn, NULL, &hPLM)) { | ||
| 100 | return SDL_SetError("[GDK] Unable to call RegisterAppStateChangeNotification"); | ||
| 101 | } | ||
| 102 | |||
| 103 | // Register constrain/unconstrain handling | ||
| 104 | auto raccn = [](BOOLEAN constrained, PVOID context) { | ||
| 105 | SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "[GDK] in RegisterAppConstrainedChangeNotification handler"); | ||
| 106 | SDL_VideoDevice *_this = SDL_GetVideoDevice(); | ||
| 107 | if (_this) { | ||
| 108 | if (constrained) { | ||
| 109 | SDL_SetKeyboardFocus(NULL); | ||
| 110 | } else { | ||
| 111 | SDL_SetKeyboardFocus(_this->windows); | ||
| 112 | } | ||
| 113 | } | ||
| 114 | }; | ||
| 115 | if (RegisterAppConstrainedChangeNotification(raccn, NULL, &hCPLM)) { | ||
| 116 | return SDL_SetError("[GDK] Unable to call RegisterAppConstrainedChangeNotification"); | ||
| 117 | } | ||
| 118 | |||
| 119 | return true; | ||
| 120 | } | ||
| 121 | |||
| 122 | extern "C" | ||
| 123 | void GDK_UnregisterChangeNotifications(void) | ||
| 124 | { | ||
| 125 | // Unregister suspend/resume handling | ||
| 126 | UnregisterAppStateChangeNotification(hPLM); | ||
| 127 | CloseHandle(plmSuspendComplete); | ||
| 128 | |||
| 129 | // Unregister constrain/unconstrain handling | ||
| 130 | UnregisterAppConstrainedChangeNotification(hCPLM); | ||
| 131 | } | ||
| 132 | |||
| 133 | extern "C" | ||
| 134 | void SDL_GDKSuspendComplete() | ||
| 135 | { | ||
| 136 | if (plmSuspendComplete) { | ||
| 137 | SetEvent(plmSuspendComplete); | ||
| 138 | } | ||
| 139 | } | ||
| 140 | |||
| 141 | extern "C" | ||
| 142 | bool SDL_GetGDKDefaultUser(XUserHandle *outUserHandle) | ||
| 143 | { | ||
| 144 | XAsyncBlock block = { 0 }; | ||
| 145 | HRESULT result; | ||
| 146 | |||
| 147 | if (FAILED(result = XUserAddAsync(XUserAddOptions::AddDefaultUserAllowingUI, &block))) { | ||
| 148 | return WIN_SetErrorFromHRESULT("XUserAddAsync", result); | ||
| 149 | } | ||
| 150 | |||
| 151 | do { | ||
| 152 | result = XUserAddResult(&block, outUserHandle); | ||
| 153 | } while (result == E_PENDING); | ||
| 154 | if (FAILED(result)) { | ||
| 155 | return WIN_SetErrorFromHRESULT("XUserAddResult", result); | ||
| 156 | } | ||
| 157 | |||
| 158 | return true; | ||
| 159 | } | ||
diff --git a/contrib/SDL-3.2.8/src/core/gdk/SDL_gdk.h b/contrib/SDL-3.2.8/src/core/gdk/SDL_gdk.h new file mode 100644 index 0000000..14f4e6f --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/gdk/SDL_gdk.h | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | // This is called from WIN_PumpEvents on GDK | ||
| 24 | extern void GDK_DispatchTaskQueue(void); | ||
| 25 | |||
| 26 | extern bool GDK_RegisterChangeNotifications(void); | ||
| 27 | extern void GDK_UnregisterChangeNotifications(void); | ||
diff --git a/contrib/SDL-3.2.8/src/core/haiku/SDL_BApp.h b/contrib/SDL-3.2.8/src/core/haiku/SDL_BApp.h new file mode 100644 index 0000000..cbd3e3a --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/haiku/SDL_BApp.h | |||
| @@ -0,0 +1,426 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #ifndef SDL_BAPP_H | ||
| 22 | #define SDL_BAPP_H | ||
| 23 | |||
| 24 | #include <Path.h> | ||
| 25 | #include <InterfaceKit.h> | ||
| 26 | #include <LocaleRoster.h> | ||
| 27 | #ifdef SDL_VIDEO_OPENGL | ||
| 28 | #include <OpenGLKit.h> | ||
| 29 | #endif | ||
| 30 | |||
| 31 | #include "../../video/haiku/SDL_bkeyboard.h" | ||
| 32 | |||
| 33 | #ifdef __cplusplus | ||
| 34 | extern "C" { | ||
| 35 | #endif | ||
| 36 | |||
| 37 | #include "SDL_internal.h" | ||
| 38 | |||
| 39 | // Local includes | ||
| 40 | #include "../../events/SDL_events_c.h" | ||
| 41 | #include "../../video/haiku/SDL_bframebuffer.h" | ||
| 42 | |||
| 43 | #ifdef __cplusplus | ||
| 44 | } | ||
| 45 | #endif | ||
| 46 | |||
| 47 | #include <vector> | ||
| 48 | |||
| 49 | |||
| 50 | // Forward declarations | ||
| 51 | class SDL_BLooper; | ||
| 52 | class SDL_BWin; | ||
| 53 | |||
| 54 | // Message constants | ||
| 55 | enum ToSDL | ||
| 56 | { | ||
| 57 | // Intercepted by BWindow on its way to BView | ||
| 58 | BAPP_MOUSE_MOVED, | ||
| 59 | BAPP_MOUSE_BUTTON, | ||
| 60 | BAPP_MOUSE_WHEEL, | ||
| 61 | BAPP_KEY, | ||
| 62 | BAPP_REPAINT, // from _UPDATE_ | ||
| 63 | // From BWindow | ||
| 64 | BAPP_MAXIMIZE, // from B_ZOOM | ||
| 65 | BAPP_MINIMIZE, | ||
| 66 | BAPP_RESTORE, // TODO: IMPLEMENT! | ||
| 67 | BAPP_SHOW, | ||
| 68 | BAPP_HIDE, | ||
| 69 | BAPP_MOUSE_FOCUS, // caused by MOUSE_MOVE | ||
| 70 | BAPP_KEYBOARD_FOCUS, // from WINDOW_ACTIVATED | ||
| 71 | BAPP_WINDOW_CLOSE_REQUESTED, | ||
| 72 | BAPP_WINDOW_MOVED, | ||
| 73 | BAPP_WINDOW_RESIZED, | ||
| 74 | BAPP_SCREEN_CHANGED | ||
| 75 | }; | ||
| 76 | |||
| 77 | |||
| 78 | extern "C" SDL_BLooper *SDL_Looper; | ||
| 79 | |||
| 80 | |||
| 81 | // Create a descendant of BLooper | ||
| 82 | class SDL_BLooper : public BLooper | ||
| 83 | { | ||
| 84 | public: | ||
| 85 | SDL_BLooper(const char* name) : BLooper(name) | ||
| 86 | { | ||
| 87 | #ifdef SDL_VIDEO_OPENGL | ||
| 88 | _current_context = NULL; | ||
| 89 | #endif | ||
| 90 | } | ||
| 91 | |||
| 92 | virtual ~SDL_BLooper() | ||
| 93 | { | ||
| 94 | } | ||
| 95 | |||
| 96 | // Event-handling functions | ||
| 97 | virtual void MessageReceived(BMessage *message) | ||
| 98 | { | ||
| 99 | // Sort out SDL-related messages | ||
| 100 | switch (message->what) { | ||
| 101 | case BAPP_MOUSE_MOVED: | ||
| 102 | _HandleMouseMove(message); | ||
| 103 | break; | ||
| 104 | |||
| 105 | case BAPP_MOUSE_BUTTON: | ||
| 106 | _HandleMouseButton(message); | ||
| 107 | break; | ||
| 108 | |||
| 109 | case BAPP_MOUSE_WHEEL: | ||
| 110 | _HandleMouseWheel(message); | ||
| 111 | break; | ||
| 112 | |||
| 113 | case BAPP_KEY: | ||
| 114 | _HandleKey(message); | ||
| 115 | break; | ||
| 116 | |||
| 117 | case BAPP_REPAINT: | ||
| 118 | _HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_EXPOSED); | ||
| 119 | break; | ||
| 120 | |||
| 121 | case BAPP_MAXIMIZE: | ||
| 122 | _HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_MAXIMIZED); | ||
| 123 | break; | ||
| 124 | |||
| 125 | case BAPP_MINIMIZE: | ||
| 126 | _HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_MINIMIZED); | ||
| 127 | break; | ||
| 128 | |||
| 129 | case BAPP_SHOW: | ||
| 130 | _HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_SHOWN); | ||
| 131 | break; | ||
| 132 | |||
| 133 | case BAPP_HIDE: | ||
| 134 | _HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_HIDDEN); | ||
| 135 | break; | ||
| 136 | |||
| 137 | case BAPP_MOUSE_FOCUS: | ||
| 138 | _HandleMouseFocus(message); | ||
| 139 | break; | ||
| 140 | |||
| 141 | case BAPP_KEYBOARD_FOCUS: | ||
| 142 | _HandleKeyboardFocus(message); | ||
| 143 | break; | ||
| 144 | |||
| 145 | case BAPP_WINDOW_CLOSE_REQUESTED: | ||
| 146 | _HandleBasicWindowEvent(message, SDL_EVENT_WINDOW_CLOSE_REQUESTED); | ||
| 147 | break; | ||
| 148 | |||
| 149 | case BAPP_WINDOW_MOVED: | ||
| 150 | _HandleWindowMoved(message); | ||
| 151 | break; | ||
| 152 | |||
| 153 | case BAPP_WINDOW_RESIZED: | ||
| 154 | _HandleWindowResized(message); | ||
| 155 | break; | ||
| 156 | |||
| 157 | case B_LOCALE_CHANGED: | ||
| 158 | SDL_SendLocaleChangedEvent(); | ||
| 159 | break; | ||
| 160 | |||
| 161 | case BAPP_SCREEN_CHANGED: | ||
| 162 | // TODO: Handle screen resize or workspace change | ||
| 163 | break; | ||
| 164 | |||
| 165 | default: | ||
| 166 | BLooper::MessageReceived(message); | ||
| 167 | break; | ||
| 168 | } | ||
| 169 | } | ||
| 170 | |||
| 171 | // Window creation/destruction methods | ||
| 172 | int32 GetID(SDL_Window *win) | ||
| 173 | { | ||
| 174 | int32 i; | ||
| 175 | for (i = 0; i < _GetNumWindowSlots(); ++i) { | ||
| 176 | if (GetSDLWindow(i) == NULL) { | ||
| 177 | _SetSDLWindow(win, i); | ||
| 178 | return i; | ||
| 179 | } | ||
| 180 | } | ||
| 181 | |||
| 182 | // Expand the vector if all slots are full | ||
| 183 | if (i == _GetNumWindowSlots()) { | ||
| 184 | _PushBackWindow(win); | ||
| 185 | return i; | ||
| 186 | } | ||
| 187 | |||
| 188 | // TODO: error handling | ||
| 189 | return 0; | ||
| 190 | } | ||
| 191 | |||
| 192 | /* FIXME: Bad coding practice, but I can't include SDL_BWin.h here. Is | ||
| 193 | there another way to do this? */ | ||
| 194 | void ClearID(SDL_BWin *bwin); // Defined in SDL_BeApp.cc | ||
| 195 | |||
| 196 | SDL_Window *GetSDLWindow(int32 winID) | ||
| 197 | { | ||
| 198 | return _window_map[winID]; | ||
| 199 | } | ||
| 200 | |||
| 201 | #ifdef SDL_VIDEO_OPENGL | ||
| 202 | BGLView *GetCurrentContext() | ||
| 203 | { | ||
| 204 | return _current_context; | ||
| 205 | } | ||
| 206 | |||
| 207 | void SetCurrentContext(BGLView *newContext) | ||
| 208 | { | ||
| 209 | if (_current_context) | ||
| 210 | _current_context->UnlockGL(); | ||
| 211 | _current_context = newContext; | ||
| 212 | if (_current_context) | ||
| 213 | _current_context->LockGL(); | ||
| 214 | } | ||
| 215 | #endif | ||
| 216 | |||
| 217 | private: | ||
| 218 | // Event management | ||
| 219 | void _HandleBasicWindowEvent(BMessage *msg, SDL_EventType sdlEventType) | ||
| 220 | { | ||
| 221 | SDL_Window *win; | ||
| 222 | int32 winID; | ||
| 223 | if ( | ||
| 224 | !_GetWinID(msg, &winID)) { | ||
| 225 | return; | ||
| 226 | } | ||
| 227 | win = GetSDLWindow(winID); | ||
| 228 | SDL_SendWindowEvent(win, sdlEventType, 0, 0); | ||
| 229 | } | ||
| 230 | |||
| 231 | void _HandleMouseMove(BMessage *msg) | ||
| 232 | { | ||
| 233 | SDL_Window *win; | ||
| 234 | int32 winID; | ||
| 235 | int32 x = 0, y = 0; | ||
| 236 | if ( | ||
| 237 | !_GetWinID(msg, &winID) || | ||
| 238 | msg->FindInt32("x", &x) != B_OK || // x movement | ||
| 239 | msg->FindInt32("y", &y) != B_OK // y movement | ||
| 240 | ) { | ||
| 241 | return; | ||
| 242 | } | ||
| 243 | win = GetSDLWindow(winID); | ||
| 244 | |||
| 245 | // Simple relative mode support for mouse. | ||
| 246 | if (SDL_GetMouse()->relative_mode) { | ||
| 247 | int winWidth, winHeight, winPosX, winPosY; | ||
| 248 | SDL_GetWindowSize(win, &winWidth, &winHeight); | ||
| 249 | SDL_GetWindowPosition(win, &winPosX, &winPosY); | ||
| 250 | int dx = x - (winWidth / 2); | ||
| 251 | int dy = y - (winHeight / 2); | ||
| 252 | SDL_SendMouseMotion(0, win, SDL_DEFAULT_MOUSE_ID, SDL_GetMouse()->relative_mode, (float)dx, (float)dy); | ||
| 253 | set_mouse_position((winPosX + winWidth / 2), (winPosY + winHeight / 2)); | ||
| 254 | if (!be_app->IsCursorHidden()) | ||
| 255 | be_app->HideCursor(); | ||
| 256 | } else { | ||
| 257 | SDL_SendMouseMotion(0, win, SDL_DEFAULT_MOUSE_ID, false, (float)x, (float)y); | ||
| 258 | if (SDL_CursorVisible() && be_app->IsCursorHidden()) | ||
| 259 | be_app->ShowCursor(); | ||
| 260 | } | ||
| 261 | } | ||
| 262 | |||
| 263 | void _HandleMouseButton(BMessage *msg) | ||
| 264 | { | ||
| 265 | SDL_Window *win; | ||
| 266 | int32 winID; | ||
| 267 | int32 button; | ||
| 268 | bool down; | ||
| 269 | if ( | ||
| 270 | !_GetWinID(msg, &winID) || | ||
| 271 | msg->FindInt32("button-id", &button) != B_OK || | ||
| 272 | msg->FindBool("button-down", &down) != B_OK) { | ||
| 273 | return; | ||
| 274 | } | ||
| 275 | win = GetSDLWindow(winID); | ||
| 276 | SDL_SendMouseButton(0, win, SDL_DEFAULT_MOUSE_ID, button, down); | ||
| 277 | } | ||
| 278 | |||
| 279 | void _HandleMouseWheel(BMessage *msg) | ||
| 280 | { | ||
| 281 | SDL_Window *win; | ||
| 282 | int32 winID; | ||
| 283 | int32 xTicks, yTicks; | ||
| 284 | if ( | ||
| 285 | !_GetWinID(msg, &winID) || | ||
| 286 | msg->FindInt32("xticks", &xTicks) != B_OK || | ||
| 287 | msg->FindInt32("yticks", &yTicks) != B_OK) { | ||
| 288 | return; | ||
| 289 | } | ||
| 290 | win = GetSDLWindow(winID); | ||
| 291 | SDL_SendMouseWheel(0, win, SDL_DEFAULT_MOUSE_ID, xTicks, -yTicks, SDL_MOUSEWHEEL_NORMAL); | ||
| 292 | } | ||
| 293 | |||
| 294 | void _HandleKey(BMessage *msg) | ||
| 295 | { | ||
| 296 | int32 scancode; | ||
| 297 | bool down; | ||
| 298 | if ( | ||
| 299 | msg->FindInt32("key-scancode", &scancode) != B_OK || | ||
| 300 | msg->FindBool("key-down", &down) != B_OK) { | ||
| 301 | return; | ||
| 302 | } | ||
| 303 | |||
| 304 | SDL_SendKeyboardKey(0, SDL_DEFAULT_KEYBOARD_ID, scancode, HAIKU_GetScancodeFromBeKey(scancode), down); | ||
| 305 | |||
| 306 | if (down) { | ||
| 307 | SDL_Window *win = SDL_GetKeyboardFocus(); | ||
| 308 | if (win && SDL_TextInputActive(win)) { | ||
| 309 | const int8 *keyUtf8; | ||
| 310 | ssize_t count; | ||
| 311 | if (msg->FindData("key-utf8", B_INT8_TYPE, (const void **)&keyUtf8, &count) == B_OK) { | ||
| 312 | char text[64]; | ||
| 313 | SDL_zeroa(text); | ||
| 314 | SDL_memcpy(text, keyUtf8, count); | ||
| 315 | SDL_SendKeyboardText(text); | ||
| 316 | } | ||
| 317 | } | ||
| 318 | } | ||
| 319 | } | ||
| 320 | |||
| 321 | void _HandleMouseFocus(BMessage *msg) | ||
| 322 | { | ||
| 323 | SDL_Window *win; | ||
| 324 | int32 winID; | ||
| 325 | bool bSetFocus; // If false, lose focus | ||
| 326 | if ( | ||
| 327 | !_GetWinID(msg, &winID) || | ||
| 328 | msg->FindBool("focusGained", &bSetFocus) != B_OK) { | ||
| 329 | return; | ||
| 330 | } | ||
| 331 | win = GetSDLWindow(winID); | ||
| 332 | if (bSetFocus) { | ||
| 333 | SDL_SetMouseFocus(win); | ||
| 334 | } else if (SDL_GetMouseFocus() == win) { | ||
| 335 | // Only lose all focus if this window was the current focus | ||
| 336 | SDL_SetMouseFocus(NULL); | ||
| 337 | } | ||
| 338 | } | ||
| 339 | |||
| 340 | void _HandleKeyboardFocus(BMessage *msg) | ||
| 341 | { | ||
| 342 | SDL_Window *win; | ||
| 343 | int32 winID; | ||
| 344 | bool bSetFocus; // If false, lose focus | ||
| 345 | if ( | ||
| 346 | !_GetWinID(msg, &winID) || | ||
| 347 | msg->FindBool("focusGained", &bSetFocus) != B_OK) { | ||
| 348 | return; | ||
| 349 | } | ||
| 350 | win = GetSDLWindow(winID); | ||
| 351 | if (bSetFocus) { | ||
| 352 | SDL_SetKeyboardFocus(win); | ||
| 353 | } else if (SDL_GetKeyboardFocus() == win) { | ||
| 354 | // Only lose all focus if this window was the current focus | ||
| 355 | SDL_SetKeyboardFocus(NULL); | ||
| 356 | } | ||
| 357 | } | ||
| 358 | |||
| 359 | void _HandleWindowMoved(BMessage *msg) | ||
| 360 | { | ||
| 361 | SDL_Window *win; | ||
| 362 | int32 winID; | ||
| 363 | int32 xPos, yPos; | ||
| 364 | // Get the window id and new x/y position of the window | ||
| 365 | if ( | ||
| 366 | !_GetWinID(msg, &winID) || | ||
| 367 | msg->FindInt32("window-x", &xPos) != B_OK || | ||
| 368 | msg->FindInt32("window-y", &yPos) != B_OK) { | ||
| 369 | return; | ||
| 370 | } | ||
| 371 | win = GetSDLWindow(winID); | ||
| 372 | SDL_SendWindowEvent(win, SDL_EVENT_WINDOW_MOVED, xPos, yPos); | ||
| 373 | } | ||
| 374 | |||
| 375 | void _HandleWindowResized(BMessage *msg) | ||
| 376 | { | ||
| 377 | SDL_Window *win; | ||
| 378 | int32 winID; | ||
| 379 | int32 w, h; | ||
| 380 | // Get the window id ]and new x/y position of the window | ||
| 381 | if ( | ||
| 382 | !_GetWinID(msg, &winID) || | ||
| 383 | msg->FindInt32("window-w", &w) != B_OK || | ||
| 384 | msg->FindInt32("window-h", &h) != B_OK) { | ||
| 385 | return; | ||
| 386 | } | ||
| 387 | win = GetSDLWindow(winID); | ||
| 388 | SDL_SendWindowEvent(win, SDL_EVENT_WINDOW_RESIZED, w, h); | ||
| 389 | } | ||
| 390 | |||
| 391 | bool _GetWinID(BMessage *msg, int32 *winID) | ||
| 392 | { | ||
| 393 | return msg->FindInt32("window-id", winID) == B_OK; | ||
| 394 | } | ||
| 395 | |||
| 396 | /* Vector functions: Wraps vector stuff in case we need to change | ||
| 397 | implementation */ | ||
| 398 | void _SetSDLWindow(SDL_Window *win, int32 winID) | ||
| 399 | { | ||
| 400 | _window_map[winID] = win; | ||
| 401 | } | ||
| 402 | |||
| 403 | int32 _GetNumWindowSlots() | ||
| 404 | { | ||
| 405 | return _window_map.size(); | ||
| 406 | } | ||
| 407 | |||
| 408 | void _PopBackWindow() | ||
| 409 | { | ||
| 410 | _window_map.pop_back(); | ||
| 411 | } | ||
| 412 | |||
| 413 | void _PushBackWindow(SDL_Window *win) | ||
| 414 | { | ||
| 415 | _window_map.push_back(win); | ||
| 416 | } | ||
| 417 | |||
| 418 | // Members | ||
| 419 | std::vector<SDL_Window *> _window_map; // Keeps track of SDL_Windows by index-id | ||
| 420 | |||
| 421 | #ifdef SDL_VIDEO_OPENGL | ||
| 422 | BGLView *_current_context; | ||
| 423 | #endif | ||
| 424 | }; | ||
| 425 | |||
| 426 | #endif | ||
diff --git a/contrib/SDL-3.2.8/src/core/haiku/SDL_BeApp.cc b/contrib/SDL-3.2.8/src/core/haiku/SDL_BeApp.cc new file mode 100644 index 0000000..350f7f3 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/haiku/SDL_BeApp.cc | |||
| @@ -0,0 +1,182 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifdef SDL_PLATFORM_HAIKU | ||
| 24 | |||
| 25 | // Handle the BeApp specific portions of the application | ||
| 26 | |||
| 27 | #include <AppKit.h> | ||
| 28 | #include <storage/AppFileInfo.h> | ||
| 29 | #include <storage/Path.h> | ||
| 30 | #include <storage/Entry.h> | ||
| 31 | #include <storage/File.h> | ||
| 32 | #include <unistd.h> | ||
| 33 | #include <memory> | ||
| 34 | |||
| 35 | #include "SDL_BApp.h" // SDL_BLooper class definition | ||
| 36 | #include "SDL_BeApp.h" | ||
| 37 | |||
| 38 | #include "../../video/haiku/SDL_BWin.h" | ||
| 39 | |||
| 40 | #ifdef __cplusplus | ||
| 41 | extern "C" { | ||
| 42 | #endif | ||
| 43 | |||
| 44 | #include "../../thread/SDL_systhread.h" | ||
| 45 | |||
| 46 | // Flag to tell whether or not the Be application and looper are active or not | ||
| 47 | static int SDL_BeAppActive = 0; | ||
| 48 | static SDL_Thread *SDL_AppThread = NULL; | ||
| 49 | SDL_BLooper *SDL_Looper = NULL; | ||
| 50 | |||
| 51 | |||
| 52 | // Default application signature | ||
| 53 | const char *SDL_signature = "application/x-SDL-executable"; | ||
| 54 | |||
| 55 | |||
| 56 | // Create a descendant of BApplication | ||
| 57 | class SDL_BApp : public BApplication { | ||
| 58 | public: | ||
| 59 | SDL_BApp(const char* signature) : | ||
| 60 | BApplication(signature) { | ||
| 61 | } | ||
| 62 | |||
| 63 | |||
| 64 | virtual ~SDL_BApp() { | ||
| 65 | } | ||
| 66 | |||
| 67 | |||
| 68 | virtual void RefsReceived(BMessage* message) { | ||
| 69 | entry_ref entryRef; | ||
| 70 | for (int32 i = 0; message->FindRef("refs", i, &entryRef) == B_OK; i++) { | ||
| 71 | BPath referencePath = BPath(&entryRef); | ||
| 72 | SDL_SendDropFile(NULL, NULL, referencePath.Path()); | ||
| 73 | } | ||
| 74 | return; | ||
| 75 | } | ||
| 76 | }; | ||
| 77 | |||
| 78 | |||
| 79 | static int StartBeApp(void *unused) | ||
| 80 | { | ||
| 81 | std::unique_ptr<BApplication> App; | ||
| 82 | |||
| 83 | (void)unused; | ||
| 84 | // dig resources for correct signature | ||
| 85 | image_info info; | ||
| 86 | int32 cookie = 0; | ||
| 87 | if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) { | ||
| 88 | BFile f(info.name, O_RDONLY); | ||
| 89 | if (f.InitCheck() == B_OK) { | ||
| 90 | BAppFileInfo app_info(&f); | ||
| 91 | if (app_info.InitCheck() == B_OK) { | ||
| 92 | char sig[B_MIME_TYPE_LENGTH]; | ||
| 93 | if (app_info.GetSignature(sig) == B_OK) { | ||
| 94 | SDL_signature = strndup(sig, B_MIME_TYPE_LENGTH); | ||
| 95 | } | ||
| 96 | } | ||
| 97 | } | ||
| 98 | } | ||
| 99 | |||
| 100 | App = std::unique_ptr<BApplication>(new SDL_BApp(SDL_signature)); | ||
| 101 | |||
| 102 | App->Run(); | ||
| 103 | return 0; | ||
| 104 | } | ||
| 105 | |||
| 106 | |||
| 107 | static bool StartBeLooper() | ||
| 108 | { | ||
| 109 | if (!be_app) { | ||
| 110 | SDL_AppThread = SDL_CreateThread(StartBeApp, "SDLApplication", NULL); | ||
| 111 | if (!SDL_AppThread) { | ||
| 112 | return SDL_SetError("Couldn't create BApplication thread"); | ||
| 113 | } | ||
| 114 | |||
| 115 | do { | ||
| 116 | SDL_Delay(10); | ||
| 117 | } while ((!be_app) || be_app->IsLaunching()); | ||
| 118 | } | ||
| 119 | |||
| 120 | SDL_Looper = new SDL_BLooper("SDLLooper"); | ||
| 121 | SDL_Looper->Run(); | ||
| 122 | return true; | ||
| 123 | } | ||
| 124 | |||
| 125 | |||
| 126 | // Initialize the Be Application, if it's not already started | ||
| 127 | bool SDL_InitBeApp(void) | ||
| 128 | { | ||
| 129 | // Create the BApplication that handles appserver interaction | ||
| 130 | if (SDL_BeAppActive <= 0) { | ||
| 131 | if (!StartBeLooper()) { | ||
| 132 | return false; | ||
| 133 | } | ||
| 134 | |||
| 135 | // Mark the application active | ||
| 136 | SDL_BeAppActive = 0; | ||
| 137 | } | ||
| 138 | |||
| 139 | // Increment the application reference count | ||
| 140 | ++SDL_BeAppActive; | ||
| 141 | |||
| 142 | // The app is running, and we're ready to go | ||
| 143 | return true; | ||
| 144 | } | ||
| 145 | |||
| 146 | // Quit the Be Application, if there's nothing left to do | ||
| 147 | void SDL_QuitBeApp(void) | ||
| 148 | { | ||
| 149 | // Decrement the application reference count | ||
| 150 | --SDL_BeAppActive; | ||
| 151 | |||
| 152 | // If the reference count reached zero, clean up the app | ||
| 153 | if (SDL_BeAppActive == 0) { | ||
| 154 | SDL_Looper->Lock(); | ||
| 155 | SDL_Looper->Quit(); | ||
| 156 | SDL_Looper = NULL; | ||
| 157 | if (SDL_AppThread) { | ||
| 158 | if (be_app != NULL) { // Not tested | ||
| 159 | be_app->PostMessage(B_QUIT_REQUESTED); | ||
| 160 | } | ||
| 161 | SDL_WaitThread(SDL_AppThread, NULL); | ||
| 162 | SDL_AppThread = NULL; | ||
| 163 | } | ||
| 164 | // be_app should now be NULL since be_app has quit | ||
| 165 | } | ||
| 166 | } | ||
| 167 | |||
| 168 | #ifdef __cplusplus | ||
| 169 | } | ||
| 170 | #endif | ||
| 171 | |||
| 172 | // SDL_BApp functions | ||
| 173 | void SDL_BLooper::ClearID(SDL_BWin *bwin) { | ||
| 174 | _SetSDLWindow(NULL, bwin->GetID()); | ||
| 175 | int32 i = _GetNumWindowSlots() - 1; | ||
| 176 | while (i >= 0 && GetSDLWindow(i) == NULL) { | ||
| 177 | _PopBackWindow(); | ||
| 178 | --i; | ||
| 179 | } | ||
| 180 | } | ||
| 181 | |||
| 182 | #endif // SDL_PLATFORM_HAIKU | ||
diff --git a/contrib/SDL-3.2.8/src/core/haiku/SDL_BeApp.h b/contrib/SDL-3.2.8/src/core/haiku/SDL_BeApp.h new file mode 100644 index 0000000..de5bb6b --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/haiku/SDL_BeApp.h | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifdef __cplusplus | ||
| 24 | extern "C" { | ||
| 25 | #endif | ||
| 26 | // Handle the BeApp specific portions of the application | ||
| 27 | |||
| 28 | // Initialize the Be Application, if it's not already started | ||
| 29 | extern bool SDL_InitBeApp(void); | ||
| 30 | |||
| 31 | // Quit the Be Application, if there's nothing left to do | ||
| 32 | extern void SDL_QuitBeApp(void); | ||
| 33 | |||
| 34 | // Be Application Signature | ||
| 35 | extern const char *SDL_signature; | ||
| 36 | |||
| 37 | |||
| 38 | #ifdef __cplusplus | ||
| 39 | } | ||
| 40 | #endif | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_dbus.c b/contrib/SDL-3.2.8/src/core/linux/SDL_dbus.c new file mode 100644 index 0000000..9a2fc1e --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_dbus.c | |||
| @@ -0,0 +1,641 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | #include "SDL_dbus.h" | ||
| 23 | #include "../../stdlib/SDL_vacopy.h" | ||
| 24 | |||
| 25 | #ifdef SDL_USE_LIBDBUS | ||
| 26 | // we never link directly to libdbus. | ||
| 27 | static const char *dbus_library = "libdbus-1.so.3"; | ||
| 28 | static SDL_SharedObject *dbus_handle = NULL; | ||
| 29 | static char *inhibit_handle = NULL; | ||
| 30 | static unsigned int screensaver_cookie = 0; | ||
| 31 | static SDL_DBusContext dbus; | ||
| 32 | |||
| 33 | static bool LoadDBUSSyms(void) | ||
| 34 | { | ||
| 35 | #define SDL_DBUS_SYM2_OPTIONAL(TYPE, x, y) \ | ||
| 36 | dbus.x = (TYPE)SDL_LoadFunction(dbus_handle, #y) | ||
| 37 | |||
| 38 | #define SDL_DBUS_SYM2(TYPE, x, y) \ | ||
| 39 | if (!(dbus.x = (TYPE)SDL_LoadFunction(dbus_handle, #y))) \ | ||
| 40 | return false | ||
| 41 | |||
| 42 | #define SDL_DBUS_SYM_OPTIONAL(TYPE, x) \ | ||
| 43 | SDL_DBUS_SYM2_OPTIONAL(TYPE, x, dbus_##x) | ||
| 44 | |||
| 45 | #define SDL_DBUS_SYM(TYPE, x) \ | ||
| 46 | SDL_DBUS_SYM2(TYPE, x, dbus_##x) | ||
| 47 | |||
| 48 | SDL_DBUS_SYM(DBusConnection *(*)(DBusBusType, DBusError *), bus_get_private); | ||
| 49 | SDL_DBUS_SYM(dbus_bool_t (*)(DBusConnection *, DBusError *), bus_register); | ||
| 50 | SDL_DBUS_SYM(void (*)(DBusConnection *, const char *, DBusError *), bus_add_match); | ||
| 51 | SDL_DBUS_SYM(DBusConnection *(*)(const char *, DBusError *), connection_open_private); | ||
| 52 | SDL_DBUS_SYM(void (*)(DBusConnection *, dbus_bool_t), connection_set_exit_on_disconnect); | ||
| 53 | SDL_DBUS_SYM(dbus_bool_t (*)(DBusConnection *), connection_get_is_connected); | ||
| 54 | SDL_DBUS_SYM(dbus_bool_t (*)(DBusConnection *, DBusHandleMessageFunction, void *, DBusFreeFunction), connection_add_filter); | ||
| 55 | SDL_DBUS_SYM(dbus_bool_t (*)(DBusConnection *, DBusHandleMessageFunction, void *), connection_remove_filter); | ||
| 56 | SDL_DBUS_SYM(dbus_bool_t (*)(DBusConnection *, const char *, const DBusObjectPathVTable *, void *, DBusError *), connection_try_register_object_path); | ||
| 57 | SDL_DBUS_SYM(dbus_bool_t (*)(DBusConnection *, DBusMessage *, dbus_uint32_t *), connection_send); | ||
| 58 | SDL_DBUS_SYM(DBusMessage *(*)(DBusConnection *, DBusMessage *, int, DBusError *), connection_send_with_reply_and_block); | ||
| 59 | SDL_DBUS_SYM(void (*)(DBusConnection *), connection_close); | ||
| 60 | SDL_DBUS_SYM(void (*)(DBusConnection *), connection_ref); | ||
| 61 | SDL_DBUS_SYM(void (*)(DBusConnection *), connection_unref); | ||
| 62 | SDL_DBUS_SYM(void (*)(DBusConnection *), connection_flush); | ||
| 63 | SDL_DBUS_SYM(dbus_bool_t (*)(DBusConnection *, int), connection_read_write); | ||
| 64 | SDL_DBUS_SYM(DBusDispatchStatus (*)(DBusConnection *), connection_dispatch); | ||
| 65 | SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessage *, const char *, const char *), message_is_signal); | ||
| 66 | SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessage *, const char *), message_has_path); | ||
| 67 | SDL_DBUS_SYM(DBusMessage *(*)(const char *, const char *, const char *, const char *), message_new_method_call); | ||
| 68 | SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessage *, int, ...), message_append_args); | ||
| 69 | SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessage *, int, va_list), message_append_args_valist); | ||
| 70 | SDL_DBUS_SYM(void (*)(DBusMessage *, DBusMessageIter *), message_iter_init_append); | ||
| 71 | SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessageIter *, int, const char *, DBusMessageIter *), message_iter_open_container); | ||
| 72 | SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessageIter *, int, const void *), message_iter_append_basic); | ||
| 73 | SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessageIter *, DBusMessageIter *), message_iter_close_container); | ||
| 74 | SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessage *, DBusError *, int, ...), message_get_args); | ||
| 75 | SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessage *, DBusError *, int, va_list), message_get_args_valist); | ||
| 76 | SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessage *, DBusMessageIter *), message_iter_init); | ||
| 77 | SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessageIter *), message_iter_next); | ||
| 78 | SDL_DBUS_SYM(void (*)(DBusMessageIter *, void *), message_iter_get_basic); | ||
| 79 | SDL_DBUS_SYM(int (*)(DBusMessageIter *), message_iter_get_arg_type); | ||
| 80 | SDL_DBUS_SYM(void (*)(DBusMessageIter *, DBusMessageIter *), message_iter_recurse); | ||
| 81 | SDL_DBUS_SYM(void (*)(DBusMessage *), message_unref); | ||
| 82 | SDL_DBUS_SYM(dbus_bool_t (*)(void), threads_init_default); | ||
| 83 | SDL_DBUS_SYM(void (*)(DBusError *), error_init); | ||
| 84 | SDL_DBUS_SYM(dbus_bool_t (*)(const DBusError *), error_is_set); | ||
| 85 | SDL_DBUS_SYM(void (*)(DBusError *), error_free); | ||
| 86 | SDL_DBUS_SYM(char *(*)(void), get_local_machine_id); | ||
| 87 | SDL_DBUS_SYM_OPTIONAL(char *(*)(DBusError *), try_get_local_machine_id); | ||
| 88 | SDL_DBUS_SYM(void (*)(void *), free); | ||
| 89 | SDL_DBUS_SYM(void (*)(char **), free_string_array); | ||
| 90 | SDL_DBUS_SYM(void (*)(void), shutdown); | ||
| 91 | |||
| 92 | #undef SDL_DBUS_SYM | ||
| 93 | #undef SDL_DBUS_SYM2 | ||
| 94 | |||
| 95 | return true; | ||
| 96 | } | ||
| 97 | |||
| 98 | static void UnloadDBUSLibrary(void) | ||
| 99 | { | ||
| 100 | if (dbus_handle) { | ||
| 101 | SDL_UnloadObject(dbus_handle); | ||
| 102 | dbus_handle = NULL; | ||
| 103 | } | ||
| 104 | } | ||
| 105 | |||
| 106 | static bool LoadDBUSLibrary(void) | ||
| 107 | { | ||
| 108 | bool result = true; | ||
| 109 | if (!dbus_handle) { | ||
| 110 | dbus_handle = SDL_LoadObject(dbus_library); | ||
| 111 | if (!dbus_handle) { | ||
| 112 | result = false; | ||
| 113 | // Don't call SDL_SetError(): SDL_LoadObject already did. | ||
| 114 | } else { | ||
| 115 | result = LoadDBUSSyms(); | ||
| 116 | if (!result) { | ||
| 117 | UnloadDBUSLibrary(); | ||
| 118 | } | ||
| 119 | } | ||
| 120 | } | ||
| 121 | return result; | ||
| 122 | } | ||
| 123 | |||
| 124 | static SDL_InitState dbus_init; | ||
| 125 | |||
| 126 | void SDL_DBus_Init(void) | ||
| 127 | { | ||
| 128 | static bool is_dbus_available = true; | ||
| 129 | |||
| 130 | if (!is_dbus_available) { | ||
| 131 | return; // don't keep trying if this fails. | ||
| 132 | } | ||
| 133 | |||
| 134 | if (!SDL_ShouldInit(&dbus_init)) { | ||
| 135 | return; | ||
| 136 | } | ||
| 137 | |||
| 138 | if (!LoadDBUSLibrary()) { | ||
| 139 | goto error; | ||
| 140 | } | ||
| 141 | |||
| 142 | if (!dbus.threads_init_default()) { | ||
| 143 | goto error; | ||
| 144 | } | ||
| 145 | |||
| 146 | DBusError err; | ||
| 147 | dbus.error_init(&err); | ||
| 148 | // session bus is required | ||
| 149 | |||
| 150 | dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err); | ||
| 151 | if (dbus.error_is_set(&err)) { | ||
| 152 | dbus.error_free(&err); | ||
| 153 | goto error; | ||
| 154 | } | ||
| 155 | dbus.connection_set_exit_on_disconnect(dbus.session_conn, 0); | ||
| 156 | |||
| 157 | // system bus is optional | ||
| 158 | dbus.system_conn = dbus.bus_get_private(DBUS_BUS_SYSTEM, &err); | ||
| 159 | if (!dbus.error_is_set(&err)) { | ||
| 160 | dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0); | ||
| 161 | } | ||
| 162 | |||
| 163 | dbus.error_free(&err); | ||
| 164 | SDL_SetInitialized(&dbus_init, true); | ||
| 165 | return; | ||
| 166 | |||
| 167 | error: | ||
| 168 | is_dbus_available = false; | ||
| 169 | SDL_SetInitialized(&dbus_init, true); | ||
| 170 | SDL_DBus_Quit(); | ||
| 171 | } | ||
| 172 | |||
| 173 | void SDL_DBus_Quit(void) | ||
| 174 | { | ||
| 175 | if (!SDL_ShouldQuit(&dbus_init)) { | ||
| 176 | return; | ||
| 177 | } | ||
| 178 | |||
| 179 | if (dbus.system_conn) { | ||
| 180 | dbus.connection_close(dbus.system_conn); | ||
| 181 | dbus.connection_unref(dbus.system_conn); | ||
| 182 | } | ||
| 183 | if (dbus.session_conn) { | ||
| 184 | dbus.connection_close(dbus.session_conn); | ||
| 185 | dbus.connection_unref(dbus.session_conn); | ||
| 186 | } | ||
| 187 | |||
| 188 | if (SDL_GetHintBoolean(SDL_HINT_SHUTDOWN_DBUS_ON_QUIT, false)) { | ||
| 189 | if (dbus.shutdown) { | ||
| 190 | dbus.shutdown(); | ||
| 191 | } | ||
| 192 | |||
| 193 | UnloadDBUSLibrary(); | ||
| 194 | } else { | ||
| 195 | /* Leaving libdbus loaded when skipping dbus_shutdown() avoids | ||
| 196 | * spurious leak warnings from LeakSanitizer on internal D-Bus | ||
| 197 | * allocations that would be freed by dbus_shutdown(). */ | ||
| 198 | dbus_handle = NULL; | ||
| 199 | } | ||
| 200 | |||
| 201 | SDL_zero(dbus); | ||
| 202 | if (inhibit_handle) { | ||
| 203 | SDL_free(inhibit_handle); | ||
| 204 | inhibit_handle = NULL; | ||
| 205 | } | ||
| 206 | |||
| 207 | SDL_SetInitialized(&dbus_init, false); | ||
| 208 | } | ||
| 209 | |||
| 210 | SDL_DBusContext *SDL_DBus_GetContext(void) | ||
| 211 | { | ||
| 212 | if (!dbus_handle || !dbus.session_conn) { | ||
| 213 | SDL_DBus_Init(); | ||
| 214 | } | ||
| 215 | |||
| 216 | return (dbus_handle && dbus.session_conn) ? &dbus : NULL; | ||
| 217 | } | ||
| 218 | |||
| 219 | static bool SDL_DBus_CallMethodInternal(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, va_list ap) | ||
| 220 | { | ||
| 221 | bool result = false; | ||
| 222 | |||
| 223 | if (conn) { | ||
| 224 | DBusMessage *msg = dbus.message_new_method_call(node, path, interface, method); | ||
| 225 | if (msg) { | ||
| 226 | int firstarg; | ||
| 227 | va_list ap_reply; | ||
| 228 | va_copy(ap_reply, ap); // copy the arg list so we don't compete with D-Bus for it | ||
| 229 | firstarg = va_arg(ap, int); | ||
| 230 | if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_append_args_valist(msg, firstarg, ap)) { | ||
| 231 | DBusMessage *reply = dbus.connection_send_with_reply_and_block(conn, msg, 300, NULL); | ||
| 232 | if (reply) { | ||
| 233 | // skip any input args, get to output args. | ||
| 234 | while ((firstarg = va_arg(ap_reply, int)) != DBUS_TYPE_INVALID) { | ||
| 235 | // we assume D-Bus already validated all this. | ||
| 236 | { | ||
| 237 | void *dumpptr = va_arg(ap_reply, void *); | ||
| 238 | (void)dumpptr; | ||
| 239 | } | ||
| 240 | if (firstarg == DBUS_TYPE_ARRAY) { | ||
| 241 | { | ||
| 242 | const int dumpint = va_arg(ap_reply, int); | ||
| 243 | (void)dumpint; | ||
| 244 | } | ||
| 245 | } | ||
| 246 | } | ||
| 247 | firstarg = va_arg(ap_reply, int); | ||
| 248 | if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_get_args_valist(reply, NULL, firstarg, ap_reply)) { | ||
| 249 | result = true; | ||
| 250 | } | ||
| 251 | dbus.message_unref(reply); | ||
| 252 | } | ||
| 253 | } | ||
| 254 | va_end(ap_reply); | ||
| 255 | dbus.message_unref(msg); | ||
| 256 | } | ||
| 257 | } | ||
| 258 | |||
| 259 | return result; | ||
| 260 | } | ||
| 261 | |||
| 262 | bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...) | ||
| 263 | { | ||
| 264 | bool result; | ||
| 265 | va_list ap; | ||
| 266 | va_start(ap, method); | ||
| 267 | result = SDL_DBus_CallMethodInternal(conn, node, path, interface, method, ap); | ||
| 268 | va_end(ap); | ||
| 269 | return result; | ||
| 270 | } | ||
| 271 | |||
| 272 | bool SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...) | ||
| 273 | { | ||
| 274 | bool result; | ||
| 275 | va_list ap; | ||
| 276 | va_start(ap, method); | ||
| 277 | result = SDL_DBus_CallMethodInternal(dbus.session_conn, node, path, interface, method, ap); | ||
| 278 | va_end(ap); | ||
| 279 | return result; | ||
| 280 | } | ||
| 281 | |||
| 282 | static bool SDL_DBus_CallVoidMethodInternal(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, va_list ap) | ||
| 283 | { | ||
| 284 | bool result = false; | ||
| 285 | |||
| 286 | if (conn) { | ||
| 287 | DBusMessage *msg = dbus.message_new_method_call(node, path, interface, method); | ||
| 288 | if (msg) { | ||
| 289 | int firstarg = va_arg(ap, int); | ||
| 290 | if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_append_args_valist(msg, firstarg, ap)) { | ||
| 291 | if (dbus.connection_send(conn, msg, NULL)) { | ||
| 292 | dbus.connection_flush(conn); | ||
| 293 | result = true; | ||
| 294 | } | ||
| 295 | } | ||
| 296 | |||
| 297 | dbus.message_unref(msg); | ||
| 298 | } | ||
| 299 | } | ||
| 300 | |||
| 301 | return result; | ||
| 302 | } | ||
| 303 | |||
| 304 | static bool SDL_DBus_CallWithBasicReply(DBusConnection *conn, DBusMessage *msg, const int expectedtype, void *result) | ||
| 305 | { | ||
| 306 | bool retval = false; | ||
| 307 | |||
| 308 | DBusMessage *reply = dbus.connection_send_with_reply_and_block(conn, msg, 300, NULL); | ||
| 309 | if (reply) { | ||
| 310 | DBusMessageIter iter, actual_iter; | ||
| 311 | dbus.message_iter_init(reply, &iter); | ||
| 312 | if (dbus.message_iter_get_arg_type(&iter) == DBUS_TYPE_VARIANT) { | ||
| 313 | dbus.message_iter_recurse(&iter, &actual_iter); | ||
| 314 | } else { | ||
| 315 | actual_iter = iter; | ||
| 316 | } | ||
| 317 | |||
| 318 | if (dbus.message_iter_get_arg_type(&actual_iter) == expectedtype) { | ||
| 319 | dbus.message_iter_get_basic(&actual_iter, result); | ||
| 320 | retval = true; | ||
| 321 | } | ||
| 322 | |||
| 323 | dbus.message_unref(reply); | ||
| 324 | } | ||
| 325 | |||
| 326 | return retval; | ||
| 327 | } | ||
| 328 | |||
| 329 | bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...) | ||
| 330 | { | ||
| 331 | bool result; | ||
| 332 | va_list ap; | ||
| 333 | va_start(ap, method); | ||
| 334 | result = SDL_DBus_CallVoidMethodInternal(conn, node, path, interface, method, ap); | ||
| 335 | va_end(ap); | ||
| 336 | return result; | ||
| 337 | } | ||
| 338 | |||
| 339 | bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...) | ||
| 340 | { | ||
| 341 | bool result; | ||
| 342 | va_list ap; | ||
| 343 | va_start(ap, method); | ||
| 344 | result = SDL_DBus_CallVoidMethodInternal(dbus.session_conn, node, path, interface, method, ap); | ||
| 345 | va_end(ap); | ||
| 346 | return result; | ||
| 347 | } | ||
| 348 | |||
| 349 | bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, int expectedtype, void *result) | ||
| 350 | { | ||
| 351 | bool retval = false; | ||
| 352 | |||
| 353 | if (conn) { | ||
| 354 | DBusMessage *msg = dbus.message_new_method_call(node, path, "org.freedesktop.DBus.Properties", "Get"); | ||
| 355 | if (msg) { | ||
| 356 | if (dbus.message_append_args(msg, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &property, DBUS_TYPE_INVALID)) { | ||
| 357 | retval = SDL_DBus_CallWithBasicReply(conn, msg, expectedtype, result); | ||
| 358 | } | ||
| 359 | dbus.message_unref(msg); | ||
| 360 | } | ||
| 361 | } | ||
| 362 | |||
| 363 | return retval; | ||
| 364 | } | ||
| 365 | |||
| 366 | bool SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, int expectedtype, void *result) | ||
| 367 | { | ||
| 368 | return SDL_DBus_QueryPropertyOnConnection(dbus.session_conn, node, path, interface, property, expectedtype, result); | ||
| 369 | } | ||
| 370 | |||
| 371 | void SDL_DBus_ScreensaverTickle(void) | ||
| 372 | { | ||
| 373 | if (screensaver_cookie == 0 && !inhibit_handle) { // no need to tickle if we're inhibiting. | ||
| 374 | // org.gnome.ScreenSaver is the legacy interface, but it'll either do nothing or just be a second harmless tickle on newer systems, so we leave it for now. | ||
| 375 | SDL_DBus_CallVoidMethod("org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID); | ||
| 376 | SDL_DBus_CallVoidMethod("org.freedesktop.ScreenSaver", "/org/freedesktop/ScreenSaver", "org.freedesktop.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID); | ||
| 377 | } | ||
| 378 | } | ||
| 379 | |||
| 380 | static bool SDL_DBus_AppendDictWithKeysAndValues(DBusMessageIter *iterInit, const char **keys, const char **values, int count) | ||
| 381 | { | ||
| 382 | DBusMessageIter iterDict; | ||
| 383 | |||
| 384 | if (!dbus.message_iter_open_container(iterInit, DBUS_TYPE_ARRAY, "{sv}", &iterDict)) { | ||
| 385 | goto failed; | ||
| 386 | } | ||
| 387 | |||
| 388 | for (int i = 0; i < count; i++) { | ||
| 389 | DBusMessageIter iterEntry, iterValue; | ||
| 390 | const char *key = keys[i]; | ||
| 391 | const char *value = values[i]; | ||
| 392 | |||
| 393 | if (!dbus.message_iter_open_container(&iterDict, DBUS_TYPE_DICT_ENTRY, NULL, &iterEntry)) { | ||
| 394 | goto failed; | ||
| 395 | } | ||
| 396 | |||
| 397 | if (!dbus.message_iter_append_basic(&iterEntry, DBUS_TYPE_STRING, &key)) { | ||
| 398 | goto failed; | ||
| 399 | } | ||
| 400 | |||
| 401 | if (!dbus.message_iter_open_container(&iterEntry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &iterValue)) { | ||
| 402 | goto failed; | ||
| 403 | } | ||
| 404 | |||
| 405 | if (!dbus.message_iter_append_basic(&iterValue, DBUS_TYPE_STRING, &value)) { | ||
| 406 | goto failed; | ||
| 407 | } | ||
| 408 | |||
| 409 | if (!dbus.message_iter_close_container(&iterEntry, &iterValue) || !dbus.message_iter_close_container(&iterDict, &iterEntry)) { | ||
| 410 | goto failed; | ||
| 411 | } | ||
| 412 | } | ||
| 413 | |||
| 414 | if (!dbus.message_iter_close_container(iterInit, &iterDict)) { | ||
| 415 | goto failed; | ||
| 416 | } | ||
| 417 | |||
| 418 | return true; | ||
| 419 | |||
| 420 | failed: | ||
| 421 | /* message_iter_abandon_container_if_open() and message_iter_abandon_container() might be | ||
| 422 | * missing if libdbus is too old. Instead, we just return without cleaning up any eventual | ||
| 423 | * open container */ | ||
| 424 | return false; | ||
| 425 | } | ||
| 426 | |||
| 427 | static bool SDL_DBus_AppendDictWithKeyValue(DBusMessageIter *iterInit, const char *key, const char *value) | ||
| 428 | { | ||
| 429 | const char *keys[1]; | ||
| 430 | const char *values[1]; | ||
| 431 | |||
| 432 | keys[0] = key; | ||
| 433 | values[0] = value; | ||
| 434 | return SDL_DBus_AppendDictWithKeysAndValues(iterInit, keys, values, 1); | ||
| 435 | } | ||
| 436 | |||
| 437 | bool SDL_DBus_ScreensaverInhibit(bool inhibit) | ||
| 438 | { | ||
| 439 | const char *default_inhibit_reason = "Playing a game"; | ||
| 440 | |||
| 441 | if ((inhibit && (screensaver_cookie != 0 || inhibit_handle)) || (!inhibit && (screensaver_cookie == 0 && !inhibit_handle))) { | ||
| 442 | return true; | ||
| 443 | } | ||
| 444 | |||
| 445 | if (!dbus.session_conn) { | ||
| 446 | /* We either lost connection to the session bus or were not able to | ||
| 447 | * load the D-Bus library at all. */ | ||
| 448 | return false; | ||
| 449 | } | ||
| 450 | |||
| 451 | if (SDL_GetSandbox() != SDL_SANDBOX_NONE) { | ||
| 452 | const char *bus_name = "org.freedesktop.portal.Desktop"; | ||
| 453 | const char *path = "/org/freedesktop/portal/desktop"; | ||
| 454 | const char *interface = "org.freedesktop.portal.Inhibit"; | ||
| 455 | const char *window = ""; // As a future improvement we could gather the X11 XID or Wayland surface identifier | ||
| 456 | static const unsigned int INHIBIT_IDLE = 8; // Taken from the portal API reference | ||
| 457 | DBusMessageIter iterInit; | ||
| 458 | |||
| 459 | if (inhibit) { | ||
| 460 | DBusMessage *msg; | ||
| 461 | bool result = false; | ||
| 462 | const char *key = "reason"; | ||
| 463 | const char *reply = NULL; | ||
| 464 | const char *reason = SDL_GetHint(SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME); | ||
| 465 | if (!reason || !reason[0]) { | ||
| 466 | reason = default_inhibit_reason; | ||
| 467 | } | ||
| 468 | |||
| 469 | msg = dbus.message_new_method_call(bus_name, path, interface, "Inhibit"); | ||
| 470 | if (!msg) { | ||
| 471 | return false; | ||
| 472 | } | ||
| 473 | |||
| 474 | if (!dbus.message_append_args(msg, DBUS_TYPE_STRING, &window, DBUS_TYPE_UINT32, &INHIBIT_IDLE, DBUS_TYPE_INVALID)) { | ||
| 475 | dbus.message_unref(msg); | ||
| 476 | return false; | ||
| 477 | } | ||
| 478 | |||
| 479 | dbus.message_iter_init_append(msg, &iterInit); | ||
| 480 | |||
| 481 | // a{sv} | ||
| 482 | if (!SDL_DBus_AppendDictWithKeyValue(&iterInit, key, reason)) { | ||
| 483 | dbus.message_unref(msg); | ||
| 484 | return false; | ||
| 485 | } | ||
| 486 | |||
| 487 | if (SDL_DBus_CallWithBasicReply(dbus.session_conn, msg, DBUS_TYPE_OBJECT_PATH, &reply)) { | ||
| 488 | inhibit_handle = SDL_strdup(reply); | ||
| 489 | result = true; | ||
| 490 | } | ||
| 491 | |||
| 492 | dbus.message_unref(msg); | ||
| 493 | return result; | ||
| 494 | } else { | ||
| 495 | if (!SDL_DBus_CallVoidMethod(bus_name, inhibit_handle, "org.freedesktop.portal.Request", "Close", DBUS_TYPE_INVALID)) { | ||
| 496 | return false; | ||
| 497 | } | ||
| 498 | SDL_free(inhibit_handle); | ||
| 499 | inhibit_handle = NULL; | ||
| 500 | } | ||
| 501 | } else { | ||
| 502 | const char *bus_name = "org.freedesktop.ScreenSaver"; | ||
| 503 | const char *path = "/org/freedesktop/ScreenSaver"; | ||
| 504 | const char *interface = "org.freedesktop.ScreenSaver"; | ||
| 505 | |||
| 506 | if (inhibit) { | ||
| 507 | const char *app = SDL_GetAppMetadataProperty(SDL_PROP_APP_METADATA_NAME_STRING); | ||
| 508 | const char *reason = SDL_GetHint(SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME); | ||
| 509 | if (!reason || !reason[0]) { | ||
| 510 | reason = default_inhibit_reason; | ||
| 511 | } | ||
| 512 | |||
| 513 | if (!SDL_DBus_CallMethod(bus_name, path, interface, "Inhibit", | ||
| 514 | DBUS_TYPE_STRING, &app, DBUS_TYPE_STRING, &reason, DBUS_TYPE_INVALID, | ||
| 515 | DBUS_TYPE_UINT32, &screensaver_cookie, DBUS_TYPE_INVALID)) { | ||
| 516 | return false; | ||
| 517 | } | ||
| 518 | return (screensaver_cookie != 0); | ||
| 519 | } else { | ||
| 520 | if (!SDL_DBus_CallVoidMethod(bus_name, path, interface, "UnInhibit", DBUS_TYPE_UINT32, &screensaver_cookie, DBUS_TYPE_INVALID)) { | ||
| 521 | return false; | ||
| 522 | } | ||
| 523 | screensaver_cookie = 0; | ||
| 524 | } | ||
| 525 | } | ||
| 526 | |||
| 527 | return true; | ||
| 528 | } | ||
| 529 | |||
| 530 | void SDL_DBus_PumpEvents(void) | ||
| 531 | { | ||
| 532 | if (dbus.session_conn) { | ||
| 533 | dbus.connection_read_write(dbus.session_conn, 0); | ||
| 534 | |||
| 535 | while (dbus.connection_dispatch(dbus.session_conn) == DBUS_DISPATCH_DATA_REMAINS) { | ||
| 536 | // Do nothing, actual work happens in DBus_MessageFilter | ||
| 537 | SDL_DelayNS(SDL_US_TO_NS(10)); | ||
| 538 | } | ||
| 539 | } | ||
| 540 | } | ||
| 541 | |||
| 542 | /* | ||
| 543 | * Get the machine ID if possible. Result must be freed with dbus->free(). | ||
| 544 | */ | ||
| 545 | char *SDL_DBus_GetLocalMachineId(void) | ||
| 546 | { | ||
| 547 | DBusError err; | ||
| 548 | char *result; | ||
| 549 | |||
| 550 | dbus.error_init(&err); | ||
| 551 | |||
| 552 | if (dbus.try_get_local_machine_id) { | ||
| 553 | // Available since dbus 1.12.0, has proper error-handling | ||
| 554 | result = dbus.try_get_local_machine_id(&err); | ||
| 555 | } else { | ||
| 556 | /* Available since time immemorial, but has no error-handling: | ||
| 557 | * if the machine ID can't be read, many versions of libdbus will | ||
| 558 | * treat that as a fatal mis-installation and abort() */ | ||
| 559 | result = dbus.get_local_machine_id(); | ||
| 560 | } | ||
| 561 | |||
| 562 | if (result) { | ||
| 563 | return result; | ||
| 564 | } | ||
| 565 | |||
| 566 | if (dbus.error_is_set(&err)) { | ||
| 567 | SDL_SetError("%s: %s", err.name, err.message); | ||
| 568 | dbus.error_free(&err); | ||
| 569 | } else { | ||
| 570 | SDL_SetError("Error getting D-Bus machine ID"); | ||
| 571 | } | ||
| 572 | |||
| 573 | return NULL; | ||
| 574 | } | ||
| 575 | |||
| 576 | /* | ||
| 577 | * Convert file drops with mime type "application/vnd.portal.filetransfer" to file paths | ||
| 578 | * Result must be freed with dbus->free_string_array(). | ||
| 579 | * https://flatpak.github.io/xdg-desktop-portal/#gdbus-method-org-freedesktop-portal-FileTransfer.RetrieveFiles | ||
| 580 | */ | ||
| 581 | char **SDL_DBus_DocumentsPortalRetrieveFiles(const char *key, int *path_count) | ||
| 582 | { | ||
| 583 | DBusError err; | ||
| 584 | DBusMessageIter iter, iterDict; | ||
| 585 | char **paths = NULL; | ||
| 586 | DBusMessage *reply = NULL; | ||
| 587 | DBusMessage *msg = dbus.message_new_method_call("org.freedesktop.portal.Documents", // Node | ||
| 588 | "/org/freedesktop/portal/documents", // Path | ||
| 589 | "org.freedesktop.portal.FileTransfer", // Interface | ||
| 590 | "RetrieveFiles"); // Method | ||
| 591 | |||
| 592 | // Make sure we have a connection to the dbus session bus | ||
| 593 | if (!SDL_DBus_GetContext() || !dbus.session_conn) { | ||
| 594 | /* We either cannot connect to the session bus or were unable to | ||
| 595 | * load the D-Bus library at all. */ | ||
| 596 | return NULL; | ||
| 597 | } | ||
| 598 | |||
| 599 | dbus.error_init(&err); | ||
| 600 | |||
| 601 | // First argument is a "application/vnd.portal.filetransfer" key from a DnD or clipboard event | ||
| 602 | if (!dbus.message_append_args(msg, DBUS_TYPE_STRING, &key, DBUS_TYPE_INVALID)) { | ||
| 603 | SDL_OutOfMemory(); | ||
| 604 | dbus.message_unref(msg); | ||
| 605 | goto failed; | ||
| 606 | } | ||
| 607 | |||
| 608 | /* Second argument is a variant dictionary for options. | ||
| 609 | * The spec doesn't define any entries yet so it's empty. */ | ||
| 610 | dbus.message_iter_init_append(msg, &iter); | ||
| 611 | if (!dbus.message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "{sv}", &iterDict) || | ||
| 612 | !dbus.message_iter_close_container(&iter, &iterDict)) { | ||
| 613 | SDL_OutOfMemory(); | ||
| 614 | dbus.message_unref(msg); | ||
| 615 | goto failed; | ||
| 616 | } | ||
| 617 | |||
| 618 | reply = dbus.connection_send_with_reply_and_block(dbus.session_conn, msg, DBUS_TIMEOUT_USE_DEFAULT, &err); | ||
| 619 | dbus.message_unref(msg); | ||
| 620 | |||
| 621 | if (reply) { | ||
| 622 | dbus.message_get_args(reply, &err, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &paths, path_count, DBUS_TYPE_INVALID); | ||
| 623 | dbus.message_unref(reply); | ||
| 624 | } | ||
| 625 | |||
| 626 | if (paths) { | ||
| 627 | return paths; | ||
| 628 | } | ||
| 629 | |||
| 630 | failed: | ||
| 631 | if (dbus.error_is_set(&err)) { | ||
| 632 | SDL_SetError("%s: %s", err.name, err.message); | ||
| 633 | dbus.error_free(&err); | ||
| 634 | } else { | ||
| 635 | SDL_SetError("Error retrieving paths for documents portal \"%s\"", key); | ||
| 636 | } | ||
| 637 | |||
| 638 | return NULL; | ||
| 639 | } | ||
| 640 | |||
| 641 | #endif | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_dbus.h b/contrib/SDL-3.2.8/src/core/linux/SDL_dbus.h new file mode 100644 index 0000000..2073d6c --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_dbus.h | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "SDL_internal.h" | ||
| 23 | |||
| 24 | #ifndef SDL_dbus_h_ | ||
| 25 | #define SDL_dbus_h_ | ||
| 26 | |||
| 27 | #ifdef HAVE_DBUS_DBUS_H | ||
| 28 | #define SDL_USE_LIBDBUS 1 | ||
| 29 | #include <dbus/dbus.h> | ||
| 30 | |||
| 31 | #ifndef DBUS_TIMEOUT_USE_DEFAULT | ||
| 32 | #define DBUS_TIMEOUT_USE_DEFAULT -1 | ||
| 33 | #endif | ||
| 34 | #ifndef DBUS_TIMEOUT_INFINITE | ||
| 35 | #define DBUS_TIMEOUT_INFINITE ((int) 0x7fffffff) | ||
| 36 | #endif | ||
| 37 | |||
| 38 | typedef struct SDL_DBusContext | ||
| 39 | { | ||
| 40 | DBusConnection *session_conn; | ||
| 41 | DBusConnection *system_conn; | ||
| 42 | |||
| 43 | DBusConnection *(*bus_get_private)(DBusBusType, DBusError *); | ||
| 44 | dbus_bool_t (*bus_register)(DBusConnection *, DBusError *); | ||
| 45 | void (*bus_add_match)(DBusConnection *, const char *, DBusError *); | ||
| 46 | DBusConnection *(*connection_open_private)(const char *, DBusError *); | ||
| 47 | void (*connection_set_exit_on_disconnect)(DBusConnection *, dbus_bool_t); | ||
| 48 | dbus_bool_t (*connection_get_is_connected)(DBusConnection *); | ||
| 49 | dbus_bool_t (*connection_add_filter)(DBusConnection *, DBusHandleMessageFunction, void *, DBusFreeFunction); | ||
| 50 | dbus_bool_t (*connection_remove_filter)(DBusConnection *, DBusHandleMessageFunction, void *); | ||
| 51 | dbus_bool_t (*connection_try_register_object_path)(DBusConnection *, const char *, | ||
| 52 | const DBusObjectPathVTable *, void *, DBusError *); | ||
| 53 | dbus_bool_t (*connection_send)(DBusConnection *, DBusMessage *, dbus_uint32_t *); | ||
| 54 | DBusMessage *(*connection_send_with_reply_and_block)(DBusConnection *, DBusMessage *, int, DBusError *); | ||
| 55 | void (*connection_close)(DBusConnection *); | ||
| 56 | void (*connection_ref)(DBusConnection *); | ||
| 57 | void (*connection_unref)(DBusConnection *); | ||
| 58 | void (*connection_flush)(DBusConnection *); | ||
| 59 | dbus_bool_t (*connection_read_write)(DBusConnection *, int); | ||
| 60 | DBusDispatchStatus (*connection_dispatch)(DBusConnection *); | ||
| 61 | dbus_bool_t (*message_is_signal)(DBusMessage *, const char *, const char *); | ||
| 62 | dbus_bool_t (*message_has_path)(DBusMessage *, const char *); | ||
| 63 | DBusMessage *(*message_new_method_call)(const char *, const char *, const char *, const char *); | ||
| 64 | dbus_bool_t (*message_append_args)(DBusMessage *, int, ...); | ||
| 65 | dbus_bool_t (*message_append_args_valist)(DBusMessage *, int, va_list); | ||
| 66 | void (*message_iter_init_append)(DBusMessage *, DBusMessageIter *); | ||
| 67 | dbus_bool_t (*message_iter_open_container)(DBusMessageIter *, int, const char *, DBusMessageIter *); | ||
| 68 | dbus_bool_t (*message_iter_append_basic)(DBusMessageIter *, int, const void *); | ||
| 69 | dbus_bool_t (*message_iter_close_container)(DBusMessageIter *, DBusMessageIter *); | ||
| 70 | dbus_bool_t (*message_get_args)(DBusMessage *, DBusError *, int, ...); | ||
| 71 | dbus_bool_t (*message_get_args_valist)(DBusMessage *, DBusError *, int, va_list); | ||
| 72 | dbus_bool_t (*message_iter_init)(DBusMessage *, DBusMessageIter *); | ||
| 73 | dbus_bool_t (*message_iter_next)(DBusMessageIter *); | ||
| 74 | void (*message_iter_get_basic)(DBusMessageIter *, void *); | ||
| 75 | int (*message_iter_get_arg_type)(DBusMessageIter *); | ||
| 76 | void (*message_iter_recurse)(DBusMessageIter *, DBusMessageIter *); | ||
| 77 | void (*message_unref)(DBusMessage *); | ||
| 78 | dbus_bool_t (*threads_init_default)(void); | ||
| 79 | void (*error_init)(DBusError *); | ||
| 80 | dbus_bool_t (*error_is_set)(const DBusError *); | ||
| 81 | void (*error_free)(DBusError *); | ||
| 82 | char *(*get_local_machine_id)(void); | ||
| 83 | char *(*try_get_local_machine_id)(DBusError *); | ||
| 84 | void (*free)(void *); | ||
| 85 | void (*free_string_array)(char **); | ||
| 86 | void (*shutdown)(void); | ||
| 87 | |||
| 88 | } SDL_DBusContext; | ||
| 89 | |||
| 90 | extern void SDL_DBus_Init(void); | ||
| 91 | extern void SDL_DBus_Quit(void); | ||
| 92 | extern SDL_DBusContext *SDL_DBus_GetContext(void); | ||
| 93 | |||
| 94 | // These use the built-in Session connection. | ||
| 95 | extern bool SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...); | ||
| 96 | extern bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...); | ||
| 97 | extern bool SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, int expectedtype, void *result); | ||
| 98 | |||
| 99 | // These use whatever connection you like. | ||
| 100 | extern bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...); | ||
| 101 | extern bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...); | ||
| 102 | extern bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, int expectedtype, void *result); | ||
| 103 | |||
| 104 | extern void SDL_DBus_ScreensaverTickle(void); | ||
| 105 | extern bool SDL_DBus_ScreensaverInhibit(bool inhibit); | ||
| 106 | |||
| 107 | extern void SDL_DBus_PumpEvents(void); | ||
| 108 | extern char *SDL_DBus_GetLocalMachineId(void); | ||
| 109 | |||
| 110 | extern char **SDL_DBus_DocumentsPortalRetrieveFiles(const char *key, int *files_count); | ||
| 111 | |||
| 112 | #endif // HAVE_DBUS_DBUS_H | ||
| 113 | |||
| 114 | #endif // SDL_dbus_h_ | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_evdev.c b/contrib/SDL-3.2.8/src/core/linux/SDL_evdev.c new file mode 100644 index 0000000..5746e2e --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_evdev.c | |||
| @@ -0,0 +1,1042 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifdef SDL_INPUT_LINUXEV | ||
| 24 | |||
| 25 | // This is based on the linux joystick driver | ||
| 26 | /* References: https://www.kernel.org/doc/Documentation/input/input.txt | ||
| 27 | * https://www.kernel.org/doc/Documentation/input/event-codes.txt | ||
| 28 | * /usr/include/linux/input.h | ||
| 29 | * The evtest application is also useful to debug the protocol | ||
| 30 | */ | ||
| 31 | |||
| 32 | #include "SDL_evdev.h" | ||
| 33 | #include "SDL_evdev_kbd.h" | ||
| 34 | |||
| 35 | #include <sys/stat.h> | ||
| 36 | #include <unistd.h> | ||
| 37 | #include <fcntl.h> | ||
| 38 | #include <sys/ioctl.h> | ||
| 39 | #include <linux/input.h> | ||
| 40 | |||
| 41 | #include "../../events/SDL_events_c.h" | ||
| 42 | #include "../../events/SDL_scancode_tables_c.h" | ||
| 43 | #include "../../core/linux/SDL_evdev_capabilities.h" | ||
| 44 | #include "../../core/linux/SDL_udev.h" | ||
| 45 | |||
| 46 | // These are not defined in older Linux kernel headers | ||
| 47 | #ifndef SYN_DROPPED | ||
| 48 | #define SYN_DROPPED 3 | ||
| 49 | #endif | ||
| 50 | #ifndef ABS_MT_SLOT | ||
| 51 | #define ABS_MT_SLOT 0x2f | ||
| 52 | #define ABS_MT_POSITION_X 0x35 | ||
| 53 | #define ABS_MT_POSITION_Y 0x36 | ||
| 54 | #define ABS_MT_TRACKING_ID 0x39 | ||
| 55 | #define ABS_MT_PRESSURE 0x3a | ||
| 56 | #endif | ||
| 57 | #ifndef REL_WHEEL_HI_RES | ||
| 58 | #define REL_WHEEL_HI_RES 0x0b | ||
| 59 | #define REL_HWHEEL_HI_RES 0x0c | ||
| 60 | #endif | ||
| 61 | |||
| 62 | // The field to look up in struct input_event for integer seconds | ||
| 63 | #ifndef input_event_sec | ||
| 64 | #define input_event_sec time.tv_sec | ||
| 65 | #endif | ||
| 66 | |||
| 67 | // The field to look up in struct input_event for fractional seconds | ||
| 68 | #ifndef input_event_usec | ||
| 69 | #define input_event_usec time.tv_usec | ||
| 70 | #endif | ||
| 71 | |||
| 72 | typedef struct SDL_evdevlist_item | ||
| 73 | { | ||
| 74 | char *path; | ||
| 75 | int fd; | ||
| 76 | int udev_class; | ||
| 77 | |||
| 78 | // TODO: use this for every device, not just touchscreen | ||
| 79 | bool out_of_sync; | ||
| 80 | |||
| 81 | /* TODO: expand on this to have data for every possible class (mouse, | ||
| 82 | keyboard, touchpad, etc.). Also there's probably some things in here we | ||
| 83 | can pull out to the SDL_evdevlist_item i.e. name */ | ||
| 84 | bool is_touchscreen; | ||
| 85 | struct | ||
| 86 | { | ||
| 87 | char *name; | ||
| 88 | |||
| 89 | int min_x, max_x, range_x; | ||
| 90 | int min_y, max_y, range_y; | ||
| 91 | int min_pressure, max_pressure, range_pressure; | ||
| 92 | |||
| 93 | int max_slots; | ||
| 94 | int current_slot; | ||
| 95 | struct | ||
| 96 | { | ||
| 97 | enum | ||
| 98 | { | ||
| 99 | EVDEV_TOUCH_SLOTDELTA_NONE = 0, | ||
| 100 | EVDEV_TOUCH_SLOTDELTA_DOWN, | ||
| 101 | EVDEV_TOUCH_SLOTDELTA_UP, | ||
| 102 | EVDEV_TOUCH_SLOTDELTA_MOVE | ||
| 103 | } delta; | ||
| 104 | int tracking_id; | ||
| 105 | int x, y, pressure; | ||
| 106 | } *slots; | ||
| 107 | |||
| 108 | } *touchscreen_data; | ||
| 109 | |||
| 110 | // Mouse state | ||
| 111 | bool high_res_wheel; | ||
| 112 | bool high_res_hwheel; | ||
| 113 | bool relative_mouse; | ||
| 114 | int mouse_x, mouse_y; | ||
| 115 | int mouse_wheel, mouse_hwheel; | ||
| 116 | int min_x, max_x, range_x; | ||
| 117 | int min_y, max_y, range_y; | ||
| 118 | |||
| 119 | struct SDL_evdevlist_item *next; | ||
| 120 | } SDL_evdevlist_item; | ||
| 121 | |||
| 122 | typedef struct SDL_EVDEV_PrivateData | ||
| 123 | { | ||
| 124 | int ref_count; | ||
| 125 | int num_devices; | ||
| 126 | SDL_evdevlist_item *first; | ||
| 127 | SDL_evdevlist_item *last; | ||
| 128 | SDL_EVDEV_keyboard_state *kbd; | ||
| 129 | } SDL_EVDEV_PrivateData; | ||
| 130 | |||
| 131 | static SDL_EVDEV_PrivateData *_this = NULL; | ||
| 132 | |||
| 133 | static SDL_Scancode SDL_EVDEV_translate_keycode(int keycode); | ||
| 134 | static void SDL_EVDEV_sync_device(SDL_evdevlist_item *item); | ||
| 135 | static bool SDL_EVDEV_device_removed(const char *dev_path); | ||
| 136 | static bool SDL_EVDEV_device_added(const char *dev_path, int udev_class); | ||
| 137 | #ifdef SDL_USE_LIBUDEV | ||
| 138 | static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, const char *dev_path); | ||
| 139 | #endif // SDL_USE_LIBUDEV | ||
| 140 | |||
| 141 | static Uint8 EVDEV_MouseButtons[] = { | ||
| 142 | SDL_BUTTON_LEFT, // BTN_LEFT 0x110 | ||
| 143 | SDL_BUTTON_RIGHT, // BTN_RIGHT 0x111 | ||
| 144 | SDL_BUTTON_MIDDLE, // BTN_MIDDLE 0x112 | ||
| 145 | SDL_BUTTON_X1, // BTN_SIDE 0x113 | ||
| 146 | SDL_BUTTON_X2, // BTN_EXTRA 0x114 | ||
| 147 | SDL_BUTTON_X2 + 1, // BTN_FORWARD 0x115 | ||
| 148 | SDL_BUTTON_X2 + 2, // BTN_BACK 0x116 | ||
| 149 | SDL_BUTTON_X2 + 3 // BTN_TASK 0x117 | ||
| 150 | }; | ||
| 151 | |||
| 152 | static bool SDL_EVDEV_SetRelativeMouseMode(bool enabled) | ||
| 153 | { | ||
| 154 | // Mice already send relative events through this interface | ||
| 155 | return true; | ||
| 156 | } | ||
| 157 | |||
| 158 | static void SDL_EVDEV_UpdateKeyboardMute(void) | ||
| 159 | { | ||
| 160 | if (SDL_EVDEV_GetDeviceCount(SDL_UDEV_DEVICE_KEYBOARD) > 0) { | ||
| 161 | SDL_EVDEV_kbd_set_muted(_this->kbd, true); | ||
| 162 | } else { | ||
| 163 | SDL_EVDEV_kbd_set_muted(_this->kbd, false); | ||
| 164 | } | ||
| 165 | } | ||
| 166 | |||
| 167 | bool SDL_EVDEV_Init(void) | ||
| 168 | { | ||
| 169 | if (!_this) { | ||
| 170 | _this = (SDL_EVDEV_PrivateData *)SDL_calloc(1, sizeof(*_this)); | ||
| 171 | if (!_this) { | ||
| 172 | return false; | ||
| 173 | } | ||
| 174 | |||
| 175 | #ifdef SDL_USE_LIBUDEV | ||
| 176 | if (!SDL_UDEV_Init()) { | ||
| 177 | SDL_free(_this); | ||
| 178 | _this = NULL; | ||
| 179 | return false; | ||
| 180 | } | ||
| 181 | |||
| 182 | // Set up the udev callback | ||
| 183 | if (!SDL_UDEV_AddCallback(SDL_EVDEV_udev_callback)) { | ||
| 184 | SDL_UDEV_Quit(); | ||
| 185 | SDL_free(_this); | ||
| 186 | _this = NULL; | ||
| 187 | return false; | ||
| 188 | } | ||
| 189 | |||
| 190 | // Force a scan to build the initial device list | ||
| 191 | SDL_UDEV_Scan(); | ||
| 192 | #else | ||
| 193 | { | ||
| 194 | /* Allow the user to specify a list of devices explicitly of | ||
| 195 | the form: | ||
| 196 | deviceclass:path[,deviceclass:path[,...]] | ||
| 197 | where device class is an integer representing the | ||
| 198 | SDL_UDEV_deviceclass and path is the full path to | ||
| 199 | the event device. */ | ||
| 200 | const char *devices = SDL_GetHint(SDL_HINT_EVDEV_DEVICES); | ||
| 201 | if (devices) { | ||
| 202 | /* Assume this is the old use of the env var and it is not in | ||
| 203 | ROM. */ | ||
| 204 | char *rest = (char *)devices; | ||
| 205 | char *spec; | ||
| 206 | while ((spec = SDL_strtok_r(rest, ",", &rest))) { | ||
| 207 | char *endofcls = 0; | ||
| 208 | long cls = SDL_strtol(spec, &endofcls, 0); | ||
| 209 | if (endofcls) { | ||
| 210 | SDL_EVDEV_device_added(endofcls + 1, cls); | ||
| 211 | } | ||
| 212 | } | ||
| 213 | } else { | ||
| 214 | // TODO: Scan the devices manually, like a caveman | ||
| 215 | } | ||
| 216 | } | ||
| 217 | #endif // SDL_USE_LIBUDEV | ||
| 218 | |||
| 219 | _this->kbd = SDL_EVDEV_kbd_init(); | ||
| 220 | |||
| 221 | SDL_EVDEV_UpdateKeyboardMute(); | ||
| 222 | } | ||
| 223 | |||
| 224 | SDL_GetMouse()->SetRelativeMouseMode = SDL_EVDEV_SetRelativeMouseMode; | ||
| 225 | |||
| 226 | _this->ref_count += 1; | ||
| 227 | |||
| 228 | return true; | ||
| 229 | } | ||
| 230 | |||
| 231 | void SDL_EVDEV_Quit(void) | ||
| 232 | { | ||
| 233 | if (!_this) { | ||
| 234 | return; | ||
| 235 | } | ||
| 236 | |||
| 237 | _this->ref_count -= 1; | ||
| 238 | |||
| 239 | if (_this->ref_count < 1) { | ||
| 240 | #ifdef SDL_USE_LIBUDEV | ||
| 241 | SDL_UDEV_DelCallback(SDL_EVDEV_udev_callback); | ||
| 242 | SDL_UDEV_Quit(); | ||
| 243 | #endif // SDL_USE_LIBUDEV | ||
| 244 | |||
| 245 | // Remove existing devices | ||
| 246 | while (_this->first) { | ||
| 247 | SDL_EVDEV_device_removed(_this->first->path); | ||
| 248 | } | ||
| 249 | |||
| 250 | SDL_EVDEV_kbd_quit(_this->kbd); | ||
| 251 | |||
| 252 | SDL_assert(_this->first == NULL); | ||
| 253 | SDL_assert(_this->last == NULL); | ||
| 254 | SDL_assert(_this->num_devices == 0); | ||
| 255 | |||
| 256 | SDL_free(_this); | ||
| 257 | _this = NULL; | ||
| 258 | } | ||
| 259 | } | ||
| 260 | |||
| 261 | #ifdef SDL_USE_LIBUDEV | ||
| 262 | static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, | ||
| 263 | const char *dev_path) | ||
| 264 | { | ||
| 265 | if (!dev_path) { | ||
| 266 | return; | ||
| 267 | } | ||
| 268 | |||
| 269 | switch (udev_event) { | ||
| 270 | case SDL_UDEV_DEVICEADDED: | ||
| 271 | if (!(udev_class & (SDL_UDEV_DEVICE_MOUSE | SDL_UDEV_DEVICE_HAS_KEYS | SDL_UDEV_DEVICE_TOUCHSCREEN | SDL_UDEV_DEVICE_TOUCHPAD))) { | ||
| 272 | return; | ||
| 273 | } | ||
| 274 | |||
| 275 | if (udev_class & SDL_UDEV_DEVICE_JOYSTICK) { | ||
| 276 | return; | ||
| 277 | } | ||
| 278 | |||
| 279 | SDL_EVDEV_device_added(dev_path, udev_class); | ||
| 280 | break; | ||
| 281 | case SDL_UDEV_DEVICEREMOVED: | ||
| 282 | SDL_EVDEV_device_removed(dev_path); | ||
| 283 | break; | ||
| 284 | default: | ||
| 285 | break; | ||
| 286 | } | ||
| 287 | } | ||
| 288 | #endif // SDL_USE_LIBUDEV | ||
| 289 | |||
| 290 | void SDL_EVDEV_SetVTSwitchCallbacks(void (*release_callback)(void*), void *release_callback_data, | ||
| 291 | void (*acquire_callback)(void*), void *acquire_callback_data) | ||
| 292 | { | ||
| 293 | SDL_EVDEV_kbd_set_vt_switch_callbacks(_this->kbd, | ||
| 294 | release_callback, release_callback_data, | ||
| 295 | acquire_callback, acquire_callback_data); | ||
| 296 | } | ||
| 297 | |||
| 298 | int SDL_EVDEV_GetDeviceCount(int device_class) | ||
| 299 | { | ||
| 300 | SDL_evdevlist_item *item; | ||
| 301 | int count = 0; | ||
| 302 | |||
| 303 | for (item = _this->first; item; item = item->next) { | ||
| 304 | if ((item->udev_class & device_class) == device_class) { | ||
| 305 | ++count; | ||
| 306 | } | ||
| 307 | } | ||
| 308 | return count; | ||
| 309 | } | ||
| 310 | |||
| 311 | void SDL_EVDEV_Poll(void) | ||
| 312 | { | ||
| 313 | struct input_event events[32]; | ||
| 314 | int i, j, len; | ||
| 315 | SDL_evdevlist_item *item; | ||
| 316 | SDL_Scancode scancode; | ||
| 317 | int mouse_button; | ||
| 318 | SDL_Mouse *mouse; | ||
| 319 | float norm_x, norm_y, norm_pressure; | ||
| 320 | |||
| 321 | if (!_this) { | ||
| 322 | return; | ||
| 323 | } | ||
| 324 | |||
| 325 | #ifdef SDL_USE_LIBUDEV | ||
| 326 | SDL_UDEV_Poll(); | ||
| 327 | #endif | ||
| 328 | |||
| 329 | SDL_EVDEV_kbd_update(_this->kbd); | ||
| 330 | |||
| 331 | mouse = SDL_GetMouse(); | ||
| 332 | |||
| 333 | for (item = _this->first; item; item = item->next) { | ||
| 334 | while ((len = read(item->fd, events, sizeof(events))) > 0) { | ||
| 335 | len /= sizeof(events[0]); | ||
| 336 | for (i = 0; i < len; ++i) { | ||
| 337 | struct input_event *event = &events[i]; | ||
| 338 | |||
| 339 | /* special handling for touchscreen, that should eventually be | ||
| 340 | used for all devices */ | ||
| 341 | if (item->out_of_sync && item->is_touchscreen && | ||
| 342 | event->type == EV_SYN && event->code != SYN_REPORT) { | ||
| 343 | break; | ||
| 344 | } | ||
| 345 | |||
| 346 | switch (event->type) { | ||
| 347 | case EV_KEY: | ||
| 348 | if (event->code >= BTN_MOUSE && event->code < BTN_MOUSE + SDL_arraysize(EVDEV_MouseButtons)) { | ||
| 349 | Uint64 timestamp = SDL_EVDEV_GetEventTimestamp(event); | ||
| 350 | mouse_button = event->code - BTN_MOUSE; | ||
| 351 | SDL_SendMouseButton(timestamp, mouse->focus, (SDL_MouseID)item->fd, EVDEV_MouseButtons[mouse_button], (event->value != 0)); | ||
| 352 | break; | ||
| 353 | } | ||
| 354 | |||
| 355 | /* BTN_TOUCH event value 1 indicates there is contact with | ||
| 356 | a touchscreen or trackpad (earliest finger's current | ||
| 357 | position is sent in EV_ABS ABS_X/ABS_Y, switching to | ||
| 358 | next finger after earliest is released) */ | ||
| 359 | if (item->is_touchscreen && event->code == BTN_TOUCH) { | ||
| 360 | if (item->touchscreen_data->max_slots == 1) { | ||
| 361 | if (event->value) { | ||
| 362 | item->touchscreen_data->slots[0].delta = EVDEV_TOUCH_SLOTDELTA_DOWN; | ||
| 363 | } else { | ||
| 364 | item->touchscreen_data->slots[0].delta = EVDEV_TOUCH_SLOTDELTA_UP; | ||
| 365 | } | ||
| 366 | } | ||
| 367 | break; | ||
| 368 | } | ||
| 369 | |||
| 370 | // Probably keyboard | ||
| 371 | { | ||
| 372 | Uint64 timestamp = SDL_EVDEV_GetEventTimestamp(event); | ||
| 373 | scancode = SDL_EVDEV_translate_keycode(event->code); | ||
| 374 | if (event->value == 0) { | ||
| 375 | SDL_SendKeyboardKey(timestamp, (SDL_KeyboardID)item->fd, event->code, scancode, false); | ||
| 376 | } else if (event->value == 1 || event->value == 2 /* key repeated */) { | ||
| 377 | SDL_SendKeyboardKey(timestamp, (SDL_KeyboardID)item->fd, event->code, scancode, true); | ||
| 378 | } | ||
| 379 | SDL_EVDEV_kbd_keycode(_this->kbd, event->code, event->value); | ||
| 380 | } | ||
| 381 | break; | ||
| 382 | case EV_ABS: | ||
| 383 | switch (event->code) { | ||
| 384 | case ABS_MT_SLOT: | ||
| 385 | if (!item->is_touchscreen) { // FIXME: temp hack | ||
| 386 | break; | ||
| 387 | } | ||
| 388 | item->touchscreen_data->current_slot = event->value; | ||
| 389 | break; | ||
| 390 | case ABS_MT_TRACKING_ID: | ||
| 391 | if (!item->is_touchscreen) { // FIXME: temp hack | ||
| 392 | break; | ||
| 393 | } | ||
| 394 | if (event->value >= 0) { | ||
| 395 | item->touchscreen_data->slots[item->touchscreen_data->current_slot].tracking_id = event->value + 1; | ||
| 396 | item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_DOWN; | ||
| 397 | } else { | ||
| 398 | item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_UP; | ||
| 399 | } | ||
| 400 | break; | ||
| 401 | case ABS_MT_POSITION_X: | ||
| 402 | if (!item->is_touchscreen) { // FIXME: temp hack | ||
| 403 | break; | ||
| 404 | } | ||
| 405 | item->touchscreen_data->slots[item->touchscreen_data->current_slot].x = event->value; | ||
| 406 | if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) { | ||
| 407 | item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE; | ||
| 408 | } | ||
| 409 | break; | ||
| 410 | case ABS_MT_POSITION_Y: | ||
| 411 | if (!item->is_touchscreen) { // FIXME: temp hack | ||
| 412 | break; | ||
| 413 | } | ||
| 414 | item->touchscreen_data->slots[item->touchscreen_data->current_slot].y = event->value; | ||
| 415 | if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) { | ||
| 416 | item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE; | ||
| 417 | } | ||
| 418 | break; | ||
| 419 | case ABS_MT_PRESSURE: | ||
| 420 | if (!item->is_touchscreen) { // FIXME: temp hack | ||
| 421 | break; | ||
| 422 | } | ||
| 423 | item->touchscreen_data->slots[item->touchscreen_data->current_slot].pressure = event->value; | ||
| 424 | if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) { | ||
| 425 | item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE; | ||
| 426 | } | ||
| 427 | break; | ||
| 428 | case ABS_X: | ||
| 429 | if (item->is_touchscreen) { | ||
| 430 | if (item->touchscreen_data->max_slots != 1) { | ||
| 431 | break; | ||
| 432 | } | ||
| 433 | item->touchscreen_data->slots[0].x = event->value; | ||
| 434 | } else if (!item->relative_mouse) { | ||
| 435 | item->mouse_x = event->value; | ||
| 436 | } | ||
| 437 | break; | ||
| 438 | case ABS_Y: | ||
| 439 | if (item->is_touchscreen) { | ||
| 440 | if (item->touchscreen_data->max_slots != 1) { | ||
| 441 | break; | ||
| 442 | } | ||
| 443 | item->touchscreen_data->slots[0].y = event->value; | ||
| 444 | } else if (!item->relative_mouse) { | ||
| 445 | item->mouse_y = event->value; | ||
| 446 | } | ||
| 447 | break; | ||
| 448 | default: | ||
| 449 | break; | ||
| 450 | } | ||
| 451 | break; | ||
| 452 | case EV_REL: | ||
| 453 | switch (event->code) { | ||
| 454 | case REL_X: | ||
| 455 | if (item->relative_mouse) { | ||
| 456 | item->mouse_x += event->value; | ||
| 457 | } | ||
| 458 | break; | ||
| 459 | case REL_Y: | ||
| 460 | if (item->relative_mouse) { | ||
| 461 | item->mouse_y += event->value; | ||
| 462 | } | ||
| 463 | break; | ||
| 464 | case REL_WHEEL: | ||
| 465 | if (!item->high_res_wheel) { | ||
| 466 | item->mouse_wheel += event->value; | ||
| 467 | } | ||
| 468 | break; | ||
| 469 | case REL_WHEEL_HI_RES: | ||
| 470 | SDL_assert(item->high_res_wheel); | ||
| 471 | item->mouse_wheel += event->value; | ||
| 472 | break; | ||
| 473 | case REL_HWHEEL: | ||
| 474 | if (!item->high_res_hwheel) { | ||
| 475 | item->mouse_hwheel += event->value; | ||
| 476 | } | ||
| 477 | break; | ||
| 478 | case REL_HWHEEL_HI_RES: | ||
| 479 | SDL_assert(item->high_res_hwheel); | ||
| 480 | item->mouse_hwheel += event->value; | ||
| 481 | break; | ||
| 482 | default: | ||
| 483 | break; | ||
| 484 | } | ||
| 485 | break; | ||
| 486 | case EV_SYN: | ||
| 487 | switch (event->code) { | ||
| 488 | case SYN_REPORT: | ||
| 489 | // Send mouse axis changes together to ensure consistency and reduce event processing overhead | ||
| 490 | if (item->relative_mouse) { | ||
| 491 | if (item->mouse_x != 0 || item->mouse_y != 0) { | ||
| 492 | Uint64 timestamp = SDL_EVDEV_GetEventTimestamp(event); | ||
| 493 | SDL_SendMouseMotion(timestamp, mouse->focus, (SDL_MouseID)item->fd, item->relative_mouse, (float)item->mouse_x, (float)item->mouse_y); | ||
| 494 | item->mouse_x = item->mouse_y = 0; | ||
| 495 | } | ||
| 496 | } else if (item->range_x > 0 && item->range_y > 0) { | ||
| 497 | int screen_w = 0, screen_h = 0; | ||
| 498 | const SDL_DisplayMode *mode = NULL; | ||
| 499 | |||
| 500 | if (mouse->focus) { | ||
| 501 | mode = SDL_GetCurrentDisplayMode(SDL_GetDisplayForWindow(mouse->focus)); | ||
| 502 | } | ||
| 503 | if (!mode) { | ||
| 504 | mode = SDL_GetCurrentDisplayMode(SDL_GetPrimaryDisplay()); | ||
| 505 | } | ||
| 506 | if (mode) { | ||
| 507 | screen_w = mode->w; | ||
| 508 | screen_h = mode->h; | ||
| 509 | } | ||
| 510 | SDL_SendMouseMotion(SDL_EVDEV_GetEventTimestamp(event), mouse->focus, (SDL_MouseID)item->fd, item->relative_mouse, | ||
| 511 | (float)(item->mouse_x - item->min_x) * screen_w / item->range_x, | ||
| 512 | (float)(item->mouse_y - item->min_y) * screen_h / item->range_y); | ||
| 513 | } | ||
| 514 | |||
| 515 | if (item->mouse_wheel != 0 || item->mouse_hwheel != 0) { | ||
| 516 | Uint64 timestamp = SDL_EVDEV_GetEventTimestamp(event); | ||
| 517 | const float denom = (item->high_res_hwheel ? 120.0f : 1.0f); | ||
| 518 | SDL_SendMouseWheel(timestamp, | ||
| 519 | mouse->focus, (SDL_MouseID)item->fd, | ||
| 520 | item->mouse_hwheel / denom, | ||
| 521 | item->mouse_wheel / denom, | ||
| 522 | SDL_MOUSEWHEEL_NORMAL); | ||
| 523 | item->mouse_wheel = item->mouse_hwheel = 0; | ||
| 524 | } | ||
| 525 | |||
| 526 | if (!item->is_touchscreen) { // FIXME: temp hack | ||
| 527 | break; | ||
| 528 | } | ||
| 529 | |||
| 530 | for (j = 0; j < item->touchscreen_data->max_slots; j++) { | ||
| 531 | norm_x = (float)(item->touchscreen_data->slots[j].x - item->touchscreen_data->min_x) / | ||
| 532 | (float)item->touchscreen_data->range_x; | ||
| 533 | norm_y = (float)(item->touchscreen_data->slots[j].y - item->touchscreen_data->min_y) / | ||
| 534 | (float)item->touchscreen_data->range_y; | ||
| 535 | |||
| 536 | if (item->touchscreen_data->range_pressure > 0) { | ||
| 537 | norm_pressure = (float)(item->touchscreen_data->slots[j].pressure - item->touchscreen_data->min_pressure) / | ||
| 538 | (float)item->touchscreen_data->range_pressure; | ||
| 539 | } else { | ||
| 540 | // This touchscreen does not support pressure | ||
| 541 | norm_pressure = 1.0f; | ||
| 542 | } | ||
| 543 | |||
| 544 | /* FIXME: the touch's window shouldn't be null, but | ||
| 545 | * the coordinate space of touch positions needs to | ||
| 546 | * be window-relative in that case. */ | ||
| 547 | switch (item->touchscreen_data->slots[j].delta) { | ||
| 548 | case EVDEV_TOUCH_SLOTDELTA_DOWN: | ||
| 549 | SDL_SendTouch(SDL_EVDEV_GetEventTimestamp(event), item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, SDL_EVENT_FINGER_DOWN, norm_x, norm_y, norm_pressure); | ||
| 550 | item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE; | ||
| 551 | break; | ||
| 552 | case EVDEV_TOUCH_SLOTDELTA_UP: | ||
| 553 | SDL_SendTouch(SDL_EVDEV_GetEventTimestamp(event), item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, SDL_EVENT_FINGER_UP, norm_x, norm_y, norm_pressure); | ||
| 554 | item->touchscreen_data->slots[j].tracking_id = 0; | ||
| 555 | item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE; | ||
| 556 | break; | ||
| 557 | case EVDEV_TOUCH_SLOTDELTA_MOVE: | ||
| 558 | SDL_SendTouchMotion(SDL_EVDEV_GetEventTimestamp(event), item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, norm_x, norm_y, norm_pressure); | ||
| 559 | item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE; | ||
| 560 | break; | ||
| 561 | default: | ||
| 562 | break; | ||
| 563 | } | ||
| 564 | } | ||
| 565 | |||
| 566 | if (item->out_of_sync) { | ||
| 567 | item->out_of_sync = false; | ||
| 568 | } | ||
| 569 | break; | ||
| 570 | case SYN_DROPPED: | ||
| 571 | if (item->is_touchscreen) { | ||
| 572 | item->out_of_sync = true; | ||
| 573 | } | ||
| 574 | SDL_EVDEV_sync_device(item); | ||
| 575 | break; | ||
| 576 | default: | ||
| 577 | break; | ||
| 578 | } | ||
| 579 | break; | ||
| 580 | } | ||
| 581 | } | ||
| 582 | } | ||
| 583 | } | ||
| 584 | } | ||
| 585 | |||
| 586 | static SDL_Scancode SDL_EVDEV_translate_keycode(int keycode) | ||
| 587 | { | ||
| 588 | SDL_Scancode scancode = SDL_GetScancodeFromTable(SDL_SCANCODE_TABLE_LINUX, keycode); | ||
| 589 | |||
| 590 | #ifdef DEBUG_SCANCODES | ||
| 591 | if (scancode == SDL_SCANCODE_UNKNOWN) { | ||
| 592 | /* BTN_TOUCH is handled elsewhere, but we might still end up here if | ||
| 593 | you get an unexpected BTN_TOUCH from something SDL believes is not | ||
| 594 | a touch device. In this case, we'd rather not get a misleading | ||
| 595 | SDL_Log message about an unknown key. */ | ||
| 596 | if (keycode != BTN_TOUCH) { | ||
| 597 | SDL_Log("The key you just pressed is not recognized by SDL. To help " | ||
| 598 | "get this fixed, please report this to the SDL forums/mailing list " | ||
| 599 | "<https://discourse.libsdl.org/> EVDEV KeyCode %d", | ||
| 600 | keycode); | ||
| 601 | } | ||
| 602 | } | ||
| 603 | #endif // DEBUG_SCANCODES | ||
| 604 | |||
| 605 | return scancode; | ||
| 606 | } | ||
| 607 | |||
| 608 | static bool SDL_EVDEV_init_keyboard(SDL_evdevlist_item *item, int udev_class) | ||
| 609 | { | ||
| 610 | char name[128]; | ||
| 611 | |||
| 612 | name[0] = '\0'; | ||
| 613 | ioctl(item->fd, EVIOCGNAME(sizeof(name)), name); | ||
| 614 | |||
| 615 | SDL_AddKeyboard((SDL_KeyboardID)item->fd, name, true); | ||
| 616 | |||
| 617 | return true; | ||
| 618 | } | ||
| 619 | |||
| 620 | static void SDL_EVDEV_destroy_keyboard(SDL_evdevlist_item *item) | ||
| 621 | { | ||
| 622 | SDL_RemoveKeyboard((SDL_KeyboardID)item->fd, true); | ||
| 623 | } | ||
| 624 | |||
| 625 | static bool SDL_EVDEV_init_mouse(SDL_evdevlist_item *item, int udev_class) | ||
| 626 | { | ||
| 627 | char name[128]; | ||
| 628 | int ret; | ||
| 629 | struct input_absinfo abs_info; | ||
| 630 | |||
| 631 | name[0] = '\0'; | ||
| 632 | ioctl(item->fd, EVIOCGNAME(sizeof(name)), name); | ||
| 633 | |||
| 634 | SDL_AddMouse((SDL_MouseID)item->fd, name, true); | ||
| 635 | |||
| 636 | ret = ioctl(item->fd, EVIOCGABS(ABS_X), &abs_info); | ||
| 637 | if (ret < 0) { | ||
| 638 | // no absolute mode info, continue | ||
| 639 | return true; | ||
| 640 | } | ||
| 641 | item->min_x = abs_info.minimum; | ||
| 642 | item->max_x = abs_info.maximum; | ||
| 643 | item->range_x = abs_info.maximum - abs_info.minimum; | ||
| 644 | |||
| 645 | ret = ioctl(item->fd, EVIOCGABS(ABS_Y), &abs_info); | ||
| 646 | if (ret < 0) { | ||
| 647 | // no absolute mode info, continue | ||
| 648 | return true; | ||
| 649 | } | ||
| 650 | item->min_y = abs_info.minimum; | ||
| 651 | item->max_y = abs_info.maximum; | ||
| 652 | item->range_y = abs_info.maximum - abs_info.minimum; | ||
| 653 | |||
| 654 | return true; | ||
| 655 | } | ||
| 656 | |||
| 657 | static void SDL_EVDEV_destroy_mouse(SDL_evdevlist_item *item) | ||
| 658 | { | ||
| 659 | SDL_RemoveMouse((SDL_MouseID)item->fd, true); | ||
| 660 | } | ||
| 661 | |||
| 662 | static bool SDL_EVDEV_init_touchscreen(SDL_evdevlist_item *item, int udev_class) | ||
| 663 | { | ||
| 664 | int ret; | ||
| 665 | unsigned long xreq, yreq; | ||
| 666 | char name[64]; | ||
| 667 | struct input_absinfo abs_info; | ||
| 668 | |||
| 669 | if (!item->is_touchscreen) { | ||
| 670 | return true; | ||
| 671 | } | ||
| 672 | |||
| 673 | item->touchscreen_data = SDL_calloc(1, sizeof(*item->touchscreen_data)); | ||
| 674 | if (!item->touchscreen_data) { | ||
| 675 | return false; | ||
| 676 | } | ||
| 677 | |||
| 678 | ret = ioctl(item->fd, EVIOCGNAME(sizeof(name)), name); | ||
| 679 | if (ret < 0) { | ||
| 680 | SDL_free(item->touchscreen_data); | ||
| 681 | return SDL_SetError("Failed to get evdev touchscreen name"); | ||
| 682 | } | ||
| 683 | |||
| 684 | item->touchscreen_data->name = SDL_strdup(name); | ||
| 685 | if (!item->touchscreen_data->name) { | ||
| 686 | SDL_free(item->touchscreen_data); | ||
| 687 | return false; | ||
| 688 | } | ||
| 689 | |||
| 690 | ret = ioctl(item->fd, EVIOCGABS(ABS_MT_SLOT), &abs_info); | ||
| 691 | if (ret < 0) { | ||
| 692 | SDL_free(item->touchscreen_data->name); | ||
| 693 | SDL_free(item->touchscreen_data); | ||
| 694 | return SDL_SetError("Failed to get evdev touchscreen limits"); | ||
| 695 | } | ||
| 696 | |||
| 697 | if (abs_info.maximum == 0) { | ||
| 698 | item->touchscreen_data->max_slots = 1; | ||
| 699 | xreq = EVIOCGABS(ABS_X); | ||
| 700 | yreq = EVIOCGABS(ABS_Y); | ||
| 701 | } else { | ||
| 702 | item->touchscreen_data->max_slots = abs_info.maximum + 1; | ||
| 703 | xreq = EVIOCGABS(ABS_MT_POSITION_X); | ||
| 704 | yreq = EVIOCGABS(ABS_MT_POSITION_Y); | ||
| 705 | } | ||
| 706 | |||
| 707 | ret = ioctl(item->fd, xreq, &abs_info); | ||
| 708 | if (ret < 0) { | ||
| 709 | SDL_free(item->touchscreen_data->name); | ||
| 710 | SDL_free(item->touchscreen_data); | ||
| 711 | return SDL_SetError("Failed to get evdev touchscreen limits"); | ||
| 712 | } | ||
| 713 | item->touchscreen_data->min_x = abs_info.minimum; | ||
| 714 | item->touchscreen_data->max_x = abs_info.maximum; | ||
| 715 | item->touchscreen_data->range_x = abs_info.maximum - abs_info.minimum; | ||
| 716 | |||
| 717 | ret = ioctl(item->fd, yreq, &abs_info); | ||
| 718 | if (ret < 0) { | ||
| 719 | SDL_free(item->touchscreen_data->name); | ||
| 720 | SDL_free(item->touchscreen_data); | ||
| 721 | return SDL_SetError("Failed to get evdev touchscreen limits"); | ||
| 722 | } | ||
| 723 | item->touchscreen_data->min_y = abs_info.minimum; | ||
| 724 | item->touchscreen_data->max_y = abs_info.maximum; | ||
| 725 | item->touchscreen_data->range_y = abs_info.maximum - abs_info.minimum; | ||
| 726 | |||
| 727 | ret = ioctl(item->fd, EVIOCGABS(ABS_MT_PRESSURE), &abs_info); | ||
| 728 | if (ret < 0) { | ||
| 729 | SDL_free(item->touchscreen_data->name); | ||
| 730 | SDL_free(item->touchscreen_data); | ||
| 731 | return SDL_SetError("Failed to get evdev touchscreen limits"); | ||
| 732 | } | ||
| 733 | item->touchscreen_data->min_pressure = abs_info.minimum; | ||
| 734 | item->touchscreen_data->max_pressure = abs_info.maximum; | ||
| 735 | item->touchscreen_data->range_pressure = abs_info.maximum - abs_info.minimum; | ||
| 736 | |||
| 737 | item->touchscreen_data->slots = SDL_calloc( | ||
| 738 | item->touchscreen_data->max_slots, | ||
| 739 | sizeof(*item->touchscreen_data->slots)); | ||
| 740 | if (!item->touchscreen_data->slots) { | ||
| 741 | SDL_free(item->touchscreen_data->name); | ||
| 742 | SDL_free(item->touchscreen_data); | ||
| 743 | return false; | ||
| 744 | } | ||
| 745 | |||
| 746 | ret = SDL_AddTouch(item->fd, // I guess our fd is unique enough | ||
| 747 | (udev_class & SDL_UDEV_DEVICE_TOUCHPAD) ? SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE : SDL_TOUCH_DEVICE_DIRECT, | ||
| 748 | item->touchscreen_data->name); | ||
| 749 | if (ret < 0) { | ||
| 750 | SDL_free(item->touchscreen_data->slots); | ||
| 751 | SDL_free(item->touchscreen_data->name); | ||
| 752 | SDL_free(item->touchscreen_data); | ||
| 753 | return false; | ||
| 754 | } | ||
| 755 | |||
| 756 | return true; | ||
| 757 | } | ||
| 758 | |||
| 759 | static void SDL_EVDEV_destroy_touchscreen(SDL_evdevlist_item *item) | ||
| 760 | { | ||
| 761 | if (!item->is_touchscreen) { | ||
| 762 | return; | ||
| 763 | } | ||
| 764 | |||
| 765 | SDL_DelTouch(item->fd); | ||
| 766 | SDL_free(item->touchscreen_data->slots); | ||
| 767 | SDL_free(item->touchscreen_data->name); | ||
| 768 | SDL_free(item->touchscreen_data); | ||
| 769 | } | ||
| 770 | |||
| 771 | static void SDL_EVDEV_sync_device(SDL_evdevlist_item *item) | ||
| 772 | { | ||
| 773 | #ifdef EVIOCGMTSLOTS | ||
| 774 | int i, ret; | ||
| 775 | struct input_absinfo abs_info; | ||
| 776 | /* | ||
| 777 | * struct input_mt_request_layout { | ||
| 778 | * __u32 code; | ||
| 779 | * __s32 values[num_slots]; | ||
| 780 | * }; | ||
| 781 | * | ||
| 782 | * this is the structure we're trying to emulate | ||
| 783 | */ | ||
| 784 | Uint32 *mt_req_code; | ||
| 785 | Sint32 *mt_req_values; | ||
| 786 | size_t mt_req_size; | ||
| 787 | |||
| 788 | // TODO: sync devices other than touchscreen | ||
| 789 | if (!item->is_touchscreen) { | ||
| 790 | return; | ||
| 791 | } | ||
| 792 | |||
| 793 | mt_req_size = sizeof(*mt_req_code) + | ||
| 794 | sizeof(*mt_req_values) * item->touchscreen_data->max_slots; | ||
| 795 | |||
| 796 | mt_req_code = SDL_calloc(1, mt_req_size); | ||
| 797 | if (!mt_req_code) { | ||
| 798 | return; | ||
| 799 | } | ||
| 800 | |||
| 801 | mt_req_values = (Sint32 *)mt_req_code + 1; | ||
| 802 | |||
| 803 | *mt_req_code = ABS_MT_TRACKING_ID; | ||
| 804 | ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); | ||
| 805 | if (ret < 0) { | ||
| 806 | SDL_free(mt_req_code); | ||
| 807 | return; | ||
| 808 | } | ||
| 809 | for (i = 0; i < item->touchscreen_data->max_slots; i++) { | ||
| 810 | /* | ||
| 811 | * This doesn't account for the very edge case of the user removing their | ||
| 812 | * finger and replacing it on the screen during the time we're out of sync, | ||
| 813 | * which'll mean that we're not going from down -> up or up -> down, we're | ||
| 814 | * going from down -> down but with a different tracking id, meaning we'd | ||
| 815 | * have to tell SDL of the two events, but since we wait till SYN_REPORT in | ||
| 816 | * SDL_EVDEV_Poll to tell SDL, the current structure of this code doesn't | ||
| 817 | * allow it. Lets just pray to God it doesn't happen. | ||
| 818 | */ | ||
| 819 | if (item->touchscreen_data->slots[i].tracking_id == 0 && | ||
| 820 | mt_req_values[i] >= 0) { | ||
| 821 | item->touchscreen_data->slots[i].tracking_id = mt_req_values[i] + 1; | ||
| 822 | item->touchscreen_data->slots[i].delta = EVDEV_TOUCH_SLOTDELTA_DOWN; | ||
| 823 | } else if (item->touchscreen_data->slots[i].tracking_id != 0 && | ||
| 824 | mt_req_values[i] < 0) { | ||
| 825 | item->touchscreen_data->slots[i].tracking_id = 0; | ||
| 826 | item->touchscreen_data->slots[i].delta = EVDEV_TOUCH_SLOTDELTA_UP; | ||
| 827 | } | ||
| 828 | } | ||
| 829 | |||
| 830 | *mt_req_code = ABS_MT_POSITION_X; | ||
| 831 | ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); | ||
| 832 | if (ret < 0) { | ||
| 833 | SDL_free(mt_req_code); | ||
| 834 | return; | ||
| 835 | } | ||
| 836 | for (i = 0; i < item->touchscreen_data->max_slots; i++) { | ||
| 837 | if (item->touchscreen_data->slots[i].tracking_id != 0 && | ||
| 838 | item->touchscreen_data->slots[i].x != mt_req_values[i]) { | ||
| 839 | item->touchscreen_data->slots[i].x = mt_req_values[i]; | ||
| 840 | if (item->touchscreen_data->slots[i].delta == | ||
| 841 | EVDEV_TOUCH_SLOTDELTA_NONE) { | ||
| 842 | item->touchscreen_data->slots[i].delta = | ||
| 843 | EVDEV_TOUCH_SLOTDELTA_MOVE; | ||
| 844 | } | ||
| 845 | } | ||
| 846 | } | ||
| 847 | |||
| 848 | *mt_req_code = ABS_MT_POSITION_Y; | ||
| 849 | ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); | ||
| 850 | if (ret < 0) { | ||
| 851 | SDL_free(mt_req_code); | ||
| 852 | return; | ||
| 853 | } | ||
| 854 | for (i = 0; i < item->touchscreen_data->max_slots; i++) { | ||
| 855 | if (item->touchscreen_data->slots[i].tracking_id != 0 && | ||
| 856 | item->touchscreen_data->slots[i].y != mt_req_values[i]) { | ||
| 857 | item->touchscreen_data->slots[i].y = mt_req_values[i]; | ||
| 858 | if (item->touchscreen_data->slots[i].delta == | ||
| 859 | EVDEV_TOUCH_SLOTDELTA_NONE) { | ||
| 860 | item->touchscreen_data->slots[i].delta = | ||
| 861 | EVDEV_TOUCH_SLOTDELTA_MOVE; | ||
| 862 | } | ||
| 863 | } | ||
| 864 | } | ||
| 865 | |||
| 866 | *mt_req_code = ABS_MT_PRESSURE; | ||
| 867 | ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); | ||
| 868 | if (ret < 0) { | ||
| 869 | SDL_free(mt_req_code); | ||
| 870 | return; | ||
| 871 | } | ||
| 872 | for (i = 0; i < item->touchscreen_data->max_slots; i++) { | ||
| 873 | if (item->touchscreen_data->slots[i].tracking_id != 0 && | ||
| 874 | item->touchscreen_data->slots[i].pressure != mt_req_values[i]) { | ||
| 875 | item->touchscreen_data->slots[i].pressure = mt_req_values[i]; | ||
| 876 | if (item->touchscreen_data->slots[i].delta == | ||
| 877 | EVDEV_TOUCH_SLOTDELTA_NONE) { | ||
| 878 | item->touchscreen_data->slots[i].delta = | ||
| 879 | EVDEV_TOUCH_SLOTDELTA_MOVE; | ||
| 880 | } | ||
| 881 | } | ||
| 882 | } | ||
| 883 | |||
| 884 | ret = ioctl(item->fd, EVIOCGABS(ABS_MT_SLOT), &abs_info); | ||
| 885 | if (ret < 0) { | ||
| 886 | SDL_free(mt_req_code); | ||
| 887 | return; | ||
| 888 | } | ||
| 889 | item->touchscreen_data->current_slot = abs_info.value; | ||
| 890 | |||
| 891 | SDL_free(mt_req_code); | ||
| 892 | |||
| 893 | #endif // EVIOCGMTSLOTS | ||
| 894 | } | ||
| 895 | |||
| 896 | static bool SDL_EVDEV_device_added(const char *dev_path, int udev_class) | ||
| 897 | { | ||
| 898 | SDL_evdevlist_item *item; | ||
| 899 | unsigned long relbit[NBITS(REL_MAX)] = { 0 }; | ||
| 900 | |||
| 901 | // Check to make sure it's not already in list. | ||
| 902 | for (item = _this->first; item; item = item->next) { | ||
| 903 | if (SDL_strcmp(dev_path, item->path) == 0) { | ||
| 904 | return false; // already have this one | ||
| 905 | } | ||
| 906 | } | ||
| 907 | |||
| 908 | item = (SDL_evdevlist_item *)SDL_calloc(1, sizeof(SDL_evdevlist_item)); | ||
| 909 | if (!item) { | ||
| 910 | return false; | ||
| 911 | } | ||
| 912 | |||
| 913 | item->fd = open(dev_path, O_RDONLY | O_NONBLOCK | O_CLOEXEC); | ||
| 914 | if (item->fd < 0) { | ||
| 915 | SDL_free(item); | ||
| 916 | return SDL_SetError("Unable to open %s", dev_path); | ||
| 917 | } | ||
| 918 | |||
| 919 | item->path = SDL_strdup(dev_path); | ||
| 920 | if (!item->path) { | ||
| 921 | close(item->fd); | ||
| 922 | SDL_free(item); | ||
| 923 | return false; | ||
| 924 | } | ||
| 925 | |||
| 926 | item->udev_class = udev_class; | ||
| 927 | |||
| 928 | if (ioctl(item->fd, EVIOCGBIT(EV_REL, sizeof(relbit)), relbit) >= 0) { | ||
| 929 | item->relative_mouse = test_bit(REL_X, relbit) && test_bit(REL_Y, relbit); | ||
| 930 | item->high_res_wheel = test_bit(REL_WHEEL_HI_RES, relbit); | ||
| 931 | item->high_res_hwheel = test_bit(REL_HWHEEL_HI_RES, relbit); | ||
| 932 | } | ||
| 933 | |||
| 934 | // For now, we just treat a touchpad like a touchscreen | ||
| 935 | if (udev_class & (SDL_UDEV_DEVICE_TOUCHSCREEN | SDL_UDEV_DEVICE_TOUCHPAD)) { | ||
| 936 | item->is_touchscreen = true; | ||
| 937 | if (!SDL_EVDEV_init_touchscreen(item, udev_class)) { | ||
| 938 | close(item->fd); | ||
| 939 | SDL_free(item->path); | ||
| 940 | SDL_free(item); | ||
| 941 | return false; | ||
| 942 | } | ||
| 943 | } | ||
| 944 | |||
| 945 | if (udev_class & SDL_UDEV_DEVICE_MOUSE) { | ||
| 946 | if (!SDL_EVDEV_init_mouse(item, udev_class)) { | ||
| 947 | close(item->fd); | ||
| 948 | SDL_free(item->path); | ||
| 949 | SDL_free(item); | ||
| 950 | return false; | ||
| 951 | } | ||
| 952 | } | ||
| 953 | |||
| 954 | if (udev_class & SDL_UDEV_DEVICE_KEYBOARD) { | ||
| 955 | if (!SDL_EVDEV_init_keyboard(item, udev_class)) { | ||
| 956 | close(item->fd); | ||
| 957 | SDL_free(item->path); | ||
| 958 | SDL_free(item); | ||
| 959 | return false; | ||
| 960 | } | ||
| 961 | } | ||
| 962 | |||
| 963 | if (!_this->last) { | ||
| 964 | _this->first = _this->last = item; | ||
| 965 | } else { | ||
| 966 | _this->last->next = item; | ||
| 967 | _this->last = item; | ||
| 968 | } | ||
| 969 | |||
| 970 | SDL_EVDEV_sync_device(item); | ||
| 971 | |||
| 972 | SDL_EVDEV_UpdateKeyboardMute(); | ||
| 973 | |||
| 974 | ++_this->num_devices; | ||
| 975 | return true; | ||
| 976 | } | ||
| 977 | |||
| 978 | static bool SDL_EVDEV_device_removed(const char *dev_path) | ||
| 979 | { | ||
| 980 | SDL_evdevlist_item *item; | ||
| 981 | SDL_evdevlist_item *prev = NULL; | ||
| 982 | |||
| 983 | for (item = _this->first; item; item = item->next) { | ||
| 984 | // found it, remove it. | ||
| 985 | if (SDL_strcmp(dev_path, item->path) == 0) { | ||
| 986 | if (prev) { | ||
| 987 | prev->next = item->next; | ||
| 988 | } else { | ||
| 989 | SDL_assert(_this->first == item); | ||
| 990 | _this->first = item->next; | ||
| 991 | } | ||
| 992 | if (item == _this->last) { | ||
| 993 | _this->last = prev; | ||
| 994 | } | ||
| 995 | |||
| 996 | if (item->is_touchscreen) { | ||
| 997 | SDL_EVDEV_destroy_touchscreen(item); | ||
| 998 | } | ||
| 999 | if (item->udev_class & SDL_UDEV_DEVICE_MOUSE) { | ||
| 1000 | SDL_EVDEV_destroy_mouse(item); | ||
| 1001 | } | ||
| 1002 | if (item->udev_class & SDL_UDEV_DEVICE_KEYBOARD) { | ||
| 1003 | SDL_EVDEV_destroy_keyboard(item); | ||
| 1004 | } | ||
| 1005 | close(item->fd); | ||
| 1006 | SDL_free(item->path); | ||
| 1007 | SDL_free(item); | ||
| 1008 | SDL_EVDEV_UpdateKeyboardMute(); | ||
| 1009 | _this->num_devices--; | ||
| 1010 | return true; | ||
| 1011 | } | ||
| 1012 | prev = item; | ||
| 1013 | } | ||
| 1014 | |||
| 1015 | return false; | ||
| 1016 | } | ||
| 1017 | |||
| 1018 | Uint64 SDL_EVDEV_GetEventTimestamp(struct input_event *event) | ||
| 1019 | { | ||
| 1020 | static Uint64 timestamp_offset; | ||
| 1021 | Uint64 timestamp; | ||
| 1022 | Uint64 now = SDL_GetTicksNS(); | ||
| 1023 | |||
| 1024 | /* The kernel internally has nanosecond timestamps, but converts it | ||
| 1025 | to microseconds when delivering the events */ | ||
| 1026 | timestamp = event->input_event_sec; | ||
| 1027 | timestamp *= SDL_NS_PER_SECOND; | ||
| 1028 | timestamp += SDL_US_TO_NS(event->input_event_usec); | ||
| 1029 | |||
| 1030 | if (!timestamp_offset) { | ||
| 1031 | timestamp_offset = (now - timestamp); | ||
| 1032 | } | ||
| 1033 | timestamp += timestamp_offset; | ||
| 1034 | |||
| 1035 | if (timestamp > now) { | ||
| 1036 | timestamp_offset -= (timestamp - now); | ||
| 1037 | timestamp = now; | ||
| 1038 | } | ||
| 1039 | return timestamp; | ||
| 1040 | } | ||
| 1041 | |||
| 1042 | #endif // SDL_INPUT_LINUXEV | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_evdev.h b/contrib/SDL-3.2.8/src/core/linux/SDL_evdev.h new file mode 100644 index 0000000..d3e2fe1 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_evdev.h | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "SDL_internal.h" | ||
| 23 | |||
| 24 | #ifndef SDL_evdev_h_ | ||
| 25 | #define SDL_evdev_h_ | ||
| 26 | |||
| 27 | #ifdef SDL_INPUT_LINUXEV | ||
| 28 | |||
| 29 | struct input_event; | ||
| 30 | |||
| 31 | extern bool SDL_EVDEV_Init(void); | ||
| 32 | extern void SDL_EVDEV_Quit(void); | ||
| 33 | extern void SDL_EVDEV_SetVTSwitchCallbacks(void (*release_callback)(void*), void *release_callback_data, | ||
| 34 | void (*acquire_callback)(void*), void *acquire_callback_data); | ||
| 35 | extern int SDL_EVDEV_GetDeviceCount(int device_class); | ||
| 36 | extern void SDL_EVDEV_Poll(void); | ||
| 37 | extern Uint64 SDL_EVDEV_GetEventTimestamp(struct input_event *event); | ||
| 38 | |||
| 39 | #endif // SDL_INPUT_LINUXEV | ||
| 40 | |||
| 41 | #endif // SDL_evdev_h_ | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_evdev_capabilities.c b/contrib/SDL-3.2.8/src/core/linux/SDL_evdev_capabilities.c new file mode 100644 index 0000000..61e240e --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_evdev_capabilities.c | |||
| @@ -0,0 +1,168 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | Copyright (C) 2020 Collabora Ltd. | ||
| 5 | |||
| 6 | This software is provided 'as-is', without any express or implied | ||
| 7 | warranty. In no event will the authors be held liable for any damages | ||
| 8 | arising from the use of this software. | ||
| 9 | |||
| 10 | Permission is granted to anyone to use this software for any purpose, | ||
| 11 | including commercial applications, and to alter it and redistribute it | ||
| 12 | freely, subject to the following restrictions: | ||
| 13 | |||
| 14 | 1. The origin of this software must not be misrepresented; you must not | ||
| 15 | claim that you wrote the original software. If you use this software | ||
| 16 | in a product, an acknowledgment in the product documentation would be | ||
| 17 | appreciated but is not required. | ||
| 18 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 19 | misrepresented as being the original software. | ||
| 20 | 3. This notice may not be removed or altered from any source distribution. | ||
| 21 | */ | ||
| 22 | #include "SDL_internal.h" | ||
| 23 | |||
| 24 | #include "SDL_evdev_capabilities.h" | ||
| 25 | |||
| 26 | #ifdef HAVE_LINUX_INPUT_H | ||
| 27 | |||
| 28 | // missing defines in older Linux kernel headers | ||
| 29 | #ifndef BTN_TRIGGER_HAPPY | ||
| 30 | #define BTN_TRIGGER_HAPPY 0x2c0 | ||
| 31 | #endif | ||
| 32 | #ifndef BTN_DPAD_UP | ||
| 33 | #define BTN_DPAD_UP 0x220 | ||
| 34 | #endif | ||
| 35 | #ifndef KEY_ALS_TOGGLE | ||
| 36 | #define KEY_ALS_TOGGLE 0x230 | ||
| 37 | #endif | ||
| 38 | |||
| 39 | extern int | ||
| 40 | SDL_EVDEV_GuessDeviceClass(const unsigned long bitmask_props[NBITS(INPUT_PROP_MAX)], | ||
| 41 | const unsigned long bitmask_ev[NBITS(EV_MAX)], | ||
| 42 | const unsigned long bitmask_abs[NBITS(ABS_MAX)], | ||
| 43 | const unsigned long bitmask_key[NBITS(KEY_MAX)], | ||
| 44 | const unsigned long bitmask_rel[NBITS(REL_MAX)]) | ||
| 45 | { | ||
| 46 | struct range | ||
| 47 | { | ||
| 48 | unsigned start; | ||
| 49 | unsigned end; | ||
| 50 | }; | ||
| 51 | |||
| 52 | // key code ranges above BTN_MISC (start is inclusive, stop is exclusive) | ||
| 53 | static const struct range high_key_blocks[] = { | ||
| 54 | { KEY_OK, BTN_DPAD_UP }, | ||
| 55 | { KEY_ALS_TOGGLE, BTN_TRIGGER_HAPPY } | ||
| 56 | }; | ||
| 57 | |||
| 58 | int devclass = 0; | ||
| 59 | unsigned long keyboard_mask; | ||
| 60 | |||
| 61 | // If the kernel specifically says it's an accelerometer, believe it | ||
| 62 | if (test_bit(INPUT_PROP_ACCELEROMETER, bitmask_props)) { | ||
| 63 | return SDL_UDEV_DEVICE_ACCELEROMETER; | ||
| 64 | } | ||
| 65 | |||
| 66 | // We treat pointing sticks as indistinguishable from mice | ||
| 67 | if (test_bit(INPUT_PROP_POINTING_STICK, bitmask_props)) { | ||
| 68 | return SDL_UDEV_DEVICE_MOUSE; | ||
| 69 | } | ||
| 70 | |||
| 71 | // We treat buttonpads as equivalent to touchpads | ||
| 72 | if (test_bit(INPUT_PROP_TOPBUTTONPAD, bitmask_props) || | ||
| 73 | test_bit(INPUT_PROP_BUTTONPAD, bitmask_props) || | ||
| 74 | test_bit(INPUT_PROP_SEMI_MT, bitmask_props)) { | ||
| 75 | return SDL_UDEV_DEVICE_TOUCHPAD; | ||
| 76 | } | ||
| 77 | |||
| 78 | // X, Y, Z axes but no buttons probably means an accelerometer | ||
| 79 | if (test_bit(EV_ABS, bitmask_ev) && | ||
| 80 | test_bit(ABS_X, bitmask_abs) && | ||
| 81 | test_bit(ABS_Y, bitmask_abs) && | ||
| 82 | test_bit(ABS_Z, bitmask_abs) && | ||
| 83 | !test_bit(EV_KEY, bitmask_ev)) { | ||
| 84 | return SDL_UDEV_DEVICE_ACCELEROMETER; | ||
| 85 | } | ||
| 86 | |||
| 87 | /* RX, RY, RZ axes but no buttons probably means a gyro or | ||
| 88 | * accelerometer (we don't distinguish) */ | ||
| 89 | if (test_bit(EV_ABS, bitmask_ev) && | ||
| 90 | test_bit(ABS_RX, bitmask_abs) && | ||
| 91 | test_bit(ABS_RY, bitmask_abs) && | ||
| 92 | test_bit(ABS_RZ, bitmask_abs) && | ||
| 93 | !test_bit(EV_KEY, bitmask_ev)) { | ||
| 94 | return SDL_UDEV_DEVICE_ACCELEROMETER; | ||
| 95 | } | ||
| 96 | |||
| 97 | if (test_bit(EV_ABS, bitmask_ev) && | ||
| 98 | test_bit(ABS_X, bitmask_abs) && test_bit(ABS_Y, bitmask_abs)) { | ||
| 99 | if (test_bit(BTN_STYLUS, bitmask_key) || test_bit(BTN_TOOL_PEN, bitmask_key)) { | ||
| 100 | ; // ID_INPUT_TABLET | ||
| 101 | } else if (test_bit(BTN_TOOL_FINGER, bitmask_key) && !test_bit(BTN_TOOL_PEN, bitmask_key)) { | ||
| 102 | devclass |= SDL_UDEV_DEVICE_TOUCHPAD; // ID_INPUT_TOUCHPAD | ||
| 103 | } else if (test_bit(BTN_MOUSE, bitmask_key)) { | ||
| 104 | devclass |= SDL_UDEV_DEVICE_MOUSE; // ID_INPUT_MOUSE | ||
| 105 | } else if (test_bit(BTN_TOUCH, bitmask_key)) { | ||
| 106 | /* TODO: better determining between touchscreen and multitouch touchpad, | ||
| 107 | see https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-input_id.c */ | ||
| 108 | devclass |= SDL_UDEV_DEVICE_TOUCHSCREEN; // ID_INPUT_TOUCHSCREEN | ||
| 109 | } | ||
| 110 | |||
| 111 | if (test_bit(BTN_TRIGGER, bitmask_key) || | ||
| 112 | test_bit(BTN_A, bitmask_key) || | ||
| 113 | test_bit(BTN_1, bitmask_key) || | ||
| 114 | test_bit(ABS_RX, bitmask_abs) || | ||
| 115 | test_bit(ABS_RY, bitmask_abs) || | ||
| 116 | test_bit(ABS_RZ, bitmask_abs) || | ||
| 117 | test_bit(ABS_THROTTLE, bitmask_abs) || | ||
| 118 | test_bit(ABS_RUDDER, bitmask_abs) || | ||
| 119 | test_bit(ABS_WHEEL, bitmask_abs) || | ||
| 120 | test_bit(ABS_GAS, bitmask_abs) || | ||
| 121 | test_bit(ABS_BRAKE, bitmask_abs)) { | ||
| 122 | devclass |= SDL_UDEV_DEVICE_JOYSTICK; // ID_INPUT_JOYSTICK | ||
| 123 | } | ||
| 124 | } | ||
| 125 | |||
| 126 | if (test_bit(EV_REL, bitmask_ev) && | ||
| 127 | test_bit(REL_X, bitmask_rel) && test_bit(REL_Y, bitmask_rel) && | ||
| 128 | test_bit(BTN_MOUSE, bitmask_key)) { | ||
| 129 | devclass |= SDL_UDEV_DEVICE_MOUSE; // ID_INPUT_MOUSE | ||
| 130 | } | ||
| 131 | |||
| 132 | if (test_bit(EV_KEY, bitmask_ev)) { | ||
| 133 | unsigned i; | ||
| 134 | unsigned long found = 0; | ||
| 135 | |||
| 136 | for (i = 0; i < BTN_MISC / BITS_PER_LONG; ++i) { | ||
| 137 | found |= bitmask_key[i]; | ||
| 138 | } | ||
| 139 | // If there are no keys in the lower block, check the higher blocks | ||
| 140 | if (!found) { | ||
| 141 | unsigned block; | ||
| 142 | for (block = 0; block < (sizeof(high_key_blocks) / sizeof(struct range)); ++block) { | ||
| 143 | for (i = high_key_blocks[block].start; i < high_key_blocks[block].end; ++i) { | ||
| 144 | if (test_bit(i, bitmask_key)) { | ||
| 145 | found = 1; | ||
| 146 | break; | ||
| 147 | } | ||
| 148 | } | ||
| 149 | } | ||
| 150 | } | ||
| 151 | |||
| 152 | if (found > 0) { | ||
| 153 | devclass |= SDL_UDEV_DEVICE_HAS_KEYS; // ID_INPUT_KEY | ||
| 154 | } | ||
| 155 | } | ||
| 156 | |||
| 157 | /* the first 32 bits are ESC, numbers, and Q to D, so if we have all of | ||
| 158 | * those, consider it to be a fully-featured keyboard; | ||
| 159 | * do not test KEY_RESERVED, though */ | ||
| 160 | keyboard_mask = 0xFFFFFFFE; | ||
| 161 | if ((bitmask_key[0] & keyboard_mask) == keyboard_mask) { | ||
| 162 | devclass |= SDL_UDEV_DEVICE_KEYBOARD; // ID_INPUT_KEYBOARD | ||
| 163 | } | ||
| 164 | |||
| 165 | return devclass; | ||
| 166 | } | ||
| 167 | |||
| 168 | #endif // HAVE_LINUX_INPUT_H | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_evdev_capabilities.h b/contrib/SDL-3.2.8/src/core/linux/SDL_evdev_capabilities.h new file mode 100644 index 0000000..5a70bdd --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_evdev_capabilities.h | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | Copyright (C) 2020 Collabora Ltd. | ||
| 5 | |||
| 6 | This software is provided 'as-is', without any express or implied | ||
| 7 | warranty. In no event will the authors be held liable for any damages | ||
| 8 | arising from the use of this software. | ||
| 9 | |||
| 10 | Permission is granted to anyone to use this software for any purpose, | ||
| 11 | including commercial applications, and to alter it and redistribute it | ||
| 12 | freely, subject to the following restrictions: | ||
| 13 | |||
| 14 | 1. The origin of this software must not be misrepresented; you must not | ||
| 15 | claim that you wrote the original software. If you use this software | ||
| 16 | in a product, an acknowledgment in the product documentation would be | ||
| 17 | appreciated but is not required. | ||
| 18 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 19 | misrepresented as being the original software. | ||
| 20 | 3. This notice may not be removed or altered from any source distribution. | ||
| 21 | */ | ||
| 22 | #include "SDL_internal.h" | ||
| 23 | |||
| 24 | #ifndef SDL_evdev_capabilities_h_ | ||
| 25 | #define SDL_evdev_capabilities_h_ | ||
| 26 | |||
| 27 | #ifdef HAVE_LINUX_INPUT_H | ||
| 28 | |||
| 29 | #include <linux/input.h> | ||
| 30 | |||
| 31 | #ifndef INPUT_PROP_SEMI_MT | ||
| 32 | #define INPUT_PROP_SEMI_MT 0x03 | ||
| 33 | #endif | ||
| 34 | #ifndef INPUT_PROP_TOPBUTTONPAD | ||
| 35 | #define INPUT_PROP_TOPBUTTONPAD 0x04 | ||
| 36 | #endif | ||
| 37 | #ifndef INPUT_PROP_POINTING_STICK | ||
| 38 | #define INPUT_PROP_POINTING_STICK 0x05 | ||
| 39 | #endif | ||
| 40 | #ifndef INPUT_PROP_ACCELEROMETER | ||
| 41 | #define INPUT_PROP_ACCELEROMETER 0x06 | ||
| 42 | #endif | ||
| 43 | #ifndef INPUT_PROP_MAX | ||
| 44 | #define INPUT_PROP_MAX 0x1f | ||
| 45 | #endif | ||
| 46 | |||
| 47 | // A device can be any combination of these classes | ||
| 48 | typedef enum | ||
| 49 | { | ||
| 50 | SDL_UDEV_DEVICE_UNKNOWN = 0x0000, | ||
| 51 | SDL_UDEV_DEVICE_MOUSE = 0x0001, | ||
| 52 | SDL_UDEV_DEVICE_KEYBOARD = 0x0002, | ||
| 53 | SDL_UDEV_DEVICE_JOYSTICK = 0x0004, | ||
| 54 | SDL_UDEV_DEVICE_SOUND = 0x0008, | ||
| 55 | SDL_UDEV_DEVICE_TOUCHSCREEN = 0x0010, | ||
| 56 | SDL_UDEV_DEVICE_ACCELEROMETER = 0x0020, | ||
| 57 | SDL_UDEV_DEVICE_TOUCHPAD = 0x0040, | ||
| 58 | SDL_UDEV_DEVICE_HAS_KEYS = 0x0080, | ||
| 59 | SDL_UDEV_DEVICE_VIDEO_CAPTURE = 0x0100, | ||
| 60 | } SDL_UDEV_deviceclass; | ||
| 61 | |||
| 62 | #define BITS_PER_LONG (sizeof(unsigned long) * 8) | ||
| 63 | #define NBITS(x) ((((x)-1) / BITS_PER_LONG) + 1) | ||
| 64 | #define EVDEV_OFF(x) ((x) % BITS_PER_LONG) | ||
| 65 | #define EVDEV_LONG(x) ((x) / BITS_PER_LONG) | ||
| 66 | #define test_bit(bit, array) ((array[EVDEV_LONG(bit)] >> EVDEV_OFF(bit)) & 1) | ||
| 67 | |||
| 68 | extern int SDL_EVDEV_GuessDeviceClass(const unsigned long bitmask_props[NBITS(INPUT_PROP_MAX)], | ||
| 69 | const unsigned long bitmask_ev[NBITS(EV_MAX)], | ||
| 70 | const unsigned long bitmask_abs[NBITS(ABS_MAX)], | ||
| 71 | const unsigned long bitmask_key[NBITS(KEY_MAX)], | ||
| 72 | const unsigned long bitmask_rel[NBITS(REL_MAX)]); | ||
| 73 | |||
| 74 | #endif // HAVE_LINUX_INPUT_H | ||
| 75 | |||
| 76 | #endif // SDL_evdev_capabilities_h_ | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_evdev_kbd.c b/contrib/SDL-3.2.8/src/core/linux/SDL_evdev_kbd.c new file mode 100644 index 0000000..b1a5664 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_evdev_kbd.c | |||
| @@ -0,0 +1,997 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #include "SDL_evdev_kbd.h" | ||
| 24 | |||
| 25 | #ifdef SDL_INPUT_LINUXKD | ||
| 26 | |||
| 27 | // This logic is adapted from drivers/tty/vt/keyboard.c in the Linux kernel source | ||
| 28 | |||
| 29 | #include <unistd.h> | ||
| 30 | #include <fcntl.h> | ||
| 31 | #include <sys/ioctl.h> | ||
| 32 | #include <linux/kd.h> | ||
| 33 | #include <linux/keyboard.h> | ||
| 34 | #include <linux/vt.h> | ||
| 35 | #include <linux/tiocl.h> // for TIOCL_GETSHIFTSTATE | ||
| 36 | |||
| 37 | #include <signal.h> | ||
| 38 | |||
| 39 | #include "../../events/SDL_events_c.h" | ||
| 40 | #include "SDL_evdev_kbd_default_accents.h" | ||
| 41 | #include "SDL_evdev_kbd_default_keymap.h" | ||
| 42 | |||
| 43 | // These are not defined in older Linux kernel headers | ||
| 44 | #ifndef K_UNICODE | ||
| 45 | #define K_UNICODE 0x03 | ||
| 46 | #endif | ||
| 47 | #ifndef K_OFF | ||
| 48 | #define K_OFF 0x04 | ||
| 49 | #endif | ||
| 50 | |||
| 51 | /* | ||
| 52 | * Handler Tables. | ||
| 53 | */ | ||
| 54 | |||
| 55 | #define K_HANDLERS \ | ||
| 56 | k_self, k_fn, k_spec, k_pad, \ | ||
| 57 | k_dead, k_cons, k_cur, k_shift, \ | ||
| 58 | k_meta, k_ascii, k_lock, k_lowercase, \ | ||
| 59 | k_slock, k_dead2, k_brl, k_ignore | ||
| 60 | |||
| 61 | typedef void(k_handler_fn)(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag); | ||
| 62 | static k_handler_fn K_HANDLERS; | ||
| 63 | static k_handler_fn *k_handler[16] = { K_HANDLERS }; | ||
| 64 | |||
| 65 | typedef void(fn_handler_fn)(SDL_EVDEV_keyboard_state *kbd); | ||
| 66 | static void fn_enter(SDL_EVDEV_keyboard_state *kbd); | ||
| 67 | static void fn_caps_toggle(SDL_EVDEV_keyboard_state *kbd); | ||
| 68 | static void fn_caps_on(SDL_EVDEV_keyboard_state *kbd); | ||
| 69 | static void fn_num(SDL_EVDEV_keyboard_state *kbd); | ||
| 70 | static void fn_compose(SDL_EVDEV_keyboard_state *kbd); | ||
| 71 | |||
| 72 | static fn_handler_fn *fn_handler[] = { | ||
| 73 | NULL, fn_enter, NULL, NULL, | ||
| 74 | NULL, NULL, NULL, fn_caps_toggle, | ||
| 75 | fn_num, NULL, NULL, NULL, | ||
| 76 | NULL, fn_caps_on, fn_compose, NULL, | ||
| 77 | NULL, NULL, NULL, fn_num | ||
| 78 | }; | ||
| 79 | |||
| 80 | /* | ||
| 81 | * Keyboard State | ||
| 82 | */ | ||
| 83 | |||
| 84 | struct SDL_EVDEV_keyboard_state | ||
| 85 | { | ||
| 86 | int console_fd; | ||
| 87 | bool muted; | ||
| 88 | int old_kbd_mode; | ||
| 89 | unsigned short **key_maps; | ||
| 90 | unsigned char shift_down[NR_SHIFT]; // shift state counters.. | ||
| 91 | bool dead_key_next; | ||
| 92 | int npadch; // -1 or number assembled on pad | ||
| 93 | struct kbdiacrs *accents; | ||
| 94 | unsigned int diacr; | ||
| 95 | bool rep; // flag telling character repeat | ||
| 96 | unsigned char lockstate; | ||
| 97 | unsigned char slockstate; | ||
| 98 | unsigned char ledflagstate; | ||
| 99 | char shift_state; | ||
| 100 | char text[128]; | ||
| 101 | unsigned int text_len; | ||
| 102 | void (*vt_release_callback)(void *); | ||
| 103 | void *vt_release_callback_data; | ||
| 104 | void (*vt_acquire_callback)(void *); | ||
| 105 | void *vt_acquire_callback_data; | ||
| 106 | }; | ||
| 107 | |||
| 108 | #ifdef DUMP_ACCENTS | ||
| 109 | static void SDL_EVDEV_dump_accents(SDL_EVDEV_keyboard_state *kbd) | ||
| 110 | { | ||
| 111 | unsigned int i; | ||
| 112 | |||
| 113 | printf("static struct kbdiacrs default_accents = {\n"); | ||
| 114 | printf(" %d,\n", kbd->accents->kb_cnt); | ||
| 115 | printf(" {\n"); | ||
| 116 | for (i = 0; i < kbd->accents->kb_cnt; ++i) { | ||
| 117 | struct kbdiacr *diacr = &kbd->accents->kbdiacr[i]; | ||
| 118 | printf(" { 0x%.2x, 0x%.2x, 0x%.2x },\n", | ||
| 119 | diacr->diacr, diacr->base, diacr->result); | ||
| 120 | } | ||
| 121 | while (i < 256) { | ||
| 122 | printf(" { 0x00, 0x00, 0x00 },\n"); | ||
| 123 | ++i; | ||
| 124 | } | ||
| 125 | printf(" }\n"); | ||
| 126 | printf("};\n"); | ||
| 127 | } | ||
| 128 | #endif // DUMP_ACCENTS | ||
| 129 | |||
| 130 | #ifdef DUMP_KEYMAP | ||
| 131 | static void SDL_EVDEV_dump_keymap(SDL_EVDEV_keyboard_state *kbd) | ||
| 132 | { | ||
| 133 | int i, j; | ||
| 134 | |||
| 135 | for (i = 0; i < MAX_NR_KEYMAPS; ++i) { | ||
| 136 | if (kbd->key_maps[i]) { | ||
| 137 | printf("static unsigned short default_key_map_%d[NR_KEYS] = {", i); | ||
| 138 | for (j = 0; j < NR_KEYS; ++j) { | ||
| 139 | if ((j % 8) == 0) { | ||
| 140 | printf("\n "); | ||
| 141 | } | ||
| 142 | printf("0x%.4x, ", kbd->key_maps[i][j]); | ||
| 143 | } | ||
| 144 | printf("\n};\n"); | ||
| 145 | } | ||
| 146 | } | ||
| 147 | printf("\n"); | ||
| 148 | printf("static unsigned short *default_key_maps[MAX_NR_KEYMAPS] = {\n"); | ||
| 149 | for (i = 0; i < MAX_NR_KEYMAPS; ++i) { | ||
| 150 | if (kbd->key_maps[i]) { | ||
| 151 | printf(" default_key_map_%d,\n", i); | ||
| 152 | } else { | ||
| 153 | printf(" NULL,\n"); | ||
| 154 | } | ||
| 155 | } | ||
| 156 | printf("};\n"); | ||
| 157 | } | ||
| 158 | #endif // DUMP_KEYMAP | ||
| 159 | |||
| 160 | static SDL_EVDEV_keyboard_state *kbd_cleanup_state = NULL; | ||
| 161 | static int kbd_cleanup_sigactions_installed = 0; | ||
| 162 | static int kbd_cleanup_atexit_installed = 0; | ||
| 163 | |||
| 164 | static struct sigaction old_sigaction[NSIG]; | ||
| 165 | |||
| 166 | static int fatal_signals[] = { | ||
| 167 | // Handlers for SIGTERM and SIGINT are installed in SDL_InitQuit. | ||
| 168 | SIGHUP, SIGQUIT, SIGILL, SIGABRT, | ||
| 169 | SIGFPE, SIGSEGV, SIGPIPE, SIGBUS, | ||
| 170 | SIGSYS | ||
| 171 | }; | ||
| 172 | |||
| 173 | static void kbd_cleanup(void) | ||
| 174 | { | ||
| 175 | SDL_EVDEV_keyboard_state *kbd = kbd_cleanup_state; | ||
| 176 | if (!kbd) { | ||
| 177 | return; | ||
| 178 | } | ||
| 179 | kbd_cleanup_state = NULL; | ||
| 180 | |||
| 181 | ioctl(kbd->console_fd, KDSKBMODE, kbd->old_kbd_mode); | ||
| 182 | } | ||
| 183 | |||
| 184 | static void SDL_EVDEV_kbd_reraise_signal(int sig) | ||
| 185 | { | ||
| 186 | (void)raise(sig); | ||
| 187 | } | ||
| 188 | |||
| 189 | static siginfo_t *SDL_EVDEV_kdb_cleanup_siginfo = NULL; | ||
| 190 | static void *SDL_EVDEV_kdb_cleanup_ucontext = NULL; | ||
| 191 | |||
| 192 | static void kbd_cleanup_signal_action(int signum, siginfo_t *info, void *ucontext) | ||
| 193 | { | ||
| 194 | struct sigaction *old_action_p = &(old_sigaction[signum]); | ||
| 195 | sigset_t sigset; | ||
| 196 | |||
| 197 | // Restore original signal handler before going any further. | ||
| 198 | sigaction(signum, old_action_p, NULL); | ||
| 199 | |||
| 200 | // Unmask current signal. | ||
| 201 | sigemptyset(&sigset); | ||
| 202 | sigaddset(&sigset, signum); | ||
| 203 | sigprocmask(SIG_UNBLOCK, &sigset, NULL); | ||
| 204 | |||
| 205 | // Save original signal info and context for archeologists. | ||
| 206 | SDL_EVDEV_kdb_cleanup_siginfo = info; | ||
| 207 | SDL_EVDEV_kdb_cleanup_ucontext = ucontext; | ||
| 208 | |||
| 209 | // Restore keyboard. | ||
| 210 | kbd_cleanup(); | ||
| 211 | |||
| 212 | // Reraise signal. | ||
| 213 | SDL_EVDEV_kbd_reraise_signal(signum); | ||
| 214 | } | ||
| 215 | |||
| 216 | static void kbd_unregister_emerg_cleanup(void) | ||
| 217 | { | ||
| 218 | int tabidx; | ||
| 219 | |||
| 220 | kbd_cleanup_state = NULL; | ||
| 221 | |||
| 222 | if (!kbd_cleanup_sigactions_installed) { | ||
| 223 | return; | ||
| 224 | } | ||
| 225 | kbd_cleanup_sigactions_installed = 0; | ||
| 226 | |||
| 227 | for (tabidx = 0; tabidx < sizeof(fatal_signals) / sizeof(fatal_signals[0]); ++tabidx) { | ||
| 228 | struct sigaction *old_action_p; | ||
| 229 | struct sigaction cur_action; | ||
| 230 | int signum = fatal_signals[tabidx]; | ||
| 231 | old_action_p = &(old_sigaction[signum]); | ||
| 232 | |||
| 233 | // Examine current signal action | ||
| 234 | if (sigaction(signum, NULL, &cur_action)) { | ||
| 235 | continue; | ||
| 236 | } | ||
| 237 | |||
| 238 | // Check if action installed and not modified | ||
| 239 | if (!(cur_action.sa_flags & SA_SIGINFO) || cur_action.sa_sigaction != &kbd_cleanup_signal_action) { | ||
| 240 | continue; | ||
| 241 | } | ||
| 242 | |||
| 243 | // Restore original action | ||
| 244 | sigaction(signum, old_action_p, NULL); | ||
| 245 | } | ||
| 246 | } | ||
| 247 | |||
| 248 | static void kbd_cleanup_atexit(void) | ||
| 249 | { | ||
| 250 | // Restore keyboard. | ||
| 251 | kbd_cleanup(); | ||
| 252 | |||
| 253 | // Try to restore signal handlers in case shared library is being unloaded | ||
| 254 | kbd_unregister_emerg_cleanup(); | ||
| 255 | } | ||
| 256 | |||
| 257 | static void kbd_register_emerg_cleanup(SDL_EVDEV_keyboard_state *kbd) | ||
| 258 | { | ||
| 259 | int tabidx; | ||
| 260 | |||
| 261 | if (kbd_cleanup_state) { | ||
| 262 | return; | ||
| 263 | } | ||
| 264 | kbd_cleanup_state = kbd; | ||
| 265 | |||
| 266 | if (!kbd_cleanup_atexit_installed) { | ||
| 267 | /* Since glibc 2.2.3, atexit() (and on_exit(3)) can be used within a shared library to establish | ||
| 268 | * functions that are called when the shared library is unloaded. | ||
| 269 | * -- man atexit(3) | ||
| 270 | */ | ||
| 271 | (void)atexit(kbd_cleanup_atexit); | ||
| 272 | kbd_cleanup_atexit_installed = 1; | ||
| 273 | } | ||
| 274 | |||
| 275 | if (kbd_cleanup_sigactions_installed) { | ||
| 276 | return; | ||
| 277 | } | ||
| 278 | kbd_cleanup_sigactions_installed = 1; | ||
| 279 | |||
| 280 | for (tabidx = 0; tabidx < sizeof(fatal_signals) / sizeof(fatal_signals[0]); ++tabidx) { | ||
| 281 | struct sigaction *old_action_p; | ||
| 282 | struct sigaction new_action; | ||
| 283 | int signum = fatal_signals[tabidx]; | ||
| 284 | old_action_p = &(old_sigaction[signum]); | ||
| 285 | if (sigaction(signum, NULL, old_action_p)) { | ||
| 286 | continue; | ||
| 287 | } | ||
| 288 | |||
| 289 | /* Skip SIGHUP and SIGPIPE if handler is already installed | ||
| 290 | * - assume the handler will do the cleanup | ||
| 291 | */ | ||
| 292 | if ((signum == SIGHUP || signum == SIGPIPE) && (old_action_p->sa_handler != SIG_DFL || (void (*)(int))old_action_p->sa_sigaction != SIG_DFL)) { | ||
| 293 | continue; | ||
| 294 | } | ||
| 295 | |||
| 296 | new_action = *old_action_p; | ||
| 297 | new_action.sa_flags |= SA_SIGINFO; | ||
| 298 | new_action.sa_sigaction = &kbd_cleanup_signal_action; | ||
| 299 | sigaction(signum, &new_action, NULL); | ||
| 300 | } | ||
| 301 | } | ||
| 302 | |||
| 303 | enum { | ||
| 304 | VT_SIGNAL_NONE, | ||
| 305 | VT_SIGNAL_RELEASE, | ||
| 306 | VT_SIGNAL_ACQUIRE, | ||
| 307 | }; | ||
| 308 | static int vt_release_signal; | ||
| 309 | static int vt_acquire_signal; | ||
| 310 | static SDL_AtomicInt vt_signal_pending; | ||
| 311 | |||
| 312 | typedef void (*signal_handler)(int signum); | ||
| 313 | |||
| 314 | static void kbd_vt_release_signal_action(int signum) | ||
| 315 | { | ||
| 316 | SDL_SetAtomicInt(&vt_signal_pending, VT_SIGNAL_RELEASE); | ||
| 317 | } | ||
| 318 | |||
| 319 | static void kbd_vt_acquire_signal_action(int signum) | ||
| 320 | { | ||
| 321 | SDL_SetAtomicInt(&vt_signal_pending, VT_SIGNAL_ACQUIRE); | ||
| 322 | } | ||
| 323 | |||
| 324 | static bool setup_vt_signal(int signum, signal_handler handler) | ||
| 325 | { | ||
| 326 | struct sigaction *old_action_p; | ||
| 327 | struct sigaction new_action; | ||
| 328 | old_action_p = &(old_sigaction[signum]); | ||
| 329 | SDL_zero(new_action); | ||
| 330 | new_action.sa_handler = handler; | ||
| 331 | new_action.sa_flags = SA_RESTART; | ||
| 332 | if (sigaction(signum, &new_action, old_action_p) < 0) { | ||
| 333 | return false; | ||
| 334 | } | ||
| 335 | if (old_action_p->sa_handler != SIG_DFL) { | ||
| 336 | // This signal is already in use | ||
| 337 | sigaction(signum, old_action_p, NULL); | ||
| 338 | return false; | ||
| 339 | } | ||
| 340 | return true; | ||
| 341 | } | ||
| 342 | |||
| 343 | static int find_free_signal(signal_handler handler) | ||
| 344 | { | ||
| 345 | #ifdef SIGRTMIN | ||
| 346 | int i; | ||
| 347 | |||
| 348 | for (i = SIGRTMIN + 2; i <= SIGRTMAX; ++i) { | ||
| 349 | if (setup_vt_signal(i, handler)) { | ||
| 350 | return i; | ||
| 351 | } | ||
| 352 | } | ||
| 353 | #endif | ||
| 354 | if (setup_vt_signal(SIGUSR1, handler)) { | ||
| 355 | return SIGUSR1; | ||
| 356 | } | ||
| 357 | if (setup_vt_signal(SIGUSR2, handler)) { | ||
| 358 | return SIGUSR2; | ||
| 359 | } | ||
| 360 | return 0; | ||
| 361 | } | ||
| 362 | |||
| 363 | static void kbd_vt_quit(int console_fd) | ||
| 364 | { | ||
| 365 | struct vt_mode mode; | ||
| 366 | |||
| 367 | if (vt_release_signal) { | ||
| 368 | sigaction(vt_release_signal, &old_sigaction[vt_release_signal], NULL); | ||
| 369 | vt_release_signal = 0; | ||
| 370 | } | ||
| 371 | if (vt_acquire_signal) { | ||
| 372 | sigaction(vt_acquire_signal, &old_sigaction[vt_acquire_signal], NULL); | ||
| 373 | vt_acquire_signal = 0; | ||
| 374 | } | ||
| 375 | |||
| 376 | SDL_zero(mode); | ||
| 377 | mode.mode = VT_AUTO; | ||
| 378 | ioctl(console_fd, VT_SETMODE, &mode); | ||
| 379 | } | ||
| 380 | |||
| 381 | static bool kbd_vt_init(int console_fd) | ||
| 382 | { | ||
| 383 | struct vt_mode mode; | ||
| 384 | |||
| 385 | vt_release_signal = find_free_signal(kbd_vt_release_signal_action); | ||
| 386 | vt_acquire_signal = find_free_signal(kbd_vt_acquire_signal_action); | ||
| 387 | if (!vt_release_signal || !vt_acquire_signal ) { | ||
| 388 | kbd_vt_quit(console_fd); | ||
| 389 | return false; | ||
| 390 | } | ||
| 391 | |||
| 392 | SDL_zero(mode); | ||
| 393 | mode.mode = VT_PROCESS; | ||
| 394 | mode.relsig = vt_release_signal; | ||
| 395 | mode.acqsig = vt_acquire_signal; | ||
| 396 | mode.frsig = SIGIO; | ||
| 397 | if (ioctl(console_fd, VT_SETMODE, &mode) < 0) { | ||
| 398 | kbd_vt_quit(console_fd); | ||
| 399 | return false; | ||
| 400 | } | ||
| 401 | return true; | ||
| 402 | } | ||
| 403 | |||
| 404 | static void kbd_vt_update(SDL_EVDEV_keyboard_state *state) | ||
| 405 | { | ||
| 406 | int signal_pending = SDL_GetAtomicInt(&vt_signal_pending); | ||
| 407 | if (signal_pending != VT_SIGNAL_NONE) { | ||
| 408 | if (signal_pending == VT_SIGNAL_RELEASE) { | ||
| 409 | if (state->vt_release_callback) { | ||
| 410 | state->vt_release_callback(state->vt_release_callback_data); | ||
| 411 | } | ||
| 412 | ioctl(state->console_fd, VT_RELDISP, 1); | ||
| 413 | } else { | ||
| 414 | if (state->vt_acquire_callback) { | ||
| 415 | state->vt_acquire_callback(state->vt_acquire_callback_data); | ||
| 416 | } | ||
| 417 | ioctl(state->console_fd, VT_RELDISP, VT_ACKACQ); | ||
| 418 | } | ||
| 419 | SDL_CompareAndSwapAtomicInt(&vt_signal_pending, signal_pending, VT_SIGNAL_NONE); | ||
| 420 | } | ||
| 421 | } | ||
| 422 | |||
| 423 | SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void) | ||
| 424 | { | ||
| 425 | SDL_EVDEV_keyboard_state *kbd; | ||
| 426 | char flag_state; | ||
| 427 | char kbtype; | ||
| 428 | char shift_state[sizeof(long)] = { TIOCL_GETSHIFTSTATE, 0 }; | ||
| 429 | |||
| 430 | kbd = (SDL_EVDEV_keyboard_state *)SDL_calloc(1, sizeof(*kbd)); | ||
| 431 | if (!kbd) { | ||
| 432 | return NULL; | ||
| 433 | } | ||
| 434 | |||
| 435 | // This might fail if we're not connected to a tty (e.g. on the Steam Link) | ||
| 436 | kbd->console_fd = open("/dev/tty", O_RDONLY | O_CLOEXEC); | ||
| 437 | if (!((ioctl(kbd->console_fd, KDGKBTYPE, &kbtype) == 0) && ((kbtype == KB_101) || (kbtype == KB_84)))) { | ||
| 438 | close(kbd->console_fd); | ||
| 439 | kbd->console_fd = -1; | ||
| 440 | } | ||
| 441 | |||
| 442 | kbd->npadch = -1; | ||
| 443 | |||
| 444 | if (ioctl(kbd->console_fd, TIOCLINUX, shift_state) == 0) { | ||
| 445 | kbd->shift_state = *shift_state; | ||
| 446 | } | ||
| 447 | |||
| 448 | if (ioctl(kbd->console_fd, KDGKBLED, &flag_state) == 0) { | ||
| 449 | kbd->ledflagstate = flag_state; | ||
| 450 | } | ||
| 451 | |||
| 452 | kbd->accents = &default_accents; | ||
| 453 | kbd->key_maps = default_key_maps; | ||
| 454 | |||
| 455 | if (ioctl(kbd->console_fd, KDGKBMODE, &kbd->old_kbd_mode) == 0) { | ||
| 456 | // Set the keyboard in UNICODE mode and load the keymaps | ||
| 457 | ioctl(kbd->console_fd, KDSKBMODE, K_UNICODE); | ||
| 458 | } | ||
| 459 | |||
| 460 | kbd_vt_init(kbd->console_fd); | ||
| 461 | |||
| 462 | return kbd; | ||
| 463 | } | ||
| 464 | |||
| 465 | void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, bool muted) | ||
| 466 | { | ||
| 467 | if (!state) { | ||
| 468 | return; | ||
| 469 | } | ||
| 470 | |||
| 471 | if (muted == state->muted) { | ||
| 472 | return; | ||
| 473 | } | ||
| 474 | |||
| 475 | if (muted) { | ||
| 476 | if (SDL_GetHintBoolean(SDL_HINT_MUTE_CONSOLE_KEYBOARD, true)) { | ||
| 477 | /* Mute the keyboard so keystrokes only generate evdev events | ||
| 478 | * and do not leak through to the console | ||
| 479 | */ | ||
| 480 | ioctl(state->console_fd, KDSKBMODE, K_OFF); | ||
| 481 | |||
| 482 | /* Make sure to restore keyboard if application fails to call | ||
| 483 | * SDL_Quit before exit or fatal signal is raised. | ||
| 484 | */ | ||
| 485 | if (!SDL_GetHintBoolean(SDL_HINT_NO_SIGNAL_HANDLERS, false)) { | ||
| 486 | kbd_register_emerg_cleanup(state); | ||
| 487 | } | ||
| 488 | } | ||
| 489 | } else { | ||
| 490 | kbd_unregister_emerg_cleanup(); | ||
| 491 | |||
| 492 | // Restore the original keyboard mode | ||
| 493 | ioctl(state->console_fd, KDSKBMODE, state->old_kbd_mode); | ||
| 494 | } | ||
| 495 | state->muted = muted; | ||
| 496 | } | ||
| 497 | |||
| 498 | void SDL_EVDEV_kbd_set_vt_switch_callbacks(SDL_EVDEV_keyboard_state *state, void (*release_callback)(void*), void *release_callback_data, void (*acquire_callback)(void*), void *acquire_callback_data) | ||
| 499 | { | ||
| 500 | if (state == NULL) { | ||
| 501 | return; | ||
| 502 | } | ||
| 503 | |||
| 504 | state->vt_release_callback = release_callback; | ||
| 505 | state->vt_release_callback_data = release_callback_data; | ||
| 506 | state->vt_acquire_callback = acquire_callback; | ||
| 507 | state->vt_acquire_callback_data = acquire_callback_data; | ||
| 508 | } | ||
| 509 | |||
| 510 | void SDL_EVDEV_kbd_update(SDL_EVDEV_keyboard_state *state) | ||
| 511 | { | ||
| 512 | if (!state) { | ||
| 513 | return; | ||
| 514 | } | ||
| 515 | |||
| 516 | kbd_vt_update(state); | ||
| 517 | } | ||
| 518 | |||
| 519 | void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state) | ||
| 520 | { | ||
| 521 | if (state == NULL) { | ||
| 522 | return; | ||
| 523 | } | ||
| 524 | |||
| 525 | SDL_EVDEV_kbd_set_muted(state, false); | ||
| 526 | |||
| 527 | kbd_vt_quit(state->console_fd); | ||
| 528 | |||
| 529 | if (state->console_fd >= 0) { | ||
| 530 | close(state->console_fd); | ||
| 531 | state->console_fd = -1; | ||
| 532 | } | ||
| 533 | |||
| 534 | if (state->key_maps && state->key_maps != default_key_maps) { | ||
| 535 | int i; | ||
| 536 | for (i = 0; i < MAX_NR_KEYMAPS; ++i) { | ||
| 537 | if (state->key_maps[i]) { | ||
| 538 | SDL_free(state->key_maps[i]); | ||
| 539 | } | ||
| 540 | } | ||
| 541 | SDL_free(state->key_maps); | ||
| 542 | } | ||
| 543 | |||
| 544 | SDL_free(state); | ||
| 545 | } | ||
| 546 | |||
| 547 | /* | ||
| 548 | * Helper Functions. | ||
| 549 | */ | ||
| 550 | static void put_queue(SDL_EVDEV_keyboard_state *kbd, uint c) | ||
| 551 | { | ||
| 552 | // c is already part of a UTF-8 sequence and safe to add as a character | ||
| 553 | if (kbd->text_len < (sizeof(kbd->text) - 1)) { | ||
| 554 | kbd->text[kbd->text_len++] = (char)c; | ||
| 555 | } | ||
| 556 | } | ||
| 557 | |||
| 558 | static void put_utf8(SDL_EVDEV_keyboard_state *kbd, uint c) | ||
| 559 | { | ||
| 560 | if (c < 0x80) { | ||
| 561 | put_queue(kbd, c); /* 0******* */ | ||
| 562 | } else if (c < 0x800) { | ||
| 563 | /* 110***** 10****** */ | ||
| 564 | put_queue(kbd, 0xc0 | (c >> 6)); | ||
| 565 | put_queue(kbd, 0x80 | (c & 0x3f)); | ||
| 566 | } else if (c < 0x10000) { | ||
| 567 | if (c >= 0xD800 && c < 0xE000) { | ||
| 568 | return; | ||
| 569 | } | ||
| 570 | if (c == 0xFFFF) { | ||
| 571 | return; | ||
| 572 | } | ||
| 573 | /* 1110**** 10****** 10****** */ | ||
| 574 | put_queue(kbd, 0xe0 | (c >> 12)); | ||
| 575 | put_queue(kbd, 0x80 | ((c >> 6) & 0x3f)); | ||
| 576 | put_queue(kbd, 0x80 | (c & 0x3f)); | ||
| 577 | } else if (c < 0x110000) { | ||
| 578 | /* 11110*** 10****** 10****** 10****** */ | ||
| 579 | put_queue(kbd, 0xf0 | (c >> 18)); | ||
| 580 | put_queue(kbd, 0x80 | ((c >> 12) & 0x3f)); | ||
| 581 | put_queue(kbd, 0x80 | ((c >> 6) & 0x3f)); | ||
| 582 | put_queue(kbd, 0x80 | (c & 0x3f)); | ||
| 583 | } | ||
| 584 | } | ||
| 585 | |||
| 586 | /* | ||
| 587 | * We have a combining character DIACR here, followed by the character CH. | ||
| 588 | * If the combination occurs in the table, return the corresponding value. | ||
| 589 | * Otherwise, if CH is a space or equals DIACR, return DIACR. | ||
| 590 | * Otherwise, conclude that DIACR was not combining after all, | ||
| 591 | * queue it and return CH. | ||
| 592 | */ | ||
| 593 | static unsigned int handle_diacr(SDL_EVDEV_keyboard_state *kbd, unsigned int ch) | ||
| 594 | { | ||
| 595 | unsigned int d = kbd->diacr; | ||
| 596 | unsigned int i; | ||
| 597 | |||
| 598 | kbd->diacr = 0; | ||
| 599 | |||
| 600 | if (kbd->console_fd >= 0) | ||
| 601 | if (ioctl(kbd->console_fd, KDGKBDIACR, kbd->accents) < 0) { | ||
| 602 | // No worries, we'll use the default accent table | ||
| 603 | } | ||
| 604 | |||
| 605 | for (i = 0; i < kbd->accents->kb_cnt; i++) { | ||
| 606 | if (kbd->accents->kbdiacr[i].diacr == d && | ||
| 607 | kbd->accents->kbdiacr[i].base == ch) { | ||
| 608 | return kbd->accents->kbdiacr[i].result; | ||
| 609 | } | ||
| 610 | } | ||
| 611 | |||
| 612 | if (ch == ' ' || ch == d) { | ||
| 613 | return d; | ||
| 614 | } | ||
| 615 | |||
| 616 | put_utf8(kbd, d); | ||
| 617 | |||
| 618 | return ch; | ||
| 619 | } | ||
| 620 | |||
| 621 | static bool vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) | ||
| 622 | { | ||
| 623 | return (kbd->ledflagstate & flag) != 0; | ||
| 624 | } | ||
| 625 | |||
| 626 | static void set_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) | ||
| 627 | { | ||
| 628 | kbd->ledflagstate |= flag; | ||
| 629 | ioctl(kbd->console_fd, KDSETLED, (unsigned long)(kbd->ledflagstate)); | ||
| 630 | } | ||
| 631 | |||
| 632 | static void clr_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) | ||
| 633 | { | ||
| 634 | kbd->ledflagstate &= ~flag; | ||
| 635 | ioctl(kbd->console_fd, KDSETLED, (unsigned long)(kbd->ledflagstate)); | ||
| 636 | } | ||
| 637 | |||
| 638 | static void chg_vc_kbd_lock(SDL_EVDEV_keyboard_state *kbd, int flag) | ||
| 639 | { | ||
| 640 | kbd->lockstate ^= 1 << flag; | ||
| 641 | } | ||
| 642 | |||
| 643 | static void chg_vc_kbd_slock(SDL_EVDEV_keyboard_state *kbd, int flag) | ||
| 644 | { | ||
| 645 | kbd->slockstate ^= 1 << flag; | ||
| 646 | } | ||
| 647 | |||
| 648 | static void chg_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) | ||
| 649 | { | ||
| 650 | kbd->ledflagstate ^= flag; | ||
| 651 | ioctl(kbd->console_fd, KDSETLED, (unsigned long)(kbd->ledflagstate)); | ||
| 652 | } | ||
| 653 | |||
| 654 | /* | ||
| 655 | * Special function handlers | ||
| 656 | */ | ||
| 657 | |||
| 658 | static void fn_enter(SDL_EVDEV_keyboard_state *kbd) | ||
| 659 | { | ||
| 660 | if (kbd->diacr) { | ||
| 661 | put_utf8(kbd, kbd->diacr); | ||
| 662 | kbd->diacr = 0; | ||
| 663 | } | ||
| 664 | } | ||
| 665 | |||
| 666 | static void fn_caps_toggle(SDL_EVDEV_keyboard_state *kbd) | ||
| 667 | { | ||
| 668 | if (kbd->rep) { | ||
| 669 | return; | ||
| 670 | } | ||
| 671 | |||
| 672 | chg_vc_kbd_led(kbd, K_CAPSLOCK); | ||
| 673 | } | ||
| 674 | |||
| 675 | static void fn_caps_on(SDL_EVDEV_keyboard_state *kbd) | ||
| 676 | { | ||
| 677 | if (kbd->rep) { | ||
| 678 | return; | ||
| 679 | } | ||
| 680 | |||
| 681 | set_vc_kbd_led(kbd, K_CAPSLOCK); | ||
| 682 | } | ||
| 683 | |||
| 684 | static void fn_num(SDL_EVDEV_keyboard_state *kbd) | ||
| 685 | { | ||
| 686 | if (!kbd->rep) { | ||
| 687 | chg_vc_kbd_led(kbd, K_NUMLOCK); | ||
| 688 | } | ||
| 689 | } | ||
| 690 | |||
| 691 | static void fn_compose(SDL_EVDEV_keyboard_state *kbd) | ||
| 692 | { | ||
| 693 | kbd->dead_key_next = true; | ||
| 694 | } | ||
| 695 | |||
| 696 | /* | ||
| 697 | * Special key handlers | ||
| 698 | */ | ||
| 699 | |||
| 700 | static void k_ignore(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) | ||
| 701 | { | ||
| 702 | } | ||
| 703 | |||
| 704 | static void k_spec(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) | ||
| 705 | { | ||
| 706 | if (up_flag) { | ||
| 707 | return; | ||
| 708 | } | ||
| 709 | if (value >= SDL_arraysize(fn_handler)) { | ||
| 710 | return; | ||
| 711 | } | ||
| 712 | if (fn_handler[value]) { | ||
| 713 | fn_handler[value](kbd); | ||
| 714 | } | ||
| 715 | } | ||
| 716 | |||
| 717 | static void k_lowercase(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) | ||
| 718 | { | ||
| 719 | } | ||
| 720 | |||
| 721 | static void k_self(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) | ||
| 722 | { | ||
| 723 | if (up_flag) { | ||
| 724 | return; // no action, if this is a key release | ||
| 725 | } | ||
| 726 | |||
| 727 | if (kbd->diacr) { | ||
| 728 | value = handle_diacr(kbd, value); | ||
| 729 | } | ||
| 730 | |||
| 731 | if (kbd->dead_key_next) { | ||
| 732 | kbd->dead_key_next = false; | ||
| 733 | kbd->diacr = value; | ||
| 734 | return; | ||
| 735 | } | ||
| 736 | put_utf8(kbd, value); | ||
| 737 | } | ||
| 738 | |||
| 739 | static void k_deadunicode(SDL_EVDEV_keyboard_state *kbd, unsigned int value, char up_flag) | ||
| 740 | { | ||
| 741 | if (up_flag) { | ||
| 742 | return; | ||
| 743 | } | ||
| 744 | |||
| 745 | kbd->diacr = (kbd->diacr ? handle_diacr(kbd, value) : value); | ||
| 746 | } | ||
| 747 | |||
| 748 | static void k_dead(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) | ||
| 749 | { | ||
| 750 | const unsigned char ret_diacr[NR_DEAD] = { '`', '\'', '^', '~', '"', ',' }; | ||
| 751 | |||
| 752 | k_deadunicode(kbd, ret_diacr[value], up_flag); | ||
| 753 | } | ||
| 754 | |||
| 755 | static void k_dead2(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) | ||
| 756 | { | ||
| 757 | k_deadunicode(kbd, value, up_flag); | ||
| 758 | } | ||
| 759 | |||
| 760 | static void k_cons(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) | ||
| 761 | { | ||
| 762 | } | ||
| 763 | |||
| 764 | static void k_fn(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) | ||
| 765 | { | ||
| 766 | } | ||
| 767 | |||
| 768 | static void k_cur(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) | ||
| 769 | { | ||
| 770 | } | ||
| 771 | |||
| 772 | static void k_pad(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) | ||
| 773 | { | ||
| 774 | static const char pad_chars[] = "0123456789+-*/\015,.?()#"; | ||
| 775 | |||
| 776 | if (up_flag) { | ||
| 777 | return; // no action, if this is a key release | ||
| 778 | } | ||
| 779 | |||
| 780 | if (!vc_kbd_led(kbd, K_NUMLOCK)) { | ||
| 781 | // unprintable action | ||
| 782 | return; | ||
| 783 | } | ||
| 784 | |||
| 785 | put_queue(kbd, pad_chars[value]); | ||
| 786 | } | ||
| 787 | |||
| 788 | static void k_shift(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) | ||
| 789 | { | ||
| 790 | int old_state = kbd->shift_state; | ||
| 791 | |||
| 792 | if (kbd->rep) { | ||
| 793 | return; | ||
| 794 | } | ||
| 795 | /* | ||
| 796 | * Mimic typewriter: | ||
| 797 | * a CapsShift key acts like Shift but undoes CapsLock | ||
| 798 | */ | ||
| 799 | if (value == KVAL(K_CAPSSHIFT)) { | ||
| 800 | value = KVAL(K_SHIFT); | ||
| 801 | if (!up_flag) { | ||
| 802 | clr_vc_kbd_led(kbd, K_CAPSLOCK); | ||
| 803 | } | ||
| 804 | } | ||
| 805 | |||
| 806 | if (up_flag) { | ||
| 807 | /* | ||
| 808 | * handle the case that two shift or control | ||
| 809 | * keys are depressed simultaneously | ||
| 810 | */ | ||
| 811 | if (kbd->shift_down[value]) { | ||
| 812 | kbd->shift_down[value]--; | ||
| 813 | } | ||
| 814 | } else { | ||
| 815 | kbd->shift_down[value]++; | ||
| 816 | } | ||
| 817 | |||
| 818 | if (kbd->shift_down[value]) { | ||
| 819 | kbd->shift_state |= (1 << value); | ||
| 820 | } else { | ||
| 821 | kbd->shift_state &= ~(1 << value); | ||
| 822 | } | ||
| 823 | |||
| 824 | // kludge | ||
| 825 | if (up_flag && kbd->shift_state != old_state && kbd->npadch != -1) { | ||
| 826 | put_utf8(kbd, kbd->npadch); | ||
| 827 | kbd->npadch = -1; | ||
| 828 | } | ||
| 829 | } | ||
| 830 | |||
| 831 | static void k_meta(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) | ||
| 832 | { | ||
| 833 | } | ||
| 834 | |||
| 835 | static void k_ascii(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) | ||
| 836 | { | ||
| 837 | int base; | ||
| 838 | |||
| 839 | if (up_flag) { | ||
| 840 | return; | ||
| 841 | } | ||
| 842 | |||
| 843 | if (value < 10) { | ||
| 844 | // decimal input of code, while Alt depressed | ||
| 845 | base = 10; | ||
| 846 | } else { | ||
| 847 | // hexadecimal input of code, while AltGr depressed | ||
| 848 | value -= 10; | ||
| 849 | base = 16; | ||
| 850 | } | ||
| 851 | |||
| 852 | if (kbd->npadch == -1) { | ||
| 853 | kbd->npadch = value; | ||
| 854 | } else { | ||
| 855 | kbd->npadch = kbd->npadch * base + value; | ||
| 856 | } | ||
| 857 | } | ||
| 858 | |||
| 859 | static void k_lock(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) | ||
| 860 | { | ||
| 861 | if (up_flag || kbd->rep) { | ||
| 862 | return; | ||
| 863 | } | ||
| 864 | |||
| 865 | chg_vc_kbd_lock(kbd, value); | ||
| 866 | } | ||
| 867 | |||
| 868 | static void k_slock(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) | ||
| 869 | { | ||
| 870 | k_shift(kbd, value, up_flag); | ||
| 871 | if (up_flag || kbd->rep) { | ||
| 872 | return; | ||
| 873 | } | ||
| 874 | |||
| 875 | chg_vc_kbd_slock(kbd, value); | ||
| 876 | // try to make Alt, oops, AltGr and such work | ||
| 877 | if (!kbd->key_maps[kbd->lockstate ^ kbd->slockstate]) { | ||
| 878 | kbd->slockstate = 0; | ||
| 879 | chg_vc_kbd_slock(kbd, value); | ||
| 880 | } | ||
| 881 | } | ||
| 882 | |||
| 883 | static void k_brl(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) | ||
| 884 | { | ||
| 885 | } | ||
| 886 | |||
| 887 | void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode, int down) | ||
| 888 | { | ||
| 889 | unsigned char shift_final; | ||
| 890 | unsigned char type; | ||
| 891 | unsigned short *key_map; | ||
| 892 | unsigned short keysym; | ||
| 893 | |||
| 894 | if (!state) { | ||
| 895 | return; | ||
| 896 | } | ||
| 897 | |||
| 898 | state->rep = (down == 2); | ||
| 899 | |||
| 900 | shift_final = (state->shift_state | state->slockstate) ^ state->lockstate; | ||
| 901 | key_map = state->key_maps[shift_final]; | ||
| 902 | if (!key_map) { | ||
| 903 | // Unsupported shift state (e.g. ctrl = 4, alt = 8), just reset to the default state | ||
| 904 | state->shift_state = 0; | ||
| 905 | state->slockstate = 0; | ||
| 906 | state->lockstate = 0; | ||
| 907 | return; | ||
| 908 | } | ||
| 909 | |||
| 910 | if (keycode < NR_KEYS) { | ||
| 911 | if (state->console_fd < 0) { | ||
| 912 | keysym = key_map[keycode]; | ||
| 913 | } else { | ||
| 914 | struct kbentry kbe; | ||
| 915 | kbe.kb_table = shift_final; | ||
| 916 | kbe.kb_index = keycode; | ||
| 917 | if (ioctl(state->console_fd, KDGKBENT, &kbe) == 0) | ||
| 918 | keysym = (kbe.kb_value ^ 0xf000); | ||
| 919 | else | ||
| 920 | return; | ||
| 921 | } | ||
| 922 | } else { | ||
| 923 | return; | ||
| 924 | } | ||
| 925 | |||
| 926 | type = KTYP(keysym); | ||
| 927 | |||
| 928 | if (type < 0xf0) { | ||
| 929 | if (down) { | ||
| 930 | put_utf8(state, keysym); | ||
| 931 | } | ||
| 932 | } else { | ||
| 933 | type -= 0xf0; | ||
| 934 | |||
| 935 | // if type is KT_LETTER then it can be affected by Caps Lock | ||
| 936 | if (type == KT_LETTER) { | ||
| 937 | type = KT_LATIN; | ||
| 938 | |||
| 939 | if (vc_kbd_led(state, K_CAPSLOCK)) { | ||
| 940 | shift_final = shift_final ^ (1 << KG_SHIFT); | ||
| 941 | key_map = state->key_maps[shift_final]; | ||
| 942 | if (key_map) { | ||
| 943 | if (state->console_fd < 0) { | ||
| 944 | keysym = key_map[keycode]; | ||
| 945 | } else { | ||
| 946 | struct kbentry kbe; | ||
| 947 | kbe.kb_table = shift_final; | ||
| 948 | kbe.kb_index = keycode; | ||
| 949 | if (ioctl(state->console_fd, KDGKBENT, &kbe) == 0) | ||
| 950 | keysym = (kbe.kb_value ^ 0xf000); | ||
| 951 | } | ||
| 952 | } | ||
| 953 | } | ||
| 954 | } | ||
| 955 | |||
| 956 | (*k_handler[type])(state, keysym & 0xff, !down); | ||
| 957 | |||
| 958 | if (type != KT_SLOCK) { | ||
| 959 | state->slockstate = 0; | ||
| 960 | } | ||
| 961 | } | ||
| 962 | |||
| 963 | if (state->text_len > 0) { | ||
| 964 | state->text[state->text_len] = '\0'; | ||
| 965 | SDL_SendKeyboardText(state->text); | ||
| 966 | state->text_len = 0; | ||
| 967 | } | ||
| 968 | } | ||
| 969 | |||
| 970 | #elif !defined(SDL_INPUT_FBSDKBIO) // !SDL_INPUT_LINUXKD | ||
| 971 | |||
| 972 | SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void) | ||
| 973 | { | ||
| 974 | return NULL; | ||
| 975 | } | ||
| 976 | |||
| 977 | void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, bool muted) | ||
| 978 | { | ||
| 979 | } | ||
| 980 | |||
| 981 | void SDL_EVDEV_kbd_set_vt_switch_callbacks(SDL_EVDEV_keyboard_state *state, void (*release_callback)(void*), void *release_callback_data, void (*acquire_callback)(void*), void *acquire_callback_data) | ||
| 982 | { | ||
| 983 | } | ||
| 984 | |||
| 985 | void SDL_EVDEV_kbd_update(SDL_EVDEV_keyboard_state *state) | ||
| 986 | { | ||
| 987 | } | ||
| 988 | |||
| 989 | void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode, int down) | ||
| 990 | { | ||
| 991 | } | ||
| 992 | |||
| 993 | void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state) | ||
| 994 | { | ||
| 995 | } | ||
| 996 | |||
| 997 | #endif // SDL_INPUT_LINUXKD | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_evdev_kbd.h b/contrib/SDL-3.2.8/src/core/linux/SDL_evdev_kbd.h new file mode 100644 index 0000000..6ea19fb --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_evdev_kbd.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #ifndef SDL_evdev_kbd_h_ | ||
| 23 | #define SDL_evdev_kbd_h_ | ||
| 24 | |||
| 25 | struct SDL_EVDEV_keyboard_state; | ||
| 26 | typedef struct SDL_EVDEV_keyboard_state SDL_EVDEV_keyboard_state; | ||
| 27 | |||
| 28 | extern SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void); | ||
| 29 | extern void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, bool muted); | ||
| 30 | extern void SDL_EVDEV_kbd_set_vt_switch_callbacks(SDL_EVDEV_keyboard_state *state, void (*release_callback)(void*), void *release_callback_data, void (*acquire_callback)(void*), void *acquire_callback_data); | ||
| 31 | extern void SDL_EVDEV_kbd_update(SDL_EVDEV_keyboard_state *state); | ||
| 32 | extern void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode, int down); | ||
| 33 | extern void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state); | ||
| 34 | |||
| 35 | #endif // SDL_evdev_kbd_h_ | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_evdev_kbd_default_accents.h b/contrib/SDL-3.2.8/src/core/linux/SDL_evdev_kbd_default_accents.h new file mode 100644 index 0000000..b6d034c --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_evdev_kbd_default_accents.h | |||
| @@ -0,0 +1,282 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | static struct kbdiacrs default_accents = { | ||
| 23 | 68, | ||
| 24 | { | ||
| 25 | { 0x60, 0x41, 0xc0 }, | ||
| 26 | { 0x60, 0x61, 0xe0 }, | ||
| 27 | { 0x27, 0x41, 0xc1 }, | ||
| 28 | { 0x27, 0x61, 0xe1 }, | ||
| 29 | { 0x5e, 0x41, 0xc2 }, | ||
| 30 | { 0x5e, 0x61, 0xe2 }, | ||
| 31 | { 0x7e, 0x41, 0xc3 }, | ||
| 32 | { 0x7e, 0x61, 0xe3 }, | ||
| 33 | { 0x22, 0x41, 0xc4 }, | ||
| 34 | { 0x22, 0x61, 0xe4 }, | ||
| 35 | { 0x4f, 0x41, 0xc5 }, | ||
| 36 | { 0x6f, 0x61, 0xe5 }, | ||
| 37 | { 0x30, 0x41, 0xc5 }, | ||
| 38 | { 0x30, 0x61, 0xe5 }, | ||
| 39 | { 0x41, 0x41, 0xc5 }, | ||
| 40 | { 0x61, 0x61, 0xe5 }, | ||
| 41 | { 0x41, 0x45, 0xc6 }, | ||
| 42 | { 0x61, 0x65, 0xe6 }, | ||
| 43 | { 0x2c, 0x43, 0xc7 }, | ||
| 44 | { 0x2c, 0x63, 0xe7 }, | ||
| 45 | { 0x60, 0x45, 0xc8 }, | ||
| 46 | { 0x60, 0x65, 0xe8 }, | ||
| 47 | { 0x27, 0x45, 0xc9 }, | ||
| 48 | { 0x27, 0x65, 0xe9 }, | ||
| 49 | { 0x5e, 0x45, 0xca }, | ||
| 50 | { 0x5e, 0x65, 0xea }, | ||
| 51 | { 0x22, 0x45, 0xcb }, | ||
| 52 | { 0x22, 0x65, 0xeb }, | ||
| 53 | { 0x60, 0x49, 0xcc }, | ||
| 54 | { 0x60, 0x69, 0xec }, | ||
| 55 | { 0x27, 0x49, 0xcd }, | ||
| 56 | { 0x27, 0x69, 0xed }, | ||
| 57 | { 0x5e, 0x49, 0xce }, | ||
| 58 | { 0x5e, 0x69, 0xee }, | ||
| 59 | { 0x22, 0x49, 0xcf }, | ||
| 60 | { 0x22, 0x69, 0xef }, | ||
| 61 | { 0x2d, 0x44, 0xd0 }, | ||
| 62 | { 0x2d, 0x64, 0xf0 }, | ||
| 63 | { 0x7e, 0x4e, 0xd1 }, | ||
| 64 | { 0x7e, 0x6e, 0xf1 }, | ||
| 65 | { 0x60, 0x4f, 0xd2 }, | ||
| 66 | { 0x60, 0x6f, 0xf2 }, | ||
| 67 | { 0x27, 0x4f, 0xd3 }, | ||
| 68 | { 0x27, 0x6f, 0xf3 }, | ||
| 69 | { 0x5e, 0x4f, 0xd4 }, | ||
| 70 | { 0x5e, 0x6f, 0xf4 }, | ||
| 71 | { 0x7e, 0x4f, 0xd5 }, | ||
| 72 | { 0x7e, 0x6f, 0xf5 }, | ||
| 73 | { 0x22, 0x4f, 0xd6 }, | ||
| 74 | { 0x22, 0x6f, 0xf6 }, | ||
| 75 | { 0x2f, 0x4f, 0xd8 }, | ||
| 76 | { 0x2f, 0x6f, 0xf8 }, | ||
| 77 | { 0x60, 0x55, 0xd9 }, | ||
| 78 | { 0x60, 0x75, 0xf9 }, | ||
| 79 | { 0x27, 0x55, 0xda }, | ||
| 80 | { 0x27, 0x75, 0xfa }, | ||
| 81 | { 0x5e, 0x55, 0xdb }, | ||
| 82 | { 0x5e, 0x75, 0xfb }, | ||
| 83 | { 0x22, 0x55, 0xdc }, | ||
| 84 | { 0x22, 0x75, 0xfc }, | ||
| 85 | { 0x27, 0x59, 0xdd }, | ||
| 86 | { 0x27, 0x79, 0xfd }, | ||
| 87 | { 0x54, 0x48, 0xde }, | ||
| 88 | { 0x74, 0x68, 0xfe }, | ||
| 89 | { 0x73, 0x73, 0xdf }, | ||
| 90 | { 0x22, 0x79, 0xff }, | ||
| 91 | { 0x73, 0x7a, 0xdf }, | ||
| 92 | { 0x69, 0x6a, 0xff }, | ||
| 93 | { 0x00, 0x00, 0x00 }, | ||
| 94 | { 0x00, 0x00, 0x00 }, | ||
| 95 | { 0x00, 0x00, 0x00 }, | ||
| 96 | { 0x00, 0x00, 0x00 }, | ||
| 97 | { 0x00, 0x00, 0x00 }, | ||
| 98 | { 0x00, 0x00, 0x00 }, | ||
| 99 | { 0x00, 0x00, 0x00 }, | ||
| 100 | { 0x00, 0x00, 0x00 }, | ||
| 101 | { 0x00, 0x00, 0x00 }, | ||
| 102 | { 0x00, 0x00, 0x00 }, | ||
| 103 | { 0x00, 0x00, 0x00 }, | ||
| 104 | { 0x00, 0x00, 0x00 }, | ||
| 105 | { 0x00, 0x00, 0x00 }, | ||
| 106 | { 0x00, 0x00, 0x00 }, | ||
| 107 | { 0x00, 0x00, 0x00 }, | ||
| 108 | { 0x00, 0x00, 0x00 }, | ||
| 109 | { 0x00, 0x00, 0x00 }, | ||
| 110 | { 0x00, 0x00, 0x00 }, | ||
| 111 | { 0x00, 0x00, 0x00 }, | ||
| 112 | { 0x00, 0x00, 0x00 }, | ||
| 113 | { 0x00, 0x00, 0x00 }, | ||
| 114 | { 0x00, 0x00, 0x00 }, | ||
| 115 | { 0x00, 0x00, 0x00 }, | ||
| 116 | { 0x00, 0x00, 0x00 }, | ||
| 117 | { 0x00, 0x00, 0x00 }, | ||
| 118 | { 0x00, 0x00, 0x00 }, | ||
| 119 | { 0x00, 0x00, 0x00 }, | ||
| 120 | { 0x00, 0x00, 0x00 }, | ||
| 121 | { 0x00, 0x00, 0x00 }, | ||
| 122 | { 0x00, 0x00, 0x00 }, | ||
| 123 | { 0x00, 0x00, 0x00 }, | ||
| 124 | { 0x00, 0x00, 0x00 }, | ||
| 125 | { 0x00, 0x00, 0x00 }, | ||
| 126 | { 0x00, 0x00, 0x00 }, | ||
| 127 | { 0x00, 0x00, 0x00 }, | ||
| 128 | { 0x00, 0x00, 0x00 }, | ||
| 129 | { 0x00, 0x00, 0x00 }, | ||
| 130 | { 0x00, 0x00, 0x00 }, | ||
| 131 | { 0x00, 0x00, 0x00 }, | ||
| 132 | { 0x00, 0x00, 0x00 }, | ||
| 133 | { 0x00, 0x00, 0x00 }, | ||
| 134 | { 0x00, 0x00, 0x00 }, | ||
| 135 | { 0x00, 0x00, 0x00 }, | ||
| 136 | { 0x00, 0x00, 0x00 }, | ||
| 137 | { 0x00, 0x00, 0x00 }, | ||
| 138 | { 0x00, 0x00, 0x00 }, | ||
| 139 | { 0x00, 0x00, 0x00 }, | ||
| 140 | { 0x00, 0x00, 0x00 }, | ||
| 141 | { 0x00, 0x00, 0x00 }, | ||
| 142 | { 0x00, 0x00, 0x00 }, | ||
| 143 | { 0x00, 0x00, 0x00 }, | ||
| 144 | { 0x00, 0x00, 0x00 }, | ||
| 145 | { 0x00, 0x00, 0x00 }, | ||
| 146 | { 0x00, 0x00, 0x00 }, | ||
| 147 | { 0x00, 0x00, 0x00 }, | ||
| 148 | { 0x00, 0x00, 0x00 }, | ||
| 149 | { 0x00, 0x00, 0x00 }, | ||
| 150 | { 0x00, 0x00, 0x00 }, | ||
| 151 | { 0x00, 0x00, 0x00 }, | ||
| 152 | { 0x00, 0x00, 0x00 }, | ||
| 153 | { 0x00, 0x00, 0x00 }, | ||
| 154 | { 0x00, 0x00, 0x00 }, | ||
| 155 | { 0x00, 0x00, 0x00 }, | ||
| 156 | { 0x00, 0x00, 0x00 }, | ||
| 157 | { 0x00, 0x00, 0x00 }, | ||
| 158 | { 0x00, 0x00, 0x00 }, | ||
| 159 | { 0x00, 0x00, 0x00 }, | ||
| 160 | { 0x00, 0x00, 0x00 }, | ||
| 161 | { 0x00, 0x00, 0x00 }, | ||
| 162 | { 0x00, 0x00, 0x00 }, | ||
| 163 | { 0x00, 0x00, 0x00 }, | ||
| 164 | { 0x00, 0x00, 0x00 }, | ||
| 165 | { 0x00, 0x00, 0x00 }, | ||
| 166 | { 0x00, 0x00, 0x00 }, | ||
| 167 | { 0x00, 0x00, 0x00 }, | ||
| 168 | { 0x00, 0x00, 0x00 }, | ||
| 169 | { 0x00, 0x00, 0x00 }, | ||
| 170 | { 0x00, 0x00, 0x00 }, | ||
| 171 | { 0x00, 0x00, 0x00 }, | ||
| 172 | { 0x00, 0x00, 0x00 }, | ||
| 173 | { 0x00, 0x00, 0x00 }, | ||
| 174 | { 0x00, 0x00, 0x00 }, | ||
| 175 | { 0x00, 0x00, 0x00 }, | ||
| 176 | { 0x00, 0x00, 0x00 }, | ||
| 177 | { 0x00, 0x00, 0x00 }, | ||
| 178 | { 0x00, 0x00, 0x00 }, | ||
| 179 | { 0x00, 0x00, 0x00 }, | ||
| 180 | { 0x00, 0x00, 0x00 }, | ||
| 181 | { 0x00, 0x00, 0x00 }, | ||
| 182 | { 0x00, 0x00, 0x00 }, | ||
| 183 | { 0x00, 0x00, 0x00 }, | ||
| 184 | { 0x00, 0x00, 0x00 }, | ||
| 185 | { 0x00, 0x00, 0x00 }, | ||
| 186 | { 0x00, 0x00, 0x00 }, | ||
| 187 | { 0x00, 0x00, 0x00 }, | ||
| 188 | { 0x00, 0x00, 0x00 }, | ||
| 189 | { 0x00, 0x00, 0x00 }, | ||
| 190 | { 0x00, 0x00, 0x00 }, | ||
| 191 | { 0x00, 0x00, 0x00 }, | ||
| 192 | { 0x00, 0x00, 0x00 }, | ||
| 193 | { 0x00, 0x00, 0x00 }, | ||
| 194 | { 0x00, 0x00, 0x00 }, | ||
| 195 | { 0x00, 0x00, 0x00 }, | ||
| 196 | { 0x00, 0x00, 0x00 }, | ||
| 197 | { 0x00, 0x00, 0x00 }, | ||
| 198 | { 0x00, 0x00, 0x00 }, | ||
| 199 | { 0x00, 0x00, 0x00 }, | ||
| 200 | { 0x00, 0x00, 0x00 }, | ||
| 201 | { 0x00, 0x00, 0x00 }, | ||
| 202 | { 0x00, 0x00, 0x00 }, | ||
| 203 | { 0x00, 0x00, 0x00 }, | ||
| 204 | { 0x00, 0x00, 0x00 }, | ||
| 205 | { 0x00, 0x00, 0x00 }, | ||
| 206 | { 0x00, 0x00, 0x00 }, | ||
| 207 | { 0x00, 0x00, 0x00 }, | ||
| 208 | { 0x00, 0x00, 0x00 }, | ||
| 209 | { 0x00, 0x00, 0x00 }, | ||
| 210 | { 0x00, 0x00, 0x00 }, | ||
| 211 | { 0x00, 0x00, 0x00 }, | ||
| 212 | { 0x00, 0x00, 0x00 }, | ||
| 213 | { 0x00, 0x00, 0x00 }, | ||
| 214 | { 0x00, 0x00, 0x00 }, | ||
| 215 | { 0x00, 0x00, 0x00 }, | ||
| 216 | { 0x00, 0x00, 0x00 }, | ||
| 217 | { 0x00, 0x00, 0x00 }, | ||
| 218 | { 0x00, 0x00, 0x00 }, | ||
| 219 | { 0x00, 0x00, 0x00 }, | ||
| 220 | { 0x00, 0x00, 0x00 }, | ||
| 221 | { 0x00, 0x00, 0x00 }, | ||
| 222 | { 0x00, 0x00, 0x00 }, | ||
| 223 | { 0x00, 0x00, 0x00 }, | ||
| 224 | { 0x00, 0x00, 0x00 }, | ||
| 225 | { 0x00, 0x00, 0x00 }, | ||
| 226 | { 0x00, 0x00, 0x00 }, | ||
| 227 | { 0x00, 0x00, 0x00 }, | ||
| 228 | { 0x00, 0x00, 0x00 }, | ||
| 229 | { 0x00, 0x00, 0x00 }, | ||
| 230 | { 0x00, 0x00, 0x00 }, | ||
| 231 | { 0x00, 0x00, 0x00 }, | ||
| 232 | { 0x00, 0x00, 0x00 }, | ||
| 233 | { 0x00, 0x00, 0x00 }, | ||
| 234 | { 0x00, 0x00, 0x00 }, | ||
| 235 | { 0x00, 0x00, 0x00 }, | ||
| 236 | { 0x00, 0x00, 0x00 }, | ||
| 237 | { 0x00, 0x00, 0x00 }, | ||
| 238 | { 0x00, 0x00, 0x00 }, | ||
| 239 | { 0x00, 0x00, 0x00 }, | ||
| 240 | { 0x00, 0x00, 0x00 }, | ||
| 241 | { 0x00, 0x00, 0x00 }, | ||
| 242 | { 0x00, 0x00, 0x00 }, | ||
| 243 | { 0x00, 0x00, 0x00 }, | ||
| 244 | { 0x00, 0x00, 0x00 }, | ||
| 245 | { 0x00, 0x00, 0x00 }, | ||
| 246 | { 0x00, 0x00, 0x00 }, | ||
| 247 | { 0x00, 0x00, 0x00 }, | ||
| 248 | { 0x00, 0x00, 0x00 }, | ||
| 249 | { 0x00, 0x00, 0x00 }, | ||
| 250 | { 0x00, 0x00, 0x00 }, | ||
| 251 | { 0x00, 0x00, 0x00 }, | ||
| 252 | { 0x00, 0x00, 0x00 }, | ||
| 253 | { 0x00, 0x00, 0x00 }, | ||
| 254 | { 0x00, 0x00, 0x00 }, | ||
| 255 | { 0x00, 0x00, 0x00 }, | ||
| 256 | { 0x00, 0x00, 0x00 }, | ||
| 257 | { 0x00, 0x00, 0x00 }, | ||
| 258 | { 0x00, 0x00, 0x00 }, | ||
| 259 | { 0x00, 0x00, 0x00 }, | ||
| 260 | { 0x00, 0x00, 0x00 }, | ||
| 261 | { 0x00, 0x00, 0x00 }, | ||
| 262 | { 0x00, 0x00, 0x00 }, | ||
| 263 | { 0x00, 0x00, 0x00 }, | ||
| 264 | { 0x00, 0x00, 0x00 }, | ||
| 265 | { 0x00, 0x00, 0x00 }, | ||
| 266 | { 0x00, 0x00, 0x00 }, | ||
| 267 | { 0x00, 0x00, 0x00 }, | ||
| 268 | { 0x00, 0x00, 0x00 }, | ||
| 269 | { 0x00, 0x00, 0x00 }, | ||
| 270 | { 0x00, 0x00, 0x00 }, | ||
| 271 | { 0x00, 0x00, 0x00 }, | ||
| 272 | { 0x00, 0x00, 0x00 }, | ||
| 273 | { 0x00, 0x00, 0x00 }, | ||
| 274 | { 0x00, 0x00, 0x00 }, | ||
| 275 | { 0x00, 0x00, 0x00 }, | ||
| 276 | { 0x00, 0x00, 0x00 }, | ||
| 277 | { 0x00, 0x00, 0x00 }, | ||
| 278 | { 0x00, 0x00, 0x00 }, | ||
| 279 | { 0x00, 0x00, 0x00 }, | ||
| 280 | { 0x00, 0x00, 0x00 }, | ||
| 281 | } | ||
| 282 | }; | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_evdev_kbd_default_keymap.h b/contrib/SDL-3.2.8/src/core/linux/SDL_evdev_kbd_default_keymap.h new file mode 100644 index 0000000..0529454 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_evdev_kbd_default_keymap.h | |||
| @@ -0,0 +1,4765 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | /* *INDENT-OFF* */ /* clang-format off */ | ||
| 23 | |||
| 24 | static unsigned short default_key_map_0[NR_KEYS] = { | ||
| 25 | 0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, | ||
| 26 | 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, | ||
| 27 | 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, | ||
| 28 | 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, | ||
| 29 | 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, | ||
| 30 | 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, | ||
| 31 | 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, | ||
| 32 | 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 33 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 34 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 35 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, | ||
| 36 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 37 | 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 38 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 39 | 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, | ||
| 40 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 41 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 42 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 43 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 44 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 45 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 46 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 47 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 48 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 49 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 50 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 51 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 52 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 53 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 54 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 55 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 56 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 57 | }; | ||
| 58 | static unsigned short default_key_map_1[NR_KEYS] = { | ||
| 59 | 0xf200, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, | ||
| 60 | 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, | ||
| 61 | 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, | ||
| 62 | 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, | ||
| 63 | 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, | ||
| 64 | 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, | ||
| 65 | 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, | ||
| 66 | 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, | ||
| 67 | 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, | ||
| 68 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 69 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, | ||
| 70 | 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 71 | 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 72 | 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, | ||
| 73 | 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, | ||
| 74 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 75 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 76 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 77 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 78 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 79 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 80 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 81 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 82 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 83 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 84 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 85 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 86 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 87 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 88 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 89 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 90 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 91 | }; | ||
| 92 | static unsigned short default_key_map_2[NR_KEYS] = { | ||
| 93 | 0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, | ||
| 94 | 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, | ||
| 95 | 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, | ||
| 96 | 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, | ||
| 97 | 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, | ||
| 98 | 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, | ||
| 99 | 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, | ||
| 100 | 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 101 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, | ||
| 102 | 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, | ||
| 103 | 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, | ||
| 104 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 105 | 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 106 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 107 | 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, | ||
| 108 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 109 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 110 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 111 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 112 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 113 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 114 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 115 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 116 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 117 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 118 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 119 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 120 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 121 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 122 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 123 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 124 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 125 | }; | ||
| 126 | static unsigned short default_key_map_3[NR_KEYS] = { | ||
| 127 | 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, | ||
| 128 | 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, | ||
| 129 | 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, | ||
| 130 | 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, | ||
| 131 | 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, | ||
| 132 | 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, | ||
| 133 | 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, | ||
| 134 | 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, | ||
| 135 | 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, | ||
| 136 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 137 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, | ||
| 138 | 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 139 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 140 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 141 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 142 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 143 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 144 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 145 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 146 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 147 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 148 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 149 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 150 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 151 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 152 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 153 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 154 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 155 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 156 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 157 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 158 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 159 | }; | ||
| 160 | #ifdef INCLUDE_EXTENDED_KEYMAP | ||
| 161 | static unsigned short default_key_map_4[NR_KEYS] = { | ||
| 162 | 0xf200, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 163 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 164 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 165 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 166 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 167 | 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 168 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 169 | 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, | ||
| 170 | 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, | ||
| 171 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 172 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, | ||
| 173 | 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 174 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 175 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 176 | 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf205, | ||
| 177 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 178 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 179 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 180 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 181 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 182 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 183 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 184 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 185 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 186 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 187 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 188 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 189 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 190 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 191 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 192 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 193 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 194 | }; | ||
| 195 | static unsigned short default_key_map_5[NR_KEYS] = { | ||
| 196 | 0xf200, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 197 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 198 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 199 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 200 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 201 | 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 202 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 203 | 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, | ||
| 204 | 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, | ||
| 205 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 206 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, | ||
| 207 | 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 208 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 209 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 210 | 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf205, | ||
| 211 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 212 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 213 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 214 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 215 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 216 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 217 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 218 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 219 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 220 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 221 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 222 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 223 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 224 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 225 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 226 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 227 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 228 | }; | ||
| 229 | static unsigned short default_key_map_6[NR_KEYS] = { | ||
| 230 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 231 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 232 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 233 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 234 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 235 | 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 236 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 237 | 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 238 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, | ||
| 239 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 240 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, | ||
| 241 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 242 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 243 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 244 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 245 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 246 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 247 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 248 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 249 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 250 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 251 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 252 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 253 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 254 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 255 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 256 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 257 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 258 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 259 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 260 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 261 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 262 | }; | ||
| 263 | static unsigned short default_key_map_7[NR_KEYS] = { | ||
| 264 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 265 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 266 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 267 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 268 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 269 | 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 270 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 271 | 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, | ||
| 272 | 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, | ||
| 273 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 274 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, | ||
| 275 | 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 276 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 277 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 278 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 279 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 280 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 281 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 282 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 283 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 284 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 285 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 286 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 287 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 288 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 289 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 290 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 291 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 292 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 293 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 294 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 295 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 296 | }; | ||
| 297 | static unsigned short default_key_map_8[NR_KEYS] = { | ||
| 298 | 0xf200, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, | ||
| 299 | 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, | ||
| 300 | 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, | ||
| 301 | 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, | ||
| 302 | 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, | ||
| 303 | 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, | ||
| 304 | 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, | ||
| 305 | 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, | ||
| 306 | 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, | ||
| 307 | 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, | ||
| 308 | 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, | ||
| 309 | 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 310 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, | ||
| 311 | 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 312 | 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, | ||
| 313 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 314 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 315 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 316 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 317 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 318 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 319 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 320 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 321 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 322 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 323 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 324 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 325 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 326 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 327 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 328 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 329 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 330 | }; | ||
| 331 | static unsigned short default_key_map_9[NR_KEYS] = { | ||
| 332 | 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, | ||
| 333 | 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, | ||
| 334 | 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, | ||
| 335 | 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, | ||
| 336 | 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, | ||
| 337 | 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, | ||
| 338 | 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, | ||
| 339 | 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 340 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, | ||
| 341 | 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, | ||
| 342 | 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, | ||
| 343 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 344 | 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 345 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 346 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 347 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 348 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 349 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 350 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 351 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 352 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 353 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 354 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 355 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 356 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 357 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 358 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 359 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 360 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 361 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 362 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 363 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 364 | }; | ||
| 365 | static unsigned short default_key_map_10[NR_KEYS] = { | ||
| 366 | 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, | ||
| 367 | 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, | ||
| 368 | 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, | ||
| 369 | 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, | ||
| 370 | 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, | ||
| 371 | 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, | ||
| 372 | 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, | ||
| 373 | 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 374 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 375 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 376 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, | ||
| 377 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 378 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 379 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 380 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 381 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 382 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 383 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 384 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 385 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 386 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 387 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 388 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 389 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 390 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 391 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 392 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 393 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 394 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 395 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 396 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 397 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 398 | }; | ||
| 399 | static unsigned short default_key_map_11[NR_KEYS] = { | ||
| 400 | 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, | ||
| 401 | 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, | ||
| 402 | 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, | ||
| 403 | 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, | ||
| 404 | 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, | ||
| 405 | 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, | ||
| 406 | 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, | ||
| 407 | 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 408 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 409 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 410 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, | ||
| 411 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 412 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 413 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 414 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 415 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 416 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 417 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 418 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 419 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 420 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 421 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 422 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 423 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 424 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 425 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 426 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 427 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 428 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 429 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 430 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 431 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 432 | }; | ||
| 433 | static unsigned short default_key_map_12[NR_KEYS] = { | ||
| 434 | 0xf200, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 435 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 436 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 437 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 438 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 439 | 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 440 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 441 | 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, | ||
| 442 | 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, | ||
| 443 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 444 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, | ||
| 445 | 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 446 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 447 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 448 | 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, | ||
| 449 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 450 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 451 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 452 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 453 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 454 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 455 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 456 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 457 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 458 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 459 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 460 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 461 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 462 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 463 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 464 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 465 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 466 | }; | ||
| 467 | static unsigned short default_key_map_13[NR_KEYS] = { | ||
| 468 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 469 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 470 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 471 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 472 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 473 | 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 474 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 475 | 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 476 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, | ||
| 477 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 478 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, | ||
| 479 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 480 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 481 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 482 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 483 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 484 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 485 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 486 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 487 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 488 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 489 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 490 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 491 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 492 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 493 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 494 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 495 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 496 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 497 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 498 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 499 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 500 | }; | ||
| 501 | static unsigned short default_key_map_14[NR_KEYS] = { | ||
| 502 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 503 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 504 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 505 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 506 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 507 | 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 508 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 509 | 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 510 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 511 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 512 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, | ||
| 513 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 514 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 515 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 516 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 517 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 518 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 519 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 520 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 521 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 522 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 523 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 524 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 525 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 526 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 527 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 528 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 529 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 530 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 531 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 532 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 533 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 534 | }; | ||
| 535 | static unsigned short default_key_map_15[NR_KEYS] = { | ||
| 536 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 537 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 538 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 539 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 540 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 541 | 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 542 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 543 | 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 544 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 545 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 546 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, | ||
| 547 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 548 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 549 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 550 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 551 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 552 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 553 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 554 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 555 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 556 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 557 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 558 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 559 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 560 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 561 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 562 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 563 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 564 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 565 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 566 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 567 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 568 | }; | ||
| 569 | static unsigned short default_key_map_16[NR_KEYS] = { | ||
| 570 | 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, | ||
| 571 | 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, | ||
| 572 | 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, | ||
| 573 | 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, | ||
| 574 | 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, | ||
| 575 | 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, | ||
| 576 | 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, | ||
| 577 | 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 578 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 579 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 580 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, | ||
| 581 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 582 | 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 583 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 584 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 585 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 586 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 587 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 588 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 589 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 590 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 591 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 592 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 593 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 594 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 595 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 596 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 597 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 598 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 599 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 600 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 601 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 602 | }; | ||
| 603 | static unsigned short default_key_map_17[NR_KEYS] = { | ||
| 604 | 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, | ||
| 605 | 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, | ||
| 606 | 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, | ||
| 607 | 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, | ||
| 608 | 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, | ||
| 609 | 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, | ||
| 610 | 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, | ||
| 611 | 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, | ||
| 612 | 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, | ||
| 613 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 614 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, | ||
| 615 | 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 616 | 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 617 | 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, | ||
| 618 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 619 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 620 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 621 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 622 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 623 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 624 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 625 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 626 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 627 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 628 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 629 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 630 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 631 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 632 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 633 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 634 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 635 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 636 | }; | ||
| 637 | static unsigned short default_key_map_18[NR_KEYS] = { | ||
| 638 | 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, | ||
| 639 | 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, | ||
| 640 | 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, | ||
| 641 | 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, | ||
| 642 | 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, | ||
| 643 | 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, | ||
| 644 | 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, | ||
| 645 | 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 646 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, | ||
| 647 | 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, | ||
| 648 | 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, | ||
| 649 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 650 | 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 651 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 652 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 653 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 654 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 655 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 656 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 657 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 658 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 659 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 660 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 661 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 662 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 663 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 664 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 665 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 666 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 667 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 668 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 669 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 670 | }; | ||
| 671 | static unsigned short default_key_map_19[NR_KEYS] = { | ||
| 672 | 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, | ||
| 673 | 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, | ||
| 674 | 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, | ||
| 675 | 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, | ||
| 676 | 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, | ||
| 677 | 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, | ||
| 678 | 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, | ||
| 679 | 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, | ||
| 680 | 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, | ||
| 681 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 682 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, | ||
| 683 | 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 684 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 685 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 686 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 687 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 688 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 689 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 690 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 691 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 692 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 693 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 694 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 695 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 696 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 697 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 698 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 699 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 700 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 701 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 702 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 703 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 704 | }; | ||
| 705 | static unsigned short default_key_map_20[NR_KEYS] = { | ||
| 706 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 707 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 708 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 709 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 710 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 711 | 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 712 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 713 | 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, | ||
| 714 | 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, | ||
| 715 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 716 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, | ||
| 717 | 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 718 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 719 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 720 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 721 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 722 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 723 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 724 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 725 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 726 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 727 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 728 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 729 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 730 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 731 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 732 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 733 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 734 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 735 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 736 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 737 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 738 | }; | ||
| 739 | static unsigned short default_key_map_21[NR_KEYS] = { | ||
| 740 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 741 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 742 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 743 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 744 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 745 | 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 746 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 747 | 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, | ||
| 748 | 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, | ||
| 749 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 750 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, | ||
| 751 | 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 752 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 753 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 754 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 755 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 756 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 757 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 758 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 759 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 760 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 761 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 762 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 763 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 764 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 765 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 766 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 767 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 768 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 769 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 770 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 771 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 772 | }; | ||
| 773 | static unsigned short default_key_map_22[NR_KEYS] = { | ||
| 774 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 775 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 776 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 777 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 778 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 779 | 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 780 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 781 | 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 782 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, | ||
| 783 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 784 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, | ||
| 785 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 786 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 787 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 788 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 789 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 790 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 791 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 792 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 793 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 794 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 795 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 796 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 797 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 798 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 799 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 800 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 801 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 802 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 803 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 804 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 805 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 806 | }; | ||
| 807 | static unsigned short default_key_map_23[NR_KEYS] = { | ||
| 808 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 809 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 810 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 811 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 812 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 813 | 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 814 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 815 | 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, | ||
| 816 | 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, | ||
| 817 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 818 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, | ||
| 819 | 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 820 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 821 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 822 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 823 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 824 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 825 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 826 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 827 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 828 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 829 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 830 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 831 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 832 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 833 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 834 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 835 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 836 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 837 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 838 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 839 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 840 | }; | ||
| 841 | static unsigned short default_key_map_24[NR_KEYS] = { | ||
| 842 | 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, | ||
| 843 | 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, | ||
| 844 | 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, | ||
| 845 | 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, | ||
| 846 | 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, | ||
| 847 | 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, | ||
| 848 | 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, | ||
| 849 | 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, | ||
| 850 | 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, | ||
| 851 | 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, | ||
| 852 | 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, | ||
| 853 | 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 854 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, | ||
| 855 | 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 856 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 857 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 858 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 859 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 860 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 861 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 862 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 863 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 864 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 865 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 866 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 867 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 868 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 869 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 870 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 871 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 872 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 873 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 874 | }; | ||
| 875 | static unsigned short default_key_map_25[NR_KEYS] = { | ||
| 876 | 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, | ||
| 877 | 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, | ||
| 878 | 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, | ||
| 879 | 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, | ||
| 880 | 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, | ||
| 881 | 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, | ||
| 882 | 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, | ||
| 883 | 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 884 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, | ||
| 885 | 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, | ||
| 886 | 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, | ||
| 887 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 888 | 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 889 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 890 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 891 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 892 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 893 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 894 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 895 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 896 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 897 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 898 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 899 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 900 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 901 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 902 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 903 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 904 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 905 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 906 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 907 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 908 | }; | ||
| 909 | static unsigned short default_key_map_26[NR_KEYS] = { | ||
| 910 | 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, | ||
| 911 | 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, | ||
| 912 | 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, | ||
| 913 | 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, | ||
| 914 | 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, | ||
| 915 | 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, | ||
| 916 | 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, | ||
| 917 | 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 918 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 919 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 920 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, | ||
| 921 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 922 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 923 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 924 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 925 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 926 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 927 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 928 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 929 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 930 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 931 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 932 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 933 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 934 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 935 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 936 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 937 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 938 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 939 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 940 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 941 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 942 | }; | ||
| 943 | static unsigned short default_key_map_27[NR_KEYS] = { | ||
| 944 | 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, | ||
| 945 | 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, | ||
| 946 | 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, | ||
| 947 | 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, | ||
| 948 | 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, | ||
| 949 | 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, | ||
| 950 | 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, | ||
| 951 | 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 952 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 953 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 954 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, | ||
| 955 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 956 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 957 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 958 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 959 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 960 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 961 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 962 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 963 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 964 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 965 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 966 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 967 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 968 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 969 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 970 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 971 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 972 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 973 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 974 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 975 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 976 | }; | ||
| 977 | static unsigned short default_key_map_28[NR_KEYS] = { | ||
| 978 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 979 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 980 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 981 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 982 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 983 | 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 984 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 985 | 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, | ||
| 986 | 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, | ||
| 987 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 988 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, | ||
| 989 | 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 990 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 991 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 992 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 993 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 994 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 995 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 996 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 997 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 998 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 999 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1000 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1001 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1002 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1003 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1004 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1005 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1006 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1007 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1008 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1009 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1010 | }; | ||
| 1011 | static unsigned short default_key_map_29[NR_KEYS] = { | ||
| 1012 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 1013 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 1014 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 1015 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 1016 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 1017 | 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 1018 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 1019 | 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 1020 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, | ||
| 1021 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1022 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, | ||
| 1023 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1024 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1025 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1026 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1027 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1028 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1029 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1030 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1031 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1032 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1033 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1034 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1035 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1036 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1037 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1038 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1039 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1040 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1041 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1042 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1043 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1044 | }; | ||
| 1045 | static unsigned short default_key_map_30[NR_KEYS] = { | ||
| 1046 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 1047 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 1048 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 1049 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 1050 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 1051 | 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 1052 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 1053 | 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 1054 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 1055 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1056 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, | ||
| 1057 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1058 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1059 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 1060 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1061 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1062 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1063 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1064 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1065 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1066 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1067 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1068 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1069 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1070 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1071 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1072 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1073 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1074 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1075 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1076 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1077 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1078 | }; | ||
| 1079 | static unsigned short default_key_map_31[NR_KEYS] = { | ||
| 1080 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 1081 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 1082 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 1083 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 1084 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 1085 | 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 1086 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 1087 | 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 1088 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 1089 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1090 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, | ||
| 1091 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1092 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1093 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1094 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1095 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1096 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1097 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1098 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1099 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1100 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1101 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1102 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1103 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1104 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1105 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1106 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1107 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1108 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1109 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1110 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1111 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1112 | }; | ||
| 1113 | static unsigned short default_key_map_32[NR_KEYS] = { | ||
| 1114 | 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, | ||
| 1115 | 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, | ||
| 1116 | 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, | ||
| 1117 | 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, | ||
| 1118 | 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, | ||
| 1119 | 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, | ||
| 1120 | 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, | ||
| 1121 | 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 1122 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 1123 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1124 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, | ||
| 1125 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1126 | 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1127 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1128 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1129 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1130 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1131 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1132 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1133 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1134 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1135 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1136 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1137 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1138 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1139 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1140 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1141 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1142 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1143 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1144 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1145 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1146 | }; | ||
| 1147 | static unsigned short default_key_map_33[NR_KEYS] = { | ||
| 1148 | 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, | ||
| 1149 | 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, | ||
| 1150 | 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, | ||
| 1151 | 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, | ||
| 1152 | 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, | ||
| 1153 | 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, | ||
| 1154 | 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, | ||
| 1155 | 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, | ||
| 1156 | 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, | ||
| 1157 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1158 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, | ||
| 1159 | 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1160 | 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1161 | 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, | ||
| 1162 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1163 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1164 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1165 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1166 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1167 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1168 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1169 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1170 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1171 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1172 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1173 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1174 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1175 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1176 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1177 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1178 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1179 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1180 | }; | ||
| 1181 | static unsigned short default_key_map_34[NR_KEYS] = { | ||
| 1182 | 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, | ||
| 1183 | 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, | ||
| 1184 | 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, | ||
| 1185 | 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, | ||
| 1186 | 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, | ||
| 1187 | 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, | ||
| 1188 | 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, | ||
| 1189 | 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 1190 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, | ||
| 1191 | 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, | ||
| 1192 | 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, | ||
| 1193 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1194 | 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1195 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1196 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1197 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1198 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1199 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1200 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1201 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1202 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1203 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1204 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1205 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1206 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1207 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1208 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1209 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1210 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1211 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1212 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1213 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1214 | }; | ||
| 1215 | static unsigned short default_key_map_35[NR_KEYS] = { | ||
| 1216 | 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, | ||
| 1217 | 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, | ||
| 1218 | 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, | ||
| 1219 | 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, | ||
| 1220 | 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, | ||
| 1221 | 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, | ||
| 1222 | 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, | ||
| 1223 | 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, | ||
| 1224 | 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, | ||
| 1225 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1226 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, | ||
| 1227 | 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1228 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1229 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1230 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1231 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1232 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1233 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1234 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1235 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1236 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1237 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1238 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1239 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1240 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1241 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1242 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1243 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1244 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1245 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1246 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1247 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1248 | }; | ||
| 1249 | static unsigned short default_key_map_36[NR_KEYS] = { | ||
| 1250 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 1251 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 1252 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 1253 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 1254 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 1255 | 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 1256 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 1257 | 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, | ||
| 1258 | 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, | ||
| 1259 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1260 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, | ||
| 1261 | 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1262 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1263 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1264 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 1265 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1266 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1267 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1268 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1269 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1270 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1271 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1272 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1273 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1274 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1275 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1276 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1277 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1278 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1279 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1280 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1281 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1282 | }; | ||
| 1283 | static unsigned short default_key_map_37[NR_KEYS] = { | ||
| 1284 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 1285 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 1286 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 1287 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 1288 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 1289 | 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 1290 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 1291 | 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, | ||
| 1292 | 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, | ||
| 1293 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1294 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, | ||
| 1295 | 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1296 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1297 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1298 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 1299 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1300 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1301 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1302 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1303 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1304 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1305 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1306 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1307 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1308 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1309 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1310 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1311 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1312 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1313 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1314 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1315 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1316 | }; | ||
| 1317 | static unsigned short default_key_map_38[NR_KEYS] = { | ||
| 1318 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 1319 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 1320 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 1321 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 1322 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 1323 | 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 1324 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 1325 | 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 1326 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, | ||
| 1327 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1328 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, | ||
| 1329 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1330 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1331 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 1332 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 1333 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1334 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1335 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1336 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1337 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1338 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1339 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1340 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1341 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1342 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1343 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1344 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1345 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1346 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1347 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1348 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1349 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1350 | }; | ||
| 1351 | static unsigned short default_key_map_39[NR_KEYS] = { | ||
| 1352 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 1353 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 1354 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 1355 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 1356 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 1357 | 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 1358 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 1359 | 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, | ||
| 1360 | 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, | ||
| 1361 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1362 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, | ||
| 1363 | 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1364 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1365 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1366 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 1367 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1368 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1369 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1370 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1371 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1372 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1373 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1374 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1375 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1376 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1377 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1378 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1379 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1380 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1381 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1382 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1383 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1384 | }; | ||
| 1385 | static unsigned short default_key_map_40[NR_KEYS] = { | ||
| 1386 | 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, | ||
| 1387 | 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, | ||
| 1388 | 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, | ||
| 1389 | 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, | ||
| 1390 | 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, | ||
| 1391 | 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, | ||
| 1392 | 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, | ||
| 1393 | 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, | ||
| 1394 | 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, | ||
| 1395 | 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, | ||
| 1396 | 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, | ||
| 1397 | 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1398 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, | ||
| 1399 | 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1400 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1401 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1402 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1403 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1404 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1405 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1406 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1407 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1408 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1409 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1410 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1411 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1412 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1413 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1414 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1415 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1416 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1417 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1418 | }; | ||
| 1419 | static unsigned short default_key_map_41[NR_KEYS] = { | ||
| 1420 | 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, | ||
| 1421 | 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, | ||
| 1422 | 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, | ||
| 1423 | 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, | ||
| 1424 | 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, | ||
| 1425 | 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, | ||
| 1426 | 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, | ||
| 1427 | 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 1428 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, | ||
| 1429 | 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, | ||
| 1430 | 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, | ||
| 1431 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1432 | 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1433 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1434 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1435 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1436 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1437 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1438 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1439 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1440 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1441 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1442 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1443 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1444 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1445 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1446 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1447 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1448 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1449 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1450 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1451 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1452 | }; | ||
| 1453 | static unsigned short default_key_map_42[NR_KEYS] = { | ||
| 1454 | 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, | ||
| 1455 | 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, | ||
| 1456 | 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, | ||
| 1457 | 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, | ||
| 1458 | 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, | ||
| 1459 | 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, | ||
| 1460 | 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, | ||
| 1461 | 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 1462 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 1463 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1464 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, | ||
| 1465 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1466 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1467 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1468 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1469 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1470 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1471 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1472 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1473 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1474 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1475 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1476 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1477 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1478 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1479 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1480 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1481 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1482 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1483 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1484 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1485 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1486 | }; | ||
| 1487 | static unsigned short default_key_map_43[NR_KEYS] = { | ||
| 1488 | 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, | ||
| 1489 | 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, | ||
| 1490 | 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, | ||
| 1491 | 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, | ||
| 1492 | 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, | ||
| 1493 | 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, | ||
| 1494 | 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, | ||
| 1495 | 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 1496 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 1497 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1498 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, | ||
| 1499 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1500 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1501 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1502 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1503 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1504 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1505 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1506 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1507 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1508 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1509 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1510 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1511 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1512 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1513 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1514 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1515 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1516 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1517 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1518 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1519 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1520 | }; | ||
| 1521 | static unsigned short default_key_map_44[NR_KEYS] = { | ||
| 1522 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 1523 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 1524 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 1525 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 1526 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 1527 | 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 1528 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 1529 | 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, | ||
| 1530 | 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, | ||
| 1531 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1532 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, | ||
| 1533 | 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1534 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1535 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 1536 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1537 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1538 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1539 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1540 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1541 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1542 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1543 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1544 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1545 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1546 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1547 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1548 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1549 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1550 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1551 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1552 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1553 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1554 | }; | ||
| 1555 | static unsigned short default_key_map_45[NR_KEYS] = { | ||
| 1556 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 1557 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 1558 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 1559 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 1560 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 1561 | 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 1562 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 1563 | 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 1564 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, | ||
| 1565 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1566 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, | ||
| 1567 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1568 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1569 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1570 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1571 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1572 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1573 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1574 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1575 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1576 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1577 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1578 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1579 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1580 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1581 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1582 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1583 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1584 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1585 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1586 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1587 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1588 | }; | ||
| 1589 | static unsigned short default_key_map_46[NR_KEYS] = { | ||
| 1590 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 1591 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 1592 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 1593 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 1594 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 1595 | 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 1596 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 1597 | 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 1598 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 1599 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1600 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, | ||
| 1601 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1602 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1603 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 1604 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1605 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1606 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1607 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1608 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1609 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1610 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1611 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1612 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1613 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1614 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1615 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1616 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1617 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1618 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1619 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1620 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1621 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1622 | }; | ||
| 1623 | static unsigned short default_key_map_47[NR_KEYS] = { | ||
| 1624 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 1625 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 1626 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 1627 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 1628 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 1629 | 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 1630 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 1631 | 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 1632 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 1633 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1634 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, | ||
| 1635 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1636 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1637 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1638 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1639 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1640 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1641 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1642 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1643 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1644 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1645 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1646 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1647 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1648 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1649 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1650 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1651 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1652 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1653 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1654 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1655 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1656 | }; | ||
| 1657 | static unsigned short default_key_map_48[NR_KEYS] = { | ||
| 1658 | 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, | ||
| 1659 | 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, | ||
| 1660 | 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, | ||
| 1661 | 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, | ||
| 1662 | 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, | ||
| 1663 | 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, | ||
| 1664 | 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, | ||
| 1665 | 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 1666 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 1667 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1668 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, | ||
| 1669 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1670 | 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1671 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1672 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1673 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1674 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1675 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1676 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1677 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1678 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1679 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1680 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1681 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1682 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1683 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1684 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1685 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1686 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1687 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1688 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1689 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1690 | }; | ||
| 1691 | static unsigned short default_key_map_49[NR_KEYS] = { | ||
| 1692 | 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, | ||
| 1693 | 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, | ||
| 1694 | 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, | ||
| 1695 | 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, | ||
| 1696 | 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, | ||
| 1697 | 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, | ||
| 1698 | 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, | ||
| 1699 | 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, | ||
| 1700 | 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, | ||
| 1701 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1702 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, | ||
| 1703 | 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1704 | 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1705 | 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, | ||
| 1706 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1707 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1708 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1709 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1710 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1711 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1712 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1713 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1714 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1715 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1716 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1717 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1718 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1719 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1720 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1721 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1722 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1723 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1724 | }; | ||
| 1725 | static unsigned short default_key_map_50[NR_KEYS] = { | ||
| 1726 | 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, | ||
| 1727 | 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, | ||
| 1728 | 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, | ||
| 1729 | 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, | ||
| 1730 | 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, | ||
| 1731 | 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, | ||
| 1732 | 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, | ||
| 1733 | 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 1734 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, | ||
| 1735 | 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, | ||
| 1736 | 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, | ||
| 1737 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1738 | 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1739 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1740 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1741 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1742 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1743 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1744 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1745 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1746 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1747 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1748 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1749 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1750 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1751 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1752 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1753 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1754 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1755 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1756 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1757 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1758 | }; | ||
| 1759 | static unsigned short default_key_map_51[NR_KEYS] = { | ||
| 1760 | 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, | ||
| 1761 | 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, | ||
| 1762 | 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, | ||
| 1763 | 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, | ||
| 1764 | 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, | ||
| 1765 | 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, | ||
| 1766 | 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, | ||
| 1767 | 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, | ||
| 1768 | 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, | ||
| 1769 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1770 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, | ||
| 1771 | 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1772 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1773 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1774 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1775 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1776 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1777 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1778 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1779 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1780 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1781 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1782 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1783 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1784 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1785 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1786 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1787 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1788 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1789 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1790 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1791 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1792 | }; | ||
| 1793 | static unsigned short default_key_map_52[NR_KEYS] = { | ||
| 1794 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 1795 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 1796 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 1797 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 1798 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 1799 | 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 1800 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 1801 | 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, | ||
| 1802 | 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, | ||
| 1803 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1804 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, | ||
| 1805 | 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1806 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1807 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1808 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 1809 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1810 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1811 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1812 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1813 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1814 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1815 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1816 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1817 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1818 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1819 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1820 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1821 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1822 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1823 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1824 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1825 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1826 | }; | ||
| 1827 | static unsigned short default_key_map_53[NR_KEYS] = { | ||
| 1828 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 1829 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 1830 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 1831 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 1832 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 1833 | 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 1834 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 1835 | 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, | ||
| 1836 | 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, | ||
| 1837 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1838 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, | ||
| 1839 | 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1840 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1841 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1842 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 1843 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1844 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1845 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1846 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1847 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1848 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1849 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1850 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1851 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1852 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1853 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1854 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1855 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1856 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1857 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1858 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1859 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1860 | }; | ||
| 1861 | static unsigned short default_key_map_54[NR_KEYS] = { | ||
| 1862 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 1863 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 1864 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 1865 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 1866 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 1867 | 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 1868 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 1869 | 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 1870 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, | ||
| 1871 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1872 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, | ||
| 1873 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1874 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1875 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 1876 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 1877 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1878 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1879 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1880 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1881 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1882 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1883 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1884 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1885 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1886 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1887 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1888 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1889 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1890 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1891 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1892 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1893 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1894 | }; | ||
| 1895 | static unsigned short default_key_map_55[NR_KEYS] = { | ||
| 1896 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 1897 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 1898 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 1899 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 1900 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 1901 | 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 1902 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 1903 | 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, | ||
| 1904 | 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, | ||
| 1905 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 1906 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, | ||
| 1907 | 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1908 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1909 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1910 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 1911 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1912 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1913 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1914 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1915 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1916 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1917 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1918 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1919 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1920 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1921 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1922 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1923 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1924 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1925 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1926 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1927 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1928 | }; | ||
| 1929 | static unsigned short default_key_map_56[NR_KEYS] = { | ||
| 1930 | 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, | ||
| 1931 | 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, | ||
| 1932 | 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, | ||
| 1933 | 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, | ||
| 1934 | 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, | ||
| 1935 | 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, | ||
| 1936 | 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, | ||
| 1937 | 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, | ||
| 1938 | 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, | ||
| 1939 | 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, | ||
| 1940 | 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, | ||
| 1941 | 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1942 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, | ||
| 1943 | 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1944 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1945 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1946 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1947 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1948 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1949 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1950 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1951 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1952 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1953 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1954 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1955 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1956 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1957 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1958 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1959 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1960 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1961 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1962 | }; | ||
| 1963 | static unsigned short default_key_map_57[NR_KEYS] = { | ||
| 1964 | 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, | ||
| 1965 | 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, | ||
| 1966 | 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, | ||
| 1967 | 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, | ||
| 1968 | 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, | ||
| 1969 | 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, | ||
| 1970 | 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, | ||
| 1971 | 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 1972 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, | ||
| 1973 | 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, | ||
| 1974 | 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, | ||
| 1975 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1976 | 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 1977 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 1978 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 1979 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 1980 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1981 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1982 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1983 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1984 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1985 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1986 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1987 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1988 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1989 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1990 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1991 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1992 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1993 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1994 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1995 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 1996 | }; | ||
| 1997 | static unsigned short default_key_map_58[NR_KEYS] = { | ||
| 1998 | 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, | ||
| 1999 | 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, | ||
| 2000 | 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, | ||
| 2001 | 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, | ||
| 2002 | 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, | ||
| 2003 | 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, | ||
| 2004 | 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, | ||
| 2005 | 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 2006 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 2007 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2008 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, | ||
| 2009 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2010 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2011 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2012 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2013 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2014 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2015 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2016 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2017 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2018 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2019 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2020 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2021 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2022 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2023 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2024 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2025 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2026 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2027 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2028 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2029 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2030 | }; | ||
| 2031 | static unsigned short default_key_map_59[NR_KEYS] = { | ||
| 2032 | 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, | ||
| 2033 | 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, | ||
| 2034 | 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, | ||
| 2035 | 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, | ||
| 2036 | 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, | ||
| 2037 | 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, | ||
| 2038 | 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, | ||
| 2039 | 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 2040 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 2041 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2042 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, | ||
| 2043 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2044 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2045 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2046 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2047 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2048 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2049 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2050 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2051 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2052 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2053 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2054 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2055 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2056 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2057 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2058 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2059 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2060 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2061 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2062 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2063 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2064 | }; | ||
| 2065 | static unsigned short default_key_map_60[NR_KEYS] = { | ||
| 2066 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 2067 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 2068 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 2069 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 2070 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 2071 | 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 2072 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 2073 | 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, | ||
| 2074 | 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, | ||
| 2075 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2076 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, | ||
| 2077 | 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2078 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2079 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 2080 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2081 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2082 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2083 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2084 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2085 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2086 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2087 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2088 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2089 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2090 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2091 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2092 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2093 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2094 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2095 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2096 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2097 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2098 | }; | ||
| 2099 | static unsigned short default_key_map_61[NR_KEYS] = { | ||
| 2100 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 2101 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 2102 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 2103 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 2104 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 2105 | 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 2106 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 2107 | 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 2108 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, | ||
| 2109 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2110 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, | ||
| 2111 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2112 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2113 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2114 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2115 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2116 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2117 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2118 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2119 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2120 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2121 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2122 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2123 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2124 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2125 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2126 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2127 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2128 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2129 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2130 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2131 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2132 | }; | ||
| 2133 | static unsigned short default_key_map_62[NR_KEYS] = { | ||
| 2134 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 2135 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 2136 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 2137 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 2138 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 2139 | 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 2140 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 2141 | 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 2142 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 2143 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2144 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, | ||
| 2145 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2146 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2147 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 2148 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2149 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2150 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2151 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2152 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2153 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2154 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2155 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2156 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2157 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2158 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2159 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2160 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2161 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2162 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2163 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2164 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2165 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2166 | }; | ||
| 2167 | static unsigned short default_key_map_63[NR_KEYS] = { | ||
| 2168 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 2169 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 2170 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 2171 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 2172 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 2173 | 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 2174 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 2175 | 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 2176 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 2177 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2178 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, | ||
| 2179 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2180 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2181 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2182 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2183 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2184 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2185 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2186 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2187 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2188 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2189 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2190 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2191 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2192 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2193 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2194 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2195 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2196 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2197 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2198 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2199 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2200 | }; | ||
| 2201 | static unsigned short default_key_map_64[NR_KEYS] = { | ||
| 2202 | 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, | ||
| 2203 | 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, | ||
| 2204 | 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, | ||
| 2205 | 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, | ||
| 2206 | 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, | ||
| 2207 | 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, | ||
| 2208 | 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, | ||
| 2209 | 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 2210 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 2211 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2212 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, | ||
| 2213 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2214 | 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2215 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2216 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2217 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2218 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2219 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2220 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2221 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2222 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2223 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2224 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2225 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2226 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2227 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2228 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2229 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2230 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2231 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2232 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2233 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2234 | }; | ||
| 2235 | static unsigned short default_key_map_65[NR_KEYS] = { | ||
| 2236 | 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, | ||
| 2237 | 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, | ||
| 2238 | 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, | ||
| 2239 | 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, | ||
| 2240 | 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, | ||
| 2241 | 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, | ||
| 2242 | 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, | ||
| 2243 | 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, | ||
| 2244 | 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, | ||
| 2245 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2246 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, | ||
| 2247 | 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2248 | 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2249 | 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, | ||
| 2250 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2251 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2252 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2253 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2254 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2255 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2256 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2257 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2258 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2259 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2260 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2261 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2262 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2263 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2264 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2265 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2266 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2267 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2268 | }; | ||
| 2269 | static unsigned short default_key_map_66[NR_KEYS] = { | ||
| 2270 | 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, | ||
| 2271 | 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, | ||
| 2272 | 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, | ||
| 2273 | 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, | ||
| 2274 | 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, | ||
| 2275 | 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, | ||
| 2276 | 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, | ||
| 2277 | 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 2278 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, | ||
| 2279 | 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, | ||
| 2280 | 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, | ||
| 2281 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2282 | 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2283 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2284 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2285 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2286 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2287 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2288 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2289 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2290 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2291 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2292 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2293 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2294 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2295 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2296 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2297 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2298 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2299 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2300 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2301 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2302 | }; | ||
| 2303 | static unsigned short default_key_map_67[NR_KEYS] = { | ||
| 2304 | 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, | ||
| 2305 | 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, | ||
| 2306 | 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, | ||
| 2307 | 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, | ||
| 2308 | 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, | ||
| 2309 | 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, | ||
| 2310 | 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, | ||
| 2311 | 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, | ||
| 2312 | 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, | ||
| 2313 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2314 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, | ||
| 2315 | 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2316 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2317 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2318 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2319 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2320 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2321 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2322 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2323 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2324 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2325 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2326 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2327 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2328 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2329 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2330 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2331 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2332 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2333 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2334 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2335 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2336 | }; | ||
| 2337 | static unsigned short default_key_map_68[NR_KEYS] = { | ||
| 2338 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 2339 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 2340 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 2341 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 2342 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 2343 | 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 2344 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 2345 | 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, | ||
| 2346 | 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, | ||
| 2347 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2348 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, | ||
| 2349 | 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2350 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2351 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2352 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 2353 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2354 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2355 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2356 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2357 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2358 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2359 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2360 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2361 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2362 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2363 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2364 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2365 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2366 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2367 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2368 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2369 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2370 | }; | ||
| 2371 | static unsigned short default_key_map_69[NR_KEYS] = { | ||
| 2372 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 2373 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 2374 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 2375 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 2376 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 2377 | 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 2378 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 2379 | 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, | ||
| 2380 | 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, | ||
| 2381 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2382 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, | ||
| 2383 | 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2384 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2385 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2386 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 2387 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2388 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2389 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2390 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2391 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2392 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2393 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2394 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2395 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2396 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2397 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2398 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2399 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2400 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2401 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2402 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2403 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2404 | }; | ||
| 2405 | static unsigned short default_key_map_70[NR_KEYS] = { | ||
| 2406 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 2407 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 2408 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 2409 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 2410 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 2411 | 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 2412 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 2413 | 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 2414 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, | ||
| 2415 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2416 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, | ||
| 2417 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2418 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2419 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 2420 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 2421 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2422 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2423 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2424 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2425 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2426 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2427 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2428 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2429 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2430 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2431 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2432 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2433 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2434 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2435 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2436 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2437 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2438 | }; | ||
| 2439 | static unsigned short default_key_map_71[NR_KEYS] = { | ||
| 2440 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 2441 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 2442 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 2443 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 2444 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 2445 | 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 2446 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 2447 | 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, | ||
| 2448 | 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, | ||
| 2449 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2450 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, | ||
| 2451 | 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2452 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2453 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2454 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 2455 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2456 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2457 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2458 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2459 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2460 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2461 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2462 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2463 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2464 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2465 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2466 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2467 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2468 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2469 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2470 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2471 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2472 | }; | ||
| 2473 | static unsigned short default_key_map_72[NR_KEYS] = { | ||
| 2474 | 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, | ||
| 2475 | 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, | ||
| 2476 | 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, | ||
| 2477 | 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, | ||
| 2478 | 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, | ||
| 2479 | 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, | ||
| 2480 | 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, | ||
| 2481 | 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, | ||
| 2482 | 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, | ||
| 2483 | 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, | ||
| 2484 | 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, | ||
| 2485 | 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2486 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, | ||
| 2487 | 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2488 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2489 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2490 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2491 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2492 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2493 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2494 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2495 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2496 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2497 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2498 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2499 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2500 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2501 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2502 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2503 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2504 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2505 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2506 | }; | ||
| 2507 | static unsigned short default_key_map_73[NR_KEYS] = { | ||
| 2508 | 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, | ||
| 2509 | 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, | ||
| 2510 | 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, | ||
| 2511 | 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, | ||
| 2512 | 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, | ||
| 2513 | 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, | ||
| 2514 | 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, | ||
| 2515 | 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 2516 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, | ||
| 2517 | 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, | ||
| 2518 | 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, | ||
| 2519 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2520 | 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2521 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2522 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2523 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2524 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2525 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2526 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2527 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2528 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2529 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2530 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2531 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2532 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2533 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2534 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2535 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2536 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2537 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2538 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2539 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2540 | }; | ||
| 2541 | static unsigned short default_key_map_74[NR_KEYS] = { | ||
| 2542 | 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, | ||
| 2543 | 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, | ||
| 2544 | 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, | ||
| 2545 | 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, | ||
| 2546 | 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, | ||
| 2547 | 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, | ||
| 2548 | 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, | ||
| 2549 | 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 2550 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 2551 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2552 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, | ||
| 2553 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2554 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2555 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2556 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2557 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2558 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2559 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2560 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2561 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2562 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2563 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2564 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2565 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2566 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2567 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2568 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2569 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2570 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2571 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2572 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2573 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2574 | }; | ||
| 2575 | static unsigned short default_key_map_75[NR_KEYS] = { | ||
| 2576 | 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, | ||
| 2577 | 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, | ||
| 2578 | 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, | ||
| 2579 | 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, | ||
| 2580 | 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, | ||
| 2581 | 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, | ||
| 2582 | 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, | ||
| 2583 | 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 2584 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 2585 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2586 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, | ||
| 2587 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2588 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2589 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2590 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2591 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2592 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2593 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2594 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2595 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2596 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2597 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2598 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2599 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2600 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2601 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2602 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2603 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2604 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2605 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2606 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2607 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2608 | }; | ||
| 2609 | static unsigned short default_key_map_76[NR_KEYS] = { | ||
| 2610 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 2611 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 2612 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 2613 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 2614 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 2615 | 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 2616 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 2617 | 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, | ||
| 2618 | 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, | ||
| 2619 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2620 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, | ||
| 2621 | 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2622 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2623 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 2624 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2625 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2626 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2627 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2628 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2629 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2630 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2631 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2632 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2633 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2634 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2635 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2636 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2637 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2638 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2639 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2640 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2641 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2642 | }; | ||
| 2643 | static unsigned short default_key_map_77[NR_KEYS] = { | ||
| 2644 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 2645 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 2646 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 2647 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 2648 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 2649 | 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 2650 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 2651 | 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 2652 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, | ||
| 2653 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2654 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, | ||
| 2655 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2656 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2657 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2658 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2659 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2660 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2661 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2662 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2663 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2664 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2665 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2666 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2667 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2668 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2669 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2670 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2671 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2672 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2673 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2674 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2675 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2676 | }; | ||
| 2677 | static unsigned short default_key_map_78[NR_KEYS] = { | ||
| 2678 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 2679 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 2680 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 2681 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 2682 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 2683 | 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 2684 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 2685 | 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 2686 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 2687 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2688 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, | ||
| 2689 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2690 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2691 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 2692 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2693 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2694 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2695 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2696 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2697 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2698 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2699 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2700 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2701 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2702 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2703 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2704 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2705 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2706 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2707 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2708 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2709 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2710 | }; | ||
| 2711 | static unsigned short default_key_map_79[NR_KEYS] = { | ||
| 2712 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 2713 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 2714 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 2715 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 2716 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 2717 | 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 2718 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 2719 | 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 2720 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 2721 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2722 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, | ||
| 2723 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2724 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2725 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2726 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2727 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2728 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2729 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2730 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2731 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2732 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2733 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2734 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2735 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2736 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2737 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2738 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2739 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2740 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2741 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2742 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2743 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2744 | }; | ||
| 2745 | static unsigned short default_key_map_80[NR_KEYS] = { | ||
| 2746 | 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, | ||
| 2747 | 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, | ||
| 2748 | 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, | ||
| 2749 | 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, | ||
| 2750 | 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, | ||
| 2751 | 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, | ||
| 2752 | 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, | ||
| 2753 | 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 2754 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 2755 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2756 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, | ||
| 2757 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2758 | 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2759 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2760 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2761 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2762 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2763 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2764 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2765 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2766 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2767 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2768 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2769 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2770 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2771 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2772 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2773 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2774 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2775 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2776 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2777 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2778 | }; | ||
| 2779 | static unsigned short default_key_map_81[NR_KEYS] = { | ||
| 2780 | 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, | ||
| 2781 | 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, | ||
| 2782 | 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, | ||
| 2783 | 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, | ||
| 2784 | 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, | ||
| 2785 | 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, | ||
| 2786 | 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, | ||
| 2787 | 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, | ||
| 2788 | 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, | ||
| 2789 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2790 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, | ||
| 2791 | 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2792 | 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2793 | 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, | ||
| 2794 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2795 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2796 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2797 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2798 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2799 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2800 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2801 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2802 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2803 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2804 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2805 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2806 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2807 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2808 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2809 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2810 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2811 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2812 | }; | ||
| 2813 | static unsigned short default_key_map_82[NR_KEYS] = { | ||
| 2814 | 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, | ||
| 2815 | 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, | ||
| 2816 | 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, | ||
| 2817 | 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, | ||
| 2818 | 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, | ||
| 2819 | 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, | ||
| 2820 | 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, | ||
| 2821 | 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 2822 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, | ||
| 2823 | 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, | ||
| 2824 | 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, | ||
| 2825 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2826 | 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2827 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2828 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2829 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2830 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2831 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2832 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2833 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2834 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2835 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2836 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2837 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2838 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2839 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2840 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2841 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2842 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2843 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2844 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2845 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2846 | }; | ||
| 2847 | static unsigned short default_key_map_83[NR_KEYS] = { | ||
| 2848 | 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, | ||
| 2849 | 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, | ||
| 2850 | 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, | ||
| 2851 | 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, | ||
| 2852 | 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, | ||
| 2853 | 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, | ||
| 2854 | 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, | ||
| 2855 | 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, | ||
| 2856 | 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, | ||
| 2857 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2858 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, | ||
| 2859 | 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2860 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2861 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2862 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 2863 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2864 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2865 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2866 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2867 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2868 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2869 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2870 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2871 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2872 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2873 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2874 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2875 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2876 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2877 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2878 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2879 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2880 | }; | ||
| 2881 | static unsigned short default_key_map_84[NR_KEYS] = { | ||
| 2882 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 2883 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 2884 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 2885 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 2886 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 2887 | 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 2888 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 2889 | 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, | ||
| 2890 | 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, | ||
| 2891 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2892 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, | ||
| 2893 | 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2894 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2895 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2896 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 2897 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2898 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2899 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2900 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2901 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2902 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2903 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2904 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2905 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2906 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2907 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2908 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2909 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2910 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2911 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2912 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2913 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2914 | }; | ||
| 2915 | static unsigned short default_key_map_85[NR_KEYS] = { | ||
| 2916 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 2917 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 2918 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 2919 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 2920 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 2921 | 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 2922 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 2923 | 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, | ||
| 2924 | 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, | ||
| 2925 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2926 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, | ||
| 2927 | 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2928 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2929 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2930 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 2931 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2932 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2933 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2934 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2935 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2936 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2937 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2938 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2939 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2940 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2941 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2942 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2943 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2944 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2945 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2946 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2947 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2948 | }; | ||
| 2949 | static unsigned short default_key_map_86[NR_KEYS] = { | ||
| 2950 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 2951 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 2952 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 2953 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 2954 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 2955 | 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 2956 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 2957 | 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 2958 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, | ||
| 2959 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2960 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, | ||
| 2961 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2962 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2963 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 2964 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 2965 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 2966 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2967 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2968 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2969 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2970 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2971 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2972 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2973 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2974 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2975 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2976 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2977 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2978 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2979 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2980 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2981 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2982 | }; | ||
| 2983 | static unsigned short default_key_map_87[NR_KEYS] = { | ||
| 2984 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 2985 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 2986 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 2987 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 2988 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 2989 | 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 2990 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 2991 | 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, | ||
| 2992 | 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, | ||
| 2993 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 2994 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, | ||
| 2995 | 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 2996 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 2997 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 2998 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 2999 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3000 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3001 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3002 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3003 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3004 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3005 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3006 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3007 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3008 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3009 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3010 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3011 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3012 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3013 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3014 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3015 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3016 | }; | ||
| 3017 | static unsigned short default_key_map_88[NR_KEYS] = { | ||
| 3018 | 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, | ||
| 3019 | 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, | ||
| 3020 | 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, | ||
| 3021 | 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, | ||
| 3022 | 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, | ||
| 3023 | 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, | ||
| 3024 | 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, | ||
| 3025 | 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, | ||
| 3026 | 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, | ||
| 3027 | 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, | ||
| 3028 | 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, | ||
| 3029 | 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3030 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, | ||
| 3031 | 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3032 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3033 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3034 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3035 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3036 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3037 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3038 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3039 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3040 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3041 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3042 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3043 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3044 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3045 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3046 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3047 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3048 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3049 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3050 | }; | ||
| 3051 | static unsigned short default_key_map_89[NR_KEYS] = { | ||
| 3052 | 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, | ||
| 3053 | 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, | ||
| 3054 | 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, | ||
| 3055 | 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, | ||
| 3056 | 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, | ||
| 3057 | 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, | ||
| 3058 | 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, | ||
| 3059 | 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 3060 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, | ||
| 3061 | 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, | ||
| 3062 | 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, | ||
| 3063 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3064 | 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3065 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3066 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3067 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3068 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3069 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3070 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3071 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3072 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3073 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3074 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3075 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3076 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3077 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3078 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3079 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3080 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3081 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3082 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3083 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3084 | }; | ||
| 3085 | static unsigned short default_key_map_90[NR_KEYS] = { | ||
| 3086 | 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, | ||
| 3087 | 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, | ||
| 3088 | 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, | ||
| 3089 | 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, | ||
| 3090 | 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, | ||
| 3091 | 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, | ||
| 3092 | 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, | ||
| 3093 | 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 3094 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 3095 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3096 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, | ||
| 3097 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3098 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3099 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3100 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3101 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3102 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3103 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3104 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3105 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3106 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3107 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3108 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3109 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3110 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3111 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3112 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3113 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3114 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3115 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3116 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3117 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3118 | }; | ||
| 3119 | static unsigned short default_key_map_91[NR_KEYS] = { | ||
| 3120 | 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, | ||
| 3121 | 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, | ||
| 3122 | 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, | ||
| 3123 | 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, | ||
| 3124 | 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, | ||
| 3125 | 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, | ||
| 3126 | 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, | ||
| 3127 | 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 3128 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 3129 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3130 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, | ||
| 3131 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3132 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3133 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3134 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3135 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3136 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3137 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3138 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3139 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3140 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3141 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3142 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3143 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3144 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3145 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3146 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3147 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3148 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3149 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3150 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3151 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3152 | }; | ||
| 3153 | static unsigned short default_key_map_92[NR_KEYS] = { | ||
| 3154 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 3155 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 3156 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 3157 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 3158 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 3159 | 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 3160 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 3161 | 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, | ||
| 3162 | 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, | ||
| 3163 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3164 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, | ||
| 3165 | 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3166 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3167 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 3168 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3169 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3170 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3171 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3172 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3173 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3174 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3175 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3176 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3177 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3178 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3179 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3180 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3181 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3182 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3183 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3184 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3185 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3186 | }; | ||
| 3187 | static unsigned short default_key_map_93[NR_KEYS] = { | ||
| 3188 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 3189 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 3190 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 3191 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 3192 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 3193 | 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 3194 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 3195 | 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 3196 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, | ||
| 3197 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3198 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, | ||
| 3199 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3200 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3201 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3202 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3203 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3204 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3205 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3206 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3207 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3208 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3209 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3210 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3211 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3212 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3213 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3214 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3215 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3216 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3217 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3218 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3219 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3220 | }; | ||
| 3221 | static unsigned short default_key_map_94[NR_KEYS] = { | ||
| 3222 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 3223 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 3224 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 3225 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 3226 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 3227 | 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 3228 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 3229 | 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 3230 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 3231 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3232 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, | ||
| 3233 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3234 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3235 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 3236 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3237 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3238 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3239 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3240 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3241 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3242 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3243 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3244 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3245 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3246 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3247 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3248 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3249 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3250 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3251 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3252 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3253 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3254 | }; | ||
| 3255 | static unsigned short default_key_map_95[NR_KEYS] = { | ||
| 3256 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 3257 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 3258 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 3259 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 3260 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 3261 | 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 3262 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 3263 | 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 3264 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 3265 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3266 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, | ||
| 3267 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3268 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3269 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3270 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3271 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3272 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3273 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3274 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3275 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3276 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3277 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3278 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3279 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3280 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3281 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3282 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3283 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3284 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3285 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3286 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3287 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3288 | }; | ||
| 3289 | static unsigned short default_key_map_96[NR_KEYS] = { | ||
| 3290 | 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, | ||
| 3291 | 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, | ||
| 3292 | 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, | ||
| 3293 | 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, | ||
| 3294 | 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, | ||
| 3295 | 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, | ||
| 3296 | 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, | ||
| 3297 | 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 3298 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 3299 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3300 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, | ||
| 3301 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3302 | 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3303 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3304 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3305 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3306 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3307 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3308 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3309 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3310 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3311 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3312 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3313 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3314 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3315 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3316 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3317 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3318 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3319 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3320 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3321 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3322 | }; | ||
| 3323 | static unsigned short default_key_map_97[NR_KEYS] = { | ||
| 3324 | 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, | ||
| 3325 | 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, | ||
| 3326 | 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, | ||
| 3327 | 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, | ||
| 3328 | 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, | ||
| 3329 | 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, | ||
| 3330 | 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, | ||
| 3331 | 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, | ||
| 3332 | 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, | ||
| 3333 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3334 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, | ||
| 3335 | 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3336 | 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3337 | 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, | ||
| 3338 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3339 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3340 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3341 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3342 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3343 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3344 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3345 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3346 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3347 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3348 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3349 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3350 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3351 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3352 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3353 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3354 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3355 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3356 | }; | ||
| 3357 | static unsigned short default_key_map_98[NR_KEYS] = { | ||
| 3358 | 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, | ||
| 3359 | 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, | ||
| 3360 | 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, | ||
| 3361 | 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, | ||
| 3362 | 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, | ||
| 3363 | 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, | ||
| 3364 | 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, | ||
| 3365 | 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 3366 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, | ||
| 3367 | 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, | ||
| 3368 | 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, | ||
| 3369 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3370 | 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3371 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3372 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3373 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3374 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3375 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3376 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3377 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3378 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3379 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3380 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3381 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3382 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3383 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3384 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3385 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3386 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3387 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3388 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3389 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3390 | }; | ||
| 3391 | static unsigned short default_key_map_99[NR_KEYS] = { | ||
| 3392 | 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, | ||
| 3393 | 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, | ||
| 3394 | 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, | ||
| 3395 | 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, | ||
| 3396 | 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, | ||
| 3397 | 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, | ||
| 3398 | 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, | ||
| 3399 | 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, | ||
| 3400 | 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, | ||
| 3401 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3402 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, | ||
| 3403 | 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3404 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3405 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3406 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3407 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3408 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3409 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3410 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3411 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3412 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3413 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3414 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3415 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3416 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3417 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3418 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3419 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3420 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3421 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3422 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3423 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3424 | }; | ||
| 3425 | static unsigned short default_key_map_100[NR_KEYS] = { | ||
| 3426 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 3427 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 3428 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 3429 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 3430 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 3431 | 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 3432 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 3433 | 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, | ||
| 3434 | 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, | ||
| 3435 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3436 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, | ||
| 3437 | 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3438 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3439 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3440 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 3441 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3442 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3443 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3444 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3445 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3446 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3447 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3448 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3449 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3450 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3451 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3452 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3453 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3454 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3455 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3456 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3457 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3458 | }; | ||
| 3459 | static unsigned short default_key_map_101[NR_KEYS] = { | ||
| 3460 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 3461 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 3462 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 3463 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 3464 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 3465 | 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 3466 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 3467 | 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, | ||
| 3468 | 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, | ||
| 3469 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3470 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, | ||
| 3471 | 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3472 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3473 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3474 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 3475 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3476 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3477 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3478 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3479 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3480 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3481 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3482 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3483 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3484 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3485 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3486 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3487 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3488 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3489 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3490 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3491 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3492 | }; | ||
| 3493 | static unsigned short default_key_map_102[NR_KEYS] = { | ||
| 3494 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 3495 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 3496 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 3497 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 3498 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 3499 | 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 3500 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 3501 | 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 3502 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, | ||
| 3503 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3504 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, | ||
| 3505 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3506 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3507 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 3508 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 3509 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3510 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3511 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3512 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3513 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3514 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3515 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3516 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3517 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3518 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3519 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3520 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3521 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3522 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3523 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3524 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3525 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3526 | }; | ||
| 3527 | static unsigned short default_key_map_103[NR_KEYS] = { | ||
| 3528 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 3529 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 3530 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 3531 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 3532 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 3533 | 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 3534 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 3535 | 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, | ||
| 3536 | 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, | ||
| 3537 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3538 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, | ||
| 3539 | 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3540 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3541 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3542 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 3543 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3544 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3545 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3546 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3547 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3548 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3549 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3550 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3551 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3552 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3553 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3554 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3555 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3556 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3557 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3558 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3559 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3560 | }; | ||
| 3561 | static unsigned short default_key_map_104[NR_KEYS] = { | ||
| 3562 | 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, | ||
| 3563 | 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, | ||
| 3564 | 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, | ||
| 3565 | 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, | ||
| 3566 | 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, | ||
| 3567 | 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, | ||
| 3568 | 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, | ||
| 3569 | 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, | ||
| 3570 | 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, | ||
| 3571 | 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, | ||
| 3572 | 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, | ||
| 3573 | 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3574 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, | ||
| 3575 | 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3576 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3577 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3578 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3579 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3580 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3581 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3582 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3583 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3584 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3585 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3586 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3587 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3588 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3589 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3590 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3591 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3592 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3593 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3594 | }; | ||
| 3595 | static unsigned short default_key_map_105[NR_KEYS] = { | ||
| 3596 | 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, | ||
| 3597 | 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, | ||
| 3598 | 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, | ||
| 3599 | 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, | ||
| 3600 | 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, | ||
| 3601 | 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, | ||
| 3602 | 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, | ||
| 3603 | 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 3604 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, | ||
| 3605 | 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, | ||
| 3606 | 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, | ||
| 3607 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3608 | 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3609 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3610 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3611 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3612 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3613 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3614 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3615 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3616 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3617 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3618 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3619 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3620 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3621 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3622 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3623 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3624 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3625 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3626 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3627 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3628 | }; | ||
| 3629 | static unsigned short default_key_map_106[NR_KEYS] = { | ||
| 3630 | 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, | ||
| 3631 | 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, | ||
| 3632 | 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, | ||
| 3633 | 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, | ||
| 3634 | 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, | ||
| 3635 | 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, | ||
| 3636 | 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, | ||
| 3637 | 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 3638 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 3639 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3640 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, | ||
| 3641 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3642 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3643 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3644 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3645 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3646 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3647 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3648 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3649 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3650 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3651 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3652 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3653 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3654 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3655 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3656 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3657 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3658 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3659 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3660 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3661 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3662 | }; | ||
| 3663 | static unsigned short default_key_map_107[NR_KEYS] = { | ||
| 3664 | 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, | ||
| 3665 | 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, | ||
| 3666 | 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, | ||
| 3667 | 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, | ||
| 3668 | 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, | ||
| 3669 | 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, | ||
| 3670 | 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, | ||
| 3671 | 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 3672 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 3673 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3674 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, | ||
| 3675 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3676 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3677 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3678 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3679 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3680 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3681 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3682 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3683 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3684 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3685 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3686 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3687 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3688 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3689 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3690 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3691 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3692 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3693 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3694 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3695 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3696 | }; | ||
| 3697 | static unsigned short default_key_map_108[NR_KEYS] = { | ||
| 3698 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 3699 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 3700 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 3701 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 3702 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 3703 | 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 3704 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 3705 | 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, | ||
| 3706 | 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, | ||
| 3707 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3708 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, | ||
| 3709 | 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3710 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3711 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 3712 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3713 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3714 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3715 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3716 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3717 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3718 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3719 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3720 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3721 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3722 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3723 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3724 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3725 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3726 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3727 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3728 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3729 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3730 | }; | ||
| 3731 | static unsigned short default_key_map_109[NR_KEYS] = { | ||
| 3732 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 3733 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 3734 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 3735 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 3736 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 3737 | 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 3738 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 3739 | 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 3740 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, | ||
| 3741 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3742 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, | ||
| 3743 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3744 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3745 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3746 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3747 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3748 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3749 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3750 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3751 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3752 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3753 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3754 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3755 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3756 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3757 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3758 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3759 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3760 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3761 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3762 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3763 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3764 | }; | ||
| 3765 | static unsigned short default_key_map_110[NR_KEYS] = { | ||
| 3766 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 3767 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 3768 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 3769 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 3770 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 3771 | 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 3772 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 3773 | 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 3774 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 3775 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3776 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, | ||
| 3777 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3778 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3779 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 3780 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3781 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3782 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3783 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3784 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3785 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3786 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3787 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3788 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3789 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3790 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3791 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3792 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3793 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3794 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3795 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3796 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3797 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3798 | }; | ||
| 3799 | static unsigned short default_key_map_111[NR_KEYS] = { | ||
| 3800 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 3801 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 3802 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 3803 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 3804 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 3805 | 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 3806 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 3807 | 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 3808 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 3809 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3810 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, | ||
| 3811 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3812 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3813 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3814 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3815 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3816 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3817 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3818 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3819 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3820 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3821 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3822 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3823 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3824 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3825 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3826 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3827 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3828 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3829 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3830 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3831 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3832 | }; | ||
| 3833 | static unsigned short default_key_map_112[NR_KEYS] = { | ||
| 3834 | 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, | ||
| 3835 | 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, | ||
| 3836 | 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, | ||
| 3837 | 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, | ||
| 3838 | 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, | ||
| 3839 | 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, | ||
| 3840 | 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, | ||
| 3841 | 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 3842 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 3843 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3844 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, | ||
| 3845 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3846 | 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3847 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3848 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3849 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3850 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3851 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3852 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3853 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3854 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3855 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3856 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3857 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3858 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3859 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3860 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3861 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3862 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3863 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3864 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3865 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3866 | }; | ||
| 3867 | static unsigned short default_key_map_113[NR_KEYS] = { | ||
| 3868 | 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, | ||
| 3869 | 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, | ||
| 3870 | 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, | ||
| 3871 | 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, | ||
| 3872 | 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, | ||
| 3873 | 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, | ||
| 3874 | 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, | ||
| 3875 | 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, | ||
| 3876 | 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, | ||
| 3877 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3878 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, | ||
| 3879 | 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3880 | 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3881 | 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, | ||
| 3882 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3883 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3884 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3885 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3886 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3887 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3888 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3889 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3890 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3891 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3892 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3893 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3894 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3895 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3896 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3897 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3898 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3899 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3900 | }; | ||
| 3901 | static unsigned short default_key_map_114[NR_KEYS] = { | ||
| 3902 | 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, | ||
| 3903 | 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, | ||
| 3904 | 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, | ||
| 3905 | 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, | ||
| 3906 | 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, | ||
| 3907 | 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, | ||
| 3908 | 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, | ||
| 3909 | 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 3910 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, | ||
| 3911 | 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, | ||
| 3912 | 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, | ||
| 3913 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3914 | 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3915 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3916 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3917 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3918 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3919 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3920 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3921 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3922 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3923 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3924 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3925 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3926 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3927 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3928 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3929 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3930 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3931 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3932 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3933 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3934 | }; | ||
| 3935 | static unsigned short default_key_map_115[NR_KEYS] = { | ||
| 3936 | 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, | ||
| 3937 | 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, | ||
| 3938 | 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, | ||
| 3939 | 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, | ||
| 3940 | 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, | ||
| 3941 | 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, | ||
| 3942 | 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, | ||
| 3943 | 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, | ||
| 3944 | 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, | ||
| 3945 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3946 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, | ||
| 3947 | 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3948 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3949 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3950 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 3951 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3952 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3953 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3954 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3955 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3956 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3957 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3958 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3959 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3960 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3961 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3962 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3963 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3964 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3965 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3966 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3967 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3968 | }; | ||
| 3969 | static unsigned short default_key_map_116[NR_KEYS] = { | ||
| 3970 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 3971 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 3972 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 3973 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 3974 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 3975 | 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 3976 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 3977 | 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, | ||
| 3978 | 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, | ||
| 3979 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 3980 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, | ||
| 3981 | 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3982 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 3983 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 3984 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 3985 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 3986 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3987 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3988 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3989 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3990 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3991 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3992 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3993 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3994 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3995 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3996 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3997 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3998 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 3999 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4000 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4001 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4002 | }; | ||
| 4003 | static unsigned short default_key_map_117[NR_KEYS] = { | ||
| 4004 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 4005 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 4006 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 4007 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 4008 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 4009 | 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 4010 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 4011 | 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, | ||
| 4012 | 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, | ||
| 4013 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 4014 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, | ||
| 4015 | 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4016 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 4017 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 4018 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 4019 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 4020 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4021 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4022 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4023 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4024 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4025 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4026 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4027 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4028 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4029 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4030 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4031 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4032 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4033 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4034 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4035 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4036 | }; | ||
| 4037 | static unsigned short default_key_map_118[NR_KEYS] = { | ||
| 4038 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 4039 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 4040 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 4041 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 4042 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 4043 | 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 4044 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 4045 | 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 4046 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, | ||
| 4047 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 4048 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, | ||
| 4049 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4050 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 4051 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 4052 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 4053 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 4054 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4055 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4056 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4057 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4058 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4059 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4060 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4061 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4062 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4063 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4064 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4065 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4066 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4067 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4068 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4069 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4070 | }; | ||
| 4071 | static unsigned short default_key_map_119[NR_KEYS] = { | ||
| 4072 | 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, | ||
| 4073 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, | ||
| 4074 | 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, | ||
| 4075 | 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, | ||
| 4076 | 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, | ||
| 4077 | 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
| 4078 | 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, | ||
| 4079 | 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, | ||
| 4080 | 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, | ||
| 4081 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 4082 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, | ||
| 4083 | 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4084 | 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 4085 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 4086 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, | ||
| 4087 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 4088 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4089 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4090 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4091 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4092 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4093 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4094 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4095 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4096 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4097 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4098 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4099 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4100 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4101 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4102 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4103 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4104 | }; | ||
| 4105 | static unsigned short default_key_map_120[NR_KEYS] = { | ||
| 4106 | 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, | ||
| 4107 | 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, | ||
| 4108 | 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, | ||
| 4109 | 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, | ||
| 4110 | 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, | ||
| 4111 | 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, | ||
| 4112 | 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, | ||
| 4113 | 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, | ||
| 4114 | 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, | ||
| 4115 | 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, | ||
| 4116 | 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, | ||
| 4117 | 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4118 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, | ||
| 4119 | 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 4120 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 4121 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 4122 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4123 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4124 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4125 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4126 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4127 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4128 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4129 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4130 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4131 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4132 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4133 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4134 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4135 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4136 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4137 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4138 | }; | ||
| 4139 | static unsigned short default_key_map_121[NR_KEYS] = { | ||
| 4140 | 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, | ||
| 4141 | 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, | ||
| 4142 | 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, | ||
| 4143 | 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, | ||
| 4144 | 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, | ||
| 4145 | 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, | ||
| 4146 | 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, | ||
| 4147 | 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 4148 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, | ||
| 4149 | 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, | ||
| 4150 | 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, | ||
| 4151 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4152 | 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 4153 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 4154 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 4155 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 4156 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4157 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4158 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4159 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4160 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4161 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4162 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4163 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4164 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4165 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4166 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4167 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4168 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4169 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4170 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4171 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4172 | }; | ||
| 4173 | static unsigned short default_key_map_122[NR_KEYS] = { | ||
| 4174 | 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, | ||
| 4175 | 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, | ||
| 4176 | 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, | ||
| 4177 | 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, | ||
| 4178 | 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, | ||
| 4179 | 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, | ||
| 4180 | 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, | ||
| 4181 | 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 4182 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 4183 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 4184 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, | ||
| 4185 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4186 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 4187 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 4188 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 4189 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 4190 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4191 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4192 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4193 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4194 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4195 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4196 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4197 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4198 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4199 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4200 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4201 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4202 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4203 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4204 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4205 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4206 | }; | ||
| 4207 | static unsigned short default_key_map_123[NR_KEYS] = { | ||
| 4208 | 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, | ||
| 4209 | 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, | ||
| 4210 | 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, | ||
| 4211 | 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, | ||
| 4212 | 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, | ||
| 4213 | 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, | ||
| 4214 | 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, | ||
| 4215 | 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 4216 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 4217 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 4218 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, | ||
| 4219 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4220 | 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 4221 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 4222 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 4223 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 4224 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4225 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4226 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4227 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4228 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4229 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4230 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4231 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4232 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4233 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4234 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4235 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4236 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4237 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4238 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4239 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4240 | }; | ||
| 4241 | static unsigned short default_key_map_124[NR_KEYS] = { | ||
| 4242 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 4243 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 4244 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 4245 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 4246 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 4247 | 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 4248 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 4249 | 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, | ||
| 4250 | 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, | ||
| 4251 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 4252 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, | ||
| 4253 | 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4254 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 4255 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 4256 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 4257 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 4258 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4259 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4260 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4261 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4262 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4263 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4264 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4265 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4266 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4267 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4268 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4269 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4270 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4271 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4272 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4273 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4274 | }; | ||
| 4275 | static unsigned short default_key_map_125[NR_KEYS] = { | ||
| 4276 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 4277 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 4278 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 4279 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 4280 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 4281 | 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 4282 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 4283 | 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, | ||
| 4284 | 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, | ||
| 4285 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 4286 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, | ||
| 4287 | 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4288 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 4289 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 4290 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 4291 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 4292 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4293 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4294 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4295 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4296 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4297 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4298 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4299 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4300 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4301 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4302 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4303 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4304 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4305 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4306 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4307 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4308 | }; | ||
| 4309 | static unsigned short default_key_map_126[NR_KEYS] = { | ||
| 4310 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 4311 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 4312 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 4313 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 4314 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 4315 | 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 4316 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 4317 | 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 4318 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 4319 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 4320 | 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, | ||
| 4321 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4322 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 4323 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, | ||
| 4324 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 4325 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 4326 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4327 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4328 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4329 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4330 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4331 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4332 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4333 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4334 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4335 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4336 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4337 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4338 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4339 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4340 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4341 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4342 | }; | ||
| 4343 | static unsigned short default_key_map_127[NR_KEYS] = { | ||
| 4344 | 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, | ||
| 4345 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, | ||
| 4346 | 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, | ||
| 4347 | 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, | ||
| 4348 | 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, | ||
| 4349 | 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
| 4350 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, | ||
| 4351 | 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, | ||
| 4352 | 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, | ||
| 4353 | 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, | ||
| 4354 | 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, | ||
| 4355 | 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4356 | 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, | ||
| 4357 | 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, | ||
| 4358 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, | ||
| 4359 | 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, | ||
| 4360 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4361 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4362 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4363 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4364 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4365 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4366 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4367 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4368 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4369 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4370 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4371 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4372 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4373 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4374 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4375 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
| 4376 | }; | ||
| 4377 | #endif /* INCLUDE_EXTENDED_KEYMAP */ | ||
| 4378 | |||
| 4379 | /* *INDENT-ON* */ /* clang-format on */ | ||
| 4380 | |||
| 4381 | static unsigned short *default_key_maps[MAX_NR_KEYMAPS] = { | ||
| 4382 | default_key_map_0, | ||
| 4383 | default_key_map_1, | ||
| 4384 | default_key_map_2, | ||
| 4385 | default_key_map_3, | ||
| 4386 | #ifdef INCLUDE_EXTENDED_KEYMAP | ||
| 4387 | default_key_map_4, | ||
| 4388 | default_key_map_5, | ||
| 4389 | default_key_map_6, | ||
| 4390 | default_key_map_7, | ||
| 4391 | default_key_map_8, | ||
| 4392 | default_key_map_9, | ||
| 4393 | default_key_map_10, | ||
| 4394 | default_key_map_11, | ||
| 4395 | default_key_map_12, | ||
| 4396 | default_key_map_13, | ||
| 4397 | default_key_map_14, | ||
| 4398 | default_key_map_15, | ||
| 4399 | default_key_map_16, | ||
| 4400 | default_key_map_17, | ||
| 4401 | default_key_map_18, | ||
| 4402 | default_key_map_19, | ||
| 4403 | default_key_map_20, | ||
| 4404 | default_key_map_21, | ||
| 4405 | default_key_map_22, | ||
| 4406 | default_key_map_23, | ||
| 4407 | default_key_map_24, | ||
| 4408 | default_key_map_25, | ||
| 4409 | default_key_map_26, | ||
| 4410 | default_key_map_27, | ||
| 4411 | default_key_map_28, | ||
| 4412 | default_key_map_29, | ||
| 4413 | default_key_map_30, | ||
| 4414 | default_key_map_31, | ||
| 4415 | default_key_map_32, | ||
| 4416 | default_key_map_33, | ||
| 4417 | default_key_map_34, | ||
| 4418 | default_key_map_35, | ||
| 4419 | default_key_map_36, | ||
| 4420 | default_key_map_37, | ||
| 4421 | default_key_map_38, | ||
| 4422 | default_key_map_39, | ||
| 4423 | default_key_map_40, | ||
| 4424 | default_key_map_41, | ||
| 4425 | default_key_map_42, | ||
| 4426 | default_key_map_43, | ||
| 4427 | default_key_map_44, | ||
| 4428 | default_key_map_45, | ||
| 4429 | default_key_map_46, | ||
| 4430 | default_key_map_47, | ||
| 4431 | default_key_map_48, | ||
| 4432 | default_key_map_49, | ||
| 4433 | default_key_map_50, | ||
| 4434 | default_key_map_51, | ||
| 4435 | default_key_map_52, | ||
| 4436 | default_key_map_53, | ||
| 4437 | default_key_map_54, | ||
| 4438 | default_key_map_55, | ||
| 4439 | default_key_map_56, | ||
| 4440 | default_key_map_57, | ||
| 4441 | default_key_map_58, | ||
| 4442 | default_key_map_59, | ||
| 4443 | default_key_map_60, | ||
| 4444 | default_key_map_61, | ||
| 4445 | default_key_map_62, | ||
| 4446 | default_key_map_63, | ||
| 4447 | default_key_map_64, | ||
| 4448 | default_key_map_65, | ||
| 4449 | default_key_map_66, | ||
| 4450 | default_key_map_67, | ||
| 4451 | default_key_map_68, | ||
| 4452 | default_key_map_69, | ||
| 4453 | default_key_map_70, | ||
| 4454 | default_key_map_71, | ||
| 4455 | default_key_map_72, | ||
| 4456 | default_key_map_73, | ||
| 4457 | default_key_map_74, | ||
| 4458 | default_key_map_75, | ||
| 4459 | default_key_map_76, | ||
| 4460 | default_key_map_77, | ||
| 4461 | default_key_map_78, | ||
| 4462 | default_key_map_79, | ||
| 4463 | default_key_map_80, | ||
| 4464 | default_key_map_81, | ||
| 4465 | default_key_map_82, | ||
| 4466 | default_key_map_83, | ||
| 4467 | default_key_map_84, | ||
| 4468 | default_key_map_85, | ||
| 4469 | default_key_map_86, | ||
| 4470 | default_key_map_87, | ||
| 4471 | default_key_map_88, | ||
| 4472 | default_key_map_89, | ||
| 4473 | default_key_map_90, | ||
| 4474 | default_key_map_91, | ||
| 4475 | default_key_map_92, | ||
| 4476 | default_key_map_93, | ||
| 4477 | default_key_map_94, | ||
| 4478 | default_key_map_95, | ||
| 4479 | default_key_map_96, | ||
| 4480 | default_key_map_97, | ||
| 4481 | default_key_map_98, | ||
| 4482 | default_key_map_99, | ||
| 4483 | default_key_map_100, | ||
| 4484 | default_key_map_101, | ||
| 4485 | default_key_map_102, | ||
| 4486 | default_key_map_103, | ||
| 4487 | default_key_map_104, | ||
| 4488 | default_key_map_105, | ||
| 4489 | default_key_map_106, | ||
| 4490 | default_key_map_107, | ||
| 4491 | default_key_map_108, | ||
| 4492 | default_key_map_109, | ||
| 4493 | default_key_map_110, | ||
| 4494 | default_key_map_111, | ||
| 4495 | default_key_map_112, | ||
| 4496 | default_key_map_113, | ||
| 4497 | default_key_map_114, | ||
| 4498 | default_key_map_115, | ||
| 4499 | default_key_map_116, | ||
| 4500 | default_key_map_117, | ||
| 4501 | default_key_map_118, | ||
| 4502 | default_key_map_119, | ||
| 4503 | default_key_map_120, | ||
| 4504 | default_key_map_121, | ||
| 4505 | default_key_map_122, | ||
| 4506 | default_key_map_123, | ||
| 4507 | default_key_map_124, | ||
| 4508 | default_key_map_125, | ||
| 4509 | default_key_map_126, | ||
| 4510 | default_key_map_127, | ||
| 4511 | #else /* !INCLUDE_EXTENDED_KEYMAP */ | ||
| 4512 | NULL, | ||
| 4513 | NULL, | ||
| 4514 | NULL, | ||
| 4515 | NULL, | ||
| 4516 | NULL, | ||
| 4517 | NULL, | ||
| 4518 | NULL, | ||
| 4519 | NULL, | ||
| 4520 | NULL, | ||
| 4521 | NULL, | ||
| 4522 | NULL, | ||
| 4523 | NULL, | ||
| 4524 | NULL, | ||
| 4525 | NULL, | ||
| 4526 | NULL, | ||
| 4527 | NULL, | ||
| 4528 | NULL, | ||
| 4529 | NULL, | ||
| 4530 | NULL, | ||
| 4531 | NULL, | ||
| 4532 | NULL, | ||
| 4533 | NULL, | ||
| 4534 | NULL, | ||
| 4535 | NULL, | ||
| 4536 | NULL, | ||
| 4537 | NULL, | ||
| 4538 | NULL, | ||
| 4539 | NULL, | ||
| 4540 | NULL, | ||
| 4541 | NULL, | ||
| 4542 | NULL, | ||
| 4543 | NULL, | ||
| 4544 | NULL, | ||
| 4545 | NULL, | ||
| 4546 | NULL, | ||
| 4547 | NULL, | ||
| 4548 | NULL, | ||
| 4549 | NULL, | ||
| 4550 | NULL, | ||
| 4551 | NULL, | ||
| 4552 | NULL, | ||
| 4553 | NULL, | ||
| 4554 | NULL, | ||
| 4555 | NULL, | ||
| 4556 | NULL, | ||
| 4557 | NULL, | ||
| 4558 | NULL, | ||
| 4559 | NULL, | ||
| 4560 | NULL, | ||
| 4561 | NULL, | ||
| 4562 | NULL, | ||
| 4563 | NULL, | ||
| 4564 | NULL, | ||
| 4565 | NULL, | ||
| 4566 | NULL, | ||
| 4567 | NULL, | ||
| 4568 | NULL, | ||
| 4569 | NULL, | ||
| 4570 | NULL, | ||
| 4571 | NULL, | ||
| 4572 | NULL, | ||
| 4573 | NULL, | ||
| 4574 | NULL, | ||
| 4575 | NULL, | ||
| 4576 | NULL, | ||
| 4577 | NULL, | ||
| 4578 | NULL, | ||
| 4579 | NULL, | ||
| 4580 | NULL, | ||
| 4581 | NULL, | ||
| 4582 | NULL, | ||
| 4583 | NULL, | ||
| 4584 | NULL, | ||
| 4585 | NULL, | ||
| 4586 | NULL, | ||
| 4587 | NULL, | ||
| 4588 | NULL, | ||
| 4589 | NULL, | ||
| 4590 | NULL, | ||
| 4591 | NULL, | ||
| 4592 | NULL, | ||
| 4593 | NULL, | ||
| 4594 | NULL, | ||
| 4595 | NULL, | ||
| 4596 | NULL, | ||
| 4597 | NULL, | ||
| 4598 | NULL, | ||
| 4599 | NULL, | ||
| 4600 | NULL, | ||
| 4601 | NULL, | ||
| 4602 | NULL, | ||
| 4603 | NULL, | ||
| 4604 | NULL, | ||
| 4605 | NULL, | ||
| 4606 | NULL, | ||
| 4607 | NULL, | ||
| 4608 | NULL, | ||
| 4609 | NULL, | ||
| 4610 | NULL, | ||
| 4611 | NULL, | ||
| 4612 | NULL, | ||
| 4613 | NULL, | ||
| 4614 | NULL, | ||
| 4615 | NULL, | ||
| 4616 | NULL, | ||
| 4617 | NULL, | ||
| 4618 | NULL, | ||
| 4619 | NULL, | ||
| 4620 | NULL, | ||
| 4621 | NULL, | ||
| 4622 | NULL, | ||
| 4623 | NULL, | ||
| 4624 | NULL, | ||
| 4625 | NULL, | ||
| 4626 | NULL, | ||
| 4627 | NULL, | ||
| 4628 | NULL, | ||
| 4629 | NULL, | ||
| 4630 | NULL, | ||
| 4631 | NULL, | ||
| 4632 | NULL, | ||
| 4633 | NULL, | ||
| 4634 | NULL, | ||
| 4635 | NULL, | ||
| 4636 | #endif /* INCLUDE_EXTENDED_KEYMAP */ | ||
| 4637 | NULL, | ||
| 4638 | NULL, | ||
| 4639 | NULL, | ||
| 4640 | NULL, | ||
| 4641 | NULL, | ||
| 4642 | NULL, | ||
| 4643 | NULL, | ||
| 4644 | NULL, | ||
| 4645 | NULL, | ||
| 4646 | NULL, | ||
| 4647 | NULL, | ||
| 4648 | NULL, | ||
| 4649 | NULL, | ||
| 4650 | NULL, | ||
| 4651 | NULL, | ||
| 4652 | NULL, | ||
| 4653 | NULL, | ||
| 4654 | NULL, | ||
| 4655 | NULL, | ||
| 4656 | NULL, | ||
| 4657 | NULL, | ||
| 4658 | NULL, | ||
| 4659 | NULL, | ||
| 4660 | NULL, | ||
| 4661 | NULL, | ||
| 4662 | NULL, | ||
| 4663 | NULL, | ||
| 4664 | NULL, | ||
| 4665 | NULL, | ||
| 4666 | NULL, | ||
| 4667 | NULL, | ||
| 4668 | NULL, | ||
| 4669 | NULL, | ||
| 4670 | NULL, | ||
| 4671 | NULL, | ||
| 4672 | NULL, | ||
| 4673 | NULL, | ||
| 4674 | NULL, | ||
| 4675 | NULL, | ||
| 4676 | NULL, | ||
| 4677 | NULL, | ||
| 4678 | NULL, | ||
| 4679 | NULL, | ||
| 4680 | NULL, | ||
| 4681 | NULL, | ||
| 4682 | NULL, | ||
| 4683 | NULL, | ||
| 4684 | NULL, | ||
| 4685 | NULL, | ||
| 4686 | NULL, | ||
| 4687 | NULL, | ||
| 4688 | NULL, | ||
| 4689 | NULL, | ||
| 4690 | NULL, | ||
| 4691 | NULL, | ||
| 4692 | NULL, | ||
| 4693 | NULL, | ||
| 4694 | NULL, | ||
| 4695 | NULL, | ||
| 4696 | NULL, | ||
| 4697 | NULL, | ||
| 4698 | NULL, | ||
| 4699 | NULL, | ||
| 4700 | NULL, | ||
| 4701 | NULL, | ||
| 4702 | NULL, | ||
| 4703 | NULL, | ||
| 4704 | NULL, | ||
| 4705 | NULL, | ||
| 4706 | NULL, | ||
| 4707 | NULL, | ||
| 4708 | NULL, | ||
| 4709 | NULL, | ||
| 4710 | NULL, | ||
| 4711 | NULL, | ||
| 4712 | NULL, | ||
| 4713 | NULL, | ||
| 4714 | NULL, | ||
| 4715 | NULL, | ||
| 4716 | NULL, | ||
| 4717 | NULL, | ||
| 4718 | NULL, | ||
| 4719 | NULL, | ||
| 4720 | NULL, | ||
| 4721 | NULL, | ||
| 4722 | NULL, | ||
| 4723 | NULL, | ||
| 4724 | NULL, | ||
| 4725 | NULL, | ||
| 4726 | NULL, | ||
| 4727 | NULL, | ||
| 4728 | NULL, | ||
| 4729 | NULL, | ||
| 4730 | NULL, | ||
| 4731 | NULL, | ||
| 4732 | NULL, | ||
| 4733 | NULL, | ||
| 4734 | NULL, | ||
| 4735 | NULL, | ||
| 4736 | NULL, | ||
| 4737 | NULL, | ||
| 4738 | NULL, | ||
| 4739 | NULL, | ||
| 4740 | NULL, | ||
| 4741 | NULL, | ||
| 4742 | NULL, | ||
| 4743 | NULL, | ||
| 4744 | NULL, | ||
| 4745 | NULL, | ||
| 4746 | NULL, | ||
| 4747 | NULL, | ||
| 4748 | NULL, | ||
| 4749 | NULL, | ||
| 4750 | NULL, | ||
| 4751 | NULL, | ||
| 4752 | NULL, | ||
| 4753 | NULL, | ||
| 4754 | NULL, | ||
| 4755 | NULL, | ||
| 4756 | NULL, | ||
| 4757 | NULL, | ||
| 4758 | NULL, | ||
| 4759 | NULL, | ||
| 4760 | NULL, | ||
| 4761 | NULL, | ||
| 4762 | NULL, | ||
| 4763 | NULL, | ||
| 4764 | NULL, | ||
| 4765 | }; | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_fcitx.c b/contrib/SDL-3.2.8/src/core/linux/SDL_fcitx.c new file mode 100644 index 0000000..d7a9ed6 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_fcitx.c | |||
| @@ -0,0 +1,460 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #include <unistd.h> | ||
| 24 | |||
| 25 | #include "SDL_fcitx.h" | ||
| 26 | #include "../../video/SDL_sysvideo.h" | ||
| 27 | #include "../../events/SDL_keyboard_c.h" | ||
| 28 | #include "SDL_dbus.h" | ||
| 29 | |||
| 30 | #ifdef SDL_VIDEO_DRIVER_X11 | ||
| 31 | #include "../../video/x11/SDL_x11video.h" | ||
| 32 | #endif | ||
| 33 | |||
| 34 | #define FCITX_DBUS_SERVICE "org.freedesktop.portal.Fcitx" | ||
| 35 | |||
| 36 | #define FCITX_IM_DBUS_PATH "/org/freedesktop/portal/inputmethod" | ||
| 37 | |||
| 38 | #define FCITX_IM_DBUS_INTERFACE "org.fcitx.Fcitx.InputMethod1" | ||
| 39 | #define FCITX_IC_DBUS_INTERFACE "org.fcitx.Fcitx.InputContext1" | ||
| 40 | |||
| 41 | #define DBUS_TIMEOUT 500 | ||
| 42 | |||
| 43 | typedef struct FcitxClient | ||
| 44 | { | ||
| 45 | SDL_DBusContext *dbus; | ||
| 46 | |||
| 47 | char *ic_path; | ||
| 48 | |||
| 49 | int id; | ||
| 50 | |||
| 51 | SDL_Rect cursor_rect; | ||
| 52 | } FcitxClient; | ||
| 53 | |||
| 54 | static FcitxClient fcitx_client; | ||
| 55 | |||
| 56 | static char *GetAppName(void) | ||
| 57 | { | ||
| 58 | #if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_FREEBSD) | ||
| 59 | char *spot; | ||
| 60 | char procfile[1024]; | ||
| 61 | char linkfile[1024]; | ||
| 62 | int linksize; | ||
| 63 | |||
| 64 | #ifdef SDL_PLATFORM_LINUX | ||
| 65 | (void)SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/exe", getpid()); | ||
| 66 | #elif defined(SDL_PLATFORM_FREEBSD) | ||
| 67 | (void)SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/file", getpid()); | ||
| 68 | #endif | ||
| 69 | linksize = readlink(procfile, linkfile, sizeof(linkfile) - 1); | ||
| 70 | if (linksize > 0) { | ||
| 71 | linkfile[linksize] = '\0'; | ||
| 72 | spot = SDL_strrchr(linkfile, '/'); | ||
| 73 | if (spot) { | ||
| 74 | return SDL_strdup(spot + 1); | ||
| 75 | } else { | ||
| 76 | return SDL_strdup(linkfile); | ||
| 77 | } | ||
| 78 | } | ||
| 79 | #endif // SDL_PLATFORM_LINUX || SDL_PLATFORM_FREEBSD | ||
| 80 | |||
| 81 | return SDL_strdup("SDL_App"); | ||
| 82 | } | ||
| 83 | |||
| 84 | static size_t Fcitx_GetPreeditString(SDL_DBusContext *dbus, | ||
| 85 | DBusMessage *msg, | ||
| 86 | char **ret, | ||
| 87 | Sint32 *start_pos, | ||
| 88 | Sint32 *end_pos) | ||
| 89 | { | ||
| 90 | char *text = NULL, *subtext; | ||
| 91 | size_t text_bytes = 0; | ||
| 92 | DBusMessageIter iter, array, sub; | ||
| 93 | Sint32 p_start_pos = -1; | ||
| 94 | Sint32 p_end_pos = -1; | ||
| 95 | |||
| 96 | dbus->message_iter_init(msg, &iter); | ||
| 97 | // Message type is a(si)i, we only need string part | ||
| 98 | if (dbus->message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) { | ||
| 99 | size_t pos = 0; | ||
| 100 | // First pass: calculate string length | ||
| 101 | dbus->message_iter_recurse(&iter, &array); | ||
| 102 | while (dbus->message_iter_get_arg_type(&array) == DBUS_TYPE_STRUCT) { | ||
| 103 | dbus->message_iter_recurse(&array, &sub); | ||
| 104 | subtext = NULL; | ||
| 105 | if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_STRING) { | ||
| 106 | dbus->message_iter_get_basic(&sub, &subtext); | ||
| 107 | if (subtext && *subtext) { | ||
| 108 | text_bytes += SDL_strlen(subtext); | ||
| 109 | } | ||
| 110 | } | ||
| 111 | dbus->message_iter_next(&sub); | ||
| 112 | if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_INT32 && p_end_pos == -1) { | ||
| 113 | // Type is a bit field defined as follows: | ||
| 114 | // bit 3: Underline, bit 4: HighLight, bit 5: DontCommit, | ||
| 115 | // bit 6: Bold, bit 7: Strike, bit 8: Italic | ||
| 116 | Sint32 type; | ||
| 117 | dbus->message_iter_get_basic(&sub, &type); | ||
| 118 | // We only consider highlight | ||
| 119 | if (type & (1 << 4)) { | ||
| 120 | if (p_start_pos == -1) { | ||
| 121 | p_start_pos = pos; | ||
| 122 | } | ||
| 123 | } else if (p_start_pos != -1 && p_end_pos == -1) { | ||
| 124 | p_end_pos = pos; | ||
| 125 | } | ||
| 126 | } | ||
| 127 | dbus->message_iter_next(&array); | ||
| 128 | if (subtext && *subtext) { | ||
| 129 | pos += SDL_utf8strlen(subtext); | ||
| 130 | } | ||
| 131 | } | ||
| 132 | if (p_start_pos != -1 && p_end_pos == -1) { | ||
| 133 | p_end_pos = pos; | ||
| 134 | } | ||
| 135 | if (text_bytes) { | ||
| 136 | text = SDL_malloc(text_bytes + 1); | ||
| 137 | } | ||
| 138 | |||
| 139 | if (text) { | ||
| 140 | char *pivot = text; | ||
| 141 | // Second pass: join all the sub string | ||
| 142 | dbus->message_iter_recurse(&iter, &array); | ||
| 143 | while (dbus->message_iter_get_arg_type(&array) == DBUS_TYPE_STRUCT) { | ||
| 144 | dbus->message_iter_recurse(&array, &sub); | ||
| 145 | if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_STRING) { | ||
| 146 | dbus->message_iter_get_basic(&sub, &subtext); | ||
| 147 | if (subtext && *subtext) { | ||
| 148 | size_t length = SDL_strlen(subtext); | ||
| 149 | SDL_strlcpy(pivot, subtext, length + 1); | ||
| 150 | pivot += length; | ||
| 151 | } | ||
| 152 | } | ||
| 153 | dbus->message_iter_next(&array); | ||
| 154 | } | ||
| 155 | } else { | ||
| 156 | text_bytes = 0; | ||
| 157 | } | ||
| 158 | } | ||
| 159 | |||
| 160 | *ret = text; | ||
| 161 | *start_pos = p_start_pos; | ||
| 162 | *end_pos = p_end_pos; | ||
| 163 | return text_bytes; | ||
| 164 | } | ||
| 165 | |||
| 166 | static Sint32 Fcitx_GetPreeditCursorByte(SDL_DBusContext *dbus, DBusMessage *msg) | ||
| 167 | { | ||
| 168 | Sint32 byte = -1; | ||
| 169 | DBusMessageIter iter; | ||
| 170 | |||
| 171 | dbus->message_iter_init(msg, &iter); | ||
| 172 | |||
| 173 | dbus->message_iter_next(&iter); | ||
| 174 | |||
| 175 | if (dbus->message_iter_get_arg_type(&iter) != DBUS_TYPE_INT32) { | ||
| 176 | return -1; | ||
| 177 | } | ||
| 178 | |||
| 179 | dbus->message_iter_get_basic(&iter, &byte); | ||
| 180 | |||
| 181 | return byte; | ||
| 182 | } | ||
| 183 | |||
| 184 | static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) | ||
| 185 | { | ||
| 186 | SDL_DBusContext *dbus = (SDL_DBusContext *)data; | ||
| 187 | |||
| 188 | if (dbus->message_is_signal(msg, FCITX_IC_DBUS_INTERFACE, "CommitString")) { | ||
| 189 | DBusMessageIter iter; | ||
| 190 | const char *text = NULL; | ||
| 191 | |||
| 192 | dbus->message_iter_init(msg, &iter); | ||
| 193 | dbus->message_iter_get_basic(&iter, &text); | ||
| 194 | |||
| 195 | SDL_SendKeyboardText(text); | ||
| 196 | |||
| 197 | return DBUS_HANDLER_RESULT_HANDLED; | ||
| 198 | } | ||
| 199 | |||
| 200 | if (dbus->message_is_signal(msg, FCITX_IC_DBUS_INTERFACE, "UpdateFormattedPreedit")) { | ||
| 201 | char *text = NULL; | ||
| 202 | Sint32 start_pos, end_pos; | ||
| 203 | size_t text_bytes = Fcitx_GetPreeditString(dbus, msg, &text, &start_pos, &end_pos); | ||
| 204 | if (text_bytes) { | ||
| 205 | if (start_pos == -1) { | ||
| 206 | Sint32 byte_pos = Fcitx_GetPreeditCursorByte(dbus, msg); | ||
| 207 | start_pos = byte_pos >= 0 ? SDL_utf8strnlen(text, byte_pos) : -1; | ||
| 208 | } | ||
| 209 | SDL_SendEditingText(text, start_pos, end_pos >= 0 ? end_pos - start_pos : -1); | ||
| 210 | SDL_free(text); | ||
| 211 | } else { | ||
| 212 | SDL_SendEditingText("", 0, 0); | ||
| 213 | } | ||
| 214 | |||
| 215 | SDL_Fcitx_UpdateTextInputArea(SDL_GetKeyboardFocus()); | ||
| 216 | return DBUS_HANDLER_RESULT_HANDLED; | ||
| 217 | } | ||
| 218 | |||
| 219 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | ||
| 220 | } | ||
| 221 | |||
| 222 | static void FcitxClientICCallMethod(FcitxClient *client, const char *method) | ||
| 223 | { | ||
| 224 | if (!client->ic_path) { | ||
| 225 | return; | ||
| 226 | } | ||
| 227 | SDL_DBus_CallVoidMethod(FCITX_DBUS_SERVICE, client->ic_path, FCITX_IC_DBUS_INTERFACE, method, DBUS_TYPE_INVALID); | ||
| 228 | } | ||
| 229 | |||
| 230 | static void SDLCALL Fcitx_SetCapabilities(void *data, | ||
| 231 | const char *name, | ||
| 232 | const char *old_val, | ||
| 233 | const char *hint) | ||
| 234 | { | ||
| 235 | FcitxClient *client = (FcitxClient *)data; | ||
| 236 | Uint64 caps = 0; | ||
| 237 | if (!client->ic_path) { | ||
| 238 | return; | ||
| 239 | } | ||
| 240 | |||
| 241 | if (hint && SDL_strstr(hint, "composition")) { | ||
| 242 | caps |= (1 << 1); // Preedit Flag | ||
| 243 | caps |= (1 << 4); // Formatted Preedit Flag | ||
| 244 | } | ||
| 245 | if (hint && SDL_strstr(hint, "candidates")) { | ||
| 246 | // FIXME, turn off native candidate rendering | ||
| 247 | } | ||
| 248 | |||
| 249 | SDL_DBus_CallVoidMethod(FCITX_DBUS_SERVICE, client->ic_path, FCITX_IC_DBUS_INTERFACE, "SetCapability", DBUS_TYPE_UINT64, &caps, DBUS_TYPE_INVALID); | ||
| 250 | } | ||
| 251 | |||
| 252 | static bool FcitxCreateInputContext(SDL_DBusContext *dbus, const char *appname, char **ic_path) | ||
| 253 | { | ||
| 254 | const char *program = "program"; | ||
| 255 | bool result = false; | ||
| 256 | |||
| 257 | if (dbus && dbus->session_conn) { | ||
| 258 | DBusMessage *msg = dbus->message_new_method_call(FCITX_DBUS_SERVICE, FCITX_IM_DBUS_PATH, FCITX_IM_DBUS_INTERFACE, "CreateInputContext"); | ||
| 259 | if (msg) { | ||
| 260 | DBusMessage *reply = NULL; | ||
| 261 | DBusMessageIter args, array, sub; | ||
| 262 | dbus->message_iter_init_append(msg, &args); | ||
| 263 | dbus->message_iter_open_container(&args, DBUS_TYPE_ARRAY, "(ss)", &array); | ||
| 264 | dbus->message_iter_open_container(&array, DBUS_TYPE_STRUCT, 0, &sub); | ||
| 265 | dbus->message_iter_append_basic(&sub, DBUS_TYPE_STRING, &program); | ||
| 266 | dbus->message_iter_append_basic(&sub, DBUS_TYPE_STRING, &appname); | ||
| 267 | dbus->message_iter_close_container(&array, &sub); | ||
| 268 | dbus->message_iter_close_container(&args, &array); | ||
| 269 | reply = dbus->connection_send_with_reply_and_block(dbus->session_conn, msg, 300, NULL); | ||
| 270 | if (reply) { | ||
| 271 | if (dbus->message_get_args(reply, NULL, DBUS_TYPE_OBJECT_PATH, ic_path, DBUS_TYPE_INVALID)) { | ||
| 272 | result = true; | ||
| 273 | } | ||
| 274 | dbus->message_unref(reply); | ||
| 275 | } | ||
| 276 | dbus->message_unref(msg); | ||
| 277 | } | ||
| 278 | } | ||
| 279 | return result; | ||
| 280 | } | ||
| 281 | |||
| 282 | static bool FcitxClientCreateIC(FcitxClient *client) | ||
| 283 | { | ||
| 284 | char *appname = GetAppName(); | ||
| 285 | char *ic_path = NULL; | ||
| 286 | SDL_DBusContext *dbus = client->dbus; | ||
| 287 | |||
| 288 | // SDL_DBus_CallMethod cannot handle a(ss) type, call dbus function directly | ||
| 289 | if (!FcitxCreateInputContext(dbus, appname, &ic_path)) { | ||
| 290 | ic_path = NULL; // just in case. | ||
| 291 | } | ||
| 292 | |||
| 293 | SDL_free(appname); | ||
| 294 | |||
| 295 | if (ic_path) { | ||
| 296 | SDL_free(client->ic_path); | ||
| 297 | client->ic_path = SDL_strdup(ic_path); | ||
| 298 | |||
| 299 | dbus->bus_add_match(dbus->session_conn, | ||
| 300 | "type='signal', interface='org.fcitx.Fcitx.InputContext1'", | ||
| 301 | NULL); | ||
| 302 | dbus->connection_add_filter(dbus->session_conn, | ||
| 303 | &DBus_MessageFilter, dbus, | ||
| 304 | NULL); | ||
| 305 | dbus->connection_flush(dbus->session_conn); | ||
| 306 | |||
| 307 | SDL_AddHintCallback(SDL_HINT_IME_IMPLEMENTED_UI, Fcitx_SetCapabilities, client); | ||
| 308 | return true; | ||
| 309 | } | ||
| 310 | |||
| 311 | return false; | ||
| 312 | } | ||
| 313 | |||
| 314 | static Uint32 Fcitx_ModState(void) | ||
| 315 | { | ||
| 316 | Uint32 fcitx_mods = 0; | ||
| 317 | SDL_Keymod sdl_mods = SDL_GetModState(); | ||
| 318 | |||
| 319 | if (sdl_mods & SDL_KMOD_SHIFT) { | ||
| 320 | fcitx_mods |= (1 << 0); | ||
| 321 | } | ||
| 322 | if (sdl_mods & SDL_KMOD_CAPS) { | ||
| 323 | fcitx_mods |= (1 << 1); | ||
| 324 | } | ||
| 325 | if (sdl_mods & SDL_KMOD_CTRL) { | ||
| 326 | fcitx_mods |= (1 << 2); | ||
| 327 | } | ||
| 328 | if (sdl_mods & SDL_KMOD_ALT) { | ||
| 329 | fcitx_mods |= (1 << 3); | ||
| 330 | } | ||
| 331 | if (sdl_mods & SDL_KMOD_NUM) { | ||
| 332 | fcitx_mods |= (1 << 4); | ||
| 333 | } | ||
| 334 | if (sdl_mods & SDL_KMOD_MODE) { | ||
| 335 | fcitx_mods |= (1 << 7); | ||
| 336 | } | ||
| 337 | if (sdl_mods & SDL_KMOD_LGUI) { | ||
| 338 | fcitx_mods |= (1 << 6); | ||
| 339 | } | ||
| 340 | if (sdl_mods & SDL_KMOD_RGUI) { | ||
| 341 | fcitx_mods |= (1 << 28); | ||
| 342 | } | ||
| 343 | |||
| 344 | return fcitx_mods; | ||
| 345 | } | ||
| 346 | |||
| 347 | bool SDL_Fcitx_Init(void) | ||
| 348 | { | ||
| 349 | fcitx_client.dbus = SDL_DBus_GetContext(); | ||
| 350 | |||
| 351 | fcitx_client.cursor_rect.x = -1; | ||
| 352 | fcitx_client.cursor_rect.y = -1; | ||
| 353 | fcitx_client.cursor_rect.w = 0; | ||
| 354 | fcitx_client.cursor_rect.h = 0; | ||
| 355 | |||
| 356 | return FcitxClientCreateIC(&fcitx_client); | ||
| 357 | } | ||
| 358 | |||
| 359 | void SDL_Fcitx_Quit(void) | ||
| 360 | { | ||
| 361 | FcitxClientICCallMethod(&fcitx_client, "DestroyIC"); | ||
| 362 | if (fcitx_client.ic_path) { | ||
| 363 | SDL_free(fcitx_client.ic_path); | ||
| 364 | fcitx_client.ic_path = NULL; | ||
| 365 | } | ||
| 366 | } | ||
| 367 | |||
| 368 | void SDL_Fcitx_SetFocus(bool focused) | ||
| 369 | { | ||
| 370 | if (focused) { | ||
| 371 | FcitxClientICCallMethod(&fcitx_client, "FocusIn"); | ||
| 372 | } else { | ||
| 373 | FcitxClientICCallMethod(&fcitx_client, "FocusOut"); | ||
| 374 | } | ||
| 375 | } | ||
| 376 | |||
| 377 | void SDL_Fcitx_Reset(void) | ||
| 378 | { | ||
| 379 | FcitxClientICCallMethod(&fcitx_client, "Reset"); | ||
| 380 | } | ||
| 381 | |||
| 382 | bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, bool down) | ||
| 383 | { | ||
| 384 | Uint32 mod_state = Fcitx_ModState(); | ||
| 385 | Uint32 handled = false; | ||
| 386 | Uint32 is_release = !down; | ||
| 387 | Uint32 event_time = 0; | ||
| 388 | |||
| 389 | if (!fcitx_client.ic_path) { | ||
| 390 | return false; | ||
| 391 | } | ||
| 392 | |||
| 393 | if (SDL_DBus_CallMethod(FCITX_DBUS_SERVICE, fcitx_client.ic_path, FCITX_IC_DBUS_INTERFACE, "ProcessKeyEvent", | ||
| 394 | DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &mod_state, DBUS_TYPE_BOOLEAN, &is_release, DBUS_TYPE_UINT32, &event_time, DBUS_TYPE_INVALID, | ||
| 395 | DBUS_TYPE_BOOLEAN, &handled, DBUS_TYPE_INVALID)) { | ||
| 396 | if (handled) { | ||
| 397 | SDL_Fcitx_UpdateTextInputArea(SDL_GetKeyboardFocus()); | ||
| 398 | return true; | ||
| 399 | } | ||
| 400 | } | ||
| 401 | |||
| 402 | return false; | ||
| 403 | } | ||
| 404 | |||
| 405 | void SDL_Fcitx_UpdateTextInputArea(SDL_Window *window) | ||
| 406 | { | ||
| 407 | int x = 0, y = 0; | ||
| 408 | SDL_Rect *cursor = &fcitx_client.cursor_rect; | ||
| 409 | |||
| 410 | if (!window) { | ||
| 411 | return; | ||
| 412 | } | ||
| 413 | |||
| 414 | // We'll use a square at the text input cursor location for the cursor_rect | ||
| 415 | cursor->x = window->text_input_rect.x + window->text_input_cursor; | ||
| 416 | cursor->y = window->text_input_rect.y; | ||
| 417 | cursor->w = window->text_input_rect.h; | ||
| 418 | cursor->h = window->text_input_rect.h; | ||
| 419 | |||
| 420 | SDL_GetWindowPosition(window, &x, &y); | ||
| 421 | |||
| 422 | #ifdef SDL_VIDEO_DRIVER_X11 | ||
| 423 | { | ||
| 424 | SDL_PropertiesID props = SDL_GetWindowProperties(window); | ||
| 425 | Display *x_disp = (Display *)SDL_GetPointerProperty(props, SDL_PROP_WINDOW_X11_DISPLAY_POINTER, NULL); | ||
| 426 | int x_screen = SDL_GetNumberProperty(props, SDL_PROP_WINDOW_X11_SCREEN_NUMBER, 0); | ||
| 427 | Window x_win = SDL_GetNumberProperty(props, SDL_PROP_WINDOW_X11_WINDOW_NUMBER, 0); | ||
| 428 | Window unused; | ||
| 429 | if (x_disp && x_win) { | ||
| 430 | X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused); | ||
| 431 | } | ||
| 432 | } | ||
| 433 | #endif | ||
| 434 | |||
| 435 | if (cursor->x == -1 && cursor->y == -1 && cursor->w == 0 && cursor->h == 0) { | ||
| 436 | // move to bottom left | ||
| 437 | int w = 0, h = 0; | ||
| 438 | SDL_GetWindowSize(window, &w, &h); | ||
| 439 | cursor->x = 0; | ||
| 440 | cursor->y = h; | ||
| 441 | } | ||
| 442 | |||
| 443 | x += cursor->x; | ||
| 444 | y += cursor->y; | ||
| 445 | |||
| 446 | SDL_DBus_CallVoidMethod(FCITX_DBUS_SERVICE, fcitx_client.ic_path, FCITX_IC_DBUS_INTERFACE, "SetCursorRect", | ||
| 447 | DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_INT32, &cursor->w, DBUS_TYPE_INT32, &cursor->h, DBUS_TYPE_INVALID); | ||
| 448 | } | ||
| 449 | |||
| 450 | void SDL_Fcitx_PumpEvents(void) | ||
| 451 | { | ||
| 452 | SDL_DBusContext *dbus = fcitx_client.dbus; | ||
| 453 | DBusConnection *conn = dbus->session_conn; | ||
| 454 | |||
| 455 | dbus->connection_read_write(conn, 0); | ||
| 456 | |||
| 457 | while (dbus->connection_dispatch(conn) == DBUS_DISPATCH_DATA_REMAINS) { | ||
| 458 | // Do nothing, actual work happens in DBus_MessageFilter | ||
| 459 | } | ||
| 460 | } | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_fcitx.h b/contrib/SDL-3.2.8/src/core/linux/SDL_fcitx.h new file mode 100644 index 0000000..82c544e --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_fcitx.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #ifndef SDL_fcitx_h_ | ||
| 23 | #define SDL_fcitx_h_ | ||
| 24 | |||
| 25 | #include "SDL_internal.h" | ||
| 26 | |||
| 27 | extern bool SDL_Fcitx_Init(void); | ||
| 28 | extern void SDL_Fcitx_Quit(void); | ||
| 29 | extern void SDL_Fcitx_SetFocus(bool focused); | ||
| 30 | extern void SDL_Fcitx_Reset(void); | ||
| 31 | extern bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, bool down); | ||
| 32 | extern void SDL_Fcitx_UpdateTextInputArea(SDL_Window *window); | ||
| 33 | extern void SDL_Fcitx_PumpEvents(void); | ||
| 34 | |||
| 35 | #endif // SDL_fcitx_h_ | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_ibus.c b/contrib/SDL-3.2.8/src/core/linux/SDL_ibus.c new file mode 100644 index 0000000..ea58ed5 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_ibus.c | |||
| @@ -0,0 +1,743 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifdef HAVE_IBUS_IBUS_H | ||
| 24 | #include "SDL_ibus.h" | ||
| 25 | #include "SDL_dbus.h" | ||
| 26 | |||
| 27 | #ifdef SDL_USE_LIBDBUS | ||
| 28 | |||
| 29 | #include "../../video/SDL_sysvideo.h" | ||
| 30 | #include "../../events/SDL_keyboard_c.h" | ||
| 31 | |||
| 32 | #ifdef SDL_VIDEO_DRIVER_X11 | ||
| 33 | #include "../../video/x11/SDL_x11video.h" | ||
| 34 | #endif | ||
| 35 | |||
| 36 | #include <sys/inotify.h> | ||
| 37 | #include <unistd.h> | ||
| 38 | #include <fcntl.h> | ||
| 39 | |||
| 40 | static const char IBUS_PATH[] = "/org/freedesktop/IBus"; | ||
| 41 | |||
| 42 | static const char IBUS_SERVICE[] = "org.freedesktop.IBus"; | ||
| 43 | static const char IBUS_INTERFACE[] = "org.freedesktop.IBus"; | ||
| 44 | static const char IBUS_INPUT_INTERFACE[] = "org.freedesktop.IBus.InputContext"; | ||
| 45 | |||
| 46 | static const char IBUS_PORTAL_SERVICE[] = "org.freedesktop.portal.IBus"; | ||
| 47 | static const char IBUS_PORTAL_INTERFACE[] = "org.freedesktop.IBus.Portal"; | ||
| 48 | static const char IBUS_PORTAL_INPUT_INTERFACE[] = "org.freedesktop.IBus.InputContext"; | ||
| 49 | |||
| 50 | static const char *ibus_service = NULL; | ||
| 51 | static const char *ibus_interface = NULL; | ||
| 52 | static const char *ibus_input_interface = NULL; | ||
| 53 | static char *input_ctx_path = NULL; | ||
| 54 | static SDL_Rect ibus_cursor_rect = { 0, 0, 0, 0 }; | ||
| 55 | static DBusConnection *ibus_conn = NULL; | ||
| 56 | static bool ibus_is_portal_interface = false; | ||
| 57 | static char *ibus_addr_file = NULL; | ||
| 58 | static int inotify_fd = -1, inotify_wd = -1; | ||
| 59 | |||
| 60 | static Uint32 IBus_ModState(void) | ||
| 61 | { | ||
| 62 | Uint32 ibus_mods = 0; | ||
| 63 | SDL_Keymod sdl_mods = SDL_GetModState(); | ||
| 64 | |||
| 65 | // Not sure about MOD3, MOD4 and HYPER mappings | ||
| 66 | if (sdl_mods & SDL_KMOD_LSHIFT) { | ||
| 67 | ibus_mods |= IBUS_SHIFT_MASK; | ||
| 68 | } | ||
| 69 | if (sdl_mods & SDL_KMOD_CAPS) { | ||
| 70 | ibus_mods |= IBUS_LOCK_MASK; | ||
| 71 | } | ||
| 72 | if (sdl_mods & SDL_KMOD_LCTRL) { | ||
| 73 | ibus_mods |= IBUS_CONTROL_MASK; | ||
| 74 | } | ||
| 75 | if (sdl_mods & SDL_KMOD_LALT) { | ||
| 76 | ibus_mods |= IBUS_MOD1_MASK; | ||
| 77 | } | ||
| 78 | if (sdl_mods & SDL_KMOD_NUM) { | ||
| 79 | ibus_mods |= IBUS_MOD2_MASK; | ||
| 80 | } | ||
| 81 | if (sdl_mods & SDL_KMOD_MODE) { | ||
| 82 | ibus_mods |= IBUS_MOD5_MASK; | ||
| 83 | } | ||
| 84 | if (sdl_mods & SDL_KMOD_LGUI) { | ||
| 85 | ibus_mods |= IBUS_SUPER_MASK; | ||
| 86 | } | ||
| 87 | if (sdl_mods & SDL_KMOD_RGUI) { | ||
| 88 | ibus_mods |= IBUS_META_MASK; | ||
| 89 | } | ||
| 90 | |||
| 91 | return ibus_mods; | ||
| 92 | } | ||
| 93 | |||
| 94 | static bool IBus_EnterVariant(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus, | ||
| 95 | DBusMessageIter *inside, const char *struct_id, size_t id_size) | ||
| 96 | { | ||
| 97 | DBusMessageIter sub; | ||
| 98 | if (dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_VARIANT) { | ||
| 99 | return false; | ||
| 100 | } | ||
| 101 | |||
| 102 | dbus->message_iter_recurse(iter, &sub); | ||
| 103 | |||
| 104 | if (dbus->message_iter_get_arg_type(&sub) != DBUS_TYPE_STRUCT) { | ||
| 105 | return false; | ||
| 106 | } | ||
| 107 | |||
| 108 | dbus->message_iter_recurse(&sub, inside); | ||
| 109 | |||
| 110 | if (dbus->message_iter_get_arg_type(inside) != DBUS_TYPE_STRING) { | ||
| 111 | return false; | ||
| 112 | } | ||
| 113 | |||
| 114 | dbus->message_iter_get_basic(inside, &struct_id); | ||
| 115 | if (!struct_id || SDL_strncmp(struct_id, struct_id, id_size) != 0) { | ||
| 116 | return false; | ||
| 117 | } | ||
| 118 | return true; | ||
| 119 | } | ||
| 120 | |||
| 121 | static bool IBus_GetDecorationPosition(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus, | ||
| 122 | Uint32 *start_pos, Uint32 *end_pos) | ||
| 123 | { | ||
| 124 | DBusMessageIter sub1, sub2, array; | ||
| 125 | |||
| 126 | if (!IBus_EnterVariant(conn, iter, dbus, &sub1, "IBusText", sizeof("IBusText"))) { | ||
| 127 | return false; | ||
| 128 | } | ||
| 129 | |||
| 130 | dbus->message_iter_next(&sub1); | ||
| 131 | dbus->message_iter_next(&sub1); | ||
| 132 | dbus->message_iter_next(&sub1); | ||
| 133 | |||
| 134 | if (!IBus_EnterVariant(conn, &sub1, dbus, &sub2, "IBusAttrList", sizeof("IBusAttrList"))) { | ||
| 135 | return false; | ||
| 136 | } | ||
| 137 | |||
| 138 | dbus->message_iter_next(&sub2); | ||
| 139 | dbus->message_iter_next(&sub2); | ||
| 140 | |||
| 141 | if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_ARRAY) { | ||
| 142 | return false; | ||
| 143 | } | ||
| 144 | |||
| 145 | dbus->message_iter_recurse(&sub2, &array); | ||
| 146 | |||
| 147 | while (dbus->message_iter_get_arg_type(&array) == DBUS_TYPE_VARIANT) { | ||
| 148 | DBusMessageIter sub; | ||
| 149 | if (IBus_EnterVariant(conn, &array, dbus, &sub, "IBusAttribute", sizeof("IBusAttribute"))) { | ||
| 150 | Uint32 type; | ||
| 151 | |||
| 152 | dbus->message_iter_next(&sub); | ||
| 153 | dbus->message_iter_next(&sub); | ||
| 154 | |||
| 155 | // From here on, the structure looks like this: | ||
| 156 | // Uint32 type: 1=underline, 2=foreground, 3=background | ||
| 157 | // Uint32 value: for underline it's 0=NONE, 1=SINGLE, 2=DOUBLE, | ||
| 158 | // 3=LOW, 4=ERROR | ||
| 159 | // for foreground and background it's a color | ||
| 160 | // Uint32 start_index: starting position for the style (utf8-char) | ||
| 161 | // Uint32 end_index: end position for the style (utf8-char) | ||
| 162 | |||
| 163 | dbus->message_iter_get_basic(&sub, &type); | ||
| 164 | // We only use the background type to determine the selection | ||
| 165 | if (type == 3) { | ||
| 166 | Uint32 start = -1; | ||
| 167 | dbus->message_iter_next(&sub); | ||
| 168 | dbus->message_iter_next(&sub); | ||
| 169 | if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_UINT32) { | ||
| 170 | dbus->message_iter_get_basic(&sub, &start); | ||
| 171 | dbus->message_iter_next(&sub); | ||
| 172 | if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_UINT32) { | ||
| 173 | dbus->message_iter_get_basic(&sub, end_pos); | ||
| 174 | *start_pos = start; | ||
| 175 | return true; | ||
| 176 | } | ||
| 177 | } | ||
| 178 | } | ||
| 179 | } | ||
| 180 | dbus->message_iter_next(&array); | ||
| 181 | } | ||
| 182 | return false; | ||
| 183 | } | ||
| 184 | |||
| 185 | static const char *IBus_GetVariantText(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus) | ||
| 186 | { | ||
| 187 | // The text we need is nested weirdly, use dbus-monitor to see the structure better | ||
| 188 | const char *text = NULL; | ||
| 189 | DBusMessageIter sub; | ||
| 190 | |||
| 191 | if (!IBus_EnterVariant(conn, iter, dbus, &sub, "IBusText", sizeof("IBusText"))) { | ||
| 192 | return NULL; | ||
| 193 | } | ||
| 194 | |||
| 195 | dbus->message_iter_next(&sub); | ||
| 196 | dbus->message_iter_next(&sub); | ||
| 197 | |||
| 198 | if (dbus->message_iter_get_arg_type(&sub) != DBUS_TYPE_STRING) { | ||
| 199 | return NULL; | ||
| 200 | } | ||
| 201 | dbus->message_iter_get_basic(&sub, &text); | ||
| 202 | |||
| 203 | return text; | ||
| 204 | } | ||
| 205 | |||
| 206 | static bool IBus_GetVariantCursorPos(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus, | ||
| 207 | Uint32 *pos) | ||
| 208 | { | ||
| 209 | dbus->message_iter_next(iter); | ||
| 210 | |||
| 211 | if (dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_UINT32) { | ||
| 212 | return false; | ||
| 213 | } | ||
| 214 | |||
| 215 | dbus->message_iter_get_basic(iter, pos); | ||
| 216 | |||
| 217 | return true; | ||
| 218 | } | ||
| 219 | |||
| 220 | static DBusHandlerResult IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data) | ||
| 221 | { | ||
| 222 | SDL_DBusContext *dbus = (SDL_DBusContext *)user_data; | ||
| 223 | |||
| 224 | if (dbus->message_is_signal(msg, ibus_input_interface, "CommitText")) { | ||
| 225 | DBusMessageIter iter; | ||
| 226 | const char *text; | ||
| 227 | |||
| 228 | dbus->message_iter_init(msg, &iter); | ||
| 229 | text = IBus_GetVariantText(conn, &iter, dbus); | ||
| 230 | |||
| 231 | SDL_SendKeyboardText(text); | ||
| 232 | |||
| 233 | return DBUS_HANDLER_RESULT_HANDLED; | ||
| 234 | } | ||
| 235 | |||
| 236 | if (dbus->message_is_signal(msg, ibus_input_interface, "UpdatePreeditText")) { | ||
| 237 | DBusMessageIter iter; | ||
| 238 | const char *text; | ||
| 239 | |||
| 240 | dbus->message_iter_init(msg, &iter); | ||
| 241 | text = IBus_GetVariantText(conn, &iter, dbus); | ||
| 242 | |||
| 243 | if (text) { | ||
| 244 | Uint32 pos, start_pos, end_pos; | ||
| 245 | bool has_pos = false; | ||
| 246 | bool has_dec_pos = false; | ||
| 247 | |||
| 248 | dbus->message_iter_init(msg, &iter); | ||
| 249 | has_dec_pos = IBus_GetDecorationPosition(conn, &iter, dbus, &start_pos, &end_pos); | ||
| 250 | if (!has_dec_pos) { | ||
| 251 | dbus->message_iter_init(msg, &iter); | ||
| 252 | has_pos = IBus_GetVariantCursorPos(conn, &iter, dbus, &pos); | ||
| 253 | } | ||
| 254 | |||
| 255 | if (has_dec_pos) { | ||
| 256 | SDL_SendEditingText(text, start_pos, end_pos - start_pos); | ||
| 257 | } else if (has_pos) { | ||
| 258 | SDL_SendEditingText(text, pos, -1); | ||
| 259 | } else { | ||
| 260 | SDL_SendEditingText(text, -1, -1); | ||
| 261 | } | ||
| 262 | } | ||
| 263 | |||
| 264 | SDL_IBus_UpdateTextInputArea(SDL_GetKeyboardFocus()); | ||
| 265 | |||
| 266 | return DBUS_HANDLER_RESULT_HANDLED; | ||
| 267 | } | ||
| 268 | |||
| 269 | if (dbus->message_is_signal(msg, ibus_input_interface, "HidePreeditText")) { | ||
| 270 | SDL_SendEditingText("", 0, 0); | ||
| 271 | return DBUS_HANDLER_RESULT_HANDLED; | ||
| 272 | } | ||
| 273 | |||
| 274 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | ||
| 275 | } | ||
| 276 | |||
| 277 | static char *IBus_ReadAddressFromFile(const char *file_path) | ||
| 278 | { | ||
| 279 | char addr_buf[1024]; | ||
| 280 | bool success = false; | ||
| 281 | FILE *addr_file; | ||
| 282 | |||
| 283 | addr_file = fopen(file_path, "r"); | ||
| 284 | if (!addr_file) { | ||
| 285 | return NULL; | ||
| 286 | } | ||
| 287 | |||
| 288 | while (fgets(addr_buf, sizeof(addr_buf), addr_file)) { | ||
| 289 | if (SDL_strncmp(addr_buf, "IBUS_ADDRESS=", sizeof("IBUS_ADDRESS=") - 1) == 0) { | ||
| 290 | size_t sz = SDL_strlen(addr_buf); | ||
| 291 | if (addr_buf[sz - 1] == '\n') { | ||
| 292 | addr_buf[sz - 1] = 0; | ||
| 293 | } | ||
| 294 | if (addr_buf[sz - 2] == '\r') { | ||
| 295 | addr_buf[sz - 2] = 0; | ||
| 296 | } | ||
| 297 | success = true; | ||
| 298 | break; | ||
| 299 | } | ||
| 300 | } | ||
| 301 | |||
| 302 | (void)fclose(addr_file); | ||
| 303 | |||
| 304 | if (success) { | ||
| 305 | return SDL_strdup(addr_buf + (sizeof("IBUS_ADDRESS=") - 1)); | ||
| 306 | } else { | ||
| 307 | return NULL; | ||
| 308 | } | ||
| 309 | } | ||
| 310 | |||
| 311 | static char *IBus_GetDBusAddressFilename(void) | ||
| 312 | { | ||
| 313 | SDL_DBusContext *dbus; | ||
| 314 | const char *disp_env; | ||
| 315 | char config_dir[PATH_MAX]; | ||
| 316 | char *display = NULL; | ||
| 317 | const char *addr; | ||
| 318 | const char *conf_env; | ||
| 319 | char *key; | ||
| 320 | char file_path[PATH_MAX]; | ||
| 321 | const char *host; | ||
| 322 | char *disp_num, *screen_num; | ||
| 323 | |||
| 324 | if (ibus_addr_file) { | ||
| 325 | return SDL_strdup(ibus_addr_file); | ||
| 326 | } | ||
| 327 | |||
| 328 | dbus = SDL_DBus_GetContext(); | ||
| 329 | if (!dbus) { | ||
| 330 | return NULL; | ||
| 331 | } | ||
| 332 | |||
| 333 | // Use this environment variable if it exists. | ||
| 334 | addr = SDL_getenv("IBUS_ADDRESS"); | ||
| 335 | if (addr && *addr) { | ||
| 336 | return SDL_strdup(addr); | ||
| 337 | } | ||
| 338 | |||
| 339 | /* Otherwise, we have to get the hostname, display, machine id, config dir | ||
| 340 | and look up the address from a filepath using all those bits, eek. */ | ||
| 341 | disp_env = SDL_getenv("DISPLAY"); | ||
| 342 | |||
| 343 | if (!disp_env || !*disp_env) { | ||
| 344 | display = SDL_strdup(":0.0"); | ||
| 345 | } else { | ||
| 346 | display = SDL_strdup(disp_env); | ||
| 347 | } | ||
| 348 | |||
| 349 | host = display; | ||
| 350 | disp_num = SDL_strrchr(display, ':'); | ||
| 351 | screen_num = SDL_strrchr(display, '.'); | ||
| 352 | |||
| 353 | if (!disp_num) { | ||
| 354 | SDL_free(display); | ||
| 355 | return NULL; | ||
| 356 | } | ||
| 357 | |||
| 358 | *disp_num = 0; | ||
| 359 | disp_num++; | ||
| 360 | |||
| 361 | if (screen_num) { | ||
| 362 | *screen_num = 0; | ||
| 363 | } | ||
| 364 | |||
| 365 | if (!*host) { | ||
| 366 | const char *session = SDL_getenv("XDG_SESSION_TYPE"); | ||
| 367 | if (session && SDL_strcmp(session, "wayland") == 0) { | ||
| 368 | host = "unix-wayland"; | ||
| 369 | } else { | ||
| 370 | host = "unix"; | ||
| 371 | } | ||
| 372 | } | ||
| 373 | |||
| 374 | SDL_memset(config_dir, 0, sizeof(config_dir)); | ||
| 375 | |||
| 376 | conf_env = SDL_getenv("XDG_CONFIG_HOME"); | ||
| 377 | if (conf_env && *conf_env) { | ||
| 378 | SDL_strlcpy(config_dir, conf_env, sizeof(config_dir)); | ||
| 379 | } else { | ||
| 380 | const char *home_env = SDL_getenv("HOME"); | ||
| 381 | if (!home_env || !*home_env) { | ||
| 382 | SDL_free(display); | ||
| 383 | return NULL; | ||
| 384 | } | ||
| 385 | (void)SDL_snprintf(config_dir, sizeof(config_dir), "%s/.config", home_env); | ||
| 386 | } | ||
| 387 | |||
| 388 | key = SDL_DBus_GetLocalMachineId(); | ||
| 389 | |||
| 390 | if (!key) { | ||
| 391 | SDL_free(display); | ||
| 392 | return NULL; | ||
| 393 | } | ||
| 394 | |||
| 395 | SDL_memset(file_path, 0, sizeof(file_path)); | ||
| 396 | (void)SDL_snprintf(file_path, sizeof(file_path), "%s/ibus/bus/%s-%s-%s", | ||
| 397 | config_dir, key, host, disp_num); | ||
| 398 | dbus->free(key); | ||
| 399 | SDL_free(display); | ||
| 400 | |||
| 401 | return SDL_strdup(file_path); | ||
| 402 | } | ||
| 403 | |||
| 404 | static bool IBus_CheckConnection(SDL_DBusContext *dbus); | ||
| 405 | |||
| 406 | static void SDLCALL IBus_SetCapabilities(void *data, const char *name, const char *old_val, | ||
| 407 | const char *hint) | ||
| 408 | { | ||
| 409 | SDL_DBusContext *dbus = SDL_DBus_GetContext(); | ||
| 410 | |||
| 411 | if (IBus_CheckConnection(dbus)) { | ||
| 412 | Uint32 caps = IBUS_CAP_FOCUS; | ||
| 413 | |||
| 414 | if (hint && SDL_strstr(hint, "composition")) { | ||
| 415 | caps |= IBUS_CAP_PREEDIT_TEXT; | ||
| 416 | } | ||
| 417 | if (hint && SDL_strstr(hint, "candidates")) { | ||
| 418 | // FIXME, turn off native candidate rendering | ||
| 419 | } | ||
| 420 | |||
| 421 | SDL_DBus_CallVoidMethodOnConnection(ibus_conn, ibus_service, input_ctx_path, ibus_input_interface, "SetCapabilities", | ||
| 422 | DBUS_TYPE_UINT32, &caps, DBUS_TYPE_INVALID); | ||
| 423 | } | ||
| 424 | } | ||
| 425 | |||
| 426 | static bool IBus_SetupConnection(SDL_DBusContext *dbus, const char *addr) | ||
| 427 | { | ||
| 428 | const char *client_name = "SDL3_Application"; | ||
| 429 | const char *path = NULL; | ||
| 430 | bool result = false; | ||
| 431 | DBusObjectPathVTable ibus_vtable; | ||
| 432 | |||
| 433 | SDL_zero(ibus_vtable); | ||
| 434 | ibus_vtable.message_function = &IBus_MessageHandler; | ||
| 435 | |||
| 436 | /* try the portal interface first. Modern systems have this in general, | ||
| 437 | and sandbox things like FlakPak and Snaps, etc, require it. */ | ||
| 438 | |||
| 439 | ibus_is_portal_interface = true; | ||
| 440 | ibus_service = IBUS_PORTAL_SERVICE; | ||
| 441 | ibus_interface = IBUS_PORTAL_INTERFACE; | ||
| 442 | ibus_input_interface = IBUS_PORTAL_INPUT_INTERFACE; | ||
| 443 | ibus_conn = dbus->session_conn; | ||
| 444 | |||
| 445 | result = SDL_DBus_CallMethodOnConnection(ibus_conn, ibus_service, IBUS_PATH, ibus_interface, "CreateInputContext", | ||
| 446 | DBUS_TYPE_STRING, &client_name, DBUS_TYPE_INVALID, | ||
| 447 | DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID); | ||
| 448 | if (!result) { | ||
| 449 | ibus_is_portal_interface = false; | ||
| 450 | ibus_service = IBUS_SERVICE; | ||
| 451 | ibus_interface = IBUS_INTERFACE; | ||
| 452 | ibus_input_interface = IBUS_INPUT_INTERFACE; | ||
| 453 | ibus_conn = dbus->connection_open_private(addr, NULL); | ||
| 454 | |||
| 455 | if (!ibus_conn) { | ||
| 456 | return false; // oh well. | ||
| 457 | } | ||
| 458 | |||
| 459 | dbus->connection_flush(ibus_conn); | ||
| 460 | |||
| 461 | if (!dbus->bus_register(ibus_conn, NULL)) { | ||
| 462 | ibus_conn = NULL; | ||
| 463 | return false; | ||
| 464 | } | ||
| 465 | |||
| 466 | dbus->connection_flush(ibus_conn); | ||
| 467 | |||
| 468 | result = SDL_DBus_CallMethodOnConnection(ibus_conn, ibus_service, IBUS_PATH, ibus_interface, "CreateInputContext", | ||
| 469 | DBUS_TYPE_STRING, &client_name, DBUS_TYPE_INVALID, | ||
| 470 | DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID); | ||
| 471 | } else { | ||
| 472 | // re-using dbus->session_conn | ||
| 473 | dbus->connection_ref(ibus_conn); | ||
| 474 | } | ||
| 475 | |||
| 476 | if (result) { | ||
| 477 | char matchstr[128]; | ||
| 478 | (void)SDL_snprintf(matchstr, sizeof(matchstr), "type='signal',interface='%s'", ibus_input_interface); | ||
| 479 | SDL_free(input_ctx_path); | ||
| 480 | input_ctx_path = SDL_strdup(path); | ||
| 481 | SDL_AddHintCallback(SDL_HINT_IME_IMPLEMENTED_UI, IBus_SetCapabilities, NULL); | ||
| 482 | dbus->bus_add_match(ibus_conn, matchstr, NULL); | ||
| 483 | dbus->connection_try_register_object_path(ibus_conn, input_ctx_path, &ibus_vtable, dbus, NULL); | ||
| 484 | dbus->connection_flush(ibus_conn); | ||
| 485 | } | ||
| 486 | |||
| 487 | SDL_Window *window = SDL_GetKeyboardFocus(); | ||
| 488 | if (SDL_TextInputActive(window)) { | ||
| 489 | SDL_IBus_SetFocus(true); | ||
| 490 | SDL_IBus_UpdateTextInputArea(window); | ||
| 491 | } else { | ||
| 492 | SDL_IBus_SetFocus(false); | ||
| 493 | } | ||
| 494 | return result; | ||
| 495 | } | ||
| 496 | |||
| 497 | static bool IBus_CheckConnection(SDL_DBusContext *dbus) | ||
| 498 | { | ||
| 499 | if (!dbus) { | ||
| 500 | return false; | ||
| 501 | } | ||
| 502 | |||
| 503 | if (ibus_conn && dbus->connection_get_is_connected(ibus_conn)) { | ||
| 504 | return true; | ||
| 505 | } | ||
| 506 | |||
| 507 | if (inotify_fd > 0 && inotify_wd > 0) { | ||
| 508 | char buf[1024]; | ||
| 509 | ssize_t readsize = read(inotify_fd, buf, sizeof(buf)); | ||
| 510 | if (readsize > 0) { | ||
| 511 | |||
| 512 | char *p; | ||
| 513 | bool file_updated = false; | ||
| 514 | |||
| 515 | for (p = buf; p < buf + readsize; /**/) { | ||
| 516 | struct inotify_event *event = (struct inotify_event *)p; | ||
| 517 | if (event->len > 0) { | ||
| 518 | char *addr_file_no_path = SDL_strrchr(ibus_addr_file, '/'); | ||
| 519 | if (!addr_file_no_path) { | ||
| 520 | return false; | ||
| 521 | } | ||
| 522 | |||
| 523 | if (SDL_strcmp(addr_file_no_path + 1, event->name) == 0) { | ||
| 524 | file_updated = true; | ||
| 525 | break; | ||
| 526 | } | ||
| 527 | } | ||
| 528 | |||
| 529 | p += sizeof(struct inotify_event) + event->len; | ||
| 530 | } | ||
| 531 | |||
| 532 | if (file_updated) { | ||
| 533 | char *addr = IBus_ReadAddressFromFile(ibus_addr_file); | ||
| 534 | if (addr) { | ||
| 535 | bool result = IBus_SetupConnection(dbus, addr); | ||
| 536 | SDL_free(addr); | ||
| 537 | return result; | ||
| 538 | } | ||
| 539 | } | ||
| 540 | } | ||
| 541 | } | ||
| 542 | |||
| 543 | return false; | ||
| 544 | } | ||
| 545 | |||
| 546 | bool SDL_IBus_Init(void) | ||
| 547 | { | ||
| 548 | bool result = false; | ||
| 549 | SDL_DBusContext *dbus = SDL_DBus_GetContext(); | ||
| 550 | |||
| 551 | if (dbus) { | ||
| 552 | char *addr_file = IBus_GetDBusAddressFilename(); | ||
| 553 | char *addr; | ||
| 554 | char *addr_file_dir; | ||
| 555 | |||
| 556 | if (!addr_file) { | ||
| 557 | return false; | ||
| 558 | } | ||
| 559 | |||
| 560 | addr = IBus_ReadAddressFromFile(addr_file); | ||
| 561 | if (!addr) { | ||
| 562 | SDL_free(addr_file); | ||
| 563 | return false; | ||
| 564 | } | ||
| 565 | |||
| 566 | if (ibus_addr_file) { | ||
| 567 | SDL_free(ibus_addr_file); | ||
| 568 | } | ||
| 569 | ibus_addr_file = SDL_strdup(addr_file); | ||
| 570 | |||
| 571 | if (inotify_fd < 0) { | ||
| 572 | inotify_fd = inotify_init(); | ||
| 573 | fcntl(inotify_fd, F_SETFL, O_NONBLOCK); | ||
| 574 | } | ||
| 575 | |||
| 576 | addr_file_dir = SDL_strrchr(addr_file, '/'); | ||
| 577 | if (addr_file_dir) { | ||
| 578 | *addr_file_dir = 0; | ||
| 579 | } | ||
| 580 | |||
| 581 | inotify_wd = inotify_add_watch(inotify_fd, addr_file, IN_CREATE | IN_MODIFY); | ||
| 582 | SDL_free(addr_file); | ||
| 583 | |||
| 584 | result = IBus_SetupConnection(dbus, addr); | ||
| 585 | SDL_free(addr); | ||
| 586 | |||
| 587 | // don't use the addr_file if using the portal interface. | ||
| 588 | if (result && ibus_is_portal_interface) { | ||
| 589 | if (inotify_fd > 0) { | ||
| 590 | if (inotify_wd > 0) { | ||
| 591 | inotify_rm_watch(inotify_fd, inotify_wd); | ||
| 592 | inotify_wd = -1; | ||
| 593 | } | ||
| 594 | close(inotify_fd); | ||
| 595 | inotify_fd = -1; | ||
| 596 | } | ||
| 597 | } | ||
| 598 | } | ||
| 599 | |||
| 600 | return result; | ||
| 601 | } | ||
| 602 | |||
| 603 | void SDL_IBus_Quit(void) | ||
| 604 | { | ||
| 605 | SDL_DBusContext *dbus; | ||
| 606 | |||
| 607 | if (input_ctx_path) { | ||
| 608 | SDL_free(input_ctx_path); | ||
| 609 | input_ctx_path = NULL; | ||
| 610 | } | ||
| 611 | |||
| 612 | if (ibus_addr_file) { | ||
| 613 | SDL_free(ibus_addr_file); | ||
| 614 | ibus_addr_file = NULL; | ||
| 615 | } | ||
| 616 | |||
| 617 | dbus = SDL_DBus_GetContext(); | ||
| 618 | |||
| 619 | // if using portal, ibus_conn == session_conn; don't release it here. | ||
| 620 | if (dbus && ibus_conn && !ibus_is_portal_interface) { | ||
| 621 | dbus->connection_close(ibus_conn); | ||
| 622 | dbus->connection_unref(ibus_conn); | ||
| 623 | } | ||
| 624 | |||
| 625 | ibus_conn = NULL; | ||
| 626 | ibus_service = NULL; | ||
| 627 | ibus_interface = NULL; | ||
| 628 | ibus_input_interface = NULL; | ||
| 629 | ibus_is_portal_interface = false; | ||
| 630 | |||
| 631 | if (inotify_fd > 0 && inotify_wd > 0) { | ||
| 632 | inotify_rm_watch(inotify_fd, inotify_wd); | ||
| 633 | inotify_wd = -1; | ||
| 634 | } | ||
| 635 | |||
| 636 | // !!! FIXME: should we close(inotify_fd) here? | ||
| 637 | |||
| 638 | SDL_RemoveHintCallback(SDL_HINT_IME_IMPLEMENTED_UI, IBus_SetCapabilities, NULL); | ||
| 639 | |||
| 640 | SDL_memset(&ibus_cursor_rect, 0, sizeof(ibus_cursor_rect)); | ||
| 641 | } | ||
| 642 | |||
| 643 | static void IBus_SimpleMessage(const char *method) | ||
| 644 | { | ||
| 645 | SDL_DBusContext *dbus = SDL_DBus_GetContext(); | ||
| 646 | |||
| 647 | if ((input_ctx_path) && (IBus_CheckConnection(dbus))) { | ||
| 648 | SDL_DBus_CallVoidMethodOnConnection(ibus_conn, ibus_service, input_ctx_path, ibus_input_interface, method, DBUS_TYPE_INVALID); | ||
| 649 | } | ||
| 650 | } | ||
| 651 | |||
| 652 | void SDL_IBus_SetFocus(bool focused) | ||
| 653 | { | ||
| 654 | const char *method = focused ? "FocusIn" : "FocusOut"; | ||
| 655 | IBus_SimpleMessage(method); | ||
| 656 | } | ||
| 657 | |||
| 658 | void SDL_IBus_Reset(void) | ||
| 659 | { | ||
| 660 | IBus_SimpleMessage("Reset"); | ||
| 661 | } | ||
| 662 | |||
| 663 | bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, bool down) | ||
| 664 | { | ||
| 665 | Uint32 result = 0; | ||
| 666 | SDL_DBusContext *dbus = SDL_DBus_GetContext(); | ||
| 667 | |||
| 668 | if (IBus_CheckConnection(dbus)) { | ||
| 669 | Uint32 mods = IBus_ModState(); | ||
| 670 | Uint32 ibus_keycode = keycode - 8; | ||
| 671 | if (!down) { | ||
| 672 | mods |= (1 << 30); // IBUS_RELEASE_MASK | ||
| 673 | } | ||
| 674 | if (!SDL_DBus_CallMethodOnConnection(ibus_conn, ibus_service, input_ctx_path, ibus_input_interface, "ProcessKeyEvent", | ||
| 675 | DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &ibus_keycode, DBUS_TYPE_UINT32, &mods, DBUS_TYPE_INVALID, | ||
| 676 | DBUS_TYPE_BOOLEAN, &result, DBUS_TYPE_INVALID)) { | ||
| 677 | result = 0; | ||
| 678 | } | ||
| 679 | } | ||
| 680 | |||
| 681 | SDL_IBus_UpdateTextInputArea(SDL_GetKeyboardFocus()); | ||
| 682 | |||
| 683 | return (result != 0); | ||
| 684 | } | ||
| 685 | |||
| 686 | void SDL_IBus_UpdateTextInputArea(SDL_Window *window) | ||
| 687 | { | ||
| 688 | int x = 0, y = 0; | ||
| 689 | SDL_DBusContext *dbus; | ||
| 690 | |||
| 691 | if (!window) { | ||
| 692 | return; | ||
| 693 | } | ||
| 694 | |||
| 695 | // We'll use a square at the text input cursor location for the ibus_cursor | ||
| 696 | ibus_cursor_rect.x = window->text_input_rect.x + window->text_input_cursor; | ||
| 697 | ibus_cursor_rect.y = window->text_input_rect.y; | ||
| 698 | ibus_cursor_rect.w = window->text_input_rect.h; | ||
| 699 | ibus_cursor_rect.h = window->text_input_rect.h; | ||
| 700 | |||
| 701 | SDL_GetWindowPosition(window, &x, &y); | ||
| 702 | |||
| 703 | #ifdef SDL_VIDEO_DRIVER_X11 | ||
| 704 | { | ||
| 705 | SDL_PropertiesID props = SDL_GetWindowProperties(window); | ||
| 706 | Display *x_disp = (Display *)SDL_GetPointerProperty(props, SDL_PROP_WINDOW_X11_DISPLAY_POINTER, NULL); | ||
| 707 | int x_screen = SDL_GetNumberProperty(props, SDL_PROP_WINDOW_X11_SCREEN_NUMBER, 0); | ||
| 708 | Window x_win = SDL_GetNumberProperty(props, SDL_PROP_WINDOW_X11_WINDOW_NUMBER, 0); | ||
| 709 | Window unused; | ||
| 710 | |||
| 711 | if (x_disp && x_win) { | ||
| 712 | X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused); | ||
| 713 | } | ||
| 714 | } | ||
| 715 | #endif | ||
| 716 | |||
| 717 | x += ibus_cursor_rect.x; | ||
| 718 | y += ibus_cursor_rect.y; | ||
| 719 | |||
| 720 | dbus = SDL_DBus_GetContext(); | ||
| 721 | |||
| 722 | if (IBus_CheckConnection(dbus)) { | ||
| 723 | SDL_DBus_CallVoidMethodOnConnection(ibus_conn, ibus_service, input_ctx_path, ibus_input_interface, "SetCursorLocation", | ||
| 724 | DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_INT32, &ibus_cursor_rect.w, DBUS_TYPE_INT32, &ibus_cursor_rect.h, DBUS_TYPE_INVALID); | ||
| 725 | } | ||
| 726 | } | ||
| 727 | |||
| 728 | void SDL_IBus_PumpEvents(void) | ||
| 729 | { | ||
| 730 | SDL_DBusContext *dbus = SDL_DBus_GetContext(); | ||
| 731 | |||
| 732 | if (IBus_CheckConnection(dbus)) { | ||
| 733 | dbus->connection_read_write(ibus_conn, 0); | ||
| 734 | |||
| 735 | while (dbus->connection_dispatch(ibus_conn) == DBUS_DISPATCH_DATA_REMAINS) { | ||
| 736 | // Do nothing, actual work happens in IBus_MessageHandler | ||
| 737 | } | ||
| 738 | } | ||
| 739 | } | ||
| 740 | |||
| 741 | #endif // SDL_USE_LIBDBUS | ||
| 742 | |||
| 743 | #endif | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_ibus.h b/contrib/SDL-3.2.8/src/core/linux/SDL_ibus.h new file mode 100644 index 0000000..ba08be6 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_ibus.h | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "SDL_internal.h" | ||
| 23 | |||
| 24 | #ifndef SDL_ibus_h_ | ||
| 25 | #define SDL_ibus_h_ | ||
| 26 | |||
| 27 | #ifdef HAVE_IBUS_IBUS_H | ||
| 28 | #define SDL_USE_IBUS 1 | ||
| 29 | #include <ibus.h> | ||
| 30 | |||
| 31 | extern bool SDL_IBus_Init(void); | ||
| 32 | extern void SDL_IBus_Quit(void); | ||
| 33 | |||
| 34 | // Lets the IBus server know about changes in window focus | ||
| 35 | extern void SDL_IBus_SetFocus(bool focused); | ||
| 36 | |||
| 37 | // Closes the candidate list and resets any text currently being edited | ||
| 38 | extern void SDL_IBus_Reset(void); | ||
| 39 | |||
| 40 | /* Sends a keypress event to IBus, returns true if IBus used this event to | ||
| 41 | update its candidate list or change input methods. PumpEvents should be | ||
| 42 | called some time after this, to receive the TextInput / TextEditing event back. */ | ||
| 43 | extern bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, bool down); | ||
| 44 | |||
| 45 | /* Update the position of IBus' candidate list. If rect is NULL then this will | ||
| 46 | just reposition it relative to the focused window's new position. */ | ||
| 47 | extern void SDL_IBus_UpdateTextInputArea(SDL_Window *window); | ||
| 48 | |||
| 49 | /* Checks DBus for new IBus events, and calls SDL_SendKeyboardText / | ||
| 50 | SDL_SendEditingText for each event it finds */ | ||
| 51 | extern void SDL_IBus_PumpEvents(void); | ||
| 52 | |||
| 53 | #endif // HAVE_IBUS_IBUS_H | ||
| 54 | |||
| 55 | #endif // SDL_ibus_h_ | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_ime.c b/contrib/SDL-3.2.8/src/core/linux/SDL_ime.c new file mode 100644 index 0000000..c15defb --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_ime.c | |||
| @@ -0,0 +1,150 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #include "SDL_ime.h" | ||
| 24 | #include "SDL_ibus.h" | ||
| 25 | #include "SDL_fcitx.h" | ||
| 26 | |||
| 27 | typedef bool (*SDL_IME_Init_t)(void); | ||
| 28 | typedef void (*SDL_IME_Quit_t)(void); | ||
| 29 | typedef void (*SDL_IME_SetFocus_t)(bool); | ||
| 30 | typedef void (*SDL_IME_Reset_t)(void); | ||
| 31 | typedef bool (*SDL_IME_ProcessKeyEvent_t)(Uint32, Uint32, bool down); | ||
| 32 | typedef void (*SDL_IME_UpdateTextInputArea_t)(SDL_Window *window); | ||
| 33 | typedef void (*SDL_IME_PumpEvents_t)(void); | ||
| 34 | |||
| 35 | static SDL_IME_Init_t SDL_IME_Init_Real = NULL; | ||
| 36 | static SDL_IME_Quit_t SDL_IME_Quit_Real = NULL; | ||
| 37 | static SDL_IME_SetFocus_t SDL_IME_SetFocus_Real = NULL; | ||
| 38 | static SDL_IME_Reset_t SDL_IME_Reset_Real = NULL; | ||
| 39 | static SDL_IME_ProcessKeyEvent_t SDL_IME_ProcessKeyEvent_Real = NULL; | ||
| 40 | static SDL_IME_UpdateTextInputArea_t SDL_IME_UpdateTextInputArea_Real = NULL; | ||
| 41 | static SDL_IME_PumpEvents_t SDL_IME_PumpEvents_Real = NULL; | ||
| 42 | |||
| 43 | static void InitIME(void) | ||
| 44 | { | ||
| 45 | static bool inited = false; | ||
| 46 | #ifdef HAVE_FCITX | ||
| 47 | const char *im_module = SDL_getenv("SDL_IM_MODULE"); | ||
| 48 | const char *xmodifiers = SDL_getenv("XMODIFIERS"); | ||
| 49 | #endif | ||
| 50 | |||
| 51 | if (inited == true) { | ||
| 52 | return; | ||
| 53 | } | ||
| 54 | |||
| 55 | inited = true; | ||
| 56 | |||
| 57 | // See if fcitx IME support is being requested | ||
| 58 | #ifdef HAVE_FCITX | ||
| 59 | if (!SDL_IME_Init_Real && | ||
| 60 | ((im_module && SDL_strcmp(im_module, "fcitx") == 0) || | ||
| 61 | (!im_module && xmodifiers && SDL_strstr(xmodifiers, "@im=fcitx") != NULL))) { | ||
| 62 | SDL_IME_Init_Real = SDL_Fcitx_Init; | ||
| 63 | SDL_IME_Quit_Real = SDL_Fcitx_Quit; | ||
| 64 | SDL_IME_SetFocus_Real = SDL_Fcitx_SetFocus; | ||
| 65 | SDL_IME_Reset_Real = SDL_Fcitx_Reset; | ||
| 66 | SDL_IME_ProcessKeyEvent_Real = SDL_Fcitx_ProcessKeyEvent; | ||
| 67 | SDL_IME_UpdateTextInputArea_Real = SDL_Fcitx_UpdateTextInputArea; | ||
| 68 | SDL_IME_PumpEvents_Real = SDL_Fcitx_PumpEvents; | ||
| 69 | } | ||
| 70 | #endif // HAVE_FCITX | ||
| 71 | |||
| 72 | // default to IBus | ||
| 73 | #ifdef HAVE_IBUS_IBUS_H | ||
| 74 | if (!SDL_IME_Init_Real) { | ||
| 75 | SDL_IME_Init_Real = SDL_IBus_Init; | ||
| 76 | SDL_IME_Quit_Real = SDL_IBus_Quit; | ||
| 77 | SDL_IME_SetFocus_Real = SDL_IBus_SetFocus; | ||
| 78 | SDL_IME_Reset_Real = SDL_IBus_Reset; | ||
| 79 | SDL_IME_ProcessKeyEvent_Real = SDL_IBus_ProcessKeyEvent; | ||
| 80 | SDL_IME_UpdateTextInputArea_Real = SDL_IBus_UpdateTextInputArea; | ||
| 81 | SDL_IME_PumpEvents_Real = SDL_IBus_PumpEvents; | ||
| 82 | } | ||
| 83 | #endif // HAVE_IBUS_IBUS_H | ||
| 84 | } | ||
| 85 | |||
| 86 | bool SDL_IME_Init(void) | ||
| 87 | { | ||
| 88 | InitIME(); | ||
| 89 | |||
| 90 | if (SDL_IME_Init_Real) { | ||
| 91 | if (SDL_IME_Init_Real()) { | ||
| 92 | return true; | ||
| 93 | } | ||
| 94 | |||
| 95 | // uhoh, the IME implementation's init failed! Disable IME support. | ||
| 96 | SDL_IME_Init_Real = NULL; | ||
| 97 | SDL_IME_Quit_Real = NULL; | ||
| 98 | SDL_IME_SetFocus_Real = NULL; | ||
| 99 | SDL_IME_Reset_Real = NULL; | ||
| 100 | SDL_IME_ProcessKeyEvent_Real = NULL; | ||
| 101 | SDL_IME_UpdateTextInputArea_Real = NULL; | ||
| 102 | SDL_IME_PumpEvents_Real = NULL; | ||
| 103 | } | ||
| 104 | |||
| 105 | return false; | ||
| 106 | } | ||
| 107 | |||
| 108 | void SDL_IME_Quit(void) | ||
| 109 | { | ||
| 110 | if (SDL_IME_Quit_Real) { | ||
| 111 | SDL_IME_Quit_Real(); | ||
| 112 | } | ||
| 113 | } | ||
| 114 | |||
| 115 | void SDL_IME_SetFocus(bool focused) | ||
| 116 | { | ||
| 117 | if (SDL_IME_SetFocus_Real) { | ||
| 118 | SDL_IME_SetFocus_Real(focused); | ||
| 119 | } | ||
| 120 | } | ||
| 121 | |||
| 122 | void SDL_IME_Reset(void) | ||
| 123 | { | ||
| 124 | if (SDL_IME_Reset_Real) { | ||
| 125 | SDL_IME_Reset_Real(); | ||
| 126 | } | ||
| 127 | } | ||
| 128 | |||
| 129 | bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, bool down) | ||
| 130 | { | ||
| 131 | if (SDL_IME_ProcessKeyEvent_Real) { | ||
| 132 | return SDL_IME_ProcessKeyEvent_Real(keysym, keycode, down); | ||
| 133 | } | ||
| 134 | |||
| 135 | return false; | ||
| 136 | } | ||
| 137 | |||
| 138 | void SDL_IME_UpdateTextInputArea(SDL_Window *window) | ||
| 139 | { | ||
| 140 | if (SDL_IME_UpdateTextInputArea_Real) { | ||
| 141 | SDL_IME_UpdateTextInputArea_Real(window); | ||
| 142 | } | ||
| 143 | } | ||
| 144 | |||
| 145 | void SDL_IME_PumpEvents(void) | ||
| 146 | { | ||
| 147 | if (SDL_IME_PumpEvents_Real) { | ||
| 148 | SDL_IME_PumpEvents_Real(); | ||
| 149 | } | ||
| 150 | } | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_ime.h b/contrib/SDL-3.2.8/src/core/linux/SDL_ime.h new file mode 100644 index 0000000..ac192fa --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_ime.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #ifndef SDL_ime_h_ | ||
| 23 | #define SDL_ime_h_ | ||
| 24 | |||
| 25 | #include "SDL_internal.h" | ||
| 26 | |||
| 27 | extern bool SDL_IME_Init(void); | ||
| 28 | extern void SDL_IME_Quit(void); | ||
| 29 | extern void SDL_IME_SetFocus(bool focused); | ||
| 30 | extern void SDL_IME_Reset(void); | ||
| 31 | extern bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, bool down); | ||
| 32 | extern void SDL_IME_UpdateTextInputArea(SDL_Window *window); | ||
| 33 | extern void SDL_IME_PumpEvents(void); | ||
| 34 | |||
| 35 | #endif // SDL_ime_h_ | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_system_theme.c b/contrib/SDL-3.2.8/src/core/linux/SDL_system_theme.c new file mode 100644 index 0000000..6d6087d --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_system_theme.c | |||
| @@ -0,0 +1,156 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #include "SDL_dbus.h" | ||
| 24 | #include "SDL_system_theme.h" | ||
| 25 | #include "../../video/SDL_sysvideo.h" | ||
| 26 | |||
| 27 | #include <unistd.h> | ||
| 28 | |||
| 29 | #define PORTAL_DESTINATION "org.freedesktop.portal.Desktop" | ||
| 30 | #define PORTAL_PATH "/org/freedesktop/portal/desktop" | ||
| 31 | #define PORTAL_INTERFACE "org.freedesktop.portal.Settings" | ||
| 32 | #define PORTAL_METHOD "Read" | ||
| 33 | |||
| 34 | #define SIGNAL_INTERFACE "org.freedesktop.portal.Settings" | ||
| 35 | #define SIGNAL_NAMESPACE "org.freedesktop.appearance" | ||
| 36 | #define SIGNAL_NAME "SettingChanged" | ||
| 37 | #define SIGNAL_KEY "color-scheme" | ||
| 38 | |||
| 39 | typedef struct SystemThemeData | ||
| 40 | { | ||
| 41 | SDL_DBusContext *dbus; | ||
| 42 | SDL_SystemTheme theme; | ||
| 43 | } SystemThemeData; | ||
| 44 | |||
| 45 | static SystemThemeData system_theme_data; | ||
| 46 | |||
| 47 | static bool DBus_ExtractThemeVariant(DBusMessageIter *iter, SDL_SystemTheme *theme) { | ||
| 48 | SDL_DBusContext *dbus = system_theme_data.dbus; | ||
| 49 | Uint32 color_scheme; | ||
| 50 | DBusMessageIter variant_iter; | ||
| 51 | |||
| 52 | if (dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_VARIANT) | ||
| 53 | return false; | ||
| 54 | dbus->message_iter_recurse(iter, &variant_iter); | ||
| 55 | if (dbus->message_iter_get_arg_type(&variant_iter) != DBUS_TYPE_UINT32) | ||
| 56 | return false; | ||
| 57 | dbus->message_iter_get_basic(&variant_iter, &color_scheme); | ||
| 58 | switch (color_scheme) { | ||
| 59 | case 0: | ||
| 60 | *theme = SDL_SYSTEM_THEME_UNKNOWN; | ||
| 61 | break; | ||
| 62 | case 1: | ||
| 63 | *theme = SDL_SYSTEM_THEME_DARK; | ||
| 64 | break; | ||
| 65 | case 2: | ||
| 66 | *theme = SDL_SYSTEM_THEME_LIGHT; | ||
| 67 | break; | ||
| 68 | } | ||
| 69 | return true; | ||
| 70 | } | ||
| 71 | |||
| 72 | static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) { | ||
| 73 | SDL_DBusContext *dbus = (SDL_DBusContext *)data; | ||
| 74 | |||
| 75 | if (dbus->message_is_signal(msg, SIGNAL_INTERFACE, SIGNAL_NAME)) { | ||
| 76 | DBusMessageIter signal_iter; | ||
| 77 | const char *namespace, *key; | ||
| 78 | |||
| 79 | dbus->message_iter_init(msg, &signal_iter); | ||
| 80 | // Check if the parameters are what we expect | ||
| 81 | if (dbus->message_iter_get_arg_type(&signal_iter) != DBUS_TYPE_STRING) | ||
| 82 | goto not_our_signal; | ||
| 83 | dbus->message_iter_get_basic(&signal_iter, &namespace); | ||
| 84 | if (SDL_strcmp(SIGNAL_NAMESPACE, namespace) != 0) | ||
| 85 | goto not_our_signal; | ||
| 86 | |||
| 87 | if (!dbus->message_iter_next(&signal_iter)) | ||
| 88 | goto not_our_signal; | ||
| 89 | |||
| 90 | if (dbus->message_iter_get_arg_type(&signal_iter) != DBUS_TYPE_STRING) | ||
| 91 | goto not_our_signal; | ||
| 92 | dbus->message_iter_get_basic(&signal_iter, &key); | ||
| 93 | if (SDL_strcmp(SIGNAL_KEY, key) != 0) | ||
| 94 | goto not_our_signal; | ||
| 95 | |||
| 96 | if (!dbus->message_iter_next(&signal_iter)) | ||
| 97 | goto not_our_signal; | ||
| 98 | |||
| 99 | if (!DBus_ExtractThemeVariant(&signal_iter, &system_theme_data.theme)) | ||
| 100 | goto not_our_signal; | ||
| 101 | |||
| 102 | SDL_SetSystemTheme(system_theme_data.theme); | ||
| 103 | return DBUS_HANDLER_RESULT_HANDLED; | ||
| 104 | } | ||
| 105 | not_our_signal: | ||
| 106 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | ||
| 107 | } | ||
| 108 | |||
| 109 | bool SDL_SystemTheme_Init(void) | ||
| 110 | { | ||
| 111 | SDL_DBusContext *dbus = SDL_DBus_GetContext(); | ||
| 112 | DBusMessage *msg; | ||
| 113 | static const char *namespace = SIGNAL_NAMESPACE; | ||
| 114 | static const char *key = SIGNAL_KEY; | ||
| 115 | |||
| 116 | system_theme_data.theme = SDL_SYSTEM_THEME_UNKNOWN; | ||
| 117 | system_theme_data.dbus = dbus; | ||
| 118 | if (!dbus) { | ||
| 119 | return false; | ||
| 120 | } | ||
| 121 | |||
| 122 | msg = dbus->message_new_method_call(PORTAL_DESTINATION, PORTAL_PATH, PORTAL_INTERFACE, PORTAL_METHOD); | ||
| 123 | if (msg) { | ||
| 124 | if (dbus->message_append_args(msg, DBUS_TYPE_STRING, &namespace, DBUS_TYPE_STRING, &key, DBUS_TYPE_INVALID)) { | ||
| 125 | DBusMessage *reply = dbus->connection_send_with_reply_and_block(dbus->session_conn, msg, 300, NULL); | ||
| 126 | if (reply) { | ||
| 127 | DBusMessageIter reply_iter, variant_outer_iter; | ||
| 128 | |||
| 129 | dbus->message_iter_init(reply, &reply_iter); | ||
| 130 | // The response has signature <<u>> | ||
| 131 | if (dbus->message_iter_get_arg_type(&reply_iter) != DBUS_TYPE_VARIANT) | ||
| 132 | goto incorrect_type; | ||
| 133 | dbus->message_iter_recurse(&reply_iter, &variant_outer_iter); | ||
| 134 | if (!DBus_ExtractThemeVariant(&variant_outer_iter, &system_theme_data.theme)) | ||
| 135 | goto incorrect_type; | ||
| 136 | incorrect_type: | ||
| 137 | dbus->message_unref(reply); | ||
| 138 | } | ||
| 139 | } | ||
| 140 | dbus->message_unref(msg); | ||
| 141 | } | ||
| 142 | |||
| 143 | dbus->bus_add_match(dbus->session_conn, | ||
| 144 | "type='signal', interface='"SIGNAL_INTERFACE"'," | ||
| 145 | "member='"SIGNAL_NAME"', arg0='"SIGNAL_NAMESPACE"'," | ||
| 146 | "arg1='"SIGNAL_KEY"'", NULL); | ||
| 147 | dbus->connection_add_filter(dbus->session_conn, | ||
| 148 | &DBus_MessageFilter, dbus, NULL); | ||
| 149 | dbus->connection_flush(dbus->session_conn); | ||
| 150 | return true; | ||
| 151 | } | ||
| 152 | |||
| 153 | SDL_SystemTheme SDL_SystemTheme_Get(void) | ||
| 154 | { | ||
| 155 | return system_theme_data.theme; | ||
| 156 | } | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_system_theme.h b/contrib/SDL-3.2.8/src/core/linux/SDL_system_theme.h new file mode 100644 index 0000000..2cd55cd --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_system_theme.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #ifndef SDL_system_theme_h_ | ||
| 23 | #define SDL_system_theme_h_ | ||
| 24 | |||
| 25 | #include "SDL_internal.h" | ||
| 26 | |||
| 27 | extern bool SDL_SystemTheme_Init(void); | ||
| 28 | extern SDL_SystemTheme SDL_SystemTheme_Get(void); | ||
| 29 | |||
| 30 | #endif // SDL_system_theme_h_ | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_threadprio.c b/contrib/SDL-3.2.8/src/core/linux/SDL_threadprio.c new file mode 100644 index 0000000..1a3e22f --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_threadprio.c | |||
| @@ -0,0 +1,345 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifdef SDL_PLATFORM_LINUX | ||
| 24 | |||
| 25 | #ifndef SDL_THREADS_DISABLED | ||
| 26 | #include <sys/time.h> | ||
| 27 | #include <sys/resource.h> | ||
| 28 | #include <pthread.h> | ||
| 29 | #include <sched.h> | ||
| 30 | #include <unistd.h> | ||
| 31 | |||
| 32 | // RLIMIT_RTTIME requires kernel >= 2.6.25 and is in glibc >= 2.14 | ||
| 33 | #ifndef RLIMIT_RTTIME | ||
| 34 | #define RLIMIT_RTTIME 15 | ||
| 35 | #endif | ||
| 36 | // SCHED_RESET_ON_FORK is in kernel >= 2.6.32. | ||
| 37 | #ifndef SCHED_RESET_ON_FORK | ||
| 38 | #define SCHED_RESET_ON_FORK 0x40000000 | ||
| 39 | #endif | ||
| 40 | |||
| 41 | #include "SDL_dbus.h" | ||
| 42 | |||
| 43 | #ifdef SDL_USE_LIBDBUS | ||
| 44 | |||
| 45 | // d-bus queries to org.freedesktop.RealtimeKit1. | ||
| 46 | #define RTKIT_DBUS_NODE "org.freedesktop.RealtimeKit1" | ||
| 47 | #define RTKIT_DBUS_PATH "/org/freedesktop/RealtimeKit1" | ||
| 48 | #define RTKIT_DBUS_INTERFACE "org.freedesktop.RealtimeKit1" | ||
| 49 | |||
| 50 | // d-bus queries to the XDG portal interface to RealtimeKit1 | ||
| 51 | #define XDG_PORTAL_DBUS_NODE "org.freedesktop.portal.Desktop" | ||
| 52 | #define XDG_PORTAL_DBUS_PATH "/org/freedesktop/portal/desktop" | ||
| 53 | #define XDG_PORTAL_DBUS_INTERFACE "org.freedesktop.portal.Realtime" | ||
| 54 | |||
| 55 | static bool rtkit_use_session_conn; | ||
| 56 | static const char *rtkit_dbus_node; | ||
| 57 | static const char *rtkit_dbus_path; | ||
| 58 | static const char *rtkit_dbus_interface; | ||
| 59 | |||
| 60 | static pthread_once_t rtkit_initialize_once = PTHREAD_ONCE_INIT; | ||
| 61 | static Sint32 rtkit_min_nice_level = -20; | ||
| 62 | static Sint32 rtkit_max_realtime_priority = 99; | ||
| 63 | static Sint64 rtkit_max_rttime_usec = 200000; | ||
| 64 | |||
| 65 | /* | ||
| 66 | * Checking that the RTTimeUSecMax property exists and is an int64 confirms that: | ||
| 67 | * - The desktop portal exists and supports the realtime interface. | ||
| 68 | * - The realtime interface is new enough to have the required bug fixes applied. | ||
| 69 | */ | ||
| 70 | static bool realtime_portal_supported(DBusConnection *conn) | ||
| 71 | { | ||
| 72 | Sint64 res; | ||
| 73 | return SDL_DBus_QueryPropertyOnConnection(conn, XDG_PORTAL_DBUS_NODE, XDG_PORTAL_DBUS_PATH, XDG_PORTAL_DBUS_INTERFACE, | ||
| 74 | "RTTimeUSecMax", DBUS_TYPE_INT64, &res); | ||
| 75 | } | ||
| 76 | |||
| 77 | static void set_rtkit_interface(void) | ||
| 78 | { | ||
| 79 | SDL_DBusContext *dbus = SDL_DBus_GetContext(); | ||
| 80 | |||
| 81 | // xdg-desktop-portal works in all instances, so check for it first. | ||
| 82 | if (dbus && realtime_portal_supported(dbus->session_conn)) { | ||
| 83 | rtkit_use_session_conn = true; | ||
| 84 | rtkit_dbus_node = XDG_PORTAL_DBUS_NODE; | ||
| 85 | rtkit_dbus_path = XDG_PORTAL_DBUS_PATH; | ||
| 86 | rtkit_dbus_interface = XDG_PORTAL_DBUS_INTERFACE; | ||
| 87 | } else { // Fall back to the standard rtkit interface in all other cases. | ||
| 88 | rtkit_use_session_conn = false; | ||
| 89 | rtkit_dbus_node = RTKIT_DBUS_NODE; | ||
| 90 | rtkit_dbus_path = RTKIT_DBUS_PATH; | ||
| 91 | rtkit_dbus_interface = RTKIT_DBUS_INTERFACE; | ||
| 92 | } | ||
| 93 | } | ||
| 94 | |||
| 95 | static DBusConnection *get_rtkit_dbus_connection(void) | ||
| 96 | { | ||
| 97 | SDL_DBusContext *dbus = SDL_DBus_GetContext(); | ||
| 98 | |||
| 99 | if (dbus) { | ||
| 100 | return rtkit_use_session_conn ? dbus->session_conn : dbus->system_conn; | ||
| 101 | } | ||
| 102 | |||
| 103 | return NULL; | ||
| 104 | } | ||
| 105 | |||
| 106 | static void rtkit_initialize(void) | ||
| 107 | { | ||
| 108 | DBusConnection *dbus_conn; | ||
| 109 | |||
| 110 | set_rtkit_interface(); | ||
| 111 | dbus_conn = get_rtkit_dbus_connection(); | ||
| 112 | |||
| 113 | // Try getting minimum nice level: this is often greater than PRIO_MIN (-20). | ||
| 114 | if (!dbus_conn || !SDL_DBus_QueryPropertyOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MinNiceLevel", | ||
| 115 | DBUS_TYPE_INT32, &rtkit_min_nice_level)) { | ||
| 116 | rtkit_min_nice_level = -20; | ||
| 117 | } | ||
| 118 | |||
| 119 | // Try getting maximum realtime priority: this can be less than the POSIX default (99). | ||
| 120 | if (!dbus_conn || !SDL_DBus_QueryPropertyOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MaxRealtimePriority", | ||
| 121 | DBUS_TYPE_INT32, &rtkit_max_realtime_priority)) { | ||
| 122 | rtkit_max_realtime_priority = 99; | ||
| 123 | } | ||
| 124 | |||
| 125 | // Try getting maximum rttime allowed by rtkit: exceeding this value will result in SIGKILL | ||
| 126 | if (!dbus_conn || !SDL_DBus_QueryPropertyOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "RTTimeUSecMax", | ||
| 127 | DBUS_TYPE_INT64, &rtkit_max_rttime_usec)) { | ||
| 128 | rtkit_max_rttime_usec = 200000; | ||
| 129 | } | ||
| 130 | } | ||
| 131 | |||
| 132 | static bool rtkit_initialize_realtime_thread(void) | ||
| 133 | { | ||
| 134 | // Following is an excerpt from rtkit README that outlines the requirements | ||
| 135 | // a thread must meet before making rtkit requests: | ||
| 136 | // | ||
| 137 | // * Only clients with RLIMIT_RTTIME set will get RT scheduling | ||
| 138 | // | ||
| 139 | // * RT scheduling will only be handed out to processes with | ||
| 140 | // SCHED_RESET_ON_FORK set to guarantee that the scheduling | ||
| 141 | // settings cannot 'leak' to child processes, thus making sure | ||
| 142 | // that 'RT fork bombs' cannot be used to bypass RLIMIT_RTTIME | ||
| 143 | // and take the system down. | ||
| 144 | // | ||
| 145 | // * Limits are enforced on all user controllable resources, only | ||
| 146 | // a maximum number of users, processes, threads can request RT | ||
| 147 | // scheduling at the same time. | ||
| 148 | // | ||
| 149 | // * Only a limited number of threads may be made RT in a | ||
| 150 | // specific time frame. | ||
| 151 | // | ||
| 152 | // * Client authorization is verified with PolicyKit | ||
| 153 | |||
| 154 | int err; | ||
| 155 | struct rlimit rlimit; | ||
| 156 | int nLimit = RLIMIT_RTTIME; | ||
| 157 | pid_t nPid = 0; // self | ||
| 158 | int nSchedPolicy = sched_getscheduler(nPid) | SCHED_RESET_ON_FORK; | ||
| 159 | struct sched_param schedParam; | ||
| 160 | |||
| 161 | SDL_zero(schedParam); | ||
| 162 | |||
| 163 | // Requirement #1: Set RLIMIT_RTTIME | ||
| 164 | err = getrlimit(nLimit, &rlimit); | ||
| 165 | if (err) { | ||
| 166 | return false; | ||
| 167 | } | ||
| 168 | |||
| 169 | // Current rtkit allows a max of 200ms right now | ||
| 170 | rlimit.rlim_max = rtkit_max_rttime_usec; | ||
| 171 | rlimit.rlim_cur = rlimit.rlim_max / 2; | ||
| 172 | err = setrlimit(nLimit, &rlimit); | ||
| 173 | if (err) { | ||
| 174 | return false; | ||
| 175 | } | ||
| 176 | |||
| 177 | // Requirement #2: Add SCHED_RESET_ON_FORK to the scheduler policy | ||
| 178 | err = sched_getparam(nPid, &schedParam); | ||
| 179 | if (err) { | ||
| 180 | return false; | ||
| 181 | } | ||
| 182 | |||
| 183 | err = sched_setscheduler(nPid, nSchedPolicy, &schedParam); | ||
| 184 | if (err) { | ||
| 185 | return false; | ||
| 186 | } | ||
| 187 | |||
| 188 | return true; | ||
| 189 | } | ||
| 190 | |||
| 191 | static bool rtkit_setpriority_nice(pid_t thread, int nice_level) | ||
| 192 | { | ||
| 193 | DBusConnection *dbus_conn; | ||
| 194 | Uint64 pid = (Uint64)getpid(); | ||
| 195 | Uint64 tid = (Uint64)thread; | ||
| 196 | Sint32 nice = (Sint32)nice_level; | ||
| 197 | |||
| 198 | pthread_once(&rtkit_initialize_once, rtkit_initialize); | ||
| 199 | dbus_conn = get_rtkit_dbus_connection(); | ||
| 200 | |||
| 201 | if (nice < rtkit_min_nice_level) { | ||
| 202 | nice = rtkit_min_nice_level; | ||
| 203 | } | ||
| 204 | |||
| 205 | if (!dbus_conn || !SDL_DBus_CallMethodOnConnection(dbus_conn, | ||
| 206 | rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MakeThreadHighPriorityWithPID", | ||
| 207 | DBUS_TYPE_UINT64, &pid, DBUS_TYPE_UINT64, &tid, DBUS_TYPE_INT32, &nice, DBUS_TYPE_INVALID, | ||
| 208 | DBUS_TYPE_INVALID)) { | ||
| 209 | return false; | ||
| 210 | } | ||
| 211 | return true; | ||
| 212 | } | ||
| 213 | |||
| 214 | static bool rtkit_setpriority_realtime(pid_t thread, int rt_priority) | ||
| 215 | { | ||
| 216 | DBusConnection *dbus_conn; | ||
| 217 | Uint64 pid = (Uint64)getpid(); | ||
| 218 | Uint64 tid = (Uint64)thread; | ||
| 219 | Uint32 priority = (Uint32)rt_priority; | ||
| 220 | |||
| 221 | pthread_once(&rtkit_initialize_once, rtkit_initialize); | ||
| 222 | dbus_conn = get_rtkit_dbus_connection(); | ||
| 223 | |||
| 224 | if (priority > rtkit_max_realtime_priority) { | ||
| 225 | priority = rtkit_max_realtime_priority; | ||
| 226 | } | ||
| 227 | |||
| 228 | // We always perform the thread state changes necessary for rtkit. | ||
| 229 | // This wastes some system calls if the state is already set but | ||
| 230 | // typically code sets a thread priority and leaves it so it's | ||
| 231 | // not expected that this wasted effort will be an issue. | ||
| 232 | // We also do not quit if this fails, we let the rtkit request | ||
| 233 | // go through to determine whether it really needs to fail or not. | ||
| 234 | rtkit_initialize_realtime_thread(); | ||
| 235 | |||
| 236 | if (!dbus_conn || !SDL_DBus_CallMethodOnConnection(dbus_conn, | ||
| 237 | rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MakeThreadRealtimeWithPID", | ||
| 238 | DBUS_TYPE_UINT64, &pid, DBUS_TYPE_UINT64, &tid, DBUS_TYPE_UINT32, &priority, DBUS_TYPE_INVALID, | ||
| 239 | DBUS_TYPE_INVALID)) { | ||
| 240 | return false; | ||
| 241 | } | ||
| 242 | return true; | ||
| 243 | } | ||
| 244 | #else | ||
| 245 | |||
| 246 | #define rtkit_max_realtime_priority 99 | ||
| 247 | |||
| 248 | #endif // dbus | ||
| 249 | #endif // threads | ||
| 250 | |||
| 251 | // this is a public symbol, so it has to exist even if threads are disabled. | ||
| 252 | bool SDL_SetLinuxThreadPriority(Sint64 threadID, int priority) | ||
| 253 | { | ||
| 254 | #ifdef SDL_THREADS_DISABLED | ||
| 255 | return SDL_Unsupported(); | ||
| 256 | #else | ||
| 257 | if (setpriority(PRIO_PROCESS, (id_t)threadID, priority) == 0) { | ||
| 258 | return true; | ||
| 259 | } | ||
| 260 | |||
| 261 | #ifdef SDL_USE_LIBDBUS | ||
| 262 | /* Note that this fails you most likely: | ||
| 263 | * Have your process's scheduler incorrectly configured. | ||
| 264 | See the requirements at: | ||
| 265 | http://git.0pointer.net/rtkit.git/tree/README#n16 | ||
| 266 | * Encountered dbus/polkit security restrictions. Note | ||
| 267 | that the RealtimeKit1 dbus endpoint is inaccessible | ||
| 268 | over ssh connections for most common distro configs. | ||
| 269 | You might want to check your local config for details: | ||
| 270 | /usr/share/polkit-1/actions/org.freedesktop.RealtimeKit1.policy | ||
| 271 | |||
| 272 | README and sample code at: http://git.0pointer.net/rtkit.git | ||
| 273 | */ | ||
| 274 | if (rtkit_setpriority_nice((pid_t)threadID, priority)) { | ||
| 275 | return true; | ||
| 276 | } | ||
| 277 | #endif | ||
| 278 | |||
| 279 | return SDL_SetError("setpriority() failed"); | ||
| 280 | #endif | ||
| 281 | } | ||
| 282 | |||
| 283 | // this is a public symbol, so it has to exist even if threads are disabled. | ||
| 284 | bool SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy) | ||
| 285 | { | ||
| 286 | #ifdef SDL_THREADS_DISABLED | ||
| 287 | return SDL_Unsupported(); | ||
| 288 | #else | ||
| 289 | int osPriority; | ||
| 290 | |||
| 291 | if (schedPolicy == SCHED_RR || schedPolicy == SCHED_FIFO) { | ||
| 292 | if (sdlPriority == SDL_THREAD_PRIORITY_LOW) { | ||
| 293 | osPriority = 1; | ||
| 294 | } else if (sdlPriority == SDL_THREAD_PRIORITY_HIGH) { | ||
| 295 | osPriority = rtkit_max_realtime_priority * 3 / 4; | ||
| 296 | } else if (sdlPriority == SDL_THREAD_PRIORITY_TIME_CRITICAL) { | ||
| 297 | osPriority = rtkit_max_realtime_priority; | ||
| 298 | } else { | ||
| 299 | osPriority = rtkit_max_realtime_priority / 2; | ||
| 300 | } | ||
| 301 | } else { | ||
| 302 | if (sdlPriority == SDL_THREAD_PRIORITY_LOW) { | ||
| 303 | osPriority = 19; | ||
| 304 | } else if (sdlPriority == SDL_THREAD_PRIORITY_HIGH) { | ||
| 305 | osPriority = -10; | ||
| 306 | } else if (sdlPriority == SDL_THREAD_PRIORITY_TIME_CRITICAL) { | ||
| 307 | osPriority = -20; | ||
| 308 | } else { | ||
| 309 | osPriority = 0; | ||
| 310 | } | ||
| 311 | |||
| 312 | if (setpriority(PRIO_PROCESS, (id_t)threadID, osPriority) == 0) { | ||
| 313 | return true; | ||
| 314 | } | ||
| 315 | } | ||
| 316 | |||
| 317 | #ifdef SDL_USE_LIBDBUS | ||
| 318 | /* Note that this fails you most likely: | ||
| 319 | * Have your process's scheduler incorrectly configured. | ||
| 320 | See the requirements at: | ||
| 321 | http://git.0pointer.net/rtkit.git/tree/README#n16 | ||
| 322 | * Encountered dbus/polkit security restrictions. Note | ||
| 323 | that the RealtimeKit1 dbus endpoint is inaccessible | ||
| 324 | over ssh connections for most common distro configs. | ||
| 325 | You might want to check your local config for details: | ||
| 326 | /usr/share/polkit-1/actions/org.freedesktop.RealtimeKit1.policy | ||
| 327 | |||
| 328 | README and sample code at: http://git.0pointer.net/rtkit.git | ||
| 329 | */ | ||
| 330 | if (schedPolicy == SCHED_RR || schedPolicy == SCHED_FIFO) { | ||
| 331 | if (rtkit_setpriority_realtime((pid_t)threadID, osPriority)) { | ||
| 332 | return true; | ||
| 333 | } | ||
| 334 | } else { | ||
| 335 | if (rtkit_setpriority_nice((pid_t)threadID, osPriority)) { | ||
| 336 | return true; | ||
| 337 | } | ||
| 338 | } | ||
| 339 | #endif | ||
| 340 | |||
| 341 | return SDL_SetError("setpriority() failed"); | ||
| 342 | #endif | ||
| 343 | } | ||
| 344 | |||
| 345 | #endif // SDL_PLATFORM_LINUX | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_udev.c b/contrib/SDL-3.2.8/src/core/linux/SDL_udev.c new file mode 100644 index 0000000..907c34c --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_udev.c | |||
| @@ -0,0 +1,596 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | /* | ||
| 24 | * To list the properties of a device, try something like: | ||
| 25 | * udevadm info -a -n snd/hwC0D0 (for a sound card) | ||
| 26 | * udevadm info --query=all -n input/event3 (for a keyboard, mouse, etc) | ||
| 27 | * udevadm info --query=property -n input/event2 | ||
| 28 | */ | ||
| 29 | #include "SDL_udev.h" | ||
| 30 | |||
| 31 | #ifdef SDL_USE_LIBUDEV | ||
| 32 | |||
| 33 | #include <linux/input.h> | ||
| 34 | #include <sys/stat.h> | ||
| 35 | |||
| 36 | #include "SDL_evdev_capabilities.h" | ||
| 37 | #include "../unix/SDL_poll.h" | ||
| 38 | |||
| 39 | static const char *SDL_UDEV_LIBS[] = { "libudev.so.1", "libudev.so.0" }; | ||
| 40 | |||
| 41 | static SDL_UDEV_PrivateData *_this = NULL; | ||
| 42 | |||
| 43 | static bool SDL_UDEV_load_sym(const char *fn, void **addr); | ||
| 44 | static bool SDL_UDEV_load_syms(void); | ||
| 45 | static bool SDL_UDEV_hotplug_update_available(void); | ||
| 46 | static void get_caps(struct udev_device *dev, struct udev_device *pdev, const char *attr, unsigned long *bitmask, size_t bitmask_len); | ||
| 47 | static int guess_device_class(struct udev_device *dev); | ||
| 48 | static int device_class(struct udev_device *dev); | ||
| 49 | static void device_event(SDL_UDEV_deviceevent type, struct udev_device *dev); | ||
| 50 | |||
| 51 | static bool SDL_UDEV_load_sym(const char *fn, void **addr) | ||
| 52 | { | ||
| 53 | *addr = SDL_LoadFunction(_this->udev_handle, fn); | ||
| 54 | if (!*addr) { | ||
| 55 | // Don't call SDL_SetError(): SDL_LoadFunction already did. | ||
| 56 | return false; | ||
| 57 | } | ||
| 58 | |||
| 59 | return true; | ||
| 60 | } | ||
| 61 | |||
| 62 | static bool SDL_UDEV_load_syms(void) | ||
| 63 | { | ||
| 64 | /* cast funcs to char* first, to please GCC's strict aliasing rules. */ | ||
| 65 | #define SDL_UDEV_SYM(x) \ | ||
| 66 | if (!SDL_UDEV_load_sym(#x, (void **)(char *)&_this->syms.x)) \ | ||
| 67 | return false | ||
| 68 | |||
| 69 | SDL_UDEV_SYM(udev_device_get_action); | ||
| 70 | SDL_UDEV_SYM(udev_device_get_devnode); | ||
| 71 | SDL_UDEV_SYM(udev_device_get_syspath); | ||
| 72 | SDL_UDEV_SYM(udev_device_get_subsystem); | ||
| 73 | SDL_UDEV_SYM(udev_device_get_parent_with_subsystem_devtype); | ||
| 74 | SDL_UDEV_SYM(udev_device_get_property_value); | ||
| 75 | SDL_UDEV_SYM(udev_device_get_sysattr_value); | ||
| 76 | SDL_UDEV_SYM(udev_device_new_from_syspath); | ||
| 77 | SDL_UDEV_SYM(udev_device_unref); | ||
| 78 | SDL_UDEV_SYM(udev_enumerate_add_match_property); | ||
| 79 | SDL_UDEV_SYM(udev_enumerate_add_match_subsystem); | ||
| 80 | SDL_UDEV_SYM(udev_enumerate_get_list_entry); | ||
| 81 | SDL_UDEV_SYM(udev_enumerate_new); | ||
| 82 | SDL_UDEV_SYM(udev_enumerate_scan_devices); | ||
| 83 | SDL_UDEV_SYM(udev_enumerate_unref); | ||
| 84 | SDL_UDEV_SYM(udev_list_entry_get_name); | ||
| 85 | SDL_UDEV_SYM(udev_list_entry_get_next); | ||
| 86 | SDL_UDEV_SYM(udev_monitor_enable_receiving); | ||
| 87 | SDL_UDEV_SYM(udev_monitor_filter_add_match_subsystem_devtype); | ||
| 88 | SDL_UDEV_SYM(udev_monitor_get_fd); | ||
| 89 | SDL_UDEV_SYM(udev_monitor_new_from_netlink); | ||
| 90 | SDL_UDEV_SYM(udev_monitor_receive_device); | ||
| 91 | SDL_UDEV_SYM(udev_monitor_unref); | ||
| 92 | SDL_UDEV_SYM(udev_new); | ||
| 93 | SDL_UDEV_SYM(udev_unref); | ||
| 94 | SDL_UDEV_SYM(udev_device_new_from_devnum); | ||
| 95 | SDL_UDEV_SYM(udev_device_get_devnum); | ||
| 96 | #undef SDL_UDEV_SYM | ||
| 97 | |||
| 98 | return true; | ||
| 99 | } | ||
| 100 | |||
| 101 | static bool SDL_UDEV_hotplug_update_available(void) | ||
| 102 | { | ||
| 103 | if (_this->udev_mon) { | ||
| 104 | const int fd = _this->syms.udev_monitor_get_fd(_this->udev_mon); | ||
| 105 | if (SDL_IOReady(fd, SDL_IOR_READ, 0)) { | ||
| 106 | return true; | ||
| 107 | } | ||
| 108 | } | ||
| 109 | return false; | ||
| 110 | } | ||
| 111 | |||
| 112 | bool SDL_UDEV_Init(void) | ||
| 113 | { | ||
| 114 | if (!_this) { | ||
| 115 | _this = (SDL_UDEV_PrivateData *)SDL_calloc(1, sizeof(*_this)); | ||
| 116 | if (!_this) { | ||
| 117 | return false; | ||
| 118 | } | ||
| 119 | |||
| 120 | if (!SDL_UDEV_LoadLibrary()) { | ||
| 121 | SDL_UDEV_Quit(); | ||
| 122 | return false; | ||
| 123 | } | ||
| 124 | |||
| 125 | /* Set up udev monitoring | ||
| 126 | * Listen for input devices (mouse, keyboard, joystick, etc) and sound devices | ||
| 127 | */ | ||
| 128 | |||
| 129 | _this->udev = _this->syms.udev_new(); | ||
| 130 | if (!_this->udev) { | ||
| 131 | SDL_UDEV_Quit(); | ||
| 132 | return SDL_SetError("udev_new() failed"); | ||
| 133 | } | ||
| 134 | |||
| 135 | _this->udev_mon = _this->syms.udev_monitor_new_from_netlink(_this->udev, "udev"); | ||
| 136 | if (!_this->udev_mon) { | ||
| 137 | SDL_UDEV_Quit(); | ||
| 138 | return SDL_SetError("udev_monitor_new_from_netlink() failed"); | ||
| 139 | } | ||
| 140 | |||
| 141 | _this->syms.udev_monitor_filter_add_match_subsystem_devtype(_this->udev_mon, "input", NULL); | ||
| 142 | _this->syms.udev_monitor_filter_add_match_subsystem_devtype(_this->udev_mon, "sound", NULL); | ||
| 143 | _this->syms.udev_monitor_filter_add_match_subsystem_devtype(_this->udev_mon, "video4linux", NULL); | ||
| 144 | _this->syms.udev_monitor_enable_receiving(_this->udev_mon); | ||
| 145 | |||
| 146 | // Do an initial scan of existing devices | ||
| 147 | SDL_UDEV_Scan(); | ||
| 148 | } | ||
| 149 | |||
| 150 | _this->ref_count += 1; | ||
| 151 | |||
| 152 | return true; | ||
| 153 | } | ||
| 154 | |||
| 155 | void SDL_UDEV_Quit(void) | ||
| 156 | { | ||
| 157 | if (!_this) { | ||
| 158 | return; | ||
| 159 | } | ||
| 160 | |||
| 161 | _this->ref_count -= 1; | ||
| 162 | |||
| 163 | if (_this->ref_count < 1) { | ||
| 164 | |||
| 165 | if (_this->udev_mon) { | ||
| 166 | _this->syms.udev_monitor_unref(_this->udev_mon); | ||
| 167 | _this->udev_mon = NULL; | ||
| 168 | } | ||
| 169 | if (_this->udev) { | ||
| 170 | _this->syms.udev_unref(_this->udev); | ||
| 171 | _this->udev = NULL; | ||
| 172 | } | ||
| 173 | |||
| 174 | // Remove existing devices | ||
| 175 | while (_this->first) { | ||
| 176 | SDL_UDEV_CallbackList *item = _this->first; | ||
| 177 | _this->first = _this->first->next; | ||
| 178 | SDL_free(item); | ||
| 179 | } | ||
| 180 | |||
| 181 | SDL_UDEV_UnloadLibrary(); | ||
| 182 | SDL_free(_this); | ||
| 183 | _this = NULL; | ||
| 184 | } | ||
| 185 | } | ||
| 186 | |||
| 187 | bool SDL_UDEV_Scan(void) | ||
| 188 | { | ||
| 189 | struct udev_enumerate *enumerate = NULL; | ||
| 190 | struct udev_list_entry *devs = NULL; | ||
| 191 | struct udev_list_entry *item = NULL; | ||
| 192 | |||
| 193 | if (!_this) { | ||
| 194 | return true; | ||
| 195 | } | ||
| 196 | |||
| 197 | enumerate = _this->syms.udev_enumerate_new(_this->udev); | ||
| 198 | if (!enumerate) { | ||
| 199 | SDL_UDEV_Quit(); | ||
| 200 | return SDL_SetError("udev_enumerate_new() failed"); | ||
| 201 | } | ||
| 202 | |||
| 203 | _this->syms.udev_enumerate_add_match_subsystem(enumerate, "input"); | ||
| 204 | _this->syms.udev_enumerate_add_match_subsystem(enumerate, "sound"); | ||
| 205 | _this->syms.udev_enumerate_add_match_subsystem(enumerate, "video4linux"); | ||
| 206 | |||
| 207 | _this->syms.udev_enumerate_scan_devices(enumerate); | ||
| 208 | devs = _this->syms.udev_enumerate_get_list_entry(enumerate); | ||
| 209 | for (item = devs; item; item = _this->syms.udev_list_entry_get_next(item)) { | ||
| 210 | const char *path = _this->syms.udev_list_entry_get_name(item); | ||
| 211 | struct udev_device *dev = _this->syms.udev_device_new_from_syspath(_this->udev, path); | ||
| 212 | if (dev) { | ||
| 213 | device_event(SDL_UDEV_DEVICEADDED, dev); | ||
| 214 | _this->syms.udev_device_unref(dev); | ||
| 215 | } | ||
| 216 | } | ||
| 217 | |||
| 218 | _this->syms.udev_enumerate_unref(enumerate); | ||
| 219 | return true; | ||
| 220 | } | ||
| 221 | |||
| 222 | bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *product, Uint16 *version, int *class) | ||
| 223 | { | ||
| 224 | struct stat statbuf; | ||
| 225 | char type; | ||
| 226 | struct udev_device *dev; | ||
| 227 | const char* val; | ||
| 228 | int class_temp; | ||
| 229 | |||
| 230 | if (!_this) { | ||
| 231 | return false; | ||
| 232 | } | ||
| 233 | |||
| 234 | if (stat(device_path, &statbuf) == -1) { | ||
| 235 | return false; | ||
| 236 | } | ||
| 237 | |||
| 238 | if (S_ISBLK(statbuf.st_mode)) { | ||
| 239 | type = 'b'; | ||
| 240 | } | ||
| 241 | else if (S_ISCHR(statbuf.st_mode)) { | ||
| 242 | type = 'c'; | ||
| 243 | } | ||
| 244 | else { | ||
| 245 | return false; | ||
| 246 | } | ||
| 247 | |||
| 248 | dev = _this->syms.udev_device_new_from_devnum(_this->udev, type, statbuf.st_rdev); | ||
| 249 | |||
| 250 | if (!dev) { | ||
| 251 | return false; | ||
| 252 | } | ||
| 253 | |||
| 254 | val = _this->syms.udev_device_get_property_value(dev, "ID_VENDOR_ID"); | ||
| 255 | if (val) { | ||
| 256 | *vendor = (Uint16)SDL_strtol(val, NULL, 16); | ||
| 257 | } | ||
| 258 | |||
| 259 | val = _this->syms.udev_device_get_property_value(dev, "ID_MODEL_ID"); | ||
| 260 | if (val) { | ||
| 261 | *product = (Uint16)SDL_strtol(val, NULL, 16); | ||
| 262 | } | ||
| 263 | |||
| 264 | val = _this->syms.udev_device_get_property_value(dev, "ID_REVISION"); | ||
| 265 | if (val) { | ||
| 266 | *version = (Uint16)SDL_strtol(val, NULL, 16); | ||
| 267 | } | ||
| 268 | |||
| 269 | class_temp = device_class(dev); | ||
| 270 | if (class_temp) { | ||
| 271 | *class = class_temp; | ||
| 272 | } | ||
| 273 | |||
| 274 | _this->syms.udev_device_unref(dev); | ||
| 275 | |||
| 276 | return true; | ||
| 277 | } | ||
| 278 | |||
| 279 | void SDL_UDEV_UnloadLibrary(void) | ||
| 280 | { | ||
| 281 | if (!_this) { | ||
| 282 | return; | ||
| 283 | } | ||
| 284 | |||
| 285 | if (_this->udev_handle) { | ||
| 286 | SDL_UnloadObject(_this->udev_handle); | ||
| 287 | _this->udev_handle = NULL; | ||
| 288 | } | ||
| 289 | } | ||
| 290 | |||
| 291 | bool SDL_UDEV_LoadLibrary(void) | ||
| 292 | { | ||
| 293 | bool result = true; | ||
| 294 | |||
| 295 | if (!_this) { | ||
| 296 | return SDL_SetError("UDEV not initialized"); | ||
| 297 | } | ||
| 298 | |||
| 299 | // See if there is a udev library already loaded | ||
| 300 | if (SDL_UDEV_load_syms()) { | ||
| 301 | return true; | ||
| 302 | } | ||
| 303 | |||
| 304 | #ifdef SDL_UDEV_DYNAMIC | ||
| 305 | // Check for the build environment's libudev first | ||
| 306 | if (!_this->udev_handle) { | ||
| 307 | _this->udev_handle = SDL_LoadObject(SDL_UDEV_DYNAMIC); | ||
| 308 | if (_this->udev_handle) { | ||
| 309 | result = SDL_UDEV_load_syms(); | ||
| 310 | if (!result) { | ||
| 311 | SDL_UDEV_UnloadLibrary(); | ||
| 312 | } | ||
| 313 | } | ||
| 314 | } | ||
| 315 | #endif | ||
| 316 | |||
| 317 | if (!_this->udev_handle) { | ||
| 318 | for (int i = 0; i < SDL_arraysize(SDL_UDEV_LIBS); i++) { | ||
| 319 | _this->udev_handle = SDL_LoadObject(SDL_UDEV_LIBS[i]); | ||
| 320 | if (_this->udev_handle) { | ||
| 321 | result = SDL_UDEV_load_syms(); | ||
| 322 | if (!result) { | ||
| 323 | SDL_UDEV_UnloadLibrary(); | ||
| 324 | } else { | ||
| 325 | break; | ||
| 326 | } | ||
| 327 | } | ||
| 328 | } | ||
| 329 | |||
| 330 | if (!_this->udev_handle) { | ||
| 331 | result = false; | ||
| 332 | // Don't call SDL_SetError(): SDL_LoadObject already did. | ||
| 333 | } | ||
| 334 | } | ||
| 335 | |||
| 336 | return result; | ||
| 337 | } | ||
| 338 | |||
| 339 | static void get_caps(struct udev_device *dev, struct udev_device *pdev, const char *attr, unsigned long *bitmask, size_t bitmask_len) | ||
| 340 | { | ||
| 341 | const char *value; | ||
| 342 | char text[4096]; | ||
| 343 | char *word; | ||
| 344 | int i; | ||
| 345 | unsigned long v; | ||
| 346 | |||
| 347 | SDL_memset(bitmask, 0, bitmask_len * sizeof(*bitmask)); | ||
| 348 | value = _this->syms.udev_device_get_sysattr_value(pdev, attr); | ||
| 349 | if (!value) { | ||
| 350 | return; | ||
| 351 | } | ||
| 352 | |||
| 353 | SDL_strlcpy(text, value, sizeof(text)); | ||
| 354 | i = 0; | ||
| 355 | while ((word = SDL_strrchr(text, ' ')) != NULL) { | ||
| 356 | v = SDL_strtoul(word + 1, NULL, 16); | ||
| 357 | if (i < bitmask_len) { | ||
| 358 | bitmask[i] = v; | ||
| 359 | } | ||
| 360 | ++i; | ||
| 361 | *word = '\0'; | ||
| 362 | } | ||
| 363 | v = SDL_strtoul(text, NULL, 16); | ||
| 364 | if (i < bitmask_len) { | ||
| 365 | bitmask[i] = v; | ||
| 366 | } | ||
| 367 | } | ||
| 368 | |||
| 369 | static int guess_device_class(struct udev_device *dev) | ||
| 370 | { | ||
| 371 | struct udev_device *pdev; | ||
| 372 | unsigned long bitmask_props[NBITS(INPUT_PROP_MAX)]; | ||
| 373 | unsigned long bitmask_ev[NBITS(EV_MAX)]; | ||
| 374 | unsigned long bitmask_abs[NBITS(ABS_MAX)]; | ||
| 375 | unsigned long bitmask_key[NBITS(KEY_MAX)]; | ||
| 376 | unsigned long bitmask_rel[NBITS(REL_MAX)]; | ||
| 377 | |||
| 378 | /* walk up the parental chain until we find the real input device; the | ||
| 379 | * argument is very likely a subdevice of this, like eventN */ | ||
| 380 | pdev = dev; | ||
| 381 | while (pdev && !_this->syms.udev_device_get_sysattr_value(pdev, "capabilities/ev")) { | ||
| 382 | pdev = _this->syms.udev_device_get_parent_with_subsystem_devtype(pdev, "input", NULL); | ||
| 383 | } | ||
| 384 | if (!pdev) { | ||
| 385 | return 0; | ||
| 386 | } | ||
| 387 | |||
| 388 | get_caps(dev, pdev, "properties", bitmask_props, SDL_arraysize(bitmask_props)); | ||
| 389 | get_caps(dev, pdev, "capabilities/ev", bitmask_ev, SDL_arraysize(bitmask_ev)); | ||
| 390 | get_caps(dev, pdev, "capabilities/abs", bitmask_abs, SDL_arraysize(bitmask_abs)); | ||
| 391 | get_caps(dev, pdev, "capabilities/rel", bitmask_rel, SDL_arraysize(bitmask_rel)); | ||
| 392 | get_caps(dev, pdev, "capabilities/key", bitmask_key, SDL_arraysize(bitmask_key)); | ||
| 393 | |||
| 394 | return SDL_EVDEV_GuessDeviceClass(&bitmask_props[0], | ||
| 395 | &bitmask_ev[0], | ||
| 396 | &bitmask_abs[0], | ||
| 397 | &bitmask_key[0], | ||
| 398 | &bitmask_rel[0]); | ||
| 399 | } | ||
| 400 | |||
| 401 | static int device_class(struct udev_device *dev) | ||
| 402 | { | ||
| 403 | const char *subsystem; | ||
| 404 | const char *val = NULL; | ||
| 405 | int devclass = 0; | ||
| 406 | |||
| 407 | subsystem = _this->syms.udev_device_get_subsystem(dev); | ||
| 408 | if (!subsystem) { | ||
| 409 | return 0; | ||
| 410 | } | ||
| 411 | |||
| 412 | if (SDL_strcmp(subsystem, "sound") == 0) { | ||
| 413 | devclass = SDL_UDEV_DEVICE_SOUND; | ||
| 414 | } else if (SDL_strcmp(subsystem, "video4linux") == 0) { | ||
| 415 | val = _this->syms.udev_device_get_property_value(dev, "ID_V4L_CAPABILITIES"); | ||
| 416 | if (val && SDL_strcasestr(val, "capture")) { | ||
| 417 | devclass = SDL_UDEV_DEVICE_VIDEO_CAPTURE; | ||
| 418 | } | ||
| 419 | } else if (SDL_strcmp(subsystem, "input") == 0) { | ||
| 420 | // udev rules reference: http://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-input_id.c | ||
| 421 | |||
| 422 | val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK"); | ||
| 423 | if (val && SDL_strcmp(val, "1") == 0) { | ||
| 424 | devclass |= SDL_UDEV_DEVICE_JOYSTICK; | ||
| 425 | } | ||
| 426 | |||
| 427 | val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER"); | ||
| 428 | if (val && SDL_strcmp(val, "1") == 0) { | ||
| 429 | devclass |= SDL_UDEV_DEVICE_ACCELEROMETER; | ||
| 430 | } | ||
| 431 | |||
| 432 | val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_MOUSE"); | ||
| 433 | if (val && SDL_strcmp(val, "1") == 0) { | ||
| 434 | devclass |= SDL_UDEV_DEVICE_MOUSE; | ||
| 435 | } | ||
| 436 | |||
| 437 | val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_TOUCHSCREEN"); | ||
| 438 | if (val && SDL_strcmp(val, "1") == 0) { | ||
| 439 | devclass |= SDL_UDEV_DEVICE_TOUCHSCREEN; | ||
| 440 | } | ||
| 441 | |||
| 442 | /* The undocumented rule is: | ||
| 443 | - All devices with keys get ID_INPUT_KEY | ||
| 444 | - From this subset, if they have ESC, numbers, and Q to D, it also gets ID_INPUT_KEYBOARD | ||
| 445 | |||
| 446 | Ref: http://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-input_id.c#n183 | ||
| 447 | */ | ||
| 448 | val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_KEY"); | ||
| 449 | if (val && SDL_strcmp(val, "1") == 0) { | ||
| 450 | devclass |= SDL_UDEV_DEVICE_HAS_KEYS; | ||
| 451 | } | ||
| 452 | |||
| 453 | val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD"); | ||
| 454 | if (val && SDL_strcmp(val, "1") == 0) { | ||
| 455 | devclass |= SDL_UDEV_DEVICE_KEYBOARD; | ||
| 456 | } | ||
| 457 | |||
| 458 | if (devclass == 0) { | ||
| 459 | // Fall back to old style input classes | ||
| 460 | val = _this->syms.udev_device_get_property_value(dev, "ID_CLASS"); | ||
| 461 | if (val) { | ||
| 462 | if (SDL_strcmp(val, "joystick") == 0) { | ||
| 463 | devclass = SDL_UDEV_DEVICE_JOYSTICK; | ||
| 464 | } else if (SDL_strcmp(val, "mouse") == 0) { | ||
| 465 | devclass = SDL_UDEV_DEVICE_MOUSE; | ||
| 466 | } else if (SDL_strcmp(val, "kbd") == 0) { | ||
| 467 | devclass = SDL_UDEV_DEVICE_HAS_KEYS | SDL_UDEV_DEVICE_KEYBOARD; | ||
| 468 | } | ||
| 469 | } else { | ||
| 470 | // We could be linked with libudev on a system that doesn't have udev running | ||
| 471 | devclass = guess_device_class(dev); | ||
| 472 | } | ||
| 473 | } | ||
| 474 | } | ||
| 475 | |||
| 476 | return devclass; | ||
| 477 | } | ||
| 478 | |||
| 479 | static void device_event(SDL_UDEV_deviceevent type, struct udev_device *dev) | ||
| 480 | { | ||
| 481 | int devclass = 0; | ||
| 482 | const char *path; | ||
| 483 | SDL_UDEV_CallbackList *item; | ||
| 484 | |||
| 485 | path = _this->syms.udev_device_get_devnode(dev); | ||
| 486 | if (!path) { | ||
| 487 | return; | ||
| 488 | } | ||
| 489 | |||
| 490 | if (type == SDL_UDEV_DEVICEADDED) { | ||
| 491 | devclass = device_class(dev); | ||
| 492 | if (!devclass) { | ||
| 493 | return; | ||
| 494 | } | ||
| 495 | } else { | ||
| 496 | // The device has been removed, the class isn't available | ||
| 497 | } | ||
| 498 | |||
| 499 | // Process callbacks | ||
| 500 | for (item = _this->first; item; item = item->next) { | ||
| 501 | item->callback(type, devclass, path); | ||
| 502 | } | ||
| 503 | } | ||
| 504 | |||
| 505 | void SDL_UDEV_Poll(void) | ||
| 506 | { | ||
| 507 | struct udev_device *dev = NULL; | ||
| 508 | const char *action = NULL; | ||
| 509 | |||
| 510 | if (!_this) { | ||
| 511 | return; | ||
| 512 | } | ||
| 513 | |||
| 514 | while (SDL_UDEV_hotplug_update_available()) { | ||
| 515 | dev = _this->syms.udev_monitor_receive_device(_this->udev_mon); | ||
| 516 | if (!dev) { | ||
| 517 | break; | ||
| 518 | } | ||
| 519 | action = _this->syms.udev_device_get_action(dev); | ||
| 520 | |||
| 521 | if (action) { | ||
| 522 | if (SDL_strcmp(action, "add") == 0) { | ||
| 523 | device_event(SDL_UDEV_DEVICEADDED, dev); | ||
| 524 | } else if (SDL_strcmp(action, "remove") == 0) { | ||
| 525 | device_event(SDL_UDEV_DEVICEREMOVED, dev); | ||
| 526 | } | ||
| 527 | } | ||
| 528 | |||
| 529 | _this->syms.udev_device_unref(dev); | ||
| 530 | } | ||
| 531 | } | ||
| 532 | |||
| 533 | bool SDL_UDEV_AddCallback(SDL_UDEV_Callback cb) | ||
| 534 | { | ||
| 535 | SDL_UDEV_CallbackList *item; | ||
| 536 | item = (SDL_UDEV_CallbackList *)SDL_calloc(1, sizeof(SDL_UDEV_CallbackList)); | ||
| 537 | if (!item) { | ||
| 538 | return false; | ||
| 539 | } | ||
| 540 | |||
| 541 | item->callback = cb; | ||
| 542 | |||
| 543 | if (!_this->last) { | ||
| 544 | _this->first = _this->last = item; | ||
| 545 | } else { | ||
| 546 | _this->last->next = item; | ||
| 547 | _this->last = item; | ||
| 548 | } | ||
| 549 | |||
| 550 | return true; | ||
| 551 | } | ||
| 552 | |||
| 553 | void SDL_UDEV_DelCallback(SDL_UDEV_Callback cb) | ||
| 554 | { | ||
| 555 | SDL_UDEV_CallbackList *item; | ||
| 556 | SDL_UDEV_CallbackList *prev = NULL; | ||
| 557 | |||
| 558 | if (!_this) { | ||
| 559 | return; | ||
| 560 | } | ||
| 561 | |||
| 562 | for (item = _this->first; item; item = item->next) { | ||
| 563 | // found it, remove it. | ||
| 564 | if (item->callback == cb) { | ||
| 565 | if (prev) { | ||
| 566 | prev->next = item->next; | ||
| 567 | } else { | ||
| 568 | SDL_assert(_this->first == item); | ||
| 569 | _this->first = item->next; | ||
| 570 | } | ||
| 571 | if (item == _this->last) { | ||
| 572 | _this->last = prev; | ||
| 573 | } | ||
| 574 | SDL_free(item); | ||
| 575 | return; | ||
| 576 | } | ||
| 577 | prev = item; | ||
| 578 | } | ||
| 579 | } | ||
| 580 | |||
| 581 | const SDL_UDEV_Symbols *SDL_UDEV_GetUdevSyms(void) | ||
| 582 | { | ||
| 583 | if (!SDL_UDEV_Init()) { | ||
| 584 | SDL_SetError("Could not initialize UDEV"); | ||
| 585 | return NULL; | ||
| 586 | } | ||
| 587 | |||
| 588 | return &_this->syms; | ||
| 589 | } | ||
| 590 | |||
| 591 | void SDL_UDEV_ReleaseUdevSyms(void) | ||
| 592 | { | ||
| 593 | SDL_UDEV_Quit(); | ||
| 594 | } | ||
| 595 | |||
| 596 | #endif // SDL_USE_LIBUDEV | ||
diff --git a/contrib/SDL-3.2.8/src/core/linux/SDL_udev.h b/contrib/SDL-3.2.8/src/core/linux/SDL_udev.h new file mode 100644 index 0000000..738f4ba --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/linux/SDL_udev.h | |||
| @@ -0,0 +1,113 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "SDL_internal.h" | ||
| 23 | |||
| 24 | #ifndef SDL_udev_h_ | ||
| 25 | #define SDL_udev_h_ | ||
| 26 | |||
| 27 | #if defined(HAVE_LIBUDEV_H) && defined(HAVE_LINUX_INPUT_H) | ||
| 28 | |||
| 29 | #ifndef SDL_USE_LIBUDEV | ||
| 30 | #define SDL_USE_LIBUDEV 1 | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <libudev.h> | ||
| 34 | #include <sys/time.h> | ||
| 35 | #include <sys/types.h> | ||
| 36 | |||
| 37 | /** | ||
| 38 | * Device type | ||
| 39 | */ | ||
| 40 | |||
| 41 | typedef enum | ||
| 42 | { | ||
| 43 | SDL_UDEV_DEVICEADDED = 1, | ||
| 44 | SDL_UDEV_DEVICEREMOVED | ||
| 45 | } SDL_UDEV_deviceevent; | ||
| 46 | |||
| 47 | typedef void (*SDL_UDEV_Callback)(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); | ||
| 48 | |||
| 49 | typedef struct SDL_UDEV_CallbackList | ||
| 50 | { | ||
| 51 | SDL_UDEV_Callback callback; | ||
| 52 | struct SDL_UDEV_CallbackList *next; | ||
| 53 | } SDL_UDEV_CallbackList; | ||
| 54 | |||
| 55 | typedef struct SDL_UDEV_Symbols | ||
| 56 | { | ||
| 57 | const char *(*udev_device_get_action)(struct udev_device *); | ||
| 58 | const char *(*udev_device_get_devnode)(struct udev_device *); | ||
| 59 | const char *(*udev_device_get_syspath)(struct udev_device *); | ||
| 60 | const char *(*udev_device_get_subsystem)(struct udev_device *); | ||
| 61 | struct udev_device *(*udev_device_get_parent_with_subsystem_devtype)(struct udev_device *udev_device, const char *subsystem, const char *devtype); | ||
| 62 | const char *(*udev_device_get_property_value)(struct udev_device *, const char *); | ||
| 63 | const char *(*udev_device_get_sysattr_value)(struct udev_device *udev_device, const char *sysattr); | ||
| 64 | struct udev_device *(*udev_device_new_from_syspath)(struct udev *, const char *); | ||
| 65 | void (*udev_device_unref)(struct udev_device *); | ||
| 66 | int (*udev_enumerate_add_match_property)(struct udev_enumerate *, const char *, const char *); | ||
| 67 | int (*udev_enumerate_add_match_subsystem)(struct udev_enumerate *, const char *); | ||
| 68 | struct udev_list_entry *(*udev_enumerate_get_list_entry)(struct udev_enumerate *); | ||
| 69 | struct udev_enumerate *(*udev_enumerate_new)(struct udev *); | ||
| 70 | int (*udev_enumerate_scan_devices)(struct udev_enumerate *); | ||
| 71 | void (*udev_enumerate_unref)(struct udev_enumerate *); | ||
| 72 | const char *(*udev_list_entry_get_name)(struct udev_list_entry *); | ||
| 73 | struct udev_list_entry *(*udev_list_entry_get_next)(struct udev_list_entry *); | ||
| 74 | int (*udev_monitor_enable_receiving)(struct udev_monitor *); | ||
| 75 | int (*udev_monitor_filter_add_match_subsystem_devtype)(struct udev_monitor *, const char *, const char *); | ||
| 76 | int (*udev_monitor_get_fd)(struct udev_monitor *); | ||
| 77 | struct udev_monitor *(*udev_monitor_new_from_netlink)(struct udev *, const char *); | ||
| 78 | struct udev_device *(*udev_monitor_receive_device)(struct udev_monitor *); | ||
| 79 | void (*udev_monitor_unref)(struct udev_monitor *); | ||
| 80 | struct udev *(*udev_new)(void); | ||
| 81 | void (*udev_unref)(struct udev *); | ||
| 82 | struct udev_device *(*udev_device_new_from_devnum)(struct udev *udev, char type, dev_t devnum); | ||
| 83 | dev_t (*udev_device_get_devnum)(struct udev_device *udev_device); | ||
| 84 | } SDL_UDEV_Symbols; | ||
| 85 | |||
| 86 | typedef struct SDL_UDEV_PrivateData | ||
| 87 | { | ||
| 88 | const char *udev_library; | ||
| 89 | SDL_SharedObject *udev_handle; | ||
| 90 | struct udev *udev; | ||
| 91 | struct udev_monitor *udev_mon; | ||
| 92 | int ref_count; | ||
| 93 | SDL_UDEV_CallbackList *first, *last; | ||
| 94 | |||
| 95 | // Function pointers | ||
| 96 | SDL_UDEV_Symbols syms; | ||
| 97 | } SDL_UDEV_PrivateData; | ||
| 98 | |||
| 99 | extern bool SDL_UDEV_Init(void); | ||
| 100 | extern void SDL_UDEV_Quit(void); | ||
| 101 | extern void SDL_UDEV_UnloadLibrary(void); | ||
| 102 | extern bool SDL_UDEV_LoadLibrary(void); | ||
| 103 | extern void SDL_UDEV_Poll(void); | ||
| 104 | extern bool SDL_UDEV_Scan(void); | ||
| 105 | extern bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *product, Uint16 *version, int *class); | ||
| 106 | extern bool SDL_UDEV_AddCallback(SDL_UDEV_Callback cb); | ||
| 107 | extern void SDL_UDEV_DelCallback(SDL_UDEV_Callback cb); | ||
| 108 | extern const SDL_UDEV_Symbols *SDL_UDEV_GetUdevSyms(void); | ||
| 109 | extern void SDL_UDEV_ReleaseUdevSyms(void); | ||
| 110 | |||
| 111 | #endif // HAVE_LIBUDEV_H && HAVE_LINUX_INPUT_H | ||
| 112 | |||
| 113 | #endif // SDL_udev_h_ | ||
diff --git a/contrib/SDL-3.2.8/src/core/openbsd/SDL_wscons.h b/contrib/SDL-3.2.8/src/core/openbsd/SDL_wscons.h new file mode 100644 index 0000000..f9b7bf8 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/openbsd/SDL_wscons.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | void SDL_WSCONS_Init(void); | ||
| 23 | void SDL_WSCONS_Quit(void); | ||
| 24 | |||
| 25 | void SDL_WSCONS_PumpEvents(void); | ||
diff --git a/contrib/SDL-3.2.8/src/core/openbsd/SDL_wscons_kbd.c b/contrib/SDL-3.2.8/src/core/openbsd/SDL_wscons_kbd.c new file mode 100644 index 0000000..5a71044 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/openbsd/SDL_wscons_kbd.c | |||
| @@ -0,0 +1,948 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "SDL_internal.h" | ||
| 23 | #include <dev/wscons/wsksymvar.h> | ||
| 24 | #include <dev/wscons/wsksymdef.h> | ||
| 25 | #include "SDL_wscons.h" | ||
| 26 | #include <sys/time.h> | ||
| 27 | #include <dev/wscons/wsconsio.h> | ||
| 28 | #include <dev/wscons/wsdisplay_usl_io.h> | ||
| 29 | #include <termios.h> | ||
| 30 | #include <fcntl.h> | ||
| 31 | #include <sys/ioctl.h> | ||
| 32 | #include <sys/param.h> | ||
| 33 | #include <unistd.h> | ||
| 34 | |||
| 35 | #include "../../events/SDL_events_c.h" | ||
| 36 | #include "../../events/SDL_keyboard_c.h" | ||
| 37 | |||
| 38 | #ifdef SDL_PLATFORM_NETBSD | ||
| 39 | #define KS_GROUP_Ascii KS_GROUP_Plain | ||
| 40 | #define KS_Cmd_ScrollBack KS_Cmd_ScrollFastUp | ||
| 41 | #define KS_Cmd_ScrollFwd KS_Cmd_ScrollFastDown | ||
| 42 | #endif | ||
| 43 | |||
| 44 | #define RETIFIOCTLERR(x) \ | ||
| 45 | if ((x) == -1) { \ | ||
| 46 | SDL_free(input); \ | ||
| 47 | input = NULL; \ | ||
| 48 | return NULL; \ | ||
| 49 | } | ||
| 50 | |||
| 51 | typedef struct SDL_WSCONS_mouse_input_data SDL_WSCONS_mouse_input_data; | ||
| 52 | extern SDL_WSCONS_mouse_input_data *SDL_WSCONS_Init_Mouse(void); | ||
| 53 | extern void updateMouse(SDL_WSCONS_mouse_input_data *input); | ||
| 54 | extern void SDL_WSCONS_Quit_Mouse(SDL_WSCONS_mouse_input_data *input); | ||
| 55 | |||
| 56 | // Conversion table courtesy of /usr/src/sys/dev/wscons/wskbdutil.c | ||
| 57 | static const unsigned char latin1_to_upper[256] = { | ||
| 58 | // 0 8 1 9 2 a 3 b 4 c 5 d 6 e 7 f | ||
| 59 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0 | ||
| 60 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0 | ||
| 61 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 1 | ||
| 62 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 1 | ||
| 63 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 2 | ||
| 64 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 2 | ||
| 65 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 3 | ||
| 66 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 3 | ||
| 67 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 4 | ||
| 68 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 4 | ||
| 69 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 5 | ||
| 70 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 5 | ||
| 71 | 0x00, 'A', 'B', 'C', 'D', 'E', 'F', 'G', // 6 | ||
| 72 | 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', // 6 | ||
| 73 | 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', // 7 | ||
| 74 | 'X', 'Y', 'Z', 0x00, 0x00, 0x00, 0x00, 0x00, // 7 | ||
| 75 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 8 | ||
| 76 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 8 | ||
| 77 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 9 | ||
| 78 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 9 | ||
| 79 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // a | ||
| 80 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // a | ||
| 81 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // b | ||
| 82 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // b | ||
| 83 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // c | ||
| 84 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // c | ||
| 85 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // d | ||
| 86 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // d | ||
| 87 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, // e | ||
| 88 | 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, // e | ||
| 89 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0x00, // f | ||
| 90 | 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x00, // f | ||
| 91 | }; | ||
| 92 | |||
| 93 | // Compose table courtesy of /usr/src/sys/dev/wscons/wskbdutil.c | ||
| 94 | static struct SDL_wscons_compose_tab_s | ||
| 95 | { | ||
| 96 | keysym_t elem[2]; | ||
| 97 | keysym_t result; | ||
| 98 | } compose_tab[] = { | ||
| 99 | { { KS_plus, KS_plus }, KS_numbersign }, | ||
| 100 | { { KS_a, KS_a }, KS_at }, | ||
| 101 | { { KS_parenleft, KS_parenleft }, KS_bracketleft }, | ||
| 102 | { { KS_slash, KS_slash }, KS_backslash }, | ||
| 103 | { { KS_parenright, KS_parenright }, KS_bracketright }, | ||
| 104 | { { KS_parenleft, KS_minus }, KS_braceleft }, | ||
| 105 | { { KS_slash, KS_minus }, KS_bar }, | ||
| 106 | { { KS_parenright, KS_minus }, KS_braceright }, | ||
| 107 | { { KS_exclam, KS_exclam }, KS_exclamdown }, | ||
| 108 | { { KS_c, KS_slash }, KS_cent }, | ||
| 109 | { { KS_l, KS_minus }, KS_sterling }, | ||
| 110 | { { KS_y, KS_minus }, KS_yen }, | ||
| 111 | { { KS_s, KS_o }, KS_section }, | ||
| 112 | { { KS_x, KS_o }, KS_currency }, | ||
| 113 | { { KS_c, KS_o }, KS_copyright }, | ||
| 114 | { { KS_less, KS_less }, KS_guillemotleft }, | ||
| 115 | { { KS_greater, KS_greater }, KS_guillemotright }, | ||
| 116 | { { KS_question, KS_question }, KS_questiondown }, | ||
| 117 | { { KS_dead_acute, KS_space }, KS_apostrophe }, | ||
| 118 | { { KS_dead_grave, KS_space }, KS_grave }, | ||
| 119 | { { KS_dead_tilde, KS_space }, KS_asciitilde }, | ||
| 120 | { { KS_dead_circumflex, KS_space }, KS_asciicircum }, | ||
| 121 | { { KS_dead_diaeresis, KS_space }, KS_quotedbl }, | ||
| 122 | { { KS_dead_cedilla, KS_space }, KS_comma }, | ||
| 123 | { { KS_dead_circumflex, KS_A }, KS_Acircumflex }, | ||
| 124 | { { KS_dead_diaeresis, KS_A }, KS_Adiaeresis }, | ||
| 125 | { { KS_dead_grave, KS_A }, KS_Agrave }, | ||
| 126 | { { KS_dead_abovering, KS_A }, KS_Aring }, | ||
| 127 | { { KS_dead_tilde, KS_A }, KS_Atilde }, | ||
| 128 | { { KS_dead_cedilla, KS_C }, KS_Ccedilla }, | ||
| 129 | { { KS_dead_acute, KS_E }, KS_Eacute }, | ||
| 130 | { { KS_dead_circumflex, KS_E }, KS_Ecircumflex }, | ||
| 131 | { { KS_dead_diaeresis, KS_E }, KS_Ediaeresis }, | ||
| 132 | { { KS_dead_grave, KS_E }, KS_Egrave }, | ||
| 133 | { { KS_dead_acute, KS_I }, KS_Iacute }, | ||
| 134 | { { KS_dead_circumflex, KS_I }, KS_Icircumflex }, | ||
| 135 | { { KS_dead_diaeresis, KS_I }, KS_Idiaeresis }, | ||
| 136 | { { KS_dead_grave, KS_I }, KS_Igrave }, | ||
| 137 | { { KS_dead_tilde, KS_N }, KS_Ntilde }, | ||
| 138 | { { KS_dead_acute, KS_O }, KS_Oacute }, | ||
| 139 | { { KS_dead_circumflex, KS_O }, KS_Ocircumflex }, | ||
| 140 | { { KS_dead_diaeresis, KS_O }, KS_Odiaeresis }, | ||
| 141 | { { KS_dead_grave, KS_O }, KS_Ograve }, | ||
| 142 | { { KS_dead_tilde, KS_O }, KS_Otilde }, | ||
| 143 | { { KS_dead_acute, KS_U }, KS_Uacute }, | ||
| 144 | { { KS_dead_circumflex, KS_U }, KS_Ucircumflex }, | ||
| 145 | { { KS_dead_diaeresis, KS_U }, KS_Udiaeresis }, | ||
| 146 | { { KS_dead_grave, KS_U }, KS_Ugrave }, | ||
| 147 | { { KS_dead_acute, KS_Y }, KS_Yacute }, | ||
| 148 | { { KS_dead_acute, KS_a }, KS_aacute }, | ||
| 149 | { { KS_dead_circumflex, KS_a }, KS_acircumflex }, | ||
| 150 | { { KS_dead_diaeresis, KS_a }, KS_adiaeresis }, | ||
| 151 | { { KS_dead_grave, KS_a }, KS_agrave }, | ||
| 152 | { { KS_dead_abovering, KS_a }, KS_aring }, | ||
| 153 | { { KS_dead_tilde, KS_a }, KS_atilde }, | ||
| 154 | { { KS_dead_cedilla, KS_c }, KS_ccedilla }, | ||
| 155 | { { KS_dead_acute, KS_e }, KS_eacute }, | ||
| 156 | { { KS_dead_circumflex, KS_e }, KS_ecircumflex }, | ||
| 157 | { { KS_dead_diaeresis, KS_e }, KS_ediaeresis }, | ||
| 158 | { { KS_dead_grave, KS_e }, KS_egrave }, | ||
| 159 | { { KS_dead_acute, KS_i }, KS_iacute }, | ||
| 160 | { { KS_dead_circumflex, KS_i }, KS_icircumflex }, | ||
| 161 | { { KS_dead_diaeresis, KS_i }, KS_idiaeresis }, | ||
| 162 | { { KS_dead_grave, KS_i }, KS_igrave }, | ||
| 163 | { { KS_dead_tilde, KS_n }, KS_ntilde }, | ||
| 164 | { { KS_dead_acute, KS_o }, KS_oacute }, | ||
| 165 | { { KS_dead_circumflex, KS_o }, KS_ocircumflex }, | ||
| 166 | { { KS_dead_diaeresis, KS_o }, KS_odiaeresis }, | ||
| 167 | { { KS_dead_grave, KS_o }, KS_ograve }, | ||
| 168 | { { KS_dead_tilde, KS_o }, KS_otilde }, | ||
| 169 | { { KS_dead_acute, KS_u }, KS_uacute }, | ||
| 170 | { { KS_dead_circumflex, KS_u }, KS_ucircumflex }, | ||
| 171 | { { KS_dead_diaeresis, KS_u }, KS_udiaeresis }, | ||
| 172 | { { KS_dead_grave, KS_u }, KS_ugrave }, | ||
| 173 | { { KS_dead_acute, KS_y }, KS_yacute }, | ||
| 174 | { { KS_dead_diaeresis, KS_y }, KS_ydiaeresis }, | ||
| 175 | { { KS_quotedbl, KS_A }, KS_Adiaeresis }, | ||
| 176 | { { KS_quotedbl, KS_E }, KS_Ediaeresis }, | ||
| 177 | { { KS_quotedbl, KS_I }, KS_Idiaeresis }, | ||
| 178 | { { KS_quotedbl, KS_O }, KS_Odiaeresis }, | ||
| 179 | { { KS_quotedbl, KS_U }, KS_Udiaeresis }, | ||
| 180 | { { KS_quotedbl, KS_a }, KS_adiaeresis }, | ||
| 181 | { { KS_quotedbl, KS_e }, KS_ediaeresis }, | ||
| 182 | { { KS_quotedbl, KS_i }, KS_idiaeresis }, | ||
| 183 | { { KS_quotedbl, KS_o }, KS_odiaeresis }, | ||
| 184 | { { KS_quotedbl, KS_u }, KS_udiaeresis }, | ||
| 185 | { { KS_quotedbl, KS_y }, KS_ydiaeresis }, | ||
| 186 | { { KS_acute, KS_A }, KS_Aacute }, | ||
| 187 | { { KS_asciicircum, KS_A }, KS_Acircumflex }, | ||
| 188 | { { KS_grave, KS_A }, KS_Agrave }, | ||
| 189 | { { KS_asterisk, KS_A }, KS_Aring }, | ||
| 190 | { { KS_asciitilde, KS_A }, KS_Atilde }, | ||
| 191 | { { KS_cedilla, KS_C }, KS_Ccedilla }, | ||
| 192 | { { KS_acute, KS_E }, KS_Eacute }, | ||
| 193 | { { KS_asciicircum, KS_E }, KS_Ecircumflex }, | ||
| 194 | { { KS_grave, KS_E }, KS_Egrave }, | ||
| 195 | { { KS_acute, KS_I }, KS_Iacute }, | ||
| 196 | { { KS_asciicircum, KS_I }, KS_Icircumflex }, | ||
| 197 | { { KS_grave, KS_I }, KS_Igrave }, | ||
| 198 | { { KS_asciitilde, KS_N }, KS_Ntilde }, | ||
| 199 | { { KS_acute, KS_O }, KS_Oacute }, | ||
| 200 | { { KS_asciicircum, KS_O }, KS_Ocircumflex }, | ||
| 201 | { { KS_grave, KS_O }, KS_Ograve }, | ||
| 202 | { { KS_asciitilde, KS_O }, KS_Otilde }, | ||
| 203 | { { KS_acute, KS_U }, KS_Uacute }, | ||
| 204 | { { KS_asciicircum, KS_U }, KS_Ucircumflex }, | ||
| 205 | { { KS_grave, KS_U }, KS_Ugrave }, | ||
| 206 | { { KS_acute, KS_Y }, KS_Yacute }, | ||
| 207 | { { KS_acute, KS_a }, KS_aacute }, | ||
| 208 | { { KS_asciicircum, KS_a }, KS_acircumflex }, | ||
| 209 | { { KS_grave, KS_a }, KS_agrave }, | ||
| 210 | { { KS_asterisk, KS_a }, KS_aring }, | ||
| 211 | { { KS_asciitilde, KS_a }, KS_atilde }, | ||
| 212 | { { KS_cedilla, KS_c }, KS_ccedilla }, | ||
| 213 | { { KS_acute, KS_e }, KS_eacute }, | ||
| 214 | { { KS_asciicircum, KS_e }, KS_ecircumflex }, | ||
| 215 | { { KS_grave, KS_e }, KS_egrave }, | ||
| 216 | { { KS_acute, KS_i }, KS_iacute }, | ||
| 217 | { { KS_asciicircum, KS_i }, KS_icircumflex }, | ||
| 218 | { { KS_grave, KS_i }, KS_igrave }, | ||
| 219 | { { KS_asciitilde, KS_n }, KS_ntilde }, | ||
| 220 | { { KS_acute, KS_o }, KS_oacute }, | ||
| 221 | { { KS_asciicircum, KS_o }, KS_ocircumflex }, | ||
| 222 | { { KS_grave, KS_o }, KS_ograve }, | ||
| 223 | { { KS_asciitilde, KS_o }, KS_otilde }, | ||
| 224 | { { KS_acute, KS_u }, KS_uacute }, | ||
| 225 | { { KS_asciicircum, KS_u }, KS_ucircumflex }, | ||
| 226 | { { KS_grave, KS_u }, KS_ugrave }, | ||
| 227 | { { KS_acute, KS_y }, KS_yacute }, | ||
| 228 | #ifndef SDL_PLATFORM_NETBSD | ||
| 229 | { { KS_dead_caron, KS_space }, KS_L2_caron }, | ||
| 230 | { { KS_dead_caron, KS_S }, KS_L2_Scaron }, | ||
| 231 | { { KS_dead_caron, KS_Z }, KS_L2_Zcaron }, | ||
| 232 | { { KS_dead_caron, KS_s }, KS_L2_scaron }, | ||
| 233 | { { KS_dead_caron, KS_z }, KS_L2_zcaron } | ||
| 234 | #endif | ||
| 235 | }; | ||
| 236 | |||
| 237 | static keysym_t ksym_upcase(keysym_t ksym) | ||
| 238 | { | ||
| 239 | if (ksym >= KS_f1 && ksym <= KS_f20) { | ||
| 240 | return KS_F1 - KS_f1 + ksym; | ||
| 241 | } | ||
| 242 | |||
| 243 | if (KS_GROUP(ksym) == KS_GROUP_Ascii && ksym <= 0xff && latin1_to_upper[ksym] != 0x00) { | ||
| 244 | return latin1_to_upper[ksym]; | ||
| 245 | } | ||
| 246 | |||
| 247 | return ksym; | ||
| 248 | } | ||
| 249 | static struct wscons_keycode_to_SDL | ||
| 250 | { | ||
| 251 | keysym_t sourcekey; | ||
| 252 | SDL_Scancode targetKey; | ||
| 253 | } conversion_table[] = { | ||
| 254 | { KS_Menu, SDL_SCANCODE_APPLICATION }, | ||
| 255 | { KS_Up, SDL_SCANCODE_UP }, | ||
| 256 | { KS_Down, SDL_SCANCODE_DOWN }, | ||
| 257 | { KS_Left, SDL_SCANCODE_LEFT }, | ||
| 258 | { KS_Right, SDL_SCANCODE_RIGHT }, | ||
| 259 | { KS_Hold_Screen, SDL_SCANCODE_SCROLLLOCK }, | ||
| 260 | { KS_Num_Lock, SDL_SCANCODE_NUMLOCKCLEAR }, | ||
| 261 | { KS_Caps_Lock, SDL_SCANCODE_CAPSLOCK }, | ||
| 262 | { KS_BackSpace, SDL_SCANCODE_BACKSPACE }, | ||
| 263 | { KS_space, SDL_SCANCODE_SPACE }, | ||
| 264 | { KS_Delete, SDL_SCANCODE_BACKSPACE }, | ||
| 265 | { KS_Home, SDL_SCANCODE_HOME }, | ||
| 266 | { KS_End, SDL_SCANCODE_END }, | ||
| 267 | { KS_Pause, SDL_SCANCODE_PAUSE }, | ||
| 268 | { KS_Print_Screen, SDL_SCANCODE_PRINTSCREEN }, | ||
| 269 | { KS_Insert, SDL_SCANCODE_INSERT }, | ||
| 270 | { KS_Escape, SDL_SCANCODE_ESCAPE }, | ||
| 271 | { KS_Return, SDL_SCANCODE_RETURN }, | ||
| 272 | { KS_Linefeed, SDL_SCANCODE_RETURN }, | ||
| 273 | { KS_KP_Delete, SDL_SCANCODE_DELETE }, | ||
| 274 | { KS_KP_Insert, SDL_SCANCODE_INSERT }, | ||
| 275 | { KS_Control_L, SDL_SCANCODE_LCTRL }, | ||
| 276 | { KS_Control_R, SDL_SCANCODE_RCTRL }, | ||
| 277 | { KS_Shift_L, SDL_SCANCODE_LSHIFT }, | ||
| 278 | { KS_Shift_R, SDL_SCANCODE_RSHIFT }, | ||
| 279 | { KS_Alt_L, SDL_SCANCODE_LALT }, | ||
| 280 | { KS_Alt_R, SDL_SCANCODE_RALT }, | ||
| 281 | { KS_grave, SDL_SCANCODE_GRAVE }, | ||
| 282 | |||
| 283 | { KS_KP_0, SDL_SCANCODE_KP_0 }, | ||
| 284 | { KS_KP_1, SDL_SCANCODE_KP_1 }, | ||
| 285 | { KS_KP_2, SDL_SCANCODE_KP_2 }, | ||
| 286 | { KS_KP_3, SDL_SCANCODE_KP_3 }, | ||
| 287 | { KS_KP_4, SDL_SCANCODE_KP_4 }, | ||
| 288 | { KS_KP_5, SDL_SCANCODE_KP_5 }, | ||
| 289 | { KS_KP_6, SDL_SCANCODE_KP_6 }, | ||
| 290 | { KS_KP_7, SDL_SCANCODE_KP_7 }, | ||
| 291 | { KS_KP_8, SDL_SCANCODE_KP_8 }, | ||
| 292 | { KS_KP_9, SDL_SCANCODE_KP_9 }, | ||
| 293 | { KS_KP_Enter, SDL_SCANCODE_KP_ENTER }, | ||
| 294 | { KS_KP_Multiply, SDL_SCANCODE_KP_MULTIPLY }, | ||
| 295 | { KS_KP_Add, SDL_SCANCODE_KP_PLUS }, | ||
| 296 | { KS_KP_Subtract, SDL_SCANCODE_KP_MINUS }, | ||
| 297 | { KS_KP_Divide, SDL_SCANCODE_KP_DIVIDE }, | ||
| 298 | { KS_KP_Up, SDL_SCANCODE_UP }, | ||
| 299 | { KS_KP_Down, SDL_SCANCODE_DOWN }, | ||
| 300 | { KS_KP_Left, SDL_SCANCODE_LEFT }, | ||
| 301 | { KS_KP_Right, SDL_SCANCODE_RIGHT }, | ||
| 302 | { KS_KP_Equal, SDL_SCANCODE_KP_EQUALS }, | ||
| 303 | { KS_f1, SDL_SCANCODE_F1 }, | ||
| 304 | { KS_f2, SDL_SCANCODE_F2 }, | ||
| 305 | { KS_f3, SDL_SCANCODE_F3 }, | ||
| 306 | { KS_f4, SDL_SCANCODE_F4 }, | ||
| 307 | { KS_f5, SDL_SCANCODE_F5 }, | ||
| 308 | { KS_f6, SDL_SCANCODE_F6 }, | ||
| 309 | { KS_f7, SDL_SCANCODE_F7 }, | ||
| 310 | { KS_f8, SDL_SCANCODE_F8 }, | ||
| 311 | { KS_f9, SDL_SCANCODE_F9 }, | ||
| 312 | { KS_f10, SDL_SCANCODE_F10 }, | ||
| 313 | { KS_f11, SDL_SCANCODE_F11 }, | ||
| 314 | { KS_f12, SDL_SCANCODE_F12 }, | ||
| 315 | { KS_f13, SDL_SCANCODE_F13 }, | ||
| 316 | { KS_f14, SDL_SCANCODE_F14 }, | ||
| 317 | { KS_f15, SDL_SCANCODE_F15 }, | ||
| 318 | { KS_f16, SDL_SCANCODE_F16 }, | ||
| 319 | { KS_f17, SDL_SCANCODE_F17 }, | ||
| 320 | { KS_f18, SDL_SCANCODE_F18 }, | ||
| 321 | { KS_f19, SDL_SCANCODE_F19 }, | ||
| 322 | { KS_f20, SDL_SCANCODE_F20 }, | ||
| 323 | #ifndef SDL_PLATFORM_NETBSD | ||
| 324 | { KS_f21, SDL_SCANCODE_F21 }, | ||
| 325 | { KS_f22, SDL_SCANCODE_F22 }, | ||
| 326 | { KS_f23, SDL_SCANCODE_F23 }, | ||
| 327 | { KS_f24, SDL_SCANCODE_F24 }, | ||
| 328 | #endif | ||
| 329 | { KS_Meta_L, SDL_SCANCODE_LGUI }, | ||
| 330 | { KS_Meta_R, SDL_SCANCODE_RGUI }, | ||
| 331 | { KS_Zenkaku_Hankaku, SDL_SCANCODE_LANG5 }, | ||
| 332 | { KS_Hiragana_Katakana, SDL_SCANCODE_INTERNATIONAL2 }, | ||
| 333 | { KS_yen, SDL_SCANCODE_INTERNATIONAL3 }, | ||
| 334 | { KS_Henkan, SDL_SCANCODE_INTERNATIONAL4 }, | ||
| 335 | { KS_Muhenkan, SDL_SCANCODE_INTERNATIONAL5 }, | ||
| 336 | { KS_KP_Prior, SDL_SCANCODE_PRIOR }, | ||
| 337 | |||
| 338 | { KS_a, SDL_SCANCODE_A }, | ||
| 339 | { KS_b, SDL_SCANCODE_B }, | ||
| 340 | { KS_c, SDL_SCANCODE_C }, | ||
| 341 | { KS_d, SDL_SCANCODE_D }, | ||
| 342 | { KS_e, SDL_SCANCODE_E }, | ||
| 343 | { KS_f, SDL_SCANCODE_F }, | ||
| 344 | { KS_g, SDL_SCANCODE_G }, | ||
| 345 | { KS_h, SDL_SCANCODE_H }, | ||
| 346 | { KS_i, SDL_SCANCODE_I }, | ||
| 347 | { KS_j, SDL_SCANCODE_J }, | ||
| 348 | { KS_k, SDL_SCANCODE_K }, | ||
| 349 | { KS_l, SDL_SCANCODE_L }, | ||
| 350 | { KS_m, SDL_SCANCODE_M }, | ||
| 351 | { KS_n, SDL_SCANCODE_N }, | ||
| 352 | { KS_o, SDL_SCANCODE_O }, | ||
| 353 | { KS_p, SDL_SCANCODE_P }, | ||
| 354 | { KS_q, SDL_SCANCODE_Q }, | ||
| 355 | { KS_r, SDL_SCANCODE_R }, | ||
| 356 | { KS_s, SDL_SCANCODE_S }, | ||
| 357 | { KS_t, SDL_SCANCODE_T }, | ||
| 358 | { KS_u, SDL_SCANCODE_U }, | ||
| 359 | { KS_v, SDL_SCANCODE_V }, | ||
| 360 | { KS_w, SDL_SCANCODE_W }, | ||
| 361 | { KS_x, SDL_SCANCODE_X }, | ||
| 362 | { KS_y, SDL_SCANCODE_Y }, | ||
| 363 | { KS_z, SDL_SCANCODE_Z }, | ||
| 364 | |||
| 365 | { KS_0, SDL_SCANCODE_0 }, | ||
| 366 | { KS_1, SDL_SCANCODE_1 }, | ||
| 367 | { KS_2, SDL_SCANCODE_2 }, | ||
| 368 | { KS_3, SDL_SCANCODE_3 }, | ||
| 369 | { KS_4, SDL_SCANCODE_4 }, | ||
| 370 | { KS_5, SDL_SCANCODE_5 }, | ||
| 371 | { KS_6, SDL_SCANCODE_6 }, | ||
| 372 | { KS_7, SDL_SCANCODE_7 }, | ||
| 373 | { KS_8, SDL_SCANCODE_8 }, | ||
| 374 | { KS_9, SDL_SCANCODE_9 }, | ||
| 375 | { KS_minus, SDL_SCANCODE_MINUS }, | ||
| 376 | { KS_equal, SDL_SCANCODE_EQUALS }, | ||
| 377 | { KS_Tab, SDL_SCANCODE_TAB }, | ||
| 378 | { KS_KP_Tab, SDL_SCANCODE_KP_TAB }, | ||
| 379 | { KS_apostrophe, SDL_SCANCODE_APOSTROPHE }, | ||
| 380 | { KS_bracketleft, SDL_SCANCODE_LEFTBRACKET }, | ||
| 381 | { KS_bracketright, SDL_SCANCODE_RIGHTBRACKET }, | ||
| 382 | { KS_semicolon, SDL_SCANCODE_SEMICOLON }, | ||
| 383 | { KS_comma, SDL_SCANCODE_COMMA }, | ||
| 384 | { KS_period, SDL_SCANCODE_PERIOD }, | ||
| 385 | { KS_slash, SDL_SCANCODE_SLASH }, | ||
| 386 | { KS_backslash, SDL_SCANCODE_BACKSLASH } | ||
| 387 | }; | ||
| 388 | |||
| 389 | typedef struct | ||
| 390 | { | ||
| 391 | int fd; | ||
| 392 | SDL_KeyboardID keyboardID; | ||
| 393 | struct wskbd_map_data keymap; | ||
| 394 | int ledstate; | ||
| 395 | int origledstate; | ||
| 396 | int shiftstate[4]; | ||
| 397 | int shiftheldstate[8]; | ||
| 398 | int lockheldstate[5]; | ||
| 399 | kbd_t encoding; | ||
| 400 | char text[128]; | ||
| 401 | unsigned int text_len; | ||
| 402 | keysym_t composebuffer[2]; | ||
| 403 | unsigned char composelen; | ||
| 404 | int type; | ||
| 405 | } SDL_WSCONS_input_data; | ||
| 406 | |||
| 407 | static SDL_WSCONS_input_data *inputs[4] = { NULL, NULL, NULL, NULL }; | ||
| 408 | static SDL_WSCONS_mouse_input_data *mouseInputData = NULL; | ||
| 409 | #define IS_CONTROL_HELD (input->shiftstate[2] > 0) | ||
| 410 | #define IS_ALT_HELD (input->shiftstate[1] > 0) | ||
| 411 | #define IS_SHIFT_HELD ((input->shiftstate[0] > 0) || (input->ledstate & (1 << 5))) | ||
| 412 | |||
| 413 | #define IS_ALTGR_MODE ((input->ledstate & (1 << 4)) || (input->shiftstate[3] > 0)) | ||
| 414 | #define IS_NUMLOCK_ON (input->ledstate & LED_NUM) | ||
| 415 | #define IS_SCROLLLOCK_ON (input->ledstate & LED_SCR) | ||
| 416 | #define IS_CAPSLOCK_ON (input->ledstate & LED_CAP) | ||
| 417 | static SDL_WSCONS_input_data *SDL_WSCONS_Init_Keyboard(const char *dev) | ||
| 418 | { | ||
| 419 | #ifdef WSKBDIO_SETVERSION | ||
| 420 | int version = WSKBDIO_EVENT_VERSION; | ||
| 421 | #endif | ||
| 422 | SDL_WSCONS_input_data *input = (SDL_WSCONS_input_data *)SDL_calloc(1, sizeof(SDL_WSCONS_input_data)); | ||
| 423 | |||
| 424 | if (!input) { | ||
| 425 | return NULL; | ||
| 426 | } | ||
| 427 | |||
| 428 | input->fd = open(dev, O_RDWR | O_NONBLOCK | O_CLOEXEC); | ||
| 429 | if (input->fd == -1) { | ||
| 430 | SDL_free(input); | ||
| 431 | input = NULL; | ||
| 432 | return NULL; | ||
| 433 | } | ||
| 434 | |||
| 435 | input->keyboardID = SDL_GetNextObjectID(); | ||
| 436 | SDL_AddKeyboard(input->keyboardID, NULL, false); | ||
| 437 | |||
| 438 | input->keymap.map = SDL_calloc(KS_NUMKEYCODES, sizeof(struct wscons_keymap)); | ||
| 439 | if (!input->keymap.map) { | ||
| 440 | SDL_free(input); | ||
| 441 | return NULL; | ||
| 442 | } | ||
| 443 | input->keymap.maplen = KS_NUMKEYCODES; | ||
| 444 | RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_GETMAP, &input->keymap)); | ||
| 445 | RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_GETLEDS, &input->ledstate)); | ||
| 446 | input->origledstate = input->ledstate; | ||
| 447 | RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_GETENCODING, &input->encoding)); | ||
| 448 | RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_GTYPE, &input->type)); | ||
| 449 | #ifdef WSKBDIO_SETVERSION | ||
| 450 | RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_SETVERSION, &version)); | ||
| 451 | #endif | ||
| 452 | return input; | ||
| 453 | } | ||
| 454 | |||
| 455 | void SDL_WSCONS_Init(void) | ||
| 456 | { | ||
| 457 | inputs[0] = SDL_WSCONS_Init_Keyboard("/dev/wskbd0"); | ||
| 458 | inputs[1] = SDL_WSCONS_Init_Keyboard("/dev/wskbd1"); | ||
| 459 | inputs[2] = SDL_WSCONS_Init_Keyboard("/dev/wskbd2"); | ||
| 460 | inputs[3] = SDL_WSCONS_Init_Keyboard("/dev/wskbd3"); | ||
| 461 | |||
| 462 | mouseInputData = SDL_WSCONS_Init_Mouse(); | ||
| 463 | return; | ||
| 464 | } | ||
| 465 | |||
| 466 | void SDL_WSCONS_Quit(void) | ||
| 467 | { | ||
| 468 | int i = 0; | ||
| 469 | SDL_WSCONS_input_data *input = NULL; | ||
| 470 | |||
| 471 | SDL_WSCONS_Quit_Mouse(mouseInputData); | ||
| 472 | mouseInputData = NULL; | ||
| 473 | for (i = 0; i < 4; i++) { | ||
| 474 | input = inputs[i]; | ||
| 475 | if (input) { | ||
| 476 | if (input->fd != -1 && input->fd != 0) { | ||
| 477 | ioctl(input->fd, WSKBDIO_SETLEDS, &input->origledstate); | ||
| 478 | close(input->fd); | ||
| 479 | input->fd = -1; | ||
| 480 | } | ||
| 481 | SDL_free(input); | ||
| 482 | input = NULL; | ||
| 483 | } | ||
| 484 | inputs[i] = NULL; | ||
| 485 | } | ||
| 486 | } | ||
| 487 | |||
| 488 | static void put_queue(SDL_WSCONS_input_data *kbd, uint c) | ||
| 489 | { | ||
| 490 | // c is already part of a UTF-8 sequence and safe to add as a character | ||
| 491 | if (kbd->text_len < (sizeof(kbd->text) - 1)) { | ||
| 492 | kbd->text[kbd->text_len++] = (char)(c); | ||
| 493 | } | ||
| 494 | } | ||
| 495 | |||
| 496 | static void put_utf8(SDL_WSCONS_input_data *input, uint c) | ||
| 497 | { | ||
| 498 | if (c < 0x80) | ||
| 499 | /* 0******* */ | ||
| 500 | put_queue(input, c); | ||
| 501 | else if (c < 0x800) { | ||
| 502 | /* 110***** 10****** */ | ||
| 503 | put_queue(input, 0xc0 | (c >> 6)); | ||
| 504 | put_queue(input, 0x80 | (c & 0x3f)); | ||
| 505 | } else if (c < 0x10000) { | ||
| 506 | if (c >= 0xD800 && c <= 0xF500) { | ||
| 507 | return; | ||
| 508 | } | ||
| 509 | if (c == 0xFFFF) { | ||
| 510 | return; | ||
| 511 | } | ||
| 512 | /* 1110**** 10****** 10****** */ | ||
| 513 | put_queue(input, 0xe0 | (c >> 12)); | ||
| 514 | put_queue(input, 0x80 | ((c >> 6) & 0x3f)); | ||
| 515 | put_queue(input, 0x80 | (c & 0x3f)); | ||
| 516 | } else if (c < 0x110000) { | ||
| 517 | /* 11110*** 10****** 10****** 10****** */ | ||
| 518 | put_queue(input, 0xf0 | (c >> 18)); | ||
| 519 | put_queue(input, 0x80 | ((c >> 12) & 0x3f)); | ||
| 520 | put_queue(input, 0x80 | ((c >> 6) & 0x3f)); | ||
| 521 | put_queue(input, 0x80 | (c & 0x3f)); | ||
| 522 | } | ||
| 523 | } | ||
| 524 | |||
| 525 | static void Translate_to_text(SDL_WSCONS_input_data *input, keysym_t ksym) | ||
| 526 | { | ||
| 527 | if (KS_GROUP(ksym) == KS_GROUP_Keypad) { | ||
| 528 | if (SDL_isprint(ksym & 0xFF)) { | ||
| 529 | ksym &= 0xFF; | ||
| 530 | } | ||
| 531 | } | ||
| 532 | switch (ksym) { | ||
| 533 | case KS_Escape: | ||
| 534 | case KS_Delete: | ||
| 535 | case KS_BackSpace: | ||
| 536 | case KS_Return: | ||
| 537 | case KS_Linefeed: | ||
| 538 | // All of these are unprintable characters. Ignore them | ||
| 539 | break; | ||
| 540 | default: | ||
| 541 | put_utf8(input, ksym); | ||
| 542 | break; | ||
| 543 | } | ||
| 544 | if (input->text_len > 0) { | ||
| 545 | input->text[input->text_len] = '\0'; | ||
| 546 | SDL_SendKeyboardText(input->text); | ||
| 547 | // SDL_memset(input->text, 0, sizeof(input->text)); | ||
| 548 | input->text_len = 0; | ||
| 549 | input->text[0] = 0; | ||
| 550 | } | ||
| 551 | } | ||
| 552 | |||
| 553 | static void Translate_to_keycode(SDL_WSCONS_input_data *input, int type, keysym_t ksym, Uint64 timestamp) | ||
| 554 | { | ||
| 555 | struct wscons_keymap keyDesc = input->keymap.map[ksym]; | ||
| 556 | keysym_t *group = &keyDesc.group1[KS_GROUP(keyDesc.group1[0]) == KS_GROUP_Keypad && IS_NUMLOCK_ON ? !IS_SHIFT_HELD : 0]; | ||
| 557 | int i = 0; | ||
| 558 | |||
| 559 | // Check command first, then group[0] | ||
| 560 | switch (keyDesc.command) { | ||
| 561 | case KS_Cmd_ScrollBack: | ||
| 562 | { | ||
| 563 | SDL_SendKeyboardKey(timestamp, input->keyboardID, 0, SDL_SCANCODE_PAGEUP, (type == WSCONS_EVENT_KEY_DOWN)); | ||
| 564 | return; | ||
| 565 | } | ||
| 566 | case KS_Cmd_ScrollFwd: | ||
| 567 | { | ||
| 568 | SDL_SendKeyboardKey(timestamp, input->keyboardID, 0, SDL_SCANCODE_PAGEDOWN, (type == WSCONS_EVENT_KEY_DOWN)); | ||
| 569 | return; | ||
| 570 | } | ||
| 571 | default: | ||
| 572 | break; | ||
| 573 | } | ||
| 574 | for (i = 0; i < SDL_arraysize(conversion_table); i++) { | ||
| 575 | if (conversion_table[i].sourcekey == group[0]) { | ||
| 576 | SDL_SendKeyboardKey(timestamp, input->keyboardID, group[0], conversion_table[i].targetKey, (type == WSCONS_EVENT_KEY_DOWN)); | ||
| 577 | return; | ||
| 578 | } | ||
| 579 | } | ||
| 580 | SDL_SendKeyboardKey(timestamp, input->keyboardID, group[0], SDL_SCANCODE_UNKNOWN, (type == WSCONS_EVENT_KEY_DOWN)); | ||
| 581 | } | ||
| 582 | |||
| 583 | static Uint64 GetEventTimestamp(struct timespec *time) | ||
| 584 | { | ||
| 585 | // FIXME: Get the event time in the SDL tick time base | ||
| 586 | return SDL_GetTicksNS(); | ||
| 587 | } | ||
| 588 | |||
| 589 | static void updateKeyboard(SDL_WSCONS_input_data *input) | ||
| 590 | { | ||
| 591 | struct wscons_event events[64]; | ||
| 592 | int type; | ||
| 593 | int n, i, gindex, acc_i; | ||
| 594 | keysym_t *group; | ||
| 595 | keysym_t ksym, result; | ||
| 596 | |||
| 597 | if (!input) { | ||
| 598 | return; | ||
| 599 | } | ||
| 600 | if ((n = read(input->fd, events, sizeof(events))) > 0) { | ||
| 601 | n /= sizeof(struct wscons_event); | ||
| 602 | for (i = 0; i < n; i++) { | ||
| 603 | Uint64 timestamp = GetEventTimestamp(&events[i].time); | ||
| 604 | type = events[i].type; | ||
| 605 | switch (type) { | ||
| 606 | case WSCONS_EVENT_KEY_DOWN: | ||
| 607 | { | ||
| 608 | switch (input->keymap.map[events[i].value].group1[0]) { | ||
| 609 | case KS_Hold_Screen: | ||
| 610 | { | ||
| 611 | if (input->lockheldstate[0] >= 1) { | ||
| 612 | break; | ||
| 613 | } | ||
| 614 | input->ledstate ^= LED_SCR; | ||
| 615 | ioctl(input->fd, WSKBDIO_SETLEDS, &input->ledstate); | ||
| 616 | input->lockheldstate[0] = 1; | ||
| 617 | break; | ||
| 618 | } | ||
| 619 | case KS_Num_Lock: | ||
| 620 | { | ||
| 621 | if (input->lockheldstate[1] >= 1) { | ||
| 622 | break; | ||
| 623 | } | ||
| 624 | input->ledstate ^= LED_NUM; | ||
| 625 | ioctl(input->fd, WSKBDIO_SETLEDS, &input->ledstate); | ||
| 626 | input->lockheldstate[1] = 1; | ||
| 627 | break; | ||
| 628 | } | ||
| 629 | case KS_Caps_Lock: | ||
| 630 | { | ||
| 631 | if (input->lockheldstate[2] >= 1) { | ||
| 632 | break; | ||
| 633 | } | ||
| 634 | input->ledstate ^= LED_CAP; | ||
| 635 | ioctl(input->fd, WSKBDIO_SETLEDS, &input->ledstate); | ||
| 636 | input->lockheldstate[2] = 1; | ||
| 637 | break; | ||
| 638 | } | ||
| 639 | #ifndef SDL_PLATFORM_NETBSD | ||
| 640 | case KS_Mode_Lock: | ||
| 641 | { | ||
| 642 | if (input->lockheldstate[3] >= 1) { | ||
| 643 | break; | ||
| 644 | } | ||
| 645 | input->ledstate ^= 1 << 4; | ||
| 646 | ioctl(input->fd, WSKBDIO_SETLEDS, &input->ledstate); | ||
| 647 | input->lockheldstate[3] = 1; | ||
| 648 | break; | ||
| 649 | } | ||
| 650 | #endif | ||
| 651 | case KS_Shift_Lock: | ||
| 652 | { | ||
| 653 | if (input->lockheldstate[4] >= 1) { | ||
| 654 | break; | ||
| 655 | } | ||
| 656 | input->ledstate ^= 1 << 5; | ||
| 657 | ioctl(input->fd, WSKBDIO_SETLEDS, &input->ledstate); | ||
| 658 | input->lockheldstate[4] = 1; | ||
| 659 | break; | ||
| 660 | } | ||
| 661 | case KS_Shift_L: | ||
| 662 | { | ||
| 663 | if (input->shiftheldstate[0]) { | ||
| 664 | break; | ||
| 665 | } | ||
| 666 | input->shiftstate[0]++; | ||
| 667 | input->shiftheldstate[0] = 1; | ||
| 668 | break; | ||
| 669 | } | ||
| 670 | case KS_Shift_R: | ||
| 671 | { | ||
| 672 | if (input->shiftheldstate[1]) { | ||
| 673 | break; | ||
| 674 | } | ||
| 675 | input->shiftstate[0]++; | ||
| 676 | input->shiftheldstate[1] = 1; | ||
| 677 | break; | ||
| 678 | } | ||
| 679 | case KS_Alt_L: | ||
| 680 | { | ||
| 681 | if (input->shiftheldstate[2]) { | ||
| 682 | break; | ||
| 683 | } | ||
| 684 | input->shiftstate[1]++; | ||
| 685 | input->shiftheldstate[2] = 1; | ||
| 686 | break; | ||
| 687 | } | ||
| 688 | case KS_Alt_R: | ||
| 689 | { | ||
| 690 | if (input->shiftheldstate[3]) { | ||
| 691 | break; | ||
| 692 | } | ||
| 693 | input->shiftstate[1]++; | ||
| 694 | input->shiftheldstate[3] = 1; | ||
| 695 | break; | ||
| 696 | } | ||
| 697 | case KS_Control_L: | ||
| 698 | { | ||
| 699 | if (input->shiftheldstate[4]) { | ||
| 700 | break; | ||
| 701 | } | ||
| 702 | input->shiftstate[2]++; | ||
| 703 | input->shiftheldstate[4] = 1; | ||
| 704 | break; | ||
| 705 | } | ||
| 706 | case KS_Control_R: | ||
| 707 | { | ||
| 708 | if (input->shiftheldstate[5]) { | ||
| 709 | break; | ||
| 710 | } | ||
| 711 | input->shiftstate[2]++; | ||
| 712 | input->shiftheldstate[5] = 1; | ||
| 713 | break; | ||
| 714 | } | ||
| 715 | case KS_Mode_switch: | ||
| 716 | { | ||
| 717 | if (input->shiftheldstate[6]) { | ||
| 718 | break; | ||
| 719 | } | ||
| 720 | input->shiftstate[3]++; | ||
| 721 | input->shiftheldstate[6] = 1; | ||
| 722 | break; | ||
| 723 | } | ||
| 724 | } | ||
| 725 | } break; | ||
| 726 | case WSCONS_EVENT_KEY_UP: | ||
| 727 | { | ||
| 728 | switch (input->keymap.map[events[i].value].group1[0]) { | ||
| 729 | case KS_Hold_Screen: | ||
| 730 | { | ||
| 731 | if (input->lockheldstate[0]) { | ||
| 732 | input->lockheldstate[0] = 0; | ||
| 733 | } | ||
| 734 | } break; | ||
| 735 | case KS_Num_Lock: | ||
| 736 | { | ||
| 737 | if (input->lockheldstate[1]) { | ||
| 738 | input->lockheldstate[1] = 0; | ||
| 739 | } | ||
| 740 | } break; | ||
| 741 | case KS_Caps_Lock: | ||
| 742 | { | ||
| 743 | if (input->lockheldstate[2]) { | ||
| 744 | input->lockheldstate[2] = 0; | ||
| 745 | } | ||
| 746 | } break; | ||
| 747 | #ifndef SDL_PLATFORM_NETBSD | ||
| 748 | case KS_Mode_Lock: | ||
| 749 | { | ||
| 750 | if (input->lockheldstate[3]) { | ||
| 751 | input->lockheldstate[3] = 0; | ||
| 752 | } | ||
| 753 | } break; | ||
| 754 | #endif | ||
| 755 | case KS_Shift_Lock: | ||
| 756 | { | ||
| 757 | if (input->lockheldstate[4]) { | ||
| 758 | input->lockheldstate[4] = 0; | ||
| 759 | } | ||
| 760 | } break; | ||
| 761 | case KS_Shift_L: | ||
| 762 | { | ||
| 763 | input->shiftheldstate[0] = 0; | ||
| 764 | if (input->shiftstate[0]) { | ||
| 765 | input->shiftstate[0]--; | ||
| 766 | } | ||
| 767 | break; | ||
| 768 | } | ||
| 769 | case KS_Shift_R: | ||
| 770 | { | ||
| 771 | input->shiftheldstate[1] = 0; | ||
| 772 | if (input->shiftstate[0]) { | ||
| 773 | input->shiftstate[0]--; | ||
| 774 | } | ||
| 775 | break; | ||
| 776 | } | ||
| 777 | case KS_Alt_L: | ||
| 778 | { | ||
| 779 | input->shiftheldstate[2] = 0; | ||
| 780 | if (input->shiftstate[1]) { | ||
| 781 | input->shiftstate[1]--; | ||
| 782 | } | ||
| 783 | break; | ||
| 784 | } | ||
| 785 | case KS_Alt_R: | ||
| 786 | { | ||
| 787 | input->shiftheldstate[3] = 0; | ||
| 788 | if (input->shiftstate[1]) { | ||
| 789 | input->shiftstate[1]--; | ||
| 790 | } | ||
| 791 | break; | ||
| 792 | } | ||
| 793 | case KS_Control_L: | ||
| 794 | { | ||
| 795 | input->shiftheldstate[4] = 0; | ||
| 796 | if (input->shiftstate[2]) { | ||
| 797 | input->shiftstate[2]--; | ||
| 798 | } | ||
| 799 | break; | ||
| 800 | } | ||
| 801 | case KS_Control_R: | ||
| 802 | { | ||
| 803 | input->shiftheldstate[5] = 0; | ||
| 804 | if (input->shiftstate[2]) { | ||
| 805 | input->shiftstate[2]--; | ||
| 806 | } | ||
| 807 | break; | ||
| 808 | } | ||
| 809 | case KS_Mode_switch: | ||
| 810 | { | ||
| 811 | input->shiftheldstate[6] = 0; | ||
| 812 | if (input->shiftstate[3]) { | ||
| 813 | input->shiftstate[3]--; | ||
| 814 | } | ||
| 815 | break; | ||
| 816 | } | ||
| 817 | } | ||
| 818 | } break; | ||
| 819 | case WSCONS_EVENT_ALL_KEYS_UP: | ||
| 820 | for (i = 0; i < SDL_SCANCODE_COUNT; i++) { | ||
| 821 | SDL_SendKeyboardKey(timestamp, input->keyboardID, 0, (SDL_Scancode)i, false); | ||
| 822 | } | ||
| 823 | break; | ||
| 824 | default: | ||
| 825 | break; | ||
| 826 | } | ||
| 827 | |||
| 828 | if (input->type == WSKBD_TYPE_USB && events[i].value <= 0xE7) { | ||
| 829 | SDL_SendKeyboardKey(timestamp, input->keyboardID, 0, (SDL_Scancode)events[i].value, (type == WSCONS_EVENT_KEY_DOWN)); | ||
| 830 | } else { | ||
| 831 | Translate_to_keycode(input, type, events[i].value, timestamp); | ||
| 832 | } | ||
| 833 | |||
| 834 | if (type == WSCONS_EVENT_KEY_UP) { | ||
| 835 | continue; | ||
| 836 | } | ||
| 837 | |||
| 838 | if (IS_ALTGR_MODE && !IS_CONTROL_HELD) | ||
| 839 | group = &input->keymap.map[events[i].value].group2[0]; | ||
| 840 | else | ||
| 841 | group = &input->keymap.map[events[i].value].group1[0]; | ||
| 842 | |||
| 843 | if (IS_NUMLOCK_ON && KS_GROUP(group[1]) == KS_GROUP_Keypad) { | ||
| 844 | gindex = !IS_SHIFT_HELD; | ||
| 845 | ksym = group[gindex]; | ||
| 846 | } else { | ||
| 847 | if (IS_CAPSLOCK_ON && !IS_SHIFT_HELD) { | ||
| 848 | gindex = 0; | ||
| 849 | ksym = ksym_upcase(group[0]); | ||
| 850 | } else { | ||
| 851 | gindex = IS_SHIFT_HELD; | ||
| 852 | ksym = group[gindex]; | ||
| 853 | } | ||
| 854 | } | ||
| 855 | result = KS_voidSymbol; | ||
| 856 | |||
| 857 | switch (KS_GROUP(ksym)) { | ||
| 858 | case KS_GROUP_Ascii: | ||
| 859 | case KS_GROUP_Keypad: | ||
| 860 | case KS_GROUP_Function: | ||
| 861 | result = ksym; | ||
| 862 | break; | ||
| 863 | case KS_GROUP_Mod: | ||
| 864 | if (ksym == KS_Multi_key) { | ||
| 865 | input->ledstate |= WSKBD_LED_COMPOSE; | ||
| 866 | ioctl(input->fd, WSKBDIO_SETLEDS, &input->ledstate); | ||
| 867 | input->composelen = 2; | ||
| 868 | input->composebuffer[0] = input->composebuffer[1] = 0; | ||
| 869 | } | ||
| 870 | break; | ||
| 871 | case KS_GROUP_Dead: | ||
| 872 | if (input->composelen == 0) { | ||
| 873 | input->ledstate |= WSKBD_LED_COMPOSE; | ||
| 874 | ioctl(input->fd, WSKBDIO_SETLEDS, &input->ledstate); | ||
| 875 | input->composelen = 1; | ||
| 876 | input->composebuffer[0] = ksym; | ||
| 877 | input->composebuffer[1] = 0; | ||
| 878 | } else | ||
| 879 | result = ksym; | ||
| 880 | break; | ||
| 881 | } | ||
| 882 | if (result == KS_voidSymbol) { | ||
| 883 | continue; | ||
| 884 | } | ||
| 885 | |||
| 886 | if (input->composelen > 0) { | ||
| 887 | if (input->composelen == 2 && group == &input->keymap.map[events[i].value].group2[0]) { | ||
| 888 | if (input->keymap.map[events[i].value].group2[gindex] == input->keymap.map[events[i].value].group1[gindex]) { | ||
| 889 | input->composelen = 0; | ||
| 890 | input->composebuffer[0] = input->composebuffer[1] = 0; | ||
| 891 | } | ||
| 892 | } | ||
| 893 | |||
| 894 | if (input->composelen != 0) { | ||
| 895 | input->composebuffer[2 - input->composelen] = result; | ||
| 896 | if (--input->composelen == 0) { | ||
| 897 | result = KS_voidSymbol; | ||
| 898 | input->ledstate &= ~WSKBD_LED_COMPOSE; | ||
| 899 | ioctl(input->fd, WSKBDIO_SETLEDS, &input->ledstate); | ||
| 900 | for (acc_i = 0; acc_i < SDL_arraysize(compose_tab); acc_i++) { | ||
| 901 | if ((compose_tab[acc_i].elem[0] == input->composebuffer[0] && compose_tab[acc_i].elem[1] == input->composebuffer[1]) || (compose_tab[acc_i].elem[0] == input->composebuffer[1] && compose_tab[acc_i].elem[1] == input->composebuffer[0])) { | ||
| 902 | result = compose_tab[acc_i].result; | ||
| 903 | break; | ||
| 904 | } | ||
| 905 | } | ||
| 906 | } else | ||
| 907 | continue; | ||
| 908 | } | ||
| 909 | } | ||
| 910 | |||
| 911 | if (KS_GROUP(result) == KS_GROUP_Ascii) { | ||
| 912 | if (IS_CONTROL_HELD) { | ||
| 913 | if ((result >= KS_at && result <= KS_z) || result == KS_space) { | ||
| 914 | result = result & 0x1f; | ||
| 915 | } else if (result == KS_2) { | ||
| 916 | result = 0x00; | ||
| 917 | } else if (result >= KS_3 && result <= KS_7) { | ||
| 918 | result = KS_Escape + (result - KS_3); | ||
| 919 | } else if (result == KS_8) { | ||
| 920 | result = KS_Delete; | ||
| 921 | } | ||
| 922 | } | ||
| 923 | if (IS_ALT_HELD) { | ||
| 924 | if (input->encoding & KB_METAESC) { | ||
| 925 | Translate_to_keycode(input, WSCONS_EVENT_KEY_DOWN, KS_Escape, 0); | ||
| 926 | Translate_to_text(input, result); | ||
| 927 | continue; | ||
| 928 | } else { | ||
| 929 | result |= 0x80; | ||
| 930 | } | ||
| 931 | } | ||
| 932 | } | ||
| 933 | Translate_to_text(input, result); | ||
| 934 | continue; | ||
| 935 | } | ||
| 936 | } | ||
| 937 | } | ||
| 938 | |||
| 939 | void SDL_WSCONS_PumpEvents(void) | ||
| 940 | { | ||
| 941 | int i = 0; | ||
| 942 | for (i = 0; i < 4; i++) { | ||
| 943 | updateKeyboard(inputs[i]); | ||
| 944 | } | ||
| 945 | if (mouseInputData) { | ||
| 946 | updateMouse(mouseInputData); | ||
| 947 | } | ||
| 948 | } | ||
diff --git a/contrib/SDL-3.2.8/src/core/openbsd/SDL_wscons_mouse.c b/contrib/SDL-3.2.8/src/core/openbsd/SDL_wscons_mouse.c new file mode 100644 index 0000000..51195f3 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/openbsd/SDL_wscons_mouse.c | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "SDL_internal.h" | ||
| 23 | #include <sys/time.h> | ||
| 24 | #include <dev/wscons/wsconsio.h> | ||
| 25 | #include <unistd.h> | ||
| 26 | #include <sys/ioctl.h> | ||
| 27 | #include <stdlib.h> | ||
| 28 | #include <fcntl.h> | ||
| 29 | |||
| 30 | #include "../../events/SDL_mouse_c.h" | ||
| 31 | |||
| 32 | typedef struct SDL_WSCONS_mouse_input_data | ||
| 33 | { | ||
| 34 | int fd; | ||
| 35 | SDL_MouseID mouseID; | ||
| 36 | } SDL_WSCONS_mouse_input_data; | ||
| 37 | |||
| 38 | SDL_WSCONS_mouse_input_data *SDL_WSCONS_Init_Mouse(void) | ||
| 39 | { | ||
| 40 | #ifdef WSMOUSEIO_SETVERSION | ||
| 41 | int version = WSMOUSE_EVENT_VERSION; | ||
| 42 | #endif | ||
| 43 | SDL_WSCONS_mouse_input_data *input = SDL_calloc(1, sizeof(SDL_WSCONS_mouse_input_data)); | ||
| 44 | |||
| 45 | if (!input) { | ||
| 46 | return NULL; | ||
| 47 | } | ||
| 48 | input->fd = open("/dev/wsmouse", O_RDWR | O_NONBLOCK | O_CLOEXEC); | ||
| 49 | if (input->fd == -1) { | ||
| 50 | SDL_free(input); | ||
| 51 | return NULL; | ||
| 52 | } | ||
| 53 | |||
| 54 | input->mouseID = SDL_GetNextObjectID(); | ||
| 55 | SDL_AddMouse(input->mouseID, NULL, false); | ||
| 56 | |||
| 57 | #ifdef WSMOUSEIO_SETMODE | ||
| 58 | ioctl(input->fd, WSMOUSEIO_SETMODE, WSMOUSE_COMPAT); | ||
| 59 | #endif | ||
| 60 | #ifdef WSMOUSEIO_SETVERSION | ||
| 61 | ioctl(input->fd, WSMOUSEIO_SETVERSION, &version); | ||
| 62 | #endif | ||
| 63 | return input; | ||
| 64 | } | ||
| 65 | |||
| 66 | static Uint64 GetEventTimestamp(struct timespec *time) | ||
| 67 | { | ||
| 68 | // FIXME: Get the event time in the SDL tick time base | ||
| 69 | return SDL_GetTicksNS(); | ||
| 70 | } | ||
| 71 | |||
| 72 | void updateMouse(SDL_WSCONS_mouse_input_data *input) | ||
| 73 | { | ||
| 74 | struct wscons_event events[64]; | ||
| 75 | int n; | ||
| 76 | SDL_Mouse *mouse = SDL_GetMouse(); | ||
| 77 | |||
| 78 | if ((n = read(input->fd, events, sizeof(events))) > 0) { | ||
| 79 | int i; | ||
| 80 | n /= sizeof(struct wscons_event); | ||
| 81 | for (i = 0; i < n; i++) { | ||
| 82 | Uint64 timestamp = GetEventTimestamp(&events[i].time); | ||
| 83 | int type = events[i].type; | ||
| 84 | switch (type) { | ||
| 85 | case WSCONS_EVENT_MOUSE_DOWN: | ||
| 86 | case WSCONS_EVENT_MOUSE_UP: | ||
| 87 | { | ||
| 88 | Uint8 button = SDL_BUTTON_LEFT + events[i].value; | ||
| 89 | bool down = (type == WSCONS_EVENT_MOUSE_DOWN); | ||
| 90 | SDL_SendMouseButton(timestamp, mouse->focus, input->mouseID, button, down); | ||
| 91 | break; | ||
| 92 | } | ||
| 93 | case WSCONS_EVENT_MOUSE_DELTA_X: | ||
| 94 | { | ||
| 95 | SDL_SendMouseMotion(timestamp, mouse->focus, input->mouseID, true, (float)events[i].value, 0.0f); | ||
| 96 | break; | ||
| 97 | } | ||
| 98 | case WSCONS_EVENT_MOUSE_DELTA_Y: | ||
| 99 | { | ||
| 100 | SDL_SendMouseMotion(timestamp, mouse->focus, input->mouseID, true, 0.0f, -(float)events[i].value); | ||
| 101 | break; | ||
| 102 | } | ||
| 103 | case WSCONS_EVENT_MOUSE_DELTA_W: | ||
| 104 | { | ||
| 105 | SDL_SendMouseWheel(timestamp, mouse->focus, input->mouseID, events[i].value, 0, SDL_MOUSEWHEEL_NORMAL); | ||
| 106 | break; | ||
| 107 | } | ||
| 108 | case WSCONS_EVENT_MOUSE_DELTA_Z: | ||
| 109 | { | ||
| 110 | SDL_SendMouseWheel(timestamp, mouse->focus, input->mouseID, 0, -events[i].value, SDL_MOUSEWHEEL_NORMAL); | ||
| 111 | break; | ||
| 112 | } | ||
| 113 | default: | ||
| 114 | break; | ||
| 115 | } | ||
| 116 | } | ||
| 117 | } | ||
| 118 | } | ||
| 119 | |||
| 120 | void SDL_WSCONS_Quit_Mouse(SDL_WSCONS_mouse_input_data *input) | ||
| 121 | { | ||
| 122 | if (!input) { | ||
| 123 | return; | ||
| 124 | } | ||
| 125 | close(input->fd); | ||
| 126 | SDL_free(input); | ||
| 127 | } | ||
diff --git a/contrib/SDL-3.2.8/src/core/unix/SDL_appid.c b/contrib/SDL-3.2.8/src/core/unix/SDL_appid.c new file mode 100644 index 0000000..996e216 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/unix/SDL_appid.c | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "SDL_internal.h" | ||
| 23 | |||
| 24 | #include "SDL_appid.h" | ||
| 25 | #include <unistd.h> | ||
| 26 | |||
| 27 | const char *SDL_GetExeName(void) | ||
| 28 | { | ||
| 29 | static const char *proc_name = NULL; | ||
| 30 | |||
| 31 | // TODO: Use a fallback if BSD has no mounted procfs (OpenBSD has no procfs at all) | ||
| 32 | if (!proc_name) { | ||
| 33 | #if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_FREEBSD) || defined (SDL_PLATFORM_NETBSD) | ||
| 34 | static char linkfile[1024]; | ||
| 35 | int linksize; | ||
| 36 | |||
| 37 | #if defined(SDL_PLATFORM_LINUX) | ||
| 38 | const char *proc_path = "/proc/self/exe"; | ||
| 39 | #elif defined(SDL_PLATFORM_FREEBSD) | ||
| 40 | const char *proc_path = "/proc/curproc/file"; | ||
| 41 | #elif defined(SDL_PLATFORM_NETBSD) | ||
| 42 | const char *proc_path = "/proc/curproc/exe"; | ||
| 43 | #endif | ||
| 44 | linksize = readlink(proc_path, linkfile, sizeof(linkfile) - 1); | ||
| 45 | if (linksize > 0) { | ||
| 46 | linkfile[linksize] = '\0'; | ||
| 47 | proc_name = SDL_strrchr(linkfile, '/'); | ||
| 48 | if (proc_name) { | ||
| 49 | ++proc_name; | ||
| 50 | } else { | ||
| 51 | proc_name = linkfile; | ||
| 52 | } | ||
| 53 | } | ||
| 54 | #endif | ||
| 55 | } | ||
| 56 | |||
| 57 | return proc_name; | ||
| 58 | } | ||
| 59 | |||
| 60 | const char *SDL_GetAppID(void) | ||
| 61 | { | ||
| 62 | const char *id_str = SDL_GetAppMetadataProperty(SDL_PROP_APP_METADATA_IDENTIFIER_STRING); | ||
| 63 | |||
| 64 | if (!id_str) { | ||
| 65 | // If the hint isn't set, try to use the application's executable name | ||
| 66 | id_str = SDL_GetExeName(); | ||
| 67 | } | ||
| 68 | |||
| 69 | if (!id_str) { | ||
| 70 | // Finally, use the default we've used forever | ||
| 71 | id_str = "SDL_App"; | ||
| 72 | } | ||
| 73 | |||
| 74 | return id_str; | ||
| 75 | } | ||
diff --git a/contrib/SDL-3.2.8/src/core/unix/SDL_appid.h b/contrib/SDL-3.2.8/src/core/unix/SDL_appid.h new file mode 100644 index 0000000..3482521 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/unix/SDL_appid.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "SDL_internal.h" | ||
| 23 | |||
| 24 | #ifndef SDL_appid_h_ | ||
| 25 | #define SDL_appid_h_ | ||
| 26 | |||
| 27 | extern const char *SDL_GetExeName(void); | ||
| 28 | extern const char *SDL_GetAppID(void); | ||
| 29 | |||
| 30 | #endif // SDL_appid_h_ | ||
diff --git a/contrib/SDL-3.2.8/src/core/unix/SDL_poll.c b/contrib/SDL-3.2.8/src/core/unix/SDL_poll.c new file mode 100644 index 0000000..572ed5a --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/unix/SDL_poll.c | |||
| @@ -0,0 +1,95 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "SDL_internal.h" | ||
| 23 | |||
| 24 | #include "SDL_poll.h" | ||
| 25 | |||
| 26 | #ifdef HAVE_POLL | ||
| 27 | #include <poll.h> | ||
| 28 | #else | ||
| 29 | #include <sys/time.h> | ||
| 30 | #include <sys/types.h> | ||
| 31 | #include <unistd.h> | ||
| 32 | #endif | ||
| 33 | #include <errno.h> | ||
| 34 | |||
| 35 | int SDL_IOReady(int fd, int flags, Sint64 timeoutNS) | ||
| 36 | { | ||
| 37 | int result; | ||
| 38 | |||
| 39 | SDL_assert(flags & (SDL_IOR_READ | SDL_IOR_WRITE)); | ||
| 40 | |||
| 41 | // Note: We don't bother to account for elapsed time if we get EINTR | ||
| 42 | do { | ||
| 43 | #ifdef HAVE_POLL | ||
| 44 | struct pollfd info; | ||
| 45 | int timeoutMS; | ||
| 46 | |||
| 47 | info.fd = fd; | ||
| 48 | info.events = 0; | ||
| 49 | if (flags & SDL_IOR_READ) { | ||
| 50 | info.events |= POLLIN | POLLPRI; | ||
| 51 | } | ||
| 52 | if (flags & SDL_IOR_WRITE) { | ||
| 53 | info.events |= POLLOUT; | ||
| 54 | } | ||
| 55 | // FIXME: Add support for ppoll() for nanosecond precision | ||
| 56 | if (timeoutNS > 0) { | ||
| 57 | timeoutMS = (int)SDL_NS_TO_MS(timeoutNS + (SDL_NS_PER_MS - 1)); | ||
| 58 | } else if (timeoutNS == 0) { | ||
| 59 | timeoutMS = 0; | ||
| 60 | } else { | ||
| 61 | timeoutMS = -1; | ||
| 62 | } | ||
| 63 | result = poll(&info, 1, timeoutMS); | ||
| 64 | #else | ||
| 65 | fd_set rfdset, *rfdp = NULL; | ||
| 66 | fd_set wfdset, *wfdp = NULL; | ||
| 67 | struct timeval tv, *tvp = NULL; | ||
| 68 | |||
| 69 | // If this assert triggers we'll corrupt memory here | ||
| 70 | SDL_assert(fd >= 0 && fd < FD_SETSIZE); | ||
| 71 | |||
| 72 | if (flags & SDL_IOR_READ) { | ||
| 73 | FD_ZERO(&rfdset); | ||
| 74 | FD_SET(fd, &rfdset); | ||
| 75 | rfdp = &rfdset; | ||
| 76 | } | ||
| 77 | if (flags & SDL_IOR_WRITE) { | ||
| 78 | FD_ZERO(&wfdset); | ||
| 79 | FD_SET(fd, &wfdset); | ||
| 80 | wfdp = &wfdset; | ||
| 81 | } | ||
| 82 | |||
| 83 | if (timeoutNS >= 0) { | ||
| 84 | tv.tv_sec = (timeoutNS / SDL_NS_PER_SECOND); | ||
| 85 | tv.tv_usec = SDL_NS_TO_US((timeoutNS % SDL_NS_PER_SECOND) + (SDL_NS_PER_US - 1)); | ||
| 86 | tvp = &tv; | ||
| 87 | } | ||
| 88 | |||
| 89 | result = select(fd + 1, rfdp, wfdp, NULL, tvp); | ||
| 90 | #endif // HAVE_POLL | ||
| 91 | |||
| 92 | } while (result < 0 && errno == EINTR && !(flags & SDL_IOR_NO_RETRY)); | ||
| 93 | |||
| 94 | return result; | ||
| 95 | } | ||
diff --git a/contrib/SDL-3.2.8/src/core/unix/SDL_poll.h b/contrib/SDL-3.2.8/src/core/unix/SDL_poll.h new file mode 100644 index 0000000..571619d --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/unix/SDL_poll.h | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "SDL_internal.h" | ||
| 23 | |||
| 24 | #ifndef SDL_poll_h_ | ||
| 25 | #define SDL_poll_h_ | ||
| 26 | |||
| 27 | #define SDL_IOR_READ 0x1 | ||
| 28 | #define SDL_IOR_WRITE 0x2 | ||
| 29 | #define SDL_IOR_NO_RETRY 0x4 | ||
| 30 | |||
| 31 | extern int SDL_IOReady(int fd, int flags, Sint64 timeoutNS); | ||
| 32 | |||
| 33 | #endif // SDL_poll_h_ | ||
diff --git a/contrib/SDL-3.2.8/src/core/windows/SDL_directx.h b/contrib/SDL-3.2.8/src/core/windows/SDL_directx.h new file mode 100644 index 0000000..6101e92 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/windows/SDL_directx.h | |||
| @@ -0,0 +1,112 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifndef SDL_directx_h_ | ||
| 24 | #define SDL_directx_h_ | ||
| 25 | |||
| 26 | // Include all of the DirectX 8.0 headers and adds any necessary tweaks | ||
| 27 | |||
| 28 | #include "SDL_windows.h" | ||
| 29 | #include <mmsystem.h> | ||
| 30 | #ifndef WIN32 | ||
| 31 | #define WIN32 | ||
| 32 | #endif | ||
| 33 | #undef WINNT | ||
| 34 | |||
| 35 | // Far pointers don't exist in 32-bit code | ||
| 36 | #ifndef FAR | ||
| 37 | #define FAR | ||
| 38 | #endif | ||
| 39 | |||
| 40 | // Error codes not yet included in Win32 API header files | ||
| 41 | #ifndef MAKE_HRESULT | ||
| 42 | #define MAKE_HRESULT(sev, fac, code) \ | ||
| 43 | ((HRESULT)(((unsigned long)(sev) << 31) | ((unsigned long)(fac) << 16) | ((unsigned long)(code)))) | ||
| 44 | #endif | ||
| 45 | |||
| 46 | #ifndef S_OK | ||
| 47 | #define S_OK (HRESULT)0x00000000L | ||
| 48 | #endif | ||
| 49 | |||
| 50 | #ifndef SUCCEEDED | ||
| 51 | #define SUCCEEDED(x) ((HRESULT)(x) >= 0) | ||
| 52 | #endif | ||
| 53 | #ifndef FAILED | ||
| 54 | #define FAILED(x) ((HRESULT)(x) < 0) | ||
| 55 | #endif | ||
| 56 | |||
| 57 | #ifndef E_FAIL | ||
| 58 | #define E_FAIL (HRESULT)0x80000008L | ||
| 59 | #endif | ||
| 60 | #ifndef E_NOINTERFACE | ||
| 61 | #define E_NOINTERFACE (HRESULT)0x80004002L | ||
| 62 | #endif | ||
| 63 | #ifndef E_OUTOFMEMORY | ||
| 64 | #define E_OUTOFMEMORY (HRESULT)0x8007000EL | ||
| 65 | #endif | ||
| 66 | #ifndef E_INVALIDARG | ||
| 67 | #define E_INVALIDARG (HRESULT)0x80070057L | ||
| 68 | #endif | ||
| 69 | #ifndef E_NOTIMPL | ||
| 70 | #define E_NOTIMPL (HRESULT)0x80004001L | ||
| 71 | #endif | ||
| 72 | #ifndef REGDB_E_CLASSNOTREG | ||
| 73 | #define REGDB_E_CLASSNOTREG (HRESULT)0x80040154L | ||
| 74 | #endif | ||
| 75 | |||
| 76 | // Severity codes | ||
| 77 | #ifndef SEVERITY_ERROR | ||
| 78 | #define SEVERITY_ERROR 1 | ||
| 79 | #endif | ||
| 80 | |||
| 81 | // Error facility codes | ||
| 82 | #ifndef FACILITY_WIN32 | ||
| 83 | #define FACILITY_WIN32 7 | ||
| 84 | #endif | ||
| 85 | |||
| 86 | #ifndef FIELD_OFFSET | ||
| 87 | #define FIELD_OFFSET(type, field) ((LONG) & (((type *)0)->field)) | ||
| 88 | #endif | ||
| 89 | |||
| 90 | /* DirectX headers (if it isn't included, I haven't tested it yet) | ||
| 91 | */ | ||
| 92 | // We need these defines to mark what version of DirectX API we use | ||
| 93 | #define DIRECTDRAW_VERSION 0x0700 | ||
| 94 | #define DIRECTSOUND_VERSION 0x0800 | ||
| 95 | #define DIRECTINPUT_VERSION 0x0800 // Need version 7 for force feedback. Need version 8 so IDirectInput8_EnumDevices doesn't leak like a sieve... | ||
| 96 | |||
| 97 | #ifdef HAVE_DDRAW_H | ||
| 98 | #include <ddraw.h> | ||
| 99 | #endif | ||
| 100 | #ifdef HAVE_DSOUND_H | ||
| 101 | #include <dsound.h> | ||
| 102 | #endif | ||
| 103 | #ifdef HAVE_DINPUT_H | ||
| 104 | #include <dinput.h> | ||
| 105 | #else | ||
| 106 | typedef struct | ||
| 107 | { | ||
| 108 | int unused; | ||
| 109 | } DIDEVICEINSTANCE; | ||
| 110 | #endif | ||
| 111 | |||
| 112 | #endif // SDL_directx_h_ | ||
diff --git a/contrib/SDL-3.2.8/src/core/windows/SDL_gameinput.c b/contrib/SDL-3.2.8/src/core/windows/SDL_gameinput.c new file mode 100644 index 0000000..9ac5912 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/windows/SDL_gameinput.c | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifdef HAVE_GAMEINPUT_H | ||
| 24 | |||
| 25 | #include "SDL_windows.h" | ||
| 26 | #include "SDL_gameinput.h" | ||
| 27 | |||
| 28 | #ifdef SDL_PLATFORM_WIN32 | ||
| 29 | #include <initguid.h> | ||
| 30 | // {11BE2A7E-4254-445A-9C09-FFC40F006918} | ||
| 31 | DEFINE_GUID(SDL_IID_GameInput, 0x11BE2A7E, 0x4254, 0x445A, 0x9C, 0x09, 0xFF, 0xC4, 0x0F, 0x00, 0x69, 0x18); | ||
| 32 | #endif | ||
| 33 | |||
| 34 | static SDL_SharedObject *g_hGameInputDLL; | ||
| 35 | static IGameInput *g_pGameInput; | ||
| 36 | static int g_nGameInputRefCount; | ||
| 37 | |||
| 38 | bool SDL_InitGameInput(IGameInput **ppGameInput) | ||
| 39 | { | ||
| 40 | if (g_nGameInputRefCount == 0) { | ||
| 41 | g_hGameInputDLL = SDL_LoadObject("gameinput.dll"); | ||
| 42 | if (!g_hGameInputDLL) { | ||
| 43 | return false; | ||
| 44 | } | ||
| 45 | |||
| 46 | typedef HRESULT (WINAPI *GameInputCreate_t)(IGameInput * *gameInput); | ||
| 47 | GameInputCreate_t GameInputCreateFunc = (GameInputCreate_t)SDL_LoadFunction(g_hGameInputDLL, "GameInputCreate"); | ||
| 48 | if (!GameInputCreateFunc) { | ||
| 49 | SDL_UnloadObject(g_hGameInputDLL); | ||
| 50 | return false; | ||
| 51 | } | ||
| 52 | |||
| 53 | IGameInput *pGameInput = NULL; | ||
| 54 | HRESULT hr = GameInputCreateFunc(&pGameInput); | ||
| 55 | if (FAILED(hr)) { | ||
| 56 | SDL_UnloadObject(g_hGameInputDLL); | ||
| 57 | return WIN_SetErrorFromHRESULT("GameInputCreate failed", hr); | ||
| 58 | } | ||
| 59 | |||
| 60 | #ifdef SDL_PLATFORM_WIN32 | ||
| 61 | hr = IGameInput_QueryInterface(pGameInput, &SDL_IID_GameInput, (void **)&g_pGameInput); | ||
| 62 | IGameInput_Release(pGameInput); | ||
| 63 | if (FAILED(hr)) { | ||
| 64 | SDL_UnloadObject(g_hGameInputDLL); | ||
| 65 | return WIN_SetErrorFromHRESULT("GameInput QueryInterface failed", hr); | ||
| 66 | } | ||
| 67 | #else | ||
| 68 | // Assume that the version we get is compatible with the current SDK | ||
| 69 | // If that isn't the case, define the correct GUID for SDL_IID_GameInput above | ||
| 70 | g_pGameInput = pGameInput; | ||
| 71 | #endif | ||
| 72 | } | ||
| 73 | ++g_nGameInputRefCount; | ||
| 74 | |||
| 75 | if (ppGameInput) { | ||
| 76 | *ppGameInput = g_pGameInput; | ||
| 77 | } | ||
| 78 | return true; | ||
| 79 | } | ||
| 80 | |||
| 81 | void SDL_QuitGameInput(void) | ||
| 82 | { | ||
| 83 | SDL_assert(g_nGameInputRefCount > 0); | ||
| 84 | |||
| 85 | --g_nGameInputRefCount; | ||
| 86 | if (g_nGameInputRefCount == 0) { | ||
| 87 | if (g_pGameInput) { | ||
| 88 | IGameInput_Release(g_pGameInput); | ||
| 89 | g_pGameInput = NULL; | ||
| 90 | } | ||
| 91 | if (g_hGameInputDLL) { | ||
| 92 | SDL_UnloadObject(g_hGameInputDLL); | ||
| 93 | g_hGameInputDLL = NULL; | ||
| 94 | } | ||
| 95 | } | ||
| 96 | } | ||
| 97 | |||
| 98 | #endif // HAVE_GAMEINPUT_H | ||
diff --git a/contrib/SDL-3.2.8/src/core/windows/SDL_gameinput.h b/contrib/SDL-3.2.8/src/core/windows/SDL_gameinput.h new file mode 100644 index 0000000..0022c0b --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/windows/SDL_gameinput.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifndef SDL_gameinput_h_ | ||
| 24 | #define SDL_gameinput_h_ | ||
| 25 | |||
| 26 | #ifdef HAVE_GAMEINPUT_H | ||
| 27 | |||
| 28 | #define COBJMACROS | ||
| 29 | #include <gameinput.h> | ||
| 30 | |||
| 31 | extern bool SDL_InitGameInput(IGameInput **ppGameInput); | ||
| 32 | extern void SDL_QuitGameInput(void); | ||
| 33 | |||
| 34 | #endif // HAVE_GAMEINPUT_H | ||
| 35 | |||
| 36 | #endif // SDL_gameinput_h_ | ||
diff --git a/contrib/SDL-3.2.8/src/core/windows/SDL_hid.c b/contrib/SDL-3.2.8/src/core/windows/SDL_hid.c new file mode 100644 index 0000000..87e8735 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/windows/SDL_hid.c | |||
| @@ -0,0 +1,254 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #include "SDL_hid.h" | ||
| 24 | |||
| 25 | HidD_GetAttributes_t SDL_HidD_GetAttributes; | ||
| 26 | HidD_GetString_t SDL_HidD_GetManufacturerString; | ||
| 27 | HidD_GetString_t SDL_HidD_GetProductString; | ||
| 28 | HidP_GetCaps_t SDL_HidP_GetCaps; | ||
| 29 | HidP_GetButtonCaps_t SDL_HidP_GetButtonCaps; | ||
| 30 | HidP_GetValueCaps_t SDL_HidP_GetValueCaps; | ||
| 31 | HidP_MaxDataListLength_t SDL_HidP_MaxDataListLength; | ||
| 32 | HidP_GetData_t SDL_HidP_GetData; | ||
| 33 | |||
| 34 | static HMODULE s_pHIDDLL = 0; | ||
| 35 | static int s_HIDDLLRefCount = 0; | ||
| 36 | |||
| 37 | |||
| 38 | bool WIN_LoadHIDDLL(void) | ||
| 39 | { | ||
| 40 | if (s_pHIDDLL) { | ||
| 41 | SDL_assert(s_HIDDLLRefCount > 0); | ||
| 42 | s_HIDDLLRefCount++; | ||
| 43 | return true; // already loaded | ||
| 44 | } | ||
| 45 | |||
| 46 | s_pHIDDLL = LoadLibrary(TEXT("hid.dll")); | ||
| 47 | if (!s_pHIDDLL) { | ||
| 48 | return false; | ||
| 49 | } | ||
| 50 | |||
| 51 | SDL_assert(s_HIDDLLRefCount == 0); | ||
| 52 | s_HIDDLLRefCount = 1; | ||
| 53 | |||
| 54 | SDL_HidD_GetAttributes = (HidD_GetAttributes_t)GetProcAddress(s_pHIDDLL, "HidD_GetAttributes"); | ||
| 55 | SDL_HidD_GetManufacturerString = (HidD_GetString_t)GetProcAddress(s_pHIDDLL, "HidD_GetManufacturerString"); | ||
| 56 | SDL_HidD_GetProductString = (HidD_GetString_t)GetProcAddress(s_pHIDDLL, "HidD_GetProductString"); | ||
| 57 | SDL_HidP_GetCaps = (HidP_GetCaps_t)GetProcAddress(s_pHIDDLL, "HidP_GetCaps"); | ||
| 58 | SDL_HidP_GetButtonCaps = (HidP_GetButtonCaps_t)GetProcAddress(s_pHIDDLL, "HidP_GetButtonCaps"); | ||
| 59 | SDL_HidP_GetValueCaps = (HidP_GetValueCaps_t)GetProcAddress(s_pHIDDLL, "HidP_GetValueCaps"); | ||
| 60 | SDL_HidP_MaxDataListLength = (HidP_MaxDataListLength_t)GetProcAddress(s_pHIDDLL, "HidP_MaxDataListLength"); | ||
| 61 | SDL_HidP_GetData = (HidP_GetData_t)GetProcAddress(s_pHIDDLL, "HidP_GetData"); | ||
| 62 | if (!SDL_HidD_GetManufacturerString || !SDL_HidD_GetProductString || | ||
| 63 | !SDL_HidP_GetCaps || !SDL_HidP_GetButtonCaps || | ||
| 64 | !SDL_HidP_GetValueCaps || !SDL_HidP_MaxDataListLength || !SDL_HidP_GetData) { | ||
| 65 | WIN_UnloadHIDDLL(); | ||
| 66 | return false; | ||
| 67 | } | ||
| 68 | |||
| 69 | return true; | ||
| 70 | } | ||
| 71 | |||
| 72 | void WIN_UnloadHIDDLL(void) | ||
| 73 | { | ||
| 74 | if (s_pHIDDLL) { | ||
| 75 | SDL_assert(s_HIDDLLRefCount > 0); | ||
| 76 | if (--s_HIDDLLRefCount == 0) { | ||
| 77 | FreeLibrary(s_pHIDDLL); | ||
| 78 | s_pHIDDLL = NULL; | ||
| 79 | } | ||
| 80 | } else { | ||
| 81 | SDL_assert(s_HIDDLLRefCount == 0); | ||
| 82 | } | ||
| 83 | } | ||
| 84 | |||
| 85 | #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) | ||
| 86 | |||
| 87 | // CM_Register_Notification definitions | ||
| 88 | |||
| 89 | #define CR_SUCCESS 0 | ||
| 90 | |||
| 91 | DECLARE_HANDLE(HCMNOTIFICATION); | ||
| 92 | typedef HCMNOTIFICATION *PHCMNOTIFICATION; | ||
| 93 | |||
| 94 | typedef enum _CM_NOTIFY_FILTER_TYPE | ||
| 95 | { | ||
| 96 | CM_NOTIFY_FILTER_TYPE_DEVICEINTERFACE = 0, | ||
| 97 | CM_NOTIFY_FILTER_TYPE_DEVICEHANDLE, | ||
| 98 | CM_NOTIFY_FILTER_TYPE_DEVICEINSTANCE, | ||
| 99 | CM_NOTIFY_FILTER_TYPE_MAX | ||
| 100 | } CM_NOTIFY_FILTER_TYPE, *PCM_NOTIFY_FILTER_TYPE; | ||
| 101 | |||
| 102 | typedef struct _CM_NOTIFY_FILTER | ||
| 103 | { | ||
| 104 | DWORD cbSize; | ||
| 105 | DWORD Flags; | ||
| 106 | CM_NOTIFY_FILTER_TYPE FilterType; | ||
| 107 | DWORD Reserved; | ||
| 108 | union | ||
| 109 | { | ||
| 110 | struct | ||
| 111 | { | ||
| 112 | GUID ClassGuid; | ||
| 113 | } DeviceInterface; | ||
| 114 | struct | ||
| 115 | { | ||
| 116 | HANDLE hTarget; | ||
| 117 | } DeviceHandle; | ||
| 118 | struct | ||
| 119 | { | ||
| 120 | WCHAR InstanceId[200]; | ||
| 121 | } DeviceInstance; | ||
| 122 | } u; | ||
| 123 | } CM_NOTIFY_FILTER, *PCM_NOTIFY_FILTER; | ||
| 124 | |||
| 125 | typedef enum _CM_NOTIFY_ACTION | ||
| 126 | { | ||
| 127 | CM_NOTIFY_ACTION_DEVICEINTERFACEARRIVAL = 0, | ||
| 128 | CM_NOTIFY_ACTION_DEVICEINTERFACEREMOVAL, | ||
| 129 | CM_NOTIFY_ACTION_DEVICEQUERYREMOVE, | ||
| 130 | CM_NOTIFY_ACTION_DEVICEQUERYREMOVEFAILED, | ||
| 131 | CM_NOTIFY_ACTION_DEVICEREMOVEPENDING, | ||
| 132 | CM_NOTIFY_ACTION_DEVICEREMOVECOMPLETE, | ||
| 133 | CM_NOTIFY_ACTION_DEVICECUSTOMEVENT, | ||
| 134 | CM_NOTIFY_ACTION_DEVICEINSTANCEENUMERATED, | ||
| 135 | CM_NOTIFY_ACTION_DEVICEINSTANCESTARTED, | ||
| 136 | CM_NOTIFY_ACTION_DEVICEINSTANCEREMOVED, | ||
| 137 | CM_NOTIFY_ACTION_MAX | ||
| 138 | } CM_NOTIFY_ACTION, *PCM_NOTIFY_ACTION; | ||
| 139 | |||
| 140 | typedef struct _CM_NOTIFY_EVENT_DATA | ||
| 141 | { | ||
| 142 | CM_NOTIFY_FILTER_TYPE FilterType; | ||
| 143 | DWORD Reserved; | ||
| 144 | union | ||
| 145 | { | ||
| 146 | struct | ||
| 147 | { | ||
| 148 | GUID ClassGuid; | ||
| 149 | WCHAR SymbolicLink[ANYSIZE_ARRAY]; | ||
| 150 | } DeviceInterface; | ||
| 151 | struct | ||
| 152 | { | ||
| 153 | GUID EventGuid; | ||
| 154 | LONG NameOffset; | ||
| 155 | DWORD DataSize; | ||
| 156 | BYTE Data[ANYSIZE_ARRAY]; | ||
| 157 | } DeviceHandle; | ||
| 158 | struct | ||
| 159 | { | ||
| 160 | WCHAR InstanceId[ANYSIZE_ARRAY]; | ||
| 161 | } DeviceInstance; | ||
| 162 | } u; | ||
| 163 | } CM_NOTIFY_EVENT_DATA, *PCM_NOTIFY_EVENT_DATA; | ||
| 164 | |||
| 165 | typedef DWORD (CALLBACK *PCM_NOTIFY_CALLBACK)(HCMNOTIFICATION hNotify, PVOID Context, CM_NOTIFY_ACTION Action, PCM_NOTIFY_EVENT_DATA EventData, DWORD EventDataSize); | ||
| 166 | |||
| 167 | typedef DWORD (WINAPI *CM_Register_NotificationFunc)(PCM_NOTIFY_FILTER pFilter, PVOID pContext, PCM_NOTIFY_CALLBACK pCallback, PHCMNOTIFICATION pNotifyContext); | ||
| 168 | typedef DWORD (WINAPI *CM_Unregister_NotificationFunc)(HCMNOTIFICATION NotifyContext); | ||
| 169 | |||
| 170 | static GUID GUID_DEVINTERFACE_HID = { 0x4D1E55B2L, 0xF16F, 0x11CF, { 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30 } }; | ||
| 171 | |||
| 172 | static int s_DeviceNotificationsRequested; | ||
| 173 | static HMODULE cfgmgr32_lib_handle; | ||
| 174 | static CM_Register_NotificationFunc CM_Register_Notification; | ||
| 175 | static CM_Unregister_NotificationFunc CM_Unregister_Notification; | ||
| 176 | static HCMNOTIFICATION s_DeviceNotificationFuncHandle; | ||
| 177 | static Uint64 s_LastDeviceNotification = 1; | ||
| 178 | |||
| 179 | static DWORD CALLBACK SDL_DeviceNotificationFunc(HCMNOTIFICATION hNotify, PVOID context, CM_NOTIFY_ACTION action, PCM_NOTIFY_EVENT_DATA eventData, DWORD event_data_size) | ||
| 180 | { | ||
| 181 | if (action == CM_NOTIFY_ACTION_DEVICEINTERFACEARRIVAL || | ||
| 182 | action == CM_NOTIFY_ACTION_DEVICEINTERFACEREMOVAL) { | ||
| 183 | s_LastDeviceNotification = SDL_GetTicksNS(); | ||
| 184 | } | ||
| 185 | return ERROR_SUCCESS; | ||
| 186 | } | ||
| 187 | |||
| 188 | void WIN_InitDeviceNotification(void) | ||
| 189 | { | ||
| 190 | ++s_DeviceNotificationsRequested; | ||
| 191 | if (s_DeviceNotificationsRequested > 1) { | ||
| 192 | return; | ||
| 193 | } | ||
| 194 | |||
| 195 | cfgmgr32_lib_handle = LoadLibraryA("cfgmgr32.dll"); | ||
| 196 | if (cfgmgr32_lib_handle) { | ||
| 197 | CM_Register_Notification = (CM_Register_NotificationFunc)GetProcAddress(cfgmgr32_lib_handle, "CM_Register_Notification"); | ||
| 198 | CM_Unregister_Notification = (CM_Unregister_NotificationFunc)GetProcAddress(cfgmgr32_lib_handle, "CM_Unregister_Notification"); | ||
| 199 | if (CM_Register_Notification && CM_Unregister_Notification) { | ||
| 200 | CM_NOTIFY_FILTER notify_filter; | ||
| 201 | |||
| 202 | SDL_zero(notify_filter); | ||
| 203 | notify_filter.cbSize = sizeof(notify_filter); | ||
| 204 | notify_filter.FilterType = CM_NOTIFY_FILTER_TYPE_DEVICEINTERFACE; | ||
| 205 | notify_filter.u.DeviceInterface.ClassGuid = GUID_DEVINTERFACE_HID; | ||
| 206 | if (CM_Register_Notification(¬ify_filter, NULL, SDL_DeviceNotificationFunc, &s_DeviceNotificationFuncHandle) == CR_SUCCESS) { | ||
| 207 | return; | ||
| 208 | } | ||
| 209 | } | ||
| 210 | } | ||
| 211 | |||
| 212 | // FIXME: Should we log errors? | ||
| 213 | } | ||
| 214 | |||
| 215 | Uint64 WIN_GetLastDeviceNotification(void) | ||
| 216 | { | ||
| 217 | return s_LastDeviceNotification; | ||
| 218 | } | ||
| 219 | |||
| 220 | void WIN_QuitDeviceNotification(void) | ||
| 221 | { | ||
| 222 | if (--s_DeviceNotificationsRequested > 0) { | ||
| 223 | return; | ||
| 224 | } | ||
| 225 | // Make sure we have balanced calls to init/quit | ||
| 226 | SDL_assert(s_DeviceNotificationsRequested == 0); | ||
| 227 | |||
| 228 | if (cfgmgr32_lib_handle) { | ||
| 229 | if (s_DeviceNotificationFuncHandle && CM_Unregister_Notification) { | ||
| 230 | CM_Unregister_Notification(s_DeviceNotificationFuncHandle); | ||
| 231 | s_DeviceNotificationFuncHandle = NULL; | ||
| 232 | } | ||
| 233 | |||
| 234 | FreeLibrary(cfgmgr32_lib_handle); | ||
| 235 | cfgmgr32_lib_handle = NULL; | ||
| 236 | } | ||
| 237 | } | ||
| 238 | |||
| 239 | #else | ||
| 240 | |||
| 241 | void WIN_InitDeviceNotification(void) | ||
| 242 | { | ||
| 243 | } | ||
| 244 | |||
| 245 | Uint64 WIN_GetLastDeviceNotification( void ) | ||
| 246 | { | ||
| 247 | return 0; | ||
| 248 | } | ||
| 249 | |||
| 250 | void WIN_QuitDeviceNotification(void) | ||
| 251 | { | ||
| 252 | } | ||
| 253 | |||
| 254 | #endif // !SDL_PLATFORM_XBOXONE && !SDL_PLATFORM_XBOXSERIES | ||
diff --git a/contrib/SDL-3.2.8/src/core/windows/SDL_hid.h b/contrib/SDL-3.2.8/src/core/windows/SDL_hid.h new file mode 100644 index 0000000..46c22f2 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/windows/SDL_hid.h | |||
| @@ -0,0 +1,215 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifndef SDL_hid_h_ | ||
| 24 | #define SDL_hid_h_ | ||
| 25 | |||
| 26 | #include "SDL_windows.h" | ||
| 27 | |||
| 28 | typedef LONG NTSTATUS; | ||
| 29 | typedef USHORT USAGE; | ||
| 30 | typedef struct _HIDP_PREPARSED_DATA *PHIDP_PREPARSED_DATA; | ||
| 31 | |||
| 32 | typedef struct _HIDD_ATTRIBUTES | ||
| 33 | { | ||
| 34 | ULONG Size; | ||
| 35 | USHORT VendorID; | ||
| 36 | USHORT ProductID; | ||
| 37 | USHORT VersionNumber; | ||
| 38 | } HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES; | ||
| 39 | |||
| 40 | typedef enum | ||
| 41 | { | ||
| 42 | HidP_Input = 0, | ||
| 43 | HidP_Output = 1, | ||
| 44 | HidP_Feature = 2 | ||
| 45 | } HIDP_REPORT_TYPE; | ||
| 46 | |||
| 47 | typedef struct | ||
| 48 | { | ||
| 49 | USAGE UsagePage; | ||
| 50 | UCHAR ReportID; | ||
| 51 | BOOLEAN IsAlias; | ||
| 52 | USHORT BitField; | ||
| 53 | USHORT LinkCollection; | ||
| 54 | USAGE LinkUsage; | ||
| 55 | USAGE LinkUsagePage; | ||
| 56 | BOOLEAN IsRange; | ||
| 57 | BOOLEAN IsStringRange; | ||
| 58 | BOOLEAN IsDesignatorRange; | ||
| 59 | BOOLEAN IsAbsolute; | ||
| 60 | ULONG Reserved[10]; | ||
| 61 | union | ||
| 62 | { | ||
| 63 | struct | ||
| 64 | { | ||
| 65 | USAGE UsageMin; | ||
| 66 | USAGE UsageMax; | ||
| 67 | USHORT StringMin; | ||
| 68 | USHORT StringMax; | ||
| 69 | USHORT DesignatorMin; | ||
| 70 | USHORT DesignatorMax; | ||
| 71 | USHORT DataIndexMin; | ||
| 72 | USHORT DataIndexMax; | ||
| 73 | } Range; | ||
| 74 | struct | ||
| 75 | { | ||
| 76 | USAGE Usage; | ||
| 77 | USAGE Reserved1; | ||
| 78 | USHORT StringIndex; | ||
| 79 | USHORT Reserved2; | ||
| 80 | USHORT DesignatorIndex; | ||
| 81 | USHORT Reserved3; | ||
| 82 | USHORT DataIndex; | ||
| 83 | USHORT Reserved4; | ||
| 84 | } NotRange; | ||
| 85 | }; | ||
| 86 | } HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS; | ||
| 87 | |||
| 88 | typedef struct | ||
| 89 | { | ||
| 90 | USAGE UsagePage; | ||
| 91 | UCHAR ReportID; | ||
| 92 | BOOLEAN IsAlias; | ||
| 93 | USHORT BitField; | ||
| 94 | USHORT LinkCollection; | ||
| 95 | USAGE LinkUsage; | ||
| 96 | USAGE LinkUsagePage; | ||
| 97 | BOOLEAN IsRange; | ||
| 98 | BOOLEAN IsStringRange; | ||
| 99 | BOOLEAN IsDesignatorRange; | ||
| 100 | BOOLEAN IsAbsolute; | ||
| 101 | BOOLEAN HasNull; | ||
| 102 | UCHAR Reserved; | ||
| 103 | USHORT BitSize; | ||
| 104 | USHORT ReportCount; | ||
| 105 | USHORT Reserved2[5]; | ||
| 106 | ULONG UnitsExp; | ||
| 107 | ULONG Units; | ||
| 108 | LONG LogicalMin; | ||
| 109 | LONG LogicalMax; | ||
| 110 | LONG PhysicalMin; | ||
| 111 | LONG PhysicalMax; | ||
| 112 | union | ||
| 113 | { | ||
| 114 | struct | ||
| 115 | { | ||
| 116 | USAGE UsageMin; | ||
| 117 | USAGE UsageMax; | ||
| 118 | USHORT StringMin; | ||
| 119 | USHORT StringMax; | ||
| 120 | USHORT DesignatorMin; | ||
| 121 | USHORT DesignatorMax; | ||
| 122 | USHORT DataIndexMin; | ||
| 123 | USHORT DataIndexMax; | ||
| 124 | } Range; | ||
| 125 | struct | ||
| 126 | { | ||
| 127 | USAGE Usage; | ||
| 128 | USAGE Reserved1; | ||
| 129 | USHORT StringIndex; | ||
| 130 | USHORT Reserved2; | ||
| 131 | USHORT DesignatorIndex; | ||
| 132 | USHORT Reserved3; | ||
| 133 | USHORT DataIndex; | ||
| 134 | USHORT Reserved4; | ||
| 135 | } NotRange; | ||
| 136 | }; | ||
| 137 | } HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS; | ||
| 138 | |||
| 139 | typedef struct | ||
| 140 | { | ||
| 141 | USAGE Usage; | ||
| 142 | USAGE UsagePage; | ||
| 143 | USHORT InputReportByteLength; | ||
| 144 | USHORT OutputReportByteLength; | ||
| 145 | USHORT FeatureReportByteLength; | ||
| 146 | USHORT Reserved[17]; | ||
| 147 | USHORT NumberLinkCollectionNodes; | ||
| 148 | USHORT NumberInputButtonCaps; | ||
| 149 | USHORT NumberInputValueCaps; | ||
| 150 | USHORT NumberInputDataIndices; | ||
| 151 | USHORT NumberOutputButtonCaps; | ||
| 152 | USHORT NumberOutputValueCaps; | ||
| 153 | USHORT NumberOutputDataIndices; | ||
| 154 | USHORT NumberFeatureButtonCaps; | ||
| 155 | USHORT NumberFeatureValueCaps; | ||
| 156 | USHORT NumberFeatureDataIndices; | ||
| 157 | } HIDP_CAPS, *PHIDP_CAPS; | ||
| 158 | |||
| 159 | typedef struct | ||
| 160 | { | ||
| 161 | USHORT DataIndex; | ||
| 162 | USHORT Reserved; | ||
| 163 | union | ||
| 164 | { | ||
| 165 | ULONG RawValue; | ||
| 166 | BOOLEAN On; | ||
| 167 | }; | ||
| 168 | } HIDP_DATA, *PHIDP_DATA; | ||
| 169 | |||
| 170 | #define HIDP_ERROR_CODES(p1, p2) ((NTSTATUS)(((p1) << 28) | (0x11 << 16) | (p2))) | ||
| 171 | #define HIDP_STATUS_SUCCESS HIDP_ERROR_CODES(0x0, 0x0000) | ||
| 172 | #define HIDP_STATUS_NULL HIDP_ERROR_CODES(0x8, 0x0001) | ||
| 173 | #define HIDP_STATUS_INVALID_PREPARSED_DATA HIDP_ERROR_CODES(0xC, 0x0001) | ||
| 174 | #define HIDP_STATUS_INVALID_REPORT_TYPE HIDP_ERROR_CODES(0xC, 0x0002) | ||
| 175 | #define HIDP_STATUS_INVALID_REPORT_LENGTH HIDP_ERROR_CODES(0xC, 0x0003) | ||
| 176 | #define HIDP_STATUS_USAGE_NOT_FOUND HIDP_ERROR_CODES(0xC, 0x0004) | ||
| 177 | #define HIDP_STATUS_VALUE_OUT_OF_RANGE HIDP_ERROR_CODES(0xC, 0x0005) | ||
| 178 | #define HIDP_STATUS_BAD_LOG_PHY_VALUES HIDP_ERROR_CODES(0xC, 0x0006) | ||
| 179 | #define HIDP_STATUS_BUFFER_TOO_SMALL HIDP_ERROR_CODES(0xC, 0x0007) | ||
| 180 | #define HIDP_STATUS_INTERNAL_ERROR HIDP_ERROR_CODES(0xC, 0x0008) | ||
| 181 | #define HIDP_STATUS_I8042_TRANS_UNKNOWN HIDP_ERROR_CODES(0xC, 0x0009) | ||
| 182 | #define HIDP_STATUS_INCOMPATIBLE_REPORT_ID HIDP_ERROR_CODES(0xC, 0x000A) | ||
| 183 | #define HIDP_STATUS_NOT_VALUE_ARRAY HIDP_ERROR_CODES(0xC, 0x000B) | ||
| 184 | #define HIDP_STATUS_IS_VALUE_ARRAY HIDP_ERROR_CODES(0xC, 0x000C) | ||
| 185 | #define HIDP_STATUS_DATA_INDEX_NOT_FOUND HIDP_ERROR_CODES(0xC, 0x000D) | ||
| 186 | #define HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE HIDP_ERROR_CODES(0xC, 0x000E) | ||
| 187 | #define HIDP_STATUS_BUTTON_NOT_PRESSED HIDP_ERROR_CODES(0xC, 0x000F) | ||
| 188 | #define HIDP_STATUS_REPORT_DOES_NOT_EXIST HIDP_ERROR_CODES(0xC, 0x0010) | ||
| 189 | #define HIDP_STATUS_NOT_IMPLEMENTED HIDP_ERROR_CODES(0xC, 0x0020) | ||
| 190 | |||
| 191 | extern bool WIN_LoadHIDDLL(void); | ||
| 192 | extern void WIN_UnloadHIDDLL(void); | ||
| 193 | |||
| 194 | typedef BOOLEAN (WINAPI *HidD_GetAttributes_t)(HANDLE HidDeviceObject, PHIDD_ATTRIBUTES Attributes); | ||
| 195 | typedef BOOLEAN (WINAPI *HidD_GetString_t)(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength); | ||
| 196 | typedef NTSTATUS (WINAPI *HidP_GetCaps_t)(PHIDP_PREPARSED_DATA PreparsedData, PHIDP_CAPS Capabilities); | ||
| 197 | typedef NTSTATUS (WINAPI *HidP_GetButtonCaps_t)(HIDP_REPORT_TYPE ReportType, PHIDP_BUTTON_CAPS ButtonCaps, PUSHORT ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData); | ||
| 198 | typedef NTSTATUS (WINAPI *HidP_GetValueCaps_t)(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS ValueCaps, PUSHORT ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData); | ||
| 199 | typedef ULONG (WINAPI *HidP_MaxDataListLength_t)(HIDP_REPORT_TYPE ReportType, PHIDP_PREPARSED_DATA PreparsedData); | ||
| 200 | typedef NTSTATUS (WINAPI *HidP_GetData_t)(HIDP_REPORT_TYPE ReportType, PHIDP_DATA DataList, PULONG DataLength, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength); | ||
| 201 | |||
| 202 | extern HidD_GetAttributes_t SDL_HidD_GetAttributes; | ||
| 203 | extern HidD_GetString_t SDL_HidD_GetManufacturerString; | ||
| 204 | extern HidD_GetString_t SDL_HidD_GetProductString; | ||
| 205 | extern HidP_GetCaps_t SDL_HidP_GetCaps; | ||
| 206 | extern HidP_GetButtonCaps_t SDL_HidP_GetButtonCaps; | ||
| 207 | extern HidP_GetValueCaps_t SDL_HidP_GetValueCaps; | ||
| 208 | extern HidP_MaxDataListLength_t SDL_HidP_MaxDataListLength; | ||
| 209 | extern HidP_GetData_t SDL_HidP_GetData; | ||
| 210 | |||
| 211 | void WIN_InitDeviceNotification(void); | ||
| 212 | Uint64 WIN_GetLastDeviceNotification(void); | ||
| 213 | void WIN_QuitDeviceNotification(void); | ||
| 214 | |||
| 215 | #endif // SDL_hid_h_ | ||
diff --git a/contrib/SDL-3.2.8/src/core/windows/SDL_immdevice.c b/contrib/SDL-3.2.8/src/core/windows/SDL_immdevice.c new file mode 100644 index 0000000..802a412 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/windows/SDL_immdevice.c | |||
| @@ -0,0 +1,434 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #if defined(SDL_PLATFORM_WINDOWS) && defined(HAVE_MMDEVICEAPI_H) | ||
| 24 | |||
| 25 | #include "SDL_windows.h" | ||
| 26 | #include "SDL_immdevice.h" | ||
| 27 | #include "../../audio/SDL_sysaudio.h" | ||
| 28 | #include <objbase.h> // For CLSIDFromString | ||
| 29 | |||
| 30 | typedef struct SDL_IMMDevice_HandleData | ||
| 31 | { | ||
| 32 | LPWSTR immdevice_id; | ||
| 33 | GUID directsound_guid; | ||
| 34 | } SDL_IMMDevice_HandleData; | ||
| 35 | |||
| 36 | static const ERole SDL_IMMDevice_role = eConsole; // !!! FIXME: should this be eMultimedia? Should be a hint? | ||
| 37 | |||
| 38 | // This is global to the WASAPI target, to handle hotplug and default device lookup. | ||
| 39 | static IMMDeviceEnumerator *enumerator = NULL; | ||
| 40 | static SDL_IMMDevice_callbacks immcallbacks; | ||
| 41 | |||
| 42 | // PropVariantInit() is an inline function/macro in PropIdl.h that calls the C runtime's memset() directly. Use ours instead, to avoid dependency. | ||
| 43 | #ifdef PropVariantInit | ||
| 44 | #undef PropVariantInit | ||
| 45 | #endif | ||
| 46 | #define PropVariantInit(p) SDL_zerop(p) | ||
| 47 | |||
| 48 | // Some GUIDs we need to know without linking to libraries that aren't available before Vista. | ||
| 49 | /* *INDENT-OFF* */ // clang-format off | ||
| 50 | static const CLSID SDL_CLSID_MMDeviceEnumerator = { 0xbcde0395, 0xe52f, 0x467c,{ 0x8e, 0x3d, 0xc4, 0x57, 0x92, 0x91, 0x69, 0x2e } }; | ||
| 51 | static const IID SDL_IID_IMMDeviceEnumerator = { 0xa95664d2, 0x9614, 0x4f35,{ 0xa7, 0x46, 0xde, 0x8d, 0xb6, 0x36, 0x17, 0xe6 } }; | ||
| 52 | static const IID SDL_IID_IMMNotificationClient = { 0x7991eec9, 0x7e89, 0x4d85,{ 0x83, 0x90, 0x6c, 0x70, 0x3c, 0xec, 0x60, 0xc0 } }; | ||
| 53 | static const IID SDL_IID_IMMEndpoint = { 0x1be09788, 0x6894, 0x4089,{ 0x85, 0x86, 0x9a, 0x2a, 0x6c, 0x26, 0x5a, 0xc5 } }; | ||
| 54 | static const PROPERTYKEY SDL_PKEY_Device_FriendlyName = { { 0xa45c254e, 0xdf1c, 0x4efd,{ 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, } }, 14 }; | ||
| 55 | static const PROPERTYKEY SDL_PKEY_AudioEngine_DeviceFormat = { { 0xf19f064d, 0x82c, 0x4e27,{ 0xbc, 0x73, 0x68, 0x82, 0xa1, 0xbb, 0x8e, 0x4c, } }, 0 }; | ||
| 56 | static const PROPERTYKEY SDL_PKEY_AudioEndpoint_GUID = { { 0x1da5d803, 0xd492, 0x4edd,{ 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, } }, 4 }; | ||
| 57 | /* *INDENT-ON* */ // clang-format on | ||
| 58 | |||
| 59 | static bool FindByDevIDCallback(SDL_AudioDevice *device, void *userdata) | ||
| 60 | { | ||
| 61 | LPCWSTR devid = (LPCWSTR)userdata; | ||
| 62 | if (devid && device && device->handle) { | ||
| 63 | const SDL_IMMDevice_HandleData *handle = (const SDL_IMMDevice_HandleData *)device->handle; | ||
| 64 | if (handle->immdevice_id && SDL_wcscmp(handle->immdevice_id, devid) == 0) { | ||
| 65 | return true; | ||
| 66 | } | ||
| 67 | } | ||
| 68 | return false; | ||
| 69 | } | ||
| 70 | |||
| 71 | static SDL_AudioDevice *SDL_IMMDevice_FindByDevID(LPCWSTR devid) | ||
| 72 | { | ||
| 73 | return SDL_FindPhysicalAudioDeviceByCallback(FindByDevIDCallback, (void *) devid); | ||
| 74 | } | ||
| 75 | |||
| 76 | LPGUID SDL_IMMDevice_GetDirectSoundGUID(SDL_AudioDevice *device) | ||
| 77 | { | ||
| 78 | return (device && device->handle) ? &(((SDL_IMMDevice_HandleData *) device->handle)->directsound_guid) : NULL; | ||
| 79 | } | ||
| 80 | |||
| 81 | LPCWSTR SDL_IMMDevice_GetDevID(SDL_AudioDevice *device) | ||
| 82 | { | ||
| 83 | return (device && device->handle) ? ((const SDL_IMMDevice_HandleData *) device->handle)->immdevice_id : NULL; | ||
| 84 | } | ||
| 85 | |||
| 86 | static void GetMMDeviceInfo(IMMDevice *device, char **utf8dev, WAVEFORMATEXTENSIBLE *fmt, GUID *guid) | ||
| 87 | { | ||
| 88 | /* PKEY_Device_FriendlyName gives you "Speakers (SoundBlaster Pro)" which drives me nuts. I'd rather it be | ||
| 89 | "SoundBlaster Pro (Speakers)" but I guess that's developers vs users. Windows uses the FriendlyName in | ||
| 90 | its own UIs, like Volume Control, etc. */ | ||
| 91 | IPropertyStore *props = NULL; | ||
| 92 | *utf8dev = NULL; | ||
| 93 | SDL_zerop(fmt); | ||
| 94 | if (SUCCEEDED(IMMDevice_OpenPropertyStore(device, STGM_READ, &props))) { | ||
| 95 | PROPVARIANT var; | ||
| 96 | PropVariantInit(&var); | ||
| 97 | if (SUCCEEDED(IPropertyStore_GetValue(props, &SDL_PKEY_Device_FriendlyName, &var))) { | ||
| 98 | *utf8dev = WIN_StringToUTF8W(var.pwszVal); | ||
| 99 | } | ||
| 100 | PropVariantClear(&var); | ||
| 101 | if (SUCCEEDED(IPropertyStore_GetValue(props, &SDL_PKEY_AudioEngine_DeviceFormat, &var))) { | ||
| 102 | SDL_memcpy(fmt, var.blob.pBlobData, SDL_min(var.blob.cbSize, sizeof(WAVEFORMATEXTENSIBLE))); | ||
| 103 | } | ||
| 104 | PropVariantClear(&var); | ||
| 105 | if (SUCCEEDED(IPropertyStore_GetValue(props, &SDL_PKEY_AudioEndpoint_GUID, &var))) { | ||
| 106 | (void)CLSIDFromString(var.pwszVal, guid); | ||
| 107 | } | ||
| 108 | PropVariantClear(&var); | ||
| 109 | IPropertyStore_Release(props); | ||
| 110 | } | ||
| 111 | } | ||
| 112 | |||
| 113 | void SDL_IMMDevice_FreeDeviceHandle(SDL_AudioDevice *device) | ||
| 114 | { | ||
| 115 | if (device && device->handle) { | ||
| 116 | SDL_IMMDevice_HandleData *handle = (SDL_IMMDevice_HandleData *) device->handle; | ||
| 117 | SDL_free(handle->immdevice_id); | ||
| 118 | SDL_free(handle); | ||
| 119 | device->handle = NULL; | ||
| 120 | } | ||
| 121 | } | ||
| 122 | |||
| 123 | static SDL_AudioDevice *SDL_IMMDevice_Add(const bool recording, const char *devname, WAVEFORMATEXTENSIBLE *fmt, LPCWSTR devid, GUID *dsoundguid) | ||
| 124 | { | ||
| 125 | /* You can have multiple endpoints on a device that are mutually exclusive ("Speakers" vs "Line Out" or whatever). | ||
| 126 | In a perfect world, things that are unplugged won't be in this collection. The only gotcha is probably for | ||
| 127 | phones and tablets, where you might have an internal speaker and a headphone jack and expect both to be | ||
| 128 | available and switch automatically. (!!! FIXME...?) */ | ||
| 129 | |||
| 130 | if (!devname) { | ||
| 131 | return NULL; | ||
| 132 | } | ||
| 133 | |||
| 134 | // see if we already have this one first. | ||
| 135 | SDL_AudioDevice *device = SDL_IMMDevice_FindByDevID(devid); | ||
| 136 | if (device) { | ||
| 137 | if (SDL_GetAtomicInt(&device->zombie)) { | ||
| 138 | // whoa, it came back! This can happen if you unplug and replug USB headphones while we're still keeping the SDL object alive. | ||
| 139 | // Kill this device's IMMDevice id; the device will go away when the app closes it, or maybe a new default device is chosen | ||
| 140 | // (possibly this reconnected device), so we just want to make sure IMMDevice doesn't try to find the old device by the existing ID string. | ||
| 141 | SDL_IMMDevice_HandleData *handle = (SDL_IMMDevice_HandleData *) device->handle; | ||
| 142 | SDL_free(handle->immdevice_id); | ||
| 143 | handle->immdevice_id = NULL; | ||
| 144 | device = NULL; // add a new device, below. | ||
| 145 | } | ||
| 146 | } | ||
| 147 | |||
| 148 | if (!device) { | ||
| 149 | // handle is freed by SDL_IMMDevice_FreeDeviceHandle! | ||
| 150 | SDL_IMMDevice_HandleData *handle = (SDL_IMMDevice_HandleData *)SDL_malloc(sizeof(SDL_IMMDevice_HandleData)); | ||
| 151 | if (!handle) { | ||
| 152 | return NULL; | ||
| 153 | } | ||
| 154 | handle->immdevice_id = SDL_wcsdup(devid); | ||
| 155 | if (!handle->immdevice_id) { | ||
| 156 | SDL_free(handle); | ||
| 157 | return NULL; | ||
| 158 | } | ||
| 159 | SDL_memcpy(&handle->directsound_guid, dsoundguid, sizeof(GUID)); | ||
| 160 | |||
| 161 | SDL_AudioSpec spec; | ||
| 162 | SDL_zero(spec); | ||
| 163 | spec.channels = (Uint8)fmt->Format.nChannels; | ||
| 164 | spec.freq = fmt->Format.nSamplesPerSec; | ||
| 165 | spec.format = SDL_WaveFormatExToSDLFormat((WAVEFORMATEX *)fmt); | ||
| 166 | |||
| 167 | device = SDL_AddAudioDevice(recording, devname, &spec, handle); | ||
| 168 | if (!device) { | ||
| 169 | SDL_free(handle->immdevice_id); | ||
| 170 | SDL_free(handle); | ||
| 171 | } | ||
| 172 | } | ||
| 173 | |||
| 174 | return device; | ||
| 175 | } | ||
| 176 | |||
| 177 | /* We need a COM subclass of IMMNotificationClient for hotplug support, which is | ||
| 178 | easy in C++, but we have to tapdance more to make work in C. | ||
| 179 | Thanks to this page for coaching on how to make this work: | ||
| 180 | https://www.codeproject.com/Articles/13601/COM-in-plain-C */ | ||
| 181 | |||
| 182 | typedef struct SDLMMNotificationClient | ||
| 183 | { | ||
| 184 | const IMMNotificationClientVtbl *lpVtbl; | ||
| 185 | SDL_AtomicInt refcount; | ||
| 186 | } SDLMMNotificationClient; | ||
| 187 | |||
| 188 | static HRESULT STDMETHODCALLTYPE SDLMMNotificationClient_QueryInterface(IMMNotificationClient *client, REFIID iid, void **ppv) | ||
| 189 | { | ||
| 190 | if ((WIN_IsEqualIID(iid, &IID_IUnknown)) || (WIN_IsEqualIID(iid, &SDL_IID_IMMNotificationClient))) { | ||
| 191 | *ppv = client; | ||
| 192 | client->lpVtbl->AddRef(client); | ||
| 193 | return S_OK; | ||
| 194 | } | ||
| 195 | |||
| 196 | *ppv = NULL; | ||
| 197 | return E_NOINTERFACE; | ||
| 198 | } | ||
| 199 | |||
| 200 | static ULONG STDMETHODCALLTYPE SDLMMNotificationClient_AddRef(IMMNotificationClient *iclient) | ||
| 201 | { | ||
| 202 | SDLMMNotificationClient *client = (SDLMMNotificationClient *)iclient; | ||
| 203 | return (ULONG)(SDL_AtomicIncRef(&client->refcount) + 1); | ||
| 204 | } | ||
| 205 | |||
| 206 | static ULONG STDMETHODCALLTYPE SDLMMNotificationClient_Release(IMMNotificationClient *iclient) | ||
| 207 | { | ||
| 208 | // client is a static object; we don't ever free it. | ||
| 209 | SDLMMNotificationClient *client = (SDLMMNotificationClient *)iclient; | ||
| 210 | const ULONG rc = SDL_AtomicDecRef(&client->refcount); | ||
| 211 | if (rc == 0) { | ||
| 212 | SDL_SetAtomicInt(&client->refcount, 0); // uhh... | ||
| 213 | return 0; | ||
| 214 | } | ||
| 215 | return rc - 1; | ||
| 216 | } | ||
| 217 | |||
| 218 | // These are the entry points called when WASAPI device endpoints change. | ||
| 219 | static HRESULT STDMETHODCALLTYPE SDLMMNotificationClient_OnDefaultDeviceChanged(IMMNotificationClient *iclient, EDataFlow flow, ERole role, LPCWSTR pwstrDeviceId) | ||
| 220 | { | ||
| 221 | if (role == SDL_IMMDevice_role) { | ||
| 222 | immcallbacks.default_audio_device_changed(SDL_IMMDevice_FindByDevID(pwstrDeviceId)); | ||
| 223 | } | ||
| 224 | return S_OK; | ||
| 225 | } | ||
| 226 | |||
| 227 | static HRESULT STDMETHODCALLTYPE SDLMMNotificationClient_OnDeviceAdded(IMMNotificationClient *iclient, LPCWSTR pwstrDeviceId) | ||
| 228 | { | ||
| 229 | /* we ignore this; devices added here then progress to ACTIVE, if appropriate, in | ||
| 230 | OnDeviceStateChange, making that a better place to deal with device adds. More | ||
| 231 | importantly: the first time you plug in a USB audio device, this callback will | ||
| 232 | fire, but when you unplug it, it isn't removed (it's state changes to NOTPRESENT). | ||
| 233 | Plugging it back in won't fire this callback again. */ | ||
| 234 | return S_OK; | ||
| 235 | } | ||
| 236 | |||
| 237 | static HRESULT STDMETHODCALLTYPE SDLMMNotificationClient_OnDeviceRemoved(IMMNotificationClient *iclient, LPCWSTR pwstrDeviceId) | ||
| 238 | { | ||
| 239 | return S_OK; // See notes in OnDeviceAdded handler about why we ignore this. | ||
| 240 | } | ||
| 241 | |||
| 242 | static HRESULT STDMETHODCALLTYPE SDLMMNotificationClient_OnDeviceStateChanged(IMMNotificationClient *iclient, LPCWSTR pwstrDeviceId, DWORD dwNewState) | ||
| 243 | { | ||
| 244 | IMMDevice *device = NULL; | ||
| 245 | |||
| 246 | if (SUCCEEDED(IMMDeviceEnumerator_GetDevice(enumerator, pwstrDeviceId, &device))) { | ||
| 247 | IMMEndpoint *endpoint = NULL; | ||
| 248 | if (SUCCEEDED(IMMDevice_QueryInterface(device, &SDL_IID_IMMEndpoint, (void **)&endpoint))) { | ||
| 249 | EDataFlow flow; | ||
| 250 | if (SUCCEEDED(IMMEndpoint_GetDataFlow(endpoint, &flow))) { | ||
| 251 | const bool recording = (flow == eCapture); | ||
| 252 | if (dwNewState == DEVICE_STATE_ACTIVE) { | ||
| 253 | char *utf8dev; | ||
| 254 | WAVEFORMATEXTENSIBLE fmt; | ||
| 255 | GUID dsoundguid; | ||
| 256 | GetMMDeviceInfo(device, &utf8dev, &fmt, &dsoundguid); | ||
| 257 | if (utf8dev) { | ||
| 258 | SDL_IMMDevice_Add(recording, utf8dev, &fmt, pwstrDeviceId, &dsoundguid); | ||
| 259 | SDL_free(utf8dev); | ||
| 260 | } | ||
| 261 | } else { | ||
| 262 | immcallbacks.audio_device_disconnected(SDL_IMMDevice_FindByDevID(pwstrDeviceId)); | ||
| 263 | } | ||
| 264 | } | ||
| 265 | IMMEndpoint_Release(endpoint); | ||
| 266 | } | ||
| 267 | IMMDevice_Release(device); | ||
| 268 | } | ||
| 269 | |||
| 270 | return S_OK; | ||
| 271 | } | ||
| 272 | |||
| 273 | static HRESULT STDMETHODCALLTYPE SDLMMNotificationClient_OnPropertyValueChanged(IMMNotificationClient *client, LPCWSTR pwstrDeviceId, const PROPERTYKEY key) | ||
| 274 | { | ||
| 275 | return S_OK; // we don't care about these. | ||
| 276 | } | ||
| 277 | |||
| 278 | static const IMMNotificationClientVtbl notification_client_vtbl = { | ||
| 279 | SDLMMNotificationClient_QueryInterface, | ||
| 280 | SDLMMNotificationClient_AddRef, | ||
| 281 | SDLMMNotificationClient_Release, | ||
| 282 | SDLMMNotificationClient_OnDeviceStateChanged, | ||
| 283 | SDLMMNotificationClient_OnDeviceAdded, | ||
| 284 | SDLMMNotificationClient_OnDeviceRemoved, | ||
| 285 | SDLMMNotificationClient_OnDefaultDeviceChanged, | ||
| 286 | SDLMMNotificationClient_OnPropertyValueChanged | ||
| 287 | }; | ||
| 288 | |||
| 289 | static SDLMMNotificationClient notification_client = { ¬ification_client_vtbl, { 1 } }; | ||
| 290 | |||
| 291 | bool SDL_IMMDevice_Init(const SDL_IMMDevice_callbacks *callbacks) | ||
| 292 | { | ||
| 293 | HRESULT ret; | ||
| 294 | |||
| 295 | // just skip the discussion with COM here. | ||
| 296 | if (!WIN_IsWindowsVistaOrGreater()) { | ||
| 297 | return SDL_SetError("IMMDevice support requires Windows Vista or later"); | ||
| 298 | } | ||
| 299 | |||
| 300 | if (FAILED(WIN_CoInitialize())) { | ||
| 301 | return SDL_SetError("IMMDevice: CoInitialize() failed"); | ||
| 302 | } | ||
| 303 | |||
| 304 | ret = CoCreateInstance(&SDL_CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &SDL_IID_IMMDeviceEnumerator, (LPVOID *)&enumerator); | ||
| 305 | if (FAILED(ret)) { | ||
| 306 | WIN_CoUninitialize(); | ||
| 307 | return WIN_SetErrorFromHRESULT("IMMDevice CoCreateInstance(MMDeviceEnumerator)", ret); | ||
| 308 | } | ||
| 309 | |||
| 310 | if (callbacks) { | ||
| 311 | SDL_copyp(&immcallbacks, callbacks); | ||
| 312 | } else { | ||
| 313 | SDL_zero(immcallbacks); | ||
| 314 | } | ||
| 315 | |||
| 316 | if (!immcallbacks.audio_device_disconnected) { | ||
| 317 | immcallbacks.audio_device_disconnected = SDL_AudioDeviceDisconnected; | ||
| 318 | } | ||
| 319 | if (!immcallbacks.default_audio_device_changed) { | ||
| 320 | immcallbacks.default_audio_device_changed = SDL_DefaultAudioDeviceChanged; | ||
| 321 | } | ||
| 322 | |||
| 323 | return true; | ||
| 324 | } | ||
| 325 | |||
| 326 | void SDL_IMMDevice_Quit(void) | ||
| 327 | { | ||
| 328 | if (enumerator) { | ||
| 329 | IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(enumerator, (IMMNotificationClient *)¬ification_client); | ||
| 330 | IMMDeviceEnumerator_Release(enumerator); | ||
| 331 | enumerator = NULL; | ||
| 332 | } | ||
| 333 | |||
| 334 | SDL_zero(immcallbacks); | ||
| 335 | |||
| 336 | WIN_CoUninitialize(); | ||
| 337 | } | ||
| 338 | |||
| 339 | bool SDL_IMMDevice_Get(SDL_AudioDevice *device, IMMDevice **immdevice, bool recording) | ||
| 340 | { | ||
| 341 | const Uint64 timeout = SDL_GetTicks() + 8000; // intel's audio drivers can fail for up to EIGHT SECONDS after a device is connected or we wake from sleep. | ||
| 342 | |||
| 343 | SDL_assert(device != NULL); | ||
| 344 | SDL_assert(immdevice != NULL); | ||
| 345 | |||
| 346 | LPCWSTR devid = SDL_IMMDevice_GetDevID(device); | ||
| 347 | SDL_assert(devid != NULL); | ||
| 348 | |||
| 349 | HRESULT ret; | ||
| 350 | while ((ret = IMMDeviceEnumerator_GetDevice(enumerator, devid, immdevice)) == E_NOTFOUND) { | ||
| 351 | const Uint64 now = SDL_GetTicks(); | ||
| 352 | if (timeout > now) { | ||
| 353 | const Uint64 ticksleft = timeout - now; | ||
| 354 | SDL_Delay((Uint32)SDL_min(ticksleft, 300)); // wait awhile and try again. | ||
| 355 | continue; | ||
| 356 | } | ||
| 357 | break; | ||
| 358 | } | ||
| 359 | |||
| 360 | if (!SUCCEEDED(ret)) { | ||
| 361 | return WIN_SetErrorFromHRESULT("WASAPI can't find requested audio endpoint", ret); | ||
| 362 | } | ||
| 363 | return true; | ||
| 364 | } | ||
| 365 | |||
| 366 | static void EnumerateEndpointsForFlow(const bool recording, SDL_AudioDevice **default_device) | ||
| 367 | { | ||
| 368 | /* Note that WASAPI separates "adapter devices" from "audio endpoint devices" | ||
| 369 | ...one adapter device ("SoundBlaster Pro") might have multiple endpoint devices ("Speakers", "Line-Out"). */ | ||
| 370 | |||
| 371 | IMMDeviceCollection *collection = NULL; | ||
| 372 | if (FAILED(IMMDeviceEnumerator_EnumAudioEndpoints(enumerator, recording ? eCapture : eRender, DEVICE_STATE_ACTIVE, &collection))) { | ||
| 373 | return; | ||
| 374 | } | ||
| 375 | |||
| 376 | UINT total = 0; | ||
| 377 | if (FAILED(IMMDeviceCollection_GetCount(collection, &total))) { | ||
| 378 | IMMDeviceCollection_Release(collection); | ||
| 379 | return; | ||
| 380 | } | ||
| 381 | |||
| 382 | LPWSTR default_devid = NULL; | ||
| 383 | if (default_device) { | ||
| 384 | IMMDevice *default_immdevice = NULL; | ||
| 385 | const EDataFlow dataflow = recording ? eCapture : eRender; | ||
| 386 | if (SUCCEEDED(IMMDeviceEnumerator_GetDefaultAudioEndpoint(enumerator, dataflow, SDL_IMMDevice_role, &default_immdevice))) { | ||
| 387 | LPWSTR devid = NULL; | ||
| 388 | if (SUCCEEDED(IMMDevice_GetId(default_immdevice, &devid))) { | ||
| 389 | default_devid = SDL_wcsdup(devid); // if this fails, oh well. | ||
| 390 | CoTaskMemFree(devid); | ||
| 391 | } | ||
| 392 | IMMDevice_Release(default_immdevice); | ||
| 393 | } | ||
| 394 | } | ||
| 395 | |||
| 396 | for (UINT i = 0; i < total; i++) { | ||
| 397 | IMMDevice *immdevice = NULL; | ||
| 398 | if (SUCCEEDED(IMMDeviceCollection_Item(collection, i, &immdevice))) { | ||
| 399 | LPWSTR devid = NULL; | ||
| 400 | if (SUCCEEDED(IMMDevice_GetId(immdevice, &devid))) { | ||
| 401 | char *devname = NULL; | ||
| 402 | WAVEFORMATEXTENSIBLE fmt; | ||
| 403 | GUID dsoundguid; | ||
| 404 | SDL_zero(fmt); | ||
| 405 | SDL_zero(dsoundguid); | ||
| 406 | GetMMDeviceInfo(immdevice, &devname, &fmt, &dsoundguid); | ||
| 407 | if (devname) { | ||
| 408 | SDL_AudioDevice *sdldevice = SDL_IMMDevice_Add(recording, devname, &fmt, devid, &dsoundguid); | ||
| 409 | if (default_device && default_devid && SDL_wcscmp(default_devid, devid) == 0) { | ||
| 410 | *default_device = sdldevice; | ||
| 411 | } | ||
| 412 | SDL_free(devname); | ||
| 413 | } | ||
| 414 | CoTaskMemFree(devid); | ||
| 415 | } | ||
| 416 | IMMDevice_Release(immdevice); | ||
| 417 | } | ||
| 418 | } | ||
| 419 | |||
| 420 | SDL_free(default_devid); | ||
| 421 | |||
| 422 | IMMDeviceCollection_Release(collection); | ||
| 423 | } | ||
| 424 | |||
| 425 | void SDL_IMMDevice_EnumerateEndpoints(SDL_AudioDevice **default_playback, SDL_AudioDevice **default_recording) | ||
| 426 | { | ||
| 427 | EnumerateEndpointsForFlow(false, default_playback); | ||
| 428 | EnumerateEndpointsForFlow(true, default_recording); | ||
| 429 | |||
| 430 | // if this fails, we just won't get hotplug events. Carry on anyhow. | ||
| 431 | IMMDeviceEnumerator_RegisterEndpointNotificationCallback(enumerator, (IMMNotificationClient *)¬ification_client); | ||
| 432 | } | ||
| 433 | |||
| 434 | #endif // defined(SDL_PLATFORM_WINDOWS) && defined(HAVE_MMDEVICEAPI_H) | ||
diff --git a/contrib/SDL-3.2.8/src/core/windows/SDL_immdevice.h b/contrib/SDL-3.2.8/src/core/windows/SDL_immdevice.h new file mode 100644 index 0000000..66fdf13 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/windows/SDL_immdevice.h | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #ifndef SDL_IMMDEVICE_H | ||
| 23 | #define SDL_IMMDEVICE_H | ||
| 24 | |||
| 25 | #define COBJMACROS | ||
| 26 | #include <mmdeviceapi.h> | ||
| 27 | #include <mmreg.h> | ||
| 28 | |||
| 29 | struct SDL_AudioDevice; // defined in src/audio/SDL_sysaudio.h | ||
| 30 | |||
| 31 | typedef struct SDL_IMMDevice_callbacks | ||
| 32 | { | ||
| 33 | void (*audio_device_disconnected)(struct SDL_AudioDevice *device); | ||
| 34 | void (*default_audio_device_changed)(struct SDL_AudioDevice *new_default_device); | ||
| 35 | } SDL_IMMDevice_callbacks; | ||
| 36 | |||
| 37 | bool SDL_IMMDevice_Init(const SDL_IMMDevice_callbacks *callbacks); | ||
| 38 | void SDL_IMMDevice_Quit(void); | ||
| 39 | bool SDL_IMMDevice_Get(struct SDL_AudioDevice *device, IMMDevice **immdevice, bool recording); | ||
| 40 | void SDL_IMMDevice_EnumerateEndpoints(struct SDL_AudioDevice **default_playback, struct SDL_AudioDevice **default_recording); | ||
| 41 | LPGUID SDL_IMMDevice_GetDirectSoundGUID(struct SDL_AudioDevice *device); | ||
| 42 | LPCWSTR SDL_IMMDevice_GetDevID(struct SDL_AudioDevice *device); | ||
| 43 | void SDL_IMMDevice_FreeDeviceHandle(struct SDL_AudioDevice *device); | ||
| 44 | |||
| 45 | #endif // SDL_IMMDEVICE_H | ||
diff --git a/contrib/SDL-3.2.8/src/core/windows/SDL_windows.c b/contrib/SDL-3.2.8/src/core/windows/SDL_windows.c new file mode 100644 index 0000000..286e8e6 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/windows/SDL_windows.c | |||
| @@ -0,0 +1,375 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #if defined(SDL_PLATFORM_WINDOWS) | ||
| 24 | |||
| 25 | #include "SDL_windows.h" | ||
| 26 | |||
| 27 | #include <objbase.h> // for CoInitialize/CoUninitialize (Win32 only) | ||
| 28 | #ifdef HAVE_ROAPI_H | ||
| 29 | #include <roapi.h> // For RoInitialize/RoUninitialize (Win32 only) | ||
| 30 | #else | ||
| 31 | typedef enum RO_INIT_TYPE | ||
| 32 | { | ||
| 33 | RO_INIT_SINGLETHREADED = 0, | ||
| 34 | RO_INIT_MULTITHREADED = 1 | ||
| 35 | } RO_INIT_TYPE; | ||
| 36 | #endif | ||
| 37 | |||
| 38 | #ifndef _WIN32_WINNT_VISTA | ||
| 39 | #define _WIN32_WINNT_VISTA 0x0600 | ||
| 40 | #endif | ||
| 41 | #ifndef _WIN32_WINNT_WIN7 | ||
| 42 | #define _WIN32_WINNT_WIN7 0x0601 | ||
| 43 | #endif | ||
| 44 | #ifndef _WIN32_WINNT_WIN8 | ||
| 45 | #define _WIN32_WINNT_WIN8 0x0602 | ||
| 46 | #endif | ||
| 47 | |||
| 48 | #ifndef LOAD_LIBRARY_SEARCH_SYSTEM32 | ||
| 49 | #define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800 | ||
| 50 | #endif | ||
| 51 | |||
| 52 | #ifndef WC_ERR_INVALID_CHARS | ||
| 53 | #define WC_ERR_INVALID_CHARS 0x00000080 | ||
| 54 | #endif | ||
| 55 | |||
| 56 | // Sets an error message based on an HRESULT | ||
| 57 | bool WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr) | ||
| 58 | { | ||
| 59 | TCHAR buffer[1024]; | ||
| 60 | char *message; | ||
| 61 | TCHAR *p = buffer; | ||
| 62 | DWORD c = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, hr, 0, | ||
| 63 | buffer, SDL_arraysize(buffer), NULL); | ||
| 64 | buffer[c] = 0; | ||
| 65 | // kill CR/LF that FormatMessage() sticks at the end | ||
| 66 | while (*p) { | ||
| 67 | if (*p == '\r') { | ||
| 68 | *p = 0; | ||
| 69 | break; | ||
| 70 | } | ||
| 71 | ++p; | ||
| 72 | } | ||
| 73 | message = WIN_StringToUTF8(buffer); | ||
| 74 | SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ": " : "", message); | ||
| 75 | SDL_free(message); | ||
| 76 | return false; | ||
| 77 | } | ||
| 78 | |||
| 79 | // Sets an error message based on GetLastError() | ||
| 80 | bool WIN_SetError(const char *prefix) | ||
| 81 | { | ||
| 82 | return WIN_SetErrorFromHRESULT(prefix, GetLastError()); | ||
| 83 | } | ||
| 84 | |||
| 85 | HRESULT | ||
| 86 | WIN_CoInitialize(void) | ||
| 87 | { | ||
| 88 | /* SDL handles any threading model, so initialize with the default, which | ||
| 89 | is compatible with OLE and if that doesn't work, try multi-threaded mode. | ||
| 90 | |||
| 91 | If you need multi-threaded mode, call CoInitializeEx() before SDL_Init() | ||
| 92 | */ | ||
| 93 | #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) | ||
| 94 | // On Xbox, there's no need to call CoInitializeEx (and it's not implemented) | ||
| 95 | return S_OK; | ||
| 96 | #else | ||
| 97 | HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); | ||
| 98 | if (hr == RPC_E_CHANGED_MODE) { | ||
| 99 | hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); | ||
| 100 | } | ||
| 101 | |||
| 102 | // S_FALSE means success, but someone else already initialized. | ||
| 103 | // You still need to call CoUninitialize in this case! | ||
| 104 | if (hr == S_FALSE) { | ||
| 105 | return S_OK; | ||
| 106 | } | ||
| 107 | |||
| 108 | return hr; | ||
| 109 | #endif | ||
| 110 | } | ||
| 111 | |||
| 112 | void WIN_CoUninitialize(void) | ||
| 113 | { | ||
| 114 | CoUninitialize(); | ||
| 115 | } | ||
| 116 | |||
| 117 | FARPROC WIN_LoadComBaseFunction(const char *name) | ||
| 118 | { | ||
| 119 | static bool s_bLoaded; | ||
| 120 | static HMODULE s_hComBase; | ||
| 121 | |||
| 122 | if (!s_bLoaded) { | ||
| 123 | s_hComBase = LoadLibraryEx(TEXT("combase.dll"), NULL, LOAD_LIBRARY_SEARCH_SYSTEM32); | ||
| 124 | s_bLoaded = true; | ||
| 125 | } | ||
| 126 | if (s_hComBase) { | ||
| 127 | return GetProcAddress(s_hComBase, name); | ||
| 128 | } else { | ||
| 129 | return NULL; | ||
| 130 | } | ||
| 131 | } | ||
| 132 | |||
| 133 | HRESULT | ||
| 134 | WIN_RoInitialize(void) | ||
| 135 | { | ||
| 136 | typedef HRESULT(WINAPI * RoInitialize_t)(RO_INIT_TYPE initType); | ||
| 137 | RoInitialize_t RoInitializeFunc = (RoInitialize_t)WIN_LoadComBaseFunction("RoInitialize"); | ||
| 138 | if (RoInitializeFunc) { | ||
| 139 | // RO_INIT_SINGLETHREADED is equivalent to COINIT_APARTMENTTHREADED | ||
| 140 | HRESULT hr = RoInitializeFunc(RO_INIT_SINGLETHREADED); | ||
| 141 | if (hr == RPC_E_CHANGED_MODE) { | ||
| 142 | hr = RoInitializeFunc(RO_INIT_MULTITHREADED); | ||
| 143 | } | ||
| 144 | |||
| 145 | // S_FALSE means success, but someone else already initialized. | ||
| 146 | // You still need to call RoUninitialize in this case! | ||
| 147 | if (hr == S_FALSE) { | ||
| 148 | return S_OK; | ||
| 149 | } | ||
| 150 | |||
| 151 | return hr; | ||
| 152 | } else { | ||
| 153 | return E_NOINTERFACE; | ||
| 154 | } | ||
| 155 | } | ||
| 156 | |||
| 157 | void WIN_RoUninitialize(void) | ||
| 158 | { | ||
| 159 | typedef void(WINAPI * RoUninitialize_t)(void); | ||
| 160 | RoUninitialize_t RoUninitializeFunc = (RoUninitialize_t)WIN_LoadComBaseFunction("RoUninitialize"); | ||
| 161 | if (RoUninitializeFunc) { | ||
| 162 | RoUninitializeFunc(); | ||
| 163 | } | ||
| 164 | } | ||
| 165 | |||
| 166 | #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) | ||
| 167 | static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor) | ||
| 168 | { | ||
| 169 | OSVERSIONINFOEXW osvi; | ||
| 170 | DWORDLONG const dwlConditionMask = VerSetConditionMask( | ||
| 171 | VerSetConditionMask( | ||
| 172 | VerSetConditionMask( | ||
| 173 | 0, VER_MAJORVERSION, VER_GREATER_EQUAL), | ||
| 174 | VER_MINORVERSION, VER_GREATER_EQUAL), | ||
| 175 | VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL); | ||
| 176 | |||
| 177 | SDL_zero(osvi); | ||
| 178 | osvi.dwOSVersionInfoSize = sizeof(osvi); | ||
| 179 | osvi.dwMajorVersion = wMajorVersion; | ||
| 180 | osvi.dwMinorVersion = wMinorVersion; | ||
| 181 | osvi.wServicePackMajor = wServicePackMajor; | ||
| 182 | |||
| 183 | return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE; | ||
| 184 | } | ||
| 185 | #endif | ||
| 186 | |||
| 187 | // apply some static variables so we only call into the Win32 API once per process for each check. | ||
| 188 | #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) | ||
| 189 | #define CHECKWINVER(notdesktop_platform_result, test) return (notdesktop_platform_result); | ||
| 190 | #else | ||
| 191 | #define CHECKWINVER(notdesktop_platform_result, test) \ | ||
| 192 | static bool checked = false; \ | ||
| 193 | static BOOL result = FALSE; \ | ||
| 194 | if (!checked) { \ | ||
| 195 | result = (test); \ | ||
| 196 | checked = true; \ | ||
| 197 | } \ | ||
| 198 | return result; | ||
| 199 | #endif | ||
| 200 | |||
| 201 | // this is the oldest thing we run on (and we may lose support for this in SDL3 at any time!), | ||
| 202 | // so there's no "OrGreater" as that would always be TRUE. The other functions are here to | ||
| 203 | // ask "can we support a specific feature?" but this function is here to ask "do we need to do | ||
| 204 | // something different for an OS version we probably should abandon?" :) | ||
| 205 | BOOL WIN_IsWindowsXP(void) | ||
| 206 | { | ||
| 207 | CHECKWINVER(FALSE, !WIN_IsWindowsVistaOrGreater() && IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 0)); | ||
| 208 | } | ||
| 209 | |||
| 210 | BOOL WIN_IsWindowsVistaOrGreater(void) | ||
| 211 | { | ||
| 212 | CHECKWINVER(TRUE, IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0)); | ||
| 213 | } | ||
| 214 | |||
| 215 | BOOL WIN_IsWindows7OrGreater(void) | ||
| 216 | { | ||
| 217 | CHECKWINVER(TRUE, IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0)); | ||
| 218 | } | ||
| 219 | |||
| 220 | BOOL WIN_IsWindows8OrGreater(void) | ||
| 221 | { | ||
| 222 | CHECKWINVER(TRUE, IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0)); | ||
| 223 | } | ||
| 224 | |||
| 225 | #undef CHECKWINVER | ||
| 226 | |||
| 227 | |||
| 228 | /* | ||
| 229 | WAVExxxCAPS gives you 31 bytes for the device name, and just truncates if it's | ||
| 230 | longer. However, since WinXP, you can use the WAVExxxCAPS2 structure, which | ||
| 231 | will give you a name GUID. The full name is in the Windows Registry under | ||
| 232 | that GUID, located here: HKLM\System\CurrentControlSet\Control\MediaCategories | ||
| 233 | |||
| 234 | Note that drivers can report GUID_NULL for the name GUID, in which case, | ||
| 235 | Windows makes a best effort to fill in those 31 bytes in the usual place. | ||
| 236 | This info summarized from MSDN: | ||
| 237 | |||
| 238 | http://web.archive.org/web/20131027093034/http://msdn.microsoft.com/en-us/library/windows/hardware/ff536382(v=vs.85).aspx | ||
| 239 | |||
| 240 | Always look this up in the registry if possible, because the strings are | ||
| 241 | different! At least on Win10, I see "Yeti Stereo Microphone" in the | ||
| 242 | Registry, and a unhelpful "Microphone(Yeti Stereo Microph" in winmm. Sigh. | ||
| 243 | |||
| 244 | (Also, DirectSound shouldn't be limited to 32 chars, but its device enum | ||
| 245 | has the same problem.) | ||
| 246 | |||
| 247 | WASAPI doesn't need this. This is just for DirectSound/WinMM. | ||
| 248 | */ | ||
| 249 | char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid) | ||
| 250 | { | ||
| 251 | #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) | ||
| 252 | return WIN_StringToUTF8W(name); // No registry access on Xbox, go with what we've got. | ||
| 253 | #else | ||
| 254 | static const GUID nullguid = { 0 }; | ||
| 255 | const unsigned char *ptr; | ||
| 256 | char keystr[128]; | ||
| 257 | WCHAR *strw = NULL; | ||
| 258 | bool rc; | ||
| 259 | HKEY hkey; | ||
| 260 | DWORD len = 0; | ||
| 261 | char *result = NULL; | ||
| 262 | |||
| 263 | if (WIN_IsEqualGUID(guid, &nullguid)) { | ||
| 264 | return WIN_StringToUTF8(name); // No GUID, go with what we've got. | ||
| 265 | } | ||
| 266 | |||
| 267 | ptr = (const unsigned char *)guid; | ||
| 268 | (void)SDL_snprintf(keystr, sizeof(keystr), | ||
| 269 | "System\\CurrentControlSet\\Control\\MediaCategories\\{%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X}", | ||
| 270 | ptr[3], ptr[2], ptr[1], ptr[0], ptr[5], ptr[4], ptr[7], ptr[6], | ||
| 271 | ptr[8], ptr[9], ptr[10], ptr[11], ptr[12], ptr[13], ptr[14], ptr[15]); | ||
| 272 | |||
| 273 | strw = WIN_UTF8ToString(keystr); | ||
| 274 | rc = (RegOpenKeyExW(HKEY_LOCAL_MACHINE, strw, 0, KEY_QUERY_VALUE, &hkey) == ERROR_SUCCESS); | ||
| 275 | SDL_free(strw); | ||
| 276 | if (!rc) { | ||
| 277 | return WIN_StringToUTF8(name); // oh well. | ||
| 278 | } | ||
| 279 | |||
| 280 | rc = (RegQueryValueExW(hkey, L"Name", NULL, NULL, NULL, &len) == ERROR_SUCCESS); | ||
| 281 | if (!rc) { | ||
| 282 | RegCloseKey(hkey); | ||
| 283 | return WIN_StringToUTF8(name); // oh well. | ||
| 284 | } | ||
| 285 | |||
| 286 | strw = (WCHAR *)SDL_malloc(len + sizeof(WCHAR)); | ||
| 287 | if (!strw) { | ||
| 288 | RegCloseKey(hkey); | ||
| 289 | return WIN_StringToUTF8(name); // oh well. | ||
| 290 | } | ||
| 291 | |||
| 292 | rc = (RegQueryValueExW(hkey, L"Name", NULL, NULL, (LPBYTE)strw, &len) == ERROR_SUCCESS); | ||
| 293 | RegCloseKey(hkey); | ||
| 294 | if (!rc) { | ||
| 295 | SDL_free(strw); | ||
| 296 | return WIN_StringToUTF8(name); // oh well. | ||
| 297 | } | ||
| 298 | |||
| 299 | strw[len / 2] = 0; // make sure it's null-terminated. | ||
| 300 | |||
| 301 | result = WIN_StringToUTF8(strw); | ||
| 302 | SDL_free(strw); | ||
| 303 | return result ? result : WIN_StringToUTF8(name); | ||
| 304 | #endif | ||
| 305 | } | ||
| 306 | |||
| 307 | BOOL WIN_IsEqualGUID(const GUID *a, const GUID *b) | ||
| 308 | { | ||
| 309 | return (SDL_memcmp(a, b, sizeof(*a)) == 0); | ||
| 310 | } | ||
| 311 | |||
| 312 | BOOL WIN_IsEqualIID(REFIID a, REFIID b) | ||
| 313 | { | ||
| 314 | return (SDL_memcmp(a, b, sizeof(*a)) == 0); | ||
| 315 | } | ||
| 316 | |||
| 317 | void WIN_RECTToRect(const RECT *winrect, SDL_Rect *sdlrect) | ||
| 318 | { | ||
| 319 | sdlrect->x = winrect->left; | ||
| 320 | sdlrect->w = (winrect->right - winrect->left) + 1; | ||
| 321 | sdlrect->y = winrect->top; | ||
| 322 | sdlrect->h = (winrect->bottom - winrect->top) + 1; | ||
| 323 | } | ||
| 324 | |||
| 325 | void WIN_RectToRECT(const SDL_Rect *sdlrect, RECT *winrect) | ||
| 326 | { | ||
| 327 | winrect->left = sdlrect->x; | ||
| 328 | winrect->right = sdlrect->x + sdlrect->w - 1; | ||
| 329 | winrect->top = sdlrect->y; | ||
| 330 | winrect->bottom = sdlrect->y + sdlrect->h - 1; | ||
| 331 | } | ||
| 332 | |||
| 333 | BOOL WIN_IsRectEmpty(const RECT *rect) | ||
| 334 | { | ||
| 335 | // Calculating this manually because Xbox does not support Win32 IsRectEmpty. | ||
| 336 | return (rect->right <= rect->left) || (rect->bottom <= rect->top); | ||
| 337 | } | ||
| 338 | |||
| 339 | // Some GUIDs we need to know without linking to libraries that aren't available before Vista. | ||
| 340 | /* *INDENT-OFF* */ // clang-format off | ||
| 341 | static const GUID SDL_KSDATAFORMAT_SUBTYPE_PCM = { 0x00000001, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } }; | ||
| 342 | static const GUID SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { 0x00000003, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } }; | ||
| 343 | /* *INDENT-ON* */ // clang-format on | ||
| 344 | |||
| 345 | SDL_AudioFormat SDL_WaveFormatExToSDLFormat(WAVEFORMATEX *waveformat) | ||
| 346 | { | ||
| 347 | if ((waveformat->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) && (waveformat->wBitsPerSample == 32)) { | ||
| 348 | return SDL_AUDIO_F32; | ||
| 349 | } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 16)) { | ||
| 350 | return SDL_AUDIO_S16; | ||
| 351 | } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 32)) { | ||
| 352 | return SDL_AUDIO_S32; | ||
| 353 | } else if (waveformat->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { | ||
| 354 | const WAVEFORMATEXTENSIBLE *ext = (const WAVEFORMATEXTENSIBLE *)waveformat; | ||
| 355 | if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { | ||
| 356 | return SDL_AUDIO_F32; | ||
| 357 | } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 16)) { | ||
| 358 | return SDL_AUDIO_S16; | ||
| 359 | } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { | ||
| 360 | return SDL_AUDIO_S32; | ||
| 361 | } | ||
| 362 | } | ||
| 363 | return SDL_AUDIO_UNKNOWN; | ||
| 364 | } | ||
| 365 | |||
| 366 | |||
| 367 | int WIN_WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWCH lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cbMultiByte, LPCCH lpDefaultChar, LPBOOL lpUsedDefaultChar) | ||
| 368 | { | ||
| 369 | if (WIN_IsWindowsXP()) { | ||
| 370 | dwFlags &= ~WC_ERR_INVALID_CHARS; // not supported before Vista. Without this flag, it will just replace bogus chars with U+FFFD. You're on your own, WinXP. | ||
| 371 | } | ||
| 372 | return WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, lpMultiByteStr, cbMultiByte, lpDefaultChar, lpUsedDefaultChar); | ||
| 373 | } | ||
| 374 | |||
| 375 | #endif // defined(SDL_PLATFORM_WINDOWS) | ||
diff --git a/contrib/SDL-3.2.8/src/core/windows/SDL_windows.h b/contrib/SDL-3.2.8/src/core/windows/SDL_windows.h new file mode 100644 index 0000000..b781b12 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/windows/SDL_windows.h | |||
| @@ -0,0 +1,172 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | // This is an include file for windows.h with the SDL build settings | ||
| 23 | |||
| 24 | #ifndef _INCLUDED_WINDOWS_H | ||
| 25 | #define _INCLUDED_WINDOWS_H | ||
| 26 | |||
| 27 | #ifdef SDL_PLATFORM_WIN32 | ||
| 28 | #ifndef WIN32_LEAN_AND_MEAN | ||
| 29 | #define WIN32_LEAN_AND_MEAN 1 | ||
| 30 | #endif | ||
| 31 | #ifndef STRICT | ||
| 32 | #define STRICT 1 | ||
| 33 | #endif | ||
| 34 | #ifndef UNICODE | ||
| 35 | #define UNICODE 1 | ||
| 36 | #endif | ||
| 37 | #undef WINVER | ||
| 38 | #undef _WIN32_WINNT | ||
| 39 | #if defined(SDL_VIDEO_RENDER_D3D12) || defined(HAVE_DXGI1_6_H) | ||
| 40 | #define _WIN32_WINNT 0xA00 // For D3D12, 0xA00 is required | ||
| 41 | #elif defined(HAVE_SHELLSCALINGAPI_H) | ||
| 42 | #define _WIN32_WINNT 0x603 // For DPI support | ||
| 43 | #else | ||
| 44 | #define _WIN32_WINNT 0x501 // Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices(), 0x501 for raw input | ||
| 45 | #endif | ||
| 46 | #define WINVER _WIN32_WINNT | ||
| 47 | |||
| 48 | #elif defined(SDL_PLATFORM_WINGDK) | ||
| 49 | #ifndef WIN32_LEAN_AND_MEAN | ||
| 50 | #define WIN32_LEAN_AND_MEAN 1 | ||
| 51 | #endif | ||
| 52 | #ifndef STRICT | ||
| 53 | #define STRICT 1 | ||
| 54 | #endif | ||
| 55 | #ifndef UNICODE | ||
| 56 | #define UNICODE 1 | ||
| 57 | #endif | ||
| 58 | #undef WINVER | ||
| 59 | #undef _WIN32_WINNT | ||
| 60 | #define _WIN32_WINNT 0xA00 | ||
| 61 | #define WINVER _WIN32_WINNT | ||
| 62 | |||
| 63 | #elif defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) | ||
| 64 | #ifndef WIN32_LEAN_AND_MEAN | ||
| 65 | #define WIN32_LEAN_AND_MEAN 1 | ||
| 66 | #endif | ||
| 67 | #ifndef STRICT | ||
| 68 | #define STRICT 1 | ||
| 69 | #endif | ||
| 70 | #ifndef UNICODE | ||
| 71 | #define UNICODE 1 | ||
| 72 | #endif | ||
| 73 | #undef WINVER | ||
| 74 | #undef _WIN32_WINNT | ||
| 75 | #define _WIN32_WINNT 0xA00 | ||
| 76 | #define WINVER _WIN32_WINNT | ||
| 77 | #endif | ||
| 78 | |||
| 79 | // See https://github.com/libsdl-org/SDL/pull/7607 | ||
| 80 | // force_align_arg_pointer attribute requires gcc >= 4.2.x. | ||
| 81 | #if defined(__clang__) | ||
| 82 | #define HAVE_FORCE_ALIGN_ARG_POINTER | ||
| 83 | #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) | ||
| 84 | #define HAVE_FORCE_ALIGN_ARG_POINTER | ||
| 85 | #endif | ||
| 86 | #if defined(__GNUC__) && defined(__i386__) && defined(HAVE_FORCE_ALIGN_ARG_POINTER) | ||
| 87 | #define MINGW32_FORCEALIGN __attribute__((force_align_arg_pointer)) | ||
| 88 | #else | ||
| 89 | #define MINGW32_FORCEALIGN | ||
| 90 | #endif | ||
| 91 | |||
| 92 | #include <windows.h> | ||
| 93 | #include <basetyps.h> // for REFIID with broken mingw.org headers | ||
| 94 | #include <mmreg.h> | ||
| 95 | |||
| 96 | // Routines to convert from UTF8 to native Windows text | ||
| 97 | #define WIN_StringToUTF8W(S) SDL_iconv_string("UTF-8", "UTF-16LE", (const char *)(S), (SDL_wcslen(S) + 1) * sizeof(WCHAR)) | ||
| 98 | #define WIN_UTF8ToStringW(S) (WCHAR *)SDL_iconv_string("UTF-16LE", "UTF-8", (const char *)(S), SDL_strlen(S) + 1) | ||
| 99 | // !!! FIXME: UTF8ToString() can just be a SDL_strdup() here. | ||
| 100 | #define WIN_StringToUTF8A(S) SDL_iconv_string("UTF-8", "ASCII", (const char *)(S), (SDL_strlen(S) + 1)) | ||
| 101 | #define WIN_UTF8ToStringA(S) SDL_iconv_string("ASCII", "UTF-8", (const char *)(S), SDL_strlen(S) + 1) | ||
| 102 | #if UNICODE | ||
| 103 | #define WIN_StringToUTF8 WIN_StringToUTF8W | ||
| 104 | #define WIN_UTF8ToString WIN_UTF8ToStringW | ||
| 105 | #define SDL_tcslen SDL_wcslen | ||
| 106 | #define SDL_tcsstr SDL_wcsstr | ||
| 107 | #else | ||
| 108 | #define WIN_StringToUTF8 WIN_StringToUTF8A | ||
| 109 | #define WIN_UTF8ToString WIN_UTF8ToStringA | ||
| 110 | #define SDL_tcslen SDL_strlen | ||
| 111 | #define SDL_tcsstr SDL_strstr | ||
| 112 | #endif | ||
| 113 | |||
| 114 | // Set up for C function definitions, even when using C++ | ||
| 115 | #ifdef __cplusplus | ||
| 116 | extern "C" { | ||
| 117 | #endif | ||
| 118 | |||
| 119 | // Sets an error message based on a given HRESULT | ||
| 120 | extern bool WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr); | ||
| 121 | |||
| 122 | // Sets an error message based on GetLastError(). Always returns false. | ||
| 123 | extern bool WIN_SetError(const char *prefix); | ||
| 124 | |||
| 125 | // Load a function from combase.dll | ||
| 126 | FARPROC WIN_LoadComBaseFunction(const char *name); | ||
| 127 | |||
| 128 | // Wrap up the oddities of CoInitialize() into a common function. | ||
| 129 | extern HRESULT WIN_CoInitialize(void); | ||
| 130 | extern void WIN_CoUninitialize(void); | ||
| 131 | |||
| 132 | // Wrap up the oddities of RoInitialize() into a common function. | ||
| 133 | extern HRESULT WIN_RoInitialize(void); | ||
| 134 | extern void WIN_RoUninitialize(void); | ||
| 135 | |||
| 136 | // Returns true if we're running on Windows XP (any service pack). DOES NOT CHECK XP "OR GREATER"! | ||
| 137 | extern BOOL WIN_IsWindowsXP(void); | ||
| 138 | |||
| 139 | // Returns true if we're running on Windows Vista and newer | ||
| 140 | extern BOOL WIN_IsWindowsVistaOrGreater(void); | ||
| 141 | |||
| 142 | // Returns true if we're running on Windows 7 and newer | ||
| 143 | extern BOOL WIN_IsWindows7OrGreater(void); | ||
| 144 | |||
| 145 | // Returns true if we're running on Windows 8 and newer | ||
| 146 | extern BOOL WIN_IsWindows8OrGreater(void); | ||
| 147 | |||
| 148 | // You need to SDL_free() the result of this call. | ||
| 149 | extern char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid); | ||
| 150 | |||
| 151 | // Checks to see if two GUID are the same. | ||
| 152 | extern BOOL WIN_IsEqualGUID(const GUID *a, const GUID *b); | ||
| 153 | extern BOOL WIN_IsEqualIID(REFIID a, REFIID b); | ||
| 154 | |||
| 155 | // Convert between SDL_rect and RECT | ||
| 156 | extern void WIN_RECTToRect(const RECT *winrect, SDL_Rect *sdlrect); | ||
| 157 | extern void WIN_RectToRECT(const SDL_Rect *sdlrect, RECT *winrect); | ||
| 158 | |||
| 159 | // Returns true if the rect is empty | ||
| 160 | extern BOOL WIN_IsRectEmpty(const RECT *rect); | ||
| 161 | |||
| 162 | extern SDL_AudioFormat SDL_WaveFormatExToSDLFormat(WAVEFORMATEX *waveformat); | ||
| 163 | |||
| 164 | // WideCharToMultiByte, but with some WinXP management. | ||
| 165 | extern int WIN_WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWCH lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cbMultiByte, LPCCH lpDefaultChar, LPBOOL lpUsedDefaultChar); | ||
| 166 | |||
| 167 | // Ends C function definitions when using C++ | ||
| 168 | #ifdef __cplusplus | ||
| 169 | } | ||
| 170 | #endif | ||
| 171 | |||
| 172 | #endif // _INCLUDED_WINDOWS_H | ||
diff --git a/contrib/SDL-3.2.8/src/core/windows/SDL_xinput.c b/contrib/SDL-3.2.8/src/core/windows/SDL_xinput.c new file mode 100644 index 0000000..ba5e4c1 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/windows/SDL_xinput.c | |||
| @@ -0,0 +1,140 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #include "SDL_xinput.h" | ||
| 24 | |||
| 25 | // Set up for C function definitions, even when using C++ | ||
| 26 | #ifdef __cplusplus | ||
| 27 | extern "C" { | ||
| 28 | #endif | ||
| 29 | |||
| 30 | XInputGetState_t SDL_XInputGetState = NULL; | ||
| 31 | XInputSetState_t SDL_XInputSetState = NULL; | ||
| 32 | XInputGetCapabilities_t SDL_XInputGetCapabilities = NULL; | ||
| 33 | XInputGetCapabilitiesEx_t SDL_XInputGetCapabilitiesEx = NULL; | ||
| 34 | XInputGetBatteryInformation_t SDL_XInputGetBatteryInformation = NULL; | ||
| 35 | DWORD SDL_XInputVersion = 0; | ||
| 36 | |||
| 37 | static HMODULE s_pXInputDLL = NULL; | ||
| 38 | static int s_XInputDLLRefCount = 0; | ||
| 39 | |||
| 40 | #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) | ||
| 41 | |||
| 42 | bool WIN_LoadXInputDLL(void) | ||
| 43 | { | ||
| 44 | /* Getting handles to system dlls (via LoadLibrary and its variants) is not | ||
| 45 | * supported on Xbox, thus, pointers to XInput's functions can't be | ||
| 46 | * retrieved via GetProcAddress. | ||
| 47 | * | ||
| 48 | * When on Xbox, assume that XInput is already loaded, and directly map | ||
| 49 | * its XInput.h-declared functions to the SDL_XInput* set of function | ||
| 50 | * pointers. | ||
| 51 | */ | ||
| 52 | SDL_XInputGetState = (XInputGetState_t)XInputGetState; | ||
| 53 | SDL_XInputSetState = (XInputSetState_t)XInputSetState; | ||
| 54 | SDL_XInputGetCapabilities = (XInputGetCapabilities_t)XInputGetCapabilities; | ||
| 55 | SDL_XInputGetBatteryInformation = (XInputGetBatteryInformation_t)XInputGetBatteryInformation; | ||
| 56 | |||
| 57 | // XInput 1.4 ships with Windows 8 and 8.1: | ||
| 58 | SDL_XInputVersion = (1 << 16) | 4; | ||
| 59 | |||
| 60 | return true; | ||
| 61 | } | ||
| 62 | |||
| 63 | void WIN_UnloadXInputDLL(void) | ||
| 64 | { | ||
| 65 | } | ||
| 66 | |||
| 67 | #else // !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) | ||
| 68 | |||
| 69 | bool WIN_LoadXInputDLL(void) | ||
| 70 | { | ||
| 71 | DWORD version = 0; | ||
| 72 | |||
| 73 | if (s_pXInputDLL) { | ||
| 74 | SDL_assert(s_XInputDLLRefCount > 0); | ||
| 75 | s_XInputDLLRefCount++; | ||
| 76 | return true; // already loaded | ||
| 77 | } | ||
| 78 | |||
| 79 | /* NOTE: Don't load XinputUap.dll | ||
| 80 | * This is XInput emulation over Windows.Gaming.Input, and has all the | ||
| 81 | * limitations of that API (no devices at startup, no background input, etc.) | ||
| 82 | */ | ||
| 83 | version = (1 << 16) | 4; | ||
| 84 | s_pXInputDLL = LoadLibrary(TEXT("XInput1_4.dll")); // 1.4 Ships with Windows 8. | ||
| 85 | if (!s_pXInputDLL) { | ||
| 86 | version = (1 << 16) | 3; | ||
| 87 | s_pXInputDLL = LoadLibrary(TEXT("XInput1_3.dll")); // 1.3 can be installed as a redistributable component. | ||
| 88 | } | ||
| 89 | if (!s_pXInputDLL) { | ||
| 90 | s_pXInputDLL = LoadLibrary(TEXT("bin\\XInput1_3.dll")); | ||
| 91 | } | ||
| 92 | if (!s_pXInputDLL) { | ||
| 93 | // "9.1.0" Ships with Vista and Win7, and is more limited than 1.3+ (e.g. XInputGetStateEx is not available.) | ||
| 94 | s_pXInputDLL = LoadLibrary(TEXT("XInput9_1_0.dll")); | ||
| 95 | } | ||
| 96 | if (!s_pXInputDLL) { | ||
| 97 | return false; | ||
| 98 | } | ||
| 99 | |||
| 100 | SDL_assert(s_XInputDLLRefCount == 0); | ||
| 101 | SDL_XInputVersion = version; | ||
| 102 | s_XInputDLLRefCount = 1; | ||
| 103 | |||
| 104 | // 100 is the ordinal for _XInputGetStateEx, which returns the same struct as XinputGetState, but with extra data in wButtons for the guide button, we think... | ||
| 105 | SDL_XInputGetState = (XInputGetState_t)GetProcAddress(s_pXInputDLL, (LPCSTR)100); | ||
| 106 | if (!SDL_XInputGetState) { | ||
| 107 | SDL_XInputGetState = (XInputGetState_t)GetProcAddress(s_pXInputDLL, "XInputGetState"); | ||
| 108 | } | ||
| 109 | SDL_XInputSetState = (XInputSetState_t)GetProcAddress(s_pXInputDLL, "XInputSetState"); | ||
| 110 | SDL_XInputGetCapabilities = (XInputGetCapabilities_t)GetProcAddress(s_pXInputDLL, "XInputGetCapabilities"); | ||
| 111 | // 108 is the ordinal for _XInputGetCapabilitiesEx, which additionally returns VID/PID of the controller. | ||
| 112 | SDL_XInputGetCapabilitiesEx = (XInputGetCapabilitiesEx_t)GetProcAddress(s_pXInputDLL, (LPCSTR)108); | ||
| 113 | SDL_XInputGetBatteryInformation = (XInputGetBatteryInformation_t)GetProcAddress(s_pXInputDLL, "XInputGetBatteryInformation"); | ||
| 114 | if (!SDL_XInputGetState || !SDL_XInputSetState || !SDL_XInputGetCapabilities) { | ||
| 115 | WIN_UnloadXInputDLL(); | ||
| 116 | return false; | ||
| 117 | } | ||
| 118 | |||
| 119 | return true; | ||
| 120 | } | ||
| 121 | |||
| 122 | void WIN_UnloadXInputDLL(void) | ||
| 123 | { | ||
| 124 | if (s_pXInputDLL) { | ||
| 125 | SDL_assert(s_XInputDLLRefCount > 0); | ||
| 126 | if (--s_XInputDLLRefCount == 0) { | ||
| 127 | FreeLibrary(s_pXInputDLL); | ||
| 128 | s_pXInputDLL = NULL; | ||
| 129 | } | ||
| 130 | } else { | ||
| 131 | SDL_assert(s_XInputDLLRefCount == 0); | ||
| 132 | } | ||
| 133 | } | ||
| 134 | |||
| 135 | #endif | ||
| 136 | |||
| 137 | // Ends C function definitions when using C++ | ||
| 138 | #ifdef __cplusplus | ||
| 139 | } | ||
| 140 | #endif | ||
diff --git a/contrib/SDL-3.2.8/src/core/windows/SDL_xinput.h b/contrib/SDL-3.2.8/src/core/windows/SDL_xinput.h new file mode 100644 index 0000000..d499cd5 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/windows/SDL_xinput.h | |||
| @@ -0,0 +1,276 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifndef SDL_xinput_h_ | ||
| 24 | #define SDL_xinput_h_ | ||
| 25 | |||
| 26 | #include "SDL_windows.h" | ||
| 27 | |||
| 28 | #ifdef HAVE_XINPUT_H | ||
| 29 | #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) | ||
| 30 | // Xbox supports an XInput wrapper which is a C++-only header... | ||
| 31 | #include <math.h> // Required to compile with recent MSVC... | ||
| 32 | #include <XInputOnGameInput.h> | ||
| 33 | using namespace XInputOnGameInput; | ||
| 34 | #else | ||
| 35 | #include <xinput.h> | ||
| 36 | #endif | ||
| 37 | #endif // HAVE_XINPUT_H | ||
| 38 | |||
| 39 | #ifndef XUSER_MAX_COUNT | ||
| 40 | #define XUSER_MAX_COUNT 4 | ||
| 41 | #endif | ||
| 42 | #ifndef XUSER_INDEX_ANY | ||
| 43 | #define XUSER_INDEX_ANY 0x000000FF | ||
| 44 | #endif | ||
| 45 | #ifndef XINPUT_CAPS_FFB_SUPPORTED | ||
| 46 | #define XINPUT_CAPS_FFB_SUPPORTED 0x0001 | ||
| 47 | #endif | ||
| 48 | #ifndef XINPUT_CAPS_WIRELESS | ||
| 49 | #define XINPUT_CAPS_WIRELESS 0x0002 | ||
| 50 | #endif | ||
| 51 | |||
| 52 | #ifndef XINPUT_DEVSUBTYPE_UNKNOWN | ||
| 53 | #define XINPUT_DEVSUBTYPE_UNKNOWN 0x00 | ||
| 54 | #endif | ||
| 55 | #ifndef XINPUT_DEVSUBTYPE_GAMEPAD | ||
| 56 | #define XINPUT_DEVSUBTYPE_GAMEPAD 0x01 | ||
| 57 | #endif | ||
| 58 | #ifndef XINPUT_DEVSUBTYPE_WHEEL | ||
| 59 | #define XINPUT_DEVSUBTYPE_WHEEL 0x02 | ||
| 60 | #endif | ||
| 61 | #ifndef XINPUT_DEVSUBTYPE_ARCADE_STICK | ||
| 62 | #define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03 | ||
| 63 | #endif | ||
| 64 | #ifndef XINPUT_DEVSUBTYPE_FLIGHT_STICK | ||
| 65 | #define XINPUT_DEVSUBTYPE_FLIGHT_STICK 0x04 | ||
| 66 | #endif | ||
| 67 | #ifndef XINPUT_DEVSUBTYPE_DANCE_PAD | ||
| 68 | #define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05 | ||
| 69 | #endif | ||
| 70 | #ifndef XINPUT_DEVSUBTYPE_GUITAR | ||
| 71 | #define XINPUT_DEVSUBTYPE_GUITAR 0x06 | ||
| 72 | #endif | ||
| 73 | #ifndef XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE | ||
| 74 | #define XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE 0x07 | ||
| 75 | #endif | ||
| 76 | #ifndef XINPUT_DEVSUBTYPE_DRUM_KIT | ||
| 77 | #define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08 | ||
| 78 | #endif | ||
| 79 | #ifndef XINPUT_DEVSUBTYPE_GUITAR_BASS | ||
| 80 | #define XINPUT_DEVSUBTYPE_GUITAR_BASS 0x0B | ||
| 81 | #endif | ||
| 82 | #ifndef XINPUT_DEVSUBTYPE_ARCADE_PAD | ||
| 83 | #define XINPUT_DEVSUBTYPE_ARCADE_PAD 0x13 | ||
| 84 | #endif | ||
| 85 | |||
| 86 | #ifndef XINPUT_FLAG_GAMEPAD | ||
| 87 | #define XINPUT_FLAG_GAMEPAD 0x01 | ||
| 88 | #endif | ||
| 89 | |||
| 90 | #ifndef XINPUT_GAMEPAD_DPAD_UP | ||
| 91 | #define XINPUT_GAMEPAD_DPAD_UP 0x0001 | ||
| 92 | #endif | ||
| 93 | #ifndef XINPUT_GAMEPAD_DPAD_DOWN | ||
| 94 | #define XINPUT_GAMEPAD_DPAD_DOWN 0x0002 | ||
| 95 | #endif | ||
| 96 | #ifndef XINPUT_GAMEPAD_DPAD_LEFT | ||
| 97 | #define XINPUT_GAMEPAD_DPAD_LEFT 0x0004 | ||
| 98 | #endif | ||
| 99 | #ifndef XINPUT_GAMEPAD_DPAD_RIGHT | ||
| 100 | #define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008 | ||
| 101 | #endif | ||
| 102 | #ifndef XINPUT_GAMEPAD_START | ||
| 103 | #define XINPUT_GAMEPAD_START 0x0010 | ||
| 104 | #endif | ||
| 105 | #ifndef XINPUT_GAMEPAD_BACK | ||
| 106 | #define XINPUT_GAMEPAD_BACK 0x0020 | ||
| 107 | #endif | ||
| 108 | #ifndef XINPUT_GAMEPAD_LEFT_THUMB | ||
| 109 | #define XINPUT_GAMEPAD_LEFT_THUMB 0x0040 | ||
| 110 | #endif | ||
| 111 | #ifndef XINPUT_GAMEPAD_RIGHT_THUMB | ||
| 112 | #define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080 | ||
| 113 | #endif | ||
| 114 | #ifndef XINPUT_GAMEPAD_LEFT_SHOULDER | ||
| 115 | #define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100 | ||
| 116 | #endif | ||
| 117 | #ifndef XINPUT_GAMEPAD_RIGHT_SHOULDER | ||
| 118 | #define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200 | ||
| 119 | #endif | ||
| 120 | #ifndef XINPUT_GAMEPAD_A | ||
| 121 | #define XINPUT_GAMEPAD_A 0x1000 | ||
| 122 | #endif | ||
| 123 | #ifndef XINPUT_GAMEPAD_B | ||
| 124 | #define XINPUT_GAMEPAD_B 0x2000 | ||
| 125 | #endif | ||
| 126 | #ifndef XINPUT_GAMEPAD_X | ||
| 127 | #define XINPUT_GAMEPAD_X 0x4000 | ||
| 128 | #endif | ||
| 129 | #ifndef XINPUT_GAMEPAD_Y | ||
| 130 | #define XINPUT_GAMEPAD_Y 0x8000 | ||
| 131 | #endif | ||
| 132 | |||
| 133 | #ifndef XINPUT_GAMEPAD_GUIDE | ||
| 134 | #define XINPUT_GAMEPAD_GUIDE 0x0400 | ||
| 135 | #endif | ||
| 136 | |||
| 137 | #ifndef BATTERY_DEVTYPE_GAMEPAD | ||
| 138 | #define BATTERY_DEVTYPE_GAMEPAD 0x00 | ||
| 139 | #endif | ||
| 140 | |||
| 141 | #ifndef BATTERY_TYPE_DISCONNECTED | ||
| 142 | #define BATTERY_TYPE_DISCONNECTED 0x00 | ||
| 143 | #endif | ||
| 144 | #ifndef BATTERY_TYPE_WIRED | ||
| 145 | #define BATTERY_TYPE_WIRED 0x01 | ||
| 146 | #endif | ||
| 147 | #ifndef BATTERY_TYPE_UNKNOWN | ||
| 148 | #define BATTERY_TYPE_UNKNOWN 0xFF | ||
| 149 | #endif | ||
| 150 | #ifndef BATTERY_LEVEL_EMPTY | ||
| 151 | #define BATTERY_LEVEL_EMPTY 0x00 | ||
| 152 | #endif | ||
| 153 | #ifndef BATTERY_LEVEL_LOW | ||
| 154 | #define BATTERY_LEVEL_LOW 0x01 | ||
| 155 | #endif | ||
| 156 | #ifndef BATTERY_LEVEL_MEDIUM | ||
| 157 | #define BATTERY_LEVEL_MEDIUM 0x02 | ||
| 158 | #endif | ||
| 159 | #ifndef BATTERY_LEVEL_FULL | ||
| 160 | #define BATTERY_LEVEL_FULL 0x03 | ||
| 161 | #endif | ||
| 162 | |||
| 163 | // Set up for C function definitions, even when using C++ | ||
| 164 | #ifdef __cplusplus | ||
| 165 | extern "C" { | ||
| 166 | #endif | ||
| 167 | |||
| 168 | // typedef's for XInput structs we use | ||
| 169 | |||
| 170 | |||
| 171 | // This is the same as XINPUT_BATTERY_INFORMATION, but always defined instead of just if WIN32_WINNT >= _WIN32_WINNT_WIN8 | ||
| 172 | typedef struct | ||
| 173 | { | ||
| 174 | BYTE BatteryType; | ||
| 175 | BYTE BatteryLevel; | ||
| 176 | } XINPUT_BATTERY_INFORMATION_EX; | ||
| 177 | |||
| 178 | #ifndef HAVE_XINPUT_H | ||
| 179 | |||
| 180 | typedef struct | ||
| 181 | { | ||
| 182 | WORD wButtons; | ||
| 183 | BYTE bLeftTrigger; | ||
| 184 | BYTE bRightTrigger; | ||
| 185 | SHORT sThumbLX; | ||
| 186 | SHORT sThumbLY; | ||
| 187 | SHORT sThumbRX; | ||
| 188 | SHORT sThumbRY; | ||
| 189 | } XINPUT_GAMEPAD; | ||
| 190 | |||
| 191 | typedef struct | ||
| 192 | { | ||
| 193 | DWORD dwPacketNumber; | ||
| 194 | XINPUT_GAMEPAD Gamepad; | ||
| 195 | } XINPUT_STATE; | ||
| 196 | |||
| 197 | typedef struct | ||
| 198 | { | ||
| 199 | WORD wLeftMotorSpeed; | ||
| 200 | WORD wRightMotorSpeed; | ||
| 201 | } XINPUT_VIBRATION; | ||
| 202 | |||
| 203 | typedef struct | ||
| 204 | { | ||
| 205 | BYTE Type; | ||
| 206 | BYTE SubType; | ||
| 207 | WORD Flags; | ||
| 208 | XINPUT_GAMEPAD Gamepad; | ||
| 209 | XINPUT_VIBRATION Vibration; | ||
| 210 | } XINPUT_CAPABILITIES; | ||
| 211 | |||
| 212 | #endif // HAVE_XINPUT_H | ||
| 213 | |||
| 214 | // This struct is not defined in XInput headers. | ||
| 215 | typedef struct | ||
| 216 | { | ||
| 217 | XINPUT_CAPABILITIES Capabilities; | ||
| 218 | WORD VendorId; | ||
| 219 | WORD ProductId; | ||
| 220 | WORD ProductVersion; | ||
| 221 | WORD unk1; | ||
| 222 | DWORD unk2; | ||
| 223 | } SDL_XINPUT_CAPABILITIES_EX; | ||
| 224 | |||
| 225 | // Forward decl's for XInput API's we load dynamically and use if available | ||
| 226 | typedef DWORD(WINAPI *XInputGetState_t)( | ||
| 227 | DWORD dwUserIndex, // [in] Index of the gamer associated with the device | ||
| 228 | XINPUT_STATE *pState // [out] Receives the current state | ||
| 229 | ); | ||
| 230 | |||
| 231 | typedef DWORD(WINAPI *XInputSetState_t)( | ||
| 232 | DWORD dwUserIndex, // [in] Index of the gamer associated with the device | ||
| 233 | XINPUT_VIBRATION *pVibration // [in, out] The vibration information to send to the controller | ||
| 234 | ); | ||
| 235 | |||
| 236 | typedef DWORD(WINAPI *XInputGetCapabilities_t)( | ||
| 237 | DWORD dwUserIndex, // [in] Index of the gamer associated with the device | ||
| 238 | DWORD dwFlags, // [in] Input flags that identify the device type | ||
| 239 | XINPUT_CAPABILITIES *pCapabilities // [out] Receives the capabilities | ||
| 240 | ); | ||
| 241 | |||
| 242 | // Only available in XInput 1.4 that is shipped with Windows 8 and newer. | ||
| 243 | typedef DWORD(WINAPI *XInputGetCapabilitiesEx_t)( | ||
| 244 | DWORD dwReserved, // [in] Must be 1 | ||
| 245 | DWORD dwUserIndex, // [in] Index of the gamer associated with the device | ||
| 246 | DWORD dwFlags, // [in] Input flags that identify the device type | ||
| 247 | SDL_XINPUT_CAPABILITIES_EX *pCapabilitiesEx // [out] Receives the capabilities | ||
| 248 | ); | ||
| 249 | |||
| 250 | typedef DWORD(WINAPI *XInputGetBatteryInformation_t)( | ||
| 251 | DWORD dwUserIndex, | ||
| 252 | BYTE devType, | ||
| 253 | XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation); | ||
| 254 | |||
| 255 | extern bool WIN_LoadXInputDLL(void); | ||
| 256 | extern void WIN_UnloadXInputDLL(void); | ||
| 257 | |||
| 258 | extern XInputGetState_t SDL_XInputGetState; | ||
| 259 | extern XInputSetState_t SDL_XInputSetState; | ||
| 260 | extern XInputGetCapabilities_t SDL_XInputGetCapabilities; | ||
| 261 | extern XInputGetCapabilitiesEx_t SDL_XInputGetCapabilitiesEx; | ||
| 262 | extern XInputGetBatteryInformation_t SDL_XInputGetBatteryInformation; | ||
| 263 | extern DWORD SDL_XInputVersion; // ((major << 16) & 0xFF00) | (minor & 0xFF) | ||
| 264 | |||
| 265 | // Ends C function definitions when using C++ | ||
| 266 | #ifdef __cplusplus | ||
| 267 | } | ||
| 268 | #endif | ||
| 269 | |||
| 270 | #define XINPUTGETSTATE SDL_XInputGetState | ||
| 271 | #define XINPUTSETSTATE SDL_XInputSetState | ||
| 272 | #define XINPUTGETCAPABILITIES SDL_XInputGetCapabilities | ||
| 273 | #define XINPUTGETCAPABILITIESEX SDL_XInputGetCapabilitiesEx | ||
| 274 | #define XINPUTGETBATTERYINFORMATION SDL_XInputGetBatteryInformation | ||
| 275 | |||
| 276 | #endif // SDL_xinput_h_ | ||
diff --git a/contrib/SDL-3.2.8/src/core/windows/pch.c b/contrib/SDL-3.2.8/src/core/windows/pch.c new file mode 100644 index 0000000..4b0c6f8 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/windows/pch.c | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
diff --git a/contrib/SDL-3.2.8/src/core/windows/pch_cpp.cpp b/contrib/SDL-3.2.8/src/core/windows/pch_cpp.cpp new file mode 100644 index 0000000..4b0c6f8 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/windows/pch_cpp.cpp | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
diff --git a/contrib/SDL-3.2.8/src/core/windows/version.rc b/contrib/SDL-3.2.8/src/core/windows/version.rc new file mode 100644 index 0000000..050f1b8 --- /dev/null +++ b/contrib/SDL-3.2.8/src/core/windows/version.rc | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | |||
| 2 | #include "winresrc.h" | ||
| 3 | |||
| 4 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US | ||
| 5 | |||
| 6 | ///////////////////////////////////////////////////////////////////////////// | ||
| 7 | // | ||
| 8 | // Version | ||
| 9 | // | ||
| 10 | |||
| 11 | VS_VERSION_INFO VERSIONINFO | ||
| 12 | FILEVERSION 3,2,8,0 | ||
| 13 | PRODUCTVERSION 3,2,8,0 | ||
| 14 | FILEFLAGSMASK 0x3fL | ||
| 15 | FILEFLAGS 0x0L | ||
| 16 | FILEOS 0x40004L | ||
| 17 | FILETYPE 0x2L | ||
| 18 | FILESUBTYPE 0x0L | ||
| 19 | BEGIN | ||
| 20 | BLOCK "StringFileInfo" | ||
| 21 | BEGIN | ||
| 22 | BLOCK "040904b0" | ||
| 23 | BEGIN | ||
| 24 | VALUE "CompanyName", "\0" | ||
| 25 | VALUE "FileDescription", "SDL\0" | ||
| 26 | VALUE "FileVersion", "3, 2, 8, 0\0" | ||
| 27 | VALUE "InternalName", "SDL\0" | ||
| 28 | VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0" | ||
| 29 | VALUE "OriginalFilename", "SDL3.dll\0" | ||
| 30 | VALUE "ProductName", "Simple DirectMedia Layer\0" | ||
| 31 | VALUE "ProductVersion", "3, 2, 8, 0\0" | ||
| 32 | END | ||
| 33 | END | ||
| 34 | BLOCK "VarFileInfo" | ||
| 35 | BEGIN | ||
| 36 | VALUE "Translation", 0x409, 1200 | ||
| 37 | END | ||
| 38 | END | ||
