Add a non-launchable-file error dialog to shell
This commit is contained in:
parent
faf66bbdb8
commit
68570ff2ad
46
shell.asm
46
shell.asm
|
@ -20,6 +20,7 @@ endstruc
|
||||||
WINDOW_ID_ICON equ 0
|
WINDOW_ID_ICON equ 0
|
||||||
WINDOW_ID_FILE_WINDOW equ 1
|
WINDOW_ID_FILE_WINDOW equ 1
|
||||||
WINDOW_ID_OOM_ERROR equ 2
|
WINDOW_ID_OOM_ERROR equ 2
|
||||||
|
WINDOW_ID_LAUNCH_ERROR equ 3
|
||||||
|
|
||||||
WINDOW_MOVE equ 1
|
WINDOW_MOVE equ 1
|
||||||
WINDOW_RESIZE equ 2
|
WINDOW_RESIZE equ 2
|
||||||
|
@ -87,6 +88,12 @@ initialize:
|
||||||
mov word [windows + WINDOW_ID_OOM_ERROR*window.size + window.y], 10
|
mov word [windows + WINDOW_ID_OOM_ERROR*window.size + window.y], 10
|
||||||
mov word [windows + WINDOW_ID_OOM_ERROR*window.size + window.data], oom_error_dialog
|
mov word [windows + WINDOW_ID_OOM_ERROR*window.size + window.data], oom_error_dialog
|
||||||
|
|
||||||
|
mov word [windows + WINDOW_ID_LAUNCH_ERROR*window.size + window.width], FS_DIRENT_NAME_SIZE-1 ; Size includes null terminator
|
||||||
|
mov word [windows + WINDOW_ID_LAUNCH_ERROR*window.size + window.height], 3
|
||||||
|
mov word [windows + WINDOW_ID_LAUNCH_ERROR*window.size + window.x], 24
|
||||||
|
mov word [windows + WINDOW_ID_LAUNCH_ERROR*window.size + window.y], 11
|
||||||
|
mov word [windows + WINDOW_ID_LAUNCH_ERROR*window.size + window.data], launch_error_dialog
|
||||||
|
|
||||||
call request_redraw
|
call request_redraw
|
||||||
|
|
||||||
.end:
|
.end:
|
||||||
|
@ -551,14 +558,13 @@ launch:
|
||||||
sub si, 4
|
sub si, 4
|
||||||
mov di, bin_extension
|
mov di, bin_extension
|
||||||
call strcmp
|
call strcmp
|
||||||
jne .end ; No, wrong extension
|
jne .not_launchable ; No, wrong extension
|
||||||
|
|
||||||
mov si, launch_filename
|
mov si, launch_filename
|
||||||
mov dx, 1 ; Don't create a new file if not found
|
mov dx, 1 ; Don't create a new file if not found
|
||||||
call PONYDOS_SEG:SYS_OPEN_FILE
|
call PONYDOS_SEG:SYS_OPEN_FILE
|
||||||
test ax, ax
|
test ax, ax
|
||||||
; TODO: Display an alert on file not being found
|
jz .not_launchable
|
||||||
jz .end
|
|
||||||
|
|
||||||
push ax
|
push ax
|
||||||
push cx
|
push cx
|
||||||
|
@ -609,6 +615,24 @@ launch:
|
||||||
.end:
|
.end:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.not_launchable:
|
||||||
|
; Copy filename into the launch error dialog
|
||||||
|
mov si, launch_filename
|
||||||
|
mov di, launch_error_dialog.filename
|
||||||
|
mov cx, FS_DIRENT_NAME_SIZE-1
|
||||||
|
.loop:
|
||||||
|
lodsb
|
||||||
|
stosb
|
||||||
|
inc di
|
||||||
|
loop .loop
|
||||||
|
|
||||||
|
; Show dialog
|
||||||
|
mov ax, cs
|
||||||
|
add ax, WINDOW_ID_LAUNCH_ERROR
|
||||||
|
mov si, windows + WINDOW_ID_LAUNCH_ERROR*window.size
|
||||||
|
call show_window
|
||||||
|
ret
|
||||||
|
|
||||||
; out:
|
; out:
|
||||||
; clobbers everything
|
; clobbers everything
|
||||||
set_wallpaper:
|
set_wallpaper:
|
||||||
|
@ -1072,12 +1096,26 @@ oom_error_dialog:
|
||||||
db 'E', 0x0f, 'r', 0x0f, 'r', 0x0f, 'o', 0x0f, 'r', 0x0f
|
db 'E', 0x0f, 'r', 0x0f, 'r', 0x0f, 'o', 0x0f, 'r', 0x0f
|
||||||
times 13-5-1 db 0x00, 0x0f
|
times 13-5-1 db 0x00, 0x0f
|
||||||
db 'x', 0x0f
|
db 'x', 0x0f
|
||||||
db 'O', 0xf0, 'u', 0xf0, 't', 0xf0, ' ', 0xf0, 'o', 0xf0, 'f', 0xf0, ' ', 0xf0, 'm', 0xf0, 'e', 0xf0, 'm', 0xf0, 'o', 0xf0, 'r', 0xf0, 'y', 0xf0
|
db 'O', 0xf0, 'u', 0xf0, 't', 0xf0, ' ', 0xf0, 'o', 0xf0, 'f', 0xf0
|
||||||
|
db ' ', 0xf0, 'm', 0xf0, 'e', 0xf0, 'm', 0xf0, 'o', 0xf0, 'r', 0xf0
|
||||||
|
db 'y', 0xf0
|
||||||
|
|
||||||
|
launch_error_dialog:
|
||||||
|
db 'E', 0x0f, 'r', 0x0f, 'r', 0x0f, 'o', 0x0f, 'r', 0x0f
|
||||||
|
times FS_DIRENT_NAME_SIZE-1-5-1 db 0x00, 0x0f
|
||||||
|
db 'x', 0x0f
|
||||||
|
db 'C', 0xf0, 'a', 0xf0, 'n', 0xf0, 'n', 0xf0, 'o', 0xf0, 't', 0xf0
|
||||||
|
db ' ', 0xf0, 'l', 0xf0, 'a', 0xf0, 'u', 0xf0, 'n', 0xf0, 'c', 0xf0
|
||||||
|
db 'h', 0xf0, ' ', 0xf0, 'f', 0xf0, 'i', 0xf0, 'l', 0xf0, 'e', 0xf0
|
||||||
|
db ':', 0xf0
|
||||||
|
times FS_DIRENT_NAME_SIZE-1-19 db 0x00, 0xf0
|
||||||
|
.filename times FS_DIRENT_NAME_SIZE-1 db 0x00, 0xf0
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
times window.size db 0
|
times window.size db 0
|
||||||
times window.size db 0
|
times window.size db 0
|
||||||
times window.size db 0
|
times window.size db 0
|
||||||
|
times window.size db 0
|
||||||
|
|
||||||
launch_filename times FS_DIRENT_NAME_SIZE db 0
|
launch_filename times FS_DIRENT_NAME_SIZE db 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue