Wrap set_skin, unpacker works now.

This commit is contained in:
2020-02-08 21:27:29 +03:00
parent 6cd18d6be7
commit 3175553eb7
5 changed files with 39 additions and 21 deletions

8
kofu.c
View File

@@ -298,6 +298,13 @@ void kofu_display_number(int argc, const char **argv) {
umka_sys_display_number(is_pointer, base, digits_to_display, is_qword, show_leading_zeros, number_or_pointer, x, y, color, fill_background, font, draw_to_buffer, scale_factor, background_color_or_buffer);
}
void kofu_set_skin(int argc, const char **argv) {
(void)argc;
const char *path = argv[1];
int32_t status = umka_sys_set_skin(path);
printf("status: %" PRIi32 "\n", status);
}
void kofu_get_font_smoothing(int argc, const char **argv) {
(void)argc;
(void)argv;
@@ -711,6 +718,7 @@ func_table_t funcs[] = {
{ "draw_rect", kofu_draw_rect },
{ "draw_line", kofu_draw_line },
{ "display_number", kofu_display_number },
{ "set_skin", kofu_set_skin },
{ "get_font_smoothing", kofu_get_font_smoothing },
{ "set_font_smoothing", kofu_set_font_smoothing },
{ "put_image_palette", kofu_put_image_palette },

View File

@@ -14,6 +14,13 @@ lang fix en
preboot_blogesc = 0 ; start immediately after bootlog
pci_code_sel = 0
VESA_1_2_VIDEO = 0 ; enable vesa 1.2 bank switch functions
macro int n {
if n eq 0x40
call i40
else
int n
end if
}
purge mov,add,sub
purge mov,add,sub
@@ -69,9 +76,7 @@ include 'video/cursors.inc'
include 'unpacker.inc'
include 'gui/window.inc'
include 'gui/button.inc'
load_file equ __load_file
include 'gui/skincode.inc'
restore load_file
include 'sysother.inc'
include 'gui/draw.inc'
include 'gui/font.inc'
@@ -198,9 +203,13 @@ proc kos_init c uses ebx esi edi ebp
call init_kernel_heap
call init_malloc
stdcall kernel_alloc, (unpack.LZMA_BASE_SIZE+(unpack.LZMA_LIT_SIZE shl \
(unpack.lc+unpack.lp)))*4
mov [unpack.p], eax
mov dword[sysdir_name], 'sys'
mov dword[sysdir_path], 'HD0/'
mov word[sysdir_path+4], '1'
mov dword[sysdir_path], 'RD/1'
mov word[sysdir_path+4], 0
mov ebx, SLOT_BASE + 2*256
mov [current_slot], ebx
@@ -255,7 +264,7 @@ proc kos_init c uses ebx esi edi ebp
call set_window_defaults
mov [skin_data], 0
call load_default_skin
; call load_default_skin
ret
endp
@@ -521,19 +530,6 @@ sys_posix:
sys_end:
ret
proc __load_file _filename
push ebx ecx edx esi edi
stdcall kernel_alloc, skin_size
push eax
mov esi, skin
mov edi, eax
mov ecx, skin_size
rep movsb
pop eax
pop edi esi edx ecx ebx
ret
endp
coverage_end:
public coverage_end
@@ -551,10 +547,7 @@ vdisk_functions:
dd 0 ; adjust_cache_size
vdisk_functions_end:
disk_name db 'hd0',0
;IncludeIGlobals
skin file 'skin.skn'
skin_size = $ - skin
include 'hid/mousedrv.inc'
screen_workarea RECT

View File

@@ -155,6 +155,7 @@ typedef struct {
uint32_t kos_time_to_epoch(uint32_t *time);
void kos_init(void);
void i40(void);
int32_t set_skin(const char *path);
void *kos_disk_add(const char *file_name, const char *disk_name);
int kos_disk_del(const char *name);
uint32_t kos_getcwd(char *buf, uint32_t len);

View File

@@ -155,6 +155,18 @@ static inline void umka_sys_display_number(int is_pointer, int base,
: "memory");
}
static inline int32_t umka_sys_set_skin(const char *path) {
int32_t status;
__asm__ __inline__ __volatile__ (
"call i40"
: "=a" (status)
: "a"(48),
"b"(8),
"c"(path)
: "memory");
return status;
}
static inline int umka_sys_get_smoothing() {
int type;
__asm__ __inline__ __volatile__ (

View File

@@ -1,3 +1,5 @@
disk_add ../img/kolibri.img rd
set_skin /sys/DEFAULT.SKN
window_redraw 1
draw_window 0 300 0 200 0x000088 1 1 1 0 1 4 hello
set_pixel 0 0 0x0000ff
@@ -34,3 +36,5 @@ dump_win_pos 5
process_info -1
scrot umka.rgba
disk_del rd