[Scummvm-cvs-logs] SF.net SVN: scummvm:[45835] scummvm/trunk/backends/platform

aquadran at users.sourceforge.net aquadran at users.sourceforge.net
Wed Nov 11 15:36:47 CET 2009


Revision: 45835
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45835&view=rev
Author:   aquadran
Date:     2009-11-11 14:36:46 +0000 (Wed, 11 Nov 2009)

Log Message:
-----------
added more cases for samsungtv to allow reuse main sdl code

Modified Paths:
--------------
    scummvm/trunk/backends/platform/samsungtv/graphics.cpp
    scummvm/trunk/backends/platform/samsungtv/sdl.cpp
    scummvm/trunk/backends/platform/samsungtv/sdl.h
    scummvm/trunk/backends/platform/sdl/sdl.cpp

Modified: scummvm/trunk/backends/platform/samsungtv/graphics.cpp
===================================================================
--- scummvm/trunk/backends/platform/samsungtv/graphics.cpp	2009-11-11 14:28:07 UTC (rev 45834)
+++ scummvm/trunk/backends/platform/samsungtv/graphics.cpp	2009-11-11 14:36:46 UTC (rev 45835)
@@ -52,10 +52,6 @@
 static int cursorStretch200To240(uint8 *buf, uint32 pitch, int width, int height, int srcX, int srcY, int origSrcY);
 #endif
 
-int OSystem_SDL_SamsungTV::getDefaultGraphicsMode() const {
-	return GFX_2XSAI;
-}
-
 Common::List<Graphics::PixelFormat> OSystem_SDL_SamsungTV::getSupportedFormats() {
 	static Common::List<Graphics::PixelFormat>list;
 	list.push_back(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));

Modified: scummvm/trunk/backends/platform/samsungtv/sdl.cpp
===================================================================
--- scummvm/trunk/backends/platform/samsungtv/sdl.cpp	2009-11-11 14:28:07 UTC (rev 45834)
+++ scummvm/trunk/backends/platform/samsungtv/sdl.cpp	2009-11-11 14:36:46 UTC (rev 45835)
@@ -43,93 +43,6 @@
 
 #if defined(SAMSUNGTV)
 
-static Uint32 timer_handler(Uint32 interval, void *param) {
-	((DefaultTimerManager *)param)->handler();
-	return interval;
-}
-
-static const size_t AR_COUNT = 4;
-static const char*       desiredAspectRatioAsStrings[AR_COUNT] = {            "auto",            "4/3",            "16/9",            "16/10" };
-static const AspectRatio desiredAspectRatios[AR_COUNT]         = { AspectRatio(0, 0), AspectRatio(4,3), AspectRatio(16,9), AspectRatio(16,10) };
-static AspectRatio getDesiredAspectRatio() {
-	//TODO : We could parse an arbitrary string, if we code enough proper validation
-	Common::String desiredAspectRatio = ConfMan.get("desired_screen_aspect_ratio");
-
-	for (size_t i = 0; i < AR_COUNT; i++) {
-		assert(desiredAspectRatioAsStrings[i] != NULL);
-
-		if (!scumm_stricmp(desiredAspectRatio.c_str(), desiredAspectRatioAsStrings[i])) {
-			return desiredAspectRatios[i];
-		}
-	}
-	// TODO : Report a warning
-	return AspectRatio(0, 0);
-}
-
-void OSystem_SDL_SamsungTV::initBackend() {
-	assert(!_inited);
-
-	uint32 sdlFlags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
-
-	if (ConfMan.hasKey("disable_sdl_parachute"))
-		sdlFlags |= SDL_INIT_NOPARACHUTE;
-
-	if (SDL_Init(sdlFlags) == -1) {
-		error("Could not initialize SDL: %s", SDL_GetError());
-	}
-
-	_graphicsMutex = createMutex();
-
-	// Enable unicode support if possible
-	SDL_EnableUNICODE(1);
-
-	memset(&_oldVideoMode, 0, sizeof(_oldVideoMode));
-	memset(&_videoMode, 0, sizeof(_videoMode));
-	memset(&_transactionDetails, 0, sizeof(_transactionDetails));
-
-	_cksumValid = false;
-	_videoMode.mode = GFX_2XSAI;
-	_videoMode.scaleFactor = 2;
-	_videoMode.aspectRatioCorrection = ConfMan.getBool("aspect_ratio");
-	_videoMode.desiredAspectRatio = getDesiredAspectRatio();
-	_scalerProc = _2xSaI;
-	_scalerType = 0;
-	_modeFlags = 0;
-	_videoMode.fullscreen = true;
-
-
-	// Create the savefile manager, if none exists yet (we check for this to
-	// allow subclasses to provide their own).
-	if (_savefile == NULL) {
-	    _savefile = new POSIXSaveFileManager();
-	}
-
-	// Create and hook up the mixer, if none exists yet (we check for this to
-	// allow subclasses to provide their own).
-	if (_mixer == NULL) {
-		setupMixer();
-	}
-
-	// Create and hook up the timer manager, if none exists yet (we check for
-	// this to allow subclasses to provide their own).
-	if (_timer == NULL) {
-		// Note: We could implement a custom SDLTimerManager by using
-		// SDL_AddTimer. That might yield better timer resolution, but it would
-		// also change the semantics of a timer: Right now, ScummVM timers
-		// *never* run in parallel, due to the way they are implemented. If we
-		// switched to SDL_AddTimer, each timer might run in a separate thread.
-		// However, not all our code is prepared for that, so we can't just
-		// switch. Still, it's a potential future change to keep in mind.
-		_timer = new DefaultTimerManager();
-		_timerID = SDL_AddTimer(10, &timer_handler, _timer);
-	}
-
-	// Invoke parent implementation of this method
-	OSystem::initBackend();
-
-	_inited = true;
-}
-
 OSystem_SDL_SamsungTV::OSystem_SDL_SamsungTV() : OSystem_SDL(),
 	_prehwscreen(0) {
 }
