auto-build games/rforces

git-svn-id: svn://kolibrios.org@5114 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
CleverMouse 2014-09-12 18:52:36 +00:00
parent 822ea2a0c5
commit d1289fac5e
2 changed files with 39 additions and 2 deletions

View File

@ -3,11 +3,40 @@
#define atexitBufferSize 32
// Autobuild uses FASM method for exe->kos,
// MENUET01 header should be present in EXE.
#ifdef AUTOBUILD
char kosExePath[1024];
char exeStack[16384];
// must be alphabetically first in the image
#pragma data_seg(".1seg")
extern "C" struct
{
char header[8];
int headerver;
void* entry;
void* i_end;
void* memsize;
void* stack;
void* params;
void* icon;
} header = {
{'M', 'E', 'N', 'U', 'E', 'T', '0', '1'},
1,
&crtStartUp,
0, // filled by doexe2.asm
0, // filled by doexe2.asm
exeStack + sizeof(exeStack),
NULL,
kosExePath
};
#pragma data_seg()
#else
char *kosExePath = NULL;
#endif
char pureCallMessage[] = "PURE function call!";
char *kosExePath = NULL;
//
void (__cdecl *atExitList[atexitBufferSize])();
int atExitFnNum = 0;
@ -950,6 +979,10 @@ __declspec(allocate(".CRT$XCZ")) _PVFV __xc_z[1] = { NULL };
//
void crtStartUp()
{
#ifdef AUTOBUILD
// linker will try to remove unused variables; force header to be included
header.header;
#endif
// âûçûâàåì èíèöèàëèçàòîðû ïî ñïèñêó, NULL'û èãíîðèðóåì
for ( _PVFV *pbegin = __xc_a; pbegin < __xc_z; pbegin++ )
{
@ -959,8 +992,10 @@ void crtStartUp()
}
// èíèöèàëèçèðóåì ãåíåðàòîð ñëó÷àéíûõ ÷èñåë
rtlSrand( kos_GetSystemClock() );
#ifndef AUTOBUILD
// ïóòü ê ôàéëó ïðîöåññà
kosExePath = *((char **)0x20);
#endif
// âûçîâ ãëàâíîé ôóíêöèè ïðèëîæåíèÿ
kos_Main();
// âûõîä

View File

@ -89,8 +89,10 @@ union sProcessInfo
} processInfo;
};
#ifndef AUTOBUILD
//
extern char *kosExePath;
#endif
//
void crtStartUp();