mirror of
https://github.com/dborth/fceugx.git
synced 2025-01-05 21:38:17 +01:00
complete redesign/rewrite of ROM loading (UNIF, NSF, partial FDS support), 7z detection
This commit is contained in:
parent
1d6352b136
commit
d8a3101bb0
12
readme.txt
12
readme.txt
@ -29,14 +29,20 @@ SNES9x GX and Genesis Plus GX projects.
|
||||
|0O×øo· UPDATE HISTORY ·oø×O0|
|
||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||
|
||||
[What's New 2.0.2]
|
||||
[What's New 2.0.3]
|
||||
* VS game support (submitted by pakitovic)
|
||||
* Complete rewrite of loading code - UNIF / NSF support, FDS games
|
||||
load but don't run
|
||||
* 480p and DVD now available for GameCube
|
||||
|
||||
[What's New 2.0.2 - September 19, 2008]
|
||||
* Fixed network freeze-up problem
|
||||
* Zapper now mapped to A and B
|
||||
* Fixed auto-save feature
|
||||
* Performance slowdowns on Gamecube should be fixed
|
||||
* Will now attempt to load old save states with CRC filename
|
||||
|
||||
[What's New 2.0.1]
|
||||
[What's New 2.0.1 - September 6, 2008]
|
||||
* Zapper support! Turn this on in the Controller Settings - most games
|
||||
require you to have the Zapper on Port 2. Thanks go to aksommerville whose
|
||||
previous work on the Zapper helped, and michniewski's cursor code
|
||||
@ -46,7 +52,7 @@ SNES9x GX and Genesis Plus GX projects.
|
||||
* Start/Select reversed mapping fixed for Wii controllers
|
||||
* Small bug fixes / improvements / tweaks
|
||||
|
||||
[What's New 2.0.0]
|
||||
[What's New 2.0.0 - September 1, 2008]
|
||||
|
||||
* Complete rewrite based on code from SNES9x GX and Genesis Plus GX
|
||||
* Wiimote, Nunchuk, and Classic controller support
|
||||
|
@ -424,7 +424,7 @@ FCEUS FSettings;
|
||||
|
||||
void FCEU_printf(char *format, ...)
|
||||
{
|
||||
char temp[2048];
|
||||
/*char temp[2048];
|
||||
|
||||
va_list ap;
|
||||
|
||||
@ -432,12 +432,12 @@ void FCEU_printf(char *format, ...)
|
||||
vsprintf(temp,format,ap);
|
||||
FCEUD_Message(temp);
|
||||
|
||||
va_end(ap);
|
||||
va_end(ap);*/
|
||||
}
|
||||
|
||||
void FCEU_PrintError(char *format, ...)
|
||||
{
|
||||
char temp[2048];
|
||||
/* char temp[2048];
|
||||
|
||||
va_list ap;
|
||||
|
||||
@ -445,7 +445,7 @@ void FCEU_PrintError(char *format, ...)
|
||||
vsprintf(temp,format,ap);
|
||||
FCEUD_PrintError(temp);
|
||||
|
||||
va_end(ap);
|
||||
va_end(ap);*/
|
||||
}
|
||||
|
||||
void FCEUI_SetRenderedLines(int ntscf, int ntscl, int palf, int pall)
|
||||
|
@ -67,7 +67,7 @@ static int32 IRQLatch,IRQCount;
|
||||
static uint8 IRQa;
|
||||
static void FDSClose(void);
|
||||
|
||||
static uint8 FDSBIOS[8192];
|
||||
uint8 FDSBIOS[8192];
|
||||
|
||||
/* Original disk data backup, to help in creating save states. */
|
||||
static uint8 *diskdatao[8]={0,0,0,0,0,0,0,0};
|
||||
@ -93,7 +93,7 @@ void FDSGI(int h)
|
||||
}
|
||||
|
||||
static void FDSStateRestore(int version)
|
||||
{
|
||||
{
|
||||
int x;
|
||||
|
||||
setmirror(((FDSRegs[5]&8)>>3)^1);
|
||||
@ -132,7 +132,7 @@ static void FDSInit(void)
|
||||
SetReadHandler(0x4032,0x4032,FDSRead4032);
|
||||
SetReadHandler(0x4033,0x4033,FDSRead4033);
|
||||
|
||||
SetWriteHandler(0x4020,0x4025,FDSWrite);
|
||||
SetWriteHandler(0x4020,0x4025,FDSWrite);
|
||||
|
||||
SetWriteHandler(0x6000,0xdfff,FDSRAMWrite);
|
||||
SetReadHandler(0x6000,0xdfff,FDSRAMRead);
|
||||
@ -148,10 +148,10 @@ void FCEU_FDSInsert(int oride)
|
||||
{
|
||||
if(InDisk==255)
|
||||
{
|
||||
FCEU_DispMessage("Disk %d Side %s Inserted",SelectDisk>>1,(SelectDisk&1)?"B":"A");
|
||||
FCEU_DispMessage("Disk %d Side %s Inserted",SelectDisk>>1,(SelectDisk&1)?"B":"A");
|
||||
InDisk=SelectDisk;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
FCEU_DispMessage("Disk %d Side %s Ejected",SelectDisk>>1,(SelectDisk&1)?"B":"A");
|
||||
InDisk=255;
|
||||
@ -187,14 +187,14 @@ static void FP_FASTAPASS(1) FDSFix(int a)
|
||||
IRQCount=IRQLatch=0;
|
||||
}
|
||||
else
|
||||
IRQCount=IRQLatch;
|
||||
IRQCount=IRQLatch;
|
||||
//IRQCount=IRQLatch; //0xFFFF;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
//printf("IRQ: %d\n",timestamp);
|
||||
// printf("IRQ: %d\n",scanline);
|
||||
}
|
||||
}
|
||||
if(DiskSeekIRQ>0)
|
||||
if(DiskSeekIRQ>0)
|
||||
{
|
||||
DiskSeekIRQ-=a;
|
||||
if(DiskSeekIRQ<=0)
|
||||
@ -239,14 +239,14 @@ static DECLFR(FDSRead4031)
|
||||
return z;
|
||||
}
|
||||
static DECLFR(FDSRead4032)
|
||||
{
|
||||
{
|
||||
uint8 ret;
|
||||
|
||||
ret=X.DB&~7;
|
||||
if(InDisk==255)
|
||||
ret|=5;
|
||||
|
||||
if(InDisk==255 || !(FDSRegs[5]&1) || (FDSRegs[5]&2))
|
||||
if(InDisk==255 || !(FDSRegs[5]&1) || (FDSRegs[5]&2))
|
||||
ret|=2;
|
||||
return ret;
|
||||
}
|
||||
@ -345,7 +345,7 @@ static DECLFW(FDSSWrite)
|
||||
A-=0x4080;
|
||||
switch(A)
|
||||
{
|
||||
case 0x0:
|
||||
case 0x0:
|
||||
case 0x4: if(V&0x80)
|
||||
amplitude[(A&0xF)>>2]=V&0x3F; //)>0x20?0x20:(V&0x3F);
|
||||
break;
|
||||
@ -361,7 +361,7 @@ static DECLFW(FDSSWrite)
|
||||
break;
|
||||
}
|
||||
//if(A>=0x7 && A!=0x8 && A<=0xF)
|
||||
//if(A==0xA || A==0x9)
|
||||
//if(A==0xA || A==0x9)
|
||||
//printf("$%04x:$%02x\n",A,V);
|
||||
SPSG[A]=V;
|
||||
}
|
||||
@ -428,7 +428,7 @@ static INLINE void ClockRise(void)
|
||||
b19shiftreg60=(SPSG[0x2]|((SPSG[0x3]&0xF)<<8));
|
||||
b17latch76=(SPSG[0x6]|((SPSG[0x07]&0xF)<<8))+b17latch76;
|
||||
|
||||
if(!(SPSG[0x7]&0x80))
|
||||
if(!(SPSG[0x7]&0x80))
|
||||
{
|
||||
int t=fdso.mwave[(b17latch76>>13)&0x1F]&7;
|
||||
int t2=amplitude[1];
|
||||
@ -448,13 +448,13 @@ static INLINE void ClockRise(void)
|
||||
b8shiftreg88=0x80 + adj;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
b8shiftreg88=0x80;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
b19shiftreg60<<=1;
|
||||
b19shiftreg60<<=1;
|
||||
b8shiftreg88>>=1;
|
||||
}
|
||||
// b24adder66=(b24latch68+b19shiftreg60)&0x3FFFFFF;
|
||||
@ -484,7 +484,7 @@ static INLINE int32 FDSDoSound(void)
|
||||
if(fdso.envcount<=0)
|
||||
{
|
||||
fdso.envcount+=SPSG[0xA]*3;
|
||||
DoEnv();
|
||||
DoEnv();
|
||||
}
|
||||
}
|
||||
if(fdso.count>=32768) goto dogk;
|
||||
@ -523,7 +523,7 @@ static void RenderSound(void)
|
||||
static void RenderSoundHQ(void)
|
||||
{
|
||||
int32 x;
|
||||
|
||||
|
||||
if(!(SPSG[0x9]&0x80))
|
||||
for(x=FBC;x<SOUNDTS;x++)
|
||||
{
|
||||
@ -677,7 +677,7 @@ static int SubLoad(FCEUFILE *fp)
|
||||
int x;
|
||||
|
||||
FCEU_fread(header,16,1,fp);
|
||||
|
||||
|
||||
if(memcmp(header,"FDS\x1a",4))
|
||||
{
|
||||
if(!(memcmp(header+1,"*NINTENDO-HVC*",14)))
|
||||
@ -691,7 +691,7 @@ static int SubLoad(FCEUFILE *fp)
|
||||
}
|
||||
else
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
TotalSides=header[4];
|
||||
|
||||
@ -738,28 +738,28 @@ static void PostSave(void)
|
||||
for(x=0;x<TotalSides;x++)
|
||||
{
|
||||
int b;
|
||||
|
||||
|
||||
for(b=0; b<65500; b++)
|
||||
diskdata[x][b] ^= diskdatao[x][b];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int FDSLoad(const char *name, FCEUFILE *fp)
|
||||
{
|
||||
FILE *zp;
|
||||
//FILE *zp;
|
||||
int x;
|
||||
char *fn;
|
||||
// char *fn;
|
||||
|
||||
FCEU_fseek(fp,0,SEEK_SET);
|
||||
|
||||
if(!SubLoad(fp))
|
||||
if(!SubLoad(fp))
|
||||
return(0);
|
||||
|
||||
|
||||
/*
|
||||
fn = FCEU_MakeFName(FCEUMKF_FDSROM,0,0);
|
||||
|
||||
if(!(zp=FCEUD_UTF8fopen(fn,"rb")))
|
||||
if(!(zp=FCEUD_UTF8fopen(fn,"rb")))
|
||||
{
|
||||
FCEU_PrintError("FDS BIOS ROM image missing!");
|
||||
FreeFDSMemory();
|
||||
@ -768,7 +768,7 @@ int FDSLoad(const char *name, FCEUFILE *fp)
|
||||
}
|
||||
|
||||
free(fn);
|
||||
|
||||
|
||||
if(fread(FDSBIOS,1,8192,zp)!=8192)
|
||||
{
|
||||
fclose(zp);
|
||||
@ -776,9 +776,8 @@ int FDSLoad(const char *name, FCEUFILE *fp)
|
||||
FCEU_PrintError("Error reading FDS BIOS ROM image.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
fclose(zp);
|
||||
|
||||
fclose(zp);
|
||||
|
||||
{
|
||||
FCEUFILE *tp;
|
||||
@ -790,8 +789,7 @@ int FDSLoad(const char *name, FCEUFILE *fp)
|
||||
diskdatao[x]=(uint8 *)FCEU_malloc(65500);
|
||||
memcpy(diskdatao[x],diskdata[x],65500);
|
||||
}
|
||||
|
||||
if((tp=FCEU_fopen(fn,0,"rb",0)))
|
||||
if((tp=FCEU_fopen(fn,0,"rb",0)))
|
||||
{
|
||||
FreeFDSMemory();
|
||||
if(!SubLoad(tp))
|
||||
@ -801,10 +799,10 @@ int FDSLoad(const char *name, FCEUFILE *fp)
|
||||
return(0);
|
||||
}
|
||||
FCEU_fclose(tp);
|
||||
DiskWritten=1; /* For save state handling. */
|
||||
DiskWritten=1; // For save state handling.
|
||||
}
|
||||
free(fn);
|
||||
}
|
||||
}*/
|
||||
|
||||
FCEUGameInfo->type=GIT_FDS;
|
||||
GameInterface=FDSGI;
|
||||
@ -817,7 +815,7 @@ int FDSLoad(const char *name, FCEUFILE *fp)
|
||||
|
||||
for(x=0;x<TotalSides;x++)
|
||||
{
|
||||
char temp[5];
|
||||
char temp[5];
|
||||
sprintf(temp,"DDT%d",x);
|
||||
AddExState(diskdata[x],65500,0,temp);
|
||||
}
|
||||
@ -862,7 +860,7 @@ void FDSClose(void)
|
||||
|
||||
for(x=0;x<TotalSides;x++)
|
||||
{
|
||||
if(fwrite(diskdata[x],1,65500,fp)!=65500)
|
||||
if(fwrite(diskdata[x],1,65500,fp)!=65500)
|
||||
{
|
||||
FCEU_PrintError("Error saving FDS image!");
|
||||
fclose(fp);
|
||||
|
@ -33,12 +33,6 @@
|
||||
#include "driver.h"
|
||||
#include "general.h"
|
||||
|
||||
typedef struct {
|
||||
uint8 *data;
|
||||
uint32 size;
|
||||
uint32 location;
|
||||
} MEMWRAP;
|
||||
|
||||
void ApplyIPS(FILE *ips, MEMWRAP *dest)
|
||||
{
|
||||
uint8 header[5];
|
||||
|
@ -3,6 +3,12 @@ typedef struct {
|
||||
uint32 type; // 0=normal file, 1=gzip, 2=zip
|
||||
} FCEUFILE;
|
||||
|
||||
typedef struct {
|
||||
uint8 *data;
|
||||
uint32 size;
|
||||
uint32 location;
|
||||
} MEMWRAP;
|
||||
|
||||
FCEUFILE *FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext);
|
||||
int FCEU_fclose(FCEUFILE*);
|
||||
uint64 FCEU_fread(void *ptr, size_t size, size_t nmemb, FCEUFILE*);
|
||||
|
@ -719,7 +719,7 @@ int iNESLoad(const char *name, FCEUFILE *fp)
|
||||
iNESCart.SaveGameLen[0]=8192;
|
||||
}
|
||||
}
|
||||
FCEU_LoadGameSave(&iNESCart);
|
||||
//FCEU_LoadGameSave(&iNESCart);
|
||||
|
||||
GameInterface=iNESGI;
|
||||
FCEU_printf("\n");
|
||||
@ -1099,160 +1099,3 @@ static int NewiNES_Init(int num)
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
** GC V1.0
|
||||
**
|
||||
** Duplicate load from memory
|
||||
****************************************************************************/
|
||||
int iNESMemLoad(char *nesrom)
|
||||
{
|
||||
struct md5_context md5;
|
||||
int memoffs = 0;
|
||||
|
||||
memcpy(&head, nesrom, 16);
|
||||
memoffs+=16;
|
||||
|
||||
if(memcmp(&head,"NES\x1a",4))
|
||||
return 0;
|
||||
|
||||
memset(&iNESCart,0,sizeof(iNESCart));
|
||||
|
||||
if(!memcmp((char *)(&head)+0x7,"DiskDude",8))
|
||||
{
|
||||
memset((char *)(&head)+0x7,0,0x9);
|
||||
}
|
||||
|
||||
if(!memcmp((char *)(&head)+0x7,"demiforce",9))
|
||||
{
|
||||
memset((char *)(&head)+0x7,0,0x9);
|
||||
}
|
||||
|
||||
if(!memcmp((char *)(&head)+0xA,"Ni03",4))
|
||||
{
|
||||
if(!memcmp((char *)(&head)+0x7,"Dis",3))
|
||||
memset((char *)(&head)+0x7,0,0x9);
|
||||
else
|
||||
memset((char *)(&head)+0xA,0,0x6);
|
||||
}
|
||||
|
||||
if(!head.ROM_size)
|
||||
{
|
||||
FCEU_PrintError("No PRG ROM!");
|
||||
return(0);
|
||||
//head.ROM_size++;
|
||||
}
|
||||
ROM_size = head.ROM_size;
|
||||
VROM_size = head.VROM_size;
|
||||
ROM_size=uppow2(ROM_size);
|
||||
|
||||
if(VROM_size)
|
||||
VROM_size=uppow2(VROM_size);
|
||||
|
||||
MapperNo = (head.ROM_type>>4);
|
||||
MapperNo|=(head.ROM_type2&0xF0);
|
||||
Mirroring = (head.ROM_type&1);
|
||||
|
||||
if(head.ROM_type&8) Mirroring=2;
|
||||
|
||||
if(!(ROM=(uint8 *)FCEU_malloc(ROM_size<<14)))
|
||||
return 0;
|
||||
|
||||
if (VROM_size)
|
||||
if(!(VROM=(uint8 *)FCEU_malloc(VROM_size<<13)))
|
||||
{
|
||||
free(ROM);
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(ROM,0xFF,ROM_size<<14);
|
||||
if(VROM_size) memset(VROM,0xFF,VROM_size<<13);
|
||||
if(head.ROM_type&4) /* Trainer */
|
||||
{
|
||||
trainerpoo=(uint8 *)FCEU_gmalloc(512);
|
||||
memcpy(trainerpoo, &nesrom[memoffs], 512);
|
||||
memoffs+=512;
|
||||
//FCEU_fread(trainerpoo,512,1,fp);
|
||||
}
|
||||
|
||||
ResetCartMapping();
|
||||
ResetExState(0,0);
|
||||
|
||||
SetupCartPRGMapping(0,ROM,ROM_size*0x4000,0);
|
||||
SetupCartPRGMapping(1,WRAM,8192,1);
|
||||
|
||||
//FCEU_fread(ROM,0x4000,head.ROM_size,fp);
|
||||
memcpy(ROM, &nesrom[memoffs], head.ROM_size * 0x4000);
|
||||
memoffs += ( head.ROM_size * 0x4000 );
|
||||
|
||||
if(VROM_size){
|
||||
//FCEU_fread(VROM,0x2000,head.VROM_size,fp);
|
||||
memcpy(VROM, &nesrom[memoffs], 0x2000 * head.VROM_size);
|
||||
memoffs += ( head.VROM_size * 0x2000 );
|
||||
}
|
||||
|
||||
md5_starts(&md5);
|
||||
md5_update(&md5,ROM,ROM_size<<14);
|
||||
|
||||
iNESGameCRC32=CalcCRC32(0,ROM,ROM_size<<14);
|
||||
|
||||
if(VROM_size)
|
||||
{
|
||||
iNESGameCRC32=CalcCRC32(iNESGameCRC32,VROM,VROM_size<<13);
|
||||
md5_update(&md5,VROM,VROM_size<<13);
|
||||
}
|
||||
|
||||
md5_finish(&md5,iNESCart.MD5);
|
||||
memcpy(FCEUGameInfo->MD5,iNESCart.MD5,sizeof(iNESCart.MD5));
|
||||
|
||||
iNESCart.CRC32=iNESGameCRC32;
|
||||
|
||||
SetInput();
|
||||
CheckHInfo();
|
||||
|
||||
{
|
||||
int x;
|
||||
uint64 partialmd5=0;
|
||||
|
||||
for(x=0;x<8;x++)
|
||||
{
|
||||
partialmd5 |= (uint64)iNESCart.MD5[7-x] << (x*8);
|
||||
}
|
||||
|
||||
FCEU_VSUniCheck(partialmd5, &MapperNo, &Mirroring);
|
||||
}
|
||||
|
||||
/* Must remain here because above functions might change value of
|
||||
VROM_size and free(VROM).
|
||||
*/
|
||||
if(VROM_size)
|
||||
SetupCartCHRMapping(0,VROM,VROM_size*0x2000,0);
|
||||
|
||||
if(Mirroring==2)
|
||||
SetupCartMirroring(4,1,ExtraNTARAM);
|
||||
else if(Mirroring>=0x10)
|
||||
SetupCartMirroring(2+(Mirroring&1),1,0);
|
||||
else
|
||||
SetupCartMirroring(Mirroring&1,(Mirroring&4)>>2,0);
|
||||
|
||||
iNESCart.battery=(head.ROM_type&2)?1:0;
|
||||
iNESCart.mirror=Mirroring;
|
||||
|
||||
if(NewiNES_Init(MapperNo))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
iNESCart.Power=iNESPower;
|
||||
if(head.ROM_type&2)
|
||||
{
|
||||
iNESCart.SaveGame[0]=WRAM;
|
||||
iNESCart.SaveGameLen[0]=8192;
|
||||
}
|
||||
}
|
||||
|
||||
GameInterface=iNESGI;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ typedef struct {
|
||||
int (*init)(FCEUFILE *fp);
|
||||
} BFMAPPING;
|
||||
|
||||
static CartInfo UNIFCart;
|
||||
CartInfo UNIFCart;
|
||||
|
||||
static int vramo;
|
||||
static int mirrortodo;
|
||||
@ -130,7 +130,7 @@ static int DoMirroring(FCEUFILE *fp)
|
||||
{
|
||||
uint8 t;
|
||||
t=FCEU_fgetc(fp);
|
||||
mirrortodo=t;
|
||||
mirrortodo=t;
|
||||
|
||||
{
|
||||
static char *stuffo[6]={"Horizontal","Vertical","$2000","$2400","\"Four-screen\"","Controlled by Mapper Hardware"};
|
||||
@ -268,7 +268,7 @@ static int LoadPRG(FCEUFILE *fp)
|
||||
else
|
||||
FCEU_printf("\n");
|
||||
|
||||
SetupCartPRGMapping(z,malloced[z],t,0);
|
||||
SetupCartPRGMapping(z,malloced[z],t,0);
|
||||
return(1);
|
||||
}
|
||||
|
||||
@ -371,14 +371,14 @@ static BMAPPING bmap[] = {
|
||||
|
||||
{ "CPROM", CPROM_Init,0},
|
||||
{ "CNROM", CNROM_Init,0},
|
||||
|
||||
|
||||
//{ "GNROM", GNROM_Init,0},
|
||||
//{ "NROM", NROM256_Init,0 },
|
||||
//{ "RROM", NROM128_Init,0 },
|
||||
//{ "RROM-128", NROM128_Init,0 },
|
||||
//{ "NROM-128", NROM128_Init,0 },
|
||||
//{ "NROM-256", NROM256_Init,0 },
|
||||
|
||||
|
||||
{ "MHROM", MHROM_Init,0},
|
||||
{ "UNROM", UNROM_Init,0},
|
||||
{ "MARIO1-MALEE2", MALEE_Init,0},
|
||||
@ -410,13 +410,13 @@ int LoadUNIFChunks(FCEUFILE *fp)
|
||||
for(;;)
|
||||
{
|
||||
t=FCEU_fread(&uchead,1,4,fp);
|
||||
if(t<4)
|
||||
if(t<4)
|
||||
{
|
||||
if(t>0)
|
||||
return 0;
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
if(!(FCEU_read32le(&uchead.info,fp)))
|
||||
if(!(FCEU_read32le(&uchead.info,fp)))
|
||||
return 0;
|
||||
t=0;
|
||||
x=0;
|
||||
@ -428,7 +428,7 @@ int LoadUNIFChunks(FCEUFILE *fp)
|
||||
if(!bfunc[x].init(fp))
|
||||
return 0;
|
||||
t=1;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
x++;
|
||||
}
|
||||
@ -497,7 +497,7 @@ int UNIFLoad(const char *name, FCEUFILE *fp)
|
||||
FCEU_fseek(fp,0,SEEK_SET);
|
||||
FCEU_fread(&unhead,1,4,fp);
|
||||
if(memcmp(&unhead,"UNIF",4))
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
ResetCartMapping();
|
||||
|
||||
@ -512,7 +512,7 @@ int UNIFLoad(const char *name, FCEUFILE *fp)
|
||||
{
|
||||
int x;
|
||||
struct md5_context md5;
|
||||
|
||||
|
||||
md5_starts(&md5);
|
||||
|
||||
for(x=0;x<32;x++)
|
||||
@ -531,10 +531,10 @@ int UNIFLoad(const char *name, FCEUFILE *fp)
|
||||
if(!InitializeBoard())
|
||||
goto aborto;
|
||||
|
||||
FCEU_LoadGameSave(&UNIFCart);
|
||||
//FCEU_LoadGameSave(&UNIFCart);
|
||||
GameInterface=UNIFGI;
|
||||
return 1;
|
||||
|
||||
|
||||
aborto:
|
||||
|
||||
FreeUNIF();
|
||||
|
@ -144,13 +144,13 @@ void FCEU_PutImage(void)
|
||||
|
||||
void FCEU_DispMessage(char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
/* va_list ap;
|
||||
|
||||
va_start(ap,format);
|
||||
vsprintf(errmsg,format,ap);
|
||||
va_end(ap);
|
||||
|
||||
howlong=180;
|
||||
howlong=180;*/
|
||||
}
|
||||
|
||||
void FCEU_ResetMessages(void)
|
||||
|
@ -22,11 +22,6 @@
|
||||
#include "menudraw.h"
|
||||
#include "gcunzip.h"
|
||||
|
||||
extern bool isWii;
|
||||
extern int offset;
|
||||
extern int selection;
|
||||
extern FILEENTRIES filelist[MAXFILES];
|
||||
extern int maxfiles;
|
||||
u64 dvddir = 0;
|
||||
u64 dvdrootdir = 0;
|
||||
int dvddirlength = 0;
|
||||
@ -451,7 +446,19 @@ LoadDVDFile (unsigned char *buffer)
|
||||
ShowAction ((char*) "Loading...");
|
||||
dvd_read (readbuffer, 2048, discoffset);
|
||||
|
||||
if (!IsZipFile (readbuffer))
|
||||
int r = IsZipFile (readbuffer);
|
||||
|
||||
if(r == 2) // 7z
|
||||
{
|
||||
WaitPrompt ((char *)"7z files are not supported!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (r)
|
||||
{
|
||||
return UnZipDVDFile (buffer, discoffset); // unzip from dvd
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < blocks; i++)
|
||||
{
|
||||
@ -469,10 +476,6 @@ LoadDVDFile (unsigned char *buffer)
|
||||
memcpy (buffer + offset, readbuffer, i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return UnZipDVDFile (buffer, discoffset); // unzip from dvd
|
||||
}
|
||||
return dvddirlength;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <gctypes.h>
|
||||
#include <ogc/system.h>
|
||||
@ -33,6 +34,7 @@
|
||||
#include <di/di.h>
|
||||
#endif
|
||||
|
||||
extern unsigned char nesrom[];
|
||||
extern bool romLoaded;
|
||||
bool isWii;
|
||||
|
||||
@ -40,6 +42,7 @@ uint8 *xbsave=NULL;
|
||||
|
||||
extern int cleanSFMDATA();
|
||||
extern void ResetNES(void);
|
||||
extern uint8 FDSBIOS[8192];
|
||||
|
||||
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);
|
||||
|
||||
@ -83,9 +86,9 @@ int main(int argc, char *argv[])
|
||||
FCEUI_SetVidSystem(0); // 0 - NTSC, 1 - PAL
|
||||
FCEUI_SetGameGenie(0); // 0 - OFF, 1 - ON
|
||||
|
||||
memset(FDSBIOS, 0, sizeof(FDSBIOS)); // clear FDS BIOS memory
|
||||
cleanSFMDATA(); // clear state data
|
||||
GCMemROM(); // load color test ROM
|
||||
romLoaded = false; // we start off with only the color test rom
|
||||
nesromptr = &nesrom[0]; // address of embedded color test ROM
|
||||
|
||||
// Set Defaults
|
||||
DefaultSettings();
|
||||
@ -118,15 +121,13 @@ int main(int argc, char *argv[])
|
||||
/****************************************************************************
|
||||
* FCEU Support Functions to be written
|
||||
****************************************************************************/
|
||||
/*** File Control ***/
|
||||
|
||||
|
||||
// File Control
|
||||
FILE *FCEUD_UTF8fopen(const char *n, const char *m)
|
||||
{
|
||||
return(fopen(n,m));
|
||||
}
|
||||
|
||||
/*** General Logging ***/
|
||||
// General Logging
|
||||
void FCEUD_PrintError(char *s)
|
||||
{
|
||||
}
|
||||
@ -135,15 +136,15 @@ void FCEUD_Message(char *text)
|
||||
{
|
||||
}
|
||||
|
||||
/*** VIDEO ***/
|
||||
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count)
|
||||
// main interface to FCE Ultra
|
||||
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int32 Count)
|
||||
{
|
||||
PlaySound(Buffer, Count);
|
||||
RenderFrame( (char *)XBuf, GCSettings.screenscaler );
|
||||
GetJoy();
|
||||
PlaySound(Buffer, Count); // play sound
|
||||
RenderFrame( (char *)XBuf, GCSettings.screenscaler); // output video frame
|
||||
GetJoy(); // check controller input
|
||||
}
|
||||
|
||||
/*** Netplay ***/
|
||||
// Netplay
|
||||
int FCEUD_SendData(void *data, uint32 len)
|
||||
{
|
||||
return 1;
|
||||
|
@ -22,25 +22,58 @@
|
||||
#include "palette.h"
|
||||
#include "fceu.h"
|
||||
#include "sound.h"
|
||||
#include "file.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "pad.h"
|
||||
#include "menudraw.h"
|
||||
#include "fceuconfig.h"
|
||||
#include "fileop.h"
|
||||
#include "filesel.h"
|
||||
#include "smbop.h"
|
||||
|
||||
unsigned char *nesromptr;
|
||||
bool romLoaded = false;
|
||||
|
||||
extern FCEUGI *FCEUGameInfo;
|
||||
extern int iNESMemLoad( char *rom );
|
||||
|
||||
extern unsigned char nesrom[];
|
||||
|
||||
#define SAMPLERATE 48000
|
||||
|
||||
int GCMemROM()
|
||||
{
|
||||
nesromptr = &nesrom[0];
|
||||
FCEUFILE *fceufp = NULL;
|
||||
MEMWRAP *fceumem = NULL;
|
||||
unsigned char * fceuFileData = NULL;
|
||||
|
||||
void MakeFCEUFile(char * membuffer, int length)
|
||||
{
|
||||
if(fceufp != NULL)
|
||||
{
|
||||
free(fceuFileData);
|
||||
free(fceumem);
|
||||
free(fceufp);
|
||||
fceuFileData = NULL;
|
||||
fceumem = NULL;
|
||||
fceufp = NULL;
|
||||
}
|
||||
|
||||
fceufp =(FCEUFILE *)malloc(sizeof(FCEUFILE));
|
||||
fceufp->type=3;
|
||||
fceumem = (MEMWRAP *)malloc(sizeof(MEMWRAP));
|
||||
fceumem->location=0;
|
||||
fceumem->size=length;
|
||||
fceuFileData = (unsigned char *)malloc(length);
|
||||
memcpy(fceuFileData, membuffer, length);
|
||||
fceumem->data=fceuFileData;
|
||||
fceufp->fp = fceumem;
|
||||
}
|
||||
|
||||
extern int FDSLoad(const char *name, FCEUFILE *fp);
|
||||
extern int iNESLoad(const char *name, FCEUFILE *fp);
|
||||
extern int UNIFLoad(const char *name, FCEUFILE *fp);
|
||||
extern int NSFLoad(FCEUFILE *fp);
|
||||
extern uint8 FDSBIOS[8192];
|
||||
|
||||
int GCMemROM(method)
|
||||
{
|
||||
ResetGameLoaded();
|
||||
|
||||
/*** Allocate and clear GameInfo ***/
|
||||
@ -66,7 +99,58 @@ int GCMemROM()
|
||||
|
||||
InitialisePads();
|
||||
|
||||
if ( iNESMemLoad( (char *)nesromptr ) )
|
||||
MakeFCEUFile((char *)nesromptr, filelist[selection].length);
|
||||
|
||||
nesGameType = 0;
|
||||
|
||||
if(iNESLoad(NULL, fceufp))
|
||||
nesGameType = 1;
|
||||
else if(UNIFLoad(NULL,fceufp))
|
||||
nesGameType = 2;
|
||||
else if(NSFLoad(fceufp))
|
||||
nesGameType = 3;
|
||||
else
|
||||
{
|
||||
// read FDS BIOS into FDSBIOS - should be 8192 bytes
|
||||
if(FDSBIOS[1] == 0)
|
||||
{
|
||||
int biosSize = 0;
|
||||
char * tmpbuffer = (char *)malloc(64 * 1024);
|
||||
|
||||
char filepath[1024];
|
||||
sprintf(filepath, "%s/disksys.rom", GCSettings.LoadFolder);
|
||||
|
||||
switch (method)
|
||||
{
|
||||
case METHOD_SD:
|
||||
case METHOD_USB:
|
||||
biosSize = LoadBufferFromFAT(tmpbuffer, filepath, NOTSILENT);
|
||||
break;
|
||||
case METHOD_SMB:
|
||||
biosSize = LoadBufferFromSMB(tmpbuffer, filepath, NOTSILENT);
|
||||
break;
|
||||
}
|
||||
|
||||
if(biosSize == 8192)
|
||||
{
|
||||
memcpy(FDSBIOS, tmpbuffer, 8192);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(biosSize > 0)
|
||||
WaitPrompt("FDS BIOS file is invalid!");
|
||||
}
|
||||
free(tmpbuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
// load game
|
||||
if(FDSLoad(NULL,fceufp))
|
||||
nesGameType = 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (nesGameType > 0)
|
||||
{
|
||||
FCEU_ResetVidSys();
|
||||
PowerNES();
|
||||
@ -74,6 +158,7 @@ int GCMemROM()
|
||||
FCEU_ResetMessages(); // Save state, status messages, etc.
|
||||
SetSoundVariables();
|
||||
romLoaded = true;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -81,7 +166,4 @@ int GCMemROM()
|
||||
romLoaded = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -9,4 +9,4 @@
|
||||
* NES Memory Load Game
|
||||
****************************************************************************/
|
||||
|
||||
int GCMemROM();
|
||||
int GCMemROM(int method);
|
||||
|
@ -41,9 +41,7 @@
|
||||
|
||||
extern u32 iNESGameCRC32;
|
||||
extern CartInfo iNESCart;
|
||||
|
||||
extern unsigned char savebuffer[SAVEBUFFERSIZE];
|
||||
extern char romFilename[];
|
||||
extern CartInfo UNIFCart;
|
||||
|
||||
int NGCFCEU_GameSave(CartInfo *LocalHWInfo, int operation)
|
||||
{
|
||||
@ -80,10 +78,14 @@ bool SaveRAM (int method, bool silent)
|
||||
|
||||
bool retval = false;
|
||||
char filepath[1024];
|
||||
int datasize;
|
||||
int datasize = 0;
|
||||
int offset = 0;
|
||||
|
||||
datasize = NGCFCEU_GameSave(&iNESCart, 0); // save game save to savebuffer
|
||||
// save game save to savebuffer
|
||||
if(nesGameType == 1)
|
||||
datasize = NGCFCEU_GameSave(&iNESCart, 0);
|
||||
else if(nesGameType == 2)
|
||||
datasize = NGCFCEU_GameSave(&UNIFCart, 0);
|
||||
|
||||
if ( datasize )
|
||||
{
|
||||
@ -137,9 +139,11 @@ bool LoadRAM (int method, bool silent)
|
||||
|
||||
if(method == METHOD_SD || method == METHOD_USB)
|
||||
{
|
||||
ChangeFATInterface(method, NOTSILENT);
|
||||
sprintf (filepath, "%s/%s/%s.sav", ROOTFATDIR, GCSettings.SaveFolder, romFilename);
|
||||
offset = LoadBufferFromFAT (filepath, silent);
|
||||
if(ChangeFATInterface(method, NOTSILENT))
|
||||
{
|
||||
sprintf (filepath, "%s/%s/%s.sav", ROOTFATDIR, GCSettings.SaveFolder, romFilename);
|
||||
offset = LoadSaveBufferFromFAT (filepath, silent);
|
||||
}
|
||||
}
|
||||
else if(method == METHOD_SMB)
|
||||
{
|
||||
@ -158,7 +162,11 @@ bool LoadRAM (int method, bool silent)
|
||||
|
||||
if (offset > 0)
|
||||
{
|
||||
NGCFCEU_GameSave(&iNESCart, 1); // load game save from savebuffer
|
||||
if(nesGameType == 1)
|
||||
NGCFCEU_GameSave(&iNESCart, 1);
|
||||
else if(nesGameType == 2)
|
||||
NGCFCEU_GameSave(&UNIFCart, 1);
|
||||
|
||||
ResetNES();
|
||||
return 1;
|
||||
}
|
||||
|
@ -52,9 +52,6 @@ extern u32 iNESGameCRC32;
|
||||
int sboffset; /*** Used as a basic fileptr ***/
|
||||
int mcversion = 0x981211;
|
||||
|
||||
extern unsigned char savebuffer[SAVEBUFFERSIZE];
|
||||
extern char romFilename[];
|
||||
|
||||
/****************************************************************************
|
||||
* Memory based file functions
|
||||
****************************************************************************/
|
||||
@ -62,7 +59,7 @@ extern char romFilename[];
|
||||
/*** Open a file ***/
|
||||
void memopen() {
|
||||
sboffset = 0;
|
||||
memset(savebuffer, 0, sizeof(savebuffer));
|
||||
memset(savebuffer, 0, SAVEBUFFERSIZE);
|
||||
}
|
||||
|
||||
/*** Close a file ***/
|
||||
@ -72,7 +69,7 @@ void memclose() {
|
||||
|
||||
/*** Write to the file ***/
|
||||
void memfwrite( void *buffer, int len ) {
|
||||
if ( (sboffset + len ) > sizeof(savebuffer))
|
||||
if ( (sboffset + len ) > SAVEBUFFERSIZE)
|
||||
WaitPrompt("Buffer Exceeded");
|
||||
|
||||
if ( len > 0 ) {
|
||||
@ -84,7 +81,7 @@ void memfwrite( void *buffer, int len ) {
|
||||
/*** Read from a file ***/
|
||||
void memfread( void *buffer, int len ) {
|
||||
|
||||
if ( ( sboffset + len ) > sizeof(savebuffer))
|
||||
if ( ( sboffset + len ) > SAVEBUFFERSIZE)
|
||||
WaitPrompt("Buffer exceeded");
|
||||
|
||||
if ( len > 0 ) {
|
||||
@ -334,13 +331,13 @@ bool LoadState (int method, bool silent)
|
||||
{
|
||||
ChangeFATInterface(method, NOTSILENT);
|
||||
sprintf (filepath, "%s/%s/%s.fcs", ROOTFATDIR, GCSettings.SaveFolder, romFilename);
|
||||
offset = LoadBufferFromFAT (filepath, silent);
|
||||
offset = LoadSaveBufferFromFAT (filepath, silent);
|
||||
|
||||
if(offset == 0) // file not found
|
||||
{
|
||||
// look for CRC save
|
||||
sprintf (filepath, "%08x.fcs", iNESGameCRC32);
|
||||
offset = LoadBufferFromFAT (filepath, silent);
|
||||
offset = LoadSaveBufferFromFAT (filepath, silent);
|
||||
}
|
||||
}
|
||||
else if(method == METHOD_SMB)
|
||||
|
@ -25,13 +25,6 @@
|
||||
|
||||
FILE * filehandle;
|
||||
|
||||
extern unsigned char savebuffer[];
|
||||
extern char output[16384];
|
||||
extern int offset;
|
||||
extern int selection;
|
||||
extern char currentdir[MAXPATHLEN];
|
||||
extern FILEENTRIES filelist[MAXFILES];
|
||||
|
||||
/****************************************************************************
|
||||
* fat_is_mounted
|
||||
* to check whether FAT media are detected.
|
||||
@ -190,9 +183,17 @@ LoadFATFile (char *filename, int length)
|
||||
{
|
||||
fread (zipbuffer, 1, 2048, handle);
|
||||
|
||||
if (IsZipFile (zipbuffer))
|
||||
int r = IsZipFile (zipbuffer);
|
||||
|
||||
if(r == 2) // 7z
|
||||
{
|
||||
size = UnZipFATFile (nesromptr, handle); // unzip from FAT
|
||||
WaitPrompt ((char *)"7z files are not supported!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (r)
|
||||
{
|
||||
size = UnZipFATFile (nesromptr, handle); // unzip from FAT
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -218,16 +219,22 @@ LoadFATFile (char *filename, int length)
|
||||
|
||||
/****************************************************************************
|
||||
* Load savebuffer from FAT file
|
||||
****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
// no buffer is specified - so use savebuffer
|
||||
int
|
||||
LoadBufferFromFAT (char *filepath, bool silent)
|
||||
LoadSaveBufferFromFAT (char *filepath, bool silent)
|
||||
{
|
||||
return LoadBufferFromFAT((char *)savebuffer, filepath, silent);
|
||||
}
|
||||
|
||||
int
|
||||
LoadBufferFromFAT (char * sbuffer, char *filepath, bool silent)
|
||||
{
|
||||
FILE *handle;
|
||||
int boffset = 0;
|
||||
int read = 0;
|
||||
|
||||
ClearSaveBuffer ();
|
||||
|
||||
handle = fopen (filepath, "rb");
|
||||
|
||||
if (handle <= 0)
|
||||
@ -275,7 +282,5 @@ SaveBufferToFAT (char *filepath, int datasize, bool silent)
|
||||
fwrite (savebuffer, 1, datasize, handle);
|
||||
fclose (handle);
|
||||
}
|
||||
|
||||
ClearSaveBuffer ();
|
||||
return datasize;
|
||||
}
|
||||
|
@ -26,7 +26,8 @@ bool ChangeFATInterface(int method, bool silent);
|
||||
int ParseFATdirectory(int method);
|
||||
int LoadFATFile (char *filename, int length);
|
||||
int SaveBufferToFAT (char *filepath, int datasize, bool silent);
|
||||
int LoadBufferFromFAT (char *filepath, bool silent);
|
||||
int LoadSaveBufferFromFAT (char *filepath, bool silent);
|
||||
int LoadBufferFromFAT (char * buffer, char *filepath, bool silent);
|
||||
|
||||
extern char currFATdir[MAXPATHLEN];
|
||||
|
||||
|
@ -34,6 +34,7 @@ int offset;
|
||||
int selection;
|
||||
char currentdir[MAXPATHLEN];
|
||||
char romFilename[200];
|
||||
int nesGameType;
|
||||
int maxfiles;
|
||||
extern int screenheight;
|
||||
|
||||
@ -46,7 +47,7 @@ int hasloaded = 0;
|
||||
// Global file entry table
|
||||
FILEENTRIES filelist[MAXFILES];
|
||||
|
||||
unsigned char savebuffer[SAVEBUFFERSIZE] ATTRIBUTE_ALIGN (32);
|
||||
unsigned char savebuffer[SAVEBUFFERSIZE];
|
||||
|
||||
/****************************************************************************
|
||||
* Clear the savebuffer
|
||||
@ -323,13 +324,14 @@ int FileSelector (int method)
|
||||
break;
|
||||
}
|
||||
|
||||
if (GCMemROM() >= 0)
|
||||
if (GCMemROM(method) > 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
WaitPrompt((char*) "Error loading ROM!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
redraw = 1;
|
||||
|
@ -12,6 +12,8 @@
|
||||
#ifndef _NGCFILESEL_
|
||||
#define _NGCFILESEL_
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#define SAVEBUFFERSIZE (64 * 1024)
|
||||
#define MAXJOLIET 255
|
||||
#define MAXDISPLAY 54
|
||||
@ -27,6 +29,14 @@ typedef struct
|
||||
|
||||
#define MAXFILES 2000 // Restrict to 2000 files per dir
|
||||
extern FILEENTRIES filelist[MAXFILES];
|
||||
extern bool isWii;
|
||||
extern int offset;
|
||||
extern int selection;
|
||||
extern char currentdir[MAXPATHLEN];
|
||||
extern int maxfiles;
|
||||
extern unsigned char savebuffer[];
|
||||
extern char romFilename[];
|
||||
extern int nesGameType;
|
||||
|
||||
void ClearSaveBuffer ();
|
||||
int OpenROM (int method);
|
||||
|
@ -44,7 +44,7 @@ void InitialiseSound()
|
||||
AUDIO_Init(NULL); /*** Start audio subsystem ***/
|
||||
AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ);
|
||||
AUDIO_RegisterDMACallback( AudioSwitchBuffers );
|
||||
|
||||
memset(audiobuffer, 0, (64 * 1024));
|
||||
buffSize[0] = buffSize[1] = 0;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
/*
|
||||
* PKWare Zip Header - adopted into zip standard
|
||||
*/
|
||||
#define PKZIPID 0x504b0304
|
||||
#define MAXROM 0x500000
|
||||
#define ZIPCHUNK 2048
|
||||
|
||||
@ -56,19 +55,27 @@ FLIP16 (u16 b)
|
||||
/****************************************************************************
|
||||
* IsZipFile
|
||||
*
|
||||
* Returns TRUE when PKZIPID is first four characters of buffer
|
||||
* Returns 1 when Zip signature is found
|
||||
* Returns 2 when 7z signature is found
|
||||
****************************************************************************/
|
||||
int
|
||||
IsZipFile (char *buffer)
|
||||
{
|
||||
unsigned int *check;
|
||||
|
||||
check = (unsigned int *) buffer;
|
||||
|
||||
if (check[0] == PKZIPID)
|
||||
if (check[0] == 0x504b0304) // ZIP file
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
// 7z signature
|
||||
static Byte Signature[6] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C};
|
||||
|
||||
int i;
|
||||
for(i = 0; i < 6; i++)
|
||||
if(buffer[i] != Signature[i])
|
||||
return 0;
|
||||
|
||||
return 2; // 7z archive found
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -228,7 +235,46 @@ UnZipSMBFile (unsigned char *outbuffer, SMBFILE infile)
|
||||
|
||||
/*
|
||||
* 7-zip functions are below. Have to be written to work with above.
|
||||
*
|
||||
else if (selection == 0 && inSz == true) {
|
||||
rootdir = filelist[1].offset;
|
||||
rootdirlength = filelist[1].length;
|
||||
offset = 0;
|
||||
maxfiles = parsedir();
|
||||
inSz = false;
|
||||
SzClose();
|
||||
}
|
||||
else if (inSz == false && SzDvdIsArchive(filelist[selection].offset) == SZ_OK) {
|
||||
// parse the 7zip file
|
||||
ShowAction("Found 7z");
|
||||
SzParse();
|
||||
if(SzRes == SZ_OK) {
|
||||
inSz = true;
|
||||
offset = selection = 0;
|
||||
} else {
|
||||
SzDisplayError(SzRes);
|
||||
}
|
||||
}
|
||||
else if (inSz == true) {
|
||||
// extract the selected ROM from the 7zip file to the buffer
|
||||
if(SzExtractROM(filelist[selection].offset, nesromptr) == true) {
|
||||
haverom = 1;
|
||||
inSz = false;
|
||||
|
||||
// go one directory up
|
||||
rootdir = filelist[1].offset;
|
||||
rootdirlength = filelist[1].length;
|
||||
offset = selection = 0;
|
||||
maxfiles = parsedir();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 7-zip functions are below. Have to be written to work with above.
|
||||
|
||||
|
||||
#include "7zCrc.h"
|
||||
@ -269,17 +315,6 @@ size_t SzOutSizeProcessed;
|
||||
CFileItem *SzF;
|
||||
char sz_buffer[2048];
|
||||
|
||||
// needed because there are no header files -.-
|
||||
//#include <sdcard.h>
|
||||
#define MAXFILES 1000
|
||||
#define MAXJOLIET 256
|
||||
|
||||
extern FILEENTRIES filelist[MAXFILES];
|
||||
|
||||
extern int selection;
|
||||
extern int maxfiles;
|
||||
extern int offset;
|
||||
|
||||
// the GC's dvd drive only supports offsets and length which are a multiply of 32 bytes
|
||||
// additionally the max length of a read is 2048 bytes
|
||||
// this function removes these limitations
|
||||
|
@ -22,10 +22,10 @@
|
||||
#include "menu.h"
|
||||
#include "memcardop.h"
|
||||
#include "fileop.h"
|
||||
#include "filesel.h"
|
||||
|
||||
#define VERIFBUFFERSIZE 65536
|
||||
static u8 SysArea[CARD_WORKAREA] ATTRIBUTE_ALIGN (32);
|
||||
extern unsigned char savebuffer[];
|
||||
unsigned char verifbuffer[VERIFBUFFERSIZE] ATTRIBUTE_ALIGN (32);
|
||||
card_dir CardDir;
|
||||
card_file CardFile;
|
||||
|
@ -76,9 +76,6 @@ LoadManager ()
|
||||
|
||||
if ( loadROM == 1 ) // if ROM was loaded
|
||||
{
|
||||
if(!GCMemROM()) // ROM was not valid
|
||||
return 0;
|
||||
|
||||
// load the RAM
|
||||
if (GCSettings.AutoLoad == 1)
|
||||
LoadRAM(GCSettings.SaveMethod, SILENT);
|
||||
@ -87,7 +84,6 @@ LoadManager ()
|
||||
|
||||
ResetNES();
|
||||
}
|
||||
|
||||
return loadROM;
|
||||
}
|
||||
|
||||
@ -527,16 +523,17 @@ GetButtonMap(u16 ctrlr_type, char* btn_name)
|
||||
return pressed;
|
||||
} // end getButtonMap()
|
||||
|
||||
int cfg_btns_count = 9;
|
||||
int cfg_btns_count = 10;
|
||||
char cfg_btns_menu[][50] = {
|
||||
"B - ",
|
||||
"A - ",
|
||||
"SELECT - ",
|
||||
"START - ",
|
||||
"UP - ",
|
||||
"DOWN - ",
|
||||
"LEFT - ",
|
||||
"RIGHT - ",
|
||||
"B - ",
|
||||
"A - ",
|
||||
"SELECT - ",
|
||||
"START - ",
|
||||
"UP - ",
|
||||
"DOWN - ",
|
||||
"LEFT - ",
|
||||
"RIGHT - ",
|
||||
"VS INSERT COIN - "
|
||||
"Return to previous"
|
||||
};
|
||||
|
||||
@ -583,7 +580,7 @@ ConfigureButtons (u16 ctrlr_type)
|
||||
while (quit == 0)
|
||||
{
|
||||
/*** Update Menu with Current ButtonMap ***/
|
||||
for (i=0; i<8; i++) // nes pad has 8 buttons to config (go thru them)
|
||||
for (i=0; i<MAXJP; i++) // nes pad has 8 buttons to config (plus VS coin insert)
|
||||
{
|
||||
// get current padmap button name to display
|
||||
for ( j=0;
|
||||
@ -616,6 +613,7 @@ ConfigureButtons (u16 ctrlr_type)
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
/*** Change button map ***/
|
||||
// wait for input
|
||||
memset (temp, 0, sizeof(temp));
|
||||
@ -627,7 +625,7 @@ ConfigureButtons (u16 ctrlr_type)
|
||||
break;
|
||||
|
||||
case -1: /*** Button B ***/
|
||||
case 8:
|
||||
case 9:
|
||||
/*** Return ***/
|
||||
quit = 1;
|
||||
break;
|
||||
|
@ -361,7 +361,7 @@ LoadPrefsFromMethod (int method)
|
||||
if(ChangeFATInterface(method, NOTSILENT))
|
||||
{
|
||||
sprintf (filepath, "%s/%s/%s", ROOTFATDIR, GCSettings.SaveFolder, PREFS_FILE_NAME);
|
||||
offset = LoadBufferFromFAT (filepath, SILENT);
|
||||
offset = LoadSaveBufferFromFAT (filepath, SILENT);
|
||||
}
|
||||
}
|
||||
else if(method == METHOD_SMB)
|
||||
|
@ -34,14 +34,6 @@ unsigned int SMBTimer = 0;
|
||||
SMBCONN smbconn;
|
||||
#define ZIPCHUNK 16384
|
||||
|
||||
extern unsigned char savebuffer[];
|
||||
extern char output[16384];
|
||||
extern int offset;
|
||||
extern int selection;
|
||||
extern char currentdir[MAXPATHLEN];
|
||||
extern FILEENTRIES filelist[MAXFILES];
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* InitializeNetwork
|
||||
* Initializes the Wii/GameCube network interface
|
||||
@ -289,7 +281,6 @@ SaveBufferToSMB (char *filepath, int datasize, bool silent)
|
||||
int
|
||||
LoadSaveBufferFromSMB (char *filepath, bool silent)
|
||||
{
|
||||
ClearSaveBuffer ();
|
||||
return LoadBufferFromSMB((char *)savebuffer, filepath, silent);
|
||||
}
|
||||
|
||||
@ -319,7 +310,15 @@ LoadBufferFromSMB (char * sbuffer, char *filepath, bool silent)
|
||||
|
||||
ret = SMB_ReadFile (sbuffer, 1024, boffset, smbfile);
|
||||
|
||||
if (IsZipFile (sbuffer))
|
||||
int r = IsZipFile (sbuffer);
|
||||
|
||||
if(r == 2) // 7z
|
||||
{
|
||||
WaitPrompt ((char *)"7z files are not supported!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (r)
|
||||
{
|
||||
boffset = UnZipSMBFile ((unsigned char *)sbuffer, smbfile); // unzip from SMB
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user