Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/hooks/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use std::str::FromStr;

use bxt_macros::pattern;
use bxt_patterns::Patterns;
use serde::{Deserialize, Serialize};

use crate::ffi::com_model::{mleaf_s, model_s};
use crate::ffi::command::cmd_function_s;
Expand Down Expand Up @@ -1322,7 +1323,7 @@ impl SCREENINFO {
}
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Deserialize, Serialize)]
pub struct RngState {
pub idum: c_int,
pub iy: c_int,
Expand Down
6 changes: 6 additions & 0 deletions src/hooks/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#![allow(non_snake_case, non_upper_case_globals)]

use std::borrow::BorrowMut;
use std::os::raw::*;
use std::ptr::NonNull;

Expand Down Expand Up @@ -70,10 +71,15 @@ pub unsafe extern "C" fn my_CmdStart(
tas_recording::on_cmd_start(marker, *cmd, random_seed);
tas_optimizer::on_cmd_start(marker);

*RANDOM_SEED.borrow_mut(marker) = Some(random_seed);

CmdStart.get(marker)(player, cmd, random_seed);
})
}

// TODO: directly grab from server, see comment https://github.com/YaLTeR/bxt-rs/pull/110#discussion_r1899846171
pub static RANDOM_SEED: MainThreadRefCell<Option<c_uint>> = MainThreadRefCell::new(None);

pub unsafe extern "C" fn my_PM_Move(ppmove: *mut playermove_s, server: c_int) {
abort_on_panic(move || {
let marker = MainThreadMarker::new();
Expand Down
Loading