FWGS / mainui_cpp

Main menu UI toolkit for Xash3D FWGS engine
33 stars 38 forks source link

Building on PowerPC big-endian #67

Closed jedavies-dev closed 2 years ago

jedavies-dev commented 2 years ago

I am working on porting xash3d to PowerPC systems. Modern PPC CPUs can run in either endian mode. Traditionally the preferred endianness was big-endian. Most 64-bit PPC distros today are little-endian though for compatibility reasons.

With some small changes, xash3d builds fine on powerpc64le (little-endian). However, it fails to build on powerpc64 (big-endian) with the following errors:

In file included from ../mainui/miniutl/generichash.cpp:18:
../mainui/miniutl/minbase_endian.h:164:11: error: use of undeclared identifier '__loadwordbytereverse'
                        return __loadwordbytereverse( dwordIndex<<2, base );
                               ^
../mainui/miniutl/minbase_endian.h:169:4: error: use of undeclared identifier '__storewordbytereverse'
                        __storewordbytereverse( dword, dwordIndex<<2, base );
                        ^
../mainui/miniutl/minbase_endian.h:173:11: error: use of undeclared identifier '__loaddoublewordbytereverse'
                        return __loaddoublewordbytereverse( nWordIndex<<2, base );
                               ^
../mainui/miniutl/minbase_endian.h:178:4: error: use of undeclared identifier '__storedoublewordbytereverse'
                        __storedoublewordbytereverse( nWord, nWordIndex<<2, base );
                        ^

These four functions: __loadwordbytereverse, __storewordbytereverse, __loaddoublewordbytereverse, __storedoublewordbytereverse, are not defined. Can you advise if they are defined in one of your other libraries? Or are further changes required here?

jedavies-dev commented 2 years ago

Note this is in the miniutl project. But I couldn't open an issue there, so I am adding it here.

nekonomicon commented 2 years ago

These four functions: loadwordbytereverse, storewordbytereverse, loaddoublewordbytereverse, storedoublewordbytereverse, are not defined. Can you advise if they are defined in one of your other libraries? Or are further changes required here?

It's compiler-dependent intrinsics. There macro for PS3 in minbase_endian.h and PS3 has CPU on PowerPC64, so you need to change macro in this header.

a1batross commented 2 years ago

MiniUTL is a part of old Source SDK UTL which is got re-released under free license.

The part you're talking about is probably from PS3 or Xbox360, which were indeed big-endian.

As an example of porting Xash to big endian, we had some work on it in Old Engine branch. You can probably reuse these handy macros: https://github.com/FWGS/xash3d/blob/725fd84b5ba8d405979d63df7a906feb1bc87d51/engine/common/common.h#L103

a1batross commented 2 years ago

Removed that functionality from MiniUTL, as it was completely unused.