[Scummvm-cvs-logs] scummvm master -> b157269ff432c8ed08352683c1d6c7c4c246e429

djwillis John.Willis at Distant-earth.com
Tue Jul 24 11:10:29 CEST 2012


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
45354676eb OPENPANDORA: Move SDL_CreateCursor hacklet from init to loadGFXMode.
6f978ee78b OPENPANDORA: Free hiddenCursor on unloadGFXMode and cleanup screen setup.
b157269ff4 OPENPANDORA: Clean up old commented code.


Commit: 45354676ebe14df8d382681621f1d994258dbb72
    https://github.com/scummvm/scummvm/commit/45354676ebe14df8d382681621f1d994258dbb72
Author: David-John Willis (John.Willis at Distant-earth.com)
Date: 2012-07-24T02:08:58-07:00

Commit Message:
OPENPANDORA: Move SDL_CreateCursor hacklet from init to loadGFXMode.

* Fixes a bug that can occur on load.

Changed paths:
    backends/graphics/gph/gph-graphics.cpp
    backends/graphics/openpandora/op-graphics.cpp
    backends/platform/openpandora/op-backend.cpp



diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp
index 8521e88..5d4baef 100644
--- a/backends/graphics/gph/gph-graphics.cpp
+++ b/backends/graphics/gph/gph-graphics.cpp
@@ -36,7 +36,8 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
 };
 
 GPHGraphicsManager::GPHGraphicsManager(SdlEventSource *sdlEventSource)
