Skip to content

Commit 6fba407

Browse files
authored
Merge pull request #57 from PiterWeb/main
v3.1 Remote Controller
2 parents 760fc3a + 91e0883 commit 6fba407

40 files changed

+438
-268
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,12 @@ finally go to the build/bin folder and your executables will be there.
123123

124124
If you are interested to contribute to this project you can follow this [guide](./CONTRIBUTING.md)
125125

126-
## Thanks to the ViGEm project ♥
127-
[ViGEmBus](https://github.com/nefarius/ViGEmBus) is making this project a reallity. We embed ViGEmBus Installation Wizard and ViGEmBus Client DLLS within the executable for Windows
126+
## Acknowledgements
127+
128+
### Thanks to jbdemonte/virtual-device ❤
129+
[jbdemonte/virtual-device](https://github.com/jbdemonte/virtual-device) is making this project a reality. This is the source of magic that enables RemoteController to generate virtual gamepads on Linux, is very fast and made in pure Go.
130+
### Thanks to the ViGEm project ❤
131+
[ViGEmBus](https://github.com/nefarius/ViGEmBus) is making this project a reallity. This is the source of magic that enables RemoteController to generate virtual gamepads on Windows. We embed ViGEmBus Installation Wizard and ViGEmBus Client DLLS within the executable for Windows
128132

129133
## Did you like the project 👍 ?
130134
You can give a star and review us on Product Hunt

docs/LINUX.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@
55
When you run RemoteController you will need to be sure to:
66

77
- Your user has read/write permissions for /dev/input/event/* and uinput devices
8-
- Example in Debian: sudo usermod -aG input $USER
8+
- Example in Debian:
9+
```sh
10+
sudo usermod -aG input $USER
11+
```
912
- Uinput module enabled
10-
- Example in Debian: sudo modprobe uinput
13+
- Check if it is loaded:
14+
- Example in Debian:
15+
```sh
16+
lsmod | grep uinput
17+
```
18+
- Load the module:
19+
- Example in Debian:
20+
```sh
21+
sudo modprobe uinput
22+
```

frontend/.npmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
engine-strict=true
1+
engine-strict=false

frontend/src/lib/detection/onwebsite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file is used to determine if the app is running on the website(client only) or not.
1+
// This file is used to determine if the app is running on the website(vercel client only) or not.
22
const onwebsite = import.meta.env?.VITE_ON_WEBSITE === 'true';
33

44
// This will be true if using the linux client when browser opens

frontend/src/lib/gamepad/gamepad_hook.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,26 @@ export function cloneGamepad(gamepad: Gamepad): ClonedGamepad {
2727
index: gamepad.index
2828
};
2929
}
30+
31+
export function handleGamepad(controllerChannel: RTCDataChannel) {
32+
const sendGamepadData = () => {
33+
const gamepadData = navigator.getGamepads();
34+
35+
gamepadData.forEach((gamepad) => {
36+
if (!gamepad) return;
37+
38+
const serializedData = JSON.stringify(cloneGamepad(gamepad));
39+
controllerChannel.send(serializedData);
40+
});
41+
};
42+
43+
const gamepadLoop = () => {
44+
sendGamepadData();
45+
46+
// Continue the loop
47+
requestAnimationFrame(gamepadLoop);
48+
};
49+
50+
// Start the gamepad loop
51+
gamepadLoop();
52+
}

frontend/src/lib/i18n/LanguageSelector.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script lang="ts">
22
import {locale, locales, _ } from 'svelte-i18n';
33
4-
function setLocale(event: Event) {
4+
async function setLocale(event: Event) {
55
const target = event.target as HTMLButtonElement;
6-
locale.set(target.dataset.value);
6+
await locale.set(target.dataset.value);
77
}
88
99
function getLocaleName(locale: string) {

frontend/src/lib/i18n/en.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,12 @@
7878
"tutorial_prev_text": "Previous",
7979
"tutorial_play_title": "You are ready to play",
8080
"tutorial_play_description": "Now select your prefered mode to play (in web there is only one) and follow the instructions inside",
81-
"share-the-code-with-your-client": "Share the code with your client"
81+
"share-the-code-with-your-client": "Share the code with your client",
82+
"go-browser": "You default browser should have been opened automatically (There are known issues in Firefox: We recommend using Chromium based Browsers)",
83+
"relay-title": "Go to the browser tab",
84+
"warning-go-browser": "Don't close the APP or go back in the menu",
85+
"resolutions": "Resolutions",
86+
"framerate": "Framerate",
87+
"ideal-framerate": "Ideal Framerate",
88+
"max-framerate": "Max Framerate"
8289
}

frontend/src/lib/i18n/es.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,12 @@
7878
"tutorial_prev_text": "Anterior",
7979
"tutorial_play_title": "Estas listo para jugar",
8080
"tutorial_play_description": "Ahora selecciona tu modo preferido para jugar (en la web solo hay uno) y sigue las instrucciones que aparecen dentro",
81-
"share-the-code-with-your-client": "Comparte el código con tu cliente."
81+
"share-the-code-with-your-client": "Comparte el código con tu cliente.",
82+
"framerate": "FPS",
83+
"go-browser": "Tu navegador por defecto debería abrirse automáticamente (Hay problemas conocidos en Firefox: recomendamos usar navegadores basados en Chromium)",
84+
"ideal-framerate": "FPS ideal",
85+
"max-framerate": "FPS máximo",
86+
"relay-title": "Ir a la pestaña del navegador",
87+
"resolutions": "Resoluciones",
88+
"warning-go-browser": "No cierres la aplicación o vuelvas atrás en el menú"
8289
}

frontend/src/lib/i18n/gl.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,12 @@
7878
"tutorial_prev_text": "Anterior",
7979
"tutorial_play_title": "Estás listo para xogar",
8080
"tutorial_play_description": "Agora selecciona o teu modo preferido para xogar (na web só hai un) e sigue as instrucións que hai dentro",
81-
"share-the-code-with-your-client": "Comparte o código co teu cliente"
81+
"share-the-code-with-your-client": "Comparte o código co teu cliente",
82+
"framerate": "FPS",
83+
"go-browser": "O teu navegador por defecto tivo que abrirse automáticamente (Hay problemas coñecidos con Firefox: recomendase usar navegadores baseados en Chromium)",
84+
"ideal-framerate": "FPS Ideais",
85+
"max-framerate": "FPS Máximos",
86+
"relay-title": "Vai a xanela do teu navegador",
87+
"resolutions": "Resolucións",
88+
"warning-go-browser": "Non peches a APP ou volvas atrás no menú"
8289
}

frontend/src/lib/i18n/i18n.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { browser } from '$app/environment'
2-
import { init, register, getLocaleFromNavigator } from 'svelte-i18n'
2+
import { init, register, getLocaleFromNavigator, locale} from 'svelte-i18n'
33

44
const defaultLocale = 'en'
55

@@ -11,5 +11,21 @@ register('fr', () => import('./fr.json'))
1111

1212
init({
1313
fallbackLocale: defaultLocale,
14-
initialLocale: browser ? new Intl.Locale(getLocaleFromNavigator() ?? defaultLocale).language : defaultLocale,
15-
})
14+
initialLocale: browser ? new Intl.Locale(getLocaleFromLocalStorage() ?? getLocaleFromNavigator() ?? defaultLocale).language : defaultLocale,
15+
})
16+
17+
export function getLocaleFromLocalStorage() {
18+
const locale_stored = localStorage.getItem('locale')
19+
return locale_stored
20+
}
21+
22+
function saveLocaleToLocalStorage(locale: string) {
23+
browser && localStorage.setItem('locale', locale)
24+
}
25+
26+
locale.subscribe((value) => {
27+
console.log('locale changed to', value)
28+
saveLocaleToLocalStorage(value ?? defaultLocale)
29+
})
30+
31+

0 commit comments

Comments
 (0)