From 6733a2f8a35034b01c3ea802036799ab2eb1ebe7 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Tue, 17 Jun 2008 16:59:16 +0000 Subject: [PATCH] fixed more compile issues with gcc --- src/drivers/sdl/dface.h | 2 +- src/drivers/sdl/input.cpp | 4 +- src/fceu.cpp | 79 ++++++++++++++++++++------------------- src/movie.cpp | 5 ++- 4 files changed, 47 insertions(+), 43 deletions(-) diff --git a/src/drivers/sdl/dface.h b/src/drivers/sdl/dface.h index 0256f88d..990797d8 100644 --- a/src/drivers/sdl/dface.h +++ b/src/drivers/sdl/dface.h @@ -30,7 +30,7 @@ void UnlockConsole(void); void ToggleFS(); /* SDL */ int LoadGame(const char *path); -int CloseGame(void); +//int CloseGame(void); void Giggles(int); void DoFun(void); diff --git a/src/drivers/sdl/input.cpp b/src/drivers/sdl/input.cpp index 12fdc4d0..58dcffc0 100644 --- a/src/drivers/sdl/input.cpp +++ b/src/drivers/sdl/input.cpp @@ -259,7 +259,7 @@ KeyboardCommands() // F12 or Esc close game if(KEY(F12) || KEY(ESCAPE)) { - CloseGame(); + FCEUI_CloseGame(); } // VS Unisystem games @@ -389,7 +389,7 @@ UpdatePhysicalInput() while(SDL_PollEvent(&event)) { switch(event.type) { case SDL_QUIT: - CloseGame(); + FCEUI_CloseGame(); puts("Quit"); break; default: diff --git a/src/fceu.cpp b/src/fceu.cpp index 66081ba8..ab46bfba 100644 --- a/src/fceu.cpp +++ b/src/fceu.cpp @@ -52,8 +52,49 @@ //TODO - we really need some kind of global platform-specific options api #ifdef WIN32 #include "drivers/win/main.h" +#else +#include "drivers/sdl/sdl.h" #endif +static void CloseGame(void) +{ + if(GameInfo) + { + if(FCEUnetplay) + { + FCEUD_NetworkClose(); + } + + FCEUI_StopMovie(); + + if(GameInfo->name) + { + free(GameInfo->name); + GameInfo->name=0; + } + + if(GameInfo->type!=GIT_NSF) + { + FCEU_FlushGameCheats(0,0); + } + + GameInterface(GI_CLOSE); + + ResetExState(0,0); + + //mbg 5/9/08 - clear screen when game is closed + //http://sourceforge.net/tracker/index.php?func=detail&aid=1787298&group_id=13536&atid=113536 + extern uint8 *XBuf; + if(XBuf) + memset(XBuf,0,256*256); + + CloseGenie(); + + delete GameInfo; + GameInfo = 0; + } +} + uint64 timestampbase; @@ -239,44 +280,6 @@ static DECLFR(ARAMH) return RAM[A&0x7FF]; } -static void CloseGame(void) -{ - if(GameInfo) - { - if(FCEUnetplay) - { - FCEUD_NetworkClose(); - } - - FCEUI_StopMovie(); - - if(GameInfo->name) - { - free(GameInfo->name); - GameInfo->name=0; - } - - if(GameInfo->type!=GIT_NSF) - { - FCEU_FlushGameCheats(0,0); - } - - GameInterface(GI_CLOSE); - - ResetExState(0,0); - - //mbg 5/9/08 - clear screen when game is closed - //http://sourceforge.net/tracker/index.php?func=detail&aid=1787298&group_id=13536&atid=113536 - extern uint8 *XBuf; - if(XBuf) - memset(XBuf,0,256*256); - - CloseGenie(); - - delete GameInfo; - GameInfo = 0; - } -} void ResetGameLoaded(void) { diff --git a/src/movie.cpp b/src/movie.cpp index 15daf6f8..1896fa9d 100644 --- a/src/movie.cpp +++ b/src/movie.cpp @@ -345,9 +345,10 @@ static void LoadFM2(MovieData& movieData, std::istream* fp, int size=INT_MAX, bo bool bail = false; for(;;) { - bool iswhitespace, isrecchar, isnewline; + bool iswhitespace, isrecchar, isnewline; + int c; if(size--<=0) goto bail; - int c = fp->get(); + c = fp->get(); if(c == -1) goto bail; iswhitespace = (c==' '||c=='\t');