use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LaunchOptions {
pub url: Option<String>,
pub headers: Option<HashMap<String, String>>,
pub token: Option<String>,
pub authenticator: crate::auth::AuthResponse,
pub timeout: Option<u64>,
pub path: String,
pub version: String,
pub instance: Option<String>,
pub detached: Option<bool>,
pub download_file_multiple: Option<u32>,
pub bypass_offline: Option<bool>,
pub intel_enabled_mac: Option<bool>,
pub loader: LoaderOptions,
pub mcp: Option<String>,
pub verify: Option<bool>,
pub ignored: Vec<String>,
pub jvm_args: Vec<String>,
pub game_args: Vec<String>,
pub java: JavaOptions,
pub screen: ScreenOptions,
pub memory: MemoryOptions,
}
impl Default for LaunchOptions {
fn default() -> Self {
Self {
url: None,
headers: None,
token: None,
authenticator: crate::auth::AuthResponse {
access_token: String::new(),
client_token: String::new(),
uuid: String::new(),
name: String::new(),
refresh_token: None,
user_properties: "{}".to_string(),
meta: crate::auth::AuthMeta {
auth_type: "Unknown".to_string(),
access_token_expires_in: 0,
demo: false,
},
xbox_account: None,
profile: None,
},
timeout: Some(10000),
path: ".Minecraft".to_string(),
version: "latest_release".to_string(),
instance: None,
detached: Some(false),
download_file_multiple: Some(5),
bypass_offline: Some(false),
intel_enabled_mac: Some(false),
loader: LoaderOptions {
path: Some("./loader".to_string()),
r#type: None,
build: Some("latest".to_string()),
enable: false,
},
mcp: None,
verify: Some(false),
ignored: vec![],
jvm_args: vec![],
game_args: vec![],
java: JavaOptions {
path: None,
version: None,
r#type: "jre".to_string(),
},
screen: ScreenOptions {
width: None,
height: None,
fullscreen: None,
},
memory: MemoryOptions {
min: None,
max: None,
},
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MemoryOptions {
pub min: Option<String>,
pub max: Option<String>,
}
impl Default for MemoryOptions {
fn default() -> Self {
Self {
min: None,
max: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ScreenOptions {
pub width: Option<u32>,
pub height: Option<u32>,
pub fullscreen: Option<bool>,
}
impl Default for ScreenOptions {
fn default() -> Self {
Self {
width: None,
height: None,
fullscreen: None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct JavaOptions {
pub path: Option<String>,
pub version: Option<String>,
pub r#type: String,
}
impl Default for JavaOptions {
fn default() -> Self {
Self {
path: None,
version: None,
r#type: "jre".to_string(),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LoaderOptions {
pub path: Option<String>,
pub r#type: Option<String>,
pub build: Option<String>,
pub enable: bool,
}
impl Default for LoaderOptions {
fn default() -> Self {
Self {
path: Some("./loader".to_string()),
r#type: None,
build: Some("latest".to_string()),
enable: false,
}
}
}