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, 25 insertions, 16 deletions
diff --git a/src/classic_controller.S b/src/classic_controller.S
index a1af772..ec35e60 100644
--- a/src/classic_controller.S
+++ b/src/classic_controller.S
@@ -189,22 +189,6 @@ skip_ZL:
lis r6,0x7fc0 // float
stw r6,0x10(r26) // set waggle ; KPADInsideStatus->acc->y
skip_ZR:
- 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:
andi. r4,r5,0x400 // WPAD_CLASSIC_BUTTON_PLUS
beq- skip_plus
ori r6,r6,0x10 // WPAD_BUTTON_PLUS
@@ -213,6 +197,10 @@ skip_plus:
beq- skip_minus
ori r6,r6,0x1000 // WPAD_BUTTON_MINUS
skip_minus:
+ andi. r4,r5,0xF // Any_DPAD
+ beq- DPADOnly // DPAD and Analog are processed separately to avoid conflicting button presses
+
+
lfs f8,0x6c(r26) // left analog x ; KPADInsideStatus->KPADEXStatus_cl->lstick
lfs f9,0x70(r26) // left analog y ; KPADInsideStatus->KPADEXStatus_cl->rstick
@@ -242,6 +230,27 @@ 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
+
+