2014-04-06 21:31:46 +02:00
|
|
|
use32
|
|
|
|
org 0
|
|
|
|
db 'MENUET01'
|
2015-11-07 21:44:13 +01:00
|
|
|
dd 1, @ENTRY, @end, @memory, @stack, @params, 0
|
2014-04-06 21:31:46 +02:00
|
|
|
|
|
|
|
include "../../macros.inc"
|
|
|
|
include "../../proc32.inc"
|
|
|
|
include "../../dll.inc"
|
2015-11-06 17:45:38 +01:00
|
|
|
; include "../../debug.inc"
|
2015-11-07 21:44:13 +01:00
|
|
|
include "../../notify.inc"
|
|
|
|
include "../../string.inc"
|
2014-04-06 21:31:46 +02:00
|
|
|
|
|
|
|
LINEH equ 12
|
2015-11-07 21:44:13 +01:00
|
|
|
MARGIN equ 12
|
2014-04-10 15:37:25 +02:00
|
|
|
ICONS equ 11
|
2014-04-06 21:31:46 +02:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
;-------------------------------------------------------------------------------
|
2014-04-06 21:31:46 +02:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
@ENTRY:
|
|
|
|
;; INIT HEAP
|
|
|
|
mcall 68, 11
|
2015-10-30 17:50:43 +01:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
;; SAVE FOCUSED WINDOW
|
2015-10-30 17:50:43 +01:00
|
|
|
mcall 18, 7
|
|
|
|
mov ecx, eax
|
|
|
|
mcall 9, buffer
|
2015-11-07 21:44:13 +01:00
|
|
|
m2m dword [prev_pid], dword [buffer + 30]
|
2015-10-30 17:50:43 +01:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
;; MAKE IT ALWAYS ON TOP
|
2015-10-30 17:50:43 +01:00
|
|
|
mcall 18, 25, 2, -1, 1
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
;; SET STD PARAMS, IF IT NEEDS
|
2014-04-06 21:31:46 +02:00
|
|
|
mov eax, @params
|
2015-11-07 21:44:13 +01:00
|
|
|
cmpne byte [@params], 0, @f
|
2015-11-06 17:45:38 +01:00
|
|
|
mov eax, sz_std
|
2014-04-06 21:31:46 +02:00
|
|
|
@@:
|
2015-11-07 21:44:13 +01:00
|
|
|
mov [params.source], eax
|
2014-04-06 21:31:46 +02:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
;; PARSE ARGUMENTS
|
|
|
|
mov esi, 0
|
2015-11-06 17:45:38 +01:00
|
|
|
call parse_text
|
2015-11-07 21:44:13 +01:00
|
|
|
call parse_flags
|
|
|
|
movzx ebx, [params.icon]
|
2014-04-06 21:31:46 +02:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
;; GET PID
|
|
|
|
mcall 9, buffer, -1
|
|
|
|
mov eax, dword [buffer + 30]
|
2015-10-30 17:50:43 +01:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
;; CONVERT PID TO STR
|
|
|
|
mov ebx, 10
|
|
|
|
mov ecx, 0
|
2015-10-30 17:50:43 +01:00
|
|
|
@@:
|
2015-11-07 21:44:13 +01:00
|
|
|
mov edx, 0
|
|
|
|
div ebx
|
|
|
|
push edx
|
2015-10-30 17:50:43 +01:00
|
|
|
inc ecx
|
2015-11-07 21:44:13 +01:00
|
|
|
cmpne eax, 0, @b
|
2014-04-06 21:31:46 +02:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
mov ebx, ctrl.name
|
|
|
|
@@:
|
|
|
|
pop eax
|
|
|
|
add al, "0"
|
|
|
|
mov [ebx], al
|
|
|
|
inc ebx
|
|
|
|
loop @b
|
2014-04-06 21:31:46 +02:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
mov dword [ebx + 0], "-NOT"
|
|
|
|
mov dword [ebx + 4], "IFY"
|
2014-04-06 21:31:46 +02:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
;; LOAD LIBRARIES
|
2014-04-06 21:31:46 +02:00
|
|
|
stdcall dll.Load, @imports
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
;; GET SIZE OF ICONS
|
2014-04-06 21:31:46 +02:00
|
|
|
mcall 70, fi
|
|
|
|
mov edx, dword [buffer + 32]
|
2014-04-09 17:42:05 +02:00
|
|
|
shl edx, 2
|
2015-11-07 21:44:13 +01:00
|
|
|
|
|
|
|
;; ALLOCATE MEMORY FOR THIS
|
2014-04-06 21:31:46 +02:00
|
|
|
stdcall mem.Alloc, edx
|
|
|
|
mov [img_data.rgb_obj], eax
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
;; READ ICONS
|
2014-04-06 21:31:46 +02:00
|
|
|
mov dword [fi + 00], 0
|
|
|
|
mov dword [fi + 12], edx
|
2015-11-07 21:44:13 +01:00
|
|
|
mov dword [fi + 16], eax
|
2014-04-06 21:31:46 +02:00
|
|
|
mcall 70, fi
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
;; DECODE ICONS
|
2014-04-06 21:31:46 +02:00
|
|
|
stdcall dword [img.decode], dword [img_data.rgb_obj], ebx, 0
|
|
|
|
mov dword [img_data.obj], eax
|
|
|
|
stdcall dword [img.to_rgb], dword [img_data.obj], dword [img_data.rgb_obj]
|
|
|
|
stdcall dword [img.destroy], dword [img_data.obj]
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
;; CALC HEIGHT
|
2014-04-06 21:31:46 +02:00
|
|
|
mov eax, [text.lines]
|
|
|
|
add eax, 2
|
|
|
|
imul eax, LINEH
|
|
|
|
mov [window.height], eax
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
;; CALC OFFSET OF TEXT
|
|
|
|
mov dword [text.offset], MARGIN
|
|
|
|
cmpe byte [params.icon], 0, @f
|
|
|
|
add dword [text.offset], MARGIN + 24
|
|
|
|
@@:
|
|
|
|
|
|
|
|
;; CALC WIDTH
|
2014-04-06 21:31:46 +02:00
|
|
|
mov eax, [text.max_len]
|
|
|
|
imul eax, 6
|
2015-11-07 21:44:13 +01:00
|
|
|
add eax, MARGIN
|
|
|
|
add eax, [text.offset]
|
2014-04-06 21:31:46 +02:00
|
|
|
mov [window.width], eax
|
|
|
|
|
|
|
|
mcall 14
|
|
|
|
mov ebx, eax
|
2015-11-07 21:44:13 +01:00
|
|
|
movzx ebx, bx
|
2014-04-06 21:31:46 +02:00
|
|
|
mov [scr.height], ebx
|
|
|
|
shr eax, 16
|
|
|
|
mov [scr.width], eax
|
|
|
|
sub eax, [window.width]
|
|
|
|
sub eax, LINEH
|
|
|
|
mov [window.x], eax
|
|
|
|
|
2015-11-08 13:02:33 +01:00
|
|
|
;; CALC PBAR
|
|
|
|
mov eax, [window.width]
|
|
|
|
sub eax, [text.offset]
|
|
|
|
sub eax, MARGIN
|
|
|
|
mov [pbar.width], eax
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
;; CALC Y
|
|
|
|
mcall 68, 22, sz_shname, 256 + 512, 4 + 1 ;OPEN_ALWAYS AND WRITE
|
2014-04-09 17:42:05 +02:00
|
|
|
add eax, 512
|
2014-04-06 21:31:46 +02:00
|
|
|
mov [shm], eax
|
|
|
|
|
|
|
|
s_search:
|
|
|
|
mov eax, [shm]
|
|
|
|
|
|
|
|
mov ebx, 0
|
|
|
|
mov ecx, [text.lines]
|
|
|
|
add ecx, 3
|
|
|
|
|
|
|
|
push eax ebx
|
|
|
|
|
|
|
|
mov eax, [scr.height]
|
|
|
|
mov edx, 0
|
|
|
|
mov ebx, LINEH
|
|
|
|
div ebx
|
|
|
|
mov edx, eax
|
|
|
|
add edx, [shm]
|
|
|
|
sub edx, ecx
|
|
|
|
inc edx
|
|
|
|
|
|
|
|
pop ebx eax
|
|
|
|
|
|
|
|
s_area:
|
|
|
|
cmpe [eax], byte 1, .is_1
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
.is_0:
|
2014-04-06 21:31:46 +02:00
|
|
|
inc ebx
|
|
|
|
cmpe ebx, ecx, s_ok
|
|
|
|
jmp .next
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
.is_1:
|
2014-04-06 21:31:46 +02:00
|
|
|
mov ebx, 0
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
.next:
|
2014-04-06 21:31:46 +02:00
|
|
|
inc eax
|
|
|
|
cmple eax, edx, s_area
|
|
|
|
|
|
|
|
mcall 5, 10
|
|
|
|
jmp s_search
|
|
|
|
|
|
|
|
s_ok:
|
|
|
|
sub eax, ecx
|
|
|
|
inc eax
|
|
|
|
mov [shm.our], eax
|
|
|
|
|
|
|
|
mov edx, eax
|
|
|
|
sub edx, [shm]
|
|
|
|
inc edx
|
|
|
|
imul edx, LINEH
|
|
|
|
mov [window.y], edx
|
|
|
|
|
2014-04-22 20:06:06 +02:00
|
|
|
push eax ebx
|
|
|
|
mcall 48, 5
|
|
|
|
shr ebx, 16
|
|
|
|
add [window.y], ebx
|
|
|
|
pop ebx eax
|
|
|
|
|
2014-04-06 21:31:46 +02:00
|
|
|
@@:
|
|
|
|
mov [eax], byte 1
|
|
|
|
inc eax
|
|
|
|
loop @b
|
|
|
|
|
|
|
|
;----------------------------
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
;; SET EVENT MASK
|
|
|
|
mcall 40, 101b
|
|
|
|
|
|
|
|
;; INIT TIMER
|
2014-04-06 21:31:46 +02:00
|
|
|
mov eax, 60
|
|
|
|
imul eax, [text.lines]
|
|
|
|
mov [timer], eax
|
2015-11-07 21:44:13 +01:00
|
|
|
mov dword [timer.step], 1
|
|
|
|
cmpne byte [params.atcl], 1, @f
|
|
|
|
mov dword [timer.step], 0
|
2014-04-06 21:31:46 +02:00
|
|
|
@@:
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
;; INIT WINDOW
|
2015-10-30 17:50:43 +01:00
|
|
|
call init_window
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
;; RESTORE FOCUS
|
2015-10-30 17:50:43 +01:00
|
|
|
mcall 18, 21, [prev_pid]
|
|
|
|
mov ecx, eax
|
|
|
|
mcall 18, 3
|
|
|
|
|
|
|
|
jmp redraw
|
|
|
|
|
2014-04-06 21:31:46 +02:00
|
|
|
;----------------------------
|
|
|
|
|
|
|
|
update:
|
|
|
|
mcall 23, 10
|
|
|
|
cmpe al, EV_REDRAW, redraw
|
2015-11-07 21:44:13 +01:00
|
|
|
cmpe al, EV_BUTTON, button
|
|
|
|
|
|
|
|
mov edi, update
|
|
|
|
|
|
|
|
;; TRY OPEN CONTROLLER
|
|
|
|
cmpe byte [params.ctrl], 1, .fail_controller_open
|
|
|
|
mcall 68, 22, ctrl.name, , 0x01
|
|
|
|
cmpe eax, 0, .fail_controller_open
|
|
|
|
mov byte [params.ctrl], 1
|
|
|
|
mov [ctrl.addr], eax
|
|
|
|
|
|
|
|
;; COPY TEXT TO CTRL
|
|
|
|
add eax, NTCTRL_TEXT
|
|
|
|
mov ebx, text.buffer
|
2015-11-08 13:02:33 +01:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
mov ecx, [text.lines]
|
2015-11-08 13:02:33 +01:00
|
|
|
cmpne byte [params.pbar], 1, @f
|
|
|
|
dec ecx
|
|
|
|
@@:
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
.copy_start:
|
|
|
|
cmpe ecx, 0, .copy_end
|
|
|
|
mov dl, [ebx]
|
|
|
|
cmpne dl, 0, @f
|
2015-11-08 13:02:33 +01:00
|
|
|
mov dl, 10
|
2015-11-07 21:44:13 +01:00
|
|
|
dec ecx
|
|
|
|
@@:
|
|
|
|
mov [eax], dl
|
|
|
|
inc eax
|
|
|
|
inc ebx
|
|
|
|
jmp .copy_start
|
|
|
|
.copy_end:
|
|
|
|
mov byte [eax - 1], 0
|
|
|
|
|
|
|
|
;; COPY FLAGS TO CTRL
|
|
|
|
mov eax, [ctrl.addr]
|
|
|
|
add eax, NTCTRL_ICON
|
|
|
|
mov dl, [params.icon]
|
|
|
|
mov [eax], dl
|
|
|
|
|
|
|
|
mov eax, [ctrl.addr]
|
|
|
|
add eax, NTCTRL_TITLE
|
|
|
|
mov dl, [params.title]
|
|
|
|
mov [eax], dl
|
|
|
|
|
|
|
|
;; SET CONTROLLER READY
|
|
|
|
mov eax, [ctrl.addr]
|
|
|
|
add eax, NTCTRL_READY
|
|
|
|
mov byte [eax], 1
|
|
|
|
.fail_controller_open:
|
|
|
|
|
|
|
|
|
|
|
|
cmpe [params.ctrl], 0, .no_ctrl
|
|
|
|
;; TEST TEXT
|
|
|
|
mov eax, [ctrl.addr]
|
|
|
|
add eax, NTCTRL_APPLY_TEXT
|
|
|
|
cmpne byte [eax], 1, @f
|
|
|
|
mov byte [eax], 0
|
2015-11-08 13:02:33 +01:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
mov eax, [ctrl.addr]
|
|
|
|
add eax, NTCTRL_TEXT
|
|
|
|
mov esi, 1
|
|
|
|
call parse_text
|
2015-11-08 13:02:33 +01:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
mov edi, redraw
|
|
|
|
@@:
|
|
|
|
|
|
|
|
;; TEST ICON
|
|
|
|
mov eax, [ctrl.addr]
|
|
|
|
add eax, NTCTRL_APPLY_ICON
|
|
|
|
cmpne byte [eax], 1, @f
|
2015-11-08 13:02:33 +01:00
|
|
|
mov byte [eax], 0
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
mov eax, [ctrl.addr]
|
|
|
|
add eax, NTCTRL_ICON
|
|
|
|
mov dl, [eax]
|
|
|
|
mov [params.icon], dl
|
2015-11-08 13:02:33 +01:00
|
|
|
|
|
|
|
mov edi, redraw
|
2015-11-07 21:44:13 +01:00
|
|
|
@@:
|
|
|
|
|
|
|
|
;; TEST TITLE
|
|
|
|
mov eax, [ctrl.addr]
|
|
|
|
add eax, NTCTRL_APPLY_TITLE
|
|
|
|
cmpne byte [eax], 1, @f
|
2015-11-08 13:02:33 +01:00
|
|
|
mov byte [eax], 0
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
mov eax, [ctrl.addr]
|
|
|
|
add eax, NTCTRL_TITLE
|
|
|
|
mov dl, [eax]
|
|
|
|
mov [params.title], dl
|
2015-11-08 13:02:33 +01:00
|
|
|
|
|
|
|
mov edi, redraw
|
|
|
|
@@:
|
|
|
|
|
|
|
|
;; TEST PBAR
|
|
|
|
mov eax, [ctrl.addr]
|
|
|
|
add eax, NTCTRL_APPLY_PBAR
|
|
|
|
cmpne byte [eax], 1, @f
|
|
|
|
mov byte [eax], 0
|
|
|
|
|
|
|
|
mov eax, [ctrl.addr]
|
|
|
|
add eax, NTCTRL_PBAR_CUR
|
|
|
|
mov edx, [eax]
|
|
|
|
mov [pbar.cur_val], edx
|
|
|
|
|
|
|
|
mov eax, [ctrl.addr]
|
|
|
|
add eax, NTCTRL_PBAR_MAX
|
|
|
|
mov edx, [eax]
|
|
|
|
mov [pbar.max_val], edx
|
|
|
|
|
|
|
|
call calc_fill_width
|
|
|
|
|
|
|
|
mov edi, redraw
|
2015-11-07 21:44:13 +01:00
|
|
|
@@:
|
|
|
|
|
|
|
|
;; TEST CLOSE
|
|
|
|
mov eax, [ctrl.addr]
|
|
|
|
add eax, NTCTRL_CLOSE
|
|
|
|
cmpe byte [eax], 1, exit
|
|
|
|
|
|
|
|
.no_ctrl:
|
2014-04-06 21:31:46 +02:00
|
|
|
|
|
|
|
mov eax, [timer.step]
|
|
|
|
sub [timer], eax
|
2015-11-07 21:44:13 +01:00
|
|
|
cmpe [timer], dword 0, exit
|
|
|
|
jmp edi
|
2014-04-06 21:31:46 +02:00
|
|
|
|
|
|
|
;----------------------------
|
|
|
|
|
|
|
|
exit:
|
|
|
|
mov eax, [shm.our]
|
|
|
|
mov ecx, [text.lines]
|
|
|
|
add ecx, 3
|
|
|
|
@@:
|
|
|
|
mov [eax], byte 0
|
|
|
|
inc eax
|
|
|
|
loop @b
|
|
|
|
|
|
|
|
mcall 68, 23, sz_shname
|
|
|
|
|
|
|
|
mcall -1
|
|
|
|
|
|
|
|
;----------------------------
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
button:
|
|
|
|
mcall 17
|
|
|
|
cmpe byte [params.clcl], 0, exit
|
|
|
|
jmp update
|
2015-02-26 16:03:52 +01:00
|
|
|
|
|
|
|
;----------------------------
|
|
|
|
|
2014-04-06 21:31:46 +02:00
|
|
|
redraw:
|
|
|
|
call draw_window
|
|
|
|
call draw_text
|
2015-11-08 13:02:33 +01:00
|
|
|
call draw_pbar
|
2014-04-06 21:31:46 +02:00
|
|
|
|
|
|
|
jmp update
|
|
|
|
|
|
|
|
;----------------------------
|
|
|
|
|
|
|
|
draw_window:
|
2015-10-30 17:50:43 +01:00
|
|
|
call init_window
|
2014-04-06 21:31:46 +02:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
movzx ebx, bx
|
|
|
|
movzx ecx, cx
|
2014-04-06 21:31:46 +02:00
|
|
|
inc ebx
|
|
|
|
inc ecx
|
|
|
|
mcall 8, , , 0x61000001
|
|
|
|
|
|
|
|
mov eax, 13
|
|
|
|
mov ebx, [window.width]
|
|
|
|
mov edx, 0x222222
|
2015-10-30 17:50:43 +01:00
|
|
|
|
2014-04-06 21:31:46 +02:00
|
|
|
cmpe [first_draw], byte 1, .draw_full
|
|
|
|
mov [first_draw], byte 1
|
|
|
|
mov esi, [window.height]
|
2014-04-08 20:39:01 +02:00
|
|
|
mov ecx, LINEH
|
2014-04-06 21:31:46 +02:00
|
|
|
@@:
|
|
|
|
mcall
|
2014-04-08 20:39:01 +02:00
|
|
|
add ecx, LINEH shl 16
|
|
|
|
sub esi, LINEH
|
2014-04-06 21:31:46 +02:00
|
|
|
push eax ebx
|
|
|
|
mcall 5, 1
|
|
|
|
pop ebx eax
|
|
|
|
cmpne esi, 0, @b
|
2015-10-30 17:50:43 +01:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
.draw_full:
|
2014-04-06 21:31:46 +02:00
|
|
|
mcall
|
|
|
|
|
|
|
|
mcall , , 1, 0x121212
|
|
|
|
|
|
|
|
mov ecx, [window.height]
|
|
|
|
dec ecx
|
|
|
|
shl ecx, 16
|
|
|
|
inc ecx
|
|
|
|
mcall
|
|
|
|
|
|
|
|
mcall , 1, [window.width]
|
|
|
|
|
|
|
|
mov ebx, [window.width]
|
|
|
|
dec ebx
|
|
|
|
shl ebx, 16
|
|
|
|
inc ebx
|
|
|
|
mcall
|
|
|
|
|
|
|
|
mcall 1, 1, 1
|
|
|
|
mov ebx, [window.width]
|
|
|
|
sub ebx, 2
|
|
|
|
mcall
|
|
|
|
mov ecx, [window.height]
|
|
|
|
sub ecx, 2
|
|
|
|
mcall
|
|
|
|
mov ebx, 1
|
|
|
|
mcall
|
|
|
|
|
|
|
|
;-----
|
|
|
|
|
|
|
|
mov ecx, [scr.width]
|
|
|
|
inc ecx
|
|
|
|
|
|
|
|
mov eax, 35
|
|
|
|
mov ebx, ecx
|
|
|
|
imul ebx, [window.y]
|
|
|
|
add ebx, [window.x]
|
|
|
|
dec ebx
|
|
|
|
mcall
|
|
|
|
push eax
|
|
|
|
|
|
|
|
mov eax, 35
|
|
|
|
add ebx, [window.width]
|
|
|
|
add ebx, 2
|
|
|
|
mcall
|
|
|
|
push eax
|
|
|
|
|
|
|
|
mov eax, 35
|
|
|
|
mov edx, ecx
|
|
|
|
mov esi, [window.height]
|
|
|
|
dec esi
|
|
|
|
imul edx, esi
|
|
|
|
add ebx, edx
|
|
|
|
mcall
|
|
|
|
push eax
|
|
|
|
|
|
|
|
mov eax, 35
|
|
|
|
sub ebx, [window.width]
|
|
|
|
sub ebx, 2
|
|
|
|
mcall
|
|
|
|
push eax
|
|
|
|
|
|
|
|
;-----
|
|
|
|
|
|
|
|
mov eax, 1
|
|
|
|
|
|
|
|
pop edx
|
|
|
|
mov ecx, [window.height]
|
|
|
|
dec ecx
|
|
|
|
mcall , 0
|
|
|
|
|
|
|
|
pop edx
|
|
|
|
mov ebx, [window.width]
|
|
|
|
dec ebx
|
|
|
|
mcall
|
|
|
|
|
|
|
|
pop edx
|
|
|
|
mcall , , 0
|
|
|
|
|
|
|
|
pop edx
|
|
|
|
mcall , 0
|
|
|
|
|
|
|
|
;-----
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
cmpe byte [params.icon], 0, @f
|
|
|
|
movzx ebx, byte [params.icon]
|
2014-04-06 21:31:46 +02:00
|
|
|
dec ebx
|
|
|
|
imul ebx, 24 * 24 * 3
|
|
|
|
add ebx, [img_data.rgb_obj]
|
|
|
|
|
|
|
|
mov edx, [window.height]
|
|
|
|
shr edx, 1
|
|
|
|
sub edx, 12
|
|
|
|
add edx, LINEH shl 16
|
|
|
|
|
|
|
|
mcall 7, , <24, 24>
|
|
|
|
@@:
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
;----------------------------
|
|
|
|
|
|
|
|
draw_text:
|
|
|
|
mov esi, [text.lines]
|
|
|
|
|
2015-11-08 13:02:33 +01:00
|
|
|
cmpne byte [params.pbar], 1, @f
|
|
|
|
dec esi
|
|
|
|
@@:
|
|
|
|
|
2014-04-06 21:31:46 +02:00
|
|
|
mov eax, 4
|
|
|
|
mov ebx, [text.offset]
|
|
|
|
shl ebx, 16
|
|
|
|
add ebx, LINEH + (LINEH - 6) / 2
|
|
|
|
mov edx, text.buffer
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
.draw_lines:
|
2014-04-06 21:31:46 +02:00
|
|
|
mov ecx, 0x80111111
|
|
|
|
|
|
|
|
add ebx, 0x00010000
|
|
|
|
dec ebx
|
|
|
|
mcall
|
|
|
|
add ebx, 2
|
|
|
|
mcall
|
|
|
|
sub ebx, 0x00020000
|
|
|
|
mcall
|
|
|
|
sub ebx, 2
|
|
|
|
mcall
|
|
|
|
|
|
|
|
add ebx, 0x00010001
|
|
|
|
mov ecx, 0x80D0D0D0
|
|
|
|
mcall
|
|
|
|
|
|
|
|
add ebx, LINEH
|
|
|
|
dec esi
|
|
|
|
cmpe esi, 0, .draw_lines.end
|
|
|
|
|
|
|
|
inc edx
|
|
|
|
@@:
|
|
|
|
cmpe [edx], byte 0, @f
|
|
|
|
inc edx
|
|
|
|
jmp @b
|
|
|
|
@@:
|
|
|
|
inc edx
|
|
|
|
jmp .draw_lines
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
.draw_lines.end:
|
2014-04-06 21:31:46 +02:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
cmpne byte [params.title], 1, @f
|
2014-04-06 21:31:46 +02:00
|
|
|
mov edx, text.buffer
|
|
|
|
mov ecx, 0x80111111
|
|
|
|
and ebx, 0xFFFF0000
|
|
|
|
add ebx, 1 shl 16 + LINEH + (LINEH - 6) / 2
|
|
|
|
mcall
|
|
|
|
|
|
|
|
mov ecx, 0x80FFFFFF
|
|
|
|
sub ebx, 0x00010000
|
|
|
|
mcall
|
|
|
|
@@:
|
|
|
|
|
|
|
|
ret
|
2015-10-30 17:50:43 +01:00
|
|
|
|
|
|
|
;----------------------------
|
|
|
|
|
2015-11-08 13:02:33 +01:00
|
|
|
draw_pbar:
|
|
|
|
cmpne byte [params.pbar], 1, .exit
|
|
|
|
mov esi, 0xFF0000
|
|
|
|
mov ecx, LINEH
|
|
|
|
imul ecx, [text.lines]
|
|
|
|
shl ecx, 16
|
|
|
|
add ecx, (LINEH / 2) shl 16 + 8
|
|
|
|
mcall 13, <[text.offset], [pbar.width]>, , 0x555555
|
|
|
|
|
|
|
|
sub ecx, -(1 shl 16) + 2
|
|
|
|
|
|
|
|
mov bx, word [pbar.f_width]
|
|
|
|
add ebx, 1 shl 16
|
|
|
|
|
|
|
|
mcall , , , 0x999999
|
|
|
|
mov cx, 1
|
|
|
|
mcall , , , 0xAAAAAA
|
|
|
|
mov cx, 6
|
|
|
|
mov bx, 1
|
|
|
|
mcall
|
|
|
|
.exit:
|
|
|
|
ret
|
|
|
|
|
|
|
|
;----------------------------
|
|
|
|
|
2015-10-30 17:50:43 +01:00
|
|
|
init_window:
|
|
|
|
dec dword [window.width]
|
|
|
|
dec dword [window.height]
|
|
|
|
mcall 0, <[window.x], [window.width]>, <[window.y], [window.height]>, 0x61000000
|
|
|
|
inc dword [window.width]
|
|
|
|
inc dword [window.height]
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
2014-04-06 21:31:46 +02:00
|
|
|
;----------------------------
|
|
|
|
|
2015-11-06 17:45:38 +01:00
|
|
|
parse_text:
|
|
|
|
mov dword [text.lines], 1
|
2015-11-08 13:02:33 +01:00
|
|
|
cmpne byte [params.pbar], 1, @f
|
|
|
|
inc dword [text.lines]
|
|
|
|
@@:
|
|
|
|
|
|
|
|
mov dword [text.max_len], 0
|
2015-11-06 17:45:38 +01:00
|
|
|
mov ebx, text.buffer
|
|
|
|
mov ecx, 0
|
|
|
|
mov dl, 0
|
|
|
|
mov dh, 0
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
cmpe esi, 1, .parse_loop
|
2015-11-06 17:45:38 +01:00
|
|
|
cmpne byte [eax], "'", @f
|
|
|
|
mov dl, "'"
|
|
|
|
mov dh, 1
|
|
|
|
@@:
|
|
|
|
cmpne byte [eax], '"', @f
|
|
|
|
mov dl, '"'
|
|
|
|
mov dh, 1
|
|
|
|
@@:
|
|
|
|
cmpne dh, 1, @f
|
|
|
|
inc eax
|
|
|
|
@@:
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
.parse_loop:
|
2015-11-06 17:45:38 +01:00
|
|
|
cmpe byte [eax], 0, .parse_loop.end
|
|
|
|
cmpe byte [eax], dl, .parse_loop.end
|
|
|
|
|
|
|
|
cmpe byte [eax], 10, .newline
|
2015-11-07 21:44:13 +01:00
|
|
|
cmpe esi, 1, .next_set_char
|
|
|
|
cmpne byte [eax], "\", @f
|
|
|
|
cmpe byte [eax + 1], dl, .quote
|
|
|
|
cmpe byte [eax + 1], "n", .newline_esc
|
|
|
|
jmp @f
|
2015-11-06 17:45:38 +01:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
.quote:
|
2015-11-06 17:45:38 +01:00
|
|
|
inc eax
|
2015-11-07 21:44:13 +01:00
|
|
|
jmp .next_set_char
|
2015-11-06 17:45:38 +01:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
.newline_esc:
|
|
|
|
inc eax
|
|
|
|
|
|
|
|
.newline:
|
2015-11-06 17:45:38 +01:00
|
|
|
mov byte [ebx], 0
|
|
|
|
cmple ecx, dword [text.max_len], .skip_max_len
|
|
|
|
mov dword [text.max_len], ecx
|
2015-11-07 21:44:13 +01:00
|
|
|
.skip_max_len:
|
2015-11-06 17:45:38 +01:00
|
|
|
mov ecx, 0
|
|
|
|
inc dword [text.lines]
|
|
|
|
jmp .next
|
|
|
|
@@:
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
.next_set_char:
|
|
|
|
mov dh, [eax]
|
2015-11-06 17:45:38 +01:00
|
|
|
mov [ebx], dh
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
.next:
|
2015-11-06 17:45:38 +01:00
|
|
|
inc eax
|
|
|
|
inc ebx
|
|
|
|
inc ecx
|
|
|
|
jmp .parse_loop
|
2015-11-07 21:44:13 +01:00
|
|
|
.parse_loop.end:
|
2015-11-06 17:45:38 +01:00
|
|
|
|
|
|
|
cmple ecx, dword [text.max_len], @f
|
|
|
|
mov dword [text.max_len], ecx
|
|
|
|
@@:
|
|
|
|
|
|
|
|
cmpge [text.max_len], dword 25, @f
|
|
|
|
mov [text.max_len], dword 25
|
|
|
|
@@:
|
|
|
|
|
|
|
|
mov [ebx], byte 0
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
;----------------------------
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
parse_flags:
|
|
|
|
mov byte [params.atcl], 0
|
|
|
|
mov byte [params.title], 0
|
|
|
|
mov byte [params.icon], 0
|
|
|
|
|
|
|
|
.loop:
|
|
|
|
mov dl, [eax]
|
|
|
|
|
|
|
|
cmpe dl, 0, .exit
|
|
|
|
cmpe dl, "d", .set_atcl
|
|
|
|
cmpe dl, "c", .set_clcl
|
|
|
|
cmpe dl, "t", .set_title
|
2015-11-08 13:02:33 +01:00
|
|
|
cmpe dl, "p", .set_pbar
|
2015-11-07 21:44:13 +01:00
|
|
|
|
|
|
|
mov bl, 1
|
|
|
|
mov ecx, sz_icons
|
|
|
|
@@:
|
|
|
|
cmpe dl, [ecx], .set_icon
|
|
|
|
inc bl
|
|
|
|
inc ecx
|
|
|
|
cmpne [ecx], byte 0, @b
|
|
|
|
jmp .next_char
|
|
|
|
|
|
|
|
.set_atcl:
|
|
|
|
mov byte [params.atcl], 1
|
|
|
|
jmp .next_char
|
|
|
|
|
|
|
|
.set_clcl:
|
|
|
|
mov byte [params.clcl], 1
|
|
|
|
jmp .next_char
|
|
|
|
|
|
|
|
.set_title:
|
|
|
|
mov byte [params.title], 1
|
|
|
|
jmp .next_char
|
|
|
|
|
2015-11-08 13:02:33 +01:00
|
|
|
.set_pbar:
|
|
|
|
mov byte [params.pbar], 1
|
|
|
|
inc dword [text.lines]
|
|
|
|
jmp .next_char
|
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
.set_icon:
|
|
|
|
mov [params.icon], bl
|
|
|
|
|
|
|
|
.next_char:
|
|
|
|
inc eax
|
|
|
|
jmp .loop
|
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
|
|
|
|
|
|
|
;----------------------------
|
|
|
|
|
2015-11-08 13:02:33 +01:00
|
|
|
calc_fill_width:
|
|
|
|
mov eax, [pbar.cur_val]
|
|
|
|
cmpng eax, [pbar.max_val], @f
|
|
|
|
mov eax, [pbar.max_val]
|
|
|
|
@@:
|
|
|
|
cmpnl eax, 0, @f
|
|
|
|
mov eax, 0
|
|
|
|
@@:
|
|
|
|
|
|
|
|
mov ebx, [pbar.width]
|
|
|
|
sub ebx, 2
|
|
|
|
imul eax, ebx
|
|
|
|
mov edx, 0
|
|
|
|
mov ebx, [pbar.max_val]
|
|
|
|
div ebx
|
|
|
|
mov [pbar.f_width], eax
|
|
|
|
ret
|
|
|
|
|
|
|
|
;----------------------------
|
|
|
|
|
2014-04-06 21:31:46 +02:00
|
|
|
@imports:
|
|
|
|
library img, "libimg.obj"
|
2015-11-07 21:44:13 +01:00
|
|
|
import img, img.to_rgb, "img_to_rgb2", \
|
|
|
|
img.decode, "img_decode", \
|
2014-04-06 21:31:46 +02:00
|
|
|
img.destroy, "img_destroy"
|
|
|
|
|
|
|
|
;----------------------------
|
|
|
|
|
2015-10-30 17:50:43 +01:00
|
|
|
sz_icons db "AEWONIFCMDS", 0
|
2014-04-08 20:39:01 +02:00
|
|
|
sz_ifile db "/sys/notify3.png", 0
|
2014-04-06 21:31:46 +02:00
|
|
|
sz_shname db "notify-mem-v01", 0
|
2015-11-07 21:44:13 +01:00
|
|
|
sz_std db "'NOTIFY 3\n", \
|
|
|
|
"d - disable auto-closing\n", \
|
|
|
|
"c - disable click-closing\n", \
|
2015-11-08 13:02:33 +01:00
|
|
|
"p - use progressbar\n", \
|
2015-11-07 21:44:13 +01:00
|
|
|
"t - title\n", \
|
|
|
|
" \n", \
|
|
|
|
"ICONS:\n", \
|
|
|
|
"A - application\n", \
|
|
|
|
"E - error\n", \
|
|
|
|
"W - warning\n", \
|
|
|
|
"O - ok\n", \
|
|
|
|
"N - network\n", \
|
|
|
|
"I - info\n", \
|
|
|
|
"F - folder\n", \
|
|
|
|
"C - component\n", \
|
|
|
|
"M - mail\n", \
|
|
|
|
"D - download\n", \
|
|
|
|
"S - audio player", \
|
2015-11-06 17:45:38 +01:00
|
|
|
"' -td", 0
|
2014-04-06 21:31:46 +02:00
|
|
|
|
2015-11-07 21:44:13 +01:00
|
|
|
fi:
|
|
|
|
dd 5
|
|
|
|
dd 0, 0, 0
|
|
|
|
dd buffer
|
|
|
|
db 0
|
|
|
|
dd sz_ifile
|
|
|
|
|
2014-04-06 21:31:46 +02:00
|
|
|
;----------------------------
|
|
|
|
|
|
|
|
@end:
|
|
|
|
|
|
|
|
;=====================================================================
|
|
|
|
|
|
|
|
window:
|
2015-11-07 21:44:13 +01:00
|
|
|
.x rd 1
|
|
|
|
.y rd 1
|
|
|
|
.width rd 1
|
|
|
|
.height rd 1
|
2014-04-06 21:31:46 +02:00
|
|
|
|
|
|
|
scr:
|
2015-11-07 21:44:13 +01:00
|
|
|
.width rd 1
|
|
|
|
.height rd 1
|
2014-04-06 21:31:46 +02:00
|
|
|
|
|
|
|
text:
|
2015-11-07 21:44:13 +01:00
|
|
|
.buffer rb 2048
|
|
|
|
.lines rd 1
|
|
|
|
.max_len rd 1
|
|
|
|
.offset rd 1
|
2014-04-06 21:31:46 +02:00
|
|
|
|
|
|
|
params:
|
2015-11-07 21:44:13 +01:00
|
|
|
.source rd 1
|
|
|
|
.atcl rb 1
|
|
|
|
.clcl rb 1
|
|
|
|
.title rb 1
|
2015-11-08 13:02:33 +01:00
|
|
|
.pbar rb 1
|
2015-11-07 21:44:13 +01:00
|
|
|
.icon rb 1
|
|
|
|
.ctrl rb 1
|
2014-04-06 21:31:46 +02:00
|
|
|
|
|
|
|
img_data:
|
2015-11-07 21:44:13 +01:00
|
|
|
.rgb_obj rd 1
|
|
|
|
.obj rd 1
|
2014-04-06 21:31:46 +02:00
|
|
|
|
|
|
|
timer:
|
2015-11-07 21:44:13 +01:00
|
|
|
.value rd 1
|
|
|
|
.step rd 1
|
2014-04-06 21:31:46 +02:00
|
|
|
|
|
|
|
shm:
|
2015-11-07 21:44:13 +01:00
|
|
|
.addr rd 1
|
|
|
|
.our rd 1
|
|
|
|
|
|
|
|
ctrl:
|
|
|
|
.name rb 31
|
|
|
|
.addr rd 1
|
2014-04-06 21:31:46 +02:00
|
|
|
|
2015-11-08 13:02:33 +01:00
|
|
|
pbar:
|
|
|
|
.width rd 1
|
|
|
|
.cur_val rd 1
|
|
|
|
.max_val rd 1
|
|
|
|
.f_width rd 1
|
|
|
|
|
2014-04-06 21:31:46 +02:00
|
|
|
buffer rb 1024
|
|
|
|
first_draw rb 1
|
2015-10-30 17:50:43 +01:00
|
|
|
prev_pid rd 1
|
2014-04-06 21:31:46 +02:00
|
|
|
|
|
|
|
;=====================================================================
|
|
|
|
rb 2048
|
|
|
|
@stack:
|
2015-11-06 20:08:26 +01:00
|
|
|
@params rb 2048
|
2014-04-06 21:31:46 +02:00
|
|
|
|
|
|
|
@memory:
|