2006-05-03 14:24:48 +00:00
/* ScummVM - Scumm Interpreter
* Copyright ( C ) 2006 The ScummVM project
*
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation ; either version 2
* of the License , or ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software
* Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 , USA .
*
2006-05-17 20:25:08 +00:00
* $ URL $
* $ Id $
2006-05-03 14:24:48 +00:00
*/
# include "kyra/kyra.h"
2007-04-15 13:39:08 +00:00
# include "kyra/kyra_v2.h"
# include "kyra/kyra_v3.h"
2006-05-03 14:24:48 +00:00
# include "common/config-manager.h"
2006-11-09 14:38:16 +00:00
# include "common/advancedDetector.h"
2006-05-03 14:24:48 +00:00
# include "base/plugins.h"
2006-11-09 14:38:16 +00:00
struct KYRAGameDescription {
2006-12-19 22:43:15 +00:00
Common : : ADGameDescription desc ;
2006-11-09 14:38:16 +00:00
2007-01-25 21:16:57 +00:00
Kyra : : GameFlags flags ;
2006-05-03 14:24:48 +00:00
} ;
2006-11-09 14:38:16 +00:00
namespace {
2007-02-12 18:01:51 +00:00
# define FLAGS(x, y, z, a, id) { Common::UNK_LANG, Common::kPlatformUnknown, x, y, z, a, id }
2006-11-09 14:38:16 +00:00
2007-02-12 18:01:51 +00:00
# define KYRA1_FLOPPY_FLAGS FLAGS(false, false, false, false, Kyra::GI_KYRA1)
2007-03-12 20:43:56 +00:00
# define KYRA1_AMIGA_FLAGS FLAGS(false, false, false, false, Kyra::GI_KYRA1)
2007-02-12 18:01:51 +00:00
# define KYRA1_TOWNS_FLAGS FLAGS(false, true, false, false, Kyra::GI_KYRA1)
# define KYRA1_TOWNS_SJIS_FLAGS FLAGS(false, true, false, true, Kyra::GI_KYRA1)
# define KYRA1_CD_FLAGS FLAGS(false, true, true, false, Kyra::GI_KYRA1)
# define KYRA1_DEMO_FLAGS FLAGS(true, false, false, false, Kyra::GI_KYRA1)
2006-11-09 14:38:16 +00:00
2007-02-24 09:55:37 +00:00
# define KYRA2_CD_FLAGS FLAGS(false, false, false, false, Kyra::GI_KYRA2)
# define KYRA2_DEMO_FLAGS FLAGS(true, false, false, false, Kyra::GI_KYRA2)
2006-11-09 14:38:16 +00:00
2007-02-12 18:01:51 +00:00
# define KYRA3_CD_FLAGS FLAGS(false, false, true, false, Kyra::GI_KYRA3)
2006-11-09 14:38:16 +00:00
2007-01-26 10:39:30 +00:00
const KYRAGameDescription adGameDescs [ ] = {
2007-02-13 13:42:28 +00:00
{ { " kyra1 " , 0 , AD_ENTRY1 ( " GEMCUT.EMC " , " 3c244298395520bb62b5edfe41688879 " ) , Common : : EN_ANY , Common : : kPlatformPC , Common : : ADGF_NO_FLAGS } , KYRA1_FLOPPY_FLAGS } ,
{ { " kyra1 " , 0 , AD_ENTRY1 ( " GEMCUT.EMC " , " 796e44863dd22fa635b042df1bf16673 " ) , Common : : EN_ANY , Common : : kPlatformPC , Common : : ADGF_NO_FLAGS } , KYRA1_FLOPPY_FLAGS } ,
{ { " kyra1 " , 0 , AD_ENTRY1 ( " GEMCUT.EMC " , " abf8eb360e79a6c2a837751fbd4d3d24 " ) , Common : : FR_FRA , Common : : kPlatformPC , Common : : ADGF_NO_FLAGS } , KYRA1_FLOPPY_FLAGS } ,
{ { " kyra1 " , 0 , AD_ENTRY1 ( " GEMCUT.EMC " , " 6018e1dfeaca7fe83f8d0b00eb0dd049 " ) , Common : : DE_DEU , Common : : kPlatformPC , Common : : ADGF_NO_FLAGS } , KYRA1_FLOPPY_FLAGS } ,
{ { " kyra1 " , 0 , AD_ENTRY1 ( " GEMCUT.EMC " , " f0b276781f47c130f423ec9679fe9ed9 " ) , Common : : DE_DEU , Common : : kPlatformPC , Common : : ADGF_NO_FLAGS } , KYRA1_FLOPPY_FLAGS } , // from Arne.F
{ { " kyra1 " , 0 , AD_ENTRY1 ( " GEMCUT.EMC " , " 8909b41596913b3f5deaf3c9f1017b01 " ) , Common : : ES_ESP , Common : : kPlatformPC , Common : : ADGF_NO_FLAGS } , KYRA1_FLOPPY_FLAGS } , // from VooD
{ { " kyra1 " , 0 , AD_ENTRY1 ( " GEMCUT.EMC " , " 747861d2a9c643c59fdab570df5b9093 " ) , Common : : ES_ESP , Common : : kPlatformPC , Common : : ADGF_NO_FLAGS } , KYRA1_FLOPPY_FLAGS } , // floppy 1.8 from clemmy
{ { " kyra1 " , 0 , AD_ENTRY1 ( " GEMCUT.EMC " , " ef08c8c237ee1473fd52578303fc36df " ) , Common : : IT_ITA , Common : : kPlatformPC , Common : : ADGF_NO_FLAGS } , KYRA1_FLOPPY_FLAGS } , // from gourry
2007-02-13 01:28:18 +00:00
2007-03-12 20:43:56 +00:00
{ { " kyra1 " , 0 , AD_ENTRY1 ( " GEMCUT.PAK " , " 2bd1da653eaefd691e050e4a9eb68a64 " ) , Common : : EN_ANY , Common : : kPlatformAmiga , Common : : ADGF_NO_FLAGS } , KYRA1_AMIGA_FLAGS } ,
2007-03-07 20:31:19 +00:00
2007-02-13 13:42:28 +00:00
{ { " kyra1 " , 0 , AD_ENTRY1 ( " TWMUSIC.PAK " , " e53bca3a3e3fb49107d59463ec387a59 " ) , Common : : EN_ANY , Common : : kPlatformFMTowns , Common : : ADGF_NO_FLAGS } , KYRA1_TOWNS_FLAGS } ,
{ { " kyra1 " , 0 , AD_ENTRY1 ( " TWMUSIC.PAK " , " e53bca3a3e3fb49107d59463ec387a59 " ) , Common : : JA_JPN , Common : : kPlatformFMTowns , Common : : ADGF_NO_FLAGS } , KYRA1_TOWNS_SJIS_FLAGS } ,
2007-02-13 01:28:18 +00:00
2007-02-13 13:42:28 +00:00
{ { " kyra1 " , " CD " , AD_ENTRY1 ( " GEMCUT.PAK " , " fac399fe62f98671e56a005c5e94e39f " ) , Common : : EN_ANY , Common : : kPlatformPC , Common : : ADGF_NO_FLAGS } , KYRA1_CD_FLAGS } ,
{ { " kyra1 " , " CD " , AD_ENTRY1 ( " GEMCUT.PAK " , " 230f54e6afc007ab4117159181a1c722 " ) , Common : : DE_DEU , Common : : kPlatformPC , Common : : ADGF_NO_FLAGS } , KYRA1_CD_FLAGS } ,
{ { " kyra1 " , " CD " , AD_ENTRY1 ( " GEMCUT.PAK " , " b037c41768b652a040360ffa3556fd2a " ) , Common : : FR_FRA , Common : : kPlatformPC , Common : : ADGF_NO_FLAGS } , KYRA1_CD_FLAGS } ,
2007-02-13 01:28:18 +00:00
2007-02-13 13:42:28 +00:00
{ { " kyra1 " , " Demo " , AD_ENTRY1 ( " DEMO1.WSA " , " fb722947d94897512b13b50cc84fd648 " ) , Common : : EN_ANY , Common : : kPlatformPC , Common : : ADGF_DEMO } , KYRA1_DEMO_FLAGS } ,
2007-02-13 01:28:18 +00:00
2007-04-15 13:39:08 +00:00
{ { " kyra2 " , 0 , AD_ENTRY1 ( " FATE.PAK " , " 28cbad1c5bf06b2d3825ae57d760d032 " ) , Common : : EN_ANY , Common : : kPlatformPC , Common : : ADGF_NO_FLAGS } , KYRA2_CD_FLAGS } , // CD version
{ { " kyra2 " , 0 , AD_ENTRY1 ( " FATE.PAK " , " 28cbad1c5bf06b2d3825ae57d760d032 " ) , Common : : DE_DEU , Common : : kPlatformPC , Common : : ADGF_NO_FLAGS } , KYRA2_CD_FLAGS } , // CD version
{ { " kyra2 " , 0 , AD_ENTRY1 ( " FATE.PAK " , " 28cbad1c5bf06b2d3825ae57d760d032 " ) , Common : : FR_FRA , Common : : kPlatformPC , Common : : ADGF_NO_FLAGS } , KYRA2_CD_FLAGS } , // CD version
2007-02-24 09:55:37 +00:00
2007-04-15 13:39:08 +00:00
{ { " kyra2 " , " Demo " , AD_ENTRY1 ( " GENERAL.PAK " , " 35825783e5b60755fd520360079f9c15 " ) , Common : : EN_ANY , Common : : kPlatformPC , Common : : ADGF_DEMO } , KYRA2_DEMO_FLAGS } ,
2007-02-13 01:28:18 +00:00
2007-02-13 13:42:28 +00:00
{ { " kyra3 " , 0 , AD_ENTRY1 ( " ONETIME.PAK " , " 3833ff312757b8e6147f464cca0a6587 " ) , Common : : EN_ANY , Common : : kPlatformPC , Common : : ADGF_NO_FLAGS } , KYRA3_CD_FLAGS } ,
{ { " kyra3 " , 0 , AD_ENTRY1 ( " ONETIME.PAK " , " 3833ff312757b8e6147f464cca0a6587 " ) , Common : : DE_DEU , Common : : kPlatformPC , Common : : ADGF_NO_FLAGS } , KYRA3_CD_FLAGS } ,
{ { " kyra3 " , 0 , AD_ENTRY1 ( " ONETIME.PAK " , " 3833ff312757b8e6147f464cca0a6587 " ) , Common : : FR_FRA , Common : : kPlatformPC , Common : : ADGF_NO_FLAGS } , KYRA3_CD_FLAGS } ,
2007-02-13 01:28:18 +00:00
{ AD_TABLE_END_MARKER , FLAGS ( 0 , 0 , 0 , 0 , 0 ) }
2006-05-03 14:24:48 +00:00
} ;
2006-11-09 14:38:16 +00:00
const PlainGameDescriptor gameList [ ] = {
{ " kyra1 " , " The Legend of Kyrandia " } ,
{ " kyra2 " , " The Legend of Kyrandia: The Hand of Fate " } ,
{ " kyra3 " , " The Legend of Kyrandia: Malcolm's Revenge " } ,
{ 0 , 0 }
} ;
2007-01-26 10:39:30 +00:00
const Common : : ADParams detectionParams = {
2007-01-24 22:24:52 +00:00
// Pointer to ADGameDescription or its superset structure
( const byte * ) adGameDescs ,
// Size of that superset structure
sizeof ( KYRAGameDescription ) ,
// Number of bytes to compute MD5 sum for
1024 * 1024 ,
// List of all engine targets
gameList ,
// Structure for autoupgrading obsolete targets
2007-01-28 07:31:26 +00:00
0 ,
// Name of single gameid (optional)
0 ,
2007-02-04 03:10:27 +00:00
// List of files for file-based fallback detection (optional)
0 ,
2007-02-13 23:37:44 +00:00
// Fallback callback
0 ,
2007-01-28 07:31:26 +00:00
// Flags
2007-01-24 22:24:52 +00:00
0
} ;
2006-05-03 14:24:48 +00:00
} // End of anonymous namespace
2006-11-12 03:23:29 +00:00
GameList Engine_KYRA_gameIDList ( ) {
2006-12-19 22:43:15 +00:00
return GameList ( gameList ) ;
2006-11-12 03:23:29 +00:00
}
2006-05-03 14:24:48 +00:00
2006-11-12 03:23:29 +00:00
GameDescriptor Engine_KYRA_findGameID ( const char * gameid ) {
2007-01-25 21:16:57 +00:00
return Common : : AdvancedDetector : : findGameID ( gameid , detectionParams ) ;
2006-11-12 03:23:29 +00:00
}
2006-05-03 14:24:48 +00:00
2007-01-20 21:27:57 +00:00
GameList Engine_KYRA_detectGames ( const FSList & fslist ) {
2007-01-25 21:16:57 +00:00
return Common : : AdvancedDetector : : detectAllGames ( fslist , detectionParams ) ;
2006-05-03 14:24:48 +00:00
}
PluginError Engine_KYRA_create ( OSystem * syst , Engine * * engine ) {
assert ( engine ) ;
const char * gameid = ConfMan . get ( " gameid " ) . c_str ( ) ;
2007-01-25 00:32:49 +00:00
2007-02-13 23:37:44 +00:00
const KYRAGameDescription * gd = ( const KYRAGameDescription * ) Common : : AdvancedDetector : : detectBestMatchingGame ( detectionParams ) ;
if ( gd = = 0 ) {
2007-01-25 00:07:48 +00:00
// maybe add non md5 based detection again?
2006-11-09 14:38:16 +00:00
return kNoGameDataFoundError ;
2006-05-03 14:24:48 +00:00
}
2007-02-13 23:37:44 +00:00
Kyra : : GameFlags flags = gd - > flags ;
2007-02-03 22:42:45 +00:00
2007-02-13 23:37:44 +00:00
flags . lang = gd - > desc . language ;
flags . platform = gd - > desc . platform ;
2007-01-25 11:32:50 +00:00
2007-01-25 21:16:57 +00:00
Common : : Platform platform = Common : : parsePlatform ( ConfMan . get ( " platform " ) ) ;
2007-04-15 16:41:20 +00:00
if ( platform ! = Common : : kPlatformUnknown )
2007-01-25 11:26:13 +00:00
flags . platform = platform ;
2007-01-25 21:16:57 +00:00
if ( flags . lang = = Common : : UNK_LANG ) {
Common : : Language lang = Common : : parseLanguage ( ConfMan . get ( " language " ) ) ;
2007-04-15 16:41:20 +00:00
if ( lang ! = Common : : UNK_LANG )
2007-01-25 11:26:13 +00:00
flags . lang = lang ;
2007-04-15 16:41:20 +00:00
else
2007-01-25 21:16:57 +00:00
flags . lang = Common : : EN_ANY ;
2007-01-25 11:26:13 +00:00
}
2007-01-25 00:07:48 +00:00
2006-11-09 14:38:16 +00:00
if ( ! scumm_stricmp ( " kyra1 " , gameid ) ) {
2007-01-25 21:16:57 +00:00
* engine = new Kyra : : KyraEngine_v1 ( syst , flags ) ;
2006-11-09 14:38:16 +00:00
} else if ( ! scumm_stricmp ( " kyra2 " , gameid ) ) {
2007-01-25 21:16:57 +00:00
* engine = new Kyra : : KyraEngine_v2 ( syst , flags ) ;
2006-11-09 14:38:16 +00:00
} else if ( ! scumm_stricmp ( " kyra3 " , gameid ) ) {
2007-01-25 21:16:57 +00:00
* engine = new Kyra : : KyraEngine_v3 ( syst , flags ) ;
2006-11-09 14:38:16 +00:00
} else
2007-01-25 00:32:49 +00:00
error ( " Kyra engine created with invalid gameid " ) ;
2006-09-18 17:30:51 +00:00
2006-11-09 14:38:16 +00:00
return kNoError ;
2006-05-03 14:24:48 +00:00
}
2006-11-09 14:38:16 +00:00
REGISTER_PLUGIN ( KYRA , " Legend of Kyrandia Engine " , " The Legend of Kyrandia (C) Westwood Studios " ) ;
2007-04-15 16:41:20 +00:00