aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/glk.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2018-11-18 22:32:27 -0800
committerPaul Gilbert2018-12-08 19:05:59 -0800
commit525c09ef38c00d71cf3037d61d221783d3b48cf3 (patch)
treefd0a4bea7984bef5e38d329cd3eddf1ee31da693 /engines/glk/glk.cpp
parentf7cb4170847373a84268479bd7487c20c58d5639 (diff)
downloadscummvm-rg350-525c09ef38c00d71cf3037d61d221783d3b48cf3.tar.gz
scummvm-rg350-525c09ef38c00d71cf3037d61d221783d3b48cf3.tar.bz2
scummvm-rg350-525c09ef38c00d71cf3037d61d221783d3b48cf3.zip
GLK: In progress transforming Blorb code to be a Common::Archive
Diffstat (limited to 'engines/glk/glk.cpp')
-rw-r--r--engines/glk/glk.cpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/engines/glk/glk.cpp b/engines/glk/glk.cpp
index 0e44f04e51..c2a8264750 100644
--- a/engines/glk/glk.cpp
+++ b/engines/glk/glk.cpp
@@ -29,6 +29,7 @@
#include "graphics/scaler.h"
#include "graphics/thumbnail.h"
#include "glk/glk.h"
+#include "glk/blorb.h"
#include "glk/conf.h"
#include "glk/events.h"
#include "glk/picture.h"
@@ -42,14 +43,16 @@ namespace Glk {
GlkEngine *g_vm;
GlkEngine::GlkEngine(OSystem *syst, const GlkGameDescription &gameDesc) :
- _gameDescription(gameDesc), Engine(syst), _random("Glk"), _clipboard(nullptr),
- _conf(nullptr), _events(nullptr), _pictures(nullptr), _screen(nullptr),
- _selection(nullptr), _windows(nullptr), _copySelect(false), _terminated(false),
- gli_unregister_obj(nullptr), gli_register_arr(nullptr), gli_unregister_arr(nullptr) {
+ _gameDescription(gameDesc), Engine(syst), _random("Glk"), _blorb(nullptr),
+ _clipboard(nullptr), _conf(nullptr), _events(nullptr), _pictures(nullptr),
+ _screen(nullptr), _selection(nullptr), _windows(nullptr), _copySelect(false),
+ _terminated(false), gli_unregister_obj(nullptr), gli_register_arr(nullptr),
+ gli_unregister_arr(nullptr) {
g_vm = this;
}
GlkEngine::~GlkEngine() {
+ delete _blorb;
delete _clipboard;
delete _conf;
delete _events;
@@ -96,11 +99,26 @@ void GlkEngine::initGraphicsMode() {
}
Common::Error GlkEngine::run() {
+ Common::File f;
+ Common::String filename = getFilename();
+ if (!Common::File::exists(filename))
+ return Common::kNoGameDataFoundError;
+
initialize();
- Common::File f;
- if (f.open(getFilename()))
- runGame(&f);
+ if (filename.hasSuffixIgnoreCase(".blorb") || filename.hasSuffixIgnoreCase(".zblorb")) {
+ // Blorb archive
+ _blorb = new Blorb(filename, getInterpreterType());
+ SearchMan.add("blorb", _blorb, 99, false);
+
+ if (!f.open("EXEC", *_blorb))
+ return Common::kNoGameDataFoundError;
+ } else {
+ if (!f.open(filename))
+ return Common::kNoGameDataFoundError;
+ }
+
+ runGame(&f);
return Common::kNoError;
}