libragephoto Version: 0.1.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
RagePhoto Class Reference

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

#include <RagePhoto.h>

Public Types

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

Public Member Functions

void clear ()
 
bool load (const char *data, size_t size)
 
bool load (const std::string &data)
 
bool loadFile (const std::string &filename)
 
uint8_t error () const
 
uint32_t format () const
 
const std::string photo () const
 
const char * photoData () const
 
uint32_t photoSize () const
 
const std::string & description () const
 
const std::string & json () const
 
const std::string & header () const
 
const std::string & 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 std::string &filename, uint32_t photoFormat)
 
bool saveFile (const std::string &filename)
 
size_t saveSize (uint32_t photoFormat)
 
size_t saveSize ()
 
void setBufferDefault ()
 
void setBufferOffsets ()
 
void setDescription (const std::string &description, uint32_t bufferSize=0)
 
void setFormat (uint32_t photoFormat)
 
void setFormatLoadFunction (uint32_t photoFormat, RagePhotoLoadFunc func)
 
void setJson (const std::string &json, uint32_t bufferSize=0)
 
void setHeader (const std::string &header, uint32_t headerSum)
 
bool setPhoto (const char *data, uint32_t size, uint32_t bufferSize=0)
 
bool setPhoto (const std::string &data, uint32_t bufferSize=0)
 
void setTitle (const std::string &title, uint32_t bufferSize=0)
 

Static Public Member Functions

static const char * version ()
 
static size_t saveSize (RagePhotoData *ragePhotoData, uint32_t photoFormat)
 
static size_t saveSize (RagePhotoData *ragePhotoData)
 
static void setBufferDefault (RagePhotoData *ragePhotoData)
 
static void setBufferOffsets (RagePhotoData *ragePhotoData)
 

Detailed Description

GTA V and RDR 2 Photo Parser.

Member Enumeration Documentation

◆ DefaultSize

enum RagePhoto::DefaultSize : uint32_t

Default sizes

Enumerator
DEFAULT_GTA5_PHOTOBUFFER 

GTA V default Photo Buffer Size

DEFAULT_RDR2_PHOTOBUFFER 

RDR 2 default Photo Buffer Size

DEFAULT_DESCBUFFER 

Default Description Buffer Size

DEFAULT_JSONBUFFER 

Default JSON Buffer Size

DEFAULT_TITLBUFFER 

Default Title Buffer Size

GTA5_HEADERSIZE 

GTA V Header Size

RDR2_HEADERSIZE 

RDR 2 Header Size

◆ Error

enum RagePhoto::Error : uint8_t

Parsing and set errors

Enumerator
DescBufferTight 

Description Buffer is too tight

DescMallocError 

Description Buffer can't be allocated

DescReadError 

Description can't be read successfully

HeaderBufferTight 

Header Buffer is too tight

IncompatibleFormat 

Format is incompatible

IncompleteChecksum 

Header checksum is incomplete

IncompleteDescBuffer 

Description Buffer Size is incomplete

IncompleteDescMarker 

Description Marker is incomplete

IncompleteDescOffset 

Description Offset is incomplete

IncompleteEOF 

End Of File Offset is incomplete

IncompleteHeader 

Header is incomplete

IncompleteJendMarker 

JEND Marker is incomplete

IncompleteJpegMarker 

JPEG Marker is incomplete

IncompleteJsonBuffer 

JSON Buffer Size is incomplete

IncompleteJsonMarker 

JSON Marker incomplete

IncompleteJsonOffset 

JSON Offset incomplete

IncompletePhotoBuffer 

Photo Buffer Size is incomplete

IncompletePhotoSize 

Photo Size is incomplete

IncompleteTitleBuffer 

Title Buffer Size is incomplete

IncompleteTitleMarker 

Title Marker is incomplete

IncompleteTitleOffset 

Title Offset is incomplete

IncorrectDescMarker 

Description Marker is incorrect

IncorrectJendMarker 

JEND Marker is incorrect

IncorrectJpegMarker 

JPEG Marker is incorrect

IncorrectJsonMarker 

JSON Marker is incorrect

IncorrectTitleMarker 

Title Marker is incorrect

JsonBufferTight 

JSON Buffer is too tight

JsonMallocError 

JSON Buffer can't be allocated

JsonReadError 

JSON can't be read successfully

NoError 

Finished without errors

NoFormatIdentifier 

No format detected, empty file

PhotoBufferTight 

Photo Buffer is too tight

