Stop All Opponents Offline Only [Hamster35000vr]
#1
Stop All Opponents Offline Only [Hamster35000vr]

NOTE: Outdated by JoshuaMK's Disable CPU Driving Code.

Does NOT work in Grand Prix.

This code will prevent the CPUs from driving past the start line.

NTSC-U
C2575BD4 00000004
808100A0 38840433
7C032040 41800008
FC000028 D00300B8
60000000 00000000

PAL
C257C438 00000004
808100A0 38840433
7C032040 41800008
FC000028 D00300B8
60000000 00000000

NTSC-J
C257BDB8 00000004
808100A0 38840433
7C032040 41800008
FC000028 D00300B8
60000000 00000000

NTSC-K
C256A490 00000004
808100A0 38840433
7C032040 41800008
FC000028 D00300B8
60000000 00000000



Source:

#r4 safe for use

lwz r4, 0xA0 (sp) #The Mem81 Pointer we need is always 0xA0 in reference to the stack pointer. No need to try to manually port this pointer per region

addi r4, r4, 0x433

cmplw r3, r4
blt- default_instruction

fsub f0, f0, f0 #Clear out f0, this causes CPUs to not move past the start line. This is essentially telling the game that the CPUs keep hitting offroad over and over again

default_instruction:
stfs f0, 0x00B8 (r3)



Code creator: Hamster35000vr
Code credits: Vega (overhauled source, fixed offroad bug)
Reply
#2
Bump, I had lots of requests to get this code ported. So I went ahead and analyzed this code, and overhauled the entire source. I got rid of the need of a region dependent pointer to reference Mem81. Fixed the offroad bug as well. Total compiled code length was cut down from 9 to 5 lines.

Here's the old source plus a list of issues with it if anyone is curious... (new source included in original post ofc)

old Source:
lis r14,-32711
addi r14,r14,19736
lwz r14,0(r14)
addi r14,r14,1232
subi r14,r14,184
addi r14,r14,27
cmpw r3,r14
bge- 0x10
lis r14,16256
stw r14,184(r3)
b 0x0C
li r14,0
stw r14,184(r3)
li r14,0

Issues with old Source:
-Using r14 w/o backup
-Using a region dependent pointer for mem81
-Two instances of stw r14, 184 (r3), non optimized branching
-Adding 1232, then subtracting 184, then readding 27 (lol), why not just add 1075 in the first adding instruction?
-Default instruction wasn't included, so a value of 1 for a float was implemented for the End User thus causing a bug where you could drive offroad with no speed loss
-The bge- is was incorrect, it should have been bge+, hence why my new source uses blt-
-The comparison for the branch was done as signed. Granted it didn't matter in this case since both values being compared are always 811XXXXX. But it's obvious the comparison was meant as both numbers being positive, so the comparison should have been done logically
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)