• Stars
    star
    389
  • Rank 110,500 (Top 3 %)
  • Language
    JavaScript
  • Created about 3 years ago
  • Updated 6 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,832
star
2

docker-wireguard

Dockerfile
2,824
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,734
star
4

docker-webtop

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

docker-code-server

Dockerfile
1,566
star
6

reverse-proxy-confs

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

docker-plex

Dockerfile
992
star
8

docker-mods

Documentation and Examples of base container modifications
Dockerfile
940
star
9

docker-unifi-controller

Dockerfile
897
star
10

docker-calibre-web

Dockerfile
877
star
11

docker-qbittorrent

Dockerfile
868
star
12

docker-letsencrypt

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

docker-bookstack

A Docker container for the BookStack documentation wiki
Dockerfile
687
star
14

docker-sonarr

Dockerfile
672
star
15

docker-jellyfin

Dockerfile
628
star
16

budge

JavaScript
617
star
17

docker-unifi-network-application

Dockerfile
616
star
18

docker-radarr

Dockerfile
595
star
19

docker-nextcloud

Dockerfile
571
star
20

docker-emulatorjs

Web based retro emulation frontend with rom scanning and automated art ingestion.
Dockerfile
502
star
21

docker-transmission

Dockerfile
486
star
22

docker-openssh-server

Dockerfile
484
star
23

docker-calibre

Dockerfile
352
star
24

docker-jackett

Dockerfile
346
star
25

docker-heimdall

Dockerfile
311
star
26

docker-grocy

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

docker-prowlarr

Docker image for Prowlarr/Prowlarr
Dockerfile
299
star
28

Heimdall-Apps

Apps for Heimdall
PHP
299
star
29

docker-smokeping

Shell
287
star
30

docker-duplicati

Dockerfile
283
star
31

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
282
star
32

docker-baseimage-kasmvnc

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

docker-netbootxyz

Dockerfile
257
star
34

docker-syncthing

Dockerfile
235
star
35

docker-bazarr

Dockerfile
232
star
36

docker-deluge

Dockerfile
223
star
37

docker-rdesktop

Dockerfile
222
star
38

docker-sabnzbd

Dockerfile
210
star
39

docker-lidarr

Dockerfile
204
star
40

docker-homeassistant

Dockerfile
200
star
41

docker-tautulli

Dockerfile
184
star
42

docker-duckdns

Shell
183
star
43

docker-mariadb

Dockerfile
181
star
44

docker-healthchecks

Dockerfile
176
star
45

docker-couchpotato

Dockerfile
153
star
46

docker-ombi

Dockerfile
153
star
47

davos

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

docker-rutorrent

DEPRECATED
PHP
151
star
49

docker-nzbget

Dockerfile
140
star
50

docker-ffmpeg

Dockerfile
139
star
51

docker-firefox

Dockerfile
135
star
52

docker-tvheadend

Dockerfile
134
star
53

fleet

Status and image fleet metadata management application for Docker images
Java
127
star
54

Clarkson

Web-based fuel logging dashboard
TypeScript
126
star
55

docker-freshrss

HTML
124
star
56

docker-baseimage-alpine

Dockerfile
124
star
57

docker-docker-compose

Shell
123
star
58

docker-nginx

Dockerfile
122
star
59

docker-kodi-headless

Dockerfile
122
star
60

docker-snipe-it

Alpine/Nginx container for the Asset Management software Snipe-IT
Dockerfile
115
star
61

docker-documentation

The repo behind...
108
star
62

docker-ddclient

Dockerfile
106
star
63

docker-emby

Dockerfile
106
star
64

docker-readarr

Container for readarr.com
105
star
65

docker-dokuwiki

Dockerfile
104
star
66

docker-piwigo

Dockerfile
104
star
67

docker-obsidian

Dockerfile
104
star
68

docker-resilio-sync

Dockerfile
102
star
69

docker-wireshark

Dockerfile
101
star
70

docker-overseerr

Dockerfile
98
star
71

docker-baseimage-guacgui

Dockerfile
98
star
72

docker-openvscode-server

Dockerfile
98
star
73

docker-beets

Dockerfile
97
star
74

docker-baseimage-ubuntu

Dockerfile
97
star
75

docker-daapd

Dockerfile
96
star
76

docker-chromium

Web accessible Chromium inside an Alpine Container
Dockerfile
96
star
77

docker-ubooquity

Dockerfile
94
star
78

docker-steamos

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

docker-netbox

Python
81
star
80

docker-libreoffice

Dockerfile
81
star
81

docker-pyload-ng

Dockerfile
80
star
82

docker-wikijs

Dockerfile
79
star
83

docker-lazylibrarian

Dockerfile
77
star
84

heimdalljs

JavaScript
77
star
85

docker-mastodon

Dockerfile
76
star
86

docker-baseimage-rdesktop-web

Custom all in one container for running GUI apps from a web browser
Dockerfile
72
star
87

docker-speedtest-tracker

Dockerfile
72
star
88

docker-librespeed

HTML
70
star
89

docker-projectsend

Dockerfile
69
star
90

docker-ldap-auth

Python
68
star
91

docker-diskover

A Docker container for the Diskover space mapping application
Dockerfile
68
star
92

gclient

NodeJS application replacement for the default Guacamole Client
JavaScript
67
star
93

docker-tt-rss

Dockerfile
65
star
94

docker-nzbhydra2

Dockerfile
65
star
95

docker-mstream

Dockerfile
62
star
96

docker-remmina

Dockerfile
62
star
97

docker-organizr

DEPRECATED
Dockerfile
61
star
98

docker-snapdrop

HTML
60
star
99

docker-blender

Responsive web accessible Blender Docker container with hardware acceleration.
Dockerfile
57
star
100

docker-budge

Dockerfile
56
star