Skip to content
trapexitPublic

About

An all in one 3DO disc tool

Resources

Stars

16 stars

Watchers

1 watching

Forks

Latest commit

 

History

91 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

3dt: 3DO Disc Tool

Features

  • list OperaFS content
  • list lowlevel disc/OperaFS details
  • list ROM tags
  • identify discs and ROMs
  • rename image based on identification
  • unpack disc and ROM OperaFS contents
  • pack directories into 3DO disc images
  • repack existing images and compact free space
  • convert raw disc images to .iso
  • supports reading CD-ROM Mode 1 images and 2048 byte/sector ISOs
  • sign and re-sign 3DO ISO images
  • verify 3DO signatures
  • encrypt or decrypt 3DO obfuscation payloads (primarily the boot file)

Build

Local builds require GNU Make and a C++17-compatible C/C++ toolchain:

make
make NDEBUG=1
make SANITIZE=1
make clean

Cross-release builds use an existing zig on PATH when available. Otherwise, make zig-venv installs the pinned ziglang==0.16.0 PyPI package in .venv; virtual-environment activation is not required. The fallback requires Python 3 with venv support and access to PyPI. Podman is no longer required.

make zig-venv
make release

make release cleans build/ and produces:

  • build/3dt_x86_64-linux-musl
  • build/3dt_aarch64-linux-musl
  • build/3dt_x86_64-windows-gnu.exe
  • build/3dt_aarch64-macos

Override PYTHON, ZIG_VENV, or ZIG on the Make command line to use a different Python interpreter, virtual-environment directory, or Zig executable.

GitHub releases

Commit the version bump and all build inputs, then run:

tools/release-to-github

The script builds all four binaries with make release, uses the version in src/version.hpp as the tag (for example, 1.6.0), pushes that tag, and uploads a GitHub draft release with generated notes and the four binaries. A missing local tag is fetched from the remote if it exists there, otherwise created as an annotated tag. Existing local or remote tags are accepted only if they point to the source commit; the script never overwrites tags.

Review the draft's notes and assets before publishing. To build, upload, and immediately publish as the latest release instead:

tools/release-to-github --publish

This requires an authenticated GitHub CLI (gh auth login) in addition to the release-build prerequisites above. REMOTE selects the Git remote whose push URL identifies the GitHub repository (default: origin).

Usage

--help

3dt: 3DO Disc Tool (v1.6.0)


Usage: 3dt [OPTIONS] SUBCOMMANDS

OPTIONS:
  -h,     --help              Print this help message and exit
          --help-all

SUBCOMMANDS:
  version                     print 3dt version
  list                        list disc content
  info                        prints lowlevel info on disc
  identify                    attempt to identify disc image
  unpack                      unpack disc image
  pack                        pack a directory into a 3DO disc image
  repack                      repack a 3DO disc image compacting avatars and empty space
  rename                      rename disc image as identified
  to-iso                      convert a .bin or similar disc image to .iso
  romtags                     print out image romtags
  verify                      verify RSA sigs
  sign                        sign 3DO ISO for retail system use
  sign-file                   sign file with 3DO or APP key
  decrypt-file                decrypt CD-DIPIR boot payload (`src/dipir/cdipir.c`)
  encrypt-file                encrypt CD-DIPIR boot payload (`src/dipir/cdipir.c`)

Use --help on individual subcommands to get specific subcommand options.

version

Print the 3dt version.

3dt version

list

A ls or dir style listing of the disc's contents.

$ 3dt list ./Escape\ from\ Monster\ Manor\ \(USA\).iso | head
Flags      Size         ID Type Filename
-r-         169 0x3977524c      AppStartup
drf        2048 0x076da54f *dir Attic Level 2
-r-        4219 0x3e9ea1e3      Attic Level 2/FloorPlan
-r-      153048 0x015deb07 loaf Attic Level 2/atticwalls.loaf
-r-      227400 0x2f06c2f1 loaf Attic Level 2/powerups.loaf
drf        2048 0x03afa069 *dir Attic Simple
-r-        4158 0x11bfb126      Attic Simple/FloorPlan
-r-      153048 0x0003d024 loaf Attic Simple/atticwalls.loaf
-r-      226532 0x1e3c48de loaf Attic Simple/powerups.loaf

