Files
isaac-port/generated-src/date_time.cpp
T
shweetandClaude Opus 5.5 3ce74c6e2d 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>
2026-11-19 21:10:23 -05:00

95 lines
4.3 KiB
C++

#include "classes.h"
// 0085af30
void DateTime::set_from_yyyymmdd(void *dateTime, int yyyymmdd)
{
*GHIDRA_CAST<undefined1 *>(dateTime) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dateTime) + 8)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dateTime) + 0xc)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dateTime) + 0x10)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dateTime) + 0x14)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dateTime) + 0x18)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dateTime) + 0x28)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dateTime) + 0x2c)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dateTime) + 0x30)) = 0;
*GHIDRA_CAST<byte *>(dateTime) = *GHIDRA_CAST<byte *>(dateTime) | 2;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(dateTime) + 0x20)) = (GHIDRA_UINT(yyyymmdd) % 10000) / 100 - 1;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(dateTime) + 0x1c)) = (GHIDRA_UINT(yyyymmdd) % 10000) % 100;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(dateTime) + 0x24)) = GHIDRA_UINT(yyyymmdd) / 10000 - 0x76c;
return;
}
// 00a24270
void DateTime::constructor(byte isNow)
{
__time64_t *_Time;
int iVar1;
int iVar2;
int iVar3;
byte bVar4;
tm *utcTime;
__time64_t _Var5;
_Time = GHIDRA_CAST<__time64_t *>((GHIDRA_INT(this) + 8));
*GHIDRA_CAST<undefined4 *>(_Time) = 0;
*GHIDRA_CAST<undefined1 *>(this) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0xc)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x10)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x14)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x18)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x1c)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x20)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x24)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x28)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x2c)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x30)) = 0;
if (isNow != 0) {
_Var5 = _time64(GHIDRA_CAST<__time64_t *>(0x0));
bVar4 = *GHIDRA_CAST<byte *>(this);
*_Time = _Var5;
*GHIDRA_CAST<byte *>(this) = bVar4 & 0xfd;
if ((bVar4 & 1) == 0) {
bVar4 = bVar4 & 0xfc;
}
else {
utcTime = _gmtime64(_Time);
iVar1 = utcTime->tm_min;
iVar2 = utcTime->tm_hour;
iVar3 = utcTime->tm_mday;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x10)) = utcTime->tm_sec;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x14)) = iVar1;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x18)) = iVar2;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x1c)) = iVar3;
iVar1 = utcTime->tm_year;
iVar2 = utcTime->tm_wday;
iVar3 = utcTime->tm_yday;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x20)) = utcTime->tm_mon;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x24)) = iVar1;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x28)) = iVar2;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x2c)) = iVar3;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x30)) = utcTime->tm_isdst;
bVar4 = *GHIDRA_CAST<byte *>(this) & 0xfd;
}
*GHIDRA_CAST<byte *>(this) = bVar4 | 1;
utcTime = _gmtime64(_Time);
iVar1 = utcTime->tm_min;
iVar2 = utcTime->tm_hour;
iVar3 = utcTime->tm_mday;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x10)) = utcTime->tm_sec;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x14)) = iVar1;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x18)) = iVar2;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x1c)) = iVar3;
iVar1 = utcTime->tm_year;
iVar2 = utcTime->tm_wday;
iVar3 = utcTime->tm_yday;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x20)) = utcTime->tm_mon;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x24)) = iVar1;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x28)) = iVar2;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x2c)) = iVar3;
iVar1 = utcTime->tm_isdst;
*GHIDRA_CAST<byte *>(this) = *GHIDRA_CAST<byte *>(this) & 0xfc;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x30)) = iVar1;
}
return;
}