#pragma once #pragma pattern_limit 523288 #include #include #include "db_files/AllChunks.pat" struct Version { u32 major; u32 minor; }; struct ChunkHeader { char name[12]; Version version; padding[4]; }; struct Chunk { ChunkHeader header; T data; }; struct FileHeader { u32 toc_offset; Version version; padding[256]; u32 deadbeef; }; struct TOCEntry { char name[while($[$] != 0x00)]; $ = $ + 12 - std::string::length(name); u32 offset; u32 size; u32 data_end = offset + size + 24; match (name) { ("AI_ROOM_DB"): Chunk ai_room_db @ offset; ("AIACS"): Chunk ai_acuity_sets @ offset; ("AICONVERSE"): Chunk ai_conversations @ offset; ("AICRTSZ"): Chunk ai_creature_sizes @ offset; ("AIGPTHVAR"): Chunk ai_gamesys_path_options @ offset; ("AIHearStat"): Chunk ai_hear_stat @ offset; ("AIPATHVAR"): Chunk ai_path_var @ offset; ("AISNDTWK"): Chunk ai_sound_tweaks @ offset; ("AMBIENT"): Chunk ambient @ offset; ("BASH"): Chunk bash @ offset; ("BRHEAD"): Chunk br_head @ offset; ("BRLIST"): Chunk br_list @ offset; ("BRVER"): Chunk brush_version @ offset; ("CELL_MOTION"): Chunk cell_motion @ offset; ("CELOBJVAR1"): Chunk celestial_object_var_1 @ offset; ("CELOBJVAR2"): Chunk celestial_object_var_2 @ offset; ("CELOBJVAR3"): Chunk celestial_object_var_3 @ offset; ("CLOUDOBJVAR"): Chunk cloud_object_var @ offset; ("DARKCOMBAT"): Chunk dark_combat @ offset; ("DARKMISS"): Chunk dark_miss @ offset; ("DISTOBJVAR"): Chunk distant_art_var @ offset; ("DRKSET"): Chunk dark_settings @ offset; ("ENVMAPVAR"): Chunk env_map_var @ offset; ("FAMILY"): Chunk family @ offset; ("FILE_TYPE"): Chunk file_type @ offset; ("FLOW_TEX"): Chunk flow_tex @ offset; ("FOGZONEVAR"): Chunk fog_zone_var @ offset; ("GameSysEAX"): Chunk gamesys_eax @ offset; ("HotRegions"): Chunk hot_regions @ offset; ("MAPISRC"): Chunk map_i_src @ offset; ("MissionEAX"): Chunk mission_eax @ offset; ("MultiBrush"): Chunk multibrush @ offset; ("OBJ_MAP"): Chunk obj_map @ offset; ("ObjVec"): Chunk obj_vec @ offset; ("Relations"): Chunk relations @ offset; ("RENDPARAMS"): Chunk rend_params @ offset; ("ROOM_DB"): Chunk room_db @ offset; ("ROOM_EAX"): Chunk room_eax @ offset; ("ScrModules"): Chunk script_modules @ offset; ("SKYMODE"): Chunk sky_mode @ offset; ("SKYOBJVAR"): Chunk sky_object_var @ offset; ("SONGPARAMS"): Chunk mision_song_params @ offset; ("STAROBJVAR"): Chunk star_object_var @ offset; ("TILIST"): Chunk ti_list @ offset; ("TXLIST"): Chunk texture_list @ offset; ("TXTPAT_DB"): Chunk texture_patch_database @ offset; ("WATERBANKS"): Chunk water_banks @ offset; ("WEATHERVAR"): Chunk weather_var @ offset; ("WREXT"): Chunk world_rep @ offset; (_): { if (std::string::starts_with(name, "P$")) { Chunk property_chunk @ offset [[name(name)]]; } else if (std::string::starts_with(name, "LD$")) { Chunk link_data @ offset [[name(name)]]; // std::print("LD: {}", name); } else if (std::string::starts_with(name, "L$")) { Chunk link_chunk @ offset [[name(name)]]; // std::print("L: {}", name); } else { std::print("Didn't load chunk: {}", name); } } } }; struct TableOfContents { u32 item_count; TOCEntry items[item_count]; }; FileHeader file_header @ 0x0; TableOfContents toc @ file_header.toc_offset;