stanoddly / DotnetRaylibWasm

Prototype for .NET 7 with Raylib compiled into WebAssembly (wasm)
MIT License
61 stars 8 forks source link

abort happens when Raylib.WindowShouldClose is used #3

Closed stanoddly closed 1 year ago

stanoddly commented 1 year ago

When Raylib.WindowShouldClose() is used the script of the web page just dies with abort. This is pretty bad since it's the core functionality of Raylib's loop.

This is how it looks like:

dotnet.js:1290 

       Aborted(RuntimeError: unreachable)
abort @ dotnet.js:1290
dotnet.js:1311 

       Uncaught RuntimeError: Aborted(RuntimeError: unreachable). Build with -sASSERTIONS for more info.
    at abort (dotnet.js:1311:11)
    at runAndAbortIfError (dotnet.js:11001:9)
    at Object.maybeStopUnwind (dotnet.js:11044:11)
    at ret.<computed> (dotnet.js:11026:30)
    at Module._mono_wasm_invoke_method_bound [as mono_wasm_invoke_method_bound] (dotnet.js:11880:135)
    at Ws (dotnet.js:5:55694)
    at Object._bound_cs_WebTest_RayThing_Start (_bound_cs_WebTest_RayThing_Start:9:3)
    at main.js:30:32
stanoddly commented 1 year ago

I guess the reason behind that could be asyncify, see comment here: https://github.com/disketteman/DotnetRaylibWasm/issues/1#issuecomment-1329639010

With that being said I won't move forward with WindowShouldClose anyway.

stanoddly commented 1 year ago

This is literally how WindowShouldClose looks like on Web:

#if defined(PLATFORM_WEB)
    // [...] COMMENTS REMOVED
    emscripten_sleep(16);
    return false;
#endif

https://github.com/raysan5/raylib/blob/50a716c0d91f90e73f1fe2b910b3f7426a0d1360/src/rcore.c#L1084

So there is no reason to use it to pay the performance cost of ASYNCIFY.