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
This commit is contained in:
Kirill Lipatov (Leency) 2012-12-15 14:11:03 +00:00
parent bef68cee11
commit a7e652271e
5 changed files with 53 additions and 36 deletions

View File

@ -20,7 +20,7 @@ int BUTTON_HEIGHT=18;
#define ONLY_OPEN 2 #define ONLY_OPEN 2
//ïåðåìåííûå //ïåðåìåííûå
#define title "Eolite File Manager v1.43" #define title "Eolite File Manager v1.45"
dword selection_col = 0x94AECE; dword selection_col = 0x94AECE;
dword lpanel_col = 0x00699C; dword lpanel_col = 0x00699C;
@ -56,8 +56,8 @@ int scroll_size;
int toolbar_buttons_x[6]={9,46,85,134,167,203}; int toolbar_buttons_x[7]={9,46,85,134,167,203};
char tmp_disk_del_param[]="d0"; char tmp_disk_del_param[3]="d0\0";
dword file_mas[6898]; dword file_mas[6898];
int j, i, mouse_dd; int j, i, mouse_dd;
@ -111,7 +111,7 @@ void main()
IF (del_active) break; IF (del_active) break;
id=GetSlot(Form.ID); 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); IF (!rename_active) edit_box_mouse stdcall(#edit1); ELSE edit_box_mouse stdcall(#edit2);

View File

@ -38,9 +38,9 @@ void about_dialog()
DefineAndDrawWindow(600,150,181,256,0x34,0x10EFEBEF,"About Eolite"); DefineAndDrawWindow(600,150,181,256,0x34,0x10EFEBEF,"About Eolite");
DrawBar(0,0,172,50,0x8494C4); //ãîëóáîå ñçàäè DrawBar(0,0,172,50,0x8494C4); //ãîëóáîå ñçàäè
PutPaletteImage(#logo,85,85,43,7,#logo_pal); PutPaletteImage(#logo,85,85,43,7,#logo_pal);
WriteText(46,100,0x90,0xBF40BF,"Eolite v1.43",0); WriteText(46,100,0x90,0xBF40BF,"Eolite v1.45",0);
$add ebx, 1<<16 $add ebx, 1<<16
$int 0x40 $int 0x40
WriteText(55,120,0x80,0,"Developers:",0); WriteText(55,120,0x80,0,"Developers:",0);
WriteText(39,130,0x80,0,"Leency & Veliant",0); WriteText(39,130,0x80,0,"Leency & Veliant",0);
WriteText(45,140,0x80,0,"KolibriOS Team",0); WriteText(45,140,0x80,0,"KolibriOS Team",0);

View File

@ -29,16 +29,20 @@ unsigned char *ERROR_TEXT[]={
void GetIni(byte onload) void GetIni(byte onload)
{ {
byte section[32]='', parametr[32]='', option[256]='', InfType=0; byte section[32]='', parametr[32]='', option[256]='', InfType=0;
word bukva[1]; char bukva[2];
int errornum; int errornum;
dword buff, fsize, tj; dword fsize, tj;
static dword buff;
//÷èòàåì ôàéë //÷èòàåì ôàéë
free(buff); IF (onload==1)
buff = malloc(12000); {
IF (onload==1) copystr(".ini", #program_path+strlen(#program_path)); free(buff);
buff = malloc(12000);
copystr(".ini", #program_path+strlen(#program_path));
}
ReadFile(0, 12000, buff, #program_path); ReadFile(0, 12000, buff, #program_path);
IF (EAX<>6) //åñëè ôàéëà ñ íàñòğîéêàìè íåò â ïàïêå ñ ïğîãğàììîé ñìîòğèì â ïàïêå ïî-óìîë÷àíèş IF (EAX<>6) ReadFile(0, 12000, buff, "/sys/File managers/Eolite.ini");
ReadFile(0, 12000, buff, "/sys/File managers/Eolite.ini");
IF (EAX<>6) //åñëè ôàéëà ñ íàñòðîéêàìè òóïî íåò ïå÷àëüêà IF (EAX<>6) //åñëè ôàéëà ñ íàñòðîéêàìè òóïî íåò ïå÷àëüêà
{ {
IF (onload==1) notify("Eolite.ini not found. Defaults will be used."); IF (onload==1) notify("Eolite.ini not found. Defaults will be used.");

View File

@ -107,13 +107,20 @@ inline fastcall int GetSlot( ECX)
$int 0x40 $int 0x40
} }
inline fastcall int ActiveProcess() inline fastcall int GetActiveProcess()
{ {
$mov eax,18; $mov eax,18;
$mov ebx,7; $mov ebx,7;
$int 0x40 $int 0x40
} }
inline fastcall void ActivateWindow( ECX)
{
EAX = 18;
EBX = 3;
$int 0x40
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
inline fastcall dword WaitEvent(){ inline fastcall dword WaitEvent(){
@ -129,17 +136,17 @@ inline fastcall void SetEventMask( EBX)
inline fastcall word GetKey(){ //+Gluk fix inline fastcall word GetKey(){ //+Gluk fix
$push edx $push edx
@getkey: GETKEY:
$mov eax,2 $mov eax,2
$int 0x40 $int 0x40
$cmp eax,1 $cmp eax,1
$jne getkeyi $jne GETKEYI
$mov ah,dh $mov ah,dh
$jmp getkeyii //jz? $jmp GETKEYII //jz?
@getkeyi: GETKEYI:
$mov dh,ah $mov dh,ah
$jmp getkey $jmp GETKEY
@getkeyii: GETKEYII:
$pop edx $pop edx
EAX = EAX >> 8; EAX = EAX >> 8;
} }
@ -207,6 +214,13 @@ inline fastcall dword GetScreenHeight()
$and eax,0x0000FFFF $and eax,0x0000FFFF
} }
inline fastcall dword GetScreenWidth()
{
$mov eax, 14
$int 0x40
$shr eax, 16
}
inline fastcall void MoveSize( EBX,ECX,EDX,ESI){ inline fastcall void MoveSize( EBX,ECX,EDX,ESI){
$mov eax,67; $mov eax,67;
$int 0x40 $int 0x40
@ -294,14 +308,14 @@ inline fastcall void debug( EDX)
{ {
$mov eax, 63 $mov eax, 63
$mov ebx, 1 $mov ebx, 1
next_char: NEXT_CHAR:
$mov ecx, DSDWORD[edx] $mov ecx, DSDWORD[edx]
$or cl, cl $or cl, cl
$jz done $jz DONE
$int 0x40 $int 0x40
$inc edx $inc edx
$jmp next_char $jmp NEXT_CHAR
done: DONE:
$mov cl, 13 $mov cl, 13
$int 0x40 $int 0x40
$mov cl, 10 $mov cl, 10

View File

@ -17,11 +17,11 @@ inline fastcall dword strlen( EDI)
inline fastcall copystr( ESI,EDI) inline fastcall copystr( ESI,EDI)
{ {
$cld $cld
l1: L1:
$lodsb $lodsb
$stosb $stosb
$test al,al $test al,al
$jnz l1 $jnz L1
} }
char buffer[11]; char buffer[11];
@ -30,26 +30,25 @@ inline fastcall dword IntToStr( ESI)
$mov edi, #buffer $mov edi, #buffer
$mov ecx, 10 $mov ecx, 10
$test esi, esi $test esi, esi
$jns f1 $jns F1
$mov al, '-' $mov al, '-'
$stosb $stosb
$neg esi $neg esi
f1: F1:
$mov eax, esi $mov eax, esi
$push -'0' $push -'0'
f2: F2:
$xor edx, edx $xor edx, edx
$div ecx $div ecx
$push edx $push edx
$test eax, eax $test eax, eax
$jnz f2 $jnz F2
f3: F3:
$pop eax $pop eax
$add al, '0' $add al, '0'
$stosb $stosb
$jnz f3 $jnz F3
$mov eax, #buffer $mov eax, #buffer
//$ret
} }
inline fastcall dword StrToInt() inline fastcall dword StrToInt()
@ -128,11 +127,11 @@ inline fastcall TitleCase( EDX)
inline fastcall strcpy( EDI, ESI) inline fastcall strcpy( EDI, ESI)
{ {
$cld $cld
l2: L2:
$lodsb $lodsb
$stosb $stosb
$test al,al $test al,al
$jnz l2 $jnz L2
} }