mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 02:00:41 +00:00
update emscripten web testing docs (#15925)
This commit is contained in:
parent
4578026186
commit
46402732ba
@ -4,17 +4,17 @@ The RetroArch Web Player is RetroArch compiled through [Emscripten](http://kripk
|
||||
|
||||
## Compiling
|
||||
|
||||
To compile RetroArch with Emscripten, you'll first have to [download and install the Emscripten SDK](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html) at 1.39.5:
|
||||
To compile RetroArch with Emscripten, you'll first have to [download and install the Emscripten SDK](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html) at 3.1.46:
|
||||
|
||||
```
|
||||
git clone https://github.com/emscripten-core/emsdk.git
|
||||
cd emsdk
|
||||
./emsdk install 1.39.5
|
||||
./emsdk activate 1.39.5
|
||||
./emsdk install 3.1.46
|
||||
./emsdk activate 3.1.46
|
||||
source emsdk_env.sh
|
||||
```
|
||||
|
||||
Other later versions of emsdk will function and may be needed (like Async support), but in general emscripten is in a constant state of development and you may run into other problems by not pinning to 1.39.5. This is currently the version [https://web.libretro.com/](https://web.libretro.com/) is built against.
|
||||
Other later versions of emsdk will function and may be needed, but in general emscripten is in a constant state of development and you may run into other problems by not pinning to 3.1.46. This is currently the version [https://web.libretro.com/](https://web.libretro.com/) is built against.
|
||||
|
||||
After emsdk is installed you will need to build an emulator core, move that output into Retroarch, and use helper scripts to produce web ready assets, in this example we will be building [https://github.com/libretro/libretro-fceumm](https://github.com/libretro/libretro-fceumm):
|
||||
|
||||
@ -25,40 +25,27 @@ git clone https://github.com/libretro/libretro-fceumm.git
|
||||
cd libretro-fceumm
|
||||
emmake make -f Makefile.libretro platform=emscripten
|
||||
git clone https://github.com/libretro/RetroArch.git ~/retroarch/RetroArch
|
||||
cp ~/retroarch/libretro-fceumm/fceumm_libretro_emscripten.bc ~/retroarch/RetroArch/dist-scripts/fceumm_libretro_emscripten.bc
|
||||
cd ~/retroarch/RetroArch/dist-scripts
|
||||
emmake ./dist-cores.sh emscripten
|
||||
cp ~/retroarch/libretro-fceumm/fceumm_libretro_emscripten.bc ~/retroarch/RetroArch/libretro_emscripten.bc
|
||||
emmake make -f Makefile.emscripten LIBRETRO=fceumm -j all
|
||||
cp fceumm_libretro.{js,wasm} pkg/emscripten/libretro
|
||||
```
|
||||
|
||||
The resulting build output will be located in `~/retroarch/RetroArch/pkg/emscripten` as:
|
||||
## Dependencies
|
||||
|
||||
```
|
||||
fceumm_libretro.js
|
||||
fceumm_libretro.wasm
|
||||
```
|
||||
The emscripten build in the retroarch tree does not contain the necessary web assets for a complete RetroArch installation. You'll need the asset package from the latest emscripten nightly build ( https://buildbot.libretro.com/nightly/emscripten/ ); take its `assets/` folder and put it into `pkg/emscripten/libretro`. This `assets/` folder should contain a `frontend/` directory and a `cores/` directory.
|
||||
|
||||
If you're building your own frontend asset bundle (i.e. modifying `frontend/bundle/`), you'll need to turn the bundle into zipped partfiles. Open a terminal in `assets/frontend` and `zip -r9 bundle.zip bundle && split -b 30M bundle.zip bundle.zip.` (this should work on Mac and Linux, please file a PR with instructions for Windows).
|
||||
|
||||
If you want to add more built-in core content files to `assets/cores`, you need to re-run the indexer script:
|
||||
|
||||
1. `chmod +x indexer`
|
||||
2. run the indexer script (you need coffeescript installed) from a terminal opened at `assets/cores`: `../../indexer > .index-xhr`
|
||||
|
||||
## Usage
|
||||
|
||||
Most of the magic happens on the browser so nothing really on that regard
|
||||
You need a web server. Nginx, apache, node's http-server, and python's http.server are all known to work.
|
||||
|
||||
If you want a self hosted version you need
|
||||
- A web server, nginx/apache will do, download a build here:
|
||||
https://buildbot.libretro.com/nightly/emscripten/
|
||||
- Extract the build somewhere in your web-server
|
||||
- Grab the asset bundle:
|
||||
https://buildbot.libretro.com/assets/frontend/assets.zip
|
||||
- Unzip it in the same dir you extracted the rest, inside **/assets/frontend/bundle**
|
||||
- Create an **assets/cores** dir, you can put game data in that dir so it's available under **downloads**
|
||||
- chmod +x the indexer script
|
||||
- run the indexer script (you need coffeescript) like this:
|
||||
```
|
||||
cd ${ROOT_WWW_PATH}/assets/frontend/bundle
|
||||
../../../indexer > .index-xhr
|
||||
cd ${ROOT_WWW_PATH}/assets/cores
|
||||
../../indexer > .index-xhr
|
||||
```
|
||||
|
||||
That should be it, you can add more cores to the list by editing index.html
|
||||
Point your webserver to the `pkg/emscripten/libretro/` directory or unzipped nightly build (or move those files to somewhere your webserver can reach them), and everything should Just Work.
|
||||
|
||||
# Threaded emulators
|
||||
|
||||
@ -92,22 +79,22 @@ Build and move output to the frontend:
|
||||
|
||||
```
|
||||
emmake make -f Makefile platform=emscripten
|
||||
cp melonds_libretro_emscripten.bc ~/retroarch/RetroArch/dist-scripts/melonds_libretro_emscripten.bc
|
||||
cp melonds_libretro_emscripten.bc ~/retroarch/RetroArch/libretro_emscripten.bc
|
||||
```
|
||||
|
||||
Now build the frontend with the pthreads env variable: (2 is the number of workers this can be any integer)
|
||||
|
||||
```
|
||||
cd ~/retroarch/RetroArch/dist-scripts
|
||||
pthread=2 emmake ./dist-cores.sh emscripten
|
||||
cd ~/retroarch/RetroArch
|
||||
pthread=2 emmake make -f Makefile.emscripten LIBRETRO=melonds && cp melonds_libretro.* pkg/emscripten/libretro
|
||||
```
|
||||
|
||||
Your resulting output will be located in:
|
||||
|
||||
```
|
||||
~/retroarch/RetroArch/pkg/emscripten/melonds_libretro.js
|
||||
~/retroarch/RetroArch/pkg/emscripten/melonds_libretro.wasm
|
||||
~/retroarch/RetroArch/pkg/emscripten/melonds_libretro.worker.js
|
||||
~/retroarch/RetroArch/pkg/emscripten/libretro/melonds_libretro.js
|
||||
~/retroarch/RetroArch/pkg/emscripten/libretro/melonds_libretro.wasm
|
||||
~/retroarch/RetroArch/pkg/emscripten/libretro/melonds_libretro.worker.js
|
||||
```
|
||||
|
||||
## Setting up your webserver (Threaded)
|
||||
|
Loading…
Reference in New Issue
Block a user