V-Gears 0
Free Final Fantasy VII engine.
TexFile Class Reference

#include <TexFile.h>

Collaboration diagram for TexFile:

Public Member Functions

 TexFile (File file)
 Constructor. More...
 
 TexFile (std::string path)
 Constructor. More...
 
 ~TexFile ()
 Destructor. More...
 
void SavePng (std::string file_name, unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned int palette=0)
 Saves a fragment of the TEX file as a PNG file. More...
 
void SavePng (std::string file_name, unsigned int palette=0)
 Saves the TEX file as a PNG file. More...
 
void SavePng (std::string file_name, unsigned int x1, unsigned int x2, unsigned int y1, unsigned int y2, unsigned int w1, unsigned int w2, unsigned int h, unsigned int palette=0)
 Saves two fragments of the TEX file as a single PNG image. More...
 

Private Member Functions

void Read (File file)
 Reads data from a file. More...
 

Private Attributes

u32 version_
 File format version. More...
 
u32 unknown_0_
 Unknown data. More...
 
u32 colour_key_
 Color key flag. More...
 
u32 unknown_1_
 Unknown data. More...
 
u32 unknown_2_
 Unknown data. More...
 
u32 min_bpc_
 Minimum bits per color. More...
 
u32 max_bpc_
 Maximum bits per color. More...
 
u32 min_alpha_bits_
 Minimum alpha bits. More...
 
u32 max_alpha_bits_
 Minimum alpha bits. More...
 
u32 min_bpp_
 Minimum bits per pixel. More...
 
u32 max_bpp_
 Maximum bits per pixel. More...
 
u32 unknown_3_
 Unknown data. More...
 
u32 palette_count_
 Number of colour palettes. More...
 
u32 palette_colour_count_
 Number of colours per palette. More...
 
u32 bit_depth_
 Bit depth. More...
 
u32 width_
 Image width. More...
 
u32 height_
 Image height. More...
 
u32 pitch_
 Pitch or bytes per row. More...
 
u32 unknown_4_
 Unknown data. More...
 
u32 has_palette_
 Indicates a paletted image. More...
 
u32 bits_per_index_
 Bits per index. More...
 
u32 indexed_to_8_bit_
 Indexed to 8 bit flag. More...
 
u32 palette_size_
 Palette size. More...
 
u32 colours_per_palette_
 Number of colours per palette. More...
 
u32 run_0_
 Runtime data. More...
 
u32 bits_per_pixel_
 Bits per pixel. More...
 
u32 bytes_per_pixel_
 Bytes per pixel. More...
 
u32 bits_red_
 Number of red bits. More...
 
u32 bits_green_
 Number of green bits. More...
 
u32 bits_blue_
 Number of blue bits. More...
 
u32 bits_alpha_
 Number of alpha bits. More...
 
u32 bitmask_red_
 Red shift. More...
 
u32 bitmask_green_
 Green bitmask. More...
 
u32 bitmask_blue_
 Blue bitmask. More...
 
u32 bitmask_alpha_
 Alpha bitmask. More...
 
u32 shift_red_
 Red shift. More...
 
u32 shift_green_
 Green shift. More...
 
u32 shift_blue_
 Blue shift. More...
 
u32 shift_alpha_
 Alpha shift. More...
 
u32 bits_red_2_
 Red bits. More...
 
u32 bits_green_2_
 Green bits. More...
 
u32 bits_blue_2_
 Blue bits. More...
 
u32 bits_alpha_2_
 Alpha bits. More...
 
u32 max_red_
 Max value for red colour. More...
 
u32 max_green_
 Max value for green colour. More...
 
u32 max_blue_
 Max value for blue colour. More...
 
u32 max_alpha_
 Max alpha value. More...
 
u32 colour_k_array_
 Colour key array flag. More...
 
u32 run_1_
 Runtime data. More...
 
u32 ref_alpha_
 Alpha reference value. More...
 
u32 run_2_
 Runtime data. More...
 
u32 unknown_5_
 Unknown data. More...
 
u32 palette_index_
 Palette index. More...
 
u32 run_3_
 Runtime data. More...
 
u32 run_4_
 Runtime data. More...
 
u32 unknown_6_
 Unknown data. More...
 
u32 unknown_7_
 Unknown data. More...
 
u32 unknown_8_
 Unknown data. More...
 
u32 unknown_9_
 Unknown data. More...
 
std::vector< std::vector< Ogre::ColourValue > > palettes_
 Palette data. More...
 
std::vector< Ogre::ColourValue > pixel_colour_
 Pixel data for non paletted images. More...
 
std::vector< u8pixel_ref_
 Pixel data for paletted images. More...
 
std::vector< u8colour_key_array_
 Colour key array. More...
 

Constructor & Destructor Documentation

◆ TexFile() [1/2]

TexFile::TexFile ( File  file)

Constructor.

Parameters
[in,out]fileFile with the tex data. The file data will not be modified, but it's offset will.

◆ TexFile() [2/2]

TexFile::TexFile ( std::string  path)

Constructor.

Parameters
[in]pathPath to the tex file.

