Skip to content

Commit

Permalink
Vita: - hires support (e.g. 640*256), switchable in display menu
Browse files Browse the repository at this point in the history
  • Loading branch information
rsn8887 committed Dec 29, 2016
1 parent f78cdea commit 6ade6ee
Show file tree
Hide file tree
Showing 12 changed files with 198 additions and 40 deletions.
44 changes: 42 additions & 2 deletions src/gp2x/menu/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@

#include <SDL_gp2x.h>

#ifdef __PSP2__
#include "psp2_shader.h"
#include "vita2d.h"
extern PSP2Shader *shader;
extern int mainMenu_shader;
typedef struct private_hwdata {
vita2d_texture *texture;
SDL_Rect dst;
} private_hwdata;
#endif

extern int bReloadKickstart;
#ifdef USE_GUICHAN
extern int mainMenu_displayHires;
Expand Down Expand Up @@ -192,6 +203,7 @@ int save_thumb(int code,char *path)

void menu_raise(void)
{
#ifndef __PSP2__
int i;
for(i=80;i>=0;i-=16)
{
Expand All @@ -203,10 +215,16 @@ void menu_raise(void)
text_flip();
SDL_Delay(10);
}
#else
text_draw_background();
text_flip();
SDL_Delay(10);
#endif
}

void menu_unraise(void)
{
#ifndef __PSP2__
int i;
for(i=0;i<=80;i+=16)
{
Expand All @@ -218,6 +236,11 @@ void menu_unraise(void)
text_flip();
SDL_Delay(10);
}
#else
text_draw_background();
text_flip();
SDL_Delay(10);
#endif
}

static void update_window_color(void)
Expand Down Expand Up @@ -342,9 +365,19 @@ void init_text(int splash)
#ifdef __PSP2__
//Display menu always in 320*240 on Vita
if(prSDLScreen != NULL) {
SDL_FillRect(prSDLScreen,NULL,0);
SDL_Flip(prSDLScreen);
for (int i=0; i<10; i++)
{
SDL_FillRect(prSDLScreen,NULL,0);
SDL_Flip(prSDLScreen);
}
private_hwdata *myhwdata=prSDLScreen->hwdata;
vita2d_wait_rendering_done();
vita2d_free_texture(prSDLScreen->hwdata->texture);
SDL_free(prSDLScreen->hwdata);
prSDLScreen->hwdata = NULL;
prSDLScreen->pixels = NULL;
SDL_FreeSurface(prSDLScreen);
prSDLScreen = NULL;
};
prSDLScreen = SDL_SetVideoMode(320, 240, 16, SDL_HWSURFACE|SDL_DOUBLEBUF);
printf("init_text: SDL_SetVideoMode(%i, %i, 16)\n", 320, 240);
Expand All @@ -362,6 +395,11 @@ void init_text(int splash)
//to compile
SDL_SetVideoModeBilinear(0);

// if(shader != NULL) {
// delete(shader);
// shader = NULL;
// }

#elif PANDORA
setenv("SDL_OMAP_LAYER_SIZE","640x480",1);
setenv("SDL_OMAP_BORDER_CUT","0,0,0,30",1);
Expand Down Expand Up @@ -460,7 +498,9 @@ void init_text(int splash)
}
else
{
#ifndef __PSP2__
SDL_FillRect(text_screen,NULL,0xFFFFFFFF);
#endif
text_flip();
uae4all_resume_music();
}
Expand Down
14 changes: 7 additions & 7 deletions src/gp2x/menu/menu_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,13 +1185,13 @@ void loadconfig(int general)
//so open it with 320*270. Even 800*600 would work,
//but only a width of 320 is supported by the current
//emulator drawing routines
int visibleAreaWidth_old = visibleAreaWidth;
int mainMenu_displayedLines_old = mainMenu_displayedLines;
visibleAreaWidth = 320;
mainMenu_displayedLines = 270;
update_display();
visibleAreaWidth=visibleAreaWidth_old;
mainMenu_displayedLines = mainMenu_displayedLines_old;
int visibleAreaWidth_old = visibleAreaWidth;
int mainMenu_displayedLines_old = mainMenu_displayedLines;
visibleAreaWidth = 320;
mainMenu_displayedLines = 200;
update_display();
visibleAreaWidth=visibleAreaWidth_old;
mainMenu_displayedLines = mainMenu_displayedLines_old;
}
#endif

