/** SGX

The   sss    gggg x   x   
     s      g      x x    Engine
      sss   g  gg   x
         s  g   g  x x          Copyright 1995-2009.
     ssss    gggg x   x         Steven Goodwin. All Rights Reserved.
    
This version has been released under the GNU Public License v2.0.

Please see the license files for details.

File: sgx/src/sgx/game/gamesku.cpp

*/

#include "sgx/core/core.hpp"
#include "sgx/game/game.hpp"
#include "sgx/filesystem/filesystem.hpp"


tUINT32 CSGXGameSKU::m_iSupportedLanguages;
tUINT32 CSGXGameSKU::m_iSupportedTVModes;
tUINT32 CSGXGameSKU::m_iSupportedRegions;

void
CSGXGameSKU::importSKUFile() {
CSGXFile f("sku");

	if (f.open()) {
		f >> m_iSupportedLanguages >> m_iSupportedTVModes >> m_iSupportedRegions;
		f.close();
	}
}

tBOOL
CSGXGameSKU::isLanguageSupported(const tUINT32 lang) {
	return m_iSupportedLanguages & (1<<lang) ? TRUE : FALSE;
}

tBOOL
CSGXGameSKU::isTVModeSupported(const tUINT32 tvmode) {
	return m_iSupportedTVModes & (1<<tvmode) ? TRUE : FALSE;
}

tBOOL
CSGXGameSKU::isRegionSupported(const tUINT32 region) {
	return m_iSupportedRegions & (1<<region) ? TRUE : FALSE;
}

const char *
CSGXGameSKU::getLanguageCode(const tUINT32 lang) {
	switch(lang) {
		case SGX_SKU_LANG_ENGLISH:
			return "en";
		case SGX_SKU_LANG_FRENCH:
			return "fr";
		case SGX_SKU_LANG_ITALIAN:
			return "it";
		case SGX_SKU_LANG_GERMAN:
			return "de";
		case SGX_SKU_LANG_SPANISH:
			return "es";
		case SGX_SKU_LANG_DUTCH:
			return "nl";
		case SGX_SKU_LANG_JAPANESE:
			return "jp";
		case SGX_SKU_LANG_CHINESE_SIMPLE:
			return "zh";
		case SGX_SKU_LANG_CHINESE_TRAD:
			return "tw";
		case SGX_SKU_LANG_KOREAN:
			return "kr";
		default:
			sgxAssert(0 && "More languages need defining, as this isn't valid");
	}

	return "Unknwon";
}
