mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2025-02-28 08:53:36 +01:00
[Gamecube/Wii]
--------------- * added message box when inputs config uses disconnected controllers. * added message box when settings are reseted to default on startup. * fixed default inputs configuration. * fixed memory leak in Cheat Menu causing spurious resets. * added an option to enable/disable automatic cheat activation * increased max number of cheat codes * optimized cheat codes requiring RAM patching. * improved default horizontal scaling to better match output from a real Mega Drive [Gamecube specific] --------------- * fixed inverted keys in cheat menu. [Wii specific] --------------- * added the possibility for any wiimotes to be used as input device, regardless of the connected expansion controller.
This commit is contained in:
parent
a4cfc2a77a
commit
39920979d2
@ -21,24 +21,11 @@
|
|||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
|
#include "gui.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "file_load.h"
|
#include "file_load.h"
|
||||||
|
|
||||||
void config_save(void)
|
static int config_load(void)
|
||||||
{
|
|
||||||
/* open configuration file */
|
|
||||||
char fname[MAXPATHLEN];
|
|
||||||
sprintf (fname, "%s/config.ini", DEFAULT_PATH);
|
|
||||||
FILE *fp = fopen(fname, "wb");
|
|
||||||
if (fp)
|
|
||||||
{
|
|
||||||
/* write file */
|
|
||||||
fwrite(&config, sizeof(config), 1, fp);
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void config_load(void)
|
|
||||||
{
|
{
|
||||||
/* open configuration file */
|
/* open configuration file */
|
||||||
char fname[MAXPATHLEN];
|
char fname[MAXPATHLEN];
|
||||||
@ -51,7 +38,7 @@ void config_load(void)
|
|||||||
fread(version, 16, 1, fp);
|
fread(version, 16, 1, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
if (strncmp(version,CONFIG_VERSION,16))
|
if (strncmp(version,CONFIG_VERSION,16))
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
/* read file */
|
/* read file */
|
||||||
fp = fopen(fname, "rb");
|
fp = fopen(fname, "rb");
|
||||||
@ -59,8 +46,24 @@ void config_load(void)
|
|||||||
{
|
{
|
||||||
fread(&config, sizeof(config), 1, fp);
|
fread(&config, sizeof(config), 1, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void config_save(void)
|
||||||
|
{
|
||||||
|
/* open configuration file */
|
||||||
|
char fname[MAXPATHLEN];
|
||||||
|
sprintf (fname, "%s/config.ini", DEFAULT_PATH);
|
||||||
|
FILE *fp = fopen(fname, "wb");
|
||||||
|
if (fp)
|
||||||
|
{
|
||||||
|
/* write file */
|
||||||
|
fwrite(&config, sizeof(config), 1, fp);
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void config_default(void)
|
void config_default(void)
|
||||||
@ -129,6 +132,7 @@ void config_default(void)
|
|||||||
|
|
||||||
/* menu options */
|
/* menu options */
|
||||||
config.autoload = 0;
|
config.autoload = 0;
|
||||||
|
config.autocheat = 0;
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
config.s_auto = 1;
|
config.s_auto = 1;
|
||||||
#else
|
#else
|
||||||
@ -152,11 +156,13 @@ void config_default(void)
|
|||||||
sprintf (config.lastdir[TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
|
sprintf (config.lastdir[TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* restore from config file */
|
/* try to restore settings from config file */
|
||||||
config_load();
|
if (!config_load()) GUI_WaitPrompt("Info","Default Settings restored");
|
||||||
io_init();
|
|
||||||
|
|
||||||
/* default menu settings */
|
/* restore inputs */
|
||||||
|
input_init();
|
||||||
|
|
||||||
|
/* restore menu settings */
|
||||||
menu_configure();
|
menu_configure();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#ifndef _CONFIG_H_
|
#ifndef _CONFIG_H_
|
||||||
#define _CONFIG_H_
|
#define _CONFIG_H_
|
||||||
|
|
||||||
#define CONFIG_VERSION "GENPLUS-GX 1.4.0"
|
#define CONFIG_VERSION "GENPLUS-GX 1.4.1"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Config Option
|
* Config Option
|
||||||
@ -75,9 +75,11 @@ typedef struct
|
|||||||
uint32 wpad_keymap[4*3][MAX_KEYS];
|
uint32 wpad_keymap[4*3][MAX_KEYS];
|
||||||
#endif
|
#endif
|
||||||
uint8 autoload;
|
uint8 autoload;
|
||||||
|
uint8 autocheat;
|
||||||
uint8 s_auto;
|
uint8 s_auto;
|
||||||
uint8 s_default;
|
uint8 s_default;
|
||||||
uint8 s_device;
|
uint8 s_device;
|
||||||
|
uint8 autocheats;
|
||||||
int8 bg_type;
|
int8 bg_type;
|
||||||
int8 bg_overlay;
|
int8 bg_overlay;
|
||||||
int16 screen_w;
|
int16 screen_w;
|
||||||
@ -95,7 +97,6 @@ t_config config;
|
|||||||
|
|
||||||
|
|
||||||
extern void config_save(void);
|
extern void config_save(void);
|
||||||
extern void config_load(void);
|
|
||||||
extern void config_default(void);
|
extern void config_default(void);
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,6 +34,9 @@
|
|||||||
#define BG_COLOR_1 {0x49,0x49,0x49,0xff}
|
#define BG_COLOR_1 {0x49,0x49,0x49,0xff}
|
||||||
#define BG_COLOR_2 {0x66,0x66,0x66,0xff}
|
#define BG_COLOR_2 {0x66,0x66,0x66,0xff}
|
||||||
|
|
||||||
|
#define MAX_CHEATS (250)
|
||||||
|
#define MAX_DESC_LENGTH (63)
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
extern const u8 Key_Minus_wii_png[];
|
extern const u8 Key_Minus_wii_png[];
|
||||||
extern const u8 Key_Plus_wii_png[];
|
extern const u8 Key_Plus_wii_png[];
|
||||||
@ -46,8 +49,8 @@ extern const u8 Key_DPAD_png[];
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char code[12];
|
char code[12];
|
||||||
char text[36];
|
char text[MAX_DESC_LENGTH];
|
||||||
u16 enable;
|
u8 enable;
|
||||||
u16 data;
|
u16 data;
|
||||||
u16 old;
|
u16 old;
|
||||||
u32 address;
|
u32 address;
|
||||||
@ -59,23 +62,44 @@ static void clear_cheats(void);
|
|||||||
static void cheatmenu_cb(void);
|
static void cheatmenu_cb(void);
|
||||||
static void switch_chars(void);
|
static void switch_chars(void);
|
||||||
|
|
||||||
static int selection = 0;
|
|
||||||
static int maxcheats = 0;
|
|
||||||
static int string_offset = 0;
|
static int string_offset = 0;
|
||||||
|
static int selection = 0;
|
||||||
|
static int offset = 0;
|
||||||
static int type = 0;
|
static int type = 0;
|
||||||
static int patchRAM =0;
|
static int maxcheats = 0;
|
||||||
|
static int maxRAMcheats = 0;
|
||||||
|
|
||||||
static CHEATENTRY cheatlist[10];
|
static CHEATENTRY cheatlist[MAX_CHEATS];
|
||||||
|
static u8 RAMcheatlist[MAX_CHEATS];
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* GUI Buttons data */
|
/* GUI Buttons data */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
static butn_data arrow_up_data =
|
||||||
|
{
|
||||||
|
{NULL,NULL},
|
||||||
|
{Button_up_png,Button_up_over_png}
|
||||||
|
};
|
||||||
|
|
||||||
|
static butn_data arrow_down_data =
|
||||||
|
{
|
||||||
|
{NULL,NULL},
|
||||||
|
{Button_down_png,Button_down_over_png}
|
||||||
|
};
|
||||||
static butn_data button_digit_data =
|
static butn_data button_digit_data =
|
||||||
{
|
{
|
||||||
{NULL,NULL},
|
{NULL,NULL},
|
||||||
{Button_digit_png,Button_digit_over_png}
|
{Button_digit_png,Button_digit_over_png}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* GUI Arrows button */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static gui_butn arrow_up = {&arrow_up_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX,{0,0,0,0},14,76,360,32};
|
||||||
|
static gui_butn arrow_down = {&arrow_down_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX,{0,0,0,0},14,368,360,32};
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* GUI helpers */
|
/* GUI helpers */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -145,7 +169,7 @@ static gui_item items_cheats[30] =
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static gui_butn buttons_cheats[30] =
|
static gui_butn buttons_cheats[30] =
|
||||||
{
|
{
|
||||||
{NULL, BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_SELECT_SFX|BUTTON_OVER_SFX,{0,0,0,0},15,108,358,26},
|
{NULL, BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_SELECT_SFX|BUTTON_OVER_SFX,{1,0,0,0},15,108,358,26},
|
||||||
{NULL, BUTTON_VISIBLE|BUTTON_SELECT_SFX|BUTTON_OVER_SFX,{1,0,0,0},15,134,358,26},
|
{NULL, BUTTON_VISIBLE|BUTTON_SELECT_SFX|BUTTON_OVER_SFX,{1,0,0,0},15,134,358,26},
|
||||||
{NULL, BUTTON_VISIBLE|BUTTON_SELECT_SFX|BUTTON_OVER_SFX,{1,0,0,0},15,160,358,26},
|
{NULL, BUTTON_VISIBLE|BUTTON_SELECT_SFX|BUTTON_OVER_SFX,{1,0,0,0},15,160,358,26},
|
||||||
{NULL, BUTTON_VISIBLE|BUTTON_SELECT_SFX|BUTTON_OVER_SFX,{1,0,0,0},15,186,358,26},
|
{NULL, BUTTON_VISIBLE|BUTTON_SELECT_SFX|BUTTON_OVER_SFX,{1,0,0,0},15,186,358,26},
|
||||||
@ -189,7 +213,7 @@ static gui_menu menu_cheats =
|
|||||||
buttons_cheats,
|
buttons_cheats,
|
||||||
bg_cheats,
|
bg_cheats,
|
||||||
{&action_cancel, &action_select},
|
{&action_cancel, &action_select},
|
||||||
{NULL,NULL},
|
{&arrow_up,&arrow_down},
|
||||||
cheatmenu_cb
|
cheatmenu_cb
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -290,8 +314,8 @@ static u32 decode_cheat(char *string, u32 *address, u32 *data)
|
|||||||
|
|
||||||
static void apply_cheats(void)
|
static void apply_cheats(void)
|
||||||
{
|
{
|
||||||
/* clear RAM patch flag */
|
/* clear RAM patches counter */
|
||||||
patchRAM = 0;
|
maxRAMcheats = 0;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < maxcheats; i++)
|
for (i = 0; i < maxcheats; i++)
|
||||||
@ -307,7 +331,7 @@ static void apply_cheats(void)
|
|||||||
else if (cheatlist[i].address >= 0xFF0000)
|
else if (cheatlist[i].address >= 0xFF0000)
|
||||||
{
|
{
|
||||||
/* patch RAM data */
|
/* patch RAM data */
|
||||||
patchRAM = 1;
|
RAMcheatlist[maxRAMcheats++] = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -450,7 +474,7 @@ static void cheatmenu_cb(void)
|
|||||||
int yoffset = 108;
|
int yoffset = 108;
|
||||||
gui_image bar_over;
|
gui_image bar_over;
|
||||||
gui_image star;
|
gui_image star;
|
||||||
char temp[36];
|
char temp[MAX_DESC_LENGTH];
|
||||||
|
|
||||||
/* Initialize textures */
|
/* Initialize textures */
|
||||||
bar_over.texture = gxTextureOpenPNG(Overlay_bar_png,0);
|
bar_over.texture = gxTextureOpenPNG(Overlay_bar_png,0);
|
||||||
@ -469,7 +493,7 @@ static void cheatmenu_cb(void)
|
|||||||
gxDrawRectangle(15, 342, 358, 26, 127, (GXColor)BG_COLOR_2);
|
gxDrawRectangle(15, 342, 358, 26, 127, (GXColor)BG_COLOR_2);
|
||||||
|
|
||||||
/* Draw Cheat list */
|
/* Draw Cheat list */
|
||||||
for (i=0; i<maxcheats; i++)
|
for (i=0; ((offset + i) < maxcheats) && (i < 10); i++)
|
||||||
{
|
{
|
||||||
if (i == selection)
|
if (i == selection)
|
||||||
{
|
{
|
||||||
@ -483,24 +507,24 @@ static void cheatmenu_cb(void)
|
|||||||
if (menu_cheats.bg_images[6].state & IMAGE_VISIBLE)
|
if (menu_cheats.bg_images[6].state & IMAGE_VISIBLE)
|
||||||
{
|
{
|
||||||
/* adjust offset so that last characters are visible */
|
/* adjust offset so that last characters are visible */
|
||||||
string_offset += FONT_writeCenter(cheatlist[i].text+string_offset,16,40,366,yoffset+21,(GXColor)WHITE);
|
string_offset += FONT_writeCenter(cheatlist[offset + i].text+string_offset,16,40,366,yoffset+21,(GXColor)WHITE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* scroll text (speed = 1/10 frame) */
|
/* scroll text (speed = 1/10 frame) */
|
||||||
if ((string_offset/10) >= strlen(cheatlist[i].text))
|
if ((string_offset/10) >= strlen(cheatlist[offset + i].text))
|
||||||
{
|
{
|
||||||
string_offset = 0;
|
string_offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string_offset)
|
if (string_offset)
|
||||||
{
|
{
|
||||||
sprintf(temp,"%s ",cheatlist[i].text+string_offset/10);
|
sprintf(temp,"%s ",cheatlist[offset + i].text+string_offset/10);
|
||||||
strncat(temp, cheatlist[i].text, string_offset/10);
|
strncat(temp, cheatlist[offset + i].text, string_offset/10);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(temp, cheatlist[i].text);
|
strcpy(temp, cheatlist[offset + i].text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FONT_writeCenter(temp,16,40,366,yoffset+21,(GXColor)WHITE))
|
if (FONT_writeCenter(temp,16,40,366,yoffset+21,(GXColor)WHITE))
|
||||||
@ -512,23 +536,23 @@ static void cheatmenu_cb(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FONT_writeCenter(cheatlist[i].code,18,40,366,yoffset+22,(GXColor)WHITE);
|
FONT_writeCenter(cheatlist[offset + i].code,18,40,366,yoffset+22,(GXColor)WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (type)
|
if (type)
|
||||||
{
|
{
|
||||||
FONT_writeCenter(cheatlist[i].text,16,40,366,yoffset+21,(GXColor)WHITE);
|
FONT_writeCenter(cheatlist[offset + i].text,16,40,366,yoffset+21,(GXColor)WHITE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FONT_writeCenter(cheatlist[i].code,18,40,366,yoffset+22,(GXColor)WHITE);
|
FONT_writeCenter(cheatlist[offset + i].code,18,40,366,yoffset+22,(GXColor)WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* draw cheat enable mark */
|
/* draw cheat enable mark */
|
||||||
if (cheatlist[i].enable)
|
if (cheatlist[offset + i].enable)
|
||||||
{
|
{
|
||||||
gxDrawTexture(star.texture,20,yoffset+5,16,16,255);
|
gxDrawTexture(star.texture,20,yoffset+5,16,16,255);
|
||||||
}
|
}
|
||||||
@ -537,9 +561,9 @@ static void cheatmenu_cb(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* New Entry */
|
/* New Entry */
|
||||||
if (maxcheats < 10)
|
if (i < 10)
|
||||||
{
|
{
|
||||||
if (maxcheats == selection)
|
if (i == selection)
|
||||||
{
|
{
|
||||||
/* selection bar */
|
/* selection bar */
|
||||||
gxDrawTexture(bar_over.texture,16,yoffset+1,356,24,255);
|
gxDrawTexture(bar_over.texture,16,yoffset+1,356,24,255);
|
||||||
@ -547,7 +571,7 @@ static void cheatmenu_cb(void)
|
|||||||
/* check if new code is being edited */
|
/* check if new code is being edited */
|
||||||
if (menu_cheats.bg_images[6].state & IMAGE_VISIBLE)
|
if (menu_cheats.bg_images[6].state & IMAGE_VISIBLE)
|
||||||
{
|
{
|
||||||
FONT_writeCenter(cheatlist[selection].code,18,40,366,yoffset+22,(GXColor)WHITE);
|
FONT_writeCenter(cheatlist[offset + selection].code,18,40,366,yoffset+22,(GXColor)WHITE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -561,6 +585,7 @@ static void cheatmenu_cb(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gxTextureClose(&bar_over.texture);
|
gxTextureClose(&bar_over.texture);
|
||||||
|
gxTextureClose(&star.texture);
|
||||||
|
|
||||||
/* Extra helpers */
|
/* Extra helpers */
|
||||||
if (maxcheats && !(menu_cheats.bg_images[6].state & IMAGE_VISIBLE))
|
if (maxcheats && !(menu_cheats.bg_images[6].state & IMAGE_VISIBLE))
|
||||||
@ -578,7 +603,7 @@ static void cheatmenu_cb(void)
|
|||||||
gxTextureClose(&key_switch.texture);
|
gxTextureClose(&key_switch.texture);
|
||||||
|
|
||||||
/* delete & enable cheats */
|
/* delete & enable cheats */
|
||||||
if (menu_cheats.selected < maxcheats)
|
if ((offset + selection) < maxcheats)
|
||||||
{
|
{
|
||||||
gui_image key_enable;
|
gui_image key_enable;
|
||||||
gui_image key_delete;
|
gui_image key_delete;
|
||||||
@ -588,14 +613,14 @@ static void cheatmenu_cb(void)
|
|||||||
gxDrawTexture(key_delete.texture,152,424,24,24,255);
|
gxDrawTexture(key_delete.texture,152,424,24,24,255);
|
||||||
gxDrawTexture(key_enable.texture,372,424,24,24,255);
|
gxDrawTexture(key_enable.texture,372,424,24,24,255);
|
||||||
FONT_write("Delete\nCheat",16,184,436,640,(GXColor)WHITE);
|
FONT_write("Delete\nCheat",16,184,436,640,(GXColor)WHITE);
|
||||||
FONT_write(cheatlist[selection].enable ? "Disable\nCheat":"Enable\nCheat",16,404,436,640,(GXColor)WHITE);
|
FONT_write(cheatlist[offset + selection].enable ? "Disable\nCheat":"Enable\nCheat",16,404,436,640,(GXColor)WHITE);
|
||||||
#else
|
#else
|
||||||
key_enable.texture = gxTextureOpenPNG(Key_L_gcn_png,0);
|
key_delete.texture = gxTextureOpenPNG(Key_L_gcn_png,0);
|
||||||
key_delete.texture = gxTextureOpenPNG(Key_R_gcn_png,0);
|
key_enable.texture = gxTextureOpenPNG(Key_R_gcn_png,0);
|
||||||
gxDrawTexture(key_delete.texture,136,426,44,20,255);
|
gxDrawTexture(key_delete.texture,136,426,44,20,255);
|
||||||
gxDrawTexture(key_enable.texture,368,426,44,20,255);
|
gxDrawTexture(key_enable.texture,368,426,44,20,255);
|
||||||
FONT_write("Delete\nCheat",16,188,436,640,(GXColor)WHITE);
|
FONT_write("Delete\nCheat",16,188,436,640,(GXColor)WHITE);
|
||||||
FONT_write(cheatlist[selection].enable ? "Disable\nCheat":"Enable\nCheat",16,420,436,640,(GXColor)WHITE);
|
FONT_write(cheatlist[offset + selection].enable ? "Disable\nCheat":"Enable\nCheat",16,420,436,640,(GXColor)WHITE);
|
||||||
#endif
|
#endif
|
||||||
gxTextureClose(&key_enable.texture);
|
gxTextureClose(&key_enable.texture);
|
||||||
gxTextureClose(&key_delete.texture);
|
gxTextureClose(&key_delete.texture);
|
||||||
@ -613,7 +638,7 @@ static void cheatmenu_cb(void)
|
|||||||
void CheatMenu(void)
|
void CheatMenu(void)
|
||||||
{
|
{
|
||||||
int i, update = 0;
|
int i, update = 0;
|
||||||
int offset = 0;
|
int digit_cnt = 0;
|
||||||
int max = 0;
|
int max = 0;
|
||||||
char temp[256];
|
char temp[256];
|
||||||
char *str = NULL;
|
char *str = NULL;
|
||||||
@ -623,6 +648,9 @@ void CheatMenu(void)
|
|||||||
/* clear existing ROM patches */
|
/* clear existing ROM patches */
|
||||||
clear_cheats();
|
clear_cheats();
|
||||||
|
|
||||||
|
/* reset scrolling */
|
||||||
|
string_offset = 0;
|
||||||
|
|
||||||
/* background type */
|
/* background type */
|
||||||
if (config.bg_type > 0)
|
if (config.bg_type > 0)
|
||||||
{
|
{
|
||||||
@ -668,13 +696,35 @@ void CheatMenu(void)
|
|||||||
|
|
||||||
while (update != -1)
|
while (update != -1)
|
||||||
{
|
{
|
||||||
|
/* update arrows buttons */
|
||||||
|
if (offset > 0) m->arrows[0]->state |= BUTTON_VISIBLE;
|
||||||
|
else m->arrows[0]->state &= ~BUTTON_VISIBLE;
|
||||||
|
if ((offset + 10) < (maxcheats + 1)) m->arrows[1]->state |= BUTTON_VISIBLE;
|
||||||
|
else m->arrows[1]->state &= ~BUTTON_VISIBLE;
|
||||||
|
|
||||||
/* draw menu */
|
/* draw menu */
|
||||||
GUI_DrawMenu(m);
|
GUI_DrawMenu(m);
|
||||||
|
|
||||||
|
/* restore cheats offset */
|
||||||
|
if (!(menu_cheats.bg_images[6].state & IMAGE_VISIBLE))
|
||||||
|
{
|
||||||
|
m->offset = offset;
|
||||||
|
m->max_items = maxcheats + 1;
|
||||||
|
m->max_buttons = 10;
|
||||||
|
}
|
||||||
|
|
||||||
/* update menu */
|
/* update menu */
|
||||||
update = GUI_UpdateMenu(m);
|
update = GUI_UpdateMenu(m);
|
||||||
|
|
||||||
/* update selection */
|
/* save offset then restore default */
|
||||||
|
if (!(menu_cheats.bg_images[6].state & IMAGE_VISIBLE))
|
||||||
|
{
|
||||||
|
offset = m->offset;
|
||||||
|
m->offset = 0;
|
||||||
|
m->max_items = m->max_buttons = 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* update selected cheat */
|
||||||
if ((m->selected < 10) && (selection != m->selected))
|
if ((m->selected < 10) && (selection != m->selected))
|
||||||
{
|
{
|
||||||
selection = m->selected;
|
selection = m->selected;
|
||||||
@ -697,17 +747,17 @@ void CheatMenu(void)
|
|||||||
case 8:
|
case 8:
|
||||||
case 9: /* Edit cheat */
|
case 9: /* Edit cheat */
|
||||||
{
|
{
|
||||||
if (type && (selection != maxcheats))
|
if (type && ((selection + offset) != maxcheats))
|
||||||
{
|
{
|
||||||
/* cheat description */
|
/* cheat description */
|
||||||
str = cheatlist[selection].text;
|
str = cheatlist[offset + selection].text;
|
||||||
strcpy(temp, str);
|
strcpy(temp, str);
|
||||||
max = 34;
|
max = MAX_DESC_LENGTH - 2;
|
||||||
offset = strlen(str);
|
digit_cnt = strlen(str);
|
||||||
if (offset <= max)
|
if (digit_cnt <= max)
|
||||||
{
|
{
|
||||||
str[offset] = '*';
|
str[digit_cnt] = '*';
|
||||||
str[offset+1] = 0;
|
str[digit_cnt+1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* init specific characters */
|
/* init specific characters */
|
||||||
@ -719,13 +769,13 @@ void CheatMenu(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* cheat code */
|
/* cheat code */
|
||||||
str = cheatlist[selection].code;
|
str = cheatlist[offset + selection].code;
|
||||||
strcpy(temp, str);
|
strcpy(temp, str);
|
||||||
if (selection == maxcheats)
|
if ((offset + selection) == maxcheats)
|
||||||
{
|
{
|
||||||
/* initialize code */
|
/* initialize code */
|
||||||
max = 0;
|
max = 0;
|
||||||
offset = 0;
|
digit_cnt = 0;
|
||||||
str[0] = '*';
|
str[0] = '*';
|
||||||
str[1] = 0;
|
str[1] = 0;
|
||||||
}
|
}
|
||||||
@ -742,7 +792,7 @@ void CheatMenu(void)
|
|||||||
/* AR code */
|
/* AR code */
|
||||||
max = 10;
|
max = 10;
|
||||||
}
|
}
|
||||||
offset = max + 1;
|
digit_cnt = max + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* init specific characters */
|
/* init specific characters */
|
||||||
@ -761,6 +811,10 @@ void CheatMenu(void)
|
|||||||
/* disable left buttons */
|
/* disable left buttons */
|
||||||
for (i=0; i<10; i++) m->buttons[i].state &= ~BUTTON_ACTIVE;
|
for (i=0; i<10; i++) m->buttons[i].state &= ~BUTTON_ACTIVE;
|
||||||
|
|
||||||
|
/* disable arrow buttons */
|
||||||
|
m->arrows[0]->state &= ~BUTTON_ACTIVE;
|
||||||
|
m->arrows[1]->state &= ~BUTTON_ACTIVE;
|
||||||
|
|
||||||
/* slide in right window */
|
/* slide in right window */
|
||||||
GUI_DrawMenuFX(m,20,0);
|
GUI_DrawMenuFX(m,20,0);
|
||||||
|
|
||||||
@ -777,20 +831,20 @@ void CheatMenu(void)
|
|||||||
|
|
||||||
case 26: /* Backspace */
|
case 26: /* Backspace */
|
||||||
{
|
{
|
||||||
if (offset > 0)
|
if (digit_cnt > 0)
|
||||||
{
|
{
|
||||||
/* delete last character */
|
/* delete last character */
|
||||||
str[offset--] = 0;
|
str[digit_cnt--] = 0;
|
||||||
|
|
||||||
/* code separator is being deleted */
|
/* code separator is being deleted */
|
||||||
if ((str[offset] == ':') || (str[offset] == '-'))
|
if ((str[digit_cnt] == ':') || (str[digit_cnt] == '-'))
|
||||||
{
|
{
|
||||||
/* reset detected code type */
|
/* reset detected code type */
|
||||||
max = 0;
|
max = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* edit mark */
|
/* edit mark */
|
||||||
str[offset] = '*';
|
str[digit_cnt] = '*';
|
||||||
|
|
||||||
/* update scroll value if necessary */
|
/* update scroll value if necessary */
|
||||||
if (string_offset > 0) string_offset--;
|
if (string_offset > 0) string_offset--;
|
||||||
@ -800,17 +854,17 @@ void CheatMenu(void)
|
|||||||
|
|
||||||
case 27:
|
case 27:
|
||||||
{
|
{
|
||||||
if (type && (selection != maxcheats))
|
if (type && ((offset + selection) != maxcheats))
|
||||||
{
|
{
|
||||||
/* SPACE character */
|
/* SPACE character */
|
||||||
if (offset <= max)
|
if (digit_cnt <= max)
|
||||||
{
|
{
|
||||||
str[offset++] = ' ';
|
str[digit_cnt++] = ' ';
|
||||||
str[offset] = 0;
|
str[digit_cnt] = 0;
|
||||||
if (offset <= max)
|
if (digit_cnt <= max)
|
||||||
{
|
{
|
||||||
str[offset] = '*';
|
str[digit_cnt] = '*';
|
||||||
str[offset+1] = 0;
|
str[digit_cnt+1] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -819,23 +873,23 @@ void CheatMenu(void)
|
|||||||
/* Separator character (only if code type has not yet been determined) */
|
/* Separator character (only if code type has not yet been determined) */
|
||||||
if (max == 0)
|
if (max == 0)
|
||||||
{
|
{
|
||||||
if (offset == 4)
|
if (digit_cnt == 4)
|
||||||
{
|
{
|
||||||
/* GG code */
|
/* GG code */
|
||||||
max = 8;
|
max = 8;
|
||||||
str[4] = '-';
|
str[4] = '-';
|
||||||
str[5] = '*';
|
str[5] = '*';
|
||||||
str[6] = 0;
|
str[6] = 0;
|
||||||
offset++;
|
digit_cnt++;
|
||||||
}
|
}
|
||||||
else if (offset == 6)
|
else if (digit_cnt == 6)
|
||||||
{
|
{
|
||||||
/* AR code */
|
/* AR code */
|
||||||
max = 10;
|
max = 10;
|
||||||
str[6] = ':';
|
str[6] = ':';
|
||||||
str[7] = '*';
|
str[7] = '*';
|
||||||
str[8] = 0;
|
str[8] = 0;
|
||||||
offset++;
|
digit_cnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -853,31 +907,31 @@ void CheatMenu(void)
|
|||||||
case 29: /* Validate entry */
|
case 29: /* Validate entry */
|
||||||
{
|
{
|
||||||
/* check if entry is valid */
|
/* check if entry is valid */
|
||||||
if (type && (selection != maxcheats))
|
if (type && ((offset + selection) != maxcheats))
|
||||||
{
|
{
|
||||||
str[offset] = 0;
|
str[digit_cnt] = 0;
|
||||||
update = -1;
|
update = -1;
|
||||||
}
|
}
|
||||||
else if (max && (offset > max))
|
else if (max && (digit_cnt > max))
|
||||||
{
|
{
|
||||||
address = data = 0;
|
address = data = 0;
|
||||||
if (decode_cheat(cheatlist[selection].code, &address, &data))
|
if (decode_cheat(cheatlist[offset + selection].code, &address, &data))
|
||||||
{
|
{
|
||||||
/* update cheat address & data values */
|
/* update cheat address & data values */
|
||||||
cheatlist[selection].address = address;
|
cheatlist[offset + selection].address = address;
|
||||||
cheatlist[selection].data = data;
|
cheatlist[offset + selection].data = data;
|
||||||
|
|
||||||
/* new cheat ? */
|
/* new cheat ? */
|
||||||
if (selection == maxcheats)
|
if ((offset + selection) == maxcheats)
|
||||||
{
|
{
|
||||||
/* increase cheat count */
|
/* increase cheat count */
|
||||||
maxcheats++;
|
maxcheats++;
|
||||||
|
|
||||||
/* enable cheat by default */
|
/* enable cheat by default */
|
||||||
cheatlist[selection].enable = 1;
|
cheatlist[offset + selection].enable = 1;
|
||||||
|
|
||||||
/* no description by default */
|
/* no description by default */
|
||||||
strcpy(cheatlist[selection].text,"No Description");
|
strcpy(cheatlist[offset + selection].text,"No Description");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return to cheat selection */
|
/* return to cheat selection */
|
||||||
@ -894,17 +948,17 @@ void CheatMenu(void)
|
|||||||
default: /* Add Character */
|
default: /* Add Character */
|
||||||
{
|
{
|
||||||
/* force code separator if none has been set yet */
|
/* force code separator if none has been set yet */
|
||||||
if ((max == 0) && (offset == 6)) break;
|
if ((max == 0) && (digit_cnt == 6)) break;
|
||||||
|
|
||||||
/* add character */
|
/* add character */
|
||||||
if ((offset <= max) || (max == 0))
|
if ((digit_cnt <= max) || (max == 0))
|
||||||
{
|
{
|
||||||
str[offset++] = m->items[m->selected].text[0];
|
str[digit_cnt++] = m->items[m->selected].text[0];
|
||||||
str[offset] = 0;
|
str[digit_cnt] = 0;
|
||||||
if ((offset <= max) || (max == 0))
|
if ((digit_cnt <= max) || (max == 0))
|
||||||
{
|
{
|
||||||
str[offset] = '*';
|
str[digit_cnt] = '*';
|
||||||
str[offset+1] = 0;
|
str[digit_cnt+1] = 0;
|
||||||
}
|
}
|
||||||
if (string_offset > 0) string_offset ++;
|
if (string_offset > 0) string_offset ++;
|
||||||
}
|
}
|
||||||
@ -933,13 +987,13 @@ void CheatMenu(void)
|
|||||||
string_offset = 0;
|
string_offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selection < maxcheats)
|
if ((offset + selection) < maxcheats)
|
||||||
{
|
{
|
||||||
/* Special inputs */
|
/* Special inputs */
|
||||||
if (m_input.keys & PAD_TRIGGER_L)
|
if (m_input.keys & PAD_TRIGGER_L)
|
||||||
{
|
{
|
||||||
/* sort cheat list */
|
/* sort cheat list */
|
||||||
for (i = selection + 1; i < maxcheats; i++)
|
for (i = offset + selection + 1; i < maxcheats; i++)
|
||||||
{
|
{
|
||||||
strcpy(cheatlist[i-1].text,cheatlist[i].text);
|
strcpy(cheatlist[i-1].text,cheatlist[i].text);
|
||||||
strcpy(cheatlist[i-1].code,cheatlist[i].code);
|
strcpy(cheatlist[i-1].code,cheatlist[i].code);
|
||||||
@ -956,10 +1010,10 @@ void CheatMenu(void)
|
|||||||
cheatlist[maxcheats-1].enable = 0;
|
cheatlist[maxcheats-1].enable = 0;
|
||||||
|
|
||||||
/* disable last button */
|
/* disable last button */
|
||||||
if (maxcheats < 10)
|
if ((maxcheats - offset) < 10)
|
||||||
{
|
{
|
||||||
m->buttons[maxcheats].state &= ~BUTTON_ACTIVE;
|
m->buttons[maxcheats - offset].state &= ~BUTTON_ACTIVE;
|
||||||
m->buttons[maxcheats - 1].shift[1] = 0;
|
m->buttons[maxcheats - offset - 1].shift[1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* decrease cheat count */
|
/* decrease cheat count */
|
||||||
@ -971,7 +1025,7 @@ void CheatMenu(void)
|
|||||||
else if (m_input.keys & PAD_TRIGGER_R)
|
else if (m_input.keys & PAD_TRIGGER_R)
|
||||||
{
|
{
|
||||||
/* cheat ON/OFF */
|
/* cheat ON/OFF */
|
||||||
cheatlist[selection].enable ^= 1;
|
cheatlist[offset + selection].enable ^= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -990,22 +1044,29 @@ void CheatMenu(void)
|
|||||||
/* hide right window */
|
/* hide right window */
|
||||||
m->bg_images[6].state &= ~IMAGE_VISIBLE;
|
m->bg_images[6].state &= ~IMAGE_VISIBLE;
|
||||||
|
|
||||||
/* enable left buttons */
|
/* update left buttons */
|
||||||
for (i=0; i<maxcheats; i++)
|
for (i=0; i<10; i++)
|
||||||
|
{
|
||||||
|
if ((offset + i) < maxcheats)
|
||||||
{
|
{
|
||||||
m->buttons[i].state |= BUTTON_ACTIVE;
|
m->buttons[i].state |= BUTTON_ACTIVE;
|
||||||
m->buttons[i].shift[1] = 1;
|
m->buttons[i].shift[1] = 1;
|
||||||
}
|
}
|
||||||
|
else if ((offset + i) == maxcheats)
|
||||||
if (maxcheats < 10)
|
|
||||||
{
|
{
|
||||||
m->buttons[maxcheats].state |= BUTTON_ACTIVE;
|
m->buttons[i].state |= BUTTON_ACTIVE;
|
||||||
m->buttons[maxcheats].shift[1] = 0;
|
m->buttons[i].shift[1] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m->buttons[9].shift[1] = 0;
|
m->buttons[i].state &= ~BUTTON_ACTIVE;
|
||||||
|
m->buttons[i].shift[1] = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* enable arrow buttons */
|
||||||
|
m->arrows[0]->state |= BUTTON_ACTIVE;
|
||||||
|
m->arrows[1]->state |= BUTTON_ACTIVE;
|
||||||
|
|
||||||
/* restore helper */
|
/* restore helper */
|
||||||
strcpy(action_cancel.comment,"Back");
|
strcpy(action_cancel.comment,"Back");
|
||||||
@ -1075,7 +1136,7 @@ void CheatLoad(void)
|
|||||||
char temp[256];
|
char temp[256];
|
||||||
|
|
||||||
/* reset cheat count */
|
/* reset cheat count */
|
||||||
selection = maxcheats = 0;
|
maxcheats = 0;
|
||||||
|
|
||||||
/* make cheat filename */
|
/* make cheat filename */
|
||||||
sprintf(temp, "%s/cheats/%s.pat", DEFAULT_PATH, rom_filename);
|
sprintf(temp, "%s/cheats/%s.pat", DEFAULT_PATH, rom_filename);
|
||||||
@ -1088,7 +1149,7 @@ void CheatLoad(void)
|
|||||||
memset(temp, 0, 256);
|
memset(temp, 0, 256);
|
||||||
|
|
||||||
/* read cheats from file (one line per cheat) */
|
/* read cheats from file (one line per cheat) */
|
||||||
while (fgets(temp, 256, f) && (maxcheats < 10) && (cnt < 10))
|
while (fgets(temp, 256, f) && (maxcheats < MAX_CHEATS) && (cnt < MAX_CHEATS))
|
||||||
{
|
{
|
||||||
/* remove CR & EOL chars */
|
/* remove CR & EOL chars */
|
||||||
if ((temp[strlen(temp) - 2] == 0x0d) || (temp[strlen(temp) - 2] == 0x0a)) temp[strlen(temp) - 2] = 0;
|
if ((temp[strlen(temp) - 2] == 0x0d) || (temp[strlen(temp) - 2] == 0x0a)) temp[strlen(temp) - 2] = 0;
|
||||||
@ -1113,18 +1174,18 @@ void CheatLoad(void)
|
|||||||
while ((temp[len] == 0x20) || (temp[len] == 0x09)) len++;
|
while ((temp[len] == 0x20) || (temp[len] == 0x09)) len++;
|
||||||
|
|
||||||
/* copy cheat description */
|
/* copy cheat description */
|
||||||
strncpy(cheatlist[maxcheats].text, &temp[len], 35);
|
strncpy(cheatlist[maxcheats].text, &temp[len], MAX_DESC_LENGTH - 1);
|
||||||
cheatlist[maxcheats].text[35] = 0;
|
cheatlist[maxcheats].text[MAX_DESC_LENGTH - 1] = 0;
|
||||||
|
|
||||||
/* increment cheat count */
|
/* increment cheat count */
|
||||||
maxcheats++;
|
maxcheats++;
|
||||||
}
|
}
|
||||||
else if (!strncmp(temp,"ON",2))
|
else if (!strcmp(temp,"ON") && config.autocheat)
|
||||||
{
|
{
|
||||||
/* enable flag */
|
/* enable flag */
|
||||||
cheatlist[cnt++].enable = 1;
|
cheatlist[cnt++].enable = 1;
|
||||||
}
|
}
|
||||||
else if (!strncmp(temp,"OFF",3))
|
else if (!strcmp(temp,"OFF") && config.autocheat)
|
||||||
{
|
{
|
||||||
/* disable flag */
|
/* disable flag */
|
||||||
cheatlist[cnt++].enable = 0;
|
cheatlist[cnt++].enable = 0;
|
||||||
@ -1142,20 +1203,27 @@ void CheatLoad(void)
|
|||||||
apply_cheats();
|
apply_cheats();
|
||||||
|
|
||||||
/* adjust menu buttons */
|
/* adjust menu buttons */
|
||||||
for (cnt=0; cnt<maxcheats; cnt++)
|
for (cnt=0; cnt<10; cnt++)
|
||||||
|
{
|
||||||
|
if (cnt < maxcheats)
|
||||||
{
|
{
|
||||||
menu_cheats.buttons[cnt].state |= BUTTON_ACTIVE;
|
menu_cheats.buttons[cnt].state |= BUTTON_ACTIVE;
|
||||||
menu_cheats.buttons[cnt].shift[1] = 1;
|
menu_cheats.buttons[cnt].shift[1] = 1;
|
||||||
}
|
}
|
||||||
if (maxcheats < 10)
|
else if (cnt == maxcheats)
|
||||||
{
|
{
|
||||||
menu_cheats.buttons[maxcheats].state |= BUTTON_ACTIVE;
|
menu_cheats.buttons[cnt].state |= BUTTON_ACTIVE;
|
||||||
menu_cheats.buttons[maxcheats].shift[1] = 0;
|
menu_cheats.buttons[cnt].shift[1] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
menu_cheats.buttons[9].shift[1] = 0;
|
menu_cheats.buttons[cnt].shift[1] = 0;
|
||||||
|
menu_cheats.buttons[cnt].state &= ~BUTTON_ACTIVE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* reset menu */
|
||||||
|
selection = offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -1166,24 +1234,23 @@ void CheatLoad(void)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void CheatUpdate(void)
|
void CheatUpdate(void)
|
||||||
{
|
{
|
||||||
if (patchRAM)
|
int index, cnt = maxRAMcheats;
|
||||||
|
|
||||||
|
while (cnt)
|
||||||
{
|
{
|
||||||
int i;
|
/* get cheat index */
|
||||||
for (i = 0; i < maxcheats; i++)
|
index = RAMcheatlist[--cnt];
|
||||||
{
|
|
||||||
if (cheatlist[i].enable && (cheatlist[i].address >= 0xFF0000))
|
/* apply RAM patch */
|
||||||
{
|
if (cheatlist[index].data & 0xFF00)
|
||||||
if (cheatlist[i].data & 0xFF00)
|
|
||||||
{
|
{
|
||||||
/* word patch */
|
/* word patch */
|
||||||
*(u16 *)(work_ram + (cheatlist[i].address & 0xFFFE)) = cheatlist[i].data;
|
*(u16 *)(work_ram + (cheatlist[index].address & 0xFFFE)) = cheatlist[index].data;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* byte patch */
|
/* byte patch */
|
||||||
work_ram[cheatlist[i].address & 0xFFFF] = cheatlist[i].data;
|
work_ram[cheatlist[index].address & 0xFFFF] = cheatlist[index].data;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -743,7 +743,7 @@ int GUI_UpdateMenu(gui_menu *menu)
|
|||||||
if (selected >= max_buttons)
|
if (selected >= max_buttons)
|
||||||
{
|
{
|
||||||
selected = max_buttons - 1;
|
selected = max_buttons - 1;
|
||||||
if ((menu->offset + selected < (max_items - 1)))
|
if ((menu->offset + selected) < (max_items - 1))
|
||||||
menu->offset ++;
|
menu->offset ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -763,7 +763,7 @@ int GUI_UpdateMenu(gui_menu *menu)
|
|||||||
if (selected >= max_buttons)
|
if (selected >= max_buttons)
|
||||||
{
|
{
|
||||||
selected = max_buttons - 1;
|
selected = max_buttons - 1;
|
||||||
if ((menu->offset + selected < (max_items - 1)))
|
if ((menu->offset + selected) < (max_items - 1))
|
||||||
menu->offset ++;
|
menu->offset ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -826,24 +826,6 @@ int GUI_UpdateMenu(gui_menu *menu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update arrows buttons status (items list) */
|
|
||||||
button = menu->arrows[0];
|
|
||||||
if (button)
|
|
||||||
{
|
|
||||||
if (menu->offset > 0)
|
|
||||||
button->state |= BUTTON_VISIBLE;
|
|
||||||
else
|
|
||||||
button->state &= ~BUTTON_VISIBLE;
|
|
||||||
}
|
|
||||||
button = menu->arrows[1];
|
|
||||||
if (button)
|
|
||||||
{
|
|
||||||
if ((menu->offset + max_buttons) < max_items)
|
|
||||||
button->state |= BUTTON_VISIBLE;
|
|
||||||
else
|
|
||||||
button->state &= ~BUTTON_VISIBLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
{
|
{
|
||||||
if (selected < max_buttons)
|
if (selected < max_buttons)
|
||||||
@ -871,6 +853,23 @@ int GUI_RunMenu(gui_menu *menu)
|
|||||||
{
|
{
|
||||||
GUI_DrawMenu(menu);
|
GUI_DrawMenu(menu);
|
||||||
update = GUI_UpdateMenu(menu);
|
update = GUI_UpdateMenu(menu);
|
||||||
|
|
||||||
|
/* update arrows buttons status (items list) */
|
||||||
|
if (menu->arrows[0])
|
||||||
|
{
|
||||||
|
if (menu->offset > 0)
|
||||||
|
menu->arrows[0]->state |= BUTTON_VISIBLE;
|
||||||
|
else
|
||||||
|
menu->arrows[0]->state &= ~BUTTON_VISIBLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (menu->arrows[1])
|
||||||
|
{
|
||||||
|
if ((menu->offset + menu->max_buttons) < menu->max_items)
|
||||||
|
menu->arrows[1]->state |= BUTTON_VISIBLE;
|
||||||
|
else
|
||||||
|
menu->arrows[1]->state &= ~BUTTON_VISIBLE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update == 2)
|
if (update == 2)
|
||||||
@ -1739,7 +1738,14 @@ static void *MsgBox_Thread(gui_message *message_box)
|
|||||||
while (message_box->refresh)
|
while (message_box->refresh)
|
||||||
{
|
{
|
||||||
/* draw parent menu */
|
/* draw parent menu */
|
||||||
|
if (message_box->parent)
|
||||||
|
{
|
||||||
GUI_DrawMenu(message_box->parent);
|
GUI_DrawMenu(message_box->parent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gxClearScreen(bg_color);
|
||||||
|
}
|
||||||
|
|
||||||
/* draw window */
|
/* draw window */
|
||||||
gxDrawTexture(message_box->window,166,160,message_box->window->width,message_box->window->height,230);
|
gxDrawTexture(message_box->window,166,160,message_box->window->width,message_box->window->height,230);
|
||||||
@ -1810,17 +1816,27 @@ void GUI_MsgBoxOpen(char *title, char *msg, bool throbber)
|
|||||||
int ypos = 248;
|
int ypos = 248;
|
||||||
|
|
||||||
/* disable helper comments */
|
/* disable helper comments */
|
||||||
|
if (message_box.parent)
|
||||||
|
{
|
||||||
if (message_box.parent->helpers[0])
|
if (message_box.parent->helpers[0])
|
||||||
message_box.parent->helpers[0]->data = 0;
|
message_box.parent->helpers[0]->data = 0;
|
||||||
if (message_box.parent->helpers[1])
|
if (message_box.parent->helpers[1])
|
||||||
message_box.parent->helpers[1]->data = 0;
|
message_box.parent->helpers[1]->data = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* slide in */
|
/* slide in */
|
||||||
int yoffset = ywindow + message_box.window->height;
|
int yoffset = ywindow + message_box.window->height;
|
||||||
while (yoffset > 0)
|
while (yoffset > 0)
|
||||||
{
|
{
|
||||||
/* draw parent menu */
|
/* draw parent menu */
|
||||||
|
if (message_box.parent)
|
||||||
|
{
|
||||||
GUI_DrawMenu(message_box.parent);
|
GUI_DrawMenu(message_box.parent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gxClearScreen(bg_color);
|
||||||
|
}
|
||||||
|
|
||||||
/* draw window */
|
/* draw window */
|
||||||
gxDrawTexture(message_box.window,xwindow,ywindow-yoffset,message_box.window->width,message_box.window->height,230);
|
gxDrawTexture(message_box.window,xwindow,ywindow-yoffset,message_box.window->width,message_box.window->height,230);
|
||||||
@ -1866,7 +1882,14 @@ void GUI_MsgBoxClose(void)
|
|||||||
while (yoffset < (ywindow + message_box.window->height))
|
while (yoffset < (ywindow + message_box.window->height))
|
||||||
{
|
{
|
||||||
/* draw parent menu */
|
/* draw parent menu */
|
||||||
|
if (message_box.parent)
|
||||||
|
{
|
||||||
GUI_DrawMenu(message_box.parent);
|
GUI_DrawMenu(message_box.parent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gxClearScreen(bg_color);
|
||||||
|
}
|
||||||
|
|
||||||
/* draw window */
|
/* draw window */
|
||||||
gxDrawTexture(message_box.window,xwindow,ywindow-yoffset,message_box.window->width,message_box.window->height,230);
|
gxDrawTexture(message_box.window,xwindow,ywindow-yoffset,message_box.window->width,message_box.window->height,230);
|
||||||
@ -1887,6 +1910,8 @@ void GUI_MsgBoxClose(void)
|
|||||||
yoffset += 60;
|
yoffset += 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (message_box.parent)
|
||||||
|
{
|
||||||
/* restore helper comment */
|
/* restore helper comment */
|
||||||
if (message_box.parent->helpers[0])
|
if (message_box.parent->helpers[0])
|
||||||
message_box.parent->helpers[0]->data = Key_B_png;
|
message_box.parent->helpers[0]->data = Key_B_png;
|
||||||
@ -1895,6 +1920,12 @@ void GUI_MsgBoxClose(void)
|
|||||||
|
|
||||||
/* final position */
|
/* final position */
|
||||||
GUI_DrawMenu(message_box.parent);
|
GUI_DrawMenu(message_box.parent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gxClearScreen(bg_color);
|
||||||
|
}
|
||||||
|
|
||||||
gxSetScreen();
|
gxSetScreen();
|
||||||
|
|
||||||
/* clear all textures */
|
/* clear all textures */
|
||||||
|
@ -306,7 +306,7 @@ static gui_item items_options[5] =
|
|||||||
{NULL,Option_system_png,"","System settings", 114,142,80,92},
|
{NULL,Option_system_png,"","System settings", 114,142,80,92},
|
||||||
{NULL,Option_video_png ,"","Video settings", 288,150,64,84},
|
{NULL,Option_video_png ,"","Video settings", 288,150,64,84},
|
||||||
{NULL,Option_sound_png ,"","Audio settings", 464,154,44,80},
|
{NULL,Option_sound_png ,"","Audio settings", 464,154,44,80},
|
||||||
{NULL,Option_ctrl_png ,"","Input settings", 192,286,88,92},
|
{NULL,Option_ctrl_png ,"","Controllers settings", 192,286,88,92},
|
||||||
{NULL,Option_menu_png ,"","Menu settings", 370,286,60,92}
|
{NULL,Option_menu_png ,"","Menu settings", 370,286,60,92}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -361,9 +361,10 @@ static gui_item items_video[8] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Menu options */
|
/* Menu options */
|
||||||
static gui_item items_prefs[8] =
|
static gui_item items_prefs[9] =
|
||||||
{
|
{
|
||||||
{NULL,NULL,"Load ROM Auto: OFF","Enable/Disable automatic ROM loading on startup", 56,132,276,48},
|
{NULL,NULL,"Auto ROM Load: OFF","Enable/Disable automatic ROM loading on startup", 56,132,276,48},
|
||||||
|
{NULL,NULL,"Auto Cheats: OFF", "Enable/Disable automatic cheats activation", 56,132,276,48},
|
||||||
{NULL,NULL,"Auto Saves: OFF", "Enable/Disable automatic saves", 56,132,276,48},
|
{NULL,NULL,"Auto Saves: OFF", "Enable/Disable automatic saves", 56,132,276,48},
|
||||||
{NULL,NULL,"Saves Device: FAT", "Configure default device for saves", 56,132,276,48},
|
{NULL,NULL,"Saves Device: FAT", "Configure default device for saves", 56,132,276,48},
|
||||||
{NULL,NULL,"SFX Volume: 100", "Adjust sound effects volume", 56,132,276,48},
|
{NULL,NULL,"SFX Volume: 100", "Adjust sound effects volume", 56,132,276,48},
|
||||||
@ -587,7 +588,7 @@ static gui_menu menu_prefs =
|
|||||||
{
|
{
|
||||||
"Menu Settings",
|
"Menu Settings",
|
||||||
0,0,
|
0,0,
|
||||||
8,4,6,0,
|
9,4,6,0,
|
||||||
items_prefs,
|
items_prefs,
|
||||||
buttons_list,
|
buttons_list,
|
||||||
bg_list,
|
bg_list,
|
||||||
@ -634,20 +635,21 @@ static void prefmenu ()
|
|||||||
gui_menu *m = &menu_prefs;
|
gui_menu *m = &menu_prefs;
|
||||||
gui_item *items = m->items;
|
gui_item *items = m->items;
|
||||||
|
|
||||||
sprintf (items[0].text, "Load ROM Auto: %s", config.autoload ? "ON":"OFF");
|
sprintf (items[0].text, "Auto ROM Load: %s", config.autoload ? "ON":"OFF");
|
||||||
if (config.s_auto == 3) sprintf (items[1].text, "Auto Saves: ALL");
|
sprintf (items[1].text, "Auto Cheats: %s", config.autocheat ? "ON":"OFF");
|
||||||
else if (config.s_auto == 2) sprintf (items[1].text, "Auto Saves: STATE ONLY");
|
if (config.s_auto == 3) sprintf (items[2].text, "Auto Saves: ALL");
|
||||||
else if (config.s_auto == 1) sprintf (items[1].text, "Auto Saves: SRAM ONLY");
|
else if (config.s_auto == 2) sprintf (items[2].text, "Auto Saves: STATE ONLY");
|
||||||
else sprintf (items[1].text, "Auto Saves: NONE");
|
else if (config.s_auto == 1) sprintf (items[2].text, "Auto Saves: SRAM ONLY");
|
||||||
if (config.s_device == 1) sprintf (items[2].text, "Saves Device: MCARD A");
|
else sprintf (items[2].text, "Auto Saves: NONE");
|
||||||
else if (config.s_device == 2) sprintf (items[2].text, "Saves Device: MCARD B");
|
if (config.s_device == 1) sprintf (items[3].text, "Saves Device: MCARD A");
|
||||||
else sprintf (items[2].text, "Saves Device: FAT");
|
else if (config.s_device == 2) sprintf (items[3].text, "Saves Device: MCARD B");
|
||||||
sprintf (items[3].text, "SFX Volume: %1.1f", config.sfx_volume);
|
else sprintf (items[3].text, "Saves Device: FAT");
|
||||||
sprintf (items[4].text, "BGM Volume: %1.1f", config.bgm_volume);
|
sprintf (items[4].text, "SFX Volume: %1.1f", config.sfx_volume);
|
||||||
if (config.bg_type) sprintf (items[5].text, "BG Type: COLOR %d", config.bg_type - 1);
|
sprintf (items[5].text, "BGM Volume: %1.1f", config.bgm_volume);
|
||||||
else sprintf (items[5].text, "BG Type: DEFAULT");
|
if (config.bg_type) sprintf (items[6].text, "BG Type: COLOR %d", config.bg_type - 1);
|
||||||
sprintf (items[6].text, "BG Overlay: %s", config.bg_overlay ? "ON":"OFF");
|
else sprintf (items[6].text, "BG Type: DEFAULT");
|
||||||
sprintf (items[7].text, "Screen Width: %d", config.screen_w);
|
sprintf (items[7].text, "BG Overlay: %s", config.bg_overlay ? "ON":"OFF");
|
||||||
|
sprintf (items[8].text, "Screen Width: %d", config.screen_w);
|
||||||
|
|
||||||
GUI_InitMenu(m);
|
GUI_InitMenu(m);
|
||||||
GUI_SlideMenuTitle(m,strlen("Menu "));
|
GUI_SlideMenuTitle(m,strlen("Menu "));
|
||||||
@ -658,57 +660,62 @@ static void prefmenu ()
|
|||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
case 0: /* Auto load last ROM file */
|
case 0: /* Auto load last ROM file on startup */
|
||||||
config.autoload ^= 1;
|
config.autoload ^= 1;
|
||||||
sprintf (items[ret].text, "Load ROM Auto: %s", config.autoload ? "ON":"OFF");
|
sprintf (items[0].text, "Auto ROM Load: %s", config.autoload ? "ON":"OFF");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: /*** Auto load/save STATE & SRAM files ***/
|
case 1: /* Cheats automatic activation */
|
||||||
|
config.autocheat ^= 1;
|
||||||
|
sprintf (items[1].text, "Auto Cheats: %s", config.autocheat ? "ON":"OFF");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2: /*** Auto load/save STATE & SRAM files ***/
|
||||||
config.s_auto = (config.s_auto + 1) % 4;
|
config.s_auto = (config.s_auto + 1) % 4;
|
||||||
if (config.s_auto == 3) sprintf (items[ret].text, "Auto Saves: ALL");
|
if (config.s_auto == 3) sprintf (items[2].text, "Auto Saves: ALL");
|
||||||
else if (config.s_auto == 2) sprintf (items[ret].text, "Auto Saves: STATE ONLY");
|
else if (config.s_auto == 2) sprintf (items[2].text, "Auto Saves: STATE ONLY");
|
||||||
else if (config.s_auto == 1) sprintf (items[ret].text, "Auto Saves: SRAM ONLY");
|
else if (config.s_auto == 1) sprintf (items[2].text, "Auto Saves: SRAM ONLY");
|
||||||
else sprintf (items[ret].text, "Auto Saves: NONE");
|
else sprintf (items[2].text, "Auto Saves: NONE");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: /*** Default saves device ***/
|
case 3: /*** Default saves device ***/
|
||||||
config.s_device = (config.s_device + 1) % 3;
|
config.s_device = (config.s_device + 1) % 3;
|
||||||
if (config.s_device == 1) sprintf (items[ret].text, "Saves Device: MCARD A");
|
if (config.s_device == 1) sprintf (items[3].text, "Saves Device: MCARD A");
|
||||||
else if (config.s_device == 2) sprintf (items[ret].text, "Saves Device: MCARD B");
|
else if (config.s_device == 2) sprintf (items[3].text, "Saves Device: MCARD B");
|
||||||
else sprintf (items[ret].text, "Saves Device: FAT");
|
else sprintf (items[3].text, "Saves Device: FAT");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: /*** Sound effects volume ***/
|
case 4: /*** Sound effects volume ***/
|
||||||
GUI_OptionBox(m,0,"SFX Volume",(void *)&config.sfx_volume,10.0,0.0,100.0,0);
|
GUI_OptionBox(m,0,"SFX Volume",(void *)&config.sfx_volume,10.0,0.0,100.0,0);
|
||||||
sprintf (items[ret].text, "SFX Volume: %1.1f", config.sfx_volume);
|
sprintf (items[4].text, "SFX Volume: %1.1f", config.sfx_volume);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: /*** Background music volume ***/
|
case 5: /*** Background music volume ***/
|
||||||
GUI_OptionBox(m,update_bgm,"BGM Volume",(void *)&config.bgm_volume,10.0,0.0,100.0,0);
|
GUI_OptionBox(m,update_bgm,"BGM Volume",(void *)&config.bgm_volume,10.0,0.0,100.0,0);
|
||||||
sprintf (items[ret].text, "BGM Volume: %1.1f", config.bgm_volume);
|
sprintf (items[5].text, "BGM Volume: %1.1f", config.bgm_volume);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5: /*** Background type ***/
|
case 6: /*** Background type ***/
|
||||||
if (ret < 0) config.bg_type --;
|
if (ret < 0) config.bg_type --;
|
||||||
else config.bg_type++;
|
else config.bg_type++;
|
||||||
if (config.bg_type < 0) config.bg_type = BG_COLOR_MAX;
|
if (config.bg_type < 0) config.bg_type = BG_COLOR_MAX;
|
||||||
else if (config.bg_type > BG_COLOR_MAX) config.bg_type = 0;
|
else if (config.bg_type > BG_COLOR_MAX) config.bg_type = 0;
|
||||||
if (config.bg_type) sprintf (items[5].text, "BG Type: COLOR %d", config.bg_type - 1);
|
if (config.bg_type) sprintf (items[6].text, "BG Type: COLOR %d", config.bg_type - 1);
|
||||||
else sprintf (items[5].text, "BG Type: DEFAULT");
|
else sprintf (items[6].text, "BG Type: DEFAULT");
|
||||||
GUI_DeleteMenu(m);
|
GUI_DeleteMenu(m);
|
||||||
menu_configure();
|
menu_configure();
|
||||||
GUI_InitMenu(m);
|
GUI_InitMenu(m);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6: /*** Background overlay ***/
|
case 7: /*** Background overlay ***/
|
||||||
config.bg_overlay ^= 1;
|
config.bg_overlay ^= 1;
|
||||||
sprintf (items[6].text, "BG Overlay: %s", config.bg_overlay ? "ON":"OFF");
|
sprintf (items[7].text, "BG Overlay: %s", config.bg_overlay ? "ON":"OFF");
|
||||||
menu_configure();
|
menu_configure();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7: /*** Screen Width ***/
|
case 8: /*** Screen Width ***/
|
||||||
GUI_OptionBox(m,update_screen_w,"Screen Width",(void *)&config.screen_w,2,640,VI_MAX_WIDTH_NTSC,1);
|
GUI_OptionBox(m,update_screen_w,"Screen Width",(void *)&config.screen_w,2,640,VI_MAX_WIDTH_NTSC,1);
|
||||||
sprintf (items[7].text, "Screen Width: %d", config.screen_w);
|
sprintf (items[8].text, "Screen Width: %d", config.screen_w);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -1:
|
case -1:
|
||||||
@ -827,7 +834,6 @@ static void soundmenu ()
|
|||||||
ret = 255;
|
ret = 255;
|
||||||
if (cart.romsize)
|
if (cart.romsize)
|
||||||
{
|
{
|
||||||
/* save YM2612 context */
|
|
||||||
temp = memalign(32,YM2612GetContextSize());
|
temp = memalign(32,YM2612GetContextSize());
|
||||||
if (temp)
|
if (temp)
|
||||||
{
|
{
|
||||||
@ -858,20 +864,17 @@ static void soundmenu ()
|
|||||||
|
|
||||||
if (cart.romsize)
|
if (cart.romsize)
|
||||||
{
|
{
|
||||||
/* save YM2612 context */
|
|
||||||
temp = memalign(32,YM2612GetContextSize());
|
temp = memalign(32,YM2612GetContextSize());
|
||||||
if (temp)
|
if (temp)
|
||||||
{
|
{
|
||||||
|
/* save YM2612 context */
|
||||||
memcpy(temp, YM2612GetContextPtr(), YM2612GetContextSize());
|
memcpy(temp, YM2612GetContextPtr(), YM2612GetContextSize());
|
||||||
}
|
|
||||||
|
|
||||||
/* reinitialize audio timings */
|
/* reinitialize audio timings */
|
||||||
audio_init(snd.sample_rate,snd.frame_rate);
|
audio_init(snd.sample_rate,snd.frame_rate);
|
||||||
sound_init();
|
sound_init();
|
||||||
|
|
||||||
/* restore YM2612 context */
|
/* restore YM2612 context */
|
||||||
if (temp)
|
|
||||||
{
|
|
||||||
YM2612Restore(temp);
|
YM2612Restore(temp);
|
||||||
free(temp);
|
free(temp);
|
||||||
}
|
}
|
||||||
@ -889,21 +892,18 @@ static void soundmenu ()
|
|||||||
|
|
||||||
if (cart.romsize)
|
if (cart.romsize)
|
||||||
{
|
{
|
||||||
/* save YM2612 context */
|
|
||||||
temp = memalign(32,YM2612GetContextSize());
|
temp = memalign(32,YM2612GetContextSize());
|
||||||
if (temp)
|
if (temp)
|
||||||
{
|
{
|
||||||
|
/* save YM2612 context */
|
||||||
memcpy(temp, YM2612GetContextPtr(), YM2612GetContextSize());
|
memcpy(temp, YM2612GetContextPtr(), YM2612GetContextSize());
|
||||||
}
|
|
||||||
|
|
||||||
/* reinitialize audio timings */
|
/* reinitialize audio timings */
|
||||||
audio_init(snd.sample_rate,snd.frame_rate);
|
audio_init(snd.sample_rate,snd.frame_rate);
|
||||||
sound_init();
|
sound_init();
|
||||||
|
|
||||||
/* restore YM2612 context */
|
/* restore YM2612 context */
|
||||||
if (temp)
|
YM2612Restore(temp);
|
||||||
{
|
|
||||||
//YM2612Restore(temp);
|
|
||||||
free(temp);
|
free(temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1081,17 +1081,15 @@ static void systemmenu ()
|
|||||||
/* save YM2612 context */
|
/* save YM2612 context */
|
||||||
temp = memalign(32,YM2612GetContextSize());
|
temp = memalign(32,YM2612GetContextSize());
|
||||||
if (temp)
|
if (temp)
|
||||||
|
{
|
||||||
memcpy(temp, YM2612GetContextPtr(), YM2612GetContextSize());
|
memcpy(temp, YM2612GetContextPtr(), YM2612GetContextSize());
|
||||||
|
}
|
||||||
|
|
||||||
/* reinitialize all timings */
|
/* reinitialize all timings */
|
||||||
framerate = vdp_pal ? 50.0 : ((config.tv_mode == 1) ? 60.0 : ((config.render || interlaced) ? 59.94 : (1000000.0/16715.0)));
|
framerate = vdp_pal ? 50.0 : ((config.tv_mode == 1) ? 60.0 : ((config.render || interlaced) ? 59.94 : (1000000.0/16715.0)));
|
||||||
audio_init(snd.sample_rate, framerate);
|
audio_init(snd.sample_rate, framerate);
|
||||||
system_init();
|
system_init();
|
||||||
|
|
||||||
/* restore SRAM */
|
|
||||||
if (config.s_auto & 1)
|
|
||||||
slot_autoload(0,config.s_device);
|
|
||||||
|
|
||||||
/* restore YM2612 context */
|
/* restore YM2612 context */
|
||||||
if (temp)
|
if (temp)
|
||||||
{
|
{
|
||||||
@ -1099,13 +1097,18 @@ static void systemmenu ()
|
|||||||
free(temp);
|
free(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reinitialize HVC tables */
|
/* restore SRAM */
|
||||||
vctab = vdp_pal ? ((reg[1] & 8) ? vc_pal_240 : vc_pal_224) : vc_ntsc_224;
|
if (config.s_auto & 1)
|
||||||
hctab = (reg[12] & 1) ? cycle2hc40 : cycle2hc32;
|
{
|
||||||
|
slot_autoload(0,config.s_device);
|
||||||
|
}
|
||||||
|
|
||||||
/* reinitialize overscan area */
|
/* reinitialize VC max value */
|
||||||
bitmap.viewport.x = (config.overscan & 2) ? ((reg[12] & 1) ? 16 : 12) : 0;
|
vc_max = 0xEA + 24*vdp_pal;
|
||||||
bitmap.viewport.y = (config.overscan & 1) ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
|
if (reg[1] & 8)
|
||||||
|
{
|
||||||
|
vc_max += (28 - 20*vdp_pal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1126,11 +1129,16 @@ static void systemmenu ()
|
|||||||
sprintf (items[3].text, "System TMSS: %s", (config.tmss & 1) ? "ON":"OFF");
|
sprintf (items[3].text, "System TMSS: %s", (config.tmss & 1) ? "ON":"OFF");
|
||||||
if (cart.romsize)
|
if (cart.romsize)
|
||||||
{
|
{
|
||||||
|
/* restart emulation */
|
||||||
system_init();
|
system_init();
|
||||||
system_reset();
|
system_reset();
|
||||||
|
|
||||||
|
/* restore SRAM */
|
||||||
if (config.s_auto & 1)
|
if (config.s_auto & 1)
|
||||||
|
{
|
||||||
slot_autoload(0,config.s_device);
|
slot_autoload(0,config.s_device);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: /*** Cart Lock-On ***/
|
case 4: /*** Cart Lock-On ***/
|
||||||
@ -1148,8 +1156,11 @@ static void systemmenu ()
|
|||||||
|
|
||||||
if (cart.romsize)
|
if (cart.romsize)
|
||||||
{
|
{
|
||||||
|
/* restart emulation */
|
||||||
system_init();
|
system_init();
|
||||||
system_reset();
|
system_reset();
|
||||||
|
|
||||||
|
/* restore SRAM */
|
||||||
if (config.s_auto & 1)
|
if (config.s_auto & 1)
|
||||||
{
|
{
|
||||||
slot_autoload(0,config.s_device);
|
slot_autoload(0,config.s_device);
|
||||||
@ -1310,7 +1321,9 @@ static void videomenu ()
|
|||||||
/* save YM2612 context */
|
/* save YM2612 context */
|
||||||
temp = memalign(32,YM2612GetContextSize());
|
temp = memalign(32,YM2612GetContextSize());
|
||||||
if (temp)
|
if (temp)
|
||||||
|
{
|
||||||
memcpy(temp, YM2612GetContextPtr(), YM2612GetContextSize());
|
memcpy(temp, YM2612GetContextPtr(), YM2612GetContextSize());
|
||||||
|
}
|
||||||
|
|
||||||
/* reinitialize audio timings */
|
/* reinitialize audio timings */
|
||||||
framerate = (config.tv_mode == 1) ? 60.0 : ((config.render || interlaced) ? 59.94 : (1000000.0/16715.0));
|
framerate = (config.tv_mode == 1) ? 60.0 : ((config.render || interlaced) ? 59.94 : (1000000.0/16715.0));
|
||||||
@ -1343,7 +1356,9 @@ static void videomenu ()
|
|||||||
/* save YM2612 context */
|
/* save YM2612 context */
|
||||||
temp = memalign(32,YM2612GetContextSize());
|
temp = memalign(32,YM2612GetContextSize());
|
||||||
if (temp)
|
if (temp)
|
||||||
|
{
|
||||||
memcpy(temp, YM2612GetContextPtr(), YM2612GetContextSize());
|
memcpy(temp, YM2612GetContextPtr(), YM2612GetContextSize());
|
||||||
|
}
|
||||||
|
|
||||||
/* reinitialize audio timings */
|
/* reinitialize audio timings */
|
||||||
framerate = (config.tv_mode == 1) ? 60.0 : ((config.render || interlaced) ? 59.94 : (1000000.0/16715.0));
|
framerate = (config.tv_mode == 1) ? 60.0 : ((config.render || interlaced) ? 59.94 : (1000000.0/16715.0));
|
||||||
@ -1950,7 +1965,8 @@ static void ctrlmenu(void)
|
|||||||
/* remove duplicate assigned inputs */
|
/* remove duplicate assigned inputs */
|
||||||
for (i=0; i<MAX_INPUTS; i++)
|
for (i=0; i<MAX_INPUTS; i++)
|
||||||
{
|
{
|
||||||
if ((i!=player) && (config.input[i].device == config.input[player].device) && (config.input[i].port == config.input[player].port))
|
if ((i!=player) && (config.input[i].port == config.input[player].port) &&
|
||||||
|
((config.input[i].device == config.input[player].device) || ((config.input[i].device * config.input[player].device) == 2)))
|
||||||
{
|
{
|
||||||
config.input[i].device = -1;
|
config.input[i].device = -1;
|
||||||
config.input[i].port = i%4;
|
config.input[i].port = i%4;
|
||||||
@ -2057,7 +2073,7 @@ static void ctrlmenu(void)
|
|||||||
/* no input device */
|
/* no input device */
|
||||||
if (config.input[player].device < 0)
|
if (config.input[player].device < 0)
|
||||||
{
|
{
|
||||||
/* try gamecube controllers */
|
/* always try gamecube controllers first */
|
||||||
config.input[player].device = 0;
|
config.input[player].device = 0;
|
||||||
config.input[player].port = 0;
|
config.input[player].port = 0;
|
||||||
}
|
}
|
||||||
@ -2070,17 +2086,19 @@ static void ctrlmenu(void)
|
|||||||
/* autodetect connected gamecube controllers */
|
/* autodetect connected gamecube controllers */
|
||||||
if (config.input[player].device == 0)
|
if (config.input[player].device == 0)
|
||||||
{
|
{
|
||||||
|
/* find first connected controller */
|
||||||
exp = 0;
|
exp = 0;
|
||||||
while ((config.input[player].port<4) && !exp)
|
while ((config.input[player].port < 4) && !exp)
|
||||||
{
|
{
|
||||||
exp = PAD_ScanPads() & (1<<config.input[player].port);
|
exp = PAD_ScanPads() & (1<<config.input[player].port);
|
||||||
if (!exp) config.input[player].port ++;
|
if (!exp) config.input[player].port ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* no more gamecube controller */
|
||||||
if (config.input[player].port >= 4)
|
if (config.input[player].port >= 4)
|
||||||
{
|
{
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
/* no gamecube controller found, try wiimote */
|
/* test wiimote */
|
||||||
config.input[player].port = 0;
|
config.input[player].port = 0;
|
||||||
config.input[player].device = 1;
|
config.input[player].device = 1;
|
||||||
#else
|
#else
|
||||||
@ -2095,56 +2113,60 @@ static void ctrlmenu(void)
|
|||||||
/* autodetect connected wiimotes (without nunchuk) */
|
/* autodetect connected wiimotes (without nunchuk) */
|
||||||
if (config.input[player].device == 1)
|
if (config.input[player].device == 1)
|
||||||
{
|
{
|
||||||
exp = 4;
|
/* test current port */
|
||||||
if (config.input[player].port<4)
|
exp = 255;
|
||||||
|
if (config.input[player].port < 4)
|
||||||
{
|
{
|
||||||
WPAD_Probe(config.input[player].port,&exp);
|
WPAD_Probe(config.input[player].port,&exp);
|
||||||
if (exp == WPAD_EXP_NUNCHUK) exp = 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((config.input[player].port<4) && (exp == 4))
|
/* find first connected controller */
|
||||||
|
while ((config.input[player].port < 4) && (exp == 255))
|
||||||
{
|
{
|
||||||
/* try next port */
|
/* try next port */
|
||||||
config.input[player].port ++;
|
config.input[player].port ++;
|
||||||
if (config.input[player].port<4)
|
if (config.input[player].port < 4)
|
||||||
{
|
{
|
||||||
exp = 4;
|
exp = 255;
|
||||||
WPAD_Probe(config.input[player].port,&exp);
|
WPAD_Probe(config.input[player].port,&exp);
|
||||||
if (exp == WPAD_EXP_NUNCHUK) exp = 4;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* no more wiimote */
|
||||||
if (config.input[player].port >= 4)
|
if (config.input[player].port >= 4)
|
||||||
{
|
{
|
||||||
/* no wiimote (without nunchuk) found, try wiimote+nunchuks */
|
/* test wiimote+nunchuk */
|
||||||
config.input[player].port = 0;
|
config.input[player].port = 0;
|
||||||
config.input[player].device = 2;
|
config.input[player].device = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* autodetect connected wiimote+nunchuks */
|
/* autodetect connected wiimote+nunchuk */
|
||||||
if (config.input[player].device == 2)
|
if (config.input[player].device == 2)
|
||||||
{
|
{
|
||||||
exp = 4;
|
/* test current port */
|
||||||
if (config.input[player].port<4)
|
exp = 255;
|
||||||
|
if (config.input[player].port < 4)
|
||||||
{
|
{
|
||||||
WPAD_Probe(config.input[player].port,&exp);
|
WPAD_Probe(config.input[player].port,&exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((config.input[player].port<4) && (exp != WPAD_EXP_NUNCHUK))
|
/* find first connected controller */
|
||||||
|
while ((config.input[player].port < 4) && (exp != WPAD_EXP_NUNCHUK))
|
||||||
{
|
{
|
||||||
/* try next port */
|
/* try next port */
|
||||||
config.input[player].port ++;
|
config.input[player].port ++;
|
||||||
if (config.input[player].port<4)
|
if (config.input[player].port < 4)
|
||||||
{
|
{
|
||||||
exp = 4;
|
exp = 255;
|
||||||
WPAD_Probe(config.input[player].port,&exp);
|
WPAD_Probe(config.input[player].port,&exp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* no more wiimote+nunchuk */
|
||||||
if (config.input[player].port >= 4)
|
if (config.input[player].port >= 4)
|
||||||
{
|
{
|
||||||
/* no wiimote+nunchuk found, try classic controllers */
|
/* test classic controllers */
|
||||||
config.input[player].port = 0;
|
config.input[player].port = 0;
|
||||||
config.input[player].device = 3;
|
config.input[player].device = 3;
|
||||||
}
|
}
|
||||||
@ -2153,19 +2175,21 @@ static void ctrlmenu(void)
|
|||||||
/* autodetect connected classic controllers */
|
/* autodetect connected classic controllers */
|
||||||
if (config.input[player].device == 3)
|
if (config.input[player].device == 3)
|
||||||
{
|
{
|
||||||
exp = 4;
|
/* test current port */
|
||||||
if (config.input[player].port<4)
|
exp = 255;
|
||||||
|
if (config.input[player].port < 4)
|
||||||
{
|
{
|
||||||
WPAD_Probe(config.input[player].port,&exp);
|
WPAD_Probe(config.input[player].port,&exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* find first connected controller */
|
||||||
while ((config.input[player].port<4) && (exp != WPAD_EXP_CLASSIC))
|
while ((config.input[player].port<4) && (exp != WPAD_EXP_CLASSIC))
|
||||||
{
|
{
|
||||||
/* try next port */
|
/* try next port */
|
||||||
config.input[player].port ++;
|
config.input[player].port ++;
|
||||||
if (config.input[player].port<4)
|
if (config.input[player].port < 4)
|
||||||
{
|
{
|
||||||
exp = 4;
|
exp = 255;
|
||||||
WPAD_Probe(config.input[player].port,&exp);
|
WPAD_Probe(config.input[player].port,&exp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2289,7 +2313,8 @@ static void ctrlmenu(void)
|
|||||||
/* remove duplicate assigned inputs before leaving */
|
/* remove duplicate assigned inputs before leaving */
|
||||||
for (i=0; i<MAX_INPUTS; i++)
|
for (i=0; i<MAX_INPUTS; i++)
|
||||||
{
|
{
|
||||||
if ((i!=player) && (config.input[i].device == config.input[player].device) && (config.input[i].port == config.input[player].port))
|
if ((i!=player) && (config.input[i].port == config.input[player].port) &&
|
||||||
|
((config.input[i].device == config.input[player].device) || ((config.input[i].device * config.input[player].device) == 2)))
|
||||||
{
|
{
|
||||||
config.input[i].device = -1;
|
config.input[i].device = -1;
|
||||||
config.input[i].port = i%4;
|
config.input[i].port = i%4;
|
||||||
@ -3091,21 +3116,36 @@ void menu_execute(void)
|
|||||||
{
|
{
|
||||||
/*** Load Game Menu ***/
|
/*** Load Game Menu ***/
|
||||||
case 0:
|
case 0:
|
||||||
|
|
||||||
GUI_DrawMenuFX(m,30,1);
|
GUI_DrawMenuFX(m,30,1);
|
||||||
GUI_DeleteMenu(m);
|
GUI_DeleteMenu(m);
|
||||||
quit = loadgamemenu();
|
|
||||||
if (quit)
|
if (loadgamemenu())
|
||||||
{
|
{
|
||||||
gxClearScreen((GXColor)BLACK);
|
/* check current controller configuration */
|
||||||
gxSetScreen();
|
if (!gx_input_FindDevices())
|
||||||
|
{
|
||||||
|
GUI_InitMenu(m);
|
||||||
|
GUI_DrawMenuFX(m,30,0);
|
||||||
|
GUI_WaitPrompt("Error","Invalid Controllers Settings");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* exit to game */
|
||||||
|
gxClearScreen((GXColor)BLACK);
|
||||||
|
gxSetScreen();
|
||||||
|
quit = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
GUI_InitMenu(m);
|
GUI_InitMenu(m);
|
||||||
GUI_DrawMenuFX(m,30,0);
|
GUI_DrawMenuFX(m,30,0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
/*** Options Menu */
|
/*** Options Menu */
|
||||||
case 1:
|
case 1:
|
||||||
|
|
||||||
GUI_DrawMenuFX(m,30,1);
|
GUI_DrawMenuFX(m,30,1);
|
||||||
GUI_DeleteMenu(m);
|
GUI_DeleteMenu(m);
|
||||||
optionmenu();
|
optionmenu();
|
||||||
@ -3113,38 +3153,73 @@ void menu_execute(void)
|
|||||||
GUI_DrawMenuFX(m,30,0);
|
GUI_DrawMenuFX(m,30,0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
/*** Exit Menu ***/
|
/*** Exit Menu ***/
|
||||||
case 2:
|
case 2:
|
||||||
|
|
||||||
exitmenu();
|
exitmenu();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
/*** Save Manager ***/
|
/*** Save Manager ***/
|
||||||
case 3:
|
case 3:
|
||||||
|
|
||||||
GUI_DrawMenuFX(m,30,1);
|
GUI_DrawMenuFX(m,30,1);
|
||||||
GUI_DeleteMenu(m);
|
GUI_DeleteMenu(m);
|
||||||
quit = savemenu();
|
|
||||||
if (quit) break;
|
if (savemenu())
|
||||||
|
{
|
||||||
|
/* check current controller configuration */
|
||||||
|
if (!gx_input_FindDevices())
|
||||||
|
{
|
||||||
|
GUI_InitMenu(m);
|
||||||
|
GUI_DrawMenuFX(m,30,0);
|
||||||
|
GUI_WaitPrompt("Error","Invalid Controllers Settings");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* exit to game */
|
||||||
|
quit = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
GUI_InitMenu(m);
|
GUI_InitMenu(m);
|
||||||
GUI_DrawMenuFX(m,30,0);
|
GUI_DrawMenuFX(m,30,0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
/*** Virtual system hard reset ***/
|
/*** Virtual system hard reset ***/
|
||||||
case 4:
|
case 4:
|
||||||
|
|
||||||
|
/* check current controller configuration */
|
||||||
|
if (!gx_input_FindDevices())
|
||||||
|
{
|
||||||
|
GUI_WaitPrompt("Error","Invalid Controllers Settings");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* reinitialize emulation */
|
||||||
GUI_DrawMenuFX(m,10,1);
|
GUI_DrawMenuFX(m,10,1);
|
||||||
GUI_DeleteMenu(m);
|
GUI_DeleteMenu(m);
|
||||||
gxClearScreen((GXColor)BLACK);
|
gxClearScreen((GXColor)BLACK);
|
||||||
gxSetScreen();
|
gxSetScreen();
|
||||||
system_init();
|
system_init();
|
||||||
system_reset();
|
system_reset();
|
||||||
|
|
||||||
|
/* restore SRAM */
|
||||||
if (config.s_auto & 1)
|
if (config.s_auto & 1)
|
||||||
{
|
{
|
||||||
slot_autoload(0,config.s_device);
|
slot_autoload(0,config.s_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* exit to game */
|
||||||
quit = 1;
|
quit = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
/*** Cheats menu ***/
|
/*** Cheats menu ***/
|
||||||
case 5:
|
case 5:
|
||||||
|
|
||||||
GUI_DrawMenuFX(m,30,1);
|
GUI_DrawMenuFX(m,30,1);
|
||||||
GUI_DeleteMenu(m);
|
GUI_DeleteMenu(m);
|
||||||
CheatMenu();
|
CheatMenu();
|
||||||
@ -3152,8 +3227,10 @@ void menu_execute(void)
|
|||||||
GUI_DrawMenuFX(m,30,0);
|
GUI_DrawMenuFX(m,30,0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
/*** Action Replay switch ***/
|
/*** Action Replay switch ***/
|
||||||
case 6:
|
case 6:
|
||||||
|
|
||||||
status = (areplay_get_status() + 1) % (AR_SWITCH_TRAINER + 1);
|
status = (areplay_get_status() + 1) % (AR_SWITCH_TRAINER + 1);
|
||||||
areplay_set_status(status);
|
areplay_set_status(status);
|
||||||
status = areplay_get_status();
|
status = areplay_get_status();
|
||||||
@ -3164,38 +3241,48 @@ void menu_execute(void)
|
|||||||
GUI_InitMenu(m);
|
GUI_InitMenu(m);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
/*** Return to Game ***/
|
/*** Return to Game ***/
|
||||||
case 7:
|
case 7:
|
||||||
case -1:
|
case -1:
|
||||||
|
|
||||||
if (cart.romsize)
|
if (cart.romsize)
|
||||||
{
|
{
|
||||||
|
/* check current controller configuration */
|
||||||
|
if (!gx_input_FindDevices())
|
||||||
|
{
|
||||||
|
GUI_WaitPrompt("Error","Invalid Controllers Settings");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* exit to game */
|
||||||
GUI_DrawMenuFX(m,10,1);
|
GUI_DrawMenuFX(m,10,1);
|
||||||
GUI_DeleteMenu(m);
|
GUI_DeleteMenu(m);
|
||||||
quit = 1;
|
quit = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
/*** Game Capture ***/
|
/*** Game Capture ***/
|
||||||
case 8:
|
case 8:
|
||||||
|
|
||||||
sprintf(filename,"%s/snaps/%s.png", DEFAULT_PATH, rom_filename);
|
sprintf(filename,"%s/snaps/%s.png", DEFAULT_PATH, rom_filename);
|
||||||
gxSaveScreenshot(filename);
|
gxSaveScreenshot(filename);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
/*** ROM information screen ***/
|
/*** ROM information screen ***/
|
||||||
case 9:
|
case 9:
|
||||||
|
|
||||||
showrominfo();
|
showrominfo();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** Remove any still held buttons ***/
|
/*** Remove any still held buttons ***/
|
||||||
while (PAD_ButtonsHeld(0))
|
while (PAD_ButtonsHeld(0)) PAD_ScanPads();
|
||||||
PAD_ScanPads();
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
while (WPAD_ButtonsHeld(0))
|
while (WPAD_ButtonsHeld(0)) WPAD_ScanPads();
|
||||||
WPAD_ScanPads();
|
|
||||||
|
|
||||||
/* free wiimote pointer data */
|
|
||||||
gxTextureClose(&w_pointer);
|
gxTextureClose(&w_pointer);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -27,5 +27,6 @@
|
|||||||
extern void menu_execute(void);
|
extern void menu_execute(void);
|
||||||
extern void menu_configure(void);
|
extern void menu_configure(void);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -697,6 +697,77 @@ void gx_input_Init(void)
|
|||||||
VIDEO_Flush();
|
VIDEO_Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int gx_input_FindDevices(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
#ifdef HW_RVL
|
||||||
|
u32 wpad;
|
||||||
|
#endif
|
||||||
|
u32 pad = PAD_ScanPads();
|
||||||
|
int found = 0;
|
||||||
|
int player = 0;
|
||||||
|
|
||||||
|
for (i=0; i<MAX_DEVICES; i++)
|
||||||
|
{
|
||||||
|
/* check emulated peripheral */
|
||||||
|
if (input.dev[i] != NO_DEVICE)
|
||||||
|
{
|
||||||
|
/* test input device */
|
||||||
|
switch (config.input[player].device)
|
||||||
|
{
|
||||||
|
case 0: /* Gamecube Controller */
|
||||||
|
{
|
||||||
|
if (!(pad & (1 << config.input[player].port)))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
found++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HW_RVL
|
||||||
|
case 1: /* Wiimote */
|
||||||
|
{
|
||||||
|
wpad = 255;
|
||||||
|
WPAD_Probe(config.input[player].port, &wpad);
|
||||||
|
if (wpad == 255)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
found++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 2: /* Expansion Controller */
|
||||||
|
case 3:
|
||||||
|
{
|
||||||
|
wpad = 255;
|
||||||
|
WPAD_Probe(config.input[player].port, &wpad);
|
||||||
|
if (wpad != (config.input[player].device - 1))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
found++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* next configured player */
|
||||||
|
player ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* return number of connected devices */
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void gx_input_SetDefault(void)
|
void gx_input_SetDefault(void)
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
@ -766,18 +837,30 @@ void gx_input_SetDefault(void)
|
|||||||
/* try to autodetect connected controller */
|
/* try to autodetect connected controller */
|
||||||
exp = 255;
|
exp = 255;
|
||||||
WPAD_Probe(i, &exp);
|
WPAD_Probe(i, &exp);
|
||||||
if (exp <= WPAD_EXP_CLASSIC)
|
if (exp == WPAD_EXP_CLASSIC)
|
||||||
{
|
{
|
||||||
/* set expansion controller (or wiimote if no expansion) as default */
|
/* use Classic Controller */
|
||||||
config.input[i].device = exp + 1;
|
config.input[i].device = 3;
|
||||||
|
config.input[i].port = i;
|
||||||
|
}
|
||||||
|
else if (exp == WPAD_EXP_NUNCHUK)
|
||||||
|
{
|
||||||
|
/* use Wiimote + Nunchuk */
|
||||||
|
config.input[i].device = 2;
|
||||||
|
config.input[i].port = i;
|
||||||
|
}
|
||||||
|
else if (exp <= EXP_MOTION_PLUS)
|
||||||
|
{
|
||||||
|
/* use Wiimote by default */
|
||||||
|
config.input[i].device = 1;
|
||||||
config.input[i].port = i;
|
config.input[i].port = i;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* look for unassigned wiimotes */
|
/* look for unused Wiimotes */
|
||||||
for (j=0; j<i; j++)
|
for (j=0; j<i; j++)
|
||||||
{
|
{
|
||||||
/* classic controller is already assigned, which means wiimote is not used */
|
/* Classic Controller is assigned, which means Wiimote is free to use */
|
||||||
if (config.input[j].device == (WPAD_EXP_CLASSIC + 1))
|
if (config.input[j].device == (WPAD_EXP_CLASSIC + 1))
|
||||||
{
|
{
|
||||||
/* assign wiimote */
|
/* assign wiimote */
|
||||||
@ -804,6 +887,7 @@ void gx_input_SetDefault(void)
|
|||||||
{
|
{
|
||||||
config.input[j].device = 0;
|
config.input[j].device = 0;
|
||||||
config.input[j].port = i;
|
config.input[j].port = i;
|
||||||
|
j = MAX_INPUTS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ typedef struct
|
|||||||
|
|
||||||
|
|
||||||
extern void gx_input_Init(void);
|
extern void gx_input_Init(void);
|
||||||
|
extern int gx_input_FindDevices(void);
|
||||||
extern void gx_input_SetDefault(void);
|
extern void gx_input_SetDefault(void);
|
||||||
extern void gx_input_Config(u8 num, u8 type, u8 max_keys);
|
extern void gx_input_Config(u8 num, u8 type, u8 max_keys);
|
||||||
extern void gx_input_UpdateEmu(void);
|
extern void gx_input_UpdateEmu(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user