Add cross-platform Avalonia Mods Manager with Linux AppImage support - #1280
Add cross-platform Avalonia Mods Manager with Linux AppImage support#1280Zexyen wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@Yokimitsuro has been working on something like this for a while on the OpenKH Discord Server. |
|
Looking onto this a little, a few concerns:
I myself don't do Linux a lot, so I will be tagging along @KHOmega for testing and assessment whether this PR is useful or detrimental for Linux and Windows folks alike, |
|
I did not originally want to mention this since OpenKH is not Re:Fined and does not share its policies or code of conduct, but this PR has a lot of the telltale signs of being generated artificially. I do apologize if this isn't the case and if it isn't I sincerely ask to be provided with evidence, as I cannot support this PR personally due to my personal alignment when it comes to Generative AI being used in important projects that a lot of people rely on. Even though I am no longer a part of the devteam, I do believe that my opinion will still matter just a tiny bit hopefully. |
|
Can we look into the code on how certain notes for the end user are formatted? This doesn't look like it was typed by a person, as several comments feel robotic. There are also some factors, such as Epic Games Store isn't available on Linux. Current versions of OpenKH work as intended when running the game via Heroic or Lutris, sans I can not in good faith support this without proof that these changes were made without the use of generative AI, as there are very big tell tale signs of it being used so. |
|
Looking further, you stated that the WPF interface is left intact for Windows, and Avalonia is used for Linux. This decision baffles me as Avalonia is cross-platform and its biggest asset is being cross-platform. Having two separate frontends on one program doesn't just make an overengineered hard to maintain program TWICE as overengineered and hard to maintain, but it also makes it so that bugs and glitches have twice the risk of popping up and being missed, whilst also adding onto the libraries called and referenced by the program. I would support a single frontend approach, replacing WPF with Avalonia completely as @Yokimitsuro has done in his fork. |
Apologies, I should've more specifically mentioned that this was a PoC and not really meant to be submitted as is.
I agree completely and would like to help @Yokimitsuro with that where possible.
They should work the same as the WINE Version (no
Some changes were created with AI Tooling (Comments & some of the work with panacea). C# isn't my strong suit (don't really use it much at work). If that causes issues with this PR please let me know and I will go ahead & close this PR. |
Then... why did you submit it as is? You could have made the PR in a way which only used Avalonia. This decision seems backwards even as a PoC.
His branch is mostly complete, and from what I can see in my personal opinion, more feature complete than this one. I'd advise reaching out to him in the OpenKH server if possible.
I do not believe the "some" claim. I can say like at least 75% of the code was made without human intervention.
I am not one of the decision makers anymore, so I have no say in this. But I will say I will not be supporting this PR going further for failure to disclose your LLM usage, failure to make the PR properly, and unless proven otherwise failure to properly disclose how much AI tooling was used in this codebase. |
|
An extremely childish response to a fair list of criticism and concerns. If you cannot handle feedback, don't contribute to open-source software. |
Important
This is a Massive PR that is still under testing and revision. I've extensively tested the Avalonia frontend on Linux, but regression testing still needs to be done on windows to confirm no bugs are brought forward.
Summary
This PR introduces a cross-platform Avalonia frontend for the OpenKH Mods Manager, bringing native Mods Manager support to Linux while keeping the existing WPF application as the default Windows experience.
The Avalonia frontend reuses the existing Mods Manager models, services, and view models wherever possible. Avalonia-specific views and compatibility services fill the places where the existing application was tied directly to WPF.
In addition to the UI port, this PR adds the supporting work needed for the full modding workflow on Linux:
Build and release model
The existing Windows application remains
OpenKh.Tools.ModsManager.csproj; Avalonia does not replace it.The cross-platform frontend is a separate project in
OpenKh.Tools.ModsManager.Avalonia.csproj. Both projects are included independently inOpenKh.sln.What changed
Avalonia Mods Manager frontend
A complete Avalonia frontend has been added under
OpenKh.Tools.ModsManager.Avalonia, including:The application starts through
Program.BuildAvaloniaApp(). Application initialization, command integration, and theme selection are handled byApp.The primary UI is implemented by
MainWindow, while the new in-window installation flow is provided byInstallModView.Shared WPF and Avalonia logic
The Avalonia project links the existing Mods Manager models, services, interfaces, extensions, and view models through
OpenKh.Tools.ModsManager.Avalonia.csproj.This keeps core behavior in one place instead of maintaining separate WPF and Avalonia implementations. WPF-specific views and services that construct WPF windows directly are excluded and replaced by Avalonia equivalents.
The existing WPF application remains supported and has been regression-built after the shared changes.
Avalonia compatibility layer
A new shared project,
OpenKh.Tools.Common.Avalonia, provides Avalonia implementations for UI behavior expected by the existing view models, including:This keeps the initial port focused and allows the existing view models to serve both frontends with minimal duplication.
Linux, Steam, and Proton support
Steam discovery
SteamServicediscovers Steam installations, additional library folders, supported games, account configuration files, and app-specific launch options.The setup and launch flows use this information through
SetupWizardViewModelandMainViewModel.Automatic Steam launch options
Panacea and LuaBackend are native Windows DLLs loaded by the Windows game executables. When those executables run through Proton, Wine must be told to prefer the installed native DLLs over its built-in replacements.
After Panacea or LuaBackend is installed, the Mods Manager now offers to add the required Steam launch options automatically:
The workflow is implemented by
SetupWizardViewModel.OfferSteamLaunchOptions()andSteamService.EnsureLaunchOptions().It:
localconfig.vdf.LaunchOptionsentry.The prompt is triggered from the relevant Panacea and LuaBackend installation flows in
SetupWizardViewModel,SetupWizardViewModel, andSetupWizardViewModel.Panacea support for the Steam launcher
The Panacea DLL now recognizes both Steam and Epic launcher functions.
During
OpenKH::Initialize(), Panacea scans for both implementations. It selects the Steam launcher when available and falls back to the Epic launcher otherwise. The Steam hook is represented byLaunchGameSteam, with launcher selection performed inOpenKH.cpp.This allows Panacea's existing quick-launch flow to work with the current Steam releases without breaking the Epic path.
Reliable quick launch under Proton
Immediately closing the launcher after requesting a game launch can race Steam's Proton session tracking. The new game may start while the launcher's Wine session is shutting down, which can leave Steam stuck on
Launchingor prevent it from registering the game process correctly.Panacea now detects Wine/Proton through
IsRunningUnderWine(). When quick-launching under Proton,QuickBootHook():Game-process detection is handled by
IsGameProcessRunning().Linux game launching
MainViewModel.RunGame()now accounts for both the current platform and selected storefront.On Linux:
Wine-compatible game paths
The Mods Manager itself uses native Linux paths, but configuration read by games under Proton must use Windows-compatible paths.
WinePathUtil.ToGamePath()converts native Linux paths to Wine'sZ:drive format.WinePathUtil.ToGamePathForwardSlashes()provides a forward-slash form suitable for TOML without additional escaping.These conversions are used when writing configuration consumed by the Windows game processes and LuaBackend.
Cross-platform behavior
Platform capabilities
PlatformCapabilitiesprovides one place to describe features that are currently Windows-only.On Linux, the UI hides or bypasses:
These features remain available to the existing WPF application and to Avalonia when running on Windows.
Mod asset paths
Mod metadata commonly uses Windows-style separators regardless of the host operating system.
PatcherProcessor.Context.NormalizeSeparators()now normalizes those paths on Unix-like systems before resolving original, source, destination, and package-map locations.For example,
bgm\music050.win32.scdresolves asbgm/music050.win32.scdon Linux instead of becoming a filename containing a literal backslash.Writable packaged configuration
An AppImage runs from an immutable mounted filesystem, so its installation directory cannot be assumed to be writable.
ConfigurationService.GetWritableStoragePath()now uses the installation directory when possible and falls back to the user's application-data directory when necessary.This covers:
Shared mod downloads and images
DownloadableModsServicewas refactored so download behavior can be shared by both frontends.Frontend-specific image handling is separated into:
DownloadableModsService.Images.Wpf.csDownloadableModsService.Images.csThis prevents WPF image types from leaking into the cross-platform build.
Setup wizard navigation
WizardPageStackServiceandSetupWizardViewModelwere updated so the same setup logic works in both frontends.The Avalonia wizard uses a page host instead of the WPF/Xceed wizard control, while preserving the existing view-model-driven branching in
SetupWizardWindow.Linux packaging and CI
AppImage packaging
build-linux-modsmanager.shnow:linux-x64.AppRunentry point.appimagetoolwhen it is not already available.appimagetoolin extraction mode.openkh-modsmanager-x86_64.AppImage.Panacea remains a Windows DLL, but it is intentionally included in the Linux package because the Kingdom Hearts executables themselves continue to run as Windows applications through Proton.
Packaging metadata lives under
packaging.GitHub Actions
The Linux workflow in
.github/workflows/dotnet-linux.yml:The existing Windows workflow in
.github/workflows/dotnet.ymlcontinues to build and package the WPF Mods Manager as part of the normal OpenKH Windows release.Both workflows now use current versions of the official checkout and .NET setup actions.
Tests
A new Linux-compatible test project has been added under
OpenKh.Tests.ModsManager.Avalonia. It targets platform-neutral .NET 8 and usesAvalonia.Headless.XUnit.The test suite covers:
Z:path conversion.The headless application is configured by
TestApp.BuildAvaloniaApp().Known platform differences
These differences are intentional and should not be treated as regressions:
Validation performed
Automated
linux-x64publish succeeds.win-x64publish succeeds.Manual
Reviewer checklist
Existing Windows WPF application
Linux Avalonia application
Panacea and Proton
%command%remain intact.localconfig.vdfwith Steam closed.version.dll/Panacea anddinput8.dll/LuaBackend load under Proton.Launching.Optional Windows Avalonia build
win-x64.Packaging and CI
.github/workflows/dotnet-linux.ymlpasses on the final PR commit..github/workflows/dotnet.ymlpasses on the final PR commit.Shared code review
Because this PR changes shared behavior in addition to adding a frontend, reviewers should pay particular attention to:
ConfigurationService.GetWritableStoragePath().SteamService.PlatformCapabilities.WinePathUtil.SetupWizardViewModel.MainViewModel.PatcherProcessor.Context.NormalizeSeparators().DownloadableModsService.OpenKH.cpp.Potential follow-up work
The following items are outside the scope of the initial Linux port and can be handled separately:
linux-x64.Screenshots
Main Mods Manager window on Linux
Setup wizard and Steam discovery
Integrated mod installation dialog