libragephoto Version: 0.6.0
Loading...
Searching...
No Matches
ragephoto::photo Class Reference

GTA V and RDR 2 Photo Parser. More...

#include <RagePhoto>

Public Types

enum  DefaultSize : uint32_t {
  DEFAULT_GTA5_PHOTOBUFFER = 524288U , DEFAULT_RDR2_PHOTOBUFFER = 1048576U , DEFAULT_DESCBUFFER = 256U , DEFAULT_JSONBUFFER = 3072U ,
  DEFAULT_TITLBUFFER = 256U , GTA5_HEADERSIZE = 264U , RDR2_HEADERSIZE = 272U
}
 
enum  Error : int32_t {
  DescBufferTight = 39 , DescMallocError = 31 , DescReadError = 32 , HeaderBufferTight = 35 ,
  HeaderMallocError = 4 , IncompatibleFormat = 2 , IncompleteChecksum = 7 , IncompleteDescBuffer = 30 ,
  IncompleteDescMarker = 28 , IncompleteDescOffset = 11 , IncompleteEOF = 8 , IncompleteHeader = 3 ,
  IncompleteJendMarker = 33 , IncompleteJpegMarker = 12 , IncompleteJsonBuffer = 20 , IncompleteJsonMarker = 18 ,
  IncompleteJsonOffset = 9 , IncompletePhotoBuffer = 14 , IncompletePhotoSize = 15 , IncompleteTitleBuffer = 25 ,
  IncompleteTitleMarker = 23 , IncompleteTitleOffset = 10 , IncorrectDescMarker = 29 , IncorrectJendMarker = 34 ,
  IncorrectJpegMarker = 13 , IncorrectJsonMarker = 19 , IncorrectTitleMarker = 24 , JsonBufferTight = 37 ,
  JsonMallocError = 21 , JsonReadError = 22 , NoError = 255 , NoFormatIdentifier = 1 ,
  PhotoBufferTight = 36 , PhotoMallocError = 16 , PhotoReadError = 17 , TitleBufferTight = 38 ,
  TitleMallocError = 26 , TitleReadError = 27 , UnicodeInitError = 5 , UnicodeHeaderError = 6 ,
  Uninitialised = 0
}
 
enum  PhotoFormat : uint32_t { GTA5 = 0x01000000U , RDR2 = 0x04000000U }
 
enum  SignInitials : uint32_t { SIGTA5 = 0xE47AB81CU , SIRDR2 = 0x00FEEB1EU }
 

Public Member Functions

void addParser (RagePhotoFormatParser *rp_parser)
 
void clear ()
 
RagePhotoDatadata ()
 
bool load (const char *data, size_t size)
 
bool load (const std::string &data)
 
bool loadFile (const std::string &filename)
 
int32_t error () const
 
uint32_t format () const
 
const std::string jpeg () const
 
const std::string_view jpeg_view () const
 
const char * jpegData () const
 
uint64_t jpegSign (uint32_t photoFormat) const
 
uint64_t jpegSign () const
 
uint32_t jpegSize () const
 
const char * description () const
 
const char * header () const
 
const char * json () const
 
const char * title () const
 
bool save (char *data, uint32_t photoFormat)
 
bool save (char *data)
 
const std::string save (uint32_t photoFormat, bool *ok=nullptr)
 
const std::string save (bool *ok=nullptr)
 
bool saveFile (const char *filename, uint32_t photoFormat)
 
bool saveFile (const char *filename)
 
size_t saveSize (uint32_t photoFormat)
 
size_t saveSize ()
 
void setBufferDefault ()
 
void setBufferOffsets ()
 
bool setData (RagePhotoData *rp_data, bool takeCopy=true)
 
void setDescription (const char *description, uint32_t bufferSize=0)
 
void setFormat (uint32_t photoFormat)
 
void setHeader (const char *header, uint32_t headerSum, uint32_t headerSum2=0)
 
bool setJpeg (const char *data, uint32_t size, uint32_t bufferSize=0)
 
bool setJpeg (const std::string &data, uint32_t bufferSize=0)
 
void setJson (const char *json, uint32_t bufferSize=0)
 
void setTitle (const char *title, uint32_t bufferSize=0)
 

Static Public Member Functions

static void clear (RagePhotoData *rp_data)
 
