Skip to content

Commit

Permalink
Reduce CustomizeGameplay I/O impact by saving only on Screen Exit
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Nov 13, 2019
1 parent 7f1d23a commit 852cd31
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion Themes/Til Death/Scripts/02 CustomizeGameplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 852cd31

Please sign in to comment.