Merge branch 'main' of git.mcorangehq.xyz:XOR64/a3l_rs

This commit is contained in:
Gvidas Juknevičius 2025-01-17 01:05:50 +02:00
commit b75f65d824
Signed by: MCorange
GPG Key ID: 12B1346D720B7FBB
3 changed files with 84 additions and 5 deletions

View File

@ -0,0 +1,76 @@
struct MyApp {
selected: String,
presets: Vec<String>,
}
impl Default for MyApp {
fn default() -> Self {
Self {
selected: String::new(),
presets: Vec::new(),
}
}
}
impl eframe::App for MyApp {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
if self.presets.is_empty() {
let home_dir = std::env::var("HOME").expect("HOME environment variable not set");
let steamapps_dir = std::path::PathBuf::from(home_dir).join(".steam/debian-installation/steamapps");
let preset_dir = steamapps_dir
.join("compatdata")
.join("107410")
.join("pfx")
.join("drive_c")
.join("users")
.join("steamuser")
.join("AppData")
.join("Local")
.join("Arma 3 Launcher")
.join("Presets");
if let Ok(entries) = std::fs::read_dir(preset_dir) {
self.presets = entries
.filter_map(|entry| entry.ok())
.filter_map(|entry| entry.file_name().into_string().ok())
.collect();
}
}
egui::ComboBox::from_label("Select Preset")
.selected_text(&self.selected)
.show_ui(ui, |ui| {
for preset in &self.presets {
ui.selectable_value(&mut self.selected, preset.clone(), preset);
}
});
if ui.button("skibidi").clicked() {
println!("Selected preset: {}", self.selected);
}
});
}
}
pub fn gui_start() -> anyhow::Result<()> {
let options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default().with_inner_size([900.0, 540.0]),
..Default::default()
};
eframe::run_native(
"a3lrs",
options,
Box::new(|cc| {
egui_extras::install_image_loaders(&cc.egui_ctx);
Ok(Box::<MyApp>::default())
}),
).unwrap();
Ok(())
}

View File

@ -1,7 +1,10 @@
use std::path::Path;
fn main() {
fn main() -> anyhow::Result<()> {
a3l_rs::modpack::internal::MPInt::default().write(Path::new("./mp2.xml"));
let mp = a3l_rs::modpack::internal::MPInt::parse(Path::new("./mp.xml"));
dbg!(mp);
a3l_rs::gui::gui_start()?;
Ok(())
}