static bool load (const char *data, size_t size, RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser)
 
static uint64_t jpegSign (uint32_t photoFormat, RagePhotoData *rp_data)
 
static uint64_t jpegSign (RagePhotoData *rp_data)
 
static const char * version ()
 
static bool save (char *data, uint32_t photoFormat, RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser)
 
static bool save (char *data, RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser)
 
static size_t saveSize (uint32_t photoFormat, RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser)
 
static size_t saveSize (RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser)
 
static void setBufferDefault (RagePhotoData *rp_data)
 
static void setBufferOffsets (RagePhotoData *rp_data)
 
static void setLibraryFlag (RagePhotoLibraryFlag flag, bool state=true)
 

Detailed Description

GTA V and RDR 2 Photo Parser.

Member Enumeration Documentation

◆ DefaultSize

Default sizes

Enumerator
DEFAULT_GTA5_PHOTOBUFFER 

GTA V default Photo Buffer Size GTA V default Photo Buffer Size

DEFAULT_RDR2_PHOTOBUFFER 

RDR 2 default Photo Buffer Size RDR 2 default Photo Buffer Size

DEFAULT_DESCBUFFER 

Default Description Buffer Size Default Description Buffer Size

DEFAULT_JSONBUFFER 

Default JSON Buffer Size Default JSON Buffer Size

DEFAULT_TITLBUFFER 

Default Title Buffer Size Default Title Buffer Size

GTA5_HEADERSIZE 

GTA V Header Size GTA V Header Size

RDR2_HEADERSIZE 

RDR 2 Header Size RDR 2 Header Size

◆ Error

enum ragephoto::photo::Error : int32_t

Parsing and set errors

Enumerator
DescBufferTight 

Description Buffer is too tight Description Buffer is too tight

DescMallocError 

Description Buffer can't be allocated Description Buffer can't be allocated

DescReadError 

Description can't be read successfully Description can't be read successfully

HeaderBufferTight 

Header Buffer is too tight Header Buffer is too tight

HeaderMallocError 

Header Buffer can't be allocated Header Buffer can't be allocated

IncompatibleFormat 

Format is incompatible Format is incompatible

IncompleteChecksum 

Header checksum is incomplete Header checksum is incomplete

IncompleteDescBuffer 

Description Buffer Size is incomplete Description Buffer Size is incomplete

IncompleteDescMarker 

Description Marker is incomplete Description Marker is incomplete

IncompleteDescOffset 

Description Offset is incomplete Description Offset is incomplete

IncompleteEOF 

End Of File Offset is incomplete End Of File Offset is incomplete

IncompleteHeader 

Header is incomplete Header is incomplete

IncompleteJendMarker 

JEND Marker is incomplete JEND Marker is incomplete

IncompleteJpegMarker 

JPEG Marker is incomplete JPEG Marker is incomplete

IncompleteJsonBuffer 

JSON Buffer Size is incomplete JSON Buffer Size is incomplete

IncompleteJsonMarker 

JSON Marker incomplete JSON Marker incomplete

IncompleteJsonOffset 

JSON Offset incomplete JSON Offset incomplete

IncompletePhotoBuffer 

Photo Buffer Size is incomplete Photo Buffer Size is incomplete

IncompletePhotoSize 

Photo Size is incomplete Photo Size is incomplete

IncompleteTitleBuffer 

Title Buffer Size is incomplete Title Buffer Size is incomplete

IncompleteTitleMarker 

Title Marker is incomplete Title Marker is incomplete

IncompleteTitleOffset 

Title Offset is incomplete Title Offset is incomplete

IncorrectDescMarker 

Description Marker is incorrect Description Marker is incorrect

IncorrectJendMarker 

JEND Marker is incorrect JEND Marker is incorrect

IncorrectJpegMarker 

JPEG Marker is incorrect JPEG Marker is incorrect

IncorrectJsonMarker 

JSON Marker is incorrect JSON Marker is incorrect

IncorrectTitleMarker 

Title Marker is incorrect Title Marker is incorrect

JsonBufferTight 

JSON Buffer is too tight JSON Buffer is too tight

JsonMallocError 

JSON Buffer can't be allocated JSON Buffer can't be allocated

JsonReadError 

JSON can't be read successfully JSON can't be read successfully

