GLK: ALAN2: Loading fixes

This commit is contained in:
Paul Gilbert 2019-06-19 20:16:19 -07:00
parent 35cfe001c2
commit 51a142aaf8
3 changed files with 8 additions and 11 deletions

View file

@ -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

View file

@ -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;

View file

@ -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 */