• Stars
    star
    331
  • Rank 122,662 (Top 3 %)
  • Language
    JavaScript
  • Created over 2 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Self hosted web based retro emulation front end with rom and art management.

EmulatorJS helper

The purpose of this application is to provide a self hosted solution for people looking to run Retro games in their web browsers. It consists of a backend application for scanning roms and ingesting art assets with a static frontend application for serving those files via any basic webserver. The backend application is more or less a run once deal, when you have finalized the menus how you like them the resulting static files of the frontend no longer require the backend helper.

This idea was born from a single need, I wanted to run retro games on my Xbox which now includes a modern chromium based web browser with Microsoft Edge. Web based emulators are popular online but always ingesting roms from external sources is a pain not to mention prone to being taken down at any time, also their interfaces are never designed around basic controller input making navigation difficult with something like an Xbox controller.

It is important to note that the current emulator used for this frontend is obfuscated code, efforts are being made to reverese engineer it but you should know it can potentially reach out to third party services if you manually enable features like netplay (this should never happen in a stock setup). We are in the process to transitioning to libretro cores for emulators, currently 27/30 emulators have been replaced.

For Users

We recommend using the docker container located here. This will spin up:

  • The nodejs backend used for managing your configuration files and rom art assets.
  • An NGINX webserver to serve the static frontend files.
  • An IPFS daemon for ingesting decentralized art asset files.

For the most part most things should be point and click, hop into port 3000, click buttons, add roms, hop over to the frontend on port 80, and play. All navigation should be compatible with the up/down/left/right arrow keys on a keyboard thus working with a standard gamepad.

For asset creators

The frontend is relatively simple it displays a psuedo wheel (popular with emulation frontends like Hyperspin and Coinops) layering pngs and videos on top of that based on the currently selected menu item. The layout of these items can be seen below:

layout

All images should be a png and run through pngquant for web optimization IE:

pngquant yourimage.png

Videos should be mp4 format and compressed pretty heavily to be optimized for web while load quickly in the web interface, IE using ffmpeg: (aac is also acceptable, but I had better results with mp3)

ffmpeg -i input.mp4 -c:v libx264 -preset slow -crf 32 -acodec libmp3lame -qscale:a 7 output.mp4

If you wish to participate in improving and expanding the asset collection for games you will need to have a basic understanding of the json in the metadata folder of this project. Let's take a look at an example entry in Atari 2600:

  "2A9647E27AB27E6CF82B3BF122EDF212FA34AE86": {
    "name": "Halo 2600 (USA) (Unl)",
    "vid": "QmWNCjneSTECeGueXrCMHLrs4qHpvWfV6Lee3y5PQ9UTgN",
    "logo": "QmfVui1hFHNEUPpdGsvfFGFpxdAG2DNHhazDFKfFKRwiEE",
    "back": "QmSXacVTbftY1vsoK9RDJ47Jz2yeJB18td3rtTPmpfTw7D",
    "corner: "QmarPeRQzXTGPY88h744vhgCu1RGJtpV9HyTtjhrQmnQhq",
    "video_position": "left:11.5vw;top:31.5vh;width:36vw;height:43vh;"
  }

This metadata entry links to the following files consisting of a full interface rendering:

https://ipfs.infura.io/ipfs/QmWNCjneSTECeGueXrCMHLrs4qHpvWfV6Lee3y5PQ9UTgN https://ipfs.infura.io/ipfs/QmfVui1hFHNEUPpdGsvfFGFpxdAG2DNHhazDFKfFKRwiEE https://ipfs.infura.io/ipfs/QmSXacVTbftY1vsoK9RDJ47Jz2yeJB18td3rtTPmpfTw7D https://ipfs.infura.io/ipfs/QmarPeRQzXTGPY88h744vhgCu1RGJtpV9HyTtjhrQmnQhq

While the video_position variable is used to place the video in the correct location on the screen. In general the only really "needed" art assets are the logo and video. The background, corner, and position entry can all be rendered from the default files for the emulated system in question. If you are making a highly custom screen for a particular game the video position might need to be set to something non default, but it always needs to be in the vh and vw unit format to support any size scaling the end user might have. It is impossible to assume a perfect 1080p or 16:9 aspect ratio on a users web browser. The video is rendered by determining a starting top left corner position with "left:11.5vw" being the distance from the left of the browser window, "top:31.5vh" being the distance from the top of the browser window, and "width:36vw;height:43vh" being the relative size.

All of the metadata entries are key based off public lists of rom/cd dumps from https://no-intro.org/ and http://redump.org/ using the sha1 of the files. This way when a user is scanning in their roms we can easily link them to the correct art assets for the menu entries.

For websites

The libretro cores that are tested and functional are published as an easy to embed library here .

Developing and testing assets

Testing assets

If you want to participate in contributing assets to this frontend you will need to test them locally first and know a couple things to get them properly ingested into the P2P ecosystem.

To test your local pngs and mp4s, first place the files in the system directories for the game in question. We will continue with the example of "Halo 2600 (USA)", the file structure would look like:

/data/atari2600/roms/Halo 2600 (USA).zip
/data/atari2600/backgrounds/Halo 2600 (USA).png
/data/atari2600/logos/Halo 2600 (USA).png
/data/atari2600/corners/Halo 2600 (USA).png
/data/atari2600/videos/Halo 2600 (USA).mp4

Then edit the corresponding config file for the system, in this case atari2600:

/data/config/atari2600.json

And the actual game entry:

{
  "title": "Atari 2600",
  "root": "atari2600",
  "parent": "main",
  "display_items": 1,
  "defaults": {
    "emulator": "libretro-stella2014",
    "bios": "",
    "path": "atari2600",
    "rom_extension": ".zip",
    "video_position": "left:11.5vw;top:31.5vh;width:36vw;height:43vh;",
    "type": "game",
    "has_back": false,
    "has_corner": false,
    "has_logo": true,
    "has_video": true,
    "multi_disc": 0
  },
  "items": {
    "Halo 2600 (USA)": {
      "video_position": "left:11.5vw;top:31.5vh;width:40vw;height:50vh;",
      "has_back": true,
      "has_corner": true
    }
  }
}

In this config we are overriding the default video position, but any of the "defaults" entries can be overridden on a per game basis. This is also useful for mixing menus and games in the same interface. We are also overriding the back and corner settings to tell the frontend to stop using the "default.png" for the system and pull by the game's name.

Pushing assets for network ingestion

So you have the menu entry setup with new art assets locally. In order to push changes to this repository you will first need to get your files into IPFS, probably the easiest way to achieve that is with this bash command:

curl "https://ipfs.infura.io:5001/api/v0/add?pin=true" \
  -X POST -H "Content-Type: multipart/form-data" \
  -F "file=@\"/data/atari2600/backgrounds/Halo 2600 (USA).png\""

Which should return something like:

{"Name":"Halo 2600 (USA).png","Hash":"QmSXacVTbftY1vsoK9RDJ47Jz2yeJB18td3rtTPmpfTw7D","Size":"127764"}

QmSXacVTbftY1vsoK9RDJ47Jz2yeJB18td3rtTPmpfTw7D is the IPFS cid you need to submit as new metadata in the metadata/atari2600.json file of this repository for the asset you uploaded. Once added to the metadata this art will be downloaded and config setup just as you do locally for users scanning in their own roms.

Development

Simply run ./setup_dev.sh and use node or nodemon to start the application with nodemon index.js.

You will need a local IPFS node running to use any of the download features of the application

The application can be accesed at:

The application is written in jQuery and scanning is backed by a simple bash helper. The idea is to keep it as simple as possible, people will not be spending hours in the backend interface. The frontend is all designed around converting json configs, images, videos, and roms into a useable web based emulator.

More Repositories

1

Heimdall

An Application dashboard and launcher
PHP
7,126
star
2

docker-wireguard

Dockerfile
2,471
star
3

docker-swag

Nginx webserver and reverse proxy with php support and a built-in Certbot (Let's Encrypt) client. It also contains fail2ban for intrusion prevention.
Dockerfile
2,461
star
4

docker-code-server

Dockerfile
1,415
star
5

docker-webtop

Ubuntu, Alpine, Arch, and Fedora based Webtop images, Linux in a web browser supporting popular desktop environments.
Dockerfile
1,275
star
6

reverse-proxy-confs

These confs are pulled into our SWAG image: https://github.com/linuxserver/docker-swag
1,229
star
7

docker-plex

Dockerfile
992
star
8

docker-unifi-controller

Dockerfile
844
star
9

docker-mods

Documentation and Examples of base container modifications
Dockerfile
808
star
10

docker-letsencrypt

DEPRECATED: Please use linuxserver/swag instead
Dockerfile
727
star
11

docker-sonarr

Dockerfile
672
star
12

docker-calibre-web

Dockerfile
663
star
13

budge

JavaScript
579
star
14

docker-nextcloud

Dockerfile
571
star
15

docker-jellyfin

Dockerfile
563
star
16

docker-bookstack

A Docker container for the BookStack documentation wiki
Dockerfile
556
star
17

docker-qbittorrent

Dockerfile
554
star
18

docker-radarr

Dockerfile
501
star
19

docker-transmission

Dockerfile
486
star
20

docker-openssh-server

Dockerfile
473
star
21

docker-emulatorjs

Web based retro emulation frontend with rom scanning and automated art ingestion.
Dockerfile
439
star
22

docker-unifi-network-application

Dockerfile
419
star
23

docker-jackett

Dockerfile
346
star
24

docker-calibre

Dockerfile
291
star
25

docker-smokeping

Shell
287
star
26

Heimdall-Apps

Apps for Heimdall
PHP
283
star
27

docker-heimdall

Dockerfile
282
star
28

docker-grocy

A container for grocy - the ERP application for your kitchen https://grocy.info
Dockerfile
256
star
29

docker-prowlarr

Docker image for Prowlarr/Prowlarr
Dockerfile
249
star
30

docker-syncthing

Dockerfile
235
star
31

docker-deluge

Dockerfile
223
star
32

docker-netbootxyz

Dockerfile
222
star
33

docker-kasm

Kasm Workspaces platform provides enterprise-class orchestration, data loss prevention, and web streaming technology to enable the delivery of containerized workloads to your browser.
Shell
218
star
34

docker-sabnzbd

Dockerfile
210
star
35

docker-duplicati

Dockerfile
207
star
36

docker-bazarr

Dockerfile
200
star
37

docker-rdesktop

Dockerfile
191
star
38

docker-tautulli

Dockerfile
184
star
39

docker-duckdns

Shell
183
star
40

docker-mariadb

Dockerfile
181
star
41

docker-homeassistant

Dockerfile
170
star
42

docker-lidarr

Dockerfile
169
star
43

docker-healthchecks

Dockerfile
163
star
44

docker-baseimage-kasmvnc

Base Images for remote web based Linux desktops using KasmVNC for many popular distros.
Shell
159
star
45

docker-couchpotato

Dockerfile
153
star
46

davos

Web-based FTP automation for Linux servers.
Java
151
star
47

docker-rutorrent

DEPRECATED
PHP
151
star
48

docker-ombi

Dockerfile
147
star
49

docker-nzbget

Dockerfile
140
star
50

docker-tvheadend

Dockerfile
134
star
51

docker-freshrss

HTML
124
star
52

docker-baseimage-alpine

Dockerfile
124
star
53

docker-docker-compose

Shell
123
star
54

docker-nginx

Dockerfile
122
star
55

docker-kodi-headless

Dockerfile
122
star
56

Clarkson

Web-based fuel logging dashboard
TypeScript
120
star
57

docker-firefox

Dockerfile
113
star
58

fleet

Status and image fleet metadata management application for Docker images
Java
110
star
59

docker-ffmpeg

Dockerfile
109
star
60

docker-ddclient

Dockerfile
106
star
61

docker-piwigo

Dockerfile
104
star
62

docker-resilio-sync

Dockerfile
102
star
63

docker-snipe-it

Alpine/Nginx container for the Asset Management software Snipe-IT
Dockerfile
101
star
64

docker-baseimage-guacgui

Dockerfile
98
star
65

docker-beets

Dockerfile
97
star
66

docker-baseimage-ubuntu

Dockerfile
97
star
67

docker-daapd

Dockerfile
96
star
68

docker-readarr

Container for readarr.com
94
star
69

docker-wireshark

Dockerfile
87
star
70

docker-openvscode-server

Dockerfile
83
star
71

docker-dokuwiki

Dockerfile
82
star
72

docker-ubooquity

Dockerfile
82
star
73

docker-emby

Dockerfile
80
star
74

docker-overseerr

Dockerfile
77
star
75

docker-lazylibrarian

Dockerfile
77
star
76

heimdalljs

JavaScript
77
star
77

docker-baseimage-rdesktop-web

Custom all in one container for running GUI apps from a web browser
Dockerfile
73
star
78

docker-netbox

Python
72
star
79

docker-pyload-ng

Dockerfile
72
star
80

docker-mastodon

Dockerfile
71
star
81

gclient

NodeJS application replacement for the default Guacamole Client
JavaScript
66
star
82

docker-ldap-auth

Python
66
star
83

docker-librespeed

HTML
66
star
84

docker-steamos

Vanilla Arch modified into SteamOS with web based Desktop access, useful for remote play and lower end games
Dockerfile
66
star
85

docker-tt-rss

Dockerfile
65
star
86

docker-libreoffice

Dockerfile
64
star
87

docker-wikijs

Dockerfile
64
star
88

docker-diskover

A Docker container for the Diskover space mapping application
Dockerfile
64
star
89

docker-nzbhydra2

Dockerfile
61
star
90

docker-organizr

DEPRECATED
Dockerfile
61
star
91

docker-budge

Dockerfile
56
star
92

docker-remmina

Dockerfile
56
star
93

docker-projectsend

Dockerfile
55
star
94

docker-scrutiny

Dockerfile
54
star
95

docker-endlessh

Dockerfile
53
star
96

docker-snapdrop

HTML
52
star
97

docker-chromium

Web accessible Chromium inside an Alpine Container
Dockerfile
52
star
98

docker-paperless-ngx

Dockerfile
48
star
99

docker-headphones

Dockerfile
48
star
100

docker-papermerge

Dockerfile
47
star