diff --git a/data/Tupfile.lua b/data/Tupfile.lua index b565605de5..edd326b890 100644 --- a/data/Tupfile.lua +++ b/data/Tupfile.lua @@ -135,7 +135,7 @@ extra_files = { {"kolibrios/emul/", "common/emul/scummvm"}, {"kolibrios/emul/", "common/emul/zsnes"}, {"kolibrios/games/doom/", "common/games/doom/*"}, - {"kolibrios/games/fara/fara", build_type .. "/games/fara"}, + {"kolibrios/games/fara/fara", PROGS .. "/games/fara/trunk/fara"}, {"kolibrios/games/fara/fara.gfx", "common/games/fara.gfx"}, {"kolibrios/games/jumpbump/", "common/games/jumpbump/*"}, {"kolibrios/games/quake/", "common/games/quake/*"}, diff --git a/data/eng/games/fara b/data/eng/games/fara deleted file mode 100644 index 098db220e5..0000000000 Binary files a/data/eng/games/fara and /dev/null differ diff --git a/data/et/games/fara b/data/et/games/fara deleted file mode 100644 index 098db220e5..0000000000 Binary files a/data/et/games/fara and /dev/null differ diff --git a/data/it/games/fara b/data/it/games/fara deleted file mode 100644 index 098db220e5..0000000000 Binary files a/data/it/games/fara and /dev/null differ diff --git a/data/rus/games/fara b/data/rus/games/fara deleted file mode 100644 index 0b9b17ece0..0000000000 Binary files a/data/rus/games/fara and /dev/null differ diff --git a/data/sp/games/fara b/data/sp/games/fara deleted file mode 100644 index 098db220e5..0000000000 Binary files a/data/sp/games/fara and /dev/null differ diff --git a/programs/games/fara/trunk/kosSyst.cpp b/programs/games/fara/trunk/kosSyst.cpp index f9efec38df..ac36c6523f 100644 --- a/programs/games/fara/trunk/kosSyst.cpp +++ b/programs/games/fara/trunk/kosSyst.cpp @@ -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; @@ -843,6 +872,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 // инициализируем кучу __asm { @@ -859,8 +892,10 @@ void crtStartUp() } // инициализируем генератор случайных чисел rtlSrand( kos_GetSystemClock() ); +#ifndef AUTOBUILD // путь к файлу процесса kosExePath = *((char **)0x20); +#endif // вызов главной функции приложения kos_Main(); // выход diff --git a/programs/games/fara/trunk/kosSyst.h b/programs/games/fara/trunk/kosSyst.h index 5bc41e6ffd..b1abbce8c6 100644 --- a/programs/games/fara/trunk/kosSyst.h +++ b/programs/games/fara/trunk/kosSyst.h @@ -89,8 +89,12 @@ union sProcessInfo } processInfo; }; +#ifdef AUTOBUILD +extern char kosExePath[]; +#else // extern char *kosExePath; +#endif // void crtStartUp();