//
// Tools_Platform.h
//
// Created by Richard Rice - 11/08/2006
// 
// Copyright (C) 2006 Rebellion, All Rights Reserved.
//


#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef ___TOOLS_PLATFORM___
#define ___TOOLS_PLATFORM___ 1

//Contains enumeration of platforms that matches those in level export.
//Moved here so it can be used without including so much
enum Tools_Platform_Type
{
	//These values get saved out and so shouldn't be altered.
	//The enumeration in Tools_Level_Export should be made to match as well
	TOOLS_PLATFORM_PC = 0,
	TOOLS_PLATFORM_PS2 = 1,
	//TOOLS_PLATFORM_XBOX = 2, // (MH - 08.05.2008) Xbox is no longer supported.
	//TOOLS_PLATFORM_GC = 3, // (KOR - 14/10/2008) Nor GameCube
	TOOLS_PLATFORM_PSP = 4,
	TOOLS_PLATFORM_PS3 = 5,
	TOOLS_PLATFORM_XBOX360 = 6,
	TOOLS_PLATFORM_WII = 7,

	TOOLS_PLATFORM_NUM_PLATFORMS,
};


class Tools_Platform
{
public :
	//Gets name of platform.
	static const char* GetPlatformName(int iPlatform);

	//Gets default extension for platform.
	static const char* GetPlatformExtension(int iPlatform);

	//searches the path for a directory name that matches one of the platform names.
	//returns -1 if no match is found.
	static int GetPlatformFromPath(const char* szPath);

	//Strips out the platform specific part of a filename, and returns the platform removed.
	//The output buffer should be at least large enough to contain szPath
	static int RemovePlatformFromPath(const char* szPath, char* szOutputBuffer);

	//Returns true if the platform is big endian
	static bool IsBigEndian(int iPlatform)
	{
		return 	iPlatform == TOOLS_PLATFORM_WII ||
				iPlatform == TOOLS_PLATFORM_PS3 ||
				iPlatform == TOOLS_PLATFORM_XBOX360;
	}

private :
	static void GetPlatformFromPath(const char* szPath, int& iOutputPlatform, const char*& pcPlatformPos);
};


#endif //___TOOLS_PLATFORM___