]> FriiDump Source - friidump.git/blobdiff - libfriidump/xbox_ref/utils.c
FriiDump 0.5.3.15: close XGD1 geometry and lead-in capture
[friidump.git] / libfriidump / xbox_ref / utils.c
index 3cf28114b01b0df5f00cc14de1003f7e4e6a4cb1..c63b03bedb6aef1afa5d739592ecd0f2cedefac6 100644 (file)
@@ -1981,7 +1981,7 @@ static void JsonWriteValidationWarnings(FILE *f, const XboxDvdSidecarCapture *ca
     if (!payloadFilesPresent)
         WRITE_WARNING("payload_files_not_fully_present");
     if (redumpStyleZeroFilledPadding)
     if (!payloadFilesPresent)
         WRITE_WARNING("payload_files_not_fully_present");
     if (redumpStyleZeroFilledPadding)
-        WRITE_WARNING("redump_style_padding_zero_filled_pending_hardware_capture");
+        WRITE_WARNING("redump_style_padding_zero_filled_unresolved_content");
 
 #undef WRITE_WARNING
 
 
 #undef WRITE_WARNING
 
@@ -2476,6 +2476,9 @@ static BOOL WriteXboxDvdMediaProfileFile(const char *isoFilename,
         fprintf(json, "    \"pregame_padding_start_lba\": %u,\n", redumpStyle ? XGD1_VIDEO_L0_SECTORS : 0U);
         fprintf(json, "    \"pregame_padding_sector_count\": %u,\n", redumpStyle ? (XGD1_GAME_OUTPUT_START_LBA - XGD1_VIDEO_L0_SECTORS) : 0U);
         fprintf(json, "    \"game_output_start_lba\": %u,\n", gameOutputLba);
         fprintf(json, "    \"pregame_padding_start_lba\": %u,\n", redumpStyle ? XGD1_VIDEO_L0_SECTORS : 0U);
         fprintf(json, "    \"pregame_padding_sector_count\": %u,\n", redumpStyle ? (XGD1_GAME_OUTPUT_START_LBA - XGD1_VIDEO_L0_SECTORS) : 0U);
         fprintf(json, "    \"game_output_start_lba\": %u,\n", gameOutputLba);
+        fprintf(json, "    \"game_leadin_unlocked_source_start_lba\": %u,\n", redumpStyle ? 0U : gameSourceLba);
+        fprintf(json, "    \"game_leadin_source_sector_count\": %u,\n", redumpStyle ? XGD1_XISO_LEADIN_SECTORS : 0U);
+        fprintf(json, "    \"game_leadin_source\": "); JsonWriteEscapedString(json, redumpStyle ? "drive_read10" : "not_applicable"); fprintf(json, ",\n");
         fprintf(json, "    \"game_unlocked_source_start_lba\": %u,\n", gameSourceLba);
         fprintf(json, "    \"game_unlocked_source_sector_count\": %u,\n", redumpStyle ? XGD1_GAME_SOURCE_SECTORS : gameSectors);
         fprintf(json, "    \"game_xiso_leadin_sector_count\": %u,\n", redumpStyle ? XGD1_XISO_LEADIN_SECTORS : 0U);
         fprintf(json, "    \"game_unlocked_source_start_lba\": %u,\n", gameSourceLba);
         fprintf(json, "    \"game_unlocked_source_sector_count\": %u,\n", redumpStyle ? XGD1_GAME_SOURCE_SECTORS : gameSectors);
         fprintf(json, "    \"game_xiso_leadin_sector_count\": %u,\n", redumpStyle ? XGD1_XISO_LEADIN_SECTORS : 0U);
@@ -2494,10 +2497,12 @@ static BOOL WriteXboxDvdMediaProfileFile(const char *isoFilename,
 
     fprintf(json, "  \"reconstruction\": {\n");
     fprintf(json, "    \"is_reconstructed_layout\": %s,\n", redumpStyle ? "true" : "false");
 
     fprintf(json, "  \"reconstruction\": {\n");
     fprintf(json, "    \"is_reconstructed_layout\": %s,\n", redumpStyle ? "true" : "false");
-    fprintf(json, "    \"filler_policy\": "); JsonWriteEscapedString(json, redumpStyle ? "zero_fill_until_drive_can_read_filler" : "not_applicable"); fprintf(json, ",\n");
+    fprintf(json, "    \"filler_policy\": "); JsonWriteEscapedString(json, redumpStyle ? "pregame_and_postgame_zero_fill_content_placeholder" : "not_applicable"); fprintf(json, ",\n");
+    fprintf(json, "    \"filler_geometry_verified\": %s,\n", redumpStyle ? "true" : "false");
     fprintf(json, "    \"filler_verified_from_disc\": false,\n");
     fprintf(json, "    \"filler_byte_value\": %s,\n", redumpStyle ? "0" : "null");
     fprintf(json, "    \"filler_verified_from_disc\": false,\n");
     fprintf(json, "    \"filler_byte_value\": %s,\n", redumpStyle ? "0" : "null");
-    fprintf(json, "    \"pending_hardware_capture\": %s,\n", redumpStyle ? "true" : "false");
+    fprintf(json, "    \"pending_hardware_capture\": false,\n");
+    fprintf(json, "    \"unresolved_filler_content\": %s,\n", redumpStyle ? "true" : "false");
     fprintf(json, "    \"filler_ranges\": [\n");
     if (redumpStyle)
     {
     fprintf(json, "    \"filler_ranges\": [\n");
     if (redumpStyle)
     {
@@ -2515,7 +2520,7 @@ static BOOL WriteXboxDvdMediaProfileFile(const char *isoFilename,
         fprintf(json, "      }\n");
     }
     fprintf(json, "    ],\n");
         fprintf(json, "      }\n");
     }
     fprintf(json, "    ],\n");
-    fprintf(json, "    \"note\": \"Padding/filler ranges are intentionally zero-filled placeholders until a drive/workflow capable of reading those regions is available.\"\n");
+    fprintf(json, "    \"note\": \"Pregame and postgame physical locations are verified by cache-aligned raw sector IDs, but their inaccessible contents remain zero-filled placeholders. The 32-sector game lead-in is drive-captured from unlocked LBA 0..31.\"\n");
     fprintf(json, "  },\n");
 
     fprintf(json, "  \"dvd_structures\": {\n");
     fprintf(json, "  },\n");
 
     fprintf(json, "  \"dvd_structures\": {\n");
@@ -2628,6 +2633,9 @@ static BOOL WriteXboxDvdSidecarFiles(const char *isoFilename,
         fprintf(json, "      \"pregame_padding_start_lba\": %u,\n", redumpStyle ? XGD1_VIDEO_L0_SECTORS : 0U);
         fprintf(json, "      \"pregame_padding_sector_count\": %u,\n", redumpStyle ? (XGD1_GAME_OUTPUT_START_LBA - XGD1_VIDEO_L0_SECTORS) : 0U);
         fprintf(json, "      \"game_output_start_lba\": %u,\n", gameOutputLba);
         fprintf(json, "      \"pregame_padding_start_lba\": %u,\n", redumpStyle ? XGD1_VIDEO_L0_SECTORS : 0U);
         fprintf(json, "      \"pregame_padding_sector_count\": %u,\n", redumpStyle ? (XGD1_GAME_OUTPUT_START_LBA - XGD1_VIDEO_L0_SECTORS) : 0U);
         fprintf(json, "      \"game_output_start_lba\": %u,\n", gameOutputLba);
+        fprintf(json, "      \"game_leadin_unlocked_source_start_lba\": %u,\n", redumpStyle ? 0U : gameSourceLba);
+        fprintf(json, "      \"game_leadin_source_sector_count\": %u,\n", redumpStyle ? XGD1_XISO_LEADIN_SECTORS : 0U);
+        fprintf(json, "      \"game_leadin_source\": "); JsonWriteEscapedString(json, redumpStyle ? "drive_read10" : "not_applicable"); fprintf(json, ",\n");
         fprintf(json, "      \"game_unlocked_source_start_lba\": %u,\n", gameSourceLba);
         fprintf(json, "      \"game_unlocked_source_sector_count\": %u,\n", redumpStyle ? XGD1_GAME_SOURCE_SECTORS : gameSectors);
         fprintf(json, "      \"game_xiso_leadin_sector_count\": %u,\n", redumpStyle ? XGD1_XISO_LEADIN_SECTORS : 0U);
         fprintf(json, "      \"game_unlocked_source_start_lba\": %u,\n", gameSourceLba);
         fprintf(json, "      \"game_unlocked_source_sector_count\": %u,\n", redumpStyle ? XGD1_GAME_SOURCE_SECTORS : gameSectors);
         fprintf(json, "      \"game_xiso_leadin_sector_count\": %u,\n", redumpStyle ? XGD1_XISO_LEADIN_SECTORS : 0U);
@@ -2941,20 +2949,28 @@ BOOL DumpXboxGameDisc(HANDLE hDevice, const char *filename, char xisoFormat, uin
                 printf("[WARN] XDFS was detected at unlocked source LBA %u, not the expected XISO header LBA 32.\n", detectedXdfsLba);
             }
 
                 printf("[WARN] XDFS was detected at unlocked source LBA %u, not the expected XISO header LBA 32.\n", detectedXdfsLba);
             }
 
-            // Build the Redump-style XISO/game region using the same proven
-            // convention as option 2: the first 32 sectors are synthetic XISO
-            // lead-in/padding, and the real XDFS volume begins at source LBA 32.
-            // Do not read unlocked source LBA 0..31 here; on the 8050L path those
-            // LBAs are not the XDFS header sectors we want in the rebuilt image.
+            // FriiDump 0.5.3.13 cache-aligned raw-ID validation proved that
+            // unlocked source LBA 0..31 is the physical 32-sector game-region
+            // lead-in and that XDVDFS begins at source LBA 32. Preserve the
+            // drive-captured lead-in instead of synthesizing zero sectors.
             gameSourceLba = XGD1_GAME_SOURCE_START_LBA;
             gameSectors = REDUMP_SECTORS;
             rawVideoSectors = XGD1_GAME_OUTPUT_START_LBA;
             rawGameSourceLba = gameSourceLba;
             rawGameSectors = gameSectors;
 
             gameSourceLba = XGD1_GAME_SOURCE_START_LBA;
             gameSectors = REDUMP_SECTORS;
             rawVideoSectors = XGD1_GAME_OUTPUT_START_LBA;
             rawGameSourceLba = gameSourceLba;
             rawGameSectors = gameSectors;
 
-            printf("[RAW] Writing %u-sector XISO lead-in/padding at output LBA %u.\n",
-                   XGD1_XISO_LEADIN_SECTORS, XGD1_GAME_OUTPUT_START_LBA);
-            if (!WriteZeroSectorsOutput(outFile, hHash, XGD1_XISO_LEADIN_SECTORS, XGD1_GAME_OUTPUT_START_LBA, "GAME-XISO-LEADIN"))
+            printf("[RAW] Capturing %u-sector game lead-in from unlocked source LBA 0..%u at output LBA %u.\n",
+                   XGD1_XISO_LEADIN_SECTORS,
+                   XGD1_XISO_LEADIN_SECTORS - 1,
+                   XGD1_GAME_OUTPUT_START_LBA);
+            if (!DumpSectorRangeWithRetry(hDevice,
+                                          outFile,
+                                          hHash,
+                                          0,
+                                          XGD1_XISO_LEADIN_SECTORS,
+                                          XGD1_GAME_OUTPUT_START_LBA,
+                                          "GAME-XISO-LEADIN",
+                                          TRUE))
             {
                 VirtualFree(videoL1Buffer, 0, MEM_RELEASE);
                 goto cleanup;
             {
                 VirtualFree(videoL1Buffer, 0, MEM_RELEASE);
                 goto cleanup;