• Advertisement
Sign in to follow this  

XBOX ONE / PS4 predefined macro

This topic is 1060 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Edited by Alundra

Share this post


Link to post
Share on other sites
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... Edited by Hodgman

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement