Skip to content

Commit

Permalink
Merge pull request #17 from rsn8887/master
Browse files Browse the repository at this point in the history
Vita: - cleaned up menu - added option to choose menu background
  • Loading branch information
Cpasjuste committed Jan 15, 2017
2 parents 9d5e624 + 79b5259 commit 36d6748
Show file tree
Hide file tree
Showing 11 changed files with 131 additions and 78 deletions.
Binary file modified AndroidData/data.zip
100755 → 100644
Binary file not shown.
5 changes: 5 additions & 0 deletions Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ Square = Backspace
Triangle = Toggle Shift

CHANGELOG:
1.48

- cleaned up display menu
- added option to choose menu background

1.47

- new menu background
Expand Down
Binary file modified psp2data/data/background_static.bmp
Binary file not shown.
43 changes: 32 additions & 11 deletions src/gp2x/menu/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ typedef struct private_hwdata {
#endif //PRIVATE_HWDATA
#endif

extern int mainMenu_background;
extern int bReloadKickstart;

#ifdef USE_GUICHAN
extern int mainMenu_displayHires;
extern int visibleAreaWidth;
Expand All @@ -47,7 +49,7 @@ SDL_Surface *current_screenshot = NULL;
#else
#define VIDEO_FLAGS VIDEO_FLAGS_INIT | SDL_DOUBLEBUF
#endif
SDL_Surface *text_screen=NULL, *text_image, *text_background, *text_window_background, *window_screen;
SDL_Surface *text_screen=NULL, *text_image, *text_background_0, *text_background_1, *text_window_background, *window_screen;

static Uint32 menu_inv_color=0, menu_win0_color=0, menu_win1_color=0;
static Uint32 menu_barra0_color=0, menu_barra1_color=0;
Expand Down Expand Up @@ -288,15 +290,22 @@ void text_draw_background()
static int pos_y=12345678;
SDL_Rect r;
int i,j;
int w=text_screen->w+text_background->w-1;
int h=text_screen->h+text_background->h-1;
#ifdef __PSP2__
SDL_Surface *text_background;

if (mainMenu_background==0)
{
text_background = text_background_0;
r.x=0;
r.y=0;
r.w=text_background->w;
r.h=text_background->h;
SDL_BlitSurface(text_background,NULL,text_screen,&r);
#else
}
else
{
text_background = text_background_1;
int w=text_screen->w+text_background->w-1;
int h=text_screen->h+text_background->h-1;
if (menu_moving)
{
if (pos_x>=0) pos_x=-text_screen->w;
Expand All @@ -314,7 +323,7 @@ void text_draw_background()
r.h=text_background->h;
SDL_BlitSurface(text_background,NULL,text_screen,&r);
}
#endif
};
if (menu_moving)
update_window_color();
}
Expand Down Expand Up @@ -437,13 +446,23 @@ void init_text(int splash)
if (text_image==NULL)
exit(-2);
SDL_SetColorKey(text_image,(SDL_SRCCOLORKEY | SDL_RLEACCEL),SDL_MapRGB(text_image -> format, 0, 0, 0));
tmp=SDL_LoadBMP(MENU_FILE_BACKGROUND);

tmp=SDL_LoadBMP(MENU_FILE_BACKGROUND_0);
if (tmp==NULL)
exit(-3);
text_background_0=SDL_DisplayFormat(tmp);
SDL_FreeSurface(tmp);
if (text_background_0==NULL)
exit(-3);

tmp=SDL_LoadBMP(MENU_FILE_BACKGROUND_1);
if (tmp==NULL)
exit(-3);
text_background=SDL_DisplayFormat(tmp);
text_background_1=SDL_DisplayFormat(tmp);
SDL_FreeSurface(tmp);
if (text_background==NULL)
if (text_background_1==NULL)
exit(-3);

