remove embedded rom - memory now allocated dynamically, fix VS coin on menu

This commit is contained in:
dborth 2008-10-01 06:03:16 +00:00
parent d8a3101bb0
commit 4ff5b30628
13 changed files with 48 additions and 48 deletions

View File

@ -35,4 +35,4 @@ extern int eoptions;
#define EO_FORCEISCALE 16384 #define EO_FORCEISCALE 16384
#define EO_NOFOURSCORE 32768 #define EO_NOFOURSCORE 32768
extern unsigned char * nesromptr; extern unsigned char * nesrom;

View File

@ -34,7 +34,7 @@
#include <di/di.h> #include <di/di.h>
#endif #endif
extern unsigned char nesrom[]; unsigned char * nesrom = NULL;
extern bool romLoaded; extern bool romLoaded;
bool isWii; bool isWii;
@ -77,6 +77,9 @@ int main(int argc, char *argv[])
DVD_Init(); DVD_Init();
#endif #endif
// allocate memory to store rom
nesrom = (unsigned char *)malloc(1024*1024*3); // 3 MB should be plenty
/*** Minimal Emulation Loop ***/ /*** Minimal Emulation Loop ***/
if ( !FCEUI_Initialize() ) { if ( !FCEUI_Initialize() ) {
printf("Unable to initialize system\n"); printf("Unable to initialize system\n");
@ -88,7 +91,6 @@ int main(int argc, char *argv[])
memset(FDSBIOS, 0, sizeof(FDSBIOS)); // clear FDS BIOS memory memset(FDSBIOS, 0, sizeof(FDSBIOS)); // clear FDS BIOS memory
cleanSFMDATA(); // clear state data cleanSFMDATA(); // clear state data
nesromptr = &nesrom[0]; // address of embedded color test ROM
// Set Defaults // Set Defaults
DefaultSettings(); DefaultSettings();

View File

@ -32,7 +32,7 @@
#include "filesel.h" #include "filesel.h"
#include "smbop.h" #include "smbop.h"
unsigned char *nesromptr; unsigned char *nesrom;
bool romLoaded = false; bool romLoaded = false;
extern FCEUGI *FCEUGameInfo; extern FCEUGI *FCEUGameInfo;
@ -99,7 +99,7 @@ int GCMemROM(method)
InitialisePads(); InitialisePads();
MakeFCEUFile((char *)nesromptr, filelist[selection].length); MakeFCEUFile((char *)nesrom, filelist[selection].length);
nesGameType = 0; nesGameType = 0;

View File

@ -193,7 +193,7 @@ LoadFATFile (char *filename, int length)
if (r) if (r)
{ {
size = UnZipFATFile (nesromptr, handle); // unzip from FAT size = UnZipFATFile (nesrom, handle); // unzip from FAT
} }
else else
{ {
@ -201,8 +201,8 @@ LoadFATFile (char *filename, int length)
fseek(handle, 0, SEEK_END); fseek(handle, 0, SEEK_END);
length = ftell(handle); // get filesize length = ftell(handle); // get filesize
fseek(handle, 2048, SEEK_SET); // seek back to point where we left off fseek(handle, 2048, SEEK_SET); // seek back to point where we left off
memcpy (nesromptr, zipbuffer, 2048); // copy what we already read memcpy (nesrom, zipbuffer, 2048); // copy what we already read
fread (nesromptr + 2048, 1, length - 2048, handle); fread (nesrom + 2048, 1, length - 2048, handle);
size = length; size = length;
} }
fclose (handle); fclose (handle);

View File

@ -38,12 +38,9 @@ int nesGameType;
int maxfiles; int maxfiles;
extern int screenheight; extern int screenheight;
int havedir = -1;
extern u64 dvddir; extern u64 dvddir;
extern int dvddirlength; extern int dvddirlength;
int hasloaded = 0;
// Global file entry table // Global file entry table
FILEENTRIES filelist[MAXFILES]; FILEENTRIES filelist[MAXFILES];
@ -315,7 +312,7 @@ int FileSelector (int method)
case METHOD_DVD: case METHOD_DVD:
dvddir = filelist[selection].offset; dvddir = filelist[selection].offset;
dvddirlength = filelist[selection].length; dvddirlength = filelist[selection].length;
LoadDVDFile (nesromptr); LoadDVDFile (nesrom);
break; break;
case METHOD_SMB: case METHOD_SMB:

View File

@ -10,6 +10,7 @@
****************************************************************************/ ****************************************************************************/
#include <gccore.h> #include <gccore.h>
#include <string.h>
#define SAMPLERATE 48000 #define SAMPLERATE 48000
unsigned char audiobuffer[2][64 * 1024] ATTRIBUTE_ALIGN(32); unsigned char audiobuffer[2][64 * 1024] ATTRIBUTE_ALIGN(32);
@ -44,7 +45,7 @@ void InitialiseSound()
AUDIO_Init(NULL); /*** Start audio subsystem ***/ AUDIO_Init(NULL); /*** Start audio subsystem ***/
AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ); AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ);
AUDIO_RegisterDMACallback( AudioSwitchBuffers ); AUDIO_RegisterDMACallback( AudioSwitchBuffers );
memset(audiobuffer, 0, (64 * 1024)); memset(audiobuffer, 0, (64 * 1024 * 2));
buffSize[0] = buffSize[1] = 0; buffSize[0] = buffSize[1] = 0;
} }

