Merge branch 'main' of git.mcorangehq.xyz:XOR64/a3l_rs
This commit is contained in:
commit
b75f65d824
8
mp2.xml
8
mp2.xml
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<addons-presets>
|
||||
<last-update>1970-01-01T03:00:00+03:00</last-update>
|
||||
<published-ids>
|
||||
</published-ids>
|
||||
<dlcs-appids />
|
||||
<last-update>1970-01-01T03:00:00+03:00</last-update>
|
||||
<published-ids>
|
||||
</published-ids>
|
||||
<dlcs-appids />
|
||||
</addons-presets>
|
||||
|
|
|
@ -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(())
|
||||
}
|
|
@ -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(())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user