Ticket #8741: advdetector-svn29385.diff

File advdetector-svn29385.diff, 29.7 KB (added by cyxx, 17 years ago)
  • engines/touche/detection.cpp

     
    110110        { 0, { 0 } }
    111111};
    112112
    113 }
     113} // End of namespace Touche
    114114
    115115static const Common::ADParams detectionParams = {
    116116        (const byte *)Touche::gameDescriptions,
     
    124124        Common::kADFlagAugmentPreferredTarget | Common::kADFlagPrintWarningOnFileBasedFallback
    125125};
    126126
    127 ADVANCED_DETECTOR_DEFINE_PLUGIN(TOUCHE, Touche::ToucheEngine, detectionParams);
    128 
    129 REGISTER_PLUGIN(TOUCHE, "Touche Engine", "Touche: The Adventures of the 5th Musketeer (C) Clipper Software");
    130 
    131 namespace Touche {
    132 
    133 bool ToucheEngine::detectGame() {
    134         Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(detectionParams);
     127static bool Engine_TOUCHE_createInstance(OSystem *syst, Engine **engine, const Common::EncapsulatedADGameDesc &encapsulatedDesc) {
    135128        const Common::ADGameDescription *gd = encapsulatedDesc.realDesc;
    136 
    137         if (gd == 0)
    138                 return false;
    139 
    140         _language = gd->language;
    141         return true;
     129        if (gd) {
     130                *engine = new Touche::ToucheEngine(syst, gd->language);
     131        }
     132        return gd != 0;
    142133}
    143134
    144 } // End of namespace Touche
     135ADVANCED_DETECTOR_DEFINE_PLUGIN(TOUCHE, Engine_TOUCHE_createInstance, detectionParams);
     136
     137REGISTER_PLUGIN(TOUCHE, "Touche Engine", "Touche: The Adventures of the 5th Musketeer (C) Clipper Software");
  • engines/touche/touche.cpp

     
    3737
    3838namespace Touche {
    3939
    40 ToucheEngine::ToucheEngine(OSystem *system)
    41         : Engine(system), _midiPlayer(0) {
     40ToucheEngine::ToucheEngine(OSystem *system, Common::Language language)
     41        : Engine(system), _midiPlayer(0), _language(language) {
    4242
    4343        _saveLoadCurrentPage = 0;
    4444        _saveLoadCurrentSlot = 0;
     
    8787                _system->initSize(kScreenWidth, kScreenHeight);
    8888        _system->endGFXTransaction();
    8989
    90         // Detect game
    91         if (!detectGame()) {
    92                 GUIErrorMessage("No valid games were found in the specified directory.");
    93                 return -1;
    94         }
    95 
    9690        Graphics::setupFont(_language);
    9791
    9892        setupOpcodes();
  • engines/touche/touche.h

     
    351351
    352352        typedef void (ToucheEngine::*OpcodeProc)();
    353353
    354         ToucheEngine(OSystem *system);
     354        ToucheEngine(OSystem *system, Common::Language language);
    355355        virtual ~ToucheEngine();
    356356
    357357        virtual int init();
  • engines/agos/agos.h

     
    179179
    180180        const AGOSGameDescription *_gameDescription;
    181181
    182         bool initGame(void);
    183182        virtual void setupGame();
    184183
    185184        int getGameId() const;
  • engines/agos/detection.cpp

     
    129129                res = false;
    130130                error("AGOS engine: unknown gameType");
    131131        }
     132        if (res) {
     133                ((AGOS::AGOSEngine *)*engine)->_gameDescription = gd;
     134        }
    132135
    133136        return res;
    134137}
    135138
    136 ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_COMPLEX_CREATION(AGOS, engineCreateAgos, detectionParams);
     139ADVANCED_DETECTOR_DEFINE_PLUGIN(AGOS, engineCreateAgos, detectionParams);
    137140
    138141REGISTER_PLUGIN(AGOS, "AGOS", "AGOS (C) Adventure Soft");
    139142
    140143namespace AGOS {
    141144
    142 bool AGOSEngine::initGame() {
    143         Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(detectionParams);
    144         _gameDescription = (const AGOSGameDescription *)(encapsulatedDesc.realDesc);
    145 
    146         return (_gameDescription != 0);
    147 }
    148 
    149 
    150145int AGOSEngine::getGameId() const {
    151146        return _gameDescription->gameId;
    152147}
  • engines/agos/agos.cpp

     
    525525}
    526526
    527527int AGOSEngine::init() {
    528         // Detect game
    529         if (!initGame()) {
    530                 GUIErrorMessage("No valid games were found in the specified directory.");
    531                 return -1;
    532         }
    533 
    534528        if (getGameId() == GID_DIMP) {
    535529                _screenWidth = 496;
    536530                _screenHeight = 400;
  • engines/cruise/cruise.h

     
    5151        bool initGame();
    5252
    5353public:
    54         CruiseEngine(OSystem * syst);
     54        CruiseEngine(OSystem * syst, const CRUISEGameDescription *gameDesc);
    5555        virtual ~ CruiseEngine();
    5656
    5757        int getGameType() const;
  • engines/cruise/detection.cpp

     
    111111        Common::kADFlagAugmentPreferredTarget
    112112};
    113113
    114 ADVANCED_DETECTOR_DEFINE_PLUGIN(CRUISE, Cruise::CruiseEngine, detectionParams);
    115 
    116 REGISTER_PLUGIN(CRUISE, "Cinematique evo 2 engine", "Cruise for a Corpse (C) Delphine Software");
    117 
    118 namespace Cruise {
    119 
    120 bool CruiseEngine::initGame() {
    121         Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(detectionParams);
    122         _gameDescription = (const CRUISEGameDescription *)(encapsulatedDesc.realDesc);
    123 
    124         return (_gameDescription != 0);
     114static bool Engine_CRUISE_createInstance(OSystem *syst, Engine **engine, Common::EncapsulatedADGameDesc encapsulatedDesc) {
     115        const Cruise::CRUISEGameDescription *gd = (const Cruise::CRUISEGameDescription *)(encapsulatedDesc.realDesc);
     116        if (gd) {
     117                *engine = new Cruise::CruiseEngine(syst, gd);
     118        }
     119        return gd != 0;
    125120}
    126121
    127 } // End of namespace Cruise
     122ADVANCED_DETECTOR_DEFINE_PLUGIN(CRUISE, Engine_CRUISE_createInstance, detectionParams);
     123
     124REGISTER_PLUGIN(CRUISE, "Cinematique evo 2 engine", "Cruise for a Corpse (C) Delphine Software");
  • engines/cruise/cruise.cpp

     
    4444
    4545CruiseEngine *g_cruise;
    4646
    47 CruiseEngine::CruiseEngine(OSystem * syst) : Engine(syst) {
     47CruiseEngine::CruiseEngine(OSystem * syst, const CRUISEGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
    4848
    4949#ifdef PALMOS_MODE
    5050        _currentVolumeFile = new Common::File();
     
    7575}
    7676
    7777int CruiseEngine::init() {
    78         // Detect game
    79         if (!initGame()) {
    80                 GUIErrorMessage ("No valid games were found in the specified directory.");
    81                 return -1;
    82         }
    8378        // Initialize backend
    8479        _system->beginGFXTransaction();
    8580        initCommonGFX(false);
  • engines/drascula/detection.cpp

     
    164164        Common::kADFlagAugmentPreferredTarget
    165165};
    166166
    167 ADVANCED_DETECTOR_DEFINE_PLUGIN(DRASCULA, Drascula::DrasculaEngine, detectionParams);
    168 
    169 REGISTER_PLUGIN(DRASCULA, "Drascula Engine", "Drascula Engine (C) 2000 Alcachofa Soft, 1996 (C) Digital Dreams Multimedia, 1994 (C) Emilio de Paz");
    170 
    171 namespace Drascula {
    172 
    173 bool DrasculaEngine::initGame() {
    174         Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(detectionParams);
    175         _gameDescription = (const DrasculaGameDescription *)(encapsulatedDesc.realDesc);
    176 
    177         return (_gameDescription != 0);
     167static bool Engine_DRASCULA_createInstance(OSystem *syst, Engine **engine, Common::EncapsulatedADGameDesc encapsulatedDesc) {
     168        const Drascula::DrasculaGameDescription *gd = (const Drascula::DrasculaGameDescription *)(encapsulatedDesc.realDesc);
     169        if (gd) {
     170                *engine = new Drascula::DrasculaEngine(syst, gd);
     171        }
     172        return gd != 0;
    178173}
    179174
    180 } // End of namespace Drascula
     175ADVANCED_DETECTOR_DEFINE_PLUGIN(DRASCULA, Engine_DRASCULA_createInstance, detectionParams);
    181176
     177REGISTER_PLUGIN(DRASCULA, "Drascula Engine", "Drascula Engine (C) 2000 Alcachofa Soft, 1996 (C) Digital Dreams Multimedia, 1994 (C) Emilio de Paz");
     178
  • engines/drascula/drascula.cpp

     
    5353        {NULL, NULL, 0, 0, NULL}
    5454};
    5555
    56 DrasculaEngine::DrasculaEngine(OSystem *syst) : Engine(syst) {
     56DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
    5757
    5858        // Setup mixer
    5959        if (!_mixer->isReady()) {
     
    119119static char poder_v[6][14] = {"11.als", "109.als", "111.als", "110.als", "115.als", "116.als"};
    120120
    121121int DrasculaEngine::init() {
    122         // Detect game
    123         if (!initGame()) {
    124                 GUIErrorMessage("No valid games were found in the specified directory.");
    125                 return -1;
    126         }
    127 
    128122        // Initialize backend
    129123        _system->beginGFXTransaction();
    130124                initCommonGFX(false);
  • engines/drascula/drascula.h

     
    337337        int go();
    338338//      void shutdown();
    339339
    340         bool initGame();
    341 
    342340public:
    343         DrasculaEngine(OSystem *syst);
     341        DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gameDesc);
    344342        virtual ~DrasculaEngine();
    345343        int getGameId() {
    346344                return _gameId;
  • engines/agi/agi.cpp

     
    605605        setAmigaStyle(renderMode == Common::kRenderAmiga);
    606606}
    607607
    608 AgiBase::AgiBase(OSystem *syst) : Engine(syst) {
     608AgiBase::AgiBase(OSystem *syst, const AGIGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
    609609
    610610}
    611611
    612 AgiEngine::AgiEngine(OSystem *syst) : AgiBase(syst) {
     612AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBase(syst, gameDesc) {
    613613
    614614        // Setup mixer
    615615        if (!_mixer->isReady()) {
     
    783783
    784784int AgiEngine::init() {
    785785
    786         // Detect game
    787         if (!initGame()) {
    788                 GUIErrorMessage("No valid games were found in the specified directory.");
    789                 return -1;
    790         }
    791 
    792 
    793786        // Initialize backend
    794787        _system->beginGFXTransaction();
    795788        initCommonGFX(false);
  • engines/agi/preagi.h

     
    4040        void shutdown();
    4141        void initialize();
    4242
    43         bool initGame();
    44 
    4543public:
    4644        void agiTimerLow() {}
    4745        int agiGetKeypressLow() { return 0; }
    4846        int agiIsKeypressLow() { return 0; }
    4947
    50         PreAgiEngine(OSystem *syst);
     48        PreAgiEngine(OSystem *syst, const AGIGameDescription *gameDesc);
    5149        virtual ~PreAgiEngine();
    5250        int getGameId() {
    5351                return _gameId;
  • engines/agi/detection.cpp

     
    22532253
    22542254        switch (gd->gameType) {
    22552255        case Agi::GType_PreAGI:
    2256                 *engine = new Agi::PreAgiEngine(syst);
     2256                *engine = new Agi::PreAgiEngine(syst, gd);
    22572257                break;
    22582258        case Agi::GType_V2:
    2259                 *engine = new Agi::AgiEngine(syst);
     2259                *engine = new Agi::AgiEngine(syst, gd);
    22602260                break;
    22612261        case Agi::GType_V3:
    2262                 *engine = new Agi::AgiEngine(syst);
     2262                *engine = new Agi::AgiEngine(syst, gd);
    22632263                break;
    22642264        default:
    22652265                res = false;
     
    22692269        return res;
    22702270}
    22712271
    2272 ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_COMPLEX_CREATION(AGI, engineCreateAgi, detectionParams);
     2272ADVANCED_DETECTOR_DEFINE_PLUGIN(AGI, engineCreateAgi, detectionParams);
    22732273
    22742274REGISTER_PLUGIN(AGI, "AGI preAGI + v2 + v3 Engine", "Sierra AGI Engine (C) Sierra On-Line Software");
    22752275
    2276 namespace Agi {
    2277 
    2278 bool AgiEngine::initGame() {
    2279         Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(detectionParams);
    2280         _gameDescription = (const AGIGameDescription *)(encapsulatedDesc.realDesc);
    2281 
    2282         return (_gameDescription != 0);
    2283 }
    2284 
    2285 bool PreAgiEngine::initGame() {
    2286         Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(detectionParams);
    2287         _gameDescription = (const AGIGameDescription *)(encapsulatedDesc.realDesc);
    2288 
    2289         return (_gameDescription != 0);
    2290 }
    2291 
    2292 } // End of namespace Agi
    2293 
  • engines/agi/agi.h

     
    656656        virtual int agiGetKeypressLow() = 0;
    657657        virtual int agiIsKeypressLow() = 0;
    658658
    659         AgiBase(OSystem *syst);
     659        AgiBase(OSystem *syst, const AGIGameDescription *gameDesc);
    660660
    661661        #define INITIAL_IMAGE_STACK_SIZE 32
    662662
     
    695695        void shutdown();
    696696        void initialize();
    697697
    698         bool initGame();
    699 
    700698public:
    701         AgiEngine(OSystem *syst);
     699        AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc);
    702700        virtual ~AgiEngine();
    703701        int getGameId() {
    704702                return _gameId;
  • engines/agi/preagi.cpp

     
    5151
    5252namespace Agi {
    5353
    54 PreAgiEngine::PreAgiEngine(OSystem *syst) : AgiBase(syst) {
     54PreAgiEngine::PreAgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBase(syst, gameDesc) {
    5555
    5656        // Setup mixer
    5757        if (!_mixer->isReady()) {
     
    195195}
    196196
    197197int PreAgiEngine::init() {
    198 
    199         // Detect game
    200         if (!initGame()) {
    201                 GUIErrorMessage("No valid games were found in the specified directory.");
    202                 return -1;
    203         }
    204 
    205198        // Initialize backend
    206199        _system->beginGFXTransaction();
    207200        initCommonGFX(false);
  • engines/kyra/detection.cpp

     
    436436        return res;
    437437}
    438438
    439 ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_COMPLEX_CREATION(KYRA, engineCreateKyra, detectionParams);
     439ADVANCED_DETECTOR_DEFINE_PLUGIN(KYRA, engineCreateKyra, detectionParams);
    440440
    441441REGISTER_PLUGIN(KYRA, "Legend of Kyrandia Engine", "The Legend of Kyrandia (C) Westwood Studios");
    442442
  • engines/gob/gob.h

     
    167167        friend class Ptr;
    168168};
    169169
     170struct GOBGameDescription;
     171
    170172class GobEngine : public Engine {
    171173protected:
    172174        GobEngine *_vm;
     
    177179        bool initGameParts();
    178180        void deinitGameParts();
    179181
    180         bool detectGame();
    181 
    182182public:
    183183        static const Common::Language _gobToScummVMLang[];
    184184
     
    237237
    238238        GobEngine(OSystem *syst);
    239239        virtual ~GobEngine();
     240
     241        void initGame(const GOBGameDescription *gd);
    240242};
    241243
    242244} // End of namespace Gob
  • engines/gob/gob.cpp

     
    145145}
    146146
    147147int GobEngine::init() {
    148         // Detect game
    149         if (!detectGame()) {
    150                 GUIErrorMessage("No valid games were found in the specified directory.");
    151                 return -1;
    152         }
    153 
    154148        if (!initGameParts()) {
    155149                GUIErrorMessage("GobEngine::init(): Unknown version of game engine");
    156150                return -1;
  • engines/gob/detection.cpp

     
    17011701        kADFlagAugmentPreferredTarget
    17021702};
    17031703
    1704 ADVANCED_DETECTOR_DEFINE_PLUGIN(GOB, Gob::GobEngine, detectionParams);
     1704static bool Engine_GOB_createInstance(OSystem *syst, Engine **engine, Common::EncapsulatedADGameDesc encapsulatedDesc) {
     1705        const Gob::GOBGameDescription *gd = (const Gob::GOBGameDescription *)(encapsulatedDesc.realDesc);
     1706        if (gd) {
     1707                *engine = new Gob::GobEngine(syst);
     1708                ((Gob::GobEngine *)*engine)->initGame(gd);
     1709        }
     1710        return gd != 0;
     1711}
    17051712
     1713ADVANCED_DETECTOR_DEFINE_PLUGIN(GOB, Engine_GOB_createInstance, detectionParams);
     1714
    17061715REGISTER_PLUGIN(GOB, "Gob Engine", "Goblins Games (C) Coktel Vision");
    17071716
    1708 
    17091717namespace Gob {
    17101718
    1711 bool GobEngine::detectGame() {
    1712         Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(detectionParams);
    1713         const GOBGameDescription *gd = (const GOBGameDescription *)(encapsulatedDesc.realDesc);
    1714 
    1715         if (gd == 0)
    1716                 return false;
    1717 
     1719void GobEngine::initGame(const GOBGameDescription *gd) {
    17181720        if (gd->startTotBase == 0) {
    17191721                _startTot = new char[10];
    17201722                _startTot0 = new char[11];
     
    17331735        _features = gd->features;
    17341736        _language = gd->desc.language;
    17351737        _platform = gd->desc.platform;
    1736 
    1737         return true;
    17381738}
    17391739
    17401740} // End of namespace Gob
  • engines/parallaction/parallaction.h

     
    363363
    364364public:
    365365
    366         Parallaction(OSystem *syst);
     366        Parallaction(OSystem *syst, const PARALLACTIONGameDescription *gameDesc);
    367367        ~Parallaction();
    368368
    369369        int init();
     
    640640class Parallaction_ns : public Parallaction {
    641641
    642642public:
    643         Parallaction_ns(OSystem* syst) : Parallaction(syst) { }
     643        Parallaction_ns(OSystem* syst, const PARALLACTIONGameDescription *gameDesc) : Parallaction(syst, gameDesc) { }
    644644        ~Parallaction_ns();
    645645
    646646        int init();
     
    922922        typedef Parallaction_ns Super;
    923923
    924924public:
    925         Parallaction_br(OSystem* syst) : Parallaction_ns(syst) { }
     925        Parallaction_br(OSystem* syst, const PARALLACTIONGameDescription *gameDesc) : Parallaction_ns(syst, gameDesc) { }
    926926        ~Parallaction_br();
    927927
    928928        int init();
  • engines/parallaction/detection.cpp

     
    184184        Common::kADFlagAugmentPreferredTarget
    185185};
    186186
    187 bool engineCreateParallaction(OSystem *syst, Engine **engine, Common::EncapsulatedADGameDesc encapsulatedDesc) {
     187static bool Engine_PARALLACTION_createInstance(OSystem *syst, Engine **engine, Common::EncapsulatedADGameDesc encapsulatedDesc) {
    188188        const Parallaction::PARALLACTIONGameDescription *gd = (const Parallaction::PARALLACTIONGameDescription *)(encapsulatedDesc.realDesc);
    189189        bool res = true;
    190190
    191191        switch (gd->gameType) {
    192192        case Parallaction::GType_Nippon:
    193                 *engine = new Parallaction::Parallaction_ns(syst);
     193                *engine = new Parallaction::Parallaction_ns(syst, gd);
    194194                break;
    195195        case Parallaction::GType_BRA:
    196                 *engine = new Parallaction::Parallaction_br(syst);
     196                *engine = new Parallaction::Parallaction_br(syst, gd);
    197197                break;
    198198        default:
    199199                res = false;
     
    203203        return res;
    204204}
    205205
    206 ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_COMPLEX_CREATION(PARALLACTION, engineCreateParallaction, detectionParams);
     206ADVANCED_DETECTOR_DEFINE_PLUGIN(PARALLACTION, Engine_PARALLACTION_createInstance, detectionParams);
    207207
    208208REGISTER_PLUGIN(PARALLACTION, "Parallaction engine", "Nippon Safes Inc. (C) Dynabyte");
    209 
    210 
    211 namespace Parallaction {
    212 
    213 bool Parallaction::detectGame() {
    214         Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(detectionParams);
    215         _gameDescription = (const PARALLACTIONGameDescription *)(encapsulatedDesc.realDesc);
    216 
    217         return (_gameDescription != 0);
    218 }
    219 
    220 } // End of namespace Parallaction
  • engines/parallaction/parallaction_br.cpp

     
    5959
    6060int Parallaction_br::init() {
    6161
    62         // Detect game
    63         if (!detectGame()) {
    64                 GUIErrorMessage("No valid games were found in the specified directory.");
    65                 return -1;
    66         }
    67 
    6862        _screenWidth = 640;
    6963        _screenHeight = 400;
    7064
  • engines/parallaction/parallaction_ns.cpp

     
    111111
    112112int Parallaction_ns::init() {
    113113
    114         // Detect game
    115         if (!detectGame()) {
    116                 GUIErrorMessage("No valid games were found in the specified directory.");
    117                 return -1;
    118         }
    119 
    120114        _screenWidth = 320;
    121115        _screenHeight = 200;
    122116
  • engines/parallaction/parallaction.cpp

     
    9191static Job         *_jRunScripts = NULL;
    9292
    9393
    94 Parallaction::Parallaction(OSystem *syst) :
    95         Engine(syst), _char(this) {
     94Parallaction::Parallaction(OSystem *syst, const PARALLACTIONGameDescription *gameDesc) :
     95        Engine(syst), _gameDescription(gameDesc), _char(this) {
    9696
    9797        // FIXME: Fingolfin asks: why is there a FIXME here? Please either clarify what
    9898        // needs fixing, or remove it!
  • engines/saga/saga.cpp

     
    5959
    6060#define MAX_TIME_DELTA 100
    6161
    62 SagaEngine::SagaEngine(OSystem *syst)
    63         : Engine(syst) {
     62SagaEngine::SagaEngine(OSystem *syst, const SAGAGameDescription *gameDesc)
     63        : Engine(syst), _gameDescription(gameDesc) {
    6464
    6565        _leftMouseButtonPressed = _rightMouseButtonPressed = false;
    6666
  • engines/saga/detection.cpp

     
    139139        Common::kADFlagAugmentPreferredTarget
    140140};
    141141
    142 ADVANCED_DETECTOR_DEFINE_PLUGIN(SAGA, Saga::SagaEngine, detectionParams);
     142static bool Engine_SAGA_createInstance(OSystem *syst, Engine **engine, Common::EncapsulatedADGameDesc encapsulatedDesc) {
     143        const Saga::SAGAGameDescription *gd = (const Saga::SAGAGameDescription *)(encapsulatedDesc.realDesc);
     144        if (gd) {
     145                *engine = new Saga::SagaEngine(syst, gd);
     146        }
     147        return gd != 0;
     148}
    143149
     150ADVANCED_DETECTOR_DEFINE_PLUGIN(SAGA, Engine_SAGA_createInstance, detectionParams);
     151
    144152REGISTER_PLUGIN(SAGA, "SAGA Engine", "Inherit the Earth (C) Wyrmkeep Entertainment");
    145153
    146154namespace Saga {
    147155
    148156bool SagaEngine::initGame() {
    149         Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(detectionParams);
    150         _gameDescription = (const SAGAGameDescription *)(encapsulatedDesc.realDesc);
    151 
    152         if (_gameDescription == 0)
    153                 return false;
    154 
    155157        _displayClip.right = getDisplayInfo().logicalWidth;
    156158        _displayClip.bottom = getDisplayInfo().logicalHeight;
    157159
  • engines/saga/saga.h

     
    504504        int go();
    505505        int init();
    506506public:
    507         SagaEngine(OSystem *syst);
     507        SagaEngine(OSystem *syst, const SAGAGameDescription *gameDesc);
    508508        virtual ~SagaEngine();
    509509        void shutDown() { _quit = true; }
    510510
  • engines/cine/detection.cpp

     
    487487        Common::kADFlagAugmentPreferredTarget
    488488};
    489489
    490 ADVANCED_DETECTOR_DEFINE_PLUGIN(CINE, Cine::CineEngine, detectionParams);
    491 
    492 REGISTER_PLUGIN(CINE, "Cinematique evo 1 engine", "Future Wars & Operation Stealth (C) Delphine Software");
    493 
    494 namespace Cine {
    495 
    496 bool CineEngine::initGame() {
    497         Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(detectionParams);
    498         _gameDescription = (const CINEGameDescription *)(encapsulatedDesc.realDesc);
    499 
    500         return (_gameDescription != 0);
     490static bool Engine_CINE_createInstance(OSystem *syst, Engine **engine, Common::EncapsulatedADGameDesc encapsulatedDesc) {
     491        const Cine::CINEGameDescription *gd = (const Cine::CINEGameDescription *)(encapsulatedDesc.realDesc);
     492        if (gd) {
     493                *engine = new Cine::CineEngine(syst, gd);
     494        }
     495        return gd != 0;
    501496}
    502497
    503 } // End of namespace Cine
     498ADVANCED_DETECTOR_DEFINE_PLUGIN(CINE, Engine_CINE_createInstance, detectionParams);
     499
     500REGISTER_PLUGIN(CINE, "Cinematique evo 1 engine", "Future Wars & Operation Stealth (C) Delphine Software");
  • engines/cine/cine.h

     
    7171        bool initGame();
    7272
    7373public:
    74         CineEngine(OSystem *syst);
     74        CineEngine(OSystem *syst, const CINEGameDescription *gameDesc);
    7575        virtual ~CineEngine();
    7676
    7777        int getGameType() const;
  • engines/cine/cine.cpp

     
    5050
    5151CineEngine *g_cine;
    5252
    53 CineEngine::CineEngine(OSystem *syst) : Engine(syst) {
     53CineEngine::CineEngine(OSystem *syst, const CINEGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
    5454        Common::addSpecialDebugLevel(kCineDebugScript, "Script", "Script debug level");
    5555
    5656        // Setup mixer
     
    7474}
    7575
    7676int CineEngine::init() {
    77         // Detect game
    78         if (!initGame()) {
    79                 GUIErrorMessage("No valid games were found in the specified directory.");
    80                 return -1;
    81         }
    82 
    8377        // Initialize backend
    8478        _system->beginGFXTransaction();
    8579        initCommonGFX(false);
  • common/advancedDetector.h

     
    236236// FIXME/TODO: Rename this function to something more sensible.
    237237EncapsulatedADGameDesc detectBestMatchingGame(const Common::ADParams &params);
    238238
    239 // FIXME/TODO: Rename this function to something more sensible.
    240 // Only used by ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_FUNC
    241 PluginError detectGameForEngineCreation(const Common::ADParams &params);
     239void upgradeTargetIfNecessary(const Common::ADParams &params);
    242240
    243241// Helper function to announce an unknown version of the game (useful for
    244242// fallback detection functions).
    245243void reportUnknown(StringList &files, int md5Bytes);
    246244
    247 // FIXME: It would probably be good to merge detectBestMatchingGame
    248 // and detectGameForEngineCreation into a single function. Right now, the
    249 // detection code called priort to creating an engine instance
    250 // (i.e. detectGameForEngineCreation) differs from the detection code the
    251 // engines call internally (i.e. detectBestMatchingGame). This could lead
    252 // to hard to debug and odd errors.
    253 
    254 
    255245} // End of namespace AdvancedDetector
    256246
    257247
     
    267257        } \
    268258        void dummyFuncToAllowTrailingSemicolon()
    269259
    270 #define _ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_PREDEFINED_FUNC(engine,factoryFunc,params) \
     260#define ADVANCED_DETECTOR_DEFINE_PLUGIN(engine,factoryFunc,params) \
    271261        _ADVANCED_DETECTOR_DEFINE_PLUGIN_HEAD(engine,params); \
    272262        PluginError Engine_##engine##_create(OSystem *syst, Engine **engine) { \
    273                 assert(syst); \
    274263                assert(engine); \
    275                 PluginError err = Common::AdvancedDetector::detectGameForEngineCreation(params); \
    276                 if (err == kNoError) \
    277                         *engine = factoryFunc(syst); \
    278                 return err; \
    279         } \
    280         void dummyFuncToAllowTrailingSemicolon()
    281 
    282 #define ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_COMPLEX_CREATION(engine,factoryFunc,params) \
    283         _ADVANCED_DETECTOR_DEFINE_PLUGIN_HEAD(engine,params); \
    284         PluginError Engine_##engine##_create(OSystem *syst, Engine **engine) { \
    285                 assert(engine); \
     264                Common::AdvancedDetector::upgradeTargetIfNecessary(params); \
    286265                Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(params); \
    287266                if (encapsulatedDesc.realDesc == 0) { \
    288267                        return kNoGameDataFoundError; \
     
    294273        } \
    295274        void dummyFuncToAllowTrailingSemicolon()
    296275
    297 #define ADVANCED_DETECTOR_DEFINE_PLUGIN(engine,className,params) \
    298         static Engine *engine##_createInstance(OSystem *syst) { \
    299                 return new className(syst); \
    300         } \
    301         _ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_PREDEFINED_FUNC(engine,engine##_createInstance,params); \
    302         void dummyFuncToAllowTrailingSemicolon()
    303 
    304 
    305276}       // End of namespace Common
    306277
    307278#endif
  • common/advancedDetector.cpp

     
    7070        return GameList(params.list);
    7171}
    7272
    73 static void upgradeTargetIfNecessary(const Common::ADParams &params) {
     73void upgradeTargetIfNecessary(const Common::ADParams &params) {
    7474        if (params.obsoleteList == 0)
    7575                return;
    7676
     
    264264        return result;
    265265}
    266266
    267 PluginError detectGameForEngineCreation(
    268         const Common::ADParams &params
    269         ) {
    270 
    271         upgradeTargetIfNecessary(params);
    272 
    273         Common::String gameid = ConfMan.get("gameid");
    274 
    275         FSList fslist;
    276         FilesystemNode dir(ConfMan.get("path"));
    277         if (!dir.getChildren(fslist, FilesystemNode::kListFilesOnly)) {
    278                 return kInvalidPathError;
    279         }
    280 
    281         ADGameDescList matches = detectGame(&fslist, params, Common::UNK_LANG, Common::kPlatformUnknown);
    282 
    283         // We have single ID set, so we have a game if there are hits
    284         if (params.singleid != NULL && matches.size())
    285                 return kNoError;
    286 
    287         for (uint i = 0; i < matches.size(); i++) {
    288                 if (matches[i]->gameid == gameid) {
    289                         return kNoError;
    290                 }
    291         }
    292 
    293         // Use fallback detector if there were no matches by other means
    294         if (params.fallbackDetectFunc != NULL) {
    295                 EncapsulatedADGameDesc fallbackDesc = (*params.fallbackDetectFunc)(&fslist);
    296                 if (fallbackDesc.realDesc != 0 && (params.singleid != NULL || fallbackDesc.getGameID() == gameid)) {
    297                         return kNoError;
    298                 }
    299         }
    300 
    301         return kNoGameDataFoundError;
    302 }
    303 
    304267void reportUnknown(StringMap &filesMD5, HashMap<String, int32, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> &filesSize) {
    305268        // TODO: This message should be cleaned up / made more specific.
    306269        // For example, we should specify at least which engine triggered this.