long	MissionBriefingScreen::getMissionTGA(const char* missionName)
{
	if (!missionName)
		return 0;

	// do I need to open the file?  I guess so, if this proves too slow,
	// it could be done when a stage is completed
	FullPathFileName path;
	path.init(missionPath, missionName, ".pak");

	if ( 1 == fileExists( path ) )
	{

		// big hack here for some reason we can open files while they're being transferred.
		HANDLE hFile = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0); // MCHD TODO: What is this all about?

		if ( hFile == INVALID_HANDLE_VALUE )
			return 0;

		CloseHandle( hFile );
	}

	// read the tga out of the pak file
	PacketFile file;
	if ( NO_ERR == file.open( path ) ) // in case file has just been created
	{
		if ( file.getNumPackets() > 3 )
		{
	
			file.seekPacket(3);
			long size = file.getPacketSize( );
			BYTE* mem = new BYTE[size];

			file.readPacket( 3, mem );
			
			TGAFileHeader* pHeader = (TGAFileHeader*)mem;
			long bmpWidth = pHeader->width;
			long bmpHeight = pHeader->height;
			flipTopToBottom( (BYTE*)(pHeader + 1), pHeader->pixel_depth, bmpWidth, bmpHeight );
			
			// set up the texture
			long tmpMapTextureHandle = mcTextureManager->textureFromMemory( (unsigned long*)(pHeader+1), gos_Texture_Solid, 0, bmpWidth );

			delete mem;

			return tmpMapTextureHandle;
		}
	}

	return 0;


}
int32_t MissionBriefingScreen::getMissionTGA(PCSTR missionName)
{
	if (!missionName)
		return 0;
	// do I need to open the file?  I guess so, if this proves too slow,
	// it could be done when a stage is completed
	FullPathFileName path;
	path.init(missionPath, missionName, ".pak");
	if (1 == fileExists(path))
	{
		// big hack here for some reason we can open files while they're being
		// transferred.
		HANDLE hFile  = CreateFile(path, GENERIC_READ, 0, nullptr, OPEN_EXISTING, 0, 0);
		int32_t error = GetLastError();
		if (hFile == INVALID_HANDLE_VALUE)
			return 0;
		CloseHandle(hFile);
	}
	// read the tga out of the pak file
	PacketFile file;
	if (NO_ERROR == file.open(path)) // in case file has just been created
	{
		if (file.getNumPackets() > 3)
		{
			file.seekPacket(3);
			int32_t size = file.getPacketSize();
			puint8_t mem = new uint8_t[size];
			file.readPacket(3, mem);
			TGAFileHeader* pHeader = (TGAFileHeader*)mem;
			int32_t bmpWidth	   = pHeader->width;
			int32_t bmpHeight	  = pHeader->height;
			flipTopToBottom((puint8_t)(pHeader + 1), pHeader->pixel_depth, bmpWidth, bmpHeight);
			// set up the texture
			int32_t tmpMapTextureHandle = mcTextureManager->textureFromMemory(
				(uint32_t*)(pHeader + 1), gos_Texture_Solid, 0, bmpWidth);
			delete mem;
			return tmpMapTextureHandle;
		}
	}
	return 0;
}