From 6658fb7940afc467962a6d488c229429cc14ae99 Mon Sep 17 00:00:00 2001 From: jyelon Date: Wed, 3 Jun 2026 15:52:20 -0400 Subject: [PATCH] Add Editor Preference to control server selection --- .../DefaultEditorPerProjectUserSettings.ini | 4 + .../KnownServers/SS_Josh_Primary.uasset | 3 + .../KnownServers/SS_Josh_Secondary.uasset | 3 + .../Luprex/KnownServers/SS_Localhost.uasset | 3 + .../Luprex/KnownServers/SS_Standalone.uasset | 3 + Integration.code-workspace.tpl.json | 183 ++++++++++-------- Source/Integration/BreakToDebugger.h | 6 +- Source/Integration/InputDeviceTracker.h | 4 - Source/Integration/Integration.Build.cs | 3 +- Source/Integration/LuprexGameModeBase.cpp | 16 +- Source/Integration/ProjectSettings.cpp | 1 + Source/Integration/ProjectSettings.h | 34 ++++ 12 files changed, 163 insertions(+), 100 deletions(-) create mode 100644 Content/Luprex/KnownServers/SS_Josh_Primary.uasset create mode 100644 Content/Luprex/KnownServers/SS_Josh_Secondary.uasset create mode 100644 Content/Luprex/KnownServers/SS_Localhost.uasset create mode 100644 Content/Luprex/KnownServers/SS_Standalone.uasset create mode 100644 Source/Integration/ProjectSettings.cpp create mode 100644 Source/Integration/ProjectSettings.h diff --git a/Config/DefaultEditorPerProjectUserSettings.ini b/Config/DefaultEditorPerProjectUserSettings.ini index bfbba785..73a0d865 100644 --- a/Config/DefaultEditorPerProjectUserSettings.ini +++ b/Config/DefaultEditorPerProjectUserSettings.ini @@ -11,3 +11,7 @@ SaveOnCompile=SoC_SuccessOnly RestoreOpenAssetTabsOnRestart=AlwaysRestore AutoSaveWarningInSeconds=0 + +[/Script/Integration.lxProjectSettings] +ActiveServer=/Game/Luprex/KnownServers/SS_Localhost.SS_Localhost + diff --git a/Content/Luprex/KnownServers/SS_Josh_Primary.uasset b/Content/Luprex/KnownServers/SS_Josh_Primary.uasset new file mode 100644 index 00000000..3ea5e42e --- /dev/null +++ b/Content/Luprex/KnownServers/SS_Josh_Primary.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d65f798f954733287ae4f76b78151d2c7a7ba2c77dc4baf8b3ff29b9b965dd20 +size 1634 diff --git a/Content/Luprex/KnownServers/SS_Josh_Secondary.uasset b/Content/Luprex/KnownServers/SS_Josh_Secondary.uasset new file mode 100644 index 00000000..777e2b57 --- /dev/null +++ b/Content/Luprex/KnownServers/SS_Josh_Secondary.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c4c721ce8aac5e55a4b64e16ec9bece40db3b85cecb5a3b5188e30ca9356375 +size 1658 diff --git a/Content/Luprex/KnownServers/SS_Localhost.uasset b/Content/Luprex/KnownServers/SS_Localhost.uasset new file mode 100644 index 00000000..0c6952dc --- /dev/null +++ b/Content/Luprex/KnownServers/SS_Localhost.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c5886dad615600ff7d74bdecbbfbd9147d719a7d3e57b27161c24cf3442fd93d +size 1629 diff --git a/Content/Luprex/KnownServers/SS_Standalone.uasset b/Content/Luprex/KnownServers/SS_Standalone.uasset new file mode 100644 index 00000000..4469792d --- /dev/null +++ b/Content/Luprex/KnownServers/SS_Standalone.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c8b7098bd7623d59a38e405f0beeaf52e94b60fa20c4a168eb7829b10e1b8b7f +size 1585 diff --git a/Integration.code-workspace.tpl.json b/Integration.code-workspace.tpl.json index 618ecbd4..c7693a9e 100644 --- a/Integration.code-workspace.tpl.json +++ b/Integration.code-workspace.tpl.json @@ -72,22 +72,48 @@ }, "tasks": { "version": "2.0.0", - "tasks": { - "for-each" : [ - { "CMD" : "python3 build.py c++", "DEFAULT":true }, - { "CMD" : "python3 build.py all", "DEFAULT":false }, - { "CMD" : "python3 build.py clean", "DEFAULT":false } - ], - "body" : { - "label": "[CMD]", - "group": { - "kind": "build", - "isDefault": "[DEFAULT]" - }, - "command": "[CMD]", - "presentation": { - "clear": true - }, + "tasks": [ + { + "label": "python3 build.py c++", + "group": { "kind": "build", "isDefault": true }, + "command": "python3 build.py c++", + "presentation": { "clear": true }, + "problemMatcher": [ + { + "owner": "build-integration", + "source": "build.py", + "fileLocation": ["relative", "${workspaceFolder}"], + "pattern": { + "regexp": "^(.*):(\\d+):(\\d+):\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$", + "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 + } + } + ], + "type": "shell" + }, + { + "label": "python3 build.py all", + "group": { "kind": "build", "isDefault": false }, + "command": "python3 build.py all", + "presentation": { "clear": true }, + "problemMatcher": [ + { + "owner": "build-integration", + "source": "build.py", + "fileLocation": ["relative", "${workspaceFolder}"], + "pattern": { + "regexp": "^(.*):(\\d+):(\\d+):\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$", + "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 + } + } + ], + "type": "shell" + }, + { + "label": "python3 build.py clean", + "group": { "kind": "build", "isDefault": false }, + "command": "python3 build.py clean", + "presentation": { "clear": true }, "problemMatcher": [ { "owner": "build-integration", @@ -101,78 +127,67 @@ ], "type": "shell" } - } + ] }, "launch": { "version": "0.2.0", - "configurations": { - "append1" : { - "for-each": [ - { "SERVER" : "Standalone" }, - { "SERVER" : "LocalHost" }, - { "SERVER" : "192.168.1.155" }, - { "SERVER" : "192.168.1.156" } + "configurations": [ + { + "name": "UnrealEditor", + "request": "launch", + "program": "[UNREALENGINE]/Engine/Binaries/Linux/UnrealEditor-Linux-[DEBUG]", + "preLaunchTask": "python3 build.py c++", + "args": [ + "[INTEGRATION]/Integration.uproject", + "-userdir=User/[USER]" ], - "body": { - "name": "Server=[SERVER]", - "request": "launch", - "program": "[UNREALENGINE]/Engine/Binaries/Linux/UnrealEditor-Linux-[DEBUG]", - "preLaunchTask": "python3 build.py c++", - "args": [ - "[INTEGRATION]/Integration.uproject", - "-userdir=User/[USER]", - "-LuprexServer=[SERVER]" - ], - "cwd": "[INTEGRATION]", - "type": "lldb", - "console": "integratedTerminal", - "initCommands": [ - "command script import [INTEGRATION]/tools/UEDataFormatter.py", - "settings set target.inline-breakpoint-strategy always", - "settings set target.prefer-dynamic-value no-run-target", - "process handle SIGTRAP --notify false --pass false --stop false", - "target stop-hook add --one-liner \"p FUnixPlatformMisc::UngrabAllInput()\"" - ] - } + "cwd": "[INTEGRATION]", + "type": "lldb", + "console": "integratedTerminal", + "initCommands": [ + "command script import [INTEGRATION]/tools/UEDataFormatter.py", + "settings set target.inline-breakpoint-strategy always", + "settings set target.prefer-dynamic-value no-run-target", + "process handle SIGTRAP --notify false --pass false --stop false", + "target stop-hook add --one-liner \"p FUnixPlatformMisc::UngrabAllInput()\"" + ] }, - "append2" : [ - { - "name": "UEWingman Commandlet", - "request": "launch", - "program": "[UNREALENGINE]/Engine/Binaries/Linux/UnrealEditor-Linux-[DEBUG]-Cmd", - "preLaunchTask": "python3 build.py c++", - "args": [ - "[INTEGRATION]/Integration.uproject", - "-userdir=User/[USER]", - "-run=UEWingman", - "-unattended" - ], - "cwd": "[INTEGRATION]", - "type": "lldb", - "console": "integratedTerminal", - "initCommands": [ - "command script import [INTEGRATION]/tools/UEDataFormatter.py", - "settings set target.inline-breakpoint-strategy always", - "settings set target.prefer-dynamic-value no-run-target", - "process handle SIGTRAP --notify false --pass false --stop false" - ] - }, - { - "name": "Luprex Server", - "request": "launch", - "program": "[INTEGRATION]/luprex/build/[OS]/luprexstatic", - "preLaunchTask": "python3 build.py c++", - "args": [ "lpxserver" ], - "cwd": "[INTEGRATION]/luprex", - "type": "lldb", - "console": "integratedTerminal", - "initCommands": [ - "settings set target.inline-breakpoint-strategy always", - "settings set target.prefer-dynamic-value no-run-target", - "process handle SIGTRAP --notify false --pass false --stop false" - ] - } - ] - } + { + "name": "UEWingman Commandlet", + "request": "launch", + "program": "[UNREALENGINE]/Engine/Binaries/Linux/UnrealEditor-Linux-[DEBUG]-Cmd", + "preLaunchTask": "python3 build.py c++", + "args": [ + "[INTEGRATION]/Integration.uproject", + "-userdir=User/[USER]", + "-run=UEWingman", + "-unattended" + ], + "cwd": "[INTEGRATION]", + "type": "lldb", + "console": "integratedTerminal", + "initCommands": [ + "command script import [INTEGRATION]/tools/UEDataFormatter.py", + "settings set target.inline-breakpoint-strategy always", + "settings set target.prefer-dynamic-value no-run-target", + "process handle SIGTRAP --notify false --pass false --stop false" + ] + }, + { + "name": "Luprex Server", + "request": "launch", + "program": "[INTEGRATION]/luprex/build/[OS]/luprexstatic", + "preLaunchTask": "python3 build.py c++", + "args": [ "lpxserver" ], + "cwd": "[INTEGRATION]/luprex", + "type": "lldb", + "console": "integratedTerminal", + "initCommands": [ + "settings set target.inline-breakpoint-strategy always", + "settings set target.prefer-dynamic-value no-run-target", + "process handle SIGTRAP --notify false --pass false --stop false" + ] + } + ] } } diff --git a/Source/Integration/BreakToDebugger.h b/Source/Integration/BreakToDebugger.h index cdac93fb..9309b3e6 100644 --- a/Source/Integration/BreakToDebugger.h +++ b/Source/Integration/BreakToDebugger.h @@ -5,9 +5,9 @@ // When an error message gets written to UE_LOG, we can // optionally trigger the blueprint debugger. // -// This only affects UE_LOG messages that are generated -// during blueprint execution. Log messages from other -// threads do not trigger the debugger. +// This only affects UE_LOG messages that are generated by +// the blueprint thread, during blueprint execution. Log +// messages from other threads do not trigger the debugger. // // The following explains how we trigger the blueprint // debugger on UE_LOG messages. Log messages are sent to a diff --git a/Source/Integration/InputDeviceTracker.h b/Source/Integration/InputDeviceTracker.h index f256b48c..ba891e17 100644 --- a/Source/Integration/InputDeviceTracker.h +++ b/Source/Integration/InputDeviceTracker.h @@ -23,10 +23,6 @@ // // FInputDeviceTrackerProcessor // -// Slate input preprocessor. Updates the device-class -// static on each button-down event. Never consumes -// events (always returns false). -// //////////////////////////////////////////////////////////// class FInputDeviceTrackerProcessor : public IInputProcessor diff --git a/Source/Integration/Integration.Build.cs b/Source/Integration/Integration.Build.cs index 99c0102c..8e991ab9 100644 --- a/Source/Integration/Integration.Build.cs +++ b/Source/Integration/Integration.Build.cs @@ -19,7 +19,8 @@ public class Integration : ModuleRules "Networking", "EnhancedInput", "UMG", - "RenderCore" + "RenderCore", + "DeveloperSettings" }); PrivateDependencyModuleNames.AddRange(new string[] { diff --git a/Source/Integration/LuprexGameModeBase.cpp b/Source/Integration/LuprexGameModeBase.cpp index b13ae807..e54618a8 100644 --- a/Source/Integration/LuprexGameModeBase.cpp +++ b/Source/Integration/LuprexGameModeBase.cpp @@ -12,6 +12,7 @@ #include "Blueprint/WidgetBlueprintLibrary.h" #include "Kismet/GameplayStatics.h" #include "Engine/GameInstance.h" +#include "ProjectSettings.h" #include "Common.h" #include "AnimQueue.h" @@ -214,14 +215,13 @@ void ALuprexGameModeBase::InitializeGlobalState() // Possibly tell the engine to connect to a server. if (Playing) { - FString LuprexServer; - FParse::Value(FCommandLine::Get(), TEXT("-LuprexServer="), LuprexServer); - LuprexServer = LuprexServer.ToLower(); - UE_LOG(LogTemp, Display, TEXT("LuprexServer = %s"), *LuprexServer) - if (LuprexServer != TEXT("standalone")) - { - FTCHARToUTF8 utf8server(LuprexServer); - w->play_access(w.Get(), AccessKind::CONNECT_TO_SERVER, 0, utf8server.Length(), utf8server.Get(), nullptr, nullptr); + UlxServerSelection* Server = GetDefault()->ActiveServer.LoadSynchronous(); + if (Server) { + FString Host = Server->Host.TrimStartAndEnd(); + if (!Host.IsEmpty()) { + FTCHARToUTF8 utf8server(*Server->Host); + w->play_access(w.Get(), AccessKind::CONNECT_TO_SERVER, 0, utf8server.Length(), utf8server.Get(), nullptr, nullptr); + } } } diff --git a/Source/Integration/ProjectSettings.cpp b/Source/Integration/ProjectSettings.cpp new file mode 100644 index 00000000..84f01262 --- /dev/null +++ b/Source/Integration/ProjectSettings.cpp @@ -0,0 +1 @@ +#include "ProjectSettings.h" diff --git a/Source/Integration/ProjectSettings.h b/Source/Integration/ProjectSettings.h new file mode 100644 index 00000000..b3324793 --- /dev/null +++ b/Source/Integration/ProjectSettings.h @@ -0,0 +1,34 @@ +#pragma once + +#include "CoreMinimal.h" +#include "Engine/DataAsset.h" +#include "Engine/DeveloperSettings.h" +#include "ProjectSettings.generated.h" + +UCLASS(BlueprintType) +class INTEGRATION_API UlxServerSelection : public UPrimaryDataAsset +{ + GENERATED_BODY() + +public: + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Server") + FString Description; + + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Server") + FString Host; +}; + +UCLASS(Config=EditorPerProjectUserSettings, DefaultConfig, meta=(DisplayName="Server Settings")) +class INTEGRATION_API UlxProjectSettings : public UDeveloperSettings +{ + GENERATED_BODY() + +public: + virtual FName GetContainerName() const override { return TEXT("Editor"); } + virtual FName GetCategoryName() const override { return TEXT("Luprex"); } + virtual FName GetSectionName() const override { return TEXT("Server"); } + + UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category="Server", + meta=(AllowedClasses="/Script/Integration.lxServerSelection")) + TSoftObjectPtr ActiveServer; +};