Compare commits

...

12 commits

Author SHA1 Message Date
Syping
a404a29188 libragephoto 0.7.1 release
- RagePhoto.c: fix memory corruption bug at ragephoto_setphotodesc
2025-10-26 23:26:51 +01:00
Syping
bb52ffb84b GitHub Actions: support macOS in .NET build 2025-10-24 22:07:59 +02:00
Syping
176fae0f03 libragephoto: update .NET version to 0.7.0.1 2025-10-24 22:01:36 +02:00
Syping
4d01b1f804 GitHub Actions: update workflows and add Linux arm64 support for .NET 2025-10-24 21:05:30 +02:00
Syping
83832a6724 libragephoto 0.7.0 release
- libragephoto: support JPEG as save format
2025-10-23 02:20:17 +02:00
Syping
c14c46cd41 GitHub Actions: fix .NET build 2025-10-23 01:48:03 +02:00
Syping
3a1d1e59b5 libragephoto: move to 0.7.0 version and other changes
- src/dotnet: move targets file to net47 only
- src/dotnet: rename Syping.RagePhoto.Core to RagePhoto.Core
- GitHub Actions: add Linux .NET build
2025-10-23 01:16:47 +02:00
Syping
cd5a160d70 GitHub Actions: build more variants 2025-10-22 02:44:47 +02:00
Syping
24a64d8740 RagePhotoLibrary.h: minor change in ordering at endian check 2025-10-21 21:53:32 +02:00
Syping
15cb5da634 RagePhoto.cpp: fix compile issues with some C++ libraries 2025-10-21 21:51:17 +02:00
Syping
8e9d4dfcc2 libragephoto: rename CMake *_LIBRARIES to *_LIBS 2025-10-21 21:47:02 +02:00
Syping
9322e1943d libragephoto: impl. linked iconv support 2025-10-21 20:05:57 +02:00
29 changed files with 360 additions and 452 deletions

187
.github/workflows/dotnet.yml vendored Normal file
View file

@ -0,0 +1,187 @@
name: .NET
on: push
jobs:
Linux_amd64:
runs-on: ubuntu-24.04
container:
image: almalinux:8
env:
BUILD_TYPE: Release
steps:
- name: Cloning
uses: actions/checkout@v5
- name: Install packages
run: dnf install -y cmake gcc gcc-c++
- name: Configure CMake
run: cmake -B "build" -DRAGEPHOTO_C_LIBRARY=ON -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build "build" --config ${{env.BUILD_TYPE}}
- name: Install
run: cmake --install "build" --config ${{env.BUILD_TYPE}} --prefix "install/"
- name: Upload
uses: actions/upload-artifact@v5
with:
name: AlmaLinux amd64
path: ${{github.workspace}}/install/
Linux_arm64:
runs-on: ubuntu-24.04-arm
container:
image: almalinux:8
env:
BUILD_TYPE: Release
steps:
- name: Cloning
uses: actions/checkout@v5
- name: Install packages
run: dnf install -y cmake gcc gcc-c++
- name: Configure CMake
run: cmake -B "build" -DRAGEPHOTO_C_LIBRARY=ON -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build "build" --config ${{env.BUILD_TYPE}}
- name: Install
run: cmake --install "build" --config ${{env.BUILD_TYPE}} --prefix "install/"
- name: Upload
uses: actions/upload-artifact@v5
with:
name: AlmaLinux arm64
path: ${{github.workspace}}/install/
macOS_amd64:
runs-on: macos-15-intel
env:
BUILD_TYPE: Release
steps:
- name: Cloning
uses: actions/checkout@v5
- name: Configure CMake
run: cmake -B "${{github.workspace}}/build" -DRAGEPHOTO_C_LIBRARY=ON -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -GNinja
- name: Build
run: cmake --build "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}}
- name: Install
run: cmake --install "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}} --prefix "${{github.workspace}}/install/"
- name: Upload
uses: actions/upload-artifact@v5
with:
name: macOS amd64
path: ${{github.workspace}}/install/
macOS_arm64:
runs-on: macos-15
env:
BUILD_TYPE: Release
steps:
- name: Cloning
uses: actions/checkout@v5
- name: Configure CMake
run: cmake -B "${{github.workspace}}/build" -DRAGEPHOTO_C_LIBRARY=ON -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -GNinja
- name: Build
run: cmake --build "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}}
- name: Install
run: cmake --install "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}} --prefix "${{github.workspace}}/install/"
- name: Upload
uses: actions/upload-artifact@v5
with:
name: macOS arm64
path: ${{github.workspace}}/install/
Windows:
runs-on: windows-latest
env:
BUILD_TYPE: Release
strategy:
matrix:
arch:
- amd64
- amd64_x86
- amd64_arm64
steps:
- name: Cloning
uses: actions/checkout@v5
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{matrix.arch}}
- name: Configure CMake
run: cmake -B "${{github.workspace}}/build" -DRAGEPHOTO_C_LIBRARY=ON -DRAGEPHOTO_UNICODE=wincvt -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -GNinja
- name: Build
run: cmake --build "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}}
- name: Install
run: cmake --install "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}} --prefix "${{github.workspace}}/install"
- name: Upload
uses: actions/upload-artifact@v5
with:
name: Windows MSVC ${{matrix.arch}}
path: ${{github.workspace}}/install/
Release:
needs: [Linux_amd64, Linux_arm64, macOS_amd64, macOS_arm64, Windows]
runs-on: windows-latest
defaults:
run:
shell: pwsh
env:
BUILD_TYPE: Release
steps:
- name: Cloning
uses: actions/checkout@v5
- name: Download Linux amd64 Assets
uses: actions/download-artifact@v6
with:
name: AlmaLinux amd64
path: assets/linux-x64
- name: Download Linux arm64 Assets
uses: actions/download-artifact@v6
with:
name: AlmaLinux arm64
path: assets/linux-arm64
- name: Download macOS amd64 Assets
uses: actions/download-artifact@v6
with:
name: macOS amd64
path: assets/osx-x64
- name: Download macOS arm64 Assets
uses: actions/download-artifact@v6
with:
name: macOS arm64
path: assets/osx-arm64
- name: Download Windows MSVC amd64 Assets
uses: actions/download-artifact@v6
with:
name: Windows MSVC amd64
path: assets/win-x64
- name: Download Windows MSVC arm64 Assets
uses: actions/download-artifact@v6
with:
name: Windows MSVC amd64_arm64
path: assets/win-arm64
- name: Download Windows MSVC x86 Assets
uses: actions/download-artifact@v6
with:
name: Windows MSVC amd64_x86
path: assets/win-x86
- name: Copy Assets
run: |
mkdir -p "${{github.workspace}}\src\dotnet\runtimes\linux-arm64\native"
mkdir -p "${{github.workspace}}\src\dotnet\runtimes\linux-x64\native"
mkdir -p "${{github.workspace}}\src\dotnet\runtimes\osx-arm64\native"
mkdir -p "${{github.workspace}}\src\dotnet\runtimes\osx-x64\native"
mkdir -p "${{github.workspace}}\src\dotnet\runtimes\win-arm64\native"
mkdir -p "${{github.workspace}}\src\dotnet\runtimes\win-x64\native"
mkdir -p "${{github.workspace}}\src\dotnet\runtimes\win-x86\native"
cp "${{github.workspace}}\assets\linux-arm64\lib64\libragephoto.so" "${{github.workspace}}\src\dotnet\runtimes\linux-arm64\native\libragephoto.so"
cp "${{github.workspace}}\assets\linux-x64\lib64\libragephoto.so" "${{github.workspace}}\src\dotnet\runtimes\linux-x64\native\libragephoto.so"
cp "${{github.workspace}}\assets\osx-arm64\lib\libragephoto.dylib" "${{github.workspace}}\src\dotnet\runtimes\osx-arm64\native\libragephoto.dylib"
cp "${{github.workspace}}\assets\osx-x64\lib\libragephoto.dylib" "${{github.workspace}}\src\dotnet\runtimes\osx-x64\native\libragephoto.dylib"
cp "${{github.workspace}}\assets\win-arm64\bin\libragephoto.dll" "${{github.workspace}}\src\dotnet\runtimes\win-arm64\native\libragephoto.dll"
cp "${{github.workspace}}\assets\win-x64\bin\libragephoto.dll" "${{github.workspace}}\src\dotnet\runtimes\win-x64\native\libragephoto.dll"
cp "${{github.workspace}}\assets\win-x86\bin\libragephoto.dll" "${{github.workspace}}\src\dotnet\runtimes\win-x86\native\libragephoto.dll"
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.x
- name: Build RagePhoto.Core
run: msbuild "${{github.workspace}}\src\dotnet\RagePhoto.Core.csproj" /t:restore /t:pack /p:Configuration=${{env.BUILD_TYPE}}
- name: Upload
uses: actions/upload-artifact@v5
with:
name: NuGet Package
path: ${{github.workspace}}\src\dotnet\bin\${{env.BUILD_TYPE}}\RagePhoto.Core.*.nupkg

