2005-03-03 20:02:39 +00:00
|
|
|
/*********************************************************************/
|
|
|
|
/* menu.c - user menu for rockboy */
|
|
|
|
/* */
|
|
|
|
/* Note: this file only exposes one function: do_user_menu(). */
|
|
|
|
/*********************************************************************/
|
|
|
|
|
2010-11-11 12:08:00 +00:00
|
|
|
#include "lib/helper.h"
|
2005-03-03 20:02:39 +00:00
|
|
|
#include "button.h"
|
|
|
|
#include "rockmacros.h"
|
2005-03-04 09:30:27 +00:00
|
|
|
#include "mem.h"
|
2007-10-16 18:16:22 +00:00
|
|
|
#include "save.h"
|
2007-07-30 05:19:05 +00:00
|
|
|
#include "rtc-gb.h"
|
2007-10-16 18:32:55 +00:00
|
|
|
#include "pcm.h"
|
2010-11-24 11:39:40 +00:00
|
|
|
#include "emu.h"
|
2010-11-25 12:45:13 +00:00
|
|
|
#include "loader.h"
|
2005-03-03 20:02:39 +00:00
|
|
|
|
2010-11-11 10:58:09 +00:00
|
|
|
#define SLOT_COUNT 50
|
2010-11-06 14:20:57 +00:00
|
|
|
#define DESC_SIZE 20
|
|
|
|
|
2005-03-03 20:02:39 +00:00
|
|
|
/* load/save state function declarations */
|
2005-03-04 09:30:27 +00:00
|
|
|
static void do_opt_menu(void);
|
2006-06-19 01:47:45 +00:00
|
|
|
static void do_slot_menu(bool is_load);
|
2005-03-04 09:30:27 +00:00
|
|
|
static void munge_name(char *buf, size_t bufsiz);
|
|
|
|
|
|
|
|
/* directory ROM save slots belong in */
|
2007-09-10 09:46:36 +00:00
|
|
|
#define STATE_DIR ROCKBOX_DIR "/rockboy"
|
2005-03-03 20:02:39 +00:00
|
|
|
|
2007-10-16 18:16:22 +00:00
|
|
|
static int getbutton(char *text)
|
2006-01-20 13:05:52 +00:00
|
|
|
{
|
2007-06-24 16:00:55 +00:00
|
|
|
int fw, fh;
|
2010-11-06 14:20:57 +00:00
|
|
|
int button;
|
2007-06-24 16:00:55 +00:00
|
|
|
rb->lcd_clear_display();
|
|
|
|
rb->font_getstringsize(text, &fw, &fh,0);
|
|
|
|
rb->lcd_putsxy(LCD_WIDTH/2-fw/2, LCD_HEIGHT/2-fh/2, text);
|
2006-06-19 01:47:45 +00:00
|
|
|
rb->lcd_update();
|
|
|
|
rb->sleep(30);
|
|
|
|
|
2007-06-24 16:00:55 +00:00
|
|
|
while (rb->button_get(false) != BUTTON_NONE)
|
2006-06-19 01:47:45 +00:00
|
|
|
rb->yield();
|
|
|
|
|
|
|
|
while(true)
|
|
|
|
{
|
|
|
|
button = rb->button_get(true);
|
2010-11-06 14:20:57 +00:00
|
|
|
button = button&(BUTTON_MAIN|BUTTON_REMOTE);
|
2006-06-19 01:47:45 +00:00
|
|
|
|
2007-06-24 16:00:55 +00:00
|
|
|
return button;
|
2006-06-19 01:47:45 +00:00
|
|
|
}
|
2006-01-20 13:05:52 +00:00
|
|
|
}
|
|
|
|
|
2007-10-16 18:16:22 +00:00
|
|
|
static void setupkeys(void)
|
2006-01-20 13:05:52 +00:00
|
|
|
{
|
2010-11-11 12:08:00 +00:00
|
|
|
options.UP = getbutton("Press Up");
|
|
|
|
options.DOWN = getbutton("Press Down");
|
|
|
|
options.LEFT = getbutton("Press Left");
|
|
|
|
options.RIGHT = getbutton("Press Right");
|
2006-01-20 13:05:52 +00:00
|
|
|
|
2010-11-11 12:08:00 +00:00
|
|
|
options.A = getbutton("Press A");
|
|
|
|
options.B = getbutton("Press B");
|
2006-01-20 13:05:52 +00:00
|
|
|
|
2010-11-11 12:08:00 +00:00
|
|
|
options.START = getbutton("Press Start");
|
|
|
|
options.SELECT = getbutton("Press Select");
|
2006-01-20 13:05:52 +00:00
|
|
|
|
2010-11-11 12:08:00 +00:00
|
|
|
options.MENU = getbutton("Press Menu");
|
2006-01-20 13:05:52 +00:00
|
|
|
}
|
|
|
|
|
2005-03-03 20:02:39 +00:00
|
|
|
/*
|
|
|
|
* do_user_menu - create the user menu on the screen.
|
|
|
|
*
|
|
|
|
* Returns USER_MENU_QUIT if the user selected "quit", otherwise
|
|
|
|
* returns zero.
|
|
|
|
*/
|
|
|
|
int do_user_menu(void) {
|
2006-06-19 01:47:45 +00:00
|
|
|
bool done=false;
|
2009-06-16 04:25:21 +00:00
|
|
|
int selected=0, ret=0;
|
2006-06-19 01:47:45 +00:00
|
|
|
int result;
|
2007-07-30 05:19:05 +00:00
|
|
|
int time = 0;
|
|
|
|
|
|
|
|
#if CONFIG_RTC
|
|
|
|
time = rb->mktime(rb->get_time());
|
|
|
|
#endif
|
2006-06-19 01:47:45 +00:00
|
|
|
|
2009-08-09 03:20:55 +00:00
|
|
|
#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
|
|
|
|
rb->lcd_set_mode(LCD_MODE_RGB565);
|
|
|
|
#endif
|
|
|
|
|
2010-11-11 12:08:00 +00:00
|
|
|
backlight_use_settings();
|
2022-11-24 04:00:29 +00:00
|
|
|
|
2006-06-19 01:47:45 +00:00
|
|
|
/* Clean out the button Queue */
|
|
|
|
while (rb->button_get(false) != BUTTON_NONE)
|
|
|
|
rb->yield();
|
|
|
|
|
2009-06-16 04:25:21 +00:00
|
|
|
MENUITEM_STRINGLIST(menu, "Rockboy Menu", NULL,
|
|
|
|
"Load Game", "Save Game",
|
2010-11-24 11:39:40 +00:00
|
|
|
"Options", "Reset", "Quit");
|
2006-06-19 01:47:45 +00:00
|
|
|
|
2010-05-27 12:00:23 +00:00
|
|
|
rockboy_pcm_init();
|
2006-06-19 01:47:45 +00:00
|
|
|
|
|
|
|
while(!done)
|
|
|
|
{
|
2009-06-16 04:25:21 +00:00
|
|
|
result = rb->do_menu(&menu, &selected, NULL, false);
|
2006-06-19 01:47:45 +00:00
|
|
|
|
|
|
|
switch (result)
|
|
|
|
{
|
|
|
|
case 0: /* Load Game */
|
|
|
|
do_slot_menu(true);
|
|
|
|
break;
|
|
|
|
case 1: /* Save Game */
|
|
|
|
do_slot_menu(false);
|
|
|
|
break;
|
|
|
|
case 2: /* Options */
|
|
|
|
do_opt_menu();
|
|
|
|
break;
|
2010-11-24 11:39:40 +00:00
|
|
|
case 3: /* Reset */
|
|
|
|
emu_reset();
|
|
|
|
done=true;
|
|
|
|
break;
|
|
|
|
case 4: /* Quit */
|
2006-06-19 01:47:45 +00:00
|
|
|
ret = USER_MENU_QUIT;
|
2010-11-25 12:45:13 +00:00
|
|
|
if(options.autosave) sn_save();
|
2006-06-19 01:47:45 +00:00
|
|
|
done=true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
done=true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-03-03 20:02:39 +00:00
|
|
|
|
2011-09-24 13:19:34 +00:00
|
|
|
rb->lcd_setfont(FONT_SYSFIXED); /* Reset the font */
|
2006-06-19 01:47:45 +00:00
|
|
|
rb->lcd_clear_display(); /* Clear display for screen size changes */
|
2007-07-30 05:19:05 +00:00
|
|
|
|
|
|
|
/* Keep the RTC in sync */
|
|
|
|
#if CONFIG_RTC
|
|
|
|
time = (rb->mktime(rb->get_time()) - time) * 60;
|
|
|
|
#endif
|
|
|
|
while (time-- > 0) rtc_tick();
|
2006-06-19 01:47:45 +00:00
|
|
|
|
2009-08-09 03:20:55 +00:00
|
|
|
#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
|
|
|
|
rb->lcd_set_mode(LCD_MODE_PAL256);
|
|
|
|
#endif
|
|
|
|
|
2010-11-11 12:08:00 +00:00
|
|
|
/* ignore backlight time out */
|
2011-01-24 12:29:16 +00:00
|
|
|
backlight_ignore_timeout();
|
2022-11-24 04:00:29 +00:00
|
|
|
|
2006-06-19 01:47:45 +00:00
|
|
|
return ret;
|
2005-03-03 20:02:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2005-03-04 09:30:27 +00:00
|
|
|
* munge_name - munge a string into a filesystem-safe name
|
|
|
|
*/
|
|
|
|
static void munge_name(char *buf, const size_t bufsiz) {
|
2006-06-19 01:47:45 +00:00
|
|
|
unsigned int i, max;
|
2005-03-04 09:30:27 +00:00
|
|
|
|
2006-06-19 01:47:45 +00:00
|
|
|
/* check strlen */
|
|
|
|
max = strlen(buf);
|
|
|
|
max = (max < bufsiz) ? max : bufsiz;
|
2005-03-04 09:30:27 +00:00
|
|
|
|
2006-06-19 01:47:45 +00:00
|
|
|
/* iterate over characters and munge them (if necessary) */
|
|
|
|
for (i = 0; i < max; i++)
|
|
|
|
if (!isalnum(buf[i]))
|
|
|
|
buf[i] = '_';
|
2005-03-04 09:30:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* build_slot_path - build a path to an slot state file for this rom
|
|
|
|
*
|
|
|
|
* Note: uses rom.name. Is there a safer way of doing this? Like a ROM
|
|
|
|
* checksum or something like that?
|
|
|
|
*/
|
2010-05-17 12:49:51 +00:00
|
|
|
static void build_slot_path(char *buf, size_t bufsiz, int slot_id) {
|
2009-07-14 13:57:45 +00:00
|
|
|
char name_buf[17];
|
2005-03-04 09:30:27 +00:00
|
|
|
|
2006-06-19 01:47:45 +00:00
|
|
|
/* munge state file name */
|
2009-07-14 13:57:45 +00:00
|
|
|
strlcpy(name_buf, rom.name, sizeof(name_buf));
|
2006-06-19 01:47:45 +00:00
|
|
|
munge_name(name_buf, strlen(name_buf));
|
2005-03-04 09:30:27 +00:00
|
|
|
|
2006-06-19 01:47:45 +00:00
|
|
|
/* glom the whole mess together */
|
2010-05-17 12:49:51 +00:00
|
|
|
snprintf(buf, bufsiz, "%s/%s-%d.rbs", STATE_DIR, name_buf, slot_id + 1);
|
2005-03-04 09:30:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* do_file - load or save game data in the given file
|
|
|
|
*
|
|
|
|
* Returns true on success and false on failure.
|
2005-03-03 20:02:39 +00:00
|
|
|
*
|
2010-11-11 10:58:09 +00:00
|
|
|
* @desc is a brief user-provided description of the state.
|
2005-03-04 09:30:27 +00:00
|
|
|
* If no description is provided, set @desc to NULL.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static bool do_file(char *path, char *desc, bool is_load) {
|
2010-11-06 14:20:57 +00:00
|
|
|
char desc_buf[DESC_SIZE];
|
2006-06-19 01:47:45 +00:00
|
|
|
int fd, file_mode;
|
2005-03-04 09:30:27 +00:00
|
|
|
|
2006-06-19 01:47:45 +00:00
|
|
|
/* set file mode */
|
|
|
|
file_mode = is_load ? O_RDONLY : (O_WRONLY | O_CREAT);
|
2005-03-04 09:30:27 +00:00
|
|
|
|
2006-06-19 01:47:45 +00:00
|
|
|
/* attempt to open file descriptor here */
|
2010-05-06 17:35:13 +00:00
|
|
|
if ((fd = open(path, file_mode, 0666)) < 0)
|
2006-06-19 01:47:45 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
/* load/save state */
|
|
|
|
if (is_load)
|
|
|
|
{
|
|
|
|
/* load description */
|
2010-11-06 14:20:57 +00:00
|
|
|
read(fd, desc_buf, sizeof(desc_buf));
|
2006-06-19 01:47:45 +00:00
|
|
|
|
|
|
|
/* load state */
|
|
|
|
loadstate(fd);
|
|
|
|
|
|
|
|
/* print out a status message so the user knows the state loaded */
|
2010-08-28 21:46:45 +00:00
|
|
|
rb->splashf(HZ * 1, "Loaded state from \"%s\"", path);
|
2006-06-19 01:47:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* build description buffer */
|
2010-11-06 14:20:57 +00:00
|
|
|
memset(desc_buf, 0, sizeof(desc_buf));
|
2006-06-19 01:47:45 +00:00
|
|
|
if (desc)
|
2010-11-06 14:20:57 +00:00
|
|
|
strlcpy(desc_buf, desc, sizeof(desc_buf));
|
2006-06-19 01:47:45 +00:00
|
|
|
|
|
|
|
/* save state */
|
2010-11-06 14:20:57 +00:00
|
|
|
write(fd, desc_buf, sizeof(desc_buf));
|
2006-06-19 01:47:45 +00:00
|
|
|
savestate(fd);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* close file descriptor */
|
|
|
|
close(fd);
|
|
|
|
|
|
|
|
/* return true (for success) */
|
|
|
|
return true;
|
2005-03-04 09:30:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* get information on the given slot
|
|
|
|
*/
|
2010-11-11 10:58:09 +00:00
|
|
|
static void slot_info(char *info_buf, size_t info_bufsiz, int slot_id,
|
|
|
|
bool number) {
|
2006-06-19 01:47:45 +00:00
|
|
|
char buf[256];
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
/* get slot file path */
|
2010-11-06 14:20:57 +00:00
|
|
|
build_slot_path(buf, sizeof(buf), slot_id);
|
2006-06-19 01:47:45 +00:00
|
|
|
|
|
|
|
/* attempt to open slot */
|
|
|
|
if ((fd = open(buf, O_RDONLY)) >= 0)
|
|
|
|
{
|
|
|
|
/* this slot has a some data in it, read it */
|
2010-11-06 14:20:57 +00:00
|
|
|
if (read(fd, buf, DESC_SIZE) == DESC_SIZE)
|
2006-06-19 01:47:45 +00:00
|
|
|
{
|
2010-11-06 14:20:57 +00:00
|
|
|
buf[DESC_SIZE] = '\0';
|
|
|
|
strlcpy(info_buf, buf, info_bufsiz);
|
2006-06-19 01:47:45 +00:00
|
|
|
}
|
2010-11-11 10:58:09 +00:00
|
|
|
else if(number)
|
2010-11-06 14:20:57 +00:00
|
|
|
strlcpy(info_buf, "ERROR", info_bufsiz);
|
2006-06-19 01:47:45 +00:00
|
|
|
|
|
|
|
close(fd);
|
|
|
|
}
|
2010-11-11 10:58:09 +00:00
|
|
|
else if(number)
|
2006-06-19 01:47:45 +00:00
|
|
|
{
|
|
|
|
/* if we couldn't open the file, then the slot is empty */
|
2010-11-06 14:20:57 +00:00
|
|
|
strlcpy(info_buf, "<Empty>", info_bufsiz);
|
2005-03-04 09:30:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-11 10:58:09 +00:00
|
|
|
/*
|
|
|
|
* do_slot - load or save game data in the given slot
|
|
|
|
*
|
|
|
|
* Returns true on success and false on failure.
|
|
|
|
*/
|
|
|
|
static bool do_slot(int slot_id, bool is_load) {
|
|
|
|
char path_buf[256], desc_buf[DESC_SIZE];
|
|
|
|
|
|
|
|
/* build slot filename, clear desc buf */
|
|
|
|
build_slot_path(path_buf, sizeof(path_buf), slot_id);
|
|
|
|
memset(desc_buf, 0, sizeof(desc_buf));
|
|
|
|
|
|
|
|
/* if we're saving to a slot, then get a brief description */
|
|
|
|
if (!is_load)
|
|
|
|
{
|
|
|
|
slot_info(desc_buf, sizeof(desc_buf), slot_id, false);
|
2020-07-21 06:33:53 +00:00
|
|
|
if ( rb->kbd_input(desc_buf, sizeof(desc_buf), NULL) < 0 )
|
2010-11-11 10:58:09 +00:00
|
|
|
return false;
|
|
|
|
if ( !strlen(desc_buf) )
|
|
|
|
strlcpy(desc_buf, "Untitled", sizeof(desc_buf));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* load/save file */
|
|
|
|
return do_file(path_buf, desc_buf, is_load);
|
|
|
|
}
|
|
|
|
|
2009-06-16 04:25:21 +00:00
|
|
|
/*
|
|
|
|
* slot_get_name
|
|
|
|
*/
|
2009-08-20 16:47:44 +00:00
|
|
|
static const char* slot_get_name(int selected_item, void * data,
|
|
|
|
char * buffer, size_t buffer_len)
|
2009-06-16 04:25:21 +00:00
|
|
|
{
|
2010-11-06 14:20:57 +00:00
|
|
|
const char (*items)[DESC_SIZE] = data;
|
|
|
|
snprintf(buffer, buffer_len, "%d. %s",
|
|
|
|
selected_item + 1, items[selected_item]);
|
|
|
|
return buffer;
|
2009-06-16 04:25:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* list_action_callback
|
|
|
|
*/
|
|
|
|
static int list_action_callback(int action, struct gui_synclist *lists)
|
|
|
|
{
|
|
|
|
(void) lists;
|
|
|
|
if (action == ACTION_STD_OK)
|
|
|
|
return ACTION_STD_CANCEL;
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
|
2005-03-04 09:30:27 +00:00
|
|
|
/*
|
|
|
|
* do_slot_menu - prompt the user for a load/save memory slot
|
2005-03-03 20:02:39 +00:00
|
|
|
*/
|
|
|
|
static void do_slot_menu(bool is_load) {
|
2006-06-19 01:47:45 +00:00
|
|
|
bool done=false;
|
2010-11-11 10:58:09 +00:00
|
|
|
char items[SLOT_COUNT][DESC_SIZE];
|
2006-06-19 01:47:45 +00:00
|
|
|
int result;
|
|
|
|
int i;
|
2009-06-16 04:25:21 +00:00
|
|
|
struct simplelist_info info;
|
2005-03-04 09:30:27 +00:00
|
|
|
|
2006-06-19 01:47:45 +00:00
|
|
|
/* create menu items */
|
2010-11-11 10:58:09 +00:00
|
|
|
for (i = 0; i < SLOT_COUNT; i++)
|
|
|
|
slot_info(items[i], sizeof(*items), i, true);
|
2005-03-03 20:02:39 +00:00
|
|
|
|
2010-11-11 10:58:09 +00:00
|
|
|
rb->simplelist_info_init(&info, NULL, SLOT_COUNT, (void *)items);
|
2009-06-16 04:25:21 +00:00
|
|
|
info.get_name = slot_get_name;
|
|
|
|
info.action_callback = list_action_callback;
|
2005-03-03 20:02:39 +00:00
|
|
|
|
2006-06-19 01:47:45 +00:00
|
|
|
while(!done)
|
|
|
|
{
|
2009-06-16 04:25:21 +00:00
|
|
|
if(rb->simplelist_show_list(&info))
|
|
|
|
break;
|
|
|
|
|
|
|
|
result = info.selection;
|
2010-11-11 10:58:09 +00:00
|
|
|
if (result<SLOT_COUNT && result >= 0 )
|
2006-06-19 01:47:45 +00:00
|
|
|
done = do_slot(result, is_load);
|
|
|
|
else
|
|
|
|
done = true;
|
|
|
|
}
|
2005-03-03 20:02:39 +00:00
|
|
|
}
|
|
|
|
|
2006-06-19 01:47:45 +00:00
|
|
|
static void do_opt_menu(void)
|
|
|
|
{
|
|
|
|
bool done=false;
|
2009-06-16 04:25:21 +00:00
|
|
|
int selected=0;
|
2006-06-19 01:47:45 +00:00
|
|
|
int result;
|
|
|
|
|
|
|
|
static const struct opt_items onoff[2] = {
|
2006-08-11 12:48:36 +00:00
|
|
|
{ "Off", -1 },
|
|
|
|
{ "On" , -1 },
|
2006-06-19 01:47:45 +00:00
|
|
|
};
|
|
|
|
|
2010-11-24 16:41:45 +00:00
|
|
|
static const struct opt_items stats[3] = {
|
|
|
|
{ "Off", -1 },
|
|
|
|
{ "Short" , -1 },
|
|
|
|
{ "Full" , -1 },
|
|
|
|
};
|
|
|
|
|
2006-06-19 01:47:45 +00:00
|
|
|
static const struct opt_items frameskip[]= {
|
2007-06-24 16:00:55 +00:00
|
|
|
{ "0 Max", -1 },
|
|
|
|
{ "1 Max", -1 },
|
|
|
|
{ "2 Max", -1 },
|
2006-08-11 12:48:36 +00:00
|
|
|
{ "3 Max", -1 },
|
|
|
|
{ "4 Max", -1 },
|
|
|
|
{ "5 Max", -1 },
|
|
|
|
{ "6 Max", -1 },
|
2010-11-24 13:08:21 +00:00
|
|
|
{ "7 Max", -1 },
|
|
|
|
{ "8 Max", -1 },
|
|
|
|
{ "9 Max", -1 },
|
|
|
|
{ "10 Max", -1 },
|
|
|
|
{ "11 Max", -1 },
|
|
|
|
{ "12 Max", -1 },
|
|
|
|
{ "13 Max", -1 },
|
|
|
|
{ "14 Max", -1 },
|
|
|
|
{ "15 Max", -1 },
|
|
|
|
{ "16 Max", -1 },
|
|
|
|
{ "17 Max", -1 },
|
|
|
|
{ "18 Max", -1 },
|
|
|
|
{ "19 Max", -1 },
|
|
|
|
{ "20 Max", -1 },
|
2006-06-19 01:47:45 +00:00
|
|
|
};
|
2007-02-06 21:41:08 +00:00
|
|
|
|
2007-06-25 04:26:23 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2009-08-09 03:35:53 +00:00
|
|
|
static const struct opt_items rotate[] = {
|
|
|
|
{ "No rotation", -1 },
|
|
|
|
{ "Rotate Right" , -1 },
|
|
|
|
{ "Rotate Left" , -1 },
|
|
|
|
};
|
|
|
|
|
2007-10-16 18:16:22 +00:00
|
|
|
static const struct opt_items scaling[]= {
|
2007-06-25 04:26:23 +00:00
|
|
|
{ "Scaled", -1 },
|
|
|
|
{ "Scaled - Maintain Ratio", -1 },
|
|
|
|
#if (LCD_WIDTH>=160) && (LCD_HEIGHT>=144)
|
|
|
|
{ "Unscaled", -1 },
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2007-02-06 21:41:08 +00:00
|
|
|
static const struct opt_items palette[]= {
|
|
|
|
{ "Brown (Default)", -1 },
|
|
|
|
{ "Gray", -1 },
|
|
|
|
{ "Light Gray", -1 },
|
|
|
|
{ "Multi-Color 1", -1 },
|
|
|
|
{ "Multi-Color 2", -1 },
|
|
|
|
{ "Adventure Island", -1 },
|
|
|
|
{ "Adventure Island 2", -1 },
|
|
|
|
{ "Balloon Kid", -1 },
|
|
|
|
{ "Batman", -1 },
|
|
|
|
{ "Batman: Return of Joker", -1 },
|
|
|
|
{ "Bionic Commando", -1 },
|
|
|
|
{ "Castlvania Adventure", -1 },
|
|
|
|
{ "Donkey Kong Land", -1 },
|
|
|
|
{ "Dr. Mario", -1 },
|
|
|
|
{ "Kirby", -1 },
|
|
|
|
{ "Metroid", -1 },
|
|
|
|
{ "Zelda", -1 },
|
|
|
|
};
|
|
|
|
#endif
|
2006-06-19 01:47:45 +00:00
|
|
|
|
2009-06-16 04:25:21 +00:00
|
|
|
MENUITEM_STRINGLIST(menu, "Options", NULL,
|
2010-11-25 12:45:13 +00:00
|
|
|
"Max Frameskip", "Autosave", "Sound", "Volume",
|
|
|
|
"Stats", "Set Keys (Buggy)",
|
2007-02-06 21:41:08 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2009-06-16 04:25:21 +00:00
|
|
|
"Screen Size", "Screen Rotate", "Set Palette",
|
2007-02-06 21:41:08 +00:00
|
|
|
#endif
|
2009-06-16 04:25:21 +00:00
|
|
|
);
|
2006-06-19 01:47:45 +00:00
|
|
|
|
2007-06-25 04:26:23 +00:00
|
|
|
options.dirty=1; /* Assume that the settings have been changed */
|
2007-06-24 16:00:55 +00:00
|
|
|
|
2010-11-11 10:58:09 +00:00
|
|
|
struct viewport *parentvp = NULL;
|
2022-11-30 14:50:18 +00:00
|
|
|
const struct settings_list* vol = rb->find_setting(&rb->global_settings->volume);
|
2010-11-11 10:58:09 +00:00
|
|
|
|
2006-06-19 01:47:45 +00:00
|
|
|
while(!done)
|
|
|
|
{
|
2009-06-16 04:25:21 +00:00
|
|
|
result = rb->do_menu(&menu, &selected, NULL, false);
|
|
|
|
|
2006-06-19 01:47:45 +00:00
|
|
|
switch (result)
|
|
|
|
{
|
|
|
|
case 0: /* Frameskip */
|
2009-06-16 04:25:21 +00:00
|
|
|
rb->set_option("Max Frameskip", &options.maxskip, INT, frameskip,
|
2007-06-24 16:00:55 +00:00
|
|
|
sizeof(frameskip)/sizeof(*frameskip), NULL );
|
2006-06-19 01:47:45 +00:00
|
|
|
break;
|
2010-11-25 12:45:13 +00:00
|
|
|
case 1: /* Autosave */
|
|
|
|
rb->set_option("Autosave", &options.autosave, INT, onoff, 2, NULL );
|
|
|
|
break;
|
|
|
|
case 2: /* Sound */
|
2006-06-19 01:47:45 +00:00
|
|
|
if(options.sound>1) options.sound=1;
|
2009-06-16 04:25:21 +00:00
|
|
|
rb->set_option("Sound", &options.sound, INT, onoff, 2, NULL );
|
2007-02-06 21:41:08 +00:00
|
|
|
if(options.sound) sound_dirty();
|
2006-06-19 01:47:45 +00:00
|
|
|
break;
|
2010-11-25 12:45:13 +00:00
|
|
|
case 3: /* Volume */
|
2010-11-11 10:58:09 +00:00
|
|
|
rb->option_screen((struct settings_list*)vol, parentvp, false, "Volume");
|
|
|
|
break;
|
2010-11-25 12:45:13 +00:00
|
|
|
case 4: /* Stats */
|
2010-11-24 16:41:45 +00:00
|
|
|
rb->set_option("Stats", &options.showstats, INT, stats, 3, NULL );
|
2006-06-19 01:47:45 +00:00
|
|
|
break;
|
2010-11-25 12:45:13 +00:00
|
|
|
case 5: /* Keys */
|
2007-06-25 04:26:23 +00:00
|
|
|
setupkeys();
|
|
|
|
break;
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
2010-11-25 12:45:13 +00:00
|
|
|
case 6: /* Screen Size */
|
2009-06-16 04:25:21 +00:00
|
|
|
rb->set_option("Screen Size", &options.scaling, INT, scaling,
|
2007-10-16 18:16:22 +00:00
|
|
|
sizeof(scaling)/sizeof(*scaling), NULL );
|
2007-06-24 16:00:55 +00:00
|
|
|
setvidmode();
|
|
|
|
break;
|
2010-11-25 12:45:13 +00:00
|
|
|
case 7: /* Screen rotate */
|
2009-08-09 03:20:55 +00:00
|
|
|
rb->set_option("Screen Rotate", &options.rotate, INT, rotate,
|
|
|
|
sizeof(rotate)/sizeof(*rotate), NULL );
|
2007-06-24 16:00:55 +00:00
|
|
|
setvidmode();
|
2006-06-19 01:47:45 +00:00
|
|
|
break;
|
2010-11-25 12:45:13 +00:00
|
|
|
case 8: /* Palette */
|
2009-06-16 04:25:21 +00:00
|
|
|
rb->set_option("Set Palette", &options.pal, INT, palette, 17, NULL );
|
2007-02-06 21:41:08 +00:00
|
|
|
set_pal();
|
|
|
|
break;
|
2009-06-16 04:25:21 +00:00
|
|
|
#endif
|
2006-06-19 01:47:45 +00:00
|
|
|
default:
|
|
|
|
done=true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-03-03 20:02:39 +00:00
|
|
|
}
|