mirror of
https://github.com/dborth/fceugx.git
synced 2025-01-07 14:28:18 +01:00
add game genie support, FDS BIOS and game genie ROM are set to load from fceugx/disksys.rom and fceugx/gg.rom
This commit is contained in:
parent
906517a7c0
commit
0a40d9f9c6
@ -293,7 +293,7 @@ void setchr8r(int r, unsigned int V)
|
|||||||
if(CHRram[r])
|
if(CHRram[r])
|
||||||
PPUCHRRAM|=(255);
|
PPUCHRRAM|=(255);
|
||||||
else
|
else
|
||||||
PPUCHRRAM=0;
|
PPUCHRRAM=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setchr1(unsigned int A, unsigned int V)
|
void setchr1(unsigned int A, unsigned int V)
|
||||||
@ -429,11 +429,15 @@ void SetupCartMirroring(int m, int hard, uint8 *extra)
|
|||||||
mirrorhard=hard;
|
mirrorhard=hard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef GEKKO
|
||||||
|
uint8 *GENIEROM=0;
|
||||||
|
#else
|
||||||
static uint8 *GENIEROM=0;
|
static uint8 *GENIEROM=0;
|
||||||
|
#endif
|
||||||
|
|
||||||
void FixGenieMap(void);
|
void FixGenieMap(void);
|
||||||
|
|
||||||
// Called when a game(file) is opened successfully.
|
// Called when a game(file) is opened successfully.
|
||||||
void OpenGenie(void)
|
void OpenGenie(void)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
@ -110,7 +110,11 @@ static void CloseGame(void)
|
|||||||
|
|
||||||
if(GameInfo->type!=GIT_NSF)
|
if(GameInfo->type!=GIT_NSF)
|
||||||
{
|
{
|
||||||
|
#ifdef GEKKO
|
||||||
|
FCEU_FlushGameCheats(0,1); // don't save cheats
|
||||||
|
#else
|
||||||
FCEU_FlushGameCheats(0,0);
|
FCEU_FlushGameCheats(0,0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
GameInterface(GI_CLOSE);
|
GameInterface(GI_CLOSE);
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
* Cheat handling
|
* Cheat handling
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <malloc.h>
|
||||||
|
|
||||||
#include "fceugx.h"
|
#include "fceugx.h"
|
||||||
#include "fceusupport.h"
|
#include "fceusupport.h"
|
||||||
#include "fileop.h"
|
#include "fileop.h"
|
||||||
@ -143,3 +145,50 @@ SetupCheats()
|
|||||||
|
|
||||||
FreeSaveBuffer ();
|
FreeSaveBuffer ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OpenGameGenie()
|
||||||
|
{
|
||||||
|
if (GENIEROM) // already loaded
|
||||||
|
{
|
||||||
|
geniestage=1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int romSize = 0;
|
||||||
|
char * tmpbuffer = (char *) memalign(32, 512 * 1024);
|
||||||
|
if(!tmpbuffer)
|
||||||
|
return;
|
||||||
|
char filepath[1024];
|
||||||
|
|
||||||
|
if (MakeFilePath(filepath, FILE_GGROM, GCSettings.LoadMethod))
|
||||||
|
{
|
||||||
|
romSize = LoadFile(tmpbuffer, filepath, 0, GCSettings.LoadMethod, SILENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (romSize > 0)
|
||||||
|
{
|
||||||
|
GENIEROM=(uint8 *)malloc(4096+1024);
|
||||||
|
|
||||||
|
if(tmpbuffer[0]==0x4E) /* iNES ROM image */
|
||||||
|
{
|
||||||
|
memcpy(GENIEROM,tmpbuffer+16,4096);
|
||||||
|
memcpy(GENIEROM+4096,tmpbuffer+16400,256);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memcpy(GENIEROM,tmpbuffer,4352);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Workaround for the FCE Ultra CHR page size only being 1KB */
|
||||||
|
for(int x=0; x<4; x++)
|
||||||
|
memcpy(GENIEROM+4096+(x<<8),GENIEROM+4096,256);
|
||||||
|
|
||||||
|
geniestage=1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
free(GENIEROM);
|
||||||
|
GENIEROM=0;
|
||||||
|
}
|
||||||
|
free(tmpbuffer);
|
||||||
|
}
|
||||||
|
@ -10,5 +10,6 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
void SetupCheats();
|
void SetupCheats();
|
||||||
|
void OpenGameGenie();
|
||||||
|
|
||||||
extern int numcheats;
|
extern int numcheats;
|
||||||
|
@ -274,7 +274,7 @@ int main(int argc, char *argv[])
|
|||||||
if (!FCEUI_Initialize())
|
if (!FCEUI_Initialize())
|
||||||
ExitApp();
|
ExitApp();
|
||||||
|
|
||||||
FCEUI_SetGameGenie(0); // 0 - OFF, 1 - ON
|
FCEUI_SetGameGenie(1); // 0 - OFF, 1 - ON
|
||||||
|
|
||||||
memset(FDSBIOS, 0, sizeof(FDSBIOS)); // clear FDS BIOS memory
|
memset(FDSBIOS, 0, sizeof(FDSBIOS)); // clear FDS BIOS memory
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ enum {
|
|||||||
FILE_STATE,
|
FILE_STATE,
|
||||||
FILE_ROM,
|
FILE_ROM,
|
||||||
FILE_FDSBIOS,
|
FILE_FDSBIOS,
|
||||||
|
FILE_GGROM,
|
||||||
FILE_CHEAT,
|
FILE_CHEAT,
|
||||||
FILE_PREF
|
FILE_PREF
|
||||||
};
|
};
|
||||||
|
@ -129,9 +129,9 @@ int GCMemROM(int method, int size)
|
|||||||
{
|
{
|
||||||
FCEU_ResetVidSys();
|
FCEU_ResetVidSys();
|
||||||
|
|
||||||
//if(GameInfo->type!=GIT_NSF)
|
if(GameInfo->type!=GIT_NSF)
|
||||||
// if(FSettings.GameGenie)
|
if(FSettings.GameGenie)
|
||||||
// OpenGenie();
|
OpenGameGenie();
|
||||||
PowerNES();
|
PowerNES();
|
||||||
|
|
||||||
//if(GameInfo->type!=GIT_NSF)
|
//if(GameInfo->type!=GIT_NSF)
|
||||||
|
@ -42,6 +42,7 @@ extern int iNESLoad(const char *name, FCEUFILE *fp, int o);
|
|||||||
extern int UNIFLoad(const char *name, FCEUFILE *fp);
|
extern int UNIFLoad(const char *name, FCEUFILE *fp);
|
||||||
extern int NSFLoad(FCEUFILE *fp);
|
extern int NSFLoad(FCEUFILE *fp);
|
||||||
extern uint8 FDSBIOS[8192];
|
extern uint8 FDSBIOS[8192];
|
||||||
|
extern uint8 *GENIEROM;
|
||||||
extern FCEUGI *GameInfo;
|
extern FCEUGI *GameInfo;
|
||||||
extern int CloseGame();
|
extern int CloseGame();
|
||||||
|
|
||||||
|
@ -269,9 +269,13 @@ bool MakeFilePath(char filepath[], int type, int method, char * filename, int fi
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case FILE_FDSBIOS:
|
case FILE_FDSBIOS:
|
||||||
sprintf(folder, GCSettings.LoadFolder);
|
sprintf(folder, "fceugx");
|
||||||
sprintf(file, "disksys.rom");
|
sprintf(file, "disksys.rom");
|
||||||
break;
|
break;
|
||||||
|
case FILE_GGROM:
|
||||||
|
sprintf(folder, "fceugx");
|
||||||
|
sprintf(file, "gg.rom");
|
||||||
|
break;
|
||||||
case FILE_CHEAT:
|
case FILE_CHEAT:
|
||||||
sprintf(folder, GCSettings.CheatFolder);
|
sprintf(folder, GCSettings.CheatFolder);
|
||||||
sprintf(file, "%s.cht", romFilename);
|
sprintf(file, "%s.cht", romFilename);
|
||||||
|
Loading…
Reference in New Issue
Block a user