aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Persson2006-04-12 19:04:10 +0000
committerLars Persson2006-04-12 19:04:10 +0000
commit1d265f18956cb78cfe2d9c92462853b057c2b2ef (patch)
treeff9f6f53af1bab024ef8aa90ba1b9c014f8d07f5
parentcdcf44d3f3cb2920ffd57317b126651076ca7e21 (diff)
downloadscummvm-rg350-1d265f18956cb78cfe2d9c92462853b057c2b2ef.tar.gz
scummvm-rg350-1d265f18956cb78cfe2d9c92462853b057c2b2ef.tar.bz2
scummvm-rg350-1d265f18956cb78cfe2d9c92462853b057c2b2ef.zip
Commiting Fingolfins patch to remove gamedetector usage.
svn-id: r21830
-rw-r--r--backends/symbian/src/SymbianActions.cpp22
-rw-r--r--backends/symbian/src/SymbianActions.h5
-rw-r--r--backends/symbian/src/SymbianOS.cpp2
-rw-r--r--backends/wince/CEActionsPocket.cpp28
-rw-r--r--backends/wince/CEActionsPocket.h5
-rw-r--r--backends/wince/CEActionsSmartphone.cpp22
-rw-r--r--backends/wince/CEActionsSmartphone.h5
-rw-r--r--backends/wince/wince-sdl.cpp30
-rw-r--r--base/main.cpp10
-rw-r--r--base/main.h4
-rw-r--r--gui/Actions.cpp16
-rw-r--r--gui/Actions.h14
12 files changed, 75 insertions, 88 deletions
diff --git a/backends/symbian/src/SymbianActions.cpp b/backends/symbian/src/SymbianActions.cpp
index 29a02d19f6..42679b889f 100644
--- a/backends/symbian/src/SymbianActions.cpp
+++ b/backends/symbian/src/SymbianActions.cpp
@@ -62,8 +62,8 @@ const int ACTIONS_DEFAULT[ACTION_LAST] = { 0, 0, 0, 0, 0x11a, 0x11b, SDLK_MENU,
#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 @@ int SymbianActions::version() {
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::initInstanceMain(OSystem *mainSystem) {
}
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
diff --git a/backends/symbian/src/SymbianActions.h b/backends/symbian/src/SymbianActions.h
index 50a3ed6bac..f8e82afcb0 100644
--- a/backends/symbian/src/SymbianActions.h
+++ b/backends/symbian/src/SymbianActions.h
@@ -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 @@ public:
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 @@ public:
~SymbianActions();
private:
- SymbianActions(GameDetector &detector);
+ SymbianActions(const Common::String &gameid);
bool _right_click_needed;
};
diff --git a/backends/symbian/src/SymbianOS.cpp b/backends/symbian/src/SymbianOS.cpp
index 720fb85820..d7539fcfe9 100644
--- a/backends/symbian/src/SymbianOS.cpp
+++ b/backends/symbian/src/SymbianOS.cpp
@@ -377,7 +377,7 @@ void OSystem_SDL_Symbian::setWindowCaption(const char *caption) {
}
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();
diff --git a/backends/wince/CEActionsPocket.cpp b/backends/wince/CEActionsPocket.cpp
index fca69ddb52..4050cd136b 100644
--- a/backends/wince/CEActionsPocket.cpp
+++ b/backends/wince/CEActionsPocket.cpp
@@ -54,8 +54,8 @@ const String pocketActionNames[] = {
"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 @@ int CEActionsPocket::version() {
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::initInstanceMain(OSystem *mainSystem) {
}
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
diff --git a/backends/wince/CEActionsPocket.h b/backends/wince/CEActionsPocket.h
index a5b24b2346..3288dfbdf4 100644
--- a/backends/wince/CEActionsPocket.h
+++ b/backends/wince/CEActionsPocket.h
@@ -28,7 +28,6 @@
#include "common/system.h"
-#include "base/gameDetector.h"
#include "wince-sdl.h"
#include "gui/Key.h"
@@ -62,7 +61,7 @@ class CEActionsPocket : public GUI::Actions {
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 @@ class CEActionsPocket : public GUI::Actions {
~CEActionsPocket();
private:
- CEActionsPocket(GameDetector &detector);
+ CEActionsPocket(const Common::String &gameid);
bool _right_click_needed;
bool _hide_toolbar_needed;
bool _zoom_needed;
diff --git a/backends/wince/CEActionsSmartphone.cpp b/backends/wince/CEActionsSmartphone.cpp
index d573b463ef..6f1ee62701 100644
--- a/backends/wince/CEActionsSmartphone.cpp
+++ b/backends/wince/CEActionsSmartphone.cpp
@@ -60,8 +60,8 @@ const int ACTIONS_SMARTPHONE_DEFAULT[] = { 0x111, 0x112, 0x114, 0x113, 0x11a, 0x
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 @@ int CEActionsSmartphone::version() {
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::initInstanceMain(OSystem *mainSystem) {
}
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
diff --git a/backends/wince/CEActionsSmartphone.h b/backends/wince/CEActionsSmartphone.h
index 56f1d43e1c..d408398e29 100644
--- a/backends/wince/CEActionsSmartphone.h
+++ b/backends/wince/CEActionsSmartphone.h
@@ -30,7 +30,6 @@
#include "common/system.h"
-#include "base/gameDetector.h"
#include "wince-sdl.h"
#include "gui/Key.h"
@@ -61,7 +60,7 @@ class CEActionsSmartphone : public GUI::Actions {
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 @@ class CEActionsSmartphone : public GUI::Actions {
~CEActionsSmartphone();
private:
- CEActionsSmartphone(GameDetector &detector);
+ CEActionsSmartphone(const Common::String &gameid);
bool _right_click_needed;
OSystem_WINCE3 *_CESystem;
};
diff --git a/backends/wince/wince-sdl.cpp b/backends/wince/wince-sdl.cpp
index b5a8d3a972..885e2ce242 100644
--- a/backends/wince/wince-sdl.cpp
+++ b/backends/wince/wince-sdl.cpp
@@ -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 @@ using namespace CEGUI;
// Given to the true main, needed for backend adaptation
-static GameDetector _gameDetector;
static FILE *stdout_file;
static FILE *stderr_file;
@@ -144,7 +142,6 @@ int SDL_main(int argc, char **argv) {
/* 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 @@ bool OSystem_WINCE3::checkOggHighSampleRate() {
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 @@ void OSystem_WINCE3::get_sample_rate() {
}
}
// 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 @@ bool OSystem_WINCE3::setSoundCallback(SoundProc proc, void *param) {
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 @@ void OSystem_WINCE3::check_mappings() {
}
// 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::check_mappings() {
}
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 @@ void OSystem_WINCE3::update_game_settings() {
_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);
}
diff --git a/base/main.cpp b/base/main.cpp
index 2b3ecfabb3..d82b238b97 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -230,11 +230,7 @@ static int runGame(GameDetector &detector, OSystem &system, const Common::String
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 @@ extern "C" int scummvm_main(int argc, char *argv[]) {
// 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
diff --git a/base/main.h b/base/main.h
index 06b7e2cb5f..8abf5038a0 100644
--- a/base/main.h
+++ b/base/main.h
@@ -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
diff --git a/gui/Actions.cpp b/gui/Actions.cpp
index 8dd25f4942..79c7005733 100644
--- a/gui/Actions.cpp
+++ b/gui/Actions.cpp
@@ -39,8 +39,8 @@ Actions* Actions::Instance() {
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 @@ Actions::~Actions() {
}
// 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 @@ Key& Actions::getKeyAction(ActionType action)
return _key_action[action];
}
-// Game detector
-GameDetector& Actions::gameDetector(){
- return *_detector;
-}
Actions *Actions::_instance = NULL;
diff --git a/gui/Actions.h b/gui/Actions.h
index 7932837c61..40a72b4beb 100644
--- a/gui/Actions.h
+++ b/gui/Actions.h
@@ -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 @@ class Actions {
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 @@ public:
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(const Common::String &gameid);
+
protected:
- Actions(GameDetector &detector);
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];