Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
run: |
$version = (Select-String '^__version__ = "(.*)"' src/decompnet/__init__.py).Matches.Groups[1].Value
if ("v$version" -ne $env:TAG) { throw "Tag $env:TAG does not match project version $version" }
- name: Build the Windows setup bundle
- name: Build Windows setup and portable downloads
shell: pwsh
run: packaging/windows/build.ps1
- name: Attach it to the release
Expand All @@ -67,11 +67,13 @@ jobs:
run: |
$installer = (Get-ChildItem dist -Filter '*-windows-x64-setup.exe' | Select-Object -First 1).FullName
if (-not $installer) { throw 'Windows setup bundle was not created.' }
$portable = (Get-ChildItem dist -Filter '*-windows-x64-portable.zip' | Select-Object -First 1).FullName
if (-not $portable) { throw 'Windows portable ZIP was not created.' }
gh release view $env:TAG 2>$null | Out-Null
if ($LASTEXITCODE -eq 0) {
gh release upload $env:TAG $installer --clobber
gh release upload $env:TAG $installer $portable --clobber
} else {
gh release create $env:TAG $installer --generate-notes --latest
gh release create $env:TAG $installer $portable --generate-notes --latest
}

macos:
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/windows-portable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Windows portable
on:
workflow_dispatch:
pull_request:
paths:
- 'packaging/windows/**'
- '.github/workflows/windows-portable.yml'
- 'pyproject.toml'
- 'uv.lock'
- 'tests/test_windows_portable.py'
- 'src/decompnet/app/launcher.py'
permissions:
contents: read
jobs:
portable:
runs-on: windows-2022
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10.3.0
- name: Check native launcher argument forwarding
run: uv run pytest tests/test_windows_portable.py -q
- name: Build and smoke test relocated portable EXE
shell: pwsh
run: packaging/windows/build.ps1 -PortableOnly
- uses: actions/upload-artifact@v4
with:
name: decompdecomp-windows-x64-portable
path: dist/*-windows-x64-portable.zip
if-no-files-found: error
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,15 @@ decomp
```

The app opens in a native Windows window. Its shortcuts appear on the desktop and in Start, and its tray icon
brings back a window closed while helpers work. Free tools use Windows builds where available. Projects stay in your Windows `Decomp-RetroReversing` folder.
brings back a window closed while helpers work.

For a portable Windows download, extract `decompdecomp-<version>-windows-x64-portable.zip`
and open `decompdecomp.exe`. Keep its bundled `python` and `packages` folders beside it;
no app installation or administrator access is needed. The native window requires .NET
Framework 4.8 and Microsoft Edge WebView2 Runtime. Projects use
`%USERPROFILE%\Decomp-RetroReversing` (or your explicit `DECOMP_HOME`), so move that
folder too when moving your work. The setup download can install missing Microsoft prerequisites.
Free tools use Windows builds where available. Projects stay in your Windows `Decomp-RetroReversing` folder.

> [!IMPORTANT]
> **PS1, PS2 and most N64 games need WSL 2 on Windows.** Their period compilers (GCC for PlayStation, EE-GCC and
Expand Down
4 changes: 4 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,10 @@ similar C through objdiff. Other processors need an instruction reader for this

## Recently done

- **Portable Windows app.** A ZIP bundles a relocatable `decompdecomp.exe`, Python and app
dependencies. No app installation is needed; Microsoft window prerequisites must already be
available. CI extracts the archive to a different path and checks the EXE and server imports.

- **Separate fork data.** Installed copies default to `Decomp-RetroReversing` in the user home;
checkouts and separate source handoffs use `Decomp-RetroReversing-dev`. Explicit `DECOMP_HOME`
overrides still work. Upstream data is never selected or migrated automatically.
Expand Down
32 changes: 30 additions & 2 deletions packaging/windows/build.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Build the Windows setup bundle used by the release workflow. It installs missing Microsoft runtimes before running
# Build the Windows portable ZIP and setup bundle used by the release workflow. It installs missing Microsoft runtimes before running
# the app's MSI. WiX 3 is used because it does not require accepting the WiX 7 Open Source Maintenance Fee agreement.
[CmdletBinding()]
param([switch]$SkipInstallSmoke)
param([switch]$SkipInstallSmoke, [switch]$PortableOnly)

$ErrorActionPreference = 'Stop'
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '../..')).Path
Expand Down Expand Up @@ -75,6 +75,34 @@ raise SystemExit(main())
}
Get-ChildItem -Path $app -Filter '__pycache__' -Directory -Recurse | Remove-Item -Recurse -Force

# Build from the same runtime as the installer, then test after ZIP extraction and relocation.
$compiler = Join-Path $env:WINDIR 'Microsoft.NET/Framework64/v4.0.30319/csc.exe'
if (-not (Test-Path -LiteralPath $compiler)) { throw 'The portable launcher needs the .NET Framework C# compiler.' }
& $compiler /nologo /target:winexe /platform:x64 /reference:System.Windows.Forms.dll `
"/win32icon=$(Join-Path $app 'decompdecomp.ico')" "/out:$(Join-Path $app 'decompdecomp.exe')" `
(Join-Path $PSScriptRoot 'portable-launcher.cs')
if ($LASTEXITCODE -ne 0) { throw 'Could not compile the portable Windows launcher.' }
Copy-Item -LiteralPath (Join-Path $PSScriptRoot 'portable-README.txt') -Destination (Join-Path $app 'README.txt')
foreach ($license in @('LICENSE', 'LICENSE-decomp.wtf')) {
Copy-Item -LiteralPath (Join-Path $repoRoot $license) -Destination $app
}
$portable = Join-Path $dist "decompdecomp-$version-windows-x64-portable.zip"
Compress-Archive -Path (Join-Path $app '*') -DestinationPath $portable -Force
$relocated = Join-Path $work 'relocated portable app'
Expand-Archive -LiteralPath $portable -DestinationPath $relocated
$portableRun = Start-Process -FilePath (Join-Path $relocated 'decompdecomp.exe') `
-ArgumentList '--help' -PassThru
if (-not $portableRun.WaitForExit(30000)) {
$portableRun.Kill()
throw 'The extracted portable EXE did not finish its launch check within 30 seconds.'
}
if ($portableRun.ExitCode -ne 0) { throw 'The extracted portable EXE failed its relocated launch check.' }
& (Join-Path $relocated 'python/python.exe') -c "import site,sys; site.addsitedir(sys.argv[1]); import decompnet.app.server" (Join-Path $relocated 'packages')
if ($LASTEXITCODE -ne 0) { throw 'The extracted portable app failed its server import check.' }
& (Join-Path $relocated 'python/python.exe') (Join-Path $PSScriptRoot 'smoke_portable.py') $relocated
if ($LASTEXITCODE -ne 0) { throw 'The extracted portable EXE failed its isolated server startup/Stop check.' }
if ($PortableOnly) { return }

$wixBin = $env:WIX_BIN
if (-not $wixBin) {
$wixZip = Join-Path $work 'wix314-binaries.zip'
Expand Down
15 changes: 15 additions & 0 deletions packaging/windows/portable-README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
decompdecomp portable for Windows x64

Extract the entire ZIP, then double-click decompdecomp.exe. Keep the python and
packages folders beside the EXE. No app installation or administrator access is
needed, and no shortcuts or uninstall entry are created automatically.

Projects and settings use %USERPROFILE%\Decomp-RetroReversing, separate from
upstream decompdecomp. An explicit DECOMP_HOME environment variable still works.
To move your work to another computer, copy that data folder as well as the app.

The native window needs .NET Framework 4.8 and Microsoft Edge WebView2 Runtime.
Windows Update normally provides .NET. If WebView2 is missing, install Microsoft's
runtime from https://developer.microsoft.com/microsoft-edge/webview2/ .
The setup download can install these prerequisites for you; the portable app
does not install them silently. Compilers are selected separately in Setup.
61 changes: 61 additions & 0 deletions packaging/windows/portable-launcher.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// A relocatable entry point for the bundled runtime, without an installer or console window.
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text;
using System.Windows.Forms;

internal static class PortableLauncher
{
// Windows passes a single command line. Preserve quotes, empty arguments and trailing backslashes.
private static string Quote(string value)
{
var result = new StringBuilder("\"");
int slashes = 0;
foreach (char c in value)
{
if (c == '\\') { slashes++; continue; }
result.Append('\\', c == '"' ? slashes * 2 + 1 : slashes);
result.Append(c);
slashes = 0;
}
result.Append('\\', slashes * 2);
return result.Append('"').ToString();
}

[STAThread]
private static int Main(string[] args)
{
try
{
string root = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string python = Path.Combine(root, "python", "pythonw.exe");
string script = Path.Combine(root, "decomp-launch.pyw");
if (!File.Exists(python) || !File.Exists(script))
throw new FileNotFoundException("Extract the entire portable ZIP before opening decompdecomp.exe. Keep it beside the python and packages folders.");
var command = new StringBuilder(Quote(script));
foreach (string arg in args) command.Append(" ").Append(Quote(arg));
var start = new ProcessStartInfo(python, command.ToString());
start.UseShellExecute = false;
start.CreateNoWindow = true;
// An unrelated Python installation must not change the bundled runtime's imports.
start.EnvironmentVariables.Remove("PYTHONHOME");
start.EnvironmentVariables.Remove("PYTHONPATH");
start.EnvironmentVariables["DECOMP_PORTABLE"] = "1";
using (Process child = Process.Start(start))
{
child.WaitForExit();
if (child.ExitCode != 0 && args.Length == 0)
MessageBox.Show("The app could not start. Check README.txt for the Microsoft window prerequisites and .decomp/logs/decomp.log in your project data folder for details.",
"decompdecomp", MessageBoxButtons.OK, MessageBoxIcon.Error);
return child.ExitCode;
}
}
catch (Exception error)
{
MessageBox.Show(error.Message, "decompdecomp", MessageBoxButtons.OK, MessageBoxIcon.Error);
return 1;
}
}
}
50 changes: 50 additions & 0 deletions packaging/windows/smoke_portable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""Start and stop only the extracted portable app, in an isolated home on the Windows build runner."""
import os
import socket
import subprocess
import sys
import tempfile
import time
import urllib.error
import urllib.request
from pathlib import Path


def main(folder):
executable = Path(folder).resolve() / 'decompdecomp.exe'
with tempfile.TemporaryDirectory(prefix='decomp-portable-smoke-') as temporary:
home = Path(temporary)
env = dict(os.environ, HOME=str(home), USERPROFILE=str(home), DECOMP_HOME=str(home / 'data'),
DECOMP_WINDOW='0', DECOMP_TRAY='0')
with socket.socket() as listener:
listener.bind(('127.0.0.1', 0))
port = listener.getsockname()[1]
process = subprocess.Popen([str(executable), 'serve', '--port', str(port)], cwd=home, env=env)
try:
deadline = time.monotonic() + 90
while time.monotonic() < deadline:
if process.poll() is not None:
raise RuntimeError(f'The portable app exited before becoming ready: {process.returncode}')
try:
with urllib.request.urlopen(f'http://127.0.0.1:{port}/health', timeout=2) as response:
if response.status == 200:
break
except (OSError, urllib.error.URLError):
time.sleep(.25)
else:
raise RuntimeError('The portable app did not answer its health check within 90 seconds.')
if not (home / 'data/.decomp/server.json').is_file():
raise RuntimeError('The portable app did not use its explicitly isolated data home.')
subprocess.run([str(executable), 'stop'], cwd=home, env=env, check=True, timeout=40)
if process.wait(timeout=20) != 0:
raise RuntimeError('The portable app did not exit cleanly after Stop.')
print('Extracted portable EXE: isolated server startup, health and graceful Stop passed.')
finally:
if process.poll() is None:
subprocess.run(['taskkill', '/PID', str(process.pid), '/T', '/F'],
capture_output=True, timeout=15, check=False)
process.wait(timeout=15)


if __name__ == '__main__':
main(sys.argv[1])
2 changes: 1 addition & 1 deletion site/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ <h2 id="start-h">Start.</h2>
<p class="step-note">Linux: run it in your terminal. It installs the app and compilers, then opens the app in its own window. There's also a .deb, an .rpm and an AppImage on the <a href="https://github.com/RetroReversing/decompdecomp/releases/latest">releases page</a>.</p>
<p class="step-note">Projects and settings use <code>~/Decomp-RetroReversing</code> (<code>%USERPROFILE%\Decomp-RetroReversing</code> on Windows), separate from upstream. Existing <code>DECOMP_HOME</code> overrides are respected; upstream databases are not migrated automatically.</p>
<p class="step-note">Fork releases use <code>vX.Y.Z-rr.N</code> and include Windows installers and macOS apps for Apple Silicon and Intel.</p>
<p class="step-note">Windows 10 and 11: download and open <code>decompdecomp-&lt;version&gt;-windows-x64-setup.exe</code> from the <a href="https://github.com/RetroReversing/decompdecomp/releases/latest">latest release</a>. The app opens in a native Windows window, with desktop and Start shortcuts and a tray icon. PS1, PS2 and most N64 games also need WSL 2 for their period compilers: run <code>wsl --install</code> in an administrator PowerShell, restart if asked, then open Ubuntu once. GameCube, Wii, DS and Windows PC games, and N64 games built with IDO, don't.</p>
<p class="step-note">Windows 10 and 11: for a portable app, extract the <code>windows-x64-portable.zip</code> download and open <code>decompdecomp.exe</code>. Keep its bundled folders alongside it. The portable download uses the same separate fork data folder and needs .NET Framework 4.8 and Microsoft Edge WebView2 Runtime already available. For setup with prerequisite installation, download and open <code>decompdecomp-&lt;version&gt;-windows-x64-setup.exe</code> from the <a href="https://github.com/RetroReversing/decompdecomp/releases/latest">latest release</a>. The app opens in a native Windows window, with desktop and Start shortcuts and a tray icon. PS1, PS2 and most N64 games also need WSL 2 for their period compilers: run <code>wsl --install</code> in an administrator PowerShell, restart if asked, then open Ubuntu once. GameCube, Wii, DS and Windows PC games, and N64 games built with IDO, don't.</p>
<p class="step-note">Frequent source updates: Settings → Run from Git can prepare main updates in a separate runtime while agents keep working. Enable automatic updates there; a restart check holds new sessions for at most 15 seconds, then releases them and retries later if active work needs longer. Agents resume with saved usage limits. No app rebuild is needed.</p>
<p class="cmd"><code id="cmd-macos">curl -fsSL https://raw.githubusercontent.com/RetroReversing/decompdecomp/main/site/public/install.sh | bash -s -- --source branch:main</code><button type="button" class="copy" data-copy-from="cmd-macos">Copy</button></p>
<p class="step-note">macOS 12+ on Intel and Apple Silicon: installs the current source and a Finder app in ~/Applications. Apple Silicon needs Rosetta for the Intel N64 KMC compiler and binutils. PS2 Sony EE-GCC needs the optional local Linux runner: install <code>brew install colima docker</code>, then choose Prepare Linux runner in Compilers &amp; tools. SN Systems EE-GCC 2.95.2/2.95.3 and CodeWarrior PS2 2.3.3/3.0.1 use wibo. Install wibo under Compilers &amp; tools → Tools; existing compiler packs show Install missing tools when a runtime needs repair. Pinned SN packs handle install paths containing spaces automatically; CodeWarrior requires license acceptance in Setup. macOS has no menu bar tray icon yet.</p>
Expand Down
2 changes: 2 additions & 0 deletions src/decompnet/app/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def _shortcut_app_id(shortcut: Path) -> None:
def install_launcher() -> str:
"""Put decompdecomp in the apps menu (a .desktop entry and its icon). A development copy gets none: it's started
from its checkout."""
if os.environ.get("DECOMP_PORTABLE") == "1":
return "the portable app is available through decompdecomp.exe; no shortcuts were installed"
if edition.DEV:
return "a development copy gets no launcher: run it with `uv run decomp` in the checkout"
if sys.platform == "darwin" and os.environ.get("DECOMP_PACKAGE") == "macos":
Expand Down
Loading
Loading