diff --git a/data/Tupfile.lua b/data/Tupfile.lua index 388b3be708..45a41beeda 100644 --- a/data/Tupfile.lua +++ b/data/Tupfile.lua @@ -53,7 +53,6 @@ img_files = { {"File Managers/KFM.INI", "common/File Managers/kfm.ini"}, {"GAMES/CHECKERS", build_type .. "/games/checkers"}, {"GAMES/MEGAMAZE", build_type .. "/games/megamaze"}, - {"GAMES/XONIX", build_type .. "/games/xonix"}, {"LIB/PIXLIB.OBJ", "common/lib/pixlib.obj"}, {"LIB/ICONV.OBJ", "common/lib/iconv.obj"}, {"LIB/NETCODE.OBJ", "common/lib/netcode.obj"}, @@ -445,6 +444,7 @@ tup.append_table(img_files, { {"MEDIA/AC97SND", PROGS .. "/media/ac97snd/ac97snd.bin"}, {"GAMES/KOSILKA", PROGS .. "/games/kosilka/kosilka"}, {"GAMES/RFORCES", PROGS .. "/games/rforces/trunk/rforces"}, + {"GAMES/XONIX", PROGS .. "/games/xonix/trunk/xonix"}, }) tup.append_table(extra_files, { {"kolibrios/games/fara/fara", PROGS .. "/games/fara/trunk/fara"}, diff --git a/data/eng/games/xonix b/data/eng/games/xonix deleted file mode 100644 index 2706da9bbc..0000000000 Binary files a/data/eng/games/xonix and /dev/null differ diff --git a/data/et/games/xonix b/data/et/games/xonix deleted file mode 100644 index 2706da9bbc..0000000000 Binary files a/data/et/games/xonix and /dev/null differ diff --git a/data/it/games/xonix b/data/it/games/xonix deleted file mode 100644 index 2706da9bbc..0000000000 Binary files a/data/it/games/xonix and /dev/null differ diff --git a/data/rus/games/xonix b/data/rus/games/xonix deleted file mode 100644 index bf29d0863c..0000000000 Binary files a/data/rus/games/xonix and /dev/null differ diff --git a/data/sp/games/xonix b/data/sp/games/xonix deleted file mode 100644 index 2706da9bbc..0000000000 Binary files a/data/sp/games/xonix and /dev/null differ diff --git a/programs/games/xonix/trunk/Tupfile.lua b/programs/games/xonix/trunk/Tupfile.lua index 3bf576ada4..609e57c422 100644 --- a/programs/games/xonix/trunk/Tupfile.lua +++ b/programs/games/xonix/trunk/Tupfile.lua @@ -1,5 +1,9 @@ if tup.getconfig("NO_MSVC") ~= "" then return end HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR") tup.include(HELPERDIR .. "/use_msvc.lua") +if tup.getconfig("LANG") == "ru" +then CFLAGS = CFLAGS .. " /DLANG=RUS" +else CFLAGS = CFLAGS .. " /DLANG=ENG" +end compile_msvc{"*.cpp"} link_msvc("xonix") diff --git a/programs/games/xonix/trunk/kosSyst.cpp b/programs/games/xonix/trunk/kosSyst.cpp index af685c0927..ae60233dbb 100644 --- a/programs/games/xonix/trunk/kosSyst.cpp +++ b/programs/games/xonix/trunk/kosSyst.cpp @@ -2,11 +2,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; @@ -809,6 +838,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++ ) { @@ -818,8 +851,10 @@ void crtStartUp() } // инициализируем генератор случайных чисел rtlSrand( kos_GetSystemClock() ); +#ifndef AUTOBUILD // путь к файлу процесса kosExePath = *((char **)0x20); +#endif // вызов главной функции приложения kos_Main(); // выход diff --git a/programs/games/xonix/trunk/kosSyst.h b/programs/games/xonix/trunk/kosSyst.h index aed509e253..5015974b60 100644 --- a/programs/games/xonix/trunk/kosSyst.h +++ b/programs/games/xonix/trunk/kosSyst.h @@ -95,8 +95,12 @@ struct PRINTK Dword args[11]; }; +#ifdef AUTOBUILD +extern char kosExePath[]; +#else // extern char *kosExePath; +#endif // void crtStartUp(); diff --git a/programs/games/xonix/trunk/lang.h b/programs/games/xonix/trunk/lang.h index ef15793f1a..63b5067569 100644 --- a/programs/games/xonix/trunk/lang.h +++ b/programs/games/xonix/trunk/lang.h @@ -1,3 +1,5 @@ #define RUS 1 #define ENG 2 -#define LANG RUS \ No newline at end of file +#ifndef LANG +#define LANG RUS +#endif