05-24-2020, 11:56 AM
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
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