//===========================================================================//
// File:	 GamePlatform.cpp												 //
// Project:  GameOS					                                         //
// Contents: Setup GameOS for running games									 //
//---------------------------------------------------------------------------//
// Date      Who    Modification                                             //
// 02/15/99  AG     Created													 //
//===========================================================================//
#define WIN32_EXTRA_LEAN			// Reduce windows header size
#define VC_EXTRALEAN				// Reduce windows header size
#include <windows.h>
#include <GameOS\GameOS.hpp>
#include <GameOS\Platform.hpp>

extern bool gViaNew;

int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow )
{
#ifdef _ICECAP
	StopCAPAll ();
#endif
	Platform=Platform_Game;
	RunFromWinMain( hInst, hPrevInst, lpCmdLine, nCmdShow );
	return 0;
}

//
// Memory management API's only occur in GamePlatform project.
//
void* __cdecl operator new (size_t size, HGOSHEAP Heap)
{
#ifdef _DEBUG	
	gViaNew = true;
#endif
	return gos_Malloc( size , Heap );
}

void* __cdecl operator new (size_t size)
{
	// 0xffffffff specifies use of the heap set by CurrentHeapLevel
#ifdef _DEBUG	
	gViaNew = true;
#endif
	return gos_Malloc( size , (HGOSHEAP) 0xffffffff );
}


void __cdecl operator delete ( void* ptr )
{
	gos_Free((char*) ptr);
}


void __cdecl operator delete[] ( void* ptr )
{
	gos_Free((char*) ptr);
}

