Files
isaac-port/generated-src/revive_player_menu.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

261 lines
11 KiB
C++

#include "classes.h"
// 008ef4b0
RevivePlayerMenu::~RevivePlayerMenu()
{
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
puStack_c = &LAB_00af0b40;
local_10 = ExceptionList;
ExceptionList = &local_10;
local_8 = 0;
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((GHIDRA_INT(this) + 0x124)))))->ANM2::Reset();
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x174)))))->AnimationState::~AnimationState();
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x154)))))->AnimationState::~AnimationState();
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((GHIDRA_INT(this) + 0x13c)))))->std::string::_Tidy_deallocate();
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((GHIDRA_INT(this) + 0x124)))))->std::string::_Tidy_deallocate();
local_8 = 1;
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((GHIDRA_INT(this) + 0x10)))))->ANM2::Reset();
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x60)))))->AnimationState::~AnimationState();
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x40)))))->AnimationState::~AnimationState();
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((GHIDRA_INT(this) + 0x28)))))->std::string::_Tidy_deallocate();
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((GHIDRA_INT(this) + 0x10)))))->std::string::_Tidy_deallocate();
ExceptionList = local_10;
return;
}
// 008ef560
void RevivePlayerMenu::Init()
{
byte bVar1;
byte *animNameCursor;
char *pcVar2;
uint uVar3;
bool isLess;
std_string menuAnmPath;
std_string selectorAnmPath;
uint local_24;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
byte *curAnim;
puStack_20 = GHIDRA_CAST<undefined1 *>((GHIDRA_INT(register0x00000010) + -4));
local_14 = 0xffffffff;
puStack_18 = &LAB_00af1f85;
local_1c = ExceptionList;
local_24 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U;
ExceptionList = &local_1c;
menuAnmPath._size = 0;
menuAnmPath._capacity = 0xf;
menuAnmPath._buf[0] = '\0';
menuAnmPath._buf[1] = '\0';
menuAnmPath._buf[2] = '\0';
menuAnmPath._buf[3] = '\0';
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(menuAnmPath._buf)) + 0x0))) = std::_Allocate(0x20);
menuAnmPath._size = 0x1d;
menuAnmPath._capacity = 0x1f;
builtin_strncpy((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(menuAnmPath._buf))) + 0x0))),"gfx/ui/Menu_RevivePlayer.anm2",0x1e);
local_14 = 0;
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((GHIDRA_INT(this) + 0x10)))))->ANM2::Load(&menuAnmPath,1);
local_14 = 0xffffffff;
if (0xf < menuAnmPath._capacity) {
uVar3 = menuAnmPath._capacity + 1;
pcVar2 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(menuAnmPath._buf))) + 0x0)));
if (0xfff < uVar3) {
pcVar2 = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(menuAnmPath._buf)) + 0x0))) + -4));
uVar3 = menuAnmPath._capacity + 0x24;
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(menuAnmPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar2))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pcVar2,uVar3);
}
curAnim = *GHIDRA_CAST<byte **>((GHIDRA_CAST<char *>(this) + 0x44));
if (curAnim == GHIDRA_CAST<byte *>(0x0)) {
LAB_008ef6a3:
bVar1 = (GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((GHIDRA_INT(this) + 0x10)))))->ANM2::SetAnimation(GHIDRA_CAST<byte *>("Background"),1);
if (bVar1 != 0) {
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x40)))))->AnimationState::Rewind();
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(this) + 0x54)) = 1;
}
}
else {
animNameCursor = curAnim;
if (0xf < *GHIDRA_CAST<uint *>((curAnim + 0x14))) {
animNameCursor = *GHIDRA_CAST<byte **>(curAnim);
}
pcVar2 = "Background";
do {
bVar1 = *animNameCursor;
isLess = bVar1 < (byte)*pcVar2;
if (bVar1 != *pcVar2) {
LAB_008ef690:
uVar3 = -GHIDRA_UINT(isLess) | 1;
goto LAB_008ef695;
}
if (bVar1 == 0) break;
bVar1 = animNameCursor[1];
isLess = bVar1 < (byte)pcVar2[1];
if (bVar1 != pcVar2[1]) goto LAB_008ef690;
animNameCursor = animNameCursor + 2;
pcVar2 = pcVar2 + 2;
} while (bVar1 != 0);
uVar3 = 0;
LAB_008ef695:
if ((uVar3 != 0) || ((curAnim[0x34] != 0 && (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this) + 0x54)) == '\0'))))
goto LAB_008ef6a3;
}
selectorAnmPath._size = 0;
selectorAnmPath._capacity = 0xf;
selectorAnmPath._buf[0] = '\0';
selectorAnmPath._buf[1] = '\0';
selectorAnmPath._buf[2] = '\0';
selectorAnmPath._buf[3] = '\0';
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(selectorAnmPath._buf)) + 0x0))) = std::_Allocate(0x30);
selectorAnmPath._size = 0x21;
selectorAnmPath._capacity = 0x2f;
builtin_strncpy((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(selectorAnmPath._buf))) + 0x0))),"gfx/ui/RevivePlayer_Selector.anm2",0x22);
local_14 = 1;
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((GHIDRA_INT(this) + 0x124)))))->ANM2::Load(&selectorAnmPath,1);
local_14 = 0xffffffff;
if (0xf < selectorAnmPath._capacity) {
uVar3 = selectorAnmPath._capacity + 1;
pcVar2 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(selectorAnmPath._buf))) + 0x0)));
if (0xfff < uVar3) {
pcVar2 = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(selectorAnmPath._buf)) + 0x0))) + -4));
uVar3 = selectorAnmPath._capacity + 0x24;
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(selectorAnmPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar2))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pcVar2,uVar3);
}
curAnim = *GHIDRA_CAST<byte **>((GHIDRA_CAST<char *>(this) + 0x158));
selectorAnmPath._size = 0;
selectorAnmPath._capacity = 0xf;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(selectorAnmPath._buf)) + 0x0))) = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(selectorAnmPath._buf)) + 0x0))) & 0xffffff00;
if (curAnim != GHIDRA_CAST<byte *>(0x0)) {
animNameCursor = curAnim;
if (0xf < *GHIDRA_CAST<uint *>((curAnim + 0x14))) {
animNameCursor = *GHIDRA_CAST<byte **>(curAnim);
}
pcVar2 = "UpperSelector";
do {
bVar1 = *animNameCursor;
isLess = bVar1 < (byte)*pcVar2;
if (bVar1 != *pcVar2) {
LAB_008ef7c0:
uVar3 = -GHIDRA_UINT(isLess) | 1;
goto LAB_008ef7c5;
}
if (bVar1 == 0) break;
bVar1 = animNameCursor[1];
isLess = bVar1 < (byte)pcVar2[1];
if (bVar1 != pcVar2[1]) goto LAB_008ef7c0;
animNameCursor = animNameCursor + 2;
pcVar2 = pcVar2 + 2;
} while (bVar1 != 0);
uVar3 = 0;
LAB_008ef7c5:
if ((uVar3 == 0) && ((curAnim[0x34] == 0 || (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this) + 0x168)) != '\0'))))
goto LAB_008ef7f1;
}
bVar1 = (GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((GHIDRA_INT(this) + 0x124)))))->ANM2::SetAnimation(GHIDRA_CAST<byte *>("UpperSelector"),1);
if (bVar1 != 0) {
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x154)))))->AnimationState::Rewind();
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(this) + 0x168)) = 1;
}
LAB_008ef7f1:
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x1c0)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x238));
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x1c4)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x238));
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 8)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4)) = 0xffffffff;
*GHIDRA_CAST<undefined4 *>(this) = 0;
ExceptionList = local_1c;
return;
}
// 008efe10
void RevivePlayerMenu::Render()
{
int iVar1;
float *nullFrame;
void *settings;
Entity_Player *player;
char *anim;
int *in_ECX;
KColor *color;
Manager *manager;
FontSettings fontSettings [5];
undefined4 local_40;
undefined4 local_3c;
KColor white;
Vector textPos;
int *menu;
Vector local_18;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
Game *game;
game = g_game;
local_8 = 0xffffffff;
puStack_c = &LAB_00b074bd;
local_10 = ExceptionList;
ExceptionList = &local_10;
menu = in_ECX;
iVar1 = (GHIDRA_CAST<PlayerManager *>((&g_game->_playerManager)))->PlayerManager::GetNumCoopPlayers();
if (((*in_ECX == 1) && (iVar1 != 0)) && ((game->_hud)._isVisible != 0)) {
textPos.x = g_screenWidth * 0.5;
textPos.y = g_screenHeight * 0.5;
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((in_ECX + 4)))))->ANM2::Render(&textPos,&g_vectorZero,&g_vectorZero);
manager = g_manager;
iVar1 = (GHIDRA_CAST<Font *>((&g_manager->_font2_TeamMeatEx12)))->Font::get_string_width_n(GHIDRA_CAST<byte *>("REVIVE PLAYER"),-1);
local_18.y = (float)((double)iVar1 + __uint_to_double_fixup[-(iVar1 >> 0x1f)]);
if (in_ECX[0x11] == 0) {
nullFrame = GHIDRA_CAST<float *>(0x0);
}
else {
nullFrame = (GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((in_ECX + 0x10)))))->AnimationState::GetNullFrame(GHIDRA_CAST<byte *>("Title"));
manager = g_manager;
}
textPos.y = textPos.y + nullFrame[1];
textPos.x = (textPos.x + *nullFrame) - local_18.y * 0.5;
(GHIDRA_CAST<FontSettings *>((fontSettings)))->FontSettings::constructor();
local_8 = 0;
(GHIDRA_CAST<KColor *>((&white)))->KColor::SetFromARGB(0xffffffff);
Font::DrawStringScaled
(&manager->_font2_TeamMeatEx12,GHIDRA_CAST<byte *>("REVIVE PLAYER"),&textPos,color,settings);
game = g_game;
local_8 = 0xffffffff;
iVar1 = in_ECX[2];
local_40 = 0;
local_3c = 0;
player = (GHIDRA_CAST<PlayerManager *>((&g_game->_playerManager)))->PlayerManager::get_main_player(iVar1);
iVar1 = (GHIDRA_CAST<HUD *>((&game->_hud)))->HUD::GetPlayerHUDLayout(iVar1,player);
FUN_009a6320(&local_18,player,iVar1);
if (g_screenHeight * 0.5 <= local_18.y) {
local_18.y = local_18.y - 35.0;
anim = "LowerSelector";
}
else if (iVar1 == 2) {
local_18.y = local_18.y + 50.0;
anim = "UpperSelector";
}
else {
local_18.y = local_18.y + 65.0;
anim = "UpperSelector";
}
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((menu + 0x49)))))->ANM2::Play(GHIDRA_CAST<byte *>(anim),0);
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((menu + 0x49)))))->ANM2::Render(&local_18,&g_vectorZero,&g_vectorZero);
}
ExceptionList = local_10;
return;
}