46 Commits

Author SHA1 Message Date
Matt Nadareski
451fc0b394 Bump version 2026-07-06 09:57:11 -04:00
Matt Nadareski
717de3608c Add Logiqx serial and version machine fields 2026-06-22 16:35:03 -04:00
Matt Nadareski
88aae0dd26 Bump version 2026-06-12 08:56:35 -04:00
Matt Nadareski
249c51933b Update packages 2026-05-14 09:25:26 -04:00
Matt Nadareski
2a0e8e2eb0 First round of cleanup for DolphinLib additions 2026-05-12 20:33:53 -04:00
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
Matt Nadareski
2462305e0b Editorconfig cleanup, use extensions 2026-04-19 09:33:55 -04:00
Deterous
e383771fb6 XRD File Support (#87) 2026-04-19 09:04:25 -04:00
Matt Nadareski
6c2098c5d2 Add "boot" element for OpenMSX, fix missing skip 2026-04-18 20:53:18 -04:00
Matt Nadareski
5694cdf9a9 Editorconfig cleanup 2026-04-15 08:44:42 -04:00
Deterous
dab850103b XDVDFS FileWriter (#83) 2026-04-15 08:41:55 -04:00
Matt Nadareski
5b22902d03 Add QD image writer 2026-04-14 12:45:31 -04:00
Matt Nadareski
4e70a7665c Add NES cart writer 2026-04-14 12:33:27 -04:00
Matt Nadareski
650402df39 Add FDS image writer 2026-04-14 12:17:42 -04:00
Matt Nadareski
fead0d781c Add LNX cart writer 2026-04-14 12:03:19 -04:00
Matt Nadareski
3896b75b3b Add A78 cart writer 2026-04-14 11:59:12 -04:00
Matt Nadareski
2d6e9d7875 Add RomVault subheader 2026-04-06 18:51:09 -04:00
Matt Nadareski
9ffa2a5e23 Convert Disk fully over to properties 2026-04-04 01:15:40 -04:00
Matt Nadareski
97b04b26a3 Make SourceDetails more complete 2026-04-03 18:31:31 -04:00
Matt Nadareski
5ccfde54f5 Convert last long key to property 2026-04-03 17:49:45 -04:00
Matt Nadareski
9df08780db Handle an enum that needed to be handled 2026-04-03 17:41:36 -04:00
Matt Nadareski
62b2fd3325 Original is cloneable and comparable 2026-04-03 13:48:43 -04:00
Matt Nadareski
716abed8b8 Convert Input mostly over to properties 2026-04-03 13:38:26 -04:00
Matt Nadareski
1d5514b29d Convert Display and Video fully over to properties 2026-04-03 13:08:36 -04:00
Matt Nadareski
2ed0c1f732 Convert Video mostly over to properties 2026-04-03 12:31:24 -04:00
Matt Nadareski
c9c31af8ea Convert Display mostly over to properties 2026-04-03 11:57:30 -04:00
Matt Nadareski
e604ef314b Convert DipLocation fully over to properties 2026-04-03 11:15:57 -04:00
Matt Nadareski
280e65775a Convert ConfLocation fully over to properties 2026-04-03 10:59:04 -04:00
Matt Nadareski
dc773dba5e Convert Chip fully over to properties 2026-04-03 10:26:20 -04:00
Matt Nadareski
3f82312943 Convert Control fully over to properties 2026-04-03 09:46:10 -04:00
Matt Nadareski
08e0aa5b77 Convert refresh rates to properties, fix format 2026-04-03 00:04:11 -04:00
Matt Nadareski
3c6cfef070 Convert size keys to size properties 2026-04-02 23:45:17 -04:00
Matt Nadareski
11803aa34c Convert Sound.Channels to long as a test 2026-04-02 22:45:33 -04:00
Matt Nadareski
8356aed5b0 Device.Manadatory converted to property 2026-04-02 02:43:29 -04:00
Matt Nadareski
c4524d20f0 Enum type conversion to property 2026-04-02 02:18:08 -04:00
Matt Nadareski
4c9ff19cf3 Runnable is Runnable 2026-04-01 22:06:24 -04:00
Matt Nadareski
451e89afff Boolean stuff convert to property 2026-04-01 21:59:16 -04:00
Matt Nadareski
826df09a3e Handle "Default" properties 2026-04-01 16:52:55 -04:00
Matt Nadareski
1cec6fa918 Add No-Intro database export reader and writer 2026-03-31 22:09:32 -04:00
Matt Nadareski
af5d161fe4 Use original XML writer settings 2026-03-31 18:30:16 -04:00
Matt Nadareski
e2e19db294 Correctness fix to include XML declaration 2026-03-31 18:15:36 -04:00
Matt Nadareski
0b055a563e Directly document No-Intro Logiqx info 2026-03-31 18:10:44 -04:00
Matt Nadareski
4d362bb791 Use XmlTextWriter for XML DAT writing 2026-03-31 18:08:40 -04:00
Matt Nadareski
8f49e190d8 Fix everything 2026-03-24 19:17:25 -04:00
Matt Nadareski
5f0fdcfd8d Update to IO 2.0.0 2026-03-24 18:02:49 -04:00
Matt Nadareski
7689c6dd07 Libraries
This change looks dramatic, but it's just separating out the already-split namespaces into separate top-level folders. In theory, every single one could be built into their own Nuget package. `SabreTools.Serialization` still builds the normal Nuget package that is used by all other projects and includes all namespaces.
2026-03-21 16:26:56 -04:00