Skip to content

Commit

Permalink
improve savestate thumbnail quality, clarify joystick option
Browse files Browse the repository at this point in the history
  • Loading branch information
rsn8887 committed Jan 12, 2019
1 parent 4a15e3b commit 5c33048
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 83 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
set(CMAKE_VERBOSE_MAKEFILE OFF)

set(VERSION_MAJOR 1)
set(VERSION_MINOR 86)
set(VERSION_MINOR 87)

if(BUILD_PSP2)
if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)
Expand Down Expand Up @@ -255,6 +255,7 @@ if(BUILD_NX)
set(LIBS
SDL2
SDL2_image
SDL2_gfx
EGL
GLESv2
glapi
Expand Down
32 changes: 21 additions & 11 deletions src/gp2x/menu/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ Uint32 menu_msg_time=0x12345678;
int skipintro=1;
int kickstart_warning=0;
int displaying_menu = 1;
int menu_screen_width = 640;
int menu_screen_height = 480;

static void obten_colores(void)
{
Expand Down Expand Up @@ -337,10 +339,23 @@ else
update_window_color();
}

void text_flip_with_image(SDL_Surface *img, int x, int y)
{
#if !defined(__PSP2__) && !defined(__SWITCH__)
SDL_Delay(10);
#endif
SDL_SoftStretch(text_screen,NULL,prSDLScreen,NULL);
SDL_Rect dst = { 2 * x, 2 * y , 0 , 0 };
SDL_BlitSurface(img, NULL, prSDLScreen, &dst);
SDL_Flip(prSDLScreen);
}

void text_flip(void)
{
#if !defined(__PSP2__) && !defined(__SWITCH__)
SDL_Delay(10);
SDL_BlitSurface(text_screen,NULL,prSDLScreen,NULL);
#endif
SDL_SoftStretch(text_screen,NULL,prSDLScreen,NULL);
SDL_Flip(prSDLScreen);
}

Expand Down Expand Up @@ -412,11 +427,11 @@ void init_text(int splash)

displaying_menu = 1;

prSDLScreen = SDL_SetVideoMode(320, 240, 16, SDL_HWSURFACE|SDL_DOUBLEBUF);
printf("init_text: SDL_SetVideoMode(%i, %i, 16)\n", 320, 240);
prSDLScreen = SDL_SetVideoMode(menu_screen_width, menu_screen_height, 16, SDL_HWSURFACE|SDL_DOUBLEBUF);
printf("init_text: SDL_SetVideoMode(%i, %i, 16)\n", menu_screen_width, menu_screen_height);

float sh = (float) 480;
float sw = (float)320*((float)480/(float)240);
float sw = (float)menu_screen_width*((float)480/(float)menu_screen_height);
int x = (960-sw)/2;
int y = (544-sh)/2;

Expand Down Expand Up @@ -451,8 +466,8 @@ void init_text(int splash)

if (!text_screen)
{
text_screen=SDL_CreateRGBSurface(prSDLScreen->flags,prSDLScreen->w,prSDLScreen->h,prSDLScreen->format->BitsPerPixel,prSDLScreen->format->Rmask,prSDLScreen->format->Gmask,prSDLScreen->format->Bmask,prSDLScreen->format->Amask);
window_screen=SDL_CreateRGBSurface(prSDLScreen->flags,prSDLScreen->w,prSDLScreen->h,prSDLScreen->format->BitsPerPixel,prSDLScreen->format->Rmask,prSDLScreen->format->Gmask,prSDLScreen->format->Bmask,prSDLScreen->format->Amask);
text_screen=SDL_CreateRGBSurface(prSDLScreen->flags,prSDLScreen->w / 2,prSDLScreen->h / 2,prSDLScreen->format->BitsPerPixel,prSDLScreen->format->Rmask,prSDLScreen->format->Gmask,prSDLScreen->format->Bmask,prSDLScreen->format->Amask);
window_screen=SDL_CreateRGBSurface(prSDLScreen->flags,prSDLScreen->w / 2,prSDLScreen->h / 2,prSDLScreen->format->BitsPerPixel,prSDLScreen->format->Rmask,prSDLScreen->format->Gmask,prSDLScreen->format->Bmask,prSDLScreen->format->Amask);

tmp=SDL_LoadBMP(MENU_FILE_TEXT_0);
if (text_screen==NULL || tmp==NULL)
Expand Down Expand Up @@ -615,11 +630,6 @@ void quit_text(void)
window_screen = NULL;
}

void draw_image_pos(SDL_Surface *img, int x, int y) {
SDL_Rect dst = { x, y, 0, 0 };
SDL_BlitSurface(img, NULL, text_screen, &dst);
}

void write_text(int x, int y, const char * str)
{
write_text_pos(x * 7, y * 7, str);
Expand Down
1 change: 1 addition & 0 deletions src/gp2x/menu/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ void draw_image_pos(SDL_Surface *img, int x, int y);
int createScript(int bIcon=0);

void text_flip(void);
void text_flip_with_image(SDL_Surface *img, int x, int y);
void set_joyConf(void);
void loadconfig(int general=0);
int saveconfig(int general=0);
Expand Down
10 changes: 2 additions & 8 deletions src/gp2x/menu/menu_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@ int mainMenu_CPU_speed = 0;
int mainMenu_cpuSpeed = 600;

int mainMenu_joyConf = 0;
#if defined(__PSP2__) || defined(__SWITCH__)
int mainMenu_joyPort = 2; // Default to port 1 on Vita because mouse is always on.
#else
int mainMenu_joyPort = 0; // Both ports
#endif
int mainMenu_autofireRate = 8;
int mainMenu_customAutofireButton = 0;
int mainMenu_showStatus = DEFAULT_STATUSLN;
Expand Down Expand Up @@ -253,11 +249,7 @@ void SetDefaultMenuSettings(int general)

mainMenu_cpuSpeed = 600;
mainMenu_joyConf = 0;
#if defined(__PSP2__) || defined(__SWITCH__)
mainMenu_joyPort = 2; // Default to port 1 on Vita because mouse is always on.
#else
mainMenu_joyPort = 0;
#endif
mainMenu_autofireRate = 8;
mainMenu_customAutofireButton = 0;
mainMenu_showStatus = DEFAULT_STATUSLN;
Expand Down Expand Up @@ -1636,6 +1628,8 @@ void loadconfig(int general)
fscanf(f,"joyconf=%d\n",&joybuffer);
mainMenu_joyConf = (joybuffer & 0x0f);
mainMenu_joyPort = ((joybuffer >> 4) & 0x0f);
if (mainMenu_joyPort == 0)
mainMenu_joyPort = 2;
fscanf(f,"autofireRate=%d\n",&mainMenu_autofireRate);
fscanf(f,"autofire=%d\n",&mainMenu_autofire);
fscanf(f,"customAutofireButton=%d\n",&mainMenu_customAutofireButton);
Expand Down
95 changes: 45 additions & 50 deletions src/gp2x/menu/menu_misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
static int justSwitchedSingleJoycons = 0;
#endif

const char *text_str_misc_separator="--------------------------------------";
const char *text_str_misc_separator="----------------------------------------";
static const char *text_str_misc_title= "Miscellanous";
static const char *text_str_stylus_offset="StylusOffset";
static const char *text_str_0px="0px";
Expand Down Expand Up @@ -121,7 +121,7 @@ static void draw_miscMenu(int c)
r.x=80-64; r.y=0; r.w=110+64+64; r.h=240;

text_draw_background();
text_draw_window(2,2,40,30,text_str_misc_title);
text_draw_window(2,2,42,30,text_str_misc_title);

// MENUMISC_RETURNMAIN
if (menuMisc == MENUMISC_RETURNMAIN && bb)
Expand All @@ -136,103 +136,103 @@ static void draw_miscMenu(int c)
// MENUMISC_CPU
write_text(leftMargin,menuLine,"CPU");
if ((mainMenu_CPU_model==0)&&((menuMisc!=MENUMISC_CPU)||(bb)))
write_text_inv(tabstop1,menuLine,"68000");
write_text_inv(tabstop2,menuLine,"68000");
else
write_text(tabstop1,menuLine,"68000");
write_text(tabstop2,menuLine,"68000");

if ((mainMenu_CPU_model==1)&&((menuMisc!=MENUMISC_CPU)||(bb)))
write_text_inv(tabstop4,menuLine,"68020");
write_text_inv(tabstop5,menuLine,"68020");
else
write_text(tabstop4,menuLine,"68020");
write_text(tabstop5,menuLine,"68020");

// MENUMISC_CHIPSET
menuLine+=2;
write_text(leftMargin,menuLine,"Chipset");

if (((mainMenu_chipset & 0xff)==0)&&((menuMisc!=MENUMISC_CHIPSET)||(bb)))
write_text_inv(tabstop1,menuLine,"OCS");
write_text_inv(tabstop2,menuLine,"OCS");
else
write_text(tabstop1,menuLine,"OCS");
write_text(tabstop2,menuLine,"OCS");

if (((mainMenu_chipset & 0xff)==1)&&((menuMisc!=MENUMISC_CHIPSET)||(bb)))
write_text_inv(tabstop3,menuLine,"ECS");
write_text_inv(tabstop4,menuLine,"ECS");
else
write_text(tabstop3,menuLine,"ECS");
write_text(tabstop4,menuLine,"ECS");

if (((mainMenu_chipset & 0xff)==2)&&((menuMisc!=MENUMISC_CHIPSET)||(bb)))
write_text_inv(tabstop5,menuLine,"AGA");
write_text_inv(tabstop6,menuLine,"AGA");
else
write_text(tabstop5,menuLine,"AGA");
write_text(tabstop6,menuLine,"AGA");

// MENUMISC_KICKSTART
menuLine+=2;
write_text(leftMargin,menuLine,"Kickstart");
if ((kickstart==0)&&((menuMisc!=MENUMISC_KICKSTART)||(bb)))
write_text_inv(tabstop1,menuLine,"1.2");
write_text_inv(tabstop2,menuLine,"1.2");
else
write_text(tabstop1,menuLine,"1.2");
write_text(tabstop2,menuLine,"1.2");

if ((kickstart==1)&&((menuMisc!=MENUMISC_KICKSTART)||(bb)))
write_text_inv(tabstop3,menuLine,"1.3");
write_text_inv(tabstop4,menuLine,"1.3");
else
write_text(tabstop3,menuLine,"1.3");
write_text(tabstop4,menuLine,"1.3");

if ((kickstart==2)&&((menuMisc!=MENUMISC_KICKSTART)||(bb)))
write_text_inv(tabstop5,menuLine,"2.0");
write_text_inv(tabstop6,menuLine,"2.0");
else
write_text(tabstop5,menuLine,"2.0");
write_text(tabstop6,menuLine,"2.0");

if ((kickstart==3)&&((menuMisc!=MENUMISC_KICKSTART)||(bb)))
write_text_inv(tabstop7,menuLine,"3.1");
write_text_inv(tabstop8,menuLine,"3.1");
else
write_text(tabstop7,menuLine,"3.1");
write_text(tabstop8,menuLine,"3.1");

if ((kickstart==4)&&((menuMisc!=MENUMISC_KICKSTART)||(bb)))
write_text_inv(tabstop9,menuLine,"Custom");
write_text_inv(tabstop9+2,menuLine,"Custom");
else
write_text(tabstop9,menuLine,"Custom");
write_text(tabstop9+2,menuLine,"Custom");

// MENUMISC_CPUSPEED
menuLine+=2;
write_text(leftMargin,menuLine,"CPU Speed");
if ((mainMenu_CPU_speed==0)&&((menuMisc!=MENUMISC_CPUSPEED)||(bb)))
write_text_inv(tabstop1,menuLine,"7MHz");
write_text_inv(tabstop2,menuLine,"7MHz");
else
write_text(tabstop1,menuLine,"7MHz");
write_text(tabstop2,menuLine,"7MHz");

if ((mainMenu_CPU_speed==1)&&((menuMisc!=MENUMISC_CPUSPEED)||(bb)))
write_text_inv(tabstop4,menuLine,"14MHz");
write_text_inv(tabstop5,menuLine,"14MHz");
else
write_text(tabstop4,menuLine,"14MHz");
write_text(tabstop5,menuLine,"14MHz");

if ((mainMenu_CPU_speed==2)&&((menuMisc!=MENUMISC_CPUSPEED)||(bb)))
write_text_inv(tabstop7,menuLine,"28MHz");
write_text_inv(tabstop8,menuLine,"28MHz");
else
write_text(tabstop7,menuLine,"28MHz");
write_text(tabstop8,menuLine,"28MHz");

if ((mainMenu_CPU_speed==3)&&((menuMisc!=MENUMISC_CPUSPEED)||(bb)))
write_text_inv(tabstop7+6,menuLine,"56MHz");
write_text_inv(tabstop9+4,menuLine,"56MHz");
else
write_text(tabstop7+6,menuLine,"56MHz");
write_text(tabstop9+4,menuLine,"56MHz");

// MENUMISC_BLITTER
menuLine+=2;
write_text(leftMargin,menuLine,"Blitter");

if (((mainMenu_chipset & 0xff00)!=0x100 && (mainMenu_chipset & 0xff00)!=0x200)&&((menuMisc!=MENUMISC_BLITTER)||(bb)))
write_text_inv(tabstop1,menuLine,"Normal");
write_text_inv(tabstop2,menuLine,"Normal");
else
write_text(tabstop1,menuLine,"Normal");
write_text(tabstop2,menuLine,"Normal");

if (((mainMenu_chipset & 0xff00)==0x100)&&((menuMisc!=MENUMISC_BLITTER)||(bb)))
write_text_inv(tabstop5-2,menuLine,"Immediate");
write_text_inv(tabstop5,menuLine,"Immediate");
else
write_text(tabstop5-2,menuLine,"Immediate");
write_text(tabstop5,menuLine,"Immediate");

if (((mainMenu_chipset & 0xff00)==0x200)&&((menuMisc!=MENUMISC_BLITTER)||(bb)))
write_text_inv(tabstop9,menuLine,"Improved");
write_text_inv(tabstop9+2,menuLine,"Improved");
else
write_text(tabstop9,menuLine,"Improved");
write_text(tabstop9+2,menuLine,"Improved");

// MENUMISC_SPRITECOLLISIONS
menuLine+=2;
Expand Down Expand Up @@ -322,31 +322,26 @@ static void draw_miscMenu(int c)

// MENUMISC_JOYSTICK
menuLine+=2;
write_text(leftMargin,menuLine,"Joystick");
write_text(leftMargin,menuLine,"Controller 1");

if ((mainMenu_joyPort==1)&&((menuMisc!=MENUMISC_JOYSTICK)||(bb)))
write_text_inv(tabstop3-2,menuLine,"Port0");
write_text_inv(tabstop2,menuLine,"Amiga Port0");
else
write_text(tabstop3-2,menuLine,"Port0");
write_text(tabstop2,menuLine,"Amiga Port0");

if ((mainMenu_joyPort==2)&&((menuMisc!=MENUMISC_JOYSTICK)||(bb)))
write_text_inv(tabstop6-2,menuLine,"Port1");
write_text_inv(tabstop9-1,menuLine,"Amiga Port1");
else
write_text(tabstop6-2,menuLine,"Port1");

if ((mainMenu_joyPort==0)&&((menuMisc!=MENUMISC_JOYSTICK)||(bb)))
write_text_inv(tabstop9-1,menuLine,"Both");
else
write_text(tabstop9-1,menuLine,"Both");
write_text(tabstop9-1,menuLine,"Amiga Port1");

// MENUMISC_AUTOFIRERATE
menuLine+=2;
write_text(leftMargin,menuLine,"Autofire Rate");

if ((mainMenu_autofireRate==8)&&((menuMisc!=MENUMISC_AUTOFIRERATE)||(bb)))
write_text_inv(tabstop3-2,menuLine,"Light");
write_text_inv(tabstop2,menuLine,"Light");
else
write_text(tabstop3-2,menuLine,"Light");
write_text(tabstop2,menuLine,"Light");

if ((mainMenu_autofireRate==4)&&((menuMisc!=MENUMISC_AUTOFIRERATE)||(bb)))
write_text_inv(tabstop6-2,menuLine,"Medium");
Expand Down Expand Up @@ -957,7 +952,7 @@ static int key_miscMenu(int *c)
case MENUMISC_JOYSTICK:
if (left)
{
if (mainMenu_joyPort>0)
if (mainMenu_joyPort>1)
mainMenu_joyPort--;
else
mainMenu_joyPort=2;
Expand All @@ -967,7 +962,7 @@ static int key_miscMenu(int *c)
if (mainMenu_joyPort<2)
mainMenu_joyPort++;
else
mainMenu_joyPort=0;
mainMenu_joyPort=1;
}
break;
case MENUMISC_AUTOFIRERATE:
Expand Down

0 comments on commit 5c33048

Please sign in to comment.