2016-01-01 17:51:53 +01:00
|
|
|
//CODED by Veliant, Leency, Nable, Pavelyakov. GNU GPL licence.
|
|
|
|
|
2015-07-22 20:32:54 +02:00
|
|
|
#ifndef INCLUDE_KOLIBRI_H
|
2015-07-20 01:09:56 +02:00
|
|
|
#define INCLUDE_KOLIBRI_H
|
2015-08-04 17:48:36 +02:00
|
|
|
|
|
|
|
#pragma option OST
|
|
|
|
#pragma option ON
|
|
|
|
#pragma option cri-
|
|
|
|
#pragma option -CPA
|
|
|
|
#initallvar 0
|
|
|
|
#jumptomain FALSE
|
2015-07-16 03:44:30 +02:00
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
#startaddress 0
|
2015-08-04 17:48:36 +02:00
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
#code32 TRUE
|
2015-08-04 17:48:36 +02:00
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
char os_name[8] = {'M','E','N','U','E','T','0','1'};
|
|
|
|
dword os_version = 0x00000001;
|
2015-08-02 16:40:41 +02:00
|
|
|
dword start_addr = #______INIT______;
|
|
|
|
dword final_addr = #______STOP______+32;
|
2013-03-11 19:16:24 +01:00
|
|
|
dword alloc_mem = MEMSIZE;
|
|
|
|
dword x86esp_reg = MEMSIZE;
|
2012-11-26 16:26:15 +01:00
|
|
|
dword I_Param = #param;
|
|
|
|
dword I_Path = #program_path;
|
|
|
|
char param[4096];
|
|
|
|
char program_path[4096];
|
|
|
|
|
2016-11-02 13:19:15 +01:00
|
|
|
#define bool int
|
2015-11-05 21:49:42 +01:00
|
|
|
|
2013-03-11 19:16:24 +01:00
|
|
|
#define NULL 0
|
|
|
|
#define OLD -1
|
|
|
|
#define true 1
|
|
|
|
#define false 0
|
|
|
|
|
2016-01-07 14:10:39 +01:00
|
|
|
//Process Events
|
2012-11-26 16:26:15 +01:00
|
|
|
#define evReDraw 1
|
2014-01-27 20:34:00 +01:00
|
|
|
#define evKey 2
|
|
|
|
#define evButton 3
|
2017-09-17 03:32:09 +02:00
|
|
|
#define evExit 4
|
2015-07-16 03:44:30 +02:00
|
|
|
#define evDesktop 5
|
2014-01-27 20:34:00 +01:00
|
|
|
#define evMouse 6
|
2015-07-16 03:44:30 +02:00
|
|
|
#define evIPC 7
|
2014-01-27 20:34:00 +01:00
|
|
|
#define evNetwork 8
|
2015-07-16 03:44:30 +02:00
|
|
|
#define evDebug 9
|
2012-11-26 16:26:15 +01:00
|
|
|
|
2017-09-17 03:32:09 +02:00
|
|
|
//Event mask bits for function 40
|
2017-09-28 11:59:41 +02:00
|
|
|
#define EVM_REDRAW 1b
|
|
|
|
#define EVM_KEY 10b
|
|
|
|
#define EVM_BUTTON 100b
|
|
|
|
#define EVM_EXIT 1000b
|
|
|
|
#define EVM_BACKGROUND 10000b
|
|
|
|
#define EVM_MOUSE 100000b
|
|
|
|
#define EVM_IPC 1000000b
|
|
|
|
#define EVM_STACK 10000000b
|
|
|
|
#define EVM_DEBUG 100000000b
|
|
|
|
#define EVM_STACK2 1000000000b
|
2017-09-17 03:32:09 +02:00
|
|
|
#define EVM_MOUSE_FILTER 0x80000000
|
|
|
|
#define EVM_CURSOR_FILTER 0x40000000
|
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
//Button options
|
|
|
|
#define BT_DEL 0x80000000
|
|
|
|
#define BT_HIDE 0x40000000
|
|
|
|
#define BT_NOFRAME 0x20000000
|
|
|
|
|
2017-10-05 23:38:09 +02:00
|
|
|
#define CLOSE_BTN 1
|
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2015-08-04 16:36:07 +02:00
|
|
|
#include "../lib/system.h"
|
|
|
|
#include "../lib/mouse.h"
|
2016-02-23 15:41:55 +01:00
|
|
|
#include "../lib/keyboard.h"
|
2015-07-23 13:54:26 +02:00
|
|
|
|
2016-11-23 21:47:33 +01:00
|
|
|
inline fastcall dword calc(EAX) { return EAX; }
|
2016-11-23 11:04:07 +01:00
|
|
|
|
2015-08-04 16:36:07 +02:00
|
|
|
:struct raw_image {
|
|
|
|
dword w, h, data;
|
2015-07-16 03:44:30 +02:00
|
|
|
};
|
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
//------------------------------------------------------------------------------
|
2015-07-20 01:09:56 +02:00
|
|
|
:dword wait_event_code;
|
2012-11-26 16:26:15 +01:00
|
|
|
inline fastcall dword WaitEvent()
|
|
|
|
{
|
|
|
|
$mov eax,10
|
|
|
|
$int 0x40
|
2015-07-16 03:44:30 +02:00
|
|
|
wait_event_code = EAX;
|
2015-07-21 03:10:37 +02:00
|
|
|
//if(wait_event_code==evMouse) MOUSE.get();
|
|
|
|
//return wait_event_code;
|
2012-11-26 16:26:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall dword CheckEvent()
|
|
|
|
{
|
|
|
|
$mov eax,11
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2015-07-16 03:44:30 +02:00
|
|
|
inline fastcall dword WaitEventTimeout(EBX)
|
2012-11-26 16:26:15 +01:00
|
|
|
{
|
|
|
|
$mov eax,23
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2017-09-17 03:32:09 +02:00
|
|
|
inline fastcall dword SetEventMask(EBX)
|
2012-11-26 16:26:15 +01:00
|
|
|
{
|
|
|
|
$mov eax,40
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-07-16 03:44:30 +02:00
|
|
|
inline fastcall pause(EBX)
|
2012-11-26 16:26:15 +01:00
|
|
|
{
|
|
|
|
$mov eax, 5
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall word GetButtonID()
|
|
|
|
{
|
|
|
|
$mov eax,17
|
|
|
|
$int 0x40
|
|
|
|
$shr eax,8
|
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall dword GetFreeRAM()
|
|
|
|
{
|
|
|
|
$mov eax, 18
|
|
|
|
$mov ebx, 16
|
|
|
|
$int 0x40
|
2017-09-17 04:19:14 +02:00
|
|
|
//return eax = free RAM in Kb
|
2012-11-26 16:26:15 +01:00
|
|
|
}
|
|
|
|
|
2016-12-08 18:20:55 +01:00
|
|
|
inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà
|
2012-11-26 16:26:15 +01:00
|
|
|
{
|
|
|
|
$mov eax, 68
|
|
|
|
$mov ebx, 16
|
|
|
|
$int 0x40
|
2016-12-08 18:20:55 +01:00
|
|
|
//return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà
|
2012-11-26 16:26:15 +01:00
|
|
|
}
|
|
|
|
|
2016-12-08 18:20:55 +01:00
|
|
|
inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó
|
2012-11-26 16:26:15 +01:00
|
|
|
{
|
|
|
|
$mov eax, 68
|
|
|
|
$mov ebx, 17
|
|
|
|
$int 0x40
|
2016-12-08 18:20:55 +01:00
|
|
|
//return eax = îïðåäåëÿåòñÿ äðàéâåðîì
|
2012-11-26 16:26:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
struct proc_info
|
|
|
|
{
|
|
|
|
#define SelfInfo -1
|
|
|
|
dword use_cpu;
|
|
|
|
word pos_in_stack,num_slot,rezerv1;
|
2013-10-30 02:12:01 +01:00
|
|
|
unsigned char name[11];
|
2012-11-26 16:26:15 +01:00
|
|
|
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;
|
2012-12-15 01:16:06 +01:00
|
|
|
dword cwidth,cheight;
|
|
|
|
byte reserved[1024-71-8];
|
2012-11-26 16:26:15 +01:00
|
|
|
};
|
|
|
|
|
2015-07-16 03:44:30 +02:00
|
|
|
inline fastcall void GetProcessInfo(EBX, ECX)
|
2012-11-26 16:26:15 +01:00
|
|
|
{
|
|
|
|
$mov eax,9;
|
|
|
|
$int 0x40
|
2012-12-15 01:16:06 +01:00
|
|
|
DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth
|
2017-10-05 11:37:50 +02:00
|
|
|
DSDWORD[EBX+75] = DSDWORD[EBX+46] - skin_height - 4; //set cheight
|
2012-11-26 16:26:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y
|
|
|
|
{
|
|
|
|
$mov eax,34
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall int GetProcessSlot( ECX)
|
|
|
|
{
|
|
|
|
EAX = 18;
|
|
|
|
EBX = 21;
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall int GetActiveProcess()
|
|
|
|
{
|
|
|
|
EAX = 18;
|
|
|
|
EBX = 7;
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2013-10-24 20:26:04 +02:00
|
|
|
:int CheckActiveProcess(int Form_ID)
|
|
|
|
{
|
2013-11-05 00:27:39 +01:00
|
|
|
int id9=GetProcessSlot(Form_ID);
|
|
|
|
if (id9==GetActiveProcess()) return 1;
|
2013-10-24 20:26:04 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-12-15 16:56:24 +01:00
|
|
|
inline fastcall void ActivateWindow( ECX)
|
|
|
|
{
|
|
|
|
EAX = 18;
|
|
|
|
EBX = 3;
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2015-02-18 20:52:40 +01:00
|
|
|
inline fastcall int MinimizeWindow()
|
|
|
|
{
|
|
|
|
EAX = 18;
|
|
|
|
EBX = 10;
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2015-07-16 03:44:30 +02:00
|
|
|
inline fastcall int CreateThread(ECX,EDX)
|
2012-11-26 16:26:15 +01:00
|
|
|
{
|
|
|
|
$mov eax,51
|
|
|
|
$mov ebx,1
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall void SwitchToAnotherThread()
|
|
|
|
{
|
|
|
|
$mov eax,68
|
|
|
|
$mov ebx,1
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2013-04-08 15:21:32 +02:00
|
|
|
inline fastcall int SendWindowMessage( ECX, EDX)
|
2013-04-04 19:07:38 +02:00
|
|
|
{
|
|
|
|
$mov eax, 72
|
|
|
|
$mov ebx, 1
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
inline fastcall int KillProcess( ECX)
|
|
|
|
{
|
|
|
|
$mov eax,18;
|
|
|
|
$mov ebx,18;
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
|
|
|
#define TURN_OFF 2
|
|
|
|
#define REBOOT 3
|
|
|
|
#define KERNEL 4
|
|
|
|
inline fastcall int ExitSystem( ECX)
|
|
|
|
{
|
|
|
|
$mov eax, 18
|
|
|
|
$mov ebx, 9
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall ExitProcess()
|
|
|
|
{
|
|
|
|
$mov eax,-1;
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2016-10-05 00:46:07 +02:00
|
|
|
inline fastcall void SetCurDir( ECX)
|
|
|
|
{
|
|
|
|
EAX=30;
|
|
|
|
EBX=1;
|
|
|
|
$int 0x40
|
|
|
|
}
|
2016-08-28 00:54:05 +02:00
|
|
|
|
|
|
|
|
2016-12-08 18:20:55 +01:00
|
|
|
//eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus)
|
2016-11-03 13:41:15 +01:00
|
|
|
#define SYS_LANG_ENG 1
|
|
|
|
#define SYS_LANG_FIN 2
|
|
|
|
#define SYS_LANG_GER 3
|
|
|
|
#define SYS_LANG_RUS 4
|
2012-11-26 16:26:15 +01:00
|
|
|
inline fastcall int GetSystemLanguage()
|
|
|
|
{
|
|
|
|
EAX = 26;
|
|
|
|
EBX = 5;
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall GetSkinHeight()
|
|
|
|
{
|
|
|
|
$push ebx
|
|
|
|
$mov eax,48
|
|
|
|
$mov ebx,4
|
|
|
|
$int 0x40
|
|
|
|
$pop ebx
|
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall void SetSystemSkin( ECX)
|
|
|
|
{
|
|
|
|
EAX = 48;
|
|
|
|
EBX = 8;
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall int GetScreenWidth()
|
|
|
|
{
|
|
|
|
$mov eax, 14
|
|
|
|
$int 0x40
|
|
|
|
$shr eax, 16
|
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall int GetScreenHeight()
|
|
|
|
{
|
|
|
|
$mov eax, 14
|
|
|
|
$int 0x40
|
|
|
|
$and eax,0x0000FFFF
|
|
|
|
}
|
|
|
|
|
2015-02-18 20:52:40 +01:00
|
|
|
inline fastcall int GetClientTop()
|
|
|
|
{
|
|
|
|
$mov eax, 48
|
|
|
|
$mov ebx, 5
|
|
|
|
$int 0x40
|
2016-01-15 00:05:51 +01:00
|
|
|
$mov eax, ebx
|
|
|
|
$shr eax, 16
|
2015-02-18 20:52:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall int GetClientHeight()
|
|
|
|
{
|
|
|
|
$mov eax, 48
|
|
|
|
$mov ebx, 5
|
|
|
|
$int 0x40
|
2016-01-15 00:05:51 +01:00
|
|
|
$mov eax, ebx
|
2015-02-18 20:52:40 +01:00
|
|
|
}
|
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
inline fastcall dword LoadLibrary( ECX)
|
|
|
|
{
|
|
|
|
$mov eax, 68
|
|
|
|
$mov ebx, 19
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall int TestBit( EAX, CL)
|
|
|
|
{
|
|
|
|
$shr eax,cl
|
|
|
|
$and eax,1
|
|
|
|
}
|
|
|
|
|
2018-02-21 00:23:57 +01:00
|
|
|
:void SetClientScreenArea(dword _left, _right, _top, _bottom)
|
|
|
|
{
|
|
|
|
EAX = 48;
|
|
|
|
EBX = 6;
|
|
|
|
ECX = _left * 65536 + _right;
|
|
|
|
EDX = _top * 65536 + _bottom;
|
|
|
|
$int 64;
|
|
|
|
}
|
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2016-11-23 12:37:13 +01:00
|
|
|
:void DefineAndDrawWindow(dword _x, _y, _w, _h, _window_type, _bgcolor, _title, _flags)
|
2012-11-26 16:26:15 +01:00
|
|
|
{
|
|
|
|
EAX = 12; // function 12:tell os about windowdraw
|
|
|
|
EBX = 1;
|
|
|
|
$int 0x40
|
|
|
|
|
2015-07-16 03:44:30 +02:00
|
|
|
$xor EAX,EAX
|
2016-11-23 12:37:13 +01:00
|
|
|
EBX = _x << 16 + _w;
|
|
|
|
ECX = _y << 16 + _h;
|
|
|
|
EDX = _window_type << 24 | _bgcolor;
|
|
|
|
EDI = _title;
|
|
|
|
ESI = _flags;
|
2012-11-26 16:26:15 +01:00
|
|
|
$int 0x40
|
|
|
|
|
2016-11-23 11:04:07 +01:00
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
EAX = 12; // function 12:tell os about windowdraw
|
|
|
|
EBX = 2;
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall MoveSize( EBX,ECX,EDX,ESI)
|
|
|
|
{
|
|
|
|
$mov eax, 67
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall void DrawTitle( ECX)
|
|
|
|
{
|
|
|
|
EAX = 71;
|
|
|
|
EBX = 1;
|
|
|
|
$int 0x40;
|
|
|
|
}
|
|
|
|
|
2016-12-11 23:58:11 +01:00
|
|
|
// @EDX is a process id, -1 for self
|
2016-12-08 18:20:55 +01:00
|
|
|
// @ESI is a new LayerBehaviour
|
|
|
|
// @RETURN: EAX, 0 is fail, 1 is success
|
2016-12-11 23:58:11 +01:00
|
|
|
#define ZPOS_DESKTOP -2
|
|
|
|
#define ZPOS_ALWAYS_BACK -1
|
|
|
|
#define ZPOS_NORMAL 0
|
|
|
|
#define ZPOS_ALWAYS_TOP 1
|
2016-12-08 18:20:55 +01:00
|
|
|
inline fastcall dword SetWindowLayerBehaviour(EDX, ESI)
|
|
|
|
{
|
|
|
|
EAX = 18;
|
|
|
|
EBX = 25;
|
|
|
|
ECX = 2;
|
|
|
|
$int 64
|
|
|
|
}
|
|
|
|
|
2016-11-21 21:25:00 +01:00
|
|
|
:void WriteTextB(dword x,y,byte fontType, dword color, str_offset)
|
2012-12-15 01:16:06 +01:00
|
|
|
{
|
|
|
|
EAX = 4;
|
|
|
|
EBX = x<<16+y;
|
|
|
|
ECX = fontType<<24+color;
|
2016-11-21 21:25:00 +01:00
|
|
|
EDX = str_offset;
|
2013-03-11 19:16:24 +01:00
|
|
|
ESI = 0;
|
2012-12-15 01:16:06 +01:00
|
|
|
$int 0x40;
|
|
|
|
$add ebx, 1<<16
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2016-11-21 21:25:00 +01:00
|
|
|
:void WriteText(dword x,y,byte fontType, dword color, str_offset)
|
2012-11-26 16:26:15 +01:00
|
|
|
{
|
|
|
|
EAX = 4;
|
|
|
|
EBX = x<<16+y;
|
|
|
|
ECX = fontType<<24+color;
|
2016-11-21 21:25:00 +01:00
|
|
|
EDX = str_offset;
|
2012-11-26 16:26:15 +01:00
|
|
|
$int 0x40;
|
|
|
|
}
|
|
|
|
|
2016-11-23 11:04:07 +01:00
|
|
|
:dword WriteBufText(dword x,y,byte fontType, dword color, str_offset, buf_offset)
|
2013-04-12 02:15:39 +02:00
|
|
|
{
|
|
|
|
EAX = 4;
|
|
|
|
EBX = x<<16+y;
|
|
|
|
ECX = fontType<<24+color;
|
2016-11-23 11:04:07 +01:00
|
|
|
EDX = str_offset;
|
|
|
|
EDI = buf_offset;
|
2013-04-12 02:15:39 +02:00
|
|
|
$int 0x40;
|
|
|
|
}
|
|
|
|
|
2016-11-23 11:04:07 +01:00
|
|
|
:void WriteNumber(dword x,y,byte fontType, dword color, count, number_or_offset)
|
2012-11-26 16:26:15 +01:00
|
|
|
{
|
|
|
|
EAX = 47;
|
|
|
|
EBX = count<<16;
|
2016-11-21 21:25:00 +01:00
|
|
|
ECX = number_or_offset;
|
2012-11-26 16:26:15 +01:00
|
|
|
EDX = x<<16+y;
|
|
|
|
ESI = fontType<<24+color;
|
|
|
|
$int 0x40;
|
|
|
|
}
|
|
|
|
|
2016-11-21 21:25:00 +01:00
|
|
|
:void CopyScreen(dword dst_offset, x, y, w, h)
|
2012-11-26 16:26:15 +01:00
|
|
|
{
|
|
|
|
EAX = 36;
|
2016-11-21 21:25:00 +01:00
|
|
|
EBX = dst_offset;
|
2013-03-11 19:16:24 +01:00
|
|
|
ECX = w << 16 + h;
|
2012-11-26 16:26:15 +01:00
|
|
|
EDX = x << 16 + y;
|
|
|
|
$int 0x40;
|
|
|
|
}
|
|
|
|
|
2016-12-08 18:20:55 +01:00
|
|
|
:dword GetPixelColorFromScreen(dword _x, _y)
|
2012-11-26 16:26:15 +01:00
|
|
|
{
|
2016-12-08 18:20:55 +01:00
|
|
|
EAX = 35;
|
|
|
|
EBX = _y * screen.width + _x;
|
|
|
|
$int 64
|
2012-11-26 16:26:15 +01:00
|
|
|
}
|
|
|
|
|
2017-10-12 01:19:28 +02:00
|
|
|
#define DRAW_DESKTOP_BG_TILE 1
|
|
|
|
#define DRAW_DESKTOP_BG_STRETCH 2
|
2018-02-16 16:53:51 +01:00
|
|
|
:void SetBackgroundImage(dword w,h, image, mode)
|
2017-10-12 01:19:28 +02:00
|
|
|
{
|
|
|
|
$mov eax,15 // SF_BACKGROUND_SET 15 - work with desktop background graphics
|
|
|
|
$mov ebx,4 // SSF_MODE_BG 4 - set drawing mode for the background
|
|
|
|
$mov ecx,mode // drawing mode - tile (1), stretch (2)
|
|
|
|
$int 64
|
|
|
|
|
|
|
|
$mov eax,15 // SF_BACKGROUND_SET 15 - work with desktop background graphics
|
|
|
|
$mov ebx,1 // SSF_SIZE_BG=1 - set a size of the background image
|
|
|
|
$mov ecx,w // width
|
|
|
|
$mov edx,h // height
|
|
|
|
$int 64
|
|
|
|
|
|
|
|
$mov eax,15 // SF_BACKGROUND_SET 15 - work with desktop background graphics
|
|
|
|
$mov ebx,5 // SSF_IMAGE_BG=5 - put block of pixels on the background image
|
|
|
|
$mov ecx,image // pointer to the data in the format BBGGRRBBGGRR...
|
|
|
|
$mov edx,0 // offset in data of the background image
|
|
|
|
ESI = 3*w*h; // size of data in bytes = 3 * number of pixels
|
|
|
|
$int 64
|
|
|
|
|
|
|
|
$mov eax,15 // SF_BACKGROUND_SET 15 - work with desktop background graphics
|
|
|
|
$mov ebx,3 // SSF_REDRAW_BG=3 - redraw background
|
|
|
|
$int 64
|
|
|
|
}
|
|
|
|
|
2016-11-21 21:25:00 +01:00
|
|
|
:void _PutImage(dword x,y, w,h, data_offset)
|
2012-11-26 16:26:15 +01:00
|
|
|
{
|
|
|
|
EAX = 7;
|
2016-11-21 21:25:00 +01:00
|
|
|
EBX = data_offset;
|
2012-11-26 16:26:15 +01:00
|
|
|
ECX = w<<16+h;
|
|
|
|
EDX = x<<16+y;
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2018-02-18 16:32:11 +01:00
|
|
|
:void PutPaletteImage(dword inbuf,w,h,x,y,bits,pal)
|
2012-11-26 16:26:15 +01:00
|
|
|
{
|
|
|
|
EAX = 65;
|
2018-02-18 16:32:11 +01:00
|
|
|
EBX = inbuf;
|
2012-11-26 16:26:15 +01:00
|
|
|
ECX = w<<16+h;
|
|
|
|
EDX = x<<16+y;
|
2018-02-18 16:32:11 +01:00
|
|
|
ESI = bits;
|
|
|
|
EDI = pal;
|
2012-11-26 16:26:15 +01:00
|
|
|
EBP = 0;
|
|
|
|
$int 0x40
|
2016-11-23 11:04:07 +01:00
|
|
|
}
|
2012-11-26 16:26:15 +01:00
|
|
|
|
|
|
|
inline fastcall void PutPixel( EBX,ECX,EDX)
|
|
|
|
{
|
|
|
|
EAX=1;
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2016-11-23 11:04:07 +01:00
|
|
|
:void DrawBar(dword x,y,w,h,color)
|
2012-11-26 16:26:15 +01:00
|
|
|
{
|
2013-02-04 14:15:13 +01:00
|
|
|
if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :)
|
2012-11-26 16:26:15 +01:00
|
|
|
EAX = 13;
|
|
|
|
EBX = x<<16+w;
|
|
|
|
ECX = y<<16+h;
|
2016-11-23 11:04:07 +01:00
|
|
|
EDX = color;
|
2016-01-15 00:05:51 +01:00
|
|
|
$int 0x40
|
2012-11-26 16:26:15 +01:00
|
|
|
}
|
|
|
|
|
2018-03-22 15:36:04 +01:00
|
|
|
:void DefineButton(dword x,y,w,h,id,color)
|
2012-11-26 16:26:15 +01:00
|
|
|
{
|
2012-12-15 01:16:06 +01:00
|
|
|
EAX = 8;
|
2018-03-22 15:36:04 +01:00
|
|
|
EDX = id + BT_DEL;
|
2012-12-15 01:16:06 +01:00
|
|
|
$int 0x40;
|
2018-03-22 15:36:04 +01:00
|
|
|
EDX = id;
|
|
|
|
ESI = color;
|
2012-12-15 01:16:06 +01:00
|
|
|
EBX = x<<16+w;
|
|
|
|
ECX = y<<16+h;
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2015-07-20 01:09:56 +02:00
|
|
|
inline RefreshWindow(dword ID_REFRESH,ID_ACTIVE)
|
|
|
|
{
|
|
|
|
EAX = 18;
|
|
|
|
EBX = 22;
|
|
|
|
ECX = 3;
|
|
|
|
EDX = ID_REFRESH;
|
|
|
|
$int 0x40
|
|
|
|
EAX = 18;
|
|
|
|
EBX = 3;
|
|
|
|
EDX = ID_ACTIVE;
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2016-11-23 11:04:07 +01:00
|
|
|
:void UnsafeDefineButton(dword x,y,w,h,id,color)
|
2012-12-15 01:16:06 +01:00
|
|
|
{
|
|
|
|
EAX = 8;
|
2012-11-26 16:26:15 +01:00
|
|
|
EBX = x<<16+w;
|
|
|
|
ECX = y<<16+h;
|
2016-11-23 11:04:07 +01:00
|
|
|
EDX = id;
|
|
|
|
ESI = color;
|
2012-11-26 16:26:15 +01:00
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2018-02-16 16:53:51 +01:00
|
|
|
:void DefineDragableWindow(dword _x, _y, _w, _h)
|
2016-12-08 18:20:55 +01:00
|
|
|
{
|
|
|
|
DefineAndDrawWindow(_x, _y, _w, _h, 0x41,0x000000,NULL,0b);
|
|
|
|
}
|
|
|
|
|
2018-02-21 00:23:57 +01:00
|
|
|
:void DefineUnDragableWindow(dword _x, _y, _w, _h)
|
|
|
|
{
|
|
|
|
DefineAndDrawWindow(_x, _y, _w, _h, 0x01, 0, 0, 0x01fffFFF);
|
|
|
|
}
|
|
|
|
|
2016-12-08 18:20:55 +01:00
|
|
|
:void EventDragWindow()
|
|
|
|
{
|
|
|
|
dword tmp_x,tmp_y;
|
|
|
|
dword z1,z2;
|
|
|
|
tmp_x = mouse.x;
|
|
|
|
tmp_y = mouse.y;
|
|
|
|
do {
|
|
|
|
mouse.get();
|
|
|
|
if (tmp_x!=mouse.x) || (tmp_y!=mouse.y)
|
|
|
|
{
|
|
|
|
z1 = Form.left + mouse.x - tmp_x;
|
|
|
|
z2 = Form.top + mouse.y - tmp_y;
|
|
|
|
if(z1<=10) || (z1>20000) z1=0; else if(z1>screen.width-Form.width-10)z1=screen.width-Form.width;
|
|
|
|
if(z2<=10) || (z2>20000) z2=0; else if(z2>screen.height-Form.height-10)z2=screen.height-Form.height;
|
|
|
|
MoveSize(z1 , z2, OLD, OLD);
|
|
|
|
draw_window();
|
|
|
|
}
|
|
|
|
pause(1);
|
|
|
|
} while (mouse.lkm);
|
|
|
|
}
|
|
|
|
|
|
|
|
:void DefineHiddenButton(dword _x, _y, _w, _h, _id)
|
|
|
|
{
|
|
|
|
DefineButton(_x, _y, _w, _h, _id + BT_HIDE, 0);
|
|
|
|
}
|
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
inline fastcall void DeleteButton( EDX)
|
|
|
|
{
|
|
|
|
EAX = 8;
|
|
|
|
EDX += BT_DEL;
|
2015-07-30 16:54:30 +02:00
|
|
|
$int 0x40
|
2015-03-25 12:46:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall dword GetStartTime()
|
|
|
|
{
|
|
|
|
$mov eax,26
|
|
|
|
$mov ebx,9
|
|
|
|
$int 0x40
|
2015-07-12 01:45:19 +02:00
|
|
|
}
|
|
|
|
|
2015-07-23 13:54:26 +02:00
|
|
|
:dword X_EventRedrawWindow,Y_EventRedrawWindow;
|
|
|
|
:void _EventRedrawWindow()
|
|
|
|
{
|
|
|
|
loop()switch(WaitEvent())
|
|
|
|
{
|
|
|
|
case evReDraw:
|
2016-11-23 12:53:45 +01:00
|
|
|
DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,100,1,0x34,0xFFFFFF,NULL,0);
|
2015-07-23 13:54:26 +02:00
|
|
|
pause(10);
|
|
|
|
ExitProcess();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2015-08-21 22:20:08 +02:00
|
|
|
:char REDRAW_BUFF_EVENT_[4096];
|
2015-07-23 13:54:26 +02:00
|
|
|
:void EventRedrawWindow(dword x,y)
|
|
|
|
{
|
|
|
|
X_EventRedrawWindow = x;
|
|
|
|
Y_EventRedrawWindow = y;
|
2015-08-21 22:20:08 +02:00
|
|
|
CreateThread(#_EventRedrawWindow,#REDRAW_BUFF_EVENT_+4092);
|
2015-07-23 13:54:26 +02:00
|
|
|
}
|
|
|
|
|
2017-10-12 01:19:28 +02:00
|
|
|
:struct rect
|
2015-07-16 03:44:30 +02:00
|
|
|
{
|
2016-02-23 15:41:55 +01:00
|
|
|
dword x,y,w,h;
|
2016-11-22 15:04:10 +01:00
|
|
|
void set_size();
|
2016-02-23 15:41:55 +01:00
|
|
|
};
|
|
|
|
|
2017-10-12 01:19:28 +02:00
|
|
|
:void rect::set_size(dword _x, _y, _w, _h)
|
2015-07-16 03:44:30 +02:00
|
|
|
{
|
2016-02-23 15:41:55 +01:00
|
|
|
x=_x;
|
|
|
|
y=_y;
|
|
|
|
w=_w;
|
|
|
|
h=_h;
|
2015-07-16 03:44:30 +02:00
|
|
|
}
|
|
|
|
|
2015-07-20 01:09:56 +02:00
|
|
|
:struct _screen
|
|
|
|
{
|
|
|
|
dword width,height;
|
|
|
|
} screen;
|
|
|
|
|
2016-01-07 16:26:59 +01:00
|
|
|
:byte skin_height;
|
2015-07-20 01:09:56 +02:00
|
|
|
|
2015-08-02 00:08:58 +02:00
|
|
|
:void DrawDate(dword x, y, color, in_date)
|
|
|
|
{
|
|
|
|
EDI = in_date;
|
|
|
|
EAX = 47;
|
|
|
|
EBX = 2<<16;
|
|
|
|
EDX = x<<16+y;
|
2016-02-22 02:41:13 +01:00
|
|
|
ESI = 0x90<<24+color;
|
2015-08-02 00:08:58 +02:00
|
|
|
ECX = EDI.date.day;
|
|
|
|
$int 0x40;
|
2016-02-23 15:41:55 +01:00
|
|
|
EDX += 20<<16;
|
2015-08-02 00:08:58 +02:00
|
|
|
ECX = EDI.date.month;
|
|
|
|
$int 0x40;
|
2016-02-23 15:41:55 +01:00
|
|
|
EDX += 20<<16;
|
2015-08-02 00:08:58 +02:00
|
|
|
EBX = 4<<16;
|
|
|
|
ECX = EDI.date.year;
|
|
|
|
$int 0x40;
|
2016-02-23 15:41:55 +01:00
|
|
|
DrawBar(x+17,y+10,2,2,color);
|
|
|
|
DrawBar(x+37,y+10,2,2,color);
|
2015-08-02 00:08:58 +02:00
|
|
|
}
|
|
|
|
|
2015-08-02 13:41:41 +02:00
|
|
|
:void __path_name__(dword BUF,PATH)
|
|
|
|
{
|
|
|
|
dword beg = PATH;
|
|
|
|
dword pos = PATH;
|
|
|
|
dword sav = PATH;
|
|
|
|
dword i;
|
|
|
|
while(DSBYTE[pos])
|
|
|
|
{
|
|
|
|
if(DSBYTE[pos]=='/')sav = pos;
|
|
|
|
pos++;
|
|
|
|
}
|
|
|
|
i = sav-beg;
|
|
|
|
while(i)
|
|
|
|
{
|
|
|
|
DSBYTE[BUF] = DSBYTE[beg];
|
|
|
|
beg++;
|
|
|
|
BUF++;
|
|
|
|
i--;
|
|
|
|
}
|
|
|
|
/*while(DSBYTE[beg])
|
|
|
|
{
|
|
|
|
DSBYTE[BUF1] = DSBYTE[beg];
|
|
|
|
beg++;
|
|
|
|
BUF1++;
|
|
|
|
}*/
|
|
|
|
//DSBYTE[BUF1] = 0;
|
|
|
|
DSBYTE[BUF] = 0;
|
|
|
|
}
|
2015-08-02 16:40:41 +02:00
|
|
|
char __BUF_DIR__[4096];
|
|
|
|
:struct SELF
|
|
|
|
{
|
|
|
|
dword dir;
|
|
|
|
dword file;
|
|
|
|
dword path;
|
|
|
|
} self;
|
2015-08-02 13:41:41 +02:00
|
|
|
|
2016-12-08 18:20:55 +01:00
|
|
|
dword __generator; // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
|
2015-07-12 01:45:19 +02:00
|
|
|
|
2015-07-20 01:09:56 +02:00
|
|
|
:dword program_path_length;
|
2015-07-16 03:44:30 +02:00
|
|
|
|
2015-07-12 01:45:19 +02:00
|
|
|
//The initialization of the initial data before running
|
2015-08-02 16:40:41 +02:00
|
|
|
void ______INIT______()
|
2015-07-12 01:45:19 +02:00
|
|
|
{
|
2016-11-25 17:03:34 +01:00
|
|
|
//if (program_path[0]!='/') I_Path++;
|
2016-11-25 16:19:45 +01:00
|
|
|
|
2015-08-02 16:40:41 +02:00
|
|
|
self.dir = #__BUF_DIR__;
|
|
|
|
self.file = 0;
|
|
|
|
self.path = I_Path;
|
|
|
|
__path_name__(#__BUF_DIR__,I_Path);
|
2015-07-20 01:09:56 +02:00
|
|
|
|
2016-01-07 16:26:59 +01:00
|
|
|
skin_height = GetSkinHeight();
|
2016-11-30 17:41:21 +01:00
|
|
|
screen.width = GetScreenWidth()+1;
|
|
|
|
screen.height = GetScreenHeight()+1;
|
2015-07-20 01:09:56 +02:00
|
|
|
|
2015-07-12 01:45:19 +02:00
|
|
|
__generator = GetStartTime();
|
2015-08-02 17:15:15 +02:00
|
|
|
|
2016-01-01 17:51:53 +01:00
|
|
|
mem_init();
|
2015-08-02 17:15:15 +02:00
|
|
|
|
2016-11-21 21:25:00 +01:00
|
|
|
|
2015-07-12 01:45:19 +02:00
|
|
|
main();
|
2015-11-26 11:53:50 +01:00
|
|
|
ExitProcess();
|
2015-07-22 20:32:54 +02:00
|
|
|
}
|
2015-08-02 16:40:41 +02:00
|
|
|
______STOP______:
|
2016-01-01 17:51:53 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef INCLUDE_MEM_H
|
|
|
|
#include "../lib/mem.h"
|
|
|
|
#endif
|
2016-01-15 00:05:51 +01:00
|
|
|
|
|
|
|
#ifndef INCLUDE_DEBUG_H
|
|
|
|
#include "../lib/debug.h"
|
|
|
|
#endif
|