From ed2e074b9f3bcb112dbd7795c64676883a09c30d Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 7 Jun 2024 10:39:27 +0100 Subject: [PATCH] Update locale codes - Fixes for new locale codes. - Correct en_US translations. - Some whitespace clean-up. --- kernel/trunk/kernelsp.inc | 2 +- programs/develop/info3ds/convert_stl_3ds.inc | 919 +- programs/develop/info3ds/data.inc | 644 +- programs/develop/info3ds/info3ds.asm | 2798 +-- programs/develop/info3ds/info3ds_u.asm | 2918 +-- programs/develop/info3ds/info_menu.inc | 56 +- programs/develop/info3ds/info_wnd_coords.inc | 1654 +- .../libraries/box_lib/trunk/t_edit.asm | 8968 ++++---- .../develop/str_double/trunk/str_double.asm | 636 +- .../develop/tinypad/trunk/data/tp-locale.inc | 992 +- programs/fs/copyr/trunk/copyr.asm | 16 +- programs/fs/kfar/trunk/kfar.asm | 17866 ++++++++-------- programs/fs/unz/unz.asm | 1828 +- programs/games/15/trunk/15.ASM | 980 +- programs/games/Dungeons/data.inc | 190 +- programs/games/arcanii/trunk/arcanii.asm | 16 +- programs/games/arcanoid/trunk/arcanoid.asm | 26 +- programs/games/bomber/bomber.asm | 4738 ++-- .../bomber/{englang.inc => lang-en_US.inc} | 34 +- .../bomber/{ruslang.inc => lang-ru_RU.inc} | 0 20 files changed, 22678 insertions(+), 22603 deletions(-) rename programs/games/bomber/{englang.inc => lang-en_US.inc} (75%) rename programs/games/bomber/{ruslang.inc => lang-ru_RU.inc} (100%) diff --git a/kernel/trunk/kernelsp.inc b/kernel/trunk/kernelsp.inc index 2734b12fff..8350f72b8d 100644 --- a/kernel/trunk/kernelsp.inc +++ b/kernel/trunk/kernelsp.inc @@ -8,5 +8,5 @@ ; Éste archivo debe ser editado con codificación CP866 -version cp850 'KolibriOS versión 0.7.7.0+ ',13,10,13,10,0 +version cp850 'KolibriOS versión 0.7.7.0 ',13,10,13,10,0 ; FIXME: Get distribution version from git tag diff16 "fin del código del kernel",0,$ diff --git a/programs/develop/info3ds/convert_stl_3ds.inc b/programs/develop/info3ds/convert_stl_3ds.inc index 10fdbc9352..4b8e79ab05 100644 --- a/programs/develop/info3ds/convert_stl_3ds.inc +++ b/programs/develop/info3ds/convert_stl_3ds.inc @@ -1,459 +1,460 @@ -; -; 㭪樨 ८ࠧ 䠩 *.stl *.3ds -; -; ᮧ 䠩 *.3ds: -; CHUNK_MAIN (40+n+v+f) -; + CHUNK_OBJMESH (34+n+v+f) -; + CHUNK_OBJBLOCK (28+n+v+f) -; + CHUNK_TRIMESH (22+v+f) -; + CHUNK_VERTLIST (8+v) -; + CHUNK_FACELIST (8+f) -; -; ᪮ 㪠 ࠧ : -; n - ꥪ -; v - 設 -; f - ࠭ - -; ଠ ୮ *.stl: -; char[80] - -; uint32 - ᫮ ࠭ -; ࠭: -; float[3] - ଠ -; float[9] - 設 1,2,3 -; uint16 - ਡ - - -if lang eq ru_RU -txt_err_stl_open: - db '"STL',13,10 - db ' *.stl 祭 让." -tW',0 -txt_err_stl_null_v: - db '"STL',13,10 - db '設 ." -tE',0 -else -txt_err_stl_open: - db '"STL',13,10 - db 'File *.stl is very large." -tW',0 -txt_err_stl_null_v: - db '"STL',13,10 - db 'Vertexes not found." -tE',0 -end if - -;output: -; eax - 㪠⥫ ନ஢ 䠩 3ds ( 砥 㤠 0) -; ecx - ࠧ ନ஢ 䠩 3ds -align 4 -proc convert_stl_3ds uses ebx edx edi esi, f_data:dword, f_size:dword -locals - c_mem dd ? ; ८ࠧ (convert memory) - c_size dd ? ;ࠧ ८ࠧ (convert memory size) - vert_c dd ? ;᫮ 設 (vertex count) - face_c dd ? ;᫮ ࠭ (faces count) -endl - xor eax,eax - mov esi,[f_data] - cmp dword[esi],'soli' - jne .bin_stl - cmp word[esi+4],'d ' - jne .bin_stl - - jmp @f - .bin_stl: - ;஢塞 䠩 ଠ - mov ecx,[esi+80] - imul ecx,50 - add ecx,84 ; - cmp ecx,[f_size] - jne .no_stl - call convert_binary_stl - jmp .no_stl - @@: - - ; 砫 'solid ' - stdcall txt_next_line, 80 - - mov eax,[f_data] - sub eax,esi - add eax,[f_size] - stdcall get_stl_vertex_count, esi,eax - or eax,eax - jnz @f - notify_window_run txt_err_stl_null_v - jmp .no_stl - @@: - cmp eax,0xffff - jle @f - notify_window_run txt_err_stl_open - mov eax,0xffff - @@: - - mov [vert_c],eax - mov ecx,3 - xor edx,edx - div ecx - mov [face_c],eax - shl eax,3 - mov ecx,[vert_c] - imul ecx,12 - lea ecx,[ecx+eax+40] - lea edx,[esi-6] - sub edx,[f_data] - cmp edx,2 - jge @f - mov edx,2 ; ࠧ ꥪ - @@: - add ecx,edx ;for object name - mov [c_size],ecx - stdcall mem.Alloc,ecx - mov [c_mem],eax - mov ebx,eax - - mov word[ebx],CHUNK_MAIN - mov dword[ebx+2],ecx - add ebx,6 - - ;3d3d - mov word[ebx],CHUNK_OBJMESH - sub ecx,6 - mov dword[ebx+2],ecx - add ebx,6 - - ;4000 - mov word[ebx],CHUNK_OBJBLOCK - sub ecx,6 - mov dword[ebx+2],ecx - add ebx,6 - - push ecx esi - mov ecx,edx - mov edi,ebx - mov esi,[f_data] - add esi,6 ;ய᪠ 'solid ' - rep movsb ;㥬 ꥪ - mov byte[edi-1],0 - add ebx,edx - pop esi ecx - - ;4100 - mov word[ebx],CHUNK_TRIMESH - sub ecx,6 - mov dword[ebx+2],ecx - add ebx,6 - - ;4110 - mov word[ebx],CHUNK_VERTLIST - mov dword[ebx+2],8 ;+ ᫮ 設 * 12 - add ebx,6 - - mov edx,ebx - mov word[edx],0 ;. 設 - add ebx,2 - finit - .cycle0: - call txt_ignore_space - cmp dword[esi],'face' - jne .end_v - stdcall txt_next_line, 80 - - call txt_ignore_space - cmp dword[esi],'oute' - jne .end_v - stdcall txt_next_line, 80 - - mov ecx,3 ;3 窨 1 ࠭ - @@: - stdcall stl_vertex_init, ebx - or eax,eax - jz .end_v - add ebx,12 - inc word[edx] - loop @b - - mov eax,[vert_c] - cmp word[edx],ax - jge .end_v - call txt_ignore_space - cmp dword[esi],'endl' - jne .end_v - stdcall txt_next_line, 80 - - call txt_ignore_space - cmp dword[esi],'endf' - jne .end_v - stdcall txt_next_line, 80 - jmp .cycle0 - .end_v: - - movzx eax,word[edx] - imul eax,12 - add [edx-4],eax ;ࠢ塞 ࠧ 4110 - - ;4120 - mov word[ebx],CHUNK_FACELIST - mov ecx,[face_c] - mov edx,ecx - shl edx,3 ;. ࠭ * 8 - add edx,8 - mov [ebx+2],edx - add ebx,6 - mov [ebx],cx ;. ࠭ - add ebx,2 - xor eax,eax - @@: - mov [ebx],ax - inc eax - mov [ebx+2],ax - inc eax - mov [ebx+4],ax - inc eax - mov word[ebx+6],0 ;ਡ - add ebx,8 - loop @b - - mov eax,[c_mem] - mov ecx,[c_size] - .no_stl: - ret -endp - -;input: -; esi - 㪠⥫ 砫 䠩 -; ecx - ࠧ 䠩 -align 4 -proc convert_binary_stl -locals - c_mem dd ? ; ८ࠧ (convert memory) - c_size dd ? ;ࠧ ८ࠧ (convert memory size) - vert_c dd ? ;᫮ 設 (vertex count) - face_c dd ? ;᫮ ࠭ (faces count) -endl - mov eax,[esi+80] - or eax,eax - jnz @f - notify_window_run txt_err_stl_null_v - jmp .no_stl - @@: - cmp eax,0xffff/3 - jle @f - notify_window_run txt_err_stl_open - mov eax,0xffff/3 - @@: - - mov [face_c],eax - mov ecx,eax - imul eax,3 - mov [vert_c],eax - shl ecx,3 - imul eax,12 - lea ecx,[ecx+eax+40+4] ;+4 ࠧ ꥪ - mov [c_size],ecx - stdcall mem.Alloc,ecx - mov [c_mem],eax - mov ebx,eax - - mov word[ebx],CHUNK_MAIN - mov dword[ebx+2],ecx - add ebx,6 - - ;3d3d - mov word[ebx],CHUNK_OBJMESH - sub ecx,6 - mov dword[ebx+2],ecx - add ebx,6 - - ;4000 - mov word[ebx],CHUNK_OBJBLOCK - sub ecx,6 - mov dword[ebx+2],ecx - add ebx,6 - mov dword[ebx],'Stl' ; ꥪ - add ebx,4 - - ;4100 - mov word[ebx],CHUNK_TRIMESH - sub ecx,6 - mov dword[ebx+2],ecx - add ebx,6 - - ;4110 - mov word[ebx],CHUNK_VERTLIST - mov dword[ebx+2],8 ;+ ᫮ 設 * 12 - add ebx,6 - - mov edx,ebx - mov ecx,[vert_c] - mov word[edx],cx ;. 設 - add ebx,2 - - add esi,80+4+12 ;ய , ᫠ ࠭, 1- ଠ - mov edi,ebx - mov eax,[face_c] - @@: ;横 ࠭ - mov ecx,9 - rep movsd ;㥬 न 3- 設 - add esi,14 ;ய ଠ ਡ⮢ - dec eax - jnz @b - mov ebx,edi - - movzx eax,word[edx] - imul eax,12 - add [edx-4],eax ;ࠢ塞 ࠧ 4110 - - ;4120 - mov word[ebx],CHUNK_FACELIST - mov ecx,[face_c] - mov edx,ecx - shl edx,3 ;. ࠭ * 8 - add edx,8 - mov [ebx+2],edx - add ebx,6 - mov [ebx],cx ;. ࠭ - add ebx,2 - xor eax,eax - @@: - mov [ebx],ax - inc eax - mov [ebx+2],ax - inc eax - mov [ebx+4],ax - inc eax - mov word[ebx+6],0 ;ਡ - add ebx,8 - loop @b - - mov eax,[c_mem] - mov ecx,[c_size] - .no_stl: - ret -endp - -;output: -; eax - vertex count -align 4 -proc get_stl_vertex_count uses ebx ecx edi, f_data:dword, f_size:dword - mov al,'v' - xor ebx,ebx - mov ecx,[f_size] - mov edi,[f_data] - .cycle0: - repne scasb - cmp dword[edi],'erte' - jne @f - inc ebx - add edi,4 - sub ecx,4 - cmp ecx,4 - jg .cycle0 - @@: - mov eax,ebx - ret -endp - -;input: -; esi - input description text -; ppoi - pointer to vertex struct -;output: -; eax - 0 (if error init) or 1 -; esi - output description text -align 4 -proc stl_vertex_init uses ebx ecx edi, ppoi:dword - call txt_ignore_space - cmp dword[esi],'vert' - jne .err_init - cmp word[esi+4],'ex' - jne .err_init - add esi,6 - mov ebx,[ppoi] - - call txt_copy_data - call String_to_DoubleFloat - fld qword[Data_Double] - fstp dword[ebx] ;coord X - - call txt_copy_data - call String_to_DoubleFloat - fld qword[Data_Double] - fstp dword[ebx+4] ;coord X - - call txt_copy_data - call String_to_DoubleFloat - fld qword[Data_Double] - fstp dword[ebx+8] ;coord Z - - stdcall txt_next_line, 80 - jmp @f - .err_init: - xor eax,eax - jmp .end_f - @@: - xor eax,eax - inc eax - .end_f: - ret -endp - -;input: -; esi - 㪠⥫ 砫 ப ஡ -;output: -; al - destroy -; ecx - destroy -; esi - 㪠⥫ ஡ ᨬ -align 4 -txt_ignore_space: - mov ecx,64 ; 横 - @@: - lodsb - cmp al,' ' - jne @f - loop @b - @@: - dec esi - ret - -;input: -; esi - 㪠⥫ ப ᫮ (஡ 砫 ப ) -;output: -; al - destroy -; ecx - destroy -; edi - destroy -; esi - 㪠⥫ ஢ ᫠ -; Data_String - ப ᫮ esi -align 4 -txt_copy_data: - call txt_ignore_space - mov ecx,32 - mov edi,esi - @@: - lodsb - or al,al - jz @f - cmp al,' ' - je @f - cmp al,13 - je @f - loop @b - @@: - mov esi,edi - sub ecx,32 - neg ecx - mov edi,Data_String - rep movsb - mov byte[edi],0 - ret - -;input: -; esi - text pointer -align 4 -proc txt_next_line uses eax ecx edi, mlen:dword - mov al,13 - mov ecx,[mlen] - mov edi,esi - repne scasb - cmp byte[edi],10 - jne @f - inc edi - @@: - mov esi,edi - ret -endp +; +; 㭪樨 ८ࠧ 䠩 *.stl *.3ds +; +; ᮧ 䠩 *.3ds: +; CHUNK_MAIN (40+n+v+f) +; + CHUNK_OBJMESH (34+n+v+f) +; + CHUNK_OBJBLOCK (28+n+v+f) +; + CHUNK_TRIMESH (22+v+f) +; + CHUNK_VERTLIST (8+v) +; + CHUNK_FACELIST (8+f) +; +; ᪮ 㪠 ࠧ : +; n - ꥪ +; v - 設 +; f - ࠭ + +; ଠ ୮ *.stl: +; char[80] - +; uint32 - ᫮ ࠭ +; ࠭: +; float[3] - ଠ +; float[9] - 設 1,2,3 +; uint16 - ਡ + + ; Language support for locales: ru_RU (CP866), en_US. + +if lang eq ru_RU +txt_err_stl_open: + db '"STL',13,10 + db ' *.stl 祭 让." -tW',0 +txt_err_stl_null_v: + db '"STL',13,10 + db '設 ." -tE',0 +else ; Default to en_US +txt_err_stl_open: + db '"STL',13,10 + db 'File *.stl is very large." -tW',0 +txt_err_stl_null_v: + db '"STL',13,10 + db 'Vertexes not found." -tE',0 +end if + +;output: +; eax - 㪠⥫ ନ஢ 䠩 3ds ( 砥 㤠 0) +; ecx - ࠧ ନ஢ 䠩 3ds +align 4 +proc convert_stl_3ds uses ebx edx edi esi, f_data:dword, f_size:dword +locals + c_mem dd ? ; ८ࠧ (convert memory) + c_size dd ? ;ࠧ ८ࠧ (convert memory size) + vert_c dd ? ;᫮ 設 (vertex count) + face_c dd ? ;᫮ ࠭ (faces count) +endl + xor eax,eax + mov esi,[f_data] + cmp dword[esi],'soli' + jne .bin_stl + cmp word[esi+4],'d ' + jne .bin_stl + + jmp @f + .bin_stl: + ;஢塞 䠩 ଠ + mov ecx,[esi+80] + imul ecx,50 + add ecx,84 ; + cmp ecx,[f_size] + jne .no_stl + call convert_binary_stl + jmp .no_stl + @@: + + ; 砫 'solid ' + stdcall txt_next_line, 80 + + mov eax,[f_data] + sub eax,esi + add eax,[f_size] + stdcall get_stl_vertex_count, esi,eax + or eax,eax + jnz @f + notify_window_run txt_err_stl_null_v + jmp .no_stl + @@: + cmp eax,0xffff + jle @f + notify_window_run txt_err_stl_open + mov eax,0xffff + @@: + + mov [vert_c],eax + mov ecx,3 + xor edx,edx + div ecx + mov [face_c],eax + shl eax,3 + mov ecx,[vert_c] + imul ecx,12 + lea ecx,[ecx+eax+40] + lea edx,[esi-6] + sub edx,[f_data] + cmp edx,2 + jge @f + mov edx,2 ; ࠧ ꥪ + @@: + add ecx,edx ;for object name + mov [c_size],ecx + stdcall mem.Alloc,ecx + mov [c_mem],eax + mov ebx,eax + + mov word[ebx],CHUNK_MAIN + mov dword[ebx+2],ecx + add ebx,6 + + ;3d3d + mov word[ebx],CHUNK_OBJMESH + sub ecx,6 + mov dword[ebx+2],ecx + add ebx,6 + + ;4000 + mov word[ebx],CHUNK_OBJBLOCK + sub ecx,6 + mov dword[ebx+2],ecx + add ebx,6 + + push ecx esi + mov ecx,edx + mov edi,ebx + mov esi,[f_data] + add esi,6 ;ய᪠ 'solid ' + rep movsb ;㥬 ꥪ + mov byte[edi-1],0 + add ebx,edx + pop esi ecx + + ;4100 + mov word[ebx],CHUNK_TRIMESH + sub ecx,6 + mov dword[ebx+2],ecx + add ebx,6 + + ;4110 + mov word[ebx],CHUNK_VERTLIST + mov dword[ebx+2],8 ;+ ᫮ 設 * 12 + add ebx,6 + + mov edx,ebx + mov word[edx],0 ;. 設 + add ebx,2 + finit + .cycle0: + call txt_ignore_space + cmp dword[esi],'face' + jne .end_v + stdcall txt_next_line, 80 + + call txt_ignore_space + cmp dword[esi],'oute' + jne .end_v + stdcall txt_next_line, 80 + + mov ecx,3 ;3 窨 1 ࠭ + @@: + stdcall stl_vertex_init, ebx + or eax,eax + jz .end_v + add ebx,12 + inc word[edx] + loop @b + + mov eax,[vert_c] + cmp word[edx],ax + jge .end_v + call txt_ignore_space + cmp dword[esi],'endl' + jne .end_v + stdcall txt_next_line, 80 + + call txt_ignore_space + cmp dword[esi],'endf' + jne .end_v + stdcall txt_next_line, 80 + jmp .cycle0 + .end_v: + + movzx eax,word[edx] + imul eax,12 + add [edx-4],eax ;ࠢ塞 ࠧ 4110 + + ;4120 + mov word[ebx],CHUNK_FACELIST + mov ecx,[face_c] + mov edx,ecx + shl edx,3 ;. ࠭ * 8 + add edx,8 + mov [ebx+2],edx + add ebx,6 + mov [ebx],cx ;. ࠭ + add ebx,2 + xor eax,eax + @@: + mov [ebx],ax + inc eax + mov [ebx+2],ax + inc eax + mov [ebx+4],ax + inc eax + mov word[ebx+6],0 ;ਡ + add ebx,8 + loop @b + + mov eax,[c_mem] + mov ecx,[c_size] + .no_stl: + ret +endp + +;input: +; esi - 㪠⥫ 砫 䠩 +; ecx - ࠧ 䠩 +align 4 +proc convert_binary_stl +locals + c_mem dd ? ; ८ࠧ (convert memory) + c_size dd ? ;ࠧ ८ࠧ (convert memory size) + vert_c dd ? ;᫮ 設 (vertex count) + face_c dd ? ;᫮ ࠭ (faces count) +endl + mov eax,[esi+80] + or eax,eax + jnz @f + notify_window_run txt_err_stl_null_v + jmp .no_stl + @@: + cmp eax,0xffff/3 + jle @f + notify_window_run txt_err_stl_open + mov eax,0xffff/3 + @@: + + mov [face_c],eax + mov ecx,eax + imul eax,3 + mov [vert_c],eax + shl ecx,3 + imul eax,12 + lea ecx,[ecx+eax+40+4] ;+4 ࠧ ꥪ + mov [c_size],ecx + stdcall mem.Alloc,ecx + mov [c_mem],eax + mov ebx,eax + + mov word[ebx],CHUNK_MAIN + mov dword[ebx+2],ecx + add ebx,6 + + ;3d3d + mov word[ebx],CHUNK_OBJMESH + sub ecx,6 + mov dword[ebx+2],ecx + add ebx,6 + + ;4000 + mov word[ebx],CHUNK_OBJBLOCK + sub ecx,6 + mov dword[ebx+2],ecx + add ebx,6 + mov dword[ebx],'Stl' ; ꥪ + add ebx,4 + + ;4100 + mov word[ebx],CHUNK_TRIMESH + sub ecx,6 + mov dword[ebx+2],ecx + add ebx,6 + + ;4110 + mov word[ebx],CHUNK_VERTLIST + mov dword[ebx+2],8 ;+ ᫮ 設 * 12 + add ebx,6 + + mov edx,ebx + mov ecx,[vert_c] + mov word[edx],cx ;. 設 + add ebx,2 + + add esi,80+4+12 ;ய , ᫠ ࠭, 1- ଠ + mov edi,ebx + mov eax,[face_c] + @@: ;横 ࠭ + mov ecx,9 + rep movsd ;㥬 न 3- 設 + add esi,14 ;ய ଠ ਡ⮢ + dec eax + jnz @b + mov ebx,edi + + movzx eax,word[edx] + imul eax,12 + add [edx-4],eax ;ࠢ塞 ࠧ 4110 + + ;4120 + mov word[ebx],CHUNK_FACELIST + mov ecx,[face_c] + mov edx,ecx + shl edx,3 ;. ࠭ * 8 + add edx,8 + mov [ebx+2],edx + add ebx,6 + mov [ebx],cx ;. ࠭ + add ebx,2 + xor eax,eax + @@: + mov [ebx],ax + inc eax + mov [ebx+2],ax + inc eax + mov [ebx+4],ax + inc eax + mov word[ebx+6],0 ;ਡ + add ebx,8 + loop @b + + mov eax,[c_mem] + mov ecx,[c_size] + .no_stl: + ret +endp + +;output: +; eax - vertex count +align 4 +proc get_stl_vertex_count uses ebx ecx edi, f_data:dword, f_size:dword + mov al,'v' + xor ebx,ebx + mov ecx,[f_size] + mov edi,[f_data] + .cycle0: + repne scasb + cmp dword[edi],'erte' + jne @f + inc ebx + add edi,4 + sub ecx,4 + cmp ecx,4 + jg .cycle0 + @@: + mov eax,ebx + ret +endp + +;input: +; esi - input description text +; ppoi - pointer to vertex struct +;output: +; eax - 0 (if error init) or 1 +; esi - output description text +align 4 +proc stl_vertex_init uses ebx ecx edi, ppoi:dword + call txt_ignore_space + cmp dword[esi],'vert' + jne .err_init + cmp word[esi+4],'ex' + jne .err_init + add esi,6 + mov ebx,[ppoi] + + call txt_copy_data + call String_to_DoubleFloat + fld qword[Data_Double] + fstp dword[ebx] ;coord X + + call txt_copy_data + call String_to_DoubleFloat + fld qword[Data_Double] + fstp dword[ebx+4] ;coord X + + call txt_copy_data + call String_to_DoubleFloat + fld qword[Data_Double] + fstp dword[ebx+8] ;coord Z + + stdcall txt_next_line, 80 + jmp @f + .err_init: + xor eax,eax + jmp .end_f + @@: + xor eax,eax + inc eax + .end_f: + ret +endp + +;input: +; esi - 㪠⥫ 砫 ப ஡ +;output: +; al - destroy +; ecx - destroy +; esi - 㪠⥫ ஡ ᨬ +align 4 +txt_ignore_space: + mov ecx,64 ; 横 + @@: + lodsb + cmp al,' ' + jne @f + loop @b + @@: + dec esi + ret + +;input: +; esi - 㪠⥫ ப ᫮ (஡ 砫 ப ) +;output: +; al - destroy +; ecx - destroy +; edi - destroy +; esi - 㪠⥫ ஢ ᫠ +; Data_String - ப ᫮ esi +align 4 +txt_copy_data: + call txt_ignore_space + mov ecx,32 + mov edi,esi + @@: + lodsb + or al,al + jz @f + cmp al,' ' + je @f + cmp al,13 + je @f + loop @b + @@: + mov esi,edi + sub ecx,32 + neg ecx + mov edi,Data_String + rep movsb + mov byte[edi],0 + ret + +;input: +; esi - text pointer +align 4 +proc txt_next_line uses eax ecx edi, mlen:dword + mov al,13 + mov ecx,[mlen] + mov edi,esi + repne scasb + cmp byte[edi],10 + jne @f + inc edi + @@: + mov esi,edi + ret +endp diff --git a/programs/develop/info3ds/data.inc b/programs/develop/info3ds/data.inc index 9468b52b5d..ce6516e93b 100644 --- a/programs/develop/info3ds/data.inc +++ b/programs/develop/info3ds/data.inc @@ -1,320 +1,324 @@ -; -; ᮡ࠭ *.3ds -; - -MAX_FILE_LEVEL equ 20 ;ᨬ ஢ - -sizeof.block_3ds equ 9 -can_save db 0 ; 䠩 - -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_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 ; [-] "楫" - -; ᮤঠ , ⬥祭 ᮬ, ⠫ -; - -align 4 -type_bloks: -block_3ds 0x0002,5,1,txt_0002 -block_3ds 0x3d3e,5,1 ; [+] mesh version -block_3ds 0x0011,4,1,txt_0011 -block_3ds 0x0100,3,1,txt_0100 -block_3ds CHUNK_ambient_color,3,0,txt_2100 ; [-] ambient color -block_3ds CHUNK_OBJMESH, 3,0,txt_3d3d -block_3ds CHUNK_OBJBLOCK,11,1,txt_4000 -block_3ds CHUNK_TRIMESH, 3,0,txt_4100 -block_3ds CHUNK_VERTLIST,8,1,txt_4110 -block_3ds CHUNK_FACELIST,3,1,txt_4120 -block_3ds CHUNK_FACEMAT,10,1,txt_4130 -block_3ds CHUNK_MAPLIST, 3,1,txt_4140 -block_3ds CHUNK_TRMATRIX,3,1,txt_4160 -block_3ds 0x4600,3,1,txt_4600 -block_3ds CHUNK_CAMERA, 3,1,txt_4700 -block_3ds CHUNK_MATERIAL,10,0,txt_afff -block_3ds CHUNK_MATNAME, 3,1,txt_a000 -block_3ds 0xa010,4,0,txt_a010 -block_3ds 0xa020,4,0,txt_a020 -block_3ds 0xa030,4,0,txt_a030 -block_3ds 0xa100,5,1,txt_a100 -block_3ds CHUNK_TEXTURE, 3,0,txt_a200 -block_3ds CHUNK_MAPFILE, 6,1,txt_a300 -block_3ds CHUNK_KEYFRAMER, 7,0,txt_b000 -block_3ds CHUNK_TRACKINFO, 3,0,txt_b002 -block_3ds CHUNK_TRACKOBJNAME,3,1,txt_b010 -block_3ds 0xb011,3,1,txt_b011 -block_3ds CHUNK_TRACKPIVOT, 3,1,txt_b013 -block_3ds 0xb014,3,1,txt_b014 -block_3ds CHUNK_TRACKPOS, 3,1,txt_b020 -block_3ds CHUNK_TRACKROTATE, 3,1,txt_b021 -block_3ds CHUNK_TRACKCAMERA, 7,0,txt_b003 -block_3ds CHUNK_TRACKFOV, 7,1,txt_b023 -block_3ds CHUNK_TRACKROLL, 7,1,txt_b024 -block_3ds CHUNK_TRACKCAMTGT, 7,0,txt_b004 - -;--- ᬮ ᠭ ᪮ 몥 -block_3ds 0x4111, 3,1,txt_4111 -block_3ds 0x4150, 3,1,txt_4150 -block_3ds 0x4165, 3,1,txt_4165 -block_3ds 0x4610, 3,1,txt_4610 -block_3ds 0x4627, 3,1,txt_4627 -block_3ds 0x4630, 3,1,txt_4630 -block_3ds 0x4641, 3,1,txt_4641 -block_3ds 0x4650, 3,1,txt_4650 -block_3ds 0x4651, 3,1,txt_4651 -block_3ds 0x4652, 3,1,txt_4652 -block_3ds 0x4653, 3,1,txt_4653 -block_3ds 0x4656, 3,1,txt_4656 -block_3ds 0x4658, 3,1,txt_4658 -block_3ds 0x4620, 3,1,txt_4620 -block_3ds 0x4625, 3,1,txt_4625 -block_3ds 0x4659, 3,1,txt_4659 -block_3ds 0x465a, 3,1,txt_465a -block_3ds 0x465b, 3,1,txt_465b -block_3ds 0xa230, 3,1,txt_a230 -block_3ds 0xa220, 3,1,txt_a220 -block_3ds 0xa351, 3,1,txt_a351 -block_3ds 0xb007, 3,1,txt_b007 -block_3ds 0xb008, 3,1,txt_b008 -block_3ds 0xb022, 3,1,txt_b022 -block_3ds 0xb030, 3,1,txt_b030 -block_3ds 0xa040, 3,1,txt_a040 -block_3ds 0xa041, 3,1,txt_a041 -block_3ds 0xa050, 3,1,txt_a050 -block_3ds 0xa052, 3,1,txt_a052 -block_3ds 0xa053, 3,1,txt_a053 -block_3ds 0xa081, 3,1,txt_a081 -block_3ds 0xa083, 3,1,txt_a083 -block_3ds 0xa084, 3,1,txt_a084 -block_3ds 0xa085, 3,1,txt_a085 -block_3ds 0xa087, 3,1,txt_a087 -block_3ds 0xa088, 3,1,txt_a088 -block_3ds 0xa08a, 3,1,txt_a08a -block_3ds 0xa08c, 3,1,txt_a08c -block_3ds 0xa08e, 3,1,txt_a08e -.end: - -if lang eq ru_RU -txt_0002 db '3ds ',0 -txt_0011 db ' rgb (⮢ ଠ)',0 -;txt_0012 db 'LIN_COLOR_24',0 -;txt_0030 db 'Percentage value (int)',0 -;txt_0031 db 'Percentage value (float)',0 -txt_0100 db 'Master scale',0 -txt_2100 db ' 㦠饩 ।',0 -txt_3d3d db ' ꥪ⮢',0 -txt_4000 db 'ꥪ ( )',0 -txt_4100 db '㣮 ⪨',0 -txt_4110 db '᮪ 設',0 -txt_4120 db '᮪ ࠭',0 -txt_4130 db 'ਠ ࠭',0 -txt_4140 db ' न',0 -txt_4160 db ' ॢ',0 -txt_4600 db '',0 -txt_4700 db '',0 -txt_a000 db ' ਠ',0 -txt_a010 db '㦠騩 梥',0 -txt_a020 db '㧭 梥',0 -txt_a030 db 'ઠ 梥',0 -txt_a100 db ' ਠ [1=flat 2=gouraud 3=phong 4=metal]',0 -txt_a200 db ' ਠ 1',0 -txt_a300 db ' 䠩 ⥪',0 -;txt_a353 db 'MAT_MAP_TEXBLUR',0 -txt_afff db 'ਠ',0 -txt_b000 db 'ଠ 樨',0 -txt_b002 db ' ꥪ',0 -;txt_b009 db 'KFCURTIME',0 -;txt_b00a db 'KFHDR',0 -txt_b010 db ' ꥪ',0 -txt_b011 db ' ',0 -txt_b013 db ' 饭 ꥪ',0 -txt_b014 db 'Bound box',0 -txt_b020 db 'ࠥ ',0 -txt_b021 db 'ࠥ 饭',0 -txt_b003 db ' ',0 -txt_b023 db ' fov ',0 -txt_b024 db ' roll ',0 -txt_b004 db ' "楫" ',0 - -;--- ᬮ ᠭ ᪮ 몥 -txt_4111 db ' 設',0 -txt_4150 db 'Smoothing group list',0 -txt_4165 db 'Object color in editor',0 -txt_4610 db 'ࠢ ᢥ',0 -txt_4627 db 'Spot raytrace',0 -txt_4630 db 'Light shadowed',0 -txt_4641 db 'Spot shadow map',0 -txt_4650 db 'Spot show cone',0 -txt_4651 db 'Spot is rectangular',0 -txt_4652 db 'Spot overshoot',0 -txt_4653 db 'Spot map',0 -txt_4656 db 'Spot roll',0 -txt_4658 db 'Spot ray trace bias',0 -txt_4620 db 'Light off',0 -txt_4625 db 'Attenuation on',0 -txt_4659 db 'Range start',0 -txt_465a db 'Range end',0 -txt_465b db 'Multiplier',0 -txt_a230 db '⪠ ५',0 -txt_a220 db '⪠ ࠦ',0 -txt_a351 db 'ࠬ ࠧ⪨',0 -txt_b007 db 'ଠ ࠢ ᢥ饭',0 -txt_b008 db ' (砫 )',0 -txt_b022 db '⠡஢',0 -txt_b030 db ' 娨',0 -txt_a040 db 'Shininess percent',0 -txt_a041 db 'Shininess strength percent',0 -txt_a050 db 'Transparency percent',0 -txt_a052 db 'Transparency falloff percent',0 -txt_a053 db 'Reflection blur percent',0 -txt_a081 db '2 sided',0 -txt_a083 db 'Add trans',0 -txt_a084 db 'Self illum',0 -txt_a085 db 'Wire frame on',0 -txt_a087 db 'Wire thickness',0 -txt_a088 db 'Face map',0 -txt_a08a db 'In tranc',0 -txt_a08c db 'Soften',0 -txt_a08e db 'Wire in units',0 - -txt_not_delete db ' 㤠 ࠭ . 饭.',0 -else - -txt_0002 db '3ds version',0 -txt_0011 db 'Color rgb (byte format)',0 -txt_0100 db 'Master scale',0 -txt_2100 db 'Ambient color',0 -txt_3d3d db 'Editor chunk',0 -txt_4000 db 'Object (with name)',0 -txt_4100 db 'Triangular mesh',0 -txt_4110 db 'Vertices list',0 -txt_4120 db 'Faces description',0 -txt_4130 db 'Faces material',0 -txt_4140 db 'Mapping coordinates list',0 -txt_4160 db 'Local coordinate system',0 -txt_4600 db 'Light',0 -txt_4700 db 'Camera',0 -txt_a000 db 'Material name',0 -txt_a010 db 'Ambient color',0 -txt_a020 db 'Diffuse color',0 -txt_a030 db 'Specular color',0 -txt_a100 db 'Material type [1=flat 2=gouraud 3=phong 4=metal]',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_b011 db 'Instance name',0 -txt_b013 db 'Object pivot point',0 -txt_b014 db 'Bound box',0 -txt_b020 db 'Position track',0 -txt_b021 db 'Rotation track',0 -txt_b003 db 'Camera information',0 -txt_b023 db 'Fov track',0 -txt_b024 db 'Roll track',0 -txt_b004 db 'Camera target information',0 - -;--- -txt_4111 db 'Vertex flags',0 -txt_4150 db 'Smoothing group list',0 -txt_4165 db 'Object color in editor',0 -txt_4610 db 'Spotlight',0 -txt_4627 db 'Spot raytrace',0 -txt_4630 db 'Light shadowed',0 -txt_4641 db 'Spot shadow map',0 -txt_4650 db 'Spot show cone',0 -txt_4651 db 'Spot is rectangular',0 -txt_4652 db 'Spot overshoot',0 -txt_4653 db 'Spot map',0 -txt_4656 db 'Spot roll',0 -txt_4658 db 'Spot ray trace bias',0 -txt_4620 db 'Light off',0 -txt_4625 db 'Attenuation on',0 -txt_4659 db 'Range start',0 -txt_465a db 'Range end',0 -txt_465b db 'Multiplier',0 -txt_a230 db 'Bump map',0 -txt_a220 db 'Reflection map',0 -txt_a351 db 'Mapping parameters',0 -txt_b007 db 'Spot light information',0 -txt_b008 db 'Frames (Start and End)',0 -txt_b022 db 'Scale track',0 -txt_b030 db 'Hierarchy position',0 -txt_a040 db 'Shininess percent',0 -txt_a041 db 'Shininess strength percent',0 -txt_a050 db 'Transparency percent',0 -txt_a052 db 'Transparency falloff percent',0 -txt_a053 db 'Reflection blur percent',0 -txt_a081 db '2 sided',0 -txt_a083 db 'Add trans',0 -txt_a084 db 'Self illum',0 -txt_a085 db 'Wire frame on',0 -txt_a087 db 'Wire thickness',0 -txt_a088 db 'Face map',0 -txt_a08a db 'In tranc',0 -txt_a08c db 'Soften',0 -txt_a08e db 'Wire in units',0 - -txt_not_delete db 'I can not delete the selected chunk. It is protected.',0 -end if - -if lang eq ru_RU -txt_open_3ds db ' 䠩:',0 -txt_no_3ds: db ' 䠩 ଠ *.3ds ',39 - .zag: rb 8 - db 39,0 -txt_3ds_err_sizes db ' 䠩 ०',0 -txt_count db '⢮',0 -txt_3ds_offs: - db '饭: ' - .dig: rb 8 - db ' : ' - .siz: rb 8 - db 0 -txt_mat_null db 'ਠ ',0 -else -txt_open_3ds db 'Open file:',0 -txt_no_3ds: db 'Open file not in format *.3ds ',39 - .zag: rb 8 - db 39,0 -txt_3ds_err_sizes db 'File may be corrupted',0 -txt_count db 'Count',0 -txt_3ds_offs: - db 'Offset: ' - .dig: rb 8 - db ' Size: ' - .siz: rb 8 - db 0 -txt_mat_null db 'No materials found',0 -end if +; +; ᮡ࠭ *.3ds +; + +; Language support for locales: ru_RU (CP866), en_US. + +MAX_FILE_LEVEL equ 20 ;ᨬ ஢ + +sizeof.block_3ds equ 9 +can_save db 0 ; 䠩 + +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_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 ; [-] "楫" + +; ᮤঠ , ⬥祭 ᮬ, ⠫ +; + +align 4 +type_bloks: +block_3ds 0x0002,5,1,txt_0002 +block_3ds 0x3d3e,5,1 ; [+] mesh version +block_3ds 0x0011,4,1,txt_0011 +block_3ds 0x0100,3,1,txt_0100 +block_3ds CHUNK_ambient_color,3,0,txt_2100 ; [-] ambient color +block_3ds CHUNK_OBJMESH, 3,0,txt_3d3d +block_3ds CHUNK_OBJBLOCK,11,1,txt_4000 +block_3ds CHUNK_TRIMESH, 3,0,txt_4100 +block_3ds CHUNK_VERTLIST,8,1,txt_4110 +block_3ds CHUNK_FACELIST,3,1,txt_4120 +block_3ds CHUNK_FACEMAT,10,1,txt_4130 +block_3ds CHUNK_MAPLIST, 3,1,txt_4140 +block_3ds CHUNK_TRMATRIX,3,1,txt_4160 +block_3ds 0x4600,3,1,txt_4600 +block_3ds CHUNK_CAMERA, 3,1,txt_4700 +block_3ds CHUNK_MATERIAL,10,0,txt_afff +block_3ds CHUNK_MATNAME, 3,1,txt_a000 +block_3ds 0xa010,4,0,txt_a010 +block_3ds 0xa020,4,0,txt_a020 +block_3ds 0xa030,4,0,txt_a030 +block_3ds 0xa100,5,1,txt_a100 +block_3ds CHUNK_TEXTURE, 3,0,txt_a200 +block_3ds CHUNK_MAPFILE, 6,1,txt_a300 +block_3ds CHUNK_KEYFRAMER, 7,0,txt_b000 +block_3ds CHUNK_TRACKINFO, 3,0,txt_b002 +block_3ds CHUNK_TRACKOBJNAME,3,1,txt_b010 +block_3ds 0xb011,3,1,txt_b011 +block_3ds CHUNK_TRACKPIVOT, 3,1,txt_b013 +block_3ds 0xb014,3,1,txt_b014 +block_3ds CHUNK_TRACKPOS, 3,1,txt_b020 +block_3ds CHUNK_TRACKROTATE, 3,1,txt_b021 +block_3ds CHUNK_TRACKCAMERA, 7,0,txt_b003 +block_3ds CHUNK_TRACKFOV, 7,1,txt_b023 +block_3ds CHUNK_TRACKROLL, 7,1,txt_b024 +block_3ds CHUNK_TRACKCAMTGT, 7,0,txt_b004 + +;--- ᬮ ᠭ ᪮ 몥 +block_3ds 0x4111, 3,1,txt_4111 +block_3ds 0x4150, 3,1,txt_4150 +block_3ds 0x4165, 3,1,txt_4165 +block_3ds 0x4610, 3,1,txt_4610 +block_3ds 0x4627, 3,1,txt_4627 +block_3ds 0x4630, 3,1,txt_4630 +block_3ds 0x4641, 3,1,txt_4641 +block_3ds 0x4650, 3,1,txt_4650 +block_3ds 0x4651, 3,1,txt_4651 +block_3ds 0x4652, 3,1,txt_4652 +block_3ds 0x4653, 3,1,txt_4653 +block_3ds 0x4656, 3,1,txt_4656 +block_3ds 0x4658, 3,1,txt_4658 +block_3ds 0x4620, 3,1,txt_4620 +block_3ds 0x4625, 3,1,txt_4625 +block_3ds 0x4659, 3,1,txt_4659 +block_3ds 0x465a, 3,1,txt_465a +block_3ds 0x465b, 3,1,txt_465b +block_3ds 0xa230, 3,1,txt_a230 +block_3ds 0xa220, 3,1,txt_a220 +block_3ds 0xa351, 3,1,txt_a351 +block_3ds 0xb007, 3,1,txt_b007 +block_3ds 0xb008, 3,1,txt_b008 +block_3ds 0xb022, 3,1,txt_b022 +block_3ds 0xb030, 3,1,txt_b030 +block_3ds 0xa040, 3,1,txt_a040 +block_3ds 0xa041, 3,1,txt_a041 +block_3ds 0xa050, 3,1,txt_a050 +block_3ds 0xa052, 3,1,txt_a052 +block_3ds 0xa053, 3,1,txt_a053 +block_3ds 0xa081, 3,1,txt_a081 +block_3ds 0xa083, 3,1,txt_a083 +block_3ds 0xa084, 3,1,txt_a084 +block_3ds 0xa085, 3,1,txt_a085 +block_3ds 0xa087, 3,1,txt_a087 +block_3ds 0xa088, 3,1,txt_a088 +block_3ds 0xa08a, 3,1,txt_a08a +block_3ds 0xa08c, 3,1,txt_a08c +block_3ds 0xa08e, 3,1,txt_a08e +.end: + +if lang eq ru_RU +txt_0002 db '3ds ',0 +txt_0011 db ' rgb (⮢ ଠ)',0 +;txt_0012 db 'LIN_COLOR_24',0 +;txt_0030 db 'Percentage value (int)',0 +;txt_0031 db 'Percentage value (float)',0 +txt_0100 db 'Master scale',0 +txt_2100 db ' 㦠饩 ।',0 +txt_3d3d db ' ꥪ⮢',0 +txt_4000 db 'ꥪ ( )',0 +txt_4100 db '㣮 ⪨',0 +txt_4110 db '᮪ 設',0 +txt_4120 db '᮪ ࠭',0 +txt_4130 db 'ਠ ࠭',0 +txt_4140 db ' न',0 +txt_4160 db ' ॢ',0 +txt_4600 db '',0 +txt_4700 db '',0 +txt_a000 db ' ਠ',0 +txt_a010 db '㦠騩 梥',0 +txt_a020 db '㧭 梥',0 +txt_a030 db 'ઠ 梥',0 +txt_a100 db ' ਠ [1=flat 2=gouraud 3=phong 4=metal]',0 +txt_a200 db ' ਠ 1',0 +txt_a300 db ' 䠩 ⥪',0 +;txt_a353 db 'MAT_MAP_TEXBLUR',0 +txt_afff db 'ਠ',0 +txt_b000 db 'ଠ 樨',0 +txt_b002 db ' ꥪ',0 +;txt_b009 db 'KFCURTIME',0 +;txt_b00a db 'KFHDR',0 +txt_b010 db ' ꥪ',0 +txt_b011 db ' ',0 +txt_b013 db ' 饭 ꥪ',0 +txt_b014 db 'Bound box',0 +txt_b020 db 'ࠥ ',0 +txt_b021 db 'ࠥ 饭',0 +txt_b003 db ' ',0 +txt_b023 db ' fov ',0 +txt_b024 db ' roll ',0 +txt_b004 db ' "楫" ',0 + +;--- ᬮ ᠭ ᪮ 몥 +txt_4111 db ' 設',0 +txt_4150 db 'Smoothing group list',0 +txt_4165 db 'Object color in editor',0 +txt_4610 db 'ࠢ ᢥ',0 +txt_4627 db 'Spot raytrace',0 +txt_4630 db 'Light shadowed',0 +txt_4641 db 'Spot shadow map',0 +txt_4650 db 'Spot show cone',0 +txt_4651 db 'Spot is rectangular',0 +txt_4652 db 'Spot overshoot',0 +txt_4653 db 'Spot map',0 +txt_4656 db 'Spot roll',0 +txt_4658 db 'Spot ray trace bias',0 +txt_4620 db 'Light off',0 +txt_4625 db 'Attenuation on',0 +txt_4659 db 'Range start',0 +txt_465a db 'Range end',0 +txt_465b db 'Multiplier',0 +txt_a230 db '⪠ ५',0 +txt_a220 db '⪠ ࠦ',0 +txt_a351 db 'ࠬ ࠧ⪨',0 +txt_b007 db 'ଠ ࠢ ᢥ饭',0 +txt_b008 db ' (砫 )',0 +txt_b022 db '⠡஢',0 +txt_b030 db ' 娨',0 +txt_a040 db 'Shininess percent',0 +txt_a041 db 'Shininess strength percent',0 +txt_a050 db 'Transparency percent',0 +txt_a052 db 'Transparency falloff percent',0 +txt_a053 db 'Reflection blur percent',0 +txt_a081 db '2 sided',0 +txt_a083 db 'Add trans',0 +txt_a084 db 'Self illum',0 +txt_a085 db 'Wire frame on',0 +txt_a087 db 'Wire thickness',0 +txt_a088 db 'Face map',0 +txt_a08a db 'In tranc',0 +txt_a08c db 'Soften',0 +txt_a08e db 'Wire in units',0 + +txt_not_delete db ' 㤠 ࠭ . 饭.',0 + +else ; Default to en_US + +txt_0002 db '3ds version',0 +txt_0011 db 'Color rgb (byte format)',0 +txt_0100 db 'Master scale',0 +txt_2100 db 'Ambient color',0 +txt_3d3d db 'Editor chunk',0 +txt_4000 db 'Object (with name)',0 +txt_4100 db 'Triangular mesh',0 +txt_4110 db 'Vertices list',0 +txt_4120 db 'Faces description',0 +txt_4130 db 'Faces material',0 +txt_4140 db 'Mapping coordinates list',0 +txt_4160 db 'Local coordinate system',0 +txt_4600 db 'Light',0 +txt_4700 db 'Camera',0 +txt_a000 db 'Material name',0 +txt_a010 db 'Ambient color',0 +txt_a020 db 'Diffuse color',0 +txt_a030 db 'Specular color',0 +txt_a100 db 'Material type [1=flat 2=gouraud 3=phong 4=metal]',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_b011 db 'Instance name',0 +txt_b013 db 'Object pivot point',0 +txt_b014 db 'Bound box',0 +txt_b020 db 'Position track',0 +txt_b021 db 'Rotation track',0 +txt_b003 db 'Camera information',0 +txt_b023 db 'Fov track',0 +txt_b024 db 'Roll track',0 +txt_b004 db 'Camera target information',0 + +;--- +txt_4111 db 'Vertex flags',0 +txt_4150 db 'Smoothing group list',0 +txt_4165 db 'Object color in editor',0 +txt_4610 db 'Spotlight',0 +txt_4627 db 'Spot raytrace',0 +txt_4630 db 'Light shadowed',0 +txt_4641 db 'Spot shadow map',0 +txt_4650 db 'Spot show cone',0 +txt_4651 db 'Spot is rectangular',0 +txt_4652 db 'Spot overshoot',0 +txt_4653 db 'Spot map',0 +txt_4656 db 'Spot roll',0 +txt_4658 db 'Spot ray trace bias',0 +txt_4620 db 'Light off',0 +txt_4625 db 'Attenuation on',0 +txt_4659 db 'Range start',0 +txt_465a db 'Range end',0 +txt_465b db 'Multiplier',0 +txt_a230 db 'Bump map',0 +txt_a220 db 'Reflection map',0 +txt_a351 db 'Mapping parameters',0 +txt_b007 db 'Spot light information',0 +txt_b008 db 'Frames (Start and End)',0 +txt_b022 db 'Scale track',0 +txt_b030 db 'Hierarchy position',0 +txt_a040 db 'Shininess percent',0 +txt_a041 db 'Shininess strength percent',0 +txt_a050 db 'Transparency percent',0 +txt_a052 db 'Transparency falloff percent',0 +txt_a053 db 'Reflection blur percent',0 +txt_a081 db '2 sided',0 +txt_a083 db 'Add trans',0 +txt_a084 db 'Self illum',0 +txt_a085 db 'Wire frame on',0 +txt_a087 db 'Wire thickness',0 +txt_a088 db 'Face map',0 +txt_a08a db 'In tranc',0 +txt_a08c db 'Soften',0 +txt_a08e db 'Wire in units',0 + +txt_not_delete db 'Cannot delete the selected chunk: it is protected.',0 +end if + +if lang eq ru_RU +txt_open_3ds db ' 䠩:',0 +txt_no_3ds: db ' 䠩 ଠ *.3ds ',39 + .zag: rb 8 + db 39,0 +txt_3ds_err_sizes db ' 䠩 ०',0 +txt_count db '⢮',0 +txt_3ds_offs: + db '饭: ' + .dig: rb 8 + db ' : ' + .siz: rb 8 + db 0 +txt_mat_null db 'ਠ ',0 + +else ; Default to en_US +txt_open_3ds db 'Open file:',0 +txt_no_3ds: db 'Open file not in format *.3ds ',39 + .zag: rb 8 + db 39,0 +txt_3ds_err_sizes db 'File may be corrupted',0 +txt_count db 'Count',0 +txt_3ds_offs: + db 'Offset: ' + .dig: rb 8 + db ' Size: ' + .siz: rb 8 + db 0 +txt_mat_null db 'No materials found',0 +end if diff --git a/programs/develop/info3ds/info3ds.asm b/programs/develop/info3ds/info3ds.asm index 221225dd76..839a60de14 100644 --- a/programs/develop/info3ds/info3ds.asm +++ b/programs/develop/info3ds/info3ds.asm @@ -1,1399 +1,1399 @@ -use32 - org 0 - db 'MENUET01' ;. ᯮ塞 䠩 ᥣ 8 - dd 1, start, i_end, mem, stacktop, file_name, sys_path - -version_edit equ 1 - -include '../../macros.inc' -include '../../proc32.inc' -include '../../KOSfuncs.inc' -include '../../develop/libraries/libs-dev/libimg/libimg.inc' -include '../../load_img.inc' -include '../../load_lib.mac' -include '../../develop/libraries/box_lib/trunk/box_lib.mac' -include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc' -include 'lang.inc' -include 'info_fun_float.inc' -include 'info_menu.inc' -include 'data.inc' -include 'convert_stl_3ds.inc' - -@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load - -ID_ICON_CHUNK_MAIN equ 0 ; -ID_ICON_CHUNK_NOT_FOUND equ 1 ; ⭮ -ID_ICON_DATA equ 2 ; , । -ID_ICON_POINT equ 8 -ID_ICON_POINT_SEL equ 9 - -FILE_ERROR_CHUNK_SIZE equ -3 ;訡 ࠧ - -include 'info_o3d.inc' - -main_wnd_height equ 460 ; ணࠬ -IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3 - -align 4 -fl255 dd 255.0 -open_file_data dd 0 ;㪠⥫ 䠩 3ds -open_file_size dd 0 ;ࠧ ⮣ 䠩 -image_data_toolbar dd 0 -icon_tl_sys dd 0 ;㪠⥥ ࠭ ⥬ -icon_toolbar dd 0 ;㪠⥥ ࠭ ꥪ⮢ -fn_toolbar db 'toolbar.png',0 - -align 4 -level_stack dd 0 -offs_last_timer dd 0 ;᫥ ᤢ 㭪樨 ⠩ - -align 4 -file_3ds: ;६ ᯮ㥬 ⨨ 䠩 -.offs: dd 0 ;+0 㪠⥫ 砫 -.size: dd 0 ;+4 ࠧ ( 1- ࠬ = ࠧ 䠩 3ds) -rb 8*MAX_FILE_LEVEL - -size_one_list equ 42 -list_offs_chunk_del equ 8 ; 㤠 -list_offs_chunk_lev equ 9 ;஢ (யᠭ 㧫) -list_offs_p_data equ 10 ;㪠⥫ -list_offs_text equ 14 ;ᤢ 砫 ⥪ -buffer rb size_one_list ; ᯨ᮪ tree1 - -txt_3ds_symb db 0,0 -;-------------------------------------- - -include 'info_wnd_coords.inc' - -align 4 -start: - ;--- copy cmd line --- - mov esi,file_name - mov edi,openfile_path -@@: - lodsd - or eax,eax - jz @f ;室, ᫨ 0 - stosd - jmp @b -@@: - stosd - - load_libraries l_libs_start,l_libs_end - ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ - mov ebp,lib_0 - .test_lib_open: - cmp dword [ebp+ll_struc_size-4],0 - jz @f - mcall SF_TERMINATE_PROCESS ;exit not correct - @@: - add ebp,ll_struc_size - cmp ebp,l_libs_end - jl .test_lib_open - mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors - mcall SF_SET_EVENTS_MASK,0xC0000027 - - stdcall [OpenDialog_Init],OpenDialog_data ;⮢ - - ;kmenu initialisation - stdcall [kmenu_init],sc - stdcall [ksubmenu_new] - mov [main_menu], eax - - stdcall [ksubmenu_new] - mov [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Vertexes, 5 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces, 6 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces_Fill, 7 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Light, 8 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Smooth, 9 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Reset, 10 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_View, [main_menu_view] - stdcall [ksubmenu_add], [main_menu], eax - - stdcall [ksubmenu_new] - mov [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Vertexes_Select, 11 - stdcall [ksubmenu_add], [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Vertexes_Deselect, 12 - stdcall [ksubmenu_add], [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 - stdcall [ksubmenu_add], [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Average_x, 13 - stdcall [ksubmenu_add], [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Average_y, 14 - stdcall [ksubmenu_add], [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Average_z, 15 - stdcall [ksubmenu_add], [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Vertexes, [main_menu_vertexes] - stdcall [ksubmenu_add], [main_menu], eax - - mov dword[w_scr_t1.type],1 - stdcall [tl_data_init], tree1 - ;⥬ 16*16 tree_list - include_image_file 'tl_sys_16.png', icon_tl_sys - ;᫨ ࠦ 뫮, icon_tl_sys - ; 樠஢ , 訡 㤥, . . 㦭 ࠧ - mov eax,dword[icon_tl_sys] - mov dword[tree1.data_img_sys],eax - - load_image_file 'objects.png', icon_toolbar - mov eax,dword[icon_toolbar] - mov dword[tree1.data_img],eax - - stdcall [buf2d_create], buf_0 ;ᮧ - - load_image_file 'font8x9.bmp', image_data_toolbar - 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 - - ;ࠡ 䠩 ஥ - copy_path ini_name,sys_path,file_name,0 - mov dword[def_dr_mode],0 - stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dv,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_vertexes - @@: - stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_df,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_faces - @@: - stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dff,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_faces_fill - @@: - stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dl,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_light - @@: - stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_ds,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_smooth - @@: - stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_ox,0x0000ff - mov [color_ox],eax - stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_oy,0xff0000 - mov [color_oy],eax - stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_oz,0x00ff00 - mov [color_oz],eax - stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_bk,0x000000 - mov [color_bk],eax - shr eax,8 - mov [color_bk+4],eax - shr eax,8 - mov [color_bk+8],eax - stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_vert,0xffffff - mov [color_vert],eax - stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_face,0x808080 - mov [color_face],eax - stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_select,0xffff00 - mov [color_select],eax - finit - fild dword[color_bk+8] - fdiv dword[fl255] - fstp dword[color_bk+8] - mov eax,[color_bk+4] - and eax,0xff - mov [color_bk+4],eax - fild dword[color_bk+4] - fdiv dword[fl255] - fstp dword[color_bk+4] - mov eax,[color_bk] - and eax,0xff - mov [color_bk],eax - fild dword[color_bk] - fdiv dword[fl255] - fstp dword[color_bk] - - 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 - stdcall [glEnable], GL_DEPTH_TEST - stdcall [glEnable], GL_NORMALIZE ; ଠ 稭 䠪⮢ - stdcall [glClearColor], [color_bk+8],[color_bk+4],[color_bk],0.0 - stdcall [glShadeModel], GL_SMOOTH - call [gluNewQuadric] - mov [qObj],eax - - mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext - mov eax,[eax] ;eax -> ZBuffer - mov eax,[eax+ZBuffer.pbuf] - mov dword[buf_ogl],eax - - ;open file from cmd line - cmp dword[openfile_path],0 - je @f - call but_open_file.no_dlg - @@: - call draw_window - -align 4 -still: - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov ebx,[last_time] - add ebx,10 ;প - cmp ebx,eax - jge @f - mov ebx,eax - @@: - sub ebx,eax - mcall SF_WAIT_EVENT_TIMEOUT - or eax,eax - jz timer_funct - - cmp al,1 - jne @f - call draw_window - jmp still - @@: - cmp al,2 - jz key - cmp al,3 - jz button - cmp al,6 - jne @f - mcall SF_THREAD_INFO,procinfo,-1 - cmp ax,word[procinfo+4] - jne @f ; ⨢ - call mouse - @@: - jmp still - -align 4 -mouse: - stdcall [tl_mouse], dword tree1 - ret - -align 4 -timer_funct: - pushad - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov [last_time],eax - - ;ᬠਢ 뤥 - stdcall [tl_node_get_data],tree1 - cmp eax,0 - je @f - mov ebx,eax - mov eax,dword[ebx] - mov ecx,dword[ebx+4] ;ࠧ - stdcall hex_in_str, txt_3ds_offs.dig, eax,8 - stdcall hex_in_str, txt_3ds_offs.siz, ecx,8 - - add eax,dword[open_file_data] ;砥 祭 ᤢ - cmp dword[offs_last_timer],eax - je @f - ;᫨ 뤥 ᮢ ᫥ - mov dword[offs_last_timer],eax - stdcall buf_draw_beg, buf_0 - stdcall [buf2d_draw_text], buf_0, buf_1,txt_3ds_offs,5,35,0xb000 - mov edx,dword[ebx+list_offs_p_data] - 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 -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_data] - 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 uses eax ebx ecx, coord_y:dword - 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 - ret -endp - -align 4 -draw_window: -pushad - mcall SF_REDRAW,SSF_BEGIN_DRAW - xor eax,eax - mov edx,[sc.work] - or edx,0x33000000 - mov edi,capt - mcall , (20 shl 16)+560, (20 shl 16)+main_wnd_height - - mcall SF_THREAD_INFO,procinfo,-1 - mov eax,dword[procinfo.box.height] - cmp eax,250 - jge @f - mov eax,250 - @@: - sub eax,65 - mov dword[tree1.box_height],eax - mov word[w_scr_t1.y_size],ax ; ࠧ ஫ - cmp eax,dword[buf_0.h] ;㢥稢 - jle @f - stdcall [buf2d_resize],buf_0,0,eax,1 - mov dword[offs_last_timer],0 ; ⠩ - @@: - - mov eax,dword[procinfo.box.width] - cmp eax,400 - jge @f - mov eax,400 - @@: - sub eax,[buf_0.w] - sub eax,41 - mov dword[tree1.box_width],eax - add ax,word[tree1.box_left] - mov word[w_scr_t1.x_pos],ax - add ax,16+5 - mov word[buf_0.l],ax - - mov esi,[sc.work_button] - mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,0x40000003 - mcall ,(30 shl 16)+20,,0x40000004 - - cmp byte[can_save],0 - je @f - mcall ,(55 shl 16)+20,,0x40000005 - @@: - mcall ,(85 shl 16)+20,,0x40000006 ; न⠬ - mcall ,(110 shl 16)+20,,0x40000007 ;㤠 - - mcall SF_PUT_IMAGE,[image_data_toolbar],(21 shl 16)+21,(5 shl 16)+5 ;new - - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mov edx,(30 shl 16)+5 ;open - int 0x40 - - cmp byte[can_save],0 - je @f - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mov edx,(55 shl 16)+5 ;save - int 0x40 - sub ebx,IMAGE_TOOLBAR_ICON_SIZE - @@: - - add ebx,4*IMAGE_TOOLBAR_ICON_SIZE - mov edx,(85 shl 16)+5 - int 0x40 - - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mov edx,(110 shl 16)+5 - int 0x40 - - mov dword[w_scr_t1.all_redraw],1 - stdcall [tl_draw], tree1 - - stdcall [buf2d_draw], buf_0 - - mcall SF_REDRAW,SSF_END_DRAW -popad - ret - -align 4 -key: - mcall SF_GET_KEY - stdcall [tl_key], dword tree1 - jmp still - - -align 4 -button: - mcall SF_GET_BUTTON - cmp ah,3 - jne @f - call but_new_file - jmp still - @@: - cmp ah,4 - jne @f - call but_open_file - jmp still - @@: - cmp ah,5 - jne @f - call but_save_file - jmp still - @@: - cmp ah,6 - jne @f - call but_wnd_coords - jmp still - @@: - cmp ah,7 - jne @f - call but_delete_chunk - jmp still - @@: - - cmp ah,1 - jne still -.exit: - mov dword[tree1.data_img],0 - mov dword[tree1.data_img_sys],0 - stdcall [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_data] - stdcall [gluDeleteQuadric], [qObj] - mcall SF_TERMINATE_PROCESS - - -align 4 -but_new_file: - mov byte[can_save],0 - stdcall [tl_info_clear], tree1 ;⪠ ᯨ᪠ ꥪ⮢ - stdcall [buf2d_clear], buf_0, [buf_0.color] ;⨬ - stdcall [tl_draw], tree1 - stdcall [buf2d_draw], buf_0 ;塞 ࠭ - ret - -align 4 -but_open_file: - copy_path open_dialog_name,communication_area_default_path,file_name,0 - pushad - mov [OpenDialog_data.type],0 - stdcall [OpenDialog_Start],OpenDialog_data - cmp [OpenDialog_data.status],2 - je .end_open_file - ; 㤠筮 ⨨ - jmp .end0 -.no_dlg: ;᫨ 㥬 䠩 - pushad - mov esi,openfile_path - stdcall str_len,esi - add esi,eax - @@: ;横 ᪠ 砫 䠩 - dec esi - cmp byte[esi],'/' - je @f - cmp byte[esi],0x5c ;'\' - je @f - cmp esi,openfile_path - jg @b - @@: - inc esi - stdcall [OpenDialog_Set_file_name],OpenDialog_data,esi ;㥬 䠩 ࠭ - .end0: - 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 - mcall SF_FILE,run_file_70 - - mov ecx,dword[open_b+32] ;+32 qword: ࠧ 䠩 - stdcall mem.ReAlloc,[open_file_data],ecx - mov [open_file_data],eax - - 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 - mcall SF_FILE,run_file_70 ;㦠 䠩 3ds - cmp ebx,0xffffffff - je .end_open_file - - mov [open_file_size],ebx - ;mcall SF_SET_CAPTION,1,openfile_path - - mov byte[can_save],0 - call init_tree - stdcall [buf2d_draw], buf_0 ;塞 ࠭ - stdcall obj_clear_param, o3d ;⨬ ࠬ न⠬ - cmp byte[prop_wnd_run],0 - je @f - ;⨬ न⠬ - stdcall [tl_info_clear], tree3 - @@: - - .end_open_file: - popad - ret - -align 4 -init_tree: - stdcall [tl_info_clear], tree1 ;⪠ ᯨ᪠ ꥪ⮢ - - mov esi,[open_file_data] - stdcall convert_stl_3ds, esi,[open_file_size] ;஢塞 䠩 ଠ *.stl ? - or eax,eax - jz @f - ;᫨ 䠩 ଠ *.stl - mov [open_file_size],ecx - mov esi,eax - stdcall mem.Free,[open_file_data] - mov [open_file_data],esi - mov byte[can_save],1 - @@: - cmp word[esi],CHUNK_MAIN - je @f - stdcall buf_draw_beg, buf_0 - stdcall [buf2d_draw_text], buf_0, buf_1,txt_no_3ds,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,[file_3ds.offs] - add edi,[file_3ds.size] - .cycle_main: - cmp dword[level_stack],0 - jle .end_cycle - - cmp esi,edi ;᫨ 䠩 - jge .end_cycle - - mov edx,[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: - ret - -; -;input: -; eax - stack pointer -; 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 - 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 ;㦥 ᤥ repne - jmp .next_bl - @@: - cmp dx,CHUNK_VERTLIST ;ᯨ᮪ 設 - je .vertexes - cmp dx,0x4111 ;䫠 設 - je .vertexes - cmp dx,CHUNK_MAPLIST ;⥪ न - je .vertexes - jmp @f - .vertexes: ;ࠡ⪠ , ᮤঠ 設 - stdcall add_3ds_object, ID_ICON_DATA,ebx,2,txt_count ;᫮ 設 - add esi,2 - sub ecx,2 - stdcall add_3ds_object, ID_ICON_DATA,ebx,ecx,0 ; 設 - sub esi,8 ;⠭ esi - call block_next - jmp .end_f - @@: - cmp dx,CHUNK_FACELIST ;ᯨ᮪ ࠭ - jne @f - stdcall add_3ds_object, ID_ICON_DATA,ebx,2,txt_count ;᫮ ࠭ - push eax - movzx eax,word[esi] - shl eax,3 - add esi,2 - sub ecx,2 - stdcall add_3ds_object, ID_ICON_DATA,ebx,eax,0 ; ࠭ - - sub ecx,eax - cmp ecx,1 - jl .data_3 ;஢塞 뢠騩 ਠ, ਬ塞 ꥪ -if 0 - add esi,eax - mov ecx,dword[esi+2] - stdcall add_3ds_object, 10,ebx,ecx,0 ; ਠ - sub esi,eax -else - add esi,eax - pop eax - jmp .next_bl -end if - .data_3: - - sub esi,8 ;⠭ esi - pop eax - call block_next - jmp .end_f - @@: - cmp dx,CHUNK_FACEMAT ;ਠ ࠭ - jne @f - 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 ;㦥 ᤥ repne - stdcall add_3ds_object, ID_ICON_DATA,ebx,2,txt_count ;᫮ ࠭ - add esi,2 - sub ecx,2 - stdcall add_3ds_object, ID_ICON_DATA,ebx,ecx,0 ; ࠭, ਬ ਠ - sub esi,edi ;⠭ esi (1) - sub esi,8 ;⠭ esi (2) - call block_next - jmp .end_f - @@: - ; *** 묨 㬮砭 ( 뤥 ) - 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- ୨ -;input: -; eax - 㪠⥫ ६ ⥪ 䠩 file_3ds -; esi - 砫 த⥫᪮ -;output: -; ebx - destroy -; esi - 砫 த⥫᪮ -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 [eax],esi ;㪠⥫ 砫 - mov ebx,[esi+2] - mov [eax+4],ebx ;ࠧ - add esi,6 ;室 - inc dword[level_stack] - add eax,8 - .end_f: - pop ecx - ret - -;室 ᫥饬 ⥪饣 ஢ -;input: -; eax - ६묨 -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 - 㪠⥫ 㥬 -; icon - -; level - ஢ 㧫 -; size_bl - ࠧ -; info_bl - ப ᠭ -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_data] - mov dword[buffer],eax ;ᬥ饭 - mov ecx,dword[size_bl] - mov dword[buffer+4],ecx ;ࠧ (ᯮ 㭪樨 buf_draw_hex_table ᮢ ) - mov ecx,dword[bl_found] - or ecx,ecx - jz @f - ;... 㦥 㣮 㤠 - mov cl,byte[ecx+4] - @@: - mov byte[buffer+list_offs_chunk_del],cl - mov ecx,[level] - mov byte[buffer+list_offs_chunk_lev],cl - mov ecx,dword[info_bl] - mov dword[buffer+list_offs_p_data],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 - or ecx,ecx - jnz @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], tree1, ebx, buffer - stdcall [tl_cur_next], tree1 - popad - ret -endp - -;input: -; eax - value -; buf - string buffer -; len - buffer len -;output: -align 4 -proc convert_int_to_str, buf:dword, len:dword -pushad - mov edi,[buf] - mov esi,[len] - add esi,edi - dec esi - call .str -popad - ret -endp - -align 4 -.str: - mov ecx,10 - cmp eax,ecx - jb @f - xor edx,edx - div ecx - push edx - call .str - pop eax - @@: - cmp edi,esi - jge @f - or al,0x30 - stosb - mov byte[edi],0 - @@: - ret - -align 4 -but_save_file: - pushad - copy_path open_dialog_name,communication_area_default_path,file_name,0 - mov [OpenDialog_data.type],1 - stdcall [OpenDialog_Set_file_ext],OpenDialog_data,Filter.1 ;.3ds - stdcall [OpenDialog_Start],OpenDialog_data - cmp [OpenDialog_data.status],2 - je .end_save_file - ; 㤠筮 ⨨ - - 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 [run_file_70.Buffer], ebx - mov ebx,dword[ebx+2] - mov dword[run_file_70.Count], ebx ;ࠧ 䠩 - mov byte[run_file_70+20], 0 - mov dword[run_file_70.FileName], openfile_path - mcall SF_FILE,run_file_70 - cmp ebx,0xffffffff - je .end_save_file - ;...ᮮ饭... - .end_save_file: - popad - ret - -align 4 -but_wnd_coords: - cmp byte[prop_wnd_run],0 - jne @f - pushad - mcall SF_CREATE_THREAD,1,prop_start,thread_coords - popad - @@: - ret - -;description: -; 㤠 ࠭ ⮣ 䠩 -align 4 -but_delete_chunk: - pushad - stdcall [tl_node_get_data],tree1 - cmp eax,0 - je .end_f - cmp byte[eax+list_offs_chunk_del],0 ;᫨ 饭 㤠 - jne .notify - - ;(1) ஢ 䠩 - mov edx,dword[eax+4] ;ࠧ - sub [open_file_size],edx ; ࠧ஢ 䠩 - mov ecx,[open_file_size] - mov ebx,dword[eax] - sub ecx,ebx ;ecx - ࠧ ᤢ 䠩 - add ebx,dword[open_file_data] ;砥 祭 ᤢ - mov edi,ebx - mov esi,ebx - add esi,edx - mov bl,byte[eax+list_offs_chunk_lev] ;६ ஢ ⥪饣 㧫 - rep movsb - mov byte[can_save],1 - - ;(2) ࠧ஢ த⥫᪨ - cmp bl,0 - je .end_2 - .cycle_2: - stdcall [tl_cur_perv], tree1 - stdcall [tl_node_get_data],tree1 - cmp eax,0 - je .end_2 - cmp byte[eax+list_offs_chunk_lev],bl - jge .cycle_2 - mov bl,byte[eax+list_offs_chunk_lev] - mov ecx,[eax] - add ecx,[open_file_data] - sub dword[ecx+2],edx - cmp bl,0 ;᫨ ᠬ 孨 㧥, bl=0 - jne .cycle_2 - .end_2: - - ;(3) ᯨ᪠ tree1 - call init_tree - call draw_window - - jmp .end_f - .notify: - notify_window_run txt_not_delete - .end_f: - popad - ret - -; 䠩 -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 '/sys',0 - -communication_area_name: - db 'FFFFFFFF_open_dialog',0 -open_dialog_name: - db 'opendial',0 -communication_area_default_path: - db '/sys/File managers/',0 - -Filter: -dd Filter.end - Filter.1 -.1: -db '3DS',0 -db 'STL',0 -.3: -db 'PNG',0 -.end: -db 0 - - -align 4 -system_dir_0 db '/sys/lib/' -lib_name_0 db 'proc_lib.obj',0 -system_dir_1 db '/sys/lib/' -lib_name_1 db 'libimg.obj',0 -system_dir_2 db '/sys/lib/' -lib_name_2 db 'box_lib.obj',0 -system_dir_3 db '/sys/lib/' -lib_name_3 db 'buf2d.obj',0 -system_dir_4 db '/sys/lib/' -lib_name_4 db 'kmenu.obj',0 -system_dir_5 db '/sys/lib/' -lib_name_5 db 'tinygl.obj',0 -system_dir_6 db '/sys/lib/' -lib_name_6 db 'libini.obj',0 - -align 4 -l_libs_start: - lib_0 l_libs lib_name_0, file_name, system_dir_0, import_proclib - lib_1 l_libs lib_name_1, file_name, system_dir_1, import_libimg - lib_2 l_libs lib_name_2, file_name, system_dir_2, import_box_lib - lib_3 l_libs lib_name_3, file_name, system_dir_3, import_buf2d - lib_4 l_libs lib_name_4, file_name, system_dir_4, import_libkmenu - lib_5 l_libs lib_name_5, file_name, system_dir_5, import_lib_tinygl - lib_6 l_libs lib_name_6, file_name, system_dir_6, import_libini -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 -import_proclib: - OpenDialog_Init dd aOpenDialog_Init - OpenDialog_Start dd aOpenDialog_Start - OpenDialog_Set_file_name dd aOpenDialog_Set_file_name - OpenDialog_Set_file_ext dd aOpenDialog_Set_file_ext -dd 0,0 - aOpenDialog_Init db 'OpenDialog_init',0 - aOpenDialog_Start db 'OpenDialog_start',0 - aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0 - aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',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_resize dd sz_buf2d_resize - 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_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_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_resize db 'buf2d_resize',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_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_set_pixel db 'buf2d_set_pixel',0 - -align 4 -import_box_lib: - dd sz_init1 - 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_edit_box_draw db 'edit_box_draw',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 - -align 4 -import_libkmenu: - kmenu_init dd akmenu_init - kmainmenu_draw dd akmainmenu_draw - kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent - ksubmenu_new dd aksubmenu_new - ksubmenu_delete dd aksubmenu_delete - ksubmenu_draw dd aksubmenu_draw - ksubmenu_add dd aksubmenu_add - kmenuitem_new dd akmenuitem_new - kmenuitem_delete dd akmenuitem_delete - kmenuitem_draw dd akmenuitem_draw -dd 0,0 - akmenu_init db 'kmenu_init',0 - akmainmenu_draw db 'kmainmenu_draw',0 - akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0 - aksubmenu_new db 'ksubmenu_new',0 - aksubmenu_delete db 'ksubmenu_delete',0 - aksubmenu_draw db 'ksubmenu_draw',0 - aksubmenu_add db 'ksubmenu_add',0 - akmenuitem_new db 'kmenuitem_new',0 - akmenuitem_delete db 'kmenuitem_delete',0 - akmenuitem_draw db 'kmenuitem_draw',0 - -align 4 -import_lib_tinygl: -macro E_LIB n -{ - n dd sz_#n -} -include '../../develop/libraries/TinyGL/asm_fork/export.inc' - dd 0,0 -macro E_LIB n -{ - sz_#n db `n,0 -} -include '../../develop/libraries/TinyGL/asm_fork/export.inc' - -align 4 -import_libini: - dd alib_init0 - ini_get_str dd aini_get_str - ini_get_int dd aini_get_int - ini_get_color dd aini_get_color -dd 0,0 - alib_init0 db 'lib_init',0 - aini_get_str db 'ini_get_str',0 - aini_get_int db 'ini_get_int',0 - aini_get_color db 'ini_get_color',0 - -align 4 -mouse_dd dd 0 -last_time dd 0 - -align 4 -buf_0: dd 0 ;㪠⥫ ࠦ -.l: dw 205 ;+4 left -.t: dw 35 ;+6 top -.w: dd 340 ;+8 w -.h: dd main_wnd_height-65 ;+12 h -.color: dd 0xffffd0 ;+16 color - db 24 ;+20 bit in pixel - -align 4 -buf_ogl: - dd 0 ;㪠⥫ ࠦ - dw 3d_wnd_l,3d_wnd_t ;+4 left,top -.w: dd 3d_wnd_w -.h: dd 3d_wnd_h - dd 0,24 ;+16 color,bit in pixel - -align 4 -buf_1: - dd 0 ;㪠⥫ ࠦ - dw 0,0 ;+4 left,top - dd 128,144 ;+8 w,h - dd 0,24 ;+16 color,bit in pixel - -align 4 -el_focus dd tree1 -tree1 tree_list size_one_list,300+2, tl_key_no_edit+tl_draw_par_line,\ - 16,16, 0xffffff,0xb0d0ff,0x400040, 5,35,195-16,250, 16,list_offs_text,0,\ - el_focus,w_scr_t1,0 - -align 4 -w_scr_t1 scrollbar 16,0, 3,0, 15, 100, 0,0, 0,0,0, 1 - -align 4 -qObj dd 0 - -light_position dd 0.0, 0.0, -2.0, 1.0 ; ᯮ 筨 [0][1][2] - ;[3] = (0.0 - ᪮筮 㤠 筨, 1.0 - 筨 ᢥ । ﭨ) -light_dir dd 0.0,0.0,0.0 ;ࠢ - -mat_specular dd 0.3, 0.3, 0.3, 1.0 ; -mat_shininess dd 3.0 ; (⭠ ய) -white_light dd 0.8, 0.8, 0.8, 1.0 ; ⥭ᨢ ᢥ饭, 㥬 筨 -lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; ࠬ 䮭 ᢥ饭 - -if lang eq ru_RU -capt db 'info 3ds 29.09.20',0 ; -else -capt db 'info 3ds version 29.09.20',0 ;window caption -end if - -align 16 -i_end: - ctx1 rb 28 ;sizeof.TinyGLContext = 28 - procinfo process_information - run_file_70 FileInfoBlock - sc system_colors - angle_x rd 1 ;㣫 業 - angle_y rd 1 - angle_z rd 1 - color_ox rd 1 - color_oy rd 1 - color_oz rd 1 - color_bk rd 3 - color_vert rd 1 - color_face rd 1 - color_select rd 1 - obj_poi_sel_c rd 1 - o3d obj_3d - rb 2048 -align 16 -thread_coords: - rb 2048 -align 16 -stacktop: - sys_path rb 2048 - file_name rb 4096 - plugin_path rb 4096 - openfile_path rb 4096 - filename_area rb 256 -mem: +use32 + org 0 + db 'MENUET01' ;. ᯮ塞 䠩 ᥣ 8 + dd 1, start, i_end, mem, stacktop, file_name, sys_path + +version_edit equ 1 + +include '../../macros.inc' +include '../../proc32.inc' +include '../../KOSfuncs.inc' +include '../../develop/libraries/libs-dev/libimg/libimg.inc' +include '../../load_img.inc' +include '../../load_lib.mac' +include '../../develop/libraries/box_lib/trunk/box_lib.mac' +include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. +include 'info_fun_float.inc' +include 'info_menu.inc' +include 'data.inc' +include 'convert_stl_3ds.inc' + +@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load + +ID_ICON_CHUNK_MAIN equ 0 ; +ID_ICON_CHUNK_NOT_FOUND equ 1 ; ⭮ +ID_ICON_DATA equ 2 ; , । +ID_ICON_POINT equ 8 +ID_ICON_POINT_SEL equ 9 + +FILE_ERROR_CHUNK_SIZE equ -3 ;訡 ࠧ + +include 'info_o3d.inc' + +main_wnd_height equ 460 ; ணࠬ +IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3 + +align 4 +fl255 dd 255.0 +open_file_data dd 0 ;㪠⥫ 䠩 3ds +open_file_size dd 0 ;ࠧ ⮣ 䠩 +image_data_toolbar dd 0 +icon_tl_sys dd 0 ;㪠⥥ ࠭ ⥬ +icon_toolbar dd 0 ;㪠⥥ ࠭ ꥪ⮢ +fn_toolbar db 'toolbar.png',0 + +align 4 +level_stack dd 0 +offs_last_timer dd 0 ;᫥ ᤢ 㭪樨 ⠩ + +align 4 +file_3ds: ;६ ᯮ㥬 ⨨ 䠩 +.offs: dd 0 ;+0 㪠⥫ 砫 +.size: dd 0 ;+4 ࠧ ( 1- ࠬ = ࠧ 䠩 3ds) +rb 8*MAX_FILE_LEVEL + +size_one_list equ 42 +list_offs_chunk_del equ 8 ; 㤠 +list_offs_chunk_lev equ 9 ;஢ (யᠭ 㧫) +list_offs_p_data equ 10 ;㪠⥫ +list_offs_text equ 14 ;ᤢ 砫 ⥪ +buffer rb size_one_list ; ᯨ᮪ tree1 + +txt_3ds_symb db 0,0 +;-------------------------------------- + +include 'info_wnd_coords.inc' + +align 4 +start: + ;--- copy cmd line --- + mov esi,file_name + mov edi,openfile_path +@@: + lodsd + or eax,eax + jz @f ;室, ᫨ 0 + stosd + jmp @b +@@: + stosd + + load_libraries l_libs_start,l_libs_end + ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ + mov ebp,lib_0 + .test_lib_open: + cmp dword [ebp+ll_struc_size-4],0 + jz @f + mcall SF_TERMINATE_PROCESS ;exit not correct + @@: + add ebp,ll_struc_size + cmp ebp,l_libs_end + jl .test_lib_open + mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors + mcall SF_SET_EVENTS_MASK,0xC0000027 + + stdcall [OpenDialog_Init],OpenDialog_data ;⮢ + + ;kmenu initialisation + stdcall [kmenu_init],sc + stdcall [ksubmenu_new] + mov [main_menu], eax + + stdcall [ksubmenu_new] + mov [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Vertexes, 5 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces, 6 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces_Fill, 7 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Light, 8 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Smooth, 9 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Reset, 10 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_View, [main_menu_view] + stdcall [ksubmenu_add], [main_menu], eax + + stdcall [ksubmenu_new] + mov [main_menu_vertexes], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Vertexes_Select, 11 + stdcall [ksubmenu_add], [main_menu_vertexes], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Vertexes_Deselect, 12 + stdcall [ksubmenu_add], [main_menu_vertexes], eax + stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 + stdcall [ksubmenu_add], [main_menu_vertexes], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Average_x, 13 + stdcall [ksubmenu_add], [main_menu_vertexes], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Average_y, 14 + stdcall [ksubmenu_add], [main_menu_vertexes], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Average_z, 15 + stdcall [ksubmenu_add], [main_menu_vertexes], eax + stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Vertexes, [main_menu_vertexes] + stdcall [ksubmenu_add], [main_menu], eax + + mov dword[w_scr_t1.type],1 + stdcall [tl_data_init], tree1 + ;⥬ 16*16 tree_list + include_image_file 'tl_sys_16.png', icon_tl_sys + ;᫨ ࠦ 뫮, icon_tl_sys + ; 樠஢ , 訡 㤥, . . 㦭 ࠧ + mov eax,dword[icon_tl_sys] + mov dword[tree1.data_img_sys],eax + + load_image_file 'objects.png', icon_toolbar + mov eax,dword[icon_toolbar] + mov dword[tree1.data_img],eax + + stdcall [buf2d_create], buf_0 ;ᮧ + + load_image_file 'font8x9.bmp', image_data_toolbar + 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 + + ;ࠡ 䠩 ஥ + copy_path ini_name,sys_path,file_name,0 + mov dword[def_dr_mode],0 + stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dv,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_vertexes + @@: + stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_df,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_faces + @@: + stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dff,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_faces_fill + @@: + stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dl,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_light + @@: + stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_ds,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_smooth + @@: + stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_ox,0x0000ff + mov [color_ox],eax + stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_oy,0xff0000 + mov [color_oy],eax + stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_oz,0x00ff00 + mov [color_oz],eax + stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_bk,0x000000 + mov [color_bk],eax + shr eax,8 + mov [color_bk+4],eax + shr eax,8 + mov [color_bk+8],eax + stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_vert,0xffffff + mov [color_vert],eax + stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_face,0x808080 + mov [color_face],eax + stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_select,0xffff00 + mov [color_select],eax + finit + fild dword[color_bk+8] + fdiv dword[fl255] + fstp dword[color_bk+8] + mov eax,[color_bk+4] + and eax,0xff + mov [color_bk+4],eax + fild dword[color_bk+4] + fdiv dword[fl255] + fstp dword[color_bk+4] + mov eax,[color_bk] + and eax,0xff + mov [color_bk],eax + fild dword[color_bk] + fdiv dword[fl255] + fstp dword[color_bk] + + 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 + stdcall [glEnable], GL_DEPTH_TEST + stdcall [glEnable], GL_NORMALIZE ; ଠ 稭 䠪⮢ + stdcall [glClearColor], [color_bk+8],[color_bk+4],[color_bk],0.0 + stdcall [glShadeModel], GL_SMOOTH + call [gluNewQuadric] + mov [qObj],eax + + mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext + mov eax,[eax] ;eax -> ZBuffer + mov eax,[eax+ZBuffer.pbuf] + mov dword[buf_ogl],eax + + ;open file from cmd line + cmp dword[openfile_path],0 + je @f + call but_open_file.no_dlg + @@: + call draw_window + +align 4 +still: + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov ebx,[last_time] + add ebx,10 ;প + cmp ebx,eax + jge @f + mov ebx,eax + @@: + sub ebx,eax + mcall SF_WAIT_EVENT_TIMEOUT + or eax,eax + jz timer_funct + + cmp al,1 + jne @f + call draw_window + jmp still + @@: + cmp al,2 + jz key + cmp al,3 + jz button + cmp al,6 + jne @f + mcall SF_THREAD_INFO,procinfo,-1 + cmp ax,word[procinfo+4] + jne @f ; ⨢ + call mouse + @@: + jmp still + +align 4 +mouse: + stdcall [tl_mouse], dword tree1 + ret + +align 4 +timer_funct: + pushad + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov [last_time],eax + + ;ᬠਢ 뤥 + stdcall [tl_node_get_data],tree1 + cmp eax,0 + je @f + mov ebx,eax + mov eax,dword[ebx] + mov ecx,dword[ebx+4] ;ࠧ + stdcall hex_in_str, txt_3ds_offs.dig, eax,8 + stdcall hex_in_str, txt_3ds_offs.siz, ecx,8 + + add eax,dword[open_file_data] ;砥 祭 ᤢ + cmp dword[offs_last_timer],eax + je @f + ;᫨ 뤥 ᮢ ᫥ + mov dword[offs_last_timer],eax + stdcall buf_draw_beg, buf_0 + stdcall [buf2d_draw_text], buf_0, buf_1,txt_3ds_offs,5,35,0xb000 + mov edx,dword[ebx+list_offs_p_data] + 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 +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_data] + 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 uses eax ebx ecx, coord_y:dword + 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 + ret +endp + +align 4 +draw_window: +pushad + mcall SF_REDRAW,SSF_BEGIN_DRAW + xor eax,eax + mov edx,[sc.work] + or edx,0x33000000 + mov edi,capt + mcall , (20 shl 16)+560, (20 shl 16)+main_wnd_height + + mcall SF_THREAD_INFO,procinfo,-1 + mov eax,dword[procinfo.box.height] + cmp eax,250 + jge @f + mov eax,250 + @@: + sub eax,65 + mov dword[tree1.box_height],eax + mov word[w_scr_t1.y_size],ax ; ࠧ ஫ + cmp eax,dword[buf_0.h] ;㢥稢 + jle @f + stdcall [buf2d_resize],buf_0,0,eax,1 + mov dword[offs_last_timer],0 ; ⠩ + @@: + + mov eax,dword[procinfo.box.width] + cmp eax,400 + jge @f + mov eax,400 + @@: + sub eax,[buf_0.w] + sub eax,41 + mov dword[tree1.box_width],eax + add ax,word[tree1.box_left] + mov word[w_scr_t1.x_pos],ax + add ax,16+5 + mov word[buf_0.l],ax + + mov esi,[sc.work_button] + mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,0x40000003 + mcall ,(30 shl 16)+20,,0x40000004 + + cmp byte[can_save],0 + je @f + mcall ,(55 shl 16)+20,,0x40000005 + @@: + mcall ,(85 shl 16)+20,,0x40000006 ; न⠬ + mcall ,(110 shl 16)+20,,0x40000007 ;㤠 + + mcall SF_PUT_IMAGE,[image_data_toolbar],(21 shl 16)+21,(5 shl 16)+5 ;new + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mov edx,(30 shl 16)+5 ;open + int 0x40 + + cmp byte[can_save],0 + je @f + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mov edx,(55 shl 16)+5 ;save + int 0x40 + sub ebx,IMAGE_TOOLBAR_ICON_SIZE + @@: + + add ebx,4*IMAGE_TOOLBAR_ICON_SIZE + mov edx,(85 shl 16)+5 + int 0x40 + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mov edx,(110 shl 16)+5 + int 0x40 + + mov dword[w_scr_t1.all_redraw],1 + stdcall [tl_draw], tree1 + + stdcall [buf2d_draw], buf_0 + + mcall SF_REDRAW,SSF_END_DRAW +popad + ret + +align 4 +key: + mcall SF_GET_KEY + stdcall [tl_key], dword tree1 + jmp still + + +align 4 +button: + mcall SF_GET_BUTTON + cmp ah,3 + jne @f + call but_new_file + jmp still + @@: + cmp ah,4 + jne @f + call but_open_file + jmp still + @@: + cmp ah,5 + jne @f + call but_save_file + jmp still + @@: + cmp ah,6 + jne @f + call but_wnd_coords + jmp still + @@: + cmp ah,7 + jne @f + call but_delete_chunk + jmp still + @@: + + cmp ah,1 + jne still +.exit: + mov dword[tree1.data_img],0 + mov dword[tree1.data_img_sys],0 + stdcall [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_data] + stdcall [gluDeleteQuadric], [qObj] + mcall SF_TERMINATE_PROCESS + + +align 4 +but_new_file: + mov byte[can_save],0 + stdcall [tl_info_clear], tree1 ;⪠ ᯨ᪠ ꥪ⮢ + stdcall [buf2d_clear], buf_0, [buf_0.color] ;⨬ + stdcall [tl_draw], tree1 + stdcall [buf2d_draw], buf_0 ;塞 ࠭ + ret + +align 4 +but_open_file: + copy_path open_dialog_name,communication_area_default_path,file_name,0 + pushad + mov [OpenDialog_data.type],0 + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],2 + je .end_open_file + ; 㤠筮 ⨨ + jmp .end0 +.no_dlg: ;᫨ 㥬 䠩 + pushad + mov esi,openfile_path + stdcall str_len,esi + add esi,eax + @@: ;横 ᪠ 砫 䠩 + dec esi + cmp byte[esi],'/' + je @f + cmp byte[esi],0x5c ;'\' + je @f + cmp esi,openfile_path + jg @b + @@: + inc esi + stdcall [OpenDialog_Set_file_name],OpenDialog_data,esi ;㥬 䠩 ࠭ + .end0: + 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 + mcall SF_FILE,run_file_70 + + mov ecx,dword[open_b+32] ;+32 qword: ࠧ 䠩 + stdcall mem.ReAlloc,[open_file_data],ecx + mov [open_file_data],eax + + 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 + mcall SF_FILE,run_file_70 ;㦠 䠩 3ds + cmp ebx,0xffffffff + je .end_open_file + + mov [open_file_size],ebx + ;mcall SF_SET_CAPTION,1,openfile_path + + mov byte[can_save],0 + call init_tree + stdcall [buf2d_draw], buf_0 ;塞 ࠭ + stdcall obj_clear_param, o3d ;⨬ ࠬ न⠬ + cmp byte[prop_wnd_run],0 + je @f + ;⨬ न⠬ + stdcall [tl_info_clear], tree3 + @@: + + .end_open_file: + popad + ret + +align 4 +init_tree: + stdcall [tl_info_clear], tree1 ;⪠ ᯨ᪠ ꥪ⮢ + + mov esi,[open_file_data] + stdcall convert_stl_3ds, esi,[open_file_size] ;஢塞 䠩 ଠ *.stl ? + or eax,eax + jz @f + ;᫨ 䠩 ଠ *.stl + mov [open_file_size],ecx + mov esi,eax + stdcall mem.Free,[open_file_data] + mov [open_file_data],esi + mov byte[can_save],1 + @@: + cmp word[esi],CHUNK_MAIN + je @f + stdcall buf_draw_beg, buf_0 + stdcall [buf2d_draw_text], buf_0, buf_1,txt_no_3ds,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,[file_3ds.offs] + add edi,[file_3ds.size] + .cycle_main: + cmp dword[level_stack],0 + jle .end_cycle + + cmp esi,edi ;᫨ 䠩 + jge .end_cycle + + mov edx,[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: + ret + +; +;input: +; eax - stack pointer +; 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 + 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 ;㦥 ᤥ repne + jmp .next_bl + @@: + cmp dx,CHUNK_VERTLIST ;ᯨ᮪ 設 + je .vertexes + cmp dx,0x4111 ;䫠 設 + je .vertexes + cmp dx,CHUNK_MAPLIST ;⥪ न + je .vertexes + jmp @f + .vertexes: ;ࠡ⪠ , ᮤঠ 設 + stdcall add_3ds_object, ID_ICON_DATA,ebx,2,txt_count ;᫮ 設 + add esi,2 + sub ecx,2 + stdcall add_3ds_object, ID_ICON_DATA,ebx,ecx,0 ; 設 + sub esi,8 ;⠭ esi + call block_next + jmp .end_f + @@: + cmp dx,CHUNK_FACELIST ;ᯨ᮪ ࠭ + jne @f + stdcall add_3ds_object, ID_ICON_DATA,ebx,2,txt_count ;᫮ ࠭ + push eax + movzx eax,word[esi] + shl eax,3 + add esi,2 + sub ecx,2 + stdcall add_3ds_object, ID_ICON_DATA,ebx,eax,0 ; ࠭ + + sub ecx,eax + cmp ecx,1 + jl .data_3 ;஢塞 뢠騩 ਠ, ਬ塞 ꥪ +if 0 + add esi,eax + mov ecx,dword[esi+2] + stdcall add_3ds_object, 10,ebx,ecx,0 ; ਠ + sub esi,eax +else + add esi,eax + pop eax + jmp .next_bl +end if + .data_3: + + sub esi,8 ;⠭ esi + pop eax + call block_next + jmp .end_f + @@: + cmp dx,CHUNK_FACEMAT ;ਠ ࠭ + jne @f + 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 ;㦥 ᤥ repne + stdcall add_3ds_object, ID_ICON_DATA,ebx,2,txt_count ;᫮ ࠭ + add esi,2 + sub ecx,2 + stdcall add_3ds_object, ID_ICON_DATA,ebx,ecx,0 ; ࠭, ਬ ਠ + sub esi,edi ;⠭ esi (1) + sub esi,8 ;⠭ esi (2) + call block_next + jmp .end_f + @@: + ; *** 묨 㬮砭 ( 뤥 ) + 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- ୨ +;input: +; eax - 㪠⥫ ६ ⥪ 䠩 file_3ds +; esi - 砫 த⥫᪮ +;output: +; ebx - destroy +; esi - 砫 த⥫᪮ +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 [eax],esi ;㪠⥫ 砫 + mov ebx,[esi+2] + mov [eax+4],ebx ;ࠧ + add esi,6 ;室 + inc dword[level_stack] + add eax,8 + .end_f: + pop ecx + ret + +;室 ᫥饬 ⥪饣 ஢ +;input: +; eax - ६묨 +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 - 㪠⥫ 㥬 +; icon - +; level - ஢ 㧫 +; size_bl - ࠧ +; info_bl - ப ᠭ +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_data] + mov dword[buffer],eax ;ᬥ饭 + mov ecx,dword[size_bl] + mov dword[buffer+4],ecx ;ࠧ (ᯮ 㭪樨 buf_draw_hex_table ᮢ ) + mov ecx,dword[bl_found] + or ecx,ecx + jz @f + ;... 㦥 㣮 㤠 + mov cl,byte[ecx+4] + @@: + mov byte[buffer+list_offs_chunk_del],cl + mov ecx,[level] + mov byte[buffer+list_offs_chunk_lev],cl + mov ecx,dword[info_bl] + mov dword[buffer+list_offs_p_data],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 + or ecx,ecx + jnz @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], tree1, ebx, buffer + stdcall [tl_cur_next], tree1 + popad + ret +endp + +;input: +; eax - value +; buf - string buffer +; len - buffer len +;output: +align 4 +proc convert_int_to_str, buf:dword, len:dword +pushad + mov edi,[buf] + mov esi,[len] + add esi,edi + dec esi + call .str +popad + ret +endp + +align 4 +.str: + mov ecx,10 + cmp eax,ecx + jb @f + xor edx,edx + div ecx + push edx + call .str + pop eax + @@: + cmp edi,esi + jge @f + or al,0x30 + stosb + mov byte[edi],0 + @@: + ret + +align 4 +but_save_file: + pushad + copy_path open_dialog_name,communication_area_default_path,file_name,0 + mov [OpenDialog_data.type],1 + stdcall [OpenDialog_Set_file_ext],OpenDialog_data,Filter.1 ;.3ds + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],2 + je .end_save_file + ; 㤠筮 ⨨ + + 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 [run_file_70.Buffer], ebx + mov ebx,dword[ebx+2] + mov dword[run_file_70.Count], ebx ;ࠧ 䠩 + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 + cmp ebx,0xffffffff + je .end_save_file + ;...ᮮ饭... + .end_save_file: + popad + ret + +align 4 +but_wnd_coords: + cmp byte[prop_wnd_run],0 + jne @f + pushad + mcall SF_CREATE_THREAD,1,prop_start,thread_coords + popad + @@: + ret + +;description: +; 㤠 ࠭ ⮣ 䠩 +align 4 +but_delete_chunk: + pushad + stdcall [tl_node_get_data],tree1 + cmp eax,0 + je .end_f + cmp byte[eax+list_offs_chunk_del],0 ;᫨ 饭 㤠 + jne .notify + + ;(1) ஢ 䠩 + mov edx,dword[eax+4] ;ࠧ + sub [open_file_size],edx ; ࠧ஢ 䠩 + mov ecx,[open_file_size] + mov ebx,dword[eax] + sub ecx,ebx ;ecx - ࠧ ᤢ 䠩 + add ebx,dword[open_file_data] ;砥 祭 ᤢ + mov edi,ebx + mov esi,ebx + add esi,edx + mov bl,byte[eax+list_offs_chunk_lev] ;६ ஢ ⥪饣 㧫 + rep movsb + mov byte[can_save],1 + + ;(2) ࠧ஢ த⥫᪨ + cmp bl,0 + je .end_2 + .cycle_2: + stdcall [tl_cur_perv], tree1 + stdcall [tl_node_get_data],tree1 + cmp eax,0 + je .end_2 + cmp byte[eax+list_offs_chunk_lev],bl + jge .cycle_2 + mov bl,byte[eax+list_offs_chunk_lev] + mov ecx,[eax] + add ecx,[open_file_data] + sub dword[ecx+2],edx + cmp bl,0 ;᫨ ᠬ 孨 㧥, bl=0 + jne .cycle_2 + .end_2: + + ;(3) ᯨ᪠ tree1 + call init_tree + call draw_window + + jmp .end_f + .notify: + notify_window_run txt_not_delete + .end_f: + popad + ret + +; 䠩 +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 '/sys',0 + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_name: + db 'opendial',0 +communication_area_default_path: + db '/sys/File managers/',0 + +Filter: +dd Filter.end - Filter.1 +.1: +db '3DS',0 +db 'STL',0 +.3: +db 'PNG',0 +.end: +db 0 + + +align 4 +system_dir_0 db '/sys/lib/' +lib_name_0 db 'proc_lib.obj',0 +system_dir_1 db '/sys/lib/' +lib_name_1 db 'libimg.obj',0 +system_dir_2 db '/sys/lib/' +lib_name_2 db 'box_lib.obj',0 +system_dir_3 db '/sys/lib/' +lib_name_3 db 'buf2d.obj',0 +system_dir_4 db '/sys/lib/' +lib_name_4 db 'kmenu.obj',0 +system_dir_5 db '/sys/lib/' +lib_name_5 db 'tinygl.obj',0 +system_dir_6 db '/sys/lib/' +lib_name_6 db 'libini.obj',0 + +align 4 +l_libs_start: + lib_0 l_libs lib_name_0, file_name, system_dir_0, import_proclib + lib_1 l_libs lib_name_1, file_name, system_dir_1, import_libimg + lib_2 l_libs lib_name_2, file_name, system_dir_2, import_box_lib + lib_3 l_libs lib_name_3, file_name, system_dir_3, import_buf2d + lib_4 l_libs lib_name_4, file_name, system_dir_4, import_libkmenu + lib_5 l_libs lib_name_5, file_name, system_dir_5, import_lib_tinygl + lib_6 l_libs lib_name_6, file_name, system_dir_6, import_libini +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 +import_proclib: + OpenDialog_Init dd aOpenDialog_Init + OpenDialog_Start dd aOpenDialog_Start + OpenDialog_Set_file_name dd aOpenDialog_Set_file_name + OpenDialog_Set_file_ext dd aOpenDialog_Set_file_ext +dd 0,0 + aOpenDialog_Init db 'OpenDialog_init',0 + aOpenDialog_Start db 'OpenDialog_start',0 + aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0 + aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',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_resize dd sz_buf2d_resize + 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_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_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_resize db 'buf2d_resize',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_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_set_pixel db 'buf2d_set_pixel',0 + +align 4 +import_box_lib: + dd sz_init1 + 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_edit_box_draw db 'edit_box_draw',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 + +align 4 +import_libkmenu: + kmenu_init dd akmenu_init + kmainmenu_draw dd akmainmenu_draw + kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent + ksubmenu_new dd aksubmenu_new + ksubmenu_delete dd aksubmenu_delete + ksubmenu_draw dd aksubmenu_draw + ksubmenu_add dd aksubmenu_add + kmenuitem_new dd akmenuitem_new + kmenuitem_delete dd akmenuitem_delete + kmenuitem_draw dd akmenuitem_draw +dd 0,0 + akmenu_init db 'kmenu_init',0 + akmainmenu_draw db 'kmainmenu_draw',0 + akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0 + aksubmenu_new db 'ksubmenu_new',0 + aksubmenu_delete db 'ksubmenu_delete',0 + aksubmenu_draw db 'ksubmenu_draw',0 + aksubmenu_add db 'ksubmenu_add',0 + akmenuitem_new db 'kmenuitem_new',0 + akmenuitem_delete db 'kmenuitem_delete',0 + akmenuitem_draw db 'kmenuitem_draw',0 + +align 4 +import_lib_tinygl: +macro E_LIB n +{ + n dd sz_#n +} +include '../../develop/libraries/TinyGL/asm_fork/export.inc' + dd 0,0 +macro E_LIB n +{ + sz_#n db `n,0 +} +include '../../develop/libraries/TinyGL/asm_fork/export.inc' + +align 4 +import_libini: + dd alib_init0 + ini_get_str dd aini_get_str + ini_get_int dd aini_get_int + ini_get_color dd aini_get_color +dd 0,0 + alib_init0 db 'lib_init',0 + aini_get_str db 'ini_get_str',0 + aini_get_int db 'ini_get_int',0 + aini_get_color db 'ini_get_color',0 + +align 4 +mouse_dd dd 0 +last_time dd 0 + +align 4 +buf_0: dd 0 ;㪠⥫ ࠦ +.l: dw 205 ;+4 left +.t: dw 35 ;+6 top +.w: dd 340 ;+8 w +.h: dd main_wnd_height-65 ;+12 h +.color: dd 0xffffd0 ;+16 color + db 24 ;+20 bit in pixel + +align 4 +buf_ogl: + dd 0 ;㪠⥫ ࠦ + dw 3d_wnd_l,3d_wnd_t ;+4 left,top +.w: dd 3d_wnd_w +.h: dd 3d_wnd_h + dd 0,24 ;+16 color,bit in pixel + +align 4 +buf_1: + dd 0 ;㪠⥫ ࠦ + dw 0,0 ;+4 left,top + dd 128,144 ;+8 w,h + dd 0,24 ;+16 color,bit in pixel + +align 4 +el_focus dd tree1 +tree1 tree_list size_one_list,300+2, tl_key_no_edit+tl_draw_par_line,\ + 16,16, 0xffffff,0xb0d0ff,0x400040, 5,35,195-16,250, 16,list_offs_text,0,\ + el_focus,w_scr_t1,0 + +align 4 +w_scr_t1 scrollbar 16,0, 3,0, 15, 100, 0,0, 0,0,0, 1 + +align 4 +qObj dd 0 + +light_position dd 0.0, 0.0, -2.0, 1.0 ; ᯮ 筨 [0][1][2] + ;[3] = (0.0 - ᪮筮 㤠 筨, 1.0 - 筨 ᢥ । ﭨ) +light_dir dd 0.0,0.0,0.0 ;ࠢ + +mat_specular dd 0.3, 0.3, 0.3, 1.0 ; +mat_shininess dd 3.0 ; (⭠ ய) +white_light dd 0.8, 0.8, 0.8, 1.0 ; ⥭ᨢ ᢥ饭, 㥬 筨 +lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; ࠬ 䮭 ᢥ饭 + +if lang eq ru_RU +capt db 'info 3ds 29.09.20',0 ; +else ; Default to en_US +capt db 'info 3ds version 29.09.20',0 ;window caption +end if + +align 16 +i_end: + ctx1 rb 28 ;sizeof.TinyGLContext = 28 + procinfo process_information + run_file_70 FileInfoBlock + sc system_colors + angle_x rd 1 ;㣫 業 + angle_y rd 1 + angle_z rd 1 + color_ox rd 1 + color_oy rd 1 + color_oz rd 1 + color_bk rd 3 + color_vert rd 1 + color_face rd 1 + color_select rd 1 + obj_poi_sel_c rd 1 + o3d obj_3d + rb 2048 +align 16 +thread_coords: + rb 2048 +align 16 +stacktop: + sys_path rb 2048 + file_name rb 4096 + plugin_path rb 4096 + openfile_path rb 4096 + filename_area rb 256 +mem: diff --git a/programs/develop/info3ds/info3ds_u.asm b/programs/develop/info3ds/info3ds_u.asm index 2419502456..a9d47f9519 100644 --- a/programs/develop/info3ds/info3ds_u.asm +++ b/programs/develop/info3ds/info3ds_u.asm @@ -1,1459 +1,1459 @@ -use32 - org 0 - db 'MENUET01' ;. ᯮ塞 䠩 ᥣ 8 - dd 1, start, i_end, mem, stacktop, file_name, sys_path - -version_edit equ 0 - -include '../../macros.inc' -include '../../proc32.inc' -include '../../KOSfuncs.inc' -include '../../develop/libraries/libs-dev/libimg/libimg.inc' -include '../../load_img.inc' -include '../../load_lib.mac' -include '../../develop/libraries/box_lib/trunk/box_lib.mac' -include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc' -include 'lang.inc' -include 'info_fun_float.inc' -include 'info_menu.inc' -include 'data.inc' -include 'convert_stl_3ds.inc' - -3d_wnd_l equ 205 ; tinygl ᫥ -3d_wnd_t equ 47 ; tinygl ᢥ -3d_wnd_w equ 344 -3d_wnd_h equ 312 - -@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load - -ID_ICON_CHUNK_MAIN equ 0 ; -ID_ICON_CHUNK_NOT_FOUND equ 1 ; ⭮ -ID_ICON_DATA equ 2 ; , । -ID_ICON_POINT equ 8 -ID_ICON_POINT_SEL equ 9 - -FILE_ERROR_CHUNK_SIZE equ -3 ;訡 ࠧ - -size_one_list equ 42+sizeof.obj_3d -list_offs_chunk_del equ 8 ; 㤠 -list_offs_chunk_lev equ 9 ;஢ (யᠭ 㧫) -list_offs_p_data equ 10 ;㪠⥫ -list_offs_obj3d equ 14 ;㪠⥫ 3d ꥪ -list_offs_text equ 14+sizeof.obj_3d ;ᤢ 砫 ⥪ -include 'info_o3d.inc' - -align 4 -fl255 dd 255.0 -open_file_data dd 0 ;㪠⥫ 䠩 3ds -open_file_size dd 0 ;ࠧ ⮣ 䠩 - -; -main_wnd_height equ 460 ; ணࠬ -fn_toolbar db 'toolbar.png',0 -IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3 -image_data_toolbar dd 0 -; -icon_tl_sys dd 0 ;㪠⥫ ࠭ ⥬ -icon_toolbar dd 0 ;㪠⥫ ࠭ ꥪ⮢ - -;-------------------------------------- -level_stack dd 0 -offs_last_timer dd 0 ;᫥ ᤢ 㭪樨 ⠩ - -align 4 -file_3ds: ;६ ᯮ㥬 ⨨ 䠩 -.offs: dd 0 ;+0 㪠⥫ 砫 -.size: dd 0 ;+4 ࠧ ( 1- ࠬ = ࠧ 䠩 3ds) -rb 8*MAX_FILE_LEVEL - -buffer rb size_one_list ; ᯨ᮪ tree1 - -txt_3ds_symb db 0,0 -;-------------------------------------- - - - -align 4 -start: - ;--- copy cmd line --- - mov esi,file_name - mov edi,openfile_path -@@: - lodsd - or eax,eax - jz @f ;室, ᫨ 0 - stosd - jmp @b -@@: - stosd - - load_libraries l_libs_start,l_libs_end - ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ - mov ebp,lib_0 - .test_lib_open: - cmp dword [ebp+ll_struc_size-4],0 - jz @f - mcall SF_TERMINATE_PROCESS ;exit not correct - @@: - add ebp,ll_struc_size - cmp ebp,l_libs_end - jl .test_lib_open - mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors - mcall SF_SET_EVENTS_MASK,0xC0000027 - - stdcall [OpenDialog_Init],OpenDialog_data ;⮢ - - ;kmenu initialisation - stdcall [kmenu_init],sc - stdcall [ksubmenu_new] - mov [main_menu], eax - - stdcall [ksubmenu_new] - mov [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Vertexes, 5 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces, 6 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces_Fill, 7 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces_Mat, 8 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Light, 9 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Smooth, 10 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Reset, 11 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_View, [main_menu_view] - stdcall [ksubmenu_add], [main_menu], eax - - mov dword[w_scr_t1.type],1 - stdcall [tl_data_init], tree1 - ;⥬ 16*16 tree_list - include_image_file 'tl_sys_16.png', icon_tl_sys - ;᫨ ࠦ 뫮, icon_tl_sys - ; 樠஢ , 訡 㤥, . . 㦭 ࠧ - mov eax,dword[icon_tl_sys] - mov dword[tree1.data_img_sys],eax - - load_image_file 'objects.png', icon_toolbar - mov eax,dword[icon_toolbar] - mov dword[tree1.data_img],eax - - load_image_file 'font8x9.bmp', image_data_toolbar - 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 - - ;ࠡ 䠩 ஥ - copy_path ini_name,sys_path,file_name,0 - mov dword[def_dr_mode],0 - stdcall [ini_get_int],file_name,ini_sec_w3d,key_dv,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_vertexes - @@: - stdcall [ini_get_int],file_name,ini_sec_w3d,key_df,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_faces - @@: - stdcall [ini_get_int],file_name,ini_sec_w3d,key_dff,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_faces_fill - @@: - stdcall [ini_get_int],file_name,ini_sec_w3d,key_dfm,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_faces_mat - @@: - stdcall [ini_get_int],file_name,ini_sec_w3d,key_dl,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_light - @@: - stdcall [ini_get_int],file_name,ini_sec_w3d,key_ds,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_smooth - @@: - stdcall [ini_get_color],file_name,ini_sec_w3d,key_ox,0x0000ff - mov [color_ox],eax - stdcall [ini_get_color],file_name,ini_sec_w3d,key_oy,0xff0000 - mov [color_oy],eax - stdcall [ini_get_color],file_name,ini_sec_w3d,key_oz,0x00ff00 - mov [color_oz],eax - stdcall [ini_get_color],file_name,ini_sec_w3d,key_bk,0x000000 - mov [color_bk],eax - shr eax,8 - mov [color_bk+4],eax - shr eax,8 - mov [color_bk+8],eax - stdcall [ini_get_color],file_name,ini_sec_w3d,key_vert,0xffffff - mov [color_vert],eax - stdcall [ini_get_color],file_name,ini_sec_w3d,key_face,0x808080 - mov [color_face],eax - stdcall [ini_get_color],file_name,ini_sec_w3d,key_select,0xffff00 - mov [color_select],eax - finit - fild dword[color_bk+8] - fdiv dword[fl255] - fstp dword[color_bk+8] - mov eax,[color_bk+4] - and eax,0xff - mov [color_bk+4],eax - fild dword[color_bk+4] - fdiv dword[fl255] - fstp dword[color_bk+4] - mov eax,[color_bk] - and eax,0xff - mov [color_bk],eax - fild dword[color_bk] - fdiv dword[fl255] - fstp dword[color_bk] - - 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 - stdcall [glEnable], GL_DEPTH_TEST - stdcall [glEnable], GL_NORMALIZE ; ଠ 稭 䠪⮢ - stdcall [glClearColor], [color_bk+8],[color_bk+4],[color_bk],0.0 - stdcall [glShadeModel], GL_SMOOTH - call [gluNewQuadric] - mov [qObj],eax - - mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext - mov eax,[eax] ;eax -> ZBuffer - mov eax,[eax+ZBuffer.pbuf] - mov dword[buf_ogl],eax - - ;open file from cmd line - cmp dword[openfile_path],0 - je @f - call but_open_file.no_dlg - @@: - call draw_window - -align 4 -still: - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov ebx,[last_time] - add ebx,10 ;প - cmp ebx,eax - jge @f - mov ebx,eax - @@: - sub ebx,eax - mcall SF_WAIT_EVENT_TIMEOUT - or eax,eax - jz timer_funct - - cmp al,1 - jne @f - call draw_window - jmp still - @@: - cmp al,2 - jz key - cmp al,3 - jz button - cmp al,6 - jne @f - mcall SF_THREAD_INFO,procinfo,-1 - cmp ax,word[procinfo+4] - jne @f ; ⨢ - call mouse - @@: - jmp still - -align 4 -mouse: - push eax ebx - 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 - - stdcall [tl_node_get_data],tree1 - or eax,eax - jz .end_d - mov ebx,[eax] - add ebx,dword[open_file_data] ;砥 祭 ᤢ - cmp word[ebx],CHUNK_OBJBLOCK - jne .end_d - - mcall SF_MOUSE_GET,SSF_WINDOW_POSITION - mov ebx,eax - sar ebx,16 ;mouse.x - cmp ebx,3d_wnd_l - jg @f - mov ebx,3d_wnd_l - @@: - sub ebx,3d_wnd_l - cmp ebx,3d_wnd_w - jle @f - mov ebx,3d_wnd_w - @@: - movsx eax,ax ;mouse.y - cmp eax,3d_wnd_t - jg @f - mov eax,3d_wnd_t - @@: - sub eax,3d_wnd_t - cmp eax,3d_wnd_h - jle @f - mov eax,3d_wnd_h - @@: - finit - fild dword[mouse_y] - mov [mouse_y],eax - fisub dword[mouse_y] - fdiv dword[angle_dxm] ;᫨ y ( ) x - fadd dword[angle_x] - fstp dword[angle_x] - - fild dword[mouse_x] - mov [mouse_x],ebx - fisub dword[mouse_x] - fdiv dword[angle_dym] ;᫨ x ( ) y - fadd dword[angle_y] - fstp dword[angle_y] - - stdcall [tl_node_get_data],tree1 - ;cmp eax,0 - , 뫮 ᤥ - add eax,list_offs_obj3d - stdcall draw_3d, eax - jmp .end_d - .end_m: - bt eax,16 - jnc @f - ;mouse l. but. up - mov dword[mouse_drag],0 - jmp .end_d - @@: - bt eax,8 - jnc .end_d - ;mouse l. but. press - mcall SF_MOUSE_GET,SSF_WINDOW_POSITION - mov ebx,eax - sar ebx,16 ;mouse.x - cmp ebx,3d_wnd_l - jl .end_d - sub ebx,3d_wnd_l - cmp ebx,3d_wnd_w - jg .end_d - movsx eax,ax ;mouse.y - cmp eax,3d_wnd_t - jl .end_d - sub eax,3d_wnd_t - cmp eax,3d_wnd_h - jg .end_d - mov dword[mouse_drag],1 - mov dword[mouse_x],ebx - mov dword[mouse_y],eax - .end_d: - - stdcall [tl_mouse], tree1 - stdcall [kmainmenu_dispatch_cursorevent], [main_menu] - pop ebx eax - ret - -align 4 -timer_funct: - pushad - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov [last_time],eax - - ;ᬠਢ 뤥 - stdcall [tl_node_get_data],tree1 - or eax,eax - jz .end_f - lea edi,[eax+list_offs_obj3d] - mov ebx,eax - mov eax,[ebx] - mov ecx,[ebx+4] ;ࠧ - stdcall hex_in_str, txt_3ds_offs.dig, eax,8 - stdcall hex_in_str, txt_3ds_offs.siz, ecx,8 - - add eax,[open_file_data] ;砥 祭 ᤢ - cmp [offs_last_timer],eax - je .end_f - ;᫨ 뤥 ᮢ ᫥ - mov [offs_last_timer],eax - - cmp word[eax],CHUNK_OBJBLOCK - jne .end_oblo - cmp dword[edi+obj_3d.poi_count],2 - jl .ini_oblo - stdcall draw_3d,edi - jmp .end_f - .ini_oblo: - stdcall obj_init,edi ;⪠ ந ६ ꥪ - cmp dword[edi+obj_3d.poi_count],2 - jl .end_f - call mnu_reset_settings ; 㣫 ० ᮢ - jmp .end_f - .end_oblo: - - cmp word[eax],CHUNK_MATERIAL - jne .end_mblo - cmp dword[edi+material.name],0 - je .ini_mblo - stdcall draw_material,edi - jmp .end_f - .ini_mblo: - stdcall mat_init,edi,eax ;⪠ ந ਠ - cmp dword[edi+material.name],0 - je .end_f - stdcall draw_material,edi - jmp .end_f - .end_mblo: - - stdcall buf_draw_beg, buf_ogl - stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_3ds_offs,5,35,0xb000 - mov edx,[ebx+list_offs_p_data] - or edx,edx ;ᬮਬ ᠭ - jz .no_info - stdcall [buf2d_draw_text], buf_ogl, buf_1,edx,5,45,0xb000 - .no_info: - stdcall [buf2d_draw], buf_ogl ;塞 ࠭ - .end_f: - popad - jmp still - -align 4 -draw_window: -pushad - mcall SF_REDRAW,SSF_BEGIN_DRAW - mov edx,[sc.work] - or edx,0x33000000 - mcall SF_CREATE_WINDOW, (20 shl 16)+560, (20 shl 16)+main_wnd_height,,, capt - - mcall SF_THREAD_INFO,procinfo,-1 - mov eax,dword[procinfo.box.height] - cmp eax,250 - jge @f - mov eax,250 - @@: - sub eax,30 - sub eax,[tree1.box_top] - mov [tree1.box_height],eax - mov word[w_scr_t1.y_size],ax ; ࠧ ஫ - - stdcall [kmainmenu_draw], [main_menu] - - mov esi,[sc.work_button] - mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(24 shl 16)+20,0x40000003 - mcall ,(30 shl 16)+20,,0x40000004 ;open - mcall ,(3d_wnd_l shl 16)+20,,0x40000005 ;設 . - mcall ,((3d_wnd_l+25) shl 16)+20,,0x40000006 ;ઠ ࠭ . - mcall ,((3d_wnd_l+50) shl 16)+20,,0x40000007 ; ࠭ . - mcall ,((3d_wnd_l+75) shl 16)+20,,0x40000008 ;࠭ ਠ . - mcall ,((3d_wnd_l+100) shl 16)+20,,0x40000009 ;ᢥ ./몫. - mcall ,((3d_wnd_l+125) shl 16)+20,,0x4000000a ;ᣫ - mcall ,((3d_wnd_l+150) shl 16)+20,,0x4000000b ; - mcall ,((3d_wnd_l+175) shl 16)+20,,0x4000000c ;ਭ 3d - - mcall SF_PUT_IMAGE,[image_data_toolbar],(21 shl 16)+21,(5 shl 16)+24 ;new - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mcall ,,,(30 shl 16)+24 ;open - add ebx,IMAGE_TOOLBAR_ICON_SIZE*6 - mcall ,,,((3d_wnd_l) shl 16)+24 ;設 . - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mcall ,,,((3d_wnd_l+25) shl 16)+24 ;ઠ ࠭ . - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mcall ,,,((3d_wnd_l+50) shl 16)+24 ; ࠭ . - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mcall ,,,((3d_wnd_l+100) shl 16)+24 ;ᢥ ./몫. - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mcall ,,,((3d_wnd_l+150) shl 16)+24 ; - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mcall ,,,((3d_wnd_l+75) shl 16)+24 ;࠭ ਠ . - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mcall ,,,((3d_wnd_l+125) shl 16)+24 ;ᣫ - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mcall ,,,((3d_wnd_l+175) shl 16)+24 ;ਭ 3d - - mov dword[w_scr_t1.all_redraw],1 - stdcall [tl_draw], tree1 - stdcall [buf2d_draw], buf_ogl - - mcall SF_REDRAW,SSF_END_DRAW -popad - ret - -align 4 -key: - mcall SF_GET_KEY - - cmp dword[el_focus], tree1 - jne @f - stdcall [tl_key], tree1 - jmp .end - @@: - - cmp ah,178 ;Up - jne @f - fld dword[angle_x] - fadd dword[delt_size] - fstp dword[angle_x] - stdcall [tl_node_get_data],tree1 - or eax,eax - jz .end - add eax,list_offs_obj3d - stdcall draw_3d, eax - jmp .end - @@: - cmp ah,177 ;Down - jne @f - fld dword[angle_x] - fsub dword[delt_size] - fstp dword[angle_x] - stdcall [tl_node_get_data],tree1 - or eax,eax - jz .end - add eax,list_offs_obj3d - stdcall draw_3d, eax - jmp .end - @@: - cmp ah,176 ;Left - jne @f - fld dword[angle_y] - fadd dword[delt_size] - fstp dword[angle_y] - stdcall [tl_node_get_data],tree1 - or eax,eax - jz .end - add eax,list_offs_obj3d - stdcall draw_3d, eax - jmp .end - @@: - cmp ah,179 ;Right - jne @f - fld dword[angle_y] - fsub dword[delt_size] - fstp dword[angle_y] - stdcall [tl_node_get_data],tree1 - or eax,eax - jz .end - add eax,list_offs_obj3d - stdcall draw_3d, eax - ;jmp .end - @@: - - .end: - jmp still - - -align 4 -button: - mcall SF_GET_BUTTON - cmp ah,3 - jne @f - call but_new_file - jmp still - @@: - cmp ah,4 - jne @f - call but_open_file - jmp still - @@: - - ;menu functions - cmp ah,5 - jne @f - call mnu_vertexes_on - jmp still - @@: - cmp ah,6 - jne @f - call mnu_edges_on - jmp still - @@: - cmp ah,7 - jne @f - call mnu_faces_on - jmp still - @@: - cmp ah,8 - jne @f - call mnu_faces_mat - jmp still - @@: - cmp ah,9 - jne @f - call mnu_light_on_off - jmp still - @@: - cmp ah,10 - jne @f - call mnu_smooth_on_off - jmp still - @@: - cmp ah,11 - jne @f - call mnu_reset_settings - jmp still - @@: - cmp ah,12 - jne @f - call mnu_make_scrshot - jmp still - @@: - - cmp ah,1 - jne still -.exit: - mov dword[tree1.data_img],0 - mov dword[tree1.data_img_sys],0 - stdcall [tl_data_clear], tree1 - stdcall [buf2d_delete],buf_1 ;㤠塞 - stdcall mem.Free,[image_data_toolbar] - stdcall mem.Free,[open_file_data] - stdcall [gluDeleteQuadric], [qObj] - mcall SF_TERMINATE_PROCESS - - -align 4 -but_new_file: -push eax ebx - stdcall [tl_node_poi_get_info], tree1,0 - @@: - or eax,eax - jz @f - mov ebx,eax - stdcall [tl_node_poi_get_data], tree1,ebx - add eax,list_offs_obj3d - stdcall obj_clear_param, eax - stdcall [tl_node_poi_get_next_info], tree1,ebx - or eax,eax - jnz @b - @@: -pop ebx eax - stdcall [tl_info_clear], tree1 ;⪠ ᯨ᪠ ꥪ⮢ - stdcall [buf2d_clear], buf_ogl, [buf_ogl.color] ;⨬ - stdcall [tl_draw], tree1 - stdcall [buf2d_draw], buf_ogl ;塞 ࠭ - ret - -align 4 -but_open_file: - copy_path open_dialog_name,communication_area_default_path,file_name,0 - pushad - mov [OpenDialog_data.type],0 - stdcall [OpenDialog_Start],OpenDialog_data - cmp [OpenDialog_data.status],2 - je .end_open_file - ; 㤠筮 ⨨ - jmp .end0 -.no_dlg: ;᫨ 㥬 䠩 - pushad - mov esi,openfile_path - stdcall str_len,esi - add esi,eax - @@: ;横 ᪠ 砫 䠩 - dec esi - cmp byte[esi],'/' - je @f - cmp byte[esi],0x5c ;'\' - je @f - cmp esi,openfile_path - jg @b - @@: - inc esi - stdcall [OpenDialog_Set_file_name],OpenDialog_data,esi ;㥬 䠩 ࠭ - .end0: - 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 - mcall SF_FILE,run_file_70 - - mov ecx,dword[open_b+32] ;+32 qword: ࠧ 䠩 - stdcall mem.ReAlloc,[open_file_data],ecx - mov [open_file_data],eax - - 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 - mcall SF_FILE,run_file_70 ;㦠 䠩 3ds - cmp ebx,0xffffffff - je .end_open_file - mov [open_file_size],ebx - ;mcall SF_SET_CAPTION,1,openfile_path - - call init_tree - stdcall [buf2d_draw], buf_ogl ;塞 ࠭ - .end_open_file: - popad - ret - -align 4 -init_tree: - ;⨬ ꥪ⠬ - stdcall [tl_node_poi_get_info], tree1,0 - @@: - or eax,eax - jz @f - mov ebx,eax - stdcall [tl_node_poi_get_data], tree1,ebx - or eax,eax - jz @f - add eax,list_offs_obj3d - stdcall obj_clear_param, eax - stdcall [tl_node_poi_get_next_info], tree1,ebx - or eax,eax - jnz @b - @@: - stdcall [tl_info_clear], tree1 ;⪠ ᯨ᪠ ꥪ⮢ - - mov esi,[open_file_data] - stdcall convert_stl_3ds, esi,[open_file_size] ;஢塞 䠩 ଠ *.stl ? - or eax,eax - jz @f - ;᫨ 䠩 ଠ *.stl - mov [open_file_size],ecx - mov esi,eax - stdcall mem.Free,[open_file_data] - mov [open_file_data],esi - mov byte[can_save],1 - @@: - cmp word[esi],CHUNK_MAIN - je @f - mov eax,[esi] - bswap eax - stdcall hex_in_str, txt_no_3ds.zag, eax,8 - stdcall buf_draw_beg, buf_ogl - stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_no_3ds,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,[file_3ds.offs] - add edi,[file_3ds.size] - .cycle_main: - cmp dword[level_stack],0 - jle .end_cycle - - cmp esi,edi ;᫨ 䠩 - jge .end_cycle - - mov edx,[esi+2] ;ࠧ - call block_analiz - cmp word[esi],CHUNK_MATERIAL - je @f - cmp word[esi],CHUNK_OBJMESH - je @f - cmp word[esi],CHUNK_OBJBLOCK - je @f - mov dword[bl_found],0 - @@: - cmp dword[bl_found],0 - jne @f - ;ꥪ ⭮ - call block_next - jmp .cycle_main - @@: - ;ꥪ ⭮ - mov ecx,dword[bl_found] - mov bx,word[ecx+2] ; ꥪ - cmp word[esi],CHUNK_OBJBLOCK - jne .pod1 - add esi,6 - push esi - sub esi,6 - jmp .pod3 - .pod1: - cmp word[esi],CHUNK_MATERIAL - jne .pod2 - cmp word[esi+6],CHUNK_MATNAME - jne .pod2 - add esi,12 - push esi - sub esi,12 - jmp .pod3 - .pod2: - push dword[ecx+5] ;⠭⭮ - .pod3: - stdcall add_3ds_object, ebx,dword[level_stack],edx - 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: - ret - -; -;input: -; eax - stack pointer -; esi - memory pointer -;output: -; eax - new stack pointer -; esi - new memory pointer -align 4 -proc block_analiz_data uses ebx ecx edx edi - mov dx,[esi] - mov ecx,[esi+2] - sub ecx,6 ;ࠧ - add esi,6 - mov ebx,dword[level_stack] - inc ebx - ; *** ࠧ묨 묨 뤥 - cmp dx,CHUNK_OBJBLOCK ;ꥪ - jne @f - push ax - cld - xor al,al - mov edi,esi - repne scasb - pop ax - sub edi,esi ;edi - strlen - add esi,edi - ;sub ecx,edi ;㦥 ᤥ repne - jmp .next_bl - @@: - cmp dx,CHUNK_VERTLIST ;ᯨ᮪ 設 - je .vertexes - cmp dx,0x4111 ;䫠 設 - je .vertexes - cmp dx,CHUNK_MAPLIST ;⥪ न - je .vertexes - jmp @f - .vertexes: ;ࠡ⪠ , ᮤঠ 設 - add esi,2 - sub ecx,2 - sub esi,8 ;⠭ esi - call block_next - jmp .end_f - @@: - cmp dx,CHUNK_FACELIST ;ᯨ᮪ ࠭ - jne @f - push eax - movzx eax,word[esi] - shl eax,3 - add esi,2 - sub ecx,2 - - sub ecx,eax - cmp ecx,1 - jl .data_3 ;஢塞 뢠騩 ਠ, ਬ塞 ꥪ -if 1 - add esi,eax - mov ecx,dword[esi+2] - stdcall add_3ds_object, 10,ebx,ecx,0 ; ਠ - sub esi,eax -else - add esi,eax - pop eax - jmp .next_bl -end if - .data_3: - - sub esi,8 ;⠭ esi - pop eax - call block_next - jmp .end_f - @@: - cmp dx,CHUNK_FACEMAT ;ਠ ࠭ - jne @f - 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 - add esi,2 - sub ecx,2 - sub esi,edi ;⠭ esi (1) - sub esi,8 ;⠭ esi (2) - call block_next - jmp .end_f - @@: - ; *** 묨 㬮砭 ( 뤥 ) - 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: - ret -endp - -;室 1- ୨ -;input: -; eax - 㪠⥫ ६ ⥪ 䠩 file_3ds -; esi - 砫 த⥫᪮ -;output: -; ebx - destroy -; esi - 砫 த⥫᪮ -align 4 -block_children: - push ecx - ;஢ઠ ࠢ쭮 ࠧ஢ ୥ - lea ebx,[esi+6] ;室 砫 ୥ - add ebx,[ebx+2] ;塞 ࠧ ୥ - mov ecx,esi - add ecx,[esi+2] ;塞 ࠧ த⥫᪮ - cmp ebx,ecx ;뢠 㦭, . . ࠢ ⮫쪮 - jle @f - ;஢ 訡 䠩, ୨ 室 । த⥫᪮ - mov dword[level_stack],FILE_ERROR_CHUNK_SIZE - jmp .end_f - @@: - mov [eax],esi ;㪠⥫ 砫 - mov ebx,[esi+2] - mov [eax+4],ebx ;ࠧ - add esi,6 ;室 - inc dword[level_stack] - add eax,8 - .end_f: - pop ecx - ret - -;室 ᫥饬 ⥪饣 ஢ -;input: -; eax - ६묨 -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 - 㪠⥫ 㥬 -; icon - -; level - ஢ 㧫 -; size_bl - ࠧ -; info_bl - ப ᠭ -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_data] - mov dword[buffer],eax ;ᬥ饭 - mov ecx,dword[size_bl] - mov dword[buffer+4],ecx ;ࠧ (ᯮ 㭪樨 buf_draw_hex_table ᮢ ) - mov ecx,dword[bl_found] - or ecx,ecx - jz @f - ;... 㦥 㣮 㤠 - mov cl,byte[ecx+4] - @@: - mov byte[buffer+list_offs_chunk_del],cl - mov ecx,[level] - mov byte[buffer+list_offs_chunk_lev],cl - mov ecx,dword[info_bl] - mov dword[buffer+list_offs_p_data],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 - or ecx,ecx - jnz @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: - mov ecx,(sizeof.obj_3d)/4 - xor eax,eax - mov edi,buffer+list_offs_obj3d - rep stosd - stdcall [tl_node_add], tree1, ebx, buffer - stdcall [tl_cur_next], tree1 - popad - ret -endp - -;input: -; eax - value -; buf - string buffer -; len - buffer len -;output: -align 4 -proc convert_int_to_str, buf:dword, len:dword -pushad - mov edi,[buf] - mov esi,[len] - add esi,edi - dec esi - call .str -popad - ret -endp - -align 4 -.str: - mov ecx,10 - cmp eax,ecx - jb @f - xor edx,edx - div ecx - push edx - call .str - pop eax - @@: - cmp edi,esi - jge @f - or al,0x30 - stosb - mov byte[edi],0 - @@: - ret - -; 䠩 -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 '/sys',0 - -communication_area_name: - db 'FFFFFFFF_open_dialog',0 -open_dialog_name: - db 'opendial',0 -communication_area_default_path: - db '/sys/File managers/',0 - -Filter: -dd Filter.end - Filter.1 -.1: -db '3DS',0 -db 'STL',0 -.3: -db 'PNG',0 -.end: -db 0 - - -align 4 -system_dir_0 db '/sys/lib/' -lib_name_0 db 'proc_lib.obj',0 -system_dir_1 db '/sys/lib/' -lib_name_1 db 'libimg.obj',0 -system_dir_2 db '/sys/lib/' -lib_name_2 db 'box_lib.obj',0 -system_dir_3 db '/sys/lib/' -lib_name_3 db 'buf2d.obj',0 -system_dir_4 db '/sys/lib/' -lib_name_4 db 'kmenu.obj',0 -system_dir_5 db '/sys/lib/' -lib_name_5 db 'tinygl.obj',0 -system_dir_6 db '/sys/lib/' -lib_name_6 db 'libini.obj',0 - -align 4 -l_libs_start: - lib_0 l_libs lib_name_0, file_name, system_dir_0, import_proclib - lib_1 l_libs lib_name_1, file_name, system_dir_1, import_libimg - lib_2 l_libs lib_name_2, file_name, system_dir_2, import_box_lib - lib_3 l_libs lib_name_3, file_name, system_dir_3, import_buf2d - lib_4 l_libs lib_name_4, file_name, system_dir_4, import_libkmenu - lib_5 l_libs lib_name_5, file_name, system_dir_5, import_lib_tinygl - lib_6 l_libs lib_name_6, file_name, system_dir_6, import_libini -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 -import_proclib: - OpenDialog_Init dd aOpenDialog_Init - OpenDialog_Start dd aOpenDialog_Start - OpenDialog_Set_file_name dd aOpenDialog_Set_file_name - OpenDialog_Set_file_ext dd aOpenDialog_Set_file_ext -dd 0,0 - aOpenDialog_Init db 'OpenDialog_init',0 - aOpenDialog_Start db 'OpenDialog_start',0 - aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0 - aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',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_resize dd sz_buf2d_resize - 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_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_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_resize db 'buf2d_resize',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_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_set_pixel db 'buf2d_set_pixel',0 - -align 4 -import_box_lib: - dd sz_init1 - 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_edit_box_draw db 'edit_box_draw',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 - -align 4 -import_libkmenu: - kmenu_init dd akmenu_init - kmainmenu_draw dd akmainmenu_draw - kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent - ksubmenu_new dd aksubmenu_new - ksubmenu_delete dd aksubmenu_delete - ksubmenu_draw dd aksubmenu_draw - ksubmenu_add dd aksubmenu_add - kmenuitem_new dd akmenuitem_new - kmenuitem_delete dd akmenuitem_delete - kmenuitem_draw dd akmenuitem_draw -dd 0,0 - akmenu_init db 'kmenu_init',0 - akmainmenu_draw db 'kmainmenu_draw',0 - akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0 - aksubmenu_new db 'ksubmenu_new',0 - aksubmenu_delete db 'ksubmenu_delete',0 - aksubmenu_draw db 'ksubmenu_draw',0 - aksubmenu_add db 'ksubmenu_add',0 - akmenuitem_new db 'kmenuitem_new',0 - akmenuitem_delete db 'kmenuitem_delete',0 - akmenuitem_draw db 'kmenuitem_draw',0 - -align 4 -import_lib_tinygl: -macro E_LIB n -{ - n dd sz_#n -} -include '../../develop/libraries/TinyGL/asm_fork/export.inc' - dd 0,0 -macro E_LIB n -{ - sz_#n db `n,0 -} -include '../../develop/libraries/TinyGL/asm_fork/export.inc' - -align 4 -import_libini: - dd alib_init0 - ini_get_str dd aini_get_str - ini_get_int dd aini_get_int - ini_get_color dd aini_get_color -dd 0,0 - alib_init0 db 'lib_init',0 - aini_get_str db 'ini_get_str',0 - aini_get_int db 'ini_get_int',0 - aini_get_color db 'ini_get_color',0 - -align 4 -mouse_dd dd 0 -last_time dd 0 -angle_dxm dd 1.9111 ;~ 3d_wnd_w/180 - ਡ 㣫 業 饭 襩 -angle_dym dd 1.7333 ;~ 3d_wnd_h/180 -ratio dd 1.1025 ;~ 3d_wnd_w/3d_wnd_h - -align 4 -buf_ogl: - dd 0 ;㪠⥫ ࠦ - dw 3d_wnd_l,3d_wnd_t ;+4 left,top -.w: dd 3d_wnd_w -.h: dd 3d_wnd_h -.color: dd 0xffffd0 - dd 24 ;+16 color,bit in pixel - -align 4 -buf_1: - dd 0 ;㪠⥫ ࠦ - dw 0,0 ;+4 left,top - dd 128,144 ;+8 w,h - dd 0,24 ;+16 color,bit in pixel - -align 4 -el_focus dd tree1 -tree1 tree_list size_one_list,300+2, tl_key_no_edit+tl_draw_par_line,\ - 16,16, 0xffffff,0xb0d0ff,0x400040, 5,47,195-16,250, 16,list_offs_text,0, el_focus,\ - w_scr_t1,0 - -align 4 -w_scr_t1 scrollbar 16,0, 3,0, 15, 100, 0,0, 0,0,0, 1 - -align 4 -qObj dd 0 - -light_position dd 0.0, 0.0, -2.0, 1.0 ; ᯮ 筨 [0][1][2] - ;[3] = (0.0 - ᪮筮 㤠 筨, 1.0 - 筨 ᢥ । ﭨ) -light_dir dd 0.0,0.0,0.0 ;ࠢ - -mat_specular dd 0.3, 0.3, 0.3, 1.0 ; -mat_shininess dd 3.0 ; (⭠ ய) -white_light dd 0.8, 0.8, 0.8, 1.0 ; ⥭ᨢ ᢥ饭, 㥬 筨 -lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; ࠬ 䮭 ᢥ饭 - -if lang eq ru_RU -capt db 'info 3ds [user] 29.09.20',0 ; -else -capt db 'info 3ds [user] version 29.09.20',0 ;window caption -end if - -align 16 -i_end: - ctx1 rb 28 ;sizeof.TinyGLContext = 28 - procinfo process_information - run_file_70 FileInfoBlock - sc system_colors - angle_x rd 1 ;㣫 業 - angle_y rd 1 - angle_z rd 1 - color_ox rd 1 - color_oy rd 1 - color_oz rd 1 - color_bk rd 3 - color_vert rd 1 - color_face rd 1 - color_select rd 1 -align 16 - rb 4096 -stacktop: - sys_path rb 2048 - file_name rb 4096 - plugin_path rb 4096 - openfile_path rb 4096 - filename_area rb 256 -mem: +use32 + org 0 + db 'MENUET01' ;. ᯮ塞 䠩 ᥣ 8 + dd 1, start, i_end, mem, stacktop, file_name, sys_path + +version_edit equ 0 + +include '../../macros.inc' +include '../../proc32.inc' +include '../../KOSfuncs.inc' +include '../../develop/libraries/libs-dev/libimg/libimg.inc' +include '../../load_img.inc' +include '../../load_lib.mac' +include '../../develop/libraries/box_lib/trunk/box_lib.mac' +include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. +include 'info_fun_float.inc' +include 'info_menu.inc' +include 'data.inc' +include 'convert_stl_3ds.inc' + +3d_wnd_l equ 205 ; tinygl ᫥ +3d_wnd_t equ 47 ; tinygl ᢥ +3d_wnd_w equ 344 +3d_wnd_h equ 312 + +@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load + +ID_ICON_CHUNK_MAIN equ 0 ; +ID_ICON_CHUNK_NOT_FOUND equ 1 ; ⭮ +ID_ICON_DATA equ 2 ; , । +ID_ICON_POINT equ 8 +ID_ICON_POINT_SEL equ 9 + +FILE_ERROR_CHUNK_SIZE equ -3 ;訡 ࠧ + +size_one_list equ 42+sizeof.obj_3d +list_offs_chunk_del equ 8 ; 㤠 +list_offs_chunk_lev equ 9 ;஢ (யᠭ 㧫) +list_offs_p_data equ 10 ;㪠⥫ +list_offs_obj3d equ 14 ;㪠⥫ 3d ꥪ +list_offs_text equ 14+sizeof.obj_3d ;ᤢ 砫 ⥪ +include 'info_o3d.inc' + +align 4 +fl255 dd 255.0 +open_file_data dd 0 ;㪠⥫ 䠩 3ds +open_file_size dd 0 ;ࠧ ⮣ 䠩 + +; +main_wnd_height equ 460 ; ணࠬ +fn_toolbar db 'toolbar.png',0 +IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3 +image_data_toolbar dd 0 +; +icon_tl_sys dd 0 ;㪠⥫ ࠭ ⥬ +icon_toolbar dd 0 ;㪠⥫ ࠭ ꥪ⮢ + +;-------------------------------------- +level_stack dd 0 +offs_last_timer dd 0 ;᫥ ᤢ 㭪樨 ⠩ + +align 4 +file_3ds: ;६ ᯮ㥬 ⨨ 䠩 +.offs: dd 0 ;+0 㪠⥫ 砫 +.size: dd 0 ;+4 ࠧ ( 1- ࠬ = ࠧ 䠩 3ds) +rb 8*MAX_FILE_LEVEL + +buffer rb size_one_list ; ᯨ᮪ tree1 + +txt_3ds_symb db 0,0 +;-------------------------------------- + + + +align 4 +start: + ;--- copy cmd line --- + mov esi,file_name + mov edi,openfile_path +@@: + lodsd + or eax,eax + jz @f ;室, ᫨ 0 + stosd + jmp @b +@@: + stosd + + load_libraries l_libs_start,l_libs_end + ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ + mov ebp,lib_0 + .test_lib_open: + cmp dword [ebp+ll_struc_size-4],0 + jz @f + mcall SF_TERMINATE_PROCESS ;exit not correct + @@: + add ebp,ll_struc_size + cmp ebp,l_libs_end + jl .test_lib_open + mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors + mcall SF_SET_EVENTS_MASK,0xC0000027 + + stdcall [OpenDialog_Init],OpenDialog_data ;⮢ + + ;kmenu initialisation + stdcall [kmenu_init],sc + stdcall [ksubmenu_new] + mov [main_menu], eax + + stdcall [ksubmenu_new] + mov [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Vertexes, 5 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces, 6 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces_Fill, 7 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces_Mat, 8 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Light, 9 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Smooth, 10 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Reset, 11 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_View, [main_menu_view] + stdcall [ksubmenu_add], [main_menu], eax + + mov dword[w_scr_t1.type],1 + stdcall [tl_data_init], tree1 + ;⥬ 16*16 tree_list + include_image_file 'tl_sys_16.png', icon_tl_sys + ;᫨ ࠦ 뫮, icon_tl_sys + ; 樠஢ , 訡 㤥, . . 㦭 ࠧ + mov eax,dword[icon_tl_sys] + mov dword[tree1.data_img_sys],eax + + load_image_file 'objects.png', icon_toolbar + mov eax,dword[icon_toolbar] + mov dword[tree1.data_img],eax + + load_image_file 'font8x9.bmp', image_data_toolbar + 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 + + ;ࠡ 䠩 ஥ + copy_path ini_name,sys_path,file_name,0 + mov dword[def_dr_mode],0 + stdcall [ini_get_int],file_name,ini_sec_w3d,key_dv,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_vertexes + @@: + stdcall [ini_get_int],file_name,ini_sec_w3d,key_df,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_faces + @@: + stdcall [ini_get_int],file_name,ini_sec_w3d,key_dff,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_faces_fill + @@: + stdcall [ini_get_int],file_name,ini_sec_w3d,key_dfm,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_faces_mat + @@: + stdcall [ini_get_int],file_name,ini_sec_w3d,key_dl,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_light + @@: + stdcall [ini_get_int],file_name,ini_sec_w3d,key_ds,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_smooth + @@: + stdcall [ini_get_color],file_name,ini_sec_w3d,key_ox,0x0000ff + mov [color_ox],eax + stdcall [ini_get_color],file_name,ini_sec_w3d,key_oy,0xff0000 + mov [color_oy],eax + stdcall [ini_get_color],file_name,ini_sec_w3d,key_oz,0x00ff00 + mov [color_oz],eax + stdcall [ini_get_color],file_name,ini_sec_w3d,key_bk,0x000000 + mov [color_bk],eax + shr eax,8 + mov [color_bk+4],eax + shr eax,8 + mov [color_bk+8],eax + stdcall [ini_get_color],file_name,ini_sec_w3d,key_vert,0xffffff + mov [color_vert],eax + stdcall [ini_get_color],file_name,ini_sec_w3d,key_face,0x808080 + mov [color_face],eax + stdcall [ini_get_color],file_name,ini_sec_w3d,key_select,0xffff00 + mov [color_select],eax + finit + fild dword[color_bk+8] + fdiv dword[fl255] + fstp dword[color_bk+8] + mov eax,[color_bk+4] + and eax,0xff + mov [color_bk+4],eax + fild dword[color_bk+4] + fdiv dword[fl255] + fstp dword[color_bk+4] + mov eax,[color_bk] + and eax,0xff + mov [color_bk],eax + fild dword[color_bk] + fdiv dword[fl255] + fstp dword[color_bk] + + 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 + stdcall [glEnable], GL_DEPTH_TEST + stdcall [glEnable], GL_NORMALIZE ; ଠ 稭 䠪⮢ + stdcall [glClearColor], [color_bk+8],[color_bk+4],[color_bk],0.0 + stdcall [glShadeModel], GL_SMOOTH + call [gluNewQuadric] + mov [qObj],eax + + mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext + mov eax,[eax] ;eax -> ZBuffer + mov eax,[eax+ZBuffer.pbuf] + mov dword[buf_ogl],eax + + ;open file from cmd line + cmp dword[openfile_path],0 + je @f + call but_open_file.no_dlg + @@: + call draw_window + +align 4 +still: + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov ebx,[last_time] + add ebx,10 ;প + cmp ebx,eax + jge @f + mov ebx,eax + @@: + sub ebx,eax + mcall SF_WAIT_EVENT_TIMEOUT + or eax,eax + jz timer_funct + + cmp al,1 + jne @f + call draw_window + jmp still + @@: + cmp al,2 + jz key + cmp al,3 + jz button + cmp al,6 + jne @f + mcall SF_THREAD_INFO,procinfo,-1 + cmp ax,word[procinfo+4] + jne @f ; ⨢ + call mouse + @@: + jmp still + +align 4 +mouse: + push eax ebx + 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 + + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end_d + mov ebx,[eax] + add ebx,dword[open_file_data] ;砥 祭 ᤢ + cmp word[ebx],CHUNK_OBJBLOCK + jne .end_d + + mcall SF_MOUSE_GET,SSF_WINDOW_POSITION + mov ebx,eax + sar ebx,16 ;mouse.x + cmp ebx,3d_wnd_l + jg @f + mov ebx,3d_wnd_l + @@: + sub ebx,3d_wnd_l + cmp ebx,3d_wnd_w + jle @f + mov ebx,3d_wnd_w + @@: + movsx eax,ax ;mouse.y + cmp eax,3d_wnd_t + jg @f + mov eax,3d_wnd_t + @@: + sub eax,3d_wnd_t + cmp eax,3d_wnd_h + jle @f + mov eax,3d_wnd_h + @@: + finit + fild dword[mouse_y] + mov [mouse_y],eax + fisub dword[mouse_y] + fdiv dword[angle_dxm] ;᫨ y ( ) x + fadd dword[angle_x] + fstp dword[angle_x] + + fild dword[mouse_x] + mov [mouse_x],ebx + fisub dword[mouse_x] + fdiv dword[angle_dym] ;᫨ x ( ) y + fadd dword[angle_y] + fstp dword[angle_y] + + stdcall [tl_node_get_data],tree1 + ;cmp eax,0 - , 뫮 ᤥ + add eax,list_offs_obj3d + stdcall draw_3d, eax + jmp .end_d + .end_m: + bt eax,16 + jnc @f + ;mouse l. but. up + mov dword[mouse_drag],0 + jmp .end_d + @@: + bt eax,8 + jnc .end_d + ;mouse l. but. press + mcall SF_MOUSE_GET,SSF_WINDOW_POSITION + mov ebx,eax + sar ebx,16 ;mouse.x + cmp ebx,3d_wnd_l + jl .end_d + sub ebx,3d_wnd_l + cmp ebx,3d_wnd_w + jg .end_d + movsx eax,ax ;mouse.y + cmp eax,3d_wnd_t + jl .end_d + sub eax,3d_wnd_t + cmp eax,3d_wnd_h + jg .end_d + mov dword[mouse_drag],1 + mov dword[mouse_x],ebx + mov dword[mouse_y],eax + .end_d: + + stdcall [tl_mouse], tree1 + stdcall [kmainmenu_dispatch_cursorevent], [main_menu] + pop ebx eax + ret + +align 4 +timer_funct: + pushad + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov [last_time],eax + + ;ᬠਢ 뤥 + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end_f + lea edi,[eax+list_offs_obj3d] + mov ebx,eax + mov eax,[ebx] + mov ecx,[ebx+4] ;ࠧ + stdcall hex_in_str, txt_3ds_offs.dig, eax,8 + stdcall hex_in_str, txt_3ds_offs.siz, ecx,8 + + add eax,[open_file_data] ;砥 祭 ᤢ + cmp [offs_last_timer],eax + je .end_f + ;᫨ 뤥 ᮢ ᫥ + mov [offs_last_timer],eax + + cmp word[eax],CHUNK_OBJBLOCK + jne .end_oblo + cmp dword[edi+obj_3d.poi_count],2 + jl .ini_oblo + stdcall draw_3d,edi + jmp .end_f + .ini_oblo: + stdcall obj_init,edi ;⪠ ந ६ ꥪ + cmp dword[edi+obj_3d.poi_count],2 + jl .end_f + call mnu_reset_settings ; 㣫 ० ᮢ + jmp .end_f + .end_oblo: + + cmp word[eax],CHUNK_MATERIAL + jne .end_mblo + cmp dword[edi+material.name],0 + je .ini_mblo + stdcall draw_material,edi + jmp .end_f + .ini_mblo: + stdcall mat_init,edi,eax ;⪠ ந ਠ + cmp dword[edi+material.name],0 + je .end_f + stdcall draw_material,edi + jmp .end_f + .end_mblo: + + stdcall buf_draw_beg, buf_ogl + stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_3ds_offs,5,35,0xb000 + mov edx,[ebx+list_offs_p_data] + or edx,edx ;ᬮਬ ᠭ + jz .no_info + stdcall [buf2d_draw_text], buf_ogl, buf_1,edx,5,45,0xb000 + .no_info: + stdcall [buf2d_draw], buf_ogl ;塞 ࠭ + .end_f: + popad + jmp still + +align 4 +draw_window: +pushad + mcall SF_REDRAW,SSF_BEGIN_DRAW + mov edx,[sc.work] + or edx,0x33000000 + mcall SF_CREATE_WINDOW, (20 shl 16)+560, (20 shl 16)+main_wnd_height,,, capt + + mcall SF_THREAD_INFO,procinfo,-1 + mov eax,dword[procinfo.box.height] + cmp eax,250 + jge @f + mov eax,250 + @@: + sub eax,30 + sub eax,[tree1.box_top] + mov [tree1.box_height],eax + mov word[w_scr_t1.y_size],ax ; ࠧ ஫ + + stdcall [kmainmenu_draw], [main_menu] + + mov esi,[sc.work_button] + mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(24 shl 16)+20,0x40000003 + mcall ,(30 shl 16)+20,,0x40000004 ;open + mcall ,(3d_wnd_l shl 16)+20,,0x40000005 ;設 . + mcall ,((3d_wnd_l+25) shl 16)+20,,0x40000006 ;ઠ ࠭ . + mcall ,((3d_wnd_l+50) shl 16)+20,,0x40000007 ; ࠭ . + mcall ,((3d_wnd_l+75) shl 16)+20,,0x40000008 ;࠭ ਠ . + mcall ,((3d_wnd_l+100) shl 16)+20,,0x40000009 ;ᢥ ./몫. + mcall ,((3d_wnd_l+125) shl 16)+20,,0x4000000a ;ᣫ + mcall ,((3d_wnd_l+150) shl 16)+20,,0x4000000b ; + mcall ,((3d_wnd_l+175) shl 16)+20,,0x4000000c ;ਭ 3d + + mcall SF_PUT_IMAGE,[image_data_toolbar],(21 shl 16)+21,(5 shl 16)+24 ;new + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mcall ,,,(30 shl 16)+24 ;open + add ebx,IMAGE_TOOLBAR_ICON_SIZE*6 + mcall ,,,((3d_wnd_l) shl 16)+24 ;設 . + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mcall ,,,((3d_wnd_l+25) shl 16)+24 ;ઠ ࠭ . + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mcall ,,,((3d_wnd_l+50) shl 16)+24 ; ࠭ . + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mcall ,,,((3d_wnd_l+100) shl 16)+24 ;ᢥ ./몫. + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mcall ,,,((3d_wnd_l+150) shl 16)+24 ; + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mcall ,,,((3d_wnd_l+75) shl 16)+24 ;࠭ ਠ . + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mcall ,,,((3d_wnd_l+125) shl 16)+24 ;ᣫ + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mcall ,,,((3d_wnd_l+175) shl 16)+24 ;ਭ 3d + + mov dword[w_scr_t1.all_redraw],1 + stdcall [tl_draw], tree1 + stdcall [buf2d_draw], buf_ogl + + mcall SF_REDRAW,SSF_END_DRAW +popad + ret + +align 4 +key: + mcall SF_GET_KEY + + cmp dword[el_focus], tree1 + jne @f + stdcall [tl_key], tree1 + jmp .end + @@: + + cmp ah,178 ;Up + jne @f + fld dword[angle_x] + fadd dword[delt_size] + fstp dword[angle_x] + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end + add eax,list_offs_obj3d + stdcall draw_3d, eax + jmp .end + @@: + cmp ah,177 ;Down + jne @f + fld dword[angle_x] + fsub dword[delt_size] + fstp dword[angle_x] + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end + add eax,list_offs_obj3d + stdcall draw_3d, eax + jmp .end + @@: + cmp ah,176 ;Left + jne @f + fld dword[angle_y] + fadd dword[delt_size] + fstp dword[angle_y] + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end + add eax,list_offs_obj3d + stdcall draw_3d, eax + jmp .end + @@: + cmp ah,179 ;Right + jne @f + fld dword[angle_y] + fsub dword[delt_size] + fstp dword[angle_y] + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end + add eax,list_offs_obj3d + stdcall draw_3d, eax + ;jmp .end + @@: + + .end: + jmp still + + +align 4 +button: + mcall SF_GET_BUTTON + cmp ah,3 + jne @f + call but_new_file + jmp still + @@: + cmp ah,4 + jne @f + call but_open_file + jmp still + @@: + + ;menu functions + cmp ah,5 + jne @f + call mnu_vertexes_on + jmp still + @@: + cmp ah,6 + jne @f + call mnu_edges_on + jmp still + @@: + cmp ah,7 + jne @f + call mnu_faces_on + jmp still + @@: + cmp ah,8 + jne @f + call mnu_faces_mat + jmp still + @@: + cmp ah,9 + jne @f + call mnu_light_on_off + jmp still + @@: + cmp ah,10 + jne @f + call mnu_smooth_on_off + jmp still + @@: + cmp ah,11 + jne @f + call mnu_reset_settings + jmp still + @@: + cmp ah,12 + jne @f + call mnu_make_scrshot + jmp still + @@: + + cmp ah,1 + jne still +.exit: + mov dword[tree1.data_img],0 + mov dword[tree1.data_img_sys],0 + stdcall [tl_data_clear], tree1 + stdcall [buf2d_delete],buf_1 ;㤠塞 + stdcall mem.Free,[image_data_toolbar] + stdcall mem.Free,[open_file_data] + stdcall [gluDeleteQuadric], [qObj] + mcall SF_TERMINATE_PROCESS + + +align 4 +but_new_file: +push eax ebx + stdcall [tl_node_poi_get_info], tree1,0 + @@: + or eax,eax + jz @f + mov ebx,eax + stdcall [tl_node_poi_get_data], tree1,ebx + add eax,list_offs_obj3d + stdcall obj_clear_param, eax + stdcall [tl_node_poi_get_next_info], tree1,ebx + or eax,eax + jnz @b + @@: +pop ebx eax + stdcall [tl_info_clear], tree1 ;⪠ ᯨ᪠ ꥪ⮢ + stdcall [buf2d_clear], buf_ogl, [buf_ogl.color] ;⨬ + stdcall [tl_draw], tree1 + stdcall [buf2d_draw], buf_ogl ;塞 ࠭ + ret + +align 4 +but_open_file: + copy_path open_dialog_name,communication_area_default_path,file_name,0 + pushad + mov [OpenDialog_data.type],0 + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],2 + je .end_open_file + ; 㤠筮 ⨨ + jmp .end0 +.no_dlg: ;᫨ 㥬 䠩 + pushad + mov esi,openfile_path + stdcall str_len,esi + add esi,eax + @@: ;横 ᪠ 砫 䠩 + dec esi + cmp byte[esi],'/' + je @f + cmp byte[esi],0x5c ;'\' + je @f + cmp esi,openfile_path + jg @b + @@: + inc esi + stdcall [OpenDialog_Set_file_name],OpenDialog_data,esi ;㥬 䠩 ࠭ + .end0: + 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 + mcall SF_FILE,run_file_70 + + mov ecx,dword[open_b+32] ;+32 qword: ࠧ 䠩 + stdcall mem.ReAlloc,[open_file_data],ecx + mov [open_file_data],eax + + 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 + mcall SF_FILE,run_file_70 ;㦠 䠩 3ds + cmp ebx,0xffffffff + je .end_open_file + mov [open_file_size],ebx + ;mcall SF_SET_CAPTION,1,openfile_path + + call init_tree + stdcall [buf2d_draw], buf_ogl ;塞 ࠭ + .end_open_file: + popad + ret + +align 4 +init_tree: + ;⨬ ꥪ⠬ + stdcall [tl_node_poi_get_info], tree1,0 + @@: + or eax,eax + jz @f + mov ebx,eax + stdcall [tl_node_poi_get_data], tree1,ebx + or eax,eax + jz @f + add eax,list_offs_obj3d + stdcall obj_clear_param, eax + stdcall [tl_node_poi_get_next_info], tree1,ebx + or eax,eax + jnz @b + @@: + stdcall [tl_info_clear], tree1 ;⪠ ᯨ᪠ ꥪ⮢ + + mov esi,[open_file_data] + stdcall convert_stl_3ds, esi,[open_file_size] ;஢塞 䠩 ଠ *.stl ? + or eax,eax + jz @f + ;᫨ 䠩 ଠ *.stl + mov [open_file_size],ecx + mov esi,eax + stdcall mem.Free,[open_file_data] + mov [open_file_data],esi + mov byte[can_save],1 + @@: + cmp word[esi],CHUNK_MAIN + je @f + mov eax,[esi] + bswap eax + stdcall hex_in_str, txt_no_3ds.zag, eax,8 + stdcall buf_draw_beg, buf_ogl + stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_no_3ds,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,[file_3ds.offs] + add edi,[file_3ds.size] + .cycle_main: + cmp dword[level_stack],0 + jle .end_cycle + + cmp esi,edi ;᫨ 䠩 + jge .end_cycle + + mov edx,[esi+2] ;ࠧ + call block_analiz + cmp word[esi],CHUNK_MATERIAL + je @f + cmp word[esi],CHUNK_OBJMESH + je @f + cmp word[esi],CHUNK_OBJBLOCK + je @f + mov dword[bl_found],0 + @@: + cmp dword[bl_found],0 + jne @f + ;ꥪ ⭮ + call block_next + jmp .cycle_main + @@: + ;ꥪ ⭮ + mov ecx,dword[bl_found] + mov bx,word[ecx+2] ; ꥪ + cmp word[esi],CHUNK_OBJBLOCK + jne .pod1 + add esi,6 + push esi + sub esi,6 + jmp .pod3 + .pod1: + cmp word[esi],CHUNK_MATERIAL + jne .pod2 + cmp word[esi+6],CHUNK_MATNAME + jne .pod2 + add esi,12 + push esi + sub esi,12 + jmp .pod3 + .pod2: + push dword[ecx+5] ;⠭⭮ + .pod3: + stdcall add_3ds_object, ebx,dword[level_stack],edx + 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: + ret + +; +;input: +; eax - stack pointer +; esi - memory pointer +;output: +; eax - new stack pointer +; esi - new memory pointer +align 4 +proc block_analiz_data uses ebx ecx edx edi + mov dx,[esi] + mov ecx,[esi+2] + sub ecx,6 ;ࠧ + add esi,6 + mov ebx,dword[level_stack] + inc ebx + ; *** ࠧ묨 묨 뤥 + cmp dx,CHUNK_OBJBLOCK ;ꥪ + jne @f + push ax + cld + xor al,al + mov edi,esi + repne scasb + pop ax + sub edi,esi ;edi - strlen + add esi,edi + ;sub ecx,edi ;㦥 ᤥ repne + jmp .next_bl + @@: + cmp dx,CHUNK_VERTLIST ;ᯨ᮪ 設 + je .vertexes + cmp dx,0x4111 ;䫠 設 + je .vertexes + cmp dx,CHUNK_MAPLIST ;⥪ न + je .vertexes + jmp @f + .vertexes: ;ࠡ⪠ , ᮤঠ 設 + add esi,2 + sub ecx,2 + sub esi,8 ;⠭ esi + call block_next + jmp .end_f + @@: + cmp dx,CHUNK_FACELIST ;ᯨ᮪ ࠭ + jne @f + push eax + movzx eax,word[esi] + shl eax,3 + add esi,2 + sub ecx,2 + + sub ecx,eax + cmp ecx,1 + jl .data_3 ;஢塞 뢠騩 ਠ, ਬ塞 ꥪ +if 1 + add esi,eax + mov ecx,dword[esi+2] + stdcall add_3ds_object, 10,ebx,ecx,0 ; ਠ + sub esi,eax +else + add esi,eax + pop eax + jmp .next_bl +end if + .data_3: + + sub esi,8 ;⠭ esi + pop eax + call block_next + jmp .end_f + @@: + cmp dx,CHUNK_FACEMAT ;ਠ ࠭ + jne @f + 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 + add esi,2 + sub ecx,2 + sub esi,edi ;⠭ esi (1) + sub esi,8 ;⠭ esi (2) + call block_next + jmp .end_f + @@: + ; *** 묨 㬮砭 ( 뤥 ) + 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: + ret +endp + +;室 1- ୨ +;input: +; eax - 㪠⥫ ६ ⥪ 䠩 file_3ds +; esi - 砫 த⥫᪮ +;output: +; ebx - destroy +; esi - 砫 த⥫᪮ +align 4 +block_children: + push ecx + ;஢ઠ ࠢ쭮 ࠧ஢ ୥ + lea ebx,[esi+6] ;室 砫 ୥ + add ebx,[ebx+2] ;塞 ࠧ ୥ + mov ecx,esi + add ecx,[esi+2] ;塞 ࠧ த⥫᪮ + cmp ebx,ecx ;뢠 㦭, . . ࠢ ⮫쪮 + jle @f + ;஢ 訡 䠩, ୨ 室 । த⥫᪮ + mov dword[level_stack],FILE_ERROR_CHUNK_SIZE + jmp .end_f + @@: + mov [eax],esi ;㪠⥫ 砫 + mov ebx,[esi+2] + mov [eax+4],ebx ;ࠧ + add esi,6 ;室 + inc dword[level_stack] + add eax,8 + .end_f: + pop ecx + ret + +;室 ᫥饬 ⥪饣 ஢ +;input: +; eax - ६묨 +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 - 㪠⥫ 㥬 +; icon - +; level - ஢ 㧫 +; size_bl - ࠧ +; info_bl - ப ᠭ +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_data] + mov dword[buffer],eax ;ᬥ饭 + mov ecx,dword[size_bl] + mov dword[buffer+4],ecx ;ࠧ (ᯮ 㭪樨 buf_draw_hex_table ᮢ ) + mov ecx,dword[bl_found] + or ecx,ecx + jz @f + ;... 㦥 㣮 㤠 + mov cl,byte[ecx+4] + @@: + mov byte[buffer+list_offs_chunk_del],cl + mov ecx,[level] + mov byte[buffer+list_offs_chunk_lev],cl + mov ecx,dword[info_bl] + mov dword[buffer+list_offs_p_data],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 + or ecx,ecx + jnz @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: + mov ecx,(sizeof.obj_3d)/4 + xor eax,eax + mov edi,buffer+list_offs_obj3d + rep stosd + stdcall [tl_node_add], tree1, ebx, buffer + stdcall [tl_cur_next], tree1 + popad + ret +endp + +;input: +; eax - value +; buf - string buffer +; len - buffer len +;output: +align 4 +proc convert_int_to_str, buf:dword, len:dword +pushad + mov edi,[buf] + mov esi,[len] + add esi,edi + dec esi + call .str +popad + ret +endp + +align 4 +.str: + mov ecx,10 + cmp eax,ecx + jb @f + xor edx,edx + div ecx + push edx + call .str + pop eax + @@: + cmp edi,esi + jge @f + or al,0x30 + stosb + mov byte[edi],0 + @@: + ret + +; 䠩 +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 '/sys',0 + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_name: + db 'opendial',0 +communication_area_default_path: + db '/sys/File managers/',0 + +Filter: +dd Filter.end - Filter.1 +.1: +db '3DS',0 +db 'STL',0 +.3: +db 'PNG',0 +.end: +db 0 + + +align 4 +system_dir_0 db '/sys/lib/' +lib_name_0 db 'proc_lib.obj',0 +system_dir_1 db '/sys/lib/' +lib_name_1 db 'libimg.obj',0 +system_dir_2 db '/sys/lib/' +lib_name_2 db 'box_lib.obj',0 +system_dir_3 db '/sys/lib/' +lib_name_3 db 'buf2d.obj',0 +system_dir_4 db '/sys/lib/' +lib_name_4 db 'kmenu.obj',0 +system_dir_5 db '/sys/lib/' +lib_name_5 db 'tinygl.obj',0 +system_dir_6 db '/sys/lib/' +lib_name_6 db 'libini.obj',0 + +align 4 +l_libs_start: + lib_0 l_libs lib_name_0, file_name, system_dir_0, import_proclib + lib_1 l_libs lib_name_1, file_name, system_dir_1, import_libimg + lib_2 l_libs lib_name_2, file_name, system_dir_2, import_box_lib + lib_3 l_libs lib_name_3, file_name, system_dir_3, import_buf2d + lib_4 l_libs lib_name_4, file_name, system_dir_4, import_libkmenu + lib_5 l_libs lib_name_5, file_name, system_dir_5, import_lib_tinygl + lib_6 l_libs lib_name_6, file_name, system_dir_6, import_libini +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 +import_proclib: + OpenDialog_Init dd aOpenDialog_Init + OpenDialog_Start dd aOpenDialog_Start + OpenDialog_Set_file_name dd aOpenDialog_Set_file_name + OpenDialog_Set_file_ext dd aOpenDialog_Set_file_ext +dd 0,0 + aOpenDialog_Init db 'OpenDialog_init',0 + aOpenDialog_Start db 'OpenDialog_start',0 + aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0 + aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',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_resize dd sz_buf2d_resize + 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_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_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_resize db 'buf2d_resize',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_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_set_pixel db 'buf2d_set_pixel',0 + +align 4 +import_box_lib: + dd sz_init1 + 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_edit_box_draw db 'edit_box_draw',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 + +align 4 +import_libkmenu: + kmenu_init dd akmenu_init + kmainmenu_draw dd akmainmenu_draw + kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent + ksubmenu_new dd aksubmenu_new + ksubmenu_delete dd aksubmenu_delete + ksubmenu_draw dd aksubmenu_draw + ksubmenu_add dd aksubmenu_add + kmenuitem_new dd akmenuitem_new + kmenuitem_delete dd akmenuitem_delete + kmenuitem_draw dd akmenuitem_draw +dd 0,0 + akmenu_init db 'kmenu_init',0 + akmainmenu_draw db 'kmainmenu_draw',0 + akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0 + aksubmenu_new db 'ksubmenu_new',0 + aksubmenu_delete db 'ksubmenu_delete',0 + aksubmenu_draw db 'ksubmenu_draw',0 + aksubmenu_add db 'ksubmenu_add',0 + akmenuitem_new db 'kmenuitem_new',0 + akmenuitem_delete db 'kmenuitem_delete',0 + akmenuitem_draw db 'kmenuitem_draw',0 + +align 4 +import_lib_tinygl: +macro E_LIB n +{ + n dd sz_#n +} +include '../../develop/libraries/TinyGL/asm_fork/export.inc' + dd 0,0 +macro E_LIB n +{ + sz_#n db `n,0 +} +include '../../develop/libraries/TinyGL/asm_fork/export.inc' + +align 4 +import_libini: + dd alib_init0 + ini_get_str dd aini_get_str + ini_get_int dd aini_get_int + ini_get_color dd aini_get_color +dd 0,0 + alib_init0 db 'lib_init',0 + aini_get_str db 'ini_get_str',0 + aini_get_int db 'ini_get_int',0 + aini_get_color db 'ini_get_color',0 + +align 4 +mouse_dd dd 0 +last_time dd 0 +angle_dxm dd 1.9111 ;~ 3d_wnd_w/180 - ਡ 㣫 業 饭 襩 +angle_dym dd 1.7333 ;~ 3d_wnd_h/180 +ratio dd 1.1025 ;~ 3d_wnd_w/3d_wnd_h + +align 4 +buf_ogl: + dd 0 ;㪠⥫ ࠦ + dw 3d_wnd_l,3d_wnd_t ;+4 left,top +.w: dd 3d_wnd_w +.h: dd 3d_wnd_h +.color: dd 0xffffd0 + dd 24 ;+16 color,bit in pixel + +align 4 +buf_1: + dd 0 ;㪠⥫ ࠦ + dw 0,0 ;+4 left,top + dd 128,144 ;+8 w,h + dd 0,24 ;+16 color,bit in pixel + +align 4 +el_focus dd tree1 +tree1 tree_list size_one_list,300+2, tl_key_no_edit+tl_draw_par_line,\ + 16,16, 0xffffff,0xb0d0ff,0x400040, 5,47,195-16,250, 16,list_offs_text,0, el_focus,\ + w_scr_t1,0 + +align 4 +w_scr_t1 scrollbar 16,0, 3,0, 15, 100, 0,0, 0,0,0, 1 + +align 4 +qObj dd 0 + +light_position dd 0.0, 0.0, -2.0, 1.0 ; ᯮ 筨 [0][1][2] + ;[3] = (0.0 - ᪮筮 㤠 筨, 1.0 - 筨 ᢥ । ﭨ) +light_dir dd 0.0,0.0,0.0 ;ࠢ + +mat_specular dd 0.3, 0.3, 0.3, 1.0 ; +mat_shininess dd 3.0 ; (⭠ ய) +white_light dd 0.8, 0.8, 0.8, 1.0 ; ⥭ᨢ ᢥ饭, 㥬 筨 +lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; ࠬ 䮭 ᢥ饭 + +if lang eq ru_RU +capt db 'info 3ds [user] 29.09.20',0 ; +else ; Default to en_US +capt db 'info 3ds [user] version 29.09.20',0 ; Window caption +end if + +align 16 +i_end: + ctx1 rb 28 ;sizeof.TinyGLContext = 28 + procinfo process_information + run_file_70 FileInfoBlock + sc system_colors + angle_x rd 1 ;㣫 業 + angle_y rd 1 + angle_z rd 1 + color_ox rd 1 + color_oy rd 1 + color_oz rd 1 + color_bk rd 3 + color_vert rd 1 + color_face rd 1 + color_select rd 1 +align 16 + rb 4096 +stacktop: + sys_path rb 2048 + file_name rb 4096 + plugin_path rb 4096 + openfile_path rb 4096 + filename_area rb 256 +mem: diff --git a/programs/develop/info3ds/info_menu.inc b/programs/develop/info3ds/info_menu.inc index 64e76e3023..e9dbbea957 100644 --- a/programs/develop/info3ds/info_menu.inc +++ b/programs/develop/info3ds/info_menu.inc @@ -1 +1,55 @@ - if lang eq ru_RU sz_main_menu_View db '', 0 sz_main_menu_Veiw_Vertexes db '設 .', 0 sz_main_menu_Veiw_Faces db 'ઠ ࠭ .', 0 sz_main_menu_Veiw_Faces_Fill db ' ࠭ .', 0 sz_main_menu_Veiw_Light db ' ./몫.', 0 sz_main_menu_Veiw_Smooth db ' ./몫.', 0 sz_main_menu_Veiw_Reset db ' ஥', 0 if version_edit eq 0 sz_main_menu_Veiw_Faces_Mat db '梥 ࠭ .', 0 else sz_main_menu_Vertexes db '設', 0 sz_main_menu_Vertexes_Select db '뤥 設', 0 sz_main_menu_Vertexes_Deselect db '⬥ 뤥', 0 sz_main_menu_Average_x db '। x',0 sz_main_menu_Average_y db '। y',0 sz_main_menu_Average_z db '। z',0 end if else sz_main_menu_View db 'View', 0 sz_main_menu_Veiw_Vertexes db 'Vertexes on', 0 sz_main_menu_Veiw_Faces db 'Edges on', 0 sz_main_menu_Veiw_Faces_Fill db 'Faces on', 0 sz_main_menu_Veiw_Light db 'Light on/off', 0 sz_main_menu_Veiw_Smooth db 'Smooth on/off', 0 sz_main_menu_Veiw_Reset db 'Reset settings', 0 if version_edit eq 0 sz_main_menu_Veiw_Faces_Mat db 'Diferent color faces on', 0 else sz_main_menu_Vertexes db 'Vertexes', 0 sz_main_menu_Vertexes_Select db 'Select vertex', 0 sz_main_menu_Vertexes_Deselect db 'Deselect all', 0 sz_main_menu_Average_x db 'Average x',0 sz_main_menu_Average_y db 'Average y',0 sz_main_menu_Average_z db 'Average z',0 end if end if main_menu dd 0 main_menu_file dd 0 main_menu_view dd 0 main_menu_vertexes dd 0 KMENUITEM_NORMAL equ 0 KMENUITEM_SUBMENU equ 1 KMENUITEM_SEPARATOR equ 2 + +; Language support for locales: ru_RU (CP866), en_US. + +if lang eq ru_RU + +sz_main_menu_View db '', 0 +sz_main_menu_Veiw_Vertexes db '設 .', 0 +sz_main_menu_Veiw_Faces db 'ઠ ࠭ .', 0 +sz_main_menu_Veiw_Faces_Fill db ' ࠭ .', 0 +sz_main_menu_Veiw_Light db ' ./몫.', 0 +sz_main_menu_Veiw_Smooth db ' ./몫.', 0 +sz_main_menu_Veiw_Reset db ' ஥', 0 + +if version_edit eq 0 +sz_main_menu_Veiw_Faces_Mat db '梥 ࠭ .', 0 +else +sz_main_menu_Vertexes db '設', 0 +sz_main_menu_Vertexes_Select db '뤥 設', 0 +sz_main_menu_Vertexes_Deselect db '⬥ 뤥', 0 +sz_main_menu_Average_x db '। x',0 +sz_main_menu_Average_y db '। y',0 +sz_main_menu_Average_z db '। z',0 +end if + +else ; Default to en_US + +sz_main_menu_View db 'View', 0 +sz_main_menu_Veiw_Vertexes db 'Vertexes on', 0 +sz_main_menu_Veiw_Faces db 'Edges on', 0 +sz_main_menu_Veiw_Faces_Fill db 'Faces on', 0 +sz_main_menu_Veiw_Light db 'Light on/off', 0 +sz_main_menu_Veiw_Smooth db 'Smooth on/off', 0 +sz_main_menu_Veiw_Reset db 'Reset settings', 0 + +if version_edit eq 0 +sz_main_menu_Veiw_Faces_Mat db 'Diferent color faces on', 0 +else +sz_main_menu_Vertexes db 'Vertexes', 0 +sz_main_menu_Vertexes_Select db 'Select vertex', 0 +sz_main_menu_Vertexes_Deselect db 'Deselect all', 0 +sz_main_menu_Average_x db 'Average x',0 +sz_main_menu_Average_y db 'Average y',0 +sz_main_menu_Average_z db 'Average z',0 +end if + +end if + +main_menu dd 0 +main_menu_file dd 0 +main_menu_view dd 0 +main_menu_vertexes dd 0 + +KMENUITEM_NORMAL equ 0 +KMENUITEM_SUBMENU equ 1 +KMENUITEM_SEPARATOR equ 2 diff --git a/programs/develop/info3ds/info_wnd_coords.inc b/programs/develop/info3ds/info_wnd_coords.inc index 1aec2c894e..b4af7c8507 100644 --- a/programs/develop/info3ds/info_wnd_coords.inc +++ b/programs/develop/info3ds/info_wnd_coords.inc @@ -1,827 +1,827 @@ -; -; ⮬ 䠩 ᮡ࠭ 㭪樨 㦭 ᮧ -; ࠡ न⠬ 設 -; - -prop_wnd_width equ 340 ;ਭ ᢮⢠ ꥪ -prop_wnd_height equ 460 ; ᢮⢠ ꥪ -3d_wnd_l equ 5 ; tinygl ᫥ -3d_wnd_t equ 23 ; tinygl ᢥ -3d_wnd_w equ 320 -3d_wnd_h equ 240 -SIZE_ONE_FLOAT equ 14 -MAX_OBJECT_SIZE equ (4+SIZE_ONE_FLOAT*3+1) - -prop_wnd_run db 0 ;६ ᫥ ⥬ - ᪠ 1- ᢮⢠ ६ - -txt_q db '?',0 -txt_space: - db SIZE_ONE_FLOAT dup(' ') -.end: - db 0 - -obj_point: ;塞 ꥪ - dd 0 ;㪠⥫ -.text: - rb MAX_OBJECT_SIZE - -if lang eq ru_RU -txt_select_vert: db '࠭: ' -else -txt_select_vert: db 'Select: ' -end if -.count: -dq 0,0 - -; () 뢠 㭪樥 but_wnd_coords -align 4 -prop_start: -pushad - mcall SF_SET_EVENTS_MASK,0x27 ;᪠ ᮡ⨩ - inc byte[prop_wnd_run] - mov dword[w_scr_t3.type],1 - mov edi,o3d - stdcall obj_clear_param, edi - call mnu_reset_settings - - stdcall [tl_node_get_data],tree1 - xor edx,edx - mov dword[capt_p],txt_q - cmp eax,0 - je .no_points - mov ebx,[eax] ;砥 祭 ᤢ ࠭ - add ebx,[open_file_data] - - cmp word[ebx],CHUNK_OBJBLOCK - jne .end_oblo - mov dword[capt_p],txt_4000 - stdcall obj_init,edi - jmp .no_points - .end_oblo: - cmp word[ebx],CHUNK_TRIMESH - jne .end_trim - mov dword[capt_p],txt_4100 - stdcall obj_init,edi - jmp .no_points - .end_trim: - cmp word[ebx],CHUNK_VERTLIST - jne .end_vlist - mov dword[capt_p],txt_4110 - stdcall obj_init,edi - jmp .no_points - .end_vlist: - cmp word[ebx],CHUNK_TRACKPIVOT - jne @f - inc edx - add ebx,6 - mov dword[capt_p],txt_b013 - jmp .set_points - @@: - cmp word[ebx],0xb014 - jne @f - mov edx,2 - add ebx,6 - mov dword[capt_p],txt_b014 - ;jmp .set_points - @@: - .set_points: - mov [edi+obj_3d.poi_data],ebx - mov [edi+obj_3d.poi_count],edx - .no_points: - - ;ன ᯨ᪠ ꥪ⮢ - mov ebx,[edi+obj_3d.poi_data] - mov dword[tree3.info_max_count],2 - mov edx,[edi+obj_3d.poi_count] - add dword[tree3.info_max_count],edx ;⠢ ᫮ 㧫, ࠢ 祪 (+2 砫 ᯨ᪠) - stdcall dword[tl_data_init], tree3 - mov eax,dword[icon_tl_sys] - mov dword[tree3.data_img_sys],eax - mov eax,dword[icon_toolbar] - mov dword[tree3.data_img],eax - - cmp edx,0 - je .no_object - mov word[NumberSymbolsAD],5 - finit - mov dword[w_scr_t3.redraw],0 - .new_point: - mov dword[obj_point],ebx - mov dword[obj_point.text],0 - cld - mov ecx,3 - @@: - fld dword[ebx] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - add ebx,4 - stdcall str_len, Data_String - mov esi,txt_space - add esi,eax - cmp esi,txt_space.end - jl .normal_size - mov esi,txt_space.end-1 ; 1 ஡ 㦭 , - ᫨ - .normal_size: - stdcall str_cat, obj_point.text,esi - stdcall str_cat, obj_point.text,Data_String - loop @b - stdcall dword[tl_node_add], tree3,(ID_ICON_POINT shl 16),obj_point - stdcall dword[tl_cur_next], tree3 - dec edx - cmp edx,0 - jg .new_point - mov dword[w_scr_t3.redraw],1 - stdcall dword[tl_cur_beg], tree3 - .no_object: - stdcall obj_set_sizes, o3d - stdcall obj_set_normals, o3d - edit_boxes_set_sys_color edit1,editboxes_end,sc ;⠭ ⥬ 梥⮢ - stdcall [edit_box_set_text], edit1, txt_q - stdcall [edit_box_set_text], edit2, txt_q - stdcall [edit_box_set_text], edit3, txt_q - mov eax,0xc0c0c0 - mov ebx,[color_ox] - shr ebx,2 - and ebx,0x3f3f3f - add eax,ebx - mov [edit1.color],eax - mov eax,0xc0c0c0 - mov ebx,[color_oy] - shr ebx,2 - and ebx,0x3f3f3f - add eax,ebx - mov [edit2.color],eax - mov eax,0xc0c0c0 - mov ebx,[color_oz] - shr ebx,2 - and ebx,0x3f3f3f - add eax,ebx - mov [edit3.color],eax -popad - call prop_red_win - -; 뢠 㭪 ।饩 -align 4 -prop_still: - pushad - - mcall SF_WAIT_EVENT_TIMEOUT,10 - or eax,eax - jnz @f - call prop_timer_funct - jmp .end - @@: - - cmp al,1 ;. - jne @f - call prop_red_win - jmp .end - @@: - cmp al,2 - jne @f - call prop_key - jmp .end - @@: - cmp al,3 - jz prop_button - cmp al,6 - jne @f - call prop_mouse - @@: -.end: - popad - jmp prop_still - -align 4 -prop_red_win: -pushad - mcall SF_REDRAW,SSF_BEGIN_DRAW - - xor eax,eax - mov edi,dword[capt_p] ;children window caption - mov bx,word[procinfo.box.left] - add bx,word[buf_0.l] - add bx,5 ;ਭ ࠬ - shl ebx,16 - mov bx,prop_wnd_width - mov cx,word[procinfo.box.top] - add cx,word[buf_0.t] - shl ecx,16 - mov cx,prop_wnd_height - mov edx,[sc.work] - or edx,0x33000000 - int 0x40 - - mov esi,[sc.work_button] - mcall SF_DEFINE_BUTTON, (5 shl 16)+20, (266 shl 16)+20, 0x40000003 - mcall , (30 shl 16)+20, (266 shl 16)+20, 0x40000004 - - mov ebx,[image_data_toolbar] - add ebx,3*IMAGE_TOOLBAR_ICON_SIZE - mcall SF_PUT_IMAGE, , (21 shl 16)+21, (5 shl 16)+266 ;load - - sub ebx,IMAGE_TOOLBAR_ICON_SIZE - mov edx,(30 shl 16)+266 ;save - int 0x40 - - mov dword[w_scr_t3.all_redraw],1 - stdcall [scrollbar_ver_draw],dword w_scr_t3 - stdcall [tl_draw], tree3 - stdcall [edit_box_draw], edit1 - stdcall [edit_box_draw], edit2 - stdcall [edit_box_draw], edit3 - - stdcall [kmainmenu_draw], [main_menu] - stdcall draw_3d, o3d - mcall SF_REDRAW,SSF_END_DRAW -popad - ret - -align 4 -proc prop_key uses eax ebx - mcall SF_GET_KEY - - test word [edit1.flags],10b ;ed_focus - je @f - stdcall [edit_box_key], edit1 - jmp .end - @@: - test word [edit2.flags],10b - je @f - stdcall [edit_box_key], edit2 - jmp .end - @@: - test word [edit3.flags],10b - je @f - stdcall [edit_box_key], edit3 - jmp .end - @@: - cmp dword[el_focus], tree3 - jne @f - stdcall [tl_key], tree3 - jmp .end - @@: - - cmp ah,178 ;Up - jne @f - fld dword[angle_x] - fadd dword[delt_size] - fstp dword[angle_x] - stdcall draw_3d, o3d - jmp .end - @@: - cmp ah,177 ;Down - jne @f - fld dword[angle_x] - fsub dword[delt_size] - fstp dword[angle_x] - stdcall draw_3d, o3d - jmp .end - @@: - cmp ah,176 ;Left - jne @f - fld dword[angle_y] - fadd dword[delt_size] - fstp dword[angle_y] - stdcall draw_3d, o3d - jmp .end - @@: - cmp ah,179 ;Right - jne @f - fld dword[angle_y] - fsub dword[delt_size] - fstp dword[angle_y] - stdcall draw_3d, o3d - ;jmp .end - @@: - .end: - ret -endp - -align 4 -prop_mouse: - push eax ebx - 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 SF_MOUSE_GET,SSF_WINDOW_POSITION ;get mouse coords - mov ebx,eax - shr ebx,16 ;mouse.x - cmp ebx,3d_wnd_l - jg @f - mov ebx,3d_wnd_l - @@: - sub ebx,3d_wnd_l - cmp ebx,3d_wnd_w - jle @f - mov ebx,3d_wnd_w - @@: - and eax,0xffff ;mouse.y - cmp eax,3d_wnd_t - jg @f - mov eax,3d_wnd_t - @@: - sub eax,3d_wnd_t - cmp eax,3d_wnd_h - jle @f - mov eax,3d_wnd_h - @@: - finit - fild dword[mouse_y] - mov [mouse_y],eax - fisub dword[mouse_y] - fdiv dword[angle_dxm] ;᫨ y ( ) x - fadd dword[angle_x] - fstp dword[angle_x] - - fild dword[mouse_x] - mov [mouse_x],ebx - fisub dword[mouse_x] - fdiv dword[angle_dym] ;᫨ x ( ) y - fadd dword[angle_y] - fstp dword[angle_y] - - stdcall draw_3d, o3d - jmp .end_d - .end_m: - bt eax,16 - jnc @f - ;mouse l. but. up - mov dword[mouse_drag],0 - jmp .end_d - @@: - bt eax,8 - jnc .end_d - ;mouse l. but. press - mcall SF_MOUSE_GET,SSF_WINDOW_POSITION ;get mouse coords - mov ebx,eax - shr ebx,16 ;mouse.x - cmp ebx,3d_wnd_l - jl .end_d - sub ebx,3d_wnd_l - cmp ebx,3d_wnd_w - jg .end_d - and eax,0xffff ;mouse.y - cmp eax,3d_wnd_t - jl .end_d - sub eax,3d_wnd_t - cmp eax,3d_wnd_h - jg .end_d - mov dword[mouse_drag],1 - mov dword[mouse_x],ebx - mov dword[mouse_y],eax - .end_d: - - stdcall [kmainmenu_dispatch_cursorevent], [main_menu] - stdcall [tl_mouse], tree3 - stdcall [edit_box_mouse], edit1 - stdcall [edit_box_mouse], edit2 - stdcall [edit_box_mouse], edit3 - pop ebx eax - ret - -align 4 -prop_button: - mcall SF_GET_BUTTON - - cmp ah,3 - jne @f - call get_point_coords - stdcall draw_3d, o3d - jmp prop_still.end - @@: - cmp ah,4 - jne @f - push eax ebx ecx edi esi - stdcall [tl_node_get_data],tree3 - cmp eax,0 - je .no_select_1 - mov ebx,[eax] - finit - - mov esi,string1 - mov edi,Data_String - cld - mov ecx,8 - rep movsd - call String_to_DoubleFloat - fld qword[Data_Double] ;뢠 double - fstp dword[ebx] ;࠭塞 float - - mov esi,string2 - mov edi,Data_String - cld - mov ecx,8 - rep movsd - call String_to_DoubleFloat - fld qword[Data_Double] ;뢠 double - fstp dword[ebx+4] ;࠭塞 float - - mov esi,string3 - mov edi,Data_String - cld - mov ecx,8 - rep movsd - call String_to_DoubleFloat - fld qword[Data_Double] ;뢠 double - fstp dword[ebx+8] ;࠭塞 float - - ; 㧫 ᯨ᪥ tree3 ( ⠩) - mov word[NumberSymbolsAD],5 - mov dword[obj_point],ebx - mov dword[obj_point.text],0 - cld - mov ecx,3 - .coord: - fld dword[ebx] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - add ebx,4 - stdcall str_len, Data_String - mov esi,txt_space - add esi,eax - cmp esi,txt_space.end - jl .normal_size - mov esi,txt_space.end-1 ; 1 ஡ 㦭 , - ᫨ - .normal_size: - stdcall str_cat, obj_point.text,esi - stdcall str_cat, obj_point.text,Data_String - loop .coord - mov byte[obj_point.text],'*' ;⬥砥 設 﫠 - stdcall dword[tl_node_set_data], tree3,obj_point - stdcall dword[tl_draw], tree3 - mov byte[can_save],1 ; '࠭' - mov dword[offs_last_timer],0 ; ⠩ - stdcall draw_3d, o3d - .no_select_1: - pop esi edi ecx ebx eax - jmp prop_still.end - @@: - cmp ah,5 - jne @f - call mnu_vertexes_on - jmp prop_still.end - @@: - cmp ah,6 - jne @f - call mnu_edges_on - jmp prop_still.end - @@: - cmp ah,7 - jne @f - call mnu_faces_on - jmp prop_still.end - @@: - cmp ah,8 - jne @f - call mnu_light_on_off - jmp prop_still.end - @@: - cmp ah,9 - jne @f - call mnu_smooth_on_off - jmp prop_still.end - @@: - cmp ah,10 - jne @f - call mnu_reset_settings - jmp prop_still.end - @@: - cmp ah,11 - jne @f - call mnu_vertexes_select - jmp prop_still.end - @@: - cmp ah,12 - jne @f - call mnu_vertexes_deselect - jmp prop_still.end - @@: - cmp ah,13 - jne @f - call mnu_reset_average_x - jmp prop_still.end - @@: - cmp ah,14 - jne @f - call mnu_reset_average_y - jmp prop_still.end - @@: - cmp ah,15 - jne @f - call mnu_reset_average_z - jmp prop_still.end - @@: - - cmp ah,1 - jne prop_still.end -.exit: - mov dword[tree3.data_img],0 ;⨬ 㪠⥫ - 㤠 - mov dword[tree3.data_img_sys],0 ;. . ᯮ 㣨 - stdcall dword[tl_data_clear], tree3 - mov edi,o3d - stdcall mem.Free,[edi+obj_3d.normals_tri_data] - stdcall mem.Free,[edi+obj_3d.normals_poi_data] - mov dword[edi+obj_3d.normals_tri_data],0 - mov dword[edi+obj_3d.normals_poi_data],0 - mov byte[prop_wnd_run],0 ;塞 稪 - mcall SF_TERMINATE_PROCESS ;室 ணࠬ - -align 4 -get_point_coords: - ;㧪 न editbox- - push eax ebx - stdcall [tl_node_get_data],tree3 - cmp eax,0 - je @f - mov ebx,[eax] - mov word[NumberSymbolsAD],8 - finit - fld dword[ebx] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - stdcall [edit_box_set_text], edit1, Data_String - fld dword[ebx+4] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - stdcall [edit_box_set_text], edit2, Data_String - fld dword[ebx+8] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - stdcall [edit_box_set_text], edit3, Data_String - stdcall [edit_box_draw], edit1 - stdcall [edit_box_draw], edit2 - stdcall [edit_box_draw], edit3 - @@: - pop ebx eax - ret - -align 4 -proc prop_timer_funct uses eax - ;ᬠਢ 뤥 न - stdcall [tl_node_get_data],tree3 - cmp [cursor_last_draw],eax - je @f - mov [cursor_last_draw],eax - stdcall draw_3d, o3d - @@: - ret -endp - -align 4 -proc mnu_vertexes_select uses eax ebx - stdcall [tl_node_get_data],tree3 - cmp eax,0 - je .no_points - stdcall found_block_data,tree3 - cmp eax,0 - je .no_points - mov bx,word[eax] - cmp bx,ID_ICON_POINT_SEL - je @f - mov word[eax],ID_ICON_POINT_SEL - inc dword[obj_poi_sel_c] - jmp .change - @@: - mov word[eax],ID_ICON_POINT - dec dword[obj_poi_sel_c] - .change: - mov eax,[obj_poi_sel_c] - stdcall convert_int_to_str, txt_select_vert.count,16 - .no_points: - ret -endp - -align 4 -proc mnu_vertexes_deselect uses eax - cmp dword[obj_poi_sel_c],0 - je .no_points - mov dword[obj_poi_sel_c],0 - stdcall [tl_node_poi_get_info], tree3,0 - cmp eax,0 - je .no_points - @@: - mov word[eax],ID_ICON_POINT - stdcall [tl_node_poi_get_next_info], tree3,eax - cmp eax,0 - jne @b - .no_points: - ret -endp - -align 4 -proc mnu_reset_average_x uses eax ebx ecx edx edi - cmp dword[obj_poi_sel_c],2 - jl .end_select - finit - fldz - mov ecx,dword[obj_poi_sel_c] - stdcall dword[tl_node_poi_get_info], tree3,0 - @@: - cmp eax,0 - je .end_select - mov ebx,eax - cmp word[ebx],ID_ICON_POINT_SEL - jne .next_sel0 - stdcall [tl_node_poi_get_data], tree3,ebx - mov eax,[eax] - fadd dword[eax] - dec ecx - jz @f - .next_sel0: - stdcall dword[tl_node_poi_get_next_info], tree3,ebx - jmp @b - @@: - fidiv dword[obj_poi_sel_c] - fstp dword[eax] - mov edx,[eax] - mov ecx,dword[obj_poi_sel_c] - stdcall dword[tl_node_poi_get_info], tree3,0 - @@: - cmp eax,0 - je .end_select - mov ebx,eax - cmp word[ebx],ID_ICON_POINT_SEL - jne .next_sel1 - stdcall [tl_node_poi_get_data], tree3,ebx - mov edi,eax - mov eax,[eax] - mov [eax],edx - stdcall update_tree, edi - dec ecx - jz @f - .next_sel1: - stdcall dword[tl_node_poi_get_next_info], tree3,ebx - jmp @b - @@: - .end_select: - ret -endp - -align 4 -proc mnu_reset_average_y uses eax ebx ecx edx edi - cmp dword[obj_poi_sel_c],2 - jl .end_select - finit - fldz - mov ecx,dword[obj_poi_sel_c] - stdcall dword[tl_node_poi_get_info], tree3,0 - @@: - cmp eax,0 - je .end_select - mov ebx,eax - cmp word[ebx],ID_ICON_POINT_SEL - jne .next_sel0 - stdcall [tl_node_poi_get_data], tree3,ebx - mov eax,[eax] - fadd dword[eax+4] - dec ecx - jz @f - .next_sel0: - stdcall dword[tl_node_poi_get_next_info], tree3,ebx - jmp @b - @@: - fidiv dword[obj_poi_sel_c] - fstp dword[eax+4] - mov edx,[eax+4] - mov ecx,dword[obj_poi_sel_c] - stdcall dword[tl_node_poi_get_info], tree3,0 - @@: - cmp eax,0 - je .end_select - mov ebx,eax - cmp word[ebx],ID_ICON_POINT_SEL - jne .next_sel1 - stdcall [tl_node_poi_get_data], tree3,ebx - mov edi,eax - mov eax,[eax] - mov [eax+4],edx - stdcall update_tree, edi - dec ecx - jz @f - .next_sel1: - stdcall dword[tl_node_poi_get_next_info], tree3,ebx - jmp @b - @@: - .end_select: - ret -endp - -align 4 -proc mnu_reset_average_z uses eax ebx ecx edx edi - cmp dword[obj_poi_sel_c],2 - jl .end_select - finit - fldz - mov ecx,dword[obj_poi_sel_c] - stdcall dword[tl_node_poi_get_info], tree3,0 - @@: - cmp eax,0 - je .end_select - mov ebx,eax - cmp word[ebx],ID_ICON_POINT_SEL - jne .next_sel0 - stdcall [tl_node_poi_get_data], tree3,ebx - mov eax,[eax] - fadd dword[eax+8] - dec ecx - jz @f - .next_sel0: - stdcall dword[tl_node_poi_get_next_info], tree3,ebx - jmp @b - @@: - fidiv dword[obj_poi_sel_c] - fstp dword[eax+8] - mov edx,[eax+8] - mov ecx,dword[obj_poi_sel_c] - stdcall dword[tl_node_poi_get_info], tree3,0 - @@: - cmp eax,0 - je .end_select - mov ebx,eax - cmp word[ebx],ID_ICON_POINT_SEL - jne .next_sel1 - stdcall [tl_node_poi_get_data], tree3,ebx - mov edi,eax - mov eax,[eax] - mov [eax+8],edx - stdcall update_tree, edi - dec ecx - jz @f - .next_sel1: - stdcall dword[tl_node_poi_get_next_info], tree3,ebx - jmp @b - @@: - .end_select: - ret -endp - -align 4 -proc update_tree h_mem:dword -pushad - mov edi,[h_mem] - mov ebx,[edi] - finit - - ; 㧫 ᯨ᪥ tree3 ( ⠩) - mov word[NumberSymbolsAD],5 - mov dword[obj_point.text],0 - cld - mov ecx,3 - .coord: - fld dword[ebx] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - add ebx,4 - stdcall str_len, Data_String - mov esi,txt_space - add esi,eax - cmp esi,txt_space.end - jl .normal_size - mov esi,txt_space.end-1 ; 1 ஡ 㦭 , - ᫨ - .normal_size: - stdcall str_cat, obj_point.text,esi - stdcall str_cat, obj_point.text,Data_String - loop .coord - mov esi,obj_point.text - mov byte[esi],'*' ;⬥砥 設 﫠 - mov byte[can_save],1 ; '࠭' - add edi,4 - mov ecx,MAX_OBJECT_SIZE-4 - rep movsb -popad - ret -endp - -align 4 -angle_dxm dd 1.7775 ;~ 3d_wnd_w/180 - ਡ 㣫 業 饭 襩 -angle_dym dd 1.3335 ;~ 3d_wnd_h/180 -ratio dd 1.3333 ;~ 3d_wnd_w/3d_wnd_h -cursor_last_draw dd 0 ; ᫥ ᮢ 3d -capt_p dd 0 - -;ॢ ꥪ⠬ 짮⥫᪮ 䠩 -tree3 tree_list MAX_OBJECT_SIZE,3, tl_key_no_edit+tl_list_box_mode,\ - 16,16, 0xffffff,0xb0d0ff,0x400040, 5,290,303,140, 16, 4,0, el_focus,\ - w_scr_t3,get_point_coords - -edit1 edit_box 80, 76, 269, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 32, string1, mouse_dd, 0 -edit2 edit_box 80, 160, 269, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 32, string2, mouse_dd, 0 -edit3 edit_box 80, 244, 269, 0xd0ffd0, 0xff, 0x80ff, 0, 0x8000, 32, string3, mouse_dd, 0 -editboxes_end: - -string1 rb 34 -string2 rb 34 -string3 rb 34 - -align 4 -w_scr_t3 scrollbar 16, 0,0,0, 15, 100,0,0, 0,0,0, 1 +; +; ⮬ 䠩 ᮡ࠭ 㭪樨 㦭 ᮧ +; ࠡ न⠬ 設 +; + +prop_wnd_width equ 340 ;ਭ ᢮⢠ ꥪ +prop_wnd_height equ 460 ; ᢮⢠ ꥪ +3d_wnd_l equ 5 ; tinygl ᫥ +3d_wnd_t equ 23 ; tinygl ᢥ +3d_wnd_w equ 320 +3d_wnd_h equ 240 +SIZE_ONE_FLOAT equ 14 +MAX_OBJECT_SIZE equ (4+SIZE_ONE_FLOAT*3+1) + +prop_wnd_run db 0 ;६ ᫥ ⥬ - ᪠ 1- ᢮⢠ ६ + +txt_q db '?',0 +txt_space: + db SIZE_ONE_FLOAT dup(' ') +.end: + db 0 + +obj_point: ;塞 ꥪ + dd 0 ;㪠⥫ +.text: + rb MAX_OBJECT_SIZE + +if lang eq ru_RU +txt_select_vert: db '࠭: ' +else ; Default to en_US +txt_select_vert: db 'Select: ' +end if +.count: +dq 0,0 + +; () 뢠 㭪樥 but_wnd_coords +align 4 +prop_start: +pushad + mcall SF_SET_EVENTS_MASK,0x27 ;᪠ ᮡ⨩ + inc byte[prop_wnd_run] + mov dword[w_scr_t3.type],1 + mov edi,o3d + stdcall obj_clear_param, edi + call mnu_reset_settings + + stdcall [tl_node_get_data],tree1 + xor edx,edx + mov dword[capt_p],txt_q + cmp eax,0 + je .no_points + mov ebx,[eax] ;砥 祭 ᤢ ࠭ + add ebx,[open_file_data] + + cmp word[ebx],CHUNK_OBJBLOCK + jne .end_oblo + mov dword[capt_p],txt_4000 + stdcall obj_init,edi + jmp .no_points + .end_oblo: + cmp word[ebx],CHUNK_TRIMESH + jne .end_trim + mov dword[capt_p],txt_4100 + stdcall obj_init,edi + jmp .no_points + .end_trim: + cmp word[ebx],CHUNK_VERTLIST + jne .end_vlist + mov dword[capt_p],txt_4110 + stdcall obj_init,edi + jmp .no_points + .end_vlist: + cmp word[ebx],CHUNK_TRACKPIVOT + jne @f + inc edx + add ebx,6 + mov dword[capt_p],txt_b013 + jmp .set_points + @@: + cmp word[ebx],0xb014 + jne @f + mov edx,2 + add ebx,6 + mov dword[capt_p],txt_b014 + ;jmp .set_points + @@: + .set_points: + mov [edi+obj_3d.poi_data],ebx + mov [edi+obj_3d.poi_count],edx + .no_points: + + ;ன ᯨ᪠ ꥪ⮢ + mov ebx,[edi+obj_3d.poi_data] + mov dword[tree3.info_max_count],2 + mov edx,[edi+obj_3d.poi_count] + add dword[tree3.info_max_count],edx ;⠢ ᫮ 㧫, ࠢ 祪 (+2 砫 ᯨ᪠) + stdcall dword[tl_data_init], tree3 + mov eax,dword[icon_tl_sys] + mov dword[tree3.data_img_sys],eax + mov eax,dword[icon_toolbar] + mov dword[tree3.data_img],eax + + cmp edx,0 + je .no_object + mov word[NumberSymbolsAD],5 + finit + mov dword[w_scr_t3.redraw],0 + .new_point: + mov dword[obj_point],ebx + mov dword[obj_point.text],0 + cld + mov ecx,3 + @@: + fld dword[ebx] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + add ebx,4 + stdcall str_len, Data_String + mov esi,txt_space + add esi,eax + cmp esi,txt_space.end + jl .normal_size + mov esi,txt_space.end-1 ; 1 ஡ 㦭 , - ᫨ + .normal_size: + stdcall str_cat, obj_point.text,esi + stdcall str_cat, obj_point.text,Data_String + loop @b + stdcall dword[tl_node_add], tree3,(ID_ICON_POINT shl 16),obj_point + stdcall dword[tl_cur_next], tree3 + dec edx + cmp edx,0 + jg .new_point + mov dword[w_scr_t3.redraw],1 + stdcall dword[tl_cur_beg], tree3 + .no_object: + stdcall obj_set_sizes, o3d + stdcall obj_set_normals, o3d + edit_boxes_set_sys_color edit1,editboxes_end,sc ;⠭ ⥬ 梥⮢ + stdcall [edit_box_set_text], edit1, txt_q + stdcall [edit_box_set_text], edit2, txt_q + stdcall [edit_box_set_text], edit3, txt_q + mov eax,0xc0c0c0 + mov ebx,[color_ox] + shr ebx,2 + and ebx,0x3f3f3f + add eax,ebx + mov [edit1.color],eax + mov eax,0xc0c0c0 + mov ebx,[color_oy] + shr ebx,2 + and ebx,0x3f3f3f + add eax,ebx + mov [edit2.color],eax + mov eax,0xc0c0c0 + mov ebx,[color_oz] + shr ebx,2 + and ebx,0x3f3f3f + add eax,ebx + mov [edit3.color],eax +popad + call prop_red_win + +; 뢠 㭪 ।饩 +align 4 +prop_still: + pushad + + mcall SF_WAIT_EVENT_TIMEOUT,10 + or eax,eax + jnz @f + call prop_timer_funct + jmp .end + @@: + + cmp al,1 ;. + jne @f + call prop_red_win + jmp .end + @@: + cmp al,2 + jne @f + call prop_key + jmp .end + @@: + cmp al,3 + jz prop_button + cmp al,6 + jne @f + call prop_mouse + @@: +.end: + popad + jmp prop_still + +align 4 +prop_red_win: +pushad + mcall SF_REDRAW,SSF_BEGIN_DRAW + + xor eax,eax + mov edi,dword[capt_p] ;children window caption + mov bx,word[procinfo.box.left] + add bx,word[buf_0.l] + add bx,5 ;ਭ ࠬ + shl ebx,16 + mov bx,prop_wnd_width + mov cx,word[procinfo.box.top] + add cx,word[buf_0.t] + shl ecx,16 + mov cx,prop_wnd_height + mov edx,[sc.work] + or edx,0x33000000 + int 0x40 + + mov esi,[sc.work_button] + mcall SF_DEFINE_BUTTON, (5 shl 16)+20, (266 shl 16)+20, 0x40000003 + mcall , (30 shl 16)+20, (266 shl 16)+20, 0x40000004 + + mov ebx,[image_data_toolbar] + add ebx,3*IMAGE_TOOLBAR_ICON_SIZE + mcall SF_PUT_IMAGE, , (21 shl 16)+21, (5 shl 16)+266 ;load + + sub ebx,IMAGE_TOOLBAR_ICON_SIZE + mov edx,(30 shl 16)+266 ;save + int 0x40 + + mov dword[w_scr_t3.all_redraw],1 + stdcall [scrollbar_ver_draw],dword w_scr_t3 + stdcall [tl_draw], tree3 + stdcall [edit_box_draw], edit1 + stdcall [edit_box_draw], edit2 + stdcall [edit_box_draw], edit3 + + stdcall [kmainmenu_draw], [main_menu] + stdcall draw_3d, o3d + mcall SF_REDRAW,SSF_END_DRAW +popad + ret + +align 4 +proc prop_key uses eax ebx + mcall SF_GET_KEY + + test word [edit1.flags],10b ;ed_focus + je @f + stdcall [edit_box_key], edit1 + jmp .end + @@: + test word [edit2.flags],10b + je @f + stdcall [edit_box_key], edit2 + jmp .end + @@: + test word [edit3.flags],10b + je @f + stdcall [edit_box_key], edit3 + jmp .end + @@: + cmp dword[el_focus], tree3 + jne @f + stdcall [tl_key], tree3 + jmp .end + @@: + + cmp ah,178 ;Up + jne @f + fld dword[angle_x] + fadd dword[delt_size] + fstp dword[angle_x] + stdcall draw_3d, o3d + jmp .end + @@: + cmp ah,177 ;Down + jne @f + fld dword[angle_x] + fsub dword[delt_size] + fstp dword[angle_x] + stdcall draw_3d, o3d + jmp .end + @@: + cmp ah,176 ;Left + jne @f + fld dword[angle_y] + fadd dword[delt_size] + fstp dword[angle_y] + stdcall draw_3d, o3d + jmp .end + @@: + cmp ah,179 ;Right + jne @f + fld dword[angle_y] + fsub dword[delt_size] + fstp dword[angle_y] + stdcall draw_3d, o3d + ;jmp .end + @@: + .end: + ret +endp + +align 4 +prop_mouse: + push eax ebx + 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 SF_MOUSE_GET,SSF_WINDOW_POSITION ;get mouse coords + mov ebx,eax + shr ebx,16 ;mouse.x + cmp ebx,3d_wnd_l + jg @f + mov ebx,3d_wnd_l + @@: + sub ebx,3d_wnd_l + cmp ebx,3d_wnd_w + jle @f + mov ebx,3d_wnd_w + @@: + and eax,0xffff ;mouse.y + cmp eax,3d_wnd_t + jg @f + mov eax,3d_wnd_t + @@: + sub eax,3d_wnd_t + cmp eax,3d_wnd_h + jle @f + mov eax,3d_wnd_h + @@: + finit + fild dword[mouse_y] + mov [mouse_y],eax + fisub dword[mouse_y] + fdiv dword[angle_dxm] ;᫨ y ( ) x + fadd dword[angle_x] + fstp dword[angle_x] + + fild dword[mouse_x] + mov [mouse_x],ebx + fisub dword[mouse_x] + fdiv dword[angle_dym] ;᫨ x ( ) y + fadd dword[angle_y] + fstp dword[angle_y] + + stdcall draw_3d, o3d + jmp .end_d + .end_m: + bt eax,16 + jnc @f + ;mouse l. but. up + mov dword[mouse_drag],0 + jmp .end_d + @@: + bt eax,8 + jnc .end_d + ;mouse l. but. press + mcall SF_MOUSE_GET,SSF_WINDOW_POSITION ;get mouse coords + mov ebx,eax + shr ebx,16 ;mouse.x + cmp ebx,3d_wnd_l + jl .end_d + sub ebx,3d_wnd_l + cmp ebx,3d_wnd_w + jg .end_d + and eax,0xffff ;mouse.y + cmp eax,3d_wnd_t + jl .end_d + sub eax,3d_wnd_t + cmp eax,3d_wnd_h + jg .end_d + mov dword[mouse_drag],1 + mov dword[mouse_x],ebx + mov dword[mouse_y],eax + .end_d: + + stdcall [kmainmenu_dispatch_cursorevent], [main_menu] + stdcall [tl_mouse], tree3 + stdcall [edit_box_mouse], edit1 + stdcall [edit_box_mouse], edit2 + stdcall [edit_box_mouse], edit3 + pop ebx eax + ret + +align 4 +prop_button: + mcall SF_GET_BUTTON + + cmp ah,3 + jne @f + call get_point_coords + stdcall draw_3d, o3d + jmp prop_still.end + @@: + cmp ah,4 + jne @f + push eax ebx ecx edi esi + stdcall [tl_node_get_data],tree3 + cmp eax,0 + je .no_select_1 + mov ebx,[eax] + finit + + mov esi,string1 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] ;뢠 double + fstp dword[ebx] ;࠭塞 float + + mov esi,string2 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] ;뢠 double + fstp dword[ebx+4] ;࠭塞 float + + mov esi,string3 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] ;뢠 double + fstp dword[ebx+8] ;࠭塞 float + + ; 㧫 ᯨ᪥ tree3 ( ⠩) + mov word[NumberSymbolsAD],5 + mov dword[obj_point],ebx + mov dword[obj_point.text],0 + cld + mov ecx,3 + .coord: + fld dword[ebx] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + add ebx,4 + stdcall str_len, Data_String + mov esi,txt_space + add esi,eax + cmp esi,txt_space.end + jl .normal_size + mov esi,txt_space.end-1 ; 1 ஡ 㦭 , - ᫨ + .normal_size: + stdcall str_cat, obj_point.text,esi + stdcall str_cat, obj_point.text,Data_String + loop .coord + mov byte[obj_point.text],'*' ;⬥砥 設 﫠 + stdcall dword[tl_node_set_data], tree3,obj_point + stdcall dword[tl_draw], tree3 + mov byte[can_save],1 ; '࠭' + mov dword[offs_last_timer],0 ; ⠩ + stdcall draw_3d, o3d + .no_select_1: + pop esi edi ecx ebx eax + jmp prop_still.end + @@: + cmp ah,5 + jne @f + call mnu_vertexes_on + jmp prop_still.end + @@: + cmp ah,6 + jne @f + call mnu_edges_on + jmp prop_still.end + @@: + cmp ah,7 + jne @f + call mnu_faces_on + jmp prop_still.end + @@: + cmp ah,8 + jne @f + call mnu_light_on_off + jmp prop_still.end + @@: + cmp ah,9 + jne @f + call mnu_smooth_on_off + jmp prop_still.end + @@: + cmp ah,10 + jne @f + call mnu_reset_settings + jmp prop_still.end + @@: + cmp ah,11 + jne @f + call mnu_vertexes_select + jmp prop_still.end + @@: + cmp ah,12 + jne @f + call mnu_vertexes_deselect + jmp prop_still.end + @@: + cmp ah,13 + jne @f + call mnu_reset_average_x + jmp prop_still.end + @@: + cmp ah,14 + jne @f + call mnu_reset_average_y + jmp prop_still.end + @@: + cmp ah,15 + jne @f + call mnu_reset_average_z + jmp prop_still.end + @@: + + cmp ah,1 + jne prop_still.end +.exit: + mov dword[tree3.data_img],0 ;⨬ 㪠⥫ - 㤠 + mov dword[tree3.data_img_sys],0 ;. . ᯮ 㣨 + stdcall dword[tl_data_clear], tree3 + mov edi,o3d + stdcall mem.Free,[edi+obj_3d.normals_tri_data] + stdcall mem.Free,[edi+obj_3d.normals_poi_data] + mov dword[edi+obj_3d.normals_tri_data],0 + mov dword[edi+obj_3d.normals_poi_data],0 + mov byte[prop_wnd_run],0 ;塞 稪 + mcall SF_TERMINATE_PROCESS ;室 ணࠬ + +align 4 +get_point_coords: + ;㧪 न editbox- + push eax ebx + stdcall [tl_node_get_data],tree3 + cmp eax,0 + je @f + mov ebx,[eax] + mov word[NumberSymbolsAD],8 + finit + fld dword[ebx] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit1, Data_String + fld dword[ebx+4] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit2, Data_String + fld dword[ebx+8] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit3, Data_String + stdcall [edit_box_draw], edit1 + stdcall [edit_box_draw], edit2 + stdcall [edit_box_draw], edit3 + @@: + pop ebx eax + ret + +align 4 +proc prop_timer_funct uses eax + ;ᬠਢ 뤥 न + stdcall [tl_node_get_data],tree3 + cmp [cursor_last_draw],eax + je @f + mov [cursor_last_draw],eax + stdcall draw_3d, o3d + @@: + ret +endp + +align 4 +proc mnu_vertexes_select uses eax ebx + stdcall [tl_node_get_data],tree3 + cmp eax,0 + je .no_points + stdcall found_block_data,tree3 + cmp eax,0 + je .no_points + mov bx,word[eax] + cmp bx,ID_ICON_POINT_SEL + je @f + mov word[eax],ID_ICON_POINT_SEL + inc dword[obj_poi_sel_c] + jmp .change + @@: + mov word[eax],ID_ICON_POINT + dec dword[obj_poi_sel_c] + .change: + mov eax,[obj_poi_sel_c] + stdcall convert_int_to_str, txt_select_vert.count,16 + .no_points: + ret +endp + +align 4 +proc mnu_vertexes_deselect uses eax + cmp dword[obj_poi_sel_c],0 + je .no_points + mov dword[obj_poi_sel_c],0 + stdcall [tl_node_poi_get_info], tree3,0 + cmp eax,0 + je .no_points + @@: + mov word[eax],ID_ICON_POINT + stdcall [tl_node_poi_get_next_info], tree3,eax + cmp eax,0 + jne @b + .no_points: + ret +endp + +align 4 +proc mnu_reset_average_x uses eax ebx ecx edx edi + cmp dword[obj_poi_sel_c],2 + jl .end_select + finit + fldz + mov ecx,dword[obj_poi_sel_c] + stdcall dword[tl_node_poi_get_info], tree3,0 + @@: + cmp eax,0 + je .end_select + mov ebx,eax + cmp word[ebx],ID_ICON_POINT_SEL + jne .next_sel0 + stdcall [tl_node_poi_get_data], tree3,ebx + mov eax,[eax] + fadd dword[eax] + dec ecx + jz @f + .next_sel0: + stdcall dword[tl_node_poi_get_next_info], tree3,ebx + jmp @b + @@: + fidiv dword[obj_poi_sel_c] + fstp dword[eax] + mov edx,[eax] + mov ecx,dword[obj_poi_sel_c] + stdcall dword[tl_node_poi_get_info], tree3,0 + @@: + cmp eax,0 + je .end_select + mov ebx,eax + cmp word[ebx],ID_ICON_POINT_SEL + jne .next_sel1 + stdcall [tl_node_poi_get_data], tree3,ebx + mov edi,eax + mov eax,[eax] + mov [eax],edx + stdcall update_tree, edi + dec ecx + jz @f + .next_sel1: + stdcall dword[tl_node_poi_get_next_info], tree3,ebx + jmp @b + @@: + .end_select: + ret +endp + +align 4 +proc mnu_reset_average_y uses eax ebx ecx edx edi + cmp dword[obj_poi_sel_c],2 + jl .end_select + finit + fldz + mov ecx,dword[obj_poi_sel_c] + stdcall dword[tl_node_poi_get_info], tree3,0 + @@: + cmp eax,0 + je .end_select + mov ebx,eax + cmp word[ebx],ID_ICON_POINT_SEL + jne .next_sel0 + stdcall [tl_node_poi_get_data], tree3,ebx + mov eax,[eax] + fadd dword[eax+4] + dec ecx + jz @f + .next_sel0: + stdcall dword[tl_node_poi_get_next_info], tree3,ebx + jmp @b + @@: + fidiv dword[obj_poi_sel_c] + fstp dword[eax+4] + mov edx,[eax+4] + mov ecx,dword[obj_poi_sel_c] + stdcall dword[tl_node_poi_get_info], tree3,0 + @@: + cmp eax,0 + je .end_select + mov ebx,eax + cmp word[ebx],ID_ICON_POINT_SEL + jne .next_sel1 + stdcall [tl_node_poi_get_data], tree3,ebx + mov edi,eax + mov eax,[eax] + mov [eax+4],edx + stdcall update_tree, edi + dec ecx + jz @f + .next_sel1: + stdcall dword[tl_node_poi_get_next_info], tree3,ebx + jmp @b + @@: + .end_select: + ret +endp + +align 4 +proc mnu_reset_average_z uses eax ebx ecx edx edi + cmp dword[obj_poi_sel_c],2 + jl .end_select + finit + fldz + mov ecx,dword[obj_poi_sel_c] + stdcall dword[tl_node_poi_get_info], tree3,0 + @@: + cmp eax,0 + je .end_select + mov ebx,eax + cmp word[ebx],ID_ICON_POINT_SEL + jne .next_sel0 + stdcall [tl_node_poi_get_data], tree3,ebx + mov eax,[eax] + fadd dword[eax+8] + dec ecx + jz @f + .next_sel0: + stdcall dword[tl_node_poi_get_next_info], tree3,ebx + jmp @b + @@: + fidiv dword[obj_poi_sel_c] + fstp dword[eax+8] + mov edx,[eax+8] + mov ecx,dword[obj_poi_sel_c] + stdcall dword[tl_node_poi_get_info], tree3,0 + @@: + cmp eax,0 + je .end_select + mov ebx,eax + cmp word[ebx],ID_ICON_POINT_SEL + jne .next_sel1 + stdcall [tl_node_poi_get_data], tree3,ebx + mov edi,eax + mov eax,[eax] + mov [eax+8],edx + stdcall update_tree, edi + dec ecx + jz @f + .next_sel1: + stdcall dword[tl_node_poi_get_next_info], tree3,ebx + jmp @b + @@: + .end_select: + ret +endp + +align 4 +proc update_tree h_mem:dword +pushad + mov edi,[h_mem] + mov ebx,[edi] + finit + + ; 㧫 ᯨ᪥ tree3 ( ⠩) + mov word[NumberSymbolsAD],5 + mov dword[obj_point.text],0 + cld + mov ecx,3 + .coord: + fld dword[ebx] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + add ebx,4 + stdcall str_len, Data_String + mov esi,txt_space + add esi,eax + cmp esi,txt_space.end + jl .normal_size + mov esi,txt_space.end-1 ; 1 ஡ 㦭 , - ᫨ + .normal_size: + stdcall str_cat, obj_point.text,esi + stdcall str_cat, obj_point.text,Data_String + loop .coord + mov esi,obj_point.text + mov byte[esi],'*' ;⬥砥 設 﫠 + mov byte[can_save],1 ; '࠭' + add edi,4 + mov ecx,MAX_OBJECT_SIZE-4 + rep movsb +popad + ret +endp + +align 4 +angle_dxm dd 1.7775 ;~ 3d_wnd_w/180 - ਡ 㣫 業 饭 襩 +angle_dym dd 1.3335 ;~ 3d_wnd_h/180 +ratio dd 1.3333 ;~ 3d_wnd_w/3d_wnd_h +cursor_last_draw dd 0 ; ᫥ ᮢ 3d +capt_p dd 0 + +;ॢ ꥪ⠬ 짮⥫᪮ 䠩 +tree3 tree_list MAX_OBJECT_SIZE,3, tl_key_no_edit+tl_list_box_mode,\ + 16,16, 0xffffff,0xb0d0ff,0x400040, 5,290,303,140, 16, 4,0, el_focus,\ + w_scr_t3,get_point_coords + +edit1 edit_box 80, 76, 269, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 32, string1, mouse_dd, 0 +edit2 edit_box 80, 160, 269, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 32, string2, mouse_dd, 0 +edit3 edit_box 80, 244, 269, 0xd0ffd0, 0xff, 0x80ff, 0, 0x8000, 32, string3, mouse_dd, 0 +editboxes_end: + +string1 rb 34 +string2 rb 34 +string3 rb 34 + +align 4 +w_scr_t3 scrollbar 16, 0,0,0, 15, 100,0,0, 0,0,0, 1 diff --git a/programs/develop/libraries/box_lib/trunk/t_edit.asm b/programs/develop/libraries/box_lib/trunk/t_edit.asm index e85b33bd4d..534d07ce38 100644 --- a/programs/develop/libraries/box_lib/trunk/t_edit.asm +++ b/programs/develop/libraries/box_lib/trunk/t_edit.asm @@ -1,4486 +1,4482 @@ -; ⥬ ⥪ box_lib.obj -; TextEditor KolibriOS -; 䠩 ᫥ ࠧ 12.01.2021 IgorA -; ਬ GPL2 業 - -;input: -; edi = pointer to tedit struct -; reg = index -;output: -; reg = pointer to 'tex' struct -macro ConvertIndexToPointer reg { - imul reg,sizeof.symbol - add reg,ted_tex -} - -;--- out_reg = ted_key_words_data[ind_reg].Text[0] --- -macro ColToIndexOffset ind_reg,out_reg { - mov out_reg,ind_reg - imul out_reg,sizeof.TexColViv - add out_reg,ted_key_words_data -} - -TED_LINES_IN_NEW_FILE equ 30 ;᫮ ப 䠩 -MAX_COLOR_WORD_LEN equ 40 -;------------------------------------------------------------------------------ -struct TexSelect - x0 dd ? - y0 dd ? - x1 dd ? - y1 dd ? -ends - -struct TexColViv - Text rb MAX_COLOR_WORD_LEN ; ᫮ ᢥ⪨ - f1 dd 0 ; ࠢ ᫮ - flags db ? ; f1+4 䫠 ᯮ㥬 뤥 - endc db ? ; f1+5 ᨬ 뤥 (ᯮ flags&4) - escc db ? ; f1+6 ࠭騩 ᨬ (ᯮ flags&4) - color db ? ; f1+7 梥 -ends - -struct symbol - c db ? ; +0 ᨬ - col db ? ; +1 梥 - perv dd ? ; +2 - next dd ? ; +6 㪠⥫ - tc dd ? ; +10 ६. ᮧ - td dd ? ; +14 ६. 㤠 -ends -;------------------------------------------------------------------------------ - -ted_symbol_space db 32 ;ascii ஡, 뢠 㦥 -ted_symbol_tab db 26 ;ascii ५ ࠢ, ᯮ ᮢ ⠡樨 ० ᨬ - -if lang eq ru_RU - -txtRow db 'ப',0 -txtCol db '',0 -txtOtm db '⬥',0 -txtBuf db ':',0 - -else - -txtRow db 'Rows',0 -txtCol db 'Cols',0 -txtOtm db 'Undo',0 -txtBuf db 'Buffer:',0 - -end if - -;EvChar - ⠡ 䨫஢ 塞 ᨬ, - 譨 -align 16 -EvChar db 0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - -KM_SHIFT equ 0x00010000 -KM_CTRL equ 0x00020000 -KM_ALT equ 0x00040000 -KM_NUMLOCK equ 0x00080000 - -; KEY CODES -KEY_F1 equ 0x0000003B -KEY_F2 equ 0x0000003C -KEY_F3 equ 0x0000003D - - - -align 16 -proc ted_init uses eax ecx edi, edit:dword - mov edi,[edit] - - mov ecx,sizeof.symbol - imul ecx,ted_max_chars - invoke mem.alloc,ecx ;뤥塞 - mov ted_tex,eax - mov ted_tex_1,eax - add ted_tex_1,sizeof.symbol - add eax,ecx - mov ted_tex_end,eax - - stdcall ted_clear, edi,1 - -;------------------------------------------------- - mov ecx,1024 ;1024 - ᨢ ted_arr_key_pos - add ecx,ted_syntax_file_size - invoke mem.alloc,ecx - mov ted_arr_key_pos,eax - add eax,1024 - mov ted_syntax_file,eax - - stdcall ted_init_scroll_bars,edi,3 - ret -endp - -MIN_W_SCRL_ARE equ 3 ;쭠 ⮡ࠦ . ஫ -MIN_H_SCRL_ARE equ 3 ;쭠 ⮡ࠦ ਧ. ஫ -;input: -; opt = 1 - 梥 ஫, 2 - ࠧ , -; 4 - ࠧ 㬥 -align 16 -proc ted_init_scroll_bars, edit:dword, opt:dword - pushad - mov edi,[edit] - mov esi,ted_scr_w - mov ebx,ted_scr_h - bt dword[opt],0 - jae @f - mov ecx,ted_color_wnd_work - mov dword[esi+sb_offs_bckg_col],ecx - mov dword[ebx+sb_offs_bckg_col],ecx - mov ecx,ted_color_wnd_capt - mov dword[esi+sb_offs_frnt_col],ecx - mov dword[ebx+sb_offs_frnt_col],ecx - mov ecx,ted_color_wnd_bord - mov dword[esi+sb_offs_line_col],ecx - mov dword[ebx+sb_offs_line_col],ecx - @@: - bt dword[opt],2 ; ࠧ 㬥 ? - jae .doc_resize - call ted_get_num_lines - cmp eax,TED_LINES_IN_NEW_FILE - jge @f - mov eax,TED_LINES_IN_NEW_FILE - @@: - mov dword[esi+sb_offs_max_area],eax - .doc_resize: - bt dword[opt],1 ; ࠧ ? - jae .no_size - mov edx,ted_wnd_l - add edx,ted_rec_l - mov word[ebx+sb_offs_start_x],dx ;⠢塞 ਧ. ஫ - mov eax,ted_wnd_h ;calculate lines in page - mov edx,ted_wnd_t - add edx,eax - mov word[ebx+sb_offs_start_y],dx ;⠢塞 孨 ਧ. ஫ - sub eax,ted_rec_t - xor edx,edx - mov ecx,ted_rec_h - div ecx - cmp eax,MIN_W_SCRL_ARE - jg @f - mov eax,MIN_W_SCRL_ARE - @@: - mov dword[esi+sb_offs_cur_area],eax - - mov eax,ted_wnd_w ;calculate cols in page - mov edx,ted_wnd_l ; - add edx,eax ;塞 ਭ - mov word[esi+sb_offs_start_x],dx ;⠢塞 . ஫ - mov edx,ted_wnd_t - mov word[esi+sb_offs_start_y],dx ;⠢塞 孨 . ஫ - mov edx,ted_wnd_h - mov word[esi+sb_offs_size_y],dx ;⠢塞 . ஫ - sub eax,ted_rec_l - mov word[ebx+sb_offs_size_x],ax ;⠢塞 ਭ ਧ. ஫ - xor edx,edx - mov ecx,ted_rec_w - div ecx - cmp eax,MIN_H_SCRL_ARE - jg @f - mov eax,MIN_H_SCRL_ARE - @@: - dec eax - mov dword[ebx+sb_offs_cur_area],eax ;⠭ ᫮ ᨬ, ࠭ ਧ. ஫ - .no_size: - popad - ret -endp - -align 16 -proc ted_delete uses edi, edit:dword - mov edi,[edit] - invoke mem.free,ted_tex - invoke mem.free,ted_arr_key_pos ;ted_syntax_file - ret -endp - - -;input: -; eax = key kodes -align 16 -proc ted_key, edit:dword, table:dword, control:dword - pushad - mov edi,[edit] - mov esi,ted_el_focus - cmp dword[esi],edi - jne .end_key_fun ; 䮪 室 㭪樨 - mov esi,dword[control] - - cmp ah,KEY_F1 ;[F1] - jne @f - stdcall ted_show_help_f1,edi - jmp .end_key_fun - @@: - cmp ah,KEY_F3 ;[F3] - jne @f - stdcall ted_but_find,edi,0 - jmp .end_key_fun - @@: - - test esi,KM_CTRL ;Ctrl+... - jz .key_Ctrl - ; *** 맮 譨 㭪権 ॡ /࠭/᪠/... - cmp ted_fun_on_key_ctrl_all,0 - je .end0 - xor al,al - cmp ah,24 ;Ctrl+O - jne @f - mov al,'O' - @@: - cmp ah,31 ;Ctrl+S - jne @f - mov al,'S' - @@: - cmp ah,33 ;Ctrl+F - jne @f - mov al,'F' - @@: - cmp ah,34 ;Ctrl+G - jne @f - mov al,'G' - @@: - cmp ah,35 ;Ctrl+H - jne @f - mov al,'H' - @@: - cmp ah,49 ;Ctrl+N - jne @f - mov al,'N' - @@: - or al,al - jz .end0 - and eax,0xff - test esi,KM_SHIFT - jz @f - or eax,0x100 - @@: - stdcall ted_fun_on_key_ctrl_all, eax - jmp .end_key_fun - .end0: - - ; *** 맮 ७ 㭪権 - cmp ah,30 ;Ctrl+A - jne @f - call ted_sel_all - @@: - cmp ah,44 ;Ctrl+Z - jne @f - stdcall ted_but_undo,edi - @@: - cmp ah,45 ;Ctrl+X - jne @f - stdcall ted_but_cut,edi - @@: - cmp ah,46 ;Ctrl+C - jne @f - stdcall ted_but_copy,edi - @@: - cmp ah,47 ;Ctrl+V - jne @f - stdcall ted_but_paste,edi - @@: - cmp ah,199 ;Ctrl+Home - jne @f - call ted_key_ctrl_home - @@: - cmp ah,207 ;Ctrl+End - jne @f - call ted_key_ctrl_end - @@: - jmp .end_key_fun - .key_Ctrl: - - test esi,KM_SHIFT ;Shift+... - jz .key_Shift - cmp ah,72 ;Shift+Up - jne @f - call ted_sel_key_up - @@: - cmp ah,75 ;Shift+Left - jne @f - call ted_sel_key_left - @@: - cmp ah,77 ;Shift+Right - jne @f - call ted_sel_key_right - @@: - cmp ah,80 ;Shift+Down - jne @f - call ted_sel_key_down - @@: - ;mov ted_drag_k,1 ;稭 뤥 - jmp .key_MoveCur - .key_Shift: -;------------------------------------------------- - cmp ah,72 ;178 ;Up - jne @f - call ted_draw_cursor_sumb - call ted_cur_move_up - cmp dl,8 - jne .no_red_0 - call ted_scroll_set_redraw - stdcall ted_draw,edi - jmp @f - .no_red_0: - call ted_sel_end - @@: - cmp ah,80 ;177 ;Down - jne @f - call ted_draw_cursor_sumb - call ted_cur_move_down - cmp dl,8 - jne .no_red_1 - call ted_scroll_set_redraw - stdcall ted_draw,edi - jmp @f - .no_red_1: - call ted_sel_end - @@: - cmp ah,75 ;176 ;Left - jne @f - call ted_draw_cursor_sumb - call ted_cur_move_left - cmp dl,8 - jne .no_red_2 - call ted_scroll_set_redraw - stdcall ted_draw,edi - jmp @f - .no_red_2: - call ted_sel_end - @@: - cmp ah,77 ;179 ;Right - jne @f - call ted_draw_cursor_sumb - call ted_cur_move_right - cmp dl,8 - jne .no_red_3 - call ted_scroll_set_redraw - stdcall ted_draw,edi - jmp @f - .no_red_3: - call ted_sel_end - @@: - cmp ah,71 ;180 ;Home - jne @f - call ted_draw_cursor_sumb - call ted_cur_move_x_first_char - cmp dl,8 - jne .no_red_4 - call ted_scroll_set_redraw - stdcall ted_draw,edi - jmp @f - .no_red_4: - call ted_sel_end - @@: - cmp ah,79 ;181 ;End - jne @f - call ted_draw_cursor_sumb - call ted_cur_move_x_last_char - cmp dl,8 - jne .no_red_5 - call ted_scroll_set_redraw - stdcall ted_draw,edi - jmp @f - .no_red_5: - call ted_sel_end - @@: - cmp ah,73 ;184 ;PageUp - jne @f - call ted_cur_move_page_up - cmp dl,0 - je @f - call ted_scroll_set_redraw - stdcall ted_draw,edi - mov ted_drag_k,0 ;稢 뤥 - @@: - cmp ah,81 ;183 ;PageDown - jne @f - call ted_cur_move_page_down - cmp dl,0 - je @f - call ted_scroll_set_redraw - stdcall ted_draw,edi - mov ted_drag_k,0 ;稢 뤥 - @@: -;------------------------------------------------- - .key_MoveCur: - - ; ய᪠ 㦥 , ᨬ - cmp ah,42 ;[L Shift] 㣨 - je .end_key_fun - cmp ah,54 ;[R Shift] 㣨 - je .end_key_fun - cmp ah,58 ;[Caps Lock] - je .end_key_fun - cmp ah,69 ;[Pause Break] - je .end_key_fun - cmp ah,120 ;[Fn] - je .end_key_fun - cmp ah,0x80 ;if key up - ja .end_key_fun - - cmp dword[table],0 - je @f - stdcall KeyConvertToASCII, [table] - @@: - - ;mov ted_drag_k,0 ;稢 뤥 - - lea edx,[EvChar] ;६ ⠡ ⨬묨 ᨬ - add dl,ah - jae @f - add edx,0x100 ;᫨ 뫮 ९ ᨬ - @@: - cmp byte[edx],1 - jne @f - mov ted_key_new,ah - call ted_set_undo - mov edx,ted_opt_ed_change_time+ted_opt_ed_move_cursor - stdcall ted_sel_text_del,edx - cmp al,1 - jne .del - mov edx,ted_opt_ed_move_cursor - .del: - cmp ted_cur_ins,1 - je .no_ins_mod - stdcall ted_text_del,edi,ted_opt_ed_change_time - mov edx,ted_opt_ed_move_cursor - .no_ins_mod: - mov ecx,edi - add ecx,ted_offs_key_new - stdcall ted_text_add,edi,ecx,1,edx ;塞 ᨬ - cmp ted_key_new,13 - jne .dr_m_win - ;᫨ ⠢ ᨬ ப - mov ecx,ted_scr_w - inc dword[ecx+sb_offs_max_area] ;㢥稢 ࠧ ⨪쭮 ஫ - mov edx,ted_cur_y - cmp edx,[ecx+sb_offs_cur_area] - jl .no_change - dec ted_cur_y ; ⠢塞 - inc dword[ecx+sb_offs_position] ;ᤢ 㭮 - .no_change: - stdcall ted_draw,edi - jmp .dr_cur_l - .dr_m_win: - stdcall ted_draw_cur_line,edi - .dr_cur_l: - cmp ted_fun_draw_panel_buttons,0 - je @f - call ted_fun_draw_panel_buttons - @@: - - cmp ah,8 ;[<-] - jne @f - call ted_set_undo - stdcall ted_sel_text_del,ted_opt_ed_change_time - cmp al,1 - je .del_one_b - stdcall ted_text_del,edi,ted_opt_ed_change_time+ted_opt_ed_move_cursor - .del_one_b: - stdcall ted_draw,edi - cmp ted_fun_draw_panel_buttons,0 - je .end_key_fun - call ted_fun_draw_panel_buttons - jmp .end_key_fun -align 4 - @@: - - cmp ah,182 ;Delete - jne @f - call ted_set_undo - stdcall ted_sel_text_del,ted_opt_ed_change_time - cmp al,1 - je .del_one_d - stdcall ted_text_del,edi,ted_opt_ed_change_time - .del_one_d: - stdcall ted_draw,edi - cmp ted_fun_draw_panel_buttons,0 - je .end_key_fun - call ted_fun_draw_panel_buttons - jmp .end_key_fun - @@: - - cmp ah,185 ;Ins - jne @f - call ted_draw_cursor_sumb - xor ted_cur_ins,1 - call ted_draw_main_cursor - @@: - - .end_key_fun: - popad - ret -endp - -;output: -; al = 1 - can save -align 16 -proc ted_can_save uses ecx edi, edit:dword - mov edi,[edit] - - mov ecx,ted_tim_ch - sub ecx,ted_tim_undo - mov al,1 - cmp ted_tim_ls,ecx - jne @f - dec al - @@: - ret -endp - -;input: -; edi = pointer to tedit struct -;output: -; al = 1 - selected -align 16 -proc ted_is_select uses ebx - xor al,al - cmp ted_drag_m,1 - je @f - inc al - mov ebx,ted_sel_x0 - cmp ebx,ted_sel_x1 - jne @f - mov ebx,ted_sel_y0 - cmp ebx,ted_sel_y1 - jne @f - xor al,al - @@: - ret -endp - -;input: -; edi = pointer to tedit struct -align 16 -proc ted_sel_normalize uses ecx esi - push edi - mov esi,edi - add esi,ted_offs_sel - add edi,ted_offs_seln - mov ecx,sizeof.TexSelect/4 - rep movsd - pop edi - - jmp @f - .swp_f: - mov ecx,ted_seln_x0 - m2m ted_seln_x0,ted_seln_x1 - mov ted_seln_x1,ecx - - mov ecx,ted_seln_y0 - cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1) - jle .end_f - m2m ted_seln_y0,ted_seln_y1 - mov ted_seln_y1,ecx - - jmp .end_f -align 4 - @@: - - mov ecx,ted_seln_y0 - cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1) - jg .swp_f - - cmp ecx,ted_seln_y1 ;(sel_y0==sel_y1) - jne .end_f - mov ecx,ted_seln_x0 - cmp ecx,ted_seln_x1 ;(sel_x0>sel_x1) - jg .swp_f - - .end_f: - ret -endp - -;input: -; edi = pointer to tedit struct -;description: -; 㭪 뢠 砫 뤥 -align 16 -proc ted_sel_start uses eax ecx - mov eax,ted_scr_h - mov ecx,ted_cur_x - add ecx,[eax+sb_offs_position] - mov ted_sel_x0,ecx - mov ted_sel_x1,ecx - - mov eax,ted_scr_w - mov ecx,ted_cur_y - add ecx,[eax+sb_offs_position] - mov ted_sel_y0,ecx - mov ted_sel_y1,ecx - ret -endp - -;input: -; edi = pointer to tedit struct -;description: -; 㭪 뢠 ⨨ 뤥 -align 16 -proc ted_sel_end uses eax - mov ted_drag_k,0 ;稢 뤥 - call ted_is_select - or al,al - jz @f - xor eax,eax - mov ted_sel_x0,eax - mov ted_sel_x1,eax - mov ted_sel_y0,eax - mov ted_sel_y1,eax - stdcall ted_draw,edi - jmp .end_f - @@: - call ted_draw_main_cursor - .end_f: - ret -endp - -;input: -; edi = pointer to tedit struct -;description: -; 㭪 뢠 ६饭 뤥 -align 16 -proc ted_sel_move - push eax ecx - mov ecx,ted_cur_x - mov eax,ted_scr_h - add ecx,[eax+sb_offs_position] - mov ted_sel_x1,ecx - - mov eax,ted_scr_w - mov ecx,ted_cur_y - add ecx,[eax+sb_offs_position] - mov ted_sel_y1,ecx - pop ecx eax - cmp ted_fun_draw_panel_buttons,0 ;redraw toolbar (need to button Copy) - je @f - call ted_fun_draw_panel_buttons - @@: - ret -endp - -;input: -; edi = pointer to tedit struct -;description: -; 㭪 뢠 뤥 ᥣ 㬥 -align 16 -proc ted_sel_all - push eax - xor eax,eax - mov ted_sel_x0,eax - mov ted_sel_y0,eax - - mov ted_sel_x1,eax ;??? - call ted_get_num_lines - mov ted_sel_y1,eax - pop eax - stdcall ted_draw,edi - cmp ted_fun_draw_panel_buttons,0 ;redraw toolbar (need to button Copy) - je @f - call ted_fun_draw_panel_buttons - @@: - ret -endp - -;input: -; cl_al_mem = 1 - clear all memory -align 16 -proc ted_clear uses ecx edi, edit:dword, cl_al_mem:dword - mov edi,[edit] - - mov ted_cur_x,0 - mov ted_cur_y,0 - mov ted_tim_ch,0 - mov ted_tim_ls,0 - mov ted_tim_co,0 - mov ted_tim_undo,0 - mov ted_help_id,-1 - mov ecx,sizeof.symbol - shl ecx,1 - add ecx,ted_tex - mov ted_ptr_free_symb,ecx - - mov ecx,ted_scr_w - mov dword[ecx+sb_offs_position],0 - mov dword[ecx+sb_offs_max_area],100 ;᫮ ப 㬥 - mov dword[ecx+sb_offs_redraw],1 - mov ecx,ted_scr_h - mov dword[ecx+sb_offs_position],0 - mov dword[ecx+sb_offs_max_area],100 ;᫮ ᨬ 㬥 - - mov ted_sel_x0,0 - mov ted_sel_y0,0 - mov ted_sel_x1,0 - mov ted_sel_y1,0 - - cmp dword[cl_al_mem],0 - je .exit - - push edx - mov ecx,sizeof.symbol - imul ecx,ted_max_chars - mov edx,ted_tex - @@: - mov byte [edx],0 - inc edx - loop @b - mov edx,ted_tex - mov dword [edx+symbol.next],1 - pop edx - - .exit: - ret -endp - - -align 16 -proc ted_init_syntax_file, edit:dword - pushad - mov edi,[edit] - - mov ecx,0x100 - mov edx,ted_arr_key_pos - @@: - mov dword[edx],-1 - add edx,4 - loop @b - - ;init: ted_colors_text_count, ted_key_words_count, ... - mov ted_colors_text_count,1 - mov ted_help_text_f1,0 - mov ted_help_id,-1 ;䨪 ᫮ ࠢ - - mov eax,edi ;࠭塞 祭 edi - mov esi,ted_syntax_file - add edi,ted_offs_count_colors ;edi = &ted_key_words_count - mov ecx,9 - rep movsd - mov edi,eax ;⠭ 祭 edi - - mov eax,ted_syntax_file - add eax,32 - mov ted_text_colors,eax - - mov eax,ted_colors_text_count ;init: count_colors_text (offset to key words) - lea eax,[4*eax+32] - add eax,ted_syntax_file - mov ted_key_words_data,eax - - mov ecx,ted_key_words_count ;init: ted_arr_key_pos (first key positions) - or ecx,ecx - jz .no_words - xor eax,eax - @@: - ColToIndexOffset eax,edx - movzx ebx,byte[edx] - mov esi,ted_arr_key_pos - lea esi,[esi+4*ebx] - cmp dword[esi],-1 - jne .no_ch_key - mov [esi],eax - .no_ch_key: - inc eax - loop @b - .no_words: - - ;init: ted_help_text_f1 - mov ecx,ted_key_words_count ;⢮ 祢 ᫮ - imul ecx,sizeof.TexColViv ;ࠧ 1- . . - add ecx,ted_key_words_data ;砫 䠩 . . - mov ted_help_text_f1,ecx ;⪠ , 稭 ⥪ ࠢ - - stdcall ted_init_scroll_bars,edi,1 ;塞 梥 ஫ - .no_colors: - popad - ret -endp - -;input: -; ebx = file size -; edi = pointer to tedit struct -;description: -; 㭪 뢠 ⨨ 䠩 -align 16 -proc ted_on_open_file - push eax ;destination - push ecx ;for cycle - push edx ;source - push esi - - or ebx,ebx - jnz @f - ;᫨ 䠩 ⮩ - stdcall ted_clear,edi,1 ;⨬ - jmp .end_opn -align 4 - @@: - stdcall ted_clear,edi,0 ;⨬ , ⮬ 㤥 묨 묨 - - mov edx,ted_tex - mov ecx,ebx - .s_10: - cmp word[edx],0xa0d ;ய᪠ 10- ᨬ ᫨ । ⮨ 13- - jne @f - dec ecx - jz .no_10 - dec ecx - jz .no_10 - add edx,2 - @@: - cmp byte[edx],10 - jne @f - mov byte[edx],13 ;塞 10- ᨬ ப - @@: - inc edx - loop .s_10 - .no_10: - - ;ॢ 䠩 t_edit - mov ecx,ebx - lea eax,[ebx+2] - ConvertIndexToPointer eax - mov edx,ted_tex - add edx,ebx - push ebx - @@: - mov ebx,[edx] - mov byte[eax],bl - mov dword[eax+symbol.perv],ecx - inc dword[eax+symbol.perv] - mov dword[eax+symbol.next],ecx - add dword[eax+symbol.next],3 - ;mov byte[eax+1],0 ;col=0 - mov dword[eax+symbol.tc],-1 - mov dword[eax+symbol.td],0 - - or ecx,ecx - jz @f - dec ecx - dec edx - sub eax,sizeof.symbol - jmp @b -align 4 - @@: - pop ebx - mov dword[eax+symbol.perv],0 ; first sumbol 'perv=0' - - mov edx,ted_tex ; ன 砫쭮 㦥 ᨬ - ; begining sumbol 'perv=0' 'next=2' - mov dword[edx+symbol.perv],0 - mov dword[edx+symbol.next],2 - - add edx,sizeof.symbol ; ன 筮 㦥 ᨬ - mov dword[edx+symbol.next],0 ; last sumbol 'next=0' - mov dword[edx+symbol.perv],ebx ; last sumbol 'perv=last' - inc dword[edx+symbol.perv] - mov dword[edx+symbol.tc],0 ; ⠢ ६ ᮧ ࠢ 0, ᨬ ࠢ쭮 ࠡ뢠 ⨨ 䠩 28 - - mov edx,ebx - inc edx ;2 = rezerv sumbols - imul edx,sizeof.symbol - add edx,ted_tex - mov dword[edx+symbol.next],1 ; last sumbol 'next=1' - - @@: ;clear memory, need if before was open big file - add edx,sizeof.symbol - cmp edx,ted_tex_end - jge .end_opn - mov dword[edx+symbol.tc],0 - mov dword[edx+symbol.td],0 - jmp @b -align 4 - .end_opn: - - call ted_get_num_lines - cmp eax,TED_LINES_IN_NEW_FILE - jge @f - mov eax,TED_LINES_IN_NEW_FILE - @@: - mov esi,ted_scr_w - mov dword[esi+sb_offs_max_area],eax - pop esi edx ecx eax - - call ted_text_colored - stdcall ted_draw,edi - cmp ted_fun_draw_panel_buttons,0 - je @f - call ted_fun_draw_panel_buttons - @@: - ret -endp - -;input: -; edx = pointer to symbol struct -; edi = pointer to tedit struct -;output: -; edx = pointer to 'perv' visible symbol struct -align 16 -ted_iterat_perv: - cmp ted_tim_undo,0 - je .else - push ebx - @@: - mov edx,[edx+symbol.perv] - or edx,edx - jz @f - imul edx,sizeof.symbol - add edx,ted_tex - call ted_symbol_not_vis - cmp bl,1 - je @b - cmp byte[edx],10 ;ய ᨬ 10 - je @b - pop ebx - ret - @@: - mov edx,ted_tex ;砫 䠩 - pop ebx - ret - .else: - mov edx,[edx+symbol.perv] - or edx,edx - jz @f - imul edx,sizeof.symbol - add edx,ted_tex - cmp dword[edx+symbol.td],0 - jne .else - cmp byte[edx],10 ;ய ᨬ 10 - je .else - ret - @@: - mov edx,ted_tex ;砫 䠩 - ret - - -;input: -; edx = pointer to symbol struct -; edi = pointer to tedit struct -;output: -; edx = pointer to 'next' visible symbol struct -align 16 -ted_iterat_next: - cmp ted_tim_undo,0 - je .else - push ebx - @@: - mov edx,[edx+symbol.next] - cmp edx,1 - jle @f - imul edx,sizeof.symbol - add edx,ted_tex - - call ted_symbol_not_vis - cmp bl,1 - je @b - cmp byte[edx],10 ;ய ᨬ 10 - je @b - pop ebx - ret - @@: - mov edx,ted_tex_1 ; 䠩 - pop ebx - ret - .else: - mov edx,[edx+symbol.next] - cmp edx,1 - jle @f - imul edx,sizeof.symbol - add edx,ted_tex - - cmp dword[edx+symbol.td],0 - jne .else - cmp byte[edx],10 ;ய ᨬ 10 - je .else - ret - @@: - mov edx,ted_tex_1 ; 䠩 - ret - -;input: -; bl = symbol end of select -; bh = ࠭騩 ᨬ (= 0 ᫨ ஢ન ) -; edx = pointer to symbol struct -; edi = pointer to tedit struct -;description: -; ᫥ 㪠 ᨬ -align 16 -ted_iterat_next_pos_char: - push ax - mov al,1 ;।騩 ᨬ, 㦨 ࠢ ᨬ bh - @@: - cmp bl,byte[edx] - je .found - .no_found: - cmp edx,ted_tex_1 - jle @f - mov al,byte[edx] - call ted_iterat_next - jmp @b - .found: - cmp bh,al - je .no_found - @@: - call ted_iterat_next - pop ax - ret - -;input: -; edx = pointer to symbol struct -; edi = pointer to tedit struct -align 16 -ted_iterat_perv_color_tag: - @@: - cmp byte[edx+1],0 - jne @f - call ted_iterat_perv - cmp edx,ted_tex_1 - jle @f - jmp @b -align 4 - @@: - ret - -;input: -; edx = pointer to symbol struct -; edi = pointer to tedit struct -align 16 -ted_iterat_next_color_tag: - @@: - call ted_iterat_next - cmp byte[edx+1],0 - jne @f - cmp edx,ted_tex_1 - jle @f - jmp @b -align 4 - @@: - ret - -;input: -; edx = pointer to symbol struct -; edi = pointer to tedit struct -;output: -; bl = 1 if sumbol not visible -; (tex[i].td+ted_tim_undo<=ted_tim_ch && tex[i].td) || (tex[i].tc>ted_tim_ch-ted_tim_undo) -align 16 -ted_symbol_not_vis: - push eax - - xor bl,bl - cmp dword[edx+symbol.td],0 - je @f - mov eax,[edx+symbol.td] ;eax=tex[i].td - add eax,ted_tim_undo - cmp eax,ted_tim_ch - jg @f - mov bl,1 - pop eax - ret - @@: - - mov eax,ted_tim_ch - sub eax,ted_tim_undo - cmp [edx+symbol.tc],eax - jle @f - or bl,1 - @@: - - pop eax - ret - -;input: -; text - pointer to text string -; add_opt - options -align 16 -proc ted_text_add, edit:dword, text:dword, t_len:dword, add_opt:dword - locals - new_spc dd ? ;count new spaces - new_lin dd ? ;count new lines - endl -;ᯮ짮 ॣ஢ 㭪樨: -;eax - ⠢ ⥪ -;ebx - ६ 㦤, ⠢塞 ⥪ -;ecx - ६ 㦤 -;edx - 㪠⥫ ᨬ - pushad - cmp dword[t_len],1 ;஢塞 塞 ⥪ - jl .no_add ; <1 룠 㭪樨,  - - mov edi,[edit] - mov esi,[text] - - call ted_get_pos_by_cursor - call ted_get_text_perv_pos - call ted_get_text_arr_index ;eax=po_t - - mov dword[new_spc],0 - cmp ted_gp_opt,2 - je @f - push eax ;c_sp=cur[cn].x+Scroller->XPos-StrLen(cur[cn].y+Scroller->YPos); - mov eax,ted_scr_h - mov eax,[eax+sb_offs_position] - add eax,ted_cur_x ;eax - ᨬ - mov [new_spc],eax - - mov eax,ted_scr_w - mov eax,[eax+sb_offs_position] - add eax,ted_cur_y ;eax - ப - call ted_strlen ;ebx = line len - sub [new_spc],ebx ; 樨 ⭨ ப, 㧭 ⢮ 塞 ஡ - pop eax - @@: - - mov ebx,[t_len] - - mov dword[new_lin],0 - cmp ted_gp_opt,0 - jne @f - push eax - mov eax,ted_scr_w - mov eax,[eax+sb_offs_position] - add eax,ted_cur_y - inc eax - mov [new_lin],eax - - call ted_get_num_lines - sub [new_lin],eax - ;㢥稢 ஫ ᫮ ⥫ ப - mov ecx,ted_scr_w - add [ecx+sb_offs_max_area],eax ;㢥稢 ࠧ ⨪쭮 ஫ - pop eax - @@: - - mov edx,ted_ptr_free_symb - .beg_cycle: ;for(i=...;i ted_cur_x - mov ted_gp_opt,1 - cmp eax,ecx - jge @f ; Row >= ted_cur_y - .u1_0: - mov ted_gp_opt,0 - inc ebx - cmp byte [edx],13 - jne @b - cmp eax,ecx - jge @f ; Row >= ted_cur_y - inc eax - xor ebx,ebx - jmp @b - @@: - cmp eax,ecx - jne @f ; Row = ted_cur_y - inc ted_gp_opt - @@: - cmp ted_gp_opt,0 - jne @f - mov edx,ted_tex_1 - ;call ted_get_text_perv_pos - @@: - ret -endp - -;input: -; eax = Row -; edi = pointer to tedit struct -;output: -; ebx = str len -align 16 -ted_strlen: - push edx ecx - ;ecx = Row, from cycle - - xor ebx,ebx - xor ecx,ecx - mov edx,ted_tex - @@: - call ted_iterat_next - cmp edx,ted_tex_1 - jle @f - inc ebx - cmp byte [edx],13 - jne @b - dec ebx ;lenght minus 1 sumbol to paragraph - cmp eax,ecx - je @f - xor ebx,ebx - inc ecx - jmp @b - @@: - - cmp eax,ecx - je @f - xor ebx,ebx - @@: - - pop ecx edx - ret - - -;input: -; edx = symbol position -; edi = pointer to tedit struct -;output: -; eax = number of line -; ebx = symbol position in line -align 16 -ted_get_text_coords: - push edx - xor eax,eax - xor ebx,ebx - @@: - call ted_iterat_perv - - or eax,eax - jnz .no_col_mov - inc ebx - .no_col_mov: - - cmp edx,ted_tex_1 - jle @f - cmp byte [edx],13 - jne @b - inc eax - jmp @b - @@: - dec ebx - pop edx - ret - -;input: -; edi = pointer to tedit struct -;output: -; eax = num lines -align 16 -ted_get_num_lines: - push edx - mov eax,1 - mov edx,ted_tex - @@: - call ted_iterat_next - cmp edx,ted_tex_1 - jle @f - cmp byte[edx],13 - jne @b - inc eax - jmp @b - @@: -;... -;dec eax - pop edx - ret - - -;input: -; edi = pointer to tedit struct -;description: -; ⬥ ⬥ ⢨, । 㬥 -align 16 -proc ted_set_undo - mov ted_drag_k,0 ;稢 뤥 - cmp ted_tim_undo,1 - jl .no_work - - push eax ebx edx - mov edx,ted_tex - call ted_get_text_next_pos ;long i=tex[0].next; - mov eax,ted_tim_undo - sub ted_tim_ch,eax ;ted_tim_ch-=ted_tim_undo; - mov eax,ted_tim_ch - cmp ted_tim_ls,eax ;if(ted_tim_ls>ted_tim_ch) - jle @f - mov ted_tim_ls,0 - @@: - cmp edx,ted_tex_1 - jle @f - - ;if(tex[i].tc>ted_tim_ch){ // ᫨ ᮧ ᨬ 뫮 ⬥ - cmp [edx+symbol.tc],eax - jle .no_u1 - mov dword[edx+symbol.tc],0 - mov dword[edx+symbol.td],0 - - mov ebx,[edx+symbol.perv] - imul ebx,sizeof.symbol - add ebx,ted_tex ;ebx=tex[i].perv - m2m dword [ebx+symbol.next],dword [edx+symbol.next] ;tex[tex[i].perv].next=tex[i].next; - - mov ebx,[edx+symbol.next] - imul ebx,sizeof.symbol - add ebx,ted_tex ;ebx=tex[i].next - m2m dword [ebx+symbol.perv],dword [edx+symbol.perv] ;tex[tex[i].next].perv=tex[i].perv; - - cmp ted_ptr_free_symb,edx - jle .no_cor_free - mov ted_ptr_free_symb,edx ;塞 㪠⥫ ᢮ ᨬ, ண ᪠ - .no_cor_free: - mov edx,ebx ;⨬㥬 ᪮ (edx ᫥ 맮 ted_get_text_next_pos 㤥 ࠢ ebx) - jmp @b - .no_u1: - - ;else if(tex[i].td>ted_tim_ch) tex[i].td=0; // ᫨ 㤠 ᨬ 뫮 ⬥ - cmp [edx+symbol.td],eax - jle .no_u2 - mov dword[edx+symbol.td],0 - .no_u2: - - call ted_get_text_next_pos - jmp @b - @@: - mov ted_tim_undo,0 - mov eax,ted_tim_co - cmp ted_tim_ch,eax - jge @f - mov ted_tim_co,0 - @@: - pop edx ebx eax - .no_work: - ret -endp - -;description: -; 室 㪠 -;input: -; row = ப -; col = ᨬ -align 16 -proc ted_go_to_position uses ecx edx edi, edit:dword, row:dword, col:dword - mov edi,[edit] - ; ⮢ ப - mov edx,[row] - call ted_get_num_lines - cmp edx,eax - jle @f - mov edx,eax ;࠭祭 ப max - @@: - dec edx - cmp edx,0 - jge @f - xor edx,edx ;࠭祭 ப min - @@: - ; ⮢ ᨬ - mov ecx,[col] - dec ecx - cmp ecx,0 - jge @f - xor ecx,ecx - @@: - call ted_go_to_pos - stdcall ted_draw,edi - ret -endp - -;input: -; ecx = Col -; edx = Row -; edi = pointer to tedit struct -;output: -; ecx = cursor x -; edx = cursor y -align 16 -ted_go_to_pos: - push eax ebx - mov eax,ted_scr_h - sub ecx,[eax+sb_offs_position] - cmp ecx,0 ;ted_cur_x < 0 - jge @f - add [eax+sb_offs_position],ecx ;ப⪠ ஫ - xor ecx,ecx - @@: - mov ebx,5 ;5 - ᫥ - cmp ecx,ebx - jge .end0 - sub ebx,ecx ;ebx - ᪮쪮 ᨬ 㦭 ᤢ - cmp [eax+sb_offs_position],ebx - jge @f - add ecx,[eax+sb_offs_position] - mov dword[eax+sb_offs_position],0 - jmp .end0 - @@: - sub [eax+sb_offs_position],ebx - add ecx,ebx - .end0: - cmp ecx,[eax+sb_offs_cur_area] ;ted_cur_x > [.cur_area] - jl .end1 - mov ebx,ecx - sub ebx,[eax+sb_offs_cur_area] - inc ebx - add [eax+sb_offs_position],ebx ;ப⪠ ஫ ࠢ - sub ecx,ebx - .end1: - mov ted_cur_x,ecx - - mov eax,ted_scr_w - sub edx,[eax+sb_offs_position] - cmp edx,0 ;ted_cur_y < 0 - jge @f - add [eax+sb_offs_position],edx ;ப⪠ ஫ - xor edx,edx - jmp .end2 - @@: - cmp edx,[eax+sb_offs_cur_area] ;ted_cur_y > [.cur_area] - jl .end2 - mov ebx,edx - sub ebx,[eax+sb_offs_cur_area] - inc ebx - add [eax+sb_offs_position],ebx ;ப⪠ ஫ - sub edx,ebx - .end2: - mov ted_cur_y,edx - pop ebx eax - ret - -;input: -; edi = pointer to tedit struct -align 16 -ted_text_colored: - push eax edx - mov eax,ted_tim_ch - sub eax,ted_tim_undo - mov ted_tim_co,eax - mov edx,ted_tex - @@: - call ted_iterat_next - cmp edx,ted_tex_1 - jle @f - mov byte[edx+1],0 - jmp @b - @@: - - cmp ted_key_words_count,1 - jl .no_colors - mov edx,ted_tex - @@: - call ted_text_find_sel_color - cmp edx,ted_tex_1 - jg @b - - xor ax,ax - mov edx,ted_tex - .cycle0: - call ted_iterat_next - cmp edx,ted_tex_1 - jle .no_colors - mov al,byte[edx+1] - or al,al - jz .cycle0 - cmp ah,al - jne @f - mov byte[edx+1],0 ;᫨ﭨ 冷 ᫮ 梥 - @@: - shl ax,8 - jmp .cycle0 - .no_colors: - pop edx eax - ret - - -;input: -; edx = pointer to start symbol -; edi = pointer to tedit struct -;output: -; edx = pointer to next symbol -;description: -; 㭪 ᪠ 뤥 ᢥ祭 ᫮ -align 16 -proc ted_text_find_sel_color uses eax ebx ecx esi -locals - begPos dd ? ;砫쭠 - endPos dd ? ;筠 - find db ? ;0 - , 1 - , 2 - 䠩 - f_color db ? ; 梥 ᫮ -endl -;eax = word_n ⥪騩 () ஢塞 ᫮ ᯨ᪥ -;ebx = ࠧ 楫 -;ecx = l_pos ᫥ () 室饣 ᫮ ᯨ᪥ -;esi = ࠧ 楫, ஢塞 ᨬ ᫮ - mov dword[begPos],1 - mov dword[endPos],1 - mov byte[find],0 - mov byte[f_color],1 - .cycle0: - call ted_iterat_next - cmp edx,ted_tex_1 - jle .cycle0end - - movzx eax,byte[edx] - shl eax,2 ;eax*=4 - add eax,ted_arr_key_pos - mov eax,[eax] - cmp eax,0 - jl .cycle0 ;if( (word_n=ted_arr_key_pos[(unsigned char)tex[i].c])>-1 ){ - - mov ecx,eax - ;while(l_posword_n && Col[l_pos-1].Text[pos]!=tex[i].c) - @@: - cmp ecx,eax - jle @f - dec ecx - ColToIndexOffset ecx,ebx - inc ecx - ;cmp byte[ebx+esi],byte[edx] - mov bl,byte[ebx+esi] - cmp bl,byte[edx] - je @f - dec ecx - jmp @b - @@: - - ColToIndexOffset eax,ebx - cmp byte[ebx+esi],0 - jne .if_0 ;if(Col[word_n].Text[pos]==0){ - mov [endPos],edx ;eP=i; - ColToIndexOffset eax,ebx - mov bl,[ebx+MAX_COLOR_WORD_LEN+7] - mov [f_color],bl ;f_color=Col[word_n].color; - - mov byte[find],1 - ColToIndexOffset eax,ebx ;... ebx = Col[word_n] - mov bl,[ebx+MAX_COLOR_WORD_LEN+4] - cmp bl,0 ;if(Col[word_n].wwo) - je .if_2n - push edx - mov edx,[begPos] - call ted_iterat_perv - - btr bx,0 ;1-1 - jae @f ;if(Col[word_n].wwo&1) - ;u1= !(isalnum(cont_s)||cont_s=='_') - call isalnum - jae @f - mov byte[find],0 - jmp .if_4e - @@: - - btr bx,3 ;4-1 - jae .if_4e ;if(Col[word_n].wwo&8) - ;u1= !isalpha(cont_s); - call isalpha - jae .if_4e - mov byte[find],0 - .if_4e: - - mov edx,[endPos] - ;call ted_iterat_next - - btr bx,1 ;2-1 - jae @f ;if(Col[word_n].wwo&2) - ;u1= !(isalnum(cont_s)||cont_s=='_') - call isalnum - jae @f - mov byte[find],0 - jmp .if_6e - @@: - - btr bx,4 ;5-1 - jae .if_6e ;if(Col[word_n].wwo&16) - ;u1= !isalpha(cont_s); - call isalpha - jae .if_6e - mov byte[find],0 - .if_6e: - - btr bx,2 ;3-1 - jae .if_7e ;if(Col[word_n].wwo&4) - ColToIndexOffset eax,ebx - mov bx,word[ebx+MAX_COLOR_WORD_LEN+5] - call ted_iterat_next_pos_char - cmp edx,ted_tex_1 - jg @f - ;᫨ 諨 䠩 諨 ᨬ ࠧ⪨ - call ted_iterat_perv - mov byte[find],2 - @@: - mov dword[endPos],edx - .if_7e: - - pop edx - .if_2n: -;if(i!=1){ // 㬥 -; cont_s=tex[eP].c; -; if(Col[word_n].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_'); // 㪢.-. ᨬ -; if(u2 && Col[word_n].wwo&16) u2= !isalpha(cont_s); // . ᨬ -; if(Col[word_n].wwo&4) eP=ted_iterat_next_pos_char(eP,Col[word_n].endc); - - cmp eax,ecx - je .wh_2e ;if(word_n==l_pos) break; // do double - ᫨ ᫮ 筮 ᫥ - .if_0: - - cmp edx,ted_tex_1 - jle .wh_2e ;if(i==1) break; - - ;while(l_pos>word_n && Col[word_n].Text[pos]!=tex[i].c) - .wh_4b: - cmp ecx,eax - jle .wh_4e - ColToIndexOffset eax,ebx - ;cmp byte[ebx+esi],byte[edx] - mov bl,byte[ebx+esi] - cmp bl,byte[edx] - je .wh_4e - inc eax - jmp .wh_4b - .wh_4e: - - cmp eax,ecx - je .wh_2e;if(word_n==l_pos) break; - inc esi ;pos++; - jmp .wh_2b - .wh_2e: - - cmp byte[find],0 ;if(fnd)break; - jne .cycle0end - mov edx,[begPos];i=bP; - jmp .cycle0 - .cycle0end: - - cmp byte[find],0 - je .if_1e ;if(fnd){ // 뤥 ⥪ - ;if(!mode_sf1 || (mode_sf1 && strlen(Col[word_n].f1->c_str())>0)){ - mov eax,[begPos] - mov bl,[f_color] - mov [eax+1],bl ;tex[bP].col=f_color; - mov eax,[endPos] - mov byte[eax+1],0xff ;tex[eP].col=255; - cmp byte[find],2 - je .if_1e - ;return ItPoPerv(eP); // 頥 宦 - mov edx,[endPos] - call ted_get_text_perv_pos - jmp @f - .if_1e: - mov edx,ted_tex - @@: - - ret -endp - -;input: -; edx = pointer to char (byte) -;output: -; cf=1 if symbol is... -align 16 -tab_all_num db 0,0,0,0,0,0,0xff,11b,11111110b,0xff,0xff,10000111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0;,0,0,0,0,0,0,0,0 - tab_alpha_0,0,0,0,0,0,0,0 -tab_alpha db 0,0,0,0,0,0,0,0,11111110b,0xff,0xff,10000111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - -;output: -; cf=1 ᫨ [edx] 㪢, '_' -align 16 -isalnum: - push eax ebx - movzx eax,byte[edx] ;al=offset - shr eax,3 - lea ebx,[tab_all_num] - add ebx,eax - movzx ax,byte[edx] ;al=bit - and ax,111b - bt word[ebx],ax - pop ebx eax - ret - -;output: -; cf=1 ᫨ [edx] 㪢 '_' -align 16 -isalpha: - push eax ebx - movzx eax,byte[edx] ;al=offset - shr eax,3 - lea ebx,[tab_alpha] - add ebx,eax - movzx ax,byte[edx] ;al=bit - and ax,111b - bt word[ebx],ax - pop ebx eax - ret - -align 16 -proc ted_show_help_f1 uses eax edx edi, edit:dword - mov edi,[edit] - - call ted_get_pos_by_cursor - push edx - call ted_iterat_next_color_tag - mov eax,edx - pop edx - call ted_iterat_perv_color_tag - - cmp eax,ted_tex - jle @f - cmp edx,ted_tex_1 - jle @f - stdcall ted_find_help_id,eax - @@: - ;call ted_draw_main_cursor - call ted_draw_help_f1 - ret -endp - -;input: -; edx = position begin 'symbol' struct -; edi = pointer to tedit struct -; end_pos = position end 'symbol' struct -align 16 -proc ted_find_help_id uses ebx ecx, end_pos:dword -; ecx = word_n -; ebx = l_pos - mov ted_help_id,-1 - - movzx ebx,byte[edx] - shl ebx,2 ;ebx*=4 - add ebx,ted_arr_key_pos - mov ecx,[ebx] - cmp ecx,0 - jl .if_0e ;if( (word_n=ted_arr_key_pos[(unsigned char)tf[0]])>-1 ){ - push esi eax - mov ebx,ecx ;l_pos=word_n; - ColToIndexOffset ecx,esi - push cx - mov cl,[esi] - @@: - cmp ebx,ted_key_words_count ;while(l_posword_n - jle .wh_0e - dec ebx - ColToIndexOffset ebx,eax - inc ebx - cmp byte[eax+esi],dl ;&& Col[l_pos-1].Text[pos]!=tf[i]) - je .wh_0e - dec ebx ;l_pos--; - jmp .wh_0b - .wh_0e: - - .wh_1b: - cmp ebx,ecx ;while(l_pos>word_n - jle .wh_1e - ColToIndexOffset ecx,eax - cmp byte[eax+esi],dl - je .wh_1e - inc ecx ;word_n++; - jmp .wh_1b - .wh_1e: - pop dx - - cmp ecx,ebx ;if(word_n==l_pos) break; - je @f - call ted_iterat_next ;pos++; - cmp edx,[end_pos] ;for(...;i y0,y1 - add ecx,ted_rec_t - mov edx,ted_cur_y - imul edx,ted_rec_h - add ecx,edx - shl ecx,16 - add ecx,ted_rec_h - - mov edx,ted_color_wnd_work - call ted_sel_normalize - - mov esi,ted_scr_w - mov eax,[esi+sb_offs_position] - sub ted_seln_y0,eax - sub ted_seln_y1,eax - - mov eax,ted_cur_y - cmp eax,ted_seln_y0 - jl .no_cur_sel - cmp eax,ted_seln_y1 - jg .no_cur_sel - mov edx,ted_color_select ;塞 梥 䮭 梥 뤥 - mov esi,ted_scr_h - cmp eax,ted_seln_y0 - jne @f - mov eax,ted_cur_x - add eax,[esi+sb_offs_position] - cmp eax,ted_seln_x0 - jge @f - mov edx,ted_color_wnd_work - @@: - mov eax,ted_cur_y - cmp eax,ted_seln_y1 - jne .no_cur_sel - mov eax,ted_cur_x - add eax,[esi+sb_offs_position] - cmp eax,ted_seln_x1 - jl .no_cur_sel - mov edx,ted_color_wnd_work - .no_cur_sel: - mcall SF_DRAW_RECT - - call ted_get_pos_by_cursor ;६ ᨬ - cmp ted_gp_opt,2 - jne @f - mov esi,1 - ror ecx,16 - mov bx,cx - add ebx,0x10001 - call ted_get_symb_color - call ted_convert_invis_symb - mcall SF_DRAW_TEXT ;ᮢ ᨬ - @@: -popad - ret -endp - -;input: -; edx -> pointer to text -; edi -> 㪠⥫ tedit -;output: -; ecx = color -; if ted_mode_color=0 then ecx=ted_color_wnd_text -align 16 -ted_get_symb_color: - mov ecx,ted_color_wnd_text ; 梥 ⥪ 㬮砭 - - push eax edx - cmp ted_mode_color,0 - je .exit - jmp .on_first - @@: - call ted_iterat_perv - cmp edx,ted_tex_1 - jle .exit - .on_first: - movzx eax,byte[edx+1] - or eax,eax ;᫨ al=0 梥 - jz @b - - cmp eax,ted_colors_text_count - jge .exit - - mov ecx,ted_text_colors ;ਡ塞 ᬥ饭 1- 梥 - lea ecx,[ecx+4*eax] - mov ecx,[ecx] ;⠭ ⥪騩 梥 ⥪ ᬥ饭 - .exit: - or ecx,ted_font_size - pop edx eax - ret - -;input: -; edx = pointer to text -; edi = pointer to tedit struct -;description: -; 㭪 ८ࠧ ᨬ ⠥ ࠭ -align 16 -ted_convert_invis_symb: - cmp ted_mode_invis,1 - jne .else - cmp byte[edx],9 - jne @f - lea edx,[ted_symbol_tab] - jmp .end_f -align 4 - @@: - cmp byte[edx],13 - jne @f - mov edx,edi - add edx,ted_offs_symbol_new_line - @@: - jmp .end_f -align 4 - .else: - cmp byte[edx],9 - je @f - cmp byte[edx],13 - jne .end_f - @@: - lea edx,[ted_symbol_space] - .end_f: - ret - -;input: -; edi = pointer to tedit struct -align 16 -ted_scroll_set_redraw: - push eax - mov eax,ted_scr_w - mov dword[eax+sb_offs_redraw],1 - mov eax,ted_scr_h - mov dword[eax+sb_offs_redraw],1 - pop eax - ret - -align 16 -proc ted_draw, edit:dword - locals - line_num dd ? - endl - pushad - mov edi,[edit] - - mov eax,SF_DRAW_TEXT - mov ecx,ted_text_colors - mov ecx,[ecx] - - mov ebx,ted_wnd_l - add ebx,ted_rec_l - shl ebx,16 - add ebx,ted_wnd_t - add ebx,ted_rec_t - add ebx,0x10001 ;塞 ࠢ 㪢 業 - - call ted_sel_normalize ;need before draw select - mov esi,ted_scr_w - mov esi,[esi+sb_offs_position] - mov [line_num],esi - - stdcall ted_clear_line_before_draw, edi,ebx,1,esi - call ted_get_first_visible_pos - or edx,edx - jz .no_draw_text - mov esi,1 ; 뢮 ⥪ 1- ᨬ - @@: - call ted_iterat_next - cmp edx,ted_tex_1 - jle .no_draw_text - - ; *** 梥⮢ ࠧ⪠ - cmp ted_mode_color,0 - je .no_col_change - cmp byte[edx+1],0 - je .no_col_change - call ted_get_symb_color - .no_col_change: - - cmp byte[edx],13 - jne .no_13 - cmp ted_mode_invis,1 - jne .no_invis - push edx - mov edx,edi - add edx,ted_offs_symbol_new_line - int 0x40 - pop edx - .no_invis: - add ebx,ted_rec_h - ;optimized output \/ - mov eax,ted_wnd_h - add eax,ted_wnd_t - cmp bx,ax - jg .no_draw_text - mov eax,SF_DRAW_TEXT - ;optimized output /\ - and ebx,0xffff - ror ebx,16 - add ebx,ted_wnd_l - add ebx,ted_rec_l - inc ebx - ror ebx,16 - inc dword[line_num] ;increment line number - stdcall ted_clear_line_before_draw,edi,ebx,1,dword[line_num] - call ted_opt_draw_line_left - jmp @b -align 4 - .no_13: - - int 0x40 - ror ebx,16 - add ebx,ted_rec_w - mov esi,ted_wnd_l - add esi,ted_wnd_w - cmp bx,si - jl .no_opt - call ted_opt_draw_line_right - .no_opt: - mov si,1 - ror ebx,16 - jmp @b - .no_draw_text: - - inc dword[line_num] - stdcall ted_clear_line_before_draw,edi,ebx,0,dword[line_num] - call ted_draw_line_numbers - call ted_draw_main_cursor - -;--------------------------------------------- -; set all_redraw flag for draw all ScrollBar -; In some cases it is necessity to draw only the area -; of moving of a "runner", for acceleration of output - -; in this case the flag needs to be reset to 0 (zero). - mov eax,ted_scr_h - mov esi,ted_scr_w - mov dword[eax+sb_offs_all_redraw],1 - mov dword[esi+sb_offs_all_redraw],1 - -; ᮢ ப⪨ - stdcall scroll_bar_horizontal.draw,eax ;[scrollbar_hor_draw] - stdcall scroll_bar_vertical.draw,esi ;[scrollbar_ver_draw] -; reset all_redraw flag - mov dword[eax+sb_offs_all_redraw],0 - mov dword[esi+sb_offs_all_redraw],0 -;--------------------------------------------- - - ;left-bottom square - mov ebx,ted_wnd_l - shl ebx,16 - add ebx,ted_rec_l - mov ecx,ted_wnd_t - add ecx,ted_wnd_h - shl ecx,16 - mov cx,word[eax+sb_offs_size_y] - inc cx - mcall SF_DRAW_RECT,,,ted_color_wnd_capt ;[sc.work] - - ;right-bottom square - mov ebx,ted_wnd_l - add ebx,ted_wnd_w - shl ebx,16 - mov bx,word[esi+sb_offs_size_x] - inc bx - int 0x40 - - cmp ted_fun_draw_panels,0 - je @f - stdcall ted_fun_draw_panels, edi - @@: - popad - ret -endp - -;input: -; edi = pointer to tedit struct -align 16 -proc ted_draw_main_cursor -pushad - mov eax,SF_DRAW_RECT ;draw cursor - mov ecx,ted_wnd_t ;calc rect -> y0,y1 - add ecx,ted_rec_t - mov edx,ted_cur_y - imul edx,ted_rec_h - add ecx,edx - - shl ecx,16 - add ecx,ted_rec_h - - mov ebx,ted_wnd_l ;calc rect -> x0,x1 - add ebx,ted_rec_l - mov edx,ted_cur_x - imul edx,ted_rec_w - add ebx,edx - shl ebx,16 - add ebx,ted_rec_w - cmp ted_cur_ins,1 ;஢ઠ ० ࠡ ( ⠢) - jne @f - shr bx,2 ;㬥蠥 ਭ - @@: - - mov edx,ted_color_cursor - int 0x40 ;뢮 - - call ted_get_pos_by_cursor - cmp ted_gp_opt,2 - jne @f - mov esi,1 - ror ecx,16 - mov bx,cx - add ebx,0x10001 - mov ecx,ted_color_cur_text - or ecx,ted_font_size - call ted_convert_invis_symb - mcall SF_DRAW_TEXT - @@: - - mov ebx,ted_wnd_l - add ebx,ted_rec_l - shl ebx,16 - add ebx,ted_wnd_t - add ebx,3 - mov ecx,ted_color_wnd_bord - or ecx,0x80000000 - lea edx,[txtRow] - mcall SF_DRAW_TEXT ;뢮 'ப' - - add ebx,0x500000 - lea edx,[txtCol] - int 0x40 ;뢮 '' - - cmp ted_tim_undo,0 - je @f - add ebx,0x500000 - lea edx,[txtOtm] - int 0x40 - sub ebx,0x500000 - @@: - - call ted_draw_buffer - call ted_draw_help_f1 - - mov eax,47 ;draw cursor coords - mov esi,ted_color_wnd_bord - or esi,0x40000000 - - mov edx,ebx - ror edx,16 - sub edx,35 - ror edx,16 - ;add edx,3 - mov ebx,0x40000 ;Row=... - mov ecx,ted_scr_w - mov ecx,[ecx+sb_offs_position] - add ecx,ted_cur_y - inc ecx - -push edi - mov edi,ted_color_wnd_work - int 0x40 ;뢮 ᫠ ⥪饩 ப -pop edi - - ;mov ebx,0x40000 ;Col=... - mov ecx,ted_scr_h - mov ecx,[ecx+sb_offs_position] - add ecx,ted_cur_x - inc ecx - add edx,0x500000 -push edi - mov edi,ted_color_wnd_work - int 0x40 ;뢮 ᫠ -pop edi - - cmp ted_tim_undo,0 - je @f - mov ecx,ted_tim_undo - add edx,0x500000 - mov edi,ted_color_wnd_work ;⨬ ॣ edi, 㭪樨 㦥 - int 0x40 ;뢮 ᫠ ⬥ ⢨ - @@: - -popad - ret -endp - -;input: -; edi = pointer to tedit struct -align 16 -proc ted_draw_buffer - pushad - - mov eax,ted_buffer - cmp dword[eax],1 ;ᬮਬ ࠧ - jl @f - mov ebx,ted_rec_l - add bx,300 - cmp ebx,ted_wnd_w ;ࠢ न 뢮 ⥪ - jge @f ; - - add ebx,ted_wnd_l - shl ebx,16 - add ebx,ted_wnd_t - add ebx,3 - mov ecx,ted_color_wnd_bord - or ecx,0x40000000 - - mov edx,ted_buffer - add edx,12 - mov esi,edx - mov edi,ted_color_wnd_work ;edi - destroy not pointer to tedit - call tl_strlen - ;cmp eax,0 ; - ;je @f - cmp eax,20 - jle .crop_buf - mov eax,20 ;१ 20 ᨬ - .crop_buf: - mov esi,eax - mcall SF_DRAW_TEXT ;뢮 ᮤন - - sub ebx,50 shl 16 - lea edx,[txtBuf] - mov esi,edx - call tl_strlen - mov esi,eax - xor ecx,0x40000000 ;㡨ࠥ 梥 䮭 - mcall SF_DRAW_TEXT ;뢮 - @@: - popad - ret -endp - -;input: -; edi = pointer to tedit struct -align 16 -proc ted_draw_help_f1 - pushad - cmp ted_rec_t,13 ;쭠 ᮢ ࠢ - jle @f - ;clear place before draw help - mov ebx,ted_wnd_l - add ebx,ted_rec_l - shl ebx,16 - add ebx,ted_wnd_w - sub ebx,ted_rec_l - mov ecx,ted_wnd_t - add ecx,13 - shl ecx,16 - add ecx,9 ;9 - 0- , ⠢ ted_rec_h ࠭ - mcall SF_DRAW_RECT,,,ted_color_wnd_capt - - cmp ted_help_id,-1 - je @f - mov eax,ted_help_id - ColToIndexOffset eax,edx - - ;SetCoordinates - mov ebx,ted_wnd_l - add ebx,ted_rec_l - shl ebx,16 - add ebx,ted_wnd_t - add ebx,13 ;=3+10 - - ;SetTextColor - movzx eax,byte[edx+MAX_COLOR_WORD_LEN+7] - shl eax,2 - mov ecx,ted_text_colors - add ecx,eax - mov ecx,[ecx] - or ecx,0xc0000000 ;SetTextStyles - mov esi,edi - mcall SF_DRAW_TEXT,,,,,ted_color_wnd_work - mov edi,esi - - mov esi,edx - call tl_strlen - - ;*** draw help string *** - mov ecx,ted_color_wnd_bord - or ecx,0x80000000 - mov edx,[edx+MAX_COLOR_WORD_LEN] - or edx,edx - jz @f - add edx,ted_help_text_f1 - inc eax - imul eax,6 ;ਭ ᨬ . - shl eax,16 - add ebx,eax - mcall SF_DRAW_TEXT - @@: - popad - ret -endp - -;input: -; edi = pointer to tedit struct -align 16 -proc ted_draw_line_numbers -pushad - ;top panel with caption - mov ebx,ted_wnd_l - ;add ebx,ted_rec_l - shl ebx,16 - add ebx,ted_wnd_w - ;sub ebx,ted_rec_l - mov edx,ted_color_wnd_work - mov ecx,ted_wnd_t - shl ecx,16 - add ecx,ted_rec_t - mov edx,ted_color_wnd_capt - mcall SF_DRAW_RECT - - ;line numbers - mov ebx,0x40000 ;format - mov ecx,ted_scr_w - mov ecx,[ecx+sb_offs_position] - inc ecx - mov edx,3 - add edx,ted_wnd_l - rol edx,16 - add edx,ted_wnd_t - add edx,ted_rec_t - @@: - -push ebx ecx edx - ;left panel with numbers - mov ebx,ted_wnd_l - shl ebx,16 - add ebx,ted_rec_l - mov ecx,ted_rec_h - rol ecx,16 - mov cx,dx - rol ecx,16 - mov edx,ted_color_wnd_capt - mcall SF_DRAW_RECT ;㥬 אַ㣮쭨 ஬ ப -pop edx ecx ebx - - mov esi,ted_color_wnd_bord - mcall SF_DRAW_NUMBER ;㥬 ப - inc ecx - add edx,ted_rec_h - sub edx,ted_wnd_t - mov esi,edx - and esi,0xffff - cmp esi,ted_wnd_h - jge @f - add edx,ted_wnd_t - jmp @b -align 4 - @@: -popad - ret -endp - -;output: -; ah = symbol -align 16 -proc KeyConvertToASCII uses ebx, table:dword - mov ebx,[table] ;convert scan to ascii - shr ax,8 - add bx,ax ;? ebx,eax - mov ah,byte[ebx] - ret -endp - -align 16 -proc ted_draw_cur_line, edit:dword -pushad - mov edi,[edit] - - mov ebx,ted_wnd_l - add ebx,ted_rec_l - shl ebx,16 - mov eax,ted_cur_y - imul eax,ted_rec_h - mov bx,ax - add ebx,ted_wnd_t - add ebx,ted_rec_t ;ebx - न אַ㣮쭨 ⪨ - add ebx,0x10001 ;塞 ࠢ 㪢 業 - - call ted_sel_normalize ;need before draw select - mov ecx,ted_cur_y - mov eax,ted_scr_w - add ecx,[eax+sb_offs_position] - stdcall ted_clear_line_before_draw,edi,ebx,1,ecx - - mov eax,ted_scr_h - mov esi,[eax+sb_offs_position] - call ted_get_pos_by_coords - - cmp ted_gp_opt,2 - jne .no_draw_text - call ted_get_symb_color - mov esi,1 ;draw 1 symbol - @@: - ;call ted_iterat_next - cmp edx,ted_tex_1 - jle .no_draw_text - - ; *** 梥⮢ ࠧ⪠ - cmp ted_mode_color,0 - je .no_col_change - cmp byte[edx+1],0 - je .no_col_change - call ted_get_symb_color - .no_col_change: - - mov eax,SF_DRAW_TEXT - cmp byte [edx],13 - jne .no_13 - cmp ted_mode_invis,1 - jne .no_draw_text - push edx - mov edx,edi - add edx,ted_offs_symbol_new_line - int 0x40 - pop edx - jmp .no_draw_text -align 4 - .no_13: - - int 0x40 - ror ebx,16 - add ebx,ted_rec_w - mov eax,ted_wnd_w - add eax,ted_wnd_l ;ax = x - cmp bx,ax - jge .no_draw_text ;Opt - ror ebx,16 - call ted_iterat_next - jmp @b -align 4 - .no_draw_text: - - call ted_draw_main_cursor -popad - ret -endp - -;input: -; clear_o - ᫨ =1 ப, =0 ப -align 16 -proc ted_clear_line_before_draw, edit:dword, coords:dword, clear_o:dword, numb_lin:dword - pushad - mov edi,[edit] - mov ebx,[coords] ;ebx = x*2^16+y coords to left up point clear line - mov esi,[numb_lin] ;esi - number text line - - sub ebx,0x10001 ;⭨ ࠢ 㪢 業 - cmp dword[clear_o],0 - jne @f - add ebx,ted_rec_h - ror ebx,16 - xor bx,bx - add ebx,ted_wnd_l - add ebx,ted_rec_l ;bx = ted_wnd_l+ted_rec_l - ror ebx,16 - @@: - - mov eax,ted_wnd_h - add eax,ted_wnd_t - cmp ax,bx - jl .no_clear - sub ax,bx - - mov cx,bx - shl ecx,16 - - xor bx,bx - add ebx,ted_wnd_w - sub ebx,ted_rec_l - xor cx,cx - add ecx,ted_rec_h - mov edx,ted_color_wnd_work - - cmp dword[clear_o],0 - je .pusto - cmp ax,cx - jge @f - .pusto: - mov cx,ax - jmp .no_select ;᫨ ⪠ , ᥣ 䮭 梥⮬ - @@: - - call ted_is_select - or al,al - jz .no_select - cmp ted_seln_y0,esi - jg .no_select - cmp ted_seln_y1,esi - jl .no_select - mov edx,ted_color_select ;draw selected line - .no_select: - - mcall SF_DRAW_RECT ;᪠ ப 梥⮬ 䮭 梥⮬ 뤥 - - call ted_is_select - or al,al - jz .no_clear - - mov al,SF_DRAW_RECT - xor cx,cx - add ecx,ted_rec_h - cmp ted_seln_y0,esi - jne @f - push bx esi - mov edx,ted_seln_x0 ; (ࠥ ᫥) - mov esi,ted_scr_h - cmp edx,[esi+sb_offs_position] - jle .in_wnd - sub edx,[esi+sb_offs_position] - imul edx,ted_rec_w - mov bx,dx - jmp .no_wnd - .in_wnd: - xor bx,bx - .no_wnd: - mov edx,ted_color_wnd_work - int 0x40 - pop esi bx - @@: - cmp ted_seln_y1,esi - jne @f - ;push esi - ;᫨ 뤥 䠩 ᤥ 室, ⮣ 㦭 jmp .no_select - mov edx,ted_seln_x1 ; (ࠥ ࠢ) - mov esi,ted_scr_h - cmp edx,[esi+sb_offs_position] - jle .in_wnd2 - sub edx,[esi+sb_offs_position] - imul edx,ted_rec_w - sub bx,dx - shl edx,16 - add ebx,edx - .in_wnd2: - mov edx,ted_color_wnd_work - int 0x40 - ;pop esi - @@: - - .no_clear: - popad - ret -endp - -;input: -; edi = pointer to tedit struct -;output: -; ecx = 梥 ᨬ -; edx = pointer to symbol -; edx = 0 if text not in screen -align 16 -ted_get_first_visible_pos: - push eax ecx - mov eax,ted_scr_w - mov edx,ted_tex - xor ecx,ecx - @@: - cmp ecx,[eax+sb_offs_position] - je @f - call ted_iterat_next - cmp edx,ted_tex_1 - jle @f - cmp byte[edx],13 - jne @b - inc ecx - jmp @b -align 4 - @@: - - cmp ecx,[eax+sb_offs_position] - je @f - xor edx,edx - @@: - cmp ecx,[eax+sb_offs_max_area] - jle @f - mov [eax+sb_offs_max_area],ecx - @@: - pop ecx eax - call ted_opt_draw_line_left - ret - -;input: -; edx = pointer to symbol -; edi = pointer to tedit struct -;output: -; ecx = 梥 ᨬ -; edx = 㪠⥫ ᨬ -;description: -; 㭪 㦭 ⨬樨 뢮 ⥪ -align 16 -proc ted_opt_draw_line_left uses ebx - mov ebx,ted_scr_h - mov ebx,[ebx+sb_offs_position] - or ebx,ebx - jz .ret_f - push eax - mov eax,edx - - cmp edx,ted_tex - jne @f - call ted_iterat_next - jmp .beg_cycle - @@: - - or ebx,ebx - jz @f - - cmp byte[edx],13 - jne @f - call ted_iterat_next - .beg_cycle: - @@: - cmp edx,ted_tex_1 - jle @f - cmp byte[edx],13 - je @f - or ebx,ebx - jz @f -;-------------------------------------- -;eax 㤥 -movzx eax,byte[edx+1] -or eax,eax -jz .no_color -cmp eax,ted_colors_text_count -jge .no_color - movzx ecx,byte[edx+1] - shl ecx,2 - add ecx,ted_text_colors - mov ecx,[ecx] -.no_color: -;-------------------------------------- - mov eax,edx - call ted_iterat_next - dec ebx - jmp @b -align 4 - @@: - mov edx,eax - pop eax - .ret_f: - call ted_get_symb_color - ret -endp - -;input: -; edx = pointer to symbol -; edi = pointer to tedit struct -;output: -; ecx = symbol color -; edx = pointer to 13 symbol -;description: -; 㭪 㦭 ⨬樨 뢮 ⥪ -align 16 -proc ted_opt_draw_line_right uses eax - mov eax,edx - @@: - cmp edx,ted_tex_1 - jle @f - cmp byte[edx],13 - je @f - mov eax,edx - call ted_iterat_next - jmp @b - @@: - mov edx,eax ;perv sumbol - call ted_get_symb_color - ret -endp - -align 16 -proc ted_mouse, edit:dword - pushad - mov edi,[edit] - - ;ࠡ뢠 ஫ - mov edx,ted_scr_h - mov ecx,ted_scr_w - - cmp word[edx+sb_offs_delta2],0 - jne .horizontal - - mov eax,[ecx+sb_offs_max_area] - cmp eax,[ecx+sb_offs_cur_area] - jbe .horizontal - ; mouse event for Vertical ScrollBar - stdcall scroll_bar_vertical.mouse,ecx ;[scrollbar_ver_mouse] - cmp dword[ecx+sb_offs_redraw],0 - je @f - mov dword[ecx+sb_offs_redraw],0 - stdcall ted_draw,edi - jmp .no_in_wnd - @@: - cmp word[ecx+sb_offs_delta2],0 - jne .no_in_wnd - .horizontal: - mov eax,[edx+sb_offs_max_area] - cmp eax,[edx+sb_offs_cur_area] - jbe .other - ; mouse event for Horizontal ScrollBar - stdcall scroll_bar_horizontal.mouse,edx ;[scrollbar_hor_mouse] - cmp dword[edx+sb_offs_redraw],0 - je .other - mov dword[edx+sb_offs_redraw],0 - stdcall ted_draw,edi - jmp .no_in_wnd - .other: - cmp word[ecx+sb_offs_delta2],0 - jne .no_in_wnd - cmp word[edx+sb_offs_delta2],0 - jne .no_in_wnd - - ;ࠡ뢠 । - mcall SF_MOUSE_GET,SSF_BUTTON - cmp al,1 - jne @f - mcall SF_MOUSE_GET,SSF_WINDOW_POSITION - mov ebx,ted_wnd_t - add ebx,ted_rec_t - cmp ax,bx - jl @f ;y_mousey_wnd - - mov ebx,ted_wnd_l - add ebx,ted_rec_l - mov ecx,eax - shr ecx,16 - cmp cx,bx - jl @f ;x_mousex_wnd - - call ted_draw_cursor_sumb - call ted_wnd_main_click - jmp .no_in_wnd - @@: - mov edx,ted_el_focus - cmp [edx],edi - jne @f - call ted_wnd_main_mouse_scroll ;ᬮਬ ப - @@: - cmp ted_drag_m,0 - je .no_in_wnd - mov ted_drag_m,0 - stdcall ted_draw,edi - cmp ted_fun_draw_panel_buttons,0 - je .no_in_wnd - call ted_fun_draw_panel_buttons - .no_in_wnd: - popad - ret -endp - -;input: -; eax -> (x,y) -; edi -> 㪠⥫ tedit -;description: -; 㭪 뢥 ⨨ ஬ । -align 16 -ted_wnd_main_click: - push ebx ecx edx - mov ebx,ted_el_focus - mov [ebx],edi ;⠢ 䮪 - - push eax - shr eax,16 - sub eax,ted_wnd_l - sub eax,ted_rec_l - - xor edx,edx - mov ecx,ted_rec_w - div cx - ;inc eax - mov ebx,ted_scr_h - cmp eax,[ebx+sb_offs_cur_area] - jle @f - mov eax,[ebx+sb_offs_cur_area] - @@: - ;dec eax - mov ted_cur_x,eax - pop eax - - push eax - and eax,0xffff - sub eax,ted_wnd_t - sub eax,ted_rec_t - - xor edx,edx - mov ecx,ted_rec_h - div cx - inc eax - mov ebx,ted_scr_w - cmp eax,[ebx+sb_offs_cur_area] - jle @f - mov eax,[ebx+sb_offs_cur_area] - @@: - dec eax - mov ted_cur_y,eax - pop eax - - cmp ted_drag_m,0 - je @f - call ted_sel_move - jmp .sel_move - @@: - mov ted_drag_m,1 - call ted_sel_start - .sel_move: - pop edx ecx ebx - ret - -;input: -; edi = pointer to tedit struct -align 16 -ted_wnd_main_mouse_scroll: - push eax ebx ecx - mcall SF_MOUSE_GET,SSF_SCROLL_DATA - or ax,ax - jz .no_scroll - mov ecx,ted_scr_w - movsx eax,ax - lea eax,[eax+eax*2] ;㬭 3 (᫮ ப ப⪨ ) - add eax,[ecx+sb_offs_position] - mov ebx,[ecx+sb_offs_max_area] - shl ebx,1 - sub ebx,[ecx+sb_offs_cur_area] ;⭨ - shr ebx,1 - cmp eax,ebx - jae .no_scroll - mov ebx,ted_cur_y ; - sub ebx,eax ;- ஫ - add ebx,[ecx+sb_offs_position] ;+ ஫ - bt ebx,31 - jnc @f - xor ebx,ebx ;᫨ ⠫ , ⠢ ப - @@: - inc ebx - cmp ebx,[ecx+sb_offs_cur_area] - jle @f - mov ebx,[ecx+sb_offs_cur_area] ;᫨ ⠫ , ⠢ ப - @@: - dec ebx - mov ted_cur_y,ebx - mov [ecx+sb_offs_position],eax - stdcall ted_draw,edi - .no_scroll: - pop ecx ebx eax - ret - -align 16 -proc ted_save_file, edit:dword, file:dword, f_name:dword -pushad - mov edi,[edit] - - stdcall ted_can_save,edi - ;or al,al - ;jz .no_save - - mov ecx,ted_max_chars - invoke mem.alloc,ecx - push eax ; 㪠⥫ 뤥 - - mov edx,ted_tex - xor ecx,ecx - @@: - call ted_iterat_next - cmp edx,ted_tex_1 - jle @f ;edx = ted_tex or edx = ted_tex+sizeof.symbol - mov bl,[edx] - mov byte[eax],bl - inc eax - inc ecx - jmp @b -align 4 - @@: - - or ecx,ecx - jz @f - mov ebx,[file] - pop eax ;뢠 㪠⥫ 뤥 - mov [ebx+16],eax - push eax ;⭮ 㪠⥫ 뤥 - mov dword[ebx], SSF_CREATE_FILE - mov dword[ebx+4], 0 - mov dword[ebx+8], 0 - mov [ebx+12], ecx - mov byte[ebx+20], 0 - push dword[f_name] - pop dword[ebx+21] - mcall SF_FILE - - mov ted_err_save,al - - or eax,eax - jz .no_msg - cmp ax,10 - jl .zifra_0_9 - mov al,'?' - sub ax,48 - .zifra_0_9: - add ax,48 - cmp ted_fun_save_err,0 - je @f - call ted_fun_save_err - jmp @f - .no_msg: - m2m ted_tim_ls,ted_tim_ch - @@: - - pop ecx ;뢠 㪠⥫ 뤥 - invoke mem.free,ecx - .no_save: -popad - ret -endp +; ⥬ ⥪ box_lib.obj +; TextEditor KolibriOS +; 䠩 ᫥ ࠧ 12.01.2021 IgorA +; ਬ GPL2 業 + +;input: +; edi = pointer to tedit struct +; reg = index +;output: +; reg = pointer to 'tex' struct +macro ConvertIndexToPointer reg { + imul reg,sizeof.symbol + add reg,ted_tex +} + +;--- out_reg = ted_key_words_data[ind_reg].Text[0] --- +macro ColToIndexOffset ind_reg,out_reg { + mov out_reg,ind_reg + imul out_reg,sizeof.TexColViv + add out_reg,ted_key_words_data +} + +TED_LINES_IN_NEW_FILE equ 30 ;᫮ ப 䠩 +MAX_COLOR_WORD_LEN equ 40 +;------------------------------------------------------------------------------ +struct TexSelect + x0 dd ? + y0 dd ? + x1 dd ? + y1 dd ? +ends + +struct TexColViv + Text rb MAX_COLOR_WORD_LEN ; ᫮ ᢥ⪨ + f1 dd 0 ; ࠢ ᫮ + flags db ? ; f1+4 䫠 ᯮ㥬 뤥 + endc db ? ; f1+5 ᨬ 뤥 (ᯮ flags&4) + escc db ? ; f1+6 ࠭騩 ᨬ (ᯮ flags&4) + color db ? ; f1+7 梥 +ends + +struct symbol + c db ? ; +0 ᨬ + col db ? ; +1 梥 + perv dd ? ; +2 + next dd ? ; +6 㪠⥫ + tc dd ? ; +10 ६. ᮧ + td dd ? ; +14 ६. 㤠 +ends +;------------------------------------------------------------------------------ + +ted_symbol_space db 32 ;ascii ஡, 뢠 㦥 +ted_symbol_tab db 26 ;ascii ५ ࠢ, ᯮ ᮢ ⠡樨 ० ᨬ + +if lang eq ru_RU + txtRow db 'ப',0 + txtCol db '',0 + txtOtm db '⬥',0 + txtBuf db ':',0 +else ; Default to en_US + txtRow db 'Rows',0 + txtCol db 'Cols',0 + txtOtm db 'Undo',0 + txtBuf db 'Buffer:',0 +end if + +;EvChar - ⠡ 䨫஢ 塞 ᨬ, - 譨 +align 16 +EvChar db 0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + +KM_SHIFT equ 0x00010000 +KM_CTRL equ 0x00020000 +KM_ALT equ 0x00040000 +KM_NUMLOCK equ 0x00080000 + +; KEY CODES +KEY_F1 equ 0x0000003B +KEY_F2 equ 0x0000003C +KEY_F3 equ 0x0000003D + + + +align 16 +proc ted_init uses eax ecx edi, edit:dword + mov edi,[edit] + + mov ecx,sizeof.symbol + imul ecx,ted_max_chars + invoke mem.alloc,ecx ;뤥塞 + mov ted_tex,eax + mov ted_tex_1,eax + add ted_tex_1,sizeof.symbol + add eax,ecx + mov ted_tex_end,eax + + stdcall ted_clear, edi,1 + +;------------------------------------------------- + mov ecx,1024 ;1024 - ᨢ ted_arr_key_pos + add ecx,ted_syntax_file_size + invoke mem.alloc,ecx + mov ted_arr_key_pos,eax + add eax,1024 + mov ted_syntax_file,eax + + stdcall ted_init_scroll_bars,edi,3 + ret +endp + +MIN_W_SCRL_ARE equ 3 ;쭠 ⮡ࠦ . ஫ +MIN_H_SCRL_ARE equ 3 ;쭠 ⮡ࠦ ਧ. ஫ +;input: +; opt = 1 - 梥 ஫, 2 - ࠧ , +; 4 - ࠧ 㬥 +align 16 +proc ted_init_scroll_bars, edit:dword, opt:dword + pushad + mov edi,[edit] + mov esi,ted_scr_w + mov ebx,ted_scr_h + bt dword[opt],0 + jae @f + mov ecx,ted_color_wnd_work + mov dword[esi+sb_offs_bckg_col],ecx + mov dword[ebx+sb_offs_bckg_col],ecx + mov ecx,ted_color_wnd_capt + mov dword[esi+sb_offs_frnt_col],ecx + mov dword[ebx+sb_offs_frnt_col],ecx + mov ecx,ted_color_wnd_bord + mov dword[esi+sb_offs_line_col],ecx + mov dword[ebx+sb_offs_line_col],ecx + @@: + bt dword[opt],2 ; ࠧ 㬥 ? + jae .doc_resize + call ted_get_num_lines + cmp eax,TED_LINES_IN_NEW_FILE + jge @f + mov eax,TED_LINES_IN_NEW_FILE + @@: + mov dword[esi+sb_offs_max_area],eax + .doc_resize: + bt dword[opt],1 ; ࠧ ? + jae .no_size + mov edx,ted_wnd_l + add edx,ted_rec_l + mov word[ebx+sb_offs_start_x],dx ;⠢塞 ਧ. ஫ + mov eax,ted_wnd_h ;calculate lines in page + mov edx,ted_wnd_t + add edx,eax + mov word[ebx+sb_offs_start_y],dx ;⠢塞 孨 ਧ. ஫ + sub eax,ted_rec_t + xor edx,edx + mov ecx,ted_rec_h + div ecx + cmp eax,MIN_W_SCRL_ARE + jg @f + mov eax,MIN_W_SCRL_ARE + @@: + mov dword[esi+sb_offs_cur_area],eax + + mov eax,ted_wnd_w ;calculate cols in page + mov edx,ted_wnd_l ; + add edx,eax ;塞 ਭ + mov word[esi+sb_offs_start_x],dx ;⠢塞 . ஫ + mov edx,ted_wnd_t + mov word[esi+sb_offs_start_y],dx ;⠢塞 孨 . ஫ + mov edx,ted_wnd_h + mov word[esi+sb_offs_size_y],dx ;⠢塞 . ஫ + sub eax,ted_rec_l + mov word[ebx+sb_offs_size_x],ax ;⠢塞 ਭ ਧ. ஫ + xor edx,edx + mov ecx,ted_rec_w + div ecx + cmp eax,MIN_H_SCRL_ARE + jg @f + mov eax,MIN_H_SCRL_ARE + @@: + dec eax + mov dword[ebx+sb_offs_cur_area],eax ;⠭ ᫮ ᨬ, ࠭ ਧ. ஫ + .no_size: + popad + ret +endp + +align 16 +proc ted_delete uses edi, edit:dword + mov edi,[edit] + invoke mem.free,ted_tex + invoke mem.free,ted_arr_key_pos ;ted_syntax_file + ret +endp + + +;input: +; eax = key kodes +align 16 +proc ted_key, edit:dword, table:dword, control:dword + pushad + mov edi,[edit] + mov esi,ted_el_focus + cmp dword[esi],edi + jne .end_key_fun ; 䮪 室 㭪樨 + mov esi,dword[control] + + cmp ah,KEY_F1 ;[F1] + jne @f + stdcall ted_show_help_f1,edi + jmp .end_key_fun + @@: + cmp ah,KEY_F3 ;[F3] + jne @f + stdcall ted_but_find,edi,0 + jmp .end_key_fun + @@: + + test esi,KM_CTRL ;Ctrl+... + jz .key_Ctrl + ; *** 맮 譨 㭪権 ॡ /࠭/᪠/... + cmp ted_fun_on_key_ctrl_all,0 + je .end0 + xor al,al + cmp ah,24 ;Ctrl+O + jne @f + mov al,'O' + @@: + cmp ah,31 ;Ctrl+S + jne @f + mov al,'S' + @@: + cmp ah,33 ;Ctrl+F + jne @f + mov al,'F' + @@: + cmp ah,34 ;Ctrl+G + jne @f + mov al,'G' + @@: + cmp ah,35 ;Ctrl+H + jne @f + mov al,'H' + @@: + cmp ah,49 ;Ctrl+N + jne @f + mov al,'N' + @@: + or al,al + jz .end0 + and eax,0xff + test esi,KM_SHIFT + jz @f + or eax,0x100 + @@: + stdcall ted_fun_on_key_ctrl_all, eax + jmp .end_key_fun + .end0: + + ; *** 맮 ७ 㭪権 + cmp ah,30 ;Ctrl+A + jne @f + call ted_sel_all + @@: + cmp ah,44 ;Ctrl+Z + jne @f + stdcall ted_but_undo,edi + @@: + cmp ah,45 ;Ctrl+X + jne @f + stdcall ted_but_cut,edi + @@: + cmp ah,46 ;Ctrl+C + jne @f + stdcall ted_but_copy,edi + @@: + cmp ah,47 ;Ctrl+V + jne @f + stdcall ted_but_paste,edi + @@: + cmp ah,199 ;Ctrl+Home + jne @f + call ted_key_ctrl_home + @@: + cmp ah,207 ;Ctrl+End + jne @f + call ted_key_ctrl_end + @@: + jmp .end_key_fun + .key_Ctrl: + + test esi,KM_SHIFT ;Shift+... + jz .key_Shift + cmp ah,72 ;Shift+Up + jne @f + call ted_sel_key_up + @@: + cmp ah,75 ;Shift+Left + jne @f + call ted_sel_key_left + @@: + cmp ah,77 ;Shift+Right + jne @f + call ted_sel_key_right + @@: + cmp ah,80 ;Shift+Down + jne @f + call ted_sel_key_down + @@: + ;mov ted_drag_k,1 ;稭 뤥 + jmp .key_MoveCur + .key_Shift: +;------------------------------------------------- + cmp ah,72 ;178 ;Up + jne @f + call ted_draw_cursor_sumb + call ted_cur_move_up + cmp dl,8 + jne .no_red_0 + call ted_scroll_set_redraw + stdcall ted_draw,edi + jmp @f + .no_red_0: + call ted_sel_end + @@: + cmp ah,80 ;177 ;Down + jne @f + call ted_draw_cursor_sumb + call ted_cur_move_down + cmp dl,8 + jne .no_red_1 + call ted_scroll_set_redraw + stdcall ted_draw,edi + jmp @f + .no_red_1: + call ted_sel_end + @@: + cmp ah,75 ;176 ;Left + jne @f + call ted_draw_cursor_sumb + call ted_cur_move_left + cmp dl,8 + jne .no_red_2 + call ted_scroll_set_redraw + stdcall ted_draw,edi + jmp @f + .no_red_2: + call ted_sel_end + @@: + cmp ah,77 ;179 ;Right + jne @f + call ted_draw_cursor_sumb + call ted_cur_move_right + cmp dl,8 + jne .no_red_3 + call ted_scroll_set_redraw + stdcall ted_draw,edi + jmp @f + .no_red_3: + call ted_sel_end + @@: + cmp ah,71 ;180 ;Home + jne @f + call ted_draw_cursor_sumb + call ted_cur_move_x_first_char + cmp dl,8 + jne .no_red_4 + call ted_scroll_set_redraw + stdcall ted_draw,edi + jmp @f + .no_red_4: + call ted_sel_end + @@: + cmp ah,79 ;181 ;End + jne @f + call ted_draw_cursor_sumb + call ted_cur_move_x_last_char + cmp dl,8 + jne .no_red_5 + call ted_scroll_set_redraw + stdcall ted_draw,edi + jmp @f + .no_red_5: + call ted_sel_end + @@: + cmp ah,73 ;184 ;PageUp + jne @f + call ted_cur_move_page_up + cmp dl,0 + je @f + call ted_scroll_set_redraw + stdcall ted_draw,edi + mov ted_drag_k,0 ;稢 뤥 + @@: + cmp ah,81 ;183 ;PageDown + jne @f + call ted_cur_move_page_down + cmp dl,0 + je @f + call ted_scroll_set_redraw + stdcall ted_draw,edi + mov ted_drag_k,0 ;稢 뤥 + @@: +;------------------------------------------------- + .key_MoveCur: + + ; ய᪠ 㦥 , ᨬ + cmp ah,42 ;[L Shift] 㣨 + je .end_key_fun + cmp ah,54 ;[R Shift] 㣨 + je .end_key_fun + cmp ah,58 ;[Caps Lock] + je .end_key_fun + cmp ah,69 ;[Pause Break] + je .end_key_fun + cmp ah,120 ;[Fn] + je .end_key_fun + cmp ah,0x80 ;if key up + ja .end_key_fun + + cmp dword[table],0 + je @f + stdcall KeyConvertToASCII, [table] + @@: + + ;mov ted_drag_k,0 ;稢 뤥 + + lea edx,[EvChar] ;६ ⠡ ⨬묨 ᨬ + add dl,ah + jae @f + add edx,0x100 ;᫨ 뫮 ९ ᨬ + @@: + cmp byte[edx],1 + jne @f + mov ted_key_new,ah + call ted_set_undo + mov edx,ted_opt_ed_change_time+ted_opt_ed_move_cursor + stdcall ted_sel_text_del,edx + cmp al,1 + jne .del + mov edx,ted_opt_ed_move_cursor + .del: + cmp ted_cur_ins,1 + je .no_ins_mod + stdcall ted_text_del,edi,ted_opt_ed_change_time + mov edx,ted_opt_ed_move_cursor + .no_ins_mod: + mov ecx,edi + add ecx,ted_offs_key_new + stdcall ted_text_add,edi,ecx,1,edx ;塞 ᨬ + cmp ted_key_new,13 + jne .dr_m_win + ;᫨ ⠢ ᨬ ப + mov ecx,ted_scr_w + inc dword[ecx+sb_offs_max_area] ;㢥稢 ࠧ ⨪쭮 ஫ + mov edx,ted_cur_y + cmp edx,[ecx+sb_offs_cur_area] + jl .no_change + dec ted_cur_y ; ⠢塞 + inc dword[ecx+sb_offs_position] ;ᤢ 㭮 + .no_change: + stdcall ted_draw,edi + jmp .dr_cur_l + .dr_m_win: + stdcall ted_draw_cur_line,edi + .dr_cur_l: + cmp ted_fun_draw_panel_buttons,0 + je @f + call ted_fun_draw_panel_buttons + @@: + + cmp ah,8 ;[<-] + jne @f + call ted_set_undo + stdcall ted_sel_text_del,ted_opt_ed_change_time + cmp al,1 + je .del_one_b + stdcall ted_text_del,edi,ted_opt_ed_change_time+ted_opt_ed_move_cursor + .del_one_b: + stdcall ted_draw,edi + cmp ted_fun_draw_panel_buttons,0 + je .end_key_fun + call ted_fun_draw_panel_buttons + jmp .end_key_fun +align 4 + @@: + + cmp ah,182 ;Delete + jne @f + call ted_set_undo + stdcall ted_sel_text_del,ted_opt_ed_change_time + cmp al,1 + je .del_one_d + stdcall ted_text_del,edi,ted_opt_ed_change_time + .del_one_d: + stdcall ted_draw,edi + cmp ted_fun_draw_panel_buttons,0 + je .end_key_fun + call ted_fun_draw_panel_buttons + jmp .end_key_fun + @@: + + cmp ah,185 ;Ins + jne @f + call ted_draw_cursor_sumb + xor ted_cur_ins,1 + call ted_draw_main_cursor + @@: + + .end_key_fun: + popad + ret +endp + +;output: +; al = 1 - can save +align 16 +proc ted_can_save uses ecx edi, edit:dword + mov edi,[edit] + + mov ecx,ted_tim_ch + sub ecx,ted_tim_undo + mov al,1 + cmp ted_tim_ls,ecx + jne @f + dec al + @@: + ret +endp + +;input: +; edi = pointer to tedit struct +;output: +; al = 1 - selected +align 16 +proc ted_is_select uses ebx + xor al,al + cmp ted_drag_m,1 + je @f + inc al + mov ebx,ted_sel_x0 + cmp ebx,ted_sel_x1 + jne @f + mov ebx,ted_sel_y0 + cmp ebx,ted_sel_y1 + jne @f + xor al,al + @@: + ret +endp + +;input: +; edi = pointer to tedit struct +align 16 +proc ted_sel_normalize uses ecx esi + push edi + mov esi,edi + add esi,ted_offs_sel + add edi,ted_offs_seln + mov ecx,sizeof.TexSelect/4 + rep movsd + pop edi + + jmp @f + .swp_f: + mov ecx,ted_seln_x0 + m2m ted_seln_x0,ted_seln_x1 + mov ted_seln_x1,ecx + + mov ecx,ted_seln_y0 + cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1) + jle .end_f + m2m ted_seln_y0,ted_seln_y1 + mov ted_seln_y1,ecx + + jmp .end_f +align 4 + @@: + + mov ecx,ted_seln_y0 + cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1) + jg .swp_f + + cmp ecx,ted_seln_y1 ;(sel_y0==sel_y1) + jne .end_f + mov ecx,ted_seln_x0 + cmp ecx,ted_seln_x1 ;(sel_x0>sel_x1) + jg .swp_f + + .end_f: + ret +endp + +;input: +; edi = pointer to tedit struct +;description: +; 㭪 뢠 砫 뤥 +align 16 +proc ted_sel_start uses eax ecx + mov eax,ted_scr_h + mov ecx,ted_cur_x + add ecx,[eax+sb_offs_position] + mov ted_sel_x0,ecx + mov ted_sel_x1,ecx + + mov eax,ted_scr_w + mov ecx,ted_cur_y + add ecx,[eax+sb_offs_position] + mov ted_sel_y0,ecx + mov ted_sel_y1,ecx + ret +endp + +;input: +; edi = pointer to tedit struct +;description: +; 㭪 뢠 ⨨ 뤥 +align 16 +proc ted_sel_end uses eax + mov ted_drag_k,0 ;稢 뤥 + call ted_is_select + or al,al + jz @f + xor eax,eax + mov ted_sel_x0,eax + mov ted_sel_x1,eax + mov ted_sel_y0,eax + mov ted_sel_y1,eax + stdcall ted_draw,edi + jmp .end_f + @@: + call ted_draw_main_cursor + .end_f: + ret +endp + +;input: +; edi = pointer to tedit struct +;description: +; 㭪 뢠 ६饭 뤥 +align 16 +proc ted_sel_move + push eax ecx + mov ecx,ted_cur_x + mov eax,ted_scr_h + add ecx,[eax+sb_offs_position] + mov ted_sel_x1,ecx + + mov eax,ted_scr_w + mov ecx,ted_cur_y + add ecx,[eax+sb_offs_position] + mov ted_sel_y1,ecx + pop ecx eax + cmp ted_fun_draw_panel_buttons,0 ;redraw toolbar (need to button Copy) + je @f + call ted_fun_draw_panel_buttons + @@: + ret +endp + +;input: +; edi = pointer to tedit struct +;description: +; 㭪 뢠 뤥 ᥣ 㬥 +align 16 +proc ted_sel_all + push eax + xor eax,eax + mov ted_sel_x0,eax + mov ted_sel_y0,eax + + mov ted_sel_x1,eax ;??? + call ted_get_num_lines + mov ted_sel_y1,eax + pop eax + stdcall ted_draw,edi + cmp ted_fun_draw_panel_buttons,0 ;redraw toolbar (need to button Copy) + je @f + call ted_fun_draw_panel_buttons + @@: + ret +endp + +;input: +; cl_al_mem = 1 - clear all memory +align 16 +proc ted_clear uses ecx edi, edit:dword, cl_al_mem:dword + mov edi,[edit] + + mov ted_cur_x,0 + mov ted_cur_y,0 + mov ted_tim_ch,0 + mov ted_tim_ls,0 + mov ted_tim_co,0 + mov ted_tim_undo,0 + mov ted_help_id,-1 + mov ecx,sizeof.symbol + shl ecx,1 + add ecx,ted_tex + mov ted_ptr_free_symb,ecx + + mov ecx,ted_scr_w + mov dword[ecx+sb_offs_position],0 + mov dword[ecx+sb_offs_max_area],100 ;᫮ ப 㬥 + mov dword[ecx+sb_offs_redraw],1 + mov ecx,ted_scr_h + mov dword[ecx+sb_offs_position],0 + mov dword[ecx+sb_offs_max_area],100 ;᫮ ᨬ 㬥 + + mov ted_sel_x0,0 + mov ted_sel_y0,0 + mov ted_sel_x1,0 + mov ted_sel_y1,0 + + cmp dword[cl_al_mem],0 + je .exit + + push edx + mov ecx,sizeof.symbol + imul ecx,ted_max_chars + mov edx,ted_tex + @@: + mov byte [edx],0 + inc edx + loop @b + mov edx,ted_tex + mov dword [edx+symbol.next],1 + pop edx + + .exit: + ret +endp + + +align 16 +proc ted_init_syntax_file, edit:dword + pushad + mov edi,[edit] + + mov ecx,0x100 + mov edx,ted_arr_key_pos + @@: + mov dword[edx],-1 + add edx,4 + loop @b + + ;init: ted_colors_text_count, ted_key_words_count, ... + mov ted_colors_text_count,1 + mov ted_help_text_f1,0 + mov ted_help_id,-1 ;䨪 ᫮ ࠢ + + mov eax,edi ;࠭塞 祭 edi + mov esi,ted_syntax_file + add edi,ted_offs_count_colors ;edi = &ted_key_words_count + mov ecx,9 + rep movsd + mov edi,eax ;⠭ 祭 edi + + mov eax,ted_syntax_file + add eax,32 + mov ted_text_colors,eax + + mov eax,ted_colors_text_count ;init: count_colors_text (offset to key words) + lea eax,[4*eax+32] + add eax,ted_syntax_file + mov ted_key_words_data,eax + + mov ecx,ted_key_words_count ;init: ted_arr_key_pos (first key positions) + or ecx,ecx + jz .no_words + xor eax,eax + @@: + ColToIndexOffset eax,edx + movzx ebx,byte[edx] + mov esi,ted_arr_key_pos + lea esi,[esi+4*ebx] + cmp dword[esi],-1 + jne .no_ch_key + mov [esi],eax + .no_ch_key: + inc eax + loop @b + .no_words: + + ;init: ted_help_text_f1 + mov ecx,ted_key_words_count ;⢮ 祢 ᫮ + imul ecx,sizeof.TexColViv ;ࠧ 1- . . + add ecx,ted_key_words_data ;砫 䠩 . . + mov ted_help_text_f1,ecx ;⪠ , 稭 ⥪ ࠢ + + stdcall ted_init_scroll_bars,edi,1 ;塞 梥 ஫ + .no_colors: + popad + ret +endp + +;input: +; ebx = file size +; edi = pointer to tedit struct +;description: +; 㭪 뢠 ⨨ 䠩 +align 16 +proc ted_on_open_file + push eax ;destination + push ecx ;for cycle + push edx ;source + push esi + + or ebx,ebx + jnz @f + ;᫨ 䠩 ⮩ + stdcall ted_clear,edi,1 ;⨬ + jmp .end_opn +align 4 + @@: + stdcall ted_clear,edi,0 ;⨬ , ⮬ 㤥 묨 묨 + + mov edx,ted_tex + mov ecx,ebx + .s_10: + cmp word[edx],0xa0d ;ய᪠ 10- ᨬ ᫨ । ⮨ 13- + jne @f + dec ecx + jz .no_10 + dec ecx + jz .no_10 + add edx,2 + @@: + cmp byte[edx],10 + jne @f + mov byte[edx],13 ;塞 10- ᨬ ப + @@: + inc edx + loop .s_10 + .no_10: + + ;ॢ 䠩 t_edit + mov ecx,ebx + lea eax,[ebx+2] + ConvertIndexToPointer eax + mov edx,ted_tex + add edx,ebx + push ebx + @@: + mov ebx,[edx] + mov byte[eax],bl + mov dword[eax+symbol.perv],ecx + inc dword[eax+symbol.perv] + mov dword[eax+symbol.next],ecx + add dword[eax+symbol.next],3 + ;mov byte[eax+1],0 ;col=0 + mov dword[eax+symbol.tc],-1 + mov dword[eax+symbol.td],0 + + or ecx,ecx + jz @f + dec ecx + dec edx + sub eax,sizeof.symbol + jmp @b +align 4 + @@: + pop ebx + mov dword[eax+symbol.perv],0 ; first sumbol 'perv=0' + + mov edx,ted_tex ; ன 砫쭮 㦥 ᨬ + ; begining sumbol 'perv=0' 'next=2' + mov dword[edx+symbol.perv],0 + mov dword[edx+symbol.next],2 + + add edx,sizeof.symbol ; ன 筮 㦥 ᨬ + mov dword[edx+symbol.next],0 ; last sumbol 'next=0' + mov dword[edx+symbol.perv],ebx ; last sumbol 'perv=last' + inc dword[edx+symbol.perv] + mov dword[edx+symbol.tc],0 ; ⠢ ६ ᮧ ࠢ 0, ᨬ ࠢ쭮 ࠡ뢠 ⨨ 䠩 28 + + mov edx,ebx + inc edx ;2 = rezerv sumbols + imul edx,sizeof.symbol + add edx,ted_tex + mov dword[edx+symbol.next],1 ; last sumbol 'next=1' + + @@: ;clear memory, need if before was open big file + add edx,sizeof.symbol + cmp edx,ted_tex_end + jge .end_opn + mov dword[edx+symbol.tc],0 + mov dword[edx+symbol.td],0 + jmp @b +align 4 + .end_opn: + + call ted_get_num_lines + cmp eax,TED_LINES_IN_NEW_FILE + jge @f + mov eax,TED_LINES_IN_NEW_FILE + @@: + mov esi,ted_scr_w + mov dword[esi+sb_offs_max_area],eax + pop esi edx ecx eax + + call ted_text_colored + stdcall ted_draw,edi + cmp ted_fun_draw_panel_buttons,0 + je @f + call ted_fun_draw_panel_buttons + @@: + ret +endp + +;input: +; edx = pointer to symbol struct +; edi = pointer to tedit struct +;output: +; edx = pointer to 'perv' visible symbol struct +align 16 +ted_iterat_perv: + cmp ted_tim_undo,0 + je .else + push ebx + @@: + mov edx,[edx+symbol.perv] + or edx,edx + jz @f + imul edx,sizeof.symbol + add edx,ted_tex + call ted_symbol_not_vis + cmp bl,1 + je @b + cmp byte[edx],10 ;ய ᨬ 10 + je @b + pop ebx + ret + @@: + mov edx,ted_tex ;砫 䠩 + pop ebx + ret + .else: + mov edx,[edx+symbol.perv] + or edx,edx + jz @f + imul edx,sizeof.symbol + add edx,ted_tex + cmp dword[edx+symbol.td],0 + jne .else + cmp byte[edx],10 ;ய ᨬ 10 + je .else + ret + @@: + mov edx,ted_tex ;砫 䠩 + ret + + +;input: +; edx = pointer to symbol struct +; edi = pointer to tedit struct +;output: +; edx = pointer to 'next' visible symbol struct +align 16 +ted_iterat_next: + cmp ted_tim_undo,0 + je .else + push ebx + @@: + mov edx,[edx+symbol.next] + cmp edx,1 + jle @f + imul edx,sizeof.symbol + add edx,ted_tex + + call ted_symbol_not_vis + cmp bl,1 + je @b + cmp byte[edx],10 ;ய ᨬ 10 + je @b + pop ebx + ret + @@: + mov edx,ted_tex_1 ; 䠩 + pop ebx + ret + .else: + mov edx,[edx+symbol.next] + cmp edx,1 + jle @f + imul edx,sizeof.symbol + add edx,ted_tex + + cmp dword[edx+symbol.td],0 + jne .else + cmp byte[edx],10 ;ய ᨬ 10 + je .else + ret + @@: + mov edx,ted_tex_1 ; 䠩 + ret + +;input: +; bl = symbol end of select +; bh = ࠭騩 ᨬ (= 0 ᫨ ஢ન ) +; edx = pointer to symbol struct +; edi = pointer to tedit struct +;description: +; ᫥ 㪠 ᨬ +align 16 +ted_iterat_next_pos_char: + push ax + mov al,1 ;।騩 ᨬ, 㦨 ࠢ ᨬ bh + @@: + cmp bl,byte[edx] + je .found + .no_found: + cmp edx,ted_tex_1 + jle @f + mov al,byte[edx] + call ted_iterat_next + jmp @b + .found: + cmp bh,al + je .no_found + @@: + call ted_iterat_next + pop ax + ret + +;input: +; edx = pointer to symbol struct +; edi = pointer to tedit struct +align 16 +ted_iterat_perv_color_tag: + @@: + cmp byte[edx+1],0 + jne @f + call ted_iterat_perv + cmp edx,ted_tex_1 + jle @f + jmp @b +align 4 + @@: + ret + +;input: +; edx = pointer to symbol struct +; edi = pointer to tedit struct +align 16 +ted_iterat_next_color_tag: + @@: + call ted_iterat_next + cmp byte[edx+1],0 + jne @f + cmp edx,ted_tex_1 + jle @f + jmp @b +align 4 + @@: + ret + +;input: +; edx = pointer to symbol struct +; edi = pointer to tedit struct +;output: +; bl = 1 if sumbol not visible +; (tex[i].td+ted_tim_undo<=ted_tim_ch && tex[i].td) || (tex[i].tc>ted_tim_ch-ted_tim_undo) +align 16 +ted_symbol_not_vis: + push eax + + xor bl,bl + cmp dword[edx+symbol.td],0 + je @f + mov eax,[edx+symbol.td] ;eax=tex[i].td + add eax,ted_tim_undo + cmp eax,ted_tim_ch + jg @f + mov bl,1 + pop eax + ret + @@: + + mov eax,ted_tim_ch + sub eax,ted_tim_undo + cmp [edx+symbol.tc],eax + jle @f + or bl,1 + @@: + + pop eax + ret + +;input: +; text - pointer to text string +; add_opt - options +align 16 +proc ted_text_add, edit:dword, text:dword, t_len:dword, add_opt:dword + locals + new_spc dd ? ;count new spaces + new_lin dd ? ;count new lines + endl +;ᯮ짮 ॣ஢ 㭪樨: +;eax - ⠢ ⥪ +;ebx - ६ 㦤, ⠢塞 ⥪ +;ecx - ६ 㦤 +;edx - 㪠⥫ ᨬ + pushad + cmp dword[t_len],1 ;஢塞 塞 ⥪ + jl .no_add ; <1 룠 㭪樨,  + + mov edi,[edit] + mov esi,[text] + + call ted_get_pos_by_cursor + call ted_get_text_perv_pos + call ted_get_text_arr_index ;eax=po_t + + mov dword[new_spc],0 + cmp ted_gp_opt,2 + je @f + push eax ;c_sp=cur[cn].x+Scroller->XPos-StrLen(cur[cn].y+Scroller->YPos); + mov eax,ted_scr_h + mov eax,[eax+sb_offs_position] + add eax,ted_cur_x ;eax - ᨬ + mov [new_spc],eax + + mov eax,ted_scr_w + mov eax,[eax+sb_offs_position] + add eax,ted_cur_y ;eax - ப + call ted_strlen ;ebx = line len + sub [new_spc],ebx ; 樨 ⭨ ப, 㧭 ⢮ 塞 ஡ + pop eax + @@: + + mov ebx,[t_len] + + mov dword[new_lin],0 + cmp ted_gp_opt,0 + jne @f + push eax + mov eax,ted_scr_w + mov eax,[eax+sb_offs_position] + add eax,ted_cur_y + inc eax + mov [new_lin],eax + + call ted_get_num_lines + sub [new_lin],eax + ;㢥稢 ஫ ᫮ ⥫ ப + mov ecx,ted_scr_w + add [ecx+sb_offs_max_area],eax ;㢥稢 ࠧ ⨪쭮 ஫ + pop eax + @@: + + mov edx,ted_ptr_free_symb + .beg_cycle: ;for(i=...;i ted_cur_x + mov ted_gp_opt,1 + cmp eax,ecx + jge @f ; Row >= ted_cur_y + .u1_0: + mov ted_gp_opt,0 + inc ebx + cmp byte [edx],13 + jne @b + cmp eax,ecx + jge @f ; Row >= ted_cur_y + inc eax + xor ebx,ebx + jmp @b + @@: + cmp eax,ecx + jne @f ; Row = ted_cur_y + inc ted_gp_opt + @@: + cmp ted_gp_opt,0 + jne @f + mov edx,ted_tex_1 + ;call ted_get_text_perv_pos + @@: + ret +endp + +;input: +; eax = Row +; edi = pointer to tedit struct +;output: +; ebx = str len +align 16 +ted_strlen: + push edx ecx + ;ecx = Row, from cycle + + xor ebx,ebx + xor ecx,ecx + mov edx,ted_tex + @@: + call ted_iterat_next + cmp edx,ted_tex_1 + jle @f + inc ebx + cmp byte [edx],13 + jne @b + dec ebx ;lenght minus 1 sumbol to paragraph + cmp eax,ecx + je @f + xor ebx,ebx + inc ecx + jmp @b + @@: + + cmp eax,ecx + je @f + xor ebx,ebx + @@: + + pop ecx edx + ret + + +;input: +; edx = symbol position +; edi = pointer to tedit struct +;output: +; eax = number of line +; ebx = symbol position in line +align 16 +ted_get_text_coords: + push edx + xor eax,eax + xor ebx,ebx + @@: + call ted_iterat_perv + + or eax,eax + jnz .no_col_mov + inc ebx + .no_col_mov: + + cmp edx,ted_tex_1 + jle @f + cmp byte [edx],13 + jne @b + inc eax + jmp @b + @@: + dec ebx + pop edx + ret + +;input: +; edi = pointer to tedit struct +;output: +; eax = num lines +align 16 +ted_get_num_lines: + push edx + mov eax,1 + mov edx,ted_tex + @@: + call ted_iterat_next + cmp edx,ted_tex_1 + jle @f + cmp byte[edx],13 + jne @b + inc eax + jmp @b + @@: +;... +;dec eax + pop edx + ret + + +;input: +; edi = pointer to tedit struct +;description: +; ⬥ ⬥ ⢨, । 㬥 +align 16 +proc ted_set_undo + mov ted_drag_k,0 ;稢 뤥 + cmp ted_tim_undo,1 + jl .no_work + + push eax ebx edx + mov edx,ted_tex + call ted_get_text_next_pos ;long i=tex[0].next; + mov eax,ted_tim_undo + sub ted_tim_ch,eax ;ted_tim_ch-=ted_tim_undo; + mov eax,ted_tim_ch + cmp ted_tim_ls,eax ;if(ted_tim_ls>ted_tim_ch) + jle @f + mov ted_tim_ls,0 + @@: + cmp edx,ted_tex_1 + jle @f + + ;if(tex[i].tc>ted_tim_ch){ // ᫨ ᮧ ᨬ 뫮 ⬥ + cmp [edx+symbol.tc],eax + jle .no_u1 + mov dword[edx+symbol.tc],0 + mov dword[edx+symbol.td],0 + + mov ebx,[edx+symbol.perv] + imul ebx,sizeof.symbol + add ebx,ted_tex ;ebx=tex[i].perv + m2m dword [ebx+symbol.next],dword [edx+symbol.next] ;tex[tex[i].perv].next=tex[i].next; + + mov ebx,[edx+symbol.next] + imul ebx,sizeof.symbol + add ebx,ted_tex ;ebx=tex[i].next + m2m dword [ebx+symbol.perv],dword [edx+symbol.perv] ;tex[tex[i].next].perv=tex[i].perv; + + cmp ted_ptr_free_symb,edx + jle .no_cor_free + mov ted_ptr_free_symb,edx ;塞 㪠⥫ ᢮ ᨬ, ண ᪠ + .no_cor_free: + mov edx,ebx ;⨬㥬 ᪮ (edx ᫥ 맮 ted_get_text_next_pos 㤥 ࠢ ebx) + jmp @b + .no_u1: + + ;else if(tex[i].td>ted_tim_ch) tex[i].td=0; // ᫨ 㤠 ᨬ 뫮 ⬥ + cmp [edx+symbol.td],eax + jle .no_u2 + mov dword[edx+symbol.td],0 + .no_u2: + + call ted_get_text_next_pos + jmp @b + @@: + mov ted_tim_undo,0 + mov eax,ted_tim_co + cmp ted_tim_ch,eax + jge @f + mov ted_tim_co,0 + @@: + pop edx ebx eax + .no_work: + ret +endp + +;description: +; 室 㪠 +;input: +; row = ப +; col = ᨬ +align 16 +proc ted_go_to_position uses ecx edx edi, edit:dword, row:dword, col:dword + mov edi,[edit] + ; ⮢ ப + mov edx,[row] + call ted_get_num_lines + cmp edx,eax + jle @f + mov edx,eax ;࠭祭 ப max + @@: + dec edx + cmp edx,0 + jge @f + xor edx,edx ;࠭祭 ப min + @@: + ; ⮢ ᨬ + mov ecx,[col] + dec ecx + cmp ecx,0 + jge @f + xor ecx,ecx + @@: + call ted_go_to_pos + stdcall ted_draw,edi + ret +endp + +;input: +; ecx = Col +; edx = Row +; edi = pointer to tedit struct +;output: +; ecx = cursor x +; edx = cursor y +align 16 +ted_go_to_pos: + push eax ebx + mov eax,ted_scr_h + sub ecx,[eax+sb_offs_position] + cmp ecx,0 ;ted_cur_x < 0 + jge @f + add [eax+sb_offs_position],ecx ;ப⪠ ஫ + xor ecx,ecx + @@: + mov ebx,5 ;5 - ᫥ + cmp ecx,ebx + jge .end0 + sub ebx,ecx ;ebx - ᪮쪮 ᨬ 㦭 ᤢ + cmp [eax+sb_offs_position],ebx + jge @f + add ecx,[eax+sb_offs_position] + mov dword[eax+sb_offs_position],0 + jmp .end0 + @@: + sub [eax+sb_offs_position],ebx + add ecx,ebx + .end0: + cmp ecx,[eax+sb_offs_cur_area] ;ted_cur_x > [.cur_area] + jl .end1 + mov ebx,ecx + sub ebx,[eax+sb_offs_cur_area] + inc ebx + add [eax+sb_offs_position],ebx ;ப⪠ ஫ ࠢ + sub ecx,ebx + .end1: + mov ted_cur_x,ecx + + mov eax,ted_scr_w + sub edx,[eax+sb_offs_position] + cmp edx,0 ;ted_cur_y < 0 + jge @f + add [eax+sb_offs_position],edx ;ப⪠ ஫ + xor edx,edx + jmp .end2 + @@: + cmp edx,[eax+sb_offs_cur_area] ;ted_cur_y > [.cur_area] + jl .end2 + mov ebx,edx + sub ebx,[eax+sb_offs_cur_area] + inc ebx + add [eax+sb_offs_position],ebx ;ப⪠ ஫ + sub edx,ebx + .end2: + mov ted_cur_y,edx + pop ebx eax + ret + +;input: +; edi = pointer to tedit struct +align 16 +ted_text_colored: + push eax edx + mov eax,ted_tim_ch + sub eax,ted_tim_undo + mov ted_tim_co,eax + mov edx,ted_tex + @@: + call ted_iterat_next + cmp edx,ted_tex_1 + jle @f + mov byte[edx+1],0 + jmp @b + @@: + + cmp ted_key_words_count,1 + jl .no_colors + mov edx,ted_tex + @@: + call ted_text_find_sel_color + cmp edx,ted_tex_1 + jg @b + + xor ax,ax + mov edx,ted_tex + .cycle0: + call ted_iterat_next + cmp edx,ted_tex_1 + jle .no_colors + mov al,byte[edx+1] + or al,al + jz .cycle0 + cmp ah,al + jne @f + mov byte[edx+1],0 ;᫨ﭨ 冷 ᫮ 梥 + @@: + shl ax,8 + jmp .cycle0 + .no_colors: + pop edx eax + ret + + +;input: +; edx = pointer to start symbol +; edi = pointer to tedit struct +;output: +; edx = pointer to next symbol +;description: +; 㭪 ᪠ 뤥 ᢥ祭 ᫮ +align 16 +proc ted_text_find_sel_color uses eax ebx ecx esi +locals + begPos dd ? ;砫쭠 + endPos dd ? ;筠 + find db ? ;0 - , 1 - , 2 - 䠩 + f_color db ? ; 梥 ᫮ +endl +;eax = word_n ⥪騩 () ஢塞 ᫮ ᯨ᪥ +;ebx = ࠧ 楫 +;ecx = l_pos ᫥ () 室饣 ᫮ ᯨ᪥ +;esi = ࠧ 楫, ஢塞 ᨬ ᫮ + mov dword[begPos],1 + mov dword[endPos],1 + mov byte[find],0 + mov byte[f_color],1 + .cycle0: + call ted_iterat_next + cmp edx,ted_tex_1 + jle .cycle0end + + movzx eax,byte[edx] + shl eax,2 ;eax*=4 + add eax,ted_arr_key_pos + mov eax,[eax] + cmp eax,0 + jl .cycle0 ;if( (word_n=ted_arr_key_pos[(unsigned char)tex[i].c])>-1 ){ + + mov ecx,eax + ;while(l_posword_n && Col[l_pos-1].Text[pos]!=tex[i].c) + @@: + cmp ecx,eax + jle @f + dec ecx + ColToIndexOffset ecx,ebx + inc ecx + ;cmp byte[ebx+esi],byte[edx] + mov bl,byte[ebx+esi] + cmp bl,byte[edx] + je @f + dec ecx + jmp @b + @@: + + ColToIndexOffset eax,ebx + cmp byte[ebx+esi],0 + jne .if_0 ;if(Col[word_n].Text[pos]==0){ + mov [endPos],edx ;eP=i; + ColToIndexOffset eax,ebx + mov bl,[ebx+MAX_COLOR_WORD_LEN+7] + mov [f_color],bl ;f_color=Col[word_n].color; + + mov byte[find],1 + ColToIndexOffset eax,ebx ;... ebx = Col[word_n] + mov bl,[ebx+MAX_COLOR_WORD_LEN+4] + cmp bl,0 ;if(Col[word_n].wwo) + je .if_2n + push edx + mov edx,[begPos] + call ted_iterat_perv + + btr bx,0 ;1-1 + jae @f ;if(Col[word_n].wwo&1) + ;u1= !(isalnum(cont_s)||cont_s=='_') + call isalnum + jae @f + mov byte[find],0 + jmp .if_4e + @@: + + btr bx,3 ;4-1 + jae .if_4e ;if(Col[word_n].wwo&8) + ;u1= !isalpha(cont_s); + call isalpha + jae .if_4e + mov byte[find],0 + .if_4e: + + mov edx,[endPos] + ;call ted_iterat_next + + btr bx,1 ;2-1 + jae @f ;if(Col[word_n].wwo&2) + ;u1= !(isalnum(cont_s)||cont_s=='_') + call isalnum + jae @f + mov byte[find],0 + jmp .if_6e + @@: + + btr bx,4 ;5-1 + jae .if_6e ;if(Col[word_n].wwo&16) + ;u1= !isalpha(cont_s); + call isalpha + jae .if_6e + mov byte[find],0 + .if_6e: + + btr bx,2 ;3-1 + jae .if_7e ;if(Col[word_n].wwo&4) + ColToIndexOffset eax,ebx + mov bx,word[ebx+MAX_COLOR_WORD_LEN+5] + call ted_iterat_next_pos_char + cmp edx,ted_tex_1 + jg @f + ;᫨ 諨 䠩 諨 ᨬ ࠧ⪨ + call ted_iterat_perv + mov byte[find],2 + @@: + mov dword[endPos],edx + .if_7e: + + pop edx + .if_2n: +;if(i!=1){ // 㬥 +; cont_s=tex[eP].c; +; if(Col[word_n].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_'); // 㪢.-. ᨬ +; if(u2 && Col[word_n].wwo&16) u2= !isalpha(cont_s); // . ᨬ +; if(Col[word_n].wwo&4) eP=ted_iterat_next_pos_char(eP,Col[word_n].endc); + + cmp eax,ecx + je .wh_2e ;if(word_n==l_pos) break; // do double - ᫨ ᫮ 筮 ᫥ + .if_0: + + cmp edx,ted_tex_1 + jle .wh_2e ;if(i==1) break; + + ;while(l_pos>word_n && Col[word_n].Text[pos]!=tex[i].c) + .wh_4b: + cmp ecx,eax + jle .wh_4e + ColToIndexOffset eax,ebx + ;cmp byte[ebx+esi],byte[edx] + mov bl,byte[ebx+esi] + cmp bl,byte[edx] + je .wh_4e + inc eax + jmp .wh_4b + .wh_4e: + + cmp eax,ecx + je .wh_2e;if(word_n==l_pos) break; + inc esi ;pos++; + jmp .wh_2b + .wh_2e: + + cmp byte[find],0 ;if(fnd)break; + jne .cycle0end + mov edx,[begPos];i=bP; + jmp .cycle0 + .cycle0end: + + cmp byte[find],0 + je .if_1e ;if(fnd){ // 뤥 ⥪ + ;if(!mode_sf1 || (mode_sf1 && strlen(Col[word_n].f1->c_str())>0)){ + mov eax,[begPos] + mov bl,[f_color] + mov [eax+1],bl ;tex[bP].col=f_color; + mov eax,[endPos] + mov byte[eax+1],0xff ;tex[eP].col=255; + cmp byte[find],2 + je .if_1e + ;return ItPoPerv(eP); // 頥 宦 + mov edx,[endPos] + call ted_get_text_perv_pos + jmp @f + .if_1e: + mov edx,ted_tex + @@: + + ret +endp + +;input: +; edx = pointer to char (byte) +;output: +; cf=1 if symbol is... +align 16 +tab_all_num db 0,0,0,0,0,0,0xff,11b,11111110b,0xff,0xff,10000111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0;,0,0,0,0,0,0,0,0 - tab_alpha_0,0,0,0,0,0,0,0 +tab_alpha db 0,0,0,0,0,0,0,0,11111110b,0xff,0xff,10000111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + +;output: +; cf=1 ᫨ [edx] 㪢, '_' +align 16 +isalnum: + push eax ebx + movzx eax,byte[edx] ;al=offset + shr eax,3 + lea ebx,[tab_all_num] + add ebx,eax + movzx ax,byte[edx] ;al=bit + and ax,111b + bt word[ebx],ax + pop ebx eax + ret + +;output: +; cf=1 ᫨ [edx] 㪢 '_' +align 16 +isalpha: + push eax ebx + movzx eax,byte[edx] ;al=offset + shr eax,3 + lea ebx,[tab_alpha] + add ebx,eax + movzx ax,byte[edx] ;al=bit + and ax,111b + bt word[ebx],ax + pop ebx eax + ret + +align 16 +proc ted_show_help_f1 uses eax edx edi, edit:dword + mov edi,[edit] + + call ted_get_pos_by_cursor + push edx + call ted_iterat_next_color_tag + mov eax,edx + pop edx + call ted_iterat_perv_color_tag + + cmp eax,ted_tex + jle @f + cmp edx,ted_tex_1 + jle @f + stdcall ted_find_help_id,eax + @@: + ;call ted_draw_main_cursor + call ted_draw_help_f1 + ret +endp + +;input: +; edx = position begin 'symbol' struct +; edi = pointer to tedit struct +; end_pos = position end 'symbol' struct +align 16 +proc ted_find_help_id uses ebx ecx, end_pos:dword +; ecx = word_n +; ebx = l_pos + mov ted_help_id,-1 + + movzx ebx,byte[edx] + shl ebx,2 ;ebx*=4 + add ebx,ted_arr_key_pos + mov ecx,[ebx] + cmp ecx,0 + jl .if_0e ;if( (word_n=ted_arr_key_pos[(unsigned char)tf[0]])>-1 ){ + push esi eax + mov ebx,ecx ;l_pos=word_n; + ColToIndexOffset ecx,esi + push cx + mov cl,[esi] + @@: + cmp ebx,ted_key_words_count ;while(l_posword_n + jle .wh_0e + dec ebx + ColToIndexOffset ebx,eax + inc ebx + cmp byte[eax+esi],dl ;&& Col[l_pos-1].Text[pos]!=tf[i]) + je .wh_0e + dec ebx ;l_pos--; + jmp .wh_0b + .wh_0e: + + .wh_1b: + cmp ebx,ecx ;while(l_pos>word_n + jle .wh_1e + ColToIndexOffset ecx,eax + cmp byte[eax+esi],dl + je .wh_1e + inc ecx ;word_n++; + jmp .wh_1b + .wh_1e: + pop dx + + cmp ecx,ebx ;if(word_n==l_pos) break; + je @f + call ted_iterat_next ;pos++; + cmp edx,[end_pos] ;for(...;i y0,y1 + add ecx,ted_rec_t + mov edx,ted_cur_y + imul edx,ted_rec_h + add ecx,edx + shl ecx,16 + add ecx,ted_rec_h + + mov edx,ted_color_wnd_work + call ted_sel_normalize + + mov esi,ted_scr_w + mov eax,[esi+sb_offs_position] + sub ted_seln_y0,eax + sub ted_seln_y1,eax + + mov eax,ted_cur_y + cmp eax,ted_seln_y0 + jl .no_cur_sel + cmp eax,ted_seln_y1 + jg .no_cur_sel + mov edx,ted_color_select ;塞 梥 䮭 梥 뤥 + mov esi,ted_scr_h + cmp eax,ted_seln_y0 + jne @f + mov eax,ted_cur_x + add eax,[esi+sb_offs_position] + cmp eax,ted_seln_x0 + jge @f + mov edx,ted_color_wnd_work + @@: + mov eax,ted_cur_y + cmp eax,ted_seln_y1 + jne .no_cur_sel + mov eax,ted_cur_x + add eax,[esi+sb_offs_position] + cmp eax,ted_seln_x1 + jl .no_cur_sel + mov edx,ted_color_wnd_work + .no_cur_sel: + mcall SF_DRAW_RECT + + call ted_get_pos_by_cursor ;६ ᨬ + cmp ted_gp_opt,2 + jne @f + mov esi,1 + ror ecx,16 + mov bx,cx + add ebx,0x10001 + call ted_get_symb_color + call ted_convert_invis_symb + mcall SF_DRAW_TEXT ;ᮢ ᨬ + @@: +popad + ret +endp + +;input: +; edx -> pointer to text +; edi -> 㪠⥫ tedit +;output: +; ecx = color +; if ted_mode_color=0 then ecx=ted_color_wnd_text +align 16 +ted_get_symb_color: + mov ecx,ted_color_wnd_text ; 梥 ⥪ 㬮砭 + + push eax edx + cmp ted_mode_color,0 + je .exit + jmp .on_first + @@: + call ted_iterat_perv + cmp edx,ted_tex_1 + jle .exit + .on_first: + movzx eax,byte[edx+1] + or eax,eax ;᫨ al=0 梥 + jz @b + + cmp eax,ted_colors_text_count + jge .exit + + mov ecx,ted_text_colors ;ਡ塞 ᬥ饭 1- 梥 + lea ecx,[ecx+4*eax] + mov ecx,[ecx] ;⠭ ⥪騩 梥 ⥪ ᬥ饭 + .exit: + or ecx,ted_font_size + pop edx eax + ret + +;input: +; edx = pointer to text +; edi = pointer to tedit struct +;description: +; 㭪 ८ࠧ ᨬ ⠥ ࠭ +align 16 +ted_convert_invis_symb: + cmp ted_mode_invis,1 + jne .else + cmp byte[edx],9 + jne @f + lea edx,[ted_symbol_tab] + jmp .end_f +align 4 + @@: + cmp byte[edx],13 + jne @f + mov edx,edi + add edx,ted_offs_symbol_new_line + @@: + jmp .end_f +align 4 + .else: + cmp byte[edx],9 + je @f + cmp byte[edx],13 + jne .end_f + @@: + lea edx,[ted_symbol_space] + .end_f: + ret + +;input: +; edi = pointer to tedit struct +align 16 +ted_scroll_set_redraw: + push eax + mov eax,ted_scr_w + mov dword[eax+sb_offs_redraw],1 + mov eax,ted_scr_h + mov dword[eax+sb_offs_redraw],1 + pop eax + ret + +align 16 +proc ted_draw, edit:dword + locals + line_num dd ? + endl + pushad + mov edi,[edit] + + mov eax,SF_DRAW_TEXT + mov ecx,ted_text_colors + mov ecx,[ecx] + + mov ebx,ted_wnd_l + add ebx,ted_rec_l + shl ebx,16 + add ebx,ted_wnd_t + add ebx,ted_rec_t + add ebx,0x10001 ;塞 ࠢ 㪢 業 + + call ted_sel_normalize ;need before draw select + mov esi,ted_scr_w + mov esi,[esi+sb_offs_position] + mov [line_num],esi + + stdcall ted_clear_line_before_draw, edi,ebx,1,esi + call ted_get_first_visible_pos + or edx,edx + jz .no_draw_text + mov esi,1 ; 뢮 ⥪ 1- ᨬ + @@: + call ted_iterat_next + cmp edx,ted_tex_1 + jle .no_draw_text + + ; *** 梥⮢ ࠧ⪠ + cmp ted_mode_color,0 + je .no_col_change + cmp byte[edx+1],0 + je .no_col_change + call ted_get_symb_color + .no_col_change: + + cmp byte[edx],13 + jne .no_13 + cmp ted_mode_invis,1 + jne .no_invis + push edx + mov edx,edi + add edx,ted_offs_symbol_new_line + int 0x40 + pop edx + .no_invis: + add ebx,ted_rec_h + ;optimized output \/ + mov eax,ted_wnd_h + add eax,ted_wnd_t + cmp bx,ax + jg .no_draw_text + mov eax,SF_DRAW_TEXT + ;optimized output /\ + and ebx,0xffff + ror ebx,16 + add ebx,ted_wnd_l + add ebx,ted_rec_l + inc ebx + ror ebx,16 + inc dword[line_num] ;increment line number + stdcall ted_clear_line_before_draw,edi,ebx,1,dword[line_num] + call ted_opt_draw_line_left + jmp @b +align 4 + .no_13: + + int 0x40 + ror ebx,16 + add ebx,ted_rec_w + mov esi,ted_wnd_l + add esi,ted_wnd_w + cmp bx,si + jl .no_opt + call ted_opt_draw_line_right + .no_opt: + mov si,1 + ror ebx,16 + jmp @b + .no_draw_text: + + inc dword[line_num] + stdcall ted_clear_line_before_draw,edi,ebx,0,dword[line_num] + call ted_draw_line_numbers + call ted_draw_main_cursor + +;--------------------------------------------- +; set all_redraw flag for draw all ScrollBar +; In some cases it is necessity to draw only the area +; of moving of a "runner", for acceleration of output - +; in this case the flag needs to be reset to 0 (zero). + mov eax,ted_scr_h + mov esi,ted_scr_w + mov dword[eax+sb_offs_all_redraw],1 + mov dword[esi+sb_offs_all_redraw],1 + +; ᮢ ப⪨ + stdcall scroll_bar_horizontal.draw,eax ;[scrollbar_hor_draw] + stdcall scroll_bar_vertical.draw,esi ;[scrollbar_ver_draw] +; reset all_redraw flag + mov dword[eax+sb_offs_all_redraw],0 + mov dword[esi+sb_offs_all_redraw],0 +;--------------------------------------------- + + ;left-bottom square + mov ebx,ted_wnd_l + shl ebx,16 + add ebx,ted_rec_l + mov ecx,ted_wnd_t + add ecx,ted_wnd_h + shl ecx,16 + mov cx,word[eax+sb_offs_size_y] + inc cx + mcall SF_DRAW_RECT,,,ted_color_wnd_capt ;[sc.work] + + ;right-bottom square + mov ebx,ted_wnd_l + add ebx,ted_wnd_w + shl ebx,16 + mov bx,word[esi+sb_offs_size_x] + inc bx + int 0x40 + + cmp ted_fun_draw_panels,0 + je @f + stdcall ted_fun_draw_panels, edi + @@: + popad + ret +endp + +;input: +; edi = pointer to tedit struct +align 16 +proc ted_draw_main_cursor +pushad + mov eax,SF_DRAW_RECT ;draw cursor + mov ecx,ted_wnd_t ;calc rect -> y0,y1 + add ecx,ted_rec_t + mov edx,ted_cur_y + imul edx,ted_rec_h + add ecx,edx + + shl ecx,16 + add ecx,ted_rec_h + + mov ebx,ted_wnd_l ;calc rect -> x0,x1 + add ebx,ted_rec_l + mov edx,ted_cur_x + imul edx,ted_rec_w + add ebx,edx + shl ebx,16 + add ebx,ted_rec_w + cmp ted_cur_ins,1 ;஢ઠ ० ࠡ ( ⠢) + jne @f + shr bx,2 ;㬥蠥 ਭ + @@: + + mov edx,ted_color_cursor + int 0x40 ;뢮 + + call ted_get_pos_by_cursor + cmp ted_gp_opt,2 + jne @f + mov esi,1 + ror ecx,16 + mov bx,cx + add ebx,0x10001 + mov ecx,ted_color_cur_text + or ecx,ted_font_size + call ted_convert_invis_symb + mcall SF_DRAW_TEXT + @@: + + mov ebx,ted_wnd_l + add ebx,ted_rec_l + shl ebx,16 + add ebx,ted_wnd_t + add ebx,3 + mov ecx,ted_color_wnd_bord + or ecx,0x80000000 + lea edx,[txtRow] + mcall SF_DRAW_TEXT ;뢮 'ப' + + add ebx,0x500000 + lea edx,[txtCol] + int 0x40 ;뢮 '' + + cmp ted_tim_undo,0 + je @f + add ebx,0x500000 + lea edx,[txtOtm] + int 0x40 + sub ebx,0x500000 + @@: + + call ted_draw_buffer + call ted_draw_help_f1 + + mov eax,47 ;draw cursor coords + mov esi,ted_color_wnd_bord + or esi,0x40000000 + + mov edx,ebx + ror edx,16 + sub edx,35 + ror edx,16 + ;add edx,3 + mov ebx,0x40000 ;Row=... + mov ecx,ted_scr_w + mov ecx,[ecx+sb_offs_position] + add ecx,ted_cur_y + inc ecx + +push edi + mov edi,ted_color_wnd_work + int 0x40 ;뢮 ᫠ ⥪饩 ப +pop edi + + ;mov ebx,0x40000 ;Col=... + mov ecx,ted_scr_h + mov ecx,[ecx+sb_offs_position] + add ecx,ted_cur_x + inc ecx + add edx,0x500000 +push edi + mov edi,ted_color_wnd_work + int 0x40 ;뢮 ᫠ +pop edi + + cmp ted_tim_undo,0 + je @f + mov ecx,ted_tim_undo + add edx,0x500000 + mov edi,ted_color_wnd_work ;⨬ ॣ edi, 㭪樨 㦥 + int 0x40 ;뢮 ᫠ ⬥ ⢨ + @@: + +popad + ret +endp + +;input: +; edi = pointer to tedit struct +align 16 +proc ted_draw_buffer + pushad + + mov eax,ted_buffer + cmp dword[eax],1 ;ᬮਬ ࠧ + jl @f + mov ebx,ted_rec_l + add bx,300 + cmp ebx,ted_wnd_w ;ࠢ न 뢮 ⥪ + jge @f ; + + add ebx,ted_wnd_l + shl ebx,16 + add ebx,ted_wnd_t + add ebx,3 + mov ecx,ted_color_wnd_bord + or ecx,0x40000000 + + mov edx,ted_buffer + add edx,12 + mov esi,edx + mov edi,ted_color_wnd_work ;edi - destroy not pointer to tedit + call tl_strlen + ;cmp eax,0 ; + ;je @f + cmp eax,20 + jle .crop_buf + mov eax,20 ;१ 20 ᨬ + .crop_buf: + mov esi,eax + mcall SF_DRAW_TEXT ;뢮 ᮤন + + sub ebx,50 shl 16 + lea edx,[txtBuf] + mov esi,edx + call tl_strlen + mov esi,eax + xor ecx,0x40000000 ;㡨ࠥ 梥 䮭 + mcall SF_DRAW_TEXT ;뢮 + @@: + popad + ret +endp + +;input: +; edi = pointer to tedit struct +align 16 +proc ted_draw_help_f1 + pushad + cmp ted_rec_t,13 ;쭠 ᮢ ࠢ + jle @f + ;clear place before draw help + mov ebx,ted_wnd_l + add ebx,ted_rec_l + shl ebx,16 + add ebx,ted_wnd_w + sub ebx,ted_rec_l + mov ecx,ted_wnd_t + add ecx,13 + shl ecx,16 + add ecx,9 ;9 - 0- , ⠢ ted_rec_h ࠭ + mcall SF_DRAW_RECT,,,ted_color_wnd_capt + + cmp ted_help_id,-1 + je @f + mov eax,ted_help_id + ColToIndexOffset eax,edx + + ;SetCoordinates + mov ebx,ted_wnd_l + add ebx,ted_rec_l + shl ebx,16 + add ebx,ted_wnd_t + add ebx,13 ;=3+10 + + ;SetTextColor + movzx eax,byte[edx+MAX_COLOR_WORD_LEN+7] + shl eax,2 + mov ecx,ted_text_colors + add ecx,eax + mov ecx,[ecx] + or ecx,0xc0000000 ;SetTextStyles + mov esi,edi + mcall SF_DRAW_TEXT,,,,,ted_color_wnd_work + mov edi,esi + + mov esi,edx + call tl_strlen + + ;*** draw help string *** + mov ecx,ted_color_wnd_bord + or ecx,0x80000000 + mov edx,[edx+MAX_COLOR_WORD_LEN] + or edx,edx + jz @f + add edx,ted_help_text_f1 + inc eax + imul eax,6 ;ਭ ᨬ . + shl eax,16 + add ebx,eax + mcall SF_DRAW_TEXT + @@: + popad + ret +endp + +;input: +; edi = pointer to tedit struct +align 16 +proc ted_draw_line_numbers +pushad + ;top panel with caption + mov ebx,ted_wnd_l + ;add ebx,ted_rec_l + shl ebx,16 + add ebx,ted_wnd_w + ;sub ebx,ted_rec_l + mov edx,ted_color_wnd_work + mov ecx,ted_wnd_t + shl ecx,16 + add ecx,ted_rec_t + mov edx,ted_color_wnd_capt + mcall SF_DRAW_RECT + + ;line numbers + mov ebx,0x40000 ;format + mov ecx,ted_scr_w + mov ecx,[ecx+sb_offs_position] + inc ecx + mov edx,3 + add edx,ted_wnd_l + rol edx,16 + add edx,ted_wnd_t + add edx,ted_rec_t + @@: + +push ebx ecx edx + ;left panel with numbers + mov ebx,ted_wnd_l + shl ebx,16 + add ebx,ted_rec_l + mov ecx,ted_rec_h + rol ecx,16 + mov cx,dx + rol ecx,16 + mov edx,ted_color_wnd_capt + mcall SF_DRAW_RECT ;㥬 אַ㣮쭨 ஬ ப +pop edx ecx ebx + + mov esi,ted_color_wnd_bord + mcall SF_DRAW_NUMBER ;㥬 ப + inc ecx + add edx,ted_rec_h + sub edx,ted_wnd_t + mov esi,edx + and esi,0xffff + cmp esi,ted_wnd_h + jge @f + add edx,ted_wnd_t + jmp @b +align 4 + @@: +popad + ret +endp + +;output: +; ah = symbol +align 16 +proc KeyConvertToASCII uses ebx, table:dword + mov ebx,[table] ;convert scan to ascii + shr ax,8 + add bx,ax ;? ebx,eax + mov ah,byte[ebx] + ret +endp + +align 16 +proc ted_draw_cur_line, edit:dword +pushad + mov edi,[edit] + + mov ebx,ted_wnd_l + add ebx,ted_rec_l + shl ebx,16 + mov eax,ted_cur_y + imul eax,ted_rec_h + mov bx,ax + add ebx,ted_wnd_t + add ebx,ted_rec_t ;ebx - न אַ㣮쭨 ⪨ + add ebx,0x10001 ;塞 ࠢ 㪢 業 + + call ted_sel_normalize ;need before draw select + mov ecx,ted_cur_y + mov eax,ted_scr_w + add ecx,[eax+sb_offs_position] + stdcall ted_clear_line_before_draw,edi,ebx,1,ecx + + mov eax,ted_scr_h + mov esi,[eax+sb_offs_position] + call ted_get_pos_by_coords + + cmp ted_gp_opt,2 + jne .no_draw_text + call ted_get_symb_color + mov esi,1 ;draw 1 symbol + @@: + ;call ted_iterat_next + cmp edx,ted_tex_1 + jle .no_draw_text + + ; *** 梥⮢ ࠧ⪠ + cmp ted_mode_color,0 + je .no_col_change + cmp byte[edx+1],0 + je .no_col_change + call ted_get_symb_color + .no_col_change: + + mov eax,SF_DRAW_TEXT + cmp byte [edx],13 + jne .no_13 + cmp ted_mode_invis,1 + jne .no_draw_text + push edx + mov edx,edi + add edx,ted_offs_symbol_new_line + int 0x40 + pop edx + jmp .no_draw_text +align 4 + .no_13: + + int 0x40 + ror ebx,16 + add ebx,ted_rec_w + mov eax,ted_wnd_w + add eax,ted_wnd_l ;ax = x + cmp bx,ax + jge .no_draw_text ;Opt + ror ebx,16 + call ted_iterat_next + jmp @b +align 4 + .no_draw_text: + + call ted_draw_main_cursor +popad + ret +endp + +;input: +; clear_o - ᫨ =1 ப, =0 ப +align 16 +proc ted_clear_line_before_draw, edit:dword, coords:dword, clear_o:dword, numb_lin:dword + pushad + mov edi,[edit] + mov ebx,[coords] ;ebx = x*2^16+y coords to left up point clear line + mov esi,[numb_lin] ;esi - number text line + + sub ebx,0x10001 ;⭨ ࠢ 㪢 業 + cmp dword[clear_o],0 + jne @f + add ebx,ted_rec_h + ror ebx,16 + xor bx,bx + add ebx,ted_wnd_l + add ebx,ted_rec_l ;bx = ted_wnd_l+ted_rec_l + ror ebx,16 + @@: + + mov eax,ted_wnd_h + add eax,ted_wnd_t + cmp ax,bx + jl .no_clear + sub ax,bx + + mov cx,bx + shl ecx,16 + + xor bx,bx + add ebx,ted_wnd_w + sub ebx,ted_rec_l + xor cx,cx + add ecx,ted_rec_h + mov edx,ted_color_wnd_work + + cmp dword[clear_o],0 + je .pusto + cmp ax,cx + jge @f + .pusto: + mov cx,ax + jmp .no_select ;᫨ ⪠ , ᥣ 䮭 梥⮬ + @@: + + call ted_is_select + or al,al + jz .no_select + cmp ted_seln_y0,esi + jg .no_select + cmp ted_seln_y1,esi + jl .no_select + mov edx,ted_color_select ;draw selected line + .no_select: + + mcall SF_DRAW_RECT ;᪠ ப 梥⮬ 䮭 梥⮬ 뤥 + + call ted_is_select + or al,al + jz .no_clear + + mov al,SF_DRAW_RECT + xor cx,cx + add ecx,ted_rec_h + cmp ted_seln_y0,esi + jne @f + push bx esi + mov edx,ted_seln_x0 ; (ࠥ ᫥) + mov esi,ted_scr_h + cmp edx,[esi+sb_offs_position] + jle .in_wnd + sub edx,[esi+sb_offs_position] + imul edx,ted_rec_w + mov bx,dx + jmp .no_wnd + .in_wnd: + xor bx,bx + .no_wnd: + mov edx,ted_color_wnd_work + int 0x40 + pop esi bx + @@: + cmp ted_seln_y1,esi + jne @f + ;push esi + ;᫨ 뤥 䠩 ᤥ 室, ⮣ 㦭 jmp .no_select + mov edx,ted_seln_x1 ; (ࠥ ࠢ) + mov esi,ted_scr_h + cmp edx,[esi+sb_offs_position] + jle .in_wnd2 + sub edx,[esi+sb_offs_position] + imul edx,ted_rec_w + sub bx,dx + shl edx,16 + add ebx,edx + .in_wnd2: + mov edx,ted_color_wnd_work + int 0x40 + ;pop esi + @@: + + .no_clear: + popad + ret +endp + +;input: +; edi = pointer to tedit struct +;output: +; ecx = 梥 ᨬ +; edx = pointer to symbol +; edx = 0 if text not in screen +align 16 +ted_get_first_visible_pos: + push eax ecx + mov eax,ted_scr_w + mov edx,ted_tex + xor ecx,ecx + @@: + cmp ecx,[eax+sb_offs_position] + je @f + call ted_iterat_next + cmp edx,ted_tex_1 + jle @f + cmp byte[edx],13 + jne @b + inc ecx + jmp @b +align 4 + @@: + + cmp ecx,[eax+sb_offs_position] + je @f + xor edx,edx + @@: + cmp ecx,[eax+sb_offs_max_area] + jle @f + mov [eax+sb_offs_max_area],ecx + @@: + pop ecx eax + call ted_opt_draw_line_left + ret + +;input: +; edx = pointer to symbol +; edi = pointer to tedit struct +;output: +; ecx = 梥 ᨬ +; edx = 㪠⥫ ᨬ +;description: +; 㭪 㦭 ⨬樨 뢮 ⥪ +align 16 +proc ted_opt_draw_line_left uses ebx + mov ebx,ted_scr_h + mov ebx,[ebx+sb_offs_position] + or ebx,ebx + jz .ret_f + push eax + mov eax,edx + + cmp edx,ted_tex + jne @f + call ted_iterat_next + jmp .beg_cycle + @@: + + or ebx,ebx + jz @f + + cmp byte[edx],13 + jne @f + call ted_iterat_next + .beg_cycle: + @@: + cmp edx,ted_tex_1 + jle @f + cmp byte[edx],13 + je @f + or ebx,ebx + jz @f +;-------------------------------------- +;eax 㤥 +movzx eax,byte[edx+1] +or eax,eax +jz .no_color +cmp eax,ted_colors_text_count +jge .no_color + movzx ecx,byte[edx+1] + shl ecx,2 + add ecx,ted_text_colors + mov ecx,[ecx] +.no_color: +;-------------------------------------- + mov eax,edx + call ted_iterat_next + dec ebx + jmp @b +align 4 + @@: + mov edx,eax + pop eax + .ret_f: + call ted_get_symb_color + ret +endp + +;input: +; edx = pointer to symbol +; edi = pointer to tedit struct +;output: +; ecx = symbol color +; edx = pointer to 13 symbol +;description: +; 㭪 㦭 ⨬樨 뢮 ⥪ +align 16 +proc ted_opt_draw_line_right uses eax + mov eax,edx + @@: + cmp edx,ted_tex_1 + jle @f + cmp byte[edx],13 + je @f + mov eax,edx + call ted_iterat_next + jmp @b + @@: + mov edx,eax ;perv sumbol + call ted_get_symb_color + ret +endp + +align 16 +proc ted_mouse, edit:dword + pushad + mov edi,[edit] + + ;ࠡ뢠 ஫ + mov edx,ted_scr_h + mov ecx,ted_scr_w + + cmp word[edx+sb_offs_delta2],0 + jne .horizontal + + mov eax,[ecx+sb_offs_max_area] + cmp eax,[ecx+sb_offs_cur_area] + jbe .horizontal + ; mouse event for Vertical ScrollBar + stdcall scroll_bar_vertical.mouse,ecx ;[scrollbar_ver_mouse] + cmp dword[ecx+sb_offs_redraw],0 + je @f + mov dword[ecx+sb_offs_redraw],0 + stdcall ted_draw,edi + jmp .no_in_wnd + @@: + cmp word[ecx+sb_offs_delta2],0 + jne .no_in_wnd + .horizontal: + mov eax,[edx+sb_offs_max_area] + cmp eax,[edx+sb_offs_cur_area] + jbe .other + ; mouse event for Horizontal ScrollBar + stdcall scroll_bar_horizontal.mouse,edx ;[scrollbar_hor_mouse] + cmp dword[edx+sb_offs_redraw],0 + je .other + mov dword[edx+sb_offs_redraw],0 + stdcall ted_draw,edi + jmp .no_in_wnd + .other: + cmp word[ecx+sb_offs_delta2],0 + jne .no_in_wnd + cmp word[edx+sb_offs_delta2],0 + jne .no_in_wnd + + ;ࠡ뢠 । + mcall SF_MOUSE_GET,SSF_BUTTON + cmp al,1 + jne @f + mcall SF_MOUSE_GET,SSF_WINDOW_POSITION + mov ebx,ted_wnd_t + add ebx,ted_rec_t + cmp ax,bx + jl @f ;y_mousey_wnd + + mov ebx,ted_wnd_l + add ebx,ted_rec_l + mov ecx,eax + shr ecx,16 + cmp cx,bx + jl @f ;x_mousex_wnd + + call ted_draw_cursor_sumb + call ted_wnd_main_click + jmp .no_in_wnd + @@: + mov edx,ted_el_focus + cmp [edx],edi + jne @f + call ted_wnd_main_mouse_scroll ;ᬮਬ ப + @@: + cmp ted_drag_m,0 + je .no_in_wnd + mov ted_drag_m,0 + stdcall ted_draw,edi + cmp ted_fun_draw_panel_buttons,0 + je .no_in_wnd + call ted_fun_draw_panel_buttons + .no_in_wnd: + popad + ret +endp + +;input: +; eax -> (x,y) +; edi -> 㪠⥫ tedit +;description: +; 㭪 뢥 ⨨ ஬ । +align 16 +ted_wnd_main_click: + push ebx ecx edx + mov ebx,ted_el_focus + mov [ebx],edi ;⠢ 䮪 + + push eax + shr eax,16 + sub eax,ted_wnd_l + sub eax,ted_rec_l + + xor edx,edx + mov ecx,ted_rec_w + div cx + ;inc eax + mov ebx,ted_scr_h + cmp eax,[ebx+sb_offs_cur_area] + jle @f + mov eax,[ebx+sb_offs_cur_area] + @@: + ;dec eax + mov ted_cur_x,eax + pop eax + + push eax + and eax,0xffff + sub eax,ted_wnd_t + sub eax,ted_rec_t + + xor edx,edx + mov ecx,ted_rec_h + div cx + inc eax + mov ebx,ted_scr_w + cmp eax,[ebx+sb_offs_cur_area] + jle @f + mov eax,[ebx+sb_offs_cur_area] + @@: + dec eax + mov ted_cur_y,eax + pop eax + + cmp ted_drag_m,0 + je @f + call ted_sel_move + jmp .sel_move + @@: + mov ted_drag_m,1 + call ted_sel_start + .sel_move: + pop edx ecx ebx + ret + +;input: +; edi = pointer to tedit struct +align 16 +ted_wnd_main_mouse_scroll: + push eax ebx ecx + mcall SF_MOUSE_GET,SSF_SCROLL_DATA + or ax,ax + jz .no_scroll + mov ecx,ted_scr_w + movsx eax,ax + lea eax,[eax+eax*2] ;㬭 3 (᫮ ப ப⪨ ) + add eax,[ecx+sb_offs_position] + mov ebx,[ecx+sb_offs_max_area] + shl ebx,1 + sub ebx,[ecx+sb_offs_cur_area] ;⭨ + shr ebx,1 + cmp eax,ebx + jae .no_scroll + mov ebx,ted_cur_y ; + sub ebx,eax ;- ஫ + add ebx,[ecx+sb_offs_position] ;+ ஫ + bt ebx,31 + jnc @f + xor ebx,ebx ;᫨ ⠫ , ⠢ ப + @@: + inc ebx + cmp ebx,[ecx+sb_offs_cur_area] + jle @f + mov ebx,[ecx+sb_offs_cur_area] ;᫨ ⠫ , ⠢ ப + @@: + dec ebx + mov ted_cur_y,ebx + mov [ecx+sb_offs_position],eax + stdcall ted_draw,edi + .no_scroll: + pop ecx ebx eax + ret + +align 16 +proc ted_save_file, edit:dword, file:dword, f_name:dword +pushad + mov edi,[edit] + + stdcall ted_can_save,edi + ;or al,al + ;jz .no_save + + mov ecx,ted_max_chars + invoke mem.alloc,ecx + push eax ; 㪠⥫ 뤥 + + mov edx,ted_tex + xor ecx,ecx + @@: + call ted_iterat_next + cmp edx,ted_tex_1 + jle @f ;edx = ted_tex or edx = ted_tex+sizeof.symbol + mov bl,[edx] + mov byte[eax],bl + inc eax + inc ecx + jmp @b +align 4 + @@: + + or ecx,ecx + jz @f + mov ebx,[file] + pop eax ;뢠 㪠⥫ 뤥 + mov [ebx+16],eax + push eax ;⭮ 㪠⥫ 뤥 + mov dword[ebx], SSF_CREATE_FILE + mov dword[ebx+4], 0 + mov dword[ebx+8], 0 + mov [ebx+12], ecx + mov byte[ebx+20], 0 + push dword[f_name] + pop dword[ebx+21] + mcall SF_FILE + + mov ted_err_save,al + + or eax,eax + jz .no_msg + cmp ax,10 + jl .zifra_0_9 + mov al,'?' + sub ax,48 + .zifra_0_9: + add ax,48 + cmp ted_fun_save_err,0 + je @f + call ted_fun_save_err + jmp @f + .no_msg: + m2m ted_tim_ls,ted_tim_ch + @@: + + pop ecx ;뢠 㪠⥫ 뤥 + invoke mem.free,ecx + .no_save: +popad + ret +endp diff --git a/programs/develop/str_double/trunk/str_double.asm b/programs/develop/str_double/trunk/str_double.asm index 7ad683ab20..170d433e13 100644 --- a/programs/develop/str_double/trunk/str_double.asm +++ b/programs/develop/str_double/trunk/str_double.asm @@ -1,318 +1,318 @@ -; ணࠬ ८ࠧ ᥫ ப -; ଠ float, double, ⠪ 10 16 筮 -; float. -; ᭮ hex2dec2bin ਬ஢ 䠩 list2_05.inc -; ( 㫠 쥢 24.05.2002), -; ChE । 16 32 ᥬ fasm. -; ணࠬ ⠪ : -; 1) ᫮ ப ॢ 4 (float) 設 -; 2) ᫮ ப ॢ 8 (double) 設 -; 3) ᫮ 設 (float) ॢ ப (5 ᫥ ⮩) - -use32 - org 0 - db 'MENUET01' - dd 1,start,i_end,e_end,e_end,0,sys_path - -include '../../../proc32.inc' -include '../../../macros.inc' -include '../../../KOSfuncs.inc' -include '../../../load_lib.mac' -include '../../../develop/libraries/box_lib/trunk/box_lib.mac' -include '../../../develop/info3ds/info_fun_float.inc' -include 'lang.inc' - -@use_library - -align 4 -start: - load_libraries l_libs_start,l_libs_end - ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ - mov ebp,lib_0 - cmp dword[ebp+ll_struc_size-4],0 - jz @f - mcall SF_TERMINATE_PROCESS - @@: - mcall SF_SET_EVENTS_MASK,0xC0000027 - mcall SF_STYLE_SETTINGS,SSF_GET_COLORS, sys_colors, sizeof.system_colors - edit_boxes_set_sys_color edit1,editboxes_end,sys_colors - option_boxes_set_sys_color sys_colors,Option_boxes1 - -align 4 -red: - call draw_window - -align 4 -still: - mcall SF_WAIT_EVENT - - cmp eax,1 ; ᮢ ? - je red ; ᫨ - red - cmp eax,2 ; ? - je key ; ᫨ - key - cmp eax,3 ; ? - je button ; ᫨ - button - cmp eax,6 - je mouse - - jmp still ; ᫨ 㣮 ᮡ⨥ - 砫 横 - -align 4 -key: ; - mcall SF_GET_KEY - ;cmp ah,13 - stdcall [edit_box_key], edit1 - jmp still ; 砫 横 - -align 4 -button: - mcall SF_GET_BUTTON - cmp ah, 1 ; ᫨ ஬ 1, - jne @f - mcall SF_TERMINATE_PROCESS - @@: - cmp ah, 5 - jne @f - cmp dword[option_group1],opt3 - jne .opt_3_end - stdcall conv_str_to_int,[edit1.text] - mov dword[Data_Double],eax - finit - fld dword[Data_Double] - fstp qword[Data_Double] - - ; Data_Double - ८ࠧ㥬 ᫮ - mov word[NumberSymbolsAD],8 ; ⢮ ᫠ ᫥ ⮩ (1-17) - call DoubleFloat_to_String - call String_crop_0 - mov dword[Data_Double],eax ;⠭ 祭 ଠ float - jmp .opt_all_end - .opt_3_end: - - mov esi,string1 - mov edi,Data_String - cld - mov ecx,32 - rep movsb - - call String_to_DoubleFloat - cmp dword[option_group1],opt1 - jne .opt_all_end ;᫨ ࠭ float, ८ࠧ㥬 ࠭ 祭 double - finit - fld qword[Data_Double] ;⠥ double - fstp dword[Data_Double] ; 頥 float - .opt_all_end: - jmp red - @@: - jmp still - -align 4 -mouse: - stdcall [edit_box_mouse], edit1 - stdcall [option_box_mouse], Option_boxes1 - jmp still - -;------------------------------------------------ -align 4 -draw_window: - mcall SF_STYLE_SETTINGS,SSF_GET_COLORS, sys_colors, sizeof.system_colors - - mcall SF_REDRAW,SSF_BEGIN_DRAW - mov edx, 0x14000000 - or edx, [sys_colors.work] - mcall SF_CREATE_WINDOW, (200 shl 16)+300, (200 shl 16)+175, ,,title - - mcall SF_DEFINE_BUTTON, ((300-53) shl 16)+38, (145 shl 16)+15, 5, [sys_colors.work_button] ; Ok - - mov ecx, 0x80000000 - or ecx, [sys_colors.work_text] - mcall SF_DRAW_TEXT, (15 shl 16) +30,, binstr, - mcall , (15 shl 16) +58,, decstr, - mcall , ((240-56*3) shl 16) +58,, Data_String, - mcall , (15 shl 16) +72,, hexstr, - mcall , (15 shl 16)+150,, numstr, - - mov ecx, 0x80000000 - or ecx, [sys_colors.work_button_text] - mcall , ((300-42) shl 16)+149, , Okstr,3 - - cmp dword[option_group1],opt1 - je @f ;᫨ ࠭ float, 訥 4 ( double) ⠥ - cmp dword[option_group1],opt3 - je @f ;᫨ ࠭ float, 訥 4 ( double) ⠥ - mov ecx, dword[Data_Double+4] - mcall SF_DRAW_NUMBER, (8 shl 16)+256,,(185 shl 16)+72,[sys_colors.work_text] ; 16- - - mov ecx, dword[Data_Double+4] - mcall ,(8 shl 16)+512,,(240 shl 16)+30, ; 2- - ror ecx, 8 - mcall ,,,((240-56) shl 16)+30, - ror ecx, 8 - mcall ,,,((240-56*2) shl 16)+30, - ror ecx, 8 - mcall ,,,((240-56*3) shl 16)+30, - ror ecx, 8 - @@: - - mov ecx,dword[Data_Double] - mcall SF_DRAW_NUMBER, (8 shl 16)+256,,(240 shl 16)+72,[sys_colors.work_text] ; 16- - - mov ecx,dword[Data_Double] - mcall , (8 shl 16)+512,,(240 shl 16)+44, ; 2- - ror ecx, 8 - mcall ,,,((240-56) shl 16)+44, - ror ecx, 8 - mcall ,,,((240-56*2) shl 16)+44, - ror ecx, 8 - mcall ,,,((240-56*3) shl 16)+44, - ror ecx, 8 - - mcall SF_DRAW_LINE, (15 shl 16)+300-15, (137 shl 16)+137, [sys_colors.work_graph] - stdcall [edit_box_draw], edit1 - stdcall [option_box_draw], Option_boxes1 - mcall SF_REDRAW,SSF_END_DRAW - -ret - - -string1 db 32 dup (0) -string1_end: - - -;input: -; buf - 㪠⥫ ப, ᫮ 10 16 筮 -;output: -; eax - ᫮ -align 4 -proc conv_str_to_int uses ebx ecx esi, buf:dword - xor eax,eax - 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 - @@: - ret -endp - -;------------------------------------------------- -title db 'string to double 03.01.21',0 -hexstr db 'hex:',0 -decstr db 'dec:',0 -binstr db 'bin:',0 - -if lang eq ru_RU - numstr db '᫮:',0 - Okstr db '',0 -else - numstr db 'Number:',0 - Okstr db 'Ok',0 -end if - -mouse_dd dd 0 -edit1 edit_box 182, 59, 146, 0xffffff, 0xff, 0x80ff, 0, 0x8000, (string1_end-string1), string1, mouse_dd, 0 -editboxes_end: - -;option_boxes -opt1 option_box option_group1, 15, 90, 8, 12, 0xffffff, 0x80ff, 0, op_text.1, 17 -opt2 option_box option_group1, 15, 106, 8, 12, 0xffffff, 0x80ff, 0, op_text.2, 18 -opt3 option_box option_group1, 15, 122, 8, 12, 0xffffff, 0x80ff, 0, op_text.3, 21 - -op_text: ;⥪ ࠤ - .1 db 'str(dec) -> float' - .2 db 'str(dec) -> double' - .3 db 'float(dec,hex) -> str' -;㪠⥫ option_box -option_group1 dd opt1 -Option_boxes1 dd opt1, opt2, opt3, 0 - -system_dir_0 db '/sys/lib/' -lib_name_0 db 'box_lib.obj',0 - - -l_libs_start: - lib_0 l_libs lib_name_0, library_path, system_dir_0,import_box_lib -l_libs_end: - -align 4 -import_box_lib: - ;dd sz_init1 - 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 - option_box_draw dd aOption_box_draw - option_box_mouse dd aOption_box_mouse - ;version_op dd aVersion_op -dd 0,0 - ;sz_init1 db 'lib_init',0 - sz_edit_box_draw db 'edit_box_draw',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 - aOption_box_draw db 'option_box_draw',0 - aOption_box_mouse db 'option_box_mouse',0 - ;aVersion_op db 'version_op',0 - -i_end: - sys_colors system_colors -align 16 - sys_path rb 4096 - library_path rb 4096 - rb 0x400 ;stack -e_end: ; ⪠ ணࠬ +; ணࠬ ८ࠧ ᥫ ப +; ଠ float, double, ⠪ 10 16 筮 +; float. +; ᭮ hex2dec2bin ਬ஢ 䠩 list2_05.inc +; ( 㫠 쥢 24.05.2002), +; ChE । 16 32 ᥬ fasm. +; ணࠬ ⠪ : +; 1) ᫮ ப ॢ 4 (float) 設 +; 2) ᫮ ப ॢ 8 (double) 設 +; 3) ᫮ 設 (float) ॢ ப (5 ᫥ ⮩) + +use32 + org 0 + db 'MENUET01' + dd 1,start,i_end,e_end,e_end,0,sys_path + +include '../../../proc32.inc' +include '../../../macros.inc' +include '../../../KOSfuncs.inc' +include '../../../load_lib.mac' +include '../../../develop/libraries/box_lib/trunk/box_lib.mac' +include '../../../develop/info3ds/info_fun_float.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. + +@use_library + +align 4 +start: + load_libraries l_libs_start,l_libs_end + ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ + mov ebp,lib_0 + cmp dword[ebp+ll_struc_size-4],0 + jz @f + mcall SF_TERMINATE_PROCESS + @@: + mcall SF_SET_EVENTS_MASK,0xC0000027 + mcall SF_STYLE_SETTINGS,SSF_GET_COLORS, sys_colors, sizeof.system_colors + edit_boxes_set_sys_color edit1,editboxes_end,sys_colors + option_boxes_set_sys_color sys_colors,Option_boxes1 + +align 4 +red: + call draw_window + +align 4 +still: + mcall SF_WAIT_EVENT + + cmp eax,1 ; ᮢ ? + je red ; ᫨ - red + cmp eax,2 ; ? + je key ; ᫨ - key + cmp eax,3 ; ? + je button ; ᫨ - button + cmp eax,6 + je mouse + + jmp still ; ᫨ 㣮 ᮡ⨥ - 砫 横 + +align 4 +key: ; + mcall SF_GET_KEY + ;cmp ah,13 + stdcall [edit_box_key], edit1 + jmp still ; 砫 横 + +align 4 +button: + mcall SF_GET_BUTTON + cmp ah, 1 ; ᫨ ஬ 1, + jne @f + mcall SF_TERMINATE_PROCESS + @@: + cmp ah, 5 + jne @f + cmp dword[option_group1],opt3 + jne .opt_3_end + stdcall conv_str_to_int,[edit1.text] + mov dword[Data_Double],eax + finit + fld dword[Data_Double] + fstp qword[Data_Double] + + ; Data_Double - ८ࠧ㥬 ᫮ + mov word[NumberSymbolsAD],8 ; ⢮ ᫠ ᫥ ⮩ (1-17) + call DoubleFloat_to_String + call String_crop_0 + mov dword[Data_Double],eax ;⠭ 祭 ଠ float + jmp .opt_all_end + .opt_3_end: + + mov esi,string1 + mov edi,Data_String + cld + mov ecx,32 + rep movsb + + call String_to_DoubleFloat + cmp dword[option_group1],opt1 + jne .opt_all_end ;᫨ ࠭ float, ८ࠧ㥬 ࠭ 祭 double + finit + fld qword[Data_Double] ;⠥ double + fstp dword[Data_Double] ; 頥 float + .opt_all_end: + jmp red + @@: + jmp still + +align 4 +mouse: + stdcall [edit_box_mouse], edit1 + stdcall [option_box_mouse], Option_boxes1 + jmp still + +;------------------------------------------------ +align 4 +draw_window: + mcall SF_STYLE_SETTINGS,SSF_GET_COLORS, sys_colors, sizeof.system_colors + + mcall SF_REDRAW,SSF_BEGIN_DRAW + mov edx, 0x14000000 + or edx, [sys_colors.work] + mcall SF_CREATE_WINDOW, (200 shl 16)+300, (200 shl 16)+175, ,,title + + mcall SF_DEFINE_BUTTON, ((300-53) shl 16)+38, (145 shl 16)+15, 5, [sys_colors.work_button] ; Ok + + mov ecx, 0x80000000 + or ecx, [sys_colors.work_text] + mcall SF_DRAW_TEXT, (15 shl 16) +30,, binstr, + mcall , (15 shl 16) +58,, decstr, + mcall , ((240-56*3) shl 16) +58,, Data_String, + mcall , (15 shl 16) +72,, hexstr, + mcall , (15 shl 16)+150,, numstr, + + mov ecx, 0x80000000 + or ecx, [sys_colors.work_button_text] + mcall , ((300-42) shl 16)+149, , Okstr,3 + + cmp dword[option_group1],opt1 + je @f ;᫨ ࠭ float, 訥 4 ( double) ⠥ + cmp dword[option_group1],opt3 + je @f ;᫨ ࠭ float, 訥 4 ( double) ⠥ + mov ecx, dword[Data_Double+4] + mcall SF_DRAW_NUMBER, (8 shl 16)+256,,(185 shl 16)+72,[sys_colors.work_text] ; 16- + + mov ecx, dword[Data_Double+4] + mcall ,(8 shl 16)+512,,(240 shl 16)+30, ; 2- + ror ecx, 8 + mcall ,,,((240-56) shl 16)+30, + ror ecx, 8 + mcall ,,,((240-56*2) shl 16)+30, + ror ecx, 8 + mcall ,,,((240-56*3) shl 16)+30, + ror ecx, 8 + @@: + + mov ecx,dword[Data_Double] + mcall SF_DRAW_NUMBER, (8 shl 16)+256,,(240 shl 16)+72,[sys_colors.work_text] ; 16- + + mov ecx,dword[Data_Double] + mcall , (8 shl 16)+512,,(240 shl 16)+44, ; 2- + ror ecx, 8 + mcall ,,,((240-56) shl 16)+44, + ror ecx, 8 + mcall ,,,((240-56*2) shl 16)+44, + ror ecx, 8 + mcall ,,,((240-56*3) shl 16)+44, + ror ecx, 8 + + mcall SF_DRAW_LINE, (15 shl 16)+300-15, (137 shl 16)+137, [sys_colors.work_graph] + stdcall [edit_box_draw], edit1 + stdcall [option_box_draw], Option_boxes1 + mcall SF_REDRAW,SSF_END_DRAW + +ret + + +string1 db 32 dup (0) +string1_end: + + +;input: +; buf - 㪠⥫ ப, ᫮ 10 16 筮 +;output: +; eax - ᫮ +align 4 +proc conv_str_to_int uses ebx ecx esi, buf:dword + xor eax,eax + 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 + @@: + ret +endp + +;------------------------------------------------- +title db 'string to double 03.01.21',0 +hexstr db 'hex:',0 +decstr db 'dec:',0 +binstr db 'bin:',0 + +if lang eq ru_RU + numstr db '᫮:',0 + Okstr db '',0 +else ; Default to en_US + numstr db 'Number:',0 + Okstr db 'Ok',0 +end if + +mouse_dd dd 0 +edit1 edit_box 182, 59, 146, 0xffffff, 0xff, 0x80ff, 0, 0x8000, (string1_end-string1), string1, mouse_dd, 0 +editboxes_end: + +;option_boxes +opt1 option_box option_group1, 15, 90, 8, 12, 0xffffff, 0x80ff, 0, op_text.1, 17 +opt2 option_box option_group1, 15, 106, 8, 12, 0xffffff, 0x80ff, 0, op_text.2, 18 +opt3 option_box option_group1, 15, 122, 8, 12, 0xffffff, 0x80ff, 0, op_text.3, 21 + +op_text: ;⥪ ࠤ + .1 db 'str(dec) -> float' + .2 db 'str(dec) -> double' + .3 db 'float(dec,hex) -> str' +;㪠⥫ option_box +option_group1 dd opt1 +Option_boxes1 dd opt1, opt2, opt3, 0 + +system_dir_0 db '/sys/lib/' +lib_name_0 db 'box_lib.obj',0 + + +l_libs_start: + lib_0 l_libs lib_name_0, library_path, system_dir_0,import_box_lib +l_libs_end: + +align 4 +import_box_lib: + ;dd sz_init1 + 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 + option_box_draw dd aOption_box_draw + option_box_mouse dd aOption_box_mouse + ;version_op dd aVersion_op +dd 0,0 + ;sz_init1 db 'lib_init',0 + sz_edit_box_draw db 'edit_box_draw',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 + aOption_box_draw db 'option_box_draw',0 + aOption_box_mouse db 'option_box_mouse',0 + ;aVersion_op db 'version_op',0 + +i_end: + sys_colors system_colors +align 16 + sys_path rb 4096 + library_path rb 4096 + rb 0x400 ;stack +e_end: ; ⪠ ணࠬ diff --git a/programs/develop/tinypad/trunk/data/tp-locale.inc b/programs/develop/tinypad/trunk/data/tp-locale.inc index c8a6d58705..b9bd4f183e 100644 --- a/programs/develop/tinypad/trunk/data/tp-locale.inc +++ b/programs/develop/tinypad/trunk/data/tp-locale.inc @@ -1,491 +1,501 @@ - -sz htext,'TINYPAD ',APP_VERSION - -menubar_res main_menu,\ - ru,'' ,mm.File ,onshow.file ,\ - ru,'ࠢ' ,mm.Edit ,onshow.edit ,\ - ru,'' ,mm.Search ,onshow.search ,\ - ru,'' ,mm.Run ,onshow.run ,\ - ru,'஢',mm.Encoding,onshow.recode ,\ - ru,'樨' ,mm.Options ,onshow.options,\ -\ - en,'File' ,mm.File ,onshow.file ,\ - en,'Edit' ,mm.Edit ,onshow.edit ,\ - en,'Search' ,mm.Search ,onshow.search ,\ - en,'Run' ,mm.Run ,onshow.run ,\ - en,'Encoding' ,mm.Encoding,onshow.recode ,\ - en,'Options' ,mm.Options ,onshow.options,\ -\ - it,'File' ,mm.File ,onshow.file ,\ - it,'Modificare' ,mm.Edit ,onshow.edit ,\ - it,'Ricerca' ,mm.Search ,onshow.search ,\ - it,'Correre' ,mm.Run ,onshow.run ,\ - it,'Codifica' ,mm.Encoding,onshow.recode ,\ - it,'Opzioni' ,mm.Options ,onshow.options,\ -\ - et,'Fail' ,mm.File ,onshow.file ,\ - et,'Muuda' ,mm.Edit ,onshow.edit ,\ - et,'Otsi' ,mm.Search ,onshow.search ,\ - et,'Kivita' ,mm.Run ,onshow.run ,\ - et,'Kodeering',mm.Encoding,onshow.recode ,\ - et,'Seaded' ,mm.Options ,onshow.options,\ -\ - sp,'Archivo' ,mm.File ,onshow.file ,\ - sp,'Editar' ,mm.Edit ,onshow.edit ,\ - sp,'Buscar' ,mm.Search ,onshow.search ,\ - sp,'Ejecutar' ,mm.Run ,onshow.run ,\ - sp,'Codificacin',mm.Encoding,onshow.recode,\ - sp,'Opciones' ,mm.Options ,onshow.options - -popup_res mm.File,\ - ru,'' ,'Ctrl+N' ,New ,\ - ru,'...','Ctrl+O' ,Open ,\ - ru,'࠭' ,'Ctrl+S' ,Save ,\ - ru,'࠭ ...','Ctrl+Shift+S',SaveAs,\ - ru,'-','',,\ - ru,'' ,'Ctrl+F4' ,Close ,\ - ru,'-','',,\ - ru,'室' ,'Alt+X' ,Exit ,\ -\ - en,'New' ,'Ctrl+N' ,New ,\ - en,'Open...' ,'Ctrl+O' ,Open ,\ - en,'Save' ,'Ctrl+S' ,Save ,\ - en,'Save as...','Ctrl+Shift+S',SaveAs ,\ - en,'-','',,\ - en,'Close' ,'Ctrl+F4' ,Close ,\ - en,'-','',,\ - en,'Exit' ,'Alt+X' ,Exit ,\ -\ - it,'Nuovo' ,'Ctrl+N' ,New ,\ - it,'Aperto...' ,'Ctrl+O' ,Open ,\ - it,'Salva' ,'Ctrl+S' ,Save ,\ - it,'Salva come...','Ctrl+Shift+S',SaveAs ,\ - it,'-','',,\ - it,'Chiudi' ,'Ctrl+F4' ,Close ,\ - it,'-','',,\ - it,'Uscita' ,'Alt+X' ,Exit ,\ -\ - et,'Uus' ,'Ctrl+N' ,New ,\ - et,'Ava...' ,'Ctrl+O' ,Open ,\ - et,'Salvesta' ,'Ctrl+S' ,Save ,\ - et,'Salvesta nimega...','Ctrl+Shift+S',SaveAs,\ - et,'-','',,\ - et,'Sulge' ,'Ctrl+F4' ,Close ,\ - et,'-','',,\ - et,'Vlju' ,'Alt+X' ,Exit ,\ -\ - sp,'Nuevo' ,'Ctrl+N' ,New ,\ - sp,'Abrir...' ,'Ctrl+O' ,Open ,\ - sp,'Guardar' ,'Ctrl+S' ,Save ,\ - sp,'Guardar como...','Ctrl+Shift+S',SaveAs,\ - sp,'-','',,\ - sp,'Cerrar' ,'Ctrl+F4',Close,\ - sp,'-','',,\ - sp,'Salir' ,'Alt+X' ,Exit - -popup_res mm.Edit,\ - ru,'१' ,'Ctrl+X',Cut ,\ - ru,'஢' ,'Ctrl+C',Copy ,\ - ru,'⠢' ,'Ctrl+V',Insert,\ - ru,'' ,'' ,Delete,\ - ru,'-','',,\ - ru,'뤥 ' ,'Ctrl+A',SelAll,\ -\ - en,'Cut' ,'Ctrl+X',Cut ,\ - en,'Copy' ,'Ctrl+C',Copy ,\ - en,'Paste' ,'Ctrl+V',Insert,\ - en,'Delete' ,'' ,Delete,\ - en,'-','',,\ - en,'Select all','Ctrl+A',SelAll,\ -\ - it,'Taglio' ,'Ctrl+X',Cut ,\ - it,'Copia' ,'Ctrl+C',Copy ,\ - it,'Incolla' ,'Ctrl+V',Insert,\ - it,'Elimina' ,'' ,Delete,\ - it,'-','',,\ - it,'Seleziona tutto','Ctrl+A',SelAll,\ -\ - et,'Lika' ,'Ctrl+X',Cut ,\ - et,'Kopeeri' ,'Ctrl+C',Copy ,\ - et,'Kleebi' ,'Ctrl+V',Insert,\ - et,'Kustuta' ,'' ,Delete,\ - et,'-','',,\ - et,'Vali kik','Ctrl+A',SelAll,\ -\ - sp,'Cortar' ,'Ctrl+X',Cut ,\ - sp,'Copiar' ,'Ctrl+C',Copy ,\ - sp,'Pegar' ,'Ctrl+V',Insert,\ - sp,'Eliminar' ,'' ,Delete,\ - sp,'-','',,\ - sp,'Seleccionar todo','Ctrl+A',SelAll - -popup_res mm.Search,\ - ru,'३...' ,'Ctrl+G',Position,\ - ru,'-','',,\ - ru,'...' ,'Ctrl+F',Find ,\ - ru,' ','F3' ,FindNext,\ - ru,'...','Ctrl+H',Replace ,\ -\ - en,'Position...','Ctrl+G',Position,\ - en,'-','',,\ - en,'Find...' ,'Ctrl+F',Find ,\ - en,'Find next' ,'F3' ,FindNext,\ - en,'Replace...' ,'Ctrl+H',Replace ,\ -\ - it,'Posizione...','Ctrl+G',Position,\ - it,'-','',,\ - it,'Trova...' ,'Ctrl+F',Find ,\ - it,'Trova il prossimo' ,'F3' ,FindNext,\ - it,'Sostituire...' ,'Ctrl+H',Replace ,\ -\ - et,'Positsioon...','Ctrl+G',Position,\ - et,'-','',,\ - et,'Leia...' ,'Ctrl+F',Find ,\ - et,'Leia jrgmine','F3' ,FindNext,\ - et,'Asenda...' ,'Ctrl+H',Replace ,\ -\ - sp,'Posicin...' ,'Ctrl+G',Position,\ - sp,'-','',,\ - sp,'Buscar...' ,'Ctrl+F',Find ,\ - sp,'Buscar siguiente','F3' ,FindNext,\ - sp,'Reemplazar...','Ctrl+H',Replace - -popup_res mm.Run,\ - ru,'' ,'F9' ,Run ,\ - ru,' ','F10',Debug ,\ - ru,'஢' ,'Ctrl+F9',Compile ,\ - ru,'-','',,\ - ru,'᪠ ⫠' ,'' ,DbgBoard,\ - ru,'⥬ 㭪樨','' ,SysFuncs,\ -\ - en,'Run' ,'F9' ,Run ,\ - en,'Run in debugger' ,'F10' ,Debug ,\ - en,'Compile' ,'Ctrl+F9',Compile ,\ - en,'-','',,\ - en,'Debug board' ,'' ,DbgBoard,\ - en,'System functions' ,'' ,SysFuncs,\ -\ - it,'Correre' ,'F9' ,Run ,\ - it,'Esegui nel debugger','F10',Debug ,\ - it,'Compilare','Ctrl+F9',Compile ,\ - it,'-','',,\ - it,'Scheda di debug' ,'' ,DbgBoard,\ - it,'Funzioni di sistema','' ,SysFuncs,\ -\ - et,'Kivita' ,'F9' ,Run ,\ - et,'Kivita aastal siluri','F10',Debug ,\ - et,'Kompileeri' ,'Ctrl+F9',Compile ,\ - et,'-','',,\ - et,'Silumis paneel' ,'' ,DbgBoard,\ - et,'Ssteemi funktsioonid','' ,SysFuncs,\ -\ - sp,'Ejecutar' ,'F9' ,Run ,\ - sp,'Ejecutar en el depurador','F10',Debug,\ - sp,'Compilar' ,'Ctrl+F9',Compile ,\ - sp,'-','',,\ - sp,'Depuracin' ,'' ,DbgBoard,\ - sp,'Funciones del sistema' ,'',SysFuncs - -popup_res mm.Encoding,\ - @!,<'CP866 ',0x1A,' CP1251'>,'',CP866.CP1251,\ - @!,<'CP1251 ',0x1A,' CP866' >,'',CP1251.CP866,\ - @!,<'-'>,'',,\ - @!,<'CP866 ',0x1A,' KOI8-R'>,'',CP866.KOI8R ,\ - @!,<'KOI8-R ',0x1A,' CP866' >,'',KOI8R.CP866 ,\ - @!,<'-'>,'',,\ - @!,<'CP1251 ',0x1A,' KOI8-R'>,'',CP1251.KOI8R,\ - @!,<'KOI8-R ',0x1A,' CP1251'>,'',KOI8R.CP1251 - -popup_res mm.Options,\ - ru,'' ,'Ctrl +',ZoomIn ,\ - ru,'' ,'Ctrl -',ZoomOut ,\ - ru,'-','',,\ - ru,' ப' ,'',LineNumbers ,\ - ru,'᭮ 뤥' ,'',SecureSel ,\ - ru,'⮬᪨ ᪮' ,'',AutoBrackets,\ - ru,'⮬᪨ ' ,'',AutoIndents ,\ - ru,'⨬쭮 ࠭' ,'',OptimalFill ,\ - ru,'-','',,\ - ru,'譨 ...' ,'',Appearance ,\ -\ - en,'Zoom in' ,'Ctrl +',ZoomIn ,\ - en,'Zoom out' ,'Ctrl -',ZoomOut ,\ - en,'-','',,\ - en,'Line numbers' ,'',LineNumbers ,\ - en,'Secure selection' ,'',SecureSel ,\ - en,'Automatic brackets' ,'',AutoBrackets,\ - en,'Automatic indents' ,'',AutoIndents ,\ - en,'Optimal fill on saving' ,'',OptimalFill ,\ - en,'-','',,\ - en,'Appearance...' ,'',Appearance ,\ -\ - it,'Ingrandire' ,'Ctrl +',ZoomIn ,\ - it,'Rimpicciolisci' ,'Ctrl -',ZoomOut ,\ - it,'-','',,\ - it,'Numeri di riga' ,'',LineNumbers ,\ - it,'Selezione sicura' ,'',SecureSel ,\ - it,'Staffe automatiche' ,'',AutoBrackets,\ - it,'Rientri automatici' ,'',AutoIndents ,\ - it,'Combina spazi' ,'',OptimalFill ,\ - it,'-','',,\ - it,'Aspetto...' ,'',Appearance ,\ -\ - et,'Zoom in' ,'Ctrl +',ZoomIn ,\ - et,'Zoom out' ,'Ctrl -',ZoomOut ,\ - et,'-','',,\ - et,'Rea numbrid' ,'',LineNumbers ,\ - et,'Turvaline valimine' ,'',SecureSel ,\ - et,'Automaatsed sulud' ,'',AutoBrackets,\ - et,'Automaatsed taandread' ,'',AutoIndents ,\ - et,'Optimaalne titmine salvestamisel','',OptimalFill,\ - et,'-','',,\ - et,'Vlimus...' ,'',Appearance ,\ -\ - sp,'Zoom in' ,'Ctrl +',ZoomIn ,\ - sp,'Zoom out' ,'Ctrl -',ZoomOut ,\ - sp,'-','',,\ - sp,'Nmeros en lneas' ,'',LineNumbers ,\ - sp,'Seleccin segura' ,'',SecureSel ,\ - sp,'Parntesis automticos' ,'',AutoBrackets,\ - sp,'Identacin automtica' ,'',AutoIndents ,\ - sp,'Llenado ptimo al guardar','',OptimalFill ,\ - sp,'-','',,\ - sp,'Apariencia...' ,'',Appearance - -lsz s_defname,\ - ru,<'ﭭ',0>,\ - en,<'Untitled',0>,\ - it,<'Senza titolo',0>,\ - et,<'Nimetu',0>,\ - sp,<'Sin ttulo',0> - -lsz s_modified,\ - ru,'',\ - en,'Modified',\ - it,'Modificato',\ - et,'Muudetud',\ - sp,'Modificado' - -lsz s_2filename,\ - ru,' 䠩:',\ - en,'Filename:',\ - en,'Nome del file:',\ - et,'Faili nimi:',\ - sp,'Nombre de archivo:' -lsz s_2open,\ - ru,'',\ - en,'Open',\ - it,'Aperto',\ - et,'Ava',\ - sp,'Abrir' -lsz s_2save,\ - ru,'࠭',\ - en,'Save',\ - it,'Salva',\ - et,'Salvesta',\ - sp,'Guardar' -lsz s_2save_no,\ - ru,'',\ - en,'No',\ - it,'No',\ - et,'Ei',\ - sp,'No' -lsz s_2find,\ - ru,'',\ - en,'Find',\ - it,'Trova',\ - et,'Leia',\ - sp,'Buscar' -db ':' -lsz s_2replace,\ - ru,'',\ - en,'Replace',\ - it,'Sostituire',\ - et,'Asenda',\ - sp,'Reemplazar' -db ':' -lsz s_2cancel,\ - ru,'⬥',\ - en,'Cancel',\ - it,'Annulla',\ - et,'Thista',\ - sp,'Cancelar' -lsz s_color,\ - ru,': 0x',\ - en,'Color: 0x',\ - it,'Colore: 0x',\ - et,'Vrv: 0x',\ - sp,'Color: 0x' -lsz s_tabpos,\ - ru,'ᯮ ',\ - en,'Tabs placement',\ - it,'Posizionamento delle schede',\ - et,'Saki asetus',\ - sp,'Lugar de tabulador' - -lsz s_enter_filename,\ - ru,<' 䠩',0>,\ - en,<'Enter filename',0>,\ - it,<'Inserisci il nome del file',0>,\ - et,<'Sisesta faili nimi',0>,\ - sp,<'Ingresa el nombre del archivo',0> - -lsz s_ask_save,\ - ru,<' ࠭?',0>,\ - en,<'Would you like to save?',0>,\ - it,<'Vorresti salvare?',0>,\ - et,<'Kas soovite salvestada?',0>,\ ; Now correct - sp,<'Quieres guardar?',0> - -lsz s_enter_text_to_find,\ - ru,<' ⥪ ᪠',0>,\ - en,<'Enter text to find',0>,\ - it,<'Inserisci il testo per trovare',0>,\ - et,<'Sisesta otsitav tekst',0>,\ - sp,<'Ingresa el texto a buscar',0> - -lsz s_enter_text_to_replace,\ - ru,<' ⥪ ',0>,\ - en,<'Enter text to replace',0>,\ - it,<'Inserisci il testo da sostituire',0>,\ - et,<'Sisesta asendatav tekst',0>,\ - sp,<'Ingresa el texto a reemplazar',0> - -lsz s_text_not_found,\ - ru,<'⨣ 䠩, ⥪ ',0>,\ - en,<'Reached end of file, text not found',0>,\ - it,<'Raggiunta la fine del file, testo non trovato',0>,\ - et,<'Faili lpp, teksti ei leitud',0>,\ - sp,<'Se lleg al final del archivo, texto no encontrado',0> - -lszc s_fs_error,b,\ - ru,<' 襭 ᯥ譮 (0)',0>,\ - ru,<'',0>,\ - ru,<'㭪 ন 䠩 ⥬ (2)',0>,\ - ru,<'⭠ 䠩 ⥬ (3)',0>,\ - ru,<'',0>,\ - ru,<' 䠩 (5)',0>,\ - ru,<' 襭 ᯥ譮 (6)',0>,\ - ru,<' 室 ࠭栬 ணࠬ (7)',0>,\ - ru,<' ᪥ ᢮ (8)',0>,\ - ru,<' FAT 㭨⮦ (9)',0>,\ - ru,<' (10)',0>,\ - ru,<'訡 ன⢠ (11)',0>,\ -\ - en,<'Operation executed successfully (0)',0>,\ - en,<'',0>,\ - en,<'Function is not supported for the given filesystem (2)',0>,\ - en,<'Unknown filesystem (3)',0>,\ - en,<'',0>,\ - en,<'Unable to open file (5)',0>,\ - en,<'Operation executed successfully (6)',0>,\ - en,<'Pointer lies outside of application memory (7)',0>,\ - en,<'Disk is full (8)',0>,\ - en,<'FAT table is destroyed (9)',0>,\ - en,<'Access denied (10)',0>,\ - en,<'Device error (11)',0>,\ -\ - it,<'Operazione eseguita correttamente (0)',0>,\ - it,<'',0>,\ - it,<'La funzione non e supportata per il file system specificato (2)', 0>, \ - it,<'Unknown filesystem (3)',0>,\ - it,<'',0>,\ - it,<'Impossibile aprire il file (5)',0>,\ - it,<'Operazione eseguita correttamente (6)',0>,\ - it,<'Il puntatore si trova al di fuori della memoria dell',96,'applicazione (7)', 0>, \ - it,<'Il disco e pieno (8)',0>,\ - it,<'La tabella FAT e distrutta (9)',0>,\ - it,<'Accesso negato (10)',0>,\ - it,<'Errore dispositivo (11)',0>,\ -\ - et,<'Operatsioon kivitati edukalt (0)',0>,\ - et,<'',0>,\ - et,<'Failissteem ei toeta funktsiooni (2)',0>,\ - et,<'Tundmatu failissteem (3)',0>,\ - et,<'',0>,\ - et,<'Faili ei suudetud avada (5)',0>,\ - et,<'Operatsioon kivitatud edukalt (6)',0>,\ - et,<'Viit on vljaspool programmi mlu (7)',0>,\ - et,<'Ketas tis (8)',0>,\ - et,<'FAT tabel hvitatud (9)',0>,\ - et,<'Juurdeps keelatud (10)',0>,\ - et,<'Seadme viga (11)',0>,\ -\ - sp,<'Operacin ejecutada correctamente (0)',0>,\ - sp,<'',0>,\ - sp,<'La funcin no est soportada por el sistema de archivos dado (2)',0>,\ - sp,<'Sistema de archivos desconocido (3)',0>,\ - sp,<'',0>,\ - sp,<'No es posible abrir el archivo (5)',0>,\ - sp,<'Operacin ejecutada correctamente (6)',0>,\ - sp,<'El puntero est fuera de la memoria de la aplicacin (7)',0>,\ - sp,<'El disco est lleno (8)',0>,\ - sp,<'La tabla FAT est destruida (9)',0>,\ - sp,<'Acceso denegado (10)',0>,\ - sp,<'Error de dispositivo (11)',0> - -lszc s_appearance,b,\ - ru,'',\ - ru,'',\ - ru,' 뤥',\ - ru,' 뤥',\ - ru,'',\ - ru,'᫠',\ - ru,'ப',\ - ru,'ਨ',\ - ru,' ப',\ - ru,'࠭ ப',\ -\ - en,'Text',\ - en,'Background',\ - en,'Selection text',\ - en,'Selection background',\ - en,'Symbols',\ - en,'Numbers',\ - en,'Strings',\ - en,'Comments',\ - en,'Modified lines',\ - en,'Saved lines',\ -\ - it,'Testo',\ - it,'Sfondo',\ - it,'Testo di selezione',\ - it,'Sfondo di selezione',\ - it,'Simboli',\ - it,'Numeri',\ - it,'Stringhe',\ - it,'Commenti',\ - it,'Linee modificate',\ - it,'Linee salvate',\ -\ - et,'Tekst',\ - et,'Taust',\ - et,'Valitud tekst',\ - et,'Valitud taust',\ - et,'Smbolid',\ - et,'Numbrid',\ - et,'Stringid',\ - et,'Kommentaarid',\ - et,'Muudetud read',\ - et,'Salvestatud read',\ -\ - sp,'Texto',\ - sp,'Fondo',\ - sp,'Texto de seleccin',\ - sp,'Fondo de seleccin',\ - sp,'Smbolos',\ - sp,'Nmeros',\ - sp,'Cadenas',\ - sp,'Comentarios',\ - sp,'Lneas modificadas',\ - sp,'Lneas guardadas' - -lsz sysfuncs_filename,\ - ru,<'SYSFUNCR.TXT',0>,\ - en,<'SYSFUNCS.TXT',0>,\ - it,<'SYSFUNCS.TXT',0>,\ - et,<'SYSFUNCET.TXT',0>,\ - sp,<'SYSFUNCS.TXT',0> - -sz s_example,'/sys/example.asm' -sz s_still ,'still' + +sz htext,'TINYPAD ',APP_VERSION + +; Language support for locales: ru_RU (CP866), en_US, it_IT, et_EE, es_ES. + +menubar_res main_menu,\ + ru_RU,'' ,mm.File ,onshow.file ,\ + ru_RU,'ࠢ' ,mm.Edit ,onshow.edit ,\ + ru_RU,'' ,mm.Search ,onshow.search ,\ + ru_RU,'' ,mm.Run ,onshow.run ,\ + ru_RU,'஢',mm.Encoding,onshow.recode ,\ + ru_RU,'樨' ,mm.Options ,onshow.options,\ +\ + en_US,'File' ,mm.File ,onshow.file ,\ + en_US,'Edit' ,mm.Edit ,onshow.edit ,\ + en_US,'Search' ,mm.Search ,onshow.search ,\ + en_US,'Run' ,mm.Run ,onshow.run ,\ + en_US,'Encoding' ,mm.Encoding,onshow.recode ,\ + en_US,'Options' ,mm.Options ,onshow.options,\ +\ + it_IT,'File' ,mm.File ,onshow.file ,\ + it_IT,'Modificare' ,mm.Edit ,onshow.edit ,\ + it_IT,'Ricerca' ,mm.Search ,onshow.search ,\ + it_IT,'Correre' ,mm.Run ,onshow.run ,\ + it_IT,'Codifica' ,mm.Encoding,onshow.recode ,\ + it_IT,'Opzioni' ,mm.Options ,onshow.options,\ +\ + et_EE,'Fail' ,mm.File ,onshow.file ,\ + et_EE,'Muuda' ,mm.Edit ,onshow.edit ,\ + et_EE,'Otsi' ,mm.Search ,onshow.search ,\ + et_EE,'Kivita' ,mm.Run ,onshow.run ,\ + et_EE,'Kodeering',mm.Encoding,onshow.recode ,\ + et_EE,'Seaded' ,mm.Options ,onshow.options,\ +\ + es_ES,'Archivo' ,mm.File ,onshow.file ,\ + es_ES,'Editar' ,mm.Edit ,onshow.edit ,\ + es_ES,'Buscar' ,mm.Search ,onshow.search ,\ + es_ES,'Ejecutar' ,mm.Run ,onshow.run ,\ + es_ES,'Codificacin',mm.Encoding,onshow.recode,\ + es_ES,'Opciones' ,mm.Options ,onshow.options + +popup_res mm.File,\ + ru_RU,'' ,'Ctrl+N' ,New ,\ + ru_RU,'...','Ctrl+O' ,Open ,\ + ru_RU,'࠭' ,'Ctrl+S' ,Save ,\ + ru_RU,'࠭ ...','Ctrl+Shift+S',SaveAs,\ + ru_RU,'-','',,\ + ru_RU,'' ,'Ctrl+F4' ,Close ,\ + ru_RU,'-','',,\ + ru_RU,'室' ,'Alt+X' ,Exit ,\ +\ + en_US,'New' ,'Ctrl+N' ,New ,\ + en_US,'Open...' ,'Ctrl+O' ,Open ,\ + en_US,'Save' ,'Ctrl+S' ,Save ,\ + en_US,'Save as...','Ctrl+Shift+S',SaveAs ,\ + en_US,'-','',,\ + en_US,'Close' ,'Ctrl+F4' ,Close ,\ + en_US,'-','',,\ + en_US,'Exit' ,'Alt+X' ,Exit ,\ +\ + it_IT,'Nuovo' ,'Ctrl+N' ,New ,\ + it_IT,'Aperto...' ,'Ctrl+O' ,Open ,\ + it_IT,'Salva' ,'Ctrl+S' ,Save ,\ + it_IT,'Salva come...','Ctrl+Shift+S',SaveAs ,\ + it_IT,'-','',,\ + it_IT,'Chiudi' ,'Ctrl+F4' ,Close ,\ + it_IT,'-','',,\ + it_IT,'Uscita' ,'Alt+X' ,Exit ,\ +\ + et_EE,'Uus' ,'Ctrl+N' ,New ,\ + et_EE,'Ava...' ,'Ctrl+O' ,Open ,\ + et_EE,'Salvesta' ,'Ctrl+S' ,Save ,\ + et_EE,'Salvesta nimega...','Ctrl+Shift+S',SaveAs,\ + et_EE,'-','',,\ + et_EE,'Sulge' ,'Ctrl+F4' ,Close ,\ + et_EE,'-','',,\ + et_EE,'Vlju' ,'Alt+X' ,Exit ,\ +\ + es_ES,'Nuevo' ,'Ctrl+N' ,New ,\ + es_ES,'Abrir...' ,'Ctrl+O' ,Open ,\ + es_ES,'Guardar' ,'Ctrl+S' ,Save ,\ + es_ES,'Guardar como...','Ctrl+Shift+S',SaveAs,\ + es_ES,'-','',,\ + es_ES,'Cerrar' ,'Ctrl+F4',Close,\ + es_ES,'-','',,\ + es_ES,'Salir' ,'Alt+X' ,Exit + +popup_res mm.Edit,\ + ru_RU,'१' ,'Ctrl+X',Cut ,\ + ru_RU,'஢' ,'Ctrl+C',Copy ,\ + ru_RU,'⠢' ,'Ctrl+V',Insert,\ + ru_RU,'' ,'' ,Delete,\ + ru_RU,'-','',,\ + ru_RU,'뤥 ' ,'Ctrl+A',SelAll,\ +\ + en_US,'Cut' ,'Ctrl+X',Cut ,\ + en_US,'Copy' ,'Ctrl+C',Copy ,\ + en_US,'Paste' ,'Ctrl+V',Insert,\ + en_US,'Delete' ,'' ,Delete,\ + en_US,'-','',,\ + en_US,'Select all','Ctrl+A',SelAll,\ +\ + it_IT,'Taglio' ,'Ctrl+X',Cut ,\ + it_IT,'Copia' ,'Ctrl+C',Copy ,\ + it_IT,'Incolla' ,'Ctrl+V',Insert,\ + it_IT,'Elimina' ,'' ,Delete,\ + it_IT,'-','',,\ + it_IT,'Seleziona tutto','Ctrl+A',SelAll,\ +\ + et_EE,'Lika' ,'Ctrl+X',Cut ,\ + et_EE,'Kopeeri' ,'Ctrl+C',Copy ,\ + et_EE,'Kleebi' ,'Ctrl+V',Insert,\ + et_EE,'Kustuta' ,'' ,Delete,\ + et_EE,'-','',,\ + et_EE,'Vali kik','Ctrl+A',SelAll,\ +\ + es_ES,'Cortar' ,'Ctrl+X',Cut ,\ + es_ES,'Copiar' ,'Ctrl+C',Copy ,\ + es_ES,'Pegar' ,'Ctrl+V',Insert,\ + es_ES,'Eliminar' ,'' ,Delete,\ + es_ES,'-','',,\ + es_ES,'Seleccionar todo','Ctrl+A',SelAll + +popup_res mm.Search,\ + ru_RU,'३...' ,'Ctrl+G',Position,\ + ru_RU,'-','',,\ + ru_RU,'...' ,'Ctrl+F',Find ,\ + ru_RU,' ','F3' ,FindNext,\ + ru_RU,'...','Ctrl+H',Replace ,\ +\ + en_US,'Position...','Ctrl+G',Position,\ + en_US,'-','',,\ + en_US,'Find...' ,'Ctrl+F',Find ,\ + en_US,'Find next' ,'F3' ,FindNext,\ + en_US,'Replace...' ,'Ctrl+H',Replace ,\ +\ + it_IT,'Posizione...','Ctrl+G',Position,\ + it_IT,'-','',,\ + it_IT,'Trova...' ,'Ctrl+F',Find ,\ + it_IT,'Trova il prossimo' ,'F3' ,FindNext,\ + it_IT,'Sostituire...' ,'Ctrl+H',Replace ,\ +\ + et_EE,'Positsioon...','Ctrl+G',Position,\ + et_EE,'-','',,\ + et_EE,'Leia...' ,'Ctrl+F',Find ,\ + et_EE,'Leia jrgmine','F3' ,FindNext,\ + et_EE,'Asenda...' ,'Ctrl+H',Replace ,\ +\ + es_ES,'Posicin...' ,'Ctrl+G',Position,\ + es_ES,'-','',,\ + es_ES,'Buscar...' ,'Ctrl+F',Find ,\ + es_ES,'Buscar siguiente','F3' ,FindNext,\ + es_ES,'Reemplazar...','Ctrl+H',Replace + +popup_res mm.Run,\ + ru_RU,'' ,'F9' ,Run ,\ + ru_RU,' ','F10',Debug ,\ + ru_RU,'஢' ,'Ctrl+F9',Compile ,\ + ru_RU,'-','',,\ + ru_RU,'᪠ ⫠' ,'' ,DbgBoard,\ + ru_RU,'⥬ 㭪樨','' ,SysFuncs,\ +\ + en_US,'Run' ,'F9' ,Run ,\ + en_US,'Run in debugger' ,'F10' ,Debug ,\ + en_US,'Compile' ,'Ctrl+F9',Compile ,\ + en_US,'-','',,\ + en_US,'Debug board' ,'' ,DbgBoard,\ + en_US,'System functions' ,'' ,SysFuncs,\ +\ + it_IT,'Correre' ,'F9' ,Run ,\ + it_IT,'Esegui nel debugger','F10',Debug ,\ + it_IT,'Compilare','Ctrl+F9',Compile ,\ + it_IT,'-','',,\ + it_IT,'Scheda di debug' ,'' ,DbgBoard,\ + it_IT,'Funzioni di sistema','' ,SysFuncs,\ +\ + et_EE,'Kivita' ,'F9' ,Run ,\ + et_EE,'Kivita aastal siluri','F10',Debug ,\ + et_EE,'Kompileeri' ,'Ctrl+F9',Compile ,\ + et_EE,'-','',,\ + et_EE,'Silumis paneel' ,'' ,DbgBoard,\ + et_EE,'Ssteemi funktsioonid','' ,SysFuncs,\ +\ + es_ES,'Ejecutar' ,'F9' ,Run ,\ + es_ES,'Ejecutar en el depurador','F10',Debug,\ + es_ES,'Compilar' ,'Ctrl+F9',Compile ,\ + es_ES,'-','',,\ + es_ES,'Depuracin' ,'' ,DbgBoard,\ + es_ES,'Funciones del sistema' ,'',SysFuncs + +popup_res mm.Encoding,\ + @!,<'CP866 ',0x1A,' CP1251'>,'',CP866.CP1251,\ + @!,<'CP1251 ',0x1A,' CP866' >,'',CP1251.CP866,\ + @!,<'-'>,'',,\ + @!,<'CP866 ',0x1A,' KOI8-R'>,'',CP866.KOI8R ,\ + @!,<'KOI8-R ',0x1A,' CP866' >,'',KOI8R.CP866 ,\ + @!,<'-'>,'',,\ + @!,<'CP1251 ',0x1A,' KOI8-R'>,'',CP1251.KOI8R,\ + @!,<'KOI8-R ',0x1A,' CP1251'>,'',KOI8R.CP1251 + +popup_res mm.Options,\ + ru_RU,'' ,'Ctrl +',ZoomIn ,\ + ru_RU,'' ,'Ctrl -',ZoomOut ,\ + ru_RU,'-','',,\ + ru_RU,' ப' ,'',LineNumbers ,\ + ru_RU,'᭮ 뤥' ,'',SecureSel ,\ + ru_RU,'⮬᪨ ᪮' ,'',AutoBrackets,\ + ru_RU,'⮬᪨ ' ,'',AutoIndents ,\ + ru_RU,'⨬쭮 ࠭' ,'',OptimalFill ,\ + ru_RU,'-','',,\ + ru_RU,'譨 ...' ,'',Appearance ,\ +\ + en_US,'Zoom in' ,'Ctrl +',ZoomIn ,\ + en_US,'Zoom out' ,'Ctrl -',ZoomOut ,\ + en_US,'-','',,\ + en_US,'Line numbers' ,'',LineNumbers ,\ + en_US,'Secure selection' ,'',SecureSel ,\ + en_US,'Automatic brackets' ,'',AutoBrackets,\ + en_US,'Automatic indents' ,'',AutoIndents ,\ + en_US,'Optimal fill on saving' ,'',OptimalFill ,\ + en_US,'-','',,\ + en_US,'Appearance...' ,'',Appearance ,\ +\ + it_IT,'Ingrandire' ,'Ctrl +',ZoomIn ,\ + it_IT,'Rimpicciolisci' ,'Ctrl -',ZoomOut ,\ + it_IT,'-','',,\ + it_IT,'Numeri di riga' ,'',LineNumbers ,\ + it_IT,'Selezione sicura' ,'',SecureSel ,\ + it_IT,'Staffe automatiche' ,'',AutoBrackets,\ + it_IT,'Rientri automatici' ,'',AutoIndents ,\ + it_IT,'Combina spazi' ,'',OptimalFill ,\ + it_IT,'-','',,\ + it_IT,'Aspetto...' ,'',Appearance ,\ +\ + et_EE,'Zoom in' ,'Ctrl +',ZoomIn ,\ + et_EE,'Zoom out' ,'Ctrl -',ZoomOut ,\ + et_EE,'-','',,\ + et_EE,'Rea numbrid' ,'',LineNumbers ,\ + et_EE,'Turvaline valimine' ,'',SecureSel ,\ + et_EE,'Automaatsed sulud' ,'',AutoBrackets,\ + et_EE,'Automaatsed taandread' ,'',AutoIndents ,\ + et_EE,'Optimaalne titmine salvestamisel','',OptimalFill,\ + et_EE,'-','',,\ + et_EE,'Vlimus...' ,'',Appearance ,\ +\ + es_ES,'Zoom in' ,'Ctrl +',ZoomIn ,\ + es_ES,'Zoom out' ,'Ctrl -',ZoomOut ,\ + es_ES,'-','',,\ + es_ES,'Nmeros en lneas' ,'',LineNumbers ,\ + es_ES,'Seleccin segura' ,'',SecureSel ,\ + es_ES,'Parntesis automticos' ,'',AutoBrackets,\ + es_ES,'Identacin automtica' ,'',AutoIndents ,\ + es_ES,'Llenado ptimo al guardar','',OptimalFill ,\ + es_ES,'-','',,\ + es_ES,'Apariencia...' ,'',Appearance + +lsz s_defname,\ + ru_RU,<'ﭭ',0>,\ + en_US,<'Untitled',0>,\ + it_IT,<'Senza titolo',0>,\ + et_EE,<'Nimetu',0>,\ + es_ES,<'Sin ttulo',0> + +lsz s_modified,\ + ru_RU,'',\ + en_US,'Modified',\ + it_IT,'Modificato',\ + et_EE,'Muudetud',\ + es_ES,'Modificado' + +lsz s_2filename,\ + ru_RU,' 䠩:',\ + en_US,'Filename:',\ + en_US,'Nome del file:',\ + et_EE,'Faili nimi:',\ + es_ES,'Nombre de archivo:' + +lsz s_2open,\ + ru_RU,'',\ + en_US,'Open',\ + it_IT,'Aperto',\ + et_EE,'Ava',\ + es_ES,'Abrir' + +lsz s_2save,\ + ru_RU,'࠭',\ + en_US,'Save',\ + it_IT,'Salva',\ + et_EE,'Salvesta',\ + es_ES,'Guardar' + +lsz s_2save_no,\ + ru_RU,'',\ + en_US,'No',\ + it_IT,'No',\ + et_EE,'Ei',\ + es_ES,'No' + +lsz s_2find,\ + ru_RU,'',\ + en_US,'Find',\ + it_IT,'Trova',\ + et_EE,'Leia',\ + es_ES,'Buscar' +db ':' + +lsz s_2replace,\ + ru_RU,'',\ + en_US,'Replace',\ + it_IT,'Sostituire',\ + et_EE,'Asenda',\ + es_ES,'Reemplazar' +db ':' + +lsz s_2cancel,\ + ru_RU,'⬥',\ + en_US,'Cancel',\ + it_IT,'Annulla',\ + et_EE,'Thista',\ + es_ES,'Cancelar' + +lsz s_color,\ + ru_RU,': 0x',\ + en_US,'Color: 0x',\ + it_IT,'Colore: 0x',\ + et_EE,'Vrv: 0x',\ + es_ES,'Color: 0x' + +lsz s_tabpos,\ + ru_RU,'ᯮ ',\ + en_US,'Tabs placement',\ + it_IT,'Posizionamento delle schede',\ + et_EE,'Saki asetus',\ + es_ES,'Lugar de tabulador' + +lsz s_enter_filename,\ + ru_RU,<' 䠩',0>,\ + en_US,<'Enter filename',0>,\ + it_IT,<'Inserisci il nome del file',0>,\ + et_EE,<'Sisesta faili nimi',0>,\ + es_ES,<'Ingresa el nombre del archivo',0> + +lsz s_ask_save,\ + ru_RU,<' ࠭?',0>,\ + en_US,<'Would you like to save?',0>,\ + it_IT,<'Vorresti salvare?',0>,\ + et_EE,<'Kas soovite salvestada?',0>,\ + es_ES,<'Quieres guardar?',0> + +lsz s_enter_text_to_find,\ + ru_RU,<' ⥪ ᪠',0>,\ + en_US,<'Enter text to find',0>,\ + it_IT,<'Inserisci il testo per trovare',0>,\ + et_EE,<'Sisesta otsitav tekst',0>,\ + es_ES,<'Ingresa el texto a buscar',0> + +lsz s_enter_text_to_replace,\ + ru_RU,<' ⥪ ',0>,\ + en_US,<'Enter text to replace',0>,\ + it_IT,<'Inserisci il testo da sostituire',0>,\ + et_EE,<'Sisesta asendatav tekst',0>,\ + es_ES,<'Ingresa el texto a reemplazar',0> + +lsz s_text_not_found,\ + ru_RU,<'⨣ 䠩, ⥪ ',0>,\ + en_US,<'Reached end of file, text not found',0>,\ + it_IT,<'Raggiunta la fine del file, testo non trovato',0>,\ + et_EE,<'Faili lpp, teksti ei leitud',0>,\ + es_ES,<'Se lleg al final del archivo, texto no encontrado',0> + +lszc s_fs_error,b,\ + ru_RU,<' 襭 ᯥ譮 (0)',0>,\ + ru_RU,<'',0>,\ + ru_RU,<'㭪 ন 䠩 ⥬ (2)',0>,\ + ru_RU,<'⭠ 䠩 ⥬ (3)',0>,\ + ru_RU,<'',0>,\ + ru_RU,<' 䠩 (5)',0>,\ + ru_RU,<' 襭 ᯥ譮 (6)',0>,\ + ru_RU,<' 室 ࠭栬 ணࠬ (7)',0>,\ + ru_RU,<' ᪥ ᢮ (8)',0>,\ + ru_RU,<' FAT 㭨⮦ (9)',0>,\ + ru_RU,<' (10)',0>,\ + ru_RU,<'訡 ன⢠ (11)',0>,\ +\ + en_US,<'Operation executed successfully (0)',0>,\ + en_US,<'',0>,\ + en_US,<'Function is not supported for the given filesystem (2)',0>,\ + en_US,<'Unknown filesystem (3)',0>,\ + en_US,<'',0>,\ + en_US,<'Unable to open file (5)',0>,\ + en_US,<'Operation executed successfully (6)',0>,\ + en_US,<'Pointer lies outside of application memory (7)',0>,\ + en_US,<'Disk is full (8)',0>,\ + en_US,<'FAT table is destroyed (9)',0>,\ + en_US,<'Access denied (10)',0>,\ + en_US,<'Device error (11)',0>,\ +\ + it_IT,<'Operazione eseguita correttamente (0)',0>,\ + it_IT,<'',0>,\ + it_IT,<'La funzione non e supportata per il file system specificato (2)', 0>, \ + it_IT,<'Unknown filesystem (3)',0>,\ + it_IT,<'',0>,\ + it_IT,<'Impossibile aprire il file (5)',0>,\ + it_IT,<'Operazione eseguita correttamente (6)',0>,\ + it_IT,<'Il puntatore si trova al di fuori della memoria dell',96,'applicazione (7)', 0>, \ + it_IT,<'Il disco e pieno (8)',0>,\ + it_IT,<'La tabella FAT e distrutta (9)',0>,\ + it_IT,<'Accesso negato (10)',0>,\ + it_IT,<'Errore dispositivo (11)',0>,\ +\ + et_EE,<'Operatsioon kivitati edukalt (0)',0>,\ + et_EE,<'',0>,\ + et_EE,<'Failissteem ei toeta funktsiooni (2)',0>,\ + et_EE,<'Tundmatu failissteem (3)',0>,\ + et_EE,<'',0>,\ + et_EE,<'Faili ei suudetud avada (5)',0>,\ + et_EE,<'Operatsioon kivitatud edukalt (6)',0>,\ + et_EE,<'Viit on vljaspool programmi mlu (7)',0>,\ + et_EE,<'Ketas tis (8)',0>,\ + et_EE,<'FAT tabel hvitatud (9)',0>,\ + et_EE,<'Juurdeps keelatud (10)',0>,\ + et_EE,<'Seadme viga (11)',0>,\ +\ + es_ES,<'Operacin ejecutada correctamente (0)',0>,\ + es_ES,<'',0>,\ + es_ES,<'La funcin no est soportada por el sistema de archivos dado (2)',0>,\ + es_ES,<'Sistema de archivos desconocido (3)',0>,\ + es_ES,<'',0>,\ + es_ES,<'No es posible abrir el archivo (5)',0>,\ + es_ES,<'Operacin ejecutada correctamente (6)',0>,\ + es_ES,<'El puntero est fuera de la memoria de la aplicacin (7)',0>,\ + es_ES,<'El disco est lleno (8)',0>,\ + es_ES,<'La tabla FAT est destruida (9)',0>,\ + es_ES,<'Acceso denegado (10)',0>,\ + es_ES,<'Error de dispositivo (11)',0> + +lszc s_appearance,b,\ + ru_RU,'',\ + ru_RU,'',\ + ru_RU,' 뤥',\ + ru_RU,' 뤥',\ + ru_RU,'',\ + ru_RU,'᫠',\ + ru_RU,'ப',\ + ru_RU,'ਨ',\ + ru_RU,' ப',\ + ru_RU,'࠭ ப',\ +\ + en_US,'Text',\ + en_US,'Background',\ + en_US,'Selection text',\ + en_US,'Selection background',\ + en_US,'Symbols',\ + en_US,'Numbers',\ + en_US,'Strings',\ + en_US,'Comments',\ + en_US,'Modified lines',\ + en_US,'Saved lines',\ +\ + it_IT,'Testo',\ + it_IT,'Sfondo',\ + it_IT,'Testo di selezione',\ + it_IT,'Sfondo di selezione',\ + it_IT,'Simboli',\ + it_IT,'Numeri',\ + it_IT,'Stringhe',\ + it_IT,'Commenti',\ + it_IT,'Linee modificate',\ + it_IT,'Linee salvate',\ +\ + et_EE,'Tekst',\ + et_EE,'Taust',\ + et_EE,'Valitud tekst',\ + et_EE,'Valitud taust',\ + et_EE,'Smbolid',\ + et_EE,'Numbrid',\ + et_EE,'Stringid',\ + et_EE,'Kommentaarid',\ + et_EE,'Muudetud read',\ + et_EE,'Salvestatud read',\ +\ + es_ES,'Texto',\ + es_ES,'Fondo',\ + es_ES,'Texto de seleccin',\ + es_ES,'Fondo de seleccin',\ + es_ES,'Smbolos',\ + es_ES,'Nmeros',\ + es_ES,'Cadenas',\ + es_ES,'Comentarios',\ + es_ES,'Lneas modificadas',\ + es_ES,'Lneas guardadas' + +lsz sysfuncs_filename,\ + ru_RU,<'SYSFUNCR.TXT',0>,\ + en_US,<'SYSFUNCS.TXT',0>,\ + it_IT,<'SYSFUNCS.TXT',0>,\ + et_EE,<'SYSFUNCET.TXT',0>,\ + es_ES,<'SYSFUNCS.TXT',0> + +sz s_example,'/sys/example.asm' +sz s_still ,'still' diff --git a/programs/fs/copyr/trunk/copyr.asm b/programs/fs/copyr/trunk/copyr.asm index eefad8d2fa..065c297d69 100644 --- a/programs/fs/copyr/trunk/copyr.asm +++ b/programs/fs/copyr/trunk/copyr.asm @@ -8,7 +8,7 @@ ; ; ; On base SYSTREE FILE COPIER 1.02 ; ; Ivan Poddubny ivan-yar@bk.ru ; -; ; +; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ண 筠 㦥 ࠡ⠥ @@ -23,11 +23,11 @@ dd 0x10000 ; esp dd param_area , 0x0 ; I_Param , I_Icon -include 'lang.inc' -include '..\..\..\macros.inc' ; very useful stuff for MeOS +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. +include '..\..\..\macros.inc' ; very useful stuff for MeOS include 'ascl.inc' -START: ; start of execution +START: ; start of execution ; ࠬ: ; db n1 = 筨 @@ -187,7 +187,7 @@ draw_window: mov edi,labelt ; WINDOW LABEL mcall - + mov eax,8 mov ebx,105*65536+290 mov ecx,33*65536+12 @@ -264,12 +264,13 @@ errors: db "() ⭠ 訡 " db " 筨 ਥ 㪠!!! " db " ਥ 㪠!!! " -else + +else ; Default to en_US text: db 'SOURCE: | ' db 'DESTINATION: | ' db ' ' - db 'x' ; <- END MARKER, DONT DELETE + db 'x' ; <- END MARKER, DO NOT DELETE labelt: db 'SYSTREE FILE COPIER' labellen: @@ -292,6 +293,7 @@ errors: db "(write) unknown error " db "Path to source is not given!!! " db "Path to destination is not given!!! " + end if ;0123456789012345678901234567890123456789012 diff --git a/programs/fs/kfar/trunk/kfar.asm b/programs/fs/kfar/trunk/kfar.asm index 67f42e530f..9caf0db73f 100644 --- a/programs/fs/kfar/trunk/kfar.asm +++ b/programs/fs/kfar/trunk/kfar.asm @@ -1,8931 +1,8935 @@ -use32 - db 'MENUET01' - dd 1 - dd start - dd i_end -memsize dd mem - dd stacktop - dd 0, app_path - -version equ '0.65' -version_dword equ 0*10000h + 65 - -min_width = 54 -max_width = 255 -min_height = 8 -max_height = 255 - -include '../../../KOSfuncs.inc' -include '../../../macros.inc' -include 'lang.inc' -include 'font.inc' -include 'sort.inc' -include 'kglobals.inc' -include 'dialogs.inc' -include 'search.inc' -include 'viewer.inc' -include 'editor.inc' -include 'tools.inc' -include 'filetool.inc' - -struct PanelData -left dd ? -top dd ? -width dd ? -height dd ? -index dd ? -start dd ? -colsz dd ? -colst dd ? -sortmode db ? - rb 3 -nfa dd ? -numfiles dd ? -files dd ? -hPlugin dd ? -hFile dd ? -parents dd ? -parents_sz dd ? -parents_alloc dd ? -colmode dd ? -colwidths rd 16+1 -total_num dd ? -total_size dq ? -selected_num dd ? -selected_size dq ? -;plugin_info: -plugin_flags dd ? -dir rb 1024 -ends - -cursor_normal_size = (font_height*15+50)/100 -cursor_big_size = font_height - -align 4 -start: - mov eax,SF_SET_EVENTS_MASK - mov ebx,(11b shl 30) or 100111b - int 0x40 - mov edi, identical_table - mov ecx, 0x100 - xor eax, eax -@@: - stosb - inc eax - loop @b - mov cl, 'A' -@@: - stosb - inc eax - loop @b - add al, 0x20 - mov cl, 'Z'-'A'+1 -@@: - stosb - inc eax - loop @b - sub al, 0x20 - mov cl, ''-'Z'-1 -@@: - stosb - inc eax - loop @b - add al, 0x20 - mov cl, ''-'' -@@: - stosb - inc eax - loop @b - add al, 0x30 - mov cl, ''-''+1 -@@: - stosb - inc eax - loop @b - sub al, 0x50 - mov cl, 256-''-1 -@@: - stosb - inc eax - loop @b - mov byte [edi-256+''], '' - mov cl, 'A' - inc eax - rep stosb - mov cl, 'Z'-'A'+1 - dec eax - rep stosb - mov cl, 'a'-'Z'-1 - inc eax - rep stosb - mov byte [edi-'a'+'_'], 0 - mov cl, 'z'-'a'+1 - dec eax - rep stosb - mov cl, ''-'z'-1 - inc eax - rep stosb - mov cl, ''-''+1 - dec eax - rep stosb - mov cl, ''-''-1 - inc eax - rep stosb - mov cl, ''-''+1 - dec eax - rep stosb - mov cl, 256-''-1 - inc eax - rep stosb - mov edi, SearchStringEditBuf - mov eax, SearchStringEditBuf.length - stosd - xor eax, eax - stosd - stosd - stosb - push SF_SYS_MISC - pop eax - push SSF_HEAP_INIT - pop ebx - int 0x40 - call init_console - call draw_window - push SF_KEYBOARD - pop eax - push SSF_SET_INPUT_MODE - pop ebx - mov ecx, ebx - int 40h ; set keyboard mode to scancodes - mov eax, 200 - mov [panel1.nfa], eax - mov [panel2.nfa], eax - mov ecx, 200*4 + 32 + 200*304 - call pgalloc - mov [panel1.files], eax - call pgalloc - mov [panel2.files], eax - test eax, eax - jz exit - xor eax, eax - cmp [panel1.files], eax - jz exit - mov [panel1.hPlugin], eax - mov [panel1.parents], eax - mov [panel1.parents_sz], eax - mov [panel1.parents_alloc], eax - mov [panel2.hPlugin], eax - mov [panel2.parents], eax - mov [panel2.parents_sz], eax - mov [panel2.parents_alloc], eax - mov [panel1.sortmode], al ; sort by name - mov [panel2.sortmode], al - mov al, 2 ; "।" ଠ - mov [panel1.colmode], eax - mov [panel2.colmode], eax - mov [num_screens], 1 - mov ecx, 0x1000 - call pgalloc - mov [screens], eax - test eax, eax - jz exit - mov ecx, panels_vtable - mov [eax], ecx - mov [active_screen_vtable], ecx - mov [active_screen_keybar], keybar_panels -; load libini.obj and kfar.ini - mov eax, libini_name - mov esi, ini_import - push 8 - pop ebp ; we use version 8 of libini - call load_dll_and_import - test eax, eax - jnz .noini - mov edi, app_path - or ecx, -1 - repnz scasb - mov dword [edi-1], '.ini' - mov byte [edi+3], 0 - push 1 - push dword aConfirmDelete - push dword aConfirmations - push dword app_path - call [ini.get_int] - mov [bConfirmDelete], al - push 0 - push dword aConfirmDeleteIncomplete - push dword aConfirmations - push dword app_path - call [ini.get_int] - mov [bConfirmDeleteIncomplete], al - push 2 - push aLeftViewMode - push aPanels - push app_path - call [ini.get_int] - cmp eax, 1 - jb @f - cmp eax, 4 - ja @f - mov [panel1.colmode], eax -@@: - push 2 - push aRightViewMode - push aPanels - push app_path - call [ini.get_int] - cmp eax, 1 - jb @f - cmp eax, 4 - ja @f - mov [panel2.colmode], eax -@@: - push 0 - push aLeftSortMode - push aPanels - push app_path - call [ini.get_int] - cmp eax, 14 - jae @f - mov [panel1.sortmode], al -@@: - push 0 - push aRightSortMode - push aPanels - push app_path - call [ini.get_int] - cmp eax, 14 - jae @f - mov [panel2.sortmode], al -@@: - push nullstr - push 512 - push saved_file_name - push aEolStyle - push aEditor - push app_path - call [ini.get_str] - mov cl, edit.eol_dos - mov al, [saved_file_name] - or al, 20h - cmp al, 'd' - jz @f - mov cl, edit.eol_mac - cmp al, 'm' - jz @f - mov cl, edit.eol_unix -@@: - mov [EditEOLStyle], cl - mov ecx, 0x1000 - call xpgalloc - test eax, eax - jz .skip_assoc - mov [associations], eax - push enum_associations_callback - push aAssociations - push app_path - call [ini.enum_keys] -.skip_assoc: - xor ebp, ebp - xor esi, esi -.shortcut_loop: - mov edi, saved_file_name - push dword nullstr - push 512 - push edi - push dword aShortcut - push dword aFolderShortcuts - push dword app_path - call [ini.get_str] - cmp byte [edi], 0 - jz .shortcut_cont - or ecx, -1 - xor eax, eax - repnz scasb - not ecx - cmp ecx, 2 - jz @f - cmp byte [edi-2], '/' - jnz @f - mov byte [edi-2], 0 - dec ecx -@@: - mov al, [aShortcut.d] - push esi - inc esi - mov [FolderShortcuts+(eax-'0')*4], esi - lea esi, [esi+ecx-1] - push esi - and esi, 0xFFF - cmp esi, ecx - pop esi - ja .norealloc - mov edx, ebp - mov ecx, esi - call xpgrealloc - test eax, eax - jnz @f - pop esi - mov edi, FolderShortcuts - mov ecx, 10 - rep stosd - jmp .skip_shortcuts -@@: - mov ebp, eax -.norealloc: - pop edi - add edi, ebp - mov ecx, saved_file_name -@@: - mov al, [ecx] - inc ecx - stosb - test al, al - jnz @b -.shortcut_cont: - inc [aShortcut.d] - cmp [aShortcut.d], '9' - jbe .shortcut_loop - mov esi, FolderShortcuts - mov ecx, 10 - dec ebp -.l3: - lodsd - test eax, eax - jz @f - add [esi-4], ebp -@@: - loop .l3 -.skip_shortcuts: -; load plugins - push enum_plugins_callback - push aPlugins - push app_path - call [ini.enum_keys] -; calculate info for editor - xor ebx, ebx - mov ecx, [num_plugins] - mov esi, [plugins] -@@: - dec ecx - js @f - mov [esi+PluginInfo.EditInfoOffs], ebx - add ebx, [esi+PluginInfo.EditInfoSize] - jnc @f - sbb ebx, ebx -@@: -; ᪮ ࠧ । ࠭祭, ࠧ , १ࢨ㥬 , ࠭祭 -; 512 - 㡠 業, ࠭ ࠡ ।, ॠ쭮 ॡ - cmp ebx, 512 - jb @f - or ebx, -1 - mov [EditPlugInfo], ebx ; disable plugins for editor - push ContinueBtn - push 1 - push EditConfigErr_ptr - push 2 - call SayErr -@@: - add ebx, 3 - and ebx, not 3 - mov [EditPlugInfo], ebx -.noini: - mov eax, [EditPlugInfo] - add eax, editor_line.plugdata - imul eax, max_height - add eax, editor_data.basesize + 0xFFF - shr eax, 12 - mov [EditDataSize], eax - mov esi, def_left_dir - mov edi, panel1.dir -@@: - lodsb - stosb - test al, al - jnz @b - mov esi, def_right_dir - mov edi, panel2.dir -@@: - lodsb - stosb - test al, al - jnz @b - call draw_keybar - call draw_cmdbar - mov [prev_dir], 0 - mov ebp, panel1 - call calc_colwidths - call read_folder - call draw_panel - mov [bSilentFolderMode], 1 - mov ebp, panel2 - call calc_colwidths - call read_folder - call draw_panel -event: - call get_event - dec eax - jz redraw - dec eax - jz key - sub eax,4 - jz mouse -; button - we have only one button, close -exit: -; close all screens -@@: - mov ecx, [num_screens] - mov eax, [screens] - mov ebp, [eax+ecx*8-4] - mov eax, [eax+ecx*8-8] - push ebp - call [eax+screen_vtable.OnExit] - pop ecx - call pgfree - dec [num_screens] - jnz @b -; unload all plugins - mov ecx, [num_plugins] - imul esi, ecx, PluginInfo.size - add esi, [plugins] -.unload: - dec ecx - js .unload_done - sub esi, PluginInfo.size - push ecx esi - call [esi+PluginInfo.unload] - pop esi ecx - jmp .unload -.unload_done: - cmp [ini.set_int], aIniSetInt - jz .nosave - push [panel1.colmode] - push aLeftViewMode - push aPanels - push app_path - call [ini.set_int] - push [panel2.colmode] - push aRightViewMode - push aPanels - push app_path - call [ini.set_int] - movzx eax, [panel1.sortmode] - push eax - push aLeftSortMode - push aPanels - push app_path - call [ini.set_int] - movzx eax, [panel2.sortmode] - push eax - push aRightSortMode - push aPanels - push app_path - call [ini.set_int] -.nosave: -if CHECK_FOR_LEAKS - mov ecx, [panel1.files] - call pgfree - mov ecx, [panel2.files] - call pgfree - mov ecx, [screens] - call pgfree - mov ecx, [associations] - call pgfree - mov ecx, [console_data_ptr] - call pgfree - mov ecx, [MemForImage] - call pgfree - mov esi, FolderShortcuts - push 10 - pop ecx -@@: - lodsd - test eax, eax - jnz @f - loop @b - jmp .nofreefs -@@: - mov ecx, eax - call pgfree - mov ecx, [plugins] - call pgfree - mov ecx, [panel1.parents] - call pgfree - mov ecx, [panel2.parents] - call pgfree -.nofreefs: - mov eax, [numallocatedregions] - test eax, eax - jz @f - mov edi, allocatedregions - int3 - jmp $ -@@: -end if - or eax, SF_TERMINATE_PROCESS - int 40h - -align 16 -get_event: - push ebx - mov ebx, [idle_interval] - cmp ebx, -1 - jz .infinite - push SF_WAIT_EVENT_TIMEOUT - pop eax - int 40h - pop ebx - test eax, eax - jnz .ret - mov ebp, [active_screen_data] - mov eax, [active_screen_vtable] - mov eax, [eax+screen_vtable.OnIdle] - test eax, eax - jz get_event - call eax - jmp get_event -.infinite: - pop ebx - push SF_WAIT_EVENT - pop eax - int 40h -.ret: - ret - -redraw: -; query kbd state from OS - mov al, SF_KEYBOARD - push SSF_GET_CONTROL_KEYS - pop ebx - int 0x40 - and eax, 0x3F - cmp al, [ctrlstate] - mov [ctrlstate], al - jz @f - call draw_keybar -@@: - mov al, SF_THREAD_INFO - mov ebx, procinfo - or ecx, -1 - int 40h -; test if rolled up -; height of rolled up window is [skinh]+3 - mov eax, [ebx+46] - sub eax, [skinh] - cmp eax, 5 - ja @f - mov al, SF_REDRAW - push SSF_BEGIN_DRAW - pop ebx - int 0x40 - xor eax, eax -; ebx, ecx, edi are ignored by function 0 after first redraw - mov edx, 0x53000000 - int 0x40 - mov al, SF_REDRAW - inc ebx - int 0x40 - jmp event -@@: - xor ecx, ecx - mov eax, [ebx+42] - mov [wnd_width], eax - sub eax, 5*2-1 - jae @f - xor eax, eax -@@: - cdq - mov esi, font_width - div esi - cmp eax, min_width - jae @f - mov al, min_width - mov ch, 1 -@@: - cmp eax, max_width - jbe @f - mov eax, max_width - mov ch, 1 -@@: - cmp eax, [cur_width] - mov [cur_width], eax - setnz cl - or cl, ch - test edx, edx - mov [fill_width], edx - setnz ch - mov eax, [ebx+46] - mov [wnd_height], eax - sub eax, [skinh] - sub eax, 5-1 - jns @f - xor eax, eax -@@: - cdq - mov esi, font_height - div esi - cmp eax, min_height - jae @f - mov al, min_height - mov cl, 1 -@@: - cmp eax, max_height - jbe @f - mov eax, max_height - mov cl, 1 -@@: - mov [fill_height], edx - cmp eax, [cur_height] - mov [cur_height], eax - jnz .resize - test cl, cl - jnz .resize - test edx, edx - setnz cl - or cl, ch - jz @f - test byte [ebx+70], 1 - jnz @f -.resize: - push SF_CHANGE_WINDOW - pop eax - or ebx, -1 - or ecx, -1 - mov edx, [cur_width] - imul edx, font_width - add edx, 5*2-1 - mov esi, [cur_height] - imul esi, font_height - add esi, [skinh] - add esi, 5-1 - int 40h -.resize_draw: - mov ecx, [MemForImage] - call pgfree - and [MemForImage], 0 - call init_console -; call draw_window - call draw_keybar - mov ebp, [active_screen_data] - mov eax, [active_screen_vtable] - mov [cursor_size], cursor_normal_size - call dword [eax+screen_vtable.OnRedraw] - jmp event -@@: - call draw_window - jmp event -alt_f9: - cmp [saved_width], -1 - jz @f - mov eax, [saved_width] - mov [cur_width], eax - or [saved_width], -1 - mov eax, [saved_height] - mov [cur_height], eax - or [saved_height], -1 - jmp redraw.resize -@@: - push SF_STYLE_SETTINGS - pop eax - push SSF_GET_SCREEN_AREA - pop ebx - int 0x40 - push eax - sub eax, [esp+2] - inc eax - movzx eax, ax - sub eax, 10 - xor edx, edx - mov ecx, font_width - div ecx - xchg [cur_width], eax - mov [saved_width], eax - mov eax, ebx - shr ebx, 16 - sub eax, ebx - sub eax, 5-1 - sub eax, [skinh] - xor edx, edx - mov ecx, font_height - div ecx - xchg [cur_height], eax - mov [saved_height], eax - mov ecx, ebx - pop ebx - shr ebx, 16 - mov edx, [cur_width] - imul edx, font_width - add edx, 5*2-1 - mov esi, [cur_height] - imul esi, font_height - add esi, [skinh] - add esi, 4 - push SF_CHANGE_WINDOW - pop eax - int 0x40 - jmp redraw.resize_draw -key: - mov al, SF_GET_KEY - int 40h - test al, al - jnz event - xchg al, ah - cmp al, 0xE0 - jnz @f - mov [bWasE0], 1 - jmp event -@@: - xchg ah, [bWasE0] - mov ebp, [active_screen_data] - mov edx, [active_screen_vtable] - cmp al, 0x1D - jz .ctrl_down - cmp al, 0x9D - jz .ctrl_up - cmp al, 0x2A - jz .lshift_down - cmp al, 0xAA - jz .lshift_up - cmp al, 0x36 - jz .rshift_down - cmp al, 0xB6 - jz .rshift_up - cmp al, 0x38 - jz .alt_down - cmp al, 0xB8 - jz .alt_up - call [edx+screen_vtable.OnKey] - jmp event -.ctrl_down: - test ah, ah - jnz .rctrl_down - or [ctrlstate], 4 - jmp .keybar -.rctrl_down: - or [ctrlstate], 8 - jmp .keybar -.ctrl_up: - test ah, ah - jnz .rctrl_up - and [ctrlstate], not 4 - jmp .keybar -.rctrl_up: - and [ctrlstate], not 8 -.keybar: - call draw_keybar - call draw_image -@@: jmp event -.lshift_down: -; ignore E0 2A sequence -; e.g. arrow keys with NumLock on generate sequence E0 2A E0 xx / E0 xx+80 E0 AA -; where xx is scancode, so we can safely ignore E0 2A - test ah, ah - jnz @b - or [ctrlstate], 1 - jmp .keybar -.lshift_up: -; ignore E0 AA sequence - test ah, ah - jnz @b - and [ctrlstate], not 1 - jmp .keybar -.rshift_down: - or [ctrlstate], 2 - jmp .keybar -.rshift_up: - and [ctrlstate], not 2 - jmp .keybar -.alt_down: - test ah, ah - jnz .ralt_down - or [ctrlstate], 0x10 - jmp .keybar -.ralt_down: - or [ctrlstate], 0x20 - jmp .keybar -.alt_up: - test ah, ah - jnz .ralt_up - and [ctrlstate], not 0x10 - jmp .keybar -.ralt_up: - and [ctrlstate], not 0x20 - jmp .keybar - -align 16 -mouse: - mov eax,SF_MOUSE_GET - mov ebx,SSF_BUTTON_EXT - int 0x40 - mov byte[mousestate], 1 - bt eax,24 ;left but. double click - jc @f - mov byte[mousestate], 0 - bt eax,8 ;left but. down - jc @f - jmp event -@@: - mov eax,SF_MOUSE_GET - mov ebx,SSF_WINDOW_POSITION - int 0x40 - cmp ax, word[skinh] - jl event - sub ax, word[skinh] - xor dx, dx - mov bx, font_height - div bx - movzx edx,ax - shr eax,16 - - mov ebx, [cur_height] - dec ebx - cmp edx, ebx - je .on_panel - cmp dword[active_screen],0 - jg event ;.on_edit - cmp edx, 2 - jl .no_ch_pos - dec edx ; ࠬ - dec edx ; - sub ebx, 7-1 - cmp edx, ebx - jge .no_ch_pos - - push edx eax - mov ecx, [cur_width] -if font_width & 3 - imul ecx, font_width - shr ecx, 2 -else - imul ecx, font_width/4 -end if - xor dx, dx - sub ax, 5 ;window border - div cx - bt ax, 0 - jnc @f - add [esp+4], ebx ;᫨ 2- ⮫ -@@: - pop eax ;edx in stack - jmp @f -.no_ch_pos: - push -1 ;edx = -1 - no change position -@@: - - mov ebx, [cur_width] - imul ebx, font_width/2 - add ebx, 5 ;window border - cmp eax,ebx - jg @f - cmp [active_panel], panel1 - je .move - jmp .tab -@@: - cmp [active_panel], panel2 - je .move -.tab: - xor [active_panel], panel1 xor panel2 - call draw_cmdbar - mov ebp, [active_panel] - xor ebp, panel1 xor panel2 - call draw_panel -.move: - mov ebp, [active_panel] - pop edx - mov eax, [ebp + PanelData.numfiles] - add edx, [ebp + PanelData.start] ;᫮ ப祭 䠩 - dec eax - cmp edx, eax - jle @f - mov edx, eax -@@: - cmp edx, 0 - jl @f - mov [ebp + PanelData.index], edx - cmp byte[mousestate], 0 - je @f - call panels_OnKey.enter - jmp event -@@: - call draw_panel - jmp event -align 4 -.on_panel: - call get_keybar_ind - lea eax, [mouse_panels+4*eax] - cmp [active_screen_keybar], keybar_viewer - jne @f - add eax, mouse_viewer-mouse_panels -@@: - cmp [active_screen_keybar], keybar_editor - jne @f - add eax, mouse_editor-mouse_panels -@@: - cmp dword[eax], 0 - je event - - mov ebx, [active_screen] - mov ebp, [screens] - mov ebp, [ebp+ebx*8+4] - - cmp dword[active_screen],0 - jne @f - mov ebp, [active_panel] - mov ecx, [ebp + PanelData.index] -@@: - push dword[eax] - sub eax, mouse_panels - shr eax, 2 - xor edx, edx - mov ebx, 12 - div ebx - lea eax, [edx+0x3B] ;eax - F1...F12 - pop ebx - call ebx - jmp event -if 0 ;not work insert text -align 4 -.on_edit: - cmp [active_screen_keybar], keybar_editor - jne event - cmp edx, 1 - jl event - push edx - xor edx, edx - mov ebx, font_width - div ebx - pop edx - mov ebx, [active_screen] - mov ebp, [screens] - mov ebp, [ebp+ebx*8+4] - mov [ebp + editor_data.cursor_x], eax - mov [ebp + editor_data.cursor_y], edx - call editor_OnRedraw - jmp event -end if - -;input: -; eax - coord x -;output: -; eax - key bar index (0 to 95) if press F1 index = 0 -align 16 -get_keybar_ind: - push ebx ecx edx esi edi - xor edx, edx - mov ebx, font_width - sub eax, 5 ;border - div ebx - mov edi, eax - - xor esi, esi - test [ctrlstate], 3 - jz @f - inc esi -@@: - test [ctrlstate], 0xC - jz @f - or si, 2 -@@: - test [ctrlstate], 0x30 - jz @f - or si, 4 -@@: - imul esi, 12 ;᫮ F1-F12 - xor ecx, ecx - inc ecx - mov ebx, 6 - mov eax, [cur_width] - sub eax, 11+9+3*2+6 - cmp eax, 7*11 - jl @f - cdq - mov bl, 11 - div ebx - mov ebx, eax -@@: - xor edx, edx -.l: - add edx, 7 - cmp ecx, 10 - jb @f - inc edx -@@: - cmp edx, edi - ja .ret - cmp edx, [cur_width] - ja .ret - cmp ecx, 12 - jz .ret - lea edx, [edx+ebx-6] - inc edx - cmp edx, [cur_width] - ja .ret - inc ecx - jmp .l -.ret: - lea eax, [esi+ecx-1] - pop edi esi edx ecx ebx - ret - -align 16 -process_ctrl_keys: - cmp byte [esi], 0 - jz .done - push ecx - cmp al, [esi] - jz .check -.cont: - pop ecx - add esi, 8 - jmp process_ctrl_keys -.done: - stc - ret -.check: - mov cl, 0 - call .check_ctrlkey - jc .cont - mov cl, 2 - call .check_ctrlkey - jc .cont - mov cl, 4 - call .check_ctrlkey - jc .cont - pop ecx - call dword [esi+4] - clc - ret -.check_ctrlkey: - push eax edx - movzx edx, [ctrlstate] - shr edx, cl - add cl, cl - movzx eax, word [esi+2] - shr eax, cl - and eax, 15 - cmp al, ctrlkey_tests_num - jae .fail - xchg eax, edx - and al, 3 - call [ctrlkey_tests + edx*4] - cmp al, 1 - pop edx eax - ret -.fail: - stc - pop edx eax - ret - -ctrlkey_test0: - test al, al - setz al - ret -ctrlkey_test1: - test al, al - setnp al - ret -ctrlkey_test2: - cmp al, 3 - setz al - ret -ctrlkey_test3: - cmp al, 1 - setz al - ret -ctrlkey_test4: - cmp al, 2 - setz al - ret - -enum_associations_callback: -; LongBool __stdcall callback(f_name,sec_name,key_name,key_value); -; [esp+4] = f_name, [esp+8] = sec_name, [esp+12] = key_name, [esp+16] = key_value - mov esi, [esp+12] - mov edi, esi -@@: - lodsb - test al, al - jnz @b - sub esi, edi ; esi = size of key name - mov eax, [esp+16] -@@: - inc esi - inc eax - cmp byte [eax-1], 0 - jnz @b -; esi = total size of entry - push esi - add esi, [associations_size] - mov ecx, [associations_allocated] -@@: - cmp esi, ecx - jbe @f - add ecx, ecx - jmp @b -@@: - pop esi - cmp [associations_allocated], ecx - jz @f - mov [associations_allocated], ecx - mov edx, [associations] - call xpgrealloc - mov [associations], eax - test eax, eax - jz .err -@@: - mov eax, esi - mov esi, edi - mov edi, [associations] - add edi, [associations_size] - dec edi - add [associations_size], eax -@@: - lodsb - stosb - test al, al - jnz @b - mov esi, [esp+16] -@@: - lodsb - stosb - test al, al - jnz @b -.ret: - mov al, 1 - ret 16 -.err: - mov ecx, edx - call pgfree - xor eax, eax - ret 16 - -align 4 -enum_plugins_callback: -; LongBool __stdcall callback(f_name,sec_name,key_name,key_value); -; [esp+4] = f_name, [esp+8] = sec_name, [esp+12] = key_name, [esp+16] = key_value - mov esi, [esp+16] - cmp byte [esi], '/' - jz .absolute -; convert path to absolute - mov edi, execdata -@@: - cmp edi, execdata+1024 - jae .overflow - lodsb - stosb - test al, al - jnz @b - mov edi, saved_file_name - mov [esp+16], edi - mov esi, app_path - push esi - xor ecx, ecx -@@: - lodsb - test al, al - jz @f - cmp al, '/' - jnz @b - mov ecx, esi - jmp @b -@@: - pop esi - sub ecx, esi - push edi - add edi, ecx - cmp edi, saved_file_name+1024 - pop edi - ja .overflow - rep movsb - mov esi, execdata -.z: - cmp word [esi], '.' - jz .ret - cmp word [esi], './' - jnz @f - add esi, 2 - jmp .z -@@: - cmp word [esi], '..' - jnz .c - cmp byte [esi+2], 0 - jz .ret - cmp byte [esi+2], '/' - jnz .c - add esi, 3 -@@: - dec edi - cmp edi, saved_file_name - jbe .ret - cmp byte [edi-1], '/' - jnz @b - jmp .z -.c: - cmp edi, saved_file_name+1024 - jae .overflow - lodsb - stosb - test al, al - jnz .c - jmp .absolute -.overflow: - mov esi, execdata - mov byte [esi+1023], 0 - call load_dll_and_import.big -.ret: - mov al, 1 - ret 16 -.absolute: -; allocate space for plugin info - mov eax, [num_plugins] - inc eax - mov [num_plugins], eax - imul ecx, eax, PluginInfo.size - cmp ecx, [alloc_plugins] - jbe .norealloc - mov edx, [plugins] - call xpgrealloc - test eax, eax - jnz @f -.dec_ret: - dec [num_plugins] - jmp .ret -@@: - mov [plugins], eax - lea eax, [ecx+0xFFF] - and eax, not 0xFFF - mov [alloc_plugins], eax -.norealloc: - mov esi, [plugins] - lea esi, [esi+ecx-PluginInfo.size] -; load plugin DLL - or ebp, -1 - mov eax, [esp+16] - call load_dll_and_import.do - test eax, eax - jnz .dec_ret -; find exported functions - mov eax, aVersion - call load_dll_and_import.find_exported_function - jnc @f - xor eax, eax -@@: -MIN_INTERFACE_VER = 3 -MAX_INTERFACE_VER = 3 - cmp eax, MIN_INTERFACE_VER - jb @f - cmp eax, MAX_INTERFACE_VER - jbe .version_ok -@@: - push aIncompatibleVersion -.cantload: - push dword [esp+4+16] - push aCannotLoadPlugin - mov eax, esp - push ContinueBtn - push 1 - push eax - push 3 - call SayErr - add esp, 12 - jmp .dec_ret -.version_ok: - mov edi, esi - mov esi, plugin_exported -.import: - lodsd - test eax, eax - jz .import_done - call load_dll_and_import.find_exported_function - jnc @f - mov eax, [esi-4+plugin_exported_default-plugin_exported] -@@: - stosd - jmp .import -.import_done: -; initialize plugin - mov eax, aPluginLoad - call load_dll_and_import.find_exported_function - jc .ok - push kfar_info - call eax - cmp eax, 1 - jb .ok - ja .dec_ret - push aInitFailed - jmp .cantload -.ok: - mov al, 1 - ret 16 - -plugin_unload_default: - ret - -OpenFilePlugin_default: - xor eax, eax - ret 28 -GetFiles_default: - xor eax, eax - ret 20 - -ClosePlugin_default: - ret 4 - -GetOpenPluginInfo_default: - ret 8 - -SetFolder_default: -open_default: - xor eax, eax - ret 12 - -new_screen: -; in: ecx=sizeof(screen data), edx->vtable -; out: ebp=pointer or NULL, eax!=0 if successful -; destroys ebx,ecx - call xpgalloc - test eax, eax - jnz @f - ret -@@: - mov ebp, eax - mov eax, [screens] - mov ecx, [num_screens] - inc ecx - shl ecx, 3 - test ecx, 0xFFF - jnz .norealloc - push edx - mov edx, eax - call xpgrealloc - pop edx - test eax, eax - jnz @f - mov ecx, ebp - call pgfree - xor eax, eax - ret -@@: - mov [screens], eax -.norealloc: - inc [num_screens] - mov [eax+ecx-8], edx - mov [eax+ecx-4], ebp - mov eax, [num_screens] - dec eax - mov [active_screen], eax - mov [active_screen_vtable], edx - mov [active_screen_data], ebp - or [idle_interval], -1 - mov edx, [edx+screen_vtable.keybar] - test edx, edx - jz @f - mov [active_screen_keybar], edx -@@: - jmp draw_keybar - -next_screen: - mov eax, [active_screen] - inc eax - cmp eax, [num_screens] - jnz @f - xor eax, eax -@@: mov [active_screen], eax - jmp change_screen - -delete_active_screen: - mov edi, [screens] - mov eax, [active_screen] - shl eax, 3 - add edi, eax - push dword [edi+4] - lea esi, [edi+8] - mov ecx, [num_screens] - sub ecx, [active_screen] - dec ecx - add ecx, ecx - rep movsd - dec [num_screens] - mov ecx, [num_screens] - shl ecx, 3 - test ecx, 0xFFF - jnz .norealloc - mov edx, [screens] - call pgrealloc ; must succeed, because we decrease size - mov [screens], eax -.norealloc: - pop ecx - call pgfree - dec [active_screen] - -change_screen: - pusha - or [idle_interval], -1 - mov eax, [active_screen] - mov esi, [screens] - mov ebp, [esi+eax*8+4] - mov eax, [esi+eax*8] - push eax ebp - mov eax, [eax+screen_vtable.OnActivate] - test eax, eax - jz @f - call eax -@@: - pop ebp eax - mov [active_screen_vtable], eax - mov [active_screen_data], ebp - mov edx, [eax+screen_vtable.keybar] - test edx, edx - jz @f - mov [active_screen_keybar], edx -@@: - call draw_keybar - mov [cursor_size], cursor_normal_size - call [eax+screen_vtable.OnRedraw] - popa - ret - -F12: - mov eax, [cur_width] - add eax, 8 - mov esi, eax - mul [num_screens] - mov ecx, eax - call xpgalloc - test eax, eax - jnz @f - ret -@@: - mov ebx, eax - mov edi, eax - xor ecx, ecx -.next: - xor eax, eax - stosd - inc ecx - cmp ecx, [num_screens] - jz @f - lea eax, [edi+esi-4] - mov dword [edi-4], eax -@@: - xor eax, eax - stosd - dec ecx - jz @f - lea eax, [edi-8] - sub eax, esi - mov dword [edi-4], eax -@@: - mov al, '&' - stosb - cmp ecx, 36 - jae .noletter - lea eax, [ecx+'0'] - cmp al, '9' - jbe @f - add al, 7 -@@: - stosb - mov al, '.' - stosb - jmp .letter_done -.noletter: - mov al, ' ' - stosb - stosb -.letter_done: - mov al, ' ' - stosb - pushad - mov eax, [screens] - mov ebp, [eax+ecx*8+4] - mov eax, [eax+ecx*8] - mov ecx, [cur_width] - sub ecx, 12 - call [eax + screen_vtable.getname] - popad - sub edi, 4 - add edi, [cur_width] - inc ecx - cmp ecx, [num_screens] - jb .next - mov eax, [active_screen] - mul esi - add eax, ebx - push 1 - push dword aScreens - push eax - call menu - cmp eax, -1 - jz @f - sub eax, ebx - div esi - mov [active_screen], eax -@@: - mov ecx, ebx - call pgfree - jmp change_screen - -panels_OnKey: -; restore screen hidden by quick search box - cmp [bDisplayQuickSearch], 0 - jz @f - mov [bDisplayQuickSearch], 0 - push 0 - push QuickSearchDlg - call HideDialogBox -@@: - mov ebp, [active_panel] - mov ecx, [ebp + PanelData.index] - mov edx, [ebp + PanelData.start] - mov ebx, [ebp + PanelData.colst] - add ebx, edx - mov esi, panels_ctrlkeys - call process_ctrl_keys - jc .nostdkey - mov [bQuickSearchMode], 0 - ret -.leaveqsmode: - mov [bQuickSearchMode], 0 - call draw_image - ret -.keepqsmode: - push QuickSearchDlg - call ShowDialogBox - mov [bDisplayQuickSearch], 1 - ret -.nostdkey: - cmp [bQuickSearchMode], 0 - jz .noqsmode - test al, al - js .keepqsmode - cmp al, 40h - jae .leaveqsmode - cmp al, 0Eh - jz .qsbackspace - cmp al, 1Ch - jz .test_enter - movzx eax, al - cmp byte [scan2ascii+eax], 0 - jz .leaveqsmode - call get_ascii_char - mov ecx, dword [quick_search_buf + 4] - cmp ecx, quicksearch_maxlen - jae .keepqsmode - mov byte [quick_search_buf + 12 + ecx], al - mov byte [quick_search_buf + 12 + ecx + 1], 0 - push ecx - call quick_find - pop ecx - jnc @f - mov byte [quick_search_buf + 12 + ecx], 0 - jmp .keepqsmode -@@: - inc dword [quick_search_buf + 4] - sub ecx, 16 - jae @f - xor ecx, ecx -@@: - mov dword [quick_search_buf + 8], ecx - jmp .keepqsmode -.qsbackspace: - mov ecx, dword [quick_search_buf + 4] - jecxz .keepqsmode2 - dec ecx - mov byte [quick_search_buf + 12 + ecx], 0 - dec dword [quick_search_buf + 4] -.keepqsmode2: - jmp .keepqsmode -.test_enter: - test [ctrlstate], 0Ch ; LCtrl or RCtrl pressed? - jz .keepqsmode2 - test [ctrlstate], 3 ; Shift pressed? - jnz @f - call quick_find_next - jmp .keepqsmode2 -@@: - call quick_find_prev - jmp .keepqsmode2 -.noqsmode: -; handle Alt+ combinations for quick search - test [ctrlstate], 30h ; LAlt or RAlt pressed? - jz .noalt ; no => skip - test [ctrlstate], 0Ch ; LCtrl or RCtrl pressed? - jnz .noalt ; yes => skip - cmp al, 40h - jae .noalt - movzx eax, al - cmp byte [scan2ascii+eax], 0 - jz .noalt - call get_ascii_char - mov edi, quick_search_buf + 12 - mov dword [edi-12], quicksearch_maxlen-1 - mov dword [edi-8], 1 - and dword [edi-4], 0 - stosb - mov byte [edi], 0 - call quick_find - jnc @f - mov byte [quick_search_buf + 12], 0 - and dword [quick_search_buf + 4], 0 -@@: - mov ebx, QuickSearchDlg - mov eax, [ebp + PanelData.left] - add eax, 10 - mov edx, [cur_width] - sub edx, 21 - cmp eax, edx - jb @f - mov eax, edx -@@: - mov [ebx + dlgtemplate.x], eax - mov eax, [ebp + PanelData.top] - add eax, [ebp + PanelData.height] - mov edx, [cur_height] - sub edx, 2 - cmp eax, edx - jb @f - mov eax, edx -@@: - mov [ebx + dlgtemplate.y], eax - push ebx - call ShowDialogBox - mov [bQuickSearchMode], 1 - mov [bDisplayQuickSearch], 1 -.find_letter_done: -.noalt: -.ret: - ret -.up: - jecxz .ret - dec ecx - mov [ebp + PanelData.index], ecx - cmp ecx, edx - jae .done_redraw - mov [ebp + PanelData.start], ecx -.done_redraw: -; call draw_panel -; ret - jmp draw_panel -.insert: - lea eax, [ecx*4] - add eax, [ebp + PanelData.files] - mov eax, [eax] - cmp word [eax+40], '..' - jnz @f - cmp byte [eax+42], 0 - jz .insert.down -@@: - xor byte [eax+303], 1 - mov edx, [eax+32] - test byte [eax+303], 1 - mov eax, [eax+36] - jnz .insert.increase - sub dword [ebp + PanelData.selected_size], edx - sbb dword [ebp + PanelData.selected_size+4], eax - dec [ebp + PanelData.selected_num] - jmp .insert.down -.insert.increase: - add dword [ebp + PanelData.selected_size], edx - adc dword [ebp + PanelData.selected_size+4], eax - inc [ebp + PanelData.selected_num] -.insert.down: - inc ecx - cmp ecx, [ebp + PanelData.numfiles] - jae .done_redraw - jmp @f -.down: - inc ecx - cmp ecx, [ebp + PanelData.numfiles] - jae .ret -@@: - mov [ebp + PanelData.index], ecx - cmp ecx, ebx - jb .done_redraw - sub ecx, [ebp + PanelData.colst] - inc ecx - mov [ebp + PanelData.start], ecx - jmp .done_redraw -.left: - test ecx, ecx - jnz @f - ret -@@: - mov eax, [ebp + PanelData.colsz] - sub ecx, eax - jae @f - xor ecx, ecx -@@: - mov [ebp + PanelData.index], ecx -.finalize_left: - cmp ecx, edx - jae .done_redraw - sub edx, eax - jae @f - xor edx, edx -@@: - mov [ebp + PanelData.start], edx - jmp .done_redraw -.pgup: - mov eax, [ebp + PanelData.colst] - dec eax - jnz @f - inc eax -@@: - test ecx, ecx - jnz @f - ret -@@: - sub ecx, eax - jae @f - xor ecx, ecx -@@: - mov [ebp + PanelData.index], ecx - dec ecx - jmp .finalize_left -.right: - mov eax, [ebp + PanelData.colsz] - add ecx, eax - cmp ecx, [ebp + PanelData.numfiles] - jb @f - mov ecx, [ebp + PanelData.numfiles] - dec ecx -@@: - mov [ebp + PanelData.index], ecx -.finalize_right: - cmp ecx, ebx - jb .done_redraw - add ebx, eax - cmp ebx, [ebp + PanelData.numfiles] - jbe @f - mov ebx, [ebp + PanelData.numfiles] -@@: - sub ebx, [ebp + PanelData.colst] - jae @f - xor ebx, ebx -@@: - mov [ebp + PanelData.start], ebx - jmp .done_redraw -.pgdn: - mov eax, [ebp + PanelData.colst] - dec eax - jnz @f - inc eax -@@: - add ecx, eax - cmp ecx, [ebp + PanelData.numfiles] - jb @f - mov ecx, [ebp + PanelData.numfiles] - dec ecx -@@: - mov [ebp + PanelData.index], ecx - inc ecx - jmp .finalize_right -.tab: - xor [active_panel], panel1 xor panel2 - call draw_cmdbar - call draw_panel - mov ebp, [active_panel] - jmp .done_redraw -.home: - and [ebp + PanelData.start], 0 - and [ebp + PanelData.index], 0 - jmp .done_redraw -.end: - mov eax, [ebp + PanelData.numfiles] - dec eax - mov [ebp + PanelData.index], eax - inc eax - sub eax, [ebp + PanelData.colst] - jae @f - xor eax, eax -@@: - mov [ebp + PanelData.start], eax - jmp .done_redraw -.enter: - cmp [bQuickSearchMode], 0 - jz @f - call draw_image -@@: - call get_curfile_folder_entry - test byte [ecx], 10h - jnz .enter_folder -; todo: add handling on plugin panel - cmp [ebp + PanelData.hPlugin], 0 - jnz .ret -; generate full file name - lea esi, [ebp + PanelData.dir] - mov edi, execdata -@@: - lodsb - test al, al - jz @f - stosb - cmp edi, execdataend-1 - jae .bigfilename - jmp @b -@@: - lea esi, [ecx+40] - mov al, '/' - stosb -@@: - lodsb - stosb - cmp edi, execdataend - ja .bigfilename - test al, al - jnz @b -; try to open file and look for all plugins - push O_READ - push execdata - call open - test eax, eax - jz .noplugins ; if can't open, just try to execute - mov esi, eax ; save handle - push filedata_buffer_size - push filedata_buffer - push esi - call read - mov edi, eax ; save size of read data -; test for Kolibri executable - cmp eax, 24h - jb .enter.noexec - cmp dword [filedata_buffer], 'MENU' - jnz @f - cmp word [filedata_buffer+4], 'ET' - jnz @f -.close_run: - push esi - call close - jmp .run_app -@@: - cmp dword [filedata_buffer], 'KPCK' - jnz @f - cmp dword [filedata_buffer+12], 0x26914601 - jz .close_run -@@: -.enter.noexec: - mov ecx, [num_plugins] - mov edx, [plugins] - sub edx, PluginInfo.size -.plugloop: - add edx, PluginInfo.size - dec ecx - js .plugdone - pushad - push execdata - push [ebp+ PanelData.hFile] - push [ebp+ PanelData.hPlugin] - push edi - push filedata_buffer - call get_curfile_folder_entry - push ecx - push esi - call [edx+PluginInfo.OpenFilePlugin] - mov [esp+28], eax - popad - test eax, eax - jz .plugloop - cmp eax, -1 - jnz .pluginok - push esi - call close - ret -.pluginok: -; save current directory and set root directory of hPlugin - mov edi, eax ; save handle - mov esi, execdata -@@: - lodsb - test al, al - jnz @b - sub esi, execdata-9 -; allocate esi bytes in buffer 'parents' - mov ecx, [ebp + PanelData.parents_sz] - add ecx, esi - cmp ecx, [ebp + PanelData.parents_alloc] - jbe .enter.norealloc - push edx - mov edx, [ebp + PanelData.parents] - call xpgrealloc - pop edx - test eax, eax - jnz @f - push edi - call [edx+PluginInfo.ClosePlugin] - ret -@@: - mov [ebp + PanelData.parents], eax -.enter.norealloc: - mov [ebp + PanelData.parents_sz], ecx -; save current state to the end of buffer - sub ecx, esi - add ecx, [ebp + PanelData.parents] - xchg edx, [ebp + PanelData.hPlugin] - mov [ecx], edx - xchg edi, [ebp + PanelData.hFile] - mov [ecx+4], edi - mov byte [ecx+8], 0 - lea edi, [ecx+9] - lea ecx, [esi-9] - mov esi, execdata - rep movsb - mov word [ebp + PanelData.dir], '/' - mov eax, [ebp + PanelData.hPlugin] - lea ebx, [ebp + PanelData.plugin_flags] ;plugin_info - and dword [ebx], 0 - push ebp - push ebx - push [ebp + PanelData.hFile] - call [eax+PluginInfo.GetOpenPluginInfo] - pop ebp - call get_curfile_folder_entry - mov esi, ecx - mov edi, left_dotdot_entry - cmp ebp, panel1 - jz @f - add edi, right_dotdot_entry-left_dotdot_entry -@@: - mov ecx, 10 - rep movsd - mov byte [edi-40], 10h ; attributes: folder - mov eax, '..' - stosd - jmp .reread -.plugdone: - push esi - call close -.noplugins: -; run program or association - call get_curfile_folder_entry - call find_extension - jc .run_app -.run_association: - cmp byte [edi], 0 - jz .l1 - cmp byte [edi], ';' - jnz @f -.l1: - ret -@@: - mov esi, edi -@@: - lodsb - test al, al - jz @f - cmp al, ';' - jnz @b - dec esi - mov byte [esi], 0 - mov [restore_semicolon], esi -@@: -.run_association2: - mov [execparams], execdata - mov [execptr], edi - jmp .dorun -.run_app: - mov [execptr], execdata - and [execparams], 0 -.dorun: - lea esi, [ebp + PanelData.dir] - mov edi, execdata -@@: - lodsb - test al, al - jz @f - stosb - cmp edi, execdataend-1 - jae .bigfilename - jmp @b -@@: - lea esi, [ecx+40] - mov al, '/' - stosb -@@: - lodsb - stosb - cmp edi, execdataend - ja .bigfilename - test al, al - jnz @b -; for fasm call - special handling, because -; 1) fasm command line convention is different : fasm infile,outfile[,path] rather than tinypad infile -; 2) fasm will probably create new file in directory, so we want to reload panel data - xor edx, edx - cmp [execparams], edx - jz .nofasm - mov esi, [execptr] -@@: - lodsb - test al, al - jnz @b - mov eax, [esi-5] - or eax, 0x20202020 - cmp eax, 'fasm' - jnz .nofasm - cmp edi, execdata+(execdataend-execdata)/2 - ja .bigfilename - mov esi, execdata -@@: - lodsb - stosb - test al, al - jnz @b - mov byte [esi-1], ',' - inc edx -; output file: no extension if input file has extension, '.bin' otherwise - push edi -@@: - dec edi - cmp byte [edi], '.' - jz .ptfound - cmp byte [edi], '/' - jnz @b - pop edi - cmp edi, execdataend-4 - ja .bigfilename - mov dword [edi-1], '.bin' - mov byte [edi+3], 0 - jmp .nofasm -.ptfound: - mov byte [edi], 0 - pop edi -.nofasm: - mov ebx, execinfo -; if command line is more than 256 symbols, the kernel will truncate it -; we do not want this! -; N.B. We know that command line is either NULL or execdata, which is always ASCIIZ string, -; but can be up to 1023 symbols - mov esi, [ebx+8] - test esi, esi - jz .cmdlinelenok -@@: - lodsb - test al, al - jnz @b - sub esi, [ebx+8] - dec esi - cmp esi, 256 - ja .bigcmdline -.cmdlinelenok: - push SF_FILE - pop eax - int 40h - xor esi, esi - xchg esi, [restore_semicolon] - test esi, esi - jz @f - mov byte [esi], ';' -@@: - neg eax - js @f - call get_error_msg - push eax - push dword aRunError - mov eax, esp - push ContinueBtn - push 1 - push eax - push 2 - call SayErr - pop eax - pop eax - ret -@@: - test edx, edx - jz @f - push SF_SLEEP - pop eax - push 20 - pop ebx - int 0x40 - jmp .ctrl_r -@@: - ret -.bigfilename3: - pop esi -.bigfilename2: - pop esi -.bigfilename: - mov eax, aFileNameTooBig -.l2: - xor esi, esi - xchg esi, [restore_semicolon] - test esi, esi - jz @f - mov byte [esi], ';' -@@: - push eax - mov eax, esp - push ContinueBtn - push 1 - push eax - push 1 - call SayErr - pop eax - ret -.bigcmdline: - mov eax, aCmdLineTooBig - jmp .l2 -.bigfoldername2: - mov esi, prev_dir - lea edi, [ebp + PanelData.dir] -@@: - lodsb - stosb - test al, al - jnz @b -.bigfoldername: - mov eax, aFolderNameTooBig - jmp .l2 -.enter_folder: - lea esi, [ecx+40] - cmp word [esi], '..' - jnz @f - cmp byte [esi+2], 0 - jz .dotdot -@@: - push esi - lea esi, [ebp + PanelData.dir] - mov edi, prev_dir -@@: - lodsb - stosb - test al, al - jnz @b - lea edi, [esi-1] - lea edx, [ebp + PanelData.dir + 1024] - cmp esi, edx - pop esi - jae .bigfoldername - mov al, '/' - cmp [edi-1], al - jz @f - stosb -@@: - lodsb - cmp edi, edx - jae .bigfoldername2 - stosb - test al, al - jnz @b - mov eax, [ebp + PanelData.hPlugin] - test eax, eax - jz .reread - push ebp - lea esi, [ebp + PanelData.dir] - push esi - add ecx, 40 - push ecx - push [ebp + PanelData.hFile] - call [eax+PluginInfo.SetFolder] - pop ebp - test al, al - jnz .reread - mov esi, prev_dir - lea edi, [ebp + PanelData.dir] -@@: - lodsb - stosb - test al, al - jnz @b -.retd: - ret -.reread: - call read_folder -.done_cmdbar: - call draw_cmdbar - jmp .done_redraw -.dotdot: - lea edi, [ebp + PanelData.dir] - cmp word [edi], '/' - jnz .dotdot_noroot - cmp [ebp + PanelData.hPlugin], 0 - jz .retd - call close_plugin_panel - jmp .dotdot -.dotdot_noroot: - mov edx, edi - mov al, 0 - or ecx, -1 - repnz scasb - dec edi - mov al, '/' - std - repnz scasb - cld - inc edi - cmp edi, edx - jnz @f - inc edi -@@: - push dword [edi] - mov byte [edi], 0 - push edi - mov eax, [ebp + PanelData.hPlugin] - test eax, eax - jz .dotdot_native - push ebp - lea esi, [ebp + PanelData.dir] - push esi - push aDotDot - push [ebp + PanelData.hFile] - call [eax+PluginInfo.SetFolder] - pop ebp - test al, al - jnz .dotdot_native - pop edi - pop dword [edi] - ret -.dotdot_native: - call read_folder - pop edi - pop dword [edi] - push edi - cmp byte [edi], '/' - jnz @f - inc edi -@@: - mov edx, [ebp + PanelData.files] - mov ecx, [ebp + PanelData.numfiles] -.scanloop: - mov esi, [edx] - add esi, 40 - push esi edi -@@: - lodsb - call match_symbol - jnz @f - inc edi - test al, al - jnz @b -@@: - pop edi esi - jz .scanfound - add edx, 4 - loop .scanloop - jmp .scandone -.scanfound: - sub edx, [ebp + PanelData.files] - shr edx, 2 - mov [ebp + PanelData.index], edx - sub edx, [ebp + PanelData.colst] - jb .scandone - inc edx - mov [ebp + PanelData.start], edx -.scandone: - pop edi - mov byte [edi], 0 - jmp .done_cmdbar -.ctrl_f3_9: - sub al, 0x3D - add al, al - mov ah, [ebp + PanelData.sortmode] - and ah, 0xFE - cmp al, ah - jnz @f - and [ebp + PanelData.sortmode], 1 - or al, [ebp + PanelData.sortmode] - xor al, 1 -@@: - mov [ebp + PanelData.sortmode], al - mov eax, [ebp + PanelData.index] - mov ecx, [ebp + PanelData.files] - push dword [ecx+eax*4] - push ecx - call sort_files - pop edi - pop eax - or ecx, -1 - repnz scasd - not ecx - dec ecx - mov [ebp + PanelData.index], ecx - sub ecx, [ebp + PanelData.start] - jb .less_start - sub ecx, [ebp + PanelData.colst] - jae .gr_end -@@: jmp .done_redraw -.less_start: - add [ebp + PanelData.start], ecx - jmp @b -.gr_end: - inc ecx - add [ebp + PanelData.start], ecx - jmp @b -.alt_f1_2: - mov ebp, panel1 - cmp al, 0x3B - jz @f - mov ebp, panel2 -@@: -; get drives list - mov ebx, dirinfo - mov [ebx+dirinfo.size-dirinfo], 1 - mov [ebx+dirinfo.dirdata-dirinfo], driveinfo - mov [ebx+dirinfo.name-dirinfo], tmpname - mov byte [tmpname], '/' - xor edx, edx - xor ecx, ecx -.drive_loop_e: - mov byte [tmpname+1], 0 - push SF_FILE - pop eax - int 40h - mov ebx, dirinfo - test eax, eax - jnz .drive_loop_e_done - mov esi, driveinfo+32+40 - mov edi, tmpname+1 -@@: - lodsb - stosb - test al, al - jnz @b - push [ebx+dirinfo.first-dirinfo] - and [ebx+dirinfo.first-dirinfo], 0 -.drive_loop_i: - push SF_FILE - pop eax - int 40h - mov ebx, dirinfo - test eax, eax - jnz .drive_loop_i_done - add ecx, 32+8 - push ecx - and ecx, 0xFFF - cmp ecx, 32+8 - pop ecx - ja @f - call xpgrealloc - mov edx, eax - test eax, eax - jnz @f - pop eax - ret -@@: - lea edi, [edx+ecx-32] - mov esi, tmpname -@@: - lodsb - test al, al - jz @f - stosb - jmp @b -@@: - mov esi, driveinfo+32+40 - mov al, '/' - stosb -@@: - lodsb - stosb - test al, al - jnz @b - inc [ebx+dirinfo.first-dirinfo] - jmp .drive_loop_i -.drive_loop_i_done: - pop [ebx+dirinfo.first-dirinfo] - inc [ebx+dirinfo.first-dirinfo] - jmp .drive_loop_e -.drive_loop_e_done: - and [ebx+dirinfo.first-dirinfo], 0 - mov edi, edx - xor esi, esi - add ecx, edx -@@: - and dword [edi], 0 - mov dword [edi+4], esi - mov esi, edi - add edi, 32+8 - cmp edi, ecx - jae @f - mov [esi], edi - jmp @b -@@: - mov ecx, edx - lea edi, [ebp + PanelData.dir] - cmp [ebp + PanelData.hPlugin], 0 - jz .find_cur_drive_loop - mov edi, [ebp + PanelData.parents] - add edi, 8 -.find_cur_drive_loop: - push edi - lea esi, [ecx+8] -@@: - lodsb - test al, al - jz .cur_drive_found - call match_symbol - jnz @f - inc edi - jmp @b -@@: - cmp dword [ecx], 0 - jz @f - pop edi - mov ecx, [ecx] - jmp .find_cur_drive_loop -@@: - mov ecx, edx -.cur_drive_found: - pop edi - push 1 - push aDrive - push ecx - mov eax, [ebp + PanelData.height] - sub eax, 2 - jae @f - add eax, 2 -@@: - push eax - push [ebp + PanelData.width] - push [ebp + PanelData.top] - push [ebp + PanelData.left] - call menu_centered_in - cmp eax, -1 - jnz @f - mov ecx, edx - call pgfree - ret -@@: - push eax - push edx - call close_plugin_panels - pop edx - lea edi, [ebp + PanelData.dir] - push edi - mov esi, edi - mov edi, prev_dir - mov ecx, 1024/4 - rep movsd - pop edi - pop esi - add esi, 8 -@@: - lodsb - stosb - test al, al - jnz @b - mov ecx, edx - call pgfree - call read_folder - jmp .done_redraw -.shift_f5: -; todo: copy to plugin panel - cmp [ebp + PanelData.hPlugin], 0 - jz @f - ret -@@: - mov esi, ebp - cmp [ebp + PanelData.selected_num], 0 - jnz .f5_2 - call get_curfile_folder_entry - lea esi, [ecx+40] - mov edi, CopyDestEditBuf - mov eax, CopyDestEditBuf.length - stosd - scasd - xor eax, eax - stosd - mov edx, edi -@@: - lodsb - test al, al - jz .f5_common - stosb - jmp @b -.f5: -; todo: copy to plugin panel - mov esi, ebp - xor esi, panel1 xor panel2 - cmp [esi + PanelData.hPlugin], 0 - jz .f5_2 - ret -.f5_2: - add esi, PanelData.dir - mov edi, CopyDestEditBuf - mov eax, CopyDestEditBuf.length - stosd - scasd - xor eax, eax - stosd - mov edx, edi -@@: - lodsb - test al, al - jz @f - cmp edi, CopyDestEditBuf+12+511 - jae .bigfoldername - stosb - jmp @b -@@: - mov al, '/' - stosb -.f5_common: - mov eax, [ebp + PanelData.hPlugin] - mov [source_hModule], eax - mov eax, [ebp + PanelData.hFile] - mov [source_hPlugin], eax - mov eax, left_dotdot_entry - cmp ebp, panel1 - jz @f - add eax, right_dotdot_entry-left_dotdot_entry -@@: - mov [default_attr], eax - mov byte [edi], 0 - sub edi, edx - mov [edx-8], edi - mov edi, CopySourceTextBuf - mov esi, aCopy1 -@@: - lodsb - test al, al - jz @f - stosb - jmp @b -@@: - mov eax, [ebp + PanelData.selected_num] - test eax, eax - jz .f5_noselected1 - mov ebx, eax - push 10 - pop ecx - push -'0' -@@: - xor edx, edx - div ecx - push edx - test eax, eax - jnz @b -@@: - pop eax - add al, '0' - jz @f - stosb - jmp @b -@@: -if lang eq ru_RU - mov dword [edi], ' ' - mov dword [edi+4], '' - add edi, 8 - cmp ebx, 1 - jz @f - mov al, '' - stosb - cmp ebx, 4 - jbe @f - mov word [edi-1], '' - inc edi -@@: -else - mov dword [edi], ' ite' - mov byte [edi+4], 'm' - add edi, 5 - cmp ebx, 1 - jz @f - mov al, 's' - stosb -@@: -end if - jmp .f5_selected1 - -.f5_noselected1: - mov al, '"' - stosb - call get_curfile_folder_entry - lea esi, [ecx+40] - lea eax, [esi+1] -@@: - inc esi - cmp byte [esi-1], 0 - jnz @b - sub esi, eax - xchg eax, esi - dec esi - mov edx, [cur_width] - sub edx, 50 - sub eax, edx - jbe @f - add esi, eax - mov al, '.' - stosb - stosb - stosb -@@: - lodsb - test al, al - jz @f - stosb - jmp @b -@@: - mov al, '"' - stosb -.f5_selected1: - mov esi, aCopy2 -@@: - lodsb - stosb - test al, al - jnz @b - mov ebx, copy_dlgdata - mov eax, [cur_width] - sub eax, 12 - mov [ebx + dlgtemplate.width], eax - dec eax - dec eax - mov [ebx - copy_dlgdata + copy_dlgdata.lcopy.x2], eax - mov [ebx - copy_dlgdata + copy_dlgdata.ename.x2], eax - shr eax, 1 - dec eax - dec eax - mov [ebx - copy_dlgdata + copy_dlgdata.copy.x2], eax - sub eax, aCopyLength-1 - mov [ebx - copy_dlgdata + copy_dlgdata.copy.x1], eax - add eax, aCopyLength+3 - mov [ebx - copy_dlgdata + copy_dlgdata.cnl.x1], eax - add eax, aCancelBLength - 1 - mov [ebx - copy_dlgdata + copy_dlgdata.cnl.x2], eax - mov byte [ebx - copy_dlgdata + copy_dlgdata.ename.flags], 0xC - and byte [ebx - copy_dlgdata + copy_dlgdata.copy.flags], not 4 - and byte [ebx - copy_dlgdata + copy_dlgdata.cnl.flags], not 4 - push ebx - call DialogBox - cmp eax, copy_dlgdata.copy - jnz .ret2 -; 㥬 - mov esi, CopyDestEditBuf+12 - mov edi, esi - xor eax, eax - or ecx, -1 - repnz scasb - dec edi - dec edi - cmp edi, esi - jb .ret2 - mov [bEndSlash], 0 - cmp byte [edi], '/' - jnz @f - cmp edi, esi - jz @f - mov byte [edi], 0 - dec edi - mov [bEndSlash], 1 -@@: -; ᫨ 稭 , ⠥ ⭮⥫쭮 ⥪饩 - cmp byte [esi], '/' - jz .copy_absolute_path - push esi - push edi - lea edi, [ebp + PanelData.dir] - or ecx, -1 - xor eax, eax - repnz scasb - not ecx - pop edi - push edi - add edi, ecx - cmp edi, CopyDestEditBuf+12+513 - pop edi - jb @f - pop esi - jmp .bigfilename -@@: - lea edx, [edi+2] - sub edx, esi - lea edi, [edi+ecx+1] - xchg ecx, edx - std - lea esi, [esi+ecx-1] - rep movsb - cld - pop edi - lea esi, [ebp + PanelData.dir] - push edi - mov ecx, edx - rep movsb - mov byte [edi-1], '/' - pop esi -.copy_absolute_path: -; 砫 ᮧ 襫騥 , -; ᫥ ⮢ 䠩, ⠪ ; -; 㥬 砥, ᫨ 筨  - xor edx, edx - cmp [ebp + PanelData.selected_num], 0 - jz .f5_noselected2 - mov ecx, [ebp + PanelData.numfiles] - mov edi, [ebp + PanelData.files] -.scanselected2: - mov eax, [edi] - add edi, 4 - test byte [eax+303], 1 - jz @f - test byte [eax], 10h - jz @f - inc edx -@@: - loop .scanselected2 - jmp .f5_selected2 -.f5_noselected2: - call get_curfile_folder_entry - test byte [ecx], 10h - setnz dl -.f5_selected2: - xor eax, eax - mov edi, esi -.countslashloop: - cmp byte [edi], '/' - jnz @f - inc eax - mov ecx, edi -@@: - inc edi - cmp byte [edi], 0 - jnz .countslashloop - mov [bNeedRestoreName], 0 -; "/file-system/partition" folders already exist, so we don't need to create them - cmp eax, 2 - jbe .createupdone -; we interpret destination as folder if edx!=0 or bEndSlash!=0 - test edx, edx - jnz @f - cmp [bEndSlash], 0 - jnz @f - mov edi, ecx - dec eax -@@: - mov [attrinfo.name], esi - mov ecx, eax -; 饬 ᫥ , -.createuploop1: - cmp eax, 2 - jbe .createupdone1 - mov dl, [edi] - mov byte [edi], 0 - push eax - push SF_FILE - pop eax - mov ebx, attrinfo - int 0x40 - test eax, eax - pop eax - mov byte [edi], dl - jnz .createupcont1 - test byte [attrinfo.attr], 10h - jnz .createupdone1 -; the item required to be a folder, but is file - push aNotFolder - push esi - mov eax, esp - push ContinueBtn - push 1 - push eax - push 2 - call SayErr - pop eax - pop eax -.ret3: - ret -.createupcont1: - dec eax -@@: - dec edi - cmp byte [edi], '/' - jnz @b - jmp .createuploop1 -.createupdone1: -; ᮧ , 㦭 - cmp eax, ecx - jae .createupdone -@@: - inc edi - cmp byte [edi], 0 - jz @f - cmp byte [edi], '/' - jnz @b -@@: - mov dl, byte [edi] - mov byte [edi], 0 - push eax - push RetryOrCancelBtn - push 2 - call makedir - mov byte [edi], dl - mov [bNeedRestoreName], 1 - pop eax - jnz .ret3 - inc eax - jmp .createupdone1 -.createupdone: - mov dl, 1 - cmp byte [edi], 1 - sbb eax, -1 - cmp eax, 2 - jbe .docopy - mov [attrinfo.attr], 0 ; assume zero attributes if error - push SF_FILE - pop eax - mov ebx, attrinfo - int 0x40 - test [attrinfo.attr], 10h - setnz dl -.docopy: - call get_curfile_folder_entry - mov eax, ecx - cmp [bNeedRestoreName], 0 - jz @f - cmp [bEndSlash], 0 - jnz @f - cmp [ebp + PanelData.selected_num], 0 - jnz @f - test byte [eax], 10h - jz @f - mov dl, 0 -@@: -; 稭 ᮡ⢥ ஢ - mov [bDestIsFolder], dl - mov [copy_bSkipAll], 0 - mov [copy_bSkipAll2], 0 - mov [copy_bSkipAll3], 0 - test [ebp + PanelData.plugin_flags], 2 - jnz .copy_GetFiles - cmp [ebp + PanelData.selected_num], 0 - jnz .f5_selected3 - call copy_file -.copydone: - push ebp - call .ctrl_r - pop ebp - xor ebp, panel1 xor panel2 - jmp .ctrl_r -.f5_selected3: - mov ecx, [ebp + PanelData.numfiles] - mov esi, [ebp + PanelData.files] -.f5_selected_copyloop: - lodsd - test byte [eax+303], 1 - jz .f5_selected_copycont - mov [bDestIsFolder], dl - call copy_file - ja .f5_multiple_cancel - and byte [eax+303], not 1 - pushad - call draw_panel - cmp [bNeedRestoreName], 0 - jz @f - mov esi, CopyDestEditBuf+12 - call delete_last_name_from_end -@@: - popad -.f5_selected_copycont: - loop .f5_selected_copyloop -.f5_multiple_cancel: - jmp .copydone -.copy_GetFiles: - mov ecx, [ebp + PanelData.selected_num] - cmp ecx, 1 - adc ecx, 0 - shl ecx, 2 - call xpgalloc - test eax, eax - jnz @f - ret -@@: - push ebp eax ; save - push copy_AddDir ; adddir - push copy_AddFile ; addfile - push eax ; items - shr ecx, 2 - push ecx ; NumItems - push [ebp + PanelData.hFile] - mov edi, eax - call get_curfile_folder_entry - mov [edi], ecx - cmp [ebp + PanelData.selected_num], 0 - jz .cgf1 - mov esi, [ebp + PanelData.files] - mov ecx, [ebp + PanelData.numfiles] -.cgf0: - lodsd - test byte [eax+303], 1 - jz @f - stosd -@@: - loop .cgf0 -.cgf1: - mov eax, [ebp + PanelData.hPlugin] - call [eax+PluginInfo.GetFiles] - pop ecx ebp - call pgfree - jmp .copydone - -.f3: - mov eax, [ebp + PanelData.files] - mov ecx, [eax+ecx*4] - test byte [ecx], 10h - jnz .ret2 - lea esi, [ebp + PanelData.dir] - xor eax, eax - call view_file -.ret2: - ret -.f4: - call edit_file - ret -.f8_has_selected: - mov edi, saved_file_name+511 - mov byte [edi], 0 - mov eax, [ebp + PanelData.selected_num] -if lang eq ru_RU - cmp eax, 1 - jz @f - dec edi - mov byte [edi], '' - cmp eax, 4 - jbe @f - dec edi - mov word [edi], '' -@@: - mov dword [edi-4], '' - mov dword [edi-8], ' ' - sub edi, 8 -else - cmp eax, 1 - jz @f - dec edi - mov byte [edi], 's' -@@: - mov dword [edi-4], 'item' - mov byte [edi-5], ' ' - sub edi, 5 -end if - xor edx, edx - push 10 - pop ecx -@@: - div ecx - add dl, '0' - dec edi - mov [edi], dl - xor edx, edx - test eax, eax - jnz @b - push edi - push aConfirmDeleteText - mov eax, esp - push DeleteOrCancelBtn - push 2 - push eax - push 2 - push aDeleteCaption - call Message - add esp, 8 - test eax, eax - jnz .ret2 - mov [del_bSkipAll], 0 - mov ecx, [ebp + PanelData.numfiles] - jecxz .ret2 - mov esi, [ebp + PanelData.files] -.f8_loop: - lodsd - test byte [eax+303], 1 - jz @f - call delete_file - ja .f8_multiple_cancel -@@: - loop .f8_loop -.f8_multiple_cancel: - jmp .copydone -.f8: -; todo: delete files from plugin panel - cmp [ebp + PanelData.hPlugin], 0 - jz @f - ret -@@: - cmp [ebp + PanelData.selected_num], 0 - jnz .f8_has_selected - call get_curfile_folder_entry - cmp word [ecx+40], '..' - jnz @f - cmp byte [ecx+42], 0 - jz .f8_not_allowed -@@: - cmp [bConfirmDelete], 0 - jz .f8_allowed - lea eax, [ecx+40] - push eax - mov esi, aConfirmDeleteText - mov edi, aConfirmDeleteTextBuf - push edi -@@: - lodsb - stosb - test al, al - jnz @b - dec edi - mov esi, aDeleteFolder - test byte [ecx], 10h - jnz @f - mov esi, aDeleteFile -@@: - lodsb - stosb - test al, al - jnz @b - mov eax, esp - push DeleteOrCancelBtn - push 2 - push eax - push 2 - push aDeleteCaption - call Message - add esp, 8 - test eax, eax - jz .f8_allowed -.f8_not_allowed: - ret -.f8_allowed: - mov [del_bSkipAll], 0 - mov eax, ecx - call delete_file - jmp .copydone -.ctrl_r: -; Rescan panel -; call read_folder -; jmp .done_redraw - mov eax, [ebp + PanelData.index] - push eax - call get_curfile_name - mov esi, ecx - mov edi, saved_file_name -@@: - lodsb - stosb - test al, al - jnz @b -.ctrl_r.doread: - push [ebp + PanelData.start] - call read_folder - pop [ebp + PanelData.start] - pop [ebp + PanelData.index] - or eax, -1 -@@: - inc eax - cmp eax, [ebp + PanelData.numfiles] - jae .ctrl_r.notfound - mov ecx, [ebp + PanelData.files] - mov esi, [ecx+eax*4] - add esi, 40 - mov edi, saved_file_name - call strcmpi - jnz @b -.ctrl_r.found: - mov [ebp + PanelData.index], eax -.ctrl_r.notfound: - mov eax, [ebp + PanelData.numfiles] - dec eax - cmp [ebp + PanelData.index], eax - jbe @f - mov [ebp + PanelData.index], eax -@@: - mov eax, [ebp + PanelData.index] - cmp [ebp + PanelData.start], eax - jbe @f - mov [ebp + PanelData.start], eax -@@: - inc eax - sub eax, [ebp + PanelData.colst] - jae @f - xor eax, eax -@@: - cmp [ebp + PanelData.start], eax - jae @f - mov [ebp + PanelData.start], eax -@@: - mov eax, [ebp + PanelData.numfiles] - sub eax, [ebp + PanelData.colst] - jbe @f - cmp [ebp + PanelData.start], eax - jbe @f - mov [ebp + PanelData.start], eax -@@: - jmp .done_redraw -.menu: -; todo: context menu for plugin panel - cmp [ebp + PanelData.hPlugin], 0 - jz @f - ret -@@: -; display context menu -; ignore folders - call get_curfile_folder_entry - test byte [ecx], 10h - jz @f -.menuret: - ret -@@: - call find_extension - jc .menuret -; known extension -@@: - cmp byte [edi], 0 - jz .menuret - cmp byte [edi], ';' - jz @f - inc edi - jmp @b -@@: - inc edi -@@: - inc edi - cmp byte [edi-1], ' ' - jz @b - cmp byte [edi-1], 9 - jz @b - dec edi - cmp byte [edi], 0 - jz .menuret - mov ecx, esi -@@: - inc ecx - cmp byte [ecx-1], 0 - jnz @b - sub ecx, esi ; ecx = 䠩+1 = +1 - cmp ecx, 15 - jb @f - mov cl, 15 -@@: - xor edx, edx - xor ebp, ebp - push edx -.menucreateloop: - mov eax, edi - xor ebx, ebx -@@: - cmp byte [edi], ',' - jz @f - cmp byte [edi], bl - jz @f - inc edi - jmp @b -@@: - xchg bl, [edi] - pushad - push nullstr - push 1024 - push saved_file_name - push eax - push aMenu - push app_path - call [ini.get_str] - popad - mov [edi], bl - mov eax, saved_file_name -@@: - cmp byte [eax], 0 - jz .menucreatecont - cmp byte [eax], ',' - jz @f - inc eax - jmp @b -@@: - mov byte [eax], 0 - push eax - sub eax, saved_file_name-1 - cmp eax, ecx - ja @f - mov eax, ecx -@@: - xchg eax, [esp] - inc eax - push eax -@@: - inc eax - cmp byte [eax-1], 0 - jnz @b - sub eax, [esp] - add [esp+4], eax - pop eax eax - add eax, 8 - add ebp, eax - push ebp - and ebp, 0xFFF - cmp ebp, eax - pop ebp - ja @f - push eax - xchg edx, [esp+4] - push ecx - mov ecx, ebp - call xpgrealloc - pop ecx - pop edx - xchg edx, [esp] - test eax, eax - xchg eax, [esp] - jz .menucreated -@@: - neg eax - add eax, ebp - add eax, [esp] - and dword [eax], 0 - and dword [eax+4], 0 - test edx, edx - jz @f - sub eax, [esp] - mov [edx], eax - add eax, [esp] - sub edx, [esp] - mov [eax+4], edx -@@: - mov edx, eax - push esi edi - mov esi, saved_file_name - lea edi, [eax+8] -@@: - lodsb - stosb - test al, al - jnz @b - push esi - sub esi, saved_file_name - sub esi, ecx - jae .menunoadd - neg esi -@@: - mov byte [edi-1], ' ' - stosb - dec esi - jnz @b -.menunoadd: - pop esi -@@: - lodsb - stosb - test al, al - jnz @b - pop edi esi -.menucreatecont: - inc edi - cmp byte [edi-1], ',' - jz .menucreateloop -.menucreated: - test edx, edx - jz .menuret_free - and dword [edx], 0 - pop edx - mov ecx, edx - add [ecx], edx -@@: - mov ecx, [ecx] - cmp dword [ecx], 0 - jz @f - add [ecx], edx - add [ecx+4], edx - jmp @b -@@: - add [ecx+4], edx - push edx - push 1 - push esi - push edx - call menu - cmp eax, -1 - jz .menuret_free - lea edi, [eax+8] -@@: - inc edi - cmp byte [edi-1], 0 - jnz @b - mov ebp, [active_panel] - call get_curfile_folder_entry - call .run_association2 -.menuret_free: - pop ecx - jmp pgfree -.f7: - mov dword [CopyDestEditBuf], CopyDestEditBuf.length - and dword [CopyDestEditBuf+4], 0 - and dword [CopyDestEditBuf+8], 0 - mov byte [CopyDestEditBuf+12], 0 - mov ebx, mkdir_dlgdata - mov eax, [cur_width] - sub eax, 12 - mov [ebx + dlgtemplate.width], eax - dec eax - dec eax - mov [ebx + MkDir_Dlgdata.dnam.x2], eax - shr eax, 1 - dec eax - dec eax - mov [ebx + MkDir_Dlgdata.cont.x2], eax - sub eax, a_ContinueLength-1 - mov [ebx + MkDir_Dlgdata.cont.x1], eax - add eax, a_ContinueLength+3 - mov [ebx + MkDir_Dlgdata.cnl.x1], eax - add eax, aCancelBLength - 1 - mov [ebx + MkDir_Dlgdata.cnl.x2], eax - mov byte [ebx + MkDir_Dlgdata.dnam.flags], 0xC - and byte [ebx + MkDir_Dlgdata.cont.flags], not 4 - and byte [ebx + MkDir_Dlgdata.cnl.flags], not 4 - push ebx - call DialogBox - cmp eax, mkdir_dlgdata.cont - jnz .ret2 - mov esi, CopyDestEditBuf+12 - cmp byte [esi], 0 - jz .ret2 - cmp byte [esi], '/' - jz .mkdir_absolute_path - push esi - lea edi, [ebp + PanelData.dir] - or ecx, -1 - xor eax, eax - repnz scasb - not ecx - mov edi, esi -@@: - cmp byte [edi+1], 0 - jz @f - inc edi - jmp @b -@@: - push edi - add edi, ecx - cmp edi, CopyDestEditBuf+12+513 - pop edi - jb @f - pop esi - jmp .bigfilename -@@: - lea edx, [edi+2] - sub edx, esi - lea edi, [edi+ecx+1] - xchg ecx, edx - std - lea esi, [esi+ecx-1] - rep movsb - cld - pop edi - lea esi, [ebp + PanelData.dir] - push edi - mov ecx, edx - rep movsb - mov byte [edi-1], '/' - pop esi -.mkdir_absolute_path: - push RetryOrCancelBtn - push 2 - call makedir - jmp .copydone -.change_mode: - dec eax - mov [ebp + PanelData.colmode], eax - call calc_colwidths - jmp draw_panel -.quick_jump: - dec eax - cmp al, 10 - jnz @f - xor eax, eax -@@: - mov eax, [FolderShortcuts+eax*4] - test eax, eax - jnz @f - ret -@@: - push eax - call close_plugin_panels - lea esi, [ebp + PanelData.dir] - push esi - mov edi, prev_dir -@@: - lodsb - stosb - test al, al - jnz @b - pop edi esi -@@: - lodsb - stosb - test al, al - jnz @b - jmp .reread -.greyplus: - push 0 - mov ecx, aSelect - jmp @f -.greyminus: - push 1 - mov ecx, aDeselect -@@: - mov eax, mark_dlgdata - mov [eax+mark_dlgdata.title-mark_dlgdata], ecx - mov [eax+mark_dlgdata.edit.flags-mark_dlgdata], 0xC - mov edi, enter_string_buf+12 - mov dword [edi-12], 512 - mov dword [edi-8], 1 - and dword [edi-4], 0 - mov word [edi], '*' - push eax - call DialogBox - inc eax - jnz @f -.noselect: - pop eax - ret -@@: - xor eax, eax - mov esi, edi -@@: - lodsb - mov al, [tolower_table+eax] - mov [esi-1], al - test al, al - jnz @b -@@: - mov ecx, [ebp + PanelData.numfiles] - mov ebx, [ebp + PanelData.files] - jecxz .noselect - mov eax, [ebx] - cmp word [eax+40], '..' - jnz .selectloop - cmp byte [eax+42], 0 - jnz .selectloop - dec ecx - jz .noselect - add ebx, 4 -.selectloop: - xor eax, eax - mov esi, [ebx] - add esi, 40 - mov edx, lower_file_name-1 -@@: - lodsb - inc edx - mov al, [tolower_table+eax] - mov [edx], al - test al, al - jnz @b - mov esi, lower_file_name - call match_mask_rev_lowercase - jc @f - mov esi, [ebx] - mov eax, [esi+32] - cmp byte [esp], 0 - jz .doselect - test byte [esi+303], 1 - jz @f - and byte [esi+303], not 1 - sub dword [ebp + PanelData.selected_size], eax - mov eax, [esi+36] - sbb dword [ebp + PanelData.selected_size+4], eax - dec dword [ebp + PanelData.selected_num] - jmp @f -.doselect: - test byte [esi+303], 1 - jnz @f - or byte [esi+303], 1 - add dword [ebp + PanelData.selected_size], eax - mov eax, [esi+36] - adc dword [ebp + PanelData.selected_size+4], eax - inc dword [ebp + PanelData.selected_num] -@@: - add ebx, 4 - dec ecx - jnz .selectloop - pop eax - jmp .done_redraw -.greyasterisk: - mov ecx, [ebp + PanelData.numfiles] - mov esi, [ebp + PanelData.files] - jecxz .galoopdone -.galoop: - lodsd - cmp word [eax+40], '..' - jnz @f - cmp byte [eax+42], 0 - jz .gacont -@@: - xor byte [eax+303], 1 - mov edx, [eax+32] - test byte [eax+303], 1 - jz .gadel - add dword [ebp + PanelData.selected_size], edx - mov edx, [eax+36] - adc dword [ebp + PanelData.selected_size+4], edx - inc dword [ebp + PanelData.selected_num] - jmp .gacont -.gadel: - sub dword [ebp + PanelData.selected_size], edx - mov edx, [eax+36] - sbb dword [ebp + PanelData.selected_size+4], edx - dec dword [ebp + PanelData.selected_num] -.gacont: - loop .galoop -.galoopdone: - jmp .done_redraw - -@@: - call close_plugin_panel -close_plugin_panels: - cmp [ebp + PanelData.hPlugin], 0 - jnz @b - ret - -align 4 -close_plugin_panel: -; close plugin and restore old directory - mov esi, [ebp + PanelData.parents] - add esi, [ebp + PanelData.parents_sz] -@@: - dec esi - cmp byte [esi-1], 0 - jnz @b - push esi - lea edi, [ebp + PanelData.dir] -@@: - lodsb - stosb - test al, al - jnz @b - pop esi - sub esi, 9 - mov edx, [esi] ; hPlugin - mov ebx, [esi+4] ; hFile - sub esi, [ebp + PanelData.parents] - mov [ebp + PanelData.parents_sz], esi - xchg edx, [ebp + PanelData.hPlugin] - xchg ebx, [ebp + PanelData.hFile] - push edx ebx - lea ebx, [ebp + PanelData.plugin_flags] ;plugin_info - and dword [ebx], 0 - mov eax, [ebp + PanelData.hPlugin] - test eax, eax - jz @f - push ebp - push ebx - push [ebp + PanelData.hFile] - call [eax+PluginInfo.GetOpenPluginInfo] - pop ebp -@@: - pop ebx edx - -align 4 -close_handle_if_unused: -; edx=hPlugin, ebx=hFile - push ebp - xor ecx, ecx -@@: - mov eax, [screens] - mov ebp, [eax+ecx*8+4] - mov eax, [eax+ecx*8] - call [eax+screen_vtable.IsHandleUsed] - jz .used - inc ecx - cmp ecx, [num_screens] - jb @b - push ebx - call [edx+PluginInfo.ClosePlugin] -.used: - pop ebp - ret - -align 4 -panels_IsHandleUsed: -; edx=hPlugin, ebx=hFile - mov ebp, panel1 - call .1 - jz .ret - mov ebp, panel2 - -.1: - cmp edx, [ebp+ PanelData.hPlugin] - jnz @f - cmp ebx, [ebp+ PanelData.hFile] - jz .ret -@@: - mov esi, [ebp + PanelData.parents_sz] - test esi, esi - jnz @f - inc esi -.ret: - ret -@@: - add esi, [ebp + PanelData.parents] -@@: - dec esi - cmp byte [esi-1], 0 - jnz @b - sub esi, 9 - cmp edx, [esi] ; hPlugin - jnz .no - mov ebx, [esi+4] ; hFile - jz .ret -.no: - cmp esi, [ebp + PanelData.parents] - jnz @b - inc esi - ret - -align 4 -panels_OnExit: -; close plugin panels - mov ebp, panel1 - call close_plugin_panels - mov ebp, panel2 - call close_plugin_panels - ret - -align 4 -panels_OnRedraw: - or [cursor_x], -1 - or [cursor_y], -1 - call draw_cmdbar - mov ebp, panel1 - call calc_colwidths - call draw_panel - mov ebp, panel2 - call calc_colwidths - call draw_panel - ret - -align 4 -init_console: - mov ecx, [console_data_ptr] - call pgfree - mov eax, [cur_width] - mul [cur_height] - mov ecx, eax - push ecx - shl ecx, 2 - call pgalloc - pop ecx - test eax, eax - jz exit - mov [console_data_ptr], eax - mov edi, eax - mov ax, 0720h - rep stosw - mov [panel1.left], ecx - mov [panel1.top], ecx - mov [panel2.top], ecx - mov eax, [cur_width] - inc eax - shr eax, 1 - mov [panel1.width], eax - mov [panel2.left], eax - sub eax, [cur_width] - neg eax - mov [panel2.width], eax - mov eax, [cur_height] - dec eax - dec eax - mov [panel1.height], eax - mov [panel2.height], eax - ret - -align 4 -get_curfile_folder_entry: - mov ecx, [ebp + PanelData.index] - shl ecx, 2 - add ecx, [ebp + PanelData.files] - mov ecx, [ecx] - ret - -align 4 -get_curfile_name: - call get_curfile_folder_entry - add ecx, 40 - ret - -quick_find: - cmp [ebp + PanelData.numfiles], 0 - jz .nof - mov ecx, [ebp + PanelData.index] -.scanloop: - mov edi, ecx - shl edi, 2 - add edi, [ebp + PanelData.files] - mov edi, [edi] - add edi, 40 - mov esi, quick_search_buf + 12 -@@: - lodsb - test al, al - jz .ok - call match_symbol - jnz .no - inc edi - jmp @b -.no: - inc ecx - cmp ecx, [ebp + PanelData.numfiles] - jb @f - xor ecx, ecx -@@: - cmp ecx, [ebp + PanelData.index] - jnz .scanloop -.nof: - stc - ret -.ok: - cmp ecx, [ebp + PanelData.index] - jz .ret - mov [ebp + PanelData.index], ecx - mov eax, [ebp + PanelData.height] - shr eax, 1 - sub ecx, eax - jae @f - xor ecx, ecx -@@: - mov eax, [ebp + PanelData.numfiles] - sub eax, [ebp + PanelData.colst] - jnc @f - xor eax, eax - xor ecx, ecx -@@: - cmp ecx, eax - jb @f - mov ecx, eax -@@: - mov [ebp + PanelData.start], ecx - call draw_panel -.ret: - clc - ret - -quick_find_next: - cmp [ebp + PanelData.numfiles], 0 - jz quick_find.nof - mov ecx, [ebp + PanelData.index] - jmp quick_find.no - -quick_find_prev: - cmp [ebp + PanelData.numfiles], 0 - jz quick_find.nof - mov ecx, [ebp + PanelData.index] -.scanloop: - dec ecx - jns @f - mov ecx, [ebp + PanelData.numfiles] - dec ecx -@@: - cmp ecx, [ebp + PanelData.index] - jz quick_find.nof - mov edi, ecx - shl edi, 2 - add edi, [ebp + PanelData.files] - mov edi, [edi] - add edi, 40 - mov esi, quick_search_buf + 12 -@@: - lodsb - test al, al - jz quick_find.ok - call match_symbol - jnz .scanloop - inc edi - jmp @b - -panels_getname: -if lang eq ru_RU - mov eax, '' - stosd - mov eax, ' ' - stosd - mov eax, ' ' - stosd - stosb -else - mov eax, 'Pane' - stosd - mov eax, 'ls ' - stosd - mov eax, ' ' - stosd - stosb -end if - sub ecx, 13 - mov ebp, [active_panel] - push 3 - pop edx - cmp [ebp + PanelData.hPlugin], 0 - jz .native - mov esi, [ebp + PanelData.parents] - add esi, [ebp + PanelData.parents_sz] -@@: - dec esi - cmp byte [esi-1], 0 - jz @f - cmp byte [esi-1], '/' - jnz @b -@@: - push ecx edi - shr ecx, 1 -@@: - lodsb - test al, al - jz @f - stosb - loop @b -@@: - sub edi, [esp] - sub [esp+4], edi - add [esp], edi - pop edi ecx - lea esi, [ebp + PanelData.dir] - cmp byte [esi+1], 0 - jnz @f - inc esi -@@: - jmp .main -.native: - lea esi, [ebp + PanelData.dir] -@@: - lodsb - stosb - dec ecx - test al, al - jz @f - cmp al, '/' - jnz @b - dec edx - jnz @b -@@: - test al, al - jnz @f - dec esi - dec edi -@@: -.main: - push esi -@@: - lodsb - test al, al - jnz @b - dec esi - mov ebx, esi - sub ebx, [esp] - dec esi - push esi - mov esi, [ebp + PanelData.index] - shl esi, 2 - add esi, [ebp + PanelData.files] - mov esi, [esi] - add esi, 40 - push esi -@@: - lodsb - test al, al - jnz @b - add ebx, esi - sub ebx, [esp] - dec esi - cmp ebx, ecx - jbe @f - mov al, '.' - stosb - stosb - stosb - sub ecx, 3 - mov ebx, ecx -@@: - add edi, ebx - inc ecx - std -@@: - movsb - dec ecx - jz .nodir - cmp esi, [esp] - jae @b - mov esi, [esp+4] - mov al, '/' - stosb - dec ecx - jz .nodir -@@: - cmp esi, [esp+8] - jb .nodir - movsb - loop @b -.nodir: - cld - pop eax - pop eax - pop eax - ret - -draw_window: - push SF_REDRAW - pop eax - push SSF_BEGIN_DRAW - pop ebx - int 40h - mov al, SF_STYLE_SETTINGS - mov bl, SSF_GET_SKIN_HEIGHT - int 40h - mov [skinh], eax - mov ebx, [cur_width] - imul ebx, font_width - add ebx, 100*65536 + 5*2-1 - mov ecx, [cur_height] - imul ecx, font_height - lea ecx, [eax+ecx+5-1+100*65536] - xor eax, eax - mov edx, 0x53000000 - mov edi, header - int 40h - mov al, SF_DRAW_RECT - xor edx, edx - cmp [fill_width], 0 - jz @f - mov ebx, [wnd_width] - sub ebx, [fill_width] - sub ebx, 5-1 - shl ebx, 16 - mov bx, word [fill_width] - mov ecx, [skinh-2] - mov cx, word [wnd_height] - sub cx, word [skinh] - sub cx, 5-1 - int 0x40 -@@: - cmp [fill_height], 0 - jz @f - xor edx, edx - mov ebx, 50000h - mov bx, word [wnd_width] - sub ebx, 9 - mov ecx, [wnd_height] - sub ecx, [fill_height] - sub ecx, 5-1 - shl ecx, 16 - mov cx, word [fill_height] - int 0x40 -@@: -; xor ecx, ecx -; call draw_image - mov al, SF_PUT_IMAGE_EXT - mov ebx, [MemForImage] - test ebx, ebx - jz @f - mov ecx, [cur_width] - imul ecx, font_width*10000h - mov cx, word [cur_height] - imul cx, font_height - mov edx, [skinh] - add edx, 5*10000h - mov esi, 8 - mov edi, console_colors - xor ebp, ebp - int 0x40 -@@: - mov al, SF_REDRAW - push SSF_END_DRAW - pop ebx - int 40h - ret - -draw_image.nomem: - mov al, SF_DRAW_RECT - xor edx, edx - mov ebx, [cur_width] - imul ebx, font_width - add ebx, 5*65536 - mov ecx, [skinh-2] - mov cx, word [cur_height] - imul cx, font_height - int 40h - mov al, SF_DRAW_TEXT - mov ebx, 32*65536+32 - mov ecx, 0xFFFFFF - mov edx, nomem_draw - push nomem_draw.size - pop esi - int 40h - ret - -align 16 -draw_image: - mov [bMemForImageValidData], byte 1 - cmp [MemForImage], 0 - jnz .allocated -; allocate memory for image - mov ecx, [cur_width] - imul ecx, [cur_height] - imul ecx, font_width*font_height - call pgalloc - test eax, eax - jz draw_image.nomem - mov [MemForImage], eax - mov [bMemForImageValidData], byte 0 -.allocated: - push ebp - and [max_x], 0 - or [min_x], -1 - and [max_y], 0 - or [min_y], -1 - mov eax, [cursor_y] - mul [cur_width] - add eax, [cursor_x] - add eax, eax - add eax, [console_data_ptr] - xchg [cur_cursor_pos], eax - mov [old_cursor_pos], eax - mov edi, [MemForImage] - mov esi, [console_data_ptr] - mov ecx, [cur_height] -.lh: - push ecx - mov ecx, [cur_width] -.lw: - push ecx - mov eax, [cur_width] - imul eax, [cur_height] - mov ebx, [esi] - cmp [bMemForImageValidData], 0 - jz @f - cmp esi, [cur_cursor_pos] - jz @f - cmp esi, [old_cursor_pos] - jz @f - cmp bx, [eax*2+esi] - jnz @f - inc esi - inc esi - jmp .skip_symbol -@@: - mov [eax*2+esi], bx - cmp ecx, [min_x] - ja @f - mov [min_x], ecx -@@: - cmp ecx, [max_x] - jb @f - mov [max_x], ecx -@@: - mov eax, [esp+4] - mov [min_y], eax - cmp eax, [max_y] - jb @f - mov [max_y], eax -@@: - push edi - xor eax, eax - mov al, [esi+1] - and al, 0xF - mov ebx, eax - mov al, [esi+1] - shr al, 4 - mov ebp, eax - sub ebx, ebp - lodsb - inc esi -if font_width > 8 - lea edx, [eax+eax+font] -else - lea edx, [eax+font] -end if -.sh: - mov ecx, [edx] -repeat font_width - shr ecx, 1 - sbb eax, eax - and eax, ebx - add eax, ebp - mov [edi+%-1], al -end repeat - mov eax, [cur_width] -; imul eax, font_width -; add edi, eax -if font_width = 6 - lea eax, [eax*2+eax] - lea edi, [edi+eax*2] -else if font_width = 7 - lea edi, [edi+eax*8] - sub edi, eax -else if font_width = 8 - lea edi, [edi+eax*8] -else if font_width = 9 - lea edi, [edi+eax*8] - add edi, eax -else if font_width = 10 - lea eax, [eax*4+eax] - lea edi, [edi+eax*2] -else -Unknown font_width value! -end if -if font_width > 8 - add edx, 256*2 - cmp edx, font+256*2*font_height -else - add edx, 256 - cmp edx, font+256*font_height -end if - jb .sh - pop edi -.skip_symbol: - pop ecx - add edi, font_width - dec ecx - jnz .lw - mov eax, [cur_width] - imul eax, (font_height-1)*font_width - add edi, eax - pop ecx - dec ecx - jnz .lh -; cursor - mov eax, [cursor_y] - inc eax - jz .nocursor - mul [cur_width] - imul eax, font_height*font_width - mov edx, [cursor_x] - inc edx - imul edx, font_width - add eax, edx - add eax, [MemForImage] - mov edx, [cur_width] - imul edx, font_width - neg edx - mov ecx, [cursor_size] -.cursor_loop: - push ecx - mov ecx, font_width - add eax, edx - push eax -@@: -;; add byte [eax-1], 0x10 - xor byte [eax-1], 7 - sub eax, 1 - loop @b - pop eax - pop ecx - loop .cursor_loop -.nocursor: - cmp [min_y], -1 - jz .nodraw - mov ecx, [cur_width] - mov ebx, [cur_height] - mov eax, ebx - sub ebx, [max_y] - sub eax, [min_y] - sub eax, ebx - inc eax - imul ebp, eax, font_height - mov edx, ecx - sub edx, [max_x] - imul edx, font_width - mov eax, edx - shl edx, 16 - imul dx, bx, font_height - imul ebx, [cur_width] - mov ecx, [max_x] - sub ecx, [min_x] - inc ecx - imul ecx, font_width*10000h - add ecx, ebp - imul ebx, font_width*font_height - add ebx, [MemForImage] - add ebx, eax - add edx, [skinh] - add edx, 5*10000h - imul esi, [cur_width], font_width - mov ebp, ecx - shr ebp, 16 - sub esi, ebp - mov ebp, esi - push SF_PUT_IMAGE_EXT - pop eax - mov edi, console_colors - push 8 - pop esi - int 40h -.nodraw: - pop ebp - ret - -get_console_ptr: -; in: eax=x, edx=y -; out: edi->console data - push edx - imul edx, [cur_width] - add edx, eax - mov edi, [console_data_ptr] - lea edi, [edi + edx*2] - pop edx - ret - -;description: -; draw keys F1-F12 -align 16 -draw_keybar: - pushad - xor eax, eax - test [ctrlstate], 3 - jz @f - inc eax -@@: - test [ctrlstate], 0xC - jz @f - or al, 2 -@@: - test [ctrlstate], 0x30 - jz @f - or al, 4 -@@: - imul eax, 6*12 ; ⥪ * ᫮ F1-F12 - mov esi, [active_screen_keybar] - add esi, eax - xor ecx, ecx - inc ecx - xor eax, eax - mov edx, [cur_height] - dec edx - call get_console_ptr - push 6 - pop ebx - mov eax, [cur_width] - sub eax, 11+9+3*2+6 - cmp eax, 7*11 - jl @f - cdq - mov bl, 11 - div ebx - mov ebx, eax -@@: - xor edx, edx ; ஫ 室 । -.l: - add edx, 7 - cmp cl, 10 - jb @f - inc edx -@@: - cmp edx, [cur_width] - ja .ret - cmp cl, 10 - jae .twodig - lea eax, [ecx+'0'] - stosb - mov al, [keybar_number_color] - stosb - jmp .cmn -.twodig: - mov al, cl - cbw - div [_10] - add al, '0' - stosb - mov al, [keybar_number_color] - stosb - xchg al, ah - add al, '0' - stosw -.cmn: - mov ah, [keybar_name_color] - push ecx - mov cl, 6 -@@: - lodsb - stosw - loop @b - mov al, ' ' - lea ecx, [ebx-6] - cmp byte [esp], 12 - jz .ret_pop - add edx, ecx - rep stosw - pop ecx - inc edx - cmp edx, [cur_width] - ja .ret - mov ah, [keybar_bgr_color] - stosw - inc ecx - jmp .l -.ret_pop: - pop ecx -.ret: - cmp byte [edi-2], ' ' - jnz @f - dec edi - dec edi -@@: - push edi - xor eax, eax - mov edx, [cur_height] - call get_console_ptr - mov ecx, edi - pop edi - sub ecx, edi - shr ecx, 1 - mov al, ' ' - mov ah, [keybar_name_color] - rep stosw ;᪠ 梥 - - cmp [bDisplayQuickSearch], 0 - jz @f - push QuickSearchDlg - call DrawDialogBox -@@: - popad - ret - -align 16 -draw_cmdbar: - mov esi, [active_panel] - add esi, PanelData.dir - xor eax, eax - mov edx, [cur_height] - dec edx - dec edx - call get_console_ptr - mov ah, [cmdbar_prefix_color] - mov ecx, [cur_width] - dec ecx -@@: - lodsb - test al, al - jz @f - stosw - loop @b -@@: - mov al, '>' - stosw - mov al, ' ' - mov ah, [cmdbar_normal_color] - rep stosw - ret - -align 16 -draw_border: - push edi - mov al, 0xC9 - stosw - mov al, 0xCD - lea ecx, [ebx-2] - rep stosw - mov al, 0xBB - stosw - pop edi - add edi, [cur_width] - add edi, [cur_width] - lea ecx, [edx-2] -.l: - push edi - mov al, 0xBA - stosw - mov al, 0x20 - push ecx - lea ecx, [ebx-2] - rep stosw - pop ecx - mov al, 0xBA - stosw - pop edi - add edi, [cur_width] - add edi, [cur_width] - loop .l - mov al, 0xC8 - stosw - mov al, 0xCD - lea ecx, [ebx-2] - rep stosw - mov al, 0xBC - stosw - ret - -calc_colwidths: -; in: ebp->panel data - imul esi, [ebp + PanelData.colmode], PanelMode.size - add esi, colmodes - lodsd - mov ecx, eax - lea edx, [ecx-1] - xor ebx, ebx - add esi, PanelMode.ColumnWidths-4 - push ecx esi - xor eax, eax -.loop: - lodsb - add edx, eax - cmp al, 1 - adc ebx, 0 - loop .loop - pop esi ecx - lea edi, [ebp + PanelData.colwidths] - test ebx, ebx - jz .loop2 - mov eax, [ebp + PanelData.width] - dec eax - dec eax - sub eax, edx - jae @f - xor eax, eax -@@: - xor edx, edx - div ebx - test eax, eax - jnz @f - xor edx, edx - inc eax -@@: - push eax -.loop2: - movzx eax, byte [esi] - inc esi - test eax, eax - jnz @f - pop eax - push eax - dec ebx - cmp ebx, edx - jae @f - inc eax -@@: - stosd - loop .loop2 - pop eax - and dword [edi], 0 - ret - -GetPanelTitle_default: - mov edi, [esp+8] - mov ecx, 1024 - mov esi, [esp+12] - test esi, esi - jz .nohost - mov edx, esi -@@: - lodsb - test al, al - jz @f - cmp al, '/' - jnz @b - mov edx, esi - jmp @b -@@: - mov esi, edx -@@: - lodsb - stosb - test al, al - loopnz @b - dec edi - inc ecx -.nohost: - mov esi, [esp+16] - cmp word [esi], '/' - jz .nodir -@@: - lodsb - stosb - test al, al - loopnz @b - dec edi -.nodir: - mov byte [edi], 0 - ret 10h - -;input: -; ebp - pointer to panel1 or panel2 -align 16 -draw_panel: - mov eax, [ebp + PanelData.left] - mov edx, [ebp + PanelData.top] - call get_console_ptr -; draw border - mov ah, [panel_border_color] - mov ebx, [ebp + PanelData.width] - mov edx, [ebp + PanelData.height] - call draw_border - push eax - mov eax, [ebp + PanelData.left] - mov edx, [ebp + PanelData.top] - add edx, [ebp + PanelData.height] - sub edx, 3 - call get_console_ptr - pop eax - mov al, 0xC7 - stosw - mov al, 0xC4 - lea ecx, [ebx-2] - rep stosw - mov al, 0xB6 - stosw - - imul esi, [ebp + PanelData.colmode], PanelMode.size - add esi, colmodes - lodsd - mov ecx, eax ; number of columns - lea ebx, [ebp + PanelData.colwidths] - mov eax, [ebp + PanelData.left] - inc eax - mov [column_left], eax - mov eax, [ebp + PanelData.top] - inc eax - mov [column_top], eax - mov eax, [ebp + PanelData.height] - sub eax, 4 - mov [column_height], eax - dec eax - mov [ebp + PanelData.colsz], eax - and [ebp + PanelData.colst], 0 - mov eax, [ebp + PanelData.start] - mov [column_index], eax - mov [last_column_index], eax -.columns_loop: - push ecx - mov eax, [ebx] - add ebx, 4 - mov [column_width], eax - cmp ecx, 1 - jz .skip_right_border - add eax, [column_left] - mov edx, [ebp + PanelData.top] - call get_console_ptr - mov ah, [panel_header_color] - mov al, 0xD1 - mov [edi], ax - add edi, [cur_width] - add edi, [cur_width] - mov ecx, [column_height] - mov al, 0xB3 -@@: - mov [edi], ax - add edi, [cur_width] - add edi, [cur_width] - loop @b - mov al, 0xC1 - stosw -.skip_right_border: - mov eax, [column_left] - mov edx, [column_top] - call get_console_ptr -; ⮫ - push edi - mov edx, [esi] - and edx, 0xF - mov edx, [column_headers+edx*4] - movzx ecx, byte [edx] - inc edx - cmp ecx, [column_width] - jb @f - mov ecx, [column_width] -@@: - push ecx - sub ecx, [column_width] - neg ecx - shr ecx, 1 - mov al, ' ' - mov ah, [column_header_color] - rep stosw - pop ecx - jecxz .skipcopyhdr - push ecx -@@: - mov al, [edx] - inc edx - stosw - loop @b - pop ecx -.skipcopyhdr: - sub ecx, [column_width] - neg ecx - inc ecx - shr ecx, 1 - mov al, ' ' - rep stosw - pop edi - add edi, [cur_width] - add edi, [cur_width] -; ᠬ ⮫ - mov eax, [esi] - and eax, 0xF - push ebx esi - call dword [draw_column_proc+eax*4] - pop esi ebx - inc esi - mov eax, [column_width] - inc eax - add [column_left], eax - pop ecx - dec ecx - jnz .columns_loop -; (⥪ ) - lea esi, [ebp + PanelData.dir] - mov eax, [ebp + PanelData.hPlugin] - test eax, eax - jz .native - push ebp - push esi - mov esi, [ebp + PanelData.parents] - add esi, [ebp + PanelData.parents_sz] -@@: - dec esi - cmp byte [esi-1], 0 - jnz @b - push esi - push execdata - push [ebp + PanelData.hFile] - call [eax+PluginInfo.GetPanelTitle] - pop ebp - mov esi, execdata -.native: - mov edi, cur_header - mov ecx, [ebp + PanelData.width] - sub ecx, 6 - cmp byte [esi], '/' - jnz .copy_rest - dec ecx - movsb -@@: - lodsb - stosb - dec ecx - test al, al - jz .header_created - cmp al, '/' - jnz @b -.copy_rest: - mov edx, esi -@@: - lodsb - test al, al - jnz @b - sub esi, edx - dec esi - cmp esi, ecx - jbe @f - mov word [edi], '..' - mov byte [edi+2], '.' - add edi, 3 - sub ecx, 3 - add edx, esi - sub edx, ecx -@@: - mov esi, edx -@@: - lodsb - stosb - dec ecx - test al, al - jnz @b -.header_created: - mov edx, [ebp + PanelData.top] - mov eax, [ebp + PanelData.left] - shr ecx, 1 - lea eax, [eax+ecx+3] - call get_console_ptr - mov ah, [panel_active_header_color] - cmp ebp, [active_panel] - jz @f - mov ah, [panel_header_color] -@@: - mov al, ' ' - stosw - mov esi, cur_header -@@: - lodsb - test al, al - jz @f - stosw - jmp @b -@@: - mov al, ' ' - stosw - mov edx, [ebp + PanelData.top] - inc edx - mov eax, [ebp + PanelData.left] - inc eax - call get_console_ptr - movzx eax, [ebp + PanelData.sortmode] - mov al, [compare_names+eax] - stosb - mov eax, [ebp + PanelData.selected_num] - test eax, eax - jz .skip_selected_info -; ଠ 뤥 䠩 - push dword [ebp + PanelData.selected_size+4] - push dword [ebp + PanelData.selected_size] - call fill_total_info - mov eax, [ebp + PanelData.width] - sub eax, 2 - cmp ecx, eax - jbe @f - mov ecx, eax - mov edi, saved_file_name+512 - sub edi, eax - mov byte [edi], '.' - mov word [edi+1], '..' -@@: - mov esi, edi - sub eax, ecx - shr eax, 1 - inc eax - add eax, [ebp + PanelData.left] - mov edx, [ebp + PanelData.top] - add edx, [ebp + PanelData.height] - sub edx, 3 - call get_console_ptr - mov ah, [panel_numselected_color] -@@: - lodsb - stosw - loop @b -.skip_selected_info: -; ଠ 饬 ᫥ ࠧ 䠩 - mov eax, [ebp + PanelData.total_num] - push dword [ebp + PanelData.total_size+4] - push dword [ebp + PanelData.total_size] - call fill_total_info - mov eax, [ebp + PanelData.width] - sub eax, 2 - cmp ecx, eax - jbe @f - mov ecx, eax - mov byte [edi+ecx-3], '.' - mov word [edi+ecx-2], '..' -@@: - sub eax, ecx - shr eax, 1 - inc eax - add eax, [ebp + PanelData.left] - add edx, [ebp + PanelData.top] - add edx, [ebp + PanelData.height] - dec edx - mov esi, edi - call get_console_ptr - mov ah, [panel_number_color] -@@: - lodsb - stosw - loop @b - cmp [ebp + PanelData.numfiles], 0 - jz .skip_curinfo -; ଠ ⥪饬 䠩 - mov ebx, [ebp + PanelData.index] - mov eax, [ebp + PanelData.files] - mov ebx, [eax+ebx*4] - mov eax, [ebp + PanelData.left] - add eax, [ebp + PanelData.width] - dec eax - mov edx, [ebp + PanelData.top] - add edx, [ebp + PanelData.height] - dec edx - dec edx - call get_console_ptr - mov ecx, [ebp + PanelData.width] - dec ecx - dec ecx - cmp [ebp + PanelData.colmode], 3 - jz .show_curname -; ६ 䨪樨 - sub edi, 5*2 - sub ecx, 6 - mov al, [ebx+24+2] - aam - or ax, 0x3030 - mov [edi], ah - mov [edi+2], al - mov [edi+4], byte ':' - mov al, [ebx+24+1] - aam - or ax, 0x3030 - mov [edi+6], ah - mov [edi+8], al - mov al, [panel_normal_color] - mov [edi+1], al - mov [edi+3], al - mov [edi+5], al - mov [edi+7], al - mov [edi+9], al - dec edi - mov [edi], al - dec edi - mov byte [edi], ' ' -; 䨪樨 - sub edi, 8*2 - sub ecx, 9 - mov al, [ebx+28+0] - aam - or ax, 0x3030 - mov [edi], ah - mov [edi+2], al - mov [edi+4], byte '.' - mov al, [ebx+28+1] - aam - or ax, 0x3030 - mov [edi+6], ah - mov [edi+8], al - mov [edi+10], byte '.' - mov ax, [ebx+28+2] - div [_100] - mov al, ah - aam - or ax, 0x3030 - mov [edi+12], ah - mov [edi+14], al - mov al, [panel_normal_color] - mov [edi+1], al - mov [edi+3], al - mov [edi+5], al - mov [edi+7], al - mov [edi+9], al - mov [edi+11], al - mov [edi+13], al - mov [edi+15], al - dec edi - mov [edi], al - dec edi - mov [edi], byte ' ' -; - std - mov ah, [panel_normal_color] - dec edi - dec edi - dec ecx - test byte [ebx], 0x10 - jz .size_file - push ecx - mov esi, aFolder+aFolder.size-1 - mov ecx, aFolder.size - cmp word [ebx+40], '..' - jnz @f - cmp byte [ebx+42], 0 - jnz @f - mov esi, aUp+aUp.size-1 - mov cl, aUp.size -@@: - sub [esp], ecx -@@: - lodsb - stosw - loop @b - pop ecx - jmp .size_done -.size_file: - mov edx, [ebx+36] - test edx, edx - jz .size_less_4g - cmp edx, 10*256 - jae .size_tera -; - mov al, 'G' - shl edx, 2 - jmp .size_letter -.size_tera: -; ࠡ - shr edx, 8 - mov al, 'T' - jmp .size_letter -.size_less_4g: - mov edx, [ebx+32] - cmp edx, 10*(1 shl 20) - jae .size_mega - cmp edx, 1 shl 20 - jb .size_num - shr edx, 10 - mov al, 'K' - jmp .size_letter -.size_mega: - mov al, 'M' - shr edx, 20 -.size_letter: - stosw - dec ecx - mov al, ' ' - stosw - dec ecx -.size_num: - xchg eax, edx - xor edx, edx - div [_10d] - xchg eax, edx - add al, '0' - mov ah, [panel_normal_color] - stosw - dec ecx - test edx, edx - jnz .size_num -.size_done: - cld -.show_curname: -; - sub edi, ecx - sub edi, ecx - lea esi, [ebx+40] -@@: - lodsb - test al, al - jnz @b - sub esi, ebx - sub esi, 41 - mov ah, [panel_normal_color] - cmp esi, ecx - lea edx, [ebx+40] - jbe @f - mov al, '{' - mov [edi-2], ax - add edx, esi - sub edx, ecx -@@: - mov esi, edx -@@: - lodsb - test al, al - jz @f - stosw - loop @b -@@: - mov al, ' ' - rep stosw -.skip_curinfo: - call draw_image - ret - -fill_total_info: - mov edi, saved_file_name+511 - mov byte [edi], ' ' -if lang eq ru_RU - mov byte [edi-1], '' - dec edi - cmp eax, 1 - jz @f - mov word [edi-1], '' - dec edi -@@: - mov dword [edi-4], '䠩' - mov byte [edi-5], ' ' - sub edi, 5 -else - cmp eax, 1 - jz @f - dec edi - mov byte [edi], 's' -@@: - mov dword [edi-4], 'file' - mov byte [edi-5], ' ' - sub edi, 5 -end if - xor edx, edx - push 10 - pop ecx -@@: - div ecx - dec edi - add dl, '0' - mov [edi], dl - xor edx, edx - test eax, eax - jnz @b -if lang eq ru_RU - mov dword [edi-4], ' ' - mov dword [edi-8], ' ' - sub edi, 8 -else - mov dword [edi-4], ' in ' - mov dword [edi-8], 'ytes' - mov word [edi-10], ' b' - sub edi, 10 -end if - lea esi, [edi-3] - mov edx, [esp+8] - mov eax, [esp+4] -.selsizel: - push edx - mov ebx, edx - xor edx, edx - add ebx, ebx - adc edx, edx - push ebx - push edx - add ebx, ebx - adc edx, edx - add ebx, [esp+4] - adc edx, [esp] - add esp, 8 - add eax, ebx - adc edx, 0 - div ecx - dec edi - cmp edi, esi - jae @f - mov byte [edi], ',' - dec edi - sub esi, 4 -@@: - pop ebx - add dl, '0' - mov byte [edi], dl - xchg eax, ebx - mul [muldiv10] - add eax, ebx - adc edx, 0 - mov ebx, eax - or ebx, edx - jnz .selsizel - dec edi - mov byte [edi], ' ' - mov ecx, saved_file_name+512 - sub ecx, edi - ret 8 - -align 4 -get_file_color: - mov ah, [esi + 6] - cmp ebp, [active_panel] - jnz @f - cmp ecx, [ebp + PanelData.index] - jnz @f - mov ah, [esi + 7] -@@: - test byte [esi + 303], 1 - jnz @f - mov ah, [esi + 4] - cmp ebp, [active_panel] - jnz @f - cmp ecx, [ebp + PanelData.index] - jnz @f - mov ah, [esi + 5] -@@: - ret - -align 4 -draw_name_column: - mov eax, [column_index] - mov [last_column_index], eax - mov edx, [ebp + PanelData.numfiles] - mov ecx, [column_height] - dec ecx -.l: - cmp [column_index], edx - jae .ret - push ecx - mov ecx, [column_index] - mov esi, [ebp + PanelData.files] - mov esi, [esi+ecx*4] - mov ebx, [esi] - call get_file_color - add esi, 40 - mov ecx, [column_width] - push edi -@@: - lodsb - test al, al - jz @f - stosw - loop @b - lodsb - test al, al - jz @f - mov byte [edi], '}' - jmp .continue -@@: - test bl, 10h - jnz .noalignext - mov ebx, [ebp + PanelData.colmode] -; sizeof(PanelMode) = 40 - lea ebx, [ebx+ebx*4] - cmp [colmodes+ebx*8+PanelMode.bAlignExtensions], 0 - jz .noalignext - push ecx - sub ecx, [column_width] - neg ecx - jz .noalignext2 - dec esi -@@: - dec esi - cmp byte [esi], '.' - loopnz @b - jnz .noalignext2 - inc esi - sub ecx, [column_width] - neg ecx - sub ecx, [esp] - sub edi, ecx - sub edi, ecx - dec ecx - mov ebx, [esp+4] - cmp ecx, 3 - ja @f - mov cl, 3 -@@: - sub ecx, [column_width] - sub ebx, edi - sar ebx, 1 - sub ebx, ecx - pop ecx - inc ecx - push 0 - cmp ecx, ebx - jbe @f - sub ecx, ebx - mov [esp], ecx - mov ecx, ebx -@@: - mov al, ' ' - rep stosw -@@: - lodsb - test al, al - jz .noalignext2 - stosw - jmp @b -.noalignext2: - pop ecx -.noalignext: - mov al, ' ' - rep stosw -.continue: - pop edi - add edi, [cur_width] - add edi, [cur_width] - inc [column_index] - pop ecx - dec ecx - jnz .l -.ret: - mov eax, [ebp + PanelData.colsz] - add [ebp + PanelData.colst], eax - cmp ebp, panel1 - jnz .ret2 -; ᫮ ࠭ -; calculate number of viewer and editor screens - xor ebx, ebx - xor edx, edx - mov ecx, [num_screens] - mov esi, [screens] -.3: - lodsd - cmp eax, viewer_vtable - jnz @f - inc ebx -@@: - cmp eax, editor_vtable - jnz @f - inc edx -@@: - lodsd - loop .3 - mov eax, ebx - mov esi, edx - or eax, edx - jz .ret2 - xor eax, eax - xor edx, edx - call get_console_ptr - mov al, '[' - stosb - mov al, [panel_nscreens_color] - stosb - xchg eax, ebx -.5: - push -'0' -@@: - xor edx, edx - div [_10d] - push edx - test eax, eax - jnz @b -@@: - pop eax - add eax, '0' - jz @f - stosb - mov al, bl - stosb - jmp @b -@@: - test esi, esi - jz .4 - mov al, '+' - stosb - mov al, bl - stosb - xor eax, eax - xchg eax, esi - jmp .5 -.4: - mov al, ']' - mov ah, [panel_nscreens_color] - stosw -.ret2: -draw_empty_column: - ret - -align 4 -draw_size_column: - add edi, [column_width] - add edi, [column_width] - dec edi - dec edi - std - mov ecx, [column_height] - dec ecx - push [last_column_index] -.l: - mov edx, [ebp + PanelData.numfiles] - cmp [last_column_index], edx - jae .ret - push ecx - push edi - mov ecx, [last_column_index] - mov esi, [ebp + PanelData.files] - mov esi, [esi+ecx*4] - call get_file_color - mov ecx, [column_width] -@@: - mov ebx, eax - cmp word [esi+40], '..' - jnz .nodotdot - cmp byte [esi+42], 0 - jnz .nodotdot -if lang eq ru_RU - mov al, '' - stosw - mov al, '' - stosw - mov al, '' - stosw - mov al, '' - stosw - mov al, '' - stosw - sub ecx, 5 -else - mov al, ' ' - stosw - stosw - mov al, 'p' - stosw - mov al, 'U' - stosw - sub ecx, 4 -end if - jmp .size_written -.nodotdot: - test byte [esi], 10h - jz .nofolder -if lang eq ru_RU - mov al, '' - stosw - mov al, '' - stosw - mov al, '' - stosw - mov al, '' - stosw - mov al, '' - stosw - sub ecx, 5 -else - mov al, 'r' - stosw - mov al, 'e' - stosw - mov al, 'd' - stosw - mov al, 'l' - stosw - mov al, 'o' - stosw - mov al, 'F' - stosw - sub ecx, 6 -end if - jmp .size_written -.nofolder: - mov eax, [esi+32] - mov edx, [esi+36] - test edx, edx - jz .less_4G - cmp edx, 10000/4*1024 - jb .giga - mov al, 'T' - shr edx, 10 - jmp .write_letter -.giga: - mov al, 'G' - shl edx, 2 - jmp .write_letter -.less_4G: - mov edx, eax - cmp eax, 1000000 - jb .byte - cmp eax, 10000*1024 - jb .kilo - mov al, 'M' - shr edx, 20 - jmp .write_letter -.kilo: - mov al, 'K' - shr edx, 10 -.write_letter: - mov ah, bh - stosw - mov al, ' ' - stosw - dec ecx - dec ecx -.byte: - xchg eax, edx - xor edx, edx - div [_10d] - xchg eax, edx - add al, '0' - mov ah, bh - stosw - dec ecx - test edx, edx - jnz .byte -.size_written: - mov eax, ebx - test ecx, ecx - jle @f - mov al, ' ' - rep stosw -@@: - mov byte [edi+1], ah - pop edi - add edi, [cur_width] - add edi, [cur_width] - inc [last_column_index] - pop ecx - dec ecx - jnz .l -.ret: - pop [last_column_index] - cld - ret - -align 4 -draw_date_column: - mov ecx, [column_height] - dec ecx - push [last_column_index] -.l: - mov edx, [ebp + PanelData.numfiles] - cmp [last_column_index], edx - jae .ret - push ecx - push edi - mov ecx, [last_column_index] - mov esi, [ebp + PanelData.files] - mov esi, [esi+ecx*4] - call get_file_color - mov bh, ah - mov byte [edi-1], bh - mov al, [esi+28] - aam - add eax, '00' - push eax - mov al, ah - mov ah, bh - stosw - pop eax - mov ah, bh - stosw - mov al, '.' - stosw - mov al, [esi+29] - aam - add eax, '00' - push eax - mov al, ah - mov ah, bh - stosw - pop eax - mov ah, bh - stosw - mov al, '.' - stosw - movzx eax, word [esi+30] - xor edx, edx - div [_10d] - xchg eax, edx - add al, '0' - mov ah, bh - mov [edi+2], ax - xchg eax, edx - xor edx, edx - div [_10d] - xchg eax, edx - add al, '0' - mov ah, bh - stosw - pop edi - add edi, [cur_width] - add edi, [cur_width] - inc [last_column_index] - pop ecx - dec ecx - jnz .l -.ret: - pop [last_column_index] - cld - ret - -align 4 -draw_time_column: - mov ecx, [column_height] - dec ecx - push [last_column_index] -.l: - mov edx, [ebp + PanelData.numfiles] - cmp [last_column_index], edx - jae .ret - push ecx - push edi - mov ecx, [last_column_index] - mov esi, [ebp + PanelData.files] - mov esi, [esi+ecx*4] - call get_file_color - mov bh, ah - mov byte [edi-1], bh - mov al, [esi+26] - aam - add eax, '00' - push eax - mov al, ah - mov ah, bh - stosw - pop eax - mov ah, bh - stosw - mov al, ':' - stosw - mov al, [esi+25] - aam - add eax, '00' - push eax - mov al, ah - mov ah, bh - stosw - pop eax - mov ah, bh - stosw - pop edi - add edi, [cur_width] - add edi, [cur_width] - inc [last_column_index] - pop ecx - dec ecx - jnz .l -.ret: - pop [last_column_index] - cld - ret - -;insert_last_dot: -; push eax esi -; mov ah, 0 -;.loop: -; lodsb -; test al, al -; jz .done -; cmp al, '.' -; jnz .loop -; mov ah, 1 -; jmp .loop -;.done: -; test ah, ah -; jnz @f -; mov byte [esi-1], '.' -; mov byte [esi], 0 -;@@: -; pop esi eax -; ret - -;delete_last_dot: -; push esi -;@@: -; cmp byte [esi], 0 -; jz @f -; inc esi -; jmp @b -;@@: -; cmp byte [esi-1], '.' -; jnz @f -; mov byte [esi-1], 0 -;@@: pop esi -; ret - -align 4 -read_folder: - mov eax, [ebp + PanelData.nfa] - mov [dirinfo.size], eax - shl eax, 2 - add eax, [ebp + PanelData.files] - mov [dirinfo.dirdata], eax - lea eax, [ebp + PanelData.dir] - mov [dirinfo.name], eax - xor eax, eax - mov [ebp + PanelData.total_num], eax - mov dword [ebp + PanelData.total_size], eax - mov dword [ebp + PanelData.total_size+4], eax - mov [ebp + PanelData.selected_num], eax - mov dword [ebp + PanelData.selected_size], eax - mov dword [ebp + PanelData.selected_size+4], eax -.retry: - mov eax, [ebp + PanelData.hPlugin] - test eax, eax - jz .native - mov ecx, [dirinfo.size] - test [ebp + PanelData.plugin_flags], 1 - jz @f - dec ecx ; reserve one entry for '..' -@@: - push ebp - push [dirinfo.dirdata] - push ecx - push 0 - push [ebp + PanelData.hFile] - call [eax + PluginInfo.ReadFolder] - pop ebp - mov ebx, [dirinfo.dirdata] - mov ebx, [ebx+4] - jmp .read -.native: - push SF_FILE - pop eax - mov ebx, dirinfo - int 40h -.read: - test eax, eax - jz .ok - cmp eax, 6 - jz .ok -; Failed to read folder, notify user - cmp [bSilentFolderMode], 0 - jnz .dont_notify - push dword aContinue - push dword aRetry - mov edx, esp - call get_error_msg - push [dirinfo.name] - push dword aCannotReadFolder - push eax - mov eax, esp - push edx - push 2 - push eax - push 3 - call SayErr - add esp, 5*4 - test eax, eax - jz .retry -.dont_notify: -; If not on plugin panel, try to return to previous directory - cmp [ebp + PanelData.hPlugin], 0 - jnz @f - mov esi, prev_dir - cmp byte [esi], 0 - jz @f - lea edi, [ebp + PanelData.dir] - mov ecx, 1024/4 - rep movsd - mov byte [prev_dir], 0 - ret -@@: - mov [bSilentFolderMode], 1 ; enter silent mode -; Try to read parent folder - mov esi, [dirinfo.name] - xor edx, edx -.up1: - lodsb - test al, al - jz .up1done - cmp al, '/' - jnz .up1 - inc edx - lea edi, [esi-1] - jmp .up1 -.up1done: - cmp [ebp + PanelData.hPlugin], 0 - jz .4 - cmp edx, 1 - ja .up -; ⥭ -; ⮬ 㦥 ୥ -; , 㭪 ⥭ 㫠 0 ⮢ -; (᫨ 㦥 室 "..", 㤥 ⮬᪨) - xor ebx, ebx ; 0 items read - mov eax, [dirinfo.dirdata] - mov [eax+8], ebx ; 0 items total - jmp .ok -.4: - cmp edx, 2 - jbe .noup -.up: - stosb - jmp read_folder -.noup: -; There is no parent folder, and we are not on plugin panel -; Try to read ramdisk - mov esi, [dirinfo.name] - mov edi, esi - lodsd - or eax, 0x00202000 - cmp eax, '/rd/' - jnz @f - lodsw - cmp ax, '1' - jz .nosetrd -@@: - mov eax, '/rd/' - stosd - mov ax, '1' - stosw - jmp read_folder -.nosetrd: -; ࠬ ⠫. , 졠... - and dword [ebp + PanelData.numfiles], 0 - and dword [ebp + PanelData.index], 0 - and dword [ebp + PanelData.start], 0 - mov [bSilentFolderMode], 0 ; leave silent mode - ret -.ok: - mov eax, [dirinfo.dirdata] - cmp [eax+8], ebx - jz .readdone - push dword [eax+8] - mov ecx, [ebp + PanelData.files] - call pgfree - pop ecx - add ecx, 0xF - and ecx, not 0xF - push ecx - imul ecx, 4+304 - add ecx, 32 - call xpgalloc - test eax, eax - jnz .succ1 - pop eax - jmp .readdone -.succ1: - mov [ebp + PanelData.files], eax - pop [ebp + PanelData.nfa] - mov [prev_dir], 0 - jmp read_folder -.readdone: - xor edx, edx - mov [ebp + PanelData.start], edx - mov [ebp + PanelData.index], edx - mov [ebp + PanelData.start], edx - mov edi, [ebp + PanelData.files] - mov eax, [ebp + PanelData.nfa] - lea eax, [edi + eax*4 + 32] - mov ecx, [eax-32+4] - test ecx, ecx - jz .loopdone -; 㥬 ᯥ樠 室, ᮮ⢥騥 '.' ⪥ ⮬ -.ptrinit: - cmp word [eax+40], '.' - jz .loopcont - test byte [eax], 8 - jnz .loopcont - mov byte [eax+303], 0 - test edx, edx - jnz .nodotdot - cmp word [eax+40], '..' - jnz .nodotdot - cmp byte [eax+42], 0 - jnz .nodotdot - mov edx, eax - push edi -@@: - cmp edi, [ebp + PanelData.files] - jbe @f - push dword [edi-4] - pop dword [edi] - sub edi, 4 - jmp @b -@@: - stosd - pop edi - scasd - jmp .dotdot -.nodotdot: - stosd - xor ebx, ebx - test byte [eax], 10h - setz bl - add [ebp + PanelData.total_num], ebx - mov ebx, dword [eax+32] - add dword [ebp + PanelData.total_size], ebx - mov ebx, dword [eax+36] - adc dword [ebp + PanelData.total_size+4], ebx -.dotdot: -; ᢥ⪠ -; call insert_last_dot - call highlight_init -; call delete_last_dot -.loopcont: - add eax, 304 - dec ecx - jnz .ptrinit -.loopdone: - push edi - sub edi, [ebp + PanelData.files] - shr edi, 2 - mov [ebp + PanelData.numfiles], edi - pop edi - test edx, edx - jnz @f - test [ebp + PanelData.plugin_flags], 1 - jz @f - mov ecx, [ebp + PanelData.numfiles] - inc [ebp + PanelData.numfiles] - lea esi, [edi-4] - std - rep movsd - cld - mov eax, left_dotdot_entry - cmp ebp, panel1 - jz .zq - add eax, right_dotdot_entry-left_dotdot_entry -.zq: - stosd - call highlight_init -@@: -; ஢ -sort_files: - movzx eax, [ebp + PanelData.sortmode] - mov ebx, [compare_fns + eax*4] -.mode: - mov edx, [ebp + PanelData.files] - mov ecx, [ebp + PanelData.numfiles] - jecxz .skip - mov eax, [edx] - cmp word [eax+40], '..' - jnz .nodotdot - cmp byte [eax+42], 0 - jnz .nodotdot - dec ecx - add edx, 4 -.nodotdot: - call sort -.skip: - mov [bSilentFolderMode], 0 ; leave silent mode - ret - -align 4 -highlight_init: - pushad - mov ebp, eax - lea esi, [ebp+40] - mov edi, lower_file_name - mov edx, edi - xor eax, eax -@@: - lodsb - mov al, [tolower_table+eax] - stosb - test al, al - jnz @b - mov esi, edx - lea edx, [edi-1] - xor ecx, ecx -.highlight_test_loop: - mov ebx, [highlight_groups+ecx*4] - mov al, [ebx + highlight.IncludeAttributes] - mov ah, [ebp] - and ah, al - cmp ah, al - jnz .highlight_test_failed - lea edi, [ebx + highlight.Mask] - call match_mask_rev_lowercase - jc .highlight_test_failed - mov ah, [ebx + highlight.NormalColor] - test ah, ah - jnz @f - mov ah, [panel_normal_color] -@@: - mov [ebp+4], ah - mov ah, [ebx + highlight.CursorColor] - test ah, ah - jnz @f - mov ah, [panel_cursor_color] -@@: - mov [ebp+5], ah - mov ah, [ebx + highlight.SelectedColor] - test ah, ah - jnz @f - mov ah, [panel_selected_color] -@@: - mov [ebp+6], ah - mov ah, [ebx + highlight.SelectedCursorColor] - test ah, ah - jnz @f - mov ah, [panel_selected_cursor_color] -@@: - mov [ebp+7], ah - jmp .doname -.highlight_test_failed: - inc ecx - cmp ecx, [highlight_num_groups] - jb .highlight_test_loop -.nohighlight: - mov ah, [panel_normal_color] - mov [ebp+4], ah - mov ah, [panel_cursor_color] - mov [ebp+5], ah - mov ah, [panel_selected_color] - mov [ebp+6], ah - mov ah, [panel_selected_cursor_color] - mov [ebp+7], ah -.doname: - popad - ret - -align 4 -compare_name: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - add esi, 40 - add edi, 40 - jmp strcmpi -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -compare_name_rev: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - add esi, 40 - add edi, 40 - xchg esi, edi - jmp strcmpi -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -strcmpi: - push eax -@@: - lodsb - call match_symbol - jnz .ret - inc edi - test al, al - jnz @b -.ret: - pop eax - ret - -align 4 -compare_ext: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - add esi, 40 - add edi, 40 - push esi edi - call seek_ext - xchg esi, edi - call seek_ext - xchg esi, edi - call strcmpi - jnz .ret - pop edi esi - jmp strcmpi -.ret: - pop edi esi - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -compare_ext_rev: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - add esi, 40 - add edi, 40 - push esi edi - call seek_ext - xchg esi, edi - call seek_ext - call strcmpi - jnz .ret - pop edi esi - xchg esi, edi - jmp strcmpi -.ret: - pop edi esi - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -seek_ext: - push eax - xor eax, eax -.l: - inc esi - cmp byte [esi-1], '.' - jnz @f - mov eax, esi -@@: - cmp byte [esi-1], 0 - jnz .l - test eax, eax - jnz @f - lea eax, [esi-1] -@@: - mov esi, eax - pop eax - ret - -align 4 -compare_modified: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - push edi - mov edi, [edi+28] - cmp edi, [esi+28] - pop edi - jnz @f - push edi - mov edi, [edi+24] - cmp edi, [esi+24] - pop edi - jnz @f - add esi, 40 - add edi, 40 - jmp strcmpi -@@: - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -compare_modified_rev: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - push esi - mov esi, [esi+28] - cmp esi, [edi+28] - pop esi - jnz @f - push esi - mov esi, [esi+24] - cmp esi, [edi+24] - pop esi - jnz @f - add esi, 40 - add edi, 40 - xchg esi, edi - jmp strcmpi -@@: - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -compare_size: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - push edi - mov edi, [edi+36] - cmp edi, [esi+36] - pop edi - jnz @f - push edi - mov edi, [edi+32] - cmp edi, [esi+32] - pop edi - jnz @f - add esi, 40 - add edi, 40 - jmp strcmpi -@@: - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -compare_size_rev: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - push esi - mov esi, [esi+36] - cmp esi, [edi+36] - pop esi - jnz @f - push esi - mov esi, [esi+32] - cmp esi, [edi+32] - pop esi - jnz @f - add esi, 40 - add edi, 40 - xchg esi, edi - jmp strcmpi -@@: - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -compare_unordered: - cmp esi, edi - ret -compare_unordered_rev: - cmp edi, esi - ret - -align 4 -compare_created: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - push edi - mov edi, [edi+12] - cmp edi, [esi+12] - pop edi - jnz @f - push edi - mov edi, [edi+8] - cmp edi, [esi+8] - pop edi - jnz @f - add esi, 40 - add edi, 40 - jmp strcmpi -@@: - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -compare_created_rev: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - push esi - mov esi, [esi+12] - cmp esi, [edi+12] - pop esi - jnz @f - push esi - mov esi, [esi+8] - cmp esi, [edi+8] - pop esi - jnz @f - add esi, 40 - add edi, 40 - xchg esi, edi - jmp strcmpi -@@: - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -compare_accessed: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - push edi - mov edi, [edi+20] - cmp edi, [esi+20] - pop edi - jnz @f - push edi - mov edi, [edi+16] - cmp edi, [esi+16] - pop edi - jnz @f - add esi, 40 - add edi, 40 - jmp strcmpi -@@: - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -compare_accessed_rev: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - push esi - mov esi, [esi+20] - cmp esi, [edi+20] - pop esi - jnz @f - push esi - mov esi, [esi+16] - cmp esi, [edi+16] - pop esi - jnz @f - add esi, 40 - add edi, 40 - xchg esi, edi - jmp strcmpi -@@: - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -ReadFolder_default: - mov eax, 2 - ret 10h - -if 0 -; Following subroutines work, but are slow -match_mask: -; in: esi->name, edi->mask -; out: CF clear <=> match - pusha - xchg esi, edi -.main_cycle: - push esi -@@: - lodsb - test al, al - jz @f - cmp al, ',' - jz @f - cmp al, '|' - jnz @b -@@: - mov [esi-1], byte 0 - xchg esi, [esp] - call match_single_mask - pop esi - mov [esi-1], al - jnc .found - cmp al, ',' - jz .main_cycle -.done_fail: - stc - popa - ret -.found: - test al, al - jz .done_succ - cmp al, '|' - jz .test_exclude - lodsb - jmp .found -.done_succ: - clc - popa - ret -.test_exclude: - push esi -@@: - lodsb - test al, al - jz @f - cmp al, ',' - jnz @b -@@: - mov byte [esi-1], 0 - xchg esi, [esp] - call match_single_mask - pop esi - mov [esi-1], al - jnc .done_fail - test al, al - jz .done_succ - jmp .test_exclude - -match_single_mask: -; in: esi->mask, edi->name -; out: CF clear <=> match - pusha -.mask_symbol: - lodsb - test al, al - jz .mask_done - cmp al, '*' - jz .asterisk - cmp al, '?' - jz .quest - cmp al, '[' - jz .list - call match_symbol - jnz .done_fail - inc edi - jmp .mask_symbol -.done_fail: - stc - popa - ret -.mask_done: - scasb - jnz .done_fail -.done_succ: - clc - popa - ret -.quest: - mov al, 0 - scasb - jz .done_fail - jmp .mask_symbol -.list: - lodsb - cmp al, ']' - jz .done_fail - cmp byte [esi+1], '-' - jz .range - call match_symbol - jnz .list -.listok: - inc edi -@@: - lodsb - cmp al, ']' - jnz @b - jmp .mask_symbol -.range: - call match_symbol - ja @f - mov al, [esi+2] - call match_symbol - jae .listok -@@: - inc esi - jmp .list -.asterisk: - cmp byte [esi], 0 - jz .done_succ - cmp byte [esi], '?' - jnz @f - mov al, 0 - scasb - jz .done_fail - inc esi - jmp .asterisk -@@: - cmp byte [esi], '[' - jz .asterisk_common -; the mask is ...*... -.asterisk_normal: - mov al, [esi] -@@: - cmp byte [edi], 0 - jz .done_fail - call match_symbol - jz @f - inc edi - jmp @b -@@: - inc edi - inc esi - call match_single_mask - jnc .done_succ - dec esi - jmp .asterisk_normal -.asterisk_common: - push edi -@@: - call match_single_mask - jnc @f - mov al, 0 - scasb - jnz @b - pop edi - jmp .done_fail -@@: - pop edi - jmp .done_succ - -match_mask_rev: -; in: esi->name, edx->end of name, edi->mask -; out: CF clear <=> match - pusha - xchg esi, edx - xchg esi, edi -.main_cycle: - mov ecx, esi -@@: - lodsb - test al, al - jz @f - cmp al, ',' - jz @f - cmp al, '|' - jnz @b -@@: - dec esi - mov [esi], byte 0 - call match_single_mask_rev2 - mov [esi], al - inc esi - jnc .found - cmp al, ',' - jz .main_cycle -.done_fail: - stc - popa - ret -.found: - test al, al - jz .done_succ - cmp al, '|' - jz .test_exclude - lodsb - jmp .found -.done_succ: - clc - popa - ret -.test_exclude: - mov ecx, esi -@@: - lodsb - test al, al - jz @f - cmp al, ',' - jnz @b -@@: - dec esi - mov byte [esi], 0 - call match_single_mask_rev2 - mov [esi], al - inc esi - jnc .done_fail - test al, al - jz .done_succ - jmp .test_exclude - -match_single_mask_rev2: - pusha - jmp match_single_mask_rev.mask_symbol -match_single_mask_rev: -; in: esi->mask, edi->end of name, edx->start of name -; out: CF clear <=> match - pusha - mov ecx, esi -@@: - lodsb - test al, al - jnz @b - dec esi -; esi->end of mask, ecx->start of mask -.mask_symbol: - dec esi - cmp esi, ecx - jb .mask_done - mov al, [esi] - cmp al, '*' - jz .asterisk - cmp al, '?' - jz .quest - cmp al, ']' - jz .list - dec edi - cmp edi, edx - jb .done_fail - call match_symbol - jz .mask_symbol -.done_fail: - stc - popa - ret -.mask_done: - cmp edi, edx - jnz .done_fail -.done_succ: - clc - popa - ret -.quest: - dec edi - cmp edi, edx - jb .done_fail - jmp .mask_symbol -.list: - dec edi - cmp edi, edx - jb .done_fail -.list_check: - dec esi - cmp esi, ecx - jbe .done_fail - mov al, [esi] - cmp al, '[' - jz .done_fail - cmp byte [esi-1], '-' - jz .range - call match_symbol - jnz .list_check -.listok: -@@: - dec esi - cmp esi, ecx - jb .done_fail - cmp byte [esi], '[' - jnz @b - jmp .mask_symbol -.range: - call match_symbol - jb @f - mov al, [esi-2] - call match_symbol - jbe .listok -@@: - dec esi - dec esi - jmp .list_check -.asterisk: - cmp esi, ecx - jz .done_succ - cmp byte [esi-1], '?' - jnz @f - cmp edi, edx - jz .done_fail - dec esi - jmp .asterisk -@@: - cmp byte [esi-1], ']' - jz .asterisk_common -; the mask is ...*... -.asterisk_normal: - mov al, [esi-1] -@@: - cmp edi, edx - jz .done_fail - call match_symbol - jz @f - dec edi - jmp @b -@@: - dec edi - dec esi - call match_single_mask_rev2 - jnc .done_succ - inc esi - jmp .asterisk_normal -.asterisk_common: - push edi -@@: - call match_single_mask_rev2 - jnc @f - dec edi - cmp edi, edx - jae @b - pop edi - jmp .done_fail -@@: - pop edi - jmp .done_succ -end if - -;tolower: -; push ecx -; movzx ecx, al -; mov al, [tolower_table+ecx] -; pop ecx -; ret - -match_symbol: -; in: al,[edi]=symbols -; out: flags as 'cmp al,[edi]' - push eax ecx - movzx ecx, al - mov al, [tolower_table+ecx] - movzx ecx, byte [edi] - cmp al, [tolower_table+ecx] - pop ecx eax - ret - -match_mask_rev_lowercase: -; in: esi->name, edx->end of name, edi->mask -; out: CF clear <=> match - pusha - xchg esi, edx - xchg esi, edi -.main_cycle: - mov ecx, esi -@@: - lodsb - test al, al - jz @f - cmp al, ',' - jz @f - cmp al, ';' - jz @f - cmp al, '|' - jnz @b -@@: - dec esi - mov [esi], byte 0 - call match_single_mask_rev_lowercase - mov [esi], al - inc esi - jnc .found - cmp al, ',' - jz .main_cycle - cmp al, ';' - jz .main_cycle -.done_fail: - stc - popa - ret -.found: - test al, al - jz .done_succ - cmp al, '|' - jz .test_exclude - lodsb - jmp .found -.done_succ: - clc - popa - ret -.test_exclude: - mov ecx, esi -@@: - lodsb - test al, al - jz @f - cmp al, ',' - jz @f - cmp al, ';' - jnz @b -@@: - dec esi - mov byte [esi], 0 - call match_single_mask_rev_lowercase - mov [esi], al - inc esi - jnc .done_fail - test al, al - jz .done_succ - jmp .test_exclude - -match_single_mask_rev_lowercase: -; in: esi->end of mask, ecx->start of mask, edi->end of name, edx->start of name -; out: CF clear <=> match - push esi edi eax -.mask_symbol: - dec esi - cmp esi, ecx - jb .mask_done - mov al, [esi] - cmp al, '*' - jz .asterisk - dec edi - cmp edi, edx - jb .done_fail - cmp al, '?' - jz .mask_symbol - cmp al, ']' - jz .list_check - cmp al, [edi] - jz .mask_symbol -.done_fail: - stc - pop eax edi esi - ret -.mask_done: - cmp edi, edx - jnz .done_fail -.done_succ: - clc - pop eax edi esi - ret -.list_check: - dec esi - cmp esi, ecx - jbe .done_fail - mov al, [esi] - cmp al, '[' - jz .done_fail - cmp byte [esi-1], '-' - jz .range - cmp al, [edi] - jnz .list_check -.listok: -@@: - dec esi - cmp esi, ecx - jb .done_fail - cmp byte [esi], '[' - jnz @b - jmp .mask_symbol -.range: - cmp al, [edi] - jb @f - mov al, [esi-2] - cmp al, [edi] - jbe .listok -@@: - dec esi - dec esi - jmp .list_check -.asterisk: - cmp esi, ecx - jz .done_succ - cmp byte [esi-1], '?' - jnz @f - cmp edi, edx - jz .done_fail - dec esi - dec edi - jmp .asterisk -@@: - cmp byte [esi-1], ']' - jz .asterisk_common -; the mask is ...*... -.asterisk_normal: - mov al, [esi-1] -@@: - dec edi - cmp edi, edx - jb .done_fail - cmp al, [edi] - jnz @b -@@: - dec esi - call match_single_mask_rev_lowercase - jnc .done_succ - inc esi - jmp .asterisk_normal -.asterisk_common: - push edi -@@: - call match_single_mask_rev_lowercase - jnc @f - dec edi - cmp edi, edx - jae @b - pop edi - jmp .done_fail -@@: - pop edi - jmp .done_succ - -find_extension: - lea esi, [ecx+40] - push esi -@@: - lodsb - test al, al - jnz @b -@@: - dec esi - cmp byte [esi], '.' - jz .found_ext - cmp esi, [esp] - ja @b -; empty extension - pop esi - stc - ret -.found_ext: - inc esi - mov edi, [associations] - test edi, edi - jz .notfound -.find_loop: - push esi edi - call strcmpi - pop edi esi - pushf -@@: - inc edi - cmp byte [edi-1], 0 - jnz @b - popf - jz .found -@@: - inc edi - cmp byte [edi-1], 0 - jnz @b - cmp byte [edi], 0 - jnz .find_loop -.notfound: -; unknown extension - stc -.found: - pop esi - ret - -header db 'Kolibri Far ',version,0 - -nomem_draw db 'No memory for redraw.',0 -.size = $ - nomem_draw - -def_left_dir db '/sys',0 -def_right_dir db '/hd0/1',0 - -bSilentFolderMode db 1 - -bQuickSearchMode db 0 -bDisplayQuickSearch db 0 - -if lang eq ru_RU -aFolder db '' -.size = $-aFolder -aUp db '' -.size = $-aUp -aDrive db '',0 -aScreens db '࠭',0 -else -aFolder db 'Folder' -.size = $-aFolder -aUp db 'Up' -.size = $-aUp -aDrive db 'Drive',0 -aScreens db 'Screens',0 -end if - -align 4 -_10d dd 10 -_100d dd 100 -muldiv10 dd 429496729 -_10 db 10 -_100 db 100 - -fpu_cw dw 000011100111111b - -keybar_panels: -if lang eq ru_RU -; -䨪஢ - db '' - db '짌' - db ' ' - db '' - db ' ' - db '७ ' - db ' ' - db '' - db '䌭' - db '室 ' - db '㫨' - db '࠭' -; Shift - db '' - db 'ᯠ' - db '劮' - db '.' - db ' ' - db '२' - db ' ' - db '' - db '࠭' - db '᫤' - db '㯯' - db '࠭' -; Ctrl - db ' ' - db 'ࠢ' - db ' ' - db '' - db ' ' - db '' - db '' - db '' - db '' - db 'ᠭ' - db '' - db ' ' -; Ctrl+Shift - db ' ' - db ' ' - db ' ' - db '' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' -; Alt - db ' ' - db 'ࠢ' - db '.' - db ' ' - db '' - db ' ' - db '᪠' - db ' ' - db ' ' - db 'ॢ' - db ' ' - db '⏠' -; Alt+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db '䏫' - db ' ' - db ' ' - db ' ' -; Alt+Ctrl -times 12 db ' ' -; Alt+Ctrl+Shift -times 12 db ' ' -else -; No modificators - db 'Help ' - db 'UserMn' - db 'View ' - db 'Edit ' - db 'Copy ' - db 'RenMov' - db 'MkFold' - db 'Delete' - db 'ConfMn' - db 'Quit ' - db 'Plugin' - db 'Screen' -; Shift - db 'Add ' - db 'Extrct' - db 'ArcCmd' - db 'Edit..' - db 'Copy ' - db 'Rename' - db ' ' - db 'Delete' - db 'Save ' - db 'Last ' - db 'Group ' - db 'SelUp ' -; Ctrl - db 'Left ' - db 'Right ' - db 'Name ' - db 'Extens' - db 'Modifn' - db 'Size ' - db 'Unsort' - db 'Creatn' - db 'Access' - db 'Descr ' - db 'Owner ' - db 'Sort ' -; Ctrl+Shift - db ' ' - db ' ' - db 'View ' - db 'Edit ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' -; Alt - db 'Left ' - db 'Right ' - db 'View..' - db ' ' - db 'Print ' - db 'MkLink' - db 'Find ' - db 'Histry' - db 'Video ' - db 'Tree ' - db 'ViewHs' - db 'FoldHs' -; Alt+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db 'ConfPl' - db ' ' - db ' ' - db ' ' -; Alt+Ctrl -times 12 db ' ' -; Alt+Ctrl+Shift -times 12 db ' ' -end if - -keybar_viewer: -if lang eq ru_RU -; -䨪஢ - db '' - db '' - db '室 ' - db ' ' - db ' ' - db '' - db ' ' -keybar_cp: - db 'cp1251' - db ' ' - db '室 ' - db '㫨' - db '࠭' -; Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db '' - db '' - db ' ' - db ' ' - db ' ' - db ' ' -; Ctrl - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' -; Ctrl+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' -; Alt - db ' ' - db ' ' - db ' ' - db ' ' - db '' - db ' ' - db ' ' - db '३' - db ' ' - db ' ' - db ' ' - db ' ' -; Alt+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db '䨣' - db ' ' - db ' ' - db ' ' -; Alt+Ctrl -times 12 db ' ' -; Alt+Ctrl+Shift -times 12 db ' ' -else -; No modificators - db 'Help ' - db 'Unwrap' - db 'Quit ' - db 'Hex ' - db ' ' - db 'Edit ' - db 'Search' -keybar_cp: - db 'cp1251' - db ' ' - db 'Quit ' - db 'Plugin' - db 'Screen' -; Shift - db ' ' - db 'WWrap ' - db ' ' - db ' ' - db ' ' - db ' ' - db 'Next ' - db 'Table ' - db ' ' - db ' ' - db ' ' - db ' ' -; Ctrl - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db 'GoFile' - db ' ' - db ' ' -; Ctrl+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' -; Alt - db ' ' - db ' ' - db ' ' - db ' ' - db 'Print ' - db ' ' - db 'Prev ' - db 'Goto ' - db 'Video ' - db ' ' - db 'ViewHs' - db ' ' -; Alt+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db 'Config' - db ' ' - db ' ' - db ' ' -; Alt+Ctrl -times 12 db ' ' -; Alt+Ctrl+Shift -times 12 db ' ' -end if - -keybar_editor: -if lang eq ru_RU -; -䨪஢ - db '' - db '࠭' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' -keybar_cp2: - db 'cp1251' - db ' ' - db '室 ' - db '㫨' - db '࠭' -; Shift - db ' ' - db '.' - db ' ' - db '.' - db ' ' - db ' ' - db '' - db '' - db ' ' - db '' - db ' ' - db ' ' -; Ctrl - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db '' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' -; Ctrl+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' -; Alt - db ' ' - db ' ' - db ' ' - db ' ' - db '' - db ' ' - db ' ' - db 'ப' - db ' ' - db ' ' - db ' ' - db ' ' -; Alt+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db '䨣' - db ' ' - db ' ' - db ' ' -; Alt+Ctrl -times 12 db ' ' -; Alt+Ctrl+Shift -times 12 db ' ' -else -; No modificators - db 'Help ' - db 'Save ' - db ' ' - db ' ' - db ' ' - db 'View ' - db 'Search' -keybar_cp2: - db 'cp1251' - db ' ' - db 'Quit ' - db 'Plugin' - db 'Screen' -; Shift - db ' ' - db 'SaveAs' - db ' ' - db 'Edit..' - db ' ' - db ' ' - db 'Next ' - db 'Table ' - db ' ' - db 'SaveQ ' - db ' ' - db ' ' -; Ctrl - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db 'Replac' - db ' ' - db ' ' - db 'GoFile' - db ' ' - db ' ' -; Ctrl+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' -; Alt - db ' ' - db ' ' - db ' ' - db ' ' - db 'Print ' - db ' ' - db ' ' - db 'Goto ' - db 'Video ' - db ' ' - db 'ViewHs' - db ' ' -; Alt+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db 'Config' - db ' ' - db ' ' - db ' ' -; Alt+Ctrl -times 12 db ' ' -; Alt+Ctrl+Shift -times 12 db ' ' -end if - - align 4 -cur_width dd 80 -cur_height dd 25 -saved_width dd -1 -saved_height dd -1 -fill_width dd 0 ;⮪ ਭ ਭ -fill_height dd 0 -max_width = 256 -max_height = 256 -console_data_ptr dd 0 - -cursor_x dd -1 -cursor_y dd -1 -cursor_size dd cursor_normal_size -cur_cursor_pos dd -1 -old_cursor_pos dd -1 - -idle_interval dd -1 - -active_panel dd panel1 - -associations dd 0 -associations_size dd 1 ; terminating zero -associations_allocated dd 0x1000 ; start with one page - -console_colors dd 0x000000, 0x000080, 0x008000, 0x008080 - dd 0x800000, 0x800080, 0x808000, 0xC0C0C0 - dd 0x808080, 0x0000FF, 0x00FF00, 0x00FFFF - dd 0xFF0000, 0xFF00FF, 0xFFFF00, 0xFFFFFF - -compare_fns dd compare_name - dd compare_name_rev - dd compare_ext - dd compare_ext_rev - dd compare_modified - dd compare_modified_rev - dd compare_size - dd compare_size_rev - dd compare_unordered - dd compare_unordered_rev - dd compare_created - dd compare_created_rev - dd compare_accessed - dd compare_accessed_rev - -ctrlkey_tests dd ctrlkey_test0 - dd ctrlkey_test1 - dd ctrlkey_test2 - dd ctrlkey_test3 - dd ctrlkey_test4 -ctrlkey_tests_num = 5 - -virtual at 0 -screen_vtable: - .OnRedraw dd ? - .OnActivate dd ? - .OnIdle dd ? - .OnKey dd ? - .keybar dd ? - .getname dd ? - .OnExit dd ? - .IsHandleUsed dd ? -end virtual - -panels_vtable: - dd panels_OnRedraw - dd 0 - dd 0 - dd panels_OnKey - dd keybar_panels - dd panels_getname - dd panels_OnExit - dd panels_IsHandleUsed - -viewer_vtable: - dd viewer_OnRedraw - dd 0 - dd 0 - dd viewer_OnKey - dd keybar_viewer - dd viewer_getname - dd viewer_OnExit - dd viewer_IsHandleUsed - -editor_vtable: - dd editor_OnRedraw - dd 0 - dd 0 - dd editor_OnKey - dd keybar_editor - dd editor_getname - dd editor_OnExit - dd editor_IsHandleUsed - -filesearch_vtable: - dd filesearch_OnRedraw - dd filesearch_OnActivate - dd filesearch_OnIdle - dd filesearch_OnKey - dd 0 - dd filesearch_getname - dd filesearch_OnExit - dd filesearch_IsHandleUsed - -; additions to this table require changes in tools.inc::get_error_msg -errors1: - dd error0msg - dd error1msg - dd error2msg - dd error3msg - dd error4msg - dd error5msg - dd error6msg - dd error7msg - dd error8msg - dd error9msg - dd error10msg - dd error11msg -errors2: - dd error30msg - dd error31msg - dd error32msg - -encodings: -.cp866 = 0 -.cp1251 = 1 -.koi8r = 2 -.unicode = 3 - -.names: - db 'cp866 ' - db 'cp1251 ' - db 'koi8-r ' - db 'Unicode ' - -.tables: -; cp866 - trivial map - times 128 db %+127 -; cp1251 - db 0x3F,0x3F,0x27,0x3F,0x22,0x3A,0xC5,0xD8,0x3F,0x25,0x3F,0x3C,0x3F,0x3F,0x3F,0x3F - db 0x3F,0x27,0x27,0x22,0x22,0x07,0x2D,0x2D,0x3F,0x54,0x3F,0x3E,0x3F,0x3F,0x3F,0x3F - db 0xFF,0xF6,0xF7,0x3F,0xFD,0x3F,0xB3,0x15,0xF0,0x63,0xF2,0x3C,0xBF,0x2D,0x52,0xF4 - db 0xF8,0x2B,0x49,0x69,0x3F,0xE7,0x14,0xFA,0xF1,0xFC,0xF3,0x3E,0x3F,0x3F,0x3F,0xF5 - times 0x30 db %-1+0x80 - times 0x10 db %-1+0xE0 -; koi8-r - db 0xC4,0xB3,0xDA,0xBF,0xC0,0xD9,0xC3,0xB4,0xC2,0xC1,0xC5,0xDF,0xDC,0xDB,0xDD,0xDE - db 0xB0,0xB1,0xB2,0xF4,0xFE,0xF9,0xFB,0xF7,0xF3,0xF2,0xFF,0xF5,0xF8,0xFD,0xFA,0xF6 - db 0xCD,0xBA,0xD5,0xF1,0xD6,0xC9,0xB8,0xB7,0xBB,0xD4,0xD3,0xC8,0xBE,0xBD,0xBC,0xC6 - db 0xC7,0xCC,0xB5,0xF0,0xB6,0xB9,0xD1,0xD2,0xCB,0xCF,0xD0,0xCA,0xD8,0xD7,0xCE,0xFC - db 0xEE,0xA0,0xA1,0xE6,0xA4,0xA5,0xE4,0xA3,0xE5,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE - db 0xAF,0xEF,0xE0,0xE1,0xE2,0xE3,0xA6,0xA2,0xEC,0xEB,0xA7,0xE8,0xED,0xE9,0xE7,0xEA - db 0x9E,0x80,0x81,0x96,0x84,0x85,0x94,0x83,0x95,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E - db 0x8F,0x9F,0x90,0x91,0x92,0x93,0x86,0x82,0x9C,0x9B,0x87,0x98,0x9D,0x99,0x97,0x9A - -.menu: - db .cp866 -.menu.1: - dd .menu.2 - dd 0 -if lang eq ru_RU - db '&DOS ⥪ (cp866)',0 -else - db '&DOS text (cp866)',0 -end if - db .cp1251 -.menu.2: - dd .menu.3 - dd .menu.1 -if lang eq ru_RU - db '&Windows ⥪ (cp1251)',0 -else - db '&Windows text (cp1251)',0 -end if - db .koi8r -.menu.3: - dd .menu.4 - dd .menu.2 -if lang eq ru_RU - db '&Linux ⥪ (koi8-r)',0 -else - db '&Linux text (koi8-r)',0 -end if - db .unicode -.menu.4: - dd 0 - dd .menu.3 - db '&Unicode',0 - -active_screen dd 0 -viewer_tabsize dd 8 -editor_tabsize dd 8 - -ascii2scan: - times 32 db 0 - db 0x39,0x02,0x03,0x04,0x05,0x06,0x08,0x28,0x0A,0x0B,0x09,0x0D,0x33,0x0C,0x34,0x35 - db 0x0B,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x27,0x27,0x33,0x0D,0x34,0x35 - db 0x03,0x1E,0x30,0x2E,0x20,0x12,0x21,0x22,0x23,0x17,0x24,0x25,0x26,0x32,0x31,0x18 - db 0x19,0x10,0x13,0x1F,0x14,0x16,0x2F,0x11,0x2D,0x15,0x2C,0x1A,0x2B,0x1B,0x07,0x0C - db 0x29,0x1E,0x30,0x2E,0x20,0x12,0x21,0x22,0x23,0x17,0x24,0x25,0x26,0x32,0x31,0x18 - db 0x19,0x10,0x13,0x1F,0x14,0x16,0x2F,0x11,0x2D,0x15,0x2C,0x1A,0x2B,0x1B,0x29,0x00 - db 0x21,0x33,0x20,0x16,0x26,0x14,0x27,0x19,0x30,0x10,0x13,0x25,0x2F,0x15,0x24,0x22 - db 0x23,0x2E,0x31,0x12,0x1E,0x1A,0x11,0x2D,0x17,0x18,0x1B,0x1F,0x32,0x28,0x34,0x2C - db 0x21,0x33,0x20,0x16,0x26,0x14,0x27,0x19,0x30,0x10,0x13,0x25,0x2F,0x15,0x24,0x22 - times 48 db 0 - db 0x23,0x2E,0x31,0x12,0x1E,0x1A,0x11,0x2D,0x17,0x18,0x1B,0x1F,0x32,0x28,0x34,0x2C - db 0x29,0x29,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 -scan2ascii: - db 0,0,'1234567890-=',0,0 - db 'qwertyuiop[]',0,0,'as' - db 'dfghjkl;',27h,'`',0,'\zxcv' - db 'bnm,./',0,0,0,' ',0,0,0,0,0,0 - -;⠡ 㭪権: mouse_panels, mouse_viewer mouse_editor 冷 㣮 -align 4 -mouse_panels: - dd 0 ;f1 - dd 0 ;f2 - dd panels_OnKey.f3 - dd panels_OnKey.f4 - dd panels_OnKey.f5 - dd 0 ;f6 - dd panels_OnKey.f7 - dd panels_OnKey.f8 - dd 0 - dd exit ;f10 - dd 0 - dd F12 -; Shift - rd 4 - dd panels_OnKey.shift_f5 - rd 7 -.ctrl: - rd 2 -repeat 9-3+1 - dd panels_OnKey.ctrl_f3_9 -end repeat - rd 3 -; Ctrl+Shift - rd 12 -.alt: - dd panels_OnKey.alt_f1_2 - dd panels_OnKey.alt_f1_2 - rd 4 - dd panels_OnKey.alt_f7 - rd 5 -; Alt+Shift - rd 12 -; Alt+Ctrl - rd 12 -; Alt+Ctrl+Shift - rd 12 - -mouse_viewer: - rd 1 - dd viewer_OnKey.f2 - dd viewer_OnKey.exit ;f3 - dd viewer_OnKey.f4 - rd 2 - dd viewer_OnKey.f7 - dd viewer_OnKey.f8 - rd 1 - dd viewer_OnKey.exit ;f10 - rd 1 - dd F12 -; Shift - rd 6 - dd viewer_OnKey.shift_f7 - rd 5 -; Ctrl - rd 12 -; Ctrl+Shift - rd 12 -; Alt - rd 12 -; Alt+Shift - rd 12 -; Alt+Ctrl - rd 12 -; Alt+Ctrl+Shift - rd 12 - -mouse_editor: - rd 1 - dd editor_OnKey.f2 - rd 4 - dd editor_OnKey.f7 - rd 2 - dd editor_OnKey.exit_confirm ;f10 - rd 1 - dd F12 -; Shift - rd 6 - dd editor_OnKey.shift_f7 - rd 5 -; Ctrl - rd 12 -; Ctrl+Shift - rd 12 -; Alt - rd 12 -; Alt+Shift - rd 12 -; Alt+Ctrl - rd 12 -; Alt+Ctrl+Shift - rd 12 - -; ⠭ -; db scancode, reserved -; dw ctrlstate -; dd handler -; ctrlstate: 訥 4 - Shift, ᫥騥 - Ctrl, ᫥騥 - Alt -; 0 = -; 1 = ஢ -; 2 = -; 3 = , ࠢ -; 4 = ࠢ , -panels_ctrlkeys: - dw 0x48, 0 - dd panels_OnKey.up - dw 0x50, 0 - dd panels_OnKey.down - dw 0x4B, 0 - dd panels_OnKey.left - dw 0x4D, 0 - dd panels_OnKey.right - dw 0x51, 0 - dd panels_OnKey.pgdn - dw 0x49, 0 - dd panels_OnKey.pgup - dw 0xF, 0 - dd panels_OnKey.tab - dw 0x47, 0 - dd panels_OnKey.home - dw 0x4F, 0 - dd panels_OnKey.end - dw 0x1C, 0 - dd panels_OnKey.enter - dw 0x3D, 0 - dd panels_OnKey.f3 - dw 0x3E, 0 - dd panels_OnKey.f4 - dw 0x3F, 0 - dd panels_OnKey.f5 - dw 0x3F, 1 - dd panels_OnKey.shift_f5 - dw 0x41, 0 - dd panels_OnKey.f7 - dw 0x41, 0x100 - dd panels_OnKey.alt_f7 - dw 0x42, 0 - dd panels_OnKey.f8 - dw 0x43, 0x100 - dd alt_f9 - dw 0x44, 0 - dd exit - dw 0x5D, 0 - dd panels_OnKey.menu -repeat 9-3+1 - dw 0x3D+%-1, 0x10 - dd panels_OnKey.ctrl_f3_9 -end repeat - dw 0x3B, 0x100 - dd panels_OnKey.alt_f1_2 - dw 0x3C, 0x100 - dd panels_OnKey.alt_f1_2 - dw 0x58, 0 - dd F12 - dw 0x13, 0x10 - dd panels_OnKey.ctrl_r - dw 2, 0x30 - dd panels_OnKey.change_mode - dw 3, 0x30 - dd panels_OnKey.change_mode - dw 4, 0x30 - dd panels_OnKey.change_mode - dw 5, 0x30 - dd panels_OnKey.change_mode -repeat 10 - dw %+1, 0x40 - dd panels_OnKey.quick_jump -end repeat - dw 0x52, 0 - dd panels_OnKey.insert - dw 0x4E, 0 - dd panels_OnKey.greyplus - dw 0x4A, 0 - dd panels_OnKey.greyminus - dw 0x37, 0 - dd panels_OnKey.greyasterisk - db 0 - -viewer_ctrlkeys: - dw 1, 0 - dd viewer_OnKey.exit - dw 0x51, 0 - dd viewer_OnKey.pgdn - dw 0x49, 0 - dd viewer_OnKey.pgup - dw 0x50, 0 - dd viewer_OnKey.down - dw 0x48, 0 - dd viewer_OnKey.up - dw 0x4B, 0 - dd viewer_OnKey.left - dw 0x4B, 0x10 - dd viewer_OnKey.ctrl_left - dw 0x4B, 0x11 - dd viewer_OnKey.ctrl_shift_left - dw 0x4C, 0 - dd viewer_OnKey.exit - dw 0x4D, 0 - dd viewer_OnKey.right - dw 0x4D, 0x10 - dd viewer_OnKey.ctrl_right - dw 0x4D, 0x11 - dd viewer_OnKey.ctrl_shift_right - dw 0x3C, 0 - dd viewer_OnKey.f2 - dw 0x3D, 0 - dd viewer_OnKey.exit - dw 0x3E, 0 - dd viewer_OnKey.f4 - dw 0x41, 0 - dd viewer_OnKey.f7 - dw 0x41, 1 - dd viewer_OnKey.shift_f7 - dw 0x42, 0 - dd viewer_OnKey.f8 - dw 0x42, 1 - dd viewer_OnKey.shift_f8 - dw 0x44, 0 - dd viewer_OnKey.exit - dw 0x47, 0 - dd viewer_OnKey.home - dw 0x4F, 0 - dd viewer_OnKey.end - dw 0x58, 0 - dd F12 - dw 0x43, 0x100 - dd alt_f9 - db 0 - -editor_ctrlkeys: - dw 1, 0 - dd editor_OnKey.exit_confirm - dw 0x0E, 0 - dd editor_OnKey.backspace - dw 0x3C, 0 - dd editor_OnKey.f2 - dw 0x41, 0 - dd editor_OnKey.f7 - dw 0x41, 1 - dd editor_OnKey.shift_f7 - dw 0x43, 0x100 - dd alt_f9 - dw 0x44, 0 - dd editor_OnKey.exit_confirm - dw 0x44, 1 - dd editor_OnKey.exit_save - dw 0x47, 0 - dd editor_OnKey.home - dw 0x48, 0 - dd editor_OnKey.up - dw 0x49, 0 - dd editor_OnKey.pgup - dw 0x4B, 0 - dd editor_OnKey.left - dw 0x4D, 0 - dd editor_OnKey.right - dw 0x4F, 0 - dd editor_OnKey.end - dw 0x50, 0 - dd editor_OnKey.down - dw 0x51, 0 - dd editor_OnKey.pgdn - dw 0x52, 0 - dd editor_OnKey.ins - dw 0x53, 0 - dd editor_OnKey.del - dw 0x58, 0 - dd F12 - dw 0xF, 0x100 ; Alt+Tab - dd dummy_key - dw 0xF, 0x101 ; Shift+Alt+Tab - dd dummy_key - db 0 - -dummy_key: - ret - -dirinfo: - dd 1 -.first dd 0 - dd 0 -.size dd 300 -.dirdata dd 0 - db 0 -.name dd 0 - -readinfo: - dd 0 -.first dq 0 -.size dd 0 -.data dd 0 - db 0 -.name dd 0 - -writeinfo: -.code dd 2 -.first dq 0 -.size dd 0 -.data dd 0 - db 0 -.name dd 0 - -attrinfo: - dd 5 - dd 0 - dd 0 - dd 0 - dd .attr - db 0 -.name dd 0 - -delinfo: - dd 8 - dd 0 - dd 0 - dd 0 - dd 0 - db 0 - dd execdata - -mkdirinfo: - dd 9 - dd 0 - dd 0 - dd 0 - dd 0 - db 0 - dd CopyDestEditBuf+12 - -if lang eq ru_RU -compare_names db 'ᑤ' -else -compare_names db 'nNxXmMsSuUcCaA' -end if - -; 稭 䨣樮 - ⥪饩 ॠ樨 ୨ - -; -panel_normal_color db 1Bh -panel_selected_color db 1Eh -panel_border_color db 1Bh -panel_cursor_color db 30h -panel_selected_cursor_color db 3Eh -panel_header_color db 1Bh -panel_active_header_color db 30h -column_header_color db 1Eh -panel_number_color db 1Bh -panel_numselected_color db 3Eh -panel_nscreens_color db 0Bh -; -dialog_colors: -dialog_main_color db 70h -dialog_border_color db 70h -dialog_header_color db 70h -dialog_edit_color db 30h -dialog_unmodified_edit_color db 38h -dialog_normal_btn_color db 70h -dialog_selected_btn_color db 30h -dialog_list_color db 70h -dialog_selected_list_color db 0Fh -dialog_scroll_list_color db 70h -; ।० 訡 -warning_colors: -; !!! ⮬ 浪, !!! -warning_main_color db 4Fh -warning_border_color db 4Fh -warning_header_color db 4Fh -warning_edit_color db 30h -warning_unmodified_edit_color db 38h -warning_normal_btn_color db 4Fh -warning_selected_btn_color db 70h -warning_list_color db 3Fh -warning_selected_list_color db 70h -warning_scroll_list_color db 3Fh -; -menu_normal_color db 3Fh -menu_selected_color db 0Fh -menu_highlight_color db 3Eh -menu_selected_highlight_color db 0Eh -menu_border_color db 3Fh -menu_header_color db 3Fh -menu_scrollbar_color db 3Fh -; -keybar_number_color db 7 -keybar_name_color db 30h -keybar_bgr_color db 7 -; ப -cmdbar_normal_color db 7 -cmdbar_prefix_color db 7 -; ᬮ騪 -view_normal_color db 1Bh -view_selected_color db 30h -view_status_color db 30h -view_arrows_color db 1Eh -; -edit_normal_color db 1Bh -edit_status_color db 30h - -; ᢥ⪠ 䠩 -highlight_num_groups dd 10 -highlight_groups dd highlight_group0 - dd highlight_group1 - dd highlight_group2 - dd highlight_group3 - dd highlight_group4 - dd highlight_group5 - dd highlight_group6 - dd highlight_group7 - dd highlight_group8 - dd highlight_group9 - -; ଠ ᠭ 㯯 ᢥ⪨: -virtual at 0 -highlight: - .IncludeAttributes db ? - .NormalColor db ? - .CursorColor db ? - .SelectedColor db ? - .SelectedCursorColor db ? - .Mask: ; ASCIIZ-string -end virtual - -; all highlight masks must be in lowercase! -highlight_group0: - db 2 - db 13h, 38h, 0, 0 - db '*',0 -highlight_group1: - db 4 - db 13h, 38h, 0, 0 - db '*',0 -highlight_group2: - db 10h - db 1Fh, 3Fh, 0, 0 - db '*|..',0 -highlight_group3: - db 10h - db 0, 0, 0, 0 - db '..',0 -highlight_group4: - db 0 - db 1Ah, 3Ah, 0, 0 - db '*.exe,*.com,*.bat,*.cmd,*.kex',0 -highlight_group5: - db 0 - db 1Ah, 3Ah, 0, 0 - db '*|*.*,readme,makefile',0 -highlight_group6: - db 0 - db 1Dh, 3Dh, 0, 0 - db '*.rar,*.zip,*.[zj],*.[bg7]z,*.[bg]zip,*.tar,*.t[ag]z,*.ar[cj],*.r[0-9][0-9],' - db '*.a[0-9][0-9],*.bz2,*.cab,*.msi,*.jar,*.lha,*.lzh,*.ha,*.ac[bei],*.pa[ck],' - db '*.rk,*.cpio,*.rpm,*.zoo,*.hqx,*.sit,*.ice,*.uc2,*.ain,*.imp,*.777,*.ufa,*.boa,' - db '*.bs[2a],*.sea,*.hpk,*.ddi,*.x2,*.rkv,*.[lw]sz,*.h[ay]p,*.lim,*.sqz,*.chz',0 -highlight_group7: - db 0 - db 16h, 36h, 0, 0 - db '*.bak,*.tmp',0 -highlight_group8: - db 0 - db 17h, 37h, 0, 0 - db '*.asm,*.inc',0 -highlight_group9: - db 10h - db 1Fh, 3Fh, 0, 0 - db '*',0 - -bConfirmDelete db 1 -bConfirmDeleteIncomplete db 0 - -FolderShortcuts dd 0,0,0,0,0,0,0,0,0,0 - -; 稢 䨣樮 - -bWasE0 db 0 -ctrlstate db 0 -mousestate db 0 -align 4 -MemForImage dd 0 -restore_semicolon dd 0 -bForHex db 0 - -align 4 -; 饭 뤥 -nomem_dlgdata: - dd 2 - dd -1 - dd -1 - dd 12 - dd 2 - dd 1 - dd 1 - dd aError - rb 8 - dd 0 - dd 0 - dd 2 -; ப "No memory" - DlgLbl ,1,0,10,0,aNoMemory,1 -; "Ok" - DlgBtn ,4,1,7,1,aOk,0xD - -; ஢ -copy_dlgdata: - dd 1 -.x dd -1 -.y dd -1 -.width dd ? -.height dd 4 - dd 4 - dd 2 - dd aCopyCaption -.main_color db ? -.border_color db ? -.header_color db ? - db 0 - dd ? - dd 0 - dd 0 - dd 4 -; ப '஢ "%s" :' -.lcopy DlgLbl ,1,0,,0,CopySourceTextBuf,0 -; ।஢ 䠩/ 祭 -.ename DlgEdit ,1,1,,1,CopyDestEditBuf,0 -; "஢" -.copy DlgBtn ,,3,,3,aCopy,18h -; "⬥" -.cnl DlgBtn ,,3,,3,aCancelB,8 - -struct MkDir_Dlgdata - dd 1 - dd -1, -1 -width dd ? -height dd 4 - dd 4, 2 - dd aMkDirCaption - dd ?, ? - dd 0 - dd 0 - dd 4 -; ப " " - DlgLbl ,1,0,aMkDirLen,0,aMkDir,0 -; ।஢ ᮧ -dnam DlgEdit ,1,1,,1,CopyDestEditBuf,0xC -; "த" -cont DlgBtn ,,3,,3,a_Continue,18h -; "⬥" -cnl DlgBtn ,,3,,3,aCancelB,8 -ends - -mkdir_dlgdata MkDir_Dlgdata - -; 뤥/ -mark_dlgdata: - dd 1 - dd -1, -1 - dd 37, 1 - dd 4, 2 -.title dd ? - dd ?, ? - dd 0, 0 - dd 1 -; ।஢ -.edit DlgEdit ,1, 0, 35, 0, enter_string_buf, - -; ண ᪠ (Alt+㪢) -QuickSearchDlg: - dd 5 -.x dd ? -.y dd ? - dd 20, 1 - dd 1, 1 - dd aSearch - dd ?, ? - dd 0, 0 - dd 1 -; ।஢ - DlgEdit ,1, 0, 18, 0, quick_search_buf, 1Ch - -; ᪠ 䠩 ᬮ騪 । -struct FindInFileDlgdata - dd 1 -x dd -1 -y dd -1 -width dd ? -height dd 7 - dd 4, 2 - dd aSearch - dd ?, ? - dd 0, 0 - dd 8 -; ப "᪠" - DlgLbl ,1,0,aSearchForLen,0,aSearchFor,0 -; ।஢ ⥪⮬ ᪠ -efind DlgEdit ,1,1,,1,SearchStringEditBuf,0xC -; ਧ⠫ ࠧ⥫ - DlgLine ,-1,2,-1,2 -; 䫠 "뢠 ॣ" -case DlgCheck,1,3,-1,3,aCaseSensitive,18h ; default: search is case sensitive -; 䫠 "쪮 楫 ᫮" -whole DlgCheck,1,4,-1,4,aWholeWords,8 ; default: do NOT search whole words only -; ਧ⠫ ࠧ⥫ - DlgLine ,-1,5,-1,5 -; "᪠" -search DlgBtn ,,6,,6,aSearchB,18h -; "⬥" -cnl DlgBtn ,,6,,6,aCancelB,8 -ends - -find_in_file_dlgdata FindInFileDlgdata - -; ᪠ 䠩 () -struct FileSearch_QueryTemplate - dd 1 -x dd ? -y dd ? -width dd ? -height dd 9 - dd 4, 2 - dd aFileSearch - dd ? - dd 0 - dd 0, 0 - dd 10 -; ப-ਣ襭 ᪨ - DlgLbl ,1,0,aFileMasksLen,0,aFileMasks,0 -; ᪨ -edit1 DlgEdit ,1,1,,1,,0xC -; ப-ਣ襭 ⥪ ᪠ - DlgLbl ,1,2,aContainingTextLen,2,aContainingText,0 -; ⥪ ᪠ -edit2 DlgEdit ,1,3,,3,,8 -; ਧ⠫ ࠧ⥫ - DlgLine ,-1,4,-1,4 -; 䫠 "뢠 ॣ" -case DlgCheck,1,5,-1,5,aCaseSensitive, ; will be initialized from find_in_file_dlgdata -; 䫠 "쪮 楫 ᫮" -whole DlgCheck,1,6,-1,6,aWholeWords, ; will be initialized from find_in_file_dlgdata -; ਧ⠫ ࠧ⥫ - DlgLine ,-1,7,-1,7 -; "᪠" -search DlgBtn ,,8,,8,aSearchB,18h -; "⬥" -cnl DlgBtn ,,8,,8,aCancelB,8 -ends - -filesearch_query_template FileSearch_QueryTemplate - -; ன ᪠ 䠩 (᪠஢) -struct FileSearch_SearchTemplate - dd 1 -x dd ? -y dd ? -width dd ? -height dd ? - dd 4, 2 -caption dd ? - dd ? - dd 0 - dd 0, 0 - dd 9 -; ᯨ᮪ 䠩 -list1 DlgList ,0,0,,,,0 -; ਧ⠫ ࠧ⥫ -lin1 DlgLine ,-1,,-1, -; ப " :" " 祭..." -lbl1 DlgLbl ,1 -; ப ⥪饩 -lbl2 DlgLbl -; ਧ⠫ ࠧ⥫ -lin2 DlgLine ,-1,,-1, -; -btn1 DlgBtn ,,,,,aNewSearch,8 -btn2 DlgBtn ,,,,,aGoto,1Ch -btn3 DlgBtn ,,,,,aView,8 -btn4 DlgBtn ,,,,,aCancelB2,8 -ends - -filesearch_search_template FileSearch_SearchTemplate - -RetryOrCancelBtn: - dd aRetry - dd a_Cancel -DeleteOrKeepBtn: - dd a_Delete - dd aKeep -RetryOrIgnoreBtn: - dd aRetry - dd aIgnore -DeleteOrCancelBtn: - dd a_Delete - dd a_Cancel -DeleteErrorBtn: - dd aRetry -SkipOrCancelBtn: - dd aSkip - dd aSkipAll - dd a_Cancel -ContinueBtn: - dd aContinue -EditorExitBtn: - dd aSave - dd aDontSave - dd aContinueEdit -YesOrNoBtn: - dd aYes - dd aNo - -aCannotOpenFile_ptr dd aCannotOpenFile -aCannotCreateThread_ptr dd aCannotCreateThread -ConfirmCancelMsg dd aConfirmCancel -EditConfigErr_ptr: - dd aEditConfigErr1 - dd aEditConfigErr2 -if lang eq ru_RU -aDeleteCaption db '',0 -aConfirmDeleteText db ' 㤠',0 -aDeleteFolder db ' ',0 -aConfirmDeleteTextMax = $ - aConfirmDeleteText - 2 -aDeleteFile db ' 䠩',0 -aCancelB db '[ ⬥ ]',0 -aCancelBLength = $ - aCancelB - 1 -aCancelB2 db '[ ⬥ ]',0 -aCancelB2Length = $ - aCancelB2 - 1 -aCopyCaption db '஢',0 -aCopy db '[ ஢ ]',0 -aCopyLength = $ - aCopy - 1 -a_Continue db '[ த ]',0 -a_ContinueLength = $ - a_Continue - 1 -aCopy1 db '஢ ',0 -aCopy2 db ' :',0 -aError db '訡',0 -aContinue db 'த',0 -aRetry db '',0 -a_Cancel db '⬥',0 -a_Delete db '',0 -aSkip db 'ய',0 -aSkipAll db 'ய ',0 -aYes db '',0 -aNo db '',0 -error0msg db '࠭... 訡',0 -error1msg db '࠭... । / ࠧ ⪮ ᪠',0 -error2msg db '㭪 ন 䠩 ⥬',0 -error3msg db '⭠ 䠩 ⥬',0 -error4msg db '࠭... 訡 4',0 -error5msg db ' ',0 -error6msg db ' 稫',0 -error7msg db '࠭... ⥫ ਫ',0 -error8msg db ' ',0 -error9msg db ' ࠧ襭',0 -error10msg db ' ',0 -error11msg db '訡 ன⢠',0 -error30msg db '筮 ',0 -error31msg db '  ᯮ塞',0 -error32msg db '誮 ᮢ',0 -aUnknownError db ' 訡: ',0 -aCannotReadFolder db ' ',0 -aRunError db '訡 ᪥ ணࠬ:',0 -aFileNameTooBig db ' 䠩 ᫨誮 ',0 -aFolderNameTooBig db ' ᫨誮 ',0 -aCmdLineTooBig db ' ப ॢ蠥 ࠭ OS 256 ᨬ',0 -aCannotCopyToSelf db ' ᪮஢ ᠬ ᥡ',0 -aCannotReadFile db ' 䠩',0 -aIncompleteFile db ' 祭 䠩. ?',0 -aKeep db '⠢',0 -aCannotWriteFile db ' 䠩',0 -aCannotDeleteFile db ' 㤠 䠩',0 -aCannotDeleteFolder db ' 㤠 ',0 -aNotFolder db '  ',0 -aIgnore db '஢',0 -aMkDirCaption db ' ',0 -aMkDir db ' ',0 -aMkDirLen = $ - aMkDir - 1 -aCannotMakeFolder db ' ᮧ ',0 -aName db 3,'' -aSize db 6,'' -aDate db 4,'' -aTime db 5,'६' -aCannotLoadDLL db ' 㧨 DLL',0 -aCannotLoadPlugin db ' 㧨 ',0 -aInvalidDLL db ' ଠ',0 -aMissingExport db '室 㭪 ',0 -aInitFailed db '訡 樠樨',0 -aIncompatibleVersion db 'ᮢ⨬ ',0 -aTables db '',0 -aSelect db '',0 -aDeselect db '',0 -aCannotOpenFile db '訡 ⨨ 䠩',0 -aCannotCreateThread db '訡 ᮧ ⮪',0 -aCannotSetFolder db ' ',0 -aSearch db '',0 -aSearchB db '[ ᪠ ]',0 -aSearchBLength = $ - aSearchB - 1 -aSearchFor db '᪠',0 -aSearchForLen = $ - aSearchFor - 1 -aCaseSensitive db '뢠 ॣ',0 -aWholeWords db '쪮 楫 ᫮',0 -aReverseSearch db ' ',0 -aStringNotFound db 'ப ',0 -aFileSearch db ' 䠩',0 -aFileMasks db ' ᪮쪮 ᮪ 䠩:',0 -aFileMasksLen = $ - aFileMasks - 1 -aContainingText db 'ঠ ⥪:',0 -aContainingTextLen = $ - aContainingText - 1 -aSearchingIn db ' "" :',0 -aSearchingInLen = $ - aSearchingIn - 1 -aSearchDone db ' 祭. ? 䠩()',0 -aSearchDoneLen = $ - aSearchDone - 1 -aNewSearch db '[ ]',0 -aNewSearchLen = $ - aNewSearch - 1 -aGoto db '[ ३ ]',0 -aGotoLen = $ - aGoto - 1 -aView db '[ ]',0 -aViewLen = $ - aView - 1 -aEditConfigErr1 db '訡 䨣樨 ।.',0 -aEditConfigErr2 db '஡ 譨 .',0 -aEditNoMemory db ' ᫨誮 㧪 ।.',0 -aLine db ' ப' -aCol db ' ' -aEditorTitle db '',0 -aFileModified db ' ',0 -aSave db '࠭',0 -aDontSave db ' ࠭',0 -aContinueEdit db 'த ।஢',0 -aCannotSaveToPlugin db '࠭ 䠩 ন',0 -aCannotSearchOnPlugin db ' ন',0 -aCancelled db '⢨ 뫮 ࢠ',0 -aConfirmCancel db ' ⢨⥫쭮 ⬥ ⢨?',0 -else -aDeleteCaption db 'Delete',0 -aConfirmDeleteText db 'Do you wish to delete',0 -aDeleteFolder db ' the folder',0 -aConfirmDeleteTextMax = $ - aConfirmDeleteText - 2 -aDeleteFile db ' the file',0 -aDelete db ' Delete ',0 -aDeleteLength = $ - aDelete - 1 -aCancel db ' Cancel ',0 -aCancelLength = $ - aCancel - 1 -aCancelB db '[ Cancel ]',0 -aCancelBLength = $ - aCancelB - 1 -aCancelB2 = aCancelB -aCancelB2Length = $ - aCancelB2 - 1 -aCopyCaption db 'Copy',0 -aCopy db '[ Copy ]',0 -aCopyLength = $ - aCopy - 1 -a_Continue db '[ Continue ]',0 -a_ContinueLength = $ - a_Continue - 1 -aCopy1 db 'Copy "',0 -aCopy2 db '" to:',0 -aError db 'Error',0 -aContinue db 'Continue',0 -aRetry db 'Retry',0 -a_Cancel db 'Cancel',0 -a_Delete db 'Delete',0 -aSkip db 'Skip',0 -aSkipAll db 'Skip all',0 -aYes db 'Yes',0 -aNo db 'No',0 -error0msg db 'Strange... No error',0 -error1msg db 'Strange... Hard disk base and/or partition not defined',0 -error2msg db 'The file system does not support this function',0 -error3msg db 'Unknown file system',0 -error4msg db 'Strange... Error 4',0 -error5msg db 'File not found',0 -error6msg db 'End of file',0 -error7msg db 'Strange... Pointer lies outside of application memory',0 -error8msg db 'Disk is full',0 -error9msg db 'File structure is destroyed',0 -error10msg db 'Access denied',0 -error11msg db 'Device error',0 -error30msg db 'Not enough memory',0 -error31msg db 'File is not executable',0 -error32msg db 'Too many processes',0 -aUnknownError db 'Unknown error code: ',0 -aCannotReadFolder db 'Cannot read folder',0 -aRunError db 'Cannot execute program:',0 -aFileNameTooBig db 'Full file name is too long',0 -aFolderNameTooBig db 'Full folder name is too long',0 -aCmdLineTooBig db 'Command line is too long (OS limit is 256 symbols)',0 -aCannotCopyToSelf db 'File cannot be copied onto itself',0 -aCannotReadFile db 'Cannot read file',0 -aIncompleteFile db 'Incomplete file was retrieved. Delete it?',0 -aKeep db 'Keep',0 -aCannotWriteFile db 'Cannot write to the file',0 -aCannotDeleteFile db 'Cannot delete the file',0 -aCannotDeleteFolder db 'Cannot delete the folder',0 -aNotFolder db 'is not a folder',0 -aIgnore db 'Ignore',0 -aMkDirCaption db 'Make folder',0 -aMkDir db 'Create the folder',0 -aMkDirLen = $ - aMkDir - 1 -aCannotMakeFolder db 'Cannot create folder',0 -aName db 4,'Name' -aSize db 4,'Size' -aDate db 4,'Date' -aTime db 4,'Time' -aCannotLoadDLL db 'Cannot load DLL',0 -aCannotLoadPlugin db 'Cannot load plugin',0 -aInvalidDLL db 'File is not found or invalid',0 -aMissingExport db 'Required function is not present',0 -aInitFailed db 'Initialization failed',0 -aIncompatibleVersion db 'Incompatible version',0 -aTables db 'Tables',0 -aSelect db 'Select',0 -aDeselect db 'Deselect',0 -aCannotOpenFile db 'Cannot open the file',0 -aCannotCreateThread db 'Cannot create a thread',0 -aCannotSetFolder db 'Cannot enter to the folder',0 -aSearch db 'Search',0 -aSearchB db '[ Search ]',0 -aSearchBLength = $ - aSearchB - 1 -aSearchFor db 'Search for',0 -aSearchForLen = $ - aSearch - 1 -aCaseSensitive db 'Case sensitive',0 -aWholeWords db 'Whole words',0 -aReverseSearch db 'Reverse search',0 -aStringNotFound db 'Could not find the string',0 -aFileSearch db 'Find file',0 -aFileMasks db 'A file mask or several file masks:',0 -aFileMasksLen = $ - aFileMasks - 1 -aContainingText db 'Containing text:',0 -aContainingTextLen = $ - aContainingText - 1 -aSearchingIn db 'Searching "" in:',0 -aSearchingInLen = $ - aSearchingIn - 1 -aSearchDone db 'Search done. Found ? file(s)',0 -aSearchDoneLen = $ - aSearchDone - 1 -aNewSearch db '[ New search ]',0 -aNewSearchLen = $ - aNewSearch - 1 -aGoto db '[ Go to ]',0 -aGotoLen = $ - aGoto - 1 -aView db '[ View ]',0 -aViewLen = $ - aView - 1 -aEditConfigErr1 db 'Error in configuration of plugins for the editor.',0 -aEditConfigErr2 db 'Try to remove unnecessary plugins.',0 -aEditNoMemory db 'The file is too big for the editor.',0 -aLine db ' Line' -aCol db ' Col ' -aEditorTitle db 'Editor',0 -aFileModified db 'File has been modified',0 -aSave db 'Save',0 -aDontSave db 'Do not save',0 -aContinueEdit db 'Continue editing',0 -aCannotSaveToPlugin db 'Saving is not supported for plugin panels',0 -aCannotSearchOnPlugin db 'The search on plugin panels is not supported yet',0 -aCancelled db 'Operation has been interrupted',0 -aConfirmCancel db 'Do you really want to cancel it?',0 -end if - -aOk db 'OK',0 -aNoMemory db 'No memory!' -nullstr db 0 -aUntitled db 'untitled',0 -aDotDot db '..',0,0 -standard_dll_path: -libini_name db '/sys/lib/' -standard_dll_path_size = $ - standard_dll_path - db 'libini.obj',0 -aStart db 'START',0 -aLibInit db 'lib_init',0 -aVersion db 'version',0 -aIniGetInt db 'ini_get_int',0 -aIniGetStr db 'ini_get_str',0 -aIniSetInt db 'ini_set_int',0 -aIniEnumKeys db 'ini_enum_keys',0 -aPluginLoad db 'plugin_load',0 -aPluginUnload db 'plugin_unload',0 -aGetattr db 'getattr',0 -aOpen db 'open',0 -aRead db 'read',0 -aSetpos db 'setpos',0 -aClose db 'close',0 -aOpenFilePlugin db 'OpenFilePlugin',0 -aClosePlugin db 'ClosePlugin',0 -aReadFolder db 'ReadFolder',0 -aSetFolder db 'SetFolder',0 -aGetOpenPluginInfo db 'GetOpenPluginInfo',0 -aGetPanelTitle db 'GetPanelTitle',0 -aGetFiles db 'GetFiles',0 -aEditInfoSize db 'EditInfoSize',0 - -aConfirmations db 'Confirmations',0 -aConfirmDelete db 'Delete',0 -aConfirmDeleteIncomplete db 'DeleteIncomplete',0 - -aPanels db 'Panels',0 -aLeftViewMode db 'LeftViewMode',0 -aRightViewMode db 'RightViewMode',0 -aLeftSortMode db 'LeftSortMode',0 -aRightSortMode db 'RightSortMode',0 - -aEditor db 'Editor',0 -aEolStyle db 'EOLStyle',0 - -aAssociations db 'Associations',0 -aPlugins db 'Plugins',0 -aMenu db 'Menu',0 -aFolderShortcuts db 'FolderShortcuts',0 -aShortcut db 'Shortcut' -.d db '0',0 - -align 4 -ini_import: -ini.get_int dd aIniGetInt -ini.get_str dd aIniGetStr -ini.enum_keys dd aIniEnumKeys -ini.set_int dd aIniSetInt - dd 0 - -plugin_exported: - dd aPluginUnload - dd aGetattr - dd aOpen - dd aRead - dd aSetpos - dd aClose - dd aOpenFilePlugin - dd aClosePlugin - dd aReadFolder - dd aSetFolder - dd aGetOpenPluginInfo - dd aGetPanelTitle - dd aGetFiles - dd aEditInfoSize - dd 0 -plugin_exported_default: - dd plugin_unload_default - dd getattr_default - dd open_default - dd read - dd setpos_default - dd close - dd OpenFilePlugin_default - dd ClosePlugin_default - dd ReadFolder_default - dd SetFolder_default - dd GetOpenPluginInfo_default - dd GetPanelTitle_default - dd GetFiles_default - dd 0 ; default value for EditInfoSize - -kfar_info: - dd .size - dd version_dword - dd open - dd open2 - dd read - dd -1 ; write: to be implemented - dd seek - dd tell - dd -1 ; flush: to be implemented - dd filesize - dd close - dd xpgalloc - dd xpgrealloc - dd pgfree - dd getfreemem - dd libini_alloc - dd libini_realloc - dd libini_free - dd menu - dd menu_centered_in - dd DialogBox - dd SayErr - dd Message - dd cur_width -.size = $ - kfar_info - -plugins dd 0 -num_plugins dd 0 -alloc_plugins dd 0 - -EditPlugInfo dd 0 -EditEOLStyle db edit.eol_unix - -virtual at 0 -PluginInfo: -.unload dd ? -.getattr dd ? -.open dd ? -.read dd ? -.setpos dd ? -.close dd ? -.OpenFilePlugin dd ? -.ClosePlugin dd ? -.ReadFolder dd ? -.SetFolder dd ? -.GetOpenPluginInfo dd ? -.GetPanelTitle dd ? -.GetFiles dd ? -.EditInfoSize dd ? -.EditInfoOffs dd ? -.size = $ -end virtual - -virtual at 0 -PanelMode: -; up to 16 columns on one panel -.NumColumns dd ? -; available column types: -COLUMN_TYPE_NONE = 0 -COLUMN_TYPE_NAME = 1 - COLUMN_NAME_MARK = 10h ; (reserved) - COLUMN_NAME_NOPATH = 20h ; (reserved) - COLUMN_NAME_RIGHTALIGN = 40h ; (reserved) -COLUMN_TYPE_SIZE = 2 - COLUMN_SIZE_COMMA = 10h ; (reserved) -COLUMN_TYPE_PACKED_SIZE = 3 ; (reserved) -COLUMN_TYPE_DATE = 4 -COLUMN_TYPE_TIME = 5 -COLUMN_TYPE_DATETIME = 6 ; (reserved) -COLUMN_TYPE_DATETIME_CREATION = 7 ; (reserved) -COLUMN_TYPE_DATETIME_ACCESS = 8 ; (reserved) -COLUMN_TYPE_ATTRIBUTES = 9 ; (reserved) -COLUMN_TYPE_DESCRIPTION = 10 ; (reserved) -COLUMN_TYPE_OWNER = 11 ; (reserved) -COLUMN_TYPE_NUMLINKS = 12 ; (reserved) -COLUMN_TYPE_CUSTOM = 13 ; (reserved) -.ColumnTypes rb 16 - -.ColumnWidths rb 16 -.bFullScreen db ? ; (reserved) -.bAlignExtensions db ? - rb 2 -.size = $ -end virtual - -align 4 -column_headers: - dd nullstr - dd aName - dd aSize - dd nullstr - dd aDate - dd aTime -draw_column_proc: - dd draw_empty_column - dd draw_name_column - dd draw_size_column - dd -1 - dd draw_date_column - dd draw_time_column -colmodes: -; ० 0 : NM,SC,D - dd 3 - db COLUMN_TYPE_NAME+COLUMN_NAME_MARK, COLUMN_TYPE_SIZE+COLUMN_SIZE_COMMA - db COLUMN_TYPE_DATE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - db 0, 10, 8 - times 13 db 0 - db 0, 1 - times 2 db 0 -; ० 1 : N,N,N - dd 3 - db COLUMN_TYPE_NAME, COLUMN_TYPE_NAME, COLUMN_TYPE_NAME - times 13 db 0 - times 16 db 0 - db 0, 1 - times 2 db 0 -; ० 2 : N,N - dd 2 - db COLUMN_TYPE_NAME, COLUMN_TYPE_NAME - times 14 db 0 - times 16 db 0 - db 0, 0 - times 2 db 0 -; ० 3 : N,S,D,T - dd 4 - db COLUMN_TYPE_NAME, COLUMN_TYPE_SIZE, COLUMN_TYPE_DATE, COLUMN_TYPE_TIME - times 12 db 0 - db 0, 6, 8, 5 - times 12 db 0 - db 0, 1 - times 2 db 0 -; ० 4 : N,S - dd 2 - db COLUMN_TYPE_NAME, COLUMN_TYPE_SIZE - times 14 db 0 - db 0, 6 - times 14 db 0 - db 0, 0 - times 2 db 0 -; ० 5 : N,S,P,DM,DC,DA,A -; ० 6 : N,Z -; ० 7 : N,S,Z -; ० 8 : N,S,O -; ० 9 : N,S,LN - -execinfo: - dd 7 - dd 0 -execparams dd 0 - dd 0 - dd 0 - db 0 -execptr dd ? - -IncludeIGlobals - -i_end: - -IncludeUGlobals - -execdata rb 1024 -execdataend: - align 4 -attrinfo.attr rb 40 - -panel1 PanelData - -panel2 PanelData - -;console_data rb max_width*max_height*2 - -nomem_dlgsavearea rb 8 + (12+4)*(3+3)*2 - -quicksearch_savearea rb 22*3*2 -quicksearch_maxlen = 64 -quick_search_buf rb 12 + quicksearch_maxlen - -cur_header rb max_width -tmp dd ? - -skinh dd ? -std_colors rd 10 - -min_y dd ? -max_y dd ? -min_x dd ? -max_x dd ? -used_width dd ? -used_height dd ? - -wnd_width dd ? -wnd_height dd ? - -column_left dd ? -column_top dd ? -column_width dd ? -column_height dd ? -column_index dd ? -last_column_index dd ? - -scrpos dq ? -viewer_right_side dq ? - -EditDataSize dd ? -EditBlockStart dd ? -EditBlockSize dd ? - -saved_file_name: -procinfo rb 1024 -lower_file_name = procinfo + 512 - -app_path rb 1100 - -error_msg rb 128 - -prev_dir rb 1024 - -driveinfo rb 32+304 -tmpname rb 32 - -screens dd ? -num_screens dd ? -active_screen_vtable dd ? -active_screen_data dd ? -active_screen_keybar dd ? - -default_attr dd ? -left_dotdot_entry rb 40+4 ; 40 bytes for attributes + '..' -right_dotdot_entry rb 40+4 - -aConfirmDeleteTextBuf rb aConfirmDeleteTextMax + 1 -CopySourceTextBuf rb 512 -CopyDestEditBuf rb 12+512+1 -.length = $ - CopyDestEditBuf - 13 - -SearchStringEditBuf rb 12 -SearchString rb 253+1 -SearchStringEditBuf.length = $ - SearchString - 1 - db ? ; used for output (string -> "string") - -enter_string_buf rb 12+512+1 - -bMemForImageValidData db ? - -align 4 -identical_table rb 256 -tolower_table rb 256 -isspace_table rb 256 -composite_table rb 256 -layout rb 128 - -copy_buffer_size = 65536 -copy_buffer rb copy_buffer_size - -filedata_buffer_size = 1024 -filedata_buffer rb filedata_buffer_size - -source_hModule dd ? -source_hPlugin dd ? -source_hFile dd ? -; data for directory delete -; If directory nested level is >1024, then its full name is too big, -; so we see the overflow when creating full name (we check for this!) -del_dir_stack rd 1024 -del_dir_stack_ptr dd ? -del_dir_query_size = 32 -del_dir_query_area rb 32+304*del_dir_query_size - -label copy_dir_stack dword at del_dir_stack -label copy_dir_stack_ptr dword at del_dir_stack_ptr -copy_dir_query_size = del_dir_query_size -copy_dir_query_area = del_dir_query_area -del_bSkipAll db ? ; for directory errors -label copy_bSkipAll byte at del_bSkipAll -copy_bSkipAll2 db ? ; for file read/write errors -copy_bSkipAll3 db ? ; for SetFolder errors - -bEndSlash db ? -bDestIsFolder db ? -bNeedRestoreName db ? - -; stack - align 4 - rb 32768 -stacktop: - -mem: +use32 + db 'MENUET01' + dd 1 + dd start + dd i_end +memsize dd mem + dd stacktop + dd 0, app_path + +version equ '0.65' +version_dword equ 0*10000h + 65 + +min_width = 54 +max_width = 255 +min_height = 8 +max_height = 255 + +include '../../../KOSfuncs.inc' +include '../../../macros.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. +include 'font.inc' +include 'sort.inc' +include 'kglobals.inc' +include 'dialogs.inc' +include 'search.inc' +include 'viewer.inc' +include 'editor.inc' +include 'tools.inc' +include 'filetool.inc' + +struct PanelData +left dd ? +top dd ? +width dd ? +height dd ? +index dd ? +start dd ? +colsz dd ? +colst dd ? +sortmode db ? + rb 3 +nfa dd ? +numfiles dd ? +files dd ? +hPlugin dd ? +hFile dd ? +parents dd ? +parents_sz dd ? +parents_alloc dd ? +colmode dd ? +colwidths rd 16+1 +total_num dd ? +total_size dq ? +selected_num dd ? +selected_size dq ? +;plugin_info: +plugin_flags dd ? +dir rb 1024 +ends + +cursor_normal_size = (font_height*15+50)/100 +cursor_big_size = font_height + +align 4 +start: + mov eax,SF_SET_EVENTS_MASK + mov ebx,(11b shl 30) or 100111b + int 0x40 + mov edi, identical_table + mov ecx, 0x100 + xor eax, eax +@@: + stosb + inc eax + loop @b + mov cl, 'A' +@@: + stosb + inc eax + loop @b + add al, 0x20 + mov cl, 'Z'-'A'+1 +@@: + stosb + inc eax + loop @b + sub al, 0x20 + mov cl, ''-'Z'-1 +@@: + stosb + inc eax + loop @b + add al, 0x20 + mov cl, ''-'' +@@: + stosb + inc eax + loop @b + add al, 0x30 + mov cl, ''-''+1 +@@: + stosb + inc eax + loop @b + sub al, 0x50 + mov cl, 256-''-1 +@@: + stosb + inc eax + loop @b + mov byte [edi-256+''], '' + mov cl, 'A' + inc eax + rep stosb + mov cl, 'Z'-'A'+1 + dec eax + rep stosb + mov cl, 'a'-'Z'-1 + inc eax + rep stosb + mov byte [edi-'a'+'_'], 0 + mov cl, 'z'-'a'+1 + dec eax + rep stosb + mov cl, ''-'z'-1 + inc eax + rep stosb + mov cl, ''-''+1 + dec eax + rep stosb + mov cl, ''-''-1 + inc eax + rep stosb + mov cl, ''-''+1 + dec eax + rep stosb + mov cl, 256-''-1 + inc eax + rep stosb + mov edi, SearchStringEditBuf + mov eax, SearchStringEditBuf.length + stosd + xor eax, eax + stosd + stosd + stosb + push SF_SYS_MISC + pop eax + push SSF_HEAP_INIT + pop ebx + int 0x40 + call init_console + call draw_window + push SF_KEYBOARD + pop eax + push SSF_SET_INPUT_MODE + pop ebx + mov ecx, ebx + int 40h ; set keyboard mode to scancodes + mov eax, 200 + mov [panel1.nfa], eax + mov [panel2.nfa], eax + mov ecx, 200*4 + 32 + 200*304 + call pgalloc + mov [panel1.files], eax + call pgalloc + mov [panel2.files], eax + test eax, eax + jz exit + xor eax, eax + cmp [panel1.files], eax + jz exit + mov [panel1.hPlugin], eax + mov [panel1.parents], eax + mov [panel1.parents_sz], eax + mov [panel1.parents_alloc], eax + mov [panel2.hPlugin], eax + mov [panel2.parents], eax + mov [panel2.parents_sz], eax + mov [panel2.parents_alloc], eax + mov [panel1.sortmode], al ; sort by name + mov [panel2.sortmode], al + mov al, 2 ; "।" ଠ + mov [panel1.colmode], eax + mov [panel2.colmode], eax + mov [num_screens], 1 + mov ecx, 0x1000 + call pgalloc + mov [screens], eax + test eax, eax + jz exit + mov ecx, panels_vtable + mov [eax], ecx + mov [active_screen_vtable], ecx + mov [active_screen_keybar], keybar_panels +; load libini.obj and kfar.ini + mov eax, libini_name + mov esi, ini_import + push 8 + pop ebp ; we use version 8 of libini + call load_dll_and_import + test eax, eax + jnz .noini + mov edi, app_path + or ecx, -1 + repnz scasb + mov dword [edi-1], '.ini' + mov byte [edi+3], 0 + push 1 + push dword aConfirmDelete + push dword aConfirmations + push dword app_path + call [ini.get_int] + mov [bConfirmDelete], al + push 0 + push dword aConfirmDeleteIncomplete + push dword aConfirmations + push dword app_path + call [ini.get_int] + mov [bConfirmDeleteIncomplete], al + push 2 + push aLeftViewMode + push aPanels + push app_path + call [ini.get_int] + cmp eax, 1 + jb @f + cmp eax, 4 + ja @f + mov [panel1.colmode], eax +@@: + push 2 + push aRightViewMode + push aPanels + push app_path + call [ini.get_int] + cmp eax, 1 + jb @f + cmp eax, 4 + ja @f + mov [panel2.colmode], eax +@@: + push 0 + push aLeftSortMode + push aPanels + push app_path + call [ini.get_int] + cmp eax, 14 + jae @f + mov [panel1.sortmode], al +@@: + push 0 + push aRightSortMode + push aPanels + push app_path + call [ini.get_int] + cmp eax, 14 + jae @f + mov [panel2.sortmode], al +@@: + push nullstr + push 512 + push saved_file_name + push aEolStyle + push aEditor + push app_path + call [ini.get_str] + mov cl, edit.eol_dos + mov al, [saved_file_name] + or al, 20h + cmp al, 'd' + jz @f + mov cl, edit.eol_mac + cmp al, 'm' + jz @f + mov cl, edit.eol_unix +@@: + mov [EditEOLStyle], cl + mov ecx, 0x1000 + call xpgalloc + test eax, eax + jz .skip_assoc + mov [associations], eax + push enum_associations_callback + push aAssociations + push app_path + call [ini.enum_keys] +.skip_assoc: + xor ebp, ebp + xor esi, esi +.shortcut_loop: + mov edi, saved_file_name + push dword nullstr + push 512 + push edi + push dword aShortcut + push dword aFolderShortcuts + push dword app_path + call [ini.get_str] + cmp byte [edi], 0 + jz .shortcut_cont + or ecx, -1 + xor eax, eax + repnz scasb + not ecx + cmp ecx, 2 + jz @f + cmp byte [edi-2], '/' + jnz @f + mov byte [edi-2], 0 + dec ecx +@@: + mov al, [aShortcut.d] + push esi + inc esi + mov [FolderShortcuts+(eax-'0')*4], esi + lea esi, [esi+ecx-1] + push esi + and esi, 0xFFF + cmp esi, ecx + pop esi + ja .norealloc + mov edx, ebp + mov ecx, esi + call xpgrealloc + test eax, eax + jnz @f + pop esi + mov edi, FolderShortcuts + mov ecx, 10 + rep stosd + jmp .skip_shortcuts +@@: + mov ebp, eax +.norealloc: + pop edi + add edi, ebp + mov ecx, saved_file_name +@@: + mov al, [ecx] + inc ecx + stosb + test al, al + jnz @b +.shortcut_cont: + inc [aShortcut.d] + cmp [aShortcut.d], '9' + jbe .shortcut_loop + mov esi, FolderShortcuts + mov ecx, 10 + dec ebp +.l3: + lodsd + test eax, eax + jz @f + add [esi-4], ebp +@@: + loop .l3 +.skip_shortcuts: +; load plugins + push enum_plugins_callback + push aPlugins + push app_path + call [ini.enum_keys] +; calculate info for editor + xor ebx, ebx + mov ecx, [num_plugins] + mov esi, [plugins] +@@: + dec ecx + js @f + mov [esi+PluginInfo.EditInfoOffs], ebx + add ebx, [esi+PluginInfo.EditInfoSize] + jnc @f + sbb ebx, ebx +@@: +; ᪮ ࠧ । ࠭祭, ࠧ , १ࢨ㥬 , ࠭祭 +; 512 - 㡠 業, ࠭ ࠡ ।, ॠ쭮 ॡ + cmp ebx, 512 + jb @f + or ebx, -1 + mov [EditPlugInfo], ebx ; disable plugins for editor + push ContinueBtn + push 1 + push EditConfigErr_ptr + push 2 + call SayErr +@@: + add ebx, 3 + and ebx, not 3 + mov [EditPlugInfo], ebx +.noini: + mov eax, [EditPlugInfo] + add eax, editor_line.plugdata + imul eax, max_height + add eax, editor_data.basesize + 0xFFF + shr eax, 12 + mov [EditDataSize], eax + mov esi, def_left_dir + mov edi, panel1.dir +@@: + lodsb + stosb + test al, al + jnz @b + mov esi, def_right_dir + mov edi, panel2.dir +@@: + lodsb + stosb + test al, al + jnz @b + call draw_keybar + call draw_cmdbar + mov [prev_dir], 0 + mov ebp, panel1 + call calc_colwidths + call read_folder + call draw_panel + mov [bSilentFolderMode], 1 + mov ebp, panel2 + call calc_colwidths + call read_folder + call draw_panel +event: + call get_event + dec eax + jz redraw + dec eax + jz key + sub eax,4 + jz mouse +; button - we have only one button, close +exit: +; close all screens +@@: + mov ecx, [num_screens] + mov eax, [screens] + mov ebp, [eax+ecx*8-4] + mov eax, [eax+ecx*8-8] + push ebp + call [eax+screen_vtable.OnExit] + pop ecx + call pgfree + dec [num_screens] + jnz @b +; unload all plugins + mov ecx, [num_plugins] + imul esi, ecx, PluginInfo.size + add esi, [plugins] +.unload: + dec ecx + js .unload_done + sub esi, PluginInfo.size + push ecx esi + call [esi+PluginInfo.unload] + pop esi ecx + jmp .unload +.unload_done: + cmp [ini.set_int], aIniSetInt + jz .nosave + push [panel1.colmode] + push aLeftViewMode + push aPanels + push app_path + call [ini.set_int] + push [panel2.colmode] + push aRightViewMode + push aPanels + push app_path + call [ini.set_int] + movzx eax, [panel1.sortmode] + push eax + push aLeftSortMode + push aPanels + push app_path + call [ini.set_int] + movzx eax, [panel2.sortmode] + push eax + push aRightSortMode + push aPanels + push app_path + call [ini.set_int] +.nosave: +if CHECK_FOR_LEAKS + mov ecx, [panel1.files] + call pgfree + mov ecx, [panel2.files] + call pgfree + mov ecx, [screens] + call pgfree + mov ecx, [associations] + call pgfree + mov ecx, [console_data_ptr] + call pgfree + mov ecx, [MemForImage] + call pgfree + mov esi, FolderShortcuts + push 10 + pop ecx +@@: + lodsd + test eax, eax + jnz @f + loop @b + jmp .nofreefs +@@: + mov ecx, eax + call pgfree + mov ecx, [plugins] + call pgfree + mov ecx, [panel1.parents] + call pgfree + mov ecx, [panel2.parents] + call pgfree +.nofreefs: + mov eax, [numallocatedregions] + test eax, eax + jz @f + mov edi, allocatedregions + int3 + jmp $ +@@: +end if + or eax, SF_TERMINATE_PROCESS + int 40h + +align 16 +get_event: + push ebx + mov ebx, [idle_interval] + cmp ebx, -1 + jz .infinite + push SF_WAIT_EVENT_TIMEOUT + pop eax + int 40h + pop ebx + test eax, eax + jnz .ret + mov ebp, [active_screen_data] + mov eax, [active_screen_vtable] + mov eax, [eax+screen_vtable.OnIdle] + test eax, eax + jz get_event + call eax + jmp get_event +.infinite: + pop ebx + push SF_WAIT_EVENT + pop eax + int 40h +.ret: + ret + +redraw: +; query kbd state from OS + mov al, SF_KEYBOARD + push SSF_GET_CONTROL_KEYS + pop ebx + int 0x40 + and eax, 0x3F + cmp al, [ctrlstate] + mov [ctrlstate], al + jz @f + call draw_keybar +@@: + mov al, SF_THREAD_INFO + mov ebx, procinfo + or ecx, -1 + int 40h +; test if rolled up +; height of rolled up window is [skinh]+3 + mov eax, [ebx+46] + sub eax, [skinh] + cmp eax, 5 + ja @f + mov al, SF_REDRAW + push SSF_BEGIN_DRAW + pop ebx + int 0x40 + xor eax, eax +; ebx, ecx, edi are ignored by function 0 after first redraw + mov edx, 0x53000000 + int 0x40 + mov al, SF_REDRAW + inc ebx + int 0x40 + jmp event +@@: + xor ecx, ecx + mov eax, [ebx+42] + mov [wnd_width], eax + sub eax, 5*2-1 + jae @f + xor eax, eax +@@: + cdq + mov esi, font_width + div esi + cmp eax, min_width + jae @f + mov al, min_width + mov ch, 1 +@@: + cmp eax, max_width + jbe @f + mov eax, max_width + mov ch, 1 +@@: + cmp eax, [cur_width] + mov [cur_width], eax + setnz cl + or cl, ch + test edx, edx + mov [fill_width], edx + setnz ch + mov eax, [ebx+46] + mov [wnd_height], eax + sub eax, [skinh] + sub eax, 5-1 + jns @f + xor eax, eax +@@: + cdq + mov esi, font_height + div esi + cmp eax, min_height + jae @f + mov al, min_height + mov cl, 1 +@@: + cmp eax, max_height + jbe @f + mov eax, max_height + mov cl, 1 +@@: + mov [fill_height], edx + cmp eax, [cur_height] + mov [cur_height], eax + jnz .resize + test cl, cl + jnz .resize + test edx, edx + setnz cl + or cl, ch + jz @f + test byte [ebx+70], 1 + jnz @f +.resize: + push SF_CHANGE_WINDOW + pop eax + or ebx, -1 + or ecx, -1 + mov edx, [cur_width] + imul edx, font_width + add edx, 5*2-1 + mov esi, [cur_height] + imul esi, font_height + add esi, [skinh] + add esi, 5-1 + int 40h +.resize_draw: + mov ecx, [MemForImage] + call pgfree + and [MemForImage], 0 + call init_console +; call draw_window + call draw_keybar + mov ebp, [active_screen_data] + mov eax, [active_screen_vtable] + mov [cursor_size], cursor_normal_size + call dword [eax+screen_vtable.OnRedraw] + jmp event +@@: + call draw_window + jmp event +alt_f9: + cmp [saved_width], -1 + jz @f + mov eax, [saved_width] + mov [cur_width], eax + or [saved_width], -1 + mov eax, [saved_height] + mov [cur_height], eax + or [saved_height], -1 + jmp redraw.resize +@@: + push SF_STYLE_SETTINGS + pop eax + push SSF_GET_SCREEN_AREA + pop ebx + int 0x40 + push eax + sub eax, [esp+2] + inc eax + movzx eax, ax + sub eax, 10 + xor edx, edx + mov ecx, font_width + div ecx + xchg [cur_width], eax + mov [saved_width], eax + mov eax, ebx + shr ebx, 16 + sub eax, ebx + sub eax, 5-1 + sub eax, [skinh] + xor edx, edx + mov ecx, font_height + div ecx + xchg [cur_height], eax + mov [saved_height], eax + mov ecx, ebx + pop ebx + shr ebx, 16 + mov edx, [cur_width] + imul edx, font_width + add edx, 5*2-1 + mov esi, [cur_height] + imul esi, font_height + add esi, [skinh] + add esi, 4 + push SF_CHANGE_WINDOW + pop eax + int 0x40 + jmp redraw.resize_draw +key: + mov al, SF_GET_KEY + int 40h + test al, al + jnz event + xchg al, ah + cmp al, 0xE0 + jnz @f + mov [bWasE0], 1 + jmp event +@@: + xchg ah, [bWasE0] + mov ebp, [active_screen_data] + mov edx, [active_screen_vtable] + cmp al, 0x1D + jz .ctrl_down + cmp al, 0x9D + jz .ctrl_up + cmp al, 0x2A + jz .lshift_down + cmp al, 0xAA + jz .lshift_up + cmp al, 0x36 + jz .rshift_down + cmp al, 0xB6 + jz .rshift_up + cmp al, 0x38 + jz .alt_down + cmp al, 0xB8 + jz .alt_up + call [edx+screen_vtable.OnKey] + jmp event +.ctrl_down: + test ah, ah + jnz .rctrl_down + or [ctrlstate], 4 + jmp .keybar +.rctrl_down: + or [ctrlstate], 8 + jmp .keybar +.ctrl_up: + test ah, ah + jnz .rctrl_up + and [ctrlstate], not 4 + jmp .keybar +.rctrl_up: + and [ctrlstate], not 8 +.keybar: + call draw_keybar + call draw_image +@@: jmp event +.lshift_down: +; ignore E0 2A sequence +; e.g. arrow keys with NumLock on generate sequence E0 2A E0 xx / E0 xx+80 E0 AA +; where xx is scancode, so we can safely ignore E0 2A + test ah, ah + jnz @b + or [ctrlstate], 1 + jmp .keybar +.lshift_up: +; ignore E0 AA sequence + test ah, ah + jnz @b + and [ctrlstate], not 1 + jmp .keybar +.rshift_down: + or [ctrlstate], 2 + jmp .keybar +.rshift_up: + and [ctrlstate], not 2 + jmp .keybar +.alt_down: + test ah, ah + jnz .ralt_down + or [ctrlstate], 0x10 + jmp .keybar +.ralt_down: + or [ctrlstate], 0x20 + jmp .keybar +.alt_up: + test ah, ah + jnz .ralt_up + and [ctrlstate], not 0x10 + jmp .keybar +.ralt_up: + and [ctrlstate], not 0x20 + jmp .keybar + +align 16 +mouse: + mov eax,SF_MOUSE_GET + mov ebx,SSF_BUTTON_EXT + int 0x40 + mov byte[mousestate], 1 + bt eax,24 ;left but. double click + jc @f + mov byte[mousestate], 0 + bt eax,8 ;left but. down + jc @f + jmp event +@@: + mov eax,SF_MOUSE_GET + mov ebx,SSF_WINDOW_POSITION + int 0x40 + cmp ax, word[skinh] + jl event + sub ax, word[skinh] + xor dx, dx + mov bx, font_height + div bx + movzx edx,ax + shr eax,16 + + mov ebx, [cur_height] + dec ebx + cmp edx, ebx + je .on_panel + cmp dword[active_screen],0 + jg event ;.on_edit + cmp edx, 2 + jl .no_ch_pos + dec edx ; ࠬ + dec edx ; + sub ebx, 7-1 + cmp edx, ebx + jge .no_ch_pos + + push edx eax + mov ecx, [cur_width] +if font_width & 3 + imul ecx, font_width + shr ecx, 2 +else + imul ecx, font_width/4 +end if + xor dx, dx + sub ax, 5 ;window border + div cx + bt ax, 0 + jnc @f + add [esp+4], ebx ;᫨ 2- ⮫ +@@: + pop eax ;edx in stack + jmp @f +.no_ch_pos: + push -1 ;edx = -1 - no change position +@@: + + mov ebx, [cur_width] + imul ebx, font_width/2 + add ebx, 5 ;window border + cmp eax,ebx + jg @f + cmp [active_panel], panel1 + je .move + jmp .tab +@@: + cmp [active_panel], panel2 + je .move +.tab: + xor [active_panel], panel1 xor panel2 + call draw_cmdbar + mov ebp, [active_panel] + xor ebp, panel1 xor panel2 + call draw_panel +.move: + mov ebp, [active_panel] + pop edx + mov eax, [ebp + PanelData.numfiles] + add edx, [ebp + PanelData.start] ;᫮ ப祭 䠩 + dec eax + cmp edx, eax + jle @f + mov edx, eax +@@: + cmp edx, 0 + jl @f + mov [ebp + PanelData.index], edx + cmp byte[mousestate], 0 + je @f + call panels_OnKey.enter + jmp event +@@: + call draw_panel + jmp event +align 4 +.on_panel: + call get_keybar_ind + lea eax, [mouse_panels+4*eax] + cmp [active_screen_keybar], keybar_viewer + jne @f + add eax, mouse_viewer-mouse_panels +@@: + cmp [active_screen_keybar], keybar_editor + jne @f + add eax, mouse_editor-mouse_panels +@@: + cmp dword[eax], 0 + je event + + mov ebx, [active_screen] + mov ebp, [screens] + mov ebp, [ebp+ebx*8+4] + + cmp dword[active_screen],0 + jne @f + mov ebp, [active_panel] + mov ecx, [ebp + PanelData.index] +@@: + push dword[eax] + sub eax, mouse_panels + shr eax, 2 + xor edx, edx + mov ebx, 12 + div ebx + lea eax, [edx+0x3B] ;eax - F1...F12 + pop ebx + call ebx + jmp event +if 0 ;not work insert text +align 4 +.on_edit: + cmp [active_screen_keybar], keybar_editor + jne event + cmp edx, 1 + jl event + push edx + xor edx, edx + mov ebx, font_width + div ebx + pop edx + mov ebx, [active_screen] + mov ebp, [screens] + mov ebp, [ebp+ebx*8+4] + mov [ebp + editor_data.cursor_x], eax + mov [ebp + editor_data.cursor_y], edx + call editor_OnRedraw + jmp event +end if + +;input: +; eax - coord x +;output: +; eax - key bar index (0 to 95) if press F1 index = 0 +align 16 +get_keybar_ind: + push ebx ecx edx esi edi + xor edx, edx + mov ebx, font_width + sub eax, 5 ;border + div ebx + mov edi, eax + + xor esi, esi + test [ctrlstate], 3 + jz @f + inc esi +@@: + test [ctrlstate], 0xC + jz @f + or si, 2 +@@: + test [ctrlstate], 0x30 + jz @f + or si, 4 +@@: + imul esi, 12 ;᫮ F1-F12 + xor ecx, ecx + inc ecx + mov ebx, 6 + mov eax, [cur_width] + sub eax, 11+9+3*2+6 + cmp eax, 7*11 + jl @f + cdq + mov bl, 11 + div ebx + mov ebx, eax +@@: + xor edx, edx +.l: + add edx, 7 + cmp ecx, 10 + jb @f + inc edx +@@: + cmp edx, edi + ja .ret + cmp edx, [cur_width] + ja .ret + cmp ecx, 12 + jz .ret + lea edx, [edx+ebx-6] + inc edx + cmp edx, [cur_width] + ja .ret + inc ecx + jmp .l +.ret: + lea eax, [esi+ecx-1] + pop edi esi edx ecx ebx + ret + +align 16 +process_ctrl_keys: + cmp byte [esi], 0 + jz .done + push ecx + cmp al, [esi] + jz .check +.cont: + pop ecx + add esi, 8 + jmp process_ctrl_keys +.done: + stc + ret +.check: + mov cl, 0 + call .check_ctrlkey + jc .cont + mov cl, 2 + call .check_ctrlkey + jc .cont + mov cl, 4 + call .check_ctrlkey + jc .cont + pop ecx + call dword [esi+4] + clc + ret +.check_ctrlkey: + push eax edx + movzx edx, [ctrlstate] + shr edx, cl + add cl, cl + movzx eax, word [esi+2] + shr eax, cl + and eax, 15 + cmp al, ctrlkey_tests_num + jae .fail + xchg eax, edx + and al, 3 + call [ctrlkey_tests + edx*4] + cmp al, 1 + pop edx eax + ret +.fail: + stc + pop edx eax + ret + +ctrlkey_test0: + test al, al + setz al + ret +ctrlkey_test1: + test al, al + setnp al + ret +ctrlkey_test2: + cmp al, 3 + setz al + ret +ctrlkey_test3: + cmp al, 1 + setz al + ret +ctrlkey_test4: + cmp al, 2 + setz al + ret + +enum_associations_callback: +; LongBool __stdcall callback(f_name,sec_name,key_name,key_value); +; [esp+4] = f_name, [esp+8] = sec_name, [esp+12] = key_name, [esp+16] = key_value + mov esi, [esp+12] + mov edi, esi +@@: + lodsb + test al, al + jnz @b + sub esi, edi ; esi = size of key name + mov eax, [esp+16] +@@: + inc esi + inc eax + cmp byte [eax-1], 0 + jnz @b +; esi = total size of entry + push esi + add esi, [associations_size] + mov ecx, [associations_allocated] +@@: + cmp esi, ecx + jbe @f + add ecx, ecx + jmp @b +@@: + pop esi + cmp [associations_allocated], ecx + jz @f + mov [associations_allocated], ecx + mov edx, [associations] + call xpgrealloc + mov [associations], eax + test eax, eax + jz .err +@@: + mov eax, esi + mov esi, edi + mov edi, [associations] + add edi, [associations_size] + dec edi + add [associations_size], eax +@@: + lodsb + stosb + test al, al + jnz @b + mov esi, [esp+16] +@@: + lodsb + stosb + test al, al + jnz @b +.ret: + mov al, 1 + ret 16 +.err: + mov ecx, edx + call pgfree + xor eax, eax + ret 16 + +align 4 +enum_plugins_callback: +; LongBool __stdcall callback(f_name,sec_name,key_name,key_value); +; [esp+4] = f_name, [esp+8] = sec_name, [esp+12] = key_name, [esp+16] = key_value + mov esi, [esp+16] + cmp byte [esi], '/' + jz .absolute +; convert path to absolute + mov edi, execdata +@@: + cmp edi, execdata+1024 + jae .overflow + lodsb + stosb + test al, al + jnz @b + mov edi, saved_file_name + mov [esp+16], edi + mov esi, app_path + push esi + xor ecx, ecx +@@: + lodsb + test al, al + jz @f + cmp al, '/' + jnz @b + mov ecx, esi + jmp @b +@@: + pop esi + sub ecx, esi + push edi + add edi, ecx + cmp edi, saved_file_name+1024 + pop edi + ja .overflow + rep movsb + mov esi, execdata +.z: + cmp word [esi], '.' + jz .ret + cmp word [esi], './' + jnz @f + add esi, 2 + jmp .z +@@: + cmp word [esi], '..' + jnz .c + cmp byte [esi+2], 0 + jz .ret + cmp byte [esi+2], '/' + jnz .c + add esi, 3 +@@: + dec edi + cmp edi, saved_file_name + jbe .ret + cmp byte [edi-1], '/' + jnz @b + jmp .z +.c: + cmp edi, saved_file_name+1024 + jae .overflow + lodsb + stosb + test al, al + jnz .c + jmp .absolute +.overflow: + mov esi, execdata + mov byte [esi+1023], 0 + call load_dll_and_import.big +.ret: + mov al, 1 + ret 16 +.absolute: +; allocate space for plugin info + mov eax, [num_plugins] + inc eax + mov [num_plugins], eax + imul ecx, eax, PluginInfo.size + cmp ecx, [alloc_plugins] + jbe .norealloc + mov edx, [plugins] + call xpgrealloc + test eax, eax + jnz @f +.dec_ret: + dec [num_plugins] + jmp .ret +@@: + mov [plugins], eax + lea eax, [ecx+0xFFF] + and eax, not 0xFFF + mov [alloc_plugins], eax +.norealloc: + mov esi, [plugins] + lea esi, [esi+ecx-PluginInfo.size] +; load plugin DLL + or ebp, -1 + mov eax, [esp+16] + call load_dll_and_import.do + test eax, eax + jnz .dec_ret +; find exported functions + mov eax, aVersion + call load_dll_and_import.find_exported_function + jnc @f + xor eax, eax +@@: +MIN_INTERFACE_VER = 3 +MAX_INTERFACE_VER = 3 + cmp eax, MIN_INTERFACE_VER + jb @f + cmp eax, MAX_INTERFACE_VER + jbe .version_ok +@@: + push aIncompatibleVersion +.cantload: + push dword [esp+4+16] + push aCannotLoadPlugin + mov eax, esp + push ContinueBtn + push 1 + push eax + push 3 + call SayErr + add esp, 12 + jmp .dec_ret +.version_ok: + mov edi, esi + mov esi, plugin_exported +.import: + lodsd + test eax, eax + jz .import_done + call load_dll_and_import.find_exported_function + jnc @f + mov eax, [esi-4+plugin_exported_default-plugin_exported] +@@: + stosd + jmp .import +.import_done: +; initialize plugin + mov eax, aPluginLoad + call load_dll_and_import.find_exported_function + jc .ok + push kfar_info + call eax + cmp eax, 1 + jb .ok + ja .dec_ret + push aInitFailed + jmp .cantload +.ok: + mov al, 1 + ret 16 + +plugin_unload_default: + ret + +OpenFilePlugin_default: + xor eax, eax + ret 28 +GetFiles_default: + xor eax, eax + ret 20 + +ClosePlugin_default: + ret 4 + +GetOpenPluginInfo_default: + ret 8 + +SetFolder_default: +open_default: + xor eax, eax + ret 12 + +new_screen: +; in: ecx=sizeof(screen data), edx->vtable +; out: ebp=pointer or NULL, eax!=0 if successful +; destroys ebx,ecx + call xpgalloc + test eax, eax + jnz @f + ret +@@: + mov ebp, eax + mov eax, [screens] + mov ecx, [num_screens] + inc ecx + shl ecx, 3 + test ecx, 0xFFF + jnz .norealloc + push edx + mov edx, eax + call xpgrealloc + pop edx + test eax, eax + jnz @f + mov ecx, ebp + call pgfree + xor eax, eax + ret +@@: + mov [screens], eax +.norealloc: + inc [num_screens] + mov [eax+ecx-8], edx + mov [eax+ecx-4], ebp + mov eax, [num_screens] + dec eax + mov [active_screen], eax + mov [active_screen_vtable], edx + mov [active_screen_data], ebp + or [idle_interval], -1 + mov edx, [edx+screen_vtable.keybar] + test edx, edx + jz @f + mov [active_screen_keybar], edx +@@: + jmp draw_keybar + +next_screen: + mov eax, [active_screen] + inc eax + cmp eax, [num_screens] + jnz @f + xor eax, eax +@@: mov [active_screen], eax + jmp change_screen + +delete_active_screen: + mov edi, [screens] + mov eax, [active_screen] + shl eax, 3 + add edi, eax + push dword [edi+4] + lea esi, [edi+8] + mov ecx, [num_screens] + sub ecx, [active_screen] + dec ecx + add ecx, ecx + rep movsd + dec [num_screens] + mov ecx, [num_screens] + shl ecx, 3 + test ecx, 0xFFF + jnz .norealloc + mov edx, [screens] + call pgrealloc ; must succeed, because we decrease size + mov [screens], eax +.norealloc: + pop ecx + call pgfree + dec [active_screen] + +change_screen: + pusha + or [idle_interval], -1 + mov eax, [active_screen] + mov esi, [screens] + mov ebp, [esi+eax*8+4] + mov eax, [esi+eax*8] + push eax ebp + mov eax, [eax+screen_vtable.OnActivate] + test eax, eax + jz @f + call eax +@@: + pop ebp eax + mov [active_screen_vtable], eax + mov [active_screen_data], ebp + mov edx, [eax+screen_vtable.keybar] + test edx, edx + jz @f + mov [active_screen_keybar], edx +@@: + call draw_keybar + mov [cursor_size], cursor_normal_size + call [eax+screen_vtable.OnRedraw] + popa + ret + +F12: + mov eax, [cur_width] + add eax, 8 + mov esi, eax + mul [num_screens] + mov ecx, eax + call xpgalloc + test eax, eax + jnz @f + ret +@@: + mov ebx, eax + mov edi, eax + xor ecx, ecx +.next: + xor eax, eax + stosd + inc ecx + cmp ecx, [num_screens] + jz @f + lea eax, [edi+esi-4] + mov dword [edi-4], eax +@@: + xor eax, eax + stosd + dec ecx + jz @f + lea eax, [edi-8] + sub eax, esi + mov dword [edi-4], eax +@@: + mov al, '&' + stosb + cmp ecx, 36 + jae .noletter + lea eax, [ecx+'0'] + cmp al, '9' + jbe @f + add al, 7 +@@: + stosb + mov al, '.' + stosb + jmp .letter_done +.noletter: + mov al, ' ' + stosb + stosb +.letter_done: + mov al, ' ' + stosb + pushad + mov eax, [screens] + mov ebp, [eax+ecx*8+4] + mov eax, [eax+ecx*8] + mov ecx, [cur_width] + sub ecx, 12 + call [eax + screen_vtable.getname] + popad + sub edi, 4 + add edi, [cur_width] + inc ecx + cmp ecx, [num_screens] + jb .next + mov eax, [active_screen] + mul esi + add eax, ebx + push 1 + push dword aScreens + push eax + call menu + cmp eax, -1 + jz @f + sub eax, ebx + div esi + mov [active_screen], eax +@@: + mov ecx, ebx + call pgfree + jmp change_screen + +panels_OnKey: +; restore screen hidden by quick search box + cmp [bDisplayQuickSearch], 0 + jz @f + mov [bDisplayQuickSearch], 0 + push 0 + push QuickSearchDlg + call HideDialogBox +@@: + mov ebp, [active_panel] + mov ecx, [ebp + PanelData.index] + mov edx, [ebp + PanelData.start] + mov ebx, [ebp + PanelData.colst] + add ebx, edx + mov esi, panels_ctrlkeys + call process_ctrl_keys + jc .nostdkey + mov [bQuickSearchMode], 0 + ret +.leaveqsmode: + mov [bQuickSearchMode], 0 + call draw_image + ret +.keepqsmode: + push QuickSearchDlg + call ShowDialogBox + mov [bDisplayQuickSearch], 1 + ret +.nostdkey: + cmp [bQuickSearchMode], 0 + jz .noqsmode + test al, al + js .keepqsmode + cmp al, 40h + jae .leaveqsmode + cmp al, 0Eh + jz .qsbackspace + cmp al, 1Ch + jz .test_enter + movzx eax, al + cmp byte [scan2ascii+eax], 0 + jz .leaveqsmode + call get_ascii_char + mov ecx, dword [quick_search_buf + 4] + cmp ecx, quicksearch_maxlen + jae .keepqsmode + mov byte [quick_search_buf + 12 + ecx], al + mov byte [quick_search_buf + 12 + ecx + 1], 0 + push ecx + call quick_find + pop ecx + jnc @f + mov byte [quick_search_buf + 12 + ecx], 0 + jmp .keepqsmode +@@: + inc dword [quick_search_buf + 4] + sub ecx, 16 + jae @f + xor ecx, ecx +@@: + mov dword [quick_search_buf + 8], ecx + jmp .keepqsmode +.qsbackspace: + mov ecx, dword [quick_search_buf + 4] + jecxz .keepqsmode2 + dec ecx + mov byte [quick_search_buf + 12 + ecx], 0 + dec dword [quick_search_buf + 4] +.keepqsmode2: + jmp .keepqsmode +.test_enter: + test [ctrlstate], 0Ch ; LCtrl or RCtrl pressed? + jz .keepqsmode2 + test [ctrlstate], 3 ; Shift pressed? + jnz @f + call quick_find_next + jmp .keepqsmode2 +@@: + call quick_find_prev + jmp .keepqsmode2 +.noqsmode: +; handle Alt+ combinations for quick search + test [ctrlstate], 30h ; LAlt or RAlt pressed? + jz .noalt ; no => skip + test [ctrlstate], 0Ch ; LCtrl or RCtrl pressed? + jnz .noalt ; yes => skip + cmp al, 40h + jae .noalt + movzx eax, al + cmp byte [scan2ascii+eax], 0 + jz .noalt + call get_ascii_char + mov edi, quick_search_buf + 12 + mov dword [edi-12], quicksearch_maxlen-1 + mov dword [edi-8], 1 + and dword [edi-4], 0 + stosb + mov byte [edi], 0 + call quick_find + jnc @f + mov byte [quick_search_buf + 12], 0 + and dword [quick_search_buf + 4], 0 +@@: + mov ebx, QuickSearchDlg + mov eax, [ebp + PanelData.left] + add eax, 10 + mov edx, [cur_width] + sub edx, 21 + cmp eax, edx + jb @f + mov eax, edx +@@: + mov [ebx + dlgtemplate.x], eax + mov eax, [ebp + PanelData.top] + add eax, [ebp + PanelData.height] + mov edx, [cur_height] + sub edx, 2 + cmp eax, edx + jb @f + mov eax, edx +@@: + mov [ebx + dlgtemplate.y], eax + push ebx + call ShowDialogBox + mov [bQuickSearchMode], 1 + mov [bDisplayQuickSearch], 1 +.find_letter_done: +.noalt: +.ret: + ret +.up: + jecxz .ret + dec ecx + mov [ebp + PanelData.index], ecx + cmp ecx, edx + jae .done_redraw + mov [ebp + PanelData.start], ecx +.done_redraw: +; call draw_panel +; ret + jmp draw_panel +.insert: + lea eax, [ecx*4] + add eax, [ebp + PanelData.files] + mov eax, [eax] + cmp word [eax+40], '..' + jnz @f + cmp byte [eax+42], 0 + jz .insert.down +@@: + xor byte [eax+303], 1 + mov edx, [eax+32] + test byte [eax+303], 1 + mov eax, [eax+36] + jnz .insert.increase + sub dword [ebp + PanelData.selected_size], edx + sbb dword [ebp + PanelData.selected_size+4], eax + dec [ebp + PanelData.selected_num] + jmp .insert.down +.insert.increase: + add dword [ebp + PanelData.selected_size], edx + adc dword [ebp + PanelData.selected_size+4], eax + inc [ebp + PanelData.selected_num] +.insert.down: + inc ecx + cmp ecx, [ebp + PanelData.numfiles] + jae .done_redraw + jmp @f +.down: + inc ecx + cmp ecx, [ebp + PanelData.numfiles] + jae .ret +@@: + mov [ebp + PanelData.index], ecx + cmp ecx, ebx + jb .done_redraw + sub ecx, [ebp + PanelData.colst] + inc ecx + mov [ebp + PanelData.start], ecx + jmp .done_redraw +.left: + test ecx, ecx + jnz @f + ret +@@: + mov eax, [ebp + PanelData.colsz] + sub ecx, eax + jae @f + xor ecx, ecx +@@: + mov [ebp + PanelData.index], ecx +.finalize_left: + cmp ecx, edx + jae .done_redraw + sub edx, eax + jae @f + xor edx, edx +@@: + mov [ebp + PanelData.start], edx + jmp .done_redraw +.pgup: + mov eax, [ebp + PanelData.colst] + dec eax + jnz @f + inc eax +@@: + test ecx, ecx + jnz @f + ret +@@: + sub ecx, eax + jae @f + xor ecx, ecx +@@: + mov [ebp + PanelData.index], ecx + dec ecx + jmp .finalize_left +.right: + mov eax, [ebp + PanelData.colsz] + add ecx, eax + cmp ecx, [ebp + PanelData.numfiles] + jb @f + mov ecx, [ebp + PanelData.numfiles] + dec ecx +@@: + mov [ebp + PanelData.index], ecx +.finalize_right: + cmp ecx, ebx + jb .done_redraw + add ebx, eax + cmp ebx, [ebp + PanelData.numfiles] + jbe @f + mov ebx, [ebp + PanelData.numfiles] +@@: + sub ebx, [ebp + PanelData.colst] + jae @f + xor ebx, ebx +@@: + mov [ebp + PanelData.start], ebx + jmp .done_redraw +.pgdn: + mov eax, [ebp + PanelData.colst] + dec eax + jnz @f + inc eax +@@: + add ecx, eax + cmp ecx, [ebp + PanelData.numfiles] + jb @f + mov ecx, [ebp + PanelData.numfiles] + dec ecx +@@: + mov [ebp + PanelData.index], ecx + inc ecx + jmp .finalize_right +.tab: + xor [active_panel], panel1 xor panel2 + call draw_cmdbar + call draw_panel + mov ebp, [active_panel] + jmp .done_redraw +.home: + and [ebp + PanelData.start], 0 + and [ebp + PanelData.index], 0 + jmp .done_redraw +.end: + mov eax, [ebp + PanelData.numfiles] + dec eax + mov [ebp + PanelData.index], eax + inc eax + sub eax, [ebp + PanelData.colst] + jae @f + xor eax, eax +@@: + mov [ebp + PanelData.start], eax + jmp .done_redraw +.enter: + cmp [bQuickSearchMode], 0 + jz @f + call draw_image +@@: + call get_curfile_folder_entry + test byte [ecx], 10h + jnz .enter_folder +; todo: add handling on plugin panel + cmp [ebp + PanelData.hPlugin], 0 + jnz .ret +; generate full file name + lea esi, [ebp + PanelData.dir] + mov edi, execdata +@@: + lodsb + test al, al + jz @f + stosb + cmp edi, execdataend-1 + jae .bigfilename + jmp @b +@@: + lea esi, [ecx+40] + mov al, '/' + stosb +@@: + lodsb + stosb + cmp edi, execdataend + ja .bigfilename + test al, al + jnz @b +; try to open file and look for all plugins + push O_READ + push execdata + call open + test eax, eax + jz .noplugins ; if can't open, just try to execute + mov esi, eax ; save handle + push filedata_buffer_size + push filedata_buffer + push esi + call read + mov edi, eax ; save size of read data +; test for Kolibri executable + cmp eax, 24h + jb .enter.noexec + cmp dword [filedata_buffer], 'MENU' + jnz @f + cmp word [filedata_buffer+4], 'ET' + jnz @f +.close_run: + push esi + call close + jmp .run_app +@@: + cmp dword [filedata_buffer], 'KPCK' + jnz @f + cmp dword [filedata_buffer+12], 0x26914601 + jz .close_run +@@: +.enter.noexec: + mov ecx, [num_plugins] + mov edx, [plugins] + sub edx, PluginInfo.size +.plugloop: + add edx, PluginInfo.size + dec ecx + js .plugdone + pushad + push execdata + push [ebp+ PanelData.hFile] + push [ebp+ PanelData.hPlugin] + push edi + push filedata_buffer + call get_curfile_folder_entry + push ecx + push esi + call [edx+PluginInfo.OpenFilePlugin] + mov [esp+28], eax + popad + test eax, eax + jz .plugloop + cmp eax, -1 + jnz .pluginok + push esi + call close + ret +.pluginok: +; save current directory and set root directory of hPlugin + mov edi, eax ; save handle + mov esi, execdata +@@: + lodsb + test al, al + jnz @b + sub esi, execdata-9 +; allocate esi bytes in buffer 'parents' + mov ecx, [ebp + PanelData.parents_sz] + add ecx, esi + cmp ecx, [ebp + PanelData.parents_alloc] + jbe .enter.norealloc + push edx + mov edx, [ebp + PanelData.parents] + call xpgrealloc + pop edx + test eax, eax + jnz @f + push edi + call [edx+PluginInfo.ClosePlugin] + ret +@@: + mov [ebp + PanelData.parents], eax +.enter.norealloc: + mov [ebp + PanelData.parents_sz], ecx +; save current state to the end of buffer + sub ecx, esi + add ecx, [ebp + PanelData.parents] + xchg edx, [ebp + PanelData.hPlugin] + mov [ecx], edx + xchg edi, [ebp + PanelData.hFile] + mov [ecx+4], edi + mov byte [ecx+8], 0 + lea edi, [ecx+9] + lea ecx, [esi-9] + mov esi, execdata + rep movsb + mov word [ebp + PanelData.dir], '/' + mov eax, [ebp + PanelData.hPlugin] + lea ebx, [ebp + PanelData.plugin_flags] ;plugin_info + and dword [ebx], 0 + push ebp + push ebx + push [ebp + PanelData.hFile] + call [eax+PluginInfo.GetOpenPluginInfo] + pop ebp + call get_curfile_folder_entry + mov esi, ecx + mov edi, left_dotdot_entry + cmp ebp, panel1 + jz @f + add edi, right_dotdot_entry-left_dotdot_entry +@@: + mov ecx, 10 + rep movsd + mov byte [edi-40], 10h ; attributes: folder + mov eax, '..' + stosd + jmp .reread +.plugdone: + push esi + call close +.noplugins: +; run program or association + call get_curfile_folder_entry + call find_extension + jc .run_app +.run_association: + cmp byte [edi], 0 + jz .l1 + cmp byte [edi], ';' + jnz @f +.l1: + ret +@@: + mov esi, edi +@@: + lodsb + test al, al + jz @f + cmp al, ';' + jnz @b + dec esi + mov byte [esi], 0 + mov [restore_semicolon], esi +@@: +.run_association2: + mov [execparams], execdata + mov [execptr], edi + jmp .dorun +.run_app: + mov [execptr], execdata + and [execparams], 0 +.dorun: + lea esi, [ebp + PanelData.dir] + mov edi, execdata +@@: + lodsb + test al, al + jz @f + stosb + cmp edi, execdataend-1 + jae .bigfilename + jmp @b +@@: + lea esi, [ecx+40] + mov al, '/' + stosb +@@: + lodsb + stosb + cmp edi, execdataend + ja .bigfilename + test al, al + jnz @b +; for fasm call - special handling, because +; 1) fasm command line convention is different : fasm infile,outfile[,path] rather than tinypad infile +; 2) fasm will probably create new file in directory, so we want to reload panel data + xor edx, edx + cmp [execparams], edx + jz .nofasm + mov esi, [execptr] +@@: + lodsb + test al, al + jnz @b + mov eax, [esi-5] + or eax, 0x20202020 + cmp eax, 'fasm' + jnz .nofasm + cmp edi, execdata+(execdataend-execdata)/2 + ja .bigfilename + mov esi, execdata +@@: + lodsb + stosb + test al, al + jnz @b + mov byte [esi-1], ',' + inc edx +; output file: no extension if input file has extension, '.bin' otherwise + push edi +@@: + dec edi + cmp byte [edi], '.' + jz .ptfound + cmp byte [edi], '/' + jnz @b + pop edi + cmp edi, execdataend-4 + ja .bigfilename + mov dword [edi-1], '.bin' + mov byte [edi+3], 0 + jmp .nofasm +.ptfound: + mov byte [edi], 0 + pop edi +.nofasm: + mov ebx, execinfo +; if command line is more than 256 symbols, the kernel will truncate it +; we do not want this! +; N.B. We know that command line is either NULL or execdata, which is always ASCIIZ string, +; but can be up to 1023 symbols + mov esi, [ebx+8] + test esi, esi + jz .cmdlinelenok +@@: + lodsb + test al, al + jnz @b + sub esi, [ebx+8] + dec esi + cmp esi, 256 + ja .bigcmdline +.cmdlinelenok: + push SF_FILE + pop eax + int 40h + xor esi, esi + xchg esi, [restore_semicolon] + test esi, esi + jz @f + mov byte [esi], ';' +@@: + neg eax + js @f + call get_error_msg + push eax + push dword aRunError + mov eax, esp + push ContinueBtn + push 1 + push eax + push 2 + call SayErr + pop eax + pop eax + ret +@@: + test edx, edx + jz @f + push SF_SLEEP + pop eax + push 20 + pop ebx + int 0x40 + jmp .ctrl_r +@@: + ret +.bigfilename3: + pop esi +.bigfilename2: + pop esi +.bigfilename: + mov eax, aFileNameTooBig +.l2: + xor esi, esi + xchg esi, [restore_semicolon] + test esi, esi + jz @f + mov byte [esi], ';' +@@: + push eax + mov eax, esp + push ContinueBtn + push 1 + push eax + push 1 + call SayErr + pop eax + ret +.bigcmdline: + mov eax, aCmdLineTooBig + jmp .l2 +.bigfoldername2: + mov esi, prev_dir + lea edi, [ebp + PanelData.dir] +@@: + lodsb + stosb + test al, al + jnz @b +.bigfoldername: + mov eax, aFolderNameTooBig + jmp .l2 +.enter_folder: + lea esi, [ecx+40] + cmp word [esi], '..' + jnz @f + cmp byte [esi+2], 0 + jz .dotdot +@@: + push esi + lea esi, [ebp + PanelData.dir] + mov edi, prev_dir +@@: + lodsb + stosb + test al, al + jnz @b + lea edi, [esi-1] + lea edx, [ebp + PanelData.dir + 1024] + cmp esi, edx + pop esi + jae .bigfoldername + mov al, '/' + cmp [edi-1], al + jz @f + stosb +@@: + lodsb + cmp edi, edx + jae .bigfoldername2 + stosb + test al, al + jnz @b + mov eax, [ebp + PanelData.hPlugin] + test eax, eax + jz .reread + push ebp + lea esi, [ebp + PanelData.dir] + push esi + add ecx, 40 + push ecx + push [ebp + PanelData.hFile] + call [eax+PluginInfo.SetFolder] + pop ebp + test al, al + jnz .reread + mov esi, prev_dir + lea edi, [ebp + PanelData.dir] +@@: + lodsb + stosb + test al, al + jnz @b +.retd: + ret +.reread: + call read_folder +.done_cmdbar: + call draw_cmdbar + jmp .done_redraw +.dotdot: + lea edi, [ebp + PanelData.dir] + cmp word [edi], '/' + jnz .dotdot_noroot + cmp [ebp + PanelData.hPlugin], 0 + jz .retd + call close_plugin_panel + jmp .dotdot +.dotdot_noroot: + mov edx, edi + mov al, 0 + or ecx, -1 + repnz scasb + dec edi + mov al, '/' + std + repnz scasb + cld + inc edi + cmp edi, edx + jnz @f + inc edi +@@: + push dword [edi] + mov byte [edi], 0 + push edi + mov eax, [ebp + PanelData.hPlugin] + test eax, eax + jz .dotdot_native + push ebp + lea esi, [ebp + PanelData.dir] + push esi + push aDotDot + push [ebp + PanelData.hFile] + call [eax+PluginInfo.SetFolder] + pop ebp + test al, al + jnz .dotdot_native + pop edi + pop dword [edi] + ret +.dotdot_native: + call read_folder + pop edi + pop dword [edi] + push edi + cmp byte [edi], '/' + jnz @f + inc edi +@@: + mov edx, [ebp + PanelData.files] + mov ecx, [ebp + PanelData.numfiles] +.scanloop: + mov esi, [edx] + add esi, 40 + push esi edi +@@: + lodsb + call match_symbol + jnz @f + inc edi + test al, al + jnz @b +@@: + pop edi esi + jz .scanfound + add edx, 4 + loop .scanloop + jmp .scandone +.scanfound: + sub edx, [ebp + PanelData.files] + shr edx, 2 + mov [ebp + PanelData.index], edx + sub edx, [ebp + PanelData.colst] + jb .scandone + inc edx + mov [ebp + PanelData.start], edx +.scandone: + pop edi + mov byte [edi], 0 + jmp .done_cmdbar +.ctrl_f3_9: + sub al, 0x3D + add al, al + mov ah, [ebp + PanelData.sortmode] + and ah, 0xFE + cmp al, ah + jnz @f + and [ebp + PanelData.sortmode], 1 + or al, [ebp + PanelData.sortmode] + xor al, 1 +@@: + mov [ebp + PanelData.sortmode], al + mov eax, [ebp + PanelData.index] + mov ecx, [ebp + PanelData.files] + push dword [ecx+eax*4] + push ecx + call sort_files + pop edi + pop eax + or ecx, -1 + repnz scasd + not ecx + dec ecx + mov [ebp + PanelData.index], ecx + sub ecx, [ebp + PanelData.start] + jb .less_start + sub ecx, [ebp + PanelData.colst] + jae .gr_end +@@: jmp .done_redraw +.less_start: + add [ebp + PanelData.start], ecx + jmp @b +.gr_end: + inc ecx + add [ebp + PanelData.start], ecx + jmp @b +.alt_f1_2: + mov ebp, panel1 + cmp al, 0x3B + jz @f + mov ebp, panel2 +@@: +; get drives list + mov ebx, dirinfo + mov [ebx+dirinfo.size-dirinfo], 1 + mov [ebx+dirinfo.dirdata-dirinfo], driveinfo + mov [ebx+dirinfo.name-dirinfo], tmpname + mov byte [tmpname], '/' + xor edx, edx + xor ecx, ecx +.drive_loop_e: + mov byte [tmpname+1], 0 + push SF_FILE + pop eax + int 40h + mov ebx, dirinfo + test eax, eax + jnz .drive_loop_e_done + mov esi, driveinfo+32+40 + mov edi, tmpname+1 +@@: + lodsb + stosb + test al, al + jnz @b + push [ebx+dirinfo.first-dirinfo] + and [ebx+dirinfo.first-dirinfo], 0 +.drive_loop_i: + push SF_FILE + pop eax + int 40h + mov ebx, dirinfo + test eax, eax + jnz .drive_loop_i_done + add ecx, 32+8 + push ecx + and ecx, 0xFFF + cmp ecx, 32+8 + pop ecx + ja @f + call xpgrealloc + mov edx, eax + test eax, eax + jnz @f + pop eax + ret +@@: + lea edi, [edx+ecx-32] + mov esi, tmpname +@@: + lodsb + test al, al + jz @f + stosb + jmp @b +@@: + mov esi, driveinfo+32+40 + mov al, '/' + stosb +@@: + lodsb + stosb + test al, al + jnz @b + inc [ebx+dirinfo.first-dirinfo] + jmp .drive_loop_i +.drive_loop_i_done: + pop [ebx+dirinfo.first-dirinfo] + inc [ebx+dirinfo.first-dirinfo] + jmp .drive_loop_e +.drive_loop_e_done: + and [ebx+dirinfo.first-dirinfo], 0 + mov edi, edx + xor esi, esi + add ecx, edx +@@: + and dword [edi], 0 + mov dword [edi+4], esi + mov esi, edi + add edi, 32+8 + cmp edi, ecx + jae @f + mov [esi], edi + jmp @b +@@: + mov ecx, edx + lea edi, [ebp + PanelData.dir] + cmp [ebp + PanelData.hPlugin], 0 + jz .find_cur_drive_loop + mov edi, [ebp + PanelData.parents] + add edi, 8 +.find_cur_drive_loop: + push edi + lea esi, [ecx+8] +@@: + lodsb + test al, al + jz .cur_drive_found + call match_symbol + jnz @f + inc edi + jmp @b +@@: + cmp dword [ecx], 0 + jz @f + pop edi + mov ecx, [ecx] + jmp .find_cur_drive_loop +@@: + mov ecx, edx +.cur_drive_found: + pop edi + push 1 + push aDrive + push ecx + mov eax, [ebp + PanelData.height] + sub eax, 2 + jae @f + add eax, 2 +@@: + push eax + push [ebp + PanelData.width] + push [ebp + PanelData.top] + push [ebp + PanelData.left] + call menu_centered_in + cmp eax, -1 + jnz @f + mov ecx, edx + call pgfree + ret +@@: + push eax + push edx + call close_plugin_panels + pop edx + lea edi, [ebp + PanelData.dir] + push edi + mov esi, edi + mov edi, prev_dir + mov ecx, 1024/4 + rep movsd + pop edi + pop esi + add esi, 8 +@@: + lodsb + stosb + test al, al + jnz @b + mov ecx, edx + call pgfree + call read_folder + jmp .done_redraw +.shift_f5: +; todo: copy to plugin panel + cmp [ebp + PanelData.hPlugin], 0 + jz @f + ret +@@: + mov esi, ebp + cmp [ebp + PanelData.selected_num], 0 + jnz .f5_2 + call get_curfile_folder_entry + lea esi, [ecx+40] + mov edi, CopyDestEditBuf + mov eax, CopyDestEditBuf.length + stosd + scasd + xor eax, eax + stosd + mov edx, edi +@@: + lodsb + test al, al + jz .f5_common + stosb + jmp @b +.f5: +; todo: copy to plugin panel + mov esi, ebp + xor esi, panel1 xor panel2 + cmp [esi + PanelData.hPlugin], 0 + jz .f5_2 + ret +.f5_2: + add esi, PanelData.dir + mov edi, CopyDestEditBuf + mov eax, CopyDestEditBuf.length + stosd + scasd + xor eax, eax + stosd + mov edx, edi +@@: + lodsb + test al, al + jz @f + cmp edi, CopyDestEditBuf+12+511 + jae .bigfoldername + stosb + jmp @b +@@: + mov al, '/' + stosb +.f5_common: + mov eax, [ebp + PanelData.hPlugin] + mov [source_hModule], eax + mov eax, [ebp + PanelData.hFile] + mov [source_hPlugin], eax + mov eax, left_dotdot_entry + cmp ebp, panel1 + jz @f + add eax, right_dotdot_entry-left_dotdot_entry +@@: + mov [default_attr], eax + mov byte [edi], 0 + sub edi, edx + mov [edx-8], edi + mov edi, CopySourceTextBuf + mov esi, aCopy1 +@@: + lodsb + test al, al + jz @f + stosb + jmp @b +@@: + mov eax, [ebp + PanelData.selected_num] + test eax, eax + jz .f5_noselected1 + mov ebx, eax + push 10 + pop ecx + push -'0' +@@: + xor edx, edx + div ecx + push edx + test eax, eax + jnz @b +@@: + pop eax + add al, '0' + jz @f + stosb + jmp @b +@@: +if lang eq ru_RU + mov dword [edi], ' ' + mov dword [edi+4], '' + add edi, 8 + cmp ebx, 1 + jz @f + mov al, '' + stosb + cmp ebx, 4 + jbe @f + mov word [edi-1], '' + inc edi +@@: +else ; Default to en_US + mov dword [edi], ' ite' + mov byte [edi+4], 'm' + add edi, 5 + cmp ebx, 1 + jz @f + mov al, 's' + stosb +@@: +end if + jmp .f5_selected1 + +.f5_noselected1: + mov al, '"' + stosb + call get_curfile_folder_entry + lea esi, [ecx+40] + lea eax, [esi+1] +@@: + inc esi + cmp byte [esi-1], 0 + jnz @b + sub esi, eax + xchg eax, esi + dec esi + mov edx, [cur_width] + sub edx, 50 + sub eax, edx + jbe @f + add esi, eax + mov al, '.' + stosb + stosb + stosb +@@: + lodsb + test al, al + jz @f + stosb + jmp @b +@@: + mov al, '"' + stosb +.f5_selected1: + mov esi, aCopy2 +@@: + lodsb + stosb + test al, al + jnz @b + mov ebx, copy_dlgdata + mov eax, [cur_width] + sub eax, 12 + mov [ebx + dlgtemplate.width], eax + dec eax + dec eax + mov [ebx - copy_dlgdata + copy_dlgdata.lcopy.x2], eax + mov [ebx - copy_dlgdata + copy_dlgdata.ename.x2], eax + shr eax, 1 + dec eax + dec eax + mov [ebx - copy_dlgdata + copy_dlgdata.copy.x2], eax + sub eax, aCopyLength-1 + mov [ebx - copy_dlgdata + copy_dlgdata.copy.x1], eax + add eax, aCopyLength+3 + mov [ebx - copy_dlgdata + copy_dlgdata.cnl.x1], eax + add eax, aCancelBLength - 1 + mov [ebx - copy_dlgdata + copy_dlgdata.cnl.x2], eax + mov byte [ebx - copy_dlgdata + copy_dlgdata.ename.flags], 0xC + and byte [ebx - copy_dlgdata + copy_dlgdata.copy.flags], not 4 + and byte [ebx - copy_dlgdata + copy_dlgdata.cnl.flags], not 4 + push ebx + call DialogBox + cmp eax, copy_dlgdata.copy + jnz .ret2 +; 㥬 + mov esi, CopyDestEditBuf+12 + mov edi, esi + xor eax, eax + or ecx, -1 + repnz scasb + dec edi + dec edi + cmp edi, esi + jb .ret2 + mov [bEndSlash], 0 + cmp byte [edi], '/' + jnz @f + cmp edi, esi + jz @f + mov byte [edi], 0 + dec edi + mov [bEndSlash], 1 +@@: +; ᫨ 稭 , ⠥ ⭮⥫쭮 ⥪饩 + cmp byte [esi], '/' + jz .copy_absolute_path + push esi + push edi + lea edi, [ebp + PanelData.dir] + or ecx, -1 + xor eax, eax + repnz scasb + not ecx + pop edi + push edi + add edi, ecx + cmp edi, CopyDestEditBuf+12+513 + pop edi + jb @f + pop esi + jmp .bigfilename +@@: + lea edx, [edi+2] + sub edx, esi + lea edi, [edi+ecx+1] + xchg ecx, edx + std + lea esi, [esi+ecx-1] + rep movsb + cld + pop edi + lea esi, [ebp + PanelData.dir] + push edi + mov ecx, edx + rep movsb + mov byte [edi-1], '/' + pop esi +.copy_absolute_path: +; 砫 ᮧ 襫騥 , +; ᫥ ⮢ 䠩, ⠪ ; +; 㥬 砥, ᫨ 筨  + xor edx, edx + cmp [ebp + PanelData.selected_num], 0 + jz .f5_noselected2 + mov ecx, [ebp + PanelData.numfiles] + mov edi, [ebp + PanelData.files] +.scanselected2: + mov eax, [edi] + add edi, 4 + test byte [eax+303], 1 + jz @f + test byte [eax], 10h + jz @f + inc edx +@@: + loop .scanselected2 + jmp .f5_selected2 +.f5_noselected2: + call get_curfile_folder_entry + test byte [ecx], 10h + setnz dl +.f5_selected2: + xor eax, eax + mov edi, esi +.countslashloop: + cmp byte [edi], '/' + jnz @f + inc eax + mov ecx, edi +@@: + inc edi + cmp byte [edi], 0 + jnz .countslashloop + mov [bNeedRestoreName], 0 +; "/file-system/partition" folders already exist, so we don't need to create them + cmp eax, 2 + jbe .createupdone +; we interpret destination as folder if edx!=0 or bEndSlash!=0 + test edx, edx + jnz @f + cmp [bEndSlash], 0 + jnz @f + mov edi, ecx + dec eax +@@: + mov [attrinfo.name], esi + mov ecx, eax +; 饬 ᫥ , +.createuploop1: + cmp eax, 2 + jbe .createupdone1 + mov dl, [edi] + mov byte [edi], 0 + push eax + push SF_FILE + pop eax + mov ebx, attrinfo + int 0x40 + test eax, eax + pop eax + mov byte [edi], dl + jnz .createupcont1 + test byte [attrinfo.attr], 10h + jnz .createupdone1 +; the item required to be a folder, but is file + push aNotFolder + push esi + mov eax, esp + push ContinueBtn + push 1 + push eax + push 2 + call SayErr + pop eax + pop eax +.ret3: + ret +.createupcont1: + dec eax +@@: + dec edi + cmp byte [edi], '/' + jnz @b + jmp .createuploop1 +.createupdone1: +; ᮧ , 㦭 + cmp eax, ecx + jae .createupdone +@@: + inc edi + cmp byte [edi], 0 + jz @f + cmp byte [edi], '/' + jnz @b +@@: + mov dl, byte [edi] + mov byte [edi], 0 + push eax + push RetryOrCancelBtn + push 2 + call makedir + mov byte [edi], dl + mov [bNeedRestoreName], 1 + pop eax + jnz .ret3 + inc eax + jmp .createupdone1 +.createupdone: + mov dl, 1 + cmp byte [edi], 1 + sbb eax, -1 + cmp eax, 2 + jbe .docopy + mov [attrinfo.attr], 0 ; assume zero attributes if error + push SF_FILE + pop eax + mov ebx, attrinfo + int 0x40 + test [attrinfo.attr], 10h + setnz dl +.docopy: + call get_curfile_folder_entry + mov eax, ecx + cmp [bNeedRestoreName], 0 + jz @f + cmp [bEndSlash], 0 + jnz @f + cmp [ebp + PanelData.selected_num], 0 + jnz @f + test byte [eax], 10h + jz @f + mov dl, 0 +@@: +; 稭 ᮡ⢥ ஢ + mov [bDestIsFolder], dl + mov [copy_bSkipAll], 0 + mov [copy_bSkipAll2], 0 + mov [copy_bSkipAll3], 0 + test [ebp + PanelData.plugin_flags], 2 + jnz .copy_GetFiles + cmp [ebp + PanelData.selected_num], 0 + jnz .f5_selected3 + call copy_file +.copydone: + push ebp + call .ctrl_r + pop ebp + xor ebp, panel1 xor panel2 + jmp .ctrl_r +.f5_selected3: + mov ecx, [ebp + PanelData.numfiles] + mov esi, [ebp + PanelData.files] +.f5_selected_copyloop: + lodsd + test byte [eax+303], 1 + jz .f5_selected_copycont + mov [bDestIsFolder], dl + call copy_file + ja .f5_multiple_cancel + and byte [eax+303], not 1 + pushad + call draw_panel + cmp [bNeedRestoreName], 0 + jz @f + mov esi, CopyDestEditBuf+12 + call delete_last_name_from_end +@@: + popad +.f5_selected_copycont: + loop .f5_selected_copyloop +.f5_multiple_cancel: + jmp .copydone +.copy_GetFiles: + mov ecx, [ebp + PanelData.selected_num] + cmp ecx, 1 + adc ecx, 0 + shl ecx, 2 + call xpgalloc + test eax, eax + jnz @f + ret +@@: + push ebp eax ; save + push copy_AddDir ; adddir + push copy_AddFile ; addfile + push eax ; items + shr ecx, 2 + push ecx ; NumItems + push [ebp + PanelData.hFile] + mov edi, eax + call get_curfile_folder_entry + mov [edi], ecx + cmp [ebp + PanelData.selected_num], 0 + jz .cgf1 + mov esi, [ebp + PanelData.files] + mov ecx, [ebp + PanelData.numfiles] +.cgf0: + lodsd + test byte [eax+303], 1 + jz @f + stosd +@@: + loop .cgf0 +.cgf1: + mov eax, [ebp + PanelData.hPlugin] + call [eax+PluginInfo.GetFiles] + pop ecx ebp + call pgfree + jmp .copydone + +.f3: + mov eax, [ebp + PanelData.files] + mov ecx, [eax+ecx*4] + test byte [ecx], 10h + jnz .ret2 + lea esi, [ebp + PanelData.dir] + xor eax, eax + call view_file +.ret2: + ret +.f4: + call edit_file + ret +.f8_has_selected: + mov edi, saved_file_name+511 + mov byte [edi], 0 + mov eax, [ebp + PanelData.selected_num] +if lang eq ru_RU + cmp eax, 1 + jz @f + dec edi + mov byte [edi], '' + cmp eax, 4 + jbe @f + dec edi + mov word [edi], '' +@@: + mov dword [edi-4], '' + mov dword [edi-8], ' ' + sub edi, 8 +else ; Default to en_US + cmp eax, 1 + jz @f + dec edi + mov byte [edi], 's' +@@: + mov dword [edi-4], 'item' + mov byte [edi-5], ' ' + sub edi, 5 +end if + xor edx, edx + push 10 + pop ecx +@@: + div ecx + add dl, '0' + dec edi + mov [edi], dl + xor edx, edx + test eax, eax + jnz @b + push edi + push aConfirmDeleteText + mov eax, esp + push DeleteOrCancelBtn + push 2 + push eax + push 2 + push aDeleteCaption + call Message + add esp, 8 + test eax, eax + jnz .ret2 + mov [del_bSkipAll], 0 + mov ecx, [ebp + PanelData.numfiles] + jecxz .ret2 + mov esi, [ebp + PanelData.files] +.f8_loop: + lodsd + test byte [eax+303], 1 + jz @f + call delete_file + ja .f8_multiple_cancel +@@: + loop .f8_loop +.f8_multiple_cancel: + jmp .copydone +.f8: +; todo: delete files from plugin panel + cmp [ebp + PanelData.hPlugin], 0 + jz @f + ret +@@: + cmp [ebp + PanelData.selected_num], 0 + jnz .f8_has_selected + call get_curfile_folder_entry + cmp word [ecx+40], '..' + jnz @f + cmp byte [ecx+42], 0 + jz .f8_not_allowed +@@: + cmp [bConfirmDelete], 0 + jz .f8_allowed + lea eax, [ecx+40] + push eax + mov esi, aConfirmDeleteText + mov edi, aConfirmDeleteTextBuf + push edi +@@: + lodsb + stosb + test al, al + jnz @b + dec edi + mov esi, aDeleteFolder + test byte [ecx], 10h + jnz @f + mov esi, aDeleteFile +@@: + lodsb + stosb + test al, al + jnz @b + mov eax, esp + push DeleteOrCancelBtn + push 2 + push eax + push 2 + push aDeleteCaption + call Message + add esp, 8 + test eax, eax + jz .f8_allowed +.f8_not_allowed: + ret +.f8_allowed: + mov [del_bSkipAll], 0 + mov eax, ecx + call delete_file + jmp .copydone +.ctrl_r: +; Rescan panel +; call read_folder +; jmp .done_redraw + mov eax, [ebp + PanelData.index] + push eax + call get_curfile_name + mov esi, ecx + mov edi, saved_file_name +@@: + lodsb + stosb + test al, al + jnz @b +.ctrl_r.doread: + push [ebp + PanelData.start] + call read_folder + pop [ebp + PanelData.start] + pop [ebp + PanelData.index] + or eax, -1 +@@: + inc eax + cmp eax, [ebp + PanelData.numfiles] + jae .ctrl_r.notfound + mov ecx, [ebp + PanelData.files] + mov esi, [ecx+eax*4] + add esi, 40 + mov edi, saved_file_name + call strcmpi + jnz @b +.ctrl_r.found: + mov [ebp + PanelData.index], eax +.ctrl_r.notfound: + mov eax, [ebp + PanelData.numfiles] + dec eax + cmp [ebp + PanelData.index], eax + jbe @f + mov [ebp + PanelData.index], eax +@@: + mov eax, [ebp + PanelData.index] + cmp [ebp + PanelData.start], eax + jbe @f + mov [ebp + PanelData.start], eax +@@: + inc eax + sub eax, [ebp + PanelData.colst] + jae @f + xor eax, eax +@@: + cmp [ebp + PanelData.start], eax + jae @f + mov [ebp + PanelData.start], eax +@@: + mov eax, [ebp + PanelData.numfiles] + sub eax, [ebp + PanelData.colst] + jbe @f + cmp [ebp + PanelData.start], eax + jbe @f + mov [ebp + PanelData.start], eax +@@: + jmp .done_redraw +.menu: +; todo: context menu for plugin panel + cmp [ebp + PanelData.hPlugin], 0 + jz @f + ret +@@: +; display context menu +; ignore folders + call get_curfile_folder_entry + test byte [ecx], 10h + jz @f +.menuret: + ret +@@: + call find_extension + jc .menuret +; known extension +@@: + cmp byte [edi], 0 + jz .menuret + cmp byte [edi], ';' + jz @f + inc edi + jmp @b +@@: + inc edi +@@: + inc edi + cmp byte [edi-1], ' ' + jz @b + cmp byte [edi-1], 9 + jz @b + dec edi + cmp byte [edi], 0 + jz .menuret + mov ecx, esi +@@: + inc ecx + cmp byte [ecx-1], 0 + jnz @b + sub ecx, esi ; ecx = 䠩+1 = +1 + cmp ecx, 15 + jb @f + mov cl, 15 +@@: + xor edx, edx + xor ebp, ebp + push edx +.menucreateloop: + mov eax, edi + xor ebx, ebx +@@: + cmp byte [edi], ',' + jz @f + cmp byte [edi], bl + jz @f + inc edi + jmp @b +@@: + xchg bl, [edi] + pushad + push nullstr + push 1024 + push saved_file_name + push eax + push aMenu + push app_path + call [ini.get_str] + popad + mov [edi], bl + mov eax, saved_file_name +@@: + cmp byte [eax], 0 + jz .menucreatecont + cmp byte [eax], ',' + jz @f + inc eax + jmp @b +@@: + mov byte [eax], 0 + push eax + sub eax, saved_file_name-1 + cmp eax, ecx + ja @f + mov eax, ecx +@@: + xchg eax, [esp] + inc eax + push eax +@@: + inc eax + cmp byte [eax-1], 0 + jnz @b + sub eax, [esp] + add [esp+4], eax + pop eax eax + add eax, 8 + add ebp, eax + push ebp + and ebp, 0xFFF + cmp ebp, eax + pop ebp + ja @f + push eax + xchg edx, [esp+4] + push ecx + mov ecx, ebp + call xpgrealloc + pop ecx + pop edx + xchg edx, [esp] + test eax, eax + xchg eax, [esp] + jz .menucreated +@@: + neg eax + add eax, ebp + add eax, [esp] + and dword [eax], 0 + and dword [eax+4], 0 + test edx, edx + jz @f + sub eax, [esp] + mov [edx], eax + add eax, [esp] + sub edx, [esp] + mov [eax+4], edx +@@: + mov edx, eax + push esi edi + mov esi, saved_file_name + lea edi, [eax+8] +@@: + lodsb + stosb + test al, al + jnz @b + push esi + sub esi, saved_file_name + sub esi, ecx + jae .menunoadd + neg esi +@@: + mov byte [edi-1], ' ' + stosb + dec esi + jnz @b +.menunoadd: + pop esi +@@: + lodsb + stosb + test al, al + jnz @b + pop edi esi +.menucreatecont: + inc edi + cmp byte [edi-1], ',' + jz .menucreateloop +.menucreated: + test edx, edx + jz .menuret_free + and dword [edx], 0 + pop edx + mov ecx, edx + add [ecx], edx +@@: + mov ecx, [ecx] + cmp dword [ecx], 0 + jz @f + add [ecx], edx + add [ecx+4], edx + jmp @b +@@: + add [ecx+4], edx + push edx + push 1 + push esi + push edx + call menu + cmp eax, -1 + jz .menuret_free + lea edi, [eax+8] +@@: + inc edi + cmp byte [edi-1], 0 + jnz @b + mov ebp, [active_panel] + call get_curfile_folder_entry + call .run_association2 +.menuret_free: + pop ecx + jmp pgfree +.f7: + mov dword [CopyDestEditBuf], CopyDestEditBuf.length + and dword [CopyDestEditBuf+4], 0 + and dword [CopyDestEditBuf+8], 0 + mov byte [CopyDestEditBuf+12], 0 + mov ebx, mkdir_dlgdata + mov eax, [cur_width] + sub eax, 12 + mov [ebx + dlgtemplate.width], eax + dec eax + dec eax + mov [ebx + MkDir_Dlgdata.dnam.x2], eax + shr eax, 1 + dec eax + dec eax + mov [ebx + MkDir_Dlgdata.cont.x2], eax + sub eax, a_ContinueLength-1 + mov [ebx + MkDir_Dlgdata.cont.x1], eax + add eax, a_ContinueLength+3 + mov [ebx + MkDir_Dlgdata.cnl.x1], eax + add eax, aCancelBLength - 1 + mov [ebx + MkDir_Dlgdata.cnl.x2], eax + mov byte [ebx + MkDir_Dlgdata.dnam.flags], 0xC + and byte [ebx + MkDir_Dlgdata.cont.flags], not 4 + and byte [ebx + MkDir_Dlgdata.cnl.flags], not 4 + push ebx + call DialogBox + cmp eax, mkdir_dlgdata.cont + jnz .ret2 + mov esi, CopyDestEditBuf+12 + cmp byte [esi], 0 + jz .ret2 + cmp byte [esi], '/' + jz .mkdir_absolute_path + push esi + lea edi, [ebp + PanelData.dir] + or ecx, -1 + xor eax, eax + repnz scasb + not ecx + mov edi, esi +@@: + cmp byte [edi+1], 0 + jz @f + inc edi + jmp @b +@@: + push edi + add edi, ecx + cmp edi, CopyDestEditBuf+12+513 + pop edi + jb @f + pop esi + jmp .bigfilename +@@: + lea edx, [edi+2] + sub edx, esi + lea edi, [edi+ecx+1] + xchg ecx, edx + std + lea esi, [esi+ecx-1] + rep movsb + cld + pop edi + lea esi, [ebp + PanelData.dir] + push edi + mov ecx, edx + rep movsb + mov byte [edi-1], '/' + pop esi +.mkdir_absolute_path: + push RetryOrCancelBtn + push 2 + call makedir + jmp .copydone +.change_mode: + dec eax + mov [ebp + PanelData.colmode], eax + call calc_colwidths + jmp draw_panel +.quick_jump: + dec eax + cmp al, 10 + jnz @f + xor eax, eax +@@: + mov eax, [FolderShortcuts+eax*4] + test eax, eax + jnz @f + ret +@@: + push eax + call close_plugin_panels + lea esi, [ebp + PanelData.dir] + push esi + mov edi, prev_dir +@@: + lodsb + stosb + test al, al + jnz @b + pop edi esi +@@: + lodsb + stosb + test al, al + jnz @b + jmp .reread +.greyplus: + push 0 + mov ecx, aSelect + jmp @f +.greyminus: + push 1 + mov ecx, aDeselect +@@: + mov eax, mark_dlgdata + mov [eax+mark_dlgdata.title-mark_dlgdata], ecx + mov [eax+mark_dlgdata.edit.flags-mark_dlgdata], 0xC + mov edi, enter_string_buf+12 + mov dword [edi-12], 512 + mov dword [edi-8], 1 + and dword [edi-4], 0 + mov word [edi], '*' + push eax + call DialogBox + inc eax + jnz @f +.noselect: + pop eax + ret +@@: + xor eax, eax + mov esi, edi +@@: + lodsb + mov al, [tolower_table+eax] + mov [esi-1], al + test al, al + jnz @b +@@: + mov ecx, [ebp + PanelData.numfiles] + mov ebx, [ebp + PanelData.files] + jecxz .noselect + mov eax, [ebx] + cmp word [eax+40], '..' + jnz .selectloop + cmp byte [eax+42], 0 + jnz .selectloop + dec ecx + jz .noselect + add ebx, 4 +.selectloop: + xor eax, eax + mov esi, [ebx] + add esi, 40 + mov edx, lower_file_name-1 +@@: + lodsb + inc edx + mov al, [tolower_table+eax] + mov [edx], al + test al, al + jnz @b + mov esi, lower_file_name + call match_mask_rev_lowercase + jc @f + mov esi, [ebx] + mov eax, [esi+32] + cmp byte [esp], 0 + jz .doselect + test byte [esi+303], 1 + jz @f + and byte [esi+303], not 1 + sub dword [ebp + PanelData.selected_size], eax + mov eax, [esi+36] + sbb dword [ebp + PanelData.selected_size+4], eax + dec dword [ebp + PanelData.selected_num] + jmp @f +.doselect: + test byte [esi+303], 1 + jnz @f + or byte [esi+303], 1 + add dword [ebp + PanelData.selected_size], eax + mov eax, [esi+36] + adc dword [ebp + PanelData.selected_size+4], eax + inc dword [ebp + PanelData.selected_num] +@@: + add ebx, 4 + dec ecx + jnz .selectloop + pop eax + jmp .done_redraw +.greyasterisk: + mov ecx, [ebp + PanelData.numfiles] + mov esi, [ebp + PanelData.files] + jecxz .galoopdone +.galoop: + lodsd + cmp word [eax+40], '..' + jnz @f + cmp byte [eax+42], 0 + jz .gacont +@@: + xor byte [eax+303], 1 + mov edx, [eax+32] + test byte [eax+303], 1 + jz .gadel + add dword [ebp + PanelData.selected_size], edx + mov edx, [eax+36] + adc dword [ebp + PanelData.selected_size+4], edx + inc dword [ebp + PanelData.selected_num] + jmp .gacont +.gadel: + sub dword [ebp + PanelData.selected_size], edx + mov edx, [eax+36] + sbb dword [ebp + PanelData.selected_size+4], edx + dec dword [ebp + PanelData.selected_num] +.gacont: + loop .galoop +.galoopdone: + jmp .done_redraw + +@@: + call close_plugin_panel +close_plugin_panels: + cmp [ebp + PanelData.hPlugin], 0 + jnz @b + ret + +align 4 +close_plugin_panel: +; close plugin and restore old directory + mov esi, [ebp + PanelData.parents] + add esi, [ebp + PanelData.parents_sz] +@@: + dec esi + cmp byte [esi-1], 0 + jnz @b + push esi + lea edi, [ebp + PanelData.dir] +@@: + lodsb + stosb + test al, al + jnz @b + pop esi + sub esi, 9 + mov edx, [esi] ; hPlugin + mov ebx, [esi+4] ; hFile + sub esi, [ebp + PanelData.parents] + mov [ebp + PanelData.parents_sz], esi + xchg edx, [ebp + PanelData.hPlugin] + xchg ebx, [ebp + PanelData.hFile] + push edx ebx + lea ebx, [ebp + PanelData.plugin_flags] ;plugin_info + and dword [ebx], 0 + mov eax, [ebp + PanelData.hPlugin] + test eax, eax + jz @f + push ebp + push ebx + push [ebp + PanelData.hFile] + call [eax+PluginInfo.GetOpenPluginInfo] + pop ebp +@@: + pop ebx edx + +align 4 +close_handle_if_unused: +; edx=hPlugin, ebx=hFile + push ebp + xor ecx, ecx +@@: + mov eax, [screens] + mov ebp, [eax+ecx*8+4] + mov eax, [eax+ecx*8] + call [eax+screen_vtable.IsHandleUsed] + jz .used + inc ecx + cmp ecx, [num_screens] + jb @b + push ebx + call [edx+PluginInfo.ClosePlugin] +.used: + pop ebp + ret + +align 4 +panels_IsHandleUsed: +; edx=hPlugin, ebx=hFile + mov ebp, panel1 + call .1 + jz .ret + mov ebp, panel2 + +.1: + cmp edx, [ebp+ PanelData.hPlugin] + jnz @f + cmp ebx, [ebp+ PanelData.hFile] + jz .ret +@@: + mov esi, [ebp + PanelData.parents_sz] + test esi, esi + jnz @f + inc esi +.ret: + ret +@@: + add esi, [ebp + PanelData.parents] +@@: + dec esi + cmp byte [esi-1], 0 + jnz @b + sub esi, 9 + cmp edx, [esi] ; hPlugin + jnz .no + mov ebx, [esi+4] ; hFile + jz .ret +.no: + cmp esi, [ebp + PanelData.parents] + jnz @b + inc esi + ret + +align 4 +panels_OnExit: +; close plugin panels + mov ebp, panel1 + call close_plugin_panels + mov ebp, panel2 + call close_plugin_panels + ret + +align 4 +panels_OnRedraw: + or [cursor_x], -1 + or [cursor_y], -1 + call draw_cmdbar + mov ebp, panel1 + call calc_colwidths + call draw_panel + mov ebp, panel2 + call calc_colwidths + call draw_panel + ret + +align 4 +init_console: + mov ecx, [console_data_ptr] + call pgfree + mov eax, [cur_width] + mul [cur_height] + mov ecx, eax + push ecx + shl ecx, 2 + call pgalloc + pop ecx + test eax, eax + jz exit + mov [console_data_ptr], eax + mov edi, eax + mov ax, 0720h + rep stosw + mov [panel1.left], ecx + mov [panel1.top], ecx + mov [panel2.top], ecx + mov eax, [cur_width] + inc eax + shr eax, 1 + mov [panel1.width], eax + mov [panel2.left], eax + sub eax, [cur_width] + neg eax + mov [panel2.width], eax + mov eax, [cur_height] + dec eax + dec eax + mov [panel1.height], eax + mov [panel2.height], eax + ret + +align 4 +get_curfile_folder_entry: + mov ecx, [ebp + PanelData.index] + shl ecx, 2 + add ecx, [ebp + PanelData.files] + mov ecx, [ecx] + ret + +align 4 +get_curfile_name: + call get_curfile_folder_entry + add ecx, 40 + ret + +quick_find: + cmp [ebp + PanelData.numfiles], 0 + jz .nof + mov ecx, [ebp + PanelData.index] +.scanloop: + mov edi, ecx + shl edi, 2 + add edi, [ebp + PanelData.files] + mov edi, [edi] + add edi, 40 + mov esi, quick_search_buf + 12 +@@: + lodsb + test al, al + jz .ok + call match_symbol + jnz .no + inc edi + jmp @b +.no: + inc ecx + cmp ecx, [ebp + PanelData.numfiles] + jb @f + xor ecx, ecx +@@: + cmp ecx, [ebp + PanelData.index] + jnz .scanloop +.nof: + stc + ret +.ok: + cmp ecx, [ebp + PanelData.index] + jz .ret + mov [ebp + PanelData.index], ecx + mov eax, [ebp + PanelData.height] + shr eax, 1 + sub ecx, eax + jae @f + xor ecx, ecx +@@: + mov eax, [ebp + PanelData.numfiles] + sub eax, [ebp + PanelData.colst] + jnc @f + xor eax, eax + xor ecx, ecx +@@: + cmp ecx, eax + jb @f + mov ecx, eax +@@: + mov [ebp + PanelData.start], ecx + call draw_panel +.ret: + clc + ret + +quick_find_next: + cmp [ebp + PanelData.numfiles], 0 + jz quick_find.nof + mov ecx, [ebp + PanelData.index] + jmp quick_find.no + +quick_find_prev: + cmp [ebp + PanelData.numfiles], 0 + jz quick_find.nof + mov ecx, [ebp + PanelData.index] +.scanloop: + dec ecx + jns @f + mov ecx, [ebp + PanelData.numfiles] + dec ecx +@@: + cmp ecx, [ebp + PanelData.index] + jz quick_find.nof + mov edi, ecx + shl edi, 2 + add edi, [ebp + PanelData.files] + mov edi, [edi] + add edi, 40 + mov esi, quick_search_buf + 12 +@@: + lodsb + test al, al + jz quick_find.ok + call match_symbol + jnz .scanloop + inc edi + jmp @b + +panels_getname: +if lang eq ru_RU + mov eax, '' + stosd + mov eax, ' ' + stosd + mov eax, ' ' + stosd + stosb +else ; Default to en_US + mov eax, 'Pane' + stosd + mov eax, 'ls ' + stosd + mov eax, ' ' + stosd + stosb +end if + sub ecx, 13 + mov ebp, [active_panel] + push 3 + pop edx + cmp [ebp + PanelData.hPlugin], 0 + jz .native + mov esi, [ebp + PanelData.parents] + add esi, [ebp + PanelData.parents_sz] +@@: + dec esi + cmp byte [esi-1], 0 + jz @f + cmp byte [esi-1], '/' + jnz @b +@@: + push ecx edi + shr ecx, 1 +@@: + lodsb + test al, al + jz @f + stosb + loop @b +@@: + sub edi, [esp] + sub [esp+4], edi + add [esp], edi + pop edi ecx + lea esi, [ebp + PanelData.dir] + cmp byte [esi+1], 0 + jnz @f + inc esi +@@: + jmp .main +.native: + lea esi, [ebp + PanelData.dir] +@@: + lodsb + stosb + dec ecx + test al, al + jz @f + cmp al, '/' + jnz @b + dec edx + jnz @b +@@: + test al, al + jnz @f + dec esi + dec edi +@@: +.main: + push esi +@@: + lodsb + test al, al + jnz @b + dec esi + mov ebx, esi + sub ebx, [esp] + dec esi + push esi + mov esi, [ebp + PanelData.index] + shl esi, 2 + add esi, [ebp + PanelData.files] + mov esi, [esi] + add esi, 40 + push esi +@@: + lodsb + test al, al + jnz @b + add ebx, esi + sub ebx, [esp] + dec esi + cmp ebx, ecx + jbe @f + mov al, '.' + stosb + stosb + stosb + sub ecx, 3 + mov ebx, ecx +@@: + add edi, ebx + inc ecx + std +@@: + movsb + dec ecx + jz .nodir + cmp esi, [esp] + jae @b + mov esi, [esp+4] + mov al, '/' + stosb + dec ecx + jz .nodir +@@: + cmp esi, [esp+8] + jb .nodir + movsb + loop @b +.nodir: + cld + pop eax + pop eax + pop eax + ret + +draw_window: + push SF_REDRAW + pop eax + push SSF_BEGIN_DRAW + pop ebx + int 40h + mov al, SF_STYLE_SETTINGS + mov bl, SSF_GET_SKIN_HEIGHT + int 40h + mov [skinh], eax + mov ebx, [cur_width] + imul ebx, font_width + add ebx, 100*65536 + 5*2-1 + mov ecx, [cur_height] + imul ecx, font_height + lea ecx, [eax+ecx+5-1+100*65536] + xor eax, eax + mov edx, 0x53000000 + mov edi, header + int 40h + mov al, SF_DRAW_RECT + xor edx, edx + cmp [fill_width], 0 + jz @f + mov ebx, [wnd_width] + sub ebx, [fill_width] + sub ebx, 5-1 + shl ebx, 16 + mov bx, word [fill_width] + mov ecx, [skinh-2] + mov cx, word [wnd_height] + sub cx, word [skinh] + sub cx, 5-1 + int 0x40 +@@: + cmp [fill_height], 0 + jz @f + xor edx, edx + mov ebx, 50000h + mov bx, word [wnd_width] + sub ebx, 9 + mov ecx, [wnd_height] + sub ecx, [fill_height] + sub ecx, 5-1 + shl ecx, 16 + mov cx, word [fill_height] + int 0x40 +@@: +; xor ecx, ecx +; call draw_image + mov al, SF_PUT_IMAGE_EXT + mov ebx, [MemForImage] + test ebx, ebx + jz @f + mov ecx, [cur_width] + imul ecx, font_width*10000h + mov cx, word [cur_height] + imul cx, font_height + mov edx, [skinh] + add edx, 5*10000h + mov esi, 8 + mov edi, console_colors + xor ebp, ebp + int 0x40 +@@: + mov al, SF_REDRAW + push SSF_END_DRAW + pop ebx + int 40h + ret + +draw_image.nomem: + mov al, SF_DRAW_RECT + xor edx, edx + mov ebx, [cur_width] + imul ebx, font_width + add ebx, 5*65536 + mov ecx, [skinh-2] + mov cx, word [cur_height] + imul cx, font_height + int 40h + mov al, SF_DRAW_TEXT + mov ebx, 32*65536+32 + mov ecx, 0xFFFFFF + mov edx, nomem_draw + push nomem_draw.size + pop esi + int 40h + ret + +align 16 +draw_image: + mov [bMemForImageValidData], byte 1 + cmp [MemForImage], 0 + jnz .allocated +; allocate memory for image + mov ecx, [cur_width] + imul ecx, [cur_height] + imul ecx, font_width*font_height + call pgalloc + test eax, eax + jz draw_image.nomem + mov [MemForImage], eax + mov [bMemForImageValidData], byte 0 +.allocated: + push ebp + and [max_x], 0 + or [min_x], -1 + and [max_y], 0 + or [min_y], -1 + mov eax, [cursor_y] + mul [cur_width] + add eax, [cursor_x] + add eax, eax + add eax, [console_data_ptr] + xchg [cur_cursor_pos], eax + mov [old_cursor_pos], eax + mov edi, [MemForImage] + mov esi, [console_data_ptr] + mov ecx, [cur_height] +.lh: + push ecx + mov ecx, [cur_width] +.lw: + push ecx + mov eax, [cur_width] + imul eax, [cur_height] + mov ebx, [esi] + cmp [bMemForImageValidData], 0 + jz @f + cmp esi, [cur_cursor_pos] + jz @f + cmp esi, [old_cursor_pos] + jz @f + cmp bx, [eax*2+esi] + jnz @f + inc esi + inc esi + jmp .skip_symbol +@@: + mov [eax*2+esi], bx + cmp ecx, [min_x] + ja @f + mov [min_x], ecx +@@: + cmp ecx, [max_x] + jb @f + mov [max_x], ecx +@@: + mov eax, [esp+4] + mov [min_y], eax + cmp eax, [max_y] + jb @f + mov [max_y], eax +@@: + push edi + xor eax, eax + mov al, [esi+1] + and al, 0xF + mov ebx, eax + mov al, [esi+1] + shr al, 4 + mov ebp, eax + sub ebx, ebp + lodsb + inc esi +if font_width > 8 + lea edx, [eax+eax+font] +else + lea edx, [eax+font] +end if +.sh: + mov ecx, [edx] +repeat font_width + shr ecx, 1 + sbb eax, eax + and eax, ebx + add eax, ebp + mov [edi+%-1], al +end repeat + mov eax, [cur_width] +; imul eax, font_width +; add edi, eax +if font_width = 6 + lea eax, [eax*2+eax] + lea edi, [edi+eax*2] +else if font_width = 7 + lea edi, [edi+eax*8] + sub edi, eax +else if font_width = 8 + lea edi, [edi+eax*8] +else if font_width = 9 + lea edi, [edi+eax*8] + add edi, eax +else if font_width = 10 + lea eax, [eax*4+eax] + lea edi, [edi+eax*2] +else +Unknown font_width value! +end if +if font_width > 8 + add edx, 256*2 + cmp edx, font+256*2*font_height +else + add edx, 256 + cmp edx, font+256*font_height +end if + jb .sh + pop edi +.skip_symbol: + pop ecx + add edi, font_width + dec ecx + jnz .lw + mov eax, [cur_width] + imul eax, (font_height-1)*font_width + add edi, eax + pop ecx + dec ecx + jnz .lh +; cursor + mov eax, [cursor_y] + inc eax + jz .nocursor + mul [cur_width] + imul eax, font_height*font_width + mov edx, [cursor_x] + inc edx + imul edx, font_width + add eax, edx + add eax, [MemForImage] + mov edx, [cur_width] + imul edx, font_width + neg edx + mov ecx, [cursor_size] +.cursor_loop: + push ecx + mov ecx, font_width + add eax, edx + push eax +@@: +;; add byte [eax-1], 0x10 + xor byte [eax-1], 7 + sub eax, 1 + loop @b + pop eax + pop ecx + loop .cursor_loop +.nocursor: + cmp [min_y], -1 + jz .nodraw + mov ecx, [cur_width] + mov ebx, [cur_height] + mov eax, ebx + sub ebx, [max_y] + sub eax, [min_y] + sub eax, ebx + inc eax + imul ebp, eax, font_height + mov edx, ecx + sub edx, [max_x] + imul edx, font_width + mov eax, edx + shl edx, 16 + imul dx, bx, font_height + imul ebx, [cur_width] + mov ecx, [max_x] + sub ecx, [min_x] + inc ecx + imul ecx, font_width*10000h + add ecx, ebp + imul ebx, font_width*font_height + add ebx, [MemForImage] + add ebx, eax + add edx, [skinh] + add edx, 5*10000h + imul esi, [cur_width], font_width + mov ebp, ecx + shr ebp, 16 + sub esi, ebp + mov ebp, esi + push SF_PUT_IMAGE_EXT + pop eax + mov edi, console_colors + push 8 + pop esi + int 40h +.nodraw: + pop ebp + ret + +get_console_ptr: +; in: eax=x, edx=y +; out: edi->console data + push edx + imul edx, [cur_width] + add edx, eax + mov edi, [console_data_ptr] + lea edi, [edi + edx*2] + pop edx + ret + +;description: +; draw keys F1-F12 +align 16 +draw_keybar: + pushad + xor eax, eax + test [ctrlstate], 3 + jz @f + inc eax +@@: + test [ctrlstate], 0xC + jz @f + or al, 2 +@@: + test [ctrlstate], 0x30 + jz @f + or al, 4 +@@: + imul eax, 6*12 ; ⥪ * ᫮ F1-F12 + mov esi, [active_screen_keybar] + add esi, eax + xor ecx, ecx + inc ecx + xor eax, eax + mov edx, [cur_height] + dec edx + call get_console_ptr + push 6 + pop ebx + mov eax, [cur_width] + sub eax, 11+9+3*2+6 + cmp eax, 7*11 + jl @f + cdq + mov bl, 11 + div ebx + mov ebx, eax +@@: + xor edx, edx ; ஫ 室 । +.l: + add edx, 7 + cmp cl, 10 + jb @f + inc edx +@@: + cmp edx, [cur_width] + ja .ret + cmp cl, 10 + jae .twodig + lea eax, [ecx+'0'] + stosb + mov al, [keybar_number_color] + stosb + jmp .cmn +.twodig: + mov al, cl + cbw + div [_10] + add al, '0' + stosb + mov al, [keybar_number_color] + stosb + xchg al, ah + add al, '0' + stosw +.cmn: + mov ah, [keybar_name_color] + push ecx + mov cl, 6 +@@: + lodsb + stosw + loop @b + mov al, ' ' + lea ecx, [ebx-6] + cmp byte [esp], 12 + jz .ret_pop + add edx, ecx + rep stosw + pop ecx + inc edx + cmp edx, [cur_width] + ja .ret + mov ah, [keybar_bgr_color] + stosw + inc ecx + jmp .l +.ret_pop: + pop ecx +.ret: + cmp byte [edi-2], ' ' + jnz @f + dec edi + dec edi +@@: + push edi + xor eax, eax + mov edx, [cur_height] + call get_console_ptr + mov ecx, edi + pop edi + sub ecx, edi + shr ecx, 1 + mov al, ' ' + mov ah, [keybar_name_color] + rep stosw ;᪠ 梥 + + cmp [bDisplayQuickSearch], 0 + jz @f + push QuickSearchDlg + call DrawDialogBox +@@: + popad + ret + +align 16 +draw_cmdbar: + mov esi, [active_panel] + add esi, PanelData.dir + xor eax, eax + mov edx, [cur_height] + dec edx + dec edx + call get_console_ptr + mov ah, [cmdbar_prefix_color] + mov ecx, [cur_width] + dec ecx +@@: + lodsb + test al, al + jz @f + stosw + loop @b +@@: + mov al, '>' + stosw + mov al, ' ' + mov ah, [cmdbar_normal_color] + rep stosw + ret + +align 16 +draw_border: + push edi + mov al, 0xC9 + stosw + mov al, 0xCD + lea ecx, [ebx-2] + rep stosw + mov al, 0xBB + stosw + pop edi + add edi, [cur_width] + add edi, [cur_width] + lea ecx, [edx-2] +.l: + push edi + mov al, 0xBA + stosw + mov al, 0x20 + push ecx + lea ecx, [ebx-2] + rep stosw + pop ecx + mov al, 0xBA + stosw + pop edi + add edi, [cur_width] + add edi, [cur_width] + loop .l + mov al, 0xC8 + stosw + mov al, 0xCD + lea ecx, [ebx-2] + rep stosw + mov al, 0xBC + stosw + ret + +calc_colwidths: +; in: ebp->panel data + imul esi, [ebp + PanelData.colmode], PanelMode.size + add esi, colmodes + lodsd + mov ecx, eax + lea edx, [ecx-1] + xor ebx, ebx + add esi, PanelMode.ColumnWidths-4 + push ecx esi + xor eax, eax +.loop: + lodsb + add edx, eax + cmp al, 1 + adc ebx, 0 + loop .loop + pop esi ecx + lea edi, [ebp + PanelData.colwidths] + test ebx, ebx + jz .loop2 + mov eax, [ebp + PanelData.width] + dec eax + dec eax + sub eax, edx + jae @f + xor eax, eax +@@: + xor edx, edx + div ebx + test eax, eax + jnz @f + xor edx, edx + inc eax +@@: + push eax +.loop2: + movzx eax, byte [esi] + inc esi + test eax, eax + jnz @f + pop eax + push eax + dec ebx + cmp ebx, edx + jae @f + inc eax +@@: + stosd + loop .loop2 + pop eax + and dword [edi], 0 + ret + +GetPanelTitle_default: + mov edi, [esp+8] + mov ecx, 1024 + mov esi, [esp+12] + test esi, esi + jz .nohost + mov edx, esi +@@: + lodsb + test al, al + jz @f + cmp al, '/' + jnz @b + mov edx, esi + jmp @b +@@: + mov esi, edx +@@: + lodsb + stosb + test al, al + loopnz @b + dec edi + inc ecx +.nohost: + mov esi, [esp+16] + cmp word [esi], '/' + jz .nodir +@@: + lodsb + stosb + test al, al + loopnz @b + dec edi +.nodir: + mov byte [edi], 0 + ret 10h + +;input: +; ebp - pointer to panel1 or panel2 +align 16 +draw_panel: + mov eax, [ebp + PanelData.left] + mov edx, [ebp + PanelData.top] + call get_console_ptr +; draw border + mov ah, [panel_border_color] + mov ebx, [ebp + PanelData.width] + mov edx, [ebp + PanelData.height] + call draw_border + push eax + mov eax, [ebp + PanelData.left] + mov edx, [ebp + PanelData.top] + add edx, [ebp + PanelData.height] + sub edx, 3 + call get_console_ptr + pop eax + mov al, 0xC7 + stosw + mov al, 0xC4 + lea ecx, [ebx-2] + rep stosw + mov al, 0xB6 + stosw + + imul esi, [ebp + PanelData.colmode], PanelMode.size + add esi, colmodes + lodsd + mov ecx, eax ; number of columns + lea ebx, [ebp + PanelData.colwidths] + mov eax, [ebp + PanelData.left] + inc eax + mov [column_left], eax + mov eax, [ebp + PanelData.top] + inc eax + mov [column_top], eax + mov eax, [ebp + PanelData.height] + sub eax, 4 + mov [column_height], eax + dec eax + mov [ebp + PanelData.colsz], eax + and [ebp + PanelData.colst], 0 + mov eax, [ebp + PanelData.start] + mov [column_index], eax + mov [last_column_index], eax +.columns_loop: + push ecx + mov eax, [ebx] + add ebx, 4 + mov [column_width], eax + cmp ecx, 1 + jz .skip_right_border + add eax, [column_left] + mov edx, [ebp + PanelData.top] + call get_console_ptr + mov ah, [panel_header_color] + mov al, 0xD1 + mov [edi], ax + add edi, [cur_width] + add edi, [cur_width] + mov ecx, [column_height] + mov al, 0xB3 +@@: + mov [edi], ax + add edi, [cur_width] + add edi, [cur_width] + loop @b + mov al, 0xC1 + stosw +.skip_right_border: + mov eax, [column_left] + mov edx, [column_top] + call get_console_ptr +; ⮫ + push edi + mov edx, [esi] + and edx, 0xF + mov edx, [column_headers+edx*4] + movzx ecx, byte [edx] + inc edx + cmp ecx, [column_width] + jb @f + mov ecx, [column_width] +@@: + push ecx + sub ecx, [column_width] + neg ecx + shr ecx, 1 + mov al, ' ' + mov ah, [column_header_color] + rep stosw + pop ecx + jecxz .skipcopyhdr + push ecx +@@: + mov al, [edx] + inc edx + stosw + loop @b + pop ecx +.skipcopyhdr: + sub ecx, [column_width] + neg ecx + inc ecx + shr ecx, 1 + mov al, ' ' + rep stosw + pop edi + add edi, [cur_width] + add edi, [cur_width] +; ᠬ ⮫ + mov eax, [esi] + and eax, 0xF + push ebx esi + call dword [draw_column_proc+eax*4] + pop esi ebx + inc esi + mov eax, [column_width] + inc eax + add [column_left], eax + pop ecx + dec ecx + jnz .columns_loop +; (⥪ ) + lea esi, [ebp + PanelData.dir] + mov eax, [ebp + PanelData.hPlugin] + test eax, eax + jz .native + push ebp + push esi + mov esi, [ebp + PanelData.parents] + add esi, [ebp + PanelData.parents_sz] +@@: + dec esi + cmp byte [esi-1], 0 + jnz @b + push esi + push execdata + push [ebp + PanelData.hFile] + call [eax+PluginInfo.GetPanelTitle] + pop ebp + mov esi, execdata +.native: + mov edi, cur_header + mov ecx, [ebp + PanelData.width] + sub ecx, 6 + cmp byte [esi], '/' + jnz .copy_rest + dec ecx + movsb +@@: + lodsb + stosb + dec ecx + test al, al + jz .header_created + cmp al, '/' + jnz @b +.copy_rest: + mov edx, esi +@@: + lodsb + test al, al + jnz @b + sub esi, edx + dec esi + cmp esi, ecx + jbe @f + mov word [edi], '..' + mov byte [edi+2], '.' + add edi, 3 + sub ecx, 3 + add edx, esi + sub edx, ecx +@@: + mov esi, edx +@@: + lodsb + stosb + dec ecx + test al, al + jnz @b +.header_created: + mov edx, [ebp + PanelData.top] + mov eax, [ebp + PanelData.left] + shr ecx, 1 + lea eax, [eax+ecx+3] + call get_console_ptr + mov ah, [panel_active_header_color] + cmp ebp, [active_panel] + jz @f + mov ah, [panel_header_color] +@@: + mov al, ' ' + stosw + mov esi, cur_header +@@: + lodsb + test al, al + jz @f + stosw + jmp @b +@@: + mov al, ' ' + stosw + mov edx, [ebp + PanelData.top] + inc edx + mov eax, [ebp + PanelData.left] + inc eax + call get_console_ptr + movzx eax, [ebp + PanelData.sortmode] + mov al, [compare_names+eax] + stosb + mov eax, [ebp + PanelData.selected_num] + test eax, eax + jz .skip_selected_info +; ଠ 뤥 䠩 + push dword [ebp + PanelData.selected_size+4] + push dword [ebp + PanelData.selected_size] + call fill_total_info + mov eax, [ebp + PanelData.width] + sub eax, 2 + cmp ecx, eax + jbe @f + mov ecx, eax + mov edi, saved_file_name+512 + sub edi, eax + mov byte [edi], '.' + mov word [edi+1], '..' +@@: + mov esi, edi + sub eax, ecx + shr eax, 1 + inc eax + add eax, [ebp + PanelData.left] + mov edx, [ebp + PanelData.top] + add edx, [ebp + PanelData.height] + sub edx, 3 + call get_console_ptr + mov ah, [panel_numselected_color] +@@: + lodsb + stosw + loop @b +.skip_selected_info: +; ଠ 饬 ᫥ ࠧ 䠩 + mov eax, [ebp + PanelData.total_num] + push dword [ebp + PanelData.total_size+4] + push dword [ebp + PanelData.total_size] + call fill_total_info + mov eax, [ebp + PanelData.width] + sub eax, 2 + cmp ecx, eax + jbe @f + mov ecx, eax + mov byte [edi+ecx-3], '.' + mov word [edi+ecx-2], '..' +@@: + sub eax, ecx + shr eax, 1 + inc eax + add eax, [ebp + PanelData.left] + add edx, [ebp + PanelData.top] + add edx, [ebp + PanelData.height] + dec edx + mov esi, edi + call get_console_ptr + mov ah, [panel_number_color] +@@: + lodsb + stosw + loop @b + cmp [ebp + PanelData.numfiles], 0 + jz .skip_curinfo +; ଠ ⥪饬 䠩 + mov ebx, [ebp + PanelData.index] + mov eax, [ebp + PanelData.files] + mov ebx, [eax+ebx*4] + mov eax, [ebp + PanelData.left] + add eax, [ebp + PanelData.width] + dec eax + mov edx, [ebp + PanelData.top] + add edx, [ebp + PanelData.height] + dec edx + dec edx + call get_console_ptr + mov ecx, [ebp + PanelData.width] + dec ecx + dec ecx + cmp [ebp + PanelData.colmode], 3 + jz .show_curname +; ६ 䨪樨 + sub edi, 5*2 + sub ecx, 6 + mov al, [ebx+24+2] + aam + or ax, 0x3030 + mov [edi], ah + mov [edi+2], al + mov [edi+4], byte ':' + mov al, [ebx+24+1] + aam + or ax, 0x3030 + mov [edi+6], ah + mov [edi+8], al + mov al, [panel_normal_color] + mov [edi+1], al + mov [edi+3], al + mov [edi+5], al + mov [edi+7], al + mov [edi+9], al + dec edi + mov [edi], al + dec edi + mov byte [edi], ' ' +; 䨪樨 + sub edi, 8*2 + sub ecx, 9 + mov al, [ebx+28+0] + aam + or ax, 0x3030 + mov [edi], ah + mov [edi+2], al + mov [edi+4], byte '.' + mov al, [ebx+28+1] + aam + or ax, 0x3030 + mov [edi+6], ah + mov [edi+8], al + mov [edi+10], byte '.' + mov ax, [ebx+28+2] + div [_100] + mov al, ah + aam + or ax, 0x3030 + mov [edi+12], ah + mov [edi+14], al + mov al, [panel_normal_color] + mov [edi+1], al + mov [edi+3], al + mov [edi+5], al + mov [edi+7], al + mov [edi+9], al + mov [edi+11], al + mov [edi+13], al + mov [edi+15], al + dec edi + mov [edi], al + dec edi + mov [edi], byte ' ' +; + std + mov ah, [panel_normal_color] + dec edi + dec edi + dec ecx + test byte [ebx], 0x10 + jz .size_file + push ecx + mov esi, aFolder+aFolder.size-1 + mov ecx, aFolder.size + cmp word [ebx+40], '..' + jnz @f + cmp byte [ebx+42], 0 + jnz @f + mov esi, aUp+aUp.size-1 + mov cl, aUp.size +@@: + sub [esp], ecx +@@: + lodsb + stosw + loop @b + pop ecx + jmp .size_done +.size_file: + mov edx, [ebx+36] + test edx, edx + jz .size_less_4g + cmp edx, 10*256 + jae .size_tera +; + mov al, 'G' + shl edx, 2 + jmp .size_letter +.size_tera: +; ࠡ + shr edx, 8 + mov al, 'T' + jmp .size_letter +.size_less_4g: + mov edx, [ebx+32] + cmp edx, 10*(1 shl 20) + jae .size_mega + cmp edx, 1 shl 20 + jb .size_num + shr edx, 10 + mov al, 'K' + jmp .size_letter +.size_mega: + mov al, 'M' + shr edx, 20 +.size_letter: + stosw + dec ecx + mov al, ' ' + stosw + dec ecx +.size_num: + xchg eax, edx + xor edx, edx + div [_10d] + xchg eax, edx + add al, '0' + mov ah, [panel_normal_color] + stosw + dec ecx + test edx, edx + jnz .size_num +.size_done: + cld +.show_curname: +; + sub edi, ecx + sub edi, ecx + lea esi, [ebx+40] +@@: + lodsb + test al, al + jnz @b + sub esi, ebx + sub esi, 41 + mov ah, [panel_normal_color] + cmp esi, ecx + lea edx, [ebx+40] + jbe @f + mov al, '{' + mov [edi-2], ax + add edx, esi + sub edx, ecx +@@: + mov esi, edx +@@: + lodsb + test al, al + jz @f + stosw + loop @b +@@: + mov al, ' ' + rep stosw +.skip_curinfo: + call draw_image + ret + +fill_total_info: + mov edi, saved_file_name+511 + mov byte [edi], ' ' +if lang eq ru_RU + mov byte [edi-1], '' + dec edi + cmp eax, 1 + jz @f + mov word [edi-1], '' + dec edi +@@: + mov dword [edi-4], '䠩' + mov byte [edi-5], ' ' + sub edi, 5 +else ; Default to en_US + cmp eax, 1 + jz @f + dec edi + mov byte [edi], 's' +@@: + mov dword [edi-4], 'file' + mov byte [edi-5], ' ' + sub edi, 5 +end if + xor edx, edx + push 10 + pop ecx +@@: + div ecx + dec edi + add dl, '0' + mov [edi], dl + xor edx, edx + test eax, eax + jnz @b +if lang eq ru_RU + mov dword [edi-4], ' ' + mov dword [edi-8], ' ' + sub edi, 8 +else ; Default to en_US + mov dword [edi-4], ' in ' + mov dword [edi-8], 'ytes' + mov word [edi-10], ' b' + sub edi, 10 +end if + lea esi, [edi-3] + mov edx, [esp+8] + mov eax, [esp+4] +.selsizel: + push edx + mov ebx, edx + xor edx, edx + add ebx, ebx + adc edx, edx + push ebx + push edx + add ebx, ebx + adc edx, edx + add ebx, [esp+4] + adc edx, [esp] + add esp, 8 + add eax, ebx + adc edx, 0 + div ecx + dec edi + cmp edi, esi + jae @f + mov byte [edi], ',' + dec edi + sub esi, 4 +@@: + pop ebx + add dl, '0' + mov byte [edi], dl + xchg eax, ebx + mul [muldiv10] + add eax, ebx + adc edx, 0 + mov ebx, eax + or ebx, edx + jnz .selsizel + dec edi + mov byte [edi], ' ' + mov ecx, saved_file_name+512 + sub ecx, edi + ret 8 + +align 4 +get_file_color: + mov ah, [esi + 6] + cmp ebp, [active_panel] + jnz @f + cmp ecx, [ebp + PanelData.index] + jnz @f + mov ah, [esi + 7] +@@: + test byte [esi + 303], 1 + jnz @f + mov ah, [esi + 4] + cmp ebp, [active_panel] + jnz @f + cmp ecx, [ebp + PanelData.index] + jnz @f + mov ah, [esi + 5] +@@: + ret + +align 4 +draw_name_column: + mov eax, [column_index] + mov [last_column_index], eax + mov edx, [ebp + PanelData.numfiles] + mov ecx, [column_height] + dec ecx +.l: + cmp [column_index], edx + jae .ret + push ecx + mov ecx, [column_index] + mov esi, [ebp + PanelData.files] + mov esi, [esi+ecx*4] + mov ebx, [esi] + call get_file_color + add esi, 40 + mov ecx, [column_width] + push edi +@@: + lodsb + test al, al + jz @f + stosw + loop @b + lodsb + test al, al + jz @f + mov byte [edi], '}' + jmp .continue +@@: + test bl, 10h + jnz .noalignext + mov ebx, [ebp + PanelData.colmode] +; sizeof(PanelMode) = 40 + lea ebx, [ebx+ebx*4] + cmp [colmodes+ebx*8+PanelMode.bAlignExtensions], 0 + jz .noalignext + push ecx + sub ecx, [column_width] + neg ecx + jz .noalignext2 + dec esi +@@: + dec esi + cmp byte [esi], '.' + loopnz @b + jnz .noalignext2 + inc esi + sub ecx, [column_width] + neg ecx + sub ecx, [esp] + sub edi, ecx + sub edi, ecx + dec ecx + mov ebx, [esp+4] + cmp ecx, 3 + ja @f + mov cl, 3 +@@: + sub ecx, [column_width] + sub ebx, edi + sar ebx, 1 + sub ebx, ecx + pop ecx + inc ecx + push 0 + cmp ecx, ebx + jbe @f + sub ecx, ebx + mov [esp], ecx + mov ecx, ebx +@@: + mov al, ' ' + rep stosw +@@: + lodsb + test al, al + jz .noalignext2 + stosw + jmp @b +.noalignext2: + pop ecx +.noalignext: + mov al, ' ' + rep stosw +.continue: + pop edi + add edi, [cur_width] + add edi, [cur_width] + inc [column_index] + pop ecx + dec ecx + jnz .l +.ret: + mov eax, [ebp + PanelData.colsz] + add [ebp + PanelData.colst], eax + cmp ebp, panel1 + jnz .ret2 +; ᫮ ࠭ +; calculate number of viewer and editor screens + xor ebx, ebx + xor edx, edx + mov ecx, [num_screens] + mov esi, [screens] +.3: + lodsd + cmp eax, viewer_vtable + jnz @f + inc ebx +@@: + cmp eax, editor_vtable + jnz @f + inc edx +@@: + lodsd + loop .3 + mov eax, ebx + mov esi, edx + or eax, edx + jz .ret2 + xor eax, eax + xor edx, edx + call get_console_ptr + mov al, '[' + stosb + mov al, [panel_nscreens_color] + stosb + xchg eax, ebx +.5: + push -'0' +@@: + xor edx, edx + div [_10d] + push edx + test eax, eax + jnz @b +@@: + pop eax + add eax, '0' + jz @f + stosb + mov al, bl + stosb + jmp @b +@@: + test esi, esi + jz .4 + mov al, '+' + stosb + mov al, bl + stosb + xor eax, eax + xchg eax, esi + jmp .5 +.4: + mov al, ']' + mov ah, [panel_nscreens_color] + stosw +.ret2: +draw_empty_column: + ret + +align 4 +draw_size_column: + add edi, [column_width] + add edi, [column_width] + dec edi + dec edi + std + mov ecx, [column_height] + dec ecx + push [last_column_index] +.l: + mov edx, [ebp + PanelData.numfiles] + cmp [last_column_index], edx + jae .ret + push ecx + push edi + mov ecx, [last_column_index] + mov esi, [ebp + PanelData.files] + mov esi, [esi+ecx*4] + call get_file_color + mov ecx, [column_width] +@@: + mov ebx, eax + cmp word [esi+40], '..' + jnz .nodotdot + cmp byte [esi+42], 0 + jnz .nodotdot +if lang eq ru_RU + mov al, '' + stosw + mov al, '' + stosw + mov al, '' + stosw + mov al, '' + stosw + mov al, '' + stosw + sub ecx, 5 +else ; Default to en_US + mov al, ' ' + stosw + stosw + mov al, 'p' + stosw + mov al, 'U' + stosw + sub ecx, 4 +end if + jmp .size_written +.nodotdot: + test byte [esi], 10h + jz .nofolder +if lang eq ru_RU + mov al, '' + stosw + mov al, '' + stosw + mov al, '' + stosw + mov al, '' + stosw + mov al, '' + stosw + sub ecx, 5 +else ; Default to en_US + mov al, 'r' + stosw + mov al, 'e' + stosw + mov al, 'd' + stosw + mov al, 'l' + stosw + mov al, 'o' + stosw + mov al, 'F' + stosw + sub ecx, 6 +end if + jmp .size_written +.nofolder: + mov eax, [esi+32] + mov edx, [esi+36] + test edx, edx + jz .less_4G + cmp edx, 10000/4*1024 + jb .giga + mov al, 'T' + shr edx, 10 + jmp .write_letter +.giga: + mov al, 'G' + shl edx, 2 + jmp .write_letter +.less_4G: + mov edx, eax + cmp eax, 1000000 + jb .byte + cmp eax, 10000*1024 + jb .kilo + mov al, 'M' + shr edx, 20 + jmp .write_letter +.kilo: + mov al, 'K' + shr edx, 10 +.write_letter: + mov ah, bh + stosw + mov al, ' ' + stosw + dec ecx + dec ecx +.byte: + xchg eax, edx + xor edx, edx + div [_10d] + xchg eax, edx + add al, '0' + mov ah, bh + stosw + dec ecx + test edx, edx + jnz .byte +.size_written: + mov eax, ebx + test ecx, ecx + jle @f + mov al, ' ' + rep stosw +@@: + mov byte [edi+1], ah + pop edi + add edi, [cur_width] + add edi, [cur_width] + inc [last_column_index] + pop ecx + dec ecx + jnz .l +.ret: + pop [last_column_index] + cld + ret + +align 4 +draw_date_column: + mov ecx, [column_height] + dec ecx + push [last_column_index] +.l: + mov edx, [ebp + PanelData.numfiles] + cmp [last_column_index], edx + jae .ret + push ecx + push edi + mov ecx, [last_column_index] + mov esi, [ebp + PanelData.files] + mov esi, [esi+ecx*4] + call get_file_color + mov bh, ah + mov byte [edi-1], bh + mov al, [esi+28] + aam + add eax, '00' + push eax + mov al, ah + mov ah, bh + stosw + pop eax + mov ah, bh + stosw + mov al, '.' + stosw + mov al, [esi+29] + aam + add eax, '00' + push eax + mov al, ah + mov ah, bh + stosw + pop eax + mov ah, bh + stosw + mov al, '.' + stosw + movzx eax, word [esi+30] + xor edx, edx + div [_10d] + xchg eax, edx + add al, '0' + mov ah, bh + mov [edi+2], ax + xchg eax, edx + xor edx, edx + div [_10d] + xchg eax, edx + add al, '0' + mov ah, bh + stosw + pop edi + add edi, [cur_width] + add edi, [cur_width] + inc [last_column_index] + pop ecx + dec ecx + jnz .l +.ret: + pop [last_column_index] + cld + ret + +align 4 +draw_time_column: + mov ecx, [column_height] + dec ecx + push [last_column_index] +.l: + mov edx, [ebp + PanelData.numfiles] + cmp [last_column_index], edx + jae .ret + push ecx + push edi + mov ecx, [last_column_index] + mov esi, [ebp + PanelData.files] + mov esi, [esi+ecx*4] + call get_file_color + mov bh, ah + mov byte [edi-1], bh + mov al, [esi+26] + aam + add eax, '00' + push eax + mov al, ah + mov ah, bh + stosw + pop eax + mov ah, bh + stosw + mov al, ':' + stosw + mov al, [esi+25] + aam + add eax, '00' + push eax + mov al, ah + mov ah, bh + stosw + pop eax + mov ah, bh + stosw + pop edi + add edi, [cur_width] + add edi, [cur_width] + inc [last_column_index] + pop ecx + dec ecx + jnz .l +.ret: + pop [last_column_index] + cld + ret + +;insert_last_dot: +; push eax esi +; mov ah, 0 +;.loop: +; lodsb +; test al, al +; jz .done +; cmp al, '.' +; jnz .loop +; mov ah, 1 +; jmp .loop +;.done: +; test ah, ah +; jnz @f +; mov byte [esi-1], '.' +; mov byte [esi], 0 +;@@: +; pop esi eax +; ret + +;delete_last_dot: +; push esi +;@@: +; cmp byte [esi], 0 +; jz @f +; inc esi +; jmp @b +;@@: +; cmp byte [esi-1], '.' +; jnz @f +; mov byte [esi-1], 0 +;@@: pop esi +; ret + +align 4 +read_folder: + mov eax, [ebp + PanelData.nfa] + mov [dirinfo.size], eax + shl eax, 2 + add eax, [ebp + PanelData.files] + mov [dirinfo.dirdata], eax + lea eax, [ebp + PanelData.dir] + mov [dirinfo.name], eax + xor eax, eax + mov [ebp + PanelData.total_num], eax + mov dword [ebp + PanelData.total_size], eax + mov dword [ebp + PanelData.total_size+4], eax + mov [ebp + PanelData.selected_num], eax + mov dword [ebp + PanelData.selected_size], eax + mov dword [ebp + PanelData.selected_size+4], eax +.retry: + mov eax, [ebp + PanelData.hPlugin] + test eax, eax + jz .native + mov ecx, [dirinfo.size] + test [ebp + PanelData.plugin_flags], 1 + jz @f + dec ecx ; reserve one entry for '..' +@@: + push ebp + push [dirinfo.dirdata] + push ecx + push 0 + push [ebp + PanelData.hFile] + call [eax + PluginInfo.ReadFolder] + pop ebp + mov ebx, [dirinfo.dirdata] + mov ebx, [ebx+4] + jmp .read +.native: + push SF_FILE + pop eax + mov ebx, dirinfo + int 40h +.read: + test eax, eax + jz .ok + cmp eax, 6 + jz .ok +; Failed to read folder, notify user + cmp [bSilentFolderMode], 0 + jnz .dont_notify + push dword aContinue + push dword aRetry + mov edx, esp + call get_error_msg + push [dirinfo.name] + push dword aCannotReadFolder + push eax + mov eax, esp + push edx + push 2 + push eax + push 3 + call SayErr + add esp, 5*4 + test eax, eax + jz .retry +.dont_notify: +; If not on plugin panel, try to return to previous directory + cmp [ebp + PanelData.hPlugin], 0 + jnz @f + mov esi, prev_dir + cmp byte [esi], 0 + jz @f + lea edi, [ebp + PanelData.dir] + mov ecx, 1024/4 + rep movsd + mov byte [prev_dir], 0 + ret +@@: + mov [bSilentFolderMode], 1 ; enter silent mode +; Try to read parent folder + mov esi, [dirinfo.name] + xor edx, edx +.up1: + lodsb + test al, al + jz .up1done + cmp al, '/' + jnz .up1 + inc edx + lea edi, [esi-1] + jmp .up1 +.up1done: + cmp [ebp + PanelData.hPlugin], 0 + jz .4 + cmp edx, 1 + ja .up +; ⥭ +; ⮬ 㦥 ୥ +; , 㭪 ⥭ 㫠 0 ⮢ +; (᫨ 㦥 室 "..", 㤥 ⮬᪨) + xor ebx, ebx ; 0 items read + mov eax, [dirinfo.dirdata] + mov [eax+8], ebx ; 0 items total + jmp .ok +.4: + cmp edx, 2 + jbe .noup +.up: + stosb + jmp read_folder +.noup: +; There is no parent folder, and we are not on plugin panel +; Try to read ramdisk + mov esi, [dirinfo.name] + mov edi, esi + lodsd + or eax, 0x00202000 + cmp eax, '/rd/' + jnz @f + lodsw + cmp ax, '1' + jz .nosetrd +@@: + mov eax, '/rd/' + stosd + mov ax, '1' + stosw + jmp read_folder +.nosetrd: +; ࠬ ⠫. , 졠... + and dword [ebp + PanelData.numfiles], 0 + and dword [ebp + PanelData.index], 0 + and dword [ebp + PanelData.start], 0 + mov [bSilentFolderMode], 0 ; leave silent mode + ret +.ok: + mov eax, [dirinfo.dirdata] + cmp [eax+8], ebx + jz .readdone + push dword [eax+8] + mov ecx, [ebp + PanelData.files] + call pgfree + pop ecx + add ecx, 0xF + and ecx, not 0xF + push ecx + imul ecx, 4+304 + add ecx, 32 + call xpgalloc + test eax, eax + jnz .succ1 + pop eax + jmp .readdone +.succ1: + mov [ebp + PanelData.files], eax + pop [ebp + PanelData.nfa] + mov [prev_dir], 0 + jmp read_folder +.readdone: + xor edx, edx + mov [ebp + PanelData.start], edx + mov [ebp + PanelData.index], edx + mov [ebp + PanelData.start], edx + mov edi, [ebp + PanelData.files] + mov eax, [ebp + PanelData.nfa] + lea eax, [edi + eax*4 + 32] + mov ecx, [eax-32+4] + test ecx, ecx + jz .loopdone +; 㥬 ᯥ樠 室, ᮮ⢥騥 '.' ⪥ ⮬ +.ptrinit: + cmp word [eax+40], '.' + jz .loopcont + test byte [eax], 8 + jnz .loopcont + mov byte [eax+303], 0 + test edx, edx + jnz .nodotdot + cmp word [eax+40], '..' + jnz .nodotdot + cmp byte [eax+42], 0 + jnz .nodotdot + mov edx, eax + push edi +@@: + cmp edi, [ebp + PanelData.files] + jbe @f + push dword [edi-4] + pop dword [edi] + sub edi, 4 + jmp @b +@@: + stosd + pop edi + scasd + jmp .dotdot +.nodotdot: + stosd + xor ebx, ebx + test byte [eax], 10h + setz bl + add [ebp + PanelData.total_num], ebx + mov ebx, dword [eax+32] + add dword [ebp + PanelData.total_size], ebx + mov ebx, dword [eax+36] + adc dword [ebp + PanelData.total_size+4], ebx +.dotdot: +; ᢥ⪠ +; call insert_last_dot + call highlight_init +; call delete_last_dot +.loopcont: + add eax, 304 + dec ecx + jnz .ptrinit +.loopdone: + push edi + sub edi, [ebp + PanelData.files] + shr edi, 2 + mov [ebp + PanelData.numfiles], edi + pop edi + test edx, edx + jnz @f + test [ebp + PanelData.plugin_flags], 1 + jz @f + mov ecx, [ebp + PanelData.numfiles] + inc [ebp + PanelData.numfiles] + lea esi, [edi-4] + std + rep movsd + cld + mov eax, left_dotdot_entry + cmp ebp, panel1 + jz .zq + add eax, right_dotdot_entry-left_dotdot_entry +.zq: + stosd + call highlight_init +@@: +; ஢ +sort_files: + movzx eax, [ebp + PanelData.sortmode] + mov ebx, [compare_fns + eax*4] +.mode: + mov edx, [ebp + PanelData.files] + mov ecx, [ebp + PanelData.numfiles] + jecxz .skip + mov eax, [edx] + cmp word [eax+40], '..' + jnz .nodotdot + cmp byte [eax+42], 0 + jnz .nodotdot + dec ecx + add edx, 4 +.nodotdot: + call sort +.skip: + mov [bSilentFolderMode], 0 ; leave silent mode + ret + +align 4 +highlight_init: + pushad + mov ebp, eax + lea esi, [ebp+40] + mov edi, lower_file_name + mov edx, edi + xor eax, eax +@@: + lodsb + mov al, [tolower_table+eax] + stosb + test al, al + jnz @b + mov esi, edx + lea edx, [edi-1] + xor ecx, ecx +.highlight_test_loop: + mov ebx, [highlight_groups+ecx*4] + mov al, [ebx + highlight.IncludeAttributes] + mov ah, [ebp] + and ah, al + cmp ah, al + jnz .highlight_test_failed + lea edi, [ebx + highlight.Mask] + call match_mask_rev_lowercase + jc .highlight_test_failed + mov ah, [ebx + highlight.NormalColor] + test ah, ah + jnz @f + mov ah, [panel_normal_color] +@@: + mov [ebp+4], ah + mov ah, [ebx + highlight.CursorColor] + test ah, ah + jnz @f + mov ah, [panel_cursor_color] +@@: + mov [ebp+5], ah + mov ah, [ebx + highlight.SelectedColor] + test ah, ah + jnz @f + mov ah, [panel_selected_color] +@@: + mov [ebp+6], ah + mov ah, [ebx + highlight.SelectedCursorColor] + test ah, ah + jnz @f + mov ah, [panel_selected_cursor_color] +@@: + mov [ebp+7], ah + jmp .doname +.highlight_test_failed: + inc ecx + cmp ecx, [highlight_num_groups] + jb .highlight_test_loop +.nohighlight: + mov ah, [panel_normal_color] + mov [ebp+4], ah + mov ah, [panel_cursor_color] + mov [ebp+5], ah + mov ah, [panel_selected_color] + mov [ebp+6], ah + mov ah, [panel_selected_cursor_color] + mov [ebp+7], ah +.doname: + popad + ret + +align 4 +compare_name: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + add esi, 40 + add edi, 40 + jmp strcmpi +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +compare_name_rev: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + add esi, 40 + add edi, 40 + xchg esi, edi + jmp strcmpi +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +strcmpi: + push eax +@@: + lodsb + call match_symbol + jnz .ret + inc edi + test al, al + jnz @b +.ret: + pop eax + ret + +align 4 +compare_ext: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + add esi, 40 + add edi, 40 + push esi edi + call seek_ext + xchg esi, edi + call seek_ext + xchg esi, edi + call strcmpi + jnz .ret + pop edi esi + jmp strcmpi +.ret: + pop edi esi + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +compare_ext_rev: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + add esi, 40 + add edi, 40 + push esi edi + call seek_ext + xchg esi, edi + call seek_ext + call strcmpi + jnz .ret + pop edi esi + xchg esi, edi + jmp strcmpi +.ret: + pop edi esi + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +seek_ext: + push eax + xor eax, eax +.l: + inc esi + cmp byte [esi-1], '.' + jnz @f + mov eax, esi +@@: + cmp byte [esi-1], 0 + jnz .l + test eax, eax + jnz @f + lea eax, [esi-1] +@@: + mov esi, eax + pop eax + ret + +align 4 +compare_modified: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + push edi + mov edi, [edi+28] + cmp edi, [esi+28] + pop edi + jnz @f + push edi + mov edi, [edi+24] + cmp edi, [esi+24] + pop edi + jnz @f + add esi, 40 + add edi, 40 + jmp strcmpi +@@: + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +compare_modified_rev: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + push esi + mov esi, [esi+28] + cmp esi, [edi+28] + pop esi + jnz @f + push esi + mov esi, [esi+24] + cmp esi, [edi+24] + pop esi + jnz @f + add esi, 40 + add edi, 40 + xchg esi, edi + jmp strcmpi +@@: + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +compare_size: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + push edi + mov edi, [edi+36] + cmp edi, [esi+36] + pop edi + jnz @f + push edi + mov edi, [edi+32] + cmp edi, [esi+32] + pop edi + jnz @f + add esi, 40 + add edi, 40 + jmp strcmpi +@@: + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +compare_size_rev: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + push esi + mov esi, [esi+36] + cmp esi, [edi+36] + pop esi + jnz @f + push esi + mov esi, [esi+32] + cmp esi, [edi+32] + pop esi + jnz @f + add esi, 40 + add edi, 40 + xchg esi, edi + jmp strcmpi +@@: + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +compare_unordered: + cmp esi, edi + ret +compare_unordered_rev: + cmp edi, esi + ret + +align 4 +compare_created: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + push edi + mov edi, [edi+12] + cmp edi, [esi+12] + pop edi + jnz @f + push edi + mov edi, [edi+8] + cmp edi, [esi+8] + pop edi + jnz @f + add esi, 40 + add edi, 40 + jmp strcmpi +@@: + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +compare_created_rev: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + push esi + mov esi, [esi+12] + cmp esi, [edi+12] + pop esi + jnz @f + push esi + mov esi, [esi+8] + cmp esi, [edi+8] + pop esi + jnz @f + add esi, 40 + add edi, 40 + xchg esi, edi + jmp strcmpi +@@: + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +compare_accessed: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + push edi + mov edi, [edi+20] + cmp edi, [esi+20] + pop edi + jnz @f + push edi + mov edi, [edi+16] + cmp edi, [esi+16] + pop edi + jnz @f + add esi, 40 + add edi, 40 + jmp strcmpi +@@: + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +compare_accessed_rev: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + push esi + mov esi, [esi+20] + cmp esi, [edi+20] + pop esi + jnz @f + push esi + mov esi, [esi+16] + cmp esi, [edi+16] + pop esi + jnz @f + add esi, 40 + add edi, 40 + xchg esi, edi + jmp strcmpi +@@: + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +ReadFolder_default: + mov eax, 2 + ret 10h + +if 0 +; Following subroutines work, but are slow +match_mask: +; in: esi->name, edi->mask +; out: CF clear <=> match + pusha + xchg esi, edi +.main_cycle: + push esi +@@: + lodsb + test al, al + jz @f + cmp al, ',' + jz @f + cmp al, '|' + jnz @b +@@: + mov [esi-1], byte 0 + xchg esi, [esp] + call match_single_mask + pop esi + mov [esi-1], al + jnc .found + cmp al, ',' + jz .main_cycle +.done_fail: + stc + popa + ret +.found: + test al, al + jz .done_succ + cmp al, '|' + jz .test_exclude + lodsb + jmp .found +.done_succ: + clc + popa + ret +.test_exclude: + push esi +@@: + lodsb + test al, al + jz @f + cmp al, ',' + jnz @b +@@: + mov byte [esi-1], 0 + xchg esi, [esp] + call match_single_mask + pop esi + mov [esi-1], al + jnc .done_fail + test al, al + jz .done_succ + jmp .test_exclude + +match_single_mask: +; in: esi->mask, edi->name +; out: CF clear <=> match + pusha +.mask_symbol: + lodsb + test al, al + jz .mask_done + cmp al, '*' + jz .asterisk + cmp al, '?' + jz .quest + cmp al, '[' + jz .list + call match_symbol + jnz .done_fail + inc edi + jmp .mask_symbol +.done_fail: + stc + popa + ret +.mask_done: + scasb + jnz .done_fail +.done_succ: + clc + popa + ret +.quest: + mov al, 0 + scasb + jz .done_fail + jmp .mask_symbol +.list: + lodsb + cmp al, ']' + jz .done_fail + cmp byte [esi+1], '-' + jz .range + call match_symbol + jnz .list +.listok: + inc edi +@@: + lodsb + cmp al, ']' + jnz @b + jmp .mask_symbol +.range: + call match_symbol + ja @f + mov al, [esi+2] + call match_symbol + jae .listok +@@: + inc esi + jmp .list +.asterisk: + cmp byte [esi], 0 + jz .done_succ + cmp byte [esi], '?' + jnz @f + mov al, 0 + scasb + jz .done_fail + inc esi + jmp .asterisk +@@: + cmp byte [esi], '[' + jz .asterisk_common +; the mask is ...*... +.asterisk_normal: + mov al, [esi] +@@: + cmp byte [edi], 0 + jz .done_fail + call match_symbol + jz @f + inc edi + jmp @b +@@: + inc edi + inc esi + call match_single_mask + jnc .done_succ + dec esi + jmp .asterisk_normal +.asterisk_common: + push edi +@@: + call match_single_mask + jnc @f + mov al, 0 + scasb + jnz @b + pop edi + jmp .done_fail +@@: + pop edi + jmp .done_succ + +match_mask_rev: +; in: esi->name, edx->end of name, edi->mask +; out: CF clear <=> match + pusha + xchg esi, edx + xchg esi, edi +.main_cycle: + mov ecx, esi +@@: + lodsb + test al, al + jz @f + cmp al, ',' + jz @f + cmp al, '|' + jnz @b +@@: + dec esi + mov [esi], byte 0 + call match_single_mask_rev2 + mov [esi], al + inc esi + jnc .found + cmp al, ',' + jz .main_cycle +.done_fail: + stc + popa + ret +.found: + test al, al + jz .done_succ + cmp al, '|' + jz .test_exclude + lodsb + jmp .found +.done_succ: + clc + popa + ret +.test_exclude: + mov ecx, esi +@@: + lodsb + test al, al + jz @f + cmp al, ',' + jnz @b +@@: + dec esi + mov byte [esi], 0 + call match_single_mask_rev2 + mov [esi], al + inc esi + jnc .done_fail + test al, al + jz .done_succ + jmp .test_exclude + +match_single_mask_rev2: + pusha + jmp match_single_mask_rev.mask_symbol +match_single_mask_rev: +; in: esi->mask, edi->end of name, edx->start of name +; out: CF clear <=> match + pusha + mov ecx, esi +@@: + lodsb + test al, al + jnz @b + dec esi +; esi->end of mask, ecx->start of mask +.mask_symbol: + dec esi + cmp esi, ecx + jb .mask_done + mov al, [esi] + cmp al, '*' + jz .asterisk + cmp al, '?' + jz .quest + cmp al, ']' + jz .list + dec edi + cmp edi, edx + jb .done_fail + call match_symbol + jz .mask_symbol +.done_fail: + stc + popa + ret +.mask_done: + cmp edi, edx + jnz .done_fail +.done_succ: + clc + popa + ret +.quest: + dec edi + cmp edi, edx + jb .done_fail + jmp .mask_symbol +.list: + dec edi + cmp edi, edx + jb .done_fail +.list_check: + dec esi + cmp esi, ecx + jbe .done_fail + mov al, [esi] + cmp al, '[' + jz .done_fail + cmp byte [esi-1], '-' + jz .range + call match_symbol + jnz .list_check +.listok: +@@: + dec esi + cmp esi, ecx + jb .done_fail + cmp byte [esi], '[' + jnz @b + jmp .mask_symbol +.range: + call match_symbol + jb @f + mov al, [esi-2] + call match_symbol + jbe .listok +@@: + dec esi + dec esi + jmp .list_check +.asterisk: + cmp esi, ecx + jz .done_succ + cmp byte [esi-1], '?' + jnz @f + cmp edi, edx + jz .done_fail + dec esi + jmp .asterisk +@@: + cmp byte [esi-1], ']' + jz .asterisk_common +; the mask is ...*... +.asterisk_normal: + mov al, [esi-1] +@@: + cmp edi, edx + jz .done_fail + call match_symbol + jz @f + dec edi + jmp @b +@@: + dec edi + dec esi + call match_single_mask_rev2 + jnc .done_succ + inc esi + jmp .asterisk_normal +.asterisk_common: + push edi +@@: + call match_single_mask_rev2 + jnc @f + dec edi + cmp edi, edx + jae @b + pop edi + jmp .done_fail +@@: + pop edi + jmp .done_succ +end if + +;tolower: +; push ecx +; movzx ecx, al +; mov al, [tolower_table+ecx] +; pop ecx +; ret + +match_symbol: +; in: al,[edi]=symbols +; out: flags as 'cmp al,[edi]' + push eax ecx + movzx ecx, al + mov al, [tolower_table+ecx] + movzx ecx, byte [edi] + cmp al, [tolower_table+ecx] + pop ecx eax + ret + +match_mask_rev_lowercase: +; in: esi->name, edx->end of name, edi->mask +; out: CF clear <=> match + pusha + xchg esi, edx + xchg esi, edi +.main_cycle: + mov ecx, esi +@@: + lodsb + test al, al + jz @f + cmp al, ',' + jz @f + cmp al, ';' + jz @f + cmp al, '|' + jnz @b +@@: + dec esi + mov [esi], byte 0 + call match_single_mask_rev_lowercase + mov [esi], al + inc esi + jnc .found + cmp al, ',' + jz .main_cycle + cmp al, ';' + jz .main_cycle +.done_fail: + stc + popa + ret +.found: + test al, al + jz .done_succ + cmp al, '|' + jz .test_exclude + lodsb + jmp .found +.done_succ: + clc + popa + ret +.test_exclude: + mov ecx, esi +@@: + lodsb + test al, al + jz @f + cmp al, ',' + jz @f + cmp al, ';' + jnz @b +@@: + dec esi + mov byte [esi], 0 + call match_single_mask_rev_lowercase + mov [esi], al + inc esi + jnc .done_fail + test al, al + jz .done_succ + jmp .test_exclude + +match_single_mask_rev_lowercase: +; in: esi->end of mask, ecx->start of mask, edi->end of name, edx->start of name +; out: CF clear <=> match + push esi edi eax +.mask_symbol: + dec esi + cmp esi, ecx + jb .mask_done + mov al, [esi] + cmp al, '*' + jz .asterisk + dec edi + cmp edi, edx + jb .done_fail + cmp al, '?' + jz .mask_symbol + cmp al, ']' + jz .list_check + cmp al, [edi] + jz .mask_symbol +.done_fail: + stc + pop eax edi esi + ret +.mask_done: + cmp edi, edx + jnz .done_fail +.done_succ: + clc + pop eax edi esi + ret +.list_check: + dec esi + cmp esi, ecx + jbe .done_fail + mov al, [esi] + cmp al, '[' + jz .done_fail + cmp byte [esi-1], '-' + jz .range + cmp al, [edi] + jnz .list_check +.listok: +@@: + dec esi + cmp esi, ecx + jb .done_fail + cmp byte [esi], '[' + jnz @b + jmp .mask_symbol +.range: + cmp al, [edi] + jb @f + mov al, [esi-2] + cmp al, [edi] + jbe .listok +@@: + dec esi + dec esi + jmp .list_check +.asterisk: + cmp esi, ecx + jz .done_succ + cmp byte [esi-1], '?' + jnz @f + cmp edi, edx + jz .done_fail + dec esi + dec edi + jmp .asterisk +@@: + cmp byte [esi-1], ']' + jz .asterisk_common +; the mask is ...*... +.asterisk_normal: + mov al, [esi-1] +@@: + dec edi + cmp edi, edx + jb .done_fail + cmp al, [edi] + jnz @b +@@: + dec esi + call match_single_mask_rev_lowercase + jnc .done_succ + inc esi + jmp .asterisk_normal +.asterisk_common: + push edi +@@: + call match_single_mask_rev_lowercase + jnc @f + dec edi + cmp edi, edx + jae @b + pop edi + jmp .done_fail +@@: + pop edi + jmp .done_succ + +find_extension: + lea esi, [ecx+40] + push esi +@@: + lodsb + test al, al + jnz @b +@@: + dec esi + cmp byte [esi], '.' + jz .found_ext + cmp esi, [esp] + ja @b +; empty extension + pop esi + stc + ret +.found_ext: + inc esi + mov edi, [associations] + test edi, edi + jz .notfound +.find_loop: + push esi edi + call strcmpi + pop edi esi + pushf +@@: + inc edi + cmp byte [edi-1], 0 + jnz @b + popf + jz .found +@@: + inc edi + cmp byte [edi-1], 0 + jnz @b + cmp byte [edi], 0 + jnz .find_loop +.notfound: +; unknown extension + stc +.found: + pop esi + ret + +header db 'Kolibri Far ',version,0 + +nomem_draw db 'No memory for redraw.',0 +.size = $ - nomem_draw + +def_left_dir db '/sys',0 +def_right_dir db '/hd0/1',0 + +bSilentFolderMode db 1 + +bQuickSearchMode db 0 +bDisplayQuickSearch db 0 + +if lang eq ru_RU +aFolder db '' +.size = $-aFolder +aUp db '' +.size = $-aUp +aDrive db '',0 +aScreens db '࠭',0 +else ; Default to en_US +aFolder db 'Folder' +.size = $-aFolder +aUp db 'Up' +.size = $-aUp +aDrive db 'Drive',0 +aScreens db 'Screens',0 +end if + +align 4 +_10d dd 10 +_100d dd 100 +muldiv10 dd 429496729 +_10 db 10 +_100 db 100 + +fpu_cw dw 000011100111111b + +keybar_panels: +if lang eq ru_RU +; -䨪஢ + db '' + db '짌' + db ' ' + db '' + db ' ' + db '७ ' + db ' ' + db '' + db '䌭' + db '室 ' + db '㫨' + db '࠭' +; Shift + db '' + db 'ᯠ' + db '劮' + db '.' + db ' ' + db '२' + db ' ' + db '' + db '࠭' + db '᫤' + db '㯯' + db '࠭' +; Ctrl + db ' ' + db 'ࠢ' + db ' ' + db '' + db ' ' + db '' + db '' + db '' + db '' + db 'ᠭ' + db '' + db ' ' +; Ctrl+Shift + db ' ' + db ' ' + db ' ' + db '' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' +; Alt + db ' ' + db 'ࠢ' + db '.' + db ' ' + db '' + db ' ' + db '᪠' + db ' ' + db ' ' + db 'ॢ' + db ' ' + db '⏠' +; Alt+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db '䏫' + db ' ' + db ' ' + db ' ' +; Alt+Ctrl +times 12 db ' ' +; Alt+Ctrl+Shift +times 12 db ' ' + +else ; Default to en_US +; No modificators + db 'Help ' + db 'UserMn' + db 'View ' + db 'Edit ' + db 'Copy ' + db 'RenMov' + db 'MkFold' + db 'Delete' + db 'ConfMn' + db 'Quit ' + db 'Plugin' + db 'Screen' +; Shift + db 'Add ' + db 'Extrct' + db 'ArcCmd' + db 'Edit..' + db 'Copy ' + db 'Rename' + db ' ' + db 'Delete' + db 'Save ' + db 'Last ' + db 'Group ' + db 'SelUp ' +; Ctrl + db 'Left ' + db 'Right ' + db 'Name ' + db 'Extens' + db 'Modifn' + db 'Size ' + db 'Unsort' + db 'Creatn' + db 'Access' + db 'Descr ' + db 'Owner ' + db 'Sort ' +; Ctrl+Shift + db ' ' + db ' ' + db 'View ' + db 'Edit ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' +; Alt + db 'Left ' + db 'Right ' + db 'View..' + db ' ' + db 'Print ' + db 'MkLink' + db 'Find ' + db 'Histry' + db 'Video ' + db 'Tree ' + db 'ViewHs' + db 'FoldHs' +; Alt+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db 'ConfPl' + db ' ' + db ' ' + db ' ' +; Alt+Ctrl +times 12 db ' ' +; Alt+Ctrl+Shift +times 12 db ' ' +end if + +keybar_viewer: +if lang eq ru_RU +; -䨪஢ + db '' + db '' + db '室 ' + db ' ' + db ' ' + db '' + db ' ' +keybar_cp: + db 'cp1251' + db ' ' + db '室 ' + db '㫨' + db '࠭' +; Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db '' + db '' + db ' ' + db ' ' + db ' ' + db ' ' +; Ctrl + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' +; Ctrl+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' +; Alt + db ' ' + db ' ' + db ' ' + db ' ' + db '' + db ' ' + db ' ' + db '३' + db ' ' + db ' ' + db ' ' + db ' ' +; Alt+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db '䨣' + db ' ' + db ' ' + db ' ' +; Alt+Ctrl +times 12 db ' ' +; Alt+Ctrl+Shift +times 12 db ' ' + +else ; Default to en_US +; No modificators + db 'Help ' + db 'Unwrap' + db 'Quit ' + db 'Hex ' + db ' ' + db 'Edit ' + db 'Search' +keybar_cp: + db 'cp1251' + db ' ' + db 'Quit ' + db 'Plugin' + db 'Screen' +; Shift + db ' ' + db 'WWrap ' + db ' ' + db ' ' + db ' ' + db ' ' + db 'Next ' + db 'Table ' + db ' ' + db ' ' + db ' ' + db ' ' +; Ctrl + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db 'GoFile' + db ' ' + db ' ' +; Ctrl+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' +; Alt + db ' ' + db ' ' + db ' ' + db ' ' + db 'Print ' + db ' ' + db 'Prev ' + db 'Goto ' + db 'Video ' + db ' ' + db 'ViewHs' + db ' ' +; Alt+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db 'Config' + db ' ' + db ' ' + db ' ' +; Alt+Ctrl +times 12 db ' ' +; Alt+Ctrl+Shift +times 12 db ' ' +end if + +keybar_editor: +if lang eq ru_RU +; -䨪஢ + db '' + db '࠭' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' +keybar_cp2: + db 'cp1251' + db ' ' + db '室 ' + db '㫨' + db '࠭' +; Shift + db ' ' + db '.' + db ' ' + db '.' + db ' ' + db ' ' + db '' + db '' + db ' ' + db '' + db ' ' + db ' ' +; Ctrl + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db '' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' +; Ctrl+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' +; Alt + db ' ' + db ' ' + db ' ' + db ' ' + db '' + db ' ' + db ' ' + db 'ப' + db ' ' + db ' ' + db ' ' + db ' ' +; Alt+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db '䨣' + db ' ' + db ' ' + db ' ' +; Alt+Ctrl +times 12 db ' ' +; Alt+Ctrl+Shift +times 12 db ' ' + +else ; Default to en_US +; No modificators + db 'Help ' + db 'Save ' + db ' ' + db ' ' + db ' ' + db 'View ' + db 'Search' +keybar_cp2: + db 'cp1251' + db ' ' + db 'Quit ' + db 'Plugin' + db 'Screen' +; Shift + db ' ' + db 'SaveAs' + db ' ' + db 'Edit..' + db ' ' + db ' ' + db 'Next ' + db 'Table ' + db ' ' + db 'SaveQ ' + db ' ' + db ' ' +; Ctrl + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db 'Replac' + db ' ' + db ' ' + db 'GoFile' + db ' ' + db ' ' +; Ctrl+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' +; Alt + db ' ' + db ' ' + db ' ' + db ' ' + db 'Print ' + db ' ' + db ' ' + db 'Goto ' + db 'Video ' + db ' ' + db 'ViewHs' + db ' ' +; Alt+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db 'Config' + db ' ' + db ' ' + db ' ' +; Alt+Ctrl +times 12 db ' ' +; Alt+Ctrl+Shift +times 12 db ' ' +end if + + align 4 +cur_width dd 80 +cur_height dd 25 +saved_width dd -1 +saved_height dd -1 +fill_width dd 0 ;⮪ ਭ ਭ +fill_height dd 0 +max_width = 256 +max_height = 256 +console_data_ptr dd 0 + +cursor_x dd -1 +cursor_y dd -1 +cursor_size dd cursor_normal_size +cur_cursor_pos dd -1 +old_cursor_pos dd -1 + +idle_interval dd -1 + +active_panel dd panel1 + +associations dd 0 +associations_size dd 1 ; terminating zero +associations_allocated dd 0x1000 ; start with one page + +console_colors dd 0x000000, 0x000080, 0x008000, 0x008080 + dd 0x800000, 0x800080, 0x808000, 0xC0C0C0 + dd 0x808080, 0x0000FF, 0x00FF00, 0x00FFFF + dd 0xFF0000, 0xFF00FF, 0xFFFF00, 0xFFFFFF + +compare_fns dd compare_name + dd compare_name_rev + dd compare_ext + dd compare_ext_rev + dd compare_modified + dd compare_modified_rev + dd compare_size + dd compare_size_rev + dd compare_unordered + dd compare_unordered_rev + dd compare_created + dd compare_created_rev + dd compare_accessed + dd compare_accessed_rev + +ctrlkey_tests dd ctrlkey_test0 + dd ctrlkey_test1 + dd ctrlkey_test2 + dd ctrlkey_test3 + dd ctrlkey_test4 +ctrlkey_tests_num = 5 + +virtual at 0 +screen_vtable: + .OnRedraw dd ? + .OnActivate dd ? + .OnIdle dd ? + .OnKey dd ? + .keybar dd ? + .getname dd ? + .OnExit dd ? + .IsHandleUsed dd ? +end virtual + +panels_vtable: + dd panels_OnRedraw + dd 0 + dd 0 + dd panels_OnKey + dd keybar_panels + dd panels_getname + dd panels_OnExit + dd panels_IsHandleUsed + +viewer_vtable: + dd viewer_OnRedraw + dd 0 + dd 0 + dd viewer_OnKey + dd keybar_viewer + dd viewer_getname + dd viewer_OnExit + dd viewer_IsHandleUsed + +editor_vtable: + dd editor_OnRedraw + dd 0 + dd 0 + dd editor_OnKey + dd keybar_editor + dd editor_getname + dd editor_OnExit + dd editor_IsHandleUsed + +filesearch_vtable: + dd filesearch_OnRedraw + dd filesearch_OnActivate + dd filesearch_OnIdle + dd filesearch_OnKey + dd 0 + dd filesearch_getname + dd filesearch_OnExit + dd filesearch_IsHandleUsed + +; additions to this table require changes in tools.inc::get_error_msg +errors1: + dd error0msg + dd error1msg + dd error2msg + dd error3msg + dd error4msg + dd error5msg + dd error6msg + dd error7msg + dd error8msg + dd error9msg + dd error10msg + dd error11msg +errors2: + dd error30msg + dd error31msg + dd error32msg + +encodings: +.cp866 = 0 +.cp1251 = 1 +.koi8r = 2 +.unicode = 3 + +.names: + db 'cp866 ' + db 'cp1251 ' + db 'koi8-r ' + db 'Unicode ' + +.tables: +; cp866 - trivial map + times 128 db %+127 +; cp1251 + db 0x3F,0x3F,0x27,0x3F,0x22,0x3A,0xC5,0xD8,0x3F,0x25,0x3F,0x3C,0x3F,0x3F,0x3F,0x3F + db 0x3F,0x27,0x27,0x22,0x22,0x07,0x2D,0x2D,0x3F,0x54,0x3F,0x3E,0x3F,0x3F,0x3F,0x3F + db 0xFF,0xF6,0xF7,0x3F,0xFD,0x3F,0xB3,0x15,0xF0,0x63,0xF2,0x3C,0xBF,0x2D,0x52,0xF4 + db 0xF8,0x2B,0x49,0x69,0x3F,0xE7,0x14,0xFA,0xF1,0xFC,0xF3,0x3E,0x3F,0x3F,0x3F,0xF5 + times 0x30 db %-1+0x80 + times 0x10 db %-1+0xE0 +; koi8-r + db 0xC4,0xB3,0xDA,0xBF,0xC0,0xD9,0xC3,0xB4,0xC2,0xC1,0xC5,0xDF,0xDC,0xDB,0xDD,0xDE + db 0xB0,0xB1,0xB2,0xF4,0xFE,0xF9,0xFB,0xF7,0xF3,0xF2,0xFF,0xF5,0xF8,0xFD,0xFA,0xF6 + db 0xCD,0xBA,0xD5,0xF1,0xD6,0xC9,0xB8,0xB7,0xBB,0xD4,0xD3,0xC8,0xBE,0xBD,0xBC,0xC6 + db 0xC7,0xCC,0xB5,0xF0,0xB6,0xB9,0xD1,0xD2,0xCB,0xCF,0xD0,0xCA,0xD8,0xD7,0xCE,0xFC + db 0xEE,0xA0,0xA1,0xE6,0xA4,0xA5,0xE4,0xA3,0xE5,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE + db 0xAF,0xEF,0xE0,0xE1,0xE2,0xE3,0xA6,0xA2,0xEC,0xEB,0xA7,0xE8,0xED,0xE9,0xE7,0xEA + db 0x9E,0x80,0x81,0x96,0x84,0x85,0x94,0x83,0x95,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E + db 0x8F,0x9F,0x90,0x91,0x92,0x93,0x86,0x82,0x9C,0x9B,0x87,0x98,0x9D,0x99,0x97,0x9A + +.menu: + db .cp866 +.menu.1: + dd .menu.2 + dd 0 +if lang eq ru_RU + db '&DOS ⥪ (CP866)',0 +else ; Default to en_US + db '&DOS text (CP866)',0 +end if + db .cp1251 +.menu.2: + dd .menu.3 + dd .menu.1 +if lang eq ru_RU + db '&Windows ⥪ (CP1251)',0 +else ; Default to en_US + db '&Windows text (CP1251)',0 +end if + db .koi8r +.menu.3: + dd .menu.4 + dd .menu.2 +if lang eq ru_RU + db '&Linux ⥪ (KOI8-R)',0 +else ; Default to en_US + db '&Linux text (KOI8-R)',0 +end if + db .unicode +.menu.4: + dd 0 + dd .menu.3 + db '&Unicode',0 + +active_screen dd 0 +viewer_tabsize dd 8 +editor_tabsize dd 8 + +ascii2scan: + times 32 db 0 + db 0x39,0x02,0x03,0x04,0x05,0x06,0x08,0x28,0x0A,0x0B,0x09,0x0D,0x33,0x0C,0x34,0x35 + db 0x0B,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x27,0x27,0x33,0x0D,0x34,0x35 + db 0x03,0x1E,0x30,0x2E,0x20,0x12,0x21,0x22,0x23,0x17,0x24,0x25,0x26,0x32,0x31,0x18 + db 0x19,0x10,0x13,0x1F,0x14,0x16,0x2F,0x11,0x2D,0x15,0x2C,0x1A,0x2B,0x1B,0x07,0x0C + db 0x29,0x1E,0x30,0x2E,0x20,0x12,0x21,0x22,0x23,0x17,0x24,0x25,0x26,0x32,0x31,0x18 + db 0x19,0x10,0x13,0x1F,0x14,0x16,0x2F,0x11,0x2D,0x15,0x2C,0x1A,0x2B,0x1B,0x29,0x00 + db 0x21,0x33,0x20,0x16,0x26,0x14,0x27,0x19,0x30,0x10,0x13,0x25,0x2F,0x15,0x24,0x22 + db 0x23,0x2E,0x31,0x12,0x1E,0x1A,0x11,0x2D,0x17,0x18,0x1B,0x1F,0x32,0x28,0x34,0x2C + db 0x21,0x33,0x20,0x16,0x26,0x14,0x27,0x19,0x30,0x10,0x13,0x25,0x2F,0x15,0x24,0x22 + times 48 db 0 + db 0x23,0x2E,0x31,0x12,0x1E,0x1A,0x11,0x2D,0x17,0x18,0x1B,0x1F,0x32,0x28,0x34,0x2C + db 0x29,0x29,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +scan2ascii: + db 0,0,'1234567890-=',0,0 + db 'qwertyuiop[]',0,0,'as' + db 'dfghjkl;',27h,'`',0,'\zxcv' + db 'bnm,./',0,0,0,' ',0,0,0,0,0,0 + +;⠡ 㭪権: mouse_panels, mouse_viewer mouse_editor 冷 㣮 +align 4 +mouse_panels: + dd 0 ;f1 + dd 0 ;f2 + dd panels_OnKey.f3 + dd panels_OnKey.f4 + dd panels_OnKey.f5 + dd 0 ;f6 + dd panels_OnKey.f7 + dd panels_OnKey.f8 + dd 0 + dd exit ;f10 + dd 0 + dd F12 +; Shift + rd 4 + dd panels_OnKey.shift_f5 + rd 7 +.ctrl: + rd 2 +repeat 9-3+1 + dd panels_OnKey.ctrl_f3_9 +end repeat + rd 3 +; Ctrl+Shift + rd 12 +.alt: + dd panels_OnKey.alt_f1_2 + dd panels_OnKey.alt_f1_2 + rd 4 + dd panels_OnKey.alt_f7 + rd 5 +; Alt+Shift + rd 12 +; Alt+Ctrl + rd 12 +; Alt+Ctrl+Shift + rd 12 + +mouse_viewer: + rd 1 + dd viewer_OnKey.f2 + dd viewer_OnKey.exit ;f3 + dd viewer_OnKey.f4 + rd 2 + dd viewer_OnKey.f7 + dd viewer_OnKey.f8 + rd 1 + dd viewer_OnKey.exit ;f10 + rd 1 + dd F12 +; Shift + rd 6 + dd viewer_OnKey.shift_f7 + rd 5 +; Ctrl + rd 12 +; Ctrl+Shift + rd 12 +; Alt + rd 12 +; Alt+Shift + rd 12 +; Alt+Ctrl + rd 12 +; Alt+Ctrl+Shift + rd 12 + +mouse_editor: + rd 1 + dd editor_OnKey.f2 + rd 4 + dd editor_OnKey.f7 + rd 2 + dd editor_OnKey.exit_confirm ;f10 + rd 1 + dd F12 +; Shift + rd 6 + dd editor_OnKey.shift_f7 + rd 5 +; Ctrl + rd 12 +; Ctrl+Shift + rd 12 +; Alt + rd 12 +; Alt+Shift + rd 12 +; Alt+Ctrl + rd 12 +; Alt+Ctrl+Shift + rd 12 + +; ⠭ +; db scancode, reserved +; dw ctrlstate +; dd handler +; ctrlstate: 訥 4 - Shift, ᫥騥 - Ctrl, ᫥騥 - Alt +; 0 = +; 1 = ஢ +; 2 = +; 3 = , ࠢ +; 4 = ࠢ , +panels_ctrlkeys: + dw 0x48, 0 + dd panels_OnKey.up + dw 0x50, 0 + dd panels_OnKey.down + dw 0x4B, 0 + dd panels_OnKey.left + dw 0x4D, 0 + dd panels_OnKey.right + dw 0x51, 0 + dd panels_OnKey.pgdn + dw 0x49, 0 + dd panels_OnKey.pgup + dw 0xF, 0 + dd panels_OnKey.tab + dw 0x47, 0 + dd panels_OnKey.home + dw 0x4F, 0 + dd panels_OnKey.end + dw 0x1C, 0 + dd panels_OnKey.enter + dw 0x3D, 0 + dd panels_OnKey.f3 + dw 0x3E, 0 + dd panels_OnKey.f4 + dw 0x3F, 0 + dd panels_OnKey.f5 + dw 0x3F, 1 + dd panels_OnKey.shift_f5 + dw 0x41, 0 + dd panels_OnKey.f7 + dw 0x41, 0x100 + dd panels_OnKey.alt_f7 + dw 0x42, 0 + dd panels_OnKey.f8 + dw 0x43, 0x100 + dd alt_f9 + dw 0x44, 0 + dd exit + dw 0x5D, 0 + dd panels_OnKey.menu +repeat 9-3+1 + dw 0x3D+%-1, 0x10 + dd panels_OnKey.ctrl_f3_9 +end repeat + dw 0x3B, 0x100 + dd panels_OnKey.alt_f1_2 + dw 0x3C, 0x100 + dd panels_OnKey.alt_f1_2 + dw 0x58, 0 + dd F12 + dw 0x13, 0x10 + dd panels_OnKey.ctrl_r + dw 2, 0x30 + dd panels_OnKey.change_mode + dw 3, 0x30 + dd panels_OnKey.change_mode + dw 4, 0x30 + dd panels_OnKey.change_mode + dw 5, 0x30 + dd panels_OnKey.change_mode +repeat 10 + dw %+1, 0x40 + dd panels_OnKey.quick_jump +end repeat + dw 0x52, 0 + dd panels_OnKey.insert + dw 0x4E, 0 + dd panels_OnKey.greyplus + dw 0x4A, 0 + dd panels_OnKey.greyminus + dw 0x37, 0 + dd panels_OnKey.greyasterisk + db 0 + +viewer_ctrlkeys: + dw 1, 0 + dd viewer_OnKey.exit + dw 0x51, 0 + dd viewer_OnKey.pgdn + dw 0x49, 0 + dd viewer_OnKey.pgup + dw 0x50, 0 + dd viewer_OnKey.down + dw 0x48, 0 + dd viewer_OnKey.up + dw 0x4B, 0 + dd viewer_OnKey.left + dw 0x4B, 0x10 + dd viewer_OnKey.ctrl_left + dw 0x4B, 0x11 + dd viewer_OnKey.ctrl_shift_left + dw 0x4C, 0 + dd viewer_OnKey.exit + dw 0x4D, 0 + dd viewer_OnKey.right + dw 0x4D, 0x10 + dd viewer_OnKey.ctrl_right + dw 0x4D, 0x11 + dd viewer_OnKey.ctrl_shift_right + dw 0x3C, 0 + dd viewer_OnKey.f2 + dw 0x3D, 0 + dd viewer_OnKey.exit + dw 0x3E, 0 + dd viewer_OnKey.f4 + dw 0x41, 0 + dd viewer_OnKey.f7 + dw 0x41, 1 + dd viewer_OnKey.shift_f7 + dw 0x42, 0 + dd viewer_OnKey.f8 + dw 0x42, 1 + dd viewer_OnKey.shift_f8 + dw 0x44, 0 + dd viewer_OnKey.exit + dw 0x47, 0 + dd viewer_OnKey.home + dw 0x4F, 0 + dd viewer_OnKey.end + dw 0x58, 0 + dd F12 + dw 0x43, 0x100 + dd alt_f9 + db 0 + +editor_ctrlkeys: + dw 1, 0 + dd editor_OnKey.exit_confirm + dw 0x0E, 0 + dd editor_OnKey.backspace + dw 0x3C, 0 + dd editor_OnKey.f2 + dw 0x41, 0 + dd editor_OnKey.f7 + dw 0x41, 1 + dd editor_OnKey.shift_f7 + dw 0x43, 0x100 + dd alt_f9 + dw 0x44, 0 + dd editor_OnKey.exit_confirm + dw 0x44, 1 + dd editor_OnKey.exit_save + dw 0x47, 0 + dd editor_OnKey.home + dw 0x48, 0 + dd editor_OnKey.up + dw 0x49, 0 + dd editor_OnKey.pgup + dw 0x4B, 0 + dd editor_OnKey.left + dw 0x4D, 0 + dd editor_OnKey.right + dw 0x4F, 0 + dd editor_OnKey.end + dw 0x50, 0 + dd editor_OnKey.down + dw 0x51, 0 + dd editor_OnKey.pgdn + dw 0x52, 0 + dd editor_OnKey.ins + dw 0x53, 0 + dd editor_OnKey.del + dw 0x58, 0 + dd F12 + dw 0xF, 0x100 ; Alt+Tab + dd dummy_key + dw 0xF, 0x101 ; Shift+Alt+Tab + dd dummy_key + db 0 + +dummy_key: + ret + +dirinfo: + dd 1 +.first dd 0 + dd 0 +.size dd 300 +.dirdata dd 0 + db 0 +.name dd 0 + +readinfo: + dd 0 +.first dq 0 +.size dd 0 +.data dd 0 + db 0 +.name dd 0 + +writeinfo: +.code dd 2 +.first dq 0 +.size dd 0 +.data dd 0 + db 0 +.name dd 0 + +attrinfo: + dd 5 + dd 0 + dd 0 + dd 0 + dd .attr + db 0 +.name dd 0 + +delinfo: + dd 8 + dd 0 + dd 0 + dd 0 + dd 0 + db 0 + dd execdata + +mkdirinfo: + dd 9 + dd 0 + dd 0 + dd 0 + dd 0 + db 0 + dd CopyDestEditBuf+12 + +if lang eq ru_RU +compare_names db 'ᑤ' +else ; Default to en_US +compare_names db 'nNxXmMsSuUcCaA' +end if + +; 稭 䨣樮 - ⥪饩 ॠ樨 ୨ + +; +panel_normal_color db 1Bh +panel_selected_color db 1Eh +panel_border_color db 1Bh +panel_cursor_color db 30h +panel_selected_cursor_color db 3Eh +panel_header_color db 1Bh +panel_active_header_color db 30h +column_header_color db 1Eh +panel_number_color db 1Bh +panel_numselected_color db 3Eh +panel_nscreens_color db 0Bh +; +dialog_colors: +dialog_main_color db 70h +dialog_border_color db 70h +dialog_header_color db 70h +dialog_edit_color db 30h +dialog_unmodified_edit_color db 38h +dialog_normal_btn_color db 70h +dialog_selected_btn_color db 30h +dialog_list_color db 70h +dialog_selected_list_color db 0Fh +dialog_scroll_list_color db 70h +; ।० 訡 +warning_colors: +; !!! ⮬ 浪, !!! +warning_main_color db 4Fh +warning_border_color db 4Fh +warning_header_color db 4Fh +warning_edit_color db 30h +warning_unmodified_edit_color db 38h +warning_normal_btn_color db 4Fh +warning_selected_btn_color db 70h +warning_list_color db 3Fh +warning_selected_list_color db 70h +warning_scroll_list_color db 3Fh +; +menu_normal_color db 3Fh +menu_selected_color db 0Fh +menu_highlight_color db 3Eh +menu_selected_highlight_color db 0Eh +menu_border_color db 3Fh +menu_header_color db 3Fh +menu_scrollbar_color db 3Fh +; +keybar_number_color db 7 +keybar_name_color db 30h +keybar_bgr_color db 7 +; ப +cmdbar_normal_color db 7 +cmdbar_prefix_color db 7 +; ᬮ騪 +view_normal_color db 1Bh +view_selected_color db 30h +view_status_color db 30h +view_arrows_color db 1Eh +; +edit_normal_color db 1Bh +edit_status_color db 30h + +; ᢥ⪠ 䠩 +highlight_num_groups dd 10 +highlight_groups dd highlight_group0 + dd highlight_group1 + dd highlight_group2 + dd highlight_group3 + dd highlight_group4 + dd highlight_group5 + dd highlight_group6 + dd highlight_group7 + dd highlight_group8 + dd highlight_group9 + +; ଠ ᠭ 㯯 ᢥ⪨: +virtual at 0 +highlight: + .IncludeAttributes db ? + .NormalColor db ? + .CursorColor db ? + .SelectedColor db ? + .SelectedCursorColor db ? + .Mask: ; ASCIIZ-string +end virtual + +; all highlight masks must be in lowercase! +highlight_group0: + db 2 + db 13h, 38h, 0, 0 + db '*',0 +highlight_group1: + db 4 + db 13h, 38h, 0, 0 + db '*',0 +highlight_group2: + db 10h + db 1Fh, 3Fh, 0, 0 + db '*|..',0 +highlight_group3: + db 10h + db 0, 0, 0, 0 + db '..',0 +highlight_group4: + db 0 + db 1Ah, 3Ah, 0, 0 + db '*.exe,*.com,*.bat,*.cmd,*.kex',0 +highlight_group5: + db 0 + db 1Ah, 3Ah, 0, 0 + db '*|*.*,readme,makefile',0 +highlight_group6: + db 0 + db 1Dh, 3Dh, 0, 0 + db '*.rar,*.zip,*.[zj],*.[bg7]z,*.[bg]zip,*.tar,*.t[ag]z,*.ar[cj],*.r[0-9][0-9],' + db '*.a[0-9][0-9],*.bz2,*.cab,*.msi,*.jar,*.lha,*.lzh,*.ha,*.ac[bei],*.pa[ck],' + db '*.rk,*.cpio,*.rpm,*.zoo,*.hqx,*.sit,*.ice,*.uc2,*.ain,*.imp,*.777,*.ufa,*.boa,' + db '*.bs[2a],*.sea,*.hpk,*.ddi,*.x2,*.rkv,*.[lw]sz,*.h[ay]p,*.lim,*.sqz,*.chz',0 +highlight_group7: + db 0 + db 16h, 36h, 0, 0 + db '*.bak,*.tmp',0 +highlight_group8: + db 0 + db 17h, 37h, 0, 0 + db '*.asm,*.inc',0 +highlight_group9: + db 10h + db 1Fh, 3Fh, 0, 0 + db '*',0 + +bConfirmDelete db 1 +bConfirmDeleteIncomplete db 0 + +FolderShortcuts dd 0,0,0,0,0,0,0,0,0,0 + +; 稢 䨣樮 + +bWasE0 db 0 +ctrlstate db 0 +mousestate db 0 +align 4 +MemForImage dd 0 +restore_semicolon dd 0 +bForHex db 0 + +align 4 +; 饭 뤥 +nomem_dlgdata: + dd 2 + dd -1 + dd -1 + dd 12 + dd 2 + dd 1 + dd 1 + dd aError + rb 8 + dd 0 + dd 0 + dd 2 +; ப "No memory" + DlgLbl ,1,0,10,0,aNoMemory,1 +; "Ok" + DlgBtn ,4,1,7,1,aOk,0xD + +; ஢ +copy_dlgdata: + dd 1 +.x dd -1 +.y dd -1 +.width dd ? +.height dd 4 + dd 4 + dd 2 + dd aCopyCaption +.main_color db ? +.border_color db ? +.header_color db ? + db 0 + dd ? + dd 0 + dd 0 + dd 4 +; ப '஢ "%s" :' +.lcopy DlgLbl ,1,0,,0,CopySourceTextBuf,0 +; ।஢ 䠩/ 祭 +.ename DlgEdit ,1,1,,1,CopyDestEditBuf,0 +; "஢" +.copy DlgBtn ,,3,,3,aCopy,18h +; "⬥" +.cnl DlgBtn ,,3,,3,aCancelB,8 + +struct MkDir_Dlgdata + dd 1 + dd -1, -1 +width dd ? +height dd 4 + dd 4, 2 + dd aMkDirCaption + dd ?, ? + dd 0 + dd 0 + dd 4 +; ப " " + DlgLbl ,1,0,aMkDirLen,0,aMkDir,0 +; ।஢ ᮧ +dnam DlgEdit ,1,1,,1,CopyDestEditBuf,0xC +; "த" +cont DlgBtn ,,3,,3,a_Continue,18h +; "⬥" +cnl DlgBtn ,,3,,3,aCancelB,8 +ends + +mkdir_dlgdata MkDir_Dlgdata + +; 뤥/ +mark_dlgdata: + dd 1 + dd -1, -1 + dd 37, 1 + dd 4, 2 +.title dd ? + dd ?, ? + dd 0, 0 + dd 1 +; ।஢ +.edit DlgEdit ,1, 0, 35, 0, enter_string_buf, + +; ண ᪠ (Alt+㪢) +QuickSearchDlg: + dd 5 +.x dd ? +.y dd ? + dd 20, 1 + dd 1, 1 + dd aSearch + dd ?, ? + dd 0, 0 + dd 1 +; ।஢ + DlgEdit ,1, 0, 18, 0, quick_search_buf, 1Ch + +; ᪠ 䠩 ᬮ騪 । +struct FindInFileDlgdata + dd 1 +x dd -1 +y dd -1 +width dd ? +height dd 7 + dd 4, 2 + dd aSearch + dd ?, ? + dd 0, 0 + dd 8 +; ப "᪠" + DlgLbl ,1,0,aSearchForLen,0,aSearchFor,0 +; ।஢ ⥪⮬ ᪠ +efind DlgEdit ,1,1,,1,SearchStringEditBuf,0xC +; ਧ⠫ ࠧ⥫ + DlgLine ,-1,2,-1,2 +; 䫠 "뢠 ॣ" +case DlgCheck,1,3,-1,3,aCaseSensitive,18h ; default: search is case sensitive +; 䫠 "쪮 楫 ᫮" +whole DlgCheck,1,4,-1,4,aWholeWords,8 ; default: do NOT search whole words only +; ਧ⠫ ࠧ⥫ + DlgLine ,-1,5,-1,5 +; "᪠" +search DlgBtn ,,6,,6,aSearchB,18h +; "⬥" +cnl DlgBtn ,,6,,6,aCancelB,8 +ends + +find_in_file_dlgdata FindInFileDlgdata + +; ᪠ 䠩 () +struct FileSearch_QueryTemplate + dd 1 +x dd ? +y dd ? +width dd ? +height dd 9 + dd 4, 2 + dd aFileSearch + dd ? + dd 0 + dd 0, 0 + dd 10 +; ப-ਣ襭 ᪨ + DlgLbl ,1,0,aFileMasksLen,0,aFileMasks,0 +; ᪨ +edit1 DlgEdit ,1,1,,1,,0xC +; ப-ਣ襭 ⥪ ᪠ + DlgLbl ,1,2,aContainingTextLen,2,aContainingText,0 +; ⥪ ᪠ +edit2 DlgEdit ,1,3,,3,,8 +; ਧ⠫ ࠧ⥫ + DlgLine ,-1,4,-1,4 +; 䫠 "뢠 ॣ" +case DlgCheck,1,5,-1,5,aCaseSensitive, ; will be initialized from find_in_file_dlgdata +; 䫠 "쪮 楫 ᫮" +whole DlgCheck,1,6,-1,6,aWholeWords, ; will be initialized from find_in_file_dlgdata +; ਧ⠫ ࠧ⥫ + DlgLine ,-1,7,-1,7 +; "᪠" +search DlgBtn ,,8,,8,aSearchB,18h +; "⬥" +cnl DlgBtn ,,8,,8,aCancelB,8 +ends + +filesearch_query_template FileSearch_QueryTemplate + +; ன ᪠ 䠩 (᪠஢) +struct FileSearch_SearchTemplate + dd 1 +x dd ? +y dd ? +width dd ? +height dd ? + dd 4, 2 +caption dd ? + dd ? + dd 0 + dd 0, 0 + dd 9 +; ᯨ᮪ 䠩 +list1 DlgList ,0,0,,,,0 +; ਧ⠫ ࠧ⥫ +lin1 DlgLine ,-1,,-1, +; ப " :" " 祭..." +lbl1 DlgLbl ,1 +; ப ⥪饩 +lbl2 DlgLbl +; ਧ⠫ ࠧ⥫ +lin2 DlgLine ,-1,,-1, +; +btn1 DlgBtn ,,,,,aNewSearch,8 +btn2 DlgBtn ,,,,,aGoto,1Ch +btn3 DlgBtn ,,,,,aView,8 +btn4 DlgBtn ,,,,,aCancelB2,8 +ends + +filesearch_search_template FileSearch_SearchTemplate + +RetryOrCancelBtn: + dd aRetry + dd a_Cancel +DeleteOrKeepBtn: + dd a_Delete + dd aKeep +RetryOrIgnoreBtn: + dd aRetry + dd aIgnore +DeleteOrCancelBtn: + dd a_Delete + dd a_Cancel +DeleteErrorBtn: + dd aRetry +SkipOrCancelBtn: + dd aSkip + dd aSkipAll + dd a_Cancel +ContinueBtn: + dd aContinue +EditorExitBtn: + dd aSave + dd aDontSave + dd aContinueEdit +YesOrNoBtn: + dd aYes + dd aNo + +aCannotOpenFile_ptr dd aCannotOpenFile +aCannotCreateThread_ptr dd aCannotCreateThread +ConfirmCancelMsg dd aConfirmCancel +EditConfigErr_ptr: + dd aEditConfigErr1 + dd aEditConfigErr2 +if lang eq ru_RU +aDeleteCaption db '',0 +aConfirmDeleteText db ' 㤠',0 +aDeleteFolder db ' ',0 +aConfirmDeleteTextMax = $ - aConfirmDeleteText - 2 +aDeleteFile db ' 䠩',0 +aCancelB db '[ ⬥ ]',0 +aCancelBLength = $ - aCancelB - 1 +aCancelB2 db '[ ⬥ ]',0 +aCancelB2Length = $ - aCancelB2 - 1 +aCopyCaption db '஢',0 +aCopy db '[ ஢ ]',0 +aCopyLength = $ - aCopy - 1 +a_Continue db '[ த ]',0 +a_ContinueLength = $ - a_Continue - 1 +aCopy1 db '஢ ',0 +aCopy2 db ' :',0 +aError db '訡',0 +aContinue db 'த',0 +aRetry db '',0 +a_Cancel db '⬥',0 +a_Delete db '',0 +aSkip db 'ய',0 +aSkipAll db 'ய ',0 +aYes db '',0 +aNo db '',0 +error0msg db '࠭... 訡',0 +error1msg db '࠭... । / ࠧ ⪮ ᪠',0 +error2msg db '㭪 ন 䠩 ⥬',0 +error3msg db '⭠ 䠩 ⥬',0 +error4msg db '࠭... 訡 4',0 +error5msg db ' ',0 +error6msg db ' 稫',0 +error7msg db '࠭... ⥫ ਫ',0 +error8msg db ' ',0 +error9msg db ' ࠧ襭',0 +error10msg db ' ',0 +error11msg db '訡 ன⢠',0 +error30msg db '筮 ',0 +error31msg db '  ᯮ塞',0 +error32msg db '誮 ᮢ',0 +aUnknownError db ' 訡: ',0 +aCannotReadFolder db ' ',0 +aRunError db '訡 ᪥ ணࠬ:',0 +aFileNameTooBig db ' 䠩 ᫨誮 ',0 +aFolderNameTooBig db ' ᫨誮 ',0 +aCmdLineTooBig db ' ப ॢ蠥 ࠭ OS 256 ᨬ',0 +aCannotCopyToSelf db ' ᪮஢ ᠬ ᥡ',0 +aCannotReadFile db ' 䠩',0 +aIncompleteFile db ' 祭 䠩. ?',0 +aKeep db '⠢',0 +aCannotWriteFile db ' 䠩',0 +aCannotDeleteFile db ' 㤠 䠩',0 +aCannotDeleteFolder db ' 㤠 ',0 +aNotFolder db '  ',0 +aIgnore db '஢',0 +aMkDirCaption db ' ',0 +aMkDir db ' ',0 +aMkDirLen = $ - aMkDir - 1 +aCannotMakeFolder db ' ᮧ ',0 +aName db 3,'' +aSize db 6,'' +aDate db 4,'' +aTime db 5,'६' +aCannotLoadDLL db ' 㧨 DLL',0 +aCannotLoadPlugin db ' 㧨 ',0 +aInvalidDLL db ' ଠ',0 +aMissingExport db '室 㭪 ',0 +aInitFailed db '訡 樠樨',0 +aIncompatibleVersion db 'ᮢ⨬ ',0 +aTables db '',0 +aSelect db '',0 +aDeselect db '',0 +aCannotOpenFile db '訡 ⨨ 䠩',0 +aCannotCreateThread db '訡 ᮧ ⮪',0 +aCannotSetFolder db ' ',0 +aSearch db '',0 +aSearchB db '[ ᪠ ]',0 +aSearchBLength = $ - aSearchB - 1 +aSearchFor db '᪠',0 +aSearchForLen = $ - aSearchFor - 1 +aCaseSensitive db '뢠 ॣ',0 +aWholeWords db '쪮 楫 ᫮',0 +aReverseSearch db ' ',0 +aStringNotFound db 'ப ',0 +aFileSearch db ' 䠩',0 +aFileMasks db ' ᪮쪮 ᮪ 䠩:',0 +aFileMasksLen = $ - aFileMasks - 1 +aContainingText db 'ঠ ⥪:',0 +aContainingTextLen = $ - aContainingText - 1 +aSearchingIn db ' "" :',0 +aSearchingInLen = $ - aSearchingIn - 1 +aSearchDone db ' 祭. ? 䠩()',0 +aSearchDoneLen = $ - aSearchDone - 1 +aNewSearch db '[ ]',0 +aNewSearchLen = $ - aNewSearch - 1 +aGoto db '[ ३ ]',0 +aGotoLen = $ - aGoto - 1 +aView db '[ ]',0 +aViewLen = $ - aView - 1 +aEditConfigErr1 db '訡 䨣樨 ।.',0 +aEditConfigErr2 db '஡ 譨 .',0 +aEditNoMemory db ' ᫨誮 㧪 ।.',0 +aLine db ' ப' +aCol db ' ' +aEditorTitle db '',0 +aFileModified db ' ',0 +aSave db '࠭',0 +aDontSave db ' ࠭',0 +aContinueEdit db 'த ।஢',0 +aCannotSaveToPlugin db '࠭ 䠩 ন',0 +aCannotSearchOnPlugin db ' ন',0 +aCancelled db '⢨ 뫮 ࢠ',0 +aConfirmCancel db ' ⢨⥫쭮 ⬥ ⢨?',0 + +else ; Default to en_US +aDeleteCaption db 'Delete',0 +aConfirmDeleteText db 'Do you wish to delete',0 +aDeleteFolder db ' the folder',0 +aConfirmDeleteTextMax = $ - aConfirmDeleteText - 2 +aDeleteFile db ' the file',0 +aDelete db ' Delete ',0 +aDeleteLength = $ - aDelete - 1 +aCancel db ' Cancel ',0 +aCancelLength = $ - aCancel - 1 +aCancelB db '[ Cancel ]',0 +aCancelBLength = $ - aCancelB - 1 +aCancelB2 = aCancelB +aCancelB2Length = $ - aCancelB2 - 1 +aCopyCaption db 'Copy',0 +aCopy db '[ Copy ]',0 +aCopyLength = $ - aCopy - 1 +a_Continue db '[ Continue ]',0 +a_ContinueLength = $ - a_Continue - 1 +aCopy1 db 'Copy "',0 +aCopy2 db '" to:',0 +aError db 'Error',0 +aContinue db 'Continue',0 +aRetry db 'Retry',0 +a_Cancel db 'Cancel',0 +a_Delete db 'Delete',0 +aSkip db 'Skip',0 +aSkipAll db 'Skip all',0 +aYes db 'Yes',0 +aNo db 'No',0 +error0msg db 'Strange... No error',0 +error1msg db 'Strange... Hard disk base and/or partition not defined',0 +error2msg db 'The file system does not support this function',0 +error3msg db 'Unknown file system',0 +error4msg db 'Strange... Error 4',0 +error5msg db 'File not found',0 +error6msg db 'End of file',0 +error7msg db 'Strange... Pointer is outside of application memory',0 +error8msg db 'Disk is full',0 +error9msg db 'File structure is destroyed',0 +error10msg db 'Access denied',0 +error11msg db 'Device error',0 +error30msg db 'Not enough memory',0 +error31msg db 'File is not executable',0 +error32msg db 'Too many processes',0 +aUnknownError db 'Unknown error code: ',0 +aCannotReadFolder db 'Cannot read folder',0 +aRunError db 'Cannot execute program:',0 +aFileNameTooBig db 'Full file name is too long',0 +aFolderNameTooBig db 'Full folder name is too long',0 +aCmdLineTooBig db 'Command line is too long (OS limit is 256 symbols)',0 +aCannotCopyToSelf db 'File cannot be copied onto itself',0 +aCannotReadFile db 'Cannot read file',0 +aIncompleteFile db 'Incomplete file was retrieved. Delete it?',0 +aKeep db 'Keep',0 +aCannotWriteFile db 'Cannot write to the file',0 +aCannotDeleteFile db 'Cannot delete the file',0 +aCannotDeleteFolder db 'Cannot delete the folder',0 +aNotFolder db 'is not a folder',0 +aIgnore db 'Ignore',0 +aMkDirCaption db 'Make folder',0 +aMkDir db 'Create the folder',0 +aMkDirLen = $ - aMkDir - 1 +aCannotMakeFolder db 'Cannot create folder',0 +aName db 4,'Name' +aSize db 4,'Size' +aDate db 4,'Date' +aTime db 4,'Time' +aCannotLoadDLL db 'Cannot load DLL',0 +aCannotLoadPlugin db 'Cannot load plugin',0 +aInvalidDLL db 'File is not found or invalid',0 +aMissingExport db 'Required function is not present',0 +aInitFailed db 'Initialization failed',0 +aIncompatibleVersion db 'Incompatible version',0 +aTables db 'Tables',0 +aSelect db 'Select',0 +aDeselect db 'Deselect',0 +aCannotOpenFile db 'Cannot open the file',0 +aCannotCreateThread db 'Cannot create a thread',0 +aCannotSetFolder db 'Cannot enter to the folder',0 +aSearch db 'Search',0 +aSearchB db '[ Search ]',0 +aSearchBLength = $ - aSearchB - 1 +aSearchFor db 'Search for',0 +aSearchForLen = $ - aSearch - 1 +aCaseSensitive db 'Case sensitive',0 +aWholeWords db 'Whole words',0 +aReverseSearch db 'Reverse search',0 +aStringNotFound db 'Could not find the string',0 +aFileSearch db 'Find file',0 +aFileMasks db 'A file mask or several file masks:',0 +aFileMasksLen = $ - aFileMasks - 1 +aContainingText db 'Containing text:',0 +aContainingTextLen = $ - aContainingText - 1 +aSearchingIn db 'Searching "" in:',0 +aSearchingInLen = $ - aSearchingIn - 1 +aSearchDone db 'Search done. Found ? file(s)',0 +aSearchDoneLen = $ - aSearchDone - 1 +aNewSearch db '[ New search ]',0 +aNewSearchLen = $ - aNewSearch - 1 +aGoto db '[ Go to ]',0 +aGotoLen = $ - aGoto - 1 +aView db '[ View ]',0 +aViewLen = $ - aView - 1 +aEditConfigErr1 db 'Error in configuration of plugins for the editor.',0 +aEditConfigErr2 db 'Try to remove unnecessary plugins.',0 +aEditNoMemory db 'The file is too big for the editor.',0 +aLine db ' Line' +aCol db ' Col ' +aEditorTitle db 'Editor',0 +aFileModified db 'File has been modified',0 +aSave db 'Save',0 +aDontSave db 'Do not save',0 +aContinueEdit db 'Continue editing',0 +aCannotSaveToPlugin db 'Saving is not supported for plugin panels',0 +aCannotSearchOnPlugin db 'The search on plugin panels is not supported yet',0 +aCancelled db 'Operation has been interrupted',0 +aConfirmCancel db 'Do you really want to cancel it?',0 +end if + +aOk db 'OK',0 +aNoMemory db 'No memory!' +nullstr db 0 +aUntitled db 'untitled',0 +aDotDot db '..',0,0 +standard_dll_path: +libini_name db '/sys/lib/' +standard_dll_path_size = $ - standard_dll_path + db 'libini.obj',0 +aStart db 'START',0 +aLibInit db 'lib_init',0 +aVersion db 'version',0 +aIniGetInt db 'ini_get_int',0 +aIniGetStr db 'ini_get_str',0 +aIniSetInt db 'ini_set_int',0 +aIniEnumKeys db 'ini_enum_keys',0 +aPluginLoad db 'plugin_load',0 +aPluginUnload db 'plugin_unload',0 +aGetattr db 'getattr',0 +aOpen db 'open',0 +aRead db 'read',0 +aSetpos db 'setpos',0 +aClose db 'close',0 +aOpenFilePlugin db 'OpenFilePlugin',0 +aClosePlugin db 'ClosePlugin',0 +aReadFolder db 'ReadFolder',0 +aSetFolder db 'SetFolder',0 +aGetOpenPluginInfo db 'GetOpenPluginInfo',0 +aGetPanelTitle db 'GetPanelTitle',0 +aGetFiles db 'GetFiles',0 +aEditInfoSize db 'EditInfoSize',0 + +aConfirmations db 'Confirmations',0 +aConfirmDelete db 'Delete',0 +aConfirmDeleteIncomplete db 'DeleteIncomplete',0 + +aPanels db 'Panels',0 +aLeftViewMode db 'LeftViewMode',0 +aRightViewMode db 'RightViewMode',0 +aLeftSortMode db 'LeftSortMode',0 +aRightSortMode db 'RightSortMode',0 + +aEditor db 'Editor',0 +aEolStyle db 'EOLStyle',0 + +aAssociations db 'Associations',0 +aPlugins db 'Plugins',0 +aMenu db 'Menu',0 +aFolderShortcuts db 'FolderShortcuts',0 +aShortcut db 'Shortcut' +.d db '0',0 + +align 4 +ini_import: +ini.get_int dd aIniGetInt +ini.get_str dd aIniGetStr +ini.enum_keys dd aIniEnumKeys +ini.set_int dd aIniSetInt + dd 0 + +plugin_exported: + dd aPluginUnload + dd aGetattr + dd aOpen + dd aRead + dd aSetpos + dd aClose + dd aOpenFilePlugin + dd aClosePlugin + dd aReadFolder + dd aSetFolder + dd aGetOpenPluginInfo + dd aGetPanelTitle + dd aGetFiles + dd aEditInfoSize + dd 0 +plugin_exported_default: + dd plugin_unload_default + dd getattr_default + dd open_default + dd read + dd setpos_default + dd close + dd OpenFilePlugin_default + dd ClosePlugin_default + dd ReadFolder_default + dd SetFolder_default + dd GetOpenPluginInfo_default + dd GetPanelTitle_default + dd GetFiles_default + dd 0 ; default value for EditInfoSize + +kfar_info: + dd .size + dd version_dword + dd open + dd open2 + dd read + dd -1 ; write: to be implemented + dd seek + dd tell + dd -1 ; flush: to be implemented + dd filesize + dd close + dd xpgalloc + dd xpgrealloc + dd pgfree + dd getfreemem + dd libini_alloc + dd libini_realloc + dd libini_free + dd menu + dd menu_centered_in + dd DialogBox + dd SayErr + dd Message + dd cur_width +.size = $ - kfar_info + +plugins dd 0 +num_plugins dd 0 +alloc_plugins dd 0 + +EditPlugInfo dd 0 +EditEOLStyle db edit.eol_unix + +virtual at 0 +PluginInfo: +.unload dd ? +.getattr dd ? +.open dd ? +.read dd ? +.setpos dd ? +.close dd ? +.OpenFilePlugin dd ? +.ClosePlugin dd ? +.ReadFolder dd ? +.SetFolder dd ? +.GetOpenPluginInfo dd ? +.GetPanelTitle dd ? +.GetFiles dd ? +.EditInfoSize dd ? +.EditInfoOffs dd ? +.size = $ +end virtual + +virtual at 0 +PanelMode: +; up to 16 columns on one panel +.NumColumns dd ? +; available column types: +COLUMN_TYPE_NONE = 0 +COLUMN_TYPE_NAME = 1 + COLUMN_NAME_MARK = 10h ; (reserved) + COLUMN_NAME_NOPATH = 20h ; (reserved) + COLUMN_NAME_RIGHTALIGN = 40h ; (reserved) +COLUMN_TYPE_SIZE = 2 + COLUMN_SIZE_COMMA = 10h ; (reserved) +COLUMN_TYPE_PACKED_SIZE = 3 ; (reserved) +COLUMN_TYPE_DATE = 4 +COLUMN_TYPE_TIME = 5 +COLUMN_TYPE_DATETIME = 6 ; (reserved) +COLUMN_TYPE_DATETIME_CREATION = 7 ; (reserved) +COLUMN_TYPE_DATETIME_ACCESS = 8 ; (reserved) +COLUMN_TYPE_ATTRIBUTES = 9 ; (reserved) +COLUMN_TYPE_DESCRIPTION = 10 ; (reserved) +COLUMN_TYPE_OWNER = 11 ; (reserved) +COLUMN_TYPE_NUMLINKS = 12 ; (reserved) +COLUMN_TYPE_CUSTOM = 13 ; (reserved) +.ColumnTypes rb 16 + +.ColumnWidths rb 16 +.bFullScreen db ? ; (reserved) +.bAlignExtensions db ? + rb 2 +.size = $ +end virtual + +align 4 +column_headers: + dd nullstr + dd aName + dd aSize + dd nullstr + dd aDate + dd aTime +draw_column_proc: + dd draw_empty_column + dd draw_name_column + dd draw_size_column + dd -1 + dd draw_date_column + dd draw_time_column +colmodes: +; ० 0 : NM,SC,D + dd 3 + db COLUMN_TYPE_NAME+COLUMN_NAME_MARK, COLUMN_TYPE_SIZE+COLUMN_SIZE_COMMA + db COLUMN_TYPE_DATE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + db 0, 10, 8 + times 13 db 0 + db 0, 1 + times 2 db 0 +; ० 1 : N,N,N + dd 3 + db COLUMN_TYPE_NAME, COLUMN_TYPE_NAME, COLUMN_TYPE_NAME + times 13 db 0 + times 16 db 0 + db 0, 1 + times 2 db 0 +; ० 2 : N,N + dd 2 + db COLUMN_TYPE_NAME, COLUMN_TYPE_NAME + times 14 db 0 + times 16 db 0 + db 0, 0 + times 2 db 0 +; ० 3 : N,S,D,T + dd 4 + db COLUMN_TYPE_NAME, COLUMN_TYPE_SIZE, COLUMN_TYPE_DATE, COLUMN_TYPE_TIME + times 12 db 0 + db 0, 6, 8, 5 + times 12 db 0 + db 0, 1 + times 2 db 0 +; ० 4 : N,S + dd 2 + db COLUMN_TYPE_NAME, COLUMN_TYPE_SIZE + times 14 db 0 + db 0, 6 + times 14 db 0 + db 0, 0 + times 2 db 0 +; ० 5 : N,S,P,DM,DC,DA,A +; ० 6 : N,Z +; ० 7 : N,S,Z +; ० 8 : N,S,O +; ० 9 : N,S,LN + +execinfo: + dd 7 + dd 0 +execparams dd 0 + dd 0 + dd 0 + db 0 +execptr dd ? + +IncludeIGlobals + +i_end: + +IncludeUGlobals + +execdata rb 1024 +execdataend: + align 4 +attrinfo.attr rb 40 + +panel1 PanelData + +panel2 PanelData + +;console_data rb max_width*max_height*2 + +nomem_dlgsavearea rb 8 + (12+4)*(3+3)*2 + +quicksearch_savearea rb 22*3*2 +quicksearch_maxlen = 64 +quick_search_buf rb 12 + quicksearch_maxlen + +cur_header rb max_width +tmp dd ? + +skinh dd ? +std_colors rd 10 + +min_y dd ? +max_y dd ? +min_x dd ? +max_x dd ? +used_width dd ? +used_height dd ? + +wnd_width dd ? +wnd_height dd ? + +column_left dd ? +column_top dd ? +column_width dd ? +column_height dd ? +column_index dd ? +last_column_index dd ? + +scrpos dq ? +viewer_right_side dq ? + +EditDataSize dd ? +EditBlockStart dd ? +EditBlockSize dd ? + +saved_file_name: +procinfo rb 1024 +lower_file_name = procinfo + 512 + +app_path rb 1100 + +error_msg rb 128 + +prev_dir rb 1024 + +driveinfo rb 32+304 +tmpname rb 32 + +screens dd ? +num_screens dd ? +active_screen_vtable dd ? +active_screen_data dd ? +active_screen_keybar dd ? + +default_attr dd ? +left_dotdot_entry rb 40+4 ; 40 bytes for attributes + '..' +right_dotdot_entry rb 40+4 + +aConfirmDeleteTextBuf rb aConfirmDeleteTextMax + 1 +CopySourceTextBuf rb 512 +CopyDestEditBuf rb 12+512+1 +.length = $ - CopyDestEditBuf - 13 + +SearchStringEditBuf rb 12 +SearchString rb 253+1 +SearchStringEditBuf.length = $ - SearchString - 1 + db ? ; used for output (string -> "string") + +enter_string_buf rb 12+512+1 + +bMemForImageValidData db ? + +align 4 +identical_table rb 256 +tolower_table rb 256 +isspace_table rb 256 +composite_table rb 256 +layout rb 128 + +copy_buffer_size = 65536 +copy_buffer rb copy_buffer_size + +filedata_buffer_size = 1024 +filedata_buffer rb filedata_buffer_size + +source_hModule dd ? +source_hPlugin dd ? +source_hFile dd ? +; data for directory delete +; If directory nested level is >1024, then its full name is too big, +; so we see the overflow when creating full name (we check for this!) +del_dir_stack rd 1024 +del_dir_stack_ptr dd ? +del_dir_query_size = 32 +del_dir_query_area rb 32+304*del_dir_query_size + +label copy_dir_stack dword at del_dir_stack +label copy_dir_stack_ptr dword at del_dir_stack_ptr +copy_dir_query_size = del_dir_query_size +copy_dir_query_area = del_dir_query_area +del_bSkipAll db ? ; for directory errors +label copy_bSkipAll byte at del_bSkipAll +copy_bSkipAll2 db ? ; for file read/write errors +copy_bSkipAll3 db ? ; for SetFolder errors + +bEndSlash db ? +bDestIsFolder db ? +bNeedRestoreName db ? + +; stack + align 4 + rb 32768 +stacktop: + +mem: diff --git a/programs/fs/unz/unz.asm b/programs/fs/unz/unz.asm index b524cf9478..7cad022aa1 100644 --- a/programs/fs/unz/unz.asm +++ b/programs/fs/unz/unz.asm @@ -1,914 +1,914 @@ -;unz - ᯠ騪, ᯮ騩 archiver.obj. ন zip 7z. - -;unz [-o output path] [-f file for unpack] [-f ...] [-h] file.zip -;-h - hide GUI. If params is empty - do exit. - -;unz -o /hd0/1/arci -f text1.txt file.zip -unpack in folder only file text1.txt -;or -;unz -o "/hd0/1/arci" -f "text1.txt" text2.txt "file.zip" -unpack in folder only file text1.txt and text2.txt - - -; -;unz -n "namezone" "file.zip" - open packed file, write list files of main folder in namezone -;namezone: -;dd 0 - ᫨ , 1 -;dd cmd - 0 -; 1 ᯨ᮪ 䠩 -; 2 䠩 -; 3 ⠭ ⥪訩 ⠫ 娢 -; 4 ࠡ -;data - , -; 1 ᯨ᮪ 䠩 -; input -; none -; output -; dd numfiles - ⢮ 䠩 ⥪饬 ⠫ -; strz file1...fileN - ᯨ᮪ ப, ࠧ 0 -; 2 䠩 -; input -; dd num bytes -; strz filename (file1.txt of /fold1/file1.txt) -; output -; dd num bytes -; data - -use32 -org 0 -db 'MENUET01' -dd 1, start, init_end, end_mem, stack_top, params, 0 - - -include 'lang.inc' -include '../../macros.inc' -include '../../proc32.inc' -include '../../develop/libraries/box_lib/trunk/box_lib.mac' -include '../../dll.inc' -;include '../../debug.inc' -include 'debug.inc' - -version equ '0.70' -version_dword equ 0*10000h + 70 - -WIN_W = 400 -SIZE_COPY_BUF = 1024*1024*2 -MM_MAX_BLOCKS equ 1024 - - -virtual at 0 -kfar_info_struc: -.lStructSize dd ? -.kfar_ver dd ? -.open dd ? -.open2 dd ? -.read dd ? -.write dd ? -.seek dd ? -.tell dd ? -.flush dd ? -.filesize dd ? -.close dd ? -.pgalloc dd ? -.pgrealloc dd ? -.pgfree dd ? -.getfreemem dd ? -.pgalloc2 dd ? -.pgrealloc2 dd ? -.pgfree2 dd ? -.menu dd ? -.menu_centered_in dd ? -.DialogBox dd ? -.SayErr dd ? -.Message dd ? -.cur_console_size dd ? -end virtual - - - -;-- CODE ------------------------------------------------------------------- - -include 'parse.inc' -include 'fs.inc' -include 'file_tree.inc' -include 'memory_manager.inc' -include 'dialogs.inc' - - -start: -;dnl -;dpsP params -;dnl - mcall 68, 11 - mcall 40, 100111b + 0C0000000h - stdcall dll.Load, IMPORTS - test eax, eax - jnz exit - mov [pathOut],0 - -;---------------------------- - ;1. find input file, clear - ;2. find -o, copy data, clear - ;3. find -f, add pointer, copy data, clear - ;4. find -c, check variable, clear -;1. - call getLastParam - test eax, eax - je wm_redraw - dec eax - je .arbeit - jmp errorParsing - -.arbeit: -;2. - call getParamOutPath - cmp eax, 2 - je errorParsing - -;3. - - @@: - mov eax, [iFiles] - shl eax, 2 - add eax, files - m2m dword[eax], dword[endPointer] - stdcall getParam, '-f' - cmp eax, 2 - je errorParsing - inc [iFiles] - cmp eax, 1 - je @b - -;4. - mov edi, params - mov ax,'-h' -@@: cmp word [edi], ax - je .check - inc edi - cmp edi, params+1024 - je @f - cmp byte[edi],0 - je @f - jmp @b -.check: - call startUnpack - mcall -1 -@@: - - stdcall [OpenDialog_Init],OpenDialog_data - -;init edit fields -------------- - xor al,al - mov edi,fInp - mov ecx,1024 - repne scasb - inc ecx - mov eax,1024 - sub eax,ecx - mov dword[edtPack.size],eax - mov dword[edtPack.pos],eax - - xor al, al - mov edi, pathOut - mov ecx, 1024 - repne scasb - inc ecx - mov eax, 1024 - sub eax, ecx - mov dword[edtUnpPath.size], eax - mov dword[edtUnpPath.pos], eax - -;main loop -------------------- -wm_redraw: - call winRedraw - -still: - mcall 10 - cmp eax, 1 - je wm_redraw - cmp eax, 2 - je wm_key - cmp eax, 3 - je wm_button - cmp eax, 6 - je wm_mouse - - jmp still - -wm_key: - mcall 2 - cmp [bWinChild],0 - jne still - - stdcall [edit_box_key],edtPack - stdcall [edit_box_key],edtUnpPath - - jmp still - - -wm_button: - mcall 17 - cmp [bWinChild],0 - jne still - - cmp ah, 3 - jne @f - call selectInput - jmp wm_redraw - @@: - cmp ah, 4 - jne @f - call selectOutFold - jmp wm_redraw - @@: - - cmp ah, 2 - jne @f - mcall 51,1,startUnpack,stackUnpack - mov [bWinChild],1 - ;call startUnpack - jmp wm_redraw - @@: - - cmp ah, 1 - je exit - jmp still - -wm_mouse: - cmp [bWinChild],0 - jne still - stdcall [edit_box_mouse],edtPack - stdcall [edit_box_mouse],edtUnpPath - jmp still - -exit: - mcall -1 - -errorParsing: -dph edx - - dps ' errorParsing' - mcall -1 - -;--- functions ------------------------------------------------------------------ - -proc winRedraw - mcall 12, 1 - mcall 48, 3, sc, sizeof.system_colors - mov edx, [sc.work] - or edx, 0x34000000 - mcall 0, <200,WIN_W>, <200,130>, , , title - mcall 8, <100,100>,<65,25>,2,[sc.work_button] - mcall 8, <(WIN_W-52),33>,<10,20>,3,[sc.work_button] - mcall 8, <(WIN_W-52),33>,<35,20>,4,[sc.work_button] - - edit_boxes_set_sys_color edtPack,endEdits,sc - stdcall [edit_box_draw],edtPack - stdcall [edit_box_draw],edtUnpPath - - - cmp [redInput],0 - jne @f - mov ecx,[sc.work_text] - or ecx,90000000h - jmp .l1 - @@: - mov ecx,90FF0000h - .l1: - mcall 4, <15,16>, , strInp - mov ecx,[sc.work_text] - or ecx,90000000h - mcall 4, <15,37>, , strPath - mov ecx,[sc.work_button_text] - or ecx,90000000h -if lang eq ru_RU - mcall 4, <107,70>, , strGo -else - mcall 4, <127,70>, , strGo -end if - mcall 4, <(WIN_W-47),12>, , strDots - mcall 4, <(WIN_W-47),37>, , strDots - - mcall 12, 2 - ret -endp - -;region -selectInput: - mov [OpenDialog_data.type],0 - stdcall [OpenDialog_Start],OpenDialog_data - mov edi,ODAreaPath - xor al,al - or ecx,-1 - repne scasb - sub edi,ODAreaPath - dec edi - mov dword[edtPack+12*4],edi - mov ecx,edi - inc ecx - mov edi,fInp - mov esi,ODAreaPath - rep movsb - mov [redInput],0 - ret -;endregion - -;region -selectOutFold: - mov [OpenDialog_data.type],2 - stdcall [OpenDialog_Start],OpenDialog_data - mov edi,ODAreaPath - xor al,al - or ecx,-1 - repne scasb - sub edi,ODAreaPath - dec edi - mov dword[edtUnpPath+12*4],edi - mov ecx,edi - inc ecx - mov edi,pathOut - mov esi,ODAreaPath - rep movsb - ret -;endregion - - -;------------------------------------------------------------------------------- - -allfiles dd 0 -succfiles dd 0 -numbytes dd 0 - -proc startUnpack -locals - paramUnp rd 1 - sizeUnpack rd 1 - hFile rd 1 - hFileZip rd 1 - hPlugin rd 1 - pathFold rb 256 -endl -;if input not corrected - cmp [fInp],byte 0 - je .errNullInp - - ; mcall 68, 24, Exception, 0FFFFFFFFh ;?? -;init plugin - push ebp - stdcall [aPluginLoad],kfar_info - pop ebp - - -;set current directory, create folder - cmp [pathOut],0 - jne @f - lea eax,[pathFold] - stdcall cpLastName, fInp, eax - lea eax,[pathFold] - mov [fsNewDir.path],eax - mcall 70, fsNewDir - mov ecx, [fsNewDir.path] - - mcall 30,4,,1 - jmp .n -@@: - mcall 30,4,pathOut,1 -.n: - -;open and read first 1KB - stdcall open, fInp, O_READ - mov [hFileZip], eax - mcall 70,fsZip - test eax,eax - jnz .errNotFound - mcall 70,fsZipRead - - -;open pack - push ebp - stdcall [aOpenFilePlugin],[hFileZip],bdvkPack,filedata_buffer,filedata_buffer_size ,0 ,0 , fInp - pop ebp - - test eax,eax - jnz @f - cmp ebx,0 ;;/ !!!! - je .errNotFound ;;祭 ebx 祭 . - cmp ebx,400h - je .errNotSupp - @@: - mov [hPlugin],eax - -;get num of all files - ; stdcall calcSizeArch,[hPlugin] - push ebp - stdcall [aSetFolder],[hPlugin], .strRoot,0 - pop ebp -;unpack -; void __stdcall GetFiles(HANDLE hPlugin, int NumItems, void* items[], void* addfile, void* adddir); - push ebp - stdcall [aGetFiles], [hPlugin], -1, 0, myAddFile, myAddDir - pop ebp - -jmp @f - .str1 db '/LICENSE.txt',0 - .strRoot db '.svn',0 -@@: - -;HANDLE __stdcall open(HANDLE hPlugin, const char* filename, int mode); -; 䠩 filename. ࠬ mode १ࢨ஢ ⥪饩 ᨨ kfar ᥣ ࠢ 1. - ; push ebp - ; stdcall [aOpen], [hPlugin], .str1, O_READ - ; pop ebp - - ; mov [hFile],eax -;unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size); -;⥭ size buf 䠩 hFile, ࠭ ⮣ १ open. -;size ⥭ 512 -;頥 祭: ᫮ ⠭ , -1 訡. - ; push ebp - ; stdcall [aRead], [hFile], copy_buf, SIZE_COPY_BUF - ; pop ebp - ; -; mcall 70, fsWrite -;void __stdcall close(HANDLE hFile); - push ebp - stdcall [aClose], [hFile] - mov [bWinChild],0 - pop ebp - - push ebp - stdcall [aClosePlugin], [hPlugin] - mov [bWinChild],0 - - mov [fsRunNotifyOK.param],strUnpackOk - mcall 70,fsRunNotifyOK - pop ebp - ret ;SUCCESS - - -.errNotFound: -; stdcall SimpleSayErr,strNotFound - mov [bWinChild],0 - mov [fsRunNotifyOK.param],strUnpackFault - mcall 70,fsRunNotifyOK - ret - -.errNotSupp: - mov eax,[fsNewDir.path] - mov [fsDelDir.path],eax - mcall 70, fsDelDir - - mov [bWinChild],0 - mov [fsRunNotifyOK.param],strUnpackFault - mcall 70,fsRunNotifyOK - ret - -.errNullInp: - mov [redInput],1 - mov [bWinChild],0 - ret -endp - - -proc Exception param1:dword - stdcall SimpleSayErr,strErrorExc - ret -endp - -proc debugInt3 - dps '!!!!!!!!!!!!!!!!!!!!!!!!!' - dnl - int3 - ret -endp - - -allnumbytes dd 0 -strBackFold db '../',0 - -proc calcSizeArch hPlugin:dword -locals - bdwk rb 560 - num rd 1 -endl -;int __stdcall ReadFolder(HANDLE hPlugin, unsigned dirinfo_start, -; unsigned dirinfo_size, void* dirdata); - mov [num],0 - ; int3 -.mainloop: - push ebp - lea eax, [bdwk] - stdcall [aReadFolder], [hPlugin],[num],1,eax - pop ebp - - cmp eax,6 - je .lastFile -;?????????????????????????????????????????????????????????????????????????????????????????????????? - lea ebx,[bdwk+0x20] ;祬 ᬥ饭 +0x20 - ⭮ - test [ebx],dword 10h - jz @f -;bool __stdcall SetFolder(HANDLE hPlugin, const char* relative_path, -; const char* absolute_path); - - push ebp - lea eax,[ebx+40] -dps 'Folder: ' -dpsP eax -dnl - stdcall [aSetFolder],[hPlugin], eax,0 - - pop ebp - stdcall calcSizeArch, [hPlugin] - inc [num] - jmp .mainloop - @@: - - lea ebx,[bdwk+0x20] -lea eax,[ebx+40] -dps 'File: ' -dpsP eax -dnl - mov eax,[ebx+32] - add [allnumbytes],eax - inc [num] - jmp .mainloop - -.lastFile: -; lea ebx,[bdwk+0x20] -; test [ebx],dword 10h -; jz @f -; -; push ebp -; lea eax,[ebx+40] -; stdcall [aSetFolder],[hPlugin], eax,0 -; pop ebp -; stdcall calcSizeArch, [hPlugin] -; @@: - - - push ebp - stdcall [aSetFolder],[hPlugin], strBackFold,0 - pop ebp - ret -endp - - -proc rec_calcSize hPlugin:dword -locals - bdwk rb 560 -endl -;int __stdcall ReadFolder(HANDLE hPlugin, unsigned dirinfo_start, -; unsigned dirinfo_size, void* dirdata); -;bool __stdcall SetFolder(HANDLE hPlugin, const char* relative_path, const char* absolute_path); - push ebp - lea eax,[bdwk] - stdcall [aReadFolder], [hPlugin],1,560,eax - pop ebp - - ret -endp -;------------------------------------------------------------------------------- -;------------------------------------------------------------------------------- -;------------------------------------------------------------------------------- - -hTrPlugin dd 0 - -;eax - file struct for sys70 - -proc rdFoldforTree -locals - fi rd 0 -endl - cmp [hTrPlugin],0 - je .exit - push ebx edi esi - - mov [fi],eax - push ebp - stdcall [aSetFolder],[hTrPlugin], [eax+20],0 - mov ebp,[esp] - ;hPlug,startBlock,numBlocks,buffer - stdcall [aReadFolder], [hTrPlugin],dword[eax+4],\ - dword[eax+12],dword[eax+16] - pop ebp - - ;cmp eax,6 - ;je .lastFile - - ;lea ebx,[bdwk+0x20] ;祬 ᬥ饭 +0x20 - ⭮ - - pop esi edi ebx -.exit: - ret -endp - -;-- DATA ------------------------------------------------------------------- - - - -sc system_colors - - -bWinChild db 0 ;1 - ୥ , ॠ஢ -redInput db 0 ;1 - ᢥ - -if lang eq ru_RU - title db 'uNZ v0.2 - ᯠ騪 Zip 7z',0 - strGo db 'ᯠ',0 - strInp db ' 娢',0 - strPath db ' ',0 - strError db '訡',0 - strErrorExc db ' 訡',0 - strOk db 'OK',0 - strGetPass db '஫',0 - strCancel db '⬥',0 - strUnpackOk db "'ᯥ譮 ᯠ' -O",0 - strUnpackFault db "'訡 ᯠ' -E",0 - strNotSupport db "'ন ଠ 娢' -E",0 - strNotFound db "' ' -E",0 -else if lang eq es_ES - title db 'uNZ v0.2 - Desarchivador para Zip y 7z',0 - strGo db 'Desarchivar',0 - strInp db 'Archivar',0 - strPath db 'Extraer en',0 - strError db 'Error',0 - strErrorExc db 'Error desconocido',0 - strOk db 'OK',0 - strGetPass db 'Contrasena',0 - strCancel db 'Cancelar',0 - strUnpackOk db "'Extracion exitosa' -O",0 - strUnpackFault db "'Fallo al extraer' -E",0 - strNotSupport db "'El formato del archivo no es soportado' -E",0 - strNotFound db "'Archivo no encontrado' -E",0 -else - title db 'uNZ v0.2 - Unarchiver of Zip and 7z',0 - strGo db 'Unpack',0 - strInp db 'Archive',0 - strPath db 'Extract to',0 - strError db 'Error',0 - strErrorExc db 'Unrecognized error',0 - strOk db 'OK',0 - strGetPass db 'Password',0 - strCancel db 'Cancel',0 - strUnpackOk db "'Unpacked successfuly' -O",0 - strUnpackFault db "'Unprack failed' -E",0 - strNotSupport db "'Archive format is not supported' -E",0 - strNotFound db "'File not found' -E",0 -end if - - - -strDots db '...', 0 - -;-------- -; int __stdcall SayErr(int num_strings, const char* strings[], -; int num_buttons, const char* buttons[]); -; int __stdcall DialogBox(DLGDATA* dlg); - -stateDlg dd 0 ;0 - in process, 1 - button ok, 2 - button cancel -errmess0 dd strErrorExc - - -kfar_info: - dd .size - dd version_dword - dd open - dd open2 - dd read - dd -1 ; write: to be implemented - dd seek - dd tell - dd -1 ; flush: to be implemented - dd filesize - dd close - dd xpgalloc - dd xpgrealloc - dd pgfree - dd getfreemem - dd debugInt3;libini_alloc - dd debugInt3;libini_realloc - dd debugInt3;libini_free - dd debugInt3;menu - dd debugInt3;menu_centered_in - dd DialogBox;DialogBox - dd SayErr ;SayErr - dd debugInt3;Message - dd 0 ;cur_width -.size = $ - kfar_info -;-------- - - -iFiles dd 0 ;⢮ ᯠ뢠 䠩 -endPointer dd buffer - - -fsZip: -.cmd dd 5 - dd 0 - dd 0 -.size dd 0 -.buf dd bdvkPack - db 0 - dd fInp - -fsZipRead: -.cmd dd 0 - dd 0 - dd 0 -.size dd 1024 -.buf dd filedata_buffer - db 0 - dd fInp - - -fsWrite: -.cmd dd 2 ;2 rewrite, 3 - write -.pos dd 0 -.hpos dd 0 -.size dd SIZE_COPY_BUF -.buf dd copy_buf - db 0 -.path dd 0 - - -fsNewDir: -.cmd dd 9 - dd 0 - dd 0 - dd 0 - dd 0 - db 0 -.path dd 0 - -fsDelDir: -.cmd dd 8 - dd 0 - dd 0 - dd 0 - dd 0 - db 0 -.path dd 0 - - - -fsRunNotifyOK: -.cmd dd 7 - dd 0 -.param dd strUnpackOk -.size dd 0 -.buf dd 0 - db '/sys/@notify',0 - - - -edtPack edit_box (WIN_W-100-60),100,10,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\ - 1024, fInp, 0,0,0,0 -edtUnpPath edit_box (WIN_W-100-60),100,35,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\ - 1024, pathOut, 0,0,0,0 -edtPassword edit_box 200, 56, 40, 0FFFFFFh,0xff,0x80ff,0h,0x90000000,\ - 255, 0, 0, ed_focus+ed_always_focus ;+ed_pass - -endEdits: - - - -;------------------------------------------------------------------------------- -OpenDialog_data: -.type dd 0 ;0-open, 1-save, 2-select folder -.procinfo dd RBProcInfo ;+4 -.com_area_name dd communication_area_name ;+8 -.com_area dd 0 ;+12 -.opendir_pach dd temp_dir_pach ;+16 -.dir_default_pach dd communication_area_default_pach ;+20 -.start_path dd open_dialog_path ;+24 -.draw_window dd winRedraw ;+28 -.status dd 0 ;+32 -.openfile_pach dd ODAreaPath; ;+36 -.filename_area dd 0; ;+40 -.filter_area dd Filter -.x: -.x_size dw 420 ;+48 ; Window X size -.x_start dw 100 ;+50 ; Window X position -.y: -.y_size dw 320 ;+52 ; Window y size -.y_start dw 100 ;+54 ; Window Y position - -communication_area_name: - db 'FFFFFFFF_open_dialog',0 -open_dialog_path: - db '/sys/File managers/opendial',0 - -communication_area_default_pach: - db '/sys',0 - -Filter dd 0 - - -; int __stdcall ReadFolder(HANDLE hPlugin, -; unsigned dirinfo_start, unsigned dirinfo_size, void* dirdata); -; void __stdcall ClosePlugin(HANDLE hPlugin); -; bool __stdcall SetFolder(HANDLE hPlugin, -; const char* relative_path, const char* absolute_path); -; void __stdcall GetOpenPluginInfo(HANDLE hPlugin, OpenPluginInfo* info); -; void __stdcall GetFiles(HANDLE hPlugin, int NumItems, void* items[], -; void* addfile, void* adddir); -; bool __stdcall addfile(const char* name, void* bdfe_info, HANDLE hFile); -; bool __stdcall adddir(const char* name, void* bdfe_info); -; int __stdcall getattr(HANDLE hPlugin, const char* filename, void* info); -; HANDLE __stdcall open(HANDLE hPlugin, const char* filename, int mode); -; void __stdcall setpos(HANDLE hFile, __int64 pos); -; unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size); -; void __stdcall close(HANDLE hFile); -IMPORTS: -library archiver, 'archiver.obj',\ - box_lib ,'box_lib.obj',\ - proc_lib,'proc_lib.obj' - -import archiver,\ - aPluginLoad , 'plugin_load',\ - aOpenFilePlugin , 'OpenFilePlugin',\ - aClosePlugin , 'ClosePlugin',\ - aReadFolder , 'ReadFolder',\ - aSetFolder , 'SetFolder',\ - aGetFiles , 'GetFiles',\ - aGetOpenPluginInfo , 'GetOpenPluginInfo',\ - aGetattr , 'getattr',\ - aOpen , 'open',\ - aRead , 'read',\ - aSetpos , 'setpos',\ - aClose , 'close',\ - aDeflateUnpack , 'deflate_unpack',\ - aDeflateUnpack2 , 'deflate_unpack2' - -import proc_lib,\ - OpenDialog_Init ,'OpenDialog_init',\ - OpenDialog_Start ,'OpenDialog_start' -import box_lib,\ - edit_box_draw ,'edit_box_draw',\ - edit_box_key ,'edit_box_key',\ - edit_box_mouse ,'edit_box_mouse' - - -IncludeIGlobals - -params1 db '-o "/hd0/1/unz/pig" -h "/hd0/1/unz/abc1"',0 -;-- UDATA ----------------------------------------------------------------------------- -init_end: -align 16 -IncludeUGlobals - -path rb 512 - -;params db 'unz -o "fil epar1" -f "arch1.txt" -f "ar ch2.txt" file1',0 -;params db 'unz -o "fil epar1" -f arch1.txt -f "ar ch2.txt" file1',0 - -fInp rb 1024 -pathOut rb 1024 ;, 㤠 ᯠ -files rd 256 - -fZipInfo rb 40 - -RBProcInfo rb 1024 -temp_dir_pach rb 1024 -ODAreaPath rb 1024 - - - -;-------- - -copy_buf rb SIZE_COPY_BUF - -execdata rb 1024 -execdataend: - -filedata_buffer_size = 1024 -filedata_buffer rb filedata_buffer_size - -CopyDestEditBuf rb 12+512+1 -.length = $ - CopyDestEditBuf - 13 - -bdvkPack rb 560 - - - -;------------ memory_manager.inc -align 4 -MM_NBlocks rd 1 ;⢮ 뤥 -MM_BlocksInfo rd 2*MM_MAX_BLOCKS ;begin,size - - -;-------- - -buffer rb 4096 ;for string of file name for extract -params rb 4096 - - rb 1024 -stackUnpack: - - rb 1024 -stackDlg: - - rb 1024 -stack_top: - -end_mem: - - +;unz - ᯠ騪, ᯮ騩 archiver.obj. ন zip 7z. + +;unz [-o output path] [-f file for unpack] [-f ...] [-h] file.zip +;-h - hide GUI. If params is empty - do exit. + +;unz -o /hd0/1/arci -f text1.txt file.zip -unpack in folder only file text1.txt +;or +;unz -o "/hd0/1/arci" -f "text1.txt" text2.txt "file.zip" -unpack in folder only file text1.txt and text2.txt + + +; +;unz -n "namezone" "file.zip" - open packed file, write list files of main folder in namezone +;namezone: +;dd 0 - ᫨ , 1 +;dd cmd - 0 +; 1 ᯨ᮪ 䠩 +; 2 䠩 +; 3 ⠭ ⥪訩 ⠫ 娢 +; 4 ࠡ +;data - , +; 1 ᯨ᮪ 䠩 +; input +; none +; output +; dd numfiles - ⢮ 䠩 ⥪饬 ⠫ +; strz file1...fileN - ᯨ᮪ ப, ࠧ 0 +; 2 䠩 +; input +; dd num bytes +; strz filename (file1.txt of /fold1/file1.txt) +; output +; dd num bytes +; data + +use32 +org 0 +db 'MENUET01' +dd 1, start, init_end, end_mem, stack_top, params, 0 + + +include 'lang.inc' ; Language support for locales: ru_RU (CP866), es_ES, en_US. +include '../../macros.inc' +include '../../proc32.inc' +include '../../develop/libraries/box_lib/trunk/box_lib.mac' +include '../../dll.inc' +;include '../../debug.inc' +include 'debug.inc' + +version equ '0.70' +version_dword equ 0*10000h + 70 + +WIN_W = 400 +SIZE_COPY_BUF = 1024*1024*2 +MM_MAX_BLOCKS equ 1024 + + +virtual at 0 +kfar_info_struc: +.lStructSize dd ? +.kfar_ver dd ? +.open dd ? +.open2 dd ? +.read dd ? +.write dd ? +.seek dd ? +.tell dd ? +.flush dd ? +.filesize dd ? +.close dd ? +.pgalloc dd ? +.pgrealloc dd ? +.pgfree dd ? +.getfreemem dd ? +.pgalloc2 dd ? +.pgrealloc2 dd ? +.pgfree2 dd ? +.menu dd ? +.menu_centered_in dd ? +.DialogBox dd ? +.SayErr dd ? +.Message dd ? +.cur_console_size dd ? +end virtual + + + +;-- CODE ------------------------------------------------------------------- + +include 'parse.inc' +include 'fs.inc' +include 'file_tree.inc' +include 'memory_manager.inc' +include 'dialogs.inc' + + +start: +;dnl +;dpsP params +;dnl + mcall 68, 11 + mcall 40, 100111b + 0C0000000h + stdcall dll.Load, IMPORTS + test eax, eax + jnz exit + mov [pathOut],0 + +;---------------------------- + ;1. find input file, clear + ;2. find -o, copy data, clear + ;3. find -f, add pointer, copy data, clear + ;4. find -c, check variable, clear +;1. + call getLastParam + test eax, eax + je wm_redraw + dec eax + je .arbeit + jmp errorParsing + +.arbeit: +;2. + call getParamOutPath + cmp eax, 2 + je errorParsing + +;3. + + @@: + mov eax, [iFiles] + shl eax, 2 + add eax, files + m2m dword[eax], dword[endPointer] + stdcall getParam, '-f' + cmp eax, 2 + je errorParsing + inc [iFiles] + cmp eax, 1 + je @b + +;4. + mov edi, params + mov ax,'-h' +@@: cmp word [edi], ax + je .check + inc edi + cmp edi, params+1024 + je @f + cmp byte[edi],0 + je @f + jmp @b +.check: + call startUnpack + mcall -1 +@@: + + stdcall [OpenDialog_Init],OpenDialog_data + +;init edit fields -------------- + xor al,al + mov edi,fInp + mov ecx,1024 + repne scasb + inc ecx + mov eax,1024 + sub eax,ecx + mov dword[edtPack.size],eax + mov dword[edtPack.pos],eax + + xor al, al + mov edi, pathOut + mov ecx, 1024 + repne scasb + inc ecx + mov eax, 1024 + sub eax, ecx + mov dword[edtUnpPath.size], eax + mov dword[edtUnpPath.pos], eax + +;main loop -------------------- +wm_redraw: + call winRedraw + +still: + mcall 10 + cmp eax, 1 + je wm_redraw + cmp eax, 2 + je wm_key + cmp eax, 3 + je wm_button + cmp eax, 6 + je wm_mouse + + jmp still + +wm_key: + mcall 2 + cmp [bWinChild],0 + jne still + + stdcall [edit_box_key],edtPack + stdcall [edit_box_key],edtUnpPath + + jmp still + + +wm_button: + mcall 17 + cmp [bWinChild],0 + jne still + + cmp ah, 3 + jne @f + call selectInput + jmp wm_redraw + @@: + cmp ah, 4 + jne @f + call selectOutFold + jmp wm_redraw + @@: + + cmp ah, 2 + jne @f + mcall 51,1,startUnpack,stackUnpack + mov [bWinChild],1 + ;call startUnpack + jmp wm_redraw + @@: + + cmp ah, 1 + je exit + jmp still + +wm_mouse: + cmp [bWinChild],0 + jne still + stdcall [edit_box_mouse],edtPack + stdcall [edit_box_mouse],edtUnpPath + jmp still + +exit: + mcall -1 + +errorParsing: +dph edx + + dps ' errorParsing' + mcall -1 + +;--- functions ------------------------------------------------------------------ + +proc winRedraw + mcall 12, 1 + mcall 48, 3, sc, sizeof.system_colors + mov edx, [sc.work] + or edx, 0x34000000 + mcall 0, <200,WIN_W>, <200,130>, , , title + mcall 8, <100,100>,<65,25>,2,[sc.work_button] + mcall 8, <(WIN_W-52),33>,<10,20>,3,[sc.work_button] + mcall 8, <(WIN_W-52),33>,<35,20>,4,[sc.work_button] + + edit_boxes_set_sys_color edtPack,endEdits,sc + stdcall [edit_box_draw],edtPack + stdcall [edit_box_draw],edtUnpPath + + + cmp [redInput],0 + jne @f + mov ecx,[sc.work_text] + or ecx,90000000h + jmp .l1 + @@: + mov ecx,90FF0000h + .l1: + mcall 4, <15,16>, , strInp + mov ecx,[sc.work_text] + or ecx,90000000h + mcall 4, <15,37>, , strPath + mov ecx,[sc.work_button_text] + or ecx,90000000h +if lang eq ru_RU + mcall 4, <107,70>, , strGo +else ; Default to en_US + mcall 4, <127,70>, , strGo +end if + mcall 4, <(WIN_W-47),12>, , strDots + mcall 4, <(WIN_W-47),37>, , strDots + + mcall 12, 2 + ret +endp + +;region +selectInput: + mov [OpenDialog_data.type],0 + stdcall [OpenDialog_Start],OpenDialog_data + mov edi,ODAreaPath + xor al,al + or ecx,-1 + repne scasb + sub edi,ODAreaPath + dec edi + mov dword[edtPack+12*4],edi + mov ecx,edi + inc ecx + mov edi,fInp + mov esi,ODAreaPath + rep movsb + mov [redInput],0 + ret +;endregion + +;region +selectOutFold: + mov [OpenDialog_data.type],2 + stdcall [OpenDialog_Start],OpenDialog_data + mov edi,ODAreaPath + xor al,al + or ecx,-1 + repne scasb + sub edi,ODAreaPath + dec edi + mov dword[edtUnpPath+12*4],edi + mov ecx,edi + inc ecx + mov edi,pathOut + mov esi,ODAreaPath + rep movsb + ret +;endregion + + +;------------------------------------------------------------------------------- + +allfiles dd 0 +succfiles dd 0 +numbytes dd 0 + +proc startUnpack +locals + paramUnp rd 1 + sizeUnpack rd 1 + hFile rd 1 + hFileZip rd 1 + hPlugin rd 1 + pathFold rb 256 +endl +;if input not corrected + cmp [fInp],byte 0 + je .errNullInp + + ; mcall 68, 24, Exception, 0FFFFFFFFh ;?? +;init plugin + push ebp + stdcall [aPluginLoad],kfar_info + pop ebp + + +;set current directory, create folder + cmp [pathOut],0 + jne @f + lea eax,[pathFold] + stdcall cpLastName, fInp, eax + lea eax,[pathFold] + mov [fsNewDir.path],eax + mcall 70, fsNewDir + mov ecx, [fsNewDir.path] + + mcall 30,4,,1 + jmp .n +@@: + mcall 30,4,pathOut,1 +.n: + +;open and read first 1KB + stdcall open, fInp, O_READ + mov [hFileZip], eax + mcall 70,fsZip + test eax,eax + jnz .errNotFound + mcall 70,fsZipRead + + +;open pack + push ebp + stdcall [aOpenFilePlugin],[hFileZip],bdvkPack,filedata_buffer,filedata_buffer_size ,0 ,0 , fInp + pop ebp + + test eax,eax + jnz @f + cmp ebx,0 ;;/ !!!! + je .errNotFound ;;祭 ebx 祭 . + cmp ebx,400h + je .errNotSupp + @@: + mov [hPlugin],eax + +;get num of all files + ; stdcall calcSizeArch,[hPlugin] + push ebp + stdcall [aSetFolder],[hPlugin], .strRoot,0 + pop ebp +;unpack +; void __stdcall GetFiles(HANDLE hPlugin, int NumItems, void* items[], void* addfile, void* adddir); + push ebp + stdcall [aGetFiles], [hPlugin], -1, 0, myAddFile, myAddDir + pop ebp + +jmp @f + .str1 db '/LICENSE.txt',0 + .strRoot db '.svn',0 +@@: + +;HANDLE __stdcall open(HANDLE hPlugin, const char* filename, int mode); +; 䠩 filename. ࠬ mode १ࢨ஢ ⥪饩 ᨨ kfar ᥣ ࠢ 1. + ; push ebp + ; stdcall [aOpen], [hPlugin], .str1, O_READ + ; pop ebp + + ; mov [hFile],eax +;unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size); +;⥭ size buf 䠩 hFile, ࠭ ⮣ १ open. +;size ⥭ 512 +;頥 祭: ᫮ ⠭ , -1 訡. + ; push ebp + ; stdcall [aRead], [hFile], copy_buf, SIZE_COPY_BUF + ; pop ebp + ; +; mcall 70, fsWrite +;void __stdcall close(HANDLE hFile); + push ebp + stdcall [aClose], [hFile] + mov [bWinChild],0 + pop ebp + + push ebp + stdcall [aClosePlugin], [hPlugin] + mov [bWinChild],0 + + mov [fsRunNotifyOK.param],strUnpackOk + mcall 70,fsRunNotifyOK + pop ebp + ret ;SUCCESS + + +.errNotFound: +; stdcall SimpleSayErr,strNotFound + mov [bWinChild],0 + mov [fsRunNotifyOK.param],strUnpackFault + mcall 70,fsRunNotifyOK + ret + +.errNotSupp: + mov eax,[fsNewDir.path] + mov [fsDelDir.path],eax + mcall 70, fsDelDir + + mov [bWinChild],0 + mov [fsRunNotifyOK.param],strUnpackFault + mcall 70,fsRunNotifyOK + ret + +.errNullInp: + mov [redInput],1 + mov [bWinChild],0 + ret +endp + + +proc Exception param1:dword + stdcall SimpleSayErr,strErrorExc + ret +endp + +proc debugInt3 + dps '!!!!!!!!!!!!!!!!!!!!!!!!!' + dnl + int3 + ret +endp + + +allnumbytes dd 0 +strBackFold db '../',0 + +proc calcSizeArch hPlugin:dword +locals + bdwk rb 560 + num rd 1 +endl +;int __stdcall ReadFolder(HANDLE hPlugin, unsigned dirinfo_start, +; unsigned dirinfo_size, void* dirdata); + mov [num],0 + ; int3 +.mainloop: + push ebp + lea eax, [bdwk] + stdcall [aReadFolder], [hPlugin],[num],1,eax + pop ebp + + cmp eax,6 + je .lastFile +;?????????????????????????????????????????????????????????????????????????????????????????????????? + lea ebx,[bdwk+0x20] ;祬 ᬥ饭 +0x20 - ⭮ + test [ebx],dword 10h + jz @f +;bool __stdcall SetFolder(HANDLE hPlugin, const char* relative_path, +; const char* absolute_path); + + push ebp + lea eax,[ebx+40] +dps 'Folder: ' +dpsP eax +dnl + stdcall [aSetFolder],[hPlugin], eax,0 + + pop ebp + stdcall calcSizeArch, [hPlugin] + inc [num] + jmp .mainloop + @@: + + lea ebx,[bdwk+0x20] +lea eax,[ebx+40] +dps 'File: ' +dpsP eax +dnl + mov eax,[ebx+32] + add [allnumbytes],eax + inc [num] + jmp .mainloop + +.lastFile: +; lea ebx,[bdwk+0x20] +; test [ebx],dword 10h +; jz @f +; +; push ebp +; lea eax,[ebx+40] +; stdcall [aSetFolder],[hPlugin], eax,0 +; pop ebp +; stdcall calcSizeArch, [hPlugin] +; @@: + + + push ebp + stdcall [aSetFolder],[hPlugin], strBackFold,0 + pop ebp + ret +endp + + +proc rec_calcSize hPlugin:dword +locals + bdwk rb 560 +endl +;int __stdcall ReadFolder(HANDLE hPlugin, unsigned dirinfo_start, +; unsigned dirinfo_size, void* dirdata); +;bool __stdcall SetFolder(HANDLE hPlugin, const char* relative_path, const char* absolute_path); + push ebp + lea eax,[bdwk] + stdcall [aReadFolder], [hPlugin],1,560,eax + pop ebp + + ret +endp +;------------------------------------------------------------------------------- +;------------------------------------------------------------------------------- +;------------------------------------------------------------------------------- + +hTrPlugin dd 0 + +;eax - file struct for sys70 + +proc rdFoldforTree +locals + fi rd 0 +endl + cmp [hTrPlugin],0 + je .exit + push ebx edi esi + + mov [fi],eax + push ebp + stdcall [aSetFolder],[hTrPlugin], [eax+20],0 + mov ebp,[esp] + ;hPlug,startBlock,numBlocks,buffer + stdcall [aReadFolder], [hTrPlugin],dword[eax+4],\ + dword[eax+12],dword[eax+16] + pop ebp + + ;cmp eax,6 + ;je .lastFile + + ;lea ebx,[bdwk+0x20] ;祬 ᬥ饭 +0x20 - ⭮ + + pop esi edi ebx +.exit: + ret +endp + +;-- DATA ------------------------------------------------------------------- + + + +sc system_colors + + +bWinChild db 0 ;1 - ୥ , ॠ஢ +redInput db 0 ;1 - ᢥ + +if lang eq ru_RU + title db 'uNZ v0.2 - ᯠ騪 Zip 7z',0 + strGo db 'ᯠ',0 + strInp db ' 娢',0 + strPath db ' ',0 + strError db '訡',0 + strErrorExc db ' 訡',0 + strOk db 'OK',0 + strGetPass db '஫',0 + strCancel db '⬥',0 + strUnpackOk db "'ᯥ譮 ᯠ' -O",0 + strUnpackFault db "'訡 ᯠ' -E",0 + strNotSupport db "'ন ଠ 娢' -E",0 + strNotFound db "' ' -E",0 +else if lang eq es_ES + title db 'uNZ v0.2 - Desarchivador para Zip y 7z',0 + strGo db 'Desarchivar',0 + strInp db 'Archivar',0 + strPath db 'Extraer en',0 + strError db 'Error',0 + strErrorExc db 'Error desconocido',0 + strOk db 'OK',0 + strGetPass db 'Contrasena',0 + strCancel db 'Cancelar',0 + strUnpackOk db "'Extracion exitosa' -O",0 + strUnpackFault db "'Fallo al extraer' -E",0 + strNotSupport db "'El formato del archivo no es soportado' -E",0 + strNotFound db "'Archivo no encontrado' -E",0 +else ; Default to en_US + title db 'uNZ v0.2 - Unarchiver of Zip and 7z',0 + strGo db 'Unpack',0 + strInp db 'Archive',0 + strPath db 'Extract to',0 + strError db 'Error',0 + strErrorExc db 'Unrecognized error',0 + strOk db 'OK',0 + strGetPass db 'Password',0 + strCancel db 'Cancel',0 + strUnpackOk db "'Unpacked successfully' -O",0 + strUnpackFault db "'Unpack failed' -E",0 + strNotSupport db "'Archive format is not supported' -E",0 + strNotFound db "'File not found' -E",0 +end if + + + +strDots db '...', 0 + +;-------- +; int __stdcall SayErr(int num_strings, const char* strings[], +; int num_buttons, const char* buttons[]); +; int __stdcall DialogBox(DLGDATA* dlg); + +stateDlg dd 0 ;0 - in process, 1 - button ok, 2 - button cancel +errmess0 dd strErrorExc + + +kfar_info: + dd .size + dd version_dword + dd open + dd open2 + dd read + dd -1 ; write: to be implemented + dd seek + dd tell + dd -1 ; flush: to be implemented + dd filesize + dd close + dd xpgalloc + dd xpgrealloc + dd pgfree + dd getfreemem + dd debugInt3;libini_alloc + dd debugInt3;libini_realloc + dd debugInt3;libini_free + dd debugInt3;menu + dd debugInt3;menu_centered_in + dd DialogBox;DialogBox + dd SayErr ;SayErr + dd debugInt3;Message + dd 0 ;cur_width +.size = $ - kfar_info +;-------- + + +iFiles dd 0 ;⢮ ᯠ뢠 䠩 +endPointer dd buffer + + +fsZip: +.cmd dd 5 + dd 0 + dd 0 +.size dd 0 +.buf dd bdvkPack + db 0 + dd fInp + +fsZipRead: +.cmd dd 0 + dd 0 + dd 0 +.size dd 1024 +.buf dd filedata_buffer + db 0 + dd fInp + + +fsWrite: +.cmd dd 2 ;2 rewrite, 3 - write +.pos dd 0 +.hpos dd 0 +.size dd SIZE_COPY_BUF +.buf dd copy_buf + db 0 +.path dd 0 + + +fsNewDir: +.cmd dd 9 + dd 0 + dd 0 + dd 0 + dd 0 + db 0 +.path dd 0 + +fsDelDir: +.cmd dd 8 + dd 0 + dd 0 + dd 0 + dd 0 + db 0 +.path dd 0 + + + +fsRunNotifyOK: +.cmd dd 7 + dd 0 +.param dd strUnpackOk +.size dd 0 +.buf dd 0 + db '/sys/@notify',0 + + + +edtPack edit_box (WIN_W-100-60),100,10,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\ + 1024, fInp, 0,0,0,0 +edtUnpPath edit_box (WIN_W-100-60),100,35,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\ + 1024, pathOut, 0,0,0,0 +edtPassword edit_box 200, 56, 40, 0FFFFFFh,0xff,0x80ff,0h,0x90000000,\ + 255, 0, 0, ed_focus+ed_always_focus ;+ed_pass + +endEdits: + + + +;------------------------------------------------------------------------------- +OpenDialog_data: +.type dd 0 ;0-open, 1-save, 2-select folder +.procinfo dd RBProcInfo ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_pach dd temp_dir_pach ;+16 +.dir_default_pach dd communication_area_default_pach ;+20 +.start_path dd open_dialog_path ;+24 +.draw_window dd winRedraw ;+28 +.status dd 0 ;+32 +.openfile_pach dd ODAreaPath; ;+36 +.filename_area dd 0; ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 100 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 100 ;+54 ; Window Y position + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_path: + db '/sys/File managers/opendial',0 + +communication_area_default_pach: + db '/sys',0 + +Filter dd 0 + + +; int __stdcall ReadFolder(HANDLE hPlugin, +; unsigned dirinfo_start, unsigned dirinfo_size, void* dirdata); +; void __stdcall ClosePlugin(HANDLE hPlugin); +; bool __stdcall SetFolder(HANDLE hPlugin, +; const char* relative_path, const char* absolute_path); +; void __stdcall GetOpenPluginInfo(HANDLE hPlugin, OpenPluginInfo* info); +; void __stdcall GetFiles(HANDLE hPlugin, int NumItems, void* items[], +; void* addfile, void* adddir); +; bool __stdcall addfile(const char* name, void* bdfe_info, HANDLE hFile); +; bool __stdcall adddir(const char* name, void* bdfe_info); +; int __stdcall getattr(HANDLE hPlugin, const char* filename, void* info); +; HANDLE __stdcall open(HANDLE hPlugin, const char* filename, int mode); +; void __stdcall setpos(HANDLE hFile, __int64 pos); +; unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size); +; void __stdcall close(HANDLE hFile); +IMPORTS: +library archiver, 'archiver.obj',\ + box_lib ,'box_lib.obj',\ + proc_lib,'proc_lib.obj' + +import archiver,\ + aPluginLoad , 'plugin_load',\ + aOpenFilePlugin , 'OpenFilePlugin',\ + aClosePlugin , 'ClosePlugin',\ + aReadFolder , 'ReadFolder',\ + aSetFolder , 'SetFolder',\ + aGetFiles , 'GetFiles',\ + aGetOpenPluginInfo , 'GetOpenPluginInfo',\ + aGetattr , 'getattr',\ + aOpen , 'open',\ + aRead , 'read',\ + aSetpos , 'setpos',\ + aClose , 'close',\ + aDeflateUnpack , 'deflate_unpack',\ + aDeflateUnpack2 , 'deflate_unpack2' + +import proc_lib,\ + OpenDialog_Init ,'OpenDialog_init',\ + OpenDialog_Start ,'OpenDialog_start' +import box_lib,\ + edit_box_draw ,'edit_box_draw',\ + edit_box_key ,'edit_box_key',\ + edit_box_mouse ,'edit_box_mouse' + + +IncludeIGlobals + +params1 db '-o "/hd0/1/unz/pig" -h "/hd0/1/unz/abc1"',0 +;-- UDATA ----------------------------------------------------------------------------- +init_end: +align 16 +IncludeUGlobals + +path rb 512 + +;params db 'unz -o "fil epar1" -f "arch1.txt" -f "ar ch2.txt" file1',0 +;params db 'unz -o "fil epar1" -f arch1.txt -f "ar ch2.txt" file1',0 + +fInp rb 1024 +pathOut rb 1024 ;, 㤠 ᯠ +files rd 256 + +fZipInfo rb 40 + +RBProcInfo rb 1024 +temp_dir_pach rb 1024 +ODAreaPath rb 1024 + + + +;-------- + +copy_buf rb SIZE_COPY_BUF + +execdata rb 1024 +execdataend: + +filedata_buffer_size = 1024 +filedata_buffer rb filedata_buffer_size + +CopyDestEditBuf rb 12+512+1 +.length = $ - CopyDestEditBuf - 13 + +bdvkPack rb 560 + + + +;------------ memory_manager.inc +align 4 +MM_NBlocks rd 1 ;⢮ 뤥 +MM_BlocksInfo rd 2*MM_MAX_BLOCKS ;begin,size + + +;-------- + +buffer rb 4096 ;for string of file name for extract +params rb 4096 + + rb 1024 +stackUnpack: + + rb 1024 +stackDlg: + + rb 1024 +stack_top: + +end_mem: + + diff --git a/programs/games/15/trunk/15.ASM b/programs/games/15/trunk/15.ASM index 40de75e229..0866c87897 100644 --- a/programs/games/15/trunk/15.ASM +++ b/programs/games/15/trunk/15.ASM @@ -1,490 +1,490 @@ -; -; The famous game 15 -; Author: Lloyd, coded by Ivushkin Andrey -; Compile with FASM -; - -include 'lang.inc' -include '..\..\..\macros.inc' ; decreases program size (not required) - -StatusColor equ 0x00ffffff -StatusColor2 equ 0x00dc1e14 -BgdColor equ 0x14aabbcc - -; Main window dimensions -XXwindow equ 200 shl 16+276 -YYwindow equ 200 shl 16+300 -; Status bar -XYstatus equ 35 shl 16+283 -XXbar equ 35 shl 16+136 -YYbar equ 280 shl 16+15 -; Buttons -BtnTop equ 28 -BtnLeft equ 13 -BtnSize equ 60 -BtnColor equ 0xafbb55 -BtnColor2 equ 0x0228c314 - -NumColor equ 0x10000000 -; Number shifting for nice look -NumShift equ 23 shl 16+23 -NumShift2 equ 4 shl 16 -; Shuffle button -XXSh equ 202 shl 16+60 -YYSh equ 280 shl 16+12 -XYShText equ 212 shl 16+283 - -; Conf button -XXCnf equ 13 shl 16+13 -YYCnf equ 280 shl 16+12 -XYCnfText equ 18 shl 16+283 - -; Position of the 'hole' -null equ (curconf+16) -; Amount of moves to perform shuffle -SH_CYCLES equ 400 -; (Amount of tasks)-1 -CONF_COUNT equ 2 - -use32 - - org 0x0 - - db 'MENUET01' - dd 0x01 - dd START - dd I_END - dd 0x2000 ; 8 Kb - dd 0x2000 - dd 0x0 - dd 0x0 - - -START: - mov [cptr],CONF_COUNT ; number of task - mov eax,3 - mcall - mov cl,16 - ror eax,cl - mov [generator],eax ; random generator from Tetris - init: - mov ecx,17 - movzx eax,[cptr] - inc eax - cmp eax,CONF_COUNT - jna init_ok - xor eax,eax ; cycling 0..CONF_COUNT - init_ok: - mov [cptr],al - mov esi,eax - shl esi,4 - add esi,conf - add esi,eax - add al,0x31 - mov [txtTitle+17],al ;task number to program title - mov [task],esi - mov edi,curconf - rep movsb ; initial configuration - - mov [sts],4 - jmp red -SHUF: - call shuffle ; immediate shuffle -red: ; window redraw - - call draw_window - -still: ; MAIN PROGRAM CYCLE - - mov eax,10 ; wait for event - mcall - - cmp eax,1 ; redraw? - - je red ; goto red - cmp eax,2 ; key pressed? - - je key ; goto key - cmp eax,3 ; button pressed? - - je button ; goto button - - jmp still ; no more events to process - - key: ; Key pressed - mov eax,2 - mcall - shr eax,8 - cmp eax,32 ; = Shuffle - je SHUF - cmp eax,13 ; = Choose task - je init - cmp eax,176 - jl still - sub eax,176 - cmp eax,3 - ja still - movzx eax,byte [eax+correct] ; 'delta' value from correct[] - jmp m_check - - button: ; Button pressed - mov eax,17 - mcall - shr eax,8 - sub eax,2 - - cmp eax,-1 ; id == 1 (closeme)? - jne noclose - mcall - - noclose: - jl SHUF ; Shuffle (id=0) pressed - cmp eax,18 - je init ; Conf button pressed - sub al,byte [null] - mov edi,correct - mov ecx,4 - repne scasb ; checking for valid move-part 1 - jne fail - m_check: - cmp byte[sts],4 ; puzzle completed, blocking buttons - ja still - call move_check ; checking for valid move-part 2 - jnc fail - inc [move_count] - call draw_moves -fail: - jmp still ; 頥 - -; ******************************* -; ******* WINDOW DRAWING ******* -; ******************************* - -draw_window: - - mcall 12, 1 ; begin draw - mcall 0, XXwindow, YYwindow, BgdColor,, txtTitle ; CREATING WINDOW - - - mov eax,8 ; SHUFFLE BUTTON - mov ebx,XXSh - mov ecx,YYSh - xor edx,edx - mov esi,BtnColor - mcall - - mov ebx,XXCnf ; CONF BUTTON - mov ecx,YYCnf - mov edx,20 - ;mov esi,BtnColor - mcall - - mov ebx, XYShText ; SHUFFLE TEXT - mov ecx, StatusColor - mov edx,txtSh - mov esi,lenSh-txtSh - mov eax,4 - mcall - - mov ebx, XYCnfText ; CONF TEXT - mov edx,lenVictory-1 - mov esi,1 - mcall - - mov ecx, 16 ; FIELD BUTTONS - dbut: - call draw_button - loop dbut - - call draw_moves - - mcall 12, 2 ; end of drawing - ret - - -; ********************************************* -; ******* DRAWING A FIELD BUTTON ************** -; ********************************************* -; ECX - button number - -draw_button: - pusha - dec ecx - ; calculating button dimensions - mov edi, ecx - lea edx,[ecx+2] - mov ebx,ecx - and ebx,11b - shr ecx,2 - - imul ebx,BtnSize+3 - add ebx,BtnLeft - shl ebx,16 - add ebx,BtnSize - - imul ecx,BtnSize+3 - add ecx,BtnTop - shl ecx,16 - add ecx,BtnSize - movzx eax,byte [null] - cmp eax,edi - jne no_hole - - pusha - inc ebx - inc ecx - mov edx,BgdColor - mov eax,13 ; clearing - 'hole' - mcall - popa - - or edx,0x80000000 ; and removing button under it -no_hole: - mov al,byte[edi+curconf] - mov esi,[task] - cmp al,byte[edi+esi] - je highlight - mov esi,BtnColor - jmp s_rbutton -highlight: - mov esi,BtnColor2 -s_rbutton: - mov eax,8 ; set/remove button - mcall - movzx eax,byte [null] - cmp eax,edi - je no_text ; no digits - that's hole - mov edx,ebx - shr ecx,16 - mov dx,cx - add edx,NumShift - mov ebx,0x20000 - movzx ecx,byte [edi+curconf] - cmp ecx,9 - ja two_num - add edx,NumShift2 ; shift to center digits - sub ebx,0x10000 -two_num: - mov esi,NumColor - mov eax,47 - mcall -no_text: - popa - ret - - -; ********************************************* -; ******* DRAWING STATUS LINE ***************** -; ********************************************* - -draw_moves: - mov eax, 13 ; clear area - mov ebx, XXbar - mov ecx, YYbar - mov edx, BgdColor - mcall - - mov eax, 4 - mov ebx, XYstatus - mov ecx, StatusColor - cmp ax, [sts] - jl report_victory - jne report_moves - mov edx,txtCnf ; prompt to choose configuration - mov esi,lenCnf-txtCnf - jmp e_dm - report_moves: - mov edx,txtMoves ; how many moves done - mov esi,lenMoves-txtMoves - mov eax,4 - mcall - mov esi,ecx - mov edx,ebx - add edx, 40 shl 16 - mov ebx,0x030000 - movzx ecx, byte[move_count] - mov eax,47 - jmp e_dm - report_victory: ; puzzle completed - mov ecx,StatusColor2 - mov edx,txtVictory - mov esi,lenVictory-txtVictory - e_dm: - mcall - ret - - -; ********************************************* -; ********* SHUFFLE *************************** -; ********************************************* - -shuffle: - xor eax,eax - mov [sts],ax - mov [move_count],ax ; reset moves to 0 - mov [sh_off],al - mov eax, [generator] - - mov ecx,SH_CYCLES - sh_cycle: - sub eax,0x43ab45b5 ; next random number - ror eax,1 - xor eax,0x32c4324f - ror eax,1 - mov [generator],eax - - push eax - and eax,11b ; direction 0..3 - movzx eax,byte [eax+correct] - call move_check - pop eax - jnc sh_cycle ; if fails then retry - loop sh_cycle - inc byte[sh_off] ; shuffling complete - ret - - -; ********************************************* -; ********* MOVE VALIDITY CHECK *************** -; ********************************************* -; AL - 'DELTA' DIRECTION - -move_check: - pusha - mov ah,byte [null] - mov bx,ax - cmp bh,3 - ja no_top - cmp al,-4 ; top of field - je no_move -no_top: - cmp bh,12 - jb no_bottom - cmp al,4 ; bottom of field - je no_move -no_bottom: - and bh,11b - cmp bh,0 - jnz no_left - cmp al,-1 ; left of field - je no_move -no_left: - cmp bh,11b - jnz ok - cmp al,1 ; right of field - je no_move -ok: - mov bx,ax - add bh,bl ; bh-new hole - mov byte [null],bh - movzx ecx,ah - mov al,byte[ecx+curconf] - movzx edx,bh - mov bl,byte[edx+curconf] ; swapping button & hole - mov byte[ecx+curconf],bl - mov byte[edx+curconf],al - - cmp byte[sh_off],0 ; if shuffle in progress, - jz no_win ; then no redraw - - ; drawing button & hole - inc ecx - call draw_button - movzx ecx,bh - inc ecx - call draw_button - ; testing if task completed - mov esi,[task] - mov edi,curconf - mov ecx,16 - repe cmpsb - cmp ecx,0 - jne no_win - mov word[sts],6 ; puzzle done. Victory! -no_win: - popa - stc - ret -no_move: - popa - clc - ret -; this is deprecated debug routine -;ud: -; ud2 - -; These are data used by program - -correct db 1,-4,4,-1 - -conf db 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,15 - db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0 - db 1,2,3,4,12,13,14,5,11,0,15,6,10,9,8,7,9 - -txtMoves: -if lang eq ru_RU - db ':' -else if lang eq it_IT - db 'Movimenti:' -else if lang eq de_DE - db 'Bewegungen:' -else - db 'Moves:' -end if -lenMoves: - -txtSh: -if lang eq ru_RU - db 'ᮢ' -else if lang eq it_IT - db 'Mischia' -else if lang eq de_DE - db 'Mischen' -else - db 'Shuffle' -end if -lenSh: - -txtCnf: -if lang eq ru_RU - db '롥 ->' -else if lang eq it_IT - db 'Seleziona un compito, poi premi->' -else if lang eq de_DE - db 'Waehle eine Aufgabe, dann clicke au->' -else - db 'Select task, then press ->' -end if -lenCnf: - -txtTitle: ; ப -if lang eq ru_RU - db ' 15 - X', 0 -else if lang eq it_IT - db 'Gioco del quindici - partita X', 0 -else if lang eq de_DE - db '15-Puzzle - Spiel X', 0 -else - db 'Game 15 - puzzle X', 0 -end if - -txtVictory: -if lang eq ru_RU - db ' 訫 ! ->' -else if lang eq it_IT - db 'Gioco completato! Premi ->' -else if lang eq de_DE - db 'Spiel beendet! Druecken sie auf ->' -else - db 'Puzzle completed! Press->' -end if -lenVictory: - -arrow equ lenVictory-2 - -I_END: ; ணࠬ -;null db ? -move_count dw ? -cptr db ? -sts dw ? -sh_off db ? -task dd ? -generator dd ? -curconf: +; +; The famous game 15 +; Author: Lloyd, coded by Ivushkin Andrey +; Compile with FASM +; + +include 'lang.inc' ; Language support for locales: ru_RU (CP866), it_IT, de_DE, en_US. +include '..\..\..\macros.inc' ; decreases program size (not required) + +StatusColor equ 0x00ffffff +StatusColor2 equ 0x00dc1e14 +BgdColor equ 0x14aabbcc + +; Main window dimensions +XXwindow equ 200 shl 16+276 +YYwindow equ 200 shl 16+300 +; Status bar +XYstatus equ 35 shl 16+283 +XXbar equ 35 shl 16+136 +YYbar equ 280 shl 16+15 +; Buttons +BtnTop equ 28 +BtnLeft equ 13 +BtnSize equ 60 +BtnColor equ 0xafbb55 +BtnColor2 equ 0x0228c314 + +NumColor equ 0x10000000 +; Number shifting for nice look +NumShift equ 23 shl 16+23 +NumShift2 equ 4 shl 16 +; Shuffle button +XXSh equ 202 shl 16+60 +YYSh equ 280 shl 16+12 +XYShText equ 212 shl 16+283 + +; Conf button +XXCnf equ 13 shl 16+13 +YYCnf equ 280 shl 16+12 +XYCnfText equ 18 shl 16+283 + +; Position of the 'hole' +null equ (curconf+16) +; Amount of moves to perform shuffle +SH_CYCLES equ 400 +; (Amount of tasks)-1 +CONF_COUNT equ 2 + +use32 + + org 0x0 + + db 'MENUET01' + dd 0x01 + dd START + dd I_END + dd 0x2000 ; 8 Kb + dd 0x2000 + dd 0x0 + dd 0x0 + + +START: + mov [cptr],CONF_COUNT ; number of task + mov eax,3 + mcall + mov cl,16 + ror eax,cl + mov [generator],eax ; random generator from Tetris + init: + mov ecx,17 + movzx eax,[cptr] + inc eax + cmp eax,CONF_COUNT + jna init_ok + xor eax,eax ; cycling 0..CONF_COUNT + init_ok: + mov [cptr],al + mov esi,eax + shl esi,4 + add esi,conf + add esi,eax + add al,0x31 + mov [txtTitle+17],al ;task number to program title + mov [task],esi + mov edi,curconf + rep movsb ; initial configuration + + mov [sts],4 + jmp red +SHUF: + call shuffle ; immediate shuffle +red: ; window redraw + + call draw_window + +still: ; MAIN PROGRAM CYCLE + + mov eax,10 ; wait for event + mcall + + cmp eax,1 ; redraw? - + je red ; goto red + cmp eax,2 ; key pressed? - + je key ; goto key + cmp eax,3 ; button pressed? - + je button ; goto button + + jmp still ; no more events to process + + key: ; Key pressed + mov eax,2 + mcall + shr eax,8 + cmp eax,32 ; = Shuffle + je SHUF + cmp eax,13 ; = Choose task + je init + cmp eax,176 + jl still + sub eax,176 + cmp eax,3 + ja still + movzx eax,byte [eax+correct] ; 'delta' value from correct[] + jmp m_check + + button: ; Button pressed + mov eax,17 + mcall + shr eax,8 + sub eax,2 + + cmp eax,-1 ; id == 1 (closeme)? + jne noclose + mcall + + noclose: + jl SHUF ; Shuffle (id=0) pressed + cmp eax,18 + je init ; Conf button pressed + sub al,byte [null] + mov edi,correct + mov ecx,4 + repne scasb ; checking for valid move-part 1 + jne fail + m_check: + cmp byte[sts],4 ; puzzle completed, blocking buttons + ja still + call move_check ; checking for valid move-part 2 + jnc fail + inc [move_count] + call draw_moves +fail: + jmp still ; 頥 + +; ******************************* +; ******* WINDOW DRAWING ******* +; ******************************* + +draw_window: + + mcall 12, 1 ; begin draw + mcall 0, XXwindow, YYwindow, BgdColor,, txtTitle ; CREATING WINDOW + + + mov eax,8 ; SHUFFLE BUTTON + mov ebx,XXSh + mov ecx,YYSh + xor edx,edx + mov esi,BtnColor + mcall + + mov ebx,XXCnf ; CONF BUTTON + mov ecx,YYCnf + mov edx,20 + ;mov esi,BtnColor + mcall + + mov ebx, XYShText ; SHUFFLE TEXT + mov ecx, StatusColor + mov edx,txtSh + mov esi,lenSh-txtSh + mov eax,4 + mcall + + mov ebx, XYCnfText ; CONF TEXT + mov edx,lenVictory-1 + mov esi,1 + mcall + + mov ecx, 16 ; FIELD BUTTONS + dbut: + call draw_button + loop dbut + + call draw_moves + + mcall 12, 2 ; end of drawing + ret + + +; ********************************************* +; ******* DRAWING A FIELD BUTTON ************** +; ********************************************* +; ECX - button number + +draw_button: + pusha + dec ecx + ; calculating button dimensions + mov edi, ecx + lea edx,[ecx+2] + mov ebx,ecx + and ebx,11b + shr ecx,2 + + imul ebx,BtnSize+3 + add ebx,BtnLeft + shl ebx,16 + add ebx,BtnSize + + imul ecx,BtnSize+3 + add ecx,BtnTop + shl ecx,16 + add ecx,BtnSize + movzx eax,byte [null] + cmp eax,edi + jne no_hole + + pusha + inc ebx + inc ecx + mov edx,BgdColor + mov eax,13 ; clearing - 'hole' + mcall + popa + + or edx,0x80000000 ; and removing button under it +no_hole: + mov al,byte[edi+curconf] + mov esi,[task] + cmp al,byte[edi+esi] + je highlight + mov esi,BtnColor + jmp s_rbutton +highlight: + mov esi,BtnColor2 +s_rbutton: + mov eax,8 ; set/remove button + mcall + movzx eax,byte [null] + cmp eax,edi + je no_text ; no digits - that's hole + mov edx,ebx + shr ecx,16 + mov dx,cx + add edx,NumShift + mov ebx,0x20000 + movzx ecx,byte [edi+curconf] + cmp ecx,9 + ja two_num + add edx,NumShift2 ; shift to center digits + sub ebx,0x10000 +two_num: + mov esi,NumColor + mov eax,47 + mcall +no_text: + popa + ret + + +; ********************************************* +; ******* DRAWING STATUS LINE ***************** +; ********************************************* + +draw_moves: + mov eax, 13 ; clear area + mov ebx, XXbar + mov ecx, YYbar + mov edx, BgdColor + mcall + + mov eax, 4 + mov ebx, XYstatus + mov ecx, StatusColor + cmp ax, [sts] + jl report_victory + jne report_moves + mov edx,txtCnf ; prompt to choose configuration + mov esi,lenCnf-txtCnf + jmp e_dm + report_moves: + mov edx,txtMoves ; how many moves done + mov esi,lenMoves-txtMoves + mov eax,4 + mcall + mov esi,ecx + mov edx,ebx + add edx, 40 shl 16 + mov ebx,0x030000 + movzx ecx, byte[move_count] + mov eax,47 + jmp e_dm + report_victory: ; puzzle completed + mov ecx,StatusColor2 + mov edx,txtVictory + mov esi,lenVictory-txtVictory + e_dm: + mcall + ret + + +; ********************************************* +; ********* SHUFFLE *************************** +; ********************************************* + +shuffle: + xor eax,eax + mov [sts],ax + mov [move_count],ax ; reset moves to 0 + mov [sh_off],al + mov eax, [generator] + + mov ecx,SH_CYCLES + sh_cycle: + sub eax,0x43ab45b5 ; next random number + ror eax,1 + xor eax,0x32c4324f + ror eax,1 + mov [generator],eax + + push eax + and eax,11b ; direction 0..3 + movzx eax,byte [eax+correct] + call move_check + pop eax + jnc sh_cycle ; if fails then retry + loop sh_cycle + inc byte[sh_off] ; shuffling complete + ret + + +; ********************************************* +; ********* MOVE VALIDITY CHECK *************** +; ********************************************* +; AL - 'DELTA' DIRECTION + +move_check: + pusha + mov ah,byte [null] + mov bx,ax + cmp bh,3 + ja no_top + cmp al,-4 ; top of field + je no_move +no_top: + cmp bh,12 + jb no_bottom + cmp al,4 ; bottom of field + je no_move +no_bottom: + and bh,11b + cmp bh,0 + jnz no_left + cmp al,-1 ; left of field + je no_move +no_left: + cmp bh,11b + jnz ok + cmp al,1 ; right of field + je no_move +ok: + mov bx,ax + add bh,bl ; bh-new hole + mov byte [null],bh + movzx ecx,ah + mov al,byte[ecx+curconf] + movzx edx,bh + mov bl,byte[edx+curconf] ; swapping button & hole + mov byte[ecx+curconf],bl + mov byte[edx+curconf],al + + cmp byte[sh_off],0 ; if shuffle in progress, + jz no_win ; then no redraw + + ; drawing button & hole + inc ecx + call draw_button + movzx ecx,bh + inc ecx + call draw_button + ; testing if task completed + mov esi,[task] + mov edi,curconf + mov ecx,16 + repe cmpsb + cmp ecx,0 + jne no_win + mov word[sts],6 ; puzzle done. Victory! +no_win: + popa + stc + ret +no_move: + popa + clc + ret +; this is deprecated debug routine +;ud: +; ud2 + +; These are data used by program + +correct db 1,-4,4,-1 + +conf db 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,15 + db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0 + db 1,2,3,4,12,13,14,5,11,0,15,6,10,9,8,7,9 + +txtMoves: +if lang eq ru_RU + db ':' +else if lang eq it_IT + db 'Movimenti:' +else if lang eq de_DE + db 'Bewegungen:' +else ; Default to en_US + db 'Moves:' +end if +lenMoves: + +txtSh: +if lang eq ru_RU + db 'ᮢ' +else if lang eq it_IT + db 'Mischia' +else if lang eq de_DE + db 'Mischen' +else ; Default to en_US + db 'Shuffle' +end if +lenSh: + +txtCnf: +if lang eq ru_RU + db '롥 ->' +else if lang eq it_IT + db 'Seleziona un compito, poi premi->' +else if lang eq de_DE + db 'Waehle eine Aufgabe, dann clicke au->' +else ; Default to en_US + db 'Select task, then press ->' +end if +lenCnf: + +txtTitle: ; ப +if lang eq ru_RU + db ' 15 - X', 0 +else if lang eq it_IT + db 'Gioco del quindici - partita X', 0 +else if lang eq de_DE + db '15-Puzzle - Spiel X', 0 +else ; Default to en_US + db 'Game 15 - puzzle X', 0 +end if + +txtVictory: +if lang eq ru_RU + db ' 訫 ! ->' +else if lang eq it_IT + db 'Gioco completato! Premi ->' +else if lang eq de_DE + db 'Spiel beendet! Druecken sie auf ->' +else ; Default to en_US + db 'Puzzle completed! Press->' +end if +lenVictory: + +arrow equ lenVictory-2 + +I_END: ; ணࠬ +;null db ? +move_count dw ? +cptr db ? +sts dw ? +sh_off db ? +task dd ? +generator dd ? +curconf: diff --git a/programs/games/Dungeons/data.inc b/programs/games/Dungeons/data.inc index 687daa997b..6745d93b93 100644 --- a/programs/games/Dungeons/data.inc +++ b/programs/games/Dungeons/data.inc @@ -1,93 +1,97 @@ -include 'lang.inc' - -struc langstr [lng, data] -{ - if lang eq lng - sz ., data - end if -} - -struc langstr0 [lng, data] -{ - if lang eq lng - sz0 ., data - end if -} - -include 'AKODE/data.inc' -include 'Resources/Textures/textures.inc' -include 'Resources/Levels/levels.inc' - -FULLSCREEN = 0 -FSAA = 0 -DISABLE_SHADING = 0 - -MOVEMENT_SPEED = BLOCK_BASE_SIZE + BLOCK_BASE_SIZE / 4 - -FIELD_OF_VIEW = 60 -BLOCK_BASE_SIZE = 512 -BLOCK_HEIGHT = 512 - -INVENTORY_SIZE = 10 - -HUD_PANEL_HEIGHT = 120 - -INVENTORY_X = 570 -INVENTORY_Y = 15 -INVENTORY_PADDING_X = 10 -INVENTORY_PADDING_Y = 10 -OBJECT_IMAGE_WIDTH = 40 -OBJECT_IMAGE_HEIGHT = 40 - -GAME_MESSAGE_X = 150 + 15 -GAME_MESSAGE_Y = 15 + 15 -GAME_MESSAGE_COLOR = 0E4E2ADh - -if FULLSCREEN - ;MAIN_WINDOW_X = 0 - ;MAIN_WINDOW_Y = 0 - ;MAIN_WINDOW_WIDTH = 0FFFFh - ;MAIN_WINDOW_HEIGHT = 0FFFFh - MAIN_WINDOW_STYLE = (01000001b) shl 24 - MAIN_WINDOW_STYLE2 = 1 shl 24 -else - MAIN_WINDOW_X = 20 - MAIN_WINDOW_Y = 20 - MAIN_WINDOW_WIDTH = 960 ; client area width - MAIN_WINDOW_HEIGHT = 712 ; client area height - MAIN_WINDOW_STYLE = (01110100b) shl 24 - MAIN_WINDOW_STYLE2 = 0 -end if - -MAIN_EVENT_MASK = EVM_REDRAW or EVM_KEY or EVM_BUTTON or EVM_MOUSE or EVM_MOUSE_FILTER - -MAIN_WINDOW_TITLE langstr0 \ - en_US, 'Dungeons of Augastes 0.1', \ - ru_RU, ' 㣠 0.1' - -LevelLoadingImageFile db 'Resources/Textures/HUD/LevelLoading.png', 0 -HudPanelImageFile db 'Resources/Textures/HUD/Panel.png', 0 -DeathImageFile db 'Resources/Textures/HUD/Death.png', 0 -EndImageFile db 'Resources/Textures/HUD/End.png', 0 - -align 4 -LevelLoadingImagePtr dd 0 -HudPanelImagePtr dd 0 -DeathImagePtr dd 0 -EndImagePtr dd 0 - -ImageBufferPtr dd 0 - -HudPanelNeedsRedraw dd 0 - -GameMessage dd 0 -GameStatus dd 0 - -GAME_STATUS.LEVEL_LOAD_FAILED = 1 -GAME_STATUS.DEAD = 2 -GAME_STATUS.END = 3 - -ACTION.DO_SOMETHING = AKODE_ACTION.CUSTOM + 1 -ACTION.LOOK_AROUND = AKODE_ACTION.CUSTOM + 2 -ACTION.USE_OBJECT = AKODE_ACTION.CUSTOM + 3 -ACTION.LOOK_AT_OBJECT = AKODE_ACTION.CUSTOM + 4 +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. + +; FIXME: +; This translation mechanism should fallback to en_US if the language +; is unlisted (e.g. es_ES). Either fix the macros or use a different method. +; The problem doesn't manifest, as we only bundle Dungeons in the RU distro. +struc langstr [lng, data] +{ + if lang eq lng + sz ., data + end if +} + +struc langstr0 [lng, data] +{ + if lang eq lng + sz0 ., data + end if +} + +include 'AKODE/data.inc' +include 'Resources/Textures/textures.inc' +include 'Resources/Levels/levels.inc' + +FULLSCREEN = 0 +FSAA = 0 +DISABLE_SHADING = 0 + +MOVEMENT_SPEED = BLOCK_BASE_SIZE + BLOCK_BASE_SIZE / 4 + +FIELD_OF_VIEW = 60 +BLOCK_BASE_SIZE = 512 +BLOCK_HEIGHT = 512 + +INVENTORY_SIZE = 10 + +HUD_PANEL_HEIGHT = 120 + +INVENTORY_X = 570 +INVENTORY_Y = 15 +INVENTORY_PADDING_X = 10 +INVENTORY_PADDING_Y = 10 +OBJECT_IMAGE_WIDTH = 40 +OBJECT_IMAGE_HEIGHT = 40 + +GAME_MESSAGE_X = 150 + 15 +GAME_MESSAGE_Y = 15 + 15 +GAME_MESSAGE_COLOR = 0E4E2ADh + +if FULLSCREEN + ;MAIN_WINDOW_X = 0 + ;MAIN_WINDOW_Y = 0 + ;MAIN_WINDOW_WIDTH = 0FFFFh + ;MAIN_WINDOW_HEIGHT = 0FFFFh + MAIN_WINDOW_STYLE = (01000001b) shl 24 + MAIN_WINDOW_STYLE2 = 1 shl 24 +else + MAIN_WINDOW_X = 20 + MAIN_WINDOW_Y = 20 + MAIN_WINDOW_WIDTH = 960 ; client area width + MAIN_WINDOW_HEIGHT = 712 ; client area height + MAIN_WINDOW_STYLE = (01110100b) shl 24 + MAIN_WINDOW_STYLE2 = 0 +end if + +MAIN_EVENT_MASK = EVM_REDRAW or EVM_KEY or EVM_BUTTON or EVM_MOUSE or EVM_MOUSE_FILTER + +MAIN_WINDOW_TITLE langstr0 \ + en_US, 'Dungeons of Augastes 0.1', \ + ru_RU, ' 㣠 0.1' + +LevelLoadingImageFile db 'Resources/Textures/HUD/LevelLoading.png', 0 +HudPanelImageFile db 'Resources/Textures/HUD/Panel.png', 0 +DeathImageFile db 'Resources/Textures/HUD/Death.png', 0 +EndImageFile db 'Resources/Textures/HUD/End.png', 0 + +align 4 +LevelLoadingImagePtr dd 0 +HudPanelImagePtr dd 0 +DeathImagePtr dd 0 +EndImagePtr dd 0 + +ImageBufferPtr dd 0 + +HudPanelNeedsRedraw dd 0 + +GameMessage dd 0 +GameStatus dd 0 + +GAME_STATUS.LEVEL_LOAD_FAILED = 1 +GAME_STATUS.DEAD = 2 +GAME_STATUS.END = 3 + +ACTION.DO_SOMETHING = AKODE_ACTION.CUSTOM + 1 +ACTION.LOOK_AROUND = AKODE_ACTION.CUSTOM + 2 +ACTION.USE_OBJECT = AKODE_ACTION.CUSTOM + 3 +ACTION.LOOK_AT_OBJECT = AKODE_ACTION.CUSTOM + 4 diff --git a/programs/games/arcanii/trunk/arcanii.asm b/programs/games/arcanii/trunk/arcanii.asm index f142b2d030..8fb22c59fe 100644 --- a/programs/games/arcanii/trunk/arcanii.asm +++ b/programs/games/arcanii/trunk/arcanii.asm @@ -4,7 +4,7 @@ ; contact: 4nic8@casiocalc.org ;---------------------------------------- -include 'lang.inc' +include 'lang.inc' ; Language support for locales: it_IT, en_US. include '../../../macros.inc' include 'ascl.inc' include 'ascgl.inc' @@ -142,7 +142,7 @@ still: ; ********************************************* show_screen: ; flips the virtual screen to the window - push_abc + push_abc mcall 7, screen, , 0 pop_abc ret @@ -389,7 +389,7 @@ grad_fill_screen: ; eax - screen color ( 0x00RRGGBB ), ebx - mack .no_ch: pop ecx loop .lab1 - + pop_abc ret @@ -409,7 +409,7 @@ intro: ; INTRO ; jne @f ret @@: - + mcall 4,<115,150>,0x82050505,VERSION mcall ,<125,180>,0x80050505,AUTHOR mcall ,<90,210>,0x81EE0800,PRESS_SPACE @@ -468,13 +468,13 @@ fast_gfx: mov ebx,0xFFFF .g_ok: call grad_fill_screen - + ;black_bg ;mov eax,0 ;mov ebx,0 ;call fill_screen - + mov eax,37 ; get mouse position mov ebx,1 mcall @@ -805,7 +805,7 @@ draw_window: mcall 48,4 lea ecx, [100*65536+Y_SIZE+4+eax]; [y start] *65536 + [y size] + [skin_height] mcall 0,<100,X_SIZE+9>,,0x74ffffff,,0 - + mov eax, [lives] add eax, '0' mov esi, HEADER @@ -836,7 +836,7 @@ if lang eq it_IT THANKS_FOR_PLAYING db 'Grazie per aver giocato', 0 PRESS_SPACE db 'Premi spazio per iniziare',0 LEVEL db 'LIVELLO',0 -else +else ; Default to en_US THANKS_FOR_PLAYING db 'Thanks for playing', 0 PRESS_SPACE db 'press SPACE to start',0 LEVEL db 'LEVEL',0 diff --git a/programs/games/arcanoid/trunk/arcanoid.asm b/programs/games/arcanoid/trunk/arcanoid.asm index 7339c626b9..784d7e4ccf 100644 --- a/programs/games/arcanoid/trunk/arcanoid.asm +++ b/programs/games/arcanoid/trunk/arcanoid.asm @@ -19,7 +19,7 @@ ;****************************************************************************** -include 'lang.inc' +include 'lang.inc' ; Language support for locales: it_IT, en_US. include '..\..\..\macros.inc' include 'ascl.inc' include 'ascgl.inc' @@ -285,7 +285,7 @@ end_col: cmp [delay_cnt],0 jne no_delay mov [delay_cnt],1 - delay 1 ;don't generate delay for fast speed programm + delay 1 ; don't generate delay for fast speed program no_delay: dec [delay_cnt] @@ -297,9 +297,9 @@ win_test: mov [againbut],1 call draw_window ; label 160,200,'You Win!',cl_Green+font_Big -; label 130,220,'Youre Score:',cl_Green+font_Big +; label 130,220,'Your Score:',cl_Green+font_Big ; outcount dword [scorea],230,220,cl_Green,5*65536 -; label 130,234,'Youre Lives:',cl_Green+font_Big +; label 130,234,'Your Lives:',cl_Green+font_Big ; outcount dword [scoreb],230,234,cl_Green,5*65536 ; delay 600 ;wait 2sec ; close ;exit from program @@ -310,7 +310,7 @@ lose_test: jne stl2 ; call draw_window ; label 160,200,'You Lose!',cl_Red+font_Big -; label 130,220,'Youre Score:',cl_Red+font_Big +; label 130,220,'Your Score:',cl_Red+font_Big ; outcount dword [scorea],230,220,cl_Red,5*65536 ; delay 300 ;wait 2sec ; close ;exit from program @@ -420,7 +420,7 @@ draw_window: window 0,0,400+8,480+24,window_Skinned if lang eq it_IT label 12,8,'ARCANOID: Usa le freccie Vite Punti',cl_White+font_Big - else + else ; Default to en_US label 12,8,'ARCANOID: USE ARROW KEYS LIVES SCORE',cl_White+font_Big end if @@ -433,9 +433,9 @@ draw_window: if lang eq it_IT label 160,200,'Hai perso!',cl_Red+font_Big label 130,220,'Punteggio:',cl_Red+font_Big - else + else ; Default to en_US label 160,200,'You Lose!',cl_Red+font_Big - label 130,220,'Youre Score:',cl_Red+font_Big + label 130,220,'Your Score:',cl_Red+font_Big end if outcount dword [scorea],230,220,cl_Red,5*65536 mov ebx,150*65536+80 @@ -449,7 +449,7 @@ draw_window: mcall if lang eq it_IT label 152,244,'Rigioca',cl_Red+font_Big - else + else ; Default to en_US label 152,244,'Play again?',cl_Red+font_Big end if jmp elev @@ -457,9 +457,9 @@ nlev: if lang eq it_IT label 160,200,'Hai vinto!',cl_Green+font_Big label 130,220,'Punteggio:',cl_Green+font_Big - else + else ; Default to en_US label 160,200,'You Win!',cl_Green+font_Big - label 130,220,'Youre Score:',cl_Green+font_Big + label 130,220,'Your Score:',cl_Green+font_Big end if outcount dword [scorea],230,220,cl_Green,5*65536 mov ebx,150*65536+120 ;mov ebx,150*65536+80 @@ -473,13 +473,13 @@ nlev: mcall if lang eq it_IT label 152,244,'Prossimo Livello',cl_Red+font_Big - else + else ; Default to en_US label 152,244,'Next level?',cl_Red+font_Big end if elev: if lang eq it_IT label 178,264,'Esci',cl_Red+font_Big - else + else ; Default to en_US label 178,264,'Exit?',cl_Red+font_Big end if diff --git a/programs/games/bomber/bomber.asm b/programs/games/bomber/bomber.asm index c205cd424e..324d52fb2b 100644 --- a/programs/games/bomber/bomber.asm +++ b/programs/games/bomber/bomber.asm @@ -1,2369 +1,2369 @@ -; - -SK_SPACE equ 0x39 -SK_CTRL equ 0x1D -SK_UP equ 0x48 -SK_DOWN equ 0x50 -SK_LEFT equ 0x4B -SK_RIGHT equ 0x4D -SK_ESC equ 0x01 - - -INIT_PLANE_X equ 20 -INIT_PLANE_Y equ 20 -BACK_COLOR equ 0x9bcdfa -GROUND_COLOR equ 0x808080 -BANG_COLOR equ 0xB0140E -ANIM_PLANE_BMP_PIXELS_COUNT equ 22*32*32 -WINDOW_WIDTH equ 800 -WINDOW_HEIGHT equ 600 -GROUNG_HEIGHT equ 100 -CITY_OFFSET equ (WINDOW_WIDTH-32*20)/2 -MAX_BOMBS equ 8 -GRAVY_ACCEL equ 1 -BOMB_DELAY equ 12 -MAX_LEVEL equ 5 -ACKACK_BULLET_SPEED equ 17 -BULLET_SIZE equ 7 -MAX_SOUNDS equ 8 - -VOLUME_BOMBFLY equ 16 -VOLUME_BOMBBANG equ 28 -VOLUME_ACKACK equ 24 -VOLUME_PLANE equ 48 -VOLUME_ARW equ 16 - - -use32 ; , 32 - org 0x0 ; , 0x0 - db 'MENUET01' ; (8 ) - dd 0x1 ; - dd start ; , - ; - dd i_end ; - dd i_end ; , 0100 - dd i_end ; , . , - dd 0x0, _s_current_dir ; . - ; , - ; - - ; , , - ; -; - -;----------------- include ------------------------------------- -include 'lang.inc' -include 'ssmix.inc' - -;--------------------------------------------------------------------------- -;----------------------------- -------------------------------- -;--------------------------------------------------------------------------- - -align 4 -start: ; - - ; : - - mov eax, 66 - mov ebx, 1 - mov ecx, 1 - int 0x40 - - ; - mov eax, 68 - mov ebx, 11 - int 0x40 - cmp eax, 1000000 ; ~1000 ( ) - ja heap_ok - mov eax, -1 - int 0x40 ; - heap_ok: - - mov eax, bmp_plane - mov ebx, 736*32*3 - call convert_bmp_backcolor - mov eax, bmp_bomb - mov ebx, 96*16*3 - call convert_bmp_backcolor - mov eax, bmp_tile - mov ebx, 20*20*3 - call convert_bmp_backcolor - mov eax, bmp_ackack - mov ebx, 40*20*3 - call convert_bmp_backcolor - - call read_sounds_file - call ssmix_init - - mov [_game_state], 0 - -redraw_window: - call draw_window - cmp [_game_state], 0 - jne still_no_intro - call draw_intro - still_no_intro: - -still: - ; - mov eax,11 - int 0x40 - cmp eax,1 - je redraw_window - cmp eax,2 - je key - cmp eax,3 - je close_button - - ; - mov eax,5 - mov ebx,1 - int 0x40 - - mov eax, 26 - mov ebx, 9 - int 0x40 - mov ebx, eax - sub eax, [_last_value_timecount] - cmp eax, [_delay] - jbe still - mov [_last_value_timecount], ebx - - call timer_x2 - call timer_x4 - - ; - cmp [_game_state], 1 - jne still_no_game - ; - mov eax, [_plane_health] - cmp eax, 0 - jle still_no_plane - call flight_control_plane - call plane_interaction - call draw_plane - still_no_plane: - call draw_plane_health - call bomb_proc - call bang_proc - call ground_draw - call city_draw - call ackack_draw - call ackack_bullet_proc - ; - call game_over_timer - still_no_game: - - jmp still - - -key: ; - mov eax,2 - int 0x40 - - push eax - key_SPACE: - cmp ah, SK_SPACE - jne key_SPACE_end - cmp [_game_state], 1 - je key_SPACE_do_a_barrel_roll - key_SPACE_start_game: ; - mov [_game_state], 1 - call init_game_state - jmp key_SPACE_end - key_SPACE_do_a_barrel_roll: ; - mov eax, [_plane_state] - cmp eax, 0 - je key_SPACE_do_a_barrel_roll_r - cmp eax, 1 - je key_SPACE_do_a_barrel_roll_l - jmp key_SPACE_end - key_SPACE_do_a_barrel_roll_r: - mov eax,[_X_plane] - cmp eax, WINDOW_WIDTH-130-32 - jg key_SPACE_end - mov [_plane_state], 4 - mov [_plane_state_step], 0 - jmp key_SPACE_end - key_SPACE_do_a_barrel_roll_l: - mov eax,[_X_plane] - cmp eax, 130 - jl key_SPACE_end - mov [_plane_state], 5 - mov [_plane_state_step], 0 - key_SPACE_end: - pop eax - - key_CTRL: - cmp ah, SK_CTRL - jne key_CTRL_end - call bomb_drop - key_CTRL_end: - - key_UP: - cmp ah, SK_UP - jne key_UP_end - cmp [_game_state], 0 - jne key_UP_end - mov ebx, [_level_num] - inc ebx - mov [_level_num], ebx - cmp ebx, MAX_LEVEL - jbe key_UP_no_max - mov [_level_num], MAX_LEVEL - key_UP_no_max: - call draw_level_num - key_UP_end: - - key_DOWN: - cmp ah, SK_DOWN - jne key_DOWN_end - cmp [_game_state], 0 - jne key_DOWN_end - mov ebx, [_level_num] - dec ebx - mov [_level_num], ebx - cmp ebx, 1 - jae key_DOWN_no_min - mov [_level_num], 1 - key_DOWN_no_min: - call draw_level_num - key_DOWN_end: - - - key_LEFT: - cmp ah, SK_LEFT - jne key_LEFT_end - cmp [_game_state], 0 - jne key_LEFT_end - mov ebx, [_set_volume] - dec ebx - cmp ebx, 0 - jge @f - mov ebx, 0 - @@: - mov [_set_volume], ebx - shl ebx, 4 - stdcall ssmix_setvolume, ebx, ebx - call draw_volume_num - key_LEFT_end: - - - key_RIGHT: - cmp ah, SK_RIGHT - jne key_RIGHT_end - cmp [_game_state], 0 - jne key_RIGHT_end - mov ebx, [_set_volume] - inc ebx - cmp ebx, 8 - jle @f - mov ebx, 8 - @@: - mov [_set_volume], ebx - shl ebx, 4 - stdcall ssmix_setvolume, ebx, ebx - call draw_volume_num - key_RIGHT_end: - - - key_ESC: - cmp ah, SK_ESC - jne key_ESC_end - jmp close_button - key_ESC_end: - - jmp still - - - - -close_button: ; - - call ssmix_release - call sounds_free_memory - ; - mov eax, -1 - int 0x40 - - -;--------------------------------------------------------------------------- -;----------------------------- --------------------------------- -;--------------------------------------------------------------------------- - - -convert_bmp_backcolor: ; eax - , ebx - - - push ecx - cbb_loop: - cmp ebx, 0 - jle cbb_loop_end - mov ecx, [eax] - and ecx, 0x00FFFFFF - cmp ecx, 0x00FFFFFF - jne @f - mov ecx, BACK_COLOR - mov [eax], cl - shr ecx, 8 - mov [eax+1], cl - shr ecx, 8 - mov [eax+2], cl - @@: - add eax, 3 - sub ebx, 3 - jmp cbb_loop - cbb_loop_end: - pop ecx - - ret - -; -read_sounds_file: - - mov edi, _s_current_dir - mov al, 0 - mov ecx, 4096 - repne scasb - mov dword[edi-1], 'data' - mov dword[edi+3], '.bin' - mov [_flag_bomberdatabin_ok], 1 - ; - mov [_fi_func], 0 - mov [_fi_pos], 8 - mov [_fi_size], 4 - mov [_fi_pbuff], _count_sounds - mov [_fi_pfilename], _s_current_dir - mov eax, 70 - mov ebx, file_info - int 0x40 - cmp ebx, -1 - jne @f - mov [_flag_bomberdatabin_ok], 0 - jmp .end - @@: - ; , () - mov ecx, [_count_sounds] - shl ecx, 3 - mov [_fi_func], 0 - mov [_fi_pos], 12 - mov [_fi_size], ecx - mov [_fi_pbuff], _array_sounds - mov [_fi_pfilename], _s_current_dir - mov eax, 70 - mov ebx, file_info - int 0x40 - ; - mov ecx, [_count_sounds] - mov esi, _array_sounds - .loop: - push ecx - ; - mov [_fi_func], 0 - mov eax, [esi] - mov [_fi_pos], eax - mov eax, [esi+4] - mov [_fi_size], eax - ; , , - mov ecx, [esi+4] - mov eax, 68 - mov ebx, 12 - int 0x40 - mov [esi], eax - mov ecx, [esi+4] - add ecx, eax - mov [esi+4], ecx - ; - mov [_fi_pbuff], eax - mov [_fi_pfilename], _s_current_dir - mov eax, 70 - mov ebx, file_info - int 0x40 - pop ecx - add esi, 8 - dec ecx - jnz .loop - .end: - - ret - - -sounds_free_memory: - - mov ecx, [_count_sounds] - mov esi, _array_sounds - .loop: - push ecx - ; , , - mov eax, 68 - mov ebx, 13 - mov ecx, [esi] - int 0x40 - pop ecx - add esi, 8 - dec ecx - jnz .loop - - - ret - - -init_game_state: ; - mov [_game_over_time], 0 - mov [_X_plane], INIT_PLANE_X - mov [_Y_plane], INIT_PLANE_Y - mov [_VX_plane], 4 - mov [_plane_state], 0 - mov [_anim_pos_plane], 0 - mov [_plane_health], 100 - mov [_timer_x2], 0 - mov [_timer_x4], 0 - mov [_bomb_count], 0 - mov [_bomb_delay_time], 0 - mov [_addit_VY_plane], 0 - mov [_flag_air_raid_warning], 0 - - call load_level - - ; - mov ebx, _bang_array - xor ecx, ecx - igs_bang_array_loop: - cmp ecx, MAX_BOMBS - jae igs_bang_array_loop_end - mov eax, -1 - mov [ebx], eax - add ebx, 8 - inc ecx - jmp igs_bang_array_loop - igs_bang_array_loop_end: - ; - mov ebx, _ackack_bullet - xor ecx, ecx - igs_bullet_array_loop: - cmp ecx, 32 - jae igs_bullet_array_loop_end - mov eax, 0 - mov [ebx], eax - add ebx, 4 - inc ecx - jmp igs_bullet_array_loop - igs_bullet_array_loop_end: - - ; - call draw_window - - ; - cmp [_flag_bomberdatabin_ok], 1 - jne @f - stdcall ssmix_playtrack, [_array_sounds+8*((( 4 ))-1)], [_array_sounds+8*((( 4 ))-1)+4], VOLUME_PLANE, VOLUME_PLANE, SSMIX_CHANMODE_REPEAT - @@: - mov [_channel_sound_plane], eax - - mov [_channel_sound_arw], -1 - - ret - - - -game_over: - - mov [_game_over_time], 30 ; game over - ; GAME OVER - mov eax,4 - mov ebx,(WINDOW_WIDTH/2 - 50)*65536 + 30 - mov ecx,0x80000000 - mov edx,_text_game_over - int 0x40 - - cmp [_flag_bomberdatabin_ok], 1 - jne @f - stdcall ssmix_stoptrack, [_channel_sound_plane] - @@: - - ret - - -game_over_timer: ; , - - mov ebx, [_game_over_time] - cmp ebx, 0 - je got_end - dec ebx - mov [_game_over_time], ebx - cmp ebx, 0 - jg got_end - mov [_game_state], 0 - cmp [_flag_bomberdatabin_ok], 1 - jne @f - call ssmix_stopalltracks - @@: - call draw_window - call draw_intro - got_end: - - ret - - -next_level: ; - - push eax - mov [_game_over_time], 1 ; - mov eax, [_level_num] ; - inc eax - cmp eax, MAX_LEVEL - jbe next_level_no_overmax - mov eax, MAX_LEVEL - next_level_no_overmax: - mov [_level_num], eax - pop eax - - ret - - - -check_level_complete: ; - - push eax - push ebx - push ecx - push edx - - mov edx, 0 ; : 0 - , 1 - - mov ebx, _city - xor ecx, ecx - clc_loop: - cmp ecx, 32 - jae clc_loop_end - xor eax, eax - mov ax, [ebx] - cmp eax, 0 - je clc_no_buildings - mov edx, 1 - jmp clc_loop_end - clc_no_buildings: - add ebx, 2 - inc ecx - jmp clc_loop - clc_loop_end : - cmp edx, 0 - jne clc_end - ; - - ; LEVEL COMPLETE - mov eax,4 - mov ebx,(WINDOW_WIDTH/2 - 70)*65536 + 30 - mov ecx,0x80000000 - mov edx,_text_level_complete - int 0x40 - ; - mov [_addit_VY_plane], 3 ; - ; - call air_raid_warning_off - clc_end: - - pop edx - pop ecx - pop ebx - pop eax - - ret - - -draw_plane_health: - - mov ebx, 5*0x00010000 + 100 - mov ecx, 5*0x00010000 + 10 - mov edx, 0x00000000 - mov eax, 13 - int 0x40 - - mov ebx, [_plane_health] - add ebx, 5*0x00010000 - mov edx, 0x00008000 - int 0x40 - - ret - - -air_raid_warning_on: - push eax - cmp [_flag_air_raid_warning], 1 - je .end - mov [_flag_air_raid_warning], 1 - cmp [_flag_bomberdatabin_ok], 1 - jne @f - stdcall ssmix_playtrack, [_array_sounds+8*((( 5 ))-1)], [_array_sounds+8*((( 5 ))-1)+4], VOLUME_ARW, VOLUME_ARW, SSMIX_CHANMODE_REPEAT - @@: - mov [_channel_sound_arw], eax - .end: - pop eax - ret - - -air_raid_warning_off: - cmp [_flag_air_raid_warning], 0 - je .end - mov [_flag_air_raid_warning], 0 - cmp [_flag_bomberdatabin_ok], 1 - jne .end - stdcall ssmix_stoptrack, [_channel_sound_arw] - .end: - ret - - -;======================================= ====================================== - - -flight_control_plane: ; - - mov eax,[_X_plane] - add eax, [_VX_plane] - mov [_X_plane], eax - - cmp eax, WINDOW_WIDTH-60-32 - jl fcp_set_utunr_rl - mov ebx, [_plane_state] - cmp ebx, 0 - jne fcp_set_utunr_rl - mov [_plane_state],2 - mov [_plane_state_step], 0 - fcp_set_utunr_rl: - - cmp eax, 60 - jg fcp_set_utunr_lr - mov ebx, [_plane_state] - cmp ebx, 1 - jne fcp_set_utunr_lr - mov [_plane_state],3 - mov [_plane_state_step], 0 - fcp_set_utunr_lr: - - ; 2 - mov eax, [_timer_x2] - cmp eax, 0 - jne fcp_timex2_end - - mov eax, [_plane_state] - cmp eax, 2 ; - jne fcp_uturn_rl_end - mov eax, [_plane_state_step] - mov ebx, 4 - sub ebx, eax - mov [_VX_plane], ebx ; - inc eax ; - mov [_plane_state_step], eax - cmp eax, 9 ; , - jne fcp_uturn_rl_end - mov [_plane_state], 1 ; - fcp_uturn_rl_end: - - - mov eax, [_plane_state] - cmp eax, 3 ; - jne fcp_uturn_lr_end - mov eax, [_plane_state_step] - mov ebx, -4 - add ebx, eax - mov [_VX_plane], ebx ; - inc eax ; - mov [_plane_state_step], eax - cmp eax, 9 ; , - jne fcp_uturn_lr_end - mov [_plane_state], 0 ; - fcp_uturn_lr_end: - - mov eax, [_plane_state] - cmp eax, 4 ; - jne fcp_barrel_r_end - mov eax, [_plane_state_step] - inc eax ; - mov [_plane_state_step], eax - cmp eax, 8 ; , - jne fcp_barrel_r_end - mov [_plane_state], 0 ; - fcp_barrel_r_end : - - mov eax, [_plane_state] - cmp eax, 5 ; - jne fcp_barrel_l_end - mov eax, [_plane_state_step] - inc eax ; - mov [_plane_state_step], eax - cmp eax, 8 ; , - jne fcp_barrel_l_end - mov [_plane_state], 1 ; - fcp_barrel_l_end: - - call animation_plane - - fcp_timex2_end: - - ; 4 - mov eax, [_timer_x4] - cmp eax, 0 - jne fcp_timex4_end - - ; - mov eax,[_Y_plane] - add eax, 1 - mov [_Y_plane], eax - - fcp_timex4_end: - - ; - - mov eax,[_Y_plane] - mov ebx,[_addit_VY_plane] - add eax, ebx - mov [_Y_plane], eax - - ; , - mov eax,[_Y_plane] - cmp eax, WINDOW_HEIGHT - GROUNG_HEIGHT - 32 - jl fcp_end_plane_landing - mov [_addit_VY_plane], 0 ; - mov ebx, [_plane_state] - cmp ebx, 6 - je fcp_end_plane_landing - cmp ebx, 0 - jne fcp_horiz_fly - mov [_plane_state], 6 ; - ;jmp fcp_end_plane_landing - fcp_horiz_fly: - mov eax, WINDOW_HEIGHT - GROUNG_HEIGHT - 32 - fcp_end_plane_landing: - cmp eax, WINDOW_HEIGHT - GROUNG_HEIGHT - 32 + 6 - jle fcp_no_plane_underground ; , " " - mov eax, WINDOW_HEIGHT - GROUNG_HEIGHT - 32 + 6 - mov ebx, [_X_plane] - cmp ebx, WINDOW_WIDTH - 60-32 - jl fcp_no_end_level ; , - ; - call next_level ; - fcp_no_end_level: - fcp_no_plane_underground: - mov [_Y_plane], eax - - ret - - - -animation_plane: - - ; - - ; - mov eax, [_plane_state] - cmp eax, 0 - jne ap_state0_end - mov [_anim_pos_plane], 0 - ap_state0_end: - - ; - mov eax, [_plane_state] - cmp eax, 1 - jne ap_state1_end - mov [_anim_pos_plane], 8 - ap_state1_end: - - ; - mov eax, [_plane_state] - cmp eax, 5 - ja ap_state2345_end - cmp eax, 2 - jb ap_state2345_end - sub eax, 2 - mov ebx, eax ; eax 9 - shl eax, 3 - add eax, ebx - add eax, [_plane_state_step] ; - shl eax, 2 ; 4 - add eax, _anim_array_uturn_rl ; - mov ebx, [eax] - mov [_anim_pos_plane], ebx ; - ap_state2345_end: - - ; ( ) - mov eax, [_plane_state] - cmp eax, 6 - jne ap_state6_end - mov [_anim_pos_plane], 22 - ap_state6_end: - - ret - - - -draw_plane: - - ; - mov eax, 13 - mov ebx,[_last_XY_plane] - and ebx, 0xffff0000 - add ebx, 32 - mov ecx,[_last_XY_plane] - shl ecx, 16 - add ecx, 32 - mov edx, BACK_COLOR - int 0x40 - - ; _anim_pos_plane - mov ebx, [_anim_pos_plane] - shl ebx, 10 - mov eax, ebx - add ebx, eax - add ebx, eax - add ebx, bmp_plane - - ; - mov edx,[_X_plane] - shl edx, 16 - add edx,[_Y_plane] - mov [_last_XY_plane], edx - - ; - mov eax,7 - mov ecx,32*65536+32 - int 0x40 - - ret - - -plane_interaction: - - push eax - push ebx - push ecx - push edx - - mov eax, [_X_plane] - mov ebx, [_Y_plane] - add ebx, 16 - mov ecx, [_VX_plane] - cmp ecx, 0 - jl pi_no_positive_vx - add eax, 32 ; - pi_no_positive_vx: - ; eax ebx X,Y - mov edx, eax - sub eax, CITY_OFFSET - ; - cmp eax, 0 - jl pi_out_of_city - cmp eax, 32*20 - jg pi_out_of_city - ; - add eax, 10 ; X 20 - mov ecx, eax - shr eax, 4 - shr ecx, 6 - sub eax, ecx - shr ecx, 2 - add eax, ecx - shr ecx, 2 - sub eax, ecx - dec eax ; eax - mov esi, eax - shl esi, 1 - add esi, _city ; esi - mov eax, edx - ; Y Y - xor ecx, ecx - mov cx, [esi] - mov edx, ecx - shl ecx, 4 - shl edx, 2 - add ecx, edx - mov edx, WINDOW_HEIGHT - GROUNG_HEIGHT - sub edx, ecx ; edx Y - cmp ebx, edx - jl pi_no_crash - ; - mov [_plane_health], 0 - call bang_add ; - call game_over ; - pi_no_crash: - - pi_out_of_city: - - pop edx - pop ecx - pop ebx - pop eax - - ret - - -; ================================== =========================================== - -bomb_drop: ; " ". , . - ; - mov eax, [_plane_health] - cmp eax, 0 - jle bomb_drop_end - ; ( ) - mov eax, [_plane_state] - cmp eax, 3 - ja bomb_drop_end - ; - mov eax, [_bomb_delay_time] - cmp eax, 0 - jne bomb_drop_end - mov [_bomb_delay_time], BOMB_DELAY - ; , - mov eax, [_bomb_count] - cmp eax, MAX_BOMBS-1 - jae bomb_drop_end - inc eax - mov [_bomb_count], eax - dec eax - shl eax, 4 - add eax, _bomb_array ; - - mov ebx, [_X_plane] - mov [eax], ebx ; X - add eax, 4 - mov ebx, [_Y_plane] - add ebx, 30 - mov [eax], ebx ; Y - - add eax, 4 - mov ebx, [_VX_plane] - cmp ebx, 0 - jge bomb_drop_pos_dir_vx - bomb_drop_neg_dir_vx: - neg ebx - shr ebx, 1 - neg ebx - jmp bomb_drop_dir_vx_end - bomb_drop_pos_dir_vx: - shr ebx, 1 - bomb_drop_dir_vx_end: - mov [eax], ebx ; X - - add eax, 4 - mov ebx, 0 - mov [eax], ebx ; Y - - push ecx - mov ecx, [_bomb_count] - dec ecx - call bombfly_sound_start - pop ecx - - bomb_drop_end: - - ret - - -bomb_proc: - ; - mov eax, [_bomb_delay_time] - cmp eax, 0 - je bomb_proc_delay_timer_end - dec eax - mov [_bomb_delay_time], eax - bomb_proc_delay_timer_end: - ; - mov eax, [_bomb_count] - cmp eax, 0 - je bomb_proc_end - xor ecx, ecx - bomb_proc_loop: ; - cmp ecx, [_bomb_count] - jae bomb_proc_end - mov ebx, ecx - shl ebx, 4 - add ebx, _bomb_array ; - - call bomb_hide ; - - ; - - ; VY - - add ebx, 4*3 - mov eax, [_timer_x2] - cmp eax, 0 - jne bomb_proc_gravity_accel_end - mov eax, [ebx] - add eax, GRAVY_ACCEL - mov [ebx], eax - bomb_proc_gravity_accel_end: - ; X - sub ebx, 4*3 - mov eax, [ebx] - add ebx, 4*2 - mov edx, [ebx] - add eax, edx - sub ebx, 4*2 - mov [ebx], eax - push eax - ; Y - add ebx, 4 - mov eax, [ebx] - add ebx, 4*2 - mov edx, [ebx] - add eax, edx - sub ebx, 4*2 - mov [ebx], eax - push eax - - ; - sub ebx, 4 - pop edx ; Y - pop eax ; X - ; , - cmp eax, 10 - jle bomb_proc_delete_bomb - cmp eax, WINDOW_WIDTH - 36 - jge bomb_proc_delete_bomb - ; - push eax - push ebx - mov ebx, edx - call bomb_check_detonation - cmp eax, 1 - pop ebx - pop eax - je bomb_proc_interaction_with_world - cmp edx, WINDOW_HEIGHT - GROUNG_HEIGHT - jae bomb_proc_interaction_with_world - jmp bomb_proc_interaction_end - bomb_proc_interaction_with_world: - push eax - push ebx - mov ebx, edx - call bang_add - call air_raid_warning_on ; - pop ebx - pop eax - bomb_proc_delete_bomb: - call bomb_delete ; - dec ecx ; .. - - mov eax, [_bomb_count] - dec eax - mov [_bomb_count], eax ; - jmp bomb_proc_draw_end ; - bomb_proc_interaction_end: - call bomb_draw - bomb_proc_draw_end: - - inc ecx - jmp bomb_proc_loop - bomb_proc_end: - - ret - - -bomb_delete: ; , - push eax - push ebx - push ecx - push edx - call bombfly_sound_stop - inc ecx - bomb_delete_loop: - cmp ecx, [_bomb_count] - jae bomb_delete_loop_end - mov ebx, ecx - shl ebx, 4 - add ebx, _bomb_array ; - dec ecx - mov edx, ecx - shl edx, 4 - add edx, _bomb_array ; - inc ecx - ; - mov eax, [ebx] - mov [edx], eax - add ebx,4 - add edx,4 - mov eax, [ebx] - mov [edx], eax - add ebx,4 - add edx,4 - mov eax, [ebx] - mov [edx], eax - add ebx,4 - add edx,4 - mov eax, [ebx] - mov [edx], eax - ; - inc ecx - jmp bomb_delete_loop - bomb_delete_loop_end: - pop edx - pop ecx - pop ebx - pop eax - - ret - -bomb_hide: ; , ebx - - - push eax - push ebx - push ecx - push edx - mov eax, 13 - mov edx, ebx - mov ebx, [edx] - shl ebx, 16 - add ebx, 16 - add edx, 4 - mov ecx, [edx] - shl ecx, 16 - add ecx, 16 - mov edx, BACK_COLOR - int 0x40 - pop edx - pop ecx - pop ebx - pop eax - - ret - - -bomb_draw: ; , ebx - - - push eax - push ebx - push ecx - push edx - - ; edx - mov edx, [ebx] - shl edx, 16 - add ebx, 4 - mov eax, [ebx] - add edx, eax - - ; ebx ( ) - add ebx, 4 - mov eax, [ebx] ; eax - - add ebx, 4 - mov ecx, [ebx] ; ecx - - xor ebx, ebx - cmp ecx, 3 - jl bomb_draw_midspeed_end - inc ebx - bomb_draw_midspeed_end: - cmp ecx, 9 - jl bomb_draw_highspeed_end - inc ebx - bomb_draw_highspeed_end: - cmp eax, 0 - jge bomb_draw_left_dir_end - add ebx, 3 - bomb_draw_left_dir_end: - ; ebx - shl ebx, 8 - mov eax, ebx - add ebx, eax - add ebx, eax - add ebx, bmp_bomb ; ebx - - ; - mov eax,7 - mov ecx,16*65536+16 - int 0x40 - - pop edx - pop ecx - pop ebx - pop eax - - ret - - -; - -bomb_check_detonation: ; : eax - X, eab - Y - ; ( ) - ; eax : 0 - , 1 - - ; ( ) - - push ecx - push edx - - add eax, 8 - add ebx, 8 - - sub eax, CITY_OFFSET - ; - cmp eax, 0 - jl bcd_out_of_city - cmp eax, 32*20 - jg bcd_out_of_city - ; - add eax, 10 ; X 20 - mov ecx, eax - shr eax, 4 - shr ecx, 6 - sub eax, ecx - shr ecx, 2 - add eax, ecx - shr ecx, 2 - sub eax, ecx - dec eax ; eax - mov esi, eax - shl esi, 1 - add esi, _city ; esi - - mov edx, WINDOW_HEIGHT - GROUNG_HEIGHT - sub edx, ebx - mov ebx, edx - cmp ebx, 0 - jg bcd_no_neg_value_Y - xor ecx, ecx - mov cx, [esi] - xor ebx, ebx - jmp bcd_damage ; - bcd_no_neg_value_Y: - add ebx, 10 ; Y 20 - mov ecx, ebx - shr ebx, 4 - shr ecx, 6 - sub ebx, ecx - shr ecx, 2 - add ebx, ecx - shr ecx, 2 - sub ebx, ecx ; ebx " " - - xor ecx, ecx - mov cx, [esi] - cmp ebx, ecx ; - jg bcd_no_detonation - bcd_damage: ; - ; - mov edx, ecx - mov ecx, ebx - sub ecx, 2 - cmp ecx, 0 ; 0, - jge bcd_no_neg_value_H - xor ecx, ecx - bcd_no_neg_value_H: - mov [esi], cx ; - ; - call clear_tiles - ; - call ackack_check_bombing - ; - ; : eax - ( - ) , - ; ebx - , ecx - , edx - , - ; esi - - dec eax - cmp eax, 0 - jl bcd_damage_left_end - sub esi, 2 - xor ecx, ecx - mov cx, [esi] ; ecx - mov edx, ecx - push ecx - sub ecx, ebx - inc ecx - cmp ecx, 2 - pop ecx - ja bcd_damage_left_end ; |ecx-ebx|<=1 - dec ecx - cmp ecx, 0 ; 0, - jge bcd_no_neg_value_HL - xor ecx, ecx - bcd_no_neg_value_HL: - mov [esi], cx - call clear_tiles - ; - call ackack_check_bombing - bcd_damage_left_end: - - ; - ; : eax - , - ; ebx - , ecx - , edx - , - ; esi - - inc eax - inc eax - cmp eax, 32 - jge bcd_damage_right_end - add esi, 4 - xor ecx, ecx - mov cx, [esi] ; ecx - mov edx, ecx - push ecx - sub ecx, ebx - inc ecx - cmp ecx, 2 - pop ecx - ja bcd_damage_right_end ; |ecx-ebx|<=1 - dec ecx - cmp ecx, 0 ; 0, - jge bcd_no_neg_value_HR - xor ecx, ecx - bcd_no_neg_value_HR: - mov [esi], cx - call clear_tiles - ; - call ackack_check_bombing - bcd_damage_right_end: - call check_level_complete - bcd_detonation: - mov eax, 1 - jmp bcd_end - bcd_no_detonation: - mov eax, 0 - jmp bcd_end - bcd_out_of_city: - mov eax, 1 - cmp ebx, WINDOW_HEIGHT - GROUNG_HEIGHT - jge bcd_end - mov eax, 0 - bcd_end: - pop edx - pop ecx - - ret - - -bombfly_sound_start: ; ecx - - - push eax ebx ecx - cmp [_flag_bomberdatabin_ok], 1 - jne @f - stdcall ssmix_playtrack, [_array_sounds+8*((( 1 ))-1)], [_array_sounds+8*((( 1 ))-1)+4], VOLUME_BOMBFLY, VOLUME_BOMBFLY, SSMIX_CHANMODE_SINGLE_WITHOUT_RESET - @@: - mov ebx, ecx - shl ebx, 2 - add ebx, _array_bombsoundchannels - mov [ebx], eax - pop ecx ebx eax - - ret - - -bombfly_sound_stop: ; ecx - - - push eax ebx ecx - mov ebx, ecx - shl ebx, 2 - add ebx, _array_bombsoundchannels - mov eax, [ebx] - cmp [_flag_bomberdatabin_ok], 1 - jne @f - stdcall ssmix_stoptrack, eax - @@: - inc ecx - .delete_loop: - cmp ecx, MAX_BOMBS - jae .delete_loop_end - mov ebx, ecx - shl ebx, 2 - add ebx, _array_bombsoundchannels - mov eax, [ebx] - mov [ebx-4], eax - inc ecx - jmp .delete_loop - .delete_loop_end: - pop ecx ebx eax - - ret - -; ==================================== ======================================= - - -fill_circle: - ; ( ) - ; : - ; eax - X - ; ebx - Y - ; ecx - - ; edx - - mov edi, eax - mov esi, ebx - push edx ; - - mov eax, ecx - shl eax, 1 - mov edx, 3 - sub edx, eax ; D:=3-2*R - xor ebx, ebx ; ebx X, ecx Y, edx D, eax - - - fc_loop: - cmp ebx, ecx - jg fc_loop_end - ; - pop eax ; - push edx ; D - mov edx, eax ; edx - - push ebx - push ecx - ; - mov eax, edi - sub eax, ebx - shl eax, 16 - add ebx, edi - add ebx, eax ; - add ecx, esi - mov eax, ecx - shl eax, 16 - add ecx, eax ; y - mov eax, 38 - int 0x40 - pop ecx - push ecx - ; - mov eax, esi - sub eax, ecx - mov ecx, eax - shl eax, 16 - add ecx, eax ; y - mov eax, 38 - int 0x40 - pop ecx - pop ebx - push ecx - push ebx ; ! ! - ; - mov eax, edi - sub eax, ecx - shl eax, 16 - add ecx, edi - add ecx, eax - mov eax, ebx - mov ebx, ecx ; - mov ecx, eax ; ! ecx - x - add ecx, esi - mov eax, ecx - shl eax, 16 - add ecx, eax ; y - mov eax, 38 - int 0x40 - pop ecx - push ecx - ; - mov eax, esi - sub eax, ecx - mov ecx, eax - shl eax, 16 - add ecx, eax ; y - mov eax, 38 - int 0x40 - pop ebx - pop ecx - - mov eax, edx ; eax - - pop edx ; D - push eax ; - ; - cmp edx, 0 - jge fc_loop_D_more_0 ; D<0 - fc_loop_D_low_0: ; - mov eax, ebx - shl eax, 2 - add edx, eax - add edx, 4 ; D:=D+4*X+6 - jmp fc_loop_cmpD_end - fc_loop_D_more_0: ; - mov eax, ebx - sub eax, ecx - shl eax, 2 - add edx, eax - add edx, 10 ; D:=D+4*(X-Y)+10 - dec ecx - fc_loop_cmpD_end: ; - inc ebx - jmp fc_loop - fc_loop_end: - - pop edx ; - - ret - - - - -bang_add: ; , eax - X, eab - Y - - push eax - push ebx - push ecx - push edx - - shl eax, 16 - add eax, ebx - mov ebx, _bang_array - xor ecx, ecx - bang_add_loop: - cmp ecx, MAX_BOMBS - jae bang_add_loop_end - mov edx, [ebx] - cmp edx, -1 - jne bang_add_loop_freecheck_end - mov edx, 5*65536 + 3 - mov [ebx], edx - add ebx, 4 - mov [ebx], eax - cmp [_flag_bomberdatabin_ok], 1 - jne @f - stdcall ssmix_playtrack, [_array_sounds+8*((( 2 ))-1)], [_array_sounds+8*((( 2 ))-1)+4], VOLUME_BOMBBANG, VOLUME_BOMBBANG, SSMIX_CHANMODE_SINGLE - @@: - jmp bang_add_loop_end - bang_add_loop_freecheck_end: - add ebx, 8 - inc ecx - jmp bang_add_loop - bang_add_loop_end: - - - pop edx - pop ecx - pop ebx - pop eax - - ret - - -bang_proc: - - mov ebx, _bang_array - xor ecx, ecx - bang_proc_loop: - cmp ecx, MAX_BOMBS - jae bang_proc_loop_end - ; - mov edx, [ebx] - cmp edx, -1 - je bang_proc_loop_freecheck_end - ; - and edx, 0x0000FFFF - cmp edx, 0 - jne bang_proc_loop_endcheck_end - ; - push ebx - push ecx - mov ecx, [ebx] - shr ecx, 16 - add ebx, 4 - mov eax, [ebx] - mov ebx, eax - shr eax, 16 - and ebx, 0x0000FFFF - mov edx, BACK_COLOR - call fill_circle - pop ecx - pop ebx - mov eax, -1 - mov [ebx], eax - jmp bang_proc_loop_continue - bang_proc_loop_endcheck_end: - ; - push ebx - push ecx - ; - mov eax, [ebx] - mov edx, eax - shr eax, 16 - mov ecx, eax - and edx, 0x0000FFFF - mov eax, edx - shl eax, 3 - add eax, ecx - shl eax, 16 - dec edx - add eax, edx - mov [ebx], eax - ; - add ebx, 4 - mov eax, [ebx] - mov ebx, eax - shr eax, 16 - and ebx, 0x0000FFFF - ; - mov edx, BANG_COLOR - call fill_circle - pop ecx - pop ebx - bang_proc_loop_freecheck_end: - bang_proc_loop_continue: - add ebx, 8 - inc ecx - jmp bang_proc_loop - bang_proc_loop_end: - - ret - -; ===================================== ========================================= -; , , , - - -ackack_draw: ; - - mov ebx, _ackack - xor ecx, ecx - xor esi, esi ; ( ) - ackack_draw_loop: - cmp ecx, 32 - jae ackack_draw_loop_end - xor eax, eax - mov ax, [ebx] - cmp eax, 1 - jne ackack_draw_continue ; 1 - push ebx - push ecx - ; ebx - mov ebx, ecx - shl ebx, 1 - add ebx, _city ; - xor eax, eax - mov ax, [ebx] ; - cmp eax, 0 - jle ackack_draw_continue2 ; - mov esi, 1 - call ackack_bullet_start - ; - mov ebx, bmp_ackack ; - cmp edx, 0 - je ackack_draw_no_start_bullet - add ebx, 20*20*3 ; - ackack_draw_no_start_bullet: - ; edx - mov edx, ecx - shl edx, 4 - shl ecx, 2 - add edx, ecx - add edx, CITY_OFFSET - shl edx, 16 - mov ecx, eax - shl eax, 4 - shl ecx, 2 - add eax, ecx - mov ecx, WINDOW_HEIGHT-GROUNG_HEIGHT - sub ecx, eax - sub ecx, 20 ; - add edx, ecx ; - mov ecx, 20*0x00010000 + 20 ; - mov eax, 7 - int 0x40 ; - ackack_draw_continue2: - pop ecx - pop ebx - ackack_draw_continue: - add ebx, 2 - inc ecx - jmp ackack_draw_loop - ackack_draw_loop_end: - - cmp esi, 0 - jne @f - ; - call air_raid_warning_off - @@: - - ret - - -ackack_check_bombing: ; : eax - - - push eax - push ebx - push ecx - push edx - ; - mov ebx, eax - shl ebx, 1 - push ebx - add ebx, _ackack - mov edx, ebx ; edx - xor eax, eax - mov ax, [ebx] ; eax - cmp eax, 1 - jne acb_no_bombing ; - xor eax, eax - mov [ebx], ax ; - call ackack_next_wave - acb_no_bombing: - ; - pop ebx - add ebx, _city - xor eax, eax - mov ax, [ebx] ; eax - cmp eax, 0 - jg acb_no_destroy_building ; - xor eax, eax - mov [ebx], ax ; - acb_no_destroy_building: - pop edx - pop ecx - pop ebx - pop eax - - ret - - - -ackack_next_wave: ; - - push eax - push ebx - push ecx - push edx - - anw_begin: - mov ebx, _ackack - xor ecx, ecx - xor edx, edx ; - anw_loop: - cmp ecx, 32 - jae anw_loop_end - xor eax, eax - mov ax, [ebx] - cmp eax, 1 - jle anw_continue ; <=1 - dec eax - mov [ebx], ax - cmp eax, 1 - jg anw_no_active_ackack ; >1 - mov edx, 1 ; - jmp anw_continue - anw_no_active_ackack: - cmp edx, 1 - je anw_continue ; 1 - mov edx, 2 - anw_continue: - add ebx, 2 - inc ecx - jmp anw_loop - anw_loop_end: - cmp edx, 2 - je anw_begin - - pop edx - pop ecx - pop ebx - pop eax - ret - - - - - -ackack_bullet_start: ; (: eax - , ecx - ; - ; : edx - (0-, 1 -) - - push eax - push ebx - push ecx - - cmp [_flag_air_raid_warning], 1 - jne abs_no_start_bullet - - ; ebx - mov edx, eax - mov ebx, ecx - shl ebx, 2 - add ebx, _ackack_bullet ; - mov eax, [ebx] ; - cmp eax, 0 - jne abs_no_start_bullet ; 0, - ; - mov eax, edx ; eax - ; - mov ecx, eax - shl eax, 4 - shl ecx, 2 - add eax, ecx - mov ecx, WINDOW_HEIGHT-GROUNG_HEIGHT - sub ecx, eax - sub ecx, 20+BULLET_SIZE ; + ( ecx - ) - mov [ebx], ecx ; - - cmp [_flag_bomberdatabin_ok], 1 - jne @f - stdcall ssmix_playtrack, [_array_sounds+8*((( 3 ))-1)], [_array_sounds+8*((( 3 ))-1)+4], VOLUME_ACKACK,VOLUME_ACKACK , SSMIX_CHANMODE_SINGLE - @@: - - mov edx, 1 - jmp abs_end_start_bullet - abs_no_start_bullet: - mov edx, 0 - abs_end_start_bullet: - - pop ecx - pop ebx - pop eax - - ret - - -ackack_bullet_proc: ; - - mov ebx, _ackack_bullet - xor ecx, ecx - abp_loop: - cmp ecx, 32 - jae abp_loop_end - mov eax, [ebx] - cmp eax, 0 - je abp_continue - jl abp_low_zero - push ebx - push ecx - ; - mov ebx, ecx - shl ebx, 4 - shl ecx, 2 - add ebx, ecx - add ebx, CITY_OFFSET - add ebx, 7 ; - mov edx, ebx - shl ebx, 16 - add ebx, edx ; ebx X - mov ecx, eax - mov edx, ecx - add edx, BULLET_SIZE ; - shl ecx, 16 - add ecx, edx ; ebx Y - mov edx, BACK_COLOR - mov eax, 38 - int 0x40 - add ebx, 0x00050005 - int 0x40 - - pop ecx - pop ebx - push ebx - push ecx - - mov eax, [ebx] - sub eax, ACKACK_BULLET_SPEED - mov [ebx], eax - cmp eax, 0 - jle abp_end_draw_bullet - - call ackack_bullet_interaction_check - cmp edx, 0 - je abp_no_bullet_interaction ; - xor eax, eax - mov [ebx], eax - jmp abp_end_draw_bullet - abp_no_bullet_interaction: - - ; - mov ebx, ecx - shl ebx, 4 - shl ecx, 2 - add ebx, ecx - add ebx, CITY_OFFSET - add ebx, 7 ; - mov edx, ebx - shl ebx, 16 - add ebx, edx ; ebx X - mov ecx, eax - mov edx, ecx - add edx, BULLET_SIZE ; - shl ecx, 16 - add ecx, edx ; ebx Y - mov edx, 0x00000000 - mov eax, 38 - int 0x40 - add ebx, 0x00050005 - int 0x40 - abp_end_draw_bullet: - - pop ecx - pop ebx - jmp abp_continue - abp_low_zero: - xor eax, eax - mov [ebx], eax - abp_continue: - add ebx, 4 - inc ecx - jmp abp_loop - abp_loop_end: - - ret - - -ackack_bullet_interaction_check: ; - ; (: eax - Y, ecx - ; - ; : edx - (0-, 1 -)) - - - push eax - push ebx - push ecx - - ; - mov ebx, [_plane_health] - cmp ebx, 0 - jle abic_with_plane_no - mov ebx, [_plane_state] - cmp ebx, 4 - je abic_with_plane_no - cmp ebx, 5 - je abic_with_plane_no - ; - mov ebx, [_Y_plane] - cmp eax, ebx - jl abic_with_plane_no ; - add ebx, 20 ; ebx - - cmp eax, ebx - jg abic_with_plane_no ; - ; X - mov edx, ecx - shl edx, 4 - shl ecx, 2 - add ecx, edx - add ecx, CITY_OFFSET - add ecx, 7 ; ecx - X - mov ebx, [_X_plane] - add ebx, 32 - cmp ecx, ebx - jg abic_with_plane_no - mov ebx, [_X_plane] - add ecx, 5 - cmp ecx, ebx - jl abic_with_plane_no - ; !!! - mov ebx, [_plane_health] - sub ebx, 20 - mov [_plane_health], ebx - cmp ebx, 0 ; game over - jg abic_no_plane_crash - mov [_plane_health], 0 - mov eax, [_X_plane] - mov ebx, [_Y_plane] - call bang_add ; - call game_over ; - abic_no_plane_crash: - mov edx, 1 - jmp abic_with_plane_end - abic_with_plane_no: - mov edx, 0 - abic_with_plane_end: - - pop ecx - pop ebx - pop eax - ret - -; ===================================== ========================================= - -ground_draw: - - mov eax, 13 - mov ebx, 0*0x00010000 + (WINDOW_WIDTH-10) - mov ecx, (WINDOW_HEIGHT-GROUNG_HEIGHT)*0x00010000 + (GROUNG_HEIGHT-5-20) - mov edx, GROUND_COLOR - int 0x40 - - mov eax, 38 - mov ebx, 0*0x00010000 + (WINDOW_WIDTH-10) - mov ecx, (WINDOW_HEIGHT-GROUNG_HEIGHT)*0x00010000 + (WINDOW_HEIGHT-GROUNG_HEIGHT) - mov edx, 0x000000 - int 0x40 - - ret - - -city_draw: ; - - mov ebx, _city - xor edx, edx - city_draw_loop: - cmp edx, 32 - jae city_draw_loop_end - xor eax, eax - mov ax, [ebx] - push ebx - push edx - mov ebx, bmp_tile - city_draw_loop2: - cmp eax, 0 - jle city_draw_loop2_end - push eax - push edx - ; edx - mov ecx, edx - shl edx, 4 - shl ecx, 2 - add edx, ecx - add edx, CITY_OFFSET - shl edx, 16 - mov ecx, eax - shl eax, 4 - shl ecx, 2 - add eax, ecx - mov ecx, WINDOW_HEIGHT-GROUNG_HEIGHT - sub ecx, eax - add edx, ecx ; - mov ecx, 20*0x00010000 + 20 ; - mov eax, 7 - int 0x40 ; - pop edx - pop eax - dec eax - jmp city_draw_loop2 - city_draw_loop2_end: - - pop edx - pop ebx - add ebx, 2 - inc edx - jmp city_draw_loop - city_draw_loop_end: - - ret - - -clear_tiles: ; : eax - , ecx - , edx - - - push eax - push ebx - push ecx - push edx - ; X - mov ebx, eax - shl eax, 4 - shl ebx, 2 - add eax, ebx - add eax, CITY_OFFSET - ; Y1 - mov ebx, ecx - shl ecx, 4 - shl ebx, 2 - add ecx, ebx - mov ebx, WINDOW_HEIGHT-GROUNG_HEIGHT - sub ebx, ecx - mov ecx, ebx - add ecx, 20 - ; Y2 - mov ebx, edx - shl edx, 4 - shl ebx, 2 - add edx, ebx - mov ebx, WINDOW_HEIGHT-GROUNG_HEIGHT - sub ebx, edx - mov edx, ebx - sub edx, 20 ; , - ; Y=Y2 H=Y1-Y2 - sub ecx, edx - shl edx, 16 - add ecx, edx - ; X 20 - shl eax, 16 - add eax, 20 - mov ebx, eax - ; - mov eax, 13 - mov edx, BACK_COLOR - int 0x40 - - pop edx - pop ecx - pop ebx - pop eax - - ret - - -load_level: ; , eax - - mov eax, [_level_num] - dec eax - shl eax, 7 ; (128 ) - mov ebx, levels - add ebx, eax ; ebx - mov edx, cur_level - mov ecx, 0 - load_level_loop: - cmp ecx, 128/4 - jae load_level_loop_end - mov eax, [ebx] - mov [edx], eax - add ebx, 4 - add edx, 4 - inc ecx - jmp load_level_loop - load_level_loop_end: - - load_level_end: - - ret - -; =================================== ======================================== - -timer_x4: - mov eax, [_timer_x4] - inc eax - mov [_timer_x4],eax - cmp eax, 4 - ja timer_x4_do - jmp timer_x4_end - timer_x4_do: - mov [_timer_x4],0 - timer_x4_end: - ret - - -timer_x2: - mov eax, [_timer_x2] - inc eax - mov [_timer_x2],eax - cmp eax, 2 - ja timer_x2_do - jmp timer_x2_end - timer_x2_do: - mov [_timer_x2],0 - timer_x2_end: - ret - -draw_window: ; - - mov eax,12 - mov ebx,1 - int 0x40 - - mov eax,0 - mov ebx,100*65536+WINDOW_WIDTH - mov ecx,100*65536+WINDOW_HEIGHT - mov edx,0x34000000+BACK_COLOR - mov edi,_window_caption - int 0x40 - - mov eax,12 - mov ebx,2 - int 0x40 - - ret - - - -draw_intro: - - ; - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-80)*65536 + 60 - mov ecx,0x80000000 - mov edx,_text_intro_title - int 0x40 - - ; - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-200)*65536 + 120 - mov ecx,0x80000000 - mov edx,_text_intro_description1 - int 0x40 - - - ; - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-60)*65536 + 200 - mov ecx,0x80000000 - mov edx,_text_intro_key_controls - int 0x40 - - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-70)*65536 + 230 - mov ecx,0x80000000 - mov edx,_text_intro_key_ctrl - int 0x40 - - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-70)*65536 + 245 - mov ecx,0x80000000 - mov edx,_text_intro_key_space - int 0x40 - - ; - - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-175)*65536 + 300 - mov ecx,0x80000000 - mov edx,_text_intro_select_level - int 0x40 - - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-25)*65536 + 320 - mov ecx,0x80000000 - mov edx,_text_intro_level_num - int 0x40 - - call draw_level_num - - ; - - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-175)*65536 + 350 - mov ecx,0x80000000 - mov edx,_text_intro_set_volume - int 0x40 - - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-25)*65536 + 370 - mov ecx,0x80000000 - mov edx,_text_intro_volume_num - int 0x40 - call draw_volume_num - - ; - - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-80)*65536 + 400 - mov ecx,0x80FF0000 - mov edx,_text_intro_start_space - int 0x40 - - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-30)*65536 + 460 - mov ecx,0x80000000 - mov edx,_text_intro_exit_key - int 0x40 - - - ret - - -draw_level_num: - - mov eax, 13 - mov ebx, (WINDOW_WIDTH/2+25)*0x00010000 + 30 - mov ecx, 320*0x00010000 + 15 - mov edx, BACK_COLOR - int 0x40 - - mov eax, 47 - mov ebx, 0x80020000 - mov ecx, [_level_num] - mov edx, (WINDOW_WIDTH/2+25)*65536 + 320 - mov esi,0x00000000 - int 0x40 - - ret - -draw_volume_num: - - mov eax, 13 - mov ebx, (WINDOW_WIDTH/2+35)*0x00010000 + 30 - mov ecx, 370*0x00010000 + 15 - mov edx, BACK_COLOR - int 0x40 - - mov eax, 47 - mov ebx, 0x80020000 - mov ecx, [_set_volume] - mov edx, (WINDOW_WIDTH/2+35)*65536 + 370 - mov esi,0x00000000 - int 0x40 - - ret - -;--------------------------------------------------------------------------- -;-------------------------------- ----------------------------------- -;--------------------------------------------------------------------------- - -_game_state dd ? -_delay dd 6 -_timer_x2 dd ? -_timer_x4 dd ? -_game_over_time dd ? -_flag_air_raid_warning dd ? -_flag_bomberdatabin_ok dd ? -_last_value_timecount dd ? - -_X_plane dd ? -_Y_plane dd ? -_last_XY_plane dd ? -_VX_plane dd ? -_addit_VY_plane dd ? -_plane_state dd ? ; 0 - , 1- , 2- -, 3- -, 4 - , 5 - -_plane_state_step dd ? ; ( ) -_plane_health dd ? ; - -_bomb_count dd ? -_bomb_array rd 4*MAX_BOMBS -_bomb_delay_time dd ? ; - -_bang_array rd 2*MAX_BOMBS - -_anim_pos_plane dd ? -; -_anim_array_uturn_rl dd 0,1,2,3,4,5,6,7,8 -_anim_array_uturn_lr dd 8,7,6,9,10,11,2,1,0 -_anim_array_barrel_r dd 0,1,2,12,13,14,15,16,0 -_anim_array_barrel_l dd 8,17,18,19,20,21,6,7,8 - - -cur_level: -; , . -_city rw 32 -; , . -_ackack rw 32 -; , -_ackack_bullet rd 32 - -; -_level_num dd 1 -; : 32 ( " ") _level?_city -; _level?_ackack -levels: -_level1_city dw 0, 0, 0, 6, 5, 6, 5, 6, 3, 3, 3, 3, 3, 6, 7, 8, 8, 7, 6, 3, 3, 3, 3, 3, 6, 5, 6, 5, 6, 0, 0, 0 -_level1_ackack dw 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - -_level2_city dw 0, 0, 0, 5, 5, 2, 5, 7, 7, 2, 7, 9, 9, 9, 2, 9, 9, 2, 9, 9, 9, 7, 2, 7, 7, 5, 2, 5, 5, 0, 0, 0 -_level2_ackack dw 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 5, 0, 0, 6, 0, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 0, 0 - -_level3_city dw 0, 0, 0,12,12,12, 9, 9, 9,12,12,12, 9, 7, 5, 3, 3, 5, 7, 9,12,12,12, 9, 9, 9,12,12,12, 0, 0, 0 -_level3_ackack dw 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 4, 0, 3, 0, 2, 1, 1, 2, 0, 3, 0, 5, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0 - -_level4_city dw 0, 0, 0,12,12,12, 3,12,12,12, 3, 1, 1, 6,12,18, 18,12, 6, 1, 1, 3,12,12,12, 3,12,12,12, 0, 0, 0 -_level4_ackack dw 0, 0, 0, 0, 5, 0, 1, 0, 0, 0, 1, 0, 3, 0, 0, 2, 6, 0, 0, 3, 0, 1, 0, 4, 0, 1, 0, 0, 0, 0, 0, 0 - -_level5_city dw 0, 5,10,10,10,10,15,15,15,15,17,17,17,17, 1,15, 15, 1,17,17,17,17,15,15,15,15,10,10,10,10, 5, 0 -_level5_ackack dw 0, 8, 0, 9, 9, 0, 3, 3, 3, 3, 0, 0, 0, 0, 5, 1, 2, 5, 0, 0, 0, 0, 4, 4, 4, 4, 0,10,10, 0, 7, 0 - -; -_count_sounds dd ? -_array_sounds rd 2*MAX_SOUNDS - -_channel_sound_plane dd ? ; -_channel_sound_arw dd ? ; -_array_bombsoundchannels rd MAX_BOMBS ; - -_set_volume dd 8 ; 0..8 - -; - -_s_current_dir rb 4096 ; - -file_info: ; - _fi_func dd ? - _fi_pos dd ? - dd 0 - _fi_size dd ? - _fi_pbuff dd ? - db 0 - _fi_pfilename dd ? - -if lang eq ru_RU - include 'ruslang.inc' -else - include 'englang.inc' -end if - -bmp_plane: -file "plane.bmp":54 - -bmp_bomb: -file "bomb.bmp":54 - -bmp_tile: -file "tile.bmp":54 - -bmp_ackack: -file "ackack.bmp":54 - - -align 16 -rb 0x100 ; . - -i_end: - +; + +SK_SPACE equ 0x39 +SK_CTRL equ 0x1D +SK_UP equ 0x48 +SK_DOWN equ 0x50 +SK_LEFT equ 0x4B +SK_RIGHT equ 0x4D +SK_ESC equ 0x01 + + +INIT_PLANE_X equ 20 +INIT_PLANE_Y equ 20 +BACK_COLOR equ 0x9bcdfa +GROUND_COLOR equ 0x808080 +BANG_COLOR equ 0xB0140E +ANIM_PLANE_BMP_PIXELS_COUNT equ 22*32*32 +WINDOW_WIDTH equ 800 +WINDOW_HEIGHT equ 600 +GROUNG_HEIGHT equ 100 +CITY_OFFSET equ (WINDOW_WIDTH-32*20)/2 +MAX_BOMBS equ 8 +GRAVY_ACCEL equ 1 +BOMB_DELAY equ 12 +MAX_LEVEL equ 5 +ACKACK_BULLET_SPEED equ 17 +BULLET_SIZE equ 7 +MAX_SOUNDS equ 8 + +VOLUME_BOMBFLY equ 16 +VOLUME_BOMBBANG equ 28 +VOLUME_ACKACK equ 24 +VOLUME_PLANE equ 48 +VOLUME_ARW equ 16 + + +use32 ; , 32 + org 0x0 ; , 0x0 + db 'MENUET01' ; (8 ) + dd 0x1 ; + dd start ; , + ; + dd i_end ; + dd i_end ; , 0100 + dd i_end ; , . , + dd 0x0, _s_current_dir ; . + ; , + ; + + ; , , + ; +; + +;----------------- include ------------------------------------- +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. +include 'ssmix.inc' + +;--------------------------------------------------------------------------- +;----------------------------- -------------------------------- +;--------------------------------------------------------------------------- + +align 4 +start: ; + + ; : - + mov eax, 66 + mov ebx, 1 + mov ecx, 1 + int 0x40 + + ; + mov eax, 68 + mov ebx, 11 + int 0x40 + cmp eax, 1000000 ; ~1000 ( ) + ja heap_ok + mov eax, -1 + int 0x40 ; + heap_ok: + + mov eax, bmp_plane + mov ebx, 736*32*3 + call convert_bmp_backcolor + mov eax, bmp_bomb + mov ebx, 96*16*3 + call convert_bmp_backcolor + mov eax, bmp_tile + mov ebx, 20*20*3 + call convert_bmp_backcolor + mov eax, bmp_ackack + mov ebx, 40*20*3 + call convert_bmp_backcolor + + call read_sounds_file + call ssmix_init + + mov [_game_state], 0 + +redraw_window: + call draw_window + cmp [_game_state], 0 + jne still_no_intro + call draw_intro + still_no_intro: + +still: + ; + mov eax,11 + int 0x40 + cmp eax,1 + je redraw_window + cmp eax,2 + je key + cmp eax,3 + je close_button + + ; + mov eax,5 + mov ebx,1 + int 0x40 + + mov eax, 26 + mov ebx, 9 + int 0x40 + mov ebx, eax + sub eax, [_last_value_timecount] + cmp eax, [_delay] + jbe still + mov [_last_value_timecount], ebx + + call timer_x2 + call timer_x4 + + ; + cmp [_game_state], 1 + jne still_no_game + ; + mov eax, [_plane_health] + cmp eax, 0 + jle still_no_plane + call flight_control_plane + call plane_interaction + call draw_plane + still_no_plane: + call draw_plane_health + call bomb_proc + call bang_proc + call ground_draw + call city_draw + call ackack_draw + call ackack_bullet_proc + ; + call game_over_timer + still_no_game: + + jmp still + + +key: ; + mov eax,2 + int 0x40 + + push eax + key_SPACE: + cmp ah, SK_SPACE + jne key_SPACE_end + cmp [_game_state], 1 + je key_SPACE_do_a_barrel_roll + key_SPACE_start_game: ; + mov [_game_state], 1 + call init_game_state + jmp key_SPACE_end + key_SPACE_do_a_barrel_roll: ; + mov eax, [_plane_state] + cmp eax, 0 + je key_SPACE_do_a_barrel_roll_r + cmp eax, 1 + je key_SPACE_do_a_barrel_roll_l + jmp key_SPACE_end + key_SPACE_do_a_barrel_roll_r: + mov eax,[_X_plane] + cmp eax, WINDOW_WIDTH-130-32 + jg key_SPACE_end + mov [_plane_state], 4 + mov [_plane_state_step], 0 + jmp key_SPACE_end + key_SPACE_do_a_barrel_roll_l: + mov eax,[_X_plane] + cmp eax, 130 + jl key_SPACE_end + mov [_plane_state], 5 + mov [_plane_state_step], 0 + key_SPACE_end: + pop eax + + key_CTRL: + cmp ah, SK_CTRL + jne key_CTRL_end + call bomb_drop + key_CTRL_end: + + key_UP: + cmp ah, SK_UP + jne key_UP_end + cmp [_game_state], 0 + jne key_UP_end + mov ebx, [_level_num] + inc ebx + mov [_level_num], ebx + cmp ebx, MAX_LEVEL + jbe key_UP_no_max + mov [_level_num], MAX_LEVEL + key_UP_no_max: + call draw_level_num + key_UP_end: + + key_DOWN: + cmp ah, SK_DOWN + jne key_DOWN_end + cmp [_game_state], 0 + jne key_DOWN_end + mov ebx, [_level_num] + dec ebx + mov [_level_num], ebx + cmp ebx, 1 + jae key_DOWN_no_min + mov [_level_num], 1 + key_DOWN_no_min: + call draw_level_num + key_DOWN_end: + + + key_LEFT: + cmp ah, SK_LEFT + jne key_LEFT_end + cmp [_game_state], 0 + jne key_LEFT_end + mov ebx, [_set_volume] + dec ebx + cmp ebx, 0 + jge @f + mov ebx, 0 + @@: + mov [_set_volume], ebx + shl ebx, 4 + stdcall ssmix_setvolume, ebx, ebx + call draw_volume_num + key_LEFT_end: + + + key_RIGHT: + cmp ah, SK_RIGHT + jne key_RIGHT_end + cmp [_game_state], 0 + jne key_RIGHT_end + mov ebx, [_set_volume] + inc ebx + cmp ebx, 8 + jle @f + mov ebx, 8 + @@: + mov [_set_volume], ebx + shl ebx, 4 + stdcall ssmix_setvolume, ebx, ebx + call draw_volume_num + key_RIGHT_end: + + + key_ESC: + cmp ah, SK_ESC + jne key_ESC_end + jmp close_button + key_ESC_end: + + jmp still + + + + +close_button: ; + + call ssmix_release + call sounds_free_memory + ; + mov eax, -1 + int 0x40 + + +;--------------------------------------------------------------------------- +;----------------------------- --------------------------------- +;--------------------------------------------------------------------------- + + +convert_bmp_backcolor: ; eax - , ebx - + + push ecx + cbb_loop: + cmp ebx, 0 + jle cbb_loop_end + mov ecx, [eax] + and ecx, 0x00FFFFFF + cmp ecx, 0x00FFFFFF + jne @f + mov ecx, BACK_COLOR + mov [eax], cl + shr ecx, 8 + mov [eax+1], cl + shr ecx, 8 + mov [eax+2], cl + @@: + add eax, 3 + sub ebx, 3 + jmp cbb_loop + cbb_loop_end: + pop ecx + + ret + +; +read_sounds_file: + + mov edi, _s_current_dir + mov al, 0 + mov ecx, 4096 + repne scasb + mov dword[edi-1], 'data' + mov dword[edi+3], '.bin' + mov [_flag_bomberdatabin_ok], 1 + ; + mov [_fi_func], 0 + mov [_fi_pos], 8 + mov [_fi_size], 4 + mov [_fi_pbuff], _count_sounds + mov [_fi_pfilename], _s_current_dir + mov eax, 70 + mov ebx, file_info + int 0x40 + cmp ebx, -1 + jne @f + mov [_flag_bomberdatabin_ok], 0 + jmp .end + @@: + ; , () + mov ecx, [_count_sounds] + shl ecx, 3 + mov [_fi_func], 0 + mov [_fi_pos], 12 + mov [_fi_size], ecx + mov [_fi_pbuff], _array_sounds + mov [_fi_pfilename], _s_current_dir + mov eax, 70 + mov ebx, file_info + int 0x40 + ; + mov ecx, [_count_sounds] + mov esi, _array_sounds + .loop: + push ecx + ; + mov [_fi_func], 0 + mov eax, [esi] + mov [_fi_pos], eax + mov eax, [esi+4] + mov [_fi_size], eax + ; , , + mov ecx, [esi+4] + mov eax, 68 + mov ebx, 12 + int 0x40 + mov [esi], eax + mov ecx, [esi+4] + add ecx, eax + mov [esi+4], ecx + ; + mov [_fi_pbuff], eax + mov [_fi_pfilename], _s_current_dir + mov eax, 70 + mov ebx, file_info + int 0x40 + pop ecx + add esi, 8 + dec ecx + jnz .loop + .end: + + ret + + +sounds_free_memory: + + mov ecx, [_count_sounds] + mov esi, _array_sounds + .loop: + push ecx + ; , , + mov eax, 68 + mov ebx, 13 + mov ecx, [esi] + int 0x40 + pop ecx + add esi, 8 + dec ecx + jnz .loop + + + ret + + +init_game_state: ; + mov [_game_over_time], 0 + mov [_X_plane], INIT_PLANE_X + mov [_Y_plane], INIT_PLANE_Y + mov [_VX_plane], 4 + mov [_plane_state], 0 + mov [_anim_pos_plane], 0 + mov [_plane_health], 100 + mov [_timer_x2], 0 + mov [_timer_x4], 0 + mov [_bomb_count], 0 + mov [_bomb_delay_time], 0 + mov [_addit_VY_plane], 0 + mov [_flag_air_raid_warning], 0 + + call load_level + + ; + mov ebx, _bang_array + xor ecx, ecx + igs_bang_array_loop: + cmp ecx, MAX_BOMBS + jae igs_bang_array_loop_end + mov eax, -1 + mov [ebx], eax + add ebx, 8 + inc ecx + jmp igs_bang_array_loop + igs_bang_array_loop_end: + ; + mov ebx, _ackack_bullet + xor ecx, ecx + igs_bullet_array_loop: + cmp ecx, 32 + jae igs_bullet_array_loop_end + mov eax, 0 + mov [ebx], eax + add ebx, 4 + inc ecx + jmp igs_bullet_array_loop + igs_bullet_array_loop_end: + + ; + call draw_window + + ; + cmp [_flag_bomberdatabin_ok], 1 + jne @f + stdcall ssmix_playtrack, [_array_sounds+8*((( 4 ))-1)], [_array_sounds+8*((( 4 ))-1)+4], VOLUME_PLANE, VOLUME_PLANE, SSMIX_CHANMODE_REPEAT + @@: + mov [_channel_sound_plane], eax + + mov [_channel_sound_arw], -1 + + ret + + + +game_over: + + mov [_game_over_time], 30 ; game over + ; GAME OVER + mov eax,4 + mov ebx,(WINDOW_WIDTH/2 - 50)*65536 + 30 + mov ecx,0x80000000 + mov edx,_text_game_over + int 0x40 + + cmp [_flag_bomberdatabin_ok], 1 + jne @f + stdcall ssmix_stoptrack, [_channel_sound_plane] + @@: + + ret + + +game_over_timer: ; , + + mov ebx, [_game_over_time] + cmp ebx, 0 + je got_end + dec ebx + mov [_game_over_time], ebx + cmp ebx, 0 + jg got_end + mov [_game_state], 0 + cmp [_flag_bomberdatabin_ok], 1 + jne @f + call ssmix_stopalltracks + @@: + call draw_window + call draw_intro + got_end: + + ret + + +next_level: ; + + push eax + mov [_game_over_time], 1 ; + mov eax, [_level_num] ; + inc eax + cmp eax, MAX_LEVEL + jbe next_level_no_overmax + mov eax, MAX_LEVEL + next_level_no_overmax: + mov [_level_num], eax + pop eax + + ret + + + +check_level_complete: ; + + push eax + push ebx + push ecx + push edx + + mov edx, 0 ; : 0 - , 1 - + mov ebx, _city + xor ecx, ecx + clc_loop: + cmp ecx, 32 + jae clc_loop_end + xor eax, eax + mov ax, [ebx] + cmp eax, 0 + je clc_no_buildings + mov edx, 1 + jmp clc_loop_end + clc_no_buildings: + add ebx, 2 + inc ecx + jmp clc_loop + clc_loop_end : + cmp edx, 0 + jne clc_end + ; - + ; LEVEL COMPLETE + mov eax,4 + mov ebx,(WINDOW_WIDTH/2 - 70)*65536 + 30 + mov ecx,0x80000000 + mov edx,_text_level_complete + int 0x40 + ; + mov [_addit_VY_plane], 3 ; + ; + call air_raid_warning_off + clc_end: + + pop edx + pop ecx + pop ebx + pop eax + + ret + + +draw_plane_health: + + mov ebx, 5*0x00010000 + 100 + mov ecx, 5*0x00010000 + 10 + mov edx, 0x00000000 + mov eax, 13 + int 0x40 + + mov ebx, [_plane_health] + add ebx, 5*0x00010000 + mov edx, 0x00008000 + int 0x40 + + ret + + +air_raid_warning_on: + push eax + cmp [_flag_air_raid_warning], 1 + je .end + mov [_flag_air_raid_warning], 1 + cmp [_flag_bomberdatabin_ok], 1 + jne @f + stdcall ssmix_playtrack, [_array_sounds+8*((( 5 ))-1)], [_array_sounds+8*((( 5 ))-1)+4], VOLUME_ARW, VOLUME_ARW, SSMIX_CHANMODE_REPEAT + @@: + mov [_channel_sound_arw], eax + .end: + pop eax + ret + + +air_raid_warning_off: + cmp [_flag_air_raid_warning], 0 + je .end + mov [_flag_air_raid_warning], 0 + cmp [_flag_bomberdatabin_ok], 1 + jne .end + stdcall ssmix_stoptrack, [_channel_sound_arw] + .end: + ret + + +;======================================= ====================================== + + +flight_control_plane: ; + + mov eax,[_X_plane] + add eax, [_VX_plane] + mov [_X_plane], eax + + cmp eax, WINDOW_WIDTH-60-32 + jl fcp_set_utunr_rl + mov ebx, [_plane_state] + cmp ebx, 0 + jne fcp_set_utunr_rl + mov [_plane_state],2 + mov [_plane_state_step], 0 + fcp_set_utunr_rl: + + cmp eax, 60 + jg fcp_set_utunr_lr + mov ebx, [_plane_state] + cmp ebx, 1 + jne fcp_set_utunr_lr + mov [_plane_state],3 + mov [_plane_state_step], 0 + fcp_set_utunr_lr: + + ; 2 + mov eax, [_timer_x2] + cmp eax, 0 + jne fcp_timex2_end + + mov eax, [_plane_state] + cmp eax, 2 ; + jne fcp_uturn_rl_end + mov eax, [_plane_state_step] + mov ebx, 4 + sub ebx, eax + mov [_VX_plane], ebx ; + inc eax ; + mov [_plane_state_step], eax + cmp eax, 9 ; , + jne fcp_uturn_rl_end + mov [_plane_state], 1 ; + fcp_uturn_rl_end: + + + mov eax, [_plane_state] + cmp eax, 3 ; + jne fcp_uturn_lr_end + mov eax, [_plane_state_step] + mov ebx, -4 + add ebx, eax + mov [_VX_plane], ebx ; + inc eax ; + mov [_plane_state_step], eax + cmp eax, 9 ; , + jne fcp_uturn_lr_end + mov [_plane_state], 0 ; + fcp_uturn_lr_end: + + mov eax, [_plane_state] + cmp eax, 4 ; + jne fcp_barrel_r_end + mov eax, [_plane_state_step] + inc eax ; + mov [_plane_state_step], eax + cmp eax, 8 ; , + jne fcp_barrel_r_end + mov [_plane_state], 0 ; + fcp_barrel_r_end : + + mov eax, [_plane_state] + cmp eax, 5 ; + jne fcp_barrel_l_end + mov eax, [_plane_state_step] + inc eax ; + mov [_plane_state_step], eax + cmp eax, 8 ; , + jne fcp_barrel_l_end + mov [_plane_state], 1 ; + fcp_barrel_l_end: + + call animation_plane + + fcp_timex2_end: + + ; 4 + mov eax, [_timer_x4] + cmp eax, 0 + jne fcp_timex4_end + + ; + mov eax,[_Y_plane] + add eax, 1 + mov [_Y_plane], eax + + fcp_timex4_end: + + ; + + mov eax,[_Y_plane] + mov ebx,[_addit_VY_plane] + add eax, ebx + mov [_Y_plane], eax + + ; , + mov eax,[_Y_plane] + cmp eax, WINDOW_HEIGHT - GROUNG_HEIGHT - 32 + jl fcp_end_plane_landing + mov [_addit_VY_plane], 0 ; + mov ebx, [_plane_state] + cmp ebx, 6 + je fcp_end_plane_landing + cmp ebx, 0 + jne fcp_horiz_fly + mov [_plane_state], 6 ; + ;jmp fcp_end_plane_landing + fcp_horiz_fly: + mov eax, WINDOW_HEIGHT - GROUNG_HEIGHT - 32 + fcp_end_plane_landing: + cmp eax, WINDOW_HEIGHT - GROUNG_HEIGHT - 32 + 6 + jle fcp_no_plane_underground ; , " " + mov eax, WINDOW_HEIGHT - GROUNG_HEIGHT - 32 + 6 + mov ebx, [_X_plane] + cmp ebx, WINDOW_WIDTH - 60-32 + jl fcp_no_end_level ; , + ; + call next_level ; + fcp_no_end_level: + fcp_no_plane_underground: + mov [_Y_plane], eax + + ret + + + +animation_plane: + + ; + + ; + mov eax, [_plane_state] + cmp eax, 0 + jne ap_state0_end + mov [_anim_pos_plane], 0 + ap_state0_end: + + ; + mov eax, [_plane_state] + cmp eax, 1 + jne ap_state1_end + mov [_anim_pos_plane], 8 + ap_state1_end: + + ; + mov eax, [_plane_state] + cmp eax, 5 + ja ap_state2345_end + cmp eax, 2 + jb ap_state2345_end + sub eax, 2 + mov ebx, eax ; eax 9 + shl eax, 3 + add eax, ebx + add eax, [_plane_state_step] ; + shl eax, 2 ; 4 + add eax, _anim_array_uturn_rl ; + mov ebx, [eax] + mov [_anim_pos_plane], ebx ; + ap_state2345_end: + + ; ( ) + mov eax, [_plane_state] + cmp eax, 6 + jne ap_state6_end + mov [_anim_pos_plane], 22 + ap_state6_end: + + ret + + + +draw_plane: + + ; + mov eax, 13 + mov ebx,[_last_XY_plane] + and ebx, 0xffff0000 + add ebx, 32 + mov ecx,[_last_XY_plane] + shl ecx, 16 + add ecx, 32 + mov edx, BACK_COLOR + int 0x40 + + ; _anim_pos_plane + mov ebx, [_anim_pos_plane] + shl ebx, 10 + mov eax, ebx + add ebx, eax + add ebx, eax + add ebx, bmp_plane + + ; + mov edx,[_X_plane] + shl edx, 16 + add edx,[_Y_plane] + mov [_last_XY_plane], edx + + ; + mov eax,7 + mov ecx,32*65536+32 + int 0x40 + + ret + + +plane_interaction: + + push eax + push ebx + push ecx + push edx + + mov eax, [_X_plane] + mov ebx, [_Y_plane] + add ebx, 16 + mov ecx, [_VX_plane] + cmp ecx, 0 + jl pi_no_positive_vx + add eax, 32 ; + pi_no_positive_vx: + ; eax ebx X,Y + mov edx, eax + sub eax, CITY_OFFSET + ; + cmp eax, 0 + jl pi_out_of_city + cmp eax, 32*20 + jg pi_out_of_city + ; + add eax, 10 ; X 20 + mov ecx, eax + shr eax, 4 + shr ecx, 6 + sub eax, ecx + shr ecx, 2 + add eax, ecx + shr ecx, 2 + sub eax, ecx + dec eax ; eax + mov esi, eax + shl esi, 1 + add esi, _city ; esi + mov eax, edx + ; Y Y + xor ecx, ecx + mov cx, [esi] + mov edx, ecx + shl ecx, 4 + shl edx, 2 + add ecx, edx + mov edx, WINDOW_HEIGHT - GROUNG_HEIGHT + sub edx, ecx ; edx Y + cmp ebx, edx + jl pi_no_crash + ; + mov [_plane_health], 0 + call bang_add ; + call game_over ; + pi_no_crash: + + pi_out_of_city: + + pop edx + pop ecx + pop ebx + pop eax + + ret + + +; ================================== =========================================== + +bomb_drop: ; " ". , . + ; + mov eax, [_plane_health] + cmp eax, 0 + jle bomb_drop_end + ; ( ) + mov eax, [_plane_state] + cmp eax, 3 + ja bomb_drop_end + ; + mov eax, [_bomb_delay_time] + cmp eax, 0 + jne bomb_drop_end + mov [_bomb_delay_time], BOMB_DELAY + ; , + mov eax, [_bomb_count] + cmp eax, MAX_BOMBS-1 + jae bomb_drop_end + inc eax + mov [_bomb_count], eax + dec eax + shl eax, 4 + add eax, _bomb_array ; + + mov ebx, [_X_plane] + mov [eax], ebx ; X + add eax, 4 + mov ebx, [_Y_plane] + add ebx, 30 + mov [eax], ebx ; Y + + add eax, 4 + mov ebx, [_VX_plane] + cmp ebx, 0 + jge bomb_drop_pos_dir_vx + bomb_drop_neg_dir_vx: + neg ebx + shr ebx, 1 + neg ebx + jmp bomb_drop_dir_vx_end + bomb_drop_pos_dir_vx: + shr ebx, 1 + bomb_drop_dir_vx_end: + mov [eax], ebx ; X + + add eax, 4 + mov ebx, 0 + mov [eax], ebx ; Y + + push ecx + mov ecx, [_bomb_count] + dec ecx + call bombfly_sound_start + pop ecx + + bomb_drop_end: + + ret + + +bomb_proc: + ; + mov eax, [_bomb_delay_time] + cmp eax, 0 + je bomb_proc_delay_timer_end + dec eax + mov [_bomb_delay_time], eax + bomb_proc_delay_timer_end: + ; + mov eax, [_bomb_count] + cmp eax, 0 + je bomb_proc_end + xor ecx, ecx + bomb_proc_loop: ; + cmp ecx, [_bomb_count] + jae bomb_proc_end + mov ebx, ecx + shl ebx, 4 + add ebx, _bomb_array ; + + call bomb_hide ; + + ; + + ; VY + + add ebx, 4*3 + mov eax, [_timer_x2] + cmp eax, 0 + jne bomb_proc_gravity_accel_end + mov eax, [ebx] + add eax, GRAVY_ACCEL + mov [ebx], eax + bomb_proc_gravity_accel_end: + ; X + sub ebx, 4*3 + mov eax, [ebx] + add ebx, 4*2 + mov edx, [ebx] + add eax, edx + sub ebx, 4*2 + mov [ebx], eax + push eax + ; Y + add ebx, 4 + mov eax, [ebx] + add ebx, 4*2 + mov edx, [ebx] + add eax, edx + sub ebx, 4*2 + mov [ebx], eax + push eax + + ; + sub ebx, 4 + pop edx ; Y + pop eax ; X + ; , + cmp eax, 10 + jle bomb_proc_delete_bomb + cmp eax, WINDOW_WIDTH - 36 + jge bomb_proc_delete_bomb + ; + push eax + push ebx + mov ebx, edx + call bomb_check_detonation + cmp eax, 1 + pop ebx + pop eax + je bomb_proc_interaction_with_world + cmp edx, WINDOW_HEIGHT - GROUNG_HEIGHT + jae bomb_proc_interaction_with_world + jmp bomb_proc_interaction_end + bomb_proc_interaction_with_world: + push eax + push ebx + mov ebx, edx + call bang_add + call air_raid_warning_on ; + pop ebx + pop eax + bomb_proc_delete_bomb: + call bomb_delete ; + dec ecx ; .. - + mov eax, [_bomb_count] + dec eax + mov [_bomb_count], eax ; + jmp bomb_proc_draw_end ; + bomb_proc_interaction_end: + call bomb_draw + bomb_proc_draw_end: + + inc ecx + jmp bomb_proc_loop + bomb_proc_end: + + ret + + +bomb_delete: ; , + push eax + push ebx + push ecx + push edx + call bombfly_sound_stop + inc ecx + bomb_delete_loop: + cmp ecx, [_bomb_count] + jae bomb_delete_loop_end + mov ebx, ecx + shl ebx, 4 + add ebx, _bomb_array ; + dec ecx + mov edx, ecx + shl edx, 4 + add edx, _bomb_array ; + inc ecx + ; + mov eax, [ebx] + mov [edx], eax + add ebx,4 + add edx,4 + mov eax, [ebx] + mov [edx], eax + add ebx,4 + add edx,4 + mov eax, [ebx] + mov [edx], eax + add ebx,4 + add edx,4 + mov eax, [ebx] + mov [edx], eax + ; + inc ecx + jmp bomb_delete_loop + bomb_delete_loop_end: + pop edx + pop ecx + pop ebx + pop eax + + ret + +bomb_hide: ; , ebx - + + push eax + push ebx + push ecx + push edx + mov eax, 13 + mov edx, ebx + mov ebx, [edx] + shl ebx, 16 + add ebx, 16 + add edx, 4 + mov ecx, [edx] + shl ecx, 16 + add ecx, 16 + mov edx, BACK_COLOR + int 0x40 + pop edx + pop ecx + pop ebx + pop eax + + ret + + +bomb_draw: ; , ebx - + + push eax + push ebx + push ecx + push edx + + ; edx + mov edx, [ebx] + shl edx, 16 + add ebx, 4 + mov eax, [ebx] + add edx, eax + + ; ebx ( ) + add ebx, 4 + mov eax, [ebx] ; eax - + add ebx, 4 + mov ecx, [ebx] ; ecx - + xor ebx, ebx + cmp ecx, 3 + jl bomb_draw_midspeed_end + inc ebx + bomb_draw_midspeed_end: + cmp ecx, 9 + jl bomb_draw_highspeed_end + inc ebx + bomb_draw_highspeed_end: + cmp eax, 0 + jge bomb_draw_left_dir_end + add ebx, 3 + bomb_draw_left_dir_end: + ; ebx + shl ebx, 8 + mov eax, ebx + add ebx, eax + add ebx, eax + add ebx, bmp_bomb ; ebx + + ; + mov eax,7 + mov ecx,16*65536+16 + int 0x40 + + pop edx + pop ecx + pop ebx + pop eax + + ret + + +; + +bomb_check_detonation: ; : eax - X, eab - Y + ; ( ) + ; eax : 0 - , 1 - + ; ( ) + + push ecx + push edx + + add eax, 8 + add ebx, 8 + + sub eax, CITY_OFFSET + ; + cmp eax, 0 + jl bcd_out_of_city + cmp eax, 32*20 + jg bcd_out_of_city + ; + add eax, 10 ; X 20 + mov ecx, eax + shr eax, 4 + shr ecx, 6 + sub eax, ecx + shr ecx, 2 + add eax, ecx + shr ecx, 2 + sub eax, ecx + dec eax ; eax + mov esi, eax + shl esi, 1 + add esi, _city ; esi + + mov edx, WINDOW_HEIGHT - GROUNG_HEIGHT + sub edx, ebx + mov ebx, edx + cmp ebx, 0 + jg bcd_no_neg_value_Y + xor ecx, ecx + mov cx, [esi] + xor ebx, ebx + jmp bcd_damage ; + bcd_no_neg_value_Y: + add ebx, 10 ; Y 20 + mov ecx, ebx + shr ebx, 4 + shr ecx, 6 + sub ebx, ecx + shr ecx, 2 + add ebx, ecx + shr ecx, 2 + sub ebx, ecx ; ebx " " + + xor ecx, ecx + mov cx, [esi] + cmp ebx, ecx ; + jg bcd_no_detonation + bcd_damage: ; + ; + mov edx, ecx + mov ecx, ebx + sub ecx, 2 + cmp ecx, 0 ; 0, + jge bcd_no_neg_value_H + xor ecx, ecx + bcd_no_neg_value_H: + mov [esi], cx ; + ; + call clear_tiles + ; + call ackack_check_bombing + ; + ; : eax - ( - ) , + ; ebx - , ecx - , edx - , + ; esi - + dec eax + cmp eax, 0 + jl bcd_damage_left_end + sub esi, 2 + xor ecx, ecx + mov cx, [esi] ; ecx + mov edx, ecx + push ecx + sub ecx, ebx + inc ecx + cmp ecx, 2 + pop ecx + ja bcd_damage_left_end ; |ecx-ebx|<=1 + dec ecx + cmp ecx, 0 ; 0, + jge bcd_no_neg_value_HL + xor ecx, ecx + bcd_no_neg_value_HL: + mov [esi], cx + call clear_tiles + ; + call ackack_check_bombing + bcd_damage_left_end: + + ; + ; : eax - , + ; ebx - , ecx - , edx - , + ; esi - + inc eax + inc eax + cmp eax, 32 + jge bcd_damage_right_end + add esi, 4 + xor ecx, ecx + mov cx, [esi] ; ecx + mov edx, ecx + push ecx + sub ecx, ebx + inc ecx + cmp ecx, 2 + pop ecx + ja bcd_damage_right_end ; |ecx-ebx|<=1 + dec ecx + cmp ecx, 0 ; 0, + jge bcd_no_neg_value_HR + xor ecx, ecx + bcd_no_neg_value_HR: + mov [esi], cx + call clear_tiles + ; + call ackack_check_bombing + bcd_damage_right_end: + call check_level_complete + bcd_detonation: + mov eax, 1 + jmp bcd_end + bcd_no_detonation: + mov eax, 0 + jmp bcd_end + bcd_out_of_city: + mov eax, 1 + cmp ebx, WINDOW_HEIGHT - GROUNG_HEIGHT + jge bcd_end + mov eax, 0 + bcd_end: + pop edx + pop ecx + + ret + + +bombfly_sound_start: ; ecx - + + push eax ebx ecx + cmp [_flag_bomberdatabin_ok], 1 + jne @f + stdcall ssmix_playtrack, [_array_sounds+8*((( 1 ))-1)], [_array_sounds+8*((( 1 ))-1)+4], VOLUME_BOMBFLY, VOLUME_BOMBFLY, SSMIX_CHANMODE_SINGLE_WITHOUT_RESET + @@: + mov ebx, ecx + shl ebx, 2 + add ebx, _array_bombsoundchannels + mov [ebx], eax + pop ecx ebx eax + + ret + + +bombfly_sound_stop: ; ecx - + + push eax ebx ecx + mov ebx, ecx + shl ebx, 2 + add ebx, _array_bombsoundchannels + mov eax, [ebx] + cmp [_flag_bomberdatabin_ok], 1 + jne @f + stdcall ssmix_stoptrack, eax + @@: + inc ecx + .delete_loop: + cmp ecx, MAX_BOMBS + jae .delete_loop_end + mov ebx, ecx + shl ebx, 2 + add ebx, _array_bombsoundchannels + mov eax, [ebx] + mov [ebx-4], eax + inc ecx + jmp .delete_loop + .delete_loop_end: + pop ecx ebx eax + + ret + +; ==================================== ======================================= + + +fill_circle: + ; ( ) + ; : + ; eax - X + ; ebx - Y + ; ecx - + ; edx - + mov edi, eax + mov esi, ebx + push edx ; + + mov eax, ecx + shl eax, 1 + mov edx, 3 + sub edx, eax ; D:=3-2*R + xor ebx, ebx ; ebx X, ecx Y, edx D, eax - + + fc_loop: + cmp ebx, ecx + jg fc_loop_end + ; + pop eax ; + push edx ; D + mov edx, eax ; edx - + push ebx + push ecx + ; + mov eax, edi + sub eax, ebx + shl eax, 16 + add ebx, edi + add ebx, eax ; + add ecx, esi + mov eax, ecx + shl eax, 16 + add ecx, eax ; y + mov eax, 38 + int 0x40 + pop ecx + push ecx + ; + mov eax, esi + sub eax, ecx + mov ecx, eax + shl eax, 16 + add ecx, eax ; y + mov eax, 38 + int 0x40 + pop ecx + pop ebx + push ecx + push ebx ; ! ! + ; + mov eax, edi + sub eax, ecx + shl eax, 16 + add ecx, edi + add ecx, eax + mov eax, ebx + mov ebx, ecx ; + mov ecx, eax ; ! ecx - x + add ecx, esi + mov eax, ecx + shl eax, 16 + add ecx, eax ; y + mov eax, 38 + int 0x40 + pop ecx + push ecx + ; + mov eax, esi + sub eax, ecx + mov ecx, eax + shl eax, 16 + add ecx, eax ; y + mov eax, 38 + int 0x40 + pop ebx + pop ecx + + mov eax, edx ; eax - + pop edx ; D + push eax ; + ; + cmp edx, 0 + jge fc_loop_D_more_0 ; D<0 + fc_loop_D_low_0: ; + mov eax, ebx + shl eax, 2 + add edx, eax + add edx, 4 ; D:=D+4*X+6 + jmp fc_loop_cmpD_end + fc_loop_D_more_0: ; + mov eax, ebx + sub eax, ecx + shl eax, 2 + add edx, eax + add edx, 10 ; D:=D+4*(X-Y)+10 + dec ecx + fc_loop_cmpD_end: ; + inc ebx + jmp fc_loop + fc_loop_end: + + pop edx ; + + ret + + + + +bang_add: ; , eax - X, eab - Y + + push eax + push ebx + push ecx + push edx + + shl eax, 16 + add eax, ebx + mov ebx, _bang_array + xor ecx, ecx + bang_add_loop: + cmp ecx, MAX_BOMBS + jae bang_add_loop_end + mov edx, [ebx] + cmp edx, -1 + jne bang_add_loop_freecheck_end + mov edx, 5*65536 + 3 + mov [ebx], edx + add ebx, 4 + mov [ebx], eax + cmp [_flag_bomberdatabin_ok], 1 + jne @f + stdcall ssmix_playtrack, [_array_sounds+8*((( 2 ))-1)], [_array_sounds+8*((( 2 ))-1)+4], VOLUME_BOMBBANG, VOLUME_BOMBBANG, SSMIX_CHANMODE_SINGLE + @@: + jmp bang_add_loop_end + bang_add_loop_freecheck_end: + add ebx, 8 + inc ecx + jmp bang_add_loop + bang_add_loop_end: + + + pop edx + pop ecx + pop ebx + pop eax + + ret + + +bang_proc: + + mov ebx, _bang_array + xor ecx, ecx + bang_proc_loop: + cmp ecx, MAX_BOMBS + jae bang_proc_loop_end + ; + mov edx, [ebx] + cmp edx, -1 + je bang_proc_loop_freecheck_end + ; + and edx, 0x0000FFFF + cmp edx, 0 + jne bang_proc_loop_endcheck_end + ; + push ebx + push ecx + mov ecx, [ebx] + shr ecx, 16 + add ebx, 4 + mov eax, [ebx] + mov ebx, eax + shr eax, 16 + and ebx, 0x0000FFFF + mov edx, BACK_COLOR + call fill_circle + pop ecx + pop ebx + mov eax, -1 + mov [ebx], eax + jmp bang_proc_loop_continue + bang_proc_loop_endcheck_end: + ; + push ebx + push ecx + ; + mov eax, [ebx] + mov edx, eax + shr eax, 16 + mov ecx, eax + and edx, 0x0000FFFF + mov eax, edx + shl eax, 3 + add eax, ecx + shl eax, 16 + dec edx + add eax, edx + mov [ebx], eax + ; + add ebx, 4 + mov eax, [ebx] + mov ebx, eax + shr eax, 16 + and ebx, 0x0000FFFF + ; + mov edx, BANG_COLOR + call fill_circle + pop ecx + pop ebx + bang_proc_loop_freecheck_end: + bang_proc_loop_continue: + add ebx, 8 + inc ecx + jmp bang_proc_loop + bang_proc_loop_end: + + ret + +; ===================================== ========================================= +; , , , + + +ackack_draw: ; + + mov ebx, _ackack + xor ecx, ecx + xor esi, esi ; ( ) + ackack_draw_loop: + cmp ecx, 32 + jae ackack_draw_loop_end + xor eax, eax + mov ax, [ebx] + cmp eax, 1 + jne ackack_draw_continue ; 1 + push ebx + push ecx + ; ebx + mov ebx, ecx + shl ebx, 1 + add ebx, _city ; + xor eax, eax + mov ax, [ebx] ; + cmp eax, 0 + jle ackack_draw_continue2 ; + mov esi, 1 + call ackack_bullet_start + ; + mov ebx, bmp_ackack ; + cmp edx, 0 + je ackack_draw_no_start_bullet + add ebx, 20*20*3 ; + ackack_draw_no_start_bullet: + ; edx + mov edx, ecx + shl edx, 4 + shl ecx, 2 + add edx, ecx + add edx, CITY_OFFSET + shl edx, 16 + mov ecx, eax + shl eax, 4 + shl ecx, 2 + add eax, ecx + mov ecx, WINDOW_HEIGHT-GROUNG_HEIGHT + sub ecx, eax + sub ecx, 20 ; + add edx, ecx ; + mov ecx, 20*0x00010000 + 20 ; + mov eax, 7 + int 0x40 ; + ackack_draw_continue2: + pop ecx + pop ebx + ackack_draw_continue: + add ebx, 2 + inc ecx + jmp ackack_draw_loop + ackack_draw_loop_end: + + cmp esi, 0 + jne @f + ; + call air_raid_warning_off + @@: + + ret + + +ackack_check_bombing: ; : eax - + + push eax + push ebx + push ecx + push edx + ; + mov ebx, eax + shl ebx, 1 + push ebx + add ebx, _ackack + mov edx, ebx ; edx + xor eax, eax + mov ax, [ebx] ; eax + cmp eax, 1 + jne acb_no_bombing ; + xor eax, eax + mov [ebx], ax ; + call ackack_next_wave + acb_no_bombing: + ; + pop ebx + add ebx, _city + xor eax, eax + mov ax, [ebx] ; eax + cmp eax, 0 + jg acb_no_destroy_building ; + xor eax, eax + mov [ebx], ax ; + acb_no_destroy_building: + pop edx + pop ecx + pop ebx + pop eax + + ret + + + +ackack_next_wave: ; + + push eax + push ebx + push ecx + push edx + + anw_begin: + mov ebx, _ackack + xor ecx, ecx + xor edx, edx ; + anw_loop: + cmp ecx, 32 + jae anw_loop_end + xor eax, eax + mov ax, [ebx] + cmp eax, 1 + jle anw_continue ; <=1 + dec eax + mov [ebx], ax + cmp eax, 1 + jg anw_no_active_ackack ; >1 + mov edx, 1 ; + jmp anw_continue + anw_no_active_ackack: + cmp edx, 1 + je anw_continue ; 1 + mov edx, 2 + anw_continue: + add ebx, 2 + inc ecx + jmp anw_loop + anw_loop_end: + cmp edx, 2 + je anw_begin + + pop edx + pop ecx + pop ebx + pop eax + ret + + + + + +ackack_bullet_start: ; (: eax - , ecx - ; + ; : edx - (0-, 1 -) + + push eax + push ebx + push ecx + + cmp [_flag_air_raid_warning], 1 + jne abs_no_start_bullet + + ; ebx + mov edx, eax + mov ebx, ecx + shl ebx, 2 + add ebx, _ackack_bullet ; + mov eax, [ebx] ; + cmp eax, 0 + jne abs_no_start_bullet ; 0, + ; + mov eax, edx ; eax + ; + mov ecx, eax + shl eax, 4 + shl ecx, 2 + add eax, ecx + mov ecx, WINDOW_HEIGHT-GROUNG_HEIGHT + sub ecx, eax + sub ecx, 20+BULLET_SIZE ; + ( ecx - ) + mov [ebx], ecx ; + + cmp [_flag_bomberdatabin_ok], 1 + jne @f + stdcall ssmix_playtrack, [_array_sounds+8*((( 3 ))-1)], [_array_sounds+8*((( 3 ))-1)+4], VOLUME_ACKACK,VOLUME_ACKACK , SSMIX_CHANMODE_SINGLE + @@: + + mov edx, 1 + jmp abs_end_start_bullet + abs_no_start_bullet: + mov edx, 0 + abs_end_start_bullet: + + pop ecx + pop ebx + pop eax + + ret + + +ackack_bullet_proc: ; + + mov ebx, _ackack_bullet + xor ecx, ecx + abp_loop: + cmp ecx, 32 + jae abp_loop_end + mov eax, [ebx] + cmp eax, 0 + je abp_continue + jl abp_low_zero + push ebx + push ecx + ; + mov ebx, ecx + shl ebx, 4 + shl ecx, 2 + add ebx, ecx + add ebx, CITY_OFFSET + add ebx, 7 ; + mov edx, ebx + shl ebx, 16 + add ebx, edx ; ebx X + mov ecx, eax + mov edx, ecx + add edx, BULLET_SIZE ; + shl ecx, 16 + add ecx, edx ; ebx Y + mov edx, BACK_COLOR + mov eax, 38 + int 0x40 + add ebx, 0x00050005 + int 0x40 + + pop ecx + pop ebx + push ebx + push ecx + + mov eax, [ebx] + sub eax, ACKACK_BULLET_SPEED + mov [ebx], eax + cmp eax, 0 + jle abp_end_draw_bullet + + call ackack_bullet_interaction_check + cmp edx, 0 + je abp_no_bullet_interaction ; + xor eax, eax + mov [ebx], eax + jmp abp_end_draw_bullet + abp_no_bullet_interaction: + + ; + mov ebx, ecx + shl ebx, 4 + shl ecx, 2 + add ebx, ecx + add ebx, CITY_OFFSET + add ebx, 7 ; + mov edx, ebx + shl ebx, 16 + add ebx, edx ; ebx X + mov ecx, eax + mov edx, ecx + add edx, BULLET_SIZE ; + shl ecx, 16 + add ecx, edx ; ebx Y + mov edx, 0x00000000 + mov eax, 38 + int 0x40 + add ebx, 0x00050005 + int 0x40 + abp_end_draw_bullet: + + pop ecx + pop ebx + jmp abp_continue + abp_low_zero: + xor eax, eax + mov [ebx], eax + abp_continue: + add ebx, 4 + inc ecx + jmp abp_loop + abp_loop_end: + + ret + + +ackack_bullet_interaction_check: ; + ; (: eax - Y, ecx - ; + ; : edx - (0-, 1 -)) + + + push eax + push ebx + push ecx + + ; + mov ebx, [_plane_health] + cmp ebx, 0 + jle abic_with_plane_no + mov ebx, [_plane_state] + cmp ebx, 4 + je abic_with_plane_no + cmp ebx, 5 + je abic_with_plane_no + ; + mov ebx, [_Y_plane] + cmp eax, ebx + jl abic_with_plane_no ; + add ebx, 20 ; ebx - + cmp eax, ebx + jg abic_with_plane_no ; + ; X + mov edx, ecx + shl edx, 4 + shl ecx, 2 + add ecx, edx + add ecx, CITY_OFFSET + add ecx, 7 ; ecx - X + mov ebx, [_X_plane] + add ebx, 32 + cmp ecx, ebx + jg abic_with_plane_no + mov ebx, [_X_plane] + add ecx, 5 + cmp ecx, ebx + jl abic_with_plane_no + ; !!! + mov ebx, [_plane_health] + sub ebx, 20 + mov [_plane_health], ebx + cmp ebx, 0 ; game over + jg abic_no_plane_crash + mov [_plane_health], 0 + mov eax, [_X_plane] + mov ebx, [_Y_plane] + call bang_add ; + call game_over ; + abic_no_plane_crash: + mov edx, 1 + jmp abic_with_plane_end + abic_with_plane_no: + mov edx, 0 + abic_with_plane_end: + + pop ecx + pop ebx + pop eax + ret + +; ===================================== ========================================= + +ground_draw: + + mov eax, 13 + mov ebx, 0*0x00010000 + (WINDOW_WIDTH-10) + mov ecx, (WINDOW_HEIGHT-GROUNG_HEIGHT)*0x00010000 + (GROUNG_HEIGHT-5-20) + mov edx, GROUND_COLOR + int 0x40 + + mov eax, 38 + mov ebx, 0*0x00010000 + (WINDOW_WIDTH-10) + mov ecx, (WINDOW_HEIGHT-GROUNG_HEIGHT)*0x00010000 + (WINDOW_HEIGHT-GROUNG_HEIGHT) + mov edx, 0x000000 + int 0x40 + + ret + + +city_draw: ; + + mov ebx, _city + xor edx, edx + city_draw_loop: + cmp edx, 32 + jae city_draw_loop_end + xor eax, eax + mov ax, [ebx] + push ebx + push edx + mov ebx, bmp_tile + city_draw_loop2: + cmp eax, 0 + jle city_draw_loop2_end + push eax + push edx + ; edx + mov ecx, edx + shl edx, 4 + shl ecx, 2 + add edx, ecx + add edx, CITY_OFFSET + shl edx, 16 + mov ecx, eax + shl eax, 4 + shl ecx, 2 + add eax, ecx + mov ecx, WINDOW_HEIGHT-GROUNG_HEIGHT + sub ecx, eax + add edx, ecx ; + mov ecx, 20*0x00010000 + 20 ; + mov eax, 7 + int 0x40 ; + pop edx + pop eax + dec eax + jmp city_draw_loop2 + city_draw_loop2_end: + + pop edx + pop ebx + add ebx, 2 + inc edx + jmp city_draw_loop + city_draw_loop_end: + + ret + + +clear_tiles: ; : eax - , ecx - , edx - + + push eax + push ebx + push ecx + push edx + ; X + mov ebx, eax + shl eax, 4 + shl ebx, 2 + add eax, ebx + add eax, CITY_OFFSET + ; Y1 + mov ebx, ecx + shl ecx, 4 + shl ebx, 2 + add ecx, ebx + mov ebx, WINDOW_HEIGHT-GROUNG_HEIGHT + sub ebx, ecx + mov ecx, ebx + add ecx, 20 + ; Y2 + mov ebx, edx + shl edx, 4 + shl ebx, 2 + add edx, ebx + mov ebx, WINDOW_HEIGHT-GROUNG_HEIGHT + sub ebx, edx + mov edx, ebx + sub edx, 20 ; , + ; Y=Y2 H=Y1-Y2 + sub ecx, edx + shl edx, 16 + add ecx, edx + ; X 20 + shl eax, 16 + add eax, 20 + mov ebx, eax + ; + mov eax, 13 + mov edx, BACK_COLOR + int 0x40 + + pop edx + pop ecx + pop ebx + pop eax + + ret + + +load_level: ; , eax + + mov eax, [_level_num] + dec eax + shl eax, 7 ; (128 ) + mov ebx, levels + add ebx, eax ; ebx + mov edx, cur_level + mov ecx, 0 + load_level_loop: + cmp ecx, 128/4 + jae load_level_loop_end + mov eax, [ebx] + mov [edx], eax + add ebx, 4 + add edx, 4 + inc ecx + jmp load_level_loop + load_level_loop_end: + + load_level_end: + + ret + +; =================================== ======================================== + +timer_x4: + mov eax, [_timer_x4] + inc eax + mov [_timer_x4],eax + cmp eax, 4 + ja timer_x4_do + jmp timer_x4_end + timer_x4_do: + mov [_timer_x4],0 + timer_x4_end: + ret + + +timer_x2: + mov eax, [_timer_x2] + inc eax + mov [_timer_x2],eax + cmp eax, 2 + ja timer_x2_do + jmp timer_x2_end + timer_x2_do: + mov [_timer_x2],0 + timer_x2_end: + ret + +draw_window: ; + + mov eax,12 + mov ebx,1 + int 0x40 + + mov eax,0 + mov ebx,100*65536+WINDOW_WIDTH + mov ecx,100*65536+WINDOW_HEIGHT + mov edx,0x34000000+BACK_COLOR + mov edi,_window_caption + int 0x40 + + mov eax,12 + mov ebx,2 + int 0x40 + + ret + + + +draw_intro: + + ; + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-80)*65536 + 60 + mov ecx,0x80000000 + mov edx,_text_intro_title + int 0x40 + + ; + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-200)*65536 + 120 + mov ecx,0x80000000 + mov edx,_text_intro_description1 + int 0x40 + + + ; + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-60)*65536 + 200 + mov ecx,0x80000000 + mov edx,_text_intro_key_controls + int 0x40 + + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-70)*65536 + 230 + mov ecx,0x80000000 + mov edx,_text_intro_key_ctrl + int 0x40 + + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-70)*65536 + 245 + mov ecx,0x80000000 + mov edx,_text_intro_key_space + int 0x40 + + ; + + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-175)*65536 + 300 + mov ecx,0x80000000 + mov edx,_text_intro_select_level + int 0x40 + + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-25)*65536 + 320 + mov ecx,0x80000000 + mov edx,_text_intro_level_num + int 0x40 + + call draw_level_num + + ; + + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-175)*65536 + 350 + mov ecx,0x80000000 + mov edx,_text_intro_set_volume + int 0x40 + + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-25)*65536 + 370 + mov ecx,0x80000000 + mov edx,_text_intro_volume_num + int 0x40 + call draw_volume_num + + ; + + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-80)*65536 + 400 + mov ecx,0x80FF0000 + mov edx,_text_intro_start_space + int 0x40 + + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-30)*65536 + 460 + mov ecx,0x80000000 + mov edx,_text_intro_exit_key + int 0x40 + + + ret + + +draw_level_num: + + mov eax, 13 + mov ebx, (WINDOW_WIDTH/2+25)*0x00010000 + 30 + mov ecx, 320*0x00010000 + 15 + mov edx, BACK_COLOR + int 0x40 + + mov eax, 47 + mov ebx, 0x80020000 + mov ecx, [_level_num] + mov edx, (WINDOW_WIDTH/2+25)*65536 + 320 + mov esi,0x00000000 + int 0x40 + + ret + +draw_volume_num: + + mov eax, 13 + mov ebx, (WINDOW_WIDTH/2+35)*0x00010000 + 30 + mov ecx, 370*0x00010000 + 15 + mov edx, BACK_COLOR + int 0x40 + + mov eax, 47 + mov ebx, 0x80020000 + mov ecx, [_set_volume] + mov edx, (WINDOW_WIDTH/2+35)*65536 + 370 + mov esi,0x00000000 + int 0x40 + + ret + +;--------------------------------------------------------------------------- +;-------------------------------- ----------------------------------- +;--------------------------------------------------------------------------- + +_game_state dd ? +_delay dd 6 +_timer_x2 dd ? +_timer_x4 dd ? +_game_over_time dd ? +_flag_air_raid_warning dd ? +_flag_bomberdatabin_ok dd ? +_last_value_timecount dd ? + +_X_plane dd ? +_Y_plane dd ? +_last_XY_plane dd ? +_VX_plane dd ? +_addit_VY_plane dd ? +_plane_state dd ? ; 0 - , 1- , 2- -, 3- -, 4 - , 5 - +_plane_state_step dd ? ; ( ) +_plane_health dd ? ; + +_bomb_count dd ? +_bomb_array rd 4*MAX_BOMBS +_bomb_delay_time dd ? ; + +_bang_array rd 2*MAX_BOMBS + +_anim_pos_plane dd ? +; +_anim_array_uturn_rl dd 0,1,2,3,4,5,6,7,8 +_anim_array_uturn_lr dd 8,7,6,9,10,11,2,1,0 +_anim_array_barrel_r dd 0,1,2,12,13,14,15,16,0 +_anim_array_barrel_l dd 8,17,18,19,20,21,6,7,8 + + +cur_level: +; , . +_city rw 32 +; , . +_ackack rw 32 +; , +_ackack_bullet rd 32 + +; +_level_num dd 1 +; : 32 ( " ") _level?_city +; _level?_ackack +levels: +_level1_city dw 0, 0, 0, 6, 5, 6, 5, 6, 3, 3, 3, 3, 3, 6, 7, 8, 8, 7, 6, 3, 3, 3, 3, 3, 6, 5, 6, 5, 6, 0, 0, 0 +_level1_ackack dw 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + +_level2_city dw 0, 0, 0, 5, 5, 2, 5, 7, 7, 2, 7, 9, 9, 9, 2, 9, 9, 2, 9, 9, 9, 7, 2, 7, 7, 5, 2, 5, 5, 0, 0, 0 +_level2_ackack dw 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 5, 0, 0, 6, 0, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 0, 0 + +_level3_city dw 0, 0, 0,12,12,12, 9, 9, 9,12,12,12, 9, 7, 5, 3, 3, 5, 7, 9,12,12,12, 9, 9, 9,12,12,12, 0, 0, 0 +_level3_ackack dw 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 4, 0, 3, 0, 2, 1, 1, 2, 0, 3, 0, 5, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0 + +_level4_city dw 0, 0, 0,12,12,12, 3,12,12,12, 3, 1, 1, 6,12,18, 18,12, 6, 1, 1, 3,12,12,12, 3,12,12,12, 0, 0, 0 +_level4_ackack dw 0, 0, 0, 0, 5, 0, 1, 0, 0, 0, 1, 0, 3, 0, 0, 2, 6, 0, 0, 3, 0, 1, 0, 4, 0, 1, 0, 0, 0, 0, 0, 0 + +_level5_city dw 0, 5,10,10,10,10,15,15,15,15,17,17,17,17, 1,15, 15, 1,17,17,17,17,15,15,15,15,10,10,10,10, 5, 0 +_level5_ackack dw 0, 8, 0, 9, 9, 0, 3, 3, 3, 3, 0, 0, 0, 0, 5, 1, 2, 5, 0, 0, 0, 0, 4, 4, 4, 4, 0,10,10, 0, 7, 0 + +; +_count_sounds dd ? +_array_sounds rd 2*MAX_SOUNDS + +_channel_sound_plane dd ? ; +_channel_sound_arw dd ? ; +_array_bombsoundchannels rd MAX_BOMBS ; + +_set_volume dd 8 ; 0..8 + +; + +_s_current_dir rb 4096 ; + +file_info: ; + _fi_func dd ? + _fi_pos dd ? + dd 0 + _fi_size dd ? + _fi_pbuff dd ? + db 0 + _fi_pfilename dd ? + +if lang eq ru_RU + include 'lang-ru_RU.inc' ; Encoded as CP866 +else ; Default to en_US + include 'lang-en_US.inc' +end if + +bmp_plane: +file "plane.bmp":54 + +bmp_bomb: +file "bomb.bmp":54 + +bmp_tile: +file "tile.bmp":54 + +bmp_ackack: +file "ackack.bmp":54 + + +align 16 +rb 0x100 ; . + +i_end: + diff --git a/programs/games/bomber/englang.inc b/programs/games/bomber/lang-en_US.inc similarity index 75% rename from programs/games/bomber/englang.inc rename to programs/games/bomber/lang-en_US.inc index 3919587510..16e176e921 100644 --- a/programs/games/bomber/englang.inc +++ b/programs/games/bomber/lang-en_US.inc @@ -1,17 +1,17 @@ -_window_caption db 'Soft landing',0 ; - -_text_game_over db 'G A M E O V E R', 0 -_text_level_complete db 'L E V E L C O M P L E T E', 0 -_text_intro_title db ' S O F T L A N D I N G', 0 -_text_intro_description1 db 'Provide a soft landing, clearing the runway from the city buildings', 0 - -_text_intro_key_controls db ' Control keys:', 0 -_text_intro_key_ctrl db ' CTRL - drop a bomb', 0 -_text_intro_key_space db 'SPACE - do a barrel roll', 0 -_text_intro_select_level db ' Use UP and DOWN arrow keys for select game level:', 0 -_text_intro_level_num db ' LEVEL', 0 -_text_intro_set_volume db ' Use LEFT and RIGHT arrow keys for setting volume:', 0 -_text_intro_volume_num db 'VOLUME', 0 - -_text_intro_start_space db 'Press SPACE for start game', 0 -_text_intro_exit_key db 'Esc - exit', 0 \ No newline at end of file +_window_caption db 'Soft landing',0 ; Application title + +_text_game_over db 'G A M E O V E R', 0 +_text_level_complete db 'L E V E L C O M P L E T E', 0 +_text_intro_title db ' S O F T L A N D I N G', 0 +_text_intro_description1 db 'Provide a soft landing, clearing the runway from the city buildings', 0 + +_text_intro_key_controls db ' Control keys:', 0 +_text_intro_key_ctrl db ' CTRL - drop a bomb', 0 +_text_intro_key_space db 'SPACE - do a barrel roll', 0 +_text_intro_select_level db ' Use UP and DOWN arrow keys to select the game level:', 0 +_text_intro_level_num db ' LEVEL', 0 +_text_intro_set_volume db ' Use LEFT and RIGHT arrow keys for setting volume:', 0 +_text_intro_volume_num db 'VOLUME', 0 + +_text_intro_start_space db 'Press SPACE for start game', 0 +_text_intro_exit_key db 'Esc - exit', 0 diff --git a/programs/games/bomber/ruslang.inc b/programs/games/bomber/lang-ru_RU.inc similarity index 100% rename from programs/games/bomber/ruslang.inc rename to programs/games/bomber/lang-ru_RU.inc