LGPL components of Rayman 3 HD Recompiled: corresponding source and replacement
================================================================================

Two libraries under the GNU Lesser General Public License are used. Each is a separate DLL in bin\ that
rexruntime.dll loads by name when the program starts. No other file of the program contains their code.

  bin\ffmpeg.dll   FFmpeg libavcodec + libavutil
                   source: https://github.com/wmarti/FFmpeg, commit 0604b464c7cb4ebc94940cf1f324a3b26b87717c
                   (the Xenia project's fork of FFmpeg 4.4, branch xenia-ffmpeg-canary-full, which adds the
                   XMA "xmaframes" decoder). Licence: LGPL version 2.1 or later (FFmpeg\COPYING.LGPLv2.1).
                   Configuration: FFmpeg\config_windows_x86_64.h of that commit, unchanged: CONFIG_GPL 0,
                   CONFIG_NONFREE 0, CONFIG_VERSION3 0; decoders mp3, mp3float, wmav2, wmapro, xmaframes;
                   parser mpegaudio; bitstream filter null (the header also enables two demuxers and the file
                   protocol of libavformat, which is not built). No external libraries, no assembly.
  bin\mspack.dll   libmspack, the LZX decompressor lzxd.c only (exports lzxd_*)
                   source: https://github.com/kyz/libmspack, commit 305907723a4e7ab2018e58040059ffb5e77db837,
                   directory libmspack\mspack. Licence: LGPL version 2.1 (libmspack\COPYING.LIB). Unmodified.

Neither library is modified by this project. The project adds only build files: ffmpeg.dll is the two static
FFmpeg libraries linked into one DLL that exports their "av*" symbols (as FFmpeg's own libavutil.v /
libavcodec.v do); mspack.dll is lzxd.c with every external symbol exported.

Corresponding source
--------------------
The source archive r3hd-lgpl-source-<version>.zip is distributed together with, and from the same place as, the
program. It holds:

  FFmpeg\                         the complete FFmpeg tree at the commit above
  libmspack\libmspack\            the complete libmspack library directory at the commit above
  ffmpeg-overlay\                 the decoder / parser / filter lists and the project's two build files
  CMakeLists.txt                  the build of both DLLs: the FFmpeg and libmspack sections of the ReXGlue SDK's
                                  thirdparty\CMakeLists.txt, copied unchanged except for the libmspack path
  ReXGlue-SDK-LICENSE.txt         the licence of the SDK build sections and list files (BSD-3-Clause)
  LGPL-BUILD-FILES-LICENSE.txt    the licence of the project's own build files (LGPL-2.1-or-later)
  MANIFEST.json                   versions, commits and the SHA-256 of every file in the archive
  README.txt                      this text

Rebuilding the DLLs (Windows x64)
---------------------------------
Tools used for the shipped DLLs: CMake 3.20 or later, Ninja, LLVM clang (23.1.3) and the Microsoft Visual C++ build
tools and Windows SDK (for the C runtime and system import libraries). Other compilers are not tested.

  1. Open "x64 Native Tools Command Prompt" (or run vcvars64.bat), with LLVM's bin folder on PATH.
  2. Unpack the archive, then in its folder:
       cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang "-DCMAKE_C_FLAGS=-march=x86-64-v2"
       cmake --build build --target ffmpeg mspack
  3. The new DLLs are build\ffmpeg.dll and build\mspack.dll.

Change any source file under FFmpeg\ or libmspack\ before step 2 to build a modified library.

Replacing the DLLs
------------------
Close the game, then copy your ffmpeg.dll and / or mspack.dll over the files in the installation's bin\ folder.
Keep a copy of the originals. A replacement must keep the interface the program was built with: the same exported
functions with the same declarations and structure layouts as in the headers at the commits above. rexruntime.dll
imports from ffmpeg.dll: av_buffer_alloc, av_frame_alloc, av_frame_free, av_log_set_callback, av_packet_alloc,
av_packet_free, av_strerror, avcodec_alloc_context3, avcodec_find_decoder (with the fork's AV_CODEC_ID_XMAFRAMES),
avcodec_free_context, avcodec_open2, avcodec_receive_frame, avcodec_send_packet; and from mspack.dll: lzxd_init,
lzxd_decompress, lzxd_free (it also reads the window and ref_data_size fields of struct lzxd_stream, lzx.h). An
upstream FFmpeg build has no xmaframes decoder, so game audio needs a build of this fork or a compatible one.
The installer's repair checks the shipped files by hash and puts the originals back if you run it again.

Portable copies: close both game and Settings, keep originals OUTSIDE app/ and bin/, then replace exactly
bin/ffmpeg.dll and/or bin/mspack.dll. Startup allows different sizes/hashes for these two paths only. Missing
files or files without a Windows x64 DLL header are refused with a specific diagnostic. Passing preparation
allows a replacement attempt; it does not certify exports, structure layouts, decoder support or dependencies.
A loader/runtime failure can still occur. Restore your saved originals or rebuild against the documented ABI.
The original ZIP audit still checks ALL shipped hashes, including these DLLs: audit it before replacement.
No automatic portable repair restores the libraries. Whole-folder relocation keeps them. For a fresh-folder
update, first verify the new ZIP, then deliberately reapply a compatible replacement; do not copy all of bin/.
The game executable and its imported libraries are adjacent in bin/; Windows resolves the normal named DLL
imports there under the existing loader rules. This policy changes no search directory and adds no PATH,
current-directory or plugin loading override. Dependencies must also be available under normal Windows
loading rules; portable refuses unlisted app/bin files. Builds needing extra private dependencies there need
separate packaging support and are not tested by this replacement contract.
