Skip to content

Commit

Permalink
VITA: fixed analog mouse control deadzone and responsiveness
Browse files Browse the repository at this point in the history
  • Loading branch information
rsn8887 committed Dec 21, 2016
1 parent 453ba43 commit d9873fe
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
30 changes: 15 additions & 15 deletions src/custom.cpp
Expand Up @@ -2092,7 +2092,7 @@ static _INLINE_ void mousehack_setdontcare (void)

write_log ("Don't care mouse mode set\n");
mousestate = dont_care_mouse;
lastspr0x = lastmx; lastspr0y = lastmy;
lastspr0x = lastmx/16; lastspr0y = lastmy/16;
mstepx = defstepx; mstepy = defstepy;
}

Expand All @@ -2114,16 +2114,16 @@ static _INLINE_ uae_u32 mousehack_helper (void)
{
/* @@@ This isn't completely right, it doesn't deal with virtual
screen sizes larger than physical very well. */
if (lastmy >= PREFS_GFX_HEIGHT)
lastmy = PREFS_GFX_HEIGHT - 1;
if (lastmy/16 >= PREFS_GFX_HEIGHT)
lastmy = 16 * (PREFS_GFX_HEIGHT - 1);
if (lastmy < 0)
lastmy = 0;
if (lastmx < 0)
lastmx = 0;
if (lastmx >= PREFS_GFX_WIDTH)
lastmx = PREFS_GFX_WIDTH - 1;
mouseypos = coord_native_to_amiga_y (lastmy) << 1;
mousexpos = coord_native_to_amiga_x (lastmx);
if (lastmx/16 >= PREFS_GFX_WIDTH)
lastmx = 16 * (PREFS_GFX_WIDTH - 1);
mouseypos = coord_native_to_amiga_y (lastmy/16) << 1;
mousexpos = coord_native_to_amiga_x (lastmx/16);
}

switch (_68k_dreg (0)) {
Expand Down Expand Up @@ -2171,8 +2171,8 @@ static _INLINE_ void do_mouse_hack (void)
switch (mousestate)
{
case normal_mouse:
diffx = lastmx - lastsampledmx;
diffy = lastmy - lastsampledmy;
diffx = lastmx/16 - lastsampledmx;
diffy = lastmy/16 - lastsampledmy;
if (!newmousecounters)
{
if (diffx > 127)
Expand All @@ -2190,10 +2190,10 @@ static _INLINE_ void do_mouse_hack (void)
break;

case dont_care_mouse:
diffx = adjust (((lastmx - lastspr0x) * mstepx) >> 16);
diffy = adjust (((lastmy - lastspr0y) * mstepy) >> 16);
lastspr0x = lastmx;
lastspr0y = lastmy;
diffx = adjust (((lastmx/16 - lastspr0x) * mstepx) >> 16);
diffy = adjust (((lastmy/16 - lastspr0y) * mstepy) >> 16);
lastspr0x = lastmx/16;
lastspr0y = lastmy/16;
mouse_x += diffx;
mouse_y += diffy;
break;
Expand All @@ -2205,8 +2205,8 @@ static _INLINE_ void do_mouse_hack (void)
if (sprvbfl && (sprvbfl-- > 1))
{
int stylusxpos, stylusypos;
stylusxpos = coord_native_to_amiga_x (lastmx);
stylusypos = coord_native_to_amiga_y (lastmy) << 1;
stylusxpos = coord_native_to_amiga_x (lastmx/16);
stylusypos = coord_native_to_amiga_y (lastmy/16) << 1;
if(stylusxpos != spr0x || stylusypos != spr0y)
{
diffx = (stylusxpos - spr0x);
Expand Down
8 changes: 4 additions & 4 deletions src/od-joy.cpp
Expand Up @@ -98,8 +98,8 @@ void read_joystick(int nr, unsigned int *dir, int *button)
}
#endif
*/
int mouseScale = mainMenu_mouseMultiplier * 4;
if (mouseScale > 99)
int mouseScale = mainMenu_mouseMultiplier * 4 * 16;
if (mouseScale > (99*16))
mouseScale /= 100;

#ifdef USE_UAE4ALL_VKBD
Expand All @@ -115,7 +115,7 @@ void read_joystick(int nr, unsigned int *dir, int *button)
#endif
{
if (buttonY)
mouseScale = mainMenu_mouseMultiplier;
mouseScale = mainMenu_mouseMultiplier * 16;
#if defined(PANDORA) || defined(ANDROIDSDL)
if (dpadLeft)
#else
Expand Down Expand Up @@ -204,7 +204,7 @@ void read_joystick(int nr, unsigned int *dir, int *button)
{
analogY=0;
}
if (analogX != 0 && analogY != 0 )
if (analogX != 0 || analogY != 0 )
{
//max movement is mouseScale.
//that way, when in one of the other mouse modes,
Expand Down
20 changes: 10 additions & 10 deletions src/sdlgfx.cpp
Expand Up @@ -763,27 +763,27 @@ void handle_events (void)
mouse_state = true;
if(gp2xButtonRemappingOn)
{
lastmx = rEvent.motion.x*2 - mainMenu_stylusOffset + moved_x + stylusAdjustX >> 1;
lastmy = rEvent.motion.y*2 - mainMenu_stylusOffset + moved_y + stylusAdjustY >> 1;
lastmx = 16 * (rEvent.motion.x*2 - mainMenu_stylusOffset + moved_x + stylusAdjustX >> 1);
lastmy = 16 * (rEvent.motion.y*2 - mainMenu_stylusOffset + moved_y + stylusAdjustY >> 1);
//mouseMoving = 1;
}
else if(slow_mouse)
{
lastmx += rEvent.motion.xrel;
lastmy += rEvent.motion.yrel;
lastmx += 16 * rEvent.motion.xrel;
lastmy += 16 * rEvent.motion.yrel;
if(rEvent.motion.x == 0)
lastmx -= 2;
lastmx -= 2*16;
if(rEvent.motion.y == 0)
lastmy -= 2;
lastmy -= 2*16;
if(rEvent.motion.x == visibleAreaWidth-1)
lastmx += 2;
lastmx += 2*16;
if(rEvent.motion.y == mainMenu_displayedLines-1)
lastmy += 2;
lastmy += 2*16;
}
else
{
int mouseScale = mainMenu_mouseMultiplier * 4;
if (mouseScale > 99)
int mouseScale = mainMenu_mouseMultiplier * 4 *16;
if (mouseScale > 99*16)
mouseScale /= 100;

lastmx += rEvent.motion.xrel * mouseScale;
Expand Down

0 comments on commit d9873fe

Please sign in to comment.