Files
isaac-port/src/data.h
T
shweetandClaude Opus 5.5 d6e1ca7c6c data.h: resource_path (lowercased, as the game normalizes); .anm2 files are Anm2Ed JSON documents
The import tool now writes every .anm2 as Anm2Ed's JSON document under its own name (anm2ed convert --format json),
as isaac-classic does; other XML keeps the generic {tag, attrs, children, text} mapping.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 22:31:16 -05:00

30 lines
991 B
C++

#pragma once
#include "simdjson.h"
#include <string>
#include <string_view>
// A game document the import tool converted from XML (items.xml, entities2.xml ...) into resources/<path>.json.
// (.anm2 files are Anm2Ed's own JSON documents under their own names instead.)
// Each element is {"tag", "attrs", "children", "text"}, with every attribute value kept as the string the XML held,
// so loaders read it the way the game read its rapidxml nodes.
struct Data
{
simdjson::dom::parser parser;
simdjson::dom::element root;
bool isLoaded = false;
};
using DataNode = simdjson::dom::element;
void data_load(Data& data, std::string_view path);
std::string data_path(std::string_view path);
std::string resource_path(std::string_view path);
std::string_view node_tag(DataNode node);
std::string_view node_attr(DataNode node, std::string_view name);
std::string_view node_text(DataNode node);
simdjson::dom::array node_children(DataNode node);
extern std::string dataDirectory;