Less intrusive approach using codecave.
Instead of overwriting half the original function, we just replace the calls to GetCategoryVolume with calls to our hooking functions located in a codecave (thank god what an awesome feature). Also makes it easier to maintain this patch and gives us volume control for each category independently.
This commit is contained in:
parent
871d76ba00
commit
aa9ddb1092
@ -1,50 +1,91 @@
|
||||
[XCXRebalanceAudioV101U]
|
||||
moduleMatches = 0xAB97DE6B
|
||||
codeCaveSize = 0x200
|
||||
|
||||
_normalAudio = 0x028933EC
|
||||
_louderAudio = 0x028933F0
|
||||
_GetCategoryIndex = 0x030F201C
|
||||
_AfterEverythingIsDone = 0x28933F8
|
||||
##
|
||||
# You may change these floats
|
||||
##
|
||||
|
||||
0x02893350 = bl _GetCategoryIndex
|
||||
0x02893354 = stw r3, 0x1240(r29)
|
||||
0x02893358 = lwz r3, 0x101A0004@l(r27)
|
||||
0x0289335C = bl _GetCategoryIndex
|
||||
0x02893360 = stw r3, 0x1248(r29)
|
||||
0x02893364 = lwz r3, 0x101A0008@l(r27)
|
||||
0x02893368 = bl _GetCategoryIndex
|
||||
0x0289336C = stw r3, 0x1250(r29)
|
||||
0x02893370 = lwz r3, 0x101A000C@l(r27)
|
||||
0x02893374 = bl _GetCategoryIndex
|
||||
0x02893378 = stw r3, 0x1258(r29)
|
||||
0x0289337C = lwz r3, 0x101A0010@l(r27)
|
||||
0x02893380 = bl _GetCategoryIndex
|
||||
0x02893384 = stw r3, 0x1260(r29)
|
||||
0x02893388 = lwz r3, 0x101A0014@l(r27)
|
||||
0x0289338C = bl _GetCategoryIndex
|
||||
0x02893390 = stw r3, 0x1268(r29)
|
||||
0x02893394 = lwz r3, 0x101A0018@l(r27)
|
||||
0x02893398 = bl _GetCategoryIndex
|
||||
0x0289339C = stw r3, 0x1270(r29)
|
||||
0x028933A0 = lwz r3, 0x101A001C@l(r27)
|
||||
0x028933A4 = bl _GetCategoryIndex
|
||||
0x028933A8 = stw r3, 0x1278(r29)
|
||||
0x028933AC = lis r11, _normalAudio@ha
|
||||
0x028933B0 = lfs f1, _normalAudio@l(r11)
|
||||
0x028933B4 = stfs f1, 0x1244(r29) #BGM
|
||||
0x028933B8 = stfs f1, 0x1254(r29) #BATTLE
|
||||
0x028933BC = stfs f1, 0x125C(r29) #FIELD
|
||||
0x028933C0 = stfs f1, 0x1264(r29) #GIMMICK
|
||||
0x028933C4 = stfs f1, 0x126C(r29) #SYSTEM
|
||||
0x028933C8 = lis r11, _louderAudio@ha
|
||||
0x028933CC = lfs f1, _louderAudio@l(r11)
|
||||
0x028933D0 = stfs f1, 0x1274(r29) #ENVIRONMENT
|
||||
0x028933D4 = stfs f1, 0x127C(r29) #WEATHER
|
||||
0x028933D8 = stfs f1, 0x124C(r29) #VOICE
|
||||
0x028933DC = li r28, 3
|
||||
0x028933E0 = li r30, 0x20
|
||||
0x028933E4 = addi r31, r31, -8
|
||||
0x028933E8 = b _AfterEverythingIsDone
|
||||
0x028933EC = .float 0.7
|
||||
0x028933F0 = .float 1.0
|
||||
0x028933F4 = nop
|
||||
0x000001A0 = .float 0.7 ; BGM
|
||||
0x000001A4 = .float 1.0 ; VOICE
|
||||
0x000001A8 = .float 0.7 ; BATTLE
|
||||
0x000001AC = .float 0.7 ; FIELD
|
||||
0x000001B0 = .float 0.7 ; GIMMICK
|
||||
0x000001B4 = .float 0.7 ; SYSTEM
|
||||
0x000001B8 = .float 1.0 ; ENVIRONMENT
|
||||
0x000001BC = .float 1.0 ; WEATHER
|
||||
|
||||
##
|
||||
# Do not touch anything below if you don't know what you are doing!
|
||||
##
|
||||
|
||||
# Labels for individual volume floats
|
||||
_audioVolumeDefault = 0x1006CF30 ; Also used by the fallback branch of setupCategory
|
||||
_audioVolumeBgm = 0x000001A0
|
||||
_audioVolumeVoice = 0x000001A4
|
||||
_audioVolumeBattle = 0x000001A8
|
||||
_audioVolumeField = 0x000001AC
|
||||
_audioVolumeGimmick = 0x000001B0
|
||||
_audioVolumeSystem = 0x000001B4
|
||||
_audioVolumeEnvironment = 0x000001B8
|
||||
_audioVolumeWeather = 0x000001BC
|
||||
|
||||
##
|
||||
# Hook routines start here
|
||||
##
|
||||
|
||||
# Override BGM volume
|
||||
_hookSetBgmVolume = 0x00000000
|
||||
0x00000000 = lis r11, _audioVolumeBgm@ha
|
||||
0x00000004 = lfs f1, _audioVolumeBgm@l(r11)
|
||||
0x00000008 = blr
|
||||
0x02893358 = bla _hookSetBgmVolume ; Install Hook
|
||||
|
||||
# Override Voice volume
|
||||
_hookSetVoiceVolume = 0x00000010
|
||||
0x00000010 = lis r11, _audioVolumeVoice@ha
|
||||
0x00000014 = lfs f1, _audioVolumeVoice@l(r11)
|
||||
0x00000018 = blr
|
||||
0x0289336C = bla _hookSetVoiceVolume ; Install Hook
|
||||
|
||||
# Override Battle volume
|
||||
_hookSetBattleVolume = 0x00000020
|
||||
0x00000020 = lis r11, _audioVolumeBattle@ha
|
||||
0x00000024 = lfs f1, _audioVolumeBattle@l(r11)
|
||||
0x00000028 = blr
|
||||
0x02893380 = bla _hookSetBattleVolume ; Install Hook
|
||||
|
||||
# Override Field volume
|
||||
_hookSetFieldVolume = 0x00000030
|
||||
0x00000030 = lis r11, _audioVolumeField@ha
|
||||
0x00000034 = lfs f1, _audioVolumeField@l(r11)
|
||||
0x00000038 = blr
|
||||
0x02893394 = bla _hookSetFieldVolume ; Install Hook
|
||||
|
||||
# Override Gimmick volume
|
||||
_hookSetGimmickVolume = 0x00000040
|
||||
0x00000040 = lis r11, _audioVolumeGimmick@ha
|
||||
0x00000044 = lfs f1, _audioVolumeGimmick@l(r11)
|
||||
0x00000048 = blr
|
||||
0x028933A8 = bla _hookSetGimmickVolume ; Install Hook
|
||||
|
||||
# Override System volume
|
||||
_hookSetSystemVolume = 0x00000050
|
||||
0x00000050 = lis r11, _audioVolumeSystem@ha
|
||||
0x00000054 = lfs f1, _audioVolumeSystem@l(r11)
|
||||
0x00000058 = blr
|
||||
0x028933BC = bla _hookSetSystemVolume ; Install Hook
|
||||
|
||||
# Override Environment volume
|
||||
_hookSetEnvironmentVolume = 0x00000060
|
||||
0x00000060 = lis r11, _audioVolumeEnvironment@ha
|
||||
0x00000064 = lfs f1, _audioVolumeEnvironment@l(r11)
|
||||
0x00000068 = blr
|
||||
0x028933D0 = bla _hookSetEnvironmentVolume ; Install Hook
|
||||
|
||||
# Override Weather volume
|
||||
_hookSetWeatherVolume = 0x00000070
|
||||
0x00000070 = lis r11, _audioVolumeWeather@ha
|
||||
0x00000074 = lfs f1, _audioVolumeWeather@l(r11)
|
||||
0x00000078 = blr
|
||||
0x028933E4 = bla _hookSetWeatherVolume ; Install Hook
|
||||
|
Loading…
Reference in New Issue
Block a user