CGameStartup::~CGameStartup() { if (m_pGame) { m_pGame->Shutdown(); m_pGame = nullptr; } if (m_gameDll) { CryFreeLibrary(m_gameDll); m_gameDll = 0; } ShutdownFramework(); }
CGameStartup::~CGameStartup() { if (m_pMod) { m_pMod->Shutdown(); m_pMod = 0; } if (m_modDll) { CryFreeLibrary(m_modDll); m_modDll = 0; } ShutdownFramework(); }
CGameStartup::~CGameStartup() { if (m_pMod) { m_pMod->Shutdown(); m_pMod = 0; } if (m_modDll) { CryFreeLibrary(m_modDll); m_modDll = 0; } CGameStartupStatic::g_pGameStartup = NULL; ShutdownFramework(); }
static void CleanupFrameworkDLL() { assert( s_frameworkDLL ); CryFreeLibrary( s_frameworkDLL ); s_frameworkDLL = 0; }
IGameRef CGameStartup::Reset(const char *pModName) { if (m_pMod) { m_pMod->Shutdown(); if (m_modDll) { CryFreeLibrary(m_modDll); m_modDll = 0; } } m_modDll = 0; string modPath; if (stricmp(pModName, GAME_NAME) != 0) { modPath.append("Mods\\"); modPath.append(pModName); modPath.append("\\"); string filename; filename.append("..\\"); filename.append(modPath); #ifdef WIN64 filename.append("Bin64\\"); #else filename.append("Bin32\\"); #endif filename.append(pModName); filename.append(".dll"); #if !defined(_LIB) && !defined(LINUX) && !defined(PS3) m_modDll = CryLoadLibrary(filename.c_str()); #endif } if (!m_modDll) { ModuleInitISystem(m_pFramework->GetISystem(),"CryGame"); static char pGameBuffer[sizeof(CGame)]; m_pMod = new ((void*)pGameBuffer) CGame(); } else { IGame::TEntryFunction CreateGame = (IGame::TEntryFunction)CryGetProcAddress(m_modDll, "CreateGame"); if (!CreateGame) return 0; m_pMod = CreateGame(m_pFramework); } if (m_pMod && m_pMod->Init(m_pFramework)) { return m_modRef; } return 0; }