Compare commits
No commits in common. "master" and "0.8.0" have entirely different histories.
11 changed files with 47 additions and 60 deletions
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
cmake_policy(VERSION 3.16...3.28)
|
||||
project(ragephoto VERSION 0.8.2 LANGUAGES C CXX)
|
||||
project(ragephoto VERSION 0.8.0 LANGUAGES C CXX)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# RagePhoto CMake includes
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#[[**************************************************************************
|
||||
* libragephoto RAGE Photo Parser
|
||||
* Copyright (C) 2021-2025 Syping
|
||||
* Copyright (C) 2021-2024 Syping
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
|
@ -16,8 +16,7 @@
|
|||
* responsible for anything with use of the software, you are self responsible.
|
||||
****************************************************************************]]
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
cmake_policy(VERSION 3.16...3.28)
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
find_package(Doxygen REQUIRED)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#[[**************************************************************************
|
||||
* libragephoto RAGE Photo Parser
|
||||
* Copyright (C) 2021-2025 Syping
|
||||
* Copyright (C) 2021-2022 Syping
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
|
@ -16,8 +16,7 @@
|
|||
* responsible for anything with use of the software, you are self responsible.
|
||||
****************************************************************************]]
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
cmake_policy(VERSION 3.16...3.28)
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
project(ragephoto-gtkviewer LANGUAGES CXX)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
|
|
@ -36,7 +35,7 @@ if (TARGET ragephoto)
|
|||
set(RAGEPHOTO_LIBRARIES ragephoto)
|
||||
set(RAGEPHOTO_LIBRARY_DIRS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
|
||||
else()
|
||||
pkg_check_modules(RAGEPHOTO REQUIRED ragephoto>=0.8)
|
||||
pkg_check_modules(RAGEPHOTO REQUIRED ragephoto>=0.6)
|
||||
endif()
|
||||
|
||||
add_executable(ragephoto-gtkviewer WIN32 ${GTKVIEWER_SOURCES})
|
||||
|
|
@ -45,6 +44,8 @@ set_target_properties(ragephoto-gtkviewer PROPERTIES
|
|||
)
|
||||
target_compile_options(ragephoto-gtkviewer PRIVATE ${GTKMM_CFLAGS} ${RAGEPHOTO_CFLAGS})
|
||||
target_link_libraries(ragephoto-gtkviewer PRIVATE ${GTKMM_LIBRARIES} ${RAGEPHOTO_LIBRARIES})
|
||||
target_link_directories(ragephoto-gtkviewer PRIVATE ${GTKMM_LIBRARY_DIRS} ${RAGEPHOTO_LIBRARY_DIRS})
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.13.0")
|
||||
target_link_directories(ragephoto-gtkviewer PRIVATE ${GTKMM_LIBRARY_DIRS} ${RAGEPHOTO_LIBRARY_DIRS})
|
||||
endif()
|
||||
target_include_directories(ragephoto-gtkviewer PRIVATE ${GTKMM_INCLUDE_DIRS} ${RAGEPHOTO_INCLUDE_DIRS})
|
||||
install(TARGETS ragephoto-gtkviewer DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#[[**************************************************************************
|
||||
* libragephoto RAGE Photo Parser
|
||||
* Copyright (C) 2021-2025 Syping
|
||||
* Copyright (C) 2021-2022 Syping
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
|
@ -16,8 +16,7 @@
|
|||
* responsible for anything with use of the software, you are self responsible.
|
||||
****************************************************************************]]
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
cmake_policy(VERSION 3.16...3.28)
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
project(ragephoto-qtviewer LANGUAGES CXX)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
|
|
@ -42,7 +41,7 @@ if (TARGET ragephoto)
|
|||
set(RAGEPHOTO_LIBRARY_DIRS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
|
||||
else()
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(RAGEPHOTO REQUIRED ragephoto>=0.8)
|
||||
pkg_check_modules(RAGEPHOTO REQUIRED ragephoto>=0.6)
|
||||
endif()
|
||||
|
||||
add_executable(ragephoto-qtviewer WIN32 ${QTVIEWER_SOURCES})
|
||||
|
|
@ -51,6 +50,8 @@ set_target_properties(ragephoto-qtviewer PROPERTIES
|
|||
)
|
||||
target_compile_options(ragephoto-qtviewer PRIVATE ${RAGEPHOTO_CFLAGS})
|
||||
target_link_libraries(ragephoto-qtviewer PRIVATE Qt${QT_VERSION_MAJOR}::Widgets ${RAGEPHOTO_LIBRARIES})
|
||||
target_link_directories(ragephoto-qtviewer PRIVATE ${RAGEPHOTO_LIBRARY_DIRS})
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.13.0")
|
||||
target_link_directories(ragephoto-qtviewer PRIVATE ${RAGEPHOTO_LIBRARY_DIRS})
|
||||
endif()
|
||||
target_include_directories(ragephoto-qtviewer PRIVATE ${RAGEPHOTO_INCLUDE_DIRS})
|
||||
install(TARGETS ragephoto-qtviewer DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
|
|
|||
|
|
@ -972,14 +972,10 @@ bool ragephotodata_savef(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parse
|
|||
#endif
|
||||
}
|
||||
else if (photoFormat == RAGEPHOTO_FORMAT_JPEG) {
|
||||
if (rp_data->jpeg) {
|
||||
const size_t length = ragephotodata_getsavesizef(rp_data, NULL, photoFormat);
|
||||
size_t pos = 0;
|
||||
writeBuffer(rp_data->jpeg, data, &pos, rp_data->jpegSize, rp_data->jpegSize);
|
||||
}
|
||||
else {
|
||||
rp_data->error = RAGEPHOTO_ERROR_PHOTOREADERROR; // 17
|
||||
return false;
|
||||
}
|
||||
|
||||
writeBuffer(rp_data->jpeg, data, &pos, length, rp_data->jpegSize);
|
||||
|
||||
rp_data->error = RAGEPHOTO_ERROR_NOERROR; // 255
|
||||
return true;
|
||||
|
|
@ -1239,7 +1235,6 @@ bool ragephoto_setphotojpeg(ragephoto_t instance, const char *data, uint32_t siz
|
|||
else if (instance->data->jpeg) {
|
||||
free(instance->data->jpeg);
|
||||
instance->data->jpeg = NULL;
|
||||
instance->data->jpegSize = 0;
|
||||
}
|
||||
|
||||
if (bufferSize != 0) {
|
||||
|
|
|
|||
|
|
@ -66,16 +66,13 @@ const char* nullchar = "";
|
|||
|
||||
/* BEGIN OF STATIC LIBRARY FUNCTIONS */
|
||||
#if defined(_WIN32) && ((RAGEPHOTO_CXX_STD < 17) || (__cplusplus < 201703L))
|
||||
inline std::wstring convertPath(const char *path)
|
||||
inline std::unique_ptr<wchar_t> convertPath(const char *path)
|
||||
{
|
||||
int wideCharSize = MultiByteToWideChar(CP_UTF8, 0, path, -1, nullptr, 0);
|
||||
if (wideCharSize <= 0)
|
||||
return {};
|
||||
std::wstring wideCharPath;
|
||||
wideCharPath.resize(wideCharSize);
|
||||
if (!MultiByteToWideChar(CP_UTF8, 0, path, -1, &wideCharPath[0], wideCharSize))
|
||||
return {};
|
||||
wideCharPath.resize(wideCharSize - 1);
|
||||
return std::unique_ptr<wchar_t>(new wchar_t[1]());
|
||||
std::unique_ptr<wchar_t> wideCharPath(new wchar_t[wideCharSize]);
|
||||
MultiByteToWideChar(CP_UTF8, 0, path, -1, wideCharPath.get(), wideCharSize);
|
||||
return wideCharPath;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -295,7 +292,7 @@ bool RagePhoto::load(const char *data, size_t length, RagePhotoData *rp_data, Ra
|
|||
rp_data->error = Error::HeaderMallocError; // 4
|
||||
return false;
|
||||
}
|
||||
memcpy(rp_data->header, photoHeader_string.data(), photoHeader_size);
|
||||
memcpy(rp_data->header, photoHeader_string.c_str(), photoHeader_size);
|
||||
#elif defined UNICODE_ICONV
|
||||
iconv_t iconv_in = iconv_open("UTF-8", "UTF-16LE");
|
||||
if (iconv_in == (iconv_t)-1) {
|
||||
|
|
@ -613,7 +610,7 @@ bool RagePhoto::loadFile(const char *filename)
|
|||
#if defined(_WIN32) && (RAGEPHOTO_CXX_STD >= 17) && (__cplusplus >= 201703L)
|
||||
std::ifstream ifs(std::filesystem::u8path(filename), std::ios::in | std::ios::binary);
|
||||
#elif defined(_WIN32)
|
||||
std::ifstream ifs(convertPath(filename).data(), std::ios::in | std::ios::binary);
|
||||
std::ifstream ifs(convertPath(filename).get(), std::ios::in | std::ios::binary);
|
||||
#else
|
||||
std::ifstream ifs(filename, std::ios::in | std::ios::binary);
|
||||
#endif
|
||||
|
|
@ -946,14 +943,10 @@ bool RagePhoto::save(char *data, uint32_t photoFormat, RagePhotoData *rp_data, R
|
|||
#endif
|
||||
}
|
||||
else if (photoFormat == PhotoFormat::JPEG) {
|
||||
if (rp_data->jpeg) {
|
||||
const size_t length = saveSize(photoFormat, rp_data, nullptr);
|
||||
size_t pos = 0;
|
||||
writeBuffer(rp_data->jpeg, data, &pos, rp_data->jpegSize, rp_data->jpegSize);
|
||||
}
|
||||
else {
|
||||
rp_data->error = Error::PhotoReadError; // 17
|
||||
return false;
|
||||
}
|
||||
|
||||
writeBuffer(rp_data->jpeg, data, &pos, length, rp_data->jpegSize);
|
||||
|
||||
rp_data->error = Error::NoError; // 255
|
||||
return true;
|
||||
|
|
@ -1015,7 +1008,7 @@ bool RagePhoto::saveFile(const char *filename, uint32_t photoFormat)
|
|||
#if defined(_WIN32) && (RAGEPHOTO_CXX_STD >= 17) && (__cplusplus >= 201703L)
|
||||
std::ofstream ofs(std::filesystem::u8path(filename), std::ios::out | std::ios::binary | std::ios::trunc);
|
||||
#elif defined(_WIN32)
|
||||
std::ofstream ofs(convertPath(filename).data(), std::ios::out | std::ios::binary | std::ios::trunc);
|
||||
std::ofstream ofs(convertPath(filename).get(), std::ios::out | std::ios::binary | std::ios::trunc);
|
||||
#else
|
||||
std::ofstream ofs(filename, std::ios::out | std::ios::binary | std::ios::trunc);
|
||||
#endif
|
||||
|
|
@ -1238,7 +1231,6 @@ bool RagePhoto::setJpeg(const char *data, uint32_t size, uint32_t bufferSize)
|
|||
else if (m_data->jpeg) {
|
||||
free(m_data->jpeg);
|
||||
m_data->jpeg = nullptr;
|
||||
m_data->jpegSize = 0;
|
||||
}
|
||||
|
||||
if (bufferSize != 0) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* libragephoto RAGE Photo Parser
|
||||
* Copyright (C) 2021-2025 Syping
|
||||
* Copyright (C) 2021-2024 Syping
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* libragephoto RAGE Photo Parser
|
||||
* Copyright (C) 2023-2025 Syping
|
||||
* Copyright (C) 2023-2024 Syping
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* libragephoto RAGE Photo Parser
|
||||
* Copyright (C) 2023-2025 Syping
|
||||
* 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,18 +1,17 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.1;net47</TargetFrameworks>
|
||||
<TargetFrameworks>netstandard2.1;net47;net8.0</TargetFrameworks>
|
||||
<AssemblyName>RagePhoto.Core</AssemblyName>
|
||||
<RootNamespace>RagePhoto</RootNamespace>
|
||||
<Version>0.8.2</Version>
|
||||
<AssemblyVersion>0.8.2</AssemblyVersion>
|
||||
<FileVersion>0.8.2</FileVersion>
|
||||
<Version>0.8.0</Version>
|
||||
<AssemblyVersion>0.8.0</AssemblyVersion>
|
||||
<FileVersion>0.8.0</FileVersion>
|
||||
<Authors>Syping</Authors>
|
||||
<Copyright>Copyright © 2025 Syping</Copyright>
|
||||
<Description>Open Source RAGE Photo Parser for GTA V and RDR 2</Description>
|
||||
<PackageLicenseExpression>BSD-2-Clause</PackageLicenseExpression>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<PackageTags>libragephoto;gta5;gtav;snapmatic;rdr2;photo</PackageTags>
|
||||
<RepositoryUrl>https://github.com/Syping/libragephoto</RepositoryUrl>
|
||||
<Nullable>disable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace RagePhoto {
|
|||
|
||||
public class Photo : IDisposable {
|
||||
|
||||
private Boolean _disposed;
|
||||
private bool _disposed;
|
||||
private readonly IntPtr _instance;
|
||||
private const String _library = "libragephoto";
|
||||
|
||||
|
|
@ -18,10 +18,10 @@ namespace RagePhoto {
|
|||
private static extern void ragephoto_close(IntPtr instance);
|
||||
[DllImport(_library, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
private static extern Boolean ragephoto_load(IntPtr instance, Byte[] data, UIntPtr size);
|
||||
private static extern bool ragephoto_load(IntPtr instance, Byte[] data, UIntPtr size);
|
||||
[DllImport(_library, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
private static extern Boolean ragephoto_loadfile(IntPtr instance, [MarshalAs(UnmanagedType.LPUTF8Str)] String filename);
|
||||
private static extern bool ragephoto_loadfile(IntPtr instance, [MarshalAs(UnmanagedType.LPUTF8Str)] String filename);
|
||||
[DllImport(_library, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
private static extern Int32 ragephoto_error(IntPtr instance);
|
||||
[DllImport(_library, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
|
|
@ -48,30 +48,30 @@ namespace RagePhoto {
|
|||
private static extern UIntPtr ragephoto_getsavesizef(IntPtr instance, UInt32 photoFormat);
|
||||
[DllImport(_library, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
private static extern Boolean ragephoto_save(IntPtr instance, [Out] Byte[] data);
|
||||
private static extern bool ragephoto_save(IntPtr instance, [Out] Byte[] data);
|
||||
[DllImport(_library, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
private static extern Boolean ragephoto_savef(IntPtr instance, [Out] Byte[] data, UInt32 photoFormat);
|
||||
private static extern bool ragephoto_savef(IntPtr instance, [Out] Byte[] data, UInt32 photoFormat);
|
||||
[DllImport(_library, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
private static extern Boolean ragephoto_savefile(IntPtr instance, [MarshalAs(UnmanagedType.LPUTF8Str)] String filename);
|
||||
private static extern bool ragephoto_savefile(IntPtr instance, [MarshalAs(UnmanagedType.LPUTF8Str)] String filename);
|
||||
[DllImport(_library, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
private static extern Boolean ragephoto_savefilef(IntPtr instance, [MarshalAs(UnmanagedType.LPUTF8Str)] String filename, UInt32 photoFormat);
|
||||
private static extern bool ragephoto_savefilef(IntPtr instance, [MarshalAs(UnmanagedType.LPUTF8Str)] String filename, UInt32 photoFormat);
|
||||
[DllImport(_library, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
private static extern void ragephoto_setbufferdefault(IntPtr instance);
|
||||
[DllImport(_library, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
private static extern void ragephoto_setbufferoffsets(IntPtr instance);
|
||||
[DllImport(_library, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
private static extern Boolean ragephoto_setphotodatac(IntPtr instance, IntPtr data);
|
||||
private static extern bool ragephoto_setphotodatac(IntPtr instance, IntPtr data);
|
||||
[DllImport(_library, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
private static extern void ragephoto_setphotodesc(IntPtr instance, [MarshalAs(UnmanagedType.LPUTF8Str)] String description, UInt32 bufferSize);
|
||||
[DllImport(_library, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
private static extern void ragephoto_setphotoformat(IntPtr instance, UInt32 photoFormat);
|
||||
[DllImport(_library, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
private static extern Boolean ragephoto_setphotojpeg(IntPtr instance, Byte[] jpeg, UInt32 size, UInt32 bufferSize);
|
||||
private static extern bool ragephoto_setphotojpeg(IntPtr instance, Byte[] jpeg, UInt32 size, UInt32 bufferSize);
|
||||
[DllImport(_library, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
private static extern void ragephoto_setphotojson(IntPtr instance, [MarshalAs(UnmanagedType.LPUTF8Str)] String json, UInt32 bufferSize);
|
||||
[DllImport(_library, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||
|
|
@ -114,7 +114,7 @@ namespace RagePhoto {
|
|||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(Boolean disposing) {
|
||||
protected virtual void Dispose(bool disposing) {
|
||||
if (_disposed)
|
||||
return;
|
||||
ragephoto_close(_instance);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue