HRESULT CLobbyApp::Init() { HRESULT hr = E_FAIL; m_plas->LogEvent(EVENTLOG_INFORMATION_TYPE, LE_Initializing); ZVerify(m_perfshare.Initialize()); m_pCounters = (LOBBY_COUNTERS *)m_perfshare.AllocateCounters( "AllLobby", "0", // if there are ever multiple lobbies running, change this sizeof(LOBBY_COUNTERS)); ZeroMemory(m_pCounters, sizeof(LOBBY_COUNTERS)); #ifdef USECLUB hr = m_sql.Init(m_strSQLConfig.m_str, GetCurrentThreadId(), m_csqlSilentThreads, m_csqlNotifyThreads); if (FAILED(hr)) { m_plas->LogEvent(EVENTLOG_ERROR_TYPE, LE_SQLInitFailed); return hr; } #endif // TODO: Make keep-alives an option if (FAILED(hr = m_fmServers.HostSession(m_fFreeLobby ? FEDFREELOBBYSERVERS_GUID : FEDLOBBYSERVERS_GUID, false, 0, m_fProtocol, m_sPort + 1)) || // Mdvalley: I don't know what happens if you try to host 2 servers on one port. Let's not find out. FAILED(hr = m_fmClients.HostSession(m_fFreeLobby ? FEDFREELOBBYCLIENTS_GUID : FEDLOBBYCLIENTS_GUID, true, 0, m_fProtocol, m_sPort))) // The first session doesn't need the port fixed, but I don't want to risk having it take the one the second is going to use. { m_plas->LogEvent(EVENTLOG_ERROR_TYPE, LE_HostSessionFailure); return hr; } // // Read Registry // DWORD dw; // Gets result of whether it opened or created... HKEY hk; if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, HKLM_AllLobby, 0, L"", REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, &hk, &dw) == ERROR_SUCCESS) { // read AutoUpdate portion of registry DWORD dwWantAutoDownload; bool bSuccess = _Module.ReadFromRegistry(hk, false, "AutoUpdateActive", &dwWantAutoDownload, 0); if(bSuccess && dwWantAutoDownload) { char szFileName[MAX_PATH+16]; strcpy(szFileName, _Module.GetModulePath()); Strcat(szFileName, "FileList.txt"); // BT - 7/15 - Enable to lobby to use a FileList.txt from the AutoUpdate folder instead of from the lobby folder. This way, only a single FileList.txt is required. _Module.ReadFromRegistry(hk, true, "AutoUpdateFileListLocation", szFileName, (DWORD)szFileName, false); CreateAutoUpdate(hk, szFileName); } else g_pAutoUpdate = NULL; RegCloseKey(hk); } return hr; }
void GeneralPane::CreateLayout() { m_main_layout = new QVBoxLayout; // Create layout here CreateBasic(); if (AutoUpdateChecker::SystemSupportsAutoUpdates()) CreateAutoUpdate(); #if defined(USE_ANALYTICS) && USE_ANALYTICS CreateAnalytics(); #endif CreateAdvanced(); m_main_layout->addStretch(1); setLayout(m_main_layout); }