update utilites

git-svn-id: svn://kolibrios.org@6259 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2016-02-19 21:36:34 +00:00
parent 82e80c20d2
commit d8b6a26cf1
4 changed files with 90 additions and 274 deletions

Binary file not shown.

View File

@ -6,8 +6,7 @@ use32
include '../../../../programs/macros.inc'
include '../../../../programs/proc32.inc'
include '../../../../programs/KOSfuncs.inc'
include '../../../../programs/develop/libraries/box_lib/load_lib.mac'
include '../../../../programs/dll.inc'
include '../../../../programs/load_img.inc'
include '../trunk/str.inc'
vox_offs_tree_table equ 4
@ -16,17 +15,7 @@ txt_buf rb 8
include '../trunk/vox_rotate.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
caption db 'Voxel creator 08.02.16',0 ;¯®¤¯¨áì ®ª­ 
struct FileInfoBlock
Function dd ?
Position dd ?
Flags dd ?
Count dd ?
Buffer dd ?
db ?
FileName dd ?
ends
caption db 'Voxel creator 19.02.16',0 ;¯®¤¯¨áì ®ª­ 
BUF_STRUCT_SIZE equ 21
buf2d_data equ dword[edi] ;¤ ­­ë¥ ¡ãä¥à  ¨§®¡à ¦¥­¨ï
@ -42,7 +31,6 @@ vox_offs_tree_table equ 4
vox_offs_data equ 12
run_file_70 FileInfoBlock
image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
vox_obj_size dd 0 ;à §¬¥à ¢®ªá¥«ì­®£® ®¡ê¥ªâ  (¤«ï ã᪮७¨ï ¢áâ ¢ª¨)
txt_space db ' ',0
txt_pref db ' ¡ ',0,' Š¡',0,' Œ¡',0,' ƒ¡',0 ;¯à¨áâ ¢ª¨: ª¨«®, ¬¥£ , £¨£ 
@ -51,50 +39,10 @@ txt_f_size: db '
fn_toolbar db 'toolbar.png',0
IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*9
image_data_toolbar dd 0
max_open_file_size equ 1024*1024 ;1 Mb
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,0
else
copy_path path,[32],file_name,0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
end if
stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
mov [buf],eax
mov [run_file_70.Function], SSF_READ_FILE
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov [run_file_70.Count], dword size
mov [run_file_70.Buffer], eax
mov byte[run_file_70+20], 0
mov [run_file_70.FileName], file_name
mcall SF_FILE,run_file_70 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
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]
@@:
}
align 4
start:
load_libraries l_libs_start,l_libs_end
@ -112,7 +60,7 @@ start:
stdcall [buf2d_create], buf_0z
stdcall [buf2d_vox_brush_create], buf_vox, vox_6_7_z
load_image_file fn_toolbar, image_data_toolbar,IMAGE_TOOLBAR_SIZE
load_image_file fn_toolbar, image_data_toolbar
stdcall mem.Alloc,max_open_file_size
mov dword[open_file_vox],eax
@ -603,16 +551,14 @@ but_open_file:
je .end_open_file
;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
mov [run_file_70.Function], 0
mov [run_file_70.Function], SSF_READ_FILE
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov [run_file_70.Count], dword max_open_file_size
m2m [run_file_70.Buffer],dword[open_file_vox]
mov byte[run_file_70+20], 0
mov dword[run_file_70.FileName], openfile_path
mov ebx,run_file_70
int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
mcall SF_FILE,run_file_70
cmp ebx,0xffffffff
je .end_open_file
; ¯à®¢¥àª  ­  ¯à ¢¨«ì­®áâì ¢®ªá¥«ì­®£® ä®à¬ â 
@ -658,16 +604,14 @@ but_save_file:
stdcall buf2d_vox_obj_get_size, ebx
mov dword[run_file_70.Count], eax ;à §¬¥à ä ©« 
mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
mov [run_file_70.Function], 2
mov [run_file_70.Function], SSF_CREATE_FILE
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov ebx, dword[open_file_vox]
mov [run_file_70.Buffer], ebx
mov byte[run_file_70+20], 0
mov dword[run_file_70.FileName], openfile_path
mov ebx,run_file_70
int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
mcall SF_FILE,run_file_70
cmp ebx,0xffffffff
je .end_save_file
@ -1162,39 +1106,35 @@ proc open_image_in_buf, buf:dword
;stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
;mov [buf],eax
mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
mov [run_file_70.Function], 0
mov [run_file_70.Function], SSF_READ_FILE
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov [run_file_70.Count], dword max_open_file_size
m2m [run_file_70.Buffer],dword[open_file_img]
mov byte[run_file_70+20], 0
mov [run_file_70.FileName], openfile_path
mov ebx,run_file_70
int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
mcall SF_FILE,run_file_70
cmp ebx,0xffffffff
je .end_0
;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data
;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï
stdcall dword[img_decode], dword[open_file_img],ebx,0
cmp eax,0
je .end_0 ;¥á«¨ ­ àã襭 ä®à¬ â ä ©« 
mov dword[image_data],eax
or eax,eax
jz .end_0 ;¥á«¨ ­ àã襭 ä®à¬ â ä ©« 
mov ebx,eax
;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥­¨¥ ª ä®à¬ âã rgb
stdcall dword[img_to_rgb2], dword[image_data],dword[open_file_img]
stdcall dword[img_to_rgb2], ebx,dword[open_file_img]
mov eax,dword[image_data]
mov edi,[buf]
cmp buf2d_data,0
jne @f
m2m buf2d_w,dword[eax+4] ;+4 = image width
m2m buf2d_h,dword[eax+8] ;+8 = image heihht
m2m buf2d_w,dword[ebx+4] ;+4 = image width
m2m buf2d_h,dword[ebx+8] ;+8 = image heihht
stdcall [buf2d_create_f_img], edi,[open_file_img]
jmp .end_1
@@:
mov ebx,dword[eax+4]
mov ecx,dword[eax+8]
stdcall [buf2d_resize], edi, ebx,ecx,1 ;¨§¬¥­ï¥¬ à §¬¥àë ¡ãä¥à 
imul ecx,ebx
mov ecx,dword[ebx+8]
stdcall [buf2d_resize], edi, [ebx+4],ecx,1 ;¨§¬¥­ï¥¬ à §¬¥àë ¡ãä¥à 
imul ecx,[ebx+4]
lea ecx,[ecx+ecx*2]
mov edi,buf2d_data
mov esi,[open_file_img]
@ -1202,8 +1142,8 @@ proc open_image_in_buf, buf:dword
rep movsb ;copy image
.end_1:
;㤠«ï¥¬ ¢à¥¬¥­­ë© ¡ãä¥à image_data
stdcall dword[img_destroy], dword[image_data]
;㤠«ï¥¬ ¢à¥¬¥­­ë© ¡ãä¥à ¢ ebx
stdcall dword[img_destroy], ebx
.end_0:
call draw_buffers
@ -1461,12 +1401,12 @@ import_buf2d:
align 4
import_msgbox_lib:
mb_create dd amb_create
; mb_reinit dd amb_reinit
; mb_setfunctions dd amb_setfunctions
; mb_reinit dd amb_reinit
; mb_setfunctions dd amb_setfunctions
dd 0,0
amb_create db 'mb_create',0
; amb_reinit db 'mb_reinit',0
; amb_setfunctions db 'mb_setfunctions',0
; amb_reinit db 'mb_reinit',0
; amb_setfunctions db 'mb_setfunctions',0
mouse_dd dd 0x0
sc system_colors

