Another potential fix for WSE crash

This commit is contained in:
IQuant 2024-11-28 16:41:54 +03:00
parent 2680fc0ab0
commit b506dac333
2 changed files with 33 additions and 11 deletions

View file

@ -539,7 +539,7 @@ pub struct App {
appearance: PlayerAppearance, appearance: PlayerAppearance,
connected_menu: ConnectedMenu, connected_menu: ConnectedMenu,
show_host_settings: bool, show_host_settings: bool,
ux_settings: UXSettings ux_settings: UXSettings,
} }
fn filled_group<R>(ui: &mut Ui, add_contents: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> { fn filled_group<R>(ui: &mut Ui, add_contents: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {
@ -597,13 +597,18 @@ fn settings_get() -> Settings {
} }
} }
fn settings_set(app: AppSavedState, color: PlayerAppearance, modmanager: ModmanagerSettings, ux: UXSettings) { fn settings_set(
app: AppSavedState,
color: PlayerAppearance,
modmanager: ModmanagerSettings,
ux: UXSettings,
) {
if let Ok(s) = std::env::current_exe() { if let Ok(s) = std::env::current_exe() {
let settings = Settings { let settings = Settings {
app, app,
color, color,
modmanager, modmanager,
ux ux,
}; };
let file = s.parent().unwrap().join("proxy.ron"); let file = s.parent().unwrap().join("proxy.ron");
let settings = ron::to_string(&settings).unwrap(); let settings = ron::to_string(&settings).unwrap();
@ -1106,14 +1111,22 @@ impl App {
ui.add_space(10.0); ui.add_space(10.0);
ui.label(tr("ping-note")); ui.label(tr("ping-note"));
ui.add_space(10.0); ui.add_space(10.0);
ui.add(egui::Slider::new(&mut self.ux_settings.ping_lifetime, 1..=60).text(tr("ping-lifetime")) ui.add(
.min_decimals(0) egui::Slider::new(&mut self.ux_settings.ping_lifetime, 1..=60)
.max_decimals(0) .text(tr("ping-lifetime"))
.step_by(1.0)).on_hover_text(tr("ping-lifetime-tooltip")); .min_decimals(0)
ui.add(egui::Slider::new(&mut self.ux_settings.ping_scale, 0.0..=1.5).text(tr("ping-scale")) .max_decimals(0)
.min_decimals(0) .step_by(1.0),
.max_decimals(1) )
.step_by(0.1)).on_hover_text(tr("ping-scale-tooltip")); .on_hover_text(tr("ping-lifetime-tooltip"));
ui.add(
egui::Slider::new(&mut self.ux_settings.ping_scale, 0.0..=1.5)
.text(tr("ping-scale"))
.min_decimals(0)
.max_decimals(1)
.step_by(0.1),
)
.on_hover_text(tr("ping-scale-tooltip"));
} }
fn connect_to_steam_lobby(&mut self, lobby_id: String) { fn connect_to_steam_lobby(&mut self, lobby_id: String) {

View file

@ -4,6 +4,15 @@ local base64 = dofile_once("mods/quant.ew/files/resource/base64.lua")
local util = {} local util = {}
local entity_load_orig = EntityLoad
function EntityLoad(path, ...)
if path == "??SAV/world_state.xml" then
error("Attempted to EntityLoad WSE")
end
return entity_load_orig(path, ...)
end
function util.string_split( s, splitter ) function util.string_split( s, splitter )
local words = {}; local words = {};
if s == nil or splitter == nil then if s == nil or splitter == nil then