Files
kolibrios/programs/games/floppybird/smalllibc/kosSyst.h
T
leency e0f45e268a flappybird renamed to floppybird
kiv fix label with green bg in fullscreen mode
2025-02-24 21:37:50 +02:00

218 lines
5.1 KiB
C

#pragma once
typedef unsigned __int32 Dword;
typedef unsigned __int16 Word;
typedef unsigned __int8 Byte;
//typedef unsigned __int32 size_t;
extern "C" char kosCmdLine[]; // command line initialized by OS
extern "C" char kosExePath[]; // path to binary initialized by OS
#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)
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);
#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;
};
};
#pragma pack(push, 1)
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;
};
#pragma pack(pop)
//
extern "C" void __cdecl 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)
#else
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
void memset( Byte *dst, Byte filler, Dword count );
#endif
unsigned int num2hex( unsigned int num );
void sprintf( char *Str, char* Format, ... );
//
Dword rtlInterlockedExchange( Dword *target, Dword value );
// ЇєэъЎш  -1 чртхЁ°хэш  яЁюЎхёёр
void __declspec(noreturn) kos_ExitApp();
// ЇєэъЎш  0
void kos_DefineAndDrawWindow(
Word x, Word y,
Word sizeX, Word sizeY,
Byte mainAreaType, Dword mainAreaColour,
Byte headerType, Dword headerColour,
Dword borderColour
);
// ЇєэъЎш  1 яюёЄртшЄ№ Єюўъє
void kos_PutPixel( Dword x, Dword y, Dword colour );
// ЇєэъЎш  2 яюыєўшЄ№ ъюф эрцрЄющ ъыртш°ш
bool kos_GetKey( Byte &keyCode );
// ЇєэъЎш  3 яюыєўшЄ№ тЁхь 
Dword kos_GetSystemClock();
// ЇєэъЎш  4
void kos_WriteTextToWindow(
Word x, Word y,
Byte fontType,
Dword textColour,
const char *textPtr,
Dword textLen
);
// ЇєэъЎш  7 эрЁшёютрЄ№ шчюсЁрцхэшх
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
// ЇєэъЎш  8 юяЁхфхышЄ№ ъэюяъє
void __declspec(noinline) kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
// ЇєэъЎш  5 ярєчр, т ёюЄ√ї фюы ї ёхъєэф√
void kos_Pause( Dword value );
// ЇєэъЎш  9 - шэЇюЁьрЎш  ю яЁюЎхёёх
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
// ЇєэъЎш  10
Dword kos_WaitForEvent();
// ЇєэъЎш  11
Dword kos_CheckForEvent();
// ЇєэъЎш  12
void kos_WindowRedrawStatus( Dword status );
// ЇєэъЎш  13 эрЁшёютрЄ№ яюыюёє
void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
// ЇєэъЎш  17
bool kos_GetButtonID( Dword &buttonID );
// ЇєэъЎш  23
Dword kos_WaitForEventTimeout( Dword timeOut );
//
enum eNumberBase
{
nbDecimal = 0,
nbHex,
nbBin
};
// яюыєўхэшх шэЇюЁьрЎшш ю ёюёЄю эшш "ь√°ш" ЇєэъЎш  37
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
// ЇєэъЎш  40 єёЄрэютшЄ№ ьрёъє ёюс√Єшщ
void kos_SetMaskForEvents( Dword mask );
// ЇєэъЎш  47 т√тхёЄш т юъэю яЁшыюцхэш  ўшёыю
void kos_DisplayNumberToWindow(
Dword value,
Dword digitsNum,
Word x,
Word y,
Dword colour,
eNumberBase nBase = nbDecimal,
bool valueIsPointer = false
);
// ЇєэъЎш  58 фюёЄєя ъ Їрщыютющ ёшёЄхьх
Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
// ЇєэъЎш  63
void kos_DebugOutChar( char ccc );
//
void rtlDebugOutString( char *str );
// ЇєэъЎш  64 шчьхэшЄ№ ярЁрьхЄЁ√ юъэр, ярЁрьхЄЁ == -1 эх ьхэ хЄё 
void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
// ЇєэъЎш  67 шчьхэхэшх ъюышўхёЄтр ярь Єш, т√фхыхээющ фы  яЁюуЁрьь√
bool kos_ApplicationMemoryResize( Dword targetSize );
// ЇєэъЎш  66 Ёхцшь яюыєўхэш  фрээ√ї юЄ ъыртшрЄєЁ√
void kos_SetKeyboardDataMode( Dword mode );
void kos_InitHeap();
//
void kos_Main();