NoError 

Finished without errors Finished without errors

NoFormatIdentifier 

No format detected, empty file No format detected, empty file

PhotoBufferTight 

Photo Buffer is too tight Photo Buffer is too tight

PhotoMallocError 

Photo Buffer can't be allocated Photo Buffer can't be allocated

PhotoReadError 

Photo can't be read Photo can't be read

TitleBufferTight 

Title Buffer is too tight Title Buffer is too tight

TitleMallocError 

Title Buffer can't be allocated Title Buffer can't be allocated

TitleReadError 

Title can't be read Title can't be read

UnicodeInitError 

Failed to initialise Unicode decoder Failed to initialise Unicode decoder

UnicodeHeaderError 

Header can't be encoded/decoded successfully Header can't be encoded/decoded successfully

Uninitialised 

Uninitialised, file access failed Uninitialised, file access failed

◆ PhotoFormat

Photo Formats

Enumerator
GTA5 

GTA V Photo Format GTA V Photo Format

RDR2 

RDR 2 Photo Format RDR 2 Photo Format

◆ SignInitials

Sign Initials

Enumerator
SIGTA5 

GTA V Sign Initial GTA V Sign Initial

SIRDR2 

RDR 2 Sign Initial RDR 2 Sign Initial

Member Function Documentation

◆ addParser()

void RagePhoto::addParser ( RagePhotoFormatParser * rp_parser)

Add a custom defined RagePhotoFormatParser.

◆ clear() [1/2]

void RagePhoto::clear ( )

Resets the RagePhotoData object to default values.

◆ clear() [2/2]

void RagePhoto::clear ( RagePhotoData * rp_data)
static

Resets the RagePhotoData object to default values.

◆ data()

RagePhotoData * RagePhoto::data ( )

Returns the internal RagePhotoData object.

◆ description()

const char * RagePhoto::description ( ) const

Returns the Photo description.

◆ error()

int32_t RagePhoto::error ( ) const

Returns the last error occurred.

◆ format()

uint32_t RagePhoto::format ( ) const

Returns the Photo Format (GTA V or RDR 2).

◆ header()

const char * RagePhoto::header ( ) const

Returns the Photo header.

◆ jpeg()

const std::string RagePhoto::jpeg ( ) const

Returns the Photo JPEG data.

◆ jpeg_view()

const std::string_view RagePhoto::jpeg_view ( ) const

Returns the Photo JPEG data.

◆ jpegData()

const char * RagePhoto::jpegData ( ) const

Returns the Photo JPEG data.

◆ jpegSign() [1/4]

uint64_t RagePhoto::jpegSign ( ) const

Returns the Photo JPEG sign.

◆ jpegSign() [2/4]

uint64_t RagePhoto::jpegSign ( RagePhotoData * rp_data)
static

Returns the Photo JPEG sign.

◆ jpegSign() [3/4]

uint64_t RagePhoto::jpegSign ( uint32_t photoFormat) const

Returns the Photo JPEG sign.

◆ jpegSign() [4/4]

uint64_t RagePhoto::jpegSign ( uint32_t photoFormat,
RagePhotoData * rp_data )
static

Returns the Photo JPEG sign.

◆ jpegSize()

uint32_t RagePhoto::jpegSize ( ) const

Returns the Photo JPEG data size.

◆ json()

const char * RagePhoto::json ( ) const

Returns the Photo JSON data.

◆ load() [1/3]

bool RagePhoto::load ( const char * data,
size_t size )

Loads a Photo from a const char*.

Parameters
dataPhoto data
sizePhoto data size

◆ load() [2/3]

bool RagePhoto::load ( const char * data,
size_t size,
RagePhotoData * rp_data,
RagePhotoFormatParser * rp_parser )
static

Loads a Photo from a const char*.

◆ load() [3/3]

bool RagePhoto::load ( const std::string & data)

Loads a Photo from a std::string.

Parameters
dataPhoto data

◆ loadFile()

bool RagePhoto::loadFile ( const std::string & filename)

Loads a Photo from a file.

Parameters
filenameFile to load

◆ save() [1/6]

const std::string RagePhoto::save ( bool * ok = nullptr)

Saves a Photo to a std::string.

Parameters
oktrue when saved successfully

◆ save() [2/6]

bool RagePhoto::save ( char * data)

