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

This is for GCN controller, port 1 only.

This code will allow you to use your C stick to manipulate the WiFi Globe's static position (only at the WiFi Main Menu) depending on which direction the C stick is set to. Meaning, you can rotate the Globe however you want!

NOTE: This code makes use of memory addresses, 0x80001000 thru 0x80001007. Make sure no other codes in your GCT/Cheat-Manager are using those addresses.

NTSC-U
04748A8C C03C1000
04748AAC C03C1004
C0000000 00000011
7C0802A6 3D808000
3D608035 894BC204
C06C1000 4800001D
D06C1000 894BC205
C06C1004 4800000D
D06C1004 48000050
3D204333 9121FFFC
C1A1FFFC FD8D6824
280A00C2 41810010
280A0050 41800010
4E800020 EC63602A
48000008 EC636028
FC036840 41810010
FDA06850 FC036840
4C800020 FC601850
4E800020 7C0803A6
4E800020 00000000

PAL
0474DFCC C03C1000
0474DFEC C03C1004
C0000000 00000011
7C0802A6 3D808000
3D608035 894B0584
C06C1000 4800001D
D06C1000 894B0585
C06C1004 4800000D
D06C1004 48000050
3D204333 9121FFFC
C1A1FFFC FD8D6824
280A00C2 41810010
280A0050 41800010
4E800020 EC63602A
48000008 EC636028
FC036840 41810010
FDA06850 FC036840
4C800020 FC601850
4E800020 7C0803A6
4E800020 00000000

NTSC-J
0474D638 C03C1000
0474D658 C03C1004
C0000000 00000011
7C0802A6 3D808000
3D608035 894BFF04
C06C1000 4800001D
D06C1000 894BFF05
C06C1004 4800000D
D06C1004 48000050
3D204333 9121FFFC
C1A1FFFC FD8D6824
280A00C2 41810010
280A0050 41800010
4E800020 EC63602A
48000008 EC636028
FC036840 41810010
FDA06850 FC036840
4C800020 FC601850
4E800020 7C0803A6
4E800020 00000000

NTSC-K
0473C38C C03C1000
0473C3AC C03C1004
C0000000 00000011
7C0802A6 3D808000
3D608034 894BE584
C06C1000 4800001D
D06C1000 894BE585
C06C1004 4800000D
D06C1004 48000050
3D204333 9121FFFC
C1A1FFFC FD8D6824
280A00C2 41810010
280A0050 41800010
4E800020 EC63602A
48000008 EC636028
FC036840 41810010
FDA06850 FC036840
4C800020 FC601850
4E800020 7C0803A6
4E800020 00000000



Code creator: Vega

Code credits: Atlas (Change Earth Rotation Speed), JoshuaMK (Help with C Stick Values)



Source (RAM Writes):

lfs f1, 0x00D0 (r3) changed to lfs f1, 0x1000 (r28) #r28 is always 0x80000000; Load and apply the globe latitude
lfs f1, 0x00CC (r30) changed to lfs f1, 0x1004 (r28) #r28 is always 0x80000000; Load and apply the globe longitude

Source (Execute ASM):
#~~~~~~~~~~~~~~#
#START ASSEMBLY#
#~~~~~~~~~~~~~~#

#

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

#~~~~~~~~~~~~~~#
#Register Notes#
#~~~~~~~~~~~~~~#

#r0 = LR Backup
#r10 = C Stick Status
#r11 = C Stick Memory Reference
#r12 = 0x80000000; For Exp. Vector Read/Write

#~~~~~~~~~~~~#
#Memory Notes#
#~~~~~~~~~~~~#

#0x80001000 = Globe Degree Lateral Floating Point
#0x80001004 = Globe Degree Longitude Floating Point

#~~~~~~~~~#
#Backup LR#
#~~~~~~~~~#

mflr r0

#~~~~~~~~~~~~~~~~~~~~~~#
#Set Exp Vector Address#
#~~~~~~~~~~~~~~~~~~~~~~#

lis r12, 0x8000

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#Set C Stick X/Y Axis Stick Address Reference#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#RMCE = 0x8034C204/5
#RMCP = 0x80350584/5
#RMCJ = 0x8034FF04/5
#RMCK = 0x8033E584/5

.if (region == 'E' || region == 'e') # RMCE
    lis r11, 0x8035
.elseif (region == 'P' || region == 'p') # RMCP
    lis r11, 0x8035
.elseif (region == 'J' || region == 'j') # RMCJ
    lis r11, 0x8035
.elseif (region == 'K' || region == 'k') # RMCK
    lis r11, 0x8034
.else # Invalid Region
    .err
.endif

#~~~~~~~~~~~~~~~~~~~~~~~#
#Check X Axis Byte Value#
#~~~~~~~~~~~~~~~~~~~~~~~#

.if (region == 'E' || region == 'e') # RMCE
    lbz r10, 0xFFFFC204 (r11)
.elseif (region == 'P' || region == 'p') # RMCP
    lbz r10, 0x0584 (r11)
.elseif (region == 'J' || region == 'j') # RMCJ
    lbz r10, 0xFFFFFF04 (r11)
.elseif (region == 'K' || region == 'k') # RMCK
    lbz r10, 0xFFFFE584 (r11)
.else # Invalid Region
    .err
.endif

lfs f3, 0x1000 (r12) #Load Globe Latitude

bl main_routine

stfs f3, 0x1000 (r12) #Update the Globe Latitude

#~~~~~~~~~~~~~~~~~~~~~~~#
#Check Y Axis Byte Value#
#~~~~~~~~~~~~~~~~~~~~~~~#

.if (region == 'E' || region == 'e') # RMCE
    lbz r10, 0xFFFFC205 (r11)
.elseif (region == 'P' || region == 'p') # RMCP
    lbz r10, 0x0585 (r11)
.elseif (region == 'J' || region == 'j') # RMCJ
    lbz r10, 0xFFFFFF05 (r11)
.elseif (region == 'K' || region == 'k') # RMCK
    lbz r10, 0xFFFFE585 (r11)
.else # Invalid Region
    .err
.endif

lfs f3, 0x1004 (r12) #Load Globe Longitude

bl main_routine

stfs f3, 0x1004 (r12) #Update the Globe Longitude

b the_end

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#Main Routine, Calculate Byte Load After Subtraction Equation, Branch Accordingly#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

main_routine:

#First set some Floating Point Values
lis r9, 0x4333 #179, will be flipped if needed to check against -179
stw r9, -0x4 (sp)
lfs f13, -0x4 (sp) #Set f13 to 179
fdiv f12, f13, 13 #Set f12 to 1

cmplwi r10, 0xC2
bgt- in_crease
cmplwi r10, 0x50
blt- de_crease

blr #If C Stick wasn't moved far enough, don't update anything

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#Increase/Decrease Globe Integer Lat/Long Degree #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

in_crease:
fadds f3, f3, f12
b check_for_degree_limit
 
de_crease:
fsubs f3, f3, f12

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#Check If Globe Degree Limit Has Been Surpassed#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

check_for_degree_limit:
fcmpo cr0, f3, f13
bgt- flip_it
fneg f13, f13 #Flip to negative 179
fcmpo cr0, f3, f13
bgelr-

#If less than -179, it's time to flip to positive, If greater than 179, it's time to flip to negative
flip_it:
fneg f3, f3
blr

#~~~~~~~#
#The End#
#~~~~~~~#

the_end:
mtlr r0

#blr #If compiling with WiiRGUI, set address to 0x80000000. Uncomment this instruction. Compile code. Change C2 line to C0.

#

#~~~~~~~~~~~~#
#END ASSEMBLY#
#~~~~~~~~~~~~#
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


Forum Jump:


Users browsing this thread: 1 Guest(s)