Fixed bugs, new functions.

git-svn-id: svn://kolibrios.org@5576 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pavelyakov 2015-07-16 01:44:30 +00:00
parent 98eee70542
commit cdf5c48fbb
13 changed files with 534 additions and 212 deletions

View File

@ -4,4 +4,4 @@ LineHeight=18
ShowDeviceName=1 ShowDeviceName=1
RealFileNamesCase=0 RealFileNamesCase=0
InfoAfterCopy=0 InfoAfterCopy=0
TimeDoubleClick=100 TimeDoubleClick=70

View File

@ -164,7 +164,7 @@ edit_box edit2 = {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xFFFFFF,0,248,#file_nam
edit_box new_file_ed = {150,213,80,0xFFFFFF,0x94AECE,0x000000,0xFFFFFF,0,248,#new_element_name,#mouse_dd,100000000000010b,6,0}; edit_box new_file_ed = {150,213,80,0xFFFFFF,0x94AECE,0x000000,0xFFFFFF,0,248,#new_element_name,#mouse_dd,100000000000010b,6,0};
PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0}; PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0};
PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
byte cmd_free;
#include "include\copy.h" #include "include\copy.h"
#include "include\gui.h" #include "include\gui.h"
#include "include\sorting.h" #include "include\sorting.h"
@ -176,6 +176,8 @@ PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #t
#include "include\settings.h" #include "include\settings.h"
#include "include\properties.h" #include "include\properties.h"
dword menu_stak,about_stak,properties_stak,settings_stak,copy_stak;
void main() void main()
{ {
word key, id, can_show, can_select, m_selected; word key, id, can_show, can_select, m_selected;
@ -202,7 +204,7 @@ void main()
} }
Open_Dir(#path,ONLY_OPEN); Open_Dir(#path,ONLY_OPEN);
SetEventMask(0x27); SetEventMask(0x27);
loop() switch(WaitEvent()) loop(){ switch(WaitEvent())
{ {
case evMouse: case evMouse:
if (del_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) break; if (del_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) break;
@ -256,66 +258,17 @@ void main()
} }
} }
} }
if (files.MouseOver(m.x, m.y))&&((m.up)||(m.down)||(m.dblclick))
/*
if (files.MouseOver(m.x, m.y)) && (!can_select)
{
m_selected = m.y - files.y / files.line_h;
if (m.lkm) can_select = 1;
if (m.pkm)
{
can_show = 1;
if (m.y - files.y / files.line_h != files.current) can_select = 1;
}
}
//select/open file {
if (!m.lkm) && (!m.pkm) && (can_select)
{
can_select = 0;
if (m.y>=files.y)
{
id = m.y - files.y / files.line_h;
if (id!=m_selected)
{
can_show=0;
break;
}
if (files.current!=id)
{
if (id<files.visible) List_Current(id-files.current);
}
else
Open(0);
}
};
// } select/open file
//file menu {
if (!m.pkm) && (!m.lkm) && (can_show)
{
can_show = 0;
menu_call_mouse = 1;
if (m.y>=files.y)
{
SwitchToAnotherThread();
CreateThread(#FileMenu,#menu_stak+4092);
}
break;
}
// } file menu
*/
if (files.MouseOver(m.x, m.y))&&(m.up)
{ {
//select/open file { //select/open file {
if (m.key&MOUSE_LEFT) if (m.key&MOUSE_LEFT)&&((m.down)||(m.dblclick))
{ {
if (m.y>=files.y)//&&(m.click) if (m.y>=files.y)//&&(m.click)
{ {
id = m.y - files.y / files.line_h; id = m.y - files.y / files.line_h;
if (files.current!=id) if (files.current!=id)
{ {
m.clearTime();
if (id<files.visible) List_Current(id-files.current); if (id<files.visible) List_Current(id-files.current);
} }
else if(m.dblclick)Open(0); else if(m.dblclick)Open(0);
@ -324,15 +277,16 @@ void main()
// } select/open file // } select/open file
else else
//file menu { //file menu {
if (m.key&MOUSE_RIGHT) if (m.key&MOUSE_RIGHT)&&(m.up)
{ {
menu_call_mouse = 1; menu_call_mouse = 1;
if (m.y>=files.y)&&(m.click) if (m.y>=files.y)//&&(m.click)
{ {
id = m.y - files.y / files.line_h; id = m.y - files.y / files.line_h;
if (files.current!=id) List_Current(id-files.current); if (files.current!=id) List_Current(id-files.current);
SwitchToAnotherThread(); //SwitchToAnotherThread();
CreateThread(#FileMenu,#menu_stak+4092); menu_stak = malloc(4096);
CreateThread(#FileMenu,menu_stak+4092);
} }
break; break;
} }
@ -427,7 +381,8 @@ void main()
Copy(#file_path, NOCUT); Copy(#file_path, NOCUT);
break; break;
case 26: //paste case 26: //paste
CreateThread(#Paste,#copy_stak+4092); copy_stak = malloc(4096);
CreateThread(#Paste,copy_stak+4092);
break; break;
case 31...33: //sort case 31...33: //sort
IF(sort_num==1) DrawFilledBar(sorting_arrow_x,42,6,10); IF(sort_num==1) DrawFilledBar(sorting_arrow_x,42,6,10);
@ -500,7 +455,8 @@ void main()
Copy(#file_path, NOCUT); Copy(#file_path, NOCUT);
break; break;
case 022: //Ctrl+V case 022: //Ctrl+V
CreateThread(#Paste,#copy_stak+4092); copy_stak = malloc(4096);
CreateThread(#Paste,copy_stak+4092);
break; break;
case 001: //Ctrl+A case 001: //Ctrl+A
debugln("press Ctrl+A"); debugln("press Ctrl+A");
@ -530,8 +486,9 @@ void main()
break; break;
case 074: //menu case 074: //menu
menu_call_mouse=0; menu_call_mouse=0;
SwitchToAnotherThread(); //SwitchToAnotherThread();
CreateThread(#FileMenu,#menu_stak+4092); menu_stak = malloc(4096);
CreateThread(#FileMenu,menu_stak+4092);
break; break;
case 173: //Ctrl+Enter case 173: //Ctrl+Enter
if (!itdir) ShowOpenWithDialog(); if (!itdir) ShowOpenWithDialog();
@ -591,6 +548,15 @@ void main()
draw_window(); draw_window();
if (action_buf) { menu_action(action_buf); action_buf=0;} if (action_buf) { menu_action(action_buf); action_buf=0;}
} }
if(cmd_free){
if(cmd_free==1) free(menu_stak);
else if(cmd_free==2)free(about_stak);
else if(cmd_free==3)free(properties_stak);
else if(cmd_free==4)free(settings_stak);
else if(cmd_free==5)free(copy_stak);
cmd_free = 0;
}
}
} }
@ -619,7 +585,7 @@ void menu_action(dword id)
if (id==203) FnProcess(4); //F4 if (id==203) FnProcess(4); //F4
if (id==104) Copy(#file_path, NOCUT); if (id==104) Copy(#file_path, NOCUT);
if (id==105) Copy(#file_path, CUT); if (id==105) Copy(#file_path, CUT);
if (id==106) CreateThread(#Paste,#copy_stak+4092); if (id==106) { copy_stak = malloc(4096); CreateThread(#Paste,copy_stak+4092);}
if (id==207) FnProcess(2); if (id==207) FnProcess(2);
if (id==108) Del_Form(); if (id==108) Del_Form();
if (id==109) FnProcess(5); if (id==109) FnProcess(5);
@ -645,7 +611,7 @@ void draw_window()
DrawBar(246,0,Form.cwidth - 297,12, sc.work); //upper editbox DrawBar(246,0,Form.cwidth - 297,12, sc.work); //upper editbox
DrawBar(246,29,Form.cwidth - 297,5,sc.work); //under editbox DrawBar(246,29,Form.cwidth - 297,5,sc.work); //under editbox
DrawRectangle(246,12,Form.cwidth - 303,16,sc.work_graph); DrawRectangle(246,12,Form.cwidth - 303,16,sc.work_graph);
DefineButton(Form.cwidth - 25,6,27,28,51+BT_HIDE+BT_NOFRAME,0); //about DefineButton(Form.cwidth - 32,6,27,28,51+BT_HIDE+BT_NOFRAME,0); //about
PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal); PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal);
//main rectangles //main rectangles
DrawRectangle(1,40,Form.cwidth-3,onTop(46,0),sc.work_graph); DrawRectangle(1,40,Form.cwidth-3,onTop(46,0),sc.work_graph);
@ -899,9 +865,10 @@ void Del_Form()
} }
if (cont) if (cont)
{ {
strcpy(#f_count, DEL_MORE_FILES_1); /*strcpy(#f_count, DEL_MORE_FILES_1);
strcat(#f_count, itoa(cont)); strcat(#f_count, itoa(cont));
strcat(#f_count, DEL_MORE_FILES_2); strcat(#f_count, DEL_MORE_FILES_2);*/
sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,cont,DEL_MORE_FILES_2);
WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,sc.work_text,#f_count); WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,sc.work_text,#f_count);
} }
else else
@ -1157,15 +1124,16 @@ void NewElement_Form(byte crt, dword strng)
DrawFlatButton(dform_x+120,208,70,20,302,0xC6DFC6,T_CANCEL); DrawFlatButton(dform_x+120,208,70,20,302,0xC6DFC6,T_CANCEL);
} }
void FnProcess(char N) void FnProcess(byte N)
{ {
switch(N) switch(N)
{ {
case 1: case 1:
if (!active_about) if (!active_about)
{ {
SwitchToAnotherThread(); //SwitchToAnotherThread();
about_window=CreateThread(#about_dialog,#about_stak+4092); about_stak = malloc(4096);
about_window = CreateThread(#about_dialog,about_stak+4092);
break; break;
} }
else else
@ -1231,14 +1199,16 @@ void FnProcess(char N)
NewElement_Form(1, T_NEW_FILE); NewElement_Form(1, T_NEW_FILE);
break; break;
case 8: case 8:
SwitchToAnotherThread(); //SwitchToAnotherThread();
CreateThread(#properties_dialog, #properties_stak+4092); properties_stak = malloc(8096);
CreateThread(#properties_dialog, properties_stak+8092);
break; break;
case 10: //F10 case 10: //F10
if (!active_settings) if (!active_settings)
{ {
SwitchToAnotherThread(); //SwitchToAnotherThread();
settings_window=CreateThread(#settings_dialog, #settings_stak+4092); settings_stak = malloc(4096);
settings_window = CreateThread(#settings_dialog, settings_stak+4092);
break; break;
} }
else else
@ -1254,10 +1224,3 @@ dword onTop(dword down,up) {EAX=Form.height-GetSkinHeight()-down-up;}
stop: stop:
char menu_stak[4096];
char copy_stak[4096];
char open_with_stak[4096];
char about_stak[4096];
char properties_stak[4096];
char settings_stak[4096];

View File

@ -25,7 +25,7 @@ void about_dialog()
byte id; byte id;
proc_info about_form; proc_info about_form;
IF (active_about) ExitProcess(); IF (active_about){cmd_free = 2;ExitProcess();}
active_about=1; active_about=1;
loop() switch(WaitEvent()) loop() switch(WaitEvent())
{ {
@ -34,6 +34,7 @@ void about_dialog()
IF (id==1) || (id==10) IF (id==1) || (id==10)
{ {
active_about=0; active_about=0;
cmd_free = 2;
ExitProcess(); ExitProcess();
} }
IF (id==23) RunProgram(BROWSER_PATH, BROWSER_LINK); IF (id==23) RunProgram(BROWSER_PATH, BROWSER_LINK);
@ -43,23 +44,24 @@ void about_dialog()
IF (GetKey()==27) IF (GetKey()==27)
{ {
active_about=0; active_about=0;
cmd_free = 2;
ExitProcess(); ExitProcess();
} }
break; break;
case evReDraw: case evReDraw:
DefineAndDrawWindow(Form.left + 200,150,181,228+GetSkinHeight(),0x34,sc.work,INTRO_TEXT_1); DefineAndDrawWindow(Form.left+Form.width/2,Form.top+Form.height/2-114,300,228+GetSkinHeight(),0x34,sc.work,INTRO_TEXT_1);
GetProcessInfo(#about_form, SelfInfo); GetProcessInfo(#about_form, SelfInfo);
if (Form.status_window>2) break; if (Form.status_window>2) break;
DrawBar(0,0,about_form.cwidth,50,0x8494C4); DrawBar(0,0,about_form.cwidth,50,0x8494C4);
PutPaletteImage(#logo,85,85,43,7,8,#logo_pal); PutPaletteImage(#logo,85,85,about_form.width/2-43,7,8,#logo_pal);
WriteTextB(46,100,0x90,0xBF40BF,ABOUT_TITLE); WriteTextB(about_form.width/2-46,100,0x90,0xBF40BF,ABOUT_TITLE);
WriteTextCenter(0,120,about_form.cwidth,0,INTRO_TEXT_2); WriteTextCenter(0,120,about_form.cwidth,0,INTRO_TEXT_2);
WriteTextCenter(0,130,about_form.cwidth,0,"Leency Veliant PunkJoker"); WriteTextCenter(0,130,about_form.cwidth,0,"Leency Veliant PunkJoker Pavelyakov");
WriteTextCenter(0,140,about_form.cwidth,0,"KolibriOS Team"); WriteTextCenter(0,140,about_form.cwidth,0,"KolibriOS Team");
WriteTextCenter(0,150,about_form.cwidth,0,"2008-2015"); WriteTextCenter(0,150,about_form.cwidth,0,"2008-2015");
WriteTextCenter(10,170,70,0,INTRO_TEXT_3); WriteTextCenter(10,170,about_form.width-125,0,INTRO_TEXT_3);
DrawLink(71,170,0x80,23, "kolibri-n.org"); DrawLink(about_form.width/2-15,170,0x80,23, "kolibri-n.org");
DrawFlatButton(85,190,70,22,10,0xE4DFE1, INTRO_TEXT_4); DrawFlatButton(about_form.width/2-35,about_form.height-60,70,22,10,0xE4DFE1, INTRO_TEXT_4);
} }
} }

View File

@ -9,6 +9,15 @@
60, "<EFBFBD> áâனª¨", "F10", 60, "<EFBFBD> áâனª¨", "F10",
0,0,0 0,0,0
}; };
?define T_PROG "<EFBFBD>ணࠬ¬ë "
?define T_SYS "‘¨á⥬  "
?define T_UNC "<EFBFBD>¥¨§¢¥áâ­® "
?define T_CD "CD-ROM "
?define T_FD "„¨áª¥â  "
?define T_HD "†¥á⪨© ¤¨áª "
?define T_SATA "SATA ¤¨áª "
?define T_USB "USB ¤¨áª "
?define T_RAM "RAM ¤¨áª "
#elif LANG_EST #elif LANG_EST
?define T_DEVICES "Seadmed" ?define T_DEVICES "Seadmed"
?define T_ACTIONS "Toimingud" ?define T_ACTIONS "Toimingud"
@ -18,6 +27,15 @@
60, "Seaded", "F10", 60, "Seaded", "F10",
0,0,0 0,0,0
}; };
?define T_PROG "Programs "
?define T_SYS "System "
?define T_UNC "Unknown "
?define T_CD "CD-ROM "
?define T_FD "Floppy disk "
?define T_HD "Hard disk "
?define T_SATA "SATA disk"
?define T_USB "USB disk"
?define T_RAM "RAM disk"
#else #else
?define T_DEVICES "Devices" ?define T_DEVICES "Devices"
?define T_ACTIONS "Actions" ?define T_ACTIONS "Actions"
@ -27,6 +45,15 @@
60, "Settings", "F10", 60, "Settings", "F10",
0,0,0 0,0,0
}; };
?define T_PROG "Programs "
?define T_SYS "System "
?define T_UNC "Unknown "
?define T_CD "CD-ROM "
?define T_FD "Floppy disk "
?define T_HD "Hard disk "
?define T_SATA "SATA disk"
?define T_USB "USB disk"
?define T_RAM "RAM disk"
#endif #endif
@ -50,7 +77,7 @@ dword devbuf;
void GetSystemDiscs() void GetSystemDiscs()
{ {
char dev_name[10], sys_discs[10]; char dev_name[10], sys_discs[10];
int i1, j1, dev_num, dev_disc_num; int i1, j1, dev_num, dev_disc_num,l;
disc_num=0; disc_num=0;
if (devbuf) free(devbuf); if (devbuf) free(devbuf);
devbuf = malloc(10000); //áóôåð ãäå-òî íà 10 äåâàéñîâ â ëåâîé ïàíåëè devbuf = malloc(10000); //áóôåð ãäå-òî íà 10 äåâàéñîâ â ëåâîé ïàíåëè
@ -58,28 +85,25 @@ void GetSystemDiscs()
dev_num = EBX; dev_num = EBX;
for (i1=0; i1<dev_num; i1++) for (i1=0; i1<dev_num; i1++)
{ {
strcpy(#dev_name, "/"); // / sprintf(#dev_name,"/%s/",i1*304+ devbuf+72);
strcat(#dev_name, i1*304+ devbuf+72); // /rd
strcat(#dev_name, "/"); // /rd/
Open_Dir(#dev_name, ONLY_OPEN); Open_Dir(#dev_name, ONLY_OPEN);
dev_disc_num = files.count; dev_disc_num = files.count;
//if (files.count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else //if (files.count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else
for (j1=0; j1<dev_disc_num; j1++;) for (j1=0; j1<dev_disc_num; j1++;)
{ {
strcpy(#sys_discs, #dev_name); // /rd/ l=sprintf(#sys_discs,"%s%s/",#dev_name,j1*304+ buf+72);
strcat(#sys_discs, j1*304+ buf+72); // /rd/1 strncpy(#disk_list[disc_num].Item, #sys_discs,l);
strcat(#sys_discs, "/"); // /rd/1/
strcpy(#disk_list[disc_num].Item, #sys_discs);
disc_num++; disc_num++;
} }
if (strcmp(#sys_discs, "/rd/1/")==0) if (strncmp(#sys_discs, "/rd/1/",6)==0)
{ {
if (isdir("/kolibrios")) if (isdir("/kolibrios"))
{ {
strcpy(#disk_list[disc_num].Item, "/kolibrios/"); strncpy(#disk_list[disc_num].Item, "/kolibrios/",11);
kolibrios_drive = true; kolibrios_drive = true;
disc_num++; disc_num++;
} else kolibrios_drive = false; }
else kolibrios_drive = false;
} }
} }
} }
@ -102,40 +126,40 @@ void DrawSystemDiscs()
{ {
case 'k': case 'k':
dev_icon=0; dev_icon=0;
strcpy(#disc_name, "Programs "); strcpy(#disc_name, T_PROG);
break; break;
case 'r': case 'r':
dev_icon=0; dev_icon=0;
strcpy(#disc_name, "System "); strcpy(#disc_name, T_SYS);
break; break;
case 'c': case 'c':
dev_icon=1; dev_icon=1;
strcpy(#disc_name, "CD-ROM "); strcpy(#disc_name, T_CD);
break; break;
case 'f': case 'f':
dev_icon=2; dev_icon=2;
strcpy(#disc_name, "Floppy disk "); strcpy(#disc_name, T_FD);
break; break;
case 'h': case 'h':
case 'b': case 'b':
dev_icon=3; dev_icon=3;
strcpy(#disc_name, "Hard disk "); strcpy(#disc_name, T_HD);
break; break;
case 's': case 's':
dev_icon=3; dev_icon=3;
strcpy(#disc_name, "SATA disk "); strcpy(#disc_name, T_SATA);
break; break;
case 'u': case 'u':
dev_icon=5; dev_icon=5;
strcpy(#disc_name, "USB flash "); strcpy(#disc_name, T_USB);
break; break;
case 't': case 't':
dev_icon=4; dev_icon=4;
strcpy(#disc_name, "RAM disk "); strcpy(#disc_name, T_RAM);
break; break;
default: default:
dev_icon=3; //ïî-óìîë÷àíèþ óñòðîéñòâî âûãëÿäèò êàê æåñòÿê íî ýòî íåïðàâèëüíî dev_icon=3; //ïî-óìîë÷àíèþ óñòðîéñòâî âûãëÿäèò êàê æåñòÿê íî ýòî íåïðàâèëüíî
strcpy(#disc_name, "Unknown "); strcpy(#disc_name, T_UNC);
} }
strcat(#disc_name, #dev_name); strcat(#disc_name, #dev_name);
if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name); else WriteText(45,i*16+79,0x80,0,#dev_name); if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name); else WriteText(45,i*16+79,0x80,0,#dev_name);

View File

@ -72,16 +72,16 @@ void FileMenu()
loop() switch(WaitEvent()) loop() switch(WaitEvent())
{ {
case evMouse: case evMouse:
if (!CheckActiveProcess(MenuForm.ID)) ExitProcess();
mm.get(); mm.get();
if (menu.ProcessMouse(mm.x, mm.y)) MenuListRedraw(); if (!CheckActiveProcess(MenuForm.ID)){ cmd_free=1; ExitProcess();}
if (mm.key&MOUSE_LEFT)&&(m.click) {action_buf = cur_action_buf; pause(5); ExitProcess(); } else if (mm.move)&&(menu.ProcessMouse(mm.x, mm.y)) MenuListRedraw();
break; else if (mm.key&MOUSE_LEFT)&&(mm.down) {action_buf = cur_action_buf; pause(5); cmd_free=1; ExitProcess(); }
break;
case evKey: case evKey:
key = GetKey(); key = GetKey();
if (key==27) ExitProcess(); if (key==27){cmd_free=1;ExitProcess();}
if (key == 13) {action_buf = cur_action_buf; ExitProcess(); } else if (key == 13) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); }
if (menu.ProcessKey(key)) MenuListRedraw(); if (menu.ProcessKey(key)) MenuListRedraw();
break; break;

View File

@ -66,9 +66,7 @@ void GetSizeDir(dword way)
for (i=0; i<fcount; i++) for (i=0; i<fcount; i++)
{ {
filename = i*304+dirbuf+72; filename = i*304+dirbuf+72;
strcpy(#cur_file, way); sprintf(#cur_file,"%s/%s",way,filename);
chrcat(#cur_file, '/');
strcat(#cur_file, filename);
if ( TestBit(ESDWORD[filename-40], 4) ) if ( TestBit(ESDWORD[filename-40], 4) )
{ {
dir_count++; dir_count++;
@ -98,8 +96,7 @@ void GetSizeMoreFiles(dword way)
{ {
selected_offset2 = file_mas[i]*304 + buf+32 + 7; selected_offset2 = file_mas[i]*304 + buf+32 + 7;
if (ESBYTE[selected_offset2]) { if (ESBYTE[selected_offset2]) {
strcpy(#cur_file, way); sprintf(#cur_file,way,file_mas[i]*304+buf+72);
strcat(#cur_file, file_mas[i]*304+buf+72);
GetFileInfo(#cur_file, #file_info_general); GetFileInfo(#cur_file, #file_info_general);
if ( file_info_general.isfolder ) if ( file_info_general.isfolder )
@ -128,10 +125,10 @@ void properties_dialog()
dword file_name_off; dword file_name_off;
dword element_size; dword element_size;
dword selected_offset2; dword selected_offset2;
char element_size_label[32]; char element_size_label[32],tmp;
proc_info settings_form; proc_info settings_form;
strcpy(#folder_info, "\0"); DSBYTE[#folder_info]=0;
file_count = 0; file_count = 0;
dir_count = 0; dir_count = 0;
size_dir = 0; size_dir = 0;
@ -152,7 +149,7 @@ void properties_dialog()
{ {
case evButton: case evButton:
id=GetButtonID(); id=GetButtonID();
IF (id==1) || (id==10) ExitProcess(); IF (id==1) || (id==10){cmd_free=3;ExitProcess();}
if (id==20) SetProperties(id); if (id==20) SetProperties(id);
if (id==21) SetProperties(id); if (id==21) SetProperties(id);
if (id==22) SetProperties(id); if (id==22) SetProperties(id);
@ -166,7 +163,7 @@ void properties_dialog()
case evKey: case evKey:
key = GetKey(); key = GetKey();
IF (key==27) ExitProcess(); IF (key==27){cmd_free=3;ExitProcess();}
EAX=key<<8; EAX=key<<8;
edit_box_key stdcall(#file_name_ed); edit_box_key stdcall(#file_name_ed);
edit_box_key stdcall(#path_to_file_ed); edit_box_key stdcall(#path_to_file_ed);
@ -186,16 +183,15 @@ void properties_dialog()
if (selected_count) if (selected_count)
{ {
Put_icon('', 18, 19, 0xFFFfff, 0); Put_icon('', 18, 19, 0xFFFfff, 0);
strcpy(#folder_info, SET_6); sprintf(#folder_info,"%s%d%s%d",SET_6,file_count,SET_7,dir_count);
strcat(#folder_info, itoa(file_count));
strcat(#folder_info, SET_7);
strcat(#folder_info, itoa(dir_count));
WriteText(50, 23, 0x80, 0x000000, #folder_info); WriteText(50, 23, 0x80, 0x000000, #folder_info);
EAX = ConvertSize(size_dir); EAX = ConvertSize(size_dir);
strcpy(#element_size_label, EAX); strcpy(#element_size_label, EAX);
strcat(#element_size_label, " ("); strcat(#element_size_label, " (");
strcat(#element_size_label, itoa(size_dir)); strcat(#element_size_label, itoa(size_dir));
strcat(#element_size_label, " b)"); strcat(#element_size_label, " b)");
//tmp = ConvertSize(size_dir);
//sprintf(#element_size_label," ( byte)");
WriteText(100, 65, 0x80, 0x000000, #element_size_label); WriteText(100, 65, 0x80, 0x000000, #element_size_label);
} }
else else
@ -215,10 +211,7 @@ void properties_dialog()
else else
{ {
WriteText(10, 80, 0x80, 0x000000, PR_T_CONTAINS); WriteText(10, 80, 0x80, 0x000000, PR_T_CONTAINS);
strcpy(#folder_info, SET_6); sprintf(#folder_info,"%s%d%s%d",SET_6,file_count,SET_7,dir_count);
strcat(#folder_info, itoa(file_count));
strcat(#folder_info, SET_7);
strcat(#folder_info, itoa(dir_count));
WriteText(100, 80, 0x80, 0x000000, #folder_info); WriteText(100, 80, 0x80, 0x000000, #folder_info);
element_size = size_dir; element_size = size_dir;
} }
@ -235,6 +228,9 @@ void properties_dialog()
strcat(#element_size_label, " ("); strcat(#element_size_label, " (");
strcat(#element_size_label, itoa(element_size)); strcat(#element_size_label, itoa(element_size));
strcat(#element_size_label, " b)"); strcat(#element_size_label, " b)");
//sprintf(#element_size_label,"%s (%d byte)","",element_size);
//tmp = ConvertSize(element_size);
//sprintf(#element_size_label,"%s (%d byte)",tmp,element_size);
WriteText(100, 65, 0x80, 0x000000, #element_size_label); WriteText(100, 65, 0x80, 0x000000, #element_size_label);
flags_frame.size_x = - flags_frame.start_x * 2 + settings_form.cwidth - 2; flags_frame.size_x = - flags_frame.start_x * 2 + settings_form.cwidth - 2;

View File

@ -12,6 +12,7 @@
?define NOTIFY_COPY_END "“¢¥¤®¬«ïâì ® § ¢¥à襭¨¨ ª®¯¨à®¢ ­¨ï" ?define NOTIFY_COPY_END "“¢¥¤®¬«ïâì ® § ¢¥à襭¨¨ ª®¯¨à®¢ ­¨ï"
?define CANCEL_T "Žâ¬¥­ " ?define CANCEL_T "Žâ¬¥­ "
?define APPLY_T "<EFBFBD>ਬ¥­¨âì" ?define APPLY_T "<EFBFBD>ਬ¥­¨âì"
?define T_DOUBLE_CLICK "‚à¥¬ï ¤¢®©­®£® ª«¨ª (¢ á®âëå)"
#else #else
?define EDIT_FILE_ASSOCIATIONS "Edit file associations" ?define EDIT_FILE_ASSOCIATIONS "Edit file associations"
?define TITLE_SETT "Settings" ?define TITLE_SETT "Settings"
@ -22,6 +23,7 @@
?define NOTIFY_COPY_END "Notify when copying finished" ?define NOTIFY_COPY_END "Notify when copying finished"
?define CANCEL_T "Cancel" ?define CANCEL_T "Cancel"
?define APPLY_T "Apply" ?define APPLY_T "Apply"
?define T_DOUBLE_CLICK "Time double click (in hundredths)"
#endif #endif
char confir_section = "Config"; char confir_section = "Config";
@ -33,11 +35,16 @@ void settings_dialog()
unsigned int key; unsigned int key;
proc_info settings_form; proc_info settings_form;
if (active_settings) ExitProcess(); if (active_settings){cmd_free = 4;ExitProcess();}
active_settings=1; active_settings=1;
SetEventMask(0x27);
loop() switch(WaitEvent()) loop(){
switch(WaitEvent())
{ {
case evMouse:
break;
case evButton: case evButton:
id=GetButtonID(); id=GetButtonID();
if (id==10) if (id==10)
@ -45,11 +52,13 @@ void settings_dialog()
SaveIniSettings(); SaveIniSettings();
active_settings=0; active_settings=0;
action_buf = 300; action_buf = 300;
cmd_free = 4;
ExitProcess(); ExitProcess();
} }
if (id==1) || (id==11) if (id==1) || (id==11)
{ {
active_settings=0; active_settings=0;
cmd_free = 4;
ExitProcess(); ExitProcess();
} }
if (id==5) if (id==5)
@ -63,6 +72,8 @@ void settings_dialog()
if (id==23) use_big_fonts ^= 1; if (id==23) use_big_fonts ^= 1;
if (id==25) files.line_h++; if (id==25) files.line_h++;
if (id==26) && (files.line_h>8) files.line_h--; if (id==26) && (files.line_h>8) files.line_h--;
if (id==27) MOUSE_TIME++;
if (id==28) && (MOUSE_TIME>30) MOUSE_TIME--;
DrawSettingsCheckBoxes(); DrawSettingsCheckBoxes();
break; break;
@ -72,17 +83,19 @@ void settings_dialog()
{ {
active_settings = 0; active_settings = 0;
action_buf = 300; action_buf = 300;
cmd_free = 4;
ExitProcess(); ExitProcess();
} }
break; break;
case evReDraw: case evReDraw:
DefineAndDrawWindow(Form.left + 100, 150, 300, 232+GetSkinHeight(),0x34,sc.work,TITLE_SETT); DefineAndDrawWindow(Form.left + Form.width/2, Form.top + Form.height/2 - 75, 300, 232+GetSkinHeight(),0x34,sc.work,TITLE_SETT);
GetProcessInfo(#settings_form, SelfInfo); GetProcessInfo(#settings_form, SelfInfo);
DrawSettingsCheckBoxes(); DrawSettingsCheckBoxes();
DrawFlatButton(9, 138, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS); DrawFlatButton(9, 168, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS);
DrawFlatButton(128, settings_form.cheight - 34, 70, 22, 10, 0xE4DFE1, APPLY_T); DrawFlatButton(128, settings_form.cheight - 30, 70, 22, 10, 0xE4DFE1, APPLY_T);
DrawFlatButton(208, settings_form.cheight - 34, 70, 22, 11, 0xE4DFE1, CANCEL_T); DrawFlatButton(208, settings_form.cheight - 30, 70, 22, 11, 0xE4DFE1, CANCEL_T);
}
} }
} }
@ -93,6 +106,7 @@ void DrawSettingsCheckBoxes()
CheckBox2(10, 55, 22, NOTIFY_COPY_END, info_after_copy); CheckBox2(10, 55, 22, NOTIFY_COPY_END, info_after_copy);
CheckBox2(10, 77, 23, USE_BIG_FONTS, use_big_fonts); CheckBox2(10, 77, 23, USE_BIG_FONTS, use_big_fonts);
MoreLessBox(10, 104, 18, 25, 26, #sc, files.line_h, LIST_LINE_HEIGHT); MoreLessBox(10, 104, 18, 25, 26, #sc, files.line_h, LIST_LINE_HEIGHT);
MoreLessBox(10, 134, 18, 27, 28, #sc, MOUSE_TIME, T_DOUBLE_CLICK);
} }
@ -127,6 +141,7 @@ void SaveIniSettings()
ini_set_int stdcall (eolite_ini_path, #confir_section, "InfoAfterCopy", info_after_copy); ini_set_int stdcall (eolite_ini_path, #confir_section, "InfoAfterCopy", info_after_copy);
ini_set_int stdcall (eolite_ini_path, #confir_section, "UseBigFonts", use_big_fonts); ini_set_int stdcall (eolite_ini_path, #confir_section, "UseBigFonts", use_big_fonts);
ini_set_int stdcall (eolite_ini_path, #confir_section, "LineHeight", files.line_h); ini_set_int stdcall (eolite_ini_path, #confir_section, "LineHeight", files.line_h);
ini_set_int stdcall (eolite_ini_path, #confir_section, "TimeDoubleClick", MOUSE_TIME);
} }
@ -137,11 +152,9 @@ void Write_Error(int error_number)
dword ii; dword ii;
if (files.current>=0) Line_ReDraw(0xFF0000, files.current); if (files.current>=0) Line_ReDraw(0xFF0000, files.current);
pause(5); pause(5);
strcpy(#error_message, "\"Eolite\n"); sprintf(#error_message,"\"%s\n%s\" -%s","Eolite",get_error(error_number),"tE");
ii = get_error(error_number);
strcat(#error_message, ii);
strcat(#error_message, "\" -tE");
notify(#error_message); notify(#error_message);
} }

View File

@ -1,12 +1,32 @@
char a_libdir[43] = "/sys/lib/\0"; char a_libdir[43] = "/sys/lib/\0";
:inline void error_init(dword text)
{
dword l,ll;
dword TEXT_ERROR = malloc(1024);
#ifdef LANG_RUS
strcpy(TEXT_ERROR,"'Žè¨¡ª  ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ `");
#elif LANG_EST
strcpy(TEXT_ERROR,"'Viga teegi laadimisel `");
#else
strcpy(TEXT_ERROR,"'Error while loading library `");
#endif
ll = strlen(TEXT_ERROR);
strcpy(TEXT_ERROR+ll,text);
l = strlen(text);
strncpy(TEXT_ERROR+ll+l,"`' -E",4);
notify(TEXT_ERROR);
free(TEXT_ERROR);
ExitProcess();
}
// stdcall with 1 parameter // stdcall with 1 parameter
void dll_Load() { void dll_Load() {
asm { asm {
push ebp push ebp
mov ebp, esp mov ebp, esp
mov esi, SSDWORD[EBP+8] mov esi, SSDWORD[EBP+8]
@next_lib: @next_lib:
mov edx, DSDWORD[ESI] mov edx, DSDWORD[ESI]
or edx, edx or edx, edx
jz exit jz exit
@ -213,4 +233,5 @@ int load_dll2(dword dllname, import_table, byte need_init)
return 0; return 0;
@exit01: @exit01:
return -1; return -1;
//error_init(dllname);
} }

View File

@ -31,8 +31,9 @@
}; };
:void DrawDate(dword x, y, color, dword in_date) :void DrawDate(dword x, y, color, in_date)
{ {
//char text[10];
EDI = in_date; EDI = in_date;
EAX = 47; EAX = 47;
EBX = 2<<16; EBX = 2<<16;
@ -47,6 +48,9 @@
EBX = 4<<16; EBX = 4<<16;
ECX = EDI.date.year; ECX = EDI.date.year;
$int 0x40; $int 0x40;
//sprintf(#text,"%d.%d.%d",EDI.date.day,EDI.date.month,EDI.date.year);
//WriteText(x, y, 0x80, 0x80<<24+color, #text);
} }
@ -297,16 +301,17 @@ enum
return #absolute_path; return #absolute_path;
} }
:dword ConvertSize(unsigned int bytes) :dword ConvertSize(dword bytes)
{ {
unsigned char size_prefix[8], size_nm[4]; byte size_prefix[8], size_nm[4];
if (bytes>=1073741824) strcpy(#size_nm, " Gb"); if (bytes>=1073741824) strcpy(#size_nm, "Gb");
else if (bytes>=1048576) strcpy(#size_nm, " Mb"); else if (bytes>=1048576) strcpy(#size_nm, "Mb");
else if (bytes>=1024) strcpy(#size_nm, " Kb"); else if (bytes>=1024) strcpy(#size_nm, "Kb");
else strcpy(#size_nm, " b "); else strcpy(#size_nm, "b");
while (bytes>1023) bytes/=1024; while (bytes>1023) bytes/=1024;
itoa_(#size_prefix, bytes); itoa_(#size_prefix, bytes);
strcat(#size_prefix, #size_nm); strcat(#size_prefix, #size_nm);
//sprintf(#size_prefix,"%s","123");
return #size_prefix; return #size_prefix;
} }

View File

@ -1,5 +1,7 @@
//CODED by Veliant, Leency, Nable. GNU GPL licence. //CODED by Veliant, Leency, Nable. GNU GPL licence.
#define LIB_KOLIBRI_H
#startaddress 0 #startaddress 0
#code32 TRUE #code32 TRUE
@ -23,9 +25,11 @@ char program_path[4096];
#define evReDraw 1 #define evReDraw 1
#define evKey 2 #define evKey 2
#define evButton 3 #define evButton 3
#define evDesktop 5
#define evMouse 6 #define evMouse 6
#define evIPC 7
#define evNetwork 8 #define evNetwork 8
#define evDebug 9
//Button options //Button options
#define BT_DEL 0x80000000 #define BT_DEL 0x80000000
@ -33,8 +37,9 @@ char program_path[4096];
#define BT_NOFRAME 0x20000000 #define BT_NOFRAME 0x20000000
//Button mouse //Button mouse
#define MOUSE_LEFT 001b #define MOUSE_LEFT 001b
#define MOUSE_RIGHT 010b #define MOUSE_RIGHT 010b
#define MOUSE_LR 011b
#define MOUSE_CENTER 100b #define MOUSE_CENTER 100b
//ASCII KEYS //ASCII KEYS
@ -55,7 +60,18 @@ char program_path[4096];
#define ASCII_KEY_PGDN 183 #define ASCII_KEY_PGDN 183
#define ASCII_KEY_PGUP 184 #define ASCII_KEY_PGUP 184
//allow event mask
#define EVENT_MASK_REDRAW 000000001b
#define EVENT_MASK_KEYBOARD 000000010b
#define EVENT_MASK_BUTTONS 000000100b
#define EVENT_MASK_DESKTOP 000010000b
#define EVENT_MASK_MOUSE 000100000b
#define EVENT_MASK_IPC 001000000b
#define EVENT_MASK_NETWORK 010000000b
#define EVENT_MASK_DEBUG 100000000b
//ARGS FUNCTION
#define END_ARGS 0xFF00FF
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
:struct raw_image { :struct raw_image {
@ -82,9 +98,81 @@ char program_path[4096];
dword __TMP_TIME,MOUSE_TIME; dword __TMP_TIME,MOUSE_TIME;
:struct mouse :struct mouse
{ {
signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,down,up,move,click,dblclick; signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,down,up,move,click,dblclick,left,top;
dword handle,_;
byte cmd;
void clearTime();
void get(); void get();
void set();
void center();
dword hide();
void slider();
void show();
}; };
:void mouse::clearTime()
{
tmp_time = GetStartTime()+MOUSE_TIME;
}
:void mouse::show()
{
if(!handle)return;
ECX = handle;
EAX = 37;
EBX = 5;
$int 0x40;
}
:dword mouse::hide()
{
if(!_)
{
EAX = 68;
EBX = 12;
ECX = 32*32*4;
$int 0x40
ECX = EAX;
_ = EAX;
} else ECX = _;
EAX = 37;
EBX = 4;
DX = 2;
$int 0x40;
handle = EAX;
ECX = EAX;
EAX = 37;
EBX = 5;
$int 0x40;
handle = EAX;
}
//set new attributes mouse
:void mouse::set()
{
if((xx!=x)||(yy!=y))
{
EAX = 18;
EBX = 19;
ECX = 4;
EDX = (x<<16)+y;
$int 0x40
//move = true;
}
if((key)||(lkm|mkm|pkm))&&(down|up|click|dblclick|move)
{
if(lkm|mkm|pkm)key=(lkm)|(pkm<<1)|(2<<mkm);
EAX = 18;
EBX = 19;
ECX = key;
EDX = (x<<16)+y;
$int 0x40
}
}
:void mouse::center()
{
EAX = 18;
EBX = 15;
$int 0x40
}
//get new attributes mouse //get new attributes mouse
:void mouse::get() :void mouse::get()
@ -115,12 +203,14 @@ dword __TMP_TIME,MOUSE_TIME;
mkm = ECX; mkm = ECX;
//when you release the mouse button //when you release the mouse button
if((down)&&!(key)){ // Mouse Up Event
if((cmd)&&!(key)){
up = true; up = true;
down = false; down = false;
if(!move) click = true; if(!move) click = true;
move = false;
__TMP_TIME = GetStartTime(); __TMP_TIME = GetStartTime();
if(__TMP_TIME-tmp_time<=MOUSE_TIME) dblclick = true; if(__TMP_TIME-tmp_time<=MOUSE_TIME){ dblclick = true;click = false; }
tmp_time = __TMP_TIME; tmp_time = __TMP_TIME;
//returns the key code //returns the key code
key = tmp; key = tmp;
@ -129,25 +219,25 @@ dword __TMP_TIME,MOUSE_TIME;
pkm >>= 1; pkm >>= 1;
mkm = 4&tmp; mkm = 4&tmp;
mkm >>= 2; mkm >>= 2;
cmd = false;
} }
//when you press the mouse button //when you press the mouse button
// Mouse Down Event/Move Event
else { else {
up = false; up = false;
click = false; click = false;
dblclick = false; dblclick = false;
if(key) down = false;
// Mouse Move Event
if((xx!=x)||(yy!=y))
{ {
down = true;
tmp = key;
}
else down = false;
if((xx!=x)||(yy!=y)){
move = true; move = true;
xx = x; xx = x;
yy = y; yy = y;
} }
else move = false; else move = false;
if(key)if(!cmd) {down = true;cmd = true;tmp=key;}
} }
//scroll //scroll
@ -161,6 +251,33 @@ dword __TMP_TIME,MOUSE_TIME;
vert = EBX; vert = EBX;
} }
:void mouse::slider()
{
signed _x,_y;
if(!handle)hide();
get();
_x = x;_y = y;
pause(5);
get();
left = _x - x;
top = _y - y;
center();
get();
_x = x;_y = y;
pause(5);
}
:struct keyboard
{
signed key;
byte down,up,press;
void get(void);
};
:void keyboard::get(void)
{
}
:struct system_colors :struct system_colors
{ {
@ -179,11 +296,12 @@ dword __TMP_TIME,MOUSE_TIME;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
dword wait_event_code;
inline fastcall dword WaitEvent() inline fastcall dword WaitEvent()
{ {
$mov eax,10 $mov eax,10
$int 0x40 $int 0x40
wait_event_code = EAX;
} }
inline fastcall dword CheckEvent() inline fastcall dword CheckEvent()
@ -192,13 +310,13 @@ inline fastcall dword CheckEvent()
$int 0x40 $int 0x40
} }
inline fastcall dword WaitEventTimeout( EBX) inline fastcall dword WaitEventTimeout(EBX)
{ {
$mov eax,23 $mov eax,23
$int 0x40 $int 0x40
} }
inline fastcall SetEventMask( EBX) inline fastcall SetEventMask(EBX)
{ {
$mov eax,40 $mov eax,40
$int 0x40 $int 0x40
@ -236,7 +354,7 @@ inline fastcall int GetFullKey()
} }
inline fastcall pause( EBX) inline fastcall pause(EBX)
{ {
$mov eax, 5 $mov eax, 5
$int 0x40 $int 0x40
@ -257,7 +375,7 @@ inline fastcall dword GetFreeRAM()
//return eax = ðàçìåð ñâîáîäíîé ïàìÿòè â êèëîáàéòàõ //return eax = ðàçìåð ñâîáîäíîé ïàìÿòè â êèëîáàéòàõ
} }
inline fastcall dword LoadDriver( ECX) //ECX - èìÿ äðàéâåðà inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà
{ {
$mov eax, 68 $mov eax, 68
$mov ebx, 16 $mov ebx, 16
@ -265,7 +383,7 @@ inline fastcall dword LoadDriver( ECX) //ECX -
//return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà //return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà
} }
inline fastcall dword RuleDriver( ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó
{ {
$mov eax, 68 $mov eax, 68
$mov ebx, 17 $mov ebx, 17
@ -288,7 +406,7 @@ struct proc_info
byte reserved[1024-71-8]; byte reserved[1024-71-8];
}; };
inline fastcall void GetProcessInfo( EBX, ECX) inline fastcall void GetProcessInfo(EBX, ECX)
{ {
$mov eax,9; $mov eax,9;
$int 0x40 $int 0x40
@ -337,7 +455,7 @@ inline fastcall int MinimizeWindow()
$int 0x40 $int 0x40
} }
inline fastcall int CreateThread( ECX,EDX) inline fastcall int CreateThread(ECX,EDX)
{ {
$mov eax,51 $mov eax,51
$mov ebx,1 $mov ebx,1
@ -522,9 +640,10 @@ void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword Windo
EBX = 1; EBX = 1;
$int 0x40 $int 0x40
EAX = 0; $xor EAX,EAX
EBX = x << 16 + size_w; EBX = x << 16 + size_w;
ECX = y << 16 + size_h; ECX = y << 16 + size_h;
EDX = WindowType << 24 | WindowAreaColor; EDX = WindowType << 24 | WindowAreaColor;
$int 0x40 $int 0x40
@ -664,12 +783,40 @@ inline fastcall dword GetStartTime()
$int 0x40 $int 0x40
} }
:dword ALERT_TEXT;
:void dialog_alert()
{
byte id;
loop()switch(WaitEvent())
{
case evReDraw:
DefineAndDrawWindow(215,100,250,200,0x34,0xFFFFFF,"Alert");
WriteTextB(5,5,0x90,0x0,ALERT_TEXT);
break;
case evButton:
id=GetButtonID();
if (id==1) ExitProcess();
break;
}
}
:dword alert(dword text)
{
dword mem = malloc(4096);
ALERT_TEXT = text;
CreateThread(#dialog_alert,mem+4092);
return mem;
}
dword __generator; // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë dword __generator; // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
dword program_path_length;
//The initialization of the initial data before running //The initialization of the initial data before running
void load_init_main() void load_init_main()
{ {
MOUSE_TIME = 50; //Default 50 ms. //program_path_length = strlen(program_path);
MOUSE_TIME = 50; //Default 500 ms.
__generator = GetStartTime(); __generator = GetStartTime();
main(); main();
} }

View File

@ -3,17 +3,17 @@
dword libHTTP = #alibHTTP; dword libHTTP = #alibHTTP;
char alibHTTP[23] = "/sys/lib/http.obj\0"; char alibHTTP[23] = "/sys/lib/http.obj\0";
dword http_lib_init = #aLib_init; dword http_lib_init = #aLib_init;
dword http_get = #aHTTPget; dword http_get = #aHTTPget;
dword http_head = #aHTTPhead; dword http_head = #aHTTPhead;
dword http_post = #aHTTPpost; dword http_post = #aHTTPpost;
dword http_find_header_field = #aFHF; dword http_find_header_field = #aFHF;
dword http_send = #aHTTPsend; dword http_send = #aHTTPsend;
dword http_receive = #aHTTPreceive; dword http_receive = #aHTTPreceive;
dword http_disconnect = #aHTTPdisconnect; dword http_disconnect = #aHTTPdisconnect;
dword http_free = #aHTTPfree; dword http_free = #aHTTPfree;
dword uri_escape = #aURIescape; dword uri_escape = #aURIescape;
dword uri_unescape = #aURIunescape; dword uri_unescape = #aURIunescape;
$DD 2 dup 0 $DD 2 dup 0
char aLib_init[9] = "lib_init\0"; char aLib_init[9] = "lib_init\0";
@ -61,3 +61,8 @@ struct http_msg{
dword content_received; dword content_received;
char http_header; char http_header;
}; };
:dword file_get_contents(dword url,...)
{
http_get(url,FLAG_HTTP11,"");
}

View File

@ -18,6 +18,12 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*******************************************************************************/ *******************************************************************************/
#define MASK_RAND 123456789
#define IQ_RAND 12773
#define IA_RAND 16807
#define IR_RAND 2836
#define IM_RAND 2147483647
#define AM_RAND (1./2147483647)
inline fastcall int random( ECX) inline fastcall int random( ECX)
// get pseudo-random number - ïîëó÷èòü ïñåâäîñëó÷àéíîå ÷èñëî // get pseudo-random number - ïîëó÷èòü ïñåâäîñëó÷àéíîå ÷èñëî
@ -40,6 +46,40 @@ inline fastcall int random( ECX)
$pop ebx $pop ebx
} }
:inline long unirand0(void)
{
long k,ans,tmp,save;
save = __generator;
__generator^=MASK_RAND; /* avoid __generator==0 */
k=__generator/IQ_RAND;
tmp=__generator-k*IQ_RAND;
__generator*=IA_RAND*tmp;
__generator-=IR_RAND*k;
if(__generator<0) __generator+=IM_RAND;
if(save == __generator) return unirand0();
ans=__generator;
__generator^=MASK_RAND; /* restore unmasked dummy */
return ans;
}
:long RAND_A,RAND_C,RAND_TMP;
:inline long rand(signed long x1,x2)
{
long tmp,xx;
RAND_A = __generator;
__generator = RAND_A*__generator+RAND_C;
RAND_C = __generator^RAND_A;
RAND_C>>=1;
RAND_A<<=1;
__generator^=RAND_A;
xx=x2;
if(x1<0)xx+=-x1;
tmp = __generator%xx;
if(tmp<0)tmp=-tmp;
tmp+=x1;
return tmp;
}
inline fastcall randomize() inline fastcall randomize()
// initialize random number __generator - èíèöèàëèçèðîâàòü ãåíåðàòîð ñëó÷àéíûõ ÷èñåë // initialize random number __generator - èíèöèàëèçèðîâàòü ãåíåðàòîð ñëó÷àéíûõ ÷èñåë
{ {
@ -49,6 +89,7 @@ inline fastcall randomize()
int 0x40 int 0x40
ror eax,16 ror eax,16
} }
//if(EAX == __generator)return randomize();
__generator = EAX; __generator = EAX;
} }

View File

@ -178,24 +178,31 @@ L2:
$jnz L2 $jnz L2
} }
inline dword strncpy(dword text1, text2, signed len) :inline dword strncpy(dword text1, text2, signed len)
signed o1,o2; signed o1,o2;
{ {
if(!text1)||(!len) return text1;
if(len<4)
{
o2 = len;
goto RUN_BYTE;
}
o1 = len/4; o1 = len/4;
o2 = len-4*o1; o2 = len-4*o1;
while(o1){ while(o1){
ESDWORD[text1] = ESDWORD[text2]; DSDWORD[text1] = DSDWORD[text2];
text1 += 4; text1 += 4;
text2 += 4; text2 += 4;
$dec o1 $dec o1
} }
RUN_BYTE:
while(o2){ while(o2){
ESBYTE[text1] = ESBYTE[text2]; DSBYTE[text1] = DSBYTE[text2];
$inc text1 $inc text1
$inc text2 $inc text2
$dec o2 $dec o2
} }
ESBYTE[text1] = 0; DSBYTE[text1] = 0;
return text1; return text1;
} }
@ -339,25 +346,26 @@ void strncat(dword text1, text2, signed len)
signed o1,o2; signed o1,o2;
char s; char s;
{ {
s = ESBYTE[text1]; s = DSBYTE[text1];
while(s){ while(s){
$inc text1 $inc text1
s = ESBYTE[text1]; s = DSBYTE[text1];
} }
o1 = len/4; o1 = len/4;
o2 = len-4*o1; o2 = len-4*o1;
while(o1){ while(o1){
ESDWORD[text1] = ESDWORD[text2]; DSDWORD[text1] = DSDWORD[text2];
text1 += 4; text1 += 4;
text2 += 4; text2 += 4;
$dec o1 $dec o1
} }
while(o2){ while(o2){
ESBYTE[text1] = ESBYTE[text2]; DSBYTE[text1] = DSBYTE[text2];
$inc text1 $inc text1
$inc text2 $inc text2
$dec o2 $dec o2
} }
DSBYTE[text1] = 0;
} }
inline fastcall void chrcat(ESI, BL) inline fastcall void chrcat(ESI, BL)
@ -614,22 +622,23 @@ F3:
inline dword itoa(signed long number) inline dword itoa(signed long number)
{ {
unsigned char buf[11]; unsigned char buf[11];
dword ret; dword ret,p;
byte cmd; byte cmd;
long mask,tmp; long mask,tmp;
mask = 1000000000; mask = 1000000000;
cmd = true; cmd = true;
p = #buf;
if(!number){ if(!number){
ESBYTE[buf] = '0'; ESBYTE[p] = '0';
ESBYTE[buf+1] = 0; ESBYTE[p+1] = 0;
return buf; return p;
} }
ret = buf; ret = p;
if(number<0) if(number<0)
{ {
$neg number $neg number
ESBYTE[buf] = '-'; ESBYTE[p] = '-';
$inc buf $inc p
} }
while(mask) while(mask)
{ {
@ -638,22 +647,22 @@ inline dword itoa(signed long number)
if(cmd){ if(cmd){
if(tmp){ if(tmp){
ESBYTE[buf] = tmp + '0'; ESBYTE[p] = tmp + '0';
$inc buf $inc p
cmd = false; cmd = false;
} }
} }
else { else {
ESBYTE[buf] = tmp + '0'; ESBYTE[p] = tmp + '0';
$inc buf $inc p
} }
mask /= 10; mask /= 10;
} }
ESBYTE[buf] = 0; ESBYTE[p] = 0;
return ret; return ret;
} }
inline fastcall itoa_(signed int EDI, ESI) :inline fastcall itoa_(signed int EDI, ESI)
{ {
$pusha $pusha
EBX = EDI; EBX = EDI;
@ -686,15 +695,27 @@ F3:
return EBX; return EBX;
} }
inline dword strdup(dword text) :inline dword memchr(dword s,int c,signed len)
{
if(!len) return NULL;
do {
if(DSBYTE[s] == c) return s;
$inc s
$dec len
} while(len);
return NULL;
}
:inline dword strdup(dword text)
{ {
dword l = strlen(text); dword l = strlen(text);
dword ret = malloc(l+1); dword ret = malloc(l+1);
if(!ret) return NULL;
strncpy(ret,text,l); strncpy(ret,text,l);
return ret; return ret;
} }
inline dword strndup(dword str, signed maxlen) :inline dword strndup(dword str, signed maxlen)
{ {
dword copy,len; dword copy,len;
@ -702,12 +723,96 @@ inline dword strndup(dword str, signed maxlen)
copy = malloc(len + 1); copy = malloc(len + 1);
if (copy != NULL) if (copy != NULL)
{ {
memcpy(copy, str, len); strncpy(copy, str, len);
DSBYTE[len+copy] = '\0'; DSBYTE[len+copy] = '\0';
} }
return copy; return copy;
} }
:inline cdecl int sprintf(dword buf, format,...)
{
byte s;
char X[10];
dword ret, tmp, l;
dword arg = #format;
ret = buf;
s = DSBYTE[format];
while(s){
if(s=='%'){
arg+=4;
tmp = DSDWORD[arg];
if(tmp==END_ARGS)goto END_FUNC_SPRINTF;
$inc format
s = DSBYTE[format];
if(!s)goto END_FUNC_SPRINTF;
switch(s)
{
case 's':
l = tmp;
s = DSBYTE[tmp];
while(s)
{
DSBYTE[buf] = s;
$inc tmp
$inc buf
s = DSBYTE[tmp];
}
break;
case 'c':
DSBYTE[buf] = tmp;
$inc buf
break;
case 'u': //if(tmp<0)return ret;
case 'd':
case 'i':
tmp = itoa(tmp);
if(!DSBYTE[tmp])goto END_FUNC_SPRINTF;
l = strlen(tmp);
strncpy(buf,tmp,l);
buf += l;
break;
case 'a':
case 'A':
strncpy(buf,"0x00000000",10);
buf+=10;
l=buf;
while(tmp)
{
$dec buf
s=tmp&0xF;
if(s>9)DSBYTE[buf]='A'+s-10;
else DSBYTE[buf]='0'+s;
tmp>>=4;
}
buf=l;
break;
case 'p':
tmp = itoa(#tmp);
if(!DSBYTE[tmp])goto END_FUNC_SPRINTF;
l = strlen(tmp);
strncpy(buf,tmp,l);
buf += l;
break;
case '%':
DSBYTE[buf] = '%';
$inc buf
break;
default:
goto END_FUNC_SPRINTF;
}
}
else {
DSBYTE[buf] = s;
$inc buf
}
$inc format
s = DSBYTE[format];
}
END_FUNC_SPRINTF:
DSBYTE[buf] = 0;
return buf-ret;
}
void debugi(dword d_int) void debugi(dword d_int)
{ {
char tmpch[12]; char tmpch[12];