================= idCommonLocal::LoadGameDLL ================= */
| 2710 | ================= |
| 2711 | */ |
| 2712 | void idCommonLocal::LoadGameDLL( void ) { |
| 2713 | #ifdef __DOOM_DLL__ |
| 2714 | const char *fs_game; |
| 2715 | char dll[MAX_OSPATH]; |
| 2716 | idStr s; |
| 2717 | |
| 2718 | gameImport_t gameImport; |
| 2719 | gameExport_t gameExport; |
| 2720 | GetGameAPI_t GetGameAPI; |
| 2721 | |
| 2722 | fs_game = cvarSystem->GetCVarString("fs_game"); |
| 2723 | if (!fs_game || !fs_game[0]) |
| 2724 | fs_game = BASE_GAMEDIR; |
| 2725 | |
| 2726 | gameDLL = 0; |
| 2727 | |
| 2728 | sys->DLL_GetFileName(fs_game, dll, sizeof(dll)); |
| 2729 | LoadGameDLLbyName(dll, s); |
| 2730 | |
| 2731 | // there was no gamelib for this mod, use default one from base game |
| 2732 | if (!gameDLL) { |
| 2733 | common->Printf( "\n" ); |
| 2734 | |
| 2735 | const char *fs_base = cvarSystem->GetCVarString("fs_game_base"); |
| 2736 | if (fs_base && fs_base[0]) { |
| 2737 | common->Warning( "couldn't load mod-specific %s, defaulting to library of fs_game_base (%s)!\n", dll, fs_base); |
| 2738 | sys->DLL_GetFileName(fs_base, dll, sizeof(dll)); |
| 2739 | LoadGameDLLbyName(dll, s); |
| 2740 | if ( !gameDLL ) { |
| 2741 | common->Warning( "couldn't load fs_game_base lib %s either, defaulting to base game's library!\n", dll); |
| 2742 | } |
| 2743 | } else { |
| 2744 | common->Warning( "couldn't load mod-specific %s, defaulting to base game's library!\n", dll ); |
| 2745 | } |
| 2746 | |
| 2747 | if ( !gameDLL ) { |
| 2748 | sys->DLL_GetFileName(BASE_GAMEDIR, dll, sizeof(dll)); |
| 2749 | LoadGameDLLbyName(dll, s); |
| 2750 | } |
| 2751 | } |
| 2752 | |
| 2753 | if ( !gameDLL ) { |
| 2754 | common->FatalError( "couldn't load game dynamic library '%s'", dll ); |
| 2755 | return; |
| 2756 | } |
| 2757 | |
| 2758 | common->Printf("loaded game library '%s'.\n", s.c_str()); |
| 2759 | |
| 2760 | GetGameAPI = (GetGameAPI_t) Sys_DLL_GetProcAddress( gameDLL, "GetGameAPI" ); |
| 2761 | if ( !GetGameAPI ) { |
| 2762 | Sys_DLL_Unload( gameDLL ); |
| 2763 | gameDLL = 0; |
| 2764 | common->FatalError( "couldn't find game DLL API" ); |
| 2765 | return; |
| 2766 | } |
| 2767 | |
| 2768 | gameImport.version = GAME_API_VERSION; |
| 2769 | gameImport.sys = ::sys; |
nothing calls this directly
no test coverage detected