]> FriiDump Source - friidump.git/blob - docs/XBOX.md
29c1f6ea5246fc04a13472a53bcb88065b69326a
[friidump.git] / docs / XBOX.md
1 # Xbox disc support
2
3 This version adds a native Xbox/XGD disc path to FriiDump. It uses the selected
4 optical drive directly through MMC/SCSI commands. The only extra Xbox metadata
5 written by FriiDump is optional dump metadata such as PFI/DMI binary captures
6 and the redump-style JSON descriptor.
7
8 ## Supported Xbox drive profiles
9
10 - `HL-DT-ST DVD-ROM GDR8050L`
11   - Detected as an Xbox-capable drive.
12   - Keeps the visible DVD-video view during detection so `-i` can capture video L0/L1.
13   - Runs the Xbox challenge-table handshake only when the dumper needs the
14     unlocked game/XDVDFS view.
15   - Enables sticky descrambling with Mode Select page `0x31` after the unlock.
16 - `HL-DT-ST DVD-ROM GDR3120L` / `GDR-3120L`
17   - Detected as an Xbox-capable drive.
18   - Uses the DiscImageCreator-style `FF 08 01` feature-list and lock-state
19     command family.
20   - For redump-style `-i`, FriiDump tries lock state `0` first to capture the
21     visible/video view, then lock state `2` / wxripper state to read the game
22     view.
23   - The GDR-8050L challenge-table handshake is not applied to this model.
24
25 Samsung/Kreon-style candidates such as `TS-H352C`, `TS-H353A`, `SH-D162C`,
26 `SH-D162D`, `SH-D163A`, and `SH-D163B` are recognized as drive profiles, but
27 are not automatically redirected into Xbox mode. Force Xbox mode with `-T 4`
28 when testing those drives and firmware that supports the `FF 08 01` command
29 family.
30
31 Other drives continue to use FriiDump's original drive command/method logic for
32 ordinary GameCube, Wii, Wii DL, or DVD dumps. If Xbox mode is explicitly forced
33 with `-T 4` on a drive that is not wired into the Xbox unlock backend, FriiDump
34 now refuses the run instead of falling back to GC/Wii methods.
35
36 For ordinary DVD-ROM media, use `-D` / `--dvd` as a clear alias for `-T 3`:
37
38 ```sh
39 friidump -d <drive> -D -i dvd.iso
40 ```
41
42 That DVD mode is available to all drives and stays on FriiDump's original
43 DVD/raw/ISO dumping path. It does not run Xbox unlocks or write Xbox metadata.
44
45 ## Recommended commands
46
47 ### Redump-style Original Xbox/XGD1 ISO
48
49 ```sh
50 friidump -d <drive> -T 4 -i xbox.iso
51 ```
52
53 For Xbox/XGD media, `-i` reconstructs a redump-style 2048-byte-sector image. It
54 is not just a game-partition dump. For retail dual-layer media the layout is:
55
56 - video L0 at output LBA `0`, read from the visible DVD-video view;
57 - pregame padding up to output LBA `198144`;
58 - a 32-sector game lead-in at output LBA `198144`;
59 - unlocked game/XDVDFS data beginning at output LBA `198176`;
60 - postgame padding;
61 - video L1 tail at output LBA `3820720`, captured from the visible DVD-video view
62   before the unlock.
63
64 When available, FriiDump also writes these files next to the ISO:
65
66 - `<name>.pfi.bin` - READ DVD STRUCTURE format `0x00` / Physical Format
67   Information;
68 - `<name>.dmi.bin` - READ DVD STRUCTURE format `0x04` / Disc Manufacturing
69   Information;
70 - `<name>.redump.json` - JSON metadata describing the layout, hashes, drive
71   profile, PFI/DMI filenames, and lead-in capture status.
72
73 For the GDR-8050L redump path, the 32-sector game lead-in follows the original
74 dumper's option-1 behavior and is written as zero-fill before copying unlocked
75 XDVDFS data from source LBA `32`.  For non-8050L Xbox strategies, FriiDump still
76 attempts to read lead-in sectors when the active drive/profile can expose them,
77 and zero-fills only unreadable lead-in sectors.
78
79 FriiDump also records a `discimagecreator_reference` section in the JSON. The
80 redump-style constants are checked against DiscImageCreator's Original
81 Xbox/XGD1 model: `XBOX_SIZE = 3820880`, `XBOX_LAYER_BREAK = 1913776`, DVD start
82 PSN `0x30000`, and Xbox/game start PSN `0x60600`. That gives the FriiDump
83 virtual layout start at output LBA `0x30600` / `198144`, matching the
84 DiscImageCreator layout model for Original Xbox discs.
85
86 For the GDR-8050L redump-style path, FriiDump follows the original dumper's
87 state order: primary handshake, media-cycle, re-handshake, game metadata/auth
88 probe, media-cycle back to the visible DVD-video view, video L0/L1 capture, final
89 handshake, game lead-in/game data write, metadata write, and STOP UNIT cleanup.
90
91 For GDR-3120L/Kreon-style vendor-lock-state drives, FriiDump sends lock state
92 `0` before the video-view capture and lock state `2` before the game-view read.
93
94 ### Game partition XISO
95
96 ```sh
97 friidump -d <drive> -T 4 -X xbox.xiso
98 ```
99
100 `-X / --xiso` writes only the game partition as an XISO-style image. The XISO
101 path unlocks first when needed, probes XDVDFS at LBA `306112`, then falls back
102 to LBA `32`. For dual-layer retail-style media it copies through LBA `1913920`
103 using `1913920 - startLba` source sectors. For single-layer/homebrew-style media
104 it uses `VolumeSize / 2048` from the XDVDFS header.
105
106 Like `-i`, XISO mode attempts to read the 32-sector game lead-in and falls back
107 to per-sector zero-fill only where reads fail.
108
109 `--xiso` is a separate output mode and cannot be combined with `-i`, `-r`, or
110 `-a` in one run.
111
112 ## GDR-8050L handshake sequence
113
114 The GDR-8050L path performs this sequence when switching from visible DVD-video view
115 to unlocked game view. This method is credited to scsi1.pas / "XBOX 1
116 DVD-Drive unlocker tool v0.1" by The Specialist and the xboxhacker.net
117 contributors credited in that source.
118
119 1. READ CAPACITY(10).
120 2. MODE SENSE(10), page `0x3E`.
121 3. READ DVD STRUCTURE, format `0xC0`, using CDB
122    `AD 00 FF 02 FD FF FE 00 06 64 00 C0`.
123 4. If needed, fall back to the Hitachi-family vendor challenge-table command
124    `0xFD`.
125 5. Decode the challenge table with SHA-1 and RC4.
126 6. MODE SELECT(10) first challenge.
127 7. MODE SENSE(10) verify.
128 8. MODE SELECT(10) second challenge.
129 9. MODE SENSE(10) verify.
130 10. MODE SELECT(10) partition-1 unlock.
131 11. MODE SELECT(6), page `0x31`, to enable sticky descrambling.
132 12. READ CAPACITY(10) again as an observation.  Like the original dumper, this
133     verification is diagnostic; the later XDVDFS probe determines whether the
134     game view is actually available.
135
136 ## GDR-3120L / Kreon-style vendor unlock sequence
137
138 The GDR-3120L/Kreon-style path follows the DiscImageCreator `FF 08 01` command
139 family:
140
141 1. `FF 08 01 10` - get feature list; valid replies begin with `A55A 5AA5`.
142 2. `FF 08 01 11 00` - set lock state 0 / visible DVD-video view when redump-style `-i`
143    needs the visible/video area.
144 3. `FF 08 01 11 02` - set lock state 2 / wxripper state when the game/XDVDFS
145    view is needed.
146 4. `FF 08 01 15 00` - disable vendor error-skip before dumping.
147 5. READ CAPACITY(10), READ DVD STRUCTURE, and READ(10) are then used by the
148    selected dump layout.
149
150 ## GC/Wii and candidate drive list
151
152 Hitachi-LG GC/Wii support list reflected in this branch:
153
154 - `GDR-8082N`, `GDR-8083N`, `GDR-8084N`
155 - `GDR-8161B`, `GDR-8162B`, `GDR-8163B`, `GDR-8164B`
156 - `GCC-4160N`, `GCC-4240N`, `GCC-4243N`, `GCC-4244N`, `GCC-4247N`
157 - `GDR-8085N`, `GDR-8087N`, and `GCC-4246N` are probable but not confirmed here.
158 - `GCC-4241N` and `GCC-4242N` are capable but known to have many errors.
159
160 DiscImageCreator reference candidates noted but not fully cloned here:
161
162 - XBOX/XBOX 360 Kreon firmware candidates: `TS-H353A`, `TS-H352C`, `SH-D162C`,
163   `SH-D162D`, `SH-D163A`, `SH-D163B`.
164 - XBOX/XBOX 360 swap candidate: `GSA-4163B`.
165 - HD-DVD and BD are DiscImageCreator-supported disc classes, but this FriiDump
166   branch does not claim DiscImageCreator-equivalent HD-DVD/BD feature coverage.
167
168 Implementation map:
169
170 - MMC/SCSI helpers, the GDR-8050L unlock path, and the `FF 08 01` vendor
171   helpers: `libfriidump/dvd_drive.c`
172 - Xbox disc detection/unlock timing: `libfriidump/disc.c`
173 - Redump-style ISO and XISO dumping: `libfriidump/dumper.c`
174
175 ### GDR-8050L reference path
176
177 On Windows, GDR-8050L `-i` and `-X` are dispatched to a copied-in reference implementation from jtryba's original Xbox dumper (`main.c`, `utils.c`, `unlock.c`, and helpers). This preserves the original state-machine order instead of approximating it in FriiDump's generic read loop. It also preserves the reference timing sleeps: tray-cycle 3000 ms, readiness settle 1500 ms after success or 10000 ms fallback, RefreshVolume's 1000 ms wait, and the explicit post-refresh 2000 ms settle.
178
179 For GDR-8050L, bare `-i` derives `Title[MediaID].iso` from the XBE title and DMI media ID, and bare `-X` derives `Title[MediaID].xiso`. Supplying `-i <file>` or `-X <file>` is an explicit filename override. FriiDump prepares the game view for that title/media-ID discovery with state-aware READ CAPACITY classification: it reuses an already-unlocked view, otherwise it attempts one direct full handshake without a media transition. A tray-cycle-and-retry path exists only as recovery when direct verification fails.
180
181 FriiDump 0.5.3.8 returns the reference dumper's actual finalized ISO filename,
182 byte count, CRC32, MD5, SHA-1, and SHA-256 to the common Redump verifier after a
183 successful option-1/full-disc dump. This supports both explicit `-i <file>` and
184 bare `-i` with XBE/DMI-derived names without hashing the 7.29 GiB file twice.
185 Use `--redump-report <file>` to publish the same atomic schema-2 evidence record
186 used by GameCube/Wii paths.
187
188 The current XGD1 image map contains documented synthetic zero-filled ranges.
189 Accordingly, `NO EXACT MATCH` is a valid evidence result even when all readable
190 sectors were acquired successfully. The verifier reports acquisition evidence
191 and archive identity as separate claims. `-X` remains outside DAT verification
192 because XISO is not a full Redump disc image.
193
194 GDR-3120L remains on the separate `FF 08 01` vendor lock/unlock path. Forced Xbox mode on non-supported Xbox unlock profiles is rejected rather than routed through FriiDump GC/Wii fallback methods.
195
196
197 ## Logging
198
199 The original Xbox reference logger is now the shared FriiDump run logger. Every
200 run opens a log file before the banner is printed. When an output filename is
201 known, the log is retargeted to `<output>.log`. If no output filename is known
202 but a drive is known, it uses `friidump_<drive>.log`; otherwise it uses
203 `friidump.log`. Xbox reference diagnostics continue to be written to the same
204 log.
205
206 GCC-4243N/GCC-4244N Method 8 split-recovery note
207 --------------------------------------------------
208 For HLDS GCC-4243N and GCC-4244N GameCube/Wii dumping, the default Hitachi command-2 / Method-8 path now has three visible recovery layers: the existing Method-8 5-block/window read reconstruction retry loop, the dump-level retry envelope, and a Method-8 split-recovery path for a failed 16-sector block. The split-recovery path reconstructs the failed block by trying 8-sector, 4-sector, 2-sector, then 1-sector streaming chunks, validates the rebuilt 16-sector raw block with the normal unscrambler/EDC check, and only caches/writes it if validation succeeds. All retry and split-recovery messages are mirrored through the shared FriiDump log file, so a failure such as `Dump failed at sectors: N..N+15` should now include whether 8/4/2/1 chunk recovery was attempted and where it failed. Existing Xbox logging remains on the same shared log path; GDR-3120L Xbox support remains on the explicit vendor lock/unlock path.
209
210 HLDS 0xE7 DIC profile-layer update
211 ------------------------------------
212 This branch now classifies HLDS/MN103 0xE7 GC/Wii dumping drives into DIC-style profiles before assigning the FriiDump Hitachi cache reader.  The selected profile is printed in the run log after Command/Method:
213
214 - Type1: GCC-4160N/GCC-4240N, cache base 0x00a13000, one 16-sector memory window.
215 - Type3: GCC-4243N/GCC-4244N/GCC-4246N/GCC-4247N and GDR8083N/GDR8084N, cache base 0x80000000, five 16-sector memory windows.
216 - Type4: GDR8082N/GDR8161B/GDR8162B/GDR8163B/GDR8164B and related DVD-ROM profiles, cache base 0x80000000, five 16-sector memory windows.
217 - Type4 GDR-8050L modified 0xE7 test: GDR8050L/GDR-8050L with cross-flashed or modified firmware that adds 0xE7 memdump, cache base 0x80000000, five 16-sector memory windows, Method 8 default for GC/Wii tests.
218 - Type2_1/Type2_2: GCC-4241N/GCC-4242N are identified as experimental DIC Type2 shapes, but this branch does not yet claim DIC parity for their moving-cache behavior.
219
220 The Type1 base address comes from the DIC source behavior for GCC-4160N/GCC-4240N.  Method 8 now honors the selected profile's memory-window count, so Type1 reads/cache-validates one 16-sector block per request instead of assuming the Type3/Type4 five-window cache layout.  GCC-4243N and GCC-4244N remain on Method 8 by default.  GDR-8050L is now split into a special modified-firmware GC/Wii test profile: stock GDR-8050L firmware is still expected to use the Xbox path only, while a cross-flashed/modified GDR-8050L with 0xE7 memdump added can be tested on the Method 8 GC/Wii cache reader.  GDR-3120L Xbox ripping support remains on the separate explicit vendor lock/unlock path.
221
222
223 GDR-8081N experimental 0xE7 probe layer
224 -----------------------------------------
225 GDR-8081N is now recognized as an experimental HLDS 0xE7 GC/Wii candidate.
226 Unlike GDR8082N/GDR816x, it was not in the confirmed DIC dump list, so FriiDump
227 does not hard-code it as a normal Type4 drive.  It starts as `GDR-8081N
228 experimental 0xE7 probe` and, during seed retrieval, tries small sector-0
229 validation reads across these cache profiles:
230
231 - Probe A Type4-derived: base 0x80000000, 5 windows.
232 - Probe B single-window: base 0x80000000, 1 window.
233 - Probe C Type1-base: base 0x00a13000, 1 window.
234 - Probe D moving-cache candidate: base 0x7fff7f00, 1 window.
235
236 The first candidate that can read/validate sector 0 is selected for the rest of
237 the run and logged.  If all candidates fail, seed retrieval stops and the log
238 records each failed probe.  Unsupported/non-HLDS drives now keep zeroed HLDS
239 profile fields so stale cache-base/window values are not printed.
240 ## FriiDump 0.5.3.9 live-summary closure
241
242 The embedded GDR-8050L reference path returns finalized hashes, output size and
243 sector count, title, media ID, and elapsed evidence to FriiDump.  The final HLDS
244 summary therefore describes the reconstructed output rather than the locked
245 6,992-sector view.  GC/Wii seed terminology is marked not applicable for this
246 Xbox authentication path.  DumpXboxGameDisc no longer spins the drive down
247 internally; FriiDump performs one final STOP UNIT after Redump verification.
248
249 ## FriiDump 0.5.3.10 state-aware metadata-entry handshake
250
251 The copied GDR-8050L bridge no longer performs the unconditional sequence
252 `unlock -> tray cycle -> unlock` before title/XDVDFS probing.
253
254 Normal entry paths are now:
255
256 - already-unlocked entry: verify readiness, reuse the game view, and read title,
257   XDVDFS, media ID, and physical metadata;
258 - locked/video entry: issue one full handshake directly, refresh/read capacity,
259   and continue only after the game view is observed;
260 - recovery only: when direct verification fails, cycle the tray once, retry the
261   full handshake once, and fail cleanly if the game view is still absent.
262
263 The dump itself still performs one intentional media transition to restore the
264 locked/video view before VIDEO-L0 and VIDEO-L1 capture, followed by one full
265 handshake for game/XDVDFS sectors. Therefore the expected normal cold-state
266 sequence is `unlock -> metadata -> tray cycle -> video -> unlock -> game`, and
267 an already-unlocked entry omits the first unlock.
268
269 XDVD sidecar authentication evidence now distinguishes two separate facts:
270
271 - `unlock_requires_media_transition: false`
272 - `locked_video_view_restore_requires_media_transition: true`
273
274 The compatibility field `requires_media_transition` is also `false`; it refers
275 to authentication/unlock acceptance, not to restoring the locked video view.