diff options
author | Stephen Simpson <megazig@gmail.com> | 2011-09-28 11:33:05 -0500 |
---|---|---|
committer | Stephen Simpson <megazig@gmail.com> | 2011-09-28 11:33:05 -0500 |
commit | fe4f07bb5c43566a799058f8a52e30e35be55003 (patch) | |
tree | d3b8df20d8810b148a0761412d9cfa6d8ff46a2b /src/classic_controller.S | |
parent | 7bb50c1714a74ba7e8468ead8f92b1f1ccceef6d (diff) | |
download | kamek-fe4f07bb5c43566a799058f8a52e30e35be55003.tar.gz kamek-fe4f07bb5c43566a799058f8a52e30e35be55003.zip |
fixed ntsc addresses to pal in the classic_controller.yaml
added basic support for left analog stick in classic_controller.S
Diffstat (limited to '')
-rw-r--r-- | src/classic_controller.S | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/src/classic_controller.S b/src/classic_controller.S index 2ae5ed7..86be34f 100644 --- a/src/classic_controller.S +++ b/src/classic_controller.S @@ -1,14 +1,18 @@ #ifndef __MWERKS__ -.set r0,0; .set r1,1; .set r2,2; .set r3,3; .set r4,4 +.set r0,0; .set r1,1; .set r2,2; .set r3,3; .set r4,4 .set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 .set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 .set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 .set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 .set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 -.set r30,30; .set r31,31; .set f0,0; .set f2,2; .set f3,3 -.set f1,1; .set f30,30; .set f31,31 +.set r30,30; .set r31,31; .set f0,0; .set f2,2; .set f3,3 +.set f1,1; .set f8,8; .set f9,9; .set f10,10; .set f11,11; +.set f30,30; .set f31,31 #endif +.text +.align 4 + .global _switch_buttons _switch_buttons: addi r1,r1,0x50 # replaced instruction @@ -79,6 +83,35 @@ skip_plus: beq- skip_minus ori r6,r6,0x1000 // WPAD_BUTTON_MINUS skip_minus: + lfs f8,0x6c(r26) // left analog x + lfs f9,0x70(r26) // left analog y + 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: mr r5,r6 blr +.data + +float_one: +.float 1.0 +float_neg_one: +.float -1.0 +float_zero: +.float 0.0 |