Expand Down
5 changes: 4 additions & 1 deletion src/gp2x/menu/menu_controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -893,24 +893,27 @@ static void raise_controlsMenu()

text_draw_background();
text_flip();
#ifndef __PSP2__
for(i=0;i<10;i++)
{
text_draw_background();
text_draw_window(80-64,(10-i)*24,160+64+64,220,text_str_controls_title);
text_flip();
}
#endif
}

static void unraise_controlsMenu()
{
int i;

#ifndef __PSP2__
for(i=9;i>=0;i--)
{
text_draw_background();
text_draw_window(80-64,(10-i)*24,160+64+64,220,text_str_controls_title);
text_flip();
}
#endif
text_draw_background();
text_flip();
}
Expand Down
5 changes: 4 additions & 1 deletion src/gp2x/menu/menu_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,24 +614,27 @@ static void raise_displayMenu()

text_draw_background();
text_flip();
#ifndef __PSP2__
for(i=0;i<10;i++)
{
text_draw_background();
text_draw_window(80-64,(10-i)*24,160+64+64,220,text_str_display_title);
text_flip();
}
#endif
}

static void unraise_displayMenu()
{
int i;

#ifndef __PSP2__
for(i=9;i>=0;i--)
{
text_draw_background();
text_draw_window(80-64,(10-i)*24,160+64+64,220,text_str_display_title);
text_flip();
}
#endif
text_draw_background();
text_flip();
}
Expand Down
4 changes: 4 additions & 0 deletions src/gp2x/menu/menu_fileinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,28 @@ static void raise_fileinfoMenu()

text_draw_background();
text_flip();
#ifndef __PSP2__
for(i=0;i<10;i++)
{
text_draw_background();
text_draw_window(80-64,(10-i)*24,160+64+64,220,text_str_fileinfo_title);
text_flip();
}
#endif
}

static void unraise_fileinfoMenu()
{
int i;

#ifndef __PSP2__
for(i=9;i>=0;i--)
{
text_draw_background();
text_draw_window(80-64,(10-i)*24,160+64+64,220,text_str_fileinfo_title);
text_flip();
}
#endif
text_draw_background();
text_flip();
}
Expand Down
29 changes: 25 additions & 4 deletions src/gp2x/menu/menu_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@

#ifdef __PSP2__
#include "psp2_shader.h"
#include "vita2d.h"
PSP2Shader *shader = NULL;
extern int mainMenu_shader;
typedef struct private_hwdata {
vita2d_texture *texture;
SDL_Rect dst;
} private_hwdata;
#endif

