Maintenance: CGameMode layout split, needed to port the CGameMode constructor (fn_21217, 0xCCD880). Evidence is the ctor's own stores

Batch #9949 by ragnarok-clanker: no function's compiled code changes; checked with 289 compiled unit(s), including every includer of Source/Client/Mode/CGameMode.h, Source/UI/Window/UIWindowMgr.h.
This commit is contained in:
ragnarok-clanker 2026-11-02 11:50:55 +00:00
commit 00792cfe86
6 changed files with 61 additions and 47 deletions

View file

@ -115,7 +115,8 @@ public:
/* 00FC */ int unknown_00FC;
/* 0100 */ unsigned char unknown_0100[0x18];
/* 0118 */ std::string unknown_0118;
/* 0130 */ unsigned char unknown_0130[0x30];
/* 0130 */ std::string unknown_0130;
/* 0148 */ std::string exchangeName;
/* 0160 */ CActorNameCardHolder nameCard;
/* 0194 */ std::map<std::uint32_t, int> unknown_0194;
/* 019C */ std::map<std::uint32_t, std::pair<int, int>> unknown_019C;
@ -129,7 +130,12 @@ public:
/* 01E0 */ unsigned char unknown_01E0[4];
/* 01E4 */ std::vector<GameModeLoopSound> loopSounds;
/* 01F0 */ std::map<std::uint32_t, MinimapMarker> minimapMarkers;
/* 01F8 */ unsigned char unknown_01F8[0x54];
/* 01F8 */ int unknown_01F8;
/* 01FC */ std::string unknown_01FC;
/* 0214 */ std::string unknown_0214;
/* 022C */ std::string unknown_022C;
/* 0244 */ int unknown_0244;
/* 0248 */ std::uint32_t unknown_0248;
/* 024C */ int unknown_024C;
/* 0250 */ int unknown_0250;
/* 0254 */ int unknown_0254;
@ -163,13 +169,21 @@ public:
/* 040C */ int unknown_040C;
/* 0410 */ unsigned char unknown_0410[0x04];
/* 0414 */ int unknown_0414;
/* 0418 */ unsigned char unknown_0418[0x40];
/* 0418 */ unsigned char unknown_0418;
/* 041C */ int miniMapTooltipId;
/* 0420 */ std::string miniMapTooltipText;
/* 0438 */ std::string unknown_0438;
/* 0450 */ int unknown_0450;
/* 0454 */ int unknown_0454;
/* 0458 */ int unknown_0458;
/* 045C */ unsigned char unknown_045C[0x08];
/* 0464 */ int unknown_0464;
/* 0468 */ unsigned char unknown_0468[0x74];
/* 04DC */ std::string unknown_04DC;
/* 04F4 */ unsigned char unknown_04F4[0xC8];
/* 0468 */ unsigned char unknown_0468[0x04];
/* 046C */ std::string unknown_046C[11];
/* 0574 */ unsigned char unknown_0574[0x3C];
/* 05B0 */ int forcedAttack;
/* 05B4 */ int unknown_05B4;
/* 05B8 */ int unknown_05B8;
/* 05BC */ int chatLogLines;
/* 05C0 */ unsigned char unknown_05C0[0x04];
/* 05C4 */ int unknown_05C4;
@ -526,7 +540,6 @@ public:
void ReceiveEquipListPart(unsigned char listType, int count, const unsigned char* data);
void ClearItemLists(const unsigned char* packet);
void RefreshItemListWindow(unsigned char listType, bool partial);
void ClearUnknown04DC();
void SetFollowTicks(int updateTick, int lostTick);
bool IsMenuWindowOpen() const;
bool ShowRestrictedNotice(int grade);

View file

