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

The decompiled C++ tree moves to generated-src/ (classes.h, C++20); src/ is for code written by hand. A curated function
defines the generated declaration and starts its comment with its address, and source_tree.py stops emitting that body.
src/rng.cpp takes over RNG (SetSeed, the constructor, Next, RandomInt, RandomFloat, Shuffle) with the shift table read
from the exe as a constexpr array; src/log.h names KAGE_LogMessage's levels (1 INFO, 2 NET, 4 WARN, 8 ERROR, 16 ASSERT,
from its prefix jump table). CMakeLists.txt builds src/*.cpp against generated-src/classes.h (clean with -Wall -Wextra).
structs.hpp and headers.py are retired: scripts/merge_fields.py writes the merged field list, classes.h checks the layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-11-19 21:10:23 -05:00
1 parent 2ff2d5d87f
commit 3ce74c6e2d
331 files changed
+485 -7835

No files matched your search

+412
View File
@@ -0,0 +1,412 @@
#include "classes.h"
// 008df9b0
void Menu_LobbyList::render_lobbies()
{
Vector position;
Vector position_00;
char isLastRef;
float *loadingFrame;
byte *pbVar1;
int *other;
undefined4 userIdHigh;
int iVar2;
int iVar3;
std_string *text;
uint uVar4;
KColor *color;
undefined4 userIdLow;
AnimationState *animState;
float *lobbyListFrame;
Font *font;
float drawX;
float fVar5;
undefined1 auStackY_250 [128];
undefined **ppuVar6;
void *pvVar7;
void *pvVar8;
undefined1 auStack_1ba [2];
undefined1 quad [116];
undefined1 *local_13c;
undefined1 *local_138;
Vector iconPos;
int *image;
int *imageRefCount;
uint entryEnd;
undefined8 local_120;
int row;
Vector textPos;
int *lobbyImpl;
int *lobbyCtrl;
uint entryIndex;
undefined4 fontSettings;
undefined4 local_f8;
int local_f4;
undefined4 local_f0;
undefined4 local_ec;
int local_e8;
int local_e4;
undefined **otherLobby;
int *otherLobbyImpl;
int *otherLobbyCtrl;
float local_d4;
float *local_d0;
Vector drawPos;
float cursorX;
std_string stageName;
byte countText [132];
uint stackCookie;
undefined1 *puStack_20;
void *savedExceptionList;
undefined1 *puStack_18;
undefined4 local_14;
puStack_20 = countText + 0xa4;
local_14 = 0xffffffff;
puStack_18 = &LAB_00b0640f;
savedExceptionList = ExceptionList;
stackCookie = __security_cookie ^ GHIDRA_UINT((countText + 0x98));
ExceptionList = &savedExceptionList;
drawX = (g_menuManager->_ViewPosition).x + *GHIDRA_CAST<float *>(this);
local_d4 = (g_menuManager->_ViewPosition).y + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 4));
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x3c)) == 0) {
local_d0 = GHIDRA_CAST<float *>(0x0);
lobbyListFrame = GHIDRA_CAST<float *>(0x0);
puStack_20 = countText + 0xa4;
}
else {
loadingFrame = AnimationState::GetNullFrame
(GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x38)),GHIDRA_CAST<byte *>("Loading"));
local_d0 = loadingFrame;
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x3c)) == 0) {
lobbyListFrame = GHIDRA_CAST<float *>(0x0);
}
else {
lobbyListFrame =
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x38)))))->AnimationState::GetNullFrame(GHIDRA_CAST<byte *>("LobbyList"));
local_d0 = loadingFrame;
}
}
local_14 = (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x360)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x35c))) / 0x18;
if ((local_14 == 0) && (GHIDRA_UINT((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x354)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x350)))) < 0x20))
{
fontSettings = 1;
local_f8 = 0xffff;
font = &g_manager->_font2_TeamMeatEx12;
local_f0 = 0x3f800000;
local_ec = 0xffffffff;
textPos.x = drawX + *local_d0;
textPos.y = local_d4 + local_d0[1];
local_f4 = local_14;
local_e8 = local_14;
local_e4 = local_14;
pbVar1 = string_table_translate(&g_manager->_stringTable,GHIDRA_CAST<byte *>("#Online/NO_LOBBIES"));
(GHIDRA_CAST<Font *>((font)))->Font::DrawString(pbVar1,&textPos,GHIDRA_CAST<Vector *>((local_d0 + 4)),GHIDRA_CAST<KColor *>((GHIDRA_INT(this) + 0x374)),
&fontSettings);
}
else {
drawPos.x = drawX + *lobbyListFrame;
drawPos.y = local_d4 + lobbyListFrame[1];
entryIndex = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x368)) * 9;
entryEnd = local_14 + (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x354)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x350)) >> 5);
local_d0 = GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x368)) * 0x120));
row = 0;
cursorX = drawPos.x;
while (iVar2 = row, entryIndex < entryEnd) {
uVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x354)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x350)) >> 5;
if (entryIndex < uVar4) {
lobbyImpl = GHIDRA_CAST<int *>(0x0);
lobbyCtrl = GHIDRA_CAST<int *>(0x0);
local_14 = 1;
std::shared_ptr::assign
(&lobbyImpl,(void *)(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x350)) + GHIDRA_INT(local_d0) + 0xc));
local_14 = 2;
local_d4 = cursorX;
if (iVar2 == *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x36c))) {
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this) + 0x225)) != '\0') {
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this) + 0x18c)) == '\0') {
AnimationState::Render
(GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x14c)),&drawPos,&g_vectorZero,&g_vectorZero)
;
animState = GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x16c));
}
else {
AnimationState::Render
(GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x16c)),&drawPos,&g_vectorZero,&g_vectorZero)
;
animState = GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x14c));
}
AnimationState::Render(animState,&drawPos,&g_vectorZero,&g_vectorZero);
cursorX = drawPos.x;
}
local_138 = auStackY_250 + 0x88;
ppuVar6 = KAGE::Network::Multiplayer::ConstLobby::vftable;
pvVar7 = (void *)0x0;
pvVar8 = (void *)0x0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 3;
(GHIDRA_CAST<std::shared_ptr *>((auStack_1ba + -10)))->std::shared_ptr::assign(&lobbyImpl);
local_14 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),2);
render_lobby_info(this,ppuVar6,pvVar7,pvVar8);
}
fVar5 = drawPos.y - 2.0;
drawX = cursorX + 24.0;
drawPos.y = fVar5;
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>((stageName._buf + 4)))))->KColor::SetFromARGB(0xffffffff);
render_quad_set_uniform_color(quad,drawX,fVar5 + 4.0,drawX + 12.0,fVar5 + 12.0 + 4.0,color);
iVar2 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x350)) + GHIDRA_INT(local_d0) + 4));
if ((iVar2 == 0) || (other = GHIDRA_CAST<int *>((iVar2 + 0x14)), *other == 0)) {
other = GHIDRA_CAST<int *>(&DAT_00c799d8);
}
(GHIDRA_CAST<KAGE::SmartPointer *>((&image)))->KAGE::SmartPointer::operator_assign(other);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 4;
(**(code **)(*image + 0x1c))();
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 5;
if (((imageRefCount != GHIDRA_CAST<int *>(0x0)) &&
(isLastRef = (**(code **)(*imageRefCount + 0xc))(), isLastRef != '\0')) &&
(g_imageReleaseFn != (void *)0x0)) {
(*g_imageReleaseFn)();
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
drawX = cursorX + 24.0 + 16.0;
font = &g_manager->_font1_TeamMeatEx10;
iVar2 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x350)) + GHIDRA_INT(local_d0) + 4));
if (iVar2 == 0) {
local_120 = 0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_120)) + 0x4))) = 0.0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_120)) + 0x0))) = 0;
userIdHigh = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_120)) + 0x4)));
userIdLow = (undefined4)local_120;
}
else {
userIdHigh = *GHIDRA_CAST<undefined4 *>((iVar2 + 0xc));
userIdLow = *GHIDRA_CAST<undefined4 *>((iVar2 + 8));
}
drawPos.x = drawX;
pbVar1 = user_profile_format_display_name(CONCAT44(userIdHigh,userIdLow),font,0x46);
fontSettings = 0;
local_f8 = 0xffff;
local_f4 = 0;
local_f0 = 0x3f800000;
local_ec = 0xffffffff;
local_e8 = 0;
local_e4 = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 6;
(GHIDRA_CAST<Font *>((font)))->Font::DrawStringScaled(pbVar1,&drawPos,GHIDRA_CAST<KColor *>((GHIDRA_INT(this) + 0x374)),&fontSettings);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
drawX = drawX + 85.0;
drawPos.x = drawX;
if (lobbyImpl != GHIDRA_CAST<int *>(0x0)) {
(**(code **)(*lobbyImpl + 0x1c))();
}
sprintf(countText,GHIDRA_CAST<byte *>("%d / %d"));
fontSettings = 0;
local_f8 = 0xffff;
local_f4 = 0;
local_f0 = 0x3f800000;
local_ec = 0xffffffff;
local_e8 = 0;
local_e4 = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 7;
Font::DrawStringScaled
(&g_manager->_font1_TeamMeatEx10,countText,&drawPos,GHIDRA_CAST<KColor *>((GHIDRA_INT(this) + 0x374)),
&fontSettings);
local_14 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),2);
iVar2 = (g_manager->_optionsConfig)._eosCrossplay;
if ((iVar2 == 2) || (iVar2 == 3)) {
if (lobbyImpl == GHIDRA_CAST<int *>(0x0)) {
iVar2 = 0;
}
else {
iVar2 = (**(code **)(*lobbyImpl + 4))();
}
iconPos.x = drawX + 35.0 + 0.0;
iconPos.y = drawPos.y + 4.0;
iVar3 = 0;
if (iVar2 != 2) {
iVar3 = iVar2;
}
position.y = iconPos.y;
position.x = iconPos.x;
render_online_icon(iVar3,position,g_vectorOne.x,g_vectorOne.y);
}
cursorX = local_d4;
drawPos.x = local_d4;
drawPos.y = drawPos.y + 22.0;
local_14 = 8;
if (lobbyCtrl != GHIDRA_CAST<int *>(0x0)) {
isLastRef = (**(code **)(*lobbyCtrl + 0xc))();
goto joined_r0x008e0604;
}
}
else {
otherLobby = KAGE::Network::Multiplayer::ConstLobby::vftable;
otherLobbyImpl = GHIDRA_CAST<int *>(0x0);
otherLobbyCtrl = GHIDRA_CAST<int *>(0x0);
local_14 = 9;
std::shared_ptr::assign
(&otherLobbyImpl,
(void *)(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x35c)) + (entryIndex - uVar4) * 0x18 + 4));
local_14 = 10;
local_120 = CONCAT44(cursorX,(undefined4)local_120);
if (iVar2 == *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x36c))) {
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this) + 0x225)) != '\0') {
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this) + 0x18c)) == '\0') {
AnimationState::Render
(GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x14c)),&drawPos,&g_vectorZero,&g_vectorZero)
;
animState = GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x16c));
}
else {
AnimationState::Render
(GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x16c)),&drawPos,&g_vectorZero,&g_vectorZero)
;
animState = GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x14c));
}
AnimationState::Render(animState,&drawPos,&g_vectorZero,&g_vectorZero);
cursorX = drawPos.x;
}
local_13c = auStackY_250 + 0x88;
ppuVar6 = KAGE::Network::Multiplayer::ConstLobby::vftable;
pvVar7 = (void *)0x0;
pvVar8 = (void *)0x0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xb;
(GHIDRA_CAST<std::shared_ptr *>((auStack_1ba + -10)))->std::shared_ptr::assign(&otherLobbyImpl);
local_14 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),10);
render_lobby_info(this,ppuVar6,pvVar7,pvVar8);
}
drawPos.x = cursorX + 20.0;
if (otherLobbyImpl == GHIDRA_CAST<int *>(0x0)) {
iVar2 = 0;
}
else {
iVar2 = (**(code **)(*otherLobbyImpl + 0x30))();
}
animState = GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x260));
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x264)) != 0) {
(GHIDRA_CAST<AnimationState *>((animState)))->AnimationState::SetFrameFloat((float)iVar2);
}
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this) + 0x339)) != '\0') {
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this) + 0x2a0)) == '\0') {
AnimationState::Render(animState,&drawPos,&g_vectorZero,&g_vectorZero);
animState = GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x280));
}
else {
AnimationState::Render
(GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x280)),&drawPos,&g_vectorZero,&g_vectorZero);
}
AnimationState::Render(animState,&drawPos,&g_vectorZero,&g_vectorZero);
}
drawX = drawPos.x + 18.0;
drawPos.y = drawPos.y + 4.0;
drawPos.x = drawX;
if (otherLobbyImpl == GHIDRA_CAST<int *>(0x0)) {
iVar2 = 0;
LAB_008e030b:
fVar5 = 0.0;
LAB_008e0315:
iVar3 = 0;
}
else {
iVar2 = (**(code **)(*otherLobbyImpl + 0x30))();
if (otherLobbyImpl == GHIDRA_CAST<int *>(0x0)) goto LAB_008e030b;
fVar5 = (float)(**(code **)(*otherLobbyImpl + 0x30))();
local_d4 = fVar5;
if (otherLobbyImpl == GHIDRA_CAST<int *>(0x0)) goto LAB_008e0315;
iVar3 = (**(code **)(*otherLobbyImpl + 0x30))();
fVar5 = local_d4;
}
fontSettings = 3;
local_f8 = 0x50ffff;
local_f4 = 1;
local_ec = 0xffffffff;
local_e8 = 0;
local_e4 = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xc;
local_f0 = 0x3f333333;
if (iVar2 == 0) {
font = &g_manager->_font1_TeamMeatEx10;
pbVar1 = string_table_translate(&g_manager->_stringTable,GHIDRA_CAST<byte *>("#Online/IN_LOBBY"));
(GHIDRA_CAST<Font *>((font)))->Font::DrawStringScaled(pbVar1,&drawPos,GHIDRA_CAST<KColor *>((GHIDRA_INT(this) + 0x374)),&fontSettings);
}
else if (iVar2 == 0x3e9) {
font = &g_manager->_font1_TeamMeatEx10;
pbVar1 = string_table_translate(&g_manager->_stringTable,GHIDRA_CAST<byte *>("#Online/IN_DEATHMATCH"));
(GHIDRA_CAST<Font *>((font)))->Font::DrawStringScaled(pbVar1,&drawPos,GHIDRA_CAST<KColor *>((GHIDRA_INT(this) + 0x374)),&fontSettings);
}
else {
Level::get_stage_display_name(&stageName,iVar2,GHIDRA_INT(fVar5),0,0,0,GHIDRA_UINT((1 < iVar3)));
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xd;
text = &stageName;
if (0xf < stageName._capacity) {
text = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(stageName._buf))) + 0x0)));
}
Font::DrawStringScaled
(&g_manager->_font1_TeamMeatEx10,GHIDRA_CAST<byte *>(text),&drawPos,
GHIDRA_CAST<KColor *>((GHIDRA_INT(this) + 0x374)),&fontSettings);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xc;
if (0xf < stageName._capacity) {
uVar4 = stageName._capacity + 1;
pvVar7 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)stageName._buf)) + 0x0)));
if (0xfff < uVar4) {
pvVar7 = *(void **)((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(stageName._buf)) + 0x0))) + -4);
uVar4 = stageName._capacity + 0x24;
if (0x1f < ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(stageName._buf)) + 0x0))) - GHIDRA_INT(pvVar7)) - 4U) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar7,uVar4);
}
}
drawX = drawX + 80.0;
drawPos.x = drawX;
if (otherLobbyImpl != GHIDRA_CAST<int *>(0x0)) {
(**(code **)(*otherLobbyImpl + 0x1c))();
}
sprintf(countText,GHIDRA_CAST<byte *>("%d / %d"));
Font::DrawStringScaled
(&g_manager->_font1_TeamMeatEx10,countText,&drawPos,GHIDRA_CAST<KColor *>((GHIDRA_INT(this) + 0x374)),
&fontSettings);
iVar2 = (g_manager->_optionsConfig)._eosCrossplay;
if ((iVar2 == 2) || (iVar2 == 3)) {
if (otherLobbyImpl == GHIDRA_CAST<int *>(0x0)) {
iVar2 = 0;
}
else {
iVar2 = (**(code **)(*otherLobbyImpl + 4))();
}
textPos.x = drawX + 35.0 + 0.0;
textPos.y = drawPos.y + 4.0;
iVar3 = 0;
if (iVar2 != 2) {
iVar3 = iVar2;
}
position_00.y = textPos.y;
position_00.x = textPos.x;
render_online_icon(iVar3,position_00,g_vectorOne.x,g_vectorOne.y);
}
cursorX = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_120)) + 0x4)));
drawPos.x = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_120)) + 0x4)));
drawPos.y = drawPos.y + 16.0;
otherLobby = KAGE::Network::Multiplayer::ConstLobby::vftable;
local_14 = 0xe;
if (otherLobbyCtrl != GHIDRA_CAST<int *>(0x0)) {
isLastRef = (**(code **)(*otherLobbyCtrl + 0xc))();
joined_r0x008e0604:
if ((isLastRef != '\0') && (g_lobbyReleaseFn != (code *)0x0)) {
(*g_lobbyReleaseFn)();
}
}
}
row = row + 1;
local_d0 = GHIDRA_CAST<float *>((GHIDRA_INT(local_d0) + 0x20));
entryIndex = entryIndex + 1;
if (8 < GHIDRA_UINT(row)) {
ExceptionList = savedExceptionList;
return;
}
}
}
ExceptionList = savedExceptionList;
return;
}