diff --git a/programs/fs/Eolite/trunk/Eolite.c-- b/programs/fs/Eolite/trunk/Eolite.c-- index 0fc916c970..6a41546592 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.35" +#define title "Eolite File Manager v1.36" dword selection_col = 0x94AECE; dword lpanel_col = 0x00699C; @@ -224,8 +224,9 @@ void main() IF (show_actions==1) show_actions=0; ELSE show_actions=1; Actions(); break; - case 78: - IF (show_dev_name==1) show_dev_name=0; ELSE show_dev_name=1; + case 78: //rescan devices + Tip(56, "Devices", 78, "-"); + Pause(10); GetSystemDiscs(); Open_Dir(#path,WITH_REDRAW); DrawSystemDiscs(); @@ -522,39 +523,6 @@ void List_ReDraw() TVScroll(); } -/*#include "def_file.txt" -#define CELL_SIZE 58 -void List_ReDraw() -{ - int i, - po_gor, po_ver, - on_xx, name_len; - po_gor=onLeft(22,197)/CELL_SIZE; - po_ver=onTop(57,6)/CELL_SIZE; - for (j=0; j=count) - { - DrawBar(i*CELL_SIZE+192,j*CELL_SIZE+57,CELL_SIZE,CELL_SIZE,0xFFFFFF); - continue; - } - DefineButton(i*CELL_SIZE+192,j*CELL_SIZE+57,CELL_SIZE,CELL_SIZE,j*po_gor+i+201+BT_HIDE,0xFFFFFF); - DrawBar(i*CELL_SIZE+192,j*CELL_SIZE+57,CELL_SIZE,CELL_SIZE,0xFFFFFF); - - off=file_mas[j*po_gor+i+za_kadrom]*304 + buf+72; - name_len=strlen(off); - if (name_len>9) name_len=9; - on_xx=-name_len*3+29; - WriteText(i*CELL_SIZE+193+on_xx,j*CELL_SIZE+57+CELL_SIZE-16,0,0,off,name_len); - if (!TestBit(ESDWORD[off-40], 4)) - PutImage(#file32,32,32,i*CELL_SIZE+197+9,j*CELL_SIZE+57+5); - else - PutImage(#folder32,32,32,i*CELL_SIZE+197+9,j*CELL_SIZE+57+5); - - } - TVScroll(); -}*/ - void Line_ReDraw(dword color, filenum){ dword text_col=0, name_len, diff --git a/programs/fs/Eolite/trunk/History.txt b/programs/fs/Eolite/trunk/History.txt index 88e33f4ec4..3c02d168bd 100644 --- a/programs/fs/Eolite/trunk/History.txt +++ b/programs/fs/Eolite/trunk/History.txt @@ -1,3 +1,10 @@ +15.11.12 -- v1.36 +- устранена утечка памяти при сканировании устройств; +- частично устранён вылет программы на больших папках (спасибо SoUrcerer за + то, что научил пользоваться отладчиком); +- ограничение на количесво устройств изменено с 10 на 20; +- обновление кода. + 12.11.12 -- v1.35 - теперь окно не обрабатывает клавиши если свёрнуто в заголовок; - фикс для строки адреса; diff --git a/programs/fs/Eolite/trunk/compile.bat b/programs/fs/Eolite/trunk/compile.bat index 73249edeed..a33983e0ef 100644 --- a/programs/fs/Eolite/trunk/compile.bat +++ b/programs/fs/Eolite/trunk/compile.bat @@ -1,5 +1,5 @@ del Eolite -@..\C--\c-- Eolite.c-- +@..\C--\c-- Eolite.c-- /lst rename Eolite.com Eolite rem ..\C--\kpack Eolite del warning.txt diff --git a/programs/fs/Eolite/trunk/include/about_dialog.h b/programs/fs/Eolite/trunk/include/about_dialog.h index 123ac67c65..2e66af4eca 100644 --- a/programs/fs/Eolite/trunk/include/about_dialog.h +++ b/programs/fs/Eolite/trunk/include/about_dialog.h @@ -39,7 +39,7 @@ 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.34",0); + WriteText(46,100,0x90,0xBF40BF,"Eolite v1.36",0); $add ebx, 1<<16 $int 0x40 WriteText(55,120,0x80,0,"Developers:",0); diff --git a/programs/fs/Eolite/trunk/include/devices.h b/programs/fs/Eolite/trunk/include/devices.h index 42d1c0141c..730ba3e75e 100644 --- a/programs/fs/Eolite/trunk/include/devices.h +++ b/programs/fs/Eolite/trunk/include/devices.h @@ -2,17 +2,17 @@ path_string disk_list[20]; int disc_num; +dword devbuf; void GetSystemDiscs() { - char dev_name[10], sys_discs[10]; - int i1, j1, dev_num, dev_disc_num; - dword devbuf; - - disc_num=0; + unsigned char dev_name[10], sys_discs[10]; + unsigned int i1, j1, dev_num, dev_disc_num; + disc_num=0; + if (devbuf) free(devbuf); devbuf= malloc(3112); //буфер где-то на 10 девайсов в левой панели - ReadDir(10, devbuf, "/"); + ReadDir(19, devbuf, "/"); dev_num = EBX; for (i1=0; i16) //если файла с настройками тупо нет печалька { - IF (onload==1) RunProgram(#NOTIFY_PATH, "Eolite.ini not found. Defaults will be used."); + IF (onload==1) RunProgram(NOTIFY_PATH, "Eolite.ini not found. Defaults will be used."); IF (onload==0) goto RUN_AS_PROGRAM; } fsize=EBX; @@ -120,7 +120,7 @@ void Write_Error(int error_number) } if (curbtn>=0) Line_ReDraw(0xFF0000, curbtn); Pause(5); - RunProgram(#NOTIFY_PATH, #error); + RunProgram(NOTIFY_PATH, #error); //DrawBar(192,onTop(0, BUTTON_HEIGHT+7),onLeft(27,192),BUTTON_HEIGHT,0xFF0000); //WriteText(205,onTop(-5, BUTTON_HEIGHT+7),0x80,0xFFFFFF,#error,0); } \ No newline at end of file diff --git a/programs/fs/Eolite/trunk/include/some_code.h b/programs/fs/Eolite/trunk/include/some_code.h index 3a7d177c46..6126ceddc4 100644 --- a/programs/fs/Eolite/trunk/include/some_code.h +++ b/programs/fs/Eolite/trunk/include/some_code.h @@ -14,24 +14,24 @@ void ShowMessage(dword message) dword ConvertSize(dword bytes) { - byte size_prefix[8], temp[3]; - IF (bytes>=1073741824) copystr(" Gb",#temp); - ELSE IF (bytes>=1048576) copystr(" Mb",#temp); - ELSE IF (bytes>=1024) copystr(" Kb",#temp); - ELSE copystr(" b ",#temp); - WHILE (bytes>1023) bytes/=1024; + unsigned char size_prefix[8], size_nm[4]; + if (bytes>=1073741824) copystr(" Gb",#size_nm); + else if (bytes>=1048576) copystr(" Mb",#size_nm); + else if (bytes>=1024) copystr(" Kb",#size_nm); + else copystr(" b ",#size_nm); + while (bytes>1023) bytes/=1024; copystr(IntToStr(bytes),#size_prefix); - copystr(#temp,#size_prefix+strlen(#size_prefix)); - EAX=#size_prefix; + copystr(#size_nm,#size_prefix+strlen(#size_prefix)); + return #size_prefix; } inline fastcall void TVScroll() { //Прокрутка dword on_y; - IF (count<=0) {DrawFlatButton(onLeft(27,0),57,16,onTop(22,58),0,0xE4DFE1,""); return;} + if (count<=0) {DrawFlatButton(onLeft(27,0),57,16,onTop(22,58),0,0xE4DFE1,""); return;} on_y = za_kadrom * onTop(22,57) / count +57; scroll_size=onTop(22,57) * but_num - but_num / count; - IF (scroll_size<20) scroll_size = 20; //устанавливаем минимальный размер скролла - IF (scroll_size>onTop(22,57)-on_y+56) || (za_kadrom+but_num>=count) on_y=onTop(23+scroll_size,0); //для большого списка + if (scroll_size<20) scroll_size = 20; //устанавливаем минимальный размер скролла + if (scroll_size>onTop(22,57)-on_y+56) || (za_kadrom+but_num>=count) on_y=onTop(23+scroll_size,0); //для большого списка DrawFlatButton(onLeft(27,0),on_y,16,scroll_size,0,0xE4DFE1,"");//ползунок DrawBar(onLeft(26,0),57,15,on_y-57,0xCED0D0);//поле до ползунка DrawBar(onLeft(26,0),on_y+scroll_size+1,15,onTop(22,57)-scroll_size-on_y+56,0xCED0D0); //поле после ползунка diff --git a/programs/fs/Eolite/trunk/include/sorting.h b/programs/fs/Eolite/trunk/include/sorting.h index 3454664c39..de80c68708 100644 --- a/programs/fs/Eolite/trunk/include/sorting.h +++ b/programs/fs/Eolite/trunk/include/sorting.h @@ -2,53 +2,52 @@ void Sort_by_Size(int a, b) // для первого вызова: a = 0, b = <элементов в массиве> - 1 { - int i = a; + int iss = a; IF (a >= b) return; FOR (j = a; j <= b; j++) - IF (ESDWORD[file_mas[j]*304 + buf+64] <= ESDWORD[file_mas[b]*304 + buf+64]) - { file_mas[i] >< file_mas[j]; i++;} - Sort_by_Size (a, i-2); - Sort_by_Size (i, b); + IF (ESDWORD[file_mas[j]*304 + buf+64] <= ESDWORD[file_mas[b]*304 + buf+64]) { file_mas[iss] >< file_mas[j]; iss++;} + Sort_by_Size (a, iss-2); + Sort_by_Size (iss, b); } void Sort_by_Name(int a, b) // для первого вызова: a = 0, b = <элементов в массиве> - 1 { - int i = a; + int isn = a; IF (a >= b) return; FOR (j = a; j <= b; j++) - IF (strcmp(file_mas[j]*304 + buf+72, file_mas[b]*304 + buf+72)<=0) { file_mas[i] >< file_mas[j]; i++;} - Sort_by_Name(a, i-2); - Sort_by_Name(i, b); + IF (strcmp(file_mas[j]*304 + buf+72, file_mas[b]*304 + buf+72)<=0) { file_mas[isn] >< file_mas[j]; isn++;} + Sort_by_Name(a, isn-2); + Sort_by_Name(isn, b); } void Sort_by_Type(int a, b) // для первого вызова: a = 0, b = <элементов в массиве> - 1 { - int i=a; + int jst, ist=a; int n; - dword offset=buf+72; - byte filename1[256], filename2[256]; + unsigned char filename1[256], filename2[256]; + unsigned char ext1[256], ext2[256]; IF (a >= b) return; - for (j = a; j <= b; j++) + for (jst = a; jst <= b; jst++) { - // - copystr(file_mas[j]*304 + offset, #filename1); - copystr(file_mas[b]*304 + offset, #filename2); + ext1[0]=ext2[0]=filename1[0]=filename2[0]=NULL; + copystr(file_mas[jst]*304 + buf+72, #filename1); + copystr(file_mas[b]*304 + buf+72, #filename2); n=strlen(#filename1)-1; WHILE (filename1[n]<>'.') && (n>0) n--; - IF (n) copystr(#filename1+n+1, #filename1); + IF (n) copystr(#filename1+n+1, #ext1); n=strlen(#filename2)-1; WHILE (filename2[n]<>'.') && (n>0) n--; - IF (n) copystr(#filename2+n+1, #filename2); - // - n=strcmp(#filename1, #filename2); - IF (n<0) { file_mas[i] >< file_mas[j]; i++;} - IF (n==0) && (strcmp(file_mas[j]*304 + offset, file_mas[b]*304 + offset)<=0) { file_mas[i] >< file_mas[j]; i++;} + IF (n) copystr(#filename2+n+1, #ext2); + + n=strcmp(#ext1, #ext2); + IF (n<0) { file_mas[ist] >< file_mas[jst]; ist++;} + IF (n==0) && (strcmp(#filename1, #filename2)<=0) { file_mas[ist] >< file_mas[jst]; ist++;} } - Sort_by_Type(a, i-2); - Sort_by_Type(i, b); + Sort_by_Type(a, ist-2); + Sort_by_Type(ist, b); } diff --git a/programs/fs/Eolite/trunk/lib/file_system.h b/programs/fs/Eolite/trunk/lib/file_system.h index e07f6d118b..dbd15462fb 100644 --- a/programs/fs/Eolite/trunk/lib/file_system.h +++ b/programs/fs/Eolite/trunk/lib/file_system.h @@ -28,8 +28,8 @@ struct BDVK{ //////////////////////////// // Создать файл // //////////////////////////// -/*f70 create_file_70; -void CreateFile(dword file_size, read_buffer, file_path) +f70 create_file_70; +int CreateFile(dword file_size, read_buffer, file_path) { create_file_70.func = 2; create_file_70.param1 = 0; @@ -41,13 +41,13 @@ void CreateFile(dword file_size, read_buffer, file_path) $mov eax,70 $mov ebx,#create_file_70.func $int 0x40 -} */ +} //////////////////////////// // Прочитать файл // //////////////////////////// f70 read_file_70; -void ReadFile(dword pos, file_size, read_buffer, file_path) +int ReadFile(dword pos, file_size, read_buffer, file_path) { read_file_70.func = 0; read_file_70.param1 = pos; diff --git a/programs/fs/Eolite/trunk/lib/kolibri.h b/programs/fs/Eolite/trunk/lib/kolibri.h index 4c017d8b00..a505243208 100644 --- a/programs/fs/Eolite/trunk/lib/kolibri.h +++ b/programs/fs/Eolite/trunk/lib/kolibri.h @@ -15,6 +15,7 @@ dword I_Path = #program_path; char param[4096]; char program_path[4096]; +#include "lib\strings.h" //Events #define evMouse 6 @@ -211,153 +212,6 @@ inline fastcall void MoveSize( EBX,ECX,EDX,ESI){ $int 0x40 } -//------------------------------------------------------------------------------ - -inline fastcall dword strlen( EDI) -{ - asm { - xor ecx, ecx - xor eax, eax - dec ecx - repne scasb - sub eax, 2 - sub eax, ecx - } -} - - -inline fastcall copystr( ESI,EDI) -{ - $cld -l1: - $lodsb - $stosb - $test al,al - $jnz l1 -} - -char buffer[11]; -inline fastcall dword IntToStr( ESI) -{ - $mov edi, #buffer - $mov ecx, 10 - $test esi, esi - $jns f1 - $mov al, '-' - $stosb - $neg esi -f1: - $mov eax, esi - $push -'0' -f2: - $xor edx, edx - $div ecx - $push edx - $test eax, eax - $jnz f2 -f3: - $pop eax - $add al, '0' - $stosb - $jnz f3 - $mov eax, #buffer - $ret -} - -inline fastcall dword StrToInt() -{ - ESI=EDI=EAX; - IF(DSBYTE[ESI]=='-')ESI++; - EAX=0; - BH=AL; - do{ - BL=DSBYTE[ESI]-'0'; - EAX=EAX*10+EBX; - ESI++; - }while(DSBYTE[ESI]>0); - IF(DSBYTE[EDI]=='-') -EAX; -} - -dword StrToCol(char* htmlcolor) -{ - dword j, color=0; - char ch=0x00; - - FOR (j=0; j<6; j++) - { - ch=ESBYTE[htmlcolor+j]; - IF ((ch>='0') && (ch<='9')) ch -= '0'; - IF ((ch>='A') && (ch<='F')) ch -= 'A'-10; - IF ((ch>='a') && (ch<='f')) ch -= 'a'-10; - color = color*0x10 + ch; - } - - return color; -} - -inline fastcall int strcmp(ESI, EDI) -{ - loop() - { - IF (DSBYTE[ESI]DSBYTE[EDI]) RETURN 1; - IF (DSBYTE[ESI]=='\0') RETURN 0; - ESI++; - EDI++; - } -} - - -inline fastcall signed int strncmp( ESI, EDI, ECX) -{ - asm { - MOV EBX, EDI - XOR EAX, EAX - MOV EDX, ECX - OR ECX, ECX - JE L1 - REPNE SCASB - SUB EDX, ECX - MOV ECX, EDX - MOV EDI, EBX - XOR EBX, EBX - REPE CMPSB - MOV AL, DSBYTE[ ESI-1] - MOV BL, DSBYTE[ EDI-1] - SUB EAX, EBX -L1: - } -} - - -inline fastcall unsigned int strchr(ESI,BL) -{ - int jj=0, last=-1; - do{ - jj++; - $lodsb - IF(AL==BL) last=jj; - } while(AL!=0); - return last; -} - - -inline fastcall TitleCase( EDX) -{ - AL=DSBYTE[EDX]; - IF(AL>='a')&&(AL<='z')DSBYTE[EDX]=AL&0x5f; - IF (AL>=160) && (AL<=175) DSBYTE[EDX] = AL - 32; //а-п - IF (AL>=224) && (AL<=239) DSBYTE[EDX] = AL - 80; //а-п - do{ - EDX++; - AL=DSBYTE[EDX]; - IF(AL>='A')&&(AL<='Z'){DSBYTE[EDX]=AL|0x20; CONTINUE;} - IF(AL>='Ђ')&&(AL<='Џ')DSBYTE[EDX]=AL|0x20; // -Ї - IF (AL>=144) && (AL<=159) DSBYTE[EDX] = AL + 80; //а-п - }while(AL!=0); -} - - //------------------------------------------------------------------------------ inline fastcall void PutPixel( EBX,ECX,EDX) { @@ -438,9 +292,6 @@ void PutImage(dword EBX,w,h,x,y) //------------------------------------------------------------------------------ inline fastcall void debug( EDX) { - $push eax - $push ebx - $push ecx $mov eax, 63 $mov ebx, 1 next_char: @@ -455,7 +306,4 @@ done: $int 0x40 $mov cl, 10 $int 0x40 - $pop eax - $pop ebx - $pop ecx } \ No newline at end of file diff --git a/programs/fs/Eolite/trunk/lib/strings.h b/programs/fs/Eolite/trunk/lib/strings.h new file mode 100644 index 0000000000..10ce42ac48 --- /dev/null +++ b/programs/fs/Eolite/trunk/lib/strings.h @@ -0,0 +1,167 @@ +//CODED by Veliant, Leency 2008-2012. GNU GPL licence. + + +inline fastcall dword strlen( EDI) +{ + asm { + xor ecx, ecx + xor eax, eax + dec ecx + repne scasb + sub eax, 2 + sub eax, ecx + } +} + + +inline fastcall copystr( ESI,EDI) +{ + $cld +l1: + $lodsb + $stosb + $test al,al + $jnz l1 +} + +char buffer[11]; +inline fastcall dword IntToStr( ESI) +{ + $mov edi, #buffer + $mov ecx, 10 + $test esi, esi + $jns f1 + $mov al, '-' + $stosb + $neg esi +f1: + $mov eax, esi + $push -'0' +f2: + $xor edx, edx + $div ecx + $push edx + $test eax, eax + $jnz f2 +f3: + $pop eax + $add al, '0' + $stosb + $jnz f3 + $mov eax, #buffer + $ret +} + +inline fastcall dword StrToInt() +{ + ESI=EDI=EAX; + IF(DSBYTE[ESI]=='-')ESI++; + EAX=0; + BH=AL; + do{ + BL=DSBYTE[ESI]-'0'; + EAX=EAX*10+EBX; + ESI++; + }while(DSBYTE[ESI]>0); + IF(DSBYTE[EDI]=='-') -EAX; +} + +dword StrToCol(char* htmlcolor) +{ + dword j, color=0; + char ch=0x00; + + FOR (j=0; j<6; j++) + { + ch=ESBYTE[htmlcolor+j]; + IF ((ch>='0') && (ch<='9')) ch -= '0'; + IF ((ch>='A') && (ch<='F')) ch -= 'A'-10; + IF ((ch>='a') && (ch<='f')) ch -= 'a'-10; + color = color*0x10 + ch; + } + + return color; +} + +inline fastcall int strcmp(ESI, EDI) +{ + loop() + { + IF (DSBYTE[ESI]DSBYTE[EDI]) RETURN 1; + IF (DSBYTE[ESI]=='\0') RETURN 0; + ESI++; + EDI++; + } +} + + + + +inline fastcall unsigned int strchr(ESI,BL) +{ + int jj=0, last=-1; + do{ + jj++; + $lodsb + IF(AL==BL) last=jj; + } while(AL!=0); + return last; +} + + +inline fastcall TitleCase( EDX) +{ + AL=DSBYTE[EDX]; + IF(AL>='a')&&(AL<='z')DSBYTE[EDX]=AL&0x5f; + IF (AL>=160) && (AL<=175) DSBYTE[EDX] = AL - 32; //а-п + IF (AL>=224) && (AL<=239) DSBYTE[EDX] = AL - 80; //а-п + do{ + EDX++; + AL=DSBYTE[EDX]; + IF(AL>='A')&&(AL<='Z'){DSBYTE[EDX]=AL|0x20; CONTINUE;} + IF(AL>='Ђ')&&(AL<='Џ')DSBYTE[EDX]=AL|0x20; // -Ї + IF (AL>=144) && (AL<=159) DSBYTE[EDX] = AL + 80; //а-п + }while(AL!=0); +} + + + +inline fastcall strcpy( EDI, ESI) +{ + $cld +l2: + $lodsb + $stosb + $test al,al + $jnz l2 +} + + +inline fastcall strcat( EDI, ESI) +{ + asm { + mov ebx, edi + xor ecx, ecx + xor eax, eax + dec ecx + repne scasb + dec edi + mov edx, edi + mov edi, esi + xor ecx, ecx + xor eax, eax + dec ecx + repne scasb + xor ecx, 0ffffffffh + mov edi, edx + mov edx, ecx + mov eax, edi + shr ecx, 2 + rep movsd + mov ecx, edx + and ecx, 3 + rep movsb + mov eax, ebx + } +} \ No newline at end of file