Fixing core to work with win32 #1257

This commit is contained in:
Hordur Johannsson 2024-08-25 15:37:39 +00:00 committed by Stephen Gutekanst
parent 17450fde65
commit 13e53e7176
3 changed files with 8 additions and 3 deletions

View file

@ -331,8 +331,8 @@ pub fn start(core: *Mod) !void {
const stack_space = try core.state().allocator.alloc(u8, 8 * 1024 * 1024);
if (supports_non_blocking) {
while (mach.mods.mod.mach_core.state != .exited) {
try mach.mods.dispatchUntil(stack_space, .mach_core, .frame_finished);
while (core.state().state != .exited) {
dispatch(stack_space);
}
// Don't return, because Platform.run wouldn't either (marked noreturn due to underlying
// platform APIs never returning.)
@ -348,6 +348,10 @@ pub fn start(core: *Mod) !void {
}
}
fn dispatch(stack_space: []u8) void {
mach.mods.dispatchUntil(stack_space, .mach_core, .frame_finished) catch { @panic("Dispatch in Core failed"); };
}
fn platform_update_callback(core: *Mod, stack_space: []u8) !bool {
// Execute systems until .mach_core.frame_finished is dispatched, signalling a frame was
// finished.