Change Reg ID, Flag, Globe Loc LIVE in Room or in Between Races [Vega]
#1
Change Reg ID, Flag, Globe Loc LIVE in Room or in Between Races [Vega]

This code that allows you to change your Region ID (line color), Country Code (Flag Image if applicable), and Globe Location in between races. If desired, you can be in an open/idle friend room and use your activators to swap between two sets of country codes/globe positions LIVE. Everyone will see the effects.

Do NOT press/hold-down other buttons when pressing your activators

XXXX = Controller Address
q (PAL only) = 5 for GCN; 4 for non-GCN
ZZZZ = Activator for Option #1
zzzz = Activator for Option #2

Option #1 values:
KK = Country
PPPPPPPP = Globe Location
R = Region ID

Option #2 values:
kk = Country
pppppppp = Globe Location
r = Region ID

NOTICE: When using this code to make changes take effect race after race (like changing region ID's in between races), press your activators during the course vote (not during the actual race itself). If you press your activators during a race, then not press them when you are on the course vote, the code will not update your changes when the next race begins.

For using this code to change region, flag image, and globe position in an idle open room, simply press your activators whenever you want. Changes take effect instantly.

Known Code side-effect:
If your normal Flag settings (location within Country) is disabled, then you will be set at 0 Lat & 0 Long with the Country's Flag on (if applicable). This occurs until you activate the code for the first time.

PAL
0400AF7C 4800005C
0400AFEC 4800009C
0400B0A0 4800009C
C2662ABC 0000000C
3D808035 A18C8200
280C0880 41820020
280C0090 40A20044
3D005F01 3D20E29F
61297C4A 39400003
48000014 3D003101
3D2015A5 6129C412
39400001 3D608043
910300B8 912300BC
994300C5 910BABD8
912BBBDC 994BAB67
88030000 00000000

NTSC-U
0400AEDC 4800005C
0400AF4C 4800009C
0400B000 4800009C
C26609D8 0000000C
3D808034 A18C8200
280C0880 41820020
280C0090 40A20044
3D005F01 3D20E29F
61297C4A 39400003
48000014 3D003101
3D2015A5 6129C412
39400001 3D608042
910300B8 912300BC
994300C5 910B6858
912B785C 994B67E7
88030000 00000000

NTSC-J
0400AEA0 4800005C
0400AF10 4800009C
0400AFC4 4800009C
C2662128 0000000C
3D808034 A18C7B80
280C0880 41820020
280C0090 40A20044
3D005F01 3D20E29F
61297C4A 39400003
48000014 3D003101
3D2015A5 6129C412
39400001 3D608043
910300B8 912300BC
994300C5 910BA558
912BB55C 994BA4E7
88030000 00000000

NTSC-K
0400B028 4800005C
0400B098 4800009C
0400B14C 4800009C
C2650DD4 0000000C
3D808033 A18C8200
280C0880 41820020
280C0090 40A20044
3D005F01 3D20E29F
61297C4A 39400003
48000014 3D003101
3D2015A5 6129C412
39400001 3D608042
910300B8 912300BC
994300C5 910B8BF8
912B9BFC 994B8B87
88030000 00000000




Code creator: Vega
Code credits: Anarion (local Geo Packet), Atlas (default Geo Packet)



ASM Source:
Code:
#C2 Hook Addresses
#PAL    80662ABC
#NTSC-U 806609D8
#NTSC-J 80662128
#NTSC-K 80650DD4

#Region setting
.set region, '' #p, e, j, or k

#Set Static Ptrs
.if (region == 'P' || region == 'p') #PAL
        .set geo_table, 0x80245DA8
        .set anarion, 0x8042AB67
.elseif (region == 'E' || region == 'e') #NTSC-U
        .set geo_table, 0x80245A90
        .set anarion, 0x804267E7
.elseif (region == 'J' || region == 'j') #NTSC-J
        .set geo_table, 0x80245758
        .set anarion, 0x8042A4E7
.elseif (region == 'K' || region == 'k') #NTSC-K
        .set geo_table, 0x80245B88
        .set anarion, 0x80418B87
.else #Invalid Region
        .err #Region match not detected. Tell the Assembler to halt and throw an error.
.endif

#Register notes
#r3 points to USER Handle Root
#r3 + 8 points to your USER packet

#Grab controller values
lis r12, 0x8035 #PAL GCN used for test source
lhz r12, 0xFFFF8200 (r12)

#Was ZZZZ/zzzz only pressed?
cmplwi r12, 0x0880 #GCN Y button used for test source
beq- set_option1
cmplwi r12, 0x0090 #GCN Z button used for test source
bne+ og_instruction

#Set option2
lis r8, 0x5F01 #New Zealand used for test source
lis r9, 0xE29F #Wellington used for test source
ori r9, r9, 0x7C4A
li r10, 3 #AUS/NZ used for test source
b write_values

#Set option1
set_option1:
lis r8, 0x3101 #USA used for test source
lis r9, 0x15A5 #Florida used for test source
ori r9, r9, 0xC412
li r10, 1 #USA used for test source

#Write values
write_values:
lis r11, anarion@ha
stw r8, 0xB8 (r3)
stw r9, 0xBC (r3)
stb r10, 0xC5 (r3)
stw r8, anarion@l+0x0071 (r11)
stw r9, anarion@l+0x1075 (r11)
stb r10, anarion@l (r11)

#Original Instruction
og_instruction:
lbz r0, 0 (r3)

1st RAM Write:
Code:
#Jump from 2nd instruction of SetCountry Func to first instruction of Func that only executes for Countries that have their Location within enabled. This forces flag image (if applicable) no matter what. Needed for rare troublesome SYSCONFs
#PAL    8000AF7C
#NTSC-U 8000AEDC
#NTSC-J 8000AEA0
#NTSC-K 8000B028
b 0x5C

2nd RAM Write:
Code:
#Jump from 2nd instruction of SetLatitude Func to first instruction of Func that will always load Latitude from Anarion's packet. Needed for rare troublesome SYSCONFs
#PAL    8000AFEC
#NTSC-U 8000AF4C
#NTSC-J 8000AF10
#NTSC-K 8000B098
b 0x9C

3rd RAM Write:
Code:
#Jump from 2nd instruction of SetLongitude Func to first instruction of Func that will always load Longitude from Anarion's packet. Needed for rare troublesome SYSCONFs
#PAL    8000B0A0
#NTSC-U 8000B000
#NTSC-J 8000AFC4
#NTSC-K 8000B14C
b 0x9C
Reply
#2
Is it possible to switch with more than 2 regions?
Reply
#3
(09-19-2018, 04:23 PM)Atlas Wrote: Is it possible to switch with more than 2 regions?

Yea, rewrite the source to allow so.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)