Globe Control [Vega]
#1
Globe Control [Vega]

Video - https://www.youtube.com/watch?v=G8KSd_2peMk

This code will allow you to use the motion of your analog stick on your controller (or the motion of your Wii Wheel) to direct the spin of the globe at the WiFi main menu. The further the motion of the stick/wheel, the faster the globe will spin. Player1/Port1 only.

NTSC-U
04748A74 60000000
04748A88 60000000
C2748AAC 0000000E
3C60809C 80638F4C
E1830034 118C64A0
E1BE00CC 3D404333
9141FFFC C161FFFC
11405850 11AD602A
108D5840 4185002C
108D5040 4184002C
108D58C0 41850014
108D50C0 40840020
11AD5C60 48000018
11AD5460 48000010
FDA05090 48000008
FDA05890 F1BE00CC
C03E00CC 00000000

PAL
0474DFB4 60000000
0474DFC8 60000000
C274DFEC 0000000E
3C60809C 8063D70C
E1830034 118C64A0
E1BE00CC 3D404333
9141FFFC C161FFFC
11405850 11AD602A
108D5840 4185002C
108D5040 4184002C
108D58C0 41850014
108D50C0 40840020
11AD5C60 48000018
11AD5460 48000010
FDA05090 48000008
FDA05890 F1BE00CC
C03E00CC 00000000

NTSC-J
0474D620 60000000
0474D634 60000000
C274D658 0000000E
3C60809C 8063C76C
E1830034 118C64A0
E1BE00CC 3D404333
9141FFFC C161FFFC
11405850 11AD602A
108D5840 4185002C
108D5040 4184002C
108D58C0 41850014
108D50C0 40840020
11AD5C60 48000018
11AD5460 48000010
FDA05090 48000008
FDA05890 F1BE00CC
C03E00CC 00000000

NTSC-K
0473C374 60000000
0473C388 60000000
C273C3AC 0000000E
3C60809B 8063BD4C
E1830034 118C64A0
E1BE00CC 3D404333
9141FFFC C161FFFC
11405850 11AD602A
108D5840 4185002C
108D5040 4184002C
108D58C0 41850014
108D50C0 40840020
11AD5C60 48000018
11AD5460 48000010
FDA05090 48000008
FDA05890 F1BE00CC
C03E00CC 00000000



Code creator: Vega
Code credits: Seeky (inputdata.h), Atlas (Change Earth Rotation)



#Sources

#RAM Writes (nops)
#Addresses
#NTSC-U 80748A74 80748A88
#PAL 8074DFB4 8074DFC8
#NTSC-J 8074D620 8074D634
#NTSC-K 8073C374 8073C388

#1st RAM Write changes stfs f1, 0x00D0 (r3) to a nop
#2nd RAM Write changes stfs f0, 0x00D0 (r3) to a nop
#These are done to prevent the default lateral nonstop spin of the globe.

#Start Assembly (C2)

#Address Ports
#NTSC-U = 80748AAC
#PAL = 8074DFEC
#NTSC-J = 8074D658
#NTSC-K = 8073C3AC

#Region Compilation Setting
.set region, '' #Fill in E, P, J, or K within the quotes for your region when Compiling! Lowercase letters can also be used.

#Region Depedent Statements
.if (region == 'E' || region == 'e') # RMCE
    .set inputbase, 0x809B8F4C
.elseif (region == 'P' || region == 'p') # RMCP
    .set inputbase, 0x809BD70C
.elseif (region == 'J' || region == 'j') # RMCJ
    .set inputbase, 0x809BC76C
.elseif (region == 'K' || region == 'k') # RMCK
    .set inputbase, 0x809ABD4C
.else # Invalid Region
    .err
.endif

#Register Notes
#r3 is safe for use
#r30 + 0xCC = longitude spot in memory
#r30 + 0xD0 = latitude spot in memory

#f10 = -179 (both ps's)
#f11 = 179 (both ps's)
#f12 ps0 = stick X initially when loaded, then becomes stick Y
#f12 ps1 = stick Y initially when loaded, then becomes stick X
#f13 ps0 = longitude
#f13 ps1 = latitude

#Load Pointer from InputBase
lis r3, inputbase@ha #ha to account for 16-bit offset signage
lwz r3, inputbase@l (r3)

#Load Stick X and Stick Y floats as Paired Singles
psq_l f12, 0x0034 (r3), 0, 0

#Flip the paired segments so Stick X effects Lat and Stick Y effects Long
ps_merge10 f12, f12, f12

#Load Longitude & Latitude from Memory
psq_l f13, 0x00CC (r30), 0, 0

#Set 179.0 as a constant in f11, Set -179 as a constant in f10
lis r10, 0x4333 #179
stw r10, -0x4 (sp)
lfs f11, -0x4 (sp) #place 179 in both ps segments of the FPR
ps_neg f10, f11 #place -179 in both ps segments of the FPR #Can't use fneg because it will only change ps0 of f10. We need both ps's of f10 with -179.

#Adjust the Longitude & Latitude simultaneously depending on their respective Stick X and Stick Y values
ps_add f13, f13, f12

#
#Check Longitude (ps0 f13) against 179
ps_cmpo0 cr1, f13, f11
bgt- cr1, longhilo

#Check Longitude (ps0 f13) against -179
ps_cmpo0 cr1, f13, f10
blt- cr1, longlohi

#Check Latitude (ps1 f13) against 179
ps_cmpo1 cr1, f13, f11
bgt- cr1, lathilo

#Check Latitude (ps1 f13) against -179
ps_cmpo1 cr1, f13, f10
bge- cr1, update #No flipping on long or lat needed, simply update values
#

#latlohi
ps_merge01 f13, f13, f11 #keep lat unchanged, change long from -180 to 179
b update

lathilo:
ps_merge01 f13, f13, f10 #keep lat unchanged, change long from 180 to -179
b update

longhilo:
fmr f13, f10 #change long from 180 to -179; fmr only effects ps0 so lat remains unaffected by this instruction, yay.
b update

longlohi:
fmr f13, f11 #change long from -180 to 179; fmr only effects ps0 so lat remains unaffected by this instruction, yay.

#Update the Longitude & Latitude in memory
update:
psq_st f13, 0x00CC (r30), 0, 0

#Default Instruction
lfs f1, 0x00CC (r30)
Reply
#2
Great work Vega. I’m so proud of you! I can’t wait to put it to use!
Reply
#3
Nice job on this!
Super Mario Eclipse, what Super Mario Sunshine could've been.
Reply
#4
Bump. Made some improvements to this code...

- Changed Assembly Codetype from C0 to C2
- No more EVA usage
- Thanks to inputdata.h from Seeky, this now works for every controller including the Wheel!
- Globe spin speed varies depending on how far you push your analog stock (or move your Wii Wheel). The less push/motion, the slower the globe spins.
- Assembly source optimized due to use of Paired Singles
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)