kolibrios-fun/programs/develop/info3ds/info3ds.asm
IgorA 337ce7e86b info3ds:
1) fixed detection of levels of blocks
2) added a signature to some units

git-svn-id: svn://kolibrios.org@2080 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-08-20 09:48:05 +00:00

1276 lines
35 KiB
NASM
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.

use32
org 0x0
db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
dd 0x1
dd start
dd i_end ;à §¬¥à ¯à¨«®¦¥­¨ï
dd mem
dd stacktop
dd 0
dd sys_path
include '../../macros.inc'
include '../../proc32.inc'
include '../../develop/libraries/box_lib/load_lib.mac'
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
include 'mem.inc'
include 'dll.inc'
include 'lang.inc'
debug equ 0
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
capt db 'info 3ds 20.08.11',0 ;¯®¤¯¨áì ®ª­ 
struct FileInfoBlock
Function dd ?
Position dd ?
Flags dd ?
Count dd ?
Buffer dd ?
db ?
FileName dd ?
ends
run_file_70 FileInfoBlock
image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
open_file_lif dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï ®âªàëâ¨ï ä ©«®¢ 3ds
;
fn_toolbar db 'toolbar.png',0
IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*7
image_data_toolbar dd 0
;
TREE_ICON_SYS16_BMP_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*11+54 ;à §¬¥à bmp ä ©«  á á¨á⥬­ë¬¨ ¨ª®­ª ¬¨
icon_tl_sys dd 0 ;㪠§ â¥¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï á¨á⥬­ëå ¨ª®­®ª
icon_toolbar dd 0 ;㪠§ â¥¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï ¨ª®­®ª ®¡ê¥ªâ®¢
TOOLBAR_ICON_BMP_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*7+54 ;à §¬¥à bmp ä ©«  á ¨ª®­ª ¬¨ ®¡ê¥ªâ®¢
;
IMAGE_FILE1_SIZE equ 128*144*3+54 ;à §¬¥à ä ©«  á ¨§®¡à ¦¥­¨¥¬
macro load_image_file path,buf,size { ;¬ ªà®á ¤«ï § £à㧪¨ ¨§®¡à ¦¥­¨©
;path - ¬®¦¥â ¡ëâì ¯¥à¥¬¥­­®© ¨«¨ áâப®¢ë¬ ¯ à ¬¥â஬
if path eqtype '' ;¯à®¢¥à塞 § ¤ ­ «¨ áâப®© ¯ à ¬¥âà path
jmp @f
local .path_str
.path_str db path ;ä®à¬¨à㥬 «®ª «ì­ãî ¯¥à¥¬¥­­ãî
db 0
@@:
;32 - áâ ­¤ àâ­ë©  ¤à¥á ¯® ª®â®à®¬ã ¤®«¦¥­ ¡ëâì ¡ãä¥à á á¨á⥬­ë¬ ¯ã⥬
copy_path .path_str,[32],file_name,0x0
else
copy_path path,[32],file_name,0x0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
end if
stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
mov [buf],eax
mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
mov [run_file_70.Function], 0
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov [run_file_70.Count], dword size
m2m [run_file_70.Buffer], [buf]
mov byte[run_file_70+20], 0
mov [run_file_70.FileName], file_name
mov ebx,run_file_70
int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
cmp ebx,0xffffffff
je @f
;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data
stdcall dword[img_decode], dword[buf],ebx,0
mov dword[image_data],eax
;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥­¨¥ ª ä®à¬ âã rgb
stdcall dword[img_to_rgb2], dword[image_data],dword[buf]
;㤠«ï¥¬ ¢à¥¬¥­­ë© ¡ãä¥à image_data
stdcall dword[img_destroy], dword[image_data]
@@:
}
;--------------------------------------
sizeof.block_3ds equ 9
macro block_3ds id,icon,par,caption
{
dw id ;+0 ¨¤¥­â¨ä¨ª â®à ¡«®ª  ¢ ä ©«¥ 3ds
dw icon ;+2 ­®¬¥à ¨ª®­ª¨ ¤«ï ¡«®ª 
db par ;+4 ᮤ¥à¦¨â «¨ ¡«®ª ¯®¤¡«®ª¨ (0-¤  1-­¥â)
dd caption+0 ;+5 ®¯¨á ­¨¥ ¡«®ª 
}
CHUNK_MAIN equ 0x4D4D ; [-] á業 
CHUNK_color_1 equ 0x0011 ; [+] 梥â rgb (byte format)
CHUNK_ambient_color equ 0x2100 ; [-] ambient color
CHUNK_OBJMESH equ 0x3D3D ; [-] ¢áïç¥áª¨¥ ®¡ê¥ªâë
CHUNK_OBJBLOCK equ 0x4000 ; [+] ®¡ê¥ªâ
CHUNK_TRIMESH equ 0x4100 ; [-] trimesh-®¡ê¥ªâ
CHUNK_VERTLIST equ 0x4110 ; [+] ᯨ᮪ ¢¥à設
CHUNK_FACELIST equ 0x4120 ; [+] ᯨ᮪ £à ­¥©
CHUNK_FACEMAT equ 0x4130 ; [+] ¬ â¥à¨ «ë £à ­¥©
CHUNK_MAPLIST equ 0x4140 ; [+] ⥪áâãà­ë¥ ª®®à¤¨­ âë
CHUNK_TRMATRIX equ 0x4160 ; [+] ¬ âà¨æ  ¯¥à¥¢®¤ 
CHUNK_CAMERA equ 0x4700 ; [+] ®¡ê¥ªâ-ª ¬¥à 
CHUNK_MATERIAL equ 0xAFFF ; [-] ¬ â¥à¨ «
CHUNK_MATNAME equ 0xA000 ; [+] ­ §¢ ­¨¥ ¬ â¥à¨ « 
CHUNK_TEXTURE equ 0xA200 ; [-] ⥪áâãà  ¬ â¥à¨ « 
CHUNK_MAPFILE equ 0xA300 ; [+] ¨¬ï ä ©«  ⥪áâãàë
CHUNK_KEYFRAMER equ 0xB000 ; [-] ¨­ä®à¬ æ¨ï ®¡  ­¨¬ æ¨¨
CHUNK_TRACKINFO equ 0xB002 ; [-] ¯®¢¥¤¥­¨¥ ®¡ê¥ªâ 
CHUNK_TRACKOBJNAME equ 0xB010 ; [+] ­ §¢ ­¨¥ í⮣® ®¡ê¥ªâ 
CHUNK_TRACKPIVOT equ 0xB013 ; [+] 業âà ¢à é¥­¨ï ®¡ê¥ªâ 
CHUNK_TRACKPOS equ 0xB020 ; [+] âà ¥ªâ®à¨ï ®¡ê¥ªâ 
CHUNK_TRACKROTATE equ 0xB021 ; [+] âà ¥ªâ®à¨ï ¢à é¥­¨ï ®¡ê¥ªâ 
CHUNK_TRACKCAMERA equ 0xB003 ; [-] ¯®¢¥¤¥­¨¥ ª ¬¥àë
CHUNK_TRACKFOV equ 0xB023 ; [+] ¯®¢¥¤¥­¨¥ FOV ª ¬¥àë
CHUNK_TRACKROLL equ 0xB024 ; [+] ¯®¢¥¤¥­¨¥ roll ª ¬¥àë
CHUNK_TRACKCAMTGT equ 0xB004 ; [-] ¯®¢¥¤¥­¨¥ "楫¨" ª ¬¥àë
;¤ ­­ë¥ ᮤ¥à¦ â «¨èì ¡«®ª¨, ®â¬¥ç¥­­ë¥ ¯«îᮬ, ®áâ «ì­ë¥ ¡«®ª¨
; á®áâ®ïâ «¨èì ¨§ ¯®¤¡«®ª®¢
MAX_FILE_LEVEL equ 20 ;¬ ªá¨¬ «ì­ë© ã஢¥­ì ¢«®¦¥­­®á⨠¡«®ª®¢ ¤«ï  ­ «¨§ 
MAX_FILE_SIZE equ 150*0x400 ;¬ ªá¨¬ «ì­ë© à §¬¥à ä ©«  (50 Kb)
level_stack dd 0
offs_last_timer dd 0 ;¯®á«¥¤­¨© ᤢ¨£ ¯®ª § ­ë© ¢ ä㭪樨 â ©¬¥à 
ID_ICON_CHUNK_MAIN equ 0 ;¨ª®­ª  £« ¢­®£® ¡«®ª 
ID_ICON_CHUNK_NOT_FOUND equ 1 ;¨ª®­ª  ­¥ ¨§¢¥áâ­®£® ¡«®ª 
ID_ICON_DATA equ 2 ;¨ª®­ª  ¤«ï ¤ ­­ëå ¡«®ª , ­¥ ®¯à¥¤¥«¥­­®© áâàãªâãàë
FILE_ERROR_CHUNK_SIZE equ -3 ;®è¨¡ª  ¢ à §¬¥à¥ ¡«®ª 
align 4
type_bloks:
block_3ds 0x0002,5,1,txt_0002
block_3ds 0x3d3e,5,1 ;mesh version
block_3ds 0xA010,4,0 ;material ambient color
block_3ds 0xA020,4,0 ;material diffuse color
block_3ds 0xA030,4,0 ;material specular color
block_3ds CHUNK_color_1, 4,1 ; [+] 梥â rgb (byte format)
block_3ds CHUNK_ambient_color,3,0 ; [-] ambient color
block_3ds CHUNK_OBJMESH, 3,0 ; [-] ¢áïç¥áª¨¥ ®¡ê¥ªâë
block_3ds CHUNK_OBJBLOCK, 3,1,txt_4000
block_3ds CHUNK_TRIMESH, 3,0 ; [-] trimesh-®¡ê¥ªâ
block_3ds CHUNK_VERTLIST, 3,1,txt_4110
block_3ds CHUNK_FACELIST, 3,1,txt_4120
block_3ds CHUNK_FACEMAT, 3,1 ; [+] ¬ â¥à¨ «ë £à ­¥©
block_3ds CHUNK_MAPLIST, 3,1 ; [+] ⥪áâãà­ë¥ ª®®à¤¨­ âë
block_3ds CHUNK_TRMATRIX, 3,1 ; [+] ¬ âà¨æ  ¯¥à¥¢®¤ 
block_3ds CHUNK_CAMERA, 3,1 ; [+] ®¡ê¥ªâ-ª ¬¥à 
block_3ds 0x4600,3,1,txt_4600
block_3ds CHUNK_MATERIAL, 3,0,txt_afff
block_3ds CHUNK_MATNAME, 3,1,txt_a000
block_3ds CHUNK_TEXTURE, 3,0,txt_a200
block_3ds CHUNK_MAPFILE, 6,1,txt_a300
block_3ds CHUNK_KEYFRAMER, 3,0,txt_b000
block_3ds CHUNK_TRACKINFO, 3,0,txt_b002
block_3ds CHUNK_TRACKOBJNAME,3,1,txt_b010
block_3ds CHUNK_TRACKPIVOT, 3,1,txt_b013
block_3ds CHUNK_TRACKPOS, 3,1 ; [+] âà ¥ªâ®à¨ï ®¡ê¥ªâ 
block_3ds CHUNK_TRACKROTATE, 3,1 ; [+] âà ¥ªâ®à¨ï ¢à é¥­¨ï ®¡ê¥ªâ 
block_3ds CHUNK_TRACKCAMERA, 3,0 ; [-] ¯®¢¥¤¥­¨¥ ª ¬¥àë
block_3ds CHUNK_TRACKFOV, 3,1 ; [+] ¯®¢¥¤¥­¨¥ FOV ª ¬¥àë
block_3ds CHUNK_TRACKROLL, 3,1 ; [+] ¯®¢¥¤¥­¨¥ roll ª ¬¥àë
block_3ds CHUNK_TRACKCAMTGT, 3,0 ; [-] ¯®¢¥¤¥­¨¥ "楫¨" ª ¬¥àë
.end:
if lang eq ru
txt_0002 db '3ds ¢¥àá¨ï',0
txt_4000 db 'Ž¡ê¥ªâ (á ¨¬¥­¥¬)',0
txt_4110 db '‘¯¨á®ª ¢¥à設',0
txt_4120 db '‘¯¨á®ª £à ­¥©',0
txt_4600 db '‘¢¥â',0
txt_a000 db '<27> §¢ ­¨¥ ¬ â¥à¨ « ',0
txt_a200 db '’¥ªáâãà  ¬ â¥à¨ «  1',0
txt_a300 db 'ˆ¬ï ä ©«  ⥪áâãàë',0
txt_afff db 'Œ â¥à¨ «',0
txt_b000 db 'ˆ­ä®à¬ æ¨ï ®¡  ­¨¬ æ¨¨',0
txt_b002 db '<27>®¢¥¤¥­¨¥ ®¡ê¥ªâ ',0
txt_b010 db '<27> §¢ ­¨¥ ®¡ê¥ªâ ',0
txt_b013 db '–¥­âà ¢à é¥­¨ï ®¡ê¥ªâ ',0
else
txt_0002 db '3ds version',0
txt_4000 db 'Object (with name)',0
txt_4110 db 'Vertices list',0
txt_4120 db 'Faces description',0
txt_4600 db 'Light',0
txt_a000 db 'Material name',0
txt_a200 db 'Texture map 1',0
txt_a300 db 'Mapping filename',0
txt_afff db 'Meterial',0
txt_b000 db 'Keyframer',0
txt_b002 db 'Mesh information',0
txt_b010 db 'Object name',0
txt_b013 db 'Object pivot point',0
end if
align 4
file_3ds:
.offs: dd 0 ;+0 㪠§ â¥«ì ­  ­ ç «® ¡«®ª 
.size: dd 0 ;+4 à §¬¥à ¡«®ª  (¤«ï 1-£® ¯ à ¬¥âà  = à §¬¥à ä ©«  3ds)
rb 8*MAX_FILE_LEVEL
size_one_list equ 40
list_offs_text equ 12 ;ᤢ¨£ ­ ç «  ⥪áâ  ¢ «¨áâ¥
buffer rb size_one_list ;¡ãä¥à ¤«ï ¤®¡ ¢«¥­¨ï áâàãªâãà ¢ ᯨ᮪ tree1
if lang eq ru
txt_open_3ds db 'Žâªàëâ ä ©«:',0
txt_no_3ds db 'Žâªàëâë© ä ©« ­¥ ¢ ä®à¬ â¥ *.3ds',0
txt_3ds_big_file db '<27> §¬¥à ä ©«  ¡®«ìè¥ MAX_FILE_SIZE',0
txt_3ds_err_sizes db '‚®§¬®¦­® ä ©« ¯®¢à¥¦¤¥­',0
txt_3ds_offs:
db '‘¬¥é¥­¨¥: '
.dig: rb 8
db 0
else
txt_open_3ds db 'Open file:',0
txt_no_3ds db 'Žâªàëâë© ä ©« ­¥ ¢ ä®à¬ â¥ *.3ds',0
txt_3ds_big_file db '<27> §¬¥à ä ©«  ¡®«ìè¥ MAX_FILE_SIZE',0
txt_3ds_err_sizes db '‚®§¬®¦­® ä ©« ¯®¢à¥¦¤¥­',0
txt_3ds_offs:
db 'Offset: '
.dig: rb 8
db 0
end if
txt_3ds_symb db 0,0
;--------------------------------------
align 4
start:
load_libraries l_libs_start,l_libs_end
;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ­ è  «¨¡ 
mov ebp,lib_7
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
@@:
mcall 48,3,sc,sizeof.system_colors
mcall 40,0x27
stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
stdcall dword[tl_data_init], tree1
;á¨á⥬­ë¥ ¨ª®­ª¨ 16*16 ¤«ï tree_list
load_image_file 'tl_sys_16.png', icon_tl_sys,TREE_ICON_SYS16_BMP_SIZE
;¥á«¨ ¨§®¡à ¦¥­¨¥ ­¥ ®âªàë«®áì, â® ¢ icon_tl_sys ¡ã¤ãâ
;­¥ ¨­¨æ¨ «¨§¨à®¢ ­­ë¥ ¤ ­­ë¥, ­® ®è¨¡ª¨ ­¥ ¡ã¤¥â, â. ª. ¡ãä¥à ­ã¦­®£® à §¬¥à 
mov eax,dword[icon_tl_sys]
mov dword[tree1.data_img_sys],eax
load_image_file 'objects.png', icon_toolbar,TOOLBAR_ICON_BMP_SIZE
mov eax,dword[icon_toolbar]
mov dword[tree1.data_img],eax
stdcall [buf2d_create], buf_0 ;ᮧ¤ ­¨¥ ¡ãä¥à 
load_image_file 'font8x9.bmp', image_data_toolbar,IMAGE_FILE1_SIZE
stdcall [buf2d_create_f_img], buf_1,[image_data_toolbar] ;ᮧ¤ ¥¬ ¡ãä¥à
stdcall mem.Free,[image_data_toolbar] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
stdcall [buf2d_conv_24_to_8], buf_1,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç­®á⨠8 ¡¨â
stdcall [buf2d_convert_text_matrix], buf_1
load_image_file fn_toolbar, image_data_toolbar,IMAGE_TOOLBAR_SIZE
stdcall mem.Alloc,MAX_FILE_SIZE
mov dword[open_file_lif],eax
mcall 26,9
mov [last_time],eax
align 4
red_win:
call draw_window
align 4
still:
mcall 26,9
mov ebx,[last_time]
add ebx,10 ;§ ¤¥à¦ª 
cmp ebx,eax
jge @f
mov ebx,eax
@@:
sub ebx,eax
;cmp ebx,10 ;§ ¤¥à¦ª 
;ja timer_funct
;test ebx,ebx
;jz timer_funct
mcall 23
cmp eax,0
je timer_funct
cmp al,1
jz red_win
cmp al,2
jz key
cmp al,3
jz button
cmp al,6
jne @f
call mouse
@@:
jmp still
align 4
mouse:
stdcall [tl_mouse], dword tree1
ret
align 4
timer_funct:
pushad
if debug
mov eax,4
mov ebx,(5 shl 16)+8
mov ecx,0xff+0x80000000
mov edx,txt_0002
int 0x40
end if
mcall 26,9
mov [last_time],eax
;
stdcall [tl_node_get_data],tree1
pop ebx
cmp ebx,0
je @f
mov eax,dword[ebx] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ë¡à ­­®£® ¡«®ª  ®â­®á¨â¥«ì­® ­ ç «  ä ©« 
mov ecx,dword[ebx+4]
stdcall hex_in_str, txt_3ds_offs.dig, eax,8
add eax,dword[open_file_lif] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ ¯ ¬ïâ¨
cmp dword[offs_last_timer],eax
je @f
mov dword[offs_last_timer],eax
call buf_draw_beg
stdcall [buf2d_draw_text], buf_0, buf_1,txt_3ds_offs,5,35,0xb000
mov edx,dword[ebx+8]
cmp edx,0 ;ᬮâਬ ¥áâì «¨ ®¯¨á ­¨¥ ¡«®ª 
je .no_info
stdcall [buf2d_draw_text], buf_0, buf_1,edx,5,45,0xb000
.no_info:
add ecx,eax ;¯®«ãç ¥¬ à §¬¥à ¡«®ª 
stdcall buf_draw_hex_table,eax,ecx ;¤®¡ ¢«¥­¨¥ 16-à¨ç­ëå ¤ ­­ëå
stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
@@:
popad
jmp still
align 4
buf_draw_beg:
stdcall [buf2d_clear], buf_0, [buf_0.color] ;ç¨á⨬ ¡ãä¥à
stdcall [buf2d_draw_text], buf_0, buf_1,txt_open_3ds,5,5,0xff
stdcall [buf2d_draw_text], buf_0, buf_1,openfile_path,5,15,0xff
cmp dword[level_stack],FILE_ERROR_CHUNK_SIZE ;¢®§¬®¦­  ®è¨¡ª  ä ©« 
jne @f
stdcall [buf2d_draw_text], buf_0, buf_1,txt_3ds_err_sizes,5,25,0xff0000
@@:
ret
align 4
proc buf_draw_hex_table, offs:dword, size_line:dword
pushad
locals
coord_y dd 55 ;ª®®à¤¨­ â  y ¤«ï ­ ç «  ¢ë¢®¤  â ¡«¨æë
endl
mov esi,dword[offs]
mov edi,dword[open_file_lif]
add edi,dword[file_3ds.size] ;edi - 㪠§ â¥«ì ­  ª®­¥æ ä ©«  ¢ ¯ ¬ïâ¨
mov dword[txt_3ds_offs.dig],0
cld
.cycle_rows:
mov ebx,5 ;®âáâ㯠᫥¢  ¤«ï æ¨äà
mov edx,5+10*24 ;®âáâ㯠᫥¢  ¤«ï ⥪áâ 
mov ecx,10
@@:
stdcall hex_in_str, txt_3ds_offs.dig, dword[esi],2
stdcall [buf2d_draw_text], buf_0, buf_1,txt_3ds_offs.dig,ebx,[coord_y],0
mov al,byte[esi]
mov byte[txt_3ds_symb],al
stdcall [buf2d_draw_text], buf_0, buf_1,txt_3ds_symb,edx,[coord_y],0x808080
inc esi
cmp esi,dword[size_line]
jne .end_block
stdcall draw_block_end_line, dword[coord_y]
.end_block:
cmp esi,edi
jge @f ;jg ???
add ebx,24
add edx,9 ;è¨à¨­  1-£® ᨬ¢®«  +1pix
loop @b
add dword[coord_y],10 ;¢ëá®â  1-£® ᨬ¢®«  (¨«¨ ¨­â¥à¢ « ¬¥¦¤ã áâப ¬¨)
mov ebx,dword[buf_0.h]
cmp dword[coord_y],ebx
jl .cycle_rows
@@:
popad
ret
endp
align 4
proc draw_block_end_line, coord_y:dword
push eax ebx ecx
add ebx,20 ;20 = width 2.5 symbols
mov eax,[coord_y]
sub eax,2
mov ecx,eax
add ecx,10
stdcall [buf2d_line], buf_0, 0,ecx,ebx,ecx ,0xff
stdcall [buf2d_line], buf_0, ebx,ecx,ebx,eax ,0xff
stdcall [buf2d_line], buf_0, ebx,eax,5+10*24-4,eax ,0xff
pop ecx ebx eax
ret
endp
align 4
draw_window:
pushad
mcall 12,1
xor eax,eax
mov ebx,(20 shl 16)+560
mov ecx,(20 shl 16)+315
mov edx,[sc.work]
or edx,(3 shl 24)+0x10000000+0x20000000
mov edi,capt
int 0x40
mov eax,8
mov ebx,(5 shl 16)+20
mov ecx,(5 shl 16)+20
mov edx,3
mov esi,[sc.work_button]
int 0x40
mov ebx,(30 shl 16)+20
mov ecx,(5 shl 16)+20
mov edx,4
int 0x40
;mov ebx,(55 shl 16)+20
;mov ecx,(5 shl 16)+20
;mov edx,5
;int 0x40
mov eax,7
mov ebx,[image_data_toolbar]
mov ecx,(16 shl 16)+16
mov edx,(7 shl 16)+7 ;new
int 0x40
add ebx,IMAGE_TOOLBAR_ICON_SIZE
mov edx,(32 shl 16)+7 ;open
int 0x40
;add ebx,IMAGE_TOOLBAR_ICON_SIZE
;mov edx,(57 shl 16)+7 ;save
;int 0x40
mov dword[w_scr_t1.all_redraw],1
stdcall [tl_draw],dword tree1
stdcall [buf2d_draw], buf_0
mcall 12,2
popad
ret
align 4
key:
mcall 2
stdcall [tl_key], dword tree1
jmp still
align 4
button:
mcall 17
cmp ah,3
jne @f
call but_new_file
@@:
cmp ah,4
jne @f
call but_open_file
@@:
cmp ah,5
jne @f
call but_save_file
@@:
cmp ah,1
jne still
.exit:
mov dword[tree1.data_img],0
mov dword[tree1.data_img_sys],0
stdcall dword[tl_data_clear], tree1
stdcall [buf2d_delete],buf_0
stdcall [buf2d_delete],buf_1 ;㤠«ï¥¬ ¡ãä¥à
stdcall mem.Free,[image_data_toolbar]
stdcall mem.Free,[open_file_lif]
mcall -1
align 4
but_new_file:
stdcall [tl_info_clear], tree1 ;®ç¨á⪠ ᯨ᪠ ®¡ê¥ªâ®¢
stdcall [buf2d_clear], buf_0, [buf_0.color] ;ç¨á⨬ ¡ãä¥à
;;;call draw_window
stdcall [tl_draw], tree1
stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
ret
align 4
but_open_file:
pushad
copy_path open_dialog_name,communication_area_default_path,file_name,0
mov [OpenDialog_data.type],0
stdcall [OpenDialog_Start],OpenDialog_data
cmp [OpenDialog_data.status],2
je .end_open_file
;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
mov [run_file_70.Function], 0
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov dword[run_file_70.Count], MAX_FILE_SIZE
m2m [run_file_70.Buffer], dword[open_file_lif]
mov byte[run_file_70+20], 0
mov dword[run_file_70.FileName], openfile_path
mov ebx,run_file_70
int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
cmp ebx,0xffffffff
je .end_open_file
;add ebx,[open_file_lif]
;mov byte[ebx],0 ;­  á«ãç © ¥á«¨ à ­¥¥ ¡ë« ®âªàëâ ä ©« ¡®«ì襣® à §¬¥à  ç¨á⨬ ª®­¥æ ¡ãä¥à  á ä ©«®¬
;mcall 71,1,openfile_path
stdcall [tl_info_clear], tree1 ;®ç¨á⪠ ᯨ᪠ ®¡ê¥ªâ®¢
mov esi,dword[open_file_lif]
cmp word[esi],CHUNK_MAIN
je @f
call buf_draw_beg
stdcall [buf2d_draw_text], buf_0, buf_1,txt_no_3ds,5,25,0xff0000 ;à¨á㥬 áâபã á ⥪á⮬
jmp .end_open
@@:
cmp dword[esi+2],MAX_FILE_SIZE
jle @f
call buf_draw_beg
stdcall [buf2d_draw_text], buf_0, buf_1,txt_3ds_big_file,5,25,0xff0000 ;à¨á㥬 áâபã á ⥪á⮬
jmp .end_open
@@:
;--- ®¡à ¡®âª  ®âªàë⮣® *.3ds ä ©« 
mov eax,file_3ds
mov dword[level_stack],0 ;®¡­ã«ï¥¬ ã஢¥­ì á⥪ 
mov dword[offs_last_timer],0
;--- ¤®¡ ¢«¥­¨¥ £« ¢­®£® ¡«®ª  ¢ ᯨ᮪
stdcall add_3ds_object, ID_ICON_CHUNK_MAIN,0,dword[esi+2],0
call block_children ;¢å®¤ ¢ ¤®ç¥à­¨© ¡«®ª
mov edi,dword[file_3ds.offs]
add edi,dword[file_3ds.size]
.cycle_main:
cmp dword[level_stack],0
jle .end_cycle
cmp esi,edi ;¥á«¨ ª®­¥æ ä ©« 
jge .end_cycle
mov edx,dword[esi+2] ;à §¬¥à ¡«®ª 
call block_analiz
cmp dword[bl_found],0
jne @f
;®¡ê¥ªâ ­¥ ¨§¢¥áâ­®£® ¢¨¤ 
stdcall add_3ds_object, ID_ICON_CHUNK_NOT_FOUND,dword[level_stack],edx,0
call block_next
jmp .cycle_main
@@:
;®¡ê¥ªâ ¨§¢¥áâ­®£® ¢¨¤ 
mov ecx,dword[bl_found]
mov bx,word[ecx+2] ;­®¬¥à ¨ª®­ª¨ ¤«ï ®¡ê¥ªâ 
stdcall add_3ds_object, ebx,dword[level_stack],edx,dword[ecx+5]
cmp byte[ecx+4],1
je .bl_data
;¡«®ª ᮤ¥à¦¨â ¤®ç¥à­¨¥ ¡«®ª¨
call block_children ;¢å®¤ ¢ ¤®ç¥à­¨© ¡«®ª
jmp .cycle_main
.bl_data:
;¡«®ª ᮤ¥à¦¨â ¤ ­­ë¥
call block_analiz_data
jmp .cycle_main
.end_cycle:
stdcall [tl_cur_beg], tree1
stdcall [tl_draw], tree1
.end_open:
stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
.end_open_file:
popad
ret
; ­ «¨§ ¤ ­­ëå ¡«®ª 
;input:
; esi - memory pointer
;output:
; eax - new stack pointer
; esi - new memory pointer
align 4
block_analiz_data:
push ebx ecx edx edi
mov dx,word[esi]
mov ecx,dword[esi+2]
sub ecx,6 ;à §¬¥à ¤ ­­ëå ¢ ¡«®ª¥
add esi,6
mov ebx,dword[level_stack]
inc ebx
; ***  ­ «¨§ ¡«®ª®¢ á à §­ë¬¨ ¤ ­­ë¬¨ ¨ ¢ë¤¥«¥­¨¥¬ ¯®¤¡«®ª®¢
cmp dx,CHUNK_OBJBLOCK ;®¡ê¥ªâ
jne @f
.cycle_0:
push ax
cld
xor al,al
mov edi,esi
repne scasb
pop ax
sub edi,esi ;edi - strlen
stdcall add_3ds_object, ID_ICON_DATA,ebx,edi,0 ;­ §¢ ­¨¥ ®¡ê¥ªâ 
add esi,edi
sub ecx,edi
jmp .next_bl
@@:
; ***  ­ «¨§ ¡«®ª  á ¤ ­­ë¬¨ ¯® 㬮«ç ­¨î (¡¥§ ¢ë¤¥«¥­¨ï ¯®¤¡«®ª®¢)
stdcall add_3ds_object, ID_ICON_DATA,ebx,ecx,0
sub esi,6 ;¢®ááâ ­®¢«¥­¨¥ esi
call block_next
jmp .end_f
.next_bl:
; *** ­ áâனª¨ ¤«ï  ­ «¨§  ®áâ ¢è¨åáï ¯®¤¡«®ª®¢
mov dword[eax],esi ;㪠§ â¥«ì ­  ­ ç «® ¡«®ª 
mov ebx,dword[esi+2]
mov dword[eax+4],ebx ;à §¬¥à ¡«®ª 
inc dword[level_stack]
add eax,8
.end_f:
pop edi edx ecx ebx
ret
;¢å®¤ ¢ 1-© ¤®ç¥à­¨© ¡«®ª
;output:
; edx - destroy
align 4
block_children:
push ecx
;¯à®¢¥àª  ¯à ¢¨«ì­®á⨠ࠧ¬¥à®¢ ¤®ç¥à­¥£® ¡«®ª 
mov ebx,esi ;ᬥ饭¨¥ ­ ç «  த¨â¥«ì᪮£® ¡«®ª 
add ebx,6 ;¯¥à¥å®¤ ­  ­ ç «® ¤®ç¥à­¥£® ¡«®ª 
add ebx,dword[ebx+2] ;¤®¡ ¢«ï¥¬ à §¬¥à ¤®ç¥à­¥£® ¡«®ª 
mov ecx,esi ;ᬥ饭¨¥ ­ ç «  த¨â¥«ì᪮£® ¡«®ª 
add ecx,dword[esi+2] ;¤®¡ ¢«ï¥¬ à §¬¥à த¨â¥«ì᪮£® ¡«®ª 
cmp ebx,ecx ;ãç¨â뢠âì § £®«®¢ª¨ ­¥ ­ã¦­®, â. ª. áà ¢­¨¢ îâáï ⮫쪮 ¤ ­­ë¥ ¡«®ª®¢
jle @f
;¤¨ £­®áâ¨à®¢ «¨ ®è¨¡ªã ä ©« , ¤®ç¥à­¨© ¡«®ª ¢ë室¨â §  ¯à¥¤¥«ë த¨â¥«ì᪮£®
mov dword[level_stack],FILE_ERROR_CHUNK_SIZE
jmp .end_f
@@:
mov dword[eax],esi ;㪠§ â¥«ì ­  ­ ç «® ¡«®ª 
mov ebx,dword[esi+2]
mov dword[eax+4],ebx ;à §¬¥à ¡«®ª 
add esi,6 ;¯¥à¥å®¤¨¬ ª ¤ ­­ë¬ ¡«®ª 
inc dword[level_stack]
add eax,8
.end_f:
pop ecx
ret
;¯¥à¥å®¤ ª á«¥¤ã饬㠡«®ªã ⥪ã饣® ã஢­ï
align 4
block_next:
push ebx
add esi,dword[esi+2] ;¯à®¯ã᪠¥¬ ¤ ­­ë¥ ¡«®ª 
;¯à®¢¥àª  à §¬¥à®¢ த¨â¥«ì᪮£® ¡«®ª , ¤«ï ¢®§¬®¦­®£® ¢ë室  ­  ¢¥àå­¨© ã஢¥­ì ¥á«¨ ª®­¥æ ¡«®ª 
@@:
mov ebx,dword[eax-8]
add ebx,dword[eax-4]
cmp esi,ebx
jl @f
dec dword[level_stack]
sub eax,8
cmp dword[level_stack],0
jg @b
@@:
pop ebx
ret
;äã­ªæ¨ï ¯®¨áª  áâàãªâãàë ®¯¨á뢠î饩 ¡«®ª
;input:
;esi - memory pointer
;output:
;dword[bl_found] - pointer to chunk struct (= 0 if not found)
align 4
bl_found dd 0
block_analiz:
pushad
mov dword[bl_found],0
mov ecx,type_bloks
@@:
mov bx,word[ecx]
cmp word[esi],bx
je .found
add ecx,sizeof.block_3ds
cmp ecx,type_bloks.end
jl @b
jmp .no_found
.found:
mov dword[bl_found],ecx
.no_found:
popad
ret
;input:
; esi - 㪠§ â¥«ì ­   ­ «¨§¨àã¥¬ë¥ ¤ ­­ë¥
align 4
proc add_3ds_object, icon:dword,level:dword,size_bl:dword,info_bl:dword
pushad
mov bx,word[icon]
shl ebx,16
mov bx,word[level]
mov eax,esi
sub eax,dword[open_file_lif]
mov dword[buffer],eax ;ᬥ饭¨¥ ¡«®ª 
mov ecx,dword[size_bl]
mov dword[buffer+4],ecx ;à §¬¥à ¡«®ª  (¨á¯®«ì§ã¥âáï ¢ ä㭪樨 buf_draw_hex_table ¤«ï à¨á®¢ ­¨ï «¨­¨¨)
mov ecx,dword[info_bl]
mov dword[buffer+8],ecx
stdcall hex_in_str, buffer+list_offs_text,dword[esi+1],2
stdcall hex_in_str, buffer+list_offs_text+2,dword[esi],2 ;ª®¤ 3ds ¡«®ª 
cmp ecx,0
jne @f
mov byte[buffer+list_offs_text+4],0 ;0 - ᨬ¢®« ª®­¥æ  áâப¨
jmp .no_capt
@@:
mov byte[buffer+list_offs_text+4],' '
mov esi,ecx
mov edi,buffer+list_offs_text+5
mov ecx,size_one_list-(list_offs_text+5)
cld
rep movsb
mov byte[buffer+size_one_list-1],0 ;0 - ᨬ¢®« ª®­¥æ  áâப¨
.no_capt:
stdcall [tl_node_add], buffer, ebx, tree1
stdcall [tl_cur_next], tree1
if debug
stdcall print_err,sz_add_3ds_object,buffer+list_offs_text
end if
popad
ret
endp
if debug
sz_add_3ds_object db 13,10,'3ds_object',0
align 4
proc print_err, fun:dword, mes:dword ;¢ë¢®¤¨¬ á®®¡é¥­¨¥ ®¡ 訡ª¥ ­  ¤®áªã ®â« ¤ª¨
pushad
mov eax,63
mov ebx,1
mov esi,[fun]
@@:
mov cl,byte[esi]
int 0x40
inc esi
cmp byte[esi],0
jne @b
mov cl,':'
int 0x40
mov cl,' '
int 0x40
mov esi,[mes]
@@:
mov cl,byte[esi]
int 0x40
inc esi
cmp byte[esi],0
jne @b
popad
ret
endp
end if
align 4
proc hex_in_str, buf:dword,val:dword,zif:dword
pushad
mov edi,dword[buf]
mov ecx,dword[zif]
add edi,ecx
dec edi
mov ebx,dword[val]
.cycle:
mov al,bl
and al,0xf
cmp al,10
jl @f
add al,'a'-'0'-10
@@:
add al,'0'
mov byte[edi],al
dec edi
shr ebx,4
loop .cycle
popad
ret
endp
align 4
but_save_file:
if debug
stdcall buf_draw_hex_table,dword[open_file_lif],3 ;¤®¡ ¢«¥­¨¥ 16-à¨ç­ëå ¤ ­­ëå
end if
ret
;input:
; buf - 㪠§ â¥«ì ­  áâபã, ç¨á«® ¤®«¦­® ¡ëâì ¢ 10 ¨«¨ 16 à¨ç­®¬ ¢¨¤¥
;output:
; eax - ç¨á«®
align 4
proc conv_str_to_int, buf:dword
xor eax,eax
push ebx ecx esi
xor ebx,ebx
mov esi,[buf]
;®¯à¥¤¥«¥­¨¥ ®âà¨æ â¥«ì­ëå ç¨á¥«
xor ecx,ecx
inc ecx
cmp byte[esi],'-'
jne @f
dec ecx
inc esi
@@:
cmp word[esi],'0x'
je .load_digit_16
.load_digit_10: ;áç¨â뢠­¨¥ 10-â¨ç­ëå æ¨äà
mov bl,byte[esi]
cmp bl,'0'
jl @f
cmp bl,'9'
jg @f
sub bl,'0'
imul eax,10
add eax,ebx
inc esi
jmp .load_digit_10
jmp @f
.load_digit_16: ;áç¨â뢠­¨¥ 16-à¨ç­ëå æ¨äà
add esi,2
.cycle_16:
mov bl,byte[esi]
cmp bl,'0'
jl @f
cmp bl,'f'
jg @f
cmp bl,'9'
jle .us1
cmp bl,'A'
jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'9' ¨ <'A'
.us1: ;á®áâ ¢­®¥ ãá«®¢¨¥
cmp bl,'F'
jle .us2
cmp bl,'a'
jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'F' ¨ <'a'
sub bl,32 ;¯¥à¥¢®¤¨¬ ᨬ¢®«ë ¢ ¢¥àå­¨© ॣ¨áâà, ¤«ï ã¯à®é¥­¨ï ¨å ¯®á«¥¤ã饩 ®¡à ¡®âª¨
.us2: ;á®áâ ¢­®¥ ãá«®¢¨¥
sub bl,'0'
cmp bl,9
jle .cor1
sub bl,7 ;convert 'A' to '10'
.cor1:
shl eax,4
add eax,ebx
inc esi
jmp .cycle_16
@@:
cmp ecx,0 ;¥á«¨ ç¨á«® ®âà¨æ â¥«ì­®¥
jne @f
sub ecx,eax
mov eax,ecx
@@:
pop esi ecx ebx
ret
endp
;¤ ­­ë¥ ¤«ï ¤¨ «®£  ®âªàëâ¨ï ä ©«®¢
align 4
OpenDialog_data:
.type dd 0 ;0 - ®âªàëâì, 1 - á®åà ­¨âì, 2 - ¢ë¡à âì ¤â४â®à¨î
.procinfo dd procinfo ;+4
.com_area_name dd communication_area_name ;+8
.com_area dd 0 ;+12
.opendir_path dd plugin_path ;+16
.dir_default_path dd default_dir ;+20
.start_path dd file_name ;+24 ¯ãâì ª ¤¨ «®£ã ®âªàëâ¨ï ä ©«®¢
.draw_window dd draw_window ;+28
.status dd 0 ;+32
.openfile_path dd openfile_path ;+36 ¯ãâì ª ®âªà뢠¥¬®¬ã ä ©«ã
.filename_area dd filename_area ;+40
.filter_area dd Filter
.x:
.x_size dw 420 ;+48 ; Window X size
.x_start dw 10 ;+50 ; Window X position
.y:
.y_size dw 320 ;+52 ; Window y size
.y_start dw 10 ;+54 ; Window Y position
default_dir db '/rd/1',0
communication_area_name:
db 'FFFFFFFF_open_dialog',0
open_dialog_name:
db 'opendial',0
communication_area_default_path:
db '/rd/1/File managers/',0
Filter:
dd Filter.end - Filter.1
.1:
db '3DS',0
db 'TXT',0
.end:
db 0
head_f_i:
head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0
system_dir_0 db '/sys/lib/'
lib_name_0 db 'proc_lib.obj',0
err_message_found_lib_0 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,0
err_message_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,0
system_dir_1 db '/sys/lib/'
lib_name_1 db 'libimg.obj',0
err_message_found_lib_1 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,0
err_message_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,0
system_dir_2 db '/sys/lib/'
lib_name_2 db 'box_lib.obj',0
err_msg_found_lib_2 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'box_lib.obj',39,0
err_msg_import_2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'box_lib',39,0
system_dir_7 db '/sys/lib/'
lib_name_7 db 'buf2d.obj',0
err_msg_found_lib_7 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,0
err_msg_import_7 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,0
l_libs_start:
lib0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\
err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i
lib1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\
err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i
lib_2 l_libs lib_name_2, sys_path, library_path, system_dir_2,\
err_msg_found_lib_2,head_f_l,import_box_lib,err_msg_import_2,head_f_i
lib_7 l_libs lib_name_7, sys_path, library_path, system_dir_7,\
err_msg_found_lib_7,head_f_l,import_buf2d,err_msg_import_7,head_f_i
l_libs_end:
align 4
import_libimg:
dd alib_init1
img_is_img dd aimg_is_img
img_info dd aimg_info
img_from_file dd aimg_from_file
img_to_file dd aimg_to_file
img_from_rgb dd aimg_from_rgb
img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode
img_encode dd aimg_encode
img_create dd aimg_create
img_destroy dd aimg_destroy
img_destroy_layer dd aimg_destroy_layer
img_count dd aimg_count
img_lock_bits dd aimg_lock_bits
img_unlock_bits dd aimg_unlock_bits
img_flip dd aimg_flip
img_flip_layer dd aimg_flip_layer
img_rotate dd aimg_rotate
img_rotate_layer dd aimg_rotate_layer
img_draw dd aimg_draw
dd 0,0
alib_init1 db 'lib_init',0
aimg_is_img db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
aimg_info db 'img_info',0
aimg_from_file db 'img_from_file',0
aimg_to_file db 'img_to_file',0
aimg_from_rgb db 'img_from_rgb',0
aimg_to_rgb db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
aimg_encode db 'img_encode',0
aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0
aimg_destroy_layer db 'img_destroy_layer',0
aimg_count db 'img_count',0
aimg_lock_bits db 'img_lock_bits',0
aimg_unlock_bits db 'img_unlock_bits',0
aimg_flip db 'img_flip',0
aimg_flip_layer db 'img_flip_layer',0
aimg_rotate db 'img_rotate',0
aimg_rotate_layer db 'img_rotate_layer',0
aimg_draw db 'img_draw',0
align 4
proclib_import: ;®¯¨á ­¨¥ íªá¯®àâ¨à㥬ëå ä㭪権
OpenDialog_Init dd aOpenDialog_Init
OpenDialog_Start dd aOpenDialog_Start
dd 0,0
aOpenDialog_Init db 'OpenDialog_init',0
aOpenDialog_Start db 'OpenDialog_start',0
; file.find_first db 'file_find_first',0
; file.find_next db 'file_find_next',0
; file.find_close db 'file_find_close',0
; file.size db 'file_size',0
; file.open db 'file_open',0
; file.read db 'file_read',0
; file.write db 'file_write',0
; file.seek db 'file_seek',0
; file.tell db 'file_tell',0
; file.eof? db 'file_iseof',0
; file.truncate db 'file_truncate',0
; file.close db 'file_close',0
align 4
import_buf2d:
dd sz_init0
buf2d_create dd sz_buf2d_create
buf2d_create_f_img dd sz_buf2d_create_f_img
buf2d_clear dd sz_buf2d_clear
buf2d_draw dd sz_buf2d_draw
buf2d_delete dd sz_buf2d_delete
buf2d_line dd sz_buf2d_line
buf2d_rect_by_size dd sz_buf2d_rect_by_size
buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
buf2d_circle dd sz_buf2d_circle
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
buf2d_bit_blt dd sz_buf2d_bit_blt
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
buf2d_curve_bezier dd sz_buf2d_curve_bezier
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
buf2d_draw_text dd sz_buf2d_draw_text
buf2d_crop_color dd sz_buf2d_crop_color
buf2d_offset_h dd sz_buf2d_offset_h
buf2d_flood_fill dd sz_buf2d_flood_fill
buf2d_set_pixel dd sz_buf2d_set_pixel
dd 0,0
sz_init0 db 'lib_init',0
sz_buf2d_create db 'buf2d_create',0
sz_buf2d_create_f_img db 'buf2d_create_f_img',0
sz_buf2d_clear db 'buf2d_clear',0
sz_buf2d_draw db 'buf2d_draw',0
sz_buf2d_delete db 'buf2d_delete',0
sz_buf2d_line db 'buf2d_line',0
sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
sz_buf2d_circle db 'buf2d_circle',0
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
sz_buf2d_draw_text db 'buf2d_draw_text',0
sz_buf2d_crop_color db 'buf2d_crop_color',0
sz_buf2d_offset_h db 'buf2d_offset_h',0
sz_buf2d_flood_fill db 'buf2d_flood_fill',0
sz_buf2d_set_pixel db 'buf2d_set_pixel',0
align 4
import_box_lib:
dd sz_init1
init_checkbox dd sz_init_checkbox
check_box_draw dd sz_check_box_draw
edit_box_draw dd sz_edit_box_draw
edit_box_key dd sz_edit_box_key
edit_box_mouse dd sz_edit_box_mouse
edit_box_set_text dd sz_edit_box_set_text
scrollbar_ver_draw dd sz_scrollbar_ver_draw
scrollbar_hor_draw dd sz_scrollbar_hor_draw
tl_data_init dd sz_tl_data_init
tl_data_clear dd sz_tl_data_clear
tl_info_clear dd sz_tl_info_clear
tl_key dd sz_tl_key
tl_mouse dd sz_tl_mouse
tl_draw dd sz_tl_draw
tl_info_undo dd sz_tl_info_undo
tl_info_redo dd sz_tl_info_redo
tl_node_add dd sz_tl_node_add
tl_node_set_data dd sz_tl_node_set_data
tl_node_get_data dd sz_tl_node_get_data
tl_node_delete dd sz_tl_node_delete
tl_node_move_up dd sz_tl_node_move_up
tl_node_move_down dd sz_tl_node_move_down
tl_cur_beg dd sz_tl_cur_beg
tl_cur_next dd sz_tl_cur_next
tl_cur_perv dd sz_tl_cur_perv
tl_node_close_open dd sz_tl_node_close_open
tl_node_lev_inc dd sz_tl_node_lev_inc
tl_node_lev_dec dd sz_tl_node_lev_dec
tl_node_poi_get_info dd sz_tl_node_poi_get_info
tl_node_poi_get_next_info dd sz_tl_node_poi_get_next_info
tl_node_poi_get_data dd sz_tl_node_poi_get_data
dd 0,0
sz_init1 db 'lib_init',0
sz_init_checkbox db 'init_checkbox2',0
sz_check_box_draw db 'check_box_draw2',0
sz_edit_box_draw db 'edit_box',0
sz_edit_box_key db 'edit_box_key',0
sz_edit_box_mouse db 'edit_box_mouse',0
sz_edit_box_set_text db 'edit_box_set_text',0
sz_scrollbar_ver_draw db 'scrollbar_v_draw',0
sz_scrollbar_hor_draw db 'scrollbar_h_draw',0
sz_tl_data_init db 'tl_data_init',0
sz_tl_data_clear db 'tl_data_clear',0
sz_tl_info_clear db 'tl_info_clear',0
sz_tl_key db 'tl_key',0
sz_tl_mouse db 'tl_mouse',0
sz_tl_draw db 'tl_draw',0
sz_tl_info_undo db 'tl_info_undo',0
sz_tl_info_redo db 'tl_info_redo',0
sz_tl_node_add db 'tl_node_add',0
sz_tl_node_set_data db 'tl_node_set_data',0
sz_tl_node_get_data db 'tl_node_get_data',0
sz_tl_node_delete db 'tl_node_delete',0
sz_tl_node_move_up db 'tl_node_move_up',0
sz_tl_node_move_down db 'tl_node_move_down',0
sz_tl_cur_beg db 'tl_cur_beg',0
sz_tl_cur_next db 'tl_cur_next',0
sz_tl_cur_perv db 'tl_cur_perv',0
sz_tl_node_close_open db 'tl_node_close_open',0
sz_tl_node_lev_inc db 'tl_node_lev_inc',0
sz_tl_node_lev_dec db 'tl_node_lev_dec',0
sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0
sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0
sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0
mouse_dd dd 0x0
sc system_colors
last_time dd 0
align 16
procinfo process_information
align 4
buf_0: dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
dw 205 ;+4 left
dw 35 ;+6 top
.w: dd 340 ;+8 w
.h: dd 250 ;+12 h
.color: dd 0xffffd0 ;+16 color
db 24 ;+20 bit in pixel
align 4
buf_1:
dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
dw 25 ;+4 left
dw 25 ;+6 top
dd 128 ;+8 w
dd 144 ;+12 h
dd 0 ;+16 color
db 24 ;+20 bit in pixel
el_focus dd tree1
tree1 tree_list size_one_list,200+2, tl_key_no_edit+tl_draw_par_line,\
16,16, 0xffffff,0xb0d0ff,0xd000ff, 5,35,195-16,250, 16,list_offs_text,0, el_focus,\
w_scr_t1,0
align 4
w_scr_t1:
.size_x dw 16 ;+0
rb 2+2+2
.btn_high dd 15 ;+8
.type dd 1 ;+12
.max_area dd 100 ;+16
rb 4+4
.bckg_col dd 0xeeeeee ;+28
.frnt_col dd 0xbbddff ;+32
.line_col dd 0 ;+36
rb 4+2+2
.run_x:
rb 2+2+2+2+4+4+4+4+4+4
.all_redraw dd 0 ;+80
.ar_offset dd 1 ;+84
;íâ®â ª®¤ ­¥ ¬®©, ®­ ¯à¥®¡à §ã¥â ç¨á«® ¢ áâபã
;input:
; eax = value
; edi = string buffer
;output:
align 4
tl_convert_to_str:
pushad
mov dword[edi+1],0;0x20202020
call .str
popad
ret
align 4
.str:
mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢§®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®©
cmp eax,ecx ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
jb @f
xor edx,edx ;®ç¨áâ¨âì edx
div ecx ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
push edx ;¯®«®¦¨âì ¢ á⥪
;dec edi ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
call .str ;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
pop eax
@@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
or al,0x30 ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥ 祬 ¤¢¥ ¢ëè¥
stosb ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
ret ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
i_end:
rb 1024
stacktop:
sys_path rb 1024
file_name:
rb 1024 ;4096
library_path rb 1024
plugin_path rb 4096
openfile_path rb 4096
filename_area rb 256
mem: