source_tree: generated code coexists with the standard library and simdjson

Ghidra's primitive names become the standard types they are (undefined4/uint/ulong -> uint32_t, byte -> uint8_t ...;
Ghidra's ulong is 4 bytes, glibc's 8); the prelude includes the C library headers and every Ghidra type, global, import
or free function the headers already declare is left to them; the MSVC STL stand-ins move to namespace msvc. A curated
file can now include <string>, <vector>, simdjson.h and classes.h together. Body rate unchanged: 877/3256.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-11-19 21:30:14 -05:00
1 parent 0b86c1071f
commit 1326bb1571
2 files changed
+54 -25

No files matched your search

+8 -8
View File
@@ -23,7 +23,7 @@ constexpr unsigned int SHIFTS[SHIFT_COUNT][3] = {
constexpr float FLOAT_SCALE = 2.3283062e-10f;
// 007e8fe0 Seeds the generator, clamping the shift index to the last triple.
void RNG::SetSeed(uint seed, uint shiftIndex)
void RNG::SetSeed(uint32_t seed, uint32_t shiftIndex)
{
unsigned int index = shiftIndex < SHIFT_COUNT ? shiftIndex : SHIFT_COUNT - 1;
@@ -34,17 +34,17 @@ void RNG::SetSeed(uint seed, uint shiftIndex)
}
// 007e8f90 Seeds the generator as its constructor does, asserting on a shift index past the table.
void RNG::game_constructor(uint seed, uint shiftIndex)
void RNG::game_constructor(uint32_t seed, uint32_t shiftIndex)
{
if (shiftIndex >= SHIFT_COUNT) KAGE_LogMessage(LOG_ASSERT, (byte*)"RNG: Invalid ShiftIdx\n");
if (shiftIndex >= SHIFT_COUNT) KAGE_LogMessage(LOG_ASSERT, (uint8_t*)"RNG: Invalid ShiftIdx\n");
SetSeed(seed, shiftIndex);
}
// 007e90f0 Steps the seed through its xorshift and returns it.
// The game stops in the debugger on a zero seed, which never moves again.
uint RNG::Next()
uint32_t RNG::Next()
{
if (_seed == 0) KAGE_LogMessage(LOG_ASSERT, (byte*)"RNG Seed is zero!\n");
if (_seed == 0) KAGE_LogMessage(LOG_ASSERT, (uint8_t*)"RNG Seed is zero!\n");
_seed ^= _seed >> _shift1;
_seed ^= _seed << _shift2;
@@ -53,9 +53,9 @@ uint RNG::Next()
}
// 007e9020 A number below max, or 0 for a max of 0.
uint RNG::RandomInt(uint max)
uint32_t RNG::RandomInt(uint32_t max)
{
uint value = Next();
uint32_t value = Next();
return max == 0 ? 0 : value % max;
}
@@ -70,7 +70,7 @@ void RNG::Shuffle(RNG* rng, int* begin, int* end)
{
for (long i = end - begin - 1; i > 0; i--)
{
uint other = rng->Next() % (uint)(i + 1);
uint32_t other = rng->Next() % (uint32_t)(i + 1);
int value = begin[i];
begin[i] = begin[other];