Sign in to follow this  
Alundra

XBOX ONE / PS4 predefined macro

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this