Major work on WASM results
This commit is contained in:
@@ -7,6 +7,7 @@ use parking_lot::RwLock;
|
||||
use paste::paste;
|
||||
|
||||
use crate::dynamic_data::{Battle, DynamicLibrary, ExecutingMove, Pokemon, TurnChoice};
|
||||
use crate::script_implementations::wasm::export_registry::WasmVoidResult;
|
||||
use crate::script_implementations::wasm::extern_ref::{ExternRef, VecExternRef};
|
||||
use crate::script_implementations::wasm::script_resolver::WebAssemblyEnvironmentData;
|
||||
use crate::static_data::{EffectParameter, Item, TypeIdentifier};
|
||||
@@ -26,7 +27,7 @@ macro_rules! script_function_cache {
|
||||
script_get_name: RwLock<Option<TypedFunction<(u32), u32>>>,
|
||||
dealloc_cstring: RwLock<Option<TypedFunction<(u32), ()>>>,
|
||||
$(
|
||||
$name: RwLock<Option<TypedFunction<(u32$(, $par_type)*), ()>>>,
|
||||
$name: RwLock<Option<TypedFunction<(u32$(, $par_type)*), WasmVoidResult>>>,
|
||||
)*
|
||||
}
|
||||
|
||||
@@ -39,7 +40,7 @@ macro_rules! script_function_cache {
|
||||
let exported = env.exported_functions();
|
||||
let f = exported.get::<StringKey>(&stringify!([< script_ $name >]).into());
|
||||
if let Some(f) = f {
|
||||
let func: TypedFunction<(u32 $(,$par_type)*), ()> = f.typed(&env.store_ref()).unwrap();
|
||||
let func: TypedFunction<(u32 $(,$par_type)*), WasmVoidResult> = f.typed(&env.store_ref()).unwrap();
|
||||
let _ = self.$name.write().insert(func);
|
||||
}
|
||||
}
|
||||
@@ -49,7 +50,7 @@ macro_rules! script_function_cache {
|
||||
pub(crate) fn [<$name>](
|
||||
&self,
|
||||
env: &Arc<WebAssemblyEnvironmentData>,
|
||||
) -> Option<TypedFunction<(u32 $(,$par_type)*), ()>> {
|
||||
) -> Option<TypedFunction<(u32 $(,$par_type)*), WasmVoidResult>> {
|
||||
{
|
||||
let read_lock = self.$name.read();
|
||||
if let Some(f) = read_lock.as_ref() {
|
||||
|
||||
Reference in New Issue
Block a user