Host Detector [Vega]
#1
Host Detector [Vega]

This code will tell you (via the Milliseconds section of your Timer) whether or not you are the Host.

Millisecond Values:
000 = Host
Normal Function of Timer = Not Host

NTSC-U
C20FC4A4 00000005
3D808053 3D6038A0
2C1F0005 4182000C
3D6080A1 616B0024
916C10A0 93FC023C
60000000 00000000

PAL
C20FC544 00000005
3D808053 3D6038A0
2C1F0005 4182000C
3D6080A1 616B0024
916C5BE8 93FC023C
60000000 00000000

NTSC-J
C20FC464 00000005
3D808053 3D6038A0
2C1F0005 4182000C
3D6080A1 616B0024
916C5568 93FC023C
60000000 00000000

NTSC-K
C20FC5BC 00000005
3D808052 3D6038A0
2C1F0005 4182000C
3D6080A1 616B0024
916C3C40 93FC023C
60000000 00000000



Source:
.set region, '' #Must set region value, or else source will not compile

.if (region == 'E' || region == 'e') # RMCE
    .set _1sthalf, 0x8053
    .set _2ndhalf, 0x10A0
.elseif (region == 'P' || region == 'p') # RMCP
    .set _1sthalf, 0x8053
    .set _2ndhalf, 0x5BE8
.elseif (region == 'J' || region == 'j') # RMCJ
    .set _1sthalf, 0x8053
    .set _2ndhalf, 0x5568
.elseif (region == 'K' || region == 'k') # RMCK
    .set _1sthalf, 0x8052
    .set _2ndhalf, 0x3C40
.else # Invalid Region
    .err
.endif

lis r12, _1sthalf

lis r11, 0x38A0 #Set 11 to 0x38A00000 so the timer will show 000 in the milliseconds

cmpwi r31, 0x5 #Wifi status number for host is always 5. Check if r31 status number is 5
beq- the_end #If equal to 5, we are the Host. Jump to the_end and store value r11's value to memory

lis r11, 0x80A1 #If not host, modify r11's value. Make sure timer functions normally. Set 1st half for default 32 bit data of Millisecond Display Modifier Code
ori r11, r11, 0x0024 #Set 2nd half value for default 32 bit data

the_end:
stw r11, _2ndhalf (r12) #Store the word of r11 to millisecond modifier address. Offset used to complete 2nd half of address.
stw r31, 0x023C (r28) #Default Instruction



Code creator: Vega
Code credits: Bully (Millisecond Display Modifier)
Reply


Messages In This Thread
Host Detector [Vega] - by Vega - 11-06-2018, 03:45 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)