TONY: Add support for using the compressed version of the demo

This commit is contained in:
Matthew Hoops 2012-05-28 16:56:31 -04:00
parent ab45e72e67
commit 6e104f0883
4 changed files with 39 additions and 1 deletions

View file

@ -32,9 +32,12 @@
#include "tony/tony.h" #include "tony/tony.h"
#include "tony/game.h" #include "tony/game.h"
namespace Tony { namespace Tony {
enum {
GF_COMPRESSED = (1 << 0)
};
struct TonyGameDescription { struct TonyGameDescription {
ADGameDescription desc; ADGameDescription desc;
}; };
@ -51,8 +54,12 @@ bool TonyEngine::getIsDemo() const {
return _gameDescription->desc.flags & ADGF_DEMO; return _gameDescription->desc.flags & ADGF_DEMO;
} }
bool TonyEngine::isCompressed() const {
return _gameDescription->desc.flags & GF_COMPRESSED;
} }
} // End of namespace Tony
static const PlainGameDescriptor tonyGames[] = { static const PlainGameDescriptor tonyGames[] = {
{"tony", "Tony Tough and the Night of Roasted Moths"}, {"tony", "Tony Tough and the Night of Roasted Moths"},
{0, 0} {0, 0}

View file

@ -41,6 +41,23 @@ static const TonyGameDescription gameDescriptions[] = {
}, },
}, },
{
// Tony Tough English Demo (Compressed)
{
"tony",
"Demo",
AD_ENTRY1s("data1.cab", "7d8b6d308f96aee3968ad7910fb11e6d", 58660608),
Common::EN_ANY,
Common::kPlatformPC,
#ifdef TEMPORARY_DISABLED
ADGF_DEMO | GF_COMPRESSED,
#else
ADGF_NO_FLAGS | GF_COMPRESSED,
#endif
GUIO1(GUIO_NONE)
},
},
{ AD_TABLE_END_MARKER } { AD_TABLE_END_MARKER }
}; };

View file

@ -26,6 +26,7 @@
#include "common/debug-channels.h" #include "common/debug-channels.h"
#include "common/events.h" #include "common/events.h"
#include "common/file.h" #include "common/file.h"
#include "common/installshield_cab.h"
#include "tony/tony.h" #include "tony/tony.h"
#include "tony/custom.h" #include "tony/custom.h"
#include "tony/debugger.h" #include "tony/debugger.h"
@ -84,6 +85,18 @@ Common::Error TonyEngine::run() {
* Initialise the game * Initialise the game
*/ */
Common::ErrorCode TonyEngine::Init() { Common::ErrorCode TonyEngine::Init() {
if (isCompressed()) {
Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember("data1.cab");
if (!stream)
error("Failed to open data1.cab");
Common::Archive *cabinet = Common::makeInstallShieldArchive(stream);
if (!cabinet)
error("Failed to parse data1.cab");
SearchMan.add("data1.cab", cabinet);
}
m_hEndOfFrame = CoroScheduler.createEvent(false, false); m_hEndOfFrame = CoroScheduler.createEvent(false, false);
m_bPaused = false; m_bPaused = false;

View file

@ -143,6 +143,7 @@ public:
Common::Language getLanguage() const; Common::Language getLanguage() const;
uint16 getVersion() const; uint16 getVersion() const;
bool getIsDemo() const; bool getIsDemo() const;
bool isCompressed() const;
RMGfxEngine *GetEngine() { RMGfxEngine *GetEngine() {
return &_theEngine; return &_theEngine;
} }