mirror of
https://github.com/dborth/fceugx.git
synced 2024-10-31 22:45:05 +01:00
start wiisd support, reads the ROMs (no zip/7z), fix Wii mode reboot/reload, started 7z support on SD Gecko
This commit is contained in:
parent
759b9ac159
commit
1f4f8e07af
@ -160,4 +160,5 @@ tags:
|
||||
/opt/devkitpro/libogc/include/sdcard/*.h \
|
||||
/opt/devkitpro/libjpeg/include/jpeg/*.h \
|
||||
/opt/devkitpro/libfreetype/include/*.h \
|
||||
/opt/devkitpro/libfreetype/include/freetype/*.h )
|
||||
/opt/devkitpro/libfreetype/include/freetype/*.h )
|
||||
|
||||
|
24
Makefile.wii
24
Makefile.wii
@ -21,9 +21,9 @@ BUILD := build
|
||||
SOURCES := source source/boards source/mappers source/input \
|
||||
source/mbshare source/drivers/common \
|
||||
source/drivers/gamecube source/roms \
|
||||
source/iplfont source/sz
|
||||
source/iplfont source/sz source/drivers/gamecube/wiisd
|
||||
DATA := data
|
||||
INCLUDES := source/sz
|
||||
INCLUDES := source/sz source/drivers/gamecube/wiisd
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
@ -144,3 +144,23 @@ $(OUTPUT).elf: $(OFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
tags:
|
||||
@( cd source; ctags *.c *.h \
|
||||
boards/*.c boards/*.h \
|
||||
mappers/*.c mappers/*.h \
|
||||
input/*.c input/*.h \
|
||||
mbshare/*.c mbshare/*.h \
|
||||
drivers/common/*.c drivers/common/*.h \
|
||||
drivers/gamecube/*.c drivers/gamecube/*.h \
|
||||
drivers/gamecube/wiisd/*.h drivers/gamecube/wiisd/*.c \
|
||||
iplfont/*.c iplfont/*.h \
|
||||
sz/*.c sz/*.h \
|
||||
/opt/devkitpro/libogc/include/*.h \
|
||||
/opt/devkitpro/libogc/include/mad/*.h \
|
||||
/opt/devkitpro/libogc/include/ogc/*.h \
|
||||
/opt/devkitpro/libogc/include/modplay/*.h \
|
||||
/opt/devkitpro/libogc/include/sdcard/*.h \
|
||||
/opt/devkitpro/libjpeg/include/jpeg/*.h \
|
||||
/opt/devkitpro/libfreetype/include/*.h \
|
||||
/opt/devkitpro/libfreetype/include/freetype/*.h )
|
||||
|
||||
|
@ -16,6 +16,9 @@
|
||||
#include "sz.h"
|
||||
#include "gcdvd.h"
|
||||
|
||||
#include "wiisd/sdio.h"
|
||||
#include "wiisd/tff.h"
|
||||
|
||||
/*** Simplified Directory Entry Record
|
||||
I only care about a couple of values ***/
|
||||
#define RECLEN 0
|
||||
@ -27,9 +30,17 @@
|
||||
|
||||
#define PAGESIZE 10
|
||||
|
||||
#define FCEUDIR "fceu"
|
||||
#define SAVEDIR "saves"
|
||||
#define ROMSDIR "roms"
|
||||
|
||||
/*Front SCARD*/
|
||||
FATFS frontfs;
|
||||
FILINFO finfo;
|
||||
|
||||
FILEENTRIES filelist[MAXFILES];
|
||||
int maxfiles = 0;
|
||||
u64 offset = 0;
|
||||
int offset = 0;
|
||||
int selection = 0;
|
||||
|
||||
/*** DVD Read Buffer ***/
|
||||
@ -44,7 +55,7 @@ extern unsigned char *nesromptr;
|
||||
extern int IsXenoGCImage( char *buffer );
|
||||
|
||||
void GetSDInfo ();
|
||||
extern int choosenSDSlot;
|
||||
extern int ChosenSlot;
|
||||
/*extern void ClearScreen();
|
||||
int LoadDVDFile( unsigned char *buffer );
|
||||
extern int unzipDVDFile( unsigned char *outbuffer, unsigned int discoffset, unsigned int length);
|
||||
@ -54,9 +65,12 @@ extern int choosenSDSlot;
|
||||
extern bool isWii;
|
||||
|
||||
int UseSDCARD = 0;
|
||||
sd_file * filehandle;
|
||||
int UseFrontSDCARD = 0;
|
||||
sd_file * filehandle = NULL;
|
||||
char rootSDdir[SDCARD_MAX_PATH_LEN];
|
||||
char rootWiiSDdir[SDCARD_MAX_PATH_LEN];
|
||||
int haveSDdir = 0;
|
||||
int haveWiiSDdir = 0;
|
||||
int sdslot = 0;
|
||||
|
||||
/****************************************************************************
|
||||
@ -436,7 +450,7 @@ int updateSDdirname()
|
||||
rootSDdir[size] = 0;
|
||||
|
||||
/* handles root name */
|
||||
//sprintf(tmpCompare, "dev%d:",choosenSDSlot);
|
||||
//sprintf(tmpCompare, "dev%d:",ChosenSlot);
|
||||
if (strcmp(rootSDdir, sdslot ? "dev1:":"dev0:") == 0)sprintf(rootSDdir,"dev%d:\\fceu\\..", sdslot);
|
||||
|
||||
return 1;
|
||||
@ -447,8 +461,8 @@ int updateSDdirname()
|
||||
if ((strlen(rootSDdir)+1+strlen(filelist[selection].filename)) < SDCARD_MAX_PATH_LEN)
|
||||
{
|
||||
/* handles root name */
|
||||
//sprintf(tmpCompare, "dev%d:\\fceu\\..",choosenSDSlot);
|
||||
//if (strcmp(rootSDdir, tmpCompare) == 0) sprintf(rootSDdir,"dev%d:",choosenSDSlot);
|
||||
//sprintf(tmpCompare, "dev%d:\\fceu\\..",ChosenSlot);
|
||||
//if (strcmp(rootSDdir, tmpCompare) == 0) sprintf(rootSDdir,"dev%d:",ChosenSlot);
|
||||
if (strcmp(rootSDdir, sdslot ? "dev1:\\fceu\\.." : "dev0:\\fceu\\..") == 0) sprintf(rootSDdir,"dev%d:",sdslot);
|
||||
|
||||
/* update current directory name */
|
||||
@ -466,9 +480,7 @@ int updateSDdirname()
|
||||
/***************************************************************************
|
||||
* Browse SDCARD subdirectories
|
||||
***************************************************************************/
|
||||
|
||||
int parseSDdirectory()
|
||||
{
|
||||
int parseSDdirectory() {
|
||||
int entries = 0;
|
||||
int nbfiles = 0;
|
||||
int numstored = 0;
|
||||
@ -502,37 +514,100 @@ int parseSDdirectory()
|
||||
|
||||
return nbfiles;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Browse WiiSD subdirectories
|
||||
***************************************************************************/
|
||||
#ifdef HW_RVL
|
||||
int parseWiiSDdirectory() {
|
||||
int entries = 0;
|
||||
int nbfiles = 0;
|
||||
int numstored = 0;
|
||||
DIRECTORY sddir;
|
||||
s32 result;
|
||||
char msg[1024];
|
||||
|
||||
/* initialize selection */
|
||||
selection = offset = 0;
|
||||
|
||||
/* Get a list of files from the actual root directory */
|
||||
result = f_opendir(&sddir, rootWiiSDdir);
|
||||
if(result != FR_OK) {
|
||||
sprintf(msg, "f_opendir(%s) failed with %d.", rootWiiSDdir, result);
|
||||
WaitPrompt(msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&finfo, 0, sizeof(finfo));
|
||||
|
||||
// f_readdir doesn't seem to find ".." dir, manually add it.
|
||||
if (strlen(rootWiiSDdir) > 0) {
|
||||
strcpy(filelist[numstored].filename, "..");
|
||||
filelist[numstored].length = 0;
|
||||
filelist[numstored].flags = 1;
|
||||
numstored++;
|
||||
}
|
||||
f_readdir(&sddir, &finfo);
|
||||
finfo.fname[12] = 0;
|
||||
while(strlen(finfo.fname) != 0) {
|
||||
finfo.fname[12] = 0;
|
||||
//if(!(finfo.fattrib & AM_DIR))
|
||||
//{
|
||||
if (strcmp((const char*)finfo.fname, ".") != 0) { // Skip "." directory
|
||||
sprintf(msg, "Adding %s", finfo.fname);
|
||||
//ShowAction(msg);
|
||||
memset(&filelist[numstored], 0, sizeof (FILEENTRIES));
|
||||
strncpy(filelist[numstored].filename,(const char*)finfo.fname,MAXJOLIET);
|
||||
filelist[numstored].filename[MAXJOLIET-1] = 0;
|
||||
filelist[numstored].length = finfo.fsize;
|
||||
filelist[numstored].flags = (char)(finfo.fattrib & AM_DIR);
|
||||
numstored++;
|
||||
}
|
||||
nbfiles++;
|
||||
//}
|
||||
memset(&finfo, 0, sizeof(finfo));
|
||||
f_readdir(&sddir, &finfo);
|
||||
}
|
||||
entries = nbfiles;
|
||||
if (entries < 0) entries = 0;
|
||||
if (entries > MAXFILES) entries = MAXFILES;
|
||||
|
||||
return numstored;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* ShowFiles
|
||||
*
|
||||
* Support function for FileSelector
|
||||
****************************************************************************/
|
||||
|
||||
void ShowFiles( int offset, int selection )
|
||||
{
|
||||
void ShowFiles( int offset, int selection ) {
|
||||
int i,j;
|
||||
char text[45];
|
||||
char text[80];
|
||||
|
||||
ClearScreen();
|
||||
|
||||
j = 0;
|
||||
for ( i = offset; i < ( offset + PAGESIZE ) && ( i < maxfiles ); i++ )
|
||||
{
|
||||
for ( i = offset; i < ( offset + PAGESIZE ) && ( i < maxfiles ); i++ ) {
|
||||
if ( filelist[i].flags ) {
|
||||
strcpy(text,"[");
|
||||
strncat(text, filelist[i].filename,43);
|
||||
strncat(text, filelist[i].filename, 78);
|
||||
strcat(text,"]");
|
||||
} else
|
||||
strncpy(text, filelist[i].filename, 45);
|
||||
strncpy(text, filelist[i].filename, 80);
|
||||
text[80]=0;
|
||||
|
||||
text[45]=0;
|
||||
char dir[1024];
|
||||
if (UseSDCARD)
|
||||
strcpy(dir, rootSDdir);
|
||||
else if (UseFrontSDCARD)
|
||||
strcpy(dir, rootWiiSDdir);
|
||||
else
|
||||
dir[0] = 0;
|
||||
|
||||
/*if ( j == ( selection - offset ) )
|
||||
writex( CentreTextPosition(text), ( j * font_height ) + 117,
|
||||
GetTextWidth(text), font_height, text, blit_lookup_inv );
|
||||
else
|
||||
writex( CentreTextPosition(text), ( j * font_height ) + 117,
|
||||
GetTextWidth(text), font_height, text, blit_lookup );*/
|
||||
writex(CentreTextPosition(dir), 32, GetTextWidth(dir), font_height, dir, 0);
|
||||
while (GetTextWidth(text) > 620)
|
||||
text[strlen(text)-2] = 0;
|
||||
|
||||
writex( CentreTextPosition(text), ( j * font_height ) + 130, GetTextWidth(text), font_height, text, j == ( selection - offset ) );
|
||||
|
||||
@ -540,7 +615,6 @@ void ShowFiles( int offset, int selection )
|
||||
}
|
||||
|
||||
SetScreen();
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -549,7 +623,6 @@ void ShowFiles( int offset, int selection )
|
||||
* Let user select another ROM to load
|
||||
****************************************************************************/
|
||||
bool inSz = false;
|
||||
//#define PADCAL 70
|
||||
extern int PADCAL;
|
||||
|
||||
void FileSelector() {
|
||||
@ -638,6 +711,7 @@ void FileSelector() {
|
||||
SzClose();
|
||||
} else if (inSz == false && SzDvdIsArchive(filelist[selection].offset) == SZ_OK) {
|
||||
// parse the 7zip file
|
||||
WaitPrompt("Found 7z");
|
||||
SzParse();
|
||||
if(SzRes == SZ_OK) {
|
||||
inSz = true;
|
||||
@ -658,6 +732,14 @@ void FileSelector() {
|
||||
maxfiles = parsedir();
|
||||
}
|
||||
} else {
|
||||
if (UseFrontSDCARD) {
|
||||
strncpy(finfo.fname, filelist[selection].filename, 12);
|
||||
int l = strlen(finfo.fname);
|
||||
if (l > 12) l = 12;
|
||||
finfo.fname[l] = 0;
|
||||
finfo.fsize = filelist[selection].length;
|
||||
finfo.fattrib = filelist[selection].flags ? AM_DIR : 0;
|
||||
}
|
||||
rootdir = filelist[selection].offset;
|
||||
rootdirlength = filelist[selection].length;
|
||||
// Now load the DVD file to it's offset
|
||||
@ -672,13 +754,77 @@ void FileSelector() {
|
||||
/****************************************************************************
|
||||
* LoadDVDFile
|
||||
****************************************************************************/
|
||||
int LoadDVDFile( unsigned char *buffer )
|
||||
{
|
||||
int LoadDVDFile( unsigned char *buffer ) {
|
||||
u64 offset;
|
||||
int blocks;
|
||||
int i;
|
||||
u64 discoffset;
|
||||
|
||||
#ifdef HW_RVL
|
||||
FIL fp;
|
||||
WORD bytes_read;
|
||||
u32 bytes_read_total;
|
||||
|
||||
if(UseFrontSDCARD) {
|
||||
WaitPrompt("WiiSD Read");
|
||||
ShowAction((char*)"Loading ... Wait");
|
||||
char filename[1024];
|
||||
sprintf(filename, "%s/%s", rootWiiSDdir, finfo.fname);
|
||||
|
||||
/*if(f_mount(0, &frontfs) != FR_OK) {
|
||||
WaitPrompt("f_mount failed");
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
int res = f_stat(filename, &finfo);
|
||||
if(res != FR_OK) {
|
||||
char msg[1024];
|
||||
sprintf(msg, "f_stat %s failed, error %d", filename, res);
|
||||
WaitPrompt(msg);
|
||||
//f_mount(0, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
res = f_open(&fp, filename, FA_READ);
|
||||
if (res != FR_OK) {
|
||||
char msg[1024];
|
||||
sprintf(msg, "f_open failed, error %d", res);
|
||||
WaitPrompt(msg);
|
||||
//f_mount(0, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//printf("Reading %u bytes\n", (unsigned int)finfo.fsize);
|
||||
bytes_read = bytes_read_total = 0;
|
||||
while(bytes_read_total < finfo.fsize) {
|
||||
if(f_read(&fp, buffer + bytes_read_total, 0x200, &bytes_read) != FR_OK) {
|
||||
WaitPrompt((char*)"f_read failed");
|
||||
f_close(&fp);
|
||||
//f_mount(0, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(bytes_read == 0)
|
||||
break;
|
||||
bytes_read_total += bytes_read;
|
||||
}
|
||||
|
||||
if(bytes_read_total < finfo.fsize) {
|
||||
//printf("error: read %u of %u bytes.\n", bytes_read_total, (unsigned int)finfo.fsize);
|
||||
WaitPrompt((char*)"read failed : over read!");
|
||||
f_close(&fp);
|
||||
//f_mount(0, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ShowAction((char*)"Loading Rom Succeeded");
|
||||
f_close(&fp);
|
||||
//f_mount(0, NULL);
|
||||
return bytes_read_total;
|
||||
}
|
||||
#endif
|
||||
|
||||
WaitPrompt("Not WiiSD");
|
||||
/*** SDCard Addition ***/
|
||||
if (UseSDCARD) GetSDInfo();
|
||||
if (rootdirlength == 0) return 0;
|
||||
@ -761,19 +907,65 @@ int OpenDVD() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef HW_RVL
|
||||
int OpenFrontSD () {
|
||||
UseFrontSDCARD = 1;
|
||||
UseSDCARD = 0;
|
||||
haveSDdir = 0;
|
||||
char msg[128];
|
||||
|
||||
if (haveWiiSDdir == 0) {
|
||||
/* don't mess with DVD entries */
|
||||
havedir = 0;
|
||||
|
||||
/* Mount WiiSD */
|
||||
if(f_mount(0, &frontfs) != FR_OK) {
|
||||
WaitPrompt((char*)"f_mount failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Reset SDCARD root directory */
|
||||
sprintf(rootWiiSDdir,"/%s/%s", FCEUDIR, ROMSDIR);
|
||||
|
||||
/* Parse initial root directory and get entries list */
|
||||
ShowAction((char *)"Reading Directory ...");
|
||||
if ((maxfiles = parseWiiSDdirectory ())) {
|
||||
sprintf (msg, "Found %d entries", maxfiles);
|
||||
ShowAction(msg);
|
||||
/* Select an entry */
|
||||
FileSelector ();
|
||||
|
||||
/* memorize last entries list, actual root directory and selection for next access */
|
||||
haveWiiSDdir = 1;
|
||||
} else {
|
||||
/* no entries found */
|
||||
sprintf (msg, "Error reading %s", rootWiiSDdir);
|
||||
WaitPrompt (msg);
|
||||
//f_mount(0, NULL);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* Retrieve previous entries list and made a new selection */
|
||||
else FileSelector ();
|
||||
//f_mount(0, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
int OpenSD () {
|
||||
UseSDCARD = 1;
|
||||
char msg[128];
|
||||
|
||||
if (choosenSDSlot != sdslot) haveSDdir = 0;
|
||||
if (ChosenSlot != sdslot) haveSDdir = 0;
|
||||
|
||||
if (haveSDdir == 0) {
|
||||
/* don't mess with DVD entries */
|
||||
havedir = 0;
|
||||
|
||||
/* Reset SDCARD root directory */
|
||||
sprintf(rootSDdir,"dev%d:\\fceu\\roms",choosenSDSlot);
|
||||
sdslot = choosenSDSlot;
|
||||
sprintf(rootSDdir,"dev%d:\\fceu\\roms",ChosenSlot);
|
||||
sdslot = ChosenSlot;
|
||||
|
||||
/* Parse initial root directory and get entries list */
|
||||
ShowAction("Reading Directory ...");
|
||||
@ -787,7 +979,7 @@ int OpenSD () {
|
||||
haveSDdir = 1;
|
||||
} else {
|
||||
/* no entries found */
|
||||
sprintf (msg, "Error reading dev%d:\\fceu\\roms", choosenSDSlot);
|
||||
sprintf (msg, "Error reading dev%d:\\fceu\\roms", ChosenSlot);
|
||||
WaitPrompt (msg);
|
||||
return 0;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
#define MARGIN 0
|
||||
//#define PSOSDLOADID 0x7c6000a6
|
||||
|
||||
#define JOY_UP 0x10
|
||||
#define JOY_UP 0x10
|
||||
#define JOY_DOWN 0x20
|
||||
|
||||
static int currpal = 0;
|
||||
@ -52,10 +52,20 @@ extern int UseSDCARD;
|
||||
extern unsigned char DecodeJoy( unsigned short pp );
|
||||
extern unsigned char GetAnalog(int Joy);
|
||||
|
||||
#define MAXPAL 12
|
||||
|
||||
#define SCROLLY 395
|
||||
void Reboot() {
|
||||
#ifdef HW_RVL
|
||||
// Thanks to hell_hibou
|
||||
int fd = IOS_Open("/dev/stm/immediate", 0);
|
||||
IOS_Ioctl(fd, 0x2001, NULL, 0, NULL, 0);
|
||||
IOS_Close(fd);
|
||||
#else
|
||||
#define SOFTRESET_ADR ((volatile u32*)0xCC003024)
|
||||
*SOFTRESET_ADR = 0x00000000;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define MAXPAL 12
|
||||
#define SCROLLY 395
|
||||
|
||||
/* color palettes */
|
||||
struct
|
||||
@ -544,9 +554,17 @@ unsigned char sgmtext[][512] = {
|
||||
int slot = 0;
|
||||
int device = 0;
|
||||
|
||||
int StateManager()
|
||||
{
|
||||
int SdSlotCount = 3;
|
||||
char SdSlots[3][10] = {
|
||||
{ "Slot A" }, { "Slot B" }, { "Wii SD"}
|
||||
};
|
||||
enum SLOTS {
|
||||
SLOT_A, SLOT_B, SLOT_WIISD
|
||||
};
|
||||
int ChosenSlot = 0;
|
||||
int ChosenDevice = 1;
|
||||
|
||||
int StateManager() {
|
||||
int menu = 0;
|
||||
int quit = 0;
|
||||
short j;
|
||||
@ -810,10 +828,11 @@ void ShowROMInfo()
|
||||
* Media Select Screen
|
||||
****************************************************************************/
|
||||
|
||||
int mediacount = 4;
|
||||
char mediamenu[4][30] = {
|
||||
{ "Load from DVD" }, { "Load from SDCARD"},
|
||||
{ "SD Gecko: Slot A" }, { "Return to previous" }
|
||||
int MediaMenuCount = 5;
|
||||
char MediaMenu[5][30] = {
|
||||
{ "Load from SDCARD"}, { "SDCard: Slot A" },
|
||||
{ "Load from DVD" }, { "Stop DVD Motor" },
|
||||
{ "Return to previous" }
|
||||
};
|
||||
|
||||
unsigned char msstext[][512] = {
|
||||
@ -823,10 +842,14 @@ unsigned char msstext[][512] = {
|
||||
{ "How can You wait this long?! The games are waiting for You!!" }
|
||||
};
|
||||
|
||||
int choosenSDSlot = 0;
|
||||
|
||||
int MediaSelect() {
|
||||
int menu = 0;
|
||||
enum MEDIA_MENU {
|
||||
MEDIA_SDCARD, MEDIA_SLOT,
|
||||
MEDIA_DVD, MEDIA_STOPDVD,
|
||||
MEDIA_EXIT
|
||||
};
|
||||
|
||||
int ChosenMenu = 0;
|
||||
int quit = 0;
|
||||
short j;
|
||||
int redraw = 1;
|
||||
@ -834,59 +857,100 @@ int MediaSelect() {
|
||||
line = 0;
|
||||
scrollerx = 320 - MARGIN;
|
||||
|
||||
while ( quit == 0 )
|
||||
{
|
||||
if ( redraw )
|
||||
DrawMenu(&mediamenu[0], mediacount, menu );
|
||||
#ifdef HW_RVL
|
||||
strcpy(MediaMenu[MEDIA_DVD], MediaMenu[MEDIA_EXIT]);
|
||||
MediaMenuCount = 3;
|
||||
ChosenSlot = SLOT_WIISD; // default to WiiSD
|
||||
#else
|
||||
SdSlotCount = 2;
|
||||
#endif
|
||||
|
||||
redraw = 0;
|
||||
while ( quit == 0 ) {
|
||||
if ( redraw ) {
|
||||
sprintf(MediaMenu[MEDIA_SLOT], "SDCard: %s", SdSlots[ChosenSlot]);
|
||||
DrawMenu(MediaMenu, MediaMenuCount, ChosenMenu );
|
||||
redraw = 0;
|
||||
}
|
||||
|
||||
j = PAD_ButtonsDown(0);
|
||||
|
||||
if ( j & PAD_BUTTON_DOWN ) {
|
||||
menu++;
|
||||
ChosenMenu++;
|
||||
redraw = 1;
|
||||
}
|
||||
|
||||
if ( j & PAD_BUTTON_UP ) {
|
||||
menu--;
|
||||
ChosenMenu--;
|
||||
redraw = 1;
|
||||
}
|
||||
|
||||
if ( j & PAD_BUTTON_A ) {
|
||||
redraw = 1;
|
||||
switch ( menu ) {
|
||||
case 0: UseSDCARD = 0; //DVD
|
||||
switch ( ChosenMenu ) {
|
||||
case MEDIA_SDCARD:
|
||||
#ifdef HW_RVL
|
||||
if (ChosenSlot == SLOT_WIISD) {
|
||||
OpenFrontSD();
|
||||
} else
|
||||
#endif
|
||||
OpenSD();
|
||||
return 1;
|
||||
break;
|
||||
case MEDIA_SLOT:
|
||||
ChosenSlot++;
|
||||
if (ChosenSlot >= SdSlotCount)
|
||||
ChosenSlot = 0;
|
||||
redraw = 1;
|
||||
break;
|
||||
case MEDIA_DVD:
|
||||
#ifdef HW_RVL
|
||||
// In Wii mode, this is just exit
|
||||
quit = 1;
|
||||
#else
|
||||
UseSDCARD = 0; //DVD
|
||||
OpenDVD();
|
||||
return 1;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 1: UseSDCARD = 1; //SDCard
|
||||
OpenSD();
|
||||
return 1;
|
||||
break;
|
||||
case 2: choosenSDSlot ^= 1; //Pick Slot
|
||||
sprintf(mediamenu[2], "SD Gecko: %s", (!choosenSDSlot) ? "Slot A" : "Slot B");
|
||||
break;
|
||||
case 3: quit = 1; //Previous
|
||||
#ifndef HW_RVL
|
||||
case MEDIA_STOPDVD:
|
||||
ShowAction((char*)"Stopping DVD Motor ... Wait");
|
||||
dvd_motor_off();
|
||||
WaitPrompt((char*)"Stopped DVD Motor");
|
||||
case MEDIA_EXIT:
|
||||
quit = 1; //Previous
|
||||
break;
|
||||
#endif
|
||||
|
||||
default: break ;
|
||||
}
|
||||
}
|
||||
|
||||
if ( (j & PAD_BUTTON_RIGHT) && (ChosenMenu == MEDIA_SLOT) ) {
|
||||
ChosenSlot++;
|
||||
if (ChosenSlot >= SdSlotCount)
|
||||
ChosenSlot = SdSlotCount - 1;
|
||||
redraw = 1;
|
||||
}
|
||||
|
||||
if ( (j & PAD_BUTTON_LEFT) && (ChosenMenu == MEDIA_SLOT) ) {
|
||||
ChosenSlot--;
|
||||
if (ChosenSlot < 0)
|
||||
ChosenSlot = 0;
|
||||
redraw = 1;
|
||||
}
|
||||
|
||||
if ( j & PAD_BUTTON_B )
|
||||
quit = 1;
|
||||
|
||||
if ( menu == mediacount )
|
||||
menu = 0;
|
||||
if ( ChosenMenu == MediaMenuCount )
|
||||
ChosenMenu = 0;
|
||||
|
||||
if ( menu < 0 )
|
||||
menu = mediacount - 1;
|
||||
if ( ChosenMenu < 0 )
|
||||
ChosenMenu = MediaMenuCount - 1;
|
||||
|
||||
scroller(SCROLLY, &msstext[0], 3);
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -952,9 +1016,13 @@ char configmenu[11][30] = {
|
||||
{ "ROM Information" },
|
||||
{ "Configure Joypads" },
|
||||
{ "Video Options" },
|
||||
{ "Stop DVD Motor" },
|
||||
#ifdef HW_RVL
|
||||
{ "TP Reload" },
|
||||
{ "Reboot Wii" },
|
||||
#else
|
||||
{ "PSO/SD Reload" } ,
|
||||
{ "Reboot Gamecube" },
|
||||
#endif
|
||||
{ "Credits" }
|
||||
};
|
||||
|
||||
@ -969,15 +1037,17 @@ unsigned char cstext[][512] = {
|
||||
{ "Official Homepage: http://www.tehskeen.net" }
|
||||
};
|
||||
|
||||
int ConfigScreen()
|
||||
{
|
||||
int ConfigScreen() {
|
||||
int menu = 0;
|
||||
int quit = 0;
|
||||
short j;
|
||||
int redraw = 1;
|
||||
|
||||
//int *psoid = (int *) 0x80001800;
|
||||
void (*PSOReload) () = (void (*)()) 0x80001800;
|
||||
#ifdef HW_RVL
|
||||
void (*PSOReload)() = (void(*)())0x90000020;
|
||||
#else
|
||||
void (*PSOReload)() = (void(*)())0x80001800;
|
||||
#endif
|
||||
|
||||
/*** Stop any running Audio ***/
|
||||
AUDIO_StopDMA();
|
||||
@ -1060,21 +1130,15 @@ int ConfigScreen()
|
||||
scrollerx = 320 - MARGIN;
|
||||
break;
|
||||
|
||||
case 7: // Stop DVD Motor
|
||||
ShowAction("Stopping Motor");
|
||||
dvd_motor_off();
|
||||
WaitPrompt("DVD Motor Stopped");
|
||||
case 7: // PSO/SD Reload
|
||||
PSOReload();
|
||||
break;
|
||||
|
||||
case 8: // PSO/SD Reload
|
||||
PSOReload ();
|
||||
case 8: // Reboot
|
||||
Reboot();
|
||||
break;
|
||||
|
||||
case 9: // Reboot
|
||||
*SOFTRESET_ADR = 0x00000000;
|
||||
break;
|
||||
|
||||
case 10: // Credits
|
||||
case 9: // Credits
|
||||
ShowCredits();
|
||||
break;
|
||||
|
||||
|
@ -45,9 +45,13 @@ long long basetime;
|
||||
|
||||
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);
|
||||
|
||||
void (*PSOReload) () = (void (*)()) 0x80001800;
|
||||
|
||||
static void reset_cb() {
|
||||
#ifdef HW_RVL
|
||||
void (*PSOReload)() = (void(*)())0x90000020;
|
||||
#else
|
||||
void (*PSOReload)() = (void(*)())0x80001800;
|
||||
#endif
|
||||
|
||||
PSOReload();
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,9 @@
|
||||
#include "gcdvd.h"
|
||||
#include "sz.h"
|
||||
|
||||
extern int UseSDCARD;
|
||||
extern int UseFrontSDCARD;
|
||||
extern sd_file *filehandle;
|
||||
|
||||
// 7zip error list
|
||||
char szerrormsg[][30] = {"7z: Data error",
|
||||
@ -58,8 +61,17 @@ int dvd_buffered_read(void *dst, u32 len, u64 offset) {
|
||||
|
||||
// only read data if the data inside dvdsf_buffer cannot be used
|
||||
if(offset != dvdsf_last_offset || len > dvdsf_last_length) {
|
||||
char msg[1024];
|
||||
sprintf(msg, "buff_read: len=%d, offset=%llX, UseSD=%d", len, offset, UseSDCARD);
|
||||
//WaitPrompt(msg);
|
||||
memset(&dvdsf_buffer, '\0', DVD_SECTOR_SIZE);
|
||||
ret = dvd_read(&dvdsf_buffer, len, offset);
|
||||
if (UseSDCARD) {
|
||||
if (filehandle == NULL)
|
||||
GetSDInfo();
|
||||
SDCARD_SeekFile(filehandle, offset, SDCARD_SEEK_SET);
|
||||
SDCARD_ReadFile(filehandle, &dvdsf_buffer, len);
|
||||
} else if (!UseFrontSDCARD)
|
||||
ret = dvd_read(&dvdsf_buffer, len, offset);
|
||||
dvdsf_last_offset = offset;
|
||||
dvdsf_last_length = len;
|
||||
}
|
||||
@ -74,10 +86,16 @@ int dvd_safe_read(void *dst_v, u32 len, u64 offset) {
|
||||
// if read size and length are a multiply of DVD_(OFFSET,LENGTH)_MULTIPLY and length < DVD_MAX_READ_LENGTH
|
||||
// we don't need to fix anything
|
||||
if(len % DVD_LENGTH_MULTIPLY == 0 && offset % DVD_OFFSET_MULTIPLY == 0 && len <= DVD_MAX_READ_LENGTH) {
|
||||
char msg[1024];
|
||||
sprintf(msg, "simple_safe_read: len=%d, offset=%llX, UseSD=%d", len, offset, UseSDCARD);
|
||||
//WaitPrompt(msg);
|
||||
int ret = dvd_buffered_read(buffer, len, offset);
|
||||
memcpy(dst_v, &buffer, len);
|
||||
return ret;
|
||||
} else {
|
||||
char msg[1024];
|
||||
sprintf(msg, "complex_safe_read: len=%d, offset=%llX, UseSD=%d", len, offset, UseSDCARD);
|
||||
//WaitPrompt(msg);
|
||||
// no errors yet -> ret = 0
|
||||
// the return value of dvd_read will be OR'd with ret
|
||||
// because dvd_read does return 1 on error and 0 on success and
|
||||
@ -199,6 +217,15 @@ SZ_RESULT SzDvdIsArchive(u64 dvd_offset) {
|
||||
|
||||
// read the data from the DVD
|
||||
int res = dvd_safe_read (&Candidate, 6, dvd_offset);
|
||||
char msg[1024];
|
||||
sprintf(msg, "7zSig: %02X %02X %02X %02X %02X %02X",
|
||||
Candidate[0],
|
||||
Candidate[1],
|
||||
Candidate[2],
|
||||
Candidate[3],
|
||||
Candidate[4],
|
||||
Candidate[5]);
|
||||
//WaitPrompt(msg);
|
||||
|
||||
size_t i;
|
||||
for(i = 0; i < 6; i++) {
|
||||
@ -310,6 +337,7 @@ bool SzExtractROM(int i, unsigned char *buffer)
|
||||
|
||||
// Unzip the file
|
||||
ShowAction("Un7zipping file. Please wait...");
|
||||
WaitPrompt("Un7zipping file. Please wait...");
|
||||
SzRes = SzExtract2(
|
||||
&SzArchiveStream.InStream,
|
||||
&SzDb,
|
||||
|
Loading…
Reference in New Issue
Block a user