◆ ~TexFile()

TexFile::~TexFile ( )

Destructor.

Member Function Documentation

◆ Read()

void TexFile::Read ( File  file)
private

Reads data from a file.

Called from constructors.

Parameters
[in]fileThe file to read from.

◆ SavePng() [1/3]

void TexFile::SavePng ( std::string  file_name,
unsigned int  palette = 0 
)

Saves the TEX file as a PNG file.

Parameters
[in]file_nameFull path of the destination file.
[in]paletteIndex of the color palette to use. For non paletted files it's ignored.

◆ SavePng() [2/3]

void TexFile::SavePng ( std::string  file_name,
unsigned int  x,
unsigned int  y,
unsigned int  w,
unsigned int  h,
unsigned int  palette = 0 
)

Saves a fragment of the TEX file as a PNG file.

Parameters
[in]file_nameFull path of the destination file.
[in]xX coordinate of the image to extract from the TEX file.
[in]yY coordinate of the image to extract from the TEX file.
[in]wWidth of the image to extract from the TEX file.
[in]hHeight of the image to extract from the TEX file.
[in]paletteIndex of the color palette to use. For non paletted files it's ignored.

◆ SavePng() [3/3]

void TexFile::SavePng ( std::string  file_name,
unsigned int  x1,
unsigned int  x2,
unsigned int  y1,
unsigned int  y2,
unsigned int  w1,
unsigned int  w2,
unsigned int  h,
unsigned int  palette = 0 
)

Saves two fragments of the TEX file as a single PNG image.

The second fragment will be at the right of the first one. They must have the same height.

Parameters
[in]file_nameFull path of the destination file.
[in]x1X coordinate of the first image to extract from the TEX file.
[in]x2X coordinate of the second image to extract from the TEX file.
[in]y1Y coordinate of the first image to extract from the TEX file.
[in]y2Y coordinate of the first image to extract from the TEX file.
[in]w1Width of the first image to extract from the TEX file.
[in]w2Width of the second image to extract from the TEX file.
[in]hHeight of the images to extract from the TEX file.
[in]paletteIndex of the color palette to use. For non paletted files it's ignored.

Member Data Documentation

◆ bit_depth_

u32 TexFile::bit_depth_
private

Bit depth.

4 Bytes.

Can be ignores, always follow {

See also
bpp}.

◆ bitmask_alpha_

u32 TexFile::bitmask_alpha_
private

Alpha bitmask.

4 bytes.

◆ bitmask_blue_

u32 TexFile::bitmask_blue_
private

Blue bitmask.

4 bytes.

◆ bitmask_green_

u32 TexFile::bitmask_green_
private

Green bitmask.

4 bytes.

◆ bitmask_red_

u32 TexFile::bitmask_red_
private

Red shift.

4 bytes.

◆ bits_alpha_

u32 TexFile::bits_alpha_
private

Number of alpha bits.

◆ bits_alpha_2_

u32 TexFile::bits_alpha_2_
private

Alpha bits.

Always 8. 4 bytes.

Unused, use {

See also
bits_alpha}.

◆ bits_blue_

u32 TexFile::bits_blue_
private

Number of blue bits.

◆ bits_blue_2_

u32 TexFile::bits_blue_2_
private

Blue bits.

Always 8. 4 bytes.

Unused, use {

See also
bits_blue}.

◆ bits_green_

u32 TexFile::bits_green_
private

Number of green bits.

◆ bits_green_2_

u32 TexFile::bits_green_2_
private

Green bits.

Always 8. 4 bytes.

Unused, use {

See also
bits_green}.

◆ bits_per_index_

u32 TexFile::bits_per_index_
private

Bits per index.

4 bytes.

For paletted images only. 0 for non-paletted.

◆ bits_per_pixel_

u32 TexFile::bits_per_pixel_
private

Bits per pixel.

◆ bits_red_

u32 TexFile::bits_red_
private

Number of red bits.

◆ bits_red_2_

u32 TexFile::bits_red_2_
private

Red bits.

Always 8. 4 bytes.

Unused, use {

See also
bits_red}.

◆ bytes_per_pixel_

u32 TexFile::bytes_per_pixel_
private

Bytes per pixel.

◆ colour_k_array_

u32 TexFile::colour_k_array_
private

Colour key array flag.

4 bytes.

Indicates the presence of a color key array,

◆ colour_key_

u32 TexFile::colour_key_
private

Color key flag.

4 bytes.

◆ colour_key_array_

std::vector<u8> TexFile::colour_key_array_
private

Colour key array.

{

See also
palette_count} bytes.

◆ colours_per_palette_

u32 TexFile::colours_per_palette_
private

Number of colours per palette.

4 bytes.

Ignore, use {

See also
palette_colour_count}

◆ has_palette_

u32 TexFile::has_palette_
private

Indicates a paletted image.

4 bytes.

◆ height_

u32 TexFile::height_
private

Image height.

4 bytes

◆ indexed_to_8_bit_

u32 TexFile::indexed_to_8_bit_
private

Indexed to 8 bit flag.

Ignored by OG and V-Gears.

◆ max_alpha_

