Skip to content

Commit

Permalink
feat: add stream toggle context method
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy committed Oct 23, 2024
1 parent dcc5862 commit 89ea6c9
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ecsact/wasm/detail/guest_imports/env.hh
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,20 @@ const auto guest_env_module_imports = allowed_guest_imports_t{
};
},
},
{
"ecsact_system_execution_context_stream_toggle",
[]() -> minst_import_resolve_func {
return {
wasm_functype_new_4_0(
wasm_valtype_new(WASM_I32), // context
wasm_valtype_new(WASM_I32), // component_id
wasm_valtype_new(WASM_I32), // streaming_enabled
wasm_valtype_new(WASM_I32) // indexed_fields
),
&wasm_ecsact_system_execution_context_stream_toggle,
};
},
},
};

} // namespace ecsact::wasm::detail
18 changes: 18 additions & 0 deletions ecsact/wasm/detail/wasm_ecsact_system_execution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,21 @@ wasm_trap_t* wasm_ecsact_system_execution_context_entity(

return nullptr;
}

wasm_trap_t* wasm_ecsact_system_execution_context_stream_toggle(
const wasm_val_vec_t* args,
wasm_val_vec_t* results
) {
debug_trace_method("ecsact_system_execution_context_stream_toggle");

auto ctx = get_execution_context(args->data[0]);
auto memory = get_execution_context_memory(args->data[0]);

ecsact_system_execution_context_add(
ctx,
ecsact_id_from_wasm_i32<ecsact_component_like_id>(args->data[1]),
get_const_void_ptr(args->data[2], memory)
);

return nullptr;
}
5 changes: 5 additions & 0 deletions ecsact/wasm/detail/wasm_ecsact_system_execution.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,9 @@ wasm_trap_t* wasm_ecsact_system_execution_context_entity(
wasm_val_vec_t* results
);

wasm_trap_t* wasm_ecsact_system_execution_context_stream_toggle(
const wasm_val_vec_t* args,
wasm_val_vec_t* results
);

#endif // WASM_ECSACT_SYSTEM_EXECUTION__H

0 comments on commit 89ea6c9

Please sign in to comment.