no message
This commit is contained in:
parent
acbacb574e
commit
c3a57954aa
298
src/keycodes.c
298
src/keycodes.c
|
@ -1,7 +1,7 @@
|
||||||
[0] = UnkCode,
|
[0] = tic_key_unknown,
|
||||||
[1] = UnkCode,
|
[1] = tic_key_unknown,
|
||||||
[2] = UnkCode,
|
[2] = tic_key_unknown,
|
||||||
[3] = UnkCode,
|
[3] = tic_key_unknown,
|
||||||
[SDL_SCANCODE_A] = tic_key_a,
|
[SDL_SCANCODE_A] = tic_key_a,
|
||||||
[SDL_SCANCODE_B] = tic_key_b,
|
[SDL_SCANCODE_B] = tic_key_b,
|
||||||
[SDL_SCANCODE_C] = tic_key_c,
|
[SDL_SCANCODE_C] = tic_key_c,
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
[SDL_SCANCODE_LEFTBRACKET] = tic_key_leftbracket,
|
[SDL_SCANCODE_LEFTBRACKET] = tic_key_leftbracket,
|
||||||
[SDL_SCANCODE_RIGHTBRACKET] = tic_key_rightbracket,
|
[SDL_SCANCODE_RIGHTBRACKET] = tic_key_rightbracket,
|
||||||
[SDL_SCANCODE_BACKSLASH] = tic_key_backslash,
|
[SDL_SCANCODE_BACKSLASH] = tic_key_backslash,
|
||||||
[50] = UnkCode,
|
[50] = tic_key_unknown,
|
||||||
[SDL_SCANCODE_SEMICOLON] = tic_key_semicolon,
|
[SDL_SCANCODE_SEMICOLON] = tic_key_semicolon,
|
||||||
[SDL_SCANCODE_APOSTROPHE] = tic_key_apostrophe,
|
[SDL_SCANCODE_APOSTROPHE] = tic_key_apostrophe,
|
||||||
[SDL_SCANCODE_GRAVE] = tic_key_grave,
|
[SDL_SCANCODE_GRAVE] = tic_key_grave,
|
||||||
|
@ -68,9 +68,9 @@
|
||||||
[SDL_SCANCODE_F10] = tic_key_f10,
|
[SDL_SCANCODE_F10] = tic_key_f10,
|
||||||
[SDL_SCANCODE_F11] = tic_key_f11,
|
[SDL_SCANCODE_F11] = tic_key_f11,
|
||||||
[SDL_SCANCODE_F12] = tic_key_f12,
|
[SDL_SCANCODE_F12] = tic_key_f12,
|
||||||
[70] = UnkCode,
|
[70] = tic_key_unknown,
|
||||||
[71] = UnkCode,
|
[71] = tic_key_unknown,
|
||||||
[72] = UnkCode,
|
[72] = tic_key_unknown,
|
||||||
[SDL_SCANCODE_INSERT] = tic_key_insert,
|
[SDL_SCANCODE_INSERT] = tic_key_insert,
|
||||||
[SDL_SCANCODE_HOME] = tic_key_home,
|
[SDL_SCANCODE_HOME] = tic_key_home,
|
||||||
[SDL_SCANCODE_PAGEUP] = tic_key_pageup,
|
[SDL_SCANCODE_PAGEUP] = tic_key_pageup,
|
||||||
|
@ -81,147 +81,147 @@
|
||||||
[SDL_SCANCODE_LEFT] = tic_key_left,
|
[SDL_SCANCODE_LEFT] = tic_key_left,
|
||||||
[SDL_SCANCODE_DOWN] = tic_key_down,
|
[SDL_SCANCODE_DOWN] = tic_key_down,
|
||||||
[SDL_SCANCODE_UP] = tic_key_up,
|
[SDL_SCANCODE_UP] = tic_key_up,
|
||||||
[83] = UnkCode,
|
[83] = tic_key_unknown,
|
||||||
[84] = UnkCode,
|
[84] = tic_key_unknown,
|
||||||
[85] = UnkCode,
|
[85] = tic_key_unknown,
|
||||||
[86] = UnkCode,
|
[86] = tic_key_unknown,
|
||||||
[87] = UnkCode,
|
[87] = tic_key_unknown,
|
||||||
[88] = UnkCode,
|
[88] = tic_key_unknown,
|
||||||
[89] = UnkCode,
|
[89] = tic_key_unknown,
|
||||||
[90] = UnkCode,
|
[90] = tic_key_unknown,
|
||||||
[91] = UnkCode,
|
[91] = tic_key_unknown,
|
||||||
[92] = UnkCode,
|
[92] = tic_key_unknown,
|
||||||
[93] = UnkCode,
|
[93] = tic_key_unknown,
|
||||||
[94] = UnkCode,
|
[94] = tic_key_unknown,
|
||||||
[95] = UnkCode,
|
[95] = tic_key_unknown,
|
||||||
[96] = UnkCode,
|
[96] = tic_key_unknown,
|
||||||
[97] = UnkCode,
|
[97] = tic_key_unknown,
|
||||||
[98] = UnkCode,
|
[98] = tic_key_unknown,
|
||||||
[99] = UnkCode,
|
[99] = tic_key_unknown,
|
||||||
[100] = UnkCode,
|
[100] = tic_key_unknown,
|
||||||
[101] = UnkCode,
|
[101] = tic_key_unknown,
|
||||||
[102] = UnkCode,
|
[102] = tic_key_unknown,
|
||||||
[103] = UnkCode,
|
[103] = tic_key_unknown,
|
||||||
[104] = UnkCode,
|
[104] = tic_key_unknown,
|
||||||
[105] = UnkCode,
|
[105] = tic_key_unknown,
|
||||||
[106] = UnkCode,
|
[106] = tic_key_unknown,
|
||||||
[107] = UnkCode,
|
[107] = tic_key_unknown,
|
||||||
[108] = UnkCode,
|
[108] = tic_key_unknown,
|
||||||
[109] = UnkCode,
|
[109] = tic_key_unknown,
|
||||||
[110] = UnkCode,
|
[110] = tic_key_unknown,
|
||||||
[111] = UnkCode,
|
[111] = tic_key_unknown,
|
||||||
[112] = UnkCode,
|
[112] = tic_key_unknown,
|
||||||
[113] = UnkCode,
|
[113] = tic_key_unknown,
|
||||||
[114] = UnkCode,
|
[114] = tic_key_unknown,
|
||||||
[115] = UnkCode,
|
[115] = tic_key_unknown,
|
||||||
[116] = UnkCode,
|
[116] = tic_key_unknown,
|
||||||
[117] = UnkCode,
|
[117] = tic_key_unknown,
|
||||||
[118] = UnkCode,
|
[118] = tic_key_unknown,
|
||||||
[119] = UnkCode,
|
[119] = tic_key_unknown,
|
||||||
[120] = UnkCode,
|
[120] = tic_key_unknown,
|
||||||
[121] = UnkCode,
|
[121] = tic_key_unknown,
|
||||||
[122] = UnkCode,
|
[122] = tic_key_unknown,
|
||||||
[123] = UnkCode,
|
[123] = tic_key_unknown,
|
||||||
[124] = UnkCode,
|
[124] = tic_key_unknown,
|
||||||
[125] = UnkCode,
|
[125] = tic_key_unknown,
|
||||||
[126] = UnkCode,
|
[126] = tic_key_unknown,
|
||||||
[127] = UnkCode,
|
[127] = tic_key_unknown,
|
||||||
[128] = UnkCode,
|
[128] = tic_key_unknown,
|
||||||
[129] = UnkCode,
|
[129] = tic_key_unknown,
|
||||||
[130] = UnkCode,
|
[130] = tic_key_unknown,
|
||||||
[131] = UnkCode,
|
[131] = tic_key_unknown,
|
||||||
[132] = UnkCode,
|
[132] = tic_key_unknown,
|
||||||
[133] = UnkCode,
|
[133] = tic_key_unknown,
|
||||||
[134] = UnkCode,
|
[134] = tic_key_unknown,
|
||||||
[135] = UnkCode,
|
[135] = tic_key_unknown,
|
||||||
[136] = UnkCode,
|
[136] = tic_key_unknown,
|
||||||
[137] = UnkCode,
|
[137] = tic_key_unknown,
|
||||||
[138] = UnkCode,
|
[138] = tic_key_unknown,
|
||||||
[139] = UnkCode,
|
[139] = tic_key_unknown,
|
||||||
[140] = UnkCode,
|
[140] = tic_key_unknown,
|
||||||
[141] = UnkCode,
|
[141] = tic_key_unknown,
|
||||||
[142] = UnkCode,
|
[142] = tic_key_unknown,
|
||||||
[143] = UnkCode,
|
[143] = tic_key_unknown,
|
||||||
[144] = UnkCode,
|
[144] = tic_key_unknown,
|
||||||
[145] = UnkCode,
|
[145] = tic_key_unknown,
|
||||||
[146] = UnkCode,
|
[146] = tic_key_unknown,
|
||||||
[147] = UnkCode,
|
[147] = tic_key_unknown,
|
||||||
[148] = UnkCode,
|
[148] = tic_key_unknown,
|
||||||
[149] = UnkCode,
|
[149] = tic_key_unknown,
|
||||||
[150] = UnkCode,
|
[150] = tic_key_unknown,
|
||||||
[151] = UnkCode,
|
[151] = tic_key_unknown,
|
||||||
[152] = UnkCode,
|
[152] = tic_key_unknown,
|
||||||
[153] = UnkCode,
|
[153] = tic_key_unknown,
|
||||||
[154] = UnkCode,
|
[154] = tic_key_unknown,
|
||||||
[155] = UnkCode,
|
[155] = tic_key_unknown,
|
||||||
[156] = UnkCode,
|
[156] = tic_key_unknown,
|
||||||
[157] = UnkCode,
|
[157] = tic_key_unknown,
|
||||||
[158] = UnkCode,
|
[158] = tic_key_unknown,
|
||||||
[159] = UnkCode,
|
[159] = tic_key_unknown,
|
||||||
[160] = UnkCode,
|
[160] = tic_key_unknown,
|
||||||
[161] = UnkCode,
|
[161] = tic_key_unknown,
|
||||||
[162] = UnkCode,
|
[162] = tic_key_unknown,
|
||||||
[163] = UnkCode,
|
[163] = tic_key_unknown,
|
||||||
[164] = UnkCode,
|
[164] = tic_key_unknown,
|
||||||
[165] = UnkCode,
|
[165] = tic_key_unknown,
|
||||||
[166] = UnkCode,
|
[166] = tic_key_unknown,
|
||||||
[167] = UnkCode,
|
[167] = tic_key_unknown,
|
||||||
[168] = UnkCode,
|
[168] = tic_key_unknown,
|
||||||
[169] = UnkCode,
|
[169] = tic_key_unknown,
|
||||||
[170] = UnkCode,
|
[170] = tic_key_unknown,
|
||||||
[171] = UnkCode,
|
[171] = tic_key_unknown,
|
||||||
[172] = UnkCode,
|
[172] = tic_key_unknown,
|
||||||
[173] = UnkCode,
|
[173] = tic_key_unknown,
|
||||||
[174] = UnkCode,
|
[174] = tic_key_unknown,
|
||||||
[175] = UnkCode,
|
[175] = tic_key_unknown,
|
||||||
[176] = UnkCode,
|
[176] = tic_key_unknown,
|
||||||
[177] = UnkCode,
|
[177] = tic_key_unknown,
|
||||||
[178] = UnkCode,
|
[178] = tic_key_unknown,
|
||||||
[179] = UnkCode,
|
[179] = tic_key_unknown,
|
||||||
[180] = UnkCode,
|
[180] = tic_key_unknown,
|
||||||
[181] = UnkCode,
|
[181] = tic_key_unknown,
|
||||||
[182] = UnkCode,
|
[182] = tic_key_unknown,
|
||||||
[183] = UnkCode,
|
[183] = tic_key_unknown,
|
||||||
[184] = UnkCode,
|
[184] = tic_key_unknown,
|
||||||
[185] = UnkCode,
|
[185] = tic_key_unknown,
|
||||||
[186] = UnkCode,
|
[186] = tic_key_unknown,
|
||||||
[187] = UnkCode,
|
[187] = tic_key_unknown,
|
||||||
[188] = UnkCode,
|
[188] = tic_key_unknown,
|
||||||
[189] = UnkCode,
|
[189] = tic_key_unknown,
|
||||||
[190] = UnkCode,
|
[190] = tic_key_unknown,
|
||||||
[191] = UnkCode,
|
[191] = tic_key_unknown,
|
||||||
[192] = UnkCode,
|
[192] = tic_key_unknown,
|
||||||
[193] = UnkCode,
|
[193] = tic_key_unknown,
|
||||||
[194] = UnkCode,
|
[194] = tic_key_unknown,
|
||||||
[195] = UnkCode,
|
[195] = tic_key_unknown,
|
||||||
[196] = UnkCode,
|
[196] = tic_key_unknown,
|
||||||
[197] = UnkCode,
|
[197] = tic_key_unknown,
|
||||||
[198] = UnkCode,
|
[198] = tic_key_unknown,
|
||||||
[199] = UnkCode,
|
[199] = tic_key_unknown,
|
||||||
[200] = UnkCode,
|
[200] = tic_key_unknown,
|
||||||
[201] = UnkCode,
|
[201] = tic_key_unknown,
|
||||||
[202] = UnkCode,
|
[202] = tic_key_unknown,
|
||||||
[203] = UnkCode,
|
[203] = tic_key_unknown,
|
||||||
[204] = UnkCode,
|
[204] = tic_key_unknown,
|
||||||
[205] = UnkCode,
|
[205] = tic_key_unknown,
|
||||||
[206] = UnkCode,
|
[206] = tic_key_unknown,
|
||||||
[207] = UnkCode,
|
[207] = tic_key_unknown,
|
||||||
[208] = UnkCode,
|
[208] = tic_key_unknown,
|
||||||
[209] = UnkCode,
|
[209] = tic_key_unknown,
|
||||||
[210] = UnkCode,
|
[210] = tic_key_unknown,
|
||||||
[211] = UnkCode,
|
[211] = tic_key_unknown,
|
||||||
[212] = UnkCode,
|
[212] = tic_key_unknown,
|
||||||
[213] = UnkCode,
|
[213] = tic_key_unknown,
|
||||||
[214] = UnkCode,
|
[214] = tic_key_unknown,
|
||||||
[215] = UnkCode,
|
[215] = tic_key_unknown,
|
||||||
[216] = UnkCode,
|
[216] = tic_key_unknown,
|
||||||
[217] = UnkCode,
|
[217] = tic_key_unknown,
|
||||||
[218] = UnkCode,
|
[218] = tic_key_unknown,
|
||||||
[219] = UnkCode,
|
[219] = tic_key_unknown,
|
||||||
[220] = UnkCode,
|
[220] = tic_key_unknown,
|
||||||
[221] = UnkCode,
|
[221] = tic_key_unknown,
|
||||||
[222] = UnkCode,
|
[222] = tic_key_unknown,
|
||||||
[223] = UnkCode,
|
[223] = tic_key_unknown,
|
||||||
[SDL_SCANCODE_LCTRL] = tic_key_ctrl,
|
[SDL_SCANCODE_LCTRL] = tic_key_ctrl,
|
||||||
[SDL_SCANCODE_LSHIFT] = tic_key_shift,
|
[SDL_SCANCODE_LSHIFT] = tic_key_shift,
|
||||||
[SDL_SCANCODE_LALT] = tic_key_alt,
|
[SDL_SCANCODE_LALT] = tic_key_alt,
|
|
@ -794,9 +794,9 @@ static s32 lua_key(lua_State* lua)
|
||||||
|
|
||||||
if (top == 1)
|
if (top == 1)
|
||||||
{
|
{
|
||||||
u8 index = getLuaNumber(lua, 1);
|
u8 index = getLuaNumber(lua, 1)+1;
|
||||||
|
|
||||||
if(index != 0xff)
|
if(index > tic_key_unknown)
|
||||||
{
|
{
|
||||||
for(s32 i = 0; i < COUNT_OF(input->keyboard.keys); i++)
|
for(s32 i = 0; i < COUNT_OF(input->keyboard.keys); i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1904,20 +1904,18 @@ static void processMouseInput()
|
||||||
|
|
||||||
static void processKeyboardInput()
|
static void processKeyboardInput()
|
||||||
{
|
{
|
||||||
enum{UnkCode = 0xff};
|
|
||||||
|
|
||||||
static const u8 KeyboardCodes[] =
|
static const u8 KeyboardCodes[] =
|
||||||
{
|
{
|
||||||
#include "keycodes.c"
|
#include "keycodes.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
tic80_input* input = &studio.tic->ram.input;
|
tic80_input* input = &studio.tic->ram.input;
|
||||||
input->keyboard.data = SDL_FOURCC(UnkCode, UnkCode, UnkCode, UnkCode);
|
input->keyboard.data = 0;
|
||||||
|
|
||||||
studio.keyboard = SDL_GetKeyboardState(NULL);
|
studio.keyboard = SDL_GetKeyboardState(NULL);
|
||||||
|
|
||||||
for(s32 i = 0, c = 0; i < COUNT_OF(KeyboardCodes) && c < COUNT_OF(input->keyboard.keys); i++)
|
for(s32 i = 0, c = 0; i < COUNT_OF(KeyboardCodes) && c < COUNT_OF(input->keyboard.keys); i++)
|
||||||
if(studio.keyboard[i] && KeyboardCodes[i] != UnkCode)
|
if(studio.keyboard[i] && KeyboardCodes[i] > tic_key_unknown)
|
||||||
input->keyboard.keys[c++] = KeyboardCodes[i];
|
input->keyboard.keys[c++] = KeyboardCodes[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue