1414#include " gamespy/GameSpy_Full.h"
1515#include " gamespy/GameSpy_HTTP.h"
1616#include " gamespy/GameSpy_Available.h"
17+ #include " gamespy/GameSpy_Browser.h"
1718#include " CdkeyDecode/cdkeydecode.h"
1819#include " string_table.h"
1920#include " xrCore/os_clipboard.h"
@@ -469,7 +470,19 @@ void CMainMenu::OnFrame()
469470
470471 if (IsActive () || m_sPDProgress.IsInProgress )
471472 {
472- m_pGameSpyFull->Update ();
473+ GSUpdateStatus status = m_pGameSpyFull->Update ();
474+ if (status!=GSUpdateStatus::ConnectingToMaster)
475+ Hide_CTMS_Dialog ();
476+ switch (status)
477+ {
478+ case GSUpdateStatus::MasterUnreachable:
479+ case GSUpdateStatus::Unknown:
480+ SetErrorDialog (ErrMasterServerConnectFailed);
481+ break ;
482+ case GSUpdateStatus::OutOfService:
483+ SetErrorDialog (ErrGSServiceFailed);
484+ break ;
485+ }
473486 m_atlas_submit_queue->update ();
474487 }
475488
@@ -549,8 +562,13 @@ void CMainMenu::DestroyInternal(bool bForce)
549562 xr_delete (m_startDialog);
550563}
551564
552- void CMainMenu::OnNewPatchFound ( LPCSTR VersionName, LPCSTR URL)
565+ void CMainMenu::OnPatchCheck ( bool success, LPCSTR VersionName, LPCSTR URL)
553566{
567+ if (!success)
568+ {
569+ m_pMB_ErrDlgs[NoNewPatch]->ShowDialog (false );
570+ return ;
571+ }
554572 if (m_sPDProgress.IsInProgress ) return ;
555573
556574 if (m_pMB_ErrDlgs[NewPatchFound])
@@ -573,11 +591,6 @@ void CMainMenu::OnNewPatchFound(LPCSTR VersionName, LPCSTR URL)
573591 m_pMB_ErrDlgs[NewPatchFound]->ShowDialog (false );
574592};
575593
576- void CMainMenu::OnNoNewPatchFound ()
577- {
578- m_pMB_ErrDlgs[NoNewPatch]->ShowDialog (false );
579- }
580-
581594void CMainMenu::OnDownloadPatch (CUIWindow*, void *)
582595{
583596 CGameSpy_Available GSA;
@@ -608,23 +621,21 @@ void CMainMenu::OnDownloadPatch(CUIWindow*, void*)
608621 m_sPDProgress.Progress = 0 ;
609622 m_sPDProgress.FileName = m_sPatchFileName;
610623 m_sPDProgress.Status = " " ;
611-
612- m_pGameSpyFull->GetGameSpyHTTP ()->DownloadFile (*m_sPatchURL, *m_sPatchFileName);
624+ CGameSpy_HTTP::CompletionCallback completionCallback;
625+ completionCallback.bind (this , &CMainMenu::OnDownloadPatchResult);
626+ CGameSpy_HTTP::ProgressCallback progressCallback;
627+ progressCallback.bind (this , &CMainMenu::OnDownloadPatchProgress);
628+ m_pGameSpyFull->GetGameSpyHTTP ()->DownloadFile (*m_sPatchURL, *m_sPatchFileName,
629+ completionCallback, progressCallback);
613630}
614631
615- void CMainMenu::OnDownloadPatchError ( )
632+ void CMainMenu::OnDownloadPatchResult ( bool success )
616633{
617- m_sPDProgress.IsInProgress = false ;
618- m_pMB_ErrDlgs[PatchDownloadError]->ShowDialog (false );
634+ m_sPDProgress.IsInProgress = false ;
635+ auto dialogId = success ? PatchDownloadSuccess : PatchDownloadError;
636+ m_pMB_ErrDlgs[dialogId]->ShowDialog (false );
619637};
620638
621- void CMainMenu::OnDownloadPatchSuccess ()
622- {
623- m_sPDProgress.IsInProgress = false ;
624-
625- m_pMB_ErrDlgs[PatchDownloadSuccess]->ShowDialog (false );
626- }
627-
628639void CMainMenu::OnSessionTerminate (LPCSTR reason)
629640{
630641 if ( m_NeedErrDialog == SessionTerminate && (Device.dwTimeGlobal - m_start_time) < 8000 )
0 commit comments