~fixed H32/H40 modes transition
~fixed overscan horizontal width in both modes +added MessageBox support [GUI engine]
12
HISTORY.txt
@ -7,20 +7,20 @@ Genesis Plus GX 1.3.2 (??/??/????) (Eke-Eke)
|
|||||||
|
|
||||||
* modified SN76489 cut-off frequency
|
* modified SN76489 cut-off frequency
|
||||||
* removed now outdated Gens YM2612 core
|
* removed now outdated Gens YM2612 core
|
||||||
* improved MAME YM2612 emulation accuracy (SSG-EG, CSM mode and more), thanks to Nemesis for his tests on real hardware
|
* improved MAME YM2612 emulation accuracy (SSG-EG, CSM mode...), thanks to Nemesis for his tests on real hardware
|
||||||
* fixed FM context in savestates
|
* fixed FM context saving/loading.
|
||||||
* improved sprites masking emulation: fixes 3D level in Mickey Mania
|
* improved sprites masking emulation: fixes 3D level in Mickey Mania, thanks to Nemesis for his test ROM.
|
||||||
* fixed lightgun autodetection: fixes cursor position in Lethal Enforcers II
|
* fixed lightgun autodetection: fixes cursor position in Lethal Enforcers II
|
||||||
* various code cleanup & optimization
|
* various code cleanup & optimization
|
||||||
|
|
||||||
[Gamecube/Wii]
|
[Gamecube/Wii]
|
||||||
|
|
||||||
* improved audio/video synchronization: fixes video skipping issues with 60Hz modes
|
* improved audio/video synchronization: fixes video skipping issues with 60Hz modes
|
||||||
* fixed stability issues and potential memory leaks
|
* fixed stability issues and a few (potential) memory leaks
|
||||||
* added screenshot feature
|
* added screenshot feature
|
||||||
* improved lightgun cursors
|
* improved lightgun cursors
|
||||||
* completely rewrote FONT & GUI engines (powered by GX hardware)
|
* new FONT & GUI engines: use internal IPL FONT, GX hardware & multithreading for fast rendering.
|
||||||
* new GUI layout (incl. IR pointing, ROM snapshots, sound effects & more)
|
* new GUI layout: includes IR pointing, ROM snapshots, menu effects, sound effects & more (check the README for more details)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,10 +107,6 @@ void config_default(void)
|
|||||||
config.bgm_volume = 100.0;
|
config.bgm_volume = 100.0;
|
||||||
config.sfx_volume = 100.0;
|
config.sfx_volume = 100.0;
|
||||||
config.screen_w = 658;
|
config.screen_w = 658;
|
||||||
#ifdef HW_RVL
|
|
||||||
if (CONF_GetAspectRatio() == CONF_ASPECT_16_9)
|
|
||||||
config.screen_w = 672;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* restore saved configuration */
|
/* restore saved configuration */
|
||||||
config_load();
|
config_load();
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "font.h"
|
#include "gui.h"
|
||||||
|
|
||||||
#ifndef HW_RVL
|
#ifndef HW_RVL
|
||||||
static u64 DvdMaxOffset = 0x57057C00; /* 1.4 GB max. by default */
|
static u64 DvdMaxOffset = 0x57057C00; /* 1.4 GB max. by default */
|
||||||
@ -88,7 +88,7 @@ u32 dvd_read (void *dst, u32 len, u64 offset)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void dvd_motor_off( )
|
void dvd_motor_off( )
|
||||||
{
|
{
|
||||||
ShowAction("Stopping DVD drive...");
|
GUI_MsgBoxOpen("INFO", "Stopping DVD drive ...");
|
||||||
|
|
||||||
#ifndef HW_RVL
|
#ifndef HW_RVL
|
||||||
dvd[0] = 0x2e;
|
dvd[0] = 0x2e;
|
||||||
@ -108,6 +108,7 @@ void dvd_motor_off( )
|
|||||||
#else
|
#else
|
||||||
DI_StopMotor();
|
DI_StopMotor();
|
||||||
#endif
|
#endif
|
||||||
|
GUI_MsgBoxClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HW_RVL
|
#ifndef HW_RVL
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "font.h"
|
#include "gui.h"
|
||||||
#include "dvd.h"
|
#include "dvd.h"
|
||||||
#include "unzip.h"
|
#include "unzip.h"
|
||||||
#include "filesel.h"
|
#include "filesel.h"
|
||||||
@ -53,7 +53,7 @@ static char dvdbuffer[2048];
|
|||||||
* The PVD should reside between sector 16 and 31.
|
* The PVD should reside between sector 16 and 31.
|
||||||
* This is for single session DVD only.
|
* This is for single session DVD only.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static int getpvd ()
|
static int getpvd()
|
||||||
{
|
{
|
||||||
int sector = 16;
|
int sector = 16;
|
||||||
u32 rootdir32;
|
u32 rootdir32;
|
||||||
@ -111,7 +111,7 @@ static int getpvd ()
|
|||||||
* Support function to return the next file entry, if any
|
* Support function to return the next file entry, if any
|
||||||
* Declared static to avoid accidental external entry.
|
* Declared static to avoid accidental external entry.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static int getentry (int entrycount)
|
static int getentry(int entrycount)
|
||||||
{
|
{
|
||||||
char fname[512]; /* Huge, but experience has determined this */
|
char fname[512]; /* Huge, but experience has determined this */
|
||||||
char *ptr;
|
char *ptr;
|
||||||
@ -201,7 +201,7 @@ static int getentry (int entrycount)
|
|||||||
*
|
*
|
||||||
* Update DVD current root directory
|
* Update DVD current root directory
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int DVD_UpdateDir(int go_up)
|
int DVD_UpdateDir(bool go_up)
|
||||||
{
|
{
|
||||||
/* root has no parent directory */
|
/* root has no parent directory */
|
||||||
if (go_up && (basedir == rootdir)) return 0;
|
if (go_up && (basedir == rootdir)) return 0;
|
||||||
@ -239,7 +239,7 @@ int DVD_UpdateDir(int go_up)
|
|||||||
*
|
*
|
||||||
* The return value is number of files collected, or 0 on failure.
|
* The return value is number of files collected, or 0 on failure.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int DVD_ParseDirectory ()
|
int DVD_ParseDirectory(void)
|
||||||
{
|
{
|
||||||
int pdlength;
|
int pdlength;
|
||||||
u64 pdoffset;
|
u64 pdoffset;
|
||||||
@ -285,7 +285,7 @@ int DVD_ParseDirectory ()
|
|||||||
* This functions return the actual size of data copied into the buffer
|
* This functions return the actual size of data copied into the buffer
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int DVD_LoadFile (u8 *buffer)
|
int DVD_LoadFile(u8 *buffer)
|
||||||
{
|
{
|
||||||
/* file size */
|
/* file size */
|
||||||
int length = filelist[selection].length;
|
int length = filelist[selection].length;
|
||||||
@ -302,7 +302,7 @@ int DVD_LoadFile (u8 *buffer)
|
|||||||
{
|
{
|
||||||
char msg[50];
|
char msg[50];
|
||||||
sprintf(msg,"Loading %d bytes...", length);
|
sprintf(msg,"Loading %d bytes...", length);
|
||||||
ShowAction(msg);
|
GUI_MsgBoxOpen("INFO",msg);
|
||||||
/* How many 2k blocks to read */
|
/* How many 2k blocks to read */
|
||||||
int blocks = length / 2048;
|
int blocks = length / 2048;
|
||||||
int readoffset = 0;
|
int readoffset = 0;
|
||||||
@ -325,6 +325,7 @@ int DVD_LoadFile (u8 *buffer)
|
|||||||
memcpy (buffer + readoffset, readbuffer, i);
|
memcpy (buffer + readoffset, readbuffer, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GUI_MsgBoxClose();
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -342,16 +343,16 @@ int DVD_LoadFile (u8 *buffer)
|
|||||||
* Function to load a DVD directory and display to user.
|
* Function to load a DVD directory and display to user.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int DVD_Open (u8 *buffer)
|
int DVD_Open(void)
|
||||||
{
|
{
|
||||||
/* reset flags */
|
/* reset flags */
|
||||||
useFAT = 0;
|
useFAT = 0;
|
||||||
|
|
||||||
/* is DVD mounted ? */
|
/* is DVD mounted ? */
|
||||||
if (!getpvd())
|
if (!getpvd())
|
||||||
{
|
{
|
||||||
/* mount DVD */
|
/* mount DVD */
|
||||||
ShowAction("Mounting DVD ... Wait");
|
GUI_MsgBoxOpen("INFO", "Mounting DVD ... Wait");
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
u32 val;
|
u32 val;
|
||||||
@ -359,7 +360,7 @@ int DVD_Open (u8 *buffer)
|
|||||||
|
|
||||||
if(val & 0x1)
|
if(val & 0x1)
|
||||||
{
|
{
|
||||||
WaitPrompt("No Disc inserted !");
|
GUI_WaitPrompt("ERROR","No Disc inserted !");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,8 +369,8 @@ int DVD_Open (u8 *buffer)
|
|||||||
if (!(DI_GetStatus() & DVD_READY))
|
if (!(DI_GetStatus() & DVD_READY))
|
||||||
{
|
{
|
||||||
char msg[50];
|
char msg[50];
|
||||||
sprintf(msg, "DI Status Error: 0x%08X\n",DI_GetStatus());
|
sprintf(msg, "DI Status Error: 0x%08X !\n",DI_GetStatus());
|
||||||
WaitPrompt(msg);
|
GUI_WaitPrompt("ERROR",msg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -379,9 +380,11 @@ int DVD_Open (u8 *buffer)
|
|||||||
haveDVDdir = 0;
|
haveDVDdir = 0;
|
||||||
if (!getpvd())
|
if (!getpvd())
|
||||||
{
|
{
|
||||||
WaitPrompt ("Failed to mount DVD");
|
GUI_WaitPrompt("ERROR","Disc can not be read !");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GUI_MsgBoxClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (haveDVDdir == 0)
|
if (haveDVDdir == 0)
|
||||||
@ -403,15 +406,15 @@ int DVD_Open (u8 *buffer)
|
|||||||
selection = 0;
|
selection = 0;
|
||||||
old_offset = 0;
|
old_offset = 0;
|
||||||
old_selection = 0;
|
old_selection = 0;
|
||||||
return FileSelector (buffer);
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* no entries found */
|
/* no entries found */
|
||||||
WaitPrompt ("no files found !");
|
GUI_WaitPrompt("ERROR","No files found !");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FileSelector (buffer);
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
#ifndef _FILE_DVD_H
|
#ifndef _FILE_DVD_H
|
||||||
#define _FILE_DVD_H
|
#define _FILE_DVD_H
|
||||||
|
|
||||||
extern int DVD_UpdateDir(int go_up);
|
extern int DVD_UpdateDir(bool go_up);
|
||||||
extern int DVD_ParseDirectory();
|
extern int DVD_ParseDirectory(void);
|
||||||
extern int DVD_LoadFile(u8 *buffer);
|
extern int DVD_LoadFile(u8 *buffer);
|
||||||
extern int DVD_Open (u8 *buffer);
|
extern int DVD_Open(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "font.h"
|
#include "gui.h"
|
||||||
#include "history.h"
|
#include "history.h"
|
||||||
#include "unzip.h"
|
#include "unzip.h"
|
||||||
#include "filesel.h"
|
#include "filesel.h"
|
||||||
@ -40,7 +40,7 @@ static int useHistory = 0;
|
|||||||
*
|
*
|
||||||
* Update FAT current root directory
|
* Update FAT current root directory
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int FAT_UpdateDir(int go_up)
|
int FAT_UpdateDir(bool go_up)
|
||||||
{
|
{
|
||||||
int size=0;
|
int size=0;
|
||||||
char *test;
|
char *test;
|
||||||
@ -99,7 +99,7 @@ int FAT_UpdateDir(int go_up)
|
|||||||
*
|
*
|
||||||
* List files into one FAT directory
|
* List files into one FAT directory
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int FAT_ParseDirectory()
|
int FAT_ParseDirectory(void)
|
||||||
{
|
{
|
||||||
int nbfiles = 0;
|
int nbfiles = 0;
|
||||||
char filename[MAXPATHLEN];
|
char filename[MAXPATHLEN];
|
||||||
@ -109,9 +109,8 @@ int FAT_ParseDirectory()
|
|||||||
DIR_ITER *dir = diropen (fatdir);
|
DIR_ITER *dir = diropen (fatdir);
|
||||||
if (dir == NULL)
|
if (dir == NULL)
|
||||||
{
|
{
|
||||||
sprintf(filename, "Error opening %s", fatdir);
|
GUI_WaitPrompt("ERROR","Unable to open directory !");
|
||||||
WaitPrompt (filename);
|
return -1;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((dirnext(dir, filename, &filestat) == 0) && (nbfiles < MAXFILES))
|
while ((dirnext(dir, filename, &filestat) == 0) && (nbfiles < MAXFILES))
|
||||||
@ -141,7 +140,7 @@ int FAT_ParseDirectory()
|
|||||||
* This functions return the actual size of data copied into the buffer
|
* This functions return the actual size of data copied into the buffer
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int FAT_LoadFile (u8 *buffer)
|
int FAT_LoadFile(u8 *buffer)
|
||||||
{
|
{
|
||||||
/* If loading from history then we need to setup a few more things. */
|
/* If loading from history then we need to setup a few more things. */
|
||||||
if(useHistory)
|
if(useHistory)
|
||||||
@ -178,7 +177,7 @@ int FAT_LoadFile (u8 *buffer)
|
|||||||
FILE *sdfile = fopen(fname, "rb");
|
FILE *sdfile = fopen(fname, "rb");
|
||||||
if (sdfile == NULL)
|
if (sdfile == NULL)
|
||||||
{
|
{
|
||||||
WaitPrompt ("Unable to open file!");
|
GUI_WaitPrompt("ERROR","Unable to open file !");
|
||||||
haveFATdir = 0;
|
haveFATdir = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -196,10 +195,11 @@ int FAT_LoadFile (u8 *buffer)
|
|||||||
if (sdfile)
|
if (sdfile)
|
||||||
{
|
{
|
||||||
char msg[50];
|
char msg[50];
|
||||||
sprintf(msg,"Loading %d bytes...", length);
|
sprintf(msg,"Loading %d bytes ...", length);
|
||||||
ShowAction(msg);
|
GUI_MsgBoxOpen("INFO",msg);
|
||||||
fread(buffer, 1, length, sdfile);
|
fread(buffer, 1, length, sdfile);
|
||||||
fclose(sdfile);
|
fclose(sdfile);
|
||||||
|
GUI_MsgBoxClose();
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -218,7 +218,7 @@ int FAT_LoadFile (u8 *buffer)
|
|||||||
*
|
*
|
||||||
* Function to load a FAT directory and display to user.
|
* Function to load a FAT directory and display to user.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int FAT_Open(int type, u8 *buffer)
|
int FAT_Open(int type)
|
||||||
{
|
{
|
||||||
int max = 0;
|
int max = 0;
|
||||||
char root[10] = "";
|
char root[10] = "";
|
||||||
@ -281,7 +281,7 @@ int FAT_Open(int type, u8 *buffer)
|
|||||||
max = FAT_ParseDirectory ();
|
max = FAT_ParseDirectory ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max)
|
if (max > 0)
|
||||||
{
|
{
|
||||||
/* FAT is default */
|
/* FAT is default */
|
||||||
haveFATdir = 1;
|
haveFATdir = 1;
|
||||||
@ -293,15 +293,15 @@ int FAT_Open(int type, u8 *buffer)
|
|||||||
selection = 0;
|
selection = 0;
|
||||||
old_offset = 0;
|
old_offset = 0;
|
||||||
old_selection = 0;
|
old_selection = 0;
|
||||||
return FileSelector (buffer);
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* no entries found */
|
/* no entries found */
|
||||||
WaitPrompt ("no files found !");
|
if (max == 0) GUI_WaitPrompt("ERROR","No files found !");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FileSelector (buffer);
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -31,9 +31,9 @@
|
|||||||
#define TYPE_USB 2
|
#define TYPE_USB 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int FAT_UpdateDir(int go_up);
|
extern int FAT_UpdateDir(bool go_up);
|
||||||
extern int FAT_ParseDirectory(void);
|
extern int FAT_ParseDirectory(void);
|
||||||
extern int FAT_LoadFile(u8* buffer);
|
extern int FAT_LoadFile(u8* buffer);
|
||||||
extern int FAT_Open (int type, u8 *buffer);
|
extern int FAT_Open(int type);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "file_mem.h"
|
#include "file_mem.h"
|
||||||
#include "font.h"
|
#include "gui.h"
|
||||||
#include "filesel.h"
|
#include "filesel.h"
|
||||||
#include "saveicon.h"
|
#include "saveicon.h"
|
||||||
#include "dvd.h"
|
#include "dvd.h"
|
||||||
@ -56,7 +56,7 @@ static u8 savebuffer[STATE_SIZE] ATTRIBUTE_ALIGN (32);
|
|||||||
* We use the same buffer as for Memory Card manager
|
* We use the same buffer as for Memory Card manager
|
||||||
* Function returns TRUE on success.
|
* Function returns TRUE on success.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static int FAT_ManageFile(char *filename, int direction, int filetype)
|
static int FAT_ManageFile(char *filename, u8 direction, u8 filetype)
|
||||||
{
|
{
|
||||||
char fname[MAXPATHLEN];
|
char fname[MAXPATHLEN];
|
||||||
int done = 0;
|
int done = 0;
|
||||||
@ -69,8 +69,7 @@ static int FAT_ManageFile(char *filename, int direction, int filetype)
|
|||||||
FILE *fp = fopen(fname, direction ? "rb" : "wb");
|
FILE *fp = fopen(fname, direction ? "rb" : "wb");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
{
|
{
|
||||||
sprintf (fname, "Error opening %s", filename);
|
GUI_WaitPrompt("ERROR","Unable to open file !");
|
||||||
WaitPrompt(fname);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,14 +89,13 @@ static int FAT_ManageFile(char *filename, int direction, int filetype)
|
|||||||
done = fwrite(savebuffer, 1, filesize, fp);
|
done = fwrite(savebuffer, 1, filesize, fp);
|
||||||
if (done < filesize)
|
if (done < filesize)
|
||||||
{
|
{
|
||||||
sprintf (fname, "Error writing %s", filename);
|
GUI_WaitPrompt("ERROR","Unable to write file !");
|
||||||
WaitPrompt(fname);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
sprintf (fname, "Saved %d bytes successfully", done);
|
sprintf (fname, "Saved %d bytes successfully", done);
|
||||||
WaitPrompt (fname);
|
GUI_WaitPrompt("INFO",fname);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case 1: /* LOADING */
|
case 1: /* LOADING */
|
||||||
@ -111,8 +109,7 @@ static int FAT_ManageFile(char *filename, int direction, int filetype)
|
|||||||
done = fread(savebuffer, 1, filesize, fp);
|
done = fread(savebuffer, 1, filesize, fp);
|
||||||
if (done < filesize)
|
if (done < filesize)
|
||||||
{
|
{
|
||||||
sprintf (fname, "Error reading %s", filename);
|
GUI_WaitPrompt("ERROR","Unable to read file !");
|
||||||
WaitPrompt(fname);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -126,7 +123,7 @@ static int FAT_ManageFile(char *filename, int direction, int filetype)
|
|||||||
else state_load(savebuffer); /* STATE */
|
else state_load(savebuffer); /* STATE */
|
||||||
|
|
||||||
sprintf (fname, "Loaded %d bytes successfully", done);
|
sprintf (fname, "Loaded %d bytes successfully", done);
|
||||||
WaitPrompt (fname);
|
GUI_WaitPrompt("INFO",fname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,8 +235,8 @@ int ManageSRAM (u8 direction, u8 device)
|
|||||||
/* clean buffer */
|
/* clean buffer */
|
||||||
memset(savebuffer, 0, 0x24000);
|
memset(savebuffer, 0, 0x24000);
|
||||||
|
|
||||||
if (direction) ShowAction ("Loading SRAM ...");
|
if (direction) GUI_MsgBoxOpen("INFO","Loading SRAM ...");
|
||||||
else ShowAction ("Saving SRAM ...");
|
else GUI_MsgBoxOpen("INFO","Saving SRAM ...");
|
||||||
|
|
||||||
if (device == 0)
|
if (device == 0)
|
||||||
{
|
{
|
||||||
@ -306,7 +303,7 @@ int ManageSRAM (u8 direction, u8 device)
|
|||||||
if (CardError)
|
if (CardError)
|
||||||
{
|
{
|
||||||
sprintf (action, "Error Open : %d", CardError);
|
sprintf (action, "Error Open : %d", CardError);
|
||||||
WaitPrompt (action);
|
GUI_WaitPrompt("ERROR",action);
|
||||||
CARD_Unmount (CARDSLOT);
|
CARD_Unmount (CARDSLOT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -321,7 +318,7 @@ int ManageSRAM (u8 direction, u8 device)
|
|||||||
if (CardError)
|
if (CardError)
|
||||||
{
|
{
|
||||||
sprintf (action, "Error Update : %d", CardError);
|
sprintf (action, "Error Update : %d", CardError);
|
||||||
WaitPrompt (action);
|
GUI_WaitPrompt("ERROR",action);
|
||||||
CARD_Unmount (CARDSLOT);
|
CARD_Unmount (CARDSLOT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -338,7 +335,7 @@ int ManageSRAM (u8 direction, u8 device)
|
|||||||
if (CardError)
|
if (CardError)
|
||||||
{
|
{
|
||||||
sprintf (action, "Error create : %d %d", CardError, CARDSLOT);
|
sprintf (action, "Error create : %d %d", CardError, CARDSLOT);
|
||||||
WaitPrompt (action);
|
GUI_WaitPrompt("ERROR",action);
|
||||||
CARD_Unmount (CARDSLOT);
|
CARD_Unmount (CARDSLOT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -364,13 +361,13 @@ int ManageSRAM (u8 direction, u8 device)
|
|||||||
CARD_Unmount (CARDSLOT);
|
CARD_Unmount (CARDSLOT);
|
||||||
sram.crc = crc32 (0, &sram.sram[0], 0x10000);
|
sram.crc = crc32 (0, &sram.sram[0], 0x10000);
|
||||||
sprintf (action, "Saved %d bytes successfully", blocks);
|
sprintf (action, "Saved %d bytes successfully", blocks);
|
||||||
WaitPrompt (action);
|
GUI_WaitPrompt("INFO",action);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
default: /*** Loading ***/
|
default: /*** Loading ***/
|
||||||
if (!CardFileExists (filename,CARDSLOT))
|
if (!CardFileExists (filename,CARDSLOT))
|
||||||
{
|
{
|
||||||
WaitPrompt ("No SRAM File Found");
|
GUI_WaitPrompt("ERROR","No SRAM file found !");
|
||||||
CARD_Unmount (CARDSLOT);
|
CARD_Unmount (CARDSLOT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -380,7 +377,7 @@ int ManageSRAM (u8 direction, u8 device)
|
|||||||
if (CardError)
|
if (CardError)
|
||||||
{
|
{
|
||||||
sprintf (action, "Error Open : %d", CardError);
|
sprintf (action, "Error Open : %d", CardError);
|
||||||
WaitPrompt (action);
|
GUI_WaitPrompt("ERROR",action);
|
||||||
CARD_Unmount (CARDSLOT);
|
CARD_Unmount (CARDSLOT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -410,11 +407,11 @@ int ManageSRAM (u8 direction, u8 device)
|
|||||||
|
|
||||||
/*** Inform user ***/
|
/*** Inform user ***/
|
||||||
sprintf (action, "Loaded %d bytes successfully", size);
|
sprintf (action, "Loaded %d bytes successfully", size);
|
||||||
WaitPrompt (action);
|
GUI_WaitPrompt("INFO",action);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else WaitPrompt ("Unable to mount memory card");
|
else GUI_WaitPrompt("ERROR","Unable to mount meory card");
|
||||||
return 0; /*** Signal failure ***/
|
return 0; /*** Signal failure ***/
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,8 +432,8 @@ int ManageState (u8 direction, u8 device)
|
|||||||
/* clean buffer */
|
/* clean buffer */
|
||||||
memset(savebuffer, 0, 0x24000);
|
memset(savebuffer, 0, 0x24000);
|
||||||
|
|
||||||
if (direction) ShowAction ("Loading State ...");
|
if (direction) GUI_MsgBoxOpen("INFO","Loading State ...");
|
||||||
else ShowAction ("Saving State ...");
|
else GUI_MsgBoxOpen("INFO","Saving State ...");
|
||||||
|
|
||||||
if (device == 0)
|
if (device == 0)
|
||||||
{
|
{
|
||||||
@ -499,7 +496,7 @@ int ManageState (u8 direction, u8 device)
|
|||||||
if (CardError)
|
if (CardError)
|
||||||
{
|
{
|
||||||
sprintf (action, "Error Open : %d", CardError);
|
sprintf (action, "Error Open : %d", CardError);
|
||||||
WaitPrompt (action);
|
GUI_WaitPrompt("ERROR",action);
|
||||||
CARD_Unmount (CARDSLOT);
|
CARD_Unmount (CARDSLOT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -514,7 +511,7 @@ int ManageState (u8 direction, u8 device)
|
|||||||
if (CardError)
|
if (CardError)
|
||||||
{
|
{
|
||||||
sprintf (action, "Error Update : %d", CardError);
|
sprintf (action, "Error Update : %d", CardError);
|
||||||
WaitPrompt (action);
|
GUI_WaitPrompt("ERROR",action);
|
||||||
CARD_Unmount (CARDSLOT);
|
CARD_Unmount (CARDSLOT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -531,7 +528,7 @@ int ManageState (u8 direction, u8 device)
|
|||||||
if (CardError)
|
if (CardError)
|
||||||
{
|
{
|
||||||
sprintf (action, "Error create : %d %d", CardError, CARDSLOT);
|
sprintf (action, "Error create : %d %d", CardError, CARDSLOT);
|
||||||
WaitPrompt (action);
|
GUI_WaitPrompt("ERROR",action);
|
||||||
CARD_Unmount (CARDSLOT);
|
CARD_Unmount (CARDSLOT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -556,13 +553,13 @@ int ManageState (u8 direction, u8 device)
|
|||||||
CARD_Close (&CardFile);
|
CARD_Close (&CardFile);
|
||||||
CARD_Unmount (CARDSLOT);
|
CARD_Unmount (CARDSLOT);
|
||||||
sprintf (action, "Saved %d bytes successfully", blocks);
|
sprintf (action, "Saved %d bytes successfully", blocks);
|
||||||
WaitPrompt (action);
|
GUI_WaitPrompt("ERROR",action);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
default: /*** Loading ***/
|
default: /*** Loading ***/
|
||||||
if (!CardFileExists (filename, CARDSLOT))
|
if (!CardFileExists (filename, CARDSLOT))
|
||||||
{
|
{
|
||||||
WaitPrompt ("No Savestate Found");
|
GUI_WaitPrompt("ERROR","No Savestate file found !");
|
||||||
CARD_Unmount (CARDSLOT);
|
CARD_Unmount (CARDSLOT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -572,7 +569,7 @@ int ManageState (u8 direction, u8 device)
|
|||||||
if (CardError)
|
if (CardError)
|
||||||
{
|
{
|
||||||
sprintf (action, "Error Open : %d", CardError);
|
sprintf (action, "Error Open : %d", CardError);
|
||||||
WaitPrompt (action);
|
GUI_WaitPrompt("ERROR",action);
|
||||||
CARD_Unmount (CARDSLOT);
|
CARD_Unmount (CARDSLOT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -598,10 +595,11 @@ int ManageState (u8 direction, u8 device)
|
|||||||
|
|
||||||
/*** Inform user ***/
|
/*** Inform user ***/
|
||||||
sprintf (action, "Loaded %d bytes successfully", size);
|
sprintf (action, "Loaded %d bytes successfully", size);
|
||||||
WaitPrompt (action);
|
GUI_WaitPrompt("ERROR",action);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else WaitPrompt ("Unable to mount memory card");
|
else GUI_WaitPrompt("ERROR","Unable to mount memory card !");
|
||||||
|
|
||||||
return 0; /*** Signal failure ***/
|
return 0; /*** Signal failure ***/
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "dvd.h"
|
#include "dvd.h"
|
||||||
#include "font.h"
|
#include "gui.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PKWare Zip Header - adopted into zip standard
|
* PKWare Zip Header - adopted into zip standard
|
||||||
@ -131,7 +131,7 @@ int UnZipBuffer (unsigned char *outbuffer, u64 discoffset, char *filename)
|
|||||||
memcpy (&pkzip, &readbuffer, sizeof (PKZIPHEADER));
|
memcpy (&pkzip, &readbuffer, sizeof (PKZIPHEADER));
|
||||||
|
|
||||||
sprintf (msg, "Unzipping %d bytes ...", FLIP32 (pkzip.uncompressedSize));
|
sprintf (msg, "Unzipping %d bytes ...", FLIP32 (pkzip.uncompressedSize));
|
||||||
ShowAction (msg);
|
GUI_MsgBoxOpen("INFO",msg);
|
||||||
|
|
||||||
/*** Prepare the zip stream ***/
|
/*** Prepare the zip stream ***/
|
||||||
memset (&zs, 0, sizeof (z_stream));
|
memset (&zs, 0, sizeof (z_stream));
|
||||||
@ -142,7 +142,11 @@ int UnZipBuffer (unsigned char *outbuffer, u64 discoffset, char *filename)
|
|||||||
zs.next_in = Z_NULL;
|
zs.next_in = Z_NULL;
|
||||||
res = inflateInit2 (&zs, -MAX_WBITS);
|
res = inflateInit2 (&zs, -MAX_WBITS);
|
||||||
|
|
||||||
if (res != Z_OK) return 0;
|
if (res != Z_OK)
|
||||||
|
{
|
||||||
|
GUI_WaitPrompt("ERROR","Unable to unzip file !");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*** Set ZipChunk for first pass ***/
|
/*** Set ZipChunk for first pass ***/
|
||||||
zipoffset = (sizeof (PKZIPHEADER) + FLIP16 (pkzip.filenameLength) + FLIP16 (pkzip.extraDataLength));
|
zipoffset = (sizeof (PKZIPHEADER) + FLIP16 (pkzip.filenameLength) + FLIP16 (pkzip.extraDataLength));
|
||||||
@ -164,6 +168,7 @@ int UnZipBuffer (unsigned char *outbuffer, u64 discoffset, char *filename)
|
|||||||
if (res == Z_MEM_ERROR)
|
if (res == Z_MEM_ERROR)
|
||||||
{
|
{
|
||||||
inflateEnd (&zs);
|
inflateEnd (&zs);
|
||||||
|
GUI_WaitPrompt("ERROR","Unable to unzip file !");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,12 +203,13 @@ int UnZipBuffer (unsigned char *outbuffer, u64 discoffset, char *filename)
|
|||||||
/* close file */
|
/* close file */
|
||||||
if (fatfile) fclose(fatfile);
|
if (fatfile) fclose(fatfile);
|
||||||
|
|
||||||
|
GUI_MsgBoxClose();
|
||||||
|
|
||||||
if (res == Z_STREAM_END)
|
if (res == Z_STREAM_END)
|
||||||
{
|
{
|
||||||
if (FLIP32 (pkzip.uncompressedSize) == (u32) bufferoffset) return bufferoffset;
|
if (FLIP32 (pkzip.uncompressedSize) == (u32) bufferoffset) return bufferoffset;
|
||||||
else return FLIP32 (pkzip.uncompressedSize);
|
else return FLIP32 (pkzip.uncompressedSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,20 +75,12 @@ static gui_butn arrow_down = {&arrow_down_data,BUTTON_VISIBLE|BUTTON_OVER_SFX,{0
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static gui_item action_cancel =
|
static gui_item action_cancel =
|
||||||
{
|
{
|
||||||
#ifdef HW_RVL
|
NULL,Key_B_png,"","Previous Directory",10,422,28,28
|
||||||
NULL,Key_B_wii_png,"","Previous",10,422,28,28
|
|
||||||
#else
|
|
||||||
NULL,Key_B_gcn_png,"","Previous",10,422,28,28
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static gui_item action_select =
|
static gui_item action_select =
|
||||||
{
|
{
|
||||||
#ifdef HW_RVL
|
NULL,Key_A_png,"","Load ROM file",602,422,28,28
|
||||||
NULL,Key_A_wii_png,"","Load ROM file",602,422,28,28
|
|
||||||
#else
|
|
||||||
NULL,Key_A_gcn_png,"","Load ROM file",602,422,28,28
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -163,8 +155,7 @@ int FileSelector(unsigned char *buffer)
|
|||||||
{
|
{
|
||||||
short p;
|
short p;
|
||||||
int ret,i,yoffset,string_offset;
|
int ret,i,yoffset,string_offset;
|
||||||
int go_up = 0;
|
int size,go_up = 0;
|
||||||
int quit =0;
|
|
||||||
int old = -1;
|
int old = -1;
|
||||||
char text[MAXPATHLEN];
|
char text[MAXPATHLEN];
|
||||||
char fname[MAXPATHLEN];
|
char fname[MAXPATHLEN];
|
||||||
@ -196,7 +187,7 @@ int FileSelector(unsigned char *buffer)
|
|||||||
bar_over.x = 22;
|
bar_over.x = 22;
|
||||||
bar_over.y = -(bar_over.h - dir_icon.h)/2;
|
bar_over.y = -(bar_over.h - dir_icon.h)/2;
|
||||||
|
|
||||||
while (!quit)
|
while (1)
|
||||||
{
|
{
|
||||||
/* ROM file snapshot/database */
|
/* ROM file snapshot/database */
|
||||||
if (old != selection)
|
if (old != selection)
|
||||||
@ -306,6 +297,8 @@ int FileSelector(unsigned char *buffer)
|
|||||||
if (Shutdown)
|
if (Shutdown)
|
||||||
{
|
{
|
||||||
gxTextureClose(&w_pointer);
|
gxTextureClose(&w_pointer);
|
||||||
|
gxTextureClose(&bar_over.texture);
|
||||||
|
gxTextureClose(&dir_icon.texture);
|
||||||
GUI_DeleteMenu(m);
|
GUI_DeleteMenu(m);
|
||||||
GUI_FadeOut();
|
GUI_FadeOut();
|
||||||
shutdown();
|
shutdown();
|
||||||
@ -362,7 +355,7 @@ int FileSelector(unsigned char *buffer)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* copy EFB to XFB */
|
/* copy EFB to XFB */
|
||||||
gxSetScreen ();
|
gxSetScreen();
|
||||||
|
|
||||||
p = m_input.keys;
|
p = m_input.keys;
|
||||||
|
|
||||||
@ -416,7 +409,10 @@ int FileSelector(unsigned char *buffer)
|
|||||||
else if (p & PAD_TRIGGER_Z)
|
else if (p & PAD_TRIGGER_Z)
|
||||||
{
|
{
|
||||||
filelist[selection].filename_offset = 0;
|
filelist[selection].filename_offset = 0;
|
||||||
quit = 2;
|
GUI_DeleteMenu(m);
|
||||||
|
gxTextureClose(&bar_over.texture);
|
||||||
|
gxTextureClose(&dir_icon.texture);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open selected file or directory */
|
/* open selected file or directory */
|
||||||
@ -464,7 +460,7 @@ int FileSelector(unsigned char *buffer)
|
|||||||
if (filelist[selection].flags)
|
if (filelist[selection].flags)
|
||||||
{
|
{
|
||||||
/* get new directory */
|
/* get new directory */
|
||||||
if (useFAT) ret =FAT_UpdateDir(go_up);
|
if (useFAT) ret = FAT_UpdateDir(go_up);
|
||||||
else ret = DVD_UpdateDir(go_up);
|
else ret = DVD_UpdateDir(go_up);
|
||||||
|
|
||||||
/* get new entry list or quit */
|
/* get new entry list or quit */
|
||||||
@ -475,7 +471,10 @@ int FileSelector(unsigned char *buffer)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
quit = 2;
|
GUI_DeleteMenu(m);
|
||||||
|
gxTextureClose(&bar_over.texture);
|
||||||
|
gxTextureClose(&dir_icon.texture);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,19 +482,24 @@ int FileSelector(unsigned char *buffer)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* root directory ? */
|
/* root directory ? */
|
||||||
if (go_up) quit = 2;
|
if (go_up)
|
||||||
else quit = 1;
|
{
|
||||||
|
GUI_DeleteMenu(m);
|
||||||
|
gxTextureClose(&bar_over.texture);
|
||||||
|
gxTextureClose(&dir_icon.texture);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (useFAT) size = FAT_LoadFile(buffer);
|
||||||
|
else size = DVD_LoadFile(buffer);
|
||||||
|
GUI_DeleteMenu(m);
|
||||||
|
gxTextureClose(&bar_over.texture);
|
||||||
|
gxTextureClose(&dir_icon.texture);
|
||||||
|
return size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete Menu */
|
|
||||||
GUI_DeleteMenu(m);
|
|
||||||
gxTextureClose(&bar_over.texture);
|
|
||||||
gxTextureClose(&dir_icon.texture);
|
|
||||||
|
|
||||||
if (quit == 2) return 0;
|
|
||||||
else if (useFAT) return FAT_LoadFile(buffer);
|
|
||||||
else return DVD_LoadFile(buffer);
|
|
||||||
}
|
}
|
||||||
|
@ -267,34 +267,3 @@ void fntDrawBoxFilled (int x1, int y1, int x2, int y2, int color)
|
|||||||
int h;
|
int h;
|
||||||
for (h = y1; h <= y2; h++) fntDrawHLine (x1, x2, h, color);
|
for (h = y1; h <= y2; h++) fntDrawHLine (x1, x2, h, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Generic GUI functions (deprecated)
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
u8 SILENT = 0;
|
|
||||||
|
|
||||||
void WaitButtonA ()
|
|
||||||
{
|
|
||||||
while (m_input.keys & PAD_BUTTON_A) VIDEO_WaitVSync();
|
|
||||||
while (!(m_input.keys & PAD_BUTTON_A)) VIDEO_WaitVSync();
|
|
||||||
}
|
|
||||||
|
|
||||||
void WaitPrompt (char *msg)
|
|
||||||
{
|
|
||||||
if (SILENT) return;
|
|
||||||
gxClearScreen((GXColor)BLACK);
|
|
||||||
WriteCentre(254, msg);
|
|
||||||
WriteCentre(254 + fheight, "Press A to Continue");
|
|
||||||
gxSetScreen();
|
|
||||||
WaitButtonA ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShowAction (char *msg)
|
|
||||||
{
|
|
||||||
if (SILENT) return;
|
|
||||||
|
|
||||||
gxClearScreen((GXColor)BLACK);
|
|
||||||
WriteCentre(254, msg);
|
|
||||||
gxSetScreen();
|
|
||||||
}
|
|
||||||
|
@ -31,12 +31,6 @@ extern int FONT_write(char *string, int size, int x, int y, int max_width, GXCo
|
|||||||
extern void FONT_writeCenter(char *string, int size, int x1, int x2, int y, GXColor color);
|
extern void FONT_writeCenter(char *string, int size, int x1, int x2, int y, GXColor color);
|
||||||
extern void FONT_alignRight(char *string, int size, int x, int y, GXColor color);
|
extern void FONT_alignRight(char *string, int size, int x, int y, GXColor color);
|
||||||
|
|
||||||
|
|
||||||
extern void WaitButtonA ();
|
|
||||||
extern void WaitPrompt (char *msg);
|
|
||||||
extern void ShowAction (char *msg);
|
|
||||||
|
|
||||||
|
|
||||||
extern void WriteCentre_HL( int y, char *string);
|
extern void WriteCentre_HL( int y, char *string);
|
||||||
extern void WriteCentre (int y, char *string);
|
extern void WriteCentre (int y, char *string);
|
||||||
extern void write_font (int x, int y, char *string);
|
extern void write_font (int x, int y, char *string);
|
||||||
@ -44,6 +38,5 @@ extern void WriteText(char *text, int size, int x, int y);
|
|||||||
extern void fntDrawBoxFilled (int x1, int y1, int x2, int y2, int color);
|
extern void fntDrawBoxFilled (int x1, int y1, int x2, int y2, int color);
|
||||||
extern int fheight;
|
extern int fheight;
|
||||||
extern int font_size[256];
|
extern int font_size[256];
|
||||||
extern u8 SILENT;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -194,7 +194,7 @@ void DrawGGCodes ()
|
|||||||
}
|
}
|
||||||
else WriteCentre ((i * fheight) + 190, (char *)ggcodes[i]);
|
else WriteCentre ((i * fheight) + 190, (char *)ggcodes[i]);
|
||||||
}
|
}
|
||||||
gxSetScreen ();
|
gxSetScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -29,6 +29,12 @@
|
|||||||
gx_texture *w_pointer;
|
gx_texture *w_pointer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
u8 SILENT = 0;
|
||||||
|
|
||||||
|
/* message box */
|
||||||
|
static gui_message message_box;
|
||||||
|
static lwp_t msgboxthread;
|
||||||
|
|
||||||
/* background color */
|
/* background color */
|
||||||
static GXColor bg_color;
|
static GXColor bg_color;
|
||||||
|
|
||||||
@ -43,7 +49,7 @@ static butn_data button_text_data =
|
|||||||
/* Generic GUI routines */
|
/* Generic GUI routines */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
/* Allocate texture images data */
|
/* Allocate Menu texture images data */
|
||||||
void GUI_InitMenu(gui_menu *menu)
|
void GUI_InitMenu(gui_menu *menu)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -101,9 +107,12 @@ void GUI_InitMenu(gui_menu *menu)
|
|||||||
if (item->data)
|
if (item->data)
|
||||||
item->texture = gxTextureOpenPNG(item->data,0);
|
item->texture = gxTextureOpenPNG(item->data,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* setup message box */
|
||||||
|
GUI_MsgBoxUpdate(menu,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* release allocated memory */
|
/* Release Menu allocated memory */
|
||||||
void GUI_DeleteMenu(gui_menu *menu)
|
void GUI_DeleteMenu(gui_menu *menu)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -153,16 +162,8 @@ void GUI_DeleteMenu(gui_menu *menu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set default background */
|
|
||||||
void GUI_SetBgColor(GXColor color)
|
|
||||||
{
|
|
||||||
bg_color.r = color.r;
|
|
||||||
bg_color.g = color.g;
|
|
||||||
bg_color.b = color.b;
|
|
||||||
bg_color.a = color.a;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Menu Rendering */
|
/* Draw Menu */
|
||||||
void GUI_DrawMenu(gui_menu *menu)
|
void GUI_DrawMenu(gui_menu *menu)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -216,9 +217,6 @@ void GUI_DrawMenu(gui_menu *menu)
|
|||||||
{
|
{
|
||||||
FONT_writeCenter(item->text,18,item->x+2,item->x+item->w+2,button->y+(button->h-18)/2+18,(GXColor)DARK_GREY);
|
FONT_writeCenter(item->text,18,item->x+2,item->x+item->w+2,button->y+(button->h-18)/2+18,(GXColor)DARK_GREY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update help comment */
|
|
||||||
if (menu->helpers[1]) strcpy(menu->helpers[1]->comment,item->comment);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -258,15 +256,18 @@ void GUI_DrawMenu(gui_menu *menu)
|
|||||||
item = menu->helpers[0];
|
item = menu->helpers[0];
|
||||||
if (item)
|
if (item)
|
||||||
{
|
{
|
||||||
gxDrawTexture(item->texture,item->x,item->y,item->w,item->h,255);
|
if (item->data && strlen(item->comment))
|
||||||
FONT_write(item->comment,16,item->x+item->w+6,item->y+(item->h-16)/2 + 16,640,(GXColor)WHITE);
|
{
|
||||||
|
gxDrawTexture(item->texture,item->x,item->y,item->w,item->h,255);
|
||||||
|
FONT_write(item->comment,16,item->x+item->w+6,item->y+(item->h-16)/2 + 16,640,(GXColor)WHITE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* right comment */
|
/* right comment */
|
||||||
item = menu->helpers[1];
|
item = menu->helpers[1];
|
||||||
if (item)
|
if (item)
|
||||||
{
|
{
|
||||||
if (menu->selected < menu->max_buttons)
|
if (item->data && strlen(item->comment))
|
||||||
{
|
{
|
||||||
gxDrawTexture(item->texture,item->x,item->y,item->w,item->h,255);
|
gxDrawTexture(item->texture,item->x,item->y,item->w,item->h,255);
|
||||||
FONT_alignRight(item->comment,16,item->x-6,item->y+(item->h-16)/2+16,(GXColor)WHITE);
|
FONT_alignRight(item->comment,16,item->x-6,item->y+(item->h-16)/2+16,(GXColor)WHITE);
|
||||||
@ -274,7 +275,7 @@ void GUI_DrawMenu(gui_menu *menu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Menu Transitions effect */
|
/* Draw Menu with transitions effects */
|
||||||
void GUI_DrawMenuFX(gui_menu *menu, u8 speed, u8 out)
|
void GUI_DrawMenuFX(gui_menu *menu, u8 speed, u8 out)
|
||||||
{
|
{
|
||||||
int i,temp,xoffset,yoffset;
|
int i,temp,xoffset,yoffset;
|
||||||
@ -441,247 +442,24 @@ void GUI_DrawMenuFX(gui_menu *menu, u8 speed, u8 out)
|
|||||||
else if (alpha < 0) alpha = 0;
|
else if (alpha < 0) alpha = 0;
|
||||||
|
|
||||||
/* copy EFB to XFB */
|
/* copy EFB to XFB */
|
||||||
gxSetScreen ();
|
gxSetScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* final position */
|
/* final position */
|
||||||
if (!out)
|
if (!out)
|
||||||
{
|
{
|
||||||
GUI_DrawMenu(menu);
|
GUI_DrawMenu(menu);
|
||||||
gxSetScreen ();
|
gxSetScreen();
|
||||||
}
|
}
|
||||||
else if (menu->screenshot)
|
else if (menu->screenshot)
|
||||||
{
|
{
|
||||||
gxClearScreen((GXColor)BLACK);
|
gxClearScreen((GXColor)BLACK);
|
||||||
gxDrawScreenshot(255);
|
gxDrawScreenshot(255);
|
||||||
gxSetScreen ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Basic Fading */
|
|
||||||
void GUI_FadeOut()
|
|
||||||
{
|
|
||||||
int alpha = 0;
|
|
||||||
while (alpha < 256)
|
|
||||||
{
|
|
||||||
gxDrawRectangle(0, 0, 640, 480, alpha, (GXColor)BLACK);
|
|
||||||
gxSetScreen();
|
gxSetScreen();
|
||||||
alpha +=3;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Window Prompt */
|
/* Update current menu */
|
||||||
/* prompt window slides in & out */
|
|
||||||
int GUI_WindowPrompt(gui_menu *parent, char *title, char *items[], u8 nb_items)
|
|
||||||
{
|
|
||||||
int i, ret, quit = 0;
|
|
||||||
s32 selected = 0;
|
|
||||||
s32 old;
|
|
||||||
butn_data *data = &button_text_data;
|
|
||||||
s16 p;
|
|
||||||
|
|
||||||
#ifdef HW_RVL
|
|
||||||
int x,y;
|
|
||||||
struct orient_t orient;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* initialize buttons data */
|
|
||||||
data->texture[0] = gxTextureOpenPNG(data->image[0],0);
|
|
||||||
data->texture[1] = gxTextureOpenPNG(data->image[1],0);
|
|
||||||
|
|
||||||
/* initialize texture window */
|
|
||||||
gx_texture *window = gxTextureOpenPNG(Frame_s1_png,0);
|
|
||||||
gx_texture *top = gxTextureOpenPNG(Frame_s1_title_png,0);
|
|
||||||
|
|
||||||
/* get initial positions */
|
|
||||||
int w = data->texture[0]->width;
|
|
||||||
int h = data->texture[0]->height;
|
|
||||||
int xwindow = (640 - window->width)/2;
|
|
||||||
int ywindow = (480 - window->height)/2;
|
|
||||||
int xpos = xwindow + (window->width - w)/2;
|
|
||||||
int ypos = (window->height - top->height - (h*nb_items) - (nb_items-1)*20)/2;
|
|
||||||
ypos = ypos + ywindow + top->height;
|
|
||||||
|
|
||||||
/* set initial vertical offset */
|
|
||||||
int yoffset = ywindow + window->height;
|
|
||||||
|
|
||||||
/* reset help comment */
|
|
||||||
if (parent->helpers[1]) strcpy(parent->helpers[1]->comment,"");
|
|
||||||
|
|
||||||
/* slide in */
|
|
||||||
while (yoffset > 0)
|
|
||||||
{
|
|
||||||
/* draw parent menu */
|
|
||||||
GUI_DrawMenu(parent);
|
|
||||||
|
|
||||||
/* draw window */
|
|
||||||
gxDrawTexture(window,xwindow,ywindow-yoffset,window->width,window->height,230);
|
|
||||||
gxDrawTexture(top,xwindow,ywindow-yoffset,top->width,top->height,255);
|
|
||||||
|
|
||||||
/* draw title */
|
|
||||||
FONT_writeCenter(title,20,xwindow,xwindow+window->width,ywindow+(top->height-20)/2+20-yoffset,(GXColor)WHITE);
|
|
||||||
|
|
||||||
/* draw buttons + text */
|
|
||||||
for (i=0; i<nb_items; i++)
|
|
||||||
{
|
|
||||||
gxDrawTexture(data->texture[0],xpos,ypos+i*(20 + h)-yoffset,w,h,255);
|
|
||||||
FONT_writeCenter(items[i],18,xpos,xpos+w,ypos+i*(20 + h)+(h + 18)/2- yoffset,(GXColor)DARK_GREY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* update display */
|
|
||||||
gxSetScreen ();
|
|
||||||
|
|
||||||
/* slide speed */
|
|
||||||
yoffset -= 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* draw menu */
|
|
||||||
while (quit == 0)
|
|
||||||
{
|
|
||||||
/* draw parent menu (should have been initialized first) */
|
|
||||||
GUI_DrawMenu(parent);
|
|
||||||
|
|
||||||
/* draw window */
|
|
||||||
gxDrawTexture(window,xwindow,ywindow,window->width,window->height,230);
|
|
||||||
gxDrawTexture(top,xwindow,ywindow,top->width,top->height,255);
|
|
||||||
|
|
||||||
/* draw title */
|
|
||||||
FONT_writeCenter(title,20,xwindow,xwindow+window->width,ywindow+(top->height-20)/2+20,(GXColor)WHITE);
|
|
||||||
|
|
||||||
/* draw buttons + text */
|
|
||||||
for (i=0; i<nb_items; i++)
|
|
||||||
{
|
|
||||||
if (i==selected)
|
|
||||||
{
|
|
||||||
gxDrawTexture(data->texture[1],xpos-4,ypos+i*(20+h)-4,w+8,h+8,255);
|
|
||||||
FONT_writeCenter(items[i],22,xpos,xpos+w,ypos+i*(20+h)+(h+22)/2,(GXColor)DARK_GREY);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gxDrawTexture(data->texture[0],xpos,ypos+i*(20 + h),w,h,255);
|
|
||||||
FONT_writeCenter(items[i],18,xpos,xpos+w,ypos+i*(20+h)+(h+18)/2,(GXColor)DARK_GREY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
old = selected;
|
|
||||||
p = m_input.keys;
|
|
||||||
|
|
||||||
#ifdef HW_RVL
|
|
||||||
if (Shutdown)
|
|
||||||
{
|
|
||||||
gxTextureClose(&w_pointer);
|
|
||||||
GUI_DeleteMenu(parent);
|
|
||||||
GUI_FadeOut();
|
|
||||||
shutdown();
|
|
||||||
SYS_ResetSystem(SYS_POWEROFF, 0, 0);
|
|
||||||
}
|
|
||||||
else if (m_input.ir.valid)
|
|
||||||
{
|
|
||||||
/* get cursor position */
|
|
||||||
x = m_input.ir.x;
|
|
||||||
y = m_input.ir.y;
|
|
||||||
|
|
||||||
/* draw wiimote pointer */
|
|
||||||
WPAD_Orientation(0,&orient);
|
|
||||||
gxResetAngle(orient.roll);
|
|
||||||
gxDrawTexture(w_pointer,x,y,w_pointer->width,w_pointer->height,255);
|
|
||||||
gxResetAngle(0.0);
|
|
||||||
|
|
||||||
/* check for valid buttons */
|
|
||||||
selected = -1;
|
|
||||||
for (i=0; i<nb_items; i++)
|
|
||||||
{
|
|
||||||
if ((x>=xpos)&&(x<=(xpos+w))&&(y>=ypos+i*(20 + h))&&(y<=(ypos+i*(20+h)+h)))
|
|
||||||
{
|
|
||||||
selected = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* reinitialize selection */
|
|
||||||
if (selected == -1) selected = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* update screen */
|
|
||||||
gxSetScreen ();
|
|
||||||
|
|
||||||
/* update selection */
|
|
||||||
if (p&PAD_BUTTON_UP)
|
|
||||||
{
|
|
||||||
if (selected > 0) selected --;
|
|
||||||
}
|
|
||||||
else if (p&PAD_BUTTON_DOWN)
|
|
||||||
{
|
|
||||||
if (selected < (nb_items -1)) selected ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* sound fx */
|
|
||||||
if (selected != old)
|
|
||||||
{
|
|
||||||
if (selected >= 0)
|
|
||||||
{
|
|
||||||
ASND_SetVoice(ASND_GetFirstUnusedVoice(),VOICE_MONO_16BIT,22050,0,(u8 *)button_over_pcm,button_over_pcm_size,
|
|
||||||
((int)config.sfx_volume * 255) / 100,((int)config.sfx_volume * 255) / 100,NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p & PAD_BUTTON_A)
|
|
||||||
{
|
|
||||||
if (selected >= 0)
|
|
||||||
{
|
|
||||||
quit = 1;
|
|
||||||
ret = selected;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (p & PAD_BUTTON_B)
|
|
||||||
{
|
|
||||||
quit = 1;
|
|
||||||
ret = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* reset initial vertical offset */
|
|
||||||
yoffset = 0;
|
|
||||||
|
|
||||||
/* slide out */
|
|
||||||
while (yoffset < (ywindow + window->height))
|
|
||||||
{
|
|
||||||
/* draw parent menu */
|
|
||||||
GUI_DrawMenu(parent);
|
|
||||||
|
|
||||||
/* draw window + header */
|
|
||||||
gxDrawTexture(window,xwindow,ywindow-yoffset,window->width,window->height,230);
|
|
||||||
gxDrawTexture(top,xwindow,ywindow-yoffset,top->width,top->height,255);
|
|
||||||
|
|
||||||
/* draw title */
|
|
||||||
FONT_writeCenter(title,20,xwindow,xwindow+window->width,ywindow+(top->height-20)/2+20-yoffset,(GXColor)WHITE);
|
|
||||||
|
|
||||||
/* draw buttons + text */
|
|
||||||
for (i=0; i<nb_items; i++)
|
|
||||||
{
|
|
||||||
gxDrawTexture(data->texture[0],xpos,ypos+i*(20+h)-yoffset,w,h,255);
|
|
||||||
FONT_writeCenter(items[i],18,xpos,xpos+w,ypos+i*(20+h)+(h+18)/2-yoffset,(GXColor)WHITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
yoffset += 60;
|
|
||||||
gxSetScreen ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* final position */
|
|
||||||
GUI_DrawMenu(parent);
|
|
||||||
gxSetScreen ();
|
|
||||||
|
|
||||||
/* close textures */
|
|
||||||
gxTextureClose(&window);
|
|
||||||
gxTextureClose(&data->texture[0]);
|
|
||||||
gxTextureClose(&data->texture[1]);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int GUI_UpdateMenu(gui_menu *menu)
|
int GUI_UpdateMenu(gui_menu *menu)
|
||||||
{
|
{
|
||||||
u16 p;
|
u16 p;
|
||||||
@ -749,7 +527,7 @@ int GUI_UpdateMenu(gui_menu *menu)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* update screen */
|
/* update screen */
|
||||||
gxSetScreen ();
|
gxSetScreen();
|
||||||
|
|
||||||
/* update menu */
|
/* update menu */
|
||||||
p = m_input.keys;
|
p = m_input.keys;
|
||||||
@ -855,6 +633,20 @@ int GUI_UpdateMenu(gui_menu *menu)
|
|||||||
menu->selected = selected;
|
menu->selected = selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* update helper comment */
|
||||||
|
if (menu->helpers[1])
|
||||||
|
{
|
||||||
|
if ((menu->offset + selected) < max_items)
|
||||||
|
{
|
||||||
|
gui_item *item = &menu->items[menu->offset + selected];
|
||||||
|
strcpy(menu->helpers[1]->comment,item->comment);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy(menu->helpers[1]->comment,"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* update arrows buttons status (items list) */
|
/* update arrows buttons status (items list) */
|
||||||
button = menu->arrows[0];
|
button = menu->arrows[0];
|
||||||
if (button)
|
if (button)
|
||||||
@ -886,6 +678,7 @@ int GUI_UpdateMenu(gui_menu *menu)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Generic routine to render & update menus */
|
||||||
int GUI_RunMenu(gui_menu *menu)
|
int GUI_RunMenu(gui_menu *menu)
|
||||||
{
|
{
|
||||||
int update = 0;
|
int update = 0;
|
||||||
@ -902,7 +695,223 @@ int GUI_RunMenu(gui_menu *menu)
|
|||||||
else return -1;
|
else return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* basic slide effect for option menus */
|
/* Window Prompt */
|
||||||
|
/* window slides in & out then display user choices */
|
||||||
|
int GUI_WindowPrompt(gui_menu *parent, char *title, char *items[], u8 nb_items)
|
||||||
|
{
|
||||||
|
int i, ret, quit = 0;
|
||||||
|
s32 selected = 0;
|
||||||
|
s32 old;
|
||||||
|
butn_data *data = &button_text_data;
|
||||||
|
s16 p;
|
||||||
|
|
||||||
|
#ifdef HW_RVL
|
||||||
|
int x,y;
|
||||||
|
struct orient_t orient;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* initialize buttons data */
|
||||||
|
data->texture[0] = gxTextureOpenPNG(data->image[0],0);
|
||||||
|
data->texture[1] = gxTextureOpenPNG(data->image[1],0);
|
||||||
|
|
||||||
|
/* initialize texture window */
|
||||||
|
gx_texture *window = gxTextureOpenPNG(Frame_s1_png,0);
|
||||||
|
gx_texture *top = gxTextureOpenPNG(Frame_s1_title_png,0);
|
||||||
|
|
||||||
|
/* get initial positions */
|
||||||
|
int w = data->texture[0]->width;
|
||||||
|
int h = data->texture[0]->height;
|
||||||
|
int xwindow = (640 - window->width)/2;
|
||||||
|
int ywindow = (480 - window->height)/2;
|
||||||
|
int xpos = xwindow + (window->width - w)/2;
|
||||||
|
int ypos = (window->height - top->height - (h*nb_items) - (nb_items-1)*20)/2;
|
||||||
|
ypos = ypos + ywindow + top->height;
|
||||||
|
|
||||||
|
/* set initial vertical offset */
|
||||||
|
int yoffset = ywindow + window->height;
|
||||||
|
|
||||||
|
/* disable helper comment */
|
||||||
|
if (parent->helpers[1]) parent->helpers[1]->data = 0;
|
||||||
|
|
||||||
|
/* slide in */
|
||||||
|
while (yoffset > 0)
|
||||||
|
{
|
||||||
|
/* draw parent menu */
|
||||||
|
GUI_DrawMenu(parent);
|
||||||
|
|
||||||
|
/* draw window */
|
||||||
|
gxDrawTexture(window,xwindow,ywindow-yoffset,window->width,window->height,230);
|
||||||
|
gxDrawTexture(top,xwindow,ywindow-yoffset,top->width,top->height,255);
|
||||||
|
|
||||||
|
/* draw title */
|
||||||
|
FONT_writeCenter(title,20,xwindow,xwindow+window->width,ywindow+(top->height-20)/2+20-yoffset,(GXColor)WHITE);
|
||||||
|
|
||||||
|
/* draw buttons + text */
|
||||||
|
for (i=0; i<nb_items; i++)
|
||||||
|
{
|
||||||
|
gxDrawTexture(data->texture[0],xpos,ypos+i*(20 + h)-yoffset,w,h,255);
|
||||||
|
FONT_writeCenter(items[i],18,xpos,xpos+w,ypos+i*(20 + h)+(h + 18)/2- yoffset,(GXColor)DARK_GREY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* update display */
|
||||||
|
gxSetScreen();
|
||||||
|
|
||||||
|
/* slide speed */
|
||||||
|
yoffset -= 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* draw menu */
|
||||||
|
while (quit == 0)
|
||||||
|
{
|
||||||
|
/* draw parent menu (should have been initialized first) */
|
||||||
|
GUI_DrawMenu(parent);
|
||||||
|
|
||||||
|
/* draw window */
|
||||||
|
gxDrawTexture(window,xwindow,ywindow,window->width,window->height,230);
|
||||||
|
gxDrawTexture(top,xwindow,ywindow,top->width,top->height,255);
|
||||||
|
|
||||||
|
/* draw title */
|
||||||
|
FONT_writeCenter(title,20,xwindow,xwindow+window->width,ywindow+(top->height-20)/2+20,(GXColor)WHITE);
|
||||||
|
|
||||||
|
/* draw buttons + text */
|
||||||
|
for (i=0; i<nb_items; i++)
|
||||||
|
{
|
||||||
|
if (i==selected)
|
||||||
|
{
|
||||||
|
gxDrawTexture(data->texture[1],xpos-4,ypos+i*(20+h)-4,w+8,h+8,255);
|
||||||
|
FONT_writeCenter(items[i],22,xpos,xpos+w,ypos+i*(20+h)+(h+22)/2,(GXColor)DARK_GREY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gxDrawTexture(data->texture[0],xpos,ypos+i*(20 + h),w,h,255);
|
||||||
|
FONT_writeCenter(items[i],18,xpos,xpos+w,ypos+i*(20+h)+(h+18)/2,(GXColor)DARK_GREY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
old = selected;
|
||||||
|
p = m_input.keys;
|
||||||
|
|
||||||
|
#ifdef HW_RVL
|
||||||
|
if (Shutdown)
|
||||||
|
{
|
||||||
|
gxTextureClose(&w_pointer);
|
||||||
|
GUI_DeleteMenu(parent);
|
||||||
|
GUI_FadeOut();
|
||||||
|
shutdown();
|
||||||
|
SYS_ResetSystem(SYS_POWEROFF, 0, 0);
|
||||||
|
}
|
||||||
|
else if (m_input.ir.valid)
|
||||||
|
{
|
||||||
|
/* get cursor position */
|
||||||
|
x = m_input.ir.x;
|
||||||
|
y = m_input.ir.y;
|
||||||
|
|
||||||
|
/* draw wiimote pointer */
|
||||||
|
WPAD_Orientation(0,&orient);
|
||||||
|
gxResetAngle(orient.roll);
|
||||||
|
gxDrawTexture(w_pointer,x,y,w_pointer->width,w_pointer->height,255);
|
||||||
|
gxResetAngle(0.0);
|
||||||
|
|
||||||
|
/* check for valid buttons */
|
||||||
|
selected = -1;
|
||||||
|
for (i=0; i<nb_items; i++)
|
||||||
|
{
|
||||||
|
if ((x>=xpos)&&(x<=(xpos+w))&&(y>=ypos+i*(20 + h))&&(y<=(ypos+i*(20+h)+h)))
|
||||||
|
{
|
||||||
|
selected = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* reinitialize selection */
|
||||||
|
if (selected == -1) selected = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* update screen */
|
||||||
|
gxSetScreen();
|
||||||
|
|
||||||
|
/* update selection */
|
||||||
|
if (p&PAD_BUTTON_UP)
|
||||||
|
{
|
||||||
|
if (selected > 0) selected --;
|
||||||
|
}
|
||||||
|
else if (p&PAD_BUTTON_DOWN)
|
||||||
|
{
|
||||||
|
if (selected < (nb_items -1)) selected ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* sound fx */
|
||||||
|
if (selected != old)
|
||||||
|
{
|
||||||
|
if (selected >= 0)
|
||||||
|
{
|
||||||
|
ASND_SetVoice(ASND_GetFirstUnusedVoice(),VOICE_MONO_16BIT,22050,0,(u8 *)button_over_pcm,button_over_pcm_size,
|
||||||
|
((int)config.sfx_volume * 255) / 100,((int)config.sfx_volume * 255) / 100,NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p & PAD_BUTTON_A)
|
||||||
|
{
|
||||||
|
if (selected >= 0)
|
||||||
|
{
|
||||||
|
quit = 1;
|
||||||
|
ret = selected;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (p & PAD_BUTTON_B)
|
||||||
|
{
|
||||||
|
quit = 1;
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* reset initial vertical offset */
|
||||||
|
yoffset = 0;
|
||||||
|
|
||||||
|
/* slide out */
|
||||||
|
while (yoffset < (ywindow + window->height))
|
||||||
|
{
|
||||||
|
/* draw parent menu */
|
||||||
|
GUI_DrawMenu(parent);
|
||||||
|
|
||||||
|
/* draw window + header */
|
||||||
|
gxDrawTexture(window,xwindow,ywindow-yoffset,window->width,window->height,230);
|
||||||
|
gxDrawTexture(top,xwindow,ywindow-yoffset,top->width,top->height,255);
|
||||||
|
|
||||||
|
/* draw title */
|
||||||
|
FONT_writeCenter(title,20,xwindow,xwindow+window->width,ywindow+(top->height-20)/2+20-yoffset,(GXColor)WHITE);
|
||||||
|
|
||||||
|
/* draw buttons + text */
|
||||||
|
for (i=0; i<nb_items; i++)
|
||||||
|
{
|
||||||
|
gxDrawTexture(data->texture[0],xpos,ypos+i*(20+h)-yoffset,w,h,255);
|
||||||
|
FONT_writeCenter(items[i],18,xpos,xpos+w,ypos+i*(20+h)+(h+18)/2-yoffset,(GXColor)WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
yoffset += 60;
|
||||||
|
gxSetScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* restore helper comment */
|
||||||
|
if (parent->helpers[1]) parent->helpers[1]->data = Key_A_png;
|
||||||
|
|
||||||
|
/* final position */
|
||||||
|
GUI_DrawMenu(parent);
|
||||||
|
gxSetScreen();
|
||||||
|
|
||||||
|
/* close textures */
|
||||||
|
gxTextureClose(&window);
|
||||||
|
gxTextureClose(&top);
|
||||||
|
gxTextureClose(&data->texture[0]);
|
||||||
|
gxTextureClose(&data->texture[1]);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Basic menu title slide effect */
|
||||||
void GUI_SlideMenuTitle(gui_menu *m, int title_offset)
|
void GUI_SlideMenuTitle(gui_menu *m, int title_offset)
|
||||||
{
|
{
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
@ -966,9 +975,232 @@ void GUI_SlideMenuTitle(gui_menu *m, int title_offset)
|
|||||||
if (m->selected >= m->max_buttons) m->selected = 0;
|
if (m->selected >= m->max_buttons) m->selected = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
gxSetScreen ();
|
gxSetScreen();
|
||||||
usleep(6000);
|
usleep(6000);
|
||||||
title_offset--;
|
title_offset--;
|
||||||
}
|
}
|
||||||
strcpy(m->title,title);
|
strcpy(m->title,title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Interactive Message Box */
|
||||||
|
/* Message Box displays a message until a specific action is completed */
|
||||||
|
|
||||||
|
/* Message Box LWP Thread */
|
||||||
|
static void *MsgBox_Thread(void *arg)
|
||||||
|
{
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if (message_box.refresh)
|
||||||
|
{
|
||||||
|
/* window position */
|
||||||
|
int xwindow = (vmode->fbWidth - message_box.window->width)/2;
|
||||||
|
int ywindow = (vmode->efbHeight - message_box.window->height)/2;
|
||||||
|
int ypos = ywindow + message_box.top->height + (message_box.window->height - message_box.top->height - 24)/2;
|
||||||
|
|
||||||
|
/* draw parent menu */
|
||||||
|
GUI_DrawMenu(message_box.parent);
|
||||||
|
|
||||||
|
/* draw window */
|
||||||
|
gxDrawTexture(message_box.window,xwindow,ywindow,message_box.window->width,message_box.window->height,230);
|
||||||
|
gxDrawTexture(message_box.top,xwindow,ywindow,message_box.top->width,message_box.top->height,255);
|
||||||
|
|
||||||
|
/* draw title */
|
||||||
|
if (message_box.title)
|
||||||
|
FONT_writeCenter(message_box.title,20,xwindow,xwindow+message_box.window->width,ywindow+(message_box.top->height-20)/2+20,(GXColor)WHITE);
|
||||||
|
|
||||||
|
/* draw box message */
|
||||||
|
if (message_box.msg)
|
||||||
|
FONT_writeCenter(message_box.msg,18,xwindow,xwindow+message_box.window->width,ypos,(GXColor)WHITE);
|
||||||
|
|
||||||
|
/* draw exit message */
|
||||||
|
if (message_box.buttonB)
|
||||||
|
{
|
||||||
|
FONT_write(": OK",18,xwindow+40+message_box.buttonA->width,640,ypos,(GXColor)WHITE);
|
||||||
|
FONT_write(": CANCEL",18,xwindow+120+message_box.buttonB->width,640,ypos,(GXColor)WHITE);
|
||||||
|
gxDrawTexture(message_box.buttonA, xwindow+40, ypos-18+(18-message_box.buttonA->height)/2,message_box.buttonA->width, message_box.buttonA->height,255);
|
||||||
|
gxDrawTexture(message_box.buttonB, xwindow+120, ypos-18+(18-message_box.buttonB->height)/2,message_box.buttonA->width, message_box.buttonA->height,255);
|
||||||
|
}
|
||||||
|
else if (message_box.buttonA)
|
||||||
|
{
|
||||||
|
FONT_writeCenter("Press to continue.",18,xwindow,xwindow+message_box.window->width,ypos+22,(GXColor)WHITE);
|
||||||
|
gxDrawTexture(message_box.buttonA, xwindow+116, ypos+4+(18-message_box.buttonA->height)/2,message_box.buttonA->width, message_box.buttonA->height,255);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* update display */
|
||||||
|
gxSetScreen();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LWP_YieldThread();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* update current Message Box */
|
||||||
|
void GUI_MsgBoxUpdate(gui_menu *parent, char *title, char *msg)
|
||||||
|
{
|
||||||
|
if (parent) message_box.parent = parent;
|
||||||
|
if (title) strncpy(message_box.title,title,64);
|
||||||
|
if (msg) strncpy(message_box.msg,msg,64);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* setup current Message Box */
|
||||||
|
void GUI_MsgBoxOpen(char *title, char *msg)
|
||||||
|
{
|
||||||
|
if (SILENT) return;
|
||||||
|
|
||||||
|
/* update message box */
|
||||||
|
GUI_MsgBoxUpdate(0,title,msg);
|
||||||
|
|
||||||
|
/* ensure we are not already running */
|
||||||
|
if (!message_box.refresh)
|
||||||
|
{
|
||||||
|
/* initialize default textures */
|
||||||
|
message_box.window = gxTextureOpenPNG(Frame_s4_png,0);
|
||||||
|
message_box.top = gxTextureOpenPNG(Frame_s4_title_png,0);
|
||||||
|
|
||||||
|
/* window position */
|
||||||
|
int xwindow = (vmode->fbWidth - message_box.window->width)/2;
|
||||||
|
int ywindow = (vmode->efbHeight - message_box.window->height)/2;
|
||||||
|
int ypos = ywindow + message_box.top->height + (message_box.window->height - message_box.top->height - 24)/2;
|
||||||
|
|
||||||
|
/* disable helper comments */
|
||||||
|
if (message_box.parent->helpers[0]) message_box.parent->helpers[0]->data = 0;
|
||||||
|
if (message_box.parent->helpers[1]) message_box.parent->helpers[1]->data = 0;
|
||||||
|
|
||||||
|
/* slide in */
|
||||||
|
int yoffset = ywindow + message_box.window->height;
|
||||||
|
while (yoffset > 0)
|
||||||
|
{
|
||||||
|
/* draw parent menu */
|
||||||
|
GUI_DrawMenu(message_box.parent);
|
||||||
|
|
||||||
|
/* draw window */
|
||||||
|
gxDrawTexture(message_box.window,xwindow,ywindow-yoffset,message_box.window->width,message_box.window->height,230);
|
||||||
|
gxDrawTexture(message_box.top,xwindow,ywindow-yoffset,message_box.top->width,message_box.top->height,255);
|
||||||
|
|
||||||
|
/* draw title */
|
||||||
|
if (title) FONT_writeCenter(title,20,xwindow,xwindow+message_box.window->width,ywindow+(message_box.top->height-20)/2+20-yoffset,(GXColor)WHITE);
|
||||||
|
|
||||||
|
/* draw box message */
|
||||||
|
if (msg) FONT_writeCenter(msg,18,xwindow,xwindow+message_box.window->width,ypos-yoffset,(GXColor)WHITE);
|
||||||
|
|
||||||
|
/* update display */
|
||||||
|
gxSetScreen();
|
||||||
|
|
||||||
|
/* slide speed */
|
||||||
|
yoffset -= 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* resume LWP thread for MessageBox refresh */
|
||||||
|
message_box.refresh = TRUE;
|
||||||
|
LWP_ResumeThread(msgboxthread);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Close current messagebox */
|
||||||
|
void GUI_MsgBoxClose(void)
|
||||||
|
{
|
||||||
|
if (message_box.refresh)
|
||||||
|
{
|
||||||
|
/* suspend MessageBox refresh */
|
||||||
|
message_box.refresh = FALSE;
|
||||||
|
LWP_SuspendThread(msgboxthread);
|
||||||
|
|
||||||
|
/* window position */
|
||||||
|
int xwindow = (vmode->fbWidth - message_box.window->width)/2;
|
||||||
|
int ywindow = (vmode->efbHeight - message_box.window->height)/2;
|
||||||
|
int ypos = ywindow + message_box.top->height + (message_box.window->height - message_box.top->height - 24)/2;
|
||||||
|
|
||||||
|
/* slide out */
|
||||||
|
int yoffset = 0;
|
||||||
|
while (yoffset < (ywindow + message_box.window->height))
|
||||||
|
{
|
||||||
|
/* draw parent menu */
|
||||||
|
GUI_DrawMenu(message_box.parent);
|
||||||
|
|
||||||
|
/* draw window */
|
||||||
|
gxDrawTexture(message_box.window,xwindow,ywindow-yoffset,message_box.window->width,message_box.window->height,230);
|
||||||
|
gxDrawTexture(message_box.top,xwindow,ywindow-yoffset,message_box.top->width,message_box.top->height,255);
|
||||||
|
|
||||||
|
/* draw title */
|
||||||
|
if (message_box.title)
|
||||||
|
FONT_writeCenter(message_box.title,20,xwindow,xwindow+message_box.window->width,ywindow+(message_box.top->height-20)/2+20-yoffset,(GXColor)WHITE);
|
||||||
|
|
||||||
|
/* draw text */
|
||||||
|
if (message_box.msg)
|
||||||
|
FONT_writeCenter(message_box.msg,18,xwindow,xwindow+message_box.window->width,ypos- yoffset,(GXColor)WHITE);
|
||||||
|
|
||||||
|
/* update display */
|
||||||
|
gxSetScreen();
|
||||||
|
|
||||||
|
/* slide speed */
|
||||||
|
yoffset += 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* restore helper comment */
|
||||||
|
if (message_box.parent->helpers[0]) message_box.parent->helpers[0]->data = Key_B_png;
|
||||||
|
if (message_box.parent->helpers[1]) message_box.parent->helpers[1]->data = Key_A_png;
|
||||||
|
|
||||||
|
/* final position */
|
||||||
|
GUI_DrawMenu(message_box.parent);
|
||||||
|
gxSetScreen();
|
||||||
|
|
||||||
|
/* close textures */
|
||||||
|
gxTextureClose(&message_box.window);
|
||||||
|
gxTextureClose(&message_box.top);
|
||||||
|
gxTextureClose(&message_box.buttonA);
|
||||||
|
gxTextureClose(&message_box.buttonB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GUI_WaitPrompt(char *title, char *msg)
|
||||||
|
{
|
||||||
|
if (SILENT) return;
|
||||||
|
|
||||||
|
/* update message box */
|
||||||
|
GUI_MsgBoxOpen(title, msg);
|
||||||
|
|
||||||
|
/* allocate texture memory */
|
||||||
|
message_box.buttonA = gxTextureOpenPNG(Key_A_png,0);
|
||||||
|
|
||||||
|
/* wait for button A */
|
||||||
|
while (m_input.keys & PAD_BUTTON_A) VIDEO_WaitVSync();
|
||||||
|
while (!(m_input.keys & PAD_BUTTON_A)) VIDEO_WaitVSync();
|
||||||
|
|
||||||
|
/* close message box if required */
|
||||||
|
GUI_MsgBoxClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Basic Fading */
|
||||||
|
void GUI_FadeOut()
|
||||||
|
{
|
||||||
|
int alpha = 0;
|
||||||
|
while (alpha < 256)
|
||||||
|
{
|
||||||
|
gxDrawRectangle(0, 0, 640, 480, alpha, (GXColor)BLACK);
|
||||||
|
gxSetScreen();
|
||||||
|
alpha +=3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Select default background color */
|
||||||
|
void GUI_SetBgColor(GXColor color)
|
||||||
|
{
|
||||||
|
bg_color.r = color.r;
|
||||||
|
bg_color.g = color.g;
|
||||||
|
bg_color.b = color.b;
|
||||||
|
bg_color.a = color.a;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize GUI engine */
|
||||||
|
void GUI_Initialize(void)
|
||||||
|
{
|
||||||
|
/* create LWP thread for MessageBox refresh */
|
||||||
|
message_box.refresh = FALSE;
|
||||||
|
LWP_CreateThread (&msgboxthread, MsgBox_Thread, NULL, NULL, 0, 50);
|
||||||
|
LWP_SuspendThread(msgboxthread);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -119,6 +119,18 @@ typedef struct
|
|||||||
bool screenshot; /* use gamescreen as background */
|
bool screenshot; /* use gamescreen as background */
|
||||||
} gui_menu;
|
} gui_menu;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
bool refresh; /* messagebox current state */
|
||||||
|
gui_menu *parent; /* parent menu */
|
||||||
|
char title[64]; /* box title */
|
||||||
|
char msg[64]; /* box message */
|
||||||
|
gx_texture *window; /* pointer to box texture */
|
||||||
|
gx_texture *top; /* pointer to box title texture */
|
||||||
|
gx_texture *buttonA; /* pointer to button A texture */
|
||||||
|
gx_texture *buttonB; /* pointer to button B texture */
|
||||||
|
} gui_message;
|
||||||
|
|
||||||
/* Menu Inputs */
|
/* Menu Inputs */
|
||||||
struct t_input_menu
|
struct t_input_menu
|
||||||
{
|
{
|
||||||
@ -152,6 +164,7 @@ extern const u8 Frame_s2_png[];
|
|||||||
extern const u8 Frame_s3_png[];
|
extern const u8 Frame_s3_png[];
|
||||||
extern const u8 Frame_s4_png[];
|
extern const u8 Frame_s4_png[];
|
||||||
extern const u8 Frame_s1_title_png[];
|
extern const u8 Frame_s1_title_png[];
|
||||||
|
extern const u8 Frame_s4_title_png[];
|
||||||
|
|
||||||
/* ROM Browser */
|
/* ROM Browser */
|
||||||
extern const u8 Overlay_bar_png[];
|
extern const u8 Overlay_bar_png[];
|
||||||
@ -228,10 +241,14 @@ extern const u8 ctrl_wiimote_png[];
|
|||||||
|
|
||||||
/* Generic images*/
|
/* Generic images*/
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
|
#define Key_A_png Key_A_wii_png
|
||||||
|
#define Key_B_png Key_B_wii_png
|
||||||
extern const u8 generic_point_png[];
|
extern const u8 generic_point_png[];
|
||||||
extern const u8 Key_A_wii_png[];
|
extern const u8 Key_A_wii_png[];
|
||||||
extern const u8 Key_B_wii_png[];
|
extern const u8 Key_B_wii_png[];
|
||||||
#else
|
#else
|
||||||
|
#define Key_A_png Key_A_gcn_png
|
||||||
|
#define Key_B_png Key_B_gcn_png
|
||||||
extern const u8 Key_A_gcn_png[];
|
extern const u8 Key_A_gcn_png[];
|
||||||
extern const u8 Key_B_gcn_png[];
|
extern const u8 Key_B_gcn_png[];
|
||||||
#endif
|
#endif
|
||||||
@ -249,15 +266,22 @@ extern const u32 intro_pcm_size;
|
|||||||
extern gx_texture *w_pointer;
|
extern gx_texture *w_pointer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern u8 SILENT;
|
||||||
|
|
||||||
extern void GUI_InitMenu(gui_menu *menu);
|
extern void GUI_InitMenu(gui_menu *menu);
|
||||||
extern void GUI_DeleteMenu(gui_menu *menu);
|
extern void GUI_DeleteMenu(gui_menu *menu);
|
||||||
extern void GUI_FadeOut();
|
|
||||||
extern void GUI_SetBgColor(GXColor color);
|
|
||||||
extern void GUI_DrawMenu(gui_menu *menu);
|
extern void GUI_DrawMenu(gui_menu *menu);
|
||||||
extern void GUI_DrawMenuFX(gui_menu *menu, u8 speed, u8 out);
|
extern void GUI_DrawMenuFX(gui_menu *menu, u8 speed, u8 out);
|
||||||
extern void GUI_SlideMenuTitle(gui_menu *m, int title_offset);
|
|
||||||
extern int GUI_UpdateMenu(gui_menu *menu);
|
extern int GUI_UpdateMenu(gui_menu *menu);
|
||||||
extern int GUI_RunMenu(gui_menu *menu);
|
extern int GUI_RunMenu(gui_menu *menu);
|
||||||
extern int GUI_WindowPrompt(gui_menu *parent, char *title, char *items[], u8 nb_items);
|
extern int GUI_WindowPrompt(gui_menu *parent, char *title, char *items[], u8 nb_items);
|
||||||
|
extern void GUI_SlideMenuTitle(gui_menu *m, int title_offset);
|
||||||
|
extern void GUI_MsgBoxOpen(char *title, char *msg);
|
||||||
|
extern void GUI_MsgBoxUpdate(gui_menu *parent, char *title, char *msg);
|
||||||
|
extern void GUI_MsgBoxClose(void);
|
||||||
|
extern void GUI_WaitPrompt(char *title, char *msg);
|
||||||
|
extern void GUI_FadeOut();
|
||||||
|
extern void GUI_SetBgColor(GXColor color);
|
||||||
|
extern void GUI_Initialize(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -80,7 +80,7 @@ void legal ()
|
|||||||
|
|
||||||
gxDrawTexture(logo_bottom, (640-logo_bottom->width-logo_top->width -32)/2, 480-logo_bottom->height-24, logo_bottom->width, logo_bottom->height,255);
|
gxDrawTexture(logo_bottom, (640-logo_bottom->width-logo_top->width -32)/2, 480-logo_bottom->height-24, logo_bottom->width, logo_bottom->height,255);
|
||||||
gxDrawTexture(logo_top, (640-logo_bottom->width-logo_top->width -32)/2+logo_bottom->width+32, 480-logo_bottom->height-24, logo_top->width, logo_top->height,255);
|
gxDrawTexture(logo_top, (640-logo_bottom->width-logo_top->width -32)/2+logo_bottom->width+32, 480-logo_bottom->height-24, logo_top->width, logo_top->height,255);
|
||||||
gxSetScreen ();
|
gxSetScreen();
|
||||||
|
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ void legal ()
|
|||||||
|
|
||||||
gxDrawTexture(logo_bottom, (640-logo_bottom->width-logo_top->width - 32)/2, 480-logo_bottom->height-24, logo_bottom->width, logo_bottom->height,255);
|
gxDrawTexture(logo_bottom, (640-logo_bottom->width-logo_top->width - 32)/2, 480-logo_bottom->height-24, logo_bottom->width, logo_bottom->height,255);
|
||||||
gxDrawTexture(logo_top, (640-logo_bottom->width-logo_top->width -32)/2+logo_bottom->width+32, 480-logo_bottom->height-24, logo_top->width, logo_top->height,255);
|
gxDrawTexture(logo_top, (640-logo_bottom->width-logo_top->width -32)/2+logo_bottom->width+32, 480-logo_bottom->height-24, logo_top->width, logo_top->height,255);
|
||||||
gxSetScreen ();
|
gxSetScreen();
|
||||||
count--;
|
count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ void legal ()
|
|||||||
free(texture);
|
free(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
gxSetScreen ();
|
gxSetScreen();
|
||||||
sleep (1);
|
sleep (1);
|
||||||
|
|
||||||
gxClearScreen((GXColor)WHITE);
|
gxClearScreen((GXColor)WHITE);
|
||||||
@ -171,7 +171,7 @@ void legal ()
|
|||||||
free(texture);
|
free(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
gxSetScreen ();
|
gxSetScreen();
|
||||||
sleep (1);
|
sleep (1);
|
||||||
gxClearScreen((GXColor)BLACK);
|
gxClearScreen((GXColor)BLACK);
|
||||||
texture = gxTextureOpenPNG(Bg_intro_c3_png,0);
|
texture = gxTextureOpenPNG(Bg_intro_c3_png,0);
|
||||||
@ -181,7 +181,7 @@ void legal ()
|
|||||||
if (texture->data) free(texture->data);
|
if (texture->data) free(texture->data);
|
||||||
free(texture);
|
free(texture);
|
||||||
}
|
}
|
||||||
gxSetScreen ();
|
gxSetScreen();
|
||||||
|
|
||||||
ASND_Init();
|
ASND_Init();
|
||||||
ASND_Pause(0);
|
ASND_Pause(0);
|
||||||
|
@ -101,20 +101,12 @@ static butn_data button_player_none_data =
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static gui_item action_cancel =
|
static gui_item action_cancel =
|
||||||
{
|
{
|
||||||
#ifdef HW_RVL
|
NULL,Key_B_png,"","Back",10,422,28,28
|
||||||
NULL,Key_B_wii_png,"","Back",10,422,28,28
|
|
||||||
#else
|
|
||||||
NULL,Key_B_gcn_png,"","Back",10,422,28,28
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static gui_item action_select =
|
static gui_item action_select =
|
||||||
{
|
{
|
||||||
#ifdef HW_RVL
|
NULL,Key_A_png,"","",602,422,28,28
|
||||||
NULL,Key_A_wii_png,"","",602,422,28,28
|
|
||||||
#else
|
|
||||||
NULL,Key_A_gcn_png,"","",602,422,28,28
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -195,7 +187,7 @@ static gui_item items_ctrls[13] =
|
|||||||
{NULL,NULL,"","",304, 0, 24, 0},
|
{NULL,NULL,"","",304, 0, 24, 0},
|
||||||
{NULL,NULL,"","", 0, 0, 0, 0},
|
{NULL,NULL,"","", 0, 0, 0, 0},
|
||||||
{NULL,NULL,"","", 0, 0, 0, 0},
|
{NULL,NULL,"","", 0, 0, 0, 0},
|
||||||
{NULL,Ctrl_config_png,"Keys\nConfig","Reconfigure Controller Keys",530,306,32,32}
|
{NULL,Ctrl_config_png,"Keys\nConfig","Configure Controller Keys",530,306,32,32}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
@ -363,7 +355,7 @@ static gui_menu menu_main =
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Main menu */
|
/* Main menu */
|
||||||
static gui_menu menu_ctrls =
|
gui_menu menu_ctrls =
|
||||||
{
|
{
|
||||||
"Controller Settings",
|
"Controller Settings",
|
||||||
0,0,
|
0,0,
|
||||||
@ -524,7 +516,7 @@ static void drawmenu (char items[][25], int maxitems, int selected)
|
|||||||
else WriteCentre (i * fheight + ypos, (char *) items[i]);
|
else WriteCentre (i * fheight + ypos, (char *) items[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
gxSetScreen ();
|
gxSetScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int domenu (char items[][25], int maxitems, u8 fastmove)
|
static int domenu (char items[][25], int maxitems, u8 fastmove)
|
||||||
@ -670,14 +662,14 @@ static void prefmenu ()
|
|||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
case -7:
|
case -7:
|
||||||
if (ret < 0) config.screen_w --;
|
if (ret < 0) config.screen_w -=2;
|
||||||
else config.screen_w ++;
|
else config.screen_w +=2;
|
||||||
if (config.screen_w < 640) config.screen_w = VI_MAX_WIDTH_NTSC;
|
if (config.screen_w < 640) config.screen_w = VI_MAX_WIDTH_NTSC;
|
||||||
else if (config.screen_w > VI_MAX_WIDTH_NTSC) config.screen_w = 640;
|
else if (config.screen_w > VI_MAX_WIDTH_NTSC) config.screen_w = 640;
|
||||||
vmode->viWidth = config.screen_w;
|
|
||||||
vmode->viXOrigin = (VI_MAX_WIDTH_NTSC - vmode->viWidth)/2;
|
|
||||||
VIDEO_Configure(vmode);
|
|
||||||
sprintf (items[5].text, "Screen Width: %d", config.screen_w);
|
sprintf (items[5].text, "Screen Width: %d", config.screen_w);
|
||||||
|
vmode->viWidth = config.screen_w;
|
||||||
|
vmode->viXOrigin = (VI_MAX_WIDTH_NTSC -config.screen_w)/2;
|
||||||
|
VIDEO_Configure(vmode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -1:
|
case -1:
|
||||||
@ -828,7 +820,7 @@ static void systemmenu ()
|
|||||||
hctab = (reg[12] & 1) ? cycle2hc40 : cycle2hc32;
|
hctab = (reg[12] & 1) ? cycle2hc40 : cycle2hc32;
|
||||||
|
|
||||||
/* reinitialize overscan area */
|
/* reinitialize overscan area */
|
||||||
bitmap.viewport.x = config.overscan ? ((reg[12] & 1) ? 16 : 12) : 0;
|
bitmap.viewport.x = config.overscan ? 14 : 0;
|
||||||
bitmap.viewport.y = config.overscan ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
|
bitmap.viewport.y = config.overscan ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1368,8 +1360,8 @@ static void ctrlmenu(void)
|
|||||||
m->buttons[10].shift[2] = 10 - m->selected;
|
m->buttons[10].shift[2] = 10 - m->selected;
|
||||||
m->buttons[11].shift[2] = 11 - m->selected;
|
m->buttons[11].shift[2] = 11 - m->selected;
|
||||||
m->buttons[12].shift[2] = 12 - m->selected;
|
m->buttons[12].shift[2] = 12 - m->selected;
|
||||||
GUI_DrawMenuFX(m, 20, 0);
|
|
||||||
m->selected = 10;
|
m->selected = 10;
|
||||||
|
GUI_DrawMenuFX(m, 20, 0);
|
||||||
|
|
||||||
/* update title */
|
/* update title */
|
||||||
if (j_cart && (player > 1))
|
if (j_cart && (player > 1))
|
||||||
@ -1514,6 +1506,7 @@ static void ctrlmenu(void)
|
|||||||
|
|
||||||
case 12: /* Controller Keys Configuration */
|
case 12: /* Controller Keys Configuration */
|
||||||
if (config.input[player].device < 0) break;
|
if (config.input[player].device < 0) break;
|
||||||
|
GUI_MsgBoxOpen("Keys Configuration", "");
|
||||||
if (config.input[player].padtype == DEVICE_6BUTTON)
|
if (config.input[player].padtype == DEVICE_6BUTTON)
|
||||||
{
|
{
|
||||||
/* 6-buttons gamepad */
|
/* 6-buttons gamepad */
|
||||||
@ -1532,9 +1525,42 @@ static void ctrlmenu(void)
|
|||||||
/* 3-Buttons gamepad, mouse, lightgun */
|
/* 3-Buttons gamepad, mouse, lightgun */
|
||||||
gx_input_Config(config.input[player].port, config.input[player].device, 4);
|
gx_input_Config(config.input[player].port, config.input[player].device, 4);
|
||||||
}
|
}
|
||||||
|
GUI_MsgBoxClose();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (update < 0)
|
||||||
|
{
|
||||||
|
if (m->bg_images[7].state & IMAGE_VISIBLE)
|
||||||
|
{
|
||||||
|
/* slide out configuration window */
|
||||||
|
GUI_DrawMenuFX(m, 20, 1);
|
||||||
|
|
||||||
|
/* disable configuration window */
|
||||||
|
m->bg_images[7].state &= ~IMAGE_VISIBLE;
|
||||||
|
|
||||||
|
/* disable configuration buttons */
|
||||||
|
m->buttons[10].state &= (~BUTTON_VISIBLE & ~BUTTON_ACTIVE);
|
||||||
|
m->buttons[11].state &= (~BUTTON_VISIBLE & ~BUTTON_ACTIVE);
|
||||||
|
m->buttons[12].state &= (~BUTTON_VISIBLE & ~BUTTON_ACTIVE);
|
||||||
|
|
||||||
|
/* clear directions */
|
||||||
|
m->buttons[2].shift[3] = 0;
|
||||||
|
m->buttons[3].shift[3] = 0;
|
||||||
|
m->buttons[4].shift[3] = 0;
|
||||||
|
m->buttons[5].shift[3] = 0;
|
||||||
|
m->buttons[6].shift[3] = 0;
|
||||||
|
m->buttons[7].shift[3] = 0;
|
||||||
|
m->buttons[8].shift[3] = 0;
|
||||||
|
m->buttons[9].shift[3] = 0;
|
||||||
|
|
||||||
|
/* update selector */
|
||||||
|
m->selected -= m->buttons[m->selected].shift[2];
|
||||||
|
|
||||||
|
/* stay in menu */
|
||||||
|
update = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remove duplicate assigned inputs before leaving */
|
/* remove duplicate assigned inputs before leaving */
|
||||||
@ -1699,8 +1725,10 @@ static int loadsavemenu (int which)
|
|||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
|
SILENT = 1;
|
||||||
if (which == 1) quit = ManageState(ret-1,device);
|
if (which == 1) quit = ManageState(ret-1,device);
|
||||||
else if (which == 0) quit = ManageSRAM(ret-1,device);
|
else if (which == 0) quit = ManageSRAM(ret-1,device);
|
||||||
|
SILENT = 0;
|
||||||
if (quit) return 1;
|
if (quit) return 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1759,49 +1787,60 @@ static int loadmenu ()
|
|||||||
{
|
{
|
||||||
int ret,size;
|
int ret,size;
|
||||||
gui_menu *m = &menu_load;
|
gui_menu *m = &menu_load;
|
||||||
|
GUI_InitMenu(m);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
GUI_InitMenu(m);
|
|
||||||
ret = GUI_RunMenu(m);
|
ret = GUI_RunMenu(m);
|
||||||
GUI_DeleteMenu(m);
|
|
||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
/*** Button B ***/
|
/*** Button B ***/
|
||||||
case -1:
|
case -1:
|
||||||
|
GUI_DeleteMenu(m);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/*** Load from DVD ***/
|
/*** Load from DVD ***/
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
case 3:
|
case 3:
|
||||||
#else
|
#else
|
||||||
case 2:
|
case 2:
|
||||||
#endif
|
#endif
|
||||||
size = DVD_Open(cart_rom);
|
if (DVD_Open())
|
||||||
if (size)
|
|
||||||
{
|
{
|
||||||
//dvd_motor_off();
|
GUI_DeleteMenu(m);
|
||||||
memfile_autosave(-1,config.state_auto);
|
size = FileSelector(cart_rom);
|
||||||
reloadrom(size,filelist[selection].filename);
|
if (size)
|
||||||
memfile_autoload(config.sram_auto,config.state_auto);
|
{
|
||||||
return 1;
|
memfile_autosave(-1,config.state_auto);
|
||||||
|
reloadrom(size,filelist[selection].filename);
|
||||||
|
memfile_autoload(config.sram_auto,config.state_auto);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
GUI_InitMenu(m);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*** Load from FAT device ***/
|
/*** Load from FAT device ***/
|
||||||
default:
|
default:
|
||||||
size = FAT_Open(ret,cart_rom);
|
if (FAT_Open(ret))
|
||||||
if (size)
|
|
||||||
{
|
{
|
||||||
memfile_autosave(-1,config.state_auto);
|
GUI_DeleteMenu(m);
|
||||||
reloadrom(size,filelist[selection].filename);
|
size = FileSelector(cart_rom);
|
||||||
memfile_autoload(config.sram_auto,config.state_auto);
|
if (size)
|
||||||
return 1;
|
{
|
||||||
|
memfile_autosave(-1,config.state_auto);
|
||||||
|
reloadrom(size,filelist[selection].filename);
|
||||||
|
memfile_autoload(config.sram_auto,config.state_auto);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
GUI_InitMenu(m);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -1912,7 +1951,7 @@ static void showrominfo ()
|
|||||||
|
|
||||||
ypos += fheight;
|
ypos += fheight;
|
||||||
WriteCentre (ypos, "Press A to Continue");
|
WriteCentre (ypos, "Press A to Continue");
|
||||||
gxSetScreen ();
|
gxSetScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
p = m_input.keys;
|
p = m_input.keys;
|
||||||
@ -1949,13 +1988,6 @@ void MainMenu (void)
|
|||||||
memfile_autosave(config.sram_auto,-1);
|
memfile_autosave(config.sram_auto,-1);
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
if (Shutdown)
|
|
||||||
{
|
|
||||||
GUI_FadeOut();
|
|
||||||
shutdown();
|
|
||||||
SYS_ResetSystem(SYS_POWEROFF, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* wiimote pointer */
|
/* wiimote pointer */
|
||||||
w_pointer = gxTextureOpenPNG(generic_point_png,0);
|
w_pointer = gxTextureOpenPNG(generic_point_png,0);
|
||||||
#endif
|
#endif
|
||||||
@ -2060,7 +2092,7 @@ void MainMenu (void)
|
|||||||
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_reset ();
|
system_reset ();
|
||||||
quit = 1;
|
quit = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -89,16 +89,19 @@ static void pad_config(int chan, int max_keys)
|
|||||||
u16 p,key;
|
u16 p,key;
|
||||||
char msg[30];
|
char msg[30];
|
||||||
|
|
||||||
/* disable inputs update callback */
|
/* reset VSYNC callback */
|
||||||
VIDEO_SetPostRetraceCallback(NULL);
|
VIDEO_SetPostRetraceCallback(NULL);
|
||||||
VIDEO_Flush();
|
VIDEO_Flush();
|
||||||
|
|
||||||
/* Check if PAD is connected */
|
/* Check if PAD is connected */
|
||||||
if (!(PAD_ScanPads() & (1<<chan)))
|
if (!(PAD_ScanPads() & (1<<chan)))
|
||||||
{
|
{
|
||||||
|
/* restore inputs update callback */
|
||||||
|
VIDEO_SetPostRetraceCallback(gx_input_UpdateMenu);
|
||||||
|
VIDEO_Flush();
|
||||||
sprintf(msg, "PAD #%d is not connected !", chan+1);
|
sprintf(msg, "PAD #%d is not connected !", chan+1);
|
||||||
WaitPrompt(msg);
|
GUI_WaitPrompt("ERROR",msg);
|
||||||
max_keys = 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Configure each keys */
|
/* Configure each keys */
|
||||||
@ -112,11 +115,8 @@ static void pad_config(int chan, int max_keys)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* wait for user input */
|
/* wait for user input */
|
||||||
gxClearScreen((GXColor)BLACK);
|
sprintf(msg,"Press key for %s\n(Z to return)",keys_name[i]);
|
||||||
sprintf(msg,"Press key for %s",keys_name[i]);
|
GUI_MsgBoxUpdate(0,0,msg);
|
||||||
WriteCentre(254, msg);
|
|
||||||
WriteCentre(254+fheight, "Z trigger to exit");
|
|
||||||
gxSetScreen();
|
|
||||||
|
|
||||||
key = 0;
|
key = 0;
|
||||||
while (!key)
|
while (!key)
|
||||||
@ -314,7 +314,7 @@ static void wpad_config(u8 chan, u8 exp, u8 max_keys)
|
|||||||
char msg[30];
|
char msg[30];
|
||||||
u32 key,p = 255;
|
u32 key,p = 255;
|
||||||
|
|
||||||
/* disable inputs update callback */
|
/* remove inputs update callback */
|
||||||
VIDEO_SetPostRetraceCallback(NULL);
|
VIDEO_SetPostRetraceCallback(NULL);
|
||||||
VIDEO_Flush();
|
VIDEO_Flush();
|
||||||
|
|
||||||
@ -322,11 +322,15 @@ static void wpad_config(u8 chan, u8 exp, u8 max_keys)
|
|||||||
WPAD_Probe(chan, &p);
|
WPAD_Probe(chan, &p);
|
||||||
if (((exp > WPAD_EXP_NONE) && (p != exp)) || (p == 255))
|
if (((exp > WPAD_EXP_NONE) && (p != exp)) || (p == 255))
|
||||||
{
|
{
|
||||||
|
/* restore inputs update callback */
|
||||||
|
VIDEO_SetPostRetraceCallback(gx_input_UpdateMenu);
|
||||||
|
VIDEO_Flush();
|
||||||
|
|
||||||
if (exp == WPAD_EXP_NONE) sprintf(msg, "WIIMOTE #%d is not connected !", chan+1);
|
if (exp == WPAD_EXP_NONE) sprintf(msg, "WIIMOTE #%d is not connected !", chan+1);
|
||||||
if (exp == WPAD_EXP_NUNCHUK) sprintf(msg, "NUNCHUK #%d is not connected !", chan+1);
|
if (exp == WPAD_EXP_NUNCHUK) sprintf(msg, "NUNCHUK #%d is not connected !", chan+1);
|
||||||
if (exp == WPAD_EXP_CLASSIC) sprintf(msg, "CLASSIC #%d is not connected !", chan+1);
|
if (exp == WPAD_EXP_CLASSIC) sprintf(msg, "CLASSIC #%d is not connected !", chan+1);
|
||||||
WaitPrompt(msg);
|
GUI_WaitPrompt("ERROR",msg);
|
||||||
max_keys = 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* loop on each mapped keys */
|
/* loop on each mapped keys */
|
||||||
@ -340,11 +344,8 @@ static void wpad_config(u8 chan, u8 exp, u8 max_keys)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* wait for user input */
|
/* wait for user input */
|
||||||
gxClearScreen((GXColor)BLACK);
|
sprintf(msg,"Press key for %s\n(HOME to return)",keys_name[i]);
|
||||||
sprintf(msg,"Press key for %s",keys_name[i]);
|
GUI_MsgBoxUpdate(0,0,msg);
|
||||||
WriteCentre(254, msg);
|
|
||||||
WriteCentre(254+fheight, "(HOME to return)");
|
|
||||||
gxSetScreen();
|
|
||||||
|
|
||||||
/* wait for input */
|
/* wait for input */
|
||||||
key = 0;
|
key = 0;
|
||||||
|
@ -454,13 +454,13 @@ static void gxResetScale(u32 width, u32 height)
|
|||||||
if (config.overscan)
|
if (config.overscan)
|
||||||
{
|
{
|
||||||
/* borders are emulated */
|
/* borders are emulated */
|
||||||
xscale = 358 + ((reg[12] & 1)*2) - gc_pal;
|
xscale = 360 - gc_pal;
|
||||||
yscale = vdp_pal + ((gc_pal && !config.render) ? 143 : 120);
|
yscale = vdp_pal + ((gc_pal && !config.render) ? 143 : 120);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* borders are simulated (black) */
|
/* borders are simulated (black) */
|
||||||
xscale = 325 + ((reg[12] & 1)*2) - gc_pal;
|
xscale = 330 - gc_pal;
|
||||||
yscale = bitmap.viewport.h / 2;
|
yscale = bitmap.viewport.h / 2;
|
||||||
if (vdp_pal && (!gc_pal || config.render)) yscale = yscale * 240 / 288;
|
if (vdp_pal && (!gc_pal || config.render)) yscale = yscale * 240 / 288;
|
||||||
else if (!vdp_pal && gc_pal && !config.render) yscale = yscale * 288 / 240;
|
else if (!vdp_pal && gc_pal && !config.render) yscale = yscale * 288 / 240;
|
||||||
@ -478,7 +478,7 @@ static void gxResetScale(u32 width, u32 height)
|
|||||||
if (config.overscan)
|
if (config.overscan)
|
||||||
{
|
{
|
||||||
/* borders are emulated */
|
/* borders are emulated */
|
||||||
xscale = 352;
|
xscale = 348;
|
||||||
yscale = (gc_pal && !config.render) ? (vdp_pal ? (268*144 / bitmap.viewport.h):143) : (vdp_pal ? (224*144 / bitmap.viewport.h):120);
|
yscale = (gc_pal && !config.render) ? (vdp_pal ? (268*144 / bitmap.viewport.h):143) : (vdp_pal ? (224*144 / bitmap.viewport.h):120);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -503,7 +503,6 @@ static void gxResetScale(u32 width, u32 height)
|
|||||||
yshift *= 2;
|
yshift *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* GX scaler (by default, use EFB maximal width) */
|
/* GX scaler (by default, use EFB maximal width) */
|
||||||
rmode->fbWidth = 640;
|
rmode->fbWidth = 640;
|
||||||
if (!config.bilinear && !config.ntsc)
|
if (!config.bilinear && !config.ntsc)
|
||||||
@ -816,7 +815,7 @@ void gxResetAngle(f32 angle)
|
|||||||
GX_Flush();
|
GX_Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
void gxSetScreen ()
|
void gxSetScreen(void)
|
||||||
{
|
{
|
||||||
GX_CopyDisp(xfb[whichfb], GX_FALSE);
|
GX_CopyDisp(xfb[whichfb], GX_FALSE);
|
||||||
GX_Flush();
|
GX_Flush();
|
||||||
@ -825,7 +824,7 @@ void gxSetScreen ()
|
|||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void gxClearScreen (GXColor color)
|
void gxClearScreen(GXColor color)
|
||||||
{
|
{
|
||||||
whichfb ^= 1;
|
whichfb ^= 1;
|
||||||
GX_SetCopyClear(color,0x00ffffff);
|
GX_SetCopyClear(color,0x00ffffff);
|
||||||
@ -1233,7 +1232,7 @@ void gx_video_Stop(void)
|
|||||||
VIDEO_Configure(vmode);
|
VIDEO_Configure(vmode);
|
||||||
VIDEO_SetPreRetraceCallback(NULL);
|
VIDEO_SetPreRetraceCallback(NULL);
|
||||||
VIDEO_SetPostRetraceCallback(gx_input_UpdateMenu);
|
VIDEO_SetPostRetraceCallback(gx_input_UpdateMenu);
|
||||||
gxSetScreen ();
|
gxSetScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Menu mode -> Emulation mode */
|
/* Menu mode -> Emulation mode */
|
||||||
@ -1304,7 +1303,7 @@ void gx_video_Start(void)
|
|||||||
crosshair[1] = gxTextureOpenPNG(Crosshair_p2_png,0);
|
crosshair[1] = gxTextureOpenPNG(Crosshair_p2_png,0);
|
||||||
|
|
||||||
/* apply changes on next video update */
|
/* apply changes on next video update */
|
||||||
bitmap.viewport.changed = 1;
|
bitmap.viewport.changed |= 1;
|
||||||
|
|
||||||
/* reset GX rendering */
|
/* reset GX rendering */
|
||||||
gxResetRendering(0);
|
gxResetRendering(0);
|
||||||
@ -1314,7 +1313,7 @@ void gx_video_Start(void)
|
|||||||
void gx_video_Update(void)
|
void gx_video_Update(void)
|
||||||
{
|
{
|
||||||
/* check if display has changed */
|
/* check if display has changed */
|
||||||
if (bitmap.viewport.changed)
|
if (bitmap.viewport.changed & 1)
|
||||||
{
|
{
|
||||||
/* update texture size */
|
/* update texture size */
|
||||||
vwidth = bitmap.viewport.w + 2 * bitmap.viewport.x;
|
vwidth = bitmap.viewport.w + 2 * bitmap.viewport.x;
|
||||||
@ -1333,10 +1332,7 @@ void gx_video_Update(void)
|
|||||||
GX_InitTexObj(&texobj, texturemem, vwidth, vheight, GX_TF_RGB565, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
GX_InitTexObj(&texobj, texturemem, vwidth, vheight, GX_TF_RGB565, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||||
|
|
||||||
/* configure texture filtering */
|
/* configure texture filtering */
|
||||||
if (!config.bilinear)
|
if (!config.bilinear) GX_InitTexObjLOD(&texobj,GX_NEAR,GX_NEAR_MIP_NEAR,0.0,10.0,0.0,GX_FALSE,GX_FALSE,GX_ANISO_1);
|
||||||
{
|
|
||||||
GX_InitTexObjLOD(&texobj,GX_NEAR,GX_NEAR_MIP_NEAR,0.0,10.0,0.0,GX_FALSE,GX_FALSE,GX_ANISO_1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* load texture object */
|
/* load texture object */
|
||||||
GX_LoadTexObj(&texobj, GX_TEXMAP0);
|
GX_LoadTexObj(&texobj, GX_TEXMAP0);
|
||||||
@ -1370,9 +1366,9 @@ void gx_video_Update(void)
|
|||||||
whichfb ^= 1;
|
whichfb ^= 1;
|
||||||
|
|
||||||
/* reconfigure VI */
|
/* reconfigure VI */
|
||||||
if (bitmap.viewport.changed)
|
if (bitmap.viewport.changed & 1)
|
||||||
{
|
{
|
||||||
bitmap.viewport.changed = 0;
|
bitmap.viewport.changed &= 2;
|
||||||
|
|
||||||
/* change VI mode */
|
/* change VI mode */
|
||||||
VIDEO_Configure(rmode);
|
VIDEO_Configure(rmode);
|
||||||
@ -1508,7 +1504,19 @@ void gx_video_Init(void)
|
|||||||
/* Initialize textures */
|
/* Initialize textures */
|
||||||
texturemem = memalign(32, TEX_SIZE);
|
texturemem = memalign(32, TEX_SIZE);
|
||||||
screenshot = memalign(32, HASPECT*VASPECT*4);
|
screenshot = memalign(32, HASPECT*VASPECT*4);
|
||||||
if (!texturemem || !screenshot) gx_video_Shutdown();
|
if (!texturemem || !screenshot)
|
||||||
|
{
|
||||||
|
FONT_writeCenter("Failed to allocate textures memory... Rebooting",18,0,640,200,(GXColor)WHITE);
|
||||||
|
gxSetScreen();
|
||||||
|
sleep(2);
|
||||||
|
gx_video_Shutdown();
|
||||||
|
#ifdef HW_RVL
|
||||||
|
DI_Close();
|
||||||
|
SYS_ResetSystem(SYS_RESTART,0,0);
|
||||||
|
#else
|
||||||
|
SYS_ResetSystem(SYS_HOTRESET,0,0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gx_video_Shutdown(void)
|
void gx_video_Shutdown(void)
|
||||||
|
@ -54,8 +54,8 @@ extern void gxDrawTextureRepeat(gx_texture *texture, s32 x, s32 y, s32 w, s32 h,
|
|||||||
extern void gxDrawScreenshot(u8 alpha);
|
extern void gxDrawScreenshot(u8 alpha);
|
||||||
extern void gxCopyScreenshot(gx_texture *texture);
|
extern void gxCopyScreenshot(gx_texture *texture);
|
||||||
extern void gxResetAngle(f32 angle);
|
extern void gxResetAngle(f32 angle);
|
||||||
extern void gxClearScreen (GXColor color);
|
extern void gxClearScreen(GXColor color);
|
||||||
extern void gxSetScreen ();
|
extern void gxSetScreen(void);
|
||||||
|
|
||||||
/* PNG textures */
|
/* PNG textures */
|
||||||
extern gx_texture *gxTextureOpenPNG(const u8 *png_data, FILE *png_file);
|
extern gx_texture *gxTextureOpenPNG(const u8 *png_data, FILE *png_file);
|
||||||
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 4.7 KiB |
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
#include "gui.h"
|
||||||
#include "history.h"
|
#include "history.h"
|
||||||
#include "aram.h"
|
#include "aram.h"
|
||||||
#include "dvd.h"
|
#include "dvd.h"
|
||||||
@ -83,7 +84,9 @@ static void init_machine(void)
|
|||||||
cart_rom = memalign(32, MAXROMSIZE);
|
cart_rom = memalign(32, MAXROMSIZE);
|
||||||
if (!cart_rom)
|
if (!cart_rom)
|
||||||
{
|
{
|
||||||
WaitPrompt("Failed to allocate ROM buffer... Rebooting");
|
FONT_writeCenter("Failed to allocate ROM buffer... Rebooting",18,0,640,200,(GXColor)WHITE);
|
||||||
|
gxSetScreen();
|
||||||
|
sleep(2);
|
||||||
gx_audio_Shutdown();
|
gx_audio_Shutdown();
|
||||||
gx_video_Shutdown();
|
gx_video_Shutdown();
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
@ -134,7 +137,7 @@ void reloadrom (int size, char *name)
|
|||||||
void shutdown(void)
|
void shutdown(void)
|
||||||
{
|
{
|
||||||
/* system shutdown */
|
/* system shutdown */
|
||||||
memfile_autosave(-1,config.state_auto);
|
memfile_autosave(config.sram_auto,config.state_auto);
|
||||||
system_shutdown();
|
system_shutdown();
|
||||||
audio_shutdown();
|
audio_shutdown();
|
||||||
free(cart_rom);
|
free(cart_rom);
|
||||||
@ -160,9 +163,6 @@ int main (int argc, char *argv[])
|
|||||||
DI_Init();
|
DI_Init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32 RenderedFrames = 0;
|
|
||||||
uint32 TotalFrames = 0;
|
|
||||||
uint32 FramesPerSecond = 0;
|
|
||||||
|
|
||||||
/* initialize hardware */
|
/* initialize hardware */
|
||||||
gx_video_Init();
|
gx_video_Init();
|
||||||
@ -236,6 +236,9 @@ int main (int argc, char *argv[])
|
|||||||
ConfigRequested = 1;
|
ConfigRequested = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* initialize GUI engine */
|
||||||
|
GUI_Initialize();
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
/* Power button callback */
|
/* Power button callback */
|
||||||
SYS_SetPowerCallback(Power_Off);
|
SYS_SetPowerCallback(Power_Off);
|
||||||
@ -247,19 +250,25 @@ int main (int argc, char *argv[])
|
|||||||
/* Main Menu request */
|
/* Main Menu request */
|
||||||
if (ConfigRequested)
|
if (ConfigRequested)
|
||||||
{
|
{
|
||||||
/* stop audio & video */
|
/* stop video */
|
||||||
gx_video_Stop();
|
gx_video_Stop();
|
||||||
|
|
||||||
|
#ifdef HW_RVL
|
||||||
|
if (Shutdown)
|
||||||
|
{
|
||||||
|
GUI_FadeOut();
|
||||||
|
shutdown();
|
||||||
|
SYS_ResetSystem(SYS_POWEROFF, 0, 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* stop audio */
|
||||||
gx_audio_Stop();
|
gx_audio_Stop();
|
||||||
|
|
||||||
/* show menu */
|
/* show menu */
|
||||||
MainMenu ();
|
MainMenu ();
|
||||||
ConfigRequested = 0;
|
ConfigRequested = 0;
|
||||||
|
|
||||||
/* reset framecounts */
|
|
||||||
RenderedFrames = 0;
|
|
||||||
TotalFrames = 0;
|
|
||||||
FramesPerSecond = vdp_rate;
|
|
||||||
|
|
||||||
/* start audio & video */
|
/* start audio & video */
|
||||||
gx_video_Start();
|
gx_video_Start();
|
||||||
gx_audio_Start();
|
gx_audio_Start();
|
||||||
@ -289,16 +298,6 @@ int main (int argc, char *argv[])
|
|||||||
/* update video & audio */
|
/* update video & audio */
|
||||||
gx_video_Update();
|
gx_video_Update();
|
||||||
gx_audio_Update();
|
gx_audio_Update();
|
||||||
RenderedFrames++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* update framecounts */
|
|
||||||
TotalFrames++;
|
|
||||||
if (TotalFrames == vdp_rate)
|
|
||||||
{
|
|
||||||
FramesPerSecond = RenderedFrames;
|
|
||||||
RenderedFrames = 0;
|
|
||||||
TotalFrames = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,13 +298,24 @@ int system_frame (int do_skip)
|
|||||||
interlaced = (reg[12] & 2) >> 1;
|
interlaced = (reg[12] & 2) >> 1;
|
||||||
if (old_interlaced != interlaced)
|
if (old_interlaced != interlaced)
|
||||||
{
|
{
|
||||||
bitmap.viewport.changed = 2;
|
bitmap.viewport.changed |= 1;
|
||||||
im2_flag = ((reg[12] & 6) == 6);
|
im2_flag = ((reg[12] & 6) == 6);
|
||||||
odd_frame = 1;
|
odd_frame = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
odd_frame ^= 1;
|
odd_frame ^= 1;
|
||||||
|
|
||||||
|
#ifdef NGC
|
||||||
|
if (bitmap.viewport.changed & 2)
|
||||||
|
{
|
||||||
|
/* Update the width of the viewport */
|
||||||
|
bitmap.viewport.w = (reg[12] & 1) ? 320 : 256;
|
||||||
|
bitmap.viewport.changed = 1;
|
||||||
|
|
||||||
|
/* Update clipping */
|
||||||
|
window_clip(reg[12],reg[17]);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* clear VBLANK and DMA flags */
|
/* clear VBLANK and DMA flags */
|
||||||
status &= 0xFFF5;
|
status &= 0xFFF5;
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ void dos_update_input(void)
|
|||||||
hctab = (reg[12] & 1) ? cycle2hc40 : cycle2hc32;
|
hctab = (reg[12] & 1) ? cycle2hc40 : cycle2hc32;
|
||||||
|
|
||||||
/* reinitialize overscan area */
|
/* reinitialize overscan area */
|
||||||
bitmap.viewport.x = config.overscan ? ((reg[12] & 1) ? 16 : 12) : 0;
|
bitmap.viewport.x = config.overscan ? 14 : 0;
|
||||||
bitmap.viewport.y = config.overscan ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
|
bitmap.viewport.y = config.overscan ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
|
||||||
bitmap.viewport.changed = 1;
|
bitmap.viewport.changed = 1;
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ int main (int argc, char **argv)
|
|||||||
hctab = (reg[12] & 1) ? cycle2hc40 : cycle2hc32;
|
hctab = (reg[12] & 1) ? cycle2hc40 : cycle2hc32;
|
||||||
|
|
||||||
/* reinitialize overscan area */
|
/* reinitialize overscan area */
|
||||||
bitmap.viewport.x = config.overscan ? ((reg[12] & 1) ? 16 : 12) : 0;
|
bitmap.viewport.x = config.overscan ? 14 : 0;
|
||||||
bitmap.viewport.y = config.overscan ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
|
bitmap.viewport.y = config.overscan ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
|
||||||
bitmap.viewport.changed = 1;
|
bitmap.viewport.changed = 1;
|
||||||
}
|
}
|
||||||
@ -331,7 +331,7 @@ int main (int argc, char **argv)
|
|||||||
else if(sym == SDLK_F12)
|
else if(sym == SDLK_F12)
|
||||||
{
|
{
|
||||||
config.overscan ^= 1;
|
config.overscan ^= 1;
|
||||||
bitmap.viewport.x = config.overscan ? ((reg[12] & 1) ? 16 : 12) : 0;
|
bitmap.viewport.x = config.overscan ? 14 : 0;
|
||||||
bitmap.viewport.y = config.overscan ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
|
bitmap.viewport.y = config.overscan ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
|
||||||
bitmap.viewport.changed = 1;
|
bitmap.viewport.changed = 1;
|
||||||
}
|
}
|
||||||
|
17
source/vdp.c
@ -205,7 +205,7 @@ void vdp_reset(void)
|
|||||||
bitmap.viewport.ow = 224;
|
bitmap.viewport.ow = 224;
|
||||||
|
|
||||||
/* reset border area */
|
/* reset border area */
|
||||||
bitmap.viewport.x = config.overscan ? 12 : 0;
|
bitmap.viewport.x = config.overscan ? 14 : 0;
|
||||||
bitmap.viewport.y = config.overscan ? (vdp_pal ? 32 : 8) : 0;
|
bitmap.viewport.y = config.overscan ? (vdp_pal ? 32 : 8) : 0;
|
||||||
bitmap.viewport.changed = 1;
|
bitmap.viewport.changed = 1;
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ void vdp_restore(uint8 *vdp_regs)
|
|||||||
hctab = (reg[12] & 1) ? cycle2hc40 : cycle2hc32;
|
hctab = (reg[12] & 1) ? cycle2hc40 : cycle2hc32;
|
||||||
|
|
||||||
/* reinitialize overscan area */
|
/* reinitialize overscan area */
|
||||||
bitmap.viewport.x = config.overscan ? ((reg[12] & 1) ? 16 : 12) : 0;
|
bitmap.viewport.x = config.overscan ? 14 : 0;
|
||||||
bitmap.viewport.y = config.overscan ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
|
bitmap.viewport.y = config.overscan ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
|
||||||
bitmap.viewport.changed = 1;
|
bitmap.viewport.changed = 1;
|
||||||
|
|
||||||
@ -649,7 +649,7 @@ static inline void vdp_reg_w(unsigned int r, unsigned int d)
|
|||||||
/* Update the height of the viewport */
|
/* Update the height of the viewport */
|
||||||
bitmap.viewport.h = (d & 8) ? 240 : 224;
|
bitmap.viewport.h = (d & 8) ? 240 : 224;
|
||||||
if (config.overscan) bitmap.viewport.y = ((vdp_pal ? 288 : 240) - bitmap.viewport.h) / 2;
|
if (config.overscan) bitmap.viewport.y = ((vdp_pal ? 288 : 240) - bitmap.viewport.h) / 2;
|
||||||
bitmap.viewport.changed = 1;
|
bitmap.viewport.changed |= 1;
|
||||||
|
|
||||||
/* update VC table */
|
/* update VC table */
|
||||||
if (vdp_pal) vctab = (d & 8) ? vc_pal_240 : vc_pal_224;
|
if (vdp_pal) vctab = (d & 8) ? vc_pal_240 : vc_pal_224;
|
||||||
@ -712,16 +712,19 @@ static inline void vdp_reg_w(unsigned int r, unsigned int d)
|
|||||||
/* Check if the viewport width has actually been changed */
|
/* Check if the viewport width has actually been changed */
|
||||||
if((reg[0x0C] & 1) != (d & 1))
|
if((reg[0x0C] & 1) != (d & 1))
|
||||||
{
|
{
|
||||||
|
#ifndef NGC
|
||||||
/* Update the width of the viewport */
|
/* Update the width of the viewport */
|
||||||
bitmap.viewport.w = (d & 1) ? 320 : 256;
|
bitmap.viewport.w = (d & 1) ? 320 : 256;
|
||||||
if (config.overscan) bitmap.viewport.x = (d & 1) ? 16 : 12;
|
|
||||||
bitmap.viewport.changed = 1;
|
bitmap.viewport.changed = 1;
|
||||||
|
|
||||||
|
/* Update clipping */
|
||||||
|
window_clip(d,reg[17]);
|
||||||
|
#else
|
||||||
|
/* Postpound update on next frame */
|
||||||
|
bitmap.viewport.changed = 2;
|
||||||
|
#endif
|
||||||
/* update HC table */
|
/* update HC table */
|
||||||
hctab = (d & 1) ? cycle2hc40 : cycle2hc32;
|
hctab = (d & 1) ? cycle2hc40 : cycle2hc32;
|
||||||
|
|
||||||
/* update clipping */
|
|
||||||
window_clip(d,reg[17]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if the S/TE mode bit has changed */
|
/* See if the S/TE mode bit has changed */
|
||||||
|