@@ -215,34 +215,38 @@ end
215
215
local LOADED = false
216
216
local IGNORE_CHANGE = false
217
217
218
+ local ALLOW_INGAME_VOLUME = false
219
+
218
220
memory .hook (" OnGameClosed" , " Set state unloaded" , function (gid , version )
219
221
LOADED = false
220
222
end )
221
223
222
224
memory .hook (" menu_major" , " Load Initial Volume" , function (menu )
223
- if not LOADED and menu == MENU_MAIN_MENU then
225
+ if memory . isMelee () and ALLOW_INGAME_VOLUME and not LOADED and menu == MENU_MAIN_MENU then
224
226
LOADED = true
225
227
-- Set the games music value to our value
226
228
music .setVolume (music .getVolume ())
227
229
end
228
230
end )
229
231
230
232
memory .hook (" volume.slider" , " Ingame Volume Adjust" , function (volume )
231
- if LOADED then
233
+ if memory . isMelee () and ALLOW_INGAME_VOLUME and LOADED then
232
234
PANEL_SETTINGS :SetVolume (100 - volume )
233
235
end
234
236
end )
235
237
236
238
function music .setVolume (vol )
237
- -- Melee's slider goes in increments of 5
238
- -- It seems to add +5 or -5 no matter what, but it can actually take numbers in between and still work
239
- -- local nearest5 = math.round((100-vol) / 5)*5
239
+ if ALLOW_INGAME_VOLUME and memory .isMelee () then
240
+ -- Melee's slider goes in increments of 5
241
+ -- It seems to add +5 or -5 no matter what, but it can actually take numbers in between and still work
242
+ -- local nearest5 = math.round((100-vol) / 5)*5
240
243
241
- -- volume.slider adjust (0-100)
242
- memory .writeByte (0x8045C384 , math .round (100 - vol ))
244
+ -- volume.slider adjust (0-100)
245
+ memory .writeByte (0x8045C384 , math .round (100 - vol ))
243
246
244
- -- volume.music adjust (0-127)
245
- memory .writeByte (0x804D3887 , (vol / 100 ) * 127 )
247
+ -- volume.music adjust (0-127)
248
+ memory .writeByte (0x804D3887 , (vol / 100 ) * 127 )
249
+ end
246
250
247
251
if PLAYING_SONG and PLAYING_SONG :isPlaying () then
248
252
PLAYING_SONG :setVolume ((vol / 100 ) * (memory .match .paused and 0.35 or 1 ))
0 commit comments