54 Commits

Author SHA1 Message Date
Novattz
4cf1e2caf4 version bump 2026-01-17 20:49:22 +01:00
Novattz
0ee10d07fc changelog 2026-01-17 20:48:44 +01:00
Novattz
365063d30d fix notifications for smokeapi install 2026-01-17 20:48:15 +01:00
Novattz
61ad3f1d54 fix notifications 2026-01-17 20:30:29 +01:00
Novattz
d3a91f5722 fix conflict detection 2026-01-17 20:30:14 +01:00
Novattz
9ba307f9f8 fix typo ELF magic number check 2026-01-17 20:29:54 +01:00
Novattz
1123012737 install smokeapi native #61 2026-01-17 17:58:14 +01:00
Novattz
7a07399946 cache validation 2026-01-17 17:57:49 +01:00
Novattz
40b9ec9b01 bitness detection 2026-01-17 17:57:17 +01:00
Novattz
05e4275962 unlocker selection styling #61 2026-01-17 17:56:57 +01:00
Novattz
03cae08df1 implement unlocker selection #61 2026-01-17 17:56:46 +01:00
Novattz
6b16ec6168 hook index 2026-01-17 17:56:20 +01:00
Novattz
a786530572 game action hook 2026-01-17 17:56:07 +01:00
Novattz
ef7dfdd6c5 unlocker select hook #61 2026-01-17 17:55:40 +01:00
Novattz
5998e77272 unlocker select dialog #61 2026-01-17 17:55:09 +01:00
Novattz
fab29f5778 change download icon 2026-01-17 17:54:38 +01:00
Novattz
bec190691b universal button 2026-01-17 17:54:04 +01:00
Novattz
58217d61d1 changelog 2026-01-09 20:44:10 +01:00
Novattz
0f4db7bbb7 gitignore 2026-01-09 20:44:02 +01:00
Novattz
22c8f41f93 bump version 2026-01-09 20:41:11 +01:00
Novattz
5ff51d1174 Remove reminder #92 2026-01-09 20:40:35 +01:00
Novattz
169b7d5edd redesign conflict dialog #92 2026-01-09 20:37:55 +01:00
Novattz
41da6731a7 update workflow 2026-01-03 00:37:31 +01:00
Novattz
5f8f389687 version bump 2026-01-03 00:31:25 +01:00
Novattz
1d8422dc65 changelog 2026-01-03 00:31:01 +01:00
Novattz
677e3ef12d disclaimer hook #87 2026-01-03 00:26:23 +01:00
Novattz
33266f3781 index #87 2026-01-03 00:26:00 +01:00
Novattz
9703f21209 disclaimer dialog & styles #87 2026-01-03 00:25:40 +01:00
Novattz
3459158d3f config types #88 2026-01-03 00:24:56 +01:00
Novattz
418b470d4a format 2026-01-03 00:24:23 +01:00
Novattz
fd606cbc2e config manager #88 2026-01-03 00:23:47 +01:00
Tickbase
5845cf9bd8 Update README for clarity and corrections 2026-01-02 19:57:25 +01:00
Tickbase
6294b99a14 Update LICENSE.md 2026-01-01 21:44:50 +01:00
Novattz
595fe53254 version bump & changelog 2025-12-26 22:12:02 +01:00
Novattz
3801404138 index & hook #89 2025-12-26 22:11:44 +01:00
Novattz
919749d0ae conflict & reminder dialogs & styles #89 2025-12-26 22:11:07 +01:00
Novattz
d4ae5d74e9 conflict backend stuff #89 2025-12-26 22:10:34 +01:00
Novattz
7fd3147f44 apperantly not a valid flag 2025-12-23 03:04:47 +01:00
Novattz
87dc328434 changelog 2025-12-23 03:01:42 +01:00
Novattz
b227dff339 version bump 2025-12-23 03:01:28 +01:00
Novattz
04910e84cf Add response if we got any new dlcs or not #64 2025-12-23 02:59:12 +01:00
Novattz
7960019cd9 update creamlinux config #64 2025-12-23 02:42:19 +01:00
Novattz
a00cc92b70 adjust settings dialog 2025-12-23 02:00:09 +01:00
Novattz
85520f8916 add settings button to game cards with smokeapi installed #67 2025-12-23 01:59:53 +01:00
Novattz
ac96e7be69 smokeapi config backend implementation #67 2025-12-23 01:59:06 +01:00
Novattz
3675ff8fae add smokeapi settings dialog & styling #67 2025-12-23 01:58:30 +01:00
Novattz
ab057b8d10 add dropdown component 2025-12-23 01:57:26 +01:00
Novattz
952749cc93 fix depraction warning 2025-12-23 01:56:46 +01:00
Tickbase
4c4e087be7 Merge pull request #86 from Novattz/dependabot/npm_and_yarn/multi-ed0ec66f32
Bump glob and semantic-release
2025-12-22 22:04:41 +01:00
dependabot[bot]
1e52c2071c Bump glob and semantic-release
Bumps [glob](https://github.com/isaacs/node-glob) and [semantic-release](https://github.com/semantic-release/semantic-release). These dependencies needed to be updated together.

Updates `glob` from 11.0.2 to 11.1.0
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v11.0.2...v11.1.0)

Updates `semantic-release` from 24.2.4 to 25.0.2
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](https://github.com/semantic-release/semantic-release/compare/v24.2.4...v25.0.2)

---
updated-dependencies:
- dependency-name: glob
  dependency-version: 11.1.0
  dependency-type: direct:development
- dependency-name: semantic-release
  dependency-version: 25.0.2
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-22 21:04:04 +00:00
Tickbase
fc8c69a915 Merge pull request #85 from Novattz/dependabot/npm_and_yarn/js-yaml-4.1.1
Bump js-yaml from 4.1.0 to 4.1.1
2025-12-22 22:02:31 +01:00
dependabot[bot]
2d7077a05b Bump js-yaml from 4.1.0 to 4.1.1
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 4.1.0 to 4.1.1.
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/4.1.0...4.1.1)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 4.1.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-22 20:52:35 +00:00
Tickbase
081d61afc7 Merge pull request #84 from Novattz/dependabot/npm_and_yarn/vite-6.4.1 2025-12-22 20:32:44 +01:00
dependabot[bot]
0bfd36aea9 Bump vite from 6.3.5 to 6.4.1
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.3.5 to 6.4.1.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/create-vite@6.4.1/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 6.4.1
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-22 19:31:54 +00:00
54 changed files with 4399 additions and 1549 deletions

View File

@@ -142,3 +142,24 @@ jobs:
includeUpdaterJson: true
tauriScript: 'npm run tauri'
args: ${{ matrix.args }}
publish-release:
name: Publish release
needs: [create-release, build-tauri]
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: Publish GitHub release (unset draft)
uses: actions/github-script@v6
with:
script: |
const release_id = Number("${{ needs.create-release.outputs.release_id }}");
await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id,
draft: false
});

1
.gitignore vendored
View File

