2006-01-03 10:43:31 +01:00
|
|
|
;******************************************************************************
|
2011-09-19 03:47:47 +02:00
|
|
|
; MAIN MENU
|
|
|
|
;******************************************************************************
|
2012-04-17 00:29:02 +02:00
|
|
|
; last update: 17/04/2012
|
|
|
|
; changed by: Marat Zakiyanov aka Mario79, aka Mario
|
|
|
|
; changes: Support for boot parameters.
|
|
|
|
;------------------------------------------------------------------------------
|
2012-03-21 21:50:44 +01:00
|
|
|
; last update: 22/03/2012
|
|
|
|
; changed by: Marat Zakiyanov aka Mario79, aka Mario
|
|
|
|
; changes: Global optimization! The program uses
|
|
|
|
; only 32 KB of memory instead of 128 kb is now.
|
|
|
|
;------------------------------------------------------------------------------
|
2011-09-19 03:47:47 +02:00
|
|
|
; last update: 19/09/2011
|
|
|
|
; changed by: Marat Zakiyanov aka Mario79, aka Mario
|
|
|
|
; changes: Checking for program exist to memory
|
|
|
|
; Added processing of keys: left and right arrow
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2006-01-03 10:43:31 +01:00
|
|
|
; MAIN MENU by lisovin@26.ru
|
|
|
|
; Some parts of code rewritten by Ivan Poddubny <ivan-yar@bk.ru>
|
|
|
|
;
|
2020-12-28 09:54:33 +01:00
|
|
|
; Compile with FASM for Kolibri
|
2006-01-03 10:43:31 +01:00
|
|
|
;******************************************************************************
|
2020-12-28 09:54:33 +01:00
|
|
|
BTN_HEIGHT = 26
|
2021-12-18 01:41:36 +01:00
|
|
|
BTN_WIDTH = 198 ; 178 for a small font
|
2021-06-05 17:18:11 +02:00
|
|
|
TXT_Y = (BTN_HEIGHT)/2-7
|
2020-12-28 09:54:33 +01:00
|
|
|
FONT_TYPE = 0x90000000
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2020-12-27 00:09:56 +01:00
|
|
|
PANEL_HEIGHT = 20
|
|
|
|
MENU_BOTTON_X_POS = 10
|
|
|
|
MENU_BOTTON_X_SIZE = 50
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2011-09-19 03:47:47 +02:00
|
|
|
use32
|
|
|
|
org 0x0
|
2012-03-21 21:50:44 +01:00
|
|
|
|
2020-12-27 00:09:56 +01:00
|
|
|
db 'MENUET01' ; 8 byte id
|
|
|
|
dd 0x01 ; header version
|
|
|
|
dd START ; start of code
|
|
|
|
dd IM_END ; size of image
|
|
|
|
dd mem_end ; memory for app
|
|
|
|
dd stack_area ; esp
|
|
|
|
dd bootparam ; boot parameters
|
|
|
|
dd 0x0 ; path
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2012-04-17 00:29:02 +02:00
|
|
|
include "..\..\..\macros.inc"
|
2020-04-14 13:29:55 +02:00
|
|
|
include "..\..\..\gui_patterns.inc"
|
2021-12-17 11:13:08 +01:00
|
|
|
; Formatted debug output:
|
|
|
|
include "..\..\..\debug-fdo.inc"
|
|
|
|
__DEBUG__ = 1 ; 0 - disable debug output / 1 - enable debug output
|
|
|
|
__DEBUG_LEVEL__ = DBG_ERR ; set the debug level
|
|
|
|
DBG_ALL = 0 ; all messages
|
|
|
|
DBG_INFO = 1 ; info and errors
|
|
|
|
DBG_ERR = 2 ; only errors
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2012-04-17 00:29:02 +02:00
|
|
|
conversion_ASCII_to_HEX:
|
|
|
|
xor ebx,ebx
|
|
|
|
cld
|
|
|
|
lodsd
|
|
|
|
mov ecx,4
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.loop:
|
|
|
|
cmp al,0x60 ; check for ABCDEF
|
|
|
|
ja @f
|
|
|
|
sub al,0x30 ; 0-9
|
|
|
|
jmp .store
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
|
|
|
sub al,0x57 ; A-F
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.store:
|
|
|
|
and al,0xf
|
|
|
|
rol ebx,4
|
|
|
|
add bl,al
|
|
|
|
ror eax,8
|
|
|
|
dec ecx
|
|
|
|
jnz .loop
|
|
|
|
|
|
|
|
ret
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2006-07-10 22:26:50 +02:00
|
|
|
START: ; start of execution
|
2012-03-21 21:50:44 +01:00
|
|
|
mcall 68,11
|
2020-12-27 00:09:56 +01:00
|
|
|
|
|
|
|
mcall 30, 1, default_dir
|
2012-04-17 00:29:02 +02:00
|
|
|
|
2021-12-17 11:13:08 +01:00
|
|
|
; DEBUGF DBG_INFO, "MENU START! sc.work = %x\n", [sc.work]
|
|
|
|
|
2012-04-17 00:29:02 +02:00
|
|
|
mov esi,bootparam
|
|
|
|
cmp [esi],byte 0
|
|
|
|
je .no_boot_parameters
|
|
|
|
; boot params - hex
|
|
|
|
; db '9999' ; +0 Menu button X
|
|
|
|
; db '9999' ; +4 Menu button X size
|
|
|
|
; db '9999' ; +8 Menu button Y
|
|
|
|
; db '9999' ; +12 Menu button Y size
|
|
|
|
; db '9999' ; +16 Panel height
|
|
|
|
; db '1000' ; +20 Panel attachment
|
|
|
|
|
|
|
|
; mov edx,bootparam
|
|
|
|
; call debug_outstr
|
|
|
|
; newline
|
|
|
|
|
|
|
|
call conversion_ASCII_to_HEX
|
|
|
|
mov [menu_button_x.start],ebx
|
|
|
|
|
|
|
|
; dps "menu_button_x.start: "
|
|
|
|
; dpd ebx
|
|
|
|
; newline
|
|
|
|
|
|
|
|
call conversion_ASCII_to_HEX
|
|
|
|
mov [menu_button_x.size],ebx
|
|
|
|
|
|
|
|
; dps "menu_button_x.size: "
|
|
|
|
; dpd ebx
|
|
|
|
; newline
|
|
|
|
|
|
|
|
call conversion_ASCII_to_HEX
|
|
|
|
mov [menu_button_y.start],ebx
|
|
|
|
|
|
|
|
; dps "menu_button_y.start: "
|
|
|
|
; dpd ebx
|
|
|
|
; newline
|
|
|
|
|
|
|
|
call conversion_ASCII_to_HEX
|
|
|
|
mov [menu_button_y.size],ebx
|
|
|
|
|
|
|
|
; dps "menu_button_y.size: "
|
|
|
|
; dpd ebx
|
|
|
|
; newline
|
|
|
|
|
|
|
|
call conversion_ASCII_to_HEX
|
|
|
|
mov [panel_height],ebx
|
|
|
|
|
|
|
|
; dps "panel_height: "
|
|
|
|
; dpd ebx
|
|
|
|
; newline
|
|
|
|
|
|
|
|
call conversion_ASCII_to_HEX
|
|
|
|
mov [panel_attachment],ebx
|
|
|
|
|
|
|
|
; dps "panel_attachment: "
|
|
|
|
; dpd ebx
|
|
|
|
; newline
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.no_boot_parameters:
|
2011-09-19 03:47:47 +02:00
|
|
|
call program_exist
|
|
|
|
mcall 14
|
|
|
|
mov [screen_size],eax
|
|
|
|
|
|
|
|
mcall 48,3,sc,sizeof.system_colors ; load system colors
|
2021-12-17 11:13:08 +01:00
|
|
|
|
|
|
|
; DEBUGF DBG_INFO, "sc.work = %x\n", [sc.work]
|
|
|
|
|
2021-12-30 15:10:46 +01:00
|
|
|
mov esi, [sc.work]
|
|
|
|
add esi, 0x1a1a1a
|
|
|
|
mov ebx, esi
|
|
|
|
and ebx, 0xFF000000
|
|
|
|
test ebx, ebx
|
|
|
|
jz @f
|
|
|
|
mov esi, 0x00FFFFFF
|
|
|
|
@@:
|
|
|
|
mov [active_color], esi
|
|
|
|
|
|
|
|
mov esi, [sc.work]
|
|
|
|
cmp esi, 0xdfdfdf
|
|
|
|
jb @f
|
|
|
|
sub esi, 0x1b1b1b
|
|
|
|
@@:
|
|
|
|
mov [work_color], esi
|
|
|
|
|
2021-12-17 11:13:08 +01:00
|
|
|
mov eax, 68
|
|
|
|
mov ebx, 22
|
|
|
|
mov ecx, icons_resname
|
|
|
|
mov esi, 0 ; SHM_READ
|
|
|
|
mcall
|
|
|
|
test eax, eax
|
|
|
|
jnz @f
|
|
|
|
mov [no_shared_resources], 1
|
|
|
|
DEBUGF DBG_ERR, "Failed to get ICONS18W from @RESHARE.\nTry rerun @RESHARE.\n"
|
|
|
|
jmp .no_res
|
|
|
|
@@:
|
|
|
|
mov [shared_icons_size], edx
|
2021-12-30 15:10:46 +01:00
|
|
|
; copy shared icons
|
2021-12-17 11:13:08 +01:00
|
|
|
mov esi, eax
|
|
|
|
mov ecx, edx
|
|
|
|
mcall 68, 12, edx
|
|
|
|
mov edi, eax
|
2021-12-30 15:10:46 +01:00
|
|
|
mov [shared_icons_ptr], eax
|
|
|
|
shr ecx, 2 ; /= 4; ecx = how many dwords in shared icons
|
|
|
|
cld
|
|
|
|
rep movsd
|
|
|
|
|
|
|
|
; copy shared icons to active icons
|
|
|
|
mov esi, [shared_icons_ptr]
|
|
|
|
mov ecx, edx
|
|
|
|
mcall 68, 12, edx
|
|
|
|
mov edi, eax
|
2021-12-17 11:13:08 +01:00
|
|
|
mov [shared_icons_active_ptr], eax
|
|
|
|
shr ecx, 2 ; /= 4; ecx = how many dwords in shared icons
|
|
|
|
cld
|
|
|
|
rep movsd
|
2021-12-30 15:10:46 +01:00
|
|
|
|
|
|
|
; fix colors:
|
2021-12-17 11:13:08 +01:00
|
|
|
mov esi, [shared_icons_active_ptr]
|
2021-12-30 15:10:46 +01:00
|
|
|
mov edi, [shared_icons_ptr]
|
2021-12-17 11:13:08 +01:00
|
|
|
xor ecx, ecx
|
|
|
|
.for1:
|
|
|
|
cmp ecx, [shared_icons_size]
|
|
|
|
jae .end_for1
|
|
|
|
|
|
|
|
mov eax, esi
|
|
|
|
add eax, ecx
|
|
|
|
mov edx, [eax]
|
|
|
|
cmp edx, [sc.work]
|
|
|
|
; DEBUGF DBG_INFO, "eax = %x, sc.work = %x\n", eax, [sc.work]
|
|
|
|
jne @f
|
2021-12-30 15:10:46 +01:00
|
|
|
mov ebx, [active_color]
|
2021-12-17 11:13:08 +01:00
|
|
|
mov [eax], ebx
|
|
|
|
@@:
|
2021-12-30 15:10:46 +01:00
|
|
|
|
|
|
|
mov eax, edi
|
|
|
|
add eax, ecx
|
|
|
|
mov edx, [eax]
|
|
|
|
cmp edx, [sc.work]
|
|
|
|
jne @f
|
|
|
|
mov ebx, [work_color]
|
|
|
|
mov [eax], ebx
|
|
|
|
@@:
|
|
|
|
|
2021-12-17 11:13:08 +01:00
|
|
|
add ecx, 4
|
|
|
|
jmp .for1
|
|
|
|
.end_for1:
|
|
|
|
.no_res:
|
2012-03-21 21:50:44 +01:00
|
|
|
|
|
|
|
; get size of file MENU.DAT
|
|
|
|
mcall 70,fileinfo
|
|
|
|
test eax,eax
|
2011-09-19 03:47:47 +02:00
|
|
|
jnz close
|
2012-03-21 21:50:44 +01:00
|
|
|
; get memory for MENU.DAT
|
|
|
|
mov ecx,[procinfo+32]
|
|
|
|
mov [fileinfo.size],ecx
|
|
|
|
mcall 68,12
|
|
|
|
mov [fileinfo.return],eax
|
|
|
|
mcall 68
|
|
|
|
mov [menu_data],eax
|
|
|
|
; load MENU.DAT
|
|
|
|
mov [fileinfo],dword 0
|
|
|
|
mcall 70,fileinfo
|
|
|
|
test eax,eax
|
|
|
|
jnz close
|
|
|
|
|
2011-09-19 03:47:47 +02:00
|
|
|
test ebx,ebx ; length = 0 ?
|
|
|
|
jz close
|
|
|
|
mov ecx,ebx
|
2012-03-21 21:50:44 +01:00
|
|
|
mov edi,[fileinfo.return] ;mem_end
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2021-12-17 11:13:08 +01:00
|
|
|
newsearch: ; search for next submenu in MENU.DAT
|
2011-09-19 03:47:47 +02:00
|
|
|
mov al,'#'
|
|
|
|
cld
|
|
|
|
repne scasb
|
|
|
|
test ecx,ecx ; if not found
|
|
|
|
jz close
|
2021-12-17 11:13:08 +01:00
|
|
|
call get_number ; get submenu number from char at edi position to ebx
|
2011-09-19 03:47:47 +02:00
|
|
|
test ebx,ebx
|
|
|
|
jnz .number
|
|
|
|
cmp al,'#'
|
|
|
|
je search_end
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
.number:
|
2021-12-17 11:13:08 +01:00
|
|
|
shl ebx,4 ; *= 16 . 16 is size of process table (see virtual at 0 ... stuff in the end of file)
|
2012-03-21 21:50:44 +01:00
|
|
|
add ebx,[menu_data] ; pointer to process table
|
2021-12-17 11:13:08 +01:00
|
|
|
mov [ebx],edi ; process_table->pointer = edi
|
2011-09-19 03:47:47 +02:00
|
|
|
inc [processes]
|
|
|
|
jmp newsearch
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
search_end:
|
|
|
|
mov [end_pointer],edi
|
|
|
|
mov ebx,[processes]
|
|
|
|
dec ebx
|
|
|
|
shl ebx,4
|
2012-03-21 21:50:44 +01:00
|
|
|
add ebx,[menu_data]
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
newprocess:
|
|
|
|
xor edx,edx
|
|
|
|
mov ecx,edi
|
|
|
|
sub ecx,[ebx]
|
|
|
|
mov al,10
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
newsearch1:
|
|
|
|
std
|
|
|
|
repne scasb
|
|
|
|
test ecx,ecx
|
|
|
|
je endprocess
|
|
|
|
cmp [edi],byte 13
|
|
|
|
jne newsearch1
|
|
|
|
inc edx
|
|
|
|
jmp newsearch1
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
endprocess:
|
|
|
|
mov esi,ebx
|
|
|
|
add esi,4
|
|
|
|
dec edx
|
|
|
|
mov [esi],dl
|
2012-03-21 21:50:44 +01:00
|
|
|
cmp ebx,[menu_data]
|
2011-09-19 03:47:47 +02:00
|
|
|
jbe search_end1
|
|
|
|
sub ebx,16
|
|
|
|
jmp newprocess
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
search_end1:
|
|
|
|
mcall 14
|
2012-04-17 00:29:02 +02:00
|
|
|
cmp [panel_attachment],byte 1
|
|
|
|
je @f
|
|
|
|
xor ax,ax
|
|
|
|
jmp .store
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
|
|
|
sub ax,[panel_height] ;20
|
|
|
|
.store:
|
2012-03-21 21:50:44 +01:00
|
|
|
mov ebx,[menu_data]
|
|
|
|
mov [ebx + y_end],ax
|
|
|
|
mov [ebx + x_start],5
|
|
|
|
mov al,[ebx + rows]
|
|
|
|
mov [ebx + cur_sel],al ; clear selection
|
|
|
|
mov [ebx + prev_sel],al
|
2011-09-19 03:47:47 +02:00
|
|
|
mov [buffer],0
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2021-12-17 11:13:08 +01:00
|
|
|
thread: ; starts new thread. called when opening each menu
|
|
|
|
DEBUGF DBG_INFO, "start new THREAD\n"
|
2012-03-21 21:50:44 +01:00
|
|
|
mov ebp,esp
|
|
|
|
sub ebp,0x1000
|
|
|
|
cmp ebp,0x2000 ; if this is first started thread
|
|
|
|
ja @f
|
|
|
|
xor ebp,ebp ; not free area
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-09-19 03:47:47 +02:00
|
|
|
mov eax,[buffer] ; identifier
|
|
|
|
shl eax,4
|
2012-03-21 21:50:44 +01:00
|
|
|
add eax,[menu_data]
|
2011-09-19 03:47:47 +02:00
|
|
|
mov edi,eax
|
|
|
|
mcall 40,100111b ; mouse + button + key + redraw
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
red:
|
|
|
|
call draw_window ; redraw
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2021-12-17 11:13:08 +01:00
|
|
|
still: ; event loop
|
2012-03-21 21:50:44 +01:00
|
|
|
call free_area_if_set_mutex
|
|
|
|
|
2011-09-19 03:47:47 +02:00
|
|
|
mcall 23,5 ; wait here for event
|
|
|
|
test [close_now],1 ; is close flag set?
|
|
|
|
jnz close
|
|
|
|
|
|
|
|
cmp eax,1 ; redraw request ?
|
|
|
|
je red
|
|
|
|
cmp eax,2 ; key pressed ?
|
|
|
|
je key
|
|
|
|
cmp eax,3 ; button in buffer ?
|
|
|
|
je button
|
|
|
|
cmp eax,6 ; mouse event ?
|
|
|
|
je mouse
|
2012-03-21 21:50:44 +01:00
|
|
|
cmp edi,[menu_data]
|
2011-09-19 03:47:47 +02:00
|
|
|
je still ; if main process-ignored
|
|
|
|
|
|
|
|
movzx ebx,[edi + parent] ; parent id
|
|
|
|
shl ebx,4
|
2012-03-21 21:50:44 +01:00
|
|
|
add ebx,[menu_data] ; ebx = base of parent info
|
2011-09-19 03:47:47 +02:00
|
|
|
call backconvert ; get my id in al
|
|
|
|
cmp al,[ebx + child] ; if I'm not child of my parent, I shall die :)
|
|
|
|
jne close
|
|
|
|
|
|
|
|
jmp still
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
key:
|
2012-03-21 21:50:44 +01:00
|
|
|
mcall 2
|
2011-09-19 03:47:47 +02:00
|
|
|
mov [last_key],ah
|
|
|
|
mov al,[edi + rows] ; number of buttons
|
|
|
|
cmp ah,178 ; KEY_UP
|
|
|
|
jne .noup
|
|
|
|
|
|
|
|
mov ah,[edi+cur_sel]
|
|
|
|
mov [edi+prev_sel],ah
|
|
|
|
dec byte [edi+cur_sel]
|
|
|
|
jnz redrawbut
|
|
|
|
mov [edi+cur_sel],al
|
|
|
|
jmp redrawbut
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
.noup:
|
|
|
|
cmp ah,177 ; KEY_DOWN
|
|
|
|
jne .nodn
|
|
|
|
|
|
|
|
mov ah,[edi + cur_sel]
|
|
|
|
mov [edi + prev_sel],ah
|
|
|
|
inc [edi + cur_sel]
|
|
|
|
cmp [edi + cur_sel],al
|
|
|
|
jna redrawbut
|
|
|
|
mov [edi + cur_sel],1
|
|
|
|
jmp redrawbut
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
.nodn:
|
|
|
|
cmp ah,179 ; KEY_LEFT
|
|
|
|
je @f
|
|
|
|
cmp ah,13 ; ENTER
|
|
|
|
jne .noenter
|
|
|
|
@@:
|
|
|
|
mov ah,[edi + cur_sel]
|
|
|
|
jmp button1
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
.noenter:
|
|
|
|
cmp ah,176 ; KEY_RIGHT
|
|
|
|
je @f
|
|
|
|
cmp ah,27 ; ESC
|
|
|
|
jne still
|
|
|
|
jmp close
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
@@:
|
|
|
|
call get_process_ID
|
|
|
|
cmp [main_process_ID],ecx
|
|
|
|
jne close
|
|
|
|
jmp still
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
button: ; BUTTON HANDLER
|
|
|
|
mcall 17 ; get id
|
|
|
|
; dunkaist[
|
2015-02-23 17:01:43 +01:00
|
|
|
test eax,0xfffffe00 ; is it system close button? (close signal from @taskbar)
|
2011-09-19 03:47:47 +02:00
|
|
|
setz byte[close_now] ; set (or not set) close_recursive flag
|
|
|
|
jz close ; if so,close all menus
|
|
|
|
; dunkaist]
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
button1:
|
|
|
|
mov esi,edi
|
|
|
|
push edi
|
|
|
|
mov edi,[edi + pointer]
|
2006-01-03 10:43:31 +01:00
|
|
|
; print "hello"
|
2011-09-19 03:47:47 +02:00
|
|
|
mov al,[esi + cur_sel]
|
|
|
|
mov [esi + prev_sel],al
|
|
|
|
mov [esi + cur_sel],ah
|
|
|
|
|
|
|
|
pushad
|
|
|
|
mov edi,esi
|
|
|
|
; dph eax
|
|
|
|
call draw_only_needed_buttons
|
|
|
|
popad
|
2021-12-17 11:13:08 +01:00
|
|
|
; look (.next_string) for the next line in MENU.DAT <ah> times; <ah> = button_id
|
2011-09-19 03:47:47 +02:00
|
|
|
push eax
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
.next_string:
|
2021-12-17 11:13:08 +01:00
|
|
|
; DEBUGF DBG_INFO, ".next_string called\n"
|
2011-09-19 03:47:47 +02:00
|
|
|
call searchstartstring
|
|
|
|
dec ah
|
|
|
|
jnz .next_string
|
|
|
|
pop eax
|
|
|
|
|
|
|
|
mov ecx,40
|
2020-12-27 00:09:56 +01:00
|
|
|
mov al,'|'
|
2011-09-19 03:47:47 +02:00
|
|
|
cld
|
|
|
|
repne scasb
|
2020-12-27 00:09:56 +01:00
|
|
|
test ecx,ecx ; if '|' not found
|
2011-09-19 03:47:47 +02:00
|
|
|
je searchexit
|
|
|
|
|
|
|
|
cmp [edi],byte '@' ; check for submenu
|
|
|
|
je runthread
|
|
|
|
|
|
|
|
cmp [last_key],179
|
|
|
|
je searchexit
|
|
|
|
|
2020-12-27 00:09:56 +01:00
|
|
|
;dec edi
|
2011-09-19 03:47:47 +02:00
|
|
|
push edi ; pointer to start of filename
|
|
|
|
call searchstartstring ; search for next string
|
|
|
|
sub edi,2 ; to last byte of string
|
|
|
|
|
|
|
|
mov ecx,edi
|
|
|
|
pop esi
|
|
|
|
sub ecx,esi
|
|
|
|
inc ecx ; length of filename
|
|
|
|
mov edi, fileinfo_start.name
|
|
|
|
rep movsb ; copy string
|
|
|
|
mov [edi],byte 0 ; store terminator
|
|
|
|
mcall 70,fileinfo_start ; start program
|
|
|
|
pop edi
|
2021-12-18 16:21:21 +01:00
|
|
|
or [close_now],1 ; set close flag
|
2011-09-19 03:47:47 +02:00
|
|
|
mov [mousemask],0
|
2021-12-18 16:21:21 +01:00
|
|
|
; if program run failed then start /sys/@open with param
|
|
|
|
test eax,eax
|
|
|
|
jns close
|
|
|
|
mov eax, fileinfo_start.name
|
|
|
|
mov [file_open.params], eax
|
|
|
|
mcall 70,file_open
|
2011-09-19 03:47:47 +02:00
|
|
|
jmp close
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
searchexit:
|
|
|
|
pop edi
|
|
|
|
jmp still
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
runthread:
|
|
|
|
inc edi
|
|
|
|
|
|
|
|
push eax
|
|
|
|
call get_number ; get number of this process
|
|
|
|
pop eax
|
|
|
|
|
|
|
|
test ebx,ebx ; returned zero - main menu or not number
|
|
|
|
jz searchexit
|
|
|
|
|
|
|
|
mov al,bl
|
|
|
|
|
|
|
|
mov ebx,[processes]
|
|
|
|
dec bl
|
|
|
|
cmp al,bl
|
|
|
|
ja searchexit ; such process doesnt exist
|
|
|
|
cmp al,[esi + child]
|
|
|
|
je searchexit ; such process already exists
|
|
|
|
|
|
|
|
mov [esi + child],al ; this is my child
|
|
|
|
mov cx,[esi + x_start]
|
2020-12-27 00:09:56 +01:00
|
|
|
add cx,BTN_WIDTH+1 ; new x_start in cx
|
2011-09-19 03:47:47 +02:00
|
|
|
movzx edx,al
|
|
|
|
shl edx,4
|
2012-03-21 21:50:44 +01:00
|
|
|
add edx,[menu_data] ; edx points to child's base address
|
2011-09-19 03:47:47 +02:00
|
|
|
mov [edx + x_start],cx ; xstart for new thread
|
|
|
|
mov cx,[esi + y_end] ; y_end in cx
|
|
|
|
mov bl,[esi + rows] ; number of buttons in bl
|
|
|
|
sub bl,ah ; number of btn from bottom
|
2020-04-30 11:28:58 +02:00
|
|
|
|
|
|
|
; Leency: store vars for case when attachement=top
|
|
|
|
pusha
|
|
|
|
mov [prior_thread_selected_y_end], bl
|
|
|
|
mcall 9,procinfo,-1
|
|
|
|
m2m [prior_thread_y], dword[procinfo+38]
|
|
|
|
m2m [prior_thread_h], dword[procinfo+46]
|
|
|
|
popa
|
|
|
|
|
2011-09-19 03:47:47 +02:00
|
|
|
movzx eax,al
|
|
|
|
mov [buffer],eax ; thread id in buffer
|
|
|
|
movzx ebx,bl
|
|
|
|
push edx
|
|
|
|
mov eax,BTN_HEIGHT
|
|
|
|
mul ebx
|
|
|
|
sub cx,ax ; new y_end for new thread
|
|
|
|
pop edx
|
|
|
|
mov [edx + y_end],cx ; store y_end
|
|
|
|
mov edi,esi
|
|
|
|
call backconvert ; get number of this process (al)
|
|
|
|
mov [edx + parent],al ; store number of parent process
|
2020-04-30 11:28:58 +02:00
|
|
|
|
2011-09-19 03:47:47 +02:00
|
|
|
mov al,[edx + rows]
|
|
|
|
mov [edx + cur_sel],al ; clear current selected element
|
|
|
|
mov [edx + prev_sel],al ; clear previous selected element
|
|
|
|
mov [edx + child],0
|
|
|
|
|
2012-03-21 21:50:44 +01:00
|
|
|
mcall 68,12,0x1000 ; stack of each thread is allocated 4 KB
|
|
|
|
add eax,0x1000 ; set the stack pointer to the desired position
|
|
|
|
mov edx,eax
|
|
|
|
mcall 51,1,thread ; Go ahead!
|
2011-09-19 03:47:47 +02:00
|
|
|
jmp searchexit
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
mouse: ; MOUSE EVENT HANDLER
|
|
|
|
mcall 37,0
|
|
|
|
mov [screen_mouse_position],eax ; eax = [ Y | X ] relative to screen
|
|
|
|
|
|
|
|
mcall 37,2
|
|
|
|
test eax,eax ; check buttons state
|
|
|
|
jnz click
|
|
|
|
mcall 37,1
|
|
|
|
ror eax,16 ; eax = [ Y | X ] relative to window
|
2020-04-14 13:29:55 +02:00
|
|
|
cmp ax,BTN_WIDTH ; pointer in window?
|
2011-09-19 03:47:47 +02:00
|
|
|
ja noinwindow
|
|
|
|
; *** in window ***
|
|
|
|
shr eax,16 ; eax = [ 0 | Y ]
|
|
|
|
xor edx,edx
|
|
|
|
mov ebx,BTN_HEIGHT
|
|
|
|
div ebx
|
|
|
|
inc eax ; number of "button" in eax
|
|
|
|
movzx ebx,[edi + rows] ; total strings in ebx
|
|
|
|
cmp eax,ebx
|
|
|
|
ja noinwindow
|
|
|
|
cmp [edi + cur_sel],al
|
|
|
|
je noredrawbut
|
|
|
|
mov bl,[edi + cur_sel]
|
|
|
|
;;;;;;
|
|
|
|
cmp [edi + child],0
|
|
|
|
jne noredrawbut
|
|
|
|
;;;;;;
|
|
|
|
mov [edi + cur_sel],al
|
|
|
|
mov [edi + prev_sel],bl
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
redrawbut:
|
|
|
|
call draw_only_needed_buttons
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
noredrawbut:
|
|
|
|
call backconvert
|
|
|
|
bts [mousemask],eax
|
|
|
|
jmp still
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
noinwindow:
|
|
|
|
call backconvert
|
|
|
|
btr [mousemask],eax
|
|
|
|
jmp still
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
click:
|
|
|
|
cmp [mousemask],0 ; not in a window (i.e. menu)
|
|
|
|
jne still
|
|
|
|
; checking for pressing 'MENU' on the taskbar
|
|
|
|
mov eax,[screen_mouse_position]
|
2012-04-17 00:29:02 +02:00
|
|
|
|
|
|
|
cmp [panel_attachment],byte 1
|
|
|
|
je @f
|
|
|
|
|
|
|
|
xor ebx,ebx
|
|
|
|
jmp .check_y
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-09-19 03:47:47 +02:00
|
|
|
mov ebx,[screen_size]
|
2012-04-17 00:29:02 +02:00
|
|
|
sub bx,word [panel_height] ;PANEL_HEIGHT
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.check_y:
|
|
|
|
add bx,word [menu_button_y.start]
|
2011-09-19 03:47:47 +02:00
|
|
|
cmp bx,ax
|
|
|
|
ja close
|
2012-04-17 00:29:02 +02:00
|
|
|
|
|
|
|
add bx,word [menu_button_y.size]
|
|
|
|
cmp bx,ax
|
|
|
|
jb close
|
|
|
|
|
2011-09-19 03:47:47 +02:00
|
|
|
shr eax,16
|
2012-04-17 00:29:02 +02:00
|
|
|
|
|
|
|
mov ebx,[menu_button_x.start]
|
|
|
|
cmp bx,ax ; MENU_BOTTON_X_SIZE
|
2011-09-19 03:47:47 +02:00
|
|
|
ja close
|
2012-04-17 00:29:02 +02:00
|
|
|
|
|
|
|
add bx,[menu_button_x.size]
|
|
|
|
cmp bx,ax ; MENU_BOTTON_X_POS
|
2011-09-19 03:47:47 +02:00
|
|
|
ja still
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
close:
|
|
|
|
|
|
|
|
movzx ebx,[edi+parent] ; parent id
|
|
|
|
shl ebx,4
|
2012-03-21 21:50:44 +01:00
|
|
|
add ebx,[menu_data] ; ebx = base of parent info
|
2011-09-19 03:47:47 +02:00
|
|
|
call backconvert
|
|
|
|
cmp [ebx + child],al ; if i am the child of my parent...
|
|
|
|
jnz @f
|
|
|
|
mov [ebx + child],-1 ; ...my parent now has no children
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2008-02-10 21:42:18 +01:00
|
|
|
@@:
|
2011-09-19 03:47:47 +02:00
|
|
|
or eax,-1 ; close this thread
|
|
|
|
mov [edi + child],al ; my child is not mine
|
2012-03-21 21:50:44 +01:00
|
|
|
|
|
|
|
call free_area_if_set_mutex
|
|
|
|
call set_mutex_for_free_area
|
|
|
|
|
2011-09-19 03:47:47 +02:00
|
|
|
mcall
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
backconvert: ; convert from pointer to process id
|
|
|
|
mov eax,edi
|
2012-03-21 21:50:44 +01:00
|
|
|
sub eax,[menu_data]
|
2011-09-19 03:47:47 +02:00
|
|
|
shr eax,4
|
|
|
|
ret
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
|
|
|
set_mutex_for_free_area:
|
|
|
|
; set mutex for free thread stack area
|
|
|
|
push eax ebx
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.wait_lock:
|
|
|
|
cmp [free_my_area_lock], 0
|
|
|
|
je .get_lock
|
|
|
|
mcall 68,1
|
|
|
|
jmp .wait_lock
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.get_lock:
|
|
|
|
mov eax, 1
|
|
|
|
xchg eax, [free_my_area_lock]
|
|
|
|
test eax, eax
|
|
|
|
jnz .wait_lock
|
|
|
|
mov [free_my_area],ebp
|
|
|
|
pop ebx eax
|
|
|
|
ret
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
|
|
|
free_area_if_set_mutex:
|
|
|
|
cmp [free_my_area_lock],0
|
|
|
|
je .end
|
|
|
|
|
|
|
|
push eax ebx ecx
|
|
|
|
mov ecx,[free_my_area]
|
|
|
|
|
|
|
|
test ecx,ecx
|
|
|
|
jz @f
|
|
|
|
mcall 68,13
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
|
|
|
xor eax,eax
|
|
|
|
mov [free_my_area_lock],eax
|
|
|
|
pop ecx ebx eax
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.end:
|
|
|
|
ret
|
|
|
|
;------------------------------------------------------------------------------
|
2006-01-03 10:43:31 +01:00
|
|
|
;==================================
|
|
|
|
; get_number
|
|
|
|
; load number from [edi] to ebx
|
|
|
|
;==================================
|
2012-03-21 21:50:44 +01:00
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
get_number:
|
|
|
|
push edi
|
|
|
|
xor eax,eax
|
|
|
|
xor ebx,ebx
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
.get_next_char:
|
|
|
|
mov al,[edi]
|
|
|
|
inc edi
|
|
|
|
cmp al, '0'
|
|
|
|
jb .finish
|
|
|
|
cmp al, '9'
|
|
|
|
ja .finish
|
|
|
|
sub al, '0'
|
|
|
|
imul ebx,10
|
|
|
|
add ebx,eax
|
|
|
|
jmp .get_next_char
|
|
|
|
;-------------------------------------
|
2012-03-21 21:50:44 +01:00
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
.finish:
|
|
|
|
pop edi
|
|
|
|
ret
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
get_process_ID:
|
|
|
|
mcall 9,procinfo,-1
|
|
|
|
mov edx,eax
|
|
|
|
mov ecx,[ebx+30] ; PID
|
|
|
|
ret
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
program_exist:
|
|
|
|
call get_process_ID
|
|
|
|
mov [main_process_ID],ecx
|
|
|
|
mcall 18,21
|
|
|
|
mov [active_process],eax ; WINDOW SLOT
|
|
|
|
mov ecx,edx
|
|
|
|
xor edx,edx
|
|
|
|
;-----------------------------------------
|
2012-03-21 21:50:44 +01:00
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
.loop:
|
|
|
|
push ecx
|
|
|
|
mcall 9,procinfo
|
|
|
|
mov eax,[menu_mame]
|
|
|
|
cmp [ebx+10],eax
|
|
|
|
jne @f
|
2020-12-27 00:09:56 +01:00
|
|
|
; temporary to fit into 3 IMG sectors
|
|
|
|
;mov ax,[menu_mame+4]
|
|
|
|
;cmp [ebx+14],ax
|
|
|
|
;jne @f
|
2011-09-19 03:47:47 +02:00
|
|
|
cmp ecx,[active_process]
|
|
|
|
je @f
|
|
|
|
; dph ecx
|
|
|
|
mcall 18,2
|
|
|
|
mov edx,1
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
@@:
|
|
|
|
pop ecx
|
|
|
|
loop .loop
|
2012-03-21 21:50:44 +01:00
|
|
|
|
2011-09-19 03:47:47 +02:00
|
|
|
test edx,edx
|
|
|
|
jz @f
|
|
|
|
mcall -1
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
@@:
|
|
|
|
ret
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2006-01-03 10:43:31 +01:00
|
|
|
; *********************************************
|
|
|
|
; ******* WINDOW DEFINITIONS AND DRAW ********
|
|
|
|
; *********************************************
|
2012-03-21 21:50:44 +01:00
|
|
|
align 4
|
2006-01-03 10:43:31 +01:00
|
|
|
draw_window:
|
2021-12-17 11:13:08 +01:00
|
|
|
mcall 48,5 ; get working area
|
2012-04-17 00:29:02 +02:00
|
|
|
mov [x_working_area],eax
|
|
|
|
mov [y_working_area],ebx
|
|
|
|
|
2011-09-19 03:47:47 +02:00
|
|
|
mcall 12,1 ; 1,start of draw
|
|
|
|
movzx ebx,[edi + rows]
|
|
|
|
imul eax,ebx,BTN_HEIGHT ; eax = height of window
|
|
|
|
movzx ecx,[edi + y_end]
|
2012-04-17 00:29:02 +02:00
|
|
|
cmp [panel_attachment],byte 1
|
|
|
|
je @f
|
2020-04-30 11:28:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
;cmp ebp,0x000 ; if this is first started thread
|
|
|
|
;je .1 ; then show it at the very top
|
|
|
|
|
|
|
|
push ebx eax
|
|
|
|
; if attachement=top
|
|
|
|
; then NEW_WIN_Y = PRIOR_WIN_Y + PRIOR_WIN_H - ITEM_H + 1 - SEL_ITEM_Y
|
|
|
|
|
|
|
|
mov ecx, [prior_thread_y]
|
|
|
|
add ecx, [prior_thread_h]
|
|
|
|
sub ecx, BTN_HEIGHT
|
|
|
|
inc ecx
|
|
|
|
|
|
|
|
xor eax, eax
|
|
|
|
mov al, [prior_thread_selected_y_end]
|
|
|
|
mov ebx, BTN_HEIGHT
|
|
|
|
mul ebx
|
|
|
|
|
|
|
|
sub ecx, eax
|
|
|
|
|
|
|
|
mov [edi + cur_sel],1 ;if attachement=top then set item=1 selected
|
|
|
|
|
|
|
|
pop eax ebx
|
|
|
|
|
2012-04-17 00:29:02 +02:00
|
|
|
jmp .1
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2011-09-19 03:47:47 +02:00
|
|
|
sub ecx,eax ; ecx = Y_START
|
2012-04-17 00:29:02 +02:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.1:
|
2011-09-19 03:47:47 +02:00
|
|
|
shl ecx,16
|
|
|
|
add ecx,eax ; ecx = [ Y_START | Y_SIZE ]
|
2020-04-14 13:29:55 +02:00
|
|
|
dec ecx
|
2018-11-10 14:07:49 +01:00
|
|
|
|
2011-09-19 03:47:47 +02:00
|
|
|
movzx ebx,[edi + x_start]
|
|
|
|
shl ebx,16
|
2020-04-14 13:29:55 +02:00
|
|
|
mov bx,BTN_WIDTH ; ebx = [ X_START | X_SIZE ]
|
2011-09-19 03:47:47 +02:00
|
|
|
mov edx,0x01000000 ; color of work area RRGGBB,8->color gl
|
|
|
|
mov esi,edx ; unmovable window
|
2012-04-17 00:29:02 +02:00
|
|
|
|
|
|
|
mov eax,[y_working_area]
|
|
|
|
shr eax,16
|
|
|
|
ror ecx,16
|
|
|
|
test cx,0x8000
|
|
|
|
jz @f
|
|
|
|
mov cx,ax
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
|
|
|
cmp cx,ax
|
|
|
|
ja @f
|
|
|
|
mov cx,ax
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
|
|
|
rol ecx,16
|
2011-09-19 03:47:47 +02:00
|
|
|
xor eax,eax ; function 0 : define and draw window
|
|
|
|
mcall
|
|
|
|
|
2012-04-17 00:29:02 +02:00
|
|
|
; dps "[ Y_START | Y_SIZE ] : "
|
|
|
|
; dph ecx
|
|
|
|
; newline
|
|
|
|
|
|
|
|
; dps "[ X_START | X_SIZE ] : "
|
|
|
|
; dph ebx
|
|
|
|
; newline
|
|
|
|
|
2011-09-19 03:47:47 +02:00
|
|
|
call draw_all_buttons
|
|
|
|
mcall 12,2
|
|
|
|
ret
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
draw_all_buttons:
|
|
|
|
xor edx,edx
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
.new_button:
|
|
|
|
call draw_one_button
|
|
|
|
inc edx
|
|
|
|
cmp dl,[edi + rows]
|
|
|
|
jb .new_button
|
|
|
|
ret
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
draw_only_needed_buttons:
|
|
|
|
xor edx,edx
|
|
|
|
mov dl,[edi + cur_sel]
|
|
|
|
dec dl
|
|
|
|
call draw_one_button
|
|
|
|
mov dl,[edi + prev_sel]
|
|
|
|
dec dl
|
|
|
|
call draw_one_button
|
|
|
|
ret
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
draw_one_button:
|
|
|
|
; receives number of button in dl
|
|
|
|
push edx
|
|
|
|
mov eax,8
|
2020-04-14 13:29:55 +02:00
|
|
|
mov ebx,BTN_WIDTH
|
2011-09-19 03:47:47 +02:00
|
|
|
movzx ecx,dl
|
|
|
|
imul ecx,BTN_HEIGHT
|
2020-04-14 13:29:55 +02:00
|
|
|
mov [draw_y], ecx
|
2011-09-19 03:47:47 +02:00
|
|
|
shl ecx,16
|
2016-02-19 22:07:11 +01:00
|
|
|
add ecx,BTN_HEIGHT
|
2011-09-19 03:47:47 +02:00
|
|
|
; edx = button identifier
|
2021-12-30 15:10:46 +01:00
|
|
|
mov esi, [work_color]
|
|
|
|
|
2021-12-17 11:13:08 +01:00
|
|
|
mov [is_icon_active], 0
|
2011-09-19 03:47:47 +02:00
|
|
|
inc dl
|
|
|
|
cmp [edi + cur_sel],dl
|
|
|
|
jne .nohighlight
|
2021-12-17 11:13:08 +01:00
|
|
|
mov [is_icon_active], 1
|
2021-12-30 15:10:46 +01:00
|
|
|
|
|
|
|
mov esi, [active_color]
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
.nohighlight:
|
2020-04-14 13:29:55 +02:00
|
|
|
or edx,BT_NOFRAME + BT_HIDE
|
2011-09-19 03:47:47 +02:00
|
|
|
; dunkaist[
|
|
|
|
add edx,0xd1ff00 ; This makes first menu buttons differ
|
|
|
|
; from system close button with 0x000001 id
|
|
|
|
; dunkaist]
|
|
|
|
mcall
|
2020-12-27 00:09:56 +01:00
|
|
|
push edx
|
2020-04-14 13:29:55 +02:00
|
|
|
|
|
|
|
mov edx, esi
|
2021-12-17 11:13:08 +01:00
|
|
|
mcall 13 ; draw rect
|
2020-04-14 13:29:55 +02:00
|
|
|
|
2020-12-27 00:09:56 +01:00
|
|
|
mcall , BTN_WIDTH,<[draw_y],1>,[sc.work_light]
|
|
|
|
add ecx, BTN_HEIGHT-1
|
|
|
|
mcall , 1
|
|
|
|
inc ecx
|
|
|
|
mcall , <BTN_WIDTH,1>, , [sc.work_dark]
|
|
|
|
add [draw_y], BTN_HEIGHT-1
|
|
|
|
mcall , BTN_WIDTH,<[draw_y],1>
|
2020-04-14 13:29:55 +02:00
|
|
|
|
2020-12-27 00:09:56 +01:00
|
|
|
pop edx
|
2011-09-19 03:47:47 +02:00
|
|
|
movzx edx,dl
|
|
|
|
dec dl
|
|
|
|
imul ebx,edx,BTN_HEIGHT
|
2021-12-17 11:13:08 +01:00
|
|
|
add ebx,((4 + 18) shl 16) + TXT_Y ; added + 18 (icon size)
|
2011-09-19 03:47:47 +02:00
|
|
|
movzx ecx,dl
|
|
|
|
inc ecx
|
|
|
|
mov edx,[edi + pointer]
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
.findline:
|
2021-12-17 11:13:08 +01:00
|
|
|
cmp byte [edx],13 ; if \r encountered => line found
|
2011-09-19 03:47:47 +02:00
|
|
|
je .linefound
|
2021-12-17 11:13:08 +01:00
|
|
|
inc edx ; go to next char
|
2011-09-19 03:47:47 +02:00
|
|
|
jmp .findline
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
.linefound:
|
2021-12-17 11:13:08 +01:00
|
|
|
inc edx ; go to next char after \r
|
|
|
|
cmp byte [edx],10 ; if it is not \n then again findline
|
2011-09-19 03:47:47 +02:00
|
|
|
jne .findline
|
2021-12-17 11:13:08 +01:00
|
|
|
dec ecx ; TODO what in ecx? button number?
|
2011-09-19 03:47:47 +02:00
|
|
|
jnz .findline
|
|
|
|
|
2020-12-28 09:54:33 +01:00
|
|
|
mov ecx, [sc.work_text]
|
|
|
|
add ecx, FONT_TYPE
|
2021-12-17 11:13:08 +01:00
|
|
|
|
|
|
|
push ecx esi edi ebp
|
|
|
|
push ebx ; preserve ebx, it stores coordinates
|
|
|
|
mov [tmp], edx
|
|
|
|
mov [has_icon], 1
|
|
|
|
xor ebx, ebx
|
|
|
|
@@: ; parse icon number
|
|
|
|
inc edx
|
|
|
|
mov al,[edx]
|
|
|
|
; DEBUGF DBG_INFO, "(%u)\n", al
|
|
|
|
cmp al, '0'
|
|
|
|
jb @f
|
|
|
|
cmp al, '9'
|
|
|
|
ja @f
|
|
|
|
sub al, '0'
|
|
|
|
imul ebx,10
|
|
|
|
add ebx,eax
|
|
|
|
jmp @b
|
|
|
|
@@:
|
|
|
|
; DEBUGF DBG_INFO, "icon_number = %x al = %u\n", ebx, al
|
|
|
|
mov [icon_number], ebx
|
|
|
|
cmp al, ' '
|
|
|
|
je @f
|
|
|
|
; if no space after number then consider that number is a part of caption
|
|
|
|
mov edx, [tmp] ; restore edx
|
|
|
|
mov [has_icon], 0 ; no icon
|
|
|
|
@@:
|
|
|
|
pop ebx
|
|
|
|
|
|
|
|
mcall 4,,,,21 ; draw menu element caption
|
|
|
|
|
|
|
|
cmp [no_shared_resources], 1
|
|
|
|
je @f
|
|
|
|
cmp [has_icon], 1
|
|
|
|
jne @f
|
|
|
|
; draw icon:
|
|
|
|
mov eax, ebx
|
|
|
|
shr eax, 16
|
|
|
|
sub eax, 18 ; 18 - icon width
|
|
|
|
movzx ebx, bx
|
|
|
|
|
|
|
|
sub ebx, 2
|
|
|
|
shl eax, 16
|
|
|
|
add eax, ebx
|
2021-12-18 01:41:36 +01:00
|
|
|
add eax, 1 shl 16
|
2021-12-17 11:13:08 +01:00
|
|
|
mov [tmp], eax
|
|
|
|
mov ebx, [icon_number]
|
|
|
|
imul ebx, 18*18*4
|
|
|
|
|
|
|
|
mov ecx, [shared_icons_ptr]
|
|
|
|
; DEBUGF DBG_INFO, "is_icon_active = %x\n", [is_icon_active]
|
|
|
|
cmp [is_icon_active], 1
|
|
|
|
jne .not_active_icon
|
|
|
|
mov ecx, [shared_icons_active_ptr]
|
|
|
|
.not_active_icon:
|
|
|
|
add ebx, ecx
|
2021-12-18 01:41:36 +01:00
|
|
|
mcall 65, ebx, <18,18>, [tmp], 32, 0, 0
|
2021-12-17 11:13:08 +01:00
|
|
|
|
|
|
|
@@:
|
2021-12-17 22:11:33 +01:00
|
|
|
pop ebp edi esi ecx
|
|
|
|
|
2011-09-19 03:47:47 +02:00
|
|
|
pop edx
|
|
|
|
ret
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
searchstartstring:
|
|
|
|
mov ecx,40
|
|
|
|
mov al,13
|
|
|
|
cld
|
|
|
|
repne scasb
|
|
|
|
cmp byte [edi],10
|
|
|
|
jne searchstartstring
|
|
|
|
ret
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2006-01-03 10:43:31 +01:00
|
|
|
;*** DATA AREA ****************************************************************
|
2020-12-27 00:09:56 +01:00
|
|
|
menu_mame: db '@MENU',0
|
|
|
|
default_dir: db '/sys',0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2012-03-21 21:50:44 +01:00
|
|
|
align 4
|
|
|
|
free_my_area_lock dd 0
|
|
|
|
free_my_area dd 0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2012-03-21 21:50:44 +01:00
|
|
|
processes dd 0
|
|
|
|
;--------------------------------------
|
2012-04-17 00:29:02 +02:00
|
|
|
menu_button_x:
|
|
|
|
.start: dd MENU_BOTTON_X_POS
|
|
|
|
.size: dd MENU_BOTTON_X_SIZE
|
|
|
|
;--------------------------------------
|
|
|
|
menu_button_y:
|
|
|
|
.start: dd 2
|
|
|
|
.size: dd 18
|
|
|
|
;--------------------------------------
|
|
|
|
panel_height: dd PANEL_HEIGHT
|
|
|
|
panel_attachment: dd 1
|
|
|
|
;--------------------------------------
|
2012-03-21 21:50:44 +01:00
|
|
|
align 4
|
2006-01-03 10:43:31 +01:00
|
|
|
fileinfo:
|
2012-03-21 21:50:44 +01:00
|
|
|
.subfunction dd 5 ; 5 - file info; 0 - file read
|
|
|
|
.start dd 0 ; start byte
|
|
|
|
.size_high dd 0 ; rezerved
|
|
|
|
.size dd 0 ; bytes to read
|
|
|
|
.return dd procinfo ; return data pointer
|
2006-01-03 10:43:31 +01:00
|
|
|
.name:
|
2020-12-27 00:09:56 +01:00
|
|
|
db 'SETTINGS/MENU.DAT',0 ; ASCIIZ dir & filename
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2006-01-03 10:43:31 +01:00
|
|
|
fileinfo_start:
|
2012-03-21 21:50:44 +01:00
|
|
|
.subfunction dd 7 ; 7=START APPLICATION
|
|
|
|
.flags dd 0 ; flags
|
|
|
|
.params dd 0x0 ; nop
|
|
|
|
.rezerved dd 0x0 ; nop
|
|
|
|
.rezerved_1 dd 0x0 ; nop
|
2006-01-03 10:43:31 +01:00
|
|
|
.name:
|
|
|
|
times 50 db ' '
|
2021-12-18 16:21:21 +01:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
file_open:
|
|
|
|
.subfunction dd 7 ; 7=START /SYS/@OPEN APP WITH PARAM
|
|
|
|
.flags dd 0 ; flags
|
|
|
|
.params dd 0x0 ; nop
|
|
|
|
.rezerved dd 0x0 ; nop
|
|
|
|
.rezerved_1 dd 0x0 ; nop
|
|
|
|
.name:
|
|
|
|
db '/SYS/@OPEN',0
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
IM_END:
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2011-09-19 03:47:47 +02:00
|
|
|
close_now dd ? ; close all processes immediately
|
|
|
|
end_pointer dd ?
|
|
|
|
buffer dd ?
|
|
|
|
mousemask dd ? ; mask for mouse pointer location
|
|
|
|
|
|
|
|
active_process dd ?
|
|
|
|
main_process_ID dd ?
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
2011-09-19 03:47:47 +02:00
|
|
|
screen_mouse_position:
|
|
|
|
.y dw ?
|
|
|
|
.x dw ?
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
2011-09-19 03:47:47 +02:00
|
|
|
screen_size:
|
|
|
|
.y dw ?
|
|
|
|
.x dw ?
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
2020-04-14 13:29:55 +02:00
|
|
|
draw_y dd ?
|
|
|
|
;--------------------------------------
|
2012-04-17 00:29:02 +02:00
|
|
|
x_working_area:
|
|
|
|
.right: dw ?
|
|
|
|
.left: dw ?
|
|
|
|
y_working_area:
|
|
|
|
.bottom: dw ?
|
|
|
|
.top: dw ?
|
|
|
|
;--------------------------------------
|
2006-01-03 10:43:31 +01:00
|
|
|
sc system_colors
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
|
|
|
last_key db ?
|
2020-04-30 11:28:58 +02:00
|
|
|
prior_thread_y dd ?
|
|
|
|
prior_thread_h dd ?
|
|
|
|
prior_thread_selected_y_end db ?
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
2020-12-27 00:09:56 +01:00
|
|
|
menu_data dd ?
|
2012-03-21 21:50:44 +01:00
|
|
|
;--------------------------------------
|
2020-12-27 00:09:56 +01:00
|
|
|
virtual at 0 ; PROCESSES TABLE (located at menu_data)
|
|
|
|
pointer dd ? ; +0 pointer in file
|
|
|
|
rows db ? ; +4 numer of strings
|
|
|
|
x_start dw ? ; +5 x start
|
|
|
|
y_end dw ? ; +7 y end
|
|
|
|
child db ? ; +9 id of child menu
|
|
|
|
parent db ? ; +10 id of parent menu
|
|
|
|
cur_sel db ? ; +11 current selection
|
|
|
|
prev_sel db ? ; +12 previous selection
|
|
|
|
rb 16-$+1 ; [16 bytes per element]
|
2006-01-03 10:43:31 +01:00
|
|
|
end virtual
|
2021-12-17 11:13:08 +01:00
|
|
|
|
|
|
|
include_debug_strings ; for debug-fdo
|
|
|
|
|
|
|
|
icons_resname db 'ICONS18W', 0
|
|
|
|
shared_icons_ptr dd ?
|
|
|
|
shared_icons_active_ptr dd ?
|
|
|
|
shared_icons_size dd ?
|
|
|
|
has_icon db ?
|
|
|
|
icon_number dd ?
|
|
|
|
is_icon_active dd ?
|
|
|
|
no_shared_resources dd 0
|
|
|
|
tmp dd ?
|
2021-12-30 15:10:46 +01:00
|
|
|
active_color dd ?
|
|
|
|
work_color dd ?
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2011-09-19 03:47:47 +02:00
|
|
|
align 4
|
2012-04-17 00:29:02 +02:00
|
|
|
bootparam:
|
2011-09-19 03:47:47 +02:00
|
|
|
procinfo:
|
|
|
|
rb 1024
|
2012-03-21 21:50:44 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
align 4
|
|
|
|
rb 0x1000
|
|
|
|
stack_area:
|
|
|
|
;------------------------------------------------------------------------------
|
2006-01-03 10:43:31 +01:00
|
|
|
mem_end:
|
2012-11-09 10:19:16 +01:00
|
|
|
;------------------------------------------------------------------------------
|