PhotoMallocError 

Photo Buffer can't be allocated

PhotoReadError 

Photo can't be read

TitleBufferTight 

Title Buffer is too tight

TitleMallocError 

Title Buffer can't be allocated

TitleReadError 

Title can't be read

UnicodeHeaderError 

Header can't be decoded

UnicodeInitError 

Failed to initialise Unicode decoder

Uninitialised 

Uninitialised, file access failed

◆ PhotoFormat

enum RagePhoto::PhotoFormat : uint32_t

Photo Formats

Enumerator
GTA5 

GTA V Photo Format

RDR2 

RDR 2 Photo Format

Member Function Documentation

◆ clear()

void RagePhoto::clear ( )

Resets the RagePhoto instance to default values.

◆ description()

const std::string & RagePhoto::description ( ) const

Returns the Photo description.

◆ error()

uint8_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 std::string & RagePhoto::header ( ) const

Returns the Photo header.

◆ json()

const std::string & RagePhoto::json ( ) const

Returns the Photo JSON data.

◆ load() [1/2]

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

Loads a Photo from a const char*.

Parameters
dataPhoto data
sizePhoto data size

◆ load() [2/2]

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

◆ photo()

const std::string RagePhoto::photo ( ) const

Returns the Photo JPEG data.

◆ photoData()

const char * RagePhoto::photoData ( ) const

Returns the Photo JPEG data.

◆ photoSize()

uint32_t RagePhoto::photoSize ( ) const

Returns the Photo JPEG data size.

◆ save() [1/4]

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

Saves a Photo to a std::string.

Parameters
oktrue when saved successfully

◆ save() [2/4]

bool RagePhoto::save ( char *  data)

Saves a Photo to a char*.

Parameters
dataPhoto data

◆ save() [3/4]

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() [4/4]

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 std::string &  filename)

Saves a Photo to a file.

◆ saveFile() [2/2]

bool RagePhoto::saveFile ( const std::string &  filename,
uint32_t  photoFormat 
)

Saves a Photo to a file.

◆ saveSize() [1/4]

size_t RagePhoto::saveSize ( )
inline

Returns the Photo save file size.

◆ saveSize() [2/4]

size_t RagePhoto::saveSize ( RagePhotoData ragePhotoData)
inlinestatic

Returns the Photo save file size.

◆ saveSize() [3/4]

size_t RagePhoto::saveSize ( RagePhotoData ragePhotoData,
uint32_t  photoFormat 
)
inlinestatic

Returns the Photo save file size.

◆ saveSize() [4/4]

size_t RagePhoto::saveSize ( uint32_t  photoFormat)
inline

Returns the Photo save file size.

◆ setBufferDefault() [1/2]

void RagePhoto::setBufferDefault ( )
inline

Sets all cross-format Buffer to default size.

◆ setBufferDefault() [2/2]

void RagePhoto::setBufferDefault ( RagePhotoData ragePhotoData)
inlinestatic

Sets all cross-format Buffer to default size.

◆ setBufferOffsets() [1/2]

void RagePhoto::setBufferOffsets ( )
inline

Moves all Buffer offsets to correct position.

◆ setBufferOffsets() [2/2]

void RagePhoto::setBufferOffsets ( RagePhotoData ragePhotoData)
inlinestatic

Moves all Buffer offsets to correct position.

◆ setDescription()

void RagePhoto::setDescription ( const std::string &  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).

◆ setFormatLoadFunction()

void RagePhoto::setFormatLoadFunction ( uint32_t  photoFormat,
RagePhotoLoadFunc  func 
)

Sets a custom Photo Format load function.

◆ setHeader()

void RagePhoto::setHeader ( const std::string &  header,
uint32_t  headerSum 
)

Sets the Photo header. (EXPERT ONLY)

◆ setJson()

void RagePhoto::setJson ( const std::string &  json,
uint32_t  bufferSize = 0 
)

Sets the Photo JSON data.

◆ setPhoto() [1/2]

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

Sets the Photo JPEG data.

Parameters
dataJPEG data
sizeJPEG data size
bufferSizeJPEG buffer size

◆ setPhoto() [2/2]

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

Sets the Photo JPEG data.

Parameters
dataJPEG data
bufferSizeJPEG buffer size

◆ setTitle()

void RagePhoto::setTitle ( const std::string &  title,
uint32_t  bufferSize = 0 
)

Sets the Photo title.

◆ title()

const std::string & 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: