Skip to content

Commit

Permalink
Fixed duplicate entries in sound cache size option list
Browse files Browse the repository at this point in the history
  • Loading branch information
LenweSaralonde committed Jul 26, 2024
1 parent 81cda2c commit e62e700
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/Musician.lua
Original file line number Diff line number Diff line change
Expand Up @@ -861,15 +861,17 @@ function Musician.SetupHooks()
-- Add custom Sound_MaxCacheSizeInBytes option for Musician (Retail)
--

local isSoundCacheOptionHooked = false
if SettingsLayoutMixin and SettingsLayoutMixin.Init then
hooksecurefunc(SettingsLayoutMixin, "Init", function(layout, layoutType)
if layoutType == SettingsLayoutMixin.LayoutType.Vertical then
hooksecurefunc(layout, "AddInitializer", function(_, initializer)
if type(initializer) == "table" and type(initializer.GetSetting) == "function" then
local setting = initializer:GetSetting()
if type(setting) == "table" and type(setting.GetVariable) == "function" and
setting:GetVariable() == "Sound_MaxCacheSizeInBytes" then
setting:GetVariable() == "Sound_MaxCacheSizeInBytes" and not isSoundCacheOptionHooked then
local hookedInitializerGetOptions = initializer.GetOptions
isSoundCacheOptionHooked = true
initializer.GetOptions = function(...)
local options = hookedInitializerGetOptions(...)()
local cacheSize = Musician.Utils.GetSoundCacheSize()
Expand Down

0 comments on commit e62e700

Please sign in to comment.