Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
161 commits
Select commit Hold shift + click to select a range
461385c
Add OoT asset support: factories, tooling, and scene/room export
briaguya0 Mar 29, 2026
d713580
Add recovered POC/draft notes document
briaguya0 Mar 29, 2026
34b76c0
add .gitignores that were lost
briaguya0 Mar 29, 2026
3385cda
Add ROM identification, DMA table extraction, and manifests directory
briaguya0 Mar 29, 2026
5e70571
Move config.yml to soh/assets/yml/ and add scaffolding
briaguya0 Mar 29, 2026
b4f3506
Implement Yaz0 decompression and fix missing definitions
briaguya0 Mar 29, 2026
27cefa8
Fix segment 0x80 handling for OoT code-section assets
briaguya0 Mar 29, 2026
20e8dee
Fix crash on zero-size blobs (e.g. OoT LimbTable)
briaguya0 Mar 29, 2026
7ee15ea
Fix empty blob export, add test logging and compare tool
briaguya0 Mar 29, 2026
512df41
Add *.o2r and torch.hash.yml to gitignore
briaguya0 Mar 29, 2026
7ba1eb5
Optimize test_assets.sh: batch hashing and log torch output to file
briaguya0 Mar 29, 2026
e31b7cc
Replace test_assets.sh with Python version (60x faster)
briaguya0 Mar 29, 2026
4069ced
Add BUILD_OOT CMake option and stub OoTTextFactory
briaguya0 Mar 29, 2026
1a516be
Fix limb DList auto-discovery and naming (574 → 1 object failure)
briaguya0 Mar 29, 2026
cbb9328
Auto-create SkelLimbs 0-byte blob for skeleton limb tables
briaguya0 Mar 29, 2026
50ede2d
Fix MTX binary export to write raw int32 values
briaguya0 Mar 29, 2026
ccf13c6
Fix PatchVirtualAddr to prefer segment 0x80 for overlay textures
briaguya0 Mar 29, 2026
67bf3d1
Skip DList entries in scene/room XMLs during YAML conversion
briaguya0 Mar 29, 2026
525ec56
Skip all DList entries in room XML files during YAML conversion
briaguya0 Mar 29, 2026
a40e4f6
Add deferred alternate header processing for scenes
briaguya0 Mar 29, 2026
8a88bc6
Fix alternate header sub-asset naming and cutscene suffix
briaguya0 Mar 29, 2026
7cfbbfd
Fix sub-asset naming for scene alternate headers
briaguya0 Mar 29, 2026
4f13d32
Use neighbor-based size for pathway count inference
briaguya0 Mar 29, 2026
b0c8968
Create 0-byte ActorEntry companion files for SetActorList
briaguya0 Mar 29, 2026
80d3352
Add asset alias mechanism for Set_ DList duplicates
briaguya0 Mar 29, 2026
ee6afd7
Add command-aware cutscene size calculation
briaguya0 Mar 29, 2026
9b46d7e
Update cutscene plan with re-serialization details
briaguya0 Mar 29, 2026
59eb03f
Implement cutscene re-serialization with macro packing
briaguya0 Mar 29, 2026
15ec464
Fix actor cue rotY/rotZ packing in cutscene re-serialization
briaguya0 Mar 29, 2026
d893d54
Document remaining OoT asset work
briaguya0 Mar 29, 2026
70a3576
Fix cutscene command ID remapping (ROM IDs vs OTR output IDs)
briaguya0 Mar 30, 2026
bc51929
Revert incorrect command ID remapping, keep bounds checking
briaguya0 Mar 30, 2026
5499945
Skip unimplemented cutscene commands matching OTRExporter behavior
briaguya0 Mar 30, 2026
4145d78
Document spot04 pathway edge case in scene factory
briaguya0 Mar 30, 2026
7dd60dd
Add comprehensive ZPath bug analysis for spot04 pathway edge case
briaguya0 Mar 30, 2026
b6e64a8
Fix pathway count for alternate headers without YAML declarations
briaguya0 Mar 30, 2026
dbb3666
Fix CRC double byte-swap in version file
briaguya0 Mar 30, 2026
9414e26
Add plan for 135 missing scene sub-assets
briaguya0 Mar 30, 2026
2657542
Add OOT:CUTSCENE factory for standalone YAML-declared cutscenes
briaguya0 Mar 30, 2026
462bcde
Remove duplicated cutscene code from SetCutscenes handler
briaguya0 Mar 30, 2026
d77adf8
Add OOT:PATH factory for standalone YAML-declared paths
briaguya0 Mar 30, 2026
b90c58e
Extract SerializePathways to eliminate pathway code duplication
briaguya0 Mar 30, 2026
dd5265a
Create background companion files for mesh type 1 rooms
briaguya0 Mar 30, 2026
e13234d
Extract CreateBackgroundCompanion to deduplicate background code
briaguya0 Mar 30, 2026
5cad83d
Document scene DList investigation — YAML approach doesn't work
briaguya0 Mar 30, 2026
f64e691
Update scene DList plan with conflict analysis
briaguya0 Mar 30, 2026
ebd634d
Fix 18 missing scene-level DLists via YAML entry ordering
briaguya0 Mar 30, 2026
ab8fedb
Keep all DLists from room files, rely on YAML ordering
briaguya0 Mar 30, 2026
1d3bb23
Add verified OoT audio factory plan (598 assets)
briaguya0 Mar 30, 2026
349fb6c
Break down audio plan into incremental verifiable steps
briaguya0 Mar 30, 2026
7fb4799
Add audio metadata extraction to zapd_to_torch.py (Step 0)
briaguya0 Mar 30, 2026
db03b5d
Add OOT:AUDIO factory skeleton (Step 1)
briaguya0 Mar 30, 2026
376927b
Extract sequences from audio segment (Steps 2+3)
briaguya0 Mar 30, 2026
8f94549
Fix aliased sequences (size==0 means ptr is index to another seq)
briaguya0 Mar 30, 2026
0320fdd
Add detailed audio sample extraction plan with correct patterns
briaguya0 Mar 30, 2026
b153d2e
Extract 449 audio samples using safe BinaryReader pattern (Step 4)
briaguya0 Mar 30, 2026
bda2b48
Add audio sample dedup/naming analysis
briaguya0 Mar 30, 2026
99a2b20
Fix cross-bank audio sample naming to match ZAPDTR behavior
briaguya0 Mar 30, 2026
c5694cc
Add audio font extraction plan (Step 5)
briaguya0 Mar 30, 2026
ca2c5ec
Extract 38 audio fonts (OSFT companion files, Step 5)
briaguya0 Mar 30, 2026
9d3a285
Fix last 2 font failures via drum→instrument stack residue mapping
briaguya0 Mar 30, 2026
2e86358
Implement OoTTextFactory for message_data_static assets
briaguya0 Mar 30, 2026
4886150
Add portVersion analysis documenting Shipwright lifecycle
briaguya0 Mar 30, 2026
f76a38f
Fix portVersion: add endianness byte and pass version to Torch
briaguya0 Mar 30, 2026
7ace490
Document VTX YAML dependency on reference O2R
briaguya0 Mar 30, 2026
969d03a
Remove reference O2R dependency from YAML generation
briaguya0 Mar 31, 2026
c859a3f
Add VTX directory README with per-version status table
briaguya0 Mar 31, 2026
44a2335
Fix Shipwright build reference: b48e5f7 not 8c4d473
briaguya0 Mar 31, 2026
5833d66
Add VTX JSON files for all 11 unique ROM configurations
briaguya0 Mar 31, 2026
9a5a4ac
Reorganize O2R directory with reference/ subdirectory
briaguya0 Mar 31, 2026
5586487
Add manifests for all 14 unique ROM configurations
briaguya0 Mar 31, 2026
a9704be
Add F3DEX2_OoT GBI minor version for OoT-specific DList hacks
briaguya0 Mar 31, 2026
5ba22b2
Add shared code isolation plan and GBI minor plan docs
briaguya0 Mar 31, 2026
71c42c0
Isolate OoT-specific changes from shared Torch code
briaguya0 Mar 31, 2026
a76ab7c
Add performance profiling findings and isolation pass 2 plan
briaguya0 Mar 31, 2026
3cbdfdb
Update performance findings with perf profiler results
briaguya0 Mar 31, 2026
914a4c4
Add AssetLookup plan to eliminate YAML::Node from lookup infrastructure
briaguya0 Mar 31, 2026
073ddfb
Add YAML enrichment plan for eliminating auto-discovery overhead
briaguya0 Apr 1, 2026
9f9dba1
Add YAML enrichment tooling: catalog_undeclared + zapd_to_torch injec…
briaguya0 Apr 1, 2026
b8ef560
Document enrichment results: 4s savings, scene enrichment blocked
briaguya0 Apr 1, 2026
f7fd406
Add plan: full YAML enrichment to remove auto-discovery from Torch
briaguya0 Apr 1, 2026
cba4fef
Update plan: make AddAsset throw to surface enrichment gaps
briaguya0 Apr 1, 2026
591de6b
PoC: YAML enrichment reduces O2R generation from 35s to 8s
briaguya0 Apr 4, 2026
dbc7316
Add plan to fix 3,099 missing Set_ scene variant assets
briaguya0 Apr 4, 2026
d44ea29
Fix 3,068 missing Set_ assets: pre-declare rooms, parse for aliases
briaguya0 Apr 4, 2026
4e95417
Fix Set_ assets: let OOT:ROOM/OOT:SCENE through AddAsset
briaguya0 Apr 4, 2026
b0381ea
Eliminate BLOB auto-discovery: extract limb table offsets from skeletons
briaguya0 Apr 4, 2026
28bc461
WIP: ROM-based extraction for Set_ headers and MTX (not yet integrated)
briaguya0 Apr 4, 2026
b88322b
Add plan: consolidate supplemental.json for YAML generation
briaguya0 Apr 4, 2026
5bf56e4
Add generate_supplemental.py: single JSON for YAML enrichment
briaguya0 Apr 4, 2026
c5df76b
Fix BLOB resolution in supplemental pipeline
briaguya0 Apr 4, 2026
bb88cce
Eliminate MTX auto-discovery: recursive DList walking in ROM
briaguya0 Apr 4, 2026
eaba1e3
Add recursive DList MTX extraction, revert Set_ pre-declaration
briaguya0 Apr 4, 2026
c95fae2
Document Set_ alternate headers: why deferred, proposed solution
briaguya0 Apr 4, 2026
bff0f2f
Eliminate Set_ auto-discovery: separate YAML files with per-file segm…
briaguya0 Apr 4, 2026
86e1563
Zero AddAsset: eliminate last VTX, fix scene Set_ directory and exter…
briaguya0 Apr 4, 2026
ec71880
Add simplification plan: audit of all OoT Torch changes
briaguya0 Apr 5, 2026
ae51ed7
Split OoTSceneFactory: extract Path, Cutscene, shared utils
briaguya0 Apr 5, 2026
588562f
Split OoTSkeletonFactory: extract Limb factory and shared types
briaguya0 Apr 5, 2026
95e12ab
Split OoTAnimationFactory: extract Curve and Player animation factories
briaguya0 Apr 5, 2026
faac170
Create OoTMtxFactory with OOT:MTX type, revert shared MtxFactory
briaguya0 Apr 5, 2026
daeea34
Remove dead AddAsset auto-discovery from OoT factories
briaguya0 Apr 5, 2026
619c94f
Simplify DeferredVtx::FlushDeferred: remove AddAsset, use GetNodeByAddr
briaguya0 Apr 5, 2026
cab16ec
Make AddAsset throw for OoT to catch enrichment regressions
briaguya0 Apr 5, 2026
9cfed7e
Small cleanups: extract helpers in Text, Array, Collision factories
briaguya0 Apr 5, 2026
86964d9
Extract AliasManager from Companion
briaguya0 Apr 5, 2026
4f2e897
Extract ProcessFile setup into named methods
briaguya0 Apr 5, 2026
540e3a6
Clean up PatchVirtualAddr and GetNodeByAddr
briaguya0 Apr 5, 2026
740b462
Add primary_virtual_segment to OoT config
briaguya0 Apr 5, 2026
d6e1be1
Add PORT_VERSION_ENDIANNESS compile flag for portVersion endianness byte
briaguya0 Apr 5, 2026
b4dd082
Move ParseNode back to original position to reduce diff noise
briaguya0 Apr 5, 2026
15c7676
Make empty blob behavior YAML-driven instead of implicit
briaguya0 Apr 5, 2026
8f06c36
Document BSWAP32 CRC investigation for Cartridge.cpp
briaguya0 Apr 5, 2026
92d3bef
Collapse duplicate YAZ0 AutoDecode case into shared fallthrough
briaguya0 Apr 5, 2026
de56cca
Clean up TranslateAddr to use IS_VIRTUAL_SEGMENT macro
briaguya0 Apr 5, 2026
aeee732
Move shared skeleton helpers from OoTSkeletonFactory to OoTSkeletonTy…
briaguya0 Apr 5, 2026
4a23d48
Move OoTSceneUtils helper implementations to .cpp file
briaguya0 Apr 5, 2026
d5fe8d4
Clean up OoTSceneFactory: move helpers to private methods, extract Co…
briaguya0 Apr 5, 2026
a7568fe
Extract SceneCommandWriter from OoTSceneFactory
briaguya0 Apr 5, 2026
100c00a
Clean up OoTSceneFactory deferred alt header block and command writer
briaguya0 Apr 5, 2026
dc048d2
Remove test scaffolding and coverage option from CMakeLists
briaguya0 Apr 5, 2026
9b471fb
Clean up OoTAnimationFactory: remove debug logging, reorder reads
briaguya0 Apr 5, 2026
ca79b3b
Replace per-read BinaryReader helpers with SafeAudioBankReader class
briaguya0 Apr 5, 2026
ba86a7c
Clean up OoTAudioFactory: extract methods, move types to header
briaguya0 Apr 6, 2026
09876bb
Refactor OoTAudioFactory sequence extraction
briaguya0 Apr 6, 2026
3d4a888
Extract sample discovery and writing into ExtractSamples method
briaguya0 Apr 6, 2026
d58ef42
Extract font writing into ExtractFonts method
briaguya0 Apr 6, 2026
dfb2648
Extract ParseSample/ParseSFESample methods with AudioParseContext
briaguya0 Apr 6, 2026
e4c5678
Add Size() to SafeAudioBankReader, extract ParseSampleNames
briaguya0 Apr 6, 2026
082bd87
Add ReadU8 to SafeAudioBankReader, remove audioBankData from ExtractF…
briaguya0 Apr 6, 2026
5bee712
Make SafeAudioBankReader own its data, extract LoadAudioBank
briaguya0 Apr 6, 2026
1473fa9
Split OoTAudioFactory into separate writer files
briaguya0 Apr 6, 2026
f64e604
Extract DiscoverSamples and WriteCompanionFiles in AudioSampleWriter
briaguya0 Apr 6, 2026
1e832db
Extract ParseDrums, ParseSFX, ParseInstruments from AudioFontWriter
briaguya0 Apr 6, 2026
008ab46
Encapsulate font stack residue in FontResidue class
briaguya0 Apr 6, 2026
235c481
Extract WriteDrums, WriteInstruments, WriteSFXEntries from AudioFontW…
briaguya0 Apr 6, 2026
d6c2081
Introduce FontWriteContext and extract WriteFontCompanion
briaguya0 Apr 6, 2026
73426c4
Clean up SerializeCutscene first pass readability
briaguya0 Apr 6, 2026
c2ae984
Introduce CutsceneSerializer class, extract Write method
briaguya0 Apr 6, 2026
34b010b
Clean up CutsceneSerializer Write method readability
briaguya0 Apr 6, 2026
831ce3e
Add end marker comment, update checklist
briaguya0 Apr 6, 2026
65b26c5
Clean up OoTLimbFactory: extract GetLimbDataSize, remove dead params
briaguya0 Apr 6, 2026
b98740c
Extract per-type limb parsers from OoTLimbFactory
briaguya0 Apr 7, 2026
a21da27
Extract skin limb parsing helpers from OoTLimbFactory
briaguya0 Apr 7, 2026
c34d5ee
Clean up OoTPathFactory readability
briaguya0 Apr 7, 2026
22115a8
Clean up OoTTextFactory readability
briaguya0 Apr 7, 2026
a27bf9d
Add missing #ifdef OOT_SUPPORT guards
briaguya0 Apr 7, 2026
538b02f
Add DisplayListFactory cleanup plan and update checklist
briaguya0 Apr 7, 2026
06969df
Update checklist: docs removal note
briaguya0 Apr 7, 2026
912a2e6
Move RemapSegmentedAddr to OoTDListHelpers
briaguya0 Apr 7, 2026
619a575
Move OoT SearchVtx to OoTDListHelpers
briaguya0 Apr 7, 2026
d04263b
Move gSunDL VTX override to OoTDListHelpers
briaguya0 Apr 7, 2026
8d25085
Move OoT G_VTX export handling to OoTDListHelpers
briaguya0 Apr 7, 2026
c1aa3c5
Move OoT G_DL export handling to OoTDListHelpers
briaguya0 Apr 7, 2026
a7acc65
Move OoT G_SETTIMG and gSunDL texture fixups to OoTDListHelpers
briaguya0 Apr 7, 2026
38f3496
Move OoT G_MTX export handling to OoTDListHelpers
briaguya0 Apr 7, 2026
13ba29b
Move OoT opcode fixups to OoTDListHelpers
briaguya0 Apr 7, 2026
75d07df
Move OoT parse handlers to OoTDListHelpers
briaguya0 Apr 7, 2026
5d258ce
Minimize DisplayListFactory diff by not indenting OoT wrapper blocks
briaguya0 Apr 7, 2026
47d7052
Refactor OoT DList helpers to method-level replacements
briaguya0 Apr 7, 2026
de68e4b
Remove docs and soh tooling/data from Torch-only branch
briaguya0 Apr 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ option(BUILD_PM64 "Build with Paper Mario support" ON)
option(BUILD_FZERO "Build with F-Zero X support" ON)
option(BUILD_MARIO_ARTIST "Build with Mario Artist support" ON)
option(BUILD_NAUDIO "Build with NAudio support" ON)
option(BUILD_OOT "Build with Ocarina of Time support" ON)
option(PORT_VERSION_ENDIANNESS "Include endianness byte in portVersion file" OFF)

