2008-08-07 14:26:07 +02:00
|
|
|
/****************************************************************************
|
2008-12-11 18:38:29 +01:00
|
|
|
* menu.c
|
2008-08-07 14:26:07 +02:00
|
|
|
*
|
2008-12-11 18:38:29 +01:00
|
|
|
* Genesis Plus GX menu
|
|
|
|
*
|
2009-03-31 09:11:25 +02:00
|
|
|
* code by Eke-Eke (march 2009)
|
2008-08-07 14:26:07 +02:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#include "shared.h"
|
|
|
|
#include "dvd.h"
|
|
|
|
#include "font.h"
|
2008-12-11 18:38:29 +01:00
|
|
|
#include "file_dvd.h"
|
|
|
|
#include "file_fat.h"
|
2008-12-14 13:38:52 +01:00
|
|
|
#include "filesel.h"
|
2008-08-07 14:26:07 +02:00
|
|
|
|
2009-03-15 20:11:01 +01:00
|
|
|
#include "Banner_main.h"
|
2009-02-22 20:57:41 +01:00
|
|
|
#include "Banner_bottom.h"
|
|
|
|
#include "Banner_top.h"
|
|
|
|
#include "Background_main.h"
|
2009-04-07 01:01:19 +02:00
|
|
|
#include "Background_overlay.h"
|
2009-04-06 19:26:32 +02:00
|
|
|
#include "Frame_s1.h"
|
|
|
|
#include "Frame_s2.h"
|
2009-04-07 18:05:16 +02:00
|
|
|
#include "Frame_title.h"
|
2009-03-15 20:11:01 +01:00
|
|
|
|
2009-04-07 18:05:16 +02:00
|
|
|
#include "Main_logo.h"
|
2009-02-22 20:57:41 +01:00
|
|
|
#include "Main_play.h"
|
|
|
|
#include "Main_load.h"
|
|
|
|
#include "Main_options.h"
|
|
|
|
#include "Main_file.h"
|
|
|
|
#include "Main_reset.h"
|
|
|
|
#include "Main_info.h"
|
2009-03-15 20:11:01 +01:00
|
|
|
|
|
|
|
#include "Option_ctrl.h"
|
|
|
|
#include "Option_ggenie.h"
|
|
|
|
#include "Option_sound.h"
|
|
|
|
#include "Option_video.h"
|
|
|
|
#include "Option_system.h"
|
|
|
|
|
|
|
|
#include "Load_recent.h"
|
|
|
|
#include "Load_sd.h"
|
|
|
|
#include "Load_dvd.h"
|
|
|
|
|
2009-03-22 13:23:30 +01:00
|
|
|
#include "Button_text.h"
|
|
|
|
#include "Button_text_over.h"
|
|
|
|
#include "Button_icon.h"
|
|
|
|
#include "Button_icon_over.h"
|
|
|
|
#include "Button_up.h"
|
|
|
|
#include "Button_down.h"
|
2009-03-29 20:56:36 +02:00
|
|
|
#include "Button_up_over.h"
|
|
|
|
#include "Button_down_over.h"
|
2009-03-15 20:11:01 +01:00
|
|
|
|
|
|
|
#ifdef HW_RVL
|
2009-03-29 20:56:36 +02:00
|
|
|
#include "Load_usb.h"
|
2009-03-15 20:11:01 +01:00
|
|
|
#include "Key_A_wii.h"
|
|
|
|
#include "Key_B_wii.h"
|
2009-04-13 19:29:09 +02:00
|
|
|
#include "Key_home.h"
|
2009-03-29 20:56:36 +02:00
|
|
|
#include "generic_point.h"
|
2009-03-30 22:36:04 +02:00
|
|
|
#include "generic_openhand.h"
|
2009-03-15 20:11:01 +01:00
|
|
|
#else
|
|
|
|
#include "Key_A_gcn.h"
|
|
|
|
#include "Key_B_gcn.h"
|
2009-04-13 19:29:09 +02:00
|
|
|
#include "Key_trigger_Z.h"
|
2009-03-15 20:11:01 +01:00
|
|
|
#endif
|
2009-02-22 20:57:41 +01:00
|
|
|
|
2009-04-05 20:20:43 +02:00
|
|
|
#include "button_select.h"
|
|
|
|
#include "button_over.h"
|
|
|
|
|
2008-08-07 14:26:07 +02:00
|
|
|
#ifdef HW_RVL
|
|
|
|
#include <wiiuse/wpad.h>
|
2008-08-20 22:25:17 +02:00
|
|
|
#include <di/di.h>
|
2008-08-07 14:26:07 +02:00
|
|
|
#endif
|
|
|
|
|
2009-04-05 20:20:43 +02:00
|
|
|
#include <asndlib.h>
|
|
|
|
|
2009-03-15 20:11:01 +01:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* Generic GUI structures */
|
|
|
|
/*****************************************************************************/
|
2009-02-22 20:57:41 +01:00
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* Controller inputs structure */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
u16 keys;
|
|
|
|
#ifdef HW_RVL
|
|
|
|
struct ir_t ir;
|
2009-03-30 09:05:34 +02:00
|
|
|
#endif
|
2009-03-29 20:56:36 +02:00
|
|
|
} gui_input;
|
|
|
|
|
2009-03-15 20:11:01 +01:00
|
|
|
/* Item descriptor*/
|
2009-02-22 20:57:41 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
2009-03-29 20:56:36 +02:00
|
|
|
png_texture *texture; /* temporary texture data */
|
|
|
|
const u8 *data; /* pointer to png image data (items icon only) */
|
2009-03-31 09:11:25 +02:00
|
|
|
char text[64]; /* item string (items list only) */
|
|
|
|
char comment[64]; /* item comment */
|
2009-03-29 20:56:36 +02:00
|
|
|
u16 x; /* button image or text X position (upper left corner) */
|
|
|
|
u16 y; /* button image or text Y position (upper left corner) */
|
|
|
|
u16 w; /* button image or text width */
|
|
|
|
u16 h; /* button image or text height */
|
2009-02-22 20:57:41 +01:00
|
|
|
} gui_item;
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* Button descriptor */
|
2009-02-22 20:57:41 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
2009-03-29 20:56:36 +02:00
|
|
|
png_texture *texture[2]; /* temporary texture datas */
|
|
|
|
const u8 *image[2]; /* pointer to png image datas (default) */
|
|
|
|
} butn_data;
|
|
|
|
|
|
|
|
/* Button descriptor */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
butn_data *data; /* pointer to button image/texture data */
|
|
|
|
u16 x; /* button image X position (upper left corner) */
|
|
|
|
u16 y; /* button image Y position (upper left corner) */
|
|
|
|
u16 w; /* button image pixels width */
|
|
|
|
u16 h; /* button image pixels height */
|
2009-02-22 20:57:41 +01:00
|
|
|
} gui_butn;
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* Image descriptor */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
png_texture *texture; /* temporary texture data */
|
|
|
|
const u8 *data; /* pointer to png image data */
|
|
|
|
u16 x; /* button image or text X position (upper left corner) */
|
|
|
|
u16 y; /* button image or text Y position (upper left corner) */
|
|
|
|
u16 w; /* button image or text width */
|
|
|
|
u16 h; /* button image or text height */
|
|
|
|
} gui_image;
|
2009-03-15 20:11:01 +01:00
|
|
|
|
|
|
|
/* Menu descriptor */
|
|
|
|
typedef struct
|
|
|
|
{
|
2009-03-31 09:11:25 +02:00
|
|
|
char title[64]; /* menu title */
|
2009-03-29 20:56:36 +02:00
|
|
|
s8 selected; /* index of selected item */
|
|
|
|
u8 offset; /* items list offset */
|
|
|
|
u8 max_items; /* total number of items */
|
|
|
|
u8 max_buttons; /* total number of buttons (not necessary identical) */
|
2009-03-30 15:08:01 +02:00
|
|
|
u8 shift; /* number of items by line */
|
2009-03-29 20:56:36 +02:00
|
|
|
gui_item *items; /* menu items table */
|
|
|
|
gui_butn *buttons; /* menu buttons table */
|
2009-04-06 19:26:32 +02:00
|
|
|
gui_image *overlay; /* overlay image */
|
2009-03-29 20:56:36 +02:00
|
|
|
gui_image *background; /* background image */
|
|
|
|
gui_image *logo; /* logo image */
|
2009-04-07 01:01:19 +02:00
|
|
|
gui_image *frames[2]; /* windows (max. 2) */
|
2009-04-06 19:26:32 +02:00
|
|
|
gui_image *banners[2]; /* bottom & top banners */
|
|
|
|
gui_item *helpers[2]; /* left & right key comments */
|
|
|
|
gui_butn *arrows[2]; /* items list up & down arrows */
|
2009-03-15 20:11:01 +01:00
|
|
|
} gui_menu;
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
#ifdef HW_RVL
|
2009-03-30 22:36:04 +02:00
|
|
|
static png_texture *w_pointer[2];
|
2009-03-29 20:56:36 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
static gui_input m_input;
|
2009-03-15 20:11:01 +01:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
2009-03-29 20:56:36 +02:00
|
|
|
/* Generic Images */
|
|
|
|
/*****************************************************************************/
|
2009-04-13 19:29:09 +02:00
|
|
|
static gui_image logo_main = {NULL,Main_logo,204,362,232,56};
|
2009-04-06 19:26:32 +02:00
|
|
|
static gui_image logo_small = {NULL,Main_logo,466,40,152,44};
|
|
|
|
static gui_image top_banner = {NULL,Banner_top,0,0,640,108};
|
2009-04-13 19:29:09 +02:00
|
|
|
static gui_image bottom_banner = {NULL,Banner_bottom,0,380,640,100};
|
|
|
|
static gui_image main_banner = {NULL,Banner_main,0,340,640,140};
|
2009-04-06 19:26:32 +02:00
|
|
|
static gui_image bg_right = {NULL,Background_main,356,144,348,288};
|
2009-04-07 18:05:16 +02:00
|
|
|
static gui_image bg_center = {NULL,Background_main,146,80,348,288};
|
2009-04-07 01:01:19 +02:00
|
|
|
static gui_image bg_overlay_line = {NULL,Background_overlay,0,0,640,480};
|
2009-04-06 19:26:32 +02:00
|
|
|
static gui_image left_frame = {NULL,Frame_s1,8,72,372,336};
|
|
|
|
static gui_image right_frame = {NULL,Frame_s2,384,116,248,296};
|
2009-03-29 20:56:36 +02:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* Shared buttons data */
|
|
|
|
/*****************************************************************************/
|
|
|
|
static butn_data arrow_up_data =
|
|
|
|
{
|
|
|
|
{NULL,NULL},
|
|
|
|
{Button_up,Button_up_over}
|
|
|
|
};
|
|
|
|
|
|
|
|
static butn_data arrow_down_data =
|
|
|
|
{
|
|
|
|
{NULL,NULL},
|
|
|
|
{Button_down,Button_down_over}
|
|
|
|
};
|
|
|
|
|
|
|
|
static butn_data button_text_data =
|
|
|
|
{
|
|
|
|
{NULL,NULL},
|
|
|
|
{Button_text,Button_text_over}
|
|
|
|
};
|
|
|
|
|
|
|
|
static butn_data button_icon_data =
|
|
|
|
{
|
|
|
|
{NULL,NULL},
|
|
|
|
{Button_icon,Button_icon_over}
|
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* Generic Arrow Buttons */
|
|
|
|
/*****************************************************************************/
|
2009-04-06 19:26:32 +02:00
|
|
|
static gui_butn arrow_up = {&arrow_up_data,172,86,36,36};
|
|
|
|
static gui_butn arrow_down = {&arrow_down_data,172,356,36,36};
|
2009-03-29 20:56:36 +02:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* Generic Items */
|
2009-03-15 20:11:01 +01:00
|
|
|
/*****************************************************************************/
|
|
|
|
static gui_item action_cancel =
|
|
|
|
{
|
|
|
|
#ifdef HW_RVL
|
2009-04-05 20:20:43 +02:00
|
|
|
NULL,Key_B_wii,"","Back",10,422,28,28
|
2009-03-15 20:11:01 +01:00
|
|
|
#else
|
2009-04-05 20:20:43 +02:00
|
|
|
NULL,Key_B_gcn,"","Back",10,422,28,28
|
2009-03-15 20:11:01 +01:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
static gui_item action_select =
|
|
|
|
{
|
|
|
|
#ifdef HW_RVL
|
2009-04-05 20:20:43 +02:00
|
|
|
NULL,Key_A_wii,"","",602,422,28,28
|
2009-03-15 20:11:01 +01:00
|
|
|
#else
|
2009-04-05 20:20:43 +02:00
|
|
|
NULL,Key_A_gcn,"","",602,422,28,28
|
2009-03-15 20:11:01 +01:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
static gui_item action_exit =
|
|
|
|
{
|
2009-04-13 19:29:09 +02:00
|
|
|
#ifdef HW_RVL
|
|
|
|
NULL,Key_home,"","",10,372,68,28
|
|
|
|
#else
|
|
|
|
NULL,Key_trigger_Z,"","",10,372,92,28
|
|
|
|
#endif
|
2009-03-15 20:11:01 +01:00
|
|
|
};
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* Menu Items description */
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
/* Audio options menu */
|
2009-03-15 20:11:01 +01:00
|
|
|
static gui_item items_audio[5] =
|
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
{NULL,NULL,"PSG Volume: 2.50", "Adjust PSG output level", 0,0,0,0},
|
|
|
|
{NULL,NULL,"FM Volume: 1.00", "Adjust FM output level", 0,0,0,0},
|
|
|
|
{NULL,NULL,"Volume Boost: 1x", "Adjust general output level", 0,0,0,0},
|
|
|
|
{NULL,NULL,"LowPass Filter: OFF","Enable/disable sound filtering", 0,0,0,0},
|
|
|
|
{NULL,NULL,"HQ YM2612: LINEAR", "Enable/disable FM chip interpolation",0,0,0,0}
|
2009-03-15 20:11:01 +01:00
|
|
|
};
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* System options menu */
|
2009-03-15 20:11:01 +01:00
|
|
|
static gui_item items_system[6] =
|
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
{NULL,NULL,"Console Region: AUTO","Select system region", 0,0,0,0},
|
|
|
|
{NULL,NULL,"System Lockups: OFF", "Enable/disable original system lock-ups",0,0,0,0},
|
|
|
|
{NULL,NULL,"System BIOS: OFF", "Enable/disable TMSS BIOS support", 0,0,0,0},
|
|
|
|
{NULL,NULL,"SVP Cycles: 1500", "Adjust SVP chip emulation speed", 0,0,0,0},
|
|
|
|
{NULL,NULL,"Auto SRAM: OFF", "Enable/disable automatic SRAM", 0,0,0,0},
|
|
|
|
{NULL,NULL,"Auto STATE: OFF", "Enable/disable automatic Freeze State", 0,0,0,0}
|
2009-03-15 20:11:01 +01:00
|
|
|
};
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* Video options menu */
|
2009-03-15 20:11:01 +01:00
|
|
|
static gui_item items_video[8] =
|
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
{NULL,NULL,"Aspect: STRETCHED", "Select display aspect ratio", 0,0,0,0},
|
|
|
|
{NULL,NULL,"Display: PROGRESSIVE", "Select video mode type", 0,0,0,0},
|
|
|
|
{NULL,NULL,"TV mode: 50/60Hz", "Select video refresh rate", 0,0,0,0},
|
|
|
|
{NULL,NULL,"Bilinear Filter: OFF", "Enable/disable hardware filtering", 0,0,0,0},
|
|
|
|
{NULL,NULL,"NTSC Filter: COMPOSITE","Enable/disable NTSC software filtering", 0,0,0,0},
|
|
|
|
{NULL,NULL,"Borders: OFF", "Enable/disable original overscan emulation",0,0,0,0},
|
|
|
|
{NULL,NULL,"DISPLAY POSITION", "Adjust display position", 0,0,0,0},
|
|
|
|
{NULL,NULL,"DISPLAY SIZE", "Adjust display size", 0,0,0,0}
|
2009-03-15 20:11:01 +01:00
|
|
|
};
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* Main menu */
|
2009-03-15 20:11:01 +01:00
|
|
|
static gui_item items_main[6] =
|
|
|
|
{
|
2009-03-31 09:11:25 +02:00
|
|
|
{NULL,Main_play ,"","",108, 76,92,88},
|
|
|
|
{NULL,Main_load ,"","",280, 72,80,92},
|
|
|
|
{NULL,Main_options,"","",456, 76,60,88},
|
|
|
|
{NULL,Main_file ,"","",114,216,80,92},
|
|
|
|
{NULL,Main_reset ,"","",282,224,76,84},
|
|
|
|
{NULL,Main_info ,"","",446,212,88,96}
|
2009-03-15 20:11:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef HW_RVL
|
|
|
|
static gui_item items_load[4] =
|
|
|
|
{
|
2009-03-31 09:11:25 +02:00
|
|
|
{NULL,Load_recent,"","Load recent files", 276,120,88,96},
|
|
|
|
{NULL,Load_sd ,"","Load ROM files from SDCARD", 110,266,88,96},
|
|
|
|
{NULL,Load_usb ,"","Load ROM files from USB device",276,266,88,96},
|
|
|
|
{NULL,Load_dvd ,"","Load ROM files from DVD", 442,266,88,96}
|
2009-03-15 20:11:01 +01:00
|
|
|
};
|
|
|
|
#else
|
|
|
|
static gui_item items_load[3] =
|
|
|
|
{
|
2009-03-31 09:11:25 +02:00
|
|
|
{NULL,Load_recent,"","Load recent files", 110,198,88,96},
|
|
|
|
{NULL,Load_sd ,"","Load ROM files from SDCARD",276,198,88,96},
|
|
|
|
{NULL,Load_dvd ,"","Load ROM files from DVD", 442,198,88,96}
|
2009-03-15 20:11:01 +01:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static gui_item items_options[5] =
|
|
|
|
{
|
2009-03-31 09:11:25 +02:00
|
|
|
{NULL,Option_system,"","System settings", 114,142,80,92},
|
|
|
|
{NULL,Option_video ,"","Video settings", 288,150,64,84},
|
|
|
|
{NULL,Option_sound ,"","Audio settings", 464,154,44,80},
|
|
|
|
{NULL,Option_ctrl ,"","Input settings", 192,286,88,92},
|
|
|
|
{NULL,Option_ggenie,"","Game Genie Codes",360,282,88,96}
|
2009-03-15 20:11:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* Menu Buttons description */
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* Generic list menu */
|
2009-03-15 20:11:01 +01:00
|
|
|
static gui_butn buttons_generic[4] =
|
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
{&button_text_data,52,132,276,48},
|
|
|
|
{&button_text_data,52,188,276,48},
|
|
|
|
{&button_text_data,52,244,276,48},
|
|
|
|
{&button_text_data,52,300,276,48}
|
2009-03-15 20:11:01 +01:00
|
|
|
};
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* Main menu */
|
2009-03-15 20:11:01 +01:00
|
|
|
static gui_butn buttons_main[6] =
|
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
{&button_icon_data, 80, 50,148,132},
|
|
|
|
{&button_icon_data,246, 50,148,132},
|
|
|
|
{&button_icon_data,412, 50,148,132},
|
|
|
|
{&button_icon_data, 80,194,148,132},
|
|
|
|
{&button_icon_data,246,194,148,132},
|
|
|
|
{&button_icon_data,412,194,148,132}
|
2009-03-15 20:11:01 +01:00
|
|
|
};
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* Load Game menu */
|
2009-03-15 20:11:01 +01:00
|
|
|
#ifdef HW_RVL
|
|
|
|
static gui_butn buttons_load[4] =
|
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
{&button_icon_data,246,102,148,132},
|
|
|
|
{&button_icon_data, 80,248,148,132},
|
|
|
|
{&button_icon_data,246,248,148,132},
|
|
|
|
{&button_icon_data,412,248,148,132}
|
|
|
|
};
|
2009-03-15 20:11:01 +01:00
|
|
|
#else
|
|
|
|
static gui_butn buttons_load[3] =
|
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
{&button_icon_data, 80,180,148,132},
|
|
|
|
{&button_icon_data,246,180,148,132},
|
|
|
|
{&button_icon_data,412,180,148,132}
|
2009-03-15 20:11:01 +01:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* Options menu */
|
2009-03-15 20:11:01 +01:00
|
|
|
static gui_butn buttons_options[5] =
|
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
{&button_icon_data, 80,120,148,132},
|
|
|
|
{&button_icon_data,246,120,148,132},
|
|
|
|
{&button_icon_data,412,120,148,132},
|
|
|
|
{&button_icon_data,162,264,148,132},
|
|
|
|
{&button_icon_data,330,264,148,132}
|
2009-03-15 20:11:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2009-03-29 20:56:36 +02:00
|
|
|
/* Menu descriptions */
|
2009-03-15 20:11:01 +01:00
|
|
|
/*****************************************************************************/
|
2009-03-29 20:56:36 +02:00
|
|
|
|
|
|
|
/* Main menu */
|
|
|
|
static gui_menu menu_main =
|
2009-03-15 20:11:01 +01:00
|
|
|
{
|
2009-03-31 09:11:25 +02:00
|
|
|
"",
|
2009-03-29 20:56:36 +02:00
|
|
|
0,0,6,6,3,
|
2009-03-15 20:11:01 +01:00
|
|
|
items_main,
|
|
|
|
buttons_main,
|
2009-04-06 19:26:32 +02:00
|
|
|
&bg_overlay_line,
|
|
|
|
&bg_center,
|
2009-03-29 20:56:36 +02:00
|
|
|
&logo_main,
|
2009-04-06 19:26:32 +02:00
|
|
|
{NULL,NULL},
|
|
|
|
{NULL,&main_banner},
|
2009-03-29 20:56:36 +02:00
|
|
|
{&action_exit,NULL},
|
|
|
|
{NULL,NULL}
|
2009-03-15 20:11:01 +01:00
|
|
|
};
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* Load Game menu */
|
|
|
|
static gui_menu menu_load =
|
2009-03-15 20:11:01 +01:00
|
|
|
{
|
2009-03-29 20:56:36 +02:00
|
|
|
"Load Game",
|
2009-03-15 20:11:01 +01:00
|
|
|
#ifdef HW_RVL
|
2009-03-29 20:56:36 +02:00
|
|
|
0,0,4,4,3,
|
2009-03-15 20:11:01 +01:00
|
|
|
#else
|
2009-03-29 20:56:36 +02:00
|
|
|
0,0,3,3,0,
|
2009-03-15 20:11:01 +01:00
|
|
|
#endif
|
|
|
|
items_load,
|
|
|
|
buttons_load,
|
2009-04-06 19:26:32 +02:00
|
|
|
&bg_overlay_line,
|
|
|
|
&bg_center,
|
2009-03-29 20:56:36 +02:00
|
|
|
&logo_small,
|
2009-04-06 19:26:32 +02:00
|
|
|
{NULL,NULL},
|
|
|
|
{&top_banner,&bottom_banner},
|
2009-03-15 20:11:01 +01:00
|
|
|
{&action_cancel, &action_select},
|
2009-03-29 20:56:36 +02:00
|
|
|
{NULL, NULL}
|
2009-03-15 20:11:01 +01:00
|
|
|
};
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* Options menu */
|
|
|
|
static gui_menu menu_options =
|
2009-02-22 20:57:41 +01:00
|
|
|
{
|
2009-03-30 15:08:01 +02:00
|
|
|
"Settings",
|
2009-03-29 20:56:36 +02:00
|
|
|
0,0,5,5,3,
|
2009-03-15 20:11:01 +01:00
|
|
|
items_options,
|
|
|
|
buttons_options,
|
2009-04-06 19:26:32 +02:00
|
|
|
&bg_overlay_line,
|
|
|
|
&bg_center,
|
2009-03-29 20:56:36 +02:00
|
|
|
&logo_small,
|
2009-04-06 19:26:32 +02:00
|
|
|
{NULL,NULL},
|
|
|
|
{&top_banner,&bottom_banner},
|
2009-03-15 20:11:01 +01:00
|
|
|
{&action_cancel, &action_select},
|
2009-03-29 20:56:36 +02:00
|
|
|
{NULL, NULL}
|
2009-02-22 20:57:41 +01:00
|
|
|
};
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* System Options menu */
|
|
|
|
static gui_menu menu_system =
|
2009-03-15 20:11:01 +01:00
|
|
|
{
|
2009-03-29 20:56:36 +02:00
|
|
|
"System Options",
|
|
|
|
0,0,6,4,1,
|
2009-03-15 20:11:01 +01:00
|
|
|
items_system,
|
|
|
|
buttons_generic,
|
2009-04-06 19:26:32 +02:00
|
|
|
&bg_overlay_line,
|
|
|
|
&bg_right,
|
2009-03-29 20:56:36 +02:00
|
|
|
&logo_small,
|
2009-04-06 19:26:32 +02:00
|
|
|
{&left_frame,NULL},
|
|
|
|
{&top_banner,&bottom_banner},
|
2009-03-15 20:11:01 +01:00
|
|
|
{&action_cancel, &action_select},
|
2009-03-30 15:08:01 +02:00
|
|
|
{NULL, &arrow_down}
|
2009-03-15 20:11:01 +01:00
|
|
|
};
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* Video Options menu */
|
|
|
|
static gui_menu menu_video =
|
2009-03-15 20:11:01 +01:00
|
|
|
{
|
2009-03-29 20:56:36 +02:00
|
|
|
"Video Options",
|
|
|
|
0,0,8,4,1,
|
2009-03-15 20:11:01 +01:00
|
|
|
items_video,
|
|
|
|
buttons_generic,
|
2009-04-06 19:26:32 +02:00
|
|
|
&bg_overlay_line,
|
|
|
|
&bg_right,
|
2009-03-29 20:56:36 +02:00
|
|
|
&logo_small,
|
2009-04-06 19:26:32 +02:00
|
|
|
{&left_frame,NULL},
|
|
|
|
{&top_banner,&bottom_banner},
|
2009-03-15 20:11:01 +01:00
|
|
|
{&action_cancel, &action_select},
|
2009-03-30 15:08:01 +02:00
|
|
|
{NULL, &arrow_down}
|
2009-03-15 20:11:01 +01:00
|
|
|
};
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* Sound Options menu */
|
|
|
|
static gui_menu menu_audio =
|
2009-03-15 20:11:01 +01:00
|
|
|
{
|
2009-03-29 20:56:36 +02:00
|
|
|
"Sound Options",
|
|
|
|
0,0,5,4,1,
|
2009-03-15 20:11:01 +01:00
|
|
|
items_audio,
|
|
|
|
buttons_generic,
|
2009-04-07 01:01:19 +02:00
|
|
|
&bg_overlay_line,
|
2009-04-06 19:26:32 +02:00
|
|
|
&bg_right,
|
2009-03-29 20:56:36 +02:00
|
|
|
&logo_small,
|
2009-04-06 19:26:32 +02:00
|
|
|
{&left_frame,NULL},
|
|
|
|
{&top_banner,&bottom_banner},
|
2009-03-15 20:11:01 +01:00
|
|
|
{&action_cancel, &action_select},
|
2009-03-30 15:08:01 +02:00
|
|
|
{NULL, &arrow_down}
|
2009-03-15 20:11:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* Generic GUI routines */
|
|
|
|
/*****************************************************************************/
|
2009-03-29 20:56:36 +02:00
|
|
|
static void menu_initialize(gui_menu *menu)
|
2009-02-22 20:57:41 +01:00
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
int i;
|
2009-02-22 20:57:41 +01:00
|
|
|
gui_item *item;
|
2009-03-29 20:56:36 +02:00
|
|
|
gui_image *image;
|
2009-03-30 09:05:34 +02:00
|
|
|
gui_butn *button;
|
2009-02-22 20:57:41 +01:00
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
#ifdef HW_RVL
|
|
|
|
/* allocate wiimote pointer data (only done once) */
|
2009-03-30 22:36:04 +02:00
|
|
|
w_pointer[0] = OpenTexturePNG(generic_point);
|
2009-03-31 09:11:25 +02:00
|
|
|
/* w_pointer[1] = OpenTexturePNG(generic_openhand);*/
|
2009-03-29 20:56:36 +02:00
|
|
|
#endif
|
|
|
|
|
2009-04-06 19:26:32 +02:00
|
|
|
/* allocate background overlay texture */
|
|
|
|
image = menu->overlay;
|
|
|
|
if (image) image->texture = OpenTexturePNG(image->data);
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* allocate background image texture */
|
2009-03-30 15:08:01 +02:00
|
|
|
image = menu->background;
|
|
|
|
if (image) image->texture = OpenTexturePNG(image->data);
|
2009-03-29 20:56:36 +02:00
|
|
|
|
|
|
|
/* allocate logo texture */
|
2009-03-30 15:08:01 +02:00
|
|
|
image = menu->logo;
|
|
|
|
if (image) image->texture = OpenTexturePNG(image->data);
|
2009-02-22 20:57:41 +01:00
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* allocate background elements textures */
|
|
|
|
for (i=0; i<2; i++)
|
2009-03-15 20:11:01 +01:00
|
|
|
{
|
2009-04-06 19:26:32 +02:00
|
|
|
/* banners */
|
|
|
|
image = menu->banners[i];
|
|
|
|
if (image) image->texture = OpenTexturePNG(image->data);
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* frames */
|
2009-03-30 15:08:01 +02:00
|
|
|
image = menu->frames[i];
|
|
|
|
if (image) image->texture = OpenTexturePNG(image->data);
|
2009-03-29 20:56:36 +02:00
|
|
|
|
|
|
|
/* key helpers */
|
2009-03-30 15:08:01 +02:00
|
|
|
item = menu->helpers[i];
|
|
|
|
if (item) item->texture = OpenTexturePNG(item->data);
|
|
|
|
}
|
2009-03-29 20:56:36 +02:00
|
|
|
|
2009-03-30 15:08:01 +02:00
|
|
|
/* allocate arrow buttons */
|
|
|
|
if (menu->max_items > menu->max_buttons)
|
|
|
|
{
|
2009-03-30 22:36:04 +02:00
|
|
|
arrow_up_data.texture[0] = OpenTexturePNG(arrow_up_data.image[0]);
|
|
|
|
arrow_up_data.texture[1] = OpenTexturePNG(arrow_up_data.image[1]);
|
2009-03-30 15:08:01 +02:00
|
|
|
arrow_down_data.texture[0] = OpenTexturePNG(arrow_down_data.image[0]);
|
|
|
|
arrow_down_data.texture[1] = OpenTexturePNG(arrow_down_data.image[1]);
|
2009-03-30 09:05:34 +02:00
|
|
|
}
|
2009-03-29 20:56:36 +02:00
|
|
|
|
2009-03-30 15:08:01 +02:00
|
|
|
/* allocate menu buttons */
|
2009-03-30 09:05:34 +02:00
|
|
|
for (i=0; i<menu->max_buttons; i++)
|
|
|
|
{
|
|
|
|
button = &menu->buttons[i];
|
2009-03-30 15:08:01 +02:00
|
|
|
if (!button->data->texture[0]) button->data->texture[0] = OpenTexturePNG(button->data->image[0]);
|
|
|
|
if (!button->data->texture[1]) button->data->texture[1] = OpenTexturePNG(button->data->image[1]);
|
2009-03-15 20:11:01 +01:00
|
|
|
}
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* allocate item textures */
|
|
|
|
for (i=0; i<menu->max_items; i++)
|
2009-03-15 20:11:01 +01:00
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
item = &menu->items[i];
|
2009-03-30 15:08:01 +02:00
|
|
|
if (item->data) item->texture = OpenTexturePNG(item->data);
|
2009-03-15 20:11:01 +01:00
|
|
|
}
|
2009-03-29 20:56:36 +02:00
|
|
|
}
|
2009-03-15 20:11:01 +01:00
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
static void menu_delete(gui_menu *menu)
|
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
int i;
|
2009-03-29 20:56:36 +02:00
|
|
|
gui_butn *button;
|
2009-03-30 09:05:34 +02:00
|
|
|
gui_item *item;
|
2009-03-29 20:56:36 +02:00
|
|
|
|
2009-04-06 19:26:32 +02:00
|
|
|
/* free background image texture */
|
|
|
|
if (menu->overlay)
|
|
|
|
CloseTexturePNG(&menu->overlay->texture);
|
|
|
|
|
2009-03-30 22:36:04 +02:00
|
|
|
/* free background image texture */
|
2009-03-29 20:56:36 +02:00
|
|
|
if (menu->background)
|
2009-04-06 19:26:32 +02:00
|
|
|
CloseTexturePNG(&menu->background->texture);
|
2009-03-29 20:56:36 +02:00
|
|
|
|
2009-03-30 15:08:01 +02:00
|
|
|
/* free logo texture */
|
2009-03-29 20:56:36 +02:00
|
|
|
if (menu->logo)
|
2009-04-06 19:26:32 +02:00
|
|
|
CloseTexturePNG(&menu->logo->texture);
|
2009-03-15 20:11:01 +01:00
|
|
|
|
2009-03-30 15:08:01 +02:00
|
|
|
/* free background elements textures */
|
2009-03-29 20:56:36 +02:00
|
|
|
for (i=0; i<2; i++)
|
2009-03-15 20:11:01 +01:00
|
|
|
{
|
2009-03-30 22:36:04 +02:00
|
|
|
#ifdef HW_RVL
|
|
|
|
/* free wiimote pointer data */
|
2009-04-06 19:26:32 +02:00
|
|
|
CloseTexturePNG(&w_pointer[i]);
|
2009-03-30 22:36:04 +02:00
|
|
|
#endif
|
|
|
|
|
2009-04-06 19:26:32 +02:00
|
|
|
/* banners */
|
|
|
|
if (menu->banners[i])
|
|
|
|
CloseTexturePNG(&menu->banners[i]->texture);
|
|
|
|
|
2009-04-07 01:01:19 +02:00
|
|
|
/* frames */
|
2009-03-29 20:56:36 +02:00
|
|
|
if (menu->frames[i])
|
2009-04-06 19:26:32 +02:00
|
|
|
CloseTexturePNG(&menu->frames[i]->texture);
|
2009-03-29 20:56:36 +02:00
|
|
|
|
|
|
|
/* key helpers */
|
|
|
|
if (menu->helpers[i])
|
2009-04-06 19:26:32 +02:00
|
|
|
CloseTexturePNG(&menu->helpers[i]->texture);
|
2009-03-29 20:56:36 +02:00
|
|
|
|
2009-04-06 19:26:32 +02:00
|
|
|
/* up&down arrows */
|
|
|
|
CloseTexturePNG(&arrow_up_data.texture[i]);
|
|
|
|
CloseTexturePNG(&arrow_down_data.texture[i]);
|
2009-03-15 20:11:01 +01:00
|
|
|
}
|
|
|
|
|
2009-03-30 15:08:01 +02:00
|
|
|
/* free menu buttons */
|
2009-03-30 09:05:34 +02:00
|
|
|
for (i=0; i<menu->max_buttons; i++)
|
|
|
|
{
|
|
|
|
button = &menu->buttons[i];
|
2009-04-06 19:26:32 +02:00
|
|
|
CloseTexturePNG(&button->data->texture[0]);
|
|
|
|
CloseTexturePNG(&button->data->texture[1]);
|
2009-03-30 09:05:34 +02:00
|
|
|
}
|
|
|
|
|
2009-03-30 15:08:01 +02:00
|
|
|
/* free item textures */
|
2009-03-29 20:56:36 +02:00
|
|
|
for (i=0; i<menu->max_items; i++)
|
2009-03-15 20:11:01 +01:00
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
item = &menu->items[i];
|
2009-04-06 19:26:32 +02:00
|
|
|
CloseTexturePNG(&item->texture);
|
2009-03-15 20:11:01 +01:00
|
|
|
}
|
2009-03-29 20:56:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void menu_draw(gui_menu *menu)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
gui_item *item;
|
|
|
|
gui_butn *button;
|
|
|
|
gui_image *image;
|
|
|
|
|
2009-04-05 20:20:43 +02:00
|
|
|
/* draw background */
|
2009-04-01 09:37:54 +02:00
|
|
|
if ((menu == &menu_main) && genromsize)
|
|
|
|
{
|
2009-04-05 20:20:43 +02:00
|
|
|
ClearScreen ((GXColor)BLACK);
|
|
|
|
gxDrawScreenshot(128);
|
2009-04-13 19:29:09 +02:00
|
|
|
image = menu->overlay;
|
|
|
|
if (image) DrawTextureRepeat(image->texture,image->x,image->y,image->w,image->h);
|
2009-04-05 20:20:43 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ClearScreen ((GXColor)BACKGROUND);
|
2009-04-06 19:26:32 +02:00
|
|
|
image = menu->overlay;
|
|
|
|
if (image) DrawTextureRepeat(image->texture,image->x,image->y,image->w,image->h);
|
2009-04-05 20:20:43 +02:00
|
|
|
image = menu->background;
|
|
|
|
if (image) DrawTexture(image->texture,image->x,image->y,image->w,image->h);
|
2009-04-01 09:37:54 +02:00
|
|
|
}
|
2009-03-29 20:56:36 +02:00
|
|
|
|
|
|
|
for (i=0; i<2; i++)
|
|
|
|
{
|
2009-04-07 01:01:19 +02:00
|
|
|
/* draw top&bottom banners */
|
|
|
|
image = menu->banners[i];
|
|
|
|
if (image) DrawTexture(image->texture,image->x,image->y,image->w,image->h);
|
2009-04-07 18:05:16 +02:00
|
|
|
|
|
|
|
/* draw frames */
|
|
|
|
image = menu->frames[i];
|
|
|
|
if (image) DrawTextureAlpha(image->texture,image->x,image->y,image->w,image->h, 128);
|
2009-04-13 19:29:09 +02:00
|
|
|
|
|
|
|
/* draw top&bottom banners */
|
|
|
|
image = menu->banners[i];
|
|
|
|
if (image) DrawTexture(image->texture,image->x,image->y,image->w,image->h);
|
2009-03-29 20:56:36 +02:00
|
|
|
}
|
|
|
|
|
2009-03-30 09:05:34 +02:00
|
|
|
/* draw logo */
|
|
|
|
image = menu->logo;
|
|
|
|
if (image) DrawTexture(image->texture,image->x,image->y,image->w,image->h);
|
|
|
|
|
|
|
|
/* draw title */
|
2009-04-13 19:29:09 +02:00
|
|
|
FONT_alignLeft(menu->title, 22,10,56, (GXColor)WHITE);
|
2009-03-30 09:05:34 +02:00
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* draw left helper */
|
2009-03-30 09:05:34 +02:00
|
|
|
item = menu->helpers[0];
|
2009-03-29 20:56:36 +02:00
|
|
|
if (item)
|
|
|
|
{
|
|
|
|
DrawTexture(item->texture, item->x, item->y, item->w, item->h);
|
2009-04-13 19:29:09 +02:00
|
|
|
FONT_alignLeft(item->comment, 16, item->x+item->w+6,item->y+(item->h-16)/2 + 16, (GXColor)WHITE);
|
2009-03-29 20:56:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* draw right helper */
|
2009-03-30 09:05:34 +02:00
|
|
|
item = menu->helpers[1];
|
2009-03-29 20:56:36 +02:00
|
|
|
if (item)
|
|
|
|
{
|
|
|
|
DrawTexture(item->texture, item->x, item->y, item->w, item->h);
|
2009-04-13 19:29:09 +02:00
|
|
|
FONT_alignRight(item->comment, 16, item->x - 6, item->y+(item->h-16)/2 + 16, (GXColor)WHITE);
|
2009-03-29 20:56:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* draw buttons + items */
|
2009-03-15 20:11:01 +01:00
|
|
|
for (i=0; i<menu->max_buttons; i++)
|
2009-02-22 20:57:41 +01:00
|
|
|
{
|
|
|
|
/* draw button */
|
2009-03-15 20:11:01 +01:00
|
|
|
button = &menu->buttons[i];
|
2009-04-05 20:20:43 +02:00
|
|
|
if (i==menu->selected) DrawTexture(button->data->texture[1], button->x-2, button->y-2, button->w+4, button->h+4);
|
|
|
|
else DrawTexture(button->data->texture[0], button->x, button->y, button->w, button->h);
|
2009-02-22 20:57:41 +01:00
|
|
|
|
|
|
|
/* draw item */
|
2009-03-30 15:08:01 +02:00
|
|
|
item = &menu->items[menu->offset +i];
|
2009-04-05 20:20:43 +02:00
|
|
|
if (item->data)
|
|
|
|
{
|
|
|
|
if (i==menu->selected) DrawTexture(item->texture, item->x-2, item->y-2, item->w+4, item->h+4);
|
|
|
|
else DrawTexture(item->texture, item->x, item->y, item->w, item->h);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-04-13 19:29:09 +02:00
|
|
|
if (i==menu->selected) FONT_writeCenter(item->text, 18, button->x, button->x + button->w, button->y + (button->h - 18)/2 + 18, (GXColor)DARK_GREY);
|
|
|
|
else FONT_writeCenter(item->text, 16, button->x, button->x + button->w, button->y + (button->h - 16)/2 + 16, (GXColor)DARK_GREY);
|
2009-04-05 20:20:43 +02:00
|
|
|
}
|
2009-03-15 20:11:01 +01:00
|
|
|
}
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* Arrows (Items list only) */
|
|
|
|
for (i=0; i<2; i++)
|
2009-03-15 20:11:01 +01:00
|
|
|
{
|
2009-03-29 20:56:36 +02:00
|
|
|
button = menu->arrows[i];
|
|
|
|
if (button)
|
|
|
|
{
|
|
|
|
if (menu->selected == menu->max_buttons + i)
|
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
DrawTexture(button->data->texture[1], button->x-2, button->y-2, button->w+4, button->h+4);
|
2009-03-29 20:56:36 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
DrawTexture(button->data->texture[0], button->x, button->y, button->w, button->h);
|
2009-03-29 20:56:36 +02:00
|
|
|
}
|
|
|
|
}
|
2009-03-15 20:11:01 +01:00
|
|
|
}
|
2009-04-06 19:26:32 +02:00
|
|
|
}
|
|
|
|
|
2009-04-07 18:17:08 +02:00
|
|
|
/* Menu Prompt */
|
2009-04-07 18:05:16 +02:00
|
|
|
/* prompt window slides in & out */
|
|
|
|
static int menu_prompt(gui_menu *parent, char *title, char *items[], u8 nb_items)
|
2009-04-06 19:26:32 +02:00
|
|
|
{
|
|
|
|
int i, ret, quit = 0;
|
2009-04-07 18:05:16 +02:00
|
|
|
s32 selected = 0;
|
|
|
|
s32 old, voice;
|
2009-04-06 19:26:32 +02:00
|
|
|
butn_data *data = &button_text_data;
|
|
|
|
u8 delete_me[2];
|
|
|
|
s16 p;
|
2009-03-29 20:56:36 +02:00
|
|
|
|
|
|
|
#ifdef HW_RVL
|
2009-04-06 19:26:32 +02:00
|
|
|
int x,y;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* initialize data */
|
|
|
|
for (i=0; i<2; i++)
|
2009-03-15 20:11:01 +01:00
|
|
|
{
|
2009-04-06 19:26:32 +02:00
|
|
|
delete_me[i] = 0;
|
|
|
|
if (!data->texture[i])
|
|
|
|
{
|
|
|
|
data->texture[i] = OpenTexturePNG(data->image[i]);
|
|
|
|
delete_me[i] = 1;
|
|
|
|
}
|
2009-03-15 20:11:01 +01:00
|
|
|
}
|
2009-04-06 19:26:32 +02:00
|
|
|
|
2009-04-07 01:01:19 +02:00
|
|
|
/* initialize texture window */
|
2009-04-06 19:26:32 +02:00
|
|
|
png_texture *window = OpenTexturePNG(Frame_s1);
|
2009-04-07 18:05:16 +02:00
|
|
|
png_texture *top = OpenTexturePNG(Frame_title);
|
2009-04-06 19:26:32 +02:00
|
|
|
|
2009-04-07 01:01:19 +02:00
|
|
|
/* get initial positions */
|
|
|
|
int w = data->texture[0]->width;
|
|
|
|
int h = data->texture[0]->height;
|
|
|
|
int xwindow = (640 - window->width)/2;
|
|
|
|
int ywindow = (480 - window->height)/2;
|
|
|
|
int xpos = xwindow + (window->width - w)/2;
|
2009-04-07 18:05:16 +02:00
|
|
|
int ypos = (window->height - top->height - (h*nb_items) - (nb_items-1)*20)/2;
|
|
|
|
ypos = ypos + ywindow + top->height;
|
2009-04-07 01:01:19 +02:00
|
|
|
|
2009-04-07 18:05:16 +02:00
|
|
|
/* get initial vertical offset */
|
|
|
|
int yoffset = ywindow + window->height;
|
|
|
|
|
|
|
|
/* slide in */
|
|
|
|
while (yoffset > 0)
|
2009-04-06 19:26:32 +02:00
|
|
|
{
|
|
|
|
/* draw parent menu */
|
2009-04-07 18:05:16 +02:00
|
|
|
menu_draw(parent);
|
|
|
|
|
|
|
|
/* draw window */
|
2009-04-13 19:29:09 +02:00
|
|
|
DrawTextureAlpha(window, xwindow, ywindow - yoffset, window->width, window->height,210);
|
2009-04-07 18:05:16 +02:00
|
|
|
DrawTexture(top, xwindow, ywindow - yoffset, top->width, top->height);
|
|
|
|
|
|
|
|
/* draw title */
|
2009-04-13 19:29:09 +02:00
|
|
|
FONT_writeCenter(title, 20,xwindow, xwindow + window->width, ywindow + (top->height-20) / 2 + 20 - yoffset, (GXColor)WHITE);
|
2009-04-07 18:05:16 +02:00
|
|
|
|
|
|
|
/* draw buttons + text */
|
|
|
|
for (i=0; i<nb_items; i++)
|
|
|
|
{
|
|
|
|
DrawTexture(data->texture[0],xpos, ypos+i*(20 + h)-yoffset, w,h);
|
2009-04-13 19:29:09 +02:00
|
|
|
FONT_writeCenter(items[i], 18, xpos, xpos + w, ypos + i*(20 + h) + (h + 18)/2 - yoffset, (GXColor)DARK_GREY);
|
2009-04-07 18:05:16 +02:00
|
|
|
}
|
|
|
|
|
2009-04-13 19:29:09 +02:00
|
|
|
yoffset -=60;
|
2009-04-07 18:05:16 +02:00
|
|
|
SetScreen ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* draw menu */
|
|
|
|
while (quit == 0)
|
|
|
|
{
|
|
|
|
/* draw parent menu (should have been initialized first) */
|
|
|
|
menu_draw(parent);
|
2009-04-06 19:26:32 +02:00
|
|
|
|
|
|
|
/* draw window */
|
2009-04-13 19:29:09 +02:00
|
|
|
DrawTextureAlpha(window, xwindow, ywindow, window->width, window->height,210);
|
|
|
|
DrawTexture(top, xwindow, ywindow, top->width, top->height);
|
2009-04-06 19:26:32 +02:00
|
|
|
|
|
|
|
/* draw title */
|
2009-04-13 19:29:09 +02:00
|
|
|
FONT_writeCenter(title, 20,xwindow, xwindow + window->width, ywindow + (top->height-20) / 2 + 20, (GXColor)WHITE);
|
2009-04-06 19:26:32 +02:00
|
|
|
|
|
|
|
/* draw buttons + text */
|
|
|
|
for (i=0; i<nb_items; i++)
|
|
|
|
{
|
2009-04-07 01:01:19 +02:00
|
|
|
if (i==selected) DrawTexture(data->texture[1], xpos-2, ypos + i*(20 + h) - 2, w+4, h+4);
|
|
|
|
else DrawTexture(data->texture[0],xpos, ypos+i*(20 + h), w,h);
|
2009-04-13 19:29:09 +02:00
|
|
|
if (i==selected) FONT_writeCenter(items[i], 20, xpos, xpos + w, ypos + i*(20 + h) + (h + 20)/2, (GXColor)DARK_GREY);
|
|
|
|
else FONT_writeCenter(items[i], 18, xpos, xpos + w, ypos+i*(20 + h) + (h + 18)/2, (GXColor)DARK_GREY);
|
2009-04-06 19:26:32 +02:00
|
|
|
}
|
|
|
|
|
2009-04-07 18:05:16 +02:00
|
|
|
old = selected;
|
2009-04-06 19:26:32 +02:00
|
|
|
p = m_input.keys;
|
2009-04-07 18:05:16 +02:00
|
|
|
|
2009-04-07 01:01:19 +02:00
|
|
|
#ifdef HW_RVL
|
2009-04-06 19:26:32 +02:00
|
|
|
if (Shutdown)
|
|
|
|
{
|
|
|
|
/* autosave SRAM/State */
|
|
|
|
memfile_autosave();
|
|
|
|
|
|
|
|
/* shutdown Wii */
|
|
|
|
DI_Close();
|
|
|
|
SYS_ResetSystem(SYS_POWEROFF, 0, 0);
|
|
|
|
}
|
|
|
|
else if (m_input.ir.valid)
|
|
|
|
{
|
|
|
|
/* get cursor position */
|
|
|
|
x = m_input.ir.x;
|
|
|
|
y = m_input.ir.y;
|
|
|
|
|
|
|
|
/* draw wiimote pointer */
|
|
|
|
gxResetCamera(m_input.ir.angle);
|
|
|
|
png_texture *texture = w_pointer[0];
|
|
|
|
DrawTexture(texture, x-texture->width/2, y-texture->height/2, texture->width, texture->height);
|
|
|
|
gxResetCamera(0.0);
|
|
|
|
|
|
|
|
/* check for valid buttons */
|
|
|
|
selected = -1;
|
|
|
|
for (i=0; i<nb_items; i++)
|
|
|
|
{
|
2009-04-07 01:01:19 +02:00
|
|
|
if ((x >= xpos) && (x <= (xpos + w)) && (y >= ypos + i*(20 + h)) && (y <= (ypos + i*(20 + h) + h)))
|
2009-04-06 19:26:32 +02:00
|
|
|
{
|
|
|
|
selected = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-04-07 01:01:19 +02:00
|
|
|
#endif
|
|
|
|
|
2009-04-06 19:26:32 +02:00
|
|
|
/* copy EFB to XFB */
|
|
|
|
SetScreen ();
|
|
|
|
|
2009-04-07 18:05:16 +02:00
|
|
|
/* update selection */
|
2009-04-06 19:26:32 +02:00
|
|
|
if (p & PAD_BUTTON_UP)
|
|
|
|
{
|
|
|
|
if (selected > 0) selected --;
|
|
|
|
}
|
|
|
|
else if (p & PAD_BUTTON_DOWN)
|
|
|
|
{
|
|
|
|
if (selected < (nb_items -1)) selected ++;
|
|
|
|
}
|
|
|
|
|
2009-04-07 18:05:16 +02:00
|
|
|
/* sound fx */
|
|
|
|
if (selected != old)
|
|
|
|
{
|
|
|
|
if (selected >= 0)
|
|
|
|
{
|
|
|
|
voice = ASND_GetFirstUnusedVoice();
|
|
|
|
if(voice >= 0) ASND_SetVoice(voice, VOICE_MONO_16BIT, 22050, 0, (u8 *)button_over, button_over_size, 255, 255, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-06 19:26:32 +02:00
|
|
|
if (p & PAD_BUTTON_A)
|
|
|
|
{
|
|
|
|
if (selected >= 0)
|
|
|
|
{
|
|
|
|
quit = 1;
|
|
|
|
ret = selected;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p & PAD_BUTTON_B)
|
|
|
|
{
|
|
|
|
quit = 1;
|
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-07 18:05:16 +02:00
|
|
|
/* get initial vertical offset */
|
|
|
|
yoffset = 0;
|
|
|
|
|
|
|
|
/* slide out */
|
|
|
|
while (yoffset < (ywindow + window->height))
|
|
|
|
{
|
|
|
|
/* draw parent menu */
|
|
|
|
menu_draw(parent);
|
|
|
|
|
2009-04-07 18:17:08 +02:00
|
|
|
/* draw window + header */
|
2009-04-13 19:29:09 +02:00
|
|
|
DrawTextureAlpha(window, xwindow, ywindow - yoffset, window->width, window->height,210);
|
2009-04-07 18:05:16 +02:00
|
|
|
DrawTexture(top, xwindow, ywindow - yoffset, top->width, top->height);
|
|
|
|
|
|
|
|
/* draw title */
|
2009-04-13 19:29:09 +02:00
|
|
|
FONT_writeCenter(title, 20, xwindow, xwindow + window->width, ywindow + (top->height-20) / 2 + 20 - yoffset, (GXColor)WHITE);
|
2009-04-07 18:05:16 +02:00
|
|
|
|
|
|
|
/* draw buttons + text */
|
|
|
|
for (i=0; i<nb_items; i++)
|
|
|
|
{
|
|
|
|
DrawTexture(data->texture[0],xpos, ypos+i*(20 + h)-yoffset, w,h);
|
2009-04-13 19:29:09 +02:00
|
|
|
FONT_writeCenter(items[i], 18, xpos, xpos + w, ypos + i*(20 + h) + (h + 18)/2 - yoffset, (GXColor)WHITE);
|
2009-04-07 18:05:16 +02:00
|
|
|
}
|
|
|
|
|
2009-04-13 19:29:09 +02:00
|
|
|
yoffset +=60;
|
2009-04-07 18:05:16 +02:00
|
|
|
SetScreen ();
|
|
|
|
}
|
|
|
|
|
2009-04-06 19:26:32 +02:00
|
|
|
/* close textures */
|
|
|
|
CloseTexturePNG(&window);
|
|
|
|
if (delete_me[0]) CloseTexturePNG(&data->texture[0]);
|
|
|
|
if (delete_me[1]) CloseTexturePNG(&data->texture[1]);
|
|
|
|
|
|
|
|
return ret;
|
2009-03-15 20:11:01 +01:00
|
|
|
}
|
|
|
|
|
2009-04-07 18:05:16 +02:00
|
|
|
/* Basic menu sliding effect */
|
|
|
|
/* this basically makes the bottom & top banners sliding in or out */
|
|
|
|
/* when a game is displayed in background, it is faded accordingly */
|
|
|
|
static void menu_slide(gui_menu *menu, u8 speed, u8 out)
|
2009-04-01 09:37:54 +02:00
|
|
|
{
|
|
|
|
int offset;
|
|
|
|
int yfinal[3];
|
|
|
|
gui_image *image[3];
|
2009-04-06 19:26:32 +02:00
|
|
|
gui_image *temp;
|
2009-04-01 09:37:54 +02:00
|
|
|
|
|
|
|
menu_initialize(menu);
|
|
|
|
|
|
|
|
offset = 0;
|
|
|
|
yfinal[0] = 0;
|
|
|
|
yfinal[1] = 0;
|
|
|
|
yfinal[2] = 0;
|
|
|
|
|
2009-04-07 18:17:08 +02:00
|
|
|
/* Main Logo (top or bottom) */
|
2009-04-01 09:37:54 +02:00
|
|
|
image[2] = menu->logo;
|
|
|
|
|
|
|
|
/* Top banner */
|
2009-04-06 19:26:32 +02:00
|
|
|
image[0] = menu->banners[0];
|
2009-04-01 09:37:54 +02:00
|
|
|
if (image[0])
|
|
|
|
{
|
|
|
|
/* intial offset */
|
|
|
|
offset = image[0]->y + image[0]->h;
|
|
|
|
|
|
|
|
/* final ypos */
|
|
|
|
yfinal[0] = out ? (-image[0]->h) : (image[0]->y);
|
|
|
|
if (image[2] && !image[1]) yfinal[2] = out ? (image[2]->y - offset) : image[2]->y;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Bottom banner */
|
2009-04-06 19:26:32 +02:00
|
|
|
image[1] = menu->banners[1];
|
2009-04-01 09:37:54 +02:00
|
|
|
if (image[1])
|
|
|
|
{
|
|
|
|
if ((480 + image[1]->h - image[1]->y) > offset)
|
|
|
|
{
|
|
|
|
/* intial offset */
|
|
|
|
offset = 480 - image[1]->y;
|
|
|
|
|
|
|
|
/* final ypos */
|
|
|
|
yfinal[1] = out ? 480 : (image[1]->y);
|
|
|
|
if (image[2] && !image[0]) yfinal[2] = out ? (image[2]->y + offset) : image[2]->y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-07 18:17:08 +02:00
|
|
|
/* Alpha steps */
|
2009-04-01 09:37:54 +02:00
|
|
|
u16 alpha = out ? 128 : 255;
|
2009-04-01 14:36:14 +02:00
|
|
|
s16 alpha_step = (127 * speed) /offset;
|
|
|
|
if (!out) alpha_step = -alpha_step;
|
2009-04-01 09:37:54 +02:00
|
|
|
|
2009-04-07 18:17:08 +02:00
|
|
|
/* Let's loop until final position has been reached */
|
2009-04-01 09:37:54 +02:00
|
|
|
while (offset > 0)
|
|
|
|
{
|
|
|
|
if ((menu == &menu_main) && genromsize)
|
|
|
|
{
|
2009-04-05 20:20:43 +02:00
|
|
|
ClearScreen ((GXColor)BLACK);
|
|
|
|
gxDrawScreenshot(alpha);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ClearScreen ((GXColor)BACKGROUND);
|
2009-04-06 19:26:32 +02:00
|
|
|
temp = menu->overlay;
|
|
|
|
if (temp) DrawTextureRepeat(temp->texture,temp->x,temp->y,temp->w,temp->h);
|
|
|
|
temp = menu->background;
|
|
|
|
if (temp) DrawTexture(temp->texture,temp->x,temp->y,temp->w,temp->h);
|
2009-04-01 09:37:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* draw top banner + logo */
|
|
|
|
if (image[out])
|
|
|
|
{
|
|
|
|
DrawTexture(image[out]->texture,image[out]->x,yfinal[out]-offset,image[out]->w,image[out]->h);
|
|
|
|
if (image[2] && !image[out^1]) DrawTexture(image[2]->texture,image[2]->x,yfinal[2]-offset,image[2]->w,image[2]->h);
|
|
|
|
}
|
|
|
|
/* draw bottom banner + logo */
|
|
|
|
if (image[out^1])
|
|
|
|
{
|
|
|
|
DrawTexture(image[out^1]->texture,image[out^1]->x,yfinal[out^1]+offset,image[out^1]->w,image[out^1]->h);
|
|
|
|
if (image[2] && !image[out]) DrawTexture(image[2]->texture,image[2]->x,image[2]->y+offset,image[2]->w,image[2]->h);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* update offset */
|
|
|
|
offset -= speed;
|
|
|
|
|
|
|
|
/* update alpha */
|
|
|
|
alpha += alpha_step;
|
|
|
|
if (alpha > 255) alpha = 255;
|
|
|
|
|
|
|
|
/* copy EFB to XFB */
|
|
|
|
SetScreen ();
|
|
|
|
}
|
|
|
|
|
2009-04-07 18:17:08 +02:00
|
|
|
/* final position */
|
2009-04-06 19:26:32 +02:00
|
|
|
if (!out)
|
|
|
|
{
|
|
|
|
menu_draw(menu);
|
|
|
|
SetScreen ();
|
|
|
|
}
|
|
|
|
|
2009-04-01 09:37:54 +02:00
|
|
|
menu_delete(menu);
|
|
|
|
}
|
|
|
|
|
2009-04-13 19:29:09 +02:00
|
|
|
#define MAX_COLORS 14
|
2009-04-07 18:17:08 +02:00
|
|
|
#define VERSION "Version 1.03"
|
2009-04-06 19:26:32 +02:00
|
|
|
|
2009-04-07 18:17:08 +02:00
|
|
|
/* it's hard to choose a nice background colors ;-) */
|
2009-04-06 19:26:32 +02:00
|
|
|
static GXColor background_colors[MAX_COLORS]=
|
|
|
|
{
|
2009-04-13 19:29:09 +02:00
|
|
|
{0x00,0x00,0x00,0xff}, /* black */
|
|
|
|
{0x33,0x33,0x33,0xff}, /* dark grey */
|
|
|
|
{0x66,0x66,0x66,0xff}, /* faded grey */
|
2009-04-06 19:26:32 +02:00
|
|
|
{0xcc,0xcc,0xcc,0xff}, /* light grey */
|
2009-04-07 18:05:16 +02:00
|
|
|
{0xd4,0xd0,0xc8,0xff}, /* cream */
|
2009-04-06 19:26:32 +02:00
|
|
|
{0xb8,0xc7,0xda,0xff}, /* light blue */
|
|
|
|
{0xc0,0xcf,0xe7,0xff}, /* sky blue */
|
2009-04-07 18:05:16 +02:00
|
|
|
{0x98,0xb1,0xd8,0xff}, /* sea blue */
|
|
|
|
{0x7b,0x8c,0xa6,0xff}, /* violet */
|
|
|
|
{0xa9,0xc7,0xc6,0xff}, /* green blue */
|
|
|
|
{0x7d,0xa4,0x9f,0xff}, /* darker green blue */
|
|
|
|
{0x22,0x52,0x74,0xff}, /* dark blue */
|
|
|
|
{0xd6,0xcb,0xba,0xff}, /* light gold */
|
|
|
|
{0xbb,0xb0,0x99,0xff} /* gold */
|
2009-04-06 19:26:32 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static s8 color_cnt = 0;
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
static int menu_callback(gui_menu *menu)
|
2009-03-15 20:11:01 +01:00
|
|
|
{
|
2009-04-07 18:05:16 +02:00
|
|
|
s32 voice,old;
|
2009-03-29 20:56:36 +02:00
|
|
|
u16 p;
|
2009-03-30 22:36:04 +02:00
|
|
|
u16 max_buttons = menu->max_buttons;
|
|
|
|
u16 max_items = menu->max_items;
|
|
|
|
u16 shift = menu->shift;
|
2009-03-29 20:56:36 +02:00
|
|
|
|
|
|
|
#ifdef HW_RVL
|
2009-04-07 18:05:16 +02:00
|
|
|
int i,x,y;
|
2009-03-29 20:56:36 +02:00
|
|
|
gui_butn *button;
|
|
|
|
#endif
|
2009-03-15 20:11:01 +01:00
|
|
|
|
|
|
|
for(;;)
|
|
|
|
{
|
2009-03-29 20:56:36 +02:00
|
|
|
menu_draw(menu);
|
2009-04-07 18:05:16 +02:00
|
|
|
old = menu->selected;
|
2009-04-06 19:26:32 +02:00
|
|
|
p = m_input.keys;
|
2009-04-07 01:01:19 +02:00
|
|
|
|
|
|
|
#ifdef HW_RVL
|
2009-03-29 20:56:36 +02:00
|
|
|
if (Shutdown)
|
2009-03-15 20:11:01 +01:00
|
|
|
{
|
2009-03-29 20:56:36 +02:00
|
|
|
/* autosave SRAM/State */
|
|
|
|
memfile_autosave();
|
|
|
|
|
|
|
|
/* shutdown Wii */
|
|
|
|
DI_Close();
|
|
|
|
SYS_ResetSystem(SYS_POWEROFF, 0, 0);
|
2009-03-15 20:11:01 +01:00
|
|
|
}
|
2009-03-29 20:56:36 +02:00
|
|
|
else if (m_input.ir.valid)
|
|
|
|
{
|
|
|
|
/* get cursor position */
|
|
|
|
x = m_input.ir.x;
|
|
|
|
y = m_input.ir.y;
|
2009-03-15 20:11:01 +01:00
|
|
|
|
2009-04-06 19:26:32 +02:00
|
|
|
/* draw wiimote pointer */
|
|
|
|
gxResetCamera(m_input.ir.angle);
|
|
|
|
png_texture *texture = w_pointer[0];
|
|
|
|
DrawTexture(texture, x-texture->width/2, y-texture->height/2, texture->width, texture->height);
|
|
|
|
gxResetCamera(0.0);
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
/* check for valid buttons */
|
2009-03-30 22:36:04 +02:00
|
|
|
for (i=0; i<max_buttons; i++)
|
2009-03-29 20:56:36 +02:00
|
|
|
{
|
|
|
|
button = &menu->buttons[i];
|
|
|
|
if ((x >= button->x) && (x <= (button->x + button->w)) && (y >= button->y) && (y <= (button->y + button->h)))
|
|
|
|
{
|
|
|
|
menu->selected = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* no valid buttons */
|
2009-03-30 22:36:04 +02:00
|
|
|
if (i == max_buttons)
|
2009-03-29 20:56:36 +02:00
|
|
|
{
|
2009-03-31 09:11:25 +02:00
|
|
|
menu->selected = i + 2;
|
2009-03-29 20:56:36 +02:00
|
|
|
|
|
|
|
/* check for arrow buttons */
|
2009-03-30 22:36:04 +02:00
|
|
|
button = menu->arrows[0];
|
|
|
|
if (button)
|
2009-03-29 20:56:36 +02:00
|
|
|
{
|
2009-03-31 09:11:25 +02:00
|
|
|
if ((y <= button->y + button->h) && (x < 320))
|
2009-03-29 20:56:36 +02:00
|
|
|
menu->selected = i;
|
|
|
|
}
|
2009-03-30 22:36:04 +02:00
|
|
|
button = menu->arrows[1];
|
|
|
|
if (button)
|
2009-03-29 20:56:36 +02:00
|
|
|
{
|
2009-03-31 09:11:25 +02:00
|
|
|
if ((y >= button->y) && (x < 320))
|
2009-03-30 22:36:04 +02:00
|
|
|
menu->selected = i + 1;
|
2009-03-29 20:56:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-04-07 01:01:19 +02:00
|
|
|
#endif
|
|
|
|
|
2009-04-06 19:26:32 +02:00
|
|
|
/* copy EFB to XFB */
|
|
|
|
SetScreen ();
|
|
|
|
|
2009-03-15 20:11:01 +01:00
|
|
|
if (p & PAD_BUTTON_UP)
|
|
|
|
{
|
|
|
|
if (menu->selected == 0)
|
|
|
|
{
|
|
|
|
if (menu->offset) menu->offset --;
|
|
|
|
}
|
2009-03-30 22:36:04 +02:00
|
|
|
else if (menu->selected >= shift)
|
2009-03-15 20:11:01 +01:00
|
|
|
{
|
2009-03-30 22:36:04 +02:00
|
|
|
menu->selected -= shift;
|
2009-03-15 20:11:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p & PAD_BUTTON_DOWN)
|
|
|
|
{
|
2009-03-30 22:36:04 +02:00
|
|
|
if (menu->selected == (max_buttons - 1))
|
2009-03-15 20:11:01 +01:00
|
|
|
{
|
2009-03-30 22:36:04 +02:00
|
|
|
if ((menu->offset + menu->selected < (max_items - 1))) menu->offset ++;
|
2009-03-15 20:11:01 +01:00
|
|
|
}
|
2009-03-30 22:36:04 +02:00
|
|
|
else if ((menu->selected + shift) < max_buttons)
|
2009-03-15 20:11:01 +01:00
|
|
|
{
|
2009-03-30 22:36:04 +02:00
|
|
|
menu->selected += shift;
|
2009-03-15 20:11:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p & PAD_BUTTON_LEFT)
|
|
|
|
{
|
2009-04-13 19:29:09 +02:00
|
|
|
if (shift != 1)
|
2009-03-15 20:11:01 +01:00
|
|
|
{
|
|
|
|
menu->selected --;
|
|
|
|
if (menu->selected < 0) menu->selected = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return 0-2-menu->offset-menu->selected;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p & PAD_BUTTON_RIGHT)
|
|
|
|
{
|
2009-04-13 19:29:09 +02:00
|
|
|
if (shift != 1)
|
2009-03-15 20:11:01 +01:00
|
|
|
{
|
|
|
|
menu->selected ++;
|
2009-03-30 22:36:04 +02:00
|
|
|
if (menu->selected >= max_buttons) menu->selected = max_buttons - 1;
|
2009-03-15 20:11:01 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return (menu->offset + menu->selected);
|
|
|
|
}
|
|
|
|
}
|
2009-04-07 18:05:16 +02:00
|
|
|
|
|
|
|
/* sound fx */
|
|
|
|
if (menu->selected != old)
|
|
|
|
{
|
|
|
|
if (menu->selected < max_buttons + 2)
|
|
|
|
{
|
|
|
|
voice = ASND_GetFirstUnusedVoice();
|
|
|
|
if(voice >= 0) ASND_SetVoice(voice, VOICE_MONO_16BIT, 22050, 0, (u8 *)button_over, button_over_size, 255, 255, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* swap menu background color */
|
|
|
|
if (p & PAD_TRIGGER_R)
|
2009-04-06 19:26:32 +02:00
|
|
|
{
|
|
|
|
color_cnt++;
|
|
|
|
if (color_cnt >= MAX_COLORS) color_cnt = 0;
|
|
|
|
BACKGROUND.r = background_colors[color_cnt].r;
|
|
|
|
BACKGROUND.g = background_colors[color_cnt].g;
|
|
|
|
BACKGROUND.b = background_colors[color_cnt].b;
|
|
|
|
BACKGROUND.a = background_colors[color_cnt].a;
|
|
|
|
}
|
|
|
|
else if (p & PAD_TRIGGER_L)
|
|
|
|
{
|
2009-04-07 01:01:19 +02:00
|
|
|
color_cnt--;
|
|
|
|
if (color_cnt < 0) color_cnt = MAX_COLORS - 1;
|
|
|
|
BACKGROUND.r = background_colors[color_cnt].r;
|
|
|
|
BACKGROUND.g = background_colors[color_cnt].g;
|
|
|
|
BACKGROUND.b = background_colors[color_cnt].b;
|
|
|
|
BACKGROUND.a = background_colors[color_cnt].a;
|
2009-04-06 19:26:32 +02:00
|
|
|
}
|
2009-03-15 20:11:01 +01:00
|
|
|
|
|
|
|
if (p & PAD_BUTTON_A)
|
|
|
|
{
|
2009-04-05 20:20:43 +02:00
|
|
|
if (menu->selected < max_buttons)
|
|
|
|
{
|
2009-04-06 19:26:32 +02:00
|
|
|
voice = ASND_GetFirstUnusedVoice();
|
|
|
|
if(voice >= 0) ASND_SetVoice(voice, VOICE_MONO_16BIT, 22050, 0, (u8 *)button_select, button_select_size, 255, 255, NULL);
|
|
|
|
return (menu->offset + menu->selected);
|
2009-04-05 20:20:43 +02:00
|
|
|
}
|
2009-03-31 09:11:25 +02:00
|
|
|
else if (menu->selected == max_buttons) menu->offset --;
|
2009-03-30 22:36:04 +02:00
|
|
|
else if (menu->selected == max_buttons + 1) menu->offset ++;
|
2009-03-15 20:11:01 +01:00
|
|
|
}
|
|
|
|
else if (p & PAD_BUTTON_B)
|
|
|
|
{
|
|
|
|
return -1;
|
2009-02-22 20:57:41 +01:00
|
|
|
}
|
2009-04-05 20:20:43 +02:00
|
|
|
else if (p & PAD_TRIGGER_Z)
|
|
|
|
{
|
|
|
|
#ifdef HW_RVL
|
2009-04-13 19:29:09 +02:00
|
|
|
char *items[3] = {"Show Credits", "Exit to Loader", "Exit to System Menu"};
|
2009-04-06 19:26:32 +02:00
|
|
|
#else
|
2009-04-13 19:29:09 +02:00
|
|
|
char *items[3] = {"Show Credits", "Exit to Loader", "Reset System"};
|
2009-04-06 19:26:32 +02:00
|
|
|
#endif
|
|
|
|
switch (menu_prompt(menu, VERSION, items,3))
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
memfile_autosave();
|
|
|
|
system_shutdown();
|
|
|
|
audio_shutdown();
|
|
|
|
VIDEO_ClearFrameBuffer(vmode, xfb[whichfb], COLOR_BLACK);
|
|
|
|
VIDEO_Flush();
|
|
|
|
VIDEO_WaitVSync();
|
|
|
|
#ifdef HW_RVL
|
|
|
|
DI_Close();
|
2009-04-05 20:20:43 +02:00
|
|
|
#endif
|
2009-04-06 19:26:32 +02:00
|
|
|
exit(0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
memfile_autosave();
|
|
|
|
system_shutdown();
|
|
|
|
audio_shutdown();
|
|
|
|
VIDEO_ClearFrameBuffer(vmode, xfb[whichfb], COLOR_BLACK);
|
|
|
|
VIDEO_Flush();
|
|
|
|
VIDEO_WaitVSync();
|
|
|
|
#ifdef HW_RVL
|
|
|
|
DI_Close();
|
|
|
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
|
|
|
#else
|
|
|
|
SYS_ResetSystem(SYS_HOTRESET,0,0);
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2009-04-05 20:20:43 +02:00
|
|
|
}
|
2009-03-29 20:56:36 +02:00
|
|
|
|
|
|
|
/* update arrows status (items list) */
|
2009-03-30 22:36:04 +02:00
|
|
|
menu->arrows[0] = NULL;
|
|
|
|
menu->arrows[1] = NULL;
|
|
|
|
if (menu->offset > 0) menu->arrows[0] = &arrow_up;
|
|
|
|
if (menu->offset + max_buttons < max_items) menu->arrows[1] = &arrow_down;
|
2009-03-29 20:56:36 +02:00
|
|
|
|
|
|
|
/* update comment */
|
2009-03-30 09:05:34 +02:00
|
|
|
if (menu->helpers[1])
|
2009-03-29 20:56:36 +02:00
|
|
|
{
|
2009-03-31 09:11:25 +02:00
|
|
|
if (menu->selected < max_buttons)
|
2009-03-30 22:36:04 +02:00
|
|
|
{
|
|
|
|
gui_item *item = &menu->items[menu->offset + menu->selected];
|
2009-03-31 09:11:25 +02:00
|
|
|
strcpy(menu->helpers[1]->comment,item->comment);
|
2009-03-30 22:36:04 +02:00
|
|
|
}
|
2009-03-31 09:11:25 +02:00
|
|
|
else strcpy(menu->helpers[1]->comment,"");
|
2009-03-29 20:56:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-30 09:05:34 +02:00
|
|
|
s16 ogc_input__getMenuButtons(u32 cnt)
|
2009-03-30 15:08:01 +02:00
|
|
|
{
|
|
|
|
return m_input.keys;
|
|
|
|
}
|
|
|
|
|
2009-04-05 20:20:43 +02:00
|
|
|
void menu_updateInputs(u32 cnt)
|
2009-03-29 20:56:36 +02:00
|
|
|
{
|
|
|
|
/* get gamepad inputs */
|
|
|
|
PAD_ScanPads();
|
2009-03-30 09:05:34 +02:00
|
|
|
s16 p = PAD_ButtonsDown(0);
|
2009-03-29 20:56:36 +02:00
|
|
|
s8 x = PAD_StickX(0);
|
|
|
|
s8 y = PAD_StickY(0);
|
|
|
|
if (x > 70) p |= PAD_BUTTON_RIGHT;
|
|
|
|
else if (x < -70) p |= PAD_BUTTON_LEFT;
|
|
|
|
if (y > 60) p |= PAD_BUTTON_UP;
|
|
|
|
else if (y < -60) p |= PAD_BUTTON_DOWN;
|
|
|
|
|
|
|
|
#ifdef HW_RVL
|
|
|
|
/* get wiimote + expansions inputs */
|
|
|
|
WPAD_ScanPads();
|
|
|
|
u32 q = WPAD_ButtonsDown(0);
|
2009-03-30 09:05:34 +02:00
|
|
|
/*u32 h = WPAD_ButtonsHeld(0);*/
|
2009-03-29 20:56:36 +02:00
|
|
|
x = WPAD_StickX(0, 0);
|
|
|
|
y = WPAD_StickY(0, 0);
|
|
|
|
|
|
|
|
/* Wiimote orientation */
|
2009-03-30 09:05:34 +02:00
|
|
|
WPAD_IR(0, &m_input.ir);
|
2009-03-29 20:56:36 +02:00
|
|
|
|
|
|
|
/* wiimote directions */
|
2009-03-30 09:05:34 +02:00
|
|
|
if (m_input.ir.valid)
|
2009-03-29 20:56:36 +02:00
|
|
|
{
|
|
|
|
if (q & WPAD_BUTTON_UP) p |= PAD_BUTTON_UP;
|
|
|
|
else if (q & WPAD_BUTTON_DOWN) p |= PAD_BUTTON_DOWN;
|
|
|
|
else if (q & WPAD_BUTTON_LEFT) p |= PAD_BUTTON_LEFT;
|
|
|
|
else if (q & WPAD_BUTTON_RIGHT) p |= PAD_BUTTON_RIGHT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (q & WPAD_BUTTON_UP) p |= PAD_BUTTON_LEFT;
|
|
|
|
else if (q & WPAD_BUTTON_DOWN) p |= PAD_BUTTON_RIGHT;
|
|
|
|
else if (q & WPAD_BUTTON_LEFT) p |= PAD_BUTTON_DOWN;
|
|
|
|
else if (q & WPAD_BUTTON_RIGHT) p |= PAD_BUTTON_UP;
|
2009-02-22 20:57:41 +01:00
|
|
|
}
|
2009-03-29 20:56:36 +02:00
|
|
|
|
|
|
|
/* analog sticks */
|
|
|
|
if (y > 70) p |= PAD_BUTTON_UP;
|
|
|
|
else if (y < -70) p |= PAD_BUTTON_DOWN;
|
|
|
|
if (x < -60) p |= PAD_BUTTON_LEFT;
|
|
|
|
else if (x > 60) p |= PAD_BUTTON_RIGHT;
|
|
|
|
|
|
|
|
/* classic controller directions */
|
|
|
|
if (q & WPAD_CLASSIC_BUTTON_UP) p |= PAD_BUTTON_UP;
|
|
|
|
else if (q & WPAD_CLASSIC_BUTTON_DOWN) p |= PAD_BUTTON_DOWN;
|
|
|
|
if (q & WPAD_CLASSIC_BUTTON_LEFT) p |= PAD_BUTTON_LEFT;
|
|
|
|
else if (q & WPAD_CLASSIC_BUTTON_RIGHT) p |= PAD_BUTTON_RIGHT;
|
|
|
|
|
|
|
|
/* wiimote keys */
|
|
|
|
if (q & WPAD_BUTTON_MINUS) p |= PAD_TRIGGER_L;
|
|
|
|
if (q & WPAD_BUTTON_PLUS) p |= PAD_TRIGGER_R;
|
|
|
|
if (q & WPAD_BUTTON_A) p |= PAD_BUTTON_A;
|
|
|
|
if (q & WPAD_BUTTON_B) p |= PAD_BUTTON_B;
|
|
|
|
if (q & WPAD_BUTTON_2) p |= PAD_BUTTON_A;
|
|
|
|
if (q & WPAD_BUTTON_1) p |= PAD_BUTTON_B;
|
|
|
|
if (q & WPAD_BUTTON_HOME) p |= PAD_TRIGGER_Z;
|
|
|
|
|
|
|
|
/* classic controller keys */
|
|
|
|
if (q & WPAD_CLASSIC_BUTTON_FULL_L) p |= PAD_TRIGGER_L;
|
|
|
|
if (q & WPAD_CLASSIC_BUTTON_FULL_R) p |= PAD_TRIGGER_R;
|
|
|
|
if (q & WPAD_CLASSIC_BUTTON_A) p |= PAD_BUTTON_A;
|
|
|
|
if (q & WPAD_CLASSIC_BUTTON_B) p |= PAD_BUTTON_B;
|
|
|
|
if (q & WPAD_CLASSIC_BUTTON_HOME) p |= PAD_TRIGGER_Z;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
m_input.keys = p;
|
2009-02-22 20:57:41 +01:00
|
|
|
}
|
|
|
|
|
2009-03-15 20:11:01 +01:00
|
|
|
/***************************************************************************
|
|
|
|
* drawmenu
|
|
|
|
*
|
|
|
|
* As it says, simply draws the menu with a highlight on the currently
|
|
|
|
* selected item :)
|
|
|
|
***************************************************************************/
|
|
|
|
char menutitle[60] = { "" };
|
2009-03-30 09:05:34 +02:00
|
|
|
static int menu = 0;
|
2009-03-15 20:11:01 +01:00
|
|
|
|
2009-03-30 09:05:34 +02:00
|
|
|
static void drawmenu (char items[][25], int maxitems, int selected)
|
2008-08-07 14:26:07 +02:00
|
|
|
{
|
2009-03-15 20:11:01 +01:00
|
|
|
|
2008-08-07 14:26:07 +02:00
|
|
|
int i;
|
|
|
|
int ypos;
|
|
|
|
|
2009-02-22 20:57:41 +01:00
|
|
|
ypos = (226 - (fheight * maxitems)) >> 1;
|
2008-08-07 14:26:07 +02:00
|
|
|
ypos += 130;
|
|
|
|
|
2009-02-26 18:24:53 +01:00
|
|
|
/* reset texture data */
|
2009-03-30 15:08:01 +02:00
|
|
|
png_texture *texture;
|
2009-02-26 18:24:53 +01:00
|
|
|
memset(&texture,0,sizeof(png_texture));
|
2009-02-22 20:57:41 +01:00
|
|
|
|
2009-02-26 18:24:53 +01:00
|
|
|
/* draw background items */
|
2009-04-05 20:20:43 +02:00
|
|
|
ClearScreen ((GXColor)BACKGROUND);
|
2009-03-30 15:08:01 +02:00
|
|
|
texture= OpenTexturePNG(Background_main);
|
|
|
|
if (texture)
|
|
|
|
{
|
|
|
|
DrawTexture(texture, (640-texture->width)/2, (480-texture->height)/2, texture->width, texture->height);
|
|
|
|
if (texture->data) free(texture->data);
|
|
|
|
free(texture);
|
|
|
|
}
|
|
|
|
texture= OpenTexturePNG(Banner_bottom);
|
|
|
|
if (texture)
|
|
|
|
{
|
|
|
|
DrawTexture(texture, 0, 480-texture->height, texture->width, texture->height);
|
|
|
|
if (texture->data) free(texture->data);
|
|
|
|
free(texture);
|
|
|
|
}
|
|
|
|
texture= OpenTexturePNG(Banner_top);
|
|
|
|
if (texture)
|
|
|
|
{
|
|
|
|
DrawTexture(texture, 0, 0, texture->width, texture->height);
|
|
|
|
if (texture->data) free(texture->data);
|
|
|
|
free(texture);
|
|
|
|
}
|
|
|
|
texture= OpenTexturePNG(Main_logo);
|
|
|
|
if (texture)
|
|
|
|
{
|
|
|
|
DrawTexture(texture, 444, 28, 176, 48);
|
|
|
|
if (texture->data) free(texture->data);
|
|
|
|
free(texture);
|
|
|
|
}
|
2009-02-26 18:24:53 +01:00
|
|
|
|
2008-08-07 14:26:07 +02:00
|
|
|
for (i = 0; i < maxitems; i++)
|
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
if (i == selected) WriteCentre_HL (i * fheight + ypos, (char *) items[i]);
|
|
|
|
else WriteCentre (i * fheight + ypos, (char *) items[i]);
|
2009-02-26 18:24:53 +01:00
|
|
|
}
|
2008-08-07 14:26:07 +02:00
|
|
|
|
|
|
|
SetScreen ();
|
|
|
|
}
|
|
|
|
|
2009-03-30 09:05:34 +02:00
|
|
|
static int domenu (char items[][25], int maxitems, u8 fastmove)
|
2008-08-07 14:26:07 +02:00
|
|
|
{
|
|
|
|
int redraw = 1;
|
|
|
|
int quit = 0;
|
|
|
|
short p;
|
|
|
|
int ret = 0;
|
|
|
|
|
2009-03-15 20:11:01 +01:00
|
|
|
|
2008-08-07 14:26:07 +02:00
|
|
|
while (quit == 0)
|
|
|
|
{
|
|
|
|
if (redraw)
|
|
|
|
{
|
|
|
|
drawmenu (&items[0], maxitems, menu);
|
|
|
|
redraw = 0;
|
|
|
|
}
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
p = ogc_input__getMenuButtons(0);
|
2008-08-07 14:26:07 +02:00
|
|
|
|
|
|
|
if (p & PAD_BUTTON_UP)
|
|
|
|
{
|
|
|
|
redraw = 1;
|
|
|
|
menu--;
|
|
|
|
if (menu < 0) menu = maxitems - 1;
|
|
|
|
}
|
|
|
|
else if (p & PAD_BUTTON_DOWN)
|
|
|
|
{
|
|
|
|
redraw = 1;
|
|
|
|
menu++;
|
|
|
|
if (menu == maxitems) menu = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p & PAD_BUTTON_A)
|
|
|
|
{
|
|
|
|
quit = 1;
|
|
|
|
ret = menu;
|
|
|
|
}
|
|
|
|
else if (p & PAD_BUTTON_B)
|
|
|
|
{
|
|
|
|
quit = 1;
|
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fastmove)
|
|
|
|
{
|
|
|
|
if (p & PAD_BUTTON_RIGHT)
|
|
|
|
{
|
|
|
|
quit = 1;
|
|
|
|
ret = menu;
|
|
|
|
}
|
|
|
|
else if (p & PAD_BUTTON_LEFT)
|
|
|
|
{
|
|
|
|
quit = 1;
|
|
|
|
ret = 0 - 2 - menu;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Sound Option menu
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2009-03-30 09:05:34 +02:00
|
|
|
static void soundmenu ()
|
2008-08-07 14:26:07 +02:00
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
int ret, quit = 0;
|
|
|
|
gui_menu *m = &menu_audio;
|
|
|
|
gui_item *items = m->items;
|
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
|
|
|
|
while (quit == 0)
|
|
|
|
{
|
2009-03-15 20:11:01 +01:00
|
|
|
sprintf (items[0].text, "PSG Volume: %1.2f", (double)config.psg_preamp/100.0);
|
|
|
|
sprintf (items[1].text, "FM Volume: %1.2f", (double)config.fm_preamp/100.0);
|
|
|
|
sprintf (items[2].text, "Volume Boost: %dX", config.boost);
|
|
|
|
sprintf (items[3].text, "LowPass Filter: %s", config.filter ? " ON":"OFF");
|
|
|
|
if (config.hq_fm == 0) sprintf (items[4].text, "HQ YM2612: OFF");
|
|
|
|
else if (config.hq_fm == 1) sprintf (items[4].text, "HQ YM2612: LINEAR");
|
|
|
|
else sprintf (items[4].text, "HQ YM2612: SINC");
|
|
|
|
|
2009-03-31 09:11:25 +02:00
|
|
|
menu_initialize(m);
|
2009-03-30 09:05:34 +02:00
|
|
|
ret = menu_callback(m);
|
2009-03-31 09:11:25 +02:00
|
|
|
menu_delete(m);
|
2008-12-10 19:16:30 +01:00
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
case -2:
|
2009-02-22 20:57:41 +01:00
|
|
|
if (ret<0) config.psg_preamp --;
|
|
|
|
else config.psg_preamp ++;
|
|
|
|
if (config.psg_preamp < 0) config.psg_preamp = 500;
|
|
|
|
if (config.psg_preamp > 500) config.psg_preamp = 0;
|
2008-12-10 19:16:30 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
case -3:
|
2009-02-22 20:57:41 +01:00
|
|
|
if (ret<0) config.fm_preamp --;
|
|
|
|
else config.fm_preamp ++;
|
|
|
|
if (config.fm_preamp < 0) config.fm_preamp = 500;
|
|
|
|
if (config.fm_preamp > 500) config.fm_preamp = 0;
|
2008-12-10 19:16:30 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
config.boost ++;
|
|
|
|
if (config.boost > 4) config.boost = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
config.filter ^= 1;
|
|
|
|
break;
|
2008-08-22 17:58:49 +02:00
|
|
|
|
|
|
|
case 4:
|
2008-12-10 19:16:30 +01:00
|
|
|
config.hq_fm ++;
|
2009-02-25 17:53:28 +01:00
|
|
|
if (config.hq_fm>2) config.hq_fm = 0;
|
2008-08-17 22:17:49 +02:00
|
|
|
if (genromsize)
|
2008-12-10 19:16:30 +01:00
|
|
|
{
|
2009-02-28 18:49:31 +01:00
|
|
|
unsigned char *temp = malloc(YM2612GetContextSize());
|
|
|
|
if (!temp) break;
|
|
|
|
memcpy(temp, YM2612GetContextPtr(), YM2612GetContextSize());
|
2008-12-10 19:16:30 +01:00
|
|
|
audio_init(48000);
|
2009-02-28 18:49:31 +01:00
|
|
|
YM2612Restore(temp);
|
|
|
|
free(temp);
|
2008-12-10 19:16:30 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-08-07 14:26:07 +02:00
|
|
|
case -1:
|
2008-12-10 19:16:30 +01:00
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-08-07 14:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Misc Option menu
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2009-03-30 09:05:34 +02:00
|
|
|
static void systemmenu ()
|
2008-08-07 14:26:07 +02:00
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
int ret, quit = 0;
|
|
|
|
gui_menu *m = &menu_system;
|
|
|
|
gui_item *items = m->items;
|
|
|
|
|
|
|
|
menu_initialize(m);
|
2009-03-15 20:11:01 +01:00
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
while (quit == 0)
|
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
if (config.region_detect == 0) sprintf (items[0].text, "Console Region: AUTO");
|
|
|
|
else if (config.region_detect == 1) sprintf (items[0].text, "Console Region: USA");
|
|
|
|
else if (config.region_detect == 2) sprintf (items[0].text, "Console Region: EUR");
|
|
|
|
else if (config.region_detect == 3) sprintf (items[0].text, "Console Region: JAP");
|
|
|
|
sprintf (items[1].text, "System Lockups: %s", config.force_dtack ? "ON" : "OFF");
|
|
|
|
sprintf (items[2].text, "System BIOS: %s", (config.bios_enabled & 1) ? "ON":"OFF");
|
2009-03-15 20:11:01 +01:00
|
|
|
sprintf (items[3].text, "SVP Cycles: %d", SVP_cycles);
|
|
|
|
if (config.sram_auto == 0) sprintf (items[4].text, "Auto SRAM: FAT");
|
|
|
|
else if (config.sram_auto == 1) sprintf (items[4].text, "Auto SRAM: MCARD A");
|
|
|
|
else if (config.sram_auto == 2) sprintf (items[4].text, "Auto SRAM: MCARD B");
|
|
|
|
else sprintf (items[4].text, "Auto SRAM: OFF");
|
|
|
|
if (config.freeze_auto == 0) sprintf (items[5].text, "Auto FREEZE: FAT");
|
|
|
|
else if (config.freeze_auto == 1) sprintf (items[5].text, "Auto FREEZE: MCARD A");
|
|
|
|
else if (config.freeze_auto == 2) sprintf (items[5].text, "Auto FREEZE: MCARD B");
|
|
|
|
else sprintf (items[5].text, "Auto FREEZE: OFF");
|
|
|
|
|
2009-03-30 09:05:34 +02:00
|
|
|
ret = menu_callback(m);
|
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0: /*** Region Force ***/
|
|
|
|
config.region_detect = (config.region_detect + 1) % 4;
|
|
|
|
if (genromsize)
|
|
|
|
{
|
|
|
|
/* force region & cpu mode */
|
|
|
|
set_region();
|
|
|
|
|
|
|
|
/* reinitialize timings */
|
|
|
|
system_init ();
|
2009-02-28 18:49:31 +01:00
|
|
|
unsigned char *temp = malloc(YM2612GetContextSize());
|
|
|
|
if (temp) memcpy(temp, YM2612GetContextPtr(), YM2612GetContextSize());
|
2008-12-10 19:16:30 +01:00
|
|
|
audio_init(48000);
|
2009-02-28 18:49:31 +01:00
|
|
|
YM2612Restore(temp);
|
|
|
|
if (temp) free(temp);
|
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
/* reinitialize HVC tables */
|
|
|
|
vctab = (vdp_pal) ? ((reg[1] & 8) ? vc_pal_240 : vc_pal_224) : vc_ntsc_224;
|
|
|
|
hctab = (reg[12] & 1) ? cycle2hc40 : cycle2hc32;
|
|
|
|
|
|
|
|
/* reinitialize overscan area */
|
|
|
|
bitmap.viewport.x = config.overscan ? ((reg[12] & 1) ? 16 : 12) : 0;
|
|
|
|
bitmap.viewport.y = config.overscan ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: /*** force DTACK ***/
|
|
|
|
config.force_dtack ^= 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: /*** BIOS support ***/
|
2008-08-07 14:26:07 +02:00
|
|
|
config.bios_enabled ^= 1;
|
2008-11-13 08:24:30 +01:00
|
|
|
if (genromsize || (config.bios_enabled == 3))
|
|
|
|
{
|
2009-01-09 18:11:42 +01:00
|
|
|
system_init ();
|
2008-12-10 19:16:30 +01:00
|
|
|
audio_init(48000);
|
2008-11-13 08:24:30 +01:00
|
|
|
system_reset ();
|
2008-12-10 19:16:30 +01:00
|
|
|
}
|
2008-11-13 08:24:30 +01:00
|
|
|
break;
|
2008-08-07 14:26:07 +02:00
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
case 3: /*** SVP emulation ***/
|
|
|
|
case -5:
|
|
|
|
if (ret<0) SVP_cycles = SVP_cycles ? (SVP_cycles-1) : 1500;
|
|
|
|
else SVP_cycles++;
|
|
|
|
if (SVP_cycles > 1500) SVP_cycles = 0;
|
|
|
|
break;
|
2008-08-07 14:26:07 +02:00
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
case 4: /*** SRAM autoload/autosave ***/
|
|
|
|
config.sram_auto ++;
|
2008-08-07 14:26:07 +02:00
|
|
|
if (config.sram_auto > 2) config.sram_auto = -1;
|
|
|
|
break;
|
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
case 5: /*** FreezeState autoload/autosave ***/
|
2008-08-07 14:26:07 +02:00
|
|
|
config.freeze_auto ++;
|
|
|
|
if (config.freeze_auto > 2) config.freeze_auto = -1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case -1:
|
2008-12-10 19:16:30 +01:00
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-03-30 09:05:34 +02:00
|
|
|
menu_delete(m);
|
2008-08-07 14:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Display Option menu
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2009-03-30 09:05:34 +02:00
|
|
|
static void videomenu ()
|
2008-08-07 14:26:07 +02:00
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
int ret, quit = 0;
|
|
|
|
gui_menu *m = &menu_video;
|
|
|
|
gui_item *items = m->items;
|
|
|
|
|
|
|
|
menu_initialize(m);
|
2008-08-07 14:26:07 +02:00
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
while (quit == 0)
|
|
|
|
{
|
2009-03-22 13:23:30 +01:00
|
|
|
sprintf (items[0].text, "Aspect: %s", config.aspect ? "ORIGINAL" : "STRETCHED");
|
|
|
|
if (config.render == 1) sprintf (items[1].text,"Display: INTERLACED");
|
|
|
|
else if (config.render == 2) sprintf (items[1].text, "Display: PROGRESSIVE");
|
|
|
|
else sprintf (items[1].text, "Display: ORIGINAL");
|
2009-03-15 20:11:01 +01:00
|
|
|
if (config.tv_mode == 0) sprintf (items[2].text, "TV Mode: 60HZ");
|
|
|
|
else if (config.tv_mode == 1) sprintf (items[2].text, "TV Mode: 50HZ");
|
|
|
|
else sprintf (items[2].text, "TV Mode: 50/60HZ");
|
|
|
|
sprintf (items[3].text, "Bilinear Filter: %s", config.bilinear ? " ON" : "OFF");
|
|
|
|
if (config.ntsc == 1) sprintf (items[4].text, "NTSC Filter: COMPOSITE");
|
|
|
|
else if (config.ntsc == 2) sprintf (items[4].text, "NTSC Filter: S-VIDEO");
|
|
|
|
else if (config.ntsc == 3) sprintf (items[4].text, "NTSC Filter: RGB");
|
|
|
|
else sprintf (items[4].text, "NTSC Filter: OFF");
|
|
|
|
sprintf (items[5].text, "Borders: %s", config.overscan ? " ON" : "OFF");
|
|
|
|
|
2009-03-30 09:05:34 +02:00
|
|
|
ret = menu_callback(m);
|
2008-12-10 19:16:30 +01:00
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0: /*** config.aspect ratio ***/
|
|
|
|
config.aspect ^= 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: /*** rendering ***/
|
|
|
|
config.render = (config.render + 1) % 3;
|
|
|
|
if (config.render == 2)
|
|
|
|
{
|
|
|
|
if (VIDEO_HaveComponentCable())
|
|
|
|
{
|
2008-08-07 14:26:07 +02:00
|
|
|
/* progressive mode (60hz only) */
|
|
|
|
config.tv_mode = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* do nothing if component cable is not detected */
|
|
|
|
config.render = 0;
|
|
|
|
}
|
2008-12-10 19:16:30 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: /*** tv mode ***/
|
2009-03-30 09:05:34 +02:00
|
|
|
if (config.render != 2) config.tv_mode = (config.tv_mode + 1) % 3;
|
2008-12-10 19:16:30 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: /*** bilinear filtering ***/
|
|
|
|
config.bilinear ^= 1;
|
|
|
|
break;
|
2008-10-20 17:50:13 +02:00
|
|
|
|
2008-10-24 18:14:54 +02:00
|
|
|
case 4: /*** NTSC filter ***/
|
2008-12-10 19:16:30 +01:00
|
|
|
config.ntsc ++;
|
2008-10-02 22:22:53 +02:00
|
|
|
if (config.ntsc > 3) config.ntsc = 0;
|
2008-12-10 19:16:30 +01:00
|
|
|
break;
|
2008-10-03 16:14:20 +02:00
|
|
|
|
2008-10-24 18:14:54 +02:00
|
|
|
case 5: /*** overscan emulation ***/
|
2008-12-10 19:16:30 +01:00
|
|
|
config.overscan ^= 1;
|
|
|
|
bitmap.viewport.x = config.overscan ? ((reg[12] & 1) ? 16 : 12) : 0;
|
|
|
|
bitmap.viewport.y = config.overscan ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
|
|
|
|
break;
|
|
|
|
|
2009-03-15 20:11:01 +01:00
|
|
|
/* case 6:
|
2008-12-10 19:16:30 +01:00
|
|
|
case -8:
|
|
|
|
if (ret<0) config.xshift --;
|
|
|
|
else config.xshift ++;
|
|
|
|
break;
|
|
|
|
|
2009-03-15 20:11:01 +01:00
|
|
|
case 7:
|
2008-12-10 19:16:30 +01:00
|
|
|
case -9:
|
|
|
|
if (ret<0) config.yshift --;
|
|
|
|
else config.yshift ++;
|
|
|
|
break;
|
|
|
|
|
2009-03-15 20:11:01 +01:00
|
|
|
case 8:
|
2008-12-10 19:16:30 +01:00
|
|
|
case -10:
|
|
|
|
if (config.aspect) break;
|
2008-10-20 17:50:13 +02:00
|
|
|
if (ret<0) config.xscale --;
|
2008-12-10 19:16:30 +01:00
|
|
|
else config.xscale ++;
|
|
|
|
break;
|
|
|
|
|
2009-03-15 20:11:01 +01:00
|
|
|
case 9:
|
2008-12-10 19:16:30 +01:00
|
|
|
case -11:
|
|
|
|
if (config.aspect) break;
|
|
|
|
if (ret<0) config.yscale --;
|
|
|
|
else config.yscale ++;
|
|
|
|
break;
|
2009-03-15 20:11:01 +01:00
|
|
|
*/
|
2008-12-10 19:16:30 +01:00
|
|
|
case -1:
|
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-03-30 09:05:34 +02:00
|
|
|
menu_delete(m);
|
2008-08-07 14:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* ConfigureJoypads
|
|
|
|
****************************************************************************/
|
2008-08-26 18:00:43 +02:00
|
|
|
extern int old_system[2];
|
2009-03-30 09:05:34 +02:00
|
|
|
static void inputsmenu(void)
|
2008-08-07 14:26:07 +02:00
|
|
|
{
|
2008-12-10 19:16:30 +01:00
|
|
|
int ret, max_players;
|
|
|
|
int i = 0;
|
2008-08-07 14:26:07 +02:00
|
|
|
int quit = 0;
|
2008-12-10 19:16:30 +01:00
|
|
|
int prevmenu = menu;
|
2008-10-02 22:22:53 +02:00
|
|
|
char padmenu[8][25];
|
2008-08-07 14:26:07 +02:00
|
|
|
|
|
|
|
int player = 0;
|
|
|
|
#ifdef HW_RVL
|
|
|
|
u32 exp;
|
|
|
|
#endif
|
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
strcpy (menutitle, "Press B to return");
|
2008-08-07 14:26:07 +02:00
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
menu = 0;
|
|
|
|
while (quit == 0)
|
|
|
|
{
|
2008-08-07 14:26:07 +02:00
|
|
|
/* update max players */
|
|
|
|
max_players = 0;
|
|
|
|
if (input.system[0] == SYSTEM_GAMEPAD)
|
|
|
|
{
|
|
|
|
sprintf (padmenu[0], "Port 1: GAMEPAD");
|
|
|
|
max_players ++;
|
|
|
|
}
|
2008-08-10 22:40:04 +02:00
|
|
|
else if (input.system[0] == SYSTEM_MOUSE)
|
|
|
|
{
|
|
|
|
sprintf (padmenu[0], "Port 1: MOUSE");
|
|
|
|
max_players ++;
|
|
|
|
}
|
2008-08-07 14:26:07 +02:00
|
|
|
else if (input.system[0] == SYSTEM_WAYPLAY)
|
|
|
|
{
|
|
|
|
sprintf (padmenu[0], "Port 1: 4-WAYPLAY");
|
|
|
|
max_players += 4;
|
|
|
|
}
|
|
|
|
else if (input.system[0] == SYSTEM_TEAMPLAYER)
|
|
|
|
{
|
|
|
|
sprintf (padmenu[0], "Port 1: TEAMPLAYER");
|
|
|
|
max_players += 4;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sprintf (padmenu[0], "Port 1: NONE");
|
|
|
|
|
|
|
|
if (input.system[1] == SYSTEM_GAMEPAD)
|
|
|
|
{
|
|
|
|
sprintf (padmenu[1], "Port 2: GAMEPAD");
|
|
|
|
max_players ++;
|
|
|
|
}
|
2008-08-13 14:47:56 +02:00
|
|
|
else if (input.system[1] == SYSTEM_MOUSE)
|
2008-08-11 20:02:04 +02:00
|
|
|
{
|
2008-08-13 14:47:56 +02:00
|
|
|
sprintf (padmenu[1], "Port 2: MOUSE");
|
2008-08-11 20:02:04 +02:00
|
|
|
max_players ++;
|
|
|
|
}
|
2008-08-07 14:26:07 +02:00
|
|
|
else if (input.system[1] == SYSTEM_WAYPLAY)
|
|
|
|
{
|
|
|
|
sprintf (padmenu[1], "Port 2: 4-WAYPLAY");
|
|
|
|
}
|
|
|
|
else if (input.system[1] == SYSTEM_TEAMPLAYER)
|
|
|
|
{
|
|
|
|
sprintf (padmenu[1], "Port 2: TEAMPLAYER");
|
|
|
|
max_players += 4;
|
|
|
|
}
|
|
|
|
else if (input.system[1] == SYSTEM_MENACER)
|
|
|
|
{
|
|
|
|
sprintf (padmenu[1], "Port 2: MENACER");
|
|
|
|
max_players += 1;
|
|
|
|
}
|
|
|
|
else if (input.system[1] == SYSTEM_JUSTIFIER)
|
|
|
|
{
|
|
|
|
sprintf (padmenu[1], "Port 2: JUSTIFIERS");
|
2008-08-11 20:02:04 +02:00
|
|
|
max_players += 2;
|
2008-08-07 14:26:07 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
sprintf (padmenu[1], "Port 2: NONE");
|
|
|
|
|
|
|
|
/* JCART special case */
|
|
|
|
if (j_cart) max_players +=2;
|
|
|
|
|
|
|
|
/* reset current player nr */
|
|
|
|
if (player >= max_players)
|
|
|
|
{
|
|
|
|
/* remove duplicate assigned inputs */
|
|
|
|
if ((0!=player) && (config.input[0].device == config.input[player].device) && (config.input[0].port == config.input[player].port))
|
|
|
|
{
|
|
|
|
config.input[0].device = -1;
|
|
|
|
config.input[0].port = i%4;
|
|
|
|
}
|
|
|
|
player = 0;
|
|
|
|
}
|
|
|
|
|
2008-08-12 18:20:43 +02:00
|
|
|
sprintf (padmenu[2], "Gun Cursor: %s", config.gun_cursor ? " ON":"OFF");
|
|
|
|
sprintf (padmenu[3], "Invert Mouse: %s", config.invert_mouse ? " ON":"OFF");
|
2008-08-10 22:40:04 +02:00
|
|
|
sprintf (padmenu[4], "Set Player: %d%s", player + 1, (j_cart && (player > 1)) ? "-JCART" : "");
|
2008-08-07 14:26:07 +02:00
|
|
|
|
|
|
|
if (config.input[player].device == 0)
|
2008-08-10 22:40:04 +02:00
|
|
|
sprintf (padmenu[5], "Device: GAMECUBE %d", config.input[player].port + 1);
|
2008-08-07 14:26:07 +02:00
|
|
|
#ifdef HW_RVL
|
|
|
|
else if (config.input[player].device == 1)
|
2008-08-10 22:40:04 +02:00
|
|
|
sprintf (padmenu[5], "Device: WIIMOTE %d", config.input[player].port + 1);
|
2008-08-07 14:26:07 +02:00
|
|
|
else if (config.input[player].device == 2)
|
2008-08-10 22:40:04 +02:00
|
|
|
sprintf (padmenu[5], "Device: NUNCHUK %d", config.input[player].port + 1);
|
2008-08-07 14:26:07 +02:00
|
|
|
else if (config.input[player].device == 3)
|
2008-08-10 22:40:04 +02:00
|
|
|
sprintf (padmenu[5], "Device: CLASSIC %d", config.input[player].port + 1);
|
2008-08-07 14:26:07 +02:00
|
|
|
#endif
|
|
|
|
else
|
2008-08-10 22:40:04 +02:00
|
|
|
sprintf (padmenu[5], "Device: NONE");
|
2008-08-07 14:26:07 +02:00
|
|
|
|
|
|
|
/* when using wiimote, force to 3Buttons pad */
|
|
|
|
if (config.input[player].device == 1) input.padtype[player] = DEVICE_3BUTTON;
|
2008-08-10 22:40:04 +02:00
|
|
|
sprintf (padmenu[6], "%s", (input.padtype[player] == DEVICE_3BUTTON) ? "Type: 3BUTTONS":"Type: 6BUTTONS");
|
2008-08-07 14:26:07 +02:00
|
|
|
|
2008-08-10 22:40:04 +02:00
|
|
|
sprintf (padmenu[7], "Configure Input");
|
2008-08-07 14:26:07 +02:00
|
|
|
|
2008-08-10 22:40:04 +02:00
|
|
|
ret = domenu (&padmenu[0], 8,0);
|
2008-08-07 14:26:07 +02:00
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0:
|
2008-08-07 14:26:07 +02:00
|
|
|
if (j_cart)
|
|
|
|
{
|
|
|
|
WaitPrompt("JCART detected !");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
input.system[0] ++;
|
2008-08-13 14:47:56 +02:00
|
|
|
if (input.system[0] == SYSTEM_MENACER) input.system[0] ++;
|
|
|
|
if (input.system[0] == SYSTEM_JUSTIFIER) input.system[0] ++;
|
|
|
|
if ((input.system[0] == SYSTEM_MOUSE) && (input.system[1] == SYSTEM_MOUSE)) input.system[0] ++;
|
|
|
|
if (input.system[0] == SYSTEM_WAYPLAY) input.system[1] = SYSTEM_WAYPLAY;
|
|
|
|
if (input.system[0] > SYSTEM_WAYPLAY)
|
2008-08-07 14:26:07 +02:00
|
|
|
{
|
|
|
|
input.system[0] = NO_SYSTEM;
|
|
|
|
input.system[1] = SYSTEM_GAMEPAD;
|
|
|
|
}
|
2008-08-18 18:02:16 +02:00
|
|
|
io_reset();
|
2008-08-26 18:00:43 +02:00
|
|
|
old_system[0] = input.system[0];
|
|
|
|
old_system[1] = input.system[1];
|
2008-12-10 19:16:30 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2008-08-07 14:26:07 +02:00
|
|
|
if (j_cart)
|
|
|
|
{
|
|
|
|
WaitPrompt("JCART detected !");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
input.system[1] ++;
|
2008-08-13 14:47:56 +02:00
|
|
|
if ((input.system[0] == SYSTEM_MOUSE) && (input.system[1] == SYSTEM_MOUSE)) input.system[1] ++;
|
|
|
|
if (input.system[1] == SYSTEM_WAYPLAY) input.system[0] = SYSTEM_WAYPLAY;
|
|
|
|
if (input.system[1] > SYSTEM_WAYPLAY)
|
2008-08-07 14:26:07 +02:00
|
|
|
{
|
|
|
|
input.system[1] = NO_SYSTEM;
|
|
|
|
input.system[0] = SYSTEM_GAMEPAD;
|
|
|
|
}
|
2008-08-18 18:02:16 +02:00
|
|
|
io_reset();
|
2008-08-26 18:00:43 +02:00
|
|
|
old_system[0] = input.system[0];
|
|
|
|
old_system[1] = input.system[1];
|
2008-12-10 19:16:30 +01:00
|
|
|
break;
|
2008-08-07 14:26:07 +02:00
|
|
|
|
|
|
|
case 2:
|
2008-08-10 22:40:04 +02:00
|
|
|
config.gun_cursor ^= 1;
|
2008-08-07 14:26:07 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2008-08-10 22:40:04 +02:00
|
|
|
config.invert_mouse ^= 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
2008-08-07 14:26:07 +02:00
|
|
|
/* remove duplicate assigned inputs */
|
|
|
|
for (i=0; i<8; i++)
|
|
|
|
{
|
|
|
|
if ((i!=player) && (config.input[i].device == config.input[player].device) && (config.input[i].port == config.input[player].port))
|
|
|
|
{
|
|
|
|
config.input[i].device = -1;
|
|
|
|
config.input[i].port = i%4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
player = (player + 1) % max_players;
|
|
|
|
break;
|
|
|
|
|
2008-08-10 22:40:04 +02:00
|
|
|
case 5:
|
2008-08-07 14:26:07 +02:00
|
|
|
#ifdef HW_RVL
|
2008-08-11 20:02:04 +02:00
|
|
|
if (config.input[player].device > 0)
|
2008-08-07 14:26:07 +02:00
|
|
|
{
|
|
|
|
config.input[player].port ++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
config.input[player].device ++;
|
|
|
|
if (config.input[player].device == 1) config.input[player].port = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (config.input[player].device == 1)
|
|
|
|
{
|
|
|
|
exp = 4;
|
|
|
|
if (config.input[player].port<4)
|
|
|
|
{
|
|
|
|
WPAD_Probe(config.input[player].port,&exp);
|
2008-08-11 20:02:04 +02:00
|
|
|
if (exp == WPAD_EXP_NUNCHUK) exp = 4;
|
2008-08-07 14:26:07 +02:00
|
|
|
}
|
|
|
|
|
2008-08-11 20:02:04 +02:00
|
|
|
while ((config.input[player].port<4) && (exp == 4))
|
2008-08-07 14:26:07 +02:00
|
|
|
{
|
|
|
|
config.input[player].port ++;
|
|
|
|
if (config.input[player].port<4)
|
|
|
|
{
|
|
|
|
exp = 4;
|
|
|
|
WPAD_Probe(config.input[player].port,&exp);
|
2008-08-11 20:02:04 +02:00
|
|
|
if (exp == WPAD_EXP_NUNCHUK) exp = 4;
|
2008-08-07 14:26:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (config.input[player].port >= 4)
|
|
|
|
{
|
2008-08-11 20:02:04 +02:00
|
|
|
config.input[player].port = 0;
|
2008-08-07 14:26:07 +02:00
|
|
|
config.input[player].device = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (config.input[player].device == 2)
|
|
|
|
{
|
|
|
|
exp = 4;
|
2008-08-11 20:02:04 +02:00
|
|
|
if (config.input[player].port<4)
|
|
|
|
{
|
|
|
|
WPAD_Probe(config.input[player].port,&exp);
|
|
|
|
}
|
|
|
|
|
|
|
|
while ((config.input[player].port<4) && (exp != WPAD_EXP_NUNCHUK))
|
|
|
|
{
|
|
|
|
config.input[player].port ++;
|
|
|
|
if (config.input[player].port<4)
|
|
|
|
{
|
|
|
|
exp = 4;
|
|
|
|
WPAD_Probe(config.input[player].port,&exp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (config.input[player].port >= 4)
|
|
|
|
{
|
|
|
|
config.input[player].port = 0;
|
|
|
|
config.input[player].device = 3;
|
|
|
|
}
|
2008-08-07 14:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (config.input[player].device == 3)
|
|
|
|
{
|
|
|
|
exp = 4;
|
2008-08-11 20:02:04 +02:00
|
|
|
if (config.input[player].port<4)
|
|
|
|
{
|
|
|
|
WPAD_Probe(config.input[player].port,&exp);
|
|
|
|
}
|
2008-08-07 14:26:07 +02:00
|
|
|
|
2008-08-11 20:02:04 +02:00
|
|
|
while ((config.input[player].port<4) && (exp != WPAD_EXP_CLASSIC))
|
|
|
|
{
|
|
|
|
config.input[player].port ++;
|
|
|
|
if (config.input[player].port<4)
|
|
|
|
{
|
|
|
|
exp = 4;
|
|
|
|
WPAD_Probe(config.input[player].port,&exp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (config.input[player].port >= 4)
|
|
|
|
{
|
|
|
|
config.input[player].port = player % 4;
|
|
|
|
config.input[player].device = 0;
|
|
|
|
}
|
2008-08-07 14:26:07 +02:00
|
|
|
}
|
|
|
|
#else
|
2008-08-11 20:02:04 +02:00
|
|
|
config.input[player].device = 0;
|
2008-08-07 14:26:07 +02:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
case 6:
|
2008-08-07 14:26:07 +02:00
|
|
|
if (config.input[player].device == 1) break;
|
|
|
|
input.padtype[player] ^= 1;
|
2008-08-18 18:02:16 +02:00
|
|
|
io_reset();
|
2008-08-07 14:26:07 +02:00
|
|
|
break;
|
|
|
|
|
2008-08-10 22:40:04 +02:00
|
|
|
case 7:
|
2008-12-12 14:27:38 +01:00
|
|
|
if (config.input[player].device < 0) break;
|
2009-04-05 20:20:43 +02:00
|
|
|
ogc_input_config(config.input[player].port, config.input[player].device, input.padtype[player]);
|
2008-08-07 14:26:07 +02:00
|
|
|
break;
|
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
case -1:
|
2008-08-07 14:26:07 +02:00
|
|
|
/* remove duplicate assigned inputs */
|
|
|
|
for (i=0; i<8; i++)
|
|
|
|
{
|
|
|
|
if ((i!=player) && (config.input[i].device == config.input[player].device) && (config.input[i].port == config.input[player].port))
|
|
|
|
{
|
|
|
|
config.input[i].device = -1;
|
|
|
|
config.input[i].port = i%4;
|
|
|
|
}
|
|
|
|
}
|
2008-12-10 19:16:30 +01:00
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-08-07 14:26:07 +02:00
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
menu = prevmenu;
|
2008-08-07 14:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Main Option menu
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2009-03-30 09:05:34 +02:00
|
|
|
static void optionmenu(void)
|
2008-08-07 14:26:07 +02:00
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
int ret, quit = 0;
|
|
|
|
gui_menu *m = &menu_options;
|
2008-12-10 19:16:30 +01:00
|
|
|
|
|
|
|
while (quit == 0)
|
2008-08-07 14:26:07 +02:00
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
menu_initialize(m);
|
|
|
|
ret = menu_callback(m);
|
|
|
|
menu_delete(m);
|
2008-12-10 19:16:30 +01:00
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0:
|
2009-03-30 09:05:34 +02:00
|
|
|
systemmenu();
|
2008-12-10 19:16:30 +01:00
|
|
|
break;
|
|
|
|
case 1:
|
2009-03-30 09:05:34 +02:00
|
|
|
videomenu();
|
2008-12-10 19:16:30 +01:00
|
|
|
break;
|
|
|
|
case 2:
|
2009-03-15 20:11:01 +01:00
|
|
|
soundmenu();
|
2008-12-10 19:16:30 +01:00
|
|
|
break;
|
|
|
|
case 3:
|
2009-03-30 09:05:34 +02:00
|
|
|
inputsmenu();
|
2008-12-10 19:16:30 +01:00
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
GetGGEntries();
|
|
|
|
break;
|
|
|
|
case -1:
|
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-08-07 14:26:07 +02:00
|
|
|
|
|
|
|
config_save();
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Generic Load/Save menu
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
static u8 device = 0;
|
|
|
|
|
2009-03-30 09:05:34 +02:00
|
|
|
static int loadsavemenu (int which)
|
2008-08-07 14:26:07 +02:00
|
|
|
{
|
2008-12-10 19:16:30 +01:00
|
|
|
int prevmenu = menu;
|
|
|
|
int quit = 0;
|
|
|
|
int ret;
|
|
|
|
int count = 3;
|
|
|
|
char items[3][25];
|
2008-08-07 14:26:07 +02:00
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
menu = 2;
|
2008-08-07 14:26:07 +02:00
|
|
|
|
|
|
|
if (which == 1)
|
|
|
|
{
|
|
|
|
sprintf(items[1], "Save State");
|
|
|
|
sprintf(items[2], "Load State");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprintf(items[1], "Save SRAM");
|
|
|
|
sprintf(items[2], "Load SRAM");
|
|
|
|
}
|
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
while (quit == 0)
|
|
|
|
{
|
2008-12-12 16:38:04 +01:00
|
|
|
if (device == 0) sprintf(items[0], "Device: FAT");
|
2008-08-07 14:26:07 +02:00
|
|
|
else if (device == 1) sprintf(items[0], "Device: MCARD A");
|
|
|
|
else if (device == 2) sprintf(items[0], "Device: MCARD B");
|
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
ret = domenu (&items[0], count, 0);
|
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case -1:
|
|
|
|
quit = 1;
|
|
|
|
break;
|
2008-08-07 14:26:07 +02:00
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
case 0:
|
2008-08-07 14:26:07 +02:00
|
|
|
device = (device + 1)%3;
|
2008-10-23 22:38:06 +02:00
|
|
|
break;
|
2008-08-07 14:26:07 +02:00
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
case 1:
|
|
|
|
case 2:
|
|
|
|
if (which == 1) quit = ManageState(ret-1,device);
|
|
|
|
else if (which == 0) quit = ManageSRAM(ret-1,device);
|
|
|
|
if (quit) return 1;
|
2008-08-07 14:26:07 +02:00
|
|
|
break;
|
2008-12-10 19:16:30 +01:00
|
|
|
}
|
|
|
|
}
|
2008-08-07 14:26:07 +02:00
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
menu = prevmenu;
|
|
|
|
return 0;
|
2008-08-07 14:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* File Manager menu
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2009-03-30 09:05:34 +02:00
|
|
|
static int filemenu ()
|
2008-08-07 14:26:07 +02:00
|
|
|
{
|
2008-12-10 19:16:30 +01:00
|
|
|
int prevmenu = menu;
|
|
|
|
int ret;
|
|
|
|
int quit = 0;
|
|
|
|
int count = 2;
|
|
|
|
char items[2][25] = {
|
|
|
|
{"SRAM Manager"},
|
|
|
|
{"STATE Manager"}
|
|
|
|
};
|
|
|
|
|
|
|
|
menu = 0;
|
|
|
|
|
|
|
|
while (quit == 0)
|
|
|
|
{
|
|
|
|
strcpy (menutitle, "Press B to return");
|
|
|
|
ret = domenu (&items[0], count, 0);
|
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case -1: /*** Button B ***/
|
|
|
|
ret = 0;
|
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0: /*** SRAM Manager ***/
|
|
|
|
case 1: /*** SaveState Manager ***/
|
|
|
|
if (loadsavemenu(ret)) return 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
menu = prevmenu;
|
|
|
|
return 0;
|
2008-08-07 14:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Load Rom menu
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2008-12-14 13:38:52 +01:00
|
|
|
extern char rom_filename[MAXJOLIET];
|
2008-08-07 14:26:07 +02:00
|
|
|
static u8 load_menu = 0;
|
|
|
|
|
2009-03-30 09:05:34 +02:00
|
|
|
static int loadmenu ()
|
2008-08-07 14:26:07 +02:00
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
int ret,size,quit = 0;
|
|
|
|
gui_menu *m = &menu_load;
|
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
while (quit == 0)
|
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
menu_initialize(m);
|
|
|
|
ret = menu_callback(m);
|
|
|
|
menu_delete(m);
|
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
/*** Button B ***/
|
2008-12-08 18:26:50 +01:00
|
|
|
case -1:
|
2008-12-10 19:16:30 +01:00
|
|
|
quit = 1;
|
2008-12-08 18:26:50 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
/*** Load from DVD ***/
|
|
|
|
#ifdef HW_RVL
|
|
|
|
case 3:
|
|
|
|
#else
|
2008-10-23 22:38:06 +02:00
|
|
|
case 2:
|
2008-12-08 18:26:50 +01:00
|
|
|
#endif
|
2008-12-10 19:16:30 +01:00
|
|
|
load_menu = menu;
|
2008-12-11 18:38:29 +01:00
|
|
|
size = DVD_Open(cart_rom);
|
|
|
|
if (size)
|
2008-11-13 08:24:30 +01:00
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
dvd_motor_off();
|
2008-12-11 18:38:29 +01:00
|
|
|
genromsize = size;
|
|
|
|
memfile_autosave();
|
|
|
|
reloadrom();
|
2008-12-14 13:38:52 +01:00
|
|
|
sprintf(rom_filename,"%s",filelist[selection].filename);
|
|
|
|
rom_filename[strlen(rom_filename) - 4] = 0;
|
|
|
|
memfile_autoload();
|
2008-11-13 08:24:30 +01:00
|
|
|
return 1;
|
|
|
|
}
|
2008-08-07 14:26:07 +02:00
|
|
|
break;
|
2008-11-13 08:24:30 +01:00
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
/*** Load from FAT device ***/
|
|
|
|
default:
|
|
|
|
load_menu = menu;
|
2008-12-11 18:38:29 +01:00
|
|
|
size = FAT_Open(ret,cart_rom);
|
|
|
|
if (size)
|
|
|
|
{
|
|
|
|
memfile_autosave();
|
2008-12-14 13:38:52 +01:00
|
|
|
genromsize = size;
|
2008-12-11 18:38:29 +01:00
|
|
|
reloadrom();
|
2008-12-14 13:38:52 +01:00
|
|
|
sprintf(rom_filename,"%s",filelist[selection].filename);
|
|
|
|
rom_filename[strlen(rom_filename) - 4] = 0;
|
|
|
|
memfile_autoload();
|
2008-12-11 18:38:29 +01:00
|
|
|
return 1;
|
|
|
|
}
|
2008-12-04 20:32:22 +01:00
|
|
|
break;
|
2008-08-20 22:25:17 +02:00
|
|
|
}
|
2008-12-10 19:16:30 +01:00
|
|
|
}
|
2008-08-07 14:26:07 +02:00
|
|
|
|
2008-11-13 08:24:30 +01:00
|
|
|
return 0;
|
2008-08-07 14:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* Show rom info screen
|
|
|
|
***************************************************************************/
|
2009-03-30 09:05:34 +02:00
|
|
|
static void showrominfo ()
|
2008-08-07 14:26:07 +02:00
|
|
|
{
|
|
|
|
int ypos;
|
|
|
|
u8 i,j,quit,redraw,max;
|
|
|
|
char msg[128];
|
|
|
|
short p;
|
|
|
|
char pName[14][21];
|
|
|
|
|
|
|
|
quit = 0;
|
|
|
|
j = 0;
|
|
|
|
redraw = 1;
|
|
|
|
|
|
|
|
/*** Remove any still held buttons ***/
|
|
|
|
while (PAD_ButtonsHeld(0)) PAD_ScanPads();
|
|
|
|
#ifdef HW_RVL
|
|
|
|
while (WPAD_ButtonsHeld(0)) WPAD_ScanPads();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
max = 14;
|
|
|
|
for (i = 0; i < 14; i++)
|
|
|
|
{
|
2008-12-10 19:16:30 +01:00
|
|
|
if (peripherals & (1 << i))
|
|
|
|
{
|
|
|
|
sprintf(pName[max-14],"%s", peripheralinfo[i].pName);
|
|
|
|
max ++;
|
|
|
|
}
|
2008-08-07 14:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
while (quit == 0)
|
|
|
|
{
|
2009-02-22 20:57:41 +01:00
|
|
|
if (redraw)
|
|
|
|
{
|
2009-04-05 20:20:43 +02:00
|
|
|
ClearScreen ((GXColor)BACKGROUND);
|
2008-12-10 19:16:30 +01:00
|
|
|
|
|
|
|
ypos = 134;
|
|
|
|
WriteCentre(ypos, "ROM Header Information");
|
|
|
|
ypos += 2*fheight;
|
|
|
|
|
|
|
|
for (i=0; i<8; i++)
|
|
|
|
{
|
|
|
|
switch (i+j)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
sprintf (msg, "Console type: %s", rominfo.consoletype);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
sprintf (msg, "Copyright: %s", rominfo.copyright);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
sprintf (msg, "Company: %s", companyinfo[getcompany ()].company);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
sprintf (msg, "Game Domestic Name:");
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
sprintf(msg, " %s",rominfo.domestic);
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
sprintf (msg, "Game International Name:");
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
sprintf(msg, " %s",rominfo.international);
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
sprintf (msg, "Type - %s : %s", rominfo.ROMType, strcmp (rominfo.ROMType, "AI") ? "Game" : "Educational");
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
sprintf (msg, "Product - %s", rominfo.product);
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
sprintf (msg, "Checksum - %04x (%04x) (%s)", rominfo.checksum, realchecksum, (rominfo.checksum == realchecksum) ? "Good" : "Bad");
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
sprintf (msg, "ROM end: $%06X", rominfo.romend);
|
|
|
|
break;
|
|
|
|
case 11:
|
|
|
|
if (svp) sprintf (msg, "SVP Chip detected");
|
|
|
|
else if (sram.custom) sprintf (msg, "EEPROM(%dK) - $%06X", ((eeprom.type.size_mask+1)* 8) /1024, (unsigned int)sram.start);
|
|
|
|
else if (sram.detected) sprintf (msg, "SRAM Start - $%06X", sram.start);
|
|
|
|
else sprintf (msg, "External RAM undetected");
|
|
|
|
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
if (sram.custom) sprintf (msg, "EEPROM(%dK) - $%06X", ((eeprom.type.size_mask+1)* 8) /1024, (unsigned int)sram.end);
|
|
|
|
else if (sram.detected) sprintf (msg, "SRAM End - $%06X", sram.end);
|
|
|
|
else if (sram.on) sprintf (msg, "Default SRAM activated ");
|
|
|
|
else sprintf (msg, "SRAM is disactivated ");
|
|
|
|
break;
|
|
|
|
case 13:
|
|
|
|
if (region_code == REGION_USA) sprintf (msg, "Region - %s (USA)", rominfo.country);
|
|
|
|
else if (region_code == REGION_EUROPE) sprintf (msg, "Region - %s (EUR)", rominfo.country);
|
|
|
|
else if (region_code == REGION_JAPAN_NTSC) sprintf (msg, "Region - %s (JAP)", rominfo.country);
|
|
|
|
else if (region_code == REGION_JAPAN_PAL) sprintf (msg, "Region - %s (JPAL)", rominfo.country);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sprintf (msg, "Supports - %s", pName[i+j-14]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
write_font (100, ypos, msg);
|
|
|
|
ypos += fheight;
|
|
|
|
}
|
|
|
|
|
|
|
|
ypos += fheight;
|
|
|
|
WriteCentre (ypos, "Press A to Continue");
|
|
|
|
SetScreen ();
|
|
|
|
}
|
|
|
|
|
2009-03-29 20:56:36 +02:00
|
|
|
p = ogc_input__getMenuButtons(0);
|
2008-12-10 19:16:30 +01:00
|
|
|
redraw = 0;
|
|
|
|
|
|
|
|
if ((j<(max-8)) && (p & PAD_BUTTON_DOWN)) {redraw = 1; j++;}
|
|
|
|
if ((j>0) && (p & PAD_BUTTON_UP)) {redraw = 1; j--;}
|
|
|
|
if (p & PAD_BUTTON_A) quit = 1;
|
|
|
|
if (p & PAD_BUTTON_B) quit = 1;
|
2008-08-07 14:26:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Main Menu
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2009-01-13 21:02:06 +01:00
|
|
|
void MainMenu (u32 fps)
|
2008-08-07 14:26:07 +02:00
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
int ret, quit = 0;
|
|
|
|
/* uint32 crccheck;*/
|
2008-12-10 19:16:30 +01:00
|
|
|
|
2008-12-07 20:31:50 +01:00
|
|
|
/* autosave (SRAM only) */
|
2008-11-13 08:24:30 +01:00
|
|
|
int temp = config.freeze_auto;
|
|
|
|
config.freeze_auto = -1;
|
|
|
|
memfile_autosave();
|
|
|
|
config.freeze_auto = temp;
|
|
|
|
|
2009-03-30 09:05:34 +02:00
|
|
|
gui_menu *m = &menu_main;
|
|
|
|
|
2009-04-01 09:37:54 +02:00
|
|
|
/* basic fade-in effect */
|
2009-04-07 18:05:16 +02:00
|
|
|
menu_slide(m,10,0);
|
2009-04-01 09:37:54 +02:00
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
while (quit == 0)
|
|
|
|
{
|
2009-03-30 09:05:34 +02:00
|
|
|
/* crccheck = crc32 (0, &sram.sram[0], 0x10000);
|
2009-02-22 20:57:41 +01:00
|
|
|
strcpy (menutitle,"");
|
2008-08-07 14:26:07 +02:00
|
|
|
if (genromsize && (crccheck != sram.crc)) strcpy (menutitle, "*** SRAM has been modified ***");
|
2009-01-13 21:02:06 +01:00
|
|
|
else if (genromsize) sprintf (menutitle, "%d FPS",fps);
|
2009-03-30 09:05:34 +02:00
|
|
|
*/
|
|
|
|
menu_initialize(m);
|
|
|
|
ret = menu_callback(m);
|
|
|
|
menu_delete(m);
|
2008-08-07 14:26:07 +02:00
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case -1: /*** Button B ***/
|
|
|
|
case 0: /*** Play Game ***/
|
2009-04-01 09:37:54 +02:00
|
|
|
if (genromsize)
|
|
|
|
{
|
|
|
|
/* basic fade-out effect */
|
2009-04-07 18:05:16 +02:00
|
|
|
menu_slide(m,10,1);
|
2009-04-05 20:20:43 +02:00
|
|
|
ClearScreen ((GXColor)BLACK);
|
|
|
|
gxDrawScreenshot(0xff);
|
|
|
|
SetScreen ();
|
2009-04-01 09:37:54 +02:00
|
|
|
quit = 1;
|
|
|
|
}
|
2008-12-10 19:16:30 +01:00
|
|
|
break;
|
|
|
|
|
2009-03-15 20:11:01 +01:00
|
|
|
case 1: /*** Load ROM Menu ***/
|
|
|
|
quit = loadmenu();
|
2008-12-10 19:16:30 +01:00
|
|
|
break;
|
|
|
|
|
2009-03-15 20:11:01 +01:00
|
|
|
case 2: /*** Emulator Options */
|
|
|
|
optionmenu ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: /*** Memory Manager ***/
|
|
|
|
quit = filemenu ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4: /*** Emulator Reset ***/
|
2008-12-10 19:16:30 +01:00
|
|
|
if (genromsize || (config.bios_enabled == 3))
|
|
|
|
{
|
|
|
|
system_reset ();
|
2009-04-05 20:20:43 +02:00
|
|
|
ClearScreen ((GXColor)BLACK);
|
|
|
|
SetScreen ();
|
2008-12-10 19:16:30 +01:00
|
|
|
quit = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2009-03-15 20:11:01 +01:00
|
|
|
case 5: /*** ROM Information ***/
|
|
|
|
showrominfo ();
|
2008-12-10 19:16:30 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 6: /*** SD/PSO/TP Reload ***/
|
2008-08-07 14:26:07 +02:00
|
|
|
memfile_autosave();
|
2008-08-25 21:38:03 +02:00
|
|
|
system_shutdown();
|
|
|
|
audio_shutdown();
|
2008-08-07 14:26:07 +02:00
|
|
|
VIDEO_ClearFrameBuffer(vmode, xfb[whichfb], COLOR_BLACK);
|
|
|
|
VIDEO_Flush();
|
|
|
|
VIDEO_WaitVSync();
|
2008-08-20 22:25:17 +02:00
|
|
|
#ifdef HW_RVL
|
|
|
|
DI_Close();
|
|
|
|
#endif
|
2008-08-07 14:26:07 +02:00
|
|
|
exit(0);
|
|
|
|
break;
|
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
case 7: /*** Return to Wii System Menu ***/
|
2008-08-07 14:26:07 +02:00
|
|
|
memfile_autosave();
|
2008-08-25 21:38:03 +02:00
|
|
|
system_shutdown();
|
|
|
|
audio_shutdown();
|
2008-08-07 14:26:07 +02:00
|
|
|
VIDEO_ClearFrameBuffer(vmode, xfb[whichfb], COLOR_BLACK);
|
|
|
|
VIDEO_Flush();
|
|
|
|
VIDEO_WaitVSync();
|
2008-08-20 22:25:17 +02:00
|
|
|
#ifdef HW_RVL
|
|
|
|
DI_Close();
|
2008-12-10 19:16:30 +01:00
|
|
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
2008-08-07 14:26:07 +02:00
|
|
|
#else
|
2008-12-10 19:16:30 +01:00
|
|
|
SYS_ResetSystem(SYS_HOTRESET,0,0);
|
2008-08-07 14:26:07 +02:00
|
|
|
#endif
|
2008-12-10 19:16:30 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-08-07 14:26:07 +02:00
|
|
|
|
2008-12-10 19:16:30 +01:00
|
|
|
/*** Remove any still held buttons ***/
|
2008-08-07 14:26:07 +02:00
|
|
|
while (PAD_ButtonsHeld(0)) PAD_ScanPads();
|
|
|
|
#ifdef HW_RVL
|
|
|
|
while (WPAD_ButtonsHeld(0)) WPAD_ScanPads();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HW_RVL
|
2008-12-10 19:16:30 +01:00
|
|
|
/*** Stop the DVD from causing clicks while playing ***/
|
|
|
|
uselessinquiry ();
|
2008-08-07 14:26:07 +02:00
|
|
|
#endif
|
|
|
|
}
|