XBOX ONE / PS4 predefined macro

Started by
1 comment, last by Alundra 9 years ago

Hi,

Is it safe enought to check the predefined macro "_XBOX" and "_PS4" to know the platform where we are compiling ?

For XBOX 360 "_X360", I don't know the XBOX ONE, but if only XBOX ONE is supported "_XBOX" is ok ?

For PS4 all these check can be used : defined(_PS4) || defined(__PS4__) || defined(SN_TARGET_PS4)

Check only "_PS4" is enough for the Playstation 4 ?

Thanks

Advertisement
In my experience, most projects use their own macros.

e.g. say that the 360 compiler defines _X360, then "Bob's Engine" might have some code in their pch.h like:
#ifdef _X360
#define BOB_PLATFORM_X360
#endif
Or:
#define BOB_PLATFORM_WINDOWS 1
#define BOB_PLATFORM_X360 2
#define BOB_PLATFORM_PS3 3

#ifdef _X360
#define BOB_PLATFORM BOB_PLATFORM_X360
#endif
etc...

So my recommendation would be to use your own standard, and then add the code to activate the right one of your macros using the platform specific details.

Or... don't even use the platform-specific details such as "_X360" -- just put your BOB_PLATFORM_X360-equivalent into the project settings for each platform manually.

p.s. We can't really answer PS/Xbox specific questions here without breaking NDA...

The answer is there :

http://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/apireference/files/PxPreprocessor_8h-source.html

"XBOXONE" for Xbox One and "__ORBIS__" for PS4, but since raknet uses "_PS4", it's safe too surely.

This topic is closed to new replies.

Advertisement