Skip to content

Commit 0fffa26

Browse files
authored
feat: add stream toggle context method (#70)
1 parent dcc5862 commit 0fffa26

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

ecsact/wasm/detail/guest_imports/env.hh

+14
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,20 @@ const auto guest_env_module_imports = allowed_guest_imports_t{
150150
};
151151
},
152152
},
153+
{
154+
"ecsact_system_execution_context_stream_toggle",
155+
[]() -> minst_import_resolve_func {
156+
return {
157+
wasm_functype_new_4_0(
158+
wasm_valtype_new(WASM_I32), // context
159+
wasm_valtype_new(WASM_I32), // component_id
160+
wasm_valtype_new(WASM_I32), // streaming_enabled
161+
wasm_valtype_new(WASM_I32) // indexed_fields
162+
),
163+
&wasm_ecsact_system_execution_context_stream_toggle,
164+
};
165+
},
166+
},
153167
};
154168

155169
} // namespace ecsact::wasm::detail

ecsact/wasm/detail/wasm_ecsact_system_execution.cc

+18
Original file line numberDiff line numberDiff line change
@@ -290,3 +290,21 @@ wasm_trap_t* wasm_ecsact_system_execution_context_entity(
290290

291291
return nullptr;
292292
}
293+
294+
wasm_trap_t* wasm_ecsact_system_execution_context_stream_toggle(
295+
const wasm_val_vec_t* args,
296+
wasm_val_vec_t* results
297+
) {
298+
debug_trace_method("ecsact_system_execution_context_stream_toggle");
299+
300+
auto ctx = get_execution_context(args->data[0]);
301+
auto memory = get_execution_context_memory(args->data[0]);
302+
303+
ecsact_system_execution_context_add(
304+
ctx,
305+
ecsact_id_from_wasm_i32<ecsact_component_like_id>(args->data[1]),
306+
get_const_void_ptr(args->data[2], memory)
307+
);
308+
309+
return nullptr;
310+
}

ecsact/wasm/detail/wasm_ecsact_system_execution.h

+5
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,9 @@ wasm_trap_t* wasm_ecsact_system_execution_context_entity(
6565
wasm_val_vec_t* results
6666
);
6767

68+
wasm_trap_t* wasm_ecsact_system_execution_context_stream_toggle(
69+
const wasm_val_vec_t* args,
70+
wasm_val_vec_t* results
71+
);
72+
6873
#endif // WASM_ECSACT_SYSTEM_EXECUTION__H

0 commit comments

Comments
 (0)