From 852cd31d4d0495cd867be17b0b75f3b2faf9463c Mon Sep 17 00:00:00 2001 From: Barinade Date: Tue, 12 Nov 2019 19:12:32 -0600 Subject: [PATCH] Reduce CustomizeGameplay I/O impact by saving only on Screen Exit --- .../BGAnimations/ScreenGameplay overlay/messagebox.lua | 4 ++++ Themes/Til Death/Scripts/02 CustomizeGameplay.lua | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Themes/Til Death/BGAnimations/ScreenGameplay overlay/messagebox.lua b/Themes/Til Death/BGAnimations/ScreenGameplay overlay/messagebox.lua index 376f3c3f1c..f9a596a14b 100644 --- a/Themes/Til Death/BGAnimations/ScreenGameplay overlay/messagebox.lua +++ b/Themes/Til Death/BGAnimations/ScreenGameplay overlay/messagebox.lua @@ -18,6 +18,10 @@ return Def.ActorFrame { SCREENMAN:GetTopScreen():AddInputCallback(MovableInput) self:SetUpdateFunction(highlight) end, + OffCommand = function(self) + -- save CustomizeGameplay changes when leaving the screen + playerConfig:save(pn_to_profile_slot(PLAYER_1)) + end, Def.BitmapText { Name = "message", Font = "Common Normal", diff --git a/Themes/Til Death/Scripts/02 CustomizeGameplay.lua b/Themes/Til Death/Scripts/02 CustomizeGameplay.lua index 7a029848a6..6d31a114b4 100644 --- a/Themes/Til Death/Scripts/02 CustomizeGameplay.lua +++ b/Themes/Til Death/Scripts/02 CustomizeGameplay.lua @@ -940,7 +940,10 @@ function MovableInput(event) end playerConfig:get_data(pn_to_profile_slot(PLAYER_1))[current.elementTree][keymode][prop] = newVal playerConfig:set_dirty(pn_to_profile_slot(PLAYER_1)) - playerConfig:save(pn_to_profile_slot(PLAYER_1)) + -- commented this to save I/O time and reduce lag + -- just make sure to call this somewhere else to make sure stuff saves. + -- (like when the screen changes....) + --playerConfig:save(pn_to_profile_slot(PLAYER_1)) end end return false