Curation round 1: 66 boot-path functions rewritten in src/; the game links into a Linux executable

Six agents took over ANM2/AnimationState/LayerState, ItemConfig, EntityConfig, StringTable/Font/FormattedText/RichText,
OptionsConfig/ChallengeParams and ModManager/ModEntry functions (FormattedText::parse checked against a transliteration
of its assembly on 200,000 random inputs). 174 field rows and 32 names from the round are merged into db/.
source_tree.py: a struct or class src/*.h defines is no longer emitted in classes.h (class takeover) and gets no stubs;
data labels get stub definitions. build/isaac links (64-bit ELF) and stops at the first function not reconstructed:
IsaacMain. Boot path 64/615 functions curated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-11-19 22:13:25 -05:00
1 parent 8c31c98a81
commit 837aa06518
63 files changed
+10557 -12054

No files matched your search

+101
View File
@@ -0,0 +1,101 @@
#include "classes.h"
#include "msvc.h"
#include <cstring>
#include <string>
constexpr const char* INVALID_LANGUAGE = "StringTable::InvalidLanguage";
constexpr const char* INVALID_CATEGORY = "StringTable::InvalidCategory";
constexpr const char* INVALID_KEY = "StringTable::InvalidKey";
constexpr const char* UNTRANSLATED_STRING = "StringTable::UntranslatedString";
constexpr char CATEGORY_SEPARATOR = '/';
// Language id to its column in every string's translations.
using LanguageNode = MsvcTreeNode<int, int>;
// Lowercased category name to its strings.
using CategoryNode = MsvcTreeNode<char*, StringTableCategory>;
// Lowercased key to its translations, one per language column.
using StringNode = MsvcTreeNode<char*, char**>;
LAYOUT32(sizeof(LanguageNode) == 0x18 && sizeof(CategoryNode) == 0x28 && sizeof(StringNode) == 0x18);
static bool is_text_before(const char* text, const char* other)
{
return std::strcmp(text, other) < 0;
}
// A copy with ASCII capitals lowered, as the game matches names. No text reads as empty, where the game crashed.
static std::string text_lower(uint8_t* text)
{
std::string lower = text ? (char*)text : "";
for (char& character : lower)
if (character >= 'A' && character <= 'Z') character += 'a' - 'A';
return lower;
}
static void category_destroy(StringTableCategory& category)
{
FID_conflict__Tidy(&category._keys);
tree_destroy<StringNode>(category._strings);
}
// 00a26920 Empties the table: every category along with its name, the default category and every language.
void StringTable::clear()
{
auto categories = (CategoryNode*)_categories._head;
for (CategoryNode* node = categories->_left; node != categories; node = tree_next(node))
tracked_alloc(TRACKED_FREE, node->_key, 0);
tree_clear<CategoryNode>(_categories, category_destroy);
_defaultCategory = nullptr;
_language = 0;
tree_clear<LanguageNode>(_languages);
}
// 00a26a30 Translates "category/key", or a key of the default category, into the current language.
uint8_t* StringTable::translate(uint8_t* key)
{
auto lowerKey = (char*)path_join(key, nullptr, true, false);
char* separator = lowerKey ? std::strchr(lowerKey, CATEGORY_SEPARATOR) : nullptr;
auto category = (uint8_t*)_defaultCategory;
auto name = (uint8_t*)lowerKey;
uint8_t isMissing = false;
if (separator)
{
*separator = '\0';
category = (uint8_t*)lowerKey;
name = (uint8_t*)separator + 1;
}
uint8_t* text = get_string(category, _language, name, &isMissing);
tracked_alloc(TRACKED_FREE, lowerKey, 0);
return text;
}
// 00a26af0 A string by category and key, both matched lowercased, in a language. A miss names what was missing and
// sets outIsMissing. A language column equal to the language count reads past the translations in the game, so it is
// taken as an invalid language here.
uint8_t* StringTable::get_string(uint8_t* category, int language, uint8_t* key, uint8_t* outIsMissing)
{
*outIsMissing = true;
auto languageNode = tree_find<LanguageNode>(_languages, language);
if (languageNode->_isNil) return (uint8_t*)INVALID_LANGUAGE;
int column = languageNode->_value;
if (column < 0 || column >= (int)_languages._size) return (uint8_t*)INVALID_LANGUAGE;
std::string categoryName = text_lower(category);
auto categoryNode = tree_find<CategoryNode>(_categories, categoryName.data(), is_text_before);
if (categoryNode->_isNil) return (uint8_t*)INVALID_CATEGORY;
std::string keyName = text_lower(key);
auto stringNode = tree_find<StringNode>(categoryNode->_value._strings, keyName.data(), is_text_before);
if (stringNode->_isNil) return (uint8_t*)INVALID_KEY;
char* text = stringNode->_value[column];
if (!text) return (uint8_t*)UNTRANSLATED_STRING;
*outIsMissing = false;
return (uint8_t*)text;
}