Compare commits

..

1 Commits

Author SHA1 Message Date
VDm
41988c45e1
Merge 30a78b00b5 into f1d1dad08b 2025-03-12 22:12:19 +00:00
7 changed files with 25 additions and 215 deletions

View File

@ -66,14 +66,6 @@ ClientServices* ClientServices::GetInstance() {
return ClientServices::s_instance; return ClientServices::s_instance;
} }
void ClientServices::GetRealmList() {
// TODO
}
void ClientServices::GetCharacterList() {
// TODO
}
REALM_INFO* ClientServices::GetRealmInfoByIndex(int32_t index) { REALM_INFO* ClientServices::GetRealmInfoByIndex(int32_t index) {
if (index >= ClientServices::GetInstance()->m_realmList.Count()) { if (index >= ClientServices::GetInstance()->m_realmList.Count()) {
return nullptr; return nullptr;

View File

@ -33,8 +33,6 @@ class ClientServices : public LoginResponse {
static void ConnectToSelectedServer(); static void ConnectToSelectedServer();
static ClientConnection* Connection(); static ClientConnection* Connection();
static ClientServices* GetInstance(); static ClientServices* GetInstance();
static void GetRealmList();
static void GetCharacterList();
static REALM_INFO* GetRealmInfoByIndex(int32_t index); static REALM_INFO* GetRealmInfoByIndex(int32_t index);
static const char* GetSelectedRealmName(); static const char* GetSelectedRealmName();
static const REALM_INFO* GetSelectedRealm(); static const REALM_INFO* GetSelectedRealm();

View File

@ -59,7 +59,6 @@ int32_t CGlueMgr::m_lastLoginResult;
int32_t CGlueMgr::m_lastLoginState; int32_t CGlueMgr::m_lastLoginState;
int32_t CGlueMgr::m_loginResult; int32_t CGlueMgr::m_loginResult;
int32_t CGlueMgr::m_loginState; int32_t CGlueMgr::m_loginState;
int32_t CGlueMgr::m_matrixChallengeCount;
int32_t CGlueMgr::m_matrixRemaining; int32_t CGlueMgr::m_matrixRemaining;
int32_t CGlueMgr::m_reconnect; int32_t CGlueMgr::m_reconnect;
int32_t CGlueMgr::m_reload; int32_t CGlueMgr::m_reload;
@ -70,13 +69,6 @@ int32_t CGlueMgr::m_showedDisconnect;
CSimpleTop* CGlueMgr::m_simpleTop; CSimpleTop* CGlueMgr::m_simpleTop;
int32_t CGlueMgr::m_suspended; int32_t CGlueMgr::m_suspended;
int32_t CGlueMgr::m_surveyTimer;
int32_t CGlueMgr::m_executedSurvey;
int32_t CGlueMgr::m_surveyDownload;
int32_t CGlueMgr::m_patchDownload;
bool CGlueMgr::m_deleteLocalPatch;
float CalculateAspectRatio() { float CalculateAspectRatio() {
auto widescreenVar = CVar::Lookup("widescreen"); auto widescreenVar = CVar::Lookup("widescreen");
auto resolutionVar = CVar::Lookup("gxResolution"); auto resolutionVar = CVar::Lookup("gxResolution");
@ -207,25 +199,6 @@ int32_t CGlueMgr::HandleDisplaySizeChanged(const CSizeEvent& event) {
return 1; return 1;
} }
void CGlueMgr::GetRealmList(bool showProgress) {
CGlueMgr::m_idleState = IDLE_REALM_LIST;
CGlueMgr::m_showedDisconnect = 0;
if (showProgress) {
auto text = FrameScript_GetText("REALM_LIST_IN_PROGRESS", -1, FRAMESCRIPT_GENDER::GENDER_NOT_APPLICABLE);
FrameScript_SignalEvent(3, "%s%s", "CANCEL", text);
}
ClientServices::GetRealmList();
}
void CGlueMgr::GetCharacterList() {
if (CGlueMgr::m_idleState != IDLE_WORLD_LOGIN) {
CGlueMgr::m_idleState = IDLE_CHARACTER_LIST;
auto text = FrameScript_GetText("CHAR_LIST_RETRIEVING", -1, GENDER_NOT_APPLICABLE);
FrameScript_SignalEvent(3, "%s%s", "CANCEL", text);
ClientServices::GetCharacterList();
}
}
// TODO a1: const EVENT_DATA_IDLE* // TODO a1: const EVENT_DATA_IDLE*
int32_t CGlueMgr::Idle(const void* a1, void* a2) { int32_t CGlueMgr::Idle(const void* a1, void* a2) {
// TODO: // TODO:
@ -294,25 +267,6 @@ int32_t CGlueMgr::Idle(const void* a1, void* a2) {
break; break;
} }
case IDLE_CHARACTER_LIST: {
CGlueMgr::PollCharacterList(errorCode, msg, complete, result, op);
break;
}
case IDLE_12: {
if (CGlueMgr::m_patchDownload) {
CGlueMgr::PatchDownloadIdle();
} else if (CGlueMgr::m_surveyDownload) {
CGlueMgr::SurveyDownloadIdle();
}
break;
}
case IDLE_13: {
CGlueMgr::PollUserSurvey();
break;
}
// TODO other idle states // TODO other idle states
default: default:
@ -443,15 +397,14 @@ void CGlueMgr::PollAccountLogin(int32_t errorCode, const char* msg, int32_t comp
if (result == 0) { if (result == 0) {
if (errorCode != 2) { if (errorCode != 2) {
// TODO // TODO
// Select Error Description with or without URL
} }
CGlueMgr::m_idleState = IDLE_NONE; CGlueMgr::m_idleState = IDLE_NONE;
CGlueMgr::m_showedDisconnect = 0; CGlueMgr::m_showedDisconnect = 0;
if (errorCode == 2) { if (errorCode == 2) {
CGlueMgr::m_disconnectPending = 1; // TODO CGlueMgr::m_disconnectPending = 1;
ClientServices::Connection()->Disconnect(); // TODO ClientServices::Connection()->Disconnect();
} }
if (errorCode != 13) { if (errorCode != 13) {
@ -461,7 +414,7 @@ void CGlueMgr::PollAccountLogin(int32_t errorCode, const char* msg, int32_t comp
FrameScript_SignalEvent(5, nullptr); FrameScript_SignalEvent(5, nullptr);
CRealmList::UpdateList(); CRealmList::UpdateList();
} else { } else {
CGlueMgr::GetRealmList(true); // TODO
} }
return; return;
@ -476,12 +429,10 @@ void CGlueMgr::PollAccountLogin(int32_t errorCode, const char* msg, int32_t comp
} }
if (op == COP_CONNECT) { if (op == COP_CONNECT) {
// TODO: Correct arguments (they're not used inside method) // TODO
ClientServices::Connection()->AccountLogin("", "", 0, 0);
return; return;
} }
CGlueMgr::SetScreen("charselect");
} }
void CGlueMgr::PollLoginServerLogin() { void CGlueMgr::PollLoginServerLogin() {
@ -501,53 +452,32 @@ void CGlueMgr::PollLoginServerLogin() {
switch (CGlueMgr::m_loginState) { switch (CGlueMgr::m_loginState) {
case LOGIN_STATE_FAILED: { case LOGIN_STATE_FAILED: {
ClientServices::LoginConnection()->Logoff(); // TODO
CGlueMgr::m_idleState = IDLE_NONE;
CGlueMgr::m_showedDisconnect = 0;
break; break;
} }
case LOGIN_STATE_DOWNLOADFILE: { case LOGIN_STATE_DOWNLOADFILE: {
// TODO // TODO
// Get String from Server's answer
// v14 = (char *)(ClientServices::LoginConnection() + 3928);
const char* v14 = "";
if (!SStrCmpI(v14, "Patch", STORM_MAX_STR)) {
CGlueMgr::PatchDownloadStart();
}
if (!SStrCmpI(v14, "Survey", STORM_MAX_STR)) {
CGlueMgr::SurveyDownloadStart();
}
break; break;
} }
case LOGIN_STATE_PIN: { case LOGIN_STATE_PIN: {
FrameScript_SignalEvent(5, nullptr);
// TODO // TODO
// Calling GruntLogin::GetPinInfo
// v9 = (unsigned __int8 *)(*(int (__thiscall **)(int))(*(_DWORD *)v8 + 136))(v8);
int32_t v9[10] = {};
FrameScript_SignalEvent(26, "%d%d%d%d%d%d%d%d%d%d", v9[0], v9[1], v9[2], v9[3], v9[4], v9[5], v9[6], v9[7], v9[8], v9[9]);
CGlueMgr::m_loginState = LOGIN_STATE_PIN_WAIT;
break; break;
} }
case LOGIN_STATE_MATRIX: { case LOGIN_STATE_MATRIX: {
// TODO // TODO
// Calling GruntLogin::GetMatrixInfo
// (*(void (__thiscall **)(int, int *, int *, int *, int *, unsigned __int8 *, _DWORD **))(*(_DWORD *)v10 + 160))(v10, &v73, &v69, &v72, &v70, &v77, &v75);
CGlueMgr::m_matrixChallengeCount = 0;
CGlueMgr::m_matrixRemaining = 0;
CGlueMgr::m_loginState = LOGIN_STATE_MATRIX_WAIT;
FrameScript_SignalEvent(5, 0);
// TODO: FrameScript_SignalEvent(0x1Cu, "%d%d%d%d%b%d", v73, v69, v72, v70, v77, v75);
break; break;
} }
case LOGIN_STATE_TOKEN: { case LOGIN_STATE_TOKEN: {
CGlueMgr::m_loginState = LOGIN_STATE_TOKEN_WAIT; // TODO
FrameScript_SignalEvent(5, 0);
FrameScript_SignalEvent(38, 0);
break; break;
} }
@ -566,59 +496,6 @@ void CGlueMgr::PollLoginServerLogin() {
} }
} }
void CGlueMgr::PollCharacterList(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op) {
FrameScript_SignalEvent(4, "%s", msg);
// TODO: if (CGlueMgr::HandleBattlenetDisconnect())
if (false) {
CGlueMgr::m_idleState = IDLE_NONE;
CGlueMgr::m_showedDisconnect = 0;
}
if (!complete) {
return;
}
if (!result) {
if (errorCode == 2) {
// TODO CCharacterSelection::ClearCharacterList();
CGlueMgr::GetRealmList(true);
} else {
FrameScript_SignalEvent(3, "%s%s", "OKAY", msg);
CGlueMgr::m_idleState = IDLE_NONE;
CGlueMgr::m_showedDisconnect = 0;
}
return;
}
CGlueMgr::m_idleState = IDLE_NONE;
CGlueMgr::m_showedDisconnect = 0;
FrameScript_SignalEvent(5, nullptr);
// TODO: sub_4E4610();
if (!CGlueMgr::m_accountMsgAvailable) {
return;
}
FrameScript_SignalEvent(34, 0);
CGlueMgr::m_accountMsgAvailable = 0;
}
void CGlueMgr::PollUserSurvey() {
if (CGlueMgr::m_surveyDownload && false /* virtual call */) {
if (CGlueMgr::m_executedSurvey) {
// TODO
} else {
CGlueMgr::m_executedSurvey = 1;
if (CGlueMgr::SurveyExecute()) {
auto text = FrameScript_GetText("LOGIN_STATE_SURVEY", -1, FRAMESCRIPT_GENDER::GENDER_NOT_APPLICABLE);
FrameScript_SignalEvent(3, "%s%s", "CANCEL", text);
CGlueMgr::SurveySendResults();
// TODO: CGlueMgr::m_surveyTimer = OsGetAsyncTimeMs();
}
}
}
}
void CGlueMgr::InitCursor() { void CGlueMgr::InitCursor() {
uint32_t width; uint32_t width;
uint32_t height; uint32_t height;
@ -813,13 +690,13 @@ void CGlueMgr::StatusDialogClick() {
} }
case IDLE_ACCOUNT_LOGIN: case IDLE_ACCOUNT_LOGIN:
case IDLE_CHARACTER_LIST: { case IDLE_3: {
ClientServices::Connection()->Cancel(2); ClientServices::Connection()->Cancel(2);
break; break;
} }
case IDLE_REALM_LIST: case IDLE_4:
case IDLE_5: case IDLE_5:
case IDLE_6: case IDLE_6:
case IDLE_10: { case IDLE_10: {
@ -840,21 +717,20 @@ void CGlueMgr::StatusDialogClick() {
break; break;
} }
case IDLE_WORLD_LOGIN: { case IDLE_11: {
CGlueMgr::m_showedDisconnect = 0; CGlueMgr::m_showedDisconnect = 0;
CGlueMgr::m_idleState = IDLE_NONE; CGlueMgr::m_idleState = IDLE_NONE;
CGlueMgr::GetCharacterList();
// TODO
// CGlueMgr::GetCharacterList();
break; break;
} }
case IDLE_12: case IDLE_12:
case IDLE_13: { case IDLE_13: {
if (CGlueMgr::m_surveyDownload) { // TODO
CGlueMgr::SurveyDownloadCancel();
CGlueMgr::m_showedDisconnect = 0;
CGlueMgr::m_idleState = IDLE_NONE;
}
break; break;
} }
} }
@ -894,25 +770,3 @@ void CGlueMgr::UpdateCurrentScreen(const char* screen) {
// TODO // TODO
} }
void CGlueMgr::SurveyDownloadStart() {
}
void CGlueMgr::SurveyDownloadCancel() {
}
void CGlueMgr::SurveyDownloadIdle() {
}
bool CGlueMgr::SurveyExecute() {
return false;
}
void CGlueMgr::SurveySendResults() {
}
void CGlueMgr::PatchDownloadStart() {
}
void CGlueMgr::PatchDownloadIdle() {
}

View File

@ -15,15 +15,15 @@ class CGlueMgr {
IDLE_NONE = 0, IDLE_NONE = 0,
IDLE_LOGIN_SERVER_LOGIN = 1, IDLE_LOGIN_SERVER_LOGIN = 1,
IDLE_ACCOUNT_LOGIN = 2, IDLE_ACCOUNT_LOGIN = 2,
IDLE_CHARACTER_LIST = 3, IDLE_3 = 3,
IDLE_REALM_LIST = 4, IDLE_4 = 4,
IDLE_5 = 5, IDLE_5 = 5,
IDLE_6 = 6, IDLE_6 = 6,
IDLE_7 = 7, IDLE_7 = 7,
IDLE_8 = 8, IDLE_8 = 8,
IDLE_9 = 9, IDLE_9 = 9,
IDLE_10 = 10, IDLE_10 = 10,
IDLE_WORLD_LOGIN = 11, IDLE_11 = 11,
IDLE_12 = 12, IDLE_12 = 12,
IDLE_13 = 13 IDLE_13 = 13
}; };
@ -48,7 +48,6 @@ class CGlueMgr {
static int32_t m_lastLoginState; static int32_t m_lastLoginState;
static int32_t m_loginResult; static int32_t m_loginResult;
static int32_t m_loginState; static int32_t m_loginState;
static int32_t m_matrixChallengeCount;
static int32_t m_matrixRemaining; static int32_t m_matrixRemaining;
static int32_t m_reconnect; static int32_t m_reconnect;
static int32_t m_reload; static int32_t m_reload;
@ -59,19 +58,11 @@ class CGlueMgr {
static CSimpleTop* m_simpleTop; static CSimpleTop* m_simpleTop;
static int32_t m_suspended; static int32_t m_suspended;
static int32_t m_surveyTimer;
static int32_t m_executedSurvey;
static int32_t m_surveyDownload;
static int32_t m_patchDownload;
static bool m_deleteLocalPatch;
// Static functions // Static functions
static void ChangeRealm(const REALM_INFO* realmInfo); static void ChangeRealm(const REALM_INFO* realmInfo);
static void DisplayLoginStatus(); static void DisplayLoginStatus();
// TODO a1: const EVENT_DATA_IDLE* // TODO a1: const EVENT_DATA_IDLE*
static int32_t HandleDisplaySizeChanged(const CSizeEvent& event); static int32_t HandleDisplaySizeChanged(const CSizeEvent& event);
static void GetRealmList(bool showProgress);
static void GetCharacterList();
static int32_t Idle(const void* a1, void* a2); static int32_t Idle(const void* a1, void* a2);
static void Initialize(); static void Initialize();
static void InitCursor(); static void InitCursor();
@ -79,8 +70,6 @@ class CGlueMgr {
static void QuitGame(); static void QuitGame();
static void PollAccountLogin(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op); static void PollAccountLogin(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op);
static void PollLoginServerLogin(); static void PollLoginServerLogin();
static void PollCharacterList(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op);
static void PollUserSurvey();
static void Resume(); static void Resume();
static void SetCurrentAccount(const char* accountName); static void SetCurrentAccount(const char* accountName);
static void SetLoginStateAndResult(LOGIN_STATE state, LOGIN_RESULT result, char const* addrStr, char const* stateStr, char const* resultStr, uint8_t flags); static void SetLoginStateAndResult(LOGIN_STATE state, LOGIN_RESULT result, char const* addrStr, char const* stateStr, char const* resultStr, uint8_t flags);
@ -89,17 +78,6 @@ class CGlueMgr {
static void Sub4D8BA0(); static void Sub4D8BA0();
static void Suspend(); static void Suspend();
static void UpdateCurrentScreen(const char* screen); static void UpdateCurrentScreen(const char* screen);
// Survey Download System
static void SurveyDownloadStart();
static void SurveyDownloadCancel();
static void SurveyDownloadIdle();
static bool SurveyExecute();
static void SurveySendResults();
// Patch Download System
static void PatchDownloadStart();
static void PatchDownloadIdle();
}; };
#endif #endif

View File

@ -2,7 +2,6 @@
#include "net/Login.hpp" #include "net/Login.hpp"
#include "client/ClientServices.hpp" #include "client/ClientServices.hpp"
#include "ui/FrameScript.hpp" #include "ui/FrameScript.hpp"
#include <storm/Error.hpp>
const char* s_errorCodeTokens[] = { const char* s_errorCodeTokens[] = {
"RESPONSE_SUCCESS", "RESPONSE_SUCCESS",
@ -111,13 +110,6 @@ const char* s_errorCodeTokens[] = {
"CHAR_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME", "CHAR_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME",
}; };
void ClientConnection::AccountLogin(const char* name, const char* password, int32_t region, int32_t locale) {
STORM_ASSERT(this->m_statusComplete == 1);
STORM_ASSERT(name);
STORM_ASSERT(password);
this->Initiate(COP_AUTHENTICATE, 11, nullptr);
}
void ClientConnection::AccountLogin_Finish(int32_t errorCode) { void ClientConnection::AccountLogin_Finish(int32_t errorCode) {
this->Complete(errorCode == 12, errorCode); this->Complete(errorCode == 12, errorCode);
} }

View File

@ -23,7 +23,6 @@ class ClientConnection : public RealmConnection {
ClientConnection(RealmResponse* realmResponse) ClientConnection(RealmResponse* realmResponse)
: RealmConnection(realmResponse) : RealmConnection(realmResponse)
{}; {};
void AccountLogin(const char* name, const char* password, int32_t region, int32_t locale);
void AccountLogin_Finish(int32_t authResult); void AccountLogin_Finish(int32_t authResult);
void AccountLogin_Queued(); void AccountLogin_Queued();
void Cancel(int32_t errorCode); void Cancel(int32_t errorCode);

View File

@ -5,7 +5,7 @@
#include "ui/Types.hpp" #include "ui/Types.hpp"
#include "util/Lua.hpp" #include "util/Lua.hpp"
#include "util/Unimplemented.hpp" #include "util/Unimplemented.hpp"
#include "glue/CGlueMgr.hpp" #include <cstdint>
int32_t Script_SetCharSelectModelFrame(lua_State* L) { int32_t Script_SetCharSelectModelFrame(lua_State* L) {
if (!lua_isstring(L, 1)) { if (!lua_isstring(L, 1)) {
@ -35,10 +35,7 @@ int32_t Script_SetCharSelectBackground(lua_State* L) {
} }
int32_t Script_GetCharacterListUpdate(lua_State* L) { int32_t Script_GetCharacterListUpdate(lua_State* L) {
// TODO: CCharSelectInfo::ClearCharacterModel(); WHOA_UNIMPLEMENTED(0);
// TODO: CCharSelectInfo::ClearPetModel();
CGlueMgr::GetCharacterList();
return 0;
} }
int32_t Script_GetNumCharacters(lua_State* L) { int32_t Script_GetNumCharacters(lua_State* L) {