Consolidate use of FCEUGI* globals GI, CurGame, and FCEUGameInfo into a single

GameInfo var. Still not very pretty, but at least there's only one of them and
the code compiles on Linux now.
This commit is contained in:
radsaq 2006-08-20 19:40:15 +00:00
parent 2dee2b9f59
commit e7d5aa6d29
36 changed files with 146 additions and 156 deletions

View File

@ -32,12 +32,12 @@ int offsetStringToInt(unsigned int type, const char* offsetBuffer)
}
else // CPU_BREAKPOINTS
{
if (GI->type == GIT_NSF) { //NSF Breakpoint keywords
if (GameInfo->type == GIT_NSF) { //NSF Breakpoint keywords
if (strcmp(offsetBuffer,"LOAD") == 0) return (NSFHeader.LoadAddressLow | (NSFHeader.LoadAddressHigh<<8));
if (strcmp(offsetBuffer,"INIT") == 0) return (NSFHeader.InitAddressLow | (NSFHeader.InitAddressHigh<<8));
if (strcmp(offsetBuffer,"PLAY") == 0) return (NSFHeader.PlayAddressLow | (NSFHeader.PlayAddressHigh<<8));
}
else if (GI->type == GIT_FDS) { //FDS Breakpoint keywords
else if (GameInfo->type == GIT_FDS) { //FDS Breakpoint keywords
if (strcmp(offsetBuffer,"NMI1") == 0) return (GetMem(0xDFF6) | (GetMem(0xDFF7)<<8));
if (strcmp(offsetBuffer,"NMI2") == 0) return (GetMem(0xDFF8) | (GetMem(0xDFF9)<<8));
if (strcmp(offsetBuffer,"NMI3") == 0) return (GetMem(0xDFFA) | (GetMem(0xDFFB)<<8));

View File

@ -116,7 +116,6 @@ public:
}
};
extern FCEUGI *GI;
extern NSF_HEADER NSFHeader;
///retrieves the core's DebuggerState

View File

@ -3,8 +3,6 @@
#include "input.h"
extern FCEUGI *CurGame;
extern CFGSTRUCT DriverConfig[];
extern ARGPSTRUCT DriverArgs[];
extern char *DriverUsage;

View File

@ -27,6 +27,7 @@
#include "sdl-video.h"
#include "../common/cheat.h"
#include "../../fceu.h"
/** GLOBALS **/
int NoWaiting=1;
@ -106,7 +107,7 @@ DoCheatSeq()
KillVideo();
DoConsoleCheatConfig();
InitVideo(CurGame);
InitVideo(GameInfo);
SilenceSound(0);
}
@ -445,7 +446,7 @@ ButtonConfigBegin()
static void
ButtonConfigEnd()
{
extern FCEUGI *CurGame;
extern FCEUGI *GameInfo;
// shutdown the joystick and video subsystems
KillJoysticks();
@ -453,7 +454,7 @@ ButtonConfigEnd()
// re-initialize joystick and video subsystems if they were active before
if(!bcpv) {
InitVideo(CurGame);
InitVideo(GameInfo);
}
if(!bcpj) {
InitJoysticks();

View File

@ -28,6 +28,7 @@
#include "sdl.h"
#include "sdl-opengl.h"
#include "../common/vidblit.h"
#include "../../fceu.h"
#include "sdl-icon.h"
#include "dface.h"
@ -322,7 +323,6 @@ void
ToggleFS()
{
int error;
extern FCEUGI *CurGame;
// shut down the current video system
KillVideo();
@ -331,11 +331,11 @@ ToggleFS()
_fullscreen = !_fullscreen;
// try to initialize the video
error = InitVideo(CurGame);
error = InitVideo(GameInfo);
if(error) {
// if we fail, just continue with what worked before
_fullscreen = !_fullscreen;
InitVideo(CurGame);
InitVideo(GameInfo);
}
}

View File

@ -15,6 +15,7 @@
#include "config.h"
#include "../common/cheat.h"
#include "../../fceu.h"
#include "input.h"
#include "dface.h"
@ -46,9 +47,6 @@ static void DriverKill(void);
static int DriverInitialize(FCEUGI *gi);
int gametype = 0;
FCEUGI *CurGame=NULL;
/**
* Prints an error string to STDOUT.
*/
@ -121,17 +119,14 @@ CloseStuff(int signum)
*/
int LoadGame(const char *path)
{
FCEUGI *tmp;
CloseGame();
if(!(tmp = FCEUI_LoadGame(path, 1))) {
if(!FCEUI_LoadGame(path, 1)) {
return 0;
}
CurGame = tmp;
ParseGIInput(tmp);
ParseGIInput(GameInfo);
RefreshThrottleFPS();
if(!DriverInitialize(tmp)) {
if(!DriverInitialize(GameInfo)) {
return(0);
}
if(soundrecfn) {
@ -158,7 +153,7 @@ CloseGame()
FCEUI_CloseGame();
DriverKill();
isloaded = 0;
CurGame = 0;
GameInfo = 0;
if(soundrecfn) {
FCEUI_EndWaveRecord();
@ -410,7 +405,7 @@ main(int argc,
}
// loop playing the game
while(CurGame) {
while(GameInfo) {
DoFun();
}
CloseGame();

View File

@ -45,6 +45,7 @@
#include <netdb.h>
#endif
#include "../../fceu.h"
#include "../../utils/md5.h"
#ifndef socklen_t
@ -159,13 +160,13 @@ int FCEUD_NetworkConnect(void)
uint8 md5out[16];
md5_starts(&md5);
md5_update(&md5, CurGame->MD5, 16);
md5_update(&md5, GameInfo->MD5, 16);
md5_update(&md5, (uint8 *)netgamekey, strlen(netgamekey));
md5_finish(&md5, md5out);
memcpy(sendbuf + 4, md5out, 16);
}
else
memcpy(sendbuf + 4, CurGame->MD5, 16);
memcpy(sendbuf + 4, GameInfo->MD5, 16);
if(netpassword)
{

View File

@ -211,11 +211,11 @@ void SaveCDLogFile(){ //todo make this button work before you've saved as
}
void DoCDLogger(){
if (!GI) {
if (!GameInfo) {
FCEUD_PrintError("You must have a game loaded before you can use the Code Data Logger.");
return;
}
if (GI->type==GIT_NSF) { //todo: NSF support!
if (GameInfo->type==GIT_NSF) { //todo: NSF support!
FCEUD_PrintError("Sorry, you can't yet use the Code Data Logger with NSFs.");
return;
}

View File

@ -488,11 +488,11 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
void ConfigCheats(HWND hParent) {
if (!GI) {
if (!GameInfo) {
FCEUD_PrintError("You must have a game loaded before you can manipulate cheats.");
return;
}
if (GI->type==GIT_NSF) {
if (GameInfo->type==GIT_NSF) {
FCEUD_PrintError("Sorry, you can't cheat with NSFs.");
return;
}

View File

@ -26,7 +26,6 @@ extern HWND hAppWnd;
extern HINSTANCE fceu_hInstance;
extern int NoWaiting;
extern FCEUGI *GI;
void DSMFix(UINT msg);
void StopSound(void);

View File

@ -974,7 +974,7 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
}
//these messages only get handled when a game is loaded
if (GI) {
if (GameInfo) {
switch(uMsg) {
case WM_VSCROLL:
//mbg merge 7/18/06 changed pausing check
@ -1354,6 +1354,6 @@ void DoDebug(uint8 halt) {
if (!debugger_open) hDebug = CreateDialog(fceu_hInstance,"DEBUGGER",NULL,DebuggerCallB);
if (hDebug) {
SetWindowPos(hDebug,HWND_TOP,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOOWNERZORDER);
if (GI) UpdateDebugger();
if (GameInfo) UpdateDebugger();
}
}

View File

@ -65,7 +65,7 @@ static int screenmode=0;
void InputScreenChanged(int fs)
{
int x;
if(GI)
if(GameInfo)
{
for(x=0;x<2;x++)
if(InputType[x]==SI_ZAPPER)
@ -1181,7 +1181,7 @@ static BOOL CALLBACK InputConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
void ConfigInput(HWND hParent)
{
DialogBox(fceu_hInstance,"INPUTCONFIG",hParent,InputConCallB);
if(GI)
if(GameInfo)
InitOtherInput();
}

View File

@ -31,7 +31,7 @@ typedef struct {
extern CFGSTRUCT InputConfig[];
extern ARGPSTRUCT InputArgs[];
void ParseGIInput(FCEUGI *GI);
void ParseGIInput(FCEUGI *GameInfo);
#define BUTTC_KEYBOARD 0x00
#define BUTTC_JOYSTICK 0x01

View File

@ -73,8 +73,6 @@ HINSTANCE fceu_hInstance;
HRESULT ddrval;
FCEUGI *GI=0;
// cheats, misc, nonvol, states, snaps, ..., base
static char *DOvers[6]={0,0,0,0,0,0};
static char *defaultds[5]={"cheats","sav","fcs","snaps","movie"};
@ -486,9 +484,9 @@ int main(int argc,char *argv[])
doloopy:
UpdateFCEUWindow();
if(GI)
if(GameInfo)
{
while(GI)
while(GameInfo)
{
uint8 *gfx=0;
int32 *sound=0;
@ -507,7 +505,7 @@ doloopy:
if(closeGame)
{
FCEUI_CloseGame();
GI = 0;
GameInfo = 0;
}

View File

@ -685,7 +685,7 @@ void InputData(char *input){
void ChangeMemViewFocus(int newEditingMode, int StartOffset,int EndOffset){
SCROLLINFO si;
if (GI->type==GIT_NSF) {
if (GameInfo->type==GIT_NSF) {
FCEUD_PrintError("Sorry, you can't yet use the Memory Viewer with NSFs.");
return;
}
@ -1469,11 +1469,11 @@ void DoMemView() {
WNDCLASSEX wndclass ;
//static RECT al;
if (!GI) {
if (!GameInfo) {
FCEUD_PrintError("You must have a game loaded before you can use the Memory Viewer.");
return;
}
if (GI->type==GIT_NSF) {
if (GameInfo->type==GIT_NSF) {
FCEUD_PrintError("Sorry, you can't yet use the Memory Viewer with NSFs.");
return;
}

View File

@ -260,13 +260,13 @@ int FCEUD_NetworkConnect(void)
uint8 md5out[16];
md5_starts(&md5);
md5_update(&md5, GI->MD5, 16);
md5_update(&md5, GameInfo->MD5, 16);
md5_update(&md5, (uint8*)netgamekey, strlen(netgamekey)); //mbg merge 7/17/06 added cast
md5_finish(&md5, md5out);
memcpy(sendbuf + 4, md5out, 16);
}
else
memcpy(sendbuf + 4, GI->MD5, 16);
memcpy(sendbuf + 4, GameInfo->MD5, 16);
if(netpassword)
{
@ -414,7 +414,7 @@ static BOOL CALLBACK NetCon(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
SetDlgItemText(hwndDlg,250,"Connect");
FixCDis(hwndDlg,1);
}
else if(GI)
else if(GameInfo)
{
GetSettings(hwndDlg);
if(FCEUD_NetworkConnect())

View File

@ -584,11 +584,11 @@ BOOL CALLBACK NTViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
void DoNTView() {
if (!GI) {
if (!GameInfo) {
FCEUD_PrintError("You must have a game loaded before you can use the Name Table Viewer.");
return;
}
if (GI->type==GIT_NSF) {
if (GameInfo->type==GIT_NSF) {
FCEUD_PrintError("Sorry, you can't use the Name Table Viewer with NSFs.");
return;
}

View File

@ -337,11 +337,11 @@ BOOL CALLBACK PPUViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
}
void DoPPUView() {
if(!GI) {
if(!GameInfo) {
FCEUD_PrintError("You must have a game loaded before you can use the PPU Viewer.");
return;
}
if(GI->type==GIT_NSF) {
if(GameInfo->type==GIT_NSF) {
FCEUD_PrintError("Sorry, you can't use the PPU Viewer with NSFs.");
return;
}

View File

@ -572,11 +572,11 @@ void ShowLogDirDialog(void){
void DoTracer(){
if (!GI) {
if (!GameInfo) {
FCEUD_PrintError("You must have a game loaded before you can use the Trace Logger.");
return;
}
if (GI->type==GIT_NSF) { //todo: NSF support!
if (GameInfo->type==GIT_NSF) { //todo: NSF support!
FCEUD_PrintError("Sorry, you can't yet use the Trace Logger with NSFs.");
return;
}

View File

@ -21,7 +21,7 @@
#include "state.cpp" /* Save/Load state AS */
extern char *md5_asciistr(uint8 digest[16]);
extern FCEUGI *FCEUGameInfo;
extern FCEUGI *GameInfo;
extern int EnableRewind;
void DSMFix(UINT msg)
@ -288,8 +288,7 @@ void HideFWindow(int h)
void ToggleHideMenu(void)
{
extern FCEUGI *FCEUGameInfo;
if(!fullscreen && (FCEUGameInfo || tog))
if(!fullscreen && (GameInfo || tog))
{
tog^=1;
HideMenu(tog);
@ -304,7 +303,7 @@ void FCEUD_HideMenuToggle(void)
static void ALoad(char *nameo)
{
if((GI=FCEUI_LoadGame(nameo,1)))
if(FCEUI_LoadGame(nameo,1))
{
palyo=FCEUI_GetCurrentVidSystem(0,0);
UpdateMenu();
@ -319,8 +318,8 @@ static void ALoad(char *nameo)
}
else
StopSound();
ParseGIInput(GI);
RedoMenuGI(GI);
ParseGIInput(GameInfo);
RedoMenuGI(GameInfo);
}
void LoadNewGamey(HWND hParent, char *initialdir)
@ -668,14 +667,14 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
case 100:StopSound();
LoadNewGamey(hWnd, 0);
break;
case 101:if(GI)
case 101:if(GameInfo)
{
#ifdef FCEUDEF_DEBUGGER
//KillDebugger(); //mbg merge 7/18/06 removed as part of old debugger
#endif
FCEUI_CloseGame();
GI=0;
RedoMenuGI(GI);
GameInfo=0;
RedoMenuGI(GameInfo);
}
break;
case 110:FCEUD_SaveStateAs();break;
@ -719,18 +718,18 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
case WM_SYSCOMMAND:
if(GI && wParam == SC_SCREENSAVE && (goptions & GOO_DISABLESS))
if(GameInfo && wParam == SC_SCREENSAVE && (goptions & GOO_DISABLESS))
return(0);
if(wParam==SC_KEYMENU)
{
if(GI && InputType[2]==SIFC_FKB && cidisabled)
if(GameInfo && InputType[2]==SIFC_FKB && cidisabled)
break;
if(lParam == VK_RETURN || fullscreen || tog) break;
}
goto proco;
case WM_SYSKEYDOWN:
if(GI && InputType[2]==SIFC_FKB && cidisabled)
if(GameInfo && InputType[2]==SIFC_FKB && cidisabled)
break; /* Hopefully this won't break DInput... */
if(fullscreen || tog)
@ -764,7 +763,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
goto proco;
case WM_KEYDOWN:
if(GI)
if(GameInfo)
{
/* Only disable command keys if a game is loaded(and the other
conditions are right, of course). */
@ -1620,7 +1619,7 @@ static void UpdateReplayDialog(HWND hwndDlg)
SetWindowText(GetDlgItem(hwndDlg,307),"FCEU 0.98.10 (blip)");
}
SetWindowText(GetDlgItem(hwndDlg,308),md5_asciistr(FCEUGameInfo->MD5));
SetWindowText(GetDlgItem(hwndDlg,308),md5_asciistr(GameInfo->MD5));
EnableWindow(GetDlgItem(hwndDlg,1),TRUE); // enable OK
doClear = 0;
@ -1644,7 +1643,7 @@ static void UpdateReplayDialog(HWND hwndDlg)
SetWindowText(GetDlgItem(hwndDlg,305),"");
SetWindowText(GetDlgItem(hwndDlg,306),"Nothing (invalid movie)");
SetWindowText(GetDlgItem(hwndDlg,307),"");
SetWindowText(GetDlgItem(hwndDlg,308),md5_asciistr(FCEUGameInfo->MD5));
SetWindowText(GetDlgItem(hwndDlg,308),md5_asciistr(GameInfo->MD5));
SetDlgItemText(hwndDlg,1003,"");
EnableWindow(GetDlgItem(hwndDlg,201),FALSE);
SendDlgItemMessage(hwndDlg,201,BM_SETCHECK,BST_UNCHECKED,0);
@ -1752,7 +1751,7 @@ static BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
char md51 [256];
char md52 [256];
if(fcm) strcpy(md51, md5_asciistr(FCEUGameInfo->MD5));
if(fcm) strcpy(md51, md5_asciistr(GameInfo->MD5));
if(fcm) strcpy(md52, md5_asciistr(info.md5_of_rom_used));
if(!fcm || strcmp(md51, md52))
{
@ -1912,7 +1911,7 @@ static BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
char szMd5Text[35];
GetDlgItemText(hwndDlg, 305, szMd5Text, 35);
if(!strlen(szMd5Text) || !strcmp(szMd5Text, "unknown") || !strcmp(szMd5Text, "00000000000000000000000000000000") || !strcmp(szMd5Text, md5_asciistr(FCEUGameInfo->MD5)))
if(!strlen(szMd5Text) || !strcmp(szMd5Text, "unknown") || !strcmp(szMd5Text, "00000000000000000000000000000000") || !strcmp(szMd5Text, md5_asciistr(GameInfo->MD5)))
SetTextColor(hdcStatic, RGB(0,0,0)); // use black color for a match (or no comparison)
else
SetTextColor(hdcStatic, RGB(255,0,0)); // use red for a mismatch

View File

@ -51,7 +51,7 @@
uint64 timestampbase;
FCEUGI *FCEUGameInfo = NULL;
FCEUGI *GameInfo = NULL;
void (*GameInterface)(int h);
void (*GameStateRestore)(int version);
@ -221,29 +221,29 @@ static DECLFR(ARAMH)
static void CloseGame(void)
{
if(FCEUGameInfo)
if(GameInfo)
{
if(FCEUnetplay)
FCEUD_NetworkClose();
FCEUI_StopMovie();
if(FCEUGameInfo->name)
if(GameInfo->name)
{
free(FCEUGameInfo->name);
FCEUGameInfo->name=0;
free(GameInfo->name);
GameInfo->name=0;
}
if(FCEUGameInfo->type!=GIT_NSF)
if(GameInfo->type!=GIT_NSF)
FCEU_FlushGameCheats(0,0);
GameInterface(GI_CLOSE);
ResetExState(0,0);
CloseGenie();
free(FCEUGameInfo);
FCEUGameInfo = 0;
free(GameInfo);
GameInfo = 0;
}
}
void ResetGameLoaded(void)
{
if(FCEUGameInfo) CloseGame();
if(GameInfo) CloseGame();
GameStateRestore=0;
PPU_hook=0;
GameHBIRQHook=0;
@ -278,17 +278,17 @@ FCEUGI *FCEUI_LoadGame(const char *name, int OverwriteVidMode)
RewindStatus[0] = RewindStatus[1] = 0;
RewindStatus[2] = RewindStatus[3] = 0;
FCEUGameInfo = (FCEUGI*)malloc(sizeof(FCEUGI));
memset(FCEUGameInfo, 0, sizeof(FCEUGI));
GameInfo = (FCEUGI*)malloc(sizeof(FCEUGI));
memset(GameInfo, 0, sizeof(FCEUGI));
FCEUGameInfo->soundchan = 0;
FCEUGameInfo->soundrate = 0;
FCEUGameInfo->name=0;
FCEUGameInfo->type=GIT_CART;
FCEUGameInfo->vidsys=GIV_USER;
FCEUGameInfo->input[0]=FCEUGameInfo->input[1]=-1;
FCEUGameInfo->inputfc=-1;
FCEUGameInfo->cspecial=0;
GameInfo->soundchan = 0;
GameInfo->soundrate = 0;
GameInfo->name=0;
GameInfo->type=GIT_CART;
GameInfo->vidsys=GIV_USER;
GameInfo->input[0]=GameInfo->input[1]=-1;
GameInfo->inputfc=-1;
GameInfo->cspecial=0;
FCEU_printf("Loading %s...\n\n",name);
@ -324,7 +324,7 @@ FCEUGI *FCEUI_LoadGame(const char *name, int OverwriteVidMode)
FCEU_ResetVidSys();
if(FCEUGameInfo->type!=GIT_NSF)
if(GameInfo->type!=GIT_NSF)
if(FSettings.GameGenie)
OpenGenie();
PowerNES();
@ -332,7 +332,7 @@ FCEUGI *FCEUI_LoadGame(const char *name, int OverwriteVidMode)
FCEUSS_CheckStates();
FCEUMOV_CheckMovies();
if(FCEUGameInfo->type!=GIT_NSF)
if(GameInfo->type!=GIT_NSF)
{
FCEU_LoadGamePalette();
FCEU_LoadGameCheats(0);
@ -343,7 +343,7 @@ FCEUGI *FCEUI_LoadGame(const char *name, int OverwriteVidMode)
strcpy(lastLoadedGameName, name);
return(FCEUGameInfo);
return GameInfo;
}
@ -505,7 +505,7 @@ void RestartMovieOrReset(int pow)
void ResetNES(void)
{
FCEUMOV_AddCommand(FCEUNPCMD_RESET);
if(!FCEUGameInfo) return;
if(!GameInfo) return;
GameInterface(GI_RESETM2);
FCEUSND_Reset();
FCEUPPU_Reset();
@ -538,7 +538,7 @@ void PowerNES(void)
{
if(!suppressAddPowerCommand)
FCEUMOV_AddCommand(FCEUNPCMD_POWER);
if(!FCEUGameInfo) return;
if(!GameInfo) return;
FCEU_CheatResetRAM();
FCEU_CheatAddRAM(2,0,RAM);
@ -565,7 +565,7 @@ void PowerNES(void)
Needed for the NSF code and VS System code.
*/
GameInterface(GI_POWER);
if(FCEUGameInfo->type==GIT_VSUNI)
if(GameInfo->type==GIT_VSUNI)
FCEU_VSUniPower();
timestampbase=0;
@ -580,9 +580,9 @@ void FCEU_ResetVidSys(void)
{
int w;
if(FCEUGameInfo->vidsys==GIV_NTSC)
if(GameInfo->vidsys==GIV_NTSC)
w=0;
else if(FCEUGameInfo->vidsys==GIV_PAL)
else if(GameInfo->vidsys==GIV_PAL)
w=1;
else
w=FSettings.PAL;
@ -642,7 +642,7 @@ void FCEUI_SetRenderedLines(int ntscf, int ntscl, int palf, int pall)
void FCEUI_SetVidSystem(int a)
{
FSettings.PAL=a?1:0;
if(FCEUGameInfo)
if(GameInfo)
{
FCEU_ResetVidSys();
FCEU_ResetPalette();

View File

@ -57,7 +57,7 @@ extern void (*GameStateRestore)(int version);
#define GI_CLOSE 3
#include "git.h"
extern FCEUGI *FCEUGameInfo;
extern FCEUGI *GameInfo;
extern int GameAttributes;
extern uint8 PAL;

View File

@ -723,7 +723,7 @@ static int SubLoad(FCEUFILE *fp)
FCEU_fread(diskdata[x],1,65500,fp);
md5_update(&md5,diskdata[x],65500);
}
md5_finish(&md5,FCEUGameInfo->MD5);
md5_finish(&md5,GameInfo->MD5);
return(1);
}
@ -816,7 +816,7 @@ int FDSLoad(const char *name, FCEUFILE *fp)
free(fn);
}
FCEUGameInfo->type=GIT_FDS;
GameInfo->type=GIT_FDS;
GameInterface=FDSGI;
SelectDisk=0;

View File

@ -602,7 +602,7 @@ void FCEUI_SetDirOverride(int which, char *n)
if(which < FCEUIOD__COUNT)
odirs[which]=n;
if(FCEUGameInfo) /* Rebuild cache of present states/movies. */
if(GameInfo) /* Rebuild cache of present states/movies. */
{
if(which==FCEUIOD_STATE)
FCEUSS_CheckStates();

View File

@ -260,9 +260,9 @@ static void SetInput(void)
{
if(moo[x].crc32==iNESGameCRC32)
{
FCEUGameInfo->input[0]=moo[x].input1;
FCEUGameInfo->input[1]=moo[x].input2;
FCEUGameInfo->inputfc=moo[x].inputfc;
GameInfo->input[0]=moo[x].input1;
GameInfo->input[1]=moo[x].input2;
GameInfo->inputfc=moo[x].inputfc;
break;
}
x++;
@ -630,7 +630,7 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
md5_update(&md5,VROM,VROM_size<<13);
}
md5_finish(&md5,iNESCart.MD5);
memcpy(FCEUGameInfo->MD5,iNESCart.MD5,sizeof(iNESCart.MD5));
memcpy(GameInfo->MD5,iNESCart.MD5,sizeof(iNESCart.MD5));
iNESCart.CRC32=iNESGameCRC32;
@ -725,7 +725,7 @@ int iNesSave(){
FILE *fp;
char name[2048];
if(FCEUGameInfo->type != GIT_CART)return 0;
if(GameInfo->type != GIT_CART)return 0;
if(GameInterface!=iNESGI)return 0;
strcpy(name,LoadedRomFName);
@ -1207,7 +1207,7 @@ static void iNESPower(void)
NONE_init();
ResetExState(0,0);
if(FCEUGameInfo->type == GIT_VSUNI)
if(GameInfo->type == GIT_VSUNI)
AddExState(FCEUVSUNI_STATEINFO, ~0, 0, 0);
AddExState(WRAM, 8192, 0, "WRAM");
@ -1425,7 +1425,7 @@ static int NewiNES_Init(int num)
{
BMAPPING *tmp=bmap;
if(FCEUGameInfo->type == GIT_VSUNI)
if(GameInfo->type == GIT_VSUNI)
AddExState(FCEUVSUNI_STATEINFO, ~0, 0, 0);
while(tmp->init)

View File

@ -268,7 +268,7 @@ void FCEU_UpdateInput(void)
FCExp->Update(InputDataPtrFC,JPAttribFC);
}
if(FCEUGameInfo->type==GIT_VSUNI)
if(GameInfo->type==GIT_VSUNI)
if(coinon) coinon--;
if(FCEUnetplay)
@ -276,7 +276,7 @@ void FCEU_UpdateInput(void)
FCEUMOV_AddJoy(joy, BotMode);
if(FCEUGameInfo->type==GIT_VSUNI)
if(GameInfo->type==GIT_VSUNI)
FCEU_VSUniSwap(&joy[0],&joy[1]);
}
@ -330,7 +330,7 @@ static void FASTAPASS(1) SetInputStuff(int x)
switch(JPType[x])
{
case SI_GAMEPAD:
if(FCEUGameInfo->type==GIT_VSUNI)
if(GameInfo->type==GIT_VSUNI)
JPorts[x] = &GPCVS;
else
JPorts[x]=&GPC;
@ -391,7 +391,7 @@ void InitializeInput(void)
memset(joy,0,sizeof(joy));
LastStrobe = 0;
if(FCEUGameInfo->type==GIT_VSUNI)
if(GameInfo->type==GIT_VSUNI)
{
SetReadHandler(0x4016,0x4016,VSUNIRead0);
SetReadHandler(0x4017,0x4017,VSUNIRead1);
@ -678,7 +678,7 @@ static void CommandUnImpl(void)
static void CommandToggleDip(void)
{
if (FCEUGameInfo->type==GIT_VSUNI)
if (GameInfo->type==GIT_VSUNI)
FCEUI_VSUniToggleDIP(execcmd-EMUCMD_VSUNI_TOGGLE_DIP_0);
}

View File

@ -157,7 +157,7 @@ static INPUTC ZAPVSC={ReadZapperVS,0,StrobeZapperVS,UpdateZapper,ZapperFrapper,D
INPUTC *FCEU_InitZapper(int w)
{
memset(&ZD[w],0,sizeof(ZAPPER));
if(FCEUGameInfo->type == GIT_VSUNI)
if(GameInfo->type == GIT_VSUNI)
return(&ZAPVSC);
else
return(&ZAPC);

View File

@ -291,7 +291,7 @@ static DECLFR(Mapper157_read)
void Mapper157_init(void)
{
FCEUGameInfo->cspecial = SIS_DATACH;
GameInfo->cspecial = SIS_DATACH;
MapIRQHook=BarcodeIRQHook;
SetWriteHandler(0x6000,0xFFFF,Mapper16_write);
SetReadHandler(0x6000,0x7FFF,Mapper157_read);

View File

@ -154,7 +154,7 @@ void MovieFlushHeader(void)
write32le(rerecord_count, fp);
write32le(frameptr, fp);
fseek(fp, 32, SEEK_SET);
fwrite(FCEUGameInfo->MD5, 1, 16, fp); // write ROM checksum
fwrite(GameInfo->MD5, 1, 16, fp); // write ROM checksum
write32le(FCEU_VERSION_NUMERIC, fp); // write emu version used
// write ROM name used
@ -356,10 +356,10 @@ static void ResetInputTypes()
UsrInputType[1] = SI_GAMEPAD;
UsrInputType[2] = SIFC_NONE;
ParseGIInput(NULL/*FCEUGameInfo*/);
ParseGIInput(NULL/*GameInfo*/);
extern int cspec, gametype;
cspec=FCEUGameInfo->cspecial;
gametype=FCEUGameInfo->type;
cspec=GameInfo->cspecial;
gametype=GameInfo->type;
InitOtherInput();
#endif
@ -564,7 +564,7 @@ void FCEUI_SaveMovie(char *fname, uint8 flags, const char* metadata)
write32le(0, fp); // leave room for movie data size
write32le(0, fp); // leave room for savestate_offset
write32le(0, fp); // leave room for offset_to_controller_data
fwrite(FCEUGameInfo->MD5, 1, 16, fp); // write ROM checksum
fwrite(GameInfo->MD5, 1, 16, fp); // write ROM checksum
write32le(FCEU_VERSION_NUMERIC, fp); // write emu version used
fputs(FileBase, fp); // write ROM name used
fputc(0, fp);

View File

@ -198,9 +198,9 @@ int NSFLoad(FCEUFILE *fp)
for(x=0;x<8;x++)
BSon|=NSFHeader.BankSwitch[x];
FCEUGameInfo->type=GIT_NSF;
FCEUGameInfo->input[0]=FCEUGameInfo->input[1]=SI_GAMEPAD;
FCEUGameInfo->cspecial=SIS_NSF;
GameInfo->type=GIT_NSF;
GameInfo->input[0]=GameInfo->input[1]=SI_GAMEPAD;
GameInfo->cspecial=SIS_NSF;
for(x=0;;x++)
{
@ -215,9 +215,9 @@ int NSFLoad(FCEUFILE *fp)
}
if(NSFHeader.VideoSystem==0)
FCEUGameInfo->vidsys=GIV_NTSC;
GameInfo->vidsys=GIV_NTSC;
else if(NSFHeader.VideoSystem==1)
FCEUGameInfo->vidsys=GIV_PAL;
GameInfo->vidsys=GIV_PAL;
GameInterface=NSFGI;

View File

@ -224,7 +224,7 @@ void FCEU_LoadGamePalette(void)
void FCEU_ResetPalette(void)
{
if(FCEUGameInfo)
if(GameInfo)
{
ChoosePalette();
WritePalette();
@ -233,11 +233,11 @@ void FCEU_ResetPalette(void)
static void ChoosePalette(void)
{
if(FCEUGameInfo->type==GIT_NSF)
if(GameInfo->type==GIT_NSF)
palo=0;
else if(ipalette)
palo=palettei;
else if(ntsccol && !PAL && FCEUGameInfo->type!=GIT_VSUNI)
else if(ntsccol && !PAL && GameInfo->type!=GIT_VSUNI)
{
palo=paletten;
CalculatePalette();
@ -252,7 +252,7 @@ void WritePalette(void)
for(x=0;x<7;x++)
FCEUD_SetPalette(x,unvpalette[x].r,unvpalette[x].g,unvpalette[x].b);
if(FCEUGameInfo->type==GIT_NSF)
if(GameInfo->type==GIT_NSF)
{
//for(x=0;x<128;x++)
// FCEUD_SetPalette(x,x,0,x);
@ -276,7 +276,7 @@ static int controllength=0;
void FCEUI_NTSCDEC(void)
{
if(ntsccol && FCEUGameInfo->type!=GIT_VSUNI &&!PAL && FCEUGameInfo->type!=GIT_NSF)
if(ntsccol && GameInfo->type!=GIT_VSUNI &&!PAL && GameInfo->type!=GIT_NSF)
{
int which;
if(controlselect)
@ -298,7 +298,7 @@ void FCEUI_NTSCDEC(void)
void FCEUI_NTSCINC(void)
{
if(ntsccol && FCEUGameInfo->type!=GIT_VSUNI && !PAL && FCEUGameInfo->type!=GIT_NSF)
if(ntsccol && GameInfo->type!=GIT_VSUNI && !PAL && GameInfo->type!=GIT_NSF)
if(controlselect)
{
if(controllength)
@ -321,12 +321,12 @@ void FCEUI_NTSCINC(void)
void FCEUI_NTSCSELHUE(void)
{
if(ntsccol && FCEUGameInfo->type!=GIT_VSUNI && !PAL && FCEUGameInfo->type!=GIT_NSF){controlselect=1;controllength=360;}
if(ntsccol && GameInfo->type!=GIT_VSUNI && !PAL && GameInfo->type!=GIT_NSF){controlselect=1;controllength=360;}
}
void FCEUI_NTSCSELTINT(void)
{
if(ntsccol && FCEUGameInfo->type!=GIT_VSUNI && !PAL && FCEUGameInfo->type!=GIT_NSF){controlselect=2;controllength=360;}
if(ntsccol && GameInfo->type!=GIT_VSUNI && !PAL && GameInfo->type!=GIT_NSF){controlselect=2;controllength=360;}
}
void FCEU_DrawNTSCControlBars(uint8 *XBuf)

View File

@ -1282,7 +1282,7 @@ int FCEUPPU_Loop(int skip)
of this delay.
*/
X6502_Run(12);
if(FCEUGameInfo->type==GIT_NSF)
if(GameInfo->type==GIT_NSF)
DoNSFFrame();
else
{
@ -1319,7 +1319,7 @@ int FCEUPPU_Loop(int skip)
X6502_Run(16-kook);
kook ^= 1;
}
if(FCEUGameInfo->type==GIT_NSF)
if(GameInfo->type==GIT_NSF)
X6502_Run((256+85)*240);
#ifdef FRAMESKIP
else if(skip)

View File

@ -154,10 +154,10 @@ static int NAME(FCEUFILE *fp)
namebuf[index]=0;
FCEU_printf("%s\n",namebuf);
if(!FCEUGameInfo->name)
if(!GameInfo->name)
{
FCEUGameInfo->name=(uint8*)malloc(strlen(namebuf)+1); //mbg merge 7/17/06 added cast
strcpy((char*)FCEUGameInfo->name,namebuf); //mbg merge 7/17/06 added cast
GameInfo->name=(uint8*)malloc(strlen(namebuf)+1); //mbg merge 7/17/06 added cast
strcpy((char*)GameInfo->name,namebuf); //mbg merge 7/17/06 added cast
}
return(1);
}
@ -201,11 +201,11 @@ static int CTRL(FCEUFILE *fp)
better than nothing...maybe.
*/
if(t&1) FCEUGameInfo->input[0]=FCEUGameInfo->input[1]=SI_GAMEPAD;
else FCEUGameInfo->input[0]=FCEUGameInfo->input[1]=SI_NONE;
if(t&1) GameInfo->input[0]=GameInfo->input[1]=SI_GAMEPAD;
else GameInfo->input[0]=GameInfo->input[1]=SI_NONE;
if(t&2) FCEUGameInfo->input[1]=SI_ZAPPER;
//else if(t&0x10) FCEUGameInfo->input[1]=SI_POWERPAD;
if(t&2) GameInfo->input[1]=SI_ZAPPER;
//else if(t&0x10) GameInfo->input[1]=SI_POWERPAD;
return(1);
}
@ -220,12 +220,12 @@ static int TVCI(FCEUFILE *fp)
char *stuffo[3]={"NTSC","PAL","NTSC and PAL"};
if(t==0)
{
FCEUGameInfo->vidsys=GIV_NTSC;
GameInfo->vidsys=GIV_NTSC;
FCEUI_SetVidSystem(0);
}
else if(t==1)
{
FCEUGameInfo->vidsys=GIV_PAL;
GameInfo->vidsys=GIV_PAL;
FCEUI_SetVidSystem(1);
}
FCEU_printf(" TV Standard Compatibility: %s\n",stuffo[t]);
@ -555,7 +555,7 @@ int UNIFLoad(const char *name, FCEUFILE *fp)
for(x=0;x<16;x++)
FCEU_printf("%02x",UNIFCart.MD5[x]);
FCEU_printf("\n");
memcpy(FCEUGameInfo->MD5,UNIFCart.MD5,sizeof(UNIFCart.MD5));
memcpy(GameInfo->MD5,UNIFCart.MD5,sizeof(UNIFCart.MD5));
}
if(!InitializeBoard())

View File

@ -129,7 +129,7 @@ void FCEU_PutImageDummy(void)
#ifdef SHOWFPS
ShowFPS();
#endif
if(FCEUGameInfo->type!=GIT_NSF)
if(GameInfo->type!=GIT_NSF)
{
FCEU_DrawNTSCControlBars(XBuf);
FCEU_DrawSaveStates(XBuf);
@ -186,7 +186,7 @@ void FCEU_PutImage(void)
DrawMessage();
}
*/
if(FCEUGameInfo->type==GIT_NSF)
if(GameInfo->type==GIT_NSF)
{
DrawNSF(XBuf);
/* Save snapshot after NSF screen is drawn. Why would we want to
@ -212,7 +212,7 @@ void FCEU_PutImage(void)
ReallySnap();
dosnapsave=0;
}
if(FCEUGameInfo->type==GIT_VSUNI)
if(GameInfo->type==GIT_VSUNI)
FCEU_VSUniDraw(XBuf);
FCEU_DrawSaveStates(XBuf);
FCEU_DrawMovies(XBuf);

View File

@ -337,9 +337,9 @@ void FCEU_VSUniCheck(uint64 md5partial, int *MapperNo, uint8 *Mirroring)
//puts(vs->name);
*MapperNo = vs->mapper;
*Mirroring = vs->mirroring;
FCEUGameInfo->type = GIT_VSUNI;
FCEUGameInfo->cspecial = SIS_VSUNISYSTEM;
FCEUGameInfo->inputfc = SIFC_NONE;
GameInfo->type = GIT_VSUNI;
GameInfo->cspecial = SIS_VSUNISYSTEM;
GameInfo->inputfc = SIFC_NONE;
curppu = vs->ppu;
curmd5 = md5partial;
@ -360,12 +360,12 @@ void FCEU_VSUniCheck(uint64 md5partial, int *MapperNo, uint8 *Mirroring)
}
if(vs->ioption & IOPTION_GUN)
{
FCEUGameInfo->input[0] = SI_ZAPPER;
FCEUGameInfo->input[1] = SI_NONE;
GameInfo->input[0] = SI_ZAPPER;
GameInfo->input[1] = SI_NONE;
}
else
{
FCEUGameInfo->input[0] = FCEUGameInfo->input[1] = SI_GAMEPAD;
GameInfo->input[0] = GameInfo->input[1] = SI_GAMEPAD;
}
curvs = vs;
return;