예제 #1
0
파일: TextureDx9.cpp 프로젝트: berak/e6
	IDirect3DBaseTexture9 * TextureCache::getBuffer( Core::Texture * tex )
	{
		//~ printf( "%s %s\n", __FUNCTION__, (tex?tex->getName():"nil"));
		//E_ASSERT( cache.size() );

		Item * it = find( tex );
		if ( ! it || ! it->val )
		{
			return addTex(tex);
		}
		it->ttl = 500;
		return it->val;
	}
예제 #2
0
파일: HGx.c 프로젝트: UraKn0x/cs2-3DS
texTable *readHG3Image(int fd, HG3StdInfo stdInfo, HG3ImgHeader imgHdr, char *texName, ulong texIndex, texTable *next)
{	
	uchar    *tempBuff = NULL, *buff = NULL, *cmdBuff = NULL, *RGBABuff = NULL, *outBuff = NULL;
	ulong    originalLen = imgHdr.originalLen, originalCmdLen = imgHdr.originalCmdLen, outLen;
	int      err;
	texTable *ret = NULL;
	
	smalloc(tempBuff, imgHdr.compressedLen);
	smalloc(buff, imgHdr.originalLen);
	read(fd, tempBuff, imgHdr.compressedLen);
	err = uncompress(buff, &originalLen, tempBuff, imgHdr.compressedLen);
	if(err != Z_OK)
	{
		printf("uncompress error on buff\n");
		printf("%d %d %d %d\n", err, Z_BUF_ERROR, Z_MEM_ERROR, Z_DATA_ERROR);
		return NULL;
	}
	free(tempBuff); tempBuff = NULL;

	smalloc(tempBuff, imgHdr.cmdLen);
	smalloc(cmdBuff, imgHdr.originalCmdLen);
	read(fd, tempBuff, imgHdr.cmdLen);
	err = uncompress(cmdBuff, &originalCmdLen, tempBuff, imgHdr.cmdLen);
	if(err != Z_OK)
	{
		printf("uncompress error on cmdBuff\n");
		printf("%d %d %d %d\n", err, Z_BUF_ERROR, Z_MEM_ERROR, Z_DATA_ERROR);
		return NULL;
	}
	free(tempBuff); tempBuff = NULL;

	outBuff = unRLE(buff, originalLen, cmdBuff, originalCmdLen, &outLen);
	smalloc(RGBABuff, outLen);
	unDelta(outBuff, outLen, stdInfo.width, stdInfo.height, stdInfo.bpp / 8, RGBABuff);

	free(buff);
	free(cmdBuff);
	free(outBuff);

	ret = addTex(next, texName, texIndex, stdInfo.width, stdInfo.height, stdInfo.bpp / 8, RGBABuff);
	free(RGBABuff);

	return ret;
}