Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions auxtools/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ impl StackFrame {

// Make sure to handle arguments/locals with no names (when there are more
// values than names)
let args = (0..(*instance).args_count)
let args = (0..(*instance).args_count())
.map(|i| {
let name = param_names.get(i as usize).cloned();
(name, Value::from_raw(*((*instance).args).add(i as usize)))
(name, Value::from_raw(*((*instance).args()).add(i as usize)))
})
.collect();

Expand Down Expand Up @@ -87,9 +87,9 @@ enum CallStackKind {
}

impl Default for CallStacks {
fn default() -> Self {
Self::new()
}
fn default() -> Self {
Self::new()
}
}

impl CallStacks {
Expand Down
89 changes: 86 additions & 3 deletions auxtools/src/raw_types/procs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,93 @@ pub struct ProcInstance {
argslist_idx: values::ValueData,
unk_1: u32,
unk_2: u32,
pub args_count: u32,
pub args: *mut values::Value,
inner: ProcInstanceInner
}

impl ProcInstance {
#[inline(never)]
fn args_count_pre516(this: &Self) -> u32 {
unsafe { this.inner.pre516.args_count }
}

#[inline(never)]
fn args_count_post516(this: &Self) -> u32 {
unsafe { this.inner.post516.args_count }
}

pub fn args_count(&self) -> u32 {
static REDIRECT: OnceLock<fn(&ProcInstance) -> u32> = OnceLock::new();
REDIRECT.get_or_init(|| unsafe {
match crate::version::BYOND_VERSION_MAJOR {
..516 => Self::args_count_pre516,
_ => Self::args_count_post516
}
})(self)
}

#[inline(never)]
fn args_pre516(this: &Self) -> *mut values::Value {
unsafe { this.inner.pre516.args }
}

#[inline(never)]
fn args_post516(this: &Self) -> *mut values::Value {
unsafe { this.inner.post516.args }
}

pub fn args(&self) -> *mut values::Value {
static REDIRECT: OnceLock<fn(&ProcInstance) -> *mut values::Value> = OnceLock::new();
REDIRECT.get_or_init(|| unsafe {
match crate::version::BYOND_VERSION_MAJOR {
..516 => Self::args_pre516,
_ => Self::args_post516
}
})(self)
}

#[inline(never)]
fn time_to_resume_pre516(this: &Self) -> u32 {
unsafe { this.inner.pre516.time_to_resume }
}

#[inline(never)]
fn time_to_resume_post516(this: &Self) -> u32 {
unsafe { this.inner.post516.time_to_resume }
}

pub fn time_to_resume(&self) -> u32 {
static REDIRECT: OnceLock<fn(&ProcInstance) -> u32> = OnceLock::new();
REDIRECT.get_or_init(|| unsafe {
match crate::version::BYOND_VERSION_MAJOR {
..516 => Self::time_to_resume_pre516,
_ => Self::time_to_resume_post516
}
})(self)
}
}
#[repr(C)]
union ProcInstanceInner {
pre516: ProcInstanceInnerPre516,
post516: ProcInstanceInnerPost516
}

#[repr(C)]
#[derive(Copy, Clone)]
struct ProcInstanceInnerPre516 {
args_count: u32,
args: *mut values::Value,
unk_3: [u8; 0x58],
pub time_to_resume: u32
time_to_resume: u32
}

#[repr(C)]
#[derive(Copy, Clone)]
pub struct ProcInstanceInnerPost516 {
unk_3: u32,
args_count: u32,
args: *mut values::Value,
unk_4: [u8; 0x58],
time_to_resume: u32
}

#[repr(C)]
Expand Down
2 changes: 1 addition & 1 deletion debug_server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "debug_server"
version = "2.3.4"
version = "2.3.5"
publish = false
authors.workspace = true
edition.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion debug_server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ impl Server {
(*instance).src = value.raw;
}
ArgType::Arg(idx) => {
let args = (*instance).args;
let args = (*instance).args();
let arg = args.add(*idx as usize);
let _ = Value::from_raw_owned(*arg);
(*arg) = value.raw;
Expand Down
Loading