extern int screenWidth;
Expand Down Expand Up @@ -143,8 +148,18 @@ void update_display() {

#ifdef __PSP2__
if (prSDLScreen != NULL) {
black_screen_now();
SDL_FreeSurface(prSDLScreen);
for (int i=0; i<10; i++)
{
SDL_FillRect(prSDLScreen,NULL,0);
SDL_Flip(prSDLScreen);
}
vita2d_wait_rendering_done();
vita2d_free_texture(prSDLScreen->hwdata->texture);
SDL_free(prSDLScreen->hwdata);
prSDLScreen->hwdata = NULL;
prSDLScreen->pixels = NULL;
SDL_FreeSurface(prSDLScreen);
prSDLScreen = NULL;
}

prSDLScreen = SDL_SetVideoMode(visibleAreaWidth, mainMenu_displayedLines, 16, SDL_HWSURFACE | SDL_DOUBLEBUF);
Expand All @@ -159,7 +174,10 @@ void update_display() {
if (mainMenu_shader != 0)
{
sh = 544;
sw = ((float)visibleAreaWidth*((float)544/(float)mainMenu_displayedLines));
if (mainMenu_displayHires)
sw = (0.5f*(float)visibleAreaWidth*((float)544/(float)mainMenu_displayedLines));
else
sw = ((float)visibleAreaWidth*((float)544/(float)mainMenu_displayedLines));
x = (960 - sw) / 2;
y = (544 - sh) / 2;

Expand All @@ -172,7 +190,10 @@ void update_display() {
else //otherwise do regular integer 2* scaling without filtering to ensure good picture quality
{
sh = (float) (2 * mainMenu_displayedLines);
sw = (float) (2 * visibleAreaWidth);
if (mainMenu_displayHires)
sw = (float) (1 * visibleAreaWidth);
else
sw = (float) (2 * visibleAreaWidth);
x = (960 - sw) / 2;
y = (544 - sh) / 2;
SDL_SetVideoModeScaling(x, y, sw, sh);
Expand Down
5 changes: 4 additions & 1 deletion src/gp2x/menu/menu_load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,24 +410,27 @@ static void raise_loadMenu()

text_draw_background();
text_flip();
#ifndef __PSP2__
for(i=0;i<10;i++)
{
text_draw_background();
text_draw_window(80-64,(10-i)*24,160+64+64,220,text_str_load_title);
text_flip();
}
#endif
}

static void unraise_loadMenu()
{
int i;

#ifndef __PSP2__
for(i=9;i>=0;i--)
{
text_draw_background();
text_draw_window(80-64,(10-i)*24,160+64+64,220,text_str_load_title);
text_flip();
}
#endif
text_draw_background();
text_flip();
}
Expand Down
6 changes: 4 additions & 2 deletions src/gp2x/menu/menu_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ static void draw_mainMenu(int c)

text_draw_background();
text_draw_window(leftMargin-1,menuLine-1,34,40,text_str_title);

// 1
if ((c==0)&&(bb))
write_text_inv(leftMargin,menuLine,text_str_df0);
Expand Down Expand Up @@ -755,24 +754,27 @@ static void raise_mainMenu()
int i;
text_draw_background();
text_flip();
#ifndef __PSP2__
for(i=0;i<10;i++)
{
text_draw_background();
text_draw_window(40,(10-i)*24,260,200,text_str_title);
text_flip();
}
#endif
}

static void unraise_mainMenu()
{
int i;

#ifndef __PSP2__
for(i=9;i>=0;i--)
{
text_draw_background();
text_draw_window(40,(10-i)*24,260,200,text_str_title);
text_flip();
}
#endif
text_draw_background();
text_flip();
}
Expand Down
5 changes: 4 additions & 1 deletion src/gp2x/menu/menu_memory_disk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,24 +480,27 @@ static void raise_memDiskMenu()

text_draw_background();
text_flip();
#ifndef __PSP2__
for(i=0;i<10;i++)
{
text_draw_background();
text_draw_window(80-64,(10-i)*24,160+64+64,220,text_str_memdisk_title);
text_flip();
}
#endif
}

static void unraise_memDiskMenu()
{
int i;

#ifndef __PSP2__
for(i=9;i>=0;i--)
{
text_draw_background();
text_draw_window(80-64,(10-i)*24,160+64+64,220,text_str_memdisk_title);
text_flip();
}
#endif
text_draw_background();
text_flip();
}
Expand Down
5 changes: 4 additions & 1 deletion src/gp2x/menu/menu_misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -741,24 +741,27 @@ static void raise_miscMenu()

text_draw_background();
text_flip();
#ifndef __PSP2__
for(i=0;i<10;i++)
{
text_draw_background();
text_draw_window(80-64,(10-i)*24,160+64+64,220,text_str_misc_title);
text_flip();
}
#endif
}

static void unraise_miscMenu()
{
int i;

#ifndef __PSP2__
for(i=9;i>=0;i--)
{
text_draw_background();
text_draw_window(80-64,(10-i)*24,160+64+64,220,text_str_misc_title);
text_flip();
}
#endif
text_draw_background();
text_flip();
}
Expand Down

0 comments on commit 6ade6ee

Please sign in to comment.