Skip to content

Commit

Permalink
Vita: - virtual keyboard transparency adjust now toggles between four…
Browse files Browse the repository at this point in the history
… values, two of which cause zero slow-down when keyboard is displayed. - resolution quick switch with R+Start+Dpad left/right is now more responsive
  • Loading branch information
rsn8887 committed Dec 28, 2016
1 parent adcabab commit 3e98b9b
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 43 deletions.
22 changes: 22 additions & 0 deletions CMakeLists.txt
Expand Up @@ -11,6 +11,20 @@ set(CMAKE_CXX_COMPILER "${VITASDK}/bin/arm-vita-eabi-g++")
set(CMAKE_C_FLAGS "-Wl,-q" CACHE STRING "C flags")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "C++ flags")

#There are two optional assembler optimizations that were used on the Pandora:
#-DUSE_ARMV7
#(use assembler-optimized "arm_memset" and "arm_memcpy" routines
#in "gp2x/memset.s" and "gp2x/memcpy.s")
#-DUSE_ARMNEON
#(use assembler-optimized drawing routines for the line drawing of Amiga screens
#in "neon_helper.s")
#Currently, these compile for the Vita but cause a crash on first leaving the menu
#I suspect these have to be re-written for the Vita CPU to make use of asm-optimization
#
#enable_language(ASM)
#set(CMAKE_ASM_COMPILER "${VITASDK}/bin/arm-vita-eabi-g++")
#set(CMAKE_ASM_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "ASM flags")

execute_process(COMMAND "date" "+%Y.%m.%d" OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)

