libragephoto Version: 0.5.0
Loading...
Searching...
No Matches
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.hpp>

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 : int32_t {
  DescBufferTight = 39L , DescMallocError = 31L , DescReadError = 32L , HeaderBufferTight = 35L ,
  HeaderMallocError = 4L , IncompatibleFormat = 2L , IncompleteChecksum = 7L , IncompleteDescBuffer = 30L ,
  IncompleteDescMarker = 28L , IncompleteDescOffset = 11L , IncompleteEOF = 8L , IncompleteHeader = 3L ,
  IncompleteJendMarker = 33L , IncompleteJpegMarker = 12L , IncompleteJsonBuffer = 20L , IncompleteJsonMarker = 18L ,
  IncompleteJsonOffset = 9L , IncompletePhotoBuffer = 14L , IncompletePhotoSize = 15L , IncompleteTitleBuffer = 25L ,
  IncompleteTitleMarker = 23L , IncompleteTitleOffset = 10L , IncorrectDescMarker = 29L , IncorrectJendMarker = 34L ,
  IncorrectJpegMarker = 13L , IncorrectJsonMarker = 19L , IncorrectTitleMarker = 24L , JsonBufferTight = 37L ,
  JsonMallocError = 21L , JsonReadError = 22L , NoError = 255L , NoFormatIdentifier = 1L ,
  PhotoBufferTight = 36L , PhotoMallocError = 16L , PhotoReadError = 17L , TitleBufferTight = 38L ,
  TitleMallocError = 26L , TitleReadError = 27L , UnicodeInitError = 5L , UnicodeHeaderError = 6L ,
  Uninitialised = 0L
}
 
enum  PhotoFormat : uint32_t { GTA5 = 0x01000000UL , RDR2 = 0x04000000UL }
 
enum  SignInitials : uint32_t { SIGTA5 = 0xE47AB81CUL , SIRDR2 = 0x00FEEB1EUL }
 

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 * json () const
 
const char * header () 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 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 ()
 
bool setData (RagePhotoData *rp_data, bool takeCopy=true)
 
void setDescription (const char *description, uint32_t bufferSize=0)
 
void setFormat (uint32_t photoFormat)
 
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 setHeader (const char *header, uint32_t headerSum, uint32_t headerSum2=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)
 

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 : int32_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

HeaderMallocError 

Header Buffer can't be allocated

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

UnicodeInitError 

Failed to initialise Unicode decoder

UnicodeHeaderError 

Header can't be encoded/decoded successfully

Uninitialised 

Uninitialised, file access failed

◆ PhotoFormat

enum RagePhoto::PhotoFormat : uint32_t

Photo Formats

Enumerator
GTA5 

GTA V Photo Format

RDR2 

RDR 2 Photo Format

◆ SignInitials

enum RagePhoto::SignInitials : uint32_t

Sign Initials

Enumerator
SIGTA5 

GTA V Sign Initial

SIRDR2 

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 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 ( )

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.

◆ 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: