aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/alan2
diff options
context:
space:
mode:
authorPaul Gilbert2019-06-19 20:16:19 -0700
committerPaul Gilbert2019-06-22 14:40:49 -0700
commit51a142aaf89fc5231b5a7b390ede08b1f7f1e08d (patch)
treee7ec77d28742ba8f2d5d4e6079f86be8d477f14e /engines/glk/alan2
parent35cfe001c24fea912d59bcb14ce72bd3411ce66a (diff)
downloadscummvm-rg350-51a142aaf89fc5231b5a7b390ede08b1f7f1e08d.tar.gz
scummvm-rg350-51a142aaf89fc5231b5a7b390ede08b1f7f1e08d.tar.bz2
scummvm-rg350-51a142aaf89fc5231b5a7b390ede08b1f7f1e08d.zip
GLK: ALAN2: Loading fixes
Diffstat (limited to 'engines/glk/alan2')
-rw-r--r--engines/glk/alan2/glkio.h1
-rw-r--r--engines/glk/alan2/inter.cpp2
-rw-r--r--engines/glk/alan2/main.cpp16
3 files changed, 8 insertions, 11 deletions
diff --git a/engines/glk/alan2/glkio.h b/engines/glk/alan2/glkio.h
index 151bb7a3b5..8c1dee2ff5 100644
--- a/engines/glk/alan2/glkio.h
+++ b/engines/glk/alan2/glkio.h
@@ -36,7 +36,6 @@ extern winid_t glkStatusWin;
/* NB: this header must be included in any file which calls print() */
-#define print glkio_printf
#undef printf
#define printf glkio_printf
diff --git a/engines/glk/alan2/inter.cpp b/engines/glk/alan2/inter.cpp
index 02b4f4819f..dd3ee9e0bd 100644
--- a/engines/glk/alan2/inter.cpp
+++ b/engines/glk/alan2/inter.cpp
@@ -257,7 +257,7 @@ void interpret(adr)
printf("PRINT \t%5ld, %5ld\t\"", fpos, len);
col = 34; /* To format it better! */
}
- print((char *)fpos, len);
+ print(fpos, len);
if (stpflg)
printf("\"");
break;
diff --git a/engines/glk/alan2/main.cpp b/engines/glk/alan2/main.cpp
index 2a1b884b3d..a508041f7d 100644
--- a/engines/glk/alan2/main.cpp
+++ b/engines/glk/alan2/main.cpp
@@ -1519,18 +1519,15 @@ static void load()
int i;
char err[100];
- Aword *ptr = (Aword *)&tmphdr;
+ Aword *ptr = (Aword *)&tmphdr + 1;
codfil->seek(0);
- for (i = 0; i < sizeof(tmphdr) / sizeof(Aword); ++i, ++ptr)
- *ptr = codfil->readUint32LE();
+ codfil->read(&tmphdr.vers[0], 4);
+ for (i = 1; i < sizeof(tmphdr) / sizeof(Aword); ++i, ++ptr)
+ *ptr = codfil->readUint32BE();
checkvers(&tmphdr);
/* Allocate and load memory */
-#ifdef REVERSED
- reverseHdr(&tmphdr);
-#endif
-
/* No memory allocated yet? */
if (memory == NULL) {
#ifdef V25COMPATIBLE
@@ -1548,7 +1545,8 @@ static void load()
::error("Header size is greater than filesize");
codfil->seek(0);
- for (i = 0, ptr = memory; i < tmphdr.size; ++i, ++ptr)
+ codfil->read(&header->vers[0], 4);
+ for (i = 1, ptr = memory + 1; i < tmphdr.size; ++i, ++ptr)
*ptr = codfil->readUint32LE();
/* Calculate checksum */
@@ -1573,7 +1571,7 @@ static void load()
}
}
-#ifdef REVERSED
+#if defined(SCUMM_LITTLE_ENDIAN)
if (dbgflg||trcflg||stpflg)
output("<Hmm, this is a little-endian machine, fixing byte ordering....");
reverseACD(tmphdr.vers[0] == 2 && tmphdr.vers[1] == 5); /* Reverse all words in the ACD file */