Skip to content

Commit 2e21720

Browse files
committed
Add Windows ARM64/x86_64 update support
Detect runtime CPU architecture and select architecture-specific Windows release assets (netdex-windows-x86_64.zip or netdex-windows-arm64.zip) with fallbacks to the legacy x64 name. Implemented RuntimeArchitecture enum, DetectRuntimeArchitecture(), ResolveWindowsAsset(), and FindAssetByNames(), and updated ResolvePlatformAsset/GetDownloadFileName to use the chosen asset. Adjusted Windows installer download paths to a generic name and updated packaging/verification scripts, docs, and README to list the new asset names. Also bumped project version to 1.3, updated repository/releases URLs, and changed export path in export_presets.cfg.
1 parent 418601d commit 2e21720

File tree

8 files changed

+79
-20
lines changed

8 files changed

+79
-20
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ src/project.godot
8383
Expected release assets:
8484

8585
- `netdex-macos-universal.zip`
86-
- `netdex-windows-x64.zip`
86+
- `netdex-windows-x86_64.zip`
87+
- `netdex-windows-arm64.zip`
8788
- `netdex-linux-x64.zip`
8889
- `netdex-android-arm64.apk`
8990

docs/flows/updater-lifecycle.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
1. `UpdateManager` auto-checks periodically and supports manual checks.
55
2. `GitHubReleaseProvider` loads `releases/latest`.
66
3. Version comparison + required platform asset lookup are applied.
7-
4. Desktop platforms require valid `sha256` digest metadata.
7+
4. On Windows, updater selects architecture-specific asset (`netdex-windows-x86_64.zip` or `netdex-windows-arm64.zip`) based on runtime features.
8+
5. Desktop platforms require valid `sha256` digest metadata.
89

910
## Install path
1011
- macOS/Windows/Linux: download package -> verify checksum -> spawn helper script/process -> relaunch.

src/export_presets.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ custom_features=""
846846
export_filter="all_resources"
847847
include_filter=""
848848
exclude_filter=""
849-
export_path=""
849+
export_path="../../Publish/wind/NetDex.exe"
850850
patches=PackedStringArray()
851851
patch_delta_encoding=false
852852
patch_delta_compression_level_zstd=19

src/project.godot

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ config_version=5
1111
[application]
1212

1313
config/name="NetDex"
14-
config/version="1.2"
14+
config/version="1.3"
1515
run/main_scene="res://main.tscn"
1616
config/features=PackedStringArray("4.6", "C#", "GL Compatibility")
1717
config/icon="res://icon.svg"
1818
config/developer_name="NoobNotFound"
1919
config/copyright_notice="(c) VibeNoobNotFound"
20-
config/repository_url="https://github.com/NoobNotFound/net-dex"
21-
config/releases_url="https://github.com/NoobNotFound/net-dex/releases"
20+
config/repository_url="https://github.com/VibeNoobNotFound/net-dex"
21+
config/releases_url="https://github.com/VibeNoobNotFound/net-dex/releases"
2222

2323
[autoload]
2424

src/scripts/updates/UpdateManager.cs

Lines changed: 61 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,23 @@ namespace NetDex.Updates;
88

