mirror of
https://github.com/ALEZ-DEV/Babylonia-terminal.git
synced 2026-03-21 21:58:52 +00:00
check all installation process and fix the issues
This commit is contained in:
parent
e671b1eb79
commit
19e4088b1d
@ -11,15 +11,19 @@ use crate::reporter::DownloadReporter;
|
|||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
SimpleLogger::new()
|
let simple_logger = SimpleLogger::new()
|
||||||
.with_module_level("hyper", LevelFilter::Off)
|
.with_module_level("hyper", LevelFilter::Off)
|
||||||
.with_module_level("hyper_util", LevelFilter::Off)
|
.with_module_level("hyper_util", LevelFilter::Off)
|
||||||
.with_module_level("tracing", LevelFilter::Off)
|
.with_module_level("tracing", LevelFilter::Off)
|
||||||
.with_module_level("rustls", LevelFilter::Off)
|
.with_module_level("rustls", LevelFilter::Off)
|
||||||
.with_module_level("minreq", LevelFilter::Off)
|
.with_module_level("minreq", LevelFilter::Off)
|
||||||
.with_module_level("tokio_utils", LevelFilter::Off)
|
.with_module_level("tokio_utils", LevelFilter::Off);
|
||||||
.init()
|
|
||||||
.unwrap();
|
if cfg!(debug_assertions) {
|
||||||
|
simple_logger.init().unwrap();
|
||||||
|
} else {
|
||||||
|
simple_logger.with_level(LevelFilter::Info).init().unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
let mut proton_component: Option<ProtonComponent> = None;
|
let mut proton_component: Option<ProtonComponent> = None;
|
||||||
let mut proton: Option<Proton> = None;
|
let mut proton: Option<Proton> = None;
|
||||||
@ -27,9 +31,7 @@ async fn main() {
|
|||||||
loop {
|
loop {
|
||||||
let state = GameState::get_current_state().await;
|
let state = GameState::get_current_state().await;
|
||||||
|
|
||||||
if GameState::get_current_state().await != GameState::WineNotInstalled
|
if state != GameState::WineNotInstalled && proton == None {
|
||||||
&& proton_component == None
|
|
||||||
{
|
|
||||||
let proton_component =
|
let proton_component =
|
||||||
ProtonComponent::new(GameState::get_config_directory().join("wine"));
|
ProtonComponent::new(GameState::get_config_directory().join("wine"));
|
||||||
match proton_component.init_proton() {
|
match proton_component.init_proton() {
|
||||||
@ -53,6 +55,7 @@ async fn main() {
|
|||||||
}
|
}
|
||||||
GameState::DXVKNotInstalled => {
|
GameState::DXVKNotInstalled => {
|
||||||
info!("DXVK not installed, installing it...");
|
info!("DXVK not installed, installing it...");
|
||||||
|
debug!("{:?}", proton_component);
|
||||||
GameManager::install_dxvk(
|
GameManager::install_dxvk(
|
||||||
&proton.clone().unwrap(),
|
&proton.clone().unwrap(),
|
||||||
GameState::get_config_directory(),
|
GameState::get_config_directory(),
|
||||||
|
|||||||
@ -7,7 +7,10 @@ use downloader::{Download, Downloader};
|
|||||||
use flate2::read::GzDecoder;
|
use flate2::read::GzDecoder;
|
||||||
use tar::Archive;
|
use tar::Archive;
|
||||||
use tokio::fs::remove_dir_all;
|
use tokio::fs::remove_dir_all;
|
||||||
use wincompatlib::{dxvk::InstallParams, wine::Wine};
|
use wincompatlib::{
|
||||||
|
dxvk::InstallParams,
|
||||||
|
wine::{ext::WineWithExt, Wine},
|
||||||
|
};
|
||||||
|
|
||||||
use crate::utils::github_requester::GithubRequester;
|
use crate::utils::github_requester::GithubRequester;
|
||||||
|
|
||||||
@ -40,7 +43,12 @@ impl<'a> ComponentDownloader for DXVKComponent<'a> {
|
|||||||
|
|
||||||
Self::uncompress(file_output.clone(), self.path.clone()).await?;
|
Self::uncompress(file_output.clone(), self.path.clone()).await?;
|
||||||
|
|
||||||
self.wine
|
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
|
||||||
.install_dxvk(self.path.clone(), InstallParams::default())
|
.install_dxvk(self.path.clone(), InstallParams::default())
|
||||||
.expect("Failed to installed DXVK");
|
.expect("Failed to installed DXVK");
|
||||||
|
|
||||||
|
|||||||
@ -95,14 +95,6 @@ impl ProtonComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn init_proton(&self) -> Result<wincompatlib::prelude::Proton, String> {
|
pub fn init_proton(&self) -> Result<wincompatlib::prelude::Proton, String> {
|
||||||
//let wine_path = self.path.join("files/bin/wine64");
|
|
||||||
//let wine_prefix = self.path.parent().unwrap().join("data");
|
|
||||||
//if !wine_prefix.exists() {
|
|
||||||
// create_dir(wine_prefix.clone()).unwrap()
|
|
||||||
//}
|
|
||||||
|
|
||||||
//let wine = wincompatlib::prelude::Wine::from_binary(wine_path);
|
|
||||||
//wine.update_prefix(Some(wine_prefix)).unwrap();
|
|
||||||
let prefix = self.path.parent().unwrap().join("data");
|
let prefix = self.path.parent().unwrap().join("data");
|
||||||
let steam_location = dirs::home_dir().unwrap().join(".steam/steam");
|
let steam_location = dirs::home_dir().unwrap().join(".steam/steam");
|
||||||
if !steam_location.exists() {
|
if !steam_location.exists() {
|
||||||
|
|||||||
@ -22,7 +22,6 @@ use crate::{
|
|||||||
game_component::GameComponent,
|
game_component::GameComponent,
|
||||||
proton_component::ProtonComponent,
|
proton_component::ProtonComponent,
|
||||||
},
|
},
|
||||||
components_downloader::ComponentsDownloader,
|
|
||||||
game_state::GameState,
|
game_state::GameState,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -76,37 +75,42 @@ impl GameManager {
|
|||||||
where
|
where
|
||||||
P: Reporter + 'static,
|
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());
|
||||||
|
|
||||||
progress.setup(Some(10), "");
|
progress.setup(Some(10), "");
|
||||||
progress.progress(0);
|
progress.progress(0);
|
||||||
|
|
||||||
proton.install_font(Font::Arial)?;
|
wine_with_proton_prefix.install_font(Font::Arial)?;
|
||||||
progress.progress(1);
|
progress.progress(1);
|
||||||
|
|
||||||
proton.install_font(Font::Andale)?;
|
wine_with_proton_prefix.install_font(Font::Andale)?;
|
||||||
progress.progress(2);
|
progress.progress(2);
|
||||||
|
|
||||||
proton.install_font(Font::Courier)?;
|
wine_with_proton_prefix.install_font(Font::Courier)?;
|
||||||
progress.progress(3);
|
progress.progress(3);
|
||||||
|
|
||||||
proton.install_font(Font::ComicSans)?;
|
wine_with_proton_prefix.install_font(Font::ComicSans)?;
|
||||||
progress.progress(4);
|
progress.progress(4);
|
||||||
|
|
||||||
proton.install_font(Font::Georgia)?;
|
wine_with_proton_prefix.install_font(Font::Georgia)?;
|
||||||
progress.progress(5);
|
progress.progress(5);
|
||||||
|
|
||||||
proton.install_font(Font::Impact)?;
|
wine_with_proton_prefix.install_font(Font::Impact)?;
|
||||||
progress.progress(6);
|
progress.progress(6);
|
||||||
|
|
||||||
proton.install_font(Font::Times)?;
|
wine_with_proton_prefix.install_font(Font::Times)?;
|
||||||
progress.progress(7);
|
progress.progress(7);
|
||||||
|
|
||||||
proton.install_font(Font::Trebuchet)?;
|
wine_with_proton_prefix.install_font(Font::Trebuchet)?;
|
||||||
progress.progress(8);
|
progress.progress(8);
|
||||||
|
|
||||||
proton.install_font(Font::Verdana)?;
|
wine_with_proton_prefix.install_font(Font::Verdana)?;
|
||||||
progress.progress(9);
|
progress.progress(9);
|
||||||
|
|
||||||
proton.install_font(Font::Webdings)?;
|
wine_with_proton_prefix.install_font(Font::Webdings)?;
|
||||||
progress.progress(10);
|
progress.progress(10);
|
||||||
|
|
||||||
let mut config = GameState::get_config().await?;
|
let mut config = GameState::get_config().await?;
|
||||||
@ -117,8 +121,13 @@ impl GameManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn install_dependecies(proton: &Proton) -> anyhow::Result<()> {
|
pub async fn install_dependecies(proton: &Proton) -> anyhow::Result<()> {
|
||||||
let winetricks = Winetricks::from_wine("winetricks", proton.wine());
|
let wine_with_proton_prefix = proton // wine take the data/wine/pfx prefix, but we want the data/wine prefix
|
||||||
winetricks.install("corefonts")?;
|
.wine()
|
||||||
|
.clone()
|
||||||
|
.with_prefix(proton.wine().prefix.parent().unwrap());
|
||||||
|
|
||||||
|
let winetricks = Winetricks::from_wine("/bin/winetricks", wine_with_proton_prefix);
|
||||||
|
//winetricks.install("corefonts")?;
|
||||||
winetricks.install("vcrun2022")?;
|
winetricks.install("vcrun2022")?;
|
||||||
|
|
||||||
let mut config = GameState::get_config().await?;
|
let mut config = GameState::get_config().await?;
|
||||||
@ -147,18 +156,6 @@ impl GameManager {
|
|||||||
pub async fn start_game(proton: &Proton, game_dir: PathBuf) {
|
pub async fn start_game(proton: &Proton, game_dir: PathBuf) {
|
||||||
debug!("Wine version : {:?}", proton.wine().version().unwrap());
|
debug!("Wine version : {:?}", proton.wine().version().unwrap());
|
||||||
let mut child = proton.run(game_dir.join("PGR.exe")).unwrap();
|
let mut child = proton.run(game_dir.join("PGR.exe")).unwrap();
|
||||||
|
child.wait().expect("The game failed to run");
|
||||||
tokio::task::spawn_blocking(move || {
|
|
||||||
let mut stdout = BufReader::new(child.stdout.as_mut().unwrap());
|
|
||||||
let mut line = String::new();
|
|
||||||
|
|
||||||
loop {
|
|
||||||
stdout.read_line(&mut line);
|
|
||||||
if !line.is_empty() {
|
|
||||||
debug!("{}", line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.await;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
pub mod components;
|
pub mod components;
|
||||||
pub mod components_downloader;
|
|
||||||
pub mod game_manager;
|
pub mod game_manager;
|
||||||
pub mod game_state;
|
pub mod game_state;
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user