Files
SabreTools.Serialization/SabreTools.Data.Models
Dimensional 49aa6895b6 Dolphin lib (#85)
* Add GCZ, WIA/RVZ, and NintendoDisc (GameCube/Wii) format support

Port of DolphinIsoLib into SabreTools.Serialization architecture:
- Data.Models: GCZ/, WIA/, NintendoDisc/ model subdirectories (15 files)
- Serialization.Readers: GCZ, WIA, NintendoDisc readers
- Serialization.Writers: GCZ, WIA writers (structural metadata; full round-trip TODO)
- Wrappers: NintendoDisc, GCZ, WIA wrappers with Encryption partial class
- Wrappers: WiaRvzCompressionHelper (BZip2/LZMA/LZMA2/Zstd, net462+ guarded)
- WrapperType + WrapperFactory: GCZ, WIA, NintendoDisc entries added

GetInnerWrapper() decompression and NintendoDisc.Extraction FST extraction
are stubbed with TODO comments pending full implementation.

* Implement GetInnerWrapper for GCZ and WIA, full NintendoDisc extraction

* Add GCZ/WIA/RVZ write pipeline and Nintendo disc compression helpers

* Add WIA/RVZ table decompression, NintendoDisc/GCZ printing, NintendoDisc detection for .iso files

* Fix NintendoDisc header layout, GC magic, and add embedded disc header to WIA/GCZ printing

- Fix GCMagicWord: 0xC23D3C1F -> 0xC2339F3D (confirmed from Dolphin DiscUtils.h)
- Fix disc header field layout to match Dolphin's confirmed offsets:
  MakerCode is bytes 4-5 of the 6-char GameId (no separate field at 0x006),
  DiscNumber at 0x006, DiscVersion at 0x007, unused region is 14 bytes (0x00A-0x017)
- Update NintendoDisc reader: derive MakerCode from GameId[4..5], fix skip count
- Add ParseDiscHeaderOnly() to reader for partial (short) stream parsing
- Guard DisableHash/DisableEnc reads at the 0x080 boundary for 128-byte embedded headers
- Guard DOL/FST skip for streams shorter than full 0x440 boot block
- Fix WrapperFactory: NintendoDisc magic detection now precedes .iso -> ISO9660 fallback
- Add GameId-prefix heuristic in WrapperFactory for GC discs lacking magic word
- Add GameId-prefix platform fallback in reader for GC discs without GCMagicWord
- Add DiscHeader property to WIA wrapper (parsed from Header2.DiscHeader bytes)
- Add DiscHeader property to GCZ wrapper (decompresses first block only)
- Add ReadDiscHeader() helper to GCZ for lightweight first-block decompression
- Print embedded disc header (Game ID, Maker, Disc/Rev, Title) in WIA.Printing.cs and GCZ.Printing.cs

* Fix Wii partition extraction: correct IV, FST size shift, partition naming

- Block decryption: IV is at raw block offset 0x3D0 (still-encrypted),
  matching Dolphin/DolphinIsoLib WiiPartitionDecryptor.DecryptBlock exactly.
- FST size field at boot.bin 0x428 is also stored >>2 on Wii; apply <<2
  to get true byte size.
- Partition folder naming now matches DolphinIsoLib WiiDiscExtractor exactly:
  type 0->GM+n, 1->UP+n, 2->CH+n, printable ASCII unknown->raw 4-char string,
  non-printable->P{index}. SSBB VC channels extract as HA8E, HA9E, etc.
- ExtractionTool peek buffer increased from 16 to 32 bytes.

Verified: SSBB GM0 extracts 5524 files, boot.bin/fst.bin byte-identical
to Dolphin reference extraction.

* Fix FST extraction: create zero-byte files instead of skipping them

Files with fileSize=0 in the FST were silently skipped. Now they are
created as empty files, matching Dolphin/DolphinIsoLib behavior.

Verified: SSBB now extracts 5958 files with 0 missing, 0 extra,
0 size mismatches, and 0 hash mismatches vs DolphinIsoLib reference.

* Add GCZ/WIA/RVZ virtual stream extraction via NintendoDisc wrapper

* Address PR #85 review comments (Copilot + mnadareski)

* Address PR #85 review comments

* Replace custom endian helpers and SHA1 with SabreTools.IO equivalents

* Update GCZ.Printing.cs

* Update NintendoDisc.Printing.cs

* Update WIA.Printing.cs

* Add WIA/RVZ Wii partition crypto round-trip support

- Add AesCbc internal helper (BouncyCastle AES-CBC encrypt/decrypt)
- Add NintendoDisc.CommonKeyProvider hook for injectable test keys
- Fix sha1.Terminate() missing in all three ComputeSha1 helpers in WIA.cs
- Fix Wii partition dataOff alignment to 0x8000 boundary
- Add WIA.EncryptWiiGroup (internal) for re-encrypting plaintext groups
- Add WIA.DumpIso to WIA.Writing.cs (WIA/RVZ -> flat ISO conversion)
- Add WiaVirtualStream on-demand group decompression
- Add _preDecryptedReader bypass on NintendoDisc for WIA extraction path
- Add WIATests.cs with Wii crypto round-trip test using synthetic data
- Move DumpIso from WIA.Extraction.cs to WIA.Writing.cs
- Bump DumpIso read buffer from 1 MiB to 2 MiB (aligns to WIA chunk size)
- Add InternalsVisibleTo SabreTools.Wrappers.Test in csproj

* Remove hardcoded Wii common keys from NintendoDisc.Encryption

- Delete the embedded WiiCommonKeyRetail and WiiCommonKeyKorean byte
  arrays from NintendoDisc.Encryption.cs.
- Make CommonKeyProvider public so any caller (not just tests) can
  inject keys; DecryptTitleKey now returns null when no key is
  available for the requested index rather than falling back to
  hardcoded values.
- Add NintendoDiscEncryptionTests.cs:
    - Argument guard and no-provider tests for DecryptTitleKey.
    - Fake-key round-trip test (encrypt then decrypt with injected key).
    - Integration test that reads TestData/NintendoDisc/keys.json,
      verifies each key against hardcoded SHA256 constants, and skips
      silently if the file is absent or the keys do not match.
    - LoadKeyProvider helper (named JSON format, index-keyed).
- Add [Collection(NintendoDisc)] to both NintendoDiscEncryptionTests
  and WIATests to prevent parallel access to the static
  CommonKeyProvider from racing between test classes.
- Add TestData/NintendoDisc/keys.json.example documenting the
  expected key file format.
- Add Newtonsoft.Json reference to SabreTools.Wrappers.Test.csproj.

* Didn't actually commit the changes. My bad. Fixed.

* Edited a comment

* Added in XUnit outputs that show up in Test Viewer in VS

---------

Co-authored-by: Matt Nadareski <mnadareski@outlook.com>
2026-05-12 10:41:32 -04:00
..
2026-03-24 19:17:25 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-05-12 10:41:32 -04:00
2026-04-25 21:45:53 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-04-06 18:51:09 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-05-12 10:41:32 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-05-12 10:41:32 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-04-18 21:32:37 -04:00
2026-04-19 09:04:25 -04:00
2026-04-19 09:04:25 -04:00
2026-04-19 09:33:55 -04:00
2026-03-21 16:26:56 -04:00
2026-03-21 16:26:56 -04:00
2026-04-02 02:23:02 -04:00
2026-03-21 16:26:56 -04:00
2026-04-14 22:56:09 -04:00
2026-03-21 16:26:56 -04:00

SabreTools.Data.Models

This library comprises of models that represent either directly serializable or representative structures for all SabreTools projects. The majority of models will have deserializers and wrappers, with some also having both regular and cross-model serializers.

Namespaces

Below is a list of all existing namespaces with the SabreTools.Data.Models prefix removed, along with a brief description of the contained models.

Namespace Description
AACS AACS media key block
AdvancedInstaller Caphyon Advanced Installer SFX
ArchiveDotOrg archive.org metadata files
ASN1 ASN.1 type/length/value
Atari7800 Atari 7800 carts
AtariLynx Atari Lynx carts
AttractMode AttractMode metadata files
BDPlus BD+ SVM
BFPK BFPK custom archive format
Bitmap Bitmap graphics
BSP Valve BSP and VBSP level file formats
BZip2 BZip2 archive
CDROM ISO 10149 / ECMA-130 CD-ROM images
CFB Microsoft Compound File Binary (CFB) file format
Charts Rhythm game song and career formats
CHD MAME Compressed Hunks of Data (CHD)
CICM Canary Islands Computer Museum (CICM) sidecar
ClrMamePro ClrMamePro (CMP) metadata files
COFF Common Object File Format (COFF)
CueSheets Cuesheet
Delphi Delphi-specific PE blocks
DosCenter DosCenter (DC) metadata files
DVD Various DVD file formats
EverdriveSMDB Everdrive SmokeMonster Database (SMDB) metadata files
GameHeader GameHeader cart information metadata files
GCF Half-Life Game Cache File (GCF)
GZIP gzip archive
Hashfile Individual hash metadata file formats
InstallShieldArchiveV3 InstallShield archive V3 (.z)
InstallShieldCabinet InstallShield cabinet (IS-CAB)
InstallShieldExecutable InstallShield Executable SFX
IRD PS3 IRD encryption files
ISO9660 ISO9660 / EMCA-119 file system
LDSCRYPT LDSCRYPT encrypted files
LinearExecutable Linear Executable (LE/LX)
Listrom MAME Listrom metadata files
Listxml MAME ListXML metadata files
Logiqx Logiqx XML-based metadata files
LZ LZ compressed file variants
Metadata Common unified metadata format
MicrosoftCabinet Microsoft cabinet (MS-CAB)
MoPaQ MoPaQ (MPQ) game installer archive
MSDOS MS-DOS executable and stub
N3DS Nintendo 3DS carts
NCF Half-Life No Cache File
NES Nintendo Entertainment System (NES) and Famicom (FC) carts
NewExecutable New Executable (NE)
Nitro Nintendo DS carts
NoIntroDatabase No-Intro Database Exports
OfflineList OfflineList XML-based metadata files
OLE Object Linking and Embedding (OLE)
OpenMSX OpenMSX XML-based metadata files
PAK Half-Life Package File
PFF PFF archive
PIC Disc Information and Emergency Brake data
PKZIP PKWARE ZIP archive and derivatives
PlayJ PlayJ propietary music format
PlayStation3 Sony PlayStation 3 (PS3) on-disc formats
PlayStation4 Sony PlayStation 4 (PS4) on-disc formats
PortableExecutable Portable Executable (PE)
Quantum Quantum archive
RAR RAR archive
RealArcade RealArcade installer formats
RomCenter RomCenter INI-based metadata files
SafeDisc SafeDisc encrypted file entry
SecuROM SecuROM protection block formats
SeparatedValue Separated-value (CSV, SSV, TSV) metadata files
SevenZip 7-zip archive
SGA SGA game archive
SNES Super Nintendo Entertainment System (SNES) and Super Famicom (SFC) carts
SoftwareList MAME software list metadata files
SpoonInstaller Spoon Installer SFX
StarForce StarForce File System (SFFS)
TAR Tape Archive (TAR)
VDF Steam SIS files
VPK Valve Package File
WAD3 Half-Life Texture Package File
WiseInstaller Wise script- and section-based installers
Xbox Xbox and Xbox 360 file formats
XboxExecutable Xbox Executable (XBE)
XDVDFS Xbox DVD Filesystem (XISO)
XenonExecutable Xenon (Xbox 360) Executable (XEX)
XZ xz archive
XZP XBox Package File
ZArchive ZArchive (ZAR)
ZSTD ZSTD archive

Notable Information Sources

Not all of this information was able to be gathered directly from the files in question, so here is a non-exhaustive list of sites and projects that allow this project to exist. Most of the models also have direct links to specific pages or code snippets, where available.

Site/Project Models Directory
3DBrew N3DS
Aaru Data Preservation Suite CICM, PIC
Advanced Access Content System Licensing Administrator (AACS LA) AACS
Atari 7800 Development Wiki Atari7800Cart
BYTE* NewExecutable
cabextract/libmspack LZ
cxbx XboxExecutable
Cxbx-Reloaded XboxExecutable
Dat-o-Matic Upload XSD NoIntroDatabase
DBox Xbox
DebugInfo.com PortableExecutable
Devilsclaw PFF
DSiBrew Nitro
DVD Resources for Open Source Development DVD
ECMA-119 ISO9660
EDM/2 LinearExecutable
faydoc.tripod.com LinearExecutable
free60.org STFS, XEX
GuitarGame_ChartFormats Charts
HandWiki Quantum
Handy SDL AtariLynxCart
HLLib BSP, GCF, NCF, PAK, SGA, VPK, WAD3, XZP
IBM Documentation TAR
IETF GZIP
Independent Commodore Library PKZIP
Joe Tsai BZip2
Ladislav Zezula MoPaQ
libaacs AACS
libbdplus BD+
libexe NewExecutable
MAME CHD
Matthew Russotto Compression/Quantum
Microsoft Learn BMP, CFB, Compression/LZX, Compression/MSZIP, MicrosoftCabinet, OLE, PortableExecutable, SecuROM, WiseInstaller
msitools CFB
Nesdev Wiki FDS, NESCart, QD
OSDev.org MSDOS, NewExecutable
PInvoke.net MSDOS
PKWARE(?) PKZIP
PS3 Developer Wiki IRD, PlayStation3
RanseiLink Nitro
raphnet SNES
Reverse Engineering Wise WiseInstaller
SharpCompress PKZIP
Source SDK 2013 BSP
Technical Committee T10 PIC
The Go tools for Windows + Assembler PortableExecutable
The Whole Half-Life WAD3
Tukaani XZ
Unshield InstallShieldCabinet
unshieldv3 InstallShieldArchiveV3
Valve Developer Community BSP, VPK
w4kfu's bl0g SafeDisc
Wine LZ
XboxDevWiki.net Xbox
XeNTaX Game Research Forum SFFS