void ShutdownSessionWrap() { Instance<ICoreGameInit>::Get()->ClearVariable("networkInited"); Instance<ICoreGameInit>::Get()->SetVariable("gameKilled"); g_isNetworkKilled = true; *g_initState = MapInitState(14); AddCrashometry("kill_network_game", "true"); OnKillNetworkDone(); g_shutdownSession(); Instance<ICoreGameInit>::Get()->OnShutdownSession(); g_shouldKillNetwork = false; while (g_isNetworkKilled) { // warning screens apparently need to run on main thread OnGameFrame(); OnMainGameFrame(); g_runWarning(); } Instance<ICoreGameInit>::Get()->OnGameRequestLoad(); }
static void WaitForInitLoopWrap() { // certain executables may recheck activation after connection, and want to perform this state change after 12 - ignore those cases *g_initState = MapInitState(6); WaitForInitLoop(); }
static void WaitForInitLoop() { // run our loop g_isInInitLoop = true; while (*g_initState <= MapInitState(6)) { lookAlive(); if (*g_initState <= MapInitState(6)) { Sleep(15); } } //*g_initState = 7; }
static void WaitForInitLoop() { // run our loop g_isInInitLoop = true; while (*g_initState <= MapInitState(6)) { runCriticalSystemServicing(); lookAlive(); if (*g_initState <= MapInitState(6)) { Sleep(15); } } //*g_initState = 7; }
static void WrapRunInitState() { if (g_setLoadingScreens) { setupLoadingScreens(10, 0); g_setLoadingScreens = false; } if (g_shouldReloadGame) { Instance<ICoreGameInit>::Get()->OnGameRequestLoad(); *g_initState = MapInitState(14); g_shouldReloadGame = false; } if (g_shouldKillNetwork) { trace("Killing network, stage 2...\n"); *g_initState = MapInitState(14); g_shouldKillNetwork = false; } /*while (g_isNetworkKilled) { Sleep(50); // warning screens apparently need to run on main thread OnGameFrame(); OnMainGameFrame(); g_runWarning(); }*/ if (!g_isNetworkKilled) { g_origRunInitState(); } }
void FiveGameInit::LoadGameFirstLaunch(bool(*callBeforeLoad)()) { g_callBeforeLoad = callBeforeLoad; g_launchedGame = true; OnGameFrame.Connect([=] () { if (g_shouldSetState) { if (*g_initState == MapInitState(6)) { *g_initState = MapInitState(7); g_shouldSetState = false; } } static bool isLoading = false; if (isLoading) { if (*g_initState == 0) { OnGameFinalizeLoad(); isLoading = false; } } else { if (*g_initState != 0) { isLoading = true; } } }); OnGameRequestLoad(); // stuff if (*g_initState == MapInitState(6)) { *g_initState = MapInitState(7); } else { if (*g_initState == MapInitState(20)) { *g_initState = MapInitState(11); } g_shouldSetState = true; } }
////////////////////////////////////////////////////////////////////////////// // // MapInit // // Description: // Initializes a MAP_RES object. // This function must be called before using a new MAP_RES. // // Inputs: // pMap - pointer to a MAP_RES // // Outputs: // None // // Returns: // None // ////////////////////////////////////////////////////////////////////////////// FSTATUS MapInit( IN MAP_RES* const pMap ) { FSTATUS Status; MapInitState( pMap ); pMap->m_DelToggle = FALSE; Status = GrowPoolInit( &pMap->m_Pool, MAP_START_SIZE, // minimum number of objects to allocate sizeof( MAP_ITEM), // size of object MAP_GROW_SIZE, // minimum number of objects to grow NULL, // no state initialization needed NULL, // no initializer needed NULL, // no destructor needed NULL ); // no context needed return Status; }
void FiveGameInit::ReloadGame() { OnGameRequestLoad(); *g_initState = MapInitState(14); }
void FiveGameInit::LoadGameFirstLaunch(bool(*callBeforeLoad)()) { AddCrashometry("load_game_first_launch", "true"); g_callBeforeLoad = callBeforeLoad; g_launchedGame = true; OnGameFrame.Connect([=] () { if (g_shouldSetState) { if (*g_initState == MapInitState(6)) { *g_initState = MapInitState(7); g_triedLoading = true; g_shouldSetState = false; } } static bool isLoading = false; if (isLoading) { if (*g_initState == 0) { trace("Triggering OnGameFinalizeLoad\n"); OnGameFinalizeLoad(); isLoading = false; } } else { if (*g_initState != 0) { isLoading = true; } } }); OnKillNetwork.Connect([=] (const char* message) { AddCrashometry("kill_network", "true"); AddCrashometry("kill_network_msg", message); trace("Killing network: %s\n", message); g_shouldKillNetwork = true; SetRenderThreadOverride(); }, 500); /*OnGameRequestLoad.Connect([=] () { });*/ OnGameRequestLoad(); // stuff if (*g_initState == MapInitState(6)) { *g_initState = MapInitState(7); g_triedLoading = true; } else { if (*g_initState == MapInitState(20)) { *g_initState = MapInitState(11); } g_shouldSetState = true; } }