switched header files in sdl/ directory to c++ headers

This commit is contained in:
xhainingx 2013-04-16 19:53:01 +00:00
parent acc1a07c1e
commit 7abad425c5
10 changed files with 93 additions and 86 deletions

View File

@ -1,13 +1,3 @@
#include <unistd.h>
#include <sys/types.h>
#include <csignal>
#include <sys/time.h>
#include <sys/stat.h>
#include <cstring>
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include "main.h" #include "main.h"
#include "throttle.h" #include "throttle.h"
#include "config.h" #include "config.h"
@ -25,6 +15,16 @@
#include <windows.h> #include <windows.h>
#endif #endif
#include <unistd.h>
#include <csignal>
#include <cstring>
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h>
/** /**
* Read a custom pallete from a file and load it into the core. * Read a custom pallete from a file and load it into the core.

View File

@ -1,15 +1,3 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkx.h>
#ifdef _GTK3
#include <gdk/gdkkeysyms-compat.h>
#endif
#include <fstream>
#include <iostream>
#include <cstdlib>
#include "../../types.h" #include "../../types.h"
#include "../../fceu.h" #include "../../fceu.h"
#include "../../driver.h" #include "../../driver.h"
@ -30,6 +18,18 @@
#include "../../fceulua.h" #include "../../fceulua.h"
#endif #endif
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkx.h>
#ifdef _GTK3
#include <gdk/gdkkeysyms-compat.h>
#endif
#include <fstream>
#include <iostream>
#include <cstdlib>
// Fix compliation errors for older version of GTK (Ubuntu 10.04 LTS) // Fix compliation errors for older version of GTK (Ubuntu 10.04 LTS)
#if GTK_MINOR_VERSION < 24 && GTK_MAJOR_VERSION == 2 #if GTK_MINOR_VERSION < 24 && GTK_MAJOR_VERSION == 2
#define GTK_COMBO_BOX_TEXT GTK_COMBO_BOX #define GTK_COMBO_BOX_TEXT GTK_COMBO_BOX

View File

@ -18,9 +18,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <cstring>
#include <cstdio>
#include "main.h" #include "main.h"
#include "dface.h" #include "dface.h"
#include "input.h" #include "input.h"
@ -47,6 +44,9 @@
#endif #endif
#include <cstring>
#include <cstdio>
/** GLOBALS **/ /** GLOBALS **/
int NoWaiting = 1; int NoWaiting = 1;
extern Config *g_config; extern Config *g_config;

View File

@ -22,12 +22,12 @@
/// \file /// \file
/// \brief Handles joystick input using the SDL. /// \brief Handles joystick input using the SDL.
#include <stdlib.h> #include "sdl.h"
#include <cstdlib>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <cerrno>
#include "sdl.h"
#define MAX_JOYSTICKS 32 #define MAX_JOYSTICKS 32
static SDL_Joystick *s_Joysticks[MAX_JOYSTICKS] = {NULL}; static SDL_Joystick *s_Joysticks[MAX_JOYSTICKS] = {NULL};

View File

@ -1,4 +1,10 @@
#define GL_GLEXT_LEGACY #define GL_GLEXT_LEGACY
#include "sdl.h"
#include "sdl-opengl.h"
#include "../common/vidblit.h"
#include "../../utils/memory.h"
#ifdef APPLEOPENGL #ifdef APPLEOPENGL
#include <OpenGL/gl.h> #include <OpenGL/gl.h>
#include <OpenGL/glu.h> #include <OpenGL/glu.h>
@ -8,13 +14,8 @@
#include <GL/glu.h> #include <GL/glu.h>
#include <GL/glext.h> #include <GL/glext.h>
#endif #endif
#include <string.h> #include <cstring>
#include <stdlib.h> #include <cstdlib>
#include "sdl.h"
#include "sdl-opengl.h"
#include "../common/vidblit.h"
#include "../../utils/memory.h"
#ifndef APIENTRY #ifndef APIENTRY
#define APIENTRY #define APIENTRY

View File

@ -21,15 +21,15 @@
/// \file /// \file
/// \brief Handles sound emulation using the SDL. /// \brief Handles sound emulation using the SDL.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "sdl.h" #include "sdl.h"
#include "../common/configSys.h" #include "../common/configSys.h"
#include "../../utils/memory.h" #include "../../utils/memory.h"
#include <cstdio>
#include <cstring>
#include <cstdlib>
extern Config *g_config; extern Config *g_config;
static volatile int *s_Buffer = 0; static volatile int *s_Buffer = 0;

View File

@ -21,10 +21,6 @@
/// \file /// \file
/// \brief Handles the graphical game display for the SDL implementation. /// \brief Handles the graphical game display for the SDL implementation.
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include "sdl.h" #include "sdl.h"
#include "sdl-opengl.h" #include "sdl-opengl.h"
#include "../common/vidblit.h" #include "../common/vidblit.h"
@ -49,6 +45,10 @@
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#endif #endif
#include <cstdio>
#include <cstring>
#include <cstdlib>
// GLOBALS // GLOBALS
extern Config *g_config; extern Config *g_config;

View File

@ -1,22 +1,3 @@
#include <unistd.h>
#include <sys/types.h>
#include <csignal>
#include <sys/time.h>
#include <sys/stat.h>
#include <cstring>
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <climits>
#include <cmath>
#ifdef _GTK
#include <gtk/gtk.h>
#include "gui.cpp"
#endif
#include "main.h" #include "main.h"
#include "throttle.h" #include "throttle.h"
#include "config.h" #include "config.h"
@ -48,6 +29,25 @@
#include <windows.h> #include <windows.h>
#endif #endif
#ifdef _GTK
#include <gtk/gtk.h>
#include "gui.cpp"
#endif
#include <unistd.h>
#include <csignal>
#include <cstring>
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <cmath>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <iostream>
#include <fstream>
extern double g_fpsScale; extern double g_fpsScale;
extern bool MaxSpeed; extern bool MaxSpeed;
@ -64,6 +64,7 @@ int eoptions=0;
static void DriverKill(void); static void DriverKill(void);
static int DriverInitialize(FCEUGI *gi); static int DriverInitialize(FCEUGI *gi);
uint64 FCEUD_GetTime();
int gametype = 0; int gametype = 0;
#ifdef CREATE_AVI #ifdef CREATE_AVI
int mutecapture; int mutecapture;
@ -346,7 +347,7 @@ FCEUD_Update(uint8 *XBuf,
{ {
if(LoggingEnabled == 2) if(LoggingEnabled == 2)
{ {
int16* MonoBuf = (int16*)malloc(sizeof(*MonoBuf) * Count); int16* MonoBuf = new int16[Count];
int n; int n;
for(n=0; n<Count; ++n) for(n=0; n<Count; ++n)
MonoBuf[n] = Buffer[n] & 0xFFFF; MonoBuf[n] = Buffer[n] & 0xFFFF;
@ -356,7 +357,7 @@ FCEUD_Update(uint8 *XBuf,
FSettings.SndRate, 16, 1, FSettings.SndRate, 16, 1,
Count Count
); );
free(MonoBuf); delete [] MonoBuf;
} }
Count /= 2; Count /= 2;
if(inited & 1) if(inited & 1)
@ -589,8 +590,9 @@ int main(int argc, char *argv[])
// This is here so that a default fceux.cfg will be created on first // This is here so that a default fceux.cfg will be created on first
// run, even without a valid ROM to play. // run, even without a valid ROM to play.
// Unless, of course, there's actually --no-config given // Unless, of course, there's actually --no-config given
// mbg 8/23/2008 - this is also here so that the inputcfg routines can have a chance to dump the new inputcfg to the fceux.cfg // mbg 8/23/2008 - this is also here so that the inputcfg routines can have
// in case you didnt specify a rom filename // a chance to dump the new inputcfg to the fceux.cfg in case you didnt
// specify a rom filename
g_config->getOption("SDL.NoConfig", &noconfig); g_config->getOption("SDL.NoConfig", &noconfig);
if (!noconfig) if (!noconfig)
g_config->save(); g_config->save();
@ -902,6 +904,7 @@ int main(int argc, char *argv[])
SDL_Delay(1); SDL_Delay(1);
while(gtk_events_pending()) while(gtk_events_pending())
gtk_main_iteration_do(FALSE); gtk_main_iteration_do(FALSE);
printf("%d\n", FCEUD_GetTime());
} }
} }
else else

View File

@ -21,19 +21,26 @@
//todo - ensure that #ifdef WIN32 makes sense //todo - ensure that #ifdef WIN32 makes sense
//consider changing this to use sdl net stuff? //consider changing this to use sdl net stuff?
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/time.h>
#include <errno.h>
#include <fcntl.h>
#include "main.h" #include "main.h"
#include "dface.h" #include "dface.h"
#include "unix-netplay.h" #include "unix-netplay.h"
#include "../../fceu.h"
#include "../../utils/md5.h"
#include "../../utils/memory.h"
#include <string>
#include "../common/configSys.h"
#include <unistd.h>
#include <sys/types.h>
#include <sys/time.h>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cerrno>
#include <fcntl.h>
#ifdef WIN32 #ifdef WIN32
#include <winsock.h> #include <winsock.h>
#else #else
@ -45,13 +52,6 @@
#include <netdb.h> #include <netdb.h>
#endif #endif
#include "../../fceu.h"
#include "../../utils/md5.h"
#include "../../utils/memory.h"
#include <string>
#include "../common/configSys.h"
extern Config *g_config; extern Config *g_config;
#ifndef socklen_t #ifndef socklen_t

View File

@ -170,9 +170,9 @@ static DECLFW(B4016)
} }
//a main joystick port driver representing the case where nothing is plugged in //a main joystick port driver representing the case where nothing is plugged in
static INPUTC DummyJPort={0,0,0,0,0,0}; static INPUTC DummyJPort={0};
//and an expansion port driver for the same ting //and an expansion port driver for the same ting
static INPUTCFC DummyPortFC={0,0,0,0,0,0}; static INPUTCFC DummyPortFC={0};
//--------4 player driver for expansion port-------- //--------4 player driver for expansion port--------
@ -1155,6 +1155,9 @@ static void MovieSubtitleToggle(void)
static void UndoRedoSavestate(void) static void UndoRedoSavestate(void)
{ {
// FIXME this will always evaluate to true, should this be
// if (*lastSavestateMade...) to check if it holds a string or just
// a '\0'?
if (lastSavestateMade && (undoSS || redoSS)) if (lastSavestateMade && (undoSS || redoSS))
SwapSaveState(); SwapSaveState();
} }