99
public partial class UpdateManager : Node
1010
{
11+
private enum RuntimeArchitecture
12+
{
13+
Unknown = 0,
14+
X86_64 = 1,
15+
Arm64 = 2
16+
}
17+
1118
private const string UpdaterConfigPath = "user://updater.cfg";
1219
private const string DefaultRepositoryUrl = "https://github.com/NoobNotFound/net-dex";
1320
private const string DefaultReleasesUrl = "https://github.com/NoobNotFound/net-dex/releases";
1421
private const string DefaultRepoOwner = "NoobNotFound";
1522
private const string DefaultRepoName = "net-dex";
1623

1724
private const string MacAssetName = "netdex-macos-universal.zip";
18-
private const string WindowsAssetName = "netdex-windows-x64.zip";
25+
private const string WindowsX86_64AssetName = "netdex-windows-x86_64.zip";
26+
private const string WindowsX64LegacyAssetName = "netdex-windows-x64.zip";
27+
private const string WindowsArm64AssetName = "netdex-windows-arm64.zip";
1928
private const string LinuxAssetName = "netdex-linux-x64.zip";
2029
private const string AndroidAssetName = "netdex-android-arm64.apk";
2130

@@ -33,6 +42,7 @@ public partial class UpdateManager : Node
3342
public string ReleasesUrl { get; private set; } = DefaultReleasesUrl;
3443

3544
public UpdatePlatform RuntimePlatform { get; private set; } = UpdatePlatform.Unsupported;
45+
private RuntimeArchitecture _runtimeArchitecture = RuntimeArchitecture.Unknown;
3646

3747
private readonly GitHubReleaseProvider _provider = new();
3848
private readonly Dictionary<UpdatePlatform, IUpdateInstaller> _installers = new();
@@ -68,6 +78,7 @@ public override void _Ready()
6878
Instance = this;
6979

7080
RuntimePlatform = DetectRuntimePlatform();
81+
_runtimeArchitecture = DetectRuntimeArchitecture();
7182
CurrentVersion = VersionComparer.NormalizeTagToVersion(ProjectSettings.GetSetting("application/config/version", "0.0.0").AsString());
7283

7384
RepositoryUrl = GetProjectSettingString("application/config/repository_url", DefaultRepositoryUrl);
@@ -203,18 +214,19 @@ public async Task PerformUpdateActionAsync()
203214

204215
try
205216
{
217+
var platformAsset = ResolvePlatformAsset(LatestRelease, RuntimePlatform);
218+
206219
if (IsDesktopInstaller(RuntimePlatform))
207220
{
208221
SetState(UpdateState.Downloading, "Downloading update package...");
209-
_downloadPathTemp = $"user://updates/{GetDownloadFileName(RuntimePlatform)}.download";
222+
var downloadFileName = platformAsset?.Name ?? GetDownloadFileName(RuntimePlatform);
223+
_downloadPathTemp = $"user://updates/{downloadFileName}.download";
210224
SaveUpdaterConfig();
211225
}
212226
else
213227
{
214228
SetState(UpdateState.Installing, "Opening update destination...");
215229
}
216-
217-
var platformAsset = ResolvePlatformAsset(LatestRelease, RuntimePlatform);
218230
var result = await installer.ExecuteAsync(this, LatestRelease, platformAsset);
219231
if (!result.Success)
220232
{
@@ -279,7 +291,7 @@ private void SetError(UpdateIssueCode code, string message)
279291
EmitSignal(SignalName.UpdateIssueRaised, (int)code, message);
280292
}
281293

282-
private static UpdateAssetInfo? ResolvePlatformAsset(UpdateReleaseInfo release, UpdatePlatform platform)
294+
private UpdateAssetInfo? ResolvePlatformAsset(UpdateReleaseInfo release, UpdatePlatform platform)
283295
{
284296
if (platform == UpdatePlatform.MacOS)
285297
{
@@ -288,7 +300,7 @@ private void SetError(UpdateIssueCode code, string message)
288300

289301
if (platform == UpdatePlatform.Windows)
290302
{
291-
return FindAssetByName(release, WindowsAssetName);
303+
return ResolveWindowsAsset(release);
292304
}
293305

294306
if (platform == UpdatePlatform.Linux)
@@ -304,6 +316,30 @@ private void SetError(UpdateIssueCode code, string message)
304316
return null;
305317
}
306318

319+
private UpdateAssetInfo? ResolveWindowsAsset(UpdateReleaseInfo release)
320+
{
321+
return _runtimeArchitecture switch
322+
{
323+
RuntimeArchitecture.Arm64 => FindAssetByNames(release, WindowsArm64AssetName),
324+
RuntimeArchitecture.X86_64 => FindAssetByNames(release, WindowsX86_64AssetName, WindowsX64LegacyAssetName),
325+
_ => FindAssetByNames(release, WindowsX86_64AssetName, WindowsX64LegacyAssetName, WindowsArm64AssetName)
326+
};
327+
}
328+
329+
private static UpdateAssetInfo? FindAssetByNames(UpdateReleaseInfo release, params string[] expectedNames)
330+
{
331+
foreach (var expectedName in expectedNames)
332+
{
333+
var asset = FindAssetByName(release, expectedName);
334+
if (asset != null)
335+
{
336+
return asset;
337+
}
338+
}
339+
340+
return null;
341+
}
342+
307343
private static UpdateAssetInfo? FindAssetByName(UpdateReleaseInfo release, string expectedName)
308344
{
309345
foreach (var asset in release.Assets)
@@ -371,6 +407,21 @@ private static UpdatePlatform DetectRuntimePlatform()
371407
return UpdatePlatform.Unsupported;
372408
}
373409

410+
private static RuntimeArchitecture DetectRuntimeArchitecture()
411+
{
412+
if (OS.HasFeature("arm64") || OS.HasFeature("aarch64"))
413+
{
414+
return RuntimeArchitecture.Arm64;
415+
}
416+
417+
if (OS.HasFeature("x86_64") || OS.HasFeature("x64") || OS.HasFeature("64"))
418+
{
419+
return RuntimeArchitecture.X86_64;
420+
}
421+
422+
return RuntimeArchitecture.Unknown;
423+
}
424+
374425
private static bool TryParseOwnerRepoFromUrl(string repositoryUrl, out string owner, out string repo)
375426
{
376427
owner = string.Empty;
@@ -418,12 +469,14 @@ private static bool RequiresDigestValidation(UpdatePlatform platform)
418469
return platform is UpdatePlatform.MacOS or UpdatePlatform.Windows or UpdatePlatform.Linux;
419470
}
420471

421-
private static string GetDownloadFileName(UpdatePlatform platform)
472+
private string GetDownloadFileName(UpdatePlatform platform)
422473
{
423474
return platform switch
424475
{
425476
UpdatePlatform.MacOS => "netdex-macos-universal.zip",
426-
UpdatePlatform.Windows => "netdex-windows-x64.zip",
477+
UpdatePlatform.Windows => _runtimeArchitecture == RuntimeArchitecture.Arm64
478+
? WindowsArm64AssetName
479+
: WindowsX86_64AssetName,
427480
UpdatePlatform.Linux => "netdex-linux-x64.zip",
428481
_ => "netdex-update-package"
429482
};

src/scripts/updates/installers/WindowsUpdateInstaller.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ namespace NetDex.Updates.Installers;
99
public sealed class WindowsUpdateInstaller : IUpdateInstaller
1010
{
1111
private const string UpdateDir = "user://updates";
12-
private const string DownloadTempPath = "user://updates/netdex-windows-x64.zip.download";
13-
private const string DownloadFinalPath = "user://updates/netdex-windows-x64.zip";
12+
private const string DownloadTempPath = "user://updates/netdex-windows-update.zip.download";
13+
private const string DownloadFinalPath = "user://updates/netdex-windows-update.zip";
1414
private const string ScriptPath = "user://updates/apply_update_windows.cmd";
1515

1616
public UpdatePlatform Platform => UpdatePlatform.Windows;

src/tools/release/package_release.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ echo "Packaging release artifacts into: $OUT_DIR"
99

1010
echo "Expected files to upload to GitHub Release:"
1111
echo " - netdex-macos-universal.zip"
12-
echo " - netdex-windows-x64.zip"
12+
echo " - netdex-windows-x86_64.zip"
13+
echo " - netdex-windows-arm64.zip"
1314
echo " - netdex-linux-x64.zip"
1415
echo " - netdex-android-arm64.apk"
1516

1617
echo
1718
echo "Example commands:"
1819
echo " cp /path/to/exported/NetDex.app \"$OUT_DIR/NetDex.app\""
1920
echo " (cd \"$OUT_DIR\" && zip -r netdex-macos-universal.zip NetDex.app)"
20-
echo " cp /path/to/exported/NetDex-Windows.zip \"$OUT_DIR/netdex-windows-x64.zip\""
21+
echo " cp /path/to/exported/NetDex-Windows-x86_64.zip \"$OUT_DIR/netdex-windows-x86_64.zip\""
22+
echo " cp /path/to/exported/NetDex-Windows-arm64.zip \"$OUT_DIR/netdex-windows-arm64.zip\""
2123
echo " cp /path/to/exported/NetDex-Linux.zip \"$OUT_DIR/netdex-linux-x64.zip\""
2224
echo " cp /path/to/exported/NetDex.apk \"$OUT_DIR/netdex-android-arm64.apk\""
2325

src/tools/release/verify_release_assets.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ fi
2121

2222
required=(
2323
"netdex-macos-universal.zip"
24-
"netdex-windows-x64.zip"
24+
"netdex-windows-x86_64.zip"
25+
"netdex-windows-arm64.zip"
2526
"netdex-linux-x64.zip"
2627
"netdex-android-arm64.apk"
2728
)
@@ -37,7 +38,8 @@ done
3738

3839
desktop=(
3940
"netdex-macos-universal.zip"
40-
"netdex-windows-x64.zip"
41+
"netdex-windows-x86_64.zip"
42+
"netdex-windows-arm64.zip"
4143
"netdex-linux-x64.zip"
4244
)
4345

0 commit comments

Comments
 (0)