Remember me

Lost Password?

Register now!


Who's Online
38 user(s) are online (21 user(s) are browsing Forums)

Members: 0
Guests: 38


Support us!


Report message:*

Re: DevilutionX - Diablo 1

Subject: Re: DevilutionX - Diablo 1
by Hans on 2019/2/3 1:54:14


Does the code you're compiling work on big-endian CPUs?

If the code reads the file in as one large buffer and the file was generated for little-endian machines, then the code snippet you posted will read values round the wrong way.

If endianness is the problem, then you'll need to:
1. Have a file with endianness conversion macros (e.g., LE32_TO_CPU()
2. Go through the code and insert the macros wherever data from the file is being read (e.g., LE64_TO_CPU(pHeader->HetTablePos64)) (that's assuming that HetTablePos64 is 64-bit

- #include <machine/endian.h> defines BYTE_ORDER, so you can use #if (BYTE_ORDER == BIG_ENDIAN) to define the correct versions of the macros in both big and little-endian platforms
- GCC 4.4.0 and newer have built in __builtin_bswap16(x), __builtin_bswap32(x), __builtin_bswap64(x)


Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project