From 509f7bd018f48c289526dc7a7be7009aed14f6b9 Mon Sep 17 00:00:00 2001 From: flow Date: Tue, 12 Jul 2022 21:15:59 -0300 Subject: [PATCH] fix: move time record overrides to BaseInstance This is needed so that we can show time stats in the UI without having to load all type-specific settings, which would make all the previous changes useless :c This is apparently done with console settings too, so I don't think there's a problem doing this too :> Signed-off-by: flow --- launcher/BaseInstance.cpp | 6 ++++++ launcher/minecraft/MinecraftInstance.cpp | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/launcher/BaseInstance.cpp b/launcher/BaseInstance.cpp index c9cfef88..35c26eb7 100644 --- a/launcher/BaseInstance.cpp +++ b/launcher/BaseInstance.cpp @@ -58,10 +58,16 @@ BaseInstance::BaseInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr s m_settings->registerSetting("name", "Unnamed Instance"); m_settings->registerSetting("iconKey", "default"); m_settings->registerSetting("notes", ""); + m_settings->registerSetting("lastLaunchTime", 0); m_settings->registerSetting("totalTimePlayed", 0); m_settings->registerSetting("lastTimePlayed", 0); + // Game time override + auto gameTimeOverride = m_settings->registerSetting("OverrideGameTime", false); + m_settings->registerOverride(globalSettings->getSetting("ShowGameTime"), gameTimeOverride); + m_settings->registerOverride(globalSettings->getSetting("RecordGameTime"), gameTimeOverride); + // NOTE: Sometimees InstanceType is already registered, as it was used to identify the type of // a locally stored instance if (!m_settings->getSetting("InstanceType")) diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp index d981ecc9..fa6535b0 100644 --- a/launcher/minecraft/MinecraftInstance.cpp +++ b/launcher/minecraft/MinecraftInstance.cpp @@ -174,11 +174,6 @@ void MinecraftInstance::loadSpecificSettings() m_settings->registerOverride(global_settings->getSetting("EnableMangoHud"), performanceOverride); m_settings->registerOverride(global_settings->getSetting("UseDiscreteGpu"), performanceOverride); - // Game time - auto gameTimeOverride = m_settings->registerSetting("OverrideGameTime", false); - m_settings->registerOverride(global_settings->getSetting("ShowGameTime"), gameTimeOverride); - m_settings->registerOverride(global_settings->getSetting("RecordGameTime"), gameTimeOverride); - // Miscellaneous auto miscellaneousOverride = m_settings->registerSetting("OverrideMiscellaneous", false); m_settings->registerOverride(global_settings->getSetting("CloseAfterLaunch"), miscellaneousOverride);