Skip to content

Commit

Permalink
Vita: - vastly improved virtual keyboard
Browse files Browse the repository at this point in the history
- The new virtual keyboard is now bigger, supports more keys including shifted keys and is transparent
- Fixed virtual keyboard not reacting when custom Dpad mode was active
- The virtual keyboard can be moved up and down using Start+Dpad Up and Start+ Dpad Down
(thanks to ScHlAuChi for the new keyboard image and many ideas)
  • Loading branch information
rsn8887 committed Dec 25, 2016
1 parent 9e6f5c8 commit f0b2823
Show file tree
Hide file tree
Showing 9 changed files with 328 additions and 58 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -40,6 +40,7 @@ set(FLAGS
-DROM_PATH_PREFIX=\"ux0:/data/uae4all/roms/\" -DDATA_PREFIX=\"app0:/data/\" -DSAVE_PREFIX=\"ux0:/data/uae4all/saves/\"
-DUSE_UAE4ALL_VKBD
-DVKBD_ALWAYS
-DLARGEKEYBOARD
-fomit-frame-pointer -Wno-unused -Wno-format
-ffast-math -fstrict-aliasing -mstructure-size-boundary=32 -fexpensive-optimizations
-fweb -frename-registers -fomit-frame-pointer
Expand Down
Binary file added psp2data/data/vkbdLarge.bmp
Binary file not shown.
Binary file added psp2data/data/vkbdLargeShift.bmp
Binary file not shown.
Binary file added psp2data/data/vkbdLargeShift_German.bmp
Binary file not shown.
Binary file added psp2data/data/vkbdLarge_German.bmp
Binary file not shown.
27 changes: 20 additions & 7 deletions src/gui.cpp
Expand Up @@ -1742,27 +1742,40 @@ if(!vkbd_mode)
}

#ifdef USE_UAE4ALL_VKBD
if (vkbd_key)
if (vkbd_key!=-1234567) // This means key was selected by user. We cannot test for zero, because that is a valid Amiga keycode
{
if (vkbd_keysave==-1234567)
if (vkbd_keysave==-1234567) // the previous vkbd key was released. Press the new key for one frame
{
SDL_keysym ks;
ks.sym=vkbd_key;
vkbd_keysave=keycode2amiga(&ks);
vkbd_keysave=vkbd_key; // remember which key we are pressing so we can release it later
if (vkbd_keysave >= 0)
{
if (!uae4all_keystate[vkbd_keysave])
{
if ((vkbd_shift) && uae4all_keystate[AK_LSH] == 0)
{
uae4all_keystate[AK_LSH]=1;
record_key(AK_LSH<<1);
}
if (!(vkbd_shift) && uae4all_keystate[AK_LSH] == 1)
{
uae4all_keystate[AK_LSH]=0;
record_key((AK_LSH<<1)|1);
}
uae4all_keystate[vkbd_keysave]=1;
record_key(vkbd_keysave<<1);
record_key(vkbd_keysave<<1);
}
}
}
}
else if (vkbd_keysave!=-1234567)
{
if (vkbd_keysave >= 0)
if (vkbd_keysave >= 0) //turn off shift together with any other key release if it was on
{
if (uae4all_keystate[AK_LSH] == 1)
{
uae4all_keystate[AK_LSH]=0;
record_key((AK_LSH<<1)|1);
}
uae4all_keystate[vkbd_keysave]=0;
record_key((vkbd_keysave << 1) | 1);
}
Expand Down
59 changes: 39 additions & 20 deletions src/od-joy.cpp
Expand Up @@ -314,32 +314,51 @@ void read_joystick(int nr, unsigned int *dir, int *button)
if (vkbd_mode && nr)
{
// move around the virtual keyboard instead
if (left)
vkbd_move |= VKBD_LEFT;
else

// if Start+up or Start+down is pressed: move the keyboard itself
if (buttonStart && (dpadUp || top))
{
vkbd_move &= ~VKBD_LEFT;
if (right)
vkbd_move |= VKBD_RIGHT;
else
vkbd_move &= ~VKBD_RIGHT;
vkbd_displace_up();
}
if (top)
vkbd_move |= VKBD_UP;
else
else if (buttonStart && (dpadDown || bot))
{
vkbd_move &= ~VKBD_UP;
if (bot)
vkbd_move |= VKBD_DOWN;
else
vkbd_move &= ~VKBD_DOWN;
vkbd_displace_down();
}
if (*button)

else
{
vkbd_move=VKBD_BUTTON;
*button=0;
if (left || dpadLeft)
vkbd_move |= VKBD_LEFT;
else
{
vkbd_move &= ~VKBD_LEFT;
if (right || dpadRight)
vkbd_move |= VKBD_RIGHT;
else
vkbd_move &= ~VKBD_RIGHT;
}
if (top || dpadUp)
vkbd_move |= VKBD_UP;
else
{
vkbd_move &= ~VKBD_UP;
if (bot || dpadDown)
vkbd_move |= VKBD_DOWN;
else
vkbd_move &= ~VKBD_DOWN;
}

if (*button || buttonX)
{
vkbd_move=VKBD_BUTTON;
*button=0;
}
else //button release, make shift toggle possible again.
{
vkbd_can_switch_shift=1;
}
// TODO: add vkbd_button2 mapped to button2
}
// TODO: add vkbd_button2 mapped to button2
}
else
#endif
Expand Down

0 comments on commit f0b2823

Please sign in to comment.