diff --git a/README.md b/README.md index 76a1f13..92795a9 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ New features or plans: - [x] fs to save in indexdb - [x] web lua script support - [x] lazy load by ~~BrowserFS or worker~~ async fetch to avoid block the audio + - [x] support mobile web with touch, with webui menu - [ ] android (future plan) - [ ] support extern SD card by [SAF](https://github.com/YuriSizuku/android-SafFile) - [x] psv, see [psv-Onscripter](https://github.com/YuriSizuku/psv-OnscripterJH) @@ -100,8 +101,9 @@ You can either download the prebuild static elf from the [release](https://githu ### (3) web This project can run in a browser through hosted web server. -Press `F10` to strech full in a webpage, `F11` in fullscreen, long click (touch also) to invoke menu. -It might need some time to load at first without lazyload now. +Press `F10` to strech full in a webpage, `F11` in fullscreen, `F9 | Right Click| Long Click` to invoke menu. + +![onsyuri_mo2_webtest3](screenshot/onsyuri_mo2_webtest3.jpg) The structure is as bellow: @@ -134,7 +136,7 @@ It will load the game according to `onsyuri_index.json`, whitch is deifned by `< This can be generated by `onsyuri_index.py`. -~~Futhremoe, use `make_xhrfs_index > onsyuri_lazyload.json` after `npm i -g browserfs ~~ deprecated +~~Futhremoe, use `make_xhrfs_index > onsyuri_lazyload.json` after `npm i -g browserfs`~~ deprecated. ## 2. Build diff --git a/screenshot/onsyuri_mo2_webtest3.jpg b/screenshot/onsyuri_mo2_webtest3.jpg new file mode 100644 index 0000000..6a060d1 Binary files /dev/null and b/screenshot/onsyuri_mo2_webtest3.jpg differ diff --git a/src/onsyuri/onscripter_main.cpp b/src/onsyuri/onscripter_main.cpp index 007d093..2d02aca 100644 --- a/src/onsyuri/onscripter_main.cpp +++ b/src/onsyuri/onscripter_main.cpp @@ -266,7 +266,8 @@ FILE *fopen_ons(const char *path, const char *mode) ); } - if(use_lazyload==1 && (strcmp(mode, "r") || strcmp(mode, "rb"))) + FILE *fp = fopen(path, mode); + if(!fp && use_lazyload==1 && (strcmp(mode, "r") || strcmp(mode, "rb"))) { int ret = 0; ret = EM_ASM_INT( // path is combined after --gamedir @@ -287,7 +288,7 @@ FILE *fopen_ons(const char *path, const char *mode) case 0: { // printf(" not found in g_onsyuri_filemap !\n"); - return fopen(path, mode); // use fopen to check for other file mount + return fp; // use fopen to check for other file mount break; } case 1: @@ -298,7 +299,7 @@ FILE *fopen_ons(const char *path, const char *mode) case 2: { // printf(" already loaded!\n"); - return fopen(path, mode); + return fp; break; } } @@ -310,8 +311,9 @@ FILE *fopen_ons(const char *path, const char *mode) { SDL_Delay(5); // wait for async function } + fp = fopen(path, mode); // reload after fetch } - return fopen(path, mode); + return fp; } #endif @@ -533,6 +535,11 @@ int main(int argc, char *argv[]) // Run ONScripter if (ons.openScript()) exit(-1); if (ons.init()) exit(-1); +#if defined(WEB) + EM_ASM( + self.postMessage("onsinit"); + ); +#endif ons.executeLabel(); exit(0); } diff --git a/src/onsyuri/version.h b/src/onsyuri/version.h index bd8c322..53681a1 100644 --- a/src/onsyuri/version.h +++ b/src/onsyuri/version.h @@ -1,4 +1,4 @@ #define ONS_JH_VERSION "0.8.0" -#define ONS_YURI_VERSION "0.6.3" +#define ONS_YURI_VERSION "0.6.4" #define ONS_VERSION "20181218" #define NSC_VERSION 296 diff --git a/src/onsyuri_web/onsyuri.html b/src/onsyuri_web/onsyuri.html index 399d83c..cd9306d 100644 --- a/src/onsyuri_web/onsyuri.html +++ b/src/onsyuri_web/onsyuri.html @@ -3,14 +3,12 @@ + - Onscripter Yuri v0.6.3 + Onscripter Yuri v0.6.4 - - - - + + + + +
+

Loading game resources ...

+

Powered by Onscripter Yuri v0.6.4

+
+

[Right|Long Click|F9]: show menu

+

[F10]: stretch full; [F11]: screen full

+
+ + \ No newline at end of file