~spiral/fantasy_console

00cb581ea1f9ee006bb087f2f9201987cd5eb049 — spiral 2 months ago 9f620f7
fix: remove vendored quickjs main loop (as expected, it breaks stuff)

Fixes timeouts not running
2 files changed, 6 insertions(+), 27 deletions(-)

M lib/javascript_main.c
M quickjs
M lib/javascript_main.c => lib/javascript_main.c +5 -26
@@ 16,6 16,10 @@

extern unsigned char IMAGE_CODE_DATA[229376];

#ifndef raylib_update_image
void raylib_update_image(void);
#endif

JSValue use_image_1(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) {
    memcpy(IMAGE_CODE_DATA, image1data, 229376);
    raylib_update_image();


@@ 89,32 93,7 @@ void javascript_init(void)
}

void javascript_run_loop(void) {
    // copy pasted frmo quickjs-libc.c
    JSContext *ctx1;
    int err;

    for(;;) {
        /* execute the pending jobs */
        for(;;) {
            err = JS_ExecutePendingJob(JS_GetRuntime(ctx), &ctx1);
            if (err <= 0) {
                    if (err < 0) {
                            js_std_dump_error(ctx1);
                    }
                    break;
            }

            // check if raylib window needs to close
            if (WindowShouldClose()) break;
        }

        // I hope removing this doesn't break anything? lol
        // if (!os_poll_func || os_poll_func(ctx))
        //         break;

        // check if raylib window needs to close
        if (WindowShouldClose()) break;
    }
    js_std_loop(ctx);
}

void javascript_teardown(void) {

M quickjs => quickjs +1 -1
@@ 1,1 1,1 @@
Subproject commit 97825c54631dab772262313535fce989a342f0e1
Subproject commit 57ead32d6dd0c792005f794e7945117db7b2c103