View file

@ -7,22 +7,20 @@ jobs:
env: env:
BUILD_TYPE: Release BUILD_TYPE: Release
steps: steps:
- uses: actions/checkout@v4 - name: Cloning
with: uses: actions/checkout@v5
submodules: recursive
- name: Install packages - name: Install packages
run: | run: |
sudo apt-get update -qq sudo apt-get update -qq
sudo apt-get install cmake gcc g++ ninja-build -qq sudo apt-get install cmake gcc g++ ninja-build -qq
- name: Configure CMake - name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DRAGEPHOTO_C_LIBRARY=ON -GNinja run: cmake -B "${{github.workspace}}/build" -DRAGEPHOTO_C_LIBRARY=ON -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -GNinja
- name: Build - name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} run: cmake --build "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}}
- name: Install - name: Install
run: cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --prefix ${{github.workspace}}/install/usr/local run: cmake --install "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}} --prefix "${{github.workspace}}/install/usr/local"
- name: Upload - name: Upload
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
with: with:
name: Ubuntu name: Ubuntu
path: | path: ${{github.workspace}}/install/
${{github.workspace}}/install/

View file

@ -6,23 +6,26 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
BUILD_TYPE: Release BUILD_TYPE: Release
strategy:
matrix:
cxxstd:
- 11
- 17
steps: steps:
- uses: actions/checkout@v4 - name: Cloning
with: uses: actions/checkout@v5
submodules: recursive
- name: Install packages - name: Install packages
run: | run: |
sudo apt-get update -qq sudo apt-get update -qq
sudo apt-get install cmake gcc g++ ninja-build -qq sudo apt-get install cmake gcc g++ ninja-build -qq
- name: Configure CMake - name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DRAGEPHOTO_CXX_STANDARD=17 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -GNinja run: cmake -B "${{github.workspace}}/build" -DRAGEPHOTO_CXX_STANDARD=${{matrix.cxxstd}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -GNinja
- name: Build - name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} run: cmake --build "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}}
- name: Install - name: Install
run: cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --prefix ${{github.workspace}}/install/usr/local run: cmake --install "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}} --prefix "${{github.workspace}}/install/usr/local"
- name: Upload - name: Upload
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
with: with:
name: Ubuntu name: Ubuntu C++${{matrix.cxxstd}}
path: | path: ${{github.workspace}}/install/
${{github.workspace}}/install/

View file

@ -7,9 +7,8 @@ jobs:
env: env:
BUILD_TYPE: Release BUILD_TYPE: Release
steps: steps:
- uses: actions/checkout@v4 - name: Cloning
with: uses: actions/checkout@v5
submodules: recursive
- name: Setup emsdk - name: Setup emsdk
uses: mymindstorm/setup-emsdk@v14 uses: mymindstorm/setup-emsdk@v14
with: with:
@ -19,11 +18,11 @@ jobs:
sudo apt-get update -qq sudo apt-get update -qq
sudo apt-get install cmake ninja-build -qq sudo apt-get install cmake ninja-build -qq
- name: Configure CMake - name: Configure CMake
run: emcmake cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DRAGEPHOTO_C_LIBRARY=ON -GNinja run: emcmake cmake -B "${{github.workspace}}/build" -DRAGEPHOTO_C_LIBRARY=ON -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -GNinja
- name: Build - name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} run: cmake --build "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}}
- name: Upload - name: Upload
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
with: with:
name: WebAssembly name: WebAssembly
path: | path: |

View file

@ -7,9 +7,8 @@ jobs:
env: env:
BUILD_TYPE: Release BUILD_TYPE: Release
steps: steps:
- uses: actions/checkout@v4 - name: Cloning
with: uses: actions/checkout@v5
submodules: recursive
- name: Setup emsdk - name: Setup emsdk
uses: mymindstorm/setup-emsdk@v14 uses: mymindstorm/setup-emsdk@v14
with: with:
@ -19,11 +18,11 @@ jobs:
sudo apt-get update -qq sudo apt-get update -qq
sudo apt-get install cmake ninja-build -qq sudo apt-get install cmake ninja-build -qq
- name: Configure CMake - name: Configure CMake
run: emcmake cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DRAGEPHOTO_CXX_STANDARD=11 -GNinja run: emcmake cmake -B "${{github.workspace}}/build" -DRAGEPHOTO_CXX_STANDARD=11 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -GNinja
- name: Build - name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} run: cmake --build "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}}
- name: Upload - name: Upload
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
with: with:
name: WebAssembly name: WebAssembly
path: | path: |

View file

