Skip to content

Commit

Permalink
xrGame: remove undefined reference of GameSpy
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleivg committed Oct 10, 2018
1 parent 7efe754 commit e51ed07
Show file tree
Hide file tree
Showing 22 changed files with 135 additions and 26 deletions.
2 changes: 2 additions & 0 deletions src/xrGame/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./stalker
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./static_cast_checked_test.cpp")
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./xr_Client_BattlEye.cpp")
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./xr_Server_BattlEye.cpp")
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./best_scores_store.cpp")
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./stats_submitter.cpp")
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/ai/monsters/rats/ai_rat_fsm.cpp")
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/ui/CExtraContentFilter.cpp")
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/ui/UIDebugFonts.cpp")
Expand Down
22 changes: 20 additions & 2 deletions src/xrGame/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ CMainMenu::CMainMenu()
m_deactivated_frame = 0;

m_sPatchURL = "";
#ifdef WINDOWS
m_pGameSpyFull = NULL;
m_account_mngr = NULL;
m_login_mngr = NULL;
m_profile_store = NULL;
m_stats_submitter = NULL;
m_atlas_submit_queue = NULL;
#endif

m_sPDProgress.IsInProgress = false;
m_downloaded_mp_map_url._set("");
Expand All @@ -103,6 +105,7 @@ CMainMenu::CMainMenu()
{
g_btnHint = new CUIButtonHint();
g_statHint = new CUIButtonHint();
#ifdef WINDOWS
m_pGameSpyFull = new CGameSpy_Full();

for (u32 i = 0; i < u32(ErrMax); i++)
Expand All @@ -127,6 +130,7 @@ CMainMenu::CMainMenu()
m_profile_store = new gamespy_profile::profile_store(m_pGameSpyFull);
m_stats_submitter = new gamespy_profile::stats_submitter(m_pGameSpyFull);
m_atlas_submit_queue = new atlas_submit_queue(m_stats_submitter);
#endif
}

Device.seqFrame.Add(this, REG_PRIORITY_LOW - 1000);
Expand All @@ -140,13 +144,15 @@ CMainMenu::~CMainMenu()
xr_delete(m_startDialog);
g_pGamePersistent->m_pMainMenu = NULL;

#ifdef WINDOWS
xr_delete(m_account_mngr);
xr_delete(m_login_mngr);
xr_delete(m_profile_store);
xr_delete(m_stats_submitter);
xr_delete(m_atlas_submit_queue);

xr_delete(m_pGameSpyFull);
#endif

xr_delete(m_demo_info_loader);
delete_data(m_pMB_ErrDlgs);
Expand Down Expand Up @@ -521,6 +527,7 @@ void CMainMenu::OnFrame()
Console->Show();
}

#ifdef WINDOWS
if (IsActive() || m_sPDProgress.IsInProgress)
{
GSUpdateStatus status = m_pGameSpyFull->Update();
Expand All @@ -534,6 +541,7 @@ void CMainMenu::OnFrame()
}
m_atlas_submit_queue->update();
}
#endif

