#include "classes.h" // 008fd3c0 void MTRNG::Init(uint32_t seed) { int iVar1; *GHIDRA_CAST(this) = seed; *GHIDRA_CAST((this + 0x340)) = 1; do { iVar1 = *GHIDRA_CAST((this + 0x340)); *GHIDRA_CAST((GHIDRA_CAST(this) + iVar1 * 4)) = (*GHIDRA_CAST((GHIDRA_CAST(this) + iVar1 * 4 + -4)) >> 0x1e ^ *GHIDRA_CAST((GHIDRA_CAST(this) + iVar1 * 4 + -4))) * 0x6c078965 + iVar1; *GHIDRA_CAST((this + 0x340)) = *GHIDRA_CAST((this + 0x340)) + 1; } while (*GHIDRA_CAST((this + 0x340)) < 0x270); return; } // 008fd410 uint32_t MTRNG::Next() { int index; uint32_t y; index = *GHIDRA_CAST((this + 0x340)); if (0x26f < index) { if (index == 0x271) { Init(this,0x1571); } index = 0; do { y = (*GHIDRA_CAST((GHIDRA_CAST(this) + index * 4 + 4)) ^ *GHIDRA_CAST((GHIDRA_CAST(this) + index * 4))) & 0x7fffffff ^ *GHIDRA_CAST((GHIDRA_CAST(this) + index * 4)); *GHIDRA_CAST((GHIDRA_CAST(this) + index * 4)) = y >> 1 ^ GHIDRA_UINT((&PTR_00b67f8c)[y & 1]) ^ *GHIDRA_CAST((GHIDRA_CAST(this) + index * 4 + 0x634)); index = index + 1; } while (index < 0xe3); do { y = (*GHIDRA_CAST((GHIDRA_CAST(this) + index * 4 + 4)) ^ *GHIDRA_CAST((GHIDRA_CAST(this) + index * 4))) & 0x7fffffff ^ *GHIDRA_CAST((GHIDRA_CAST(this) + index * 4)); *GHIDRA_CAST((GHIDRA_CAST(this) + index * 4)) = y >> 1 ^ GHIDRA_UINT((&PTR_00b67f8c)[y & 1]) ^ *GHIDRA_CAST((GHIDRA_CAST(this) + index * 4 + -0x38c)); index = index + 1; } while (index < 0x26f); y = (*GHIDRA_CAST(this) ^ *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x33e])) + 0x2))))) & 0x7fffffff ^ *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x33e])) + 0x2)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x33e])) + 0x2)))) = GHIDRA_UINT((&PTR_00b67f8c)[y & 1]) ^ *GHIDRA_CAST((this + 0x210)) ^ y >> 1; index = 0; *GHIDRA_CAST((this + 0x340)) = 0; } y = *GHIDRA_CAST((GHIDRA_CAST(this) + index * 4)); *GHIDRA_CAST((this + 0x340)) = index + 1; y = y ^ y >> 0xb; y = y ^ (y & 0xff3a58ad) << 7; y = y ^ (y & 0xffffdf8c) << 0xf; return y >> 0x12 ^ y; }