Files
isaac-port/generated-src/revive_player_menu.cpp
T
shweetandClaude Opus 5.5 780767f5e1 Curation round 2, wave A: anm2 (Anm2Ed JSON), text, config as idiomatic classes; SDL3 platform opens a window
- anm2.h/.cpp take over ANM2, AnimationState, LayerState, AnmCache and the frame data. They read Anm2Ed's JSON documents
  with simdjson and play them as the game does (interpolation baked at load). src/anm2/ and msvc.h are retired.
- font, formatted_text, string_table and rich_text take over the text classes. FormattedText::parse is still bit-exact
  against its assembly.
- options_config and challenge_params take over OptionsConfig, ChallengeParams and the .ini helpers. The tests include
  Save's exact bytes.
- platform.h/.cpp and main.cpp run IsaacMain on SDL3: the window and GL context open, and the run stops at the first
  built-in shader (FUN_00a13fa0).
- source_tree.py: a taken-over parent stays bytes, taken-over methods are not re-emitted as a namespace, and every
  address in a (a, b, c to d) list on a comment counts as taken over.
- log.h: reconstruction_missing() for a taken-over class's methods that are not written yet.
206 functions taken over, boot path 89/615. The full build waits for wave B: item_config, entity_config and mod_manager
still use the old APIs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 23:04:54 -05:00

261 lines
10 KiB
C++

