Files
isaac-port/generated-src/menu_challenge.cpp
T
shweetandClaude Opus 5.5 fd8b965350 Curation round 4: popups, Seeds/Random, Game, KeyConfigs, offline NetplayManager, Console, TextureCache, render passes
Six agents took over PopupButtons/PopupQueue/AchievementOverlay, Seeds with the global Random (now seeded from the
clock as in the original), Game (g_game exists from Manager::Init on), KeyConfigs, an offline NetplayManager, Console's
output and printing, TextureCache, the color-mod and sprite shader passes, mod shaders and reload_resource_paths. An
integration pass moved callers to the new APIs (0 errors, 0 warnings with -Wall -Wextra). build/isaac loads the 34
installed mods and stops at ScoreSheet::ScoreSheet in Game's constructor; with the remaining stubs skipped under gdb the
intro cutscene plays through and the main menu's frame loop runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 01:32:19 -05:00

1074 lines
48 KiB
C++

#include "classes.h"
// 008cd7b0
void Menu_Challenge::render_seed_text()
{
uint32_t uVar1;
uint32_t uVar2;
uint32_t uVar3;
void *pvVar4;
float *nullFrame;
uint32_t ******ppppppuVar5;
std_string *psVar6;
std_string *psVar7;
void *ptr;
int in_ECX;
uint32_t ******ppppppuVar8;
uint32_t size;
uint32_t uVar9;
uint32_t ******ppppppuVar10;
uint32_t ******ppppppuVar11;
uint32_t drawParams;
uint32_t local_98;
uint32_t local_94;
uint32_t local_90;
uint32_t local_8c;
uint32_t local_88;
uint32_t local_84;
Vector textPos;
float textY;
int menu;
std_string *linesBegin;
std_string *linesEnd;
std_string *linesCapacity;
uint32_t ******local_64;
uint32_t ******local_60;
uint32_t ******local_5c;
uint32_t ******local_58;
void *seedPart;
KColor local_50;
uint32_t ******seedText [4];
uint32_t ******seedTextSize;
uint32_t ******seedTextCapacity;
uint32_t local_24;
uint8_t *puStack_20;
void *local_1c;
uint8_t *puStack_18;
uint32_t *****local_14;
puStack_20 = GHIDRA_CAST<uint8_t *>((seedText + 0xe));
local_14 = GHIDRA_CAST<uint32_t *****>(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 = AnimationState::GetNullFrame(GHIDRA_CAST<AnimationState *>((in_ECX + 0x30)),&DAT_00b75670);
if (((pvVar4 == (void *)0x0) || (*GHIDRA_CAST<int *>((in_ECX + 0x4a8)) == 0)) ||
(pvVar4 = AnimationState::GetNullFrame(GHIDRA_CAST<AnimationState *>((in_ECX + 0x4a4)),GHIDRA_CAST<uint8_t *>("SeedPos")),
pvVar4 == (void *)0x0)) goto LAB_008cddc4;
local_58 = GHIDRA_CAST<uint32_t ******>(((g_menuManager->_ViewPosition).x + *GHIDRA_CAST<float *>((in_ECX + 0x7dc))));
local_5c = GHIDRA_CAST<uint32_t ******>(((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 = AnimationState::GetNullFrame(GHIDRA_CAST<AnimationState *>((in_ECX + 0x30)),&DAT_00b75670);
}
local_58 = GHIDRA_CAST<uint32_t ******>(((float)local_58 + *nullFrame));
local_5c = GHIDRA_CAST<uint32_t ******>(((float)local_5c + nullFrame[1]));
if (*GHIDRA_CAST<int *>((in_ECX + 0x4a8)) == 0) {
nullFrame = GHIDRA_CAST<float *>(0x0);
}
else {
nullFrame = AnimationState::GetNullFrame(GHIDRA_CAST<AnimationState *>((in_ECX + 0x4a4)),GHIDRA_CAST<uint8_t *>("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<msvc::string *>((GHIDRA_CAST<char *>(seedText))))->msvc::string::string(&(g_manager->_lobbySettings)._seed);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0;
(*GHIDRA_CAST<uint8_t *>((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<uint32_t ******>(&DAT_00000004)) {
if (ppppppuVar10 < &DAT_00000005) {
if (GHIDRA_CAST<uint32_t ******>((0x7fffffff - (GHIDRA_UINT(ppppppuVar10) >> 1))) < ppppppuVar10) {
ppppppuVar8 = GHIDRA_CAST<uint32_t ******>(0x7fffffff);
}
else {
ppppppuVar11 = GHIDRA_CAST<uint32_t ******>((GHIDRA_INT(ppppppuVar10) + (GHIDRA_UINT(ppppppuVar10) >> 1)));
ppppppuVar8 = GHIDRA_CAST<uint32_t ******>(&DAT_0000000f);
if (&DAT_0000000f < ppppppuVar11) {
ppppppuVar8 = ppppppuVar11;
}
}
local_60 = ppppppuVar10;
local_64 = msvc::_Allocate(GHIDRA_UINT((GHIDRA_INT(ppppppuVar8) + 1)));
ppppppuVar11 = GHIDRA_CAST<uint32_t ******>(&DAT_00000005);
local_58 = GHIDRA_CAST<uint32_t ******>(&DAT_00000005);
seedTextSize = GHIDRA_CAST<uint32_t ******>(&DAT_00000005);
ppppppuVar10 = ppppppuVar8;
seedTextCapacity = ppppppuVar8;
if (local_60 < GHIDRA_CAST<uint32_t ******>(0x10)) {
*local_64 = ppppppuVar5;
*GHIDRA_CAST<uint16_t *>((local_64 + 1)) = 0x20;
seedText[0] = local_64;
}
else {
ppppppuVar8 = GHIDRA_CAST<uint32_t ******>((GHIDRA_INT(local_60) + 1));
*local_64 = *ppppppuVar5;
*GHIDRA_CAST<uint16_t *>((local_64 + 1)) = 0x20;
ppppppuVar11 = ppppppuVar5;
if (GHIDRA_CAST<uint32_t ******>(0xfff) < ppppppuVar8) {
ppppppuVar11 = GHIDRA_CAST<uint32_t ******>(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<uint32_t ******>(&DAT_00000005);
ppppppuVar11 = seedText;
if (&DAT_0000000f < ppppppuVar10) {
ppppppuVar11 = seedText[0];
}
*GHIDRA_CAST<uint16_t *>((ppppppuVar11 + 1)) = 0x20;
ppppppuVar11 = seedTextSize;
ppppppuVar8 = seedTextCapacity;
}
else if (ppppppuVar11 < ppppppuVar10) {
seedTextSize = GHIDRA_CAST<uint32_t ******>((GHIDRA_INT(ppppppuVar11) + 1));
ppppppuVar5 = seedText;
if (&DAT_0000000f < ppppppuVar10) {
ppppppuVar5 = seedText[0];
}
*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(ppppppuVar5) + GHIDRA_INT(ppppppuVar11))) = 0x2d;
ppppppuVar11 = seedTextSize;
ppppppuVar8 = seedTextCapacity;
}
else {
local_5c = ppppppuVar11;
if (ppppppuVar11 == GHIDRA_CAST<uint32_t ******>(0x7fffffff)) {
/* WARNING: Subroutine does not return */
msvc::string::_Xlen();
}
local_58 = GHIDRA_CAST<uint32_t ******>((GHIDRA_INT(ppppppuVar11) + 1));
ppppppuVar8 = GHIDRA_CAST<uint32_t ******>((GHIDRA_UINT(local_58) | 0xf));
if (ppppppuVar8 < GHIDRA_CAST<uint32_t ******>(0x80000000)) {
if (GHIDRA_CAST<uint32_t ******>((0x7fffffff - (GHIDRA_UINT(ppppppuVar10) >> 1))) < ppppppuVar10) {
ppppppuVar8 = GHIDRA_CAST<uint32_t ******>(0x7fffffff);
}
else {
ppppppuVar11 = GHIDRA_CAST<uint32_t ******>((GHIDRA_INT(ppppppuVar10) + (GHIDRA_UINT(ppppppuVar10) >> 1)));
if (ppppppuVar8 < ppppppuVar11) {
ppppppuVar8 = ppppppuVar11;
}
}
}
else {
ppppppuVar8 = GHIDRA_CAST<uint32_t ******>(0x7fffffff);
}
local_64 = ppppppuVar10;
local_60 = msvc::_Allocate(GHIDRA_UINT((GHIDRA_INT(ppppppuVar8) + 1)));
ppppppuVar11 = local_5c;
seedTextSize = local_58;
seedTextCapacity = ppppppuVar8;
if (local_64 < GHIDRA_CAST<uint32_t ******>(0x10)) {
memcpy(local_60,seedText,(size_t)local_5c);
*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(ppppppuVar11) + GHIDRA_INT(local_60))) = 0x2d;
}
else {
memcpy(local_60,ppppppuVar5,(size_t)local_5c);
*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(local_5c) + GHIDRA_INT(local_60))) = 0x2d;
ppppppuVar10 = GHIDRA_CAST<uint32_t ******>((GHIDRA_INT(local_64) + 1));
ppppppuVar11 = ppppppuVar5;
if (GHIDRA_CAST<uint32_t ******>(0xfff) < ppppppuVar10) {
ppppppuVar11 = GHIDRA_CAST<uint32_t ******>(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<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 1;
psVar6 = GHIDRA_CAST<std_string *>(FUN_00651a90(&seedPart,0,4));
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
vector_string_emplace_reallocate_move(&linesBegin,GHIDRA_CAST<std_string *>(0x0),psVar6);
(*GHIDRA_CAST<uint8_t *>((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<uint8_t *>((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<uint32_t *>((psVar6->_buf + 4));
uVar2 = *GHIDRA_CAST<uint32_t *>((psVar6->_buf + 8));
uVar3 = *GHIDRA_CAST<uint32_t *>((psVar6->_buf + 0xc));
*GHIDRA_CAST<uint32_t *>(linesEnd->_buf) = *GHIDRA_CAST<uint32_t *>(psVar6->_buf);
*GHIDRA_CAST<uint32_t *>((linesEnd->_buf + 4)) = uVar1;
*GHIDRA_CAST<uint32_t *>((linesEnd->_buf + 8)) = uVar2;
*GHIDRA_CAST<uint32_t *>((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<uint8_t *>((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<uint32_t ******>(((GHIDRA_INT(psVar6) - GHIDRA_INT(linesBegin)) / 0x18));
local_64 = ppppppuVar11;
if (ppppppuVar11 != GHIDRA_CAST<uint32_t ******>(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<uint8_t *>((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<uint8_t *>(psVar7),&textPos,&local_50,&drawParams);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 1;
psVar6 = psVar6 + 1;
textPos.y = (float)(uint16_t)(g_manager->_font3_TeamMeatEx16)._base + textY;
ppppppuVar11 = GHIDRA_CAST<uint32_t ******>((GHIDRA_INT(ppppppuVar11) + -1));
textY = textPos.y;
} while (ppppppuVar11 != GHIDRA_CAST<uint32_t ******>(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<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(linesBegin) + (-4 - GHIDRA_INT(psVar6))))) goto LAB_008cddb4;
}
operator_delete(psVar6,uVar9);
}
if (&DAT_0000000f < seedTextCapacity) {
ppppppuVar10 = GHIDRA_CAST<uint32_t ******>((GHIDRA_INT(seedTextCapacity) + 1));
ppppppuVar11 = seedText[0];
if (GHIDRA_CAST<uint32_t ******>(0xfff) < ppppppuVar10) {
ppppppuVar11 = GHIDRA_CAST<uint32_t ******>(seedText[0][-1]);
ppppppuVar10 = seedTextCapacity + 9;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((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;
uint8_t *puStack_c;
uint32_t 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;
ANM2::Reset(GHIDRA_CAST<ANM2 *>((in_ECX + 0x14)));
AnimationState::~AnimationState(GHIDRA_CAST<AnimationState *>((in_ECX + 100)));
AnimationState::~AnimationState(GHIDRA_CAST<AnimationState *>((in_ECX + 0x44)));
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((in_ECX + 0x2c)))))->msvc::string::_Tidy_deallocate();
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((in_ECX + 0x14)))))->msvc::string::_Tidy_deallocate();
ExceptionList = local_10;
return;
}
// 00945e50
void Menu_Challenge::Update()
{
Seeds unk;
KColor fadeColor;
std_string seed;
char isActionPressed;
uint8_t isUnlocked;
uint32_t challengeIdx;
Seeds *seeds;
uint32_t *in_ECX;
Manager *this;
uint32_t uVar1;
PersistentGameData *extraout_ECX;
PersistentGameData *persistentData;
PersistentGameData *extraout_ECX_00;
int unused;
uint32_t uVar2;
int extraout_EDX;
int extraout_EDX_00;
float scrollY;
Seeds aSStackY_2f08 [128];
uint8_t in_stack_ffffff54 [48];
uint32_t in_stack_ffffff84;
uint32_t in_stack_ffffff88;
uint32_t in_stack_ffffff8c;
uint32_t in_stack_ffffff90;
uint32_t in_stack_ffffff94;
uint32_t uVar3;
uint32_t in_stack_ffffff98;
uint32_t uVar4;
uint32_t in_stack_ffffff9c;
int iVar5;
uint32_t in_stack_ffffffa0;
uint32_t in_stack_ffffffa4;
uint32_t in_stack_ffffffa8;
void *in_stack_ffffffac;
uint32_t in_stack_ffffffb0;
int difficulty;
char acStack_4a [2];
void *seedText [4];
uint32_t seedTextSize;
uint32_t seedTextCapacity;
uint32_t stackCookie;
void *local_10;
uint8_t *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')) {
AnimationState::Update(GHIDRA_CAST<AnimationState *>((in_ECX + 0x11)));
in_stack_ffffffb0 = 0x945ea5;
AnimationState::Update(GHIDRA_CAST<AnimationState *>((in_ECX + 0x19)));
}
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)) {
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&((g_manager->_lobbySettings))) + 0x4)))) = 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 = PersistentGameData::Unlocked(persistentData,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 = PersistentGameData::Unlocked(persistentData,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];
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&((manager->_lobbySettings))) + 0x4)))) = 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<msvc::string *>((acStack_4a + -0x1a)))->msvc::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;
Seeds::SetStartSeed(&menuManager->_seedsObject,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;
*GHIDRA_CAST<uint8_t *>(seeds) = 1;
difficulty = *GHIDRA_CAST<int *>((challengeIdx * 0xa4 + 0x70 + GHIDRA_INT(challengeParams)));
Seeds::construct_from_copy(aSStackY_2f08 + 0x81,seeds);
unk._stageSeeds[6] = in_stack_ffffff84;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(unk)) + 0x0))) = in_stack_ffffff54;
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);
Manager::StartNewGame(this,iVar5,uVar1,unk,difficulty);
}
ExceptionList = local_10;
return;
}
// 009462c0
void Menu_Challenge::Render()
{
Vector pos;
Vector scale;
LayerState *layer;
void *pvVar1;
float *customButtonFrame;
uint32_t uVar2;
AnimationState *secondAnimState;
AnimationLayer *animLayer;
int iVar3;
ANM2 *pAVar4;
Vector menuPos;
ANM2 *challengeSprite;
Vector local_24;
int prevMenuState;
uint32_t challengeIndex;
uint8_t isChallengeDone;
uint8_t 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 = ANM2::GetLayer(challengeSprite,GHIDRA_CAST<uint8_t *>("CustomTab"));
pAVar4 = &this->ChallengeMenuSprite;
layer->_visible = isLayerVisible;
layer = ANM2::GetLayer(pAVar4,GHIDRA_CAST<uint8_t *>(0x2));
layer->_visible = 0;
layer = ANM2::GetLayer(pAVar4,&DAT_0000000e);
layer->_visible = 0;
layer = ANM2::GetLayer(pAVar4,&DAT_0000000f);
layer->_visible = 0;
layer = ANM2::GetLayer(pAVar4,&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 = ANM2::GetLayer(&this->ChallengeMenuSprite,GHIDRA_CAST<uint8_t *>(0x2));
layer->_visible = 1;
challengeIndex = 1;
do {
if (challengeIndex < 0x2e) {
uVar2 = *GHIDRA_CAST<uint32_t *>((&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)) ||
(((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((g_manager)) + 0x8)))) == 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<uint8_t *>("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<uint8_t *>("id out of bounds\n"));
}
*(uint32_t *)
(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<uint8_t *>("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<uint8_t *>("id out of bounds\n"));
}
*(uint32_t *)
(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<uint8_t *>("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<uint8_t *>("id out of bounds\n"));
}
*(uint32_t *)
(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 = ANM2::GetLayer(&this->ChallengeMenuSprite,&DAT_0000000e);
layer->_visible = isLayerVisible;
isChallengeDone =
*GHIDRA_CAST<uint8_t *>((GHIDRA_INT((g_manager->_persistentGameData)._cutsceneCounters) + (challengeIndex - 0x31)
));
layer = ANM2::GetLayer(&this->ChallengeMenuSprite,&DAT_0000000f);
isLayerVisible = isLayerVisible ^ 1;
layer->_visible = isChallengeDone;
layer = ANM2::GetLayer(&this->ChallengeMenuSprite,&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<uint8_t *>("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<uint8_t *>("id out of bounds\n"));
}
*GHIDRA_CAST<uint32_t *>((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<uint8_t *>("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 = ANM2::GetLayer(challengeSprite,GHIDRA_CAST<uint8_t *>("CustomPaper"));
layer->_visible = isLayerVisible;
layer = ANM2::GetLayer(challengeSprite,GHIDRA_CAST<uint8_t *>("CustomText"));
layer->_visible = isLayerVisible;
return;
}
// 00946b80
void Menu_Challenge::reset()
{
uint8_t bVar1;
uint8_t *currentAnimName;
uint32_t uVar2;
uint8_t *idleName;
bool isLess;
int previousMenuState;
uint8_t *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<uint8_t *>(0x0)) {
currentAnimName = animData;
if (0xf < *GHIDRA_CAST<uint32_t *>((animData + 0x14))) {
currentAnimName = *GHIDRA_CAST<uint8_t **>(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 = ANM2::SetAnimation(&this->ChallengeMenuSprite,s_Idle,1);
if (bVar1 != 0) {
AnimationState::Rewind(&(this->ChallengeMenuSprite)._animState);
(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<uint32_t *>((&DAT_00b7b0b0 + uVar2 * 4));
} while ((uVar2 == 0xfffffffe) ||
((-1 < GHIDRA_INT(uVar2) &&
((0x281 < uVar2 ||
(((uVar2 != 0 && ((manager->_persistentGameData)._achievements[uVar2] == 0)) &&
(((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((manager)) + 0x8)))) != 2 || (game == GHIDRA_CAST<Game *>(0x0))) ||
(((game->_dailyChallenge)._id == 0 && (game->_isDebug == 0))))))))))));
return;
}