The decompiled C++ tree moves to generated-src/ (classes.h, C++20); src/ is for code written by hand. A curated function defines the generated declaration and starts its comment with its address, and source_tree.py stops emitting that body. src/rng.cpp takes over RNG (SetSeed, the constructor, Next, RandomInt, RandomFloat, Shuffle) with the shift table read from the exe as a constexpr array; src/log.h names KAGE_LogMessage's levels (1 INFO, 2 NET, 4 WARN, 8 ERROR, 16 ASSERT, from its prefix jump table). CMakeLists.txt builds src/*.cpp against generated-src/classes.h (clean with -Wall -Wextra). structs.hpp and headers.py are retired: scripts/merge_fields.py writes the merged field list, classes.h checks the layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
112 lines
4.2 KiB
C++
112 lines
4.2 KiB
C++
#include "classes.h"
|
|
|
|
// 00a284d0
|
|
void * KAGE::Network::Multiplayer::Lobby::get_member(void *outProfile, uint index)
|
|
{
|
|
int extraout_EAX;
|
|
int iVar1;
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 local_8;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00b11cad;
|
|
local_10 = ExceptionList;
|
|
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4));
|
|
if (iVar1 == 0) {
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(outProfile) + 4)) = 0;
|
|
*GHIDRA_CAST<undefined ***>(outProfile) = System::UserProfile::vftable;
|
|
return outProfile;
|
|
}
|
|
ExceptionList = &local_10;
|
|
if (GHIDRA_UINT((*GHIDRA_CAST<int *>((iVar1 + 0x14)) - *GHIDRA_CAST<int *>((iVar1 + 0x10)) >> 3)) <= index) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("Invalid lobby user index"));
|
|
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4));
|
|
}
|
|
iVar1 = *GHIDRA_CAST<int *>((iVar1 + 0x10));
|
|
*GHIDRA_CAST<undefined ***>(outProfile) = System::UserProfileBase::vftable;
|
|
(GHIDRA_CAST<UserProfile *>(((void *)(iVar1 + index * 8))))->UserProfile::find_or_create();
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(outProfile) + 4)) = extraout_EAX;
|
|
local_8 = 0;
|
|
*GHIDRA_CAST<undefined ***>(outProfile) = System::UserProfile::vftable;
|
|
if (((extraout_EAX != 0) && (*GHIDRA_CAST<int *>((extraout_EAX + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX + 0xc)) != 0)
|
|
) && (*GHIDRA_CAST<int *>((extraout_EAX + 0x14)) == 0)) {
|
|
System::UserProfile::load_steam_avatar(outProfile);
|
|
}
|
|
ExceptionList = local_10;
|
|
return outProfile;
|
|
}
|
|
|
|
// 00a285f0
|
|
void KAGE::Network::Multiplayer::Lobby::get_members(void *outMembers, byte isIncludeLocalUser)
|
|
{
|
|
byte isLocalUser;
|
|
int extraout_EAX;
|
|
void *memberCursor;
|
|
undefined **profile;
|
|
int profileData;
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 local_8;
|
|
int lobbyImpl;
|
|
undefined4 *membersEnd;
|
|
|
|
puStack_c = &LAB_00b09575;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
lobbyImpl = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4));
|
|
if ((lobbyImpl != 0) &&
|
|
(memberCursor = *(void **)(lobbyImpl + 0x10), memberCursor != *(void **)(lobbyImpl + 0x14))) {
|
|
do {
|
|
local_8 = 0xffffffff;
|
|
profile = System::UserProfileBase::vftable;
|
|
(GHIDRA_CAST<UserProfile *>((memberCursor)))->UserProfile::find_or_create();
|
|
local_8 = 0;
|
|
profile = System::UserProfile::vftable;
|
|
profileData = extraout_EAX;
|
|
if ((extraout_EAX != 0) &&
|
|
((*GHIDRA_CAST<int *>((extraout_EAX + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX + 0xc)) != 0 &&
|
|
(*GHIDRA_CAST<int *>((extraout_EAX + 0x14)) == 0)))) {
|
|
System::UserProfile::load_steam_avatar(&profile);
|
|
}
|
|
local_8 = 1;
|
|
if ((isIncludeLocalUser != 0) ||
|
|
(isLocalUser = System::UserProfile::is_local_user(&profile), isLocalUser == 0)) {
|
|
membersEnd = *GHIDRA_CAST<undefined4 **>((GHIDRA_CAST<char *>(outMembers) + 4));
|
|
if (membersEnd == *GHIDRA_CAST<undefined4 **>((GHIDRA_CAST<char *>(outMembers) + 8))) {
|
|
std::vector<UserProfile>::_Emplace_reallocate(membersEnd,&profile);
|
|
}
|
|
else {
|
|
*membersEnd = System::UserProfileBase::vftable;
|
|
membersEnd[1] = profileData;
|
|
*membersEnd = System::UserProfile::vftable;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(outMembers) + 4)) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(outMembers) + 4)) + 8;
|
|
}
|
|
}
|
|
memberCursor = (void *)(GHIDRA_INT(memberCursor) + 8);
|
|
} while (memberCursor != *(void **)(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) + 0x14));
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 00a72740
|
|
KAGE::Network::Multiplayer::Lobby::Lobby(void *other)
|
|
{
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 local_8;
|
|
|
|
puStack_c = &LAB_00b12750;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
*GHIDRA_CAST<undefined ***>(this) = ConstLobby::vftable;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4)) = 0;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 8)) = 0;
|
|
local_8 = 0;
|
|
(GHIDRA_CAST<std::shared_ptr *>((GHIDRA_CAST<undefined4 *>((GHIDRA_INT(this) + 4)))))->std::shared_ptr::assign((void *)(GHIDRA_INT(other) + 4));
|
|
*GHIDRA_CAST<undefined ***>(this) = vftable;
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|