mirror of
https://github.com/dborth/fceugx.git
synced 2025-01-05 21:38:17 +01:00
remove embedded rom - memory now allocated dynamically, fix VS coin on menu
This commit is contained in:
parent
d8a3101bb0
commit
4ff5b30628
@ -35,4 +35,4 @@ extern int eoptions;
|
||||
#define EO_FORCEISCALE 16384
|
||||
#define EO_NOFOURSCORE 32768
|
||||
|
||||
extern unsigned char * nesromptr;
|
||||
extern unsigned char * nesrom;
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <di/di.h>
|
||||
#endif
|
||||
|
||||
extern unsigned char nesrom[];
|
||||
unsigned char * nesrom = NULL;
|
||||
extern bool romLoaded;
|
||||
bool isWii;
|
||||
|
||||
@ -77,6 +77,9 @@ int main(int argc, char *argv[])
|
||||
DVD_Init();
|
||||
#endif
|
||||
|
||||
// allocate memory to store rom
|
||||
nesrom = (unsigned char *)malloc(1024*1024*3); // 3 MB should be plenty
|
||||
|
||||
/*** Minimal Emulation Loop ***/
|
||||
if ( !FCEUI_Initialize() ) {
|
||||
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
|
||||
cleanSFMDATA(); // clear state data
|
||||
nesromptr = &nesrom[0]; // address of embedded color test ROM
|
||||
|
||||
// Set Defaults
|
||||
DefaultSettings();
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "filesel.h"
|
||||
#include "smbop.h"
|
||||
|
||||
unsigned char *nesromptr;
|
||||
unsigned char *nesrom;
|
||||
bool romLoaded = false;
|
||||
|
||||
extern FCEUGI *FCEUGameInfo;
|
||||
@ -99,7 +99,7 @@ int GCMemROM(method)
|
||||
|
||||
InitialisePads();
|
||||
|
||||
MakeFCEUFile((char *)nesromptr, filelist[selection].length);
|
||||
MakeFCEUFile((char *)nesrom, filelist[selection].length);
|
||||
|
||||
nesGameType = 0;
|
||||
|
||||
|
@ -193,7 +193,7 @@ LoadFATFile (char *filename, int length)
|
||||
|
||||
if (r)
|
||||
{
|
||||
size = UnZipFATFile (nesromptr, handle); // unzip from FAT
|
||||
size = UnZipFATFile (nesrom, handle); // unzip from FAT
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -201,8 +201,8 @@ LoadFATFile (char *filename, int length)
|
||||
fseek(handle, 0, SEEK_END);
|
||||
length = ftell(handle); // get filesize
|
||||
fseek(handle, 2048, SEEK_SET); // seek back to point where we left off
|
||||
memcpy (nesromptr, zipbuffer, 2048); // copy what we already read
|
||||
fread (nesromptr + 2048, 1, length - 2048, handle);
|
||||
memcpy (nesrom, zipbuffer, 2048); // copy what we already read
|
||||
fread (nesrom + 2048, 1, length - 2048, handle);
|
||||
size = length;
|
||||
}
|
||||
fclose (handle);
|
||||
|
@ -38,12 +38,9 @@ int nesGameType;
|
||||
int maxfiles;
|
||||
extern int screenheight;
|
||||
|
||||
int havedir = -1;
|
||||
extern u64 dvddir;
|
||||
extern int dvddirlength;
|
||||
|
||||
int hasloaded = 0;
|
||||
|
||||
// Global file entry table
|
||||
FILEENTRIES filelist[MAXFILES];
|
||||
|
||||
@ -315,7 +312,7 @@ int FileSelector (int method)
|
||||
case METHOD_DVD:
|
||||
dvddir = filelist[selection].offset;
|
||||
dvddirlength = filelist[selection].length;
|
||||
LoadDVDFile (nesromptr);
|
||||
LoadDVDFile (nesrom);
|
||||
break;
|
||||
|
||||
case METHOD_SMB:
|
||||
|
@ -10,6 +10,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <gccore.h>
|
||||
#include <string.h>
|
||||
|
||||
#define SAMPLERATE 48000
|
||||
unsigned char audiobuffer[2][64 * 1024] ATTRIBUTE_ALIGN(32);
|
||||
@ -44,7 +45,7 @@ void InitialiseSound()
|
||||
AUDIO_Init(NULL); /*** Start audio subsystem ***/
|
||||
AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ);
|
||||
AUDIO_RegisterDMACallback( AudioSwitchBuffers );
|
||||
memset(audiobuffer, 0, (64 * 1024));
|
||||
memset(audiobuffer, 0, (64 * 1024 * 2));
|
||||
buffSize[0] = buffSize[1] = 0;
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ else if (inSz == false && SzDvdIsArchive(filelist[selection].offset) == SZ_OK) {
|
||||
}
|
||||
else if (inSz == true) {
|
||||
// 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;
|
||||
inSz = false;
|
||||
|
||||
|
@ -525,15 +525,15 @@ GetButtonMap(u16 ctrlr_type, char* btn_name)
|
||||
|
||||
int cfg_btns_count = 10;
|
||||
char cfg_btns_menu[][50] = {
|
||||
"B - ",
|
||||
"A - ",
|
||||
"SELECT - ",
|
||||
"START - ",
|
||||
"UP - ",
|
||||
"DOWN - ",
|
||||
"LEFT - ",
|
||||
"RIGHT - ",
|
||||
"VS INSERT COIN - "
|
||||
"B - ",
|
||||
"A - ",
|
||||
"SELECT - ",
|
||||
"START - ",
|
||||
"UP - ",
|
||||
"DOWN - ",
|
||||
"LEFT - ",
|
||||
"RIGHT - ",
|
||||
"INSERT COIN - ",
|
||||
"Return to previous"
|
||||
};
|
||||
|
||||
|
@ -1,7 +0,0 @@
|
||||
.rodata
|
||||
.globl nesrom
|
||||
nesromsize: .long 1048592
|
||||
.balign 32
|
||||
nesrom:
|
||||
.incbin "../source/ngc/rom/ROM.NES"
|
||||
|
@ -22,6 +22,9 @@
|
||||
#include "menu.h"
|
||||
#include "fceustate.h"
|
||||
#include "fceuram.h"
|
||||
#include "filesel.h"
|
||||
|
||||
extern bool romLoaded;
|
||||
|
||||
// Original NES controller buttons
|
||||
// All other pads are mapped to this
|
||||
@ -89,27 +92,31 @@ void InitialisePads()
|
||||
|
||||
void ToggleFourScore(int set)
|
||||
{
|
||||
FCEUI_DisableFourScore(set);
|
||||
if(romLoaded)
|
||||
FCEUI_DisableFourScore(set);
|
||||
}
|
||||
|
||||
void ToggleZapper(int set)
|
||||
{
|
||||
// set defaults
|
||||
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)
|
||||
if(romLoaded)
|
||||
{
|
||||
// enable Zapper
|
||||
zapperdata[set-1] = FCEU_InitZapper(set-1);
|
||||
FCEUI_SetInput(set-1, SI_ZAPPER, myzappers[set-1], 1);
|
||||
// set defaults
|
||||
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
|
||||
zapperdata[set-1] = FCEU_InitZapper(set-1);
|
||||
FCEUI_SetInput(set-1, SI_ZAPPER, myzappers[set-1], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#define PI 3.14159265f
|
||||
#define PADCAL 50
|
||||
#define MAXJP 8
|
||||
#define MAXJP 9
|
||||
|
||||
extern unsigned int gcpadmap[];
|
||||
extern unsigned int wmpadmap[];
|
||||
|
Binary file not shown.
@ -225,7 +225,7 @@ LoadSMBFile (char *filename, int length)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return LoadBufferFromSMB((char *)nesromptr, SMBPath(filepath), NOTSILENT);
|
||||
return LoadBufferFromSMB((char *)nesrom, SMBPath(filepath), NOTSILENT);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user