summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStephen Simpson <megazig@gmail.com>2011-09-28 18:23:55 -0500
committerStephen Simpson <megazig@gmail.com>2011-09-28 18:23:55 -0500
commit63d9a470f3e508097741522f899a3da0b5c67e12 (patch)
treeb9c9ba18f2fc8b1c25e6cf96681fa82c5cf95705 /src
parentfe4f07bb5c43566a799058f8a52e30e35be55003 (diff)
downloadkamek-63d9a470f3e508097741522f899a3da0b5c67e12.tar.gz
kamek-63d9a470f3e508097741522f899a3da0b5c67e12.zip
fixed region offsets in classic_controller.yaml
fixed branch type from bl to b in classic_controller.yaml still missing analog sticks and tilt
Diffstat (limited to 'src')
-rw-r--r--src/classic_controller.S62
1 files changed, 46 insertions, 16 deletions
diff --git a/src/classic_controller.S b/src/classic_controller.S
index 86be34f..2ba7a9e 100644
--- a/src/classic_controller.S
+++ b/src/classic_controller.S
@@ -10,6 +10,16 @@
.set f30,30; .set f31,31
#endif
+.set stackSize,0x30;
+.set r4Place,0x10;
+.set r5Place,0x14;
+.set r6Place,0x18;
+.set r26Place,0x1c;
+.set f8Place,0x20;
+.set f9Place,0x24;
+.set f10Place,0x28;
+.set f11Place,0x2c;
+
.text
.align 4
@@ -17,7 +27,17 @@
_switch_buttons:
addi r1,r1,0x50 # replaced instruction
+ stwu r1,-stackSize(r1) # provide new stack for saving regs
mflr r0
+ stw r4,r4Place(r1)
+ stw r5,r5Place(r1)
+ stw r6,r6Place(r1)
+ stw r26,r26Place(r1)
+ stfs f8,f8Place(r1)
+ stfs f9,f9Place(r1)
+ stfs f10,f10Place(r1)
+ stfs f11,f11Place(r1)
+
lwz r5,0x60(r26) # wiimote cc data
bl map_buttons
lwz r4,0(r26)
@@ -33,7 +53,17 @@ _switch_buttons:
lwz r4,8(r26)
or r5,r5,r4
stw r5,8(r26)
+
+ lwz r4,r4Place(r1)
+ lwz r5,r5Place(r1)
+ lwz r6,r6Place(r1)
+ lwz r26,r26Place(r1)
+ lfs f8,f8Place(r1)
+ lfs f9,f9Place(r1)
+ lfs f10,f10Place(r1)
+ lfs f11,f11Place(r1)
mtlr r0
+ addi r1,r1,stackSize
blr
map_buttons:
@@ -88,22 +118,22 @@ skip_minus:
lis r5,float_one@h
lfs f10,float_one@l(r5)
lfs f11,float_neg_one@l(r5)
- fcmpu cr1,f8,f10
- bne cr1,skip_right_analog
- ori r6,r6,4 // WPAD_BUTTON_DOWN
-skip_right_analog:
- fcmpu cr1,f9,f10
- bne cr1,skip_right_analog
- ori r6,r6,2 // WPAD_BUTTON_RIGHT
-skip_up_analog:
- fcmpu cr1,f9,f11
- bne cr1,skip_right_analog
- ori r6,r6,1 // WPAD_BUTTON_LEFT
-skip_down_analog:
- fcmpu cr1,f8,f11
- bne cr1,skip_right_analog
- ori r6,r6,8 // WPAD_BUTTON_UP
-skip_left_analog:
+# fcmpu cr0,f8,f10
+# bne skip_right_analog
+# ori r6,r6,4 // WPAD_BUTTON_DOWN
+#skip_right_analog:
+# fcmpu cr0,f9,f10
+# bne skip_right_analog
+# ori r6,r6,2 // WPAD_BUTTON_RIGHT
+#skip_up_analog:
+# fcmpu cr0,f9,f11
+# bne skip_right_analog
+# ori r6,r6,1 // WPAD_BUTTON_LEFT
+#skip_down_analog:
+# fcmpu cr0,f8,f11
+# bne skip_right_analog
+# ori r6,r6,8 // WPAD_BUTTON_UP
+#skip_left_analog:
mr r5,r6
blr