Skip to content

Getting Started

MegaMech edited this page Mar 14, 2024 · 7 revisions

Presuming a decomp has

What is Torch?

Torch was constructed from the ground up as a flexible asset extractor for use with any decomp. It extracts data on a per file basis from a given yaml. It supports decomp and ports allowing for flawless transition between the two. Torch has no asterisks regarding the progress of a decomp nor what tools are already in-place. Torch can replace the current asset extraction system one file at a time. Torch also allows for modding of assets.

  • Torch auto-generates some assets such as vtx and textures when it sees the relevant displaylist.

What does Torch not do?

  • It does not replace already existing decompilation tools.
  • It does not assist in defining code segments.
  • It does not provide suggestions as to what the data might be.
  • It does not assist with .text C code. Only assets.

The decomper still needs to analyze the data and decide what it is or might be. Then add an entry to the yaml file for extraction.

Torch Modes

Torch has three modes; code, binary, and header.

Code

Generates C code for use in decomps

Binary

Generates binary used in otr/o2r formats for use in ports.

Header

Generates headers.

Running Torch

./torch code baserom.z64 ./torch otr baserom.z64 ./torch binary baserom.z64 ./torch header baserom.z64

Optional commands: -v --verbose adds offsets and sizes as comments to the C output to help match files.

Basic Configuration

Place a config.yml in the root of the working directory. Explanation here

Extraction

Torch extracts data on a per file basis; one code file per yaml file. The yaml contains a list of assets and specifies how to extract them. For instance, a compressed segmented file containing many vertices, displaylists, textures, and other data arrays are exported as a C file using a Torch yaml file. Torch outputs textures as their one .inc.c files that are included in the main file. These resources including the final code file are neatly placed into a folder.

Torch outputs simple debugging information as comments containing sizes and offsets to help decompers match files.