diff options
author | Johannes Schickel | 2006-07-15 20:30:36 +0000 |
---|---|---|
committer | Johannes Schickel | 2006-07-15 20:30:36 +0000 |
commit | 04503d462d43d49dd9504785477364ca18eecdb7 (patch) | |
tree | 5c0552c9fcdbd8a00830955578c1d694746454f3 /engines | |
parent | a8e3e929e83d2a963233e13e9656e6e6a7213cd8 (diff) | |
download | scummvm-rg350-04503d462d43d49dd9504785477364ca18eecdb7.tar.gz scummvm-rg350-04503d462d43d49dd9504785477364ca18eecdb7.tar.bz2 scummvm-rg350-04503d462d43d49dd9504785477364ca18eecdb7.zip |
Use the FS Api to load all .PAK and .APK files. (I just made a few quick tests, but before this should be integrated to branch-0-9-0 there should be a test for it on *every* platform, since I'm not quite sure if FilesystemNode::displayName is useable for this...)
svn-id: r23511
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/resource.cpp | 120 |
1 files changed, 18 insertions, 102 deletions
diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp index 02be4f31ff..5281f015c3 100644 --- a/engines/kyra/resource.cpp +++ b/engines/kyra/resource.cpp @@ -21,8 +21,10 @@ */ #include "common/stdafx.h" +#include "common/config-manager.h" #include "common/endian.h" #include "common/file.h" +#include "common/fs.h" #include "gui/message.h" @@ -35,103 +37,6 @@ namespace Kyra { Resource::Resource(KyraEngine *engine) { _engine = engine; - // prefetches all PAK Files - - // ugly a hardcoded list - // TODO: use the FS Backend to get all .PAK Files and load them - // or any other thing to get all files - static const char *kyra1Filelist[] = { - "A_E.PAK", "DAT.PAK", "F_L.PAK", "MAP_5.PAK", "MSC.PAK", "M_S.PAK", - "S_Z.PAK", "WSA1.PAK", "WSA2.PAK", "WSA3.PAK", "WSA4.PAK", "WSA5.PAK", - "WSA6.PAK", 0 - }; - - /*static const char *kyra1AmigaFilelist[] = { - "alchemy.pak", "chasm.pak", "finale1.pak", "gen_cav.pak", "mix.pak", "spring.pak", - "algae.pak", "cliff.pak", "finale2.pak", "genhall.pak", "mooncav.pak", "square.pak", - "altar.pak", "darms.pak", "fnorth.pak", "glade.pak", "ncliffb.pak", "startup.pak", - "arch.pak", "dead.pak", "foresta.pak", "grave.pak", "ncliff.pak", "stump.pak", - "balcony.pak", "dnstair.pak", "forestb.pak", "grthall.pak", "nwclifb.pak", "temple.pak", - "belroom.pak", "dragon.pak", "forestc.pak", "healer.pak", "nwcliff.pak", "trunk.pak", - "bonkbg.pak", "drgnwsa.pak", "fountn.pak", "herman.pak", "oaks.pak", "upstair.pak", - "bridge.pak", "edgeb.pak", "foyer.pak", "intro1.pak", "plateau.pak", "well.pak", - "brins.pak", "edge.pak", "frstawsa.pak", "kitchen.pak", "pltcave.pak", "willow.pak", - "broken.pak", "emcav.pak", "fsouthb.pak", "kyragem.pak", "potion.pak", "wise.pak", - "burn.pak", "enter.pak", "fsouth.pak", "lagoon.pak", "potwsa.pak", "xedgeb.pak", - "castle.pak", "extheal.pak", "fwststh.pak", "landing.pak", "ruby.pak", "xedgec.pak", - "catacom.pak", "extpot.pak", "gatecv.pak", "lava.pak", "sickwil.pak", "xedge.pak", - "caveb.pak", "extspel.pak", "gemcut.pak", "lephole.pak", "song.pak", "zrock.pak", - "cave.pak", "falls.pak", "gem.pak", "library.pak", "sorrow.pak", - "cgate.pak", "fgowest.pak", "gencavb.pak", "misc.pak", "spell.pak", 0 - };*/ - - static const char *kyra1CDFilelist[] = { - "ALTAR.APK", "BELROOM.APK", "BONKBG.APK", "BROKEN.APK", "CASTLE.APK", "CAVE.APK", "CGATE.APK", - "DEAD.APK", "DNSTAIR.APK", "DRAGON1.APK", "DRAGON2.APK", "EXTPOT.APK", "FORESTA.APK", "FORESTB.APK", - "FOUNTN.APK", "FOYER.APK", "GATECV.APK", "GEM.APK", "GEMCUT.APK", "GENHALL.APK", "GLADE.APK", - "GRAVE.APK", "HEALER.APK", "LAGOON.APK", "LANDING.APK", "LAVA.APK", "LEPHOLE.APK", "LIBRARY.APK", - "MIX.APK", "MOONCAV.APK", "POTION.APK", "SONG.APK", "SORROW.APK", "SPELL.APK", "STUMP.APK", - "TEMPLE.APK", "TRUNK.APK", "WILLOW.APK", "XEDGE.APK", - - "ADL.PAK", "BRINS.PAK", "CLIFF.PAK", "ENTER.PAK", "FORESTA.PAK", "GEM.PAK", "INTRO1.PAK", - "LEPHOLE.PAK", "OAKS.PAK", "SPELL.PAK", "WILLOW.PAK", "ALCHEMY.PAK", "BROKEN.PAK", "COL.PAK", - "EXTHEAL.PAK", "FORESTB.PAK", "GEMCUT.PAK", "INTRO2.PAK", "LIBRARY.PAK", "PLATEAU.PAK", "SPRING.PAK", - "WISE.PAK", "ALGAE.PAK", "BURN.PAK", "DARMS.PAK", "EXTPOT.PAK", "FORESTC.PAK", "GENCAVB.PAK", - "INTRO3.PAK", "MISC.PAK", "PLTCAVE.PAK", "SQUARE.PAK", "XEDGE.PAK", "ALTAR.PAK", "CASTLE.PAK", - "DEAD.PAK", "EXTSPEL.PAK", "FOUNTN.PAK", "GENHALL.PAK", "INTRO4.PAK", "MIX.PAK", "POTION.PAK", - "STARTUP.PAK", "XEDGEB.PAK", "ARCH.PAK", "CATACOM.PAK", "DNSTAIR.PAK", "FALLS.PAK", "FOYER.PAK", - "GEN_CAV.PAK", "KITCHEN.PAK", "MOONCAV.PAK", "RUBY.PAK", "STUMP.PAK", "XEDGEC.PAK", "BALCONY.PAK", - "CAVE.PAK", "DRAGON.PAK", "FESTSTH.PAK", "FSOUTH.PAK", "GLADE.PAK", "KYRAGEM.PAK", "NCLIFF.PAK", - "SICKWIL.PAK", "TEMPLE.PAK", "XMI.PAK", "BELROOM.PAK", "CAVEB.PAK", "EDGE.PAK", "FGOWEST.PAK", - "FSOUTHB.PAK", "GRAVE.PAK", "LAGOON.PAK", "NCLIFFB.PAK", "SND.PAK", "TRUNK.PAK", "ZROCK.PAK", - "BONKBG.PAK", "CGATE.PAK", "EDGEB.PAK", "FINALE.PAK", "FWSTSTH.PAK", "GRTHALL.PAK", "LANDING.PAK", - "NWCLIFB.PAK", "SONG.PAK", "UPSTAIR.PAK", "BRIDGE.PAK", "CHASM.PAK", "EMCAV.PAK", "FNORTH.PAK", - "GATECV.PAK", "HEALER.PAK", "LAVA.PAK", "NWCLIFF.PAK", "SORROW.PAK", "WELL.PAK", - - "CHAPTER1.VRM", 0 - }; - - static const char *kyra2CDFilelist[] = { - "ALLEY.PAK", "COST3_SH.PAK", "DINOD.PAK", "GARDEN.PAK", "INJAIL2.PAK", "MISC_EMC.PAK", "PHONE_B.PAK", - "STATION.PAK", "VOLCANO.PAK", "VOLC_L.PAK", "ALTAR.PAK", "COST4_SH.PAK", "DOCK.PAK", "GEARS.PAK", - "INSHOP.PAK", "MYSTRM.PAK", "PHONE_C.PAK", "STREET.PAK", "VOLC_A.PAK", "VOLC_M.PAK", "ANCHOR.PAK", - "COST5_SH.PAK", "DOOR.PAK", "GEARS2.PAK", "INSTORE.PAK", "NEST.PAK", "PHONE_D.PAK", "SULFUR.PAK", - "VOLC_B.PAK", "VOLC_N.PAK", "AUDIO.PAK", "COST6_SH.PAK", "DRIVERS.PAK", "GEARS3.PAK", "INTRODRV.PAK", - "ONBOAT.PAK", "QUICK.PAK", "TALKENG.PAK", "VOLC_C.PAK", "VOLC_O.PAK", "BRIDGE.PAK", "COST7_SH.PAK", - "FALL.PAK", "GNARL.PAK", "INTROGEN.PAK", "OTHER.PAK", "RAINA.PAK", "TALKFRE.PAK", "VOLC_D.PAK", - "VOLC_P.PAK", "CAULDRON.PAK", "COST8_SH.PAK", "FATE.PAK", "HANOI.PAK", "INTROTLK.PAK", "OUTCAVE.PAK", - "RAINB.PAK", "TALKGER.PAK", "VOLC_E.PAK", "WHARF.PAK", "CELLAR.PAK", "COST9_SH.PAK", "FERRY.PAK", - "HOLE.PAK", "INTROVOC.PAK", "OUTCAVE2.PAK", "RAT.PAK", "TAVERN.PAK", "VOLC_F.PAK", "WHEEL.PAK", - "CLEARNG.PAK", "CRICKET.PAK", "FIGHT.PAK", "INCAVE.PAK", "ISLE.PAK", "OUTFARM.PAK", "ROAD.PAK", - "TIMBER.PAK", "VOLC_G.PAK", "CLIFF.PAK", "CROC.PAK", "FISHER.PAK", "INGATE.PAK", "JUNGLE.PAK", - "OUTGATE.PAK", "ROPE.PAK", "TRAM.PAK", "VOLC_H.PAK", "CLOSE.PAK", "DINOA.PAK", "FLOAT.PAK", "INHERB.PAK", - "MARKHME.PAK", "OUTHERB.PAK", "SCORCH.PAK", "TREE.PAK", "VOLC_I.PAK", "COST1_SH.PAK", "DINOB.PAK", - "FLYTRAP.PAK", "INHOME.PAK", "MEADOW.PAK", "OUTHOME.PAK", "SKULL.PAK", "TREE2.PAK", "VOLC_J.PAK", - "COST2_SH.PAK", "DINOC.PAK", "FOOT.PAK", "INJAIL.PAK", "MISC_CPS.PAK", "PHONE_A.PAK", "SKY.PAK", "VOC.PAK", - "VOLC_K.PAK", 0 - }; - - static const char *kyra3Filelist[] = { - // enough for now - "MISC_EMC.PAK", "MISC_CPS.PAK", "OTHER.PAK", "ONETIME.PAK", 0 - }; - - const char **usedFilelist = 0; - - if (_engine->game() == GI_KYRA1) { - /*if (_engine->features() & GF_AMIGA) - usedFilelist = kyra1AmigaFilelist; - else*/ if (_engine->features() & GF_FLOPPY) - usedFilelist = kyra1Filelist; - else if (_engine->features() & GF_TALKIE) - usedFilelist = kyra1CDFilelist; - } else if (_engine->game() == GI_KYRA2) { - // TODO: add kyra2 floppy file list - usedFilelist = kyra2CDFilelist; - } else if (_engine->game() == GI_KYRA3) { - usedFilelist = kyra3Filelist; - } - if (_engine->game() == GI_KYRA1) { // we're loading KYRA.DAT here too (but just for Kyrandia 1) if (!loadPakFile("KYRA.DAT")) { @@ -139,6 +44,11 @@ Resource::Resource(KyraEngine *engine) { errorMsg.runModal(); error("couldn't open Kyrandia resource file ('KYRA.DAT') make sure you got one file for your version"); } + + // only VRM file we need in the *whole* game for kyra1 + if (_engine->features() & GF_TALKIE) { + assert(loadPakFile("CHAPTER1.VRM")); + } } else if (_engine->game() == GI_KYRA3) { // load the installation package file for kyra3 INSFile *insFile = new INSFile("WESTWOOD.001"); @@ -151,12 +61,18 @@ Resource::Resource(KyraEngine *engine) { // We only need kyra.dat for the demo. if (_engine->features() & GF_DEMO) return; - - if (!usedFilelist) - error("no filelist found for this game"); + + FSList fslist; + FilesystemNode dir(ConfMan.get("path")); + + if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) { + error("invalid game path '%s'", dir.path().c_str()); + } - for (uint32 tmp = 0; usedFilelist[tmp]; ++tmp) { - loadPakFile(usedFilelist[tmp]); + for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { + if (file->displayName().hasSuffix("PAK") || file->displayName().hasSuffix("APK")) { + assert(loadPakFile(file->displayName())); + } } } |