kolibrios-gitea/programs/system/icon_new/ico.inc
Marat Zakiyanov (Mario79) 0177401fa8 Fixed some bugs reported by 0CodErr. Author of fix - GerdtR.
git-svn-id: svn://kolibrios.org@3921 a494cfbc-eb01-0410-851d-a64ba20cac60
2013-09-21 12:25:30 +00:00

131 lines
2.6 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

include 'libimg/libimg.asm'
;¢®§¢à é ¥â 㪠§ â¥«ì ­  ¯ ¬ïâì «¨¡® 0
LoadIcon:
path equ ebp+8
BuffR equ ebp-16
BuffH equ ebp-22
endTablI equ ebp-26
push ebp
mov ebp,esp
add esp,-26
push ebx edi esi
;--------------------------- ¯à®¢¥à塞 - § £à㦥­  «¨ íâ®â ä ©« á ¨ª®­ª®© ------
xor ebx,ebx
.SearchIco:
mov edi,[path]
mov esi,[IcoTable+ebx]
@@: lodsb
scasb
jne @f
test al,al
jnz @b
mov eax,[IcoTable+ebx+4]
pop esi edi ebx
leave
ret 4
@@:
add ebx,8
cmp ebx,50*8
jne @f
xor eax,eax
pop esi edi ebx
leave
ret 4
@@:
cmp [IcoTable+ebx],0
jnz .SearchIco
;-------------------------------------------------------------------------------
mov [endTablI],ebx
m2m dword[fiIcon.path],dword[path]
mcall 70,fiIcon
test eax,eax
jz @f
xor eax,eax
pop esi edi ebx
leave
ret 4
@@:
xor ecx,ecx
mov cx,[BuffH+4]
xor edi,edi
.TestRecord:
cmp word[BuffR],2020h
jne .NextRec
cmp byte[BuffR+2],0
jne .NextRec
lea eax,[BuffR]
stdcall LoadIco32b, [path],eax
pop esi edi ebx
leave
ret 4
.NextRec:
inc edi
mov eax,edi
shl eax,4
add eax,6
mov dword[fiIcon.pos],eax
mcall 70,fiIcon
loop .TestRecord
xor eax,eax
pop esi edi ebx
leave
ret 4
restore path
restore BuffH
restore BuffR
proc LoadIco32b, path,bufHeader
local ImgBuff:DWORD
mov edi,[bufHeader]
cmp dword[edi+8],10A8h
je @f
xor eax,eax
ret
@@:
mcall 68,12,32*32*4*2
mov ebx,[endTablI]
mov [IcoTable+ebx],eax
add eax,4096
mov [IcoTable+ebx+4],eax
mov [ImgBuff],eax
m2m dword[fiIcon.pos],dword[edi+12]
mov dword[fiIcon.size],32*32*4
mcall 70,fiIcon
mov eax,[ImgBuff]
ret
endp
fiIcon:
dd 0
.pos dd 0
dd 0
.size dd 22
.point dd 0
db 0
.path dd 0
IcoTable rd 2*50 ;(name(4), data(4)). End - dword 0