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>
103 lines
3.0 KiB
C++
103 lines
3.0 KiB
C++
#include "classes.h"
|
|
|
|
// 00a9f2b0
|
|
void LobbyLocalhost::read_welcome_message(void *data)
|
|
{
|
|
uint uVar1;
|
|
int tagCompare;
|
|
void *pvVar2;
|
|
undefined **local_40;
|
|
void *externalSize;
|
|
undefined4 local_38;
|
|
void *bufferBegin;
|
|
void *bufferEnd;
|
|
int bufferCapacityEnd;
|
|
void *externalData;
|
|
int bufferPos;
|
|
uint position;
|
|
uint bufferStart;
|
|
undefined **innerStream;
|
|
char local_14 [4];
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 local_8;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00b14e3d;
|
|
local_10 = ExceptionList;
|
|
uVar1 = __security_cookie ^ GHIDRA_UINT((local_14 + 0x10));
|
|
ExceptionList = &local_10;
|
|
strncpy(this,"lhwm",4);
|
|
bufferBegin = (void *)0x0;
|
|
bufferCapacityEnd = 0;
|
|
local_38 = 0xff;
|
|
externalSize = (void *)0xff;
|
|
externalData = data;
|
|
bufferStart = 0;
|
|
position = 0;
|
|
bufferPos = 0;
|
|
bufferEnd = (void *)0x0;
|
|
local_40 = KAGE::Filesys::BufferedStream::vftable;
|
|
innerStream = KAGE::Filesys::BufferedStream::vftable;
|
|
local_8 = 0;
|
|
memory_stream_read(&innerStream,local_14,4,1);
|
|
tagCompare = strncmp(local_14,"lhwm",4);
|
|
if (tagCompare != 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("Invalid localhost welcome message\n"));
|
|
}
|
|
data = (void *)0x0;
|
|
if ((code *)innerStream[5] == memory_stream_read) {
|
|
memory_stream_read(&innerStream,&data,4,1);
|
|
}
|
|
else {
|
|
(*(code *)innerStream[5])(&data,4,1,uVar1);
|
|
}
|
|
pvVar2 = bufferBegin;
|
|
if (externalData != (void *)0x0) {
|
|
pvVar2 = externalData;
|
|
}
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 8)) = GHIDRA_INT(pvVar2) + position;
|
|
position = position + GHIDRA_INT(data) * 8;
|
|
*(void **)(GHIDRA_CAST<char *>(this) + 4) = data;
|
|
data = (void *)(GHIDRA_INT(bufferEnd) - GHIDRA_INT(bufferBegin));
|
|
if (externalData != (void *)0x0) {
|
|
data = externalSize;
|
|
}
|
|
if ((position < bufferStart) || (data < (void *)(position - bufferStart))) {
|
|
(GHIDRA_CAST<KAGE::Filesys::BufferedStream *>((&local_40)))->KAGE::Filesys::BufferedStream::rebuffer();
|
|
}
|
|
bufferPos = position - bufferStart;
|
|
data = (void *)0x0;
|
|
if ((code *)innerStream[5] == memory_stream_read) {
|
|
memory_stream_read(&innerStream,&data,4,1);
|
|
}
|
|
else {
|
|
(*(code *)innerStream[5])(&data);
|
|
}
|
|
*(void **)(GHIDRA_CAST<char *>(this) + 0xc) = data;
|
|
innerStream = KAGE::Filesys::StreamBase::vftable;
|
|
local_40 = KAGE::Filesys::BufferedStreamBase::vftable;
|
|
externalSize = (void *)0x0;
|
|
local_38 = 0;
|
|
bufferEnd = bufferBegin;
|
|
externalData = (void *)0x0;
|
|
bufferPos = 0;
|
|
position = 0;
|
|
bufferStart = 0;
|
|
if (bufferBegin != (void *)0x0) {
|
|
uVar1 = bufferCapacityEnd - GHIDRA_INT(bufferBegin);
|
|
pvVar2 = bufferBegin;
|
|
if (0xfff < uVar1) {
|
|
pvVar2 = *(void **)(GHIDRA_CAST<char *>(bufferBegin) + -4);
|
|
uVar1 = uVar1 + 0x23;
|
|
if (0x1f < GHIDRA_UINT((GHIDRA_INT(bufferBegin) + (-4 - GHIDRA_INT(pvVar2))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(pvVar2,uVar1);
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|