Recreate s_scantokey_* tables in win_input.cpp to fix MinGW build

the tables contain character constants like ('ä') that are supposed to
be interpreted as ISO8859-1 or WINDOWS-1252 or sth, but that doesn't
seem to work with MinGW (anymore) - seems like it assumes UTF-8 by
default, and for some reason -finput-charset=ISO8859-1 doesn't help
either, it complains about multichar character constants then..

Anyway, now the table entries are represented as the corresponding
integer constants which seems to work as intended.

Fixes #238
This commit is contained in:
Daniel Gibson 2019-06-17 03:50:07 +02:00
parent e33921a28a
commit 04a50e1927
2 changed files with 123 additions and 2 deletions

View file

@ -48,6 +48,9 @@ class idFile;
// are bindable (otherwise they get bound as one of the special keys in this
// table)
typedef enum {
// DG: please don't change any existing constants for keyboard keys below (or recreate the tables in win_input.cpp)!
K_TAB = 9,
K_ENTER = 13,
K_ESCAPE = 27,
@ -119,6 +122,8 @@ typedef enum {
K_KP_STAR,
K_KP_EQUALS,
// DG: please don't change any existing constants above this one (or recreate the tables in win_input.cpp)!
K_MASCULINE_ORDINATOR = 186,
// K_MOUSE enums must be contiguous (no char codes in the middle)
K_MOUSE1 = 187,

View file

@ -32,6 +32,10 @@ If you have questions concerning this license or the applicable additional terms
#include "sys/win32/win_local.h"
// DG: at least MinGW doesn't like the old scantokey tables, seems to be some kind of charcode-fuckup
// (no -finput-charset=ISO8859-1 doesn't seem to help, see #238) - so use plain numbers instead
#if 0 // keeping the original for reference
static const unsigned char s_scantokey[256] = {
// 0 1 2 3 4 5 6 7
// 8 9 A B C D E F
@ -69,7 +73,30 @@ static const unsigned char s_scantokey[256] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 // 7
};
#else // the same in numbers, generated by VS2010 Express on WinXP
static const unsigned char s_scantokey[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 27, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 45, 61, 127, 9, // 0
113, 119, 101, 114, 116, 121, 117, 105, 111, 112, 91, 93, 13, 141, 97, 115, // 1
100, 102, 103, 104, 106, 107, 108, 59, 39, 96, 142, 92, 122, 120, 99, 118, // 2
98, 110, 109, 44, 46, 47, 142, 183, 140, 32, 129, 149, 150, 151, 152, 153, // 3
154, 155, 156, 157, 158, 132, 130, 147, 133, 146, 179, 135, 169, 136, 181, 148, // 4
134, 145, 143, 144, 0, 0, 0, 159, 160, 0, 0, 137, 138, 139, 0, 0, // 5
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7
// shifted
0, 27, 33, 64, 35, 36, 37, 94, 38, 42, 40, 41, 95, 43, 127, 9, // 0
113, 119, 101, 114, 116, 121, 117, 105, 111, 112, 91, 93, 13, 141, 97, 115, // 1
100, 102, 103, 104, 106, 107, 108, 59, 39, 126, 142, 92, 122, 120, 99, 118, // 2
98, 110, 109, 44, 46, 47, 142, 183, 140, 32, 129, 149, 150, 151, 152, 153, // 3
154, 155, 156, 157, 158, 132, 130, 147, 133, 146, 179, 135, 169, 136, 181, 148, // 4
134, 145, 143, 144, 0, 0, 0, 159, 160, 0, 0, 137, 138, 139, 0, 0, // 5
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7
};
#endif
#if 0 // keeping the original for reference
static const unsigned char s_scantokey_german[256] = {
// 0 1 2 3 4 5 6 7
// 8 9 A B C D E F
@ -107,7 +134,30 @@ static const unsigned char s_scantokey_german[256] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 // 7
};
#else // the same in numbers, generated by VS2010 Express on WinXP
static const unsigned char s_scantokey_german[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 27, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 63, 39, 127, 9, // 0
113, 119, 101, 114, 116, 122, 117, 105, 111, 112, 61, 43, 13, 141, 97, 115, // 1
100, 102, 103, 104, 106, 107, 108, 91, 93, 96, 142, 35, 121, 120, 99, 118, // 2
98, 110, 109, 44, 46, 45, 142, 183, 140, 32, 129, 149, 150, 151, 152, 153, // 3
154, 155, 156, 157, 158, 132, 130, 147, 133, 146, 179, 135, 169, 136, 181, 148, // 4
134, 145, 143, 144, 0, 0, 60, 159, 160, 0, 0, 137, 138, 139, 0, 0, // 5
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7
// shifted
0, 27, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 63, 39, 127, 9, // 0
113, 119, 101, 114, 116, 122, 117, 105, 111, 112, 61, 43, 13, 141, 97, 115, // 1
100, 102, 103, 104, 106, 107, 108, 91, 93, 96, 142, 35, 121, 120, 99, 118, // 2
98, 110, 109, 44, 46, 45, 142, 183, 140, 32, 129, 149, 150, 151, 152, 153, // 3
154, 155, 156, 157, 158, 132, 130, 147, 133, 146, 179, 135, 169, 136, 181, 148, // 4
134, 145, 143, 144, 0, 0, 60, 159, 160, 0, 0, 137, 138, 139, 0, 0, // 5
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7
};
#endif
#if 0 // keeping the original for reference
static const unsigned char s_scantokey_french[256] = {
// 0 1 2 3 4 5 6 7
// 8 9 A B C D E F
@ -145,7 +195,30 @@ static const unsigned char s_scantokey_french[256] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 // 7
};
#else // the same in numbers, generated by VS2010 Express on WinXP
static const unsigned char s_scantokey_french[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 27, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 41, 61, 127, 9, // 0
97, 122, 101, 114, 116, 121, 117, 105, 111, 112, 94, 36, 13, 141, 113, 115, // 1
100, 102, 103, 104, 106, 107, 108, 109, 249, 96, 142, 42, 119, 120, 99, 118, // 2
98, 110, 44, 59, 58, 33, 142, 183, 140, 32, 129, 149, 150, 151, 152, 153, // 3
154, 155, 156, 157, 158, 132, 130, 147, 133, 146, 179, 135, 169, 136, 181, 148, // 4
134, 145, 143, 144, 0, 0, 60, 159, 160, 0, 0, 137, 138, 139, 0, 0, // 5
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7
// shifted
0, 27, 38, 233, 34, 39, 40, 45, 232, 95, 231, 224, 176, 43, 127, 9, // 0
97, 122, 101, 114, 116, 121, 117, 105, 111, 112, 94, 36, 13, 141, 113, 115, // 1
100, 102, 103, 104, 106, 107, 108, 109, 249, 0, 142, 42, 119, 120, 99, 118, // 2
98, 110, 44, 59, 58, 33, 142, 183, 140, 32, 129, 149, 150, 151, 152, 153, // 3
154, 155, 156, 157, 158, 132, 130, 147, 133, 146, 179, 135, 169, 136, 181, 148, // 4
134, 145, 143, 144, 0, 0, 60, 159, 160, 0, 0, 137, 138, 139, 0, 0, // 5
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7
};
#endif
#if 0 // keeping the original for reference
static const unsigned char s_scantokey_spanish[256] = {
// 0 1 2 3 4 5 6 7
// 8 9 A B C D E F
@ -183,7 +256,30 @@ static const unsigned char s_scantokey_spanish[256] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 // 7
};
#else // the same in numbers, generated by VS2010 Express on WinXP
static const unsigned char s_scantokey_spanish[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 27, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 39, 161, 127, 9, // 0
113, 119, 101, 114, 116, 121, 117, 105, 111, 112, 96, 43, 13, 141, 97, 115, // 1
100, 102, 103, 104, 106, 107, 108, 241, 180, 186, 142, 231, 122, 120, 99, 118, // 2
98, 110, 109, 44, 46, 45, 142, 183, 140, 32, 129, 149, 150, 151, 152, 153, // 3
154, 155, 156, 157, 158, 132, 130, 147, 133, 146, 179, 135, 169, 136, 181, 148, // 4
134, 145, 143, 144, 0, 0, 60, 159, 160, 0, 0, 137, 138, 139, 0, 0, // 5
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7
// shifted
0, 27, 33, 34, 183, 36, 37, 38, 47, 40, 41, 61, 63, 191, 127, 9, // 0
113, 119, 101, 114, 116, 121, 117, 105, 111, 112, 94, 42, 13, 141, 97, 115, // 1
100, 102, 103, 104, 106, 107, 108, 209, 168, 170, 142, 199, 122, 120, 99, 118, // 2
98, 110, 109, 44, 46, 45, 142, 183, 140, 32, 129, 149, 150, 151, 152, 153, // 3
154, 155, 156, 157, 158, 132, 130, 147, 133, 146, 179, 135, 169, 136, 181, 148, // 4
134, 145, 143, 144, 0, 0, 60, 159, 160, 0, 0, 137, 138, 139, 0, 0, // 5
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7
};
#endif
#if 0 // keeping the original for reference
static const unsigned char s_scantokey_italian[256] = {
// 0 1 2 3 4 5 6 7
// 8 9 A B C D E F
@ -220,9 +316,29 @@ static const unsigned char s_scantokey_italian[256] = {
0, 0, 0, 0, 0, 0, 0, 0, // 6
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 // 7
};
#else // the same in numbers, generated by VS2010 Express on WinXP
static const unsigned char s_scantokey_italian[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 27, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 39, 236, 127, 9, // 0
113, 119, 101, 114, 116, 121, 117, 105, 111, 112, 232, 43, 13, 141, 97, 115, // 1
100, 102, 103, 104, 106, 107, 108, 242, 224, 92, 142, 249, 122, 120, 99, 118, // 2
98, 110, 109, 44, 46, 45, 142, 183, 140, 32, 129, 149, 150, 151, 152, 153, // 3
154, 155, 156, 157, 158, 132, 130, 147, 133, 146, 179, 135, 169, 136, 181, 148, // 4
134, 145, 143, 144, 0, 0, 60, 159, 160, 0, 0, 137, 138, 139, 0, 0, // 5
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7
// shifted
0, 27, 33, 34, 163, 36, 37, 38, 47, 40, 41, 61, 63, 94, 127, 9, // 0
113, 119, 101, 114, 116, 121, 117, 105, 111, 112, 233, 42, 13, 141, 97, 115, // 1
100, 102, 103, 104, 106, 107, 108, 231, 176, 124, 142, 167, 122, 120, 99, 118, // 2
98, 110, 109, 44, 46, 45, 142, 183, 140, 32, 129, 149, 150, 151, 152, 153, // 3
154, 155, 156, 157, 158, 132, 130, 147, 133, 146, 179, 135, 169, 136, 181, 148, // 4
134, 145, 143, 144, 0, 0, 60, 159, 160, 0, 0, 137, 138, 139, 0, 0, // 5
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7
};
#endif
static const unsigned char *keyScanTable = s_scantokey;