mirror of
https://github.com/ALEZ-DEV/Babylonia-terminal.git
synced 2026-03-23 06:38:52 +00:00
Merge pull request #52 from ALEZ-DEV/proton_to_wine
Transition from proton to wine
This commit is contained in:
commit
131009dc7e
28
Cargo.lock
generated
28
Cargo.lock
generated
@ -374,7 +374,9 @@ dependencies = [
|
||||
"serde_json",
|
||||
"tar",
|
||||
"tokio",
|
||||
"whatadistro",
|
||||
"wincompatlib",
|
||||
"xz2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2069,6 +2071,17 @@ version = "0.4.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f"
|
||||
|
||||
[[package]]
|
||||
name = "lzma-sys"
|
||||
version = "0.1.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5fda04ab3764e6cde78b9974eec4f779acaba7c4e84b36eca3cf77c581b85d27"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.4"
|
||||
@ -3951,6 +3964,12 @@ version = "0.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"
|
||||
|
||||
[[package]]
|
||||
name = "whatadistro"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c97ebad4f59809511083f2161587445631bff21bb78d9e046b9ca5b2d05d913"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
@ -4269,6 +4288,15 @@ dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xz2"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2"
|
||||
dependencies = [
|
||||
"lzma-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yoke"
|
||||
version = "0.7.5"
|
||||
|
||||
@ -3,7 +3,7 @@ use std::{path::PathBuf, str::FromStr, sync::Arc};
|
||||
use babylonia_terminal_sdk::{
|
||||
components::{
|
||||
dxvk_component::{DXVK_DEV, DXVK_REPO},
|
||||
proton_component::{ProtonComponent, PROTON_DEV, PROTON_REPO},
|
||||
wine_component::{WineComponent, WINE_DEV, WINE_REPO},
|
||||
},
|
||||
game_config::GameConfig,
|
||||
game_manager::{EnvironmentVariable, GameManager},
|
||||
@ -21,8 +21,32 @@ pub async fn run(
|
||||
env_vars: Vec<EnvironmentVariable>,
|
||||
show_logs: bool,
|
||||
) {
|
||||
let mut proton_component: Option<ProtonComponent> = None;
|
||||
let mut proton: Option<Proton> = None;
|
||||
let mut wine_component: Option<WineComponent> = None;
|
||||
let mut wine: Option<Wine> = None;
|
||||
|
||||
// Deleting old setup
|
||||
if None == GameConfig::get_config().await.launcher_version {
|
||||
info!("You seem to have the old setup to play the game.");
|
||||
info!("do you want to delete it to setup the new one ? (y/n) (default - yes): ");
|
||||
|
||||
let input = BufReader::new(tokio::io::stdin())
|
||||
.lines()
|
||||
.next_line()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
if None == input
|
||||
|| Some("".to_string()) == input
|
||||
|| Some("y".to_string()) == input
|
||||
|| Some("yes".to_string()) == input
|
||||
{
|
||||
info!("Deleting old setup...");
|
||||
babylonia_terminal_sdk::utils::remove_setup().await;
|
||||
info!("done!");
|
||||
} else {
|
||||
info!("Keeping old setup...");
|
||||
}
|
||||
}
|
||||
|
||||
loop {
|
||||
let state_result = GameState::get_current_state().await;
|
||||
@ -32,40 +56,42 @@ pub async fn run(
|
||||
}
|
||||
let state = state_result.unwrap();
|
||||
|
||||
if state != GameState::ProtonNotInstalled && proton == None {
|
||||
let proton_component = ProtonComponent::new(GameConfig::get_config_directory().await);
|
||||
match proton_component.init_proton() {
|
||||
Ok(p) => proton = Some(p),
|
||||
if state != GameState::WineNotInstalled && wine == None {
|
||||
let wine_component = WineComponent::new(GameConfig::get_config_directory().await);
|
||||
match wine_component.init_wine() {
|
||||
Ok(p) => wine = Some(p),
|
||||
Err(err) => panic!("{}", err),
|
||||
};
|
||||
}
|
||||
|
||||
match state {
|
||||
GameState::ProtonNotInstalled => {
|
||||
GameState::WineNotInstalled => {
|
||||
let release;
|
||||
if utils::use_latest("Do you want to install latest version of Proton GE or a specific version of it?") {
|
||||
release = 0;
|
||||
} else {
|
||||
release = utils::choose_release_version(
|
||||
PROTON_DEV,
|
||||
PROTON_REPO,
|
||||
"Please, select a version of Proton GE to install.",
|
||||
)
|
||||
.await
|
||||
.expect("Failed to fetch proton version!");
|
||||
}
|
||||
if utils::use_latest(
|
||||
"Do you want to install latest version of wine GE or a specific version of it?",
|
||||
) {
|
||||
release = 0;
|
||||
} else {
|
||||
release = utils::choose_release_version(
|
||||
WINE_DEV,
|
||||
WINE_REPO,
|
||||
"Please, select a version of wine GE to install.",
|
||||
)
|
||||
.await
|
||||
.expect("Failed to fetch wine version!");
|
||||
}
|
||||
|
||||
info!("Proton not installed, installing it...");
|
||||
proton_component = Some(
|
||||
info!("Wine not installed, installing it...");
|
||||
wine_component = Some(
|
||||
GameManager::install_wine(
|
||||
GameConfig::get_config_directory().await,
|
||||
release,
|
||||
Some(DownloadReporter::create(false)),
|
||||
)
|
||||
.await
|
||||
.expect("Failed to install Wine"),
|
||||
.expect("Failed to install wine"),
|
||||
);
|
||||
info!("Proton installed");
|
||||
info!("wine installed");
|
||||
}
|
||||
GameState::DXVKNotInstalled => {
|
||||
let release;
|
||||
@ -84,9 +110,9 @@ pub async fn run(
|
||||
}
|
||||
|
||||
info!("DXVK not installed, installing it...");
|
||||
debug!("{:?}", proton_component);
|
||||
debug!("{:?}", wine_component);
|
||||
GameManager::install_dxvk(
|
||||
&proton.clone().unwrap(),
|
||||
&wine.clone().unwrap(),
|
||||
GameConfig::get_config_directory().await,
|
||||
release,
|
||||
Some(DownloadReporter::create(false)),
|
||||
@ -97,14 +123,14 @@ pub async fn run(
|
||||
}
|
||||
GameState::FontNotInstalled => {
|
||||
info!("Fonts not installed, installing it...");
|
||||
GameManager::install_font(&proton.clone().unwrap(), None::<Arc<DownloadReporter>>)
|
||||
GameManager::install_font(&wine.clone().unwrap(), None::<Arc<DownloadReporter>>)
|
||||
.await
|
||||
.expect("Failed to install fonts");
|
||||
info!("Fonts installed");
|
||||
}
|
||||
GameState::DependecieNotInstalled => {
|
||||
info!("Dependecies not installed, installing it...");
|
||||
GameManager::install_dependencies(&proton.clone().unwrap())
|
||||
GameManager::install_dependencies(&wine.clone().unwrap())
|
||||
.await
|
||||
.expect("Failed to install dependecies");
|
||||
info!("Dependecies installed");
|
||||
@ -167,9 +193,9 @@ pub async fn run(
|
||||
}
|
||||
|
||||
info!("Starting game...");
|
||||
debug!("{:?}", proton);
|
||||
debug!("{:?}", wine);
|
||||
GameManager::start_game(
|
||||
&proton.unwrap(),
|
||||
&wine.unwrap(),
|
||||
GameConfig::get_game_dir()
|
||||
.await
|
||||
.expect("Failed to start game, the game directory was not found"),
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
use std::{ops::Deref, sync::Arc};
|
||||
|
||||
use babylonia_terminal_sdk::{
|
||||
components::proton_component::ProtonComponent, game_config::GameConfig,
|
||||
game_manager::GameManager, utils::github_requester::GithubRelease,
|
||||
components::wine_component::WineComponent, game_config::GameConfig, game_manager::GameManager,
|
||||
utils::github_requester::GithubRelease,
|
||||
};
|
||||
use downloader::download;
|
||||
use log::{debug, error};
|
||||
@ -10,7 +10,7 @@ use relm4::{
|
||||
tokio::{self, sync::OnceCell},
|
||||
Worker,
|
||||
};
|
||||
use wincompatlib::prelude::Proton;
|
||||
use wincompatlib::prelude::Wine;
|
||||
|
||||
use crate::ui::{
|
||||
self,
|
||||
@ -23,36 +23,33 @@ use crate::ui::{
|
||||
},
|
||||
};
|
||||
|
||||
static PROTON: OnceCell<Proton> = OnceCell::const_new();
|
||||
static WINE: OnceCell<Wine> = OnceCell::const_new();
|
||||
|
||||
pub async fn get_proton() -> anyhow::Result<Proton> {
|
||||
if !PROTON.initialized() {
|
||||
let proton_component = ProtonComponent::new(GameConfig::get_config().await.config_dir);
|
||||
let proton = proton_component.init_proton();
|
||||
pub async fn get_wine() -> anyhow::Result<Wine> {
|
||||
if !WINE.initialized() {
|
||||
let wine_component = WineComponent::new(GameConfig::get_config().await.config_dir);
|
||||
let wine = wine_component.init_wine();
|
||||
|
||||
if let Err(ref e) = proton {
|
||||
error!("Failed to initialize proton : {}", e);
|
||||
anyhow::bail!("Failed to initialize proton : {}", e);
|
||||
if let Err(ref e) = wine {
|
||||
error!("Failed to initialize wine : {}", e);
|
||||
anyhow::bail!("Failed to initialize wine : {}", e);
|
||||
}
|
||||
|
||||
Ok(PROTON
|
||||
.get_or_init(|| async { proton.unwrap() })
|
||||
.await
|
||||
.clone())
|
||||
Ok(WINE.get_or_init(|| async { wine.unwrap() }).await.clone())
|
||||
} else {
|
||||
Ok(PROTON.get().unwrap().clone())
|
||||
Ok(WINE.get().unwrap().clone())
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn run_game() -> anyhow::Result<()> {
|
||||
let proton = get_proton().await?;
|
||||
let wine = get_wine().await?;
|
||||
let game_dir = GameConfig::get_config().await.game_dir;
|
||||
if game_dir.is_none() {
|
||||
error!("Failed to start game, the game directory was not found");
|
||||
anyhow::bail!("Failed to start game, the game directory was not found");
|
||||
}
|
||||
|
||||
GameManager::start_game(&proton, game_dir.unwrap(), None, vec![], false).await?;
|
||||
GameManager::start_game(&wine, game_dir.unwrap(), None, vec![], false).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -217,7 +214,7 @@ pub enum HandleComponentInstallationMsg {
|
||||
usize,
|
||||
Arc<download_components::DownloadComponentProgressBarReporter>,
|
||||
),
|
||||
), // proton release and dxvk release
|
||||
), // wine release and dxvk release
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -237,7 +234,7 @@ impl Worker for HandleComponentInstallation {
|
||||
fn update(&mut self, message: Self::Input, sender: relm4::ComponentSender<Self>) {
|
||||
match message {
|
||||
HandleComponentInstallationMsg::StartInstallation((
|
||||
proton_release,
|
||||
wine_release,
|
||||
dxvk_release,
|
||||
progress_bar,
|
||||
)) => {
|
||||
@ -248,20 +245,20 @@ impl Worker for HandleComponentInstallation {
|
||||
.block_on(async {
|
||||
let _ = sender.output(
|
||||
download_components::DownloadComponentsMsg::UpdateProgressBarMsg(
|
||||
String::from("Starting download for proton"),
|
||||
Some(String::from("Unpacking and initializing proton")),
|
||||
String::from("Starting download for wine"),
|
||||
Some(String::from("Unpacking and initializing wine")),
|
||||
),
|
||||
);
|
||||
|
||||
let _ = sender.output(
|
||||
download_components::DownloadComponentsMsg::UpdateCurrentlyInstalling(
|
||||
download_components::CurrentlyInstalling::Proton,
|
||||
download_components::CurrentlyInstalling::Wine,
|
||||
),
|
||||
);
|
||||
|
||||
let _ = sender.output(
|
||||
download_components::DownloadComponentsMsg::UpdateDownloadedComponentName(
|
||||
String::from("proton"),
|
||||
String::from("wine"),
|
||||
),
|
||||
);
|
||||
|
||||
@ -271,8 +268,8 @@ impl Worker for HandleComponentInstallation {
|
||||
GameConfig::get_config_directory().await
|
||||
};
|
||||
|
||||
if let Err(error) = GameManager::install_wine(game_dir.clone(), proton_release, Some(progress_bar.clone())).await {
|
||||
sender.output(download_components::DownloadComponentsMsg::ShowError(format!("Failed to install proton : {}", error))).unwrap();
|
||||
if let Err(error) = GameManager::install_wine(game_dir.clone(), wine_release, Some(progress_bar.clone())).await {
|
||||
sender.output(download_components::DownloadComponentsMsg::ShowError(format!("Failed to install wine : {}", error))).unwrap();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -283,15 +280,15 @@ impl Worker for HandleComponentInstallation {
|
||||
|
||||
let _ = sender.output(download_components::DownloadComponentsMsg::UpdateDownloadedComponentName(String::from("DXVK")));
|
||||
|
||||
let proton = match get_proton().await {
|
||||
let wine = match get_wine().await {
|
||||
Ok(p) => p,
|
||||
Err(e) => {
|
||||
sender.output(download_components::DownloadComponentsMsg::ShowError(format!("Failed to initialize proton : {:?}", e))).unwrap();
|
||||
sender.output(download_components::DownloadComponentsMsg::ShowError(format!("Failed to initialize wine : {:?}", e))).unwrap();
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
if let Err(error) = GameManager::install_dxvk(&proton, game_dir, dxvk_release, Some(progress_bar.clone())).await {
|
||||
if let Err(error) = GameManager::install_dxvk(&wine, game_dir, dxvk_release, Some(progress_bar.clone())).await {
|
||||
sender.output(download_components::DownloadComponentsMsg::ShowError(format!("Failed to install DXVK : {}", error))).unwrap();
|
||||
return;
|
||||
}
|
||||
@ -303,7 +300,7 @@ impl Worker for HandleComponentInstallation {
|
||||
|
||||
let _ = sender.output(download_components::DownloadComponentsMsg::UpdateDownloadedComponentName(String::from("fonts")));
|
||||
|
||||
if let Err(error) = GameManager::install_font(&proton, Some(progress_bar.clone())).await {
|
||||
if let Err(error) = GameManager::install_font(&wine, Some(progress_bar.clone())).await {
|
||||
sender.output(download_components::DownloadComponentsMsg::ShowError(format!("Failed to install fonts : {}", error))).unwrap();
|
||||
return;
|
||||
}
|
||||
@ -315,7 +312,7 @@ impl Worker for HandleComponentInstallation {
|
||||
|
||||
let _ = sender.output(download_components::DownloadComponentsMsg::UpdateDownloadedComponentName(String::from("denpendecies")));
|
||||
|
||||
if let Err(error) = GameManager::install_dependencies(&proton).await {
|
||||
if let Err(error) = GameManager::install_dependencies(&wine).await {
|
||||
sender.output(download_components::DownloadComponentsMsg::ShowError(format!("Failed to install dependencies : {}", error))).unwrap();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
use std::{convert::identity, fmt::format};
|
||||
use std::{convert::identity, fmt::format, process::Command};
|
||||
|
||||
use arboard::Clipboard;
|
||||
use babylonia_terminal_sdk::game_state::GameState;
|
||||
use libadwaita::prelude::{MessageDialogExt, PreferencesPageExt};
|
||||
use log::error;
|
||||
use babylonia_terminal_sdk::{game_config::GameConfig, game_state::GameState, utils};
|
||||
use libadwaita::prelude::{ApplicationExt, MessageDialogExt, PreferencesPageExt};
|
||||
use log::{debug, error};
|
||||
use relm4::{
|
||||
adw,
|
||||
gtk::{
|
||||
@ -11,7 +11,7 @@ use relm4::{
|
||||
prelude::{ButtonExt, GtkWindowExt, OrientableExt, WidgetExt},
|
||||
},
|
||||
prelude::{AsyncComponentParts, SimpleAsyncComponent},
|
||||
Component, RelmWidgetExt, WorkerController,
|
||||
tokio, Component, RelmWidgetExt, WorkerController,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@ -31,6 +31,7 @@ pub struct GamePage {
|
||||
progress_bar_reporter: std::sync::Arc<ProgressBarGameInstallationReporter>,
|
||||
progress_bar_message: String,
|
||||
fraction: f64,
|
||||
delete_old_setup_manager: DeleteOldSetupManager,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -41,6 +42,7 @@ pub enum GamePageMsg {
|
||||
UpdateGameState,
|
||||
UpdateProgressBar(u64, u64),
|
||||
ShowError(String),
|
||||
DeleteOldSetup,
|
||||
}
|
||||
|
||||
#[relm4::component(pub, async)]
|
||||
@ -222,6 +224,7 @@ impl SimpleAsyncComponent for GamePage {
|
||||
) -> relm4::prelude::AsyncComponentParts<Self> {
|
||||
let model = GamePage {
|
||||
progress_bar_reporter: ProgressBarGameInstallationReporter::create(sender.clone()),
|
||||
delete_old_setup_manager: DeleteOldSetupManager::new(sender.clone()),
|
||||
game_state,
|
||||
game_handler: manager::HandleGameProcess::builder()
|
||||
.detach_worker(())
|
||||
@ -238,10 +241,18 @@ impl SimpleAsyncComponent for GamePage {
|
||||
|
||||
let widgets = view_output!();
|
||||
|
||||
if None == GameConfig::get_config().await.launcher_version {
|
||||
sender.input(GamePageMsg::DeleteOldSetup);
|
||||
}
|
||||
|
||||
AsyncComponentParts { model, widgets }
|
||||
}
|
||||
|
||||
async fn update(&mut self, message: Self::Input, _: relm4::AsyncComponentSender<Self>) -> () {
|
||||
async fn update(
|
||||
&mut self,
|
||||
message: Self::Input,
|
||||
sender: relm4::AsyncComponentSender<Self>,
|
||||
) -> () {
|
||||
match message {
|
||||
GamePageMsg::SetIsGameRunning(value) => self.is_game_running = value,
|
||||
GamePageMsg::SetIsDownloading(value) => self.is_downloading = value,
|
||||
@ -287,6 +298,32 @@ impl SimpleAsyncComponent for GamePage {
|
||||
}
|
||||
});
|
||||
|
||||
dialog.present();
|
||||
}
|
||||
GamePageMsg::DeleteOldSetup => {
|
||||
let dialog = unsafe {
|
||||
adw::MessageDialog::new(
|
||||
MAIN_WINDOW.as_ref(),
|
||||
Some("Remove old setup"),
|
||||
Some("You seem to have a old environment. You need to delete it if you want to continue to play."),
|
||||
)
|
||||
};
|
||||
|
||||
dialog.add_response("remove", "Remove setup and restart");
|
||||
dialog.set_response_appearance("remove", adw::ResponseAppearance::Suggested);
|
||||
|
||||
let remove_old_setup_manager = self.delete_old_setup_manager.clone();
|
||||
|
||||
dialog.connect_response(Some("remove"), move |_, _| {
|
||||
tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap()
|
||||
.block_on(async {
|
||||
remove_old_setup_manager.delete_old_setup().await;
|
||||
});
|
||||
});
|
||||
|
||||
dialog.present();
|
||||
}
|
||||
}
|
||||
@ -337,3 +374,25 @@ impl downloader::progress::Reporter for ProgressBarGameInstallationReporter {
|
||||
*guard = None;
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct DeleteOldSetupManager {
|
||||
sender: relm4::AsyncComponentSender<GamePage>,
|
||||
}
|
||||
|
||||
impl DeleteOldSetupManager {
|
||||
pub fn new(sender: relm4::AsyncComponentSender<GamePage>) -> Self {
|
||||
Self { sender }
|
||||
}
|
||||
|
||||
pub async fn delete_old_setup(&self) {
|
||||
if let Err(e) = utils::remove_setup().await {
|
||||
self.sender.input(GamePageMsg::ShowError(e.to_string()));
|
||||
} else {
|
||||
if let Ok(bin_path) = std::env::current_exe() {
|
||||
let _ = Command::new(bin_path).arg("--gui").spawn();
|
||||
};
|
||||
relm4::main_application().quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ use arboard::Clipboard;
|
||||
use babylonia_terminal_sdk::{
|
||||
components::{
|
||||
dxvk_component::{self, DXVKComponent},
|
||||
proton_component::{self, ProtonComponent},
|
||||
wine_component::{self, WineComponent},
|
||||
},
|
||||
game_config::GameConfig,
|
||||
game_state::GameState,
|
||||
@ -43,7 +43,7 @@ pub enum DownloadComponentsMsg {
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum CurrentlyInstalling {
|
||||
None,
|
||||
Proton,
|
||||
Wine,
|
||||
DXVK,
|
||||
Fonts,
|
||||
Denpendecies,
|
||||
@ -52,14 +52,14 @@ pub enum CurrentlyInstalling {
|
||||
#[derive(Debug)]
|
||||
pub struct DownloadComponentsPage {
|
||||
// widgets
|
||||
proton_combo: adw::ComboRow,
|
||||
wine_combo: adw::ComboRow,
|
||||
dxvk_combo: adw::ComboRow,
|
||||
//error_dialog: Controller<CopyDialog>,
|
||||
|
||||
// values
|
||||
proton_versions: Vec<GithubRelease>,
|
||||
wine_versions: Vec<GithubRelease>,
|
||||
dxvk_versions: Vec<GithubRelease>,
|
||||
selected_proton_version: Option<GithubRelease>,
|
||||
selected_wine_version: Option<GithubRelease>,
|
||||
selected_dxvk_version: Option<GithubRelease>,
|
||||
game_config: GameConfig,
|
||||
|
||||
@ -108,11 +108,11 @@ impl SimpleAsyncComponent for DownloadComponentsPage {
|
||||
set_vexpand: true,
|
||||
|
||||
#[local_ref]
|
||||
proton_combo -> adw::ComboRow {
|
||||
set_title: "proton version",
|
||||
wine_combo -> adw::ComboRow {
|
||||
set_title: "Wine version",
|
||||
|
||||
set_model: Some(>k::StringList::new(model
|
||||
.proton_versions
|
||||
.wine_versions
|
||||
.iter()
|
||||
.map(|r| r.tag_name.as_str())
|
||||
.collect::<Vec<&str>>()
|
||||
@ -142,7 +142,7 @@ impl SimpleAsyncComponent for DownloadComponentsPage {
|
||||
set_hexpand: false,
|
||||
set_width_request: 200,
|
||||
|
||||
connect_clicked => DownloadComponentsMsg::UpdateCurrentlyInstalling(CurrentlyInstalling::Proton),
|
||||
connect_clicked => DownloadComponentsMsg::UpdateCurrentlyInstalling(CurrentlyInstalling::Wine),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -168,21 +168,21 @@ impl SimpleAsyncComponent for DownloadComponentsPage {
|
||||
set_vexpand: true,
|
||||
|
||||
adw::ActionRow {
|
||||
set_title: "Proton",
|
||||
set_title: "Wine",
|
||||
#[watch]
|
||||
set_subtitle: match &model.selected_proton_version {
|
||||
set_subtitle: match &model.selected_wine_version {
|
||||
Some(release) => &release.tag_name,
|
||||
None => "WTF??!! there's no proton version found ????",
|
||||
None => "WTF??!! there's no wine version found ????",
|
||||
},
|
||||
|
||||
#[watch]
|
||||
set_icon_name: if model.currently_installing != CurrentlyInstalling::Proton && model.game_config.is_wine_installed { Some("emblem-ok-symbolic") } else { None },
|
||||
set_icon_name: if model.currently_installing != CurrentlyInstalling::Wine && model.game_config.is_wine_installed { Some("emblem-ok-symbolic") } else { None },
|
||||
|
||||
add_prefix = >k::Spinner {
|
||||
set_spinning: true,
|
||||
|
||||
#[watch]
|
||||
set_visible: model.currently_installing == CurrentlyInstalling::Proton,
|
||||
set_visible: model.currently_installing == CurrentlyInstalling::Wine,
|
||||
}
|
||||
},
|
||||
|
||||
@ -191,7 +191,7 @@ impl SimpleAsyncComponent for DownloadComponentsPage {
|
||||
#[watch]
|
||||
set_subtitle: match &model.selected_dxvk_version {
|
||||
Some(release) => &release.tag_name,
|
||||
None => "WTF??!! there's no proton version found ????",
|
||||
None => "WTF??!! there's no wine version found ????",
|
||||
},
|
||||
|
||||
#[watch]
|
||||
@ -285,12 +285,10 @@ impl SimpleAsyncComponent for DownloadComponentsPage {
|
||||
root: Self::Root,
|
||||
sender: AsyncComponentSender<Self>,
|
||||
) -> AsyncComponentParts<Self> {
|
||||
let proton_releases = ProtonComponent::get_github_releases(
|
||||
proton_component::PROTON_DEV,
|
||||
proton_component::PROTON_REPO,
|
||||
)
|
||||
.await
|
||||
.unwrap(); //TODO: remove unwrap()
|
||||
let wine_releases =
|
||||
WineComponent::get_github_releases(wine_component::WINE_DEV, wine_component::WINE_REPO)
|
||||
.await
|
||||
.unwrap(); //TODO: remove unwrap()
|
||||
|
||||
let dxvk_releases =
|
||||
DXVKComponent::get_github_releases(dxvk_component::DXVK_DEV, dxvk_component::DXVK_REPO)
|
||||
@ -298,12 +296,12 @@ impl SimpleAsyncComponent for DownloadComponentsPage {
|
||||
.unwrap(); //TODO: remove unwrap()
|
||||
|
||||
let model = DownloadComponentsPage {
|
||||
proton_combo: adw::ComboRow::new(),
|
||||
wine_combo: adw::ComboRow::new(),
|
||||
dxvk_combo: adw::ComboRow::new(),
|
||||
|
||||
proton_versions: proton_releases,
|
||||
wine_versions: wine_releases,
|
||||
dxvk_versions: dxvk_releases,
|
||||
selected_proton_version: None,
|
||||
selected_wine_version: None,
|
||||
selected_dxvk_version: None,
|
||||
game_config: GameConfig::get_config().await,
|
||||
|
||||
@ -320,7 +318,7 @@ impl SimpleAsyncComponent for DownloadComponentsPage {
|
||||
msg_when_done: None,
|
||||
};
|
||||
|
||||
let proton_combo = &model.proton_combo;
|
||||
let wine_combo = &model.wine_combo;
|
||||
let dxvk_combo = &model.dxvk_combo;
|
||||
|
||||
let widgets = view_output!();
|
||||
@ -395,21 +393,21 @@ impl SimpleAsyncComponent for DownloadComponentsPage {
|
||||
DownloadComponentsMsg::Quit => relm4::main_application().quit(),
|
||||
}
|
||||
|
||||
if self.selected_proton_version.is_none()
|
||||
if self.selected_wine_version.is_none()
|
||||
&& self.selected_dxvk_version.is_none()
|
||||
&& self.currently_installing != CurrentlyInstalling::None
|
||||
{
|
||||
let proton_index = self.proton_combo.selected() as usize;
|
||||
let wine_index = self.wine_combo.selected() as usize;
|
||||
let dxvk_index = self.dxvk_combo.selected() as usize;
|
||||
|
||||
let proton_release = self.proton_versions[proton_index].clone();
|
||||
let wine_release = self.wine_versions[wine_index].clone();
|
||||
let dxvk_release = self.dxvk_versions[dxvk_index].clone();
|
||||
|
||||
self.selected_proton_version = Some(proton_release);
|
||||
self.selected_wine_version = Some(wine_release);
|
||||
self.selected_dxvk_version = Some(dxvk_release);
|
||||
let _ = self.installation_handler.sender().send(
|
||||
manager::HandleComponentInstallationMsg::StartInstallation((
|
||||
proton_index,
|
||||
wine_index,
|
||||
dxvk_index,
|
||||
self.progress_bar_reporter.clone(),
|
||||
)),
|
||||
|
||||
@ -27,10 +27,11 @@ serde = { version = "1.0.197", features = ["derive"] }
|
||||
serde_json = "1.0.115"
|
||||
tar = "0.4.40"
|
||||
tokio = { version = "1.37.0", features = ["fs"] }
|
||||
whatadistro = "0.1.0"
|
||||
wincompatlib = { version = "0.7.5", features = [
|
||||
"dxvk",
|
||||
"wine-bundles",
|
||||
"wine-proton",
|
||||
"wine-fonts",
|
||||
"winetricks",
|
||||
] }
|
||||
xz2 = "0.1.7"
|
||||
|
||||
@ -55,12 +55,7 @@ impl<'a> ComponentDownloader for DXVKComponent<'a> {
|
||||
|
||||
Self::uncompress(file_output.clone(), self.path.clone()).await?;
|
||||
|
||||
let wine_with_proton_prefix = self // wine take the data/wine/pfx prefix, but we want the data/wine prefix
|
||||
.wine
|
||||
.clone()
|
||||
.with_prefix(self.wine.prefix.parent().unwrap());
|
||||
|
||||
wine_with_proton_prefix
|
||||
self.wine
|
||||
.install_dxvk(self.path.clone(), InstallParams::default())
|
||||
.expect("Failed to installed DXVK");
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pub mod component_downloader;
|
||||
pub mod dxvk_component;
|
||||
pub mod game_component;
|
||||
pub mod proton_component;
|
||||
pub mod wine_component;
|
||||
|
||||
@ -6,37 +6,37 @@ use std::{
|
||||
};
|
||||
|
||||
use downloader::{progress::Reporter, Downloader};
|
||||
use flate2::read::GzDecoder;
|
||||
use log::debug;
|
||||
use tar::Archive;
|
||||
use wincompatlib::wine::ext::WineBootExt;
|
||||
use xz2::read::XzDecoder;
|
||||
|
||||
use super::component_downloader::ComponentDownloader;
|
||||
use crate::utils::github_requester::GithubRequester;
|
||||
|
||||
pub static PROTON_DEV: &str = "GloriousEggroll";
|
||||
pub static PROTON_REPO: &str = "proton-ge-custom";
|
||||
pub static WINE_DEV: &str = "Kron4ek";
|
||||
pub static WINE_REPO: &str = "Wine-Builds";
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct ProtonComponent {
|
||||
pub struct WineComponent {
|
||||
path: PathBuf,
|
||||
github_release_index: usize,
|
||||
}
|
||||
|
||||
impl GithubRequester for ProtonComponent {
|
||||
impl GithubRequester for WineComponent {
|
||||
fn set_github_release_index(&mut self, new_release_index: usize) {
|
||||
self.github_release_index = new_release_index;
|
||||
}
|
||||
}
|
||||
|
||||
impl ComponentDownloader for ProtonComponent {
|
||||
impl ComponentDownloader for WineComponent {
|
||||
async fn install<P: Reporter + 'static>(&self, progress: Option<Arc<P>>) -> anyhow::Result<()> {
|
||||
let file_output = self
|
||||
.download(
|
||||
&self
|
||||
.path
|
||||
.parent()
|
||||
.expect("Failed to get the parent directory of Wine")
|
||||
.expect("Failed to get the parent directory of wine")
|
||||
.to_path_buf(),
|
||||
progress,
|
||||
)
|
||||
@ -52,7 +52,7 @@ impl ComponentDownloader for ProtonComponent {
|
||||
progress: Option<Arc<P>>,
|
||||
) -> anyhow::Result<PathBuf> {
|
||||
let release =
|
||||
Self::get_github_release_version(PROTON_DEV, PROTON_REPO, self.github_release_index)
|
||||
Self::get_github_release_version(WINE_DEV, WINE_REPO, self.github_release_index)
|
||||
.await?;
|
||||
|
||||
let asset = release
|
||||
@ -79,12 +79,12 @@ impl ComponentDownloader for ProtonComponent {
|
||||
async fn uncompress(file: PathBuf, new_directory_name: PathBuf) -> anyhow::Result<()> {
|
||||
tokio::task::spawn_blocking(move || {
|
||||
let tar_xz = File::open(file.clone()).unwrap();
|
||||
let tar = GzDecoder::new(tar_xz);
|
||||
let tar = XzDecoder::new(tar_xz);
|
||||
let mut archive = Archive::new(tar);
|
||||
archive.unpack(new_directory_name.parent().unwrap())?;
|
||||
remove_file(file.clone())?;
|
||||
rename(
|
||||
file.to_str().unwrap().strip_suffix(".tar.gz").unwrap(),
|
||||
file.to_str().unwrap().strip_suffix(".tar.xz").unwrap(),
|
||||
new_directory_name,
|
||||
)?;
|
||||
|
||||
@ -96,49 +96,48 @@ impl ComponentDownloader for ProtonComponent {
|
||||
}
|
||||
}
|
||||
|
||||
impl ProtonComponent {
|
||||
impl WineComponent {
|
||||
pub fn new(path: PathBuf) -> Self {
|
||||
ProtonComponent {
|
||||
path: path.join("proton"),
|
||||
WineComponent {
|
||||
path: path.join("wine"),
|
||||
github_release_index: 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn init_proton(&self) -> Result<wincompatlib::prelude::Proton, String> {
|
||||
pub fn init_wine(&self) -> Result<wincompatlib::prelude::Wine, String> {
|
||||
let prefix = self.path.parent().unwrap().join("data");
|
||||
let wine_bin_location = self.path.join("bin/wine");
|
||||
debug!("Initializing prefix with -> {:?}", prefix);
|
||||
debug!("Wine binary path : {:?}", wine_bin_location);
|
||||
|
||||
let mut proton =
|
||||
wincompatlib::prelude::Proton::new(self.path.clone(), Some(prefix.clone()));
|
||||
let steam_location = Self::get_steam_location()?;
|
||||
let mut wine = wincompatlib::prelude::Wine::from_binary(wine_bin_location);
|
||||
wine.prefix = prefix.clone();
|
||||
|
||||
debug!("Steam location used -> {:?}", steam_location);
|
||||
wine.init_prefix(Some(prefix)).unwrap();
|
||||
|
||||
proton.steam_client_path = Some(steam_location);
|
||||
proton.init_prefix(Some(prefix)).unwrap();
|
||||
|
||||
Ok(proton)
|
||||
Ok(wine)
|
||||
}
|
||||
|
||||
fn get_steam_location() -> Result<PathBuf, String> {
|
||||
let specified_steam_location = std::env::var("BT_STEAM_CLIENT_PATH");
|
||||
if let Ok(location) = specified_steam_location {
|
||||
return Ok(PathBuf::from(location));
|
||||
}
|
||||
//fn get_steam_location() -> Result<PathBuf, String> {
|
||||
// let specified_steam_location = std::env::var("BT_STEAM_CLIENT_PATH");
|
||||
// if let Ok(location) = specified_steam_location {
|
||||
// return Ok(PathBuf::from(location));
|
||||
// }
|
||||
|
||||
let location_to_check = [
|
||||
dirs::home_dir().unwrap().join(".steam/steam"),
|
||||
dirs::home_dir()
|
||||
.unwrap()
|
||||
.join(".var/app/com.valvesoftware.Steam/steam"), // for the flatpak version of steam
|
||||
];
|
||||
// let location_to_check = [
|
||||
// dirs::home_dir().unwrap().join(".steam/steam"),
|
||||
// dirs::home_dir()
|
||||
// .unwrap()
|
||||
// .join(".var/app/com.valvesoftware.Steam/steam"), // for the flatpak version of steam
|
||||
// ];
|
||||
|
||||
for location in location_to_check {
|
||||
if location.exists() {
|
||||
return Ok(location);
|
||||
}
|
||||
}
|
||||
// for location in location_to_check {
|
||||
// if location.exists() {
|
||||
// return Ok(location);
|
||||
// }
|
||||
// }
|
||||
|
||||
debug!("Can't find steam installation");
|
||||
Err(String::from_str("We can't find your steam installation, please install steam in '~/.steam/steam' or specify your steam installation").unwrap())
|
||||
}
|
||||
// debug!("Can't find steam installation");
|
||||
// Err(String::from_str("We can't find your steam installation, please install steam in '~/.steam/steam' or specify your steam installation").unwrap())
|
||||
//}
|
||||
}
|
||||
@ -18,6 +18,7 @@ pub struct GameConfig {
|
||||
pub is_game_installed: bool,
|
||||
pub is_game_patched: bool,
|
||||
pub launch_options: Option<String>,
|
||||
pub launcher_version: Option<String>,
|
||||
}
|
||||
|
||||
impl GameConfig {
|
||||
@ -100,6 +101,7 @@ impl Default for GameConfig {
|
||||
is_game_installed: false,
|
||||
is_game_patched: false,
|
||||
launch_options: None,
|
||||
launcher_version: Some(env!("CARGO_PKG_VERSION").to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ use wincompatlib::prelude::*;
|
||||
use crate::{
|
||||
components::{
|
||||
component_downloader::ComponentDownloader, dxvk_component::DXVKComponent,
|
||||
game_component::GameComponent, proton_component::ProtonComponent,
|
||||
game_component::GameComponent, wine_component::WineComponent,
|
||||
},
|
||||
game_config::GameConfig,
|
||||
game_patcher,
|
||||
@ -46,11 +46,11 @@ impl GameManager {
|
||||
config_dir: PathBuf,
|
||||
release_index: usize,
|
||||
progress: Option<Arc<P>>,
|
||||
) -> anyhow::Result<ProtonComponent>
|
||||
) -> anyhow::Result<WineComponent>
|
||||
where
|
||||
P: Reporter + 'static,
|
||||
{
|
||||
let mut wine_component = ProtonComponent::new(config_dir);
|
||||
let mut wine_component = WineComponent::new(config_dir);
|
||||
wine_component.set_github_release_index(release_index);
|
||||
|
||||
wine_component.install(progress).await?;
|
||||
@ -63,7 +63,7 @@ impl GameManager {
|
||||
}
|
||||
|
||||
pub async fn install_dxvk<P>(
|
||||
proton: &Proton,
|
||||
wine: &Wine,
|
||||
config_dir: PathBuf,
|
||||
release_index: usize,
|
||||
progress: Option<Arc<P>>,
|
||||
@ -71,7 +71,7 @@ impl GameManager {
|
||||
where
|
||||
P: Reporter + 'static,
|
||||
{
|
||||
let mut dxvk_component = DXVKComponent::from_wine(proton.wine(), config_dir);
|
||||
let mut dxvk_component = DXVKComponent::from_wine(wine, config_dir);
|
||||
dxvk_component.set_github_release_index(release_index);
|
||||
|
||||
dxvk_component.install(progress).await?;
|
||||
@ -83,15 +83,10 @@ impl GameManager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn install_font<P>(proton: &Proton, progress: Option<Arc<P>>) -> anyhow::Result<()>
|
||||
pub async fn install_font<P>(wine: &Wine, progress: Option<Arc<P>>) -> anyhow::Result<()>
|
||||
where
|
||||
P: Reporter + 'static,
|
||||
{
|
||||
let wine_with_proton_prefix = proton // wine take the data/wine/pfx prefix, but we want the data/wine prefix
|
||||
.wine()
|
||||
.clone()
|
||||
.with_prefix(proton.wine().prefix.parent().unwrap());
|
||||
|
||||
let max = 1;
|
||||
|
||||
if let Some(p) = &progress {
|
||||
@ -100,7 +95,7 @@ impl GameManager {
|
||||
|
||||
notify_fonts_progress(0, max, &progress);
|
||||
|
||||
wine_with_proton_prefix.install_font(Font::Arial)?;
|
||||
wine.install_font(Font::Arial)?;
|
||||
notify_fonts_progress(1, max, &progress);
|
||||
|
||||
let mut config = GameConfig::get_config().await;
|
||||
@ -110,13 +105,8 @@ impl GameManager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn install_dependencies(proton: &Proton) -> anyhow::Result<()> {
|
||||
let wine_with_proton_prefix = proton // wine take the data/wine/pfx prefix, but we want the data/wine prefix
|
||||
.wine()
|
||||
.clone()
|
||||
.with_prefix(proton.wine().prefix.parent().unwrap());
|
||||
|
||||
let winetricks = Winetricks::from_wine("/bin/winetricks", wine_with_proton_prefix);
|
||||
pub async fn install_dependencies(wine: &Wine) -> anyhow::Result<()> {
|
||||
let winetricks = Winetricks::from_wine("/bin/winetricks", wine);
|
||||
//winetricks.install("corefonts")?;
|
||||
let mut child = winetricks.install("vcrun2022")?;
|
||||
|
||||
@ -165,26 +155,26 @@ impl GameManager {
|
||||
}
|
||||
|
||||
pub async fn start_game(
|
||||
proton: &Proton,
|
||||
wine: &Wine,
|
||||
game_dir: PathBuf,
|
||||
options: Option<String>,
|
||||
env_variables: Vec<EnvironmentVariable>,
|
||||
show_logs: bool,
|
||||
) -> anyhow::Result<()> {
|
||||
let proton_version = proton.wine().version()?;
|
||||
let wine_version = wine.version()?;
|
||||
let binary_path = game_dir
|
||||
.join(get_game_name())
|
||||
.join(get_game_name_with_executable());
|
||||
|
||||
debug!("Wine version : {:?}", proton_version);
|
||||
debug!("wine version : {:?}", wine_version);
|
||||
|
||||
let mut child = if let Some(custom_command) = options {
|
||||
Self::run(proton, binary_path, Some(custom_command), env_variables).await?
|
||||
Self::run(wine, binary_path, Some(custom_command), env_variables).await?
|
||||
} else {
|
||||
if let Some(custom_command) = GameConfig::get_launch_options().await.unwrap() {
|
||||
Self::run(proton, binary_path, Some(custom_command), env_variables).await?
|
||||
Self::run(wine, binary_path, Some(custom_command), env_variables).await?
|
||||
} else {
|
||||
Self::run(proton, binary_path, None, env_variables).await?
|
||||
Self::run(wine, binary_path, None, env_variables).await?
|
||||
}
|
||||
}?;
|
||||
|
||||
@ -205,7 +195,7 @@ impl GameManager {
|
||||
.lines()
|
||||
.inspect(|s| {
|
||||
if let Ok(str) = s {
|
||||
info!("[Proton] > {}", str);
|
||||
info!("[wine] > {}", str);
|
||||
stdout_save.push_str(str);
|
||||
}
|
||||
})
|
||||
@ -219,7 +209,7 @@ impl GameManager {
|
||||
.lines()
|
||||
.inspect(|s| {
|
||||
if let Ok(str) = s {
|
||||
info!("[Proton] > {}", str);
|
||||
info!("[wine] > {}", str);
|
||||
stderr_save.push_str(str);
|
||||
}
|
||||
})
|
||||
@ -292,21 +282,31 @@ impl GameManager {
|
||||
}
|
||||
|
||||
async fn run(
|
||||
proton: &Proton,
|
||||
wine: &Wine,
|
||||
binary_path: PathBuf,
|
||||
custom_command: Option<String>,
|
||||
env_variables: Vec<EnvironmentVariable>,
|
||||
) -> anyhow::Result<Result<Child, std::io::Error>> {
|
||||
let mut command: Vec<&str> = vec![];
|
||||
|
||||
let proton_path = GameConfig::get_config_directory()
|
||||
let wine_path = GameConfig::get_config_directory()
|
||||
.await
|
||||
.join("proton")
|
||||
.join("proton");
|
||||
.join("wine")
|
||||
.join("bin")
|
||||
.join("wine");
|
||||
let mut wine_path = wine_path.to_str().unwrap();
|
||||
|
||||
command.push(proton.python.to_str().unwrap());
|
||||
command.push(proton_path.to_str().unwrap());
|
||||
command.push("run");
|
||||
if let Some(distro) = whatadistro::identify() {
|
||||
if distro.is_similar("nixos") {
|
||||
wine_path = "wine";
|
||||
|
||||
info!("Nixos detected, using system Wine...");
|
||||
};
|
||||
};
|
||||
|
||||
//command.push(wine.python.to_str().unwrap());
|
||||
command.push(wine_path);
|
||||
//command.push("run");
|
||||
command.push(binary_path.to_str().unwrap());
|
||||
|
||||
let launch_option;
|
||||
@ -334,11 +334,14 @@ impl GameManager {
|
||||
}
|
||||
|
||||
debug!("Command preview -> {}", command.join(" "));
|
||||
debug!(
|
||||
"Command envs -> {:?}",
|
||||
wine.get_envs()["WINEPREFIX"].clone()
|
||||
);
|
||||
|
||||
Ok(Command::new(command[0])
|
||||
.args(&command[1..command.len()])
|
||||
.envs(proton.get_envs())
|
||||
.env("PROTON_LOG", "1")
|
||||
.env("WINE_PREFIX", wine.get_envs()["WINEPREFIX"].clone())
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
|
||||
@ -58,29 +58,29 @@ pub async fn patch_game(game_dir: PathBuf) -> anyhow::Result<()> {
|
||||
|
||||
// section to replace the executable with the patched one
|
||||
|
||||
let executable_path = game_dir
|
||||
.join(get_game_name())
|
||||
.join(get_game_name_with_executable());
|
||||
//let executable_path = game_dir
|
||||
// .join(get_game_name())
|
||||
// .join(get_game_name_with_executable());
|
||||
|
||||
debug!("{:?}", executable_path);
|
||||
//debug!("{:?}", executable_path);
|
||||
|
||||
if executable_path.exists() {
|
||||
remove_file(executable_path.clone()).await?;
|
||||
}
|
||||
//if executable_path.exists() {
|
||||
// remove_file(executable_path.clone()).await?;
|
||||
//}
|
||||
|
||||
match PatchedGameExecutable::get_exectable() {
|
||||
Some(exe) => {
|
||||
let mut file = File::create(executable_path).await?;
|
||||
//match PatchedGameExecutable::get_exectable() {
|
||||
// Some(exe) => {
|
||||
// let mut file = File::create(executable_path).await?;
|
||||
|
||||
let data: Result<Vec<_>, _> = exe.data.bytes().collect();
|
||||
let data = data.expect("Unable to read executable data");
|
||||
// let data: Result<Vec<_>, _> = exe.data.bytes().collect();
|
||||
// let data = data.expect("Unable to read executable data");
|
||||
|
||||
file.write_all(&data).await?;
|
||||
}
|
||||
None => anyhow::bail!(
|
||||
"Game executable not included in the binary! Please report this to the developer!"
|
||||
),
|
||||
}
|
||||
// file.write_all(&data).await?;
|
||||
// }
|
||||
// None => anyhow::bail!(
|
||||
// "Game executable not included in the binary! Please report this to the developer!"
|
||||
// ),
|
||||
//}
|
||||
|
||||
let mut config = GameConfig::get_config().await;
|
||||
config.is_game_patched = true;
|
||||
|
||||
@ -2,7 +2,7 @@ use crate::{game_config::GameConfig, utils::kuro_prod_api::GameInfo};
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
pub enum GameState {
|
||||
ProtonNotInstalled,
|
||||
WineNotInstalled,
|
||||
DXVKNotInstalled,
|
||||
FontNotInstalled,
|
||||
DependecieNotInstalled,
|
||||
@ -17,7 +17,7 @@ impl GameState {
|
||||
let config = GameConfig::get_config().await;
|
||||
|
||||
if !config.is_wine_installed {
|
||||
return Ok(GameState::ProtonNotInstalled);
|
||||
return Ok(GameState::WineNotInstalled);
|
||||
}
|
||||
|
||||
if !config.is_dxvk_installed {
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
use std::io;
|
||||
|
||||
use log::debug;
|
||||
use tokio::fs::remove_dir_all;
|
||||
|
||||
use crate::game_config::GameConfig;
|
||||
|
||||
pub mod github_requester;
|
||||
pub mod kuro_prod_api;
|
||||
|
||||
@ -8,3 +15,11 @@ pub fn get_game_name() -> String {
|
||||
pub fn get_game_name_with_executable() -> String {
|
||||
format!("{}.exe", get_game_name())
|
||||
}
|
||||
|
||||
pub async fn remove_setup() -> io::Result<()> {
|
||||
let config_dir = GameConfig::get_config_directory().await;
|
||||
|
||||
debug!("Current setup directory : {:?}", config_dir);
|
||||
|
||||
remove_dir_all(config_dir).await
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user