The pixel formats of the textures of Direct3D, the conversion of images into them, and the image files of RGBA 5551.
More...
Go to the source code of this file.
|
| DDPIXELFORMAT * | LookupPixelFormatById (int nId) |
| | Find a pixel format of textures by its identifier.
|
| int | CountBitWidth (unsigned nMask) |
| | Count the bits up to and including the highest set bit of a mask.
|
| int | CountTrailingZeroBits32 (unsigned nMask) |
| | Count the clear bits below the lowest set bit of a mask.
|
| int | PopCount32 (unsigned nMask) |
| | Count the set bits of a mask.
|
| HRESULT CALLBACK | EnumTextureFormatsCallback_MatchPreset (DDSURFACEDESC *pDesc, void *pContext) |
| | Store a texture format of the device in an entry of g_aTexturePixelFormats when it suits the entry better than the format the entry has.
|
| void | UnpackRgba5551ToRgba8 (unsigned char *pDest, const unsigned short *pSrc, int nCount) |
| | Unpack pixels of RGBA 5551 to RGBA 8888.
|
| unsigned | ConvertN64Rgba5551ToRgba8 (unsigned nColor) |
| | Convert a host-loaded N64 RGBA 5551 word to four RGBA bytes.
|
| int | ConvertRGBAToPixelFormat (void *pDest, const void *pSrc, int nSize, int nPixelFormatId) |
| | Convert pixels of RGBA 8888 to a pixel format of the device.
|
| int | ConvertRGBAToPixelFormatWithColorKey (void *pDest, const void *pSrc, int nSize, int nPixelFormatId, unsigned *pColorKey) |
| | Convert RGBA pixels, replacing alpha below 128 with the lowest green bit of the device format.
|
| void * | LoadRgba5551ImageFile (const char *pszPath, unsigned nAdlerExpected, int *pnWidth, int *pnHeight) |
| | Load an image file of RGBA 5551 pixels and convert it to pixel format 0xb.
|
The pixel formats of the textures of Direct3D, the conversion of images into them, and the image files of RGBA 5551.
◆ TEXTURE_PIXEL_FORMAT_COUNT
| #define TEXTURE_PIXEL_FORMAT_COUNT 5 |
The number of entries of g_aTexturePixelFormats.
◆ LookupPixelFormatById()
Find a pixel format of textures by its identifier.
- Parameters
-
- Returns
- The format of the device, or null for an identifier that is not known.
- Ghidra address:
- BRD3D: 0x10009830
◆ CountBitWidth()
| int CountBitWidth |
( |
unsigned | nMask | ) |
|
Count the bits up to and including the highest set bit of a mask.
- Parameters
-
- Returns
- The index of the highest set bit plus one, or 0 for an empty mask.
- Ghidra address:
- BRD3D: 0x10009880
◆ CountTrailingZeroBits32()
| int CountTrailingZeroBits32 |
( |
unsigned | nMask | ) |
|
Count the clear bits below the lowest set bit of a mask.
An empty mask does not return.
- Parameters
-
- Returns
- The index of the lowest set bit.
- Ghidra address:
- BRD3D: 0x10009860
◆ PopCount32()
| int PopCount32 |
( |
unsigned | nMask | ) |
|
Count the set bits of a mask.
- Parameters
-
- Returns
- The number of set bits.
- Ghidra address:
- BRD3D: 0x10009640
◆ EnumTextureFormatsCallback_MatchPreset()
Store a texture format of the device in an entry of g_aTexturePixelFormats when it suits the entry better than the format the entry has.
A format with more bits a pixel than wMaxBitCount of the entry is skipped, and an empty entry takes the first format of its rule. The rule depends on the identifier of the entry. 2 wants the most alpha bits up to 8, 3 wants RGB with three channels of one width up to 8, 4 and 0xc want RGB with the most alpha bits, and 0xb wants RGB with the fewest alpha bits above none.
- Parameters
-
| pDesc | The surface description of the format. |
| pContext | The entry of g_aTexturePixelFormats. |
- Returns
- Always D3DENUMRET_OK, to continue the enumeration.
- Ghidra address:
- BRD3D: 0x10009360
◆ UnpackRgba5551ToRgba8()
| void UnpackRgba5551ToRgba8 |
( |
unsigned char * | pDest, |
|
|
const unsigned short * | pSrc, |
|
|
int | nCount ) |
Unpack pixels of RGBA 5551 to RGBA 8888.
The low bits of each channel repeat bits of the channel, and an alpha bit becomes 0 or 0xff.
- Parameters
-
| pDest | Receives four bytes for each pixel. |
| pSrc | The pixels to unpack. |
| nCount | The number of pixels. |
- Ghidra address:
- BRD3D: 0x10009a50
◆ ConvertN64Rgba5551ToRgba8()
| unsigned ConvertN64Rgba5551ToRgba8 |
( |
unsigned | nColor | ) |
|
Convert a host-loaded N64 RGBA 5551 word to four RGBA bytes.
- Parameters
-
| nColor | The word loaded from the big-endian image bytes. |
- Returns
- RGBA channels from the least to the most significant byte.
- Ghidra address:
- BRD3D: 0x10027b10
◆ ConvertRGBAToPixelFormat()
| int ConvertRGBAToPixelFormat |
( |
void * | pDest, |
|
|
const void * | pSrc, |
|
|
int | nSize, |
|
|
int | nPixelFormatId ) |
Convert pixels of RGBA 8888 to a pixel format of the device.
- Parameters
-
| pDest | Receives the pixels. |
| pSrc | The pixels to convert. |
| nSize | The size of the source in bytes. |
| nPixelFormatId | The pixel format. |
- Returns
- The number of bytes written. A format of three bytes for each pixel writes none.
- Ghidra address:
- BRD3D: 0x100098a0
◆ ConvertRGBAToPixelFormatWithColorKey()
| int ConvertRGBAToPixelFormatWithColorKey |
( |
void * | pDest, |
|
|
const void * | pSrc, |
|
|
int | nSize, |
|
|
int | nPixelFormatId, |
|
|
unsigned * | pColorKey ) |
Convert RGBA pixels, replacing alpha below 128 with the lowest green bit of the device format.
- Parameters
-
| pDest | Receives the pixels. |
| pSrc | The source pixels. |
| nSize | The source byte count. |
| nPixelFormatId | The device format identifier. |
| pColorKey | Receives the transparent pixel value, even when the source byte count is zero. |
- Returns
- The output byte count.
- Ghidra address:
- BRD3D: 0x10009660
◆ LoadRgba5551ImageFile()
| void * LoadRgba5551ImageFile |
( |
const char * | pszPath, |
|
|
unsigned | nAdlerExpected, |
|
|
int * | pnWidth, |
|
|
int * | pnHeight ) |
Load an image file of RGBA 5551 pixels and convert it to pixel format 0xb.
The file has the width, the height, a word that is not read, and the pixels. A checksum that does not match ends the process.
- Parameters
-
| pszPath | The path of the image. |
| nAdlerExpected | The Adler-32 checksum of the pixels, or 0 to skip the check. |
| pnWidth | Receives the width of the image. |
| pnHeight | Receives the height of the image. |
- Returns
- The converted pixels in the shared decoding workspace.
- Ghidra address:
- BRD3D: 0x10009ad0