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

6
Cargo.lock generated
View File

@@ -4609,7 +4609,7 @@ dependencies = [
[[package]] [[package]]
name = "theseus" name = "theseus"
version = "0.2.2" version = "0.3.0"
dependencies = [ dependencies = [
"async-recursion", "async-recursion",
"async-tungstenite", "async-tungstenite",
@@ -4654,7 +4654,7 @@ dependencies = [
[[package]] [[package]]
name = "theseus_cli" name = "theseus_cli"
version = "0.2.2" version = "0.3.0"
dependencies = [ dependencies = [
"argh", "argh",
"color-eyre", "color-eyre",
@@ -4681,7 +4681,7 @@ dependencies = [
[[package]] [[package]]
name = "theseus_gui" name = "theseus_gui"
version = "0.2.2" version = "0.3.0"
dependencies = [ dependencies = [
"chrono", "chrono",
"cocoa", "cocoa",

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "theseus" name = "theseus"
version = "0.2.2" version = "0.3.0"
authors = ["Jai A <jaiagr+gpg@pm.me>"] authors = ["Jai A <jaiagr+gpg@pm.me>"]
edition = "2018" edition = "2018"

View File

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

View File

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

View File

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

View File

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

View File

@@ -149,8 +149,7 @@ pub struct Profile {
pub memory: Option<MemorySettings>, pub memory: Option<MemorySettings>,
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub resolution: Option<WindowSize>, pub resolution: Option<WindowSize>,
#[serde(default)] pub fullscreen: Option<bool>,
pub force_fullscreen: SetFullscreen,
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub hooks: Option<Hooks>, pub hooks: Option<Hooks>,
pub projects: HashMap<ProjectPathId, Project>, 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)] #[derive(Serialize, Deserialize, Clone, Debug)]
pub struct JavaSettings { pub struct JavaSettings {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@@ -285,7 +269,7 @@ impl Profile {
java: None, java: None,
memory: None, memory: None,
resolution: None, resolution: None,
force_fullscreen: SetFullscreen::LeaveUnset, fullscreen: None,
hooks: None, hooks: None,
modrinth_update_version: None, modrinth_update_version: None,
}) })

View File

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

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "theseus_cli" name = "theseus_cli"
version = "0.2.2" version = "0.3.0"
authors = ["Jai A <jaiagr+gpg@pm.me>"] authors = ["Jai A <jaiagr+gpg@pm.me>"]
edition = "2018" edition = "2018"

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "theseus_gui" name = "theseus_gui"
version = "0.2.2" version = "0.3.0"
description = "A Tauri App" description = "A Tauri App"
authors = ["you"] authors = ["you"]
license = "" license = ""

View File

@@ -276,7 +276,7 @@ pub struct EditProfile {
pub memory: Option<MemorySettings>, pub memory: Option<MemorySettings>,
pub resolution: Option<WindowSize>, pub resolution: Option<WindowSize>,
pub hooks: Option<Hooks>, pub hooks: Option<Hooks>,
pub force_fullscreen: Option<SetFullscreen>, pub fullscreen: Option<bool>,
} }
#[derive(Serialize, Deserialize, Clone, Debug)] #[derive(Serialize, Deserialize, Clone, Debug)]
@@ -316,9 +316,7 @@ pub async fn profile_edit(
prof.java = edit_profile.java.clone(); prof.java = edit_profile.java.clone();
prof.memory = edit_profile.memory; prof.memory = edit_profile.memory;
prof.resolution = edit_profile.resolution; prof.resolution = edit_profile.resolution;
if let Some(force_fullscreen) = edit_profile.force_fullscreen { prof.fullscreen = edit_profile.fullscreen;
prof.force_fullscreen = force_fullscreen;
}
prof.hooks = edit_profile.hooks.clone(); prof.hooks = edit_profile.hooks.clone();
prof.metadata.date_modified = chrono::Utc::now(); prof.metadata.date_modified = chrono::Utc::now();

View File

@@ -8,7 +8,7 @@
}, },
"package": { "package": {
"productName": "Modrinth App", "productName": "Modrinth App",
"version": "0.2.2" "version": "0.3.0"
}, },
"tauri": { "tauri": {
"allowlist": { "allowlist": {

View File

@@ -144,7 +144,7 @@ watch(
" "
/> />
</div> </div>
<div class="opening-page"> <div class="adjacent-input">
<label for="opening-page"> <label for="opening-page">
<span class="label__title">Default landing page</span> <span class="label__title">Default landing page</span>
<span class="label__description">Change the page to which the launcher opens on.</span> <span class="label__description">Change the page to which the launcher opens on.</span>
@@ -329,6 +329,15 @@ watch(
<span class="label__title size-card-header">Window size</span> <span class="label__title size-card-header">Window size</span>
</h3> </h3>
</div> </div>
<div class="adjacent-input">
<label for="fullscreen">
<span class="label__title">Fullscreen</span>
<span class="label__description">
Make the game start in full screen when launched.
</span>
</label>
<Toggle id="fullscreen" v-model="settings.fullscreen" />
</div>
<div class="adjacent-input"> <div class="adjacent-input">
<label for="width"> <label for="width">
<span class="label__title">Width</span> <span class="label__title">Width</span>
@@ -337,6 +346,7 @@ watch(
<input <input
id="width" id="width"
v-model="settings.game_resolution[0]" v-model="settings.game_resolution[0]"
:disabled="settings.fullscreen"
autocomplete="off" autocomplete="off"
type="number" type="number"
placeholder="Enter width..." placeholder="Enter width..."
@@ -350,6 +360,7 @@ watch(
<input <input
id="height" id="height"
v-model="settings.game_resolution[1]" v-model="settings.game_resolution[1]"
:disabled="settings.fullscreen"
autocomplete="off" autocomplete="off"
type="number" type="number"
class="input" class="input"

View File

@@ -183,10 +183,14 @@
</h3> </h3>
</div> </div>
<div class="adjacent-input"> <div class="adjacent-input">
<DropdownSelect v-model="forceFullscreen" :options="fullscreenOptions" /> <Checkbox v-model="overrideWindowSettings" label="Override global window settings" />
</div> </div>
<div class="adjacent-input"> <div class="adjacent-input">
<Checkbox v-model="overrideWindowSettings" label="Override global window settings" /> <label for="fullscreen">
<span class="label__title">Fullscreen</span>
<span class="label__description"> Make the game start in full screen when launched. </span>
</label>
<Toggle id="fullscreen" v-model="fullscreen" :disabled="!overrideWindowSettings" />
</div> </div>
<div class="adjacent-input"> <div class="adjacent-input">
<label for="width"> <label for="width">
@@ -197,7 +201,7 @@
id="width" id="width"
v-model="resolution[0]" v-model="resolution[0]"
autocomplete="off" autocomplete="off"
:disabled="!overrideWindowSettings" :disabled="!overrideWindowSettings || fullscreen"
type="number" type="number"
placeholder="Enter width..." placeholder="Enter width..."
/> />
@@ -211,7 +215,7 @@
id="height" id="height"
v-model="resolution[1]" v-model="resolution[1]"
autocomplete="off" autocomplete="off"
:disabled="!overrideWindowSettings" :disabled="!overrideWindowSettings || fullscreen"
type="number" type="number"
class="input" class="input"
placeholder="Enter height..." placeholder="Enter height..."
@@ -295,7 +299,7 @@
</div> </div>
<div v-if="props.instance.modrinth_update_version" class="adjacent-input"> <div v-if="props.instance.modrinth_update_version" class="adjacent-input">
<label for="repair-profile"> <label for="repair-profile">
<span class="label__title">Repair modpack</span> <span class="label__title">Reinstall modpack</span>
<span class="label__description"> <span class="label__description">
Reinstalls Modrinth modpack and checks for corruption. Use this if your game is not Reinstalls Modrinth modpack and checks for corruption. Use this if your game is not
launching due to your instance diverging from the Modrinth modpack. launching due to your instance diverging from the Modrinth modpack.
@@ -307,7 +311,7 @@
:disabled="repairing" :disabled="repairing"
@click="repairModpack" @click="repairModpack"
> >
<HammerIcon /> Repair <DownloadIcon /> Reinstall
</button> </button>
</div> </div>
@@ -346,7 +350,9 @@ import {
XIcon, XIcon,
SaveIcon, SaveIcon,
HammerIcon, HammerIcon,
DownloadIcon,
ModalConfirm, ModalConfirm,
Toggle,
} from 'omorphia' } from 'omorphia'
import { Multiselect } from 'vue-multiselect' import { Multiselect } from 'vue-multiselect'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
@@ -445,8 +451,7 @@ const resolution = ref(props.instance.resolution ?? globalSettings.game_resoluti
const overrideHooks = ref(!!props.instance.hooks) const overrideHooks = ref(!!props.instance.hooks)
const hooks = ref(props.instance.hooks ?? globalSettings.hooks) const hooks = ref(props.instance.hooks ?? globalSettings.hooks)
const fullscreenOptions = ref(['Leave unchanged', 'Set windowed', 'Set fullscreen']) const fullscreen = ref(props.instance.fullscreen)
const forceFullscreen = ref(props.instance.force_fullscreen)
watch( watch(
[ [
@@ -463,7 +468,7 @@ watch(
memory, memory,
overrideWindowSettings, overrideWindowSettings,
resolution, resolution,
forceFullscreen, fullscreen,
overrideHooks, overrideHooks,
hooks, hooks,
], ],
@@ -508,11 +513,11 @@ watch(
} }
if (overrideWindowSettings.value) { if (overrideWindowSettings.value) {
editProfile.resolution = resolution.value editProfile.fullscreen = fullscreen.value
}
if (forceFullscreen.value) { if (!fullscreen.value) {
editProfile.force_fullscreen = forceFullscreen.value editProfile.resolution = resolution.value
}
} }
if (overrideHooks.value) { if (overrideHooks.value) {