Saves a Photo to a char*.

Parameters
dataPhoto data

◆ save() [3/6]

bool RagePhoto::save ( char * data,
RagePhotoData * rp_data,
RagePhotoFormatParser * rp_parser )
static

Saves a Photo to a char*.

◆ save() [4/6]

bool RagePhoto::save ( char * data,
uint32_t photoFormat )

Saves a Photo to a char*.

Parameters
dataPhoto data
photoFormatPhoto Format (GTA V or RDR 2)

◆ save() [5/6]

bool RagePhoto::save ( char * data,
uint32_t photoFormat,
RagePhotoData * rp_data,
RagePhotoFormatParser * rp_parser )
static

Saves a Photo to a char*.

◆ save() [6/6]

const std::string RagePhoto::save ( uint32_t photoFormat,
bool * ok = nullptr )

Saves a Photo to a std::string.

Parameters
photoFormatPhoto Format (GTA V or RDR 2)
oktrue when saved successfully

◆ saveFile() [1/2]

bool RagePhoto::saveFile ( const char * filename)

Saves a Photo to a file.

◆ saveFile() [2/2]

bool RagePhoto::saveFile ( const char * filename,
uint32_t photoFormat )

Saves a Photo to a file.

◆ saveSize() [1/4]

size_t RagePhoto::saveSize ( )

Returns the Photo save file size.

◆ saveSize() [2/4]

size_t RagePhoto::saveSize ( RagePhotoData * rp_data,
RagePhotoFormatParser * rp_parser )
static

Returns the Photo save file size.

◆ saveSize() [3/4]

size_t RagePhoto::saveSize ( uint32_t photoFormat)

Returns the Photo save file size.

◆ saveSize() [4/4]

size_t RagePhoto::saveSize ( uint32_t photoFormat,
RagePhotoData * rp_data,
RagePhotoFormatParser * rp_parser )
static

Returns the Photo save file size.

◆ setBufferDefault() [1/2]

void RagePhoto::setBufferDefault ( )

Sets all cross-format Buffer to default size.

◆ setBufferDefault() [2/2]

void RagePhoto::setBufferDefault ( RagePhotoData * rp_data)
static

Sets all cross-format Buffer to default size.

◆ setBufferOffsets() [1/2]

void RagePhoto::setBufferOffsets ( )

Moves all Buffer offsets to correct position.

◆ setBufferOffsets() [2/2]

void RagePhoto::setBufferOffsets ( RagePhotoData * rp_data)
static

Moves all Buffer offsets to correct position.

◆ setData()

bool RagePhoto::setData ( RagePhotoData * rp_data,
bool takeCopy = true )

Sets the internal RagePhotoData object.

◆ setDescription()

void RagePhoto::setDescription ( const char * description,
uint32_t bufferSize = 0 )

Sets the Photo description.

◆ setFormat()

void RagePhoto::setFormat ( uint32_t photoFormat)

Sets the Photo Format (GTA V or RDR 2).

◆ setHeader()

void RagePhoto::setHeader ( const char * header,
uint32_t headerSum,
uint32_t headerSum2 = 0 )

Sets the Photo header.

◆ setJpeg() [1/2]

bool RagePhoto::setJpeg ( const char * data,
uint32_t size,
uint32_t bufferSize = 0 )

Sets the Photo JPEG data.

Parameters
dataJPEG data
sizeJPEG data size
bufferSizeJPEG buffer size

◆ setJpeg() [2/2]

bool RagePhoto::setJpeg ( const std::string & data,
uint32_t bufferSize = 0 )

Sets the Photo JPEG data.

Parameters
dataJPEG data
bufferSizeJPEG buffer size

◆ setJson()

void RagePhoto::setJson ( const char * json,
uint32_t bufferSize = 0 )

Sets the Photo JSON data.

◆ setLibraryFlag()

void RagePhoto::setLibraryFlag ( RagePhotoLibraryFlag flag,
bool state = true )
static

Sets a library flag.

◆ setTitle()

void RagePhoto::setTitle ( const char * title,
uint32_t bufferSize = 0 )

Sets the Photo title.

◆ title()

const char * RagePhoto::title ( ) const

Returns the Photo title.

◆ version()

const char * RagePhoto::version ( )
static

Returns the library version.


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