From 41556196e4bb6ccaadec5d097fe587853f70b8d0 Mon Sep 17 00:00:00 2001 From: stephena Date: Thu, 4 Dec 2003 22:22:53 +0000 Subject: [PATCH] Finally added the required modifications to the SDL port for compilation in Windows. There's still some work to do in the SettingsWin32 class, and tweaking of the sound, but it's pretty close. I think its the best that Stella has ever sounded on Windows ... I use the MingW32 environment with the Ming SDL libs from libsdl,org. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@226 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/build/makefile | 878 ++++++++++++++------------- stella/src/ui/sdl/FrameBufferSDL.cxx | 6 +- stella/src/ui/sdl/SettingsWin32.cxx | 213 +++++++ stella/src/ui/sdl/SettingsWin32.hxx | 70 +++ stella/src/ui/sdl/mainSDL.cxx | 13 +- stella/src/ui/sound/SoundSDL.cxx | 23 +- stella/src/ui/sound/SoundSDL.hxx | 7 +- 7 files changed, 762 insertions(+), 448 deletions(-) create mode 100644 stella/src/ui/sdl/SettingsWin32.cxx create mode 100644 stella/src/ui/sdl/SettingsWin32.hxx diff --git a/stella/src/build/makefile b/stella/src/build/makefile index 7dddd2da9..60f3e77e3 100644 --- a/stella/src/build/makefile +++ b/stella/src/build/makefile @@ -1,430 +1,448 @@ -##============================================================================ -## -## SSSS tt lll lll -## SS SS tt ll ll -## SS tttttt eeee ll ll aaaa -## SSSS tt ee ee ll ll aa -## SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" -## SS SS tt ee ll ll aa aa -## SSSS ttt eeeee llll llll aaaaa -## -## Copyright (c) 1995-1999 by Bradford W. Mott -## -## See the file "license" for information on usage and redistribution of -## this file, and for a DISCLAIMER OF ALL WARRANTIES. -## -## $Id: makefile,v 1.45 2003-11-09 23:53:19 stephena Exp $ -##============================================================================ - -##============================================================================ -## Development environment options -## -## The following options are used during compiling. -## Comment a line out to disable that option, remove comment to enable it. -##============================================================================ - -OPTIMIZATIONS = $(CXXFLAGS) -Wall -Wunused - -### which sound drivers to compile for the SDL version -### OSS is most compatible, SDL for platforms where OSS not available -### comment out all lines to completely disable sound -### -#SOUND_ALSA = 1 -SOUND_OSS = 1 -#SOUND_SDL = 1 - -### to include OpenGL video support (SDL) -# OPENGL_SUPPORT = 1 - -### to include joystick support (SDL) -# JOYSTICK_SUPPORT = 1 - -### to include support for saving snapshots in png format -### (requires PNG library) FIXME -### Only SDL port supported for now FIXME -# SNAPSHOT_SUPPORT = 1 - -### comment this out if your system doesn't -### have the gettimeofday function -HAVE_GETTIMEOFDAY = 1 - -### to include support for game developers -### enables some extra commandline options that allow the user -### to override some emulation defaults -### Only SDL port supported for now -# DEVELOPER_SUPPORT = 1 - -### if your C++ compiler doesn't support the bool type -# BSPF_BOOL = 1 - -### if your want some timing information displayed when you exit the program -# SHOW_TIMING = 1 - -### you want a 6507 trace written to stdout -# DEBUG = 1 - -##============================================================================ -## All done, type make to get a list of frontends -## No configurable options below this line ... -##============================================================================ - -CXX = g++ -LD = g++ - -LDFLAGS = -LDLIBS = - -OBJS.SDL = -OPTS.SDL = -LIBS.SDL = `sdl-config --libs` -CFLAGS.SDL = `sdl-config --cflags` - -OPTS.DOS = -DDOS=1 - -SRC = .. -CORE = $(SRC)/emucore -UI = $(SRC)/ui -COMMON = $(SRC)/ui/common - -INCLUDES = -I. -I$(CORE) -I$(CORE)/m6502/src -I$(CORE)/m6502/src/bspf/src -I$(COMMON) - -FLAGS = $(OPTIMIZATIONS) $(INCLUDES) $(SYS_INCLUDES) - -## set the user-defined options -ifdef BSPF_BOOL -OPTS.DOS += -DBSPF_BOOL=1 -endif - -ifdef SHOW_TIMING -OPTS.SDL += -DSHOW_TIMING=1 -OPTS.DOS += -DSHOW_TIMING=1 -endif - -ifdef DEBUG -OPTS.SDL += -DDEBUG=1 -OPTS.DOS += -DDEBUG=1 -endif - -ifdef JOYSTICK_SUPPORT -OPTS.SDL += -DHAVE_JOYSTICK=1 -endif - -ifdef SNAPSHOT_SUPPORT -OBJS.SDL += Snapshot.o -OPTS.SDL += -DSNAPSHOT_SUPPORT=1 -LIBS.SDL += -lpng -lz -endif - -ifdef HAVE_GETTIMEOFDAY -OPTS.SDL += -DHAVE_GETTIMEOFDAY=1 -endif - -ifdef DEVELOPER_SUPPORT -OPTS.SDL += -DDEVELOPER_SUPPORT=1 -OPTS.DOS += -DDEVELOPER_SUPPORT=1 -endif - -ifeq ($(SOUND_OSS), 1) - OPTS.SDL += -DSOUND_OSS=1 - OBJS.SDL += SoundOSS.o -endif - -ifeq ($(SOUND_SDL), 1) - OPTS.SDL += -DSOUND_SDL=1 - OBJS.SDL += SoundSDL.o -endif - -ifeq ($(SOUND_ALSA), 1) - OPTS.SDL += -DSOUND_ALSA=1 - OBJS.SDL += SoundALSA.o - LIBS.SDL += -lasound -endif - -ifeq ($(OPENGL_SUPPORT), 1) - OPTS.SDL += -DDISPLAY_OPENGL=1 - OBJS.SDL += FrameBufferGL.o - LIBS.SDL += -lGL -lGLU -endif - - -default: - @echo "" - @echo "To build Stella type: 'make '" - @echo "You should edit the makefile for extra options" - @echo "" - @echo " is one of:" - @echo "" - @echo " dos DOS version using DJGPP" - @echo " linux-sdl Linux SDL version" - @echo "" - @echo "Hopefully new versions will be added soon!" - @echo "" - -dos: - make stella.exe \ - LD="gxx" \ - CXX="gcc" \ - INCLUDES="$(INCLUDES) -I$(UI)/dos -I$(UI)/sound" \ - OPTIONS="-DBSPF_DOS=1" \ - OPTIONS+="$(OPTS.DOS)" \ - LDFLAGS="" \ - LDLIBS="" \ - OBJS="mainDOS.o PCJoys.o SndDOS.o dos_sb.o vga.o" - -linux-sdl: - make stella.sdl \ - INCLUDES="$(INCLUDES) -I$(UI)/sdl -I$(UI)/sound" \ - SYS_INCLUDES="" \ - OPTIONS="-DBSPF_UNIX=1 -DUNIX=1" \ - OPTIONS+="$(OPTS.SDL)" \ - LDFLAGS="-L/usr/X11R6/lib" \ - LDFLAGS+="$(CFLAGS.SDL)" \ - LDLIBS="-lX11 -lXext" \ - LDLIBS+="$(LIBS.SDL)" \ - OBJS="mainSDL.o SettingsUNIX.o FrameBufferSDL.o FrameBufferSoft.o" \ - OBJS+="$(OBJS.SDL)" - -############################################################################### -## List of "core" object files -############################################################################### -M6502_OBJS = D6502.o Device.o M6502.o M6502Low.o M6502Hi.o NullDev.o System.o - -CORE_OBJS = Booster.o Cart.o Cart2K.o Cart3F.o Cart4K.o CartAR.o CartDPC.o \ - CartE0.o CartE7.o CartF4.o CartF4SC.o CartF6.o CartF6SC.o \ - CartF8.o CartF8SC.o CartFASC.o CartFE.o CartMC.o CartCV.o \ - CartMB.o Console.o Control.o Driving.o \ - Event.o Joystick.o Keyboard.o M6532.o MD5.o MediaSrc.o Paddles.o \ - Props.o PropsSet.o Random.o Sound.o Switches.o Settings.o TIA.o \ - Serializer.o Deserializer.o TIASound.o EventHandler.o FrameBuffer.o \ - $(M6502_OBJS) - -stella.exe: $(CORE_OBJS) $(OBJS) - $(LD) -o a.exe *.o $(LDFLAGS) $(LDLIBS) - exe2coff a.exe - strip a - del stella.exe - copy /B $(DJGPP:\DJGPP.ENV=)\bin\pmodstub.exe+a stella.exe - del a - del a.exe - -stella.sdl: $(CORE_OBJS) $(OBJS) - $(LD) -o stella.sdl $(CORE_OBJS) $(OBJS) $(LDFLAGS) $(LDLIBS) - -M6502Low.ins: $(CORE)/m6502/src/M6502Low.m4 $(CORE)/m6502/src/M6502.m4 - m4 $(CORE)/m6502/src/M6502Low.m4 $(CORE)/m6502/src/M6502.m4 > M6502Low.ins - -M6502Hi.ins: $(CORE)/m6502/src/M6502Hi.m4 $(CORE)/m6502/src/M6502.m4 - m4 $(CORE)/m6502/src/M6502Hi.m4 $(CORE)/m6502/src/M6502.m4 > M6502Hi.ins - -M6502Low.o: M6502Low.ins -M6502Hi.o: M6502Hi.ins - -cleandos: - del *.o - del stella.exe - del M6502Low.ins - del M6502Hi.ins - -clean: - rm -f *.o stella stella.sdl stella.exe core - -cleanall: clean - rm -f M6502Low.ins M6502Hi.ins - -Driving.o: $(CORE)/Driving.cxx $(CORE)/Driving.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Driving.cxx - -Event.o: $(CORE)/Event.cxx $(CORE)/Event.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Event.cxx - -EventHandler.o: $(CORE)/EventHandler.cxx $(CORE)/EventHandler.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/EventHandler.cxx - -Control.o: $(CORE)/Control.cxx $(CORE)/Control.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Control.cxx - -Joystick.o: $(CORE)/Joystick.cxx $(CORE)/Joystick.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Joystick.cxx - -Keyboard.o: $(CORE)/Keyboard.cxx $(CORE)/Keyboard.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Keyboard.cxx - -Paddles.o: $(CORE)/Paddles.cxx $(CORE)/Paddles.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Paddles.cxx - -Booster.o: $(CORE)/Booster.cxx $(CORE)/Booster.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Booster.cxx - -Cart.o: $(CORE)/Cart.cxx $(CORE)/Cart.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Cart.cxx - -Cart2K.o: $(CORE)/Cart2K.cxx $(CORE)/Cart2K.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Cart2K.cxx - -Cart3F.o: $(CORE)/Cart3F.cxx $(CORE)/Cart3F.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Cart3F.cxx - -Cart4K.o: $(CORE)/Cart4K.cxx $(CORE)/Cart4K.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Cart4K.cxx - -CartAR.o: $(CORE)/CartAR.cxx $(CORE)/CartAR.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartAR.cxx - -CartDPC.o: $(CORE)/CartDPC.cxx $(CORE)/CartDPC.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartDPC.cxx - -CartE0.o: $(CORE)/CartE0.cxx $(CORE)/CartE0.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartE0.cxx - -CartE7.o: $(CORE)/CartE7.cxx $(CORE)/CartE7.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartE7.cxx - -CartF4.o: $(CORE)/CartF4.cxx $(CORE)/CartF4.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartF4.cxx - -CartF4SC.o: $(CORE)/CartF4SC.cxx $(CORE)/CartF4SC.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartF4SC.cxx - -CartF6.o: $(CORE)/CartF6.cxx $(CORE)/CartF6.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartF6.cxx - -CartF6SC.o: $(CORE)/CartF6SC.cxx $(CORE)/CartF6SC.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartF6SC.cxx - -CartF8.o: $(CORE)/CartF8.cxx $(CORE)/CartF8.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartF8.cxx - -CartF8SC.o: $(CORE)/CartF8SC.cxx $(CORE)/CartF8SC.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartF8SC.cxx - -CartFASC.o: $(CORE)/CartFASC.cxx $(CORE)/CartFASC.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartFASC.cxx - -CartFE.o: $(CORE)/CartFE.cxx $(CORE)/CartFE.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartFE.cxx - -CartMC.o: $(CORE)/CartMC.cxx $(CORE)/CartMC.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartMC.cxx - -CartMB.o: $(CORE)/CartMB.cxx $(CORE)/CartMB.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartMB.cxx - -CartCV.o: $(CORE)/CartCV.cxx $(CORE)/CartCV.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartCV.cxx - -M6532.o: $(CORE)/M6532.cxx $(CORE)/M6532.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/M6532.cxx - -TIA.o: $(CORE)/TIA.cxx $(CORE)/TIA.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/TIA.cxx - -TIASound.o: $(CORE)/TIASound.c $(CORE)/TIASound.h - $(CXX) -c -DWIN32 $(FLAGS) $(OPTIONS) $(CORE)/TIASound.c - -Console.o: $(CORE)/Console.cxx $(CORE)/Console.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Console.cxx - -MD5.o: $(CORE)/MD5.cxx $(CORE)/MD5.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/MD5.cxx - -MediaSrc.o: $(CORE)/MediaSrc.cxx $(CORE)/MediaSrc.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/MediaSrc.cxx - -FrameBuffer.o: $(CORE)/FrameBuffer.cxx $(CORE)/FrameBuffer.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/FrameBuffer.cxx - -PropsSet.o: $(CORE)/PropsSet.cxx $(CORE)/PropsSet.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/PropsSet.cxx - -Props.o: $(CORE)/Props.cxx $(CORE)/Props.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Props.cxx - -Random.o: $(CORE)/Random.cxx $(CORE)/Random.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Random.cxx - -Sound.o: $(CORE)/Sound.cxx $(CORE)/Sound.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(CORE)/Sound.cxx - -Switches.o: $(CORE)/Switches.cxx $(CORE)/Switches.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Switches.cxx - -Serializer.o: $(CORE)/Serializer.cxx $(CORE)/Serializer.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Serializer.cxx - -Deserializer.o: $(CORE)/Deserializer.cxx $(CORE)/Deserializer.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Deserializer.cxx - -Settings.o: $(CORE)/Settings.cxx $(CORE)/Settings.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(CORE)/Settings.cxx - -SettingsUNIX.o: $(UI)/sdl/SettingsUNIX.cxx $(UI)/sdl/SettingsUNIX.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sdl/SettingsUNIX.cxx - -Terminal.o: $(UI)/x11/Terminal.cxx $(UI)/x11/Terminal.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(UI)/x11/Terminal.cxx - -mainDOS.o: $(UI)/dos/mainDOS.cxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(UI)/dos/mainDOS.cxx - -PCJoys.o: $(UI)/dos/PCJoys.cxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(UI)/dos/PCJoys.cxx - -SndDOS.o: $(UI)/dos/SndDOS.cxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(UI)/dos/SndDOS.cxx - -dos_sb.o: $(UI)/dos/dos_sb.c - $(CXX) -c $(FLAGS) $(OPTIONS) $(UI)/dos/dos_sb.c - -vga.o: $(UI)/dos/vga.cxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(UI)/dos/vga.cxx - -SoundALSA.o: $(UI)/sound/SoundALSA.cxx $(UI)/sound/SoundALSA.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sound/SoundALSA.cxx - -SoundOSS.o: $(UI)/sound/SoundOSS.cxx $(UI)/sound/SoundOSS.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sound/SoundOSS.cxx - -SoundSDL.o: $(UI)/sound/SoundSDL.cxx $(UI)/sound/SoundSDL.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sound/SoundSDL.cxx - -mainX11.o: $(UI)/x11/mainX11.cxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/x11/mainX11.cxx - -mainSDL.o: $(UI)/sdl/mainSDL.cxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sdl/mainSDL.cxx - -RectList.o: $(UI)/sdl/RectList.cxx $(UI)/sdl/RectList.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sdl/RectList.cxx - -FrameBufferSDL.o: $(UI)/sdl/FrameBufferSDL.cxx $(UI)/sdl/FrameBufferSDL.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sdl/FrameBufferSDL.cxx - -FrameBufferSoft.o: $(UI)/sdl/FrameBufferSoft.cxx $(UI)/sdl/FrameBufferSoft.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sdl/FrameBufferSoft.cxx - -FrameBufferGL.o: $(UI)/sdl/FrameBufferGL.cxx $(UI)/sdl/FrameBufferGL.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sdl/FrameBufferGL.cxx - -Snapshot.o: $(UI)/common/Snapshot.cxx $(UI)/common/Snapshot.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/common/Snapshot.cxx - -D6502.o: $(CORE)/m6502/src/D6502.cxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/D6502.cxx - -Device.o: $(CORE)/m6502/src/Device.cxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/Device.cxx - -M6502.o: $(CORE)/m6502/src/M6502.cxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/M6502.cxx - -M6502Low.o: $(CORE)/m6502/src/M6502Low.cxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/M6502Low.cxx - -M6502Hi.o: $(CORE)/m6502/src/M6502Hi.cxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/M6502Hi.cxx - -NullDev.o: $(CORE)/m6502/src/NullDev.cxx $(CORE)/m6502/src/NullDev.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/NullDev.cxx - -System.o: $(CORE)/m6502/src/System.cxx $(CORE)/m6502/src/System.hxx - $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/System.cxx +##============================================================================ +## +## SSSS tt lll lll +## SS SS tt ll ll +## SS tttttt eeee ll ll aaaa +## SSSS tt ee ee ll ll aa +## SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" +## SS SS tt ee ll ll aa aa +## SSSS ttt eeeee llll llll aaaaa +## +## Copyright (c) 1995-1999 by Bradford W. Mott +## +## See the file "license" for information on usage and redistribution of +## this file, and for a DISCLAIMER OF ALL WARRANTIES. +## +## $Id: makefile,v 1.46 2003-12-04 22:22:53 stephena Exp $ +##============================================================================ + +##============================================================================ +## Development environment options +## +## The following options are used during compiling. +## Comment a line out to disable that option, remove comment to enable it. +##============================================================================ + +OPTIMIZATIONS = $(CXXFLAGS) -Wall -Wunused + +### which sound drivers to compile for the SDL version +### OSS is most compatible, SDL for platforms where OSS not available +### comment out all lines to completely disable sound +### +#SOUND_ALSA = 1 +#SOUND_OSS = 1 +SOUND_SDL = 1 + +### to include OpenGL video support (SDL) + OPENGL_SUPPORT = 1 + +### to include joystick support (SDL) + JOYSTICK_SUPPORT = 1 + +### to include support for saving snapshots in png format +### (requires PNG library) FIXME +### Only SDL port supported for now FIXME +# SNAPSHOT_SUPPORT = 1 + +### comment this out if your system doesn't +### have the gettimeofday function +#HAVE_GETTIMEOFDAY = 1 + +### to include support for game developers +### enables some extra commandline options that allow the user +### to override some emulation defaults +### Only SDL port supported for now + DEVELOPER_SUPPORT = 1 + +### if your C++ compiler doesn't support the bool type +# BSPF_BOOL = 1 + +### if your want some timing information displayed when you exit the program +# SHOW_TIMING = 1 + +### you want a 6507 trace written to stdout +# DEBUG = 1 + +##============================================================================ +## All done, type make to get a list of frontends +## No configurable options below this line ... +##============================================================================ + +CXX = g++ +LD = g++ + +LDFLAGS = +LDLIBS = + +OBJS.SDL = +OPTS.SDL = +LIBS.SDL = `sdl-config --libs` +CFLAGS.SDL = `sdl-config --cflags` + +OPTS.DOS = -DDOS=1 + +SRC = .. +CORE = $(SRC)/emucore +UI = $(SRC)/ui +COMMON = $(SRC)/ui/common + +INCLUDES = -I. -I$(CORE) -I$(CORE)/m6502/src -I$(CORE)/m6502/src/bspf/src -I$(COMMON) + +FLAGS = $(OPTIMIZATIONS) $(INCLUDES) $(SYS_INCLUDES) + +## set the user-defined options +ifdef BSPF_BOOL +OPTS.DOS += -DBSPF_BOOL=1 +endif + +ifdef SHOW_TIMING +OPTS.SDL += -DSHOW_TIMING=1 +OPTS.DOS += -DSHOW_TIMING=1 +endif + +ifdef DEBUG +OPTS.SDL += -DDEBUG=1 +OPTS.DOS += -DDEBUG=1 +endif + +ifdef JOYSTICK_SUPPORT +OPTS.SDL += -DHAVE_JOYSTICK=1 +endif + +ifdef SNAPSHOT_SUPPORT +OBJS.SDL += Snapshot.o +OPTS.SDL += -DSNAPSHOT_SUPPORT=1 +LIBS.SDL += -lpng -lz +endif + +ifdef HAVE_GETTIMEOFDAY +OPTS.SDL += -DHAVE_GETTIMEOFDAY=1 +endif + +ifdef DEVELOPER_SUPPORT +OPTS.SDL += -DDEVELOPER_SUPPORT=1 +OPTS.DOS += -DDEVELOPER_SUPPORT=1 +endif + +ifeq ($(sounD_OSS), 1) + OPTS.SDL += -DSOUND_OSS=1 + OBJS.SDL += SoundOSS.o +endif + +ifeq ($(SOUND_SDL), 1) + OPTS.SDL += -DSOUND_SDL=1 + OBJS.SDL += SoundSDL.o +endif + +ifeq ($(SOUND_ALSA), 1) + OPTS.SDL += -DSOUND_ALSA=1 + OBJS.SDL += SoundALSA.o + LIBS.SDL += -lasound +endif + +ifeq ($(OPENGL_SUPPORT), 1) + OPTS.SDL += -DDISPLAY_OPENGL=1 + OBJS.SDL += FrameBufferGL.o + LIBS.SDL += -lopengl32 +endif + + +default: + @echo "" + @echo "To build Stella type: 'make '" + @echo "You should edit the makefile for extra options" + @echo "" + @echo " is one of:" + @echo "" + @echo " dos DOS version using DJGPP" + @echo " linux-sdl Linux SDL version" + @echo " win32-sdl Windows SDL version" + @echo "" + @echo "Hopefully new versions will be added soon!" + @echo "" + +dos: + make stella.exe \ + LD="gxx" \ + CXX="gcc" \ + INCLUDES="$(INCLUDES) -I$(UI)/dos -I$(UI)/sound" \ + OPTIONS="-DBSPF_DOS=1" \ + OPTIONS+="$(OPTS.DOS)" \ + LDFLAGS="" \ + LDLIBS="" \ + OBJS="mainDOS.o PCJoys.o SndDOS.o dos_sb.o vga.o" + +linux-sdl: + make stella.sdl \ + INCLUDES="$(INCLUDES) -I$(UI)/sdl -I$(UI)/sound" \ + SYS_INCLUDES="" \ + OPTIONS="-DBSPF_UNIX=1 -DUNIX=1" \ + OPTIONS+="$(OPTS.SDL)" \ + LDFLAGS="-L/usr/X11R6/lib" \ + LDFLAGS+="$(CFLAGS.SDL)" \ + LDLIBS="-lX11 -lXext" \ + LDLIBS+="$(LIBS.SDL)" \ + OBJS="mainSDL.o SettingsUNIX.o FrameBufferSDL.o FrameBufferSoft.o" \ + OBJS+="$(OBJS.SDL)" + +win32-sdl: + make stella.sdl \ + INCLUDES="$(INCLUDES) -I$(UI)/sdl -I$(UI)/sound" \ + SYS_INCLUDES="" \ + OPTIONS="-DBSPF_UNIX=1 -DWIN32" \ + OPTIONS+="$(OPTS.SDL)" \ + LDFLAGS="" \ + LDFLAGS+="$(CFLAGS.SDL)" \ + LDLIBS="" \ + LDLIBS+="$(LIBS.SDL)" \ + OBJS="mainSDL.o SettingsWin32.o FrameBufferSDL.o FrameBufferSoft.o" \ + OBJS+="$(OBJS.SDL)" + + +############################################################################### +## List of "core" object files +############################################################################### +M6502_OBJS = D6502.o Device.o M6502.o M6502Low.o M6502Hi.o NullDev.o System.o + +CORE_OBJS = Booster.o Cart.o Cart2K.o Cart3F.o Cart4K.o CartAR.o CartDPC.o \ + CartE0.o CartE7.o CartF4.o CartF4SC.o CartF6.o CartF6SC.o \ + CartF8.o CartF8SC.o CartFASC.o CartFE.o CartMC.o CartCV.o \ + CartMB.o Console.o Control.o Driving.o \ + Event.o Joystick.o Keyboard.o M6532.o MD5.o MediaSrc.o Paddles.o \ + Props.o PropsSet.o Random.o Sound.o Switches.o Settings.o TIA.o \ + Serializer.o Deserializer.o TIASound.o EventHandler.o FrameBuffer.o \ + $(M6502_OBJS) + +stella.exe: $(CORE_OBJS) $(OBJS) + $(LD) -o a.exe *.o $(LDFLAGS) $(LDLIBS) + exe2coff a.exe + strip a + del stella.exe + copy /B $(DJGPP:\DJGPP.ENV=)\bin\pmodstub.exe+a stella.exe + del a + del a.exe + +stella.sdl: $(CORE_OBJS) $(OBJS) + $(LD) -o stella.sdl $(CORE_OBJS) $(OBJS) $(LDFLAGS) $(LDLIBS) + +M6502Low.ins: $(CORE)/m6502/src/M6502Low.m4 $(CORE)/m6502/src/M6502.m4 + m4 $(CORE)/m6502/src/M6502Low.m4 $(CORE)/m6502/src/M6502.m4 > M6502Low.ins + +M6502Hi.ins: $(CORE)/m6502/src/M6502Hi.m4 $(CORE)/m6502/src/M6502.m4 + m4 $(CORE)/m6502/src/M6502Hi.m4 $(CORE)/m6502/src/M6502.m4 > M6502Hi.ins + +M6502Low.o: M6502Low.ins +M6502Hi.o: M6502Hi.ins + +cleandos: + del *.o + del stella.exe + del M6502Low.ins + del M6502Hi.ins + +clean: + rm -f *.o stella stella.sdl stella.exe core + +cleanall: clean + rm -f M6502Low.ins M6502Hi.ins + +Driving.o: $(CORE)/Driving.cxx $(CORE)/Driving.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Driving.cxx + +Event.o: $(CORE)/Event.cxx $(CORE)/Event.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Event.cxx + +EventHandler.o: $(CORE)/EventHandler.cxx $(CORE)/EventHandler.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/EventHandler.cxx + +Control.o: $(CORE)/Control.cxx $(CORE)/Control.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Control.cxx + +Joystick.o: $(CORE)/Joystick.cxx $(CORE)/Joystick.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Joystick.cxx + +Keyboard.o: $(CORE)/Keyboard.cxx $(CORE)/Keyboard.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Keyboard.cxx + +Paddles.o: $(CORE)/Paddles.cxx $(CORE)/Paddles.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Paddles.cxx + +Booster.o: $(CORE)/Booster.cxx $(CORE)/Booster.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Booster.cxx + +Cart.o: $(CORE)/Cart.cxx $(CORE)/Cart.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Cart.cxx + +Cart2K.o: $(CORE)/Cart2K.cxx $(CORE)/Cart2K.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Cart2K.cxx + +Cart3F.o: $(CORE)/Cart3F.cxx $(CORE)/Cart3F.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Cart3F.cxx + +Cart4K.o: $(CORE)/Cart4K.cxx $(CORE)/Cart4K.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Cart4K.cxx + +CartAR.o: $(CORE)/CartAR.cxx $(CORE)/CartAR.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartAR.cxx + +CartDPC.o: $(CORE)/CartDPC.cxx $(CORE)/CartDPC.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartDPC.cxx + +CartE0.o: $(CORE)/CartE0.cxx $(CORE)/CartE0.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartE0.cxx + +CartE7.o: $(CORE)/CartE7.cxx $(CORE)/CartE7.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartE7.cxx + +CartF4.o: $(CORE)/CartF4.cxx $(CORE)/CartF4.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartF4.cxx + +CartF4SC.o: $(CORE)/CartF4SC.cxx $(CORE)/CartF4SC.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartF4SC.cxx + +CartF6.o: $(CORE)/CartF6.cxx $(CORE)/CartF6.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartF6.cxx + +CartF6SC.o: $(CORE)/CartF6SC.cxx $(CORE)/CartF6SC.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartF6SC.cxx + +CartF8.o: $(CORE)/CartF8.cxx $(CORE)/CartF8.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartF8.cxx + +CartF8SC.o: $(CORE)/CartF8SC.cxx $(CORE)/CartF8SC.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartF8SC.cxx + +CartFASC.o: $(CORE)/CartFASC.cxx $(CORE)/CartFASC.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartFASC.cxx + +CartFE.o: $(CORE)/CartFE.cxx $(CORE)/CartFE.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartFE.cxx + +CartMC.o: $(CORE)/CartMC.cxx $(CORE)/CartMC.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartMC.cxx + +CartMB.o: $(CORE)/CartMB.cxx $(CORE)/CartMB.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartMB.cxx + +CartCV.o: $(CORE)/CartCV.cxx $(CORE)/CartCV.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartCV.cxx + +M6532.o: $(CORE)/M6532.cxx $(CORE)/M6532.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/M6532.cxx + +TIA.o: $(CORE)/TIA.cxx $(CORE)/TIA.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/TIA.cxx + +TIASound.o: $(CORE)/TIASound.c $(CORE)/TIASound.h + $(CXX) -c -DWIN32 $(FLAGS) $(OPTIONS) $(CORE)/TIASound.c + +Console.o: $(CORE)/Console.cxx $(CORE)/Console.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Console.cxx + +MD5.o: $(CORE)/MD5.cxx $(CORE)/MD5.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/MD5.cxx + +MediaSrc.o: $(CORE)/MediaSrc.cxx $(CORE)/MediaSrc.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/MediaSrc.cxx + +FrameBuffer.o: $(CORE)/FrameBuffer.cxx $(CORE)/FrameBuffer.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/FrameBuffer.cxx + +PropsSet.o: $(CORE)/PropsSet.cxx $(CORE)/PropsSet.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/PropsSet.cxx + +Props.o: $(CORE)/Props.cxx $(CORE)/Props.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Props.cxx + +Random.o: $(CORE)/Random.cxx $(CORE)/Random.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Random.cxx + +Sound.o: $(CORE)/Sound.cxx $(CORE)/Sound.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(CORE)/Sound.cxx + +Switches.o: $(CORE)/Switches.cxx $(CORE)/Switches.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Switches.cxx + +Serializer.o: $(CORE)/Serializer.cxx $(CORE)/Serializer.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Serializer.cxx + +Deserializer.o: $(CORE)/Deserializer.cxx $(CORE)/Deserializer.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Deserializer.cxx + +Settings.o: $(CORE)/Settings.cxx $(CORE)/Settings.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(CORE)/Settings.cxx + +SettingsUNIX.o: $(UI)/sdl/SettingsUNIX.cxx $(UI)/sdl/SettingsUNIX.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sdl/SettingsUNIX.cxx + +SettingsWin32.o: $(UI)/sdl/SettingsWin32.cxx $(UI)/sdl/SettingsWin32.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sdl/SettingsWin32.cxx + +Terminal.o: $(UI)/x11/Terminal.cxx $(UI)/x11/Terminal.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(UI)/x11/Terminal.cxx + +mainDOS.o: $(UI)/dos/mainDOS.cxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(UI)/dos/mainDOS.cxx + +PCJoys.o: $(UI)/dos/PCJoys.cxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(UI)/dos/PCJoys.cxx + +SndDOS.o: $(UI)/dos/SndDOS.cxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(UI)/dos/SndDOS.cxx + +dos_sb.o: $(UI)/dos/dos_sb.c + $(CXX) -c $(FLAGS) $(OPTIONS) $(UI)/dos/dos_sb.c + +vga.o: $(UI)/dos/vga.cxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(UI)/dos/vga.cxx + +SoundALSA.o: $(UI)/sound/SoundALSA.cxx $(UI)/sound/SoundALSA.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sound/SoundALSA.cxx + +SoundOSS.o: $(UI)/sound/SoundOSS.cxx $(UI)/sound/SoundOSS.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sound/SoundOSS.cxx + +SoundSDL.o: $(UI)/sound/SoundSDL.cxx $(UI)/sound/SoundSDL.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sound/SoundSDL.cxx + +mainX11.o: $(UI)/x11/mainX11.cxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/x11/mainX11.cxx + +mainSDL.o: $(UI)/sdl/mainSDL.cxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sdl/mainSDL.cxx + +RectList.o: $(UI)/sdl/RectList.cxx $(UI)/sdl/RectList.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sdl/RectList.cxx + +FrameBufferSDL.o: $(UI)/sdl/FrameBufferSDL.cxx $(UI)/sdl/FrameBufferSDL.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sdl/FrameBufferSDL.cxx + +FrameBufferSoft.o: $(UI)/sdl/FrameBufferSoft.cxx $(UI)/sdl/FrameBufferSoft.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sdl/FrameBufferSoft.cxx + +FrameBufferGL.o: $(UI)/sdl/FrameBufferGL.cxx $(UI)/sdl/FrameBufferGL.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/sdl/FrameBufferGL.cxx + +Snapshot.o: $(UI)/common/Snapshot.cxx $(UI)/common/Snapshot.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/common/Snapshot.cxx + +D6502.o: $(CORE)/m6502/src/D6502.cxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/D6502.cxx + +Device.o: $(CORE)/m6502/src/Device.cxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/Device.cxx + +M6502.o: $(CORE)/m6502/src/M6502.cxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/M6502.cxx + +M6502Low.o: $(CORE)/m6502/src/M6502Low.cxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/M6502Low.cxx + +M6502Hi.o: $(CORE)/m6502/src/M6502Hi.cxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/M6502Hi.cxx + +NullDev.o: $(CORE)/m6502/src/NullDev.cxx $(CORE)/m6502/src/NullDev.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/NullDev.cxx + +System.o: $(CORE)/m6502/src/System.cxx $(CORE)/m6502/src/System.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/System.cxx diff --git a/stella/src/ui/sdl/FrameBufferSDL.cxx b/stella/src/ui/sdl/FrameBufferSDL.cxx index d812a086b..49785c834 100644 --- a/stella/src/ui/sdl/FrameBufferSDL.cxx +++ b/stella/src/ui/sdl/FrameBufferSDL.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: FrameBufferSDL.cxx,v 1.8 2003-12-03 18:11:25 stephena Exp $ +// $Id: FrameBufferSDL.cxx,v 1.9 2003-12-04 22:22:53 stephena Exp $ //============================================================================ #include @@ -155,7 +155,7 @@ void FrameBufferSDL::grabMouse(bool grab) uInt32 FrameBufferSDL::maxWindowSizeForScreen() { if(!x11Available) - return 3; + return 4; #ifdef UNIX // Otherwise, lock the screen and get the width and height @@ -186,6 +186,8 @@ uInt32 FrameBufferSDL::maxWindowSizeForScreen() else return 1; #endif + + return 4; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/ui/sdl/SettingsWin32.cxx b/stella/src/ui/sdl/SettingsWin32.cxx new file mode 100644 index 000000000..10eae8718 --- /dev/null +++ b/stella/src/ui/sdl/SettingsWin32.cxx @@ -0,0 +1,213 @@ +//============================================================================ +// +// SSSS tt lll lll +// SS SS tt ll ll +// SS tttttt eeee ll ll aaaa +// SSSS tt ee ee ll ll aa +// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" +// SS SS tt ee ll ll aa aa +// SSSS ttt eeeee llll llll aaaaa +// +// Copyright (c) 1995-1999 by Bradford W. Mott +// +// See the file "license" for information on usage and redistribution of +// this file, and for a DISCLAIMER OF ALL WARRANTIES. +// +// $Id: SettingsWin32.cxx,v 1.1 2003-12-04 22:22:53 stephena Exp $ +//============================================================================ + +#include +#include +#include + +#include +#include +#include + +#include "bspf.hxx" +#include "Console.hxx" +#include "EventHandler.hxx" +#include "StellaEvent.hxx" + +#include "Settings.hxx" +#include "SettingsWin32.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +SettingsWin32::SettingsWin32() +{ + // First set variables that the parent class needs + myBaseDir = ".\\"; + string stelladir = myBaseDir; + +// if(access(stelladir.c_str(), R_OK|W_OK|X_OK) != 0 ) +// mkdir(stelladir.c_str(), 0777); + + myStateDir = stelladir + "state\\"; +// if(access(myStateDir.c_str(), R_OK|W_OK|X_OK) != 0 ) +// mkdir(myStateDir.c_str(), 0777); + + myUserPropertiesFile = stelladir + "stella.pro"; + mySystemPropertiesFile = stelladir + "stella.pro"; + myUserConfigFile = stelladir + "stellarc"; + mySystemConfigFile = stelladir + "stellarc"; + + // Set up the names of the input and output config files + mySettingsOutputFilename = myUserConfigFile; +// if(access(myUserConfigFile.c_str(), R_OK) == 0) + mySettingsInputFilename = myUserConfigFile; +// else +// mySettingsInputFilename = mySystemConfigFile; + + mySnapshotFile = ""; + myStateFile = ""; + + // Now create UNIX specific settings + set("video", "soft"); +#ifdef DISPLAY_OPENGL + set("gl_filter", "nearest"); + set("gl_aspect", "2"); +#endif + set("sound", "sdl"); + set("fullscreen", "false"); + set("grabmouse", "false"); + set("hidecursor", "false"); + set("volume", "-1"); + set("accurate", "false"); // Don't change this, or the sound will skip +#ifdef SNAPSHOT_SUPPORT + set("ssname", "romname"); + set("ssdir", ".\\"); + set("ssingle", "false"); +#endif + set("joyleft", "0"); + set("joyright", "1"); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +SettingsWin32::~SettingsWin32() +{ +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void SettingsWin32::usage(string& message) +{ + cout << endl + << message << endl + << endl + << "Valid options are:" << endl + << endl + << " -video Type is one of the following:\n" + << " soft SDL software mode\n" +#ifdef DISPLAY_OPENGL + << " gl SDL OpenGL mode\n" + << endl + << " -gl_filter Type is one of the following:\n" + << " nearest Normal scaling (GL_NEAREST)\n" + << " linear Blurred scaling (GL_LINEAR)\n" + << " -gl_aspect Scale the width by the given amount\n" + << endl +#endif + << " -sound Type is one of the following:\n" + << " 0 Disables all sound generation\n" + #ifdef SOUND_ALSA + << " alsa ALSA version 0.9 driver\n" + #endif + #ifdef SOUND_OSS + << " oss Open Sound System driver\n" + #endif + #ifdef SOUND_SDL + << " sdl Native SDL driver\n" + #endif + << endl + << " -framerate Display the given number of frames per second\n" + << " -zoom Makes window be 'size' times normal\n" + << " -fullscreen <0|1> Play the game in fullscreen mode\n" + << " -grabmouse <0|1> Keeps the mouse in the game window\n" + << " -hidecursor <0|1> Hides the mouse cursor in the game window\n" + << " -volume Set the volume (0 - 100)\n" +#ifdef HAVE_JOYSTICK + << " -paddle <0|1|2|3|real> Indicates which paddle the mouse should emulate\n" + << " or that real Atari 2600 paddles are being used\n" + << " -joyleft The joystick number representing the left controller\n" + << " -joyright The joystick number representing the right controller\n" +#else + << " -paddle <0|1|2|3> Indicates which paddle the mouse should emulate\n" +#endif + << " -altpro Use the given properties file instead of stella.pro\n" + << " -showinfo <0|1> Shows some game info\n" + << " -accurate <0|1> Accurate game timing (uses more CPU)\n" + #ifdef SNAPSHOT_SUPPORT + << " -ssdir The directory to save snapshot files to\n" + << " -ssname How to name the snapshot (romname or md5sum)\n" + << " -sssingle <0|1> Generate single snapshot instead of many\n" + #endif + << endl + #ifdef DEVELOPER_SUPPORT + << " DEVELOPER options (see Stella manual for details)\n" + << " -Dformat Sets \"Display.Format\"\n" + << " -Dxstart Sets \"Display.XStart\"\n" + << " -Dwidth Sets \"Display.Width\"\n" + << " -Dystart Sets \"Display.YStart\"\n" + << " -Dheight Sets \"Display.Height\"\n" + << " -mergeprops <0|1> Merge changed properties into properties file,\n" + << " or save into a separate file\n" + #endif + << endl; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +string SettingsWin32::stateFilename(uInt32 state) +{ + if(!myConsole) + return ""; + + ostringstream buf; + buf << myStateDir << myConsole->properties().get("Cartridge.MD5") + << ".st" << state; + + myStateFile = buf.str(); + return myStateFile; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +string SettingsWin32::snapshotFilename() +{ + if(!myConsole) + return ""; + + string filename; + string path = getString("ssdir"); + string theSnapshotName = getString("ssname"); + + if(theSnapshotName == "romname") + path = path + "/" + myConsole->properties().get("Cartridge.Name"); + else if(theSnapshotName == "md5sum") + path = path + "/" + myConsole->properties().get("Cartridge.MD5"); + + // Replace all spaces in name with underscores + replace(path.begin(), path.end(), ' ', '_'); + + // Check whether we want multiple snapshots created + if(!getBool("sssingle")) + { + // Determine if the file already exists, checking each successive filename + // until one doesn't exist + filename = path + ".png"; + if(access(filename.c_str(), F_OK) == 0 ) + { + ostringstream buf; + for(uInt32 i = 1; ;++i) + { + buf.str(""); + buf << path << "_" << i << ".png"; + if(access(buf.str().c_str(), F_OK) == -1 ) + break; + } + filename = buf.str(); + } + } + else + filename = path + ".png"; + + mySnapshotFile = filename; + return mySnapshotFile; +} diff --git a/stella/src/ui/sdl/SettingsWin32.hxx b/stella/src/ui/sdl/SettingsWin32.hxx new file mode 100644 index 000000000..491456318 --- /dev/null +++ b/stella/src/ui/sdl/SettingsWin32.hxx @@ -0,0 +1,70 @@ +//============================================================================ +// +// SSSS tt lll lll +// SS SS tt ll ll +// SS tttttt eeee ll ll aaaa +// SSSS tt ee ee ll ll aa +// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" +// SS SS tt ee ll ll aa aa +// SSSS ttt eeeee llll llll aaaaa +// +// Copyright (c) 1995-1999 by Bradford W. Mott +// +// See the file "license" for information on usage and redistribution of +// this file, and for a DISCLAIMER OF ALL WARRANTIES. +// +// $Id: SettingsWin32.hxx,v 1.1 2003-12-04 22:22:53 stephena Exp $ +//============================================================================ + +#ifndef SETTINGS_WIN32_HXX +#define SETTINGS_WIN32_HXX + +#include "bspf.hxx" + +class Console; + + +/** + This class defines Windows system specific settings. + + @author Stephen Anthony + @version $Id: SettingsWin32.hxx,v 1.1 2003-12-04 22:22:53 stephena Exp $ +*/ +class SettingsWin32 : public Settings +{ + public: + /** + Create a new UNIX settings object + */ + SettingsWin32(); + + /** + Destructor + */ + virtual ~SettingsWin32(); + + public: + /** + This method should be called to get the filename of a state file + given the state number. + + @return String representing the full path of the state filename. + */ + virtual string stateFilename(uInt32 state); + + /** + This method should be called to get the filename of a snapshot. + + @return String representing the full path of the snapshot filename. + */ + virtual string snapshotFilename(); + + /** + Display the commandline settings for this UNIX version of Stella. + + @param message A short message about this version of Stella + */ + virtual void usage(string& message); +}; + +#endif diff --git a/stella/src/ui/sdl/mainSDL.cxx b/stella/src/ui/sdl/mainSDL.cxx index 7648a8253..6d204291f 100644 --- a/stella/src/ui/sdl/mainSDL.cxx +++ b/stella/src/ui/sdl/mainSDL.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: mainSDL.cxx,v 1.63 2003-12-04 19:18:45 stephena Exp $ +// $Id: mainSDL.cxx,v 1.64 2003-12-04 22:22:53 stephena Exp $ //============================================================================ #include @@ -61,6 +61,10 @@ #include "SettingsUNIX.hxx" #endif +#ifdef WIN32 + #include "SettingsWin32.hxx" +#endif + static void cleanup(); static bool setupJoystick(); static void handleEvents(); @@ -664,6 +668,9 @@ int main(int argc, char* argv[]) { #ifdef UNIX theSettings = new SettingsUNIX(); +#endif +#ifdef WIN32 + theSettings = new SettingsWin32(); #endif if(!theSettings) { @@ -687,13 +694,13 @@ int main(int argc, char* argv[]) // Request that the SDL window be centered, if possible // This will probably only work under Linux - setenv("SDL_VIDEO_CENTERED", "1", 1); + putenv("SDL_VIDEO_CENTERED"); // Get a pointer to the file which contains the cartridge ROM const char* file = argv[argc - 1]; // Open the cartridge image and read it in - ifstream in(file); + ifstream in(file, ios_base::binary); if(!in) { cerr << "ERROR: Couldn't open " << file << "..." << endl; diff --git a/stella/src/ui/sound/SoundSDL.cxx b/stella/src/ui/sound/SoundSDL.cxx index ef3c17026..553c75d4a 100644 --- a/stella/src/ui/sound/SoundSDL.cxx +++ b/stella/src/ui/sound/SoundSDL.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: SoundSDL.cxx,v 1.5 2003-11-19 15:57:11 stephena Exp $ +// $Id: SoundSDL.cxx,v 1.6 2003-12-04 22:22:53 stephena Exp $ //============================================================================ #include @@ -23,11 +23,12 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SoundSDL::SoundSDL() : myCurrentVolume(SDL_MIX_MAXVOLUME), - myFragmentSize(1024), + myFragmentSize(2048), myIsInitializedFlag(false), myIsMuted(false), mySampleRate(31400), - mySampleQueue(mySampleRate) + mySampleQueueSize(8000), + mySampleQueue(mySampleQueueSize)//mySampleRate) { if(1) { @@ -172,10 +173,10 @@ void SoundSDL::update() SDL_LockAudio(); // Move all of the generated samples into the our private sample queue - uInt8 buffer[4096]; + uInt8 buffer[2048]; while(myMediaSource->numberOfAudioSamples() > 0) { - uInt32 size = myMediaSource->dequeueAudioSamples(buffer, 4096); + uInt32 size = myMediaSource->dequeueAudioSamples(buffer, 2048); mySampleQueue.enqueue(buffer, size); } @@ -184,7 +185,7 @@ void SoundSDL::update() // Block until the sound thread has consumed all but 142 milliseconds // of the available audio samples - uInt32 leave = mySampleRate / 7; + uInt32 left = mySampleRate / 3; for(;;) { uInt32 size = 0; @@ -193,12 +194,12 @@ void SoundSDL::update() size = mySampleQueue.size(); SDL_UnlockAudio(); - if(size <= leave) + if(size < left) { break; } - SDL_Delay(5); + SDL_Delay(1); } } } @@ -214,7 +215,7 @@ void SoundSDL::callback(void* udata, uInt8* stream, int len) } // Don't use samples unless there's at least 76 milliseconds worth of data - if(sound->mySampleQueue.size() < (sound->mySampleRate / 13)) + if(sound->mySampleQueue.size() < (sound->mySampleRate / 16)) { return; } @@ -224,11 +225,11 @@ void SoundSDL::callback(void* udata, uInt8* stream, int len) if(sound->mySampleQueue.size() > 0) { Int32 offset; - uInt8 buffer[4096]; + uInt8 buffer[2048]; for(offset = 0; (offset < len) && (sound->mySampleQueue.size() > 0); ) { uInt32 s = sound->mySampleQueue.dequeue(buffer, - (4096 > (len - offset) ? (len - offset) : 4096)); + (2048 > (len - offset) ? (len - offset) : 2048)); SDL_MixAudio(stream + offset, buffer, s, sound->myCurrentVolume); offset += s; } diff --git a/stella/src/ui/sound/SoundSDL.hxx b/stella/src/ui/sound/SoundSDL.hxx index 37c3272d9..be52e91e4 100644 --- a/stella/src/ui/sound/SoundSDL.hxx +++ b/stella/src/ui/sound/SoundSDL.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: SoundSDL.hxx,v 1.5 2003-11-19 15:57:11 stephena Exp $ +// $Id: SoundSDL.hxx,v 1.6 2003-12-04 22:22:53 stephena Exp $ //============================================================================ #ifndef SOUNDSDL_HXX @@ -29,7 +29,7 @@ This class implements the sound API for SDL. @author Stephen Anthony and Bradford W. Mott - @version $Id: SoundSDL.hxx,v 1.5 2003-11-19 15:57:11 stephena Exp $ + @version $Id: SoundSDL.hxx,v 1.6 2003-12-04 22:22:53 stephena Exp $ */ class SoundSDL : public Sound { @@ -160,6 +160,9 @@ class SoundSDL : public Sound // DSP sample rate uInt32 mySampleRate; + // The sample queue size (which is auto-adapting) + uInt32 mySampleQueueSize; + // Queue which holds samples from the media source before they are played SampleQueue mySampleQueue;