mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 20:35:58 +03:00
feat(client): use 'realmList' CVar when connecting to realm list server
This commit is contained in:
parent
9096894a21
commit
d60b85f85c
@ -178,7 +178,12 @@ int32_t InitializeGlobal() {
|
|||||||
|
|
||||||
ConsoleInitializeClientCommand();
|
ConsoleInitializeClientCommand();
|
||||||
|
|
||||||
CVar::Initialize("Config.wtf");
|
ConsoleInitializeClientCVar("Config.wtf");
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
// replace enUS with detected locale
|
||||||
|
ClientServices::InitLoginServerCVars(1, "enUS");
|
||||||
|
|
||||||
// sub_7663F0();
|
// sub_7663F0();
|
||||||
|
|
||||||
// v18 = 0;
|
// v18 = 0;
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#include "net/Connection.hpp"
|
#include "net/Connection.hpp"
|
||||||
#include "net/Login.hpp"
|
#include "net/Login.hpp"
|
||||||
#include "console/CVar.hpp"
|
#include "console/CVar.hpp"
|
||||||
|
#include "console/Types.hpp"
|
||||||
#include <storm/Memory.hpp>
|
#include <storm/Memory.hpp>
|
||||||
#include <storm/String.hpp>
|
#include <storm/String.hpp>
|
||||||
#include <new>
|
#include <new>
|
||||||
@ -16,7 +17,6 @@ ClientConnection* ClientServices::s_currentConnection;
|
|||||||
ClientServices* ClientServices::s_instance;
|
ClientServices* ClientServices::s_instance;
|
||||||
Login* ClientServices::s_loginObj;
|
Login* ClientServices::s_loginObj;
|
||||||
bool ClientServices::s_newLogin;
|
bool ClientServices::s_newLogin;
|
||||||
CVar* ClientServices::s_realmNameVar;
|
|
||||||
REALM_INFO ClientServices::s_selectRealmInfo;
|
REALM_INFO ClientServices::s_selectRealmInfo;
|
||||||
bool ClientServices::s_selectRealmInfoValid;
|
bool ClientServices::s_selectRealmInfoValid;
|
||||||
|
|
||||||
@ -138,9 +138,19 @@ void ClientServices::Logon(const char* accountName, const char* password) {
|
|||||||
|
|
||||||
ClientServices::s_loginObj->SetLogonCreds(accountName, password);
|
ClientServices::s_loginObj->SetLogonCreds(accountName, password);
|
||||||
|
|
||||||
|
auto loginServerType = ClientServices::s_loginObj->GetLoginServerType();
|
||||||
|
|
||||||
|
auto portal = loginServerType == 1 ?
|
||||||
|
ClientServices::s_darkPortalVar->GetString() :
|
||||||
|
"";
|
||||||
|
|
||||||
|
auto realmList = loginServerType == 1 ?
|
||||||
|
ClientServices::s_realmListBNVar->GetString() :
|
||||||
|
ClientServices::s_realmListVar->GetString();
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
ClientServices::s_loginObj->Logon(nullptr, nullptr);
|
ClientServices::s_loginObj->Logon(realmList, portal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientServices::SelectRealm(const char* realmName) {
|
void ClientServices::SelectRealm(const char* realmName) {
|
||||||
@ -229,3 +239,107 @@ void ClientServices::RealmEnumCallback(uint32_t a2) {
|
|||||||
|
|
||||||
ClientServices::ConnectToSelectedServer();
|
ClientServices::ConnectToSelectedServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* ClientServices::GetDefaultRealmlistString() {
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
// return default us realmlist for now
|
||||||
|
|
||||||
|
return "us.logon.worldofwarcraft.com:3724";
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* ClientServices::GetDefaultPatchListString() {
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
// Return default patchlist for now
|
||||||
|
|
||||||
|
return "public-test.patch.battle.net:1119/patch";
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClientServices::InitLoginServerCVars(int32_t overwrite, const char* locale) {
|
||||||
|
if ((ClientServices::s_realmListBNVar == nullptr || ClientServices::s_realmListVar == nullptr) || overwrite != 0 ) {
|
||||||
|
ClientServices::s_decorateAccountName = CVar::Register(
|
||||||
|
"decorateAccountName",
|
||||||
|
"",
|
||||||
|
0,
|
||||||
|
"0",
|
||||||
|
nullptr,
|
||||||
|
CATEGORY::NET,
|
||||||
|
false,
|
||||||
|
nullptr,
|
||||||
|
false);
|
||||||
|
}
|
||||||
|
|
||||||
|
char localRealmList[260] = {0};
|
||||||
|
char localDataDir[272] = {0};
|
||||||
|
|
||||||
|
if (locale == nullptr || *locale == '\0') {
|
||||||
|
localDataDir[0] = '\0';
|
||||||
|
} else {
|
||||||
|
SStrPrintf(localDataDir, STORM_MAX_PATH, "data\\%s\\", locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((ClientServices::s_realmListBNVar == nullptr) || overwrite != 0) {
|
||||||
|
ClientServices::s_realmListBNVar = CVar::Register(
|
||||||
|
"realmListbn",
|
||||||
|
"Address of Battle.net server",
|
||||||
|
0,
|
||||||
|
"",
|
||||||
|
nullptr,
|
||||||
|
CATEGORY::NET,
|
||||||
|
false,
|
||||||
|
nullptr,
|
||||||
|
false);
|
||||||
|
|
||||||
|
SStrPrintf(localRealmList, STORM_MAX_PATH, "%srealmlistbn.wtf", localDataDir);
|
||||||
|
|
||||||
|
if (ConsoleLoadClientCVar(localRealmList) == 0) {
|
||||||
|
ConsoleLoadClientCVar("realmlistbn.wtf");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ClientServices::s_darkPortalVar == nullptr || overwrite != 0) {
|
||||||
|
ClientServices::s_darkPortalVar = CVar::Register(
|
||||||
|
"portal",
|
||||||
|
"Name of Battle.net portal to use",
|
||||||
|
0,
|
||||||
|
"public-test",
|
||||||
|
nullptr,
|
||||||
|
CATEGORY::NET,
|
||||||
|
false,
|
||||||
|
nullptr,
|
||||||
|
false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ClientServices::s_ServerAlertVar == nullptr || overwrite != 0) {
|
||||||
|
ClientServices::s_ServerAlertVar = CVar::Register(
|
||||||
|
"serverAlert",
|
||||||
|
"Get the glue-string tag for the URL",
|
||||||
|
0,
|
||||||
|
"SERVER_ALERT_URL",
|
||||||
|
nullptr,
|
||||||
|
CATEGORY::NET,
|
||||||
|
false,
|
||||||
|
nullptr,
|
||||||
|
false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ClientServices::s_ServerAlertVar == nullptr || overwrite != 0) {
|
||||||
|
ClientServices::s_realmListVar = CVar::Register(
|
||||||
|
"realmList",
|
||||||
|
"Address of realm list server",
|
||||||
|
0,
|
||||||
|
ClientServices::GetDefaultRealmlistString(),
|
||||||
|
nullptr,
|
||||||
|
CATEGORY::NET,
|
||||||
|
false,
|
||||||
|
nullptr,
|
||||||
|
false);
|
||||||
|
|
||||||
|
SStrPrintf(localRealmList, STORM_MAX_PATH, "%srealmlist.wtf", localDataDir);
|
||||||
|
|
||||||
|
if (ConsoleLoadClientCVar(localRealmList) == 0) {
|
||||||
|
ConsoleLoadClientCVar("realmlist.wtf");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -17,10 +17,18 @@ class ClientServices : public LoginResponse {
|
|||||||
static ClientServices* s_instance;
|
static ClientServices* s_instance;
|
||||||
static Login* s_loginObj;
|
static Login* s_loginObj;
|
||||||
static bool s_newLogin;
|
static bool s_newLogin;
|
||||||
static CVar* s_realmNameVar;
|
|
||||||
static REALM_INFO s_selectRealmInfo;
|
static REALM_INFO s_selectRealmInfo;
|
||||||
static bool s_selectRealmInfoValid;
|
static bool s_selectRealmInfoValid;
|
||||||
|
|
||||||
|
// Static console variables
|
||||||
|
static CVar* s_realmNameVar;
|
||||||
|
static CVar* s_decorateAccountName;
|
||||||
|
static CVar* s_realmListBNVar;
|
||||||
|
static CVar* s_darkPortalVar;
|
||||||
|
static CVar* s_ServerAlertVar;
|
||||||
|
static CVar* s_realmListVar;
|
||||||
|
static CVar* s_patchListVar;
|
||||||
|
|
||||||
// Static functions
|
// Static functions
|
||||||
static void ConnectToSelectedServer();
|
static void ConnectToSelectedServer();
|
||||||
static ClientConnection* Connection();
|
static ClientConnection* Connection();
|
||||||
@ -34,6 +42,9 @@ class ClientServices : public LoginResponse {
|
|||||||
static void SelectRealm(const char* realmName);
|
static void SelectRealm(const char* realmName);
|
||||||
static void SetAccountName(const char* accountName);
|
static void SetAccountName(const char* accountName);
|
||||||
static int32_t SetSelectedRealmInfo(int32_t a1);
|
static int32_t SetSelectedRealmInfo(int32_t a1);
|
||||||
|
static void InitLoginServerCVars(int32_t overwrite, const char* locale)
|
||||||
|
const char* GetDefaultRealmlistString();
|
||||||
|
const char* GetDefaultPatchListString();
|
||||||
|
|
||||||
// Virtual member functions
|
// Virtual member functions
|
||||||
virtual int32_t GetLoginServerType();
|
virtual int32_t GetLoginServerType();
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "console/Client.hpp"
|
#include "console/Client.hpp"
|
||||||
#include "console/Command.hpp"
|
#include "console/Command.hpp"
|
||||||
|
#include "console/CVar.hpp"
|
||||||
|
|
||||||
void ConsoleInitializeClientCommand() {
|
void ConsoleInitializeClientCommand() {
|
||||||
ConsoleCommandInitialize();
|
ConsoleCommandInitialize();
|
||||||
@ -8,5 +9,9 @@ void ConsoleInitializeClientCommand() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleInitializeClientCVar(const char* a1) {
|
void ConsoleInitializeClientCVar(const char* a1) {
|
||||||
// TODO
|
CVar::Initialize(a1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t ConsoleLoadClientCVar(const char* a1) {
|
||||||
|
return CVar::Load(a1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,12 @@
|
|||||||
#ifndef CONSOLE_CLIENT_HPP
|
#ifndef CONSOLE_CLIENT_HPP
|
||||||
#define CONSOLE_CLIENT_HPP
|
#define CONSOLE_CLIENT_HPP
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
void ConsoleInitializeClientCommand();
|
void ConsoleInitializeClientCommand();
|
||||||
|
|
||||||
void ConsoleInitializeClientCVar(const char* a1);
|
void ConsoleInitializeClientCVar(const char* a1);
|
||||||
|
|
||||||
|
int32_t ConsoleLoadClientCVar(const char* a1);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -22,6 +22,10 @@ bool CVGxMaximizeCallback(CVar*, const char*, const char*, void*) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CVGxResolutionCallback(CVar*, const char*, const char*, void*) {
|
bool CVGxResolutionCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
static C2iVector legalSizes[] = {
|
||||||
|
{}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user