Future Fly (Classic Controller) [TheMrx1983, Skullface, Ro]
#1
Future Fly (Classic Controller) [TheMrx1983, Skullface, Ro]

For Classic Controller only. You can find for other controllers in this site.

Skullface edited Future Fly Lite to work on Classic Controller but since it's the lite version it lacked straffing up/down/left/right. From his source, I added straffing and cleaned up Future Fly code, some unnecessary parts were improved and I also the code be a single C2 hook, it no longer needs the extra C2 hook which writes your player ID to free memory to be read in Future Fly and the flight values such as speed, turning strength etc being written in free memory addresses.

The code works like the GameCube version. To activate the code, push the right stick up to go up and enable. Press A and B at the same time to disable.

Can be used with "No Camera Height Shift in Air" for better view (Normal camera in air, https://mariokartwii.com/showthread.php?tid=2222)

To change activator, change 2434XXXX 3C800000 to 2834XXXX YYYYZZZZ  and the deactivator 2834XXXX FFAF0050 to 2834XXXX YYYYZZZZ (ZZZZ: Button value, YYYY: FFFF - Button value). XXXX: Controller Address (First line one is different because it is stick address instead of button, modify to button one if you want to enable with button), ZZZZ: Button value, YYYY: FFFF - Button value) Button values: https://mariokartwii.com/showthread.php?...ton+values

NTSC-U
243414D8 3C800000
C25AA6FC 00000027
EC7A01F2 3D80809C
818CD110 818C0020
3D60809C 816B8F68
896B0B84 1D6B0004
7D8C5A14 818C0000
818C0024 818CFFF8
818C0008 818C0008
398C0010 7C0CF000
408200F0 4800001D
43700000 42F00000
43400000 43700000
BD500000 BD800000
7E4802A6 3DE08034
C03E0068 C33E006C
C2FE0070 3DC0808B
C20E053C A1CF14C2
C2520010 FE209050
FE508CAE C2320000
C28F14D4 FDE0A050
FE907D2E C1F2000C
EDF403F2 C27EFF8C
EE7303F2 EC219828
C27EFFAC EE7303F2
EEF79828 C20F14D8
C1F20008 EE1003F2
EF39802A 71CC0040
41820014 C2320004
FE208850 FE409050
4800000C 71CC0010
41820028 C27EFF94
EE730472 EC21982A
C27EFFA4 EE730472
EF39982A C27EFFB4
EE730472 EEF7982A
C26F14CC EE5204F2
D25E00E8 C26F14D0
FE609850 C2320014
EE3104F2 D23E00E4
60000000 00000000
E0000000 00000000
283414C2 FFAF0050
045AA6FC EC7A01F2
E0000000 00000000

PAL
24345858 3C800000
C25B5624 00000027
EC7A01F2 3D80809C
818C18F8 818C0020
3D60809C 816BD728
896B0B84 1D6B0004
7D8C5A14 818C0000
818C0024 818CFFF8
818C0008 818C0008
398C0010 7C0CF000
408200F0 4800001D
43700000 42F00000
43400000 43700000
BD500000 BD800000
7E4802A6 3DE08034
C03E0068 C33E006C
C2FE0070 3DC0808B
C20E4BEC A1CF5842
C2520010 FE209050
FE508CAE C2320000
C28F5854 FDE0A050
FE907D2E C1F2000C
EDF403F2 C27EFF8C
EE7303F2 EC219828
C27EFFAC EE7303F2
EEF79828 C20F5858
C1F20008 EE1003F2
EF39802A 71CC0040
41820014 C2320004
FE208850 FE409050
4800000C 71CC0010
41820028 C27EFF94
EE730472 EC21982A
C27EFFA4 EE730472
EF39982A C27EFFB4
EE730472 EEF7982A
C26F584C EE5204F2
D25E00E8 C26F5850
FE609850 C2320014
EE3104F2 D23E00E4
60000000 00000000
E0000000 00000000
28345842 FFAF0050
045B5624 EC7A01F2
E0000000 00000000

