mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-27 21:14:21 +01:00
-scrollable cheat menu
-housekeeping
This commit is contained in:
parent
30dc47b29d
commit
aff0dc6d17
@ -2,6 +2,7 @@
|
|||||||
* Snes9x 1.51
|
* Snes9x 1.51
|
||||||
*
|
*
|
||||||
* Nintendo Wii/Gamecube Port
|
* Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
* Tantric August 2008
|
* Tantric August 2008
|
||||||
*
|
*
|
||||||
* cheatmgr.cpp
|
* cheatmgr.cpp
|
||||||
@ -36,6 +37,8 @@ bool8 NGCLoadCheatFile (int length)
|
|||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
while (offset < length)
|
while (offset < length)
|
||||||
|
{
|
||||||
|
if(Cheat.num_cheats < MAX_CHEATS)
|
||||||
{
|
{
|
||||||
memcpy (data, savebuffer+offset, 28);
|
memcpy (data, savebuffer+offset, 28);
|
||||||
offset += 28;
|
offset += 28;
|
||||||
@ -48,6 +51,7 @@ bool8 NGCLoadCheatFile (int length)
|
|||||||
memmove (Cheat.c [Cheat.num_cheats].name, &data [8], 20);
|
memmove (Cheat.c [Cheat.num_cheats].name, &data [8], 20);
|
||||||
Cheat.c [Cheat.num_cheats++].name [20] = 0;
|
Cheat.c [Cheat.num_cheats++].name [20] = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
extern int offset;
|
extern int offset;
|
||||||
extern int selection;
|
extern int selection;
|
||||||
|
extern FILEENTRIES filelist[MAXFILES];
|
||||||
|
|
||||||
/** DVD I/O Address base **/
|
/** DVD I/O Address base **/
|
||||||
volatile unsigned long *dvd = (volatile unsigned long *) 0xCC006000;
|
volatile unsigned long *dvd = (volatile unsigned long *) 0xCC006000;
|
||||||
@ -107,9 +108,6 @@ static int IsJoliet = 0;
|
|||||||
u64 rootdir = 0;
|
u64 rootdir = 0;
|
||||||
int rootdirlength = 0;
|
int rootdirlength = 0;
|
||||||
|
|
||||||
/** Global file entry table **/
|
|
||||||
FILEENTRIES filelist[MAXFILES];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Primary Volume Descriptor
|
* Primary Volume Descriptor
|
||||||
*
|
*
|
||||||
|
@ -10,21 +10,8 @@
|
|||||||
#ifndef _NGCDVD_
|
#ifndef _NGCDVD_
|
||||||
#define _NGCDVD_
|
#define _NGCDVD_
|
||||||
|
|
||||||
#define MAXJOLIET 255
|
|
||||||
#define MAXDISPLAY 54
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
u64 offset;
|
|
||||||
unsigned int length;
|
|
||||||
char flags;
|
|
||||||
char filename[MAXJOLIET + 1];
|
|
||||||
char displayname[MAXDISPLAY + 1];
|
|
||||||
} FILEENTRIES;
|
|
||||||
|
|
||||||
extern u64 rootdir;
|
extern u64 rootdir;
|
||||||
extern int rootdirlength;
|
extern int rootdirlength;
|
||||||
#define MAXFILES 2000 /** Restrict to 2000 files per dir **/
|
|
||||||
extern FILEENTRIES filelist[MAXFILES];
|
|
||||||
|
|
||||||
int getpvd ();
|
int getpvd ();
|
||||||
int ParseDVDdirectory ();
|
int ParseDVDdirectory ();
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
* Snes9x 1.50
|
* Snes9x 1.50
|
||||||
*
|
*
|
||||||
* Nintendo Wii/Gamecube Port
|
* Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
* softdev July 2006
|
* softdev July 2006
|
||||||
* crunchy2 May 2007
|
* crunchy2 May 2007
|
||||||
* Tantric August 2008
|
* Tantric August 2008
|
||||||
@ -21,7 +22,6 @@
|
|||||||
#include "unzip.h"
|
#include "unzip.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "menudraw.h"
|
#include "menudraw.h"
|
||||||
#include "dvd.h"
|
|
||||||
#include "filesel.h"
|
#include "filesel.h"
|
||||||
#include "sram.h"
|
#include "sram.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Snes9x 1.50
|
* Snes9x 1.50
|
||||||
*
|
*
|
||||||
* Nintendo Gamecube Port
|
* Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
* softdev July 2006
|
* softdev July 2006
|
||||||
* crunchy2 May 2007
|
* crunchy2 May 2007
|
||||||
|
* Tantric August 2008
|
||||||
*
|
*
|
||||||
* fileop.h
|
* fileop.h
|
||||||
*
|
*
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
* Snes9x 1.50
|
* Snes9x 1.50
|
||||||
*
|
*
|
||||||
* Nintendo Wii/Gamecube Port
|
* Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
* softdev July 2006
|
* softdev July 2006
|
||||||
* svpe June 2007
|
* svpe June 2007
|
||||||
* crunchy2 May-July 2007
|
* crunchy2 May-July 2007
|
||||||
@ -36,11 +37,13 @@ int selection;
|
|||||||
char currentdir[MAXPATHLEN];
|
char currentdir[MAXPATHLEN];
|
||||||
int maxfiles;
|
int maxfiles;
|
||||||
extern int screenheight;
|
extern int screenheight;
|
||||||
#define PAGESIZE 17
|
|
||||||
extern unsigned long ARAM_ROMSIZE;
|
extern unsigned long ARAM_ROMSIZE;
|
||||||
int havedir = 0;
|
int havedir = 0;
|
||||||
int hasloaded = 0;
|
int hasloaded = 0;
|
||||||
|
|
||||||
|
// Global file entry table
|
||||||
|
FILEENTRIES filelist[MAXFILES];
|
||||||
|
|
||||||
unsigned char savebuffer[SAVEBUFFERSIZE] ATTRIBUTE_ALIGN (32);
|
unsigned char savebuffer[SAVEBUFFERSIZE] ATTRIBUTE_ALIGN (32);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -195,68 +198,6 @@ void StripExt(char* returnstring, char * inputstring)
|
|||||||
*loc_dot = '\0'; // strip file extension
|
*loc_dot = '\0'; // strip file extension
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Showfile screen
|
|
||||||
*
|
|
||||||
* Display the file selection to the user
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
static void
|
|
||||||
ShowFiles ()
|
|
||||||
{
|
|
||||||
int i, j;
|
|
||||||
char text[MAXPATHLEN];
|
|
||||||
int ypos;
|
|
||||||
int w;
|
|
||||||
|
|
||||||
clearscreen ();
|
|
||||||
|
|
||||||
setfontsize (28);
|
|
||||||
DrawText (-1, 60, (char*)"Choose Game");
|
|
||||||
|
|
||||||
setfontsize(18);
|
|
||||||
|
|
||||||
ypos = (screenheight - ((PAGESIZE - 1) * 20)) >> 1;
|
|
||||||
|
|
||||||
if (screenheight == 480)
|
|
||||||
ypos += 24;
|
|
||||||
else
|
|
||||||
ypos += 10;
|
|
||||||
|
|
||||||
j = 0;
|
|
||||||
for (i = offset; i < (offset + PAGESIZE) && (i < maxfiles); i++)
|
|
||||||
{
|
|
||||||
if (filelist[i].flags) // if a dir
|
|
||||||
{
|
|
||||||
strcpy (text, "[");
|
|
||||||
strcat (text, filelist[i].displayname);
|
|
||||||
strcat (text, "]");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// hide file extension on listing (.7z, .fig, .smc)
|
|
||||||
StripExt(text, filelist[i].displayname);
|
|
||||||
}
|
|
||||||
if (j == (selection - offset))
|
|
||||||
{
|
|
||||||
/*** Highlighted text entry ***/
|
|
||||||
for ( w = 0; w < 20; w++ )
|
|
||||||
DrawLineFast( 30, 610, ( j * 20 ) + (ypos-16) + w, 0x80, 0x80, 0x80 );
|
|
||||||
|
|
||||||
setfontcolour (0x00, 0x00, 0xe0);
|
|
||||||
DrawText (50, (j * 20) + ypos, text);
|
|
||||||
setfontcolour (0x00, 0x00, 0x00);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/*** Normal entry ***/
|
|
||||||
DrawText (50, (j * 20) + ypos, text);
|
|
||||||
}
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
showscreen ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* FileSelector
|
* FileSelector
|
||||||
*
|
*
|
||||||
@ -282,7 +223,7 @@ FileSelector (int method)
|
|||||||
while (haverom == 0)
|
while (haverom == 0)
|
||||||
{
|
{
|
||||||
if (redraw)
|
if (redraw)
|
||||||
ShowFiles ();
|
ShowFiles (filelist, maxfiles, offset, selection);
|
||||||
redraw = 0;
|
redraw = 0;
|
||||||
|
|
||||||
VIDEO_WaitVSync(); // slow things down a bit so we don't overread the pads
|
VIDEO_WaitVSync(); // slow things down a bit so we don't overread the pads
|
||||||
|
@ -1,21 +1,41 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Snes9x 1.50
|
* Snes9x 1.50
|
||||||
*
|
*
|
||||||
* Nintendo Gamecube Filesel - borrowed from GPP
|
* Nintendo Wii/Gamecube Port
|
||||||
*
|
*
|
||||||
* softdev July 2006
|
* softdev July 2006
|
||||||
* crunchy2 May 2007
|
* crunchy2 May 2007
|
||||||
|
* Tantric August 2008
|
||||||
|
*
|
||||||
|
* filesel.h
|
||||||
|
*
|
||||||
|
* Generic file routines - reading, writing, browsing
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef _NGCFILESEL_
|
#ifndef _NGCFILESEL_
|
||||||
#define _NGCFILESEL_
|
#define _NGCFILESEL_
|
||||||
|
|
||||||
#define SAVEBUFFERSIZE ((512 * 1024) + 2048 + 64 + 4 + 4)
|
#define SAVEBUFFERSIZE ((512 * 1024) + 2048 + 64 + 4 + 4)
|
||||||
|
#define MAXJOLIET 255
|
||||||
|
#define MAXDISPLAY 54
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
u64 offset;
|
||||||
|
unsigned int length;
|
||||||
|
char flags;
|
||||||
|
char filename[MAXJOLIET + 1];
|
||||||
|
char displayname[MAXDISPLAY + 1];
|
||||||
|
} FILEENTRIES;
|
||||||
|
|
||||||
|
#define MAXFILES 2000 // Restrict to 2000 files per dir
|
||||||
|
extern FILEENTRIES filelist[MAXFILES];
|
||||||
|
|
||||||
void ClearSaveBuffer ();
|
void ClearSaveBuffer ();
|
||||||
int OpenROM (int method);
|
int OpenROM (int method);
|
||||||
int autoLoadMethod();
|
int autoLoadMethod();
|
||||||
int autoSaveMethod();
|
int autoSaveMethod();
|
||||||
int FileSortCallback(const void *f1, const void *f2);
|
int FileSortCallback(const void *f1, const void *f2);
|
||||||
|
void StripExt(char* returnstring, char * inputstring);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,16 +1,21 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Snes9x 1.50 - GX 2.0
|
* Snes9x 1.50
|
||||||
*
|
*
|
||||||
* NGC Snapshots Memory File System
|
* Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* softdev July 2006
|
||||||
|
* crunchy2 May 2007-July 2007
|
||||||
|
* Tantric August 2008
|
||||||
|
*
|
||||||
|
* freeze.cpp
|
||||||
|
*
|
||||||
|
* Snapshots Memory File System
|
||||||
*
|
*
|
||||||
* This is a single global memory file controller. Don't even think of opening two
|
* This is a single global memory file controller. Don't even think of opening two
|
||||||
* at the same time !
|
* at the same time !
|
||||||
*
|
*
|
||||||
* There's just enough here to do SnapShots - you should add anything else you
|
* There's just enough here to do SnapShots - you should add anything else you
|
||||||
* need.
|
* need.
|
||||||
*
|
|
||||||
* softdev July 2006
|
|
||||||
* crunchy2 May 2007-July 2007
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <gccore.h>
|
#include <gccore.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -1,7 +1,15 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Snes9x 1.50 - GX 2.0
|
* Snes9x 1.50
|
||||||
*
|
*
|
||||||
* NGC Snapshots Memory File System
|
* Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* softdev July 2006
|
||||||
|
* crunchy2 May 2007-July 2007
|
||||||
|
* Tantric August 2008
|
||||||
|
*
|
||||||
|
* freeze.h
|
||||||
|
*
|
||||||
|
* Snapshots Memory File System
|
||||||
*
|
*
|
||||||
* This is a single global memory file controller. Don't even think of opening two
|
* This is a single global memory file controller. Don't even think of opening two
|
||||||
* at the same time !
|
* at the same time !
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Snes9x 1.50
|
* Snes9x 1.50
|
||||||
*
|
*
|
||||||
* Nintendo Gamecube Menu
|
* Nintendo Wii/Gamecube Port
|
||||||
*
|
*
|
||||||
* softdev July 2006
|
* softdev July 2006
|
||||||
* crunchy2 May-June 2007
|
* crunchy2 May-June 2007
|
||||||
|
* Tantric August 2008
|
||||||
|
*
|
||||||
|
* menu.cpp
|
||||||
|
*
|
||||||
|
* Menu flow routines
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <gccore.h>
|
#include <gccore.h>
|
||||||
#include <ogcsys.h>
|
#include <ogcsys.h>
|
||||||
@ -293,6 +298,9 @@ PreferencesMenu ()
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static int cheatmenuCount = 0;
|
static int cheatmenuCount = 0;
|
||||||
static char cheatmenu[MAX_CHEATS][50];
|
static char cheatmenu[MAX_CHEATS][50];
|
||||||
|
static char cheatmenuvalue[MAX_CHEATS][50];
|
||||||
|
|
||||||
|
#define PADCAL 40
|
||||||
|
|
||||||
void CheatMenu()
|
void CheatMenu()
|
||||||
{
|
{
|
||||||
@ -300,10 +308,26 @@ void CheatMenu()
|
|||||||
int oldmenu = menu;
|
int oldmenu = menu;
|
||||||
menu = 0;
|
menu = 0;
|
||||||
|
|
||||||
|
int selection = 0;
|
||||||
|
int offset = 0;
|
||||||
|
u32 p, wp, ph, wh;
|
||||||
|
signed char a, c;
|
||||||
|
int redraw = 1;
|
||||||
|
int selectit = 0;
|
||||||
|
float mag, mag2;
|
||||||
|
u16 ang, ang2;
|
||||||
|
int scroll_delay = 0;
|
||||||
|
bool move_selection = 0;
|
||||||
|
#define SCROLL_INITIAL_DELAY 15
|
||||||
|
#define SCROLL_LOOP_DELAY 2
|
||||||
|
|
||||||
if(Cheat.num_cheats > 0)
|
if(Cheat.num_cheats > 0)
|
||||||
{
|
{
|
||||||
cheatmenuCount = Cheat.num_cheats + 1;
|
cheatmenuCount = Cheat.num_cheats + 1;
|
||||||
|
|
||||||
|
for(uint16 i=0; i < Cheat.num_cheats; i++)
|
||||||
|
sprintf (cheatmenu[i], "%s", Cheat.c[i].name);
|
||||||
|
|
||||||
sprintf (cheatmenu[cheatmenuCount-1], "Back to Game Menu");
|
sprintf (cheatmenu[cheatmenuCount-1], "Back to Game Menu");
|
||||||
|
|
||||||
while(ret != cheatmenuCount-1)
|
while(ret != cheatmenuCount-1)
|
||||||
@ -314,17 +338,133 @@ void CheatMenu()
|
|||||||
S9xDisableCheat(ret);
|
S9xDisableCheat(ret);
|
||||||
else
|
else
|
||||||
S9xEnableCheat(ret);
|
S9xEnableCheat(ret);
|
||||||
|
|
||||||
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uint16 i=0; i < Cheat.num_cheats; i++)
|
for(uint16 i=0; i < Cheat.num_cheats; i++)
|
||||||
sprintf (cheatmenu[i], "%s %s", Cheat.c[i].name, Cheat.c[i].enabled == true ? " ON" : "OFF");
|
sprintf (cheatmenuvalue[i], "%s", Cheat.c[i].enabled == true ? "ON" : "OFF");
|
||||||
|
|
||||||
ret = RunMenu (cheatmenu, cheatmenuCount, (char*)"Cheats", 16);
|
if (redraw)
|
||||||
|
ShowCheats (cheatmenu, cheatmenuvalue, cheatmenuCount, offset, selection);
|
||||||
|
|
||||||
|
redraw = 0;
|
||||||
|
|
||||||
|
VIDEO_WaitVSync(); // slow things down a bit so we don't overread the pads
|
||||||
|
|
||||||
|
p = PAD_ButtonsDown (0);
|
||||||
|
ph = PAD_ButtonsHeld (0);
|
||||||
|
#ifdef HW_RVL
|
||||||
|
wp = WPAD_ButtonsDown (0);
|
||||||
|
wh = WPAD_ButtonsHeld (0);
|
||||||
|
wpad_get_analogues(0, &mag, &ang, &mag2, &ang2); // get joystick info from wii expansions
|
||||||
|
#else
|
||||||
|
wp = 0;
|
||||||
|
wh = 0;
|
||||||
|
ang = 0;
|
||||||
|
ang2 = 0;
|
||||||
|
mag = 0;
|
||||||
|
mag2 = 0;
|
||||||
|
#endif
|
||||||
|
a = PAD_StickY (0);
|
||||||
|
c = PAD_SubStickX (0);
|
||||||
|
|
||||||
|
/*** Check for exit combo ***/
|
||||||
|
if ( (c < -70) || (wp & WPAD_BUTTON_HOME) || (wp & WPAD_CLASSIC_BUTTON_HOME) )
|
||||||
|
break;
|
||||||
|
|
||||||
|
/*** Check buttons, perform actions ***/
|
||||||
|
if ( (p & PAD_BUTTON_A) || selectit || (wp & (WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A)) )
|
||||||
|
{
|
||||||
|
if ( selectit )
|
||||||
|
selectit = 0;
|
||||||
|
|
||||||
|
redraw = 1;
|
||||||
|
ret = selection;
|
||||||
|
} // End of A
|
||||||
|
|
||||||
|
if ( ((p | ph) & PAD_BUTTON_DOWN) || ((wp | wh) & (WPAD_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_DOWN)) || (a < -PADCAL) || (mag>JOY_THRESHOLD && (ang>130 && ang<230)) )
|
||||||
|
{
|
||||||
|
if ( (p & PAD_BUTTON_DOWN) || (wp & (WPAD_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_DOWN)) ) { /*** Button just pressed ***/
|
||||||
|
scroll_delay = SCROLL_INITIAL_DELAY; // reset scroll delay.
|
||||||
|
move_selection = 1; //continue (move selection)
|
||||||
|
}
|
||||||
|
else if (scroll_delay == 0) { /*** Button is held ***/
|
||||||
|
scroll_delay = SCROLL_LOOP_DELAY;
|
||||||
|
move_selection = 1; //continue (move selection)
|
||||||
|
} else {
|
||||||
|
scroll_delay--; // wait
|
||||||
|
}
|
||||||
|
|
||||||
|
if (move_selection)
|
||||||
|
{
|
||||||
|
selection++;
|
||||||
|
if (selection == cheatmenuCount)
|
||||||
|
selection = offset = 0;
|
||||||
|
if ((selection - offset) >= PAGESIZE)
|
||||||
|
offset += PAGESIZE;
|
||||||
|
redraw = 1;
|
||||||
|
move_selection = 0;
|
||||||
|
}
|
||||||
|
} // End of down
|
||||||
|
if ( ((p | ph) & PAD_BUTTON_UP) || ((wp | wh) & (WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_UP)) || (a > PADCAL) || (mag>JOY_THRESHOLD && (ang>300 || ang<50)) )
|
||||||
|
{
|
||||||
|
if ( (p & PAD_BUTTON_UP) || (wp & (WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_UP)) ) { /*** Button just pressed***/
|
||||||
|
scroll_delay = SCROLL_INITIAL_DELAY; // reset scroll delay.
|
||||||
|
move_selection = 1; //continue (move selection)
|
||||||
|
}
|
||||||
|
else if (scroll_delay == 0) { /*** Button is held ***/
|
||||||
|
scroll_delay = SCROLL_LOOP_DELAY;
|
||||||
|
move_selection = 1; //continue (move selection)
|
||||||
|
} else {
|
||||||
|
scroll_delay--; // wait
|
||||||
|
}
|
||||||
|
|
||||||
|
if (move_selection)
|
||||||
|
{
|
||||||
|
selection--;
|
||||||
|
if (selection < 0) {
|
||||||
|
selection = cheatmenuCount - 1;
|
||||||
|
offset = selection - PAGESIZE + 1;
|
||||||
|
}
|
||||||
|
if (selection < offset)
|
||||||
|
offset -= PAGESIZE;
|
||||||
|
if (offset < 0)
|
||||||
|
offset = 0;
|
||||||
|
redraw = 1;
|
||||||
|
move_selection = 0;
|
||||||
|
}
|
||||||
|
} // End of Up
|
||||||
|
if ( (p & PAD_BUTTON_LEFT) || (wp & (WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT)) )
|
||||||
|
{
|
||||||
|
/*** Go back a page ***/
|
||||||
|
selection -= PAGESIZE;
|
||||||
|
if (selection < 0)
|
||||||
|
{
|
||||||
|
selection = cheatmenuCount - 1;
|
||||||
|
offset = selection - PAGESIZE + 1;
|
||||||
|
}
|
||||||
|
if (selection < offset)
|
||||||
|
offset -= PAGESIZE;
|
||||||
|
if (offset < 0)
|
||||||
|
offset = 0;
|
||||||
|
redraw = 1;
|
||||||
|
}
|
||||||
|
if ( (p & PAD_BUTTON_RIGHT) || (wp & (WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT)) )
|
||||||
|
{
|
||||||
|
/*** Go forward a page ***/
|
||||||
|
selection += PAGESIZE;
|
||||||
|
if (selection > cheatmenuCount - 1)
|
||||||
|
selection = offset = 0;
|
||||||
|
if ((selection - offset) >= PAGESIZE)
|
||||||
|
offset += PAGESIZE;
|
||||||
|
redraw = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WaitPrompt((char*)"Cheat file not found!");
|
WaitPrompt((char*)"No cheats found!");
|
||||||
}
|
}
|
||||||
menu = oldmenu;
|
menu = oldmenu;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Snes9x 1.50
|
* Snes9x 1.50
|
||||||
*
|
*
|
||||||
* Nintendo Gamecube Menu
|
* Nintendo Wii/Gamecube Port
|
||||||
*
|
*
|
||||||
* softdev July 2006
|
* softdev July 2006
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Snes9x 1.50
|
* Snes9x 1.50
|
||||||
*
|
*
|
||||||
* Nintendo Gamecube Screen Font Driver
|
* Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* softdev July 2006
|
||||||
|
* crunchy2 June 2007
|
||||||
|
* Tantric August 2008
|
||||||
|
*
|
||||||
|
* menudraw.cpp
|
||||||
|
*
|
||||||
|
* Menu drawing routines
|
||||||
*
|
*
|
||||||
* Uses libfreetype 2.2.1 compiled for GC with TTF support only.
|
* Uses libfreetype 2.2.1 compiled for GC with TTF support only.
|
||||||
* TTF only reduces the library by some 900k bytes!
|
* TTF only reduces the library by some 900k bytes!
|
||||||
*
|
*
|
||||||
* Visit - http://www.freetype.org !
|
|
||||||
*
|
|
||||||
* **WARNING***
|
* **WARNING***
|
||||||
*
|
*
|
||||||
* ONLY USE GUARANTEED PATENT FREE FONTS.
|
* ONLY USE GUARANTEED PATENT FREE FONTS.
|
||||||
* THOSE IN YOUR WINDOWS\FONTS DIRECTORY ARE COPYRIGHT
|
|
||||||
* AND MAY NOT BE DISTRIBUTED!
|
|
||||||
*
|
|
||||||
* softdev July 2006
|
|
||||||
* crunchy2 June 2007
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <gccore.h>
|
#include <gccore.h>
|
||||||
#include <ogcsys.h>
|
#include <ogcsys.h>
|
||||||
@ -33,6 +34,8 @@
|
|||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "menudraw.h"
|
#include "menudraw.h"
|
||||||
#include "snes9xGX.h"
|
#include "snes9xGX.h"
|
||||||
|
#include "filesel.h"
|
||||||
|
#include "dvd.h"
|
||||||
#include "aram.h"
|
#include "aram.h"
|
||||||
#include "images/gfx_bg.h"
|
#include "images/gfx_bg.h"
|
||||||
|
|
||||||
@ -627,6 +630,116 @@ RunMenu (char items[][50], int maxitems, char *title, int fontsize, int x)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Showfile screen
|
||||||
|
*
|
||||||
|
* Display the file selection to the user
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
ShowFiles (FILEENTRIES filelist[], int maxfiles, int offset, int selection)
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
char text[MAXPATHLEN];
|
||||||
|
int ypos;
|
||||||
|
int w;
|
||||||
|
|
||||||
|
clearscreen ();
|
||||||
|
|
||||||
|
setfontsize (28);
|
||||||
|
DrawText (-1, 60, (char*)"Choose Game");
|
||||||
|
|
||||||
|
setfontsize(18);
|
||||||
|
|
||||||
|
ypos = (screenheight - ((PAGESIZE - 1) * 20)) >> 1;
|
||||||
|
|
||||||
|
if (screenheight == 480)
|
||||||
|
ypos += 24;
|
||||||
|
else
|
||||||
|
ypos += 10;
|
||||||
|
|
||||||
|
j = 0;
|
||||||
|
for (i = offset; i < (offset + PAGESIZE) && (i < maxfiles); i++)
|
||||||
|
{
|
||||||
|
if (filelist[i].flags) // if a dir
|
||||||
|
{
|
||||||
|
strcpy (text, "[");
|
||||||
|
strcat (text, filelist[i].displayname);
|
||||||
|
strcat (text, "]");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// hide file extension on listing (.7z, .fig, .smc)
|
||||||
|
StripExt(text, filelist[i].displayname);
|
||||||
|
}
|
||||||
|
if (j == (selection - offset))
|
||||||
|
{
|
||||||
|
/*** Highlighted text entry ***/
|
||||||
|
for ( w = 0; w < 20; w++ )
|
||||||
|
DrawLineFast( 30, 610, ( j * 20 ) + (ypos-16) + w, 0x80, 0x80, 0x80 );
|
||||||
|
|
||||||
|
setfontcolour (0x00, 0x00, 0xe0);
|
||||||
|
DrawText (50, (j * 20) + ypos, text);
|
||||||
|
setfontcolour (0x00, 0x00, 0x00);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*** Normal entry ***/
|
||||||
|
DrawText (50, (j * 20) + ypos, text);
|
||||||
|
}
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
showscreen ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Cheats screen
|
||||||
|
*
|
||||||
|
* Displays a scrollable list of cheats to the user
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
ShowCheats (char items[][50], char itemvalues[][50], int maxitems, int offset, int selection)
|
||||||
|
{
|
||||||
|
int i, j = 0;
|
||||||
|
int ypos;
|
||||||
|
int w;
|
||||||
|
|
||||||
|
clearscreen ();
|
||||||
|
|
||||||
|
setfontsize (28);
|
||||||
|
DrawText (-1, 60, (char*)"Cheats");
|
||||||
|
|
||||||
|
setfontsize(18);
|
||||||
|
|
||||||
|
ypos = (screenheight - ((PAGESIZE - 1) * 20)) >> 1;
|
||||||
|
|
||||||
|
if (screenheight == 480)
|
||||||
|
ypos += 24;
|
||||||
|
else
|
||||||
|
ypos += 10;
|
||||||
|
|
||||||
|
for (i = offset; i < (offset + PAGESIZE) && (i < maxitems); i++)
|
||||||
|
{
|
||||||
|
if (i == selection)
|
||||||
|
{
|
||||||
|
/*** Highlighted text entry ***/
|
||||||
|
for ( w = 0; w < 20; w++ )
|
||||||
|
DrawLineFast( 30, 610, ( j * 20 ) + (ypos-16) + w, 0x80, 0x80, 0x80 );
|
||||||
|
|
||||||
|
DrawText (150, (j * 20) + ypos, items[i]);
|
||||||
|
DrawText (400, (j * 20) + ypos, itemvalues[i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*** Normal entry ***/
|
||||||
|
DrawText (150, (j * 20) + ypos, items[i]);
|
||||||
|
DrawText (400, (j * 20) + ypos, itemvalues[i]);
|
||||||
|
}
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
showscreen ();
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* ROM Information Screen
|
* ROM Information Screen
|
||||||
|
@ -1,24 +1,29 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Snes9x 1.50
|
* Snes9x 1.50
|
||||||
*
|
*
|
||||||
* Nintendo Gamecube Screen Font Driver
|
* Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* softdev July 2006
|
||||||
|
* crunchy2 June 2007
|
||||||
|
* Tantric August 2008
|
||||||
|
*
|
||||||
|
* menudraw.h
|
||||||
|
*
|
||||||
|
* Menu drawing routines
|
||||||
*
|
*
|
||||||
* Uses libfreetype 2.2.1 compiled for GC with TTF support only.
|
* Uses libfreetype 2.2.1 compiled for GC with TTF support only.
|
||||||
* TTF only reduces the library by some 900kbytes!
|
* TTF only reduces the library by some 900k bytes!
|
||||||
*
|
|
||||||
* Visit - http://www.freetype.org !
|
|
||||||
*
|
*
|
||||||
* **WARNING***
|
* **WARNING***
|
||||||
*
|
*
|
||||||
* ONLY USE GUARANTEED PATENT FREE FONTS.
|
* ONLY USE GUARANTEED PATENT FREE FONTS.
|
||||||
* THOSE IN YOUR WINDOWS\FONTS DIRECTORY ARE COPYRIGHT
|
|
||||||
* AND MAY NOT BE DISTRIBUTED!
|
|
||||||
*
|
|
||||||
* softdev July 2006
|
|
||||||
* crunchy2 June 2007
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifndef _TTFFONTS_
|
#ifndef _NGCMENUDRAW_
|
||||||
#define _TTFFONTS_
|
#define _NGCMENUDRAW_
|
||||||
|
|
||||||
|
#include "filesel.h"
|
||||||
|
|
||||||
|
#define PAGESIZE 17 // max item listing on a screen
|
||||||
|
|
||||||
int FT_Init ();
|
int FT_Init ();
|
||||||
void setfontsize (int pixelsize);
|
void setfontsize (int pixelsize);
|
||||||
@ -30,6 +35,9 @@ void RomInfo ();
|
|||||||
void WaitButtonA ();
|
void WaitButtonA ();
|
||||||
int RunMenu (char items[][50], int maxitems, char *title, int fontsize = 20, int x = -1);
|
int RunMenu (char items[][50], int maxitems, char *title, int fontsize = 20, int x = -1);
|
||||||
void DrawMenu (char items[][50], char *title, int maxitems, int selected, int fontsize = 20, int x = -1);
|
void DrawMenu (char items[][50], char *title, int maxitems, int selected, int fontsize = 20, int x = -1);
|
||||||
|
void ShowCheats (char items[][50], char itemvalues[][50], int maxitems, int offset, int selection);
|
||||||
|
void ShowFiles (FILEENTRIES filelist[], int maxfiles, int offset, int selection);
|
||||||
|
|
||||||
void WaitPrompt (char *msg);
|
void WaitPrompt (char *msg);
|
||||||
int WaitPromptChoice (char *msg, char* bmsg, char* amsg);
|
int WaitPromptChoice (char *msg, char* bmsg, char* amsg);
|
||||||
void ShowAction (char *msg);
|
void ShowAction (char *msg);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
* Snes9x 1.50
|
* Snes9x 1.50
|
||||||
*
|
*
|
||||||
* Nintendo Wii/Gamecube Port
|
* Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
* softdev July 2006
|
* softdev July 2006
|
||||||
* crunchy2 May 2007
|
* crunchy2 May 2007
|
||||||
* Tantric August 2008
|
* Tantric August 2008
|
||||||
@ -24,7 +25,6 @@
|
|||||||
#include "unzip.h"
|
#include "unzip.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "menudraw.h"
|
#include "menudraw.h"
|
||||||
#include "dvd.h"
|
|
||||||
#include "filesel.h"
|
#include "filesel.h"
|
||||||
#include "smbop.h"
|
#include "smbop.h"
|
||||||
#include "Snes9xGx.h"
|
#include "Snes9xGx.h"
|
||||||
@ -234,7 +234,7 @@ LoadSMBFile (char *filename, int length)
|
|||||||
{
|
{
|
||||||
//return UnZipBuffer(rbuffer, 0, 2, NULL);
|
//return UnZipBuffer(rbuffer, 0, 2, NULL);
|
||||||
// UNZIP currently crashes - FIX ME
|
// UNZIP currently crashes - FIX ME
|
||||||
WaitPrompt((char*) "Zipped files are currently not supported!");
|
WaitPrompt((char*) "Zipped files are currently not supported over SMB!");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -287,8 +287,10 @@ SaveBufferToSMB (char *filepath, int datasize, bool8 silent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Load savebuffer from SMB file
|
* Load up a buffer from SMB file
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
// no buffer is specified - so use savebuffer
|
||||||
int
|
int
|
||||||
LoadBufferFromSMB (char *filepath, bool8 silent)
|
LoadBufferFromSMB (char *filepath, bool8 silent)
|
||||||
{
|
{
|
||||||
|
@ -85,7 +85,7 @@ UnZipBuffer (unsigned char *outbuffer, u64 inoffset, short where, FILE* filehand
|
|||||||
int res;
|
int res;
|
||||||
int bufferoffset = 0;
|
int bufferoffset = 0;
|
||||||
int have = 0;
|
int have = 0;
|
||||||
char readbuffer[2048];
|
char readbuffer[ZIPCHUNK];
|
||||||
char msg[128];
|
char msg[128];
|
||||||
|
|
||||||
/*** Read Zip Header ***/
|
/*** Read Zip Header ***/
|
||||||
@ -93,15 +93,15 @@ UnZipBuffer (unsigned char *outbuffer, u64 inoffset, short where, FILE* filehand
|
|||||||
{
|
{
|
||||||
case 0: // SD Card
|
case 0: // SD Card
|
||||||
fseek(filehandle, 0, SEEK_SET);
|
fseek(filehandle, 0, SEEK_SET);
|
||||||
fread (readbuffer, 1, 2048, filehandle);
|
fread (readbuffer, 1, ZIPCHUNK, filehandle);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // DVD
|
case 1: // DVD
|
||||||
dvd_read (readbuffer, 2048, inoffset);
|
dvd_read (readbuffer, ZIPCHUNK, inoffset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // From buffer
|
case 2: // From buffer
|
||||||
memcpy(readbuffer, outbuffer, 2048);
|
memcpy(readbuffer, outbuffer, ZIPCHUNK);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,17 +169,17 @@ UnZipBuffer (unsigned char *outbuffer, u64 inoffset, short where, FILE* filehand
|
|||||||
switch (where)
|
switch (where)
|
||||||
{
|
{
|
||||||
case 0: // SD Card
|
case 0: // SD Card
|
||||||
fread (readbuffer, 1, 2048, filehandle);
|
fread (readbuffer, 1, ZIPCHUNK, filehandle);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // DVD
|
case 1: // DVD
|
||||||
inoffset += 2048;
|
inoffset += ZIPCHUNK;
|
||||||
dvd_read (readbuffer, 2048, inoffset);
|
dvd_read (readbuffer, ZIPCHUNK, inoffset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // From buffer
|
case 2: // From buffer
|
||||||
inoffset += 2048;
|
inoffset += ZIPCHUNK;
|
||||||
memcpy(readbuffer, outbuffer+inoffset, 2048);
|
memcpy(readbuffer, outbuffer+inoffset, ZIPCHUNK);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user