UnclePunch
Smash Ace
- Joined
- Nov 9, 2014
- Messages
- 673
Code:
$Music Plays at 20% Volume When All Controllers Are Idle For 1 Minute [UnclePunch]
C237793C 00000018
7DC802A6 480000A5
7E0802A6 7DC803A6
1E380002 7C600279
40820020 89F00008
2C0F0001 41820094
7DD1822E 39CE0001
7DD1832E 48000038
39C00000 91D00000
91D00004 89D00008
2C0E0001 4082006C
3DC0804D 61CE3884
A1F0000A B1EE0002
39E00000 99F00008
48000050 7DD1822E
2C0E0E10 41800044
89F00008 2C0F0001
41820038 3DC0804D
61CE3884 A1EE0002
B1F0000A 39E00019
B1EE0002 39E00001
99F00008 48000014
4E800021 00000000
00000000 00000000
7C600279 00000000
Code:
inject @ 8037793c (HSD_PadRenewMasterStatus)
.macro load reg, address
lis \reg, \address @h
ori \reg, \reg, \address @l
.endm
getAddress:
mflr r14
bl variables
mflr r16
mtlr r14
mulli r17,r24,0x2
xor. r0, r3, r0 #original codeline, determine if new button was pressed
bne pressedButton
noUniquePressThatFrame:
incrementTimer:
lbz r15,0x8(r16) #get music lowered bool
cmpwi r15,0x1 #if music is lowered, do not increment frame counts
beq exit
lhzx r14,r17,r16 #get players frame count half
addi r14,r14,0x1 #increment by 1
sthx r14,r17,r16 #store back to variable
b compareTime
pressedButton:
li r14,0x0
stw r14,0x0(r16) #zero out all input counters
stw r14,0x4(r16) #zero out all input counters
lbz r14,0x8(r16) #get music lowered bool
cmpwi r14,0x1 #if music is playing, do not resume music
bne exit
resumeMusic:
load r14,0x804d3884 #get master volume address
lhz r15,0xA(r16) #get master volume value when music was lowered
sth r15,0x2(r14) #store value
li r15,0x0
stb r15,0x8(r16) #set music lowered bool as 0
b exit
compareTime:
lhzx r14,r17,r16 #get player's frame count
cmpwi r14,0xE10 #exit if 1 minute has not gone by
blt exit
lowerMusic:
lbz r15,0x8(r16) #check if music is lowered
cmpwi r15,0x1 #exit if it has
beq exit
load r14,0x804d3884 #get master volume address
lhz r15,0x2(r14) #get master volume value
sth r15,0xA(r16) #store prev volume
li r15,0x19 #load 20% value
sth r15,0x2(r14) #lower volume
li r15,0x1 #1 = music is lowered
stb r15,0x8(r16) #set music lowered bool to 1
b exit
#####################
variables:
blrl
#0x0 = framesSinceP1Input
#0x2 = framesSinceP2Input
.long 0x00000000
#0x0 = framesSinceP3Input
#0x2 = framesSinceP4Input
.long 0x00000000
#0x0 = isMusicMuted
#0x2 = valueBeforeLowered
.long 0x00000000
######################
exit:
xor. r0, r3, r0
Thanks @Gehis514 for the suggestion! This was much needed.
Last edited: