Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shared Item Detection [Not Working]
#1
Shared Item Detection

The code works, however, it bares the risk of reporting a false positive for an unknown reason. I do not have the time to fix this bug. So, I will leave the code public for anyone who would like to try to fix it, or base a code off it.

This code will detect when a player tries to obtain a Shared Item, but the item they intend to cheat already has it's maximum amount in play. The code will also detect when a player obtains impossible item combinations. It will display the slot of the cheating player in the milliseconds of the timer, accompanied by a value denoting the reason.

(NTSC-U)
C265EE14 0000000A
9421FFB0 BDC10008
1D960004 3D8C8168
88030001 8AA30003
2C150000 41820014
2C150001 41820014
2C150002 40800010
980C0193 4800000C
48000008 980C0193
B9C10008 38210050
60000000 00000000
C265EE30 00000051
9421FFB0 BDC10008
1D960004 3D8C8168
88100011 8AB00013
2C150000 41820014
2C150001 41820014
2C150002 40800214
980C0193 48000244
3DE08168 61EF0133
3E208168 62310193
8A500010 8A700011
8A900012 7F0902A6
3F4038A0 3F608053
637B10A0 2C140010
41820018 2C140011
41820010 2C140012
41820008 4800001C
2C130010 418201CC
2C130011 418201C4
2C130012 418201BC
3AE0000C 7EE903A6
8B310000 2C190006
40820010 8B2F0000
3B390001 9B2F0000
2C190007 40820010
8B2F0004 3B390001
9B2F0004 2C190008
40820010 8B2F0008
3B390001 9B2F0008
2C190009 40820010
8B2F000C 3B390001
9B2F000C 2C19000A
40820010 8B2F0010
3B390001 9B2F0010
2C19000B 40820010
8B2F0014 3B390001
9B2F0014 2C19000C
40820010 8B2F0018
3B390001 9B2F0018
2C19000D 40820010
8B2F001C 3B390001
9B2F001C 2C19000E
40820010 8B2F0020
3B390001 9B2F0020
2C19000F 40820010
8B2F0024 3B390001
9B2F0024 3A310004
4200FF30 2C130006
40820010 8B2F0000
2C190003 408000C4
2C130007 40820010
8B2F0004 2C190001
408000B0 2C130008
40820010 8B2F0008
2C190001 4080009C
2C130009 40820010
8B2F000C 2C190003
40800088 2C13000A
40820010 8B2F0010
2C190002 40800074
2C13000B 40820010
8B2F0014 2C190002
40800060 2C13000C
40820010 8B2F0018
2C190001 4080004C
2C13000D 40820010
8B2F001C 2C190001
40800038 2C13000E
40820010 8B2F0020
2C190001 40800024
2C13000F 40820010
8B2F0024 2C190001
40800010 48000020
980C0193 48000034
635A0064 48000008
635A012C 7F5AB214
935B0000 3AE0000A
7EE903A6 3F200000
9B2F0000 39EF0004
4200FFF4 7F0903A6
B9C10008 38210050
60000000 00000000
C26593FC 00000006
9421FFB0 BDC10008
907C0008 3F4080A1
635A0024 3F608053
637B10A0 935B0000
B9C10008 38210050
60000000 00000000