-	: SurfaceSdlGraphicsManager(sdlEventSource) {
+	: SurfaceSdlGraphicsManager(sdlEventSource),
+	_cursorDontScale(true) {
 }
 
 const OSystem::GraphicsMode *GPHGraphicsManager::getSupportedGraphicsModes() const {
diff --git a/backends/graphics/openpandora/op-graphics.cpp b/backends/graphics/openpandora/op-graphics.cpp
index 5f0301a..1a3d7d3 100644
--- a/backends/graphics/openpandora/op-graphics.cpp
+++ b/backends/graphics/openpandora/op-graphics.cpp
@@ -31,17 +31,35 @@
 #include "common/mutex.h"
 #include "common/textconsole.h"
 
+static SDL_Cursor *hiddenCursor;
+
 OPGraphicsManager::OPGraphicsManager(SdlEventSource *sdlEventSource)
 	: SurfaceSdlGraphicsManager(sdlEventSource) {
 }
 
 bool OPGraphicsManager::loadGFXMode() {
+
+	uint8_t hiddenCursorData = 0;
+	hiddenCursor = SDL_CreateCursor(&hiddenCursorData, &hiddenCursorData, 8, 1, 0, 0);
+
+	/* On the OpenPandora we need to work around an SDL assumption that
+	   returns relative mouse coordinates when you get to the screen
+	   edges using the touchscreen. The workaround is to set a blank
+	   SDL cursor and not disable it (Hackish I know).
+
+	   The root issues likes in the Windows Manager GRAB code in SDL.
+	   That is why the issue is not seen on framebuffer devices like the
+	   GP2X (there is no X window manager ;)).
+	*/
+	SDL_ShowCursor(SDL_ENABLE);
+	SDL_SetCursor(hiddenCursor);
+
 	/* FIXME: For now we just cheat and set the overlay to 640*480 not 800*480 and let SDL
 	   deal with the boarders (it saves cleaning up the overlay when the game screen is
 	   smaller than the overlay ;)
 	*/
-	_videoMode.overlayWidth = 640;
-	_videoMode.overlayHeight = 480;
+	//_videoMode.overlayWidth = 640;
+	//_videoMode.overlayHeight = 480;
 	_videoMode.fullscreen = true;
 
 	if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400)
diff --git a/backends/platform/openpandora/op-backend.cpp b/backends/platform/openpandora/op-backend.cpp
index dcec387..47cff1c 100644
--- a/backends/platform/openpandora/op-backend.cpp
+++ b/backends/platform/openpandora/op-backend.cpp
@@ -54,8 +54,6 @@
 /* Dump console info to files. */
 #define DUMP_STDOUT
 
-static SDL_Cursor *hiddenCursor;
-
 OSystem_OP::OSystem_OP()
 	:
 	OSystem_POSIX() {
@@ -179,32 +177,12 @@ void OSystem_OP::initBackend() {
 	/* Make sure SDL knows that we have a joystick we want to use. */
 	ConfMan.setInt("joystick_num", 0);
 
-//	_graphicsMutex = createMutex();
-
 	/* Pass to POSIX method to do the heavy lifting */
 	OSystem_POSIX::initBackend();
 
 	_inited = true;
 }
 
-// enable joystick
-//	if (joystick_num > -1 && SDL_NumJoysticks() > 0) {
-//		printf("Using joystick: %s\n", SDL_JoystickName(0));
-//		_joystick = SDL_JoystickOpen(joystick_num);
-//	}
-//
-//	setupMixer();
-
-// 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);
-
 void OSystem_OP::initSDL() {
 	// Check if SDL has not been initialized
 	if (!_initedSDL) {
@@ -217,38 +195,7 @@ void OSystem_OP::initSDL() {
 		if (SDL_Init(sdlFlags) == -1)
 			error("Could not initialize SDL: %s", SDL_GetError());
 
-		uint8_t hiddenCursorData = 0;
-
-		hiddenCursor = SDL_CreateCursor(&hiddenCursorData, &hiddenCursorData, 8, 1, 0, 0);
-
-		/* On the OpenPandora we need to work around an SDL assumption that
-		   returns relative mouse coordinates when you get to the screen
-		   edges using the touchscreen. The workaround is to set a blank
-		   SDL cursor and not disable it (Hackish I know).
-
-		   The root issues likes in the Windows Manager GRAB code in SDL.
-		   That is why the issue is not seen on framebuffer devices like the
-		   GP2X (there is no X window manager ;)).
-		*/
-		SDL_ShowCursor(SDL_ENABLE);
-		SDL_SetCursor(hiddenCursor);
-		SDL_EnableUNICODE(1);
-
-//		memset(&_oldVideoMode, 0, sizeof(_oldVideoMode));
-//		memset(&_videoMode, 0, sizeof(_videoMode));
-//		memset(&_transactionDetails, 0, sizeof(_transactionDetails));
-
-//		_videoMode.mode = GFX_DOUBLESIZE;
-//		_videoMode.scaleFactor = 2;
-//		_videoMode.aspectRatioCorrection = ConfMan.getBool("aspect_ratio");
-//		_scalerProc = Normal2x;
-//		_scalerType = 0;
-
-//		_videoMode.fullscreen = true;
-
 		_initedSDL = true;
-
-//	OSystem_POSIX::initSDL();
 	}
 }
 
@@ -275,8 +222,6 @@ void OSystem_OP::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
 
 void OSystem_OP::quit() {
 
-	SDL_FreeCursor(hiddenCursor);
-
 #ifdef DUMP_STDOUT
 	printf("%s\n", "Debug: STDOUT and STDERR text files closed.");
 	fclose(stdout);


Commit: 6f978ee78b19be19329adef2618d814012440071
    https://github.com/scummvm/scummvm/commit/6f978ee78b19be19329adef2618d814012440071
Author: David-John Willis (John.Willis at Distant-earth.com)
Date: 2012-07-24T02:08:58-07:00

Commit Message:
OPENPANDORA: Free hiddenCursor on unloadGFXMode and cleanup screen setup.

* Also remove some old cruft in the form of commented code.

Changed paths:
    backends/graphics/openpandora/op-graphics.cpp
    backends/graphics/openpandora/op-graphics.h



diff --git a/backends/graphics/openpandora/op-graphics.cpp b/backends/graphics/openpandora/op-graphics.cpp
index 1a3d7d3..f371081 100644
--- a/backends/graphics/openpandora/op-graphics.cpp
+++ b/backends/graphics/openpandora/op-graphics.cpp
@@ -26,7 +26,6 @@
 
 #include "backends/graphics/openpandora/op-graphics.h"
 #include "backends/events/openpandora/op-events.h"
-//#include "backends/platform/openpandora/op-sdl.h"
 #include "graphics/scaler/aspect.h"
 #include "common/mutex.h"
 #include "common/textconsole.h"
@@ -54,18 +53,32 @@ bool OPGraphicsManager::loadGFXMode() {
 	SDL_ShowCursor(SDL_ENABLE);
 	SDL_SetCursor(hiddenCursor);
 
-	/* FIXME: For now we just cheat and set the overlay to 640*480 not 800*480 and let SDL
-	   deal with the boarders (it saves cleaning up the overlay when the game screen is
-	   smaller than the overlay ;)
-	*/
-	//_videoMode.overlayWidth = 640;
-	//_videoMode.overlayHeight = 480;
 	_videoMode.fullscreen = true;
 
+	_videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+	_videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
+
 	if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400)
 		_videoMode.aspectRatioCorrection = false;
 
+	if (_videoMode.aspectRatioCorrection)
+		_videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight);
+
+	_videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+	_videoMode.hardwareHeight = effectiveScreenHeight();
+
 	return SurfaceSdlGraphicsManager::loadGFXMode();
 }
 
+void OPGraphicsManager::unloadGFXMode() {
+
+	uint8_t hiddenCursorData = 0;
+	hiddenCursor = SDL_CreateCursor(&hiddenCursorData, &hiddenCursorData, 8, 1, 0, 0);
+
+	// Free the hidden SDL cursor created in loadGFXMode
+	SDL_FreeCursor(hiddenCursor);
+
+	SurfaceSdlGraphicsManager::unloadGFXMode();
+}
+
 #endif
diff --git a/backends/graphics/openpandora/op-graphics.h b/backends/graphics/openpandora/op-graphics.h
index 0b3eeae..2e3d63e 100644
--- a/backends/graphics/openpandora/op-graphics.h
+++ b/backends/graphics/openpandora/op-graphics.h
@@ -24,7 +24,6 @@
 #define BACKENDS_GRAPHICS_OP_H
 
 #include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
-#include "graphics/scaler/aspect.h" // for aspect2Real
 #include "graphics/scaler/downscaler.h"
 
 enum {
@@ -35,28 +34,8 @@ class OPGraphicsManager : public SurfaceSdlGraphicsManager {
 public:
 	OPGraphicsManager(SdlEventSource *sdlEventSource);
 
-//	bool hasFeature(OSystem::Feature f);
-//	void setFeatureState(OSystem::Feature f, bool enable);
-//	bool getFeatureState(OSystem::Feature f);
-//	int getDefaultGraphicsMode() const;
-
-//	void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL);
-//	const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
-//	bool setGraphicsMode(const char *name);
-//	bool setGraphicsMode(int mode);
-//	void setGraphicsModeIntern();
-//	void internUpdateScreen();
-//	void showOverlay();
-//	void hideOverlay();
 	bool loadGFXMode();
-//	void drawMouse();
-//	void undrawMouse();
-//	virtual void warpMouse(int x, int y);
-
-//	SurfaceSdlGraphicsManager::MousePos *getMouseCurState();
-//	SurfaceSdlGraphicsManager::VideoState *getVideoMode();
-
-//	virtual void adjustMouseEvent(const Common::Event &event);
+	void unloadGFXMode();
 };
 
 #endif /* BACKENDS_GRAPHICS_OP_H */


Commit: b157269ff432c8ed08352683c1d6c7c4c246e429
    https://github.com/scummvm/scummvm/commit/b157269ff432c8ed08352683c1d6c7c4c246e429
Author: David-John Willis (John.Willis at Distant-earth.com)
Date: 2012-07-24T02:08:58-07:00

Commit Message:
OPENPANDORA: Clean up old commented code.

Changed paths:
    backends/platform/openpandora/op-backend.cpp



diff --git a/backends/platform/openpandora/op-backend.cpp b/backends/platform/openpandora/op-backend.cpp
index 47cff1c..b2d53f9 100644
--- a/backends/platform/openpandora/op-backend.cpp
+++ b/backends/platform/openpandora/op-backend.cpp
@@ -59,11 +59,6 @@ OSystem_OP::OSystem_OP()
 	OSystem_POSIX() {
 }
 
-//static Uint32 timer_handler(Uint32 interval, void *param) {
-//	((DefaultTimerManager *)param)->handler();
-//	return interval;
-//}
-
 void OSystem_OP::initBackend() {
 
 	assert(!_inited);
@@ -77,28 +72,6 @@ void OSystem_OP::initBackend() {
 		_graphicsManager = new OPGraphicsManager(_eventSource);
 	}
 
-//	int joystick_num = ConfMan.getInt("joystick_num");
-//	uint32 sdlFlags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
-//
-//	if (ConfMan.hasKey("disable_sdl_parachute"))
-//		sdlFlags |= SDL_INIT_NOPARACHUTE;
-//
-//	if (joystick_num > -1)
-//		sdlFlags |= SDL_INIT_JOYSTICK;
-//
-//	if (SDL_Init(sdlFlags) == -1) {
-//		error("Could not initialize SDL: %s", SDL_GetError());
-//	}
-//
-
-	// Create the mixer manager
-//	if (_mixer == 0) {
-//		_mixerManager = new DoubleBufferSDLMixerManager();
-
-	// Setup and start mixer
-//		_mixerManager->init();
-//	}
-
 	/* Setup default save path to be workingdir/saves */
 
 	char savePath[PATH_MAX+1];






More information about the Scummvm-git-logs mailing list