project(uae4all2)
Expand Down Expand Up @@ -41,6 +55,8 @@ set(FLAGS
-DUSE_UAE4ALL_VKBD
-DVKBD_ALWAYS
-DLARGEKEYBOARD
#-DUSE_ARMV7
#-DUSE_ARMNEON
-fomit-frame-pointer -Wno-unused -Wno-format
-ffast-math -fstrict-aliasing -mstructure-size-boundary=32 -fexpensive-optimizations
-fweb -frename-registers -fomit-frame-pointer
Expand All @@ -56,6 +72,9 @@ set(DEBUG_FLAGS
-DUSE_SDL -DGCCCONSTFUNC="__attribute__\(\(const\)\)" -DUSE_UNDERSCORE
-DSHM_SUPPORT_LINKS=0 -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS -DOS_WITHOUT_MEMORY_MANAGEMENT
-DROM_PATH_PREFIX=\"ux0:/data/uae4all/roms/\" -DDATA_PREFIX=\"app0:/data/\" -DSAVE_PREFIX=\"ux0:/data/uae4all/saves/\"
-DUSE_UAE4ALL_VKBD
-DVKBD_ALWAYS
-DLARGEKEYBOARD
-DDEBUG -DDEBUG_UAE4ALL -DUAE_CONSOLE
)

Expand All @@ -64,6 +83,9 @@ set(SRC_FILES
src/psp2/psp2_input.c
src/psp2/psp2-dirent.c
src/vkbd/vkbd.cpp
# src/neon_helper.s
# src/gp2x/memset.s
# src/gp2x/memcpy.s
src/audio.cpp
src/autoconf.cpp
src/blitfunc.cpp
Expand Down
Binary file removed psp2data/data/vkbdLargeShift_German.bmp
Binary file not shown.
Binary file removed psp2data/data/vkbdLarge_German.bmp
Binary file not shown.
72 changes: 43 additions & 29 deletions src/gui.cpp
Expand Up @@ -76,13 +76,14 @@ extern SDL_Joystick *uae4all_joy0, *uae4all_joy1;

#ifdef __PSP2__
//Predefined quick switch resolutions to select via TRIGGER R+START+DPAD LEFT/RIGHT
int quickSwitchModeID=8;
static int can_change_quickSwitchModeID = 1;
static int quickSwitchModeID=1;
struct myRes
{
int num_lines;
int top_pos;
};
myRes quickSwitchModes[] = {
static myRes quickSwitchModes[] = {
{192, 0},
{200, 0},
{216, 0},
Expand Down Expand Up @@ -758,21 +759,25 @@ if(!vkbd_mode)
#ifdef __PSP2__
// Change zoom:
// quickSwitch resolution presets
if (quickSwitchModeID==0)
if (can_change_quickSwitchModeID)
{
quickSwitchModeID=sizeof(quickSwitchModes)/sizeof(quickSwitchModes[0])-1;
}
else
{
quickSwitchModeID--;
if (quickSwitchModeID==0)
{
quickSwitchModeID=sizeof(quickSwitchModes)/sizeof(quickSwitchModes[0])-1;
}
else
{
quickSwitchModeID--;
}
mainMenu_displayedLines =
quickSwitchModes[quickSwitchModeID].num_lines;
moveY =
quickSwitchModes[quickSwitchModeID].top_pos;
getChanges();
check_all_prefs();
update_display();
can_change_quickSwitchModeID=0;
}
mainMenu_displayedLines =
quickSwitchModes[quickSwitchModeID].num_lines;
moveY =
quickSwitchModes[quickSwitchModeID].top_pos;
getChanges();
check_all_prefs();
update_display();
#else
screenWidth -=10;
if(screenWidth<200)
Expand All @@ -784,28 +789,37 @@ if(!vkbd_mode)
else if(dpadRight)
{
#ifdef __PSP2__
if (quickSwitchModeID==sizeof(quickSwitchModes)/sizeof(quickSwitchModes[0])-1)
{
quickSwitchModeID=0;
}
else
{
quickSwitchModeID++;
if (can_change_quickSwitchModeID)
{

if (quickSwitchModeID==sizeof(quickSwitchModes)/sizeof(quickSwitchModes[0])-1)
{
quickSwitchModeID=0;
}
else
{
quickSwitchModeID++;
}
mainMenu_displayedLines =
quickSwitchModes[quickSwitchModeID].num_lines;
moveY =
quickSwitchModes[quickSwitchModeID].top_pos;
getChanges();
check_all_prefs();
update_display();
can_change_quickSwitchModeID = 0;
}
mainMenu_displayedLines =
quickSwitchModes[quickSwitchModeID].num_lines;
moveY =
quickSwitchModes[quickSwitchModeID].top_pos;
getChanges();
check_all_prefs();
update_display();
#else
screenWidth +=10;
if(screenWidth>800)
screenWidth = 800;
update_display();
#endif
}
else if (!can_change_quickSwitchModeID)
{
can_change_quickSwitchModeID = 1;
}
//1
else if(keystate[SDLK_1])
{
Expand Down
14 changes: 12 additions & 2 deletions src/od-joy.cpp
Expand Up @@ -23,6 +23,7 @@

#ifdef USE_UAE4ALL_VKBD
#include "vkbd.h"
static int can_change_vkbd_transparency=1;
#endif

#ifdef ANDROIDSDL
Expand Down Expand Up @@ -339,18 +340,27 @@ void read_joystick(int nr, unsigned int *dir, int *button)
else if (buttonStart && (dpadLeft || left))
#endif
{
vkbd_transparency_up();
if (can_change_vkbd_transparency)
{
vkbd_transparency_up();
can_change_vkbd_transparency=0;
}
}
#ifdef __PSP2__
else if (rAnalogX > 1024*10)
#else
else if (buttonStart && (dpadRight || right))
#endif
{
vkbd_transparency_down();
if (can_change_vkbd_transparency)
{
vkbd_transparency_down();
can_change_vkbd_transparency=0;
}
}
else
{
can_change_vkbd_transparency=1;
if (left || dpadLeft)
vkbd_move |= VKBD_LEFT;
else
Expand Down
64 changes: 52 additions & 12 deletions src/vkbd/vkbd.cpp
Expand Up @@ -437,32 +437,72 @@ void vkbd_redraw(void)

void vkbd_transparency_up(void)
{
if (vkbd_transparency>53)
vkbd_transparency-=4;
else
vkbd_transparency=50;
SDL_SetAlpha(ksur, SDL_SRCALPHA | SDL_RLEACCEL, vkbd_transparency);
switch (vkbd_transparency)
{
case 255:
vkbd_transparency=192;
break;
case 192:
vkbd_transparency=128;
break;
case 128:
vkbd_transparency=64;
break;
case 64:
vkbd_transparency=255;
break;
default:
vkbd_transparency=64;
break;
}
if (vkbd_transparency != 255)
{
SDL_SetAlpha(ksur, SDL_SRCALPHA | SDL_RLEACCEL, vkbd_transparency);
#ifdef LARGEKEYBOARD
SDL_SetAlpha(ksurShift, SDL_SRCALPHA | SDL_RLEACCEL, vkbd_transparency);
SDL_SetAlpha(ksurShift, SDL_SRCALPHA | SDL_RLEACCEL, vkbd_transparency);
#endif
}
else //fully opague
{
SDL_SetAlpha(ksur, 0, 255);
#ifdef LARGEKEYBOARD
SDL_SetAlpha(ksurShift, 0, 255);
#endif
}
}

void vkbd_transparency_down(void)
{
if (vkbd_transparency<252)
switch (vkbd_transparency)
{
case 255:
vkbd_transparency=64;
break;
case 192:
vkbd_transparency=255;
break;
case 128:
vkbd_transparency=192;
break;
case 64:
vkbd_transparency=128;
break;
default:
vkbd_transparency=255;
break;
}
if (vkbd_transparency != 255)
{
vkbd_transparency+=4; //some transparency
SDL_SetAlpha(ksur, SDL_SRCALPHA | SDL_RLEACCEL, vkbd_transparency);
#ifdef LARGEKEYBOARD
SDL_SetAlpha(ksurShift, SDL_SRCALPHA | SDL_RLEACCEL, vkbd_transparency);
#endif
}
else
else //fully opague
{
vkbd_transparency=255; //fully opaque
SDL_SetAlpha(ksur, 0, vkbd_transparency);
SDL_SetAlpha(ksur, 0, 255);
#ifdef LARGEKEYBOARD
SDL_SetAlpha(ksurShift, 0, vkbd_transparency);
SDL_SetAlpha(ksurShift, 0, 255);
#endif
}
}
Expand Down

0 comments on commit 3e98b9b

Please sign in to comment.