From 6bd18afffa0892e9a77bdef89d07e6bf6036dc91 Mon Sep 17 00:00:00 2001 From: EatCodeSleep2 <52021568+EatCodeSleep2@users.noreply.github.com> Date: Tue, 24 Nov 2026 09:00:56 -0800 Subject: [PATCH] HLE: complete XPackage progress callback unregistration (cherry picked from commit 4f54c4775574e78ea7a869eae6605a401b107db3) --- crates/victory-hle/src/modules/xpackage.rs | 40 +++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/crates/victory-hle/src/modules/xpackage.rs b/crates/victory-hle/src/modules/xpackage.rs index 315faac..9fad9a3 100644 --- a/crates/victory-hle/src/modules/xpackage.rs +++ b/crates/victory-hle/src/modules/xpackage.rs @@ -136,6 +136,16 @@ extern "system" fn register_progress( put(out, token()) } +/// The completed installation has no pending progress callbacks to wait for. +extern "system" fn unregister_progress( + _: This, + _monitor: *const c_void, + _token: u64, + _wait: bool, +) -> bool { + true +} + /// 0: ready. // shortcut: every selector counts as installed, including ones the // package's layout does not have (the console answers those with an @@ -279,7 +289,7 @@ static VTABLE: Methods<40> = Methods([ progress as *const (), // 0x38 missing::<8> as *const (), // 0x40 update a monitor register_progress as *const (), // 0x48 - missing::<10> as *const (), // 0x50 unregister it + unregister_progress as *const (), // 0x50 missing::<11> as *const (), // 0x58 user locale find_availability as *const (), // 0x60 missing::<13> as *const (), // 0x68 enumerate chunk availability @@ -316,6 +326,34 @@ mod tests { use super::*; use crate::modules::xgameruntime::method; + #[test] + fn completed_installation_unregisters_progress_immediately() { + type Register = + extern "system" fn(This, *const c_void, *mut c_void, *const c_void, *mut u64) -> HRESULT; + type Unregister = extern "system" fn(This, *const c_void, u64, bool) -> bool; + extern "system" fn callback(_: *mut c_void, _: *const c_void) {} + + let this: This = &OBJECT; + let register = method::(&OBJECT, 0x48); + assert_eq!(VTABLE.0[0x50 / 8], unregister_progress as *const ()); + let unregister = method::(&OBJECT, 0x50); + for wait in [false, true] { + let mut token = 0; + assert_eq!( + register( + this, + monitor(), + std::ptr::null_mut(), + callback as *const c_void, + &mut token + ), + S_OK + ); + assert_ne!(token, 0); + assert!(unregister(this, monitor(), token, wait)); + } + } + #[test] fn the_installation_is_complete_and_alone() { let this: This = &OBJECT;