emscripten: Use EM_ASYNC_JS

This commit is contained in:
kichikuou
2024-07-31 08:59:33 +09:00
parent a6aa50b5cf
commit 42e994dfba
3 changed files with 11 additions and 13 deletions
+1 -1
View File
@@ -164,7 +164,7 @@ if (EMSCRIPTEN)
-sASYNCIFY=1
-sASYNCIFY_IGNORE_INDIRECT=1
-sASYNCIFY_REMOVE=SDL_Delay
-sASYNCIFY_IMPORTS=muspcm_load_no,muspcm_load_data,muspcm_load_mixlr,muspcm_waitend,wait_vsync,load_mincho_font
-sASYNCIFY_IMPORTS=wait_vsync
-sASYNCIFY_ADD=commands2F60,nact_main,send_agsevent,cb_waitkey_sprite
-sALLOW_MEMORY_GROWTH=1
-sNO_EXIT_RUNTIME=1
+2 -4
View File
@@ -235,9 +235,7 @@ boolean font_get_antialias(void) {
}
#ifdef __EMSCRIPTEN__
EM_JS(int, load_mincho_font, (void), {
return Asyncify.handleSleep(function(wakeUp) {
xsystem35.load_mincho_font().then(wakeUp);
});
EM_ASYNC_JS(int, load_mincho_font, (void), {
await xsystem35.load_mincho_font();
});
#endif
+8 -8
View File
@@ -36,16 +36,16 @@ EM_JS(int, muspcm_reset, (void), {
return xsystem35.audio.pcm_reset();;
});
EM_JS(int, muspcm_load_no, (int slot, int no), { // async
return Asyncify.handleSleep((wakeUp) => xsystem35.audio.pcm_load(slot, no, wakeUp));
EM_ASYNC_JS(int, muspcm_load_no, (int slot, int no), {
return await xsystem35.audio.pcm_load(slot, no);
});
EM_JS(int, muspcm_load_data, (int slot, uint8_t *buf, uint32_t len), { // async
return Asyncify.handleSleep((wakeUp) => xsystem35.audio.pcm_load_data(slot, buf, len, wakeUp));
EM_ASYNC_JS(int, muspcm_load_data, (int slot, uint8_t *buf, uint32_t len), {
return await xsystem35.audio.pcm_load_data(slot, buf, len);
});
EM_JS(int, muspcm_load_mixlr, (int slot, int noL, int noR), { // async
return Asyncify.handleSleep((wakeUp) => xsystem35.audio.pcm_load_mixlr(slot, noL, noR, wakeUp));
EM_ASYNC_JS(int, muspcm_load_mixlr, (int slot, int noL, int noR), {
return await xsystem35.audio.pcm_load_mixlr(slot, noL, noR);
});
EM_JS(int, muspcm_unload, (int slot), {
@@ -91,6 +91,6 @@ EM_JS(boolean, muspcm_isplaying, (int slot), {
return xsystem35.audio.pcm_isplaying(slot);
});
EM_JS(int, muspcm_waitend, (int slot), { // async
return Asyncify.handleSleep((wakeUp) => xsystem35.audio.pcm_waitend(slot, wakeUp));
EM_ASYNC_JS(int, muspcm_waitend, (int slot), {
return await xsystem35.audio.pcm_waitend(slot);
});