Unverified Commit 6b50ef04 authored by Libretro-Admin's avatar Libretro-Admin Committed by GitHub
Browse files

Merge pull request #60 from bbbradsmith/bayx_swap

Swap B/A and Y/X in default controls
parents 7be3f922 7f65aeaa
Pipeline #2543 passed with stages
in 2 minutes and 44 seconds
......@@ -55,16 +55,19 @@ Note : zip support is provided by RetroArch and is done before passing the game
## Default Controls
```
L2 Show/Hide statut
R2 Sound on/off
L Toggle Num Joy .
L2 Show/Hide status
R2 Select virtual keyboard page
L Show/hide virtual keyboard
R Change Mouse speed 1 to 6 . (for gui and emu)
SEL Toggle Mouse/Joy mode .
STR Show/Hide vkbd .
A Fire/Mouse btn A / Valid key in vkbd
B Mouse btn B
X
Y HATARI GUI
SEL Toggle Mouse/Joy mode
STR Toggle joystick number
B Fire / Left mouse button / Virtual keyboard keypress
A Auto-Fire / Right mouse button
Y Toggle Shift
X Hatari GUI
Analog Left - Joystick / Mouse
Mouse - Mouse
```
## Knows Bugs
......
......@@ -58,7 +58,6 @@ int pauseg=0; //enter_gui
//JOY
int al[2];//left analog1
int ar[2];//right analog1
unsigned char MXjoy0; // joy
int NUMjoy=1;
......@@ -369,24 +368,21 @@ void Process_key(void)
/*
L2 show/hide Statut
L2 show/hide Status
R2 swap kbd pages
L show/hide vkbd
R MOUSE SPEED(gui/emu)
SEL toggle mouse/joy mode
STR toggle num joy
A fire/mousea/valid key in vkbd
B mouseb
X switch Shift ON/OFF
Y Emu Gui
B fire/mouse-left/valid key in vkbd
A mouse-right
Y switch Shift ON/OFF
X Emu Gui
*/
void update_input(void)
{
int i;
// RETRO B Y SLT STA UP DWN LEFT RGT A X L R L2 R2 L3 R3
// INDEX 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
static int vbt[16]={0x1C,0x39,0x01,0x3B,0x01,0x02,0x04,0x08,0x80,0x6D,0x15,0x31,0x24,0x1F,0x6E,0x6F};
static int oldi=-1;
static int vkx=0,vky=0;
......@@ -401,10 +397,11 @@ void update_input(void)
Process_key();
if (Key_Sate[RETROK_F11] || input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y) )
i=RETRO_DEVICE_ID_JOYPAD_X;
if (Key_Sate[RETROK_F11] || input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) )
pauseg=1;
i=10;//show vkey toggle
i=RETRO_DEVICE_ID_JOYPAD_L;//show vkey toggle
if ( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) && mbt[i]==0 )
mbt[i]=1;
else if ( mbt[i]==1 && ! input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) )
......@@ -414,7 +411,7 @@ void update_input(void)
Screen_SetFullUpdate();
}
i=2;//mouse/joy toggle
i=RETRO_DEVICE_ID_JOYPAD_SELECT;//mouse/joy toggle
if ( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) && mbt[i]==0 )
mbt[i]=1;
else if ( mbt[i]==1 && ! input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) )
......@@ -423,7 +420,7 @@ void update_input(void)
MOUSEMODE=-MOUSEMODE;
}
i=3;//num joy toggle
i=RETRO_DEVICE_ID_JOYPAD_START;//num joy toggle
if ( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) && mbt[i]==0 )
mbt[i]=1;
else if ( mbt[i]==1 && ! input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) )
......@@ -433,7 +430,7 @@ void update_input(void)
NUMjoy=-NUMjoy;
}
i=11;//mouse gui speed
i=RETRO_DEVICE_ID_JOYPAD_R;//mouse gui speed
if ( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) && mbt[i]==0 )
mbt[i]=1;
else if ( mbt[i]==1 && ! input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) )
......@@ -442,7 +439,7 @@ void update_input(void)
PAS++;if(PAS>MAXPAS)PAS=1;
}
i=9;//switch shift On/Off
i=RETRO_DEVICE_ID_JOYPAD_Y;//switch shift On/Off
if ( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) && mbt[i]==0 )
mbt[i]=1;
else if ( mbt[i]==1 && ! input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) )
......@@ -452,7 +449,7 @@ void update_input(void)
Screen_SetFullUpdate();
}
i=12;//show/hide statut
i=RETRO_DEVICE_ID_JOYPAD_L2;//show/hide status
if ( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) && mbt[i]==0 )
mbt[i]=1;
else if ( mbt[i]==1 && ! input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) )
......@@ -462,7 +459,7 @@ void update_input(void)
Screen_SetFullUpdate();
}
i=13;//swap kbd pages
i=RETRO_DEVICE_ID_JOYPAD_R2;//swap kbd pages
if ( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) && mbt[i]==0 )
mbt[i]=1;
else if ( mbt[i]==1 && ! input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) )
......@@ -477,7 +474,7 @@ void update_input(void)
if(SHOWKEY==1)
{
static int vkflag[5]={0,0,0,0,0};
static int vkflag[5]={0,0,0,0,0};
if ( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP) && vkflag[0]==0 )
vkflag[0]=1;
......@@ -518,8 +515,8 @@ void update_input(void)
virtual_kdb(bmp,vkx,vky);
i=8;
if(input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) && vkflag[4]==0)
i=RETRO_DEVICE_ID_JOYPAD_B;
if(input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) && vkflag[4]==0)
vkflag[4]=1;
else if( !input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) && vkflag[4]==1)
{
......@@ -529,9 +526,8 @@ void update_input(void)
if(i==-2)
{
NPAGE=-NPAGE;oldi=-1;
//Clear interface zone
//Clear interface zone
Screen_SetFullUpdate();
}
else if(i==-1)
oldi=-1;
......@@ -544,7 +540,7 @@ void update_input(void)
}
else if(i==-4)
{
//VKbd show/hide
//VKbd show/hide
oldi=-1;
Screen_SetFullUpdate();
SHOWKEY=-SHOWKEY;
......@@ -607,11 +603,14 @@ void update_input(void)
else if (al[0] >= JOYRANGE_RIGHT_VALUE)
MXjoy0 |= ATARIJOY_BITMASK_RIGHT;
for(i=4;i<9;i++)if( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) )MXjoy0 |= vbt[i]; // Joy press
if( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP ) ) MXjoy0 |= ATARIJOY_BITMASK_UP;
if( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN ) ) MXjoy0 |= ATARIJOY_BITMASK_DOWN;
if( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT ) ) MXjoy0 |= ATARIJOY_BITMASK_LEFT;
if( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT) ) MXjoy0 |= ATARIJOY_BITMASK_RIGHT;
if( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B) ) MXjoy0 |= ATARIJOY_BITMASK_FIRE;
// Joy autofire
if( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B) )
if( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A) )
{
MXjoy0 |= ATARIJOY_BITMASK_FIRE;
if ((nVBLs&0x7)<4)
......@@ -633,29 +632,29 @@ void update_input(void)
//Mouse mode
fmousex=fmousey=0;
//emulate mouse with joy analog right
ar[0] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X));
ar[1] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y));
//emulate mouse with joy analog left
al[0] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X));
al[1] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y));
#if defined(VITA)
// fix analog to mouse move up alone
int analog_deadzone = (15 * 32768 / 100);
double analog_r_magnitude = sqrt((ar[0]*ar[0]) + (ar[1]*ar[1]));
// fix analog to mouse move up alone
int analog_deadzone = (15 * 32768 / 100);
double analog_r_magnitude = sqrt((al[0]*al[0]) + (al[1]*al[1]));
if (analog_r_magnitude <= analog_deadzone)
{
ar[0] = 0;
ar[1] = 0;
al[0] = 0;
al[1] = 0;
}
#endif
if(ar[0]<=-1024)
fmousex -=(-ar[0])/1024;
if(ar[0]>= 1024)
fmousex +=( ar[0])/1024;
if(ar[1]<=-1024)
fmousey -=(-ar[1])/1024;
if(ar[1]>= 1024)
fmousey +=( ar[1])/1024;
if(al[0]<=-1024)
fmousex -=(-al[0])/1024;
if(al[0]>= 1024)
fmousex +=( al[0])/1024;
if(al[1]<=-1024)
fmousey -=(-al[1])/1024;
if(al[1]>= 1024)
fmousey +=( al[1])/1024;
//emulate mouse with dpad
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT))
......@@ -667,8 +666,8 @@ void update_input(void)
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP))
fmousey -= PAS;
mouse_l=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A);
mouse_r=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B);
mouse_l=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B);
mouse_r=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A);
}
if(mbL==0 && mouse_l)
......@@ -701,7 +700,7 @@ void update_input(void)
void input_gui(void)
{
int SAVPAS=PAS;
int SAVPAS=PAS;
input_poll_cb();
......@@ -723,6 +722,29 @@ void input_gui(void)
if(MOUSEMODE==1)
{
//emulate mouse with joy analog left
al[0] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X));
al[1] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y));
#if defined(VITA)
// fix analog to mouse move up alone
int analog_deadzone = (15 * 32768 / 100);
double analog_r_magnitude = sqrt((al[0]*al[0]) + (al[1]*al[1]));
if (analog_r_magnitude <= analog_deadzone)
{
al[0] = 0;
al[1] = 0;
}
#endif
if(al[0]<=-1024)
mouse_x -=(-al[0])/1024;
if(al[0]>= 1024)
mouse_x +=( al[0])/1024;
if(al[1]<=-1024)
mouse_y -=(-al[1])/1024;
if(al[1]>= 1024)
mouse_y +=( al[1])/1024;
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT))
mouse_x += PAS;
......@@ -732,11 +754,10 @@ void input_gui(void)
mouse_y += PAS;
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP))
mouse_y -= PAS;
mouse_l=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A);
mouse_r=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B);
mouse_l=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B);
mouse_r=input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A);
PAS=SAVPAS;
}
else
{
......@@ -752,7 +773,7 @@ void input_gui(void)
if(mmbL==0 && mouse_l)
{
mmbL=1;
mmbL=1;
touch=1;
}
else if(mmbL==1 && !mouse_l)
......@@ -762,7 +783,7 @@ void input_gui(void)
}
if(mmbR==0 && mouse_r)
mmbR=1;
mmbR=1;
else if(mmbR==1 && !mouse_r)
mmbR=0;
......@@ -776,6 +797,5 @@ void input_gui(void)
gmy=0;
if (gmy>retroh-1)
gmy=retroh-1;
}
......@@ -70,12 +70,13 @@ static struct retro_input_descriptor input_descriptors[] = {
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN, "Down" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "Left" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "Right" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A, "Fire" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "Turbo Fire" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y, "Enter GUI" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A, "Turbo Fire" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "Fire" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X, "Enter GUI" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y, "Shift toggle" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Mouse mode toggle" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Keyboard overlay" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2, "Toggle m/k status" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2, "Toggle status display" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L, "Joystick number" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R, "Mouse speed" },
// Terminate
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment