From d9cb9fb31e18ef5128f1b08889b9a7ed3c40cebd Mon Sep 17 00:00:00 2001 From: Zenny Date: Thu, 27 Feb 2025 22:30:51 -0800 Subject: [PATCH] Cleanup, make the project compilable on windows using AoT, add room box to all rooms --- GameJamDungeon.csproj | 9 +- .../deploy_to_steamos/GodotExportManager.cs | 53 -- .../GodotExportManager.cs.uid | 1 - addons/deploy_to_steamos/Plugin.cs | 33 -- addons/deploy_to_steamos/Plugin.cs.uid | 1 - addons/deploy_to_steamos/SettingsFile.cs | 13 - addons/deploy_to_steamos/SettingsFile.cs.uid | 1 - addons/deploy_to_steamos/SettingsManager.cs | 101 ---- .../deploy_to_steamos/SettingsManager.cs.uid | 1 - .../deploy_to_steamos/SteamOSDevkitManager.cs | 251 ---------- .../SteamOSDevkitManager.cs.uid | 1 - .../add_device_window/AddDeviceWindow.cs | 130 ----- .../add_device_window/AddDeviceWindow.cs.uid | 1 - .../add_device_window/DeviceItemPrefab.cs | 42 -- .../add_device_window/DeviceItemPrefab.cs.uid | 1 - .../add_device_window/add_device_window.tscn | 107 ---- .../add_device_window/device_item_prefab.tscn | 63 --- .../deploy_dock/DeployDock.cs | 108 ---- .../deploy_dock/DeployDock.cs.uid | 1 - .../deploy_dock/deploy_dock.tscn | 54 -- .../deploy_window/DeployWindow.Build.cs | 38 -- .../deploy_window/DeployWindow.Build.cs.uid | 1 - .../DeployWindow.CreateShortcut.cs | 36 -- .../DeployWindow.CreateShortcut.cs.uid | 1 - .../deploy_window/DeployWindow.Init.cs | 41 -- .../deploy_window/DeployWindow.Init.cs.uid | 1 - .../DeployWindow.PrepareUpload.cs | 26 - .../DeployWindow.PrepareUpload.cs.uid | 1 - .../deploy_window/DeployWindow.Upload.cs | 33 -- .../deploy_window/DeployWindow.Upload.cs.uid | 1 - .../deploy_window/DeployWindow.cs | 304 ------------ .../deploy_window/DeployWindow.cs.uid | 1 - .../deploy_window/deploy_window.tscn | 287 ----------- addons/deploy_to_steamos/folder.svg | 1 - addons/deploy_to_steamos/folder.svg.import | 37 -- addons/deploy_to_steamos/icon.svg | 13 - addons/deploy_to_steamos/icon.svg.import | 37 -- addons/deploy_to_steamos/plugin.cfg | 7 - .../settings_panel/SettingsPanel.cs | 101 ---- .../settings_panel/SettingsPanel.cs.uid | 1 - .../settings_panel/settings_panel.tscn | 259 ---------- export_presets.cfg | 70 +++ project.godot | 1 + src/app/state/AppLogic.g.puml | 2 +- src/enemy/Enemy.cs | 12 +- .../02. michael/MichaelModelView.tscn | 42 +- .../06. chariot/ChariotModelView.tscn | 163 +----- .../enemy_types/09. Agi/AgiModelView.tscn | 10 +- .../GoldSproingyModelView.tscn | 58 +-- src/enemy/enemy_types/15. ox_face/OxFace.tscn | 24 +- .../enemy_types/15. ox_face/OxFace2.tscn | 463 ------------------ src/enemy/state/EnemyLogic.g.puml | 4 +- src/game/GameLogic.g.puml | 8 +- src/map/Map.cs | 1 - src/map/dungeon/Teleport.tscn | 20 - src/map/dungeon/code/MonsterRoom.cs | 64 ++- src/map/dungeon/floors/Floor01.tscn | 14 +- src/map/dungeon/floors/Floor02.tscn | 16 +- src/map/dungeon/floors/Floor03.tscn | 16 +- src/map/dungeon/floors/Floor04.tscn | 16 +- src/map/dungeon/floors/Floor05.tscn | 16 +- src/map/dungeon/floors/Floor06.tscn | 16 +- src/map/dungeon/floors/Floor07.tscn | 16 +- src/map/dungeon/floors/Floor08.tscn | 16 +- src/map/dungeon/floors/Floor09.tscn | 16 +- src/map/dungeon/floors/Floor10.tscn | 2 +- src/map/dungeon/floors/Floor11.tscn | 20 +- src/map/dungeon/floors/Floor12.tscn | 20 +- src/map/dungeon/floors/Floor13.tscn | 20 +- src/map/dungeon/floors/Floor14.tscn | 20 +- src/map/dungeon/floors/Floor15.tscn | 20 +- src/map/dungeon/floors/Floor16.tscn | 20 +- src/map/dungeon/floors/Floor17.tscn | 20 +- src/map/dungeon/floors/Floor18.tscn | 20 +- src/map/dungeon/floors/Floor19.tscn | 20 +- src/map/dungeon/floors/Floor20.tscn | 2 +- src/map/dungeon/floors/Floor21.tscn | 2 +- src/map/dungeon/floors/Floor22.tscn | 2 +- .../Set A/03. Antechamber A.tscn | 14 +- .../Set A/04. Antechamber B.tscn | 14 +- .../Set A/05. Pit Room A.tscn | 15 +- .../Set A/06. Balcony Room A.tscn | 14 +- .../Set A/07. Statue Room.tscn | 14 +- .../Set A/08. Basin Room.tscn} | 15 +- .../Set A/09. Column Room.tscn | 14 +- .../Set A/10. Item Transfer Room.tscn | 14 +- .../Set A/11. Long Room.tscn | 14 +- .../Set A/12. Jump Scare Room.tscn | 14 +- .../Set A/13. Water Room.tscn | 14 +- .../Set A/14. Ran's Room.tscn | 14 +- .../Set A/15. Boss Floor A.tscn | 0 .../Set A/16. Seshat's Room.tscn | 14 +- .../Set A/17. Gesthemii's Room.tscn | 14 +- .../Set A/18. Corridor A.tscn | 0 .../Set A/19. Floor Exit A.tscn | 15 +- .../Set B/20. Antechamber 3.tscn | 15 +- .../Set B/21. Gallery Room.tscn | 15 +- .../Set B/22. Pit Room B.tscn | 15 +- .../Set B/23. Antechamber 4.tscn | 15 +- .../Set B/24. Balcony Room 2.tscn | 15 +- .../Set B/25. Pedestal Room.tscn | 15 +- .../Set B/26. Item Transfer Room B.tscn | 17 +- .../Set B/27. Water Room B.tscn | 21 +- .../Set B/28. Long Room B.tscn | 15 +- .../Set B/29. Column Circle Room.tscn | 15 +- .../Set B/30. Void Room.tscn | 0 .../Set B/31. Dismantled Saint's Room.tscn | 15 +- .../Set B/32. Proscenium's Room.tscn | 15 +- .../Set B/33. Puer's Room.tscn | 17 +- .../Set B/34. Boss Floor B.tscn | 0 .../Set B/35. Goddess of Guidance's Room.tscn | 0 .../Set B/36. Final Floor.tscn | 0 .../Set B/37. Corridor 2.tscn | 0 .../Set B/38. Floor Exit B.tscn | 15 +- src/player/state/PlayerLogic.g.puml | 6 +- 115 files changed, 757 insertions(+), 3153 deletions(-) delete mode 100644 addons/deploy_to_steamos/GodotExportManager.cs delete mode 100644 addons/deploy_to_steamos/GodotExportManager.cs.uid delete mode 100644 addons/deploy_to_steamos/Plugin.cs delete mode 100644 addons/deploy_to_steamos/Plugin.cs.uid delete mode 100644 addons/deploy_to_steamos/SettingsFile.cs delete mode 100644 addons/deploy_to_steamos/SettingsFile.cs.uid delete mode 100644 addons/deploy_to_steamos/SettingsManager.cs delete mode 100644 addons/deploy_to_steamos/SettingsManager.cs.uid delete mode 100644 addons/deploy_to_steamos/SteamOSDevkitManager.cs delete mode 100644 addons/deploy_to_steamos/SteamOSDevkitManager.cs.uid delete mode 100644 addons/deploy_to_steamos/add_device_window/AddDeviceWindow.cs delete mode 100644 addons/deploy_to_steamos/add_device_window/AddDeviceWindow.cs.uid delete mode 100644 addons/deploy_to_steamos/add_device_window/DeviceItemPrefab.cs delete mode 100644 addons/deploy_to_steamos/add_device_window/DeviceItemPrefab.cs.uid delete mode 100644 addons/deploy_to_steamos/add_device_window/add_device_window.tscn delete mode 100644 addons/deploy_to_steamos/add_device_window/device_item_prefab.tscn delete mode 100644 addons/deploy_to_steamos/deploy_dock/DeployDock.cs delete mode 100644 addons/deploy_to_steamos/deploy_dock/DeployDock.cs.uid delete mode 100644 addons/deploy_to_steamos/deploy_dock/deploy_dock.tscn delete mode 100644 addons/deploy_to_steamos/deploy_window/DeployWindow.Build.cs delete mode 100644 addons/deploy_to_steamos/deploy_window/DeployWindow.Build.cs.uid delete mode 100644 addons/deploy_to_steamos/deploy_window/DeployWindow.CreateShortcut.cs delete mode 100644 addons/deploy_to_steamos/deploy_window/DeployWindow.CreateShortcut.cs.uid delete mode 100644 addons/deploy_to_steamos/deploy_window/DeployWindow.Init.cs delete mode 100644 addons/deploy_to_steamos/deploy_window/DeployWindow.Init.cs.uid delete mode 100644 addons/deploy_to_steamos/deploy_window/DeployWindow.PrepareUpload.cs delete mode 100644 addons/deploy_to_steamos/deploy_window/DeployWindow.PrepareUpload.cs.uid delete mode 100644 addons/deploy_to_steamos/deploy_window/DeployWindow.Upload.cs delete mode 100644 addons/deploy_to_steamos/deploy_window/DeployWindow.Upload.cs.uid delete mode 100644 addons/deploy_to_steamos/deploy_window/DeployWindow.cs delete mode 100644 addons/deploy_to_steamos/deploy_window/DeployWindow.cs.uid delete mode 100644 addons/deploy_to_steamos/deploy_window/deploy_window.tscn delete mode 100644 addons/deploy_to_steamos/folder.svg delete mode 100644 addons/deploy_to_steamos/folder.svg.import delete mode 100644 addons/deploy_to_steamos/icon.svg delete mode 100644 addons/deploy_to_steamos/icon.svg.import delete mode 100644 addons/deploy_to_steamos/plugin.cfg delete mode 100644 addons/deploy_to_steamos/settings_panel/SettingsPanel.cs delete mode 100644 addons/deploy_to_steamos/settings_panel/SettingsPanel.cs.uid delete mode 100644 addons/deploy_to_steamos/settings_panel/settings_panel.tscn delete mode 100644 src/enemy/enemy_types/15. ox_face/OxFace2.tscn delete mode 100644 src/map/dungeon/Teleport.tscn rename src/map/dungeon/{scenes => rooms}/Set A/03. Antechamber A.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set A/04. Antechamber B.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set A/05. Pit Room A.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set A/06. Balcony Room A.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set A/07. Statue Room.tscn (99%) rename src/map/dungeon/{scenes/Set A/08. BasinRoom.tscn => rooms/Set A/08. Basin Room.tscn} (99%) rename src/map/dungeon/{scenes => rooms}/Set A/09. Column Room.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set A/10. Item Transfer Room.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set A/11. Long Room.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set A/12. Jump Scare Room.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set A/13. Water Room.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set A/14. Ran's Room.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set A/15. Boss Floor A.tscn (100%) rename src/map/dungeon/{scenes => rooms}/Set A/16. Seshat's Room.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set A/17. Gesthemii's Room.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set A/18. Corridor A.tscn (100%) rename src/map/dungeon/{scenes => rooms}/Set A/19. Floor Exit A.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set B/20. Antechamber 3.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set B/21. Gallery Room.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set B/22. Pit Room B.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set B/23. Antechamber 4.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set B/24. Balcony Room 2.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set B/25. Pedestal Room.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set B/26. Item Transfer Room B.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set B/27. Water Room B.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set B/28. Long Room B.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set B/29. Column Circle Room.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set B/30. Void Room.tscn (100%) rename src/map/dungeon/{scenes => rooms}/Set B/31. Dismantled Saint's Room.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set B/32. Proscenium's Room.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set B/33. Puer's Room.tscn (99%) rename src/map/dungeon/{scenes => rooms}/Set B/34. Boss Floor B.tscn (100%) rename src/map/dungeon/{scenes => rooms}/Set B/35. Goddess of Guidance's Room.tscn (100%) rename src/map/dungeon/{scenes => rooms}/Set B/36. Final Floor.tscn (100%) rename src/map/dungeon/{scenes => rooms}/Set B/37. Corridor 2.tscn (100%) rename src/map/dungeon/{scenes => rooms}/Set B/38. Floor Exit B.tscn (99%) diff --git a/GameJamDungeon.csproj b/GameJamDungeon.csproj index 653c8869..199c686b 100644 --- a/GameJamDungeon.csproj +++ b/GameJamDungeon.csproj @@ -2,12 +2,13 @@ net8.0 true + + true - - - - + + + diff --git a/addons/deploy_to_steamos/GodotExportManager.cs b/addons/deploy_to_steamos/GodotExportManager.cs deleted file mode 100644 index 19f380bc..00000000 --- a/addons/deploy_to_steamos/GodotExportManager.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Diagnostics; -using Godot; - -namespace Laura.DeployToSteamOS; - -public class GodotExportManager -{ - public static void ExportProject( - string projectPath, - string outputPath, - bool isReleaseBuild, - Callable logCallable, - Action OnProcessExited = null) - { - logCallable.CallDeferred("Starting project export, this may take a while."); - logCallable.CallDeferred($"Output path: {outputPath}"); - logCallable.CallDeferred($"Is Release Build: {(isReleaseBuild ? "Yes" : "No")}"); - - Process exportProcess = new Process(); - - exportProcess.StartInfo.FileName = OS.GetExecutablePath(); - - var arguments = $"--headless --path \"{projectPath}\" "; - arguments += isReleaseBuild ? "--export-release " : "--export-debug "; - arguments += "\"Steamdeck\" "; - arguments += $"\"{outputPath}\""; - - exportProcess.StartInfo.Arguments = arguments; - exportProcess.StartInfo.UseShellExecute = false; - exportProcess.StartInfo.RedirectStandardOutput = true; - exportProcess.EnableRaisingEvents = true; - - exportProcess.ErrorDataReceived += (sender, args) => - { - throw new Exception("Error while building project: " + args.Data); - }; - - exportProcess.OutputDataReceived += (sender, args) => - { - logCallable.CallDeferred(args.Data); - }; - - exportProcess.Exited += (sender, args) => - { - OnProcessExited?.Invoke(); - exportProcess.WaitForExit(); - }; - - exportProcess.Start(); - exportProcess.BeginOutputReadLine(); - } -} \ No newline at end of file diff --git a/addons/deploy_to_steamos/GodotExportManager.cs.uid b/addons/deploy_to_steamos/GodotExportManager.cs.uid deleted file mode 100644 index f2d5ffbd..00000000 --- a/addons/deploy_to_steamos/GodotExportManager.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://bilfhy4daj1r7 diff --git a/addons/deploy_to_steamos/Plugin.cs b/addons/deploy_to_steamos/Plugin.cs deleted file mode 100644 index 04a739aa..00000000 --- a/addons/deploy_to_steamos/Plugin.cs +++ /dev/null @@ -1,33 +0,0 @@ -#if TOOLS -using Godot; - -namespace Laura.DeployToSteamOS; - -[Tool] -public partial class Plugin : EditorPlugin -{ - private Control _dock; - private Control _settingsPanel; - - public override void _EnterTree() - { - AddAutoloadSingleton("SettingsManager", "res://addons/deploy_to_steamos/SettingsManager.cs"); - - _dock = GD.Load("res://addons/deploy_to_steamos/deploy_dock/deploy_dock.tscn").Instantiate(); - _settingsPanel = GD.Load("res://addons/deploy_to_steamos/settings_panel/settings_panel.tscn").Instantiate(); - - AddControlToContainer(CustomControlContainer.Toolbar, _dock); - AddControlToContainer(CustomControlContainer.ProjectSettingTabRight, _settingsPanel); - } - - public override void _ExitTree() - { - RemoveControlFromContainer(CustomControlContainer.Toolbar, _dock); - RemoveControlFromContainer(CustomControlContainer.ProjectSettingTabRight, _settingsPanel); - - RemoveAutoloadSingleton("SettingsManager"); - - _dock.Free(); - } -} -#endif diff --git a/addons/deploy_to_steamos/Plugin.cs.uid b/addons/deploy_to_steamos/Plugin.cs.uid deleted file mode 100644 index 6ec5e543..00000000 --- a/addons/deploy_to_steamos/Plugin.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://b6d4565qxd5vp diff --git a/addons/deploy_to_steamos/SettingsFile.cs b/addons/deploy_to_steamos/SettingsFile.cs deleted file mode 100644 index b29631e4..00000000 --- a/addons/deploy_to_steamos/SettingsFile.cs +++ /dev/null @@ -1,13 +0,0 @@ -public class SettingsFile -{ - public enum UploadMethods - { - Differential, - Incremental, - CleanReplace - } - - public string BuildPath { get; set; } = ""; - public string StartParameters { get; set; } = ""; - public UploadMethods UploadMethod { get; set; } = UploadMethods.Differential; -} \ No newline at end of file diff --git a/addons/deploy_to_steamos/SettingsFile.cs.uid b/addons/deploy_to_steamos/SettingsFile.cs.uid deleted file mode 100644 index b7029f39..00000000 --- a/addons/deploy_to_steamos/SettingsFile.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://dqm7rp41yye7q diff --git a/addons/deploy_to_steamos/SettingsManager.cs b/addons/deploy_to_steamos/SettingsManager.cs deleted file mode 100644 index 7f4133db..00000000 --- a/addons/deploy_to_steamos/SettingsManager.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System.Collections.Generic; -using System.Text.Json; -using Godot; - -namespace Laura.DeployToSteamOS; - -[Tool] -public partial class SettingsManager : Node -{ - public static SettingsManager Instance; - - private const string FolderPath = "res://.deploy_to_steamos"; - private const string SettingsPath = FolderPath + "/settings.json"; - private const string DevicesPath = FolderPath + "/devices.json"; - - public bool IsDirty = false; - public SettingsFile Settings = new(); - public List Devices = new(); - - public override void _EnterTree() - { - Instance = this; - - Load(); - } - - public void Load() - { - if (!FileAccess.FileExists(SettingsPath)) - { - Settings = new SettingsFile(); - IsDirty = true; - } - else - { - using var settingsFile = FileAccess.Open(SettingsPath, FileAccess.ModeFlags.Read); - var settingsFileContent = settingsFile.GetAsText(); - - Settings = JsonSerializer.Deserialize(settingsFileContent, DefaultSerializerOptions); - - // Failsafe if settings file is corrupt - if (Settings == null) - { - Settings = new SettingsFile(); - IsDirty = true; - } - } - - if (!FileAccess.FileExists(SettingsPath)) - { - Devices = new List(); - IsDirty = true; - } - else - { - using var devicesFile = FileAccess.Open(DevicesPath, FileAccess.ModeFlags.Read); - var devicesFileContent = devicesFile.GetAsText(); - - Devices = JsonSerializer.Deserialize>(devicesFileContent, DefaultSerializerOptions); - - // Failsafe if device file is corrupt - if (Devices == null) - { - Devices = new List(); - IsDirty = true; - } - } - - if (IsDirty) - { - Save(); - } - } - - public void Save() - { - // Check if directory exists and create if it doesn't - var dirAccess = DirAccess.Open(FolderPath); - if (dirAccess == null) - { - DirAccess.MakeDirRecursiveAbsolute(FolderPath); - } - - // Save Settings - var jsonSettings = JsonSerializer.Serialize(Settings); - using var settingsFile = FileAccess.Open(SettingsPath, FileAccess.ModeFlags.Write); - settingsFile.StoreString(jsonSettings); - - // Save Devices - var jsonDevices = JsonSerializer.Serialize(Devices); - using var devicesFile = FileAccess.Open(DevicesPath, FileAccess.ModeFlags.Write); - devicesFile.StoreString(jsonDevices); - - IsDirty = false; - } - - public static readonly JsonSerializerOptions DefaultSerializerOptions = new JsonSerializerOptions - { - PropertyNameCaseInsensitive = true, - }; -} \ No newline at end of file diff --git a/addons/deploy_to_steamos/SettingsManager.cs.uid b/addons/deploy_to_steamos/SettingsManager.cs.uid deleted file mode 100644 index 61528763..00000000 --- a/addons/deploy_to_steamos/SettingsManager.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://f4th1y34dy1y diff --git a/addons/deploy_to_steamos/SteamOSDevkitManager.cs b/addons/deploy_to_steamos/SteamOSDevkitManager.cs deleted file mode 100644 index 45b76f0c..00000000 --- a/addons/deploy_to_steamos/SteamOSDevkitManager.cs +++ /dev/null @@ -1,251 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Godot; -using Renci.SshNet; -using Zeroconf; - -namespace Laura.DeployToSteamOS; - -/// -/// Scans the network for SteamOS Devkit devices via the ZeroConf / Bonjour protocol -/// -public class SteamOSDevkitManager -{ - public const string SteamOSProtocol = "_steamos-devkit._tcp.local."; - public const string CompatibleTextVersion = "1"; - - /// - /// Scans the network for valid SteamOS devkit devices - /// - /// A list of valid SteamOS devkit devices - public static async Task> ScanDevices() - { - var networkDevices = await ZeroconfResolver.ResolveAsync(SteamOSProtocol); - List devices = new(); - - // Iterate through all network devices and request further connection info from the service - foreach (var networkDevice in networkDevices) - { - var device = new Device - { - DisplayName = networkDevice.DisplayName, - IPAdress = networkDevice.IPAddress, - ServiceName = networkDevice.DisplayName + "." + SteamOSProtocol, - }; - - var hasServiceData = networkDevice.Services.TryGetValue(device.ServiceName, out var serviceData); - - // This device is not a proper SteamOS device - if(!hasServiceData) continue; - - var properties = serviceData.Properties.FirstOrDefault(); - if (properties == null) continue; - - // Device is not compatible (version mismatch) - // String"1" is for some reason not equal to String"1" - //if (properties["txtvers"] != CompatibleTextVersion) continue; - - device.Settings = properties["settings"]; - device.Login = properties["login"]; - device.Devkit1 = properties["devkit1"]; - - devices.Add(device); - } - - return devices; - } - - /// - /// Creates an SSH connection and runs a command - /// - /// A SteamOS devkit device - /// The SSH command to run - /// A callable for logging - /// The SSH CLI output - public static async Task RunSSHCommand(Device device, string command, Callable logCallable) - { - logCallable.CallDeferred($"Connecting to {device.Login}@{device.IPAdress}"); - using var client = new SshClient(GetSSHConnectionInfo(device)); - await client.ConnectAsync(CancellationToken.None); - - logCallable.CallDeferred($"Command: '{command}'"); - var sshCommand = client.CreateCommand(command); - var result = await Task.Factory.FromAsync(sshCommand.BeginExecute(), sshCommand.EndExecute); - - client.Disconnect(); - - return result; - } - - /// - /// Creates a new SCP connection and copies all local files to a remote path - /// - /// A SteamOS devkit device - /// The path on the host - /// The path on the device - /// A callable for logging - public static async Task CopyFiles(Device device, string localPath, string remotePath, Callable logCallable) - { - logCallable.CallDeferred($"Connecting to {device.Login}@{device.IPAdress}"); - using var client = new ScpClient(GetSSHConnectionInfo(device)); - await client.ConnectAsync(CancellationToken.None); - - logCallable.CallDeferred($"Uploading files"); - - // Run async method until upload is done - // TODO: Set Progress based on files - var lastUploadedFilename = ""; - var uploadProgress = 0; - var taskCompletion = new TaskCompletionSource(); - client.Uploading += (sender, e) => - { - if (e.Filename != lastUploadedFilename) - { - lastUploadedFilename = e.Filename; - uploadProgress = 0; - } - var progressPercentage = Mathf.CeilToInt((double)e.Uploaded / e.Size * 100); - - if (progressPercentage != uploadProgress) - { - uploadProgress = progressPercentage; - logCallable.CallDeferred($"Uploading {lastUploadedFilename} ({progressPercentage}%)"); - } - - if (e.Uploaded == e.Size) - { - taskCompletion.TrySetResult(true); - } - }; - client.ErrorOccurred += (sender, args) => throw new Exception("Error while uploading build."); - - await Task.Run(() => client.Upload(new DirectoryInfo(localPath), remotePath)); - await taskCompletion.Task; - client.Disconnect(); - - logCallable.CallDeferred($"Fixing file permissions"); - await RunSSHCommand(device, $"chmod +x -R {remotePath}", logCallable); - } - - /// - /// Runs an SSH command on the device that runs the steamos-prepare-upload script - /// - /// A SteamOS devkit device - /// An ID for the game - /// A callable for logging - /// The CLI result - public static async Task PrepareUpload(Device device, string gameId, Callable logCallable) - { - logCallable.CallDeferred("Preparing upload"); - - var resultRaw = await RunSSHCommand(device, "python3 ~/devkit-utils/steamos-prepare-upload --gameid " + gameId, logCallable); - var result = JsonSerializer.Deserialize(resultRaw, DefaultSerializerOptions); - - return result; - } - - /// - /// Runs an SSH command on the device that runs the steamos-create-shortcut script - /// - /// A SteamOS devkit device - /// Parameters for the shortcut - /// A callable for logging - /// The CLI result - public static async Task CreateShortcut(Device device, CreateShortcutParameters parameters, Callable logCallable) - { - var parametersJson = JsonSerializer.Serialize(parameters); - var command = $"python3 ~/devkit-utils/steam-client-create-shortcut --parms '{parametersJson}'"; - - var resultRaw = await RunSSHCommand(device, command, logCallable); - var result = JsonSerializer.Deserialize(resultRaw, DefaultSerializerOptions); - - return result; - } - - /// - /// A SteamOS devkit device - /// - public class Device - { - public string DisplayName { get; set; } - public string IPAdress { get; set; } - public int Port { get; set; } - public string ServiceName { get; set; } - public string Settings { get; set; } - public string Login { get; set; } - public string Devkit1 { get; set; } - } - - public class PrepareUploadResult - { - public string User { get; set; } - public string Directory { get; set; } - } - - public class CreateShortcutResult - { - public string Error { get; set; } - public string Success { get; set; } - } - - /// - /// Parameters for the CreateShortcut method - /// - public struct CreateShortcutParameters - { - public string gameid { get; set; } - public string directory { get; set; } - public string[] argv { get; set; } - public Dictionary settings { get; set; } - } - - /// - /// Returns the path to the devkit_rsa key generated by the official SteamOS devkit client - /// - /// The path to the "devkit_rsa" key - public static string GetPrivateKeyPath() - { - string applicationDataPath; - switch (System.Environment.OSVersion.Platform) - { - // TODO: Linux Support - case PlatformID.Win32NT: - applicationDataPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "steamos-devkit"); - break; - case PlatformID.Unix: - applicationDataPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "Library", "Application Support"); - break; - default: - applicationDataPath = ""; - break; - } - - var keyFolder = Path.Combine(applicationDataPath, "steamos-devkit"); - return Path.Combine(keyFolder, "devkit_rsa"); - } - - /// - /// Creates a SSH Connection Info for a SteamOS devkit device - /// - /// A SteamOS devkit device - /// An SSH ConnectionInfo - /// Throws if there is no private key present - public static ConnectionInfo GetSSHConnectionInfo(Device device) - { - var privateKeyPath = GetPrivateKeyPath(); - if (!File.Exists(privateKeyPath)) throw new Exception("devkit_rsa key is missing. Have you connected to your device via the official devkit UI yet?"); - - var privateKeyFile = new PrivateKeyFile(privateKeyPath); - return new ConnectionInfo(device.IPAdress, device.Login, new PrivateKeyAuthenticationMethod(device.Login, privateKeyFile)); - } - - public static readonly JsonSerializerOptions DefaultSerializerOptions = new JsonSerializerOptions - { - PropertyNameCaseInsensitive = true, - }; -} \ No newline at end of file diff --git a/addons/deploy_to_steamos/SteamOSDevkitManager.cs.uid b/addons/deploy_to_steamos/SteamOSDevkitManager.cs.uid deleted file mode 100644 index 9704d7d3..00000000 --- a/addons/deploy_to_steamos/SteamOSDevkitManager.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://dvupxtmvbmofd diff --git a/addons/deploy_to_steamos/add_device_window/AddDeviceWindow.cs b/addons/deploy_to_steamos/add_device_window/AddDeviceWindow.cs deleted file mode 100644 index 095809d4..00000000 --- a/addons/deploy_to_steamos/add_device_window/AddDeviceWindow.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System.Collections.Generic; -using Godot; - -namespace Laura.DeployToSteamOS; - -[Tool] -public partial class AddDeviceWindow : Window -{ - private bool _isVisible; - private bool _isUpdatingDevices; - private float _scanCooldown; - private List _scannedDevices = new(); - private List _pairedDevices = new(); - - public delegate void DevicesChangedDelegate(List devices); - public event DevicesChangedDelegate OnDevicesChanged; - - [ExportGroup("References")] - [Export] private VBoxContainer _devicesContainer; - [Export] private PackedScene _deviceItemPrefab; - [Export] private Button _refreshButton; - - public override void _Process(double delta) - { - if (!Visible) return; - - _scanCooldown -= (float)delta; - if (_scanCooldown < 0f) - { - _scanCooldown = 10f; - UpdateDevices(); - UpdateDeviceList(); - } - - _refreshButton.Disabled = _isUpdatingDevices; - } - - private async void UpdateDevices() - { - if (!Visible || _isUpdatingDevices) return; - - _isUpdatingDevices = true; - - var devices = await SteamOSDevkitManager.ScanDevices(); - if (devices != _scannedDevices) - { - foreach (var device in devices) - { - if ( - _scannedDevices.Exists(x => x.IPAdress == device.IPAdress && x.Login == device.Login) - || _pairedDevices.Exists(x => x.IPAdress == device.IPAdress && x.Login == device.Login) - ) continue; - - _scannedDevices.Add(device); - } - - UpdateDeviceList(); - } - - _isUpdatingDevices = false; - } - - public void UpdateDeviceList() - { - // Clear List - foreach (var childNode in _devicesContainer.GetChildren()) - { - childNode.QueueFree(); - } - - var devices = new List(); - devices.AddRange(_pairedDevices); - foreach (var scannedDevice in _scannedDevices) - { - if (devices.Exists(x => x.IPAdress == scannedDevice.IPAdress && x.Login == scannedDevice.Login)) - { - continue; - } - - devices.Add(scannedDevice); - } - - foreach (var scannedDevice in devices) - { - var deviceItem = _deviceItemPrefab.Instantiate(); - deviceItem.SetUI(scannedDevice); - deviceItem.OnDevicePair += device => - { - // TODO: Connect to device and run a random ssh command to check communication - if (!_pairedDevices.Exists(x => x.IPAdress == device.IPAdress && x.Login == device.Login)) - { - _pairedDevices.Add(device); - } - UpdateDeviceList(); - }; - deviceItem.OnDeviceUnpair += device => - { - _pairedDevices.Remove(device); - UpdateDeviceList(); - }; - _devicesContainer.AddChild(deviceItem); - } - } - - public void Close() - { - Hide(); - - if (_pairedDevices != SettingsManager.Instance.Devices) - { - OnDevicesChanged?.Invoke(_pairedDevices); - } - } - - public void OnVisibilityChanged() - { - if (Visible) - { - _isVisible = true; - - // Prepopulate device list with saved devices - _pairedDevices = new List(SettingsManager.Instance.Devices); - UpdateDeviceList(); - } - else - { - _isVisible = false; - } - } -} diff --git a/addons/deploy_to_steamos/add_device_window/AddDeviceWindow.cs.uid b/addons/deploy_to_steamos/add_device_window/AddDeviceWindow.cs.uid deleted file mode 100644 index 7f8cef6f..00000000 --- a/addons/deploy_to_steamos/add_device_window/AddDeviceWindow.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://db4834umjmne2 diff --git a/addons/deploy_to_steamos/add_device_window/DeviceItemPrefab.cs b/addons/deploy_to_steamos/add_device_window/DeviceItemPrefab.cs deleted file mode 100644 index 8f8279d1..00000000 --- a/addons/deploy_to_steamos/add_device_window/DeviceItemPrefab.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Godot; - -namespace Laura.DeployToSteamOS; - -[Tool] -public partial class DeviceItemPrefab : PanelContainer -{ - private SteamOSDevkitManager.Device _device; - - public delegate void DeviceDelegate(SteamOSDevkitManager.Device device); - public event DeviceDelegate OnDevicePair; - public event DeviceDelegate OnDeviceUnpair; - - [ExportGroup("References")] - [Export] private Label _deviceNameLabel; - [Export] private Label _deviceConnectionLabel; - [Export] private Button _devicePairButton; - [Export] private Button _deviceUnpairButton; - - public void SetUI(SteamOSDevkitManager.Device device) - { - _device = device; - _deviceNameLabel.Text = device.DisplayName; - _deviceConnectionLabel.Text = $"{device.Login}@{device.IPAdress}"; - - if (SettingsManager.Instance.Devices.Exists(x => x.IPAdress == device.IPAdress && x.Login == device.Login)) - { - _devicePairButton.Visible = false; - _deviceUnpairButton.Visible = true; - } - } - - public void Pair() - { - OnDevicePair?.Invoke(_device); - } - - public void Unpair() - { - OnDeviceUnpair?.Invoke(_device); - } -} diff --git a/addons/deploy_to_steamos/add_device_window/DeviceItemPrefab.cs.uid b/addons/deploy_to_steamos/add_device_window/DeviceItemPrefab.cs.uid deleted file mode 100644 index 870137d4..00000000 --- a/addons/deploy_to_steamos/add_device_window/DeviceItemPrefab.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://b42137lbyy050 diff --git a/addons/deploy_to_steamos/add_device_window/add_device_window.tscn b/addons/deploy_to_steamos/add_device_window/add_device_window.tscn deleted file mode 100644 index f432958f..00000000 --- a/addons/deploy_to_steamos/add_device_window/add_device_window.tscn +++ /dev/null @@ -1,107 +0,0 @@ -[gd_scene load_steps=7 format=3 uid="uid://6be5afncp3nr"] - -[ext_resource type="Script" path="res://addons/deploy_to_steamos/add_device_window/AddDeviceWindow.cs" id="1_3tepc"] -[ext_resource type="PackedScene" uid="uid://p64nkj5ii2xt" path="res://addons/deploy_to_steamos/add_device_window/device_item_prefab.tscn" id="2_dka1k"] - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mam6h"] -content_margin_left = 0.0 -content_margin_top = 0.0 -content_margin_right = 0.0 -content_margin_bottom = 0.0 -bg_color = Color(0.0666667, 0.0666667, 0.0666667, 1) - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_imdn0"] -content_margin_left = 30.0 -content_margin_top = 10.0 -content_margin_right = 30.0 -content_margin_bottom = 10.0 -bg_color = Color(0.2, 0.0823529, 0.121569, 1) - -[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_74135"] -content_margin_left = 15.0 -content_margin_top = 15.0 -content_margin_right = 15.0 -content_margin_bottom = 15.0 - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ne8al"] -content_margin_left = 30.0 -content_margin_top = 10.0 -content_margin_right = 30.0 -content_margin_bottom = 10.0 -bg_color = Color(0.133333, 0.133333, 0.133333, 1) - -[node name="AddDeviceWindow" type="Window" node_paths=PackedStringArray("_devicesContainer", "_refreshButton")] -title = "Add devkit device" -initial_position = 1 -size = Vector2i(650, 500) -transient = true -exclusive = true -min_size = Vector2i(650, 500) -script = ExtResource("1_3tepc") -_devicesContainer = NodePath("PanelContainer/VBoxContainer/ScrollContainer/ContentContainer/DevicesContainer") -_deviceItemPrefab = ExtResource("2_dka1k") -_refreshButton = NodePath("PanelContainer/VBoxContainer/ActionsContainer/HBoxContainer/RefreshButton") - -[node name="PanelContainer" type="PanelContainer" parent="."] -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -size_flags_horizontal = 3 -size_flags_vertical = 3 -theme_override_styles/panel = SubResource("StyleBoxFlat_mam6h") - -[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 3 -theme_override_constants/separation = 0 - -[node name="InfoContainer" type="PanelContainer" parent="PanelContainer/VBoxContainer"] -layout_mode = 2 -theme_override_styles/panel = SubResource("StyleBoxFlat_imdn0") - -[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/InfoContainer"] -custom_minimum_size = Vector2(0, 10) -layout_mode = 2 -theme_override_colors/font_color = Color(1, 0.788235, 0.858824, 1) -theme_override_font_sizes/font_size = 11 -text = "Please keep in mind that you need to connect to your devkit device at least once through the official SteamOS devkit client to install the devkit tools to your device and create the necessary authentication keys." -autowrap_mode = 3 - -[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/VBoxContainer"] -layout_mode = 2 -size_flags_vertical = 3 - -[node name="ContentContainer" type="PanelContainer" parent="PanelContainer/VBoxContainer/ScrollContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 0 -theme_override_styles/panel = SubResource("StyleBoxEmpty_74135") - -[node name="DevicesContainer" type="VBoxContainer" parent="PanelContainer/VBoxContainer/ScrollContainer/ContentContainer"] -layout_mode = 2 -theme_override_constants/separation = 10 - -[node name="ActionsContainer" type="PanelContainer" parent="PanelContainer/VBoxContainer"] -layout_mode = 2 -theme_override_styles/panel = SubResource("StyleBoxFlat_ne8al") - -[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/VBoxContainer/ActionsContainer"] -layout_mode = 2 -theme_override_constants/separation = 10 -alignment = 2 - -[node name="RefreshButton" type="Button" parent="PanelContainer/VBoxContainer/ActionsContainer/HBoxContainer"] -layout_mode = 2 -text = "Refresh" - -[node name="CloseButton" type="Button" parent="PanelContainer/VBoxContainer/ActionsContainer/HBoxContainer"] -layout_mode = 2 -text = "Close" - -[connection signal="close_requested" from="." to="." method="Close"] -[connection signal="visibility_changed" from="." to="." method="OnVisibilityChanged"] -[connection signal="pressed" from="PanelContainer/VBoxContainer/ActionsContainer/HBoxContainer/RefreshButton" to="." method="UpdateDevices"] -[connection signal="pressed" from="PanelContainer/VBoxContainer/ActionsContainer/HBoxContainer/CloseButton" to="." method="Close"] diff --git a/addons/deploy_to_steamos/add_device_window/device_item_prefab.tscn b/addons/deploy_to_steamos/add_device_window/device_item_prefab.tscn deleted file mode 100644 index d4762609..00000000 --- a/addons/deploy_to_steamos/add_device_window/device_item_prefab.tscn +++ /dev/null @@ -1,63 +0,0 @@ -[gd_scene load_steps=3 format=3 uid="uid://p64nkj5ii2xt"] - -[ext_resource type="Script" path="res://addons/deploy_to_steamos/add_device_window/DeviceItemPrefab.cs" id="1_q77lw"] - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6g2hd"] -content_margin_left = 15.0 -content_margin_top = 10.0 -content_margin_right = 15.0 -content_margin_bottom = 10.0 -bg_color = Color(0.133333, 0.133333, 0.133333, 1) -corner_radius_top_left = 4 -corner_radius_top_right = 4 -corner_radius_bottom_right = 4 -corner_radius_bottom_left = 4 - -[node name="DeviceItemPrefab" type="PanelContainer" node_paths=PackedStringArray("_deviceNameLabel", "_deviceConnectionLabel", "_devicePairButton", "_deviceUnpairButton")] -offset_right = 532.0 -offset_bottom = 51.0 -theme_override_styles/panel = SubResource("StyleBoxFlat_6g2hd") -script = ExtResource("1_q77lw") -_deviceNameLabel = NodePath("HBoxContainer/VBoxContainer/DeviceNameLabel") -_deviceConnectionLabel = NodePath("HBoxContainer/VBoxContainer/DeviceConnectionLabel") -_devicePairButton = NodePath("HBoxContainer/PairButton") -_deviceUnpairButton = NodePath("HBoxContainer/UnpairButton") - -[node name="HBoxContainer" type="HBoxContainer" parent="."] -layout_mode = 2 -size_flags_horizontal = 3 -theme_override_constants/separation = 5 -alignment = 1 - -[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -theme_override_constants/separation = -5 - -[node name="DeviceNameLabel" type="Label" parent="HBoxContainer/VBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -text = "steamdeck" - -[node name="DeviceConnectionLabel" type="Label" parent="HBoxContainer/VBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -theme_override_colors/font_color = Color(1, 1, 1, 0.490196) -theme_override_font_sizes/font_size = 12 -text = "deck@127.0.0.1" - -[node name="PairButton" type="Button" parent="HBoxContainer"] -layout_mode = 2 -size_flags_vertical = 4 -theme_override_constants/icon_max_width = 20 -text = "Pair" - -[node name="UnpairButton" type="Button" parent="HBoxContainer"] -visible = false -layout_mode = 2 -size_flags_vertical = 4 -theme_override_constants/icon_max_width = 20 -text = "Unpair" - -[connection signal="pressed" from="HBoxContainer/PairButton" to="." method="Pair"] -[connection signal="pressed" from="HBoxContainer/UnpairButton" to="." method="Unpair"] diff --git a/addons/deploy_to_steamos/deploy_dock/DeployDock.cs b/addons/deploy_to_steamos/deploy_dock/DeployDock.cs deleted file mode 100644 index 1bef946f..00000000 --- a/addons/deploy_to_steamos/deploy_dock/DeployDock.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Godot; - -namespace Laura.DeployToSteamOS; - -[Tool] -public partial class DeployDock : PanelContainer -{ - private int _selectedId = 10000; - - [Export] private OptionButton _deployTargetButton; - [Export] private Button _deployButton; - [Export] private AddDeviceWindow _addDeviceWindow; - [Export] private DeployWindow _deployWindow; - - public override void _EnterTree() - { - _addDeviceWindow.OnDevicesChanged += OnDevicesChanged; - } - - public override void _ExitTree() - { - _addDeviceWindow.OnDevicesChanged -= OnDevicesChanged; - } - - public override void _Ready() - { - UpdateDropdown(); - } - - public void OnDeployTargetItemSelected(int index) - { - var itemId = _deployTargetButton.GetItemId(index); - if (_selectedId == itemId) return; - - if (itemId <= 10000) - { - _selectedId = itemId; - } - else if (itemId == 10001) - { - _addDeviceWindow.Show(); - } - - _deployTargetButton.Select(_deployTargetButton.GetItemIndex(_selectedId)); - _deployButton.Disabled = _selectedId >= 10000; - } - - public void Deploy() - { - var device = SettingsManager.Instance.Devices.ElementAtOrDefault(_selectedId); - if (device == null) - { - GD.PrintErr("[DeployToSteamOS] Unknown deploy target."); - return; - } - - // TODO: Detect Export Presets and stop if no Linux preset named "Steamdeck" exists - - _deployWindow.Deploy(device); - } - - private void OnDevicesChanged(List devices) - { - // Adding Devices - var devicesToAdd = devices.Where(device => !SettingsManager.Instance.Devices.Exists(x => x.IPAdress == device.IPAdress && x.Login == device.Login)).ToList(); - foreach (var device in devicesToAdd) - { - SettingsManager.Instance.Devices.Add(device); - } - - // Removing Devices - var devicesToRemove = SettingsManager.Instance.Devices.Where(savedDevice => !devices.Exists(x => x.IPAdress == savedDevice.IPAdress && x.Login == savedDevice.Login)).ToList(); - foreach (var savedDevice in devicesToRemove) - { - SettingsManager.Instance.Devices.Remove(savedDevice); - } - - SettingsManager.Instance.Save(); - UpdateDropdown(); - } - - private async void UpdateDropdown() - { - // Hack to prevent console error - // Godot apparently calls this before the settings are loaded - while (SettingsManager.Instance == null) - { - await Task.Delay(10); - } - - _deployTargetButton.Clear(); - _deployTargetButton.AddItem("None", 10000); - - for (var index = 0; index < SettingsManager.Instance.Devices.Count; index++) - { - var savedDevice = SettingsManager.Instance.Devices.ElementAtOrDefault(index); - if(savedDevice == null) continue; - - _deployTargetButton.AddItem($"{savedDevice.DisplayName} ({savedDevice.Login}@{savedDevice.IPAdress})", index); - } - - _deployTargetButton.AddSeparator(); - _deployTargetButton.AddItem("Add devkit device", 10001); - } -} diff --git a/addons/deploy_to_steamos/deploy_dock/DeployDock.cs.uid b/addons/deploy_to_steamos/deploy_dock/DeployDock.cs.uid deleted file mode 100644 index 08d6a282..00000000 --- a/addons/deploy_to_steamos/deploy_dock/DeployDock.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://0kau18vff4u2 diff --git a/addons/deploy_to_steamos/deploy_dock/deploy_dock.tscn b/addons/deploy_to_steamos/deploy_dock/deploy_dock.tscn deleted file mode 100644 index d770facb..00000000 --- a/addons/deploy_to_steamos/deploy_dock/deploy_dock.tscn +++ /dev/null @@ -1,54 +0,0 @@ -[gd_scene load_steps=6 format=3 uid="uid://kdbpdei4v1ub"] - -[ext_resource type="Script" path="res://addons/deploy_to_steamos/deploy_dock/DeployDock.cs" id="1_atc6e"] -[ext_resource type="Texture2D" uid="uid://s1tcpal4iir4" path="res://addons/deploy_to_steamos/icon.svg" id="2_rpj28"] -[ext_resource type="PackedScene" uid="uid://6be5afncp3nr" path="res://addons/deploy_to_steamos/add_device_window/add_device_window.tscn" id="3_qfyb3"] -[ext_resource type="PackedScene" uid="uid://ds2umdqybfls8" path="res://addons/deploy_to_steamos/deploy_window/deploy_window.tscn" id="4_8y8co"] - -[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ebqha"] -content_margin_left = 10.0 - -[node name="DeployDock" type="PanelContainer" node_paths=PackedStringArray("_deployTargetButton", "_deployButton", "_addDeviceWindow", "_deployWindow")] -offset_right = 337.0 -offset_bottom = 32.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -theme_override_styles/panel = SubResource("StyleBoxEmpty_ebqha") -script = ExtResource("1_atc6e") -_deployTargetButton = NodePath("HBoxContainer/DeployTargetButton") -_deployButton = NodePath("HBoxContainer/DeployButton") -_addDeviceWindow = NodePath("AddDeviceWindow") -_deployWindow = NodePath("DeployWindow") - -[node name="HBoxContainer" type="HBoxContainer" parent="."] -layout_mode = 2 - -[node name="DeployTargetButton" type="OptionButton" parent="HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -item_count = 3 -selected = 0 -popup/item_0/text = "None" -popup/item_0/id = 10000 -popup/item_1/text = "" -popup/item_1/id = -1 -popup/item_1/separator = true -popup/item_2/text = "Add devkit device" -popup/item_2/id = 10001 - -[node name="DeployButton" type="Button" parent="HBoxContainer"] -custom_minimum_size = Vector2(32, 32) -layout_mode = 2 -disabled = true -icon = ExtResource("2_rpj28") -icon_alignment = 1 -expand_icon = true - -[node name="AddDeviceWindow" parent="." instance=ExtResource("3_qfyb3")] -visible = false - -[node name="DeployWindow" parent="." instance=ExtResource("4_8y8co")] -visible = false - -[connection signal="item_selected" from="HBoxContainer/DeployTargetButton" to="." method="OnDeployTargetItemSelected"] -[connection signal="pressed" from="HBoxContainer/DeployButton" to="." method="Deploy"] diff --git a/addons/deploy_to_steamos/deploy_window/DeployWindow.Build.cs b/addons/deploy_to_steamos/deploy_window/DeployWindow.Build.cs deleted file mode 100644 index 0f82be5f..00000000 --- a/addons/deploy_to_steamos/deploy_window/DeployWindow.Build.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.IO; -using System.Threading.Tasks; -using Godot; - -namespace Laura.DeployToSteamOS; - -public partial class DeployWindow -{ - private async Task DeployBuild(Callable logCallable) - { - CurrentStep = DeployStep.Building; - CurrentProgress = StepProgress.Running; - UpdateUI(); - - // Adding a 2 second delay so the UI can update - await ToSignal(GetTree().CreateTimer(1), "timeout"); - var buildTask = new TaskCompletionSource(); - - if (SettingsManager.Instance.Settings.UploadMethod == SettingsFile.UploadMethods.CleanReplace) - { - AddToConsole(DeployStep.Building, "Removing previous build as upload method is set to CleanReplace"); - await SteamOSDevkitManager.RunSSHCommand(_device, "python3 ~/devkit-utils/steamos-delete --delete-title " + _gameId, logCallable); - } - - GodotExportManager.ExportProject( - ProjectSettings.GlobalizePath("res://"), - Path.Join(_localPath, "game.x86_64"), - false, - logCallable, - () => { buildTask.SetResult(true); } - ); - - await buildTask.Task; - - CurrentProgress = StepProgress.Succeeded; - UpdateUI(); - } -} \ No newline at end of file diff --git a/addons/deploy_to_steamos/deploy_window/DeployWindow.Build.cs.uid b/addons/deploy_to_steamos/deploy_window/DeployWindow.Build.cs.uid deleted file mode 100644 index 78024340..00000000 --- a/addons/deploy_to_steamos/deploy_window/DeployWindow.Build.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://bye7k4dvdra1b diff --git a/addons/deploy_to_steamos/deploy_window/DeployWindow.CreateShortcut.cs b/addons/deploy_to_steamos/deploy_window/DeployWindow.CreateShortcut.cs deleted file mode 100644 index 5ea14a19..00000000 --- a/addons/deploy_to_steamos/deploy_window/DeployWindow.CreateShortcut.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Collections.Generic; -using System.Threading.Tasks; -using Godot; - -namespace Laura.DeployToSteamOS; - -public partial class DeployWindow -{ - private async Task DeployCreateShortcut(Callable logCallable) - { - CurrentStep = DeployStep.CreateShortcut; - CurrentProgress = StepProgress.Running; - UpdateUI(); - - var createShortcutParameters = new SteamOSDevkitManager.CreateShortcutParameters - { - gameid = _gameId, - directory = _prepareUploadResult.Directory, - argv = new[] { "game.x86_64", SettingsManager.Instance.Settings.StartParameters }, - settings = new Dictionary - { - { "steam_play", "0" } - }, - }; - - // TODO: Fix Result, success/error are not filled in response but exist/dont - _createShortcutResult = await SteamOSDevkitManager.CreateShortcut( - _device, - createShortcutParameters, - logCallable - ); - - CurrentProgress = StepProgress.Succeeded; - UpdateUI(); - } -} \ No newline at end of file diff --git a/addons/deploy_to_steamos/deploy_window/DeployWindow.CreateShortcut.cs.uid b/addons/deploy_to_steamos/deploy_window/DeployWindow.CreateShortcut.cs.uid deleted file mode 100644 index 0dd29e84..00000000 --- a/addons/deploy_to_steamos/deploy_window/DeployWindow.CreateShortcut.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://cveynna4dxqj diff --git a/addons/deploy_to_steamos/deploy_window/DeployWindow.Init.cs b/addons/deploy_to_steamos/deploy_window/DeployWindow.Init.cs deleted file mode 100644 index 04660dee..00000000 --- a/addons/deploy_to_steamos/deploy_window/DeployWindow.Init.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.IO; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using Godot; - -namespace Laura.DeployToSteamOS; - -public partial class DeployWindow -{ - private async Task DeployInit() - { - CurrentStep = DeployStep.Init; - CurrentProgress = StepProgress.Running; - UpdateUI(); - - await Task.Delay(0); - - _gameId = ProjectSettings.GetSetting("application/config/name", "game").AsString(); - _gameId = Regex.Replace(_gameId, @"[^a-zA-Z0-9]", string.Empty); - - // Add current timestamp to gameid for incremental builds - if (SettingsManager.Instance.Settings.UploadMethod == SettingsFile.UploadMethods.Incremental) - { - _gameId += "_" + DateTimeOffset.Now.ToUnixTimeSeconds(); - } - - GD.Print($"[DeployToSteamOS] Deploying '{_gameId}' to '{_device.DisplayName} ({_device.Login}@{_device.IPAdress})'"); - - _localPath = SettingsManager.Instance.Settings.BuildPath; - if (DirAccess.Open(_localPath) == null) - { - GD.PrintErr($"[DeployToSteamOS] Build path '{_localPath}' does not exist."); - UpdateUIToFail(); - return; - } - - CurrentProgress = StepProgress.Succeeded; - UpdateUI(); - } -} \ No newline at end of file diff --git a/addons/deploy_to_steamos/deploy_window/DeployWindow.Init.cs.uid b/addons/deploy_to_steamos/deploy_window/DeployWindow.Init.cs.uid deleted file mode 100644 index 150e6bf4..00000000 --- a/addons/deploy_to_steamos/deploy_window/DeployWindow.Init.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://bhkwfem6monsw diff --git a/addons/deploy_to_steamos/deploy_window/DeployWindow.PrepareUpload.cs b/addons/deploy_to_steamos/deploy_window/DeployWindow.PrepareUpload.cs deleted file mode 100644 index e4cc63ca..00000000 --- a/addons/deploy_to_steamos/deploy_window/DeployWindow.PrepareUpload.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Threading.Tasks; -using Godot; - -namespace Laura.DeployToSteamOS; - -public partial class DeployWindow -{ - private async Task DeployPrepareUpload(Callable logCallable) - { - CurrentStep = DeployStep.PrepareUpload; - CurrentProgress = StepProgress.Running; - UpdateUI(); - - _prepareUploadResult = await SteamOSDevkitManager.PrepareUpload( - _device, - _gameId, - logCallable - ); - - AddToConsole(DeployStep.PrepareUpload, $"User: {_prepareUploadResult.User}"); - AddToConsole(DeployStep.PrepareUpload, $"Directory: {_prepareUploadResult.Directory}"); - - CurrentProgress = StepProgress.Succeeded; - UpdateUI(); - } -} \ No newline at end of file diff --git a/addons/deploy_to_steamos/deploy_window/DeployWindow.PrepareUpload.cs.uid b/addons/deploy_to_steamos/deploy_window/DeployWindow.PrepareUpload.cs.uid deleted file mode 100644 index 09d577a4..00000000 --- a/addons/deploy_to_steamos/deploy_window/DeployWindow.PrepareUpload.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://do8iwi7jpset4 diff --git a/addons/deploy_to_steamos/deploy_window/DeployWindow.Upload.cs b/addons/deploy_to_steamos/deploy_window/DeployWindow.Upload.cs deleted file mode 100644 index 9bfe0258..00000000 --- a/addons/deploy_to_steamos/deploy_window/DeployWindow.Upload.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Threading.Tasks; -using Godot; - -namespace Laura.DeployToSteamOS; - -public partial class DeployWindow -{ - private async Task DeployUpload(Callable logCallable) - { - CurrentStep = DeployStep.Uploading; - CurrentProgress = StepProgress.Running; - UpdateUI(); - - try - { - await SteamOSDevkitManager.CopyFiles( - _device, - _localPath, - _prepareUploadResult.Directory, - logCallable - ); - } - catch (Exception e) - { - AddToConsole(DeployStep.Uploading, e.Message); - UpdateUIToFail(); - } - - CurrentProgress = StepProgress.Succeeded; - UpdateUI(); - } -} \ No newline at end of file diff --git a/addons/deploy_to_steamos/deploy_window/DeployWindow.Upload.cs.uid b/addons/deploy_to_steamos/deploy_window/DeployWindow.Upload.cs.uid deleted file mode 100644 index a8c3e80e..00000000 --- a/addons/deploy_to_steamos/deploy_window/DeployWindow.Upload.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://csn5do4f3tqya diff --git a/addons/deploy_to_steamos/deploy_window/DeployWindow.cs b/addons/deploy_to_steamos/deploy_window/DeployWindow.cs deleted file mode 100644 index fa8c8c7a..00000000 --- a/addons/deploy_to_steamos/deploy_window/DeployWindow.cs +++ /dev/null @@ -1,304 +0,0 @@ -using System.Collections.Generic; -using Godot; - -namespace Laura.DeployToSteamOS; - -[Tool] -public partial class DeployWindow : Window -{ - public enum DeployStep - { - Init, - Building, - PrepareUpload, - Uploading, - CreateShortcut, - Done - } - public DeployStep CurrentStep = DeployStep.Init; - - public enum StepProgress - { - Queued, - Running, - Succeeded, - Failed - } - public StepProgress CurrentProgress = StepProgress.Queued; - - private string _localPath; - private string _gameId; - private SteamOSDevkitManager.Device _device; - private SteamOSDevkitManager.PrepareUploadResult _prepareUploadResult; - private SteamOSDevkitManager.CreateShortcutResult _createShortcutResult; - - private Dictionary _colorsBright = new() - { - { StepProgress.Queued, new Color("#6a6a6a") }, - { StepProgress.Running, new Color("#ffffff") }, - { StepProgress.Succeeded, new Color("#00f294") }, - { StepProgress.Failed, new Color("#ff4245") }, - }; - private Dictionary _colorsDim = new() - { - { StepProgress.Queued, new Color("#1d1d1d") }, - { StepProgress.Running, new Color("#222222") }, - { StepProgress.Succeeded, new Color("#13241d") }, - { StepProgress.Failed, new Color("#241313") }, - }; - - [ExportGroup("References")] - [Export] private VBoxContainer _buildingContainer; - [Export] private VBoxContainer _prepareUploadContainer; - [Export] private VBoxContainer _uploadingContainer; - [Export] private VBoxContainer _createShortcutContainer; - - public override void _Process(double delta) - { - if (CurrentStep != DeployStep.Done) - { - var container = CurrentStep switch - { - DeployStep.Building => _buildingContainer, - DeployStep.PrepareUpload => _prepareUploadContainer, - DeployStep.Uploading => _uploadingContainer, - DeployStep.CreateShortcut => _createShortcutContainer, - _ => null - }; - if (container != null) - { - var progressBar = container.GetNode("Progressbar"); - if (progressBar.Value < 95f) - { - var shouldDoubleSpeed = CurrentStep is DeployStep.PrepareUpload or DeployStep.CreateShortcut; - progressBar.Value += (float)delta * (shouldDoubleSpeed ? 2f : 1f); - } - } - } - } - - public async void Deploy(SteamOSDevkitManager.Device device) - { - if (device == null) - { - GD.PrintErr("[DeployToSteamOS] Device is not available."); - return; - } - - _device = device; - _prepareUploadResult = null; - _createShortcutResult = null; - ResetUI(); - - Title = $"Deploying to {_device.DisplayName} ({_device.Login}@{_device.IPAdress})"; - Show(); - - await DeployInit(); - await DeployBuild(Callable.From((Variant log) => AddToConsole(DeployStep.Building, log.AsString()))); - await DeployPrepareUpload(Callable.From((Variant log) => AddToConsole(DeployStep.PrepareUpload, log.AsString()))); - await DeployUpload(Callable.From((Variant log) => AddToConsole(DeployStep.Uploading, log.AsString()))); - await DeployCreateShortcut(Callable.From((Variant log) => AddToConsole(DeployStep.CreateShortcut, log.AsString()))); - - CurrentStep = DeployStep.Done; - CurrentProgress = StepProgress.Succeeded; - UpdateUI(); - } - - public void Close() - { - if (CurrentStep != DeployStep.Init && CurrentStep != DeployStep.Done) return; - Hide(); - } - - private void UpdateUI() - { - UpdateContainer(CurrentStep, CurrentProgress); - if (CurrentStep == DeployStep.Done) - { - SetConsoleVisibility(DeployStep.Building, false, false); - SetConsoleVisibility(DeployStep.PrepareUpload, false, false); - SetConsoleVisibility(DeployStep.Uploading, false, false); - SetConsoleVisibility(DeployStep.CreateShortcut, false, false); - } - } - - private void ResetUI() - { - // Clear Consoles - List consoleNodes = new(); - consoleNodes.AddRange(_buildingContainer.GetNode("ConsoleContainer/ScrollContainer/VBoxContainer").GetChildren()); - consoleNodes.AddRange(_prepareUploadContainer.GetNode("ConsoleContainer/ScrollContainer/VBoxContainer").GetChildren()); - consoleNodes.AddRange(_uploadingContainer.GetNode("ConsoleContainer/ScrollContainer/VBoxContainer").GetChildren()); - consoleNodes.AddRange(_createShortcutContainer.GetNode("ConsoleContainer/ScrollContainer/VBoxContainer").GetChildren()); - - foreach (var consoleNode in consoleNodes) - { - consoleNode.QueueFree(); - } - - // Clear States - UpdateContainer(DeployStep.Building, StepProgress.Queued); - UpdateContainer(DeployStep.PrepareUpload, StepProgress.Queued); - UpdateContainer(DeployStep.Uploading, StepProgress.Queued); - UpdateContainer(DeployStep.CreateShortcut, StepProgress.Queued); - - CurrentStep = DeployStep.Init; - CurrentProgress = StepProgress.Queued; - } - - private void UpdateContainer(DeployStep step, StepProgress progress) - { - var container = step switch - { - DeployStep.Building => _buildingContainer, - DeployStep.PrepareUpload => _prepareUploadContainer, - DeployStep.Uploading => _uploadingContainer, - DeployStep.CreateShortcut => _createShortcutContainer, - _ => null - }; - if (container == null) return; - - var headerContainer = container.GetNode("HeaderContainer"); - var label = headerContainer.GetNode