Curation round 2, wave A: anm2 (Anm2Ed JSON), text, config as idiomatic classes; SDL3 platform opens a window

- anm2.h/.cpp take over ANM2, AnimationState, LayerState, AnmCache and the frame data. They read Anm2Ed's JSON documents
  with simdjson and play them as the game does (interpolation baked at load). src/anm2/ and msvc.h are retired.
- font, formatted_text, string_table and rich_text take over the text classes. FormattedText::parse is still bit-exact
  against its assembly.
- options_config and challenge_params take over OptionsConfig, ChallengeParams and the .ini helpers. The tests include
  Save's exact bytes.
- platform.h/.cpp and main.cpp run IsaacMain on SDL3: the window and GL context open, and the run stops at the first
  built-in shader (FUN_00a13fa0).
- source_tree.py: a taken-over parent stays bytes, taken-over methods are not re-emitted as a namespace, and every
  address in a (a, b, c to d) list on a comment counts as taken over.
- log.h: reconstruction_missing() for a taken-over class's methods that are not written yet.
206 functions taken over, boot path 89/615. The full build waits for wave B: item_config, entity_config and mod_manager
still use the old APIs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-11-19 23:04:54 -05:00
1 parent d6e1ca7c6c
commit 780767f5e1
161 files changed
+8646 -21919

No files matched your search

+74 -1
View File
@@ -1,7 +1,80 @@
#include "classes.h"
#include "data.h"
#include "gl.h"
#include "platform.h"
#include <SDL3/SDL_video.h>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
// The Linux entry point hands over to the game's own main.
constexpr const char* GAME_VERSION = "J460";
constexpr const char* LOCALHOST_FLAG = "--localhost_match";
constexpr const char* RESOURCES_FLAG = "--resources";
constexpr const char* LOG_FILE = "log.txt";
constexpr const char* LOCALHOST_LOG = "localhost/log_";
constexpr const char* CLAMP_COLOR_EXTENSION = "GL_ARB_color_buffer_float";
// GL 3.0, as major * 10 + minor.
constexpr int CLAMP_COLOR_VERSION = 30;
constexpr int VERSION_MINOR_DIGITS = 10;
// The context's GL version as major * 10 + minor, 0 without one.
static int gl_version_get()
{
const char* version = gl.GetString ? (const char*)gl.GetString(GL_VERSION) : nullptr;
int major = 0;
int minor = 0;
if (version) std::sscanf(version, "%d.%d", &major, &minor);
return major * VERSION_MINOR_DIGITS + minor;
}
// 00931050 Starts the engine and the game, logging the command line, then runs one frame at a time at 60 Hz until
// the window closes. "--localhost_match" logs to a timestamped file under localhost/ instead of log.txt.
// The theora log hook, COM, the Win32 window-move listener, Steam and the Windows power and timer settings are left
// out. A debug flag nothing sets (DAT_00c35e68) would skip the update and render.
int IsaacMain(int argc, uint8_t** argv)
{
platform.directories_load();
std::string logPath = platform.userDataDirectory + LOG_FILE;
for (int i = 0; i < argc; i++)
{
if (std::strcmp((const char*)argv[i], LOCALHOST_FLAG) != 0) continue;
logPath = platform.userDataDirectory + LOCALHOST_LOG + std::to_string(std::time(nullptr)) + ".txt";
break;
}
log_open(logPath);
platform.bindings_load();
platform.engine_init();
log_printf(LOG_INFO, "Command Line: \n");
for (int i = 0; i < argc; i++) log_printf(LOG_INFO, "\t%s\n", (const char*)argv[i]);
log_printf(LOG_INFO, "Game Version: %s \n", GAME_VERSION);
if (gl.ClampColor && (SDL_GL_ExtensionSupported(CLAMP_COLOR_EXTENSION) || gl_version_get() >= CLAMP_COLOR_VERSION))
gl.ClampColor(GL_CLAMP_VERTEX_COLOR, GL_FALSE);
FontKerningPair::IsaacStartup(argc, argv);
while (true)
{
g_manager->_framesPerSecond = platform.frame_begin();
KAGE::System::update();
Manager::Update(1);
g_manager->Render();
if (g_game) FUN_008657c0();
if (platform.isQuitRequested) break;
platform.frame_wait();
}
Isaac::Shutdown();
kage_shutdown();
return 0;
}
// The Linux entry point: "--resources <dir>" says where the imported game files are, then the game's own main runs.
int main(int argc, char** argv)
{
for (int i = 1; i + 1 < argc; i++)
if (std::strcmp(argv[i], RESOURCES_FLAG) == 0) dataDirectory = std::string(argv[i + 1]) + "/";
return IsaacMain(argc, (uint8_t**)argv);
}