Overview
Wine is a compatibility layer that allows running Windows applications on Linux. An Anime Game Launcher automatically manages Wine installation, configuration, and Wine prefix creation to ensure optimal game performance.Wine Installation
Automatic Wine Detection
When the launcher detects that Wine is not installed (LauncherState::WineNotInstalled), it will prompt you to download a compatible Wine version.
Implementation: The Wine download process is handled in src/ui/main/download_wine.rs
Download Process
Check for Downloaded Versions
The launcher first checks if any Wine versions are already downloaded:If found, it automatically selects the first available version and updates the launcher state.
Select Wine Version
If no Wine is downloaded, the launcher determines which version to install:
- Uses
config.game.wine.selectedif specified - Falls back to latest available version via
wine::Version::latest(&CONFIG.components.path)
Progress Tracking
During Wine installation, the launcher displays real-time progress:- Downloading: Shows download progress with percentage and speed
- Unpacking: Displays extraction progress
- Errors: Shows detailed error messages for download or unpacking failures
Wine Configuration
Wine Builds Directory
Location:config.game.wine.builds
This directory stores all downloaded Wine versions. Multiple versions can coexist, allowing you to switch between them.
Selected Wine Version
Configuration:config.game.wine.selected
Stores the name of the currently selected Wine version. This value is automatically set during installation but can be changed in launcher preferences.
Components Path
Configuration:CONFIG.components.path
The components path contains the Wine version index and metadata. The launcher uses this to:
- Query available Wine versions
- Check for updates
- Download new versions
The components index is automatically synchronized from remote servers during launcher startup.
Wine Prefix
A Wine prefix is an isolated Windows environment where the game runs.Prefix Location
Configuration:config.game.wine.prefix
The prefix directory contains:
- Windows registry simulation
- System libraries
- Application data
- DirectX/DXVK files
Prefix Creation
When the launcher detectsLauncherState::PrefixNotExists, it will create a new Wine prefix.
Implementation: src/ui/main/create_prefix.rs
Initialize Prefix
Creates the Wine prefix directory structure:This process may take a minute as Wine sets up the Windows environment.
Prefix creation is a one-time operation. The prefix is reused for all subsequent game launches.
Wine Loader
The launcher usesWineLoader::Current which means:
- Wine is loaded from the configured builds directory
- The prefix is isolated from system Wine installations
- Each game edition can use a different Wine version
DXVK Installation
DXVK is a Vulkan-based implementation of Direct3D that provides better performance than Wine’s built-in DirectX translation.When DXVK is Required
The launcher will prompt for DXVK installation when inLauncherState::DxvkNotInstalled state.
Implementation: src/ui/main/install_dxvk.rs
Installation Process
DXVK Configuration
Builds Directory:config.game.dxvk.builds
Stores downloaded DXVK versions. Like Wine, multiple DXVK versions can be stored.
Install Parameters: InstallParams::default()
Uses default DXVK installation parameters. This can be customized in future versions for advanced users.
Error Handling
The Wine and DXVK installation processes include comprehensive error handling:Wine Download Errors
Wine Selection Errors
DXVK Installation Errors
Components Index Synchronization
The launcher automatically synchronizes the components index on startup to ensure you have access to the latest Wine and DXVK versions. Process:CONFIG.components.servers
Contains a list of component repository URLs. The launcher tries each server until successful.
Component index updates are non-blocking and happen in the background during launcher initialization.
Advanced Configuration
Custom Temp Folder
Both Wine and DXVK downloads respect the configured temp folder:Manual Wine Selection
While the launcher automatically selects Wine versions, you can manually configure:config.game.wine.selected- Name of Wine version to useconfig.game.wine.builds- Directory containing Wine builds
Wine Prefix Management
The Wine prefix can be:- Manually deleted to reset the Windows environment
- Backed up before major game updates
- Shared between different game editions (not recommended)