mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-22 22:48:08 +03:00
emscripten: Lazily load mincho font
This commit is contained in:
+6
-5
@@ -13,9 +13,10 @@ EMFLAGS += -s NO_EXIT_RUNTIME=1
|
||||
LFLAGS := $(EMFLAGS)
|
||||
LFLAGS += -s EXPORTED_FUNCTIONS="['_main','_ags_setAntialiasedStringMode', '_ald_getdata', '_ald_freedata', '_sjis2unicode']"
|
||||
LFLAGS += -s EXTRA_EXPORTED_RUNTIME_METHODS="['getValue','getMemory','addRunDependency','removeRunDependency']"
|
||||
LFLAGS += --js-library emscripten/library.js
|
||||
|
||||
SYNCLIST := -s EMTERPRETIFY_SYNCLIST="['_muspcm_load_no','_muspcm_load_mixlr','_wait_vsync']"
|
||||
JSLIB := --js-library emscripten/library.js
|
||||
|
||||
SYNCLIST := -s EMTERPRETIFY_SYNCLIST="['_muspcm_load_no','_muspcm_load_mixlr','_wait_vsync','_load_mincho_font']"
|
||||
|
||||
WASMFLAGS := -s WASM=1 -s "BINARYEN_TRAP_MODE='allow'"
|
||||
ASMJSFLAGS := -s WASM=0
|
||||
@@ -26,13 +27,13 @@ out:
|
||||
mkdir out
|
||||
|
||||
out/xsystem35.js: emterpretify_whitelist src/xsystem35 out
|
||||
$(CC) xsystem35.bc $(LFLAGS) $(WASMFLAGS) @emterpretify_whitelist -o $@
|
||||
$(CC) xsystem35.bc $(LFLAGS) $(JSLIB) $(WASMFLAGS) @emterpretify_whitelist -o $@
|
||||
|
||||
out/xsystem35.asm.js: emterpretify_whitelist src/xsystem35 out
|
||||
$(CC) xsystem35.bc $(LFLAGS) $(ASMJSFLAGS) @emterpretify_whitelist -o $@
|
||||
$(CC) xsystem35.bc $(LFLAGS) $(JSLIB) $(ASMJSFLAGS) @emterpretify_whitelist -o $@
|
||||
|
||||
emterpretify_whitelist:
|
||||
$(CC) $(EMPORTS) -s EMTERPRETIFY=1 -s EMTERPRETIFY_ADVISE=1 $(SYNCLIST) xsystem35.bc |grep EMTERPRETIFY_WHITELIST > $@
|
||||
$(CC) $(EMPORTS) -s EMTERPRETIFY=1 -s EMTERPRETIFY_ADVISE=1 $(SYNCLIST) $(JSLIB) xsystem35.bc |grep EMTERPRETIFY_WHITELIST > $@
|
||||
|
||||
src/xsystem35: src src/Makefile
|
||||
$(MAKE) -C src
|
||||
|
||||
@@ -7,6 +7,14 @@ mergeInto(LibraryManager.library, {
|
||||
});
|
||||
});
|
||||
},
|
||||
load_mincho_font: function() {
|
||||
return EmterpreterAsync.handle(function(resume) {
|
||||
xsystem35.load_mincho_font().then(function(result) {
|
||||
if (ABORT) return; // do this manually; we can't call into Browser.safeSetTimeout, because that is paused/resumed!
|
||||
resume(function() { return result; });
|
||||
});
|
||||
});
|
||||
},
|
||||
muspcm_init: function() {
|
||||
return 0; // OK
|
||||
},
|
||||
|
||||
@@ -1 +1 @@
|
||||
-s EMTERPRETIFY_WHITELIST='["_ags_eCopyArea", "_ags_fadeIn", "_ags_fadeOut", "_ags_fader", "_ags_whiteIn", "_ags_whiteOut", "_checkMessage", "_check_command", "_commandCD", "_commandCE", "_commandH", "_commandHH", "_commandIK", "_commandMP", "_commandPF", "_commandPW", "_commandSM", "_commandSP", "_commandSQ", "_commandVA", "_commandY", "_commandZT20", "_commandZT21", "_commands2F1E", "_commands2F21", "_commands2F7C", "_commands2F7D", "_commands2F7E", "_commands2F7F", "_eCopyArea1", "_eCopyArea11", "_eCopyArea12", "_eCopyArea13", "_eCopyArea14", "_eCopyArea15", "_eCopyArea16", "_eCopyArea17", "_eCopyArea18", "_eCopyArea19", "_eCopyArea2", "_eCopyArea20", "_eCopyArea21", "_eCopyArea22", "_eCopyArea23", "_eCopyArea24", "_eCopyArea25", "_eCopyArea26", "_eCopyArea3", "_eCopyArea33", "_eCopyArea34", "_eCopyArea39", "_eCopyArea4", "_eCopyArea40", "_eCopyArea48", "_eCopyArea49", "_eCopyArea5", "_eCopyArea5sp", "_eCopyArea6", "_eCopyArea7", "_eCopyArea8", "_eCopyArea9", "_main", "_msg_putMessage", "_mus_pcm_load", "_mus_pcm_mix", "_mus_pcm_start", "_nact_main", "_sdl_keywait", "_sdl_sleep", "_sdl_wait_vsync", "_sel_select", "_sys_addMsg", "_sys_hit_any_key", "_sys_key_releasewait"]'
|
||||
-s EMTERPRETIFY_WHITELIST='["_ags_eCopyArea", "_ags_fadeIn", "_ags_fadeOut", "_ags_fader", "_ags_whiteIn", "_ags_whiteOut", "_checkMessage", "_check_command", "_commandCD", "_commandCE", "_commandH", "_commandHH", "_commandIK", "_commandMP", "_commandPF", "_commandPW", "_commandSM", "_commandSP", "_commandSQ", "_commandVA", "_commandY", "_commandZT20", "_commandZT21", "_commandZZ13", "_commands2F1E", "_commands2F21", "_commands2F7C", "_commands2F7D", "_commands2F7E", "_commands2F7F", "_eCopyArea1", "_eCopyArea11", "_eCopyArea12", "_eCopyArea13", "_eCopyArea14", "_eCopyArea15", "_eCopyArea16", "_eCopyArea17", "_eCopyArea18", "_eCopyArea19", "_eCopyArea2", "_eCopyArea20", "_eCopyArea21", "_eCopyArea22", "_eCopyArea23", "_eCopyArea24", "_eCopyArea25", "_eCopyArea26", "_eCopyArea3", "_eCopyArea33", "_eCopyArea34", "_eCopyArea39", "_eCopyArea4", "_eCopyArea40", "_eCopyArea48", "_eCopyArea49", "_eCopyArea5", "_eCopyArea5sp", "_eCopyArea6", "_eCopyArea7", "_eCopyArea8", "_eCopyArea9", "_main", "_msg_putMessage", "_mus_pcm_load", "_mus_pcm_mix", "_mus_pcm_start", "_nact_main", "_sdl_keywait", "_sdl_sleep", "_sdl_wait_vsync", "_sel_select", "_sys_addMsg", "_sys_hit_any_key", "_sys_key_releasewait"]'
|
||||
|
||||
+6
-1
@@ -436,7 +436,12 @@ void commandZZ10() {
|
||||
void commandZZ13() {
|
||||
/* 表示フォントを設定する */
|
||||
int num = getCaliValue();
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
if (num == FONT_MINCHO) {
|
||||
if (load_mincho_font() != OK)
|
||||
num = FONT_GOTHIC;
|
||||
}
|
||||
#endif
|
||||
nact->msg.MsgFont = num;
|
||||
|
||||
DEBUG_COMMAND("ZZ13 %d:\n",num);
|
||||
|
||||
@@ -81,4 +81,8 @@ typedef enum {
|
||||
FONT_SDLTTF
|
||||
} fontdev_t;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
int load_mincho_font(void);
|
||||
#endif
|
||||
|
||||
#endif /* __FONT_H__ */
|
||||
|
||||
Reference in New Issue
Block a user