From a7e652271e257e9bff4b40bef849a7c63a3bbbb9 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sat, 15 Dec 2012 14:11:03 +0000 Subject: [PATCH] Eolite 1.45: crash fixed, remove malloc/free every time as user open file, make some global labels local git-svn-id: svn://kolibrios.org@3113 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/fs/Eolite/trunk/Eolite.c-- | 8 ++--- .../fs/Eolite/trunk/include/about_dialog.h | 6 ++-- programs/fs/Eolite/trunk/include/ini.h | 18 ++++++---- programs/fs/Eolite/trunk/lib/kolibri.h | 36 +++++++++++++------ programs/fs/Eolite/trunk/lib/strings.h | 21 ++++++----- 5 files changed, 53 insertions(+), 36 deletions(-) diff --git a/programs/fs/Eolite/trunk/Eolite.c-- b/programs/fs/Eolite/trunk/Eolite.c-- index ba3120c57d..2dc46e12dc 100644 --- a/programs/fs/Eolite/trunk/Eolite.c-- +++ b/programs/fs/Eolite/trunk/Eolite.c-- @@ -20,7 +20,7 @@ int BUTTON_HEIGHT=18; #define ONLY_OPEN 2 //переменные -#define title "Eolite File Manager v1.43" +#define title "Eolite File Manager v1.45" dword selection_col = 0x94AECE; dword lpanel_col = 0x00699C; @@ -56,8 +56,8 @@ int scroll_size; -int toolbar_buttons_x[6]={9,46,85,134,167,203}; -char tmp_disk_del_param[]="d0"; +int toolbar_buttons_x[7]={9,46,85,134,167,203}; +char tmp_disk_del_param[3]="d0\0"; dword file_mas[6898]; int j, i, mouse_dd; @@ -111,7 +111,7 @@ void main() IF (del_active) break; id=GetSlot(Form.ID); - IF (id<>ActiveProcess()) break; //если окно не активно на события мыши не реагируем + IF (id<>GetActiveProcess()) break; //если окно не активно на события мыши не реагируем IF (!rename_active) edit_box_mouse stdcall(#edit1); ELSE edit_box_mouse stdcall(#edit2); diff --git a/programs/fs/Eolite/trunk/include/about_dialog.h b/programs/fs/Eolite/trunk/include/about_dialog.h index bd0565dd29..8f259ca042 100644 --- a/programs/fs/Eolite/trunk/include/about_dialog.h +++ b/programs/fs/Eolite/trunk/include/about_dialog.h @@ -38,9 +38,9 @@ void about_dialog() DefineAndDrawWindow(600,150,181,256,0x34,0x10EFEBEF,"About Eolite"); DrawBar(0,0,172,50,0x8494C4); //голубое сзади PutPaletteImage(#logo,85,85,43,7,#logo_pal); - WriteText(46,100,0x90,0xBF40BF,"Eolite v1.43",0); - $add ebx, 1<<16 - $int 0x40 + WriteText(46,100,0x90,0xBF40BF,"Eolite v1.45",0); + $add ebx, 1<<16 + $int 0x40 WriteText(55,120,0x80,0,"Developers:",0); WriteText(39,130,0x80,0,"Leency & Veliant",0); WriteText(45,140,0x80,0,"KolibriOS Team",0); diff --git a/programs/fs/Eolite/trunk/include/ini.h b/programs/fs/Eolite/trunk/include/ini.h index f34e0d7c86..20ac38f851 100644 --- a/programs/fs/Eolite/trunk/include/ini.h +++ b/programs/fs/Eolite/trunk/include/ini.h @@ -29,16 +29,20 @@ unsigned char *ERROR_TEXT[]={ void GetIni(byte onload) { byte section[32]='', parametr[32]='', option[256]='', InfType=0; - word bukva[1]; + char bukva[2]; int errornum; - dword buff, fsize, tj; + dword fsize, tj; + static dword buff; //читаем файл - free(buff); - buff = malloc(12000); - IF (onload==1) copystr(".ini", #program_path+strlen(#program_path)); + IF (onload==1) + { + free(buff); + buff = malloc(12000); + copystr(".ini", #program_path+strlen(#program_path)); + } + ReadFile(0, 12000, buff, #program_path); - IF (EAX<>6) //если файла с настройками нет в папке с программой смотрим в папке по-умолчанию - ReadFile(0, 12000, buff, "/sys/File managers/Eolite.ini"); + IF (EAX<>6) ReadFile(0, 12000, buff, "/sys/File managers/Eolite.ini"); IF (EAX<>6) //если файла с настройками тупо нет печалька { IF (onload==1) notify("Eolite.ini not found. Defaults will be used."); diff --git a/programs/fs/Eolite/trunk/lib/kolibri.h b/programs/fs/Eolite/trunk/lib/kolibri.h index afc5a99ed7..133c8886c4 100644 --- a/programs/fs/Eolite/trunk/lib/kolibri.h +++ b/programs/fs/Eolite/trunk/lib/kolibri.h @@ -107,13 +107,20 @@ inline fastcall int GetSlot( ECX) $int 0x40 } -inline fastcall int ActiveProcess() +inline fastcall int GetActiveProcess() { $mov eax,18; $mov ebx,7; $int 0x40 } +inline fastcall void ActivateWindow( ECX) +{ + EAX = 18; + EBX = 3; + $int 0x40 +} + //------------------------------------------------------------------------------- inline fastcall dword WaitEvent(){ @@ -129,17 +136,17 @@ inline fastcall void SetEventMask( EBX) inline fastcall word GetKey(){ //+Gluk fix $push edx -@getkey: +GETKEY: $mov eax,2 $int 0x40 $cmp eax,1 - $jne getkeyi + $jne GETKEYI $mov ah,dh - $jmp getkeyii //jz? -@getkeyi: + $jmp GETKEYII //jz? +GETKEYI: $mov dh,ah - $jmp getkey -@getkeyii: + $jmp GETKEY +GETKEYII: $pop edx EAX = EAX >> 8; } @@ -207,6 +214,13 @@ inline fastcall dword GetScreenHeight() $and eax,0x0000FFFF } +inline fastcall dword GetScreenWidth() +{ + $mov eax, 14 + $int 0x40 + $shr eax, 16 +} + inline fastcall void MoveSize( EBX,ECX,EDX,ESI){ $mov eax,67; $int 0x40 @@ -294,14 +308,14 @@ inline fastcall void debug( EDX) { $mov eax, 63 $mov ebx, 1 -next_char: +NEXT_CHAR: $mov ecx, DSDWORD[edx] $or cl, cl - $jz done + $jz DONE $int 0x40 $inc edx - $jmp next_char -done: + $jmp NEXT_CHAR +DONE: $mov cl, 13 $int 0x40 $mov cl, 10 diff --git a/programs/fs/Eolite/trunk/lib/strings.h b/programs/fs/Eolite/trunk/lib/strings.h index e1e70142b5..d713d692dc 100644 --- a/programs/fs/Eolite/trunk/lib/strings.h +++ b/programs/fs/Eolite/trunk/lib/strings.h @@ -17,11 +17,11 @@ inline fastcall dword strlen( EDI) inline fastcall copystr( ESI,EDI) { $cld -l1: +L1: $lodsb $stosb $test al,al - $jnz l1 + $jnz L1 } char buffer[11]; @@ -30,26 +30,25 @@ inline fastcall dword IntToStr( ESI) $mov edi, #buffer $mov ecx, 10 $test esi, esi - $jns f1 + $jns F1 $mov al, '-' $stosb $neg esi -f1: +F1: $mov eax, esi $push -'0' -f2: +F2: $xor edx, edx $div ecx $push edx $test eax, eax - $jnz f2 -f3: + $jnz F2 +F3: $pop eax $add al, '0' $stosb - $jnz f3 + $jnz F3 $mov eax, #buffer - //$ret } inline fastcall dword StrToInt() @@ -128,11 +127,11 @@ inline fastcall TitleCase( EDX) inline fastcall strcpy( EDI, ESI) { $cld -l2: +L2: $lodsb $stosb $test al,al - $jnz l2 + $jnz L2 }