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

1086 lines
49 KiB
C++

#include "classes.h"
// 008cd7b0
void Menu_Challenge::render_seed_text()
{
undefined4 uVar1;
undefined4 uVar2;
undefined4 uVar3;
void *pvVar4;
float *nullFrame;
undefined4 ******ppppppuVar5;
std_string *psVar6;
std_string *psVar7;
void *ptr;
int in_ECX;
undefined4 ******ppppppuVar8;
uint size;
uint uVar9;
undefined4 ******ppppppuVar10;
undefined4 ******ppppppuVar11;
undefined4 drawParams;
undefined4 local_98;
undefined4 local_94;
undefined4 local_90;
undefined4 local_8c;
undefined4 local_88;
undefined4 local_84;
Vector textPos;
float textY;
int menu;
std_string *linesBegin;
std_string *linesEnd;
std_string *linesCapacity;
undefined4 ******local_64;
undefined4 ******local_60;
undefined4 ******local_5c;
undefined4 ******local_58;
void *seedPart;
KColor local_50;
undefined4 ******seedText [4];
undefined4 ******seedTextSize;
undefined4 ******seedTextCapacity;
uint local_24;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 *****local_14;
puStack_20 = GHIDRA_CAST<undefined1 *>((seedText + 0xe));
local_14 = GHIDRA_CAST<undefined4 *****>(0xffffffff);
puStack_18 = &LAB_00b05ad0;
local_1c = ExceptionList;
local_24 = __security_cookie ^ GHIDRA_UINT((seedText + 0xb));
ExceptionList = &local_1c;
if (*GHIDRA_CAST<int *>((in_ECX + 0x34)) != 0) {
menu = in_ECX;
pvVar4 = (GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((in_ECX + 0x30)))))->AnimationState::GetNullFrame(&DAT_00b75670);
if (((pvVar4 == (void *)0x0) || (*GHIDRA_CAST<int *>((in_ECX + 0x4a8)) == 0)) ||
(pvVar4 = (GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((in_ECX + 0x4a4)))))->AnimationState::GetNullFrame(GHIDRA_CAST<byte *>("SeedPos")),
pvVar4 == (void *)0x0)) goto LAB_008cddc4;
local_58 = GHIDRA_CAST<undefined4 ******>(((g_menuManager->_ViewPosition).x + *GHIDRA_CAST<float *>((in_ECX + 0x7dc))));
local_5c = GHIDRA_CAST<undefined4 ******>(((g_menuManager->_ViewPosition).y + *GHIDRA_CAST<float *>((in_ECX + 0x7e0))));
if (*GHIDRA_CAST<int *>((in_ECX + 0x34)) == 0) {
nullFrame = GHIDRA_CAST<float *>(0x0);
}
else {
nullFrame = (GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((in_ECX + 0x30)))))->AnimationState::GetNullFrame(&DAT_00b75670);
}
local_58 = GHIDRA_CAST<undefined4 ******>(((float)local_58 + *nullFrame));
local_5c = GHIDRA_CAST<undefined4 ******>(((float)local_5c + nullFrame[1]));
if (*GHIDRA_CAST<int *>((in_ECX + 0x4a8)) == 0) {
nullFrame = GHIDRA_CAST<float *>(0x0);
}
else {
nullFrame = (GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((in_ECX + 0x4a4)))))->AnimationState::GetNullFrame(GHIDRA_CAST<byte *>("SeedPos"))
;
}
textPos.x = (float)local_58 + *nullFrame + 0.0;
textPos.y = (float)-*GHIDRA_CAST<int *>((in_ECX + 0x590)) + (float)local_5c + nullFrame[1];
textY = textPos.y;
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(seedText))))->std::string::string(&(g_manager->_lobbySettings)._seed);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))) = 0;
if (seedTextSize < &DAT_00000009) {
ppppppuVar11 = seedTextSize;
ppppppuVar10 = seedTextCapacity;
LAB_008cd921:
do {
ppppppuVar5 = seedText[0];
if (ppppppuVar11 == GHIDRA_CAST<undefined4 ******>(&DAT_00000004)) {
if (ppppppuVar10 < &DAT_00000005) {
if (GHIDRA_CAST<undefined4 ******>((0x7fffffff - (GHIDRA_UINT(ppppppuVar10) >> 1))) < ppppppuVar10) {
ppppppuVar8 = GHIDRA_CAST<undefined4 ******>(0x7fffffff);
}
else {
ppppppuVar11 = GHIDRA_CAST<undefined4 ******>((GHIDRA_INT(ppppppuVar10) + (GHIDRA_UINT(ppppppuVar10) >> 1)));
ppppppuVar8 = GHIDRA_CAST<undefined4 ******>(&DAT_0000000f);
if (&DAT_0000000f < ppppppuVar11) {
ppppppuVar8 = ppppppuVar11;
}
}
local_60 = ppppppuVar10;
local_64 = std::_Allocate(GHIDRA_UINT((GHIDRA_INT(ppppppuVar8) + 1)));
ppppppuVar11 = GHIDRA_CAST<undefined4 ******>(&DAT_00000005);
local_58 = GHIDRA_CAST<undefined4 ******>(&DAT_00000005);
seedTextSize = GHIDRA_CAST<undefined4 ******>(&DAT_00000005);
ppppppuVar10 = ppppppuVar8;
seedTextCapacity = ppppppuVar8;
if (local_60 < GHIDRA_CAST<undefined4 ******>(0x10)) {
*local_64 = ppppppuVar5;
*GHIDRA_CAST<undefined2 *>((local_64 + 1)) = 0x20;
seedText[0] = local_64;
}
else {
ppppppuVar8 = GHIDRA_CAST<undefined4 ******>((GHIDRA_INT(local_60) + 1));
*local_64 = *ppppppuVar5;
*GHIDRA_CAST<undefined2 *>((local_64 + 1)) = 0x20;
ppppppuVar11 = ppppppuVar5;
if (GHIDRA_CAST<undefined4 ******>(0xfff) < ppppppuVar8) {
ppppppuVar11 = GHIDRA_CAST<undefined4 ******>(ppppppuVar5[-1]);
ppppppuVar8 = local_60 + 9;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(ppppppuVar5) + (-4 - GHIDRA_INT(ppppppuVar11))))) goto LAB_008cddb4;
}
operator_delete(ppppppuVar11,GHIDRA_UINT(ppppppuVar8));
seedText[0] = local_64;
ppppppuVar11 = local_58;
}
goto LAB_008cd921;
}
seedTextSize = GHIDRA_CAST<undefined4 ******>(&DAT_00000005);
ppppppuVar11 = seedText;
if (&DAT_0000000f < ppppppuVar10) {
ppppppuVar11 = seedText[0];
}
*GHIDRA_CAST<undefined2 *>((ppppppuVar11 + 1)) = 0x20;
ppppppuVar11 = seedTextSize;
ppppppuVar8 = seedTextCapacity;
}
else if (ppppppuVar11 < ppppppuVar10) {
seedTextSize = GHIDRA_CAST<undefined4 ******>((GHIDRA_INT(ppppppuVar11) + 1));
ppppppuVar5 = seedText;
if (&DAT_0000000f < ppppppuVar10) {
ppppppuVar5 = seedText[0];
}
*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(ppppppuVar5) + GHIDRA_INT(ppppppuVar11))) = 0x2d;
ppppppuVar11 = seedTextSize;
ppppppuVar8 = seedTextCapacity;
}
else {
local_5c = ppppppuVar11;
if (ppppppuVar11 == GHIDRA_CAST<undefined4 ******>(0x7fffffff)) {
/* WARNING: Subroutine does not return */
std::string::_Xlen();
}
local_58 = GHIDRA_CAST<undefined4 ******>((GHIDRA_INT(ppppppuVar11) + 1));
ppppppuVar8 = GHIDRA_CAST<undefined4 ******>((GHIDRA_UINT(local_58) | 0xf));
if (ppppppuVar8 < GHIDRA_CAST<undefined4 ******>(0x80000000)) {
if (GHIDRA_CAST<undefined4 ******>((0x7fffffff - (GHIDRA_UINT(ppppppuVar10) >> 1))) < ppppppuVar10) {
ppppppuVar8 = GHIDRA_CAST<undefined4 ******>(0x7fffffff);
}
else {
ppppppuVar11 = GHIDRA_CAST<undefined4 ******>((GHIDRA_INT(ppppppuVar10) + (GHIDRA_UINT(ppppppuVar10) >> 1)));
if (ppppppuVar8 < ppppppuVar11) {
ppppppuVar8 = ppppppuVar11;
}
}
}
else {
ppppppuVar8 = GHIDRA_CAST<undefined4 ******>(0x7fffffff);
}
local_64 = ppppppuVar10;
local_60 = std::_Allocate(GHIDRA_UINT((GHIDRA_INT(ppppppuVar8) + 1)));
ppppppuVar11 = local_5c;
seedTextSize = local_58;
seedTextCapacity = ppppppuVar8;
if (local_64 < GHIDRA_CAST<undefined4 ******>(0x10)) {
memcpy(local_60,seedText,(size_t)local_5c);
*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(ppppppuVar11) + GHIDRA_INT(local_60))) = 0x2d;
}
else {
memcpy(local_60,ppppppuVar5,(size_t)local_5c);
*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(local_5c) + GHIDRA_INT(local_60))) = 0x2d;
ppppppuVar10 = GHIDRA_CAST<undefined4 ******>((GHIDRA_INT(local_64) + 1));
ppppppuVar11 = ppppppuVar5;
if (GHIDRA_CAST<undefined4 ******>(0xfff) < ppppppuVar10) {
ppppppuVar11 = GHIDRA_CAST<undefined4 ******>(ppppppuVar5[-1]);
ppppppuVar10 = local_64 + 9;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(ppppppuVar5) + (-4 - GHIDRA_INT(ppppppuVar11))))) goto LAB_008cddb4;
}
operator_delete(ppppppuVar11,GHIDRA_UINT(ppppppuVar10));
}
ppppppuVar11 = local_58;
seedText[0] = local_60;
}
ppppppuVar10 = ppppppuVar8;
} while (ppppppuVar11 < &DAT_00000009);
in_ECX = menu;
}
linesBegin = GHIDRA_CAST<std_string *>(0x0);
linesEnd = GHIDRA_CAST<std_string *>(0x0);
linesCapacity = GHIDRA_CAST<std_string *>(0x0);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 1;
psVar6 = GHIDRA_CAST<std_string *>(FUN_00651a90(&seedPart,0,4));
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
vector_string_emplace_reallocate_move(&linesBegin,GHIDRA_CAST<std_string *>(0x0),psVar6);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 1;
if (0xf < GHIDRA_UINT(local_50._unk)) {
uVar9 = local_50._unk + 1;
pvVar4 = seedPart;
if (0xfff < uVar9) {
pvVar4 = *(void **)(GHIDRA_CAST<char *>(seedPart) + -4);
uVar9 = local_50._unk + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(seedPart) + (-4 - GHIDRA_INT(pvVar4))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar4,uVar9);
}
psVar6 = GHIDRA_CAST<std_string *>(FUN_00651a90(&seedPart,5,4));
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 3;
if (linesEnd == linesCapacity) {
vector_string_emplace_reallocate_move(&linesBegin,linesEnd,psVar6);
}
else {
linesEnd->_buf[0] = '\0';
linesEnd->_buf[1] = '\0';
linesEnd->_buf[2] = '\0';
linesEnd->_buf[3] = '\0';
linesEnd->_size = 0;
linesEnd->_capacity = 0;
uVar1 = *GHIDRA_CAST<undefined4 *>((psVar6->_buf + 4));
uVar2 = *GHIDRA_CAST<undefined4 *>((psVar6->_buf + 8));
uVar3 = *GHIDRA_CAST<undefined4 *>((psVar6->_buf + 0xc));
*GHIDRA_CAST<undefined4 *>(linesEnd->_buf) = *GHIDRA_CAST<undefined4 *>(psVar6->_buf);
*GHIDRA_CAST<undefined4 *>((linesEnd->_buf + 4)) = uVar1;
*GHIDRA_CAST<undefined4 *>((linesEnd->_buf + 8)) = uVar2;
*GHIDRA_CAST<undefined4 *>((linesEnd->_buf + 0xc)) = uVar3;
uVar9 = psVar6->_capacity;
linesEnd->_size = psVar6->_size;
linesEnd->_capacity = uVar9;
linesEnd = linesEnd + 1;
psVar6->_size = 0;
psVar6->_capacity = 0xf;
psVar6->_buf[0] = '\0';
}
psVar6 = linesEnd;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 1;
if (0xf < GHIDRA_UINT(local_50._unk)) {
uVar9 = local_50._unk + 1;
pvVar4 = seedPart;
if (0xfff < uVar9) {
pvVar4 = *(void **)(GHIDRA_CAST<char *>(seedPart) + -4);
uVar9 = local_50._unk + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(seedPart) + (-4 - GHIDRA_INT(pvVar4))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar4,uVar9);
}
(GHIDRA_CAST<KColor *>((&local_50)))->KColor::SetFromARGB(0xff362f2d);
local_50._alpha = *GHIDRA_CAST<float *>((in_ECX + 0x7e8));
ppppppuVar11 = GHIDRA_CAST<undefined4 ******>(((GHIDRA_INT(psVar6) - GHIDRA_INT(linesBegin)) / 0x18));
local_64 = ppppppuVar11;
if (ppppppuVar11 != GHIDRA_CAST<undefined4 ******>(0x0)) {
psVar6 = linesBegin;
do {
drawParams = 1;
local_98 = 0xffff;
local_94 = 0;
local_90 = 0x3f800000;
local_8c = 0xffffffff;
local_88 = 0;
local_84 = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 4;
psVar7 = psVar6;
if (0xf < psVar6->_capacity) {
psVar7 = *GHIDRA_CAST<std_string **>(psVar6->_buf);
}
Font::DrawStringScaled
(&g_manager->_font3_TeamMeatEx16,GHIDRA_CAST<byte *>(psVar7),&textPos,&local_50,&drawParams);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 1;
psVar6 = psVar6 + 1;
textPos.y = (float)(ushort)(g_manager->_font3_TeamMeatEx16)._base + textY;
ppppppuVar11 = GHIDRA_CAST<undefined4 ******>((GHIDRA_INT(ppppppuVar11) + -1));
textY = textPos.y;
} while (ppppppuVar11 != GHIDRA_CAST<undefined4 ******>(0x0));
psVar6 = linesEnd;
}
psVar7 = linesBegin;
if (linesBegin != GHIDRA_CAST<std_string *>(0x0)) {
for (; psVar7 != psVar6; psVar7 = psVar7 + 1) {
uVar9 = psVar7->_capacity;
if (0xf < uVar9) {
pvVar4 = *(void **)psVar7->_buf;
size = uVar9 + 1;
ptr = pvVar4;
if (0xfff < size) {
ptr = *(void **)(GHIDRA_CAST<char *>(pvVar4) + -4);
size = uVar9 + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(pvVar4) + (-4 - GHIDRA_INT(ptr))))) goto LAB_008cddb4;
}
operator_delete(ptr,size);
}
psVar7->_size = 0;
psVar7->_capacity = 0xf;
psVar7->_buf[0] = 0;
}
uVar9 = ((GHIDRA_INT(linesCapacity) - GHIDRA_INT(linesBegin)) / 0x18) * 0x18;
psVar6 = linesBegin;
if (0xfff < uVar9) {
psVar6 = GHIDRA_CAST<std_string *>(linesBegin[-1]._capacity);
uVar9 = uVar9 + 0x23;
if (GHIDRA_CAST<byte *>(0x1f) < GHIDRA_CAST<byte *>((GHIDRA_INT(linesBegin) + (-4 - GHIDRA_INT(psVar6))))) goto LAB_008cddb4;
}
operator_delete(psVar6,uVar9);
}
if (&DAT_0000000f < seedTextCapacity) {
ppppppuVar10 = GHIDRA_CAST<undefined4 ******>((GHIDRA_INT(seedTextCapacity) + 1));
ppppppuVar11 = seedText[0];
if (GHIDRA_CAST<undefined4 ******>(0xfff) < ppppppuVar10) {
ppppppuVar11 = GHIDRA_CAST<undefined4 ******>(seedText[0][-1]);
ppppppuVar10 = seedTextCapacity + 9;
if (GHIDRA_CAST<undefined1 *>(0x1f) < GHIDRA_CAST<undefined1 *>((GHIDRA_INT(seedText[0]) + (-4 - GHIDRA_INT(ppppppuVar11))))) {
LAB_008cddb4:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(ppppppuVar11,GHIDRA_UINT(ppppppuVar10));
}
}
LAB_008cddc4:
ExceptionList = local_1c;
return;
}
// 00945db0
void Menu_Challenge::destructor()
{
char isLastImageRef;
int in_ECX;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
puStack_c = &LAB_00af0b40;
local_10 = ExceptionList;
ExceptionList = &local_10;
local_8 = 0;
if (*GHIDRA_CAST<int **>((in_ECX + 300)) != GHIDRA_CAST<int *>(0x0)) {
isLastImageRef =
(**(code **)(**GHIDRA_CAST<int **>((in_ECX + 300)) + 0xc))
(__security_cookie ^ GHIDRA_INT(register0x00000010) - 4U);
if ((isLastImageRef != '\0') && (g_imageReleaseFn != (void *)0x0)) {
(*g_imageReleaseFn)(in_ECX + 0x128);
}
}
local_8 = 1;
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((in_ECX + 0x14)))))->ANM2::Reset();
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((in_ECX + 100)))))->AnimationState::~AnimationState();
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((in_ECX + 0x44)))))->AnimationState::~AnimationState();
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((in_ECX + 0x2c)))))->std::string::_Tidy_deallocate();
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((in_ECX + 0x14)))))->std::string::_Tidy_deallocate();
ExceptionList = local_10;
return;
}
// 00945e50
void Menu_Challenge::Update()
{
Seeds unk;
KColor fadeColor;
std_string seed;
char isActionPressed;
byte isUnlocked;
uint challengeIdx;
Seeds *seeds;
undefined4 *in_ECX;
Manager *this;
uint uVar1;
PersistentGameData *extraout_ECX;
PersistentGameData *persistentData;
PersistentGameData *extraout_ECX_00;
int unused;
uint uVar2;
int extraout_EDX;
int extraout_EDX_00;
float scrollY;
Seeds aSStackY_2f08 [128];
undefined1 in_stack_ffffff54 [48];
undefined4 in_stack_ffffff84;
undefined4 in_stack_ffffff88;
undefined4 in_stack_ffffff8c;
undefined4 in_stack_ffffff90;
undefined4 in_stack_ffffff94;
undefined4 uVar3;
undefined4 in_stack_ffffff98;
undefined4 uVar4;
undefined4 in_stack_ffffff9c;
int iVar5;
undefined4 in_stack_ffffffa0;
undefined4 in_stack_ffffffa4;
undefined4 in_stack_ffffffa8;
void *in_stack_ffffffac;
uint in_stack_ffffffb0;
int difficulty;
char acStack_4a [2];
void *seedText [4];
undefined4 seedTextSize;
uint seedTextCapacity;
uint stackCookie;
void *local_10;
undefined1 *puStack_c;
void *local_8;
void *challengeParams;
Manager *manager;
MenuManager *menuManager;
local_8 = (void *)0xffffffff;
puStack_c = &LAB_00af32ed;
local_10 = ExceptionList;
stackCookie = __security_cookie ^ GHIDRA_UINT((seedText + 10));
ExceptionList = &local_10;
if (((g_manager->_framecount & 1) == 0) && (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(in_ECX) + 0x11d)) != '\0')) {
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((in_ECX + 0x11)))))->AnimationState::Update();
in_stack_ffffffb0 = 0x945ea5;
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((in_ECX + 0x19)))))->AnimationState::Update();
}
menuManager = g_menuManager;
if (g_menuManager->_fadeOutActive == 0) {
iVar5 = 0x945fd4;
isActionPressed = (**(code **)(PTR_vftable_00c57b18 + 0x74))();
manager = g_manager;
if (isActionPressed == '\0') {
isActionPressed = (**(code **)(PTR_vftable_00c57b18 + 0x74))();
if (isActionPressed == '\0') {
isActionPressed = (**(code **)(PTR_vftable_00c57b18 + 0x74))();
if (isActionPressed == '\0') {
isActionPressed = (**(code **)(PTR_vftable_00c57b18 + 0x74))();
if (isActionPressed == '\0') {
isActionPressed = (**(code **)(PTR_vftable_00c57b18 + 0x74))();
if ((isActionPressed != '\0') && (iVar5 = FUN_0098aef0(), iVar5 != 0x15)) {
MenuManager::push_menu(0xf,unused);
}
}
else {
iVar5 = FUN_0098aef0();
if ((iVar5 == 0x15) && ((g_manager->_lobbySettings)._challenge == 0)) {
(g_manager->_lobbySettings)._gameMode = 0;
}
FUN_0098aec0();
}
}
else {
iVar5 = in_ECX[2];
if ((iVar5 == 0) || ((0x31 < iVar5 && (iVar5 % 10 == 0)))) {
iVar5 = in_ECX[1];
persistentData = &g_manager->_persistentGameData;
do {
uVar1 = iVar5 + 1;
in_ECX[1] = uVar1;
if (GHIDRA_INT(uVar1) < 0x2e) {
if (uVar1 < 0x2e) {
iVar5 = *GHIDRA_CAST<int *>((&DAT_00b7b0b0 + uVar1 * 4));
}
else {
iVar5 = 0;
}
}
else {
in_ECX[1] = 1;
iVar5 = 0;
}
isUnlocked = (GHIDRA_CAST<PersistentGameData *>((persistentData)))->PersistentGameData::Unlocked(iVar5);
persistentData = extraout_ECX_00;
iVar5 = extraout_EDX_00;
} while (isUnlocked == 0);
}
}
}
else {
iVar5 = in_ECX[2];
if ((iVar5 == 0) || ((0x31 < iVar5 && (iVar5 % 10 == 0)))) {
iVar5 = in_ECX[1];
persistentData = &g_manager->_persistentGameData;
do {
uVar1 = iVar5 - 1;
in_ECX[1] = uVar1;
if (GHIDRA_INT(uVar1) < 1) {
in_ECX[1] = 0x2d;
iVar5 = 0x204;
}
else if (uVar1 < 0x2e) {
iVar5 = *GHIDRA_CAST<int *>((&DAT_00b7b0b0 + uVar1 * 4));
}
else {
iVar5 = 0;
}
isUnlocked = (GHIDRA_CAST<PersistentGameData *>((persistentData)))->PersistentGameData::Unlocked(iVar5);
persistentData = extraout_ECX;
iVar5 = extraout_EDX;
} while (isUnlocked == 0);
}
}
}
else {
uVar1 = GHIDRA_INT((g_menuManager->_menuStateHistory)._end) -
GHIDRA_INT((g_menuManager->_menuStateHistory)._begin) >> 2;
if ((uVar1 < 2) ||
(*GHIDRA_CAST<int *>((GHIDRA_INT((g_menuManager->_menuStateHistory)._begin) + uVar1 * 4 + -8)) != 0x15)) {
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>((acStack_4a + -0x2a)))))->KColor::SetFromARGB(0xff000000);
fadeColor._green = (float)in_stack_ffffff90;
fadeColor._red = (float)in_stack_ffffff8c;
fadeColor._blue = (float)in_stack_ffffff94;
fadeColor._alpha = (float)in_stack_ffffff98;
fadeColor._unk = iVar5;
MenuManager::start_game(fadeColor);
}
else {
(g_manager->_lobbySettings)._challenge = in_ECX[1];
(manager->_lobbySettings)._gameMode = 4;
FUN_0098aec0();
}
}
isActionPressed = (**(code **)(PTR_vftable_00c57b18 + 0x74))();
if ((isActionPressed == '\0') &&
(isActionPressed = (**(code **)(PTR_vftable_00c57b18 + 0x74))(), isActionPressed == '\0')) {
in_ECX[2] = 0;
}
else {
in_ECX[2] = in_ECX[2] + 1;
}
menuManager = g_menuManager;
iVar5 = in_ECX[1];
if (iVar5 < 5) {
scrollY = -216.0;
}
else if (iVar5 < 0x2b) {
scrollY = -216.0 - (float)((iVar5 + -4) * 0x16);
}
else {
scrollY = -1074.0;
}
g_menuManager->_viewPositionSet[7].y = scrollY;
menuManager->_state = 1;
*in_ECX = 0;
}
else if (1.0 <= g_menuManager->_fadeOutProgress) {
uVar1 = in_ECX[1];
challengeParams = (g_manager->_challengeParams)._begin;
seedTextCapacity = 0xf;
uVar2 = (GHIDRA_INT((g_manager->_challengeParams)._end) - GHIDRA_INT(challengeParams)) / 0xa4 - 1;
seedTextSize = 0;
seedText[0] = (void *)0x0;
challengeIdx = -GHIDRA_UINT((uVar1 != 0)) & uVar1;
if (uVar2 <= challengeIdx) {
challengeIdx = uVar2;
}
iVar5 = *GHIDRA_CAST<int *>((challengeIdx * 0xa4 + 0x44 + GHIDRA_INT(challengeParams)));
local_8 = (void *)0x0;
uVar3 = 0x945f3b;
(GHIDRA_CAST<std::string *>((acStack_4a + -0x1a)))->std::string::string(seedText);
uVar4 = 0x945f46;
seed._buf[4] = (char)in_stack_ffffffa0;
seed._buf[5] = (char)(GHIDRA_UINT(in_stack_ffffffa0) >> 8);
seed._buf[6] = (char)(GHIDRA_UINT(in_stack_ffffffa0) >> 0x10);
seed._buf[7] = (char)(GHIDRA_UINT(in_stack_ffffffa0) >> 0x18);
seed._buf[0] = (char)in_stack_ffffff9c;
seed._buf[1] = (char)(GHIDRA_UINT(in_stack_ffffff9c) >> 8);
seed._buf[2] = (char)(GHIDRA_UINT(in_stack_ffffff9c) >> 0x10);
seed._buf[3] = (char)(GHIDRA_UINT(in_stack_ffffff9c) >> 0x18);
seed._buf[8] = (char)in_stack_ffffffa4;
seed._buf[9] = (char)(GHIDRA_UINT(in_stack_ffffffa4) >> 8);
seed._buf[10] = (char)(GHIDRA_UINT(in_stack_ffffffa4) >> 0x10);
seed._buf[0xb] = (char)(GHIDRA_UINT(in_stack_ffffffa4) >> 0x18);
seed._buf[0xc] = (char)in_stack_ffffffa8;
seed._buf[0xd] = (char)(GHIDRA_UINT(in_stack_ffffffa8) >> 8);
seed._buf[0xe] = (char)(GHIDRA_UINT(in_stack_ffffffa8) >> 0x10);
seed._buf[0xf] = (char)(GHIDRA_UINT(in_stack_ffffffa8) >> 0x18);
seed._size = GHIDRA_UINT(in_stack_ffffffac);
seed._capacity = in_stack_ffffffb0;
(GHIDRA_CAST<Seeds *>((&menuManager->_seedsObject)))->Seeds::SetStartSeed(seed);
local_8 = (void *)0xffffffff;
if (0xf < seedTextCapacity) {
uVar2 = seedTextCapacity + 1;
in_stack_ffffffac = seedText[0];
if (0xfff < uVar2) {
in_stack_ffffffac = *(void **)(GHIDRA_INT(seedText[0]) + -4);
uVar2 = seedTextCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(seedText[0]) + (-4 - GHIDRA_INT(in_stack_ffffffac))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
in_stack_ffffffa8 = 0x945f80;
operator_delete(in_stack_ffffffac,uVar2);
}
seeds = &g_menuManager->_seedsObject;
seeds->_isCustomRun = 1;
difficulty = *GHIDRA_CAST<int *>((challengeIdx * 0xa4 + 0x70 + GHIDRA_INT(challengeParams)));
(GHIDRA_CAST<Seeds *>((aSStackY_2f08 + 0x81)))->Seeds::construct_from_copy(seeds);
unk._stageSeeds[6] = in_stack_ffffff84;
unk._isCustomRun = in_stack_ffffff54[0];
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(unk)) + 0x1))) = (*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(in_stack_ffffff54)) + 0x1)));
unk._gameStartSeed = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_ffffff54)) + 0x4)));
unk._rng._seed = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_ffffff54)) + 0x8)));
unk._rng._shift1 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_ffffff54)) + 0xc)));
unk._rng._shift2 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_ffffff54)) + 0x10)));
unk._rng._shift3 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_ffffff54)) + 0x14)));
unk._stageSeeds[0] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_ffffff54)) + 0x18)));
unk._stageSeeds[1] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_ffffff54)) + 0x1c)));
unk._stageSeeds[2] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_ffffff54)) + 0x20)));
unk._stageSeeds[3] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_ffffff54)) + 0x24)));
unk._stageSeeds[4] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_ffffff54)) + 0x28)));
unk._stageSeeds[5] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_ffffff54)) + 0x2c)));
unk._stageSeeds[7] = in_stack_ffffff88;
unk._stageSeeds[8] = in_stack_ffffff8c;
unk._stageSeeds[9] = in_stack_ffffff90;
unk._stageSeeds[10] = uVar3;
unk._stageSeeds[0xb] = uVar4;
unk._stageSeeds[0xc] = in_stack_ffffff9c;
unk._stageSeeds[0xd] = in_stack_ffffffa0;
unk._playerInitSeed = in_stack_ffffffa4;
unk._seedEffects = (void *)in_stack_ffffffa8;
unk._seedEffectsCount = GHIDRA_INT(in_stack_ffffffac);
this->Manager::StartNewGame(iVar5,uVar1,unk,difficulty);
}
ExceptionList = local_10;
return;
}
// 009462c0
void Menu_Challenge::Render()
{
Vector pos;
Vector scale;
LayerState *layer;
void *pvVar1;
float *customButtonFrame;
uint uVar2;
AnimationState *secondAnimState;
AnimationLayer *animLayer;
int iVar3;
ANM2 *pAVar4;
Vector menuPos;
ANM2 *challengeSprite;
Vector local_24;
int prevMenuState;
uint challengeIndex;
byte isChallengeDone;
byte isLayerVisible;
uVar2 = GHIDRA_INT((g_menuManager->_menuStateHistory)._end) -
GHIDRA_INT((g_menuManager->_menuStateHistory)._begin) >> 2;
if (uVar2 < 2) {
prevMenuState = 0;
}
else {
prevMenuState = *GHIDRA_CAST<int *>((GHIDRA_INT((g_menuManager->_menuStateHistory)._begin) + uVar2 * 4 + -8));
}
if ((g_menuControllerIndex != 0) || (isLayerVisible = 1, prevMenuState == 0x15)) {
isLayerVisible = 0;
}
challengeSprite = &this->ChallengeMenuSprite;
layer = (GHIDRA_CAST<ANM2 *>((challengeSprite)))->ANM2::GetLayer(GHIDRA_CAST<byte *>("CustomTab"));
pAVar4 = &this->ChallengeMenuSprite;
layer->_visible = isLayerVisible;
layer = (GHIDRA_CAST<ANM2 *>((pAVar4)))->ANM2::GetLayer(GHIDRA_CAST<byte *>(0x2));
layer->_visible = 0;
layer = (GHIDRA_CAST<ANM2 *>((pAVar4)))->ANM2::GetLayer(&DAT_0000000e);
layer->_visible = 0;
layer = (GHIDRA_CAST<ANM2 *>((pAVar4)))->ANM2::GetLayer(&DAT_0000000f);
layer->_visible = 0;
layer = (GHIDRA_CAST<ANM2 *>((pAVar4)))->ANM2::GetLayer(&DAT_0000000d);
layer->_visible = 0;
menuPos.x = (g_menuManager->_ViewPosition).x + this->PositionX;
menuPos.y = (g_menuManager->_ViewPosition).y + this->PositionY;
if ((this->ChallengeMenuSprite)._loaded != 0) {
if ((this->ChallengeMenuSprite)._overlayRenderFirst == 0) {
AnimationState::Render
(&(this->ChallengeMenuSprite)._animState,&menuPos,&g_vectorZero,&g_vectorZero);
secondAnimState = &(this->ChallengeMenuSprite)._overlayAnimState;
}
else {
AnimationState::Render
(&(this->ChallengeMenuSprite)._overlayAnimState,&menuPos,&g_vectorZero,&g_vectorZero
);
secondAnimState = &(this->ChallengeMenuSprite)._animState;
}
AnimationState::Render(secondAnimState,&menuPos,&g_vectorZero,&g_vectorZero);
}
layer = (GHIDRA_CAST<ANM2 *>((&this->ChallengeMenuSprite)))->ANM2::GetLayer(GHIDRA_CAST<byte *>(0x2));
layer->_visible = 1;
challengeIndex = 1;
do {
if (challengeIndex < 0x2e) {
uVar2 = *GHIDRA_CAST<uint *>((&DAT_00b7b0b0 + challengeIndex * 4));
if (uVar2 == 0xfffffffe) {
isLayerVisible = 0;
}
else {
if (GHIDRA_INT(uVar2) < 0) goto LAB_00946450;
if (uVar2 < 0x282) {
if (((uVar2 == 0) || ((g_manager->_persistentGameData)._achievements[uVar2] != 0)) ||
(((g_manager->_state == 2 && (g_game != GHIDRA_CAST<Game *>(0x0))) &&
(((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0))))))
goto LAB_00946450;
isLayerVisible = 0;
}
else {
isLayerVisible = 0;
}
}
}
else {
LAB_00946450:
isLayerVisible = 1;
}
if ((this->ChallengeMenuSprite)._animState._animData != (void *)0x0) {
if ((0xe < *GHIDRA_CAST<int *>((GHIDRA_INT((this->ChallengeMenuSprite)._animState._animation) + 0x80))) ||
(KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("LayerId out of bounds\n")),
0xe < *GHIDRA_CAST<int *>((GHIDRA_INT((this->ChallengeMenuSprite)._animState._animation) + 0x80)))) {
pvVar1 = (this->ChallengeMenuSprite)._animState._animData;
local_24.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + 0x70));
if ((pvVar1 == (void *)0x0) ||
((GHIDRA_INT(local_24.y) < 0 || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x1c)) <= GHIDRA_INT(local_24.y))))) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("id out of bounds\n"));
}
*(undefined4 *)
(GHIDRA_INT((this->ChallengeMenuSprite)._animState._layerFrames) + GHIDRA_INT(local_24.y) * 4) = 0;
AnimationState::AdvanceLayerPosition
(&(this->ChallengeMenuSprite)._animState,GHIDRA_INT(local_24.y),
(float)GHIDRA_INT((challengeIndex - 1)));
}
if ((this->ChallengeMenuSprite)._animState._animData != (void *)0x0) {
if ((0xf < *GHIDRA_CAST<int *>((GHIDRA_INT((this->ChallengeMenuSprite)._animState._animation) + 0x80))) ||
(KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("LayerId out of bounds\n")),
0xf < *GHIDRA_CAST<int *>((GHIDRA_INT((this->ChallengeMenuSprite)._animState._animation) + 0x80)))) {
pvVar1 = (this->ChallengeMenuSprite)._animState._animData;
local_24.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + 0x74));
if ((pvVar1 == (void *)0x0) ||
((GHIDRA_INT(local_24.y) < 0 || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x1c)) <= GHIDRA_INT(local_24.y))))) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("id out of bounds\n"));
}
*(undefined4 *)
(GHIDRA_INT((this->ChallengeMenuSprite)._animState._layerFrames) + GHIDRA_INT(local_24.y) * 4) = 0;
AnimationState::AdvanceLayerPosition
(&(this->ChallengeMenuSprite)._animState,GHIDRA_INT(local_24.y),
(float)GHIDRA_INT((challengeIndex - 1)));
}
if (((this->ChallengeMenuSprite)._animState._animData != (void *)0x0) &&
((0xd < *GHIDRA_CAST<int *>((GHIDRA_INT((this->ChallengeMenuSprite)._animState._animation) + 0x80)) ||
(KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("LayerId out of bounds\n")),
0xd < *GHIDRA_CAST<int *>((GHIDRA_INT((this->ChallengeMenuSprite)._animState._animation) + 0x80)))))) {
pvVar1 = (this->ChallengeMenuSprite)._animState._animData;
local_24.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + 0x6c));
if ((pvVar1 == (void *)0x0) ||
((GHIDRA_INT(local_24.y) < 0 || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x1c)) <= GHIDRA_INT(local_24.y))))) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("id out of bounds\n"));
}
*(undefined4 *)
(GHIDRA_INT((this->ChallengeMenuSprite)._animState._layerFrames) + GHIDRA_INT(local_24.y) * 4) = 0;
AnimationState::AdvanceLayerPosition
(&(this->ChallengeMenuSprite)._animState,GHIDRA_INT(local_24.y),
(float)GHIDRA_INT((challengeIndex - 1)));
}
}
}
layer = (GHIDRA_CAST<ANM2 *>((&this->ChallengeMenuSprite)))->ANM2::GetLayer(&DAT_0000000e);
layer->_visible = isLayerVisible;
isChallengeDone =
*GHIDRA_CAST<byte *>((GHIDRA_INT((g_manager->_persistentGameData)._cutsceneCounters) + (challengeIndex - 0x31)
));
layer = (GHIDRA_CAST<ANM2 *>((&this->ChallengeMenuSprite)))->ANM2::GetLayer(&DAT_0000000f);
isLayerVisible = isLayerVisible ^ 1;
layer->_visible = isChallengeDone;
layer = (GHIDRA_CAST<ANM2 *>((&this->ChallengeMenuSprite)))->ANM2::GetLayer(&DAT_0000000d);
layer->_visible = isLayerVisible;
if ((this->ChallengeMenuSprite)._loaded != 0) {
if ((this->ChallengeMenuSprite)._overlayRenderFirst == 0) {
pvVar1 = (this->ChallengeMenuSprite)._animState._animData;
if (((pvVar1 != (void *)0x0) &&
(pAVar4 = (this->ChallengeMenuSprite)._animState._animation, 0xe < pAVar4->_layerCount))
&& (iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x70)), -1 < iVar3)) {
AnimationLayer::RenderFrame
(GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x18)))),&menuPos,
*GHIDRA_CAST<int *>((GHIDRA_INT((this->ChallengeMenuSprite)._animState._layerFrames) + iVar3 * 4)),
&g_vectorZero,&g_vectorZero,pAVar4);
}
pvVar1 = (this->ChallengeMenuSprite)._overlayAnimState._animData;
if (((pvVar1 != (void *)0x0) &&
(pAVar4 = (this->ChallengeMenuSprite)._overlayAnimState._animation,
0xe < pAVar4->_layerCount)) && (iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x70)), -1 < iVar3)) {
animLayer = GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x18))));
pvVar1 = (this->ChallengeMenuSprite)._overlayAnimState._layerFrames;
goto LAB_009466e1;
}
}
else {
pvVar1 = (this->ChallengeMenuSprite)._overlayAnimState._animData;
if (((pvVar1 != (void *)0x0) &&
(pAVar4 = (this->ChallengeMenuSprite)._overlayAnimState._animation,
0xe < pAVar4->_layerCount)) && (iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x70)), -1 < iVar3)) {
AnimationLayer::RenderFrame
(GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x18)))),&menuPos,
*GHIDRA_CAST<int *>((GHIDRA_INT((this->ChallengeMenuSprite)._overlayAnimState._layerFrames) +
iVar3 * 4)),&g_vectorZero,&g_vectorZero,pAVar4);
}
pvVar1 = (this->ChallengeMenuSprite)._animState._animData;
if (((pvVar1 != (void *)0x0) &&
(pAVar4 = (this->ChallengeMenuSprite)._animState._animation, 0xe < pAVar4->_layerCount))
&& (iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x70)), -1 < iVar3)) {
animLayer = GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x18))));
pvVar1 = (this->ChallengeMenuSprite)._animState._layerFrames;
LAB_009466e1:
AnimationLayer::RenderFrame
(animLayer,&menuPos,*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + iVar3 * 4)),&g_vectorZero,
&g_vectorZero,pAVar4);
}
}
if ((this->ChallengeMenuSprite)._loaded != 0) {
if ((this->ChallengeMenuSprite)._overlayRenderFirst == 0) {
pvVar1 = (this->ChallengeMenuSprite)._animState._animData;
if (((pvVar1 != (void *)0x0) &&
(pAVar4 = (this->ChallengeMenuSprite)._animState._animation, 0xf < pAVar4->_layerCount
)) && (iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x74)), -1 < iVar3)) {
AnimationLayer::RenderFrame
(GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x18)))),&menuPos,
*GHIDRA_CAST<int *>((GHIDRA_INT((this->ChallengeMenuSprite)._animState._layerFrames) + iVar3 * 4
)),&g_vectorZero,&g_vectorZero,pAVar4);
}
pvVar1 = (this->ChallengeMenuSprite)._overlayAnimState._animData;
if (((pvVar1 != (void *)0x0) &&
(pAVar4 = (this->ChallengeMenuSprite)._overlayAnimState._animation,
0xf < pAVar4->_layerCount)) && (iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x74)), -1 < iVar3)) {
animLayer = GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x18))));
pvVar1 = (this->ChallengeMenuSprite)._overlayAnimState._layerFrames;
goto LAB_009467de;
}
}
else {
pvVar1 = (this->ChallengeMenuSprite)._overlayAnimState._animData;
if (((pvVar1 != (void *)0x0) &&
(pAVar4 = (this->ChallengeMenuSprite)._overlayAnimState._animation,
0xf < pAVar4->_layerCount)) && (iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x74)), -1 < iVar3)) {
AnimationLayer::RenderFrame
(GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x18)))),&menuPos,
*GHIDRA_CAST<int *>((GHIDRA_INT((this->ChallengeMenuSprite)._overlayAnimState._layerFrames) +
iVar3 * 4)),&g_vectorZero,&g_vectorZero,pAVar4);
}
pvVar1 = (this->ChallengeMenuSprite)._animState._animData;
if (((pvVar1 != (void *)0x0) &&
(pAVar4 = (this->ChallengeMenuSprite)._animState._animation, 0xf < pAVar4->_layerCount
)) && (iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x74)), -1 < iVar3)) {
animLayer = GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x18))));
pvVar1 = (this->ChallengeMenuSprite)._animState._layerFrames;
LAB_009467de:
AnimationLayer::RenderFrame
(animLayer,&menuPos,*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + iVar3 * 4)),&g_vectorZero,
&g_vectorZero,pAVar4);
}
}
if ((this->ChallengeMenuSprite)._loaded != 0) {
if ((this->ChallengeMenuSprite)._overlayRenderFirst == 0) {
pvVar1 = (this->ChallengeMenuSprite)._animState._animData;
if (((pvVar1 != (void *)0x0) &&
(pAVar4 = (this->ChallengeMenuSprite)._animState._animation,
0xd < pAVar4->_layerCount)) && (iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x6c)), -1 < iVar3)) {
AnimationLayer::RenderFrame
(GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x18)))),&menuPos,
*GHIDRA_CAST<int *>((GHIDRA_INT((this->ChallengeMenuSprite)._animState._layerFrames) +
iVar3 * 4)),&g_vectorZero,&g_vectorZero,pAVar4);
}
pvVar1 = (this->ChallengeMenuSprite)._overlayAnimState._animData;
if (((pvVar1 != (void *)0x0) &&
(pAVar4 = (this->ChallengeMenuSprite)._overlayAnimState._animation,
0xd < pAVar4->_layerCount)) && (iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x6c)), -1 < iVar3)) {
animLayer = GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x18))));
pvVar1 = (this->ChallengeMenuSprite)._overlayAnimState._layerFrames;
goto LAB_009468db;
}
}
else {
pvVar1 = (this->ChallengeMenuSprite)._overlayAnimState._animData;
if (((pvVar1 != (void *)0x0) &&
(pAVar4 = (this->ChallengeMenuSprite)._overlayAnimState._animation,
0xd < pAVar4->_layerCount)) && (iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x6c)), -1 < iVar3)) {
AnimationLayer::RenderFrame
(GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x18)))),&menuPos,
*GHIDRA_CAST<int *>((GHIDRA_INT((this->ChallengeMenuSprite)._overlayAnimState._layerFrames) +
iVar3 * 4)),&g_vectorZero,&g_vectorZero,pAVar4);
}
pvVar1 = (this->ChallengeMenuSprite)._animState._animData;
if (((pvVar1 != (void *)0x0) &&
(pAVar4 = (this->ChallengeMenuSprite)._animState._animation,
0xd < pAVar4->_layerCount)) && (iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x6c)), -1 < iVar3)) {
animLayer = GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x18))));
pvVar1 = (this->ChallengeMenuSprite)._animState._layerFrames;
LAB_009468db:
AnimationLayer::RenderFrame
(animLayer,&menuPos,*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + iVar3 * 4)),&g_vectorZero,
&g_vectorZero,pAVar4);
}
}
}
}
}
challengeIndex = challengeIndex + 1;
} while (GHIDRA_INT(challengeIndex) < 0x2e);
challengeIndex = this->SelectedChallengeID + -1;
if (((this->ChallengeMenuSprite)._animState._animData != (void *)0x0) &&
((2 < *GHIDRA_CAST<int *>((GHIDRA_INT((this->ChallengeMenuSprite)._animState._animation) + 0x80)) ||
(KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("LayerId out of bounds\n")),
2 < *GHIDRA_CAST<int *>((GHIDRA_INT((this->ChallengeMenuSprite)._animState._animation) + 0x80)))))) {
pvVar1 = (this->ChallengeMenuSprite)._animState._animData;
local_24.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + 0x40));
if ((pvVar1 == (void *)0x0) ||
((GHIDRA_INT(local_24.y) < 0 || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x1c)) <= GHIDRA_INT(local_24.y))))) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("id out of bounds\n"));
}
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT((this->ChallengeMenuSprite)._animState._layerFrames) + GHIDRA_INT(local_24.y) * 4))
= 0;
AnimationState::AdvanceLayerPosition
(&(this->ChallengeMenuSprite)._animState,GHIDRA_INT(local_24.y),(float)GHIDRA_INT(challengeIndex));
}
local_24.x = (g_menuManager->_ViewPosition).x + this->PositionX;
local_24.y = (g_menuManager->_ViewPosition).y + this->PositionY;
if ((this->ChallengeMenuSprite)._loaded != 0) {
if ((this->ChallengeMenuSprite)._overlayRenderFirst == 0) {
pvVar1 = (this->ChallengeMenuSprite)._animState._animData;
if (((pvVar1 != (void *)0x0) &&
(pAVar4 = (this->ChallengeMenuSprite)._animState._animation, 2 < pAVar4->_layerCount)) &&
(iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x40)), -1 < iVar3)) {
AnimationLayer::RenderFrame
(GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x18)))),&local_24,
*GHIDRA_CAST<int *>((GHIDRA_INT((this->ChallengeMenuSprite)._animState._layerFrames) + iVar3 * 4)),
&g_vectorZero,&g_vectorZero,pAVar4);
}
pvVar1 = (this->ChallengeMenuSprite)._overlayAnimState._animData;
if (((pvVar1 == (void *)0x0) ||
(pAVar4 = (this->ChallengeMenuSprite)._overlayAnimState._animation,
pAVar4->_layerCount < 3)) || (iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x40)), iVar3 < 0))
goto LAB_00946a99;
animLayer = GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x18))));
pvVar1 = (this->ChallengeMenuSprite)._overlayAnimState._layerFrames;
}
else {
pvVar1 = (this->ChallengeMenuSprite)._overlayAnimState._animData;
if (((pvVar1 != (void *)0x0) &&
(pAVar4 = (this->ChallengeMenuSprite)._overlayAnimState._animation,
2 < pAVar4->_layerCount)) && (iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x40)), -1 < iVar3)) {
AnimationLayer::RenderFrame
(GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x18)))),&local_24,
*GHIDRA_CAST<int *>((GHIDRA_INT((this->ChallengeMenuSprite)._overlayAnimState._layerFrames) +
iVar3 * 4)),&g_vectorZero,&g_vectorZero,pAVar4);
}
pvVar1 = (this->ChallengeMenuSprite)._animState._animData;
if (((pvVar1 == (void *)0x0) ||
(pAVar4 = (this->ChallengeMenuSprite)._animState._animation, pAVar4->_layerCount < 3)) ||
(iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x40)), iVar3 < 0)) goto LAB_00946a99;
animLayer = GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x18))));
pvVar1 = (this->ChallengeMenuSprite)._animState._layerFrames;
}
AnimationLayer::RenderFrame
(animLayer,&local_24,*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + iVar3 * 4)),&g_vectorZero,&g_vectorZero,
pAVar4);
}
LAB_00946a99:
iVar3 = prevMenuState;
if (((g_menuControllerIndex != 0) && (prevMenuState != 0x15)) &&
(((this->ChallengeMenuSprite)._animState._animData != (void *)0x0 &&
(customButtonFrame =
AnimationState::GetNullFrame
(&(this->ChallengeMenuSprite)._animState,GHIDRA_CAST<byte *>("CustomButton")),
customButtonFrame != GHIDRA_CAST<float *>(0x0))))) {
menuPos.y = customButtonFrame[1] + menuPos.y;
menuPos.x = *customButtonFrame + menuPos.x;
pos.y = menuPos.y;
pos.x = menuPos.x;
scale.y = g_vectorOne.y;
scale.x = g_vectorOne.x;
Manager::render_controller_action_glyph
(g_manager,g_menuControllerIndex,0x1c,0,1,
(ColorMod)ZEXT1644(CONCAT412(0x3f800000,CONCAT48(0x3f800000,0x3f8000003f800000))),pos
,scale);
}
isLayerVisible = iVar3 != 0x15;
layer = (GHIDRA_CAST<ANM2 *>((challengeSprite)))->ANM2::GetLayer(GHIDRA_CAST<byte *>("CustomPaper"));
layer->_visible = isLayerVisible;
layer = (GHIDRA_CAST<ANM2 *>((challengeSprite)))->ANM2::GetLayer(GHIDRA_CAST<byte *>("CustomText"));
layer->_visible = isLayerVisible;
return;
}
// 00946b80
void Menu_Challenge::reset()
{
byte bVar1;
byte *currentAnimName;
uint uVar2;
byte *idleName;
bool isLess;
int previousMenuState;
byte *animData;
Game *game;
int lastChallenge;
Manager *manager;
MenuManager *menuManager;
uVar2 = GHIDRA_INT((g_menuManager->_menuStateHistory)._end) -
GHIDRA_INT((g_menuManager->_menuStateHistory)._begin) >> 2;
if (uVar2 < 2) {
previousMenuState = 0;
}
else {
previousMenuState = *GHIDRA_CAST<int *>((GHIDRA_INT((g_menuManager->_menuStateHistory)._begin) + uVar2 * 4 + -8));
}
animData = (this->ChallengeMenuSprite)._animState._animData;
if (animData != GHIDRA_CAST<byte *>(0x0)) {
currentAnimName = animData;
if (0xf < *GHIDRA_CAST<uint *>((animData + 0x14))) {
currentAnimName = *GHIDRA_CAST<byte **>(animData);
}
idleName = s_Idle;
do {
bVar1 = *currentAnimName;
isLess = bVar1 < *idleName;
if (bVar1 != *idleName) {
LAB_00946be4:
uVar2 = -GHIDRA_UINT(isLess) | 1;
goto LAB_00946be9;
}
if (bVar1 == 0) break;
bVar1 = currentAnimName[1];
isLess = bVar1 < idleName[1];
if (bVar1 != idleName[1]) goto LAB_00946be4;
currentAnimName = currentAnimName + 2;
idleName = idleName + 2;
} while (bVar1 != 0);
uVar2 = 0;
LAB_00946be9:
if ((uVar2 == 0) &&
((animData[0x34] == 0 || ((this->ChallengeMenuSprite)._animState._isPlaying != 0))))
goto LAB_00946c23;
}
bVar1 = (GHIDRA_CAST<ANM2 *>((&this->ChallengeMenuSprite)))->ANM2::SetAnimation(s_Idle,1);
if (bVar1 != 0) {
(GHIDRA_CAST<AnimationState *>((&(this->ChallengeMenuSprite)._animState)))->AnimationState::Rewind();
(this->ChallengeMenuSprite)._animState._isPlaying = 1;
}
LAB_00946c23:
menuManager = g_menuManager;
manager = g_manager;
this->SelectedChallengeID = 0;
if ((previousMenuState == 0x15) &&
(lastChallenge = (manager->_lobbySettings)._challenge, 0 < lastChallenge)) {
this->SelectedChallengeID = lastChallenge + -1;
}
game = g_game;
this->HoldInputTimer = 1;
menuManager->_viewPositionSet[7].y = -216.0;
menuManager->_state = 1;
do {
this->SelectedChallengeID = this->SelectedChallengeID + 1;
uVar2 = this->SelectedChallengeID;
if (GHIDRA_INT(uVar2) < 0x2e) {
if (0x2d < uVar2) {
return;
}
}
else {
this->SelectedChallengeID = 1;
uVar2 = 1;
}
uVar2 = *GHIDRA_CAST<uint *>((&DAT_00b7b0b0 + uVar2 * 4));
} while ((uVar2 == 0xfffffffe) ||
((-1 < GHIDRA_INT(uVar2) &&
((0x281 < uVar2 ||
(((uVar2 != 0 && ((manager->_persistentGameData)._achievements[uVar2] == 0)) &&
(((manager->_state != 2 || (game == GHIDRA_CAST<Game *>(0x0))) ||
(((game->_dailyChallenge)._id == 0 && (game->_isDebug == 0))))))))))));
return;
}