HLE: implement mfplat.dll!MFResetDXGIDeviceManagerX with system fallback #21
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-21T21:57:13Z.
Summary
Implements the Xbox GDK Media Foundation helper
mfplat.dll!MFResetDXGIDeviceManagerXwith transparent system fallback for all standard Media Foundation exports.Changes
crates/xcl/src/hle/mfplat.rs:MFResetDXGIDeviceManagerX(pDeviceManager, pDevice, resetToken) -> HRESULTusing the typedwindows::Win32::Media::MediaFoundation::IMFDXGIDeviceManagerCOM interface (borrowing caller-owned pointers withManuallyDrop).E_POINTER) and attemptsIMFDXGIDeviceManager::ResetDevicedirectly first (which succeeds natively forID3D12Deviceon Windows 11 and preservesE_INVALIDARGfor invalid reset tokens).ResetDevicefails for anID3D12Device, creates a companion D3D11 device (dynamically loaded fromd3d11.dll) on the matching adapter LUID withVIDEO_SUPPORT | BGRA_SUPPORTandID3D10Multithread::SetMultithreadProtected(TRUE), then passes it toResetDevicewith the caller'sresetToken.LoadLibrary+GetProcAddress, null pointer handling, invalid token rejection, realID3D12Devicereset +OpenDeviceHandle/TestDevice/CloseDeviceHandle, and the companion D3D11 bridge path.crates/xcl/src/hle/mod.rs:MFPLAT(mfplat.dll) with system fallback&[mfplat.dll](aliases_are_system() == false), so standard exports (MFStartup,MFCreateDXGIDeviceManager,MFCreateMediaType, etc.) resolve to Windows'mfplat.dllwhileMFResetDXGIDeviceManagerXresolves to XCL's HLE export andhle::opusdynamic loading remains unchanged.tests/testtitle/src/gpu.rs&tests/testtitle/src/main.rs:MFStartup,MFCreateDXGIDeviceManager,MFShutdown, andMFResetDXGIDeviceManagerXfrommfplat.dllagainst the consoled3d12_xsdevice.Verification
cargo build --workspace: 0 new warningscargo test --workspace -- --test-threads=4: all tests passed (243 lib unit tests, 12console_dlls_e2e, 1console_shaders, 1e2eincluding the newtesttitlecheck, 6gpu_pso_e2e, 3xg_oracle).Imported from ivall/xcl. Originally posted by ivall on 2026-11-21T22:54:08Z.
Reviewed and merged, thanks. It conflicted with #20 in
tests/testtitle/src/main.rs(both added a check line); I merged it on main keeping both lines (your MFPlat check and the XMA2 + Opus XAudio2 line). Checked together with #21, #22 and #25 on top of current main: full workspace tests pass (277 lib tests, e2e, console_dlls_e2e, gpu_pso_e2e, rpf_e2e), no new build warnings.