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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 57 additions and 61 deletions

6
Cargo.lock generated
View File

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

View File

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

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(),

View File

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

View File

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

View File

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

View File

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

View File

@ -144,7 +144,7 @@ watch(
"
/>
</div>
<div class="opening-page">
<div class="adjacent-input">
<label for="opening-page">
<span class="label__title">Default landing page</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>
</h3>
</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">
<label for="width">
<span class="label__title">Width</span>
@ -337,6 +346,7 @@ watch(
<input
id="width"
v-model="settings.game_resolution[0]"
:disabled="settings.fullscreen"
autocomplete="off"
type="number"
placeholder="Enter width..."
@ -350,6 +360,7 @@ watch(
<input
id="height"
v-model="settings.game_resolution[1]"
:disabled="settings.fullscreen"
autocomplete="off"
type="number"
class="input"

View File

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