fix: add null check for DitherConfig argument

This commit is contained in:
xeon 2025-05-25 19:18:07 +03:00
parent 747091ba61
commit 25a6caf0a3

View file

@ -34,8 +34,10 @@ impl NapModule for NapModuleContext<CensorshipPatch> {
impl CensorshipPatch { impl CensorshipPatch {
pub unsafe extern "win64" fn on_set_dither_config(reg: *mut Registers, _: usize) { pub unsafe extern "win64" fn on_set_dither_config(reg: *mut Registers, _: usize) {
if LAST_ENTER_SCENE_TYPE.load(Ordering::SeqCst) == SCENE_TYPE_HALL { if LAST_ENTER_SCENE_TYPE.load(Ordering::SeqCst) == SCENE_TYPE_HALL {
println!("SetDitherConfig: disabling dither alpha"); if (*reg).rdx != 0 {
*(((*reg).rdx as *mut u8).wrapping_add(DITHER_CONFIG_AVATAR_USING_DITHER_ALPHA)) = 0; println!("SetDitherConfig: disabling dither alpha");
*(((*reg).rdx as *mut u8).wrapping_add(DITHER_CONFIG_AVATAR_USING_DITHER_ALPHA)) = 0;
}
} else { } else {
println!("SetDitherConfig: not in hall, ignoring"); println!("SetDitherConfig: not in hall, ignoring");
} }