diff --git a/src/gp2x/menu/menu.cpp b/src/gp2x/menu/menu.cpp index 967258b..03c01b7 100755 --- a/src/gp2x/menu/menu.cpp +++ b/src/gp2x/menu/menu.cpp @@ -339,6 +339,31 @@ void init_kickstart() 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); + SDL_FreeSurface(prSDLScreen); + }; + prSDLScreen = SDL_SetVideoMode(320, 240, 16, SDL_HWSURFACE|SDL_DOUBLEBUF); + + float sh = (float) 480; + float sw = (float)320*((float)480/(float)240); + int x = (960-sw)/2; + int y = 0; + + SDL_SetVideoModeScaling(x, y, sw, sh); + printf("SDL_SetVideoModeScaling(%i, %i, %i, %i)\n", x, y, sw, sh); +#elif PANDORA + setenv("SDL_OMAP_LAYER_SIZE","640x480",1); + setenv("SDL_OMAP_BORDER_CUT","0,0,0,30",1); + prSDLScreen = SDL_SetVideoMode(320, 270, 16, SDL_SWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF); +#else + prSDLScreen = SDL_SetVideoMode(320, 240, 16, SDL_SWSURFACE|SDL_FULLSCREEN); +#endif + + char fname[256]; SDL_Surface *tmp; @@ -347,6 +372,7 @@ void init_text(int splash) { 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); + tmp=SDL_LoadBMP(MENU_FILE_TEXT); if (text_screen==NULL || tmp==NULL) exit(-1); @@ -445,6 +471,8 @@ void quit_text(void) text_window_background = NULL; SDL_FreeSurface(text_screen); text_screen = NULL; + SDL_FreeSurface(window_screen); + window_screen = NULL; } void write_text_pos(int x, int y, char * str) diff --git a/src/gp2x/menu/menu_config.cpp b/src/gp2x/menu/menu_config.cpp index 740c4b9..d08ba4b 100755 --- a/src/gp2x/menu/menu_config.cpp +++ b/src/gp2x/menu/menu_config.cpp @@ -1021,6 +1021,19 @@ int saveconfig(int general) void loadconfig(int general) { +#ifdef __PSP2__ +//first time opening the screen on Vita, somehow this sets the max possible resolution, +//so open it with 320*270. Even 800*600 would work, but only a width of 320 is supported by the current +//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; +#endif + char path[300]; if(general == 1) { diff --git a/src/gp2x/menu/menu_helper.cpp b/src/gp2x/menu/menu_helper.cpp index 168e97c..f7a44a5 100755 --- a/src/gp2x/menu/menu_helper.cpp +++ b/src/gp2x/menu/menu_helper.cpp @@ -40,7 +40,6 @@ int saveAdfDir() return 1; } - void extractFileName(char * str,char *buffer) { char *p=str+strlen(str)-1; @@ -146,10 +145,13 @@ void update_display() } prSDLScreen = SDL_SetVideoMode(visibleAreaWidth, mainMenu_displayedLines, 16, SDL_HWSURFACE|SDL_DOUBLEBUF); printf("SDL_SetVideoMode(%i, %i, 16)\n", visibleAreaWidth, mainMenu_displayedLines); -// int sh = 540; - int sh = 2 * (int) mainMenu_displayedLines; -// int sw = (int)((float)visibleAreaWidth*((float)540/(float)mainMenu_displayedLines)); - int sw = 2 * (int) visibleAreaWidth; + //the commented out scaling fills the screen better + //but looks horrible, due to the current lack of a good shader sharp bilinear scaler + //so stick with simple 2* point filtering for now. +// float sh = 544; + float sh = (float) (2 * mainMenu_displayedLines); +// float sw = ((float)visibleAreaWidth*((float)544/(float)mainMenu_displayedLines)); + float sw = (float) (2 * visibleAreaWidth); int x = (960-sw)/2; int y = 0; SDL_SetVideoModeScaling(x, 0, sw, sh); diff --git a/src/gp2x/menu/menu_main.cpp b/src/gp2x/menu/menu_main.cpp index f466567..1060e81 100755 --- a/src/gp2x/menu/menu_main.cpp +++ b/src/gp2x/menu/menu_main.cpp @@ -90,8 +90,6 @@ int current_drive=0; int lastCpuSpeed=600; int ntsc=0; -extern SDL_Surface *prSDLScreen; - static void adjustToWindow(char *str, char* buffer) { if (strlen(str)<33) return; @@ -748,33 +746,8 @@ SDL_ANDROID_SetScreenKeyboardShown(1); } static void raise_mainMenu() -{ -#ifdef __PSP2__ - if(prSDLScreen != NULL) { - SDL_FillRect(prSDLScreen,NULL,0); - SDL_Flip(prSDLScreen); - SDL_FreeSurface(prSDLScreen); - } - - //for some reason the max texture size is 320 by 240 - prSDLScreen = SDL_SetVideoMode(320, 240, 16, SDL_HWSURFACE|SDL_DOUBLEBUF); - int sh = 480; - int sw = (float)320*((float)480/(float)240); - int x = (960-sw)/2; - int y = 0; - SDL_SetVideoModeScaling(x, y, sw, sh); - printf("SDL_SetVideoModeScaling(%i, %i, %i, %i)\n", x, y, sw, sh); -#elif PANDORA - setenv("SDL_OMAP_LAYER_SIZE","640x480",1); - setenv("SDL_OMAP_BORDER_CUT","0,0,0,30",1); - prSDLScreen = SDL_SetVideoMode(320, 270, 16, SDL_SWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF); -#else - prSDLScreen = SDL_SetVideoMode(320, 240, 16, SDL_SWSURFACE|SDL_FULLSCREEN); -#endif - - +{ int i; - text_draw_background(); text_flip(); for(i=0;i<10;i++) diff --git a/src/main.cpp b/src/main.cpp index 0f8b72a..e1fdd52 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -250,7 +250,8 @@ void real_main (int argc, char **argv) #endif // Set everthing to default and clear HD settings SetDefaultMenuSettings(1); - loadconfig (1); + + loadconfig (1); if (! graphics_setup ()) { exit (1); }