if(EMSCRIPTEN)
set(BUILD_SM64 OFF) # TODO: This is broken for some reason
Expand Down Expand Up @@ -70,7 +72,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
file(GLOB_RECURSE CXX_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/**/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/lib/strhash64/*.cpp)
file(GLOB C_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.c ${CMAKE_CURRENT_SOURCE_DIR}/src/**/*.c ${CMAKE_CURRENT_SOURCE_DIR}/lib/libmio0/*.c ${CMAKE_CURRENT_SOURCE_DIR}/lib/libyay0/*.c)
file(GLOB C_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.c ${CMAKE_CURRENT_SOURCE_DIR}/src/**/*.c ${CMAKE_CURRENT_SOURCE_DIR}/lib/libmio0/*.c ${CMAKE_CURRENT_SOURCE_DIR}/lib/libyay0/*.c ${CMAKE_CURRENT_SOURCE_DIR}/lib/libyaz0/*.c)
set(SRC_DIR ${CXX_FILES} ${C_FILES} ${LGFXD_FILES})

if(BUILD_SM64)
Expand Down Expand Up @@ -115,6 +117,16 @@ else()
list(FILTER SRC_DIR EXCLUDE REGEX "${CMAKE_CURRENT_SOURCE_DIR}/src/factories/naudio/*")
endif()

if(PORT_VERSION_ENDIANNESS)
add_definitions(-DPORT_VERSION_ENDIANNESS)
endif()

if(BUILD_OOT)
add_definitions(-DOOT_SUPPORT)
else()
list(FILTER SRC_DIR EXCLUDE REGEX "${CMAKE_CURRENT_SOURCE_DIR}/src/factories/oot/*")
endif()

if(ENABLE_ASAN)
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
Expand Down
57 changes: 57 additions & 0 deletions lib/libyaz0/yaz0.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#include "yaz0.h"
#include "libmio0/utils.h"
#include <stdlib.h>
#include <string.h>

uint8_t* yaz0_decode(const uint8_t* in, uint32_t* out_size) {
if (strncmp((const char*)in, "Yaz0", 4) != 0) {
return NULL;
}

uint32_t decompressed_size = read_u32_be(in + 4);
uint8_t* out = malloc(decompressed_size);
if (!out) {
return NULL;
}

uint32_t src = YAZ0_HEADER_LENGTH;
uint32_t dst = 0;
uint8_t group_head = 0;
int bits_left = 0;

while (dst < decompressed_size) {
if (bits_left == 0) {
group_head = in[src++];
bits_left = 8;
}

if (group_head & 0x80) {
/* literal byte */
out[dst++] = in[src++];
} else {
/* back-reference */
uint8_t b1 = in[src++];
uint8_t b2 = in[src++];

uint32_t dist = ((b1 & 0x0F) << 8) | b2;
uint32_t copy_src = dst - (dist + 1);
uint32_t count;

if (b1 >> 4) {
count = (b1 >> 4) + 2;
} else {
count = in[src++] + 0x12;
}

for (uint32_t i = 0; i < count; i++) {
out[dst++] = out[copy_src + i];
}
}

group_head <<= 1;
bits_left--;
}

*out_size = decompressed_size;
return out;
}
7 changes: 7 additions & 0 deletions lib/libyaz0/yaz0.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <stdint.h>

#define YAZ0_HEADER_LENGTH 16

extern uint8_t* yaz0_decode(const uint8_t* in, uint32_t* out_size);
23 changes: 23 additions & 0 deletions src/AliasManager.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "AliasManager.h"
#include "utils/TorchUtils.h"

static AliasManager sAliasManagerInstance;
AliasManager* AliasManager::Instance = &sAliasManagerInstance;

void AliasManager::Register(const std::string& primaryPath, const std::string& aliasPath) {
mAliases[primaryPath].push_back(aliasPath);
}

void AliasManager::WriteAliases(const std::string& primaryPath, BinaryWrapper* wrapper,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a quick question about this system, is this a way for one file's data to be written to multiple locations in the output binary, and if so what is the use case for it?

const std::vector<char>& data) {
if (!Torch::contains(mAliases, primaryPath)) return;

for (auto& alias : mAliases[primaryPath]) {
wrapper->AddFile(alias, data);
}
mAliases.erase(primaryPath);
}

void AliasManager::Clear() {
mAliases.clear();
}
19 changes: 19 additions & 0 deletions src/AliasManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

#include <string>
#include <vector>
#include <unordered_map>
#include "archive/BinaryWrapper.h"

class AliasManager {
public:
static AliasManager* Instance;

void Register(const std::string& primaryPath, const std::string& aliasPath);
void WriteAliases(const std::string& primaryPath, BinaryWrapper* wrapper,
const std::vector<char>& data);
void Clear();

private:
std::unordered_map<std::string, std::vector<std::string>> mAliases;
};
Loading