- updated core library to 0.1.3
- added soda wine version
- added default patch servers for config file
- with core modifications now first run window
  finally works
This commit is contained in:
Observer KRypt0n_ 2022-07-28 09:39:24 +02:00
parent 0f6ebfff55
commit ecb5094785
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
7 changed files with 207 additions and 51 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "anime-game-launcher"
version = "0.1.1"
version = "0.2.0"
description = "Anime Game launcher"
authors = ["Nikita Podvirnyy <suimin.tu.mu.ga.mi@gmail.com>"]
license = "GPL-3.0"

@ -1 +1 @@
Subproject commit f5c91f01561cd12873e92bb51b37c7d68ca0cd99
Subproject commit 33893a336d4051e14ce6ed1da81a18910f0a82b0

View file

@ -255,6 +255,53 @@ Adw.ApplicationWindow window {
}
}
}
// Fourth page (downloading finished)
Gtk.Box fourth_page {
orientation: vertical;
hexpand: true;
Adw.PreferencesPage {
Adw.PreferencesGroup {
Gtk.Label {
label: "Downloading finished!";
margin-top: 16;
styles ["title-1"]
}
Gtk.Label {
label: "All the basic components were downloaded. Now you can restart the launcher and download the game. Welcome to our club!";
wrap: true;
justify: center;
margin-top: 32;
}
}
Adw.PreferencesGroup {
vexpand: true;
valign: center;
Gtk.Box {
orientation: horizontal;
spacing: 8;
halign: center;
Gtk.Button fourth_page_restart {
label: "Restart";
styles ["suggested-action"]
}
Gtk.Button fourth_page_exit {
label: "Exit";
}
}
}
}
}
}
Adw.CarouselIndicatorDots {

View file

@ -492,6 +492,51 @@
}
]
},
{
"title": "Soda",
"subtitle": "New runner based on Valves Wine, with patches from Proton, TKG and GE. Developed by Bottles",
"versions": [
{
"family": "Soda",
"name": "soda-7.0-2-x86_64",
"title": "Soda 7.0-2",
"uri": "https://github.com/bottlesdevs/wine/releases/download/soda-7.0-2/soda-7.0-2-x86_64.tar.xz",
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
},
{
"family": "Soda",
"name": "soda-7.0-1-x86_64",
"title": "Soda 7.0-1",
"uri": "https://github.com/bottlesdevs/wine/releases/download/soda-7.0-1/soda-7.0-1-x86_64.tar.xz",
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
},
{
"family": "Soda",
"name": "soda-7.0-x86_64",
"title": "Soda 7.0",
"uri": "https://github.com/bottlesdevs/wine/releases/download/soda-7.0/soda-7.0-x86_64.tar.xz",
"files": {
"wine": "bin/wine64",
"wineserver": "bin/wineserver",
"wineboot": "bin/wineboot",
"winecfg": "lib/wine/x86_64-windows/winecfg.exe"
},
"recommended": true
}
]
},
{
"title": "Lutris",
"subtitle": null,

View file

@ -197,7 +197,10 @@ impl Default for Patch {
Some(dir) => format!("{}/patch", dir),
None => String::new()
},
servers: Vec::new()
servers: vec![
"https://notabug.org/Krock/dawn".to_string(),
"https://dev.kaifa.ch/Maroxy/dawn".to_string()
]
}
}
}

View file