(PAL)
C265E18C 0000000A
9421FFB0 BDC10008
1D960004 3D8C8168
88030001 8AA30003
2C150000 41820014
2C150001 41820014
2C150002 40800010
980C0193 4800000C
48000008 980C0193
B9C10008 38210050
60000000 00000000
C265E1A8 00000051
9421FFB0 BDC10008
1D960004 3D8C8168
88100011 8AB00013
2C150000 41820014
2C150001 41820014
2C150002 40800214
980C0193 48000244
3DE08168 61EF0133
3E208168 62310193
8A500010 8A700011
8A900012 7F0902A6
3F4038A0 3F608053
637B5BE8 2C140010
41820018 2C140011
41820010 2C140012
41820008 4800001C
2C130010 418201CC
2C130011 418201C4
2C130012 418201BC
3AE0000C 7EE903A6
8B310000 2C190006
40820010 8B2F0000
3B390001 9B2F0000
2C190007 40820010
8B2F0004 3B390001
9B2F0004 2C190008
40820010 8B2F0008
3B390001 9B2F0008
2C190009 40820010
8B2F000C 3B390001
9B2F000C 2C19000A
40820010 8B2F0010
3B390001 9B2F0010
2C19000B 40820010
8B2F0014 3B390001
9B2F0014 2C19000C
40820010 8B2F0018
3B390001 9B2F0018
2C19000D 40820010
8B2F001C 3B390001
9B2F001C 2C19000E
40820010 8B2F0020
3B390001 9B2F0020
2C19000F 40820010
8B2F0024 3B390001
9B2F0024 3A310004
4200FF30 2C130006
40820010 8B2F0000
2C190003 408000C4
2C130007 40820010
8B2F0004 2C190001
408000B0 2C130008
40820010 8B2F0008
2C190001 4080009C
2C130009 40820010
8B2F000C 2C190003
40800088 2C13000A
40820010 8B2F0010
2C190002 40800074
2C13000B 40820010
8B2F0014 2C190002
40800060 2C13000C
40820010 8B2F0018
2C190001 4080004C
2C13000D 40820010
8B2F001C 2C190001
40800038 2C13000E
40820010 8B2F0020
2C190001 40800024
2C13000F 40820010
8B2F0024 2C190001
40800010 48000020
980C0193 48000034
635A0064 48000008
635A012C 7F5AB214
935B0000 3AE0000A
7EE903A6 3F200000
9B2F0000 39EF0004
4200FFF4 7F0903A6
B9C10008 38210050
60000000 00000000
C2661338 00000006
9421FFB0 BDC10008
907C0008 3F4080A1
635A0024 3F608053
637B5BE8 935B0000
B9C10008 38210050
60000000 00000000

(NTSC-J)
C265D7F8 0000000A
9421FFB0 BDC10008
1D960004 3D8C8168
88030001 8AA30003
2C150000 41820014
2C150001 41820014
2C150002 40800010
980C0193 4800000C
48000008 980C0193
B9C10008 38210050
60000000 00000000
C265D814 00000051
9421FFB0 BDC10008
1D960004 3D8C8168
88100011 8AB00013
2C150000 41820014
2C150001 41820014
2C150002 40800214
980C0193 48000244
3DE08168 61EF0133
3E208168 62310193
8A500010 8A700011
8A900012 7F0902A6
3F4038A0 3F608053
637B5568 2C140010
41820018 2C140011
41820010 2C140012
41820008 4800001C
2C130010 418201CC
2C130011 418201C4
2C130012 418201BC
3AE0000C 7EE903A6
8B310000 2C190006
40820010 8B2F0000
3B390001 9B2F0000
2C190007 40820010
8B2F0004 3B390001
9B2F0004 2C190008
40820010 8B2F0008
3B390001 9B2F0008
2C190009 40820010
8B2F000C 3B390001
9B2F000C 2C19000A
40820010 8B2F0010
3B390001 9B2F0010
2C19000B 40820010
8B2F0014 3B390001
9B2F0014 2C19000C
40820010 8B2F0018
3B390001 9B2F0018
2C19000D 40820010
8B2F001C 3B390001
9B2F001C 2C19000E
40820010 8B2F0020
3B390001 9B2F0020
2C19000F 40820010
8B2F0024 3B390001
9B2F0024 3A310004
4200FF30 2C130006
40820010 8B2F0000
2C190003 408000C4
2C130007 40820010
8B2F0004 2C190001
408000B0 2C130008
40820010 8B2F0008
2C190001 4080009C
2C130009 40820010
8B2F000C 2C190003
40800088 2C13000A
40820010 8B2F0010
2C190002 40800074
2C13000B 40820010
8B2F0014 2C190002
40800060 2C13000C
40820010 8B2F0018
2C190001 4080004C
2C13000D 40820010
8B2F001C 2C190001
40800038 2C13000E
40820010 8B2F0020
2C190001 40800024
2C13000F 40820010
8B2F0024 2C190001
40800010 48000020
980C0193 48000034
635A0064 48000008
635A012C 7F5AB214
935B0000 3AE0000A
7EE903A6 3F200000
9B2F0000 39EF0004
4200FFF4 7F0903A6
B9C10008 38210050
60000000 00000000
C26609A4 00000006
9421FFB0 BDC10008
907C0008 3F4080A1
635A0024 3F608053
637B5568 935B0000
B9C10008 38210050
60000000 00000000

