1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-04-28 17:37:45 +00:00
kawari/src/config.rs
Joshua Goins 059becf55f Detect when players enter exit zones, and transistion them to the correct place
It's a hack and only really works going from New -> Old Gridania, but this does
work! It also means Kawari now actually requires a valid game installation,
since it has to read layer group information.
2025-03-15 19:34:29 -04:00

49 lines
1.1 KiB
Rust

use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct Config {
#[serde(default)]
pub worlds_open: bool,
#[serde(default)]
pub login_open: bool,
#[serde(default = "default_supported_platforms")]
pub supported_platforms: Vec<String>,
#[serde(default)]
pub boot_patches_location: String,
#[serde(default)]
pub game_location: String,
}
impl Default for Config {
fn default() -> Self {
Self {
worlds_open: false,
login_open: false,
boot_patches_location: String::new(),
supported_platforms: default_supported_platforms(),
game_location: String::new(),
}
}
}
impl Config {
pub fn supports_platform(&self, platform: &String) -> bool {
self.supported_platforms.contains(platform)
}
}
fn default_supported_platforms() -> Vec<String> {
vec!["win32".to_string()]
}
pub fn get_config() -> Config {
if let Ok(data) = std::fs::read_to_string("config.json") {
serde_json::from_str(&data).expect("Failed to parse")
} else {
Config::default()
}
}