u32 TexFile::max_alpha_
private

Max alpha value.

4 bytes.

◆ max_alpha_bits_

u32 TexFile::max_alpha_bits_
private

Minimum alpha bits.

4 bytes.

Ignored by V-Gears.

◆ max_blue_

u32 TexFile::max_blue_
private

Max value for blue colour.

4 bytes.

◆ max_bpc_

u32 TexFile::max_bpc_
private

Maximum bits per color.

4 bytes.

Ignored by V-Geas.

◆ max_bpp_

u32 TexFile::max_bpp_
private

Maximum bits per pixel.

4 bytes.

Ignored by V-Gears.

◆ max_green_

u32 TexFile::max_green_
private

Max value for green colour.

4 bytes.

◆ max_red_

u32 TexFile::max_red_
private

Max value for red colour.

4 bytes.

◆ min_alpha_bits_

u32 TexFile::min_alpha_bits_
private

Minimum alpha bits.

4 bytes.

Ignored by V-Gears.

◆ min_bpc_

u32 TexFile::min_bpc_
private

Minimum bits per color.

4 bytes.

Ignored by V-Geas.

◆ min_bpp_

u32 TexFile::min_bpp_
private

Minimum bits per pixel.

4 bytes.

Ignored by V-Gears.

◆ palette_colour_count_

u32 TexFile::palette_colour_count_
private

Number of colours per palette.

4 bytes.

◆ palette_count_

u32 TexFile::palette_count_
private

Number of colour palettes.

4 bytes.

◆ palette_index_

u32 TexFile::palette_index_
private

Palette index.

4 bytes.

Runtime data.

◆ palette_size_

u32 TexFile::palette_size_
private

Palette size.

4 bytes.

It must match {

See also
palette_count} * {
colours_per_palette}.

◆ palettes_

std::vector<std::vector<Ogre::ColourValue> > TexFile::palettes_
private

Palette data.

4 * {

See also
palette_size} bytes.

Used only for paletted images. Blocks of 32-bit BGRA colour format.

◆ pitch_

u32 TexFile::pitch_
private

Pitch or bytes per row.

4 bytes.

Ignored, use {

See also
bytes_per_pixel} * {
width}.

◆ pixel_colour_

std::vector<Ogre::ColourValue> TexFile::pixel_colour_
private

Pixel data for non paletted images.

{

See also
width} * {
height}.

◆ pixel_ref_

std::vector<u8> TexFile::pixel_ref_
private

Pixel data for paletted images.

{

See also
width} * {
height} * {
bytes_per pixels}.

In paletted images, every byte is a color reference in the palette. For non-paletted images, a pixel format section.

◆ ref_alpha_

u32 TexFile::ref_alpha_
private

Alpha reference value.

4 bytes.

Only applies to paltted images, if the alpha value sampled from the palee is 0xFE, this value should be replaced with the reference alpha.

◆ run_0_

u32 TexFile::run_0_
private

Runtime data.

V-gears ignores it.

◆ run_1_

u32 TexFile::run_1_
private

Runtime data.

4 bytes.

V-Gears ignores it.

◆ run_2_

u32 TexFile::run_2_
private

Runtime data.

4 bytes.

V-Gears ignores it.

◆ run_3_

u32 TexFile::run_3_
private

Runtime data.

4 bytes.

V-Gears ignores it.

◆ run_4_

u32 TexFile::run_4_
private

Runtime data.

4 bytes.

V-Gears ignores it.

◆ shift_alpha_

u32 TexFile::shift_alpha_
private

Alpha shift.

4 bytes.

◆ shift_blue_

u32 TexFile::shift_blue_
private

Blue shift.

4 bytes.

◆ shift_green_

u32 TexFile::shift_green_
private

Green shift.

4 bytes.

◆ shift_red_

u32 TexFile::shift_red_
private

Red shift.

4 bytes.

◆ unknown_0_

u32 TexFile::unknown_0_
private

Unknown data.

4 bytes.

◆ unknown_1_

u32 TexFile::unknown_1_
private

Unknown data.

4 bytes.

◆ unknown_2_

u32 TexFile::unknown_2_
private

Unknown data.

4 bytes.

◆ unknown_3_

u32 TexFile::unknown_3_
private

Unknown data.

4 bytes.

◆ unknown_4_

u32 TexFile::unknown_4_
private

Unknown data.

4 bytes.

◆ unknown_5_

u32 TexFile::unknown_5_
private

Unknown data.

4 bytes.

◆ unknown_6_

u32 TexFile::unknown_6_
private

Unknown data.

4 bytes.

◆ unknown_7_

u32 TexFile::unknown_7_
private

Unknown data.

4 bytes.

◆ unknown_8_

u32 TexFile::unknown_8_
private

Unknown data.

4 bytes.

◆ unknown_9_

u32 TexFile::unknown_9_
private

Unknown data.

4 bytes.

◆ version_

u32 TexFile::version_
private

File format version.

Always 1. 4 bytes.

◆ width_

u32 TexFile::width_
private

Image width.

4 bytes


The documentation for this class was generated from the following files: