diff --git a/hook/src/hooks/mod.rs b/hook/src/hooks/mod.rs index 2f99136b..b5903ece 100644 --- a/hook/src/hooks/mod.rs +++ b/hook/src/hooks/mod.rs @@ -6,12 +6,11 @@ use std::{ ffi::c_void, path::{Path, PathBuf}, ptr::NonNull, - sync::{Arc, OnceLock}, + sync::OnceLock, }; use anyhow::{Context, Result}; use fs_err as fs; -use hook_resolvers::GasFixResolution; use mint_lib::DRGInstallationType; use windows::Win32::System::Memory::{VirtualProtect, PAGE_EXECUTE_READWRITE}; @@ -88,12 +87,6 @@ pub unsafe fn initialize() -> Result<()> { server_list::init_hooks()?; - if !globals().meta.config.disable_fix_exploding_gas { - if let Ok(gas_fix) = &globals().resolution.gas_fix { - apply_gas_fix(gas_fix)?; - } - } - let installation_type = DRGInstallationType::from_exe_path()?; match installation_type { @@ -143,45 +136,6 @@ pub unsafe fn initialize() -> Result<()> { Ok(()) } -unsafe fn apply_gas_fix(gas_fix: &Arc) -> Result<()> { - #[repr(C)] - struct UObjectTemperatureComponent { - padding: [u8; 0xd8], - on_start_burning: [u64; 2], - on_frozen_server: [u64; 2], - temperature_change_scale: f32, - burn_temperature: f32, - freeze_temperature: f32, - douse_fire_temperature: f32, - cooling_rate: f32, - is_heatsource_when_on_fire: bool, - on_fire_heat_range: f32, - timer_handle: u64, - is_object_on_fire: bool, - current_temperature: f32, - } - - let fn_process_multicast_delegate: unsafe extern "system" fn(*mut c_void, *mut c_void) = - std::mem::transmute(gas_fix.process_multicast_delegate.0); - - UObjectTemperatureComponentTimerCallback.initialize( - std::mem::transmute(gas_fix.timer_callback.0), - move |this| { - let obj = &*(this as *const UObjectTemperatureComponent); - let on_fire = obj.is_object_on_fire; - UObjectTemperatureComponentTimerCallback.call(this); - if !on_fire && obj.is_object_on_fire { - fn_process_multicast_delegate( - std::ptr::addr_of!(obj.on_start_burning) as *mut c_void, - std::ptr::null_mut(), - ); - } - }, - )?; - UObjectTemperatureComponentTimerCallback.enable()?; - Ok(()) -} - unsafe fn patch_mem(address: *mut u8, patch: impl AsRef<[u8]>) -> Result<()> { let patch = patch.as_ref(); let patch_mem = std::slice::from_raw_parts_mut(address, patch.len()); diff --git a/hook_resolvers/src/lib.rs b/hook_resolvers/src/lib.rs index 6b64d391..443bc7b0 100644 --- a/hook_resolvers/src/lib.rs +++ b/hook_resolvers/src/lib.rs @@ -106,29 +106,6 @@ impl_resolver_singleton!(PEImage, Disable, |ctx| async { Ok(Self(ensure_one(res.into_iter().flatten())?)) }); -#[derive(Debug, PartialEq)] -#[cfg_attr(feature = "serde-resolvers", derive(Serialize, Deserialize))] -pub struct UObjectTemperatureComponentTimerCallback(pub usize); -impl_resolver_singleton!(collect, UObjectTemperatureComponentTimerCallback); -impl_resolver_singleton!( - PEImage, - UObjectTemperatureComponentTimerCallback, - |ctx| async { - let patterns = ["40 55 57 41 56 48 8D 6C 24 ?? 48 81 EC 20 01 00 00"]; - let res = join_all(patterns.iter().map(|p| ctx.scan(Pattern::new(p).unwrap()))).await; - Ok(Self(ensure_one(res.into_iter().flatten())?)) - } -); -#[derive(Debug, PartialEq)] -#[cfg_attr(feature = "serde-resolvers", derive(Serialize, Deserialize))] -pub struct ProcessMulticastDelegate(pub usize); -impl_resolver_singleton!(collect, ProcessMulticastDelegate); -impl_resolver_singleton!(PEImage, ProcessMulticastDelegate, |ctx| async { - let patterns = ["4C 8B DC 57 41 54 41 56 48 81 EC A0 00 00 00"]; - let res = join_all(patterns.iter().map(|p| ctx.scan(Pattern::new(p).unwrap()))).await; - Ok(Self(ensure_one(res.into_iter().flatten())?)) -}); - impl_try_collector! { #[derive(Debug, PartialEq)] #[cfg_attr(feature = "serde-resolvers", derive(Serialize, Deserialize))] @@ -159,15 +136,6 @@ impl_try_collector! { } } -impl_try_collector! { - #[derive(Debug, PartialEq)] - #[cfg_attr(feature = "serde-resolvers", derive(Serialize, Deserialize))] - pub struct GasFixResolution { - pub timer_callback: UObjectTemperatureComponentTimerCallback, - pub process_multicast_delegate: ProcessMulticastDelegate, - } -} - impl_try_collector! { #[derive(Debug, PartialEq)] #[cfg_attr(feature = "serde-resolvers", derive(Serialize, Deserialize))] @@ -191,7 +159,6 @@ impl_collector! { pub server_name: ServerNameResolution, pub server_mods: ServerModsResolution, pub save_game: SaveGameResolution, - pub gas_fix: GasFixResolution, pub core: CoreResolution, } } diff --git a/mint_lib/src/mod_info.rs b/mint_lib/src/mod_info.rs index 10a7c5d6..576685b4 100644 --- a/mint_lib/src/mod_info.rs +++ b/mint_lib/src/mod_info.rs @@ -131,9 +131,7 @@ pub struct Meta { pub config: MetaConfig, } #[derive(Debug, Serialize, Deserialize)] -pub struct MetaConfig { - pub disable_fix_exploding_gas: bool, -} +pub struct MetaConfig {} #[derive(Debug, Serialize, Deserialize)] pub struct SemverVersion { pub major: u32, diff --git a/src/state/mod.rs b/src/state/mod.rs index e0bef7c9..d5a1771c 100644 --- a/src/state/mod.rs +++ b/src/state/mod.rs @@ -331,10 +331,6 @@ impl ModData!["0.1.0"] { } } -fn is_false(value: &bool) -> bool { - !value -} - #[obake::versioned] #[obake(version("0.0.0"))] #[derive(Debug, Serialize, Deserialize)] @@ -342,8 +338,6 @@ pub struct Config { pub provider_parameters: HashMap>, pub drg_pak_path: Option, pub gui_theme: Option, - #[serde(default, skip_serializing_if = "is_false")] - pub disable_fix_exploding_gas: bool, pub sorting_config: Option, } @@ -418,17 +412,14 @@ impl Default for Config!["0.0.0"] { .as_ref() .map(DRGInstallation::main_pak), gui_theme: None, - disable_fix_exploding_gas: false, sorting_config: None, } } } impl From<&VersionAnnotatedConfig> for MetaConfig { - fn from(value: &VersionAnnotatedConfig) -> Self { - MetaConfig { - disable_fix_exploding_gas: value.disable_fix_exploding_gas, - } + fn from(_value: &VersionAnnotatedConfig) -> Self { + MetaConfig {} } }