if (IsActive())
{
Expand Down Expand Up @@ -629,6 +637,7 @@ void CMainMenu::OnPatchCheck(bool success, LPCSTR VersionName, LPCSTR URL)

void CMainMenu::OnDownloadPatch(CUIWindow*, void*)
{
#ifdef WINDOWS
CGameSpy_Available GSA;
shared_str result_string;
if (!GSA.CheckAvailableServices(result_string))
Expand All @@ -643,9 +652,7 @@ void CMainMenu::OnDownloadPatch(CUIWindow*, void*)

string4096 FilePath = "";
char* FileName = NULL;
#ifndef LINUX // FIXME!!!
GetFullPathName(fileName, 4096, FilePath, &FileName);
#endif
string_path fname;
if (FS.path_exist("$downloads$"))
{
Expand All @@ -665,6 +672,7 @@ void CMainMenu::OnDownloadPatch(CUIWindow*, void*)
progressCallback.bind(this, &CMainMenu::OnDownloadPatchProgress);
m_pGameSpyFull->GetGameSpyHTTP()->DownloadFile(
*m_sPatchURL, *m_sPatchFileName, completionCallback, progressCallback);
#endif
}

void CMainMenu::OnDownloadPatchResult(bool success)
Expand Down Expand Up @@ -724,8 +732,10 @@ void CMainMenu::OnRunDownloadedPatch(CUIWindow*, void*)

void CMainMenu::CancelDownload()
{
#ifdef WINDOWS
m_pGameSpyFull->GetGameSpyHTTP()->StopDownload();
m_sPDProgress.IsInProgress = false;
#endif
}

void CMainMenu::SetNeedVidRestart() { m_Flags.set(flNeedVidRestart, TRUE); }
Expand Down Expand Up @@ -781,6 +791,7 @@ LPCSTR DelHyphens(LPCSTR c)

bool CMainMenu::IsCDKeyIsValid()
{
#ifdef WINDOWS
if (!m_pGameSpyFull || !m_pGameSpyFull->GetGameSpyHTTP())
return false;
string64 CDKey = "";
Expand All @@ -799,6 +810,9 @@ bool CMainMenu::IsCDKeyIsValid()
return true;
};
return false;
#else
return true;
#endif
}

bool CMainMenu::ValidateCDKey()
Expand Down Expand Up @@ -831,12 +845,15 @@ void CMainMenu::OnConnectToMasterServerOkClicked(CUIWindow*, void*) { Hide_CTMS_
LPCSTR CMainMenu::GetGSVer()
{
static string256 buff;
#ifdef WINDOWS
xr_strcpy(buff, GetGameVersion());
#endif
return buff;
}

LPCSTR CMainMenu::GetPlayerName()
{
#ifdef WINDOWS
gamespy_gp::login_manager* l_mngr = GetLoginMngr();
gamespy_gp::profile const* tmp_prof = l_mngr ? l_mngr->get_current_profile() : NULL;

Expand All @@ -845,6 +862,7 @@ LPCSTR CMainMenu::GetPlayerName()
m_player_name = tmp_prof->unique_nick();
}
else
#endif
{
string512 name;
GetPlayerName_FromRegistry(name, sizeof(name));
Expand Down
9 changes: 5 additions & 4 deletions src/xrGame/MainMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ class CMainMenu : public IMainMenu,
void ReadTextureInfo();

xr_vector<CUIWindow*> m_pp_draw_wnds;

#ifdef WINDOWS
CGameSpy_Full* m_pGameSpyFull;
gamespy_gp::account_manager* m_account_mngr;
gamespy_gp::login_manager* m_login_mngr;
gamespy_profile::profile_store* m_profile_store;
gamespy_profile::stats_submitter* m_stats_submitter;
atlas_submit_queue* m_atlas_submit_queue;

#endif
demo_info_loader* m_demo_info_loader;

public:
Expand Down Expand Up @@ -107,13 +107,14 @@ class CMainMenu : public IMainMenu,
Patch_Dawnload_Progress m_sPDProgress;
Patch_Dawnload_Progress* GetPatchProgress() { return &m_sPDProgress; }
void CancelDownload();

#ifdef WINDOWS
CGameSpy_Full* GetGS() { return m_pGameSpyFull; };
gamespy_gp::account_manager* GetAccountMngr() { return m_account_mngr; };
gamespy_gp::login_manager* GetLoginMngr() { return m_login_mngr; };
gamespy_profile::profile_store* GetProfileStore() { return m_profile_store; };
gamespy_profile::stats_submitter* GetStatsSubmitter() { return m_stats_submitter; };
atlas_submit_queue* GetSubmitQueue() { return m_atlas_submit_queue; };
#endif
protected:
EErrorDlg m_NeedErrDialog;
u32 m_start_time;
Expand Down Expand Up @@ -166,7 +167,7 @@ class CMainMenu : public IMainMenu,
void UnregisterPPDraw(CUIWindow* w);

void SetErrorDialog(EErrorDlg ErrDlg);
EErrorDlg GetErrorDialogType() const { return m_NeedErrDialog; };
EErrorDlg GetErrorDialogType() const { return m_NeedErrDialog; }
void CheckForErrorDlg();
void SwitchToMultiplayerMenu();
void xr_stdcall OnPatchCheck(bool success, LPCSTR VersionName, LPCSTR URL);
Expand Down
5 changes: 4 additions & 1 deletion src/xrGame/account_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void account_manager::delete_profile(account_operation_cb dpcb)
{
m_profile_deleting_cb = dpcb;
}

#ifdef WINDOWS
login_manager* tmp_lmngr = MainMenu()->GetLoginMngr();
VERIFY(tmp_lmngr);
if (!tmp_lmngr->get_current_profile())
Expand All @@ -248,6 +248,7 @@ void account_manager::delete_profile(account_operation_cb dpcb)
{
m_profile_deleting_cb(false, CGameSpy_GP::TryToTranslate(tmp_res).c_str());
}
#endif
}

void account_manager::get_account_profiles(char const* email, char const* password, account_profiles_cb profiles_cb)
Expand Down Expand Up @@ -446,10 +447,12 @@ void __cdecl account_manager::delete_profile_cb(GPConnection* connection, void*
return;
}
VERIFY(tmp_inst->m_gamespy_gp);
#ifdef WINDOWS
login_manager* tmp_lmngr = MainMenu()->GetLoginMngr();
VERIFY(tmp_lmngr);
tmp_lmngr->delete_profile_obj();
tmp_inst->m_profile_deleting_cb(true, "");
#endif
}

void __cdecl account_manager::search_profile_cb(GPConnection* connection, void* arg, void* param)
Expand Down
18 changes: 18 additions & 0 deletions src/xrGame/account_manager_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

void CCC_CreateGameSpyAccount::Execute(LPCSTR args)
{
#ifdef WINDOWS
if (!args || (xr_strlen(args) == 0))
{
TInfo tmp_info;
Expand Down Expand Up @@ -39,10 +40,12 @@ void CCC_CreateGameSpyAccount::Execute(LPCSTR args)
prof_data.password = tmp_password;

tmp_acc_mngr->create_profile(tmp_nick, tmp_unick, tmp_email, tmp_password, gamespy_gp::account_operation_cb());
#endif
}

void CCC_GapySpyListProfiles::Execute(LPCSTR args)
{
#ifdef WINDOWS
if (!args || (xr_strlen(args) == 0))
{
TInfo tmp_info;
Expand All @@ -60,10 +63,12 @@ void CCC_GapySpyListProfiles::Execute(LPCSTR args)
VERIFY(tmp_gp);
gamespy_gp::account_manager* tmp_acc_mngr = MainMenu()->GetAccountMngr();
tmp_acc_mngr->get_account_profiles(tmp_email, tmp_password, gamespy_gp::account_profiles_cb());
#endif
}

void CCC_GameSpyLogin::Execute(LPCSTR args)
{
#ifdef WINDOWS
if (!args || (xr_strlen(args) == 0))
{
TInfo tmp_info;
Expand All @@ -83,14 +88,17 @@ void CCC_GameSpyLogin::Execute(LPCSTR args)
gamespy_gp::login_manager* tmp_lmngr = MainMenu()->GetLoginMngr();
VERIFY(tmp_lmngr);
tmp_lmngr->login(tmp_email, tmp_nick, tmp_password, gamespy_gp::login_operation_cb());
#endif
}

void CCC_GameSpyLogout::Execute(LPCSTR args)
{
#ifdef WINDOWS
VERIFY(MainMenu() && MainMenu()->GetGS());
gamespy_gp::login_manager* tmp_lmngr = MainMenu()->GetLoginMngr();
VERIFY(tmp_lmngr);
tmp_lmngr->logout();
#endif
}

static char const* print_time(time_t const& src_time, string64& dest_time)
Expand All @@ -103,6 +111,7 @@ static char const* print_time(time_t const& src_time, string64& dest_time)

void CCC_GameSpyPrintProfile::Execute(LPCSTR args)
{
#ifdef WINDOWS
VERIFY(MainMenu() && MainMenu()->GetGS());
gamespy_gp::login_manager* tmp_lmngr = MainMenu()->GetLoginMngr();
gamespy_gp::profile const* tmp_profile = tmp_lmngr->get_current_profile();
Expand Down Expand Up @@ -145,40 +154,48 @@ void CCC_GameSpyPrintProfile::Execute(LPCSTR args)
{
Msg("- No profile. You are not loged in.");
}
#endif
}

void CCC_GameSpySuggestUNicks::Execute(LPCSTR args)
{
#ifdef WINDOWS
VERIFY(MainMenu() && MainMenu()->GetGS());
string256 tmp_unick;
sscanf(args, "%s", tmp_unick);
gamespy_gp::account_manager* tmp_amngr = MainMenu()->GetAccountMngr();
VERIFY(tmp_amngr);
tmp_amngr->suggest_unique_nicks(tmp_unick, gamespy_gp::suggest_nicks_cb());
#endif
}

void CCC_GameSpyRegisterUniqueNick::Execute(LPCSTR args)
{
#ifdef WINDOWS
VERIFY(MainMenu() && MainMenu()->GetGS());
gamespy_gp::login_manager::unique_nick_t tmp_unick;
sscanf(args, "%s", tmp_unick);
gamespy_gp::login_manager* tmp_lmngr = MainMenu()->GetLoginMngr();
VERIFY(tmp_lmngr);
tmp_lmngr->set_unique_nick(tmp_unick, gamespy_gp::login_operation_cb());
#endif
}

void CCC_GameSpyDeleteProfile::Execute(LPCSTR args)
{
#ifdef WINDOWS
VERIFY(MainMenu() && MainMenu()->GetGS());
gamespy_gp::account_manager* tmp_amngr = MainMenu()->GetAccountMngr();
VERIFY(tmp_amngr);
tmp_amngr->delete_profile(gamespy_gp::account_operation_cb());
#endif
}

static gamespy_profile::all_best_scores_t debug_best_scores;

void CCC_GameSpyProfile::Execute(LPCSTR args)
{
#ifdef WINDOWS
VERIFY(MainMenu());
gamespy_gp::login_manager* tmp_lmngr = MainMenu()->GetLoginMngr();
VERIFY(tmp_lmngr);
Expand Down Expand Up @@ -241,4 +258,5 @@ void CCC_GameSpyProfile::Execute(LPCSTR args)
std::make_pair(static_cast<gamespy_profile::enum_best_score_type>(score_id), score_value));
tmp_ssubmitter->set_best_scores(&debug_best_scores, tmp_curr_prof, gamespy_profile::store_operation_cb());
}
#endif
}
Loading

0 comments on commit e51ed07

Please sign in to comment.