From 58a7cbe7b17dccded72e16dc11ad3d981535a163 Mon Sep 17 00:00:00 2001 From: JovannMC Date: Wed, 18 Dec 2024 13:04:27 +0300 Subject: [PATCH] Allow overriding slimevr server/port to search on idk why i didn't have this before, lol thanks @ButterscotchV --- src/languages/en.json | 4 +++- src/main.ts | 24 ++++++++++++++++++++++-- src/static/html/index.html | 38 ++++++++++++++++++++++++++++++++++++++ src/static/js/index.ts | 38 +++++++++++++++++++++++++++++++++++++- 4 files changed, 100 insertions(+), 4 deletions(-) diff --git a/src/languages/en.json b/src/languages/en.json index aaea101..0b7dd4a 100644 --- a/src/languages/en.json +++ b/src/languages/en.json @@ -100,7 +100,9 @@ "autoStart": "Start connection on open", "autoOff": "Turn off trackers on exit", "trackerVisualizationFPS": "Tracker visualization FPS", - "heartbeat": "Tracker heartbeat interval" + "heartbeat": "Tracker heartbeat interval", + "serverAddress": "SlimeVR server address", + "serverPort": "SlimeVR server port" }, "updates": { "title": "Update checking", diff --git a/src/main.ts b/src/main.ts index b502002..8d52b9b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -40,6 +40,8 @@ let firstLaunch = false; let isClosing = false; let hasInitializedLogDir = false; let foundSlimeVR = false; +let serverAddress = "255.255.255.255"; +let serverPort = 6969; let canLogToFile = true; let loggingMode = 1; @@ -86,6 +88,9 @@ try { updateChannel = config.global?.updates?.updateChannel ?? "stable"; heartbeatInterval = config.global?.trackers?.heartbeatInterval ?? 2000; loggingMode = config.global?.debug?.loggingMode ?? 1; + + serverAddress = config.global?.serverAddress ?? "255.255.255.255"; + serverPort = config.global?.serverPort ?? 6969; } catch (err) { // If the config file doesn't exist or is empty, create it log("First launch, creating config file and showing onboarding screen (after load)"); @@ -637,6 +642,16 @@ ipcMain.on("set-auto-off", (_event, arg) => { log(`Auto-off set to: ${arg}`, "settings"); }); +ipcMain.on("set-server-address", (_event, arg) => { + serverAddress = arg; + log(`Server address set to: ${arg}`, "settings"); +}); + +ipcMain.on("set-server-port", (_event, arg) => { + serverPort = arg; + log(`Server port set to: ${arg}`, "settings"); +}); + ipcMain.on("open-support-page", async () => { await shell.openExternal("https://github.com/OCSYT/SlimeTora/wiki/FAQ#i-found-an-issuebug"); }); @@ -1194,7 +1209,9 @@ async function processQueue() { `SlimeTora v${app.getVersion()}`, new FirmwareFeatureFlags(new Map([])), BoardType.HARITORA, - MCUType.HARITORA + MCUType.HARITORA, + serverAddress, + serverPort ); await newTracker.init(); @@ -1650,11 +1667,14 @@ const heartbeatTracker = new EmulatedTracker( `SlimeTora v${app.getVersion()} heartbeat`, new FirmwareFeatureFlags(new Map([])), BoardType.HARITORA, - MCUType.HARITORA + MCUType.HARITORA, + serverAddress, + serverPort ); setupTrackerEvents(heartbeatTracker, true); await heartbeatTracker.init(); +log(`Looking for SlimeVR server on: ${serverAddress}:${serverPort}`, "connection"); /* * Logging diff --git a/src/static/html/index.html b/src/static/html/index.html index 4e16228..f119b8f 100644 --- a/src/static/html/index.html +++ b/src/static/html/index.html @@ -432,6 +432,43 @@

Other s +
+
+
+
+ + +
+
+
+
+ + +
+
+
@@ -728,6 +765,7 @@


+