]> FriiDump Source - friidump.git/blob - docs/XBOX.md
Harden GCC-4243N A102 HLDS E7 profile
[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 is captured from
74 unlocked source LBA `0..31` before copying XDVDFS data from source LBA `32`.
75 FriiDump 0.5.3.13 proved this placement with cache-aligned raw-sector IDs. The
76 native libfriidump path retains per-sector zero-fill only for a genuinely
77 unreadable lead-in sector and records the read/zero-fill counts; the reference
78 Xbox path treats failure to capture the proven lead-in as a dump failure.
79
80 FriiDump also records a `discimagecreator_reference` section in the JSON. The
81 redump-style constants are checked against DiscImageCreator's Original
82 Xbox/XGD1 model: `XBOX_SIZE = 3820880`, `XBOX_LAYER_BREAK = 1913776`, DVD start
83 PSN `0x30000`, and Xbox/game start PSN `0x60600`. That gives the FriiDump
84 virtual layout start at output LBA `0x30600` / `198144`, matching the
85 DiscImageCreator layout model for Original Xbox discs.
86
87 For the GDR-8050L redump-style path, FriiDump follows the original dumper's
88 state order: primary handshake, media-cycle, re-handshake, game metadata/auth
89 probe, media-cycle back to the visible DVD-video view, video L0/L1 capture, final
90 handshake, game lead-in/game data write, metadata write, and STOP UNIT cleanup.
91
92 For GDR-3120L/Kreon-style vendor-lock-state drives, FriiDump sends lock state
93 `0` before the video-view capture and lock state `2` before the game-view read.
94
95 ### Game partition XISO
96
97 ```sh
98 friidump -d <drive> -T 4 -X xbox.xiso
99 ```
100
101 `-X / --xiso` writes only the game partition as an XISO-style image. The XISO
102 path unlocks first when needed, probes XDVDFS at LBA `306112`, then falls back
103 to LBA `32`. For dual-layer retail-style media it copies through LBA `1913920`
104 using `1913920 - startLba` source sectors. For single-layer/homebrew-style media
105 it uses `VolumeSize / 2048` from the XDVDFS header.
106
107 Like `-i`, XISO mode attempts to read the 32-sector game lead-in and falls back
108 to per-sector zero-fill only where reads fail.
109
110 `--xiso` is a separate output mode and cannot be combined with `-i`, `-r`, or
111 `-a` in one run.
112
113 ## Read-only XGD1 logical-boundary probe
114
115 FriiDump 0.5.3.11 adds a Windows-only diagnostic that does not create or alter
116 an ISO:
117
118 ```powershell
119 friidump -d f: --xgd1-layout-probe "docs\debug\xgd1-layout-probe.json"
120 ```
121
122 The mode is currently restricted to the GDR-8050L challenge-handshake profile.
123 It performs the following evidence sequence:
124
125 1. Record the entry READ CAPACITY(10) state.
126 2. Cycle the tray and verify the exact 6,992-sector locked/video capacity.
127 3. Probe selected boundary LBAs with one-sector READ(10) and READ(12).
128 4. Apply the established full Xbox handshake and verify the unlocked/game
129    capacity.
130 5. Probe the corresponding unlocked-source and capacity-edge LBAs.
131 6. Restore the locked/video entry state when the run began locked.
132 7. Atomically publish the JSON report and issue STOP UNIT.
133
134 Each command record includes the Win32 result, SCSI status, sense
135 key/ASC/ASCQ, all-zero/nonzero classification, SHA-1, and full 2048-byte sector
136 data when the read succeeds. Expected out-of-range failures are evidence and
137 do not by themselves invalidate the report.
138
139 This is a logical-read probe, not a physical-sector dumper. It does not assert
140 that inaccessible filler is zero, does not replace the current synthetic
141 ranges, and does not promote the reconstructed XGD1 image to Redump identity.
142
143 ## GDR-8050L handshake sequence
144
145 The GDR-8050L path performs this sequence when switching from visible DVD-video view
146 to unlocked game view. This method is credited to scsi1.pas / "XBOX 1
147 DVD-Drive unlocker tool v0.1" by The Specialist and the xboxhacker.net
148 contributors credited in that source.
149
150 1. READ CAPACITY(10).
151 2. MODE SENSE(10), page `0x3E`.
152 3. READ DVD STRUCTURE, format `0xC0`, using CDB
153    `AD 00 FF 02 FD FF FE 00 06 64 00 C0`.
154 4. If needed, fall back to the Hitachi-family vendor challenge-table command
155    `0xFD`.
156 5. Decode the challenge table with SHA-1 and RC4.
157 6. MODE SELECT(10) first challenge.
158 7. MODE SENSE(10) verify.
159 8. MODE SELECT(10) second challenge.
160 9. MODE SENSE(10) verify.
161 10. MODE SELECT(10) partition-1 unlock.
162 11. MODE SELECT(6), page `0x31`, to enable sticky descrambling.
163 12. READ CAPACITY(10) again as an observation.  Like the original dumper, this
164     verification is diagnostic; the later XDVDFS probe determines whether the
165     game view is actually available.
166
167 ## GDR-3120L / Kreon-style vendor unlock sequence
168
169 The GDR-3120L/Kreon-style path follows the DiscImageCreator `FF 08 01` command
170 family:
171
172 1. `FF 08 01 10` - get feature list; valid replies begin with `A55A 5AA5`.
173 2. `FF 08 01 11 00` - set lock state 0 / visible DVD-video view when redump-style `-i`
174    needs the visible/video area.
175 3. `FF 08 01 11 02` - set lock state 2 / wxripper state when the game/XDVDFS
176    view is needed.
177 4. `FF 08 01 15 00` - disable vendor error-skip before dumping.
178 5. READ CAPACITY(10), READ DVD STRUCTURE, and READ(10) are then used by the
179    selected dump layout.
180
181 ## GC/Wii and candidate drive list
182
183 Hitachi-LG GC/Wii support list reflected in this branch:
184
185 - `GDR-8082N`, `GDR-8083N`, `GDR-8084N`
186 - `GDR-8161B`, `GDR-8162B`, `GDR-8163B`, `GDR-8164B`
187 - `GCC-4160N`, `GCC-4240N`, `GCC-4243N`, `GCC-4244N`, `GCC-4247N`
188 - `GDR-8085N`, `GDR-8087N`, and `GCC-4246N` are probable but not confirmed here.
189 - `GCC-4241N` and `GCC-4242N` are capable but known to have many errors.
190
191 DiscImageCreator reference candidates noted but not fully cloned here:
192
193 - XBOX/XBOX 360 Kreon firmware candidates: `TS-H353A`, `TS-H352C`, `SH-D162C`,
194   `SH-D162D`, `SH-D163A`, `SH-D163B`.
195 - XBOX/XBOX 360 swap candidate: `GSA-4163B`.
196 - HD-DVD and BD are DiscImageCreator-supported disc classes, but this FriiDump
197   branch does not claim DiscImageCreator-equivalent HD-DVD/BD feature coverage.
198
199 Implementation map:
200
201 - MMC/SCSI helpers, the GDR-8050L unlock path, and the `FF 08 01` vendor
202   helpers: `libfriidump/dvd_drive.c`
203 - Xbox disc detection/unlock timing: `libfriidump/disc.c`
204 - Redump-style ISO and XISO dumping: `libfriidump/dumper.c`
205
206 ### GDR-8050L reference path
207
208 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.
209
210 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.
211
212 FriiDump 0.5.3.8 returns the reference dumper's actual finalized ISO filename,
213 byte count, CRC32, MD5, SHA-1, and SHA-256 to the common Redump verifier after a
214 successful option-1/full-disc dump. This supports both explicit `-i <file>` and
215 bare `-i` with XBE/DMI-derived names without hashing the 7.29 GiB file twice.
216 Use `--redump-report <file>` to publish the same atomic schema-2 evidence record
217 used by GameCube/Wii paths.
218
219 The current XGD1 image map contains unresolved zero-filled pregame and postgame ranges.
220 Accordingly, `NO EXACT MATCH` is a valid evidence result even when all readable
221 sectors were acquired successfully. The verifier reports acquisition evidence
222 and archive identity as separate claims. `-X` remains outside DAT verification
223 because XISO is not a full Redump disc image.
224
225 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.
226
227
228
229 ## XGD1 cache-aligned raw-ID geometry correction (0.5.3.13)
230
231 The first 0.5.3.12 hardware report contained a mixture of valid physical IDs
232 and stale/block-start cache entries. The corrected probe now performs the same
233 zero-transfer READ(12) flush and 16-sector block alignment used by the proven
234 modified-GDR-8050L Method 8 path. It dumps only the raw 12-byte header and
235 four-byte EDC for the selected slot, decodes the layer bit, normalizes layer-1
236 PSNs by 24-bit complement, and compares each sample with its mapped full-output
237 LBA.
238
239 The live 0.5.3.13 run matched all 13 selected samples and set
240 `physical_geometry_resolved` true. The result proves the physical placement of
241 the visible video ranges, the full unlocked game range, and the omitted
242 pregame/postgame spans. It does not establish the byte content of the omitted
243 filler spans.
244
245 ## Drive-captured XGD1 game lead-in (0.5.3.14)
246
247 The successful 0.5.3.13 geometry report established these adjacent mappings:
248
249 - unlocked source LBA `0..31` -> output LBA `198144..198175`, raw PSN
250   `0x060600..0x06061F`;
251 - unlocked source LBA `32` -> output LBA `198176`, raw PSN `0x060620`, where
252   the `MICROSOFT*XBOX*MEDIA` XDVDFS descriptor begins.
253
254 FriiDump 0.5.3.14 therefore replaces the historical synthetic 32-sector
255 game-lead-in write with drive capture from source LBA `0..31`. This changes the
256 full XGD1 output bytes and requires a new live full-disc dump plus Redump DAT
257 comparison. The 191,312-sector pregame and postgame spans retain zero-filled
258 placeholder content: their physical geometry is proven, but their inaccessible
259 byte content is not.
260
261 ## Logging
262
263 The original Xbox reference logger is now the shared FriiDump run logger. Every
264 run opens a log file before the banner is printed. When an output filename is
265 known, the log is retargeted to `<output>.log`. If no output filename is known
266 but a drive is known, it uses `friidump_<drive>.log`; otherwise it uses
267 `friidump.log`. Xbox reference diagnostics continue to be written to the same
268 log.
269
270 GCC-4243N/GCC-4244N Method 8 split-recovery note
271 --------------------------------------------------
272 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.
273
274 HLDS 0xE7 DIC profile-layer update
275 ------------------------------------
276 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:
277
278 - Type1: GCC-4160N/GCC-4240N, cache base 0x00a13000, one 16-sector memory window.
279 - Type3: GCC-4243N/GCC-4244N/GCC-4246N/GCC-4247N and GDR8083N/GDR8084N, cache base 0x80000000, five 16-sector memory windows.
280 - Type4: GDR8082N/GDR8161B/GDR8162B/GDR8163B/GDR8164B and related DVD-ROM profiles, cache base 0x80000000, five 16-sector memory windows.
281 - 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.
282 - 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.
283
284 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.
285
286
287 GDR-8081N experimental 0xE7 probe layer
288 -----------------------------------------
289 GDR-8081N is now recognized as an experimental HLDS 0xE7 GC/Wii candidate.
290 Unlike GDR8082N/GDR816x, it was not in the confirmed DIC dump list, so FriiDump
291 does not hard-code it as a normal Type4 drive.  It starts as `GDR-8081N
292 experimental 0xE7 probe` and, during seed retrieval, tries small sector-0
293 validation reads across these cache profiles:
294
295 - Probe A Type4-derived: base 0x80000000, 5 windows.
296 - Probe B single-window: base 0x80000000, 1 window.
297 - Probe C Type1-base: base 0x00a13000, 1 window.
298 - Probe D moving-cache candidate: base 0x7fff7f00, 1 window.
299
300 The first candidate that can read/validate sector 0 is selected for the rest of
301 the run and logged.  If all candidates fail, seed retrieval stops and the log
302 records each failed probe.  Unsupported/non-HLDS drives now keep zeroed HLDS
303 profile fields so stale cache-base/window values are not printed.
304 ## FriiDump 0.5.3.9 live-summary closure
305
306 The embedded GDR-8050L reference path returns finalized hashes, output size and
307 sector count, title, media ID, and elapsed evidence to FriiDump.  The final HLDS
308 summary therefore describes the reconstructed output rather than the locked
309 6,992-sector view.  GC/Wii seed terminology is marked not applicable for this
310 Xbox authentication path.  DumpXboxGameDisc no longer spins the drive down
311 internally; FriiDump performs one final STOP UNIT after Redump verification.
312
313 ## FriiDump 0.5.3.10 state-aware metadata-entry handshake
314
315 The copied GDR-8050L bridge no longer performs the unconditional sequence
316 `unlock -> tray cycle -> unlock` before title/XDVDFS probing.
317
318 Normal entry paths are now:
319
320 - already-unlocked entry: verify readiness, reuse the game view, and read title,
321   XDVDFS, media ID, and physical metadata;
322 - locked/video entry: issue one full handshake directly, refresh/read capacity,
323   and continue only after the game view is observed;
324 - recovery only: when direct verification fails, cycle the tray once, retry the
325   full handshake once, and fail cleanly if the game view is still absent.
326
327 The dump itself still performs one intentional media transition to restore the
328 locked/video view before VIDEO-L0 and VIDEO-L1 capture, followed by one full
329 handshake for game/XDVDFS sectors. Therefore the expected normal cold-state
330 sequence is `unlock -> metadata -> tray cycle -> video -> unlock -> game`, and
331 an already-unlocked entry omits the first unlock.
332
333 XDVD sidecar authentication evidence now distinguishes two separate facts:
334
335 - `unlock_requires_media_transition: false`
336 - `locked_video_view_restore_requires_media_transition: true`
337
338 The compatibility field `requires_media_transition` is also `false`; it refers
339 to authentication/unlock acceptance, not to restoring the locked video view.
340
341 ## XGD1 raw-sector ID geometry probe (0.5.3.12)
342
343 Live 0.5.3.11 evidence closed the ordinary logical-read branch: all 17
344 successful READ(10)/READ(12) pairs were identical, the locked view stopped at
345 6991, and the unlocked view stopped at 3431263. Output-space LBAs outside
346 those capacities returned ILLEGAL REQUEST / LBA OUT OF RANGE (05/21/00).
347 This means neither READ opcode exposes a hidden logical source for the
348 synthetic pregame or postgame ranges.
349
350 `--xgd1-raw-id-probe <file>` is the next read-only geometry probe. On the
351 modified GDR-8050L profile it fills the drive cache with a controlled 16-sector
352 READ(12), dumps the selected 2064-byte raw sector through `E7 48 49 54 01`, and
353 decodes bytes 1..3 of the raw DVD ID as the physical-sector number. Adjacent
354 locked and unlocked boundary samples can establish whether the active logical
355 views map linearly or jump across omitted physical regions.
356
357 Raw physical IDs do not reveal the contents of inaccessible filler sectors.
358 No zero-filled range may be promoted to exact merely because its geometry is
359 confirmed.
360
361
362 ## 0.5.3.15 live closure
363
364 The required 0.5.3.14 hardware run completed on the modified GDR-8050L
365 revision `0012`.
366
367 The drive-captured source LBA `0..31` lead-in was independently verified at
368 output LBA `198144..198175`, and source LBA `32` remained the XDVDFS boundary at
369 output LBA `198176`.
370
371 Final output:
372
373 - sectors: `3,820,880`;
374 - bytes: `7,825,162,240`;
375 - SHA-256:
376   `5995f823c6d67b9e3e3b3e1c2b54e1e036793188bec6b5be4220f559305f53b9`.
377
378 The Microsoft Xbox DAT scan returned `NO EXACT MATCH`. Pregame and postgame
379 geometry is proven, but their inaccessible content remains zero-filled and
380 unresolved.
381
382 Without `--redump-dat-dir`, DAT discovery checks the executable-relative
383 `redump_dat` directory before the current working directory. This prevents
384 runner working directories from hiding the packaged DAT set.