aboutsummaryrefslogtreecommitdiff
path: root/engines/glk
diff options
context:
space:
mode:
authorPaul Gilbert2019-09-26 18:15:38 -0700
committerPaul Gilbert2019-09-26 18:15:38 -0700
commit6175aac187ad76a6e6b97361ad2df5388e691009 (patch)
tree2dc2ff4b807f050d5ec67cec89a6a199ed7cfe9d /engines/glk
parent70942301411a5f998bedde85f261a0b3113fc467 (diff)
downloadscummvm-rg350-6175aac187ad76a6e6b97361ad2df5388e691009.tar.gz
scummvm-rg350-6175aac187ad76a6e6b97361ad2df5388e691009.tar.bz2
scummvm-rg350-6175aac187ad76a6e6b97361ad2df5388e691009.zip
GLK: ADRIFT: ADRIFT 5 games aren't supported
Diffstat (limited to 'engines/glk')
-rw-r--r--engines/glk/adrift/scprotos.h3
-rw-r--r--engines/glk/adrift/sctaffil.cpp47
-rw-r--r--engines/glk/adrift/scutils.cpp2
3 files changed, 30 insertions, 22 deletions
diff --git a/engines/glk/adrift/scprotos.h b/engines/glk/adrift/scprotos.h
index 39fba6bbe4..6fd383cba8 100644
--- a/engines/glk/adrift/scprotos.h
+++ b/engines/glk/adrift/scprotos.h
@@ -97,10 +97,11 @@ extern sc_uint sc_hash(const sc_char *string);
/* TAF file reader/decompressor enumerations, opaque typedef and functions. */
enum {
TAF_VERSION_NONE = 0,
+ TAF_VERSION_SAVE = 999,
TAF_VERSION_500 = 500,
TAF_VERSION_400 = 400,
TAF_VERSION_390 = 390,
- TAF_VERSION_380 = 380
+ TAF_VERSION_380 = 380,
};
typedef struct sc_taf_s *sc_tafref_t;
diff --git a/engines/glk/adrift/sctaffil.cpp b/engines/glk/adrift/sctaffil.cpp
index 0cda5ec20b..e5c94a58ce 100644
--- a/engines/glk/adrift/sctaffil.cpp
+++ b/engines/glk/adrift/sctaffil.cpp
@@ -50,22 +50,22 @@ static const sc_char NEWLINE = '\n';
static const sc_char CARRIAGE_RETURN = '\r';
static const sc_char NUL = '\0';
-/* Version 4.0, version 3.9, and version 3.8 TAF file signatures. */
-static const sc_byte
-V400_SIGNATURE[VERSION_HEADER_SIZE] = {0x3c, 0x42, 0x3f, 0xc9, 0x6a, 0x87,
- 0xc2, 0xcf, 0x93, 0x45, 0x3e, 0x61,
- 0x39, 0xfa
- };
-static const sc_byte
-V390_SIGNATURE[VERSION_HEADER_SIZE] = {0x3c, 0x42, 0x3f, 0xc9, 0x6a, 0x87,
- 0xc2, 0xcf, 0x94, 0x45, 0x37, 0x61,
- 0x39, 0xfa
- };
-static const sc_byte
-V380_SIGNATURE[VERSION_HEADER_SIZE] = {0x3c, 0x42, 0x3f, 0xc9, 0x6a, 0x87,
- 0xc2, 0xcf, 0x94, 0x45, 0x36, 0x61,
- 0x39, 0xfa
- };
+/* Various version TAF file signatures. */
+static const sc_byte V500_SIGNATURE[VERSION_HEADER_SIZE] = {
+ 0x3c, 0x42, 0x3f, 0xc9, 0x6a, 0x87, 0xc2, 0xcf, 0x92, 0x45, 0x3e, 0x61, 0x30, 0x30
+};
+
+static const sc_byte V400_SIGNATURE[VERSION_HEADER_SIZE] = {
+ 0x3c, 0x42, 0x3f, 0xc9, 0x6a, 0x87, 0xc2, 0xcf, 0x93, 0x45, 0x3e, 0x61, 0x39, 0xfa
+};
+
+static const sc_byte V390_SIGNATURE[VERSION_HEADER_SIZE] = {
+ 0x3c, 0x42, 0x3f, 0xc9, 0x6a, 0x87, 0xc2, 0xcf, 0x94, 0x45, 0x37, 0x61, 0x39, 0xfa
+};
+
+static const sc_byte V380_SIGNATURE[VERSION_HEADER_SIZE] = {
+ 0x3c, 0x42, 0x3f, 0xc9, 0x6a, 0x87, 0xc2, 0xcf, 0x94, 0x45, 0x36, 0x61, 0x39, 0xfa
+};
/*
* Game TAF data structure. The game structure contains the original TAF
@@ -499,7 +499,10 @@ static sc_tafref_t taf_create_from_callback(sc_read_callbackref_t callback,
* Compare the header with the known TAF signatures, and set TAF version
* appropriately.
*/
- if (memcmp(taf->header, V400_SIGNATURE, VERSION_HEADER_SIZE) == 0) {
+ if (memcmp(taf->header, V500_SIGNATURE, VERSION_HEADER_SIZE) == 0) {
+ taf->version = TAF_VERSION_500;
+
+ } else if (memcmp(taf->header, V400_SIGNATURE, VERSION_HEADER_SIZE) == 0) {
/* Read in the version 4.0 header extension. */
in_bytes = callback(opaque,
taf->header + VERSION_HEADER_SIZE,
@@ -522,7 +525,7 @@ static sc_tafref_t taf_create_from_callback(sc_read_callbackref_t callback,
}
} else {
/* Saved games are always considered to be for ScummVM, version 5.0. */
- taf->version = TAF_VERSION_500;
+ taf->version = TAF_VERSION_SAVE;
}
/*
@@ -531,10 +534,14 @@ static sc_tafref_t taf_create_from_callback(sc_read_callbackref_t callback,
* it's obfuscated with the Visual Basic PRNG.
*/
switch (taf->version) {
- case TAF_VERSION_500:
+ case TAF_VERSION_SAVE:
status = taf_read_raw(taf, callback, opaque, is_gamefile);
break;
-
+
+ case TAF_VERSION_500:
+ sc_error("taf_create: ADRIFT 5 games are not yet supported");
+ break;
+
case TAF_VERSION_400:
status = taf_decompress(taf, callback, opaque, is_gamefile);
break;
diff --git a/engines/glk/adrift/scutils.cpp b/engines/glk/adrift/scutils.cpp
index 0c8165d581..d1dc5141e9 100644
--- a/engines/glk/adrift/scutils.cpp
+++ b/engines/glk/adrift/scutils.cpp
@@ -65,7 +65,7 @@ void sc_error(const sc_char *format, ...) {
assert(format);
va_start(ap, format);
- Common::String s = Common::String::format(format, ap);
+ Common::String s = Common::String::vformat(format, ap);
va_end(ap);
warning("%s", s.c_str());
}