add new emujs config options

This commit is contained in:
Georges-Antoine Assi
2025-12-29 11:11:43 -05:00
parent 9d33707e10
commit 9252883fdf
4 changed files with 209 additions and 49 deletions
+3 -3
View File
@@ -6,7 +6,7 @@ Thank you for considering contributing to RomM! This document outlines some guid
## Code of Conduct
Please note that this project adheres to the Contributor Covenant [code of conduct](CODE_OF_CONDUCT.md). By participating in this project, you are expected to uphold this code.
Please note that this project adheres to the Contributor Covenant [code of conduct](https://github.com/rommapp/romm/blob/master/CODE_OF_CONDUCT.md). By participating in this project, you are expected to uphold this code.
## AI Assistance Notice
@@ -44,7 +44,7 @@ If you would like to translate the project into another language, create a new f
1. Fork the repository.
2. Clone your forked repository: `git clone https://github.com/your-username/romm.git`
3. Checkout the `master` branch: `git checkout master`
4. Follow the steps in the [developer setup guide](DEVELOPER_SETUP.md)
4. Follow the steps in the [developer setup guide](https://github.com/rommapp/romm/blob/master/DEVELOPER_SETUP.md)
5. Create a new branch for your feature/fix: `git checkout -b feature-or-fix-name`
6. Make your changes and commit them with descriptive commit messages: `git commit -am 'Add feature XYZ'`
7. Push your changes to your fork: `git push origin feature-or-fix-name`
@@ -74,7 +74,7 @@ If you encounter any bugs or have suggestions for improvements, please [create a
## Licensing
By contributing to RomM, you agree that your contributions will be licensed under the project's [LICENSE](LICENSE).
By contributing to RomM, you agree that your contributions will be licensed under the project's [LICENSE](https://github.com/rommapp/romm/blob/master/LICENSE).
---
+146 -6
View File
@@ -1,10 +1,14 @@
<!-- trunk-ignore-all(markdownlint/MD024) -->
# Setting up RomM for development
Docker provides a quick and easy way to get started with RomM by encapsulating all dependencies within Docker containers. This guide will walk you through the process of setting up RomM for development using Docker.
## Option 1: Using Docker
## Environment setup
If you prefer to use Docker for development, you can set up RomM using the provided Docker Compose configuration. This method simplifies the setup process by encapsulating all dependencies within Docker containers.
### Create the mock structure with at least one rom and empty config for manual testing
### Environment setup
#### Create the mock structure with at least one rom and empty config for manual testing
```sh
mkdir -p romm_mock/library/roms/switch
@@ -15,7 +19,7 @@ mkdir -p romm_mock/config
touch romm_mock/config/config.yml
```
### Copy env.template to .env and fill the variables
#### Copy env.template to .env and fill the variables
```sh
cp env.template .env
@@ -26,16 +30,152 @@ ROMM_BASE_PATH=/app/romm
DEV_MODE=true
```
### Build the image
#### Build the image
```sh
docker compose build # or `docker compose build --no-cache` to rebuild from scratch
```
### Spin up the Docker containers
#### Spin up the Docker containers
```sh
docker compose up -d
```
And you're done! You can access the app at `http://localhost:3000`. Any changes made to the code will be automatically reflected in the app thanks to the volume mounts.
## Option 2: Manual setup
### Environment setup
#### - Create the mock structure with at least one rom and empty config for manual testing
```sh
mkdir -p romm_mock/library/roms/switch
touch romm_mock/library/roms/switch/metroid.xci
mkdir -p romm_mock/resources
mkdir -p romm_mock/assets
mkdir -p romm_mock/config
touch romm_mock/config/config.yml
```
#### - Copy env.template to .env and fill the variables
```sh
cp env.template .env
```
#### - Install system dependencies
```sh
# https://mariadb.com/docs/skysql-previous-release/connect/programming-languages/c/install/#Installation_via_Package_Repository_(Linux):
sudo apt install libmariadb3 libmariadb-dev libpq-dev
# Build and configure RAHasher (optional)
# This is only required to calculate RA hashes
# Users on macOS can skip this step as RAHasher is not supported
git clone --recursive https://github.com/RetroAchievements/RALibretro.git
cd ./RALibretro
git checkout 1.8.0
git submodule update --init --recursive
sed -i '22a #include <ctime>' ./src/Util.h
make HAVE_CHD=1 -f ./Makefile.RAHasher
cp ./bin64/RAHasher /usr/bin/RAHasher
```
#### - Install python dependencies
You'll need uv installed
<https://docs.astral.sh/uv/getting-started/installation/>
```sh
curl -LsSf https://astral.sh/uv/install.sh | sh
```
Then create the virtual environment and install the dependencies using uv:
```sh
uv venv
source .venv/bin/activate
uv sync --all-extras --dev
```
#### - Spin up the database and other services
```sh
docker compose up -d
```
#### - Run the backend
_Migrations will be run automatically when running the backend._
```sh
cd backend
uv run python3 main.py
```
### Setting up the frontend
#### - Install node.js dependencies
```sh
cd frontend
# npm version >= 9 needed
npm install
```
#### - Create symlink to library and resources
```sh
mkdir assets/romm
ln -s ../romm_mock/resources assets/romm/resources
ln -s ../romm_mock/assets assets/romm/assets
```
#### - Run the frontend
```sh
npm run dev
```
## Setting up the linter
We use [Trunk](https://trunk.io) for linting, which combines multiple linters and formatters with sensible defaults and a single configuration file. You'll need to install the Trunk CLI to use it.
### - Install the Trunk CLI
```sh
curl https://get.trunk.io -fsSL | bash
```
Alternative installation methods can be found [in their docs](https://docs.trunk.io/check/usage#install-the-cli). On commit, the linter will run automatically. To run it manually, use the following commands:
```sh
trunk fmt
trunk check
```
**Failing to install and run the linter will result in a failed CI check, which won't allow us to merge your PR.**
## Test setup
### - Create the test user and database with root user
```sh
docker exec -i romm-db-dev mariadb -uroot -p<root password> < backend/romm_test/setup.sql
```
### - Run tests
_Migrations will be run automatically when running the tests._
```sh
cd backend
# path or test file can be passed as argument to test only a subset
uv run pytest [path/file]
# or run the following command to run all tests
# the -vv switch increases the verbosity of the output, providing more detailed information during test execution.
uv run pytest -vv
```
+31 -9
View File
@@ -101,6 +101,7 @@ Disable file hash calculation for low power devices (e.g. Raspberry PI).
filesystem:
skip_hash_calculation: true
```
---
## Scan Section
@@ -232,21 +233,42 @@ emulatorjs:
cache_limit: 52428800 # 50 MB
```
### Disable batch bootup
Skips the step that runs a batch file that sets soundcard information, mounts file systems, and attempts to run an `autorun.bat` file (try this if DOS games fail to boot).
```yaml
emulatorjs:
disable_batch_bootup: true
```
### Disable auto-unload
The emulator stops/shuts itself down when you navigate to a new page; this setting stops that behaviour (if that's something you want).
```yaml
emulatorjs:
disable_auto_unload: true
```
### Netplay
Enable [netplay](https://emulatorjs.org/docs4devs/netplay/#website-integration) and configure STUN/TURN servers. We recommend Google's public servers or [Metered's free tier](https://www.metered.ca/stun-turn).
```yaml
emulatorjs:
netplay:
enabled: true
ice_servers: # Google is your friend here!
- urls: 'stun:stun.l.google.com:19302'
- urls: 'stun:stun1.l.google.com:19302'
- urls: "stun:stun.relay.metered.ca:80"
- urls: "turn:global.relay.metered.ca:80"
username: "<username>"
credential: "<password>"
netplay:
enabled: true
ice_servers:
- urls: "stun:stun.l.google.com:19302"
- urls: "stun:stun1.l.google.com:19302"
- urls: "stun:stun2.l.google.com:19302"
- urls: "turn:openrelay.metered.ca:80"
username: "openrelayproject"
credential: "openrelayproject"
- urls: "turn:openrelay.metered.ca:443"
username: "openrelayproject"
credential: "openrelayproject"
```
### Settings
+29 -31
View File
@@ -21,49 +21,47 @@ Netplay lets you play with friends remotely, in realtime with the build-in web p
```yaml
emulatorjs:
netplay:
enabled: true
netplay:
enabled: true
```
If you require ICE servers for NAT traversal, we recommend a free-tier [Metered](https://www.metered.ca/stun-turn) account. Create new "TURN Credentials" and replace `<username>` and `<password>` with the entries under "Show ICE Server Array":
```yaml
emulatorjs:
netplay:
ice_servers:
- urls: "stun:stun.relay.metered.ca:80"
- urls: "stun:stun.relay.metered.ca:80"
- urls: "turn:global.relay.metered.ca:80"
username: "<username>"
credential: "<password>"
- urls: "turn:global.relay.metered.ca:80?transport=tcp"
username: "<username>"
credential: "<password>"
- urls: "turn:global.relay.metered.ca:443"
username: "<username>"
credential: "<password>"
- urls: "turns:global.relay.metered.ca:443?transport=tcp"
username: "<username>"
credential: "<password>"
netplay:
ice_servers:
- urls: "stun:stun.relay.metered.ca:80"
- urls: "stun:stun.relay.metered.ca:80"
- urls: "turn:global.relay.metered.ca:80"
username: "<username>"
credential: "<password>"
- urls: "turn:global.relay.metered.ca:80?transport=tcp"
username: "<username>"
credential: "<password>"
- urls: "turn:global.relay.metered.ca:443"
username: "<username>"
credential: "<password>"
- urls: "turns:global.relay.metered.ca:443?transport=tcp"
username: "<username>"
credential: "<password>"
```
Alternatively, use the free STUN servers from Google and TURN servers via the OpenRelayProject:
```yaml
emulatorjs:
netplay:
enabled: true
ice_servers:
- urls: "stun:stun.l.google.com:19302"
- urls: "stun:stun1.l.google.com:19302"
- urls: "stun:stun2.l.google.com:19302"
- urls: "stun:stun.nextcloud.com:34782"
- urls: "turn:openrelay.metered.ca:80"
username: "openrelayproject"
credential: "openrelayproject"
- urls: "turn:openrelay.metered.ca:443"
username: "openrelayproject"
credential: "openrelayproject"
netplay:
ice_servers:
- urls: "stun:stun.l.google.com:19302"
- urls: "stun:stun1.l.google.com:19302"
- urls: "stun:stun2.l.google.com:19302"
- urls: "turn:openrelay.metered.ca:80"
username: "openrelayproject"
credential: "openrelayproject"
- urls: "turn:openrelay.metered.ca:443"
username: "openrelayproject"
credential: "openrelayproject"
```
To host a game, start it, then hit the 🌐 icon in botton bar. Set your name, create a room (password optional), and other players should be able to see and join your room. **All players need access to your RomM server to join a room and play together.**