HLE: complete XPackage progress callback unregistration
(cherry picked from commit 4f54c4775574e78ea7a869eae6605a401b107db3)
This commit is contained in:
1 parent
4ae3490420
commit
6bd18afffa
1 file changed
+39
-1
@@ -136,6 +136,16 @@ extern "system" fn register_progress(
|
|||||||
put(out, token())
|
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.
|
/// 0: ready.
|
||||||
// shortcut: every selector counts as installed, including ones the
|
// shortcut: every selector counts as installed, including ones the
|
||||||
// package's layout does not have (the console answers those with an
|
// 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
|
progress as *const (), // 0x38
|
||||||
missing::<8> as *const (), // 0x40 update a monitor
|
missing::<8> as *const (), // 0x40 update a monitor
|
||||||
register_progress as *const (), // 0x48
|
register_progress as *const (), // 0x48
|
||||||
missing::<10> as *const (), // 0x50 unregister it
|
unregister_progress as *const (), // 0x50
|
||||||
missing::<11> as *const (), // 0x58 user locale
|
missing::<11> as *const (), // 0x58 user locale
|
||||||
find_availability as *const (), // 0x60
|
find_availability as *const (), // 0x60
|
||||||
missing::<13> as *const (), // 0x68 enumerate chunk availability
|
missing::<13> as *const (), // 0x68 enumerate chunk availability
|
||||||
@@ -316,6 +326,34 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::modules::xgameruntime::method;
|
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::<Register>(&OBJECT, 0x48);
|
||||||
|
assert_eq!(VTABLE.0[0x50 / 8], unregister_progress as *const ());
|
||||||
|
let unregister = method::<Unregister>(&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]
|
#[test]
|
||||||
fn the_installation_is_complete_and_alone() {
|
fn the_installation_is_complete_and_alone() {
|
||||||
let this: This = &OBJECT;
|
let this: This = &OBJECT;
|
||||||
|
|||||||
Reference in new issue
Block a user