mirror of https://github.com/PCSX2/pcsx2.git
ZeroPad: Commit bolche's Analog control code, ifdeffed out, so I don't forget to add a gui for it and enable it some day.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1126 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
94c006efd2
commit
5f35cf1376
|
@ -278,6 +278,59 @@ void CALLBACK PADupdate(int pad)
|
|||
case KeyPress:
|
||||
key = XLookupKeysym((XKeyEvent *)&E, 0);
|
||||
|
||||
#ifdef ANALOG_CONTROLS_HACK
|
||||
switch(key) {
|
||||
case KEY_PAD_LX_LEFT:
|
||||
g_lanalog[pad].x = DEF_VALUE/256;
|
||||
if( conf.options&PADOPTION_REVERTLX )
|
||||
g_lanalog[pad].x = -g_lanalog[pad].x;
|
||||
g_lanalog[pad].x += 0x80;
|
||||
break;
|
||||
case KEY_PAD_LX_RIGHT:
|
||||
g_lanalog[pad].x = -DEF_VALUE/256;
|
||||
if( conf.options&PADOPTION_REVERTLX )
|
||||
g_lanalog[pad].x = -g_lanalog[pad].x;
|
||||
g_lanalog[pad].x += 0x80;
|
||||
break;
|
||||
case KEY_PAD_LY_UP:
|
||||
g_lanalog[pad].y = DEF_VALUE/256;
|
||||
if( conf.options&PADOPTION_REVERTLY )
|
||||
g_lanalog[pad].y = -g_lanalog[pad].y;
|
||||
g_lanalog[pad].y += 0x80;
|
||||
break;
|
||||
case KEY_PAD_LY_DOWN:
|
||||
g_lanalog[pad].y = -DEF_VALUE/256;
|
||||
if( conf.options&PADOPTION_REVERTLY )
|
||||
g_lanalog[pad].y = -g_lanalog[pad].y;
|
||||
g_lanalog[pad].y += 0x80;
|
||||
break;
|
||||
case KEY_PAD_RX_LEFT:
|
||||
g_ranalog[pad].x = DEF_VALUE/256;
|
||||
if( conf.options&PADOPTION_REVERTRX )
|
||||
g_ranalog[pad].x = -g_ranalog[pad].x;
|
||||
g_ranalog[pad].x += 0x80;
|
||||
break;
|
||||
case KEY_PAD_RX_RIGHT:
|
||||
g_ranalog[pad].x = -DEF_VALUE/256;
|
||||
if( conf.options&PADOPTION_REVERTRX )
|
||||
g_ranalog[pad].x = -g_ranalog[pad].x;
|
||||
g_ranalog[pad].x += 0x80;
|
||||
break;
|
||||
case KEY_PAD_RY_UP:
|
||||
g_ranalog[pad].y = DEF_VALUE/256;
|
||||
if( conf.options&PADOPTION_REVERTRY )
|
||||
g_ranalog[pad].y = -g_ranalog[pad].y;
|
||||
g_ranalog[pad].y += 0x80;
|
||||
break;
|
||||
case KEY_PAD_RY_DOWN:
|
||||
g_ranalog[pad].y = -DEF_VALUE/256;
|
||||
if( conf.options&PADOPTION_REVERTRY )
|
||||
g_ranalog[pad].y = -g_ranalog[pad].y;
|
||||
g_ranalog[pad].y += 0x80;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
i = FindKey(key, pad);
|
||||
keyPress |= (1 << i);
|
||||
keyRelease &= ~(1 << i);
|
||||
|
@ -287,6 +340,36 @@ void CALLBACK PADupdate(int pad)
|
|||
break;
|
||||
case KeyRelease:
|
||||
key = XLookupKeysym((XKeyEvent *)&E, 0);
|
||||
|
||||
#ifdef ANALOG_CONTROLS_HACK
|
||||
switch(key) {
|
||||
case KEY_PAD_LX_LEFT:
|
||||
g_lanalog[pad].x = 0x80;
|
||||
break;
|
||||
case KEY_PAD_LY_UP:
|
||||
g_lanalog[pad].y = 0x80;
|
||||
break;
|
||||
case KEY_PAD_RX_LEFT:
|
||||
g_ranalog[pad].x = 0x80;
|
||||
break;
|
||||
case KEY_PAD_RY_UP:
|
||||
g_ranalog[pad].y = 0x80;
|
||||
break;
|
||||
case KEY_PAD_LX_RIGHT:
|
||||
g_lanalog[pad].x = 0x80;
|
||||
break;
|
||||
case KEY_PAD_LY_DOWN:
|
||||
g_lanalog[pad].y = 0x80;
|
||||
break;
|
||||
case KEY_PAD_RX_RIGHT:
|
||||
g_ranalog[pad].x = 0x80;
|
||||
break;
|
||||
case KEY_PAD_RY_DOWN:
|
||||
g_ranalog[pad].y = 0x80;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
i = FindKey(key, pad);
|
||||
keyPress &= ~(1<<i);
|
||||
keyRelease |= (1<<i);
|
||||
|
|
|
@ -111,6 +111,25 @@ extern FILE *padLog;
|
|||
#define PAD_R2 1
|
||||
#define PAD_L2 0
|
||||
|
||||
// Put in the code for bolche's analog contols hack, ifdeffed out, so I don't forget to
|
||||
// add a gui some day and activate it.
|
||||
//#define ANALOG_CONTROLS_HACK
|
||||
// The various KEY_PAD_xxx definitions are defined as the value of whatever key is pressed.
|
||||
// DEF_VALUE is the strength you press the control.
|
||||
// Code taken from http://forums.pcsx2.net/thread-4699.html
|
||||
|
||||
#ifdef ANALOG_CONTROLS_HACK
|
||||
#define KEY_PAD_RY_UP 0xff50
|
||||
#define KEY_PAD_RY_DOWN 0xff57
|
||||
#define KEY_PAD_LY_UP 0xff52
|
||||
#define KEY_PAD_LY_DOWN 0xff54
|
||||
#define KEY_PAD_RX_LEFT 0xffff
|
||||
#define KEY_PAD_RX_RIGHT 0xff56
|
||||
#define KEY_PAD_LX_LEFT 0xff51
|
||||
#define KEY_PAD_LX_RIGHT 0xff53
|
||||
#define DEF_VALUE 32766
|
||||
#endif
|
||||
|
||||
/* end of pad.h */
|
||||
|
||||
extern keyEvent event;
|
||||
|
|
Loading…
Reference in New Issue