From 1d265f18956cb78cfe2d9c92462853b057c2b2ef Mon Sep 17 00:00:00 2001 From: Lars Persson Date: Wed, 12 Apr 2006 19:04:10 +0000 Subject: Commiting Fingolfins patch to remove gamedetector usage. svn-id: r21830 --- backends/symbian/src/SymbianActions.cpp | 22 +++++++++++----------- backends/symbian/src/SymbianActions.h | 5 ++--- backends/symbian/src/SymbianOS.cpp | 2 +- backends/wince/CEActionsPocket.cpp | 28 ++++++++++++++-------------- backends/wince/CEActionsPocket.h | 5 ++--- backends/wince/CEActionsSmartphone.cpp | 22 +++++++++++----------- backends/wince/CEActionsSmartphone.h | 5 ++--- backends/wince/wince-sdl.cpp | 30 ++++++++++++++++-------------- 8 files changed, 59 insertions(+), 60 deletions(-) (limited to 'backends') 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); } -- cgit v1.2.3