[Scummvm-cvs-logs] SF.net SVN: scummvm: [21830] scummvm/trunk/gui

anotherguest at users.sourceforge.net anotherguest at users.sourceforge.net
Wed Apr 12 12:05:05 CEST 2006


Revision: 21830
Author:   anotherguest
Date:     2006-04-12 12:04:10 -0700 (Wed, 12 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21830&view=rev

Log Message:
-----------
Commiting Fingolfins patch to remove gamedetector usage.

Modified Paths:
--------------
    scummvm/trunk/backends/symbian/src/SymbianActions.cpp
    scummvm/trunk/backends/symbian/src/SymbianActions.h
    scummvm/trunk/backends/symbian/src/SymbianOS.cpp
    scummvm/trunk/backends/wince/CEActionsPocket.cpp
    scummvm/trunk/backends/wince/CEActionsPocket.h
    scummvm/trunk/backends/wince/CEActionsSmartphone.cpp
    scummvm/trunk/backends/wince/CEActionsSmartphone.h
    scummvm/trunk/backends/wince/wince-sdl.cpp
    scummvm/trunk/base/main.cpp
    scummvm/trunk/base/main.h
    scummvm/trunk/gui/Actions.cpp
    scummvm/trunk/gui/Actions.h
Modified: scummvm/trunk/backends/symbian/src/SymbianActions.cpp
===================================================================
--- scummvm/trunk/backends/symbian/src/SymbianActions.cpp	2006-04-12 16:34:23 UTC (rev 21829)
+++ scummvm/trunk/backends/symbian/src/SymbianActions.cpp	2006-04-12 19:04:10 UTC (rev 21830)
@@ -62,8 +62,8 @@
 #endif
 
 // creator function according to Factory Pattern
-void SymbianActions::init(GameDetector &detector) {
-	_instance = new SymbianActions(detector);
+void SymbianActions::init(const Common::String &gameid) {
+	_instance = new SymbianActions(gameid);
 }
 
 
@@ -83,8 +83,8 @@
 	return ACTION_VERSION;
 }
 
-SymbianActions::SymbianActions(GameDetector &detector) :
-	Actions(detector) {
+SymbianActions::SymbianActions(const Common::String &gameid) :
+	Actions(gameid) {
 	int i;
 
 	for (i = 0; i < ACTION_LAST; i++) {
@@ -121,17 +121,17 @@
 }
 
 void SymbianActions::initInstanceGame() {
-	bool is_simon = (strncmp(_detector->_gameid.c_str(), "simon", 5) == 0);
-	bool is_sky = (_detector->_gameid == "sky");
-	bool is_queen = (_detector->_gameid == "queen");
-	bool is_gob = (strncmp(_detector->_gameid.c_str(), "gob", 3) == 0);
-	bool is_ite = ((strncmp(_detector->_gameid.c_str(), "ite", 3) == 0) ||
-				  (strncmp(_detector->_gameid.c_str(), "ihnm", 4) == 0));
+	bool is_simon = (strncmp(_gameid.c_str(), "simon", 5) == 0);
+	bool is_sky = (_gameid == "sky");
+	bool is_queen = (_gameid == "queen");
+	bool is_gob = (strncmp(_gameid.c_str(), "gob", 3) == 0);
+	bool is_ite = ((strncmp(_gameid.c_str(), "ite", 3) == 0) ||
+				  (strncmp(_gameid.c_str(), "ihnm", 4) == 0));
 	
 	Actions::initInstanceGame();
 
 	// See if a right click mapping could be needed
-	if (is_sky || _detector->_gameid == "samnmax" || is_gob)
+	if (is_sky || _gameid == "samnmax" || is_gob)
 		_right_click_needed = true;
 
 	// Initialize keys for different actions

Modified: scummvm/trunk/backends/symbian/src/SymbianActions.h
===================================================================
--- scummvm/trunk/backends/symbian/src/SymbianActions.h	2006-04-12 16:34:23 UTC (rev 21829)
+++ scummvm/trunk/backends/symbian/src/SymbianActions.h	2006-04-12 19:04:10 UTC (rev 21830)
@@ -26,7 +26,6 @@
 #include "common/stdafx.h"
 #include "common/scummsys.h"
 #include "common/system.h"
-#include "base/gameDetector.h"
 #include "gui/Key.h"
 #include "gui/Actions.h"
 
@@ -58,7 +57,7 @@
 	bool perform(ActionType action, bool pushed = true);
 	Common::String actionName(ActionType action);
 	int size();
-	static void init(GameDetector &detector);
+	static void init(const Common::String &gameid);
 	void initInstanceMain(OSystem *mainSystem);
 	void initInstanceGame();
 
@@ -69,7 +68,7 @@
 	~SymbianActions();
 
 private:
-	SymbianActions(GameDetector &detector);
+	SymbianActions(const Common::String &gameid);
 	bool _right_click_needed;
 };
 

Modified: scummvm/trunk/backends/symbian/src/SymbianOS.cpp
===================================================================
--- scummvm/trunk/backends/symbian/src/SymbianOS.cpp	2006-04-12 16:34:23 UTC (rev 21829)
+++ scummvm/trunk/backends/symbian/src/SymbianOS.cpp	2006-04-12 19:04:10 UTC (rev 21830)
@@ -377,7 +377,7 @@
 }
 
 void OSystem_SDL_Symbian::check_mappings() {
-	if (!GUI::Actions::Instance()->gameDetector()._targetName.size() || GUI::Actions::Instance()->initialized())
+	if (!GUI::Actions::Instance()->_gameid.size() || GUI::Actions::Instance()->initialized())
 		return;
 
 	GUI::Actions::Instance()->initInstanceGame();

Modified: scummvm/trunk/backends/wince/CEActionsPocket.cpp
===================================================================
--- scummvm/trunk/backends/wince/CEActionsPocket.cpp	2006-04-12 16:34:23 UTC (rev 21829)
+++ scummvm/trunk/backends/wince/CEActionsPocket.cpp	2006-04-12 19:04:10 UTC (rev 21830)
@@ -54,8 +54,8 @@
 	"Bind Keys"
 };
 
-void CEActionsPocket::init(GameDetector &detector) {
-	_instance = new CEActionsPocket(detector);
+void CEActionsPocket::init(const Common::String &gameid) {
+	_instance = new CEActionsPocket(gameid);
 }
 
 
@@ -75,8 +75,8 @@
 	return POCKET_ACTION_VERSION;
 }
 
-CEActionsPocket::CEActionsPocket(GameDetector &detector) :
-GUI::Actions(detector)
+CEActionsPocket::CEActionsPocket(const Common::String &gameid) :
+GUI::Actions(gameid)
 {
 	int i;
 
@@ -98,21 +98,21 @@
 }
 
 void CEActionsPocket::initInstanceGame() {
-	bool is_simon = (strncmp(_detector->_gameid.c_str(), "simon", 5) == 0);
-	bool is_sword1 = (_detector->_gameid == "sword1");
-	bool is_sword2 = (strcmp(_detector->_gameid.c_str(), "sword2") == 0);
-	bool is_queen = (_detector->_gameid == "queen");
-	bool is_sky = (_detector->_gameid == "sky");
-	bool is_comi = (strncmp(_detector->_gameid.c_str(), "comi", 4) == 0);
-	bool is_gob = (strncmp(_detector->_gameid.c_str(), "gob", 3) == 0);
-	bool is_ite = ((strncmp(_detector->_gameid.c_str(), "ite", 3) == 0) ||
-				  (strncmp(_detector->_gameid.c_str(), "ihnm", 4) == 0));
+	bool is_simon = (strncmp(_gameid.c_str(), "simon", 5) == 0);
+	bool is_sword1 = (_gameid == "sword1");
+	bool is_sword2 = (strcmp(_gameid.c_str(), "sword2") == 0);
+	bool is_queen = (_gameid == "queen");
+	bool is_sky = (_gameid == "sky");
+	bool is_comi = (strncmp(_gameid.c_str(), "comi", 4) == 0);
+	bool is_gob = (strncmp(_gameid.c_str(), "gob", 3) == 0);
+	bool is_ite = ((strncmp(_gameid.c_str(), "ite", 3) == 0) ||
+				  (strncmp(_gameid.c_str(), "ihnm", 4) == 0));
 
 	GUI_Actions::initInstanceGame();
 
 	// See if a right click mapping could be needed
 	if (is_sword1 || is_sword2 || is_sky || is_queen || is_comi || is_gob ||
-		_detector->_gameid == "samnmax")
+		_gameid == "samnmax")
 		_right_click_needed = true;
 
 	// See if a "hide toolbar" mapping could be needed

Modified: scummvm/trunk/backends/wince/CEActionsPocket.h
===================================================================
--- scummvm/trunk/backends/wince/CEActionsPocket.h	2006-04-12 16:34:23 UTC (rev 21829)
+++ scummvm/trunk/backends/wince/CEActionsPocket.h	2006-04-12 19:04:10 UTC (rev 21830)
@@ -28,7 +28,6 @@
 #include "common/system.h"
 
 
-#include "base/gameDetector.h"
 #include "wince-sdl.h"
 #include "gui/Key.h"
 
@@ -62,7 +61,7 @@
 		String actionName(GUI::ActionType action);
 		int size();
 
-		static void init(GameDetector &detector);
+		static void init(const Common::String &gameid);
 		void initInstanceMain(OSystem *mainSystem);
 		void initInstanceGame();
 
@@ -77,7 +76,7 @@
 
 		~CEActionsPocket();
 	private:
-		CEActionsPocket(GameDetector &detector);
+		CEActionsPocket(const Common::String &gameid);
 		bool _right_click_needed;
 		bool _hide_toolbar_needed;
 		bool _zoom_needed;

Modified: scummvm/trunk/backends/wince/CEActionsSmartphone.cpp
===================================================================
--- scummvm/trunk/backends/wince/CEActionsSmartphone.cpp	2006-04-12 16:34:23 UTC (rev 21829)
+++ scummvm/trunk/backends/wince/CEActionsSmartphone.cpp	2006-04-12 19:04:10 UTC (rev 21830)
@@ -60,8 +60,8 @@
 const int ACTIONS_SMARTPHONE_DEFAULT[] = { '4', '6', '8', '2', 0x11a, 0x11b, '0', VK_ESCAPE, '9', 0, VK_RETURN };
 #endif
 
-void CEActionsSmartphone::init(GameDetector &detector) {
-	_instance = new CEActionsSmartphone(detector);
+void CEActionsSmartphone::init(const Common::String &gameid) {
+	_instance = new CEActionsSmartphone(gameid);
 }
 
 
@@ -81,8 +81,8 @@
 	return SMARTPHONE_ACTION_VERSION;
 }
 
-CEActionsSmartphone::CEActionsSmartphone(GameDetector &detector) :
-GUI::Actions(detector)
+CEActionsSmartphone::CEActionsSmartphone(const Common::String &gameid) :
+GUI::Actions(gameid)
 {
 	int i;
 
@@ -112,17 +112,17 @@
 }
 
 void CEActionsSmartphone::initInstanceGame() {
-	bool is_simon = (strncmp(_detector->_gameid.c_str(), "simon", 5) == 0);
-	bool is_sky = (_detector->_gameid == "sky");
-	bool is_queen = (_detector->_gameid == "queen");
-	bool is_gob = (strncmp(_detector->_gameid.c_str(), "gob", 3) == 0);
-	bool is_ite = ((strncmp(_detector->_gameid.c_str(), "ite", 3) == 0) ||
-				  (strncmp(_detector->_gameid.c_str(), "ihnm", 4) == 0));
+	bool is_simon = (strncmp(_gameid.c_str(), "simon", 5) == 0);
+	bool is_sky = (_gameid == "sky");
+	bool is_queen = (_gameid == "queen");
+	bool is_gob = (strncmp(_gameid.c_str(), "gob", 3) == 0);
+	bool is_ite = ((strncmp(_gameid.c_str(), "ite", 3) == 0) ||
+				  (strncmp(_gameid.c_str(), "ihnm", 4) == 0));
 
 	GUI_Actions::initInstanceGame();
 
 	// See if a right click mapping could be needed
-	if (is_sky || _detector->_gameid == "samnmax" || is_gob)
+	if (is_sky || _gameid == "samnmax" || is_gob)
 		_right_click_needed = true;
 
 	// Initialize keys for different actions

Modified: scummvm/trunk/backends/wince/CEActionsSmartphone.h
===================================================================
--- scummvm/trunk/backends/wince/CEActionsSmartphone.h	2006-04-12 16:34:23 UTC (rev 21829)
+++ scummvm/trunk/backends/wince/CEActionsSmartphone.h	2006-04-12 19:04:10 UTC (rev 21830)
@@ -30,7 +30,6 @@
 #include "common/system.h"
 
 
-#include "base/gameDetector.h"
 #include "wince-sdl.h"
 #include "gui/Key.h"
 
@@ -61,7 +60,7 @@
 		bool perform(GUI::ActionType action, bool pushed = true);
 		String actionName(GUI::ActionType action);
 		int size();
-		static void init(GameDetector &detector);
+		static void init(const Common::String &gameid);
 		void initInstanceMain(OSystem *mainSystem);
 		void initInstanceGame();
 
@@ -71,7 +70,7 @@
 
 		~CEActionsSmartphone();
 	private:
-		CEActionsSmartphone(GameDetector &detector);
+		CEActionsSmartphone(const Common::String &gameid);
 		bool _right_click_needed;
 		OSystem_WINCE3 *_CESystem;
 	};

Modified: scummvm/trunk/backends/wince/wince-sdl.cpp
===================================================================
--- scummvm/trunk/backends/wince/wince-sdl.cpp	2006-04-12 16:34:23 UTC (rev 21829)
+++ scummvm/trunk/backends/wince/wince-sdl.cpp	2006-04-12 19:04:10 UTC (rev 21830)
@@ -24,7 +24,6 @@
 #include "wince-sdl.h"
 
 #include "common/util.h"
-#include "base/gameDetector.h"
 #include "base/engine.h"
 #include "base/main.h"
 #include "base/plugins.h"
@@ -68,7 +67,6 @@
 
 // Given to the true main, needed for backend adaptation
 
-static GameDetector _gameDetector;
 static FILE *stdout_file;
 static FILE *stderr_file;
 
@@ -144,7 +142,6 @@
 	/* Avoid print problems - this file will be put in RAM anyway */
 	stdout_file = fopen("\\scummvm_stdout.txt", "w");
 	stderr_file = fopen("\\scummvm_stderr.txt", "w");
-	GUI::Actions::init(_gameDetector);
 
 	int rest = 0;
 
@@ -525,7 +522,8 @@
 
 void OSystem_WINCE3::get_sample_rate() {
 	// Force at least medium quality FM synthesis for FOTAQ
-	if (_gameDetector._gameid == "queen") {
+	Common::String gameid(GUI::Actions::Instance()->_gameid);
+	if (gameid == "queen") {
 		if (!((ConfMan.hasKey("FM_high_quality") && ConfMan.getBool("FM_high_quality")) ||
 			(ConfMan.hasKey("FM_medium_quality") && ConfMan.getBool("FM_medium_quality")))) {
 			ConfMan.set("FM_medium_quality", true);
@@ -533,12 +531,12 @@
 		}
 	}
 	// See if the output frequency is forced by the game
-	if ((_gameDetector._gameid == "ft" ||
-		_gameDetector._gameid == "dig" ||
-		_gameDetector._gameid == "comi" ||
-		_gameDetector._gameid == "queen" ||
-		strncmp(_gameDetector._gameid.c_str(), "sword", 5) == 0 ||
-		strncmp(_gameDetector._gameid.c_str(), "sky", 3) == 0)
+	if ((gameid == "ft" ||
+		gameid == "dig" ||
+		gameid == "comi" ||
+		gameid == "queen" ||
+		strncmp(gameid.c_str(), "sword", 5) == 0 ||
+		strncmp(gameid.c_str(), "sky", 3) == 0)
 			_sampleRate = SAMPLES_PER_SEC_NEW;
 	else {
 		if (ConfMan.hasKey("high_sample_rate") && ConfMan.getBool("high_sample_rate"))
@@ -655,7 +653,9 @@
 void OSystem_WINCE3::check_mappings() {
 		CEActionsPocket *instance;
 
-		if (!_gameDetector._gameid.size() || GUI_Actions::Instance()->initialized())
+		Common::String gameid(GUI::Actions::Instance()->_gameid);
+
+		if (!gameid.size() || GUI_Actions::Instance()->initialized())
 			return;
 
 		GUI_Actions::Instance()->initInstanceGame();
@@ -698,7 +698,7 @@
 		}
 
 		// Extra warning for Zak Mc Kracken
-		if (strncmp(_gameDetector._gameid.c_str(), "zak", 3) == 0 &&
+		if (strncmp(gameid.c_str(), "zak", 3) == 0 &&
 			!GUI_Actions::Instance()->getMapping(POCKET_ACTION_HIDE)) {
 			GUI::MessageDialog alert("Don't forget to map a key to 'Hide Toolbar' action to see the whole inventory");
 			alert.runModal();
@@ -707,8 +707,10 @@
 }
 
 void OSystem_WINCE3::update_game_settings() {
+	Common::String gameid(GUI::Actions::Instance()->_gameid);
+
 	// Finish panel initialization
-	if (!_panelInitialized && _gameDetector._gameid.size()) {
+	if (!_panelInitialized && gameid.size()) {
 		Panel *panel;
 		_panelInitialized = true;
 		// Add the main panel
@@ -731,7 +733,7 @@
 		_toolbarHandler.setVisible(true);
 
 		// Keyboard is active for Monkey 1 or 2 initial copy-protection
-		if (strncmp(_gameDetector._gameid.c_str(), "monkey", 6) == 0) {
+		if (strncmp(gameid.c_str(), "monkey", 6) == 0) {
 			_monkeyKeyboard = true;
 			_toolbarHandler.setActive(NAME_PANEL_KEYBOARD);
 		}

Modified: scummvm/trunk/base/main.cpp
===================================================================
--- scummvm/trunk/base/main.cpp	2006-04-12 16:34:23 UTC (rev 21829)
+++ scummvm/trunk/base/main.cpp	2006-04-12 19:04:10 UTC (rev 21830)
@@ -230,11 +230,7 @@
 	return result;
 }
 
-#ifdef _WIN32_WCE
-extern "C" int scummvm_main(GameDetector &detector, int argc, char *argv[]) {
-#else
 extern "C" int scummvm_main(int argc, char *argv[]) {
-#endif
 	Common::String specialDebug;
 	Common::String command;
 	bool running = true;
@@ -291,14 +287,12 @@
 	
 
 	// Process the remaining command line settings
-#ifndef _WIN32_WCE
 	GameDetector detector;
-#endif
 	detector.processSettings(command, settings);
 
-#ifdef __SYMBIAN32__
+#if defined(__SYMBIAN32__) || defined(_WIN32_WCE)
 	// init keymap support here: we wanna move this somewhere else?
-	GUI::Actions::init(detector);
+	GUI::Actions::init(detector._gameid);
 #endif
 
 #ifdef PALMOS_68K

Modified: scummvm/trunk/base/main.h
===================================================================
--- scummvm/trunk/base/main.h	2006-04-12 16:34:23 UTC (rev 21829)
+++ scummvm/trunk/base/main.h	2006-04-12 19:04:10 UTC (rev 21830)
@@ -29,10 +29,6 @@
 //
 // The scummvm main entry point, to be invoked by ports
 //
-#ifdef _WIN32_WCE
-extern "C" int scummvm_main(GameDetector &detector, int argc, char *argv[]);
-#else
 extern "C" int scummvm_main(int argc, char *argv[]);
-#endif
 
 #endif

Modified: scummvm/trunk/gui/Actions.cpp
===================================================================
--- scummvm/trunk/gui/Actions.cpp	2006-04-12 16:34:23 UTC (rev 21829)
+++ scummvm/trunk/gui/Actions.cpp	2006-04-12 19:04:10 UTC (rev 21830)
@@ -39,8 +39,8 @@
 	return _instance;
 }
 
-Actions::Actions(GameDetector &detector) :
-	_detector(&detector), _mapping_active(false), _initialized(false)
+Actions::Actions(const Common::String &gameid) :
+	_gameid(gameid), _mapping_active(false), _initialized(false)
 {
 }
 
@@ -49,15 +49,15 @@
 }
 
 // call the correct object creator function according to the Factory Pattern
-void Actions::init(GameDetector &detector) {
+void Actions::init(const Common::String &gameid) {
 #ifdef _WIN32_WCE
 	// For WinCE: now use software + Factory pattern to create correct objects
 	if (!CEDevice::isSmartphone())
-		CEActionsPocket::init(detector);
+		CEActionsPocket::init(gameid);
 	else
-		CEActionsSmartphone::init(detector);
+		CEActionsSmartphone::init(gameid);
 #elif defined(__SYMBIAN32__)
-	SymbianActions::init(detector);
+	SymbianActions::init(gameid);
 #endif
 }
 
@@ -160,10 +160,6 @@
 	return _key_action[action];
 }
 
-// Game detector
-GameDetector& Actions::gameDetector(){
-	return *_detector;
-}
 Actions *Actions::_instance = NULL;
 
 

Modified: scummvm/trunk/gui/Actions.h
===================================================================
--- scummvm/trunk/gui/Actions.h	2006-04-12 16:34:23 UTC (rev 21829)
+++ scummvm/trunk/gui/Actions.h	2006-04-12 19:04:10 UTC (rev 21830)
@@ -26,7 +26,6 @@
 #include "common/stdafx.h"
 #include "common/scummsys.h"
 #include "common/system.h"
-#include "base/gameDetector.h"
 #include "gui/Key.h"
 namespace GUI {
 
@@ -38,7 +37,7 @@
 
 public:
 	static Actions* Instance();
-	static void init(GameDetector &detector);
+	static void init(const Common::String &gameid);
 	virtual void initInstanceMain(OSystem *mainSystem);
 	virtual void initInstanceGame();
 	bool initialized();
@@ -66,13 +65,16 @@
 
 	virtual ~Actions();
 
-    // Game detector
-    GameDetector& gameDetector();
+public:
+	// Since _gameid is const it's safe to let the public read it.
+	const Common::String _gameid;
+
 protected:
-	Actions(GameDetector &detector);
+	Actions(const Common::String &gameid);
+
+protected:
 	static Actions* _instance;
 	OSystem *_mainSystem;
-	GameDetector *_detector;
 	Key _key_action[MAX_ACTIONS + 1];
 	bool _action_enabled[MAX_ACTIONS + 1];
 	unsigned int _action_mapping[MAX_ACTIONS + 1];


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