Compare commits
5 Commits
v0.1.0
...
add-excamp
Author | SHA1 | Date | |
---|---|---|---|
7fd94fc4c6 | |||
008485e004 | |||
14ef5e42a8 | |||
9ca0d8d658 | |||
186fbe426e |
@@ -1,3 +1,7 @@
|
||||
# Syscalls
|
||||
|
||||
Syscalls library for Lua
|
||||
|
||||
## Examples
|
||||
|
||||
you can find it in tests folder
|
||||
|
353
doc/manual.md
353
doc/manual.md
@@ -1,13 +1,34 @@
|
||||
# Manual
|
||||
|
||||
This is KolibriOS lua syscalls library. Usually you shouldn't use this library
|
||||
|
||||
Better if you read before [KolibriOS syscalls wiki](http://wiki.kolibrios.org/wiki/)
|
||||
|
||||
include:
|
||||
```lua
|
||||
local syscalls = require("syscalls")
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Events
|
||||
|
||||
### `SetEventMask(newMask)`
|
||||
|
||||
### `CheckEvent()`
|
||||
|
||||
check event
|
||||
|
||||
### `WaitEvent()`
|
||||
|
||||
Endless wait event
|
||||
|
||||
### `WaitEventTimeout(timeout)`
|
||||
|
||||
Wait timeout 1/100 sec
|
||||
|
||||
return event or `nil`
|
||||
|
||||
### Events list
|
||||
|
||||
```lua
|
||||
syscalls.Event.<EventName>
|
||||
```
|
||||
@@ -21,6 +42,62 @@ syscalls.Event.<EventName>
|
||||
+ `IPC`
|
||||
+ `Debug`
|
||||
|
||||
## Window
|
||||
|
||||
### `CreateWindow(x, y, width, height, workColor, style, borderColor, titleColor)`
|
||||
|
||||
Define window
|
||||
|
||||
`borderColor` and `borderColor` only for `FixSizes` and `CanChangeSizes` (without skin styles) style.
|
||||
|
||||
### `StartRedraw()`
|
||||
|
||||
Start window redraw. Just call it before `CreateWindow`
|
||||
|
||||
### `EndRedraw()`
|
||||
|
||||
End window redraw. Just call it after you done redraw window.
|
||||
|
||||
### `ChangeWindow(newX, newY, newWidth, newHeight)`
|
||||
|
||||
### `FocusWindow(slot)`
|
||||
|
||||
### `UnfocusWindow(slot)`
|
||||
|
||||
### `SetWindowTitle(newTitle)`
|
||||
|
||||
### `GetSkinHeight()`
|
||||
|
||||
return skin height.
|
||||
|
||||
### `SetSkin(path)`
|
||||
|
||||
return error code
|
||||
|
||||
### `GetSkinTitleArea()`
|
||||
|
||||
return table:
|
||||
```lua
|
||||
{
|
||||
Left: number,
|
||||
Right: number,
|
||||
Top: number,
|
||||
Bottom: number
|
||||
}
|
||||
```
|
||||
|
||||
### Style
|
||||
|
||||
```lua
|
||||
syscalls.windowStyle.<Value>
|
||||
```
|
||||
|
||||
+ `FixSizes`
|
||||
+ `NoDraw` (you must draw window manually)
|
||||
+ `CanChangeSizes`
|
||||
+ `WithSkin` (usually use it)
|
||||
+ `WithSkinFixSizes` (with skin, but window size fixed)
|
||||
|
||||
## Graphic
|
||||
|
||||
### Text encoding
|
||||
@@ -67,12 +144,217 @@ textSize, textLen, backgroundColor, encoding are optional.
|
||||
|
||||
### `DrawLine(x1, y1, x2, y2)`
|
||||
|
||||
### `DrawRectangle(x, y, w, h color)`
|
||||
### `DrawRectangle(x, y, widht, height, color)`
|
||||
|
||||
### `ReadPoint(x, y)`
|
||||
|
||||
return color
|
||||
|
||||
## Buttons
|
||||
|
||||
### `DefineButton(x, y, widht, height, id, color)`
|
||||
|
||||
### `DeleteButton(id)`
|
||||
|
||||
### `GetButton()`
|
||||
|
||||
return pressed button or `nil`
|
||||
|
||||
### `SetButtonStyle(style)`
|
||||
|
||||
|
||||
### buttons
|
||||
|
||||
button's ids that defined default by window with skin
|
||||
|
||||
```lua
|
||||
syscalls.buttons.<Value>
|
||||
```
|
||||
|
||||
+ `close`
|
||||
+ `minimization`
|
||||
|
||||
### ButtonStyles
|
||||
|
||||
```lua
|
||||
syscalls.buttonStyle.<Value>
|
||||
```
|
||||
|
||||
## Keyboard
|
||||
|
||||
### `GetKey()`
|
||||
|
||||
return:
|
||||
+ nil if buffer empty
|
||||
+ if hotkey return second number
|
||||
+ if key pressed and key input mode is ascii return string(1 char), else return scancode
|
||||
|
||||
example:
|
||||
|
||||
```lua
|
||||
local key, hotkey = syscalls.GetKey()
|
||||
|
||||
if key then
|
||||
print("key pressed")
|
||||
end
|
||||
|
||||
if hotkey then
|
||||
print(hotkey pressed)
|
||||
end
|
||||
```
|
||||
|
||||
### `SetKeyInputMode(mode)`
|
||||
|
||||
by default is `ASCII`
|
||||
|
||||
### `GetKeyInputMode()`
|
||||
|
||||
return key input mode.
|
||||
|
||||
isn't syscall
|
||||
|
||||
### Scancodes
|
||||
|
||||
```lua
|
||||
syscalls.scancode.<Value>
|
||||
```
|
||||
|
||||
+ `A`
|
||||
+ `B`
|
||||
+ `C`
|
||||
+ `D`
|
||||
+ `E`
|
||||
+ `F`
|
||||
+ `G`
|
||||
+ `H`
|
||||
+ `J`
|
||||
+ `K`
|
||||
+ `L`
|
||||
+ `M`
|
||||
+ `O`
|
||||
+ `P`
|
||||
+ `Q`
|
||||
+ `S`
|
||||
+ `T`
|
||||
+ `U`
|
||||
+ `W`
|
||||
+ `X`
|
||||
+ `Y`
|
||||
+ `Z`
|
||||
+ `1`
|
||||
+ `2`
|
||||
+ `3`
|
||||
+ `4`
|
||||
+ `5`
|
||||
+ `6`
|
||||
+ `7`
|
||||
+ `8`
|
||||
+ `9`
|
||||
+ `F1`
|
||||
+ `F2`
|
||||
+ `F3`
|
||||
+ `F4`
|
||||
+ `F5`
|
||||
+ `F6`
|
||||
+ `F7`
|
||||
+ `F8`
|
||||
+ `F9`
|
||||
+ `F10`
|
||||
+ `F11`
|
||||
+ `F12`
|
||||
+ `LeftShift`
|
||||
+ `RightShift`
|
||||
+ `LeftAlt`
|
||||
+ `RightAlt`
|
||||
+ `Tab`
|
||||
|
||||
## SystemColors
|
||||
|
||||
### SystemColors type
|
||||
|
||||
userdata
|
||||
|
||||
#### Fields
|
||||
|
||||
```lua
|
||||
{
|
||||
frameArea: number,
|
||||
grabBar: number,
|
||||
grabBarButton: number,
|
||||
grabButtonText: number
|
||||
grabText: number,
|
||||
workArea: number,
|
||||
workButton: number,
|
||||
workButton: number,
|
||||
workButtonText: number,
|
||||
workGraph: number,
|
||||
workText: number
|
||||
}
|
||||
```
|
||||
|
||||
#### Constructor
|
||||
|
||||
```lua
|
||||
syscalls.SystemColors.new(
|
||||
frameArea,
|
||||
grabBar,
|
||||
grabBarButton,
|
||||
grabButtonText,
|
||||
grabText,
|
||||
workArea,
|
||||
workButton,
|
||||
workButton,
|
||||
workButtonText,
|
||||
workGraph,
|
||||
workText
|
||||
)
|
||||
```
|
||||
|
||||
### `GetSystemColors()`
|
||||
|
||||
return SystemColors
|
||||
|
||||
### `SetSystemColors(SystemColors)`
|
||||
|
||||
## Threads
|
||||
|
||||
### `ThreadInfo(pid)`
|
||||
|
||||
return table:
|
||||
```lua
|
||||
{
|
||||
name: string,
|
||||
pid: number,
|
||||
cpu_usage: number,
|
||||
memused: number,
|
||||
winXPos: number,
|
||||
winYPos: number,
|
||||
winXSize: number,
|
||||
winYPos: number,
|
||||
slotState: number,
|
||||
windowState: number,
|
||||
slotNumWindowStack: number,
|
||||
posInWindowStack: number,
|
||||
keyInputMode: number
|
||||
}
|
||||
```
|
||||
|
||||
### `KillBySlot(slot)`
|
||||
|
||||
### Slot states
|
||||
|
||||
```lua
|
||||
syscalls.slotState.<Value>
|
||||
```
|
||||
|
||||
+ `Running`
|
||||
+ `Suspended`
|
||||
+ `SuspendedWaitEvent`
|
||||
+ `NormalTerm`
|
||||
+ `ExceptTerm`
|
||||
+ `WaitEvent`
|
||||
+ `Free`
|
||||
|
||||
## Sockets
|
||||
|
||||
### `OpenSocket(domain, type, protocol)`
|
||||
@@ -170,4 +452,69 @@ syscalls.SO.<Value>
|
||||
+ `BINDTODEVICE`
|
||||
+ `NONBLOCK`
|
||||
|
||||
## Debug
|
||||
|
||||
### Registers type
|
||||
|
||||
```lua
|
||||
{
|
||||
eax: number
|
||||
ebx: number,
|
||||
esp: number,
|
||||
esi: number,
|
||||
edi: number,
|
||||
eip: number,
|
||||
eflags: number
|
||||
}
|
||||
```
|
||||
|
||||
### `DebugPutc(char)`
|
||||
|
||||
Put char to debug board
|
||||
|
||||
### `DebugPuts(text)`
|
||||
|
||||
Put string to debug board
|
||||
|
||||
### `GetRegisters(pid)`
|
||||
|
||||
The process must be loaded for debugging (as stated in the general description).
|
||||
|
||||
return registers table
|
||||
|
||||
### `SetRegisters(pid, registers)`
|
||||
|
||||
The process must be loaded for debugging (as stated in the general description).
|
||||
|
||||
### `Disconnect(pid)`
|
||||
|
||||
The process must be loaded for debugging (as stated in the general description).
|
||||
|
||||
If the process was suspended, it resumes execution.
|
||||
|
||||
### `Stop(pid)`
|
||||
|
||||
The process must be loaded for debugging (as stated in the general description).
|
||||
|
||||
### `Continue(pid)`
|
||||
|
||||
The process must be loaded for debugging (as stated in the general description).
|
||||
|
||||
### `ReadFromMem(pid, bytes, pointer, buffer)`
|
||||
|
||||
The process must be loaded for debugging (as stated in the general description).
|
||||
|
||||
return or `nil`
|
||||
|
||||
### `WriteToMem(pid, bytes, pointer, buffer)`
|
||||
|
||||
The process must be loaded for debugging (as stated in the general description).
|
||||
|
||||
return or `nil`
|
||||
|
||||
### `Done(pid)`
|
||||
|
||||
### `DefineBreakpoint(pid, index, condition, len)`
|
||||
|
||||
### `UndefBreakpoint(pid, index, condition, len)`
|
||||
|
||||
|
@@ -37,9 +37,8 @@ int syscalls_SetMessageArea(lua_State* L)
|
||||
|
||||
int syscalls_GetRegisters(lua_State* L)
|
||||
{
|
||||
struct registers* r = syscalls_pushRegisters(L);
|
||||
|
||||
uint32_t pid = luaL_checkinteger(L, 1);
|
||||
struct registers* r = syscalls_pushRegisters(L);
|
||||
|
||||
asm_inline(
|
||||
"int $0x40"
|
||||
@@ -59,7 +58,7 @@ int syscalls_SetRegisters(lua_State* L)
|
||||
:: "a"(69), "b"(2), "c"(pid), "d"(sizeof(struct registers)), "S"(r)
|
||||
);
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int syscalls_Disconnect(lua_State* L)
|
||||
@@ -71,7 +70,7 @@ int syscalls_Disconnect(lua_State* L)
|
||||
:: "a"(69), "b"(3), "c"(pid)
|
||||
);
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int syscalls_Stop(lua_State* L)
|
||||
@@ -83,7 +82,7 @@ int syscalls_Stop(lua_State* L)
|
||||
:: "a"(69), "b"(4), "c"(pid)
|
||||
);
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int syscalls_Continue(lua_State* L)
|
||||
@@ -95,7 +94,7 @@ int syscalls_Continue(lua_State* L)
|
||||
:: "a"(69), "b"(5), "c"(pid)
|
||||
);
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int syscalls_ReadFromMem(lua_State* L)
|
||||
@@ -151,7 +150,7 @@ int syscalls_Done(lua_State* L)
|
||||
:: "a"(69), "b"(8), "c"(pid)
|
||||
);
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int syscalls_DefineBreakpoint(lua_State* L)
|
||||
|
@@ -83,7 +83,7 @@ static int syscalls_newindexRegisters(lua_State* L)
|
||||
luaL_error(L, "wrong index: %s", index);
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int syscalls_eqRegisters(lua_State* L)
|
||||
|
@@ -45,53 +45,37 @@ inline void syscalls_push_textSizes(lua_State* L)
|
||||
{
|
||||
lua_newtable(L);
|
||||
|
||||
lua_pushinteger(L, TextScale_SIZE_6x9);
|
||||
lua_setfield(L, -2, "6x9");
|
||||
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_6x9, "6x9");
|
||||
|
||||
lua_pushinteger(L, TextScale_SIZE_8x16);
|
||||
lua_setfield(L, -2, "8x16");
|
||||
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_8x16, "8x16");
|
||||
|
||||
lua_pushinteger(L, TextScale_SIZE_12x18);
|
||||
lua_setfield(L, -2, "12x18");
|
||||
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_12x18, "12x18");
|
||||
|
||||
lua_pushinteger(L, TextScale_SIZE_16x32);
|
||||
lua_setfield(L, -2, "16x32");
|
||||
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_16x32, "16x32");
|
||||
|
||||
lua_pushinteger(L, TextScale_SIZE_18x27);
|
||||
lua_setfield(L, -2, "18x27");
|
||||
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_18x27, "18x27");
|
||||
|
||||
lua_pushinteger(L, TextScale_SIZE_24x36);
|
||||
lua_setfield(L, -2, "24x36");
|
||||
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_24x36, "24x36");
|
||||
|
||||
lua_pushinteger(L, TextScale_SIZE_24x48);
|
||||
lua_setfield(L, -2, "24x48");
|
||||
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_24x48, "24x48");
|
||||
|
||||
lua_pushinteger(L, TextScale_SIZE_30x45);
|
||||
lua_setfield(L, -2, "30x45");
|
||||
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_30x45, "30x45");
|
||||
|
||||
lua_pushinteger(L, TextScale_SIZE_32x64);
|
||||
lua_setfield(L, -2, "32x64");
|
||||
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_32x64, "32x64");
|
||||
|
||||
lua_pushinteger(L, TextScale_SIZE_36x54);
|
||||
lua_setfield(L, -2, "36x54");
|
||||
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_36x54, "36x54");
|
||||
|
||||
lua_pushinteger(L, TextScale_SIZE_40x80);
|
||||
lua_setfield(L, -2, "40x80");
|
||||
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_40x80, "40x80");
|
||||
|
||||
lua_pushinteger(L, TextScale_SIZE_42x63);
|
||||
lua_setfield(L, -2, "42x63");
|
||||
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_42x63, "42x63");
|
||||
|
||||
lua_pushinteger(L, TextScale_SIZE_48x72);
|
||||
lua_setfield(L, -2, "48x72");
|
||||
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_48x72, "48x72");
|
||||
|
||||
lua_pushinteger(L, TextScale_SIZE_48x96);
|
||||
lua_setfield(L, -2, "48x96");
|
||||
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_48x96, "48x96");
|
||||
|
||||
lua_pushinteger(L, TextScale_SIZE_56x112);
|
||||
lua_setfield(L, -2, "56x112");
|
||||
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_56x112, "56x112");
|
||||
|
||||
lua_pushinteger(L, TextScale_SIZE_64x128);
|
||||
lua_setfield(L, -2, "64x128");
|
||||
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_64x128, "64x128");
|
||||
|
||||
lua_setfield(L, -2, "textSize");
|
||||
}
|
||||
@@ -100,21 +84,17 @@ inline void syscalls_push_Encoding(lua_State* L)
|
||||
{
|
||||
lua_newtable(L);
|
||||
|
||||
lua_pushinteger(L, cp866);
|
||||
lua_setfield(L, -2, "cp866");
|
||||
LUA_PUSH_INTEGER_FIELD(L, cp866, "cp866");
|
||||
|
||||
lua_pushinteger(L, cp866_8x16);
|
||||
lua_setfield(L, -2, "cp866_8x16");
|
||||
LUA_PUSH_INTEGER_FIELD(L, cp866_8x16, "cp866_8x16");
|
||||
|
||||
lua_pushinteger(L, utf8);
|
||||
lua_setfield(L, -2, "utf8");
|
||||
LUA_PUSH_INTEGER_FIELD(L, utf8, "utf8");
|
||||
|
||||
lua_pushinteger(L, utf16);
|
||||
lua_setfield(L, -2, "utf16");
|
||||
LUA_PUSH_INTEGER_FIELD(L, utf16, "utf16");
|
||||
|
||||
lua_setfield(L, -2, "Encoding");
|
||||
}
|
||||
|
||||
#define syscalls_push_graphic(L) syscalls_push_textSizes(L); syscalls_push_Encoding(L);
|
||||
|
||||
#endif // __GRAPHIC_H__
|
||||
#endif // __GRAPHIC_H_
|
261
src/scancodes.h
261
src/scancodes.h
@@ -10,266 +10,179 @@ static inline void syscalls_register_scancodes(lua_State* L)
|
||||
{
|
||||
lua_newtable(L);
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_0);
|
||||
lua_setfield(L, -2, "0");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_0, "0");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_1);
|
||||
lua_setfield(L, -2, "1");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_1, "1");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_2);
|
||||
lua_setfield(L, -2, "2");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_2, "2");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_3);
|
||||
lua_setfield(L, -2, "3");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_3, "3");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_4);
|
||||
lua_setfield(L, -2, "4");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_4, "5");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_5);
|
||||
lua_setfield(L, -2, "6");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_5, "6");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_7);
|
||||
lua_setfield(L, -2, "7");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_7, "7");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_8);
|
||||
lua_setfield(L, -2, "8");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_8, "8");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_9);
|
||||
lua_setfield(L, -2, "9");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_9, "9");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_A);
|
||||
lua_setfield(L, -2, "A");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_A, "A");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_B);
|
||||
lua_setfield(L, -2, "B");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_B, "B");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_C);
|
||||
lua_setfield(L, -2, "C");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_C, "C");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_D);
|
||||
lua_setfield(L, -2, "D");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_D, "D");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_E);
|
||||
lua_setfield(L, -2, "E");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_E, "E");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_F);
|
||||
lua_setfield(L, -2, "F");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F, "F");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_G);
|
||||
lua_setfield(L, -2, "G");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_G, "G");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_H);
|
||||
lua_setfield(L, -2, "H");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_H, "H");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_J);
|
||||
lua_setfield(L, -2, "J");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_J, "J");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_K);
|
||||
lua_setfield(L, -2, "K");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_K, "K");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_L);
|
||||
lua_setfield(L, -2, "L");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_L, "L");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_M);
|
||||
lua_setfield(L, -2, "M");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_M, "M");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_N);
|
||||
lua_setfield(L, -2, "N");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_N, "N");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_O);
|
||||
lua_setfield(L, -2, "O");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_O, "O");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_P);
|
||||
lua_setfield(L, -2, "P");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_P, "P");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_Q);
|
||||
lua_setfield(L, -2, "Q");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_Q, "Q");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_R);
|
||||
lua_setfield(L, -2, "R");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_R, "R");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_S);
|
||||
lua_setfield(L, -2, "S");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_S, "S");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_T);
|
||||
lua_setfield(L, -2, "T");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_T, "T");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_U);
|
||||
lua_setfield(L, -2, "U");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_U, "U");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_V);
|
||||
lua_setfield(L, -2, "V");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_V, "V");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_W);
|
||||
lua_setfield(L, -2, "W");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_W, "W");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_X);
|
||||
lua_setfield(L, -2, "X");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_X, "X");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_Y);
|
||||
lua_setfield(L, -2, "Y");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_Y, "Y");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_Z);
|
||||
lua_setfield(L, -2, "Z");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_Z, "Z");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_F1);
|
||||
lua_setfield(L, -2, "F1");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F1, "F1");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_F2);
|
||||
lua_setfield(L, -2, "F2");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F2, "F2");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_F3);
|
||||
lua_setfield(L, -2, "F3");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F3, "F3");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_F4);
|
||||
lua_setfield(L, -2, "F4");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F4, "F4");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_F5);
|
||||
lua_setfield(L, -2, "F5");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F5, "F5");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_F6);
|
||||
lua_setfield(L, -2, "F6");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F6, "F6");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_F7);
|
||||
lua_setfield(L, -2, "F7");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F7, "F7");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_F8);
|
||||
lua_setfield(L, -2, "F8");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F8, "F8");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_F9);
|
||||
lua_setfield(L, -2, "F9");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F9, "F9");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_F10);
|
||||
lua_setfield(L, -2, "F10");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F10, "F10");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_F11);
|
||||
lua_setfield(L, -2, "F11");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F11, "F11");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_F12);
|
||||
lua_setfield(L, -2, "F12");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F12, "F12");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_LSHIFT);
|
||||
lua_setfield(L, -2, "LeftShift");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_LSHIFT, "LeftShift");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_RSHIFT);
|
||||
lua_setfield(L, -2, "RightShift");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_RSHIFT, "RightShift");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_BACKSLASH);
|
||||
lua_setfield(L, -2, "Backslash");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_BACKSLASH, "Backslash");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_COMMA);
|
||||
lua_setfield(L, -2, "Comma");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_COMMA, "Comma");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_SLASH);
|
||||
lua_setfield(L, -2, "Slash");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_SLASH, "Slash");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_LALT);
|
||||
lua_setfield(L, -2, "LeftAlt");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_LALT, "LeftAlt");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_RALT);
|
||||
lua_setfield(L, -2, "RightAlt");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_RALT, "RightAlt");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_LCTRL);
|
||||
lua_setfield(L, -2, "LeftCtrl");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_LCTRL, "LeftCtrl");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_RCTRL);
|
||||
lua_setfield(L, -2, "RightCtrl");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_RCTRL, "RightCtrl");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_CAPSLOCK);
|
||||
lua_setfield(L, -2, "CapsLock");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_CAPSLOCK, "CapsLock");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_NUMLOCK);
|
||||
lua_setfield(L, -2, "NumLock");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMLOCK, "NumLock");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_POINT);
|
||||
lua_setfield(L, -2, "Point");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_POINT, "Point");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_ENTER);
|
||||
lua_setfield(L, -2, "Enter");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_ENTER, "Enter");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_ESC);
|
||||
lua_setfield(L, -2, "Esc");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_ESC, "Esc");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_TAB);
|
||||
lua_setfield(L, -2, "Tab");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_TAB, "Tab");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_HOME);
|
||||
lua_setfield(L, -2, "Home");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_HOME, "Home");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_PGUP);
|
||||
lua_setfield(L, -2, "PageUp");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_PGUP, "PageUp");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_PGDOWN);
|
||||
lua_setfield(L, -2, "PageDown");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_PGDOWN, "PageDown");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_END);
|
||||
lua_setfield(L, -2, "End");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_END, "End");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_UP);
|
||||
lua_setfield(L, -2, "Up");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_UP, "Up");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_DOWN);
|
||||
lua_setfield(L, -2, "Down");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_DOWN, "Down");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_LEFT);
|
||||
lua_setfield(L, -2, "Left");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_LEFT, "Left");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_RIGHT);
|
||||
lua_setfield(L, -2, "Right");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_RIGHT, "Right");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_DELETE);
|
||||
lua_setfield(L, -2, "Delete");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_DELETE, "Delete");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_INSERT);
|
||||
lua_setfield(L, -2, "Insert");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_INSERT, "Insert");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_MINUS);
|
||||
lua_setfield(L, -2, "Minus");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_MINUS, "Minus");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_NUMPAD_ENTER);
|
||||
lua_setfield(L, -2, "NumpadEnter");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_NUMPAD_ENTER, "NumpadEnter");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_NUMPAD_DIV);
|
||||
lua_setfield(L, -2, "NumpadDiv");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_NUMPAD_DIV, "NumpadDiv");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_MULT);
|
||||
lua_setfield(L, -2, "NumpadMult");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_MULT, "NumpadMult");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_MINUS);
|
||||
lua_setfield(L, -2, "NumpadMinus");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_MINUS, "NumpadMinus");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_PLUS);
|
||||
lua_setfield(L, -2, "NumpadPlus");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_PLUS, "NumpadPlus");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_0);
|
||||
lua_setfield(L, -2, "Numpad_0");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_0, "Numpad_0");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_1);
|
||||
lua_setfield(L, -2, "Numpad_1");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_1, "Numpad_1");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_2);
|
||||
lua_setfield(L, -2, "Numpad_2");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_2, "Numpad_2");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_3);
|
||||
lua_setfield(L, -2, "Numpad_3");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_3, "Numpad_3");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_4);
|
||||
lua_setfield(L, -2, "Numpad_4");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_4, "Numpad_4");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_5);
|
||||
lua_setfield(L, -2, "Numpad_5");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_5, "Numpad_5");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_6);
|
||||
lua_setfield(L, -2, "Numpad_6");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_6, "Numpad_6");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_7);
|
||||
lua_setfield(L, -2, "Numpad_7");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_7, "Numpad_7");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_8);
|
||||
lua_setfield(L, -2, "Numpad_8");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_8, "Numpad_8");
|
||||
|
||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_9);
|
||||
lua_setfield(L, -2, "Numpad_9");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_9, "Numpad_9");
|
||||
|
||||
lua_setfield(L, -2, "scancode");
|
||||
}
|
||||
|
227
src/syscalls.c
227
src/syscalls.c
@@ -95,6 +95,7 @@ static int syscalls_endRedraw(lua_State* L)
|
||||
static int syscalls_SetSkin(lua_State* L)
|
||||
{
|
||||
unsigned ret;
|
||||
|
||||
asm_inline(
|
||||
"int $0x40"
|
||||
: "=a"(ret)
|
||||
@@ -139,34 +140,39 @@ static int syscalls_SetWorkArea(lua_State* L)
|
||||
uint32_t bottom = luaL_checkinteger(L, 4);
|
||||
|
||||
asm_inline(
|
||||
"int $0x40" ::"a"(48), "b"(6), "c"(left * 65536 + right), "d"(top * 65536 + bottom));
|
||||
"int $0x40" ::
|
||||
"a"(48),
|
||||
"b"(6),
|
||||
"c"((left << 16) | right),
|
||||
"d"((top << 16) | bottom)
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int syscalls_GetWorkArea(lua_State* L)
|
||||
{
|
||||
ksys_pos_t leftlright;
|
||||
ksys_pos_t toplbottom;
|
||||
ksys_pos_t leftAndRight;
|
||||
ksys_pos_t topAndBottom;
|
||||
|
||||
asm_inline(
|
||||
"int $0x40"
|
||||
:"=a"(leftlright), "=b"(toplbottom)
|
||||
:"=a"(leftAndRight), "=b"(topAndBottom)
|
||||
: "a"(48), "b"(5)
|
||||
);
|
||||
|
||||
lua_createtable(L, 0, 4);
|
||||
|
||||
lua_pushinteger(L, leftlright.x);
|
||||
lua_pushinteger(L, leftAndRight.x);
|
||||
lua_setfield(L, -2, "Left");
|
||||
|
||||
lua_pushinteger(L, leftlright.y);
|
||||
lua_pushinteger(L, leftAndRight.y);
|
||||
lua_setfield(L, -2, "Right");
|
||||
|
||||
lua_pushinteger(L, toplbottom.x);
|
||||
lua_pushinteger(L, topAndBottom.x);
|
||||
lua_setfield(L, -2, "Top");
|
||||
|
||||
lua_pushinteger(L, toplbottom.y);
|
||||
lua_pushinteger(L, topAndBottom.y);
|
||||
lua_setfield(L, -2, "Bottom");
|
||||
|
||||
return 1;
|
||||
@@ -195,6 +201,7 @@ static int syscalls_deleteButton(lua_State* L)
|
||||
static int syscalls_SetButtonsStyle(lua_State* L)
|
||||
{
|
||||
uint32_t style = luaL_checkinteger(L, 1);
|
||||
|
||||
asm_inline(
|
||||
"int $0x40" ::"a"(48), "b"(1), "c"(style));
|
||||
|
||||
@@ -246,50 +253,49 @@ static int syscalls_threadInfo(lua_State* L)
|
||||
lua_createtable(L, 0, 13);
|
||||
|
||||
lua_pushstring(L, t.name);
|
||||
lua_setfield(L, -2, "name");
|
||||
lua_setfield(L, -2, "Name");
|
||||
|
||||
lua_pushinteger(L, t.cpu_usage);
|
||||
lua_setfield(L, -2, "cpu_usage");
|
||||
lua_setfield(L, -2, "CpuUsage");
|
||||
|
||||
lua_pushinteger(L, t.memused);
|
||||
lua_setfield(L, -2, "memused");
|
||||
lua_setfield(L, -2, "MemUsed");
|
||||
|
||||
lua_pushinteger(L, t.pid);
|
||||
lua_setfield(L, -2, "pid");
|
||||
lua_setfield(L, -2, "PID");
|
||||
|
||||
lua_pushinteger(L, t.key_input_mode);
|
||||
lua_setfield(L, -2, "keyInputMode");
|
||||
lua_setfield(L, -2, "KeyInputMode");
|
||||
|
||||
lua_pushinteger(L, t.pos_in_window_stack);
|
||||
lua_setfield(L, -2, "posInWindowStack");
|
||||
lua_setfield(L, -2, "PosInWindowStack");
|
||||
|
||||
lua_pushinteger(L, t.slot_num_window_stack);
|
||||
lua_setfield(L, -2, "slotNumWindowStack");
|
||||
lua_setfield(L, -2, "SlotNumWindowStack");
|
||||
|
||||
lua_pushinteger(L, t.slot_state);
|
||||
lua_setfield(L, -2, "slotState");
|
||||
lua_setfield(L, -2, "SlotState");
|
||||
|
||||
lua_pushinteger(L, t.window_state);
|
||||
lua_setfield(L, -2, "windowState");
|
||||
lua_setfield(L, -2, "WindowState");
|
||||
|
||||
lua_pushinteger(L, t.winx_size);
|
||||
lua_setfield(L, -2, "winXSize");
|
||||
lua_setfield(L, -2, "WinXSize");
|
||||
|
||||
lua_pushinteger(L, t.winy_size);
|
||||
lua_setfield(L, -2, "winYSize");
|
||||
lua_setfield(L, -2, "WinYSize");
|
||||
|
||||
lua_pushinteger(L, t.winx_start);
|
||||
lua_setfield(L, -2, "winXPos");
|
||||
lua_setfield(L, -2, "WinXPos");
|
||||
|
||||
lua_pushinteger(L, t.winy_start);
|
||||
lua_setfield(L, -2, "winYPos");
|
||||
lua_setfield(L, -2, "WinYPos");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int syscalls_KillBySlot(lua_State* L)
|
||||
{
|
||||
|
||||
_ksys_kill_by_slot(
|
||||
luaL_checkinteger(L, 1));
|
||||
|
||||
@@ -319,7 +325,10 @@ static int syscalls_checkEvent(lua_State* L)
|
||||
|
||||
static int syscalls_waitEventTimeout(lua_State* L)
|
||||
{
|
||||
lua_pushinteger(L, _ksys_wait_event_timeout(luaL_checkinteger(L, 1)));
|
||||
lua_pushinteger(
|
||||
L,
|
||||
_ksys_wait_event_timeout(luaL_checkinteger(L, 1))
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -688,7 +697,7 @@ static int syscalls_getMouseEvents(lua_State* L)
|
||||
createMouseState(state, L);
|
||||
|
||||
lua_pushboolean(L, state & (1 << 8));
|
||||
lua_setfield(L, -2, "getMouseEvents");
|
||||
lua_setfield(L, -2, "LeftButtonPressed");
|
||||
|
||||
lua_pushboolean(L, state & (1 << 9));
|
||||
lua_setfield(L, -2, "RightButtonPressed");
|
||||
@@ -756,13 +765,13 @@ static int syscalls_GetMouseSettings(lua_State* L)
|
||||
lua_createtable(L, 0, 3);
|
||||
|
||||
lua_pushinteger(L, getMouseSettings(KSYS_MOUSE_GET_SPEED));
|
||||
lua_setfield(L, -2, "speed");
|
||||
lua_setfield(L, -2, "Speed");
|
||||
|
||||
lua_pushinteger(L, getMouseSettings(KSYS_MOUSE_GET_SENS));
|
||||
lua_setfield(L, -2, "sensitivity");
|
||||
lua_setfield(L, -2, "Sensitivity");
|
||||
|
||||
lua_pushinteger(L, getMouseSettings(KSYS_MOUSE_GET_DOUBLE_CLICK_DELAY));
|
||||
lua_setfield(L, -2, "doubleClickDelay");
|
||||
lua_setfield(L, -2, "DoubleClickDelay");
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -825,7 +834,7 @@ static int syscalls_SetMouseSettings(lua_State* L)
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
|
||||
lua_getfield(L, 1, "Speed");
|
||||
lua_getfield(L, 1, "Sens");
|
||||
lua_getfield(L, 1, "Sensitivity");
|
||||
lua_getfield(L, 1, "DoubleClickDelay");
|
||||
|
||||
_ksys_set_mouse_settings(KSYS_MOUSE_GET_SPEED, luaL_checkinteger(L, -3));
|
||||
@@ -985,10 +994,7 @@ static int syscalls_GetTXByteCount(lua_State* L)
|
||||
: "=a"(num), "=b"(NUM)
|
||||
: "a"(74), "b"(8 | device << 8));
|
||||
|
||||
if (num == -1)
|
||||
lua_pushnil(L);
|
||||
else
|
||||
lua_pushinteger(L, (uint64_t)(num | NUM << 31));
|
||||
syscalls_ReturnIntegerValueOrNil(num, num | NUM << 31, L);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1004,10 +1010,7 @@ static int syscalls_GetRXByteCount(lua_State* L)
|
||||
: "=a"(num), "=b"(NUM)
|
||||
: "a"(74), "b"(9 | device << 8));
|
||||
|
||||
if (num == -1)
|
||||
lua_pushnil(L);
|
||||
else
|
||||
lua_pushinteger(L, (uint64_t)(num | NUM << 31));
|
||||
syscalls_ReturnIntegerValueOrNil(num, num | NUM << 31, L);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1023,10 +1026,7 @@ static int syscalls_GetTXErrorPacketCount(lua_State* L)
|
||||
: "=a"(num), "=b"(NUM)
|
||||
: "a"(74), "b"(11 | device << 8));
|
||||
|
||||
if (num == -1)
|
||||
lua_pushnil(L);
|
||||
else
|
||||
lua_pushinteger(L, (uint64_t)(num | NUM << 31));
|
||||
syscalls_ReturnIntegerValueOrNil(num, num | NUM << 31, L);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1042,10 +1042,7 @@ static int syscalls_GetTXDropPacketCount(lua_State* L)
|
||||
: "=a"(num), "=b"(NUM)
|
||||
: "a"(74), "b"(12 | device << 8));
|
||||
|
||||
if (num == -1)
|
||||
lua_pushnil(L);
|
||||
else
|
||||
lua_pushinteger(L, (uint64_t)(num | NUM << 31));
|
||||
syscalls_ReturnIntegerValueOrNil(num, num | NUM << 31, L);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1061,10 +1058,7 @@ static int syscalls_GetTXMissPacketCount(lua_State* L)
|
||||
: "=a"(num), "=b"(NUM)
|
||||
: "a"(74), "b"(13 | device << 8));
|
||||
|
||||
if (num == -1)
|
||||
lua_pushnil(L);
|
||||
else
|
||||
lua_pushinteger(L, (uint64_t)(num | NUM << 31));
|
||||
syscalls_ReturnIntegerValueOrNil(num, num | NUM << 31, L);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1080,10 +1074,7 @@ static int syscalls_GetRXErrorPacketCount(lua_State* L)
|
||||
: "=a"(num), "=b"(NUM)
|
||||
: "a"(74), "b"(14 | device << 8));
|
||||
|
||||
if (num == -1)
|
||||
lua_pushnil(L);
|
||||
else
|
||||
lua_pushinteger(L, (uint64_t)(num | NUM << 31));
|
||||
syscalls_ReturnIntegerValueOrNil(num, num | NUM << 31, L);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1144,6 +1135,7 @@ static int syscalls_GetConnectionStatus(lua_State* L)
|
||||
lua_pushnil(L);
|
||||
else
|
||||
lua_pushinteger(L, num & 0x101);
|
||||
|
||||
lua_pushinteger(L, (num & FullDuplex) != 0);
|
||||
|
||||
return 2;
|
||||
@@ -1420,7 +1412,7 @@ static int syscalls_ReadARPEntry(lua_State* L)
|
||||
if (eax == -1)
|
||||
lua_pushnil(L);
|
||||
else
|
||||
memcpy(syscalls_pushARPEntry(L), &buffer, sizeof(struct ARP_entry));
|
||||
memcpy(syscalls_pushARPEntry(L), &buffer, sizeof(struct ARP_entry)); // не самый лучший вариант реализации, но если если запушить в луа это раньше то как потом запушить nil? хз может потому будут идеи более адекватной реализации
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1539,8 +1531,8 @@ static const luaL_Reg syscallsLib[] = {
|
||||
/* keyboard funcs */
|
||||
{"SetKeyInputMode", syscalls_setKeyInputMode},
|
||||
{"GetKeyInputMode", syscalls_getKeyInputMode},
|
||||
{"getKey", syscalls_getKey},
|
||||
{"getControlKeyState", syscalls_getControlKeyState},
|
||||
{"GetKey", syscalls_getKey},
|
||||
{"GetControlKeyState", syscalls_getControlKeyState},
|
||||
{"SetHotkey", syscalls_SetHotkey},
|
||||
{"DeleteHotkey", syscalls_DeleteHotkey},
|
||||
{"LockNormalInput", syscalls_LockNormalInput},
|
||||
@@ -1643,35 +1635,25 @@ static inline void syscalls_push_events(lua_State* L)
|
||||
{
|
||||
lua_newtable(L);
|
||||
|
||||
lua_pushinteger(L, KSYS_EVENT_NONE);
|
||||
lua_setfield(L, -2, "None");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_NONE, "None");
|
||||
|
||||
lua_pushinteger(L, KSYS_EVENT_REDRAW);
|
||||
lua_setfield(L, -2, "Redraw");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_REDRAW, "Redraw");
|
||||
|
||||
lua_pushinteger(L, KSYS_EVENT_KEY);
|
||||
lua_setfield(L, -2, "Key");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_KEY, "Key");
|
||||
|
||||
lua_pushinteger(L, KSYS_EVENT_BUTTON);
|
||||
lua_setfield(L, -2, "Button");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_BUTTON, "Button");
|
||||
|
||||
lua_pushinteger(L, KSYS_EVENT_DESKTOP);
|
||||
lua_setfield(L, -2, "Desktop");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_DESKTOP, "Desktop");
|
||||
|
||||
lua_pushinteger(L, KSYS_EVENT_MOUSE);
|
||||
lua_setfield(L, -2, "Mouse");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_MOUSE, "Mouse");
|
||||
|
||||
lua_pushinteger(L, KSYS_EVENT_IPC);
|
||||
lua_setfield(L, -2, "IPC");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_IPC, "IPC");
|
||||
|
||||
lua_pushinteger(L, KSYS_EVENT_NETWORK);
|
||||
lua_setfield(L, -2, "Network");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_NETWORK, "Network");
|
||||
|
||||
lua_pushinteger(L, KSYS_EVENT_DEBUG);
|
||||
lua_setfield(L, -2, "Debug");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_DEBUG, "Debug");
|
||||
|
||||
lua_pushinteger(L, KSYS_EVENT_IRQBEGIN);
|
||||
lua_setfield(L, -2, "IRQBegin");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_IRQBEGIN, "IRQBegin");
|
||||
|
||||
lua_setfield(L, -2, "Event");
|
||||
}
|
||||
@@ -1680,20 +1662,15 @@ static inline void syscalls_push_buttonCodes(lua_State* L)
|
||||
{
|
||||
lua_newtable(L);
|
||||
|
||||
lua_pushinteger(L, KSYS_MOUSE_LBUTTON_PRESSED);
|
||||
lua_setfield(L, -2, "LeftButton");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_MOUSE_LBUTTON_PRESSED, "LeftButton");
|
||||
|
||||
lua_pushinteger(L, KSYS_MOUSE_RBUTTON_PRESSED);
|
||||
lua_setfield(L, -2, "RightButton");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_MOUSE_RBUTTON_PRESSED, "RightButton");
|
||||
|
||||
lua_pushinteger(L, KSYS_MOUSE_MBUTTON_PRESSED);
|
||||
lua_setfield(L, -2, "MiddleButton");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_MOUSE_MBUTTON_PRESSED, "MiddleButton");
|
||||
|
||||
lua_pushinteger(L, KSYS_MOUSE_4BUTTON_PRESSED);
|
||||
lua_setfield(L, -2, "Button4");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_MOUSE_4BUTTON_PRESSED, "Button4");
|
||||
|
||||
lua_pushinteger(L, KSYS_MOUSE_5BUTTON_PRESSED);
|
||||
lua_setfield(L, -2, "Button5");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_MOUSE_5BUTTON_PRESSED, "Button5");
|
||||
|
||||
lua_setfield(L, -2, "mouseButtons");
|
||||
}
|
||||
@@ -1702,26 +1679,19 @@ static inline void syscalls_push_slotStates(lua_State* L)
|
||||
{
|
||||
lua_newtable(L);
|
||||
|
||||
lua_pushinteger(L, KSYS_SLOT_STATE_RUNNING);
|
||||
lua_setfield(L, -2, "Running");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SLOT_STATE_RUNNING, "Running");
|
||||
|
||||
lua_pushinteger(L, KSYS_SLOT_STATE_SUSPENDED);
|
||||
lua_setfield(L, -2, "Suspended");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SLOT_STATE_SUSPENDED, "Suspended");
|
||||
|
||||
lua_pushinteger(L, KSYS_SLOT_STATE_SUSPENDED_WAIT_EVENT);
|
||||
lua_setfield(L, -2, "SuspendedWaitEvent");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SLOT_STATE_SUSPENDED_WAIT_EVENT, "SuspendedWaitEvent");
|
||||
|
||||
lua_pushinteger(L, KSYS_SLOT_STATE_NORMAL_TERM);
|
||||
lua_setfield(L, -2, "NormalTerm");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SLOT_STATE_NORMAL_TERM, "NormalTerm");
|
||||
|
||||
lua_pushinteger(L, KSYS_SLOT_STATE_EXCEPT_TERM);
|
||||
lua_setfield(L, -2, "ExceptTerm");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SLOT_STATE_EXCEPT_TERM, "ExceptTerm");
|
||||
|
||||
lua_pushinteger(L, KSYS_SLOT_STATE_EXCEPT_TERM);
|
||||
lua_setfield(L, -2, "WaitEvent");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SLOT_STATE_EXCEPT_TERM, "WaitEvent");
|
||||
|
||||
lua_pushinteger(L, KSYS_SLOT_STATE_WAIT_EVENT);
|
||||
lua_setfield(L, -2, "Free");
|
||||
LUA_PUSH_INTEGER_FIELD(L, KSYS_SLOT_STATE_WAIT_EVENT, "Free");
|
||||
|
||||
lua_setfield(L, -2, "slotState");
|
||||
}
|
||||
@@ -1730,21 +1700,15 @@ static inline void syscalls_push_hotkey_states(lua_State* L)
|
||||
{
|
||||
lua_newtable(L);
|
||||
|
||||
lua_pushinteger(L, 0);
|
||||
lua_setfield(L, -2, "hotkeyNoOne");
|
||||
LUA_PUSH_INTEGER_FIELD(L, 0, "NoOne");
|
||||
|
||||
lua_pushinteger(L, 1);
|
||||
lua_setfield(L, -2, "hotkeyOnlyOne");
|
||||
LUA_PUSH_INTEGER_FIELD(L, 1, "OnlyOne");
|
||||
|
||||
lua_pushinteger(L, 2);
|
||||
lua_setfield(L, -2, "hotkeyBoth");
|
||||
LUA_PUSH_INTEGER_FIELD(L, 2, "Both");
|
||||
|
||||
lua_pushinteger(L, 4);
|
||||
lua_setfield(L, -2, "hotkeyLeftOnly");
|
||||
|
||||
lua_pushinteger(L, 5);
|
||||
lua_setfield(L, -2, "hotkeyRightOnly");
|
||||
LUA_PUSH_INTEGER_FIELD(L, 4, "LeftOnly");
|
||||
|
||||
LUA_PUSH_INTEGER_FIELD(L, 5, "RightOnly");
|
||||
|
||||
lua_setfield(L, -2, "hotkeyStates");
|
||||
}
|
||||
@@ -1753,12 +1717,9 @@ static inline void syscalls_push_buttonsStyle(lua_State* L)
|
||||
{
|
||||
lua_newtable(L);
|
||||
|
||||
lua_pushinteger(L, 0);
|
||||
lua_setfield(L, -2, "ButtonStyleFlat");
|
||||
|
||||
lua_pushinteger(L, 1);
|
||||
lua_setfield(L, -2, "ButtonStyleVolume");
|
||||
LUA_PUSH_INTEGER_FIELD(L, 0, "Flat");
|
||||
|
||||
LUA_PUSH_INTEGER_FIELD(L, 1, "Volume");
|
||||
|
||||
lua_setfield(L, -2, "buttonStyle");
|
||||
}
|
||||
@@ -1767,20 +1728,15 @@ static inline void syscalls_push_windowStyles(lua_State* L)
|
||||
{
|
||||
lua_newtable(L);
|
||||
|
||||
lua_pushinteger(L, 0);
|
||||
lua_setfield(L, -2, "FixSizes");
|
||||
LUA_PUSH_INTEGER_FIELD(L, 0, "FixSizes");
|
||||
|
||||
lua_pushinteger(L, 1);
|
||||
lua_setfield(L, -2, "NoDraw");
|
||||
LUA_PUSH_INTEGER_FIELD(L, 1, "NoDraw");
|
||||
|
||||
lua_pushinteger(L, 2);
|
||||
lua_setfield(L, -2, "CanChangeSizes");
|
||||
LUA_PUSH_INTEGER_FIELD(L, 2, "CanChangeSizes");
|
||||
|
||||
lua_pushinteger(L, 3);
|
||||
lua_setfield(L, -2, "WithSkin");
|
||||
LUA_PUSH_INTEGER_FIELD(L, 3, "WithSkin");
|
||||
|
||||
lua_pushinteger(L, 4);
|
||||
lua_setfield(L, -2, "WithSkinFixSizes");
|
||||
LUA_PUSH_INTEGER_FIELD(L, 4, "WithSkinFixSizes");
|
||||
|
||||
lua_setfield(L, -2, "windowStyle");
|
||||
}
|
||||
@@ -1789,11 +1745,9 @@ static inline void syscalls_push_buttons(lua_State* L)
|
||||
{
|
||||
lua_newtable(L);
|
||||
|
||||
lua_pushinteger(L, 0xffff);
|
||||
lua_setfield(L, -2, "minimization");
|
||||
LUA_PUSH_INTEGER_FIELD(L, 0xffff, "minimization");
|
||||
|
||||
lua_pushinteger(L, 1);
|
||||
lua_setfield(L, -2, "close");
|
||||
LUA_PUSH_INTEGER_FIELD(L, 1, "close");
|
||||
|
||||
lua_setfield(L, -2, "buttons");
|
||||
}
|
||||
@@ -1802,20 +1756,15 @@ static inline void syscalls_push_connectionStatus(lua_State* L)
|
||||
{
|
||||
lua_newtable(L);
|
||||
|
||||
lua_pushinteger(L, NoConnect);
|
||||
lua_setfield(L, -2, "no");
|
||||
LUA_PUSH_INTEGER_FIELD(L, NoConnect, "No");
|
||||
|
||||
lua_pushinteger(L, Unknown);
|
||||
lua_setfield(L, -2, "unknown");
|
||||
LUA_PUSH_INTEGER_FIELD(L, Unknown, "Unknown");
|
||||
|
||||
lua_pushinteger(L, Mb10);
|
||||
lua_setfield(L, -2, "10Mb");
|
||||
LUA_PUSH_INTEGER_FIELD(L, Mb10, "10Mb");
|
||||
|
||||
lua_pushinteger(L, Mb100);
|
||||
lua_setfield(L, -2, "100Mb");
|
||||
LUA_PUSH_INTEGER_FIELD(L, Mb100, "100Mb");
|
||||
|
||||
lua_pushinteger(L, Gb);
|
||||
lua_setfield(L, -2, "1Gb");
|
||||
LUA_PUSH_INTEGER_FIELD(L, Gb, "1GB");
|
||||
|
||||
lua_setfield(L, -2, "connectionStatus");
|
||||
}
|
||||
|
@@ -53,4 +53,8 @@ inline void syscalls_ReturnStringOrNil(LUA_INTEGER cond, const char* value, lua_
|
||||
}
|
||||
}
|
||||
|
||||
#define LUA_PUSH_INTEGER_FIELD(L, val, name) lua_pushinteger(L, val); lua_setfield(L, -2, name);
|
||||
#define LUA_PUSH_STRING_FIELD(L, val, name) lua_pushstring(L, val); lua_setfield(L, -2, name);
|
||||
#define LUA_PUSH_NUMBER_FIELD(L, val, name) lua_pushnumber(L, val); lua_setfield(L, -2, name);
|
||||
|
||||
#endif // __SYSCALLS_H__
|
||||
|
145
tests/calc.lua
Normal file
145
tests/calc.lua
Normal file
@@ -0,0 +1,145 @@
|
||||
local syscalls = require("syscalls")
|
||||
|
||||
local systemColors = syscalls.GetSystemColors()
|
||||
local skinHeight = syscalls.GetSkinHeight()
|
||||
|
||||
local display = "0"
|
||||
local ans = "0"
|
||||
|
||||
local buttons = {
|
||||
{"1", "2", "3", "+", "-"},
|
||||
{"4", "5", "6", "*", "/"},
|
||||
{"7", "8", "9", "%", ""},
|
||||
{"0", ".", "Ans", "="}
|
||||
}
|
||||
|
||||
local function DrawDisplay()
|
||||
syscalls.DrawText(
|
||||
display,
|
||||
20,
|
||||
20 + skinHeight,
|
||||
systemColors.workText
|
||||
)
|
||||
end
|
||||
|
||||
local function redraw()
|
||||
syscalls.StartRedraw()
|
||||
|
||||
syscalls.CreateWindow(
|
||||
100,
|
||||
100,
|
||||
200,
|
||||
256,
|
||||
"lua example Calc",
|
||||
systemColors.workArea,
|
||||
syscalls.windowStyle.WithSkinFixSizes
|
||||
)
|
||||
|
||||
DrawDisplay()
|
||||
|
||||
--local t = syscalls.ThreadInfo()
|
||||
|
||||
local i = 2
|
||||
local h = math.floor(150 / #buttons)
|
||||
|
||||
for rowN, row in pairs(buttons) do
|
||||
|
||||
local w = math.floor(200 / #row)
|
||||
|
||||
for col, v in pairs(row) do
|
||||
|
||||
local x = math.floor((col-1) * w)
|
||||
local y = math.floor((rowN-1) * h + 50 + skinHeight)
|
||||
|
||||
syscalls.DefineButton(
|
||||
x,
|
||||
y,
|
||||
w,
|
||||
h,
|
||||
i,
|
||||
systemColors.workButton
|
||||
)
|
||||
|
||||
syscalls.DrawText(
|
||||
v,
|
||||
x,
|
||||
y,
|
||||
systemColors.workButtonText
|
||||
)
|
||||
|
||||
i=i+1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
syscalls.EndRedraw()
|
||||
end
|
||||
|
||||
local function CheckButton(ButtonID)
|
||||
local i = 2
|
||||
for k, v in pairs(buttons) do
|
||||
for j, s in pairs(v) do
|
||||
if ButtonID ~= i then
|
||||
i = i + 1
|
||||
else
|
||||
return s
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
local function checkInput(s)
|
||||
if s == "=" then
|
||||
display = assert(load( "return " .. display))()
|
||||
ans = display
|
||||
elseif s == "Ans" then
|
||||
display = display .. ans
|
||||
elseif s then
|
||||
if display == "0" then
|
||||
display = s
|
||||
else
|
||||
display = display .. s
|
||||
end
|
||||
end
|
||||
|
||||
syscalls.DrawRectangle(20, 20 + skinHeight, 200, 30, systemColors.workArea)
|
||||
DrawDisplay()
|
||||
end
|
||||
|
||||
-- main
|
||||
|
||||
redraw()
|
||||
|
||||
local exit = false
|
||||
while not exit do
|
||||
local event = syscalls.WaitEvent()
|
||||
|
||||
if event == syscalls.Event.Redraw then
|
||||
redraw()
|
||||
elseif event == syscalls.Event.Button then
|
||||
local ButtonID = syscalls.GetButton()
|
||||
|
||||
if ButtonID == syscalls.buttons.close then
|
||||
exit = true
|
||||
else
|
||||
local s = CheckButton(ButtonID)
|
||||
|
||||
checkInput(s)
|
||||
end
|
||||
elseif event == syscalls.Event.Key then
|
||||
local key, a = syscalls.GetKey()
|
||||
|
||||
key = key:sub(1, 1)
|
||||
|
||||
for _, row in pairs(buttons) do
|
||||
for _, v in pairs(row) do
|
||||
if v == key then
|
||||
checkInput(key)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user