From 7826bd091710b9393021e7e1bbbac7d017644550 Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Sun, 27 May 2012 23:11:44 +0000 Subject: [PATCH] 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 --- programs/system/icon/trunk/dat_area.inc | 3 ++ programs/system/icon/trunk/icon.asm | 50 ++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/programs/system/icon/trunk/dat_area.inc b/programs/system/icon/trunk/dat_area.inc index f8f1d3d14e..1662d3cb20 100644 --- a/programs/system/icon/trunk/dat_area.inc +++ b/programs/system/icon/trunk/dat_area.inc @@ -16,6 +16,9 @@ cur_band rd 1 icon_count 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... adress_of_icon_data: rd 1 ; [ebp+8] diff --git a/programs/system/icon/trunk/icon.asm b/programs/system/icon/trunk/icon.asm index 2ce909f73e..3174576011 100644 --- a/programs/system/icon/trunk/icon.asm +++ b/programs/system/icon/trunk/icon.asm @@ -5,6 +5,12 @@ ;* 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 ; last update: 03/04/2012 ; 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 [deflate_unpack],eax ;--------------------------------------------------------------------- -; get size of file ICONSTRP.GIF +; get size of file ICONSTRP.PNG mcall 70,finfo test eax,eax jnz close -; get memory for ICONSTRP.GIF +; get memory for ICONSTRP.PNG mov ecx,[procinfo+32] mov [finfo.size],ecx mov [img_size],ecx mcall 68,12 mov [finfo.point],eax mov [image_file],eax -; load ICONSTRP.GIF +; load ICONSTRP.PNG mov [finfo],dword 0 mcall 70,finfo test eax,eax @@ -115,6 +121,8 @@ load_libraries l_libs_start,end_l_libs call [cnv_png_import.Start] mov eax,[raw_pointer] + mov ebx,[eax+32] + mov [strip_file_size],ebx mov eax,[eax+28] add eax,[raw_pointer] mov [strip_file],eax @@ -125,6 +133,9 @@ load_libraries l_libs_start,end_l_libs mov eax,[eax+8] shr eax,5 mov [icon_count],eax + + and eax,0x7 + mov [cur_band_compensation],eax ; load ICON.DAT call load_ic boot_str: @@ -470,7 +481,14 @@ align 4 band: add esi,12 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 call draw_btns jmp still @@ -791,12 +809,34 @@ align 4 push ecx pusha 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 +;-------------------------------------- +align 4 +.draw_pict_end: popa pop ecx add ebx,ICON_SIZE add edx,34 shl 16 - loop .nxt + + dec ecx + jnz .nxt mcall 4,<45,280-2>,0,rep_text,rep_text_len-rep_text lea edx,[ebx+(8*5)shl 16]