From d99badb18790cc7d5ccdde067f29a3f8d7f4734c Mon Sep 17 00:00:00 2001 From: rsn8887 Date: Wed, 19 Jul 2017 21:23:10 -0500 Subject: [PATCH] Vita: -fix autofire for ply #2 w/o custom controls --- Readme.txt | 4 ++++ src/od-joy.cpp | 33 +++++++++++++++++++++++++++++---- src/psp2/psp2_shader.cpp | 2 +- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/Readme.txt b/Readme.txt index bd03b31..d8e20c1 100755 --- a/Readme.txt +++ b/Readme.txt @@ -111,6 +111,10 @@ Square = Backspace Triangle = Toggle Shift CHANGELOG: +1.51 + +-fix autofire for ply #2 w/o custom controls + 1.50 - fix analog deadzone (broken in last release) diff --git a/src/od-joy.cpp b/src/od-joy.cpp index 03198f4..6d51a27 100755 --- a/src/od-joy.cpp +++ b/src/od-joy.cpp @@ -57,6 +57,7 @@ extern int lAnalogX; extern int lAnalogY; extern int mainMenu_leftStickMouse; extern int mainMenu_deadZone; +int delay2=0; // for 2nd player non-custom autofire #endif extern char launchDir[300]; @@ -548,10 +549,34 @@ void read_joystick(int nr, unsigned int *dir, int *button) top = 1; else if (dpadDown[1]) bot = 1; - if ((mainMenu_button1==GP2X_BUTTON_B && buttonA[1]) || (mainMenu_button1==GP2X_BUTTON_X && buttonX[1]) || (mainMenu_button1==GP2X_BUTTON_Y && buttonY[1])) - *button |= 0x01; - if (buttonB[1]) - *button |= (0x01 << 1); + if ( + (mainMenu_autofire & switch_autofire & delay2>mainMenu_autofireRate) + || + ( + ( + (mainMenu_autofireButton1==GP2X_BUTTON_B && buttonA[1]) + || + (mainMenu_autofireButton1==GP2X_BUTTON_X && buttonX[1]) + || + (mainMenu_autofireButton1==GP2X_BUTTON_Y && buttonY[1]) + ) + & delay2>mainMenu_autofireRate + ) + ) + { + if(!buttonB[1]) + *button=1; + delay2=0; + *button |= (buttonB[1] & 1) << 1; + } + else + { + if ((mainMenu_button1==GP2X_BUTTON_B && buttonA[1]) || (mainMenu_button1==GP2X_BUTTON_X && buttonX[1]) || (mainMenu_button1==GP2X_BUTTON_Y && buttonY[1])) + *button |= 0x01; + if (buttonB[1]) + *button |= (0x01 << 1); + delay2++; + } } #endif //__PSP2__ // normal joystick movement diff --git a/src/psp2/psp2_shader.cpp b/src/psp2/psp2_shader.cpp index 4e503ed..7830894 100644 --- a/src/psp2/psp2_shader.cpp +++ b/src/psp2/psp2_shader.cpp @@ -2,7 +2,7 @@ // Created by cpasjuste on 18/12/16. // -// use https://github.com/frangarcj/vita2dlib/commits/fbo +// use https://github.com/frangarcj/vita2dlib/tree/fbo // and https://github.com/frangarcj/vita-shader-collection/releases #include