From ffde590f1cd84c24535ee51b026433ee7306b778 Mon Sep 17 00:00:00 2001 From: Philip Kristoffersen Date: Wed, 6 Oct 2021 11:13:54 +0200 Subject: [PATCH] UI for GOG --- Readme.md | 59 +++++++++++++++++++++++++++++++++-------- gui/mainview.fl | 31 +++++++++++++++++----- src/gog/gog_platform.rs | 25 +++++++++-------- src/sync/sync.rs | 11 ++++---- src/ui/ui.rs | 32 +++++++++++++++++++++- 5 files changed, 120 insertions(+), 38 deletions(-) diff --git a/Readme.md b/Readme.md index 3f0e2a7..a5faa27 100644 --- a/Readme.md +++ b/Readme.md @@ -6,12 +6,13 @@ This little tool will synchronize games from other platforms into your Steam lib The goal is that you do not have to leave your Steam library to launch games from other launchers/stores. ## Features + - [x] Download art from [SteamGridDB](https://www.steamgriddb.com/) - [x] [Legendary](https://github.com/derrod/legendary) integration - [x] [Epic Games Store](https://www.epicgames.com/) integration - [x] [Itch.io](https://itch.io/app) integration - [x] [Origin](https://www.origin.com) integration (currently only windows, linux comming soon) -- [x] [GOG](https://www.gog.com/galaxy) integration (currently only windows, linux comming soon, also no ui configuration either, but coming even sooner) +- [x] [GOG](https://www.gog.com/galaxy) integration - [x] Cross Platform - [x] Small (~1.5mb on disk), lightweight (~2mb ram) and fast(~30ms sync) - [x] UI For configuration @@ -28,35 +29,39 @@ Feel free to submit issues and pull requests. ## Getting started -* Download the latest release from the [releases page](https://github.com/PhilipK/BoilR/releases). -* Choose the UI version or the cli version (if in doubt pick the UI version) -* Place it in a folder of your choice. -* Run the executable. -* Restart Steam to see your new shortcuts. +- Download the latest release from the [releases page](https://github.com/PhilipK/BoilR/releases). +- Choose the UI version or the cli version (if in doubt pick the UI version) +- Place it in a folder of your choice. +- Run the executable. +- Restart Steam to see your new shortcuts. ## Getting art for your shortcuts -* Get a [SteamGridDB API key](https://www.steamgriddb.com/profile/preferences/api) -* For the CLI version, Write it in the `config.toml` file (see how in the [config section](#configuration)). -* for the Ui version , copy it into the auth key input. -* Run the executable again +- Get a [SteamGridDB API key](https://www.steamgriddb.com/profile/preferences/api) +- For the CLI version, Write it in the `config.toml` file (see how in the [config section](#configuration)). +- for the Ui version , copy it into the auth key input. +- Run the executable again ## Configuration + The tool reads its configuration from a `config.toml` file. You can either manually edit this file or use the UI version to changing these configurations. Here is a simple example of how to write the config file: + ```toml [steamgrid_db] auth_key="your steamgrid db auth key" ``` And here is a full example of all configuration options: + ```toml [epic_games] enabled=true #On windows this is default true, on linux default false location="C:\\ProgramData\\Epic\\EpicGamesLauncher\\Data\\Manifests" #If this value is not defined, the tool will try to find it automatically (only windows). If it can't find it, it will fail and tell you. +create_symlinks = true #Only for Linux, To get around a bug in steam where paths can not contain spaces, BoilR creates symlinks in ~/.boilr/link and uses those. [legendary] enabled=false #On windows this is default false, on linux default true @@ -65,6 +70,7 @@ executable="legendary" #If this value is not defined, "legendary" will be used, [itch] enabled=false #Default false location="C:\\Users\\user\\AppData\\Roaming\\itch" #If this value is not defined, "%APPDATA%itch" will be used on windows, and HOME/.config/itch on linux. +create_symlinks = true #Only for Linux, To get around a bug in steam where paths can not contain spaces, BoilR creates symlinks in ~/.boilr/link and uses those. [origin] enabled=false #Default false @@ -72,7 +78,9 @@ location="C:\\ProgramData\\Origin" #If this value is not defined, "%PROGRAMGDATA [gog] enabled=false #Default false -location="C:\\ProgramData\\GOG.com\\Galaxy" #The location of GOG Galaxy (will default to this value if not defined) +location="C:\\ProgramData\\GOG.com\\Galaxy" #The location of GOG Galaxy will default to this value if not defined on windows and "~/Games/gog-galaxy/drive_c/ProgramData/GOG.com/Galaxy" on linux. +create_symlinks = true #Only for Linux, To get around a bug in steam where paths can not contain spaces, BoilR creates symlinks in ~/.boilr/link and uses those. +wine_c_drive="/home/username/Games/gog-galaxy/drive_c" #Only for Linux, Is mandatory on linux. [steam] location="C:\\Program Files (x86)\\Steam\\" #If this value is not defined, the tool will try to find it automatically. If it can't find it, it will fail and tell you. @@ -82,6 +90,35 @@ enabled = true #If false, the whole download of custom art will be skipped. auth_key="" #This value is mandatory if you have steamgrid_db enabled. ``` +## Tips for Linux + +If you are on linux, and want to use one of the launchers that is not available natively, here are a few ways that you can make them work. + +### GOG + +- Install [Lutris](https://lutris.net/) +- Install GOG thourgh Lutris [here](https://lutris.net/games/gog-galaxy/) +- Set the path to GOG in the config.toml (or through the ui) +- Run BoilR +- Remember to pick which version of Proton you want to use for a game, before the first time you want to rn it. + +### Epic + +I recommend you just use [Legendary](https://github.com/derrod/legendary). But if you really want to use EGS you can: + +- Install [Lutris](https://lutris.net/) +- Install EGS thourgh Lutris [here](https://lutris.net/games/epic-games-store/) +- Set the path to EGS in the config.toml (or through the ui) +- Run BoilR +- Remember to pick which version of Proton you want to use for a game, before the first time you want to rn it. + +### Origin + +Currently BoilR can't setup shortcuts to Origin because Origin uses a special link to open games. But I know of a workaround, it is just going to take a bit to make (basicly let Boiler take that url as input and let it call origin with proton settings and the url). +This section will be updated when it is ready. +Untill then you can still play origin games thourgh Lutris [here](https://lutris.net/games/origin/) + + ## License This project is dual license MIT or Apache 2.0 , it is up to you. In short, you can do what you want with this project, but if in doubt read the license files. diff --git a/gui/mainview.fl b/gui/mainview.fl index e56abb2..bfed2d7 100644 --- a/gui/mainview.fl +++ b/gui/mainview.fl @@ -8,7 +8,7 @@ class UserInterface {open } { Fl_Window win { label {Main View} open - xywh {768 30 535 865} type Double visible + xywh {768 0 575 985} type Double visible } { Fl_Group {} { label BoilR @@ -76,11 +76,11 @@ class UserInterface {open } } Fl_Group origin_group { - label Origin open - xywh {40 699 633 78} align 5 + label Origin + xywh {35 699 638 121} align 5 } { Fl_Input origin_folder_input { - label {Origin Data Folder} selected + label {Origin Data Folder} xywh {40 745 445 26} align 5 } Fl_Check_Button enable_origin_checkbox { @@ -89,15 +89,32 @@ class UserInterface {open } } Fl_Group action_buttons { - xywh {35 800 570 50} + xywh {35 800 570 170} } { Fl_Button save_settings_button { label {Save Settings} - xywh {38 808 120 40} + xywh {35 930 120 40} } Fl_Button synchronize_button { label {Synchronize Games} - xywh {325 806 160 40} + xywh {325 925 160 40} + } + } + Fl_Group {} { + label {GOG Galaxy} open + xywh {35 799 570 121} align 5 + } { + Fl_Check_Button enable_gog_checkbox { + label Enable + xywh {35 799 570 26} down_box DOWN_BOX + } + Fl_Input gog_folder_input { + label {GOG Data Folder} + xywh {35 844 445 26} align 5 + } + Fl_Input gog_winedrive_input { + label {GOG Wine C Drive} selected + xywh {35 894 445 26} align 5 } } } diff --git a/src/gog/gog_platform.rs b/src/gog/gog_platform.rs index e052cc0..86a030d 100644 --- a/src/gog/gog_platform.rs +++ b/src/gog/gog_platform.rs @@ -52,7 +52,6 @@ impl Platform for GogPlatform { for install_location in install_locations { let path = Path::new(&install_location); if path.exists() { - println!("exists {:?}", &path); let dirs = path.read_dir(); if let Ok(dirs) = dirs { for dir in dirs { @@ -122,7 +121,7 @@ impl Platform for GogPlatform { #[cfg(target_os = "linux")] let working_dir = working_dir.replace("\\", "/"); - + let full_path_string = full_path.to_string(); #[cfg(target_os = "linux")] @@ -149,17 +148,17 @@ impl Platform for GogPlatform { #[cfg(target_os = "linux")] fn fix_paths(wine_c_drive: &String, paths: Vec) -> Vec { - paths - .iter() - .flat_map(|path| { - if path.starts_with("C:\\") { - let path_buf = Path::new(wine_c_drive).join(&path[3..]); - path_buf.to_str().map(|s| s.to_string().replace("\\", "/")) - } else { - None - } - }) - .collect() + paths + .iter() + .flat_map(|path| { + if path.starts_with("C:\\") { + let path_buf = Path::new(wine_c_drive).join(&path[3..]); + path_buf.to_str().map(|s| s.to_string().replace("\\", "/")) + } else { + None + } + }) + .collect() } fn get_install_locations(path: PathBuf) -> Result, GogErrors> { diff --git a/src/sync/sync.rs b/src/sync/sync.rs index d39b16d..4336239 100644 --- a/src/sync/sync.rs +++ b/src/sync/sync.rs @@ -164,12 +164,11 @@ fn create_sym_links(shortcut: &ShortcutOwned) -> ShortcutOwned { let workdir_original = Path::new(&shortcut.start_dir); use std::os::unix::fs::symlink; - - match ( - symlink(&target_original, &target_link), - symlink(&workdir_original, &workdir_link), - ) { - (Ok(_), Ok(_)) => { + // If the links exsists, then they must point towards what is needed, otherwise they would have a different app id + let target_ok = target_link.exists() || symlink(&target_original, &target_link).is_ok(); + let workdir_ok = workdir_link.exists() || symlink(&workdir_original, &workdir_link).is_ok(); + match (target_ok, workdir_ok) { + (true, true) => { let exe = target_link.to_string_lossy().to_string(); let start_dir = workdir_link.to_string_lossy().to_string(); let new_shortcut = Shortcut::new( diff --git a/src/ui/ui.rs b/src/ui/ui.rs index 67f5fa1..80ac0e3 100644 --- a/src/ui/ui.rs +++ b/src/ui/ui.rs @@ -71,6 +71,11 @@ fn update_settings_with_ui_values(settings: &mut Settings, ui: &UserInterface) { // Itch settings.itch.enabled = ui.enable_itch_checkbox.value(); settings.itch.location = empty_or_whitespace(ui.itch_locatoin_input.value()); + + // Gog + settings.gog.enabled = ui.enable_gog_checkbox.value(); + settings.gog.location = empty_or_whitespace(ui.gog_folder_input.value()); + settings.gog.wine_c_drive = empty_or_whitespace(ui.gog_winedrive_input.value()); } #[cfg(feature = "ui")] @@ -84,7 +89,7 @@ fn save_settings_to_file(settings: &Settings) { fn update_ui_with_settings(ui: &mut UserInterface, settings: &Settings) { use std::path::Path; - use crate::{itch, origin, steam}; + use crate::{gog, itch, origin, steam}; ui.steam_location_input.set_value( &settings @@ -152,4 +157,29 @@ fn update_ui_with_settings(ui: &mut UserInterface, settings: &Settings) { .clone() .unwrap_or(default_origin_location), ); + + ui.enable_gog_checkbox.set_value(settings.gog.enabled); + let default_gog_location = gog::default_location(); + let default_gog_location = if !default_gog_location.exists() { + String::from("") + } else { + default_gog_location.to_string_lossy().to_string() + }; + ui.gog_folder_input.set_value( + &settings + .gog + .location + .clone() + .unwrap_or(default_gog_location), + ); + + #[cfg(target_os = "linux")] + { + ui.gog_winedrive_input + .set_value(&settings.gog.wine_c_drive.clone().unwrap_or("".to_string())); + } + #[cfg(not(target_os = "linux"))] + { + ui.gog_winedrive_input.deactivate(); + } }