static void show_command_line_help() { char gameverstrbuffer[80] = ""; char *gameverstrptr = gameverstrbuffer, *gameverstrend = gameverstrbuffer + sizeof(gameverstrbuffer); for (int gameVerVal = 0; gameVerVal < BE_GAMEVER_LAST; ++gameVerVal) { if (gameVerVal < BE_GAMEVER_LAST-1) gameverstrptr = BE_Cross_safeandfastcstringcopy_2strs(gameverstrptr, gameverstrend, refkeen_gamever_strs[gameVerVal], ", "); else gameverstrptr = BE_Cross_safeandfastcstringcopy(gameverstrptr, gameverstrend, refkeen_gamever_strs[gameVerVal]); } // HACK - For text mode emulation (and exit handler) BE_ST_PrepareForGameStartupWithoutAudio(); BE_ST_puts("*** " REFKEEN_TITLE_AND_VER_STRING " - Command line arguments ***"); BE_ST_puts(""); #ifdef REFKEEN_ENABLE_LAUNCHER BE_ST_puts("Launcher is started unless any command line argument is passed."); BE_ST_puts(""); #endif BE_ST_puts("List of possible command line arguments:"); BE_ST_puts("-gamever <VER>: Select game version supported by this executable."); #ifdef REFKEEN_VER_CATADVENTURES BE_ST_puts("-skipintro: Skip what is found in the original intro EXE and start game."); #ifdef REFKEEN_VER_CATABYSS BE_ST_puts("-showslides: Show the electronic catalog / hint book."); #else BE_ST_puts("-showslides: Show the hint book."); #endif #endif BE_ST_puts("-passorigargs <...>: Pass all following arguments to the original game port."); BE_ST_puts("-datadir <...>: Specify an alternative path for game data (separated by ver.)."); BE_ST_puts("-cfgdir <...>: Specify an alternative path for new cfg files (not old CONFIG)."); #ifdef REFKEEN_ENABLE_LAUNCHER BE_ST_puts("-fulllauncher: Show a fullscreen launcher window."); BE_ST_puts("-softlauncher: Show a software-rendered launcher window (not fullscreen)."); #endif BE_ST_puts(""); BE_ST_puts("Note: The path passed to -datadir or -cfgdir is assumed to exist."); BE_ST_puts(""); BE_ST_puts("Supported game versions:"); BE_ST_printf("%s\n", gameverstrbuffer); BE_ST_HandleExit(0); }
// gameVer should be BE_GAMEVER_LAST if no specific version is desired void BE_Cross_SelectGameInstallation(int gameVerVal) { if (gameVerVal == BE_GAMEVER_LAST) { if (!g_be_gameinstallations_num) { BE_ST_ExitWithErrorMsg("BE_Cross_SelectGameInstallation: No compatible game installation found!"); } g_be_selectedGameInstallation = &g_be_gameinstallations[0]; } else { int gameInstNum; for (gameInstNum = 0; gameInstNum < g_be_gameinstallations_num; ++gameInstNum) { if (g_be_gameinstallations[gameInstNum].verId == gameVerVal) { break; } } if (gameInstNum == g_be_gameinstallations_num) { char errorBuffer[80]; BE_Cross_safeandfastcstringcopy_2strs(errorBuffer, errorBuffer+sizeof(errorBuffer), "BE_Cross_SelectGameInstallation: Can't find game installation: ", refkeen_gamever_strs[gameVerVal]); BE_ST_ExitWithErrorMsg(errorBuffer); } g_be_selectedGameInstallation = &g_be_gameinstallations[gameInstNum]; } refkeen_current_gamever = g_be_selectedGameInstallation->verId; //extern void RefKeen_Patch_id_ca(void); //RefKeen_Patch_id_ca(); extern void RefKeen_Patch_id_us(void); RefKeen_Patch_id_us(); #ifdef REFKEEN_VER_KDREAMS extern void RefKeen_Patch_id_rf(void); RefKeen_Patch_id_rf(); //extern void RefKeen_Patch_kd_play(void); //RefKeen_Patch_kd_play(); #endif #ifdef REFKEEN_VER_CAT3D extern void RefKeen_Patch_c3_game(void); RefKeen_Patch_c3_game(); extern void RefKeen_Patch_c3_play(void); RefKeen_Patch_c3_play(); #endif #ifdef REFKEEN_VER_CATABYSS extern void RefKeen_Patch_c4_main(void); RefKeen_Patch_c4_main(); extern void RefKeen_Patch_c4_play(void); RefKeen_Patch_c4_play(); extern void RefKeen_Patch_gelib(void); RefKeen_Patch_gelib(); #endif #ifdef REFKEEN_VER_CATADVENTURES extern void RefKeen_Patch_intro(void); RefKeen_Patch_intro(); #endif /*extern void RefKeen_FillObjStatesWithDOSPointers(void); RefKeen_FillObjStatesWithDOSPointers(); // Saved games compatibility*/ }
void BE_Cross_PrepareGameInstallations(void) { /*** Some misc. preparation ***/ #ifdef REFKEEN_PLATFORM_UNIX #if (defined REFKEEN_VER_KDREAMS_CGA_ALL) const char *homedir = getenv("HOME"); char path[BE_CROSS_PATH_LEN_BOUND]; char *pathEnd = path + sizeof(path); #endif #endif #ifdef REFKEEN_PLATFORM_WINDOWS #if (defined REFKEEN_VER_CAT3D) || (defined REFKEEN_VER_CATABYSS) || (defined REFKEEN_VER_CATARM) || (defined REFKEEN_VER_CATAPOC) char path[BE_CROSS_PATH_LEN_BOUND]; char gog_catacombs_path[BE_CROSS_PATH_LEN_BOUND]; DWORD dwType = 0; DWORD dwSize = sizeof(gog_catacombs_path); LSTATUS status = SHGetValueA(HKEY_LOCAL_MACHINE, "SOFTWARE\\GOG.COM\\GOGCATACOMBSPACK", "PATH", &dwType, gog_catacombs_path, &dwSize); bool isGogCatacombsPathFound = ((status == ERROR_SUCCESS) && (dwType == REG_SZ)); char *gog_catacombs_path_end; if (isGogCatacombsPathFound) { path_gog_catacombs_prefix_end = path/*NOT gog_catacombs_path*/ + strlen(gog_catacombs_path); } #endif #endif /*** Now handling each version separately ***/ #ifdef REFKEEN_VER_KDREAMS_CGA_ALL BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_kdreamsc105, ".", "Keen Dreams CGA v1.05 (Local)"); #ifdef REFKEEN_PLATFORM_UNIX if (homedir) { BE_Cross_safeandfastcstringcopy_2strs(path, pathEnd, homedir, "/.steam/steam/SteamApps/common/Keen Dreams/cga"); BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_kdreamsc105, path, "Keen Dreams CGA v1.05 (Steam)"); } #endif #endif #ifdef REFKEEN_VER_KDREAMS_ANYEGA_ALL //BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_kdreamse113, ".", "Keen Dreams EGA v1.13 (Local)"); //BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_kdreamse193, ".", "Keen Dreams EGA v1.93 (Local)"); //BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_kdreamse120, ".", "Keen Dreams EGA v1.20 (Local)"); #endif #ifdef REFKEEN_VER_CAT3D BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_cat3d100, ".", "Catacomb 3-D v1.00 (Local)"); BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_cat3d122, ".", "Catacomb 3-D v1.22 (Local)"); #ifdef REFKEEN_PLATFORM_WINDOWS if (isGogCatacombsPathFound) { memcpy(path, gog_catacombs_path, sizeof(path)); BE_Cross_safeandfastcstringcopy(path_gog_catacombs_prefix_end, ptrEnd, "\\Cat3D"); BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_cat3d122, path, "Catacomb 3-D v1.22 (GOG.com)"); } #endif #endif #ifdef REFKEEN_VER_CATABYSS BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_catabyss113, ".", "Catacomb Abyss v1.13 (Local)"); BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_catabyss124, ".", "Catacomb Abyss v1.24 (Local)"); #ifdef REFKEEN_PLATFORM_WINDOWS if (isGogCatacombsPathFound) { memcpy(path, gog_catacombs_path, sizeof(path)); BE_Cross_safeandfastcstringcopy(path_gog_catacombs_prefix_end, ptrEnd, "\\Abyss"); BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_catabyss124, path, "Catacomb Abyss v1.24 (GOG.com)"); } #endif #endif #ifdef REFKEEN_VER_CATARM BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_catarm102, ".", "Catacomb Armageddon v1.02 (Local)"); #ifdef REFKEEN_PLATFORM_WINDOWS if (isGogCatacombsPathFound) { memcpy(path, gog_catacombs_path, sizeof(path)); BE_Cross_safeandfastcstringcopy(path_gog_catacombs_prefix_end, ptrEnd, "\\Armageddon"); BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_catarm102, path, "Catacomb Armageddon v1.02 (GOG.com)"); } #endif #endif #ifdef REFKEEN_VER_CATAPOC BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_catapoc101, ".", "Catacomb Apocalypse v1.01 (Local)"); #ifdef REFKEEN_PLATFORM_WINDOWS if (isGogCatacombsPathFound) { memcpy(path, gog_catacombs_path, sizeof(path)); BE_Cross_safeandfastcstringcopy(path_gog_catacombs_prefix_end, ptrEnd, "\\Apocalypse"); BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_catapoc101, path, "Catacomb Apocalypse v1.01 (GOG.com)"); } #endif #endif }