Reconstruction layout: generated-src/ (generated) and src/ (curated), CMake, the first takeover: RNG

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>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-11-19 21:10:23 -05:00
1 parent 2ff2d5d87f
commit 3ce74c6e2d
331 files changed
+485 -7835

No files matched your search

@@ -0,0 +1,166 @@
#include "classes.h"
// 00a588c0
void KAGE::Network::Multiplayer::ConnectionBase::Update()
{
int iVar1;
longlong lVar2;
longlong lVar3;
longlong lVar4;
ulonglong uVar5;
void *this_00;
int iVar6;
char cVar7;
uint uVar8;
undefined4 extraout_ECX;
uint uVar9;
int *piVar10;
ulonglong uVar11;
undefined8 uVar12;
ulonglong uVar13;
undefined1 auStackY_d8 [128];
int *packet;
int *packetRefCount;
undefined4 local_2c;
int local_28;
void *connection;
int node;
int *local_1c;
char pingMessage [8];
undefined8 local_10;
undefined4 local_8;
local_8 = __security_cookie ^ GHIDRA_UINT((pingMessage + 0x14));
connection = this;
uVar11 = GetTimeNs();
uVar8 = GHIDRA_UINT((uVar11 >> 0x20));
lVar2 = (uVar11 & 0xffffffff) * 0x431bde82;
node = GHIDRA_INT(((ulonglong)lVar2 >> 0x20));
lVar3 = (ulonglong)uVar8 * 0x431bde82;
local_1c = GHIDRA_CAST<int *>(lVar3);
lVar4 = (ulonglong)uVar8 * 0xd7b634db + ((uVar11 & 0xffffffff) * 0xd7b634db >> 0x20);
local_2c = (undefined4)(lVar4 + lVar2);
lVar3 = lVar3 + (ulonglong)
CONCAT14(CARRY4(GHIDRA_UINT(((ulonglong)lVar4 >> 0x20)),
node + GHIDRA_UINT(CARRY4(GHIDRA_UINT(lVar2),GHIDRA_UINT(lVar4)))),
GHIDRA_INT(((ulonglong)(lVar4 + lVar2) >> 0x20)));
uVar9 = GHIDRA_UINT(((ulonglong)lVar3 >> 0x20));
uVar8 = GHIDRA_UINT(lVar3) >> 0x12 | uVar9 * 0x4000;
local_28 = ((uVar9 >> 0x12) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(connection) + 0x1c))) -
GHIDRA_UINT((uVar8 < *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(connection) + 0x18))));
if ((local_28 != 0) || (1000 < uVar8 - *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(connection) + 0x18)))) {
uVar11 = GetTimeNs();
uVar8 = GHIDRA_UINT((uVar11 >> 0x20));
lVar2 = (uVar11 & 0xffffffff) * 0x431bde82;
node = GHIDRA_INT(((ulonglong)lVar2 >> 0x20));
lVar3 = (ulonglong)uVar8 * 0xd7b634db + ((uVar11 & 0xffffffff) * 0xd7b634db >> 0x20);
local_2c = (undefined4)(lVar3 + lVar2);
lVar2 = (ulonglong)uVar8 * 0x431bde82 +
(ulonglong)
CONCAT14(CARRY4(GHIDRA_UINT(((ulonglong)lVar3 >> 0x20)),
node + GHIDRA_UINT(CARRY4(GHIDRA_UINT(lVar2),GHIDRA_UINT(lVar3)))),
GHIDRA_INT(((ulonglong)(lVar3 + lVar2) >> 0x20)));
uVar8 = GHIDRA_UINT(((ulonglong)lVar2 >> 0x20));
local_1c = GHIDRA_CAST<int *>((uVar8 >> 0x12));
strncpy(pingMessage,"ping",4);
local_10 = CONCAT44(local_1c,GHIDRA_UINT(lVar2) >> 0x12 | uVar8 * 0x4000);
FUN_00a2a030(GHIDRA_INT(connection) + 0xc,extraout_ECX,pingMessage);
uVar11 = GetTimeNs();
uVar8 = GHIDRA_UINT((uVar11 >> 0x20));
lVar2 = (uVar11 & 0xffffffff) * 0x431bde82;
lVar3 = (ulonglong)uVar8 * 0x431bde82;
local_1c = GHIDRA_CAST<int *>(lVar3);
lVar4 = (ulonglong)uVar8 * 0xd7b634db + ((uVar11 & 0xffffffff) * 0xd7b634db >> 0x20);
local_2c = (undefined4)(lVar4 + lVar2);
lVar3 = lVar3 + (ulonglong)
CONCAT14(CARRY4(GHIDRA_UINT(((ulonglong)lVar4 >> 0x20)),
GHIDRA_INT(((ulonglong)lVar2 >> 0x20)) +
GHIDRA_UINT(CARRY4(GHIDRA_UINT(lVar2),GHIDRA_UINT(lVar4)))),
GHIDRA_INT(((ulonglong)(lVar4 + lVar2) >> 0x20)));
uVar8 = GHIDRA_UINT(((ulonglong)lVar3 >> 0x20));
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(connection) + 0x18)) = GHIDRA_UINT(lVar3) >> 0x12 | uVar8 * 0x4000;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(connection) + 0x1c)) = uVar8 >> 0x12;
}
node = **GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(connection) + 0x2c));
if (GHIDRA_CAST<int *>(node) != *GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(connection) + 0x2c))) {
do {
iVar6 = node;
uVar12 = FUN_00a585c0();
local_1c = GHIDRA_CAST<int *>(uVar12);
uVar8 = __ftoui3();
if ((GHIDRA_INT(((ulonglong)uVar12 >> 0x20)) != 0) || (uVar8 < local_1c)) {
FUN_00a5a2f0();
this_00 = g_multiplayerService;
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(connection) + 0x10));
if (iVar1 == 0) {
local_10 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_10)) + 0x4))) = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_10)) + 0x0))) = 0;
local_28 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_10)) + 0x4)));
local_2c = (undefined4)local_10;
}
else {
local_28 = *GHIDRA_CAST<int *>((iVar1 + 0xc));
local_2c = *GHIDRA_CAST<undefined4 *>((iVar1 + 8));
}
packet = (void *)0x0;
packetRefCount = GHIDRA_CAST<int *>(0x0);
piVar10 = *GHIDRA_CAST<int **>((iVar6 + 0x1c));
local_1c = *GHIDRA_CAST<int **>((iVar6 + 0x18));
if (piVar10 != GHIDRA_CAST<int *>(0x0)) {
cVar7 = (**(code **)(*piVar10 + 4))();
if (cVar7 != '\0') {
if (((packetRefCount != GHIDRA_CAST<int *>(0x0)) &&
(cVar7 = (**(code **)(*packetRefCount + 0xc))(), cVar7 != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)(auStackY_d8 + 0x8c);
}
packet = local_1c;
packetRefCount = piVar10;
}
}
send_message(this_00,GHIDRA_CAST<ulonglong *>(&local_2c),0,packet,packetRefCount);
uVar13 = GetTimeNs();
uVar8 = GHIDRA_UINT((uVar13 >> 0x20));
uVar11 = (uVar13 & 0xffffffff) * 0xd7b634db;
lVar2 = (ulonglong)uVar8 * 0x431bde82;
local_1c = GHIDRA_CAST<int *>(lVar2);
uVar5 = (ulonglong)uVar8 * 0xd7b634db + (uVar11 >> 0x20);
local_10 = CONCAT44(GHIDRA_INT(((ulonglong)lVar2 >> 0x20)),GHIDRA_INT(uVar11));
uVar9 = GHIDRA_UINT((uVar5 >> 0x20));
uVar8 = GHIDRA_UINT(((uVar13 & 0xffffffff) * 0x431bde82 + (uVar5 & 0xffffffff) >> 0x20));
lVar2 = lVar2 + (ulonglong)CONCAT14(CARRY4(uVar9,uVar8),uVar9 + uVar8);
uVar8 = GHIDRA_UINT(((ulonglong)lVar2 >> 0x20));
*GHIDRA_CAST<uint *>((iVar6 + 0x20)) = GHIDRA_UINT(lVar2) >> 0x12 | uVar8 * 0x4000;
*GHIDRA_CAST<uint *>((iVar6 + 0x24)) = uVar8 >> 0x12;
}
std::
_Tree_unchecked_const_iterator<std::_Tree_val<std::_Tree_simple_types<unsigned_int>_>,std::_Iterator_base0>
::operator++((_Tree_unchecked_const_iterator<std::_Tree_val<std::_Tree_simple_types<unsigned_int>_>,std::_Iterator_base0>
*)&node);
} while (node != *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(connection) + 0x2c)));
}
piVar10 = GHIDRA_CAST<int *>((GHIDRA_INT(connection) + 0x38));
node = **GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(connection) + 0x38));
local_1c = piVar10;
if (GHIDRA_CAST<int *>(node) != *GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(connection) + 0x38))) {
do {
if (*GHIDRA_CAST<char *>((node + 0x14)) == '\0') {
uVar12 = FUN_00a585c0();
local_10 = CONCAT44(GHIDRA_INT(uVar12),(undefined4)local_10);
uVar8 = __ftoui3();
piVar10 = local_1c;
if ((GHIDRA_INT(((ulonglong)uVar12 >> 0x20)) == 0) && ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_10)) + 0x4))) <= uVar8)) goto LAB_00a58c1d;
node = FUN_00a598e0();
}
else {
LAB_00a58c1d:
std::
_Tree_unchecked_const_iterator<std::_Tree_val<std::_Tree_simple_types<unsigned_int>_>,std::_Iterator_base0>
::operator++((_Tree_unchecked_const_iterator<std::_Tree_val<std::_Tree_simple_types<unsigned_int>_>,std::_Iterator_base0>
*)&node);
}
} while (node != *piVar10);
}
return;
}
@@ -0,0 +1,49 @@
#include "classes.h"
// 00a28360
KAGE::Network::Multiplayer::ConstLobby::ConstLobby(void *lobbyPtr, void *lobbyCtrl)
{
undefined4 uVar1;
char cVar2;
uint uVar3;
undefined4 *resolvedLobby;
undefined1 oldLobbyPtr [4];
int *oldLobbyCtrl;
void *self;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
puStack_c = &LAB_00b11c48;
local_10 = ExceptionList;
uVar3 = __security_cookie ^ GHIDRA_UINT((oldLobbyPtr + 0x18));
ExceptionList = &local_10;
*GHIDRA_CAST<undefined ***>(this) = vftable;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 8)) = 0;
local_8 = 1;
self = this;
resolvedLobby = GHIDRA_CAST<undefined4 *>(FUN_00a28840(&lobbyPtr));
uVar1 = resolvedLobby[1];
resolvedLobby[1] = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 8));
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 8)) = uVar1;
uVar1 = *resolvedLobby;
*resolvedLobby = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4));
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4)) = uVar1;
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),2);
if (oldLobbyCtrl != GHIDRA_CAST<int *>(0x0)) {
cVar2 = (**(code **)(*oldLobbyCtrl + 0xc))(uVar3);
if ((cVar2 != '\0') && (g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)(oldLobbyPtr);
}
}
local_8 = 3;
if (lobbyCtrl != (void *)0x0) {
cVar2 = (**(code **)(*GHIDRA_CAST<int *>(lobbyCtrl) + 0xc))();
if ((cVar2 != '\0') && (g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)(&lobbyPtr);
}
}
ExceptionList = local_10;
return this;
}
@@ -0,0 +1,111 @@
#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;
}
@@ -0,0 +1,214 @@
#include "classes.h"
// 00a9ede0
void KAGE::Network::Multiplayer::LobbyLocalhost::add_member(ulonglong *param_1)
{
char cVar1;
uint uVar2;
void *replyData;
int extraout_EAX;
int extraout_EAX_00;
int in_ECX;
uint extraout_ECX;
uint extraout_ECX_00;
uint extraout_ECX_01;
uint extraout_ECX_02;
undefined **ptr;
undefined *puVar3;
undefined4 uVar4;
undefined **local_44;
undefined4 local_40;
int *local_3c;
undefined **userProfile;
uint local_34;
int local_30;
char packetTag [8];
undefined4 packetUserIdLow;
undefined4 packetUserIdHigh;
undefined4 local_1c;
uint local_14;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
int *membersEnd;
local_8 = 0xffffffff;
puStack_c = &LAB_00b14dcd;
local_10 = ExceptionList;
uVar2 = __security_cookie ^ GHIDRA_UINT((packetTag + 0x28));
ExceptionList = &local_10;
local_14 = uVar2;
if ((((*GHIDRA_CAST<byte *>((in_ECX + 0x2c)) == 0) ||
(membersEnd = *GHIDRA_CAST<int **>((in_ECX + 0x24)),
GHIDRA_UINT(*GHIDRA_CAST<byte *>((in_ECX + 0x2c))) <= GHIDRA_UINT((GHIDRA_INT(membersEnd) - *GHIDRA_CAST<int *>((in_ECX + 0x20)) >> 3)))) ||
(*GHIDRA_CAST<char *>((in_ECX + 0x34)) == '\0')) || (*GHIDRA_CAST<int *>((in_ECX + 0x30)) == 0)) {
local_30 = 0;
local_34 = 0;
local_44 = GHIDRA_CAST<undefined **>(0x0);
local_40 = 0;
local_3c = GHIDRA_CAST<int *>(0x0);
local_8 = 0;
replyData = (void *)FUN_00a9f4b0(&local_30,uVar2);
local_8 = 0xffffffff;
if (local_44 != GHIDRA_CAST<undefined **>(0x0)) {
uVar2 = GHIDRA_INT(local_3c) - GHIDRA_INT(local_44) & 0xfffffff8;
ptr = local_44;
if (0xfff < uVar2) {
ptr = GHIDRA_CAST<undefined **>(local_44[-1]);
uVar2 = uVar2 + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_44) + (-4 - GHIDRA_INT(ptr))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(ptr,uVar2);
}
userProfile = System::UserProfileBase::vftable;
(GHIDRA_CAST<UserProfile *>((param_1)))->UserProfile::find_or_create();
local_8 = 1;
userProfile = System::UserProfile::vftable;
uVar2 = extraout_ECX_01;
if (((extraout_EAX_00 != 0) &&
(uVar2 = *GHIDRA_CAST<uint *>((extraout_EAX_00 + 8)) | *GHIDRA_CAST<uint *>((extraout_EAX_00 + 0xc)), uVar2 != 0)) &&
(*GHIDRA_CAST<int *>((extraout_EAX_00 + 0x14)) == 0)) {
System::UserProfile::load_steam_avatar(&userProfile);
uVar2 = extraout_ECX_02;
}
local_8 = 2;
FUN_00a2a030(&userProfile,uVar2,replyData,local_30,uVar2);
if (replyData != (void *)0x0) {
local_8 = 3;
tracked_alloc(1,replyData,0);
}
}
else {
local_30 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(param_1) + 4));
if (GHIDRA_INT(*param_1) != 0 || local_30 != 0) {
if (membersEnd == *GHIDRA_CAST<int **>((in_ECX + 0x28))) {
std::vector<8byte>::_Emplace_reallocate(membersEnd,param_1);
}
else {
*membersEnd = GHIDRA_INT(*param_1);
membersEnd[1] = local_30;
*GHIDRA_CAST<int *>((in_ECX + 0x24)) = *GHIDRA_CAST<int *>((in_ECX + 0x24)) + 8;
}
local_34 = GHIDRA_UINT(*GHIDRA_CAST<byte *>((in_ECX + 0x2c)));
local_30 = 0;
replyData = (void *)FUN_00a9f4b0(&local_30,uVar2);
userProfile = System::UserProfileBase::vftable;
(GHIDRA_CAST<UserProfile *>((param_1)))->UserProfile::find_or_create();
local_8 = 4;
userProfile = System::UserProfile::vftable;
uVar2 = extraout_ECX;
if (((extraout_EAX != 0) &&
(uVar2 = *GHIDRA_CAST<uint *>((extraout_EAX + 8)) | *GHIDRA_CAST<uint *>((extraout_EAX + 0xc)), uVar2 != 0)) &&
(*GHIDRA_CAST<int *>((extraout_EAX + 0x14)) == 0)) {
System::UserProfile::load_steam_avatar(&userProfile);
uVar2 = extraout_ECX_00;
}
local_8 = 5;
FUN_00a2a030(&userProfile,uVar2,replyData,local_30,uVar2);
if (replyData != (void *)0x0) {
local_8 = 6;
tracked_alloc(1,replyData,0);
}
}
local_8 = 0xffffffff;
uVar4 = 4;
puVar3 = &DAT_00ba22d8;
strncpy(packetTag,"lhum",4);
packetUserIdLow = (undefined4)*param_1;
packetUserIdHigh = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(param_1) + 4));
local_1c = 0;
FUN_00a2a070(packetUserIdHigh,packetTag,puVar3,uVar4);
local_44 = ConstLobby::vftable;
local_40 = 0;
local_3c = GHIDRA_CAST<int *>(0x0);
local_8 = 7;
(GHIDRA_CAST<std::shared_ptr *>((&local_40)))->std::shared_ptr::assign(&g_multiplayerLobbyPtr);
local_44 = Lobby::vftable;
local_8 = 8;
::Multiplayer::handle_member_status(&local_44,param_1,0);
local_44 = ConstLobby::vftable;
local_8 = 9;
if (local_3c != GHIDRA_CAST<int *>(0x0)) {
cVar1 = (**(code **)(*local_3c + 0xc))();
if ((cVar1 != '\0') && (g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)(&local_40);
}
}
}
ExceptionList = local_10;
return;
}
// 00a9f180
void KAGE::Network::Multiplayer::LobbyLocalhost::find_or_create()
{
void *in_ECX;
uint uVar1;
ulonglong *in_EDX;
void *pvVar2;
undefined **tmpLobby [2];
undefined8 local_44;
void *membersBegin;
undefined4 membersEnd;
int membersCapacityEnd;
void *pendingBegin;
undefined4 pendingEnd;
int pendingCapacityEnd;
undefined1 local_20;
undefined4 local_1c;
undefined1 local_18;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
puStack_c = &LAB_00b14e0d;
local_10 = ExceptionList;
ExceptionList = &local_10;
membersBegin = (void *)0x0;
local_44 = 0;
membersEnd = 0;
membersCapacityEnd = 0;
tmpLobby[0] = vftable;
pendingBegin = (void *)0x0;
pendingEnd = 0;
pendingCapacityEnd = 0;
local_20 = 0;
local_1c = 3;
local_18 = 1;
local_8 = 0;
lobby_registry_find_or_create(tmpLobby,in_ECX,in_EDX);
tmpLobby[0] = vftable;
if (pendingBegin != (void *)0x0) {
uVar1 = pendingCapacityEnd - GHIDRA_INT(pendingBegin) & 0xfffffff8;
pvVar2 = pendingBegin;
if (0xfff < uVar1) {
pvVar2 = *(void **)(GHIDRA_CAST<char *>(pendingBegin) + -4);
uVar1 = uVar1 + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(pendingBegin) + (-4 - GHIDRA_INT(pvVar2))))) goto LAB_00a9f283;
}
operator_delete(pvVar2,uVar1);
pendingBegin = (void *)0x0;
pendingEnd = 0;
pendingCapacityEnd = 0;
}
tmpLobby[0] = LobbyImplBase::vftable;
if (membersBegin != (void *)0x0) {
uVar1 = membersCapacityEnd - GHIDRA_INT(membersBegin) & 0xfffffff8;
pvVar2 = membersBegin;
if (0xfff < uVar1) {
pvVar2 = *(void **)(GHIDRA_CAST<char *>(membersBegin) + -4);
uVar1 = uVar1 + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(membersBegin) + (-4 - GHIDRA_INT(pvVar2))))) {
LAB_00a9f283:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar2,uVar1);
}
ExceptionList = local_10;
return;
}
@@ -0,0 +1,86 @@
#include "classes.h"
// 00a52940
byte KAGE::Network::Multiplayer::LobbySteam::request_lobby_data(void *callback, void *userData)
{
byte isRequested;
uint uVar1;
int *matchmaking;
undefined4 *puVar2;
undefined4 extraout_ECX;
undefined4 uVar3;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
code *requestLobbyDataFn;
local_14 = 0xffffffff;
puStack_18 = &LAB_00b1244d;
local_1c = ExceptionList;
uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U;
ExceptionList = &local_1c;
matchmaking = GHIDRA_CAST<int *>(SteamInternal_ContextInit(&PTR_FUN_00c5c504,uVar1));
if (*matchmaking == 0) {
isRequested = 0;
}
else {
::this->Lobby::refresh_members();
puVar2 = GHIDRA_CAST<undefined4 *>(SteamInternal_ContextInit(&PTR_FUN_00c5c504,uVar1));
requestLobbyDataFn = *(code **)(*GHIDRA_CAST<int *>(*puVar2) + 0x70);
uVar3 = extraout_ECX;
FUN_00a238e0(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 8)),*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0xc)));
isRequested = (*requestLobbyDataFn)(uVar3);
if (isRequested != 0) {
local_14 = 0;
puVar2 = GHIDRA_CAST<undefined4 *>(FUN_00a533d0(GHIDRA_INT(this) + 8));
*puVar2 = callback;
puVar2[1] = userData;
}
}
ExceptionList = local_1c;
return isRequested;
}
// 00a53290
void * KAGE::Network::Multiplayer::LobbySteam::find_or_create(void *outLobby, ulonglong *lobbyId)
{
uint size;
void *ptr;
undefined **tmpLobby [2];
undefined8 local_2c;
void *membersBegin;
undefined4 local_20;
int membersCapacityEnd;
void *local_14;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
puStack_c = &LAB_00b124bd;
local_10 = ExceptionList;
ExceptionList = &local_10;
membersBegin = (void *)0x0;
local_2c = 0;
local_20 = 0;
membersCapacityEnd = 0;
tmpLobby[0] = vftable;
local_8 = 0;
local_14 = outLobby;
lobby_registry_find_or_create(tmpLobby,outLobby,lobbyId);
tmpLobby[0] = LobbyImplBase::vftable;
if (membersBegin != (void *)0x0) {
size = membersCapacityEnd - GHIDRA_INT(membersBegin) & 0xfffffff8;
ptr = membersBegin;
if (0xfff < size) {
ptr = *(void **)(GHIDRA_CAST<char *>(membersBegin) + -4);
size = size + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(membersBegin) + (-4 - GHIDRA_INT(ptr))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(ptr,size);
}
ExceptionList = local_10;
return outLobby;
}
@@ -0,0 +1,146 @@
#include "classes.h"
// 00a77bf0
KAGE::Network::Multiplayer::ServiceBase::ServiceBase()
{
uint uVar1;
void *sentinelNode;
undefined4 *in_ECX;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00b140a7;
local_10 = ExceptionList;
uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
ExceptionList = &local_10;
*in_ECX = vftable;
*GHIDRA_CAST<undefined1 *>((in_ECX + 1)) = 0;
in_ECX[2] = 0;
in_ECX[3] = 0;
sentinelNode = operator_new(0x20);
*(void **)sentinelNode = sentinelNode;
*(void **)(GHIDRA_CAST<char *>(sentinelNode) + 4) = sentinelNode;
*(void **)(GHIDRA_CAST<char *>(sentinelNode) + 8) = sentinelNode;
*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(sentinelNode) + 0xc)) = 0x101;
in_ECX[2] = sentinelNode;
*GHIDRA_CAST<undefined1 *>((in_ECX + 5)) = 0;
in_ECX[4] = Mutex::vftable;
in_ECX[6] = 0;
local_8 = 1;
in_ECX[7] = 0;
in_ECX[8] = 0;
sentinelNode = operator_new(0x1c);
*(void **)sentinelNode = sentinelNode;
*(void **)(GHIDRA_CAST<char *>(sentinelNode) + 4) = sentinelNode;
*(void **)(GHIDRA_CAST<char *>(sentinelNode) + 8) = sentinelNode;
*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(sentinelNode) + 0xc)) = 0x101;
in_ECX[7] = sentinelNode;
*GHIDRA_CAST<undefined1 *>((in_ECX + 10)) = 0;
in_ECX[9] = Mutex::vftable;
in_ECX[0xb] = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 3;
in_ECX[0xc] = 0;
in_ECX[0xd] = 0;
sentinelNode = operator_new(0x10);
*(void **)sentinelNode = sentinelNode;
*(void **)(GHIDRA_CAST<char *>(sentinelNode) + 4) = sentinelNode;
in_ECX[0xc] = sentinelNode;
*GHIDRA_CAST<undefined1 *>((in_ECX + 0xf)) = 0;
in_ECX[0xe] = Mutex::vftable;
in_ECX[0x10] = 0;
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),5);
g_multiplayerRelease = FUN_00a79280;
if (*(code **)(in_ECX[4] + 4) == FUN_00a15770) {
FUN_00a15770();
}
else {
(**(code **)(in_ECX[4] + 4))(uVar1);
}
if (*(code **)(in_ECX[9] + 4) == FUN_00a15770) {
FUN_00a15770();
}
else {
(**(code **)(in_ECX[9] + 4))();
}
if (*(code **)(in_ECX[0xe] + 4) == FUN_00a15770) {
FUN_00a15770();
ExceptionList = local_10;
return;
}
(**(code **)(in_ECX[0xe] + 4))();
ExceptionList = local_10;
return;
}
// 00a77dd0
KAGE::Network::Multiplayer::ServiceBase::~ServiceBase()
{
int iVar1;
uint uVar2;
int *connectionMap;
int *secondTree;
void *local_10;
undefined1 *puStack_c;
undefined4 uStack_8;
LPCRITICAL_SECTION criticalSection;
int *firstMutex;
uStack_8 = 0xffffffff;
puStack_c = &LAB_00b03a50;
local_10 = ExceptionList;
uVar2 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
ExceptionList = &local_10;
firstMutex = GHIDRA_CAST<int *>((GHIDRA_INT(this) + 0x10));
*GHIDRA_CAST<undefined ***>(this) = vftable;
(**(code **)(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x10)) + 0xc))(0xffffffff,uVar2);
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 8));
connectionMap = GHIDRA_CAST<int *>((GHIDRA_INT(this) + 8));
std::map<u64_ConnectionPtr>::_Erase_tree(connectionMap,*GHIDRA_CAST<undefined4 *>((iVar1 + 4)));
*GHIDRA_CAST<int *>((iVar1 + 4)) = iVar1;
*GHIDRA_CAST<int *>(iVar1) = iVar1;
*GHIDRA_CAST<int *>((iVar1 + 8)) = iVar1;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0xc)) = 0;
(**(code **)(*firstMutex + 0x10))();
FUN_00a78940();
(**(code **)(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x24)) + 8))();
(**(code **)(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x38)) + 8))();
(**(code **)(*firstMutex + 8))();
criticalSection = *GHIDRA_CAST<LPCRITICAL_SECTION *>((GHIDRA_CAST<char *>(this) + 0x40));
*GHIDRA_CAST<undefined ***>((GHIDRA_CAST<char *>(this) + 0x38)) = Mutex::vftable;
if (criticalSection != (LPCRITICAL_SECTION)0x0) {
DeleteCriticalSection(criticalSection);
operator_delete(criticalSection,0x1c);
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x40)) = 0;
}
*GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(this) + 0x3c)) = *GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(this) + 0x3c)) & 0xfe;
*GHIDRA_CAST<undefined ***>((GHIDRA_CAST<char *>(this) + 0x38)) = MutexBase::vftable;
FUN_00a799d0();
operator_delete(*(void **)(GHIDRA_CAST<char *>(this) + 0x30),0x10);
criticalSection = *GHIDRA_CAST<LPCRITICAL_SECTION *>((GHIDRA_CAST<char *>(this) + 0x2c));
*GHIDRA_CAST<undefined ***>((GHIDRA_CAST<char *>(this) + 0x24)) = Mutex::vftable;
if (criticalSection != (LPCRITICAL_SECTION)0x0) {
DeleteCriticalSection(criticalSection);
operator_delete(criticalSection,0x1c);
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x2c)) = 0;
}
*GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(this) + 0x28)) = *GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(this) + 0x28)) & 0xfe;
*GHIDRA_CAST<undefined ***>((GHIDRA_CAST<char *>(this) + 0x24)) = MutexBase::vftable;
secondTree = GHIDRA_CAST<int *>((GHIDRA_INT(this) + 0x1c));
FUN_00a79d10(secondTree,*GHIDRA_CAST<undefined4 *>((*secondTree + 4)));
operator_delete((void *)*secondTree,0x1c);
criticalSection = *GHIDRA_CAST<LPCRITICAL_SECTION *>((GHIDRA_CAST<char *>(this) + 0x18));
*firstMutex = GHIDRA_INT(Mutex)::vftable;
if (criticalSection != (LPCRITICAL_SECTION)0x0) {
DeleteCriticalSection(criticalSection);
operator_delete(criticalSection,0x1c);
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x18)) = 0;
}
*GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(this) + 0x14)) = *GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(this) + 0x14)) & 0xfe;
*firstMutex = GHIDRA_INT(MutexBase)::vftable;
std::map<u64_ConnectionPtr>::_Erase_tree(connectionMap,*GHIDRA_CAST<undefined4 *>((*connectionMap + 4)));
operator_delete((void *)*connectionMap,0x20);
ExceptionList = local_10;
return;
}
@@ -0,0 +1,146 @@
#include "classes.h"
// 00a76a20
void KAGE::Network::Multiplayer::ServiceEOS::on_create_lobby_complete(int *param_1)
{
char isLastRef;
uint uVar1;
int service;
int lobbyEos;
undefined4 uVar2;
char *userName;
void *pvVar3;
undefined4 uVar4;
undefined ***releaseArg;
longlong lVar5;
byte *buffer;
undefined *puVar6;
char *lobbyCtrl;
undefined **failedLobby;
undefined **local_70;
int *local_6c;
undefined **newLobby;
undefined8 local_64;
undefined **lobbyImpl;
int *lobbyImplRefCount;
byte userIdText [64];
uint local_14;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
int eosLobbyId;
code *lobbyCallback;
local_8 = 0xffffffff;
puStack_c = &LAB_00b13eb5;
local_10 = ExceptionList;
uVar1 = __security_cookie ^ GHIDRA_UINT((userIdText + 0x50));
ExceptionList = &local_10;
local_14 = uVar1;
service = __RTDynamicCast(g_multiplayerService,0,&ServiceBase::RTTI_Type_Descriptor,
&RTTI_Type_Descriptor,0,uVar1);
lobbyCallback = *(code **)(service + 0x50);
if (*param_1 != 0) {
uVar4 = _EOS_EResult_ToString_4(*param_1);
KAGE_LogMessage(8,GHIDRA_CAST<byte *>("Failed to create EOS lobby: %s\n"));
uVar2 = *GHIDRA_CAST<undefined4 *>((service + 0x54));
failedLobby = ConstLobby::vftable;
SmartPointer<LobbyImplBase>::SmartPointer(uVar4);
local_8 = 5;
(*lobbyCallback)(0x12,&failedLobby,uVar2);
failedLobby = ConstLobby::vftable;
local_8 = 6;
if (local_6c == GHIDRA_CAST<int *>(0x0)) {
ExceptionList = local_10;
return;
}
isLastRef = (**(code **)(*local_6c + 0xc))();
if (isLastRef == '\0') {
ExceptionList = local_10;
return;
}
if (g_lobbyReleaseFn == (void *)0x0) {
ExceptionList = local_10;
return;
}
releaseArg = &local_70;
goto LAB_00a76c5e;
}
FUN_00a84a90();
local_8 = 0;
eosLobbyId = param_1[1];
lobbyEos = __RTDynamicCast(lobbyImpl,0,&LobbyImplBase::RTTI_Type_Descriptor,
&LobbyEOS::RTTI_Type_Descriptor,0,uVar1);
local_70 = System::UserProfile::vftable;
*GHIDRA_CAST<int *>((lobbyEos + 0x24)) = eosLobbyId;
pvVar3 = g_userProfile;
local_6c = g_userProfile;
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),1);
if (g_userProfile == (void *)0x0) {
local_64 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_64)) + 0x4))) = GHIDRA_CAST<int *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_64)) + 0x0))) = 0;
uVar2 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_64)) + 0x4)));
uVar4 = (undefined4)local_64;
}
else {
uVar2 = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(g_userProfile) + 0xc));
uVar4 = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(g_userProfile) + 8));
}
buffer = userIdText;
puVar6 = &DAT_00ba24e0;
sprintf(buffer,&DAT_00ba24e0);
__RTDynamicCast(lobbyImpl,0,&LobbyImplBase::RTTI_Type_Descriptor,&LobbyEOS::RTTI_Type_Descriptor,0
,buffer,puVar6,uVar4,uVar2);
FUN_00a84b90("user_id",userIdText,"add member string value");
uVar2 = __RTDynamicCast(lobbyImpl,0,&LobbyImplBase::RTTI_Type_Descriptor,
&LobbyEOS::RTTI_Type_Descriptor,0);
local_64 = CONCAT44(uVar2,(undefined4)local_64);
if (pvVar3 == (void *)0x0) {
LAB_00a76b5e:
userName = "???";
}
else {
lVar5 = __aullshr();
if (lVar5 == 0xfefefefe) {
userName = "localhost";
}
else {
if (pvVar3 == (void *)0x0) goto LAB_00a76b5e;
userName = *GHIDRA_CAST<char **>((GHIDRA_CAST<char *>(pvVar3) + 0x10));
}
}
lobbyCtrl = "add member string value";
FUN_00a84b90("user_name",userName,"add member string value");
uVar2 = *GHIDRA_CAST<undefined4 *>((service + 0x54));
FUN_00a28840(&lobbyImpl);
pvVar3 = ConstLobby::ConstLobby(&newLobby,userName,lobbyCtrl);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 2;
(*lobbyCallback)(0,pvVar3,uVar2);
newLobby = ConstLobby::vftable;
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),3);
if ((((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_64)) + 0x4))) != GHIDRA_CAST<int *>(0x0)) &&
(isLastRef = (**(code **)(*(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_64)) + 0x4))) + 0xc))(), isLastRef != '\0')) &&
(g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)(&local_64);
}
local_8 = 4;
if (lobbyImplRefCount == GHIDRA_CAST<int *>(0x0)) {
ExceptionList = local_10;
return;
}
isLastRef = (**(code **)(*lobbyImplRefCount + 0xc))();
if (isLastRef == '\0') {
ExceptionList = local_10;
return;
}
if (g_lobbyReleaseFn == (void *)0x0) {
ExceptionList = local_10;
return;
}
releaseArg = &lobbyImpl;
LAB_00a76c5e:
(*g_lobbyReleaseFn)(releaseArg);
ExceptionList = local_10;
return;
}
@@ -0,0 +1,159 @@
#include "classes.h"
// 00a73b60
void KAGE::Network::Multiplayer::ServiceLocalhost::FUN_00a77f70()
{
char isLastRef;
BOOL isWindowAlive;
uint size;
undefined4 userIdHigh;
int *piVar1;
int iVar2;
HWND hWnd;
ulonglong *userId;
ulonglong *puVar3;
undefined **statusLobby;
undefined4 statusLobbyImpl;
int *statusLobbyRefCount;
undefined **lobby;
int lobbyImpl;
int *lobbyRefCount;
ulonglong *deadPeersBegin;
ulonglong *deadPeersEnd;
ulonglong *deadPeersCap;
int *local_28;
int peerNode;
void *service;
ulonglong *deadPeersLimit;
undefined8 local_18;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
int *member;
ulonglong *savedDeadPeersEnd;
puStack_c = &LAB_00b13a5d;
local_10 = ExceptionList;
ExceptionList = &local_10;
puVar3 = GHIDRA_CAST<ulonglong *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_18)) + 0x4))) = GHIDRA_CAST<ulonglong *>(0x0);
deadPeersBegin = GHIDRA_CAST<ulonglong *>(0x0);
deadPeersEnd = GHIDRA_CAST<ulonglong *>(0x0);
deadPeersLimit = GHIDRA_CAST<ulonglong *>(0x0);
deadPeersCap = GHIDRA_CAST<ulonglong *>(0x0);
piVar1 = GHIDRA_CAST<int *>((GHIDRA_INT(this) + 0x10));
local_8 = 0;
local_28 = piVar1;
service = this;
(**(code **)(*piVar1 + 0xc))(0xffffffff,__security_cookie ^ GHIDRA_INT(register0x00000010) - 4U);
peerNode = **GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(service) + 8));
if (GHIDRA_CAST<int *>(peerNode) != *GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(service) + 8))) {
do {
iVar2 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((peerNode + 0x18)) + 0x10));
if (iVar2 == 0) {
local_18 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_18)) + 0x4))) = GHIDRA_CAST<ulonglong *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_18)) + 0x0))) = (HWND)0x0;
userIdHigh = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_18)) + 0x4)));
hWnd = (HWND)local_18;
}
else {
local_18 = *GHIDRA_CAST<undefined8 *>((iVar2 + 8));
userIdHigh = *GHIDRA_CAST<undefined4 *>((iVar2 + 0xc));
hWnd = *GHIDRA_CAST<HWND *>((iVar2 + 8));
}
isWindowAlive = IsWindow(hWnd);
if (isWindowAlive == 0) {
if (puVar3 == deadPeersLimit) {
std::vector<8byte>::_Emplace_reallocate(puVar3,&local_18);
deadPeersLimit = deadPeersCap;
puVar3 = deadPeersEnd;
}
else {
*GHIDRA_CAST<HWND *>(puVar3) = hWnd;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(puVar3) + 4)) = userIdHigh;
deadPeersEnd = puVar3 + 1;
puVar3 = deadPeersEnd;
}
}
std::
_Tree_unchecked_const_iterator<std::_Tree_val<std::_Tree_simple_types<unsigned_int>_>,std::_Iterator_base0>
::operator++((_Tree_unchecked_const_iterator<std::_Tree_val<std::_Tree_simple_types<unsigned_int>_>,std::_Iterator_base0>
*)&peerNode);
} while (peerNode != *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(service) + 8)));
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_18)) + 0x4))) = deadPeersBegin;
piVar1 = local_28;
}
(**(code **)(*piVar1 + 0x10))();
userId = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_18)) + 0x4)));
if ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_18)) + 0x4))) != puVar3) {
do {
lobby = ConstLobby::vftable;
lobbyImpl = 0;
lobbyRefCount = GHIDRA_CAST<int *>(0x0);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
(GHIDRA_CAST<std::shared_ptr *>((&lobbyImpl)))->std::shared_ptr::assign(&g_multiplayerLobbyPtr);
lobby = Lobby::vftable;
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),2);
if (lobbyImpl == 0) {
iVar2 = 0;
}
else {
iVar2 = __RTDynamicCast(lobbyImpl,0,&LobbyImplBase::RTTI_Type_Descriptor,
&LobbyLocalhost::RTTI_Type_Descriptor,0);
}
savedDeadPeersEnd = deadPeersEnd;
piVar1 = *GHIDRA_CAST<int **>((iVar2 + 0x20));
do {
member = piVar1;
if (member == *GHIDRA_CAST<int **>((iVar2 + 0x24))) goto LAB_00a73ce0;
piVar1 = member + 2;
puVar3 = deadPeersEnd;
} while ((*member != GHIDRA_INT(*userId)) || (member[1] != *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(userId) + 4))));
memmove(member,piVar1,GHIDRA_INT(*GHIDRA_CAST<int **>((iVar2 + 0x24))) - GHIDRA_INT(piVar1));
*GHIDRA_CAST<int *>((iVar2 + 0x24)) = *GHIDRA_CAST<int *>((iVar2 + 0x24)) + -8;
puVar3 = savedDeadPeersEnd;
LAB_00a73ce0:
lobby = ConstLobby::vftable;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 3;
if (((lobbyRefCount != GHIDRA_CAST<int *>(0x0)) &&
(isLastRef = (**(code **)(*lobbyRefCount + 0xc))(), isLastRef != '\0')) &&
(g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)(&lobbyImpl);
}
statusLobby = ConstLobby::vftable;
statusLobbyImpl = 0;
statusLobbyRefCount = GHIDRA_CAST<int *>(0x0);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 4;
(GHIDRA_CAST<std::shared_ptr *>((&statusLobbyImpl)))->std::shared_ptr::assign(&g_multiplayerLobbyPtr);
statusLobby = Lobby::vftable;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 5;
::Multiplayer::handle_member_status(&statusLobby,userId,1);
statusLobby = ConstLobby::vftable;
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),6);
if (((statusLobbyRefCount != GHIDRA_CAST<int *>(0x0)) &&
(isLastRef = (**(code **)(*statusLobbyRefCount + 0xc))(), isLastRef != '\0')) &&
(g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)(&statusLobbyImpl);
}
userId = userId + 1;
} while (userId != puVar3);
}
local_8 = 0xffffffff;
if ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_18)) + 0x4))) != GHIDRA_CAST<ulonglong *>(0x0)) {
size = GHIDRA_INT(deadPeersLimit) - (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(local_18))) + 0x4))) & 0xfffffff8;
puVar3 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_18)) + 0x4)));
if (0xfff < size) {
puVar3 = *GHIDRA_CAST<ulonglong **>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(local_18))) + 0x4))) + -4));
size = size + 0x23;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(local_18))) + 0x4))) + (-4 - GHIDRA_INT(puVar3))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(puVar3,size);
}
FUN_00a77f70();
ExceptionList = local_10;
return;
}
@@ -0,0 +1,537 @@
#include "classes.h"
// 00a289d0
undefined * KAGE::Network::MultiplayerManager::dynamic_initializer()
{
uint stackCookie;
undefined4 in_ECX;
undefined4 extraout_ECX;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
puStack_c = &LAB_00b11d65;
local_10 = ExceptionList;
stackCookie = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
ExceptionList = &local_10;
_DAT_00c79a54 = 0;
local_8 = 0;
_DAT_00c79a50 = MultiplayerManagerBase::vftable;
g_multiplayerService = (void *)0x0;
DAT_00c79a60 = 0;
_DAT_00c79a64 = 0;
_DAT_00c79a68 = 0;
_DAT_00c79a70 = Multiplayer::ConstLobby::vftable;
SmartPointer<LobbyImplBase>::SmartPointer(in_ECX);
_DAT_00c79a70 = Multiplayer::Lobby::vftable;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(g_multiplayerCommandThreadFlags)) + 0x0))) = 0;
FUN_00a28c20(stackCookie);
DAT_00c79aac = 0;
DAT_00c79aa8 = Thread::vftable;
_DAT_00c79ab0 = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 3;
_DAT_00c79ab4 = (void *)0x0;
_DAT_00c79ab8 = 0;
_DAT_00c79ab4 = operator_new(0x10);
*(void **)_DAT_00c79ab4 = _DAT_00c79ab4;
*(void **)(GHIDRA_CAST<char *>(_DAT_00c79ab4) + 4) = _DAT_00c79ab4;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 4;
FUN_00a28c20();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 5;
_DAT_00c79ae4 = Multiplayer::ConstLobby::vftable;
SmartPointer<LobbyImplBase>::SmartPointer(extraout_ECX);
_DAT_00c79ae4 = Multiplayer::Lobby::vftable;
_DAT_00c79af0 = 0;
uRam00c79af4 = 0;
uRam00c79af8 = 0;
uRam00c79afc = 0;
_DAT_00c79b00 = 0;
DAT_00c79b08 = 0;
DAT_00c79b0c = 0;
_DAT_00c79b10 = 0;
DAT_00c79b14 = 0;
DAT_00c79b18 = 0;
uRam00c79b1c = 0;
_DAT_00c79b20 = 0;
DAT_00c79b24 = 0;
uRam00c79b28 = 0;
uRam00c79b2c = 0;
_DAT_00c79b30 = 0;
_DAT_00c79b34 = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 8;
FUN_00a28c20();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 9;
DAT_00c79b60 = (void *)0x0;
_DAT_00c79b64 = 0;
DAT_00c79b60 = operator_new(0x10);
*(void **)DAT_00c79b60 = DAT_00c79b60;
*(void **)(GHIDRA_CAST<char *>(DAT_00c79b60) + 4) = DAT_00c79b60;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 10;
_DAT_00c79b68 = (void *)0x0;
_DAT_00c79b6c = 0;
_DAT_00c79b68 = operator_new(0x10);
*(void **)_DAT_00c79b68 = _DAT_00c79b68;
*(void **)(GHIDRA_CAST<char *>(_DAT_00c79b68) + 4) = _DAT_00c79b68;
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),0xb);
_DAT_00c79b70 = (void *)0x0;
_DAT_00c79b74 = 0;
_DAT_00c79b70 = operator_new(0x10);
*(void **)_DAT_00c79b70 = _DAT_00c79b70;
*(void **)(GHIDRA_CAST<char *>(_DAT_00c79b70) + 4) = _DAT_00c79b70;
ExceptionList = local_10;
return &DAT_00c79a50;
}
// 00a54f00
void KAGE::Network::MultiplayerManager::on_lobby_data_update(uint *param_1)
{
char cVar1;
uint uVar2;
undefined8 *callbackEntry;
uint uVar3;
void *lobbySteam;
uint uVar4;
undefined **local_24;
int local_20;
int *local_1c;
undefined8 local_18;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
bool isCurrentLobby;
local_8 = 0xffffffff;
puStack_c = &LAB_00b126e5;
local_10 = ExceptionList;
uVar2 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
ExceptionList = &local_10;
uVar3 = *param_1;
uVar4 = param_1[1];
if ((uVar3 == param_1[2]) && (uVar4 == param_1[3])) {
FUN_00a53660(&local_24,param_1);
if ((((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(local_1c) + 0xd)) == '\0') && (*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(local_1c) + 0x14)) <= uVar4)) &&
((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(local_1c) + 0x14)) < uVar4 || (*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(local_1c) + 0x10)) <= uVar3))))
&& (local_1c != GHIDRA_CAST<int *>(DAT_00c79a44))) {
callbackEntry = GHIDRA_CAST<undefined8 *>(FUN_00a533d0(param_1));
local_18 = *callbackEntry;
local_8 = 0;
if (*(code **)callbackEntry != (code *)0x0) {
(**(code **)callbackEntry)
((-GHIDRA_UINT(((char)param_1[4] != '\0')) & 0xfffffff0) + 0x10,param_1,
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(callbackEntry) + 4)),uVar2);
}
FUN_00a551c0(param_1);
ExceptionList = local_10;
return;
}
}
else {
local_24 = Multiplayer::ConstLobby::vftable;
local_20 = 0;
local_1c = GHIDRA_CAST<int *>(0x0);
local_8 = 1;
(GHIDRA_CAST<std::shared_ptr *>((&local_20)))->std::shared_ptr::assign(&g_multiplayerLobbyPtr);
if (local_20 == 0) {
local_18 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_18)) + 0x4))) = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_18)) + 0x0))) = 0;
uVar3 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_18)) + 0x4)));
uVar4 = GHIDRA_UINT(local_18);
}
else {
uVar3 = *GHIDRA_CAST<uint *>((local_20 + 0xc));
uVar4 = *GHIDRA_CAST<uint *>((local_20 + 8));
}
if ((uVar4 == *param_1) && (uVar3 == param_1[1])) {
isCurrentLobby = true;
}
else {
isCurrentLobby = false;
}
local_24 = Multiplayer::ConstLobby::vftable;
local_8 = 2;
if (local_1c != GHIDRA_CAST<int *>(0x0)) {
cVar1 = (**(code **)(*local_1c + 0xc))();
if ((cVar1 != '\0') && (g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)(&local_20);
}
}
if (isCurrentLobby) {
local_24 = Multiplayer::ConstLobby::vftable;
local_20 = 0;
local_1c = GHIDRA_CAST<int *>(0x0);
local_8 = 3;
(GHIDRA_CAST<std::shared_ptr *>((&local_20)))->std::shared_ptr::assign(&g_multiplayerLobbyPtr);
local_24 = Multiplayer::Lobby::vftable;
local_8 = 4;
lobbySteam = (void *)0x0;
if (local_20 != 0) {
lobbySteam = (void *)__RTDynamicCast(local_20,0,
&Multiplayer::LobbyImplBase::RTTI_Type_Descriptor,
&Multiplayer::LobbySteam::RTTI_Type_Descriptor,0);
}
(GHIDRA_CAST<Lobby *>((lobbySteam)))->Lobby::refresh_members();
local_24 = Multiplayer::ConstLobby::vftable;
local_8 = 5;
if (local_1c != GHIDRA_CAST<int *>(0x0)) {
cVar1 = (**(code **)(*local_1c + 0xc))();
if ((cVar1 != '\0') && (g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)(&local_20);
}
}
}
}
ExceptionList = local_10;
return;
}
// 00a722c0
void KAGE::Network::MultiplayerManager::update_lobby_members()
{
char isLobbyValid;
int extraout_EAX;
int iVar1;
undefined4 memberIdHigh;
code *extraout_ECX;
undefined4 memberIdLow;
code *pcVar2;
uint uVar3;
code *pcVar4;
void *pvVar5;
void *ptr;
undefined8 memberId;
undefined4 command;
void *commandArgsBegin;
undefined4 uStack_54;
int commandArgsCapacityEnd;
undefined4 uStack_4c;
undefined4 local_48;
undefined4 queuedCommandType;
void *queuedArgsBegin;
int queuedArgsEnd;
code *local_38;
code *local_34;
undefined4 *local_30;
undefined8 local_2c;
undefined8 local_24;
undefined4 *local_1c;
code *local_18;
undefined4 *local_14;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
int lobbyMemberIds;
int *queueCount;
local_8 = 0xffffffff;
puStack_c = &LAB_00b1383d;
local_10 = ExceptionList;
ExceptionList = &local_10;
if ((*GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 0x88)) != GHIDRA_CAST<int *>(0x0)) &&
(isLobbyValid = (**(code **)(**GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 0x88)) + 0xc))
(__security_cookie ^ GHIDRA_INT(register0x00000010) - 4U),
isLobbyValid != '\0')) {
uVar3 = 0;
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x90));
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x94)) - iVar1 >> 3 != 0) {
do {
local_24 = CONCAT44((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_24)) + 0x4))),System::UserProfileBase::vftable);
(GHIDRA_CAST<UserProfile *>(((void *)(iVar1 + uVar3 * 8))))->UserProfile::find_or_create();
local_8 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_24)) + 0x0))) = System::UserProfile::vftable;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_24)) + 0x4))) = GHIDRA_CAST<int *>(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(&local_24);
}
local_8 = 0xffffffff;
iVar1 = FUN_00a28590(&local_24);
local_24 = CONCAT44((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_24)) + 0x4))),System::UserProfileBase::vftable);
if (iVar1 == -1) goto LAB_00a725ee;
uVar3 = uVar3 + 1;
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x90));
} while (uVar3 < GHIDRA_UINT((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x94)) - iVar1 >> 3)));
}
local_38 = (code *)0x0;
local_34 = (code *)0x0;
local_30 = GHIDRA_CAST<undefined4 *>(0x0);
local_8 = 1;
Multiplayer::Lobby::get_members((void *)(GHIDRA_INT(this) + 0x10),&local_38,0);
local_1c = GHIDRA_CAST<undefined4 *>((GHIDRA_INT(local_34) - GHIDRA_INT(local_38) >> 3));
local_14 = GHIDRA_CAST<undefined4 *>(0x0);
if (local_1c != GHIDRA_CAST<undefined4 *>(0x0)) {
pcVar2 = local_38;
do {
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x88));
local_18 = pcVar2;
if (iVar1 != 0) {
lobbyMemberIds = *GHIDRA_CAST<int *>((iVar1 + 0x10));
uVar3 = 0;
if (*GHIDRA_CAST<int *>((iVar1 + 0x14)) - lobbyMemberIds >> 3 != 0) {
do {
memberId = FUN_00a23920();
pcVar2 = extraout_ECX;
if ((*GHIDRA_CAST<int *>((lobbyMemberIds + uVar3 * 8)) == GHIDRA_INT(memberId)) &&
(*GHIDRA_CAST<int *>((lobbyMemberIds + 4 + uVar3 * 8)) == GHIDRA_INT(((ulonglong)memberId >> 0x20)))) {
if (uVar3 != 0xffffffff) {
local_18 = extraout_ECX;
goto LAB_00a72464;
}
break;
}
uVar3 = uVar3 + 1;
} while (uVar3 < GHIDRA_UINT((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x88)) + 0x14)) - lobbyMemberIds >>
3)));
}
}
iVar1 = *GHIDRA_CAST<int *>((pcVar2 + 4));
if (iVar1 == 0) {
local_24 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_24)) + 0x4))) = GHIDRA_CAST<int *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_24)) + 0x0))) = GHIDRA_CAST<undefined **>(0x0);
memberIdHigh = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_24)) + 0x4)));
memberIdLow = GHIDRA_CAST<undefined **>(local_24);
}
else {
memberIdHigh = *GHIDRA_CAST<undefined4 *>((iVar1 + 0xc));
memberIdLow = *GHIDRA_CAST<undefined4 *>((iVar1 + 8));
}
local_2c = CONCAT44(memberIdHigh,memberIdLow);
::Multiplayer::handle_member_status((void *)(GHIDRA_INT(this) + 0x10),&local_2c,2);
LAB_00a72464:
pcVar2 = local_18 + 8;
local_14 = GHIDRA_CAST<undefined4 *>((GHIDRA_INT(local_14) + 1));
} while (local_14 < local_1c);
local_18 = pcVar2;
}
pcVar2 = local_38;
command = 3;
commandArgsBegin = (void *)0x0;
uStack_54 = 0;
commandArgsCapacityEnd = 0;
uStack_4c = 0;
local_48 = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 2;
local_2c = 0;
std::vector<8byte>::_Emplace_reallocate(0,&local_2c);
this->CommandThread::post_command(&command);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
if (commandArgsBegin != (void *)0x0) {
uVar3 = (commandArgsCapacityEnd - GHIDRA_INT(commandArgsBegin) >> 3) * 8;
pvVar5 = commandArgsBegin;
if (0xfff < uVar3) {
pvVar5 = *(void **)(GHIDRA_CAST<char *>(commandArgsBegin) + -4);
uVar3 = uVar3 + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(commandArgsBegin) + (-4 - GHIDRA_INT(pvVar5))))) goto LAB_00a7271d;
}
operator_delete(pvVar5,uVar3);
}
command = 6;
commandArgsBegin = (void *)0x0;
uStack_54 = 0;
commandArgsCapacityEnd = 0;
uStack_4c = 0;
local_48 = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 3;
local_2c = 1;
std::vector<8byte>::_Emplace_reallocate(0,&local_2c);
uStack_4c = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x9c));
local_48 = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0xa0));
this->CommandThread::post_command(&command);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
if (commandArgsBegin != (void *)0x0) {
uVar3 = (commandArgsCapacityEnd - GHIDRA_INT(commandArgsBegin) >> 3) * 8;
pvVar5 = commandArgsBegin;
if (0xfff < uVar3) {
pvVar5 = *(void **)(GHIDRA_CAST<char *>(commandArgsBegin) + -4);
uVar3 = uVar3 + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(commandArgsBegin) + (-4 - GHIDRA_INT(pvVar5))))) goto LAB_00a7271d;
}
operator_delete(pvVar5,uVar3);
}
if (pcVar2 != (code *)0x0) {
local_8 = 4;
pcVar4 = pcVar2;
if (pcVar2 != local_34) {
do {
(*(code *)**GHIDRA_CAST<undefined4 **>(pcVar4))(0);
pcVar4 = pcVar4 + 8;
} while (pcVar4 != local_34);
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 0xff;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))) = 0xffffff;
uVar3 = (GHIDRA_INT(local_30) - GHIDRA_INT(pcVar2) >> 3) * 8;
pcVar4 = pcVar2;
if (0xfff < uVar3) {
pcVar4 = *(code **)(pcVar2 + -4);
uVar3 = uVar3 + 0x23;
if ((code *)0x1f < pcVar2 + (-4 - GHIDRA_INT(pcVar4))) goto LAB_00a7271d;
}
operator_delete(pcVar4,uVar3);
}
}
LAB_00a725ee:
pvVar5 = (void *)0x0;
queuedCommandType = 0;
pcVar2 = (code *)0x0;
queuedArgsBegin = (void *)0x0;
queuedArgsEnd = 0;
local_38 = (code *)0x0;
local_34 = (code *)0x0;
local_30 = GHIDRA_CAST<undefined4 *>(0x0);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 5;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))) = 0;
local_24 = CONCAT44(GHIDRA_INT(this) + 0x78,GHIDRA_CAST<undefined **>(local_24));
while ((**(code **)(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x78)) + 0xc))(0xffffffff),
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x74)) != 0) {
local_14 = *(undefined4 **)
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x68)) +
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x6c)) - 1U & *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x70))) * 4);
queuedCommandType = *local_14;
if (&queuedArgsBegin != (void **)(local_14 + 1)) {
local_1c = GHIDRA_CAST<undefined4 *>(local_14[1]);
local_18 = (code *)(local_14[2] - GHIDRA_INT(local_1c));
if (GHIDRA_UINT((GHIDRA_INT(pcVar2) - GHIDRA_INT(pvVar5) >> 3)) < GHIDRA_UINT((GHIDRA_INT(local_18) >> 3))) {
std::vector<8byte>::_Clear_and_reserve(GHIDRA_INT(local_18) >> 3);
pcVar2 = local_38;
pvVar5 = queuedArgsBegin;
}
memmove(pvVar5,local_1c,(size_t)local_18);
queuedArgsEnd = GHIDRA_INT(local_18) + GHIDRA_INT(pvVar5);
}
local_30 = GHIDRA_CAST<undefined4 *>(local_14[5]);
local_34 = (code *)local_14[4];
iVar1 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x68)) +
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x6c)) - 1U & *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x70))) * 4));
*GHIDRA_CAST<undefined4 *>((iVar1 + 0x10)) = 0;
*GHIDRA_CAST<undefined4 *>((iVar1 + 0x14)) = 0;
local_1c = local_30;
local_18 = local_34;
std::vector<Vector>::_Tidy();
queueCount = GHIDRA_CAST<int *>((GHIDRA_INT(this) + 0x74));
*queueCount = *queueCount + -1;
if (*queueCount == 0) {
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x70)) = 0;
}
else {
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x70)) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x70)) + 1;
}
(**(code **)(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x78)) + 0x10))();
(*local_18)(0,GHIDRA_INT(this) + 0x10,local_1c);
}
(**(code **)(*(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_24)) + 0x4))) + 0x10))();
if (pvVar5 != (void *)0x0) {
uVar3 = GHIDRA_INT(pcVar2) - GHIDRA_INT(pvVar5) & 0xfffffff8;
ptr = pvVar5;
if (0xfff < uVar3) {
ptr = *(void **)(GHIDRA_CAST<char *>(pvVar5) + -4);
uVar3 = uVar3 + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(pvVar5) + (-4 - GHIDRA_INT(ptr))))) {
LAB_00a7271d:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(ptr,uVar3);
}
ExceptionList = local_10;
return;
}
// 00a72a20
void KAGE::Network::MultiplayerManager::join_lobby(void *lobby, int unknown, void *userData)
{
char isInLobby;
void *allocBlock;
uint allocSize;
undefined4 command;
void *commandArgsBegin;
undefined4 *commandArgsEnd;
undefined4 *commandArgsCap;
code *commandCallback;
void *commandUserData;
undefined8 arg;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
int lobbyId;
local_8 = 0xffffffff;
puStack_c = &LAB_00b138b5;
local_10 = ExceptionList;
ExceptionList = &local_10;
if (*GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 0x14)) != GHIDRA_CAST<int *>(0x0)) {
isInLobby = (**(code **)(**GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 0x14)) + 0xc))
(__security_cookie ^ GHIDRA_INT(register0x00000010) - 4U);
if (isInLobby != '\0') {
command = 3;
commandArgsBegin = (void *)0x0;
commandArgsEnd = GHIDRA_CAST<undefined4 *>(0x0);
commandArgsCap = GHIDRA_CAST<undefined4 *>(0x0);
commandCallback = (code *)0x0;
commandUserData = (void *)0x0;
local_8 = 0;
arg = 0;
std::vector<8byte>::_Emplace_reallocate(0,&arg);
this->CommandThread::post_command(&command);
local_8 = 0xffffffff;
if (commandArgsBegin != (void *)0x0) {
allocSize = (GHIDRA_INT(commandArgsCap) - GHIDRA_INT(commandArgsBegin) >> 3) * 8;
allocBlock = commandArgsBegin;
if (0xfff < allocSize) {
allocBlock = *(void **)(GHIDRA_CAST<char *>(commandArgsBegin) + -4);
allocSize = allocSize + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(commandArgsBegin) + (-4 - GHIDRA_INT(allocBlock))))) goto LAB_00a72b9e;
}
operator_delete(allocBlock,allocSize);
}
}
}
command = 2;
commandArgsBegin = (void *)0x0;
commandArgsEnd = GHIDRA_CAST<undefined4 *>(0x0);
commandArgsCap = GHIDRA_CAST<undefined4 *>(0x0);
commandCallback = (code *)0x0;
commandUserData = (void *)0x0;
local_8 = 1;
arg = 1;
std::vector<8byte>::_Emplace_reallocate(0,&arg);
lobbyId = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(lobby) + 4));
if (lobbyId == 0) {
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(arg)) + 0x4))) = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(arg)) + 0x0))) = 0;
}
else {
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(arg)) + 0x0))) = *GHIDRA_CAST<undefined4 *>((lobbyId + 8));
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(arg)) + 0x4))) = *GHIDRA_CAST<undefined4 *>((lobbyId + 0xc));
}
if (commandArgsEnd == commandArgsCap) {
std::vector<8byte>::_Emplace_reallocate(commandArgsEnd,&arg);
}
else {
*commandArgsEnd = (undefined4)arg;
commandArgsEnd[1] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(arg)) + 0x4)));
commandArgsEnd = commandArgsEnd + 2;
}
commandUserData = userData;
commandCallback = FUN_00908660;
this->CommandThread::post_command(&command);
if (commandArgsBegin != (void *)0x0) {
allocSize = GHIDRA_INT(commandArgsCap) - GHIDRA_INT(commandArgsBegin) & 0xfffffff8;
allocBlock = commandArgsBegin;
if (0xfff < allocSize) {
allocBlock = *(void **)(GHIDRA_CAST<char *>(commandArgsBegin) + -4);
allocSize = allocSize + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(commandArgsBegin) + (-4 - GHIDRA_INT(allocBlock))))) {
LAB_00a72b9e:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(allocBlock,allocSize);
}
ExceptionList = local_10;
return;
}