(NTSC-K)
C264C4A4 0000000A
9421FFB0 BDC10008
1D960004 3D8C8168
88030001 8AA30003
2C150000 41820014
2C150001 41820014
2C150002 40800010
980C0193 4800000C
48000008 980C0193
B9C10008 38210050
60000000 00000000
C264C4C0 00000051
9421FFB0 BDC10008
1D960004 3D8C8168
88100011 8AB00013
2C150000 41820014
2C150001 41820014
2C150002 40800214
980C0193 48000244
3DE08168 61EF0133
3E208168 62310193
8A500010 8A700011
8A900012 7F0902A6
3F4038A0 3F608052
637B3C40 2C140010
41820018 2C140011
41820010 2C140012
41820008 4800001C
2C130010 418201CC
2C130011 418201C4
2C130012 418201BC
3AE0000C 7EE903A6
8B310000 2C190006
40820010 8B2F0000
3B390001 9B2F0000
2C190007 40820010
8B2F0004 3B390001
9B2F0004 2C190008
40820010 8B2F0008
3B390001 9B2F0008
2C190009 40820010
8B2F000C 3B390001
9B2F000C 2C19000A
40820010 8B2F0010
3B390001 9B2F0010
2C19000B 40820010
8B2F0014 3B390001
9B2F0014 2C19000C
40820010 8B2F0018
3B390001 9B2F0018
2C19000D 40820010
8B2F001C 3B390001
9B2F001C 2C19000E
40820010 8B2F0020
3B390001 9B2F0020
2C19000F 40820010
8B2F0024 3B390001
9B2F0024 3A310004
4200FF30 2C130006
40820010 8B2F0000
2C190003 408000C4
2C130007 40820010
8B2F0004 2C190001
408000B0 2C130008
40820010 8B2F0008
2C190001 4080009C
2C130009 40820010
8B2F000C 2C190003
40800088 2C13000A
40820010 8B2F0010
2C190002 40800074
2C13000B 40820010
8B2F0014 2C190002
40800060 2C13000C
40820010 8B2F0018
2C190001 4080004C
2C13000D 40820010
8B2F001C 2C190001
40800038 2C13000E
40820010 8B2F0020
2C190001 40800024
2C13000F 40820010
8B2F0024 2C190001
40800010 48000020
980C0193 48000034
635A0064 48000008
635A012C 7F5AB214
935B0000 3AE0000A
7EE903A6 3F200000
9B2F0000 39EF0004
4200FFF4 7F0903A6
B9C10008 38210050
60000000 00000000
C264F650 00000006
9421FFB0 BDC10008
907C0008 3F4080A1
635A0024 3F608052
637B3C40 935B0000
B9C10008 38210050
60000000 00000000



# Source

#####################################################
# 8065D7F8 (NTSC-J) ~ Local Player's ITEM Record
#####################################################
# 0(r3) = Start time of Local Player's item
# 1(r3) = Local Player's Held Item
# 2(r3) = Local Player's Trailed Item
# 3(r3) = Local Player's Activation Mode
#####################################################
# r0  = Local Player's Held Item
# r3  = Address to ITEM Record
# r12 = Address to offset for original Item Spy
# r21 = Local Player's Activation Mode
# r22 = Local Player's Slot
#####################################################
stwu r1, -80(r1) # Make space for 18 registers
stmw r14, 8(r1) # Push r14-r31 onto the stack

mulli r12, r22, 4 # Multiply the value in r22 (Local Player Slot) by 4 and place the lower 32 bits of the result in r12
subis r12, r12, 32408 # Subtract the value in r12 by 32408, then shift r12 16 bits to the left and store the result in r12

# Original instruction
lbz r0, 1(r3) # Load the byte at the address in r3 offset by 1 (Local Player's Held Item) and store it in r0
lbz r21, 3(r3) # Load the byte at the address in r3 offset by 3 (Local Player's Activation Mode) and store it in r21

######################################################
# Purpose:
# Find the current activation mode of the client
######################################################

cmpwi r21, 0x0 # Compare the value in r21 (Local Player's Activation Mode) to 0x0
beq- branch_handshake_stage_0 # Branch if equal
cmpwi r21, 0x1 # Compare the value in r21 (Local Player's Activation Mode) to 0x1
beq- branch_handshake_stage_1 # Branch if equal
cmpwi r21, 0x2 # Compare the value in r21 (Local Player's Activation Mode) to 0x2 and greater
bge- branch_handshake_stage_2_through_7 # Branch if greater or equal

