Audio Fade v1.21 [InternetExplorer] C2017618 00000032 3DC0804C 61CE21B0 81CE0000 2C0E0001 40820174 3DC0805A 61CE7400 81CE0014 2C0E0001 41820160 9421FFB8 D8010008 D8210010 D8410018 D8610020 D8810028 BF410030 3F40805B 635AAD00 3F60805A 637B7400 3F803F79 639C999A 939B0008 3F803E80 939B000C 3BC00000 3BE00000 3BFF0001 839A0210 2C1C0000 41820008 3BC00001 8B9A0030 2C1C0020 41800010 2C1C00E0 41810008 3BC00001 8B9A0031 2C1C0020 41800010 2C1C00E0 41810008 3BC00001 3B5A0040 2C1F0008 4180FFB4 3F60805A 637B7400 2C1E0001 835B0000 40820008 3B400000 3B5A0001 935B0000 2C1A2A30 3BE00000 40800008 3BE00001 3FC09034 63DE94D4 C01B0004 C03E0004 C05B0008 C07B000C C09B0010 FC040800 40820010 2C1F0000 41820030 4800000C D03B0004 4800003C FC010000 41820034 EC211024 FC010000 40810008 FC200090 D03E0004 4800001C EC0000F2 EC2100B2 FC010000 40800008 FC200090 D03E0004 83FE0004 93FB0010 C8010008 C8210010 C8410018 C8610020 C8810028 BB410030 38210048 9421FFE0 60000000 00000000 ----NOTES---- 903494d8 - music volume 805BAD00 Controller Port 1 Inputs (GCC) 805BAD40 Controller Port 2 Inputs (GCC) 805BAD80 Controller Port 3 Inputs (GCC) 805BADC0 Controller Port 4 Inputs (GCC) 805BAE00 Controller Port 5 Inputs (Wii) 805BAE40 Controller Port 6 Inputs (Wii) 805BAE80 Controller Port 7 Inputs (Wii) 805BAEC0 Controller Port 8 Inputs (Wii) Injection: 805a7400 -Injection Offsets Below- 00: Timer 04: Old music volume 08: Fade multiplier 0C: Percent to reduce volume to 10: Current music volume 14: Enabled/disabled -ASM BELOW- --80017618-- #Has the game actually started? #If not, don't do anything lis r14,0x804c ori r14,r14,0x21b0 lwz r14,0(r14) cmpwi r14,1 bne REALEND lis r14,0x805A ori r14,r14,0x7400 lwz r14,0x14(r14) cmpwi r14,1 beq REALEND #Save registers to the stack stwu r1,-0x48(r1) stfd f0,0x8(r1) stfd f1,0x10(r1) stfd f2,0x18(r1) stfd f3,0x20(r1) stfd f4,0x28(r1) stmw r26,0x30(r1) #load controller input pointer to r26 lis r26, 0x805B ori r26,r26,0xAD00 #load injection pointer to r27 lis r27,0x805A ori r27,r27,0x7400 #store fade multiplier to memory lis r28,0x3f79 ori r28,r28,0x999a stw r28,0x8(r27) lis r28,0x3e80 stw r28,0xC(r27) #initialize variables li r30,0 #movement flag li r31,0 #loop counter #compare each controller to last frame and store new values LOOP: addi r31,r31,1 lwz r28,0x210(r26) #if last frame's and this frame's inputs are equal, #keep r30 at 0 cmpwi r28,0 beq 0x8 li r30,1 #is stick x-axis over 0x20 AND under 0xE0? lbz r28,0x30(r26) cmpwi r28,0x20 blt 0x10 cmpwi r28,0xE0 bgt 0x8 li r30,1 #is stick y-axis over 0x20 AND under 0xE0? lbz r28,0x31(r26) cmpwi r28,0x20 blt 0x10 cmpwi r28,0xE0 bgt 0x8 li r30,1 #update pointers addi r26,r26,0x40 cmpwi r31,8 blt LOOP #load frame counter, reset if controller moved lis r27,0x805A ori r27,r27,0x7400 #was a controller moved? cmpwi r30,1 lwz r26,0(r27) #if so, reset timer bne 0x8 li r26,0 #add 1 to timer and store addi r26,r26,1 stw r26,0(r27) #has the timer passed 10800 frames? cmpwi r26,10800 li r31,0 bge 0x8 #if not, set r31 to 1 li r31,1 #load current music volume and old music volume lis r30,0x9034 ori r30,r30,0x94D4 lfs f0,0x4(r27) #f0 is Brawl's music volume lfs f1,4(r30) #f1 is current music volume lfs f2,0x8(r27) #f2 is the fade multiplier lfs f3,0xC(r27) #f3 is volume % to dim to lfs f4,0x10(r27) #f4 is last frame's volume #Does last frame's volume equal this frame's? #If not, Brawl changed the volume for some reason, reset variables fcmpu cr0,f4,f1 bne FIX #branch to fadeout or fadein depending on the timer count cmpwi r31,0 beq FADEOUT b FADEIN FIX: #If the game changes volume on its own, set that to the new "Brawl volume" stfs f1,0x4(r27) b END FADEIN: #if current volume = Brawl volume, do nothing fcmpu cr0,f1,f0 beq END #divide volume by multiplier fdivs f1,f1,f2 #is it louder than Brawl volume? fcmpu cr0,f1,f0 ble 0x8 #if so, just use Brawl's volume fmr f1,f0 #store it stfs f1,4(r30) b END FADEOUT: #multiply Brawl's volume by the dim % fmuls f0,f0,f3 #multiply current volume by multiplier fmuls f1,f1,f2 #is it softer than f0? fcmpu cr0,f1,f0 bge 0x8 #if so, just use f0 fmr f1,f0 #store it stfs f1,4(r30) END: #store current volume to last frame's volume lwz r31,0x4(r30) stw r31,0x10(r27) #stack stuff lfd f0,0x8(r1) lfd f1,0x10(r1) lfd f2,0x18(r1) lfd f3,0x20(r1) lfd f4,0x28(r1) lmw r26,0x30(r1) addi r1,r1,0x48 REALEND: #original line we overwrote stwu sp,-0x20(sp)