Skip to content

adds a version struct helper#105

Merged
Absolucy merged 2 commits into
masterfrom
versioned-structs
May 28, 2026
Merged

adds a version struct helper#105
Absolucy merged 2 commits into
masterfrom
versioned-structs

Conversation

@Absolucy
Copy link
Copy Markdown
Collaborator

@Absolucy Absolucy commented May 24, 2026

this adds a new proc macro for auxtools, #[versioned], used for having "versioned" internal structs - basically, it automatically implements the BytecodePre1630 and BytecodePost1630 stuff:

#[versioned(
	Pre1630 if crate::version::BYOND_VERSION_MINOR <= 1627,
	Post1630,
)]
#[repr(C)]
pub struct ProcMetadata {
	#[only_in(Post1630)]
	unk_2: u32,
	pub bytecode: misc::BytecodeId,
	pub locals: misc::LocalsId,
	pub parameters: misc::ParametersId
}

// ...

#[versioned(
	Pre516 if crate::version::BYOND_VERSION_MAJOR < 516,
	Post516,
)]
#[repr(C)]
struct ProcInstanceInner {
	#[only_in(Post516)]
	unk_pre: u32,
	pub args_count: u32,
	pub args: *mut values::Value,
	#[only_in(Pre516)]
	unk_3: [u8; 0x58],
	#[only_in(Post516)]
	unk_4: [u8; 0x58],
	pub time_to_resume: u32
}

some part of me is thinking there's still a better way to do this, but i can't quite figure out how to describe it tbh

also i fixed a random clippy lint in list.rs that was annoying me

Comment thread auxtools-impl/src/versioned_struct.rs Outdated
Comment thread auxtools-impl/src/versioned_struct.rs Outdated
Comment thread auxtools-impl/src/versioned_struct.rs Outdated
@Absolucy Absolucy merged commit e397eee into master May 28, 2026
2 checks passed
@Absolucy Absolucy deleted the versioned-structs branch May 28, 2026 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants