Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion crates/xcl/src/hle/xgameruntime/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
7 changes: 7 additions & 0 deletions crates/xcl/tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
13 changes: 13 additions & 0 deletions tests/testtitle/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Loading