You can choose from a few output formats:

list supports --format=default, --format=file-offsets, and --format=block-offsets. A second positional argument filters output to paths with that prefix.

$ 3dt list --format=block-offsets SHADOW\ -\ War\ of\ Succession\ \(USA\).iso  | head
Flags      Size         ID Type  RecOffset     Avatar Filename
-r-      185064 0x273d2a36 anim 0x00012b0b 0x000024de 30fbl.anim
-r-        1784 0x27fd1ae1 cel  0x00012b0b 0x00002539 3dologo.cel
-r-       66932 0x00902938 FRAM 0x00012b0b 0x0000253a ALVIN.FRAMES
-r-        1100 0x1b218626 AA   0x00012b0b 0x0000255b ALVIN.HEAD.AA
-r-       27566 0x147cc12b MOVE 0x00012b0b 0x0000255c ALVIN.MOVES
-r-       36408 0x148b2e00 out  0x00012b0b 0x0000256a ALVIN.sprites.anim.out
-r-        5984 0x2d1e6785 out  0x00012b0b 0x0000257c ALVIN.sprites.data.out
-r-       82317 0x172bde1c FRAM 0x00012b0b 0x0000257f ANTHONY.FRAMES
-r-        1040 0x09ef093d AA   0x00012b0b 0x000025a8 ANTHONY.HEAD.AA

info

Prints out the disc's "disc label", file count, and total data byte size. Use --format=human, --format=csv, or --format=cheader to change output.

$ 3dt info ./PO\'ed.iso
 - record_type: 0x01
 - volume_sync_bytes: 0x5A
 - volume_structure_version: 0x01
 - volume_flags: 0x00
 - volume_commentary:
 - volume_identifier: CD-ROM
 - volume_unique_identifier: 0x198EEB79
 - volume_block_size: 2048
 - volume_block_count: 204800
 - root_unique_identifier: 0x1F2377CF
 - root_directory_block_count: 2
 - root_directory_block_size: 2048
 - root_directory_last_avatar_index: 6
 - root_directory_avatar_list:
   - 39473
   - 39475
   - 58515
   - 87772
   - 117029
   - 146286
   - 175543
 - file_count: 398
 - total_data_size: 80414372

identify