@@ -178,26 +91,4 @@
 	}
 }
 
-void OSystem_SDL_SamsungTV::quit() {
-	unloadGFXMode();
-	deleteMutex(_graphicsMutex);
-
-	SDL_RemoveTimer(_timerID);
-	closeMixer();
-
-	free(_dirtyChecksums);
-	free(_currentPalette);
-	free(_cursorPalette);
-	free(_mouseData);
-
-	delete _timer;
-
-	SDL_Quit();
-
-	// Even Manager requires save manager for storing
-	// recorded events
-	delete getEventManager();
-	delete _savefile;
-}
-
 #endif

Modified: scummvm/trunk/backends/platform/samsungtv/sdl.h
===================================================================
--- scummvm/trunk/backends/platform/samsungtv/sdl.h	2009-11-11 14:28:07 UTC (rev 45834)
+++ scummvm/trunk/backends/platform/samsungtv/sdl.h	2009-11-11 14:36:46 UTC (rev 45835)
@@ -42,8 +42,6 @@
 public:
 	OSystem_SDL_SamsungTV();
 
-	virtual void initBackend();
-
 	// Highest supported
 	virtual Common::List<Graphics::PixelFormat> getSupportedFormats();
 
@@ -63,11 +61,6 @@
 	// Returns true if an event was retrieved.
 	virtual bool pollEvent(Common::Event &event);
 
-	// Quit
-	virtual void quit(); // overloaded by CE backend
-
-	virtual int getDefaultGraphicsMode() const;
-
 	virtual bool hasFeature(Feature f);
 	virtual void setFeatureState(Feature f, bool enable);
 	virtual bool getFeatureState(Feature f);

Modified: scummvm/trunk/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/sdl.cpp	2009-11-11 14:28:07 UTC (rev 45834)
+++ scummvm/trunk/backends/platform/sdl/sdl.cpp	2009-11-11 14:36:46 UTC (rev 45835)
@@ -137,8 +137,9 @@
 
 	_graphicsMutex = createMutex();
 
+#if !defined(SAMSUNGTV)
 	SDL_ShowCursor(SDL_DISABLE);
-
+#endif
 	// Enable unicode support if possible
 	SDL_EnableUNICODE(1);
 
@@ -503,8 +504,9 @@
 
 	if (_joystick)
 		SDL_JoystickClose(_joystick);
+#if !defined(SAMSUNGTV)
 	SDL_ShowCursor(SDL_ENABLE);
-
+#endif
 	SDL_RemoveTimer(_timerID);
 	closeMixer();
 
@@ -522,7 +524,9 @@
 	delete getEventManager();
 	delete _savefile;
 
+#if !defined(SAMSUNGTV)
 	exit(0);
+#endif
 }
 
 void OSystem_SDL::setupIcon() {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list