Time trials online mode
#41
Hey guys,

I was wondering if there is a way to merge multiple activator (28) codes with different controllers so that they work simultaneously. I wrote a code to toggle player/cpus names/icons and it'd be way more efficient to merge the 5 codes (1 code per controller) into one. Putting the 28 codes one after another to create a giant code obviously does not work.

I already tried to write a C0 codetype code that checked for the controller and then the corresponding input and that triggered the toggle code, it works but I don't get the same "smoothness" as I do with the 28 codes, the names flash and sometimes if you press the names disappear and then reappear instantly, most likely because C0 codes are triggered every frame. 
I also tried to hook to a random address that is triggered a lot during races and I get the same problem. 
 
Thanks, Melg
Reply
#42
What was the ASM you were using in the C0? Using a C0 to read from InputData is probably the best way to make controller universal activators, here's an example using the start button (PAL)

C0000000 00000008
3C60809C 8063D70C
2C030000 41820028
A0A30032 A063004A
7CA31878 70631000
41820014 3CA08000
80650198 68630001
90650198 4E800020
60000000 00000000
20000198 00000001
(activator here)
CC000000 00000000
(deact here)
E0000000 80008000

Source asm:
.set INPUTDATA, 0x809bd70c

lis r3, INPUTDATA@ha
lwz r3, INPUTDATA@l (r3)

# check if it's been initialised, skip if it hasn't
cmpwi r3, 0
beq- end

# Load the buttonRaw fields for controller 1
# +4 ->realControllerHolders[0]
# +0x28 ->inputStates[0]
# +6 ->buttonRaw
# total offset 0x32
# +0x18 ->inputStates[1].buttonRaw
# total offset 0x4A
lhz r5, 0x32 (r3)
lhz r3, 0x4A (r3)

# Get buttons that weren't pressed the previous frame but are now
andc r3, r5, r3

# Check if start is one of them
andi. r3, r3, 0x1000
beq end

# If start was pressed, flip the value in the exception vector area
lis r5, 0x8000
lwz r3, 0x198 (r5)
xori r3, r3, 1
stw r3, 0x198 (r5)

end:
blr
Reply
#43
I was using your structure since it was practical. My problem was how I checked the button which was pressed, I was simply checking if at least the button was pressed every frame which is what gave the flashing. The andc instruction is a very clever way of solving the problem, thanks Seeky
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)