######################################################
# Purpose:
# Store Player's Held Item to Item Spy
#
# Activation Mode:
# 0 - No Item
######################################################

branch_handshake_stage_0:

stb r0, 403(r12) # Store the byte in r0 (Player's Held Item) to the address in r12 offset by 403

b branch_finished

######################################################
# Purpose:
# To stay consistent with other players, we do not
# store the pending item at handshake stage 1.
#
# This code will not include Local Player detection,
# as the code length would be doubled for little reason.
#
# Handshake Value:
# 1 - Item player wants
######################################################

branch_handshake_stage_1:

b branch_finished

####################################################
# Purpose:
# Store Player's Held Item to Item Spy
#
# Handshake Value:
# 2 - Item player will receive
# 3 -
# 4 - Ready to fire triple items
# 5 -
# 6 - Ready to fire single item
# 7 - No Item Available
####################################################

branch_handshake_stage_2_through_7:

stb r0, 403(r12) # Store the byte in r0 (Local Player's Held Item) to the address in r12 offset by 403

branch_finished:

lmw r14, 8(r1) # Pop r14-r31 off the stack
addi r1, r1, 80 # Release the space

~

#####################################################
# 8065D814 (NTSC-J) ~ Players ITEM Record
#####################################################
# 16(r16) = Start time of item
# 17(r16) = Held Item
# 18(r16) = Trailed Item
# 19(r16) = Activation Mode
#####################################################
# r0  = Player's Held Item
# r12 = Address to offset for original Item Spy
# r15 = Address to number of items in play
# r16 = Address to ITEM Record
# r17 = Address to all Player's items
# r18 = Player's Start time of item
# r19 = Player's Held Item
# r20 = Player's Trailed Item
# r21 = Player's Activation Mode
# r22 = Player's Slot
# r23 = Count Register Loop Amount
# r24 = Preserved Count Register Loop Amount
# r25 = nth Player's Item
# r26 = Milliseconds Display Modifier
# r27 = Address to Milliseconds Display Modifier
#####################################################
stwu r1, -80(r1) # Make space for 18 registers
stmw r14, 8(r1) # Push r14-r31 onto the stack

mulli r12, r22, 4 # Multiply the value in r22 (Player Slot) by 4 and place the lower 32 bits of the result in r12
subis r12, r12, 32408 # Subtract the value in r12 by 32408, then shift r12 16 bits to the left and store the result in r12

# Original instruction
lbz r0, 17(r16)  # Load the byte at the address in r16 offset by 17 (Player's Held Item) and store it in r0
lbz r21, 19(r16) # Load the byte at the address in r16 offset by 19 (Player's Activation Mode) and store it in r21

######################################################
# Purpose:
# Find the current activation mode of the client.
######################################################

cmpwi r21, 0x0 # Compare the value in r21 (Player's Activation Mode) to 0x0
beq- branch_handshake_stage_0 # Branch if equal
cmpwi r21, 0x1 # Compare the value in r21 (Player's Activation Mode) to 0x1
beq- branch_handshake_stage_1 # Branch if equal
cmpwi r21, 0x2 # Compare the value in r21 (Player's Activation Mode) to 0x2
bge- branch_handshake_stage_2_through_7 # Branch if greater than or equal

######################################################
# Purpose:
# Store Player's Held Item to Item Spy.
#
# Activation Mode:
# 0 - No Item
######################################################

branch_handshake_stage_0:

stb r0, 403(r12) # Store the byte in r0 (Player's Held Item) to the address in r12 offset by 403

b branch_finished

######################################################
# Purpose:
# Detect players trying to obtain impossible Shared Items using
# a variety of methods.
#
# Handshake Value:
# 1 - Item player wants
######################################################

branch_handshake_stage_1:

lis r15, 0x8168 # Set the higher 16 bits of r15 (Address to number of items in play) to 0x8168
ori r15, r15, 0x0133 # Set the lower 16 bits of r15 (Address to number of items in play) to 0x0133

lis r17, 0x8168 # Set the higher 16 bits of r17 (Address to all Player's Items) to 0x8168
ori r17, r17, 0x0193 # Set the lower 16 bits of r17 (Address to all Player's Items) to 0x0193

