mirror of
https://github.com/linuxserver/libretrojs.git
synced 2026-03-09 00:04:54 +08:00
add initial logic for release and docs
This commit is contained in:
parent
18953c5c4c
commit
7477a922b6
39
.github/workflows/default.yml
vendored
Normal file
39
.github/workflows/default.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
name: libretrojs
|
||||
|
||||
jobs:
|
||||
build-latest:
|
||||
name: Build Latest
|
||||
runs-on: alpine-latest
|
||||
steps:
|
||||
- name: Setup Build env
|
||||
run: |
|
||||
apk add p7zip zip
|
||||
export GITHUB_TAG=$(curl -sX GET "https://api.github.com/repos/linuxserver/emulatorjs/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]')
|
||||
echo "GITHUB_TAG=$GITHUB_TAG" >> $GITHUB_ENV
|
||||
|
||||
- name: Build release
|
||||
env:
|
||||
GITHUB_TAG: ${{ env.GITHUB_TAG }}
|
||||
run: |
|
||||
./make_release.sh
|
||||
|
||||
- name: Create Release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ env.GITHUB_TAG }}
|
||||
release_name: ${{ env.GITHUB_TAG }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
- name: Upload Assets
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
file: /buildout/*
|
||||
file_glob: true
|
||||
overwrite: true
|
||||
prerelease: false
|
||||
release_name: ${{ env.GITHUB_TAG }}
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
tag: ${{ env.GITHUB_TAG }}
|
||||
73
README.md
73
README.md
@ -1 +1,72 @@
|
||||
# Initial
|
||||
# LibretroJS
|
||||
|
||||
This repository collects the assets used in [https://github.com/linuxserver/emulatorjs](https://github.com/linuxserver/emulatorjs) and publishes releases that can be embedded into any website.
|
||||
|
||||
# Example
|
||||
```
|
||||
<div id="game"></div>
|
||||
<script type="text/javascript">
|
||||
EJS_player = '#game';
|
||||
EJS_gameUrl = '/your/game/rom.zip';
|
||||
EJS_core = 'snes9x';
|
||||
</script>
|
||||
<script src="js/vendor/jquery.min.js"></script>
|
||||
<script src="js/vendor/jquery.hotkeys.js"></script>
|
||||
<script src="js/vendor/browserfs.min.js"></script>
|
||||
<script src="js/libretro.js"></script>
|
||||
```
|
||||
|
||||
Simply extract the release into the root of your webserver and try this test page for the `snes9x` emulator.
|
||||
|
||||
# Supported emulators
|
||||
|
||||
* bluemsx- [https://github.com/libretro/blueMSX-libretro](https://github.com/libretro/blueMSX-libretro)
|
||||
* fceumm- [https://github.com/libretro/libretro-fceumm](https://github.com/libretro/libretro-fceumm)
|
||||
* gearboy- [https://github.com/libretro/Gearboy](https://github.com/libretro/Gearboy)
|
||||
* genesis_plus_gx- [https://github.com/libretro/Genesis-Plus-GX](https://github.com/libretro/Genesis-Plus-GX)
|
||||
* handy- [https://github.com/libretro/libretro-handy](https://github.com/libretro/libretro-handy)
|
||||
* mame2003_plus- [https://github.com/libretro/mame2003-plus-libretro](https://github.com/libretro/mame2003-plus-libretro)
|
||||
* mednafen_ngp- [https://github.com/libretro/beetle-ngp-libretro](https://github.com/libretro/beetle-ngp-libretro)
|
||||
* mednafen_pce_fast- [https://github.com/libretro/beetle-pce-fast-libretro](https://github.com/libretro/beetle-pce-fast-libretro)
|
||||
* mednafen_vb- [https://github.com/libretro/beetle-vb-libretro](https://github.com/libretro/beetle-vb-libretro)
|
||||
* mednafen_wswan- [https://github.com/libretro/beetle-wswan-libretro](https://github.com/libretro/beetle-wswan-libretro)
|
||||
* o2em- [https://github.com/libretro/libretro-o2em](https://github.com/libretro/libretro-o2em)
|
||||
* prboom- [https://github.com/libretro/libretro-prboom](https://github.com/libretro/libretro-prboom)
|
||||
* prosystem- [https://github.com/libretro/prosystem-libretro](https://github.com/libretro/prosystem-libretro)
|
||||
* snes9x- [https://github.com/libretro/snes9x](https://github.com/libretro/snes9x)
|
||||
* stella2014- [https://github.com/libretro/stella2014-libretro](https://github.com/libretro/stella2014-libretro)
|
||||
* vba_next- [https://github.com/libretro/vba-next](https://github.com/libretro/vba-next)
|
||||
* vecx- [https://github.com/libretro/libretro-vecx](https://github.com/libretro/libretro-vecx)
|
||||
* virtualjaguar- [https://github.com/libretro/virtualjaguar-libretro](https://github.com/libretro/virtualjaguar-libretro)
|
||||
|
||||
# Variables and usage
|
||||
|
||||
## Supported variables
|
||||
* EJS_player- The id of the div you want the libretro canvas to render into.
|
||||
* EJS_gameUrl- The full URL to the game to load.
|
||||
* EJS_core- The libretro core to use.
|
||||
* EJS_biosUrl- Bios URL will be loaded into libretro's system directory, a zip file will be unzipped into this directory.
|
||||
* EJS_onGameStart- Run a custom function after the game is started.
|
||||
|
||||
## Basic setup
|
||||
|
||||
By default the script renders in a canvas element and an unstyled fullscreen button with the class `full-button`. Feel free to hide the button or style it absolute to where you need it on your page. The user of the game can bring up the libretro menu by pressing F1 on a keyboard or start+select+L+R on a controller.
|
||||
You can define scripts to run after startup by using the onGameStart option, IE to go fullscreen on load:
|
||||
|
||||
```
|
||||
EJS_onGameStart = function() {
|
||||
Module.requestFullscreen(false);
|
||||
}
|
||||
```
|
||||
|
||||
The core can be interacted with while running using the `Module` as seen above to go fullscreen, there are other commands that can be sent also one of the most important being `Module._cmd_savefiles()` this will force an sram dump of the users save data on supported games/cores. You will want to tie this to an unload or hashchange event on your webpage to ensure the user does not need to go into the menu and manually trigger this action. Some other commands are:
|
||||
|
||||
```
|
||||
_cmd_load_state()
|
||||
_cmd_save_state()
|
||||
_cmd_savefiles()
|
||||
_cmd_take_screenshot()
|
||||
```
|
||||
|
||||
Everything is stored in browser storage using an indexDB there is no integrated logic for downloading the files from the browser, but this can easily be built by interacting with the `fs` directly in the browser.
|
||||
All of the code is open, feel free to modify it to your needs, but do not come here for support, none will be provided. These repositories are simply for development participation only.
|
||||
|
||||
60
make_release.sh
Executable file
60
make_release.sh
Executable file
@ -0,0 +1,60 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Working emulators for retroarch
|
||||
retroarchemus="\
|
||||
fceumm
|
||||
snes9x
|
||||
mednafen_vb
|
||||
gearboy
|
||||
vba_next
|
||||
genesis_plus_gx
|
||||
handy
|
||||
mame2003_plus
|
||||
mednafen_ngp
|
||||
mednafen_pce_fast
|
||||
mednafen_wswan
|
||||
o2em
|
||||
prboom
|
||||
vecx
|
||||
bluemsx"
|
||||
IFS=$'\n'
|
||||
|
||||
# Setup build dirs
|
||||
rootdir='/buildout/'
|
||||
mkdir -p ${rootdir}{data,js/vendor,retrotmp,emulatorjstmp}
|
||||
|
||||
## Grab frontend blobs
|
||||
# Libretro emscripten
|
||||
cd ${rootdir}retrotmp
|
||||
wget https://buildbot.libretro.com/nightly/emscripten/RetroArch.7z
|
||||
7z x RetroArch.7z
|
||||
sed -i 's/wasmBinaryFile="/wasmBinaryFile="data\//g' retroarch/*.js
|
||||
for emu in $retroarchemus; do
|
||||
mv retroarch/${emu}_libretro.* "${rootdir}/data/"
|
||||
done
|
||||
cd retroarch/assets/frontend/bundle/
|
||||
zip -r frontend.zip assets/xmb/monochrome assets/ozone shaders filters info autoconfig overlay assets/menu_widgets
|
||||
mv frontend.zip "${rootdir}/data/"
|
||||
cd "${rootdir}"
|
||||
rm -Rf retrotmp
|
||||
# Custom cores
|
||||
wget https://github.com/linuxserver/libretro-cores/archive/master.tar.gz
|
||||
tar xf \
|
||||
master.tar.gz -C \
|
||||
${rootdir} --strip-components=1
|
||||
rm -f ${rootdir}/{README.md,master.tar.gz}
|
||||
# Grab logic from emulatorjs
|
||||
wget https://github.com/linuxserver/emulatorjs/archive/${GITHUB_TAG}.tar.gz \
|
||||
-O ${rootdir}/emulatorjstmp/emulatorjs.tar.gz
|
||||
tar xf \
|
||||
${rootdir}/emulatorjstmp/emulatorjs.tar.gz -C \
|
||||
${rootdir}/emulatorjstmp/ --strip-components=1
|
||||
mv \
|
||||
${rootdir}/emulatorjstmp/frontend/js/libretro.js \
|
||||
${rootdir}/js/
|
||||
mv \
|
||||
${rootdir}/emulatorjstmp/frontend/js/vendor/browserfs.min.js \
|
||||
${rootdir}/emulatorjstmp/frontend/js/vendor/jquery.hotkeys.js \
|
||||
${rootdir}/emulatorjstmp/frontend/js/vendor/jquery.min.js \
|
||||
${rootdir}/js/vendor/
|
||||
rm -Rf ${rootdir}/emulatorjstmp/
|
||||
Loading…
x
Reference in New Issue
Block a user