libragephoto: add RagePhotoB for best implementation
CMakeLists.txt: add RagePhotoB class, improve settings clarification doc/build.doc: add RAGEPHOTO_C_LIBRARY flag doc/index.doc: correct RagePhoto.h header doc/usage.doc: fix minor documentation issue, clarify class differences ragephoto-gtkviewer: use RagePhotoB class ragephoto-qtviewer: use RagePhotoB class RagePhoto-Extract.cpp: use RagePhotoB class RagePhoto.cpp: LIBRAGEPHOTO_C_API -> LIBRAGEPHOTO_CXX_C RagePhotoA.hpp: simplify brief RagePhotoB.hpp: add best implementation detection RagePhotoLibrary.h: fix WASM C API inclusion by default README.md: add RAGEPHOTO_C_LIBRARY flag
This commit is contained in:
parent
d7943e552d
commit
12507be85d
13 changed files with 81 additions and 38 deletions
|
@ -16,7 +16,7 @@
|
|||
* responsible for anything with use of the software, you are self responsible.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <RagePhoto>
|
||||
#include <RagePhotoB>
|
||||
#include <fstream>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
@ -27,18 +27,18 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
// Initialise RagePhoto
|
||||
RagePhoto ragePhoto;
|
||||
RagePhotoB ragePhoto;
|
||||
|
||||
// Load Photo
|
||||
const bool loaded = ragePhoto.loadFile(argv[1]);
|
||||
|
||||
if (!loaded) {
|
||||
const int32_t error = ragePhoto.error();
|
||||
if (error == RagePhoto::Uninitialised) {
|
||||
if (error == RagePhotoB::Uninitialised) {
|
||||
std::cout << "Failed to open file: " << argv[1] << std::endl;
|
||||
return 1;
|
||||
}
|
||||
else if (error <= RagePhoto::PhotoReadError) {
|
||||
else if (error <= RagePhotoB::PhotoReadError) {
|
||||
std::cout << "Failed to load photo" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
@ -60,9 +60,9 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
const uint32_t photoFormat = ragePhoto.format();
|
||||
if (photoFormat == RagePhoto::GTA5)
|
||||
if (photoFormat == RagePhotoB::GTA5)
|
||||
std::cout << "GTA V Photo successfully exported" << std::endl;
|
||||
else if (photoFormat == RagePhoto::RDR2)
|
||||
else if (photoFormat == RagePhotoB::RDR2)
|
||||
std::cout << "RDR 2 Photo successfully exported" << std::endl;
|
||||
else
|
||||
std::cout << "Photo successfully exported" << std::endl;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "RagePhoto.hpp"
|
||||
#ifdef LIBRAGEPHOTO_C_API
|
||||
#ifdef LIBRAGEPHOTO_CXX_C
|
||||
#include "RagePhoto.h"
|
||||
#endif
|
||||
|
||||
|
@ -1223,7 +1223,7 @@ void RagePhoto::setTitle(const char *title, uint32_t bufferSize)
|
|||
m_data->error = Error::NoError; // 255
|
||||
}
|
||||
|
||||
#ifdef LIBRAGEPHOTO_C_API
|
||||
#ifdef LIBRAGEPHOTO_CXX_C
|
||||
ragephoto_t ragephoto_open()
|
||||
{
|
||||
return static_cast<ragephoto_t>(new RagePhoto);
|
||||
|
|
|
@ -25,10 +25,7 @@
|
|||
#include <iostream>
|
||||
|
||||
/**
|
||||
* \brief ABI Stable Wrapper for RagePhoto.
|
||||
*
|
||||
* Using RagePhotoA instead of RagePhoto allows your library or application to survive more changes in the RagePhoto class,
|
||||
* disadvantages include that it doesn't always include the newest features, performance is about the same.
|
||||
* \brief GTA V and RDR 2 Photo Parser (C API wrapper).
|
||||
*/
|
||||
class RagePhotoA
|
||||
{
|
||||
|
|
1
src/RagePhotoB
Normal file
1
src/RagePhotoB
Normal file
|
@ -0,0 +1 @@
|
|||
#include "RagePhotoB.hpp"
|
43
src/RagePhotoB.hpp
Normal file
43
src/RagePhotoB.hpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*****************************************************************************
|
||||
* libragephoto RAGE Photo Parser
|
||||
* Copyright (C) 2023 Syping
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* This software is provided as-is, no warranties are given to you, we are not
|
||||
* responsible for anything with use of the software, you are self responsible.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef RAGEPHOTOB_HPP
|
||||
#define RAGEPHOTOB_HPP
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "RagePhotoLibrary.h"
|
||||
#ifdef LIBRAGEPHOTO_CXX_ONLY
|
||||
#include "RagePhoto.hpp"
|
||||
typedef RagePhoto RagePhotoB;
|
||||
#elif defined LIBRAGEPHOTO_CXX_C
|
||||
#ifdef LIBRAGEPHOTO_STATIC
|
||||
#include "RagePhoto.hpp"
|
||||
typedef RagePhoto RagePhotoB;
|
||||
#else
|
||||
#include "RagePhotoA.hpp"
|
||||
typedef RagePhotoA RagePhotoB;
|
||||
#endif // LIBRAGEPHOTO_STATIC
|
||||
#elif defined LIBRAGEPHOTO_C_ONLY
|
||||
#include "RagePhotoA.hpp"
|
||||
typedef RagePhotoA RagePhotoB;
|
||||
#else
|
||||
#error "Could not determine best RagePhoto implementation, libragephoto installation might be corrupt!"
|
||||
#endif // LIBRAGEPHOTO_CXX_ONLY
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // RAGEPHOTOB_HPP
|
|
@ -57,12 +57,13 @@
|
|||
#endif // _WIN32
|
||||
/* RAGEPHOTO LIBRARY BINDING END */
|
||||
|
||||
/* ENABLE C API FOR RAGEPHOTO WASM LIBRARY BEGIN */
|
||||
/* ENABLE C API FOR LIBRAGEPHOTO WASM LIBRARY BEGIN */
|
||||
#ifdef LIBRAGEPHOTO_WASM
|
||||
#ifndef RAGEPHOTO_C_API
|
||||
#define RAGEPHOTO_C_API
|
||||
#endif // RAGEPHOTO_C_API
|
||||
#ifdef LIBRAGEPHOTO_CXX_ONLY
|
||||
#undef LIBRAGEPHOTO_CXX_ONLY
|
||||
#define LIBRAGEPHOTO_CXX_C
|
||||
#endif // LIBRAGEPHOTO_CXX_ONLY
|
||||
#endif // LIBRAGEPHOTO_WASM
|
||||
/* ENABLE C API FOR RAGEPHOTO WASM LIBRARY END */
|
||||
/* ENABLE C API FOR LIBRAGEPHOTO WASM LIBRARY END */
|
||||
|
||||
#endif // RAGEPHOTOLIBRARY_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue