- got rid of the EXTGUI define and associated code

- commented sdl-video.cpp
This commit is contained in:
gimmedonutnow 2006-08-01 06:47:01 +00:00
parent 2d30eb6daf
commit 4025828176
5 changed files with 433 additions and 408 deletions

View File

@ -57,10 +57,6 @@ void ParseGIInput(FCEUGI *gi)
if(gi->inputfc>=0)
InputType[2]=gi->inputfc;
cspec = gi->cspecial;
#ifdef EXTGUI
Giggles(gi->cspecial);
#endif
}
@ -83,23 +79,17 @@ static void UpdateTopRider(void);
static uint32 JSreturn=0;
int NoWaiting=1;
#ifndef EXTGUI
static void DoCheatSeq(void)
{
#if defined(DOS) || defined(SDL)
SilenceSound(1);
#endif
KillKeyboard();
KillVideo();
DoConsoleCheatConfig();
InitVideo(CurGame);
InitKeyboard();
#if defined(DOS) || defined(SDL)
SilenceSound(0);
#endif
}
#endif
#include "keyscan.h"
static char *keys=0;
@ -171,9 +161,7 @@ static void KeyboardCommands(void)
if(keyonly(F9)) FCEUI_SaveSnapshot();
if(gametype!=GIT_NSF)
{
#ifndef EXTGUI
if(keyonly(F2)) DoCheatSeq();
#endif
if(keyonly(F5))
{
if(is_shift)
@ -201,13 +189,7 @@ static void KeyboardCommands(void)
if(keyonly(F10)) FCEUI_ResetNES();
if(keyonly(F11)) FCEUI_PowerNES();
#ifdef EXTGUI
if(keyonly(F3)) GUI_Hide(-1);
if(KEY(F12)) GUI_RequestExit();
if(KEY(ESCAPE)) CloseGame();
#else
if(KEY(F12) || KEY(ESCAPE)) CloseGame();
#endif
if(gametype==GIT_VSUNI)
{

View File

@ -80,7 +80,6 @@ static void ParseGI(FCEUGI *gi)
gametype=gi->type;
}
#ifndef EXTGUI
void FCEUD_PrintError(char *s)
{
puts(s);
@ -90,7 +89,6 @@ void FCEUD_Message(char *s)
{
fputs(s,stdout);
}
#endif
static char *cpalette=0;
static void LoadCPalette(void)
@ -107,9 +105,6 @@ static void LoadCPalette(void)
FCEUI_SetPaletteArray(tmpp);
fclose(fp);
}
#ifdef EXTGUI
extern CFGSTRUCT GUIConfig;
#endif
static CFGSTRUCT fceuconfig[]={
AC(soundrate),
AC(soundq),
@ -125,9 +120,6 @@ static CFGSTRUCT fceuconfig[]={
ACA(erendlinev),
ADDCFGSTRUCT(InputConfig),
ADDCFGSTRUCT(DriverConfig),
#ifdef EXTGUI
ADDCFGSTRUCT(GUIConfig),
#endif
ENDCFGSTRUCT
};
@ -297,9 +289,6 @@ int LoadGame(const char *path)
}
}
isloaded=1;
#ifdef EXTGUI
if(eoptions&EO_AUTOHIDE) GUI_Hide(1);
#endif
FCEUD_NetworkConnect();
return 1;
@ -317,9 +306,6 @@ int CloseGame(void)
if(soundrecfn)
FCEUI_EndWaveRecord();
#ifdef EXTGUI
GUI_Hide(0);
#endif
InputUserActiveFix();
return(1);
}
@ -361,11 +347,7 @@ int CLImain(int argc, char *argv[])
CreateDirs();
#ifdef EXTGUI
if(argc==2 && !strcmp(argv[1],"-help")) // I hope no one has a game named "-help" :b
#else
if(argc<=1)
#endif
{
ShowUsage(argv[0]);
return(0);
@ -378,10 +360,6 @@ int CLImain(int argc, char *argv[])
LoadCPalette();
/* All the config files and arguments are parsed now. */
#ifdef EXTGUI
return(1);
#else
if(!LoadGame(argv[argc-1]))
{
DriverKill();
@ -391,13 +369,6 @@ int CLImain(int argc, char *argv[])
while(CurGame)
DoFun();
#if(0)
{
int x;
for(x=1;x<argc;x++)
{ LoadGame(argv[x]); while(CurGame) DoFun(); }
}
#endif
CloseGame();
@ -405,7 +376,6 @@ int CLImain(int argc, char *argv[])
FCEUI_Kill();
#endif
return(1);
}

View File

@ -65,7 +65,7 @@ int KillJoysticks (void)
{
int n; /* joystick index */
if(!jinited) return(0);
if(!jinited) return(-1);
for (n = 0; n < MAX_JOYSTICKS; n++)
{
if (Joysticks[n] != 0)
@ -73,7 +73,7 @@ int KillJoysticks (void)
Joysticks[n]=0;
}
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
return(1);
return(0);
}
/* Initialize joysticks. */

View File

@ -18,6 +18,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/// \file
/// \brief Handles the graphical game display for the SDL implementation.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@ -36,15 +39,13 @@ SDL_Surface *IconSurface=NULL;
static int curbpp;
static int srendline,erendline;
static int tlines;
static int inited=0;
static int inited;
#ifdef OPENGL
extern int sdlhaveogl;
static int usingogl;
static double exs,eys;
#else
static double exs,eys;
#endif
static double exs,eys;
static int eefx;
#define NWIDTH (256-((eoptions&EO_CLIPSIDES)?16:0))
@ -53,386 +54,470 @@ static int eefx;
static int paletterefresh;
/* Return 1 if video was killed, 0 otherwise(video wasn't initialized). */
int KillVideo(void)
/**
* Attempts to destroy the graphical video display. Returns 0 on
* success, -1 on failure.
*/
int
KillVideo()
{
if(IconSurface)
{
// if the IconSurface has been initialized, destroy it
if(IconSurface) {
SDL_FreeSurface(IconSurface);
IconSurface=0;
}
if(inited&1)
{
#ifdef OPENGL
// if the rest of the system has been initialized, shut it down
if(inited) {
#ifdef OPENGL
// check for OpenGL and shut it down
if(usingogl)
KillOpenGL();
else
#endif
if(curbpp>8)
#endif
// shut down the system that converts from 8 to 16/32 bpp
if(curbpp > 8)
KillBlitToHigh();
// shut down the SDL video sub-system
SDL_QuitSubSystem(SDL_INIT_VIDEO);
inited&=~1;
return(1);
inited = 0;
return 0;
}
inited=0;
return(0);
// return failure, since the system was not initialized
// XXX soules - this seems odd to me... why is it doing this?
return -1;
}
static int sponge;
int InitVideo(FCEUGI *gi)
/**
* Attempts to initialize the graphical video display. Returns 0 on
* success, -1 on failure.
*/
int
InitVideo(FCEUGI *gi)
{
// XXX soules - const? is this necessary?
const SDL_VideoInfo *vinf;
int flags=0;
int error, flags = 0;
FCEUI_printf("Initializing video...");
FCEUI_GetCurrentVidSystem(&srendline,&erendline);
// check the starting, ending, and total scan lines
FCEUI_GetCurrentVidSystem(&srendline, &erendline);
tlines = erendline - srendline + 1;
if(_fullscreen) sponge=Settings.specialfs;
else sponge=Settings.special;
#ifdef OPENGL
usingogl=0;
if(_opengl && sdlhaveogl && !sponge)
{
flags=SDL_OPENGL;
usingogl=1;
// XXX soules - what is the sponge variable?
if(_fullscreen) {
sponge = Settings.specialfs;
} else {
sponge = Settings.special;
}
#endif
#ifdef EXTGUI
GUI_SetVideo(_fullscreen, 0, 0);
#endif
// check for OpenGL and set the global flags
#ifdef OPENGL
usingogl = 0;
if(_opengl && sdlhaveogl && !sponge) {
flags = SDL_OPENGL;
usingogl = 1;
}
#endif
if(!(SDL_WasInit(SDL_INIT_VIDEO)&SDL_INIT_VIDEO))
if(SDL_InitSubSystem(SDL_INIT_VIDEO)==-1)
{
// initialize the SDL video subsystem if it is not already active
if(!SDL_WasInit(SDL_INIT_VIDEO)) {
error = SDL_InitSubSystem(SDL_INIT_VIDEO);
if(error) {
FCEUD_PrintError(SDL_GetError());
return(0);
return -1;
}
inited|=1;
}
inited = 1;
// shows the cursor within the display window
SDL_ShowCursor(0);
tlines=erendline-srendline+1;
// determine if we can allocate the display on the video card
vinf=SDL_GetVideoInfo();
if(vinf->hw_available)
flags|=SDL_HWSURFACE;
if(_fullscreen)
flags|=SDL_FULLSCREEN;
flags|=SDL_HWPALETTE;
//flags|=SDL_DOUBLEBUF;
#ifdef OPENGL
if(usingogl)
{
FCEU_printf("\n Initializing with OpenGL(Use \"-opengl 0\" to disable).\n");
if(_doublebuf)
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
if(vinf->hw_available) {
flags |= SDL_HWSURFACE;
}
else
#endif
if(_doublebuf && (flags&SDL_HWSURFACE))
flags|=SDL_DOUBLEBUF;
if(_fullscreen)
{
int desbpp=_bpp;
// check if we are rendering fullscreen
if(_fullscreen) {
flags |= SDL_FULLSCREEN;
}
exs=_xscalefs;
eys=_yscalefs;
eefx=_efxfs;
// gives the SDL exclusive palette control... ensures the requested colors
flags |= SDL_HWPALETTE;
#ifdef OPENGL
// enable double buffering if requested and we have hardware support
#ifdef OPENGL
if(usingogl) {
FCEU_printf("Initializing with OpenGL (Disable with '-opengl 0').\n");
if(_doublebuf) {
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
}
} else
#endif
if(_doublebuf && (flags & SDL_HWSURFACE)) {
flags |= SDL_DOUBLEBUF;
}
if(_fullscreen) {
int desbpp = _bpp;
exs = _xscalefs;
eys = _yscalefs;
eefx = _efxfs;
#ifdef OPENGL
if(!usingogl) {exs=(int)exs;eys=(int)eys;}
else desbpp=0;
if(sponge)
{
exs=eys=2;
if(sponge == 3 || sponge == 4) exs = eys = 3;
if(sponge) {
exs = eys = 2;
if(sponge == 3 || sponge == 4) {
exs = eys = 3;
}
eefx=0;
if(sponge == 1 || sponge == 3) desbpp = 32;
if(sponge == 1 || sponge == 3) {
desbpp = 32;
}
}
if( (usingogl && !_stretchx) || !usingogl)
#endif
if(_xres<NWIDTH*exs || exs <= 0.01)
{
#endif
if(_xres < (NWIDTH * exs) || exs <= 0.01) {
FCEUD_PrintError("xscale out of bounds.");
KillVideo();
return(0);
return -1;
}
#ifdef OPENGL
#ifdef OPENGL
if( (usingogl && !_stretchy) || !usingogl)
#endif
if(_yres<tlines*eys || eys <= 0.01)
{
#endif
if(_yres<tlines*eys || eys <= 0.01) {
FCEUD_PrintError("yscale out of bounds.");
KillVideo();
return(0);
return -1;
}
#ifdef EXTGUI
GUI_SetVideo(_fullscreen, _xres, _yres);
#endif
#ifdef OPENGL
if(!(screen = SDL_SetVideoMode(_xres, _yres, desbpp, flags)))
#else
if(!(screen = SDL_SetVideoMode(_xres, _yres, desbpp, flags)))
#endif
{
screen = SDL_SetVideoMode(_xres, _yres, desbpp, flags);
if(!screen) {
FCEUD_PrintError(SDL_GetError());
return(0);
return -1;
}
}
else
{
} else {
int desbpp=0;
exs=_xscale;
eys=_yscale;
eefx=_efx;
if(sponge)
{
exs=eys=2;
if(sponge >= 3) exs=eys=3;
eefx=0;
if(sponge) {
exs = eys = 2;
if(sponge >= 3) {
exs = eys = 3;
}
eefx = 0;
// SDL's 32bpp->16bpp code is slighty faster than mine, at least :/
if(sponge == 1 || sponge == 3) desbpp=32;
if(sponge == 1 || sponge == 3) {
desbpp=32;
}
}
#ifdef OPENGL
#ifdef OPENGL
if(!usingogl) {exs=(int)exs;eys=(int)eys;}
if(exs <= 0.01)
{
FCEUD_PrintError("xscale out of bounds.");
KillVideo();
return(0);
return -1;
}
if(eys <= 0.01)
{
FCEUD_PrintError("yscale out of bounds.");
KillVideo();
return(0);
return -1;
}
#endif
#ifdef EXTGUI
GUI_SetVideo(_fullscreen, (NWIDTH*exs), tlines*eys);
#endif
#endif
screen = SDL_SetVideoMode((int)(NWIDTH*exs), (int)(tlines*eys),
desbpp, flags);
if(!screen) {
FCEUD_PrintError(SDL_GetError());
return -1;
}
}
curbpp=screen->format->BitsPerPixel;
if(!screen)
{
if(!screen) {
FCEUD_PrintError(SDL_GetError());
KillVideo();
return(0);
return -1;
}
// XXX soules - this would be creating a surface on the video
// card, but was commented out for some reason...
//BlitBuf=SDL_CreateRGBSurface(SDL_HWSURFACE,256,240,screen->format->BitsPerPixel,screen->format->Rmask,screen->format->Gmask,screen->format->Bmask,0);
inited=1;
FCEU_printf(" Video Mode: %d x %d x %d bpp %s\n",
screen->w, screen->h, screen->format->BitsPerPixel,
_fullscreen ? "full screen" : "");
FCEU_printf(" Video Mode: %d x %d x %d bpp %s\n",screen->w,screen->h,screen->format->BitsPerPixel,_fullscreen?"full screen":"");
if(curbpp!=16 && curbpp!=24 && curbpp!=8 && curbpp!=32)
{
FCEU_printf(" Sorry, %dbpp modes are not supported by FCE Ultra. Supported bit depths are 8bpp, 16bpp, and 32bpp.\n",curbpp);
if(curbpp != 8 && curbpp != 16 && curbpp != 24 && curbpp != 32) {
FCEU_printf(" Sorry, %dbpp modes are not supported by FCE Ultra. Supported bit depths are 8bpp, 16bpp, and 32bpp.\n", curbpp);
KillVideo();
return(0);
return -1;
}
if(gi->name)
// if the game being run has a name, set it as the window name
if(gi->name) {
SDL_WM_SetCaption((const char *)gi->name, (const char *)gi->name);
else
} else {
SDL_WM_SetCaption("FCE Ultra","FCE Ultra");
}
#ifdef LSB_FIRST
IconSurface=SDL_CreateRGBSurfaceFrom((void *)fceu_playicon.pixel_data,32,32,24,32*3,0xFF,0xFF00,0xFF0000,0x00);
#else
IconSurface=SDL_CreateRGBSurfaceFrom((void *)fceu_playicon.pixel_data,32,32,24,32*3,0xFF0000,0xFF00,0xFF,0x00);
#endif
// create the surface for displaying graphical messages
#ifdef LSB_FIRST
IconSurface = SDL_CreateRGBSurfaceFrom((void *)fceu_playicon.pixel_data,
32, 32, 24, 32*3,
0xFF, 0xFF00, 0xFF0000, 0x00);
#else
IconSurface = SDL_CreateRGBSurfaceFrom((void *)fceu_playicon.pixel_data,
32, 32, 24, 32*3,
0xFF0000, 0xFF00, 0xFF, 0x00);
#endif
SDL_WM_SetIcon(IconSurface,0);
paletterefresh = 1;
paletterefresh=1;
if(curbpp>8)
#ifdef OPENGL
// XXX soules - can't SDL do this for us?
// if using more than 8bpp, initialize the conversion routines
if(curbpp > 8)
#ifdef OPENGL
if(!usingogl)
#endif
#endif
InitBlitToHigh(curbpp>>3,screen->format->Rmask,screen->format->Gmask,screen->format->Bmask,eefx,sponge);
#ifdef OPENGL
#ifdef OPENGL
if(usingogl)
if(!InitOpenGL((eoptions&EO_CLIPSIDES)?8:0,256-((eoptions&EO_CLIPSIDES)?8:0),srendline,erendline+1,exs,eys,eefx,_openglip,_stretchx,_stretchy,screen))
{
if(!InitOpenGL((eoptions&EO_CLIPSIDES)?8:0,256-((eoptions&EO_CLIPSIDES)?8:0),srendline,erendline+1,exs,eys,eefx,_openglip,_stretchx,_stretchy,screen)) {
FCEUD_PrintError("Error initializing OpenGL.");
KillVideo();
return(0);
return -1;
}
#endif
return 1;
#endif
return 0;
}
void ToggleFS(void)
/**
* Toggles the full-screen display.
*/
void
ToggleFS()
{
int error;
extern FCEUGI *CurGame;
KillVideo();
_fullscreen=!_fullscreen;
if(!InitVideo(CurGame))
{
_fullscreen=!_fullscreen;
// shut down the current video system
KillVideo();
// flip the fullscreen flag
_fullscreen = !_fullscreen;
// try to initialize the video
error = InitVideo(CurGame);
if(error) {
// if we fail, just continue with what worked before
_fullscreen = !_fullscreen;
InitVideo(CurGame);
}
}
static SDL_Color psdl[256];
void FCEUD_SetPalette(uint8 index, uint8 r, uint8 g, uint8 b)
{
psdl[index].r=r;
psdl[index].g=g;
psdl[index].b=b;
paletterefresh=1;
/**
* Sets the color for a particular index in the palette.
*/
void
FCEUD_SetPalette(uint8 index,
uint8 r,
uint8 g,
uint8 b)
{
psdl[index].r = r;
psdl[index].g = g;
psdl[index].b = b;
paletterefresh = 1;
}
void FCEUD_GetPalette(uint8 index, uint8 *r, uint8 *g, uint8 *b)
/**
* Gets the color for a particular index in the palette.
*/
void
FCEUD_GetPalette(uint8 index,
uint8 *r,
uint8 *g,
uint8 *b)
{
*r=psdl[index].r;
*g=psdl[index].g;
*b=psdl[index].b;
*r = psdl[index].r;
*g = psdl[index].g;
*b = psdl[index].b;
}
static void RedoPalette(void)
/**
* Pushes the palette structure into the underlying video subsystem.
*/
static void
RedoPalette()
{
#ifdef OPENGL
#ifdef OPENGL
if(usingogl)
SetOpenGLPalette((uint8*)psdl);
else
#endif
#endif
{
if(curbpp>8)
if(curbpp > 8) {
SetPaletteBlitToHigh((uint8*)psdl);
else
{
SDL_SetPalette(screen,SDL_PHYSPAL,psdl,0,256);
} else {
SDL_SetPalette(screen, SDL_PHYSPAL, psdl, 0, 256);
}
}
}
// XXX soules - console lock/unlock unimplemented?
///Currently unimplemented.
void LockConsole(){}
///Currently unimplemented.
void UnlockConsole(){}
void BlitScreen(uint8 *XBuf)
/**
* Pushes the given buffer of bits to the screen.
*/
void
BlitScreen(uint8 *XBuf)
{
SDL_Surface *TmpScreen;
uint8 *dest;
int xo=0,yo=0;
int xo = 0, yo = 0;
if(!screen) return;
if(!screen) {
return;
}
if(paletterefresh)
{
// refresh the palette if required
if(paletterefresh) {
RedoPalette();
paletterefresh=0;
}
#ifdef OPENGL
if(usingogl)
{
#ifdef OPENGL
// OpenGL is handled separately
if(usingogl) {
BlitOpenGL(XBuf);
return;
}
#endif
#endif
XBuf+=srendline*256;
// XXX soules - not entirely sure why this is being done yet
XBuf += srendline * 256;
if(BlitBuf) TmpScreen=BlitBuf;
else TmpScreen=screen;
if(BlitBuf) {
TmpScreen = BlitBuf;
} else {
TmpScreen = screen;
}
if(SDL_MUSTLOCK(TmpScreen))
if(SDL_LockSurface(TmpScreen))
{
// lock the display, if necessary
if(SDL_MUSTLOCK(TmpScreen)) {
if(SDL_LockSurface(TmpScreen) < 0) {
return;
}
}
dest=(uint8*)TmpScreen->pixels;
dest = (uint8*)TmpScreen->pixels;
if(_fullscreen)
{
xo=(int)(((TmpScreen->w-NWIDTH*exs))/2);
dest+=xo*(curbpp>>3);
if(TmpScreen->h>(tlines*eys))
{
yo=(int)((TmpScreen->h-tlines*eys)/2);
dest+=yo*TmpScreen->pitch;
if(_fullscreen) {
xo = (int)(((TmpScreen->w - NWIDTH * exs)) / 2);
dest += xo * (curbpp >> 3);
if(TmpScreen->h > (tlines * eys)) {
yo = (int)((TmpScreen->h - tlines * eys) / 2);
dest += yo * TmpScreen->pitch;
}
}
if(curbpp>8)
{
// XXX soules - again, I'm surprised SDL can't handle this
// perform the blit, converting bpp if necessary
if(curbpp > 8) {
if(BlitBuf) {
Blit8ToHigh(XBuf+NOFFSET,dest, NWIDTH, tlines, TmpScreen->pitch,1,1);
Blit8ToHigh(XBuf + NOFFSET, dest, NWIDTH, tlines,
TmpScreen->pitch, 1, 1);
} else {
Blit8ToHigh(XBuf+NOFFSET,dest, NWIDTH, tlines, TmpScreen->pitch,
(int)exs,(int)eys);
Blit8ToHigh(XBuf + NOFFSET,dest, NWIDTH, tlines,
TmpScreen->pitch, (int)exs, (int)eys);
}
}
else
{
} else {
if(BlitBuf) {
Blit8To8(XBuf+NOFFSET,dest, NWIDTH, tlines,
Blit8To8(XBuf + NOFFSET, dest, NWIDTH, tlines,
TmpScreen->pitch, 1, 1, 0, sponge);
} else {
Blit8To8(XBuf+NOFFSET, dest, NWIDTH, tlines,
Blit8To8(XBuf + NOFFSET, dest, NWIDTH, tlines,
TmpScreen->pitch, (int)exs, (int)eys, eefx, sponge);
}
}
if(SDL_MUSTLOCK(TmpScreen))
SDL_UnlockSurface(TmpScreen);
if(BlitBuf)
{
// unlock the display, if necessary
if(SDL_MUSTLOCK(TmpScreen)) {
SDL_UnlockSurface(TmpScreen);
}
// if we have a hardware video buffer, do a fast video->video copy
if(BlitBuf) {
SDL_Rect srect;
SDL_Rect drect;
srect.x=0;
srect.y=0;
srect.w=NWIDTH;
srect.h=tlines;
srect.x = 0;
srect.y = 0;
srect.w = NWIDTH;
srect.h = tlines;
drect.x=0;
drect.y=0;
drect.w=(Uint16)(exs*NWIDTH);
drect.h=(Uint16)(eys*tlines);
drect.x = 0;
drect.y = 0;
drect.w = (Uint16)(exs * NWIDTH);
drect.h = (Uint16)(eys * tlines);
SDL_BlitSurface(BlitBuf, &srect,screen,&drect);
SDL_BlitSurface(BlitBuf, &srect, screen, &drect);
}
// ensure that the display is updated
SDL_UpdateRect(screen, xo, yo, (Uint32)(NWIDTH*exs), (Uint32)(tlines*eys));
if(screen->flags&SDL_DOUBLEBUF)
// have to flip the displayed buffer in the case of double buffering
if(screen->flags & SDL_DOUBLEBUF) {
SDL_Flip(screen);
}
}
uint32 PtoV(uint16 x, uint16 y)
/**
* Converts an x-y coordinate in the window manager into an x-y
* coordinate on FCEU's screen.
*/
uint32
PtoV(uint16 x,
uint16 y)
{
y=(uint16)((double)y/eys);
x=(uint16)((double)x/exs);
if(eoptions&EO_CLIPSIDES)
x+=8;
y+=srendline;
return(x|(y<<16));
y = (uint16)((double)y / eys);
x = (uint16)((double)x / exs);
if(eoptions & EO_CLIPSIDES) {
x += 8;
}
y += srendline;
return (x | (y << 16));
}

View File

@ -140,9 +140,6 @@ void GetMouseData(uint32 *d)
uint32 t;
t=SDL_GetMouseState(&x,&y);
#ifdef EXTGUI
GUI_GetMouseState(&t,&x,&y);
#endif
d[2]=0;
if(t&SDL_BUTTON(1))
@ -192,9 +189,6 @@ static uint8 *KeyState=NULL;
char *GetKeyboard(void)
{
KeyState=SDL_GetKeyState(0);
#ifdef EXTGUI
{ char *tmp=GUI_GetKeyboard(); if(tmp) KeyState=tmp; }
#endif
return((char *)KeyState);
}
@ -207,7 +201,6 @@ char *GetKeyboard(void)
//#endif
#endif
#ifndef EXTGUI
uint8 *GetBaseDirectory(void)
{
uint8 *ol;
@ -240,7 +233,6 @@ uint8 *GetBaseDirectory(void)
}
return(ret);
}
#endif
#ifdef OPENGL
int sdlhaveogl;
@ -295,8 +287,8 @@ void ButtonConfigEnd(void)
extern FCEUGI *CurGame;
KillJoysticks();
SDL_QuitSubSystem(SDL_INIT_VIDEO);
if(bcpv) InitVideo(CurGame);
if(bcpj) InitJoysticks();
if(!bcpv) InitVideo(CurGame);
if(!bcpj) InitJoysticks();
}
int DWaitButton(const uint8 *text, ButtConfig *bc, int wb)
@ -306,9 +298,7 @@ int DWaitButton(const uint8 *text, ButtConfig *bc, int wb)
int x,y;
SDL_WM_SetCaption((const char *)text,0);
#ifndef EXTGUI
puts((const char *)text);
#endif
for(x=0;x<64;x++)
for(y=0;y<64;y++)
LastAx[x][y]=0x100000;
@ -356,18 +346,16 @@ int DWaitButton(const uint8 *text, ButtConfig *bc, int wb)
return(0);
}
#ifdef EXTGUI
int FCEUSDLmain(int argc, char *argv[])
#else
int main(int argc, char *argv[])
#endif
int
main(int argc,
char *argv[])
{
FCEUD_Message("\nStarting "FCEU_NAME_AND_VERSION"...\n");
#ifdef WIN32
#ifdef WIN32
/* Taken from win32 sdl_main.c */
SDL_SetModuleHandle(GetModuleHandle(NULL));
#endif
#endif
if(SDL_Init(SDL_INIT_VIDEO)) /* SDL_INIT_VIDEO Needed for (joystick config) event processing? */
{
@ -375,14 +363,14 @@ int main(int argc, char *argv[])
return(-1);
}
#ifdef OPENGL
#ifdef APPLEOPENGL
#ifdef OPENGL
#ifdef APPLEOPENGL
sdlhaveogl = 1; /* Stupid something... Hack. */
#else
#else
if(!SDL_GL_LoadLibrary(0)) sdlhaveogl=1;
else sdlhaveogl=0;
#endif
#endif
#endif
#endif
SetDefaults();
@ -418,6 +406,6 @@ DUMMY(FCEUD_ToggleStatusIcon)
DUMMY(FCEUD_AviRecordTo)
DUMMY(FCEUD_AviStop)
void FCEUI_AviVideoUpdate(const unsigned char* buffer) {FCEU_DispMessage("Not implemented.");}
int FCEUD_ShowStatusIcon(void) {FCEU_DispMessage("Not implemented."); return 0; }
int FCEUD_ShowStatusIcon(void) {return 0;}
int FCEUI_AviIsRecording(void) {return 0;}