lbz r18, 16(r16) # Load the byte at the address in r16 offset by 16 (Player's Start time of item) and store it in r18
lbz r19, 17(r16) # Load the byte at the address in r16 offset by 17 (Player's Held Item) and store it in r19
lbz r20, 18(r16) # Load the byte at the address in r16 offset by 18 (Player's Trailed Item) and store it in r20

mfctr r24 # Preserve the value in the Count Register in r24

lis r26, 0x38A0 # Set the higher 16 bits of r26 (Milliseconds Display Modifier) to 0x38A0

lis r27, 0x8053 # Set the higher 16 bits of r27 (Address to Milliseconds Display Modifier) to 0x8053
ori r27, r27, 0x5568 # Set the lower 16 bits of r27 (Address to Milliseconds Display Modifier) to 0x5568

######################################################
# Purpose:
# Check the if the current player has impossible
# items trailing them, according to their current
# item.
#
# It is impossible for a player to obtain another set of triple items
# if they are currently trailing a set.
######################################################

cmpwi r20, 0x10 # Compare the value in r20 (Player's Trailed Item) to 0x10 (Triple Green Shells)
beq- branch_impossible_trailed_items_check # Branch if equal
cmpwi r20, 0x11 # Compare the value in r20 (Player's Trailed Item) to 0x11 (Triple Red Shells)
beq- branch_impossible_trailed_items_check # Branch if equal
cmpwi r20, 0x12 # Compare the value in r20 (Player's Trailed Item) to 0x12 (Triple Bananas)
beq- branch_impossible_trailed_items_check # Branch if equal

b branch_skip_impossible_trailed_items_check

branch_impossible_trailed_items_check:
cmpwi r19, 0x10 # Compare the value in r19 (Player's Held Item) to 0x10 (Triple Green Shells)
beq- branch_impossible_triple_item_combination_detected # Branch if equal
cmpwi r19, 0x11 # Compare the value in r19 (Player's Held Item) to 0x11 (Triple Red Shells)
beq- branch_impossible_triple_item_combination_detected # Branch if equal
cmpwi r19, 0x12 # Compare the value in r19 (Player's Held Item) to 0x12 (Triple Bananas)
beq- branch_impossible_triple_item_combination_detected # Branch if equal

branch_skip_impossible_trailed_items_check:

#####################################################
# Purpose:
# Store the amount of each item currently in play,
# not including the player's pending item.
#####################################################

li r23, 0xC # Load 0xC into r23 (Count Register Loop Amount)
mtctr r23 # Move r23 (Count Register Loop Amount) into the Count Register

branch_item_amount_loop:

lbz r25, 0(r17) # Load the byte at the address in r17 (nth Player's Item) and store it in r25

cmpwi r25, 0x6 # Compare the value in r25 (nth Player's Item) to 0x6 (Bob-omb)
bne- branch_item_not_bob_omb # Branch if not equal
lbz r25, 0x0(r15) # Load the byte at the address in r15 (Number of Bob-ombs in play) and store it in r25
addi r25, r25, 0x1 # Add 0x1 to r25 (Number of Bob-ombs in play) and store the result in r25
stb r25, 0x0(r15) # Store the byte in r25 (Number of Bob-ombs in play) to the address in r15
branch_item_not_bob_omb:

cmpwi r25, 0x7
bne- branch_item_not_blue_shell
lbz r25, 0x4(r15)
addi r25, r25, 0x1
stb r25, 0x4(r15)
branch_item_not_blue_shell:

cmpwi r25, 0x8
bne- branch_item_not_lightning
lbz r25, 0x8(r15)
addi r25, r25, 0x1
stb r25, 0x8(r15)
branch_item_not_lightning:

cmpwi r25, 0x9
bne- branch_item_not_star
lbz r25, 0xC(r15)
addi r25, r25, 0x1
stb r25, 0xC(r15)
branch_item_not_star:

cmpwi r25, 0xA
bne- branch_item_not_golden_mushroom
lbz r25, 0x10(r15)
addi r25, r25, 0x1
stb r25, 0x10(r15)
branch_item_not_golden_mushroom:

cmpwi r25, 0xB
bne- branch_item_not_mega_mushroom
lbz r25, 0x14(r15)
addi r25, r25, 0x1
stb r25, 0x14(r15)
branch_item_not_mega_mushroom:

cmpwi r25, 0xC
bne- branch_item_not_blooper
lbz r25, 0x18(r15)
addi r25, r25, 0x1
stb r25, 0x18(r15)
branch_item_not_blooper:

