6TINT TTexture::GetBitsPerTexel( GXTexFmt a_texFmt )
33TINT TTexture::ComputeHash(
const TCHAR* str )
39 if ( val ==
'\0' )
break;
40 hash = hash * 0x11 + val;
45void TTexture::CheckValid()
47 if ( m_texFmt - 8 < 3 )
56 m_magFilter = GX_LIN_MIP_LIN;
57 m_unk4 = 0.5f * -( m_mipMaps - 176.0f );
60 if ( m_texFmt - 8 < 2 )
68void TTexture::InitTexObj()
72 if ( m_mipMaps & 0x20000000 )
74 m_pImageData =
new byte[ m_iImageSize ];
75 if ( m_width != ( m_width & -m_width ) || m_height != ( m_height & -m_height ) )
84void TTexture::InitRuntime( GXTexFmt a_texFmt, GXTlutFmt a_tlutFmt,
TUINT a_unk,
TUINT a_unk2,
TUINT a_unk3,
TUINT a_unk4,
void* a_unk5,
void* a_unk6,
TCHAR const* a_szFileName )
88 m_tlutFmt = a_tlutFmt;
91 m_szFileName = (
TCHAR*)a_szFileName;
93 m_iHash = ComputeHash( m_szFileName );
95 if ( m_texFmt - 8 < 3 )
101 a_unk3 |= 0x10000000;
105void TTexture::Swizzle()
107 uint8_t bitsPerTexel = GetBitsPerTexel( m_texFmt );
108 switch ( bitsPerTexel )
127void TTexture::Swizzle32Bit()
133 for (
TSIZE i = 0; i < m_mipMaps + 1; i++ )
137 for (
TSIZE j = 0; j < height; j += 4 )
141 for (
TSIZE k = 0; k < width; k += 4 )
143 uint8_t* buf2 = buf + iVar1;
144 for (
TSIZE s = 0; s < 2; s++ )
147 imgPtr3[ 0 ] = buf2[ 0 ] >> 0x10;
148 imgPtr3[ 1 ] = buf2[ 1 ] >> 0x10;
149 imgPtr3[ 2 ] = buf2[ 2 ] >> 0x10;
150 imgPtr3[ 3 ] = buf2[ 3 ] >> 0x10;
152 imgPtr3[ 16 ] = buf2[ 0 ];
153 imgPtr3[ 17 ] = buf2[ 1 ];
154 imgPtr3[ 18 ] = buf2[ 2 ];
155 imgPtr3[ 19 ] = buf2[ 3 ];
157 uint8_t* buf3 = buf2 + width;
158 imgPtr3[ 4 ] = buf3[ 0 ] >> 0x10;
159 imgPtr3[ 5 ] = buf3[ 1 ] >> 0x10;
160 imgPtr3[ 6 ] = buf3[ 2 ] >> 0x10;
161 imgPtr3[ 7 ] = buf3[ 3 ] >> 0x10;
163 imgPtr3[ 20 ] = buf3[ 0 ];
164 imgPtr3[ 21 ] = buf3[ 1 ];
165 imgPtr3[ 22 ] = buf3[ 2 ];
166 imgPtr3[ 23 ] = buf3[ 3 ];
171 imagePtr = imgPtr3 + 24;
184 if ( bitsPerTexel < 16 )
#define TOSHI_NAMESPACE_START
#define TOSHI_NAMESPACE_END
static void * MemCopy(void *dst, const void *src, TSIZE size)