Allow changing wallpapers from shell

This commit is contained in:
Juhani Krekelä 2023-03-23 00:54:35 +02:00
parent c455758566
commit be727d8757
2 changed files with 44 additions and 11 deletions

View File

@ -1,5 +1,5 @@
ANSI art is my
passion
ANSI art is my passion

View File

@ -43,13 +43,7 @@ initialize:
.not_relaunch:
; Set wallpaper
mov si, wallpaper_name
xor dx, dx
call PONYDOS_SEG:SYS_OPEN_FILE
mov bx, GLOBAL_WALLPAPER
xor di, di ; read
call PONYDOS_SEG:SYS_MODIFY_SECTORS
call set_wallpaper
; Create icon for the disk on the desktop
mov ax, cs
@ -340,10 +334,33 @@ hide_file_window:
launch:
mov si, launch_filename
; Is it a .bin file?
; Is it a .wall file?
call strlen
cmp cx, 5
jb .not_wall
add si, cx
sub si, 5
mov di, wall_extension
call strcmp
jne .not_wall
mov ax, cs
mov es, ax
mov si, launch_filename
mov di, wallpaper_name
mov cx, FS_DIRENT_NAME_SIZE
rep movsb
call set_wallpaper
call request_redraw
jmp .end
.not_wall:
; Is it a .bin file?
cmp cx, 4
jb .end ; No, too short
mov si, launch_filename
add si, cx
sub si, 4
mov di, bin_extension
@ -402,6 +419,20 @@ launch:
.end:
ret
; out:
; clobbers everything
set_wallpaper:
mov ax, PONYDOS_SEG
mov es, ax
mov si, wallpaper_name
xor dx, dx
call PONYDOS_SEG:SYS_OPEN_FILE
mov bx, GLOBAL_WALLPAPER
xor di, di ; read
call PONYDOS_SEG:SYS_MODIFY_SECTORS
ret
; in:
; al = WM_KEYBOARD
; bx = window ID
@ -748,9 +779,11 @@ forward_event:
pop bp
ret
wallpaper_name db 'ponydos.wall', 0
wallpaper_name db 'ponydos.wall'
times FS_DIRENT_NAME_SIZE-12 db 0
bin_extension db '.bin', 0
wall_extension db '.wall', 0
%include "debug.inc"