If you run the Intel version of Crawl and then the PowerPC version, you will get "Lua error: global_prelude: bad header in precompiled chunk" seven times during the start of Crawl.
This patch corrects the issue by making the bytecode architecture independent.
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
GO6VWVNRS4XT66TFY466AYAYAV35NAORJTUXKTDGOJRGIPFL4MTAC
}
static void LoadMem (LoadState* S, void* b, int n, size_t size)
{
LoadBlock(S,b,n*size);
if (S->swap)
{
char* p=(char*) b;
char c;
switch (size)
{
case 1:
break;
case 2:
while (n--)
{
c=p[0]; p[0]=p[1]; p[1]=c;
p+=2;
}
break;
case 4:
while (n--)
{
c=p[0]; p[0]=p[3]; p[3]=c;
c=p[1]; p[1]=p[2]; p[2]=c;
p+=4;
}
break;
case 8:
while (n--)
{
c=p[0]; p[0]=p[7]; p[7]=c;
c=p[1]; p[1]=p[6]; p[6]=c;
c=p[2]; p[2]=p[5]; p[5]=c;
c=p[3]; p[3]=p[4]; p[4]=c;
p+=8;
}
break;
default:
IF(1, "bad size");
break;
}
}