Skip to content

Commit

Permalink
fix squirrel stuff + notes
Browse files Browse the repository at this point in the history
  • Loading branch information
catornot committed Jan 23, 2024
1 parent 209a8b4 commit 9784abf
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 10 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ default-target = "x86_64-pc-windows-msvc"
targets = ["x86_64-pc-windows-msvc"]

[features]
default = []
async_engine = []
2 changes: 1 addition & 1 deletion src/bindings/squirrelfunctions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ offset_functions! {

sq_raiseerror = sq_raiseerrorType where offset(0x8440);

sq_getstring = sq_getstringType where offset(0x5840);
sq_getstring = sq_getstringType where offset(0x60A0);
sq_getinteger = sq_getintegerType where offset(0x60C0);
sq_getfloat = sq_getfloatType where offset(0x60E0);
sq_getbool = sq_getboolType where offset(0x6110);
Expand Down
2 changes: 2 additions & 0 deletions src/high/engine_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ macro_rules! into_squirrel_args_impl{
)* }
}

// TODO: add single parameter

into_squirrel_args_impl! {
(T1: 0);
(T1: 0, T2: 1);
Expand Down
4 changes: 2 additions & 2 deletions src/high/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ pub mod squirrel;
pub mod squirrel_traits;
pub mod vector;

#[cfg(feature = "async_engine ")]
#[cfg(feature = "async_engine")]
pub mod engine_sync;

#[doc(hidden)]
#[cfg(not(feature = "async_engine "))]
#[cfg(not(feature = "async_engine"))]
pub mod engine_sync {
#[doc(hidden)]
#[inline(always)]
Expand Down
12 changes: 6 additions & 6 deletions src/high/squirrel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ impl CSquirrelVMHandle {
) -> Self {
unsafe {
match (context, is_being_dropped) {
(ScriptContext::SERVER, true) => {
(ScriptContext::SERVER, false) => {
_ = SQVM_SERVER.get(token).replace(Some((*handle).sqvm))
}
(ScriptContext::SERVER, false) => _ = SQVM_SERVER.get(token).replace(None),
(ScriptContext::CLIENT, true) => {
(ScriptContext::SERVER, true) => _ = SQVM_SERVER.get(token).replace(None),
(ScriptContext::CLIENT, false) => {
_ = SQVM_CLIENT.get(token).replace(Some((*handle).sqvm))
}
(ScriptContext::CLIENT, false) => _ = SQVM_CLIENT.get(token).replace(None),
(ScriptContext::UI, true) => _ = SQVM_UI.get(token).replace(Some((*handle).sqvm)),
(ScriptContext::UI, false) => _ = SQVM_UI.get(token).replace(None),
(ScriptContext::CLIENT, true) => _ = SQVM_CLIENT.get(token).replace(None),
(ScriptContext::UI, false) => _ = SQVM_UI.get(token).replace(Some((*handle).sqvm)),
(ScriptContext::UI, true) => _ = SQVM_UI.get(token).replace(None),
}
}
Self {
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use windows::{

use crate::{bindings::plugin_abi::CreateInterface, mid::utils::try_cstring};

// TODO: impl Sync and Send for interfaces since they are unsafe the reponsibility falls on the user to mamnage from where they are called and some are thread safe

#[macro_export]
macro_rules! create_external_interface {
{ $struct_vis:vis $interface_name:ident + $mod_name:ident => {$($func_vis:vis fn $name:ident( $( $arg_name:ident : $arg:ty),*) -> $output:ty );*;}} => {
Expand Down
5 changes: 5 additions & 0 deletions src/interfaces/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ pub unsafe fn register_interface<T: Send + Sync + 'static + AsInterface>(
UnsafeHandle::internal_new(Box::leak(Box::new(interface)) as *const _ as *const c_void),
);
}

// TODO: implement this
// pub unsafe fn get_local(

// )
1 change: 1 addition & 0 deletions src/macros/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ macro_rules! entry {
pub(crate) use exports::PLUGIN;
#[doc(hidden)]
pub(crate) mod exports {
#![allow(non_snake_case)]
use super::$plugin;

use high::engine::EngineData;
Expand Down

0 comments on commit 9784abf

Please sign in to comment.