View File

@ -1,40 +1,22 @@
use32
org 0x0
db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
dd 0x1
dd start
dd i_end ;à §¬¥à ¯à¨«®¦¥­¨ï
dd mem
dd stacktop
dd 0
dd sys_path
dd 1, start, i_end, mem, stacktop, 0, sys_path
include '../../../../programs/macros.inc'
include '../../../../programs/proc32.inc'
include '../../../../programs/develop/libraries/box_lib/load_lib.mac'
include '../../../../programs/dll.inc'
include '../../../../programs/KOSfuncs.inc'
include '../../../../programs/load_img.inc'
include '../trunk/vox_draw.inc'
include '../trunk/vox_rotate.inc'
include '../trunk/str.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
caption db 'Voxel mover 29.01.15',0 ;¯®¤¯¨áì ®ª­ 
struct FileInfoBlock
Function dd ?
Position dd ?
Flags dd ?
Count dd ?
Buffer dd ?
db ?
FileName dd ?
ends
caption db 'Voxel mover 19.02.16',0 ;¯®¤¯¨áì ®ª­ 
run_file_70 FileInfoBlock
image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*18
image_data_toolbar dd 0
;§­ ç¥­¨ï § ¤ ¢ ¥¬ë¥ ¯® 㬮«ç ­¨î, ¡¥§ ini ä ©« 
@ -62,45 +44,6 @@ key_t_size db 'tile_size',0
key_f_size db 'file_size',0
key_col_b db 'c_background',0
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]
@@:
}
OT_MAP_X equ 0
OT_MAP_Y equ 0
OT_CAPT_X_COLOR equ 5 ;®âáâ㯠¤«ï ¯®¤¯¨á¨ 梥â 
@ -116,10 +59,10 @@ start:
mov ebp,lib_2
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
mcall SF_TERMINATE_PROCESS
@@:
mcall 48,3,sc,sizeof.system_colors
mcall 40,0x27
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
mcall SF_SET_EVENTS_MASK,0xC0000027
stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
;--- load ini file ---
@ -174,7 +117,7 @@ start:
stdcall [buf2d_vox_brush_create], buf_vox, vox_6_7_z
load_image_file 'toolbar_m.png', image_data_toolbar,IMAGE_TOOLBAR_SIZE
load_image_file 'toolbar_m.png', image_data_toolbar
stdcall mem.Alloc,[max_open_file_size]
mov dword[open_file_vox],eax
@ -190,7 +133,7 @@ red_win:
align 4
still:
mcall 10
mcall SF_WAIT_EVENT
cmp al,1
jz red_win
@ -200,7 +143,7 @@ still:
jz button
cmp al,6
jne @f
mcall 9,procinfo,-1
mcall SF_THREAD_INFO,procinfo,-1
cmp ax,word[procinfo+4]
jne @f ;®ª­® ­¥  ªâ¨¢­®
call mouse
@ -210,10 +153,10 @@ still:
align 4
mouse:
pushad
mcall 37,2
mcall SF_MOUSE_GET,SSF_BUTTON
bt eax,1 ;right button
jnc @f
mcall 37,1 ;get mouse coords
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
mov ebx,eax
shr ebx,16
and eax,0xffff
@ -223,7 +166,7 @@ mouse:
@@:
bt eax,0 ;left button
jnc .end_f
mcall 37,1 ;get mouse coords
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
mov ebx,eax
shr ebx,16
and eax,0xffff
@ -347,16 +290,16 @@ convert_y:
align 4
draw_window:
pushad
mcall 12,1
mcall SF_REDRAW,SSF_BEGIN_DRAW
; *** à¨á®¢ ­¨¥ £« ¢­®£® ®ª­  (¢ë¯®«­ï¥âáï 1 à § ¯à¨ § ¯ã᪥) ***
mov edx,[sc.work]
or edx,(3 shl 24)+0x30000000
mcall 0,dword[wnd_s_pos],dword[wnd_s_pos+4],,,caption
mcall SF_CREATE_WINDOW,dword[wnd_s_pos],dword[wnd_s_pos+4],,,caption
; *** ᮧ¤ ­¨¥ ª­®¯®ª ­  ¯ ­¥«ì ***
mov esi,[sc.work_button]
mcall 8,(5 shl 16)+20,(5 shl 16)+20,3
mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3
mov ebx,(30 shl 16)+20
mov edx,4
@ -412,7 +355,7 @@ pushad
; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
mov edx,(7 shl 16)+7 ;icon new
mcall 7,[image_data_toolbar],(16 shl 16)+16
mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16
add ebx,IMAGE_TOOLBAR_ICON_SIZE
add edx,(25 shl 16) ;icon open
@ -471,7 +414,7 @@ pushad
call draw_objects
call draw_pok
mcall 12,2
mcall SF_REDRAW,SSF_END_DRAW
popad
ret
@ -480,7 +423,7 @@ draw_pok:
mov esi,[sc.work_button_text]
or esi,(1 shl 30)
mov edi,[sc.work_button]
mcall 47, (3 shl 16)+(1 shl 31), [v_zoom], ((350+6*9) shl 16)+OT_CAPT_Y_COLOR+2 ;¬ áèâ ¡
mcall SF_DRAW_NUMBER, (3 shl 16)+(1 shl 31), [v_zoom], ((350+6*9) shl 16)+OT_CAPT_Y_COLOR+2 ;¬ áèâ ¡
mov ecx,[n_plane]
add edx,115 shl 16 ;9
int 0x40 ;­®¬¥à á¥ç¥­¨ï
@ -517,7 +460,7 @@ draw_pok:
;à¨á®¢ ­¨¥ ⥪áâ 
mov ecx,[sc.work_text]
or ecx,0x80000000 ;or (1 shl 30)
mcall 4, (OT_CAPT_X_COLOR shl 16)+OT_CAPT_Y_COLOR+2,,txt_color
mcall SF_DRAW_TEXT, (OT_CAPT_X_COLOR shl 16)+OT_CAPT_Y_COLOR+2,,txt_color
mov edx,txt_curor
add ebx,115 shl 16
@ -545,26 +488,26 @@ on_change_color:
pushad
mov ebx,((OT_CAPT_X_COLOR+35) shl 16)+16 ;¯® ®á¨ x
mov ecx,(OT_CAPT_Y_COLOR shl 16)+12 ;¯® ®á¨ y
mcall 13,,,[v_color]
mcall SF_DRAW_RECT,,,[v_color]
mov ecx,edx
mov edx,((OT_CAPT_X_COLOR+55) shl 16)+OT_CAPT_Y_COLOR+2
mov esi,[sc.work_text]
add esi,(1 shl 30)
mov edi,[sc.work]
mcall 47,(1 shl 8)+(6 shl 16)
mcall SF_DRAW_NUMBER,(1 shl 8)+(6 shl 16)
popad
ret
align 4
key:
mcall 2
mcall SF_GET_KEY
jmp still
align 4
button:
mcall 17
mcall SF_GET_BUTTON
cmp ah,3
jne @f
stdcall but_new_file, [open_file_vox]
@ -659,7 +602,7 @@ button:
stdcall mem.Free,[image_data_toolbar]
stdcall mem.Free,[open_file_vox]
stdcall mem.Free,[moved_file_vox]
mcall -1
mcall SF_TERMINATE_PROCESS
;¤ ­­ë¥ ¤«ï ¨­¨æ¨ «¨§ æ¨¨ ¢®ªá¥«ì­®£® ®¡ê¥ªâ 
align 4
@ -693,22 +636,20 @@ but_open_file:
je .end_open_file
;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
mov [run_file_70.Function], 0
mov [run_file_70.Function], SSF_READ_FILE
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
m2m dword[run_file_70.Count], dword[max_open_file_size]
m2m [run_file_70.Buffer], [open_file_vox]
mov byte[run_file_70+20], 0
mov dword[run_file_70.FileName], openfile_path
mov ebx,run_file_70
int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
mcall SF_FILE,run_file_70
cmp ebx,0xffffffff
je .end_open_file
;add ebx,[open_file_vox]
;mov byte[ebx],0 ;­  á«ãç © ¥á«¨ à ­¥¥ ¡ë« ®âªàëâ ä ©« ¡®«ì襣® à §¬¥à  ç¨á⨬ ª®­¥æ ¡ãä¥à  á ä ©«®¬
mcall 71,1,openfile_path
mcall SF_SET_CAPTION,1,openfile_path
;---
mov eax,[open_file_vox]
@ -739,16 +680,14 @@ but_save_file:
stdcall buf2d_vox_obj_get_size, ebx
mov dword[run_file_70.Count], eax ;à §¬¥à ä ©« 
mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
mov [run_file_70.Function], 2
mov [run_file_70.Function], SSF_CREATE_FILE
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov ebx, dword[moved_file_vox]
mov [run_file_70.Buffer], ebx
mov byte[run_file_70+20], 0
mov dword[run_file_70.FileName], openfile_path
mov ebx,run_file_70
int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
mcall SF_FILE,run_file_70
cmp ebx,0xffffffff
je .end_save_file

View File

@ -5,77 +5,26 @@ use32
include '../../../../programs/macros.inc'
include '../../../../programs/proc32.inc'
include '../../../../programs/develop/libraries/box_lib/load_lib.mac'
include '../../../../programs/dll.inc'
include '../../../../programs/KOSfuncs.inc'
include '../../../../programs/load_img.inc'
include '../../../../programs/develop/libraries/TinyGL/asm_fork/opengl_const.inc'
include 'vox_3d.inc'
include '../trunk/str.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
caption db 'Voxel viewer 07.12.15',0 ;¯®¤¯¨áì ®ª­ 
struct FileInfoBlock
Function dd ?
Position dd ?
Flags dd ?
Count dd ?
Buffer dd ?
db ?
FileName dd ?
ends
caption db 'Voxel viewer 19.02.16',0 ;¯®¤¯¨áì ®ª­ 
3d_wnd_l equ 5 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  á«¥¢ 
3d_wnd_t equ 30 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  ᢥàåã
3d_wnd_w equ 512
3d_wnd_h equ 512
image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*10
image_data_toolbar dd 0
offs_zbuf_pbuf equ 24
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,0
else
copy_path path,[32],file_name,0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
end if
stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
mov [buf],eax
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
mov [run_file_70.Buffer], eax
mov byte[run_file_70+20], 0
mov [run_file_70.FileName], file_name
mcall 70,run_file_70 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
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]
@@:
}
align 4
start:
load_libraries l_libs_start,l_libs_end
@ -83,20 +32,20 @@ start:
mov ebp,lib_0
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
mcall SF_TERMINATE_PROCESS
@@:
mcall 48,3,sc,sizeof.system_colors
mcall 40,0x27
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
mcall SF_SET_EVENTS_MASK,0xC0000027
stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
stdcall [buf2d_create], buf_0 ;ᮧ¤ ­¨¥ ¡ãä¥à 
load_image_file 'toolbar_t.png', image_data_toolbar,IMAGE_TOOLBAR_SIZE*2 ;*2 for gray icons
load_image_file 'toolbar_t.png', image_data_toolbar,,,6 ;6 - for gray icons
mov eax,[image_data_toolbar]
add eax,IMAGE_TOOLBAR_SIZE
stdcall img_to_gray, [image_data_toolbar],eax,(IMAGE_TOOLBAR_SIZE)/3
mcall 26,9
mcall SF_SYSTEM_GET,SSF_TIME_COUNT
mov [last_time],eax
stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,3d_wnd_w,3d_wnd_h,ctx1
@ -114,7 +63,7 @@ red_win:
align 4
still:
mcall 26,9
mcall SF_SYSTEM_GET,SSF_TIME_COUNT
mov ebx,[last_time]
add ebx,50 ;§ ¤¥à¦ª 
cmp ebx,eax
@ -122,7 +71,7 @@ still:
mov ebx,eax
@@:
sub ebx,eax
mcall 23
mcall SF_WAIT_EVENT_TIMEOUT
bt word[opt_auto_rotate],0
jnc @f
or eax,eax
@ -145,7 +94,7 @@ still:
align 4
timer_funct:
pushad
mcall 26,9
mcall SF_SYSTEM_GET,SSF_TIME_COUNT
mov [last_time],eax
; ¢â®¬ â¨ç¥áª®¥ ¨§¬¥­¥­¨¥ 㣫  ®¡§®à 
@ -161,17 +110,15 @@ timer_funct:
align 4
draw_window:
pushad
mcall 12,1
mcall SF_REDRAW,SSF_BEGIN_DRAW
; *** à¨á®¢ ­¨¥ £« ¢­®£® ®ª­  (¢ë¯®«­ï¥âáï 1 à § ¯à¨ § ¯ã᪥) ***
xor eax,eax
mov edx,[sc.work]
or edx,(3 shl 24)+0x30000000
mcall ,(20 shl 16)+800,(20 shl 16)+570,,,caption
mcall SF_CREATE_WINDOW,(20 shl 16)+800,(20 shl 16)+570,,,caption
; *** ᮧ¤ ­¨¥ ª­®¯®ª ­  ¯ ­¥«ì ***
mov esi,[sc.work_button]
mcall 8,(5 shl 16)+20,(5 shl 16)+20,3
mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3,[sc.work_button]
mov ebx,(30 shl 16)+20
mov edx,4
@ -206,7 +153,7 @@ pushad
stdcall [buf2d_draw], buf_0
stdcall [kosglSwapBuffers]
mcall 12,2
mcall SF_REDRAW,SSF_END_DRAW
popad
ret
@ -215,7 +162,7 @@ align 4
draw_toolbar_i:
; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
mov edx,(7 shl 16)+7 ;icon new
mcall 7,[image_data_toolbar],(16 shl 16)+16
mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16
add ebx,IMAGE_TOOLBAR_ICON_SIZE
add edx,(25 shl 16) ;icon open
@ -278,7 +225,7 @@ draw_toolbar_i:
align 4
key:
mcall 2
mcall SF_GET_KEY
cmp ah,178 ;Up
jne @f
@ -319,13 +266,13 @@ key:
align 4
mouse:
push eax ebx
mcall 37,3
mcall SF_MOUSE_GET,SSF_BUTTON_EXT
bt eax,0
jnc .end_m
;mouse l. but. move
cmp dword[mouse_drag],1
jne .end_m
mcall 37,1 ;get mouse coords
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
mov ebx,eax
shr ebx,16 ;mouse.x
cmp ebx,3d_wnd_l
@ -375,7 +322,7 @@ mouse:
bt eax,8
jnc .end_d
;mouse l. but. press
mcall 37,1 ;get mouse coords
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
mov ebx,eax
shr ebx,16 ;mouse.x
cmp ebx,3d_wnd_l
@ -400,7 +347,7 @@ mouse:
align 4
button:
mcall 17
mcall SF_GET_BUTTON
cmp ah,3
jne @f
call but_new_file
@ -448,7 +395,7 @@ button:
stdcall mem.Free,[image_data_toolbar]
stdcall mem.Free,[open_file_data]
stdcall mem.Free,[open_file_ogl]
mcall -1
mcall SF_TERMINATE_PROCESS
align 4
@ -461,7 +408,6 @@ but_new_file:
align 4
open_file_data dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï ®âªàëâ¨ï ä ©«®¢
open_file_size dd 0 ;à §¬¥à ®âªàë⮣® ä ©« 
open_b rb 560
open_file_ogl dd 0 ;¤«ï § ¯¨á¨ ª®®à¤¨­ â èà ­¥© ¢®ªá¥«¥© ¢ ¯®ª §¥ opengl
v_zoom dd 0
@ -475,16 +421,14 @@ pushad
je .end_open_file
;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
mov [run_file_70.Function], 5
mov [run_file_70.Function], SSF_GET_INFO
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov dword[run_file_70.Count], 0
mov dword[run_file_70.Buffer], open_b
mov byte[run_file_70+20], 0
mov dword[run_file_70.FileName], openfile_path
mov ebx,run_file_70
int 0x40
mcall SF_FILE,run_file_70
;mov eax,dword[open_b+32]
;mov edi,txt_buf
@ -495,21 +439,19 @@ pushad
stdcall mem.ReAlloc,[open_file_data],ecx
mov [open_file_data],eax
mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
mov [run_file_70.Function], 0
mov [run_file_70.Function], SSF_READ_FILE
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov dword[run_file_70.Count], ecx
m2m dword[run_file_70.Buffer], dword[open_file_data]
mov byte[run_file_70+20], 0
mov dword[run_file_70.FileName], openfile_path
mov ebx,run_file_70
int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
mcall SF_FILE,run_file_70
cmp ebx,0xffffffff
je .end_open_file
mov [open_file_size],ebx
mcall 71,1,openfile_path
mcall SF_SET_CAPTION,1,openfile_path
mov eax,[open_file_data]
movzx eax,byte[eax]
@ -624,22 +566,19 @@ but_save_file:
je .end_save_file
;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
mov [run_file_70.Function], 2
mov [run_file_70.Function], SSF_CREATE_FILE
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov ebx, dword[open_file_data]
;¯¨è¥¬ ¢ ä ©« ­®¢ë© ¬ áèâ ¡
mov edx,dword[v_zoom]
mov byte[ebx],dl
;
mov [run_file_70.Buffer], ebx
mov ebx,[open_file_size]
mov dword[run_file_70.Count], ebx ;à §¬¥à ä ©« 
mov byte[run_file_70+20], 0
mov dword[run_file_70.FileName], openfile_path
mov ebx,run_file_70
int 0x40 ;á®å࠭塞 ä ©«
mcall SF_FILE,run_file_70
;cmp ebx,0xffffffff
;je .end_save_file
; ... á®®¡é¥­¨¥ ® ­¥ã¤ ç­®¬ á®åà ­¥­¨¨ ...
@ -799,7 +738,7 @@ draw_3d:
;­® ¢á¥ ¦¥ ¯à¨ ¯®¢®à®â å ¡ã¤ãâ ®âᥪ âáï ªà ï, ª®â®àë¥ ¢ë«¥§ãâ §  ¯à¥¤¥«ë ¯«®áª®á⥩ ®âá¥ç¥­¨ï
;¢ ¢¥àᨨ opengl ¯®¤ Win ª®®à¤¨­ âë ¨¤ãâ ®â -1.0 ¤® 1.0 ¯®â®¬ã â ¬ í⮣® ¤¥« âì ­¥ ­ã¦­®
stdcall [glScalef], [scale], [scale], [scale] ;㢥«¨ç¨¢ ¥¬ ¢®ªá¥«ì­ë© ®¡ê¥ªâ, çâ®-¡ë ­¥ ¡ë« ®ç¥­ì ¬ «¥­ìª¨¬
stdcall [glScalef], 1.0, 1.0, 0.5 ;çâ®-¡ë ªà ï ®¡ê¥ªâ  ­¥ ¢ë« §¨«¨ §  £à ­¨ ®âá¥ç¥­¨ï
stdcall [glScalef], 1.0, 1.0, 0.25 ;çâ®-¡ë ªà ï ®¡ê¥ªâ  ­¥ ¢ë« §¨«¨ §  £à ­¨ ®âá¥ç¥­¨ï
stdcall [glRotatef], [angle_x],1.0,0.0,0.0
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
stdcall [glRotatef], [angle_z],0.0,0.0,1.0
@ -915,6 +854,11 @@ lib_name_2 db 'buf2d.obj',0
err_msg_found_lib_2 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,0
err_msg_import_2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,0
system_dir_3 db '/kolibrios/lib/'
lib_name_3 db 'tinygl.obj',0
err_msg_found_lib_3 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'tinygl.obj',39,0
err_msg_import_3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'tinygl',39,0
l_libs_start:
lib_0 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
@ -1049,13 +993,6 @@ macro E_LIB n
}
include '../../../../programs/develop/libraries/TinyGL/asm_fork/export.inc'
;--------------------------------------------------
system_dir_3 db '/sys/lib/'
lib_name_3 db 'tinygl.obj',0
err_msg_found_lib_3 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'tinygl.obj',39,0
err_msg_import_3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'tinygl',39,0
;--------------------------------------------------
last_time dd 0
align 4