The 3dt internal database includes a number of fields and metrics found on a 3DO image. The "unique" identifiers are not necessarily unique and as such the file count and total data size were used to help in uniquly identifying images. If you come across an unknown image (which isn't just random homebrew) please file a ticket with the details from info command. Use --format=human or --format=csv to change output.

$ 3dt identify ./PO\'ed.iso
./PO'ed (USA, Europe).bin:
 - volume_unique_identifier: 0x198EEB79
 - volume_block_count: 204800
 - root_unique_identifier: 0x1F2377CF
 - file_count: 398
 - total_data_size: 80414372
 - matches:
   - PO'ed (USA, Europe)

unpack

This will copy the files from the disc image to your local storage device. It will create a directory based on the file name with ".unpacked" appended unless the -o,--output option is used to change the directory it unpacks to. Use --format=human or --format=csv to change logging output. A layout.json file is written in the unpacked root by default; use --layout to choose another path. OperaFS names that cannot be represented portably on the host filesystem (including /, \, Windows-reserved characters, and non-ASCII byte strings) are extracted under deterministic __3dt_... aliases. layout.json records both the host alias and the original name bytes; pass that layout to pack to restore the original OperaFS names. Use --no-system to omit a case-insensitive top-level System entry and all of its descendants from extracted files, command output, and layout metadata. Use --no-metadata to omit the case-insensitive top-level special files Disc label, rom_tags, signatures, and layout.json from extracted files and command output, and to disable generated layout metadata. It cannot be combined with --layout; nested files with those names remain ordinary files. Use --no-executables to omit LaunchMe and other ARM AIF executables, identified from their directory-record type or validated file header, from extracted files, command output, and layout metadata. Use --only-assets for reconstruction exports; it is equivalent to combining --no-metadata, --no-system, and --no-executables.

$ 3dt unpack ./PO\'ed.iso
-r-         334 0x398d91a4 0x20202020 (    ) AppStartup
-r-      153688 0x1e2c6ba5 0x20202020 (    ) BannerScreen
-r-        5406 0x0367a749 0x64656d6f (demo) POed.demo0
-r-        5406 0x278e1e30 0x64656d6f (demo) POed.demo1
-r-        5406 0x291a85ff 0x64656d6f (demo) POed.demo2
-r-        5406 0x0d68b8b8 0x64656d6f (demo) POed.demo3
-r-        5406 0x0169672d 0x64656d6f (demo) POed.demo4
-r-        5406 0x14193b38 0x64656d6f (demo) POed.demo5
-r-        5406 0x0035f235 0x64656d6f (demo) POed.demo6
-r-        5394 0x13a19901 0x64656d6f (demo) POed.demo7
...

rename

If a match is found for the image it will rename the file based on the name in the internal database. Multiple inputs are supported. Use --take-first when an image has multiple matches and the first match should be used automatically.

$ 3dt rename ./POed.iso
./POed.iso: renamed to ./PO'ed (USA, Europe).iso

to-iso

This, like many other tools, will take a raw CDROM image such as a .bin file from a .bin/.cue set and create a .iso file. The output path is optional. Use --force to overwrite an existing output file.

$ 3dt to-iso ./PO\'ed\ \(USA\,\ Europe\).bin
./PO'ed (USA, Europe).iso: sector 205249 of 205249 written

$ 3dt identify PO\'ed\ \(USA\,\ Europe\).iso
PO'ed (USA, Europe).iso:
 - volume_unique_identifier: 0x198EEB79
 - volume_block_count: 204800
 - root_unique_identifier: 0x1F2377CF
 - file_count: 398
 - total_data_size: 80414372
 - matches:
   - PO'ed (USA, Europe)

romtags

Print rom tags Use --format=human or --format=csv to change output.

$ 3dt romtags Wolfenstein\ 3D\ \(USA\).iso
Wolfenstein 3D (USA).iso:
  - Offset:      1
    SubSysType:  0x0f
    Type:        0x0d (NEWKNEWNEWGNUBOOT)
    Version:     2
    Revision:    5
    Flags:       0
    TypeSpec:    0
    Size:        6448
  - Offset:      5
    SubSysType:  0x0f
    Type:        0x07 (OS)
    Version:     24
    Revision:    225
    Flags:       0
    TypeSpec:    0
    Size:        115520
  - Offset:      69
    SubSysType:  0x0f
    Type:        0x10 (MISCCODE)
    Version:     0
    Revision:    0
    Flags:       0
    TypeSpec:    0
    Size:        2908
  - Offset:      42713
    SubSysType:  0x0f
    Type:        0x02 (BLOCKS_ALWAYS)
    Version:     0
    Revision:    0
    Flags:       0
    TypeSpec:    0
    Size:        47
  - Offset:      42766
    SubSysType:  0x0f
    Type:        0x05 (SIGNATURE_BLOCK)
    Version:     0
    Revision:    0
    Flags:       0
    TypeSpec:    15
    Size:        57344

pack

Build a 3DO disc image from a source tree.

3dt pack /path/to/source --output game.iso

Packing ignores layout.json by default and signs the image for retail compatibility. Pass --layout /path/to/layout.json to reproduce its recorded filesystem layout; 3dt first writes that layout, then regenerates the ROMTags and signatures needed for retail compatibility within the recorded allocations. Pass --unsigned only when an unsigned image is explicitly required. For newly allocated layouts, System/Kernel/boot_code, os_code, and misc_code are placed in that order immediately after the ROM-tag block, before OperaFS directories and ordinary payloads. OperaFS performs ASCII case-insensitive filename lookup, so each directory must have unique child names under that comparison. pack rejects collisions such as LaunchMe with launchme, including file-versus-directory conflicts.

Common options:

  • --volume-label / --volume-commentary: set label metadata
  • --volume-unique-id / --root-unique-id: set identifiers
  • --dry-run: validate layout and allocations without writing the image
  • --mark: write a 3dt marker into the output image
  • --unsigned: pack without signing the image
  • --no-banner-romtag / --no-rsa-appsplash: disable RSA_APPSPLASH romtag generation
  • --billstuff-romtag: enable RSA_BILLSTUFF romtag generation (off by default, really has no impact but was set in all original titles)
  • --verbose: print the full packing, signing, and verification output (a one-line summary including the number of files and directories found is printed before packing starts otherwise)

By default, pack derives the volume unique identifier from the CRC32 of BannerScreen and the root unique identifier from the CRC32 of LaunchMe. If BannerScreen is not present, the volume unique identifier is generated randomly. Passing --volume-unique-id or --root-unique-id overrides the derived value; passing 0 explicitly selects a random identifier.

repack

Rebuild an image while compacting avatars and reclaiming free space.

3dt repack game.iso --output game-repacked.iso

When --output is omitted, repack writes to the input basename with a .iso extension. For example, 3dt repack game.bin writes game.iso. Repack supports multiple input images. --output requires exactly one input. Repack reads payloads directly from the source image, so OperaFS names that are not valid host filenames are preserved without using a temporary filesystem tree. Repack signs and verifies the compacted image by default. Use --unsigned for the legacy unsigned repack behavior. It also supports --mark, --no-banner-romtag / --no-rsa-appsplash, --billstuff-romtag, and --verbose (print the full packing/signing/verification output).

sign

Sign an existing ISO image for retail playback.

3dt sign game.iso --output game-signed.iso

--output requires exactly one input. Useful flags include --force for unusual source layouts, --mark, --no-banner-romtag / --no-rsa-appsplash, --billstuff-romtag, and --verbose (print the full signing/verification output).

verify

Validate signed images and report status.

3dt verify --format=csv game.iso

Output formats are human, csv, and json; add --quiet to print only per-image verification status. By default verify prints only per-image status; pass -v,--verbose for the full verification trace. Verification checks the required component and cross-application RSA signatures. It does not interpret historical nonzero block-digest tables.

sign-file

Sign, verify, or emit signatures for a file payload. Use --append to append a new signature trailer, --replace to replace the existing trailer, --write to update the input file, --signature-output to write signature bytes separately, and --key-name=app or --key-name=3do to choose the signing key.

3dt sign-file --verify boot_code
3dt sign-file --write --append --key-name app boot_code

decrypt-file

Decrypt CD-DIPIR boot payloads. This is mainly used for the boot file (system/kernel/boot_code, sometimes referred to as boot_file) when working with CD-DIPIR-protected images. In practice that is the primary real-world use. This maps to the Portfolio OS src/dipir/cdipir.c boot flow (DecryptBlock()). Re-run 3dt encrypt-file on the same file once edits are complete.

3dt decrypt-file boot_code

encrypt-file

Encrypt CD-DIPIR boot payloads using the same boot-file obfuscation transform. This is effectively the inverse operation of decrypt-file and is used when you need to restore the encrypted form (typically for system/kernel/boot_code). The inverse transform corresponds to Portfolio OS CD-DIPIR boot-file logic in src/dipir/cdipir.c.

3dt encrypt-file boot_code

Links

About

An all in one 3DO disc tool

Resources

Stars

16 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages