ICON - fixed crash when trying to select some of the icons (bug #13)

git-svn-id: svn://kolibrios.org@2697 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2012-05-27 23:11:44 +00:00
parent d1955fdb3d
commit 7826bd0917
2 changed files with 48 additions and 5 deletions

View File

@ -16,6 +16,9 @@ cur_band rd 1
icon_count rd 1 icon_count rd 1
strip_file rd 1 strip_file rd 1
strip_file_size rd 1
cur_band_compensation rd 1
icon_position: rd 1 ; [ebp-4] 'AA-F' or... icon_position: rd 1 ; [ebp-4] 'AA-F' or...
adress_of_icon_data: rd 1 ; [ebp+8] adress_of_icon_data: rd 1 ; [ebp+8]

View File

@ -5,6 +5,12 @@
;* Compile with flat assembler * ;* Compile with flat assembler *
;* * ;* *
;******************************** ;********************************
; version: 3.11
; last update: 28/05/2012
; changed by: Marat Zakiyanov aka Mario79, aka Mario
; changes: Fixed crash when trying to select some of the icons.
; (bug 000013)
;---------------------------------------------------------------------
; version: 3.10 ; version: 3.10
; last update: 03/04/2012 ; last update: 03/04/2012
; changed by: Marat Zakiyanov aka Mario79, aka Mario ; changed by: Marat Zakiyanov aka Mario79, aka Mario
@ -91,18 +97,18 @@ load_libraries l_libs_start,end_l_libs
mov eax,[unpack_DeflateUnpack2] mov eax,[unpack_DeflateUnpack2]
mov [deflate_unpack],eax mov [deflate_unpack],eax
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
; get size of file ICONSTRP.GIF ; get size of file ICONSTRP.PNG
mcall 70,finfo mcall 70,finfo
test eax,eax test eax,eax
jnz close jnz close
; get memory for ICONSTRP.GIF ; get memory for ICONSTRP.PNG
mov ecx,[procinfo+32] mov ecx,[procinfo+32]
mov [finfo.size],ecx mov [finfo.size],ecx
mov [img_size],ecx mov [img_size],ecx
mcall 68,12 mcall 68,12
mov [finfo.point],eax mov [finfo.point],eax
mov [image_file],eax mov [image_file],eax
; load ICONSTRP.GIF ; load ICONSTRP.PNG
mov [finfo],dword 0 mov [finfo],dword 0
mcall 70,finfo mcall 70,finfo
test eax,eax test eax,eax
@ -115,6 +121,8 @@ load_libraries l_libs_start,end_l_libs
call [cnv_png_import.Start] call [cnv_png_import.Start]
mov eax,[raw_pointer] mov eax,[raw_pointer]
mov ebx,[eax+32]
mov [strip_file_size],ebx
mov eax,[eax+28] mov eax,[eax+28]
add eax,[raw_pointer] add eax,[raw_pointer]
mov [strip_file],eax mov [strip_file],eax
@ -125,6 +133,9 @@ load_libraries l_libs_start,end_l_libs
mov eax,[eax+8] mov eax,[eax+8]
shr eax,5 shr eax,5
mov [icon_count],eax mov [icon_count],eax
and eax,0x7
mov [cur_band_compensation],eax
; load ICON.DAT ; load ICON.DAT
call load_ic call load_ic
boot_str: boot_str:
@ -470,7 +481,14 @@ align 4
band: band:
add esi,12 add esi,12
call ASCII_to_icon_number call ASCII_to_icon_number
and eax,0xfffff8 ; and eax,0xfffff8
cmp eax,[cur_band_compensation]
jb @f
sub eax,[cur_band_compensation]
;--------------------------------------
align 4
@@:
mov [cur_band],eax mov [cur_band],eax
call draw_btns call draw_btns
jmp still jmp still
@ -791,12 +809,34 @@ align 4
push ecx push ecx
pusha pusha
mov ebp,0 mov ebp,0
mov eax,[strip_file_size]
add eax,[strip_file]
cmp eax,ebx
ja @f
; draw a rectangle if icon does not exist
mov ebx,edx ; X
mov ecx,edx ; Y
shl ecx,16
mov bx,32
mov cx,bx
xor edx,edx
mcall 13
jmp .draw_pict_end
;--------------------------------------
align 4
@@:
mcall 65,,<32,32>,,32 mcall 65,,<32,32>,,32
;--------------------------------------
align 4
.draw_pict_end:
popa popa
pop ecx pop ecx
add ebx,ICON_SIZE add ebx,ICON_SIZE
add edx,34 shl 16 add edx,34 shl 16
loop .nxt
dec ecx
jnz .nxt
mcall 4,<45,280-2>,0,rep_text,rep_text_len-rep_text mcall 4,<45,280-2>,0,rep_text,rep_text_len-rep_text
lea edx,[ebx+(8*5)shl 16] lea edx,[ebx+(8*5)shl 16]