mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-14 13:22:23 +08:00
- removed useless casting on CTexture
~ updated TEXTURE_FORMAT.md documentation to reflect real format Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
d9c12d0b58
commit
8ae77aa7c0
@ -8,15 +8,26 @@ Wallpaper engine uses a custom texture storage format converted by resourcecompi
|
|||||||
| __Padding__ | 1 byte | Null terminator for string |
|
| __Padding__ | 1 byte | Null terminator for string |
|
||||||
| __Extra file type indicator?__ | 8 bytes | TEXI0001 |
|
| __Extra file type indicator?__ | 8 bytes | TEXI0001 |
|
||||||
| __Padding__ | 1 byte | Null terminator for string |
|
| __Padding__ | 1 byte | Null terminator for string |
|
||||||
| __Texture type__ | 1 byte | 4 => DXT5? 0 => JPEG? |
|
| __Texture type__ | 4 bytes | 0 => ARGB8888, 4 => DXT5, 6 => DXT3, 7 => DXT1, 8 => RG88, 9 => R8 |
|
||||||
| __Unknown data__ | 15 bytes | To be reversed |
|
| __Texture flags__ | 4 bytes | Flags for the texture (1 => Interpolation, 2 => ClampUVs, 4 => IsGif) |
|
||||||
|
| __Texture Width__ | 4 bytes | Texture's full width |
|
||||||
|
| __Texture Height__ | 4 bytes | Texture's full height |
|
||||||
| __Width__ | 4 bytes | Image's width |
|
| __Width__ | 4 bytes | Image's width |
|
||||||
| __Height__ | 4 bytes | Image's height |
|
| __Height__ | 4 bytes | Image's height |
|
||||||
| __Unknown data__ | 5 bytes | To be reversed |
|
| __Unknown data__ | 4 bytes | To be reversed |
|
||||||
| __Container version__ | 8 bytes | TEXB0003 |
|
| __Container version__ | 8 bytes | TEXB0003/TEXB0002/TEXB0001 |
|
||||||
| __Padding__ | 1 byte | Null terminator for string |
|
| __Padding__ | 1 byte | Null terminator for string |
|
||||||
| __Unknown data__ | 8 bytes | To be reversed |
|
| __Texture information__ | x bytes | Varies depending on the container version |
|
||||||
| __Mip map levels__ | 4 bytes | The number of mipmaps stored for this texture |
|
|
||||||
|
## TEXB0003
|
||||||
|
| __Unknown data__ | 4 bytes | To be reversed |
|
||||||
|
| __Free image format__ | 4 bytes | The type of file this texture is based off the FREEIMAGE library |
|
||||||
|
| __Mip map levels__ | 4 bytes | The number of mipmap levels stored for this texture |
|
||||||
|
| __Mipmap entry__ | x bytes | See Mipmap entries |
|
||||||
|
|
||||||
|
## TEXB0002 and TEXB0001
|
||||||
|
| __Unknown data__ | 4 bytes | To be reversed |
|
||||||
|
| __Mip map levels__ | 4 bytes | The number of mipmap levels stored for this texture |
|
||||||
| __Mipmap entry__ | x bytes | See Mipmap entries |
|
| __Mipmap entry__ | x bytes | See Mipmap entries |
|
||||||
|
|
||||||
## Mipmap entries
|
## Mipmap entries
|
||||||
|
@ -203,37 +203,29 @@ void CTexture::parseHeader (char* fileData)
|
|||||||
fileData = reinterpret_cast <char*> (pointer);
|
fileData = reinterpret_cast <char*> (pointer);
|
||||||
// get the position of what comes after the texture data
|
// get the position of what comes after the texture data
|
||||||
char* afterFileData = fileData + 9;
|
char* afterFileData = fileData + 9;
|
||||||
|
pointer = reinterpret_cast <uint32_t*> (fileData + 9);
|
||||||
|
|
||||||
if (memcmp (fileData, "TEXB0003", 9) == 0)
|
if (memcmp (fileData, "TEXB0003", 9) == 0)
|
||||||
{
|
{
|
||||||
this->m_header->containerVersion = ContainerVersion::TEXB0003;
|
this->m_header->containerVersion = ContainerVersion::TEXB0003;
|
||||||
|
|
||||||
// get back the pointer and use it
|
// get back the pointer and use it
|
||||||
pointer = reinterpret_cast <uint32_t*> (afterFileData);
|
|
||||||
pointer ++;
|
pointer ++;
|
||||||
this->m_header->freeImageFormat = static_cast<FREE_IMAGE_FORMAT> (*pointer++);
|
this->m_header->freeImageFormat = static_cast<FREE_IMAGE_FORMAT> (*pointer++);
|
||||||
// set back the pointer
|
|
||||||
fileData = reinterpret_cast <char*> (pointer);
|
|
||||||
}
|
}
|
||||||
else if(memcmp (fileData, "TEXB0002", 9) == 0)
|
else if(memcmp (fileData, "TEXB0002", 9) == 0)
|
||||||
{
|
{
|
||||||
this->m_header->containerVersion = ContainerVersion::TEXB0002;
|
this->m_header->containerVersion = ContainerVersion::TEXB0002;
|
||||||
|
|
||||||
// get back the pointer and use it
|
// skip 4 bytes
|
||||||
pointer = reinterpret_cast <uint32_t*> (afterFileData);
|
|
||||||
pointer ++;
|
pointer ++;
|
||||||
// set back the pointer
|
|
||||||
fileData = reinterpret_cast <char*> (pointer);
|
|
||||||
}
|
}
|
||||||
else if (memcmp (fileData, "TEXB0001", 9) == 0)
|
else if (memcmp (fileData, "TEXB0001", 9) == 0)
|
||||||
{
|
{
|
||||||
this->m_header->containerVersion = ContainerVersion::TEXB0001;
|
this->m_header->containerVersion = ContainerVersion::TEXB0001;
|
||||||
|
|
||||||
// get back the pointer and use it
|
// skip 4 bytes
|
||||||
pointer = reinterpret_cast <uint32_t*> (afterFileData);
|
|
||||||
pointer ++;
|
pointer ++;
|
||||||
// set back the pointer
|
|
||||||
fileData = reinterpret_cast <char*> (pointer);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -255,9 +247,6 @@ void CTexture::parseHeader (char* fileData)
|
|||||||
throw std::runtime_error ("RG88 format is not supported yet");
|
throw std::runtime_error ("RG88 format is not supported yet");
|
||||||
}
|
}
|
||||||
|
|
||||||
// get back an integer pointer
|
|
||||||
pointer = reinterpret_cast <uint32_t*> (fileData);
|
|
||||||
|
|
||||||
// read the number of mipmaps available
|
// read the number of mipmaps available
|
||||||
this->m_header->mipmapCount = *pointer ++;
|
this->m_header->mipmapCount = *pointer ++;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user