Skip to content

Commit 9252883

Browse files
committed
add new emujs config options
1 parent 9d33707 commit 9252883

4 files changed

Lines changed: 209 additions & 49 deletions

File tree

‎docs/API-and-Development/Contributing.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Thank you for considering contributing to RomM! This document outlines some guid
66

77
## Code of Conduct
88

9-
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.
9+
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.
1010

1111
## AI Assistance Notice
1212

@@ -44,7 +44,7 @@ If you would like to translate the project into another language, create a new f
4444
1. Fork the repository.
4545
2. Clone your forked repository: `git clone https://github.com/your-username/romm.git`
4646
3. Checkout the `master` branch: `git checkout master`
47-
4. Follow the steps in the [developer setup guide](DEVELOPER_SETUP.md)
47+
4. Follow the steps in the [developer setup guide](https://github.com/rommapp/romm/blob/master/DEVELOPER_SETUP.md)
4848
5. Create a new branch for your feature/fix: `git checkout -b feature-or-fix-name`
4949
6. Make your changes and commit them with descriptive commit messages: `git commit -am 'Add feature XYZ'`
5050
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
7474

7575
## Licensing
7676

77-
By contributing to RomM, you agree that your contributions will be licensed under the project's [LICENSE](LICENSE).
77+
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).
7878

7979
---
8080

Lines changed: 146 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
<!-- trunk-ignore-all(markdownlint/MD024) -->
2+
13
# Setting up RomM for development
24

3-
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.
5+
## Option 1: Using Docker
6+
7+
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.
48

5-
## Environment setup
9+
### Environment setup
610

7-
### Create the mock structure with at least one rom and empty config for manual testing
11+
#### Create the mock structure with at least one rom and empty config for manual testing
812

913
```sh
1014
mkdir -p romm_mock/library/roms/switch
@@ -15,7 +19,7 @@ mkdir -p romm_mock/config
1519
touch romm_mock/config/config.yml
1620
```
1721

18-
### Copy env.template to .env and fill the variables
22+
#### Copy env.template to .env and fill the variables
1923

2024
```sh
2125
cp env.template .env
@@ -26,16 +30,152 @@ ROMM_BASE_PATH=/app/romm
2630
DEV_MODE=true
2731
```
2832

29-
### Build the image
33+
#### Build the image
3034

3135
```sh
3236
docker compose build # or `docker compose build --no-cache` to rebuild from scratch
3337
```
3438

35-
### Spin up the Docker containers
39+
#### Spin up the Docker containers
3640

3741
```sh
3842
docker compose up -d
3943
```
4044

4145
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.
46+
47+
## Option 2: Manual setup
48+
49+
### Environment setup
50+
51+
#### - Create the mock structure with at least one rom and empty config for manual testing
52+
53+
```sh
54+
mkdir -p romm_mock/library/roms/switch
55+
touch romm_mock/library/roms/switch/metroid.xci
56+
mkdir -p romm_mock/resources
57+
mkdir -p romm_mock/assets
58+
mkdir -p romm_mock/config
59+
touch romm_mock/config/config.yml
60+
```
61+
62+
#### - Copy env.template to .env and fill the variables
63+
64+
```sh
65+
cp env.template .env
66+
```
67+
68+
#### - Install system dependencies
69+
70+
```sh
71+
# https://mariadb.com/docs/skysql-previous-release/connect/programming-languages/c/install/#Installation_via_Package_Repository_(Linux):
72+
sudo apt install libmariadb3 libmariadb-dev libpq-dev
73+
74+
# Build and configure RAHasher (optional)
75+
# This is only required to calculate RA hashes
76+
# Users on macOS can skip this step as RAHasher is not supported
77+
git clone --recursive https://github.com/RetroAchievements/RALibretro.git
78+
cd ./RALibretro
79+
git checkout 1.8.0
80+
git submodule update --init --recursive
81+
sed -i '22a #include <ctime>' ./src/Util.h
82+
make HAVE_CHD=1 -f ./Makefile.RAHasher
83+
cp ./bin64/RAHasher /usr/bin/RAHasher
84+
```
85+
86+
#### - Install python dependencies
87+
88+
You'll need uv installed
89+
90+
<https://docs.astral.sh/uv/getting-started/installation/>
91+
92+
```sh
93+
curl -LsSf https://astral.sh/uv/install.sh | sh
94+
```
95+
96+
Then create the virtual environment and install the dependencies using uv:
97+
98+
```sh
99+
uv venv
100+
source .venv/bin/activate
101+
uv sync --all-extras --dev
102+
```
103+
104+
#### - Spin up the database and other services
105+
106+
```sh
107+
docker compose up -d
108+
```
109+
110+
#### - Run the backend
111+
112+
_Migrations will be run automatically when running the backend._
113+
114+
```sh
115+
cd backend
116+
uv run python3 main.py
117+
```
118+
119+
### Setting up the frontend
120+
121+
#### - Install node.js dependencies
122+
123+
```sh
124+
cd frontend
125+
# npm version >= 9 needed
126+
npm install
127+
```
128+
129+
#### - Create symlink to library and resources
130+
131+
```sh
132+
mkdir assets/romm
133+
ln -s ../romm_mock/resources assets/romm/resources
134+
ln -s ../romm_mock/assets assets/romm/assets
135+
```
136+
137+
#### - Run the frontend
138+
139+
```sh
140+
npm run dev
141+
```
142+
143+
## Setting up the linter
144+
145+
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.
146+
147+
### - Install the Trunk CLI
148+
149+
```sh
150+
curl https://get.trunk.io -fsSL | bash
151+
```
152+
153+
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:
154+
155+
```sh
156+
trunk fmt
157+
trunk check
158+
```
159+
160+
**Failing to install and run the linter will result in a failed CI check, which won't allow us to merge your PR.**
161+
162+
## Test setup
163+
164+
### - Create the test user and database with root user
165+
166+
```sh
167+
docker exec -i romm-db-dev mariadb -uroot -p<root password> < backend/romm_test/setup.sql
168+
```
169+
170+
### - Run tests
171+
172+
_Migrations will be run automatically when running the tests._
173+
174+
```sh
175+
cd backend
176+
# path or test file can be passed as argument to test only a subset
177+
uv run pytest [path/file]
178+
# or run the following command to run all tests
179+
# the -vv switch increases the verbosity of the output, providing more detailed information during test execution.
180+
uv run pytest -vv
181+
```

‎docs/Getting-Started/Configuration-File.md‎

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ Disable file hash calculation for low power devices (e.g. Raspberry PI).
101101
filesystem:
102102
skip_hash_calculation: true
103103
```
104+
104105
---
105106

106107
## Scan Section
@@ -232,21 +233,42 @@ emulatorjs:
232233
cache_limit: 52428800 # 50 MB
233234
```
234235

236+
### Disable batch bootup
237+
238+
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).
239+
240+
```yaml
241+
emulatorjs:
242+
disable_batch_bootup: true
243+
```
244+
245+
### Disable auto-unload
246+
247+
The emulator stops/shuts itself down when you navigate to a new page; this setting stops that behaviour (if that's something you want).
248+
249+
```yaml
250+
emulatorjs:
251+
disable_auto_unload: true
252+
```
253+
235254
### Netplay
236255

237256
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).
238257

239258
```yaml
240259
emulatorjs:
241-
netplay:
242-
enabled: true
243-
ice_servers: # Google is your friend here!
244-
- urls: 'stun:stun.l.google.com:19302'
245-
- urls: 'stun:stun1.l.google.com:19302'
246-
- urls: "stun:stun.relay.metered.ca:80"
247-
- urls: "turn:global.relay.metered.ca:80"
248-
username: "<username>"
249-
credential: "<password>"
260+
netplay:
261+
enabled: true
262+
ice_servers:
263+
- urls: "stun:stun.l.google.com:19302"
264+
- urls: "stun:stun1.l.google.com:19302"
265+
- urls: "stun:stun2.l.google.com:19302"
266+
- urls: "turn:openrelay.metered.ca:80"
267+
username: "openrelayproject"
268+
credential: "openrelayproject"
269+
- urls: "turn:openrelay.metered.ca:443"
270+
username: "openrelayproject"
271+
credential: "openrelayproject"
250272
```
251273

252274
### Settings

‎docs/Platforms-and-Players/EmulatorJS-Player.md‎

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,49 +21,47 @@ Netplay lets you play with friends remotely, in realtime with the build-in web p
2121

2222
```yaml
2323
emulatorjs:
24-
netplay:
25-
enabled: true
24+
netplay:
25+
enabled: true
2626
```
2727
2828
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":
2929

3030
```yaml
3131
emulatorjs:
32-
netplay:
33-
ice_servers:
34-
- urls: "stun:stun.relay.metered.ca:80"
35-
- urls: "stun:stun.relay.metered.ca:80"
36-
- urls: "turn:global.relay.metered.ca:80"
37-
username: "<username>"
38-
credential: "<password>"
39-
- urls: "turn:global.relay.metered.ca:80?transport=tcp"
40-
username: "<username>"
41-
credential: "<password>"
42-
- urls: "turn:global.relay.metered.ca:443"
43-
username: "<username>"
44-
credential: "<password>"
45-
- urls: "turns:global.relay.metered.ca:443?transport=tcp"
46-
username: "<username>"
47-
credential: "<password>"
32+
netplay:
33+
ice_servers:
34+
- urls: "stun:stun.relay.metered.ca:80"
35+
- urls: "stun:stun.relay.metered.ca:80"
36+
- urls: "turn:global.relay.metered.ca:80"
37+
username: "<username>"
38+
credential: "<password>"
39+
- urls: "turn:global.relay.metered.ca:80?transport=tcp"
40+
username: "<username>"
41+
credential: "<password>"
42+
- urls: "turn:global.relay.metered.ca:443"
43+
username: "<username>"
44+
credential: "<password>"
45+
- urls: "turns:global.relay.metered.ca:443?transport=tcp"
46+
username: "<username>"
47+
credential: "<password>"
4848
```
4949

5050
Alternatively, use the free STUN servers from Google and TURN servers via the OpenRelayProject:
5151

5252
```yaml
5353
emulatorjs:
54-
netplay:
55-
enabled: true
56-
ice_servers:
57-
- urls: "stun:stun.l.google.com:19302"
58-
- urls: "stun:stun1.l.google.com:19302"
59-
- urls: "stun:stun2.l.google.com:19302"
60-
- urls: "stun:stun.nextcloud.com:34782"
61-
- urls: "turn:openrelay.metered.ca:80"
62-
username: "openrelayproject"
63-
credential: "openrelayproject"
64-
- urls: "turn:openrelay.metered.ca:443"
65-
username: "openrelayproject"
66-
credential: "openrelayproject"
54+
netplay:
55+
ice_servers:
56+
- urls: "stun:stun.l.google.com:19302"
57+
- urls: "stun:stun1.l.google.com:19302"
58+
- urls: "stun:stun2.l.google.com:19302"
59+
- urls: "turn:openrelay.metered.ca:80"
60+
username: "openrelayproject"
61+
credential: "openrelayproject"
62+
- urls: "turn:openrelay.metered.ca:443"
63+
username: "openrelayproject"
64+
credential: "openrelayproject"
6765
```
6866

6967
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.**

0 commit comments

Comments
 (0)