diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 07a24cf..47444e8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,168 @@ -name: VNAR Release Bootstrap +name: Build Beta Release on: + push: + branches: + - main + pull_request: + branches: + - main workflow_dispatch: +permissions: + contents: read + +concurrency: + group: vnar-release-${{ github.ref }} + cancel-in-progress: false + +env: + RELEASE_TAG: v1.0.0-beta.1.1 + jobs: - waiting: - runs-on: ubuntu-latest + build-release: + runs-on: windows-latest + steps: - - run: echo "Bootstrap files are being prepared." + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET 10 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 10.0.x + + - name: Restore + run: dotnet restore .\LocaleGameHub\LocaleGameHub.csproj + + - name: Publish self-contained build + shell: pwsh + run: | + dotnet publish .\LocaleGameHub\LocaleGameHub.csproj ` + -c Release ` + -r win-x64 ` + --self-contained true ` + -p:PublishSingleFile=true ` + -p:IncludeNativeLibrariesForSelfExtract=true ` + -o .\dist\portable + + if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed" } + + Copy-Item .\LICENSE .\dist\portable\LICENSE.txt + Copy-Item .\THIRD_PARTY_NOTICES.md .\dist\portable\THIRD_PARTY_NOTICES.md + Copy-Item .\README.md .\dist\portable\README.md + Copy-Item .\README.es.md .\dist\portable\README.es.md + + # Debug symbols are not required by end users (Skia's PDB is large). + Get-ChildItem .\dist\portable -Recurse -Filter *.pdb | Remove-Item + + - name: Include dependency licenses + shell: pwsh + run: | + $noticeRoot = New-Item .\dist\portable\licenses -ItemType Directory -Force + $dotnetNotices = New-Item (Join-Path $noticeRoot.FullName 'dotnet') -ItemType Directory -Force + Get-ChildItem $env:DOTNET_ROOT -File | + Where-Object { $_.Name -match '(?i)license|notice' } | + Copy-Item -Destination $dotnetNotices.FullName + + $assets = Get-Content .\LocaleGameHub\obj\project.assets.json -Raw | ConvertFrom-Json + foreach ($packageRoot in $assets.packageFolders.PSObject.Properties.Name) { + foreach ($package in (Get-ChildItem $packageRoot -Directory | Where-Object { $_.Name -like 'skiasharp*' -or $_.Name -like 'microsoft.netcore.app.runtime.*' -or $_.Name -like 'microsoft.windowsdesktop.app.runtime.*' })) { + foreach ($notice in (Get-ChildItem $package.FullName -Recurse -File | Where-Object { $_.Name -match '(?i)license|notice' -and $_.Extension -in '.txt', '.md', '.html', '' })) { + $relative = [IO.Path]::GetRelativePath($packageRoot, $notice.FullName) + $target = Join-Path $noticeRoot.FullName $relative + New-Item (Split-Path $target -Parent) -ItemType Directory -Force | Out-Null + Copy-Item $notice.FullName $target + } + } + } + if (!(Get-ChildItem $dotnetNotices.FullName -File)) { throw 'Missing .NET license notices' } + Get-ChildItem $noticeRoot.FullName -Recurse -File | Select-Object FullName + + - name: Create portable ZIP + shell: pwsh + run: | + Compress-Archive -Path .\dist\portable\* -DestinationPath .\dist\VNAR-Portable-win-x64.zip -Force + + - name: Install Inno Setup + shell: pwsh + run: choco install innosetup --no-progress -y + + - name: Build installer + shell: pwsh + run: | + & "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" .\installer\VNAR.iss + if ($LASTEXITCODE -ne 0) { throw "Installer compilation failed" } + + - name: Verify packages and create checksums + shell: pwsh + run: | + foreach ($file in @('.\dist\portable\VNAR.exe', '.\dist\portable\Resources\VNARShortcut.ico', '.\dist\VNAR-Setup.exe', '.\dist\VNAR-Portable-win-x64.zip')) { + if (!(Test-Path $file) -or (Get-Item $file).Length -eq 0) { throw "Missing or empty package file: $file" } + } + Get-FileHash .\dist\VNAR-Setup.exe, .\dist\VNAR-Portable-win-x64.zip -Algorithm SHA256 | + ForEach-Object { "$($_.Hash.ToLower()) $(Split-Path $_.Path -Leaf)" } | + Set-Content .\dist\SHA256SUMS.txt -Encoding ascii + + - name: Upload validated packages + uses: actions/upload-artifact@v4 + with: + name: vnar-windows-packages + path: | + dist/VNAR-Setup.exe + dist/VNAR-Portable-win-x64.zip + dist/SHA256SUMS.txt + if-no-files-found: error + + publish-release: + needs: build-release + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + runs-on: windows-latest + permissions: + contents: write + steps: + - name: Download validated packages + uses: actions/download-artifact@v4 + with: + name: vnar-windows-packages + path: dist + + - name: Publish GitHub prerelease + shell: pwsh + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + run: | + $tag = "${{ env.RELEASE_TAG }}" + $notes = @" + ## VNAR Beta 1.1 + + First public GitHub beta package. + + ### Downloads + - **VNAR-Setup.exe** — self-contained Windows installer. + - **VNAR-Portable-win-x64.zip** — self-contained portable build. + - **SHA256SUMS.txt** — package checksums. + + Both packages store settings and artwork in `%LOCALAPPDATA%\VNAR`. + The executables are unsigned; Windows may display a SmartScreen warning. + + See the repository README for setup instructions, features, and third-party notices. + "@ + + gh release view $tag 2>$null + if ($LASTEXITCODE -ne 0) { + gh release create $tag ` + .\dist\VNAR-Setup.exe ` + .\dist\VNAR-Portable-win-x64.zip ` + .\dist\SHA256SUMS.txt ` + --title "VNAR Beta 1.1" ` + --notes $notes ` + --prerelease --draft ` + --target "${{ github.sha }}" + if ($LASTEXITCODE -ne 0) { throw "Release upload failed" } + gh release edit $tag --draft=false + if ($LASTEXITCODE -ne 0) { throw "Release publication failed" } + } else { + Write-Host "Release $tag already exists; keeping its original packages. Bump RELEASE_TAG for the next release." + } diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..32a1d21 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,16 @@ +# Changelog + +## 1.0.0-beta.1.1 + +First public GitHub beta package. + +Highlights: + +- Locale Emulator profiles and first-run setup. +- Game library import, drag & drop, scanning, search, pagination, favorites, and developer grouping. +- English and Spanish UI. +- VNDB metadata and cover integration. +- Non-destructive cover editor with HQ export and multiple background modes. +- WebP normalization through SkiaSharp. +- Smart desktop shortcuts with selectable executable icons. +- Themed context menus and scrollbars. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fbcc40f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 JAVCIF + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LocaleGameHub/App.xaml b/LocaleGameHub/App.xaml new file mode 100644 index 0000000..f5400c7 --- /dev/null +++ b/LocaleGameHub/App.xaml @@ -0,0 +1,500 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LocaleGameHub/App.xaml.cs b/LocaleGameHub/App.xaml.cs new file mode 100644 index 0000000..46b8bae --- /dev/null +++ b/LocaleGameHub/App.xaml.cs @@ -0,0 +1,131 @@ +using System.Text; +using System.Windows; +using System.Windows.Threading; +using LocaleGameHub.Services; + +namespace LocaleGameHub; + +public partial class App : Application +{ + protected override void OnStartup(StartupEventArgs e) + { + base.OnStartup(e); + + DispatcherUnhandledException += App_DispatcherUnhandledException; + AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; + + try + { + var preferences = new LibraryService(); + LocalizationService.SetLanguage(preferences.Settings.Language); + + if (TryGetLaunchGameId(e.Args, out var gameId)) + { + LaunchFromShortcut(preferences, gameId); + Shutdown(0); + return; + } + + var main = new MainWindow(); + MainWindow = main; + main.Show(); + } + catch (Exception ex) + { + ShowStartupError(ex); + Shutdown(-1); + } + } + + + private static bool TryGetLaunchGameId(string[] args, out Guid gameId) + { + gameId = Guid.Empty; + for (var i = 0; i < args.Length; i++) + { + var arg = args[i]; + if (arg.StartsWith("--launch=", StringComparison.OrdinalIgnoreCase)) + return Guid.TryParse(arg["--launch=".Length..].Trim('"'), out gameId); + + if (!arg.Equals("--launch", StringComparison.OrdinalIgnoreCase) || i + 1 >= args.Length) continue; + return Guid.TryParse(args[i + 1].Trim('"'), out gameId); + } + return false; + } + + private static void LaunchFromShortcut(LibraryService library, Guid gameId) + { + var game = library.Games.FirstOrDefault(g => g.Id == gameId) + ?? throw new InvalidOperationException(LocalizationService.Bi( + "Ese acceso directo apunta a un juego que ya no existe en la biblioteca de VNAR.", + "This shortcut points to a game that no longer exists in the VNAR library.")); + + var locale = new LocaleEmulatorService(library); + locale.Launch(game); + game.LastPlayedUtc = DateTime.UtcNow; + library.SaveGames(); + } + + private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) + { + WriteCrashLog("DispatcherUnhandledException", e.Exception); + MessageBox.Show( + BuildErrorMessage(e.Exception), + LocalizationService.Bi("VNAR - Error inesperado", "VNAR - Unexpected error"), + MessageBoxButton.OK, + MessageBoxImage.Error); + e.Handled = true; + } + + private void CurrentDomain_UnhandledException(object? sender, UnhandledExceptionEventArgs e) + { + if (e.ExceptionObject is Exception ex) + WriteCrashLog("UnhandledException", ex); + } + + private static void ShowStartupError(Exception ex) + { + WriteCrashLog("Startup", ex); + MessageBox.Show( + BuildErrorMessage(ex), + LocalizationService.Bi("VNAR no pudo iniciar", "VNAR could not start"), + MessageBoxButton.OK, + MessageBoxImage.Error); + } + + private static string BuildErrorMessage(Exception ex) + { + return LocalizationService.IsSpanish + ? $"VNAR encontró un error al iniciar.\n\n{ex.GetType().Name}: {ex.Message}\n\nSe guardó un log en:\n{CrashLogPath}" + : $"VNAR encountered a startup error.\n\n{ex.GetType().Name}: {ex.Message}\n\nA log was saved to:\n{CrashLogPath}"; + } + + private static string CrashLogPath + { + get + { + var root = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), + "VNAR"); + return Path.Combine(root, "crash.log"); + } + } + + private static void WriteCrashLog(string stage, Exception ex) + { + try + { + var path = CrashLogPath; + Directory.CreateDirectory(Path.GetDirectoryName(path)!); + var sb = new StringBuilder(); + sb.AppendLine($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] {stage}"); + sb.AppendLine(ex.ToString()); + sb.AppendLine(new string('-', 80)); + File.AppendAllText(path, sb.ToString()); + } + catch + { + // Never let logging hide the original error. + } + } +} diff --git a/LocaleGameHub/CoverEditorWindow.xaml b/LocaleGameHub/CoverEditorWindow.xaml new file mode 100644 index 0000000..9f5560f --- /dev/null +++ b/LocaleGameHub/CoverEditorWindow.xaml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +