ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

md5check.cpp

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #include "common/file.h"
00024 #include "common/md5.h"
00025 #include "common/translation.h"
00026 
00027 #include "gui/error.h"
00028 
00029 #include "engines/grim/md5check.h"
00030 #include "engines/grim/grim.h"
00031 
00032 namespace Grim {
00033 
00034 // Grim retail
00035 
00036 const char *gfupd101[] = {
00037     "bc57c4db2ab814f3bb115ec5702b62f4"
00038 };
00039 const char *year4mus[] = {
00040     "939e041887c1b14f99ad951ac8e3cb25" //english unpatched
00041 };
00042 const char *year3mus[] = {
00043     "df556a8fc151f6f48bb68a8cef855e7d" //english unpatched
00044 };
00045 const char *year2mus[] = {
00046     "775376fccf0415258be6b33e7e6e4985" //english unpatched
00047 };
00048 const char *year1mus[] = {
00049     "c555c95b0f7557617da364091589d6ea" //english unpatched
00050 };
00051 const char *year0mus[] = {
00052     "fea10f11abe3ac32d53e4798f80d5ba0" //english unpatched
00053 };
00054 const char *vox0004[] = {
00055     "ae53a36f77eb0d42a28653b28c345439", //english unpatched
00056     "57915d4dd3aa5aa44817477b7bd41ce6", //italian unpatched
00057     "bae246c5335c1d139b97a48277ee8841", //german unpatched
00058     "a49dce6e1bb83ad40b47e03903aaff1b", //french unpatched
00059     "3577a8b6cf013bc5b9c9133e29d1f4f0" //spanish unpatched
00060 };
00061 const char *vox0003[] = {
00062     "7c88ad7c949a516793b584299f33ed23", //english unpatched
00063     "f900cb063fbd0ef2a0516e9a00291d13", //italian unpatched
00064     "5bda9a36181c1fea368491b842c11efe", //german unpatched
00065     "c4aa2c45b24f351e8fce40a141084fb0", //french unpatched
00066     "1d4e94e3d3fd803a02c9993412359082" //spanish unpatched
00067 };
00068 const char *vox0002[] = {
00069     "70419878e32377d9d2906fbcb2cb59b5", //english unpatched
00070     "616e4147c39268b650ce112bf79ea3a1", //italian unpatched
00071     "5ea9fde04f3315a51fe1fe9c5bdb9d0d", //german unpatched
00072     "24bbf1f6d3d63ae07ad2dd06bd7dad8c", //french unpatched
00073     "c4484dadd4a33066290e1847523d7d64" //spanish unpatched
00074 };
00075 const char *vox0001[] = {
00076     "40beb2e0a6572dc89fddb21f282bc237", //english pre-patched
00077     "6a32f8079d2d98d1c10ec8364765fd4b", //english unpatched
00078     "a0455d5d883ed46f0bda5030e4b5654c", //italian unpatched
00079     "e13eb421b9490cbaeef66f0cf6156764", //german unpatched
00080     "e940d5a4a4f2229f0a6674bf45464457", //french unpatched
00081     "77cdd6f02bc3f7085bff17c454066de3" //spanish unpatched
00082 };
00083 const char *vox0000[] = {
00084     "c7900f32d48d7e265629bd355a21c795", //english pre-patched
00085     "67627f2d9314f9c0ae55dd2099fc052f", //english unpatched
00086     "c9e1a755f280b3ebff58578c4e5f1e52", //italian unpatched
00087     "e884221099ba62dacf04a35be8428419", //german unpatched
00088     "dbe35af39eec29db21a4c6e1c228cc9d", //french unpatched
00089     "076bf048de229ad8cefcb3d7c0bfd134" //spanish unpatched
00090 };
00091 const char *movie04[] = {
00092     "605d6f2cc4d21fbe702d8e637b5bcfa1", //english unpatched
00093     "7c8d7e0f4beaca3910658290e8b14cf8", //italian unpatched
00094     "f1b8c1de4f82099ab080f9cbe2b02da6", //german unpatched
00095     "7e2a4578010cdf5407bb24dcfb6705e4", //french unpatched
00096     "2daf2ec272a7be49cbfde053482f182c" //spanish unpatched
00097 };
00098 const char *movie03[] = {
00099     "113a768e7206016df72f9d2f5c1851b7", //english unpatched
00100     "0fdb7dda9ebc049eac386d29bface366", //italian unpatched
00101     "d2aae2e27616f78016a71818e528acda", //german unpatched
00102     "c2ba7adbf09b7a4f69c180f1c74297ee", //french unpatched
00103     "fb87d5a9e3a81d3ffd521dee4432c4da" //spanish unpatched
00104 };
00105 const char *movie02[] = {
00106     "24a8704a331a03097d195f3597fe21e1", //english unpatched
00107     "129dad4e40987e91c5549c819d0dad1d", //italian unpatched
00108     "a4d5c108a167afb0674e26790edf65e6", //german unpatched
00109     "90fce3e6e1f91455d92b072f773f0a67", //french unpatched
00110     "f5879c544f4c1f1f2e2d2e92c026c245" //spanish unpatched
00111 };
00112 const char *movie01[] = {
00113     "548a19a0a4d4ccb8660966d646210820", //english unpatched
00114     "9fd30d0289f9b4d5c09e821a0a478db5", //italian unpatched
00115     "500bc51ce211d528f6c7170f479c9525", //german unpatched
00116     "16674e1496e4fb3f0f5f173f12e30617", //french unpatched
00117     "ede9fb7d035a5d4af496f23f811707a2" //spanish unpatched
00118 };
00119 const char *movie00[] = {
00120     "0c6b8e4fa74024c4afdf7758f8d8b1a0" //english unpatched
00121 };
00122 const char *data004[] = {
00123     "2cdb79d3606965a9a0a3378507488dd7" //english unpatched
00124 };
00125 const char *data003[] = {
00126     "76dcfc2c21f3412415674c65611fb76d", //english unpatched
00127     "7f76c20f1d77db287473ffef10b8b309" //german unpatched
00128 };
00129 const char *data002[] = {
00130     "d236403c0d860961963db0134380001f" //english unpatched
00131 };
00132 const char *data001[] = {
00133     "84cf3072586fe2840ae16774adb6f5cb" //english unpatched
00134 };
00135 const char *data000[] = {
00136     "2069b8bf113119910df8219e787e7e94", //english pre-patched
00137     "08e2505a6a7fd90d3920131b1297c60f" //english unpatched
00138 };
00139 const char *credits[] = {
00140     "6dcecad8f01657184f8576aab8fb3f00", //english unpatched
00141     "1827307248d55c07642342c9213a4723", //italian unpatched
00142     "2e6319c2ec5772ced5dc9f8b41eb5de7", //german unpatched
00143     "cd71ca4e600198277f22e944988f7516", //french unpatched
00144     "836a2081d5e57ed6ef5eaade7f770b0e" //spanish unpatched
00145 };
00146 const char *local[] = {
00147     "6142624ce13ea3c9079aa80918010c4a", //italian unpatched
00148     "27c961c16f9eaf0260781883150e5611", //german unpatched
00149     "c9dd41f66883959de27f80bbe457f30d", //french unpatched
00150     "d22648d6787c2f8f0a789ee3ed0c08f7" //spanish unpatched
00151 };
00152 
00153 
00154 // Grim demo
00155 
00156 const char *gfdemo01[] = {
00157     "25d831d57a93eb3ab8edbb07b7b63943"
00158 };
00159 const char *gdemo001[] = {
00160     "aa44d6c01a1b03d4607901933635d385"
00161 };
00162 const char *gfdemo01ger[] = {
00163     "fd728f040557118b7ca436f8205029e5"
00164 };
00165 const char *gfdemo01fra[] = {
00166     "fd728f040557118b7ca436f8205029e5" // Same as german
00167 };
00168 const char *gfdemo01ita[] = {
00169     "fd728f040557118b7ca436f8205029e5" // Same as german
00170 };
00171 const char *gfdemo01spa[] = {
00172     "fd728f040557118b7ca436f8205029e5" // Same as german
00173 };
00174 const char *grimdemo[] = {
00175     "3ba28e7e36a49b5fd01ba98e3c772fe8"
00176 };
00177 const char *sound001[] = {
00178     "c91a7d405d15fb198a9cb31f89637026"
00179 };
00180 const char *voice001[] = {
00181     "f24a45079394fee296a0f7fad07c7fad"
00182 };
00183 const char *voice001ger[] = {
00184     "d1d68735ae10148ecccb6b5000a4db96"
00185 };
00186 const char *voice001fra[] = {
00187     "43f56fca727e117b724051c740202c26"
00188 };
00189 const char *voice001ita[] = {
00190     "412bd831ec42d226fa173e0f55cb47cd"
00191 };
00192 const char *voice001spa[] = {
00193     "00cb825deca33b96719bc157a5427c40"
00194 };
00195 
00196 // EMI retail PC version
00197 
00198 const char *emi_artAll[] = {
00199     "8c7db9dab564854f2c4bab0571104780", // english patched
00200     "7c1da307c5c3eb1ba65b7c1a2e6b5bce", // german patched
00201     "f2ec4854639cd25792dd3e88fb08a1e6", // spanish patched
00202     "e0fbba846efca842553bb1a726a25dcf", // french patched
00203     "b9838ab13a672a42b1fbc8893b94ca26", // italian patched
00204 };
00205 const char *emi_artJam[] = {
00206     "e5ff286dbf7b23d1ad41dd8defe48291", // english patched
00207     "f0bcfa22f77d12e25920148d405a9615", // german patched
00208     "86ceeb03620d316f2dba86f68e40bebb", // spanish patched
00209     "6b9c6c88a0cd95f92f60db823fca4baa", // french patched
00210     "70a6fe11cc2de45f7b0650c8ea749156", // italian patched
00211     "10cb2cf22497d0007263116db68692a6", // Mac version
00212 };
00213 const char *emi_artLuc[] = {
00214     "1fcaef5755e6f6c3c30c89536022bd72", // english patched
00215     "0f6bcf8997ddd3cbdf161132103f769d", // german patched
00216     "cc956c2b6e99329bb970c9c18ed63b80", // spanish patched
00217     "1d388d0c12f99ba9af540f1b8b98e34b", // french patched
00218     "24216ef38709dc0be3771755bd274b79", // italian patched
00219 };
00220 const char *emi_artMel[] = {
00221     "66144e92a0742fdc9cc6c4f892c53e84", // english patched
00222     "ed1d2548374339775110bf5826db9f6d", // german patched
00223     "9b49161e7bb4db1dd3cb66d33940c22f", // spanish patched
00224     "33f3dc6eaf6ec50a9dbad3858dc00876", // french patched
00225     "640559d6854c3aa5b63bfad1a9afd60e", // italian patched
00226 };
00227 const char *emi_artMon[] = {
00228     "3510567bda8a4e8c5aee4c3b3bb1f98e", // english patched
00229     "5ff8b38e44fe1d3aeeb277f35f932d7b", // german patched
00230     "1d69547c39a9a85bfb1bf50c503f479d", // spanish patched
00231     "408a55615fef4282b9996aa0df8373e3", // french patched
00232     "a27c1a33652473d7caf26c069520a765", // italian patched
00233 };
00234 const char *emi_lip[] = {
00235     "57eceeae6b82028243ede6c97c334c57", // english patched
00236     "0ad24338f33f8ed9b4ab21e43f99aff0", // german patched
00237     "c0e9f1197338440b005431d2b365d287", // spanish patched
00238     "53973abc64a8ecaf963ba7e2dc6f7b42", // french patched
00239     "9b64f65a9473d11e34055137c4d978d1", // italian patched
00240 };
00241 const char *emi_local[] = {
00242     "c3b694d941c05264e8c37dc2be75ca1c", // english patched
00243 };
00244 const char *emi_patch[] = {
00245     "067100a100b3ca9283b796480aa39b52", // english patched
00246 };
00247 const char *emi_update[] = {
00248     "7c7dbd2349d49e382a2dea40bed448e0", // english
00249     "dc1376baf7c8be28854a6fa620ad2278", // german
00250     "12c5db7d07d198d1506ab8b141dd594d", // spanish
00251     "cc5ff3bb8f78a0eb4b8e0feb9cdd2e87", // french
00252     "943ad57c2873b5eb9928e6b04a5b48d4", // italian
00253     "6d2516abcdce4266ad3ae873040258ab", // portuguese
00254 };
00255 const char *emi_sfx[] = {
00256     "a5d2ded26255518b82030466c2368168", // english patched
00257 };
00258 const char *emi_voiceAll[] = {
00259     "18d3996c7de4d460b4cd4ee5897a90ae", // english patched
00260     "e65a13f2906899ab6eca2cce3c4cb514", // german patched
00261     "073ecbe5f23d17536dce591174bac593", // spanish patched
00262     "86126ac852312452ee79558a5e76d7fd", // french patched
00263     "9b6b4748e872712c267d65778a3ed2da", // italian patched
00264 };
00265 const char *emi_voiceJam[] = {
00266     "2318a4680a89b93f1f71b09e66c65c86", // english patched
00267     "3df7d4964fe33f22be67920b21d65710", // german patched
00268     "173b1b949a84746d51d51ccbf7e9856e", // spanish patched
00269     "89947e7e6064356ebfde10b644f3d612", // french patched
00270     "a50b0d5d7f3aecd8629bd5e8c0647bcc", // italian patched
00271 };
00272 const char *emi_voiceLuc[] = {
00273     "d5e4842e421bdb891e6cbf88741e9119", // english patched
00274     "60d96bb92042729037b37c0056f93267", // german patched
00275     "2e0279b8753129f6ce167cc0823a4865", // spanish patched
00276     "ab9fe90e177cd03af1e34059117cc995", // french patched
00277     "c6ed446d4448de214dbdcbb6cbcca41b", // italian patched
00278 };
00279 const char *emi_voiceMel[] = {
00280     "b8b19fc4a9438f51a99f7cf3cad9c419", // english patched
00281     "0511a19405b763e2dd9ab5b0637757ee", // german patched
00282     "15154f16af25c55d7b797174032abe8a", // spanish patched
00283     "3e678cef88037ebd6c52988744401c03", // french patched
00284     "d1af7a4f0a2bed25c43d3fd197b6df3b", // italian patched
00285 };
00286 const char *emi_voiceMon[] = {
00287     "9327a6bea951b28bac31bdb52007dc41", // english patched
00288     "e3046478916f0000a657f9ebf498e120", // german patched
00289     "eda144022632cafc45c3174abc774468", // spanish patched
00290     "ef130c43a84c9d88a3e95abc51839292", // french patched
00291     "bc4d8ab5231f620c46117205578a2642", // italian patched
00292 };
00293 
00294 // EMI retail PS2 version
00295 
00296 const char *emiPS2_artAll[] = {
00297     "7bed6dd54ea6509b708e93017c14df8d", // english
00298 };
00299 const char *emiPS2_artJam[] = {
00300     "199c713bbfc22ae941502ffd60ea794d", // english
00301 };
00302 const char *emiPS2_artLuc[] = {
00303     "7add9758294c2118621e900940e66838", // english
00304 };
00305 const char *emiPS2_artMel[] = {
00306     "514f1a684022831c178a18d13a16b6ad", // english PAL?
00307     "c4f51395440049942fae39bf6155e82c", // english NTSC
00308 };
00309 const char *emiPS2_artMon[] = {
00310     "db945bd9d5fa990447bbabf6a1e00e5b", // english
00311 };
00312 const char *emiPS2_lip[] = {
00313     "57eceeae6b82028243ede6c97c334c57", // english
00314 };
00315 const char *emiPS2_local[] = {
00316     "da26ad3a739f2fa341988901ce8dfa49", // english
00317 };
00318 /*
00319 const char *emiPS2_music1[] = {
00320     "a44753d9aaed016e6c7b398b55c97d3d", // english
00321 };
00322 const char *emiPS2_music2[] = {
00323     "204cb3d451e4bf71ae5432ab33ca3a49", // english
00324 };
00325 */
00326 const char *emiPS2_sfx[] = {
00327     "877e90e1329182caaf27d2ce4d3c9c42", // english
00328 };
00329 const char *emiPS2_voiceAll[] = {
00330     "194a1e545a348df0fe488012bc703338", // english
00331 };
00332 const char *emiPS2_voiceJam[] = {
00333     "686b45178a4b2fdb5bee2097739feea9", // english
00334 };
00335 const char *emiPS2_voiceLuc[] = {
00336     "c5e8e0ce9986385b6c1f31b68768be47", // english
00337 };
00338 const char *emiPS2_voiceMel[] = {
00339     "54663fc82520f1f02d7f3d9b29894540", // english
00340 };
00341 const char *emiPS2_voiceMon[] = {
00342     "b4a938b9c116e9370e992c8edfb00c35", // english
00343 };
00344 
00345 // EMI demo
00346 
00347 const char *emid_i9n[] = {
00348     "d913504ec3a2fe52ee02a20a154a2b17", // english patched
00349     "1cd0547b7cb26082274624b146dab3f1", // french
00350     "0e011c72372acc4baeac259b46ae30f4", // german
00351     "25523ee7687096382cbd3f3b6d30b84c", // spanish
00352 };
00353 const char *emid_lip[] = {
00354     "0a145aa7acc1a68a738c7a6f27d23283", // english patched
00355 };
00356 const char *emid_MagDemo[] = {
00357     "0a7f0e72d3fab641f0d7b0efbaa15cdc", // english patched
00358 };
00359 const char *emid_tile[] = {
00360     "23fdff61743c5621963ca04e8ca43000", // english patched
00361 };
00362 const char *emid_voice[] = {
00363     "7f9867d48b5e0af5cb3fbd8d79741f5d", // english patched
00364 };
00365 
00366 // EMI Macintosh
00367 const char *emi_installer[] = {
00368     "93a639e3221405862dc46e9706216c00", // German (EFMI Installer)
00369     "a42f8aa079a6d23c285fceba191e67a4", // English (Monkey Island 4 Installer)
00370 };
00371 
00372 bool MD5Check::_initted = false;
00373 Common::Array<MD5Check::MD5Sum> *MD5Check::_files = nullptr;
00374 int MD5Check::_iterator = -1;
00375 
00376 void MD5Check::init() {
00377     if (_initted) {
00378         return;
00379     }
00380     _initted = true;
00381     _files = new Common::Array<MD5Sum>();
00382 
00383     #define MD5SUM(filename, sums) _files->push_back(MD5Sum(filename, sums, sizeof(sums) / sizeof(const char *)));
00384 
00385     if (g_grim->getGameType() == GType_GRIM) {
00386         if (g_grim->getGameFlags() & ADGF_DEMO) {
00387             bool isDemoWithVideo = false;
00388             if (g_grim->getGameLanguage() == Common::DE_DEU) {
00389                 MD5SUM("gfdemo01.lab", gfdemo01ger)
00390                 MD5SUM("voice001.lab", voice001ger)
00391             } else if (g_grim->getGameLanguage() == Common::FR_FRA) {
00392                 MD5SUM("gfdemo01.lab", gfdemo01fra)
00393                 MD5SUM("voice001.lab", voice001fra)
00394             } else if (g_grim->getGameLanguage() == Common::IT_ITA) {
00395                 MD5SUM("gfdemo01.lab", gfdemo01ita)
00396                 MD5SUM("voice001.lab", voice001ita)
00397             } else if (g_grim->getGameLanguage() == Common::ES_ESP) {
00398                 MD5SUM("gfdemo01.lab", gfdemo01spa)
00399                 MD5SUM("voice001.lab", voice001spa)
00400             } else {
00401                 // Check which version we have
00402                 Common::File test;
00403                 if (!test.open("gfdemo01.lab")) {
00404                     isDemoWithVideo = true;
00405                     MD5SUM("gdemo001.lab", gdemo001);
00406                 } else {
00407                     MD5SUM("gfdemo01.lab", gfdemo01)
00408                     MD5SUM("voice001.lab", voice001)
00409                 }
00410             }
00411             if (!isDemoWithVideo) {
00412                 MD5SUM("sound001.lab", sound001)
00413             }
00414             MD5SUM("grimdemo.mus", grimdemo)
00415         } else {
00416             MD5SUM("gfupd101.exe", gfupd101)
00417             MD5SUM("year4mus.lab", year4mus)
00418             MD5SUM("year3mus.lab", year3mus)
00419             MD5SUM("year2mus.lab", year2mus)
00420             MD5SUM("year1mus.lab", year1mus)
00421             MD5SUM("year0mus.lab", year0mus)
00422             MD5SUM("vox0004.lab", vox0004)
00423             MD5SUM("vox0003.lab", vox0003)
00424             MD5SUM("vox0002.lab", vox0002)
00425             MD5SUM("vox0001.lab", vox0001)
00426             MD5SUM("vox0000.lab", vox0000)
00427             MD5SUM("movie04.lab", movie04)
00428             MD5SUM("movie03.lab", movie03)
00429             MD5SUM("movie02.lab", movie02)
00430             MD5SUM("movie01.lab", movie01)
00431             MD5SUM("movie00.lab", movie00)
00432             MD5SUM("data004.lab", data004)
00433             MD5SUM("data003.lab", data003)
00434             MD5SUM("data002.lab", data002)
00435             MD5SUM("data001.lab", data001)
00436             MD5SUM("data000.lab", data000)
00437             MD5SUM("credits.lab", credits)
00438             if (g_grim->getGameLanguage() != Common::EN_ANY) {
00439                 MD5SUM("local.lab", local)
00440             }
00441         }
00442     } else {
00443         if (g_grim->getGameFlags() & ADGF_DEMO) {
00444             MD5SUM("i9n.lab", emid_i9n)
00445             MD5SUM("lip.lab", emid_lip)
00446             MD5SUM("MagDemo.lab", emid_MagDemo)
00447             MD5SUM("tile.lab", emid_tile)
00448             MD5SUM("voice.lab", emid_voice)
00449         } else if (g_grim->getGamePlatform() == Common::kPlatformPS2) {
00450             MD5SUM("artAll.m4b", emiPS2_artAll)
00451             MD5SUM("artJam.m4b", emiPS2_artJam)
00452             MD5SUM("artLuc.m4b", emiPS2_artLuc)
00453             MD5SUM("artMel.m4b", emiPS2_artMel)
00454             MD5SUM("artMon.m4b", emiPS2_artMon)
00455             MD5SUM("lip.m4b", emiPS2_lip)
00456             MD5SUM("local.m4b", emiPS2_local)
00457             MD5SUM("sfx.m4b", emiPS2_sfx)
00458             MD5SUM("voiceAll.m4b", emiPS2_voiceAll)
00459             MD5SUM("voiceJam.m4b", emiPS2_voiceJam)
00460             MD5SUM("voiceLuc.m4b", emiPS2_voiceLuc)
00461             MD5SUM("voiceMel.m4b", emiPS2_voiceMel)
00462             MD5SUM("voiceMon.m4b", emiPS2_voiceMon)
00463         } else {
00464             if (g_grim->getGamePlatform() == Common::kPlatformMacintosh) {
00465                 if (g_grim->getGameLanguage() == Common::DE_DEU) {
00466                     // Known to be the correct filename for german
00467                     MD5SUM("EFMI Installer", emi_installer)
00468                 } else {
00469                     // Known to be the correct filename for english
00470                     MD5SUM("Monkey Island 4 Installer", emi_installer)
00471                 }
00472             }
00473             MD5SUM("artAll.m4b", emi_artAll)
00474             MD5SUM("artJam.m4b", emi_artJam)
00475             MD5SUM("artLuc.m4b", emi_artLuc)
00476             MD5SUM("artMel.m4b", emi_artMel)
00477             MD5SUM("artMon.m4b", emi_artMon)
00478             MD5SUM("lip.m4b", emi_lip)
00479             MD5SUM("local.m4b", emi_local)
00480             MD5SUM("sfx.m4b", emi_sfx)
00481             MD5SUM("voiceAll.m4b", emi_voiceAll)
00482             MD5SUM("voiceJam.m4b", emi_voiceJam)
00483             MD5SUM("voiceLuc.m4b", emi_voiceLuc)
00484             MD5SUM("voiceMel.m4b", emi_voiceMel)
00485             MD5SUM("voiceMon.m4b", emi_voiceMon)
00486 
00487             const char *updateFilename = g_grim->getUpdateFilename();
00488             if (updateFilename)
00489                 MD5SUM(updateFilename, emi_update)
00490         }
00491     }
00492 
00493     #undef MD5SUM
00494 }
00495 
00496 void MD5Check::clear() {
00497     delete _files;
00498     _files = nullptr;
00499     _initted = false;
00500 }
00501 
00502 bool MD5Check::checkMD5(const MD5Sum &sums, const char *md5) {
00503     for (int i = 0; i < sums.numSums; ++i) {
00504         if (strcmp(sums.sums[i], md5) == 0) {
00505             return true;
00506         }
00507     }
00508     return false;
00509 }
00510 
00511 bool MD5Check::checkFiles() {
00512     startCheckFiles();
00513     bool ok = true;
00514     while (_iterator != -1) {
00515         ok = advanceCheck() && ok;
00516     }
00517 
00518     return ok;
00519 }
00520 
00521 void MD5Check::startCheckFiles() {
00522     init();
00523     _iterator = 0;
00524 }
00525 
00526 bool MD5Check::advanceCheck(int *pos, int *total) {
00527     if (_iterator < 0) {
00528         return false;
00529     }
00530 
00531     const MD5Sum &sum = (*_files)[_iterator++];
00532     if (pos) {
00533         *pos = _iterator;
00534     }
00535     if (total) {
00536         *total = _files->size();
00537     }
00538     if ((uint32)_iterator == _files->size()) {
00539         _iterator = -1;
00540     }
00541 
00542     Common::File file;
00543     if (file.open(sum.filename)) {
00544         Common::String md5 = Common::computeStreamMD5AsString(file);
00545         if (!checkMD5(sum, md5.c_str())) {
00546             warning(_("'%s' may be corrupted. MD5: '%s'"), sum.filename, md5.c_str());
00547             GUI::displayErrorDialog(Common::String::format(_("The game data file %s may be corrupted.\nIf you are sure it is "
00548                                     "not please provide the ResidualVM team the following code, along with the file name, the language and a "
00549                                     "description of your game version (i.e. dvd-box or jewelcase):\n%s"), sum.filename, md5.c_str()).c_str());
00550             return false;
00551         }
00552     } else {
00553         warning(_("Could not open %s for checking"), sum.filename);
00554         GUI::displayErrorDialog(Common::String::format(_("Could not open the file %s for checking.\nIt may be missing or "
00555                                 "you may not have the rights to open it.\nGo to http://wiki.residualvm.org/index.php/Datafiles to see a list "
00556                                 "of the needed files."), sum.filename).c_str());
00557         return false;
00558     }
00559 
00560     return true;
00561 }
00562 
00563 }


Generated on Sat Oct 19 2019 05:01:05 for ResidualVM by doxygen 1.7.1
curved edge   curved edge