diff --git a/README.md b/README.md index 0710608d4d..a5f77b72b2 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,7 @@ xcl rpf D:\data\shaders.rpf --extract NAME --out folder toolchain are unchanged; `XCL_TRANSLATED_CACHE=0` disables that disk cache. - Every run writes `report.json` (called stubs, unknown D3D12.X slots and interfaces, XGameRuntime classes asked for, shader statistics, audio formats, crash). + `XErrorReport` log entries label messages supplied by the title, including any repair advice. `d3d12.presents` counts presentations, not visible content. With `XCL_FRAME_DUMP=N` (`N > 1`), the existing optional frame dumps also set `d3d12.last_frame_dump`: the latest sampled frame's zero-based index, source dimensions, DXGI format, sample step, sample count and `non_dark_samples` diff --git a/crates/xcl/src/hle/xgameruntime/api.rs b/crates/xcl/src/hle/xgameruntime/api.rs index 13406406db..93048b0f8b 100644 --- a/crates/xcl/src/hle/xgameruntime/api.rs +++ b/crates/xcl/src/hle/xgameruntime/api.rs @@ -218,7 +218,7 @@ static ERROR_OPTIONS: AtomicUsize = AtomicUsize::new(0); pub unsafe extern "system" fn XErrorReport(hr: HRESULT, message: *const u8) { let text = crate::util::from_cstr_ptr(message).unwrap_or_default(); - crate::xlog_warn!("XErrorReport {:#x}: {text}", hr as u32); + crate::xlog_warn!("XErrorReport {:#x} (reported by the title): {text}", hr as u32); // Copy and release `ERROR_CB` before invoking the guest callback so re-entrant calls to // `XErrorSetCallback` or `XErrorReport` do not deadlock. let entry = *ERROR_CB.lock().unwrap(); diff --git a/crates/xcl/tests/e2e.rs b/crates/xcl/tests/e2e.rs index 57301087f2..2822ac1428 100644 --- a/crates/xcl/tests/e2e.rs +++ b/crates/xcl/tests/e2e.rs @@ -132,6 +132,13 @@ fn test_title_runs_and_game_folder_is_untouched() { assert!(fails.is_empty(), "failed checks in the test title:\n{}", fails.join("\n")); assert!(stdout.contains("xcl_testtitle: done, failures: 0"), "the test title did not run to the end"); assert!(out.status.success(), "exit code {:?}", out.status.code()); + assert!( + stderr.contains(concat!( + "XErrorReport 0x89240107 (reported by the title): ", + "XGameRuntime is missing required dependencies, run GamingRepair.exe to resolve.", + )), + "XErrorReport should identify the source of the message" + ); // (2) the game folder is untouched assert_eq!(snapshot(&game), before, "GAME FOLDER WAS MODIFIED"); diff --git a/tests/testtitle/src/main.rs b/tests/testtitle/src/main.rs index d5ae267a44..c4ce337462 100644 --- a/tests/testtitle/src/main.rs +++ b/tests/testtitle/src/main.rs @@ -453,6 +453,19 @@ fn main() { Ok(()) }); + check("XGameRuntime: report a title error", || unsafe { + let h = LoadLibraryW(wide("xgameruntime.dll").as_ptr()); + ensure!(h != 0, "LoadLibrary(xgameruntime) failed"); + let f = GetProcAddress(h, b"XErrorReport\0".as_ptr()); + ensure!(f != 0, "XErrorReport not found"); + let report: unsafe extern "system" fn(i32, *const u8) = std::mem::transmute(f); + report( + 0x89240107u32 as i32, + b"XGameRuntime is missing required dependencies, run GamingRepair.exe to resolve.\0".as_ptr(), + ); + Ok(()) + }); + check("game DLL: static import + DllMain + TLS + its own kernelx import", || unsafe { ensure!(mw_attached() == 1, "DllMain(PROCESS_ATTACH) not run"); ensure!(mw_add(2, 3) == 5, "mw_add");