Y Axis= axis(4-,4+)
X Axis= axis(3-,3+)
-#Pandora dual nub support, the hat is in fact "nub1"
+#Pandora nub support
[nub0]
plugged = True
plugin = 2
# default value here
Mempak switch = key(44)
Rumblepak switch = key(46)
+C Button2 U = mouse_up
+C Button2 D = mouse_down
+C Button2 L = mouse_left
+C Button2 R = mouse_right
+
+#Pandora nub support, if using right nub
+[nub1]
+plugged = True
+plugin = 2
+mouse = False
+DPad R = key(275)
+DPad L = key(276)
+DPad D = key(274)
+DPad U = key(273)
+#Start is Start
+Start= key(308)
+Z Trig= key(303)
+#B button = (X) = 281 = SDLK_PAGEDWN
+B Button= key(278)
+#A button = (A) = 278 = SDLK_HOME (279 = (B))
+A Button= key(281)
+R Trig= key(305)
+#L trigger is (B) (P = 111)
+L Trig= key(279)
+Y Axis= axis(1-,1+)
+X Axis= axis(0-,0+)
+# K=107 , Backspace=8
+C Button R = key(8)
+# J = 106, 9 = 57
+C Button L = key(57)
+# M = 109 , (Y) = 280
+C Button D = key(280)
+# I = 105 , 0 = 48
+C Button U = key(48)
+#C Button R = hat(0 Right)
+#C Button L = hat(0 Left)
+#C Button D = hat(0 Down)
+#C Button U = hat(0 Up)
+# default value here
+Mempak switch = key(44)
+Rumblepak switch = key(46)
+C Button2 U = mouse_up
+C Button2 D = mouse_down
+C Button2 L = mouse_left
+C Button2 R = mouse_right
+
+[Retrode]
+plugged = True
+plugin = 2
+mouse = False
+AnalogDeadzone = 4096,4096
+AnalogPeak = 32768,32768
+DPad R = button(8)
+DPad L = button(9)
+DPad D = button(10)
+DPad U = button(11)
+Start = button(12)
+Z Trig = button(13)
+B Button = button(14)
+A Button = button(15)
+C Button R = button(0)
+C Button L = button(1)
+C Button D = button(2)
+C Button U = button(3)
+R Trig = button(4)
+L Trig = button(5)
+#Mempak switch =
+#Rumblepak switch =
+X Axis = axis(0-,0+)
+Y Axis = axis(1-,1+)
+__NextController:
+plugged = True
+plugin = 2
+mouse = False
+AnalogDeadzone = 4096,4096
+AnalogPeak = 32768,32768
+DPad R = button(24)
+DPad L = button(25)
+DPad D = button(26)
+DPad U = button(27)
+Start = button(28)
+Z Trig = button(29)
+B Button = button(30)
+A Button = button(31)
+C Button R = button(19)
+C Button L = button(18)
+C Button D = button(17)
+C Button U = button(16)
+R Trig = button(20)
+L Trig = button(21)
+#Mempak switch =
+#Rumblepak switch =
+X Axis = axis(2-,2+)
+Y Axis = axis(3-,3+)
\ No newline at end of file
"L Trig", // L_TRIG
"Mempak switch",
"Rumblepak switch",
+ "C Button2 R", // R_CBUTTON alternate
+ "C Button2 L", // L_CBUTTON alternate
+ "C Button2 D", // D_CBUTTON alternate
+ "C Button2 U", // U_CBUTTON alternate
"X Axis", // X_AXIS
"Y Axis" // Y_AXIS
};
controller[iCtrlIdx].control->Present = 0;
controller[iCtrlIdx].control->RawData = 0;
controller[iCtrlIdx].control->Plugin = PLUGIN_NONE;
- for( b = 0; b < 16; b++ )
+ for( b = 0; b < NUM_BUTTONS; b++ )
{
controller[iCtrlIdx].button[b].button = -1;
controller[iCtrlIdx].button[b].key = SDL_SCANCODE_UNKNOWN;
controller[iCtrlIdx].button[b].hat = -1;
controller[iCtrlIdx].button[b].hat_pos = -1;
controller[iCtrlIdx].button[b].mouse = -1;
+ controller[iCtrlIdx].button[b].mouse_up = 0;
+ controller[iCtrlIdx].button[b].mouse_down = 0;
+ controller[iCtrlIdx].button[b].mouse_left = 0;
+ controller[iCtrlIdx].button[b].mouse_right = 0;
}
for( b = 0; b < 2; b++ )
{
static int load_controller_config(const char *SectionName, int i, int sdlDeviceIdx)
{
m64p_handle pConfig;
- char input_str[256], value1_str[16], value2_str[16];
+ char input_str[256], value1_str[NUM_BUTTONS], value2_str[NUM_BUTTONS];
const char *config_ptr;
int j;
if (lastchar > value1_str && *lastchar == ')') *lastchar = 0;
controller[i].button[j].hat_pos = get_hat_pos_by_name(value1_str);
}
- if ((config_ptr = strstr(input_str, "mouse")) != NULL)
- if (sscanf(config_ptr, "mouse(%i)", &controller[i].button[j].mouse) != 1)
+ if ((config_ptr = strstr(input_str, "mouse")) != NULL) {
+ // check for mouse_pseudo button first
+ if ((config_ptr = strstr(input_str, "mouse_up")) != NULL) {controller[i].button[j].mouse_up=1; controller[i].mouse_up=1;}
+ else if ((config_ptr = strstr(input_str, "mouse_down")) != NULL) {controller[i].button[j].mouse_down=1; controller[i].mouse_down=1;}
+ else if ((config_ptr = strstr(input_str, "mouse_left")) != NULL) {controller[i].button[j].mouse_left=1; controller[i].mouse_left=1;}
+ else if ((config_ptr = strstr(input_str, "mouse_right")) != NULL) {controller[i].button[j].mouse_right=1; controller[i].mouse_right=1;}
+ else if (sscanf(config_ptr, "mouse(%i)", &controller[i].button[j].mouse) != 1)
DebugMessage(M64MSG_WARNING, "parsing error in mouse() parameter of button '%s' for controller %i", button_names[j], i + 1);
+ }
}
/* load configuration for the 2 analog joystick axes */
for (j = X_AXIS; j <= Y_AXIS; j++)
sprintf(Param, "mouse(%i) ", controller[iCtrlIdx].button[j].mouse);
strcat(ParamString, Param);
}
+ if (controller[iCtrlIdx].button[j].mouse_up > 0)
+ {
+ sprintf(Param, "mouse_up ");
+ strcat(ParamString, Param);
+ }
+ if (controller[iCtrlIdx].button[j].mouse_down > 0)
+ {
+ sprintf(Param, "mouse_down ");
+ strcat(ParamString, Param);
+ }
+ if (controller[iCtrlIdx].button[j].mouse_right > 0)
+ {
+ sprintf(Param, "mouse_right ");
+ strcat(ParamString, Param);
+ }
+ if (controller[iCtrlIdx].button[j].mouse_left > 0)
+ {
+ sprintf(Param, "mouse_left ");
+ strcat(ParamString, Param);
+ }
if (j == 0)
Help = "Digital button configuration mappings";
else
0x1000, // R_TRIG
0x2000, // L_TRIG
0x4000, // Mempak switch
- 0x8000 // Rumblepak switch
+ 0x8000, // Rumblepak switch
+ 0x0100, // R_CBUTTON alternate
+ 0x0200, // L_CBUTTON alternate
+ 0x0400, // D_CBUTTON alternate
+ 0x0800 // U_CBUTTON alternate
};
static int romopen = 0; // is a rom opened
static int grabmouse = 1, grabtoggled = 0;
axis_max_val = 80;
- if (keystate[SDL_SCANCODE_RCTRL])
+/* if (keystate[SDL_SCANCODE_RCTRL])
axis_max_val -= 40;
if (keystate[SDL_SCANCODE_RSHIFT])
- axis_max_val -= 20;
+ axis_max_val -= 20;*/
for( c = 0; c < 4; c++ )
{
}
if (controller[c].mouse)
{
- if (keystate[SDL_SCANCODE_LCTRL] && keystate[SDL_SCANCODE_LALT])
+ /* if (keystate[SDL_SCANCODE_LCTRL] && keystate[SDL_SCANCODE_LALT])
{
if (!grabtoggled)
{
}
}
else grabtoggled = 0;
+ */
}
}
}
if( controller[Control].device >= 0 )
{
- for( b = 0; b < 16; b++ )
+ for( b = 0; b < NUM_BUTTONS; b++ )
{
if( controller[Control].button[b].button >= 0 )
if( SDL_JoystickGetButton( controller[Control].joystick, controller[Control].button[b].button ) )
// process mouse events
mstate = SDL_GetMouseState( NULL, NULL );
- for( b = 0; b < 16; b++ )
+ for( b = 0; b < NUM_BUTTONS; b++ )
{
if( controller[Control].button[b].mouse < 1 )
continue;
controller[Control].buttons.Value |= button_bits[b];
}
- if (controller[Control].mouse)
+ if ((controller[Control].mouse)
+ || ((controller[Control].mouse_up) || (controller[Control].mouse_down) || (controller[Control].mouse_left) || (controller[Control].mouse_right) ))
{
#if SDL_VERSION_ATLEAST(2,0,0)
#warning SDL mouse grabbing not yet supported with SDL 2.0
axis_val = -80;
else if (axis_val > 80)
axis_val = 80;
- controller[Control].buttons.X_AXIS = axis_val;
+ if (controller[Control].mouse)
+ controller[Control].buttons.X_AXIS = axis_val;
+ else {
+ for( b = 0; b < NUM_BUTTONS; b++ ) {
+ if( controller[Control].button[b].mouse_left > 0 )
+ if (controller[Control].mouse_left) controller[Control].buttons.Value |= (axis_val<-40)?button_bits[b]:0;
+ if( controller[Control].button[b].mouse_right > 0 )
+ if (controller[Control].mouse_right) controller[Control].buttons.Value |= (axis_val>40)?button_bits[b]:0;
+ }
+ }
axis_val = mousey_residual;
if (axis_val < -80)
axis_val = -80;
else if (axis_val > 80)
axis_val = 80;
- controller[Control].buttons.Y_AXIS = -axis_val;
+ if (controller[Control].mouse)
+ controller[Control].buttons.Y_AXIS = -axis_val;
+ else {
+ for( b = 0; b < NUM_BUTTONS; b++ ) {
+ if( controller[Control].button[b].mouse_up > 0 )
+ if (controller[Control].mouse_up) controller[Control].buttons.Value |= (axis_val<-40)?button_bits[b]:0;
+ if( controller[Control].button[b].mouse_down > 0 )
+ if (controller[Control].mouse_down) controller[Control].buttons.Value |= (axis_val>40)?button_bits[b]:0;
+ }
+ }
/* the mouse x/y values decay exponentially */
mousex_residual = (mousex_residual * 224) / 256;
mousey_residual = (mousey_residual * 224) / 256;
controller[i].joystick = NULL;
// grab mouse
- if (controller[0].mouse || controller[1].mouse || controller[2].mouse || controller[3].mouse)
+ if ((controller[0].mouse || controller[1].mouse || controller[2].mouse || controller[3].mouse)
+ ||(controller[0].mouse_up || controller[0].mouse_down || controller[0].mouse_left || controller[0].mouse_right))
{
#if SDL_VERSION_ATLEAST(2,0,0)
#warning SDL mouse grabbing not yet supported with SDL 2.0
L_TRIG,
MEMPAK,
RUMBLEPAK,
+ R_CBUTTON2,
+ L_CBUTTON2,
+ D_CBUTTON2,
+ U_CBUTTON2,
X_AXIS,
Y_AXIS,
NUM_BUTTONS
int axis_deadzone; // -1 for default, or >= 0 for custom value
int hat, hat_pos; // hat + hat position; -1 if not assigned
int mouse; // mouse button
+ int mouse_up; // mouse direction pseudo buttons
+ int mouse_down;
+ int mouse_left;
+ int mouse_right;
} SButtonMap;
typedef struct
BUTTONS buttons;
// mappings
- SButtonMap button[16]; // 14 buttons; in the order of EButton + mempak/rumblepak switches
+ SButtonMap button[NUM_BUTTONS]; // 14 buttons; in the order of EButton + mempak/rumblepak switches
SAxisMap axis[2]; // 2 axis
int device; // joystick device; -1 = keyboard; -2 = none
int mouse; // mouse enabled: 0 = no; 1 = yes
int axis_deadzone[2]; // minimum absolute value before analog movement is recognized
int axis_peak[2]; // highest analog value returned by SDL, used for scaling
float mouse_sens[2]; // mouse sensitivity
+ int mouse_up;
+ int mouse_down;
+ int mouse_left;
+ int mouse_right;
} SController;
/* global data definitions */