@ -6,7 +6,8 @@ use gtk::glib;
use std::io::Error;
use anime_game_core::prelude::*;
use wait_not_await::Await;
use crate::lib::prettify_bytes::prettify_bytes;
#[derive(Debug)]
pub enum ProgressUpdateResult {
@ -56,13 +57,23 @@ impl ProgressBar {
InstallerUpdate::DownloadingProgress(curr, total) => {
let progress = curr as f64 / total as f64;
self.update(progress, None);
self.update(progress, Some(&format!(
"Downloading: {:.2}% ({} of {})",
progress * 100.0,
prettify_bytes(curr),
prettify_bytes(total)
)));
}
InstallerUpdate::UnpackingProgress(curr, total) => {
let progress = curr as f64 / total as f64;
self.update(progress, None);
self.update(progress, Some(&format!(
"Unpacking: {:.2}% ({} of {})",
progress * 100.0,
prettify_bytes(curr),
prettify_bytes(total)
)));
}
InstallerUpdate::DownloadingFinished => (),

View file

@ -45,7 +45,12 @@ pub struct AppWidgets {
pub third_page_download: gtk::Button,
pub third_page_exit: gtk::Button,
pub third_page_progress_bar: ProgressBar
pub third_page_progress_bar: ProgressBar,
// Fourth page
pub fourth_page: gtk::Box,
pub fourth_page_restart: gtk::Button,
pub fourth_page_exit: gtk::Button
}
impl AppWidgets {
@ -79,6 +84,11 @@ impl AppWidgets {
get_object(&builder, "third_page_buttons_group")?,
get_object(&builder, "third_page_progress_bar_group")?
),
// Fourth page
fourth_page: get_object(&builder, "fourth_page")?,
fourth_page_restart: get_object(&builder, "fourth_page_restart")?,
fourth_page_exit: get_object(&builder, "fourth_page_exit")?
})
}
}
@ -93,6 +103,8 @@ pub enum Actions {
FirstPageContinue,
SecondPageContinue,
ThirdPageDownload,
ThirdPageContinue,
FourthPageRestart,
Exit
}
@ -151,9 +163,11 @@ impl App {
self.widgets.first_page_continue.connect_clicked(Actions::FirstPageContinue.into_fn(&self));
self.widgets.second_page_continue.connect_clicked(Actions::SecondPageContinue.into_fn(&self));
self.widgets.third_page_download.connect_clicked(Actions::ThirdPageDownload.into_fn(&self));
self.widgets.fourth_page_restart.connect_clicked(Actions::FourthPageRestart.into_fn(&self));
self.widgets.second_page_exit.connect_clicked(Actions::Exit.into_fn(&self));
self.widgets.third_page_exit.connect_clicked(Actions::Exit.into_fn(&self));
self.widgets.fourth_page_exit.connect_clicked(Actions::Exit.into_fn(&self));
self
}
@ -185,58 +199,94 @@ impl App {
this.widgets.third_page_progress_bar.show();
let this = this.clone();
let (sender, receiver) = glib::MainContext::channel::<InstallerUpdate>(glib::PRIORITY_DEFAULT);
let progress_bar = this.widgets.third_page_progress_bar.clone();
let wine_version = WineVersion::latest().unwrap();
let dxvk_version = DxvkVersion::latest().unwrap();
let wine_version_copy = wine_version.clone();
// Download wine
std::thread::spawn(move || {
let config = config::get().unwrap();
let wine_version = WineVersion::latest().unwrap();
let dxvk_version = DxvkVersion::latest().unwrap();
let mut wine_version_installer = Installer::new(&wine_version.uri).unwrap();
let progress_bar = this.widgets.third_page_progress_bar.clone();
let mut wine_version_installer = Installer::new(&wine_version_copy.uri).unwrap();
wine_version_installer.install(&config.game.wine.builds, move |state| {
match progress_bar.update_from_state(state) {
ProgressUpdateResult::Updated => (),
ProgressUpdateResult::Error(_, _) => todo!(),
ProgressUpdateResult::Finished => {
let mut config = config::get().unwrap();
let prefix = WinePrefix::new(&config.game.wine.prefix);
config.game.wine.selected = Some(wine_version.name.clone());
config::update_raw(config.clone()).unwrap();
prefix.update(&config.game.wine.builds, wine_version.clone()).unwrap();
let mut dxvk_version_installer = Installer::new(&dxvk_version.uri).unwrap();
let dxvk_version = dxvk_version.clone();
let progress_bar = progress_bar.clone();
dxvk_version_installer.install(&config.game.dxvk.builds, move |state| {
match progress_bar.update_from_state(state) {
ProgressUpdateResult::Updated => (),
ProgressUpdateResult::Error(_, _) => todo!(),
ProgressUpdateResult::Finished => {
let mut config = config::get().unwrap();
config.game.dxvk.selected = Some(dxvk_version.name.clone());
config::update_raw(config.clone()).unwrap();
println!("Done!!");
}
}
});
}
}
sender.send(state).unwrap();
});
});
let this = this.clone();
// Download wine (had to do so this way)
receiver.attach(None, move |state| {
match progress_bar.update_from_state(state) {
ProgressUpdateResult::Updated => (),
ProgressUpdateResult::Error(_, _) => todo!(),
ProgressUpdateResult::Finished => {
let mut config = config::get().unwrap();
let prefix = WinePrefix::new(&config.game.wine.prefix);
// Update wine config
config.game.wine.selected = Some(wine_version.name.clone());
config::update_raw(config.clone()).unwrap();
// Create wine prefix
prefix.update(&config.game.wine.builds, wine_version.clone()).unwrap();
// Prepare DXVK downloader
let mut dxvk_version_installer = Installer::new(&dxvk_version.uri).unwrap();
let dxvk_version = dxvk_version.clone();
let progress_bar = progress_bar.clone();
let this = this.clone();
// Download DXVK
dxvk_version_installer.install(&config.game.dxvk.builds, move |state| {
match progress_bar.update_from_state(state) {
ProgressUpdateResult::Updated => (),
ProgressUpdateResult::Error(_, _) => todo!(),
ProgressUpdateResult::Finished => {
let mut config = config::get().unwrap();
// Apply DXVK
println!("{}", dxvk_version.apply(&config.game.dxvk.builds, &config.game.wine.prefix).unwrap());
// Update dxvk config
config.game.dxvk.selected = Some(dxvk_version.name.clone());
config::update_raw(config.clone()).unwrap();
// Remove .first-run file
let launcher_dir = crate::lib::consts::launcher_dir().unwrap();
std::fs::remove_file(format!("{}/.first-run", launcher_dir)).unwrap();
// Show next page
this.update(Actions::ThirdPageContinue).unwrap();
}
}
});
}
}
glib::Continue(true)
});
}
Actions::ThirdPageContinue => {
this.widgets.carousel.scroll_to(&this.widgets.fourth_page, true);
}
// FIXME
Actions::FourthPageRestart => {
this.widgets.window.close();
}
Actions::Exit => {