From 215280dad46f35cffa687fe26ef71e020c61b017 Mon Sep 17 00:00:00 2001 From: tombohar Date: Fri, 17 Apr 2026 19:24:56 -0400 Subject: [PATCH] Add Inno Setup installer and build script Build-Installer.ps1 publishes all three components (launcher, engine, plugin) and stages them for ISCC. RynthCore.iss installs to C:\Games\RynthCore with data dirs at C:\Games\RynthSuite\RynthAi, checks for running acclient.exe, and shows getting-started instructions. Co-Authored-By: Claude Sonnet 4.6 --- .gitignore | 4 + installer/Build-Installer.ps1 | 139 ++++++++++++++++++++++++++++++++++ installer/RynthCore.iss | 139 ++++++++++++++++++++++++++++++++++ 3 files changed, 282 insertions(+) create mode 100644 installer/Build-Installer.ps1 create mode 100644 installer/RynthCore.iss diff --git a/.gitignore b/.gitignore index f13e079..7b4ebe5 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,7 @@ appsettings.*.local.json # Scratch space scratch/ + +# Installer build artifacts +installer/staging/ +installer/Output/ diff --git a/installer/Build-Installer.ps1 b/installer/Build-Installer.ps1 new file mode 100644 index 0000000..afe84ce --- /dev/null +++ b/installer/Build-Installer.ps1 @@ -0,0 +1,139 @@ +#Requires -Version 5.1 +<# +.SYNOPSIS + Builds all RynthCore components and produces RynthCore-Setup.exe via Inno Setup. + +.DESCRIPTION + 1. Publishes the Avalonia launcher (self-contained, x86) + 2. Publishes RynthCore.Engine (NativeAOT, x86 -- ~2 min) + 3. Publishes RynthCore.Plugin.RynthAi (NativeAOT, x86) + 4. Stages all output under installer\staging\app\ + 5. Invokes ISCC.exe to produce installer\Output\RynthCore-Setup.exe + +.PARAMETER Configuration + Build configuration. Default: Release + +.PARAMETER IsccPath + Path to ISCC.exe (Inno Setup compiler). Default looks in the standard Inno Setup 6 location. + Install Inno Setup from: https://jrsoftware.org/isdl.php + +.PARAMETER SkipBuild + Skip dotnet publish steps and just re-run ISCC against the existing staging directory. +#> +param( + [string]$Configuration = "Release", + [string]$IsccPath = "C:\Program Files (x86)\Inno Setup 6\ISCC.exe", + [switch]$SkipBuild +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Off + +$ScriptDir = $PSScriptRoot +$RepoRoot = Split-Path $ScriptDir -Parent # C:\Projects\RynthCore +$ProjectsRoot = Split-Path $RepoRoot -Parent # C:\Projects + +$LauncherProject = "$RepoRoot\src\RynthCore.App.Avalonia\RynthCore.App.Avalonia.csproj" +$EngineProject = "$RepoRoot\src\RynthCore.Engine\RynthCore.Engine.csproj" +$PluginProject = "$ProjectsRoot\RynthSuite\Plugins\RynthCore.Plugin.RynthAi\RynthCore.Plugin.RynthAi.csproj" + +$LauncherPublish = "$RepoRoot\src\RynthCore.App.Avalonia\bin\$Configuration\net9.0-windows7.0\win-x86\publish" +$EnginePublish = "$RepoRoot\src\RynthCore.Engine\bin\$Configuration\net9.0-windows\win-x86\publish" +$PluginPublish = "$ProjectsRoot\RynthSuite\Plugins\RynthCore.Plugin.RynthAi\bin\$Configuration\net9.0-windows\win-x86\publish" + +$StagingDir = "$ScriptDir\staging\app" + +# ── Validate projects ─────────────────────────────────────────────────────── +foreach ($p in @($LauncherProject, $EngineProject, $PluginProject)) { + if (-not (Test-Path $p)) { + throw "Project not found: $p`nUpdate paths in Build-Installer.ps1 if your repo layout differs." + } +} + +if (-not $SkipBuild) { + # ── 1. Launcher (self-contained Avalonia WinExe) ───────────────────────── + Write-Host "" + Write-Host "[1/3] Publishing Launcher (self-contained, x86)..." -ForegroundColor Cyan + dotnet publish $LauncherProject -c $Configuration -r win-x86 --self-contained true + if ($LASTEXITCODE -ne 0) { throw "Launcher publish failed (exit $LASTEXITCODE)" } + + # ── 2. Engine (NativeAOT — the slow one) ────────────────────────────────── + Write-Host "" + Write-Host "[2/3] Publishing Engine (NativeAOT, ~2 min)..." -ForegroundColor Cyan + dotnet publish $EngineProject -c $Configuration + if ($LASTEXITCODE -ne 0) { throw "Engine publish failed (exit $LASTEXITCODE)" } + + # ── 3. Plugin (NativeAOT) ───────────────────────────────────────────────── + Write-Host "" + Write-Host "[3/3] Publishing Plugin (NativeAOT)..." -ForegroundColor Cyan + dotnet publish $PluginProject -c $Configuration + if ($LASTEXITCODE -ne 0) { throw "Plugin publish failed (exit $LASTEXITCODE)" } +} + +# ── Stage ──────────────────────────────────────────────────────────────────── +Write-Host "" +Write-Host "Staging files..." -ForegroundColor Cyan + +if (Test-Path "$ScriptDir\staging") { + Remove-Item "$ScriptDir\staging" -Recurse -Force +} +New-Item -ItemType Directory -Path "$StagingDir\Runtime\Native" -Force | Out-Null +New-Item -ItemType Directory -Path "$StagingDir\Runtime\Plugins" -Force | Out-Null + +# Launcher root files (rename .exe → RynthCore.exe; drop .pdb) +foreach ($file in (Get-ChildItem "$LauncherPublish" -File)) { + if ($file.Extension -eq '.pdb') { continue } + $destName = if ($file.Name -eq 'RynthCore.App.Avalonia.exe') { 'RynthCore.exe' } else { $file.Name } + Copy-Item $file.FullName "$StagingDir\$destName" -Force +} + +# Engine runtime files (into Runtime\, skip .pdb) +foreach ($file in (Get-ChildItem "$EnginePublish" -File)) { + if ($file.Extension -eq '.pdb') { continue } + Copy-Item $file.FullName "$StagingDir\Runtime\$($file.Name)" -Force +} + +# Engine Native subfolder +if (Test-Path "$EnginePublish\Native") { + foreach ($file in (Get-ChildItem "$EnginePublish\Native" -File)) { + if ($file.Extension -eq '.pdb') { continue } + Copy-Item $file.FullName "$StagingDir\Runtime\Native\$($file.Name)" -Force + } +} + +# Plugin DLL only (cimgui.dll excluded — already in Runtime from Engine) +$pluginDll = "$PluginPublish\RynthCore.Plugin.RynthAi.dll" +if (-not (Test-Path $pluginDll)) { throw "Plugin DLL not found at: $pluginDll" } +Copy-Item $pluginDll "$StagingDir\Runtime\Plugins\" -Force + +# Report staged sizes +$engineDll = "$StagingDir\Runtime\RynthCore.Engine.dll" +if (Test-Path $engineDll) { + $sizeMb = [math]::Round((Get-Item $engineDll).Length / 1MB, 1) + Write-Host " Engine.dll: ${sizeMb} MB" +} +$totalMb = [math]::Round((Get-ChildItem "$StagingDir" -Recurse -File | Measure-Object Length -Sum).Sum / 1MB, 1) +Write-Host " Total staged: ${totalMb} MB" + +Write-Host "Staging complete: $StagingDir" -ForegroundColor Green + +# ── Inno Setup ─────────────────────────────────────────────────────────────── +if (-not (Test-Path $IsccPath)) { + Write-Host "" + Write-Warning "Inno Setup compiler not found at:" + Write-Warning " $IsccPath" + Write-Warning "Install Inno Setup 6 from: https://jrsoftware.org/isdl.php" + Write-Warning "Then re-run this script, or invoke ISCC manually:" + Write-Warning " `"$IsccPath`" `"$ScriptDir\RynthCore.iss`"" + exit 0 +} + +Write-Host "" +Write-Host "Building installer..." -ForegroundColor Cyan +New-Item -ItemType Directory -Path "$ScriptDir\Output" -Force | Out-Null +& $IsccPath "$ScriptDir\RynthCore.iss" +if ($LASTEXITCODE -ne 0) { throw "ISCC build failed (exit $LASTEXITCODE)" } + +Write-Host "" +Write-Host "SUCCESS" -ForegroundColor Green +Write-Host "Installer: $ScriptDir\Output\RynthCore-Setup.exe" diff --git a/installer/RynthCore.iss b/installer/RynthCore.iss new file mode 100644 index 0000000..07466b8 --- /dev/null +++ b/installer/RynthCore.iss @@ -0,0 +1,139 @@ +; RynthCore + RynthAi Installer +; Build with: Build-Installer.ps1 (requires Inno Setup 6) +; Source: https://jrsoftware.org/isdl.php + +#define AppName "RynthCore" +#define AppVersion "0.2" +#define AppPublisher "RynthCore" +#define AppExeName "RynthCore.exe" +#define DataRoot "C:\Games\RynthSuite\RynthAi" + +; NOTE: Staging directory is populated by Build-Installer.ps1 before ISCC is invoked. +; All files under staging\app\ are installed to {app}\ recursively. + +[Setup] +AppId={{A8B4C2D1-E3F5-4678-9ABC-DEF012345678} +AppName={#AppName} +AppVersion={#AppVersion} +AppPublisher={#AppPublisher} +; AppPublisherURL=https://github.com/your-repo-here +DefaultDirName=C:\Games\RynthCore +DisableDirPage=no +DefaultGroupName={#AppName} +DisableProgramGroupPage=yes +OutputDir=Output +OutputBaseFilename=RynthCore-Setup +SetupIconFile=..\src\RynthCore.App.Avalonia\LogoCore.ico +Compression=lzma2/ultra64 +SolidCompression=yes +WizardStyle=modern +; Run as lowest privilege; Windows will prompt for elevation only when +; the chosen install folder requires it (e.g. C:\Games\). +PrivilegesRequired=lowest +PrivilegesRequiredOverridesAllowed=dialog +; 32-bit app; works on 32/64-bit Windows +ArchitecturesAllowed=x86 x64 arm64 +ArchitecturesInstallIn64BitMode= + +[Languages] +Name: "english"; MessagesFile: "compiler:Default.isl" + +[Tasks] +Name: desktopicon; Description: "Create a &desktop shortcut"; GroupDescription: "Additional icons:" + +; ── Program files ───────────────────────────────────────────────────────────── +[Files] +; Installs the entire staging layout (launcher, Runtime\, Runtime\Plugins\, etc.) +Source: "staging\app\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs + +; ── Data directories (created once; never removed on uninstall) ────────────── +[Dirs] +Name: "{#DataRoot}"; Flags: uninsneveruninstall +Name: "{#DataRoot}\NavProfiles"; Flags: uninsneveruninstall +Name: "{#DataRoot}\LootProfiles"; Flags: uninsneveruninstall +Name: "{#DataRoot}\MetaFiles"; Flags: uninsneveruninstall +Name: "{#DataRoot}\MetaProfiles"; Flags: uninsneveruninstall +Name: "{#DataRoot}\SettingsProfiles"; Flags: uninsneveruninstall +Name: "{#DataRoot}\SettingsProfiles\ACEmulator"; Flags: uninsneveruninstall +Name: "{#DataRoot}\LuaScripts"; Flags: uninsneveruninstall +Name: "{#DataRoot}\Logs"; Flags: uninsneveruninstall +Name: "{#DataRoot}\pvars"; Flags: uninsneveruninstall +Name: "{#DataRoot}\ItemGiver"; Flags: uninsneveruninstall + +; ── Shortcuts ───────────────────────────────────────────────────────────────── +[Icons] +; Start Menu +Name: "{group}\RynthCore"; Filename: "{app}\{#AppExeName}"; WorkingDir: "{app}"; Comment: "Launch RynthCore and inject into Asheron's Call" +Name: "{group}\Uninstall RynthCore"; Filename: "{uninstallexe}" + +; Optional Desktop shortcut (created only when the desktopicon task is checked) +Name: "{autodesktop}\RynthCore"; Filename: "{app}\{#AppExeName}"; WorkingDir: "{app}"; Tasks: desktopicon + +; ── Pascal scripting ────────────────────────────────────────────────────────── +[Code] + +// Returns True if acclient.exe has any running instances. +function IsAcClientRunning(): Boolean; +var + WbemLocator, WbemService, QueryResult: Variant; +begin + Result := False; + try + WbemLocator := CreateOleObject('WbemScripting.SWbemLocator'); + WbemService := WbemLocator.ConnectServer('.', 'root\cimv2', '', ''); + QueryResult := WbemService.ExecQuery( + 'SELECT Handle FROM Win32_Process WHERE Name = "acclient.exe"'); + Result := QueryResult.Count > 0; + except + // If WMI fails for any reason just let the install continue. + Result := False; + end; +end; + +function InitializeSetup(): Boolean; +begin + Result := True; + + if IsAcClientRunning() then + begin + if MsgBox( + 'Asheron''s Call (acclient.exe) is currently running.' + #13#10 + + #13#10 + + 'Please close Asheron''s Call before continuing — the installer ' + + 'needs to write files that are loaded by acclient.exe.' + #13#10 + + #13#10 + + 'Click OK once you have closed it, or Cancel to abort.', + mbConfirmation, MB_OKCANCEL) = IDCANCEL then + begin + Result := False; + end; + end; +end; + +// Customise the Finish page with getting-started instructions. +procedure CurPageChanged(CurPageID: Integer); +var + Msg: String; +begin + if CurPageID <> wpFinish then Exit; + + Msg := + 'RynthCore is installed.' + #13#10 + + #13#10 + + 'Getting started:' + #13#10 + + ' 1. Start Asheron''s Call and log in to your character.' + #13#10 + + ' 2. Open RynthCore (Start Menu or Desktop shortcut).' + #13#10 + + ' 3. In the Launcher, set your acclient.exe path under Runtime Paths.' + #13#10 + + ' 4. Click "Inject Running AC" to activate the overlay.' + #13#10 + + ' The RynthAi panel should appear inside the AC window.' + #13#10 + + #13#10 + + 'Alternatively, use "Launch + Inject" to have the launcher start' + #13#10 + + 'AC and inject automatically once it finishes loading.' + #13#10 + + #13#10 + + 'Loot, nav, and meta profiles go in:' + #13#10 + + ' C:\Games\RynthSuite\RynthAi\' + #13#10 + + #13#10 + + 'Log file: %USERPROFILE%\Desktop\RynthCore.log'; + + WizardForm.FinishedLabel.Caption := Msg; +end;