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>
This commit is contained in:
1 parent
2ff2d5d87f
commit
3ce74c6e2d
331 files changed
+485
-7835
No files matched your search
@@ -0,0 +1,257 @@
|
||||
#include "classes.h"
|
||||
|
||||
// 008d1f20
|
||||
void EmoteWheel::Update()
|
||||
{
|
||||
int *piVar1;
|
||||
char cVar2;
|
||||
uint uVar3;
|
||||
int iVar4;
|
||||
float *stickInput;
|
||||
float openProgress;
|
||||
float fVar5;
|
||||
float local_24;
|
||||
float local_20;
|
||||
int local_1c [3];
|
||||
void *local_10;
|
||||
undefined1 *puStack_c;
|
||||
int local_8;
|
||||
|
||||
local_8 = 0xffffffff;
|
||||
puStack_c = &LAB_00b05cad;
|
||||
local_10 = ExceptionList;
|
||||
uVar3 = __security_cookie ^ GHIDRA_UINT((local_1c + 6));
|
||||
ExceptionList = &local_10;
|
||||
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4));
|
||||
if (iVar4 == 1) {
|
||||
iVar4 = 1;
|
||||
fVar5 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x844));
|
||||
openProgress = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x840)) + 12.0;
|
||||
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x840)) = openProgress;
|
||||
if (fVar5 <= openProgress) {
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4)) = 2;
|
||||
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x840)) = fVar5;
|
||||
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x834)) = GHIDRA_INT((270.0 / *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x838))));
|
||||
iVar4 = 2;
|
||||
openProgress = fVar5;
|
||||
}
|
||||
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x804)) = openProgress;
|
||||
}
|
||||
if (iVar4 == 3) {
|
||||
fVar5 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x840)) - 12.0;
|
||||
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x840)) = fVar5;
|
||||
if (fVar5 <= 0.0) {
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x840)) = 0;
|
||||
fVar5 = 0.0;
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4)) = 0;
|
||||
}
|
||||
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x804)) = fVar5;
|
||||
}
|
||||
iVar4 = FUN_0090b070(uVar3);
|
||||
if ((((((iVar4 == 0) || ((g_game->_pauseScreen)._state != 0)) || (*GHIDRA_CAST<int *>(&g_game->_gameOver) != 0)
|
||||
) || (((g_game->_genericPrompt)._sprite._animState._animData != (void *)0x0 &&
|
||||
((g_game->_genericPrompt)._sprite._animState._isPlaying != 0)))) ||
|
||||
(((g_game->_leaderboard)._state != 0 || (*GHIDRA_CAST<int *>(&g_game->_stageTransition) != 0)))) ||
|
||||
((*GHIDRA_CAST<int *>(&g_game->_roomTransition) != 0 &&
|
||||
(cVar2 = Game::IsRoomTransitionActive(), cVar2 != '\0')))) {
|
||||
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) == 2) {
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x834)) = 0;
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4)) = 3;
|
||||
}
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x840)) = 0;
|
||||
}
|
||||
else {
|
||||
FUN_0090b070(uVar3);
|
||||
iVar4 = FUN_00423970();
|
||||
local_1c[2] = 0x1e;
|
||||
cVar2 = (**(code **)(PTR_vftable_00c57b18 + 0x74))(iVar4,FUN_00a209e0,local_1c + 2,0,0);
|
||||
if ((cVar2 != '\0') && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) == 0)) {
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x834)) = 0;
|
||||
FUN_008d26c0(0,0);
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4)) = 1;
|
||||
}
|
||||
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) == 2) {
|
||||
if (iVar4 == 0) {
|
||||
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x834)) < 0) {
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x834)) = 0;
|
||||
}
|
||||
local_1c[2] = 0x14;
|
||||
cVar2 = (**(code **)(PTR_vftable_00c57b18 + 0x74))(0,FUN_00a209e0,local_1c + 2,0,0);
|
||||
if (cVar2 == '\0') {
|
||||
local_1c[2] = 0x15;
|
||||
cVar2 = (**(code **)(PTR_vftable_00c57b18 + 0x74))(0,FUN_00a209e0,local_1c + 2,0,0);
|
||||
if (cVar2 != '\0') {
|
||||
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x834)) =
|
||||
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x834)) + 1U) %
|
||||
GHIDRA_UINT((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7cc)) + 4 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7d8)) * 0xc
|
||||
)) -
|
||||
*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7cc)) + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7d8)) * 0xc)) >>
|
||||
2));
|
||||
}
|
||||
}
|
||||
else {
|
||||
piVar1 = GHIDRA_CAST<int *>((GHIDRA_INT(this) + 0x834));
|
||||
*piVar1 = *piVar1 + -1;
|
||||
if (*piVar1 < 0) {
|
||||
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x834)) =
|
||||
(*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7cc)) + 4 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7d8)) * 0xc)) -
|
||||
*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7cc)) + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7d8)) * 0xc)) >> 2) +
|
||||
-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x834)) = 0xffffffff;
|
||||
(GHIDRA_CAST<InputManager *>((&PTR_vftable_00c57b18)))->InputManager::get_device(local_1c,iVar4);
|
||||
local_8 = 0;
|
||||
if (local_1c[0] == 0) {
|
||||
stickInput = &local_24;
|
||||
local_24 = g_vectorZero.x;
|
||||
local_20 = g_vectorZero.y;
|
||||
}
|
||||
else {
|
||||
stickInput = GHIDRA_CAST<float *>(FUN_00a1eed0(&local_24,0));
|
||||
}
|
||||
fVar5 = sqrtf(*stickInput * *stickInput + stickInput[1] * stickInput[1]);
|
||||
if (0.5 < fVar5) {
|
||||
fVar5 = atan2f(stickInput[1],*stickInput);
|
||||
fVar5 = fVar5 * 57.295776;
|
||||
if (fVar5 < 0.0) {
|
||||
fVar5 = fVar5 + 360.0;
|
||||
}
|
||||
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x834)) = GHIDRA_INT((fVar5 / *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x838))));
|
||||
}
|
||||
local_8 = 0xffffffff;
|
||||
FUN_004242b0();
|
||||
}
|
||||
local_1c[2] = 0xe;
|
||||
cVar2 = (**(code **)(PTR_vftable_00c57b18 + 0x74))(iVar4,FUN_00a209e0,local_1c + 2,0,0);
|
||||
if (cVar2 == '\0') {
|
||||
local_1c[1] = 0x1e;
|
||||
cVar2 = (**(code **)(PTR_vftable_00c57b18 + 0x74))(iVar4,FUN_00a209e0,local_1c + 1,0,0);
|
||||
if (cVar2 == '\0') {
|
||||
local_1c[1] = 0x1c;
|
||||
cVar2 = (**(code **)(PTR_vftable_00c57b18 + 0x74))
|
||||
(0xffffffff,FUN_00a209e0,local_1c + 1,0,0);
|
||||
if (cVar2 != '\0') {
|
||||
FUN_008d26c0((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7d8)) + 1U) %
|
||||
GHIDRA_UINT(((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 2000)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7cc))) / 0xc)),0)
|
||||
;
|
||||
ExceptionList = local_10;
|
||||
return;
|
||||
}
|
||||
local_20 = 2.10195e-44;
|
||||
cVar2 = (**(code **)(PTR_vftable_00c57b18 + 0x74))(iVar4,FUN_00a209e0,&local_20,0,0);
|
||||
if (cVar2 == '\0') {
|
||||
ExceptionList = local_10;
|
||||
return;
|
||||
}
|
||||
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) == 2) {
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x834)) = 0;
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4)) = 3;
|
||||
ExceptionList = local_10;
|
||||
return;
|
||||
}
|
||||
ExceptionList = local_10;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (-1 < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x834))) {
|
||||
iVar4 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7cc)) + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7d8)) * 0xc)) +
|
||||
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x834)) * 4));
|
||||
if (iVar4 == 0x12) {
|
||||
iVar4 = rand();
|
||||
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(g_manager[1]._gamestate)) + 0x92c)))) = iVar4 % 6 + 0x16;
|
||||
}
|
||||
else if (iVar4 == 0x13) {
|
||||
iVar4 = rand();
|
||||
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(g_manager[1]._gamestate)) + 0x92c)))) = iVar4 % 0x14 + 0x1c;
|
||||
}
|
||||
else {
|
||||
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(g_manager[1]._gamestate)) + 0x92c)))) = iVar4;
|
||||
}
|
||||
}
|
||||
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) == 2) {
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x834)) = 0;
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4)) = 3;
|
||||
ExceptionList = local_10;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
ExceptionList = local_10;
|
||||
return;
|
||||
}
|
||||
|
||||
// 008d2450
|
||||
void EmoteWheel::Render()
|
||||
{
|
||||
undefined4 extraout_ECX;
|
||||
int emotes;
|
||||
uint emoteIdx;
|
||||
float fVar1;
|
||||
float fVar2;
|
||||
float local_34;
|
||||
float local_30;
|
||||
float centerX;
|
||||
float centerY;
|
||||
Vector emotePos;
|
||||
KColor wheelColor;
|
||||
|
||||
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) != 0) {
|
||||
local_34 = g_screenWidth * 0.5;
|
||||
wheelColor._unk = 0;
|
||||
local_30 = g_screenHeight * 0.5;
|
||||
centerX = local_34;
|
||||
centerY = local_30;
|
||||
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) == 2) {
|
||||
wheelColor._red = 0.78431374;
|
||||
wheelColor._green = 0.7176471;
|
||||
wheelColor._blue = 0.6392157;
|
||||
wheelColor._alpha = 0.33333334;
|
||||
FUN_00424d70(&local_34,&wheelColor,0x43b40000,*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x848)));
|
||||
if (-1 < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x834))) {
|
||||
fVar1 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x838));
|
||||
fVar2 = (float)*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x834)) * fVar1;
|
||||
(GHIDRA_CAST<KColor *>((&wheelColor)))->KColor::set_from_argb_signed(0x6599ff99);
|
||||
FUN_00424d70(&local_34,extraout_ECX,fVar1 + fVar2,*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x848)));
|
||||
}
|
||||
emoteIdx = 0;
|
||||
emotes = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7cc)) + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7d8)) * 0xc));
|
||||
if (*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7cc)) + 4 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7d8)) * 0xc)) - emotes >>
|
||||
2 != 0) {
|
||||
do {
|
||||
FUN_00430750(*GHIDRA_CAST<undefined4 *>((emotes + emoteIdx * 4)),0);
|
||||
ItemUseAnim::update();
|
||||
local_34 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x804)) - 20.0;
|
||||
fVar1 = ((float)((double)GHIDRA_INT(emoteIdx) + __uint_to_double_fixup[-(GHIDRA_INT(emoteIdx) >> 0x1f)])
|
||||
* *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x838)) + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x838)) * 0.5) *
|
||||
0.017453292;
|
||||
fVar2 = cos(fVar1);
|
||||
fVar1 = sin(fVar1);
|
||||
emotePos.x = (fVar2 * local_34 - fVar1 * 0.0) + centerX;
|
||||
emotePos.y = fVar1 * local_34 + fVar2 * 0.0 + centerY;
|
||||
(GHIDRA_CAST<Game *>((GHIDRA_CAST<Game *>((GHIDRA_INT(this) + 8)))))->Game::Update(&emotePos);
|
||||
emoteIdx = emoteIdx + 1;
|
||||
emotes = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7cc)) + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7d8)) * 0xc));
|
||||
} while (emoteIdx <
|
||||
GHIDRA_UINT((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7cc)) + 4 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x7d8)) * 0xc
|
||||
)) - emotes >> 2)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
fVar1 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x840)) -
|
||||
(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x844)) - *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x848)));
|
||||
wheelColor._red = 0.78431374;
|
||||
wheelColor._green = 0.7176471;
|
||||
wheelColor._blue = 0.6392157;
|
||||
wheelColor._alpha = 0.33333334;
|
||||
if (fVar1 <= 0.0) {
|
||||
fVar1 = 0.0;
|
||||
}
|
||||
FUN_00424d70(&local_34,&wheelColor,0x43b40000,fVar1);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
Reference in new issue
Block a user