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,437 @@
|
||||
#include "classes.h"
|
||||
|
||||
// 00407170
|
||||
Color::Color()
|
||||
{
|
||||
this->_tint[0] = 1.0;
|
||||
this->_tint[1] = 1.0;
|
||||
this->_tint[2] = 1.0;
|
||||
this->_tint[3] = 1.0;
|
||||
this->_colorize[0] = 0.0;
|
||||
this->_colorize[1] = 0.0;
|
||||
this->_colorize[2] = 0.0;
|
||||
this->_colorize[3] = 0.0;
|
||||
this->_offset[0] = 0.0;
|
||||
this->_offset[1] = 0.0;
|
||||
this->_offset[2] = 0.0;
|
||||
return;
|
||||
}
|
||||
|
||||
// 004071c0
|
||||
ColorMod * Color::operator_assign(ColorMod *other)
|
||||
{
|
||||
float fVar1;
|
||||
float fVar2;
|
||||
float fVar3;
|
||||
|
||||
fVar1 = other->_tint[1];
|
||||
fVar2 = other->_tint[2];
|
||||
fVar3 = other->_tint[3];
|
||||
this->_tint[0] = other->_tint[0];
|
||||
this->_tint[1] = fVar1;
|
||||
this->_tint[2] = fVar2;
|
||||
this->_tint[3] = fVar3;
|
||||
fVar1 = other->_colorize[1];
|
||||
fVar2 = other->_colorize[2];
|
||||
fVar3 = other->_colorize[3];
|
||||
this->_colorize[0] = other->_colorize[0];
|
||||
this->_colorize[1] = fVar1;
|
||||
this->_colorize[2] = fVar2;
|
||||
this->_colorize[3] = fVar3;
|
||||
*GHIDRA_CAST<undefined8 *>(this->_offset) = *GHIDRA_CAST<undefined8 *>(other->_offset);
|
||||
this->_offset[2] = other->_offset[2];
|
||||
return GHIDRA_CAST<ColorMod *>(this);
|
||||
}
|
||||
|
||||
// 00407240
|
||||
float Color::R()
|
||||
{
|
||||
return this->_tint[0];
|
||||
}
|
||||
|
||||
// 00407250
|
||||
float10 Color::G()
|
||||
{
|
||||
int in_ECX;
|
||||
|
||||
return (float10)*GHIDRA_CAST<float *>((in_ECX + 4));
|
||||
}
|
||||
|
||||
// 00407260
|
||||
float Color::B()
|
||||
{
|
||||
return this->_tint[2];
|
||||
}
|
||||
|
||||
// 00407270
|
||||
float Color::A()
|
||||
{
|
||||
return this->_tint[3];
|
||||
}
|
||||
|
||||
// 004072b0
|
||||
float10 Color::RO()
|
||||
{
|
||||
int in_ECX;
|
||||
|
||||
return (float10)*GHIDRA_CAST<float *>((in_ECX + 0x20));
|
||||
}
|
||||
|
||||
// 004072c0
|
||||
float Color::GO()
|
||||
{
|
||||
return this->_offset[1];
|
||||
}
|
||||
|
||||
// 004072d0
|
||||
float10 Color::BO()
|
||||
{
|
||||
int in_ECX;
|
||||
|
||||
return (float10)*GHIDRA_CAST<float *>((in_ECX + 0x28));
|
||||
}
|
||||
|
||||
// 0040d0e0
|
||||
Color::Color(undefined4 param_1, undefined4 param_2, undefined4 param_3, undefined4 param_4)
|
||||
{
|
||||
undefined4 *in_ECX;
|
||||
undefined4 in_XMM1_Da;
|
||||
undefined4 in_XMM2_Da;
|
||||
undefined4 in_XMM3_Da;
|
||||
|
||||
in_ECX[4] = 0;
|
||||
in_ECX[5] = 0;
|
||||
in_ECX[6] = 0;
|
||||
in_ECX[7] = 0;
|
||||
in_ECX[3] = param_1;
|
||||
in_ECX[8] = param_2;
|
||||
in_ECX[9] = param_3;
|
||||
*in_ECX = in_XMM1_Da;
|
||||
in_ECX[1] = in_XMM2_Da;
|
||||
in_ECX[2] = in_XMM3_Da;
|
||||
in_ECX[10] = param_4;
|
||||
return;
|
||||
}
|
||||
|
||||
// 004238f0
|
||||
Color::Color(float r, float g, float b, float a)
|
||||
{
|
||||
this->_colorize[0] = 0.0;
|
||||
this->_colorize[1] = 0.0;
|
||||
this->_colorize[2] = 0.0;
|
||||
this->_colorize[3] = 0.0;
|
||||
this->_offset[0] = 0.0;
|
||||
this->_offset[1] = 0.0;
|
||||
this->_offset[2] = 0.0;
|
||||
this->_tint[0] = r;
|
||||
this->_tint[1] = g;
|
||||
this->_tint[2] = b;
|
||||
this->_tint[3] = a;
|
||||
return;
|
||||
}
|
||||
|
||||
// 0042cfd0
|
||||
Color::Color(float r, float g, float b, float redOffset, float greenOffset, float blueOffset)
|
||||
{
|
||||
this->_colorize[0] = 0.0;
|
||||
this->_colorize[1] = 0.0;
|
||||
this->_colorize[2] = 0.0;
|
||||
this->_colorize[3] = 0.0;
|
||||
this->_offset[0] = redOffset;
|
||||
this->_offset[1] = greenOffset;
|
||||
this->_tint[0] = r;
|
||||
this->_tint[1] = g;
|
||||
this->_tint[2] = b;
|
||||
this->_tint[3] = 1.0;
|
||||
this->_offset[2] = blueOffset;
|
||||
return GHIDRA_CAST<ColorMod *>(this);
|
||||
}
|
||||
|
||||
// 00435ad0
|
||||
Color::Color(undefined4 param_1, int param_2, int param_3, int param_4)
|
||||
{
|
||||
undefined4 *in_ECX;
|
||||
undefined4 in_XMM1_Da;
|
||||
undefined4 in_XMM2_Da;
|
||||
undefined4 in_XMM3_Da;
|
||||
|
||||
in_ECX[4] = 0;
|
||||
in_ECX[5] = 0;
|
||||
in_ECX[6] = 0;
|
||||
in_ECX[7] = 0;
|
||||
in_ECX[3] = param_1;
|
||||
*in_ECX = in_XMM1_Da;
|
||||
in_ECX[1] = in_XMM2_Da;
|
||||
in_ECX[2] = in_XMM3_Da;
|
||||
in_ECX[8] = (float)param_2 * 0.003921569;
|
||||
in_ECX[9] = (float)param_3 * 0.003921569;
|
||||
in_ECX[10] = (float)param_4 * 0.003921569;
|
||||
return;
|
||||
}
|
||||
|
||||
// 00435b50
|
||||
Color::Color(undefined4 param_1, undefined4 param_2, undefined4 param_3, undefined4 param_4, undefined4 param_5, undefined4 param_6, undefined4 param_7, undefined4 param_8)
|
||||
{
|
||||
undefined4 *in_ECX;
|
||||
undefined4 in_XMM1_Da;
|
||||
undefined4 in_XMM2_Da;
|
||||
undefined4 in_XMM3_Da;
|
||||
|
||||
in_ECX[3] = param_1;
|
||||
in_ECX[4] = param_2;
|
||||
in_ECX[5] = param_3;
|
||||
in_ECX[6] = param_4;
|
||||
in_ECX[7] = param_5;
|
||||
in_ECX[8] = param_6;
|
||||
in_ECX[9] = param_7;
|
||||
*in_ECX = in_XMM1_Da;
|
||||
in_ECX[1] = in_XMM2_Da;
|
||||
in_ECX[2] = in_XMM3_Da;
|
||||
in_ECX[10] = param_8;
|
||||
return;
|
||||
}
|
||||
|
||||
// 00456380
|
||||
void Color::assign(undefined4 *param_1)
|
||||
{
|
||||
undefined4 uVar1;
|
||||
undefined4 uVar2;
|
||||
undefined4 uVar3;
|
||||
int in_ECX;
|
||||
|
||||
if (GHIDRA_CAST<undefined4 *>((in_ECX + 0x1e4)) != param_1) {
|
||||
uVar1 = param_1[1];
|
||||
uVar2 = param_1[2];
|
||||
uVar3 = param_1[3];
|
||||
*GHIDRA_CAST<undefined4 *>((in_ECX + 0x1e4)) = *param_1;
|
||||
*GHIDRA_CAST<undefined4 *>((in_ECX + 0x1e8)) = uVar1;
|
||||
*GHIDRA_CAST<undefined4 *>((in_ECX + 0x1ec)) = uVar2;
|
||||
*GHIDRA_CAST<undefined4 *>((in_ECX + 0x1f0)) = uVar3;
|
||||
uVar1 = param_1[5];
|
||||
uVar2 = param_1[6];
|
||||
uVar3 = param_1[7];
|
||||
*GHIDRA_CAST<undefined4 *>((in_ECX + 500)) = param_1[4];
|
||||
*GHIDRA_CAST<undefined4 *>((in_ECX + 0x1f8)) = uVar1;
|
||||
*GHIDRA_CAST<undefined4 *>((in_ECX + 0x1fc)) = uVar2;
|
||||
*GHIDRA_CAST<undefined4 *>((in_ECX + 0x200)) = uVar3;
|
||||
*GHIDRA_CAST<undefined8 *>((in_ECX + 0x204)) = *GHIDRA_CAST<undefined8 *>((param_1 + 8));
|
||||
*GHIDRA_CAST<undefined4 *>((in_ECX + 0x20c)) = param_1[10];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 004e46d0
|
||||
void Color::apply_to_kcolor(KColor *outColor, ColorMod *color, KColor *input)
|
||||
{
|
||||
float fVar1;
|
||||
float tintAlpha;
|
||||
float blue;
|
||||
float green;
|
||||
float red;
|
||||
float inputAlpha;
|
||||
float offsetRed;
|
||||
float tintAlpha;
|
||||
|
||||
fVar1 = color->_colorize[3];
|
||||
tintAlpha = color->_tint[3];
|
||||
red = color->_tint[0] * input->_red;
|
||||
green = color->_tint[1] * input->_green;
|
||||
blue = color->_tint[2] * input->_blue;
|
||||
inputAlpha = input->_alpha;
|
||||
if (fVar1 != 0.0) {
|
||||
tintAlpha = green * 0.71516 + red * 0.212671 + blue * 0.072169;
|
||||
red = red + (tintAlpha * color->_colorize[0] - red) * fVar1;
|
||||
green = green + (tintAlpha * color->_colorize[1] - green) * fVar1;
|
||||
blue = blue + (tintAlpha * color->_colorize[2] - blue) * fVar1;
|
||||
}
|
||||
fVar1 = color->_offset[2];
|
||||
tintAlpha = color->_offset[1];
|
||||
offsetRed = color->_offset[0];
|
||||
outColor->_unk = 0;
|
||||
outColor->_alpha = tintAlpha * inputAlpha;
|
||||
outColor->_blue = blue + fVar1;
|
||||
outColor->_green = green + tintAlpha;
|
||||
outColor->_red = red + offsetRed;
|
||||
return;
|
||||
}
|
||||
|
||||
// 00682ed0
|
||||
void Color::Reset()
|
||||
{
|
||||
this->_tint[0] = 1.0;
|
||||
this->_tint[1] = 1.0;
|
||||
this->_tint[2] = 1.0;
|
||||
this->_tint[3] = 1.0;
|
||||
this->_colorize[0] = 0.0;
|
||||
this->_colorize[1] = 0.0;
|
||||
this->_colorize[2] = 0.0;
|
||||
this->_colorize[3] = 0.0;
|
||||
this->_offset[0] = 0.0;
|
||||
this->_offset[1] = 0.0;
|
||||
this->_offset[2] = 0.0;
|
||||
return;
|
||||
}
|
||||
|
||||
// 00682f20
|
||||
void Color::SetTint(float r, float g, float b, float a)
|
||||
{
|
||||
this->_tint[0] = r;
|
||||
this->_tint[1] = g;
|
||||
this->_tint[2] = b;
|
||||
this->_tint[3] = a;
|
||||
return;
|
||||
}
|
||||
|
||||
// 00682fb0
|
||||
void Color::SetColorize(float red, float green, float blue, float amount)
|
||||
{
|
||||
this->_colorize[0] = red;
|
||||
this->_colorize[1] = green;
|
||||
this->_colorize[2] = blue;
|
||||
this->_colorize[3] = amount;
|
||||
return;
|
||||
}
|
||||
|
||||
// 00682fe0
|
||||
void Color::SetOffset(float redOffset, float greenOffset, float blueOffset)
|
||||
{
|
||||
this->_offset[0] = redOffset;
|
||||
this->_offset[1] = greenOffset;
|
||||
this->_offset[2] = blueOffset;
|
||||
return;
|
||||
}
|
||||
|
||||
// 006831c0
|
||||
void Color::__mul(ColorMod *other)
|
||||
{
|
||||
float colorizeB;
|
||||
float colorizeG;
|
||||
float otherColorizeR;
|
||||
|
||||
this->_tint[0] = other->_tint[0] * this->_tint[0];
|
||||
this->_tint[1] = other->_tint[1] * this->_tint[1];
|
||||
this->_tint[2] = other->_tint[2] * this->_tint[2];
|
||||
this->_tint[3] = other->_tint[3] * this->_tint[3];
|
||||
otherColorizeR = other->_colorize[0];
|
||||
if (otherColorizeR + other->_colorize[1] + other->_colorize[2] != 0.0) {
|
||||
colorizeG = this->_colorize[1];
|
||||
colorizeB = this->_colorize[2];
|
||||
if (this->_colorize[0] + colorizeG + colorizeB == 0.0) {
|
||||
this->_colorize[0] = otherColorizeR;
|
||||
this->_colorize[1] = other->_colorize[1];
|
||||
this->_colorize[2] = other->_colorize[2];
|
||||
this->_colorize[3] = other->_colorize[3];
|
||||
}
|
||||
else {
|
||||
this->_colorize[0] = (this->_colorize[0] + otherColorizeR) * 0.5;
|
||||
this->_colorize[1] = (colorizeG + other->_colorize[1]) * 0.5;
|
||||
this->_colorize[2] = (colorizeB + other->_colorize[2]) * 0.5;
|
||||
this->_colorize[3] = (this->_colorize[3] + other->_colorize[3]) * 0.5;
|
||||
}
|
||||
}
|
||||
this->_offset[0] = other->_offset[0] + this->_offset[0];
|
||||
this->_offset[1] = other->_offset[1] + this->_offset[1];
|
||||
this->_offset[2] = other->_offset[2] + this->_offset[2];
|
||||
return;
|
||||
}
|
||||
|
||||
// 006832e0
|
||||
ColorMod * Color::Lerp(ColorMod *out, ColorMod *from, ColorMod *to, float t)
|
||||
{
|
||||
float invT;
|
||||
float fromColorizeA;
|
||||
float fromColorizeB;
|
||||
float fromColorizeG;
|
||||
float fromColorizeR;
|
||||
float fromOffsetB;
|
||||
float fromOffsetG;
|
||||
float fromOffsetR;
|
||||
float fromTintA;
|
||||
float fromTintB;
|
||||
float fromTintG;
|
||||
float toColorizeA;
|
||||
float toColorizeB;
|
||||
float toColorizeG;
|
||||
float toColorizeR;
|
||||
float toOffsetB;
|
||||
float toOffsetG;
|
||||
float toOffsetR;
|
||||
float toTintA;
|
||||
float toTintB;
|
||||
float toTintG;
|
||||
|
||||
invT = 1.0 - t;
|
||||
toTintG = to->_tint[1];
|
||||
toTintB = to->_tint[2];
|
||||
toTintA = to->_tint[3];
|
||||
fromTintG = from->_tint[1];
|
||||
fromTintB = from->_tint[2];
|
||||
fromTintA = from->_tint[3];
|
||||
fromColorizeR = from->_colorize[0];
|
||||
fromColorizeG = from->_colorize[1];
|
||||
toColorizeR = to->_colorize[0];
|
||||
fromColorizeB = from->_colorize[2];
|
||||
fromColorizeA = from->_colorize[3];
|
||||
toColorizeG = to->_colorize[1];
|
||||
fromOffsetG = from->_offset[1];
|
||||
toColorizeB = to->_colorize[2];
|
||||
fromOffsetR = from->_offset[0];
|
||||
toColorizeA = to->_colorize[3];
|
||||
toOffsetR = to->_offset[0];
|
||||
toOffsetG = to->_offset[1];
|
||||
toOffsetB = to->_offset[2];
|
||||
fromOffsetB = from->_offset[2];
|
||||
out->_tint[0] = t * to->_tint[0] + invT * from->_tint[0];
|
||||
out->_tint[1] = t * toTintG + invT * fromTintG;
|
||||
out->_tint[2] = t * toTintB + invT * fromTintB;
|
||||
out->_tint[3] = t * toTintA + invT * fromTintA;
|
||||
out->_offset[1] = invT * fromOffsetG + t * toOffsetG;
|
||||
out->_offset[0] = invT * fromOffsetR + t * toOffsetR;
|
||||
out->_offset[2] = invT * fromOffsetB + t * toOffsetB;
|
||||
out->_colorize[0] = invT * fromColorizeR + t * toColorizeR;
|
||||
out->_colorize[1] = invT * fromColorizeG + t * toColorizeG;
|
||||
out->_colorize[2] = invT * fromColorizeB + t * toColorizeB;
|
||||
out->_colorize[3] = invT * fromColorizeA + t * toColorizeA;
|
||||
return out;
|
||||
}
|
||||
|
||||
// 0069f990
|
||||
void * Color::copy_constructor_ext(void *other)
|
||||
{
|
||||
float fVar1;
|
||||
float fVar2;
|
||||
float fVar3;
|
||||
void *local_10;
|
||||
undefined1 *puStack_c;
|
||||
undefined4 local_8;
|
||||
|
||||
local_8 = 0xffffffff;
|
||||
puStack_c = &LAB_00afa07b;
|
||||
local_10 = ExceptionList;
|
||||
ExceptionList = &local_10;
|
||||
fVar1 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(other) + 4));
|
||||
fVar2 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(other) + 8));
|
||||
fVar3 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(other) + 0xc));
|
||||
this->_tint[0] = *GHIDRA_CAST<float *>(other);
|
||||
this->_tint[1] = fVar1;
|
||||
this->_tint[2] = fVar2;
|
||||
this->_tint[3] = fVar3;
|
||||
fVar1 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(other) + 0x14));
|
||||
fVar2 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(other) + 0x18));
|
||||
fVar3 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(other) + 0x1c));
|
||||
this->_colorize[0] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(other) + 0x10));
|
||||
this->_colorize[1] = fVar1;
|
||||
this->_colorize[2] = fVar2;
|
||||
this->_colorize[3] = fVar3;
|
||||
*GHIDRA_CAST<undefined8 *>(this->_offset) = *GHIDRA_CAST<undefined8 *>((GHIDRA_CAST<char *>(other) + 0x20));
|
||||
this->_offset[2] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(other) + 0x28));
|
||||
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((this + 1)))))->std::string::string((void *)(GHIDRA_INT(other) + 0x2c));
|
||||
local_8 = 0;
|
||||
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((this[1]._colorize + 2)))))->std::string::string((void *)(GHIDRA_INT(other) + 0x44));
|
||||
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),1);
|
||||
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((this[2]._tint + 1)))))->std::string::string((void *)(GHIDRA_INT(other) + 0x5c));
|
||||
this[2]._colorize[3] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(other) + 0x74));
|
||||
this[2]._offset[0] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(other) + 0x78));
|
||||
ExceptionList = local_10;
|
||||
return this;
|
||||
}
|
||||
Reference in new issue
Block a user