cmpwi r25, 0xD
bne- branch_item_not_pow_block
lbz r25, 0x1C(r15)
addi r25, r25, 0x1
stb r25, 0x1C(r15)
branch_item_not_pow_block:

cmpwi r25, 0xE
bne- branch_item_not_thunder_cloud
lbz r25, 0x20(r15)
addi r25, r25, 0x1
stb r25, 0x20(r15)
branch_item_not_thunder_cloud:

cmpwi r25, 0xF
bne- branch_item_not_bullet_bill
lbz r25, 0x24(r15)
addi r25, r25, 0x1
stb r25, 0x24(r15)
branch_item_not_bullet_bill:

addi r17, r17, 0x4 # Add 0x4 to r17 (Address to all Player's items) and store the result in r17

bdnz+ branch_item_amount_loop # Branch and decrement the Count Register while not zero

#######################################################
# Purpose:
# Now that we have the amount of each item in play,
# we can compare them to their hardcoded limit.
# If the value is equal (or greater) to the max,
# the current player must be trying to cheat one.
# This is because they are trying obtain one when the game
# would limit it due to the hardcoded limits.
#
# This is possible because for a brief period during
# phase 1 of the handshake, the player's held item
# will change to the one they would like to receive.
#######################################################

cmpwi r19, 0x6 # Compare the value in r19 (Player's Held Item) to 0x6 (Bob-omb)
bne- branch_not_checking_bob_omb_limit # Branch if not equal
lbz r25, 0x0(r15) # Load the byte at the address in r15 (Number of Bob-ombs in play) and store it in r25
cmpwi r25, 0x3 # Compare the value in r25 (Number of Bob-ombs in play) to 0x3 (Max Number of Bob-ombs)
bge- branch_impossible_shared_item_detected # Branch if greater than or equal
branch_not_checking_bob_omb_limit:

cmpwi r19, 0x7
bne- branch_not_checking_blue_shell_limit
lbz r25, 0x4(r15)
cmpwi r25, 0x1
bge- branch_impossible_shared_item_detected
branch_not_checking_blue_shell_limit:

cmpwi r19, 0x8
bne- branch_not_checking_lightning_limit
lbz r25, 0x8(r15)
cmpwi r25, 0x1
bge- branch_impossible_shared_item_detected
branch_not_checking_lightning_limit:

cmpwi r19, 0x9
bne- branch_not_checking_star_limit
lbz r25, 0xC(r15)
cmpwi r25, 0x3
bge- branch_impossible_shared_item_detected
branch_not_checking_star_limit:

cmpwi r19, 0xA
bne- branch_not_checking_golden_mushroom_limit
lbz r25, 0x10(r15)
cmpwi r25, 0x2
bge- branch_impossible_shared_item_detected
branch_not_checking_golden_mushroom_limit:

cmpwi r19, 0xB
bne- branch_not_checking_mega_mushroom_limit
lbz r25, 0x14(r15)
cmpwi r25, 0x2
bge- branch_impossible_shared_item_detected
branch_not_checking_mega_mushroom_limit:

cmpwi r19, 0xC
bne- branch_not_checking_blooper_limit
lbz r25, 0x18(r15)
cmpwi r25, 0x1
bge- branch_impossible_shared_item_detected
branch_not_checking_blooper_limit:

cmpwi r19, 0xD
bne- branch_not_checking_pow_block_limit
lbz r25, 0x1C(r15)
cmpwi r25, 0x1
bge- branch_impossible_shared_item_detected
branch_not_checking_pow_block_limit:

cmpwi r19, 0xE
bne- branch_not_checking_thunder_cloud_limit
lbz r25, 0x20(r15)
cmpwi r25, 0x1
bge- branch_impossible_shared_item_detected
branch_not_checking_thunder_cloud_limit:

cmpwi r19, 0xF
bne- branch_not_checking_bullet_bill_limit
lbz r25, 0x24(r15)
cmpwi r25, 0x1
bge- branch_impossible_shared_item_detected
branch_not_checking_bullet_bill_limit:

b branch_impossible_shared_item_not_detected

####################################################
# Purpose:
# Store Player's Held Item to Item Spy
#
# Handshake Value:
# 2 - Item player will receive
# 3 -
# 4 - Ready to fire triple items
# 5 -
# 6 - Ready to fire single item
# 7 - No Item Available
####################################################

