mirror of
https://github.com/dborth/fceugx.git
synced 2024-12-04 22:34:14 +01:00
RAM save support, sound changes, code cleanup
This commit is contained in:
parent
7f7b2c2300
commit
6420f2178c
11
readme.txt
11
readme.txt
@ -17,6 +17,7 @@ SNES9x GX and Genesis Plus GX projects.
|
||||
|
||||
* Wiimote, Nunchuk, Classic, and Gamecube controller support
|
||||
* 1-2 Player Support
|
||||
* RAM and State saving
|
||||
* Custom controller configurations
|
||||
* SD, USB, DVD, SMB, GC Memory Card, and Zip support
|
||||
* NES Compatibility Based on v0.98.12
|
||||
@ -27,6 +28,16 @@ SNES9x GX and Genesis Plus GX projects.
|
||||
|0O×øo· UPDATE HISTORY ·oø×O0|
|
||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||
|
||||
[What's New 2.0.1]
|
||||
* 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
|
||||
* RAM game save support! Now you can save your games just like the NES did.
|
||||
By default game saves are saved/loaded automatically. This can be changed
|
||||
in the Preferences menu
|
||||
* Start/Select reversed mapping fixed for Wii controllers
|
||||
* Small bug fixes / improvements / tweaks
|
||||
|
||||
[What's New 2.0.0]
|
||||
|
||||
* Complete rewrite based on code from SNES9x GX and Genesis Plus GX
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 1998 BERO
|
||||
* Copyright (C) 1998 BERO
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -46,7 +46,7 @@ static uint8 *trainerpoo=0;
|
||||
static uint8 *ROM=NULL;
|
||||
static uint8 *VROM=NULL;
|
||||
|
||||
static CartInfo iNESCart;
|
||||
CartInfo iNESCart;
|
||||
|
||||
uint8 iNESMirroring;
|
||||
uint16 iNESCHRBankList[8];
|
||||
@ -66,7 +66,7 @@ int MapperNo = 0;
|
||||
|
||||
iNES_HEADER head;
|
||||
|
||||
/* MapperReset() is called when the NES is reset(with the reset button).
|
||||
/* MapperReset() is called when the NES is reset(with the reset button).
|
||||
Mapperxxx_init is called when the NES has been powered on.
|
||||
*/
|
||||
|
||||
@ -212,7 +212,7 @@ static void SetInput(void)
|
||||
}
|
||||
|
||||
struct CHINF {
|
||||
uint32 crc32;
|
||||
uint32 crc32;
|
||||
int32 mapper;
|
||||
int32 mirror;
|
||||
};
|
||||
@ -230,7 +230,7 @@ static void CheckHInfo(void)
|
||||
{
|
||||
0x498c10dc463cfe95LL, /* Battle Fleet */
|
||||
0x6917ffcaca2d8466LL, /* Famista '90 */
|
||||
|
||||
|
||||
0xd63dcc68c2b20adcLL, /* Final Fantasy J */
|
||||
0x012df596e2b31174LL, /* Final Fantasy 1+2 */
|
||||
0xf6b359a720549ecdLL, /* Final Fantasy 2 */
|
||||
@ -268,7 +268,7 @@ static void CheckHInfo(void)
|
||||
|
||||
0x94b9484862a26cbaLL, /* Legend of Zelda */
|
||||
0x04a31647de80fdabLL, /* "" */
|
||||
|
||||
|
||||
0x9aa1dc16c05e7de5LL, /* Startropics */
|
||||
0x1b084107d0878bd0LL, /* Startropics 2*/
|
||||
|
||||
@ -332,7 +332,7 @@ static void CheckHInfo(void)
|
||||
{0xf518dd58,7,8}, /* Captain Skyhawk */
|
||||
{0x7ccb12a3,43,-1}, /* SMB2j */
|
||||
{0x6f12afc5,235,-1}, /* Golden Game 150-in-1 */
|
||||
{0xccc03440,156,-1},
|
||||
{0xccc03440,156,-1},
|
||||
{0xc9ee15a7,3,-1}, /* 3 is probably best. 41 WILL NOT WORK. */
|
||||
|
||||
{0x3e1271d5,79,1}, /* Tiles of Fate */
|
||||
@ -360,7 +360,7 @@ static void CheckHInfo(void)
|
||||
{0x932ff06e,34,1}, /* Classic Concentration */
|
||||
{0x4c7c1af3,34,1}, /* Caesar's Palace */
|
||||
{0x9ea1dc76,2,0}, /* Rainbow Islands */
|
||||
|
||||
|
||||
{0x9eefb4b4,4,8}, /* Pachi Slot Adventure 2 */
|
||||
{0x5337f73c,4,8}, /* Niji no Silk Road */
|
||||
{0x7474ac92,4,8}, /* Kabuki: Quantum Fighter */
|
||||
@ -536,7 +536,7 @@ static void CheckHInfo(void)
|
||||
|
||||
/* Four-screen mirroring implicitly set. */
|
||||
if(MapperNo==99)
|
||||
Mirroring=2;
|
||||
Mirroring=2;
|
||||
|
||||
if(tofix)
|
||||
{
|
||||
@ -550,7 +550,7 @@ static void CheckHInfo(void)
|
||||
sprintf(gigastr+strlen(gigastr),"Mirroring should be set to \"%s\". ",mstr[Mirroring&3]);
|
||||
}
|
||||
if(tofix&4)
|
||||
strcat(gigastr,"The battery-backed bit should be set. ");
|
||||
strcat(gigastr,"The battery-backed bit should be set. ");
|
||||
if(tofix&8)
|
||||
strcat(gigastr,"This game should not have any CHR ROM. ");
|
||||
strcat(gigastr,"\n");
|
||||
@ -614,8 +614,8 @@ int iNESLoad(const char *name, FCEUFILE *fp)
|
||||
|
||||
if(!(ROM=(uint8 *)FCEU_malloc(ROM_size<<14)))
|
||||
return 0;
|
||||
|
||||
if (VROM_size)
|
||||
|
||||
if (VROM_size)
|
||||
if(!(VROM=(uint8 *)FCEU_malloc(VROM_size<<13)))
|
||||
{
|
||||
free(ROM);
|
||||
@ -641,7 +641,7 @@ int iNESLoad(const char *name, FCEUFILE *fp)
|
||||
if(VROM_size)
|
||||
FCEU_fread(VROM,0x2000,head.VROM_size,fp);
|
||||
|
||||
md5_starts(&md5);
|
||||
md5_starts(&md5);
|
||||
md5_update(&md5,ROM,ROM_size<<14);
|
||||
|
||||
iNESGameCRC32=CalcCRC32(0,ROM,ROM_size<<14);
|
||||
@ -662,7 +662,7 @@ int iNESLoad(const char *name, FCEUFILE *fp)
|
||||
{
|
||||
int x;
|
||||
FCEU_printf(" ROM MD5: 0x");
|
||||
for(x=0;x<16;x++)
|
||||
for(x=0;x<16;x++)
|
||||
FCEU_printf("%02x",iNESCart.MD5[x]);
|
||||
FCEU_printf("\n");
|
||||
}
|
||||
@ -679,7 +679,7 @@ int iNESLoad(const char *name, FCEUFILE *fp)
|
||||
for(x=0;x<8;x++)
|
||||
{
|
||||
partialmd5 |= (uint64)iNESCart.MD5[7-x] << (x*8);
|
||||
}
|
||||
}
|
||||
|
||||
FCEU_VSUniCheck(partialmd5, &MapperNo, &Mirroring);
|
||||
}
|
||||
@ -695,7 +695,7 @@ int iNESLoad(const char *name, FCEUFILE *fp)
|
||||
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;
|
||||
|
||||
@ -733,7 +733,7 @@ void FASTAPASS(2) VRAM_BANK1(uint32 A, uint8 V)
|
||||
CHRBankList[(A)>>10]=V;
|
||||
VPage[(A)>>10]=&CHRRAM[V<<10]-(A);
|
||||
}
|
||||
|
||||
|
||||
void FASTAPASS(2) VRAM_BANK4(uint32 A, uint32 V)
|
||||
{
|
||||
V&=1;
|
||||
@ -749,7 +749,7 @@ void FASTAPASS(2) VROM_BANK1(uint32 A,uint32 V)
|
||||
setchr1(A,V);
|
||||
CHRBankList[(A)>>10]=V;
|
||||
}
|
||||
|
||||
|
||||
void FASTAPASS(2) VROM_BANK2(uint32 A,uint32 V)
|
||||
{
|
||||
setchr2(A,V);
|
||||
@ -785,16 +785,16 @@ void FASTAPASS(2) ROM_BANK8(uint32 A, uint32 V)
|
||||
if(A>=0x8000)
|
||||
PRGBankList[((A-0x8000)>>13)]=V;
|
||||
}
|
||||
|
||||
|
||||
void FASTAPASS(2) ROM_BANK16(uint32 A, uint32 V)
|
||||
{
|
||||
setprg16(A,V);
|
||||
if(A>=0x8000)
|
||||
if(A>=0x8000)
|
||||
{
|
||||
PRGBankList[((A-0x8000)>>13)]=V<<1;
|
||||
PRGBankList[((A-0x8000)>>13)+1]=(V<<1)+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FASTAPASS(1) ROM_BANK32(uint32 V)
|
||||
{
|
||||
@ -834,7 +834,7 @@ static void NONE_init(void)
|
||||
ROM_BANK16(0x8000,0);
|
||||
ROM_BANK16(0xC000,~0);
|
||||
|
||||
if(VROM_size)
|
||||
if(VROM_size)
|
||||
VROM_BANK8(0);
|
||||
else
|
||||
setvram8(CHRRAM);
|
||||
@ -901,14 +901,14 @@ void (*MapStateRestore)(int version);
|
||||
void iNESStateRestore(int version)
|
||||
{
|
||||
int x;
|
||||
|
||||
|
||||
if(!MapperNo) return;
|
||||
|
||||
for(x=0;x<4;x++)
|
||||
setprg8(0x8000+x*8192,PRGBankList[x]);
|
||||
|
||||
if(VROM_size)
|
||||
for(x=0;x<8;x++)
|
||||
for(x=0;x<8;x++)
|
||||
setchr1(0x400*x,CHRBankList[x]);
|
||||
|
||||
if(0) switch(Mirroring)
|
||||
@ -963,7 +963,7 @@ static void iNESPower(void)
|
||||
if(head.ROM_type&8)
|
||||
AddExState(ExtraNTARAM, 2048, 0, "EXNR");
|
||||
|
||||
/* Exclude some mappers whose emulation code handle save state stuff
|
||||
/* Exclude some mappers whose emulation code handle save state stuff
|
||||
themselves. */
|
||||
if(type && type!=13 && type!=96)
|
||||
{
|
||||
@ -976,7 +976,7 @@ static void iNESPower(void)
|
||||
for(x=0;x<8;x++)
|
||||
{
|
||||
char tak[8];
|
||||
sprintf(tak,"CBL%d",x);
|
||||
sprintf(tak,"CBL%d",x);
|
||||
AddExState(&CHRBankList[x], 2, 1,tak);
|
||||
}
|
||||
}
|
||||
@ -990,7 +990,7 @@ static void iNESPower(void)
|
||||
|
||||
|
||||
typedef struct {
|
||||
int number;
|
||||
int number;
|
||||
void (*init)(CartInfo *);
|
||||
} BMAPPING;
|
||||
|
||||
@ -1017,8 +1017,8 @@ static BMAPPING bmap[] = {
|
||||
{116, Mapper116_Init},
|
||||
{118, Mapper118_Init},
|
||||
{119, Mapper119_Init}, /* Has CHR ROM and CHR RAM by default. Hmm. */
|
||||
{155, Mapper155_Init},
|
||||
{164, Mapper164_Init},
|
||||
{155, Mapper155_Init},
|
||||
{164, Mapper164_Init},
|
||||
{187, Mapper187_Init},
|
||||
{206, Mapper206_Init},
|
||||
{208, Mapper208_Init},
|
||||
@ -1068,8 +1068,8 @@ static BMAPPING bmap[] = {
|
||||
{242, Mapper242_init},
|
||||
//252.c
|
||||
{252, Mapper252_Init},
|
||||
|
||||
|
||||
|
||||
|
||||
{0,0}
|
||||
};
|
||||
|
||||
@ -1109,10 +1109,10 @@ 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;
|
||||
|
||||
@ -1157,8 +1157,8 @@ int iNESMemLoad(char *nesrom)
|
||||
|
||||
if(!(ROM=(uint8 *)FCEU_malloc(ROM_size<<14)))
|
||||
return 0;
|
||||
|
||||
if (VROM_size)
|
||||
|
||||
if (VROM_size)
|
||||
if(!(VROM=(uint8 *)FCEU_malloc(VROM_size<<13)))
|
||||
{
|
||||
free(ROM);
|
||||
@ -1184,14 +1184,14 @@ int iNESMemLoad(char *nesrom)
|
||||
//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_starts(&md5);
|
||||
md5_update(&md5,ROM,ROM_size<<14);
|
||||
|
||||
iNESGameCRC32=CalcCRC32(0,ROM,ROM_size<<14);
|
||||
@ -1217,7 +1217,7 @@ int iNESMemLoad(char *nesrom)
|
||||
for(x=0;x<8;x++)
|
||||
{
|
||||
partialmd5 |= (uint64)iNESCart.MD5[7-x] << (x*8);
|
||||
}
|
||||
}
|
||||
|
||||
FCEU_VSUniCheck(partialmd5, &MapperNo, &Mirroring);
|
||||
}
|
||||
@ -1234,7 +1234,7 @@ int iNESMemLoad(char *nesrom)
|
||||
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;
|
||||
|
||||
|
@ -1,7 +0,0 @@
|
||||
.rodata
|
||||
.globl nesrom
|
||||
nesromsize: .long 1048592
|
||||
.balign 32
|
||||
nesrom:
|
||||
.incbin "../source/fceultra/rom/ROM.NES"
|
||||
|
@ -34,8 +34,8 @@ DefaultSettings ()
|
||||
sprintf (GCSettings.LoadFolder,"fceugx/roms"); // Path to game files
|
||||
sprintf (GCSettings.SaveFolder,"fceugx/saves"); // Path to save files
|
||||
sprintf (GCSettings.CheatFolder,"fceugx/cheats"); // Path to cheat files
|
||||
GCSettings.AutoLoad = 0;
|
||||
GCSettings.AutoSave = 0;
|
||||
GCSettings.AutoLoad = 1; // Auto Load RAM
|
||||
GCSettings.AutoSave = 1; // Auto Save RAM
|
||||
|
||||
// default SMB settings
|
||||
strncpy (GCSettings.smbip, "192.168.0.1", 15); // IP Address of share server
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
void DefaultSettings ();
|
||||
|
||||
#define VERSIONNUM "2.0.0"
|
||||
#define VERSIONSTR "FCEUGX 2.0.0"
|
||||
#define VERSIONNUM "2.0.1"
|
||||
#define VERSIONSTR "FCE Ultra GX 2.0.1"
|
||||
|
||||
#define NOTSILENT 0
|
||||
#define SILENT 1
|
||||
|
@ -36,32 +36,10 @@
|
||||
extern bool romLoaded;
|
||||
bool isWii;
|
||||
|
||||
/* Some timing-related variables. */
|
||||
static int fullscreen=0;
|
||||
static int genie=0;
|
||||
|
||||
static volatile int nofocus=0;
|
||||
static volatile int userpause=0;
|
||||
|
||||
#define SO_FORCE8BIT 1
|
||||
#define SO_SECONDARY 2
|
||||
#define SO_GFOCUS 4
|
||||
#define SO_D16VOL 8
|
||||
|
||||
#define GOO_DISABLESS 1 /* Disable screen saver when game is loaded. */
|
||||
#define GOO_CONFIRMEXIT 2 /* Confirmation before exiting. */
|
||||
#define GOO_POWERRESET 4 /* Confirm on power/reset. */
|
||||
|
||||
static int soundvolume=100;
|
||||
static int soundquality=0;
|
||||
static int soundo;
|
||||
|
||||
uint8 *xbsave=NULL;
|
||||
int eoptions=EO_BGRUN | EO_FORCEISCALE;
|
||||
|
||||
extern int cleanSFMDATA();
|
||||
extern void ResetNES(void);
|
||||
long long basetime;
|
||||
|
||||
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);
|
||||
|
||||
@ -103,12 +81,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
FCEUI_SetVidSystem(0); // 0 - NTSC, 1 - PAL
|
||||
genie&=1;
|
||||
FCEUI_SetGameGenie(genie);
|
||||
fullscreen&=1;
|
||||
soundo&=1;
|
||||
FCEUI_SetSoundVolume(soundvolume);
|
||||
FCEUI_SetSoundQuality(soundquality);
|
||||
|
||||
FCEUI_SetGameGenie(0); // 0 - OFF, 1 - ON
|
||||
FCEUI_SetSoundVolume(100); // 0-100
|
||||
FCEUI_SetSoundQuality(1); // 0 - low, 1 - high
|
||||
|
||||
cleanSFMDATA();
|
||||
GCMemROM();
|
||||
@ -188,4 +164,10 @@ void FCEUD_NetworkClose(void)
|
||||
void FCEUD_NetplayText(uint8 *text)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
void FCEUI_SaveExtraDataUnderBase(int a);
|
||||
If "a" is nonzero, save extra non-volatile game data(battery-backed
|
||||
RAM) under FCE Ultra's base directory. Otherwise, the behavior is
|
||||
to save it under the same directory the game is located in(this is
|
||||
the default behavior).
|
||||
*/
|
||||
|
@ -60,7 +60,7 @@ int GCMemROM()
|
||||
|
||||
/*** Set internal sound information ***/
|
||||
FCEUI_Sound(SAMPLERATE);
|
||||
FCEUI_SetSoundQuality(0);
|
||||
FCEUI_SetSoundQuality(1);
|
||||
FCEUI_SetSoundVolume(100);
|
||||
FCEUI_SetLowPass(0);
|
||||
|
||||
|
171
source/ngc/fceuram.c
Normal file
171
source/ngc/fceuram.c
Normal file
@ -0,0 +1,171 @@
|
||||
/****************************************************************************
|
||||
* FCE Ultra 0.98.12
|
||||
* Nintendo Wii/Gamecube Port
|
||||
*
|
||||
* Tantric September 2008
|
||||
*
|
||||
* fceustate.c
|
||||
*
|
||||
* Memory Based Load/Save RAM Manager
|
||||
*
|
||||
* These are the battery-backed RAM (save data) routines, brought together
|
||||
* as GCxxxxx
|
||||
* The original file I/O is replaced with Memory Read/Writes to the
|
||||
* savebuffer below
|
||||
****************************************************************************/
|
||||
|
||||
#include <gccore.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <fat.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include "fceu.h"
|
||||
#include "ppu.h"
|
||||
|
||||
#include "cart.h"
|
||||
#include "memory.h"
|
||||
#include "x6502.h"
|
||||
|
||||
#include "general.h"
|
||||
|
||||
#include "fceuconfig.h"
|
||||
#include "intl.h"
|
||||
#include "menudraw.h"
|
||||
#include "filesel.h"
|
||||
#include "memcardop.h"
|
||||
#include "fileop.h"
|
||||
#include "smbop.h"
|
||||
|
||||
extern u32 iNESGameCRC32;
|
||||
extern CartInfo iNESCart;
|
||||
|
||||
extern unsigned char savebuffer[SAVEBUFFERSIZE];
|
||||
extern char romFilename[];
|
||||
|
||||
int NGCFCEU_GameSave(CartInfo *LocalHWInfo, int operation)
|
||||
{
|
||||
int size = 0;
|
||||
if(LocalHWInfo->battery && LocalHWInfo->SaveGame[0])
|
||||
{
|
||||
int x;
|
||||
|
||||
for(x=0;x<4;x++)
|
||||
{
|
||||
if(LocalHWInfo->SaveGame[x])
|
||||
{
|
||||
if(operation == 0) // save to file
|
||||
{
|
||||
memcpy(savebuffer, LocalHWInfo->SaveGame[x], LocalHWInfo->SaveGameLen[x]);
|
||||
}
|
||||
else // load from file
|
||||
{
|
||||
memcpy(LocalHWInfo->SaveGame[x], savebuffer, LocalHWInfo->SaveGameLen[x]);
|
||||
}
|
||||
size += LocalHWInfo->SaveGameLen[x];
|
||||
}
|
||||
}
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
bool SaveRAM (int method, bool silent)
|
||||
{
|
||||
ShowAction ((char*) "Saving...");
|
||||
|
||||
if(method == METHOD_AUTO)
|
||||
method = autoSaveMethod();
|
||||
|
||||
bool retval = false;
|
||||
char filepath[1024];
|
||||
int datasize;
|
||||
int offset = 0;
|
||||
|
||||
datasize = NGCFCEU_GameSave(&iNESCart, 0); // save game save to savebuffer
|
||||
|
||||
if ( datasize )
|
||||
{
|
||||
if(method == METHOD_SD || method == METHOD_USB)
|
||||
{
|
||||
if(ChangeFATInterface(method, NOTSILENT))
|
||||
{
|
||||
sprintf (filepath, "%s/%s/%s.sav", ROOTFATDIR, GCSettings.SaveFolder, romFilename);
|
||||
offset = SaveBufferToFAT (filepath, datasize, silent);
|
||||
}
|
||||
}
|
||||
else if(method == METHOD_SMB)
|
||||
{
|
||||
sprintf (filepath, "%s/%s.sav", GCSettings.SaveFolder, romFilename);
|
||||
offset = SaveBufferToSMB (filepath, datasize, silent);
|
||||
}
|
||||
else if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB)
|
||||
{
|
||||
sprintf (filepath, "%08x.sav", iNESGameCRC32);
|
||||
|
||||
if(method == METHOD_MC_SLOTA)
|
||||
offset = SaveBufferToMC (savebuffer, CARD_SLOTA, filepath, datasize, silent);
|
||||
else
|
||||
offset = SaveBufferToMC (savebuffer, CARD_SLOTB, filepath, datasize, silent);
|
||||
}
|
||||
|
||||
if (offset > 0)
|
||||
{
|
||||
if ( !silent )
|
||||
WaitPrompt((char *)"Save successful");
|
||||
retval = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !silent )
|
||||
WaitPrompt((char *)"No data to save!");
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool LoadRAM (int method, bool silent)
|
||||
{
|
||||
ShowAction ((char*) "Loading...");
|
||||
|
||||
if(method == METHOD_AUTO)
|
||||
method = autoSaveMethod(); // we use 'Save' because we need R/W
|
||||
|
||||
char filepath[1024];
|
||||
int offset = 0;
|
||||
|
||||
if(method == METHOD_SD || method == METHOD_USB)
|
||||
{
|
||||
ChangeFATInterface(method, NOTSILENT);
|
||||
sprintf (filepath, "%s/%s/%s.sav", ROOTFATDIR, GCSettings.SaveFolder, romFilename);
|
||||
offset = LoadBufferFromFAT (filepath, silent);
|
||||
}
|
||||
else if(method == METHOD_SMB)
|
||||
{
|
||||
sprintf (filepath, "%s/%s.sav", GCSettings.SaveFolder, romFilename);
|
||||
offset = LoadSaveBufferFromSMB (filepath, silent);
|
||||
}
|
||||
else if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB)
|
||||
{
|
||||
sprintf (filepath, "%08x.sav", iNESGameCRC32);
|
||||
|
||||
if(method == METHOD_MC_SLOTA)
|
||||
offset = LoadBufferFromMC (savebuffer, CARD_SLOTA, filepath, silent);
|
||||
else
|
||||
offset = LoadBufferFromMC (savebuffer, CARD_SLOTB, filepath, silent);
|
||||
}
|
||||
|
||||
if (offset > 0)
|
||||
{
|
||||
NGCFCEU_GameSave(&iNESCart, 1); // load game save from savebuffer
|
||||
ResetNES();
|
||||
return 1;
|
||||
}
|
||||
|
||||
// if we reached here, nothing was done!
|
||||
if(!silent)
|
||||
WaitPrompt ((char*) "Save file not found");
|
||||
|
||||
return 0;
|
||||
}
|
13
source/ngc/fceuram.h
Normal file
13
source/ngc/fceuram.h
Normal file
@ -0,0 +1,13 @@
|
||||
/****************************************************************************
|
||||
* FCE Ultra 0.98.12
|
||||
* Nintendo Wii/Gamecube Port
|
||||
*
|
||||
* Tantric September 2008
|
||||
*
|
||||
* fceuram.h
|
||||
*
|
||||
* Memory Based Load/Save RAM Manager
|
||||
****************************************************************************/
|
||||
|
||||
bool SaveRAM (int method, bool silent);
|
||||
bool LoadRAM (int method, bool silent);
|
@ -325,7 +325,7 @@ bool LoadState (int method, bool silent)
|
||||
ShowAction ((char*) "Loading...");
|
||||
|
||||
if(method == METHOD_AUTO)
|
||||
method = autoSaveMethod(); // we use 'Save' because SRAM needs R/W
|
||||
method = autoSaveMethod(); // we use 'Save' because we need R/W
|
||||
|
||||
char filepath[1024];
|
||||
int offset = 0;
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "fceustate.h"
|
||||
#include "gcvideo.h"
|
||||
#include "preferences.h"
|
||||
#include "fceuram.h"
|
||||
|
||||
extern int GCMemROM();
|
||||
extern void ResetNES(void);
|
||||
@ -78,9 +79,13 @@ LoadManager ()
|
||||
if(!GCMemROM()) // ROM was not valid
|
||||
return 0;
|
||||
|
||||
// load the state
|
||||
// load the RAM
|
||||
if (GCSettings.AutoLoad == 1)
|
||||
LoadRAM(GCSettings.SaveMethod, SILENT);
|
||||
else
|
||||
LoadState(GCSettings.SaveMethod, SILENT);
|
||||
|
||||
ResetNES();
|
||||
}
|
||||
|
||||
return loadROM;
|
||||
@ -276,10 +281,13 @@ PreferencesMenu ()
|
||||
prefmenu[3][0] = '\0';
|
||||
|
||||
if (GCSettings.AutoLoad == 0) sprintf (prefmenu[4],"Auto Load OFF");
|
||||
else if (GCSettings.AutoLoad == 1) sprintf (prefmenu[4],"Auto Load ON");
|
||||
else if (GCSettings.AutoLoad == 1) sprintf (prefmenu[4],"Auto Load RAM");
|
||||
else if (GCSettings.AutoLoad == 2) sprintf (prefmenu[4],"Auto Load STATE");
|
||||
|
||||
if (GCSettings.AutoSave == 0) sprintf (prefmenu[5],"Auto Save OFF");
|
||||
else if (GCSettings.AutoSave == 1) sprintf (prefmenu[5],"Auto Save ON");
|
||||
else if (GCSettings.AutoSave == 1) sprintf (prefmenu[5],"Auto Save RAM");
|
||||
else if (GCSettings.AutoSave == 2) sprintf (prefmenu[5],"Auto Save STATE");
|
||||
else if (GCSettings.AutoSave == 3) sprintf (prefmenu[5],"Auto Save BOTH");
|
||||
|
||||
sprintf (prefmenu[6], "Verify MC Saves %s",
|
||||
GCSettings.VerifySaves == true ? " ON" : "OFF");
|
||||
@ -304,13 +312,13 @@ PreferencesMenu ()
|
||||
|
||||
case 4:
|
||||
GCSettings.AutoLoad ++;
|
||||
if (GCSettings.AutoLoad > 1)
|
||||
if (GCSettings.AutoLoad > 2)
|
||||
GCSettings.AutoLoad = 0;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
GCSettings.AutoSave ++;
|
||||
if (GCSettings.AutoSave > 1)
|
||||
if (GCSettings.AutoSave > 3)
|
||||
GCSettings.AutoSave = 0;
|
||||
break;
|
||||
|
||||
@ -339,11 +347,12 @@ PreferencesMenu ()
|
||||
int
|
||||
GameMenu ()
|
||||
{
|
||||
int gamemenuCount = 6;
|
||||
int gamemenuCount = 8;
|
||||
char gamemenu[][50] = {
|
||||
"Return to Game",
|
||||
"Reset Game",
|
||||
"ROM Information",
|
||||
"Load RAM", "Save RAM",
|
||||
"Load State", "Save State",
|
||||
"Back to Main Menu"
|
||||
};
|
||||
@ -355,12 +364,21 @@ GameMenu ()
|
||||
|
||||
while (quit == 0)
|
||||
{
|
||||
// disable state saving/loading if AUTO is on
|
||||
|
||||
if (GCSettings.AutoLoad == 1) // Auto Load State
|
||||
// disable RAM/STATE saving/loading if AUTO is on
|
||||
if (GCSettings.AutoLoad == 1) // Auto Load RAM
|
||||
gamemenu[3][0] = '\0';
|
||||
if (GCSettings.AutoSave == 1) // Auto Save State
|
||||
else if (GCSettings.AutoLoad == 2) // Auto Load STATE
|
||||
gamemenu[5][0] = '\0';
|
||||
|
||||
if (GCSettings.AutoSave == 1) // Auto Save RAM
|
||||
gamemenu[4][0] = '\0';
|
||||
else if (GCSettings.AutoSave == 2) // Auto Save STATE
|
||||
gamemenu[6][0] = '\0';
|
||||
else if (GCSettings.AutoSave == 3) // Auto Save BOTH
|
||||
{
|
||||
gamemenu[4][0] = '\0';
|
||||
gamemenu[6][0] = '\0';
|
||||
}
|
||||
|
||||
ret = RunMenu (gamemenu, gamemenuCount, (char*)"Game Menu", 20, -1);
|
||||
|
||||
@ -380,16 +398,24 @@ GameMenu ()
|
||||
WaitButtonA ();
|
||||
break;
|
||||
|
||||
case 3: // Load State
|
||||
case 3: // Load RAM
|
||||
quit = retval = LoadRAM(GCSettings.SaveMethod, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 4: // Save RAM
|
||||
SaveRAM(GCSettings.SaveMethod, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 5: // Load State
|
||||
quit = retval = LoadState(GCSettings.SaveMethod, NOTSILENT);
|
||||
break;
|
||||
|
||||
case 4: // Save State
|
||||
case 6: // Save State
|
||||
SaveState(GCSettings.SaveMethod, NOTSILENT);
|
||||
break;
|
||||
|
||||
case -1: // Button B
|
||||
case 5: // Return to previous menu
|
||||
case 7: // Return to previous menu
|
||||
retval = 0;
|
||||
quit = 1;
|
||||
break;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <zlib.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
#include "fceuconfig.h"
|
||||
#include "gcvideo.h"
|
||||
#include "menudraw.h"
|
||||
#include "filesel.h"
|
||||
@ -421,7 +422,7 @@ DrawMenu (char items[][50], char *title, int maxitems, int selected, int fontsiz
|
||||
}
|
||||
|
||||
setfontsize (12);
|
||||
DrawText (510, screenheight - 40, (char *)"FCEUGX 2.0.0");
|
||||
DrawText (510, screenheight - 40, VERSIONSTR);
|
||||
|
||||
// Draw menu items
|
||||
|
||||
|
7
source/ngc/nesrom.s
Normal file
7
source/ngc/nesrom.s
Normal file
@ -0,0 +1,7 @@
|
||||
.rodata
|
||||
.globl nesrom
|
||||
nesromsize: .long 1048592
|
||||
.balign 32
|
||||
nesrom:
|
||||
.incbin "../source/ngc/rom/ROM.NES"
|
||||
|
Loading…
Reference in New Issue
Block a user