private int CheckTextureCache(int tx) { object tag = ROM.SegmentMapping[(byte)(Textures[tx].Address >> 24)]; foreach (TextureCache cached in texcache) { if (cached.Tag == tag && cached.Format == Textures[tx].Format && cached.Address == Textures[tx].Address && cached.RealHeight == Textures[tx].RealHeight && cached.RealWidth == Textures[tx].RealWidth) return cached.GLID; } TextureCache newcached = new TextureCache(tag, Textures[tx], LoadTexture(tx)); texcache.Add(newcached); return newcached.GLID; }