Skip to content

Commit 4b5b056

Browse files
committed
astro_modloader: move app icon and version to app config
1 parent ac8fe82 commit 4b5b056

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

astro_modintegrator/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[package]
22
name = "astro_modintegrator"
33
authors = ["AstroTechies"]
4-
version = "0.1.2"
4+
version = "0.1.3"
55
edition = "2021"
66

77
[dependencies]
8-
unreal_modloader = { verison = "0.1.2", git = "https://github.com/AstroTechies/unrealmodding", features = ["bulk_data", "ue4_23"] }
8+
unreal_modloader = { verison = "0.1.3", git = "https://github.com/AstroTechies/unrealmodding", features = ["bulk_data", "ue4_23"] }
99
serde_json = "1.0.82"
1010
serde = { version = "1.0.140", features = ["derive"] }
1111
log = "0.4.17"

astro_modloader/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version = "0.1.1"
55
edition = "2021"
66

77
[dependencies]
8-
astro_modintegrator = { version = "0.1.2", path = "../astro_modintegrator" }
8+
astro_modintegrator = { version = "0.1.3", path = "../astro_modintegrator" }
99
image = "0.24.3"
1010
autoupdater = "0.1.5"
1111
serde_json = "1.0.82"

astro_modloader/src/main.rs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ use std::collections::BTreeMap;
55
use std::path::Path;
66

77
use astro_modintegrator::unreal_modintegrator::IntegratorConfig;
8-
use astro_modintegrator::unreal_modloader::config::{GameConfig, InstallManager};
8+
use astro_modintegrator::unreal_modloader::config::{GameConfig, IconData, InstallManager};
99
use astro_modintegrator::unreal_modloader::error::ModLoaderError;
1010
use astro_modintegrator::unreal_modloader::game_platform_managers::{
1111
GetGameBuildTrait, MsStoreInstallManager, SteamInstallManager,
1212
};
1313
use astro_modintegrator::unreal_modloader::update_info::UpdateInfo;
1414
use astro_modintegrator::unreal_modloader::version::GameBuild;
15-
use astro_modintegrator::unreal_modloader::IconData;
1615
use astro_modintegrator::{unreal_modloader, AstroIntegratorConfig};
1716

1817
mod logging;
@@ -55,6 +54,21 @@ impl GetGameBuildTrait<SteamInstallManager> for SteamGetGameBuild {
5554

5655
struct AstroGameConfig;
5756

57+
fn load_icon() -> IconData {
58+
let data = include_bytes!("../assets/icon.ico");
59+
let image = image::load_from_memory(data).unwrap().to_rgba8();
60+
61+
IconData {
62+
data: image.to_vec(),
63+
width: image.width(),
64+
height: image.height(),
65+
}
66+
}
67+
68+
lazy_static! {
69+
static ref RGB_DATA: IconData = load_icon();
70+
}
71+
5872
impl<T, E: std::error::Error> GameConfig<'static, AstroIntegratorConfig, T, E> for AstroGameConfig
5973
where
6074
AstroIntegratorConfig: IntegratorConfig<'static, T, E>,
@@ -78,6 +92,7 @@ where
7892

7993
const WINDOW_TITLE: &'static str = "Astroneer Modloader";
8094
const CONFIG_DIR: &'static str = "AstroModLoader";
95+
const CRATE_VERSION: &'static str = cargo_crate_version!();
8196

8297
fn get_install_managers(
8398
&self,
@@ -135,29 +150,18 @@ where
135150
}
136151
Ok(())
137152
}
138-
}
139153

140-
fn load_icon() -> IconData {
141-
let data = include_bytes!("../assets/icon.ico");
142-
let image = image::load_from_memory(data).unwrap().to_rgba8();
143-
144-
IconData {
145-
data: image.to_vec(),
146-
width: image.width(),
147-
height: image.height(),
154+
fn get_icon(&self) -> Option<IconData> {
155+
Some(RGB_DATA.clone())
148156
}
149157
}
150158

151-
lazy_static! {
152-
static ref RGB_DATA: IconData = load_icon();
153-
}
154-
155159
fn main() {
156160
logging::init().unwrap();
157161

158162
info!("Astroneer Modloader");
159163

160164
let config = AstroGameConfig;
161165

162-
unreal_modloader::run(config, Some(RGB_DATA.clone()), cargo_crate_version!());
166+
unreal_modloader::run(config);
163167
}

0 commit comments

Comments
 (0)