Files
isaac-port/generated-src/netplay_manager.cpp
T
shweetandClaude Opus 5.5 3ce74c6e2d 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>
2026-11-19 21:10:23 -05:00

7514 lines
313 KiB
C++

#include "classes.h"
// 008fd530
byte NetplayManager::process_consolidated_messages()
{
NetplayManager *this_00;
int iVar1;
undefined4 *puVar2;
undefined4 uVar3;
NetplayManager *pNVar4;
char isLastRef;
int *piVar5;
byte *isPeerReady;
NetplayManager entryCursor;
undefined1 findResult [8];
NetplayManager lowerBound;
undefined4 userIdLow;
uint userIdHigh;
undefined4 *local_40;
NetplayManager *local_3c;
undefined4 local_38;
int *piStack_34;
undefined4 peerIdLow;
uint peerIdHigh;
NetplayManager *self;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
NetplayManager entriesEnd;
puStack_20 = findResult + 0x50;
puStack_18 = &LAB_00b07edd;
local_1c = ExceptionList;
ExceptionList = &local_1c;
self = this;
while (local_14 = 0xffffffff, g_multiplayerService != (void *)0x0) {
piVar5 = (GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::receive_message(&local_38,4,0);
iVar1 = *piVar5;
local_14 = 0;
if (((piStack_34 != GHIDRA_CAST<int *>(0x0)) &&
(isLastRef = (**(code **)(*piStack_34 + 0xc))(), isLastRef != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)(&local_38);
}
local_14 = 0xffffffff;
if (iVar1 == 0) break;
if (g_multiplayerService == (void *)0x0) {
KAGE::SmartPointer<MessageData>::reset(0);
}
else {
(GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::receive_message(&local_40,4,1);
}
puVar2 = local_40;
local_14 = 1;
if (local_40[3] != 1) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("This function should only be called on consolidated messages"));
}
if (*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(puVar2[2]) + 0x14)) + 8)) == 0) {
peerIdLow = *local_40;
peerIdHigh = local_40[1];
isPeerReady = map_u64_bool_subscript(this + 1,GHIDRA_CAST<ulonglong *>(&peerIdLow));
*isPeerReady = 1;
}
local_14 = 2;
if (((local_3c != GHIDRA_CAST<NetplayManager *>(0x0)) &&
(isLastRef = (**(code **)(GHIDRA_INT(*local_3c) + 0xc))(), isLastRef != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)(&local_40);
}
}
local_14 = 0xffffffff;
if (*GHIDRA_CAST<char *>(this) != '\0') {
entryCursor = g_manager->_netplayManager;
entriesEnd = *GHIDRA_CAST<NetplayManager *>((g_manager + 1));
if (entryCursor != entriesEnd) {
local_3c = self + 1;
do {
iVar1 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(entryCursor) + 0x374));
if (iVar1 == 0) {
local_38 = 0;
uVar3 = local_38;
piStack_34 = GHIDRA_CAST<int *>(0x0);
local_38 = 0;
userIdHigh = GHIDRA_UINT(piStack_34);
userIdLow = local_38;
local_38 = uVar3;
}
else {
userIdHigh = *GHIDRA_CAST<uint *>((iVar1 + 0xc));
userIdLow = *GHIDRA_CAST<undefined4 *>((iVar1 + 8));
}
_local_38 = CONCAT44(userIdLow,local_38);
peerIdHigh = userIdHigh;
FUN_00731ee0(findResult,&userIdLow);
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(lowerBound) + 0xd)) != '\0') ||
(peerIdHigh < *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(lowerBound) + 0x14)))) ||
(((peerIdHigh <= *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(lowerBound) + 0x14)) &&
(piStack_34 < *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(lowerBound) + 0x10)))) || (lowerBound == *local_3c)))) {
ExceptionList = local_1c;
return 1;
}
entryCursor = (NetplayManager)(GHIDRA_INT(entryCursor) + 4);
} while (entryCursor != entriesEnd);
}
pNVar4 = self;
this_00 = self + 1;
*GHIDRA_CAST<byte *>(self) = 0;
entryCursor = *this_00;
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(this_00,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)this_00,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(entryCursor) + 4));
*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(entryCursor) + 4)) = entryCursor;
*GHIDRA_CAST<NetplayManager *>(entryCursor) = entryCursor;
*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(entryCursor) + 8)) = entryCursor;
pNVar4[2] = (NetplayManager)0x0;
this = self;
}
ExceptionList = local_1c;
return *GHIDRA_CAST<byte *>(this);
}
// 00906a90
NetplayManager::~NetplayManager()
{
NetplayManager *pNVar1;
NetplayManager ptr;
char cVar2;
uint uVar3;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00b08a50;
local_10 = ExceptionList;
uVar3 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
ExceptionList = &local_10;
FUN_00a1d6b0(netplay_lobby_join_requested_callback);
NetplayTextPopup::clear(uVar3);
this[0x724] = (NetplayManager)0x0;
this[0x725] = (NetplayManager)0x0;
(GHIDRA_CAST<GenericPopup *>((GHIDRA_CAST<GenericPopup *>((this + 0x6ce)))))->GenericPopup::destructor();
daily_lobby_join_destructor(this + 0x636);
pNVar1 = this + 0x627;
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(pNVar1,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)pNVar1,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(this[0x627]) + 4));
operator_delete((void *)*pNVar1,0x20);
this[0x624] = (NetplayManager)KAGE::Network::Multiplayer::ConstLobby::vftable;
local_8 = 0;
if (this[0x626] != (NetplayManager)0x0) {
cVar2 = (**(code **)(*GHIDRA_CAST<int *>(this[0x626]) + 0xc))();
if ((cVar2 != '\0') && (g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)(this + 0x625);
}
}
FUN_004b3950();
std::vector<32byte>::_Tidy();
std::vector<24byte>::_Tidy();
FUN_00914d90(this + 0x619,*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(this[0x619]) + 4)));
operator_delete((void *)this[0x619],0x30);
FUN_00913df0();
OnlineChat::destructor();
pNVar1 = this + 0x489;
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(pNVar1,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)pNVar1,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(this[0x489]) + 4));
operator_delete((void *)*pNVar1,0x20);
FUN_00900940();
std::vector<Vector>::_Tidy();
std::vector<Vector>::_Tidy();
std::vector<Vector>::_Tidy();
std::vector<Vector>::_Tidy();
std::vector<Vector>::_Tidy();
local_8 = 1;
NetplayTextPopup::clear();
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),2);
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((this + 0x42d)))))->ANM2::Reset();
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((this + 0x441)))))->AnimationState::~AnimationState();
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((this + 0x439)))))->AnimationState::~AnimationState();
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((this + 0x433)))))->std::string::_Tidy_deallocate();
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((this + 0x42d)))))->std::string::_Tidy_deallocate();
std::deque<36byte>::_Tidy();
std::deque<4byte>::~deque();
std::deque<12byte>::~deque();
std::map<unsigned_long_long_PeerStreams>::destroy_subtree
(this + 0x41c,*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(this[0x41c]) + 4)));
operator_delete((void *)this[0x41c],0xe8);
FUN_009156e0(this + 0x41a,*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(this[0x41a]) + 4)));
operator_delete((void *)this[0x41a],0xfa8);
FUN_00a58200();
FUN_00a58200();
local_8 = 3;
if (this[0x18] != (NetplayManager)0x0) {
(*(code *)**GHIDRA_CAST<undefined4 **>(this[0x18]))(1);
}
PersistentGameData_Bestiary::~PersistentGameData_Bestiary
(GHIDRA_CAST<PersistentGameData_Bestiary *>((this + 0x3f0)));
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((this + 0x1f)))))->std::string::_Tidy_deallocate();
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((this + 0x19)))))->std::string::_Tidy_deallocate();
std::vector<Vector>::_Tidy();
pNVar1 = this + 0xf;
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(pNVar1,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)pNVar1,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(this[0xf]) + 4));
operator_delete((void *)*pNVar1,0x1c);
std::deque<12byte>::_Tidy();
ptr = this[10];
this[10] = (NetplayManager)0x0;
operator_delete((void *)ptr,8);
FID_conflict__Tidy(this);
ExceptionList = local_10;
return;
}
// 00906d60
void NetplayManager::Init()
{
NetplayManager *pNVar1;
char isLastRef;
LayerState *paperLayer;
int *jsonEntryRef;
char *strBuf;
void *extraout_EAX;
NetplayManager *extraout_EAX_00;
NetplayManager NVar2;
uint size;
NetplayManager *chat;
undefined **ppuVar3;
void *userRefCount;
undefined1 auStack_9a [2];
undefined1 chatMessage [44];
undefined **local_60;
undefined1 *puStack_5c;
undefined **local_58;
undefined4 local_54;
int *local_50;
NetplayManager *self;
NetplayManager local_44;
std_string local_40;
uint local_24;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
undefined4 *jsonEntry;
Manager *manager;
puStack_20 = chatMessage + 0x88;
local_14 = 0xffffffff;
puStack_18 = &LAB_00b08a9d;
local_1c = ExceptionList;
local_24 = __security_cookie ^ GHIDRA_UINT((chatMessage + 0x7c));
ExceptionList = &local_1c;
local_40._size = 0;
local_40._capacity = 0xf;
local_40._buf[0] = '\0';
local_40._buf[1] = '\0';
local_40._buf[2] = '\0';
local_40._buf[3] = '\0';
self = this;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_40._buf)) + 0x0))) = std::_Allocate(0x20);
local_40._size = 0x15;
local_40._capacity = 0x1f;
builtin_strncpy((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(local_40._buf))) + 0x0))),"gfx/ui/ui_streak.anm2",0x16);
local_14 = 0;
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((this + 0x42d)))))->ANM2::Load(&local_40,1);
local_14 = 0xffffffff;
if (0xf < local_40._capacity) {
size = local_40._capacity + 1;
strBuf = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(local_40._buf))) + 0x0)));
if (0xfff < size) {
strBuf = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_40._buf)) + 0x0))) + -4));
size = local_40._capacity + 0x24;
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_40._buf)) + 0x0))) + (-4 - GHIDRA_INT(strBuf))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(strBuf,size);
}
paperLayer = (GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((this + 0x42d)))))->ANM2::GetLayer(GHIDRA_CAST<byte *>("paper"));
paperLayer->_visible = 0;
std::list<std::pair<int_int>>::push_back();
std::list<std::pair<int_int>>::push_back();
local_40._buf[8] = '\0';
local_40._buf[9] = '\0';
local_40._buf[10] = '\0';
local_40._buf[0xb] = '\0';
local_40._buf[0xc] = '\0';
local_40._buf[0xd] = '\0';
local_40._buf[0xe] = '\0';
local_40._buf[0xf] = '\0';
local_40._size = 0;
local_40._capacity = 0;
jsonEntryRef = GHIDRA_CAST<int *>(FUN_00a53dd0(&local_44));
jsonEntry = GHIDRA_CAST<undefined4 *>(*jsonEntryRef);
strBuf = operator_new_tracked(0xd);
strncpy(strBuf,"game_version",0xd);
*jsonEntry = strBuf;
strBuf = operator_new_tracked(10);
strncpy(strBuf,"v1.9.7.17",10);
jsonEntry[2] = strBuf;
jsonEntry[3] = GHIDRA_INT(strBuf) >> 0x1f;
local_40._buf[8] = '\0';
local_40._buf[9] = '\0';
local_40._buf[10] = '\0';
local_40._buf[0xb] = '\0';
local_40._buf[0xc] = '\0';
local_40._buf[0xd] = '\0';
local_40._buf[0xe] = '\0';
local_40._buf[0xf] = '\0';
local_40._size = 0;
local_40._capacity = 0;
jsonEntryRef = GHIDRA_CAST<int *>(FUN_00a53dd0(&local_44));
jsonEntry = GHIDRA_CAST<undefined4 *>(*jsonEntryRef);
strBuf = operator_new_tracked(0xd);
strncpy(strBuf,"build_number",0xd);
*jsonEntry = strBuf;
strBuf = operator_new_tracked(5);
strncpy(strBuf,"J460",5);
jsonEntry[2] = strBuf;
jsonEntry[3] = GHIDRA_INT(strBuf) >> 0x1f;
local_40._buf[0] = '\0';
local_40._buf[1] = '\0';
local_40._buf[2] = '\0';
local_40._buf[3] = '\0';
local_40._buf[4] = '\0';
local_40._buf[5] = '\0';
local_40._buf[6] = '\0';
local_40._buf[7] = '\0';
local_40._buf[8] = '\0';
local_40._buf[9] = '\0';
local_40._buf[10] = '\0';
local_40._buf[0xb] = '\0';
local_40._buf[0xc] = '\0';
local_40._buf[0xd] = '\0';
local_40._buf[0xe] = '\0';
local_40._buf[0xf] = '\0';
local_40._size = 0;
local_40._capacity = 0;
jsonEntryRef = GHIDRA_CAST<int *>(FUN_00a53e50(&local_44));
jsonEntry = GHIDRA_CAST<undefined4 *>(*jsonEntryRef);
strBuf = operator_new_tracked(0xd);
strncpy(strBuf,"game_version",0xd);
*jsonEntry = strBuf;
strBuf = operator_new_tracked(10);
strncpy(strBuf,"v1.9.7.17",10);
jsonEntry[4] = 2;
jsonEntry[2] = strBuf;
jsonEntry[3] = GHIDRA_INT(strBuf) >> 0x1f;
local_40._buf[0] = '\0';
local_40._buf[1] = '\0';
local_40._buf[2] = '\0';
local_40._buf[3] = '\0';
local_40._buf[4] = '\0';
local_40._buf[5] = '\0';
local_40._buf[6] = '\0';
local_40._buf[7] = '\0';
local_40._buf[8] = '\0';
local_40._buf[9] = '\0';
local_40._buf[10] = '\0';
local_40._buf[0xb] = '\0';
local_40._buf[0xc] = '\0';
local_40._buf[0xd] = '\0';
local_40._buf[0xe] = '\0';
local_40._buf[0xf] = '\0';
local_40._size = 0;
local_40._capacity = 0;
jsonEntryRef = GHIDRA_CAST<int *>(FUN_00a53e50(&local_44));
jsonEntry = GHIDRA_CAST<undefined4 *>(*jsonEntryRef);
strBuf = operator_new_tracked(0xd);
strncpy(strBuf,"build_number",0xd);
*jsonEntry = strBuf;
strBuf = operator_new_tracked(5);
strncpy(strBuf,"J460",5);
pNVar1 = self;
local_40._capacity = GHIDRA_UINT(g_userProfile);
jsonEntry[2] = strBuf;
manager = g_manager;
jsonEntry[3] = GHIDRA_INT(strBuf) >> 0x1f;
jsonEntry[4] = 2;
chat = self + 0x48c;
local_40._size = GHIDRA_UINT(KAGE)::System::UserProfile::vftable;
self[0x602] = (NetplayManager)&manager->_font2_TeamMeatEx12;
local_14 = 1;
if ((void *)local_40._capacity == (void *)0x0) {
local_60 = GHIDRA_CAST<undefined **>(0x0);
ppuVar3 = local_60;
puStack_5c = GHIDRA_CAST<undefined1 *>(0x0);
local_60 = GHIDRA_CAST<undefined **>(0x0);
local_58 = local_60;
local_54 = puStack_5c;
local_60 = ppuVar3;
}
else {
local_58 = *GHIDRA_CAST<undefined ***>((local_40._capacity + 8));
local_54 = GHIDRA_CAST<undefined1 *>(*GHIDRA_CAST<undefined4 *>((local_40._capacity + 0xc)));
}
local_44 = (NetplayManager)(self + 0x48f);
if (0xf < GHIDRA_UINT(self[0x494])) {
local_44 = *GHIDRA_CAST<NetplayManager *>(local_44);
}
_local_60 = CONCAT44(auStack_9a + -10,local_60);
(GHIDRA_CAST<UserProfile *>((&local_58)))->UserProfile::find_or_create();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
ppuVar3 = KAGE::System::UserProfile::vftable;
userRefCount = extraout_EAX;
if (((extraout_EAX != (void *)0x0) &&
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(extraout_EAX) + 8)) != 0 || *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(extraout_EAX) + 0xc)) != 0)) &&
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(extraout_EAX) + 0x14)) == 0)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((auStack_9a + -10)))->KAGE::System::UserProfile::load_steam_avatar();
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 1;
(GHIDRA_CAST<OnlineChatMessage *>((chatMessage)))->OnlineChatMessage::constructor(chat,GHIDRA_CAST<byte *>(local_44),ppuVar3,userRefCount,1.0);
local_14 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),3);
pNVar1[0x495] = *extraout_EAX_00;
pNVar1[0x497] = extraout_EAX_00[2];
(GHIDRA_CAST<FormattedText *>((pNVar1 + 0x498)))->FormattedText::operator_assign(extraout_EAX_00 + 3);
pNVar1[0x49c] = extraout_EAX_00[7];
pNVar1[0x49d] = extraout_EAX_00[8];
pNVar1[0x49e] = extraout_EAX_00[9];
pNVar1[0x49f] = extraout_EAX_00[10];
std::vector<12byte>::clear();
std::vector<12byte>::_Tidy();
local_14 = 0xffffffff;
load_mute_list();
pNVar1 = self;
reset(self,1);
daily_lobby_join_init();
local_40._size = 0;
local_40._capacity = 0;
KAGE::Network::Multiplayer::ConstLobby::ConstLobby<id>();
local_14 = 4;
(GHIDRA_CAST<std::shared_ptr *>((pNVar1 + 0x722)))->std::shared_ptr::assign(&local_54);
local_58 = KAGE::Network::Multiplayer::ConstLobby::vftable;
local_14 = 5;
if (local_50 != GHIDRA_CAST<int *>(0x0)) {
isLastRef = (**(code **)(*local_50 + 0xc))();
if ((isLastRef != '\0') && (g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)();
}
}
local_14 = 0xffffffff;
FUN_008370f0();
NVar2 = (NetplayManager)(pNVar1 + 0x71b);
if (0xf < GHIDRA_UINT(pNVar1[0x720])) {
NVar2 = pNVar1[0x71b];
}
pNVar1[0x71f] = (NetplayManager)0x0;
*GHIDRA_CAST<undefined1 *>(NVar2) = 0;
ExceptionList = local_1c;
return;
}
// 00907c10
byte NetplayManager::is_user_in_player_list(ulonglong userId)
{
Entity_Player **playerSlot;
uint playerIndex;
uint playerCount;
undefined4 idLow;
undefined4 idHigh;
int profile;
playerSlot = *GHIDRA_CAST<Entity_Player ***>(this);
playerIndex = 0;
playerCount = GHIDRA_INT(this[1]) - GHIDRA_INT(playerSlot) >> 2;
if (playerCount != 0) {
do {
profile = *GHIDRA_CAST<int *>((GHIDRA_INT(*playerSlot) + 0x374));
if (profile == 0) {
idHigh = 0;
idLow = 0;
}
else {
idLow = *GHIDRA_CAST<undefined4 *>((profile + 8));
idHigh = *GHIDRA_CAST<undefined4 *>((profile + 0xc));
}
if (userId == CONCAT44(idHigh,idLow)) {
return 1;
}
playerIndex = playerIndex + 1;
playerSlot = GHIDRA_CAST<Entity_Player **>((GHIDRA_INT(playerSlot) + 4));
} while (playerIndex < playerCount);
}
return 0;
}
// 00908e70
void NetplayManager::QueueRemovePlayer(float *param_1)
{
char cVar1;
byte bVar2;
Entity_Player *pEVar3;
undefined4 uVar4;
PlayerManager *in_ECX;
undefined4 uVar5;
uint size;
void *ptr;
float fVar6;
undefined4 uStack_40;
Entity_Player *pEStack_3c;
undefined4 uStack_38;
void *pvStack_34;
undefined4 uStack_30;
int iStack_2c;
undefined8 uStack_28;
undefined8 local_20;
void *local_10;
undefined1 *puStack_c;
undefined4 uStack_8;
uStack_8 = 0xffffffff;
puStack_c = &LAB_00b08d9d;
local_10 = ExceptionList;
ExceptionList = &local_10;
if ((GHIDRA_CAST<Vector *>((param_1 + 1)))->x == 0.0) {
local_20 = 0;
}
(**(code **)(GHIDRA_INT(*param_1) + 4))(__security_cookie ^ GHIDRA_INT(register0x00000010) - 4U);
KAGE_LogMessage(1,(byte *)
"[Frame: %d] NetManager::QueueRemovePlayer() Queueing remove player \"%s\" %llu \n"
);
fVar6 = (GHIDRA_CAST<Vector *>((param_1 + 1)))->x;
if (fVar6 == 0.0) {
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_20)) + 0x4))) = GHIDRA_CAST<Entity_Player *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_20)) + 0x0))) = 0;
}
else {
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_20)) + 0x0))) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(fVar6) + 8));
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_20)) + 0x4))) = *GHIDRA_CAST<Entity_Player **>((GHIDRA_CAST<char *>(fVar6) + 0xc));
}
pEVar3 = (GHIDRA_CAST<PlayerManager *>((in_ECX)))->PlayerManager::get_player_by_user_id(&local_20);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_20)) + 0x4))) = pEVar3;
if (pEVar3 != GHIDRA_CAST<Entity_Player *>(0x0)) {
if ((char)in_ECX[0x15]._coopSlots[0]._state == '\0') {
cVar1 = FUN_008feaa0(pEVar3);
if (cVar1 != '\0') {
if (fVar6 == 0.0) {
uStack_28 = 0;
}
(**(code **)(GHIDRA_INT(*param_1) + 4))();
KAGE_LogMessage(1,(byte *)
"[Frame: %d] NetManager::QueueRemovePlayer() Player \"%s\" %llu is already queued to by dropped by the Desync Handler (Removing player from Desync Handler) \n"
);
fVar6 = (((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_20)) + 0x4))))->_sizeMulti).x;
if (fVar6 == 0.0) {
uStack_28 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_28)) + 0x4))) = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_28)) + 0x0))) = 0;
uVar4 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_28)) + 0x4)));
uVar5 = (undefined4)uStack_28;
}
else {
uVar4 = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(fVar6) + 0xc));
uVar5 = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(fVar6) + 8));
}
FUN_008feaf0(uVar5,uVar4);
fVar6 = (GHIDRA_CAST<Vector *>((param_1 + 1)))->x;
}
if (fVar6 == 0.0) {
uStack_28 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_28)) + 0x4))) = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_28)) + 0x0))) = 0;
uVar4 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_28)) + 0x4)));
uVar5 = (undefined4)uStack_28;
}
else {
uVar4 = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(fVar6) + 0xc));
uVar5 = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(fVar6) + 8));
}
bVar2 = is_player_removal_queued(GHIDRA_CAST<NetplayManager *>(in_ECX),CONCAT44(uVar4,uVar5));
if (bVar2 != 0) {
if (fVar6 == 0.0) {
uStack_28 = 0;
}
(**(code **)(GHIDRA_INT(*param_1) + 4))();
KAGE_LogMessage(1,(byte *)
"[Frame: %d] NetManager::QueueRemovePlayer() Player \"%s\" %llu is already queued for removal (Ignoring queue request) \n"
);
ExceptionList = local_10;
return;
}
if (fVar6 == 0.0) {
uStack_28 = 0;
}
(**(code **)(GHIDRA_INT(*param_1) + 4))();
KAGE_LogMessage(1,(byte *)
"[Frame: %d] NetManager::QueueRemovePlayer() Adding player \"%s\" %llu to pending removals\n"
);
uStack_40 = 0;
pEStack_3c = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_20)) + 0x4)));
uStack_38 = 0;
pvStack_34 = (void *)0x0;
uStack_30 = 0;
iStack_2c = 0;
uStack_8 = 0;
FUN_00913ac0(&uStack_40);
if (pvStack_34 == (void *)0x0) {
ExceptionList = local_10;
return;
}
size = iStack_2c - GHIDRA_INT(pvStack_34) & 0xfffffff8;
ptr = pvStack_34;
if (0xfff < size) {
ptr = *(void **)(GHIDRA_CAST<char *>(pvStack_34) + -4);
size = size + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(pvStack_34) + (-4 - GHIDRA_INT(ptr))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(ptr,size);
ExceptionList = local_10;
return;
}
param_1 = &pEVar3->_size;
}
RemoveRemotePlayer(GHIDRA_CAST<NetplayManager *>(in_ECX),param_1);
ExceptionList = local_10;
return;
}
// 00909120
byte NetplayManager::is_player_removal_queued(ulonglong userId)
{
int profile;
int iVar2;
int *entryPlayer;
uint i;
undefined4 profileIdLow;
undefined4 uStack_8;
int profile;
iVar2 = GHIDRA_INT(this[0x61c]) - GHIDRA_INT(this[0x61b]);
profile = iVar2 >> 0x1f;
iVar2 = iVar2 / 0x18 + profile;
i = 0;
if (iVar2 != profile) {
entryPlayer = GHIDRA_CAST<int *>((GHIDRA_INT(this[0x61b]) + 4));
do {
profile = *GHIDRA_CAST<int *>((*entryPlayer + 0x374));
if (profile == 0) {
uStack_8 = 0;
profileIdLow = 0;
}
else {
profileIdLow = *GHIDRA_CAST<undefined4 *>((profile + 8));
uStack_8 = *GHIDRA_CAST<undefined4 *>((profile + 0xc));
}
if (userId == CONCAT44(uStack_8,profileIdLow)) {
return 1;
}
i = i + 1;
entryPlayer = entryPlayer + 6;
} while (i < GHIDRA_UINT((iVar2 - profile)));
}
return 0;
}
// 009091a0
void NetplayManager::RemoveRemotePlayer(void *userProfile)
{
void **ppvVar1;
qword qVar2;
EntityPtr EVar3;
Vector VVar4;
byte bVar5;
char isLastRef;
uint uVar6;
Entity_Player *pEVar7;
int iVar8;
Vector *spawnPos;
Entity_Player *pocketOwner;
NetplayManager NVar9;
undefined4 uVar10;
int *playerSlot;
byte unusedBool;
float idLow;
uint playerIndex;
float fVar11;
qword *allocatedBytes;
void *pvVar12;
NetplayManager NVar13;
uint playerCount;
longlong userId;
void *pvVar14;
undefined1 *puVar15;
Vector VStack_7c;
NetplayManager *self;
undefined1 auStack_70 [12];
NetplayManager local_64;
undefined4 uStack_60;
Entity_Player *pEStack_5c;
EntityPtr local_54;
int local_50;
float local_4c;
Vector scratchVec;
undefined4 dropMessage [2];
undefined8 dropUserId;
NetplayManager local_30;
uint local_24;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
Game *game;
Manager *manager;
int *playerList;
Room *room;
int userProfileData;
puStack_20 = GHIDRA_CAST<undefined1 *>((dropMessage + 0xf));
local_14 = 0xffffffff;
puStack_18 = &LAB_00b08dd5;
local_1c = ExceptionList;
uVar6 = __security_cookie ^ GHIDRA_UINT((dropMessage + 0xc));
ExceptionList = &local_1c;
local_54 = (EntityPtr)userProfile;
iVar8 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(userProfile) + 4));
if (iVar8 == 0) {
scratchVec.x = 0.0;
scratchVec.y = 0.0;
VVar4 = scratchVec;
scratchVec.y = 0.0;
scratchVec.x = 0.0;
fVar11 = scratchVec.y;
idLow = scratchVec.x;
scratchVec = VVar4;
}
else {
fVar11 = *GHIDRA_CAST<float *>((iVar8 + 0xc));
idLow = *GHIDRA_CAST<float *>((iVar8 + 8));
}
self = this;
local_24 = uVar6;
remove_drop_entry(this,CONCAT44(fVar11,idLow));
iVar8 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(userProfile) + 4));
if (iVar8 == 0) {
scratchVec.x = 0.0;
scratchVec.y = 0.0;
VVar4 = scratchVec;
scratchVec.y = 0.0;
scratchVec.x = 0.0;
fVar11 = scratchVec.y;
idLow = scratchVec.x;
scratchVec = VVar4;
}
else {
fVar11 = *GHIDRA_CAST<float *>((iVar8 + 0xc));
idLow = *GHIDRA_CAST<float *>((iVar8 + 8));
}
bVar5 = is_user_in_player_list(this,CONCAT44(fVar11,idLow));
if (bVar5 == 0) {
dropMessage[0] = 4;
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(userProfile) + 4)) == 0) {
dropUserId = 0;
}
else {
dropUserId = *GHIDRA_CAST<undefined8 *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(userProfile) + 4)) + 8));
}
local_30 = this[3];
if (g_multiplayerService == (void *)0x0) {
KAGE_LogMessage(0x10,(byte *)
"Attempting to create a message when there is no multiplayer service\n");
}
puVar15 = &DAT_00000005;
pvVar14 = (void *)0x18;
NetConnection::send_message(g_multiplayerService,auStack_70 + 8,1,dropMessage,0x18,5);
local_14 = 0;
FUN_008ef1d0(auStack_70 + 8);
multiplayer_send_message(userProfile,pvVar14,puVar15);
local_14 = 1;
if (((local_64 != (NetplayManager)0x0) &&
(isLastRef = (**(code **)(*GHIDRA_CAST<int *>(local_64) + 0xc))(), isLastRef != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)(auStack_70 + 8);
}
local_14 = 0xffffffff;
}
local_4c = 0.0;
if (GHIDRA_INT(this[0x617]) - GHIDRA_INT(this[0x616]) >> 4 != 0) {
local_50 = 0;
do {
scratchVec = (Vector)FUN_00a23920(uVar6);
FUN_00914480(&scratchVec);
local_4c = (float)(GHIDRA_INT(local_4c) + 1);
local_50 = local_50 + 0x10;
} while (GHIDRA_UINT(local_4c) < GHIDRA_UINT((GHIDRA_INT(this[0x617]) - GHIDRA_INT(this[0x616]) >> 4)));
userProfile = (void *)local_54;
}
iVar8 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(userProfile) + 4));
if (iVar8 == 0) {
scratchVec.x = 0.0;
scratchVec.y = 0.0;
local_4c = 0.0;
local_50 = 0;
}
else {
local_50 = *GHIDRA_CAST<undefined4 *>((iVar8 + 8));
local_4c = *GHIDRA_CAST<float *>((iVar8 + 0xc));
}
(**(code **)(*GHIDRA_CAST<int *>(userProfile) + 4))();
KAGE_LogMessage(1,(byte *)
"[Frame: %d] NetManager::RemoveRemotePlayer(UserProfile) Removing remote player \"%s\" %llu \n"
);
pvVar14 = (g_manager->_lobbyMembers)._begin;
pEStack_5c = (g_manager->_lobbyMembers)._end;
if (pvVar14 != pEStack_5c) {
LAB_009093b4:
iVar8 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar14) + 4));
if (iVar8 == 0) {
scratchVec.x = 0.0;
scratchVec.y = 0.0;
local_50 = 0;
local_4c = 0.0;
}
else {
local_4c = *GHIDRA_CAST<float *>((iVar8 + 8));
local_50 = *GHIDRA_CAST<undefined4 *>((iVar8 + 0xc));
}
pvVar12 = (void *)(GHIDRA_INT(pvVar14) + 0x14);
userId = FUN_00a23920();
if (userId != CONCAT44(local_50,local_4c)) goto LAB_009093f2;
if (pvVar12 == pEStack_5c) {
pEVar7 = pEStack_5c;
}
else {
puVar15 = GHIDRA_CAST<undefined1 *>((GHIDRA_INT(pvVar14) + 8));
do {
*GHIDRA_CAST<undefined4 *>((puVar15 + -4)) = *GHIDRA_CAST<undefined4 *>((puVar15 + 0x10));
pvVar12 = (void *)(GHIDRA_INT(pvVar12) + 0x14);
*puVar15 = puVar15[0x14];
*GHIDRA_CAST<undefined4 *>((puVar15 + 4)) = *GHIDRA_CAST<undefined4 *>((puVar15 + 0x18));
*GHIDRA_CAST<undefined4 *>((puVar15 + 8)) = *GHIDRA_CAST<undefined4 *>((puVar15 + 0x1c));
puVar15 = puVar15 + 0x14;
} while (pvVar12 != pEStack_5c);
pEVar7 = (g_manager->_lobbyMembers)._end;
}
manager = g_manager;
*GHIDRA_CAST<undefined ***>((GHIDRA_CAST<char *>(pEVar7) + -0x14)) = KAGE::System::UserProfileBase::vftable;
ppvVar1 = &(manager->_lobbyMembers)._end;
*ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + -0x14);
}
LAB_00909444:
iVar8 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_54) + 4));
if (iVar8 == 0) {
scratchVec.x = 0.0;
scratchVec.y = 0.0;
VVar4 = scratchVec;
scratchVec.y = 0.0;
scratchVec.x = 0.0;
fVar11 = scratchVec.y;
idLow = scratchVec.x;
scratchVec = VVar4;
}
else {
fVar11 = *GHIDRA_CAST<float *>((iVar8 + 0xc));
idLow = *GHIDRA_CAST<float *>((iVar8 + 8));
}
FUN_008feaf0(idLow,fVar11);
NVar13 = this[1];
local_64 = *this;
fVar11 = (float)(GHIDRA_INT(NVar13) - GHIDRA_INT(local_64) >> 2);
local_4c = 0.0;
scratchVec.y = fVar11;
if (fVar11 == 0.0) {
LAB_00909b6b:
local_64 = (NetplayManager)0x0;
VStack_7c.y = *GHIDRA_CAST<float *>(this);
uVar6 = GHIDRA_INT(NVar13) - GHIDRA_INT(VStack_7c.y) >> 2;
if (uVar6 != 0) {
playerList = (g_game->_playerManager)._playerList._begin;
playerCount = GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT(playerList) >> 2;
do {
playerIndex = 0;
if (playerCount != 0) {
playerSlot = playerList;
do {
iVar8 = *playerSlot;
if (*GHIDRA_CAST<int *>((iVar8 + 0x1618)) == *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(VStack_7c.y) + 0xc))) {
if ((iVar8 != 0) && (*GHIDRA_CAST<char *>((iVar8 + 0x20a9)) == '\0')) {
ExceptionList = local_1c;
return;
}
break;
}
playerIndex = playerIndex + 1;
playerSlot = playerSlot + 1;
} while (playerIndex < playerCount);
}
local_64 = (NetplayManager)(GHIDRA_INT(local_64) + 1);
VStack_7c.y = (float)(GHIDRA_INT(VStack_7c.y) + 4);
} while (GHIDRA_UINT(local_64) < uVar6);
this = self;
}
if (*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2) {
this[0x62d] = (NetplayManager)0x0;
this[0x62c] = (NetplayManager)(GHIDRA_INT(this[3]) + 0x3c);
}
ExceptionList = local_1c;
return;
}
while( true ) {
iVar8 = *GHIDRA_CAST<int *>(local_64);
userProfileData = *GHIDRA_CAST<int *>((iVar8 + 0x374));
if (userProfileData == 0) {
VStack_7c.y = 0.0;
uStack_60 = 0;
pEStack_5c = GHIDRA_CAST<Entity_Player *>(0x0);
}
else {
pEStack_5c = *GHIDRA_CAST<Entity_Player **>((userProfileData + 8));
VStack_7c.y = *GHIDRA_CAST<float *>((userProfileData + 0xc));
}
local_50 = iVar8;
userId = FUN_00a23920();
if (userId == CONCAT44(VStack_7c.y,pEStack_5c)) break;
local_4c = (float)(GHIDRA_INT(local_4c) + 1);
local_64 = (NetplayManager)(GHIDRA_INT(local_64) + 4);
if (GHIDRA_UINT(scratchVec.y) <= GHIDRA_UINT(local_4c)) goto LAB_00909b68;
}
if (iVar8 != 0) {
pEVar7 = GHIDRA_CAST<Entity_Player *>(FUN_004253d0());
if (pEVar7 == GHIDRA_CAST<Entity_Player *>(0x0)) {
this = self;
}
else {
if (*GHIDRA_CAST<char *>(g_game->_room) != '\0') {
local_64 = (NetplayManager)0x2;
do {
iVar8 = FUN_004253d0();
bVar5 = 0;
scratchVec.x = *GHIDRA_CAST<float *>((iVar8 + 0x33c));
scratchVec.y = *GHIDRA_CAST<float *>((iVar8 + 0x340));
spawnPos = Room::FindFreePickupSpawnPosition
(g_game->_room,&VStack_7c,&scratchVec,0.0,0,0,0);
(GHIDRA_CAST<Entity_Player *>((pEVar7)))->Entity_Player::DropTrinket(spawnPos,bVar5);
local_64 = (NetplayManager)(GHIDRA_INT(local_64) + -1);
} while (local_64 != (NetplayManager)0x0);
local_64 = (NetplayManager)0x0;
pocketOwner = GHIDRA_CAST<Entity_Player *>(FUN_004253d0());
uVar6 = (GHIDRA_CAST<Entity_Player *>((pocketOwner)))->Entity_Player::GetMaxPocketItems();
if (uVar6 != 0) {
do {
room = g_game->_room;
iVar8 = FUN_004253d0();
scratchVec.x = *GHIDRA_CAST<float *>((iVar8 + 0x33c));
scratchVec.y = *GHIDRA_CAST<float *>((iVar8 + 0x340));
spawnPos = Room::FindFreePickupSpawnPosition(room,&VStack_7c,&scratchVec,0.0,0,0,0);
NVar13 = local_64;
(GHIDRA_CAST<Entity_Player *>((pEVar7)))->Entity_Player::DropPocketItem(GHIDRA_INT(local_64),spawnPos);
local_64 = (NetplayManager)(GHIDRA_INT(NVar13) + 1);
pocketOwner = GHIDRA_CAST<Entity_Player *>(FUN_004253d0());
NVar9 = (NetplayManager)(GHIDRA_CAST<Entity_Player *>((pocketOwner)))->Entity_Player::GetMaxPocketItems();
} while (GHIDRA_UINT((GHIDRA_INT(NVar13) + 1)) < GHIDRA_UINT(NVar9));
}
bVar5 = (GHIDRA_CAST<Entity_Player *>((pEVar7)))->Entity_Player::HasCollectible(0x147,0);
if (bVar5 != 0) {
(GHIDRA_CAST<Entity_Player *>((pEVar7)))->Entity_Player::RemoveCollectible(0x147,0,0,1);
room = g_game->_room;
spawnPos = Room::GetCenterPos(GHIDRA_CAST<Vector *>((auStack_70 + 8)));
Room::FindFreePickupSpawnPosition(room,&scratchVec,spawnPos,0.0,1,0,0);
uVar6 = Random();
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(5,100,&scratchVec,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0x147,uVar6);
}
bVar5 = (GHIDRA_CAST<Entity_Player *>((pEVar7)))->Entity_Player::HasCollectible(0x148,0);
if (bVar5 != 0) {
(GHIDRA_CAST<Entity_Player *>((pEVar7)))->Entity_Player::RemoveCollectible(0x148,0,0,1);
room = g_game->_room;
spawnPos = Room::GetCenterPos(GHIDRA_CAST<Vector *>((auStack_70 + 8)));
Room::FindFreePickupSpawnPosition(room,&scratchVec,spawnPos,0.0,1,0,0);
uVar6 = Random();
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(5,100,&scratchVec,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0x148,uVar6);
}
bVar5 = (GHIDRA_CAST<Entity_Player *>((pEVar7)))->Entity_Player::HasCollectible(0xee,0);
if (bVar5 != 0) {
(GHIDRA_CAST<Entity_Player *>((pEVar7)))->Entity_Player::RemoveCollectible(0xee,0,0,1);
room = g_game->_room;
spawnPos = Room::GetCenterPos(GHIDRA_CAST<Vector *>((auStack_70 + 8)));
Room::FindFreePickupSpawnPosition(room,&scratchVec,spawnPos,0.0,1,0,0);
uVar6 = Random();
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(5,100,&scratchVec,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0xee,uVar6);
}
bVar5 = (GHIDRA_CAST<Entity_Player *>((pEVar7)))->Entity_Player::HasCollectible(0xef,0);
if (bVar5 != 0) {
(GHIDRA_CAST<Entity_Player *>((pEVar7)))->Entity_Player::RemoveCollectible(0xef,0,0,1);
room = g_game->_room;
spawnPos = Room::GetCenterPos(GHIDRA_CAST<Vector *>((auStack_70 + 8)));
Room::FindFreePickupSpawnPosition(room,&scratchVec,spawnPos,0.0,1,0,0);
uVar6 = Random();
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(5,100,&scratchVec,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0xef,uVar6);
}
bVar5 = (GHIDRA_CAST<Entity_Player *>((pEVar7)))->Entity_Player::HasCollectible(0x272,0);
if (bVar5 != 0) {
(GHIDRA_CAST<Entity_Player *>((pEVar7)))->Entity_Player::RemoveCollectible(0x272,0,0,1);
room = g_game->_room;
spawnPos = Room::GetCenterPos(GHIDRA_CAST<Vector *>((auStack_70 + 8)));
Room::FindFreePickupSpawnPosition(room,&scratchVec,spawnPos,0.0,1,0,0);
uVar6 = Random();
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(5,100,&scratchVec,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0x272,uVar6);
}
bVar5 = (GHIDRA_CAST<Entity_Player *>((pEVar7)))->Entity_Player::HasCollectible(0x273,0);
if (bVar5 != 0) {
(GHIDRA_CAST<Entity_Player *>((pEVar7)))->Entity_Player::RemoveCollectible(0x273,0,0,1);
room = g_game->_room;
spawnPos = Room::GetCenterPos(GHIDRA_CAST<Vector *>((auStack_70 + 8)));
Room::FindFreePickupSpawnPosition(room,&scratchVec,spawnPos,0.0,1,0,0);
uVar6 = Random();
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(5,100,&scratchVec,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0x273,uVar6);
}
EntityList::QuerySublist
(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST<EntityList_EL *>(auStack_70),6,0xb,-1,
0,0);
NVar13 = (NetplayManager)0x0;
local_14 = 2;
if (local_64 != (NetplayManager)0x0) {
do {
if (*GHIDRA_CAST<Entity_Player **>((*GHIDRA_CAST<int *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(auStack_70)) + 0x4))) + GHIDRA_INT(NVar13) * 4)) + 0x3c8)) == pEVar7)
{
uVar6 = Random();
iVar8 = *GHIDRA_CAST<int *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(auStack_70)) + 0x4))) + GHIDRA_INT(NVar13) * 4));
scratchVec.x = *GHIDRA_CAST<float *>((iVar8 + 0x33c));
scratchVec.y = *GHIDRA_CAST<float *>((iVar8 + 0x340));
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0xf,&scratchVec,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar6);
(**(code **)(**GHIDRA_CAST<int **>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(auStack_70)) + 0x4))) + GHIDRA_INT(NVar13) * 4)) + 0x28))();
}
NVar13 = (NetplayManager)(GHIDRA_INT(NVar13) + 1);
} while (GHIDRA_UINT(NVar13) < GHIDRA_UINT(local_64));
}
local_14 = 0xffffffff;
if (auStack_70[0] == '\0') {
if (g_mainHeap == (void *)0x0) {
allocatedBytes = &g_allocatedBytesNoHeap;
}
else {
allocatedBytes = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
if ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)auStack_70)) + 0x4))) != (void *)0x0) {
uVar6 = *GHIDRA_CAST<uint *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(auStack_70)) + 0x4))) + -4));
qVar2 = *allocatedBytes;
*GHIDRA_CAST<uint *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar6;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < uVar6));
free(GHIDRA_CAST<uint *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(auStack_70)) + 0x4))) + -4)));
}
}
local_14 = 0xffffffff;
iVar8 = local_50;
}
uVar10 = FUN_004253d0();
this = self;
userProfileData = *GHIDRA_CAST<int *>((iVar8 + 0x374));
if (userProfileData == 0) {
scratchVec.y = 0.0;
scratchVec.x = 0.0;
}
else {
scratchVec.x = *GHIDRA_CAST<float *>((userProfileData + 8));
scratchVec.y = *GHIDRA_CAST<float *>((userProfileData + 0xc));
}
FUN_0090c740(&scratchVec,uVar10);
}
}
pEStack_5c = GHIDRA_CAST<Entity_Player *>(FUN_004253d0());
if (pEStack_5c != GHIDRA_CAST<Entity_Player *>(0x0)) {
local_54 = pEStack_5c->_twinPlayer;
(GHIDRA_CAST<Entity_Player *>((pEStack_5c)))->Entity_Player::TriggerDeath(0);
(GHIDRA_CAST<PlayerManager *>((&g_game->_playerManager)))->PlayerManager::RemoveCoPlayer(pEStack_5c,unusedBool);
pvVar14 = g_game->_room;
(GHIDRA_CAST<EntityList_EL *>((GHIDRA_CAST<EntityList_EL *>((GHIDRA_INT(pvVar14) + 0x1238)))))->EntityList_EL::remove(GHIDRA_CAST<Entity *>(pEStack_5c));
(GHIDRA_CAST<EntityList_EL *>((GHIDRA_CAST<EntityList_EL *>((GHIDRA_INT(pvVar14) + 0x1258)))))->EntityList_EL::remove(GHIDRA_CAST<Entity *>(pEStack_5c));
(GHIDRA_CAST<EntityList_EL *>((GHIDRA_CAST<EntityList_EL *>((GHIDRA_INT(pvVar14) + 0x1248)))))->EntityList_EL::remove(GHIDRA_CAST<Entity *>(pEStack_5c));
(GHIDRA_CAST<EntityList_EL *>((GHIDRA_CAST<EntityList_EL *>((GHIDRA_INT(pvVar14) + 0x1268)))))->EntityList_EL::remove(GHIDRA_CAST<Entity *>(pEStack_5c));
(GHIDRA_CAST<EntityList_EL *>((GHIDRA_CAST<EntityList_EL *>((GHIDRA_INT(pvVar14) + 0x12a8)))))->EntityList_EL::remove(GHIDRA_CAST<Entity *>(pEStack_5c));
pEStack_5c->_valid = 0;
EntityList::invalidate_type_cache
(GHIDRA_CAST<EntityList *>((GHIDRA_INT(pvVar14) + 0x1218)),pEStack_5c->_type,pEStack_5c->_variant,
pEStack_5c->_subtype);
game = g_game;
if (*GHIDRA_CAST<Entity_Player **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&((g_game->_playerManager))) + 0x7c)))) == pEStack_5c) {
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&((g_game->_playerManager))) + 0x7c)))) = 0;
}
if (local_54 != (EntityPtr)0x0) {
pvVar14 = game->_room;
(GHIDRA_CAST<EntityList_EL *>((GHIDRA_CAST<EntityList_EL *>((GHIDRA_INT(pvVar14) + 0x1238)))))->EntityList_EL::remove(GHIDRA_CAST<Entity *>(local_54));
(GHIDRA_CAST<EntityList_EL *>((GHIDRA_CAST<EntityList_EL *>((GHIDRA_INT(pvVar14) + 0x1258)))))->EntityList_EL::remove(GHIDRA_CAST<Entity *>(local_54));
(GHIDRA_CAST<EntityList_EL *>((GHIDRA_CAST<EntityList_EL *>((GHIDRA_INT(pvVar14) + 0x1248)))))->EntityList_EL::remove(GHIDRA_CAST<Entity *>(local_54));
(GHIDRA_CAST<EntityList_EL *>((GHIDRA_CAST<EntityList_EL *>((GHIDRA_INT(pvVar14) + 0x1268)))))->EntityList_EL::remove(GHIDRA_CAST<Entity *>(local_54));
(GHIDRA_CAST<EntityList_EL *>((GHIDRA_CAST<EntityList_EL *>((GHIDRA_INT(pvVar14) + 0x12a8)))))->EntityList_EL::remove(GHIDRA_CAST<Entity *>(local_54));
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(local_54) + 0x170)) = 0;
EntityList::invalidate_type_cache
(GHIDRA_CAST<EntityList *>((GHIDRA_INT(pvVar14) + 0x1218)),*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_54) + 0x28)),
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_54) + 0x2c)),*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_54) + 0x30)));
EVar3 = local_54;
(**(code **)(*GHIDRA_CAST<int *>(local_54) + 0x44))();
(*(code *)**GHIDRA_CAST<undefined4 **>(EVar3))(1);
}
pEVar7 = pEStack_5c;
pEStack_5c->ClearReferences();
(*(code *)**GHIDRA_CAST<undefined4 **>(pEVar7))(1);
iVar8 = local_50;
}
KAGE_LogMessage(1,GHIDRA_CAST<byte *>("[Frame %d] Removing input device with ID %d \n"));
pvVar12 = (void *)(GHIDRA_INT(*this) + GHIDRA_INT(local_4c) * 4);
pvVar14 = (void *)(GHIDRA_INT(pvVar12) + 4);
memmove(pvVar12,pvVar14,GHIDRA_INT(this[1]) - GHIDRA_INT(pvVar14));
this[1] = (NetplayManager)(GHIDRA_INT(this[1]) + -4);
FUN_00906020(iVar8);
LAB_00909b68:
NVar13 = this[1];
goto LAB_00909b6b;
LAB_009093f2:
pvVar14 = pvVar12;
if (pvVar12 == pEStack_5c) goto LAB_00909444;
goto LAB_009093b4;
}
// 00909fe0
void * NetplayManager::get_drop_entry(ulonglong userId)
{
NetplayManager *pNVar1;
NetplayManager NVar2;
void *newMapHead;
uint i;
uint entryCount;
ulonglong pendingEntry;
void *pendingMap;
undefined4 pendingMapSize;
NetplayManager *local_14;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
undefined4 swapTmp;
local_8 = 0xffffffff;
puStack_c = &LAB_00b08e8d;
local_10 = ExceptionList;
NVar2 = this[0x616];
i = 0;
entryCount = GHIDRA_INT(this[0x617]) - GHIDRA_INT(NVar2) >> 4;
if (entryCount != 0) {
do {
if ((*GHIDRA_CAST<int *>(NVar2) == GHIDRA_INT(userId)) && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(NVar2) + 4)) == (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(userId)) + 0x4))))) {
return (void *)NVar2;
}
i = i + 1;
NVar2 = (NetplayManager)(GHIDRA_INT(NVar2) + 0x10);
} while (i < entryCount);
}
pendingMap = (void *)0x0;
pendingMapSize = 0;
ExceptionList = &local_10;
local_14 = this;
pendingEntry = userId;
pendingMap = operator_new(0x20);
pNVar1 = local_14;
*(void **)pendingMap = pendingMap;
*(void **)(GHIDRA_CAST<char *>(pendingMap) + 4) = pendingMap;
*(void **)(GHIDRA_CAST<char *>(pendingMap) + 8) = pendingMap;
*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(pendingMap) + 0xc)) = 0x101;
local_8 = 0;
NVar2 = local_14[0x617];
if (NVar2 == local_14[0x618]) {
std::vector<16byte>::_Emplace_reallocate(NVar2,&pendingEntry);
}
else {
*GHIDRA_CAST<ulonglong *>(NVar2) = pendingEntry;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(NVar2) + 8)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(NVar2) + 0xc)) = 0;
newMapHead = operator_new(0x20);
*(void **)newMapHead = newMapHead;
*(void **)(GHIDRA_CAST<char *>(newMapHead) + 4) = newMapHead;
*(void **)(GHIDRA_CAST<char *>(newMapHead) + 8) = newMapHead;
*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(newMapHead) + 0xc)) = 0x101;
*(void **)(GHIDRA_CAST<char *>(NVar2) + 8) = newMapHead;
*(void **)(GHIDRA_CAST<char *>(NVar2) + 8) = pendingMap;
swapTmp = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(NVar2) + 0xc));
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(NVar2) + 0xc)) = pendingMapSize;
this[0x617] = (NetplayManager)(GHIDRA_INT(this[0x617]) + 0x10);
pendingMap = newMapHead;
pendingMapSize = swapTmp;
}
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(&pendingMap,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)&pendingMap,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(pendingMap) + 4));
operator_delete(pendingMap,0x20);
ExceptionList = local_10;
return (void *)(GHIDRA_INT(pNVar1[0x617]) + -0x10);
}
// 0090a150
void NetplayManager::ban_user(undefined **param_1, undefined4 param_2)
{
char cVar1;
byte bVar2;
uint uVar3;
int ownerProfile;
byte *metadataValue;
byte *pbVar4;
byte *pbVar5;
undefined4 ****ppppuVar6;
undefined **appuStack_d0 [2];
undefined **local_c8;
int *lobbyImpl;
int *lobbyRefCount;
undefined **ppuStack_bc;
undefined4 uStack_b8;
undefined4 ****banList [4];
int iStack_a4;
uint uStack_a0;
byte metadataKey [104];
byte userIdText [32];
uint local_14;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
undefined4 *bannedUsersEnd;
Manager *manager;
puStack_c = &LAB_00b08ee1;
local_10 = ExceptionList;
uVar3 = __security_cookie ^ GHIDRA_UINT((userIdText + 0x30));
ExceptionList = &local_10;
local_c8 = KAGE::Network::Multiplayer::ConstLobby::vftable;
lobbyImpl = GHIDRA_CAST<int *>(0x0);
lobbyRefCount = GHIDRA_CAST<int *>(0x0);
local_8 = 0;
local_14 = uVar3;
(GHIDRA_CAST<std::shared_ptr *>((&lobbyImpl)))->std::shared_ptr::assign(&g_multiplayerLobbyPtr);
local_c8 = KAGE::Network::Multiplayer::Lobby::vftable;
local_8 = 1;
if ((lobbyImpl != GHIDRA_CAST<int *>(0x0)) && (cVar1 = (**(code **)(*lobbyImpl + 0xc))(uVar3), cVar1 != '\0'))
{
KAGE_LogMessage(1,GHIDRA_CAST<byte *>("[Frame: %d] Banning user %llu from the lobby \n"));
manager = g_manager;
ppuStack_bc = param_1;
uStack_b8 = param_2;
bannedUsersEnd = *GHIDRA_CAST<undefined4 **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((g_manager)) + 0x4b124))));
if (bannedUsersEnd == *GHIDRA_CAST<undefined4 **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((g_manager)) + 0x4b128))))) {
std::vector<8byte>::_Emplace_reallocate(bannedUsersEnd,&ppuStack_bc);
}
else {
*bannedUsersEnd = param_1;
bannedUsersEnd[1] = param_2;
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((manager)) + 0x4b124)))) = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((manager)) + 0x4b124)))) + 8;
}
if (lobbyImpl == GHIDRA_CAST<int *>(0x0)) {
uStack_b8 = 0;
}
else {
ownerProfile = (**(code **)(*lobbyImpl + 0x20))(appuStack_d0);
uStack_b8 = *GHIDRA_CAST<undefined4 *>((ownerProfile + 4));
appuStack_d0[0] = KAGE::System::UserProfileBase::vftable;
}
ppuStack_bc = KAGE::System::UserProfile::vftable;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 2;
bVar2 = (GHIDRA_CAST<KAGE::System::UserProfile *>((&ppuStack_bc)))->KAGE::System::UserProfile::is_local_user();
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),1);
if (bVar2 != 0) {
sprintf_s(userIdText,0x20,&UNK_00b78d18);
pbVar4 = userIdText;
do {
bVar2 = *pbVar4;
pbVar4 = pbVar4 + 1;
} while (bVar2 != 0);
sprintf_s(metadataKey,100,&DAT_00b62fdc);
if (lobbyImpl == GHIDRA_CAST<int *>(0x0)) {
metadataValue = GHIDRA_CAST<byte *>(0x0);
}
else {
metadataValue = GHIDRA_CAST<byte *>((**(code **)(*lobbyImpl + 0x2c))(metadataKey));
}
iStack_a4 = 0;
uStack_a0 = 0xf;
banList[0] = GHIDRA_CAST<undefined4 ****>(0x0);
pbVar5 = metadataValue;
do {
bVar2 = *pbVar5;
pbVar5 = pbVar5 + 1;
} while (bVar2 != 0);
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(banList))))->std::string::assign(metadataValue,GHIDRA_INT(pbVar5) - GHIDRA_INT((metadataValue + 1)));
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),3);
while (GHIDRA_CAST<byte *>(0x64) < pbVar4 + iStack_a4 + (1 - GHIDRA_INT((userIdText + 1)))) {
sprintf_s(metadataKey,100,&DAT_00b69520);
if (lobbyImpl == GHIDRA_CAST<int *>(0x0)) {
metadataValue = GHIDRA_CAST<byte *>(0x0);
}
else {
metadataValue = GHIDRA_CAST<byte *>((**(code **)(*lobbyImpl + 0x2c))(metadataKey));
}
pbVar5 = metadataValue;
do {
bVar2 = *pbVar5;
pbVar5 = pbVar5 + 1;
} while (bVar2 != 0);
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(banList))))->std::string::assign(metadataValue,GHIDRA_INT(pbVar5) - GHIDRA_INT((metadataValue + 1)));
}
pbVar4 = userIdText;
do {
bVar2 = *pbVar4;
pbVar4 = pbVar4 + 1;
} while (bVar2 != 0);
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(banList))))->std::string::append(userIdText,GHIDRA_INT(pbVar4) - GHIDRA_INT((userIdText + 1)));
ppppuVar6 = banList;
if (0xf < uStack_a0) {
ppppuVar6 = banList[0];
}
if (lobbyImpl != GHIDRA_CAST<int *>(0x0)) {
(**(code **)(*lobbyImpl + 0x28))(metadataKey,ppppuVar6);
}
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),1);
if (0xf < uStack_a0) {
uVar3 = uStack_a0 + 1;
ppppuVar6 = banList[0];
if (0xfff < uVar3) {
ppppuVar6 = GHIDRA_CAST<undefined4 ****>(banList[0][-1]);
uVar3 = uStack_a0 + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(banList[0]) + (-4 - GHIDRA_INT(ppppuVar6))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(ppppuVar6,uVar3);
}
}
}
local_c8 = KAGE::Network::Multiplayer::ConstLobby::vftable;
local_8 = 4;
if (((lobbyRefCount != GHIDRA_CAST<int *>(0x0)) &&
(cVar1 = (**(code **)(*lobbyRefCount + 0xc))(), cVar1 != '\0')) &&
(g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)(&lobbyImpl);
}
ExceptionList = local_10;
return;
}
// 0090a8a0
void NetplayManager::reset(byte isReleaseDevices)
{
NetplayManager *tree;
qword qVar1;
char isLastRef;
uint uVar2;
undefined4 extraout_ECX;
undefined4 extraout_ECX_00;
qword *allocCounter;
NetplayManager elementCursor;
NetplayManager NVar3;
undefined1 *outDevice;
int iVar4;
undefined1 device [4];
NetplayManager local_14;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00b08f8d;
local_10 = ExceptionList;
uVar2 = __security_cookie ^ GHIDRA_UINT((device + 0x14));
ExceptionList = &local_10;
this[3] = (NetplayManager)0x0;
this[0x62c] = (NetplayManager)0x0;
this[0x62d] = (NetplayManager)0x0;
this[5] = (NetplayManager)0x0;
*GHIDRA_CAST<undefined1 *>((this + 6)) = 1;
std::deque<12byte>::_Tidy(uVar2);
this[0x12] = this[0x11];
NVar3 = this[0xf];
local_14 = *GHIDRA_CAST<NetplayManager *>(NVar3);
if (local_14 != NVar3) {
do {
NVar3 = local_14;
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_14) + 0x14));
if (iVar4 != 0) {
if (g_mainHeap == (void *)0x0) {
allocCounter = &g_allocatedBytesNoHeap;
}
else {
allocCounter = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar2 = *GHIDRA_CAST<uint *>((iVar4 + -4));
qVar1 = *allocCounter;
*GHIDRA_CAST<uint *>(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocCounter) + 4)) =
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar2));
free((void *)(iVar4 + -4));
local_8 = 0xffffffff;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(NVar3) + 0x14)) = 0;
}
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>
*)&local_14);
NVar3 = this[0xf];
} while (local_14 != NVar3);
}
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(this + 0xf,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)(this + 0xf),
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(NVar3) + 4));
*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(NVar3) + 4)) = NVar3;
*GHIDRA_CAST<NetplayManager *>(NVar3) = NVar3;
*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(NVar3) + 8)) = NVar3;
this[0x10] = (NetplayManager)0x0;
this[0x477] = this[0x476];
this[0x47a] = this[0x479];
this[0x483] = this[0x482];
this[0x472] = (NetplayManager)0x0;
this[0x473] = (NetplayManager)0x0;
this[0x480] = this[0x47f];
FUN_00900b90(extraout_ECX);
tree = this + 0x489;
this[0x486] = this[0x485];
this[0x475] = (NetplayManager)0x0;
NVar3 = *tree;
*GHIDRA_CAST<undefined1 *>((this + 0x488)) = 0;
*GHIDRA_CAST<undefined1 *>((this + 0x48b)) = 0;
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(tree,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)tree,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(NVar3) + 4));
*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(NVar3) + 4)) = NVar3;
*GHIDRA_CAST<NetplayManager *>(NVar3) = NVar3;
*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(NVar3) + 8)) = NVar3;
this[0x48a] = (NetplayManager)0x0;
NVar3 = this[0x41c];
this[0x630] = (NetplayManager)0x26;
this[0x631] = (NetplayManager)0xe;
this[0x632] = (NetplayManager)0x0;
this[0x633] = (NetplayManager)0x0;
*GHIDRA_CAST<undefined1 *>((this + 0x634)) = 0;
std::map<unsigned_long_long_PeerStreams>::destroy_subtree
(this + 0x41c,*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(NVar3) + 4)));
*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(NVar3) + 4)) = NVar3;
*GHIDRA_CAST<NetplayManager *>(NVar3) = NVar3;
*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(NVar3) + 8)) = NVar3;
this[0x41d] = (NetplayManager)0x0;
FUN_00915be0(extraout_ECX_00);
this[0x617] = this[0x616];
if (isReleaseDevices == 0) {
NVar3 = *this;
if (NVar3 != this[1]) {
do {
FUN_00901b70();
NVar3 = (NetplayManager)(GHIDRA_INT(NVar3) + 4);
} while (NVar3 != this[1]);
}
ExceptionList = local_10;
return;
}
NVar3 = *this;
if (3 < GHIDRA_UINT((GHIDRA_INT(this[1]) - GHIDRA_INT(NVar3)))) {
do {
iVar4 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(NVar3) + 0xc));
outDevice = device;
(GHIDRA_CAST<InputManager *>((&PTR_vftable_00c57b18)))->InputManager::get_device(outDevice,iVar4);
local_8 = 1;
FUN_00902d60(device);
FUN_00a20eb0(outDevice,iVar4);
local_8 = 2;
if (((local_14 != (NetplayManager)0x0) &&
(isLastRef = (**(code **)(*GHIDRA_CAST<int *>(local_14) + 0xc))(), isLastRef != '\0')) &&
(g_inputDeviceRelease != (void *)0x0)) {
(*g_inputDeviceRelease)(device);
}
local_8 = 0xffffffff;
NVar3 = *this;
} while ((GHIDRA_INT(this[1]) - GHIDRA_INT(NVar3) & 0xfffffffcU) != 0);
}
NVar3 = this[0x61c];
elementCursor = this[0x61b];
if (elementCursor != NVar3) {
do {
std::vector<Vector>::_Tidy();
elementCursor = (NetplayManager)(GHIDRA_INT(elementCursor) + 0x18);
} while (elementCursor != NVar3);
elementCursor = this[0x61b];
}
this[0x61c] = elementCursor;
NVar3 = this[0x61f];
elementCursor = this[0x61e];
if (elementCursor != NVar3) {
do {
std::vector<Vector>::_Tidy();
elementCursor = (NetplayManager)(GHIDRA_INT(elementCursor) + 0x20);
} while (elementCursor != NVar3);
elementCursor = this[0x61e];
}
this[0x61f] = elementCursor;
NVar3 = this[0x619];
this[0x622] = this[0x621];
FUN_00914d90(this + 0x619,*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(NVar3) + 4)));
*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(NVar3) + 4)) = NVar3;
*GHIDRA_CAST<NetplayManager *>(NVar3) = NVar3;
*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(NVar3) + 8)) = NVar3;
this[0x61a] = (NetplayManager)0x0;
ExceptionList = local_10;
return;
}
// 0090b100
byte NetplayManager::IsIdxLocalPlayer(uint idx)
{
byte isLocal;
NetplayManager playerSlot;
uint playerCount;
uint i;
playerSlot = *this;
i = 0;
playerCount = GHIDRA_INT(this[1]) - GHIDRA_INT(playerSlot) >> 2;
if (playerCount != 0) {
do {
if (*GHIDRA_CAST<uint *>((*GHIDRA_CAST<int *>(playerSlot) + 0xc)) == idx) {
isLocal = (**(code **)(*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(playerSlot) + 0x370)) + 0x14))();
return isLocal;
}
i = i + 1;
playerSlot = (NetplayManager)(GHIDRA_INT(playerSlot) + 4);
} while (i < playerCount);
}
return 1;
}
// 0090b150
byte NetplayManager::Update()
{
NetplayManager *this_00;
int iVar1;
Game *pGVar2;
undefined1 *puVar3;
char cVar4;
byte bVar5;
int *piVar6;
uint uVar7;
Manager *manager;
int *messageRefCount;
undefined1 auStack_8a [2];
int *local_50;
int *local_4c;
int *local_48;
int *local_44;
int *inputMessage;
int *inputMessageRef;
undefined1 received [4];
NetplayManager local_34;
int *local_30;
int *local_2c;
int *cleanupFlags;
char isNoLobby;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
NetplayManager dailyJoinStatus;
NetplayManager inputDelay;
puStack_20 = received + 0x34;
local_14 = 0xffffffff;
puStack_18 = &LAB_00b0901e;
local_1c = ExceptionList;
ExceptionList = &local_1c;
this_00 = this + 0x636;
local_30 = GHIDRA_CAST<int *>(0x0);
cleanupFlags = GHIDRA_CAST<int *>(0x0);
puVar3 = received + 0x34;
if ((this[0x646] != (NetplayManager)0x0) &&
(puVar3 = received + 0x34, *GHIDRA_CAST<char *>((this + 0x64a)) != '\0')) {
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((this + 0x639)))))->ANM2::update_appear_then_idle();
if ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[0x6c8])) + 0x1))) != '\0') {
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((this + 0x692)))))->AnimationState::Update();
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((this + 0x69a)))))->AnimationState::Update();
}
local_2c = GHIDRA_CAST<int *>(&DAT_0000000f);
cVar4 = (**(code **)(PTR_vftable_00c57b18 + 0x74))(0xffffffff,FUN_00a209e0,&local_2c);
if (cVar4 != '\0') {
daily_lobby_join_reset(this_00);
}
this[0x637] = (NetplayManager)(GHIDRA_INT(this[0x637]) + 1);
puVar3 = puStack_20;
if (0x5a < GHIDRA_UINT(this[0x637])) {
dailyJoinStatus = *this_00;
if (dailyJoinStatus == (NetplayManager)0x2) {
daily_lobby_join_reset(this_00);
string_table_translate(&g_manager->_stringTable,GHIDRA_CAST<byte *>("#Online/LOBBY_JOIN_DAILY_DENIED"));
daily_lobby_join_show_error();
puVar3 = puStack_20;
}
else if (dailyJoinStatus == (NetplayManager)0x5) {
daily_lobby_join_reset(this_00);
string_table_translate(&g_manager->_stringTable,GHIDRA_CAST<byte *>("#Online/LOBBY_JOIN_DAILY_FAILED"));
daily_lobby_join_show_error();
puVar3 = puStack_20;
}
else if (dailyJoinStatus == (NetplayManager)0x3) {
daily_lobby_join_reset(this_00);
string_table_translate
(&g_manager->_stringTable,GHIDRA_CAST<byte *>("#Online/LOBBY_JOIN_DAILY_IN_PROGRESS"));
daily_lobby_join_show_error();
puVar3 = puStack_20;
}
else if (dailyJoinStatus == (NetplayManager)0x4) {
join_pending_lobby(&g_manager->_netplayManager,this + 0x6cb);
daily_lobby_join_reset(this_00);
puVar3 = puStack_20;
}
}
}
puStack_20 = puVar3;
(GHIDRA_CAST<LobbyPasswordPrompt *>((this + 0x6ce)))->LobbyPasswordPrompt::Update();
update_text_popup(this + 0x428);
process_lobby_messages();
if ((this[0x62a] != (NetplayManager)0x0) && (this[0x629] == this[3])) {
KAGE_LogMessage(1,GHIDRA_CAST<byte *>("[Frame %d] Executing delayed game start \n"));
FUN_00a581a0();
local_14 = 0;
FUN_0090ca40();
this[0x629] = (NetplayManager)0x0;
if (this[0x62a] != (NetplayManager)0x0) {
operator_delete((void *)this[0x62a],1);
this[0x62a] = (NetplayManager)0x0;
}
this[0x62b] = (NetplayManager)0x0;
local_14 = 0xffffffff;
FUN_00a58200();
}
while (g_multiplayerService != (void *)0x0) {
piVar6 = (GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::receive_message(received,2,0);
iVar1 = *piVar6;
local_14 = 1;
if (((local_34 != (NetplayManager)0x0) &&
(cVar4 = (**(code **)(*GHIDRA_CAST<int *>(local_34) + 0xc))(), cVar4 != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)();
}
local_14 = 0xffffffff;
if (iVar1 == 0) break;
cleanupFlags = GHIDRA_CAST<int *>((GHIDRA_UINT(cleanupFlags) | 2));
if (g_multiplayerService == (void *)0x0) {
KAGE::SmartPointer<MessageData>::reset();
}
else {
(GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::receive_message(&local_48,2,1);
}
local_14 = 2;
if (((local_44 != GHIDRA_CAST<int *>(0x0)) && (cVar4 = (**(code **)(*local_44 + 0xc))(), cVar4 != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)();
}
local_14 = 0xffffffff;
}
update_status_messages();
while (g_multiplayerService != (void *)0x0) {
piVar6 = (GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::receive_message(&local_50,10,0);
iVar1 = *piVar6;
local_14 = 3;
if (((local_4c != GHIDRA_CAST<int *>(0x0)) && (cVar4 = (**(code **)(*local_4c + 0xc))(), cVar4 != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)();
}
local_14 = 0xffffffff;
if (iVar1 == 0) break;
cleanupFlags = GHIDRA_CAST<int *>((GHIDRA_UINT(cleanupFlags) | 4));
if (g_multiplayerService == (void *)0x0) {
KAGE::SmartPointer<MessageData>::reset();
}
else {
(GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::receive_message(&local_48,10,1);
}
local_14 = 4;
piVar6 = GHIDRA_CAST<int *>(0x0);
local_2c = local_44;
local_30 = local_48;
if ((((local_44 != GHIDRA_CAST<int *>(0x0)) && (cVar4 = (**(code **)(*local_44 + 4))(), cVar4 != '\0')) &&
(piVar6 != GHIDRA_CAST<int *>(0x0))) &&
((cVar4 = (**(code **)(*piVar6 + 0xc))(), cVar4 != '\0' &&
(g_multiplayerRelease != (void *)0x0)))) {
(*g_multiplayerRelease)(auStack_8a + -10);
}
(GHIDRA_CAST<Camera *>((GHIDRA_CAST<Camera *>((this + 0x48c)))))->Camera::UpdateUltrasmooth();
local_14 = 5;
if (((local_44 != GHIDRA_CAST<int *>(0x0)) && (cVar4 = (**(code **)(*local_44 + 0xc))(), cVar4 != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)();
}
local_14 = 0xffffffff;
}
process_drop_player_message(this);
receive_vote_end_message(this);
update_player_removal(this);
if (*this != this[1]) {
local_50 = GHIDRA_CAST<int *>(0x0);
local_4c = GHIDRA_CAST<int *>(0x0);
local_14 = 6;
(GHIDRA_CAST<std::shared_ptr *>((&local_50)))->std::shared_ptr::assign(&g_multiplayerLobbyPtr);
local_14 = 7;
local_30 = GHIDRA_CAST<int *>((GHIDRA_UINT(cleanupFlags) | 0x19));
cleanupFlags = local_30;
if (local_50 != GHIDRA_CAST<int *>(0x0)) {
cVar4 = (**(code **)(*local_50 + 0xc))();
isNoLobby = '\0';
if (cVar4 != '\0') goto LAB_0090b5d1;
}
}
isNoLobby = '\x01';
LAB_0090b5d1:
if ((GHIDRA_UINT(cleanupFlags) & 1) != 0) {
cleanupFlags = GHIDRA_CAST<int *>((GHIDRA_UINT(cleanupFlags) & 0xfffffffe));
local_14 = 8;
if (((local_4c != GHIDRA_CAST<int *>(0x0)) && (cVar4 = (**(code **)(*local_4c + 0xc))(), cVar4 != '\0')) &&
(g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)();
}
}
local_14 = 0xffffffff;
if (isNoLobby == '\0') {
check_connection(this);
manager = g_manager;
dailyJoinStatus = this[4];
inputDelay = (NetplayManager)(g_manager->_optionsConfig)._onlineInputDelay;
this[4] = inputDelay;
if (GHIDRA_UINT(dailyJoinStatus) < GHIDRA_UINT(inputDelay)) {
*GHIDRA_CAST<undefined1 *>((this + 6)) = 1;
}
if (manager->_state == 2) {
online_chat_update(this + 0x48c);
manager = g_manager;
}
if ((manager->_framecount & 1) == 0) {
while (g_multiplayerService != (void *)0x0) {
piVar6 = (GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::receive_message(&local_50,1,0);
iVar1 = *piVar6;
local_14 = 9;
if (((local_4c != GHIDRA_CAST<int *>(0x0)) && (cVar4 = (**(code **)(*local_4c + 0xc))(), cVar4 != '\0'))
&& (g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)();
}
local_14 = 0xffffffff;
if (iVar1 == 0) break;
cleanupFlags = GHIDRA_CAST<int *>((GHIDRA_UINT(cleanupFlags) | 0x20));
if (g_multiplayerService == (void *)0x0) {
KAGE::SmartPointer<MessageData>::reset();
}
else {
(GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::receive_message(&inputMessage,1,1);
}
local_14 = 10;
local_48 = GHIDRA_CAST<int *>(*inputMessage);
local_44 = GHIDRA_CAST<int *>(inputMessage[1]);
local_34 = (NetplayManager)
PlayerManager::get_player_by_user_id
(GHIDRA_CAST<PlayerManager *>(this),GHIDRA_CAST<ulonglong *>(&local_48));
if (local_34 != (NetplayManager)0x0) {
piVar6 = GHIDRA_CAST<int *>(0x0);
messageRefCount = GHIDRA_CAST<int *>(0x0);
local_30 = inputMessageRef;
local_2c = inputMessage;
if ((inputMessageRef != GHIDRA_CAST<int *>(0x0)) &&
(cVar4 = (**(code **)(*inputMessageRef + 4))(), cVar4 != '\0')) {
if ((messageRefCount != GHIDRA_CAST<int *>(0x0)) &&
((cVar4 = (**(code **)(*messageRefCount + 0xc))(), cVar4 != '\0' &&
(g_multiplayerRelease != (void *)0x0)))) {
(*g_multiplayerRelease)(auStack_8a + -10);
}
piVar6 = local_2c;
messageRefCount = local_30;
}
(GHIDRA_CAST<NetInputDevice *>(((void *)local_34)))->NetInputDevice::ProcessInputMessage(piVar6,messageRefCount);
}
local_14 = 0xb;
if (((inputMessageRef != GHIDRA_CAST<int *>(0x0)) &&
(cVar4 = (**(code **)(*inputMessageRef + 0xc))(), cVar4 != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)();
}
local_14 = 0xffffffff;
}
process_drop_player_message(this);
update_revives(this);
online_vote_update();
(GHIDRA_CAST<NetDesyncHandler *>((this + 0x472)))->NetDesyncHandler::Update();
dailyJoinStatus = this[0x630];
local_34 = (NetplayManager)get_rich_presence_room_status();
pGVar2 = g_game;
if (((local_34 != dailyJoinStatus) || (this[0x631] != (NetplayManager)g_game->_stage)) ||
(((iVar1 = g_game->_difficulty, iVar1 == 2 || (iVar1 == 3)) &&
((this[0x632] != (NetplayManager)g_game->_greedModeWave ||
(this[0x633] != (NetplayManager)((iVar1 == 3) + 10))))))) {
this[0x630] = local_34;
this[0x631] = (NetplayManager)pGVar2->_stage;
this[0x632] = (NetplayManager)pGVar2->_greedModeWave;
this[0x633] = (NetplayManager)((pGVar2->_difficulty == 3) + 10);
*GHIDRA_CAST<bool *>((this + 0x634)) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pGVar2->_room) + 0x723c)) != -1;
update_lobby_stage_info(this);
}
bVar5 = process_consolidated_messages(this + 0x488);
if (bVar5 == 0) {
bVar5 = try_advance_frame(this);
ExceptionList = local_1c;
return bVar5;
}
ExceptionList = local_1c;
return 0;
}
uVar7 = 0;
if (GHIDRA_INT(this[1]) - GHIDRA_INT(*this) >> 2 != 0) {
do {
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_INT(*this) + uVar7 * 4));
uVar7 = uVar7 + 1;
*GHIDRA_CAST<undefined4 *>((iVar1 + 0x388)) = 0;
*GHIDRA_CAST<undefined4 *>((iVar1 + 0x38c)) = 0;
} while (uVar7 < GHIDRA_UINT((GHIDRA_INT(this[1]) - GHIDRA_INT(*this) >> 2)));
}
}
ExceptionList = local_1c;
return 1;
}
// 0090b900
void NetplayManager::Render()
{
NetplayManager *topAnimState = this;
char isActive;
uint uVar1;
AnimationState *topAnimState;
byte *str;
float *centerNull;
undefined4 drawParams;
undefined4 local_44;
undefined4 local_40;
undefined4 local_3c;
undefined4 local_38;
undefined4 local_34;
undefined4 local_30;
KColor white;
Vector drawPos;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
Manager *manager;
local_8 = 0xffffffff;
puStack_c = &LAB_00b0904d;
local_10 = ExceptionList;
uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
ExceptionList = &local_10;
if (topAnimState[0x42c] != (NetplayManager)0x0) {
drawPos.x = g_screenWidth * 0.5;
drawPos.y = 48.0;
if ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(topAnimState[0x46f])) + 0x1))) != '\0') {
if (*GHIDRA_CAST<char *>((topAnimState + 0x449)) == '\0') {
AnimationState::Render
(GHIDRA_CAST<AnimationState *>((topAnimState + 0x439)),&drawPos,&g_vectorZero,&g_vectorZero);
topAnimState = GHIDRA_CAST<AnimationState *>((topAnimState + 0x441));
}
else {
AnimationState::Render
(GHIDRA_CAST<AnimationState *>((topAnimState + 0x441)),&drawPos,&g_vectorZero,&g_vectorZero);
topAnimState = GHIDRA_CAST<AnimationState *>((topAnimState + 0x439));
}
AnimationState::Render(topAnimState,&drawPos,&g_vectorZero,&g_vectorZero);
}
if (topAnimState[0x43a] == (NetplayManager)0x0) {
centerNull = GHIDRA_CAST<float *>(0x0);
}
else {
centerNull = (GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((topAnimState + 0x439)))))->AnimationState::GetNullFrame(GHIDRA_CAST<byte *>("Center"));
}
manager = g_manager;
drawPos.x = drawPos.x + *centerNull;
drawParams = 4;
drawPos.y = (drawPos.y + centerNull[1]) - 2.0;
local_44 = 0xffff;
local_40 = 0;
local_3c = 0x3f800000;
local_38 = 0xffffffff;
local_34 = 0;
local_30 = 0;
local_8 = 0;
(GHIDRA_CAST<KColor *>((&white)))->KColor::SetFromARGB(0xffffffff);
str = *GHIDRA_CAST<byte **>((GHIDRA_INT(topAnimState[0x429]) + (GHIDRA_INT(topAnimState[0x42a]) - 1U & GHIDRA_UINT(topAnimState[0x42b])) * 4));
if (0xf < *GHIDRA_CAST<uint *>((str + 0x14))) {
str = *GHIDRA_CAST<byte **>(str);
}
(GHIDRA_CAST<Font *>((&manager->_font2_TeamMeatEx12)))->Font::DrawString(str,&drawPos,GHIDRA_CAST<Vector *>((centerNull + 4)),&white,
&drawParams);
}
local_8 = 0xffffffff;
if (g_menuManager == GHIDRA_CAST<MenuManager *>(0x0)) {
drawPos.y = DAT_00c79980 - 80.0;
drawPos.x = 60.0;
(GHIDRA_CAST<OnlineChat *>((topAnimState + 0x48c)))->OnlineChat::render_all(&drawPos,0);
}
if ((topAnimState[0x646] != (NetplayManager)0x0) && (*GHIDRA_CAST<char *>((topAnimState + 0x64a)) != '\0')) {
(GHIDRA_CAST<GenericPopup *>((GHIDRA_CAST<GenericPopup *>((topAnimState + 0x639)))))->GenericPopup::Render();
isActive = FUN_00837610(uVar1);
if (isActive != '\0') {
drawPos.x = (g_screenWidth - 480.0) * 0.5 + 240.0;
drawPos.y = (g_screenHeight - 270.0) * 0.5 + 150.0;
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((topAnimState + 0x686)))))->ANM2::Render(&drawPos,&g_vectorZero,&g_vectorZero);
}
}
if ((topAnimState[0x6db] != (NetplayManager)0x0) && (*GHIDRA_CAST<char *>((topAnimState + 0x6df)) != '\0')) {
(GHIDRA_CAST<GenericPopup *>((GHIDRA_CAST<GenericPopup *>((topAnimState + 0x6ce)))))->GenericPopup::Render();
isActive = FUN_00837610(uVar1);
if (isActive != '\0') {
drawPos.x = (g_screenWidth - 480.0) * 0.5 + 209.0;
drawPos.y = (g_screenHeight - 270.0) * 0.5 + 130.0;
lobby_password_render(topAnimState + 0x71b,&drawPos,1.0);
}
}
ExceptionList = local_10;
return;
}
// 0090bf10
void NetplayManager::join_pending_lobby(void *lobby)
{
int height;
int *piVar1;
MenuManager *newMenuManager;
MenuManager *extraout_EAX;
int unused;
undefined1 auStackY_dc [128];
undefined4 in_stack_ffffffac;
undefined4 in_stack_ffffffb0;
undefined1 auStack_4a [2];
KColor fadeColor;
int local_28;
MenuManager *pMStack_24;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
Manager *manager;
puStack_20 = auStack_4a + 0x46;
local_14 = 0xffffffff;
puStack_18 = &LAB_00b090fa;
local_1c = ExceptionList;
ExceptionList = &local_1c;
if (g_manager->_currentSaveSlot == 0) {
if (g_menuManager == GHIDRA_CAST<MenuManager *>(0x0)) {
puStack_20 = auStack_4a + 0x46;
piVar1 = glfw_get_window_size(&local_28,0);
height = piVar1[1];
piVar1 = glfw_get_window_size(&local_28,unused);
Manager::set_viewport_size(*piVar1,height);
newMenuManager = operator_new(0xf930);
_local_28 = CONCAT44(newMenuManager,local_28);
local_14 = 0;
if (newMenuManager == GHIDRA_CAST<MenuManager *>(0x0)) {
g_menuManager = GHIDRA_CAST<MenuManager *>(0x0);
}
else {
(GHIDRA_CAST<MenuManager *>((newMenuManager)))->MenuManager::constructor();
g_menuManager = extraout_EAX;
}
local_14 = 0xffffffff;
(GHIDRA_CAST<MenuManager *>((g_menuManager)))->MenuManager::Init();
(GHIDRA_CAST<KColor *>((&fadeColor)))->KColor::SetFromARGB(0xffffffff);
manager = g_manager;
(g_manager->_pendingMenuFadeColor)._red = fadeColor._red;
(manager->_pendingMenuFadeColor)._green = fadeColor._green;
(manager->_pendingMenuFadeColor)._blue = fadeColor._blue;
(manager->_pendingMenuFadeColor)._alpha = fadeColor._alpha;
manager->_pendingMenuState = 2;
(manager->_pendingMenuFadeColor)._unk = fadeColor._unk;
manager->_isMenuPending = 1;
}
else {
puStack_20 = auStack_4a + 0x46;
(GHIDRA_CAST<MenuManager *>((g_menuManager)))->MenuManager::SetState(2,1);
}
_local_28 = CONCAT44(auStackY_dc + 0x84,local_28);
local_14 = 1;
(GHIDRA_CAST<std::shared_ptr *>((auStackY_dc + 0x88)))->std::shared_ptr::assign((void *)(GHIDRA_INT(lobby) + 4));
local_14 = 0xffffffff;
FUN_009db250();
}
else if ((g_game == GHIDRA_CAST<Game *>(0x0)) || (g_game->_stage == 0)) {
online_lobby_join(this,lobby,CONCAT44(in_stack_ffffffb0,in_stack_ffffffac));
}
else {
puStack_20 = auStack_4a + 0x46;
(GHIDRA_CAST<std::shared_ptr *>((this + 0x625)))->std::shared_ptr::assign((void *)(GHIDRA_INT(lobby) + 4));
if (*this == this[1]) {
_local_28 = 0;
KAGE::Network::Multiplayer::ConstLobby::ConstLobby<id>();
local_14 = 2;
netplay_leave_lobby_callback();
(GHIDRA_CAST<KAGE::Network::Multiplayer::ConstLobby *>((&fadeColor._blue)))->KAGE::Network::Multiplayer::ConstLobby::~ConstLobby();
}
else {
Multiplayer::leave_lobby(netplay_leave_lobby_callback,this);
}
}
ExceptionList = local_1c;
return;
}
// 0090c0e0
void NetplayManager::store_local_persistent_game_data()
{
int *piVar1;
void *pvVar2;
int in_ECX;
undefined4 local_98;
undefined4 uStack_94;
void *local_8c;
undefined4 local_88;
void *pvStack_84;
undefined1 messageType;
undefined4 gameDataWriter;
undefined4 uStack_74;
undefined4 uStack_70;
undefined4 uStack_6c;
undefined4 local_68;
undefined4 uStack_64;
undefined4 uStack_60;
undefined4 uStack_5c;
int bufferedStream [13];
uint local_24;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
int local_14;
void *compressedData;
puStack_20 = GHIDRA_CAST<undefined1 *>((bufferedStream + 0x15));
local_14 = 0xffffffff;
puStack_18 = &LAB_00b09145;
local_1c = ExceptionList;
local_24 = __security_cookie ^ GHIDRA_UINT((bufferedStream + 0x12));
ExceptionList = &local_1c;
piVar1 = GHIDRA_CAST<int *>((in_ECX + 0xfec));
(**(code **)(*piVar1 + 8))(local_24);
(**(code **)(*piVar1 + 4))(0,0xffffffff);
(GHIDRA_CAST<KAGE::Filesys::BufferedStream *>((bufferedStream)))->KAGE::Filesys::BufferedStream::BufferedStream(0);
local_14 = 0;
(**(code **)(bufferedStream[0] + 8))();
(**(code **)(bufferedStream[0] + 4))(0,0xffffffff);
gameDataWriter = 0;
uStack_74 = 0;
uStack_70 = 0;
uStack_6c = 0;
local_68 = 0;
uStack_64 = 0;
uStack_60 = 0;
uStack_5c = 0;
local_8c = g_userProfile;
local_14 = 2;
if (g_userProfile == (void *)0x0) {
pvStack_84 = (void *)0x0;
local_88 = 0;
}
else {
local_88 = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(g_userProfile) + 8));
pvStack_84 = *(void **)(GHIDRA_CAST<char *>(g_userProfile) + 0xc);
}
FUN_0091b0f0(&g_manager->_persistentGameData,&local_88);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 1;
local_8c = (void *)0x0;
pvVar2 = (GHIDRA_CAST<PersistentGameDataWriter *>((&gameDataWriter)))->PersistentGameDataWriter::compress(GHIDRA_CAST<uint *>(&local_8c));
pvStack_84 = pvVar2;
(**(code **)(*piVar1 + 4))(0,0xffffffff);
pvVar2 = local_8c;
(**(code **)(*piVar1 + 0xc))(GHIDRA_INT(local_8c) + 5);
messageType = 2;
(**(code **)(*GHIDRA_CAST<int *>((in_ECX + 0x1014)) + 0x1c))(&messageType,1,1);
local_8c = pvVar2;
(**(code **)(*GHIDRA_CAST<int *>((in_ECX + 0x1014)) + 0x1c))(&local_8c,4,1);
compressedData = pvStack_84;
(**(code **)(*GHIDRA_CAST<int *>((in_ECX + 0x1014)) + 0x1c))(pvStack_84,pvVar2,1);
if (compressedData != (void *)0x0) {
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 3;
tracked_alloc(1,compressedData,0);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 1;
}
PersistentGameData::operator_assign
(GHIDRA_CAST<PersistentGameData *>((in_ECX + 0x5c)),&g_manager->_persistentGameData);
local_8c = g_userProfile;
local_14 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),4);
if (g_userProfile == (void *)0x0) {
uStack_94 = 0;
local_98 = 0;
}
else {
local_98 = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(g_userProfile) + 8));
uStack_94 = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(g_userProfile) + 0xc));
}
_local_88 = CONCAT44(uStack_94,local_98);
FUN_0090c2d0(&local_88,&gameDataWriter);
FUN_00a58200();
ExceptionList = local_1c;
return;
}
// 0090c360
void * NetplayManager::get_player_persistent_game_data(Entity_Player *player)
{
void *gameData;
uint userIdLow;
uint userIdHigh;
uint userIdKey;
uint userIdKeyHigh;
undefined1 findResult [8];
NetplayManager foundNode;
int userProfile;
gameData = this->InputManager::GetDeviceByPlayerEntity(player);
if (gameData != (void *)0x0) {
userProfile = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(gameData) + 0x374));
if (userProfile == 0) {
userIdKeyHigh = 0;
userIdKey = 0;
userIdLow = userIdKey;
userIdHigh = userIdKeyHigh;
}
else {
userIdLow = *GHIDRA_CAST<uint *>((userProfile + 8));
userIdHigh = *GHIDRA_CAST<uint *>((userProfile + 0xc));
}
_userIdKey = CONCAT44(userIdHigh,userIdLow);
FUN_00731ee0(findResult,&userIdKey);
if ((((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(foundNode) + 0xd)) == '\0') &&
(*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(foundNode) + 0x14)) <= userIdHigh)) &&
((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(foundNode) + 0x14)) < userIdHigh ||
(*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(foundNode) + 0x10)) <= userIdLow)))) && (foundNode != this[0x41a])) {
gameData = (void *)FUN_00914150(&userIdKey);
return gameData;
}
}
return (void *)0x0;
}
// 0090c7e0
int NetplayManager::restore_player_state(ulonglong *userId, Entity_Player *player)
{
EntityPtr player_00;
Entity_Player *pEVar1;
ulonglong *userId_00;
NetplayManager *this_00;
uint uVar2;
int *pendingEntry;
int *piVar3;
undefined1 findResult [8];
NetplayManager lowerBound;
uint reader;
byte *local_618;
undefined4 local_614;
undefined4 local_610;
undefined1 local_60c;
undefined4 local_608;
undefined4 local_604;
int slotValue;
Entity_Player *local_5fc;
ulonglong *local_5f8;
NetplayManager *local_5f4;
GameStatePlayer gameState [375];
uint local_14;
void *local_10;
undefined1 *puStack_c;
GameStatePlayer local_8;
int playerType;
local_8 = (GameStatePlayer)0xffffffff;
puStack_c = &LAB_00b091d0;
local_10 = ExceptionList;
uVar2 = __security_cookie ^ GHIDRA_UINT((gameState + 0x17b));
ExceptionList = &local_10;
local_5f8 = userId;
local_5fc = player;
local_5f4 = this;
local_14 = uVar2;
FUN_00731ee0(findResult,userId);
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(lowerBound) + 0xd)) != '\0') {
ExceptionList = local_10;
return 0;
}
if (*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(userId) + 4)) < *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(lowerBound) + 0x14))) {
ExceptionList = local_10;
return 0;
}
if ((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(userId) + 4)) <= *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(lowerBound) + 0x14))) &&
(GHIDRA_UINT(*userId) < *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(lowerBound) + 0x10)))) {
ExceptionList = local_10;
return 0;
}
if (lowerBound == this[0x41c]) {
ExceptionList = local_10;
return 0;
}
pendingEntry = GHIDRA_CAST<int *>(FUN_00913e50(userId));
playerType = player->_playerType;
if (*pendingEntry == playerType) {
piVar3 = pendingEntry;
}
else {
piVar3 = pendingEntry + 0xd;
if (((pendingEntry[0xd] != playerType) &&
(piVar3 = pendingEntry + 0x1a, pendingEntry[0x1a] != playerType)) &&
(piVar3 = pendingEntry + 0x27, pendingEntry[0x27] != playerType)) goto LAB_0090c9f0;
}
if (piVar3 != GHIDRA_CAST<int *>(0x0)) {
(**(code **)(piVar3[0xc] + 0xc))(0,0,uVar2);
local_618 = &s_empty;
local_604 = 1;
local_610 = 0;
local_60c = 0;
reader = -GHIDRA_UINT((piVar3 != GHIDRA_CAST<int *>(0xfffffff8))) & GHIDRA_UINT((piVar3 + 0xc));
local_608 = 0xfedcba76;
input_state_reset(gameState);
local_8 = (GameStatePlayer)0x0;
(GHIDRA_CAST<GameStatePlayer *>((gameState)))->GameStatePlayer::Init();
local_614 = 0xa9;
(GHIDRA_CAST<GameStatePlayer *>((gameState)))->GameStatePlayer::read(&reader);
(GHIDRA_CAST<Entity_Player *>((local_5fc)))->Entity_Player::RestoreGameState(gameState);
this_00 = local_5f4;
userId_00 = local_5f8;
slotValue = piVar3[1];
*piVar3 = 0x29;
piVar3[1] = 0;
if (((*pendingEntry == 0x29) && (pendingEntry[0xd] == 0x29)) &&
((pendingEntry[0x1a] == 0x29 && (pendingEntry[0x27] == 0x29)))) {
std::map<unsigned_long_long_PeerStreams>::erase(local_5f8);
}
pEVar1 = local_5fc;
player_00 = local_5fc->_twinPlayer;
if ((player_00 != (EntityPtr)0x0) &&
(((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(player_00) + 0x161c)) == -1 ||
(local_5fc->_playerIndex <= *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(player_00) + 0x161c)))) ||
(player_00 == (EntityPtr)local_5fc)))) {
restore_player_state(this_00,userId_00,GHIDRA_CAST<Entity_Player *>(player_00));
}
if (pEVar1->_backupPlayer != GHIDRA_CAST<Entity_Player *>(0x0)) {
restore_player_state(this_00,userId_00,pEVar1->_backupPlayer);
}
(GHIDRA_CAST<GameStatePlayer *>((gameState)))->GameStatePlayer::~GameStatePlayer();
ExceptionList = local_10;
return slotValue;
}
LAB_0090c9f0:
if ((((*pendingEntry == 0x29) && (pendingEntry[0xd] == 0x29)) && (pendingEntry[0x1a] == 0x29)) &&
(pendingEntry[0x27] == 0x29)) {
std::map<unsigned_long_long_PeerStreams>::erase(userId);
}
ExceptionList = local_10;
return 0;
}
// 0090d640
void NetplayManager::save_frame_snapshot(byte isResetEntities)
{
NetplayManager *snapshotDeque = this;
NetplayManager *pNVar1;
undefined ***pppuVar2;
uint uVar3;
int iVar4;
int *piVar5;
void *pvVar6;
NetplayManager dequeMap;
NetplayManager NVar7;
qword *allocatedBytes;
EntityList *entityList;
NetplayManager local_94;
int iStack_90;
NetplayManager lowerBoundNode;
EntityList *entityListRef;
undefined4 local_84;
NetplayManager local_80;
NetplayManager *netplay;
undefined4 gameDataWriter;
undefined4 uStack_74;
undefined4 uStack_70;
undefined4 uStack_6c;
undefined4 local_68;
undefined4 uStack_64;
undefined4 uStack_60;
undefined4 uStack_5c;
undefined **stream;
undefined4 local_54;
undefined4 local_50;
undefined4 local_4c;
undefined4 local_48;
undefined4 local_40;
undefined4 uStack_3c;
undefined4 uStack_38;
undefined4 uStack_34;
undefined **local_30 [3];
uint local_24;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined **local_14;
qword allocatedBefore;
NetplayManager *frameNumber;
NetplayManager *snapshotDeque;
undefined8 *snapshotEntry;
puStack_20 = GHIDRA_CAST<undefined1 *>((local_30 + 0xb));
local_14 = GHIDRA_CAST<undefined **>(0xffffffff);
puStack_18 = &LAB_00b09285;
local_1c = ExceptionList;
uVar3 = __security_cookie ^ GHIDRA_UINT((local_30 + 8));
ExceptionList = &local_1c;
entityList = GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218));
entityListRef = entityList;
netplay = snapshotDeque;
local_24 = uVar3;
pppuVar2 = local_30 + 0xb;
if (isResetEntities != 0) {
(GHIDRA_CAST<EntityList *>((entityList)))->EntityList::Reset();
(GHIDRA_CAST<EntityList *>((entityList)))->EntityList::Update(0);
pppuVar2 = GHIDRA_CAST<undefined ***>(puStack_20);
}
puStack_20 = GHIDRA_CAST<undefined1 *>(pppuVar2);
pNVar1 = netplay;
snapshotDeque = netplay + 10;
dequeMap = netplay[0xd];
local_80 = (NetplayManager)(GHIDRA_INT(netplay[0xe]) + GHIDRA_INT(dequeMap));
NVar7 = *snapshotDeque;
while( true ) {
if (dequeMap == local_80) {
(GHIDRA_CAST<KAGE::Filesys::BufferedStream *>((&stream)))->KAGE::Filesys::BufferedStream::BufferedStream(0);
local_14 = GHIDRA_CAST<undefined **>(0x0);
(*(code *)stream[2])(uVar3);
(*(code *)stream[1])(0,0xffffffff);
gameDataWriter = 0;
uStack_74 = 0;
uStack_70 = 0;
uStack_6c = 0;
local_68 = 0;
uStack_64 = 0;
uStack_60 = 0;
uStack_5c = 0;
local_14 = GHIDRA_CAST<undefined **>(0x1);
PersistentGameDataWriter::write
(&gameDataWriter,&g_manager->_persistentGameData,netplay + 0x406);
frameNumber = netplay + 3;
_Find_lower_bound<>(&local_94,frameNumber);
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(lowerBoundNode) + 0xd)) == '\0') &&
(GHIDRA_UINT(*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(lowerBoundNode) + 0x10))) <= GHIDRA_UINT(*frameNumber))) &&
(lowerBoundNode != netplay[0xf])) {
piVar5 = GHIDRA_CAST<int *>(std)::map<unsigned_int_8byte>::try_emplace(&local_84,frameNumber);
if (*GHIDRA_CAST<int *>((*piVar5 + 0x14)) != 0) {
piVar5 = GHIDRA_CAST<int *>(std)::map<unsigned_int_8byte>::try_emplace(&local_84,frameNumber);
iVar4 = *GHIDRA_CAST<int *>((*piVar5 + 0x14));
if (g_mainHeap == (void *)0x0) {
allocatedBytes = &g_allocatedBytesNoHeap;
}
else {
allocatedBytes = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
if (iVar4 != 0) {
uVar3 = *GHIDRA_CAST<uint *>((iVar4 + -4));
allocatedBefore = *allocatedBytes;
*GHIDRA_CAST<uint *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar3;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBefore) < uVar3));
free((void *)(iVar4 + -4));
}
local_14 = GHIDRA_CAST<undefined **>(CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),1));
piVar5 = GHIDRA_CAST<int *>(std)::map<unsigned_int_8byte>::try_emplace(&local_84,frameNumber);
*GHIDRA_CAST<undefined4 *>((*piVar5 + 0x14)) = 0;
}
std::map<unsigned_int_8byte>::erase(frameNumber);
}
local_84 = 0;
local_80 = (NetplayManager)0x0;
pvVar6 = (GHIDRA_CAST<PersistentGameDataWriter *>((&gameDataWriter)))->PersistentGameDataWriter::compress(GHIDRA_CAST<uint *>(&local_80));
piVar5 = GHIDRA_CAST<int *>(std)::map<unsigned_int_8byte>::try_emplace(&iStack_90,netplay + 3);
iVar4 = *piVar5;
*(void **)(iVar4 + 0x14) = pvVar6;
*GHIDRA_CAST<NetplayManager *>((iVar4 + 0x18)) = local_80;
local_80 = (NetplayManager)checksum_stream(local_30,0,0);
dequeMap = pNVar1[0xc];
local_94 = netplay[3];
iStack_90 = entityListRef[1]._updateEL._capacity;
NVar7 = pNVar1[0xe];
if (GHIDRA_UINT(dequeMap) <= GHIDRA_INT(NVar7) + 1U) {
std_deque_growmap(snapshotDeque,GHIDRA_UINT(NVar7));
dequeMap = pNVar1[0xc];
NVar7 = pNVar1[0xe];
}
pNVar1[0xd] = (NetplayManager)(GHIDRA_UINT(pNVar1[0xd]) & GHIDRA_INT(dequeMap) - 1U);
uVar3 = GHIDRA_INT(NVar7) + GHIDRA_INT(pNVar1[0xd]) & GHIDRA_INT(dequeMap) - 1U;
dequeMap = pNVar1[0xb];
iVar4 = uVar3 * 4;
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(dequeMap) + uVar3 * 4)) == 0) {
pvVar6 = operator_new(0xc);
*(void **)(iVar4 + GHIDRA_INT(pNVar1[0xb])) = pvVar6;
dequeMap = pNVar1[0xb];
}
snapshotEntry = *GHIDRA_CAST<undefined8 **>((GHIDRA_CAST<char *>(dequeMap) + iVar4));
*snapshotEntry = CONCAT44(iStack_90,local_94);
*GHIDRA_CAST<NetplayManager *>((snapshotEntry + 1)) = local_80;
pNVar1[0xe] = (NetplayManager)(GHIDRA_INT(pNVar1[0xe]) + 1);
local_30[0] = KAGE::Filesys::StreamBase::vftable;
stream = KAGE::Filesys::BufferedStreamBase::vftable;
local_54 = 0;
local_50 = 0;
local_48 = local_4c;
local_40 = 0;
uStack_3c = 0;
uStack_38 = 0;
uStack_34 = 0;
FUN_007dcd30();
ExceptionList = local_1c;
return;
}
if (NVar7 == (NetplayManager)0x0) {
iVar4 = 0;
}
else {
iVar4 = *GHIDRA_CAST<int *>(NVar7);
}
if (**GHIDRA_CAST<NetplayManager **>((*GHIDRA_CAST<int *>((iVar4 + 4)) + (*GHIDRA_CAST<int *>((iVar4 + 8)) - 1U & GHIDRA_UINT(dequeMap)) * 4))
== netplay[3]) break;
dequeMap = (NetplayManager)(GHIDRA_INT(dequeMap) + 1);
}
iVar4 = entityListRef[1]._updateEL._capacity;
if (NVar7 == (NetplayManager)0x0) {
*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((_DAT_00000004 + (_DAT_00000008 - 1U & GHIDRA_UINT(dequeMap)) * 4)) + 4)) = iVar4;
ExceptionList = local_1c;
return;
}
*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(NVar7) + 4)) +
(*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(NVar7) + 8)) - 1U & GHIDRA_UINT(dequeMap)) * 4)) + 4)) = iVar4;
ExceptionList = local_1c;
return;
}
// 0090d9b0
void NetplayManager::add_new_players()
{
void **ppvVar1;
NetplayManager NVar2;
char cVar3;
byte isLocalUser;
int playerEntry;
undefined ***ownerProfile;
undefined **ppuVar4;
uint uVar5;
undefined **recipient;
undefined4 *puVar6;
void *pvVar7;
void *messageRefCount;
undefined1 auStack_9a [2];
undefined **stream;
undefined **ppuStack_88;
undefined4 uStack_84;
void *pvStack_80;
void *pvStack_7c;
void *pvStack_74;
undefined4 uStack_70;
undefined4 uStack_6c;
undefined4 uStack_68;
undefined **ppuStack_64;
undefined **lobby;
int *lobbyPtr;
int *lobbyRefCount;
undefined4 *newPlayersBegin;
undefined4 *newPlayersEnd;
undefined4 *newPlayersCapacity;
undefined **ppuStack_48;
undefined **ppuStack_44;
NetplayManager NStack_3c;
undefined **ppuStack_38;
undefined **local_34;
NetplayManager *self;
NetplayManager NStack_2c;
undefined **local_28;
char isLobbyOwner;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
uint uStack_14;
Manager *manager;
NetplayManager *netplayManager;
puStack_20 = GHIDRA_CAST<undefined1 *>((GHIDRA_INT(register0x00000010) + -4));
uStack_14 = 0xffffffff;
puStack_18 = &LAB_00b0931f;
local_1c = ExceptionList;
ExceptionList = &local_1c;
local_28 = GHIDRA_CAST<undefined **>(0x0);
local_34 = GHIDRA_CAST<undefined **>(0x0);
if (this[0x61a] != (NetplayManager)0x0) {
self = this;
KAGE_LogMessage(1,GHIDRA_CAST<byte *>("[Frame %d] Adding %d new players\n"));
local_34 = GHIDRA_CAST<undefined **>(0x0);
newPlayersBegin = GHIDRA_CAST<undefined4 *>(0x0);
newPlayersEnd = GHIDRA_CAST<undefined4 *>(0x0);
newPlayersCapacity = GHIDRA_CAST<undefined4 *>(0x0);
uStack_14 = 0;
NStack_3c = (NetplayManager)0x0;
ppuStack_38 = GHIDRA_CAST<undefined **>(0x0);
NStack_3c = (NetplayManager)operator_new(0x30);
netplayManager = self;
*GHIDRA_CAST<NetplayManager *>(NStack_3c) = NStack_3c;
*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(NStack_3c) + 4)) = NStack_3c;
*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(NStack_3c) + 8)) = NStack_3c;
*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(NStack_3c) + 0xc)) = 0x101;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(uStack_14)) + 0x0))) = 1;
NStack_2c = *GHIDRA_CAST<NetplayManager *>(this[0x619]);
if (NStack_2c != this[0x619]) {
do {
NVar2 = NStack_2c;
lobby = KAGE::Network::Multiplayer::ConstLobby::vftable;
lobbyPtr = GHIDRA_CAST<int *>(0x0);
lobbyRefCount = GHIDRA_CAST<int *>(0x0);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(uStack_14)) + 0x0))) = 2;
(GHIDRA_CAST<std::shared_ptr *>((&lobbyPtr)))->std::shared_ptr::assign(&g_multiplayerLobbyPtr);
local_28 = GHIDRA_CAST<undefined **>((GHIDRA_UINT(local_28) | 0xc));
lobby = KAGE::Network::Multiplayer::Lobby::vftable;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(uStack_14)) + 0x0))) = 3;
ppuStack_48 = GHIDRA_CAST<undefined **>(FUN_00a28590());
ppuStack_44 = GHIDRA_CAST<undefined **>((GHIDRA_INT(ppuStack_48) >> 0x1f));
playerEntry = FUN_00913ba0();
*GHIDRA_CAST<undefined4 *>((playerEntry + 4)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(NVar2) + 0x1c));
*GHIDRA_CAST<undefined1 *>((playerEntry + 8)) = *GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(NVar2) + 0x20));
*GHIDRA_CAST<undefined4 *>((playerEntry + 0xc)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(NVar2) + 0x24));
*GHIDRA_CAST<undefined4 *>((playerEntry + 0x10)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(NVar2) + 0x28));
lobby = KAGE::Network::Multiplayer::ConstLobby::vftable;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(uStack_14)) + 0x0))) = 4;
if (((lobbyRefCount != GHIDRA_CAST<int *>(0x0)) &&
(cVar3 = (**(code **)(*lobbyRefCount + 0xc))(), cVar3 != '\0')) &&
(g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)();
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(uStack_14)) + 0x0))) = 1;
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>
*)&NStack_2c);
} while (NStack_2c != netplayManager[0x619]);
}
NStack_2c = *GHIDRA_CAST<NetplayManager *>(NStack_3c);
recipient = GHIDRA_CAST<undefined **>(GHIDRA_CAST<undefined4 *>(0x0));
if (NStack_2c != NStack_3c) {
puVar6 = newPlayersCapacity;
do {
if (newPlayersEnd == puVar6) {
FUN_008ef230();
puVar6 = newPlayersCapacity;
}
else {
*newPlayersEnd = KAGE::System::UserProfileBase::vftable;
newPlayersEnd[1] = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(NStack_2c) + 0x1c));
*newPlayersEnd = KAGE::System::UserProfile::vftable;
*GHIDRA_CAST<undefined1 *>((newPlayersEnd + 2)) = *GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(NStack_2c) + 0x20));
newPlayersEnd[3] = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(NStack_2c) + 0x24));
newPlayersEnd[4] = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(NStack_2c) + 0x28));
newPlayersEnd = newPlayersEnd + 5;
}
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>
*)&NStack_2c);
} while (NStack_2c != NStack_3c);
local_34 = GHIDRA_CAST<undefined **>(newPlayersBegin);
recipient = GHIDRA_CAST<undefined **>(newPlayersBegin);
}
uStack_14 = (*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(uStack_14))) + 0x1))) << 8;
FUN_00914d90();
operator_delete((void *)NStack_3c,0x30);
manager = g_manager;
if (recipient != GHIDRA_CAST<undefined **>(newPlayersEnd)) {
do {
puVar6 = (manager->_lobbyMembers)._end;
if (puVar6 == (manager->_lobbyMembers)._capacity) {
FUN_008ef230();
}
else {
*puVar6 = KAGE::System::UserProfileBase::vftable;
puVar6[1] = recipient[1];
*puVar6 = KAGE::System::UserProfile::vftable;
*GHIDRA_CAST<undefined1 *>((puVar6 + 2)) = *GHIDRA_CAST<undefined1 *>((recipient + 2));
puVar6[3] = recipient[3];
puVar6[4] = recipient[4];
ppvVar1 = &(manager->_lobbyMembers)._end;
*ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + 0x14);
}
recipient = recipient + 5;
} while (recipient != GHIDRA_CAST<undefined **>(newPlayersEnd));
recipient = local_34;
}
lobby = KAGE::Network::Multiplayer::ConstLobby::vftable;
lobbyPtr = GHIDRA_CAST<int *>(0x0);
lobbyRefCount = GHIDRA_CAST<int *>(0x0);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(uStack_14)) + 0x0))) = 5;
(GHIDRA_CAST<std::shared_ptr *>((&lobbyPtr)))->std::shared_ptr::assign(&g_multiplayerLobbyPtr);
ppuVar4 = local_28;
lobby = KAGE::Network::Multiplayer::Lobby::vftable;
uStack_14 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(uStack_14)) + 0x1))),6);
local_28 = GHIDRA_CAST<undefined **>((GHIDRA_UINT(local_28) | 0x31));
local_34 = local_28;
if (lobbyPtr == GHIDRA_CAST<int *>(0x0)) {
ppuStack_44 = GHIDRA_CAST<undefined **>(0x0);
ownerProfile = &ppuStack_48;
ppuStack_48 = KAGE::System::UserProfile::vftable;
uVar5 = GHIDRA_UINT(ppuVar4) | 0xb1;
}
else {
ownerProfile = GHIDRA_CAST<undefined ***>((**(code **)(*lobbyPtr + 0x20))());
uVar5 = GHIDRA_UINT(local_28) | 0x40;
}
NStack_3c = (NetplayManager)KAGE::System::UserProfileBase::vftable;
ppuStack_38 = ownerProfile[1];
NStack_3c = (NetplayManager)KAGE::System::UserProfile::vftable;
if ((char)uVar5 < '\0') {
uVar5 = uVar5 & 0xffffff7f;
}
if ((uVar5 & 0x40) != 0) {
uVar5 = uVar5 & 0xffffffbf;
ppuStack_48 = KAGE::System::UserProfileBase::vftable;
}
local_34 = GHIDRA_CAST<undefined **>((uVar5 | 0x102));
uStack_14 = 7;
local_28 = local_34;
isLocalUser = (GHIDRA_CAST<KAGE::System::UserProfile *>((&NStack_3c)))->KAGE::System::UserProfile::is_local_user();
if ((isLocalUser == 0) || (isLobbyOwner = '\x01', self[0x41d] == (NetplayManager)0x0)) {
isLobbyOwner = '\0';
}
ppuVar4 = local_28;
if ((GHIDRA_UINT(local_28) & 2) != 0) {
ppuVar4 = GHIDRA_CAST<undefined **>((GHIDRA_UINT(local_28) & 0xfffffffd));
NStack_3c = (NetplayManager)KAGE::System::UserProfileBase::vftable;
}
uStack_14 = 0;
if ((GHIDRA_UINT(ppuVar4) & 1) != 0) {
lobby = KAGE::Network::Multiplayer::ConstLobby::vftable;
uStack_14 = 8;
if (((lobbyRefCount != GHIDRA_CAST<int *>(0x0)) &&
(cVar3 = (**(code **)(*lobbyRefCount + 0xc))(), cVar3 != '\0')) &&
(g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)();
}
uStack_14 = uStack_14 & 0xffffff00;
}
if (isLobbyOwner != '\0') {
(GHIDRA_CAST<KAGE::Filesys::BufferedStream *>((&stream)))->KAGE::Filesys::BufferedStream::BufferedStream(0);
uStack_14 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(uStack_14)) + 0x1))),9);
write_player_game_states_message();
local_34 = ppuStack_88;
pvVar7 = pvStack_80;
if (pvStack_74 != (void *)0x0) {
pvVar7 = pvStack_74;
}
if (g_multiplayerService == (void *)0x0) {
KAGE_LogMessage(0x10,(byte *)
"Attempting to create a message when there is no multiplayer service\n"
);
}
NetConnection::send_message(g_multiplayerService,&ppuStack_48,1,pvVar7,GHIDRA_UINT(local_34),0);
puVar6 = newPlayersEnd;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(uStack_14)) + 0x0))) = 10;
for (; recipient != GHIDRA_CAST<undefined **>(puVar6); recipient = recipient + 5) {
NStack_2c = (NetplayManager)(GHIDRA_INT(auStack_9a) + -10);
pvVar7 = (void *)0x0;
messageRefCount = (void *)0x0;
local_34 = ppuStack_44;
NVar2 = (NetplayManager)(GHIDRA_INT(auStack_9a) + -10);
local_28 = ppuStack_48;
if (ppuStack_44 != GHIDRA_CAST<undefined **>(0x0)) {
cVar3 = (**(code **)(*ppuStack_44 + 4))();
NVar2 = NStack_2c;
if (cVar3 != '\0') {
if (((*GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(NStack_2c) + 4)) != GHIDRA_CAST<int *>(0x0)) &&
(cVar3 = (**(code **)(**GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(NStack_2c) + 4)) + 0xc))(), cVar3 != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)(NStack_2c);
}
*GHIDRA_CAST<undefined ***>((GHIDRA_CAST<char *>(NStack_2c) + 4)) = local_34;
*GHIDRA_CAST<undefined ***>(NStack_2c) = local_28;
NVar2 = NStack_2c;
}
}
NStack_2c = NVar2;
multiplayer_send_message(recipient,pvVar7,messageRefCount);
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(uStack_14)) + 0x0))) = 0xb;
if (((ppuStack_44 != GHIDRA_CAST<undefined **>(0x0)) &&
(cVar3 = (**(code **)(*ppuStack_44 + 0xc))(), cVar3 != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)();
}
uStack_14 = (*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(uStack_14))) + 0x1))) << 8;
ppuStack_64 = KAGE::Filesys::StreamBase::vftable;
stream = KAGE::Filesys::BufferedStreamBase::vftable;
ppuStack_88 = GHIDRA_CAST<undefined **>(0x0);
uStack_84 = 0;
pvStack_7c = pvStack_80;
pvStack_74 = (void *)0x0;
uStack_70 = 0;
uStack_6c = 0;
uStack_68 = 0;
FUN_007dcd30();
}
(GHIDRA_CAST<Game *>((g_game)))->Game::add_players(GHIDRA_CAST<int *>(&newPlayersBegin),4);
netplayManager = self;
NVar2 = self[0x619];
FUN_00914d90();
*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(NVar2) + 4)) = NVar2;
*GHIDRA_CAST<NetplayManager *>(NVar2) = NVar2;
*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(NVar2) + 8)) = NVar2;
netplayManager[0x61a] = (NetplayManager)0x0;
puVar6 = newPlayersBegin;
if (newPlayersBegin != GHIDRA_CAST<undefined4 *>(0x0)) {
for (; puVar6 != newPlayersEnd; puVar6 = puVar6 + 5) {
*puVar6 = KAGE::System::UserProfileBase::vftable;
}
uVar5 = ((GHIDRA_INT(newPlayersCapacity) - GHIDRA_INT(newPlayersBegin)) / 0x14) * 0x14;
puVar6 = newPlayersBegin;
if (0xfff < uVar5) {
puVar6 = GHIDRA_CAST<undefined4 *>(newPlayersBegin[-1]);
uVar5 = uVar5 + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(newPlayersBegin) + (-4 - GHIDRA_INT(puVar6))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(puVar6,uVar5);
}
}
ExceptionList = local_1c;
return;
}
// 0090df40
void NetplayManager::process_pending_joins(byte isForce)
{
char cVar1;
uint uVar2;
int iVar3;
void *pvVar4;
undefined3 in_stack_00000005;
void *message;
void *messageRefCount;
undefined1 stream [4];
void *pvStack_b8;
void *pvStack_b0;
void *pvStack_a4;
undefined **ppuStack_90;
int *piStack_8c;
undefined **ownerProfile;
void *pvStack_84;
byte isLobbyOwner;
undefined1 gameDataWriter [80];
void *challengeString [3];
undefined **lobby;
int *piStack_1c;
int *piStack_18;
uint local_14;
void *local_10;
undefined1 *puStack_c;
void *pvStack_8;
pvStack_8 = (void *)0xffffffff;
puStack_c = &LAB_00b0938e;
local_10 = ExceptionList;
uVar2 = __security_cookie ^ GHIDRA_UINT((challengeString + 10));
ExceptionList = &local_10;
if ((this[0x61a] != (NetplayManager)0x0) || (isForce != 0)) {
local_14 = uVar2;
KAGE_LogMessage(1,GHIDRA_CAST<byte *>("[Frame %d] Processing pending joins \n"));
if (isForce != 0) {
reset(this,0);
}
add_new_players(this,uVar2);
lobby = KAGE::Network::Multiplayer::ConstLobby::vftable;
piStack_1c = GHIDRA_CAST<int *>(0x0);
piStack_18 = GHIDRA_CAST<int *>(0x0);
pvStack_8 = (void *)0x0;
(GHIDRA_CAST<std::shared_ptr *>((&piStack_1c)))->std::shared_ptr::assign(&g_multiplayerLobbyPtr);
lobby = KAGE::Network::Multiplayer::Lobby::vftable;
pvStack_8 = (void *)0x1;
if (piStack_1c == GHIDRA_CAST<int *>(0x0)) {
pvStack_84 = (void *)0x0;
}
else {
iVar3 = (**(code **)(*piStack_1c + 0x20))(&ppuStack_90);
pvStack_84 = *(void **)(iVar3 + 4);
ppuStack_90 = KAGE::System::UserProfileBase::vftable;
}
ownerProfile = KAGE::System::UserProfile::vftable;
pvStack_8 = (void *)CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(pvStack_8)) + 0x1))),2);
isLobbyOwner = (GHIDRA_CAST<KAGE::System::UserProfile *>((&ownerProfile)))->KAGE::System::UserProfile::is_local_user();
ownerProfile = KAGE::System::UserProfileBase::vftable;
lobby = KAGE::Network::Multiplayer::ConstLobby::vftable;
pvStack_8 = (void *)0x3;
if (piStack_18 != GHIDRA_CAST<int *>(0x0)) {
cVar1 = (**(code **)(*piStack_18 + 0xc))();
if ((cVar1 != '\0') && (g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)(&piStack_1c);
}
}
pvStack_8 = (void *)0xffffffff;
if (isLobbyOwner != 0) {
(GHIDRA_CAST<KAGE::Filesys::BufferedStream *>((stream)))->KAGE::Filesys::BufferedStream::BufferedStream(0);
pvStack_8 = (void *)0x4;
if (isForce == 0) {
FUN_009193b0();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(pvStack_8)) + 0x0))) = 6;
(GHIDRA_CAST<PersistentGameDataWriter *>((gameDataWriter)))->PersistentGameDataWriter::write(&g_manager->_persistentGameData,this + 0x406)
;
piStack_18 = GHIDRA_CAST<int *>(0xf);
piStack_1c = GHIDRA_CAST<int *>(0x0);
challengeString[0] = (void *)0x0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(pvStack_8)) + 0x0))) = 7;
FUN_00916f70(g_game->_challenge,challengeString,gameDataWriter,0);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(pvStack_8)) + 0x0))) = 6;
if (0xf < piStack_18) {
uVar2 = GHIDRA_INT(piStack_18) + 1;
pvVar4 = challengeString[0];
if (0xfff < uVar2) {
pvVar4 = *(void **)(GHIDRA_INT(challengeString[0]) + -4);
uVar2 = GHIDRA_INT(piStack_18) + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(challengeString[0]) + (-4 - GHIDRA_INT(pvVar4))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar4,uVar2);
}
pvStack_8 = (void *)CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(pvStack_8)) + 0x1))),4);
FUN_00a58200();
}
else {
piStack_18 = GHIDRA_CAST<int *>(0xf);
piStack_1c = GHIDRA_CAST<int *>(0x0);
challengeString[0] = (void *)0x0;
pvStack_8 = (void *)0x5;
FUN_00916f70(g_game->_challenge,challengeString,this + 0x406,_isForce);
pvStack_8 = (void *)CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(pvStack_8)) + 0x1))),4);
if (0xf < piStack_18) {
uVar2 = GHIDRA_INT(piStack_18) + 1;
pvVar4 = challengeString[0];
if (0xfff < uVar2) {
pvVar4 = *(void **)(GHIDRA_INT(challengeString[0]) + -4);
uVar2 = GHIDRA_INT(piStack_18) + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(challengeString[0]) + (-4 - GHIDRA_INT(pvVar4))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar4,uVar2);
}
}
pvStack_84 = pvStack_b8;
pvVar4 = pvStack_b0;
if (pvStack_a4 != (void *)0x0) {
pvVar4 = pvStack_a4;
}
if (g_multiplayerService == (void *)0x0) {
KAGE_LogMessage(0x10,(byte *)
"Attempting to create a message when there is no multiplayer service\n"
);
}
messageRefCount = (void *)0x0;
message = pvStack_84;
NetConnection::send_message(g_multiplayerService,&ppuStack_90,1,pvVar4,GHIDRA_UINT(pvStack_84),0);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(pvStack_8)) + 0x0))) = 8;
FUN_008ef1d0(&ppuStack_90);
send_message(this,0x1c,message,messageRefCount);
pvStack_8 = (void *)CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(pvStack_8)) + 0x1))),9);
if (piStack_8c != GHIDRA_CAST<int *>(0x0)) {
cVar1 = (**(code **)(*piStack_8c + 0xc))();
if ((cVar1 != '\0') && (g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)(&ppuStack_90);
}
}
FUN_00a58200();
}
}
ExceptionList = local_10;
return;
}
// 0090e6d0
byte NetplayManager::check_connection()
{
undefined1 *puVar1;
char isConnected;
NetplayManager popupId;
undefined1 local_d0 [168];
Vector popupPos;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
puStack_20 = local_d0 + 0xcc;
local_14 = 0xffffffff;
puStack_18 = &LAB_00b093d0;
local_1c = ExceptionList;
ExceptionList = &local_1c;
puVar1 = local_d0 + 0xcc;
if ((g_multiplayerService != (void *)0x0) &&
(isConnected = (**(code **)(*GHIDRA_CAST<int *>(g_multiplayerService) + 0x10))
(__security_cookie ^ GHIDRA_UINT((local_d0 + 0xc0))), puVar1 = puStack_20,
isConnected != '\0')) {
ExceptionList = local_1c;
return 1;
}
puStack_20 = puVar1;
if (this[0x16] == (NetplayManager)0xffffffff) {
popupPos.x = (float)&DAT_bf800000;
popupPos.y = (float)&DAT_bf800000;
MessagePopup::MessagePopup
(local_d0,&g_manager->_font2_TeamMeatEx12,netplay_lost_connection_callback,this,
&popupPos);
local_14 = 0;
MessagePopup::add_ok_button(GHIDRA_CAST<byte *>("##PLATFORM###LOST_CONNECTION_TO_SERVER"),local_d0);
popupId = (NetplayManager)(GHIDRA_CAST<PopupQueue *>((&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(g_manager[1]._gamestate)) + 0xcf0))))))->PopupQueue::push(local_d0);
this[0x16] = popupId;
FUN_00420710();
ExceptionList = local_1c;
return 0;
}
ExceptionList = local_1c;
return 1;
}
// 0090eca0
void NetplayManager::send_message(uint flags, void *message, void *messageRefCount)
{
byte bVar1;
char cVar2;
undefined4 uVar3;
byte *sentFlag;
undefined4 uVar4;
NetplayManager peerNode;
void *pvVar5;
uint memberIdHigh;
longlong localUserId;
undefined1 auStackY_138 [128];
void *pvVar6;
int *piVar7;
NetplayManager *pNVar8;
void *foundIt;
undefined **local_90;
undefined4 local_8c;
int *memberLobbyRefCount;
undefined **local_84;
int lobbyImpl;
int *lobbyRefCount;
undefined8 idKey;
void *peerIdLow;
NetplayManager *peerIdHigh;
NetplayManager *userIdLow;
uint userIdHigh;
int local_60;
int *peerRefCount;
undefined **local_58;
int local_54;
void *sentIds;
undefined4 local_48;
NetplayManager *local_44;
undefined8 local_40;
undefined4 local_38;
NetplayManager *pNStack_34;
void *local_2c;
NetplayManager *cleanupFlags;
char isRecipient;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
int userImpl;
puStack_20 = GHIDRA_CAST<undefined1 *>((GHIDRA_INT(register0x00000010) + -4));
puStack_18 = &LAB_00b09533;
local_1c = ExceptionList;
ExceptionList = &local_1c;
cleanupFlags = GHIDRA_CAST<NetplayManager *>(0x0);
pNStack_34 = GHIDRA_CAST<NetplayManager *>(0x0);
local_14 = 0;
local_44 = this;
if ((flags & 1) == 0) {
sentIds = (void *)0x0;
local_48 = 0;
sentIds = operator_new(0x20);
*(void **)sentIds = sentIds;
*(void **)(GHIDRA_CAST<char *>(sentIds) + 4) = sentIds;
*(void **)(GHIDRA_CAST<char *>(sentIds) + 8) = sentIds;
*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(sentIds) + 0xc)) = 0x101;
if ((flags & 2) != 0) {
local_2c = (void *)0x0;
pNVar8 = GHIDRA_CAST<NetplayManager *>(0x0);
while( true ) {
local_84 = KAGE::Network::Multiplayer::ConstLobby::vftable;
lobbyImpl = 0;
lobbyRefCount = GHIDRA_CAST<int *>(0x0);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
(GHIDRA_CAST<std::shared_ptr *>((&lobbyImpl)))->std::shared_ptr::assign(&g_multiplayerLobbyPtr);
cleanupFlags = GHIDRA_CAST<NetplayManager *>((GHIDRA_UINT(pNVar8) | 0x18));
if (lobbyImpl == 0) {
pvVar5 = (void *)0x0;
}
else {
pvVar5 = (void *)(*GHIDRA_CAST<int *>((lobbyImpl + 0x14)) - *GHIDRA_CAST<int *>((lobbyImpl + 0x10)) >> 3);
}
local_84 = KAGE::Network::Multiplayer::ConstLobby::vftable;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 3;
if (((lobbyRefCount != GHIDRA_CAST<int *>(0x0)) &&
(cVar2 = (**(code **)(*lobbyRefCount + 0xc))(), cVar2 != '\0')) &&
(g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)();
}
if (pvVar5 <= local_2c) break;
local_90 = KAGE::Network::Multiplayer::ConstLobby::vftable;
local_8c = 0;
memberLobbyRefCount = GHIDRA_CAST<int *>(0x0);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 4;
(GHIDRA_CAST<std::shared_ptr *>((&local_8c)))->std::shared_ptr::assign(&g_multiplayerLobbyPtr);
cleanupFlags = GHIDRA_CAST<NetplayManager *>((GHIDRA_UINT(pNVar8) | 0x78));
local_90 = KAGE::Network::Multiplayer::Lobby::vftable;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 5;
(GHIDRA_CAST<KAGE::Network::Multiplayer::Lobby *>((&local_90)))->KAGE::Network::Multiplayer::Lobby::get_member(&local_58,GHIDRA_UINT(local_2c));
local_90 = KAGE::Network::Multiplayer::ConstLobby::vftable;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 8;
if (((memberLobbyRefCount != GHIDRA_CAST<int *>(0x0)) &&
(cVar2 = (**(code **)(*memberLobbyRefCount + 0xc))(), cVar2 != '\0')) &&
(g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)();
}
local_14 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),7);
pvVar5 = (g_manager->_lobbyMembers)._begin;
pvVar6 = (g_manager->_lobbyMembers)._end;
local_40 = CONCAT44(pvVar6,GHIDRA_CAST<NetplayManager *>(local_40));
if (pvVar5 != pvVar6) {
do {
userImpl = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar5) + 4));
if (userImpl == 0) {
pNStack_34 = GHIDRA_CAST<NetplayManager *>(0x0);
pNVar8 = pNStack_34;
local_38 = 0;
pNStack_34 = GHIDRA_CAST<NetplayManager *>(0x0);
}
else {
pNStack_34 = *GHIDRA_CAST<NetplayManager **>((userImpl + 8));
pNVar8 = *GHIDRA_CAST<NetplayManager **>((userImpl + 0xc));
}
localUserId = FUN_00a23920();
if (localUserId == CONCAT44(pNVar8,pNStack_34)) goto LAB_0090ef7c;
pvVar5 = (void *)(GHIDRA_INT(pvVar5) + 0x14);
} while ((NetplayManager)pvVar5 != (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_40)) + 0x4))));
}
userImpl = local_54;
if (local_54 == 0) {
local_40 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_40)) + 0x4))) = (NetplayManager)0x0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_40)) + 0x0))) = GHIDRA_CAST<NetplayManager *>(0x0);
userIdLow = GHIDRA_CAST<NetplayManager *>(local_40);
memberIdHigh = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(local_40))) + 0x4)));
}
else {
userIdLow = *GHIDRA_CAST<NetplayManager **>((local_54 + 8));
memberIdHigh = *GHIDRA_CAST<uint *>((local_54 + 0xc));
}
userIdHigh = memberIdHigh;
pNStack_34 = userIdLow;
FUN_00731ee0();
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(foundIt) + 0xd)) == '\0') &&
(*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(foundIt) + 0x14)) <= memberIdHigh)) &&
(((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(foundIt) + 0x14)) < memberIdHigh ||
(*GHIDRA_CAST<NetplayManager **>((GHIDRA_CAST<char *>(foundIt) + 0x10)) <= pNStack_34)) && (foundIt != sentIds)))) {
LAB_0090ef7c:
isRecipient = '\0';
}
else {
if (g_multiplayerService == (void *)0x0) {
KAGE::SmartPointer<ConnectionBase>::SmartPointer();
}
else {
if (userImpl == 0) {
local_40 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_40)) + 0x4))) = (NetplayManager)0x0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_40)) + 0x0))) = (void *)0x0;
peerIdLow = GHIDRA_CAST<NetplayManager *>(local_40);
peerIdHigh = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<NetplayManager *>(local_40))) + 0x4)));
}
else {
peerIdLow = *(void **)(userImpl + 8);
peerIdHigh = *GHIDRA_CAST<NetplayManager **>((userImpl + 0xc));
}
(GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::get_peer(&local_60,GHIDRA_CAST<ulonglong *>(&peerIdLow));
}
local_14 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),9);
cleanupFlags = GHIDRA_CAST<NetplayManager *>((GHIDRA_UINT(cleanupFlags) | 0x81));
pNStack_34 = cleanupFlags;
if ((local_60 == 0) &&
((bVar1 = (GHIDRA_CAST<KAGE::System::UserProfile *>((&local_58)))->KAGE::System::UserProfile::is_local_user(), bVar1 == 0 ||
((flags & 0x10) == 0)))) goto LAB_0090ef7c;
isRecipient = '\x01';
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))) = 0;
if ((GHIDRA_UINT(cleanupFlags) & 1) != 0) {
cleanupFlags = GHIDRA_CAST<NetplayManager *>((GHIDRA_UINT(cleanupFlags) & 0xfffffffe));
local_14 = 10;
if (((peerRefCount != GHIDRA_CAST<int *>(0x0)) &&
(cVar2 = (**(code **)(*peerRefCount + 0xc))(), cVar2 != '\0')) &&
(g_connectionReleaseFn != (void *)0x0)) {
(*g_connectionReleaseFn)();
}
}
pvVar5 = messageRefCount;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 7;
if (isRecipient != '\0') {
pvVar6 = (void *)0x0;
piVar7 = GHIDRA_CAST<int *>(0x0);
local_40 = CONCAT44(message,GHIDRA_CAST<NetplayManager *>(local_40));
if ((messageRefCount != (void *)0x0) &&
(cVar2 = (**(code **)(*GHIDRA_CAST<int *>(messageRefCount) + 4))(), cVar2 != '\0')) {
if ((piVar7 != GHIDRA_CAST<int *>(0x0)) &&
((cVar2 = (**(code **)(*piVar7 + 0xc))(), cVar2 != '\0' &&
(g_multiplayerRelease != (void *)0x0)))) {
(*g_multiplayerRelease)(auStackY_138 + 0x84);
}
pvVar6 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)local_40)) + 0x4)));
piVar7 = pvVar5;
}
multiplayer_send_message(&local_58,pvVar6,piVar7);
if (local_54 == 0) {
local_40 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_40)) + 0x4))) = (NetplayManager)0x0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_40)) + 0x0))) = GHIDRA_CAST<NetplayManager *>(0x0);
uVar3 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_40)) + 0x4)));
uVar4 = GHIDRA_CAST<NetplayManager *>(local_40);
}
else {
uVar3 = *GHIDRA_CAST<undefined4 *>((local_54 + 0xc));
uVar4 = *GHIDRA_CAST<undefined4 *>((local_54 + 8));
}
idKey = CONCAT44(uVar3,uVar4);
sentFlag = map_u64_bool_subscript(&sentIds,&idKey);
*sentFlag = 1;
}
local_2c = (void *)(GHIDRA_INT(local_2c) + 1);
local_58 = KAGE::System::UserProfileBase::vftable;
pNVar8 = cleanupFlags;
}
this = local_44;
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 1;
if ((flags & 4) != 0) {
peerNode = *GHIDRA_CAST<NetplayManager *>(this[0x619]);
local_40 = CONCAT44(peerNode,GHIDRA_CAST<NetplayManager *>(local_40));
if (peerNode != this[0x619]) {
do {
userImpl = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(peerNode) + 0x1c));
if (userImpl == 0) {
idKey = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(idKey)) + 0x4))) = GHIDRA_CAST<NetplayManager *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(idKey)) + 0x0))) = (void *)0x0;
peerIdHigh = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(idKey)) + 0x4)));
peerIdLow = GHIDRA_CAST<NetplayManager *>(idKey);
}
else {
peerIdHigh = *GHIDRA_CAST<NetplayManager **>((userImpl + 0xc));
peerIdLow = *(void **)(userImpl + 8);
}
local_2c = peerIdLow;
pNStack_34 = peerIdHigh;
FUN_00731ee0();
if ((((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(foundIt) + 0xd)) == '\0') &&
(*GHIDRA_CAST<NetplayManager **>((GHIDRA_CAST<char *>(foundIt) + 0x14)) <= pNStack_34)) &&
((*GHIDRA_CAST<NetplayManager **>((GHIDRA_CAST<char *>(foundIt) + 0x14)) < pNStack_34 ||
(*(void **)(GHIDRA_CAST<char *>(foundIt) + 0x10) <= local_2c)))) && (foundIt != sentIds)) {
LAB_0090f165:
isRecipient = '\0';
}
else {
if (g_multiplayerService == (void *)0x0) {
KAGE::SmartPointer<ConnectionBase>::SmartPointer();
}
else {
if (userImpl == 0) {
idKey = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(idKey)) + 0x4))) = GHIDRA_CAST<NetplayManager *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(idKey)) + 0x0))) = GHIDRA_CAST<NetplayManager *>(0x0);
userIdLow = GHIDRA_CAST<NetplayManager *>(idKey);
userIdHigh = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(idKey))) + 0x4)));
}
else {
userIdLow = *GHIDRA_CAST<NetplayManager **>((userImpl + 8));
userIdHigh = *GHIDRA_CAST<uint *>((userImpl + 0xc));
}
(GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::get_peer(&local_60,GHIDRA_CAST<ulonglong *>(&userIdLow));
}
local_14 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),0xb);
cleanupFlags = GHIDRA_CAST<NetplayManager *>((GHIDRA_UINT(cleanupFlags) | 0x102));
pNStack_34 = cleanupFlags;
if ((local_60 == 0) &&
((cVar2 = (**(code **)(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(peerNode) + 0x18)) + 0x14))(), cVar2 == '\0' ||
((flags & 0x10) == 0)))) goto LAB_0090f165;
isRecipient = '\x01';
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))) = 0;
if ((GHIDRA_UINT(cleanupFlags) & 2) != 0) {
cleanupFlags = GHIDRA_CAST<NetplayManager *>((GHIDRA_UINT(cleanupFlags) & 0xfffffffd));
local_14 = 0xc;
if (((peerRefCount != GHIDRA_CAST<int *>(0x0)) &&
(cVar2 = (**(code **)(*peerRefCount + 0xc))(), cVar2 != '\0')) &&
(g_connectionReleaseFn != (void *)0x0)) {
(*g_connectionReleaseFn)();
}
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 1;
if (isRecipient != '\0') {
pvVar5 = (void *)0x0;
pNVar8 = GHIDRA_CAST<NetplayManager *>(0x0);
pNStack_34 = messageRefCount;
local_2c = message;
if ((messageRefCount != (void *)0x0) &&
(cVar2 = (**(code **)(*GHIDRA_CAST<int *>(messageRefCount) + 4))(), cVar2 != '\0')) {
if ((pNVar8 != GHIDRA_CAST<NetplayManager *>(0x0)) &&
((cVar2 = (**(code **)(GHIDRA_INT(*pNVar8) + 0xc))(), cVar2 != '\0' &&
(g_multiplayerRelease != (void *)0x0)))) {
(*g_multiplayerRelease)(auStackY_138 + 0x84);
}
pvVar5 = local_2c;
pNVar8 = pNStack_34;
}
multiplayer_send_message((void *)(GHIDRA_INT(peerNode) + 0x18),pvVar5,pNVar8);
userImpl = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(peerNode) + 0x1c));
if (userImpl == 0) {
idKey = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(idKey)) + 0x4))) = GHIDRA_CAST<NetplayManager *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(idKey)) + 0x0))) = GHIDRA_CAST<NetplayManager *>(0x0);
local_54 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(idKey))) + 0x4)));
local_58 = GHIDRA_CAST<undefined **>(GHIDRA_CAST<NetplayManager *>(idKey));
}
else {
local_54 = *GHIDRA_CAST<int *>((userImpl + 0xc));
local_58 = *GHIDRA_CAST<undefined ***>((userImpl + 8));
}
sentFlag = map_u64_bool_subscript(&sentIds,GHIDRA_CAST<ulonglong *>(&local_58));
*sentFlag = 1;
}
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>
*)(GHIDRA_INT(&local_40) + 4));
peerNode = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_40)) + 0x4)));
} while ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_40)) + 0x4))) != local_44[0x619]);
}
}
if (((flags & 8) != 0) &&
(piVar7 = (g_manager->_lobbyMembers)._begin, piVar7 != (g_manager->_lobbyMembers)._end)) {
do {
userImpl = piVar7[1];
if (userImpl == 0) {
idKey = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(idKey)) + 0x4))) = GHIDRA_CAST<NetplayManager *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(idKey)) + 0x0))) = (void *)0x0;
peerIdHigh = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(idKey)) + 0x4)));
peerIdLow = GHIDRA_CAST<NetplayManager *>(idKey);
}
else {
peerIdHigh = *GHIDRA_CAST<NetplayManager **>((userImpl + 0xc));
peerIdLow = *(void **)(userImpl + 8);
}
local_40 = CONCAT44(peerIdLow,GHIDRA_CAST<NetplayManager *>(local_40));
local_44 = peerIdHigh;
FUN_00731ee0();
if ((((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(foundIt) + 0xd)) == '\0') &&
(*GHIDRA_CAST<NetplayManager **>((GHIDRA_CAST<char *>(foundIt) + 0x14)) <= local_44)) &&
((*GHIDRA_CAST<NetplayManager **>((GHIDRA_CAST<char *>(foundIt) + 0x14)) < local_44 ||
(*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(foundIt) + 0x10)) <= (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(local_40))) + 0x4))))))) && (foundIt != sentIds)) {
LAB_0090f35f:
isRecipient = '\0';
}
else {
if (g_multiplayerService == (void *)0x0) {
KAGE::SmartPointer<ConnectionBase>::SmartPointer();
}
else {
if (userImpl == 0) {
idKey = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(idKey)) + 0x4))) = GHIDRA_CAST<NetplayManager *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(idKey)) + 0x0))) = GHIDRA_CAST<NetplayManager *>(0x0);
userIdLow = GHIDRA_CAST<NetplayManager *>(idKey);
userIdHigh = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(idKey))) + 0x4)));
}
else {
userIdLow = *GHIDRA_CAST<NetplayManager **>((userImpl + 8));
userIdHigh = *GHIDRA_CAST<uint *>((userImpl + 0xc));
}
(GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::get_peer(&local_60,GHIDRA_CAST<ulonglong *>(&userIdLow));
}
local_14 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),0xd);
cleanupFlags = GHIDRA_CAST<NetplayManager *>((GHIDRA_UINT(cleanupFlags) | 0x204));
pNStack_34 = cleanupFlags;
if ((local_60 == 0) &&
((cVar2 = (**(code **)(*piVar7 + 0x14))(), cVar2 == '\0' || ((flags & 0x10) == 0))))
goto LAB_0090f35f;
isRecipient = '\x01';
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))) = 0;
if ((GHIDRA_UINT(cleanupFlags) & 4) != 0) {
cleanupFlags = GHIDRA_CAST<NetplayManager *>((GHIDRA_UINT(cleanupFlags) & 0xfffffffb));
local_14 = 0xe;
if (((peerRefCount != GHIDRA_CAST<int *>(0x0)) &&
(cVar2 = (**(code **)(*peerRefCount + 0xc))(), cVar2 != '\0')) &&
(g_connectionReleaseFn != (void *)0x0)) {
(*g_connectionReleaseFn)();
}
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 1;
if (isRecipient != '\0') {
pvVar5 = (void *)0x0;
pNVar8 = GHIDRA_CAST<NetplayManager *>(0x0);
local_44 = messageRefCount;
local_40 = CONCAT44(message,GHIDRA_CAST<NetplayManager *>(local_40));
if ((messageRefCount != (void *)0x0) &&
(cVar2 = (**(code **)(*GHIDRA_CAST<int *>(messageRefCount) + 4))(), cVar2 != '\0')) {
if ((pNVar8 != GHIDRA_CAST<NetplayManager *>(0x0)) &&
((cVar2 = (**(code **)(GHIDRA_INT(*pNVar8) + 0xc))(), cVar2 != '\0' &&
(g_multiplayerRelease != (void *)0x0)))) {
(*g_multiplayerRelease)(auStackY_138 + 0x84);
}
pvVar5 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)local_40)) + 0x4)));
pNVar8 = local_44;
}
multiplayer_send_message(piVar7,pvVar5,pNVar8);
userImpl = piVar7[1];
if (userImpl == 0) {
idKey = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(idKey)) + 0x4))) = GHIDRA_CAST<NetplayManager *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(idKey)) + 0x0))) = GHIDRA_CAST<NetplayManager *>(0x0);
local_54 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(idKey))) + 0x4)));
local_58 = GHIDRA_CAST<undefined **>(GHIDRA_CAST<NetplayManager *>(idKey));
}
else {
local_54 = *GHIDRA_CAST<int *>((userImpl + 0xc));
local_58 = *GHIDRA_CAST<undefined ***>((userImpl + 8));
}
sentFlag = map_u64_bool_subscript(&sentIds,GHIDRA_CAST<ulonglong *>(&local_58));
*sentFlag = 1;
}
piVar7 = piVar7 + 5;
} while (piVar7 != (g_manager->_lobbyMembers)._end);
}
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(&sentIds,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)&sentIds,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(sentIds) + 4));
operator_delete(sentIds,0x20);
}
else {
puStack_20 = GHIDRA_CAST<undefined1 *>((GHIDRA_INT(register0x00000010) + -4));
FUN_008ef1d0(&message);
FUN_00a29a40((byte)(flags >> 4) & 1);
}
local_14 = 0xf;
if (((messageRefCount != (void *)0x0) &&
(cVar2 = (**(code **)(*GHIDRA_CAST<int *>(messageRefCount) + 0xc))(), cVar2 != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)();
}
ExceptionList = local_1c;
return;
}
// 0090f760
void NetplayManager::process_drop_player_message()
{
NetplayManager *dropEntry = this;
char cVar1;
byte bVar2;
uint uVar3;
int *piVar4;
ulonglong *dropEntry;
int extraout_EAX;
undefined4 uVar5;
int extraout_EAX_00;
int extraout_EAX_01;
int extraout_EAX_02;
int extraout_EAX_03;
byte *profileName;
undefined4 *puVar6;
int extraout_EAX_04;
int extraout_EAX_05;
int extraout_EAX_06;
int extraout_EAX_07;
int extraout_EAX_08;
int extraout_EAX_09;
int extraout_EAX_10;
int extraout_EAX_11;
int extraout_EAX_12;
int extraout_EAX_13;
int extraout_EAX_14;
Entity_Player *kickedPlayer;
byte *nameEnd;
byte *******textEnd;
uint uVar7;
undefined4 userIdLow;
byte *******textBuffer;
void *freeBlock;
int unused1;
int iVar8;
undefined1 voteIter [8];
undefined4 kickedIdLow;
undefined4 kickedIdHigh;
undefined4 execSenderIdLow;
undefined4 execSenderIdHigh;
undefined4 offVoterIdLow;
undefined4 offVoterIdHigh;
undefined4 offSenderIdLow;
undefined4 offSenderIdHigh;
undefined4 voterIdLow;
undefined4 voterIdHigh;
undefined4 senderIdLow;
undefined4 senderIdHigh;
undefined1 peekedMessage [4];
int *peekedRefCount;
undefined **targetProfile;
int targetProfileData;
undefined **execTargetProfile;
int execTargetProfileData;
undefined **offTargetProfile;
int offTargetProfileData;
undefined **removeProfile [2];
undefined **banProfile;
int banProfileData;
undefined **execSenderProfile [2];
undefined **execCheckProfile [2];
undefined **kickedChatProfile [2];
undefined **execTargetNameProfile [2];
undefined **offSenderProfile [2];
undefined **offTargetNameProfile [2];
undefined **banCheckProfile [2];
undefined **targetChatProfile [2];
undefined **targetCheckProfile [2];
undefined **senderProfile [2];
undefined **targetNameProfile [2];
undefined4 *messageData;
int *messageRefCount;
undefined4 logSenderIdLow;
undefined4 local_a4;
undefined8 local_a0;
undefined8 uStack_98;
undefined8 local_90;
byte *******kickVoteText;
undefined4 uStack_80;
undefined4 uStack_7c;
undefined4 uStack_78;
undefined4 kickVoteTextSize;
uint kickVoteTextCapacity;
byte *******kickedText;
undefined4 uStack_68;
undefined4 uStack_64;
undefined4 uStack_60;
undefined4 kickedTextSize;
uint kickedTextCapacity;
void *chatLine [4];
undefined4 chatLineSize;
uint chatLineCapacity;
ulonglong nameText;
char acStack_34 [12];
uint nameTextCapacity;
uint stackCookie;
undefined1 *puStack_20;
void *savedExceptionList;
undefined1 *puStack_18;
undefined4 ehState;
puStack_20 = acStack_34 + 0x30;
puStack_18 = &LAB_00b09748;
savedExceptionList = ExceptionList;
uVar3 = __security_cookie ^ GHIDRA_UINT((acStack_34 + 0x24));
ExceptionList = &savedExceptionList;
stackCookie = uVar3;
do {
ehState = 0xffffffff;
if (g_multiplayerService == (void *)0x0) {
ExceptionList = savedExceptionList;
return;
}
piVar4 = (GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::receive_message(peekedMessage,5,0);
iVar8 = *piVar4;
ehState = 0;
if (((peekedRefCount != GHIDRA_CAST<int *>(0x0)) &&
(cVar1 = (**(code **)(*peekedRefCount + 0xc))(uVar3), cVar1 != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)(peekedMessage);
}
ehState = 0xffffffff;
if (iVar8 == 0) {
ExceptionList = savedExceptionList;
return;
}
if (g_multiplayerService == (void *)0x0) {
KAGE::SmartPointer<MessageData>::reset(0);
}
else {
(GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::receive_message(&messageData,5,1);
}
ehState = 1;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_90)) + 0x4))) = messageData;
if (messageData[3] != 1) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("This function should only be called on consolidated messages"));
}
if (*GHIDRA_CAST<int *>((*(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<int *>(local_90))) + 0x4)))[2] + 0x18)) != 0x20) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("Invalid data size recieved for Drop Player Message \n"));
}
puVar6 = messageData;
if (messageData[3] != 1) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("This function should only be called on consolidated messages"));
}
local_90 = CONCAT44(*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(puVar6[2]) + 0x14)) + 8,(undefined4)local_90);
dropEntry = get_drop_entry(dropEntry,*GHIDRA_CAST<ulonglong *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(puVar6[2]) + 0x14)) + 0x10)));
if (dropEntry == GHIDRA_CAST<ulonglong *>(0x0)) {
KAGE_LogMessage(8,(byte *)
"[Frame: %d] Recieved Drop Player Message with invalid drop player ID: %llu \n"
);
}
else {
iVar8 = *(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_90)) + 0x4)));
if (iVar8 == 0) {
senderIdLow = *messageData;
senderIdHigh = messageData[1];
senderProfile[0] = KAGE::System::UserProfileBase::vftable;
logSenderIdLow = senderIdLow;
local_a4 = senderIdHigh;
(GHIDRA_CAST<UserProfile *>((&senderIdLow)))->UserProfile::find_or_create();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 2;
senderProfile[0] = KAGE::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)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((senderProfile)))->KAGE::System::UserProfile::load_steam_avatar();
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 3;
uVar5 = (*(code *)senderProfile[0][1])();
uStack_98 = CONCAT44(uVar5,(undefined4)uStack_98);
targetProfile = KAGE::System::UserProfileBase::vftable;
(GHIDRA_CAST<UserProfile *>((dropEntry)))->UserProfile::find_or_create();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 4;
targetProfile = KAGE::System::UserProfile::vftable;
targetProfileData = extraout_EAX_00;
if (((extraout_EAX_00 != 0) &&
(*GHIDRA_CAST<int *>((extraout_EAX_00 + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX_00 + 0xc)) != 0)) &&
(*GHIDRA_CAST<int *>((extraout_EAX_00 + 0x14)) == 0)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((&targetProfile)))->KAGE::System::UserProfile::load_steam_avatar();
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 5;
if (targetProfileData == 0) {
local_a0 = local_a0 & 0xffffffff;
local_90 = 0;
}
else {
local_90 = CONCAT44(*GHIDRA_CAST<undefined4 *>((targetProfileData + 8)),(undefined4)local_90);
local_a0 = CONCAT44(*GHIDRA_CAST<undefined4 *>((targetProfileData + 0xc)),(undefined4)local_a0);
}
targetNameProfile[0] = KAGE::System::UserProfileBase::vftable;
(GHIDRA_CAST<UserProfile *>((dropEntry)))->UserProfile::find_or_create();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 6;
targetNameProfile[0] = KAGE::System::UserProfile::vftable;
if (((extraout_EAX_01 != 0) &&
(*GHIDRA_CAST<int *>((extraout_EAX_01 + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX_01 + 0xc)) != 0)) &&
(*GHIDRA_CAST<int *>((extraout_EAX_01 + 0x14)) == 0)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((targetNameProfile)))->KAGE::System::UserProfile::load_steam_avatar();
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 7;
(*(code *)targetNameProfile[0][1])();
KAGE_LogMessage(1,(byte *)
"[Frame: %d] Recieved eDropMessageType::MSG_DROP_ON for player \"%s\" %llu from player \"%s\" %llu \n"
);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 1;
targetNameProfile[0] = KAGE::System::UserProfileBase::vftable;
targetProfile = KAGE::System::UserProfileBase::vftable;
senderProfile[0] = KAGE::System::UserProfileBase::vftable;
voterIdLow = *messageData;
voterIdHigh = messageData[1];
piVar4 = GHIDRA_CAST<int *>(FUN_00915960(voteIter,&voterIdLow));
*GHIDRA_CAST<undefined1 *>((*piVar4 + 0x18)) = 1;
if (GHIDRA_INT(dropEntry[1]) - GHIDRA_INT(*dropEntry) >> 2 != 0) {
targetCheckProfile[0] = KAGE::System::UserProfileBase::vftable;
(GHIDRA_CAST<UserProfile *>((dropEntry)))->UserProfile::find_or_create();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 8;
targetCheckProfile[0] = KAGE::System::UserProfile::vftable;
if (((extraout_EAX_02 != 0) &&
(*GHIDRA_CAST<int *>((extraout_EAX_02 + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX_02 + 0xc)) != 0)) &&
(*GHIDRA_CAST<int *>((extraout_EAX_02 + 0x14)) == 0)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((targetCheckProfile)))->KAGE::System::UserProfile::load_steam_avatar();
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 9;
cVar1 = (*(code *)targetCheckProfile[0][5])();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 1;
targetCheckProfile[0] = KAGE::System::UserProfileBase::vftable;
if (cVar1 == '\0') {
targetChatProfile[0] = KAGE::System::UserProfileBase::vftable;
(GHIDRA_CAST<UserProfile *>((dropEntry)))->UserProfile::find_or_create();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 10;
targetChatProfile[0] = KAGE::System::UserProfile::vftable;
if (((extraout_EAX_03 != 0) &&
(*GHIDRA_CAST<int *>((extraout_EAX_03 + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX_03 + 0xc)) != 0)) &&
(*GHIDRA_CAST<int *>((extraout_EAX_03 + 0x14)) == 0)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((targetChatProfile)))->KAGE::System::UserProfile::load_steam_avatar();
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0xb;
profileName = GHIDRA_CAST<byte *>((*(code *)targetChatProfile[0][1])());
acStack_34[8] = '\0';
acStack_34[9] = '\0';
acStack_34[10] = '\0';
acStack_34[0xb] = '\0';
nameTextCapacity = 0xf;
nameText = nameText & 0xffffffff00000000;
uStack_98 = CONCAT44(profileName + 1,(undefined4)uStack_98);
nameEnd = profileName;
do {
bVar2 = *nameEnd;
nameEnd = nameEnd + 1;
} while (bVar2 != 0);
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(&nameText))))->std::string::assign(profileName,GHIDRA_INT(nameEnd) - GHIDRA_INT((profileName + 1)))
;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0xc;
puVar6 = (GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(&nameText))))->std::string::append(GHIDRA_CAST<byte *>(" RECEIVED A KICK VOTE"),0x15);
kickVoteText = GHIDRA_CAST<byte *******>(*puVar6);
kickVoteTextSize = puVar6[4];
kickVoteTextCapacity = puVar6[5];
uStack_80 = puVar6[1];
uStack_7c = puVar6[2];
uStack_78 = puVar6[3];
puVar6[4] = 0;
puVar6[5] = 0xf;
*GHIDRA_CAST<undefined1 *>(puVar6) = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0xd;
chatLineSize = 0;
textBuffer = GHIDRA_CAST<byte *******>(&kickVoteText);
if (0xf < kickVoteTextCapacity) {
textBuffer = kickVoteText;
}
chatLineCapacity = 0xf;
chatLine[0] = (void *)0x0;
uStack_98 = CONCAT44(GHIDRA_CAST<byte *>((GHIDRA_INT(textBuffer) + 1)),(undefined4)uStack_98);
textEnd = textBuffer;
do {
bVar2 = *GHIDRA_CAST<byte *>(textEnd);
textEnd = GHIDRA_CAST<byte *******>((GHIDRA_INT(textEnd) + 1));
} while (bVar2 != 0);
uVar7 = GHIDRA_INT(textEnd) - (GHIDRA_INT(textBuffer) + 1);
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(chatLine))))->std::string::assign(GHIDRA_CAST<byte *>(textBuffer),uVar7);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0xe;
FUN_00428b60(chatLine,0x6e,textBuffer,uVar7);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0xd;
if (0xf < chatLineCapacity) {
uVar7 = chatLineCapacity + 1;
freeBlock = chatLine[0];
if (0xfff < uVar7) {
freeBlock = *(void **)(GHIDRA_INT(chatLine[0]) + -4);
uVar7 = chatLineCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(chatLine[0]) + (-4 - GHIDRA_INT(freeBlock))))) goto LAB_0091061f;
}
operator_delete(freeBlock,uVar7);
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0xc;
if (0xf < kickVoteTextCapacity) {
uVar7 = kickVoteTextCapacity + 1;
textBuffer = kickVoteText;
if (0xfff < uVar7) {
textBuffer = GHIDRA_CAST<byte *******>(kickVoteText[-1]);
uVar7 = kickVoteTextCapacity + 0x24;
if (GHIDRA_CAST<byte *>(0x1f) < GHIDRA_CAST<byte *>((GHIDRA_INT(kickVoteText) + (-4 - GHIDRA_INT(textBuffer)))))
goto LAB_0091061f;
}
operator_delete(textBuffer,uVar7);
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0xb;
if (0xf < nameTextCapacity) {
uVar7 = nameTextCapacity + 1;
freeBlock = (void *)nameText;
if (0xfff < uVar7) {
freeBlock = *(void **)(GHIDRA_INT((void *)nameText) + -4);
uVar7 = nameTextCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT((void *)nameText) + (-4 - GHIDRA_INT(freeBlock))))) goto LAB_0091061f;
}
operator_delete(freeBlock,uVar7);
}
acStack_34[8] = '\0';
acStack_34[9] = '\0';
acStack_34[10] = '\0';
acStack_34[0xb] = '\0';
nameTextCapacity = 0xf;
nameText = nameText & 0xffffffffffffff00;
targetChatProfile[0] = KAGE::System::UserProfileBase::vftable;
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 1;
local_90 = CONCAT44(&g_manager->_netplayManager,(undefined4)local_90);
bVar2 = is_user_in_player_list(&g_manager->_netplayManager,*dropEntry);
if (bVar2 == 0) {
uVar7 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_90)) + 0x4)))[1] - *(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_90)) + 0x4))) >> 2;
}
else {
uVar7 = ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_90)) + 0x4)))[1] - *(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_90)) + 0x4))) >> 2) - 1;
}
if (uVar7 <= *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(dropEntry) + 0xc))) {
banProfile = KAGE::System::UserProfileBase::vftable;
(GHIDRA_CAST<UserProfile *>((dropEntry)))->UserProfile::find_or_create();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0xf;
banProfile = KAGE::System::UserProfile::vftable;
banProfileData = extraout_EAX_04;
if (((extraout_EAX_04 != 0) &&
(*GHIDRA_CAST<int *>((extraout_EAX_04 + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX_04 + 0xc)) != 0)) &&
(*GHIDRA_CAST<int *>((extraout_EAX_04 + 0x14)) == 0)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((&banProfile)))->KAGE::System::UserProfile::load_steam_avatar();
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x10;
if (banProfileData == 0) {
uStack_98 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_98)) + 0x4))) = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_98)) + 0x0))) = 0;
uVar5 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_98)) + 0x4)));
userIdLow = (undefined4)uStack_98;
}
else {
uVar5 = *GHIDRA_CAST<undefined4 *>((banProfileData + 0xc));
userIdLow = *GHIDRA_CAST<undefined4 *>((banProfileData + 8));
}
ban_user(userIdLow,uVar5);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 1;
banProfile = KAGE::System::UserProfileBase::vftable;
banCheckProfile[0] = KAGE::System::UserProfileBase::vftable;
(GHIDRA_CAST<UserProfile *>((dropEntry)))->UserProfile::find_or_create();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x11;
banCheckProfile[0] = KAGE::System::UserProfile::vftable;
if (((extraout_EAX_05 != 0) &&
(*GHIDRA_CAST<int *>((extraout_EAX_05 + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX_05 + 0xc)) != 0)) &&
(*GHIDRA_CAST<int *>((extraout_EAX_05 + 0x14)) == 0)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((banCheckProfile)))->KAGE::System::UserProfile::load_steam_avatar();
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x12;
uVar5 = 0x90fe2f;
cVar1 = (*(code *)banCheckProfile[0][5])();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 1;
banCheckProfile[0] = KAGE::System::UserProfileBase::vftable;
if (cVar1 == '\0') {
removeProfile[0] = KAGE::System::UserProfileBase::vftable;
(GHIDRA_CAST<UserProfile *>((dropEntry)))->UserProfile::find_or_create();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x14;
removeProfile[0] = KAGE::System::UserProfile::vftable;
if (((extraout_EAX_06 != 0) &&
(*GHIDRA_CAST<int *>((extraout_EAX_06 + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX_06 + 0xc)) != 0)) &&
(*GHIDRA_CAST<int *>((extraout_EAX_06 + 0x14)) == 0)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((removeProfile)))->KAGE::System::UserProfile::load_steam_avatar();
}
ehState = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x1))),0x15);
QueueRemovePlayer(removeProfile);
removeProfile[0] = KAGE::System::UserProfileBase::vftable;
}
else {
builtin_strncpy(acStack_34," KICKED",8);
nameTextCapacity = 0xf;
acStack_34[8] = '\x0f';
acStack_34[9] = '\0';
acStack_34[10] = '\0';
acStack_34[0xb] = '\0';
nameText = 0x4552455720554f59;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x13;
FUN_00428b60(&nameText,0x6e,userIdLow,uVar5);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 1;
if (0xf < nameTextCapacity) {
uVar7 = nameTextCapacity + 1;
freeBlock = (void *)nameText;
if (0xfff < uVar7) {
freeBlock = *(void **)(GHIDRA_INT((void *)nameText) + -4);
uVar7 = nameTextCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT((void *)nameText) + (-4 - GHIDRA_INT(freeBlock))))) {
LAB_0091061f:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(freeBlock,uVar7);
}
uVar5 = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dropEntry) + 4));
userIdLow = (undefined4)*dropEntry;
remove_drop_entry(dropEntry,*dropEntry);
FUN_00907830(userIdLow,uVar5);
}
}
}
}
else if (iVar8 == 1) {
offSenderIdLow = *messageData;
offSenderIdHigh = messageData[1];
uStack_98 = CONCAT44(offSenderIdHigh,(undefined4)uStack_98);
offSenderProfile[0] = KAGE::System::UserProfileBase::vftable;
logSenderIdLow = offSenderIdLow;
(GHIDRA_CAST<UserProfile *>((&offSenderIdLow)))->UserProfile::find_or_create();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x16;
offSenderProfile[0] = KAGE::System::UserProfile::vftable;
if (((extraout_EAX_07 != 0) &&
(*GHIDRA_CAST<int *>((extraout_EAX_07 + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX_07 + 0xc)) != 0)) &&
(*GHIDRA_CAST<int *>((extraout_EAX_07 + 0x14)) == 0)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((offSenderProfile)))->KAGE::System::UserProfile::load_steam_avatar();
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x17;
local_a4 = (*(code *)offSenderProfile[0][1])();
offTargetProfile = KAGE::System::UserProfileBase::vftable;
(GHIDRA_CAST<UserProfile *>((dropEntry)))->UserProfile::find_or_create();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x18;
offTargetProfile = KAGE::System::UserProfile::vftable;
offTargetProfileData = extraout_EAX_08;
if (((extraout_EAX_08 != 0) &&
(*GHIDRA_CAST<int *>((extraout_EAX_08 + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX_08 + 0xc)) != 0)) &&
(*GHIDRA_CAST<int *>((extraout_EAX_08 + 0x14)) == 0)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((&offTargetProfile)))->KAGE::System::UserProfile::load_steam_avatar();
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x19;
if (offTargetProfileData == 0) {
local_90 = local_90 & 0xffffffff;
local_a0 = 0;
}
else {
local_a0 = CONCAT44(*GHIDRA_CAST<undefined4 *>((offTargetProfileData + 8)),(undefined4)local_a0);
local_90 = CONCAT44(*GHIDRA_CAST<undefined4 *>((offTargetProfileData + 0xc)),(undefined4)local_90);
}
offTargetNameProfile[0] = KAGE::System::UserProfileBase::vftable;
(GHIDRA_CAST<UserProfile *>((dropEntry)))->UserProfile::find_or_create();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x1a;
offTargetNameProfile[0] = KAGE::System::UserProfile::vftable;
if (((extraout_EAX_09 != 0) &&
(*GHIDRA_CAST<int *>((extraout_EAX_09 + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX_09 + 0xc)) != 0)) &&
(*GHIDRA_CAST<int *>((extraout_EAX_09 + 0x14)) == 0)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((offTargetNameProfile)))->KAGE::System::UserProfile::load_steam_avatar();
}
ehState = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x1))),0x1b);
(*(code *)offTargetNameProfile[0][1])();
KAGE_LogMessage(1,(byte *)
"[Frame: %d] Recieved eDropMessageType::MSG_DROP_OFF for player \"%s\" %llu from player \"%s\" %llu \n"
);
offTargetNameProfile[0] = KAGE::System::UserProfileBase::vftable;
offTargetProfile = KAGE::System::UserProfileBase::vftable;
offSenderProfile[0] = KAGE::System::UserProfileBase::vftable;
offVoterIdLow = *messageData;
offVoterIdHigh = messageData[1];
FUN_00914480(&offVoterIdLow);
}
else if (iVar8 == 4) {
execSenderIdLow = *messageData;
execSenderIdHigh = messageData[1];
uStack_98 = CONCAT44(execSenderIdHigh,(undefined4)uStack_98);
execSenderProfile[0] = KAGE::System::UserProfileBase::vftable;
logSenderIdLow = execSenderIdLow;
(GHIDRA_CAST<UserProfile *>((&execSenderIdLow)))->UserProfile::find_or_create();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x1c;
execSenderProfile[0] = KAGE::System::UserProfile::vftable;
if (((extraout_EAX_10 != 0) &&
(*GHIDRA_CAST<int *>((extraout_EAX_10 + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX_10 + 0xc)) != 0)) &&
(*GHIDRA_CAST<int *>((extraout_EAX_10 + 0x14)) == 0)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((execSenderProfile)))->KAGE::System::UserProfile::load_steam_avatar();
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x1d;
local_a4 = (*(code *)execSenderProfile[0][1])();
execTargetProfile = KAGE::System::UserProfileBase::vftable;
(GHIDRA_CAST<UserProfile *>((dropEntry)))->UserProfile::find_or_create();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x1e;
execTargetProfile = KAGE::System::UserProfile::vftable;
execTargetProfileData = extraout_EAX_11;
if (((extraout_EAX_11 != 0) &&
(*GHIDRA_CAST<int *>((extraout_EAX_11 + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX_11 + 0xc)) != 0)) &&
(*GHIDRA_CAST<int *>((extraout_EAX_11 + 0x14)) == 0)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((&execTargetProfile)))->KAGE::System::UserProfile::load_steam_avatar();
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x1f;
if (execTargetProfileData == 0) {
local_90 = local_90 & 0xffffffff;
local_a0 = 0;
}
else {
local_a0 = CONCAT44(*GHIDRA_CAST<undefined4 *>((execTargetProfileData + 8)),(undefined4)local_a0);
local_90 = CONCAT44(*GHIDRA_CAST<undefined4 *>((execTargetProfileData + 0xc)),(undefined4)local_90);
}
execTargetNameProfile[0] = KAGE::System::UserProfileBase::vftable;
(GHIDRA_CAST<UserProfile *>((dropEntry)))->UserProfile::find_or_create();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x20;
execTargetNameProfile[0] = KAGE::System::UserProfile::vftable;
if (((extraout_EAX_12 != 0) &&
(*GHIDRA_CAST<int *>((extraout_EAX_12 + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX_12 + 0xc)) != 0)) &&
(*GHIDRA_CAST<int *>((extraout_EAX_12 + 0x14)) == 0)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((execTargetNameProfile)))->KAGE::System::UserProfile::load_steam_avatar();
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x21;
(*(code *)execTargetNameProfile[0][1])();
KAGE_LogMessage(1,(byte *)
"[Frame: %d] Recieved eDropMessageType::MSG_DROP_EXECUTE for player \"%s\" %llu from player \"%s\" %llu \n"
);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 1;
execTargetNameProfile[0] = KAGE::System::UserProfileBase::vftable;
execTargetProfile = KAGE::System::UserProfileBase::vftable;
execSenderProfile[0] = KAGE::System::UserProfileBase::vftable;
execCheckProfile[0] = KAGE::System::UserProfileBase::vftable;
(GHIDRA_CAST<UserProfile *>((dropEntry)))->UserProfile::find_or_create();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x22;
execCheckProfile[0] = KAGE::System::UserProfile::vftable;
if (((extraout_EAX_13 != 0) &&
(*GHIDRA_CAST<int *>((extraout_EAX_13 + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX_13 + 0xc)) != 0)) &&
(*GHIDRA_CAST<int *>((extraout_EAX_13 + 0x14)) == 0)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((execCheckProfile)))->KAGE::System::UserProfile::load_steam_avatar();
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x23;
cVar1 = (*(code *)execCheckProfile[0][5])();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 1;
iVar8 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(dropEntry) + 4));
unused1 = GHIDRA_INT(*dropEntry);
execCheckProfile[0] = KAGE::System::UserProfileBase::vftable;
if (cVar1 == '\0') {
bVar2 = is_user_in_player_list(dropEntry,*dropEntry);
if (bVar2 != 0) {
kickedChatProfile[0] = KAGE::System::UserProfileBase::vftable;
(GHIDRA_CAST<UserProfile *>((dropEntry)))->UserProfile::find_or_create();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x24;
kickedChatProfile[0] = KAGE::System::UserProfile::vftable;
if (((extraout_EAX_14 != 0) &&
(*GHIDRA_CAST<int *>((extraout_EAX_14 + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX_14 + 0xc)) != 0)) &&
(*GHIDRA_CAST<int *>((extraout_EAX_14 + 0x14)) == 0)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((kickedChatProfile)))->KAGE::System::UserProfile::load_steam_avatar();
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x25;
profileName = GHIDRA_CAST<byte *>((*(code *)kickedChatProfile[0][1])());
acStack_34[8] = '\0';
acStack_34[9] = '\0';
acStack_34[10] = '\0';
acStack_34[0xb] = '\0';
nameTextCapacity = 0xf;
nameText = nameText & 0xffffffff00000000;
uStack_98 = CONCAT44(profileName + 1,(undefined4)uStack_98);
nameEnd = profileName;
do {
bVar2 = *nameEnd;
nameEnd = nameEnd + 1;
} while (bVar2 != 0);
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(&nameText))))->std::string::assign(profileName,GHIDRA_INT(nameEnd) - GHIDRA_INT((profileName + 1)))
;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x26;
puVar6 = (GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(&nameText))))->std::string::append(GHIDRA_CAST<byte *>(" WAS KICKED"),0xb);
kickedText = GHIDRA_CAST<byte *******>(*puVar6);
kickedTextSize = puVar6[4];
kickedTextCapacity = puVar6[5];
uStack_68 = puVar6[1];
uStack_64 = puVar6[2];
uStack_60 = puVar6[3];
puVar6[4] = 0;
puVar6[5] = 0xf;
*GHIDRA_CAST<undefined1 *>(puVar6) = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x27;
chatLineSize = 0;
textBuffer = GHIDRA_CAST<byte *******>(&kickedText);
if (0xf < kickedTextCapacity) {
textBuffer = kickedText;
}
chatLineCapacity = 0xf;
chatLine[0] = (void *)0x0;
uStack_98 = CONCAT44(GHIDRA_CAST<byte *>((GHIDRA_INT(textBuffer) + 1)),(undefined4)uStack_98);
textEnd = textBuffer;
do {
bVar2 = *GHIDRA_CAST<byte *>(textEnd);
textEnd = GHIDRA_CAST<byte *******>((GHIDRA_INT(textEnd) + 1));
} while (bVar2 != 0);
uVar7 = GHIDRA_INT(textEnd) - (GHIDRA_INT(textBuffer) + 1);
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(chatLine))))->std::string::assign(GHIDRA_CAST<byte *>(textBuffer),uVar7);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x28;
FUN_00428b60(chatLine,0x6e,textBuffer,uVar7);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x27;
if (0xf < chatLineCapacity) {
uVar7 = chatLineCapacity + 1;
freeBlock = chatLine[0];
if (0xfff < uVar7) {
freeBlock = *(void **)(GHIDRA_INT(chatLine[0]) + -4);
uVar7 = chatLineCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(chatLine[0]) + (-4 - GHIDRA_INT(freeBlock))))) goto LAB_0091061f;
}
operator_delete(freeBlock,uVar7);
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x26;
if (0xf < kickedTextCapacity) {
uVar7 = kickedTextCapacity + 1;
textBuffer = kickedText;
if (0xfff < uVar7) {
textBuffer = GHIDRA_CAST<byte *******>(kickedText[-1]);
uVar7 = kickedTextCapacity + 0x24;
if (GHIDRA_CAST<byte *>(0x1f) < GHIDRA_CAST<byte *>((GHIDRA_INT(kickedText) + (-4 - GHIDRA_INT(textBuffer)))))
goto LAB_0091061f;
}
operator_delete(textBuffer,uVar7);
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x25;
if (0xf < nameTextCapacity) {
uVar7 = nameTextCapacity + 1;
freeBlock = (void *)nameText;
if (0xfff < uVar7) {
freeBlock = *(void **)(GHIDRA_INT((void *)nameText) + -4);
uVar7 = nameTextCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT((void *)nameText) + (-4 - GHIDRA_INT(freeBlock))))) goto LAB_0091061f;
}
operator_delete(freeBlock,uVar7);
}
ehState = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x1))),1);
kickedIdLow = (undefined4)*dropEntry;
kickedIdHigh = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dropEntry) + 4));
kickedChatProfile[0] = KAGE::System::UserProfileBase::vftable;
kickedPlayer = PlayerManager::get_player_by_user_id
(GHIDRA_CAST<PlayerManager *>(dropEntry),GHIDRA_CAST<ulonglong *>(&kickedIdLow));
RemoveRemotePlayer(dropEntry,&kickedPlayer->_size);
}
}
else {
bVar2 = is_user_in_player_list(dropEntry,*dropEntry);
if (bVar2 == 0) {
if (g_menuManager == GHIDRA_CAST<MenuManager *>(0x0)) {
netplay_leave_lobby(dropEntry,unused1,iVar8);
reset(dropEntry,1);
}
else {
Menu_OnlineLobby::handle_kicked();
}
}
}
}
else {
KAGE_LogMessage(8,(byte *)
"[Frame: %d] Recieved Drop Player Message with invalid message type: %d \n"
);
}
}
ehState = 0x29;
if (((messageRefCount != GHIDRA_CAST<int *>(0x0)) &&
(cVar1 = (**(code **)(*messageRefCount + 0xc))(), cVar1 != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)(&messageData);
}
} while( true );
}
// 00910650
void NetplayManager::update_status_messages()
{
longlong lVar1;
longlong lVar2;
longlong lVar3;
char isLastRef;
uint uVar4;
int *receiveResult;
Entity_Player *pEVar5;
undefined4 *puVar6;
PlayerManager *in_ECX;
uint uVar7;
undefined4 *messageData;
ulonglong uVar8;
undefined1 *message;
undefined1 *messageRefCount;
undefined4 *statusMessage;
int *statusMessageRefCount;
undefined4 local_38;
int *local_34;
undefined4 local_30;
int *local_2c;
undefined4 *local_28;
PlayerManager *netplay;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
int isMessageAvailable;
Manager *manager;
PlayerManager *players;
puStack_20 = GHIDRA_CAST<undefined1 *>((GHIDRA_INT(register0x00000010) + -4));
puStack_18 = &LAB_00b09795;
local_1c = ExceptionList;
uVar4 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U;
ExceptionList = &local_1c;
netplay = in_ECX;
while( true ) {
players = netplay;
local_14 = 0xffffffff;
if (g_multiplayerService == (void *)0x0) break;
receiveResult = (GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::receive_message(&local_30,9,0);
isMessageAvailable = *receiveResult;
local_14 = 0;
if (((local_2c != GHIDRA_CAST<int *>(0x0)) &&
(isLastRef = (**(code **)(*local_2c + 0xc))(uVar4), isLastRef != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)(&local_30);
}
local_14 = 0xffffffff;
if (isMessageAvailable == 0) break;
if (g_multiplayerService == (void *)0x0) {
KAGE::SmartPointer<MessageData>::reset(0);
}
else {
(GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::receive_message(&statusMessage,9,1);
}
puVar6 = statusMessage;
local_14 = 1;
local_38 = *statusMessage;
local_34 = GHIDRA_CAST<int *>(statusMessage[1]);
pEVar5 = (GHIDRA_CAST<PlayerManager *>((players)))->PlayerManager::get_player_by_user_id(GHIDRA_CAST<ulonglong *>(&local_38));
if (pEVar5 != GHIDRA_CAST<Entity_Player *>(0x0)) {
_local_2c = CONCAT44(puVar6,local_2c);
messageData = puVar6;
if (puVar6[3] != 1) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("This function should only be called on consolidated messages"))
;
puVar6 = local_28;
messageData = statusMessage;
}
if (*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(puVar6[2]) + 0x14)) + 8)) == 0) {
if (messageData[3] != 1) {
KAGE_LogMessage(0x10,(byte *)
"This function should only be called on consolidated messages");
}
pEVar5->_target = *GHIDRA_CAST<EntityPtr *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(messageData[2]) + 0x14)) + 0xc));
}
}
local_14 = 2;
if (((statusMessageRefCount != GHIDRA_CAST<int *>(0x0)) &&
(isLastRef = (**(code **)(*statusMessageRefCount + 0xc))(), isLastRef != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)(&statusMessage);
}
}
local_14 = 0xffffffff;
if ((players->_playerList)._begin != (players->_playerList)._end) {
uVar8 = GetTimeNs();
lVar1 = (uVar8 & 0xffffffff) * 0x431bde82;
local_34 = GHIDRA_CAST<int *>(((ulonglong)lVar1 >> 0x20));
lVar2 = (uVar8 >> 0x20) * 0xd7b634db;
lVar3 = (uVar8 >> 0x20) * 0x431bde82;
uVar8 = lVar2 + ((uVar8 & 0xffffffff) * 0xd7b634db >> 0x20);
uVar7 = GHIDRA_UINT((uVar8 >> 0x20));
_local_2c = CONCAT44(GHIDRA_INT(lVar3),GHIDRA_INT(((ulonglong)lVar2 >> 0x20)));
lVar1 = lVar1 + (uVar8 & 0xffffffff);
local_30 = (undefined4)lVar1;
uVar4 = GHIDRA_UINT(((ulonglong)lVar1 >> 0x20));
lVar3 = lVar3 + (ulonglong)CONCAT14(CARRY4(uVar7,uVar4),uVar7 + uVar4);
uVar4 = GHIDRA_UINT(((ulonglong)lVar3 >> 0x20));
uVar7 = GHIDRA_UINT(lVar3) >> 0x12 | uVar4 * 0x4000;
if (((uVar4 >> 0x12) - *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(netplay[0x1c])) + 0xac)))) !=
GHIDRA_UINT((uVar7 < *GHIDRA_CAST<uint *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(netplay[0x1c])) + 0xa8))))))) ||
(1000 < uVar7 - *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(netplay[0x1c])) + 0xa8)))))) {
statusMessage = GHIDRA_CAST<undefined4 *>(0x0);
statusMessageRefCount = *GHIDRA_CAST<int **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((g_manager)) + 0x4b12c))));
if (g_multiplayerService == (void *)0x0) {
KAGE_LogMessage(0x10,(byte *)
"Attempting to create a message when there is no multiplayer service\n"
);
}
messageRefCount = &DAT_00000009;
message = &DAT_00000008;
NetConnection::send_message(g_multiplayerService,&local_38,0,&statusMessage,8,9);
manager = g_manager;
local_14 = 3;
FUN_008ef1d0(&local_38);
send_message(&manager->_netplayManager,1,message,messageRefCount);
local_14 = 4;
if (((local_34 != GHIDRA_CAST<int *>(0x0)) &&
(isLastRef = (**(code **)(*local_34 + 0xc))(), isLastRef != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)(&local_38);
}
uVar8 = GetTimeNs();
lVar1 = (uVar8 & 0xffffffff) * 0x431bde82;
lVar2 = (uVar8 >> 0x20) * 0xd7b634db + ((uVar8 & 0xffffffff) * 0xd7b634db >> 0x20);
uVar7 = GHIDRA_UINT(((ulonglong)lVar2 >> 0x20));
uVar4 = GHIDRA_INT(((ulonglong)lVar1 >> 0x20)) + GHIDRA_UINT(CARRY4(GHIDRA_UINT(lVar1),GHIDRA_UINT(lVar2)));
lVar1 = (uVar8 >> 0x20) * 0x431bde82 + (ulonglong)CONCAT14(CARRY4(uVar7,uVar4),uVar7 + uVar4);
uVar4 = GHIDRA_UINT(((ulonglong)lVar1 >> 0x20));
*GHIDRA_CAST<uint *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(netplay[0x1c])) + 0xa8)))) = GHIDRA_UINT(lVar1) >> 0x12 | uVar4 * 0x4000;
*GHIDRA_CAST<uint *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(netplay[0x1c])) + 0xac)))) = uVar4 >> 0x12;
}
}
ExceptionList = local_1c;
return;
}
// 00910980
byte NetplayManager::try_advance_frame()
{
qword qVar1;
undefined1 *puVar2;
char cVar3;
byte bVar4;
byte *pbVar5;
int *piVar6;
uint uVar7;
int matchedPlayer;
NetplayManager *pNVar8;
uint uVar9;
qword *pqVar10;
uint uVar11;
int iVar12;
uint uVar13;
NetplayManager NVar14;
uint uVar15;
Entity_Player *player;
bool bVar16;
float fVar17;
undefined1 auStack_62 [2];
NetplayManager local_50;
undefined4 local_48;
int *piStack_44;
undefined4 local_40;
int *local_3c;
undefined8 local_38;
int inputState;
NetplayManager *local_28;
char emoteId;
byte isReady;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
byte *currentAnimData;
Game *game;
puStack_20 = auStack_62 + 0x5e;
local_14 = 0xffffffff;
puStack_18 = &LAB_00b097c0;
local_1c = ExceptionList;
ExceptionList = &local_1c;
uVar11 = 0;
NVar14 = *this;
isReady = 1;
local_28 = this;
puVar2 = auStack_62 + 0x5e;
if (GHIDRA_INT(this[1]) - GHIDRA_INT(NVar14) >> 2 != 0) {
do {
if (g_multiplayerService == (void *)0x0) {
KAGE::SmartPointer<ConnectionBase>::SmartPointer(auStack_62 + -10);
}
else {
iVar12 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(NVar14) + uVar11 * 4)) + 0x374));
if (iVar12 == 0) {
piStack_44 = GHIDRA_CAST<int *>(0x0);
local_48 = 0;
}
else {
local_48 = *GHIDRA_CAST<undefined4 *>((iVar12 + 8));
piStack_44 = *GHIDRA_CAST<int **>((iVar12 + 0xc));
}
local_40 = local_48;
local_3c = piStack_44;
(GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::get_peer(auStack_62 + -10,GHIDRA_CAST<ulonglong *>(&local_40));
}
cVar3 = NetInputDevice::is_input_ready();
if ((cVar3 == '\0') || (bVar16 = isReady == 0, isReady = 1, bVar16)) {
isReady = 0;
}
uVar11 = uVar11 + 1;
NVar14 = *this;
puVar2 = puStack_20;
} while (uVar11 < GHIDRA_UINT((GHIDRA_INT(this[1]) - GHIDRA_INT(NVar14) >> 2)));
}
puStack_20 = puVar2;
iVar12 = (GHIDRA_INT(this[0x61c]) - GHIDRA_INT(this[0x61b])) / 0x18;
if (iVar12 == 0) {
}
else {
pNVar8 = GHIDRA_CAST<NetplayManager *>((GHIDRA_INT(this[0x61b]) + 8));
do {
bVar4 = 0;
if (*pNVar8 != this[3]) {
bVar4 = isReady;
}
iVar12 = iVar12 + -1;
pNVar8 = pNVar8 + 6;
isReady = bVar4;
} while (iVar12 != 0);
this = local_28;
}
iVar12 = GHIDRA_INT(this[0x61f]) - GHIDRA_INT(this[0x61e]) >> 5;
if (iVar12 != 0) {
pNVar8 = GHIDRA_CAST<NetplayManager *>((GHIDRA_INT(this[0x61e]) + 0x10));
do {
bVar4 = 0;
if (*pNVar8 != this[3]) {
bVar4 = isReady;
}
iVar12 = iVar12 + -1;
pNVar8 = pNVar8 + 8;
isReady = bVar4;
} while (iVar12 != 0);
this = local_28;
}
iVar12 = GHIDRA_INT(this[0x622]) - GHIDRA_INT(this[0x621]) >> 4;
if (iVar12 != 0) {
pNVar8 = GHIDRA_CAST<NetplayManager *>((GHIDRA_INT(this[0x621]) + 0xc));
do {
bVar4 = 0;
if (*pNVar8 != this[3]) {
bVar4 = isReady;
}
iVar12 = iVar12 + -1;
pNVar8 = pNVar8 + 4;
isReady = bVar4;
} while (iVar12 != 0);
this = local_28;
}
if ((this[0x472] != (NetplayManager)0x0) && (GHIDRA_UINT(this[0x475]) <= GHIDRA_UINT(this[3]))) {
ExceptionList = local_1c;
return 0;
}
if (isReady == 0) {
ExceptionList = local_1c;
return 0;
}
*GHIDRA_CAST<undefined1 *>((this + 6)) = 0;
uVar11 = 0;
NVar14 = *this;
if (GHIDRA_INT(this[1]) - GHIDRA_INT(NVar14) >> 2 == 0) {
LAB_00910f99:
NVar14 = this[0xe];
if (GHIDRA_UINT((GHIDRA_INT(this[4]) * 2)) < GHIDRA_UINT(NVar14)) {
do {
pNVar8 = (NetplayManager *)
**GHIDRA_CAST<undefined4 **>((GHIDRA_INT(this[0xb]) + (GHIDRA_INT(this[0xc]) - 1U & GHIDRA_UINT(this[0xd])) * 4));
local_28 = pNVar8;
_Find_lower_bound<>();
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(local_50) + 0xd)) == '\0') &&
(*GHIDRA_CAST<NetplayManager **>((GHIDRA_CAST<char *>(local_50) + 0x10)) <= pNVar8)) && (local_50 != this[0xf])) {
piVar6 = GHIDRA_CAST<int *>(std)::map<unsigned_int_8byte>::try_emplace();
if (*GHIDRA_CAST<int *>((*piVar6 + 0x14)) != 0) {
piVar6 = GHIDRA_CAST<int *>(std)::map<unsigned_int_8byte>::try_emplace();
iVar12 = *GHIDRA_CAST<int *>((*piVar6 + 0x14));
if (g_mainHeap == (void *)0x0) {
pqVar10 = &g_allocatedBytesNoHeap;
}
else {
pqVar10 = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
if (iVar12 != 0) {
uVar11 = *GHIDRA_CAST<uint *>((iVar12 + -4));
qVar1 = *pqVar10;
*GHIDRA_CAST<uint *>(pqVar10) = GHIDRA_UINT(*pqVar10) - uVar11;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(pqVar10) + 4)) =
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(pqVar10) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar11));
free((void *)(iVar12 + -4));
}
local_14 = 0xffffffff;
piVar6 = GHIDRA_CAST<int *>(std)::map<unsigned_int_8byte>::try_emplace();
*GHIDRA_CAST<undefined4 *>((*piVar6 + 0x14)) = 0;
}
std::map<unsigned_int_8byte>::erase();
NVar14 = this[0xe];
}
NVar14 = (NetplayManager)(GHIDRA_INT(NVar14) - 1);
this[0xe] = NVar14;
if (NVar14 == (NetplayManager)0x0) {
this[0xd] = (NetplayManager)0x0;
}
else {
this[0xd] = (NetplayManager)(GHIDRA_INT(this[0xd]) + 1);
}
} while (GHIDRA_UINT((GHIDRA_INT(this[4]) * 2)) < GHIDRA_UINT(NVar14));
}
save_frame_snapshot(this,0);
game = g_game;
if (((this[0x62c] != (NetplayManager)0x0 || this[0x62d] != (NetplayManager)0x0) &&
(this[0x62d] == (NetplayManager)0x0)) && (GHIDRA_UINT(this[0x62c]) <= GHIDRA_UINT(this[3]))) {
this[0x62c] = (NetplayManager)0x0;
this[0x62d] = (NetplayManager)0x0;
(GHIDRA_CAST<Game *>((game)))->Game::End(1);
}
this[3] = (NetplayManager)(GHIDRA_INT(this[3]) + 1);
ExceptionList = local_1c;
return isReady;
}
LAB_00910b70:
local_3c = *GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(NVar14) + uVar11 * 4));
if ((GHIDRA_UINT(local_3c[2]) & 1) == 0) {
local_3c[0xe2] = 0;
local_3c[0xe3] = 0;
local_3c[0xe0] = 0;
local_3c[0xe1] = 0;
local_3c[0xe4] = 0;
local_3c[0xe5] = 0;
local_3c[0xe6] = 0;
local_3c[0xe7] = 0;
}
else {
inputState = FUN_00901190();
uVar13 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_38)) + 0x4))) = 0;
local_38 = 0;
uVar15 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_38)) + 0x4)));
do {
iVar12 = FUN_00900f50();
if ((iVar12 != 0xff) &&
((GHIDRA_UINT(*GHIDRA_CAST<ushort *>((inputState + 4))) & 1 << ((byte)iVar12 & 0x1f)) != 0)) {
uVar7 = 1 << (uVar13 & 0x1f);
uVar9 = 0;
if (0x1f < uVar13) {
uVar9 = uVar7;
}
uVar7 = uVar7 ^ uVar9;
if (0x3f < uVar13) {
uVar9 = uVar7;
}
local_38 = CONCAT44((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_38)) + 0x4))) | uVar7,(undefined4)local_38);
uVar15 = uVar15 | uVar9;
}
uVar13 = uVar13 + 1;
} while (uVar13 < 0x20);
uVar13 = local_3c[0xe0];
local_3c[0xe0] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_38)) + 0x4)));
local_3c[0xe2] = ~uVar13 & (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_38)) + 0x4)));
local_3c[0xe3] = ~local_3c[0xe1] & uVar15;
local_3c[0xe1] = uVar15;
local_3c[0xe4] = GHIDRA_INT(((float)*GHIDRA_CAST<ushort *>((inputState + 6)) / 32767.0 - 1.0));
local_3c[0xe5] = GHIDRA_INT(((float)*GHIDRA_CAST<ushort *>((inputState + 8)) / 32767.0 - 1.0));
bVar16 = (*GHIDRA_CAST<byte *>((inputState + 0xf)) & 2) == 0;
if (bVar16) {
local_3c[0xe6] = GHIDRA_INT(((float)*GHIDRA_CAST<ushort *>((inputState + 10)) / 32767.0 - 1.0));
fVar17 = (float)*GHIDRA_CAST<ushort *>((inputState + 0xc)) / 32767.0 - 1.0;
}
else {
local_3c[0xe6] = GHIDRA_INT((float)GHIDRA_INT(*GHIDRA_CAST<short *>((inputState + 10))));
fVar17 = (float)GHIDRA_INT(*GHIDRA_CAST<short *>((inputState + 0xc)));
}
local_3c[0xe7] = GHIDRA_INT(fVar17);
*GHIDRA_CAST<bool *>((local_3c + 0xf5)) = !bVar16;
game = g_game;
uVar15 = 0;
iVar12 = local_3c[3];
local_3c[0xf4] = GHIDRA_INT(*GHIDRA_CAST<char *>((inputState + 0xf))) & 1;
piVar6 = (game->_playerManager)._playerList._begin;
uVar13 = GHIDRA_INT((game->_playerManager)._playerList._end) - GHIDRA_INT(piVar6) >> 2;
if (uVar13 != 0) {
do {
matchedPlayer = piVar6[uVar15];
local_38 = CONCAT44(matchedPlayer,(undefined4)local_38);
if (*GHIDRA_CAST<int *>((matchedPlayer + 0x1618)) == iVar12) {
if (matchedPlayer != 0) {
uVar15 = 0;
if (*GHIDRA_CAST<char *>((inputState + 0xe)) == '\x15') goto LAB_00910d40;
goto LAB_00910d90;
}
break;
}
uVar15 = uVar15 + 1;
} while (uVar15 < uVar13);
}
}
goto LAB_00910f7e;
while( true ) {
uVar15 = uVar15 + 1;
piVar6 = piVar6 + 1;
if (uVar13 <= uVar15) break;
LAB_00910d90:
matchedPlayer = *piVar6;
if (*GHIDRA_CAST<int *>((matchedPlayer + 0x1618)) == iVar12) goto LAB_00910daa;
}
matchedPlayer = 0;
LAB_00910daa:
if ((*GHIDRA_CAST<char *>((matchedPlayer + 0x26d8)) != '\0') && (*GHIDRA_CAST<int *>((matchedPlayer + 0x26dc)) == 0x15)) {
*GHIDRA_CAST<undefined1 *>((matchedPlayer + 0x26d8)) = 0;
*GHIDRA_CAST<undefined4 *>((matchedPlayer + 0x26dc)) = 0x3c;
*GHIDRA_CAST<undefined4 *>((matchedPlayer + 0x26e0)) = 0;
*GHIDRA_CAST<undefined4 *>((matchedPlayer + 0x26e4)) = 0;
}
emoteId = *GHIDRA_CAST<char *>((inputState + 0xe));
if (emoteId == '<') goto LAB_00910f7e;
uVar15 = 0;
piVar6 = (g_game->_playerManager)._playerList._begin;
uVar13 = GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT(piVar6) >> 2;
if (uVar13 != 0) {
do {
player = GHIDRA_CAST<Entity_Player *>(*piVar6);
if (player->_controllerIndex == local_3c[3]) goto LAB_00910e26;
uVar15 = uVar15 + 1;
piVar6 = piVar6 + 1;
} while (uVar15 < uVar13);
}
player = GHIDRA_CAST<Entity_Player *>(0x0);
LAB_00910e26:
iVar12 = GHIDRA_INT(emoteId);
if (iVar12 != 0x15) {
Player_stats_add(&g_game->_onlinePlayerStats,8,player,1.0);
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((player)) + 0x26d8))) = 1;
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((player)) + 0x26e4)))) = 0x78;
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((player)) + 0x26dc)))) == iVar12) goto LAB_00910f7e;
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((player)) + 0x26dc)))) = iVar12;
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((player)) + 0x26e0)))) = 0;
if (iVar12 == 0x15) goto LAB_00910f7e;
local_3c = player->_ghostTrinkets + iVar12 * 6 + 0x212;
if ((void *)0xf < (void *)local_3c[5]) {
local_3c = GHIDRA_CAST<int *>(*local_3c);
}
currentAnimData = *GHIDRA_CAST<byte **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((player)) + 0x2834))));
if (currentAnimData == GHIDRA_CAST<byte *>(0x0)) {
LAB_00910ee9:
bVar4 = (GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((player)) + 0x2800)))))))->ANM2::SetAnimation(GHIDRA_CAST<byte *>(local_3c),1);
if (bVar4 != 0) {
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((player)) + 0x2830)))))))->AnimationState::Rewind();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((player)) + 0x2844))) = 1;
}
}
else {
pbVar5 = currentAnimData;
piVar6 = local_3c;
if (0xf < *GHIDRA_CAST<uint *>((currentAnimData + 0x14))) {
pbVar5 = *GHIDRA_CAST<byte **>(currentAnimData);
}
do {
bVar4 = *pbVar5;
bVar16 = bVar4 < (byte)*piVar6;
if (bVar4 != (byte)*piVar6) {
LAB_00910ed0:
uVar15 = -GHIDRA_UINT(bVar16) | 1;
goto LAB_00910ed5;
}
if (bVar4 == 0) break;
bVar4 = pbVar5[1];
bVar16 = bVar4 < *GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(piVar6) + 1));
if (bVar4 != *GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(piVar6) + 1))) goto LAB_00910ed0;
pbVar5 = pbVar5 + 2;
piVar6 = GHIDRA_CAST<int *>((GHIDRA_INT(piVar6) + 2));
} while (bVar4 != 0);
uVar15 = 0;
LAB_00910ed5:
if ((uVar15 != 0) || ((currentAnimData[0x34] != 0 && ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((player)) + 0x2844))) == '\0'))))
goto LAB_00910ee9;
}
if ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((player)) + 0x2909))) != '\0') {
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((player)) + 0x2830)))))))->AnimationState::Update();
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((player)) + 0x2850)))))))->AnimationState::Update();
}
LAB_00910f7e:
uVar11 = uVar11 + 1;
NVar14 = *local_28;
this = local_28;
if (GHIDRA_UINT((GHIDRA_INT(local_28[1]) - GHIDRA_INT(NVar14) >> 2)) <= uVar11) goto LAB_00910f99;
goto LAB_00910b70;
while( true ) {
uVar15 = uVar15 + 1;
piVar6 = piVar6 + 1;
if (uVar13 <= uVar15) break;
LAB_00910d40:
matchedPlayer = *piVar6;
if (*GHIDRA_CAST<int *>((matchedPlayer + 0x1618)) == iVar12) goto LAB_00910d54;
}
matchedPlayer = 0;
LAB_00910d54:
*GHIDRA_CAST<undefined1 *>((matchedPlayer + 0x26d8)) = 1;
*GHIDRA_CAST<undefined4 *>((matchedPlayer + 0x26e4)) = 0;
if (*GHIDRA_CAST<int *>((matchedPlayer + 0x26dc)) != 0x15) {
*GHIDRA_CAST<undefined4 *>((matchedPlayer + 0x26dc)) = 0x15;
*GHIDRA_CAST<undefined4 *>((matchedPlayer + 0x26e0)) = 0;
}
goto LAB_00910f7e;
}
// 00911120
void NetplayManager::update_player_removal()
{
undefined4 *puVar1;
ulonglong senderIdHigh;
byte isInPlayerList;
char cVar3;
uint uVar4;
int extraout_EAX;
void *extraout_EAX_00;
int iVar5;
Entity_Player *removedPlayer;
NetplayManager NVar6;
void *pvVar7;
NetplayManager *latestFrameSrc;
CoopJoinSlot *entryFrameSrc;
CoopJoinSlot *latestFrameSrc;
NetplayManager *pNVar9;
NetplayManager *dstField;
ulonglong *this_00;
int iVar10;
uint uVar11;
void *ptr;
NetplayManager *srcField;
int *piVar12;
undefined1 auStack_ba [2];
undefined8 targetUserId;
CoopJoinSlot removeMessage;
int *local_84;
undefined8 local_80;
PlayerManager *self;
undefined8 local_70;
undefined8 uStack_68;
undefined8 *message;
NetplayManager *local_5c;
undefined **local_58;
void *local_54;
undefined8 local_50;
char isMessageReceived;
NetplayManager *local_40;
longlong local_3c;
char local_34 [4];
void *local_30;
undefined4 local_2c;
uint local_28;
uint stackCookie;
undefined1 *puStack_20;
void *savedExceptionList;
undefined1 *puStack_18;
undefined4 ehState;
undefined4 senderIdHigh;
int userImpl;
ehState = 0xffffffff;
puStack_18 = &LAB_00b09828;
savedExceptionList = ExceptionList;
stackCookie = __security_cookie ^ GHIDRA_UINT((local_34 + 0x24));
ExceptionList = &savedExceptionList;
self = GHIDRA_CAST<PlayerManager *>(this);
puStack_20 = local_34 + 0x30;
if (GHIDRA_INT(this[1]) - GHIDRA_INT(*this) >> 2 != 0) {
NVar6 = this[0x616];
uVar4 = GHIDRA_INT(this[0x617]) - GHIDRA_INT(NVar6) >> 4;
local_5c = GHIDRA_CAST<NetplayManager *>((uVar4 - 1));
puStack_20 = local_34 + 0x30;
if (local_5c < uVar4) {
local_40 = GHIDRA_CAST<NetplayManager *>((GHIDRA_INT(local_5c) * 0x10));
puStack_20 = local_34 + 0x30;
do {
this_00 = GHIDRA_CAST<ulonglong *>((GHIDRA_INT(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((local_40)) + 0x0)))) + GHIDRA_INT(NVar6)));
uStack_68 = CONCAT44(&g_manager->_netplayManager,GHIDRA_INT(uStack_68));
isInPlayerList =
is_user_in_player_list
(&g_manager->_netplayManager,
CONCAT44(*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_40[1])) + 0x0)))) + GHIDRA_INT(NVar6))),
GHIDRA_INT(*this_00)));
if (isInPlayerList == 0) {
uVar4 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_68)) + 0x4)))[1] - *(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_68)) + 0x4))) >> 2;
}
else {
uVar4 = ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_68)) + 0x4)))[1] - *(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_68)) + 0x4))) >> 2) - 1;
}
if ((uVar4 <= *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this_00) + 0xc))) &&
(isInPlayerList = is_player_removal_queued(this,*this_00), isInPlayerList == 0)) {
local_50 = CONCAT44((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_50)) + 0x4))),KAGE::System::UserProfileBase::vftable);
(GHIDRA_CAST<UserProfile *>((this_00)))->UserProfile::find_or_create();
ehState = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_50)) + 0x0))) = KAGE::System::UserProfile::vftable;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_50)) + 0x4))) = GHIDRA_CAST<undefined1 *>(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)))) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((&local_50)))->KAGE::System::UserProfile::load_steam_avatar();
}
ehState = 1;
cVar3 = (*(code *)(GHIDRA_CAST<undefined **>(local_50))[5])();
ehState = 0xffffffff;
local_50 = CONCAT44((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_50)) + 0x4))),KAGE::System::UserProfileBase::vftable);
if (cVar3 == '\0') {
ban_user();
local_58 = KAGE::System::UserProfileBase::vftable;
(GHIDRA_CAST<UserProfile *>((this_00)))->UserProfile::find_or_create();
ehState = 3;
local_58 = KAGE::System::UserProfile::vftable;
local_54 = extraout_EAX_00;
if (((extraout_EAX_00 != (void *)0x0) &&
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(extraout_EAX_00) + 8)) != 0 ||
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(extraout_EAX_00) + 0xc)) != 0)) &&
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(extraout_EAX_00) + 0x14)) == 0)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((&local_58)))->KAGE::System::UserProfile::load_steam_avatar();
}
ehState = 4;
QueueRemovePlayer();
ehState = 0xffffffff;
local_58 = KAGE::System::UserProfileBase::vftable;
}
else {
remove_drop_entry(this,*this_00);
if (1 < GHIDRA_UINT((GHIDRA_INT(this[1]) - GHIDRA_INT(*this) >> 2))) {
builtin_strncpy(local_34," KIC",4);
local_28 = 0xf;
local_2c = 0xf;
local_3c = 0x4552455720554f59;
local_30 = (void *)0x44454b;
ehState = 2;
FUN_00428b60(&local_3c,0x6e);
ehState = 0xffffffff;
if (0xf < local_28) {
uVar4 = local_28 + 1;
pvVar7 = (void *)local_3c;
if (0xfff < uVar4) {
pvVar7 = *(void **)(GHIDRA_INT((void *)local_3c) + -4);
uVar4 = local_28 + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT((void *)local_3c) + (-4 - GHIDRA_INT(pvVar7))))) goto LAB_00911409;
}
operator_delete(pvVar7,uVar4);
}
remove_drop_entry(this,*this_00);
FUN_00907830();
}
}
}
NVar6 = this[0x616];
local_5c = GHIDRA_CAST<NetplayManager *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_5c[-1])) + 0x3))));
local_40 = local_40 + -4;
} while (local_5c < GHIDRA_CAST<undefined1 *>((GHIDRA_INT(this[0x617]) - GHIDRA_INT(NVar6) >> 4)));
}
}
local_40 = this + 0x61b;
local_54 = (void *)0x0;
iVar10 = GHIDRA_INT(this[0x61c]) - GHIDRA_INT(*local_40) >> 0x1f;
if ((GHIDRA_INT(this[0x61c]) - GHIDRA_INT(*local_40)) / 0x18 + iVar10 != iVar10) {
iVar10 = 0;
do {
if (*GHIDRA_CAST<int *>((iVar10 + GHIDRA_INT(this[0x61b]))) == 0) {
if (*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar10 + 4 + GHIDRA_INT(this[0x61b]))) + 0x374)) == 0) {
local_50 = 0;
}
send_remove_frame();
local_50 = CONCAT44(GHIDRA_INT(this[0x61b]) + iVar10,GHIDRA_CAST<undefined **>(local_50));
local_5c = GHIDRA_CAST<NetplayManager *>((GHIDRA_INT(this[0x61b]) + iVar10 + 0xc));
iVar5 = FUN_0090b070();
iVar5 = *GHIDRA_CAST<int *>((iVar5 + 0x374));
if (iVar5 == 0) {
local_70 = 0;
senderIdHigh = local_70;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_70)) + 0x4))) = GHIDRA_CAST<NetplayManager *>(0x0);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_70)) + 0x0))) = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_70)) + 0x1))) = 0;
local_84 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<int *>(local_70))) + 0x4)));
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(removeMessage)) + 0x10))) = (undefined4)local_70;
local_70 = senderIdHigh;
}
else {
local_84 = *GHIDRA_CAST<int **>((iVar5 + 0xc));
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(removeMessage)) + 0x10))) = *GHIDRA_CAST<undefined4 *>((iVar5 + 8));
}
uStack_68 = CONCAT44(local_84,GHIDRA_INT(uStack_68));
puVar1 = *GHIDRA_CAST<undefined4 **>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(local_50))) + 0x4))) + 0x10));
if (puVar1 == *GHIDRA_CAST<undefined4 **>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(local_50))) + 0x4))) + 0x14))) {
std::vector<8byte>::_Emplace_reallocate();
}
else {
*puVar1 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(removeMessage)) + 0x10)));
puVar1[1] = local_84;
local_5c[1] = (NetplayManager)(GHIDRA_INT(local_5c[1]) + 8);
}
latestFrameSrc = GHIDRA_CAST<NetplayManager *>((GHIDRA_INT(this[0x61b]) + 8 + iVar10));
if (GHIDRA_UINT(*latestFrameSrc) < GHIDRA_UINT(this[3])) {
latestFrameSrc = this + 3;
}
*GHIDRA_CAST<NetplayManager *>((GHIDRA_INT(this[0x61b]) + 8 + iVar10)) = *latestFrameSrc;
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(this[0x61b]) + iVar10)) = 1;
}
iVar10 = iVar10 + 0x18;
local_54 = (void *)(GHIDRA_INT(local_54) + 1);
} while (local_54 < (void *)((GHIDRA_INT(local_40[1]) - GHIDRA_INT(*local_40)) / 0x18));
}
do {
if (g_multiplayerService == (void *)0x0) {
cVar3 = '\0';
}
else {
piVar12 = NetworkManager::receive_message
(g_multiplayerService,&removeMessage._isPlayerTypeForced,6,0);
isMessageReceived = *piVar12 != 0;
ehState = 5;
if (((local_84 != GHIDRA_CAST<int *>(0x0)) && (cVar3 = (**(code **)(*local_84 + 0xc))(), cVar3 != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)();
}
ehState = 0xffffffff;
cVar3 = isMessageReceived;
}
if (cVar3 == '\0') {
local_54 = *(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x60)));
iVar10 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x5c))));
uStack_68 = uStack_68 & 0xffffffff;
iVar5 = GHIDRA_INT(local_54) - iVar10 >> 0x1f;
if ((GHIDRA_INT(local_54) - iVar10) / 0x18 + iVar5 == iVar5) goto LAB_00911aa4;
iVar5 = 0;
local_70 = local_70 & 0xffffffff;
break;
}
if (g_multiplayerService == (void *)0x0) {
KAGE::SmartPointer<MessageData>::reset();
}
else {
(GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::receive_message(&message,6,1);
}
targetUserId = 0;
removeMessage._controllerIndex = 0;
removeMessage._playerType = 0;
removeMessage._state = 0;
removeMessage._menuPosition = 0.0;
ehState = 7;
piVar12 = GHIDRA_CAST<int *>(0x0);
local_50 = CONCAT44(local_5c,GHIDRA_CAST<undefined **>(local_50));
uStack_68 = CONCAT44(message,GHIDRA_INT(uStack_68));
if ((((local_5c != GHIDRA_CAST<NetplayManager *>(0x0)) &&
(cVar3 = (**(code **)(GHIDRA_INT(*local_5c) + 4))(), cVar3 != '\0')) && (piVar12 != GHIDRA_CAST<int *>(0x0)))
&& ((cVar3 = (**(code **)(*piVar12 + 0xc))(), cVar3 != '\0' &&
(g_multiplayerRelease != (void *)0x0)))) {
(*g_multiplayerRelease)(auStack_ba + -10);
}
RemovePlayerMessage::read();
local_54 = (void *)removeMessage._playerType;
removedPlayer = (GHIDRA_CAST<PlayerManager *>((GHIDRA_CAST<PlayerManager *>(this))))->PlayerManager::get_player_by_user_id(&targetUserId);
local_70 = CONCAT44(removedPlayer,(undefined4)local_70);
KAGE_LogMessage(1,(byte *)
"[FRAME: %d] Recieved eRemoveMessageType::MSG_REMOVE_FRAME from User(%llu), for User(%llu) \n"
);
uVar11 = 0;
uVar4 = (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x60)))) -
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x5c))))) / 0x18;
local_50 = CONCAT44(uVar4,GHIDRA_CAST<undefined **>(local_50));
if (uVar4 != 0) {
piVar12 = GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x5c)))) + 4));
do {
iVar10 = *GHIDRA_CAST<int *>((*piVar12 + 0x374));
if (iVar10 == 0) {
uStack_68 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_68)) + 0x4))) = GHIDRA_CAST<int *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_68)) + 0x0))) = 0;
iVar5 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(uStack_68))) + 0x4)));
iVar10 = GHIDRA_INT(uStack_68);
}
else {
iVar5 = *GHIDRA_CAST<int *>((iVar10 + 0xc));
iVar10 = *GHIDRA_CAST<int *>((iVar10 + 8));
}
if ((iVar10 == GHIDRA_INT(targetUserId)) && (iVar5 == (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(targetUserId)) + 0x4))))) {
iVar10 = uVar11 * 0x18;
entryFrameSrc =
(CoopJoinSlot *)
(*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x5c)))) + 8 + iVar10);
latestFrameSrc = &removeMessage;
if (GHIDRA_UINT(removeMessage._controllerIndex) <= GHIDRA_UINT(entryFrameSrc->_controllerIndex)) {
latestFrameSrc = entryFrameSrc;
}
*GHIDRA_CAST<int *>((iVar10 + 8 + *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x5c)))))) =
latestFrameSrc->_controllerIndex;
iVar10 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x5c)))) + iVar10;
senderIdHigh = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(message) + 4));
local_50 = CONCAT44(senderIdHigh,GHIDRA_CAST<undefined **>(local_50));
puVar1 = *GHIDRA_CAST<undefined4 **>((iVar10 + 0x10));
if (puVar1 == *GHIDRA_CAST<undefined4 **>((iVar10 + 0x14))) {
std::vector<8byte>::_Emplace_reallocate();
}
else {
*puVar1 = *GHIDRA_CAST<undefined4 *>(message);
puVar1[1] = senderIdHigh;
*GHIDRA_CAST<int *>((iVar10 + 0x10)) = *GHIDRA_CAST<int *>((iVar10 + 0x10)) + 8;
}
if ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_70)) + 0x4))) == GHIDRA_CAST<NetplayManager *>(0x0)) goto LAB_0091189c;
goto LAB_00911863;
}
uVar11 = uVar11 + 1;
piVar12 = piVar12 + 6;
} while (uVar11 < uVar4);
}
if ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_70)) + 0x4))) != GHIDRA_CAST<NetplayManager *>(0x0)) {
local_3c = ZEXT48((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_70)) + 0x4)))) << 0x20;
local_34[0] = '\0';
local_34[1] = '\0';
local_34[2] = '\0';
local_34[3] = '\0';
local_30 = (void *)0x0;
local_2c = 0;
uStack_68 = uStack_68 & 0xffffffff;
local_28 = 0;
ehState = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x1))),8);
puVar1 = *GHIDRA_CAST<undefined4 **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x60))));
if (puVar1 == *GHIDRA_CAST<undefined4 **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x64))))) {
FUN_00914ba0();
uStack_68 = CONCAT44(local_28,GHIDRA_INT(uStack_68));
}
else {
*puVar1 = 0;
puVar1[1] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_70)) + 0x4)));
puVar1[2] = 0;
puVar1[3] = 0;
puVar1[4] = 0;
puVar1[5] = 0;
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x60)))) =
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x60)))) + 0x18;
}
pvVar7 = local_30;
latestFrameSrc = &removeMessage;
if (GHIDRA_UINT(removeMessage._controllerIndex) <
GHIDRA_UINT((GHIDRA_CAST<PlayerManager *>(this))->_coopSlots[0]._controllerIndex)) {
latestFrameSrc = (GHIDRA_CAST<PlayerManager *>(this))->_coopSlots;
}
*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x60)))) + -0x10)) =
latestFrameSrc->_controllerIndex;
iVar10 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x60))));
senderIdHigh = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(message) + 4));
local_80 = *message;
local_50 = CONCAT44(senderIdHigh,GHIDRA_CAST<undefined **>(local_50));
puVar1 = *GHIDRA_CAST<undefined4 **>((iVar10 + -8));
if (puVar1 == *GHIDRA_CAST<undefined4 **>((iVar10 + -4))) {
std::vector<8byte>::_Emplace_reallocate();
}
else {
*puVar1 = *GHIDRA_CAST<undefined4 *>(message);
puVar1[1] = senderIdHigh;
*GHIDRA_CAST<int *>((iVar10 + -8)) = *GHIDRA_CAST<int *>((iVar10 + -8)) + 8;
}
ehState = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x1))),7);
if (pvVar7 != (void *)0x0) {
uVar4 = ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(uStack_68))) + 0x4))) - GHIDRA_INT(pvVar7) >> 3) * 8;
ptr = pvVar7;
if (0xfff < uVar4) {
ptr = *(void **)(GHIDRA_CAST<char *>(pvVar7) + -4);
uVar4 = uVar4 + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(pvVar7) + (-4 - GHIDRA_INT(ptr))))) {
LAB_00911409:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(ptr,uVar4);
}
LAB_00911863:
uVar4 = 0;
iVar10 = removeMessage._state - GHIDRA_INT(local_54) >> 4;
local_50 = CONCAT44(iVar10,GHIDRA_CAST<undefined **>(local_50));
if (iVar10 != 0) {
uStack_68 = CONCAT44((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(local_70))) + 0x4))) + 0x3a0,GHIDRA_INT(uStack_68));
do {
FUN_00901070();
uVar4 = uVar4 + 1;
this = GHIDRA_CAST<NetplayManager *>(self);
} while (uVar4 < (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_50)) + 0x4))));
}
}
LAB_0091189c:
ehState = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(ehState)) + 0x1))),6);
if (local_54 != (void *)0x0) {
uVar4 = GHIDRA_INT(removeMessage._menuPosition) - GHIDRA_INT(local_54) & 0xfffffff0;
pvVar7 = local_54;
if (0xfff < uVar4) {
pvVar7 = *(void **)(GHIDRA_INT(local_54) - 4);
uVar4 = uVar4 + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_54) + (-4 - GHIDRA_INT(pvVar7))))) goto LAB_00911409;
}
operator_delete(pvVar7,uVar4);
}
ehState = 9;
if (((local_5c != GHIDRA_CAST<NetplayManager *>(0x0)) &&
(cVar3 = (**(code **)(GHIDRA_INT(*local_5c) + 0xc))(), cVar3 != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)();
}
ehState = 0xffffffff;
} while( true );
LAB_00911940:
iVar5 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar10 + 4 + iVar5)) + 0x374));
if (iVar5 == 0) {
local_80 = 0;
local_40 = GHIDRA_CAST<NetplayManager *>(0x0);
local_5c = GHIDRA_CAST<NetplayManager *>(0x0);
}
else {
local_5c = *GHIDRA_CAST<NetplayManager **>((iVar5 + 8));
local_40 = *GHIDRA_CAST<NetplayManager **>((iVar5 + 0xc));
}
iVar5 = GHIDRA_INT(local_54) - iVar10;
local_54 = (void *)0x0;
iVar5 = iVar5 / 0x18;
local_50 = CONCAT44(iVar5,GHIDRA_CAST<undefined **>(local_50));
if (iVar5 == 0) {
LAB_00911c37:
KAGE_LogMessage(8,(byte *)
"[Frame %d] IsPlayerRemoveConfirmed() given User ID (%llu) that is not pending removal! \n"
);
LAB_00911a68:
}
else {
do {
userImpl = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar10 + 4)) + 0x374));
if (userImpl == 0) {
local_80 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_80)) + 0x4))) = GHIDRA_CAST<NetplayManager *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_80)) + 0x0))) = GHIDRA_CAST<NetplayManager *>(0x0);
latestFrameSrc = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_80)) + 0x4)));
pNVar9 = GHIDRA_CAST<NetplayManager *>(local_80);
}
else {
latestFrameSrc = *GHIDRA_CAST<NetplayManager **>((userImpl + 0xc));
pNVar9 = *GHIDRA_CAST<NetplayManager **>((userImpl + 8));
}
if ((pNVar9 == local_5c) && (latestFrameSrc == local_40)) {
local_54 = (void *)iVar10;
}
iVar10 = iVar10 + 0x18;
iVar5 = iVar5 + -1;
} while (iVar5 != 0);
this = GHIDRA_CAST<NetplayManager *>(self);
if (local_54 == (void *)0x0) goto LAB_00911c37;
local_40 = (self->_playerList)._begin;
iVar10 = GHIDRA_INT((self->_playerList)._end) - GHIDRA_INT(local_40) >> 2;
local_50 = CONCAT44(iVar10,GHIDRA_CAST<undefined **>(local_50));
local_5c = GHIDRA_CAST<NetplayManager *>(0x0);
latestFrameSrc = GHIDRA_CAST<NetplayManager *>(0x0);
if (iVar10 != 0) {
do {
iVar10 = *GHIDRA_CAST<int *>((GHIDRA_INT(*local_40) + 0x374));
if (iVar10 == 0) {
local_80 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_80)) + 0x4))) = GHIDRA_CAST<NetplayManager *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_80)) + 0x0))) = GHIDRA_CAST<NetplayManager *>(0x0);
iVar5 = GHIDRA_INT(GHIDRA_CAST<NetplayManager *>(local_80));
iVar10 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(local_80))) + 0x4)));
}
else {
iVar5 = *GHIDRA_CAST<int *>((iVar10 + 8));
iVar10 = *GHIDRA_CAST<int *>((iVar10 + 0xc));
}
isInPlayerList = is_player_removal_queued(GHIDRA_CAST<NetplayManager *>(self),CONCAT44(iVar10,iVar5));
if (isInPlayerList == 0) {
uVar4 = 0;
piVar12 = *GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(local_54) + 0xc));
uVar11 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_54) + 0x10)) - GHIDRA_INT(piVar12) >> 3;
if (uVar11 == 0) {
LAB_00911a65:
this = GHIDRA_CAST<NetplayManager *>(self);
goto LAB_00911a68;
}
while ((*piVar12 != iVar5 || (piVar12[1] != iVar10))) {
uVar4 = uVar4 + 1;
piVar12 = piVar12 + 2;
if (uVar11 <= uVar4) goto LAB_00911a65;
}
}
local_5c = GHIDRA_CAST<NetplayManager *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((local_5c)) + 0x1))));
local_40 = local_40 + 1;
} while (local_5c < (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_50)) + 0x4))));
latestFrameSrc = local_5c;
}
local_5c = latestFrameSrc;
this = GHIDRA_CAST<NetplayManager *>(self);
if (*GHIDRA_CAST<uint *>((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(self[0x1c])) + 0x5c)))) + 8 + (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(local_70))) + 0x4))))) <=
GHIDRA_UINT(self->_coopSlots[0]._controllerIndex)) {
*GHIDRA_CAST<undefined4 *>((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(self[0x1c])) + 0x5c)))) + (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(local_70))) + 0x4))))) = 2;
}
}
local_54 = *(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x60)));
iVar5 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(local_70))) + 0x4))) + 0x18;
iVar10 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x5c))));
uVar4 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(uStack_68))) + 0x4))) + 1;
uStack_68 = CONCAT44(uVar4,GHIDRA_INT(uStack_68));
local_70 = CONCAT44(iVar5,(undefined4)local_70);
if (GHIDRA_UINT(((GHIDRA_INT(local_54) - iVar10) / 0x18)) <= uVar4) {
LAB_00911aa4:
uVar11 = (GHIDRA_INT(local_54) - iVar10) / 0x18;
uVar4 = uVar11 - 1;
uStack_68 = CONCAT44(uVar4,GHIDRA_INT(uStack_68));
if (uVar4 < uVar11) {
local_54 = (void *)(uVar4 * 0x18);
do {
if (*GHIDRA_CAST<int *>((iVar10 + GHIDRA_INT(local_54))) == 2) {
RemoveRemotePlayer(this,(void *)(*GHIDRA_CAST<int *>((iVar10 + GHIDRA_INT(local_54) + 4)) + 0x370));
local_40 = (NetplayManager *)
(*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x5c)))) + GHIDRA_INT(local_54));
pNVar9 = *GHIDRA_CAST<NetplayManager **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x60))));
latestFrameSrc = local_40 + 6;
local_50 = CONCAT44(latestFrameSrc,GHIDRA_CAST<undefined **>(local_50));
local_5c = pNVar9;
if (latestFrameSrc != pNVar9) {
dstField = local_40 + 5;
srcField = local_40 + 0xb;
local_70 = CONCAT44(dstField,(undefined4)local_70);
do {
*local_40 = *latestFrameSrc;
dstField[-4] = srcField[-4];
dstField[-3] = srcField[-3];
if (dstField != srcField) {
std::vector<Vector>::_Tidy();
dstField[-2] = srcField[-2];
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_70)) + 0x4)))[-1] = srcField[-1];
*(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_70)) + 0x4))) = *srcField;
srcField[-2] = (NetplayManager)0x0;
srcField[-1] = (NetplayManager)0x0;
*srcField = (NetplayManager)0x0;
dstField = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_70)) + 0x4)));
pNVar9 = local_5c;
}
local_40 = local_40 + 6;
latestFrameSrc = GHIDRA_CAST<NetplayManager *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(local_50))) + 0x4))) + 0x18));
dstField = dstField + 6;
local_50 = CONCAT44(latestFrameSrc,GHIDRA_CAST<undefined **>(local_50));
srcField = srcField + 6;
local_70 = CONCAT44(dstField,(undefined4)local_70);
} while (latestFrameSrc != pNVar9);
this = GHIDRA_CAST<NetplayManager *>(self);
}
std::vector<Vector>::_Tidy();
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x60)))) =
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x60)))) + -0x18;
uVar4 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(uStack_68))) + 0x4)));
}
local_54 = (void *)(GHIDRA_INT(local_54) + -0x18);
iVar10 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x5c))));
uVar4 = uVar4 - 1;
uStack_68 = CONCAT44(uVar4,GHIDRA_INT(uStack_68));
} while (uVar4 < GHIDRA_UINT(((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<PlayerManager *>((GHIDRA_INT(this) + 0x1810))))) + 0x60)))) - iVar10
) / 0x18)));
}
ExceptionList = savedExceptionList;
return;
}
goto LAB_00911940;
}
// 00911c70
void NetplayManager::update_revives()
{
undefined4 *puVar1;
char isLastRef;
uint uVar2;
NetplayManager *entryFramePtr;
int iVar3;
int *piVar4;
Entity_Player *player;
NetplayManager *pNVar5;
uint *puVar6;
NetplayManager NVar7;
uint uVar8;
int queueEntry;
NetplayManager NVar9;
int *piVar10;
PlayerManager *playerManager;
int iVar11;
void *pvVar12;
undefined1 *messageRefCount;
undefined4 newRevive [2];
int iStack_88;
int iStack_84;
int iStack_80;
void *pvStack_7c;
undefined4 uStack_78;
int iStack_74;
undefined4 reviveMessage;
undefined4 reviveUserIdHigh;
undefined8 local_68;
ulonglong confirmUserId;
ulonglong senderUserId;
NetplayManager local_4c;
undefined8 local_48;
NetplayManager local_40;
NetplayManager local_3c;
undefined4 local_38;
int *local_34;
NetplayManager local_30;
int *local_2c;
NetplayManager *reviveQueue;
PlayerManager *netplayManager;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
Game *game;
Manager *manager;
NetplayManager playerListBegin;
local_14 = 0xffffffff;
puStack_18 = &LAB_00b0987d;
local_1c = ExceptionList;
puStack_20 = GHIDRA_CAST<undefined1 *>((GHIDRA_INT(register0x00000010) + -4));
uVar2 = __security_cookie ^ GHIDRA_UINT((newRevive + 0x20));
ExceptionList = &local_1c;
netplayManager = GHIDRA_CAST<PlayerManager *>(this);
NVar9 = this[0x61e];
pNVar5 = this + 0x61e;
local_30 = (NetplayManager)0x0;
reviveQueue = pNVar5;
if (GHIDRA_INT(this[0x61f]) - GHIDRA_INT(NVar9) >> 5 != 0) {
iVar11 = 0;
do {
if (*GHIDRA_CAST<int *>((iVar11 + GHIDRA_INT(NVar9))) == 0) {
local_4c = (NetplayManager)
(netplayManager->_coopSlots[0]._playerType +
netplayManager->_coopSlots[0]._controllerIndex);
entryFramePtr = GHIDRA_CAST<NetplayManager *>((GHIDRA_INT(NVar9) + 0x10 + iVar11));
pNVar5 = &local_4c;
if (GHIDRA_UINT(local_4c) <= GHIDRA_UINT(*entryFramePtr)) {
pNVar5 = entryFramePtr;
}
reviveMessage = *GHIDRA_CAST<undefined4 *>((iVar11 + 8 + GHIDRA_INT(NVar9)));
local_4c = *pNVar5;
reviveUserIdHigh = *GHIDRA_CAST<undefined4 *>((iVar11 + 0xc + GHIDRA_INT(NVar9)));
local_68 = CONCAT44((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_68)) + 0x4))),local_4c);
if (g_multiplayerService == (void *)0x0) {
KAGE_LogMessage(0x10,(byte *)
"Attempting to create a message when there is no multiplayer service\n"
);
}
messageRefCount = &DAT_00000007;
pvVar12 = (void *)0x10;
NetConnection::send_message(g_multiplayerService,&local_40,1,&reviveMessage,0x10,7);
manager = g_manager;
local_14 = 0;
FUN_008ef1d0(&local_40);
send_message(&manager->_netplayManager,8,pvVar12,messageRefCount);
local_14 = 1;
if (((local_3c != (NetplayManager)0x0) &&
(isLastRef = (**(code **)(*GHIDRA_CAST<int *>(local_3c) + 0xc))(), isLastRef != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)(&local_40);
}
local_14 = 0xffffffff;
queueEntry = GHIDRA_INT(*reviveQueue) + iVar11;
iVar3 = FUN_0090b070();
iVar3 = *GHIDRA_CAST<int *>((iVar3 + 0x374));
if (iVar3 == 0) {
local_48 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_48)) + 0x4))) = GHIDRA_CAST<uint *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_48)) + 0x0))) = 0;
local_38 = (undefined4)local_48;
local_34 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<int *>(local_48))) + 0x4)));
}
else {
local_38 = *GHIDRA_CAST<undefined4 *>((iVar3 + 8));
local_34 = *GHIDRA_CAST<int **>((iVar3 + 0xc));
}
puVar1 = *GHIDRA_CAST<undefined4 **>((queueEntry + 0x18));
if (puVar1 == *GHIDRA_CAST<undefined4 **>((queueEntry + 0x1c))) {
std::vector<8byte>::_Emplace_reallocate(puVar1,&local_38);
}
else {
*puVar1 = local_38;
puVar1[1] = local_34;
*GHIDRA_CAST<int *>((queueEntry + 0x18)) = *GHIDRA_CAST<int *>((queueEntry + 0x18)) + 8;
}
*GHIDRA_CAST<NetplayManager *>((GHIDRA_INT(*reviveQueue) + 0x10 + iVar11)) = local_4c;
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(*reviveQueue) + iVar11)) = 1;
pNVar5 = reviveQueue;
}
local_30 = (NetplayManager)(GHIDRA_INT(local_30) + 1);
NVar9 = *pNVar5;
iVar11 = iVar11 + 0x20;
} while (GHIDRA_UINT(local_30) < GHIDRA_UINT((GHIDRA_INT(pNVar5[1]) - GHIDRA_INT(NVar9) >> 5)));
}
LAB_00911e30:
pNVar5 = reviveQueue;
if (g_multiplayerService != (void *)0x0) {
piVar4 = (GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::receive_message(&local_38,7,0);
iVar11 = *piVar4;
local_14 = 2;
if (((local_34 != GHIDRA_CAST<int *>(0x0)) &&
(isLastRef = (**(code **)(*local_34 + 0xc))(uVar2), isLastRef != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)(&local_38);
}
local_14 = 0xffffffff;
if (iVar11 != 0) {
if (g_multiplayerService == (void *)0x0) {
KAGE::SmartPointer<MessageData>::reset(0);
}
else {
(GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::receive_message(&local_40,7,1);
}
NVar9 = local_40;
local_14 = 3;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(senderUserId)) + 0x0))) = *GHIDRA_CAST<NetplayManager *>(local_40);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(senderUserId)) + 0x4))) = *GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(local_40) + 4));
player = (GHIDRA_CAST<PlayerManager *>((netplayManager)))->PlayerManager::get_player_by_user_id(&senderUserId);
if (player != GHIDRA_CAST<Entity_Player *>(0x0)) {
local_4c = NVar9;
if (*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(NVar9) + 0xc)) != (NetplayManager)0x1) {
KAGE_LogMessage(0x10,(byte *)
"This function should only be called on consolidated messages");
}
iVar11 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(local_4c) + 8))) + 0x14));
local_2c = GHIDRA_CAST<int *>((iVar11 + 8));
local_48 = CONCAT44(iVar11 + 0x10,(undefined4)local_48);
KAGE_LogMessage(1,(byte *)
"[FRAME: %d] Recieved Message_RevivePlayer from User(%llu), for User(%llu), Revive Frame = %d \n"
);
piVar4 = local_2c;
NVar9 = *pNVar5;
local_30 = (NetplayManager)0x0;
local_4c = (NetplayManager)(GHIDRA_INT(pNVar5[1]) - GHIDRA_INT(NVar9) >> 5);
if (local_4c != (NetplayManager)0x0) {
do {
if ((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(NVar9) + 8)) == *local_2c) &&
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(NVar9) + 0xc)) == local_2c[1])) {
if (NVar9 != (NetplayManager)0x0) {
NVar7 = (NetplayManager)0x0;
pNVar5 = *GHIDRA_CAST<NetplayManager **>((GHIDRA_CAST<char *>(NVar9) + 0x14));
local_4c = (NetplayManager)(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(NVar9) + 0x18)) - GHIDRA_INT(pNVar5) >> 3);
if (local_4c == (NetplayManager)0x0) goto LAB_00912059;
local_30 = *GHIDRA_CAST<NetplayManager *>(local_40);
goto LAB_00912042;
}
break;
}
local_30 = (NetplayManager)(GHIDRA_INT(local_30) + 1);
NVar9 = (NetplayManager)(GHIDRA_INT(NVar9) + 0x20);
} while (GHIDRA_UINT(local_30) < GHIDRA_UINT(local_4c));
}
KAGE_LogMessage(1,(byte *)
"[FRAME: %d] - No pending revival found for user(%llu), creating one \n");
iStack_88 = *piVar4;
iStack_84 = piVar4[1];
newRevive[0] = 0;
iStack_80 = 0;
pvStack_7c = (void *)0x0;
uStack_78 = 0;
iStack_74 = 0;
local_14 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),4);
local_68 = *GHIDRA_CAST<undefined8 *>(local_40);
std::vector<8byte>::_Emplace_reallocate(0,&local_68);
iStack_80 = piVar4[2];
puVar1 = *GHIDRA_CAST<undefined4 **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(netplayManager[0x1c])) + 0x6c))));
if (puVar1 == netplayManager[0x1c]._coopPlayerTypes._begin) {
FUN_009149f0(puVar1,newRevive);
}
else {
*puVar1 = newRevive[0];
puVar1[2] = iStack_88;
puVar1[3] = iStack_84;
puVar1[4] = iStack_80;
FUN_00915d70(&pvStack_7c);
pNVar5[1] = (NetplayManager)(GHIDRA_INT(pNVar5[1]) + 0x20);
}
local_14 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),3);
if (pvStack_7c != (void *)0x0) {
uVar8 = (iStack_74 - GHIDRA_INT(pvStack_7c) >> 3) * 8;
pvVar12 = pvStack_7c;
if (0xfff < uVar8) {
pvVar12 = *(void **)(GHIDRA_CAST<char *>(pvStack_7c) + -4);
uVar8 = uVar8 + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(pvStack_7c) + (-4 - GHIDRA_INT(pvVar12))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar12,uVar8);
}
}
goto LAB_0091211f;
}
}
NVar9 = pNVar5[1];
NVar7 = *pNVar5;
local_30 = (NetplayManager)0x0;
if (GHIDRA_INT(NVar9) - GHIDRA_INT(NVar7) >> 5 == 0) {
LAB_009122d0:
uVar2 = GHIDRA_INT(NVar9) - GHIDRA_INT(NVar7) >> 5;
local_30 = (NetplayManager)(uVar2 - 1);
if (GHIDRA_UINT(local_30) < uVar2) {
local_2c = GHIDRA_CAST<int *>((GHIDRA_INT(local_30) * 0x20));
do {
game = g_game;
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(NVar7) + GHIDRA_INT(local_2c))) == 2) {
playerManager = &g_game->_playerManager;
local_4c = (NetplayManager)playerManager;
player = PlayerManager::get_player_by_user_id
(netplayManager,GHIDRA_CAST<ulonglong *>((GHIDRA_INT(local_2c) + 8 + GHIDRA_INT(NVar7))));
uVar2 = 0;
piVar4 = (playerManager->_playerList)._begin;
uVar8 = GHIDRA_INT((game->_playerManager)._playerList._end) - GHIDRA_INT(piVar4) >> 2;
if (uVar8 != 0) {
do {
iVar11 = piVar4[uVar2];
if (*(void **)(iVar11 + 0x1618) == (player->_damageEvents)._end) goto LAB_00912346;
uVar2 = uVar2 + 1;
} while (uVar2 < uVar8);
}
iVar11 = 0;
if (uVar8 != 0) {
LAB_00912346:
uVar2 = 0;
do {
if (*piVar4 == iVar11) goto LAB_00912357;
uVar2 = uVar2 + 1;
piVar4 = piVar4 + 1;
} while (uVar2 < uVar8);
}
uVar2 = 0xffffffff;
LAB_00912357:
PlayerManager::ReviveCoopPlayer(uVar2);
local_34 = GHIDRA_CAST<int *>((GHIDRA_INT(local_2c) + *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(netplayManager[0x1c])) + 0x68))))));
NVar9 = *GHIDRA_CAST<NetplayManager *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(netplayManager[0x1c])) + 0x6c))));
local_4c = (NetplayManager)(local_34 + 8);
local_3c = NVar9;
if (local_4c != NVar9) {
piVar4 = local_34 + 7;
piVar10 = local_34 + 0xf;
local_48 = CONCAT44(piVar4,(undefined4)local_48);
do {
*local_34 = *GHIDRA_CAST<int *>(local_4c);
iVar11 = piVar10[-4];
piVar4[-5] = piVar10[-5];
piVar4[-4] = iVar11;
piVar4[-3] = piVar10[-3];
if (piVar4 != piVar10) {
std::vector<Vector>::_Tidy();
piVar4[-2] = piVar10[-2];
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_48)) + 0x4)))[-1] = piVar10[-1];
*(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_48)) + 0x4))) = *piVar10;
piVar10[-2] = 0;
piVar10[-1] = 0;
*piVar10 = 0;
piVar4 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<int *>(local_48))) + 0x4)));
NVar9 = local_3c;
}
piVar4 = piVar4 + 8;
local_4c = (NetplayManager)(GHIDRA_INT(local_4c) + 0x20);
local_34 = local_34 + 8;
local_48 = CONCAT44(piVar4,(undefined4)local_48);
piVar10 = piVar10 + 8;
} while (local_4c != NVar9);
}
playerManager = netplayManager;
std::vector<Vector>::_Tidy();
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(playerManager[0x1c])) + 0x6c)))) = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(playerManager[0x1c])) + 0x6c)))) + -0x20;
pNVar5 = reviveQueue;
}
local_30 = (NetplayManager)(GHIDRA_INT(local_30) - 1);
NVar7 = *pNVar5;
local_2c = GHIDRA_CAST<int *>((GHIDRA_INT(local_2c) + -0x20));
} while (GHIDRA_UINT(local_30) < GHIDRA_UINT((GHIDRA_INT(pNVar5[1]) - GHIDRA_INT(NVar7) >> 5)));
}
ExceptionList = local_1c;
return;
}
local_2c = GHIDRA_CAST<int *>(0x0);
LAB_00912180:
piVar4 = local_2c;
uVar8 = 0;
uVar2 = GHIDRA_INT(NVar9) - GHIDRA_INT(NVar7) >> 5;
NVar9 = NVar7;
if (uVar2 != 0) {
local_4c = *GHIDRA_CAST<NetplayManager *>((GHIDRA_INT((GHIDRA_INT(NVar7) + 8)) + GHIDRA_INT(local_2c)));
iVar11 = *GHIDRA_CAST<int *>((GHIDRA_INT((GHIDRA_INT(NVar7) + 0xc)) + GHIDRA_INT(local_2c)));
local_48 = CONCAT44(iVar11,(undefined4)local_48);
local_3c = NVar7;
do {
if ((*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(NVar7) + 8)) == local_4c) &&
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(NVar7) + 0xc)) == iVar11)) {
NVar9 = local_3c;
if (NVar7 != (NetplayManager)0x0) {
local_34 = GHIDRA_CAST<int *>(0x0);
playerListBegin = (NetplayManager)(netplayManager->_playerList)._begin;
piVar10 = GHIDRA_CAST<int *>((GHIDRA_INT((netplayManager->_playerList)._end) - GHIDRA_INT(playerListBegin) >> 2));
local_48 = CONCAT44(piVar10,(undefined4)local_48);
local_3c = playerListBegin;
if (piVar10 == GHIDRA_CAST<int *>(0x0)) goto LAB_00912262;
local_4c = *GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(NVar7) + 0x14));
uVar2 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(NVar7) + 0x18)) - GHIDRA_INT(local_4c) >> 3;
goto LAB_00912202;
}
break;
}
uVar8 = uVar8 + 1;
NVar7 = (NetplayManager)(GHIDRA_INT(NVar7) + 0x20);
NVar9 = *GHIDRA_CAST<NetplayManager *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(netplayManager[0x1c])) + 0x68))));
local_3c = NVar9;
} while (uVar8 < uVar2);
}
goto LAB_00912283;
while( true ) {
NVar7 = (NetplayManager)(GHIDRA_INT(NVar7) + 1);
pNVar5 = pNVar5 + 2;
if (GHIDRA_UINT(local_4c) <= GHIDRA_UINT(NVar7)) break;
LAB_00912042:
if ((*pNVar5 == local_30) && (pNVar5[1] == *GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(local_40) + 4)))) {
KAGE_LogMessage(8,(byte *)
"[FRAME: %d] - User(%llu) has already confirmed revival for User(%llu)! \n")
;
goto LAB_0091211f;
}
}
LAB_00912059:
KAGE_LogMessage(1,(byte *)
"[FRAME: %d] - Adding revival confirmation to existing pending revival \n");
puVar6 = GHIDRA_CAST<uint *>((GHIDRA_INT(NVar9) + 0x10));
if (*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(NVar9) + 0x10)) < *(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_48)) + 0x4)))) {
puVar6 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_48)) + 0x4)));
}
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(NVar9) + 0x10)) = *puVar6;
pNVar5 = *GHIDRA_CAST<NetplayManager **>((GHIDRA_CAST<char *>(NVar9) + 0x18));
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(confirmUserId)) + 0x0))) = *GHIDRA_CAST<NetplayManager *>(local_40);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(confirmUserId)) + 0x4))) = *GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(local_40) + 4));
if (pNVar5 == *GHIDRA_CAST<NetplayManager **>((GHIDRA_CAST<char *>(NVar9) + 0x1c))) {
std::vector<8byte>::_Emplace_reallocate(pNVar5,&confirmUserId);
}
else {
*pNVar5 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(confirmUserId)) + 0x0)));
pNVar5[1] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(confirmUserId)) + 0x4)));
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(NVar9) + 0x18)) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(NVar9) + 0x18)) + 8;
}
LAB_0091211f:
local_14 = 5;
if (((local_3c != (NetplayManager)0x0) &&
(isLastRef = (**(code **)(*GHIDRA_CAST<int *>(local_3c) + 0xc))(), isLastRef != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)(&local_40);
}
local_14 = 0xffffffff;
goto LAB_00911e30;
while( true ) {
NVar9 = local_4c;
while ((*GHIDRA_CAST<int *>(NVar9) != iVar3 || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(NVar9) + 4)) != iVar11))) {
uVar8 = uVar8 + 1;
NVar9 = (NetplayManager)(GHIDRA_INT(NVar9) + 8);
if (uVar2 <= uVar8) goto LAB_00912241;
}
local_34 = GHIDRA_CAST<int *>((GHIDRA_INT(local_34) + 1));
local_3c = (NetplayManager)(GHIDRA_INT(local_3c) + 4);
if (piVar10 <= local_34) break;
LAB_00912202:
iVar11 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(local_3c) + 0x374));
if (iVar11 == 0) {
local_68 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_68)) + 0x4))) = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_68)) + 0x0))) = 0;
iVar3 = GHIDRA_INT(local_68);
iVar11 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_68)) + 0x4)));
}
else {
iVar3 = *GHIDRA_CAST<int *>((iVar11 + 8));
iVar11 = *GHIDRA_CAST<int *>((iVar11 + 0xc));
}
uVar8 = 0;
if (uVar2 == 0) {
LAB_00912241:
NVar9 = *reviveQueue;
goto LAB_00912283;
}
}
NVar9 = *reviveQueue;
LAB_00912262:
if (netplayManager->_coopSlots[0]._controllerIndex ==
(GHIDRA_CAST<undefined4 *>((GHIDRA_INT(NVar9) + GHIDRA_INT(local_2c))))[4]) {
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(NVar9) + GHIDRA_INT(local_2c))) = 2;
}
else {
LAB_00912283:
if (*GHIDRA_CAST<uint *>((GHIDRA_INT((GHIDRA_INT(NVar9) + 0x10)) + GHIDRA_INT(local_2c))) <
GHIDRA_UINT(netplayManager->_coopSlots[0]._controllerIndex)) {
KAGE_LogMessage(8,(byte *)
"[FRAME: %d] Revival Frame for User(%llu) has passed without being revived! (Revive Frame = %d) \n"
);
}
}
local_2c = GHIDRA_CAST<int *>((GHIDRA_INT(piVar4) + 0x20));
local_30 = (NetplayManager)(GHIDRA_INT(local_30) + 1);
NVar9 = reviveQueue[1];
NVar7 = *reviveQueue;
pNVar5 = reviveQueue;
if (GHIDRA_UINT((GHIDRA_INT(NVar9) - GHIDRA_INT(NVar7) >> 5)) <= GHIDRA_UINT(local_30)) goto LAB_009122d0;
goto LAB_00912180;
}
// 00912450
void NetplayManager::remove_drop_entry(ulonglong userId)
{
int iVar1;
NetplayManager entriesEnd;
uint index;
NetplayManager nextEntry;
uint entryCount;
int *piVar2;
int *nextSet;
undefined4 userIdHigh;
nextEntry = this[0x616];
index = 0;
entryCount = GHIDRA_INT(this[0x617]) - GHIDRA_INT(nextEntry) >> 4;
if (entryCount != 0) {
while ((*GHIDRA_CAST<int *>(nextEntry) != GHIDRA_INT(userId) ||
(GHIDRA_CAST<undefined4 *>(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(nextEntry) + 4))) != (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(userId)) + 0x4)))))) {
index = index + 1;
nextEntry = (NetplayManager)(GHIDRA_INT(nextEntry) + 0x10);
if (entryCount <= index) {
return;
}
}
entriesEnd = this[0x617];
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(userId)) + 0x4))) = GHIDRA_CAST<undefined4 *>((GHIDRA_INT(this[0x616]) + index * 0x10));
nextEntry = (NetplayManager)((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(userId)) + 0x4))) + 4);
if (nextEntry != entriesEnd) {
nextSet = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(userId)) + 0x4))) + 6;
piVar2 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(userId)) + 0x4))) + 2;
do {
userIdHigh = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(nextEntry) + 4));
*(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(userId)) + 0x4))) = *GHIDRA_CAST<undefined4 *>(nextEntry);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(userId)) + 0x4)))[1] = userIdHigh;
if (piVar2 != nextSet) {
iVar1 = *piVar2;
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(piVar2,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)piVar2,
*(_Tree_node<unsigned_int,void*> **)(iVar1 + 4));
*GHIDRA_CAST<int *>((iVar1 + 4)) = iVar1;
*GHIDRA_CAST<int *>(iVar1) = iVar1;
*GHIDRA_CAST<int *>((iVar1 + 8)) = iVar1;
piVar2[1] = 0;
iVar1 = *piVar2;
*piVar2 = *nextSet;
*nextSet = iVar1;
iVar1 = piVar2[1];
piVar2[1] = nextSet[1];
nextSet[1] = iVar1;
}
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(userId)) + 0x4))) = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(userId)) + 0x4))) + 4;
nextEntry = (NetplayManager)(GHIDRA_INT(nextEntry) + 0x10);
nextSet = nextSet + 4;
piVar2 = piVar2 + 4;
} while (nextEntry != entriesEnd);
entriesEnd = this[0x617];
}
piVar2 = GHIDRA_CAST<int *>((GHIDRA_INT(entriesEnd) + -8));
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(piVar2,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)piVar2,
*(_Tree_node<unsigned_int,void*> **)(*piVar2 + 4));
operator_delete((void *)*piVar2,0x20);
this[0x617] = (NetplayManager)(GHIDRA_INT(this[0x617]) + -0x10);
}
return;
}
// 00912560
void NetplayManager::receive_vote_end_message()
{
undefined4 uVar1;
char isLastReference;
uint uVar2;
int *peekResult;
NetplayManager NVar3;
int iVar4;
int iVar5;
void *pvVar6;
undefined4 *profileEntry;
int iVar8;
void *missingProfiles;
undefined4 *missingProfilesEnd;
undefined4 *missingProfilesCapacity;
undefined8 local_50;
undefined1 local_48 [4];
int *peekRefCount;
undefined4 *voteMessage;
int *voteMessageRefCount;
Game *game;
NetplayManager *netplayManager;
uint entryCount;
void *local_2c;
NetplayManager local_28;
void *local_24;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
undefined4 *profileEntry;
puStack_20 = local_48 + 0x44;
puStack_18 = &LAB_00b098b5;
local_1c = ExceptionList;
uVar2 = __security_cookie ^ GHIDRA_UINT((local_48 + 0x38));
ExceptionList = &local_1c;
netplayManager = this;
while (local_14 = 0xffffffff, g_multiplayerService != (void *)0x0) {
peekResult = (GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::receive_message(local_48,8,0);
iVar8 = *peekResult;
local_14 = 0;
if (((peekRefCount != GHIDRA_CAST<int *>(0x0)) &&
(isLastReference = (**(code **)(*peekRefCount + 0xc))(uVar2), isLastReference != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)(local_48);
}
local_14 = 0xffffffff;
if (iVar8 == 0) break;
if (g_multiplayerService == (void *)0x0) {
KAGE::SmartPointer<MessageData>::reset(0);
}
else {
(GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::receive_message(&voteMessage,8,1);
}
local_14 = 1;
KAGE_LogMessage(1,GHIDRA_CAST<byte *>("[Frame: %d] Recieved Vote End message from user %llu \n"));
profileEntry = voteMessage;
if (voteMessage[3] != 1) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("This function should only be called on consolidated messages"));
}
FUN_0090a4b0(*voteMessage,voteMessage[1],*GHIDRA_CAST<undefined4 *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(profileEntry[2]) + 0x14)) + 8))
,*GHIDRA_CAST<undefined4 *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(profileEntry[2]) + 0x14)) + 0xc)));
local_14 = 2;
if (((voteMessageRefCount != GHIDRA_CAST<int *>(0x0)) &&
(isLastReference = (**(code **)(*voteMessageRefCount + 0xc))(), isLastReference != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)(&voteMessage);
}
}
local_14 = 0xffffffff;
entryCount = GHIDRA_INT(this[0x622]) - GHIDRA_INT(this[0x621]) >> 4;
if (entryCount != 0) {
local_28 = *this;
local_24 = (void *)0x0;
local_2c = (void *)(GHIDRA_INT(this[1]) - GHIDRA_INT(local_28) >> 2);
if (local_2c != (void *)0x0) {
do {
uVar2 = 0;
iVar8 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(local_28) + 0x374));
NVar3 = this[0x621];
while( true ) {
if (iVar8 == 0) {
local_50 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_50)) + 0x4))) = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_50)) + 0x0))) = 0;
iVar4 = GHIDRA_INT(local_50);
iVar5 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_50)) + 0x4)));
}
else {
iVar4 = *GHIDRA_CAST<int *>((iVar8 + 8));
iVar5 = *GHIDRA_CAST<int *>((iVar8 + 0xc));
}
if (((*GHIDRA_CAST<int *>(NVar3) == iVar4) && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(NVar3) + 4)) == iVar5)) &&
(GHIDRA_UINT(*GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<char *>(NVar3) + 0xc))) <= GHIDRA_UINT(netplayManager[3]))) break;
uVar2 = uVar2 + 1;
NVar3 = (NetplayManager)(GHIDRA_INT(NVar3) + 0x10);
if (entryCount <= uVar2) {
ExceptionList = local_1c;
return;
}
}
local_24 = (void *)(GHIDRA_INT(local_24) + 1);
local_28 = (NetplayManager)(GHIDRA_INT(local_28) + 4);
} while (local_24 < local_2c);
}
game = g_game;
if (((g_game->_genericPrompt)._sprite._animState._animData != (void *)0x0) &&
((g_game->_genericPrompt)._sprite._animState._isPlaying != 0)) {
KAGE_LogMessage(1,GHIDRA_CAST<byte *>("[Frame: %d] Victory lap vote processed \n"));
GenericPrompt::Disappear(&(g_game->_genericPrompt)._sprite);
local_24 = (void *)0x1;
profileEntry = GHIDRA_CAST<undefined4 *>(0x0);
missingProfiles = (void *)0x0;
missingProfilesEnd = GHIDRA_CAST<undefined4 *>(0x0);
local_28 = (NetplayManager)0x0;
missingProfilesCapacity = GHIDRA_CAST<undefined4 *>(0x0);
local_14 = 3;
pvVar6 = *(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(g_manager[1]._gamestate)) + 0x8dc)));
entryCount = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(g_manager[1]._gamestate)) + 0x8e0)))) - GHIDRA_INT(pvVar6) >> 4;
if (entryCount != 0) {
iVar8 = 0;
do {
profileEntry = GHIDRA_CAST<undefined4 *>((GHIDRA_INT(pvVar6) + iVar8));
if (profileEntry[2] == 0) {
if ((NetplayManager)profileEntry == local_28) {
std::vector<8byte>::_Emplace_reallocate(profileEntry,profileEntry);
local_28 = (NetplayManager)missingProfilesCapacity;
profileEntry = missingProfilesEnd;
}
else {
uVar1 = profileEntry[1];
*profileEntry = *profileEntry;
profileEntry[1] = uVar1;
missingProfilesEnd = profileEntry + 2;
profileEntry = missingProfilesEnd;
}
}
if (g_userProfile == (void *)0x0) {
local_50 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_50)) + 0x4))) = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_50)) + 0x0))) = 0;
iVar4 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_50)) + 0x4)));
iVar5 = GHIDRA_INT(local_50);
}
else {
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_userProfile) + 0xc));
iVar5 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_userProfile) + 8));
}
pvVar6 = *(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(g_manager[1]._gamestate)) + 0x8dc)));
if ((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar6) + iVar8)) == iVar5) &&
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar6) + iVar8 + 4)) == iVar4)) {
local_24 = *(void **)(GHIDRA_CAST<char *>(pvVar6) + iVar8 + 8);
}
iVar8 = iVar8 + 0x10;
entryCount = entryCount + -1;
local_2c = pvVar6;
} while (entryCount != 0);
NVar3 = local_28;
if (local_24 == (void *)0x0) {
KAGE::Network::MultiplayerManager::request_user_profiles
(&DAT_00c79a60,&missingProfiles,pvVar6,game);
NVar3 = (NetplayManager)missingProfilesCapacity;
}
if (missingProfiles != (void *)0x0) {
uVar2 = GHIDRA_INT(NVar3) - GHIDRA_INT(missingProfiles) & 0xfffffff8;
pvVar6 = missingProfiles;
if (0xfff < uVar2) {
pvVar6 = *(void **)(GHIDRA_CAST<char *>(missingProfiles) + -4);
uVar2 = uVar2 + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(missingProfiles) + (-4 - GHIDRA_INT(pvVar6))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar6,uVar2);
}
}
}
netplayManager[0x622] = netplayManager[0x621];
}
ExceptionList = local_1c;
return;
}
// 009128e0
void NetplayManager::update_lobby_stage_info()
{
undefined1 *puVar1;
char cVar2;
int ownerInfo;
void *message;
NetplayManager messageRefCount;
undefined1 auStack_62 [2];
undefined1 stageMessage [20];
undefined **local_40;
int *lobbyImpl;
int *lobbyRefCount;
undefined **local_34;
undefined **ownerProfile;
undefined1 *local_28;
byte isLobbyOwner;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
puStack_20 = stageMessage + 0x50;
puStack_18 = &LAB_00b0991d;
local_1c = ExceptionList;
ExceptionList = &local_1c;
local_40 = KAGE::Network::Multiplayer::ConstLobby::vftable;
lobbyImpl = GHIDRA_CAST<int *>(0x0);
lobbyRefCount = GHIDRA_CAST<int *>(0x0);
local_14 = 0;
(GHIDRA_CAST<std::shared_ptr *>((&lobbyImpl)))->std::shared_ptr::assign(&g_multiplayerLobbyPtr);
local_40 = KAGE::Network::Multiplayer::Lobby::vftable;
local_14 = 1;
if (lobbyImpl == GHIDRA_CAST<int *>(0x0)) {
local_28 = GHIDRA_CAST<undefined1 *>(0x0);
}
else {
ownerInfo = (**(code **)(*lobbyImpl + 0x20))();
local_28 = *GHIDRA_CAST<undefined1 **>((ownerInfo + 4));
local_34 = KAGE::System::UserProfileBase::vftable;
}
ownerProfile = KAGE::System::UserProfile::vftable;
local_14 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),2);
isLobbyOwner = (GHIDRA_CAST<KAGE::System::UserProfile *>((&ownerProfile)))->KAGE::System::UserProfile::is_local_user();
ownerProfile = KAGE::System::UserProfileBase::vftable;
local_40 = KAGE::Network::Multiplayer::ConstLobby::vftable;
local_14 = 3;
if (((lobbyRefCount != GHIDRA_CAST<int *>(0x0)) &&
(cVar2 = (**(code **)(*lobbyRefCount + 0xc))(), cVar2 != '\0')) &&
(g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)();
}
local_14 = 0xffffffff;
if (isLobbyOwner != 0) {
messageRefCount = this[0x630];
message = (void *)0x9129f1;
FUN_009187f0();
local_28 = auStack_62 + -10;
puVar1 = auStack_62 + -10;
if (g_multiplayerService == (void *)0x0) {
KAGE_LogMessage(0x10,(byte *)
"Attempting to create a message when there is no multiplayer service\n");
puVar1 = local_28;
}
local_28 = puVar1;
NetConnection::send_message(g_multiplayerService,auStack_62 + -10,1,stageMessage,0x14,0);
send_message(this,2,message,(void *)messageRefCount);
local_40 = KAGE::Network::Multiplayer::ConstLobby::vftable;
lobbyImpl = GHIDRA_CAST<int *>(0x0);
lobbyRefCount = GHIDRA_CAST<int *>(0x0);
local_14 = 4;
(GHIDRA_CAST<std::shared_ptr *>((&lobbyImpl)))->std::shared_ptr::assign(&g_multiplayerLobbyPtr);
local_40 = KAGE::Network::Multiplayer::Lobby::vftable;
local_14 = 5;
if (lobbyImpl != GHIDRA_CAST<int *>(0x0)) {
(**(code **)(*lobbyImpl + 0x24))();
}
local_40 = KAGE::Network::Multiplayer::ConstLobby::vftable;
local_14 = 6;
if (((lobbyRefCount != GHIDRA_CAST<int *>(0x0)) &&
(cVar2 = (**(code **)(*lobbyRefCount + 0xc))(), cVar2 != '\0')) &&
(g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)();
}
local_40 = KAGE::Network::Multiplayer::ConstLobby::vftable;
lobbyImpl = GHIDRA_CAST<int *>(0x0);
lobbyRefCount = GHIDRA_CAST<int *>(0x0);
local_14 = 7;
(GHIDRA_CAST<std::shared_ptr *>((&lobbyImpl)))->std::shared_ptr::assign(&g_multiplayerLobbyPtr);
local_40 = KAGE::Network::Multiplayer::Lobby::vftable;
local_14 = 8;
if (lobbyImpl != GHIDRA_CAST<int *>(0x0)) {
(**(code **)(*lobbyImpl + 0x24))();
}
local_40 = KAGE::Network::Multiplayer::ConstLobby::vftable;
local_14 = 9;
if (((lobbyRefCount != GHIDRA_CAST<int *>(0x0)) &&
(cVar2 = (**(code **)(*lobbyRefCount + 0xc))(), cVar2 != '\0')) &&
(g_lobbyReleaseFn != (void *)0x0)) {
(*g_lobbyReleaseFn)();
}
}
ExceptionList = local_1c;
return;
}
// 00916110
void NetplayManager::send_remove_frame(undefined4 param_1, undefined4 param_2)
{
undefined4 uVar1;
undefined4 uVar2;
undefined4 uVar3;
char isLastRef;
uint uVar4;
undefined4 *entriesEnd;
undefined4 *entriesCapacity;
void *pvVar5;
Entity_Player *message;
undefined1 *messageRefCount;
undefined **local_80;
void *local_7c;
undefined4 local_78;
void *streamBuffer;
void *local_70;
void *streamHeapBuffer;
undefined4 local_64;
undefined4 local_60;
undefined4 local_5c;
undefined **streamWriter;
void *local_54;
undefined4 *local_50;
undefined4 *local_4c;
undefined1 netMessage [4];
int *netMessageRefCount;
undefined4 local_40;
Entity_Player *local_3c;
undefined4 *local_34;
float local_30;
void *local_2c;
undefined4 *local_28;
undefined1 entryCountByte;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
Manager *manager;
puStack_20 = netMessage + 0x44;
local_14 = 0xffffffff;
puStack_18 = &LAB_00b09c8d;
local_1c = ExceptionList;
uVar4 = __security_cookie ^ GHIDRA_UINT((netMessage + 0x38));
ExceptionList = &local_1c;
(GHIDRA_CAST<KAGE::Filesys::BufferedStream *>((&local_80)))->KAGE::Filesys::BufferedStream::BufferedStream(0);
local_14 = 0;
local_34 = GHIDRA_CAST<undefined4 *>(0x0);
(*(code *)streamWriter[7])(&local_34,4,1,uVar4);
local_3c = GHIDRA_CAST<Entity_Player *>(param_2);
local_40 = param_1;
(*(code *)streamWriter[7])(&local_40,8,1);
(*(code *)streamWriter[7])(&local_34,4,1);
local_3c = PlayerManager::get_player_by_user_id
(GHIDRA_CAST<PlayerManager *>(&g_manager->_netplayManager),GHIDRA_CAST<ulonglong *>(&param_1));
entriesCapacity = GHIDRA_CAST<undefined4 *>(0x0);
local_2c = (void *)0x0;
entriesEnd = GHIDRA_CAST<undefined4 *>(0x0);
local_54 = (void *)0x0;
local_50 = GHIDRA_CAST<undefined4 *>(0x0);
local_34 = GHIDRA_CAST<undefined4 *>(0x0);
local_4c = GHIDRA_CAST<undefined4 *>(0x0);
local_14 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),1);
if ((local_3c != GHIDRA_CAST<Entity_Player *>(0x0)) &&
(local_30 = *GHIDRA_CAST<float *>(local_3c->_slowingAmount),
GHIDRA_CAST<int *>(local_30) != GHIDRA_CAST<int *>(local_3c->_slowingAmount))) {
do {
if (entriesEnd == entriesCapacity) {
std::vector<16byte>::_Emplace_reallocate(entriesEnd,GHIDRA_CAST<undefined4 *>((GHIDRA_INT(local_30) + 0x14)));
local_28 = local_50;
entriesCapacity = local_4c;
}
else {
uVar1 = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(local_30) + 0x18));
uVar2 = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(local_30) + 0x1c));
uVar3 = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(local_30) + 0x20));
*entriesEnd = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(local_30) + 0x14));
entriesEnd[1] = uVar1;
entriesEnd[2] = uVar2;
entriesEnd[3] = uVar3;
local_28 = entriesEnd + 4;
}
local_50 = local_28;
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>
*)&local_30);
entriesEnd = local_28;
} while (local_30 != local_3c->_slowingAmount);
local_2c = local_54;
local_34 = entriesCapacity;
}
entriesCapacity = local_34;
local_28 = GHIDRA_CAST<undefined4 *>((GHIDRA_INT(entriesEnd) - GHIDRA_INT(local_2c) >> 4));
entryCountByte = SUB41(local_28,0);
local_54 = local_2c;
(*(code *)streamWriter[7])(&entryCountByte,1,1);
entriesEnd = local_28;
local_30 = 0.0;
if (local_28 != GHIDRA_CAST<undefined4 *>(0x0)) {
pvVar5 = local_2c;
do {
buffered_stream_write(&streamWriter,pvVar5,0x10,1);
pvVar5 = (void *)(GHIDRA_INT(pvVar5) + 0x10);
local_30 = (float)(GHIDRA_INT(local_30) + 1);
} while (GHIDRA_UINT(local_30) < entriesEnd);
entriesCapacity = local_34;
}
local_3c = local_7c;
pvVar5 = streamBuffer;
if (streamHeapBuffer != (void *)0x0) {
pvVar5 = streamHeapBuffer;
}
if (g_multiplayerService == (void *)0x0) {
KAGE_LogMessage(0x10,(byte *)
"Attempting to create a message when there is no multiplayer service\n");
}
messageRefCount = &DAT_00000006;
message = local_3c;
NetConnection::send_message(g_multiplayerService,netMessage,1,pvVar5,GHIDRA_UINT(local_3c),6);
manager = g_manager;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
FUN_008ef1d0(netMessage);
send_message(&manager->_netplayManager,8,message,messageRefCount);
local_14 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),3);
if (((netMessageRefCount != GHIDRA_CAST<int *>(0x0)) &&
(isLastRef = (**(code **)(*netMessageRefCount + 0xc))(), isLastRef != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)(netMessage);
}
if (local_2c != (void *)0x0) {
uVar4 = GHIDRA_INT(entriesCapacity) - GHIDRA_INT(local_2c) & 0xfffffff0;
pvVar5 = local_2c;
if (0xfff < uVar4) {
pvVar5 = *(void **)(GHIDRA_CAST<char *>(local_2c) + -4);
uVar4 = uVar4 + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_2c) + (-4 - GHIDRA_INT(pvVar5))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar5,uVar4);
}
streamWriter = KAGE::Filesys::StreamBase::vftable;
local_80 = KAGE::Filesys::BufferedStreamBase::vftable;
local_7c = (void *)0x0;
local_78 = 0;
local_70 = streamBuffer;
streamHeapBuffer = (void *)0x0;
local_64 = 0;
local_60 = 0;
local_5c = 0;
FUN_007dcd30();
ExceptionList = local_1c;
return;
}
// 00916770
void NetplayManager::process_lobby_messages()
{
ulonglong *puVar1;
ulonglong *puVar2;
char cVar3;
int extraout_EAX;
void *member;
int *findResult;
int extraout_EAX_00;
undefined4 uVar4;
Manager *pMVar5;
int extraout_EAX_01;
int iVar6;
undefined1 *puVar7;
Manager *pMVar8;
undefined1 uStack_f0;
undefined4 uStack_e8;
void *pvStack_e4;
Manager *pMStack_e0;
void *pendingJoinNode;
NetplayManager stream;
int streamSize;
int local_d0;
void *local_cc;
int local_c8;
undefined4 local_c4;
void *streamData;
undefined4 local_bc;
undefined4 local_b8;
undefined4 local_b4;
undefined **streamVtable;
undefined **senderProfile [2];
ulonglong *local_a4;
int *messageRefCount;
Manager *pMStack_9c;
undefined1 replyMessage [4];
Manager *local_94;
Manager *senderIdLow;
Manager *senderIdHigh;
undefined8 uStack_88;
char *local_80;
byte messageSubtype;
undefined1 saveData [84];
uint stackCookie;
byte *pbStack_20;
void *local_1c;
undefined1 *puStack_18;
byte local_14 [4];
Manager *manager;
MenuManager *menuManager;
char *messageData;
pbStack_20 = local_14 + 0x10;
local_14[0] = 0xff;
local_14[1] = 0xff;
local_14[2] = 0xff;
local_14[3] = 0xff;
puStack_18 = &LAB_00b09d5f;
local_1c = ExceptionList;
stackCookie = __security_cookie ^ GHIDRA_UINT((local_14 + 4));
ExceptionList = &local_1c;
cVar3 = FUN_00a29b10(0);
if (cVar3 == '\0') {
ExceptionList = local_1c;
return;
}
if (g_multiplayerService == (void *)0x0) {
KAGE::SmartPointer<MessageData>::reset(0);
}
else {
(GHIDRA_CAST<NetworkManager *>((g_multiplayerService)))->NetworkManager::receive_message(&local_a4,0,1);
}
puVar1 = local_a4;
local_14[0] = 0;
local_14[1] = 0;
local_14[2] = 0;
local_14[3] = 0;
senderIdLow = *GHIDRA_CAST<Manager **>(local_a4);
senderIdHigh = *GHIDRA_CAST<Manager **>((GHIDRA_CAST<char *>(local_a4) + 4));
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_a4) + 0xc)) != 1) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("This function should only be called on consolidated messages"));
}
puVar2 = local_a4;
local_80 = GHIDRA_CAST<char *>((*GHIDRA_CAST<int *>((**GHIDRA_CAST<int **>((puVar1 + 1)) + 0x14)) + 8));
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_a4) + 0xc)) != 1) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("This function should only be called on consolidated messages"));
}
puVar1 = local_a4;
iVar6 = *GHIDRA_CAST<int *>((**GHIDRA_CAST<int **>((puVar2 + 1)) + 0x18)) + -8;
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_a4) + 0xc)) != 1) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("This function should only be called on consolidated messages"));
}
pMVar8 = senderIdHigh;
streamData = (void *)(*GHIDRA_CAST<int *>((**GHIDRA_CAST<int **>((puVar1 + 1)) + 0x14)) + 8);
local_cc = (void *)0x0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_c4)) + 0x0))) = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_c4)) + 0x1))) = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_c4)) + 0x2))) = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_c4)) + 0x3))) = 0;
local_b4 = 0;
local_b8 = 0;
local_bc = 0;
local_c8 = 0;
stream = (NetplayManager)KAGE::Filesys::BufferedStream::vftable;
streamVtable = KAGE::Filesys::BufferedStream::vftable;
local_14[0] = 1;
local_94 = senderIdLow;
senderProfile[0] = KAGE::System::UserProfileBase::vftable;
streamSize = iVar6;
local_d0 = iVar6;
(GHIDRA_CAST<UserProfile *>((&senderIdLow)))->UserProfile::find_or_create();
local_14[0] = 2;
senderProfile[0] = KAGE::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)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((senderProfile)))->KAGE::System::UserProfile::load_steam_avatar();
}
local_14[0] = 3;
(*(code *)senderProfile[0][1])();
messageData = local_80;
pMVar5 = local_94;
KAGE_LogMessage(1,GHIDRA_CAST<byte *>("[Frame %d] Received %s message from user %s [%llu]\n"));
menuManager = g_menuManager;
manager = g_manager;
local_14[0] = 1;
senderProfile[0] = KAGE::System::UserProfileBase::vftable;
switch(*messageData) {
case '\0':
if (g_menuManager == GHIDRA_CAST<MenuManager *>(0x0)) {
local_94 = g_manager;
for (member = (g_manager->_lobbyMembers)._begin; member != (g_manager->_lobbyMembers)._end;
member = (void *)(GHIDRA_INT(member) + 0x14)) {
iVar6 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(member) + 4));
if (iVar6 == 0) {
uStack_88 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_88)) + 0x4))) = GHIDRA_CAST<Manager *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_88)) + 0x0))) = GHIDRA_CAST<Manager *>(0x0);
pMVar8 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_88)) + 0x4)));
pMVar5 = GHIDRA_CAST<Manager *>(uStack_88);
}
else {
pMVar8 = *GHIDRA_CAST<Manager **>((iVar6 + 0xc));
pMVar5 = *GHIDRA_CAST<Manager **>((iVar6 + 8));
}
if ((pMVar5 == senderIdLow) && (pMVar8 == senderIdHigh)) goto LAB_00916ee3;
}
puVar7 = &(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(g_manager[1]._gamestate)) + 0x8bc)));
findResult = GHIDRA_CAST<int *>(FUN_008fd870(&pMStack_9c,&senderIdLow));
if (*findResult == *GHIDRA_CAST<int *>(puVar7)) {
if ((local_80[1] & 2U) == 0) goto LAB_00916ee3;
KAGE_LogMessage(1,GHIDRA_CAST<byte *>("[Frame %d] Adding pending join for player %llu \n"));
func_0x008e74a0();
local_14[0] = 4;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_88)) + 0x0))) = GHIDRA_CAST<Manager *>(KAGE)::System::UserProfileBase::vftable;
(GHIDRA_CAST<UserProfile *>((&senderIdLow)))->UserProfile::find_or_create();
local_14[0] = 5;
uStack_88 = CONCAT44(extraout_EAX_00,KAGE::System::UserProfile::vftable);
iVar6 = extraout_EAX_00;
if (((extraout_EAX_00 != 0) &&
(iVar6 = extraout_EAX_00,
*GHIDRA_CAST<int *>((extraout_EAX_00 + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX_00 + 0xc)) != 0)) &&
(iVar6 = extraout_EAX_00, *GHIDRA_CAST<int *>((extraout_EAX_00 + 0x14)) == 0)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((&uStack_88)))->KAGE::System::UserProfile::load_steam_avatar();
iVar6 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(uStack_88))) + 0x4)));
}
local_14[0] = 4;
uVar4 = FUN_00949b90();
pMVar8 = GHIDRA_CAST<Manager *>(&senderIdLow);
pMVar5 = GHIDRA_CAST<Manager *>(&pvStack_e4);
FUN_00731ee0(pMVar5,pMVar8);
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(pendingJoinNode) + 0xd)) != '\0') ||
(senderIdHigh < *GHIDRA_CAST<Manager **>((GHIDRA_CAST<char *>(pendingJoinNode) + 0x14)))) ||
((senderIdHigh <= *GHIDRA_CAST<Manager **>((GHIDRA_CAST<char *>(pendingJoinNode) + 0x14)) &&
(senderIdLow < *GHIDRA_CAST<Manager **>((GHIDRA_CAST<char *>(pendingJoinNode) + 0x10)))))) {
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(manager[1]._gamestate)) + 0x8c0)))) == 0x5555555) {
/* WARNING: Subroutine does not return */
FUN_004170d0();
}
pMVar5 = *GHIDRA_CAST<Manager **>(puVar7);
local_14[0] = 6;
uStack_88 = ZEXT48(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_94[1]._gamestate)) + 0x8bc))));
pMVar8 = operator_new(0x30);
pMVar8->_currentSaveSlot = GHIDRA_INT(senderIdLow);
*GHIDRA_CAST<Manager **>(&pMVar8->_persistentGameData) = senderIdHigh;
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&((pMVar8->_persistentGameData))) + 0x8)))) = 0;
(pMVar8->_persistentGameData)._saveFile = KAGE::System::UserProfile::vftable;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&((pMVar8->_persistentGameData))) + 0xc))) = 0;
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&((pMVar8->_persistentGameData))) + 0x10)))) = 0;
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&((pMVar8->_persistentGameData))) + 0x14)))) = 5;
*GHIDRA_CAST<Manager **>(pMVar8) = pMVar5;
*GHIDRA_CAST<Manager **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((pMVar8)) + 0x4)))) = pMVar5;
pMVar8->_state = GHIDRA_INT(pMVar5);
*GHIDRA_CAST<undefined2 *>(&pMVar8->_previousState) = 0;
pendingJoinNode =
std::_Tree::_Insert_node
(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_94[1]._gamestate)) + 0x8bc))),pvStack_e4,GHIDRA_INT(pMStack_e0),pMVar8);
pMVar5 = pMStack_e0;
}
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(pendingJoinNode) + 0x20)) = uStack_f0;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pendingJoinNode) + 0x1c)) = iVar6;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pendingJoinNode) + 0x24)) = uVar4;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pendingJoinNode) + 0x28)) = uStack_e8;
local_14[0] = 1;
}
else {
if ((local_80[1] & 2U) != 0) goto LAB_00916ee3;
pMVar8 = GHIDRA_CAST<Manager *>(&senderIdLow);
pMVar5 = GHIDRA_CAST<Manager *>(0x916a2f);
FUN_00913c80(pMVar8);
}
break;
}
goto LAB_00916ec7;
case '\x02':
FUN_009193b0();
local_14[0] = 7;
messageSubtype = 0;
if ((code *)streamVtable[5] == memory_stream_read) {
(GHIDRA_CAST<KAGE::Filesys::BufferedStream *>((&stream)))->KAGE::Filesys::BufferedStream::read(&messageSubtype,1,1);
}
else {
(*(code *)streamVtable[5])(&messageSubtype);
}
if (messageSubtype != 2) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("Specified data is not a report save data message\n"));
}
local_80 = GHIDRA_CAST<char *>(0x0);
if ((code *)streamVtable[5] == memory_stream_read) {
(GHIDRA_CAST<KAGE::Filesys::BufferedStream *>((&stream)))->KAGE::Filesys::BufferedStream::read(&local_80,4,1);
}
else {
(*(code *)streamVtable[5])(&local_80);
}
if ((code *)streamVtable[2] != FUN_00a58260) {
(*(code *)streamVtable[2])();
}
FUN_0091ad50(saveData);
uStack_88 = *local_a4;
pMVar5 = GHIDRA_CAST<Manager *>(&uStack_88);
FUN_0090c2d0(pMVar5,saveData);
local_14[0] = 1;
pMVar8 = GHIDRA_CAST<Manager *>(0x916cbb);
FUN_00a58200();
break;
case '\x03':
pMVar5 = GHIDRA_CAST<Manager *>((**(code **)(*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(g_manager[1]._gamestate)) + 0x6c)))) + 4))());
iVar6 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(manager[1]._gamestate)) + 0x5c))));
if (iVar6 == 0) {
iVar6 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(manager[1]._gamestate)) + 0x50))));
}
FUN_00a296e0(replyMessage,1,iVar6,pMVar5,0);
local_14[0] = 8;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_88)) + 0x0))) = GHIDRA_CAST<Manager *>(KAGE)::System::UserProfileBase::vftable;
puVar7 = GHIDRA_CAST<undefined1 *>(0x916d0c);
(GHIDRA_CAST<UserProfile *>((&senderIdLow)))->UserProfile::find_or_create();
local_14[0] = 9;
uStack_88 = CONCAT44(extraout_EAX_01,KAGE::System::UserProfile::vftable);
if (((extraout_EAX_01 != 0) &&
(*GHIDRA_CAST<int *>((extraout_EAX_01 + 8)) != 0 || *GHIDRA_CAST<int *>((extraout_EAX_01 + 0xc)) != 0)) &&
(*GHIDRA_CAST<int *>((extraout_EAX_01 + 0x14)) == 0)) {
puVar7 = &LAB_00916d34;
(GHIDRA_CAST<KAGE::System::UserProfile *>((&uStack_88)))->KAGE::System::UserProfile::load_steam_avatar();
}
local_14[0] = 10;
FUN_008ef1d0(replyMessage);
multiplayer_send_message(&uStack_88,pMVar5,puVar7);
local_14[0] = 1;
pMVar8 = GHIDRA_CAST<Manager *>(0x916d61);
FUN_00708d40();
break;
case '\x04':
case '\x05':
pMStack_9c = GHIDRA_CAST<Manager *>(CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(pMStack_9c)) + 0x1))),*messageData == '\x04'));
if (g_menuManager == GHIDRA_CAST<MenuManager *>(0x0)) {
pMVar5 = GHIDRA_CAST<Manager *>(&stream);
pMVar8 = pMStack_9c;
FUN_0090ca40(pMVar5,pMStack_9c);
}
else {
KAGE_LogMessage(1,GHIDRA_CAST<byte *>("Menu_OnlineLobby::notify_game_start() \n"));
puVar7 = &(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((menuManager)) + 0xe370)));
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((menuManager)) + 0xe3b0))) = 1;
if (*GHIDRA_CAST<int *>(puVar7) != -1) {
local_80 = GHIDRA_CAST<char *>(0xffffffff);
(GHIDRA_CAST<PopupManager *>((&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(g_manager[1]._gamestate)) + 0xcf0))))))->PopupManager::close(GHIDRA_CAST<int *>(puVar7),GHIDRA_CAST<int *>(&local_80));
*GHIDRA_CAST<undefined4 *>(puVar7) = 0xffffffff;
}
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((menuManager)) + 0xe374)))) != -1) {
local_94 = GHIDRA_CAST<Manager *>(0xffffffff);
(GHIDRA_CAST<PopupManager *>((&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(g_manager[1]._gamestate)) + 0xcf0))))))->PopupManager::close(GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((menuManager)) + 0xe374)))),
GHIDRA_CAST<int *>(&local_94));
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((menuManager)) + 0xe374)))) = 0xffffffff;
}
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((menuManager)) + 0xe378)))) != -1) {
pMStack_9c = GHIDRA_CAST<Manager *>(0xffffffff);
(GHIDRA_CAST<PopupManager *>((&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(g_manager[1]._gamestate)) + 0xcf0))))))->PopupManager::close(GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((menuManager)) + 0xe378)))),
GHIDRA_CAST<int *>(&pMStack_9c));
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((menuManager)) + 0xe378)))) = 0xffffffff;
}
FUN_0090ca40(&stream,1);
DAT_00c7ac68 = 1;
(GHIDRA_CAST<Menu_Character *>((&g_menuManager->_menuCharacter)))->Menu_Character::Reset();
iVar6 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((menuManager)) + 0xe37c))));
pMVar5 = GHIDRA_CAST<Manager *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((menuManager)) + 0xe37c))));
DAT_00c7ac68 = 0;
pMVar8 = *GHIDRA_CAST<Manager **>((iVar6 + 4));
FUN_008ef400(pMVar5,pMVar8);
*GHIDRA_CAST<int *>((iVar6 + 4)) = iVar6;
*GHIDRA_CAST<int *>(iVar6) = iVar6;
*GHIDRA_CAST<int *>((iVar6 + 8)) = iVar6;
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((menuManager)) + 0xe380)))) = 0;
}
break;
case '\a':
pMVar8 = GHIDRA_CAST<Manager *>(0x916ebd);
read_player_game_states_message(&stream);
}
if (g_menuManager != GHIDRA_CAST<MenuManager *>(0x0)) {
LAB_00916ec7:
FUN_008ef1d0(&local_a4);
FUN_008ea6e0(pMVar5,pMVar8);
}
LAB_00916ee3:
FUN_00a58200();
local_14[0] = 0xb;
local_14[1] = 0;
local_14[2] = 0;
local_14[3] = 0;
if (((messageRefCount != GHIDRA_CAST<int *>(0x0)) &&
(cVar3 = (**(code **)(*messageRefCount + 0xc))(), cVar3 != '\0')) &&
(g_multiplayerRelease != (void *)0x0)) {
(*g_multiplayerRelease)(&local_a4);
}
ExceptionList = local_1c;
return;
}
// 00917a50
void NetplayManager::load_game_start_packet(void *message, void *netplayState)
{
int *piVar1;
undefined1 *puVar2;
KColor fadeColor;
Manager *pMVar3;
undefined4 *member;
int extraout_EAX;
void *treeHead;
std_vector *lobbyMembers;
uint i;
void **ppvVar4;
bool bVar5;
byte isCustomRun;
undefined4 local_ec;
undefined4 local_e8;
undefined **profile;
undefined4 local_dc;
byte local_d8;
int local_d4;
uint local_d0;
undefined8 entryCount;
void *local_c0;
uint entryCountHigh;
void *local_b8;
undefined8 local_b4;
int challenge;
undefined8 local_a4;
undefined8 entry;
undefined **tmpProfile;
uint local_8c;
uint local_88;
int local_84;
byte isCustomRunSaved;
uint local_7c;
byte local_75;
Seeds local_74;
uint local_14;
void *local_10;
undefined1 *puStack_c;
int local_8;
Manager *manager;
undefined4 *vecEnd;
manager = g_manager;
local_8 = 0xffffffff;
puStack_c = &LAB_00b09e13;
local_10 = ExceptionList;
local_14 = __security_cookie ^ GHIDRA_UINT(&(&local_74)[1]._rng._shift3);
ExceptionList = &local_10;
piVar1 = GHIDRA_CAST<int *>((GHIDRA_INT(message) + 0x28));
local_75 = 0;
lobbyMembers = &g_manager->_lobbyMembers;
local_c0 = message;
local_b8 = netplayState;
(**(code **)(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(message) + 0x28)) + 0x14))(&local_75,1,1,local_14);
vecEnd = (manager->_lobbyMembers)._end;
member = lobbyMembers->_begin;
if (member != vecEnd) {
do {
*member = KAGE::System::UserProfileBase::vftable;
member = member + 5;
} while (member != vecEnd);
member = lobbyMembers->_begin;
}
(manager->_lobbyMembers)._end = member;
for (local_7c = GHIDRA_UINT(local_75); local_7c != 0; local_7c = local_7c - 1) {
local_dc = 0;
profile = KAGE::System::UserProfile::vftable;
local_d8 = 0;
local_d4 = 0;
local_d0 = 5;
local_8 = 0;
local_b4 = 0;
(**(code **)(*piVar1 + 0x14))(&local_b4,8,1);
local_a4 = local_b4;
tmpProfile = KAGE::System::UserProfileBase::vftable;
(GHIDRA_CAST<UserProfile *>((&local_a4)))->UserProfile::find_or_create();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
tmpProfile = KAGE::System::UserProfile::vftable;
local_8c = 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)) {
(GHIDRA_CAST<KAGE::System::UserProfile *>((&tmpProfile)))->KAGE::System::UserProfile::load_steam_avatar();
}
local_8 = (*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(local_8))) + 0x1))) << 8;
tmpProfile = KAGE::System::UserProfileBase::vftable;
local_84 = 0;
(**(code **)(*piVar1 + 0x14))(&local_84,4,1);
local_d4 = local_84;
local_75 = 0;
(**(code **)(*piVar1 + 0x14))(&local_75,1,1);
local_d8 = local_75;
local_88 = 0;
(**(code **)(*piVar1 + 0x14))(&local_88,4,1);
vecEnd = (manager->_lobbyMembers)._end;
local_d0 = local_88;
if (vecEnd == (manager->_lobbyMembers)._capacity) {
FUN_008ef230(vecEnd,&profile);
}
else {
*GHIDRA_CAST<byte *>((vecEnd + 2)) = local_75;
vecEnd[1] = local_8c;
*vecEnd = KAGE::System::UserProfile::vftable;
vecEnd[3] = local_84;
vecEnd[4] = local_88;
ppvVar4 = &(manager->_lobbyMembers)._end;
*ppvVar4 = (void *)(GHIDRA_INT(*ppvVar4) + 0x14);
}
local_8 = 0xffffffff;
}
local_88 = 0;
(**(code **)(*piVar1 + 0x14))(&local_88,4,1);
local_75 = 0;
(**(code **)(*piVar1 + 0x14))(&local_75,1,1);
isCustomRun = local_75 != 0;
local_84 = 0;
isCustomRunSaved = isCustomRun;
(**(code **)(*piVar1 + 0x14))(&local_84,4,1);
local_75 = 0;
(**(code **)(*piVar1 + 0x14))(&local_75,1,1);
local_8c = GHIDRA_UINT(local_75);
challenge = 0;
(**(code **)(*piVar1 + 0x14))(&challenge,4,1);
local_a4 = 0;
(**(code **)(*piVar1 + 0x14))(&local_a4,8,1);
entryCount = 0;
(**(code **)(*piVar1 + 0x14))(&entryCount,8,1);
local_b4 = CONCAT44(GHIDRA_INT(entryCount),(undefined4)local_b4);
entryCountHigh = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(entryCount)) + 0x4)));
entry = 0;
if (((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(entryCount)) + 0x4))) != 0) || (GHIDRA_INT(entryCount) != 0)) {
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(entry)) + 0x0))) = 0;
local_7c = 0;
i = GHIDRA_UINT(entry);
do {
manager = g_manager;
entry = 0;
(**(code **)(*piVar1 + 0x14))(&entry,8,1);
vecEnd = *GHIDRA_CAST<undefined4 **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(manager[1]._persistentGameData)) + 0x30))));
local_ec = GHIDRA_UINT(entry);
local_e8 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(entry)) + 0x4)));
if (vecEnd == *GHIDRA_CAST<undefined4 **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(manager[1]._persistentGameData)) + 0x34))))) {
std::vector<8byte>::_Emplace_reallocate(vecEnd,&local_ec);
}
else {
*vecEnd = GHIDRA_UINT(entry);
vecEnd[1] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(entry)) + 0x4)));
puVar2 = &(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(manager[1]._persistentGameData)) + 0x30)));
*GHIDRA_CAST<int *>(puVar2) = *GHIDRA_CAST<int *>(puVar2) + 8;
}
bVar5 = 0xfffffffe < i;
i = i + 1;
local_7c = local_7c + bVar5;
} while ((local_7c < entryCountHigh) || ((local_7c <= entryCountHigh && (i < (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_b4)) + 0x4)))))));
isCustomRun = isCustomRunSaved;
}
local_7c = 0;
(**(code **)(*piVar1 + 0x14))(&local_7c,4,1);
(**(code **)(*piVar1 + 8))(local_b8);
FUN_0091ad50();
local_74._rng._seed = -0x55e8beb1;
local_74._rng._shift1 = 5;
local_74._rng._shift2 = 9;
local_74._rng._shift3 = 7;
local_74._seedEffects = (void *)0x0;
local_74._seedEffectsCount = 0;
treeHead = operator_new(0x14);
*(void **)treeHead = treeHead;
*(void **)(GHIDRA_CAST<char *>(treeHead) + 4) = treeHead;
*(void **)(GHIDRA_CAST<char *>(treeHead) + 8) = treeHead;
*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(treeHead) + 0xc)) = 0x101;
local_74._gameStartSeed = 0;
local_74._isCustomRun = 0;
local_74._seedEffects = treeHead;
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(&local_74._seedEffects,
(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)&local_74._seedEffects,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(treeHead) + 4));
*(void **)(GHIDRA_CAST<char *>(treeHead) + 4) = treeHead;
*(void **)treeHead = treeHead;
*(void **)(GHIDRA_CAST<char *>(treeHead) + 8) = treeHead;
local_74._seedEffectsCount = 0;
local_8 = 2;
(GHIDRA_CAST<Seeds *>((&local_74)))->Seeds::set_start_seed(local_88);
local_74._isCustomRun = isCustomRun;
(GHIDRA_CAST<Seeds *>((&g_manager->_startSeeds)))->Seeds::operator_assign(&local_74);
manager = g_manager;
ppvVar4 = &(g_manager->_startSeeds)._seedEffects;
treeHead = *ppvVar4;
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(ppvVar4,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)ppvVar4,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(treeHead) + 4));
pMVar3 = g_manager;
*(void **)(GHIDRA_CAST<char *>(treeHead) + 4) = treeHead;
*(void **)treeHead = treeHead;
*(void **)(GHIDRA_CAST<char *>(treeHead) + 8) = treeHead;
(manager->_startSeeds)._seedEffectsCount = 0;
(GHIDRA_CAST<Seeds *>((&pMVar3->_startSeeds)))->Seeds::AddSeedEffect(local_84);
manager = g_manager;
g_manager->_startDifficulty = local_8c;
manager->_startChallenge = challenge;
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(manager[1]._persistentGameData)) + 0xc)))) = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_a4)) + 0x4)));
manager->_rerunAvailable = 0;
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(manager[1]._persistentGameData)) + 0x8)))) = (undefined4)local_a4;
reset(&manager->_netplayManager,0);
if (g_menuManager == GHIDRA_CAST<MenuManager *>(0x0)) {
g_manager->_starting = 1;
}
else {
fadeColor._alpha = 1.0;
fadeColor._red = 0.0;
fadeColor._green = 0.0;
fadeColor._blue = 0.0;
fadeColor._unk = 0;
MenuManager::start_game(fadeColor);
}
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(&local_74._seedEffects,
(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)&local_74._seedEffects,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(local_74._seedEffects) + 4));
operator_delete(local_74._seedEffects,0x14);
ExceptionList = local_10;
return;
}
// 00918870
void NetplayManager::write_player_game_states_message()
{
qword qVar1;
uint uVar2;
int iVar3;
int iVar4;
int iVar5;
int iVar6;
void *pvVar7;
undefined4 compressedSize;
int extraout_ECX;
undefined4 extraout_ECX_00;
qword *allocCounter;
int *piVar8;
uint totalSize;
undefined **stream;
int *streamSize;
undefined4 local_50;
int local_4c;
int local_48;
int local_44;
int local_40;
undefined4 local_3c;
undefined4 local_38;
undefined4 local_34;
undefined **local_30;
undefined4 playerKey;
undefined4 playerKeyHigh;
int *local_20;
undefined4 *local_1c;
int playerStateNode;
undefined1 writeByte;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
Manager *manager;
manager = g_manager;
local_8 = 0xffffffff;
puStack_c = &LAB_00b09e9d;
local_10 = ExceptionList;
uVar2 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
ExceptionList = &local_10;
totalSize = 1;
(GHIDRA_CAST<KAGE::Filesys::BufferedStream *>((&stream)))->KAGE::Filesys::BufferedStream::BufferedStream(0);
local_8 = 0;
piVar8 = *GHIDRA_CAST<int **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(manager[1]._gamestate)) + 0xc8))));
playerStateNode = *piVar8;
if (GHIDRA_CAST<int *>(playerStateNode) != piVar8) {
do {
iVar6 = playerStateNode;
iVar3 = (**(code **)(*GHIDRA_CAST<int *>((playerStateNode + 0x48)) + 4))(uVar2);
iVar4 = (**(code **)(*GHIDRA_CAST<int *>((iVar6 + 0x7c)) + 4))();
iVar5 = (**(code **)(*GHIDRA_CAST<int *>((iVar6 + 0xb0)) + 4))();
iVar6 = (**(code **)(*GHIDRA_CAST<int *>((iVar6 + 0xe4)) + 4))();
totalSize = totalSize + iVar3 + iVar4 + iVar5 + 0x18 + iVar6;
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>
*)&playerStateNode);
} while (playerStateNode != *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(manager[1]._gamestate)) + 0xc8)))));
}
if (GHIDRA_UINT((local_44 - local_4c)) < totalSize) {
if (0x7fffffff < totalSize) {
/* WARNING: Subroutine does not return */
std::_Xlen();
}
FUN_00a2c860(totalSize);
}
writeByte = (*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(manager[1]._gamestate)) + 0xcc)));
(*(code *)local_30[7])(&writeByte,1,1);
piVar8 = *GHIDRA_CAST<int **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(manager[1]._gamestate)) + 0xc8))));
playerStateNode = *piVar8;
if (GHIDRA_CAST<int *>(playerStateNode) != piVar8) {
do {
iVar6 = playerStateNode;
playerKey = *GHIDRA_CAST<undefined4 *>((playerStateNode + 0x10));
playerKeyHigh = *GHIDRA_CAST<undefined4 *>((playerStateNode + 0x14));
(*(code *)local_30[7])(&playerKey,8,1);
writeByte = *GHIDRA_CAST<undefined1 *>((iVar6 + 0x18));
(*(code *)local_30[7])(&writeByte,1,1);
writeByte = *GHIDRA_CAST<undefined1 *>((iVar6 + 0x1c));
(*(code *)local_30[7])(&writeByte,1,1);
uVar2 = (**(code **)(*GHIDRA_CAST<int *>((iVar6 + 0x48)) + 4))();
local_1c = GHIDRA_CAST<undefined4 *>((uVar2 & 0xffff));
(*(code *)local_30[7])(&local_1c,2,1);
iVar3 = (**(code **)(*GHIDRA_CAST<int *>((iVar6 + 0x48)) + 4))();
if (iVar3 != 0) {
uVar2 = (**(code **)(*GHIDRA_CAST<int *>((iVar6 + 0x48)) + 4))();
pvVar7 = *(void **)(iVar6 + 0x38);
if (pvVar7 == (void *)0x0) {
pvVar7 = *(void **)(iVar6 + 0x2c);
}
buffered_stream_write(&local_30,pvVar7,1,uVar2);
}
writeByte = *GHIDRA_CAST<undefined1 *>((iVar6 + 0x4c));
(*(code *)local_30[7])(&writeByte,1,1);
writeByte = *GHIDRA_CAST<undefined1 *>((iVar6 + 0x50));
(*(code *)local_30[7])(&writeByte,1,1);
uVar2 = (**(code **)(*GHIDRA_CAST<int *>((iVar6 + 0x7c)) + 4))();
local_1c = GHIDRA_CAST<undefined4 *>((uVar2 & 0xffff));
(*(code *)local_30[7])(&local_1c,2,1);
iVar3 = (**(code **)(*GHIDRA_CAST<int *>((iVar6 + 0x7c)) + 4))();
if (iVar3 != 0) {
uVar2 = (**(code **)(*GHIDRA_CAST<int *>((iVar6 + 0x7c)) + 4))();
pvVar7 = *(void **)(iVar6 + 0x6c);
if (pvVar7 == (void *)0x0) {
pvVar7 = *(void **)(iVar6 + 0x60);
}
buffered_stream_write(&local_30,pvVar7,1,uVar2);
}
writeByte = *GHIDRA_CAST<undefined1 *>((iVar6 + 0x80));
(*(code *)local_30[7])(&writeByte,1,1);
writeByte = *GHIDRA_CAST<undefined1 *>((iVar6 + 0x84));
(*(code *)local_30[7])(&writeByte,1,1);
uVar2 = (**(code **)(*GHIDRA_CAST<int *>((iVar6 + 0xb0)) + 4))();
local_1c = GHIDRA_CAST<undefined4 *>((uVar2 & 0xffff));
(*(code *)local_30[7])(&local_1c,2,1);
iVar3 = (**(code **)(*GHIDRA_CAST<int *>((iVar6 + 0xb0)) + 4))();
if (iVar3 != 0) {
uVar2 = (**(code **)(*GHIDRA_CAST<int *>((iVar6 + 0xb0)) + 4))();
pvVar7 = *(void **)(iVar6 + 0xa0);
if (pvVar7 == (void *)0x0) {
pvVar7 = *(void **)(iVar6 + 0x94);
}
buffered_stream_write(&local_30,pvVar7,1,uVar2);
}
writeByte = *GHIDRA_CAST<undefined1 *>((iVar6 + 0xb4));
(*(code *)local_30[7])(&writeByte,1,1);
writeByte = *GHIDRA_CAST<undefined1 *>((iVar6 + 0xb8));
(*(code *)local_30[7])(&writeByte,1,1);
uVar2 = (**(code **)(*GHIDRA_CAST<int *>((iVar6 + 0xe4)) + 4))();
local_1c = GHIDRA_CAST<undefined4 *>((uVar2 & 0xffff));
(*(code *)local_30[7])(&local_1c,2,1);
iVar3 = (**(code **)(*GHIDRA_CAST<int *>((iVar6 + 0xe4)) + 4))();
if (iVar3 != 0) {
uVar2 = (**(code **)(*GHIDRA_CAST<int *>((iVar6 + 0xe4)) + 4))();
pvVar7 = *(void **)(iVar6 + 0xd4);
if (pvVar7 == (void *)0x0) {
pvVar7 = *(void **)(iVar6 + 200);
}
buffered_stream_write(&local_30,pvVar7,1,uVar2);
}
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>
*)&playerStateNode);
} while (playerStateNode != *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(manager[1]._gamestate)) + 0xc8)))));
}
piVar8 = streamSize;
pvVar7 = operator_new_tracked(GHIDRA_UINT(streamSize));
iVar6 = local_4c;
if (local_40 != 0) {
iVar6 = local_40;
}
if (g_deflateCompressor == (void *)0x0) {
local_1c = operator_new(0x14);
if (local_1c == GHIDRA_CAST<undefined4 *>(0x0)) {
g_deflateCompressor = GHIDRA_CAST<undefined4 *>(0x0);
}
else {
*local_1c = 0;
local_1c[1] = 0;
local_1c[3] = 0;
g_deflateCompressor = local_1c;
}
local_40 = extraout_ECX;
}
FUN_00a89ba0(local_40);
compressedSize = tdefl_compress(pvVar7,piVar8,iVar6,piVar8,extraout_ECX_00);
(**(code **)(*local_20 + 4))(0,0xffffffff);
piVar8 = local_20 + 10;
writeByte = 7;
(**(code **)(local_20[10] + 0x1c))(&writeByte,1,1);
local_20 = streamSize;
(**(code **)(*piVar8 + 0x1c))(&local_20,4,1);
(**(code **)(*piVar8 + 0x1c))(pvVar7,1,compressedSize);
if (pvVar7 != (void *)0x0) {
if (g_mainHeap == (void *)0x0) {
allocCounter = &g_allocatedBytesNoHeap;
}
else {
allocCounter = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar2 = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(pvVar7) + -4));
qVar1 = *allocCounter;
*GHIDRA_CAST<uint *>(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocCounter) + 4)) =
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar2));
free((void *)(GHIDRA_INT(pvVar7) + -4));
}
local_30 = KAGE::Filesys::StreamBase::vftable;
stream = KAGE::Filesys::BufferedStreamBase::vftable;
streamSize = GHIDRA_CAST<int *>(0x0);
local_50 = 0;
local_48 = local_4c;
local_40 = 0;
local_3c = 0;
local_38 = 0;
local_34 = 0;
FUN_007dcd30();
ExceptionList = local_10;
return;
}
// 00918d00
void NetplayManager::read_player_game_states_message()
{
uint uVar1;
int iVar2;
int iVar3;
uint *peerState;
void *stateBlob;
byte shift;
uint uVar4;
qword *allocatedBytes;
code *freeFn;
NetplayManager NVar5;
undefined **stream;
undefined4 peerIdLow;
undefined4 peerIdHigh;
Manager *local_28;
void *decompressBuffer;
uint local_20;
undefined8 local_1c;
byte readByte;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
Manager *manager;
qword oldAllocatedBytes;
local_8 = 0xffffffff;
puStack_c = &LAB_00b09ecd;
local_10 = ExceptionList;
ExceptionList = &local_10;
local_28 = g_manager;
readByte = 0;
(**(code **)(GHIDRA_INT(this[10]) + 0x14))
(&readByte,1,1,__security_cookie ^ GHIDRA_INT(register0x00000010) - 4U);
if (readByte != 7) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("Specified data is not a report player game states message\n"));
}
local_1c = (ulonglong)GHIDRA_UINT(local_1c);
(**(code **)(GHIDRA_INT(this[10]) + 0x14))(GHIDRA_INT(&local_1c) + 4,4,1);
shift = 1;
uVar4 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_1c)) + 0x4))) - 1;
uVar1 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_1c)) + 0x4))) >> 1;
while (uVar1 != 0) {
uVar4 = uVar4 | uVar1;
shift = shift + 1;
uVar1 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_1c)) + 0x4))) >> (shift & 0x1f);
}
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_1c)) + 0x4))) = uVar4 + 1;
decompressBuffer = operator_new_tracked(uVar4 + 1);
iVar2 = (**(code **)(GHIDRA_INT(this[10]) + 8))();
iVar3 = (**(code **)(GHIDRA_INT(this[10]) + 4))();
local_20 = iVar3 - iVar2;
NVar5 = this[6];
if (NVar5 == (NetplayManager)0x0) {
NVar5 = this[3];
}
iVar2 = (**(code **)(GHIDRA_INT(this[10]) + 8))();
buffer_decompress(decompressBuffer,(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_1c)) + 0x4))),(void *)(iVar2 + GHIDRA_INT(NVar5)),local_20);
stream = KAGE::Filesys::BufferedStream::vftable;
local_8 = 0;
readByte = 0;
memory_stream_read(&stream,&readByte,1,1);
manager = local_28;
uVar4 = GHIDRA_UINT(readByte);
local_28 = GHIDRA_CAST<Manager *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_28[1]._gamestate)) + 0xc8))));
iVar2 = *GHIDRA_CAST<int *>(local_28);
local_20 = uVar4;
std::map<unsigned_long_long_PeerStreams>::destroy_subtree(local_28,*GHIDRA_CAST<undefined4 *>((iVar2 + 4)));
*GHIDRA_CAST<int *>((iVar2 + 4)) = iVar2;
*GHIDRA_CAST<int *>(iVar2) = iVar2;
*GHIDRA_CAST<int *>((iVar2 + 8)) = iVar2;
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(manager[1]._gamestate)) + 0xcc)))) = 0;
freeFn = free_exref;
do {
if (uVar4 == 0) {
if (decompressBuffer != (void *)0x0) {
if (g_mainHeap == (void *)0x0) {
allocatedBytes = &g_allocatedBytesNoHeap;
}
else {
allocatedBytes = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar4 = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(decompressBuffer) + -4));
oldAllocatedBytes = *allocatedBytes;
*GHIDRA_CAST<uint *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar4;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocatedBytes) < uVar4));
(*freeFn)(GHIDRA_CAST<uint *>((GHIDRA_INT(decompressBuffer) + -4)));
}
ExceptionList = local_10;
return;
}
local_1c = 0;
if ((code *)stream[5] == memory_stream_read) {
memory_stream_read(&stream,&local_1c,8,1);
}
else {
(*(code *)stream[5])(&local_1c);
}
peerIdLow = GHIDRA_UINT(local_1c);
peerIdHigh = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_1c)) + 0x4)));
peerState = GHIDRA_CAST<uint *>(FUN_00913e50(&peerIdLow));
readByte = 0;
if ((code *)stream[5] == memory_stream_read) {
memory_stream_read(&stream,&readByte,1,1);
}
else {
(*(code *)stream[5])(&readByte);
}
*peerState = GHIDRA_UINT(readByte);
readByte = 0;
if ((code *)stream[5] == memory_stream_read) {
memory_stream_read(&stream,&readByte,1,1);
}
else {
(*(code *)stream[5])(&readByte);
}
peerState[1] = GHIDRA_UINT(readByte);
(**(code **)(peerState[2] + 4))(0,0xffffffff);
local_1c = local_1c & 0xffffffff;
if ((code *)stream[5] == memory_stream_read) {
memory_stream_read(&stream,(void *)(GHIDRA_INT(&local_1c) + 4),2,1);
}
else {
(*(code *)stream[5])(GHIDRA_INT(&local_1c) + 4);
}
if ((short)(local_1c >> 0x20) != 0) {
uVar4 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_1c)) + 0x4))) & 0xffff;
stateBlob = operator_new_tracked(uVar4);
memory_stream_read(&stream,stateBlob,1,uVar4);
(**(code **)(peerState[0xc] + 0x1c))(stateBlob,1,uVar4);
if (stateBlob != (void *)0x0) {
if (g_mainHeap == (void *)0x0) {
allocatedBytes = &g_allocatedBytesNoHeap;
}
else {
allocatedBytes = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar4 = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(stateBlob) + -4));
oldAllocatedBytes = *allocatedBytes;
*GHIDRA_CAST<uint *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar4;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocatedBytes) < uVar4));
free((void *)(GHIDRA_INT(stateBlob) + -4));
local_8 = local_8 & 0xffffff00;
}
}
readByte = 0;
if ((code *)stream[5] == memory_stream_read) {
memory_stream_read(&stream,&readByte,1,1);
}
else {
(*(code *)stream[5])(&readByte);
}
peerState[0xd] = GHIDRA_UINT(readByte);
readByte = 0;
if ((code *)stream[5] == memory_stream_read) {
memory_stream_read(&stream,&readByte,1,1);
}
else {
(*(code *)stream[5])(&readByte);
}
peerState[0xe] = GHIDRA_UINT(readByte);
(**(code **)(peerState[0xf] + 4))(0,0xffffffff);
local_1c = local_1c & 0xffffffff;
if ((code *)stream[5] == memory_stream_read) {
memory_stream_read(&stream,(void *)(GHIDRA_INT(&local_1c) + 4),2,1);
}
else {
(*(code *)stream[5])(GHIDRA_INT(&local_1c) + 4);
}
if ((short)(local_1c >> 0x20) != 0) {
uVar4 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_1c)) + 0x4))) & 0xffff;
stateBlob = operator_new_tracked(uVar4);
memory_stream_read(&stream,stateBlob,1,uVar4);
(**(code **)(peerState[0x19] + 0x1c))(stateBlob,1,uVar4);
if (stateBlob != (void *)0x0) {
if (g_mainHeap == (void *)0x0) {
allocatedBytes = &g_allocatedBytesNoHeap;
}
else {
allocatedBytes = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar4 = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(stateBlob) + -4));
oldAllocatedBytes = *allocatedBytes;
*GHIDRA_CAST<uint *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar4;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocatedBytes) < uVar4));
free((void *)(GHIDRA_INT(stateBlob) + -4));
local_8 = local_8 & 0xffffff00;
}
}
readByte = 0;
if ((code *)stream[5] == memory_stream_read) {
memory_stream_read(&stream,&readByte,1,1);
}
else {
(*(code *)stream[5])(&readByte);
}
peerState[0x1a] = GHIDRA_UINT(readByte);
readByte = 0;
if ((code *)stream[5] == memory_stream_read) {
memory_stream_read(&stream,&readByte,1,1);
}
else {
(*(code *)stream[5])(&readByte);
}
peerState[0x1b] = GHIDRA_UINT(readByte);
(**(code **)(peerState[0x1c] + 4))(0,0xffffffff);
local_1c = local_1c & 0xffffffff;
if ((code *)stream[5] == memory_stream_read) {
memory_stream_read(&stream,(void *)(GHIDRA_INT(&local_1c) + 4),2,1);
}
else {
(*(code *)stream[5])(GHIDRA_INT(&local_1c) + 4);
}
if ((short)(local_1c >> 0x20) != 0) {
uVar4 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_1c)) + 0x4))) & 0xffff;
stateBlob = operator_new_tracked(uVar4);
memory_stream_read(&stream,stateBlob,1,uVar4);
(**(code **)(peerState[0x26] + 0x1c))(stateBlob,1,uVar4);
if (stateBlob != (void *)0x0) {
if (g_mainHeap == (void *)0x0) {
allocatedBytes = &g_allocatedBytesNoHeap;
}
else {
allocatedBytes = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar4 = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(stateBlob) + -4));
oldAllocatedBytes = *allocatedBytes;
*GHIDRA_CAST<uint *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar4;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocatedBytes) < uVar4));
free((void *)(GHIDRA_INT(stateBlob) + -4));
local_8 = local_8 & 0xffffff00;
}
}
readByte = 0;
if ((code *)stream[5] == memory_stream_read) {
memory_stream_read(&stream,&readByte,1,1);
}
else {
(*(code *)stream[5])(&readByte);
}
peerState[0x27] = GHIDRA_UINT(readByte);
readByte = 0;
if ((code *)stream[5] == memory_stream_read) {
memory_stream_read(&stream,&readByte,1,1);
}
else {
(*(code *)stream[5])(&readByte);
}
peerState[0x28] = GHIDRA_UINT(readByte);
(**(code **)(peerState[0x29] + 4))(0,0xffffffff);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_1c)) + 0x4))) = 0;
if ((code *)stream[5] == memory_stream_read) {
memory_stream_read(&stream,(void *)(GHIDRA_INT(&local_1c) + 4),2,1);
}
else {
(*(code *)stream[5])(GHIDRA_INT(&local_1c) + 4);
}
if ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((short)local_1c)) + 0x4))) == 0) {
LAB_009192e4:
freeFn = free_exref;
}
else {
uVar4 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_1c)) + 0x4))) & 0xffff;
stateBlob = operator_new_tracked(uVar4);
memory_stream_read(&stream,stateBlob,1,uVar4);
(**(code **)(peerState[0x33] + 0x1c))(stateBlob,1,uVar4);
if (stateBlob == (void *)0x0) goto LAB_009192e4;
if (g_mainHeap == (void *)0x0) {
allocatedBytes = &g_allocatedBytesNoHeap;
}
else {
allocatedBytes = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar4 = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(stateBlob) + -4));
oldAllocatedBytes = *allocatedBytes;
*GHIDRA_CAST<uint *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar4;
freeFn = free_exref;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocatedBytes) < uVar4));
free((void *)(GHIDRA_INT(stateBlob) + -4));
local_8 = local_8 & 0xffffff00;
}
local_20 = local_20 - 1;
uVar4 = local_20;
} while( true );
}
// 0091f780
void NetplayManager::load_mute_list()
{
char *pcVar1;
char isEof;
uint uVar2;
int *file;
int iVar3;
undefined1 *newlinePos;
char *lineCursor;
int *errnoPtr;
byte *mutedFlag;
int in_ECX;
undefined4 ****ppppuVar4;
code *pcVar5;
ulonglong userId;
undefined8 userIdKey;
int *muteSet;
undefined4 ****parseEnd;
undefined4 ****lineString [4];
undefined4 lineSize;
uint lineCapacity;
uint local_14;
void *local_10;
undefined1 *puStack_c;
undefined4 ***local_8;
local_8 = GHIDRA_CAST<undefined4 ***>(0xffffffff);
puStack_c = &LAB_00af32ed;
local_10 = ExceptionList;
uVar2 = __security_cookie ^ GHIDRA_UINT((lineString + 10));
ExceptionList = &local_10;
local_14 = uVar2;
if (DAT_00c72620 == '\0') {
sprintf_s(GHIDRA_CAST<byte *>(&DAT_00c72620),0x400,&DAT_00b60c28);
}
muteSet = GHIDRA_CAST<int *>((in_ECX + 0x620));
iVar3 = *muteSet;
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(muteSet,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)muteSet,
*(_Tree_node<unsigned_int,void*> **)(iVar3 + 4));
*GHIDRA_CAST<int *>((iVar3 + 4)) = iVar3;
*GHIDRA_CAST<int *>(iVar3) = iVar3;
*GHIDRA_CAST<int *>((iVar3 + 8)) = iVar3;
*GHIDRA_CAST<undefined4 *>((in_ECX + 0x624)) = 0;
file = (GHIDRA_CAST<SaveDataManager *>((&PTR_vftable_00c5aa80)))->SaveDataManager::open_file_read(GHIDRA_CAST<byte *>(&DAT_00c72620));
if (file != GHIDRA_CAST<int *>(0x0)) {
isEof = (**(code **)(*file + 0x10))(uVar2);
if (isEof == '\0') {
pcVar5 = strchr_exref;
do {
iVar3 = (**(code **)(*file + 0x18))(&DAT_00c93a50,0x400);
if (iVar3 != 0) {
newlinePos = GHIDRA_CAST<undefined1 *>((*pcVar5)(&DAT_00c93a50,0xd));
if (newlinePos != GHIDRA_CAST<undefined1 *>(0x0)) {
*newlinePos = 0;
}
newlinePos = GHIDRA_CAST<undefined1 *>((*pcVar5)(&DAT_00c93a50,10));
if (newlinePos != GHIDRA_CAST<undefined1 *>(0x0)) {
*newlinePos = 0;
}
lineSize = 0;
lineCapacity = 0xf;
lineString[0] = GHIDRA_CAST<undefined4 ****>(0x0);
pcVar1 = &DAT_00c93a50;
do {
lineCursor = pcVar1;
pcVar1 = lineCursor + 1;
} while (*lineCursor != '\0');
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(lineString))))->std::string::assign(&DAT_00c93a50,GHIDRA_UINT((lineCursor + -0xc93a50)));
local_8 = GHIDRA_CAST<undefined4 ***>(0x0);
errnoPtr = _errno();
ppppuVar4 = lineString;
if (0xf < lineCapacity) {
ppppuVar4 = lineString[0];
}
*errnoPtr = 0;
userId = strtoull(ppppuVar4,&parseEnd,10);
if (ppppuVar4 == parseEnd) {
std::_Xinvalid_argument("invalid stoull argument");
pcVar5 = (code *)swi(3);
(*pcVar5)();
return;
}
if (*errnoPtr == 0x22) {
/* WARNING: Subroutine does not return */
std::_Xout_of_range("stoull argument out of range");
}
userIdKey = userId;
mutedFlag = map_u64_bool_subscript(muteSet,&userIdKey);
local_8 = GHIDRA_CAST<undefined4 ***>(0xffffffff);
*mutedFlag = 1;
if (0xf < lineCapacity) {
uVar2 = lineCapacity + 1;
ppppuVar4 = lineString[0];
if (0xfff < uVar2) {
ppppuVar4 = GHIDRA_CAST<undefined4 ****>(lineString[0][-1]);
uVar2 = lineCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(lineString[0]) + (-4 - GHIDRA_INT(ppppuVar4))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(ppppuVar4,uVar2);
}
lineSize = 0;
lineCapacity = 0xf;
lineString[0] = GHIDRA_CAST<undefined4 ****>((GHIDRA_UINT(lineString[0]) & 0xffffff00));
pcVar5 = strchr_exref;
}
isEof = (**(code **)(*file + 0x10))();
} while (isEof == '\0');
}
(**(code **)*file)(1);
}
ExceptionList = local_10;
return;
}
// 00923920
void NetplayManager::update_text_popup()
{
uint *puVar1;
bool bVar2;
undefined4 uVar3;
byte bVar4;
NetplayManager NVar5;
std_string *psVar6;
std_string *psVar7;
uint uVar8;
char *pcVar9;
NetplayManager NVar10;
NetplayManager NVar11;
bool bVar12;
std_string animName;
std_string *local_8;
int message;
int messageTimer;
local_8 = GHIDRA_CAST<std_string *>((__security_cookie ^ GHIDRA_UINT((GHIDRA_INT(&animName) + 0x1cU))));
bVar12 = false;
if ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[0x47])) + 0x1))) != '\0') {
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((this + 0x11)))))->AnimationState::Update();
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((this + 0x19)))))->AnimationState::Update();
}
if (this[0x12] == (NetplayManager)0x0) {
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(animName._buf)) + 0x0))) = GHIDRA_CAST<std_string *>(0x0);
animName._capacity = 0xf;
animName._size = 0;
LAB_00923989:
psVar6 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(animName._buf))) + 0x0)));
psVar7 = &animName;
if (0xf < animName._capacity) {
psVar7 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(animName._buf))) + 0x0)));
}
bVar12 = true;
bVar4 = str_eq(GHIDRA_CAST<byte *>(psVar7),animName._size,GHIDRA_CAST<byte *>("TextIn"),6);
bVar2 = true;
if (bVar4 == 0) goto LAB_009239ae;
}
else {
if (*GHIDRA_CAST<char *>((this + 0x16)) == '\0') {
(GHIDRA_CAST<std::string *>((animName._buf)))->std::string::string((void *)this[0x12]);
goto LAB_00923989;
}
psVar6 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(animName._buf))) + 0x0)));
LAB_009239ae:
bVar2 = false;
}
if ((bVar12) && (0xf < animName._capacity)) {
uVar8 = animName._capacity + 1;
psVar7 = psVar6;
if (0xfff < uVar8) {
psVar7 = GHIDRA_CAST<std_string *>(psVar6[-1]._capacity);
uVar8 = animName._capacity + 0x24;
if (GHIDRA_CAST<byte *>(0x1f) < GHIDRA_CAST<byte *>((GHIDRA_INT(psVar6) + (-4 - GHIDRA_INT(psVar7))))) goto LAB_00923ac5;
}
operator_delete(psVar7,uVar8);
}
bVar12 = false;
if (bVar2) {
NVar10 = this[0x12];
if (NVar10 != (NetplayManager)0x0) {
NVar5 = NVar10;
if (0xf < *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(NVar10) + 0x14))) {
NVar5 = *GHIDRA_CAST<NetplayManager *>(NVar10);
}
pcVar9 = "TextStay";
do {
bVar4 = *GHIDRA_CAST<byte *>(NVar5);
bVar12 = bVar4 < (byte)*pcVar9;
if (bVar4 != *pcVar9) {
LAB_00923a30:
uVar8 = -GHIDRA_UINT(bVar12) | 1;
goto LAB_00923a35;
}
if (bVar4 == 0) break;
bVar4 = *GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(NVar5) + 1));
bVar12 = bVar4 < (byte)pcVar9[1];
if (bVar4 != pcVar9[1]) goto LAB_00923a30;
NVar5 = (NetplayManager)(GHIDRA_INT(NVar5) + 2);
pcVar9 = pcVar9 + 2;
} while (bVar4 != 0);
uVar8 = 0;
LAB_00923a35:
if (uVar8 == 0) {
if (*GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(NVar10) + 0x34)) == 0) {
return;
}
if (*GHIDRA_CAST<char *>((this + 0x16)) != '\0') {
return;
}
}
}
pcVar9 = "TextStay";
goto LAB_00923c61;
}
if (this[0x12] == (NetplayManager)0x0) {
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(animName._buf)) + 0x0))) = GHIDRA_CAST<std_string *>(0x0);
animName._capacity = 0xf;
animName._size = 0;
}
else {
(GHIDRA_CAST<std::string *>((animName._buf)))->std::string::string((void *)this[0x12]);
}
uVar3 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(animName._buf)) + 0x0)));
psVar6 = &animName;
if (0xf < animName._capacity) {
psVar6 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(animName._buf))) + 0x0)));
}
bVar4 = str_eq(GHIDRA_CAST<byte *>(psVar6),animName._size,GHIDRA_CAST<byte *>("TextStay"),8);
if (0xf < animName._capacity) {
uVar8 = animName._capacity + 1;
psVar6 = GHIDRA_CAST<std_string *>(uVar3);
if (0xfff < uVar8) {
psVar6 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>((uVar3 + -0x18)))->_capacity);
uVar8 = animName._capacity + 0x24;
if (GHIDRA_CAST<byte *>(0x1f) < GHIDRA_CAST<byte *>((uVar3 + (-4 - GHIDRA_INT(psVar6))))) {
LAB_00923ac5:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(psVar6,uVar8);
}
if (bVar4 != 0) {
NVar10 = this[2];
NVar5 = this[3];
NVar11 = this[1];
message = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(NVar11) + (GHIDRA_INT(NVar10) - 1U & GHIDRA_UINT(NVar5)) * 4));
messageTimer = *GHIDRA_CAST<int *>((message + 0x18));
if (0 < messageTimer) {
*GHIDRA_CAST<int *>((message + 0x18)) = messageTimer + -1;
NVar5 = this[3];
NVar10 = this[2];
NVar11 = this[1];
}
if (0 < *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(NVar11) + (GHIDRA_INT(NVar10) - 1U & GHIDRA_UINT(NVar5)) * 4)) + 0x18))) {
return;
}
NVar10 = this[0x12];
if (NVar10 != (NetplayManager)0x0) {
NVar5 = NVar10;
if (0xf < *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(NVar10) + 0x14))) {
NVar5 = *GHIDRA_CAST<NetplayManager *>(NVar10);
}
pcVar9 = "TextOut";
do {
bVar4 = *GHIDRA_CAST<byte *>(NVar5);
bVar12 = bVar4 < (byte)*pcVar9;
if (bVar4 != *pcVar9) {
LAB_00923b50:
uVar8 = -GHIDRA_UINT(bVar12) | 1;
goto LAB_00923b55;
}
if (bVar4 == 0) break;
bVar4 = *GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(NVar5) + 1));
bVar12 = bVar4 < (byte)pcVar9[1];
if (bVar4 != pcVar9[1]) goto LAB_00923b50;
NVar5 = (NetplayManager)(GHIDRA_INT(NVar5) + 2);
pcVar9 = pcVar9 + 2;
} while (bVar4 != 0);
uVar8 = 0;
LAB_00923b55:
if (uVar8 == 0) {
if (*GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(NVar10) + 0x34)) == 0) {
return;
}
if (*GHIDRA_CAST<char *>((this + 0x16)) != '\0') {
return;
}
}
}
pcVar9 = "TextOut";
goto LAB_00923c61;
}
if ((this[0x12] == (NetplayManager)0x0) || (*GHIDRA_CAST<char *>((this + 0x16)) == '\0')) {
psVar6 = (GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((this + 0x11)))))->ANM2::GetAnimation(&animName);
bVar12 = true;
puVar1 = &psVar6->_size;
if (0xf < psVar6->_capacity) {
psVar6 = *GHIDRA_CAST<std_string **>(psVar6->_buf);
}
bVar4 = str_eq(GHIDRA_CAST<byte *>(psVar6),*puVar1,GHIDRA_CAST<byte *>("TextOut"),7);
if ((bVar4 == 0) || (bVar2 = true, this[4] == (NetplayManager)0x0)) goto LAB_00923bbc;
}
else {
LAB_00923bbc:
bVar2 = false;
}
if ((bVar12) && (0xf < animName._capacity)) {
uVar8 = animName._capacity + 1;
psVar6 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(animName._buf))) + 0x0)));
if (0xfff < uVar8) {
psVar6 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(animName._buf)) + 0x0))) + -0x18)))->_capacity);
uVar8 = animName._capacity + 0x24;
if (GHIDRA_CAST<byte *>(0x1f) < GHIDRA_CAST<byte *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(animName._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar6))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(psVar6,uVar8);
}
if (!bVar2) {
return;
}
FUN_00923d30();
if (this[4] == (NetplayManager)0x0) {
return;
}
NVar10 = this[0x12];
if (NVar10 != (NetplayManager)0x0) {
NVar5 = NVar10;
if (0xf < *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(NVar10) + 0x14))) {
NVar5 = *GHIDRA_CAST<NetplayManager *>(NVar10);
}
pcVar9 = "TextIn";
do {
bVar4 = *GHIDRA_CAST<byte *>(NVar5);
bVar12 = bVar4 < (byte)*pcVar9;
if (bVar4 != *pcVar9) {
LAB_00923c47:
uVar8 = -GHIDRA_UINT(bVar12) | 1;
goto LAB_00923c4c;
}
if (bVar4 == 0) break;
bVar4 = *GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(NVar5) + 1));
bVar12 = bVar4 < (byte)pcVar9[1];
if (bVar4 != pcVar9[1]) goto LAB_00923c47;
NVar5 = (NetplayManager)(GHIDRA_INT(NVar5) + 2);
pcVar9 = pcVar9 + 2;
} while (bVar4 != 0);
uVar8 = 0;
LAB_00923c4c:
if (uVar8 == 0) {
if (*GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(NVar10) + 0x34)) == 0) {
return;
}
if (*GHIDRA_CAST<char *>((this + 0x16)) != '\0') {
return;
}
}
}
pcVar9 = "TextIn";
LAB_00923c61:
bVar4 = (GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((this + 5)))))->ANM2::SetAnimation(GHIDRA_CAST<byte *>(pcVar9),1);
if (bVar4 != 0) {
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((this + 0x11)))))->AnimationState::Rewind();
*GHIDRA_CAST<undefined1 *>((this + 0x16)) = 1;
}
return;
}