2008-12-30 00:23:33 +01:00
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
typedef unsigned __int32 Dword;
|
|
|
|
|
typedef unsigned __int16 Word;
|
|
|
|
|
typedef unsigned __int8 Byte;
|
|
|
|
|
//typedef unsigned __int32 size_t;
|
|
|
|
|
|
|
|
|
|
#define NULL 0
|
|
|
|
|
|
|
|
|
|
#define MAX_PATH 256
|
|
|
|
|
|
|
|
|
|
#define FO_READ 0
|
|
|
|
|
#define FO_WRITE 2
|
|
|
|
|
|
|
|
|
|
#define EM_WINDOW_REDRAW 1
|
|
|
|
|
#define EM_KEY_PRESS 2
|
|
|
|
|
#define EM_BUTTON_CLICK 4
|
|
|
|
|
#define EM_APP_CLOSE 8
|
|
|
|
|
#define EM_DRAW_BACKGROUND 16
|
|
|
|
|
#define EM_MOUSE_EVENT 32
|
|
|
|
|
#define EM_IPC 64
|
|
|
|
|
#define EM_NETWORK 256
|
|
|
|
|
|
|
|
|
|
#define KM_CHARS 0
|
|
|
|
|
#define KM_SCANS 1
|
|
|
|
|
|
|
|
|
|
#define WRS_BEGIN 1
|
|
|
|
|
#define WRS_END 2
|
|
|
|
|
|
|
|
|
|
#define PROCESS_ID_SELF -1
|
|
|
|
|
|
|
|
|
|
#define abs(a) (a<0?0-a:a)
|
|
|
|
|
|
2011-01-25 13:53:48 +01:00
|
|
|
|
extern "C" double __cdecl acos(double x);
|
|
|
|
|
extern "C" double __cdecl asin(double x);
|
|
|
|
|
extern "C" double __cdecl floor(double x);
|
|
|
|
|
extern "C" double __cdecl round(double x);
|
2008-12-30 00:23:33 +01:00
|
|
|
|
#pragma function(acos,asin)
|
|
|
|
|
#if _MSC_VER > 1200
|
|
|
|
|
#pragma function(floor)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct kosFileInfo
|
|
|
|
|
{
|
|
|
|
|
Dword rwMode;
|
|
|
|
|
Dword OffsetLow;
|
|
|
|
|
Dword OffsetHigh;
|
|
|
|
|
Dword dataCount;
|
|
|
|
|
Byte *bufferPtr;
|
|
|
|
|
char fileURL[MAX_PATH];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct RGB
|
|
|
|
|
{
|
|
|
|
|
Byte b;
|
|
|
|
|
Byte g;
|
|
|
|
|
Byte r;
|
|
|
|
|
//
|
|
|
|
|
RGB() {};
|
|
|
|
|
//
|
|
|
|
|
RGB( Dword value )
|
|
|
|
|
{
|
|
|
|
|
r = (Byte)(value >> 16);
|
|
|
|
|
g = (Byte)(value >> 8);
|
|
|
|
|
b = (Byte)value;
|
|
|
|
|
};
|
|
|
|
|
//
|
|
|
|
|
bool operator != ( RGB &another )
|
|
|
|
|
{
|
|
|
|
|
return this->b != another.b || this->g != another.g || this->r != another.r;
|
|
|
|
|
};
|
|
|
|
|
//
|
|
|
|
|
bool operator == ( RGB &another )
|
|
|
|
|
{
|
|
|
|
|
return this->b == another.b && this->g == another.g && this->r == another.r;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2012-06-07 15:27:56 +02:00
|
|
|
|
#pragma pack(push, 1)
|
2008-12-30 00:23:33 +01:00
|
|
|
|
union sProcessInfo
|
|
|
|
|
{
|
|
|
|
|
Byte rawData[1024];
|
|
|
|
|
struct
|
|
|
|
|
{
|
|
|
|
|
Dword cpu_usage;
|
|
|
|
|
Word window_stack_position;
|
|
|
|
|
Word window_stack_value;
|
|
|
|
|
Word reserved1;
|
|
|
|
|
char process_name[12];
|
|
|
|
|
Dword memory_start;
|
|
|
|
|
Dword used_memory;
|
|
|
|
|
Dword PID;
|
|
|
|
|
Dword x_start;
|
|
|
|
|
Dword y_start;
|
|
|
|
|
Dword x_size;
|
|
|
|
|
Dword y_size;
|
|
|
|
|
Word slot_state;
|
|
|
|
|
} processInfo;
|
|
|
|
|
};
|
2012-06-07 15:27:56 +02:00
|
|
|
|
#pragma pack(pop)
|
2008-12-30 00:23:33 +01:00
|
|
|
|
|
2011-01-25 13:53:48 +01:00
|
|
|
|
#ifndef AUTOBUILD
|
2008-12-30 00:23:33 +01:00
|
|
|
|
//
|
|
|
|
|
extern char *kosExePath;
|
2011-01-25 13:53:48 +01:00
|
|
|
|
#endif
|
2008-12-30 00:23:33 +01:00
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
void crtStartUp();
|
|
|
|
|
//
|
|
|
|
|
int __cdecl _purecall();
|
|
|
|
|
//
|
|
|
|
|
int __cdecl atexit( void (__cdecl *func )( void ));
|
|
|
|
|
//
|
|
|
|
|
void rtlSrand( Dword seed );
|
|
|
|
|
Dword rtlRand( void );
|
|
|
|
|
//
|
|
|
|
|
char * __cdecl strcpy( char *target, const char *source );
|
|
|
|
|
int __cdecl strlen( const char *line );
|
|
|
|
|
char * __cdecl strrchr( const char * string, int c );
|
|
|
|
|
|
|
|
|
|
#if _MSC_VER < 1400
|
|
|
|
|
extern "C" void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
|
|
|
|
|
extern "C" void memset( Byte *dst, Byte filler, Dword count );
|
|
|
|
|
//#pragma intrinsic(memcpy,memset)
|
2011-01-25 13:53:48 +01:00
|
|
|
|
#elif defined AUTOBUILD
|
|
|
|
|
void memcpy( void *dst, const void *src, size_t bytesCount );
|
|
|
|
|
void memset( Byte *dst, Byte filler, Dword count );
|
2008-12-30 00:23:33 +01:00
|
|
|
|
#else
|
|
|
|
|
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
|
|
|
|
|
void memset( Byte *dst, Byte filler, Dword count );
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
void sprintf( char *Str, char* Format, ... );
|
|
|
|
|
//
|
|
|
|
|
Dword rtlInterlockedExchange( Dword *target, Dword value );
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void kos_ExitApp();
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0
|
|
|
|
|
void kos_DefineAndDrawWindow(
|
|
|
|
|
Word x, Word y,
|
|
|
|
|
Word sizeX, Word sizeY,
|
|
|
|
|
Byte mainAreaType, Dword mainAreaColour,
|
|
|
|
|
Byte headerType, Dword headerColour,
|
|
|
|
|
Dword borderColour
|
|
|
|
|
);
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void kos_PutPixel( Dword x, Dword y, Dword colour );
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
bool kos_GetKey( Byte &keyCode );
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Dword kos_GetSystemClock();
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4
|
2011-01-25 13:53:48 +01:00
|
|
|
|
void __declspec(noinline) kos_WriteTextToWindow(
|
2008-12-30 00:23:33 +01:00
|
|
|
|
Word x, Word y,
|
|
|
|
|
Byte fontType,
|
|
|
|
|
Dword textColour,
|
|
|
|
|
char *textPtr,
|
|
|
|
|
Dword textLen
|
|
|
|
|
);
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 7 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 8 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2011-01-25 13:53:48 +01:00
|
|
|
|
void __declspec(noinline) kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
|
2008-12-30 00:23:33 +01:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5 <20><><EFBFBD><EFBFBD><EFBFBD>, <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void kos_Pause( Dword value );
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 9 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 10
|
|
|
|
|
Dword kos_WaitForEvent();
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 11
|
|
|
|
|
Dword kos_CheckForEvent();
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 12
|
|
|
|
|
void kos_WindowRedrawStatus( Dword status );
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 13 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2011-01-25 13:53:48 +01:00
|
|
|
|
void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
|
2008-12-30 00:23:33 +01:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 17
|
|
|
|
|
bool kos_GetButtonID( Dword &buttonID );
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 23
|
2012-06-06 23:39:30 +02:00
|
|
|
|
Dword kos_WaitForEventTimeout( Dword timeOut );
|
2008-12-30 00:23:33 +01:00
|
|
|
|
//
|
|
|
|
|
enum eNumberBase
|
|
|
|
|
{
|
|
|
|
|
nbDecimal = 0,
|
|
|
|
|
nbHex,
|
|
|
|
|
nbBin
|
|
|
|
|
};
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD>" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 37
|
|
|
|
|
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 40 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void kos_SetMaskForEvents( Dword mask );
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 47 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void kos_DisplayNumberToWindow(
|
|
|
|
|
Dword value,
|
|
|
|
|
Dword digitsNum,
|
|
|
|
|
Word x,
|
|
|
|
|
Word y,
|
|
|
|
|
Dword colour,
|
|
|
|
|
eNumberBase nBase = nbDecimal,
|
|
|
|
|
bool valueIsPointer = false
|
|
|
|
|
);
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 58 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 63
|
|
|
|
|
void kos_DebugOutChar( char ccc );
|
|
|
|
|
//
|
|
|
|
|
void rtlDebugOutString( char *str );
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 64 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> == -1 <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 67 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
bool kos_ApplicationMemoryResize( Dword targetSize );
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 66 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void kos_SetKeyboardDataMode( Dword mode );
|
|
|
|
|
|
|
|
|
|
void kos_InitHeap();
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
void kos_Main();
|