@@ -14,7 +14,6 @@ docs
*.local
*.lock
.env
CHANGELOG.md
# Editor directories and files
.vscode/*

View File

@@ -1,3 +1,46 @@
## [1.4.0] - 17-01-2026
### Added
- Unlocker selection dialog for native games, allowing users to choose between CreamLinux and SmokeAPI
- Game bitness detection
### Fixed
- Cache now validates if expected files are missing.
## [1.3.5] - 09-01-2026
### Changed
- Redesigned conflict detection dialog to show all conflicts at once
- Integrated Steam launch option reminder directly into the conflict dialog
### Fixed
- Improved UX by allowing users to resolve conflicts in any order or defer to later
## [1.3.4] - 03-01-2026
### Added
- Disclaimer dialog explaining that CreamLinux Installer manages DLC IDs, not actual DLC files
- User config stored in `~/.config/creamlinux/config.json`
- **"Don't show again" option**: Users can permanently dismiss the disclaimer via checkbox
## [1.3.3] - 26-12-2025
### Added
- Platform conflict detection
- Automatic removal of incompatible unlocker files when switching between Native/Proton
- Reminder dialog for steam launch options after creamlinux removal
- Conflict dialog to show which game had the conflict
## [1.3.2] - 23-12-2025
### Added
- New dropdown component
- Settings dialog for SmokeAPI configuration
- Update creamlinux config functionality
### Changed
- Adjusted styling for CreamLinux settings dialog
## [1.3.0] - 22-12-2025
### Added

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2025 Tickbase
Copyright (c) 2026 Tickbase
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,6 +1,6 @@
# CreamLinux
CreamLinux is a GUI application for Linux that simplifies the management of DLC in Steam games. It provides a user-friendly interface to install and configure CreamAPI (for native Linux games) and SmokeAPI (for Windows games running through Proton).
CreamLinux is a GUI application for Linux that simplifies the management of DLC IDs in Steam games. It provides a user-friendly interface to install and configure CreamAPI (for native Linux games) and SmokeAPI (for Windows games running through Proton).
## Watch the demo here:
@@ -61,7 +61,7 @@ While the core functionality is working, please be aware that this is an early r
```bash
git clone https://github.com/Novattz/creamlinux-installer.git
cd creamlinux
cd creamlinux-installer
```
2. Install dependencies:
@@ -124,7 +124,7 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) f
## Credits
- [Creamlinux](https://github.com/anticitizn/creamlinux) - Native DLC support
- [Creamlinux](https://github.com/anticitizn/creamlinux) - Native support
- [SmokeAPI](https://github.com/acidicoala/SmokeAPI) - Proton support
- [Tauri](https://tauri.app/) - Framework for building the desktop application
- [React](https://reactjs.org/) - UI library

2768
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{
"name": "creamlinux",
"private": true,
"version": "1.3.0",
"version": "1.4.0",
"type": "module",
"author": "Tickbase",
"repository": "https://github.com/Novattz/creamlinux-installer",
@@ -40,14 +40,14 @@
"eslint": "^9.22.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.19",
"glob": "^11.0.2",
"glob": "^11.1.0",
"globals": "^16.0.0",
"node-fetch": "^3.3.2",
"sass-embedded": "^1.86.3",
"semantic-release": "^24.2.4",
"semantic-release": "^25.0.2",
"typescript": "~5.7.2",
"typescript-eslint": "^8.26.1",
"vite": "^6.3.5",
"vite": "^6.4.1",
"vite-plugin-svgr": "^4.3.0"
}
}

View File

@@ -1,6 +1,6 @@
[package]
name = "creamlinux-installer"
version = "1.3.0"
version = "1.4.0"
description = "DLC Manager for Steam games on Linux"
authors = ["tickbase"]
license = "MIT"

View File

@@ -2,9 +2,10 @@ mod storage;
mod version;
pub use storage::{
get_creamlinux_version_dir, get_smokeapi_version_dir, is_cache_initialized,
list_creamlinux_files, list_smokeapi_dlls, read_versions, update_creamlinux_version,
update_smokeapi_version,
get_creamlinux_version_dir, get_smokeapi_version_dir,
list_creamlinux_files, list_smokeapi_files, read_versions,
update_creamlinux_version, update_smokeapi_version, validate_smokeapi_cache,
validate_creamlinux_cache,
};
pub use version::{
@@ -22,39 +23,87 @@ use std::collections::HashMap;
pub async fn initialize_cache() -> Result<(), String> {
info!("Initializing cache...");
// Check if cache is already initialized
if is_cache_initialized()? {
info!("Cache already initialized");
return Ok(());
let versions = read_versions()?;
let mut needs_smokeapi = false;
let mut needs_creamlinux = false;
// Check if SmokeAPI is properly cached
if versions.smokeapi.latest.is_empty() {
info!("No SmokeAPI version in manifest");
needs_smokeapi = true
} else {
// Validate that all files exist
match validate_smokeapi_cache(&versions.smokeapi.latest) {
Ok(true) => {
info!("SmokeAPI cache validated successfully");
}
Ok(false) => {
info!("SmokeAPI cache incomplete, re-downloading");
needs_smokeapi = true;
}
Err(e) => {
warn!("Failed to validate SmokeAPI cache: {}, re-downloading", e);
needs_smokeapi = true;
}
}
}
info!("Cache not initialized, downloading unlockers...");
// Check if CreamLinux is properly cached
if versions.creamlinux.latest.is_empty() {
info!("No CreamLinux version in manifest");
needs_creamlinux = true;
} else {
match validate_creamlinux_cache(&versions.creamlinux.latest) {
Ok(true) => {
info!("CreamLinux cache validated successfully");
}
Ok(false) => {
info!("CreamLinux cache incomplete, re-downloading");
needs_creamlinux = true;
}
Err(e) => {
warn!("Failed to validate CreamLinux cache: {}, re-downloading", e);
needs_creamlinux = true;
}
}
}
// Download SmokeAPI
match SmokeAPI::download_to_cache().await {
Ok(version) => {
info!("Downloaded SmokeAPI version: {}", version);
update_smokeapi_version(&version)?;
}
Err(e) => {
error!("Failed to download SmokeAPI: {}", e);
return Err(format!("Failed to download SmokeAPI: {}", e));
if needs_smokeapi {
info!("Downloading SmokeAPI...");
match SmokeAPI::download_to_cache().await {
Ok(version) => {
info!("Downloaded SmokeAPI version: {}", version);
update_smokeapi_version(&version)?;
}
Err(e) => {
error!("Failed to download SmokeAPI: {}", e);
return Err(format!("Failed to download SmokeAPI: {}", e));
}
}
}
// Download CreamLinux
match CreamLinux::download_to_cache().await {
Ok(version) => {
info!("Downloaded CreamLinux version: {}", version);
update_creamlinux_version(&version)?;
}
Err(e) => {
error!("Failed to download CreamLinux: {}", e);
return Err(format!("Failed to download CreamLinux: {}", e));
if needs_creamlinux {
info!("Downloading CreamLinux...");
match CreamLinux::download_to_cache().await {
Ok(version) => {
info!("Downloaded CreamLinux version: {}", version);
update_creamlinux_version(&version)?;
}
Err(e) => {
error!("Failed to download CreamLinux: {}", e);
return Err(format!("Failed to download CreamLinux: {}", e));
}
}
}
info!("Cache initialization complete");
if !needs_smokeapi && !needs_creamlinux {
info!("Cache already initialized and validated");
} else {
info!("Cache initialization complete");
}
Ok(())
}

View File

@@ -204,12 +204,6 @@ pub fn update_creamlinux_version(new_version: &str) -> Result<(), String> {
Ok(())
}
// Check if the cache is initialized (has both unlockers cached)
pub fn is_cache_initialized() -> Result<bool, String> {
let versions = read_versions()?;
Ok(!versions.smokeapi.latest.is_empty() && !versions.creamlinux.latest.is_empty())
}
// Get the SmokeAPI DLL path for the latest cached version
#[allow(dead_code)]
pub fn get_smokeapi_dll_path() -> Result<PathBuf, String> {
@@ -233,8 +227,8 @@ pub fn get_creamlinux_files_dir() -> Result<PathBuf, String> {
get_creamlinux_version_dir(&versions.creamlinux.latest)
}
// List all SmokeAPI DLL files in the cached version directory
pub fn list_smokeapi_dlls() -> Result<Vec<PathBuf>, String> {
/// List all SmokeAPI files in the cached version directory
pub fn list_smokeapi_files() -> Result<Vec<PathBuf>, String> {
let versions = read_versions()?;
if versions.smokeapi.latest.is_empty() {
return Ok(Vec::new());
@@ -249,17 +243,20 @@ pub fn list_smokeapi_dlls() -> Result<Vec<PathBuf>, String> {
let entries = fs::read_dir(&version_dir)
.map_err(|e| format!("Failed to read SmokeAPI directory: {}", e))?;
let mut dlls = Vec::new();
let mut files = Vec::new();
for entry in entries {
if let Ok(entry) = entry {
let path = entry.path();
if path.extension().and_then(|s| s.to_str()) == Some("dll") {
dlls.push(path);
// Get both .dll and .so files
if let Some(ext) = path.extension().and_then(|s| s.to_str()) {
if ext == "dll" || ext == "so" {
files.push(path);
}
}
}
}
Ok(dlls)
Ok(files)
}
// List all CreamLinux files in the cached version directory
@@ -289,4 +286,70 @@ pub fn list_creamlinux_files() -> Result<Vec<PathBuf>, String> {
}
Ok(files)
}
/// Validate that all required files exist for SmokeAPI
pub fn validate_smokeapi_cache(version: &str) -> Result<bool, String> {
let version_dir = get_smokeapi_version_dir(version)?;
if !version_dir.exists() {
return Ok(false);
}
// Required files for SmokeAPI
let required_files = vec![
"smoke_api32.dll",
"smoke_api64.dll",
"libsmoke_api32.so",
"libsmoke_api64.so",
];
let mut missing_files = Vec::new();
for file in &required_files {
let file_path = version_dir.join(file);
if !file_path.exists() {
missing_files.push(file.to_string());
}
}
if !missing_files.is_empty() {
info!("Missing required files in cache: {:?}", missing_files);
return Ok(false);
}
Ok(true)
}
/// Validate that all required files exist for CreamLinux
pub fn validate_creamlinux_cache(version: &str) -> Result<bool, String> {
let version_dir = get_creamlinux_version_dir(version)?;
if !version_dir.exists() {
return Ok(false);
}
// Required files for CreamLinux
let required_files = vec![
"cream.sh",
"cream_api.ini",
"lib32Creamlinux.so",
"lib64Creamlinux.so",
];
let mut missing_files = Vec::new();
for file in &required_files {
let file_path = version_dir.join(file);
if !file_path.exists() {
missing_files.push(file.to_string());
}
}
if !missing_files.is_empty() {
info!("Missing required files in cache: {:?}", missing_files);
return Ok(false);
}
Ok(true)
}

118
src-tauri/src/config.rs Normal file
View File

@@ -0,0 +1,118 @@
use serde::{Deserialize, Serialize};
use std::fs;
use std::path::PathBuf;
use log::info;
// User configuration structure
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Config {
// Whether to show the disclaimer on startup
pub show_disclaimer: bool,
}
impl Default for Config {
fn default() -> Self {
Self {
show_disclaimer: true,
}
}
}
// Get the config directory path (~/.config/creamlinux)
fn get_config_dir() -> Result<PathBuf, String> {
let home = std::env::var("HOME")
.map_err(|_| "Failed to get HOME directory".to_string())?;
let config_dir = PathBuf::from(home).join(".config").join("creamlinux");
Ok(config_dir)
}
// Get the config file path
fn get_config_path() -> Result<PathBuf, String> {
let config_dir = get_config_dir()?;
Ok(config_dir.join("config.json"))
}
// Ensure the config directory exists
fn ensure_config_dir() -> Result<(), String> {
let config_dir = get_config_dir()?;
if !config_dir.exists() {
fs::create_dir_all(&config_dir)
.map_err(|e| format!("Failed to create config directory: {}", e))?;
info!("Created config directory at {:?}", config_dir);
}
Ok(())
}
// Load configuration from disk
pub fn load_config() -> Result<Config, String> {
ensure_config_dir()?;
let config_path = get_config_path()?;
// If config file doesn't exist, create default config
if !config_path.exists() {
let default_config = Config::default();
save_config(&default_config)?;
info!("Created default config file at {:?}", config_path);
return Ok(default_config);
}
// Read and parse config file
let config_str = fs::read_to_string(&config_path)
.map_err(|e| format!("Failed to read config file: {}", e))?;
let config: Config = serde_json::from_str(&config_str)
.map_err(|e| format!("Failed to parse config file: {}", e))?;
info!("Loaded config from {:?}", config_path);
Ok(config)
}
// Save configuration to disk
pub fn save_config(config: &Config) -> Result<(), String> {
ensure_config_dir()?;
let config_path = get_config_path()?;
let config_str = serde_json::to_string_pretty(config)
.map_err(|e| format!("Failed to serialize config: {}", e))?;
fs::write(&config_path, config_str)
.map_err(|e| format!("Failed to write config file: {}", e))?;
info!("Saved config to {:?}", config_path);
Ok(())
}
// Update a specific config value
pub fn update_config<F>(updater: F) -> Result<Config, String>
where
F: FnOnce(&mut Config),
{
let mut config = load_config()?;
updater(&mut config);
save_config(&config)?;
Ok(config)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_default_config() {
let config = Config::default();
assert!(config.show_disclaimer);
}
#[test]
fn test_config_serialization() {
let config = Config::default();
let json = serde_json::to_string(&config).unwrap();
let parsed: Config = serde_json::from_str(&json).unwrap();
assert_eq!(config.show_disclaimer, parsed.show_disclaimer);
}
}

View File

@@ -241,8 +241,26 @@ async fn uninstall_creamlinux(game: Game, app_handle: AppHandle) -> Result<(), S
Ok(())
}
// Install SmokeAPI to a game
async fn install_smokeapi(game: Game, app_handle: AppHandle) -> Result<(), String> {
// Check if native or proton and route accordingly
if game.native {
install_smokeapi_native(game, app_handle).await
} else {
install_smokeapi_proton(game, app_handle).await
}
}
async fn uninstall_smokeapi(game: Game, app_handle: AppHandle) -> Result<(), String> {
// Check if native or proton and route accordingly
if game.native {
uninstall_smokeapi_native(game, app_handle).await
} else {
uninstall_smokeapi_proton(game, app_handle).await
}
}
// Install SmokeAPI to a proton game
async fn install_smokeapi_proton(game: Game, app_handle: AppHandle) -> Result<(), String> {
if game.native {
return Err("SmokeAPI can only be installed on Proton/Windows games".to_string());
}
@@ -286,8 +304,8 @@ async fn install_smokeapi(game: Game, app_handle: AppHandle) -> Result<(), Strin
Ok(())
}
// Uninstall SmokeAPI from a game
async fn uninstall_smokeapi(game: Game, app_handle: AppHandle) -> Result<(), String> {
// Uninstall SmokeAPI from a proton game
async fn uninstall_smokeapi_proton(game: Game, app_handle: AppHandle) -> Result<(), String> {
if game.native {
return Err("SmokeAPI can only be uninstalled from Proton/Windows games".to_string());
}
@@ -329,6 +347,99 @@ async fn uninstall_smokeapi(game: Game, app_handle: AppHandle) -> Result<(), Str
Ok(())
}
// Install SmokeAPI to a native Linux game
async fn install_smokeapi_native(
game: Game,
app_handle: AppHandle,
) -> Result<(), String> {
info!("Installing SmokeAPI (native) for game: {}", game.title);
let game_title = game.title.clone();
emit_progress(
&app_handle,
&format!("Installing SmokeAPI for {}", game_title),
"Detecting game architecture...",
20.0,
false,
false,
None,
);
emit_progress(
&app_handle,
&format!("Installing SmokeAPI for {}", game_title),
"Installing from cache...",
50.0,
false,
false,
None,
);
// Install SmokeAPI for native Linux (empty string for api_files_str)
SmokeAPI::install_to_game(&game.path, "")
.await
.map_err(|e| format!("Failed to install SmokeAPI: {}", e))?;
// Update version manifest
let cached_versions = crate::cache::read_versions()?;
update_game_smokeapi_version(&game.path, cached_versions.smokeapi.latest)?;
emit_progress(
&app_handle,
&format!("Installation Completed: {}", game_title),
"SmokeAPI has been installed successfully!",
100.0,
true,
false,
None,
);
info!("SmokeAPI (native) installation completed for: {}", game_title);
Ok(())
}
// Uninstall SmokeAPI from a native Linux game
async fn uninstall_smokeapi_native(game: Game, app_handle: AppHandle) -> Result<(), String> {
if !game.native {
return Err("This function is only for native Linux games".to_string());
}
let game_title = game.title.clone();
info!("Uninstalling SmokeAPI (native) from game: {}", game_title);
emit_progress(
&app_handle,
&format!("Uninstalling SmokeAPI from {}", game_title),
"Removing SmokeAPI files...",
50.0,
false,
false,
None,
);
// Uninstall SmokeAPI (empty string for api_files_str)
SmokeAPI::uninstall_from_game(&game.path, "")
.await
.map_err(|e| format!("Failed to uninstall SmokeAPI: {}", e))?;
// Remove version from manifest
remove_smokeapi_version(&game.path)?;
emit_progress(
&app_handle,
&format!("Uninstallation Completed: {}", game_title),
"SmokeAPI has been removed successfully!",
100.0,
true,
false,
None,
);
info!("SmokeAPI (native) uninstallation completed for: {}", game_title);
Ok(())
}
// Fetch DLC details from Steam API (simple version without progress)
pub async fn fetch_dlc_details(app_id: &str) -> Result<Vec<DlcInfo>, String> {
let client = reqwest::Client::new();

View File

@@ -4,11 +4,16 @@
)]
mod cache;
mod utils;
mod dlc_manager;
mod installer;
mod searcher;
mod unlockers;
mod smokeapi_config;
mod config;
use crate::config::Config;
use crate::unlockers::{CreamLinux, SmokeAPI, Unlocker};
use dlc_manager::DlcInfoWithState;
use installer::{Game, InstallerAction, InstallerType};
use log::{debug, error, info, warn};
@@ -44,6 +49,19 @@ pub struct AppState {
fetch_cancellation: Arc<AtomicBool>,
}
// Load the current configuration
#[tauri::command]
fn load_config() -> Result<Config, String> {
config::load_config()
}
// Update configuration
#[tauri::command]
fn update_config(config_data: Config) -> Result<Config, String> {
config::save_config(&config_data)?;
Ok(config_data)
}
#[tauri::command]
fn get_all_dlcs_command(game_path: String) -> Result<Vec<DlcInfoWithState>, String> {
info!("Getting all DLCs (enabled and disabled) for: {}", game_path);
@@ -434,6 +452,167 @@ async fn install_cream_with_dlcs_command(
}
}
#[tauri::command]
fn read_smokeapi_config(game_path: String) -> Result<Option<smokeapi_config::SmokeAPIConfig>, String> {
info!("Reading SmokeAPI config for: {}", game_path);
smokeapi_config::read_config(&game_path)
}
#[tauri::command]
fn write_smokeapi_config(
game_path: String,
config: smokeapi_config::SmokeAPIConfig,
) -> Result<(), String> {
info!("Writing SmokeAPI config for: {}", game_path);
smokeapi_config::write_config(&game_path, &config)
}
#[tauri::command]
fn delete_smokeapi_config(game_path: String) -> Result<(), String> {
info!("Deleting SmokeAPI config for: {}", game_path);
smokeapi_config::delete_config(&game_path)
}
#[tauri::command]
async fn resolve_platform_conflict(
game_id: String,
conflict_type: String, // "cream-to-proton" or "smoke-to-native"
state: State<'_, AppState>,
app_handle: tauri::AppHandle,
) -> Result<Game, String> {
info!(
"Resolving platform conflict for game {}: {}",
game_id, conflict_type
);
let game = {
let games = state.games.lock();
games
.get(&game_id)
.cloned()
.ok_or_else(|| format!("Game with ID {} not found", game_id))?
};
let game_title = game.title.clone();
// Emit progress
installer::emit_progress(
&app_handle,
&format!("Resolving Conflict: {}", game_title),
"Removing conflicting files...",
50.0,
false,
false,
None,
);
// Perform the appropriate removal based on conflict type
match conflict_type.as_str() {
"cream-to-proton" => {
// Remove CreamLinux files (bypassing native check)
info!("Removing CreamLinux files from Proton game: {}", game_title);
CreamLinux::uninstall_from_game(&game.path, &game.id)
.await
.map_err(|e| format!("Failed to remove CreamLinux files: {}", e))?;
// Remove version from manifest
crate::cache::remove_creamlinux_version(&game.path)?;
}
"smoke-to-native" => {
// Remove SmokeAPI files (bypassing proton check)
info!("Removing SmokeAPI files from native game: {}", game_title);
// For native games, we need to manually remove backup files since
// the main DLL might already be gone
// Look for and remove *_o.dll backup files
use walkdir::WalkDir;
let mut removed_files = false;
for entry in WalkDir::new(&game.path)
.max_depth(5)
.into_iter()
.filter_map(Result::ok)
{
let path = entry.path();
if !path.is_file() {
continue;
}
let filename = path.file_name().unwrap_or_default().to_string_lossy();
// Remove steam_api*_o.dll backup files
if filename.starts_with("steam_api") && filename.ends_with("_o.dll") {
match std::fs::remove_file(path) {
Ok(_) => {
info!("Removed SmokeAPI backup file: {}", path.display());
removed_files = true;
}
Err(e) => {
warn!("Failed to remove backup file {}: {}", path.display(), e);
}
}
}
}
// Also try the normal uninstall if api_files are present
if !game.api_files.is_empty() {
let api_files_str = game.api_files.join(",");
if let Err(e) = SmokeAPI::uninstall_from_game(&game.path, &api_files_str).await {
// Don't fail if this errors - we might have already cleaned up manually above
warn!("SmokeAPI uninstall warning: {}", e);
}
}
if !removed_files {
warn!("No SmokeAPI files found to remove for: {}", game_title);
}
// Remove version from manifest
crate::cache::remove_smokeapi_version(&game.path)?;
}
_ => return Err(format!("Invalid conflict type: {}", conflict_type)),
}
installer::emit_progress(
&app_handle,
&format!("Conflict Resolved: {}", game_title),
"Conflicting files have been removed successfully!",
100.0,
true,
false,
None,
);
// Update game state
let updated_game = {
let mut games_map = state.games.lock();
let game = games_map
.get_mut(&game_id)
.ok_or_else(|| format!("Game with ID {} not found after conflict resolution", game_id))?;
match conflict_type.as_str() {
"cream-to-proton" => {
game.cream_installed = false;
}
"smoke-to-native" => {
game.smoke_installed = false;
}
_ => {}
}
game.installing = false;
game.clone()
};
if let Err(e) = app_handle.emit("game-updated", &updated_game) {
warn!("Failed to emit game-updated event: {}", e);
}
info!("Platform conflict resolved successfully for: {}", game_title);
Ok(updated_game)
}
fn setup_logging() -> Result<(), Box<dyn std::error::Error>> {
use log::LevelFilter;
use log4rs::append::file::FileAppender;
@@ -491,6 +670,12 @@ fn main() {
get_all_dlcs_command,
clear_caches,
abort_dlc_fetch,
read_smokeapi_config,
write_smokeapi_config,
delete_smokeapi_config,
resolve_platform_conflict,
load_config,
update_config,
])
.setup(|app| {
info!("Tauri application setup");

View File

@@ -256,22 +256,62 @@ fn check_creamlinux_installed(game_path: &Path) -> bool {
// Check if a game has SmokeAPI installed
fn check_smokeapi_installed(game_path: &Path, api_files: &[String]) -> bool {
if api_files.is_empty() {
return false;
// For Proton games: check for backup DLL files
if !api_files.is_empty() {
for api_file in api_files {
let api_path = game_path.join(api_file);
let api_dir = api_path.parent().unwrap_or(game_path);
let api_filename = api_path.file_name().unwrap_or_default();
// Check for backup file (original file renamed with _o.dll suffix)
let backup_name = api_filename.to_string_lossy().replace(".dll", "_o.dll");
let backup_path = api_dir.join(backup_name);
if backup_path.exists() {
debug!("SmokeAPI backup file found: {}", backup_path.display());
return true;
}
}
}
// SmokeAPI creates backups with _o.dll suffix
for api_file in api_files {
let api_path = game_path.join(api_file);
let api_dir = api_path.parent().unwrap_or(game_path);
let api_filename = api_path.file_name().unwrap_or_default();
// For Native games: check for lib_steam_api_o.so backup
for entry in WalkDir::new(game_path)
.max_depth(3)
.into_iter()
.filter_map(Result::ok)
{
let path = entry.path();
if !path.is_file() {
continue;
}
// Check for backup file (original file renamed with _o.dll suffix)
let backup_name = api_filename.to_string_lossy().replace(".dll", "_o.dll");
let backup_path = api_dir.join(backup_name);
let filename = path.file_name().unwrap_or_default().to_string_lossy();
if backup_path.exists() {
debug!("SmokeAPI backup file found: {}", backup_path.display());
// Check for native SmokeAPI backup
if filename == "libsteam_api_o.so" {
debug!("Found native SmokeAPI backup: {}", path.display());
return true;
}
}
// Also scan for orphaned backup files (in case the main DLL was removed)
// This handles the Proton->Native switch case where steam_api*.dll is gone
// but steam_api*_o.dll backup remains
for entry in WalkDir::new(game_path)
.max_depth(5)
.into_iter()
.filter_map(Result::ok)
{
let path = entry.path();
if !path.is_file() {
continue;
}
let filename = path.file_name().unwrap_or_default().to_string_lossy();
// Look for steam_api*_o.dll backup files (SmokeAPI pattern)
if filename.starts_with("steam_api") && filename.ends_with("_o.dll") {
debug!("Found orphaned SmokeAPI backup file: {}", path.display());
return true;
}
}
@@ -631,12 +671,10 @@ pub async fn find_installed_games(steamapps_paths: &[PathBuf]) -> Vec<GameInfo>
// Check for CreamLinux installation
let cream_installed = check_creamlinux_installed(&game_path);
// Check for SmokeAPI installation (only for non-native games with Steam API DLLs)
let smoke_installed = if !is_native && !api_files.is_empty() {
check_smokeapi_installed(&game_path, &api_files)
} else {
false
};
// Check for SmokeAPI installation
// For Proton games: check if api_files exist
// For Native games: ALSO check for orphaned backup files (proton->native switch)
let smoke_installed = check_smokeapi_installed(&game_path, &api_files);
// Create the game info
let game_info = GameInfo {

View File

@@ -0,0 +1,128 @@
use log::{info, warn};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::fs;
use std::path::Path;
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct SmokeAPIConfig {
#[serde(rename = "$schema")]
pub schema: String,
#[serde(rename = "$version")]
pub version: u32,
pub logging: bool,
pub log_steam_http: bool,
pub default_app_status: String,
pub override_app_status: HashMap<String, String>,
pub override_dlc_status: HashMap<String, String>,
pub auto_inject_inventory: bool,
pub extra_inventory_items: Vec<u32>,
pub extra_dlcs: HashMap<String, serde_json::Value>,
}
impl Default for SmokeAPIConfig {
fn default() -> Self {
Self {
schema: "https://raw.githubusercontent.com/acidicoala/SmokeAPI/refs/tags/v4.0.0/res/SmokeAPI.schema.json".to_string(),
version: 4,
logging: false,
log_steam_http: false,
default_app_status: "unlocked".to_string(),
override_app_status: HashMap::new(),
override_dlc_status: HashMap::new(),
auto_inject_inventory: true,
extra_inventory_items: Vec::new(),
extra_dlcs: HashMap::new(),
}
}
}
// Read SmokeAPI config from a game directory
// Returns None if the config doesn't exist
pub fn read_config(game_path: &str) -> Result<Option<SmokeAPIConfig>, String> {
info!("Reading SmokeAPI config from: {}", game_path);
// Find the SmokeAPI DLL location in the game directory
let config_path = find_smokeapi_config_path(game_path)?;
if !config_path.exists() {
info!("No SmokeAPI config found at: {}", config_path.display());
return Ok(None);
}
let content = fs::read_to_string(&config_path)
.map_err(|e| format!("Failed to read SmokeAPI config: {}", e))?;
let config: SmokeAPIConfig = serde_json::from_str(&content)
.map_err(|e| format!("Failed to parse SmokeAPI config: {}", e))?;
info!("Successfully read SmokeAPI config");
Ok(Some(config))
}
// Write SmokeAPI config to a game directory
pub fn write_config(game_path: &str, config: &SmokeAPIConfig) -> Result<(), String> {
info!("Writing SmokeAPI config to: {}", game_path);
let config_path = find_smokeapi_config_path(game_path)?;
let content = serde_json::to_string_pretty(config)
.map_err(|e| format!("Failed to serialize SmokeAPI config: {}", e))?;
fs::write(&config_path, content)
.map_err(|e| format!("Failed to write SmokeAPI config: {}", e))?;
info!("Successfully wrote SmokeAPI config to: {}", config_path.display());
Ok(())
}
// Delete SmokeAPI config from a game directory
pub fn delete_config(game_path: &str) -> Result<(), String> {
info!("Deleting SmokeAPI config from: {}", game_path);
let config_path = find_smokeapi_config_path(game_path)?;
if config_path.exists() {
fs::remove_file(&config_path)
.map_err(|e| format!("Failed to delete SmokeAPI config: {}", e))?;
info!("Successfully deleted SmokeAPI config");
} else {
info!("No SmokeAPI config to delete");
}
Ok(())
}
// Find the path where SmokeAPI.config.json should be located
// This is in the same directory as the SmokeAPI DLL files
fn find_smokeapi_config_path(game_path: &str) -> Result<std::path::PathBuf, String> {
let game_path_obj = Path::new(game_path);
// Search for steam_api*.dll files with _o.dll backups (indicating SmokeAPI installation)
let mut smokeapi_dir: Option<std::path::PathBuf> = None;
// Use walkdir to search recursively
for entry in walkdir::WalkDir::new(game_path_obj)
.max_depth(5)
.into_iter()
.filter_map(Result::ok)
{
let path = entry.path();
let filename = path.file_name().unwrap_or_default().to_string_lossy();
// Look for steam_api*_o.dll (backup files created by SmokeAPI)
if filename.starts_with("steam_api") && filename.ends_with("_o.dll") {
smokeapi_dir = path.parent().map(|p| p.to_path_buf());
break;
}
}
// If we found a SmokeAPI directory, return the config path
if let Some(dir) = smokeapi_dir {
Ok(dir.join("SmokeAPI.config.json"))
} else {
// Fallback to game root directory
warn!("Could not find SmokeAPI DLL directory, using game root");
Ok(game_path_obj.join("SmokeAPI.config.json"))
}
}

View File

@@ -94,7 +94,7 @@ impl Unlocker for SmokeAPI {
let mut archive =
ZipArchive::new(file).map_err(|e| format!("Failed to read zip archive: {}", e))?;
// Extract all DLL files
// Extract both DLL files (for Proton) and .so files (for native Linux)
for i in 0..archive.len() {
let mut file = archive
.by_index(i)
@@ -102,8 +102,11 @@ impl Unlocker for SmokeAPI {
let file_name = file.name();
// Only extract DLL files
if file_name.to_lowercase().ends_with(".dll") {
// Extract DLL files for Proton and .so files for native Linux
let should_extract = file_name.to_lowercase().ends_with(".dll")
|| file_name.to_lowercase().ends_with(".so");
if should_extract {
let output_path = version_dir.join(
Path::new(file_name)
.file_name()
@@ -127,17 +130,56 @@ impl Unlocker for SmokeAPI {
}
async fn install_to_game(game_path: &str, api_files_str: &str) -> Result<(), String> {
// Check if this is a native Linux game or Proton game
// Native games have empty api_files_str, Proton games have DLL paths
let is_native = api_files_str.is_empty();
if is_native {
Self::install_to_native_game(game_path).await
} else {
Self::install_to_proton_game(game_path, api_files_str).await
}
}
async fn uninstall_from_game(game_path: &str, api_files_str: &str) -> Result<(), String> {
// Check if this is a native Linux game or Proton game
let is_native = api_files_str.is_empty();
if is_native {
Self::uninstall_from_native_game(game_path).await
} else {
Self::uninstall_from_proton_game(game_path, api_files_str).await
}
}
fn name() -> &'static str {
"SmokeAPI"
}
}
impl SmokeAPI {
/// Install SmokeAPI to a Proton/Windows game
async fn install_to_proton_game(game_path: &str, api_files_str: &str) -> Result<(), String> {
// Parse api_files from the context string (comma-separated)
let api_files: Vec<String> = api_files_str.split(',').map(|s| s.to_string()).collect();
info!(
"Installing SmokeAPI to {} for {} API files",
"Installing SmokeAPI (Proton) to {} for {} API files",
game_path,
api_files.len()
);
// Get the cached SmokeAPI DLLs
let cached_dlls = crate::cache::list_smokeapi_dlls()?;
let cached_files = crate::cache::list_smokeapi_files()?;
if cached_files.is_empty() {
return Err("No SmokeAPI files found in cache".to_string());
}
let cached_dlls: Vec<_> = cached_files
.iter()
.filter(|f| f.extension().and_then(|e| e.to_str()) == Some("dll"))
.collect();
if cached_dlls.is_empty() {
return Err("No SmokeAPI DLLs found in cache".to_string());
}
@@ -195,15 +237,77 @@ impl Unlocker for SmokeAPI {
);
}
info!("SmokeAPI installation completed for: {}", game_path);
info!("SmokeAPI (Proton) installation completed for: {}", game_path);
Ok(())
}
async fn uninstall_from_game(game_path: &str, api_files_str: &str) -> Result<(), String> {
/// Install SmokeAPI to a native Linux game
async fn install_to_native_game(game_path: &str) -> Result<(), String> {
info!("Installing SmokeAPI (native) to {}", game_path);
// Detect game bitness
let bitness = crate::utils::bitness::detect_game_bitness(game_path)?;
info!("Detected game bitness: {:?}", bitness);
// Get the cached SmokeAPI files
let cached_files = crate::cache::list_smokeapi_files()?;
if cached_files.is_empty() {
return Err("No SmokeAPI files found in cache".to_string());
}
// Determine which .so file to use based on bitness
let target_so = match bitness {
crate::utils::bitness::Bitness::Bit32 => "libsmoke_api32.so",
crate::utils::bitness::Bitness::Bit64 => "libsmoke_api64.so",
};
// Find the matching .so file in cache
let matching_so = cached_files
.iter()
.find(|file| {
file.file_name()
.unwrap_or_default()
.to_string_lossy()
== target_so
})
.ok_or_else(|| format!("No matching {} found in cache", target_so))?;
let game_path_obj = Path::new(game_path);
// Look for libsteam_api.so in the game directory (scan up to depth 3)
let libsteam_path = Self::find_libsteam_api(game_path_obj)?;
info!("Found libsteam_api.so at: {}", libsteam_path.display());
// Create backup of original libsteam_api.so
let backup_path = libsteam_path.with_file_name("libsteam_api_o.so");
// Only backup if not already backed up
if !backup_path.exists() && libsteam_path.exists() {
fs::copy(&libsteam_path, &backup_path)
.map_err(|e| format!("Failed to backup libsteam_api.so: {}", e))?;
info!("Created backup: {}", backup_path.display());
}
// Replace libsteam_api.so with SmokeAPI's libsmoke_api.so
fs::copy(matching_so, &libsteam_path)
.map_err(|e| format!("Failed to replace libsteam_api.so: {}", e))?;
info!(
"Replaced libsteam_api.so with {}",
target_so
);
info!("SmokeAPI (native) installation completed for: {}", game_path);
Ok(())
}
/// Uninstall SmokeAPI from a Proton/Windows game
async fn uninstall_from_proton_game(game_path: &str, api_files_str: &str) -> Result<(), String> {
// Parse api_files from the context string (comma-separated)
let api_files: Vec<String> = api_files_str.split(',').map(|s| s.to_string()).collect();
info!("Uninstalling SmokeAPI from: {}", game_path);
info!("Uninstalling SmokeAPI (Proton) from: {}", game_path);
for api_file in &api_files {
let api_path = Path::new(game_path).join(api_file);
@@ -250,11 +354,79 @@ impl Unlocker for SmokeAPI {
}
}
info!("SmokeAPI uninstallation completed for: {}", game_path);
info!("SmokeAPI (Proton) uninstallation completed for: {}", game_path);
Ok(())
}
fn name() -> &'static str {
"SmokeAPI"
/// Uninstall SmokeAPI from a native Linux game
async fn uninstall_from_native_game(game_path: &str) -> Result<(), String> {
info!("Uninstalling SmokeAPI (native) from: {}", game_path);
let game_path_obj = Path::new(game_path);
// Look for libsteam_api.so (which is actually our SmokeAPI now)
let libsteam_path = match Self::find_libsteam_api(game_path_obj) {
Ok(path) => path,
Err(_) => {
warn!("libsteam_api.so not found, nothing to uninstall");
return Ok(());
}
};
// Look for backup
let backup_path = libsteam_path.with_file_name("libsteam_api_o.so");
if backup_path.exists() {
// Remove the SmokeAPI version
if libsteam_path.exists() {
match fs::remove_file(&libsteam_path) {
Ok(_) => info!("Removed SmokeAPI version: {}", libsteam_path.display()),
Err(e) => warn!("Failed to remove SmokeAPI file: {}", e),
}
}
// Restore the original file
match fs::rename(&backup_path, &libsteam_path) {
Ok(_) => info!("Restored original libsteam_api.so"),
Err(e) => {
warn!("Failed to restore original file: {}", e);
// Try to copy instead if rename fails
if let Err(copy_err) = fs::copy(&backup_path, &libsteam_path)
.and_then(|_| fs::remove_file(&backup_path))
{
error!("Failed to copy backup file: {}", copy_err);
}
}
}
} else {
warn!("No backup found (libsteam_api_o.so), cannot restore original");
}
info!("SmokeAPI (native) uninstallation completed for: {}", game_path);
Ok(())
}
/// Find libsteam_api.so in the game directory
fn find_libsteam_api(game_path: &Path) -> Result<std::path::PathBuf, String> {
use walkdir::WalkDir;
// Scan for libsteam_api.so (not too deep to keep it fast)
for entry in WalkDir::new(game_path)
.max_depth(3)
.into_iter()
.filter_map(Result::ok)
{
let path = entry.path();
if !path.is_file() {
continue;
}
let filename = path.file_name().unwrap_or_default().to_string_lossy();
if filename == "libsteam_api.so" {
return Ok(path.to_path_buf());
}
}
Err("libsteam_api.so not found in game directory".to_string())
}
}

View File

@@ -0,0 +1,155 @@
use log::{debug, info, warn};
use std::fs;
use std::path::Path;
use walkdir::WalkDir;
/// Represents the bitness of a binary
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Bitness {
Bit32,
Bit64,
}
/// Detect the bitness of a Linux Binary by reading ELF header
/// ELF format: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
fn detect_binary_bitness(file_path: &Path) -> Option<Bitness> {
// Read first 5 bytes of the file to check ELF header
let bytes = match fs::read(file_path) {
Ok(b) if b.len() >= 5 => b,
_ => return None,
};
// Check for ELF magic number (0x7F 'E' 'L' 'F')
if bytes.len() < 5 || &bytes[0..4] != b"\x7FELF" {
return None;
}
// Byte 4 (EI_CLASS) indicates 32-bit or 64-bit
// 1 = ELFCLASS32 (32-bit)
// 2 = ELFCLASS64 (64-bit)
match bytes[4] {
1 => Some(Bitness::Bit32),
2 => Some(Bitness::Bit64),
_ => None,
}
}
/// Scan game directory for Linux binaries and determine bitness
/// Returns the detected bitness, prioritizing the main game executable
pub fn detect_game_bitness(game_path: &str) -> Result<Bitness, String> {
info!("Detecting bitness for game at: {}", game_path);
let game_path_obj = Path::new(game_path);
if !game_path_obj.exists() {
return Err("Game path does not exist".to_string());
}
// Directories to skip for performance
let skip_dirs = [
"videos",
"video",
"movies",
"movie",
"sound",
"sounds",
"audio",
"textures",
"music",
"localization",
"shaders",
"logs",
"assets",
"_CommonRedist",
];
// Limit scan depth to avoid deep recursion
const MAX_DEPTH: usize = 5;
let mut bit64_binaries = Vec::new();
let mut bit32_binaries = Vec::new();
// Scan for Linux binaries
for entry in WalkDir::new(game_path_obj)
.max_depth(MAX_DEPTH)
.follow_links(false)
.into_iter()
.filter_entry(|e| {
if e.file_type().is_dir() {
let dir_name = e.file_name().to_string_lossy().to_lowercase();
!skip_dirs.iter().any(|&skip| dir_name.contains(skip))
} else {
true
}
})
.filter_map(Result::ok)
{
let path = entry.path();
// Only check files
if !path.is_file() {
continue;
}
// Skip non-binary files early for performance
let filename = path.file_name().unwrap_or_default().to_string_lossy();
// Check for common Linux executable extensions or shared libraries
let has_binary_extension = filename.ends_with(".x86")
|| filename.ends_with(".x86_64")
|| filename.ends_with(".bin")
|| filename.ends_with(".so")
|| filename.contains(".so.")
|| filename.starts_with("lib");
// Check if file is executable
#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
if let Ok(metadata) = fs::metadata(path) {
let permissions = metadata.permissions();
let is_executable = permissions.mode() & 0o111 != 0;
// Skip files that are neither executable nor have binary extensions
if !is_executable && !has_binary_extension {
continue;
}
} else {
continue;
}
}
// Detect bitness
if let Some(bitness) = detect_binary_bitness(path) {
debug!("Found {:?} binary: {}", bitness, path.display());
match bitness {
Bitness::Bit64 => bit64_binaries.push(path.to_path_buf()),
Bitness::Bit32 => bit32_binaries.push(path.to_path_buf()),
}
}
}
// Decision logic: prioritize finding the main game executable
// 1. If we found any 64-bit binaries and no 32-bit, it's 64-bit
// 2. If we found any 32-bit binaries and no 64-bit, it's 32-bit
// 3. If we found both, prefer 64-bit (modern games are usually 64-bit)
// 4. If we found neither, return an error
if !bit64_binaries.is_empty() && bit32_binaries.is_empty() {
info!("Detected 64-bit game (Only 64-bit binaries found)");
Ok(Bitness::Bit64)
} else if !bit32_binaries.is_empty() && bit64_binaries.is_empty() {
info!("Detected 32-bit game (Only 32-bit binaries found)");
Ok(Bitness::Bit32)
} else if !bit64_binaries.is_empty() && !bit32_binaries.is_empty() {
warn!(
"Found both 32-bit and 64-bit binaries, defaulting to 64-bit. 32-bit: {}, 64-bit: {}",
bit32_binaries.len(),
bit64_binaries.len()
);
info!("Detected 64-bit game (mixed binaries, defaulting to 64-bit)");
Ok(Bitness::Bit64)
} else {
Err("Could not detect game bitness: no Linux binaries found".to_string())
}
}

View File

@@ -0,0 +1 @@
pub mod bitness;

View File

@@ -19,7 +19,7 @@
},
"productName": "Creamlinux",
"mainBinaryName": "creamlinux",
"version": "1.3.0",
"version": "1.4.0",
"identifier": "com.creamlinux.dev",
"app": {
"withGlobalTauri": false,

View File

@@ -1,13 +1,28 @@
import { useState } from 'react'
import { invoke } from '@tauri-apps/api/core'
import { useAppContext } from '@/contexts/useAppContext'
import { useAppLogic } from '@/hooks'
import { useAppLogic, useConflictDetection, useDisclaimer } from '@/hooks'
import './styles/main.scss'
// Layout components
import { Header, Sidebar, InitialLoadingScreen, ErrorBoundary, UpdateScreen, AnimatedBackground } from '@/components/layout'
import {
Header,
Sidebar,
InitialLoadingScreen,
ErrorBoundary,
UpdateScreen,
AnimatedBackground,
} from '@/components/layout'
// Dialog components
import { ProgressDialog, DlcSelectionDialog, SettingsDialog } from '@/components/dialogs'
import {
ProgressDialog,
DlcSelectionDialog,
SettingsDialog,
ConflictDialog,
DisclaimerDialog,
UnlockerSelectionDialog,
} from '@/components/dialogs'
// Game components
import { GameList } from '@/components/games'
@@ -17,6 +32,9 @@ import { GameList } from '@/components/games'
*/
function App() {
const [updateComplete, setUpdateComplete] = useState(false)
const { showDisclaimer, handleDisclaimerClose } = useDisclaimer()
// Get application logic from hook
const {
filter,
@@ -33,6 +51,7 @@ function App() {
// Get action handlers from context
const {
games,
dlcDialog,
handleDlcDialogClose,
handleProgressDialogClose,
@@ -40,11 +59,44 @@ function App() {
handleGameAction,
handleDlcConfirm,
handleGameEdit,
handleUpdateDlcs,
settingsDialog,
handleSettingsOpen,
handleSettingsClose,
handleSmokeAPISettingsOpen,
showToast,
unlockerSelectionDialog,
handleSelectCreamLinux,
handleSelectSmokeAPI,
closeUnlockerDialog,
} = useAppContext()
// Conflict detection
const { conflicts, showDialog, resolveConflict, closeDialog } =
useConflictDetection(games)
// Handle conflict resolution
const handleConflictResolve = async (
gameId: string,
conflictType: 'cream-to-proton' | 'smoke-to-native'
) => {
try {
// Invoke backend to resolve the conflict
await invoke('resolve_platform_conflict', {
gameId,
conflictType,
})
// Remove from UI
resolveConflict(gameId, conflictType)
showToast('Conflict resolved successfully', 'success')
} catch (error) {
console.error('Error resolving conflict:', error)
showToast('Failed to resolve conflict', 'error')
}
}
// Show update screen first
if (!updateComplete) {
return <UpdateScreen onComplete={() => setUpdateComplete(true)} />
@@ -71,7 +123,11 @@ function App() {
<div className="main-content">
{/* Sidebar for filtering */}
<Sidebar setFilter={setFilter} currentFilter={filter} onSettingsClick={handleSettingsOpen} />
<Sidebar
setFilter={setFilter}
currentFilter={filter}
onSettingsClick={handleSettingsOpen}
/>
{/* Show error or game list */}
{error ? (
@@ -86,6 +142,7 @@ function App() {
isLoading={isLoading}
onAction={handleGameAction}
onEdit={handleGameEdit}
onSmokeAPISettings={handleSmokeAPISettingsOpen}
/>
)}
</div>
@@ -105,20 +162,42 @@ function App() {
<DlcSelectionDialog
visible={dlcDialog.visible}
gameTitle={dlcDialog.gameTitle}
gameId={dlcDialog.gameId}
dlcs={dlcDialog.dlcs}
isLoading={dlcDialog.isLoading}
isEditMode={dlcDialog.isEditMode}
isUpdating={dlcDialog.isUpdating}
updateAttempted={dlcDialog.updateAttempted}
loadingProgress={dlcDialog.progress}
estimatedTimeLeft={dlcDialog.timeLeft}
newDlcsCount={dlcDialog.newDlcsCount}
onClose={handleDlcDialogClose}
onConfirm={handleDlcConfirm}
onUpdate={handleUpdateDlcs}
/>
{/* Settings Dialog */}
<SettingsDialog
visible ={settingsDialog.visible}
onClose={handleSettingsClose}
<SettingsDialog visible={settingsDialog.visible} onClose={handleSettingsClose} />
{/* Conflict Detection Dialog */}
<ConflictDialog
visible={showDialog}
conflicts={conflicts}
onResolve={handleConflictResolve}
onClose={closeDialog}
/>
{/* Unlocker Selection Dialog */}
<UnlockerSelectionDialog
visible={unlockerSelectionDialog.visible}
gameTitle={unlockerSelectionDialog.gameTitle || ''}
onClose={closeUnlockerDialog}
onSelectCreamLinux={handleSelectCreamLinux}
onSelectSmokeAPI={handleSelectSmokeAPI}
/>
{/* Disclaimer Dialog - Shows AFTER everything is loaded */}
<DisclaimerDialog visible={showDisclaimer} onClose={handleDisclaimerClose} />
</div>
</ErrorBoundary>
)

View File

@@ -3,7 +3,7 @@ import Button, { ButtonVariant } from '../buttons/Button'
import { Icon, trash, download } from '@/components/icons'
// Define available action types
export type ActionType = 'install_cream' | 'uninstall_cream' | 'install_smoke' | 'uninstall_smoke'
export type ActionType = 'install_cream' | 'uninstall_cream' | 'install_smoke' | 'uninstall_smoke' | 'install_unlocker'
interface ActionButtonProps {
action: ActionType
@@ -18,7 +18,6 @@ interface ActionButtonProps {
* Specialized button for game installation actions
*/
const ActionButton: FC<ActionButtonProps> = ({
action,
isInstalled,
isWorking,
onClick,
@@ -29,10 +28,7 @@ const ActionButton: FC<ActionButtonProps> = ({
const getButtonText = () => {
if (isWorking) return 'Working...'
const isCream = action.includes('cream')
const product = isCream ? 'CreamLinux' : 'SmokeAPI'
return isInstalled ? `Uninstall ${product}` : `Install ${product}`
return isInstalled ? 'Uninstall' : 'Install'
}
// Map to button variant

View File

@@ -0,0 +1,97 @@
import { useState, useRef, useEffect } from 'react'
import { Icon, arrowUp } from '@/components/icons'
export interface DropdownOption<T = string> {
value: T
label: string
}
interface DropdownProps<T = string> {
label: string
description?: string
value: T
options: DropdownOption<T>[]
onChange: (value: T) => void
disabled?: boolean
className?: string
}
/**
* Dropdown component for selecting from a list of options
*/
const Dropdown = <T extends string | number | boolean>({
label,
description,
value,
options,
onChange,
disabled = false,
className = '',
}: DropdownProps<T>) => {
const [isOpen, setIsOpen] = useState(false)
const dropdownRef = useRef<HTMLDivElement>(null)
// Close dropdown when clicking outside
useEffect(() => {
const handleClickOutside = (event: MouseEvent) => {
if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {
setIsOpen(false)
}
}
if (isOpen) {
document.addEventListener('mousedown', handleClickOutside)
return () => document.removeEventListener('mousedown', handleClickOutside)
}
}, [isOpen])
const selectedOption = options.find((opt) => opt.value === value)
const handleSelect = (optionValue: T) => {
onChange(optionValue)
setIsOpen(false)
}
return (
<div className={`dropdown-container ${className}`}>
<div className="dropdown-label-container">
<label className="dropdown-label">{label}</label>
{description && <p className="dropdown-description">{description}</p>}
</div>
<div className={`dropdown ${disabled ? 'disabled' : ''}`} ref={dropdownRef}>
<button
type="button"
className="dropdown-trigger"
onClick={() => !disabled && setIsOpen(!isOpen)}
disabled={disabled}
>
<span className="dropdown-value">{selectedOption?.label || 'Select...'}</span>
<Icon
name={arrowUp}
variant="solid"
size="sm"
className={`dropdown-icon ${isOpen ? 'open' : ''}`}
/>
</button>
{isOpen && !disabled && (
<div className="dropdown-menu">
{options.map((option) => (
<button
key={String(option.value)}
type="button"
className={`dropdown-option ${option.value === value ? 'selected' : ''}`}
onClick={() => handleSelect(option.value)}
>
{option.label}
</button>
))}
</div>
)}
</div>
</div>
)
}
export default Dropdown

View File

@@ -1,4 +1,6 @@
export { default as LoadingIndicator } from './LoadingIndicator'
export { default as ProgressBar } from './ProgressBar'
export { default as Dropdown } from './Dropdown'
export type { LoadingSize, LoadingType } from './LoadingIndicator'
export type { DropdownOption } from './Dropdown'

View File

@@ -0,0 +1,106 @@
import React from 'react'
import {
Dialog,
DialogHeader,
DialogBody,
DialogFooter,
DialogActions,
} from '@/components/dialogs'
import { Button } from '@/components/buttons'
import { Icon, warning, info } from '@/components/icons'
export interface Conflict {
gameId: string
gameTitle: string
type: 'cream-to-proton' | 'smoke-to-native'
}
export interface ConflictDialogProps {
visible: boolean
conflicts: Conflict[]
onResolve: (gameId: string, conflictType: 'cream-to-proton' | 'smoke-to-native') => void
onClose: () => void
}
/**
* Conflict Dialog component
* Shows all conflicts at once with individual resolve buttons
*/
const ConflictDialog: React.FC<ConflictDialogProps> = ({
visible,
conflicts,
onResolve,
onClose,
}) => {
// Check if any CreamLinux conflicts exist
const hasCreamConflicts = conflicts.some((c) => c.type === 'cream-to-proton')
const getConflictDescription = (type: 'cream-to-proton' | 'smoke-to-native') => {
if (type === 'cream-to-proton') {
return 'Will remove existing unlocker files and restore the game to a clean state.'
} else {
return 'Will remove existing unlocker files and restore the game to a clean state.'
}
}
return (
<Dialog visible={visible} size="large" preventBackdropClose={true}>
<DialogHeader hideCloseButton={true}>
<div className="conflict-dialog-header">
<Icon name={warning} variant="solid" size="lg" />
<h3>Unlocker conflicts detected</h3>
</div>
</DialogHeader>
<DialogBody>
<div className="conflict-dialog-body">
<p className="conflict-intro">
Some games have conflicting unlocker states that need attention.
</p>
<div className="conflict-list">
{conflicts.map((conflict) => (
<div key={conflict.gameId} className="conflict-item">
<div className="conflict-info">
<div className="conflict-icon">
<Icon name={warning} variant="solid" size="md" />
</div>
<div className="conflict-details">
<h4>{conflict.gameTitle}</h4>
<p>{getConflictDescription(conflict.type)}</p>
</div>
</div>
<Button
variant="primary"
onClick={() => onResolve(conflict.gameId, conflict.type)}
className="conflict-resolve-btn"
>
Resolve
</Button>
</div>
))}
</div>
</div>
</DialogBody>
<DialogFooter>
{hasCreamConflicts && (
<div className="conflict-reminder">
<Icon name={info} variant="solid" size="md" />
<span>
Remember to remove <code>sh ./cream.sh %command%</code> from Steam launch options
after resolving CreamLinux conflicts.
</span>
</div>
)}
<DialogActions>
<Button variant="secondary" onClick={onClose}>
Close
</Button>
</DialogActions>
</DialogFooter>
</Dialog>
)
}
export default ConflictDialog

View File

@@ -0,0 +1,69 @@
import {
Dialog,
DialogHeader,
DialogBody,
DialogFooter,
DialogActions,
} from '@/components/dialogs'
import { Button, AnimatedCheckbox } from '@/components/buttons'
import { useState } from 'react'
export interface DisclaimerDialogProps {
visible: boolean
onClose: (dontShowAgain: boolean) => void
}
/**
* Disclaimer dialog that appears on app startup
* Informs users that CreamLinux manages DLC IDs, not actual DLC files
*/
const DisclaimerDialog = ({ visible, onClose }: DisclaimerDialogProps) => {
const [dontShowAgain, setDontShowAgain] = useState(false)
const handleOkClick = () => {
onClose(dontShowAgain)
}
return (
<Dialog visible={visible} onClose={() => onClose(false)} size="medium" preventBackdropClose>
<DialogHeader hideCloseButton={true}>
<div className="disclaimer-header">
<h3>Important Notice</h3>
</div>
</DialogHeader>
<DialogBody>
<div className="disclaimer-content">
<p>
<strong>CreamLinux Installer</strong> does not install any DLC content files.
</p>
<p>
This application manages the <strong>DLC IDs</strong> associated with DLCs you want to
use. You must obtain the actual DLC files separately.
</p>
<p>
This tool only configures which DLC IDs are recognized by the game unlockers
(CreamLinux and SmokeAPI).
</p>
</div>
</DialogBody>
<DialogFooter>
<DialogActions>
<div className="disclaimer-footer">
<AnimatedCheckbox
checked={dontShowAgain}
onChange={() => setDontShowAgain(!dontShowAgain)}
label="Don't show this disclaimer again"
/>
<Button variant="primary" onClick={handleOkClick}>
OK
</Button>
</div>
</DialogActions>
</DialogFooter>
</Dialog>
)
}
export default DisclaimerDialog

View File

@@ -6,17 +6,23 @@ import DialogFooter from './DialogFooter'
import DialogActions from './DialogActions'
import { Button, AnimatedCheckbox } from '@/components/buttons'
import { DlcInfo } from '@/types'
import { Icon, check, info } from '@/components/icons'
export interface DlcSelectionDialogProps {
visible: boolean
gameTitle: string
gameId: string
dlcs: DlcInfo[]
onClose: () => void
onConfirm: (selectedDlcs: DlcInfo[]) => void
onUpdate?: (gameId: string) => void
isLoading: boolean
isEditMode?: boolean
isUpdating?: boolean
updateAttempted?: boolean
loadingProgress?: number
estimatedTimeLeft?: string
newDlcsCount?: number
}
/**
@@ -27,13 +33,18 @@ export interface DlcSelectionDialogProps {
const DlcSelectionDialog = ({
visible,
gameTitle,
gameId,
dlcs,
onClose,
onConfirm,
onUpdate,
isLoading,
isEditMode = false,
isUpdating = false,
updateAttempted = false,
loadingProgress = 0,
estimatedTimeLeft = '',
newDlcsCount = 0,
}: DlcSelectionDialogProps) => {
// State for DLC management
const [selectedDlcs, setSelectedDlcs] = useState<DlcInfo[]>([])
@@ -169,13 +180,13 @@ const DlcSelectionDialog = ({
</div>
</div>
{isLoading && loadingProgress > 0 && (
{(isLoading || isUpdating) && loadingProgress > 0 && (
<div className="dlc-loading-progress">
<div className="progress-bar-container">
<div className="progress-bar" style={{ width: `${loadingProgress}%` }} />
</div>
<div className="loading-details">
<span>Loading DLCs: {loadingProgress}%</span>
<span>{isUpdating ? 'Updating DLC list' : 'Loading DLCs'}: {loadingProgress}%</span>
{estimatedTimeLeft && (
<span className="time-left">Est. time left: {estimatedTimeLeft}</span>
)}
@@ -211,15 +222,47 @@ const DlcSelectionDialog = ({
</DialogBody>
<DialogFooter>
{/* Show update results */}
{!isUpdating && !isLoading && isEditMode && updateAttempted && (
<>
{newDlcsCount > 0 && (
<div className="dlc-update-results dlc-update-success">
<span className="update-message">
<Icon name={check} size="md" variant="solid" className="dlc-update-icon-success"/> Found {newDlcsCount} new DLC{newDlcsCount > 1 ? 's' : ''}!
</span>
</div>
)}
{newDlcsCount === 0 && (
<div className="dlc-update-results dlc-update-info">
<span className="update-message">
<Icon name={info} size="md" variant="solid" className="dlc-update-icon-info"/> No new DLCs found. Your list is up to date!
</span>
</div>
)}
</>
)}
<DialogActions>
<Button
variant="secondary"
onClick={onClose}
disabled={isLoading && loadingProgress < 10}
disabled={(isLoading || isUpdating) && loadingProgress < 10}
>
Cancel
</Button>
<Button variant="primary" onClick={handleConfirm} disabled={isLoading}>
{/* Update button - only show in edit mode */}
{isEditMode && onUpdate && (
<Button
variant="warning"
onClick={() => onUpdate(gameId)}
disabled={isLoading || isUpdating}
>
{isUpdating ? 'Updating...' : 'Update DLC List'}
</Button>
)}
<Button variant="primary" onClick={handleConfirm} disabled={isLoading || isUpdating}>
{actionButtonText}
</Button>
</DialogActions>
@@ -228,4 +271,4 @@ const DlcSelectionDialog = ({
)
}
export default DlcSelectionDialog
export default DlcSelectionDialog

View File

@@ -0,0 +1,56 @@
import React from 'react'
import {
Dialog,
DialogHeader,
DialogBody,
DialogFooter,
DialogActions,
} from '@/components/dialogs'
import { Button } from '@/components/buttons'
import { Icon, info } from '@/components/icons'
export interface ReminderDialogProps {
visible: boolean
onClose: () => void
}
/**
* Reminder Dialog component
* Reminds users to remove Steam launch options after removing CreamLinux
*/
const ReminderDialog: React.FC<ReminderDialogProps> = ({ visible, onClose }) => {
return (
<Dialog visible={visible} onClose={onClose} size="small">
<DialogHeader onClose={onClose} hideCloseButton={true}>
<div className="reminder-dialog-header">
<Icon name={info} variant="solid" size="lg" />
<h3>Reminder</h3>
</div>
</DialogHeader>
<DialogBody>
<div className="reminder-dialog-body">
<p>
If you added a Steam launch option for CreamLinux, remember to remove it in Steam:
</p>
<ol className="reminder-steps">
<li>Right-click the game in Steam</li>
<li>Select "Properties"</li>
<li>Go to "Launch Options"</li>
<li>Remove the CreamLinux command</li>
</ol>
</div>
</DialogBody>
<DialogFooter>
<DialogActions>
<Button variant="primary" onClick={onClose}>
Got it
</Button>
</DialogActions>
</DialogFooter>
</Dialog>
)
}
export default ReminderDialog

View File

@@ -41,7 +41,7 @@ const SettingsDialog: React.FC<SettingsDialogProps> = ({ visible, onClose }) =>
<Dialog visible={visible} onClose={onClose} size="medium">
<DialogHeader onClose={onClose} hideCloseButton={true}>
<div className="settings-header">
<Icon name={settings} variant="solid" size="md" />
{/*<Icon name={settings} variant="solid" size="md" />*/}
<h3>Settings</h3>
</div>
</DialogHeader>

View File

@@ -0,0 +1,228 @@
import { useState, useEffect, useCallback } from 'react'
import { invoke } from '@tauri-apps/api/core'
import {
Dialog,
DialogHeader,
DialogBody,
DialogFooter,
DialogActions,
} from '@/components/dialogs'
import { Button, AnimatedCheckbox } from '@/components/buttons'
import { Dropdown, DropdownOption } from '@/components/common'
//import { Icon, settings } from '@/components/icons'
interface SmokeAPIConfig {
$schema: string
$version: number
logging: boolean
log_steam_http: boolean
default_app_status: 'unlocked' | 'locked' | 'original'
override_app_status: Record<string, string>
override_dlc_status: Record<string, string>
auto_inject_inventory: boolean
extra_inventory_items: number[]
extra_dlcs: Record<string, unknown>
}
interface SmokeAPISettingsDialogProps {
visible: boolean
onClose: () => void
gamePath: string
gameTitle: string
}
const DEFAULT_CONFIG: SmokeAPIConfig = {
$schema:
'https://raw.githubusercontent.com/acidicoala/SmokeAPI/refs/tags/v4.0.0/res/SmokeAPI.schema.json',
$version: 4,
logging: false,
log_steam_http: false,
default_app_status: 'unlocked',
override_app_status: {},
override_dlc_status: {},
auto_inject_inventory: true,
extra_inventory_items: [],
extra_dlcs: {},
}
const APP_STATUS_OPTIONS: DropdownOption<'unlocked' | 'locked' | 'original'>[] = [
{ value: 'unlocked', label: 'Unlocked' },
{ value: 'locked', label: 'Locked' },
{ value: 'original', label: 'Original' },
]
/**
* SmokeAPI Settings Dialog
* Allows configuration of SmokeAPI for a specific game
*/
const SmokeAPISettingsDialog = ({
visible,
onClose,
gamePath,
gameTitle,
}: SmokeAPISettingsDialogProps) => {
const [enabled, setEnabled] = useState(false)
const [config, setConfig] = useState<SmokeAPIConfig>(DEFAULT_CONFIG)
const [isLoading, setIsLoading] = useState(false)
const [hasChanges, setHasChanges] = useState(false)
// Load existing config when dialog opens
const loadConfig = useCallback(async () => {
setIsLoading(true)
try {
const existingConfig = await invoke<SmokeAPIConfig | null>('read_smokeapi_config', {
gamePath,
})
if (existingConfig) {
setConfig(existingConfig)
setEnabled(true)
} else {
setConfig(DEFAULT_CONFIG)
setEnabled(false)
}
setHasChanges(false)
} catch (error) {
console.error('Failed to load SmokeAPI config:', error)
setConfig(DEFAULT_CONFIG)
setEnabled(false)
} finally {
setIsLoading(false)
}
}, [gamePath])
useEffect(() => {
if (visible && gamePath) {
loadConfig()
}
}, [visible, gamePath, loadConfig])
const handleSave = async () => {
setIsLoading(true)
try {
if (enabled) {
// Save the config
await invoke('write_smokeapi_config', {
gamePath,
config,
})
} else {
// Delete the config
await invoke('delete_smokeapi_config', {
gamePath,
})
}
setHasChanges(false)
onClose()
} catch (error) {
console.error('Failed to save SmokeAPI config:', error)
} finally {
setIsLoading(false)
}
}
const handleCancel = () => {
setHasChanges(false)
onClose()
}
const updateConfig = <K extends keyof SmokeAPIConfig>(key: K, value: SmokeAPIConfig[K]) => {
setConfig((prev) => ({ ...prev, [key]: value }))
setHasChanges(true)
}
return (
<Dialog visible={visible} onClose={handleCancel} size="medium">
<DialogHeader onClose={handleCancel} hideCloseButton={true}>
<div className="settings-header">
{/*<Icon name={settings} variant="solid" size="md" />*/}
<h3>SmokeAPI Settings</h3>
</div>
<p className="dialog-subtitle">{gameTitle}</p>
</DialogHeader>
<DialogBody>
<div className="smokeapi-settings-content">
{/* Enable/Disable Section */}
<div className="settings-section">
<AnimatedCheckbox
checked={enabled}
onChange={() => {
setEnabled(!enabled)
setHasChanges(true)
}}
label="Enable SmokeAPI Configuration"
sublabel="Enable this to customize SmokeAPI settings for this game"
/>
</div>
{/* Settings Options */}
<div className={`settings-options ${!enabled ? 'disabled' : ''}`}>
<div className="settings-section">
<h4>General Settings</h4>
<Dropdown
label="Default App Status"
description="Specifies the default DLC status"
value={config.default_app_status}
options={APP_STATUS_OPTIONS}
onChange={(value) => updateConfig('default_app_status', value)}
disabled={!enabled}
/>
</div>
<div className="settings-section">
<h4>Logging</h4>
<div className="checkbox-option">
<AnimatedCheckbox
checked={config.logging}
onChange={() => updateConfig('logging', !config.logging)}
label="Enable Logging"
sublabel="Enables logging to SmokeAPI.log.log file"
/>
</div>
<div className="checkbox-option">
<AnimatedCheckbox
checked={config.log_steam_http}
onChange={() => updateConfig('log_steam_http', !config.log_steam_http)}
label="Log Steam HTTP"
sublabel="Toggles logging of SteamHTTP traffic"
/>
</div>
</div>
<div className="settings-section">
<h4>Inventory</h4>
<div className="checkbox-option">
<AnimatedCheckbox
checked={config.auto_inject_inventory}
onChange={() =>
updateConfig('auto_inject_inventory', !config.auto_inject_inventory)
}
label="Auto Inject Inventory"
sublabel="Automatically inject a list of all registered inventory items when the game queries user inventory"
/>
</div>
</div>
</div>
</div>
</DialogBody>
<DialogFooter>
<DialogActions>
<Button variant="secondary" onClick={handleCancel} disabled={isLoading}>
Cancel
</Button>
<Button variant="primary" onClick={handleSave} disabled={isLoading || !hasChanges}>
{isLoading ? 'Saving...' : 'Save'}
</Button>
</DialogActions>
</DialogFooter>
</Dialog>
)
}
export default SmokeAPISettingsDialog

View File

@@ -0,0 +1,95 @@
import React from 'react'
import {
Dialog,
DialogHeader,
DialogBody,
DialogFooter,
DialogActions,
} from '@/components/dialogs'
import { Button } from '@/components/buttons'
import { Icon, info } from '@/components/icons'
export interface UnlockerSelectionDialogProps {
visible: boolean
gameTitle: string
onClose: () => void
onSelectCreamLinux: () => void
onSelectSmokeAPI: () => void
}
/**
* Unlocker Selection Dialog component
* Allows users to choose between CreamLinux and SmokeAPI for native Linux games
*/
const UnlockerSelectionDialog: React.FC<UnlockerSelectionDialogProps> = ({
visible,
gameTitle,
onClose,
onSelectCreamLinux,
onSelectSmokeAPI,
}) => {
return (
<Dialog visible={visible} onClose={onClose} size="medium">
<DialogHeader onClose={onClose} hideCloseButton={true}>
<div className="unlocker-selection-header">
<h3>Choose Unlocker</h3>
</div>
</DialogHeader>
<DialogBody>
<div className="unlocker-selection-content">
<p className="game-title-info">
Select which unlocker to install for <strong>{gameTitle}</strong>:
</p>
<div className="unlocker-options">
<div className="unlocker-option recommended">
<div className="option-header">
<h4>CreamLinux</h4>
<span className="recommended-badge">Recommended</span>
</div>
<p className="option-description">
Native Linux DLC unlocker. Works best with most native Linux games and provides
better compatibility.
</p>
<Button variant="primary" onClick={onSelectCreamLinux} fullWidth>
Install CreamLinux
</Button>
</div>
<div className="unlocker-option">
<div className="option-header">
<h4>SmokeAPI</h4>
<span className="alternative-badge">Alternative</span>
</div>
<p className="option-description">
Cross-platform DLC unlocker. Try this if CreamLinux doesn't work for your game.
Automatically fetches DLC information.
</p>
<Button variant="secondary" onClick={onSelectSmokeAPI} fullWidth>
Install SmokeAPI
</Button>
</div>
</div>
<div className="selection-info">
<Icon name={info} variant="solid" size="md" />
<span>
You can always uninstall and try the other option if one doesn't work properly.
</span>
</div>
</div>
</DialogBody>
<DialogFooter>
<DialogActions>
<Button variant="secondary" onClick={onClose}>
Cancel
</Button>
</DialogActions>
</DialogFooter>
</Dialog>
)
}
export default UnlockerSelectionDialog

View File

@@ -7,6 +7,10 @@ export { default as DialogActions } from './DialogActions'
export { default as ProgressDialog } from './ProgressDialog'
export { default as DlcSelectionDialog } from './DlcSelectionDialog'
export { default as SettingsDialog } from './SettingsDialog'
export { default as SmokeAPISettingsDialog } from './SmokeAPISettingsDialog'
export { default as ConflictDialog } from './ConflictDialog'
export { default as DisclaimerDialog } from './DisclaimerDialog'
export { default as UnlockerSelectionDialog} from './UnlockerSelectionDialog'
// Export types
export type { DialogProps } from './Dialog'
@@ -16,3 +20,5 @@ export type { DialogFooterProps } from './DialogFooter'
export type { DialogActionsProps } from './DialogActions'
export type { ProgressDialogProps, InstallationInstructions } from './ProgressDialog'
export type { DlcSelectionDialogProps } from './DlcSelectionDialog'
export type { ConflictDialogProps, Conflict } from './ConflictDialog'
export type { UnlockerSelectionDialogProps } from './UnlockerSelectionDialog'

View File

@@ -8,13 +8,14 @@ interface GameItemProps {
game: Game
onAction: (gameId: string, action: ActionType) => Promise<void>
onEdit?: (gameId: string) => void
onSmokeAPISettings?: (gameId: string) => void
}
/**
* Individual game card component
* Displays game information and action buttons
*/
const GameItem = ({ game, onAction, onEdit }: GameItemProps) => {
const GameItem = ({ game, onAction, onEdit, onSmokeAPISettings }: GameItemProps) => {
const [imageUrl, setImageUrl] = useState<string | null>(null)
const [isLoading, setIsLoading] = useState(true)
const [hasError, setHasError] = useState(false)
@@ -50,11 +51,14 @@ const GameItem = ({ game, onAction, onEdit }: GameItemProps) => {
}, [game.id, imageUrl])
// Determine if we should show CreamLinux buttons (only for native games)
const shouldShowCream = game.native === true
const shouldShowCream = game.native && game.cream_installed // Only show if installed (for uninstall)
// Determine if we should show SmokeAPI buttons (only for non-native games with API files)
const shouldShowSmoke = !game.native && game.api_files && game.api_files.length > 0
// Show generic button if nothing installed
const shouldShowUnlocker = game.native && !game.cream_installed && !game.smoke_installed
// Check if this is a Proton game without API files
const isProtonNoApi = !game.native && (!game.api_files || game.api_files.length === 0)
@@ -70,6 +74,11 @@ const GameItem = ({ game, onAction, onEdit }: GameItemProps) => {
onAction(game.id, action)
}
const handleUnlockerAction = () => {
if (game.installing) return
onAction(game.id, 'install_unlocker')
}
// Handle edit button click
const handleEdit = () => {
if (onEdit && game.cream_installed) {
@@ -77,6 +86,13 @@ const GameItem = ({ game, onAction, onEdit }: GameItemProps) => {
}
}
// SmokeAPI settings handler
const handleSmokeAPISettings = () => {
if (onSmokeAPISettings && game.smoke_installed) {
onSmokeAPISettings(game.id)
}
}
// Determine background image
const backgroundImage =
!isLoading && imageUrl
@@ -108,17 +124,27 @@ const GameItem = ({ game, onAction, onEdit }: GameItemProps) => {
</div>
<div className="game-actions">
{/* Show CreamLinux button only for native games */}
{/* Show generic "Install" button for native games with nothing installed */}
{shouldShowUnlocker && (
<ActionButton
action="install_unlocker"
isInstalled={false}
isWorking={!!game.installing}
onClick={handleUnlockerAction}
/>
)}
{/* Show CreamLinux uninstall button if CreamLinux is installed */}
{shouldShowCream && (
<ActionButton
action={game.cream_installed ? 'uninstall_cream' : 'install_cream'}
isInstalled={!!game.cream_installed}
action="uninstall_cream"
isInstalled={true}
isWorking={!!game.installing}
onClick={handleCreamAction}
/>
)}
{/* Show SmokeAPI button only for Proton/Windows games with API files */}
{/* Show SmokeAPI button for Proton games OR native games with SmokeAPI installed */}
{shouldShowSmoke && (
<ActionButton
action={game.smoke_installed ? 'uninstall_smoke' : 'install_smoke'}
@@ -128,6 +154,16 @@ const GameItem = ({ game, onAction, onEdit }: GameItemProps) => {
/>
)}
{/* Show SmokeAPI uninstall for native games if installed */}
{game.native && game.smoke_installed && (
<ActionButton
action="uninstall_smoke"
isInstalled={true}
isWorking={!!game.installing}
onClick={handleSmokeAction}
/>
)}
{/* Show message for Proton games without API files */}
{isProtonNoApi && (
<div className="api-not-found-message">
@@ -156,6 +192,20 @@ const GameItem = ({ game, onAction, onEdit }: GameItemProps) => {
iconOnly
/>
)}
{/* Edit button - only enabled if SmokeAPI is installed */}
{game.smoke_installed && (
<Button
variant="secondary"
size="small"
onClick={handleSmokeAPISettings}
disabled={!game.smoke_installed || !!game.installing}
title="Configure SmokeAPI"
className="edit-button settings-icon-button"
leftIcon={<Icon name="Settings" variant="solid" size="md" />}
iconOnly
/>
)}
</div>
</div>
</div>

View File

@@ -9,13 +9,14 @@ interface GameListProps {
isLoading: boolean
onAction: (gameId: string, action: ActionType) => Promise<void>
onEdit?: (gameId: string) => void
onSmokeAPISettings?: (gameId: string) => void
}
/**
* Main game list component
* Displays games in a grid with search and filtering applied
*/
const GameList = ({ games, isLoading, onAction, onEdit }: GameListProps) => {
const GameList = ({ games, isLoading, onAction, onEdit, onSmokeAPISettings }: GameListProps) => {
const [imagesPreloaded, setImagesPreloaded] = useState(false)
// Sort games alphabetically by title
@@ -56,7 +57,7 @@ const GameList = ({ games, isLoading, onAction, onEdit }: GameListProps) => {
) : (
<div className="game-grid">
{sortedGames.map((game) => (
<GameItem key={game.id} game={game} onAction={onAction} onEdit={onEdit} />
<GameItem key={game.id} game={game} onAction={onAction} onEdit={onEdit} onSmokeAPISettings={onSmokeAPISettings} />
))}
</div>
)}

View File

@@ -1,4 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">
<path d="M20.25 14.75V10.75C20.25 8.83608 20.2477 7.50125 20.1123 6.49411C19.9808 5.51577 19.7401 4.99789 19.3711 4.62888C19.0021 4.25987 18.4842 4.01921 17.5059 3.88767C16.4987 3.75226 15.1639 3.74997 13.25 3.74997H10.75C8.83611 3.74997 7.50128 3.75226 6.49414 3.88767C5.5158 4.01921 4.99792 4.25987 4.62891 4.62888C4.2599 4.99789 4.01924 5.51577 3.8877 6.49411C3.75229 7.50125 3.75 8.83608 3.75 10.75V14.75C3.75 15.3023 3.30229 15.75 2.75 15.75C2.19772 15.75 1.75 15.3023 1.75 14.75V10.75C1.75 8.89262 1.74779 7.39889 1.90528 6.22751C2.06664 5.02741 2.41231 4.01735 3.21485 3.21481C4.01738 2.41228 5.02745 2.06661 6.22754 1.90524C7.39892 1.74776 8.89265 1.74997 10.75 1.74997H13.25C15.1074 1.74997 16.6011 1.74776 17.7725 1.90524C18.9726 2.06661 19.9826 2.41228 20.7852 3.21481C21.5877 4.01735 21.9334 5.02742 22.0947 6.22751C22.2522 7.39889 22.25 8.89262 22.25 10.75V14.75C22.25 15.3023 21.8023 15.75 21.25 15.75C20.6977 15.75 20.25 15.3023 20.25 14.75Z" fill="currentColor" />
<path d="M14.0312 5.74997C15.6419 5.74996 16.9169 5.74997 17.9248 5.86911C18.9557 5.99098 19.8048 6.2463 20.5137 6.82809C20.7541 7.02541 20.9746 7.24589 21.1719 7.4863C21.7537 8.19522 22.009 9.04424 22.1309 10.0752C22.25 11.0831 22.25 12.3581 22.25 13.9687V14.0312C22.25 15.6418 22.25 16.9169 22.1309 17.9248C22.009 18.9557 21.7537 19.8047 21.1719 20.5136C20.9746 20.7541 20.7541 20.9745 20.5137 21.1718C19.8048 21.7536 18.9557 22.009 17.9248 22.1308C16.9169 22.25 15.6419 22.25 14.0312 22.25H9.96875C8.35815 22.25 7.0831 22.25 6.0752 22.1308C5.04427 22.009 4.19525 21.7536 3.48633 21.1718C3.24592 20.9745 3.02544 20.7541 2.82812 20.5136C2.24633 19.8047 1.99101 18.9557 1.86914 17.9248C1.75 16.9169 1.75 15.6418 1.75 14.0312V13.9687C1.75 12.3581 1.75 11.0831 1.86914 10.0752C1.99101 9.04424 2.24633 8.19522 2.82812 7.4863C3.02544 7.24589 3.24592 7.02541 3.48633 6.82809C4.19525 6.2463 5.04427 5.99098 6.0752 5.86911C7.0831 5.74997 8.35815 5.74996 9.96875 5.74997H14.0312ZM12 9.49997C11.4477 9.49997 11 9.94768 11 10.5V15.3906C10.6896 15.0331 10.3585 14.6264 10.1455 14.3535C10.0396 14.2178 9.86489 13.9856 9.80566 13.9072C9.47825 13.4626 8.8519 13.3671 8.40723 13.6943C7.96265 14.0217 7.86716 14.6481 8.19434 15.0927C8.259 15.1784 8.45594 15.4386 8.56934 15.584C8.7953 15.8735 9.10761 16.2629 9.44824 16.6552C9.78455 17.0426 10.1683 17.456 10.5352 17.7802C10.7175 17.9414 10.9198 18.1021 11.1279 18.2275C11.3086 18.3364 11.6228 18.5 12 18.5C12.3772 18.5 12.6914 18.3364 12.8721 18.2275C13.0802 18.1021 13.2825 17.9414 13.4648 17.7802C13.8317 17.4561 14.2154 17.0426 14.5518 16.6552C14.8924 16.2629 15.2047 15.8735 15.4307 15.584C15.5441 15.4386 15.741 15.1784 15.8057 15.0927C16.1328 14.6481 16.0373 14.0227 15.5928 13.6953C15.1481 13.3678 14.5219 13.4635 14.1943 13.9082C14.1351 13.9866 13.9604 14.2178 13.8545 14.3535C13.6415 14.6264 13.3104 15.0331 13 15.3906V10.5C13 9.9477 12.5523 9.49999 12 9.49997Z" fill="currentColor" />
<path d="M16.1439 10.8544C15.7604 10.7888 15.2902 10.7658 14.7504 10.7567V4.99991C14.7504 4.5833 14.7563 4.22799 14.6732 3.91788C14.4652 3.1414 13.8589 2.5351 13.0824 2.32706C12.7723 2.24399 12.417 2.24991 12.0004 2.24991C11.5838 2.24991 11.2285 2.244 10.9183 2.32706C10.1419 2.5351 9.53459 3.1414 9.32654 3.91788C9.24355 4.22794 9.25037 4.5834 9.25037 4.99991V10.7567C8.71056 10.7658 8.24038 10.7888 7.85681 10.8544C7.344 10.9421 6.77397 11.1384 6.46033 11.6796L6.40174 11.7929L6.35193 11.9081C6.08178 12.5976 6.3948 13.2355 6.73279 13.7284C7.07715 14.2305 7.6246 14.832 8.28226 15.5546L8.31873 15.5946C9.03427 16.3808 9.62531 17.0262 10.1595 17.4687C10.7074 17.9223 11.2882 18.2426 11.9926 18.2499H12.0082C12.7125 18.2426 13.2934 17.9223 13.8412 17.4687C14.3754 17.0262 14.9665 16.3808 15.682 15.5946L15.7185 15.5546C16.3761 14.832 16.9236 14.2305 17.2679 13.7284C17.6059 13.2355 17.919 12.5976 17.6488 11.9081L17.599 11.7929L17.5404 11.6796C17.2268 11.1384 16.6567 10.9421 16.1439 10.8544Z" fill="currentColor" />
<path d="M18.75 19.7499C19.3023 19.7499 19.75 20.1976 19.75 20.7499C19.75 21.3022 19.3023 21.7499 18.75 21.7499H5.25C4.69772 21.7499 4.25 21.3022 4.25 20.7499C4.25 20.1976 4.69772 19.7499 5.25 19.7499H18.75Z" fill="currentColor" />
</svg>

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -1,5 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
<path d="M14 21.5H10C6.71252 21.5 5.06878 21.5 3.96243 20.592C3.75989 20.4258 3.57418 20.2401 3.40796 20.0376C2.5 18.9312 2.5 17.2875 2.5 14C2.5 10.7125 2.5 9.06878 3.40796 7.96243C3.57418 7.75989 3.75989 7.57418 3.96243 7.40796C5.06878 6.5 6.71252 6.5 10 6.5H14C17.2875 6.5 18.9312 6.5 20.0376 7.40796C20.2401 7.57418 20.4258 7.75989 20.592 7.96243C21.5 9.06878 21.5 10.7125 21.5 14C21.5 17.2875 21.5 18.9312 20.592 20.0376C20.4258 20.2401 20.2401 20.4258 20.0376 20.592C18.9312 21.5 17.2875 21.5 14 21.5Z" />
<path d="M2.5 14.5V10.5C2.5 6.72876 2.5 4.84315 3.67157 3.67157C4.84315 2.5 6.72876 2.5 10.5 2.5H13.5C17.2712 2.5 19.1569 2.5 20.3284 3.67157C21.5 4.84315 21.5 6.72876 21.5 10.5V14.5" />
<path d="M15 14.5C15 14.5 12.7905 17.4999 12 17.4999C11.2094 17.5 9 14.4999 9 14.4999M12 17L12 10.5" />
<path d="M16.9504 12.1817C17.1981 12.814 16.5076 13.5726 15.1267 15.0899C13.6702 16.6902 12.9201 17.4904 12 17.5C11.0799 17.4904 10.3298 16.6902 8.87331 15.0899C7.49239 13.5726 6.80193 12.814 7.04964 12.1817C7.05868 12.1586 7.06851 12.1359 7.0791 12.1135C7.34928 11.542 8.24477 11.5029 10 11.5002V4.99998C10 4.53501 10 4.30253 10.0511 4.11179C10.1898 3.59414 10.5941 3.1898 11.1118 3.05111C11.3025 3 11.535 3 12 3C12.4649 3 12.6974 3 12.8882 3.05111C13.4058 3.1898 13.8102 3.59414 13.9489 4.11179C14 4.30253 14 4.53501 14 4.99998V11.5002C15.7552 11.5029 16.6507 11.542 16.9209 12.1135C16.9315 12.1359 16.9413 12.1586 16.9504 12.1817Z" />
<path d="M5.00006 21H19.0001" />
</svg>

Before

Width:  |  Height:  |  Size: 1020 B

After

Width:  |  Height:  |  Size: 885 B

View File

@@ -1,6 +1,7 @@
import { createContext } from 'react'
import { Game, DlcInfo } from '@/types'
import { ActionType } from '@/components/buttons/ActionButton'
import { DlcDialogState } from '@/hooks/useDlcManager'
// Types for context sub-components
export interface InstallationInstructions {
@@ -10,17 +11,6 @@ export interface InstallationInstructions {
dlc_count?: number
}
export interface DlcDialogState {
visible: boolean
gameId: string
gameTitle: string
dlcs: DlcInfo[]
isLoading: boolean
isEditMode: boolean
progress: number
timeLeft?: string
}
export interface ProgressDialogState {
visible: boolean
title: string
@@ -30,6 +20,12 @@ export interface ProgressDialogState {
instructions?: InstallationInstructions
}
export interface SmokeAPISettingsDialogState {
visible: boolean
gamePath: string
gameTitle: string
}
// Define the context type
export interface AppContextType {
// Game state
@@ -43,6 +39,7 @@ export interface AppContextType {
dlcDialog: DlcDialogState
handleGameEdit: (gameId: string) => void
handleDlcDialogClose: () => void
handleUpdateDlcs: (gameId: string) => Promise<void>
// Game actions
progressDialog: ProgressDialogState
@@ -54,13 +51,28 @@ export interface AppContextType {
handleSettingsOpen: () => void
handleSettingsClose: () => void
// SmokeAPI settings
smokeAPISettingsDialog: SmokeAPISettingsDialogState
handleSmokeAPISettingsOpen: (gameId: string) => void
handleSmokeAPISettingsClose: () => void
// Toast notifications
showToast: (
message: string,
type: 'success' | 'error' | 'warning' | 'info',
options?: Record<string, unknown>
) => void
// Unlocker selection
unlockerSelectionDialog: {
visible: boolean
gameId: string | null
gameTitle: string | null
}
handleSelectCreamLinux: () => void
handleSelectSmokeAPI: () => void
closeUnlockerDialog: () => void
}
// Create the context with a default value
export const AppContext = createContext<AppContextType | undefined>(undefined)
export const AppContext = createContext<AppContextType | undefined>(undefined)

View File

@@ -4,6 +4,7 @@ import { useGames, useDlcManager, useGameActions, useToasts } from '@/hooks'
import { DlcInfo } from '@/types'
import { ActionType } from '@/components/buttons/ActionButton'
import { ToastContainer } from '@/components/notifications'
import { SmokeAPISettingsDialog } from '@/components/dialogs'
// Context provider component
interface AppProviderProps {
@@ -24,6 +25,7 @@ export const AppProvider = ({ children }: AppProviderProps) => {
handleDlcDialogClose: closeDlcDialog,
streamGameDlcs,
handleGameEdit,
handleUpdateDlcs,
} = useDlcManager()
const {
@@ -31,6 +33,8 @@ export const AppProvider = ({ children }: AppProviderProps) => {
handleCloseProgressDialog,
handleGameAction: executeGameAction,
handleDlcConfirm: executeDlcConfirm,
unlockerSelectionDialog,
closeUnlockerDialog,
} = useGameActions()
const { toasts, removeToast, success, error: showError, warning, info } = useToasts()
@@ -38,6 +42,17 @@ export const AppProvider = ({ children }: AppProviderProps) => {
// Settings dialog state
const [settingsDialog, setSettingsDialog] = useState({ visible: false })
// SmokeAPI settings dialog state
const [smokeAPISettingsDialog, setSmokeAPISettingsDialog] = useState<{
visible: boolean
gamePath: string
gameTitle: string
}>({
visible: false,
gamePath: '',
gameTitle: '',
})
// Settings handlers
const handleSettingsOpen = () => {
setSettingsDialog({ visible: true })
@@ -47,6 +62,29 @@ export const AppProvider = ({ children }: AppProviderProps) => {
setSettingsDialog({ visible: false })
}
// SmokeAPI settings handlers
const handleSmokeAPISettingsOpen = (gameId: string) => {
const game = games.find((g) => g.id === gameId)
if (!game) {
showError('Game not found')
return
}
setSmokeAPISettingsDialog({
visible: true,
gamePath: game.path,
gameTitle: game.title,
})
}
const handleSmokeAPISettingsClose = () => {
setSmokeAPISettingsDialog({
visible: false,
gamePath: '',
gameTitle: '',
})
}
// Game action handler with proper error reporting
const handleGameAction = async (gameId: string, action: ActionType) => {
const game = games.find((g) => g.id === gameId)
@@ -79,6 +117,28 @@ export const AppProvider = ({ children }: AppProviderProps) => {
}
}
// For install_unlocker action, executeGameAction will handle showing the dialog
// We should NOT show any notifications here - they'll be shown after actual installation
if (action === 'install_unlocker') {
// Mark game as installing while the user makes a selection
setGames((prevGames) =>
prevGames.map((g) => (g.id === gameId ? { ...g, installing: true } : g))
)
try {
// This will show the UnlockerSelectionDialog and handle the callback
await executeGameAction(gameId, action, games)
} catch (error) {
showError(`Action failed: ${error}`)
} finally {
// Reset installing state
setGames((prevGames) =>
prevGames.map((g) => (g.id === gameId ? { ...g, installing: false } : g))
)
}
return // Don't show any notifications for install_unlocker
}
// For other actions (uninstall cream, install/uninstall smoke)
// Mark game as installing
setGames((prevGames) =>
@@ -89,7 +149,7 @@ export const AppProvider = ({ children }: AppProviderProps) => {
await executeGameAction(gameId, action, games)
// Show appropriate success message based on action type
const product = action.includes('cream') ? 'Creamlinux' : 'SmokeAPI'
const product = action.includes('cream') ? 'CreamLinux' : 'SmokeAPI'
const isUninstall = action.includes('uninstall')
const isInstall = action.includes('install') && !isUninstall
@@ -189,6 +249,7 @@ export const AppProvider = ({ children }: AppProviderProps) => {
handleGameEdit(gameId, games)
},
handleDlcDialogClose: closeDlcDialog,
handleUpdateDlcs: (gameId: string) => handleUpdateDlcs(gameId),
// Game actions
progressDialog,
@@ -201,14 +262,74 @@ export const AppProvider = ({ children }: AppProviderProps) => {
handleSettingsOpen,
handleSettingsClose,
// SmokeAPI Settings
smokeAPISettingsDialog,
handleSmokeAPISettingsOpen,
handleSmokeAPISettingsClose,
// Toast notifications
showToast,
// Unlocker selection - Pass wrapped handlers that also handle the installing state
unlockerSelectionDialog,
handleSelectCreamLinux: () => {
// When CreamLinux is selected, trigger the DLC dialog flow
const gameId = unlockerSelectionDialog.gameId
if (gameId) {
const game = games.find((g) => g.id === gameId)
if (game) {
closeUnlockerDialog()
// Reset installing state before showing DLC dialog
setGames((prevGames) =>
prevGames.map((g) => (g.id === gameId ? { ...g, installing: false } : g))
)
// Show DLC selection dialog directly
setDlcDialog({
...dlcDialog,
visible: true,
gameId,
gameTitle: game.title,
dlcs: [],
isLoading: true,
isEditMode: false,
progress: 0,
})
streamGameDlcs(gameId)
}
}
},
handleSelectSmokeAPI: () => {
// When SmokeAPI is selected, trigger the actual installation
const gameId = unlockerSelectionDialog.gameId
if (gameId) {
const game = games.find((g) => g.id === gameId)
if (game) {
closeUnlockerDialog()
setTimeout(() => {
handleGameAction(gameId, 'install_smoke')
}, 0)
}
}
},
closeUnlockerDialog,
}
return (
<AppContext.Provider value={contextValue}>
{children}
<ToastContainer toasts={toasts} onDismiss={removeToast} />
{/* SmokeAPI Settings Dialog */}
<SmokeAPISettingsDialog
visible={smokeAPISettingsDialog.visible}
onClose={handleSmokeAPISettingsClose}
gamePath={smokeAPISettingsDialog.gamePath}
gameTitle={smokeAPISettingsDialog.gameTitle}
/>
</AppContext.Provider>
)
}
}

View File

@@ -4,7 +4,11 @@ export { useDlcManager } from './useDlcManager'
export { useGameActions } from './useGameActions'
export { useToasts } from './useToasts'
export { useAppLogic } from './useAppLogic'
export { useConflictDetection } from './useConflictDetection'
export { useDisclaimer } from './useDisclaimer'
export { useUnlockerSelection } from './useUnlockerSelection'
// Export types
export type { ToastType, Toast, ToastOptions } from './useToasts'
export type { DlcDialogState } from './useDlcManager'
export type { Conflict, ConflictResolution } from './useConflictDetection'

View File

@@ -0,0 +1,102 @@
import { useState, useEffect, useCallback } from 'react'
import { Game } from '@/types'
export interface Conflict {
gameId: string
gameTitle: string
type: 'cream-to-proton' | 'smoke-to-native'
}
export interface ConflictResolution {
gameId: string
conflictType: 'cream-to-proton' | 'smoke-to-native'
}
/**
* Hook for detecting platform conflicts
* Identifies when unlocker files exist for the wrong platform
*/
export function useConflictDetection(games: Game[]) {
const [conflicts, setConflicts] = useState<Conflict[]>([])
const [showDialog, setShowDialog] = useState(false)
const [resolvedConflicts, setResolvedConflicts] = useState<Set<string>>(new Set())
const [hasShownThisSession, setHasShownThisSession] = useState(false)
// Detect conflicts whenever games change
useEffect(() => {
const detectedConflicts: Conflict[] = []
games.forEach((game) => {
// Skip if we've already resolved a conflict for this game
if (resolvedConflicts.has(game.id)) {
return
}
// Conflict 1: CreamLinux installed but game is now Proton
if (!game.native && game.cream_installed) {
detectedConflicts.push({
gameId: game.id,
gameTitle: game.title,
type: 'cream-to-proton',
})
}
// Conflict 2: Orphaned Proton SmokeAPI DLL files on a native game
if (game.native && game.smoke_installed && game.api_files && game.api_files.length > 0) {
detectedConflicts.push({
gameId: game.id,
gameTitle: game.title,
type: 'smoke-to-native',
})
}
})
setConflicts(detectedConflicts)
// Show dialog only if:
// 1. We have conflicts
// 2. Dialog isn't already visible
// 3. We haven't shown it this session
if (detectedConflicts.length > 0 && !showDialog && !hasShownThisSession) {
setShowDialog(true)
setHasShownThisSession(true)
}
}, [games, resolvedConflicts, showDialog, hasShownThisSession])
// Handle resolving a single conflict
const resolveConflict = useCallback(
(gameId: string, conflictType: 'cream-to-proton' | 'smoke-to-native'): ConflictResolution => {
// Mark this game as resolved
setResolvedConflicts((prev) => new Set(prev).add(gameId))
// Remove from conflicts list
setConflicts((prev) => prev.filter((c) => c.gameId !== gameId))
return {
gameId,
conflictType,
}
},
[]
)
// Auto-close dialog when all conflicts are resolved
useEffect(() => {
if (conflicts.length === 0 && showDialog) {
setShowDialog(false)
}
}, [conflicts.length, showDialog])
// Handle dialog close
const closeDialog = useCallback(() => {
setShowDialog(false)
}, [])
return {
conflicts,
showDialog,
resolveConflict,
closeDialog,
hasConflicts: conflicts.length > 0,
}
}

View File

@@ -0,0 +1,58 @@
import { useState, useEffect } from 'react'
import { invoke } from '@tauri-apps/api/core'
import { Config } from '@/types/Config'
/**
* Hook to manage disclaimer dialog state
* Loads config on mount and provides methods to update it
*/
export function useDisclaimer() {
const [showDisclaimer, setShowDisclaimer] = useState(false)
const [isLoading, setIsLoading] = useState(true)
// Load config on mount
useEffect(() => {
loadConfig()
}, [])
const loadConfig = async () => {
try {
const config = await invoke<Config>('load_config')
setShowDisclaimer(config.show_disclaimer)
} catch (error) {
console.error('Failed to load config:', error)
// Default to showing disclaimer if config load fails
setShowDisclaimer(true)
} finally {
setIsLoading(false)
}
}
const handleDisclaimerClose = async (dontShowAgain: boolean) => {
setShowDisclaimer(false)
if (dontShowAgain) {
try {
// Load the current config first
const currentConfig = await invoke<Config>('load_config')
// Update the show_disclaimer field
const updatedConfig: Config = {
...currentConfig,
show_disclaimer: false,
}
// Save the updated config
await invoke('update_config', { configData: updatedConfig })
} catch (error) {
console.error('Failed to update config:', error)
}
}
}
return {
showDisclaimer,
isLoading,
handleDisclaimerClose,
}
}

View File

@@ -11,10 +11,13 @@ export interface DlcDialogState {
enabledDlcs: string[]
isLoading: boolean
isEditMode: boolean
isUpdating: boolean
updateAttempted: boolean
progress: number
progressMessage: string
timeLeft: string
error: string | null
newDlcsCount: number
}
/**
@@ -36,10 +39,13 @@ export function useDlcManager() {
enabledDlcs: [],
isLoading: false,
isEditMode: false,
isUpdating: false,
updateAttempted: false,
progress: 0,
progressMessage: '',
timeLeft: '',
error: null,
newDlcsCount: 0,
})
// Set up event listeners for DLC streaming
@@ -80,6 +86,7 @@ export function useDlcManager() {
setDlcDialog((prev) => ({
...prev,
isLoading: false,
isUpdating: false,
}))
// Reset fetch state
@@ -177,10 +184,13 @@ export function useDlcManager() {
enabledDlcs: [],
isLoading: true,
isEditMode: true,
isUpdating: false,
updateAttempted: false,
progress: 0,
progressMessage: 'Reading DLC configuration...',
timeLeft: '',
error: null,
newDlcsCount: 0,
})
// Always get a fresh copy from the config file
@@ -302,6 +312,58 @@ export function useDlcManager() {
}
}, [dlcDialog.dlcs, dlcDialog.enabledDlcs])
// Function to update DLC list (refetch from Steam API)
const handleUpdateDlcs = async (gameId: string) => {
try {
// Store current app IDs to identify new DLCs later
const currentAppIds = new Set(dlcDialog.dlcs.map((dlc) => dlc.appid))
// Set updating state and clear DLCs
setDlcDialog((prev) => ({
...prev,
isUpdating: true,
isLoading: true,
updateAttempted: true,
progress: 0,
progressMessage: 'Checking for new DLCs...',
newDlcsCount: 0,
dlcs: [], // Clear current DLCs to start fresh
}))
// Mark that we're fetching DLCs for this game
setIsFetchingDlcs(true)
activeDlcFetchId.current = gameId
// Start streaming DLCs
await streamGameDlcs(gameId)
// After streaming completes, calculate new DLCs
// Wait a bit longer to ensure all DLCs have been added
setTimeout(() => {
setDlcDialog((prev) => {
// Count how many DLCs are new (not in the original list)
const actualNewCount = prev.dlcs.filter(dlc => !currentAppIds.has(dlc.appid)).length
console.log(`Update complete: Found ${actualNewCount} new DLCs out of ${prev.dlcs.length} total`)
return {
...prev,
newDlcsCount: actualNewCount,
}
})
}, 1500) // Increased timeout to ensure all DLCs are processed
} catch (error) {
console.error('Error updating DLCs:', error)
setDlcDialog((prev) => ({
...prev,
error: `Failed to update DLCs: ${error}`,
isLoading: false,
isUpdating: false,
}))
}
}
return {
dlcDialog,
setDlcDialog,
@@ -309,6 +371,7 @@ export function useDlcManager() {
streamGameDlcs,
handleGameEdit,
handleDlcDialogClose,
handleUpdateDlcs,
forceReload,
}
}
}

View File

@@ -4,6 +4,7 @@ import { listen } from '@tauri-apps/api/event'
import { ActionType } from '@/components/buttons/ActionButton'
import { Game, DlcInfo } from '@/types'
import { InstallationInstructions } from '@/contexts/AppContext'
import { useUnlockerSelection } from './useUnlockerSelection'
/**
* Hook for managing game action operations
@@ -79,22 +80,38 @@ export function useGameActions() {
setProgressDialog((prev) => ({ ...prev, visible: false }))
}, [])
// Unlocker selection hook for native games
const {
selectionState,
showUnlockerSelection,
handleSelectCreamLinux,
handleSelectSmokeAPI,
closeDialog: closeUnlockerDialog,
} = useUnlockerSelection()
// Unified handler for game actions (install/uninstall)
const handleGameAction = useCallback(
async (gameId: string, action: ActionType, games: Game[]) => {
try {
// For CreamLinux installation, we should NOT call process_game_action directly
// Instead, we show the DLC selection dialog first, which is handled in AppProvider
// Find the game
const game = games.find((g) => g.id === gameId)
if (!game) return
// For CreamLinux installation, DLC dialog is handled in AppProvider
if (action === 'install_cream') {
return
}
// For other actions (uninstall_cream, install_smoke, uninstall_smoke)
// Find game to get title
const game = games.find((g) => g.id === gameId)
if (!game) return
// Handle generic "install_unlocker" action for native games
if (action === 'install_unlocker') {
showUnlockerSelection(game, (chosenAction: ActionType) => {
// User chose, now proceed with that action
handleGameAction(gameId, chosenAction, games)
})
return
}
// Get title based on action
// For other actions (uninstall_cream, install_smoke, uninstall_smoke)
const isCream = action.includes('cream')
const isInstall = action.includes('install')
const product = isCream ? 'CreamLinux' : 'SmokeAPI'
@@ -138,7 +155,7 @@ export function useGameActions() {
throw error
}
},
[]
[showUnlockerSelection]
)
// Handle DLC selection confirmation
@@ -231,5 +248,9 @@ export function useGameActions() {
handleCloseProgressDialog,
handleGameAction,
handleDlcConfirm,
unlockerSelectionDialog: selectionState,
handleSelectCreamLinux,
handleSelectSmokeAPI,
closeUnlockerDialog,
}
}

View File

@@ -0,0 +1,71 @@
import { useState, useCallback } from 'react'
import { Game } from '@/types'
import { ActionType } from '@/components/buttons'
export interface UnlockerSelectionState {
visible: boolean
gameId: string | null
gameTitle: string | null
}
/**
* Hook for managing unlocker selection on native games
*/
export function useUnlockerSelection() {
const [selectionState, setSelectionState] = useState<UnlockerSelectionState>({
visible: false,
gameId: null,
gameTitle: null,
})
// Store the callback to call when user makes a selection
const [selectionCallback, setSelectionCallback] = useState<((action: ActionType) => void) | null>(
null
)
// Show the dialog and store the callback
const showUnlockerSelection = useCallback(
(game: Game, callback: (action: ActionType) => void) => {
setSelectionState({
visible: true,
gameId: game.id,
gameTitle: game.title,
})
// Wrap in function to avoid stale closure
setSelectionCallback(() => callback)
},
[]
)
// User selected CreamLinux
const handleSelectCreamLinux = useCallback(() => {
setSelectionState({ visible: false, gameId: null, gameTitle: null })
if (selectionCallback) {
selectionCallback('install_cream')
}
setSelectionCallback(null)
}, [selectionCallback])
// User selected SmokeAPI
const handleSelectSmokeAPI = useCallback(() => {
setSelectionState({ visible: false, gameId: null, gameTitle: null })
if (selectionCallback) {
selectionCallback('install_smoke')
}
setSelectionCallback(null)
}, [selectionCallback])
// Close dialog without selection
const closeDialog = useCallback(() => {
setSelectionState({ visible: false, gameId: null, gameTitle: null })
setSelectionCallback(null)
}, [])
return {
selectionState,
showUnlockerSelection,
handleSelectCreamLinux,
handleSelectSmokeAPI,
closeDialog,
}
}

View File

@@ -0,0 +1,127 @@
@use '../../themes/index' as *;
@use '../../abstracts/index' as *;
/*
Dropdown component styles
*/
.dropdown-container {
display: flex;
flex-direction: column;
gap: 0.5rem;
width: 100%;
}
.dropdown-label-container {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.dropdown-label {
font-size: 0.95rem;
font-weight: 600;
color: var(--text-primary);
}
.dropdown-description {
font-size: 0.85rem;
color: var(--text-secondary);
line-height: 1.4;
margin: 0;
}
.dropdown {
position: relative;
width: 100%;
&.disabled {
opacity: 0.5;
cursor: not-allowed;
}
}
.dropdown-trigger {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
background-color: var(--border-dark);
border: 1px solid var(--border-soft);
border-radius: var(--radius-sm);
padding: 0.75rem 1rem;
color: var(--text-primary);
cursor: pointer;
transition: all var(--duration-normal) var(--easing-ease-out);
&:hover:not(:disabled) {
border-color: var(--border);
background-color: rgba(255, 255, 255, 0.05);
}
&:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 2px rgba(var(--primary-color), 0.2);
}
&:disabled {
cursor: not-allowed;
}
}
.dropdown-value {
flex: 1;
text-align: left;
font-size: 0.9rem;
}
.dropdown-icon {
transition: transform var(--duration-normal) var(--easing-ease-out);
color: var(--text-secondary);
transform: rotate(180deg);
&.open {
transform: rotate(0deg);
}
}
.dropdown-menu {
position: absolute;
top: calc(100% + 0.5rem);
left: 0;
right: 0;
background-color: var(--elevated-bg);
border: 1px solid var(--border-soft);
border-radius: var(--radius-sm);
box-shadow: var(--shadow-lg);
z-index: var(--z-modal);
max-height: 200px;
overflow-y: auto;
@include custom-scrollbar;
}
.dropdown-option {
width: 100%;
padding: 0.75rem 1rem;
background: none;
border: none;
color: var(--text-primary);
text-align: left;
cursor: pointer;
transition: all var(--duration-normal) var(--easing-ease-out);
font-size: 0.9rem;
&:hover {
background-color: rgba(255, 255, 255, 0.05);
}
&.selected {
background-color: rgba(var(--primary-color), 0.2);
color: var(--primary-color);
}
&:not(:last-child) {
border-bottom: 1px solid var(--border-soft);
}
}

View File

@@ -1,2 +1,3 @@
@forward './loading';
@forward './progress_bar';
@forward './dropdown';

View File

@@ -0,0 +1,143 @@
@use '../../themes/index' as *;
@use '../../abstracts/index' as *;
/*
Conflict Dialog Styles
Used for platform conflict detection dialogs
*/
.conflict-dialog-header {
display: flex;
align-items: center;
gap: 0.75rem;
h3 {
margin: 0;
flex: 1;
font-size: 1.1rem;
color: var(--text-primary);
}
svg {
color: var(--warning);
flex-shrink: 0;
}
}
.conflict-dialog-body {
display: flex;
flex-direction: column;
gap: 1rem;
.conflict-intro {
margin: 0;
color: var(--text-secondary);
line-height: 1.5;
}
.conflict-list {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.conflict-item {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
padding: 1rem;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 8px;
transition: all 0.2s ease;
&:hover {
background: rgba(255, 255, 255, 0.05);
border-color: rgba(255, 255, 255, 0.15);
}
}
.conflict-info {
display: flex;
align-items: flex-start;
gap: 0.75rem;
flex: 1;
min-width: 0; // Enable text truncation
}
.conflict-icon {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
background: rgba(255, 193, 7, 0.1);
border-radius: 8px;
svg {
color: var(--warning);
}
}
.conflict-details {
flex: 1;
min-width: 0;
h4 {
margin: 0 0 0.25rem 0;
font-size: 0.95rem;
font-weight: var(--semibold);
color: var(--text-primary);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
p {
margin: 0;
font-size: 0.85rem;
color: var(--text-secondary);
line-height: 1.4;
}
}
.conflict-resolve-btn {
flex-shrink: 0;
min-width: 100px;
}
}
.conflict-reminder {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.75rem 1rem;
background: rgba(33, 150, 243, 0.1);
border: 1px solid rgba(33, 150, 243, 0.2);
border-radius: 6px;
font-size: 0.85rem;
color: var(--text-secondary);
line-height: 1.4;
margin-bottom: 1rem;
svg {
color: var(--info);
flex-shrink: 0;
}
span {
flex: 1;
}
code {
padding: 0.125rem 0.375rem;
background: rgba(0, 0, 0, 0.3);
border-radius: 3px;
font-family: 'Courier New', monospace;
font-size: 0.8rem;
color: var(--text-primary);
white-space: nowrap;
}
}

View File

@@ -0,0 +1,38 @@
@use '../../themes/index' as *;
@use '../../abstracts/index' as *;
/*
Disclaimer Dialog Styles
Used for the startup disclaimer dialog
*/
.disclaimer-header {
h3 {
margin-bottom: 0;
}
}
.disclaimer-content {
p {
margin-bottom: 1rem;
color: var(--text-secondary);
line-height: 1.6;
font-size: 0.95rem;
&:last-of-type {
margin-bottom: 0;
}
strong {
color: var(--text-primary);
font-weight: var(--bold);
}
}
}
.disclaimer-footer {
display: flex;
justify-content: space-between;
align-items: center;
gap: 1rem;
width: 100%;
}

View File

@@ -154,6 +154,40 @@
color: var(--text-secondary);
}
// Update results message
.dlc-update-results {
padding: 0.75rem 1.5rem;
background-color: var(--elevated-bg);
border: 1px solid var(--border-soft);
border-radius: var(--radius-sm);
margin-bottom: 0.75rem;
.update-message {
color: var(--text-primary);
font-weight: 600;
font-size: 0.9rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
&.dlc-update-success {
.update-message {
.dlc-update-icon-success {
color: var(--success);
}
}
}
&.dlc-update-info {
.update-message {
.dlc-update-icon-info {
color: var(--info);
}
}
}
}
// Game information in DLC dialog
.dlc-game-info {
display: flex;

View File

@@ -2,3 +2,7 @@
@forward './dlc_dialog';
@forward './progress_dialog';
@forward './settings_dialog';
@forward './smokeapi_settings_dialog';
@forward './conflict_dialog';
@forward './disclaimer_dialog';
@forward './unlocker_selection_dialog';

View File

@@ -18,8 +18,8 @@
.settings-section {
h4 {
font-size: 1.1rem;
font-weight: 600;
font-size: 1.2rem;
font-weight: 700;
color: var(--text-primary);
margin-bottom: 0.5rem;
padding-bottom: 0.5rem;

View File

@@ -0,0 +1,66 @@
@use '../../themes/index' as *;
@use '../../abstracts/index' as *;
/*
SmokeAPI Settings Dialog styles
*/
.dialog-subtitle {
color: var(--text-secondary);
font-weight: 500;
margin-top: 0.25rem;
font-weight: normal;
}
.smokeapi-settings-content {
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.settings-options {
display: flex;
flex-direction: column;
gap: 1.5rem;
transition: opacity var(--duration-normal) var(--easing-ease-out);
&.disabled {
opacity: 0.4;
pointer-events: none;
}
}
.settings-section {
display: flex;
flex-direction: column;
gap: 1rem;
h4 {
font-size: 1rem;
font-weight: 600;
color: var(--text-primary);
margin: 0;
padding-bottom: 0.5rem;
border-bottom: 1px solid var(--border-soft);
}
}
.checkbox-option {
padding: 0.5rem 0;
&:not(:last-child) {
border-bottom: 1px solid var(--border-soft);
}
.animated-checkbox {
width: 100%;
.checkbox-content {
flex: 1;
}
.checkbox-sublabel {
margin-top: 0.25rem;
}
}
}

View File

@@ -0,0 +1,122 @@
@use '../../themes/index' as *;
@use '../../abstracts/index' as *;
/*
Unlocker Selection Dialog styles
For choosing between CreamLinux and SmokeAPI on native games
*/
.unlocker-selection-header {
display: flex;
align-items: center;
gap: 0.75rem;
h3 {
margin: 0;
font-size: 1.5rem;
font-weight: 600;
color: var(--text-primary);
}
}
.unlocker-selection-content {
display: flex;
flex-direction: column;
gap: 1.5rem;
.game-title-info {
font-size: 1rem;
color: var(--text-secondary);
margin: 0;
strong {
color: var(--text-primary);
}
}
.unlocker-options {
display: flex;
flex-direction: column;
gap: 1rem;
}
.unlocker-option {
background-color: rgba(255, 255, 255, 0.03);
border: 1px solid var(--border-soft);
border-radius: 8px;
padding: 1.25rem;
transition: all var(--duration-normal) var(--easing-ease-out);
&:hover {
background-color: rgba(255, 255, 255, 0.05);
border-color: var(--border);
}
&.recommended {
border-color: var(--primary-color);
background-color: rgba(245, 150, 130, 0.05);
&:hover {
background-color: rgba(245, 150, 130, 0.08);
}
}
.option-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 0.75rem;
h4 {
margin: 0;
font-size: 1.1rem;
font-weight: 600;
color: var(--text-primary);
}
.recommended-badge {
background-color: var(--primary-color);
color: var(--text-heavy);
padding: 0.25rem 0.75rem;
border-radius: 12px;
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
}
.alternative-badge {
background-color: var(--border);
color: var(--text-secondary);
padding: 0.25rem 0.75rem;
border-radius: 12px;
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
}
}
.option-description {
font-size: 0.9rem;
color: var(--text-secondary);
margin: 0 0 1rem 0;
line-height: 1.5;
}
}
.selection-info {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.75rem 1rem;
background-color: rgba(255, 255, 255, 0.02);
border: 1px solid var(--border-soft);
border-radius: 6px;
font-size: 0.85rem;
color: var(--text-muted);
svg {
flex-shrink: 0;
color: var(--info);
}
}
}

8
src/types/Config.ts Normal file
View File

@@ -0,0 +1,8 @@
/**
* User configuration structure
* Matches the Rust Config struct
*/
export interface Config {
/** Whether to show the disclaimer on startup */
show_disclaimer: boolean
}

View File

@@ -1,2 +1,3 @@
export * from './Game'
export * from './DlcInfo'
export * from './Config'