branch_handshake_stage_2_through_7:

stb r0, 403(r12) # Store the byte in r0 (Player's Held Item) to the address in r12 offset by 403

b branch_finished

#####################################################
# Purpose:
# The first digit on the timer will denote the detection reason.
# They are as follows:
#
# 1XX - Impossible Shared Item Detected
# 3XX - Impossible Triple Item Combination Detected
#####################################################

branch_impossible_shared_item_detected:

ori r26, r26, 0x0064 # Set the lower 16 bits of r26 (Milliseconds Display Modifier) to 0x0064 [100]

b branch_modify_timer

branch_impossible_triple_item_combination_detected:

ori r26, r26, 0x012C # Set the lower 16 bits of r26 (Milliseconds Display Modifier) to 0x012C [300]

branch_modify_timer:

add r26, r26, r22 # Add the value in r22 (Player's Slot) to the value in r26
stw r26, 0(r27) # Store the word in r26 (Milliseconds Display Modifier) to the address in r27

####################################################
# Purpose:
# Erase the amount of each item currently in play.
####################################################

branch_impossible_shared_item_not_detected:

li r23, 0xA # Load 0xA into r23 (Count Register Loop Amount)
mtctr r23 # Move r23 (Count Register Loop Amount) into the Count Register

branch_clear_item_amount_loop:

lis r25, 0x0000 # Set the higher 16 bits of r25 (nth Player's Item) to 0x0000 and clear the lower 16 bits
stb r25, 0x0(r15) # Store the byte in r25 (0x00) to the address in r15 (Number of n in play)

addi r15, r15, 0x4 # Add 0x4 to r15 and store the result in r15 (Number of n in play)

bdnz+ branch_clear_item_amount_loop # Branch and decrement the Count Register while not zero

mtctr r24 # Move the value in r24 (Preserved Count Register Loop Amount) into the Count Register

branch_finished:

lmw r14, 8(r1) # Pop r14-r31 off the stack
addi r1, r1, 80 # Release the space

~

#####################################################
# 806609A4 (NTSC-J) ~ Local SELECT Record
#####################################################
# 8(r28) = NULL or time of sender
#####################################################
# r3  = NULL or time of sender
# r26 = Milliseconds Display Modifier Deactivator
# r27 = Address to Milliseconds Display Modifier
# r28 = Address to SELECT Record
#####################################################
stwu r1, -80(r1) # Make space for 18 registers
stmw r14, 8(r1) # Push r14-r31 onto the stack

# Original instruction
stw r3, 8(r28) # Store in r3 (NULL or time of sender) at the address in r28 offset by 8

######################################################
# Purpose:
# Reset the timer back to the default milliseconds
# after each race. If the timer was not changed,
# no harm done.
#
# This instruction is only executed before a race starts, so the
# timer will always be reset for a new race.                                          
######################################################
lis r26, 0x80A1 # Set the higher 16 bits of r26 (Milliseconds Display Modifier Deactivator) to 0x38A0
ori r26, r26, 0x0024 # Set the lower 16 bits of r26 (Milliseconds Display Modifier Deactivator) to 0x0024

lis r27, 0x8053 # Set the higher 16 bits of r27 (Address to Milliseconds Display Modifier) to 0x8053
ori r27, r27, 0x5568 # Set the lower 16 bits of r27 (Address to Milliseconds Display Modifier) to 0x5568

stw r26, 0x0(r27) # Store the word in r26 (Milliseconds Display Modifier Deactivator) at the address in r27

lmw r14, 8(r1) # Pop r14-r31 off the stack
addi r1, r1, 80 # Release the space



Notes:
- If a detection occurs, the milliseconds will return to normal when the next race begins.
- This code relies on a specific value in the ITEM Packet, and it is very quick to change. Due to the nature of how often updates are sent to other clients when there are many players in the room, it is recommended to have all P2P connections set up (NATNEG complete).



Code Creator: Star
Code Credits: mdmwii (Item Warning), Bully@WiiPlaza (USB Gecko Item Spy, Millisecond Display Modifier)
Reply
#2
Update #1
Reply
#3
Update #2
Reply
#4
Update #3
Reply
#5
Hell yeah! Inb4 random noobs use it in laggy WW's and come back here saying the code doesn't work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)