#include "classes.h"
// 008ef4b0
RevivePlayerMenu::~RevivePlayerMenu()
{
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
puStack_c = &LAB_00af0b40;
local_10 = ExceptionList;
ExceptionList = &local_10;
local_8 = 0;
ANM2::Reset(GHIDRA_CAST<ANM2 *>((GHIDRA_INT(this) + 0x124)));
AnimationState::~AnimationState(GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x174)));
AnimationState::~AnimationState(GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x154)));
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((GHIDRA_INT(this) + 0x13c)))))->msvc::string::_Tidy_deallocate();
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((GHIDRA_INT(this) + 0x124)))))->msvc::string::_Tidy_deallocate();
local_8 = 1;
ANM2::Reset(GHIDRA_CAST<ANM2 *>((GHIDRA_INT(this) + 0x10)));
AnimationState::~AnimationState(GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x60)));
AnimationState::~AnimationState(GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x40)));
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((GHIDRA_INT(this) + 0x28)))))->msvc::string::_Tidy_deallocate();
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((GHIDRA_INT(this) + 0x10)))))->msvc::string::_Tidy_deallocate();
ExceptionList = local_10;
return;
}
// 008ef560
void RevivePlayerMenu::Init()
{
uint8_t bVar1;
uint8_t *animNameCursor;
char *pcVar2;
uint32_t uVar3;
bool isLess;
std_string menuAnmPath;
std_string selectorAnmPath;
uint32_t local_24;
uint8_t *puStack_20;
void *local_1c;
uint8_t *puStack_18;
uint32_t local_14;
uint8_t *curAnim;
puStack_20 = GHIDRA_CAST<uint8_t *>((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<uint32_t *>((GHIDRA_CAST<char *>(&(menuAnmPath._buf)) + 0x0))) = msvc::_Allocate(0x20);
menuAnmPath._size = 0x1d;
menuAnmPath._capacity = 0x1f;
builtin_strncpy((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(menuAnmPath._buf))) + 0x0))),"gfx/ui/Menu_RevivePlayer.anm2",0x1e);
local_14 = 0;
ANM2::Load(GHIDRA_CAST<ANM2 *>((GHIDRA_INT(this) + 0x10)),&menuAnmPath,1);
local_14 = 0xffffffff;
if (0xf < menuAnmPath._capacity) {
uVar3 = menuAnmPath._capacity + 1;
pcVar2 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(menuAnmPath._buf))) + 0x0)));
if (0xfff < uVar3) {
pcVar2 = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(menuAnmPath._buf)) + 0x0))) + -4));
uVar3 = menuAnmPath._capacity + 0x24;
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<uint32_t *>((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<uint8_t **>((GHIDRA_CAST<char *>(this) + 0x44));
if (curAnim == GHIDRA_CAST<uint8_t *>(0x0)) {
LAB_008ef6a3:
bVar1 = ANM2::SetAnimation(GHIDRA_CAST<ANM2 *>((GHIDRA_INT(this) + 0x10)),GHIDRA_CAST<uint8_t *>("Background"),1);
if (bVar1 != 0) {
AnimationState::Rewind(GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x40)));
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(this) + 0x54)) = 1;
}
}
else {
animNameCursor = curAnim;
if (0xf < *GHIDRA_CAST<uint32_t *>((curAnim + 0x14))) {
animNameCursor = *GHIDRA_CAST<uint8_t **>(curAnim);
}
pcVar2 = "Background";
do {
bVar1 = *animNameCursor;
isLess = bVar1 < (uint8_t)*pcVar2;
if (bVar1 != *pcVar2) {
LAB_008ef690:
uVar3 = -GHIDRA_UINT(isLess) | 1;
goto LAB_008ef695;
}
if (bVar1 == 0) break;
bVar1 = animNameCursor[1];
isLess = bVar1 < (uint8_t)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<uint32_t *>((GHIDRA_CAST<char *>(&(selectorAnmPath._buf)) + 0x0))) = msvc::_Allocate(0x30);
selectorAnmPath._size = 0x21;
selectorAnmPath._capacity = 0x2f;
builtin_strncpy((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(selectorAnmPath._buf))) + 0x0))),"gfx/ui/RevivePlayer_Selector.anm2",0x22);
local_14 = 1;
ANM2::Load(GHIDRA_CAST<ANM2 *>((GHIDRA_INT(this) + 0x124)),&selectorAnmPath,1);
local_14 = 0xffffffff;
if (0xf < selectorAnmPath._capacity) {
uVar3 = selectorAnmPath._capacity + 1;
pcVar2 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(selectorAnmPath._buf))) + 0x0)));
if (0xfff < uVar3) {
pcVar2 = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(selectorAnmPath._buf)) + 0x0))) + -4));
uVar3 = selectorAnmPath._capacity + 0x24;
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<uint32_t *>((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<uint8_t **>((GHIDRA_CAST<char *>(this) + 0x158));
selectorAnmPath._size = 0;
selectorAnmPath._capacity = 0xf;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(selectorAnmPath._buf)) + 0x0))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(selectorAnmPath._buf)) + 0x0))) & 0xffffff00;
if (curAnim != GHIDRA_CAST<uint8_t *>(0x0)) {
animNameCursor = curAnim;
if (0xf < *GHIDRA_CAST<uint32_t *>((curAnim + 0x14))) {
animNameCursor = *GHIDRA_CAST<uint8_t **>(curAnim);
}
pcVar2 = "UpperSelector";
do {
bVar1 = *animNameCursor;
isLess = bVar1 < (uint8_t)*pcVar2;
if (bVar1 != *pcVar2) {
LAB_008ef7c0:
uVar3 = -GHIDRA_UINT(isLess) | 1;
goto LAB_008ef7c5;
}
if (bVar1 == 0) break;
bVar1 = animNameCursor[1];
isLess = bVar1 < (uint8_t)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 = ANM2::SetAnimation(GHIDRA_CAST<ANM2 *>((GHIDRA_INT(this) + 0x124)),GHIDRA_CAST<uint8_t *>("UpperSelector"),1);
if (bVar1 != 0) {
AnimationState::Rewind(GHIDRA_CAST<AnimationState *>((GHIDRA_INT(this) + 0x154)));
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(this) + 0x168)) = 1;
}
LAB_008ef7f1:
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x1c0)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x238));
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x1c4)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x238));
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 8)) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 4)) = 0xffffffff;
*GHIDRA_CAST<uint32_t *>(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 [6];
uint32_t local_40;
uint32_t local_3c;
KColor white;
Vector textPos;
int *menu;
Vector local_18;
void *local_10;
uint8_t *puStack_c;
uint32_t 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;
ANM2::Render(GHIDRA_CAST<ANM2 *>((in_ECX + 4)),&textPos,&g_vectorZero,&g_vectorZero);
manager = g_manager;
iVar1 = Font::get_string_width_n(&g_manager->_font2_TeamMeatEx12,GHIDRA_CAST<uint8_t *>("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 = AnimationState::GetNullFrame(GHIDRA_CAST<AnimationState *>((in_ECX + 0x10)),GHIDRA_CAST<uint8_t *>("Title"));
manager = g_manager;
}
textPos.y = textPos.y + nullFrame[1];
textPos.x = (textPos.x + *nullFrame) - local_18.y * 0.5;
FontSettings::constructor(fontSettings);
local_8 = 0;
(GHIDRA_CAST<KColor *>((&white)))->KColor::SetFromARGB(0xffffffff);
Font::DrawStringScaled
(&manager->_font2_TeamMeatEx12,GHIDRA_CAST<uint8_t *>("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";
}
ANM2::Play(GHIDRA_CAST<ANM2 *>((menu + 0x49)),GHIDRA_CAST<uint8_t *>(anim),0);
ANM2::Render(GHIDRA_CAST<ANM2 *>((menu + 0x49)),&local_18,&g_vectorZero,&g_vectorZero);
}
ExceptionList = local_10;
return;
}