diff options
author | Paul Gilbert | 2019-06-26 22:16:22 -0700 |
---|---|---|
committer | Paul Gilbert | 2019-07-06 15:27:08 -0700 |
commit | f5ad5b00d0098f90416192a867f48dda4d607f51 (patch) | |
tree | 707b113b022e02b0fecf295dcfcc52116601a7fb /engines/glk/alan3 | |
parent | 4d7cfeb2c7d860a86e57f27701a1c0465538b20f (diff) | |
download | scummvm-rg350-f5ad5b00d0098f90416192a867f48dda4d607f51.tar.gz scummvm-rg350-f5ad5b00d0098f90416192a867f48dda4d607f51.tar.bz2 scummvm-rg350-f5ad5b00d0098f90416192a867f48dda4d607f51.zip |
GLK: ALAN3: Fix endianness of loading temporary header
Diffstat (limited to 'engines/glk/alan3')
-rw-r--r-- | engines/glk/alan3/main.cpp | 12 | ||||
-rw-r--r-- | engines/glk/alan3/reverse.cpp | 2 | ||||
-rw-r--r-- | engines/glk/alan3/reverse.h | 1 |
3 files changed, 7 insertions, 8 deletions
diff --git a/engines/glk/alan3/main.cpp b/engines/glk/alan3/main.cpp index 64f701934f..06e5895dcc 100644 --- a/engines/glk/alan3/main.cpp +++ b/engines/glk/alan3/main.cpp @@ -135,8 +135,12 @@ static int crcStart(char version[4]) { /*----------------------------------------------------------------------*/ static void readTemporaryHeader(ACodeHeader *tmphdr) { codfil->seek(0); - codfil->read(tmphdr, sizeof(*tmphdr)); - codfil->seek(0); + codfil->read(&tmphdr->tag[0], 4); + + Aword *ptr = (Aword *)tmphdr + 1; + uint i; + for (i = 1; i < sizeof(ACodeHeader) / sizeof(Aword); ++i, ++ptr) + *ptr = codfil->readUint32BE(); if (strncmp((char *)tmphdr, "ALAN", 4) != 0) playererr("Not an Alan game file, does not start with \"ALAN\""); @@ -365,10 +369,6 @@ static void load(void) { checkVersion(&tmphdr); /* Allocate and load memory */ - - if (littleEndian()) - reverseHdr(&tmphdr); - if (tmphdr.size <= sizeof(ACodeHeader) / sizeof(Aword)) syserr("Malformed game file. Too small."); diff --git a/engines/glk/alan3/reverse.cpp b/engines/glk/alan3/reverse.cpp index ca6db949af..6fa7aa56a3 100644 --- a/engines/glk/alan3/reverse.cpp +++ b/engines/glk/alan3/reverse.cpp @@ -573,7 +573,7 @@ static void reversePreBeta2() { /*======================================================================*/ -void reverseHdr(ACodeHeader *hdr) { +static void reverseHdr(ACodeHeader *hdr) { uint i; /* Reverse all words in the header except the tag and the version marking */ diff --git a/engines/glk/alan3/reverse.h b/engines/glk/alan3/reverse.h index ebcc0f5f8f..cca38c0c27 100644 --- a/engines/glk/alan3/reverse.h +++ b/engines/glk/alan3/reverse.h @@ -32,7 +32,6 @@ namespace Alan3 { /* Functions: */ -extern void reverseHdr(ACodeHeader *hdr); extern void reverseACD(void); extern void reverse(Aword *word); extern Aword reversed(Aword word); |