libragephoto Version: 0.5.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
RagePhotoA Class Reference

GTA V and RDR 2 Photo Parser (C API wrapper). More...

#include <RagePhotoA.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 char *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 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 *ragePhotoData, 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 (C API wrapper).

Member Enumeration Documentation

◆ DefaultSize

enum RagePhotoA::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 RagePhotoA::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 RagePhotoA::PhotoFormat : uint32_t

Photo Formats

Enumerator
GTA5 

GTA V Photo Format

RDR2 

RDR 2 Photo Format

◆ SignInitials

enum RagePhotoA::SignInitials : uint32_t

Sign Initials

Enumerator
SIGTA5 

GTA V Sign Initial

SIRDR2 

RDR 2 Sign Initial

Member Function Documentation

◆ addParser()

void RagePhotoA::addParser ( RagePhotoFormatParser rp_parser)
inline

Add a custom defined RagePhotoFormatParser.

◆ clear() [1/2]

void RagePhotoA::clear ( )
inline

Resets the RagePhotoData object to default values.

◆ clear() [2/2]

static void RagePhotoA::clear ( RagePhotoData rp_data)
inlinestatic

Resets the RagePhotoData object to default values.

◆ data()

RagePhotoData * RagePhotoA::data ( )
inline

Returns the internal RagePhotoData object.

◆ description()

const char * RagePhotoA::description ( ) const
inline

Returns the Photo description.

◆ error()

int32_t RagePhotoA::error ( ) const
inline

Returns the last error occurred.

◆ format()

uint32_t RagePhotoA::format ( ) const
inline

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

◆ header()

const char * RagePhotoA::header ( ) const
inline

Returns the Photo header.

◆ jpeg()

const std::string RagePhotoA::jpeg ( ) const
inline

Returns the Photo JPEG data.

◆ jpeg_view()

const std::string_view RagePhotoA::jpeg_view ( ) const
inline

Returns the Photo JPEG data.

◆ jpegData()

const char * RagePhotoA::jpegData ( ) const
inline

Returns the Photo JPEG data.

◆ jpegSign() [1/4]

uint64_t RagePhotoA::jpegSign ( ) const
inline

Returns the Photo JPEG sign.

◆ jpegSign() [2/4]

static uint64_t RagePhotoA::jpegSign ( RagePhotoData rp_data)
inlinestatic

Returns the Photo JPEG sign.

◆ jpegSign() [3/4]

uint64_t RagePhotoA::jpegSign ( uint32_t  photoFormat) const
inline

Returns the Photo JPEG sign.

◆ jpegSign() [4/4]

static uint64_t RagePhotoA::jpegSign ( uint32_t  photoFormat,
RagePhotoData rp_data 
)
inlinestatic

Returns the Photo JPEG sign.

◆ jpegSize()

uint32_t RagePhotoA::jpegSize ( ) const
inline

Returns the Photo JPEG data size.

◆ json()

const char * RagePhotoA::json ( ) const
inline

Returns the Photo JSON data.

◆ load() [1/3]

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

Loads a Photo from a const char*.

Parameters
dataPhoto data
sizePhoto data size

◆ load() [2/3]

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

Loads a Photo from a const char*.

◆ load() [3/3]

bool RagePhotoA::load ( const std::string &  data)
inline

Loads a Photo from a std::string.

Parameters
dataPhoto data

◆ loadFile()

bool RagePhotoA::loadFile ( const char *  filename)
inline

Loads a Photo from a file.

Parameters
filenameFile to load

◆ save() [1/6]

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

Saves a Photo to a std::string.

Parameters
oktrue when saved successfully

◆ save() [2/6]

bool RagePhotoA::save ( char *  data)
inline

Saves a Photo to a char*.

Parameters
dataPhoto data

◆ save() [3/6]

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

Saves a Photo to a char*.

◆ save() [4/6]

bool RagePhotoA::save ( char *  data,
uint32_t  photoFormat 
)
inline

Saves a Photo to a char*.

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

◆ save() [5/6]

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

Saves a Photo to a char*.

◆ save() [6/6]

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

Saves a Photo to a std::string.

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

◆ saveFile() [1/2]

bool RagePhotoA::saveFile ( const char *  filename)
inline

Saves a Photo to a file.

◆ saveFile() [2/2]

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

Saves a Photo to a file.

◆ saveSize() [1/4]

size_t RagePhotoA::saveSize ( )
inline

Returns the Photo save file size.

◆ saveSize() [2/4]

static size_t RagePhotoA::saveSize ( RagePhotoData rp_data,
RagePhotoFormatParser rp_parser 
)
inlinestatic

Returns the Photo save file size.

◆ saveSize() [3/4]

size_t RagePhotoA::saveSize ( uint32_t  photoFormat)
inline

Returns the Photo save file size.

◆ saveSize() [4/4]

static size_t RagePhotoA::saveSize ( uint32_t  photoFormat,
RagePhotoData rp_data,
RagePhotoFormatParser rp_parser 
)
inlinestatic

Returns the Photo save file size.

◆ setBufferDefault() [1/2]

void RagePhotoA::setBufferDefault ( )
inline

Sets all cross-format Buffer to default size.

◆ setBufferDefault() [2/2]

static void RagePhotoA::setBufferDefault ( RagePhotoData rp_data)
inlinestatic

Sets all cross-format Buffer to default size.

◆ setBufferOffsets() [1/2]

void RagePhotoA::setBufferOffsets ( )
inline

Moves all Buffer offsets to correct position.

◆ setBufferOffsets() [2/2]

static void RagePhotoA::setBufferOffsets ( RagePhotoData rp_data)
inlinestatic

Moves all Buffer offsets to correct position.

◆ setData()

bool RagePhotoA::setData ( RagePhotoData ragePhotoData,
bool  takeCopy = true 
)
inline

Sets the internal RagePhotoData object.

◆ setDescription()

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

Sets the Photo description.

◆ setFormat()

void RagePhotoA::setFormat ( uint32_t  photoFormat)
inline

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

◆ setHeader()

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

Sets the Photo header.

◆ setJpeg() [1/2]

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

Sets the Photo JPEG data.

Parameters
dataJPEG data
sizeJPEG data size
bufferSizeJPEG buffer size

◆ setJpeg() [2/2]

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

Sets the Photo JPEG data.

Parameters
dataJPEG data
bufferSizeJPEG buffer size

◆ setJson()

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

Sets the Photo JSON data.

◆ setTitle()

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

Sets the Photo title.

◆ title()

const char * RagePhotoA::title ( ) const
inline

Returns the Photo title.

◆ version()

static const char * RagePhotoA::version ( )
inlinestatic

Returns the library version.


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