From df6ac3618cb3f8d038ffbc99dd5ce65e14068323 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Thu, 30 Dec 2021 01:57:38 +0000 Subject: [PATCH] buddhabrot: code refactoring, add "set as wallpaper" feature, fix rection on keys, add to IMG eolite: small fix git-svn-id: svn://kolibrios.org@9525 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/Tupfile.lua | 2 +- data/eng/settings/menu.dat | 1 + data/rus/settings/menu.dat | 1 + programs/cmm/eolite/include/left_panel.h | 3 +- .../demos/buddhabrot/trunk/buddhabrot.asm | 161 ++++++++---------- 5 files changed, 76 insertions(+), 92 deletions(-) diff --git a/data/Tupfile.lua b/data/Tupfile.lua index 2452ebf5fa..18b942a628 100644 --- a/data/Tupfile.lua +++ b/data/Tupfile.lua @@ -443,6 +443,7 @@ tup.append_table(img_files, { {"3D/RAY", PROGS .. "/demos/ray/ray"}, {"3D/VIEW3DS", PROGS .. "/demos/view3ds/view3ds"}, {"DEMOS/BCDCLK", PROGS .. "/demos/bcdclk/trunk/bcdclk"}, + {"DEMOS/BUGHBROT", PROGS .. "/demos/buddhabrot/trunk/buddhabrot"}, {"DEMOS/EYES", PROGS .. "/demos/eyes/trunk/eyes"}, {"DEMOS/FIREWORK", PROGS .. "/demos/firework/trunk/firework"}, {"DEMOS/MOVBACK", PROGS .. "/demos/movback/trunk/movback"}, @@ -585,7 +586,6 @@ tup.append_table(extra_files, { {"kolibrios/3D/voxel_utilites/VOX_CREATOR" , PROGS .. "/media/voxel_editor/utilites/vox_creator"}, {"kolibrios/3D/voxel_utilites/VOX_MOVER" , PROGS .. "/media/voxel_editor/utilites/vox_mover"}, {"kolibrios/3D/voxel_utilites/VOX_TGL" , PROGS .. "/media/voxel_editor/utilites/vox_tgl"}, - {"kolibrios/demos/buddhabrot", PROGS .. "/demos/buddhabrot/trunk/buddhabrot"}, {"kolibrios/demos/life3", PROGS .. "/games/life3/trunk/life3"}, {"kolibrios/demos/qjulia", PROGS .. "/demos/qjulia/trunk/qjulia"}, {"kolibrios/develop/utils/koldbg", PROGS .. "/develop/koldbg/koldbg"}, diff --git a/data/eng/settings/menu.dat b/data/eng/settings/menu.dat index 55316ec947..bb9266fa50 100644 --- a/data/eng/settings/menu.dat +++ b/data/eng/settings/menu.dat @@ -25,6 +25,7 @@ 16 Web |demos/web 16 FireWork |demos/firework 16 UnvWater |demos/unvwater +16 Buddhabrot |demos/budhbrot #2 **** 3D 15 Crown Screensaver |3d/crownscr 15 Labyrinth |3d/free3d04 diff --git a/data/rus/settings/menu.dat b/data/rus/settings/menu.dat index d22caed4c0..0e2ea85239 100644 --- a/data/rus/settings/menu.dat +++ b/data/rus/settings/menu.dat @@ -25,6 +25,7 @@ 16 Паутинка |demos/web 16 Фейерверк |demos/firework 16 UnvWater |demos/unvwater +16 Buddhabrot |demos/budhbrot #2 **** 3D 15 Скринсейвер |3d/crownscr 15 3D-Лабиринт |3d/free3d04 diff --git a/programs/cmm/eolite/include/left_panel.h b/programs/cmm/eolite/include/left_panel.h index f60684b986..4f600a310a 100644 --- a/programs/cmm/eolite/include/left_panel.h +++ b/programs/cmm/eolite/include/left_panel.h @@ -59,7 +59,8 @@ void GetDiskIconAndName(dword dev_name, icon, disc_name) if (ESBYTE[icon]==4) { //show label only for hard disk drives - if (volume_label = GetVolumeLabel(dev_name)) { + volume_label = GetVolumeLabel(dev_name); + if (ESBYTE[volume_label]) { strncpy(disc_name, volume_label, 15); chrcat(disc_name, ' '); return; diff --git a/programs/demos/buddhabrot/trunk/buddhabrot.asm b/programs/demos/buddhabrot/trunk/buddhabrot.asm index 949e0bb4ed..744c39d448 100644 --- a/programs/demos/buddhabrot/trunk/buddhabrot.asm +++ b/programs/demos/buddhabrot/trunk/buddhabrot.asm @@ -2,89 +2,75 @@ ; Now it use static memory, it is mixed 32bit code and SSE instructions. include '../../../macros.inc' +include '../../../KOSfuncs.inc' use32 + org 0x0 - org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd IMG_END ; size of image + dd I_END ;0x100000 ; memory for app + dd I_END ;0xbffff ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon - db 'MENUET01' ; 8 byte id - dd 0x01 ; header version - dd START ; start of code - dd IMG_END ; size of image - dd I_END ;0x100000 ; memory for app - dd I_END ;0xbffff ; esp - dd 0x0 , 0x0 ; I_Param , I_Icon +; start of execution +START: -START: ; start of execution - - call draw_window - call Main - call draw_from_buffer + call draw_window + call draw_from_buffer + call Main + call draw_from_buffer + + mcall SF_SET_CAPTION,1,wintitle2 still: + mcall SF_WAIT_EVENT + + cmp eax,EV_REDRAW + je .redraw + cmp eax,EV_KEY + je .key + cmp eax,EV_BUTTON + je .button + jmp still + + .redraw: + call draw_window + call draw_from_buffer + jmp still -; call Main + .key: + mcall SF_GET_KEY + shr eax,16 ; get scancode in 'al' + cmp al,1 + je .exit + cmp al,66 + je set_as_wallpaper + jmp still + + .button: + mcall SF_GET_BUTTON + cmp ah,1 ; button id=1 ? + jne still + + .exit: + mcall SF_TERMINATE_PROCESS -; mov eax,7 -; mov ebx,screen -; mov ecx,IMG_SIZE*65536+IMG_SIZE -; mov edx,0*65536+0 -; int 0x40 - -; mov eax,23 ; wait here for event -; mov ebx,timeout -; int 0x40 - ; mov eax,11 ; check for event no wait - mov eax,10 ; wait for event - int 0x40 - - cmp eax,1 ; redraw request ? - je red - cmp eax,2 ; key in buffer ? - je key - cmp eax,3 ; button in buffer ? - je button - - jmp noclose - - red: ; redraw - call draw_window - call draw_from_buffer - jmp still - - key: ; key - mov eax,2 ; just read it and ignore - int 0x40 - shr eax,8 - cmp eax, 27 - jne still - mov eax, -1 - int 0x40 - - - button: ; button - mov eax,17 ; get id - int 0x40 - - cmp ah,1 ; button id=1 ? - jne noclose - - mov eax,-1 ; close this program - int 0x40 - noclose: - - jmp still - +set_as_wallpaper: + mcall SF_BACKGROUND_SET,SSF_MODE_BG,2 + mcall SF_BACKGROUND_SET,SSF_SIZE_BG,IMG_SIZE,IMG_SIZE + mcall SF_BACKGROUND_SET,SSF_IMAGE_BG,screen,0,3*IMG_SIZE*IMG_SIZE + mcall SF_BACKGROUND_SET,SSF_REDRAW_BG + jmp still draw_from_buffer: - - mov eax,7 - mov ebx,screen - mov ecx,IMG_SIZE*65536+IMG_SIZE - mov edx,0*65536+0 - int 0x40 + pusha + mcall SF_PUT_IMAGE,screen,IMG_SIZE*65536+IMG_SIZE,0 + popa ret ;------------------------------------------------------------------------------- @@ -323,23 +309,20 @@ r15dd equ ebp-72 ; ********************************************* draw_window: - mcall 12, 1 ; function 12:tell os about windowdraw + mcall SF_REDRAW, SSF_BEGIN_DRAW - mcall 48, 4 ;get skin width - lea ecx, [50*65536+IMG_SIZE+4+eax] ; [y start] *65536 + [y size] + [skin_height] - mcall 0,<50,IMG_SIZE+9>,,0x74000000,,labelt ;draw window - - mcall 12, 2 ; function 12:tell os about windowdraw - - ret + mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT + lea ecx, [50*65536+IMG_SIZE+4+eax] ; [y start] *65536 + [y size] + [skin_height] + mcall SF_CREATE_WINDOW,<50,IMG_SIZE+9>,,0x74000000,,wintitle1 + mcall SF_REDRAW, SSF_END_DRAW + ret ;------------------------------------------------------------------------------- align 1 -labelt: - db 'buddhabrot',0 -labelen: +wintitle1 db 'Buddhabrot - Calculating, please wait...',0 +wintitle2 db 'Buddhabrot - Press F8 to set image as wallpaper',0 align 4 g_xorwow_x dd 123456789 @@ -350,9 +333,10 @@ g_xorwow_v dd 5783321 g_xorwow_d dd 6615241 g_rand_scale dd 2.3283064e-10 ; 1.0 / 2^32 -IMG_SIZE=600 -SEQ_SIZE=50 -ITERATIONS=100 +IMG_SIZE = 600 +SEQ_SIZE = 50 +ITERATIONS = 100 + g_img_size dd 600.0 g_offsetx dd 0.5 g_offsety dd 0.0 @@ -367,10 +351,7 @@ g_255_0 dd 255.0 IMG_END: ;-------------------- -sequence: - rb SEQ_SIZE*8 -screen: - rb IMG_SIZE*IMG_SIZE*4 -memStack: - rd 1024 +sequence: rb SEQ_SIZE*8 +screen: rb IMG_SIZE*IMG_SIZE*4 +memStack: rd 1024 I_END: \ No newline at end of file