summaryrefslogtreecommitdiff
path: root/src/classic_controller.S
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/classic_controller.S41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/classic_controller.S b/src/classic_controller.S
index ec35e60..fd6aa4c 100644
--- a/src/classic_controller.S
+++ b/src/classic_controller.S
@@ -197,10 +197,29 @@ skip_plus:
beq- skip_minus
ori r6,r6,0x1000 // WPAD_BUTTON_MINUS
skip_minus:
- andi. r4,r5,0xF // Any_DPAD
+ andi. r4,r5,0xC003 // Any_DPAD
beq- DPADOnly // DPAD and Analog are processed separately to avoid conflicting button presses
+ andi. r4,r5,1 // WPAD_CLASSIC_BUTTON_UP
+ beq- skip_up
+ ori r6,r6,2 // WPAD_BUTTON_RIGHT
+skip_up:
+ andi. r4,r5,2 // WPAD_CLASSIC_BUTTON_LEFT
+ beq- skip_left
+ ori r6,r6,8 // WPAD_BUTTON_UP
+skip_left:
+ andi. r4,r5,0x8000 // WPAD_CLASSIC_BUTTON_RIGHT
+ beq- skip_right
+ ori r6,r6,4 // WPAD_BUTTON_DOWN
+skip_right:
+ andi. r4,r5,0x4000 // WPAD_CLASSIC_BUTTON_DOWN
+ beq- skip_down
+ ori r6,r6,1 // WPAD_BUTTON_LEFT
+skip_down:
+ mr r5,r6
+ blr
+DPADOnly:
lfs f8,0x6c(r26) // left analog x ; KPADInsideStatus->KPADEXStatus_cl->lstick
lfs f9,0x70(r26) // left analog y ; KPADInsideStatus->KPADEXStatus_cl->rstick
@@ -230,26 +249,6 @@ skip_left_analog:
blr
-DPADOnly:
- andi. r4,r5,1 // WPAD_CLASSIC_BUTTON_UP
- beq- skip_up
- ori r6,r6,2 // WPAD_BUTTON_RIGHT
-skip_up:
- andi. r4,r5,2 // WPAD_CLASSIC_BUTTON_LEFT
- beq- skip_left
- ori r6,r6,8 // WPAD_BUTTON_UP
-skip_left:
- andi. r4,r5,0x8000 // WPAD_CLASSIC_BUTTON_RIGHT
- beq- skip_right
- ori r6,r6,4 // WPAD_BUTTON_DOWN
-skip_right:
- andi. r4,r5,0x4000 // WPAD_CLASSIC_BUTTON_DOWN
- beq- skip_down
- ori r6,r6,1 // WPAD_BUTTON_LEFT
-skip_down:
- mr r5,r6
- blr
-