How scighost/starward works
Purpose and executable topology
Starward is a Windows third-party replacement launcher for HoYoverse PC games, with launcher, installation, account, game-data, gacha, screenshot, and play-time features. The primary GUI executable is the WPF/WinUI-style Starward app, entered through src/Starward/Program.cs and src/Starward/App.xaml.cs; its main shell is src/Starward/Features/ViewHost/MainWindow.xaml.
Supporting executables are a privileged/local RPC worker (src/Starward.RPC/Program.cs), an installer/updater (src/Starward.Setup/Program.cs), and a native launcher component (src/Starward.Launcher/Starward.Launcher.cpp).
Presentation, composition, and feature boundaries
The desktop client is organized by feature under src/Starward/Features. App configuration/service registration is centralized in src/Starward/AppConfig.ServiceProvider.cs, while navigation/window hosting lives in src/Starward/Features/ViewHost/MainView.xaml.cs and src/Starward/Features/ViewHost/MainWindow.xaml.cs.
Feature services own application orchestration; XAML pages/windows are presentation endpoints. Cross-feature state changes are represented by feature-local message classes, such as launch, navigation, and installation messages, rather than direct UI-to-UI coupling.
Game discovery, metadata, and launching
Game identity and shared HoYoverse contracts are modeled in Core: src/Starward.Core/GameBiz.cs, src/Starward.Core/GameRegistry.cs, and src/Starward.Core/HoYoPlay/HoYoPlayClient.cs. The client retrieves launcher/game package metadata, maps it to supported game variants, then surfaces selected-game state through src/Starward/Features/GameSelector/GameSelector.xaml.cs.
src/Starward/Features/GameLauncher/GameLauncherService.cs coordinates installation state, authentication/announcements, local game configuration, and process start actions. It is the boundary between UI workflows and local executable/game files.
Installation worker and IPC boundary
Potentially long-running or privileged game package operations are isolated in Starward.RPC. src/Starward/Features/RPC/RpcService.cs is the GUI-side bridge; src/Starward.RPC/NamedPipesConnectionFactory.cs and src/Starward.RPC/RpcClientFactory.cs establish local named-pipe RPC.
The worker exposes protobuf-defined environment and install operations (src/Starward.RPC/Env/Env.proto, src/Starward.RPC/GameInstall/GameInstall.proto) and executes stateful download, verification/assembly, install, and uninstall workflows through src/Starward.RPC/GameInstall/GameInstallService.cs and src/Starward.RPC/GameInstall/GamePackageService.cs. This process boundary protects UI responsiveness and separates disk/network package mutation from the desktop client.
HoYoverse online-data integrations
Starward.Core is the typed API client layer, with JSON contexts/converters and service-specific clients. Game record retrieval is centered on src/Starward.Core/GameRecord/GameRecordClient.cs and src/Starward.Core/GameRecord/HoyolabClient.cs; UI coordination is in src/Starward/Features/GameRecord/GameRecordService.cs.
Gacha acquisition is game-specific behind src/Starward.Core/Gacha/GachaLogClient.cs, then normalized, persisted/exported, and displayed by src/Starward/Features/Gacha/GachaLogService.cs and src/Starward/Features/Gacha/UIGF/UIGFGachaService.cs. These integrations depend on HoYoLAB/miHoYo and HoYoPlay endpoints; failure semantics are centralized by src/Starward.Core/miHoYoApiException.cs.
Local user data and auxiliary desktop capabilities
The GUI persists feature data through src/Starward/Features/Database/DatabaseService.cs, with gacha, accounts, play time, and screenshot features layering on it or local filesystem/game-process state. Key examples are src/Starward/Features/GameAccount/GameAccountService.cs, src/Starward/Features/PlayTime/PlayTimeRecordService.cs, and src/Starward/Features/Screenshot/ScreenCaptureService.cs.
src/Starward/Features/Overlay/RunningGameService.cs tracks running games for overlays and related lifecycle behavior. Native Windows integration also includes URL protocol handling (src/Starward/Features/UrlProtocol/UrlProtocolService.cs) and gamepad input (src/Starward/Features/GamepadControl/GamepadController.cs).
Distribution, updates, and runtime dependencies
The installer applies full/downloaded updates and HPatch deltas through src/Starward.Setup/Services/InstallService.cs, src/Starward.Setup/Services/UpdateService.cs, and native runtime libraries under src/Starward.Setup/runtimes. The app invokes update/setup workflows through src/Starward/Features/Update/UpdateService.cs and src/Starward/Features/Update/SetupService.cs.
The solution targets Windows 10+ and requires WebView2 and WebP support. Builds are .NET plus native C++/UWP toolchains (Starward.slnx); release artifacts are published via GitHub workflows, with GitHub Releases, Cloudflare CDN, and SignPath signing as distribution infrastructure.
Main entry points: GameRegistry.cs Game identity & registry · GameLauncherService.cs Game launch orchestration · HoYoPlayClient.cs HoYoPlay metadata client · AppConfig.ServiceProvider.cs Service composition
Components 22
Desktop client
- Starward app · Primary Windows launcher process.
src/Starward/Program.cs - Service composition
src/Starward/AppConfig.ServiceProvider.cs - Main shell & navigation
src/Starward/Features/ViewHost/MainWindow.xaml - Feature messages · Feature-local messages decouple state changes from UI endpoints.
- Game selection
src/Starward/Features/GameSelector/GameSelector.xaml.cs - Game launch orchestration · Coordinates game state, authentication, configuration, and process start.
src/Starward/Features/GameLauncher/GameLauncherService.cs - RPC bridge
src/Starward/Features/RPC/RpcService.cs - Feature data store · Persists gacha, accounts, play time, and related feature data.
src/Starward/Features/Database/DatabaseService.cs - Local game capabilities · Accounts, play time, screenshots, running-game overlays, URL protocol, and gamepad control.
src/Starward/Features/GameAccount/GameAccountService.cs - Update workflow
src/Starward/Features/Update/UpdateService.cs
Core contracts & APIs
- Game identity & registry
src/Starward.Core/GameRegistry.cs - HoYoPlay metadata client
src/Starward.Core/HoYoPlay/HoYoPlayClient.cs - Game record client
src/Starward.Core/GameRecord/GameRecordClient.cs - Gacha log client
src/Starward.Core/Gacha/GachaLogClient.cs - HoYoverse endpoints · HoYoPlay, HoYoLAB, and miHoYo services.
Package worker
- Starward.RPC worker · Isolates privileged and long-running package mutations.
src/Starward.RPC/Program.cs - Named-pipe RPC
src/Starward.RPC/NamedPipesConnectionFactory.cs - Environment & install contracts
src/Starward.RPC/GameInstall/GameInstall.proto - Package workflows · Downloads, verifies, assembles, installs, and uninstalls game packages.
src/Starward.RPC/GameInstall/GameInstallService.cs
Setup & updates
- Setup executable
src/Starward.Setup/Program.cs - Install & delta updates · Applies full downloads and HPatch deltas.
src/Starward.Setup/Services/UpdateService.cs - Release distribution · GitHub Releases, Cloudflare CDN, and SignPath signing.
Connections 21
- Starward app → Service composition: initializes
- Service composition → Main shell & navigation: composes
- Main shell & navigation → Feature messages: routes workflows
- Feature messages → Game selection: updates state
- Game selection → Game identity & registry: selects variant
- HoYoPlay metadata client → Game identity & registry: maps metadata
- HoYoPlay metadata client → HoYoverse endpoints: retrieves metadata
- Game launch orchestration → RPC bridge: requests package operations
- Game launch orchestration → Game identity & registry: uses game identity
- RPC bridge → Named-pipe RPC: connects
- Named-pipe RPC → Starward.RPC worker: hosts local RPC
- Starward.RPC worker → Environment & install contracts: exposes
- Environment & install contracts → Package workflows: drives
- Package workflows → HoYoverse endpoints: downloads packages
- Game record client → HoYoverse endpoints: retrieves records
- Gacha log client → HoYoverse endpoints: acquires logs
- Feature data store → Gacha log client: persists normalized logs
- Local game capabilities → Feature data store: persists feature state
- Update workflow → Setup executable: invokes
- Setup executable → Install & delta updates: runs
- Install & delta updates → Release distribution: fetches releases