@ -13,21 +13,20 @@ jobs:
- amd64_x86 - amd64_x86
- amd64_arm64 - amd64_arm64
steps: steps:
- uses: actions/checkout@v4 - name: Cloning
with: uses: actions/checkout@v5
submodules: recursive - name: Setup MSVC
- uses: ilammy/msvc-dev-cmd@v1 uses: ilammy/msvc-dev-cmd@v1
with: with:
arch: ${{matrix.arch}} arch: ${{matrix.arch}}
- name: Configure CMake - name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DRAGEPHOTO_C_LIBRARY=ON -DRAGEPHOTO_UNICODE=wincvt -GNinja run: cmake -B "${{github.workspace}}/build" -DRAGEPHOTO_C_LIBRARY=ON -DRAGEPHOTO_UNICODE=wincvt -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -GNinja
- name: Build - name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} run: cmake --build "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}}
- name: Install - name: Install
run: cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --prefix ${{github.workspace}}/install run: cmake --install "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}} --prefix "${{github.workspace}}/install"
- name: Upload - name: Upload
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
with: with:
name: Windows MSVC ${{matrix.arch}} name: Windows MSVC ${{matrix.arch}}
path: | path: ${{github.workspace}}/install/
${{github.workspace}}/install/

View file

@ -12,22 +12,24 @@ jobs:
- amd64 - amd64
- amd64_x86 - amd64_x86
- amd64_arm64 - amd64_arm64
cxxstd:
- 11
- 17
steps: steps:
- uses: actions/checkout@v4 - name: Cloning
with: uses: actions/checkout@v5
submodules: recursive - name: Setup MSVC
- uses: ilammy/msvc-dev-cmd@v1 uses: ilammy/msvc-dev-cmd@v1
with: with:
arch: ${{matrix.arch}} arch: ${{matrix.arch}}
- name: Configure CMake - name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DRAGEPHOTO_CXX_STANDARD=17 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DRAGEPHOTO_UNICODE=wincvt -GNinja run: cmake -B "${{github.workspace}}/build" -DRAGEPHOTO_CXX_STANDARD=${{matrix.cxxstd}} -DRAGEPHOTO_UNICODE=wincvt -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -GNinja
- name: Build - name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} run: cmake --build "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}}
- name: Install - name: Install
run: cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --prefix ${{github.workspace}}/install run: cmake --install "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}} --prefix "${{github.workspace}}/install"
- name: Upload - name: Upload
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
with: with:
name: Windows MSVC ${{matrix.arch}} name: Windows MSVC C++${{matrix.cxxstd}} ${{matrix.arch}}
path: | path: ${{github.workspace}}/install/
${{github.workspace}}/install/

View file

@ -1,78 +0,0 @@
name: Windows .NET
on: push
jobs:
Native:
runs-on: windows-latest
env:
BUILD_TYPE: Release
strategy:
matrix:
arch:
- amd64
- amd64_x86
- amd64_arm64
steps:
- name: Cloning
uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{matrix.arch}}
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DRAGEPHOTO_C_LIBRARY=ON -DRAGEPHOTO_UNICODE=wincvt -GNinja
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Install
run: cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --prefix ${{github.workspace}}/install
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Windows MSVC ${{matrix.arch}}
path: |
${{github.workspace}}/install/
Release:
needs: Native
runs-on: windows-latest
env:
BUILD_TYPE: Release
steps:
- name: Cloning
uses: actions/checkout@v4
- name: Download Windows MSVC amd64 Assets
uses: actions/download-artifact@v4
with:
name: Windows MSVC amd64
path: assets/amd64
- name: Download Windows MSVC amd64_x86 Assets
uses: actions/download-artifact@v4
with:
name: Windows MSVC amd64_x86
path: assets/amd64_x86
- name: Download Windows MSVC amd64_arm64 Assets
uses: actions/download-artifact@v4
with:
name: Windows MSVC amd64_arm64
path: assets/amd64_arm64
- name: Copy Assets
shell: pwsh
run: |
mkdir -p ${{github.workspace}}\src\dotnet\runtimes\win-arm64\native
mkdir -p ${{github.workspace}}\src\dotnet\runtimes\win-x64\native
mkdir -p ${{github.workspace}}\src\dotnet\runtimes\win-x86\native
cp ${{github.workspace}}\assets\amd64_arm64\bin\libragephoto.dll ${{github.workspace}}\src\dotnet\runtimes\win-arm64\native\libragephoto.dll
cp ${{github.workspace}}\assets\amd64\bin\libragephoto.dll ${{github.workspace}}\src\dotnet\runtimes\win-x64\native\libragephoto.dll
cp ${{github.workspace}}\assets\amd64_x86\bin\libragephoto.dll ${{github.workspace}}\src\dotnet\runtimes\win-x86\native\libragephoto.dll
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build Syping.RagePhoto.Core
run: msbuild ${{github.workspace}}\src\dotnet\Syping.RagePhoto.Core.csproj /t:restore /t:pack /p:Configuration=${{env.BUILD_TYPE}}
- name: Upload
uses: actions/upload-artifact@v4
with:
name: NuGet Package
path: |
${{github.workspace}}\src\dotnet\bin\${{env.BUILD_TYPE}}\Syping.RagePhoto.Core.*.nupkg

View file

@ -1,6 +1,6 @@
#[[************************************************************************** #[[**************************************************************************
* libragephoto RAGE Photo Parser * libragephoto RAGE Photo Parser
* Copyright (C) 2021-2024 Syping * Copyright (C) 2021-2025 Syping
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -18,7 +18,7 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
cmake_policy(VERSION 3.16...3.28) cmake_policy(VERSION 3.16...3.28)
project(ragephoto VERSION 0.6.2 LANGUAGES C CXX) project(ragephoto VERSION 0.7.1 LANGUAGES C CXX)
include(GNUInstallDirs) include(GNUInstallDirs)
# RagePhoto CMake includes # RagePhoto CMake includes
@ -136,6 +136,7 @@ target_include_directories(ragephoto PUBLIC
"${ragephoto_BINARY_DIR}/include" "${ragephoto_BINARY_DIR}/include"
"${ragephoto_SOURCE_DIR}/src/core" "${ragephoto_SOURCE_DIR}/src/core"
) )
target_link_libraries(ragephoto PRIVATE ${LIBRAGEPHOTO_LIBS})
install(TARGETS ragephoto install(TARGETS ragephoto
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"

View file

@ -1,6 +1,6 @@
#[[************************************************************************** #[[**************************************************************************
* libragephoto RAGE Photo Parser * libragephoto RAGE Photo Parser
* Copyright (C) 2021-2024 Syping * Copyright (C) 2021-2025 Syping
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -17,17 +17,31 @@
****************************************************************************]] ****************************************************************************]]
set(RAGEPHOTO_UNICODE "" CACHE STRING "libragephoto Unicode implementation") set(RAGEPHOTO_UNICODE "" CACHE STRING "libragephoto Unicode implementation")
set(RAGEPHOTO_UNICODE_LIBS "" CACHE STRING "libragephoto Unicode libraries")
if (RAGEPHOTO_UNICODE) if (RAGEPHOTO_UNICODE)
string(TOUPPER "UNICODE_${RAGEPHOTO_UNICODE}" UNICODE_DEF) string(TOUPPER "UNICODE_${RAGEPHOTO_UNICODE}" UNICODE_DEF)
list(APPEND LIBRAGEPHOTO_DEFINES list(APPEND LIBRAGEPHOTO_DEFINES
"${UNICODE_DEF}" ${UNICODE_DEF}
)
list(APPEND LIBRAGEPHOTO_LIBS
${RAGEPHOTO_UNICODE_LIBS}
) )
message("-- UnicodeCvt - ${RAGEPHOTO_UNICODE}") message("-- UnicodeCvt - ${RAGEPHOTO_UNICODE}")
else() else()
# RagePhoto test source files
if (RAGEPHOTO_C_LIBRARY)
set(ICONV_SOURCE "${PROJECT_SOURCE_DIR}/tests/IconvTest.c")
set(WINCVT_SOURCE "${PROJECT_SOURCE_DIR}/tests/WincvtTest.c")
else()
set(CODECVT_SOURCE "${PROJECT_SOURCE_DIR}/tests/CodecvtTest.cpp")
set(ICONV_SOURCE "${PROJECT_SOURCE_DIR}/tests/IconvTest.cpp")
set(WINCVT_SOURCE "${PROJECT_SOURCE_DIR}/tests/WincvtTest.cpp")
endif()
# RagePhoto Unicode functionality tests # RagePhoto Unicode functionality tests
if (NOT RAGEPHOTO_C_LIBRARY) if (NOT RAGEPHOTO_C_LIBRARY)
message("-- Testing codecvt") message("-- Testing codecvt")
try_run(CODECVT_RUN CODECVT_COMPILE "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/tests/CodecvtTest.cpp") try_run(CODECVT_RUN CODECVT_COMPILE "${PROJECT_BINARY_DIR}" "${CODECVT_SOURCE}")
if (CODECVT_COMPILE AND CODECVT_RUN EQUAL 0) if (CODECVT_COMPILE AND CODECVT_RUN EQUAL 0)
set(CODECVT_COMPAT TRUE) set(CODECVT_COMPAT TRUE)
message("-- Testing codecvt - yes") message("-- Testing codecvt - yes")
@ -37,25 +51,24 @@ else()
endif() endif()
message("-- Testing iconv") message("-- Testing iconv")
if (RAGEPHOTO_C_LIBRARY) try_run(ICONV_RUN ICONV_COMPILE "${PROJECT_BINARY_DIR}" "${ICONV_SOURCE}")
try_run(ICONV_RUN ICONV_COMPILE "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/tests/IconvTest.c")
else()
try_run(ICONV_RUN ICONV_COMPILE "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/tests/IconvTest.cpp")
endif()
if (ICONV_COMPILE AND ICONV_RUN EQUAL 0) if (ICONV_COMPILE AND ICONV_RUN EQUAL 0)
set(ICONV_COMPAT TRUE) set(ICONV_COMPAT TRUE)
message("-- Testing iconv - yes") message("-- Testing iconv - yes")
else() else()
message("-- Testing iconv - no") try_run(ICONV_RUN ICONV_COMPILE "${PROJECT_BINARY_DIR}" "${ICONV_SOURCE}" LINK_LIBRARIES iconv)
if (ICONV_COMPILE AND ICONV_RUN EQUAL 0)
set(ICONV_COMPAT TRUE)
set(ICONV_LINKED TRUE)
message("-- Testing iconv - yes (linked)")
else()
message("-- Testing iconv - no")
endif()
endif() endif()
if (WIN32) if (WIN32)
message("-- Testing wincvt") message("-- Testing wincvt")
if (RAGEPHOTO_C_LIBRARY) try_run(WINCVT_RUN WINCVT_COMPILE "${PROJECT_BINARY_DIR}" "${WINCVT_SOURCE}")
try_run(WINCVT_RUN WINCVT_COMPILE "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/tests/WincvtTest.c")
else()
try_run(WINCVT_RUN WINCVT_COMPILE "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/tests/WincvtTest.cpp")
endif()
if (WINCVT_COMPILE AND WINCVT_RUN EQUAL 0) if (WINCVT_COMPILE AND WINCVT_RUN EQUAL 0)
set(WINCVT_COMPAT TRUE) set(WINCVT_COMPAT TRUE)
message("-- Testing wincvt - yes") message("-- Testing wincvt - yes")
@ -67,18 +80,23 @@ else()
# Unicode implementation for RagePhoto # Unicode implementation for RagePhoto
if (WINCVT_COMPAT) if (WINCVT_COMPAT)
list(APPEND LIBRAGEPHOTO_DEFINES list(APPEND LIBRAGEPHOTO_DEFINES
"UNICODE_WINCVT" UNICODE_WINCVT
) )
message("-- UnicodeCvt - wincvt") message("-- UnicodeCvt - wincvt")
elseif (CODECVT_COMPAT AND NOT RAGEPHOTO_C_LIBRARY) elseif (CODECVT_COMPAT AND NOT RAGEPHOTO_C_LIBRARY)
list(APPEND LIBRAGEPHOTO_DEFINES list(APPEND LIBRAGEPHOTO_DEFINES
"UNICODE_CODECVT" UNICODE_CODECVT
) )
message("-- UnicodeCvt - codecvt") message("-- UnicodeCvt - codecvt")
elseif (ICONV_COMPAT) elseif (ICONV_COMPAT)
list(APPEND LIBRAGEPHOTO_DEFINES list(APPEND LIBRAGEPHOTO_DEFINES
"UNICODE_ICONV" UNICODE_ICONV
) )
if (ICONV_LINKED)
list(APPEND LIBRAGEPHOTO_LIBS
iconv
)
endif()
message("-- UnicodeCvt - iconv") message("-- UnicodeCvt - iconv")
else() else()
message("-- UnicodeCvt - none") message("-- UnicodeCvt - none")

View file

