#include "classes.h" // 00857220 void ScoreSheet::LoadAnm2() { char *pcVar1; uint32_t uVar2; std_string leaderboardAnmPath; std_string scoreAnmPath; uint32_t local_24; uint8_t *puStack_20; void *local_1c; uint8_t *puStack_18; uint32_t local_14; puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); local_14 = 0xffffffff; puStack_18 = &LAB_00b035d5; local_1c = ExceptionList; local_24 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U; ExceptionList = &local_1c; scoreAnmPath._size = 0; scoreAnmPath._capacity = 0xf; scoreAnmPath._buf[0] = '\0'; scoreAnmPath._buf[1] = '\0'; scoreAnmPath._buf[2] = '\0'; scoreAnmPath._buf[3] = '\0'; (*GHIDRA_CAST((GHIDRA_CAST(&(scoreAnmPath._buf)) + 0x0))) = msvc::_Allocate(0x20); scoreAnmPath._size = 0x15; scoreAnmPath._capacity = 0x1f; builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(scoreAnmPath._buf))) + 0x0))),"gfx/ui/ScoreMenu.anm2",0x16); local_14 = 0; ANM2::Load(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[5])) + 0x1)))),&scoreAnmPath,1); local_14 = 0xffffffff; if (0xf < scoreAnmPath._capacity) { uVar2 = scoreAnmPath._capacity + 1; pcVar1 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(scoreAnmPath._buf))) + 0x0))); if (0xfff < uVar2) { pcVar1 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(scoreAnmPath._buf)) + 0x0))) + -4)); uVar2 = scoreAnmPath._capacity + 0x24; if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(scoreAnmPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar1))))) { /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(pcVar1,uVar2); } leaderboardAnmPath._size = 0; leaderboardAnmPath._capacity = 0xf; leaderboardAnmPath._buf[0] = '\0'; leaderboardAnmPath._buf[1] = '\0'; leaderboardAnmPath._buf[2] = '\0'; leaderboardAnmPath._buf[3] = '\0'; (*GHIDRA_CAST((GHIDRA_CAST(&(leaderboardAnmPath._buf)) + 0x0))) = msvc::_Allocate(0x20); leaderboardAnmPath._size = 0x1b; leaderboardAnmPath._capacity = 0x1f; builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(leaderboardAnmPath._buf))) + 0x0))),"gfx/ui/LeaderboardMenu.anm2",0x1c); local_14 = 1; ANM2::Load(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x61])) + 0x1)))),&leaderboardAnmPath,1); if (0xf < leaderboardAnmPath._capacity) { uVar2 = leaderboardAnmPath._capacity + 1; pcVar1 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(leaderboardAnmPath._buf))) + 0x0))); if (0xfff < uVar2) { pcVar1 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(leaderboardAnmPath._buf)) + 0x0))) + -4)); uVar2 = leaderboardAnmPath._capacity + 0x24; if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(leaderboardAnmPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar1))))) { /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(pcVar1,uVar2); } (*GHIDRA_CAST((GHIDRA_CAST(&(this[0x13a])) + 0x2))) = 0; *GHIDRA_CAST(this) = 1; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x1)))) = 0; *GHIDRA_CAST((this + 0x138)) = 0; ExceptionList = local_1c; return; } // 009e5300 ScoreSheet::ScoreSheet() { *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x15])) + 0x1)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x16])) + 0x2)))) = 0; *GHIDRA_CAST((this + 0x18)) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1e])) + 0x2)))) = 0; *GHIDRA_CAST((this + 0x20)) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x21])) + 0x1)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x22])) + 0x2)))) = 0; *GHIDRA_CAST((this + 0x24)) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x25])) + 0x1)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x29])) + 0x1)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x2a])) + 0x2)))) = 0; *GHIDRA_CAST((this + 0x2c)) = 0; Reset(); return this; } // 009e53a0 void ScoreSheet::Reset() { int iVar1; uint32_t buildId; uint32_t minorVersion; uint32_t *in_ECX; char *buildNumberText; in_ECX[0x18] = in_ECX[0x17]; in_ECX[0x1b] = in_ECX[0x1a]; in_ECX[0x20] = in_ECX[0x1f]; in_ECX[0x11] = in_ECX[0x10]; buildId = DAT_00c5c4dc; *in_ECX = 0; in_ECX[1] = 0; in_ECX[2] = 0; in_ECX[3] = 0; in_ECX[4] = 0; in_ECX[5] = 0; in_ECX[6] = 0; in_ECX[7] = 0; in_ECX[8] = 0; in_ECX[9] = 0; in_ECX[10] = 0; in_ECX[0xb] = 0; in_ECX[0xc] = 0; in_ECX[0xd] = 0; in_ECX[0xe] = 0; in_ECX[0xf] = 0; in_ECX[0x13] = 0; in_ECX[0x14] = 0; in_ECX[0x15] = 0; in_ECX[0x16] = 0; in_ECX[0x1d] = 0; in_ECX[0x1e] = 0; *GHIDRA_CAST((in_ECX + 0x22)) = 0; if (buildId == 0xffffffff) { iVar1 = isdigit(0x4a); if (iVar1 == 0) { buildNumberText = "460"; } else { buildNumberText = "J460"; } buildId = atoi(buildNumberText); iVar1 = atoi("1"); minorVersion = atoi("9"); buildId = (minorVersion | iVar1 << 8) << 0x10 | buildId; DAT_00c5c4dc = buildId; } in_ECX[0x23] = buildId; return; } // 009e54d0 void ScoreSheet::store_state(void *dst) { int iVar1; void *pvVar2; uint64_t *srcEntry; int spanBytes; int srcOffset; uint64_t *dstEnd; pvVar2 = dst; dst = (void *)0x0; *GHIDRA_CAST(pvVar2) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x12])) + 0x2)))); *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 4)) = *GHIDRA_CAST((this + 0x14)); *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 8)) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x19])) + 0x1)))); *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0xc)) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1a])) + 0x2)))); *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x10)) = *GHIDRA_CAST((this + 0x1c)); *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x14)) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1d])) + 0x1)))); *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1c)) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x18)); spanBytes = *GHIDRA_CAST((this + 0x20)) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1e])) + 0x2)))); iVar1 = spanBytes >> 0x1f; if (spanBytes / 0xc + iVar1 != iVar1) { srcOffset = 0; do { dstEnd = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1c)); srcEntry = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1e])) + 0x2)))) + srcOffset)); if (dstEnd == *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x20))) { msvc::vector<12byte>::_Emplace_reallocate(dstEnd,srcEntry); } else { *dstEnd = *srcEntry; *GHIDRA_CAST((dstEnd + 1)) = *GHIDRA_CAST((srcEntry + 1)); *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1c)) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1c)) + 0xc; } srcOffset = srcOffset + 0xc; dst = (void *)(GHIDRA_INT(dst) + 1); } while (dst < (void *)((*GHIDRA_CAST((this + 0x20)) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1e])) + 0x2))))) / 0xc)); } *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x28)) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x24)); dst = (void *)0x0; spanBytes = *GHIDRA_CAST((this + 0x24)) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x22])) + 0x2)))); iVar1 = spanBytes >> 0x1f; if (spanBytes / 0xc + iVar1 != iVar1) { srcOffset = 0; do { dstEnd = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x28)); srcEntry = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x22])) + 0x2)))) + srcOffset)); if (dstEnd == *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x2c))) { msvc::vector<12byte>::_Emplace_reallocate(dstEnd,srcEntry); } else { *dstEnd = *srcEntry; *GHIDRA_CAST((dstEnd + 1)) = *GHIDRA_CAST((srcEntry + 1)); *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x28)) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x28)) + 0xc; } srcOffset = srcOffset + 0xc; dst = (void *)(GHIDRA_INT(dst) + 1); } while (dst < (void *)((*GHIDRA_CAST((this + 0x24)) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x22])) + 0x2))))) / 0xc)); } *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x30)) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x26])) + 0x2)))); *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x34)) = *GHIDRA_CAST((this + 0x28)); *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x48)) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x44)); dst = (void *)0x0; spanBytes = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x2a])) + 0x2)))) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x29])) + 0x1)))); iVar1 = spanBytes >> 0x1f; if (spanBytes / 0xc + iVar1 != iVar1) { srcOffset = 0; do { dstEnd = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x48)); srcEntry = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x29])) + 0x1)))) + srcOffset)); if (dstEnd == *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x4c))) { msvc::vector<12byte>::_Emplace_reallocate(dstEnd,srcEntry); } else { *dstEnd = *srcEntry; *GHIDRA_CAST((dstEnd + 1)) = *GHIDRA_CAST((srcEntry + 1)); *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x48)) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x48)) + 0xc; } srcOffset = srcOffset + 0xc; dst = (void *)(GHIDRA_INT(dst) + 1); } while (dst < (void *)((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x2a])) + 0x2)))) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x29])) + 0x1))))) / 0xc)); } *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x3c)) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x38)); dst = (void *)0x0; spanBytes = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x16])) + 0x2)))) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x15])) + 0x1)))); iVar1 = spanBytes >> 0x1f; if (spanBytes / 0xc + iVar1 != iVar1) { srcOffset = 0; do { dstEnd = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x3c)); srcEntry = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x15])) + 0x1)))) + srcOffset)); if (dstEnd == *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x40))) { msvc::vector<12byte>::_Emplace_reallocate(dstEnd,srcEntry); } else { *dstEnd = *srcEntry; *GHIDRA_CAST((dstEnd + 1)) = *GHIDRA_CAST((srcEntry + 1)); *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x3c)) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x3c)) + 0xc; } srcOffset = srcOffset + 0xc; dst = (void *)(GHIDRA_INT(dst) + 1); } while (dst < (void *)((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x16])) + 0x2)))) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x15])) + 0x1))))) / 0xc)); } return; } // 009e5710 void ScoreSheet::restore_state(void *src) { int iVar1; void *pvVar2; uint64_t *srcEntry; int iVar3; int srcOffset; uint64_t *dstEnd; pvVar2 = src; src = (void *)0x0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x12])) + 0x2)))) = *GHIDRA_CAST(pvVar2); *GHIDRA_CAST((this + 0x14)) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 4)); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x19])) + 0x1)))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 8)); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1a])) + 0x2)))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0xc)); *GHIDRA_CAST((this + 0x1c)) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x10)); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1d])) + 0x1)))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x14)); *GHIDRA_CAST((this + 0x20)) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1e])) + 0x2)))); iVar3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1c)) - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x18)); iVar1 = iVar3 >> 0x1f; if (iVar3 / 0xc + iVar1 != iVar1) { srcOffset = 0; do { dstEnd = *GHIDRA_CAST((this + 0x20)); srcEntry = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x18)) + srcOffset)); if (dstEnd == *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x21])) + 0x1))))) { msvc::vector<12byte>::_Emplace_reallocate(dstEnd,srcEntry); } else { *dstEnd = *srcEntry; *GHIDRA_CAST((dstEnd + 1)) = *GHIDRA_CAST((srcEntry + 1)); *GHIDRA_CAST((this + 0x20)) = *GHIDRA_CAST((this + 0x20)) + 0xc; } srcOffset = srcOffset + 0xc; src = (void *)(GHIDRA_INT(src) + 1); } while (src < (void *)((*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1c)) - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x18))) / 0xc)); } *GHIDRA_CAST((this + 0x24)) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x22])) + 0x2)))); src = (void *)0x0; iVar3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x28)) - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x24)); iVar1 = iVar3 >> 0x1f; if (iVar3 / 0xc + iVar1 != iVar1) { srcOffset = 0; do { dstEnd = *GHIDRA_CAST((this + 0x24)); srcEntry = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x24)) + srcOffset)); if (dstEnd == *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x25])) + 0x1))))) { msvc::vector<12byte>::_Emplace_reallocate(dstEnd,srcEntry); } else { *dstEnd = *srcEntry; *GHIDRA_CAST((dstEnd + 1)) = *GHIDRA_CAST((srcEntry + 1)); *GHIDRA_CAST((this + 0x24)) = *GHIDRA_CAST((this + 0x24)) + 0xc; } srcOffset = srcOffset + 0xc; src = (void *)(GHIDRA_INT(src) + 1); } while (src < (void *)((*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x28)) - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x24))) / 0xc)); } *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x26])) + 0x2)))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x30)); *GHIDRA_CAST((this + 0x28)) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x34)); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x2a])) + 0x2)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x29])) + 0x1)))); src = (void *)0x0; iVar3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x48)) - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x44)); iVar1 = iVar3 >> 0x1f; if (iVar3 / 0xc + iVar1 != iVar1) { srcOffset = 0; do { dstEnd = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x2a])) + 0x2)))); srcEntry = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x44)) + srcOffset)); if (dstEnd == *GHIDRA_CAST((this + 0x2c))) { msvc::vector<12byte>::_Emplace_reallocate(dstEnd,srcEntry); } else { *dstEnd = *srcEntry; *GHIDRA_CAST((dstEnd + 1)) = *GHIDRA_CAST((srcEntry + 1)); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x2a])) + 0x2)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x2a])) + 0x2)))) + 0xc; } srcOffset = srcOffset + 0xc; src = (void *)(GHIDRA_INT(src) + 1); } while (src < (void *)((*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x48)) - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x44))) / 0xc)); } *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x16])) + 0x2)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x15])) + 0x1)))); src = (void *)0x0; iVar3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x3c)) - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x38)); iVar1 = iVar3 >> 0x1f; if (iVar3 / 0xc + iVar1 != iVar1) { srcOffset = 0; do { dstEnd = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x16])) + 0x2)))); srcEntry = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x38)) + srcOffset)); if (dstEnd == *GHIDRA_CAST((this + 0x18))) { msvc::vector<12byte>::_Emplace_reallocate(dstEnd,srcEntry); } else { *dstEnd = *srcEntry; *GHIDRA_CAST((dstEnd + 1)) = *GHIDRA_CAST((srcEntry + 1)); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x16])) + 0x2)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x16])) + 0x2)))) + 0xc; } srcOffset = srcOffset + 0xc; src = (void *)(GHIDRA_INT(src) + 1); } while (src < (void *)((*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x3c)) - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x38))) / 0xc)); } return; } // 009e5960 void ScoreSheet::add_cleared_room(int roomType, int roomShape, int clearCount, uint8_t isFlag) { int entryCount; int entriesLeft; Game *game; float in_XMM0_Da; int entry; uint32_t uStack_10; float local_c; uint32_t local_8; uint64_t *entriesEnd; game = g_game; local_8 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; if ((clearCount == 1) && (find_stage_entry(this,g_game->_stage,g_game->_stageType, (g_game->_gameStateFlags & 0x1000000000000) != 0), 0.0 < in_XMM0_Da)) { entry = roomType; uStack_10 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_10)) + 0x1))),isFlag); local_c = in_XMM0_Da; entryCount = FUN_009e6740(roomShape); if (0 < entryCount) { entriesLeft = entryCount; do { entriesEnd = *GHIDRA_CAST((this + 0x20)); if (entriesEnd == *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x21])) + 0x1))))) { msvc::vector<12byte>::_Emplace_reallocate(entriesEnd,&entry); } else { *entriesEnd = CONCAT44(uStack_10,entry); *GHIDRA_CAST((entriesEnd + 1)) = local_c; *GHIDRA_CAST((this + 0x20)) = *GHIDRA_CAST((this + 0x20)) + 0xc; } entriesLeft = entriesLeft + -1; } while (entriesLeft != 0); game = g_game; } if ((roomType == 0xb) && (game->_bossChallenge != 0)) { *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x26])) + 0x2)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x26])) + 0x2)))) + entryCount; } } return; } // 009e5ab0 void ScoreSheet::add_pickup_points(int variant, int subType, Vector *position) { int iVar1; uint8_t isGFuel; uint32_t seed; Entity *pointsText; int points; Vector local_1c; Vector local_14; void *seedNode; Game *game; game = g_game; if (g_game->_isRoomRespawned == 0) { points = 0; if ((variant == 100) && (subType == -1)) { isGFuel = Seeds::HasSeedEffect(&g_game->_seedEffects,0x4f); if (isGFuel != 0) { points = (game->_stage + 4) * 200; } } local_1c.x = 1.10703e-43; msvc::set::find_node(&local_14,&local_1c); if ((((*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0xd)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0x10)) < 0x50)) && (seedNode != (game->_seedEffects)._seedEffects)) && (((position->x != g_vectorZero.x || (position->y != g_vectorZero.y)) && (0 < points)))) { seed = Random(); local_14.x = position->x - 0.0; local_14.y = position->y - 8.0; local_1c.x = 0.0; local_1c.y = -2.0; pointsText = Game::SpawnEx(g_game,0x2329,2,&local_14,&local_1c,GHIDRA_CAST(0x0),0,seed,0); iVar1 = *GHIDRA_CAST(pointsText); (pointsText->_targetPosition).y = 0.0; (pointsText->_targetPosition).x = (float)points; (**(code **)(iVar1 + 0xc))(); } *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1a])) + 0x2)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1a])) + 0x2)))) + points; } return; } // 009e5d90 void ScoreSheet::Calculate() { Entity_Player *pEVar1; int iVar2; int iVar3; int iVar4; uint32_t uVar5; int iVar6; int iVar7; uint32_t uVar8; ChallengeParam *challengeParams; int stageNum; int iVar9; float fVar10; uint32_t uVar11; char *entryFlag; int *piVar12; int *piVar13; int *piVar14; uint8_t auVar15 [12]; float decayWeight; int iVar16; float remainingValue; int iVar17; int iVar18; int iVar19; int iVar20; float fVar21; double dVar22; int soulHeartsSum; int redHeartsSum; int eternalHeartsSum; int boneHeartsSum; int local_80; int parStageCount; uint32_t local_78; int local_74; Entity_Player *local_70; int *players; int *playersEnd; int *playersCapacityEnd; int *playersBegin; uint8_t local_59; uint32_t local_58; float local_54; int *local_4c; int *local_48; int stageParTimes [9]; uint8_t *puStack_20; void *local_1c; uint8_t *puStack_18; int local_14; float chunkScore; Game *game; uint64_t gameStateFlags; char isEntryFlagged; puStack_20 = GHIDRA_CAST((stageParTimes + 0x10)); puStack_18 = &LAB_00b0f92d; local_1c = ExceptionList; uVar5 = __security_cookie ^ GHIDRA_UINT((stageParTimes + 0xd)); ExceptionList = &local_1c; stageParTimes[0] = 0x3c; stageParTimes[1] = 0x78; stageParTimes[2] = 0xb4; stageParTimes[3] = 0xb4; stageParTimes[4] = 300; stageParTimes[5] = 300; stageParTimes[6] = 0x168; stageParTimes[7] = 0x168; players = GHIDRA_CAST(0x0); playersEnd = GHIDRA_CAST(0x0); playersCapacityEnd = GHIDRA_CAST(0x0); local_14 = 0; stageParTimes[8] = uVar5; if (g_manager->_netplayManager == *GHIDRA_CAST((g_manager + 1))) { local_70 = Game::GetPlayer(g_game,0); } else { puStack_20 = GHIDRA_CAST((stageParTimes + 0x10)); iVar6 = FUN_0090b070(uVar5); if (iVar6 == 0) { local_70 = GHIDRA_CAST(0x0); } else { FUN_0090b070(uVar5); local_70 = GHIDRA_CAST(FUN_004253d0()); } } msvc::vector::_Emplace_reallocate(0,&local_70); playersBegin = players; if (*players == 0) goto LAB_009e66e0; local_48 = *GHIDRA_CAST((*players + 0x1d98)); if (local_48 != GHIDRA_CAST(0x0)) { if (playersEnd == playersCapacityEnd) { msvc::vector::_Emplace_reallocate(playersEnd,&local_48); playersBegin = players; } else { *playersEnd = GHIDRA_INT(local_48); playersEnd = playersEnd + 1; } } local_48 = *GHIDRA_CAST((*playersBegin + 0x1e68)); local_4c = playersEnd; if (local_48 != GHIDRA_CAST(0x0)) { if (playersEnd == playersCapacityEnd) { players = playersBegin; msvc::vector::_Emplace_reallocate(playersEnd,&local_48); playersBegin = players; } else { *playersEnd = GHIDRA_INT(local_48); playersEnd = playersEnd + 1; } local_48 = *GHIDRA_CAST((*GHIDRA_CAST((*playersBegin + 0x1e68)) + 0x1d98)); local_4c = playersEnd; if (local_48 != GHIDRA_CAST(0x0)) { if (playersEnd == playersCapacityEnd) { players = playersBegin; msvc::vector::_Emplace_reallocate(playersEnd,&local_48); playersBegin = players; } else { *playersEnd = GHIDRA_INT(local_48); playersEnd = playersEnd + 1; } local_4c = playersEnd; } } local_48 = *GHIDRA_CAST((*playersBegin + 0x1e6c)); playersEnd = local_4c; if (local_48 != GHIDRA_CAST(0x0)) { if (local_4c == playersCapacityEnd) { players = playersBegin; msvc::vector::_Emplace_reallocate(local_4c,&local_48); playersBegin = players; } else { *local_4c = GHIDRA_INT(local_48); playersEnd = local_4c + 1; } local_48 = *GHIDRA_CAST((*GHIDRA_CAST((*playersBegin + 0x1e6c)) + 0x1d98)); local_4c = playersEnd; if (local_48 != GHIDRA_CAST(0x0)) { if (playersEnd == playersCapacityEnd) { players = playersBegin; msvc::vector::_Emplace_reallocate(playersEnd,&local_48); playersBegin = players; local_4c = playersEnd; } else { *playersEnd = GHIDRA_INT(local_48); local_4c = playersEnd + 1; } } } piVar13 = local_4c; pEVar1 = GHIDRA_CAST(g_game->_stage); iVar6 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1d])) + 0x1)))); if ((iVar6 == 0) || (local_70 = pEVar1, iVar6 == 1)) { local_70 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEVar1[-1])) + 0x2eff)))); } parStageCount = GHIDRA_INT(&DAT_00000008); if (GHIDRA_INT(local_70) < 8) { parStageCount = GHIDRA_INT(local_70); } if (((10 < GHIDRA_INT(pEVar1)) || (iVar6 == 4)) || (local_80 = 0, iVar6 == 5)) { local_80 = 1; } *GHIDRA_CAST(this) = 0; local_78 = 0; iVar9 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x2a])) + 0x2)))) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x29])) + 0x1)))); iVar6 = iVar9 >> 0x1f; if (iVar9 / 0xc + iVar6 != iVar6) { iVar6 = 0; do { iVar9 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x29])) + 0x1)))); if (*GHIDRA_CAST((iVar9 + 8 + iVar6)) == '\0') { if (*GHIDRA_CAST((iVar9 + iVar6)) < 0xe) { iVar7 = *GHIDRA_CAST((&DAT_00b80bd0 + *GHIDRA_CAST((iVar9 + iVar6)) * 4)); } else { iVar7 = 0; } } else { iVar7 = 500; } *GHIDRA_CAST(this) = *GHIDRA_CAST(this) + iVar7; iVar6 = iVar6 + 0xc; local_78 = local_78 + 1; } while (local_78 < GHIDRA_UINT(((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x2a])) + 0x2)))) - iVar9) / 0xc))); } iVar6 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1d])) + 0x1)))); uVar8 = 0; if (iVar6 == 6) { uVar8 = 4000; } *GHIDRA_CAST((this + 4)) = uVar8; uVar8 = 0; if (iVar6 == 7) { uVar8 = 4000; } *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[2])) + 0x2)))) = uVar8; uVar8 = 0; if (iVar6 == 8) { uVar8 = 0x1a0a; } *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[5])) + 0x1)))) = uVar8; game = g_game; uVar8 = 0; if (iVar6 == 0xd) { uVar8 = 0x1a0a; } *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[6])) + 0x2)))) = uVar8; local_58 = (uint32_t)game->_gameStateFlags; local_59 = (game->_gameStateFlags & 0x200000000) != 0; local_74 = 0; redHeartsSum = 0; iVar9 = 0; if ((g_game->_gameStateFlags & 0x10000000000) != 0) { iVar9 = 0x15b3; } iVar7 = 0; if ((bool)local_59) { iVar7 = 0x115c; } soulHeartsSum = 0; uVar8 = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[10])) + 0x2)))) = iVar9 + iVar7; eternalHeartsSum = 0; if (iVar6 == 0xb) { uVar8 = 0x1a0a; } *GHIDRA_CAST((this + 8)) = uVar8; uVar8 = 0; if (iVar6 == 0xe) { uVar8 = 0x1a0a; } *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[9])) + 0x1)))) = uVar8; fVar10 = 0.0; local_4c = GHIDRA_CAST(0x0); boneHeartsSum = 0; local_48 = playersBegin; if (playersBegin != piVar13) { fVar10 = 0.0; do { iVar6 = *local_48; iVar9 = 0x10; local_78 = 0; uVar5 = *GHIDRA_CAST((iVar6 + 0x1350)); do { uVar11 = GHIDRA_INT(uVar5) >> 1; fVar10 = (float)(GHIDRA_INT(fVar10) + (uVar5 & 1)); uVar5 = GHIDRA_INT(uVar5) >> 2; local_78 = local_78 + (uVar11 & 1); iVar9 = iVar9 + -1; } while (iVar9 != 0); fVar10 = (float)(GHIDRA_INT(fVar10) + local_78); local_74 = local_74 + *GHIDRA_CAST((iVar6 + 0x1340)); redHeartsSum = redHeartsSum + *GHIDRA_CAST((iVar6 + 0x1344)); soulHeartsSum = soulHeartsSum + *GHIDRA_CAST((iVar6 + 0x134c)); eternalHeartsSum = eternalHeartsSum + *GHIDRA_CAST((iVar6 + 0x1348)); local_4c = GHIDRA_CAST((GHIDRA_INT(local_4c) + *GHIDRA_CAST((iVar6 + 0x194c)))); boneHeartsSum = boneHeartsSum + *GHIDRA_CAST((iVar6 + 0x1d88)); local_48 = local_48 + 1; } while (local_48 != piVar13); local_54 = fVar10; } fVar21 = 0.0; remainingValue = (float)((double)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1a])) + 0x2)))) + __uint_to_double_fixup[-(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1a])) + 0x2)))) >> 0x1f)]); for (decayWeight = 1.0; (0.0 < remainingValue && (0.001 < decayWeight)); decayWeight = decayWeight * 0.98058254) { auVar15 = ZEXT812(0x42c80000); if (remainingValue <= (*GHIDRA_CAST((GHIDRA_CAST(&(auVar15)) + 0x0)))) { (*GHIDRA_CAST((GHIDRA_CAST(&(auVar15)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar15)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(auVar15)) + 0x0))) = remainingValue; } remainingValue = remainingValue - 100.0; chunkScore = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar15)) + 0x0))) * decayWeight; fVar21 = fVar21 + chunkScore + chunkScore; } iVar6 = *playersBegin; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x1)))) = GHIDRA_INT(fVar21) + (GHIDRA_INT(local_4c) * 5 + *GHIDRA_CAST((iVar6 + 0x1368)) + (*GHIDRA_CAST((iVar6 + 0x1364)) + *GHIDRA_CAST((iVar6 + 0x135c))) * 2 + boneHeartsSum + eternalHeartsSum + GHIDRA_INT(fVar10) + redHeartsSum + soulHeartsSum + local_74) * 10; players = playersBegin; calculate_room_score(this); local_4c = GHIDRA_CAST(0x3c); challengeParams = Game::GetChallengeParams(g_game); if ((challengeParams->_pathType == 3) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1d])) + 0x1)))) == 0xe)) { local_80 = 0; parStageCount = GHIDRA_INT(local_70); if (6 < GHIDRA_INT(local_70)) { parStageCount = GHIDRA_INT(&DAT_00000006); } iVar6 = 0x3c; local_48 = GHIDRA_CAST(((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x2a])) + 0x2)))) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x29])) + 0x1))))) / 0xc)); if (local_48 != GHIDRA_CAST(0x0)) { entryFlag = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x29])) + 0x1)))) + 8)); iVar9 = iVar6; piVar14 = local_48; do { isEntryFlagged = *entryFlag; entryFlag = entryFlag + 0xc; iVar6 = iVar9 + 0x4b; if (isEntryFlagged == '\0') { iVar6 = iVar9; } piVar14 = GHIDRA_CAST((GHIDRA_INT(piVar14) + -1)); iVar9 = iVar6; } while (piVar14 != GHIDRA_CAST(0x0)); local_4c = GHIDRA_CAST(iVar6); } if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1d])) + 0x1)))) == 0xe) { local_4c = GHIDRA_CAST((iVar6 + 0x1a4)); } } piVar14 = GHIDRA_CAST(0x0); if ((parStageCount < 1) || (GHIDRA_UINT(parStageCount) < 8)) { piVar12 = local_4c; } else { uVar5 = parStageCount & 0x80000007; if (GHIDRA_INT(uVar5) < 0) { uVar5 = (uVar5 - 1 | 0xfffffff8) + 1; } iVar6 = 0; iVar9 = 0; iVar7 = 0; iVar16 = 0; iVar17 = 0; iVar18 = 0; iVar19 = 0; iVar20 = 0; do { iVar6 = iVar6 + stageParTimes[GHIDRA_INT(piVar14)]; iVar9 = iVar9 + stageParTimes[GHIDRA_INT(piVar14) + 1]; iVar7 = iVar7 + stageParTimes[GHIDRA_INT(piVar14) + 2]; iVar16 = iVar16 + stageParTimes[GHIDRA_INT(piVar14) + 3]; piVar12 = piVar14 + 1; iVar2 = GHIDRA_INT(piVar14) + 5; iVar3 = GHIDRA_INT(piVar14) + 6; iVar4 = GHIDRA_INT(piVar14) + 7; piVar14 = piVar14 + 2; iVar17 = iVar17 + stageParTimes[GHIDRA_INT(piVar12)]; iVar18 = iVar18 + stageParTimes[iVar2]; iVar19 = iVar19 + stageParTimes[iVar3]; iVar20 = iVar20 + stageParTimes[iVar4]; } while (GHIDRA_INT(piVar14) < GHIDRA_INT((parStageCount - uVar5))); piVar12 = GHIDRA_CAST((GHIDRA_INT(local_4c) + iVar6 + iVar17 + iVar7 + iVar19 + iVar9 + iVar18 + iVar16 + iVar20)); } local_74 = 0; if (GHIDRA_INT(piVar14) < parStageCount) { if (parStageCount - GHIDRA_INT(piVar14) < 2) { iVar6 = 0; LAB_009e63f7: piVar12 = GHIDRA_CAST((GHIDRA_INT(piVar12) + stageParTimes[GHIDRA_INT(piVar14)])); } else { iVar6 = 0; local_74 = 0; do { iVar6 = iVar6 + stageParTimes[GHIDRA_INT(piVar14)]; local_74 = local_74 + stageParTimes[GHIDRA_INT(piVar14) + 1]; piVar14 = GHIDRA_CAST((GHIDRA_INT(piVar14) + 2)); } while (GHIDRA_INT(piVar14) < parStageCount + -1); local_48 = piVar14; if (GHIDRA_INT(piVar14) < parStageCount) goto LAB_009e63f7; } piVar12 = GHIDRA_CAST((GHIDRA_INT(piVar12) + iVar6 + local_74)); } iVar9 = GHIDRA_INT(piVar12) + local_80 * 0x1a4; iVar6 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1d])) + 0x1)))); if (((iVar6 == 6) || (iVar6 == 7)) || (iVar6 == 8)) { iVar9 = iVar9 + 0x1a4; } gameStateFlags = g_game->_gameStateFlags; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0xe])) + 0x2)))) = 0; local_54 = (float)(iVar9 + 0xf0); if ((gameStateFlags & 0x200000000) == 0) { local_54 = (float)iVar9; } if (local_54 == 0.0) { iVar6 = 0; local_54 = 0.0; } else { fVar10 = log_precise(0.8); fVar10 = (fVar10 * ((float)g_game->_timeCounter / 30.0)) / (float)((double)GHIDRA_INT(local_54) + __uint_to_double_fixup[-(GHIDRA_INT(local_54) >> 0x1f)]); FUN_007df1e0(); local_54 = (1.0 - fVar10) * (float)(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[9])) + 0x1)))) + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[2])) + 0x2)))) + *GHIDRA_CAST(this) + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[5])) + 0x1)))) + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[10])) + 0x2)))) + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[6])) + 0x2)))) + *GHIDRA_CAST((this + 8)) + *GHIDRA_CAST((this + 4))) * 0.8; dVar22 = ceil((double)local_54); local_54 = (float)dVar22; iVar6 = GHIDRA_INT(dVar22); } *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0xe])) + 0x2)))) = iVar6; piVar12 = GHIDRA_CAST(0x0); local_48 = GHIDRA_CAST(0x0); piVar14 = playersBegin; if (playersBegin != piVar13) { do { iVar6 = *piVar14; piVar14 = piVar14 + 1; piVar12 = GHIDRA_CAST((GHIDRA_INT(piVar12) + *GHIDRA_CAST((iVar6 + 0x16b4)))); } while (piVar14 != piVar13); local_48 = piVar12; } fVar10 = log_precise(0.8); fVar21 = ((float)((double)GHIDRA_INT(local_48) + __uint_to_double_fixup[-(GHIDRA_INT(local_48) >> 0x1f)]) * fVar10) / 12.0; FUN_007df1e0(); local_54 = (1.0 - fVar21) * (float)*GHIDRA_CAST((this + 0xc)) * 0.8; dVar22 = ceil((double)local_54); local_54 = (float)dVar22; local_80 = thunk_FUN_00af0780(); stageNum = GHIDRA_INT(local_70); if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1d])) + 0x1)))) == 0xe) { stageNum = 7; } *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0xd])) + 0x1)))) = local_80; *GHIDRA_CAST((this + 0x10)) = 0; iVar6 = 0; fVar21 = (float)stageNum * 2.5; if (fVar21 <= 1.0) { fVar21 = 1.0; } if (fVar21 <= 0.0) { iVar9 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x1)))); } else { local_48 = GHIDRA_CAST(0x0); piVar14 = playersBegin; if (playersBegin != piVar13) { do { iVar6 = 0; piVar12 = *GHIDRA_CAST((*piVar14 + 0x16c8)); for (iVar9 = *GHIDRA_CAST((*piVar14 + 0x16cc)) - GHIDRA_INT(piVar12) >> 2; iVar9 != 0; iVar9 = iVar9 + -1 ) { iVar6 = iVar6 + *piVar12; piVar12 = piVar12 + 1; } piVar14 = piVar14 + 1; local_48 = GHIDRA_CAST((GHIDRA_INT(local_48) + iVar6)); } while (piVar14 != piVar13); local_80 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0xd])) + 0x1)))); } iVar9 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x1)))); fVar21 = ((float)((double)GHIDRA_INT(local_48) + __uint_to_double_fixup[-(GHIDRA_INT(local_48) >> 0x1f)]) * fVar10) / fVar21; FUN_007df1e0(); local_54 = (1.0 - fVar21) * (float)iVar9 * 0.8; dVar22 = ceil((double)local_54); local_54 = (float)dVar22; iVar6 = thunk_FUN_00af0780(); *GHIDRA_CAST((this + 0x10)) = iVar6; } *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x11])) + 0x1)))) = (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[9])) + 0x1)))) - iVar6) - local_80) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0xe])) + 0x2))))) + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[2])) + 0x2)))) + *GHIDRA_CAST(this) + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[5])) + 0x1)))) + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[10])) + 0x2)))) + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[6])) + 0x2)))) + iVar9 + *GHIDRA_CAST((this + 0xc)) + *GHIDRA_CAST((this + 8)) + *GHIDRA_CAST((this + 4)); LAB_009e66e0: if (playersBegin != GHIDRA_CAST(0x0)) { uVar5 = GHIDRA_INT(playersCapacityEnd) - GHIDRA_INT(playersBegin) & 0xfffffffc; piVar13 = playersBegin; if (0xfff < uVar5) { piVar13 = GHIDRA_CAST(playersBegin[-1]); uVar5 = uVar5 + 0x23; if (0x1f < GHIDRA_UINT((GHIDRA_INT(playersBegin) + (-4 - GHIDRA_INT(piVar13))))) { /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(piVar13,uVar5); } ExceptionList = local_1c; return; } // 009e6780 void ScoreSheet::calculate_room_score() { int iVar1; int iVar2; int entryOffset; int score; float multiplier; uint32_t i; int bonusTotal; Game *game; uint32_t gameStateFlagsHigh; entryOffset = 0; bonusTotal = 0; i = 0; *GHIDRA_CAST((this + 0xc)) = 0; score = 0; iVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x22])) + 0x2)))); iVar1 = *GHIDRA_CAST((this + 0x24)) - iVar2 >> 0x1f; if ((*GHIDRA_CAST((this + 0x24)) - iVar2) / 0xc + iVar1 != iVar1) { do { score = *GHIDRA_CAST((this + 0xc)); multiplier = *GHIDRA_CAST((entryOffset + 8 + iVar2)); if (*GHIDRA_CAST((entryOffset + 4 + iVar2)) == '\0') { iVar1 = FUN_009e69c0(*GHIDRA_CAST((entryOffset + iVar2)),0); score = score + GHIDRA_INT(((float)iVar1 * multiplier)); *GHIDRA_CAST((this + 0xc)) = score; } else { iVar1 = FUN_009e69c0(*GHIDRA_CAST((entryOffset + iVar2)),0); bonusTotal = bonusTotal + GHIDRA_INT(((float)iVar1 * multiplier)); } entryOffset = entryOffset + 0xc; i = i + 1; } while (i < GHIDRA_UINT(((*GHIDRA_CAST((this + 0x24)) - iVar2) / 0xc))); } iVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x1e])) + 0x2)))); i = 0; iVar1 = *GHIDRA_CAST((this + 0x20)) - iVar2 >> 0x1f; if ((*GHIDRA_CAST((this + 0x20)) - iVar2) / 0xc + iVar1 != iVar1) { iVar1 = 0; do { score = *GHIDRA_CAST((this + 0xc)); multiplier = *GHIDRA_CAST((iVar2 + 8 + iVar1)); if (*GHIDRA_CAST((iVar2 + 4 + iVar1)) == '\0') { entryOffset = FUN_009e69c0(*GHIDRA_CAST((iVar2 + iVar1)),1); score = score + GHIDRA_INT(((float)entryOffset * multiplier)); *GHIDRA_CAST((this + 0xc)) = score; } else { entryOffset = FUN_009e69c0(*GHIDRA_CAST((iVar2 + iVar1)),1); bonusTotal = bonusTotal + GHIDRA_INT(((float)entryOffset * multiplier)); } iVar1 = iVar1 + 0xc; i = i + 1; } while (i < GHIDRA_UINT(((*GHIDRA_CAST((this + 0x20)) - iVar2) / 0xc))); } if (1999 < bonusTotal) { (*GHIDRA_CAST((GHIDRA_CAST(&(this[0x2d])) + 0x1))) = 1; } game = g_game; iVar2 = 2000; if (bonusTotal < 2000) { iVar2 = bonusTotal; } score = (*GHIDRA_CAST((this + 0x28)) * 3 + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x26])) + 0x2))))) * 100 + iVar2 + *GHIDRA_CAST((this + 0x1c)) + score; *GHIDRA_CAST((this + 0xc)) = score; gameStateFlagsHigh = *GHIDRA_CAST((GHIDRA_INT(&game->_gameStateFlags) + 4)); if ((gameStateFlagsHigh & 0x40) != 0) { score = score + 1000; *GHIDRA_CAST((this + 0xc)) = score; gameStateFlagsHigh = *GHIDRA_CAST((GHIDRA_INT(&game->_gameStateFlags) + 4)); } if ((gameStateFlagsHigh & 0x80) != 0) { *GHIDRA_CAST((this + 0xc)) = score + 1000; } return; } // 009e6940 void * ScoreSheet::find_stage_entry(int stage, int stageType, uint8_t isFlag) { int iVar1; uint8_t *entry; int iVar2; uint32_t entryCount; uint32_t index; index = 0; iVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x16])) + 0x2)))) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x15])) + 0x1)))); entry = GHIDRA_CAST((iVar2 * 0x2aaaaaab)); iVar1 = iVar2 >> 0x1f; iVar2 = iVar2 / 0xc + iVar1; entryCount = iVar2 - iVar1; if (iVar2 != iVar1) { entry = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x15])) + 0x1)))) + 8)); while (((*GHIDRA_CAST((entry + -8)) != stage || (*GHIDRA_CAST((entry + -4)) != stageType)) || (*entry != isFlag))) { index = index + 1; entry = entry + 0xc; if (entryCount <= index) { return entry; } } if (entryCount == 1) { return entry; } } return entry; }