2012-03-22 14:33:15 +01:00
|
|
|
|
//CODED by Veliant, Leency 2008-2012. GNU GPL licence.
|
2010-12-19 08:29:49 +01:00
|
|
|
|
|
|
|
|
|
#startaddress 0
|
|
|
|
|
#code32 TRUE
|
|
|
|
|
|
|
|
|
|
byte os_name[8] = {'M','E','N','U','E','T','0','1'};
|
|
|
|
|
dword os_version = 0x00000001;
|
|
|
|
|
dword start_addr = #main;
|
|
|
|
|
dword final_addr = #stop+32;
|
|
|
|
|
dword alloc_mem = 0x00100000;
|
|
|
|
|
dword x86esp_reg = 0x00100000; // 0x0007fff0;
|
|
|
|
|
dword I_Param = #param;
|
2011-08-18 15:32:06 +02:00
|
|
|
|
dword I_Path = #program_path;
|
2011-10-05 11:50:43 +02:00
|
|
|
|
|
2011-08-18 15:32:06 +02:00
|
|
|
|
char param[4096]="";
|
|
|
|
|
char program_path[4096]="";
|
|
|
|
|
|
2010-12-19 08:29:49 +01:00
|
|
|
|
|
|
|
|
|
//Events
|
|
|
|
|
#define evMouse 6
|
|
|
|
|
#define evButton 3
|
|
|
|
|
#define evKey 2
|
|
|
|
|
#define evReDraw 1
|
|
|
|
|
|
|
|
|
|
//Button options
|
|
|
|
|
#define BT_DEL 0x80000000
|
|
|
|
|
#define BT_HIDE 0x40000000
|
|
|
|
|
#define BT_NOFRAME 0x20000000
|
|
|
|
|
|
|
|
|
|
#define OLD -1
|
|
|
|
|
#define true 1
|
|
|
|
|
#define false 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct mouse{
|
2011-08-27 23:37:45 +02:00
|
|
|
|
unsigned int x,y,lkm,pkm,hor,vert;
|
|
|
|
|
void get();
|
2010-12-19 08:29:49 +01:00
|
|
|
|
};
|
|
|
|
|
|
2011-10-05 11:50:43 +02:00
|
|
|
|
inline fastcall int TestBit(EAX, CL)
|
2011-08-27 23:37:45 +02:00
|
|
|
|
{
|
|
|
|
|
$shr eax,cl
|
|
|
|
|
$and eax,1
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-19 08:29:49 +01:00
|
|
|
|
void mouse::get()
|
|
|
|
|
{
|
|
|
|
|
EAX = 37;
|
|
|
|
|
EBX = 1;
|
|
|
|
|
$int 0x40
|
|
|
|
|
$mov ebx, eax
|
|
|
|
|
$shr eax, 16
|
|
|
|
|
$and ebx,0x0000FFFF
|
|
|
|
|
x = EAX;
|
|
|
|
|
y = EBX;
|
2011-08-27 23:37:45 +02:00
|
|
|
|
|
2010-12-19 08:29:49 +01:00
|
|
|
|
EAX = 37;
|
|
|
|
|
EBX = 2;
|
|
|
|
|
$int 0x40
|
|
|
|
|
$mov ebx, eax
|
|
|
|
|
$and eax, 0x00000001
|
|
|
|
|
$shr ebx, 1
|
|
|
|
|
$and ebx, 0x00000001
|
|
|
|
|
lkm = EAX;
|
|
|
|
|
pkm = EBX;
|
2011-08-27 23:37:45 +02:00
|
|
|
|
|
|
|
|
|
EAX = 37; //scroll
|
2010-12-19 08:29:49 +01:00
|
|
|
|
EBX = 7;
|
|
|
|
|
$int 0x40
|
|
|
|
|
$mov ebx, eax
|
|
|
|
|
$shr eax, 16
|
|
|
|
|
$and ebx,0x0000FFFF
|
|
|
|
|
//hor = EAX;
|
|
|
|
|
vert = EBX;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
struct proc_info{
|
|
|
|
|
dword use_cpu;
|
|
|
|
|
word pos_in_stack,num_slot,rezerv1;
|
|
|
|
|
char name[11];
|
|
|
|
|
char rezerv2;
|
|
|
|
|
dword adress,use_memory,ID,left,top,width,height;
|
|
|
|
|
word status_slot,rezerv3;
|
|
|
|
|
dword work_left,work_top,work_width,work_height;
|
|
|
|
|
char status_window;
|
|
|
|
|
void GetInfo(dword ECX);
|
|
|
|
|
byte reserved[1024-71];
|
|
|
|
|
#define SelfInfo -1
|
|
|
|
|
};
|
|
|
|
|
|
2011-08-27 23:37:45 +02:00
|
|
|
|
void proc_info::GetInfo(dword EBX, ECX)
|
2010-12-19 08:29:49 +01:00
|
|
|
|
{
|
|
|
|
|
EAX = 9;
|
|
|
|
|
$int 0x40
|
|
|
|
|
}
|
2011-08-27 23:37:45 +02:00
|
|
|
|
|
2011-10-05 11:50:43 +02:00
|
|
|
|
inline fastcall int GetSlot(dword ECX)
|
2011-08-27 23:37:45 +02:00
|
|
|
|
{
|
|
|
|
|
EAX = 18;
|
|
|
|
|
EBX = 21;
|
|
|
|
|
$int 0x40
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-05 11:50:43 +02:00
|
|
|
|
inline fastcall int ActiveProcess()
|
2011-08-27 23:37:45 +02:00
|
|
|
|
{
|
|
|
|
|
EAX = 18;
|
|
|
|
|
EBX = 7;
|
|
|
|
|
$int 0x40
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-19 08:29:49 +01:00
|
|
|
|
//-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
inline fastcall dword WaitEvent(){
|
2011-08-27 23:37:45 +02:00
|
|
|
|
EAX = 10; // wait here for event
|
|
|
|
|
$int 0x40
|
2010-12-19 08:29:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline fastcall void SetEventMask(dword EBX)
|
|
|
|
|
{
|
2011-08-27 23:37:45 +02:00
|
|
|
|
EAX = 40;
|
|
|
|
|
$int 0x40
|
2010-12-19 08:29:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
2011-08-27 23:37:45 +02:00
|
|
|
|
inline fastcall word GetKey(){ //Gluk fix
|
|
|
|
|
$push edx
|
|
|
|
|
@getkey:
|
|
|
|
|
$mov eax,2
|
|
|
|
|
$int 0x40
|
|
|
|
|
$cmp eax,1
|
|
|
|
|
$jne getkeyi
|
|
|
|
|
$mov ah,dh
|
|
|
|
|
$jmp getkeyii //jz?
|
|
|
|
|
@getkeyi:
|
|
|
|
|
$mov dh,ah
|
|
|
|
|
$jmp getkey
|
|
|
|
|
@getkeyii:
|
|
|
|
|
$pop edx
|
|
|
|
|
EAX = EAX >> 8;
|
2010-12-19 08:29:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline fastcall word GetButtonID(){
|
2011-08-27 23:37:45 +02:00
|
|
|
|
EAX = 17; // Get ID
|
|
|
|
|
$int 0x40
|
|
|
|
|
EAX = EAX >> 8;
|
2010-12-19 08:29:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline fastcall void ExitProcess(){
|
2011-08-27 23:37:45 +02:00
|
|
|
|
EAX = -1; // close this program
|
|
|
|
|
$int 0x40
|
2010-12-19 08:29:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline fastcall void Pause(dword EBX){
|
|
|
|
|
$mov eax, 5 //<2F><>㧠, <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> ᥪ㭤<E1A5AA>
|
|
|
|
|
$int 0x40
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2011-10-05 11:50:43 +02:00
|
|
|
|
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,
|
|
|
|
|
dword mainAreaColour,byte headerType,dword headerColour,EDI)
|
2010-12-19 08:29:49 +01:00
|
|
|
|
{
|
2011-10-05 11:50:43 +02:00
|
|
|
|
EAX = 12; // function 12:tell os about windowdraw
|
2011-09-26 16:44:58 +02:00
|
|
|
|
EBX = 1;
|
|
|
|
|
$int 0x40
|
2011-09-26 16:30:45 +02:00
|
|
|
|
|
2010-12-19 08:29:49 +01:00
|
|
|
|
EBX = x << 16 + sizeX;
|
|
|
|
|
ECX = y << 16 + sizeY;
|
2011-10-05 11:50:43 +02:00
|
|
|
|
EDX = mainAreaType << 24 | mainAreaColour;
|
|
|
|
|
ESI = headerType << 24 | headerColour;
|
2010-12-19 08:29:49 +01:00
|
|
|
|
$xor eax,eax
|
|
|
|
|
$int 0x40
|
2011-10-05 11:50:43 +02:00
|
|
|
|
|
|
|
|
|
EAX = 12; // function 12:tell os about windowdraw
|
2011-09-26 16:44:58 +02:00
|
|
|
|
EBX = 2;
|
|
|
|
|
$int 0x40
|
2010-12-19 08:29:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline fastcall void CreateThread(dword ECX,EDX)
|
|
|
|
|
{
|
|
|
|
|
EAX = 51;
|
|
|
|
|
EBX = 1;
|
|
|
|
|
$int 0x40
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline fastcall void DrawTitle(dword ECX){
|
|
|
|
|
EAX = 71;
|
|
|
|
|
EBX = 1;
|
|
|
|
|
$int 0x40;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline fastcall dword GetSkinWidth(){
|
|
|
|
|
EAX = 48;
|
|
|
|
|
EBX = 4;
|
|
|
|
|
$int 0x40
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline fastcall void MoveSize(dword EBX,ECX,EDX,ESI){
|
|
|
|
|
EAX = 67;
|
|
|
|
|
$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(dword ESI,EDI)
|
|
|
|
|
{
|
|
|
|
|
$cld
|
|
|
|
|
l1:
|
|
|
|
|
$lodsb
|
|
|
|
|
$stosb
|
|
|
|
|
$test al,al
|
|
|
|
|
$jnz l1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char buffer[11]="";
|
|
|
|
|
inline fastcall dword IntToStr(dword 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 int strcmp(ESI, EDI)
|
|
|
|
|
{
|
|
|
|
|
loop()
|
|
|
|
|
{
|
|
|
|
|
IF (DSBYTE[ESI]<DSBYTE[EDI]) RETURN -1;
|
|
|
|
|
IF (DSBYTE[ESI]>DSBYTE[EDI]) RETURN 1;
|
|
|
|
|
IF (DSBYTE[ESI]=='\0') RETURN 0;
|
|
|
|
|
ESI++;
|
|
|
|
|
EDI++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline fastcall unsigned int find_symbol(ESI,BL)
|
|
|
|
|
{
|
|
|
|
|
int jj=0, last=-1;
|
|
|
|
|
do{
|
|
|
|
|
jj++;
|
|
|
|
|
$lodsb
|
|
|
|
|
IF(AL==BL) last=jj;
|
|
|
|
|
} while(AL!=0);
|
|
|
|
|
return last;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline fastcall ChangeCase(dword EDX)
|
|
|
|
|
{
|
|
|
|
|
AL=DSBYTE[EDX];
|
|
|
|
|
IF(AL>='a')&&(AL<='z')DSBYTE[EDX]=AL&0x5f;
|
|
|
|
|
IF (AL>=160) && (AL<=175) DSBYTE[EDX] = AL - 32; //<2F>-<2D>
|
|
|
|
|
IF (AL>=224) && (AL<=239) DSBYTE[EDX] = AL - 80; //<2F>-<2D>
|
|
|
|
|
do{
|
|
|
|
|
EDX++;
|
|
|
|
|
AL=DSBYTE[EDX];
|
2011-08-18 15:32:06 +02:00
|
|
|
|
IF(AL>='A')&&(AL<='Z'){DSBYTE[EDX]=AL|0x20; CONTINUE;}
|
2010-12-19 08:29:49 +01:00
|
|
|
|
IF(AL>='<27>')&&(AL<='<27>')DSBYTE[EDX]=AL|0x20; //<2F>-<2D>
|
|
|
|
|
IF (AL>=144) && (AL<=159) DSBYTE[EDX] = AL + 80; //<2F>-<2D>
|
|
|
|
|
}while(AL!=0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
inline fastcall void PutPixel(dword EBX,ECX,EDX){
|
|
|
|
|
EAX=1;
|
|
|
|
|
$int 0x40
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-30 12:14:05 +02:00
|
|
|
|
void DefineButton(dword x,y,w,h,EDX,ESI)
|
|
|
|
|
{
|
|
|
|
|
EAX = 8;
|
|
|
|
|
$push edx
|
|
|
|
|
EDX += BT_DEL; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD> <20><>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
$int 0x40;
|
2010-12-19 08:29:49 +01:00
|
|
|
|
EBX = x<<16+w;
|
|
|
|
|
ECX = y<<16+h;
|
2012-03-30 12:14:05 +02:00
|
|
|
|
$pop edx
|
2010-12-19 08:29:49 +01:00
|
|
|
|
$int 0x40
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline fastcall void DeleteButton(dword EDX)
|
|
|
|
|
{
|
|
|
|
|
EAX = 8;
|
|
|
|
|
EDX += BT_DEL;
|
|
|
|
|
$int 0x40;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WriteText(dword x,y,byte fontType, dword color, EDX, ESI)
|
|
|
|
|
{
|
|
|
|
|
EAX = 4;
|
|
|
|
|
EBX = x<<16+y;
|
|
|
|
|
ECX = fontType<<24+color;
|
|
|
|
|
$int 0x40;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DrawBar(dword x,y,w,h,EDX)
|
|
|
|
|
{
|
|
|
|
|
#speed
|
|
|
|
|
EAX = 13;
|
|
|
|
|
EBX = x<<16+w;
|
|
|
|
|
ECX = y<<16+h;
|
|
|
|
|
$int 0x40
|
|
|
|
|
#codesize
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DrawRegion_3D(dword x,y,width,height,color1,color2)
|
|
|
|
|
{
|
|
|
|
|
DrawBar(x,y,width+1,1,color1); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> ᢥ<><E1A2A5><EFBFBD>
|
|
|
|
|
DrawBar(x,y+1,1,height-1,color1); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <><E1ABA5>
|
|
|
|
|
DrawBar(x+width,y+1,1,height,color2); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ࠢ<EFBFBD>
|
|
|
|
|
DrawBar(x,y+height,width,1,color2); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> ᭨<><E1ADA8>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DrawFlatButton(dword x,y,width,height,id,color,text)
|
|
|
|
|
{
|
|
|
|
|
DrawRegion_3D(x,y,width,height,0x94AECE,0x94AECE);
|
|
|
|
|
DrawRegion_3D(x+1,y+1,width-2,height-2,0xFFFFFF,0xC7C7C7);
|
|
|
|
|
DrawBar(x+2,y+2,width-3,height-3,color); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2011-08-27 23:37:45 +02:00
|
|
|
|
IF (id<>0) DefineButton(x+1,y+1,width-2,height-2,id+BT_HIDE,0xEFEBEF); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2010-12-19 08:29:49 +01:00
|
|
|
|
WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,0,text,0);
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-27 23:37:45 +02:00
|
|
|
|
void PutPaletteImage(dword EBX,w,h,x,y, EDI)
|
2010-12-19 08:29:49 +01:00
|
|
|
|
{
|
2011-08-27 23:37:45 +02:00
|
|
|
|
EAX = 65;
|
2010-12-19 08:29:49 +01:00
|
|
|
|
ECX = w<<16+h;
|
|
|
|
|
EDX = x<<16+y;
|
2011-08-27 23:37:45 +02:00
|
|
|
|
ESI = 8;
|
|
|
|
|
EBP = 0;
|
2010-12-19 08:29:49 +01:00
|
|
|
|
$int 0x40
|
2011-08-27 23:37:45 +02:00
|
|
|
|
}
|
2010-12-19 08:29:49 +01:00
|
|
|
|
|
2011-08-27 23:37:45 +02:00
|
|
|
|
void PutImage(dword EBX,w,h,x,y)
|
2010-12-19 08:29:49 +01:00
|
|
|
|
{
|
2011-08-27 23:37:45 +02:00
|
|
|
|
EAX = 7;
|
2010-12-19 08:29:49 +01:00
|
|
|
|
ECX = w<<16+h;
|
|
|
|
|
EDX = x<<16+y;
|
|
|
|
|
$int 0x40
|
2011-08-27 23:37:45 +02:00
|
|
|
|
}
|
2010-12-19 08:29:49 +01:00
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2011-10-05 11:50:43 +02:00
|
|
|
|
inline fastcall void WriteDebug(dword EDX)
|
2010-12-19 08:29:49 +01:00
|
|
|
|
{
|
|
|
|
|
$mov eax, 63
|
|
|
|
|
$mov ebx, 1
|
|
|
|
|
next_char:
|
|
|
|
|
$mov ecx, DSDWORD[edx]
|
|
|
|
|
$or cl, cl
|
|
|
|
|
$jz done
|
|
|
|
|
$int 0x40
|
|
|
|
|
$inc edx
|
|
|
|
|
$jmp next_char
|
|
|
|
|
done:
|
|
|
|
|
$mov cl, 13
|
|
|
|
|
$int 0x40
|
|
|
|
|
$mov cl, 10
|
|
|
|
|
$int 0x40
|
|
|
|
|
}
|
2011-08-27 23:37:45 +02:00
|
|
|
|
|
|
|
|
|
inline fastcall void WriteFullDebug(dword ESI)
|
|
|
|
|
{
|
|
|
|
|
WriteDebug("");
|
|
|
|
|
WriteDebug(ESI);
|
|
|
|
|
|
|
|
|
|
WriteDebug("Number of files:");
|
|
|
|
|
WriteDebug(IntToStr(count));
|
|
|
|
|
|
|
|
|
|
WriteDebug("but_num:");
|
|
|
|
|
WriteDebug(IntToStr(but_num));
|
|
|
|
|
|
|
|
|
|
WriteDebug("curbtn");
|
|
|
|
|
WriteDebug(IntToStr(curbtn));
|
|
|
|
|
|
|
|
|
|
WriteDebug("ra_kadrom:");
|
|
|
|
|
WriteDebug(IntToStr(za_kadrom));
|
|
|
|
|
|
|
|
|
|
Pause(200);
|
2011-10-05 11:50:43 +02:00
|
|
|
|
}
|