Compare commits
12 Commits
v0.1.0
...
105f80a8f6
Author | SHA1 | Date | |
---|---|---|---|
105f80a8f6 | |||
1c77f25017 | |||
a4042c34d4 | |||
37ae2a28a9 | |||
e6cc79ee8b | |||
5319af9056 | |||
63359cb028 | |||
68e8b3417e | |||
008485e004 | |||
14ef5e42a8 | |||
9ca0d8d658 | |||
186fbe426e |
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
|||||||
[submodule "lua"]
|
|
||||||
path = lua
|
|
||||||
url = https://git.kolibrios.org/lua/lua.git
|
|
||||||
|
30
.vscode/c_cpp_properties.json
vendored
30
.vscode/c_cpp_properties.json
vendored
@@ -1,20 +1,42 @@
|
|||||||
{
|
{
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "Release",
|
"name": "Windows Lua5.4",
|
||||||
"includePath": [
|
"includePath": [
|
||||||
"${workspaceFolder}/lua/src",
|
"C:/MinGW/msys/1.0/home/autobuild/tools/win32/include",
|
||||||
|
"C:/MinGW/msys/1.0/home/autobuild/tools/win32/include/lua5.4",
|
||||||
"${workspaceFolder}/../kolibrios/contrib/sdk/sources/newlib/libc/include"
|
"${workspaceFolder}/../kolibrios/contrib/sdk/sources/newlib/libc/include"
|
||||||
],
|
],
|
||||||
"defines": []
|
"defines": [
|
||||||
|
"SYSCALLS_VERSION_A",
|
||||||
|
"SYSCALLS_VERSION_B",
|
||||||
|
"SYSCALLS_VERSION_C"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Windows Lua5.3",
|
||||||
|
"includePath": [
|
||||||
|
"C:/MinGW/msys/1.0/home/autobuild/tools/win32/include",
|
||||||
|
"C:/MinGW/msys/1.0/home/autobuild/tools/win32/include/lua5.3",
|
||||||
|
"${workspaceFolder}/../kolibrios/contrib/sdk/sources/newlib/libc/include"
|
||||||
|
],
|
||||||
|
"defines": [
|
||||||
|
"SYSCALLS_VERSION_A",
|
||||||
|
"SYSCALLS_VERSION_B",
|
||||||
|
"SYSCALLS_VERSION_C"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Debug",
|
"name": "Debug",
|
||||||
"includePath": [
|
"includePath": [
|
||||||
"${workspaceFolder}/lua/src",
|
"/home/autobuild/tools/win32/include",
|
||||||
|
"/home/autobuild/tools/win32/include/lua5.4",
|
||||||
"${workspaceFolder}/../kolibrios/contrib/sdk/sources/newlib/libc/include"
|
"${workspaceFolder}/../kolibrios/contrib/sdk/sources/newlib/libc/include"
|
||||||
],
|
],
|
||||||
"defines": [
|
"defines": [
|
||||||
|
"SYSCALLS_VERSION_A",
|
||||||
|
"SYSCALLS_VERSION_B",
|
||||||
|
"SYSCALLS_VERSION_C",
|
||||||
"NDEBUG"
|
"NDEBUG"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -7,7 +7,9 @@
|
|||||||
"socket.h": "c",
|
"socket.h": "c",
|
||||||
"graphic.h": "c",
|
"graphic.h": "c",
|
||||||
"syscalls.h": "c",
|
"syscalls.h": "c",
|
||||||
"registers.h": "c"
|
"registers.h": "c",
|
||||||
|
"version_type.h": "c",
|
||||||
|
"library_version.h": "c"
|
||||||
},
|
},
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"syscalls",
|
"syscalls",
|
||||||
|
31
Makefile
31
Makefile
@@ -1,13 +1,18 @@
|
|||||||
LUA_V = 54
|
|
||||||
|
LUA_V = 5.4
|
||||||
|
SYSCALLS_VER_A = 2
|
||||||
|
SYSCALLS_VER_B = 0
|
||||||
|
SYSCALLS_VER_C = 0
|
||||||
|
SYSCALLS_VER = $(SYSCALLS_VER_C).$(SYSCALLS_VER_B).$(SYSCALLS_VER_A)
|
||||||
|
|
||||||
CC = kos32-gcc
|
CC = kos32-gcc
|
||||||
LD = kos32-ld
|
LD = kos32-ld
|
||||||
STRIP = kos32-strip
|
STRIP = kos32-strip
|
||||||
OBJCOPY = kos32-objcopy
|
OBJCOPY = kos32-objcopy
|
||||||
STD = -std=gnu11
|
STD = -std=gnu11
|
||||||
CFLAGS = $(SYSCFLAGS) -O2 -Wall -Wextra $(STD) $(MYCFLAGS)
|
CFLAGS = $(SYSCFLAGS) -O2 -Wall -Wextra $(STD) $(MYCFLAGS) -DSYSCALLS_VERSION_A=$(SYSCALLS_VER_A) -DSYSCALLS_VERSION_B=$(SYSCALLS_VER_B) -DSYSCALLS_VERSION_C=$(SYSCALLS_VER_C)
|
||||||
LDFLAGS = $(SYSLDFLAGS) $(MYLDFLAGS)
|
LDFLAGS = $(SYSLDFLAGS) $(MYLDFLAGS)
|
||||||
LIBS = $(SYSLIBS) $(MYLIBS) $(TOOLCHAIN_PATH)/mingw32/lib/lua$(LUA_V).dll.a
|
LIBS = $(SYSLIBS) $(MYLIBS) -llua$(LUA_V).dll
|
||||||
|
|
||||||
ifeq ($(OS), Windows_NT)
|
ifeq ($(OS), Windows_NT)
|
||||||
TOOLCHAIN_PATH = C:/MinGW/msys/1.0/home/autobuild/tools/win32
|
TOOLCHAIN_PATH = C:/MinGW/msys/1.0/home/autobuild/tools/win32
|
||||||
@@ -21,9 +26,8 @@ KOLIBRIOS_REPO = $(abspath ../kolibrios)
|
|||||||
|
|
||||||
SDK_DIR = $(KOLIBRIOS_REPO)/contrib/sdk
|
SDK_DIR = $(KOLIBRIOS_REPO)/contrib/sdk
|
||||||
NewLib_DIR = $(SDK_DIR)/sources/newlib
|
NewLib_DIR = $(SDK_DIR)/sources/newlib
|
||||||
SYSCFLAGS = -fno-ident -fomit-frame-pointer -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -I$(NewLib_DIR)/libc/include -I$(abspath .)/lua/src
|
SYSCFLAGS = -fno-ident -fomit-frame-pointer -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -I$(NewLib_DIR)/libc/include -I$(TOOLCHAIN_PATH)/include/lua$(LUA_V)
|
||||||
SYSLDFLAGS = --image-base 0 -Tapp-dynamic.lds
|
SYSLIBS = -L $(SDK_DIR)/lib -lgcc -lc.dll -ldll
|
||||||
SYSLIBS = -nostdlib -L $(SDK_DIR)/lib -L$(TOOLCHAIN_PATH)/lib -L$(TOOLCHAIN_PATH)/mingw32/lib -lgcc -lc.dll -ldll
|
|
||||||
MYCFLAGS =
|
MYCFLAGS =
|
||||||
MYLDFLAGS =
|
MYLDFLAGS =
|
||||||
MYLIBS =
|
MYLIBS =
|
||||||
@@ -32,11 +36,12 @@ MYOBJS =
|
|||||||
|
|
||||||
Socket_O = src/sockets/socket.o src/sockets/socket_lua.o src/sockets/sockaddr.o
|
Socket_O = src/sockets/socket.o src/sockets/socket_lua.o src/sockets/sockaddr.o
|
||||||
Debug_O = src/debug/debug.o src/debug/registers.o
|
Debug_O = src/debug/debug.o src/debug/registers.o
|
||||||
|
Version_O = src/version/coreversion.o src/version/version_type.o
|
||||||
|
|
||||||
ALL_O = src/syscalls.o src/ARP_entry.o src/systemColors.o src/graphic.o $(Socket_O) $(Debug_O)
|
ALL_O = src/syscalls.o src/ARP_entry.o src/systemColors.o src/graphic.o $(Socket_O) $(Debug_O) $(Version_O) src/background/background.o
|
||||||
|
|
||||||
syscalls.dll: $(ALL_O)
|
syscalls.dll: $(ALL_O)
|
||||||
$(CC) -shared -T dll.lds --entry _DllStartup -o $@ $(ALL_O) $(LIBS)
|
$(LD) -shared -T dll.lds --entry _DllStartup $(LDFLAGS) -o $@ $(ALL_O) $(LIBS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(ALL_O) syscalls.dll
|
rm -f $(ALL_O) syscalls.dll
|
||||||
@@ -45,7 +50,7 @@ clean:
|
|||||||
|
|
||||||
## Sources
|
## Sources
|
||||||
|
|
||||||
src/syscalls.o: src/syscalls.c src/syscalls.h src/systemColors.h src/ARP_entry.h src/scancodes.h src/sockets/socket_lua.h src/graphic.h
|
src/syscalls.o: src/syscalls.c src/syscalls.h src/systemColors.h src/ARP_entry.h src/scancodes.h src/sockets/socket_lua.h src/graphic.h src/version/library_version.h
|
||||||
src/ARP_entry.o: src/ARP_entry.c src/ARP_entry.h src/debug.h
|
src/ARP_entry.o: src/ARP_entry.c src/ARP_entry.h src/debug.h
|
||||||
src/systemColors.o: src/systemColors.c src/systemColors.h src/debug.h
|
src/systemColors.o: src/systemColors.c src/systemColors.h src/debug.h
|
||||||
src/sockets/socket.o: src/sockets/socket.c src/sockets/socket.h
|
src/sockets/socket.o: src/sockets/socket.c src/sockets/socket.h
|
||||||
@@ -53,7 +58,10 @@ src/sockets/socket_lua.o: src/sockets/socket_lua.c src/sockets/socket_lua.h
|
|||||||
src/sockets/sockaddr.o: src/sockets/sockaddr.c src/sockets/sockaddr.h
|
src/sockets/sockaddr.o: src/sockets/sockaddr.c src/sockets/sockaddr.h
|
||||||
src/graphic.o: src/graphic.c src/graphic.h
|
src/graphic.o: src/graphic.c src/graphic.h
|
||||||
src/debug/debug.o: src/debug/debug.c src/debug/debug.h src/debug/registers.h
|
src/debug/debug.o: src/debug/debug.c src/debug/debug.h src/debug/registers.h
|
||||||
src/debug/registers.o: src/debug/registers.c src/debug/registers.h src/syscalls.h
|
src/debug/registers.o: src/debug/registers.c src/debug/registers.h src/syscalls.h src/debug.h
|
||||||
|
src/version/coreversion.o: src/version/coreversion.c src/version/coreversion.h
|
||||||
|
src/version/version_type.o: src/version/version_type.c src/version/version_type.h src/debug.h
|
||||||
|
src/background/background.o: src/background/background.c src/background/background.h
|
||||||
|
|
||||||
## headers
|
## headers
|
||||||
|
|
||||||
@@ -62,3 +70,6 @@ src/sockets/socket_lua.h: src/syscalls.h src/sockets/socket.h
|
|||||||
src/sockets/sockaddr.h: src/sockets/socket.h src/syscalls.h
|
src/sockets/sockaddr.h: src/sockets/socket.h src/syscalls.h
|
||||||
src/debug/debug.h: src/syscalls.h
|
src/debug/debug.h: src/syscalls.h
|
||||||
src/debug/registers.h: src/syscalls.h
|
src/debug/registers.h: src/syscalls.h
|
||||||
|
src/version/coreversion.h: src/version/version_type.h
|
||||||
|
src/version/version_type.h: src/syscalls.h
|
||||||
|
src/background/background.h: src/syscalls.h
|
||||||
|
353
doc/manual.md
353
doc/manual.md
@@ -1,13 +1,34 @@
|
|||||||
# Manual
|
# 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
|
```lua
|
||||||
local syscalls = require("syscalls")
|
local syscalls = require("syscalls")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Events
|
## Events
|
||||||
|
|
||||||
|
### `SetEventMask(newMask)`
|
||||||
|
|
||||||
|
### `CheckEvent()`
|
||||||
|
|
||||||
|
check event
|
||||||
|
|
||||||
|
### `WaitEvent()`
|
||||||
|
|
||||||
|
Endless wait event
|
||||||
|
|
||||||
|
### `WaitEventTimeout(timeout)`
|
||||||
|
|
||||||
|
Wait timeout 1/100 sec
|
||||||
|
|
||||||
|
return event or `nil`
|
||||||
|
|
||||||
|
### Events list
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
syscalls.Event.<EventName>
|
syscalls.Event.<EventName>
|
||||||
```
|
```
|
||||||
@@ -21,6 +42,62 @@ syscalls.Event.<EventName>
|
|||||||
+ `IPC`
|
+ `IPC`
|
||||||
+ `Debug`
|
+ `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
|
## Graphic
|
||||||
|
|
||||||
### Text encoding
|
### Text encoding
|
||||||
@@ -67,12 +144,217 @@ textSize, textLen, backgroundColor, encoding are optional.
|
|||||||
|
|
||||||
### `DrawLine(x1, y1, x2, y2)`
|
### `DrawLine(x1, y1, x2, y2)`
|
||||||
|
|
||||||
### `DrawRectangle(x, y, w, h color)`
|
### `DrawRectangle(x, y, widht, height, color)`
|
||||||
|
|
||||||
### `ReadPoint(x, y)`
|
### `ReadPoint(x, y)`
|
||||||
|
|
||||||
return color
|
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
|
## Sockets
|
||||||
|
|
||||||
### `OpenSocket(domain, type, protocol)`
|
### `OpenSocket(domain, type, protocol)`
|
||||||
@@ -170,4 +452,69 @@ syscalls.SO.<Value>
|
|||||||
+ `BINDTODEVICE`
|
+ `BINDTODEVICE`
|
||||||
+ `NONBLOCK`
|
+ `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)`
|
||||||
|
|
||||||
|
1
lua
1
lua
repo.diff.submodule_deleted%!(EXTRA template.HTML=lua, template.HTML=eae2ea0aaa)
129
src/background/background.c
Normal file
129
src/background/background.c
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
#include "background.h"
|
||||||
|
|
||||||
|
static ksys_pos_t sizes;
|
||||||
|
|
||||||
|
int syscalls_backgroundGetSize(lua_State* L)
|
||||||
|
{
|
||||||
|
asm_inline(
|
||||||
|
"int $0x40"
|
||||||
|
:"=a"(sizes)
|
||||||
|
: "a"(39), "b"(1)
|
||||||
|
);
|
||||||
|
|
||||||
|
syscalls_push_pos_t(L, sizes);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int syscalls_backgroundSetSize(lua_State* L)
|
||||||
|
{
|
||||||
|
sizes = syscalls_check_pos_t(L, 1);
|
||||||
|
|
||||||
|
_ksys_bg_set_size(
|
||||||
|
sizes.x,
|
||||||
|
sizes.y
|
||||||
|
);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int syscalls_backgroundPutPixel(lua_State* L)
|
||||||
|
{
|
||||||
|
uint32_t x = luaL_checkinteger(L, 1);
|
||||||
|
uint32_t y = luaL_checkinteger(L, 2);
|
||||||
|
|
||||||
|
_ksys_bg_put_pixel(
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
sizes.x,
|
||||||
|
luaL_checkinteger(L, 3)
|
||||||
|
);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ksys_color_t background_read_point(ksys_pos_t pos, uint16_t w)
|
||||||
|
{
|
||||||
|
ksys_color_t color;
|
||||||
|
|
||||||
|
asm_inline(
|
||||||
|
"int $0x40"
|
||||||
|
:"=a"(color)
|
||||||
|
: "a"(39), "b"(2), "c"((pos.x + pos.y * w) * 3)
|
||||||
|
);
|
||||||
|
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
int syscalls_backgroundReadPoint(lua_State* L)
|
||||||
|
{
|
||||||
|
lua_pushinteger(
|
||||||
|
L,
|
||||||
|
background_read_point(syscalls_check_pos_t(L, 1), sizes.x)
|
||||||
|
);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int syscalls_backgroundRedraw(lua_State* L)
|
||||||
|
{
|
||||||
|
_ksys_bg_redraw();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int syscalls_backgroundSetDrawMode(lua_State* L)
|
||||||
|
{
|
||||||
|
_ksys_bg_set_mode(luaL_checkinteger(L, 1));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int syscalls_backgroundGetDrawMode(lua_State* L)
|
||||||
|
{
|
||||||
|
enum KSYS_BG_MODES mode;
|
||||||
|
|
||||||
|
asm_inline(
|
||||||
|
"int $0x40"
|
||||||
|
:"=a"(mode)
|
||||||
|
: "a"(39), "b"(4)
|
||||||
|
);
|
||||||
|
|
||||||
|
lua_pushinteger(L, mode);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int syscalls_backgroundOpenMap(lua_State* L)
|
||||||
|
{
|
||||||
|
lua_pushinteger(
|
||||||
|
L,
|
||||||
|
_ksys_bg_get_map()
|
||||||
|
);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int syscalls_backgroundCloseMap(lua_State* L)
|
||||||
|
{
|
||||||
|
if (_ksys_bg_close_map(luaL_checkinteger(L, 1)) == 0)
|
||||||
|
{
|
||||||
|
lua_pushnil(L);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lua_pushboolean(L, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int syscalls_backgroundRedrawArea(lua_State* L)
|
||||||
|
{
|
||||||
|
_ksys_bg_redraw_bar(
|
||||||
|
syscalls_check_pos_t(L, 1),
|
||||||
|
syscalls_check_pos_t(L, 3)
|
||||||
|
);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
33
src/background/background.h
Normal file
33
src/background/background.h
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#ifndef __BACKGROUND_H__
|
||||||
|
#define __BACKGROUND_H__
|
||||||
|
|
||||||
|
#include "../syscalls.h"
|
||||||
|
|
||||||
|
int syscalls_backgroundSetSize(lua_State* L);
|
||||||
|
|
||||||
|
int syscalls_backgroundPutPixel(lua_State* L);
|
||||||
|
|
||||||
|
int syscalls_backgroundRedraw(lua_State* L);
|
||||||
|
|
||||||
|
int syscalls_backgroundSetDrawMode(lua_State* L);
|
||||||
|
|
||||||
|
int syscalls_backgroundGetDrawMode(lua_State* L);
|
||||||
|
|
||||||
|
int syscalls_backgroundOpenMap(lua_State* L);
|
||||||
|
|
||||||
|
int syscalls_backgroundCloseMap(lua_State* L);
|
||||||
|
|
||||||
|
int syscalls_backgroundRedrawArea(lua_State* L);
|
||||||
|
|
||||||
|
inline syscalls_push_BackgroundDrawMode(lua_State* L)
|
||||||
|
{
|
||||||
|
lua_createtable(L, 0, 2);
|
||||||
|
|
||||||
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_BG_MODE_PAVE, "Pave");
|
||||||
|
|
||||||
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_BG_MODE_STRETCH, "Stretch");
|
||||||
|
|
||||||
|
lua_setfield(L, -2, "DrawMode");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __BACKGROUND_H__
|
@@ -37,9 +37,8 @@ int syscalls_SetMessageArea(lua_State* L)
|
|||||||
|
|
||||||
int syscalls_GetRegisters(lua_State* L)
|
int syscalls_GetRegisters(lua_State* L)
|
||||||
{
|
{
|
||||||
struct registers* r = syscalls_pushRegisters(L);
|
|
||||||
|
|
||||||
uint32_t pid = luaL_checkinteger(L, 1);
|
uint32_t pid = luaL_checkinteger(L, 1);
|
||||||
|
struct registers* r = syscalls_pushRegisters(L);
|
||||||
|
|
||||||
asm_inline(
|
asm_inline(
|
||||||
"int $0x40"
|
"int $0x40"
|
||||||
@@ -59,7 +58,7 @@ int syscalls_SetRegisters(lua_State* L)
|
|||||||
:: "a"(69), "b"(2), "c"(pid), "d"(sizeof(struct registers)), "S"(r)
|
:: "a"(69), "b"(2), "c"(pid), "d"(sizeof(struct registers)), "S"(r)
|
||||||
);
|
);
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int syscalls_Disconnect(lua_State* L)
|
int syscalls_Disconnect(lua_State* L)
|
||||||
@@ -71,7 +70,7 @@ int syscalls_Disconnect(lua_State* L)
|
|||||||
:: "a"(69), "b"(3), "c"(pid)
|
:: "a"(69), "b"(3), "c"(pid)
|
||||||
);
|
);
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int syscalls_Stop(lua_State* L)
|
int syscalls_Stop(lua_State* L)
|
||||||
@@ -83,7 +82,7 @@ int syscalls_Stop(lua_State* L)
|
|||||||
:: "a"(69), "b"(4), "c"(pid)
|
:: "a"(69), "b"(4), "c"(pid)
|
||||||
);
|
);
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int syscalls_Continue(lua_State* L)
|
int syscalls_Continue(lua_State* L)
|
||||||
@@ -95,7 +94,7 @@ int syscalls_Continue(lua_State* L)
|
|||||||
:: "a"(69), "b"(5), "c"(pid)
|
:: "a"(69), "b"(5), "c"(pid)
|
||||||
);
|
);
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int syscalls_ReadFromMem(lua_State* L)
|
int syscalls_ReadFromMem(lua_State* L)
|
||||||
@@ -151,7 +150,7 @@ int syscalls_Done(lua_State* L)
|
|||||||
:: "a"(69), "b"(8), "c"(pid)
|
:: "a"(69), "b"(8), "c"(pid)
|
||||||
);
|
);
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int syscalls_DefineBreakpoint(lua_State* L)
|
int syscalls_DefineBreakpoint(lua_State* L)
|
||||||
|
@@ -83,7 +83,7 @@ static int syscalls_newindexRegisters(lua_State* L)
|
|||||||
luaL_error(L, "wrong index: %s", index);
|
luaL_error(L, "wrong index: %s", index);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int syscalls_eqRegisters(lua_State* L)
|
static int syscalls_eqRegisters(lua_State* L)
|
||||||
|
@@ -45,53 +45,37 @@ inline void syscalls_push_textSizes(lua_State* L)
|
|||||||
{
|
{
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
|
|
||||||
lua_pushinteger(L, TextScale_SIZE_6x9);
|
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_6x9, "6x9");
|
||||||
lua_setfield(L, -2, "6x9");
|
|
||||||
|
|
||||||
lua_pushinteger(L, TextScale_SIZE_8x16);
|
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_8x16, "8x16");
|
||||||
lua_setfield(L, -2, "8x16");
|
|
||||||
|
|
||||||
lua_pushinteger(L, TextScale_SIZE_12x18);
|
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_12x18, "12x18");
|
||||||
lua_setfield(L, -2, "12x18");
|
|
||||||
|
|
||||||
lua_pushinteger(L, TextScale_SIZE_16x32);
|
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_16x32, "16x32");
|
||||||
lua_setfield(L, -2, "16x32");
|
|
||||||
|
|
||||||
lua_pushinteger(L, TextScale_SIZE_18x27);
|
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_18x27, "18x27");
|
||||||
lua_setfield(L, -2, "18x27");
|
|
||||||
|
|
||||||
lua_pushinteger(L, TextScale_SIZE_24x36);
|
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_24x36, "24x36");
|
||||||
lua_setfield(L, -2, "24x36");
|
|
||||||
|
|
||||||
lua_pushinteger(L, TextScale_SIZE_24x48);
|
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_24x48, "24x48");
|
||||||
lua_setfield(L, -2, "24x48");
|
|
||||||
|
|
||||||
lua_pushinteger(L, TextScale_SIZE_30x45);
|
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_30x45, "30x45");
|
||||||
lua_setfield(L, -2, "30x45");
|
|
||||||
|
|
||||||
lua_pushinteger(L, TextScale_SIZE_32x64);
|
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_32x64, "32x64");
|
||||||
lua_setfield(L, -2, "32x64");
|
|
||||||
|
|
||||||
lua_pushinteger(L, TextScale_SIZE_36x54);
|
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_36x54, "36x54");
|
||||||
lua_setfield(L, -2, "36x54");
|
|
||||||
|
|
||||||
lua_pushinteger(L, TextScale_SIZE_40x80);
|
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_40x80, "40x80");
|
||||||
lua_setfield(L, -2, "40x80");
|
|
||||||
|
|
||||||
lua_pushinteger(L, TextScale_SIZE_42x63);
|
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_42x63, "42x63");
|
||||||
lua_setfield(L, -2, "42x63");
|
|
||||||
|
|
||||||
lua_pushinteger(L, TextScale_SIZE_48x72);
|
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_48x72, "48x72");
|
||||||
lua_setfield(L, -2, "48x72");
|
|
||||||
|
|
||||||
lua_pushinteger(L, TextScale_SIZE_48x96);
|
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_48x96, "48x96");
|
||||||
lua_setfield(L, -2, "48x96");
|
|
||||||
|
|
||||||
lua_pushinteger(L, TextScale_SIZE_56x112);
|
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_56x112, "56x112");
|
||||||
lua_setfield(L, -2, "56x112");
|
|
||||||
|
|
||||||
lua_pushinteger(L, TextScale_SIZE_64x128);
|
LUA_PUSH_INTEGER_FIELD(L, TextScale_SIZE_64x128, "64x128");
|
||||||
lua_setfield(L, -2, "64x128");
|
|
||||||
|
|
||||||
lua_setfield(L, -2, "textSize");
|
lua_setfield(L, -2, "textSize");
|
||||||
}
|
}
|
||||||
@@ -100,21 +84,17 @@ inline void syscalls_push_Encoding(lua_State* L)
|
|||||||
{
|
{
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
|
|
||||||
lua_pushinteger(L, cp866);
|
LUA_PUSH_INTEGER_FIELD(L, cp866, "cp866");
|
||||||
lua_setfield(L, -2, "cp866");
|
|
||||||
|
|
||||||
lua_pushinteger(L, cp866_8x16);
|
LUA_PUSH_INTEGER_FIELD(L, cp866_8x16, "cp866_8x16");
|
||||||
lua_setfield(L, -2, "cp866_8x16");
|
|
||||||
|
|
||||||
lua_pushinteger(L, utf8);
|
LUA_PUSH_INTEGER_FIELD(L, utf8, "utf8");
|
||||||
lua_setfield(L, -2, "utf8");
|
|
||||||
|
|
||||||
lua_pushinteger(L, utf16);
|
LUA_PUSH_INTEGER_FIELD(L, utf16, "utf16");
|
||||||
lua_setfield(L, -2, "utf16");
|
|
||||||
|
|
||||||
lua_setfield(L, -2, "Encoding");
|
lua_setfield(L, -2, "Encoding");
|
||||||
}
|
}
|
||||||
|
|
||||||
#define syscalls_push_graphic(L) syscalls_push_textSizes(L); syscalls_push_Encoding(L);
|
#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_newtable(L);
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_0);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_0, "0");
|
||||||
lua_setfield(L, -2, "0");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_1);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_1, "1");
|
||||||
lua_setfield(L, -2, "1");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_2);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_2, "2");
|
||||||
lua_setfield(L, -2, "2");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_3);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_3, "3");
|
||||||
lua_setfield(L, -2, "3");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_4);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_4, "5");
|
||||||
lua_setfield(L, -2, "4");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_5);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_5, "6");
|
||||||
lua_setfield(L, -2, "6");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_7);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_7, "7");
|
||||||
lua_setfield(L, -2, "7");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_8);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_8, "8");
|
||||||
lua_setfield(L, -2, "8");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_9);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_9, "9");
|
||||||
lua_setfield(L, -2, "9");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_A);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_A, "A");
|
||||||
lua_setfield(L, -2, "A");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_B);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_B, "B");
|
||||||
lua_setfield(L, -2, "B");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_C);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_C, "C");
|
||||||
lua_setfield(L, -2, "C");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_D);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_D, "D");
|
||||||
lua_setfield(L, -2, "D");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_E);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_E, "E");
|
||||||
lua_setfield(L, -2, "E");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_F);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F, "F");
|
||||||
lua_setfield(L, -2, "F");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_G);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_G, "G");
|
||||||
lua_setfield(L, -2, "G");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_H);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_H, "H");
|
||||||
lua_setfield(L, -2, "H");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_J);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_J, "J");
|
||||||
lua_setfield(L, -2, "J");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_K);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_K, "K");
|
||||||
lua_setfield(L, -2, "K");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_L);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_L, "L");
|
||||||
lua_setfield(L, -2, "L");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_M);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_M, "M");
|
||||||
lua_setfield(L, -2, "M");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_N);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_N, "N");
|
||||||
lua_setfield(L, -2, "N");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_O);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_O, "O");
|
||||||
lua_setfield(L, -2, "O");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_P);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_P, "P");
|
||||||
lua_setfield(L, -2, "P");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_Q);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_Q, "Q");
|
||||||
lua_setfield(L, -2, "Q");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_R);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_R, "R");
|
||||||
lua_setfield(L, -2, "R");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_S);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_S, "S");
|
||||||
lua_setfield(L, -2, "S");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_T);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_T, "T");
|
||||||
lua_setfield(L, -2, "T");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_U);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_U, "U");
|
||||||
lua_setfield(L, -2, "U");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_V);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_V, "V");
|
||||||
lua_setfield(L, -2, "V");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_W);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_W, "W");
|
||||||
lua_setfield(L, -2, "W");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_X);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_X, "X");
|
||||||
lua_setfield(L, -2, "X");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_Y);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_Y, "Y");
|
||||||
lua_setfield(L, -2, "Y");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_Z);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_Z, "Z");
|
||||||
lua_setfield(L, -2, "Z");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_F1);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F1, "F1");
|
||||||
lua_setfield(L, -2, "F1");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_F2);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F2, "F2");
|
||||||
lua_setfield(L, -2, "F2");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_F3);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F3, "F3");
|
||||||
lua_setfield(L, -2, "F3");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_F4);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F4, "F4");
|
||||||
lua_setfield(L, -2, "F4");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_F5);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F5, "F5");
|
||||||
lua_setfield(L, -2, "F5");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_F6);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F6, "F6");
|
||||||
lua_setfield(L, -2, "F6");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_F7);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F7, "F7");
|
||||||
lua_setfield(L, -2, "F7");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_F8);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F8, "F8");
|
||||||
lua_setfield(L, -2, "F8");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_F9);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F9, "F9");
|
||||||
lua_setfield(L, -2, "F9");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_F10);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F10, "F10");
|
||||||
lua_setfield(L, -2, "F10");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_F11);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F11, "F11");
|
||||||
lua_setfield(L, -2, "F11");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_F12);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_F12, "F12");
|
||||||
lua_setfield(L, -2, "F12");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_LSHIFT);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_LSHIFT, "LeftShift");
|
||||||
lua_setfield(L, -2, "LeftShift");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_RSHIFT);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_RSHIFT, "RightShift");
|
||||||
lua_setfield(L, -2, "RightShift");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_BACKSLASH);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_BACKSLASH, "Backslash");
|
||||||
lua_setfield(L, -2, "Backslash");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_COMMA);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_COMMA, "Comma");
|
||||||
lua_setfield(L, -2, "Comma");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_SLASH);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_SLASH, "Slash");
|
||||||
lua_setfield(L, -2, "Slash");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_LALT);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_LALT, "LeftAlt");
|
||||||
lua_setfield(L, -2, "LeftAlt");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_RALT);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_RALT, "RightAlt");
|
||||||
lua_setfield(L, -2, "RightAlt");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_LCTRL);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_LCTRL, "LeftCtrl");
|
||||||
lua_setfield(L, -2, "LeftCtrl");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_RCTRL);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_RCTRL, "RightCtrl");
|
||||||
lua_setfield(L, -2, "RightCtrl");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_CAPSLOCK);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_CAPSLOCK, "CapsLock");
|
||||||
lua_setfield(L, -2, "CapsLock");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_NUMLOCK);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMLOCK, "NumLock");
|
||||||
lua_setfield(L, -2, "NumLock");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_POINT);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_POINT, "Point");
|
||||||
lua_setfield(L, -2, "Point");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_ENTER);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_ENTER, "Enter");
|
||||||
lua_setfield(L, -2, "Enter");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_ESC);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_ESC, "Esc");
|
||||||
lua_setfield(L, -2, "Esc");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_TAB);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_TAB, "Tab");
|
||||||
lua_setfield(L, -2, "Tab");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_HOME);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_HOME, "Home");
|
||||||
lua_setfield(L, -2, "Home");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_PGUP);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_PGUP, "PageUp");
|
||||||
lua_setfield(L, -2, "PageUp");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_PGDOWN);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_PGDOWN, "PageDown");
|
||||||
lua_setfield(L, -2, "PageDown");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_END);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_END, "End");
|
||||||
lua_setfield(L, -2, "End");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_UP);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_UP, "Up");
|
||||||
lua_setfield(L, -2, "Up");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_DOWN);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_DOWN, "Down");
|
||||||
lua_setfield(L, -2, "Down");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_LEFT);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_LEFT, "Left");
|
||||||
lua_setfield(L, -2, "Left");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_RIGHT);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_RIGHT, "Right");
|
||||||
lua_setfield(L, -2, "Right");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_DELETE);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_DELETE, "Delete");
|
||||||
lua_setfield(L, -2, "Delete");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_INSERT);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_INSERT, "Insert");
|
||||||
lua_setfield(L, -2, "Insert");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_MINUS);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_MINUS, "Minus");
|
||||||
lua_setfield(L, -2, "Minus");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_NUMPAD_ENTER);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_NUMPAD_ENTER, "NumpadEnter");
|
||||||
lua_setfield(L, -2, "NumpadEnter");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_EXT_NUMPAD_DIV);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_EXT_NUMPAD_DIV, "NumpadDiv");
|
||||||
lua_setfield(L, -2, "NumpadDiv");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_MULT);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_MULT, "NumpadMult");
|
||||||
lua_setfield(L, -2, "NumpadMult");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_MINUS);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_MINUS, "NumpadMinus");
|
||||||
lua_setfield(L, -2, "NumpadMinus");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_PLUS);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_PLUS, "NumpadPlus");
|
||||||
lua_setfield(L, -2, "NumpadPlus");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_0);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_0, "Numpad_0");
|
||||||
lua_setfield(L, -2, "Numpad_0");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_1);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_1, "Numpad_1");
|
||||||
lua_setfield(L, -2, "Numpad_1");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_2);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_2, "Numpad_2");
|
||||||
lua_setfield(L, -2, "Numpad_2");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_3);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_3, "Numpad_3");
|
||||||
lua_setfield(L, -2, "Numpad_3");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_4);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_4, "Numpad_4");
|
||||||
lua_setfield(L, -2, "Numpad_4");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_5);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_5, "Numpad_5");
|
||||||
lua_setfield(L, -2, "Numpad_5");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_6);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_6, "Numpad_6");
|
||||||
lua_setfield(L, -2, "Numpad_6");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_7);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_7, "Numpad_7");
|
||||||
lua_setfield(L, -2, "Numpad_7");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_8);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_8, "Numpad_8");
|
||||||
lua_setfield(L, -2, "Numpad_8");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SCANCODE_NUMPAD_9);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SCANCODE_NUMPAD_9, "Numpad_9");
|
||||||
lua_setfield(L, -2, "Numpad_9");
|
|
||||||
|
|
||||||
lua_setfield(L, -2, "scancode");
|
lua_setfield(L, -2, "scancode");
|
||||||
}
|
}
|
||||||
|
286
src/syscalls.c
286
src/syscalls.c
@@ -15,7 +15,9 @@
|
|||||||
#include "sockets/socket_lua.h"
|
#include "sockets/socket_lua.h"
|
||||||
#include "debug/debug.h"
|
#include "debug/debug.h"
|
||||||
#include "graphic.h"
|
#include "graphic.h"
|
||||||
|
#include "version/coreversion.h"
|
||||||
|
#include "version/library_version.h"
|
||||||
|
#include "background/background.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Режим ввода с клавиатуры
|
Режим ввода с клавиатуры
|
||||||
@@ -95,6 +97,7 @@ static int syscalls_endRedraw(lua_State* L)
|
|||||||
static int syscalls_SetSkin(lua_State* L)
|
static int syscalls_SetSkin(lua_State* L)
|
||||||
{
|
{
|
||||||
unsigned ret;
|
unsigned ret;
|
||||||
|
|
||||||
asm_inline(
|
asm_inline(
|
||||||
"int $0x40"
|
"int $0x40"
|
||||||
: "=a"(ret)
|
: "=a"(ret)
|
||||||
@@ -105,7 +108,7 @@ static int syscalls_SetSkin(lua_State* L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int syscalls_GetSkinTilteArea(lua_State* L)
|
static int syscalls_GetSkinTitleArea(lua_State* L)
|
||||||
{
|
{
|
||||||
ksys_pos_t leftRight, topBottom;
|
ksys_pos_t leftRight, topBottom;
|
||||||
|
|
||||||
@@ -139,34 +142,39 @@ static int syscalls_SetWorkArea(lua_State* L)
|
|||||||
uint32_t bottom = luaL_checkinteger(L, 4);
|
uint32_t bottom = luaL_checkinteger(L, 4);
|
||||||
|
|
||||||
asm_inline(
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int syscalls_GetWorkArea(lua_State* L)
|
static int syscalls_GetWorkArea(lua_State* L)
|
||||||
{
|
{
|
||||||
ksys_pos_t leftlright;
|
ksys_pos_t leftAndRight;
|
||||||
ksys_pos_t toplbottom;
|
ksys_pos_t topAndBottom;
|
||||||
|
|
||||||
asm_inline(
|
asm_inline(
|
||||||
"int $0x40"
|
"int $0x40"
|
||||||
:"=a"(leftlright), "=b"(toplbottom)
|
:"=a"(leftAndRight), "=b"(topAndBottom)
|
||||||
: "a"(48), "b"(5)
|
: "a"(48), "b"(5)
|
||||||
);
|
);
|
||||||
|
|
||||||
lua_createtable(L, 0, 4);
|
lua_createtable(L, 0, 4);
|
||||||
|
|
||||||
lua_pushinteger(L, leftlright.x);
|
lua_pushinteger(L, leftAndRight.x);
|
||||||
lua_setfield(L, -2, "Left");
|
lua_setfield(L, -2, "Left");
|
||||||
|
|
||||||
lua_pushinteger(L, leftlright.y);
|
lua_pushinteger(L, leftAndRight.y);
|
||||||
lua_setfield(L, -2, "Right");
|
lua_setfield(L, -2, "Right");
|
||||||
|
|
||||||
lua_pushinteger(L, toplbottom.x);
|
lua_pushinteger(L, topAndBottom.x);
|
||||||
lua_setfield(L, -2, "Top");
|
lua_setfield(L, -2, "Top");
|
||||||
|
|
||||||
lua_pushinteger(L, toplbottom.y);
|
lua_pushinteger(L, topAndBottom.y);
|
||||||
lua_setfield(L, -2, "Bottom");
|
lua_setfield(L, -2, "Bottom");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -195,6 +203,7 @@ static int syscalls_deleteButton(lua_State* L)
|
|||||||
static int syscalls_SetButtonsStyle(lua_State* L)
|
static int syscalls_SetButtonsStyle(lua_State* L)
|
||||||
{
|
{
|
||||||
uint32_t style = luaL_checkinteger(L, 1);
|
uint32_t style = luaL_checkinteger(L, 1);
|
||||||
|
|
||||||
asm_inline(
|
asm_inline(
|
||||||
"int $0x40" ::"a"(48), "b"(1), "c"(style));
|
"int $0x40" ::"a"(48), "b"(1), "c"(style));
|
||||||
|
|
||||||
@@ -228,7 +237,7 @@ static int syscalls_WindowMsg(lua_State* L)
|
|||||||
|
|
||||||
asm_inline(
|
asm_inline(
|
||||||
"int $0x40"
|
"int $0x40"
|
||||||
:"=a"(ret)
|
: "=a"(ret)
|
||||||
: "a"(72), "b"(1), "c"(event), "d"(code)
|
: "a"(72), "b"(1), "c"(event), "d"(code)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -246,50 +255,49 @@ static int syscalls_threadInfo(lua_State* L)
|
|||||||
lua_createtable(L, 0, 13);
|
lua_createtable(L, 0, 13);
|
||||||
|
|
||||||
lua_pushstring(L, t.name);
|
lua_pushstring(L, t.name);
|
||||||
lua_setfield(L, -2, "name");
|
lua_setfield(L, -2, "Name");
|
||||||
|
|
||||||
lua_pushinteger(L, t.cpu_usage);
|
lua_pushinteger(L, t.cpu_usage);
|
||||||
lua_setfield(L, -2, "cpu_usage");
|
lua_setfield(L, -2, "CpuUsage");
|
||||||
|
|
||||||
lua_pushinteger(L, t.memused);
|
lua_pushinteger(L, t.memused);
|
||||||
lua_setfield(L, -2, "memused");
|
lua_setfield(L, -2, "MemUsed");
|
||||||
|
|
||||||
lua_pushinteger(L, t.pid);
|
lua_pushinteger(L, t.pid);
|
||||||
lua_setfield(L, -2, "pid");
|
lua_setfield(L, -2, "PID");
|
||||||
|
|
||||||
lua_pushinteger(L, t.key_input_mode);
|
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_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_pushinteger(L, t.slot_num_window_stack);
|
||||||
lua_setfield(L, -2, "slotNumWindowStack");
|
lua_setfield(L, -2, "SlotNumWindowStack");
|
||||||
|
|
||||||
lua_pushinteger(L, t.slot_state);
|
lua_pushinteger(L, t.slot_state);
|
||||||
lua_setfield(L, -2, "slotState");
|
lua_setfield(L, -2, "SlotState");
|
||||||
|
|
||||||
lua_pushinteger(L, t.window_state);
|
lua_pushinteger(L, t.window_state);
|
||||||
lua_setfield(L, -2, "windowState");
|
lua_setfield(L, -2, "WindowState");
|
||||||
|
|
||||||
lua_pushinteger(L, t.winx_size);
|
lua_pushinteger(L, t.winx_size);
|
||||||
lua_setfield(L, -2, "winXSize");
|
lua_setfield(L, -2, "WinXSize");
|
||||||
|
|
||||||
lua_pushinteger(L, t.winy_size);
|
lua_pushinteger(L, t.winy_size);
|
||||||
lua_setfield(L, -2, "winYSize");
|
lua_setfield(L, -2, "WinYSize");
|
||||||
|
|
||||||
lua_pushinteger(L, t.winx_start);
|
lua_pushinteger(L, t.winx_start);
|
||||||
lua_setfield(L, -2, "winXPos");
|
lua_setfield(L, -2, "WinXPos");
|
||||||
|
|
||||||
lua_pushinteger(L, t.winy_start);
|
lua_pushinteger(L, t.winy_start);
|
||||||
lua_setfield(L, -2, "winYPos");
|
lua_setfield(L, -2, "WinYPos");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int syscalls_KillBySlot(lua_State* L)
|
static int syscalls_KillBySlot(lua_State* L)
|
||||||
{
|
{
|
||||||
|
|
||||||
_ksys_kill_by_slot(
|
_ksys_kill_by_slot(
|
||||||
luaL_checkinteger(L, 1));
|
luaL_checkinteger(L, 1));
|
||||||
|
|
||||||
@@ -319,7 +327,10 @@ static int syscalls_checkEvent(lua_State* L)
|
|||||||
|
|
||||||
static int syscalls_waitEventTimeout(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;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -398,37 +409,6 @@ static int syscalls_getButton(lua_State* L)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Backgound
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int syscalls_backgroundSetSize(lua_State* L)
|
|
||||||
{
|
|
||||||
_ksys_bg_set_size(
|
|
||||||
luaL_checkinteger(L, 1),
|
|
||||||
luaL_checkinteger(L, 2));
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int syscalls_backgroundPutPixel(lua_State* L)
|
|
||||||
{
|
|
||||||
_ksys_bg_put_pixel(
|
|
||||||
luaL_checkinteger(L, 1),
|
|
||||||
luaL_checkinteger(L, 2),
|
|
||||||
luaL_checkinteger(L, 3),
|
|
||||||
luaL_checkinteger(L, 4));
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int syscalls_backgroundRedraw(lua_State* L)
|
|
||||||
{
|
|
||||||
_ksys_bg_redraw();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int syscalls_getCPUClock(lua_State* L)
|
static int syscalls_getCPUClock(lua_State* L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, _ksys_get_cpu_clock());
|
lua_pushinteger(L, _ksys_get_cpu_clock());
|
||||||
@@ -496,7 +476,7 @@ static int syscalls_getKey(lua_State* L)
|
|||||||
{
|
{
|
||||||
char s[2];
|
char s[2];
|
||||||
s[0] = a.code;
|
s[0] = a.code;
|
||||||
s[1] = '\n';
|
s[1] = '\0';
|
||||||
lua_pushstring(L, s);
|
lua_pushstring(L, s);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -688,7 +668,7 @@ static int syscalls_getMouseEvents(lua_State* L)
|
|||||||
createMouseState(state, L);
|
createMouseState(state, L);
|
||||||
|
|
||||||
lua_pushboolean(L, state & (1 << 8));
|
lua_pushboolean(L, state & (1 << 8));
|
||||||
lua_setfield(L, -2, "getMouseEvents");
|
lua_setfield(L, -2, "LeftButtonPressed");
|
||||||
|
|
||||||
lua_pushboolean(L, state & (1 << 9));
|
lua_pushboolean(L, state & (1 << 9));
|
||||||
lua_setfield(L, -2, "RightButtonPressed");
|
lua_setfield(L, -2, "RightButtonPressed");
|
||||||
@@ -756,13 +736,13 @@ static int syscalls_GetMouseSettings(lua_State* L)
|
|||||||
lua_createtable(L, 0, 3);
|
lua_createtable(L, 0, 3);
|
||||||
|
|
||||||
lua_pushinteger(L, getMouseSettings(KSYS_MOUSE_GET_SPEED));
|
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_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_pushinteger(L, getMouseSettings(KSYS_MOUSE_GET_DOUBLE_CLICK_DELAY));
|
||||||
lua_setfield(L, -2, "doubleClickDelay");
|
lua_setfield(L, -2, "DoubleClickDelay");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -825,7 +805,7 @@ static int syscalls_SetMouseSettings(lua_State* L)
|
|||||||
luaL_checktype(L, 1, LUA_TTABLE);
|
luaL_checktype(L, 1, LUA_TTABLE);
|
||||||
|
|
||||||
lua_getfield(L, 1, "Speed");
|
lua_getfield(L, 1, "Speed");
|
||||||
lua_getfield(L, 1, "Sens");
|
lua_getfield(L, 1, "Sensitivity");
|
||||||
lua_getfield(L, 1, "DoubleClickDelay");
|
lua_getfield(L, 1, "DoubleClickDelay");
|
||||||
|
|
||||||
_ksys_set_mouse_settings(KSYS_MOUSE_GET_SPEED, luaL_checkinteger(L, -3));
|
_ksys_set_mouse_settings(KSYS_MOUSE_GET_SPEED, luaL_checkinteger(L, -3));
|
||||||
@@ -985,10 +965,7 @@ static int syscalls_GetTXByteCount(lua_State* L)
|
|||||||
: "=a"(num), "=b"(NUM)
|
: "=a"(num), "=b"(NUM)
|
||||||
: "a"(74), "b"(8 | device << 8));
|
: "a"(74), "b"(8 | device << 8));
|
||||||
|
|
||||||
if (num == -1)
|
syscalls_ReturnIntegerValueOrNil(num, num | NUM << 31, L);
|
||||||
lua_pushnil(L);
|
|
||||||
else
|
|
||||||
lua_pushinteger(L, (uint64_t)(num | NUM << 31));
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1004,10 +981,7 @@ static int syscalls_GetRXByteCount(lua_State* L)
|
|||||||
: "=a"(num), "=b"(NUM)
|
: "=a"(num), "=b"(NUM)
|
||||||
: "a"(74), "b"(9 | device << 8));
|
: "a"(74), "b"(9 | device << 8));
|
||||||
|
|
||||||
if (num == -1)
|
syscalls_ReturnIntegerValueOrNil(num, num | NUM << 31, L);
|
||||||
lua_pushnil(L);
|
|
||||||
else
|
|
||||||
lua_pushinteger(L, (uint64_t)(num | NUM << 31));
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1023,10 +997,7 @@ static int syscalls_GetTXErrorPacketCount(lua_State* L)
|
|||||||
: "=a"(num), "=b"(NUM)
|
: "=a"(num), "=b"(NUM)
|
||||||
: "a"(74), "b"(11 | device << 8));
|
: "a"(74), "b"(11 | device << 8));
|
||||||
|
|
||||||
if (num == -1)
|
syscalls_ReturnIntegerValueOrNil(num, num | NUM << 31, L);
|
||||||
lua_pushnil(L);
|
|
||||||
else
|
|
||||||
lua_pushinteger(L, (uint64_t)(num | NUM << 31));
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1042,10 +1013,7 @@ static int syscalls_GetTXDropPacketCount(lua_State* L)
|
|||||||
: "=a"(num), "=b"(NUM)
|
: "=a"(num), "=b"(NUM)
|
||||||
: "a"(74), "b"(12 | device << 8));
|
: "a"(74), "b"(12 | device << 8));
|
||||||
|
|
||||||
if (num == -1)
|
syscalls_ReturnIntegerValueOrNil(num, num | NUM << 31, L);
|
||||||
lua_pushnil(L);
|
|
||||||
else
|
|
||||||
lua_pushinteger(L, (uint64_t)(num | NUM << 31));
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1061,10 +1029,7 @@ static int syscalls_GetTXMissPacketCount(lua_State* L)
|
|||||||
: "=a"(num), "=b"(NUM)
|
: "=a"(num), "=b"(NUM)
|
||||||
: "a"(74), "b"(13 | device << 8));
|
: "a"(74), "b"(13 | device << 8));
|
||||||
|
|
||||||
if (num == -1)
|
syscalls_ReturnIntegerValueOrNil(num, num | NUM << 31, L);
|
||||||
lua_pushnil(L);
|
|
||||||
else
|
|
||||||
lua_pushinteger(L, (uint64_t)(num | NUM << 31));
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1080,10 +1045,7 @@ static int syscalls_GetRXErrorPacketCount(lua_State* L)
|
|||||||
: "=a"(num), "=b"(NUM)
|
: "=a"(num), "=b"(NUM)
|
||||||
: "a"(74), "b"(14 | device << 8));
|
: "a"(74), "b"(14 | device << 8));
|
||||||
|
|
||||||
if (num == -1)
|
syscalls_ReturnIntegerValueOrNil(num, num | NUM << 31, L);
|
||||||
lua_pushnil(L);
|
|
||||||
else
|
|
||||||
lua_pushinteger(L, (uint64_t)(num | NUM << 31));
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1144,6 +1106,7 @@ static int syscalls_GetConnectionStatus(lua_State* L)
|
|||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
else
|
else
|
||||||
lua_pushinteger(L, num & 0x101);
|
lua_pushinteger(L, num & 0x101);
|
||||||
|
|
||||||
lua_pushinteger(L, (num & FullDuplex) != 0);
|
lua_pushinteger(L, (num & FullDuplex) != 0);
|
||||||
|
|
||||||
return 2;
|
return 2;
|
||||||
@@ -1420,7 +1383,7 @@ static int syscalls_ReadARPEntry(lua_State* L)
|
|||||||
if (eax == -1)
|
if (eax == -1)
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
else
|
else
|
||||||
memcpy(syscalls_pushARPEntry(L), &buffer, sizeof(struct ARP_entry));
|
memcpy(syscalls_pushARPEntry(L), &buffer, sizeof(struct ARP_entry)); // не самый лучший вариант реализации, но если если запушить в луа это раньше то как потом запушить nil? хз может потому будут идеи более адекватной реализации
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1502,7 +1465,7 @@ static const luaL_Reg syscallsLib[] = {
|
|||||||
{"SetWindowTitle", syscalls_setWindowTitle},
|
{"SetWindowTitle", syscalls_setWindowTitle},
|
||||||
{"GetSkinHeight", syscalls_getSkinHeight},
|
{"GetSkinHeight", syscalls_getSkinHeight},
|
||||||
{"SetSkin", syscalls_SetSkin},
|
{"SetSkin", syscalls_SetSkin},
|
||||||
{"GetSkinTitleArea", syscalls_GetSkinTilteArea},
|
{"GetSkinTitleArea", syscalls_GetSkinTitleArea},
|
||||||
/* Buttons funcs*/
|
/* Buttons funcs*/
|
||||||
{"DefineButton", syscalls_defineButton},
|
{"DefineButton", syscalls_defineButton},
|
||||||
{"DeleteButton", syscalls_deleteButton},
|
{"DeleteButton", syscalls_deleteButton},
|
||||||
@@ -1514,11 +1477,16 @@ static const luaL_Reg syscallsLib[] = {
|
|||||||
{"CheckEvent", syscalls_checkEvent},
|
{"CheckEvent", syscalls_checkEvent},
|
||||||
{"WaitEventTimeout", syscalls_waitEventTimeout},
|
{"WaitEventTimeout", syscalls_waitEventTimeout},
|
||||||
/* Background funcs */
|
/* Background funcs */
|
||||||
{"BackgroundSetSize", syscalls_backgroundSetSize},
|
{ "BackgroundSetSize", syscalls_backgroundSetSize },
|
||||||
{"BackgroundPutPixel", syscalls_backgroundPutPixel},
|
{ "BackgroundPutPixel", syscalls_backgroundPutPixel },
|
||||||
{"BackgroundRedraw", syscalls_backgroundRedraw},
|
{ "BackgroundRedraw", syscalls_backgroundRedraw },
|
||||||
|
{ "BackgroundSetDrawMode", syscalls_backgroundSetDrawMode },
|
||||||
|
{ "BackgroundGetDrawMode", syscalls_backgroundGetDrawMode },
|
||||||
|
{ "BackgroundOpenMap", syscalls_backgroundOpenMap },
|
||||||
|
{ "BackgroundCloseMap", syscalls_backgroundCloseMap },
|
||||||
|
{ "BackgroundRedrawArea", syscalls_backgroundRedrawArea },
|
||||||
/* system funcs */
|
/* system funcs */
|
||||||
{"GetRamSize", syscalls_getRamSize},
|
{ "GetRamSize", syscalls_getRamSize },
|
||||||
{"GetFreeRam", syscalls_getFreeRam},
|
{"GetFreeRam", syscalls_getFreeRam},
|
||||||
{"GetCPUClock", syscalls_getCPUClock},
|
{"GetCPUClock", syscalls_getCPUClock},
|
||||||
{"ShutdownPowerOff", syscalls_shutdownPowerOff},
|
{"ShutdownPowerOff", syscalls_shutdownPowerOff},
|
||||||
@@ -1539,8 +1507,8 @@ static const luaL_Reg syscallsLib[] = {
|
|||||||
/* keyboard funcs */
|
/* keyboard funcs */
|
||||||
{"SetKeyInputMode", syscalls_setKeyInputMode},
|
{"SetKeyInputMode", syscalls_setKeyInputMode},
|
||||||
{"GetKeyInputMode", syscalls_getKeyInputMode},
|
{"GetKeyInputMode", syscalls_getKeyInputMode},
|
||||||
{"getKey", syscalls_getKey},
|
{"GetKey", syscalls_getKey},
|
||||||
{"getControlKeyState", syscalls_getControlKeyState},
|
{"GetControlKeyState", syscalls_getControlKeyState},
|
||||||
{"SetHotkey", syscalls_SetHotkey},
|
{"SetHotkey", syscalls_SetHotkey},
|
||||||
{"DeleteHotkey", syscalls_DeleteHotkey},
|
{"DeleteHotkey", syscalls_DeleteHotkey},
|
||||||
{"LockNormalInput", syscalls_LockNormalInput},
|
{"LockNormalInput", syscalls_LockNormalInput},
|
||||||
@@ -1643,35 +1611,25 @@ static inline void syscalls_push_events(lua_State* L)
|
|||||||
{
|
{
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_EVENT_NONE);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_NONE, "None");
|
||||||
lua_setfield(L, -2, "None");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_EVENT_REDRAW);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_REDRAW, "Redraw");
|
||||||
lua_setfield(L, -2, "Redraw");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_EVENT_KEY);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_KEY, "Key");
|
||||||
lua_setfield(L, -2, "Key");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_EVENT_BUTTON);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_BUTTON, "Button");
|
||||||
lua_setfield(L, -2, "Button");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_EVENT_DESKTOP);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_DESKTOP, "Desktop");
|
||||||
lua_setfield(L, -2, "Desktop");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_EVENT_MOUSE);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_MOUSE, "Mouse");
|
||||||
lua_setfield(L, -2, "Mouse");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_EVENT_IPC);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_IPC, "IPC");
|
||||||
lua_setfield(L, -2, "IPC");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_EVENT_NETWORK);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_NETWORK, "Network");
|
||||||
lua_setfield(L, -2, "Network");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_EVENT_DEBUG);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_DEBUG, "Debug");
|
||||||
lua_setfield(L, -2, "Debug");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_EVENT_IRQBEGIN);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_EVENT_IRQBEGIN, "IRQBegin");
|
||||||
lua_setfield(L, -2, "IRQBegin");
|
|
||||||
|
|
||||||
lua_setfield(L, -2, "Event");
|
lua_setfield(L, -2, "Event");
|
||||||
}
|
}
|
||||||
@@ -1680,20 +1638,15 @@ static inline void syscalls_push_buttonCodes(lua_State* L)
|
|||||||
{
|
{
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_MOUSE_LBUTTON_PRESSED);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_MOUSE_LBUTTON_PRESSED, "LeftButton");
|
||||||
lua_setfield(L, -2, "LeftButton");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_MOUSE_RBUTTON_PRESSED);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_MOUSE_RBUTTON_PRESSED, "RightButton");
|
||||||
lua_setfield(L, -2, "RightButton");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_MOUSE_MBUTTON_PRESSED);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_MOUSE_MBUTTON_PRESSED, "MiddleButton");
|
||||||
lua_setfield(L, -2, "MiddleButton");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_MOUSE_4BUTTON_PRESSED);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_MOUSE_4BUTTON_PRESSED, "Button4");
|
||||||
lua_setfield(L, -2, "Button4");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_MOUSE_5BUTTON_PRESSED);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_MOUSE_5BUTTON_PRESSED, "Button5");
|
||||||
lua_setfield(L, -2, "Button5");
|
|
||||||
|
|
||||||
lua_setfield(L, -2, "mouseButtons");
|
lua_setfield(L, -2, "mouseButtons");
|
||||||
}
|
}
|
||||||
@@ -1702,26 +1655,19 @@ static inline void syscalls_push_slotStates(lua_State* L)
|
|||||||
{
|
{
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SLOT_STATE_RUNNING);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SLOT_STATE_RUNNING, "Running");
|
||||||
lua_setfield(L, -2, "Running");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SLOT_STATE_SUSPENDED);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SLOT_STATE_SUSPENDED, "Suspended");
|
||||||
lua_setfield(L, -2, "Suspended");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SLOT_STATE_SUSPENDED_WAIT_EVENT);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SLOT_STATE_SUSPENDED_WAIT_EVENT, "SuspendedWaitEvent");
|
||||||
lua_setfield(L, -2, "SuspendedWaitEvent");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SLOT_STATE_NORMAL_TERM);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SLOT_STATE_NORMAL_TERM, "NormalTerm");
|
||||||
lua_setfield(L, -2, "NormalTerm");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SLOT_STATE_EXCEPT_TERM);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SLOT_STATE_EXCEPT_TERM, "ExceptTerm");
|
||||||
lua_setfield(L, -2, "ExceptTerm");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SLOT_STATE_EXCEPT_TERM);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SLOT_STATE_EXCEPT_TERM, "WaitEvent");
|
||||||
lua_setfield(L, -2, "WaitEvent");
|
|
||||||
|
|
||||||
lua_pushinteger(L, KSYS_SLOT_STATE_WAIT_EVENT);
|
LUA_PUSH_INTEGER_FIELD(L, KSYS_SLOT_STATE_WAIT_EVENT, "Free");
|
||||||
lua_setfield(L, -2, "Free");
|
|
||||||
|
|
||||||
lua_setfield(L, -2, "slotState");
|
lua_setfield(L, -2, "slotState");
|
||||||
}
|
}
|
||||||
@@ -1730,21 +1676,15 @@ static inline void syscalls_push_hotkey_states(lua_State* L)
|
|||||||
{
|
{
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
|
|
||||||
lua_pushinteger(L, 0);
|
LUA_PUSH_INTEGER_FIELD(L, 0, "NoOne");
|
||||||
lua_setfield(L, -2, "hotkeyNoOne");
|
|
||||||
|
|
||||||
lua_pushinteger(L, 1);
|
LUA_PUSH_INTEGER_FIELD(L, 1, "OnlyOne");
|
||||||
lua_setfield(L, -2, "hotkeyOnlyOne");
|
|
||||||
|
|
||||||
lua_pushinteger(L, 2);
|
LUA_PUSH_INTEGER_FIELD(L, 2, "Both");
|
||||||
lua_setfield(L, -2, "hotkeyBoth");
|
|
||||||
|
|
||||||
lua_pushinteger(L, 4);
|
LUA_PUSH_INTEGER_FIELD(L, 4, "LeftOnly");
|
||||||
lua_setfield(L, -2, "hotkeyLeftOnly");
|
|
||||||
|
|
||||||
lua_pushinteger(L, 5);
|
|
||||||
lua_setfield(L, -2, "hotkeyRightOnly");
|
|
||||||
|
|
||||||
|
LUA_PUSH_INTEGER_FIELD(L, 5, "RightOnly");
|
||||||
|
|
||||||
lua_setfield(L, -2, "hotkeyStates");
|
lua_setfield(L, -2, "hotkeyStates");
|
||||||
}
|
}
|
||||||
@@ -1753,12 +1693,9 @@ static inline void syscalls_push_buttonsStyle(lua_State* L)
|
|||||||
{
|
{
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
|
|
||||||
lua_pushinteger(L, 0);
|
LUA_PUSH_INTEGER_FIELD(L, 0, "Flat");
|
||||||
lua_setfield(L, -2, "ButtonStyleFlat");
|
|
||||||
|
|
||||||
lua_pushinteger(L, 1);
|
|
||||||
lua_setfield(L, -2, "ButtonStyleVolume");
|
|
||||||
|
|
||||||
|
LUA_PUSH_INTEGER_FIELD(L, 1, "Volume");
|
||||||
|
|
||||||
lua_setfield(L, -2, "buttonStyle");
|
lua_setfield(L, -2, "buttonStyle");
|
||||||
}
|
}
|
||||||
@@ -1767,20 +1704,15 @@ static inline void syscalls_push_windowStyles(lua_State* L)
|
|||||||
{
|
{
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
|
|
||||||
lua_pushinteger(L, 0);
|
LUA_PUSH_INTEGER_FIELD(L, 0, "FixSizes");
|
||||||
lua_setfield(L, -2, "FixSizes");
|
|
||||||
|
|
||||||
lua_pushinteger(L, 1);
|
LUA_PUSH_INTEGER_FIELD(L, 1, "NoDraw");
|
||||||
lua_setfield(L, -2, "NoDraw");
|
|
||||||
|
|
||||||
lua_pushinteger(L, 2);
|
LUA_PUSH_INTEGER_FIELD(L, 2, "CanChangeSizes");
|
||||||
lua_setfield(L, -2, "CanChangeSizes");
|
|
||||||
|
|
||||||
lua_pushinteger(L, 3);
|
LUA_PUSH_INTEGER_FIELD(L, 3, "WithSkin");
|
||||||
lua_setfield(L, -2, "WithSkin");
|
|
||||||
|
|
||||||
lua_pushinteger(L, 4);
|
LUA_PUSH_INTEGER_FIELD(L, 4, "WithSkinFixSizes");
|
||||||
lua_setfield(L, -2, "WithSkinFixSizes");
|
|
||||||
|
|
||||||
lua_setfield(L, -2, "windowStyle");
|
lua_setfield(L, -2, "windowStyle");
|
||||||
}
|
}
|
||||||
@@ -1789,11 +1721,9 @@ static inline void syscalls_push_buttons(lua_State* L)
|
|||||||
{
|
{
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
|
|
||||||
lua_pushinteger(L, 0xffff);
|
LUA_PUSH_INTEGER_FIELD(L, 0xffff, "minimization");
|
||||||
lua_setfield(L, -2, "minimization");
|
|
||||||
|
|
||||||
lua_pushinteger(L, 1);
|
LUA_PUSH_INTEGER_FIELD(L, 1, "close");
|
||||||
lua_setfield(L, -2, "close");
|
|
||||||
|
|
||||||
lua_setfield(L, -2, "buttons");
|
lua_setfield(L, -2, "buttons");
|
||||||
}
|
}
|
||||||
@@ -1802,20 +1732,15 @@ static inline void syscalls_push_connectionStatus(lua_State* L)
|
|||||||
{
|
{
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
|
|
||||||
lua_pushinteger(L, NoConnect);
|
LUA_PUSH_INTEGER_FIELD(L, NoConnect, "No");
|
||||||
lua_setfield(L, -2, "no");
|
|
||||||
|
|
||||||
lua_pushinteger(L, Unknown);
|
LUA_PUSH_INTEGER_FIELD(L, Unknown, "Unknown");
|
||||||
lua_setfield(L, -2, "unknown");
|
|
||||||
|
|
||||||
lua_pushinteger(L, Mb10);
|
LUA_PUSH_INTEGER_FIELD(L, Mb10, "10Mb");
|
||||||
lua_setfield(L, -2, "10Mb");
|
|
||||||
|
|
||||||
lua_pushinteger(L, Mb100);
|
LUA_PUSH_INTEGER_FIELD(L, Mb100, "100Mb");
|
||||||
lua_setfield(L, -2, "100Mb");
|
|
||||||
|
|
||||||
lua_pushinteger(L, Gb);
|
LUA_PUSH_INTEGER_FIELD(L, Gb, "1GB");
|
||||||
lua_setfield(L, -2, "1Gb");
|
|
||||||
|
|
||||||
lua_setfield(L, -2, "connectionStatus");
|
lua_setfield(L, -2, "connectionStatus");
|
||||||
}
|
}
|
||||||
@@ -1826,6 +1751,8 @@ LUALIB_API int luaopen_syscalls(lua_State* L)
|
|||||||
{
|
{
|
||||||
luaL_newlib(L, syscallsLib);
|
luaL_newlib(L, syscallsLib);
|
||||||
|
|
||||||
|
syscalls_push_library_version(L);
|
||||||
|
|
||||||
syscalls_push_events(L);
|
syscalls_push_events(L);
|
||||||
syscalls_push_slotStates(L);
|
syscalls_push_slotStates(L);
|
||||||
syscalls_register_scancodes(L);
|
syscalls_register_scancodes(L);
|
||||||
@@ -1838,6 +1765,7 @@ LUALIB_API int luaopen_syscalls(lua_State* L)
|
|||||||
|
|
||||||
syscalls_register_ARPEntry(L);
|
syscalls_register_ARPEntry(L);
|
||||||
syscalls_register_SystemColors(L);
|
syscalls_register_SystemColors(L);
|
||||||
|
syscalls_register_Version(L);
|
||||||
|
|
||||||
_ksys_set_event_mask(7); // set default event mask
|
_ksys_set_event_mask(7); // set default event mask
|
||||||
|
|
||||||
|
@@ -4,8 +4,9 @@
|
|||||||
#include <lua.h>
|
#include <lua.h>
|
||||||
#include <lualib.h>
|
#include <lualib.h>
|
||||||
#include <lauxlib.h>
|
#include <lauxlib.h>
|
||||||
|
#include <sys/ksys.h>
|
||||||
|
|
||||||
inline void syscalls_ReturnIntegerOrNil(LUA_INTEGER value, lua_State* L)
|
static inline void syscalls_ReturnIntegerOrNil(LUA_INTEGER value, lua_State* L)
|
||||||
{
|
{
|
||||||
if (value == -1)
|
if (value == -1)
|
||||||
{
|
{
|
||||||
@@ -17,7 +18,7 @@ inline void syscalls_ReturnIntegerOrNil(LUA_INTEGER value, lua_State* L)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void syscalls_ReturnIntegerValueOrNil(LUA_INTEGER cond, LUA_INTEGER value, lua_State* L)
|
static inline void syscalls_ReturnIntegerValueOrNil(LUA_INTEGER cond, LUA_INTEGER value, lua_State* L)
|
||||||
{
|
{
|
||||||
if (cond == -1)
|
if (cond == -1)
|
||||||
{
|
{
|
||||||
@@ -29,7 +30,7 @@ inline void syscalls_ReturnIntegerValueOrNil(LUA_INTEGER cond, LUA_INTEGER value
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void syscalls_ReturnTrueOrNil(LUA_INTEGER value, lua_State* L)
|
static inline void syscalls_ReturnTrueOrNil(LUA_INTEGER value, lua_State* L)
|
||||||
{
|
{
|
||||||
if (value == -1)
|
if (value == -1)
|
||||||
{
|
{
|
||||||
@@ -41,7 +42,7 @@ inline void syscalls_ReturnTrueOrNil(LUA_INTEGER value, lua_State* L)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void syscalls_ReturnStringOrNil(LUA_INTEGER cond, const char* value, lua_State* L)
|
static inline void syscalls_ReturnStringOrNil(LUA_INTEGER cond, const char* value, lua_State* L)
|
||||||
{
|
{
|
||||||
if (cond == -1)
|
if (cond == -1)
|
||||||
{
|
{
|
||||||
@@ -53,4 +54,27 @@ 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);
|
||||||
|
|
||||||
|
static inline ksys_pos_t syscalls_check_pos_t(lua_State* L, int index)
|
||||||
|
{
|
||||||
|
ksys_pos_t pos;
|
||||||
|
|
||||||
|
pos.x = luaL_checkinteger(L, index);
|
||||||
|
pos.y = luaL_checkinteger(L, index + 1);
|
||||||
|
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void syscalls_push_pos_t(lua_State* L, ksys_pos_t pos)
|
||||||
|
{
|
||||||
|
lua_createtable(L, 0, 2);
|
||||||
|
|
||||||
|
LUA_PUSH_INTEGER_FIELD(L, pos.x, "x");
|
||||||
|
|
||||||
|
LUA_PUSH_INTEGER_FIELD(L, pos.y, "y");
|
||||||
|
}
|
||||||
|
|
||||||
#endif // __SYSCALLS_H__
|
#endif // __SYSCALLS_H__
|
||||||
|
13
src/version/coreversion.c
Normal file
13
src/version/coreversion.c
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#include "coreversion.h"
|
||||||
|
|
||||||
|
int syscalls_GetCoreVersion(lua_State* L)
|
||||||
|
{
|
||||||
|
struct core_version* ver = syscalls_pushVersion(L);
|
||||||
|
|
||||||
|
asm_inline(
|
||||||
|
"int $0x40"
|
||||||
|
::"a"(18), "b"(13), "c"(ver)
|
||||||
|
);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
8
src/version/coreversion.h
Normal file
8
src/version/coreversion.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#ifndef __CORE_VERSION_H__
|
||||||
|
#define __CORE_VERSION_H__
|
||||||
|
|
||||||
|
#include "version_type.h"
|
||||||
|
|
||||||
|
int syscalls_GetCoreVersion(lua_State *L);
|
||||||
|
|
||||||
|
#endif // __CORE_VERSION_H__
|
17
src/version/library_version.h
Normal file
17
src/version/library_version.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#ifndef __LIBRARY_VERSION_H__
|
||||||
|
#define __LIBRARY_VERSION_H__
|
||||||
|
|
||||||
|
#include "../syscalls.h"
|
||||||
|
|
||||||
|
inline void syscalls_push_library_version(lua_State* L)
|
||||||
|
{
|
||||||
|
lua_createtable(L, 0, 3);
|
||||||
|
|
||||||
|
LUA_PUSH_INTEGER_FIELD(L, SYSCALLS_VERSION_A, "a");
|
||||||
|
LUA_PUSH_INTEGER_FIELD(L, SYSCALLS_VERSION_B, "b");
|
||||||
|
LUA_PUSH_INTEGER_FIELD(L, SYSCALLS_VERSION_C, "c");
|
||||||
|
|
||||||
|
lua_setfield(L, -2, "version");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBRARY_VERSION_H__
|
202
src/version/version_type.c
Normal file
202
src/version/version_type.c
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
#include "version_type.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include "../debug.h"
|
||||||
|
|
||||||
|
static int syscalls_indexVersion(lua_State* L)
|
||||||
|
{
|
||||||
|
struct core_version* r = luaL_checkudata(L, 1, syscalls_Version_metatable_name);
|
||||||
|
const char* index = luaL_checkstring(L, 2);
|
||||||
|
|
||||||
|
if (strcmp(index, "a") == 0)
|
||||||
|
{
|
||||||
|
lua_pushinteger(L, r->a);
|
||||||
|
}
|
||||||
|
else if (strcmp(index, "b") == 0)
|
||||||
|
{
|
||||||
|
lua_pushinteger(L, r->b);
|
||||||
|
}
|
||||||
|
else if (strcmp(index, "c") == 0)
|
||||||
|
{
|
||||||
|
lua_pushinteger(L, r->c);
|
||||||
|
}
|
||||||
|
else if (strcmp(index, "d") == 0)
|
||||||
|
{
|
||||||
|
lua_pushinteger(L, r->d);
|
||||||
|
}
|
||||||
|
else if (strcmp(index, "rev") == 0)
|
||||||
|
{
|
||||||
|
lua_pushinteger(L, r->revision);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lua_pushnil(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int syscalls_newindexVersion(lua_State* L)
|
||||||
|
{
|
||||||
|
struct core_version* r = luaL_checkudata(L, 1, syscalls_Version_metatable_name);
|
||||||
|
const char* index = luaL_checkstring(L, 2);
|
||||||
|
uint32_t val = luaL_checkinteger(L, 3);
|
||||||
|
|
||||||
|
if (strcmp(index, "a") == 0)
|
||||||
|
{
|
||||||
|
r->a = val;
|
||||||
|
}
|
||||||
|
else if (strcmp(index, "b") == 0)
|
||||||
|
{
|
||||||
|
r->b = val;
|
||||||
|
}
|
||||||
|
else if (strcmp(index, "c") == 0)
|
||||||
|
{
|
||||||
|
r->c = val;
|
||||||
|
}
|
||||||
|
else if (strcmp(index, "d") == 0)
|
||||||
|
{
|
||||||
|
r->d = val;
|
||||||
|
}
|
||||||
|
else if (strcmp(index, "rev") == 0)
|
||||||
|
{
|
||||||
|
r->revision = val;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
luaL_error(L, "wrong index: %s", index);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int syscalls_eqVersion(lua_State* L)
|
||||||
|
{
|
||||||
|
lua_pushboolean(
|
||||||
|
L,
|
||||||
|
memcmp(
|
||||||
|
luaL_checkudata(L, 1, syscalls_Version_metatable_name),
|
||||||
|
luaL_checkudata(L, 2, syscalls_Version_metatable_name),
|
||||||
|
sizeof(struct core_version)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int syscalls_ltVersion(lua_State* L)
|
||||||
|
{
|
||||||
|
struct core_version* a = luaL_checkudata(L, 1, syscalls_Version_metatable_name);
|
||||||
|
struct core_version* b = luaL_checkudata(L, 2, syscalls_Version_metatable_name);
|
||||||
|
|
||||||
|
bool r;
|
||||||
|
|
||||||
|
if (a->a < b->a)
|
||||||
|
r = true;
|
||||||
|
else if (a->b < b->b)
|
||||||
|
r = true;
|
||||||
|
else if (a->c < b->c)
|
||||||
|
r = true;
|
||||||
|
else if (a->d < b->d)
|
||||||
|
r = true;
|
||||||
|
else if (a->revision < b->revision)
|
||||||
|
r = true;
|
||||||
|
else
|
||||||
|
r = false;
|
||||||
|
|
||||||
|
lua_pushboolean(L, r);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int syscalls_leVersion(lua_State* L)
|
||||||
|
{
|
||||||
|
struct core_version* a = luaL_checkudata(L, 1, syscalls_Version_metatable_name);
|
||||||
|
struct core_version* b = luaL_checkudata(L, 2, syscalls_Version_metatable_name);
|
||||||
|
|
||||||
|
bool r;
|
||||||
|
|
||||||
|
if (a->a <= b->a)
|
||||||
|
r = true;
|
||||||
|
else if (a->b <= b->b)
|
||||||
|
r = true;
|
||||||
|
else if (a->c <= b->c)
|
||||||
|
r = true;
|
||||||
|
else if (a->d <= b->d)
|
||||||
|
r = true;
|
||||||
|
else if (a->revision <= b->revision)
|
||||||
|
r = true;
|
||||||
|
else
|
||||||
|
r = false;
|
||||||
|
|
||||||
|
lua_pushboolean(L, r);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int syscalls_tostringVersion(lua_State* L)
|
||||||
|
{
|
||||||
|
// AAA.BBB.CCC.DDD.RRRRRRRRRRRRR
|
||||||
|
// +1 на конце на всякий случай
|
||||||
|
char buff[4 + 4 + 4 + 4 + 13 + 1];
|
||||||
|
struct core_version* a = luaL_checkudata(L, 1, syscalls_Version_metatable_name);
|
||||||
|
|
||||||
|
sprintf(buff, "%d.%d.%d.%d.%d", a->a, a->b, a->c, a->d, a->revision);
|
||||||
|
|
||||||
|
lua_pushstring(L, buff);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const luaL_Reg syscalls_Version_m[] = {
|
||||||
|
{"__index", syscalls_indexVersion},
|
||||||
|
{"__newindex", syscalls_newindexVersion},
|
||||||
|
{"__eq", syscalls_eqVersion},
|
||||||
|
{"__lt", syscalls_ltVersion},
|
||||||
|
{"__le", syscalls_ltVersion},
|
||||||
|
{"__tostring", syscalls_tostringVersion},
|
||||||
|
{NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct core_version* syscalls_pushVersion(lua_State* L)
|
||||||
|
{
|
||||||
|
DEBUG_LINE("push Version entry");
|
||||||
|
|
||||||
|
struct core_version* entry = lua_newuserdata(L, sizeof(struct core_version));
|
||||||
|
|
||||||
|
luaL_setmetatable(L, syscalls_Version_metatable_name);
|
||||||
|
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int syscalls_newVersion(lua_State* L)
|
||||||
|
{
|
||||||
|
struct core_version* r = syscalls_pushVersion(L);
|
||||||
|
memset(r, 0, sizeof(struct core_version));
|
||||||
|
|
||||||
|
r->a = luaL_checkinteger(L, 1);
|
||||||
|
r->b = luaL_checkinteger(L, 2);
|
||||||
|
r->c = luaL_checkinteger(L, 3);
|
||||||
|
r->d = luaL_checkinteger(L, 4);
|
||||||
|
r->revision = luaL_checkinteger(L, 5);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const luaL_Reg syscalls_Version_lib[] = {
|
||||||
|
{"new", syscalls_newVersion},
|
||||||
|
{NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
void syscalls_register_Version(lua_State* L)
|
||||||
|
{
|
||||||
|
DEBUG_LINE("register Version entry");
|
||||||
|
|
||||||
|
luaL_newlib(L, syscalls_Version_lib);
|
||||||
|
|
||||||
|
lua_setfield(L, -2, syscalls_Version_name);
|
||||||
|
|
||||||
|
|
||||||
|
luaL_newmetatable(L, syscalls_Version_metatable_name);
|
||||||
|
luaL_setfuncs(L, syscalls_Version_m, 0);
|
||||||
|
|
||||||
|
lua_pop(L, 1);
|
||||||
|
}
|
28
src/version/version_type.h
Normal file
28
src/version/version_type.h
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#ifndef __VERSION_TYPE_H__
|
||||||
|
#define __VERSION_TYPE_H__
|
||||||
|
|
||||||
|
#include <sys/ksys.h>
|
||||||
|
#include "../syscalls.h"
|
||||||
|
|
||||||
|
// sub library name
|
||||||
|
#define syscalls_Version_name "CoreVersion"
|
||||||
|
#define syscalls_Version_metatable_name "Version table"
|
||||||
|
#define syscalls_Version_metatable_name "Version metatable"
|
||||||
|
|
||||||
|
struct core_version
|
||||||
|
{
|
||||||
|
uint8_t a;
|
||||||
|
uint8_t b;
|
||||||
|
uint8_t c;
|
||||||
|
uint8_t d;
|
||||||
|
uint8_t zero;
|
||||||
|
uint32_t revision;
|
||||||
|
|
||||||
|
uint32_t unused;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct core_version* syscalls_pushVersion(lua_State* L);
|
||||||
|
|
||||||
|
void syscalls_register_Version(lua_State* L);
|
||||||
|
|
||||||
|
#endif // __VERSION_TYPE_H__
|
Reference in New Issue
Block a user