feat(client): register handlers in ClientInitializeGame

This commit is contained in:
fallenoak committed 2025-09-22 22:07:23 -05:00
1 parent 667e50bd67
commit ea7fda972e
7 files changed
+94 -7

No files matched your search

+16 -4
View File
@@ -1,5 +1,6 @@
#include "client/Client.hpp"
#include "async/AsyncFile.hpp"
#include "client/ClientHandlers.hpp"
#include "client/ClientServices.hpp"
#include "console/CVar.hpp"
#include "console/Client.hpp"
@@ -30,6 +31,21 @@ void BaseInitializeGlobal() {
PropInitialize();
}
void ClientInitializeGame(uint32_t mapId, C3Vector position) {
// TODO
ClientServices::SetMessageHandler(SMSG_NOTIFICATION, NotifyHandler, nullptr);
ClientServices::SetMessageHandler(SMSG_PLAYED_TIME, PlayedTimeHandler, nullptr);
ClientServices::SetMessageHandler(SMSG_NEW_WORLD, NewWorldHandler, nullptr);
ClientServices::SetMessageHandler(SMSG_TRANSFER_PENDING, TransferPendingHandler, nullptr);
ClientServices::SetMessageHandler(SMSG_TRANSFER_ABORTED, TransferAbortedHandler, nullptr);
ClientServices::SetMessageHandler(SMSG_LOGIN_VERIFY_WORLD, LoginVerifyWorldHandler, nullptr);
ClientServices::SetMessageHandler(SMSG_KICK_REASON, CGlueMgr::OnKickReasonMsg, nullptr);
// TODO
}
void ClientMiscInitialize() {
// TODO
@@ -48,10 +64,6 @@ void ClientMiscInitialize() {
// TODO
}
void ClientInitializeGame(uint32_t mapId, C3Vector position) {
// TODO
}
void ClientPostClose(int32_t a1) {
// TODO s_finalDialog = a1;
EventPostCloseEx(nullptr);
+37
View File
@@ -0,0 +1,37 @@
#include "client/ClientHandlers.hpp"
int32_t LoginVerifyWorldHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg) {
// TODO
return 0;
}
int32_t NewWorldHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg) {
// TODO
return 0;
}
int32_t NotifyHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg) {
// TODO
return 0;
}
int32_t PlayedTimeHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg) {
// TODO
return 0;
}
int32_t TransferAbortedHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg) {
// TODO
return 0;
}
int32_t TransferPendingHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg) {
// TODO
return 0;
}
+21
View File
@@ -0,0 +1,21 @@
#ifndef CLIENT_CLIENT_HANDLERS_HPP
#define CLIENT_CLIENT_HANDLERS_HPP
#include "net/Types.hpp"
#include <cstdint>
class CDataStore;
int32_t LoginVerifyWorldHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
int32_t NewWorldHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
int32_t NotifyHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
int32_t PlayedTimeHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
int32_t TransferAbortedHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
int32_t TransferPendingHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
#endif
+7
View File
@@ -154,6 +154,13 @@ void ClientServices::SetAccountName(const char* accountName) {
SStrCopy(ClientServices::s_accountName, accountName, sizeof(ClientServices::s_accountName));
}
void ClientServices::SetMessageHandler(NETMESSAGE msgId, MESSAGE_HANDLER handler, void* param) {
STORM_ASSERT(handler);
STORM_ASSERT(ClientServices::s_currentConnection);
ClientServices::s_currentConnection->SetMessageHandler(msgId, handler, param);
}
int32_t ClientServices::SetSelectedRealmInfo(int32_t a1) {
auto instance = ClientServices::GetInstance();
+2
View File
@@ -1,6 +1,7 @@
#ifndef CLIENT_CLIENT_SERVICES_HPP
#define CLIENT_CLIENT_SERVICES_HPP
#include "net/connection/NetClient.hpp"
#include "net/login/LoginResponse.hpp"
class ClientConnection;
@@ -33,6 +34,7 @@ class ClientServices : public LoginResponse {
static void Logon(const char* accountName, const char* password);
static void SelectRealm(const char* realmName);
static void SetAccountName(const char* accountName);
static void SetMessageHandler(NETMESSAGE msgId, MESSAGE_HANDLER handler, void* param);
static int32_t SetSelectedRealmInfo(int32_t a1);
// Virtual member functions