GLK: ALAN2: Loading fixes
This commit is contained in:
parent
35cfe001c2
commit
51a142aaf8
3 changed files with 8 additions and 11 deletions
|
@ -36,7 +36,6 @@ extern winid_t glkStatusWin;
|
||||||
|
|
||||||
/* NB: this header must be included in any file which calls print() */
|
/* NB: this header must be included in any file which calls print() */
|
||||||
|
|
||||||
#define print glkio_printf
|
|
||||||
#undef printf
|
#undef printf
|
||||||
#define printf glkio_printf
|
#define printf glkio_printf
|
||||||
|
|
||||||
|
|
|
@ -257,7 +257,7 @@ void interpret(adr)
|
||||||
printf("PRINT \t%5ld, %5ld\t\"", fpos, len);
|
printf("PRINT \t%5ld, %5ld\t\"", fpos, len);
|
||||||
col = 34; /* To format it better! */
|
col = 34; /* To format it better! */
|
||||||
}
|
}
|
||||||
print((char *)fpos, len);
|
print(fpos, len);
|
||||||
if (stpflg)
|
if (stpflg)
|
||||||
printf("\"");
|
printf("\"");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1519,18 +1519,15 @@ static void load()
|
||||||
int i;
|
int i;
|
||||||
char err[100];
|
char err[100];
|
||||||
|
|
||||||
Aword *ptr = (Aword *)&tmphdr;
|
Aword *ptr = (Aword *)&tmphdr + 1;
|
||||||
codfil->seek(0);
|
codfil->seek(0);
|
||||||
for (i = 0; i < sizeof(tmphdr) / sizeof(Aword); ++i, ++ptr)
|
codfil->read(&tmphdr.vers[0], 4);
|
||||||
*ptr = codfil->readUint32LE();
|
for (i = 1; i < sizeof(tmphdr) / sizeof(Aword); ++i, ++ptr)
|
||||||
|
*ptr = codfil->readUint32BE();
|
||||||
checkvers(&tmphdr);
|
checkvers(&tmphdr);
|
||||||
|
|
||||||
/* Allocate and load memory */
|
/* Allocate and load memory */
|
||||||
|
|
||||||
#ifdef REVERSED
|
|
||||||
reverseHdr(&tmphdr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* No memory allocated yet? */
|
/* No memory allocated yet? */
|
||||||
if (memory == NULL) {
|
if (memory == NULL) {
|
||||||
#ifdef V25COMPATIBLE
|
#ifdef V25COMPATIBLE
|
||||||
|
@ -1548,7 +1545,8 @@ static void load()
|
||||||
::error("Header size is greater than filesize");
|
::error("Header size is greater than filesize");
|
||||||
|
|
||||||
codfil->seek(0);
|
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();
|
*ptr = codfil->readUint32LE();
|
||||||
|
|
||||||
/* Calculate checksum */
|
/* Calculate checksum */
|
||||||
|
@ -1573,7 +1571,7 @@ static void load()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef REVERSED
|
#if defined(SCUMM_LITTLE_ENDIAN)
|
||||||
if (dbgflg||trcflg||stpflg)
|
if (dbgflg||trcflg||stpflg)
|
||||||
output("<Hmm, this is a little-endian machine, fixing byte ordering....");
|
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 */
|
reverseACD(tmphdr.vers[0] == 2 && tmphdr.vers[1] == 5); /* Reverse all words in the ACD file */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue