XProger / OpenLara

Classic Tomb Raider open-source engine
http://xproger.info/projects/OpenLara/
BSD 2-Clause "Simplified" License
4.69k stars 359 forks source link

utils.h, typedefs conflicts on OpenBSD workaround #320

Open c64skin opened 3 years ago

c64skin commented 3 years ago

~~```

ifdef OpenBSD

typedef int8_t int8; typedef int16_t int16; typedef int32_t int32; typedef int64_t int64; typedef uint8_t uint8; typedef uint16_t uint16; typedef uint32_t uint32; typedef uint64_t uint64;

else

typedef signed char int8; typedef signed short int16; typedef signed int int32; typedef signed long long int64; typedef unsigned char uint8; typedef unsigned short uint16; typedef unsigned int uint32; typedef unsigned long long uint64;

endif~~

XProger commented 3 years ago

why it conflicts?

c64skin commented 3 years ago

another day and a another look.. it's these two that is the issue in utils.h:

inline uint16 swap16(uint16 x) {
    return ((x & 0x00FF) << 8) | ((x & 0xFF00) >> 8);
}

inline uint32 swap32(uint32 x) {
    return ((x & 0x000000FF) << 24) | ((x & 0x0000FF00) << 8) | ((x & 0x00FF0000) >> 8) | ((x & 0xFF000000) >> 24);
}

../../utils.h:160:15: error: 'uint16 __uint16_t' redeclared as different kind of symbol inline uint16 swap16(uint16 x) {

../../utils.h:165:15: error: 'uint32 __uint32_t' redeclared as different kind of symbol inline uint32 swap32(uint32 x) {

c64skin commented 3 years ago

workaround:


#ifndef __OpenBSD__
inline uint16 swap16(uint16 x) {
    return ((x & 0x00FF) << 8) | ((x & 0xFF00) >> 8);
}

inline uint32 swap32(uint32 x) {
    return ((x & 0x000000FF) << 24) | ((x & 0x0000FF00) << 8) | ((x & 0x00FF0000) >> 8) | ((x & 0xFF000000) >> 24);
}
#endif
XProger commented 3 years ago

ifdef BSD should be better I think. How did you replace linux/*.h headers? I compile game without joystick support, but it crashes on some OGL calls, mesa gl version is 3.2

c64skin commented 3 years ago

I've settled for the sdl2 version...i haven't made any effort to try building nix version. If you recommend nix instead i will do so.

XProger commented 3 years ago

no, just my curiosity, I have never worked with BSD systems... maybe I'll try