New Alpha Final Fixes (#365)

This commit is contained in:
Geometrically
2023-07-27 01:31:28 -07:00
committed by GitHub
parent c364468ed5
commit 744d11f09e
14 changed files with 57 additions and 61 deletions

View File

@@ -27,7 +27,7 @@ pub mod prelude {
jre, metadata, pack, process,
profile::{self, create, Profile},
settings,
state::{JavaGlobals, SetFullscreen},
state::JavaGlobals,
state::{ProfilePathId, ProjectPathId},
util::{
io::{canonicalize, IOError},

View File

@@ -7,9 +7,7 @@ use crate::event::LoadingBarType;
use crate::pack::install_from::{
EnvType, PackDependency, PackFile, PackFileHash, PackFormat,
};
use crate::prelude::{
JavaVersion, ProfilePathId, ProjectPathId, SetFullscreen,
};
use crate::prelude::{JavaVersion, ProfilePathId, ProjectPathId};
use crate::state::ProjectMetadata;
use crate::util::io::{self, IOError};
@@ -841,17 +839,13 @@ pub async fn run_credentials(
};
// Any options.txt settings that we want set, add here
let mut mc_set_options: Vec<(String, String)> = Vec::new();
match profile.force_fullscreen {
SetFullscreen::LeaveUnset => {}
SetFullscreen::SetWindowed => {
mc_set_options
.push(("fullscreen".to_string(), "false".to_string()));
}
SetFullscreen::SetFullscreen => {
mc_set_options.push(("fullscreen".to_string(), "true".to_string()));
}
}
let mc_set_options: Vec<(String, String)> = vec![(
"fullscreen".to_string(),
profile
.fullscreen
.unwrap_or(settings.force_fullscreen)
.to_string(),
)];
let mc_process = crate::launcher::launch_minecraft(
java_args,

View File

@@ -6,7 +6,6 @@ use crate::launcher::io::IOError;
use crate::prelude::JavaVersion;
use crate::state::ProfileInstallStage;
use crate::util::io;
use crate::EventState;
use crate::{
process,
state::{self as st, MinecraftChild},
@@ -532,6 +531,8 @@ pub async fn launch_minecraft(
// If in tauri, and the 'minimize on launch' setting is enabled, minimize the window
#[cfg(feature = "tauri")]
{
use crate::EventState;
let window = EventState::get_main_window().await?;
if let Some(window) = window {
let settings = state.settings.read().await;

View File

@@ -13,7 +13,7 @@ use tracing::error;
use crate::event::emit::emit_process;
use crate::event::ProcessPayloadType;
use crate::util::io::IOError;
use crate::EventState;
use tokio::task::JoinHandle;
use uuid::Uuid;
@@ -155,7 +155,7 @@ impl Children {
// If in tauri, window should show itself again after process exists if it was hidden
#[cfg(feature = "tauri")]
{
let window = EventState::get_main_window().await?;
let window = crate::EventState::get_main_window().await?;
if let Some(window) = window {
window.unminimize()?;
}

View File

@@ -149,8 +149,7 @@ pub struct Profile {
pub memory: Option<MemorySettings>,
#[serde(skip_serializing_if = "Option::is_none")]
pub resolution: Option<WindowSize>,
#[serde(default)]
pub force_fullscreen: SetFullscreen,
pub fullscreen: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub hooks: Option<Hooks>,
pub projects: HashMap<ProjectPathId, Project>,
@@ -225,21 +224,6 @@ impl ModLoader {
}
}
#[derive(Serialize, Deserialize, Clone, Debug, Copy)]
pub enum SetFullscreen {
#[serde(rename = "Leave unset")]
LeaveUnset,
#[serde(rename = "Set windowed")]
SetWindowed,
#[serde(rename = "Set fullscreen")]
SetFullscreen,
}
impl Default for SetFullscreen {
fn default() -> Self {
Self::LeaveUnset
}
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct JavaSettings {
#[serde(skip_serializing_if = "Option::is_none")]
@@ -285,7 +269,7 @@ impl Profile {
java: None,
memory: None,
resolution: None,
force_fullscreen: SetFullscreen::LeaveUnset,
fullscreen: None,
hooks: None,
modrinth_update_version: None,
})

View File

@@ -18,6 +18,8 @@ const CURRENT_FORMAT_VERSION: u32 = 1;
pub struct Settings {
pub theme: Theme,
pub memory: MemorySettings,
#[serde(default)]
pub force_fullscreen: bool,
pub game_resolution: WindowSize,
pub custom_java_args: Vec<String>,
pub custom_env_args: Vec<(String, String)>,
@@ -64,6 +66,7 @@ impl Settings {
Ok(Self {
theme: Theme::Dark,
memory: MemorySettings::default(),
force_fullscreen: false,
game_resolution: WindowSize::default(),
custom_java_args: Vec::new(),
custom_env_args: Vec::new(),