Get Notified When Certain Player is in your Room/WW
#1
Get Notified When Certain Player is in your Room/WW

NOTE: Does NOT work in Dolphin Emulator

This code will notify you when a certain player joins your room/WW, or if you join a room/WW and that certain player is in it.

How the code works: You will get notified if a player is in the same Room/WW as you once the race begins (which will be after he joins). As the race starts, your HUD will fade notifying you that the targeted player is in your Room/WW. If the targeted player leaves the WW while you stay in the WW, when next race starts, the HUD will go back to normal. If you leave the WW before the targeted player leaves, the HUD will not fix itself. The start of each race updates the HUD accordingly.

XXXXYYYYWWWWZZZZ = The targeted player's FC in Hex.

How to take an FC and make it HEX:
Let's say the Target FC is 2705-8294-0189. Use any online converter to change it from Decimal to Hex.

The Hex value for that FC is 0000003F0000021D.

NTSC-U
C261E0CC 0000000A
3C808060 6084C748
3D60XXXX 616BYYYY
81830170 7C0C5800
40A20024 3D60WWWW
616BZZZZ 81830174
7C0C5800 40A20010
3D803800 618C007F
4800000C 3D803800
618C00FF 91840000
88830185 00000000

PAL
C26513E0 0000000A
3C808063 6084DB68
3D60XXXX 616BYYYY
81830170 7C0C5800
40A20024 3D60WWWW
616BZZZZ 81830174
7C0C5800 40A20010
3D803800 618C007F
4800000C 3D803800
618C00FF 91840000
88830185 00000000

NTSC-J
C2650A4C 0000000A
3C808063 6084D1D4
3D60XXXX 616BYYYY
81830170 7C0C5800
40A20024 3D60WWWW
616BZZZZ 81830174
7C0C5800 40A20010
3D803800 618C007F
4800000C 3D803800
618C00FF 91840000
88830185 00000000

NTSC-K
C263F6F8 0000000A
3C808062 6084BE80
3D60XXXX 616BYYYY
81830170 7C0C5800
40A20024 3D60WWWW
616BZZZZ 81830174
7C0C5800 40A20010
3D803800 618C007F
4800000C 3D803800
618C00FF 91840000
88830185 00000000



Source (for NTSC-K):
#~~~~~~~~~~~~~~~~#
# START ASSEMBLY #
#~~~~~~~~~~~~~~~~#

#~~~~~~~~#
# NTSC-K #
#~~~~~~~~#

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

##r4 safe to use because it gets overwritten by Default ASM at end of code##

#

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Set HUD Transparency Code Address #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lis r4, 0x8062 #Set 1st half of NTSC-K HUD Code Address
ori r4, r4, 0xBE80 #Set 2nd half of NTSC-K HUD Code Address

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# User Entered First Half of FC Here #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lis r11, 0xXXXX #Load user's desired first fourth of FC value into upper 16 bits of r14
ori r11, r11, 0xYYYY #Load user's desired second fourth of FC value into lower 16 bits of r14

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Load First Half of Current Player's FC #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lwz r12, 0x0170 (r3) #Load FC Upper 32 bits from current read player's USER Record

#~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# First FC Comparison Check #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~#

cmpw r12, r11
bne+ no_go

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# User Entered Second Half of FC Here #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lis r11, 0xWWWW #Load user's desired third fourth of FC value into upper 16 bits of r14
ori r11, r11, 0xZZZZ #Load user's desired final fourth of FC value into lower 16 bits of r14

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Load Second Half of Current Player's FC #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lwz r12, 0x0174 (r3) #Load FC Lower 32 bits from current read player's USER Record

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Second FC Comparison Check #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

cmpw r12, r11
bne+ no_go

#~~~~~~~~~~~~~~~~~~~~~~#
# Execute Notification #
#~~~~~~~~~~~~~~~~~~~~~~#

lis r12, 0x3800 #Set 1st half value of word to write to the HUD Address
ori r12, r12, 0x007F #Set 2nd half value of word
b the_end

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# no_go label; set HUD to normal #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

no_go:
lis r12, 0x3800 #Set 1st half value of word to write to the HUD Address
ori r12, r12, 0x00FF #Set 2nd half value of word

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# the_end label & Default ASM #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

the_end:
stw r12, 0 (r4) #Store finalized word to HUD Transparency Modifier Address
lbz r4, 0x0185 (r3) #Default ASM

#

#~~~~~~~~~~~~~~#
# END ASSEMBLY #
#~~~~~~~~~~~~~~#



Code creator: zak
Code contributor(s): Star (address founder); EvilRobot (HUD Transparency Modifier)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)