NTSC-J
243451D8 3C800000
C25B4FA4 00000027
EC7A01F2 3D80809C
818C18F8 818C0020
3D60809C 816BC788
896B0B84 1D6B0004
7D8C5A14 818C0000
818C0024 818CFFF8
818C0008 818C0008
398C0010 7C0CF000
408200F0 4800001D
43700000 42F00000
43400000 43700000
BD500000 BD800000
7E4802A6 3DE08034
C03E0068 C33E006C
C2FE0070 3DC0808B
C20E3D4C A1CF51C2
C2520010 FE209050
FE508CAE C2320000
C28F51D4 FDE0A050
FE907D2E C1F2000C
EDF403F2 C27EFF8C
EE7303F2 EC219828
C27EFFAC EE7303F2
EEF79828 C20F51D8
C1F20008 EE1003F2
EF39802A 71CC0040
41820014 C2320004
FE208850 FE409050
4800000C 71CC0010
41820028 C27EFF94
EE730472 EC21982A
C27EFFA4 EE730472
EF39982A C27EFFB4
EE730472 EEF7982A
C26F51CC EE5204F2
D25E00E8 C26F51D0
FE609850 C2320014
EE3104F2 D23E00E4
60000000 00000000
E0000000 00000000
283451C2 FFAF0050
045B4FA4 EC7A01F2
E0000000 00000000

NTSC-K
24333858 3C800000
C25A367C 00000027
EC7A01F2 3D80809B
818CFF38 818C0020
3D60809B 816BBD68
896B0B84 1D6B0004
7D8C5A14 818C0000
818C0024 818CFFF8
818C0008 818C0008
398C0010 7C0CF000
408200F0 4800001D
43700000 42F00000
43400000 43700000
BD500000 BD800000
7E4802A6 3DE08033
C03E0068 C33E006C
C2FE0070 3DC0808A
C20E3064 A1CF3842
C2520010 FE209050
FE508CAE C2320000
C28F3854 FDE0A050
FE907D2E C1F2000C
EDF403F2 C27EFF8C
EE7303F2 EC219828
C27EFFAC EE7303F2
EEF79828 C20F3858
C1F20008 EE1003F2
EF39802A 71CC0040
41820014 C2320004
FE208850 FE409050
4800000C 71CC0010
41820028 C27EFF94
EE730472 EC21982A
C27EFFA4 EE730472
EF39982A C27EFFB4
EE730472 EEF7982A
C26F384C EE5204F2
D25E00E8 C26F3850
FE609850 C2320014
EE3104F2 D23E00E4
60000000 00000000
E0000000 00000000
28333842 FFAF0050
045A367C EC7A01F2
E0000000 00000000

Code:
#============================================================#
#                          Source                          #
#------------------------------------------------------------#
# Future Fly Address Ports:                                  #
# RMCE - 0x805AA6FC                                          #
# RMCP - 0x805B5624                                          #
# RMCJ - 0x805B4FA4                                          #
# RMCK - 0x805A367C                                          #
#============================================================#

.set region, '' #Plug in e,p,j,k for compilation region
.set _AccelButton, 0x0010
.set _BackButton, 0x0040
.set _ForwSpeed, 0x0000
.set _BackSpeed, 0x0004
.set _UDStrafe, 0x0008
.set _LRStrafe, 0x000C
.set _LRTurnStrength, 0x0010
.set _UDTurnStrength, 0x0014

.if (region == 'E' || region == 'e')
        .set ptr_raceData, 0x809B8F68
.set ptr_playerBase, 0x809BD110
.set addr_controllerButtons, 0x803414C2
.set addr_controllerRightUDStick, 0x803414D8
.set addr_controllerRightLRStick, 0x803414D4
.set addr_controllerLeftUDStick, 0x803414D0
.set addr_controllerLeftLRStick, 0x803414CC
.set addr_floatUsedForMirroring, 0x808B053C
.elseif (region == 'P' || region == 'p')
        .set ptr_raceData, 0x809BD728
.set ptr_playerBase, 0x809C18F8
.set addr_controllerButtons, 0x80345842
.set addr_controllerRightUDStick, 0x80345858
.set addr_controllerRightLRStick, 0x80345854
.set addr_controllerLeftUDStick, 0x80345850
.set addr_controllerLeftLRStick, 0x8034584C
.set addr_floatUsedForMirroring, 0x808B4BEC
.elseif (region == 'J' || region == 'j')
        .set ptr_raceData, 0x809BC788
.set ptr_playerBase, 0x809C18F8
.set addr_controllerButtons, 0x803451C2
.set addr_controllerRightUDStick, 0x803451D8
.set addr_controllerRightLRStick, 0x803451D4
.set addr_controllerLeftUDStick, 0x803451D0
.set addr_controllerLeftLRStick, 0x803451CC
.set addr_floatUsedForMirroring, 0x808B3D4C
.set addr_controllerUDStick, 0x803414D8
.elseif (region == 'K' || region == 'k')
        .set ptr_raceData, 0x809ABD68
.set ptr_playerBase, 0x809AFF38
.set addr_controllerButtons, 0x80333842
.set addr_controllerRightUDStick, 0x80333858
.set addr_controllerRightLRStick, 0x80333854
.set addr_controllerLeftUDStick, 0x80333850
.set addr_controllerLeftLRStick, 0x8033384C
.set addr_floatUsedForMirroring, 0x808A3064
.else
        .err
.endif

fmuls f3,f26,f7 # Original instruction

#Only apply to Player 1
lis r12, ptr_playerBase@ha
lwz r12, ptr_playerBase@l (r12)
lwz r12, 0x20 (r12)
lis r11, ptr_raceData@ha
lwz r11, ptr_raceData@l (r11)
lbz r11, 0xB84 (r11)
mulli r11, r11, 4
add r12, r12, r11
lwz r12, 0 (r12)
lwz r12, 0x24 (r12)
lwz r12, -0x8 (r12)
lwz r12, 0x8 (r12)
lwz r12, 0x8 (r12)
addi r12, r12, 0x10
cmpw r12, r30
bne end

bl FlightValues
.long 0x43700000 #Forward speed value
.long 0x42F00000 #Backward speed value
.long 0x43400000 #Strafe Up/Down speed value
.long 0x43700000 #Strafe Left/Right speed value
.long 0xBD500000 #Left/Right turn strenght value
.long 0xBD800000 #Up/Down turn strenght value

FlightValues:
mflr r18

lis r15, addr_controllerButtons@ha

# Load coordinates
lfs f1, 0x0068 (r30)
lfs f25, 0x006C (r30)
lfs f23, 0x0070 (r30)

#Invert turning in Mirror Mode

lis r14, addr_floatUsedForMirroring@ha
lfs f16, addr_floatUsedForMirroring@l (r14)

#Fly Forward/Backwards

#Controller Address
lhz r14, addr_controllerButtons@l (r15)

lfs f18, _LRTurnStrength (r18)
fneg f17, f18
fsel f18, f16, f18, f17
lfs f17, _ForwSpeed (r18)

strafe:
# Strafe Left/Right

lfs f20, addr_controllerRightLRStick@l (r15)
fneg f15, f20
fsel f20, f16, f20, f15
lfs f15, _LRStrafe (r18)
fmuls f15, f20, f15
lfs f19, -0x74 (r30)
fmuls f19, f19, f15
fsubs f1, f1, f19
lfs f19, -0x54 (r30)
fmuls f19, f19, f15
fsubs f23, f23, f19

# Strafe Up/Down

lfs f16, addr_controllerRightUDStick@l (r15)
lfs f15, _UDStrafe (r18)
fmuls f16, f16, f15
fadds f25, f25, f16

andi. r12,r14, _BackButton
beq forward
lfs f17, _BackSpeed (r18)
fneg f17, f17
fneg f18, f18
b moveCalc

forward:
andi. r12, r14, _AccelButton
beq turning
moveCalc:
lfs f19, -0x6C (r30)
fmuls f19, f19, f17
fadds f1, f1, f19
lfs f19, -0x5C (r30)
fmuls f19, f19, f17
fadds f25, f25, f19
lfs f19, -0x4C (r30)
fmuls f19, f19, f17
fadds f23, f23, f19

turning:
#Turn left/right

lfs f19, addr_controllerLeftLRStick@l (r15)
fmuls f18, f18, f19
stfs f18, 0x00E8 (r30)

#Turn up/down

lfs f19, addr_controllerLeftUDStick@l (r15)
fneg f19, f19
lfs f17, _UDTurnStrength (r18)
fmuls f17, f17, f19
stfs f17, 0x00E4 (r30)
end:
#============================================================#

Code credits: mdmwii (Original Free Fly code), TheMrx1983 (Made Future Fly out of Free Fly code), Skullface (Future Fly Light for Classic Controller), Ro (Added straffing, improved code and source, made it be a single C2 write code)
Reply
#2
Nice work. This code (regardless of controller type) was long overdue for a rehaul.

Considering much of the controller data sits adjacent to each other in memory, have you looked into using Paired Singles w/ Quantization? Would chop off some more lines of code.
Reply
#3
I have not. I could look into it futurely. If I could find the "KartVehicle" from this function it would be possible to make Future Fly Light work for all controllers in a single code, by reading the kart inputs rather than the global game one. For straffing however, it would have to be specific.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)