View File

@ -257,7 +257,7 @@ else if (inSz == false && SzDvdIsArchive(filelist[selection].offset) == SZ_OK) {
} }
else if (inSz == true) { else if (inSz == true) {
// extract the selected ROM from the 7zip file to the buffer // extract the selected ROM from the 7zip file to the buffer
if(SzExtractROM(filelist[selection].offset, nesromptr) == true) { if(SzExtractROM(filelist[selection].offset, nesrom) == true) {
haverom = 1; haverom = 1;
inSz = false; inSz = false;

View File

@ -525,15 +525,15 @@ GetButtonMap(u16 ctrlr_type, char* btn_name)
int cfg_btns_count = 10; int cfg_btns_count = 10;
char cfg_btns_menu[][50] = { char cfg_btns_menu[][50] = {
"B - ", "B - ",
"A - ", "A - ",
"SELECT - ", "SELECT - ",
"START - ", "START - ",
"UP - ", "UP - ",
"DOWN - ", "DOWN - ",
"LEFT - ", "LEFT - ",
"RIGHT - ", "RIGHT - ",
"VS INSERT COIN - " "INSERT COIN - ",
"Return to previous" "Return to previous"
}; };

View File

@ -1,7 +0,0 @@
.rodata
.globl nesrom
nesromsize: .long 1048592
.balign 32
nesrom:
.incbin "../source/ngc/rom/ROM.NES"

View File

@ -22,6 +22,9 @@
#include "menu.h" #include "menu.h"
#include "fceustate.h" #include "fceustate.h"
#include "fceuram.h" #include "fceuram.h"
#include "filesel.h"
extern bool romLoaded;
// Original NES controller buttons // Original NES controller buttons
// All other pads are mapped to this // All other pads are mapped to this
@ -89,27 +92,31 @@ void InitialisePads()
void ToggleFourScore(int set) void ToggleFourScore(int set)
{ {
FCEUI_DisableFourScore(set); if(romLoaded)
FCEUI_DisableFourScore(set);
} }
void ToggleZapper(int set) void ToggleZapper(int set)
{ {
// set defaults if(romLoaded)
zapperdata[0]=NULL;
zapperdata[1]=NULL;
myzappers[0][0]=myzappers[1][0]=128;
myzappers[0][1]=myzappers[1][1]=120;
myzappers[0][2]=myzappers[1][2]=0;
// Default ports back to gamepad
FCEUI_SetInput(0, SI_GAMEPAD, InputDPR, 0);
FCEUI_SetInput(1, SI_GAMEPAD, InputDPR, 0);
if(set)
{ {
// enable Zapper // set defaults
zapperdata[set-1] = FCEU_InitZapper(set-1); zapperdata[0]=NULL;
FCEUI_SetInput(set-1, SI_ZAPPER, myzappers[set-1], 1); zapperdata[1]=NULL;
myzappers[0][0]=myzappers[1][0]=128;
myzappers[0][1]=myzappers[1][1]=120;
myzappers[0][2]=myzappers[1][2]=0;
// Default ports back to gamepad
FCEUI_SetInput(0, SI_GAMEPAD, InputDPR, 0);
FCEUI_SetInput(1, SI_GAMEPAD, InputDPR, 0);
if(set)
{
// enable Zapper
zapperdata[set-1] = FCEU_InitZapper(set-1);
FCEUI_SetInput(set-1, SI_ZAPPER, myzappers[set-1], 1);
}
} }
} }

View File

@ -16,7 +16,7 @@
#define PI 3.14159265f #define PI 3.14159265f
#define PADCAL 50 #define PADCAL 50
#define MAXJP 8 #define MAXJP 9
extern unsigned int gcpadmap[]; extern unsigned int gcpadmap[];
extern unsigned int wmpadmap[]; extern unsigned int wmpadmap[];

Binary file not shown.

View File

@ -225,7 +225,7 @@ LoadSMBFile (char *filename, int length)
return -1; return -1;
} }
return LoadBufferFromSMB((char *)nesromptr, SMBPath(filepath), NOTSILENT); return LoadBufferFromSMB((char *)nesrom, SMBPath(filepath), NOTSILENT);
} }
/**************************************************************************** /****************************************************************************