Ticket #4582: detection.patch

File detection.patch, 7.0 KB (added by bluegr, 15 years ago)

Beginning of conversion of gameid and extras fields to Common::String

  • engines/advancedDetector.cpp

     
    144144        const char *title = 0;
    145145
    146146        while (sg->gameid) {
    147                 if (!scumm_stricmp(g.gameid, sg->gameid))
     147                if (g.gameid == sg->gameid)
    148148                        title = sg->description;
    149149                sg++;
    150150        }
    151151
    152152        GameDescriptor gd(g.gameid, title, g.language, g.platform);
    153         gd.updateDesc(g.extra);
     153        gd.updateDesc(g.extra.c_str());
    154154        return gd;
    155155}
    156156
  • engines/advancedDetector.h

     
    5151};
    5252
    5353struct ADGameDescription {
    54         const char *gameid;
    55         const char *extra;
     54        Common::String gameid;
     55        Common::String extra;
    5656        ADGameFileDescription filesDescriptions[14];
    5757        Common::Language language;
    5858        Common::Platform platform;
  • engines/agos/agos.h

     
    199199        int getGameId() const;
    200200        int getGameType() const;
    201201        uint32 getFeatures() const;
    202         const char *getExtra() const;
     202        Common::String getExtra() const;
    203203        Common::Language getLanguage() const;
    204204        Common::Platform getPlatform() const;
    205205        const char *getFileName(int type) const;
  • engines/agos/detection.cpp

     
    230230        return _gameDescription->features;
    231231}
    232232
    233 const char *AGOSEngine::getExtra() const {
     233Common::String AGOSEngine::getExtra() const {
    234234        return _gameDescription->desc.extra;
    235235}
    236236
  • engines/agos/script_ff.cpp

     
    438438        // 135: switch CD
    439439        uint16 disc = readVariable(97);
    440440
    441         if (!strcmp(getExtra(), "4CD")) {
     441        if (getExtra() == "4CD") {
    442442                _sound->switchVoiceFile(gss, disc);
    443         } else if (!strcmp(getExtra(), "2CD")) {
     443        } else if (getExtra() == "2CD") {
    444444                if (disc == 1 || disc == 2)
    445445                        _sound->switchVoiceFile(gss, 1);
    446446                else if (disc == 3 || disc == 4)
  • engines/cruise/cruise.h

     
    8383        virtual bool hasFeature(EngineFeature f) const;
    8484
    8585        int getGameType() const;
    86         const char *getGameId() const;
     86        Common::String getGameId() const;
    8787        uint32 getFeatures() const;
    8888        Common::Language getLanguage() const;
    8989        Common::Platform getPlatform() const;
  • engines/cruise/detection.cpp

     
    4141        uint32 features;
    4242};
    4343
    44 const char *CruiseEngine::getGameId() const {
     44Common::String CruiseEngine::getGameId() const {
    4545        return _gameDescription->desc.gameid;
    4646}
    4747
  • engines/sci/detection.cpp

     
    339339        delete resMan;
    340340
    341341        // Distinguish demos from full versions
    342         if (!strcmp(s_fallbackDesc.desc.gameid, "castlebrain") && !Common::File::exists("resource.002")) {
     342        if (s_fallbackDesc.desc.gameid == "castlebrain" && !Common::File::exists("resource.002")) {
    343343                // The Spanish full version doesn't have resource.002, but we can distinguish it from the
    344344                // demo from the size of resource.000
    345345                if (smallResource000Size)
    346346                        s_fallbackDesc.desc.flags |= ADGF_DEMO;
    347347        }
    348348
    349         if (!strcmp(s_fallbackDesc.desc.gameid, "islandbrain") && smallResource000Size)
     349        if (s_fallbackDesc.desc.gameid == "islandbrain" && smallResource000Size)
    350350                s_fallbackDesc.desc.flags |= ADGF_DEMO;
    351351
    352         if (!strcmp(s_fallbackDesc.desc.gameid, "kq6") && smallResource000Size)
     352        if (s_fallbackDesc.desc.gameid == "kq6" && smallResource000Size)
    353353                s_fallbackDesc.desc.flags |= ADGF_DEMO;
    354354
    355355        // Fill in extras field
    356         if (!strcmp(s_fallbackDesc.desc.gameid, "lsl1sci") ||
    357                 !strcmp(s_fallbackDesc.desc.gameid, "pq1sci") ||
    358                 !strcmp(s_fallbackDesc.desc.gameid, "sq1sci"))
     356        if (s_fallbackDesc.desc.gameid == "lsl1sci" ||
     357                s_fallbackDesc.desc.gameid == "pq1sci" ||
     358                s_fallbackDesc.desc.gameid == "sq1sci")
    359359                s_fallbackDesc.desc.extra = "VGA Remake";
    360360
    361         if (!strcmp(s_fallbackDesc.desc.gameid, "qfg1") && !Common::File::exists("resource.001"))
     361        if (s_fallbackDesc.desc.gameid == "qfg1" && !Common::File::exists("resource.001"))
    362362                s_fallbackDesc.desc.extra = "VGA Remake";
    363363
    364364        SearchMan.remove("SCI_detection");
  • engines/sci/sci.cpp

     
    235235        return _console;
    236236}
    237237
    238 const char* SciEngine::getGameID() const {
     238Common::String SciEngine::getGameID() const {
    239239        return _gameDescription->desc.gameid;
    240240}
    241241
  • engines/sci/sci.h

     
    106106        virtual GUI::Debugger *getDebugger();
    107107        Console *getSciDebugger();
    108108
    109         const char* getGameID() const;
     109        Common::String getGameID() const;
    110110        int getResourceVersion() const;
    111111        SciVersion getVersion() const;
    112112        Common::Language getLanguage() const;
  • engines/tinsel/detection.cpp

     
    679679        // Includes nifty stuff like removing trailing dots and ignoring case.
    680680        for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
    681681                if (file->isDirectory()) {
    682                         if (!scumm_stricmp(file->getName().c_str(), "dw2")) {
     682                        if (file->getName().equalsIgnoreCase("dw2")) {
    683683                                // Probably Discworld 2 subfolder on CD, so add it's contents as well
    684684                                Common::FSList files;
    685685                                if (file->getChildren(files, Common::FSNode::kListAll)) {
     
    704704        // Check which files are included in some dw2 ADGameDescription *and* present
    705705        // in fslist without a '1' suffix character. Compute MD5s and file sizes for these files.
    706706        for (g = &Tinsel::gameDescriptions[0]; g->desc.gameid != 0; ++g) {
    707                 if (strcmp(g->desc.gameid, "dw2") != 0)
     707                if (g->desc.gameid == "dw2")
    708708                        continue;
    709709
    710710                for (fileDesc = g->desc.filesDescriptions; fileDesc->fileName; fileDesc++) {
     
    738738        // MD5 based matching
    739739        uint i;
    740740        for (i = 0, g = &Tinsel::gameDescriptions[0]; g->desc.gameid != 0; ++g) {
    741                 if (strcmp(g->desc.gameid, "dw2") != 0)
     741                if (g->desc.gameid == "dw2")
    742742                        continue;
    743743
    744744                bool fileMissing = false;