mirror of
https://github.com/ALEZ-DEV/Babylonia-terminal.git
synced 2025-12-15 17:08:51 +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]
|
||||
async fn main() {
|
||||
SimpleLogger::new()
|
||||
let simple_logger = SimpleLogger::new()
|
||||
.with_module_level("hyper", LevelFilter::Off)
|
||||
.with_module_level("hyper_util", LevelFilter::Off)
|
||||
.with_module_level("tracing", LevelFilter::Off)
|
||||
.with_module_level("rustls", LevelFilter::Off)
|
||||
.with_module_level("minreq", LevelFilter::Off)
|
||||
.with_module_level("tokio_utils", LevelFilter::Off)
|
||||
.init()
|
||||
.unwrap();
|
||||
.with_module_level("tokio_utils", LevelFilter::Off);
|
||||
|
||||
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: Option<Proton> = None;
|
||||
@ -27,9 +31,7 @@ async fn main() {
|
||||
loop {
|
||||
let state = GameState::get_current_state().await;
|
||||
|
||||
if GameState::get_current_state().await != GameState::WineNotInstalled
|
||||
&& proton_component == None
|
||||
{
|
||||
if state != GameState::WineNotInstalled && proton == None {
|
||||
let proton_component =
|
||||
ProtonComponent::new(GameState::get_config_directory().join("wine"));
|
||||
match proton_component.init_proton() {
|
||||
@ -53,6 +55,7 @@ async fn main() {
|
||||
}
|
||||
GameState::DXVKNotInstalled => {
|
||||
info!("DXVK not installed, installing it...");
|
||||
debug!("{:?}", proton_component);
|
||||
GameManager::install_dxvk(
|
||||
&proton.clone().unwrap(),
|
||||
GameState::get_config_directory(),
|
||||
|
||||
@ -7,7 +7,10 @@ use downloader::{Download, Downloader};
|
||||
use flate2::read::GzDecoder;
|
||||
use tar::Archive;
|
||||
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;
|
||||
|
||||
@ -40,7 +43,12 @@ impl<'a> ComponentDownloader for DXVKComponent<'a> {
|
||||
|
||||
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())
|
||||
.expect("Failed to installed DXVK");
|
||||
|
||||
|
||||
@ -95,14 +95,6 @@ impl ProtonComponent {
|
||||
}
|
||||
|
||||
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 steam_location = dirs::home_dir().unwrap().join(".steam/steam");
|
||||
if !steam_location.exists() {
|
||||
|
||||
@ -22,7 +22,6 @@ use crate::{
|
||||
game_component::GameComponent,
|
||||
proton_component::ProtonComponent,
|
||||
},
|
||||
components_downloader::ComponentsDownloader,
|
||||
game_state::GameState,
|
||||
};
|
||||
|
||||
@ -76,37 +75,42 @@ impl GameManager {
|
||||
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());
|
||||
|
||||
progress.setup(Some(10), "");
|
||||
progress.progress(0);
|
||||
|
||||
proton.install_font(Font::Arial)?;
|
||||
wine_with_proton_prefix.install_font(Font::Arial)?;
|
||||
progress.progress(1);
|
||||
|
||||
proton.install_font(Font::Andale)?;
|
||||
wine_with_proton_prefix.install_font(Font::Andale)?;
|
||||
progress.progress(2);
|
||||
|
||||
proton.install_font(Font::Courier)?;
|
||||
wine_with_proton_prefix.install_font(Font::Courier)?;
|
||||
progress.progress(3);
|
||||
|
||||
proton.install_font(Font::ComicSans)?;
|
||||
wine_with_proton_prefix.install_font(Font::ComicSans)?;
|
||||
progress.progress(4);
|
||||
|
||||
proton.install_font(Font::Georgia)?;
|
||||
wine_with_proton_prefix.install_font(Font::Georgia)?;
|
||||
progress.progress(5);
|
||||
|
||||
proton.install_font(Font::Impact)?;
|
||||
wine_with_proton_prefix.install_font(Font::Impact)?;
|
||||
progress.progress(6);
|
||||
|
||||
proton.install_font(Font::Times)?;
|
||||
wine_with_proton_prefix.install_font(Font::Times)?;
|
||||
progress.progress(7);
|
||||
|
||||
proton.install_font(Font::Trebuchet)?;
|
||||
wine_with_proton_prefix.install_font(Font::Trebuchet)?;
|
||||
progress.progress(8);
|
||||
|
||||
proton.install_font(Font::Verdana)?;
|
||||
wine_with_proton_prefix.install_font(Font::Verdana)?;
|
||||
progress.progress(9);
|
||||
|
||||
proton.install_font(Font::Webdings)?;
|
||||
wine_with_proton_prefix.install_font(Font::Webdings)?;
|
||||
progress.progress(10);
|
||||
|
||||
let mut config = GameState::get_config().await?;
|
||||
@ -117,8 +121,13 @@ impl GameManager {
|
||||
}
|
||||
|
||||
pub async fn install_dependecies(proton: &Proton) -> anyhow::Result<()> {
|
||||
let winetricks = Winetricks::from_wine("winetricks", proton.wine());
|
||||
winetricks.install("corefonts")?;
|
||||
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);
|
||||
//winetricks.install("corefonts")?;
|
||||
winetricks.install("vcrun2022")?;
|
||||
|
||||
let mut config = GameState::get_config().await?;
|
||||
@ -147,18 +156,6 @@ impl GameManager {
|
||||
pub async fn start_game(proton: &Proton, game_dir: PathBuf) {
|
||||
debug!("Wine version : {:?}", proton.wine().version().unwrap());
|
||||
let mut child = proton.run(game_dir.join("PGR.exe")).unwrap();
|
||||
|
||||
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;
|
||||
child.wait().expect("The game failed to run");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
pub mod components;
|
||||
pub mod components_downloader;
|
||||
pub mod game_manager;
|
||||
pub mod game_state;
|
||||
pub mod utils;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user