diff --git a/src/RagePhoto.cpp b/src/RagePhoto.cpp index 93dd817..fdfda0f 100644 --- a/src/RagePhoto.cpp +++ b/src/RagePhoto.cpp @@ -1171,12 +1171,22 @@ void ragephoto_clear(ragephoto_t instance) ragePhoto->clear(); } +void ragephotodata_clear(RagePhotoData *rp_data) +{ + RagePhoto::clear(rp_data); +} + ragephoto_bool_t ragephoto_load(ragephoto_t instance, const char *data, size_t size) { RagePhoto *ragePhoto = static_cast(instance); return ragePhoto->load(data, size); } +ragephoto_bool_t ragephotodata_load(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser, const char *data, size_t size) +{ + return RagePhoto::load(rp_data, rp_parser, data, size); +} + ragephoto_bool_t ragephoto_loadfile(ragephoto_t instance, const char *filename) { RagePhoto *ragePhoto = static_cast(instance); @@ -1263,12 +1273,22 @@ size_t ragephoto_getsavesize(ragephoto_t instance) return ragePhoto->saveSize(); } +size_t ragephotodata_getsavesize(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser) +{ + return RagePhoto::saveSize(rp_data, rp_parser); +} + size_t ragephoto_getsavesizef(ragephoto_t instance, uint32_t photoFormat) { RagePhoto *ragePhoto = static_cast(instance); return ragePhoto->saveSize(photoFormat); } +size_t ragephotodata_getsavesizef(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser, uint32_t photoFormat) +{ + return RagePhoto::saveSize(rp_data, rp_parser, photoFormat); +} + ragephoto_bool_t ragephoto_save(ragephoto_t instance, char *data) { RagePhoto *ragePhoto = static_cast(instance); @@ -1299,12 +1319,22 @@ void ragephoto_setbufferdefault(ragephoto_t instance) ragePhoto->setBufferDefault(); } +void ragephotodata_setbufferdefault(RagePhotoData *rp_data) +{ + RagePhoto::setBufferDefault(rp_data); +} + void ragephoto_setbufferoffsets(ragephoto_t instance) { RagePhoto *ragePhoto = static_cast(instance); ragePhoto->setBufferOffsets(); } +void ragephotodata_setbufferoffsets(RagePhotoData *rp_data) +{ + RagePhoto::setBufferOffsets(rp_data); +} + ragephoto_bool_t ragephoto_setphotodata(ragephoto_t instance, RagePhotoData *rp_data) { RagePhoto *ragePhoto = static_cast(instance); diff --git a/src/RagePhotoA.h b/src/RagePhotoA.h index b435a4c..9c3d259 100644 --- a/src/RagePhotoA.h +++ b/src/RagePhotoA.h @@ -98,7 +98,15 @@ public: ~RagePhotoA() { ragephoto_close(instance); } - /** Resets the RagePhoto instance to default values. */ + /** Add a custom defined RagePhotoFormatParser. */ + void addParser(RagePhotoFormatParser *rp_parser) { + ragephoto_addparser(instance, rp_parser); + } + /** Resets the RagePhotoData object to default values. */ + static void clear(RagePhotoData *rp_data) { + ragephotodata_clear(rp_data); + } + /** Resets the RagePhotoData object to default values. */ void clear() { ragephoto_clear(instance); } @@ -106,6 +114,10 @@ public: RagePhotoData* data() { return ragephoto_getphotodata(instance); } + /** Loads a Photo from a const char*. */ + static bool load(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser, const char *data, size_t size) { + return ragephotodata_load(rp_data, rp_parser, data, size); + } /** Loads a Photo from a const char*. * \param data Photo data * \param size Photo data size @@ -211,6 +223,14 @@ public: return ragephoto_savefile(instance, filename); } /** Returns the Photo save file size. */ + static size_t saveSize(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser, uint32_t photoFormat) { + return ragephotodata_getsavesizef(rp_data, rp_parser, photoFormat); + } + /** Returns the Photo save file size. */ + static size_t saveSize(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser) { + return ragephotodata_getsavesize(rp_data, rp_parser); + } + /** Returns the Photo save file size. */ size_t saveSize(uint32_t photoFormat) { return ragephoto_getsavesizef(instance, photoFormat); } @@ -219,10 +239,18 @@ public: return ragephoto_getsavesize(instance); } /** Sets all cross-format Buffer to default size. */ + static void setBufferDefault(RagePhotoData *rp_data) { + ragephotodata_setbufferdefault(rp_data); + } + /** Sets all cross-format Buffer to default size. */ void setBufferDefault() { ragephoto_setbufferdefault(instance); } /** Moves all Buffer offsets to correct position. */ + static void setBufferOffsets(RagePhotoData *rp_data) { + ragephotodata_setbufferoffsets(rp_data); + } + /** Moves all Buffer offsets to correct position. */ void setBufferOffsets() { ragephoto_setbufferoffsets(instance); } diff --git a/src/RagePhotoC.h b/src/RagePhotoC.h index 0aae084..aac1bfc 100644 --- a/src/RagePhotoC.h +++ b/src/RagePhotoC.h @@ -45,11 +45,16 @@ LIBRAGEPHOTO_C_BINDING ragephoto_t ragephoto_open(); */ LIBRAGEPHOTO_C_BINDING void ragephoto_addparser(ragephoto_t instance, RagePhotoFormatParser *rp_parser); -/** Resets the \p ragephoto_t instance to default values. +/** Resets the RagePhotoData object to default values. * \param instance \p ragephoto_t instance */ LIBRAGEPHOTO_C_BINDING void ragephoto_clear(ragephoto_t instance); +/** Resets the RagePhotoData object to default values. +* \param rp_data RagePhotoData object +*/ +LIBRAGEPHOTO_C_BINDING void ragephotodata_clear(RagePhotoData *rp_data); + /** Loads a Photo from a const char*. * \param instance \p ragephoto_t instance * \param data Photo data @@ -57,6 +62,14 @@ LIBRAGEPHOTO_C_BINDING void ragephoto_clear(ragephoto_t instance); */ LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephoto_load(ragephoto_t instance, const char *data, size_t size); +/** Loads a Photo from a const char*. +* \param rp_data RagePhotoData object +* \param rp_parser RagePhotoFormatParser parser array +* \param data Photo data +* \param size Photo data size +*/ +LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephotodata_load(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser, const char *data, size_t size); + /** Loads a Photo from a file. * \param instance \p ragephoto_t instance * \param filename File to load @@ -125,12 +138,25 @@ LIBRAGEPHOTO_C_BINDING const char* ragephoto_getphototitle(ragephoto_t instance) */ LIBRAGEPHOTO_C_BINDING size_t ragephoto_getsavesize(ragephoto_t instance); +/** Returns the Photo save file size. +* \param rp_data RagePhotoData object +* \param rp_parser RagePhotoFormatParser parser array +*/ +LIBRAGEPHOTO_C_BINDING size_t ragephotodata_getsavesize(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser); + /** Returns the Photo save file size. * \param instance \p ragephoto_t instance * \param photoFormat Photo Format (GTA V or RDR 2) */ LIBRAGEPHOTO_C_BINDING size_t ragephoto_getsavesizef(ragephoto_t instance, uint32_t photoFormat); +/** Returns the Photo save file size. +* \param rp_data RagePhotoData object +* \param rp_parser RagePhotoFormatParser parser array +* \param photoFormat Photo Format (GTA V or RDR 2) +*/ +LIBRAGEPHOTO_C_BINDING size_t ragephotodata_getsavesizef(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser, uint32_t photoFormat); + /** Saves a Photo to a char*. * \param instance \p ragephoto_t instance * \param data Photo data @@ -162,11 +188,21 @@ LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephoto_savefilef(ragephoto_t instance */ LIBRAGEPHOTO_C_BINDING void ragephoto_setbufferdefault(ragephoto_t instance); +/** Sets all cross-format Buffer to default size. +* \param rp_data RagePhotoData object +*/ +LIBRAGEPHOTO_C_BINDING void ragephotodata_setbufferdefault(RagePhotoData *rp_data); + /** Moves all Buffer offsets to correct position. * \param instance \p ragephoto_t instance */ LIBRAGEPHOTO_C_BINDING void ragephoto_setbufferoffsets(ragephoto_t instance); +/** Moves all Buffer offsets to correct position. +* \param rp_data RagePhotoData object +*/ +LIBRAGEPHOTO_C_BINDING void ragephotodata_setbufferoffsets(RagePhotoData *rp_data); + /** Sets the internal RagePhotoData object. * \param instance \p ragephoto_t instance * \param rp_data RagePhotoData object being set