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,343 @@
|
||||
#include "classes.h"
|
||||
|
||||
// 0084dc00
|
||||
void StatsPanel::add_stat_line()
|
||||
{
|
||||
char *format;
|
||||
void **formattedString;
|
||||
int in_ECX;
|
||||
byte *textEnd;
|
||||
void *pvVar1;
|
||||
uint allocSize;
|
||||
float in_XMM1_Da;
|
||||
void *entry;
|
||||
void *pvStack_1bc;
|
||||
void *pvStack_1b8;
|
||||
void *pvStack_1b4;
|
||||
undefined8 local_1b0;
|
||||
undefined1 local_1a8 [12];
|
||||
undefined1 local_19c [12];
|
||||
undefined1 local_190 [12];
|
||||
undefined1 local_184 [12];
|
||||
undefined1 local_178 [12];
|
||||
undefined1 local_16c [20];
|
||||
void *local_158;
|
||||
undefined4 local_148;
|
||||
uint local_144;
|
||||
void *textString [4];
|
||||
undefined4 local_130;
|
||||
uint local_12c;
|
||||
byte text [260];
|
||||
uint local_24;
|
||||
undefined1 *puStack_20;
|
||||
void *local_1c;
|
||||
undefined1 *puStack_18;
|
||||
undefined4 local_14;
|
||||
byte ch;
|
||||
|
||||
puStack_20 = text + 0x124;
|
||||
local_14 = 0xffffffff;
|
||||
puStack_18 = &LAB_00b02fbb;
|
||||
local_1c = ExceptionList;
|
||||
local_24 = __security_cookie ^ GHIDRA_UINT((text + 0x118));
|
||||
ExceptionList = &local_1c;
|
||||
if (in_XMM1_Da != 0.0) {
|
||||
format = "<color=FF3BF745>+%.2f<color=0xffffffff>";
|
||||
if (in_XMM1_Da < 0.0) {
|
||||
format = "<color=FFF7513B>%.2f<color=0xffffffff>";
|
||||
}
|
||||
sprintf_s(text,0x100,GHIDRA_CAST<byte *>(format));
|
||||
(GHIDRA_CAST<InfoDisplayText *>((&entry)))->InfoDisplayText::constructor();
|
||||
local_14 = 0;
|
||||
textEnd = text;
|
||||
local_130 = 0;
|
||||
local_12c = 0xf;
|
||||
textString[0] = (void *)0x0;
|
||||
do {
|
||||
ch = *textEnd;
|
||||
textEnd = textEnd + 1;
|
||||
} while (ch != 0);
|
||||
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(textString))))->std::string::assign(text,GHIDRA_INT(textEnd) - GHIDRA_INT((text + 1)));
|
||||
local_14 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),1);
|
||||
formattedString = (void **)FUN_00651d50();
|
||||
if (&entry != formattedString) {
|
||||
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(&entry))))->std::string::_Tidy_deallocate();
|
||||
entry = *formattedString;
|
||||
pvStack_1bc = formattedString[1];
|
||||
pvStack_1b8 = formattedString[2];
|
||||
pvStack_1b4 = formattedString[3];
|
||||
local_1b0 = *GHIDRA_CAST<undefined8 *>((formattedString + 4));
|
||||
formattedString[4] = (void *)0x0;
|
||||
formattedString[5] = (void *)0xf;
|
||||
*GHIDRA_CAST<char *>(formattedString) = '\0';
|
||||
}
|
||||
if (0xf < local_144) {
|
||||
allocSize = local_144 + 1;
|
||||
pvVar1 = local_158;
|
||||
if (0xfff < allocSize) {
|
||||
pvVar1 = *(void **)(GHIDRA_CAST<char *>(local_158) + -4);
|
||||
allocSize = local_144 + 0x24;
|
||||
if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_158) + (-4 - GHIDRA_INT(pvVar1))))) goto LAB_0084ddc1;
|
||||
}
|
||||
operator_delete(pvVar1,allocSize);
|
||||
}
|
||||
local_14 = local_14 & 0xffffff00;
|
||||
local_148 = 0;
|
||||
local_144 = 0xf;
|
||||
local_158 = (void *)(GHIDRA_UINT(local_158) & 0xffffff00);
|
||||
if (0xf < local_12c) {
|
||||
allocSize = local_12c + 1;
|
||||
pvVar1 = textString[0];
|
||||
if (0xfff < allocSize) {
|
||||
pvVar1 = *(void **)(GHIDRA_INT(textString[0]) + -4);
|
||||
allocSize = local_12c + 0x24;
|
||||
if (0x1f < GHIDRA_UINT((GHIDRA_INT(textString[0]) + (-4 - GHIDRA_INT(pvVar1))))) {
|
||||
LAB_0084ddc1:
|
||||
/* WARNING: Subroutine does not return */
|
||||
_invalid_parameter_noinfo_noreturn();
|
||||
}
|
||||
}
|
||||
operator_delete(pvVar1,allocSize);
|
||||
}
|
||||
pvVar1 = *(void **)(in_ECX + 0x24);
|
||||
if (pvVar1 == *(void **)(in_ECX + 0x28)) {
|
||||
std::vector<104byte>::_Emplace_reallocate(pvVar1,&entry);
|
||||
}
|
||||
else {
|
||||
(GHIDRA_CAST<InfoDisplayEntry *>((pvVar1)))->InfoDisplayEntry::copy_constructor(&entry);
|
||||
*GHIDRA_CAST<int *>((in_ECX + 0x24)) = *GHIDRA_CAST<int *>((in_ECX + 0x24)) + 0x68;
|
||||
}
|
||||
FID_conflict__Tidy(local_16c);
|
||||
FID_conflict__Tidy(local_178);
|
||||
FID_conflict__Tidy(local_184);
|
||||
FID_conflict__Tidy(local_190);
|
||||
FID_conflict__Tidy(local_19c);
|
||||
FID_conflict__Tidy(local_1a8);
|
||||
if (0xf < (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_1b0)) + 0x4)))) {
|
||||
allocSize = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_1b0)) + 0x4))) + 1;
|
||||
pvVar1 = entry;
|
||||
if (0xfff < allocSize) {
|
||||
pvVar1 = *(void **)(GHIDRA_CAST<char *>(entry) + -4);
|
||||
allocSize = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_1b0)) + 0x4))) + 0x24;
|
||||
if (0x1f < GHIDRA_UINT((GHIDRA_INT(entry) + (-4 - GHIDRA_INT(pvVar1))))) {
|
||||
/* WARNING: Subroutine does not return */
|
||||
_invalid_parameter_noinfo_noreturn();
|
||||
}
|
||||
}
|
||||
operator_delete(pvVar1,allocSize);
|
||||
}
|
||||
}
|
||||
ExceptionList = local_1c;
|
||||
return;
|
||||
}
|
||||
|
||||
// 0084dea0
|
||||
void StatsPanel::set(Entity_Player *player, byte isGoldenTrinket)
|
||||
{
|
||||
uint uVar1;
|
||||
void *extraout_ECX;
|
||||
void *extraout_ECX_00;
|
||||
void *panel;
|
||||
undefined3 in_stack_00000009;
|
||||
std_string statName;
|
||||
void *local_10;
|
||||
undefined1 *puStack_c;
|
||||
uint local_8;
|
||||
|
||||
local_8 = 0xffffffff;
|
||||
puStack_c = &LAB_00b03025;
|
||||
local_10 = ExceptionList;
|
||||
uVar1 = __security_cookie ^ GHIDRA_UINT(&(&statName)[1]._size);
|
||||
ExceptionList = &local_10;
|
||||
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) != 0) {
|
||||
*GHIDRA_CAST<Entity_Player **>((GHIDRA_CAST<char *>(this) + 0x48)) = player;
|
||||
if (*GHIDRA_CAST<int *>(this) == 0) {
|
||||
preview_collectible(1);
|
||||
panel = extraout_ECX;
|
||||
}
|
||||
else {
|
||||
panel = this;
|
||||
if (*GHIDRA_CAST<int *>(this) == 1) {
|
||||
preview_trinket(1,_isGoldenTrinket);
|
||||
panel = extraout_ECX_00;
|
||||
}
|
||||
}
|
||||
FUN_00856840(panel,uVar1);
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x24)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x20));
|
||||
statName._capacity = 0xf;
|
||||
statName._size = 6;
|
||||
builtin_strncpy(statName._buf," Speed",7);
|
||||
local_8 = 0;
|
||||
add_stat_line(&statName);
|
||||
local_8 = 0xffffffff;
|
||||
if (0xf < statName._capacity) {
|
||||
uVar1 = statName._capacity + 1;
|
||||
panel = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)statName._buf)) + 0x0)));
|
||||
if (0xfff < uVar1) {
|
||||
panel = *(void **)((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) + -4);
|
||||
uVar1 = statName._capacity + 0x24;
|
||||
if (0x1f < ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) - GHIDRA_INT(panel)) - 4U) goto LAB_0084e1d4;
|
||||
}
|
||||
operator_delete(panel,uVar1);
|
||||
}
|
||||
statName._capacity = 0xf;
|
||||
statName._size = 6;
|
||||
builtin_strncpy(statName._buf," Tears",7);
|
||||
local_8 = 1;
|
||||
add_stat_line(&statName);
|
||||
local_8 = 0xffffffff;
|
||||
if (0xf < statName._capacity) {
|
||||
uVar1 = statName._capacity + 1;
|
||||
panel = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)statName._buf)) + 0x0)));
|
||||
if (0xfff < uVar1) {
|
||||
panel = *(void **)((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) + -4);
|
||||
uVar1 = statName._capacity + 0x24;
|
||||
if (0x1f < ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) - GHIDRA_INT(panel)) - 4U) goto LAB_0084e1d4;
|
||||
}
|
||||
operator_delete(panel,uVar1);
|
||||
}
|
||||
statName._capacity = 0xf;
|
||||
statName._size = 7;
|
||||
builtin_strncpy(statName._buf," Damage",8);
|
||||
local_8 = 2;
|
||||
add_stat_line(&statName);
|
||||
local_8 = 0xffffffff;
|
||||
if (0xf < statName._capacity) {
|
||||
uVar1 = statName._capacity + 1;
|
||||
panel = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)statName._buf)) + 0x0)));
|
||||
if (0xfff < uVar1) {
|
||||
panel = *(void **)((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) + -4);
|
||||
uVar1 = statName._capacity + 0x24;
|
||||
if (0x1f < ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) - GHIDRA_INT(panel)) - 4U) goto LAB_0084e1d4;
|
||||
}
|
||||
operator_delete(panel,uVar1);
|
||||
}
|
||||
statName._capacity = 0xf;
|
||||
statName._size = 6;
|
||||
builtin_strncpy(statName._buf," Range",7);
|
||||
local_8 = 3;
|
||||
add_stat_line(&statName);
|
||||
local_8 = 0xffffffff;
|
||||
if (0xf < statName._capacity) {
|
||||
uVar1 = statName._capacity + 1;
|
||||
panel = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)statName._buf)) + 0x0)));
|
||||
if (0xfff < uVar1) {
|
||||
panel = *(void **)((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) + -4);
|
||||
uVar1 = statName._capacity + 0x24;
|
||||
if (0x1f < ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) - GHIDRA_INT(panel)) - 4U) goto LAB_0084e1d4;
|
||||
}
|
||||
operator_delete(panel,uVar1);
|
||||
}
|
||||
builtin_strncpy(statName._buf + 8,"eed",4);
|
||||
statName._capacity = 0xf;
|
||||
statName._size = 0xb;
|
||||
builtin_strncpy(statName._buf," Shot Sp",8);
|
||||
local_8 = 4;
|
||||
add_stat_line(&statName);
|
||||
local_8 = 0xffffffff;
|
||||
if (0xf < statName._capacity) {
|
||||
uVar1 = statName._capacity + 1;
|
||||
panel = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)statName._buf)) + 0x0)));
|
||||
if (0xfff < uVar1) {
|
||||
panel = *(void **)((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) + -4);
|
||||
uVar1 = statName._capacity + 0x24;
|
||||
if (0x1f < ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) - GHIDRA_INT(panel)) - 4U) goto LAB_0084e1d4;
|
||||
}
|
||||
operator_delete(panel,uVar1);
|
||||
}
|
||||
statName._capacity = 0xf;
|
||||
statName._size = 5;
|
||||
builtin_strncpy(statName._buf," Luck",6);
|
||||
local_8 = 5;
|
||||
add_stat_line(&statName);
|
||||
if (0xf < statName._capacity) {
|
||||
uVar1 = statName._capacity + 1;
|
||||
panel = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)statName._buf)) + 0x0)));
|
||||
if (0xfff < uVar1) {
|
||||
panel = *(void **)((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) + -4);
|
||||
uVar1 = statName._capacity + 0x24;
|
||||
if (0x1f < ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) - GHIDRA_INT(panel)) - 4U) {
|
||||
LAB_0084e1d4:
|
||||
/* WARNING: Subroutine does not return */
|
||||
_invalid_parameter_noinfo_noreturn();
|
||||
}
|
||||
}
|
||||
operator_delete(panel,uVar1);
|
||||
}
|
||||
}
|
||||
ExceptionList = local_10;
|
||||
return;
|
||||
}
|
||||
|
||||
// 0084e9d0
|
||||
void StatsPanel::snapshot_stats(undefined4 param_1)
|
||||
{
|
||||
int in_ECX;
|
||||
|
||||
if (*GHIDRA_CAST<int *>((in_ECX + 0x48)) != 0) {
|
||||
StatTracker::set(param_1);
|
||||
StatTracker::set(param_1);
|
||||
StatTracker::set(param_1);
|
||||
StatTracker::set(param_1);
|
||||
StatTracker::set(param_1);
|
||||
StatTracker::set(param_1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 0084ea90
|
||||
void StatsPanel::preview_collectible(undefined1 param_1)
|
||||
{
|
||||
uint *puVar1;
|
||||
int iVar2;
|
||||
int in_ECX;
|
||||
|
||||
if (*GHIDRA_CAST<int *>((in_ECX + 0x48)) != 0) {
|
||||
snapshot_stats(0);
|
||||
iVar2 = *GHIDRA_CAST<int *>((in_ECX + 0x48));
|
||||
*GHIDRA_CAST<undefined4 *>((iVar2 + 0x2ef4)) = *GHIDRA_CAST<undefined4 *>((in_ECX + 4));
|
||||
*GHIDRA_CAST<undefined1 *>((iVar2 + 0x2ef0)) = param_1;
|
||||
puVar1 = GHIDRA_CAST<uint *>((*GHIDRA_CAST<int *>((in_ECX + 0x48)) + 0x1574));
|
||||
*puVar1 = *puVar1 | 0x41f;
|
||||
(GHIDRA_CAST<Entity_Player *>((*GHIDRA_CAST<Entity_Player **>((in_ECX + 0x48)))))->Entity_Player::EvaluateItems();
|
||||
snapshot_stats(1);
|
||||
iVar2 = *GHIDRA_CAST<int *>((in_ECX + 0x48));
|
||||
*GHIDRA_CAST<undefined4 *>((iVar2 + 0x2ef4)) = 0;
|
||||
*GHIDRA_CAST<undefined1 *>((iVar2 + 0x2ef0)) = 1;
|
||||
puVar1 = GHIDRA_CAST<uint *>((*GHIDRA_CAST<int *>((in_ECX + 0x48)) + 0x1574));
|
||||
*puVar1 = *puVar1 | 0x41f;
|
||||
(GHIDRA_CAST<Entity_Player *>((*GHIDRA_CAST<Entity_Player **>((in_ECX + 0x48)))))->Entity_Player::EvaluateItems();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 0084eb10
|
||||
void StatsPanel::preview_trinket(undefined1 param_1, int param_2)
|
||||
{
|
||||
uint *puVar1;
|
||||
int iVar2;
|
||||
uint uVar3;
|
||||
int in_ECX;
|
||||
|
||||
if (*GHIDRA_CAST<int *>((in_ECX + 0x48)) != 0) {
|
||||
snapshot_stats(0);
|
||||
iVar2 = *GHIDRA_CAST<int *>((in_ECX + 0x48));
|
||||
uVar3 = *GHIDRA_CAST<uint *>((in_ECX + 4)) | 0x8000;
|
||||
if (param_2 != 1) {
|
||||
uVar3 = *GHIDRA_CAST<uint *>((in_ECX + 4));
|
||||
}
|
||||
*GHIDRA_CAST<uint *>((iVar2 + 0x2ef8)) = uVar3;
|
||||
*GHIDRA_CAST<undefined1 *>((iVar2 + 0x2ef0)) = param_1;
|
||||
puVar1 = GHIDRA_CAST<uint *>((*GHIDRA_CAST<int *>((in_ECX + 0x48)) + 0x1574));
|
||||
*puVar1 = *puVar1 | 0x41f;
|
||||
(GHIDRA_CAST<Entity_Player *>((*GHIDRA_CAST<Entity_Player **>((in_ECX + 0x48)))))->Entity_Player::EvaluateItems();
|
||||
snapshot_stats(1);
|
||||
iVar2 = *GHIDRA_CAST<int *>((in_ECX + 0x48));
|
||||
*GHIDRA_CAST<undefined4 *>((iVar2 + 0x2ef8)) = 0;
|
||||
*GHIDRA_CAST<undefined1 *>((iVar2 + 0x2ef0)) = 1;
|
||||
puVar1 = GHIDRA_CAST<uint *>((*GHIDRA_CAST<int *>((in_ECX + 0x48)) + 0x1574));
|
||||
*puVar1 = *puVar1 | 0x41f;
|
||||
(GHIDRA_CAST<Entity_Player *>((*GHIDRA_CAST<Entity_Player **>((in_ECX + 0x48)))))->Entity_Player::EvaluateItems();
|
||||
}
|
||||
return;
|
||||
}
|
||||
Reference in new issue
Block a user