mupen64plus-libretro-nx icon indicating copy to clipboard operation
mupen64plus-libretro-nx copied to clipboard

Add emscripten support built against patched 2.0.34 emsdk

Open thelamer opened this issue 1 year ago • 9 comments

This is an update of toadkings PR here and I cannot take credit for these changes https://github.com/BinBashBanana using toadkings old PR got this all working: https://github.com/libretro/mupen64plus-libretro-nx/pull/132

This needs to be built against a specific version of emscripten that has webgl patched.

git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install 2.0.34
./emsdk activate 2.0.34
wget https://raw.githubusercontent.com/BinBashBanana/webretro/master/source/patches/emscripten.patch
patch -u -p0 -i emscripten.patch
source emsdk_env.sh

On the retroarch side should be built without ASYNC flagged as is currently defined here: (can be deleted) https://github.com/libretro/RetroArch/blob/master/Makefile.emscripten#L61C1-L63C6

And with the additional flags: -s TOTAL_STACK=268435456 -s TOTAL_MEMORY=536870912 -s FULL_ES3=1 -s MIN_WEBGL_VERSION=2 -s MAX_WEBGL_VERSION=2

The results are very good even on a low end client machine:

https://github.com/libretro/mupen64plus-libretro-nx/assets/1852688/a0feb40d-acba-4281-a887-cb7cdcfc0c2f

I can rewrite the guards Retroarch side as well but having a viable bc file is the first step.

Let me know if this is possible to mainline I do not have a deep enough understanding of the codebase to see if there are any breaking changes for other ports here, but most of it looks non obtrusive with guards.

thelamer avatar Jan 18 '24 21:01 thelamer

I need to check whatever i merged to my main branches already, most things still reside in emscripten_testing branch iirc

m4xw avatar Jan 24 '24 10:01 m4xw

Gonna start on this soon

m4xw avatar Feb 05 '24 16:02 m4xw

Rebased & Backported some changes onto emscripten_testing branch

m4xw avatar Feb 06 '24 17:02 m4xw

Am I reading this correct that you are working on dynarec in emscripten? That is one of the biggest pain points of nearly every core, the SIMD extensions lacking. Hoping for a breakthrough.

thelamer avatar Feb 07 '24 04:02 thelamer

Am I reading this correct that you are working on dynarec in emscripten? That is one of the biggest pain points of nearly every core, the SIMD extensions lacking. Hoping for a breakthrough.

Ahead of time tho, I implemented it through cached interpreter for now so i can compile in parts of the game into the core directly.

Also SIMD seems to work decently with this

m4xw avatar Mar 26 '24 12:03 m4xw

-msimd128 -ftree-vectorize -mfpu=neon

m4xw avatar Mar 26 '24 12:03 m4xw

This is progressing quite well, still too many changes to push it all but thought i give a small update

m4xw avatar Apr 11 '24 17:04 m4xw

Hi, i don't know if this is the right place. But i thought i try it and ask. How does it look? It would be really cool to have this core also as emscrpten port :)! Thank you!

alec4 avatar Jul 12 '24 15:07 alec4

Hi, i don't know if this is the right place. But i thought i try it and ask. How does it look? It would be really cool to have this core also as emscrpten port :)! Thank you!

Its looking good, working on getting it on the last toolchain ver next

m4xw avatar Jul 15 '24 13:07 m4xw