@ -485,7 +485,7 @@ unsigned CGameMode::sub_CEC6A0(const std::vector<unsigned char>& data) {
// OFFSET: 0x00CEFE50
// FUNCTION: fn_21407
void CGameMode::ClearUnknown04DC() {
void UIWindowMgr::ClearUnknown04DC() {
this->unknown_04DC.assign("", 0);
}
@ -1652,11 +1652,11 @@ void CGameMode::TargetActorByAid(int aid) {
*reinterpret_cast<int*>(&this->unknown_00D8[0x20]) = 0;
if (g_session.GetSceneUnknown004C() == 0 && (HIBYTE(GetAsyncKeyState(VK_CONTROL)) || forceOption != 0)) {
this->RequestPlayerAction(aid, 0);
*reinterpret_cast<int*>(&this->unknown_04F4[0xBC]) = 1;
this->forcedAttack = 1;
return;
}
this->RequestPlayerAction(aid, 1);
*reinterpret_cast<int*>(&this->unknown_04F4[0xBC]) = 0;
this->forcedAttack = 0;
}
}
@ -2253,8 +2253,8 @@ void CGameMode::ProcessUiMessage(unsigned char* message) {
break;
case 906: {
const GameModeUiWhisperMessage* whisper = reinterpret_cast<const GameModeUiWhisperMessage*>(message);
*reinterpret_cast<std::string*>(this->unknown_01F8 + 0x34) = whisper->target;
*reinterpret_cast<std::string*>(this->unknown_01F8 + 0x1C) = whisper->text;
this->unknown_022C = whisper->target;
this->unknown_0214 = whisper->text;
break;
}
case 907: {
@ -2562,8 +2562,8 @@ void CGameMode::ChangeZoneServer(std::string mapName, int x, int y, int ip, int
GetRagConnection().Close();
g_activeSkillEffects.clear();
*reinterpret_cast<int*>(this->unknown_01F8 + 0x4C) = 1;
*reinterpret_cast<std::uint32_t*>(this->unknown_01F8 + 0x50) = timeGetTime();
this->unknown_0244 = 1;
this->unknown_0248 = timeGetTime();
this->scene->player->SendMsg(nullptr, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
if (g_screenShakeDuration > 0) {
g_screenShakeDuration = g_screenShakeMode == 2 ? 10001 : g_screenShakeDuration;
@ -3360,7 +3360,7 @@ void CGameMode::InitializeState() {
*reinterpret_cast<int*>(&this->unknown_00D8[8]) = g_screenHeight;
this->unknown_00E4 = g_screenWidth;
this->unknown_00E8 = g_screenHeight;
*reinterpret_cast<int*>(&this->unknown_01F8[0x4C]) = 0;
this->unknown_0244 = 0;
this->unknown_024C = 0;
this->unknown_0250 = 0;
*reinterpret_cast<int*>(&this->unknown_0294[0x18]) = 0;
@ -3370,7 +3370,7 @@ void CGameMode::InitializeState() {
*reinterpret_cast<int*>(&this->unknown_02B8[8]) = 0;
this->itemWindow = nullptr;
this->unknown_05D0 = nullptr;
*reinterpret_cast<int*>(this->unknown_01F8) = -1;
this->unknown_01F8 = -1;
this->balloonActorId = 0;
*reinterpret_cast<int*>(this->unknown_02E4) = 0;
*reinterpret_cast<int*>(&this->unknown_02E4[4]) = 0;
@ -3393,14 +3393,14 @@ void CGameMode::InitializeState() {
*reinterpret_cast<int*>(&this->unknown_0100[0x0C]) = 0;
*reinterpret_cast<int*>(&this->unknown_0100[0x10]) = 0;
*reinterpret_cast<int*>(&this->unknown_0100[0x14]) = 0;
*reinterpret_cast<int*>(&this->unknown_0418[0x38]) = 0;
*reinterpret_cast<int*>(&this->unknown_0418[0x3C]) = 0;
*reinterpret_cast<std::string*>(&this->unknown_0418[0x20]) = "";
this->unknown_0450 = 0;
this->unknown_0454 = 0;
this->unknown_0438 = "";
this->unknown_0408 = nullptr;
this->unknown_040C = 0;
g_pickInvert = 0;
*reinterpret_cast<int*>(this->unknown_045C) = 0;
*reinterpret_cast<int*>(&this->unknown_0418[4]) = -1;
this->miniMapTooltipId = -1;
*reinterpret_cast<int*>(&this->unknown_045C[4]) = -1;
char subKey[512];
@ -3427,7 +3427,7 @@ void CGameMode::InitializeState() {
this->unknown_026E[0x16] = 0;
*reinterpret_cast<std::uint32_t*>(&this->unknown_026E[0x06]) = timeGetTime();
*reinterpret_cast<std::uint32_t*>(&this->unknown_026E[0x0A]) = timeGetTime();
*reinterpret_cast<std::uint32_t*>(&this->unknown_01F8[0x50]) = timeGetTime();
this->unknown_0248 = timeGetTime();
*reinterpret_cast<std::uint32_t*>(this->unknown_01E0) = timeGetTime();
this->broadcastBalloon = nullptr;
*reinterpret_cast<std::uint32_t*>(&this->unknown_026E[0x0E]) = timeGetTime();
@ -4055,7 +4055,7 @@ void CGameMode::ProcessActorClick(int& handled, ActorPickInfo* pick, CGameActor*
}
int& targetAid = *reinterpret_cast<int*>(&this->unknown_00EC[0x04]);
int& forced = *reinterpret_cast<int*>(&this->unknown_04F4[0xBC]);
int& forced = this->forcedAttack;
if (attack != 0 && g_groundMarkAltEnabled != 0 && g_mouse.buttons[0] == 1 && g_session.IsMercenarySkill(this->unknown_040C)) {
CGameActor* mercenary = static_cast<CGameActor*>(this->scene->GetGameActorByAID(mercenaryAid));
if (mercenary && mercenary->HasUnknown0310Entry()) {
@ -4181,7 +4181,7 @@ int CGameMode::ProcessMousePick(int result, ActorPickInfo* pick) {
}
ModeCursor& cursor = *reinterpret_cast<ModeCursor*>(&this->cursorAction);
int& lockedPick = *reinterpret_cast<int*>(&this->unknown_04F4[0xBC]);
int& lockedPick = this->forcedAttack;
int& pickTarget = *reinterpret_cast<int*>(&this->unknown_00EC[0x00]);
int& clickTarget = *reinterpret_cast<int*>(&this->unknown_00EC[0x04]);
@ -4323,7 +4323,7 @@ void CGameMode::ProcessStatusIconTooltip(int x, int y) {
return;
}
int& hoveredId = *reinterpret_cast<int*>(this->unknown_01F8);
int& hoveredId = this->unknown_01F8;
const int count = static_cast<int>(g_activeSkillEffects.end() - g_activeSkillEffects.begin());
const int rows = (g_renderer->viewport.height - 169) / 35;
const int right = g_renderer->viewport.width - 18;

View file

@ -807,8 +807,8 @@ char g_miniMapTooltipText[256];
// OFFSET: 0x00CD1690
// FUNCTION: fn_21257
void CGameMode::RefreshMiniMapTooltips() {
int& tooltipId = *reinterpret_cast<int*>(&this->unknown_0418[0x04]);
std::string& tooltipText = *reinterpret_cast<std::string*>(&this->unknown_0418[0x08]);
int& tooltipId = this->miniMapTooltipId;
std::string& tooltipText = this->miniMapTooltipText;
std::map<int, std::string>& tooltipWindows = *reinterpret_cast<std::map<int, std::string>*>(&this->unknown_05D4[0x08]);
if (tooltipId == -1) {
@ -893,8 +893,8 @@ void CGameMode::RefreshMiniMapTooltips() {
// OFFSET: 0x00CD0B30
// FUNCTION: fn_21254
int CGameMode::UpdateMiniMapTooltip() {
int& tooltipId = *reinterpret_cast<int*>(&this->unknown_0418[0x04]);
std::string& tooltipText = *reinterpret_cast<std::string*>(&this->unknown_0418[0x08]);
int& tooltipId = this->miniMapTooltipId;
std::string& tooltipText = this->miniMapTooltipText;
int id = tooltipId;
if (id > 9 || id == -1) {
this->RefreshMiniMapTooltips();

View file

@ -3038,7 +3038,7 @@ void CGameMode::ReceiveExchangeItemAddAck(const unsigned char* data) {
// FUNCTION: fn_21625
void CGameMode::ReceiveExchangeRequestAck2(const unsigned char* data) {
const auto* packet = reinterpret_cast<const ExchangeRequestAckPacket*>(data);
const std::string& exchangeName = *reinterpret_cast<const std::string*>(&this->unknown_0130[0x18]);
const std::string& exchangeName = this->exchangeName;
switch (packet->result) {
case 3: {
this->SendMsg(40, 0, 0, 0, 0);
@ -3090,7 +3090,7 @@ void CGameMode::ReceiveExchangeRequestAck(const unsigned char* data) {
g_windowMgr.CloseWindow(10011);
UIWindow* window = g_windowMgr.EnsureWindow(10011);
if (window) {
const std::string& exchangeName = *reinterpret_cast<const std::string*>(&this->unknown_0130[0x18]);
const std::string& exchangeName = this->exchangeName;
window->SendMsg(nullptr, 50, reinterpret_cast<std::intptr_t>(exchangeName.c_str()), 0, 0, 0);
}
break;

View file

@ -1555,7 +1555,7 @@ void CGameMode::IgnorePacket478(const unsigned char*) {
// OFFSET: 0x00D3A1D0
// FUNCTION: fn_21775
void CGameMode::ClearUnknown0244(const unsigned char*) {
*reinterpret_cast<int*>(this->unknown_01F8 + 0x4C) = 0;
this->unknown_0244 = 0;
}
#pragma pack(push, 1)
@ -1831,8 +1831,8 @@ void CGameMode::ReceiveDynamicNpcNotice(const unsigned char* packet) {
// OFFSET: 0x00D079A0
// FUNCTION: fn_21584
void CGameMode::sub_D079A0(unsigned char kind, int argument) {
std::string& speaker = *reinterpret_cast<std::string*>(this->unknown_01F8 + 0x1C);
std::string& target = *reinterpret_cast<std::string*>(this->unknown_01F8 + 0x34);
std::string& speaker = this->unknown_0214;
std::string& target = this->unknown_022C;
switch (kind) {
case 0: {
@ -8286,7 +8286,7 @@ void CGameMode::ReceiveItemPickupAck2(const unsigned char* data) {
item.unknown_0060 = packet->refine;
item.unknown_0068 = packet->expireTime;
if (std::atoi(item.itemId.c_str()) == 607) {
*reinterpret_cast<int*>(&this->unknown_04F4[0xC4]) = 0;
this->unknown_05B8 = 0;
}
if (packet->type == 10 || packet->type == 16 || packet->type == 17 || packet->type == 19) {
item.unknown_0000[3] = 0x8000;
@ -8315,7 +8315,7 @@ void CGameMode::ReceiveItemPickupAck2(const unsigned char* data) {
item.unknown_0060 = packet->refine;
item.unknown_0068 = packet->expireTime;
if (std::atoi(item.itemId.c_str()) == 607) {
*reinterpret_cast<int*>(&this->unknown_04F4[0xC4]) = 0;
this->unknown_05B8 = 0;
}
if (packet->type == 10 || packet->type == 16 || packet->type == 17 || packet->type == 19) {
item.unknown_0000[3] = 0x8000;
@ -8379,7 +8379,7 @@ void CGameMode::ReceiveItemPickupAck3(const unsigned char* data) {
item.unknown_0064 = packet->bindOnEquip;
item.unknown_0074[1] = 1;
if (std::atoi(item.itemId.c_str()) == 607) {
*reinterpret_cast<int*>(&this->unknown_04F4[0xC4]) = 0;
this->unknown_05B8 = 0;
}
if (packet->type == 10 || packet->type == 16 || packet->type == 17 || packet->type == 19) {
item.unknown_0000[3] = 0x8000;
@ -8412,7 +8412,7 @@ void CGameMode::ReceiveItemPickupAck3(const unsigned char* data) {
item.unknown_0068 = packet->expireTime;
item.unknown_0064 = packet->bindOnEquip;
if (std::atoi(item.itemId.c_str()) == 607) {
*reinterpret_cast<int*>(&this->unknown_04F4[0xC4]) = 0;
this->unknown_05B8 = 0;
}
if (packet->type == 10 || packet->type == 16 || packet->type == 17 || packet->type == 19) {
item.unknown_0000[3] = 0x8000;
@ -8476,7 +8476,7 @@ void CGameMode::ReceiveItemPickupAck(const unsigned char* data) {
item.unknown_005D = packet->damaged;
item.unknown_0060 = packet->refine;
if (std::atoi(item.itemId.c_str()) == 607) {
*reinterpret_cast<int*>(&this->unknown_04F4[0xC4]) = 0;
this->unknown_05B8 = 0;
}
if (packet->type == 10 || packet->type == 16 || packet->type == 17 || packet->type == 19) {
item.unknown_0000[3] = 0x8000;
@ -8504,7 +8504,7 @@ void CGameMode::ReceiveItemPickupAck(const unsigned char* data) {
item.unknown_005D = packet->damaged;
item.unknown_0060 = packet->refine;
if (std::atoi(item.itemId.c_str()) == 607) {
*reinterpret_cast<int*>(&this->unknown_04F4[0xC4]) = 0;
this->unknown_05B8 = 0;
}
if (packet->type == 10 || packet->type == 16 || packet->type == 17 || packet->type == 19) {
item.unknown_0000[3] = 0x8000;
@ -8581,7 +8581,7 @@ void CGameMode::ReceiveItemPickupAck5(
reinterpret_cast<StoreItemOption*>(item.unknown_009C)[option] = options[option];
}
if (std::atoi(item.itemId.c_str()) == 607) {
*reinterpret_cast<int*>(&static_cast<CGameMode*>(g_modeMgr.GetGameMode())->unknown_04F4[0xC4]) = 0;
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->unknown_05B8 = 0;
}
if (type == 10 || type == 16 || type == 17 || type == 19) {
item.unknown_0000[3] = 0x8000;
@ -8622,7 +8622,7 @@ void CGameMode::ReceiveItemPickupAck5(
reinterpret_cast<StoreItemOption*>(item.unknown_009C)[option] = options[option];
}
if (std::atoi(item.itemId.c_str()) == 607) {
*reinterpret_cast<int*>(&static_cast<CGameMode*>(g_modeMgr.GetGameMode())->unknown_04F4[0xC4]) = 0;
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->unknown_05B8 = 0;
}
if (type == 10 || type == 16 || type == 17 || type == 19) {
item.unknown_0000[3] = 0x8000;
@ -8695,7 +8695,7 @@ void CGameMode::ReceiveItemPickupAck7(const unsigned char* data) {
reinterpret_cast<StoreItemOption*>(item.unknown_009C)[option] = options[option];
}
if (std::atoi(item.itemId.c_str()) == 607) {
*reinterpret_cast<int*>(&static_cast<CGameMode*>(g_modeMgr.GetGameMode())->unknown_04F4[0xC4]) = 0;
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->unknown_05B8 = 0;
}
if (packet->type == 10 || packet->type == 16 || packet->type == 17 || packet->type == 19) {
item.unknown_0000[3] = 0x8000;
@ -8735,7 +8735,7 @@ void CGameMode::ReceiveItemPickupAck7(const unsigned char* data) {
reinterpret_cast<StoreItemOption*>(item.unknown_009C)[option] = options[option];
}
if (std::atoi(item.itemId.c_str()) == 607) {
*reinterpret_cast<int*>(&static_cast<CGameMode*>(g_modeMgr.GetGameMode())->unknown_04F4[0xC4]) = 0;
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->unknown_05B8 = 0;
}
if (packet->type == 10 || packet->type == 16 || packet->type == 17 || packet->type == 19) {
item.unknown_0000[3] = 0x8000;
@ -9771,7 +9771,7 @@ void CGameMode::ReceiveItemPickupAck8(const unsigned char* data) {
reinterpret_cast<StoreItemOption*>(item.unknown_009C)[option] = options[option];
}
if (std::atoi(item.itemId.c_str()) == 607) {
*reinterpret_cast<int*>(&static_cast<CGameMode*>(g_modeMgr.GetGameMode())->unknown_04F4[0xC4]) = 0;
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->unknown_05B8 = 0;
}
if (packet->type == 10 || packet->type == 16 || packet->type == 17 || packet->type == 19) {
item.unknown_0000[3] = 0x8000;
@ -9814,7 +9814,7 @@ void CGameMode::ReceiveItemPickupAck8(const unsigned char* data) {
reinterpret_cast<StoreItemOption*>(item.unknown_009C)[option] = options[option];
}
if (std::atoi(item.itemId.c_str()) == 607) {
*reinterpret_cast<int*>(&static_cast<CGameMode*>(g_modeMgr.GetGameMode())->unknown_04F4[0xC4]) = 0;
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->unknown_05B8 = 0;
}
if (packet->type == 10 || packet->type == 16 || packet->type == 17 || packet->type == 19) {
item.unknown_0000[3] = 0x8000;
@ -9891,7 +9891,7 @@ void CGameMode::ReceiveItemPickupAck9(const unsigned char* data) {
}
item.unknown_0074[0] = packet->favorite;
if (std::atoi(item.itemId.c_str()) == 607) {
*reinterpret_cast<int*>(&static_cast<CGameMode*>(g_modeMgr.GetGameMode())->unknown_04F4[0xC4]) = 0;
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->unknown_05B8 = 0;
}
if (packet->type == 10 || packet->type == 16 || packet->type == 17 || packet->type == 19) {
item.unknown_0000[3] = 0x8000;
@ -9944,7 +9944,7 @@ void CGameMode::ReceiveItemPickupAck9(const unsigned char* data) {
}
item.unknown_0074[0] = packet->favorite;
if (std::atoi(item.itemId.c_str()) == 607) {
*reinterpret_cast<int*>(&static_cast<CGameMode*>(g_modeMgr.GetGameMode())->unknown_04F4[0xC4]) = 0;
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->unknown_05B8 = 0;
}
if (packet->type == 10 || packet->type == 16 || packet->type == 17 || packet->type == 19) {
item.unknown_0000[3] = 0x8000;

View file

@ -476,6 +476,7 @@ public:
void MoveTransient(int x, int y);
void RetireTransientWindow();
void ClearWindow01B8();
void ClearUnknown04DC();
int ProcessMouse();
bool CloseWindow(int id);
void CloseWindowExcept251(int id);