Skip to content

Commit

Permalink
update BXT exported function
Browse files Browse the repository at this point in the history
  • Loading branch information
khanghugo committed Jul 27, 2024
1 parent 9c7dead commit a2a5a0c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/hooks/bxt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use hltas::HLTAS;
use crate::modules::tas_studio;
use crate::utils::{abort_on_panic, MainThreadMarker, Pointer, PointerTrait};

pub static BXT_ON_TAS_PLAYBACK_FRAME: Pointer<
pub static BXT_ON_TAS_PLAYBACK_FRAME_V2: Pointer<
*mut Option<unsafe extern "C" fn(OnTasPlaybackFrameData) -> c_int>,
> = Pointer::empty(b"bxt_on_tas_playback_frame\0");
> = Pointer::empty(b"bxt_on_tas_playback_frame_v2\0");
pub static BXT_ON_TAS_PLAYBACK_STOPPED: Pointer<*mut Option<unsafe extern "C" fn()>> =
Pointer::empty(b"bxt_on_tas_playback_stopped\0");
pub static BXT_SIMULATION_IPC_IS_CLIENT_INITIALIZED: Pointer<unsafe extern "C" fn() -> c_int> =
Expand All @@ -31,7 +31,7 @@ pub static BXT_TAS_STUDIO_FREECAM_SET_ORIGIN: Pointer<unsafe extern "C" fn([c_fl
Pointer::empty(b"bxt_tas_studio_freecam_set_origin\0");

static POINTERS: &[&dyn PointerTrait] = &[
&BXT_ON_TAS_PLAYBACK_FRAME,
&BXT_ON_TAS_PLAYBACK_FRAME_V2,
&BXT_ON_TAS_PLAYBACK_STOPPED,
&BXT_SIMULATION_IPC_IS_CLIENT_INITIALIZED,
&BXT_TAS_LOAD_SCRIPT_FROM_STRING,
Expand Down Expand Up @@ -79,7 +79,7 @@ pub unsafe fn find_pointers(marker: MainThreadMarker) {
}

fn set_callbacks(marker: MainThreadMarker) {
if let Some(bxt_on_tas_playback_frame) = BXT_ON_TAS_PLAYBACK_FRAME.get_opt(marker) {
if let Some(bxt_on_tas_playback_frame) = BXT_ON_TAS_PLAYBACK_FRAME_V2.get_opt(marker) {
// SAFETY: this is a global variable in BXT which is accessed only from the main game thread
// (which is the current thread as we have a marker).
unsafe {
Expand Down
5 changes: 2 additions & 3 deletions src/modules/tas_studio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ use crate::handler;
use crate::hooks::bxt::{OnTasPlaybackFrameData, BXT_IS_TAS_EDITOR_ACTIVE};
use crate::hooks::engine::con_print;
use crate::hooks::{bxt, client, engine, sdl};
use crate::modules::tas_studio::editor::MaxAccelYawOffsetMode;
use crate::modules::tas_studio::editor::CameraViewAdjustmentMode;
use crate::modules::tas_studio::editor::{CameraViewAdjustmentMode, MaxAccelYawOffsetMode};
use crate::utils::*;

pub struct TasStudio;
Expand Down Expand Up @@ -120,7 +119,7 @@ impl Module for TasStudio {
&& sdl::SDL_GetMouseState.is_set(marker)
&& bxt::BXT_TAS_LOAD_SCRIPT_FROM_STRING.is_set(marker)
&& bxt::BXT_IS_TAS_EDITOR_ACTIVE.is_set(marker)
&& bxt::BXT_ON_TAS_PLAYBACK_FRAME.is_set(marker)
&& bxt::BXT_ON_TAS_PLAYBACK_FRAME_V2.is_set(marker)
&& bxt::BXT_ON_TAS_PLAYBACK_STOPPED.is_set(marker)
&& bxt::BXT_TAS_NEW.is_set(marker)
&& bxt::BXT_TAS_NOREFRESH_UNTIL_LAST_FRAMES.is_set(marker)
Expand Down

0 comments on commit a2a5a0c

Please sign in to comment.