mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2024-09-28 21:19:24 +00:00
show missing mod.txt
This commit is contained in:
parent
3f8c66db0f
commit
987c857b1c
|
@ -16,6 +16,7 @@ pub struct ModInfo {
|
||||||
pub path: String,
|
pub path: String,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub description: String,
|
pub description: String,
|
||||||
|
pub valid: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModInfo {
|
impl ModInfo {
|
||||||
|
@ -147,11 +148,13 @@ impl ModList {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut valid = false;
|
||||||
let mut name = String::new();
|
let mut name = String::new();
|
||||||
let mut description = String::new();
|
let mut description = String::new();
|
||||||
let mut save_slot = -1;
|
let mut save_slot = -1;
|
||||||
|
|
||||||
if let Ok(file) = filesystem::open(ctx, [&path, "/mod.txt"].join("")) {
|
if let Ok(file) = filesystem::open(ctx, [&path, "/mod.txt"].join("")) {
|
||||||
|
valid = true;
|
||||||
let reader = BufReader::new(file);
|
let reader = BufReader::new(file);
|
||||||
let mut lines = reader.lines();
|
let mut lines = reader.lines();
|
||||||
if let Some(line) = lines.nth(1) {
|
if let Some(line) = lines.nth(1) {
|
||||||
|
@ -164,9 +167,12 @@ impl ModList {
|
||||||
if let Some(line) = lines.next() {
|
if let Some(line) = lines.next() {
|
||||||
description = line.unwrap_or("No Description".to_string()).to_string();
|
description = line.unwrap_or("No Description".to_string()).to_string();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
name = path.clone();
|
||||||
|
description = "mod.txt not found".to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
mods.push(ModInfo { id, requirement, priority, save_slot, path, name, description })
|
mods.push(ModInfo { id, requirement, priority, save_slot, path, name, description, valid })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,10 @@ impl Scene for TitleScene {
|
||||||
let mut mutate_selection = true;
|
let mut mutate_selection = true;
|
||||||
|
|
||||||
for mod_info in state.mod_list.mods.iter() {
|
for mod_info in state.mod_list.mods.iter() {
|
||||||
|
if !mod_info.valid {
|
||||||
|
self.challenges_menu.push_entry(MenuEntry::Disabled(mod_info.path.clone()));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if mod_info.satisfies_requirement(&state.mod_requirements) {
|
if mod_info.satisfies_requirement(&state.mod_requirements) {
|
||||||
self.challenges_menu.push_entry(MenuEntry::Active(mod_info.name.clone()));
|
self.challenges_menu.push_entry(MenuEntry::Active(mod_info.name.clone()));
|
||||||
mutate_selection = false;
|
mutate_selection = false;
|
||||||
|
|
Loading…
Reference in a new issue