@ -984,6 +984,15 @@ bool ragephotodata_savef(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parse
return false; return false;
#endif #endif
} }
else if (photoFormat == RAGEPHOTO_FORMAT_JPEG) {
const size_t length = ragephotodata_getsavesizef(rp_data, NULL, photoFormat);
size_t pos = 0;
writeBuffer(rp_data->jpeg, data, &pos, length, rp_data->jpegSize);
rp_data->error = RAGEPHOTO_ERROR_NOERROR; // 255
return true;
}
else if (rp_parser) { else if (rp_parser) {
RagePhotoFormatParser n_parser; RagePhotoFormatParser n_parser;
memset(&n_parser, 0, sizeof(RagePhotoFormatParser)); memset(&n_parser, 0, sizeof(RagePhotoFormatParser));
@ -1049,6 +1058,8 @@ size_t ragephotodata_getsavesizef(RagePhotoData *rp_data, RagePhotoFormatParser
return (rp_data->jpegBuffer + rp_data->jsonBuffer + rp_data->titlBuffer + rp_data->descBuffer + RAGEPHOTO_GTA5_HEADERSIZE + UINT32_C(56)); return (rp_data->jpegBuffer + rp_data->jsonBuffer + rp_data->titlBuffer + rp_data->descBuffer + RAGEPHOTO_GTA5_HEADERSIZE + UINT32_C(56));
else if (photoFormat == RAGEPHOTO_FORMAT_RDR2) else if (photoFormat == RAGEPHOTO_FORMAT_RDR2)
return (rp_data->jpegBuffer + rp_data->jsonBuffer + rp_data->titlBuffer + rp_data->descBuffer + RAGEPHOTO_RDR2_HEADERSIZE + UINT32_C(56)); return (rp_data->jpegBuffer + rp_data->jsonBuffer + rp_data->titlBuffer + rp_data->descBuffer + RAGEPHOTO_RDR2_HEADERSIZE + UINT32_C(56));
else if (photoFormat == RAGEPHOTO_FORMAT_JPEG)
return (rp_data->jpegSize);
else if (rp_parser) { else if (rp_parser) {
RagePhotoFormatParser n_parser; RagePhotoFormatParser n_parser;
memset(&n_parser, 0, sizeof(RagePhotoFormatParser)); memset(&n_parser, 0, sizeof(RagePhotoFormatParser));
@ -1196,7 +1207,7 @@ void ragephoto_setphotodesc(ragephoto_t instance_t, const char *description, uin
} }
if (bufferSize != 0) { if (bufferSize != 0) {
instance->data->descBuffer = bufferSize; instance->data->descBuffer = bufferSize;
ragephoto_setbufferoffsets(instance->data); ragephotodata_setbufferoffsets(instance->data);
} }
instance->data->error = RAGEPHOTO_ERROR_NOERROR; // 255 instance->data->error = RAGEPHOTO_ERROR_NOERROR; // 255
} }

View file

@ -939,6 +939,15 @@ bool RagePhoto::save(char *data, uint32_t photoFormat, RagePhotoData *rp_data, R
return false; return false;
#endif #endif
} }
else if (photoFormat == PhotoFormat::JPEG) {
const size_t length = saveSize(photoFormat, rp_data, nullptr);
size_t pos = 0;
writeBuffer(rp_data->jpeg, data, &pos, length, rp_data->jpegSize);
rp_data->error = Error::NoError; // 255
return true;
}
else if (rp_parser) { else if (rp_parser) {
RagePhotoFormatParser n_parser[1]{}; RagePhotoFormatParser n_parser[1]{};
for (size_t i = 0; memcmp(&n_parser[0], &rp_parser[i], sizeof(RagePhotoFormatParser)); i++) { for (size_t i = 0; memcmp(&n_parser[0], &rp_parser[i], sizeof(RagePhotoFormatParser)); i++) {
@ -1004,11 +1013,7 @@ bool RagePhoto::saveFile(const char *filename, uint32_t photoFormat)
m_data->error = Error::Uninitialised; // 0 m_data->error = Error::Uninitialised; // 0
return false; return false;
} }
#if (RAGEPHOTO_CXX_STD >= 11) && (__cplusplus >= 201103L)
ofs << sdata;
#else
ofs.write(sdata.data(), sdata.size()); ofs.write(sdata.data(), sdata.size());
#endif
ok = ofs.good(); ok = ofs.good();
ofs.close(); ofs.close();
return ok; return ok;
@ -1028,6 +1033,8 @@ size_t RagePhoto::saveSize(uint32_t photoFormat, RagePhotoData *rp_data, RagePho
return (rp_data->jpegBuffer + rp_data->jsonBuffer + rp_data->titlBuffer + rp_data->descBuffer + GTA5_HEADERSIZE + UINT32_C(56)); return (rp_data->jpegBuffer + rp_data->jsonBuffer + rp_data->titlBuffer + rp_data->descBuffer + GTA5_HEADERSIZE + UINT32_C(56));
else if (photoFormat == PhotoFormat::RDR2) else if (photoFormat == PhotoFormat::RDR2)
return (rp_data->jpegBuffer + rp_data->jsonBuffer + rp_data->titlBuffer + rp_data->descBuffer + RDR2_HEADERSIZE + UINT32_C(56)); return (rp_data->jpegBuffer + rp_data->jsonBuffer + rp_data->titlBuffer + rp_data->descBuffer + RDR2_HEADERSIZE + UINT32_C(56));
else if (photoFormat == PhotoFormat::JPEG)
return (rp_data->jpegSize);
else if (rp_parser) { else if (rp_parser) {
RagePhotoFormatParser n_parser[1]{}; RagePhotoFormatParser n_parser[1]{};
for (size_t i = 0; memcmp(&n_parser[0], &rp_parser[i], sizeof(RagePhotoFormatParser)); i++) { for (size_t i = 0; memcmp(&n_parser[0], &rp_parser[i], sizeof(RagePhotoFormatParser)); i++) {

View file

@ -71,16 +71,16 @@
#if defined(__DARWIN_BYTE_ORDER) && defined(__DARWIN_LITTLE_ENDIAN) && __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN #if defined(__DARWIN_BYTE_ORDER) && defined(__DARWIN_LITTLE_ENDIAN) && __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
#define LIBRAGEPHOTO_LITTLE_ENDIAN #define LIBRAGEPHOTO_LITTLE_ENDIAN
#endif // __DARWIN_BYTE_ORDER #endif // __DARWIN_BYTE_ORDER
#elif defined(__linux__)
#include <endian.h>
#if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && __BYTE_ORDER == __LITTLE_ENDIAN
#define LIBRAGEPHOTO_LITTLE_ENDIAN
#endif // __BYTE_ORDER
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/endian.h> #include <sys/endian.h>
#if defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) && _BYTE_ORDER == _LITTLE_ENDIAN #if defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) && _BYTE_ORDER == _LITTLE_ENDIAN
#define LIBRAGEPHOTO_LITTLE_ENDIAN #define LIBRAGEPHOTO_LITTLE_ENDIAN
#endif // _BYTE_ORDER #endif // _BYTE_ORDER
#elif defined(__linux__)
#include <endian.h>
#if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && __BYTE_ORDER == __LITTLE_ENDIAN
#define LIBRAGEPHOTO_LITTLE_ENDIAN
#endif // __BYTE_ORDER
#endif #endif
/* RAGEPHOTO LIBRARY ENDIAN END */ /* RAGEPHOTO LIBRARY ENDIAN END */

View file

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
* libragephoto RAGE Photo Parser * libragephoto RAGE Photo Parser
* Copyright (C) 2021-2024 Syping * Copyright (C) 2021-2025 Syping
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -136,6 +136,7 @@ typedef enum RagePhotoLibraryFlag {
#define RAGEPHOTO_ERROR_UNINITIALISED INT32_C(0) /**< Uninitialised, file access failed */ #define RAGEPHOTO_ERROR_UNINITIALISED INT32_C(0) /**< Uninitialised, file access failed */
/* RagePhoto formats */ /* RagePhoto formats */
#define RAGEPHOTO_FORMAT_JPEG UINT32_C(0xE0FFD8FF) /**< JPEG Photo Format */
#define RAGEPHOTO_FORMAT_GTA5 UINT32_C(0x01000000) /**< GTA V Photo Format */ #define RAGEPHOTO_FORMAT_GTA5 UINT32_C(0x01000000) /**< GTA V Photo Format */
#define RAGEPHOTO_FORMAT_RDR2 UINT32_C(0x04000000) /**< RDR 2 Photo Format */ #define RAGEPHOTO_FORMAT_RDR2 UINT32_C(0x04000000) /**< RDR 2 Photo Format */

View file

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
* libragephoto RAGE Photo Parser * libragephoto RAGE Photo Parser
* Copyright (C) 2021-2024 Syping * Copyright (C) 2021-2025 Syping
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -41,7 +41,7 @@ public:
DEFAULT_JSONBUFFER = RAGEPHOTO_DEFAULT_JSONBUFFER, /**< Default JSON Buffer Size */ DEFAULT_JSONBUFFER = RAGEPHOTO_DEFAULT_JSONBUFFER, /**< Default JSON Buffer Size */
DEFAULT_TITLBUFFER = RAGEPHOTO_DEFAULT_TITLBUFFER, /**< Default Title Buffer Size */ DEFAULT_TITLBUFFER = RAGEPHOTO_DEFAULT_TITLBUFFER, /**< Default Title Buffer Size */
GTA5_HEADERSIZE = RAGEPHOTO_GTA5_HEADERSIZE, /**< GTA V Header Size */ GTA5_HEADERSIZE = RAGEPHOTO_GTA5_HEADERSIZE, /**< GTA V Header Size */
RDR2_HEADERSIZE = RAGEPHOTO_RDR2_HEADERSIZE, /**< RDR 2 Header Size */ RDR2_HEADERSIZE = RAGEPHOTO_RDR2_HEADERSIZE /**< RDR 2 Header Size */
}; };
/** Parsing and set errors */ /** Parsing and set errors */
enum Error : int32_t { enum Error : int32_t {
@ -85,17 +85,18 @@ public:
TitleReadError = RAGEPHOTO_ERROR_TITLEREADERROR, /**< Title can't be read */ TitleReadError = RAGEPHOTO_ERROR_TITLEREADERROR, /**< Title can't be read */
UnicodeInitError = RAGEPHOTO_ERROR_UNICODEINITERROR, /**< Failed to initialise Unicode decoder */ UnicodeInitError = RAGEPHOTO_ERROR_UNICODEINITERROR, /**< Failed to initialise Unicode decoder */
UnicodeHeaderError = RAGEPHOTO_ERROR_UNICODEHEADERERROR, /**< Header can't be encoded/decoded successfully */ UnicodeHeaderError = RAGEPHOTO_ERROR_UNICODEHEADERERROR, /**< Header can't be encoded/decoded successfully */
Uninitialised = RAGEPHOTO_ERROR_UNINITIALISED, /**< Uninitialised, file access failed */ Uninitialised = RAGEPHOTO_ERROR_UNINITIALISED /**< Uninitialised, file access failed */
}; };
/** Photo Formats */ /** Photo Formats */
enum PhotoFormat : uint32_t { enum PhotoFormat : uint32_t {
JPEG = RAGEPHOTO_FORMAT_JPEG, /**< JPEG Photo Format */
GTA5 = RAGEPHOTO_FORMAT_GTA5, /**< GTA V Photo Format */ GTA5 = RAGEPHOTO_FORMAT_GTA5, /**< GTA V Photo Format */
RDR2 = RAGEPHOTO_FORMAT_RDR2, /**< RDR 2 Photo Format */ RDR2 = RAGEPHOTO_FORMAT_RDR2 /**< RDR 2 Photo Format */
}; };
/** Sign Initials */ /** Sign Initials */
enum SignInitials : uint32_t { enum SignInitials : uint32_t {
SIGTA5 = RAGEPHOTO_SIGNINITIAL_GTA5, /**< GTA V Sign Initial */ SIGTA5 = RAGEPHOTO_SIGNINITIAL_GTA5, /**< GTA V Sign Initial */
SIRDR2 = RAGEPHOTO_SIGNINITIAL_RDR2, /**< RDR 2 Sign Initial */ SIRDR2 = RAGEPHOTO_SIGNINITIAL_RDR2 /**< RDR 2 Sign Initial */
}; };
photo() { photo() {
instance = ragephoto_open(); instance = ragephoto_open();

View file

@ -44,7 +44,7 @@ public:
DEFAULT_JSONBUFFER = RAGEPHOTO_DEFAULT_JSONBUFFER, /**< Default JSON Buffer Size */ DEFAULT_JSONBUFFER = RAGEPHOTO_DEFAULT_JSONBUFFER, /**< Default JSON Buffer Size */
DEFAULT_TITLBUFFER = RAGEPHOTO_DEFAULT_TITLBUFFER, /**< Default Title Buffer Size */ DEFAULT_TITLBUFFER = RAGEPHOTO_DEFAULT_TITLBUFFER, /**< Default Title Buffer Size */
GTA5_HEADERSIZE = RAGEPHOTO_GTA5_HEADERSIZE, /**< GTA V Header Size */ GTA5_HEADERSIZE = RAGEPHOTO_GTA5_HEADERSIZE, /**< GTA V Header Size */
RDR2_HEADERSIZE = RAGEPHOTO_RDR2_HEADERSIZE, /**< RDR 2 Header Size */ RDR2_HEADERSIZE = RAGEPHOTO_RDR2_HEADERSIZE /**< RDR 2 Header Size */
}; };
/** Parsing and set errors */ /** Parsing and set errors */
enum Error : int32_t { enum Error : int32_t {
@ -88,17 +88,18 @@ public:
TitleReadError = RAGEPHOTO_ERROR_TITLEREADERROR, /**< Title can't be read */ TitleReadError = RAGEPHOTO_ERROR_TITLEREADERROR, /**< Title can't be read */
UnicodeInitError = RAGEPHOTO_ERROR_UNICODEINITERROR, /**< Failed to initialise Unicode decoder */ UnicodeInitError = RAGEPHOTO_ERROR_UNICODEINITERROR, /**< Failed to initialise Unicode decoder */
UnicodeHeaderError = RAGEPHOTO_ERROR_UNICODEHEADERERROR, /**< Header can't be encoded/decoded successfully */ UnicodeHeaderError = RAGEPHOTO_ERROR_UNICODEHEADERERROR, /**< Header can't be encoded/decoded successfully */
Uninitialised = RAGEPHOTO_ERROR_UNINITIALISED, /**< Uninitialised, file access failed */ Uninitialised = RAGEPHOTO_ERROR_UNINITIALISED /**< Uninitialised, file access failed */
}; };
/** Photo Formats */ /** Photo Formats */
enum PhotoFormat : uint32_t { enum PhotoFormat : uint32_t {
JPEG = RAGEPHOTO_FORMAT_JPEG, /**< JPEG Photo Format */
GTA5 = RAGEPHOTO_FORMAT_GTA5, /**< GTA V Photo Format */ GTA5 = RAGEPHOTO_FORMAT_GTA5, /**< GTA V Photo Format */
RDR2 = RAGEPHOTO_FORMAT_RDR2, /**< RDR 2 Photo Format */ RDR2 = RAGEPHOTO_FORMAT_RDR2 /**< RDR 2 Photo Format */
}; };
/** Sign Initials */ /** Sign Initials */
enum SignInitials : uint32_t { enum SignInitials : uint32_t {
SIGTA5 = RAGEPHOTO_SIGNINITIAL_GTA5, /**< GTA V Sign Initial */ SIGTA5 = RAGEPHOTO_SIGNINITIAL_GTA5, /**< GTA V Sign Initial */
SIRDR2 = RAGEPHOTO_SIGNINITIAL_RDR2, /**< RDR 2 Sign Initial */ SIRDR2 = RAGEPHOTO_SIGNINITIAL_RDR2 /**< RDR 2 Sign Initial */
}; };
photo(); photo();
~photo(); ~photo();

View file

@ -1,244 +0,0 @@
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true
# C# files
[*.cs]
#### Core EditorConfig Options ####
# Indentation and spacing
indent_size = 4
indent_style = space
tab_width = 4
# New line preferences
end_of_line = crlf
insert_final_newline = false
#### .NET Code Actions ####
# Type members
dotnet_hide_advanced_members = false
dotnet_member_insertion_location = with_other_members_of_the_same_kind
dotnet_property_generation_behavior = prefer_throwing_properties
# Symbol search
dotnet_search_reference_assemblies = true
#### .NET Coding Conventions ####
# Organize usings
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = false
file_header_template = unset
# this. and Me. preferences
dotnet_style_qualification_for_event = false
dotnet_style_qualification_for_field = false
dotnet_style_qualification_for_method = false
dotnet_style_qualification_for_property = false
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true
dotnet_style_predefined_type_for_member_access = true
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members
# Expression-level preferences
dotnet_prefer_system_hash_code = true
dotnet_style_coalesce_expression = true
dotnet_style_collection_initializer = true
dotnet_style_explicit_tuple_names = true
dotnet_style_namespace_match_folder = true
dotnet_style_null_propagation = true
dotnet_style_object_initializer = true
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_prefer_auto_properties = true
dotnet_style_prefer_collection_expression = when_types_loosely_match
dotnet_style_prefer_compound_assignment = true
dotnet_style_prefer_conditional_expression_over_assignment = true
dotnet_style_prefer_conditional_expression_over_return = true
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
dotnet_style_prefer_inferred_anonymous_type_member_names = true
dotnet_style_prefer_inferred_tuple_names = true
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
dotnet_style_prefer_simplified_boolean_expressions = true
dotnet_style_prefer_simplified_interpolation = true
# Field preferences
dotnet_style_readonly_field = true
# Parameter preferences
dotnet_code_quality_unused_parameters = all
# Suppression preferences
dotnet_remove_unnecessary_suppression_exclusions = none
# New line preferences
dotnet_style_allow_multiple_blank_lines_experimental = true
dotnet_style_allow_statement_immediately_after_block_experimental = true
#### C# Coding Conventions ####
# var preferences
csharp_style_var_elsewhere = false
csharp_style_var_for_built_in_types = false
csharp_style_var_when_type_is_apparent = false
# Expression-bodied members
csharp_style_expression_bodied_accessors = true
csharp_style_expression_bodied_constructors = false
csharp_style_expression_bodied_indexers = true
csharp_style_expression_bodied_lambdas = true
csharp_style_expression_bodied_local_functions = false
csharp_style_expression_bodied_methods = false
csharp_style_expression_bodied_operators = false
csharp_style_expression_bodied_properties = true
# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true
csharp_style_pattern_matching_over_is_with_cast_check = true
csharp_style_prefer_extended_property_pattern = true
csharp_style_prefer_not_pattern = true
csharp_style_prefer_pattern_matching = true
csharp_style_prefer_switch_expression = true
# Null-checking preferences
csharp_style_conditional_delegate_call = true
# Modifier preferences
csharp_prefer_static_anonymous_function = true
csharp_prefer_static_local_function = true
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async
csharp_style_prefer_readonly_struct = true
csharp_style_prefer_readonly_struct_member = true
# Code-block preferences
csharp_prefer_braces = true
csharp_prefer_simple_using_statement = true
csharp_prefer_system_threading_lock = true
csharp_style_namespace_declarations = block_scoped
csharp_style_prefer_method_group_conversion = true
csharp_style_prefer_primary_constructors = true
csharp_style_prefer_top_level_statements = true
# Expression-level preferences
csharp_prefer_simple_default_expression = true
csharp_style_deconstructed_variable_declaration = true
csharp_style_implicit_object_creation_when_type_is_apparent = true
csharp_style_inlined_variable_declaration = true
csharp_style_prefer_index_operator = true
csharp_style_prefer_local_over_anonymous_function = true
csharp_style_prefer_null_check_over_type_check = true
csharp_style_prefer_range_operator = true
csharp_style_prefer_tuple_swap = true
csharp_style_prefer_utf8_string_literals = true
csharp_style_throw_expression = true
csharp_style_unused_value_assignment_preference = discard_variable
csharp_style_unused_value_expression_statement_preference = discard_variable
# 'using' directive preferences
csharp_using_directive_placement = outside_namespace
# New line preferences
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
csharp_style_allow_embedded_statements_on_same_line_experimental = true
#### C# Formatting Rules ####
# New line preferences
csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = none
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = false
csharp_indent_labels = flush_left
csharp_indent_switch_labels = true
# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
# Wrapping preferences
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true
#### Naming styles ####
# Naming rules
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
# Symbol specifications
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
# Naming styles
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

View file

@ -2,11 +2,11 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.1;net47</TargetFrameworks> <TargetFrameworks>netstandard2.1;net47</TargetFrameworks>
<AssemblyName>Syping.RagePhoto.Core</AssemblyName> <AssemblyName>RagePhoto.Core</AssemblyName>
<RootNamespace>Syping.RagePhoto</RootNamespace> <RootNamespace>RagePhoto</RootNamespace>
<Version>0.6.2</Version> <Version>0.7.1</Version>
<AssemblyVersion>0.6.2</AssemblyVersion> <AssemblyVersion>0.7.1</AssemblyVersion>
<FileVersion>0.6.2</FileVersion> <FileVersion>0.7.1</FileVersion>
<Authors>Syping</Authors> <Authors>Syping</Authors>
<Copyright>Copyright © 2025 Syping</Copyright> <Copyright>Copyright © 2025 Syping</Copyright>
<Description>Open Source RAGE Photo Parser for GTA V and RDR 2</Description> <Description>Open Source RAGE Photo Parser for GTA V and RDR 2</Description>
@ -20,17 +20,14 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<NativeDlls Include="runtimes\**\libragephoto.dll" /> <NativeDlls Include="runtimes\**\libragephoto.*" />
</ItemGroup>
<ItemGroup>
<None Include="@(NativeDlls)" Pack="true" PackagePath="runtimes\%(RecursiveDir)%(Filename)%(Extension)"> <None Include="@(NativeDlls)" Pack="true" PackagePath="runtimes\%(RecursiveDir)%(Filename)%(Extension)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
</ItemGroup> <None Include="RagePhoto.Core.targets" Pack="true" PackagePath="build\net47\RagePhoto.Core.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ItemGroup> </None>
<None Include="Syping.RagePhoto.Core.targets" Pack="true" PackagePath="buildTransitive\Syping.RagePhoto.Core.targets"> <None Include="RagePhoto.Core.targets" Pack="true" PackagePath="buildTransitive\net47\RagePhoto.Core.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>

View file

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.13.35919.96 d17.13 VisualStudioVersion = 17.13.35919.96 d17.13
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Syping.RagePhoto.Core", "Syping.RagePhoto.Core.csproj", "{00E62D4F-74D6-4167-ABB1-852FFEB65C84}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RagePhoto.Core", "RagePhoto.Core.csproj", "{00E62D4F-74D6-4167-ABB1-852FFEB65C84}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Condition="'$(OS)' == 'Windows_NT' AND '$(Platform)' == 'arm64'">
<Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-arm64\native\libragephoto.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>false</Pack>
</Content>
</ItemGroup>
<ItemGroup Condition="'$(OS)' == 'Windows_NT' AND '$(Platform)' == 'x64'">
<Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x64\native\libragephoto.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>false</Pack>
</Content>
</ItemGroup>
<ItemGroup Condition="'$(OS)' == 'Windows_NT' AND '$(Platform)' == 'x86'">
<Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\libragephoto.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>false</Pack>
</Content>
</ItemGroup>
</Project>

View file

@ -2,7 +2,7 @@
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
namespace Syping.RagePhoto { namespace RagePhoto {
public class Photo : IDisposable { public class Photo : IDisposable {

View file

@ -1,6 +1,6 @@
using System; using System;
namespace Syping.RagePhoto { namespace RagePhoto {
public class RagePhotoException : Exception { public class RagePhotoException : Exception {

View file

@ -1,6 +1,6 @@
using System; using System;
namespace Syping.RagePhoto { namespace RagePhoto {
public enum DefaultSize : UInt32 { public enum DefaultSize : UInt32 {
DEFAULT_GTA5_PHOTOBUFFER = 524288U, DEFAULT_GTA5_PHOTOBUFFER = 524288U,
@ -57,6 +57,7 @@ namespace Syping.RagePhoto {
} }
public enum PhotoFormat : UInt32 { public enum PhotoFormat : UInt32 {
JPEG = 0xE0FFD8FFU,
GTA5 = 0x01000000U, GTA5 = 0x01000000U,
RDR2 = 0x04000000U RDR2 = 0x04000000U
} }

View file

@ -1,17 +0,0 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Condition="'$(Platform)' == 'ARM64' and '$(OS)' == 'Windows_NT'">
<Content Include="$(MSBuildThisFileDirectory)..\runtimes\win-arm64\native\libragephoto.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup Condition="'$(Platform)' == 'x64' and '$(OS)' == 'Windows_NT'">
<Content Include="$(MSBuildThisFileDirectory)..\runtimes\win-x64\native\libragephoto.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup Condition="'$(Platform)' == 'x86' and '$(OS)' == 'Windows_NT'">
<Content Include="$(MSBuildThisFileDirectory)..\runtimes\win-x86\native\libragephoto.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View file

@ -1,6 +1,6 @@
############################################################################## ##############################################################################
# libragephoto for Python # libragephoto for Python
# Copyright (C) 2023-2024 Syping # Copyright (C) 2023-2025 Syping
# #
# Redistribution and use in source and binary forms, with or without modification, # Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met: # are permitted provided that the following conditions are met:

View file

@ -1,6 +1,6 @@
############################################################################## ##############################################################################
# libragephoto for Python # libragephoto for Python
# Copyright (C) 2023 Syping # Copyright (C) 2023-2025 Syping
# #
# Redistribution and use in source and binary forms, with or without modification, # Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met: # are permitted provided that the following conditions are met:

View file

@ -1,6 +1,6 @@
############################################################################## ##############################################################################
# libragephoto for Python # libragephoto for Python
# Copyright (C) 2023-2024 Syping # Copyright (C) 2023-2025 Syping
# #
# Redistribution and use in source and binary forms, with or without modification, # Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met: # are permitted provided that the following conditions are met:

View file

@ -1,6 +1,6 @@
############################################################################## ##############################################################################
# libragephoto for Python # libragephoto for Python
# Copyright (C) 2023-2024 Syping # Copyright (C) 2023-2025 Syping
# #
# Redistribution and use in source and binary forms, with or without modification, # Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met: # are permitted provided that the following conditions are met:
@ -73,6 +73,7 @@ class RagePhoto:
Uninitialised = 0 Uninitialised = 0
class PhotoFormat(IntEnum): class PhotoFormat(IntEnum):
JPEG = 0xE0FFD8FF
GTA5 = 0x01000000 GTA5 = 0x01000000
RDR2 = 0x04000000 RDR2 = 0x04000000

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
############################################################################## ##############################################################################
# libragephoto for Python # libragephoto for Python
# Copyright (C) 2023 Syping # Copyright (C) 2023-2025 Syping
# #
# Redistribution and use in source and binary forms, with or without modification, # Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met: # are permitted provided that the following conditions are met: