+ if (options.xgd1_layout_probe || options.xgd1_raw_id_probe) {
+#ifdef WIN32
+ int media_rc;
+ int media_sense_key;
+ int media_asc;
+ int media_ascq;
+ int probe_status;
+ bool stop_ok;
+ const char *probe_name;
+
+ probe_name = options.xgd1_raw_id_probe ? "XGD1 raw-sector ID" : "XGD1 logical-boundary";
+
+ if (!disc_is_xbox_challenge_drive (d)) {
+ fprintf (stderr,
+ "%s probe currently supports only the GDR-8050L challenge-handshake profile.\n",
+ probe_name);
+ return false;
+ }
+
+ if (options.xgd1_raw_id_probe &&
+ !(disc_get_hlds_e7_type (d) == 44 ||
+ disc_get_hlds_e7_type (d) == 45 ||
+ disc_get_hlds_e7_type (d) == 442 ||
+ disc_get_hlds_e7_type (d) == 443 ||
+ disc_get_hlds_e7_type (d) == 445)) {
+ fprintf (stderr,
+ "--xgd1-raw-id-probe requires the modified GDR-8050L HIT 0xE7 memdump profile.\n");
+ return false;
+ }
+
+ fprintf (stderr, "\nChecking for ready Xbox media before %s probing... ", probe_name);
+ media_rc = disc_media_preflight (d, 15000, &media_sense_key, &media_asc, &media_ascq);
+ if (media_rc <= 0) {
+ fprintf (stderr,
+ "Failed (sense %02X/%02X/%02X). Insert the disc, wait for spin-up, close AutoPlay/File Explorer, and retry.\n",
+ media_sense_key, media_asc, media_ascq);
+ return false;
+ }
+ fprintf (stderr, "OK\n");
+
+ gettimeofday (&(stats -> start_time), NULL);
+ if (options.xgd1_raw_id_probe)
+ probe_status = xbox_ref_xgd1_raw_id_probe_with_handle (
+ disc_get_native_handle (d), disc_get_device (d), options.xgd1_raw_id_probe_report);
+ else
+ probe_status = xbox_ref_xgd1_layout_probe_with_handle (
+ disc_get_native_handle (d), disc_get_device (d), options.xgd1_layout_probe_report);
+
+ fprintf (stderr, "Issuing STOP UNIT / spin-down after %s probe... ", probe_name);
+ stop_ok = disc_stop_unit (d, false);
+ fprintf (stderr, "%s\n", stop_ok ? "OK" : "Failed");
+ gettimeofday (&(stats -> end_time), NULL);
+ fprintf (stderr, "%s probe status: %s\n", probe_name, probe_status == 0 ? "OK" : "FAILED");
+ friidump_summary_reset();
+ return probe_status == 0;
+#else
+ fprintf (stderr, "XGD1 probe modes are available only in the Windows build.\n");
+ return false;
+#endif
+ }
+