// ------------------------------------------------------------------------
/*
	author: Jaap Suter
   
	Copyright (C) Electronic Arts Canada Inc. 2002.  All rights reserved.	
*/
// ------------------------------------------------------------------------

/*! \file */

#include "reveal/reveal.h"
#include "coreallocator/icoreallocator_interface.h"

//! Define storage for the global reference to the singleton;
// porting: BLJ these two lines were needed for PS3 GCC, the compiler was crashing with 
// the original line
namespace Reveal {
	Reveal::Tweaker& GetTweaker()
	{
		static Reveal::Singleton& gTweaker = Reveal::Singleton::Instance();
		return gTweaker;
	}
}

namespace Reveal {
	namespace Memory {
		EA::Allocator::ICoreAllocator *gAlloc;

		void SetAllocator(EA::Allocator::ICoreAllocator *alloc)
		{
			assert(alloc);
			gAlloc = alloc;
		}

		void* RevealMalloc(size_t sz)
		{
			assert(gAlloc);
			return gAlloc->Alloc(sz, "RevealMalloc", EA::Allocator::MEM_PERM);
		}

		void RevealFree(void *ptr)
		{
			assert(gAlloc);
			gAlloc->Free(ptr);
		}
	}
}