tmp=SDL_LoadBMP(MENU_FILE_WINDOW);
if (tmp==NULL)
exit(-4);
Expand Down Expand Up @@ -523,8 +542,10 @@ void quit_text(void)
{
SDL_FreeSurface(text_image);
text_image = NULL;
SDL_FreeSurface(text_background);
text_background = NULL;
SDL_FreeSurface(text_background_0);
SDL_FreeSurface(text_background_1);
text_background_0 = NULL;
text_background_1 = NULL;
SDL_FreeSurface(text_window_background);
text_window_background = NULL;
SDL_FreeSurface(text_screen);
Expand Down
7 changes: 2 additions & 5 deletions src/gp2x/menu/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
extern SDL_Surface *prSDLScreen;

#define MENU_FILE_SPLASH DATA_PREFIX "gp2xsplash.bmp"
#ifdef __PSP2__
#define MENU_FILE_BACKGROUND DATA_PREFIX "background_static.bmp"
#else
#define MENU_FILE_BACKGROUND DATA_PREFIX "background.bmp"
#endif
#define MENU_FILE_BACKGROUND_0 DATA_PREFIX "background_static.bmp"
#define MENU_FILE_BACKGROUND_1 DATA_PREFIX "background.bmp"
#define MENU_FILE_WINDOW DATA_PREFIX "window.bmp"
#define MENU_FILE_TEXT DATA_PREFIX "text.bmp"
#define MENU_DIR_DEFAULT "."
Expand Down
5 changes: 5 additions & 0 deletions src/gp2x/menu/menu_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ int mainMenu_joyPort = 0; // Both ports
int mainMenu_autofireRate = 8;
int mainMenu_customAutofireButton = 0;
int mainMenu_showStatus = DEFAULT_STATUSLN;
int mainMenu_background = 0;
int mainMenu_mouseMultiplier = DEFAULT_MOUSEMULTIPLIER;
int mainMenu_mouseEmulation = 1;
int mainMenu_stylusOffset = 0;
Expand Down Expand Up @@ -239,6 +240,7 @@ void SetDefaultMenuSettings(int general)
mainMenu_autofireRate = 8;
mainMenu_customAutofireButton = 0;
mainMenu_showStatus = DEFAULT_STATUSLN;
mainMenu_background = 0;
mainMenu_mouseMultiplier = DEFAULT_MOUSEMULTIPLIER;
mainMenu_mouseEmulation = 1;
mainMenu_stylusOffset = 0;
Expand Down Expand Up @@ -947,6 +949,8 @@ int saveconfig(int general)
#endif
snprintf((char*)buffer, 255, "showstatus=%d\n",mainMenu_showStatus);
fputs(buffer,f);
snprintf((char*)buffer, 255, "background=%d\n",mainMenu_background);
fputs(buffer,f);
snprintf((char*)buffer, 255, "mousemultiplier=%d\n",mainMenu_mouseMultiplier);
fputs(buffer,f);
snprintf((char*)buffer, 255, "mouseemulation=%d\n",mainMenu_mouseEmulation);
Expand Down Expand Up @@ -1346,6 +1350,7 @@ void loadconfig(int general)
fscanf(f,"deadzone=%d\n",&mainMenu_deadZone);
#endif
fscanf(f,"showstatus=%d\n",&mainMenu_showStatus);
fscanf(f,"background=%d\n",&mainMenu_background);
fscanf(f,"mousemultiplier=%d\n",&mainMenu_mouseMultiplier );
fscanf(f,"mouseemulation=%d\n",&mainMenu_mouseEmulation );
#if defined(PANDORA) || defined(ANDROIDSDL)
Expand Down
1 change: 1 addition & 0 deletions src/gp2x/menu/menu_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ extern int mainMenu_joyPort;
extern int mainMenu_autofireRate;
extern int mainMenu_customAutofireButton;
extern int mainMenu_showStatus;
extern int mainMenu_background;
extern int mainMenu_mouseMultiplier;
extern int mainMenu_mouseEmulation;
extern int mainMenu_stylusOffset;
Expand Down
22 changes: 11 additions & 11 deletions src/gp2x/menu/menu_controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ static void draw_controlsMenu(int c)
menuLine+=2;

// MENUCONTROLS_CUSTOM_CONTROLLER_NR
write_text(leftMargin,menuLine,"Edit Map For Controller");
write_text(leftMargin,menuLine,"Edit Map for Controller");
if ((mainMenu_custom_currentlyEditingControllerNr==0)&&((menuControls!=MENUCONTROLS_CUSTOM_CONTROLLER_NR)||(bb)))
write_text_inv(tabstop6,menuLine,"1");
else
Expand Down Expand Up @@ -473,31 +473,31 @@ static void draw_controlsMenu(int c)
{
// MENUCONTROLS_UP
menuLine+=2;
write_text(leftMargin,menuLine," up");
write_text(leftMargin,menuLine," Up");
getMapping(mainMenu_custom_up[ctrlNr]);
if ((menuControls!=MENUCONTROLS_UP)||(bb))
write_text_inv(tabstop1-4,menuLine,mapping);
else
write_text(tabstop1-4,menuLine,mapping);
// MENUCONTROLS_DOWN
menuLine+=2;
write_text(leftMargin,menuLine," down");
write_text(leftMargin,menuLine," Down");
getMapping(mainMenu_custom_down[ctrlNr]);
if ((menuControls!=MENUCONTROLS_DOWN)||(bb))
write_text_inv(tabstop1-4,menuLine,mapping);
else
write_text(tabstop1-4,menuLine,mapping);
// MENUCONTROLS_LEFT
menuLine+=2;
write_text(leftMargin,menuLine," left");
write_text(leftMargin,menuLine," Left");
getMapping(mainMenu_custom_left[ctrlNr]);
if ((menuControls!=MENUCONTROLS_LEFT)||(bb))
write_text_inv(tabstop1-4,menuLine,mapping);
else
write_text(tabstop1-4,menuLine,mapping);
// MENUCONTROLS_RIGHT
menuLine+=2;
write_text(leftMargin,menuLine," right");
write_text(leftMargin,menuLine," Right");
getMapping(mainMenu_custom_right[ctrlNr]);
if ((menuControls!=MENUCONTROLS_RIGHT)||(bb))
write_text_inv(tabstop1-4,menuLine,mapping);
Expand All @@ -508,7 +508,7 @@ static void draw_controlsMenu(int c)
// MENUCONTROLS_Y
menuLine+=3;
#ifdef __PSP2__
write_text(leftMargin,menuLine,"(Triangle)");
write_text(leftMargin,menuLine,"Triangle");
#else
write_text(leftMargin,menuLine," (Y)");
#endif
Expand All @@ -521,7 +521,7 @@ static void draw_controlsMenu(int c)
// MENUCONTROLS_X
menuLine+=2;
#ifdef __PSP2__
write_text(leftMargin,menuLine,"(Cross)");
write_text(leftMargin,menuLine,"Cross");
#else
write_text(leftMargin,menuLine," (X)");
#endif
Expand All @@ -534,7 +534,7 @@ static void draw_controlsMenu(int c)
// MENUCONTROLS_A
menuLine+=2;
#ifdef __PSP2__
write_text(leftMargin,menuLine,"(Square)");
write_text(leftMargin,menuLine,"Square");
#else
write_text(leftMargin,menuLine," (A)");
#endif
Expand All @@ -547,7 +547,7 @@ static void draw_controlsMenu(int c)
// MENUCONTROLS_B
menuLine+=2;
#ifdef __PSP2__
write_text(leftMargin,menuLine,"(Circle)");
write_text(leftMargin,menuLine,"Circle");
#else
write_text(leftMargin,menuLine," (B)");
#endif
Expand All @@ -560,15 +560,15 @@ static void draw_controlsMenu(int c)

// MENUCONTROLS_L
menuLine+=3;
write_text(leftMargin,menuLine," (L)");
write_text(leftMargin,menuLine," L");
getMapping(mainMenu_custom_L[ctrlNr]);
if ((menuControls!=MENUCONTROLS_L)||(bb))
write_text_inv(tabstop1-4,menuLine,mapping);
else
write_text(tabstop1-4,menuLine,mapping);
// MENUCONTROLS_R
menuLine+=2;
write_text(leftMargin,menuLine," (R)");
write_text(leftMargin,menuLine," R");
getMapping(mainMenu_custom_R[ctrlNr]);
if ((menuControls!=MENUCONTROLS_R)||(bb))
write_text_inv(tabstop1-4,menuLine,mapping);
Expand Down

0 comments on commit 36d6748

Please sign in to comment.