### Meson Build Setup and Compilation Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/build/meson/README.md Instructions for setting up the Meson build system for zstandard, configuring build options, and compiling the project. This involves navigating to the meson directory, running 'meson setup' with desired options, changing into the build directory, and then using 'ninja' to build and 'ninja install' to install. ```shell meson setup -Dbin_programs=true -Dbin_contrib=true builddir cd builddir ninja ninja install ``` -------------------------------- ### Meson Staging Installation Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/build/meson/README.md Demonstrates how to install the zstandard library into a staging directory using Meson and Ninja. This is useful for temporary installations or packaging. ```shell DESTDIR=./staging ninja install ``` -------------------------------- ### Install MIO using CMake Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/mio/README.md Command to build and install MIO in release configuration. May require administrator privileges depending on the installation path. Installs header and CMake configuration files. ```bash cmake --build . --config Release --target install ``` -------------------------------- ### Install with Static Configuration (Make/Ninja) Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/mio/README.md This snippet demonstrates how to install the M2dev-Client-Src project using static configuration build tools like GNU Make or Ninja. It covers configuring CMake with an optional installation prefix and build testing disabled, followed by executing the install target. ```sh cd mkdir build cd build # Configure the build cmake [-D CMAKE_INSTALL_PREFIX="path/to/installation"] \ [-D BUILD_TESTING=False] \ -D CMAKE_BUILD_TYPE=Release \ -G <"Unix Makefiles" | "Ninja"> .. # install mio ``` -------------------------------- ### Install with Dynamic Configuration (Visual Studio/Xcode) Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/mio/README.md This snippet outlines the steps for installing the M2dev-Client-Src project using dynamic configuration build tools like Visual Studio or Xcode. It includes configuring CMake with an optional installation prefix and build testing disabled, preparing the project for installation. ```sh cd mkdir build cd build # Configure the project cmake [-D CMAKE_INSTALL_PREFIX="path/to/installation"] \ [-D BUILD_TESTING=False] \ -G <"Visual Studio 14 2015 Win64" | "Xcode"> .. ``` -------------------------------- ### C++ Example: Setting Up Warrior Combo Attack Source: https://context7.com/d1str4ught/m2dev-client-src/llms.txt Provides an example function to set up a warrior's combo attack. This involves creating a TMotionAttackData structure with specific combat properties and iterating to add hit detection frames with associated hit data. ```cpp // Example: Complete character attack setup void SetupWarriorAttack() { // Create combo attack motion NRaceData::TMotionAttackData combo; combo.iMotionType = NRaceData::MOTION_TYPE_COMBO; combo.iAttackType = NRaceData::ATTACK_TYPE_SPLASH; combo.iHittingType = NRaceData::HIT_TYPE_GREAT; combo.fExternalForce = 200.0f; combo.fStiffenTime = 0.5f; combo.iHitLimitCount = 3; // Add hit detection frames for (float t = 0.2f; t <= 0.6f; t += 0.1f) { NRaceData::THitData hit; ``` -------------------------------- ### Installing Zstd via VCPKG Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/README.md This snippet shows the process of cloning the VCPKG repository, bootstrapping it, integrating it with the system, and finally installing the Zstd library. VCPKG is a cross-platform package manager that simplifies the dependency management for Zstd. ```bash git clone https://github.com/Microsoft/vcpkg.git cd vcpkg ./bootstrap-vcpkg.sh ./vcpkg integrate install ./vcpkg install zstd ``` -------------------------------- ### Shell Script: Dictionaries Setup Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/tests/cli-tests/README.md This setup script runs before each test case within the 'dictionaries' test suite. It copies the 'files' and 'dicts' directories, created by 'setup_once', into the current test case's scratch directory. ```shell #!/bin/sh # Runs in the test case's scratch directory. # The test suite's scratch directory that # `setup_once` operates in is the parent directory. cp -r ../files ../dicts . ``` -------------------------------- ### Shell Script: Echo stdout Example Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/tests/cli-tests/README.md This shell script example prints 'hello world' to standard output. It is used to verify exact matches of stdout content. ```shell #!/bin/sh echo "hello world" ``` -------------------------------- ### Shell Script: Basic Test Setup Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/tests/cli-tests/README.md This shell script serves as a basic setup for a test case. It uses the 'datagen' command to create three files ('file', 'file0', 'file1') for testing purposes. ```shell #!/bin/sh # Create some files for testing with datagen > file datagen > file0 datagen > file1 ``` -------------------------------- ### Meson Build Configuration Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/build/meson/README.md Shows the command to configure build options for a Meson-based project after initial setup. This allows users to modify build parameters without re-running the initial setup. ```shell meson configure ``` -------------------------------- ### Checking for L1 Cache Misses with perf Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/CONTRIBUTING.md This example shows how to use 'perf' to specifically monitor the 'L1-dcache-load-misses' hardware counter. This is helpful when verifying if code optimizations have successfully reduced L1 data cache misses. ```bash perf --list ``` -------------------------------- ### Install Man Pages and Symlinks (CMake) Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/build/cmake/programs/CMakeLists.txt Copies Zstandard man pages (zstd.1, zstdgrep.1, zstdless.1) to the build directory and creates symbolic links for 'zstdcat.1' and 'unzstd.1' pointing to 'zstd.1'. Finally, it installs all generated man pages to the specified man directory, aiding in user documentation. ```cmake add_custom_target(zstd.1 ALL ${CMAKE_COMMAND} -E copy ${PROGRAMS_DIR}/zstd.1 . COMMENT "Copying manpage zstd.1") add_custom_target(zstdgrep.1 ALL ${CMAKE_COMMAND} -E copy ${PROGRAMS_DIR}/zstdgrep.1 . COMMENT "Copying manpage zstdgrep.1") add_custom_target(zstdless.1 ALL ${CMAKE_COMMAND} -E copy ${PROGRAMS_DIR}/zstdless.1 . COMMENT "Copying manpage zstdless.1") add_custom_target(zstdcat.1 ALL ${CMAKE_COMMAND} -E create_symlink zstd.1 zstdcat.1 DEPENDS zstd.1 COMMENT "Creating zstdcat.1 symlink") add_custom_target(unzstd.1 ALL ${CMAKE_COMMAND} -E create_symlink zstd.1 unzstd.1 DEPENDS zstd.1 COMMENT "Creating unzstd.1 symlink") # Define MAN_INSTALL_DIR if necessary if (MAN_INSTALL_DIR) else () set(MAN_INSTALL_DIR ${CMAKE_INSTALL_MANDIR}/man1) endif () install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zstd.1 ${CMAKE_CURRENT_BINARY_DIR}/zstdcat.1 ${CMAKE_CURRENT_BINARY_DIR}/unzstd.1 ${CMAKE_CURRENT_BINARY_DIR}/zstdgrep.1 ${CMAKE_CURRENT_BINARY_DIR}/zstdless.1 DESTINATION "${MAN_INSTALL_DIR}") ``` -------------------------------- ### Show CMake Build Options Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/build/cmake/README.md This command displays the available CMake build options for a project. It's useful for understanding configurable parameters before configuring the build. ```shell cd build/cmake/builddir cmake -LH .. ``` -------------------------------- ### Shell Script: Dictionaries Setup Once Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/tests/cli-tests/README.md This script is designed to run once before a test suite. It creates a 'files' directory with 10 generated files and then trains a Zstandard dictionary ('dicts/0') using these files. ```shell #!/bin/sh set -e mkdir files/ dicts/ for i in $(seq 10); do datagen -g1000 > files/$i done zstd --train -r files/ -o dicts/0 ``` -------------------------------- ### Generate MIO Package with CPack Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/mio/README.md Command to generate a packaged installation of MIO using CPack from the build directory. Requires specifying a generator name and build configuration. ```bash cpack -G -C Release ``` -------------------------------- ### CMake Recommended Style: If/Else/Endif Block Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/build/cmake/README.md This example illustrates the recommended CMake style for conditional blocks, emphasizing the use of empty 'else()' and 'endif()' commands for improved readability. It follows the convention of indenting the block body. ```cmake if(FOOVAR) some_command(...) else() another_command(...) endif() ``` -------------------------------- ### Get ZSTD Frame Content Size (C) Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/doc/zstd_manual.html Retrieves the decompressed size of a ZSTD encoded frame. It handles cases where the size is unknown or an error occurs, returning specific values for each scenario. Input `src` must point to the frame start, and `srcSize` should be at least the frame header size. ```c #define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1) #define ZSTD_CONTENTSIZE_ERROR (0ULL - 2) unsigned long long ZSTD_getFrameContentSize(const void *src, size_t srcSize); ``` -------------------------------- ### Initialize and Control Game Audio with SoundEngine Source: https://context7.com/d1str4ught/m2dev-client-src/llms.txt This snippet demonstrates the basic initialization and control of the SoundEngine, including setting master volumes, playing 2D interface sounds, and playing 3D positional sounds at specified world coordinates. It also shows how to manage the audio for game states like window minimization. ```cpp #include "AudioLib/SoundEngine.h" // Initialize audio engine singleton SoundEngine& audio = SoundEngine::Instance(); audio.Initialize(); // Set master volumes (0.0 to 1.0) audio.SetMasterVolume(1.0f); audio.SetSoundVolume(0.8f); audio.SetMusicVolume(0.6f); // Play 2D interface sound audio.PlaySound2D("sound/ui/click.wav"); audio.PlaySound2D("sound/ui/drop.wav"); // Play 3D positional sound at world coordinates float x = 1234.5f; float y = 5678.9f; float z = 100.0f; MaSoundInstance* sound3D = audio.PlaySound3D("sound/monster/attack.wav", x, y, z); if (sound3D) { // Sound instance can be used to control playback // Automatically spatialized based on listener position } // Play looping ambience sound MaSoundInstance* ambient = audio.PlayAmbienceSound3D( x, y, z, "sound/ambience/forest_birds.wav", -1 // Loop count: -1 for infinite, 0 for once, N for N times ); // Update listener position (typically camera/character position) float listenerX = 1200.0f; float listenerY = 5600.0f; float listenerZ = 150.0f; audio.SetListenerPosition(listenerX, listenerY, listenerZ); // Update listener orientation (forward and up vectors) float forwardX = 0.0f, forwardY = 1.0f, forwardZ = 0.0f; float upX = 0.0f, upY = 0.0f, upZ = 1.0f; audio.SetListenerOrientation(forwardX, forwardY, forwardZ, upX, upY, upZ); // Music system with crossfade audio.FadeInMusic("sound/music/main_theme.mp3", 0.8f, 2.0f); // Parameters: file path, target volume, fade duration in seconds // Fade out current music audio.FadeOutMusic("sound/music/main_theme.mp3", 0.0f, 1.5f); // Fade out all music (for game exit or major scene change) audio.FadeOutAllMusic(); // Stop all 3D sounds (useful for map changes) audio.StopAllSound3D(); // Volume management during window state changes audio.SaveVolume(true); // Mute when minimized audio.RestoreVolume(); // Restore when window regains focus // Per-frame update (call in main game loop) void GameLoop() { while (running) { // Update audio system audio.Update(); // Update character position for listener audio.SetListenerPosition(player.x, player.y, player.z); // Render and other game logic... } } // Example: Complete audio setup for new map void LoadMap(const char* mapName) { // Stop all existing sounds audio.StopAllSound3D(); audio.FadeOutAllMusic(); // Load new background music with fade in std::string musicPath = std::string("sound/music/") + mapName + ".mp3"; audio.FadeInMusic(musicPath, 0.7f, 3.0f); // Play ambient sounds for environment audio.PlayAmbienceSound3D(100.0f, 100.0f, 50.0f, "sound/ambience/wind.wav", -1); audio.PlayAmbienceSound3D(500.0f, 600.0f, 20.0f, "sound/ambience/water.wav", -1); } ``` -------------------------------- ### Building Zstd with CMake (Universal2 Support) Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/README.md This example demonstrates how to build Zstd with support for both Apple Silicon and Intel architectures using CMake. It configures the build for Universal2 output and specifies the target architectures. This is useful for creating cross-compatible binaries. ```bash cmake -B build-cmake-debug -S build/cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="x86_64;x86_64h;arm64" cd build-cmake-debug ninja sudo ninja install ``` -------------------------------- ### Install Crypto++ Library and Export Targets (CMake) Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/cryptopp/CMakeLists.txt This section of the CMake script handles the installation of the Crypto++ library. It conditionally installs shared and static library targets, exports CMake configuration files for package management, and installs header files. It also sets up installation directories based on CMake variables. ```cmake set(export_name "cryptopp-targets") # Runtime package if (BUILD_SHARED) export(TARGETS cryptopp-shared FILE ${export_name}.cmake ) install( TARGETS cryptopp-shared EXPORT ${export_name} DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) endif () # Development package if (BUILD_STATIC) export(TARGETS cryptopp-static FILE ${export_name}.cmake ) install(TARGETS cryptopp-static EXPORT ${export_name} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif () install(FILES ${cryptopp_headers} DESTINATION include/cryptopp) ``` -------------------------------- ### Initialize and Use CPackManager for Game Resource Loading Source: https://context7.com/d1str4ught/m2dev-client-src/llms.txt Demonstrates how to initialize the CPackManager singleton, add pack files, set the loading mode, check for file existence, and retrieve file data. It also shows examples of loading textures and Python scripts from packs, along with a complete initialization sequence for multiple pack files. Dependencies include the 'PackLib/PackManager.h' header and standard C++ libraries. ```cpp #include "PackLib/PackManager.h" #include #include #include // Initialize pack manager singleton CPackManager& packMgr = CPackManager::Instance(); // Add pack files (typically .epk or .eix/.mix pairs) packMgr.AddPack("pack/patch1.eix"); packMgr.AddPack("pack/season3_eu.eix"); packMgr.AddPack("pack/patch2.eix"); packMgr.AddPack("pack/metin2_patch_snow.eix"); // Set loading mode packMgr.SetPackLoadMode(); // Load from pack files (default) // packMgr.SetFileLoadMode(); // Load directly from filesystem // Check if file exists in packs bool exists = packMgr.IsExist("d:/ymir work/ui/logo.dds"); if (exists) { // File found in pack system } // Get file data from pack struct TPackFile { const uint8_t* data; size_t size; }; TPackFile fileData; bool success = packMgr.GetFile("d:/ymir work/monster/mob_001/model.gr2", fileData); if (success) { // fileData.data contains raw file bytes // fileData.size contains file size const uint8_t* rawData = fileData.data; size_t dataSize = fileData.size; // Use the data (texture, model, etc.) // Note: data is memory-mapped, no need to free } // Load texture from pack TPackFile textureData; if (packMgr.GetFile("d:/ymir work/ui/pattern/border_a.tga", textureData)) { // Pass to graphics engine for texture creation // GraphicsEngine::LoadTextureFromMemory(textureData.data, textureData.size); } // Load Python script from pack TPackFile scriptData; if (packMgr.GetFile("uiscript/mainmenu.py", scriptData)) { // Execute Python script // PythonEngine::ExecuteMemory((const char*)scriptData.data, scriptData.size); } // Example: Complete pack initialization sequence bool PackInitialize(const char* folder) { if (_access(folder, 0) != 0) return false; std::vector packFiles = { "patch1", "season3_eu", "patch2", "metin2_patch_snow", "metin2_patch_etc_costume1", "metin2_patch_pet1", "_texcache" // Required for new map textures }; for (const auto& packName : packFiles) { std::string packPath = std::string(folder) + "/" + packName + ".eix"; if (!packMgr.AddPack(packPath)) { // Handle error: pack file missing or corrupted return false; } } return true; } ``` -------------------------------- ### Install Crypto++ Tests and Documentation (CMake) Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/cryptopp/CMakeLists.txt This CMake script configures the installation of testing-related components and generated documentation for the Crypto++ library. It installs the test executable, test data directories, and the Doxygen-generated HTML documentation to their respective locations on the system, based on standard CMake installation directories. ```cmake # Tests if (BUILD_TESTING) install(TARGETS cryptest DESTINATION ${CMAKE_INSTALL_BINDIR}) install(DIRECTORY ${SRC_DIR}/TestData DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cryptopp) install(DIRECTORY ${SRC_DIR}/TestVectors DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cryptopp) endif () # Documentation if (BUILD_DOCUMENTATION) install(DIRECTORY "${out_source_DOCS_DIR}" DESTINATION ${CMAKE_INSTALL_DOCDIR}) endif () ``` -------------------------------- ### Benchmarking with zstd Command Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/CONTRIBUTING.md This command-line snippet demonstrates how to run a benchmark using the zstd compression tool for a duration of 5 seconds. It's useful for profiling code performance. ```bash $ zstd -b1 -i5 # this will run for 5 seconds ``` -------------------------------- ### Install generated HTML documentation with CMake Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/build/cmake/contrib/gen_html/CMakeLists.txt This CMake command installs the generated 'zstd_manual.html' file to the destination directory specified by 'CMAKE_INSTALL_DOCDIR'. This ensures the documentation is available after the project is installed. ```cmake install(FILES "${PROJECT_BINARY_DIR}/zstd_manual.html" DESTINATION "${CMAKE_INSTALL_DOCDIR}") ``` -------------------------------- ### Build and Test with Static Configuration (Make/Ninja) Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/mio/README.md This snippet shows how to configure, build, and run tests for the M2dev-Client-Src project using static configuration build tools like GNU Make or Ninja. It involves creating a build directory, configuring CMake with build type and generator, building the project, and then running tests using make test, ninja test, or cmake --build . --target test. ```sh cd mkdir build cd build # Configure the build cmake -D CMAKE_BUILD_TYPE= \ -G <"Unix Makefiles" | "Ninja"> .. # build the tests < make | ninja | cmake --build . > # run the tests < make test | ninja test | cmake --build . --target test | ctest > ``` -------------------------------- ### Install Zstandard Executable and Symlinks (CMake) Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/build/cmake/programs/CMakeLists.txt Installs the 'zstd' executable to the runtime destination directory. On UNIX systems, it also creates symbolic links for 'zstdcat' and 'unzstd' pointing to 'zstd', and installs the 'zstdgrep' and 'zstdless' programs. This ensures common Zstandard utilities are accessible. ```cmake install(TARGETS zstd RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}") if (UNIX) add_custom_target(zstdcat ALL ${CMAKE_COMMAND} -E create_symlink zstd zstdcat DEPENDS zstd COMMENT "Creating zstdcat symlink") add_custom_target(unzstd ALL ${CMAKE_COMMAND} -E create_symlink zstd unzstd DEPENDS zstd COMMENT "Creating unzstd symlink") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zstdcat DESTINATION "${CMAKE_INSTALL_BINDIR}") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unzstd DESTINATION "${CMAKE_INSTALL_BINDIR}") install(PROGRAMS ${PROGRAMS_DIR}/zstdgrep DESTINATION "${CMAKE_INSTALL_BINDIR}") install(PROGRAMS ${PROGRAMS_DIR}/zstdless DESTINATION "${CMAKE_INSTALL_BINDIR}") endif () ``` -------------------------------- ### PZstandard Piping and Standard Output Usage Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/contrib/pzstd/README.md Demonstrates how to use PZstandard with standard input/output and pipes, redirecting output to /dev/null. This example shows compression using a specified number of threads. ```bash cat input-file | pzstd -p num-threads -# -c > /dev/null ``` -------------------------------- ### Generate ZSTD Package Config Files (CMake) Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/build/cmake/CMakeLists.txt Configures and installs CMake package configuration files (`zstdConfig.cmake` and `zstdConfigVersion.cmake`). These files allow other CMake projects to find and use the installed zstd library. It uses `CMakePackageConfigHelpers` and `export` commands to manage target exports and installation paths. ```cmake #----------------------------------------------------------------------------- # Generate Package Config files # # This section is based on the boiler plate code from: # https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#creating-packages #----------------------------------------------------------------------------- include(CMakePackageConfigHelpers) write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/zstdConfigVersion.cmake" VERSION ${zstd_VERSION} COMPATIBILITY SameMajorVersion ) # A Package Config file that works from the build directory export(EXPORT zstdExports FILE "${CMAKE_CURRENT_BINARY_DIR}/zstdTargets.cmake" NAMESPACE zstd:: ) # A Package Config file that works from the installation directory set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/zstd) install(EXPORT zstdExports FILE zstdTargets.cmake NAMESPACE zstd:: DESTINATION ${ConfigPackageLocation} ) configure_package_config_file( zstdConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/zstdConfig.cmake" INSTALL_DESTINATION ${ConfigPackageLocation} ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zstdConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/zstdConfigVersion.cmake" DESTINATION ${ConfigPackageLocation} ) ``` -------------------------------- ### Configure CPack for Project Packaging (CMake) Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/mio/CMakeLists.txt Sets up CPack to generate installation packages for the project. This includes defining the package vendor, summary description, homepage URL, license file, and version information. CPack can then be used to create various installer formats like tarballs, debian packages, or NSIS installers. ```cmake if(NOT subproject) set(CPACK_PACKAGE_VENDOR "mandreyel") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Cross-platform C++11 header-only library for memory mapped file IO") set(CMAKE_PROJECT_HOMEPAGE_URL "https://github.com/mandreyel/mio") set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") include(CPack) endif() ``` -------------------------------- ### PZstandard Help Command Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/contrib/pzstd/README.md Displays the help message for PZstandard, which includes all available options and configurations, such as the default number of threads. ```bash pzstd --help ``` -------------------------------- ### Shell Script: Exit 1 Example Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/tests/cli-tests/README.md This example demonstrates a shell script that intentionally exits with a status code of 1. It is used to test expectation matching for exit codes. ```shell #!/bin/sh exit 1 ``` -------------------------------- ### CMake Package Configuration (CMake) Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/cryptopp/CMakeLists.txt This CMake code generates and installs package configuration files for Crypto++. It utilizes `write_basic_package_version_file` to create a version file and then installs the main configuration file (`cryptopp-config.cmake`) and the version file into the CMake package directory. This enables other projects to find and use the installed Crypto++ library via CMake's find_package mechanism. ```cmake if (NOT CMAKE_VERSION VERSION_LESS 2.8.8) include(CMakePackageConfigHelpers) write_basic_package_version_file("${PROJECT_BINARY_DIR}/cryptopp-config-version.cmake" VERSION ${cryptopp_VERSION_MAJOR}.${cryptopp_VERSION_MINOR}.${cryptopp_VERSION_PATCH} COMPATIBILITY SameMajorVersion) install(FILES cryptopp-config.cmake ${PROJECT_BINARY_DIR}/cryptopp-config-version.cmake DESTINATION "lib/cmake/cryptopp") install(EXPORT ${export_name} DESTINATION "lib/cmake/cryptopp") endif () ``` -------------------------------- ### C++ Character Job and Motion Key Setup Source: https://context7.com/d1str4ught/m2dev-client-src/llms.txt Demonstrates setting character job types using an enumeration and defining motion keyframes for animations. Motion keys are created using macros like MAKE_MOTION_KEY and MAKE_RANDOM_MOTION_KEY, with functions to extract their components. ```cpp #include "GameLib/GameType.h" // Character job enumeration NRaceData::EJobs playerJob = NRaceData::JOB_WARRIOR; // Available jobs: // - JOB_WARRIOR (0): Melee fighter // - JOB_ASSASSIN (1): Agile melee/ranged // - JOB_SURA (0): Magic warrior // - JOB_SHAMAN (3): Healer/caster // Motion key system for animation management MOTION_KEY idleMotion = MAKE_MOTION_KEY(0, 0); // mode=0, index=0 MOTION_KEY attackMotion = MAKE_MOTION_KEY(1, 2); // mode=1, index=2 MOTION_KEY randomMotion = MAKE_RANDOM_MOTION_KEY(2, 5, 3); // mode=2, index=5, type=3 // Extract motion components BYTE mode = GET_MOTION_MODE(attackMotion); // Returns 1 WORD index = GET_MOTION_INDEX(attackMotion); // Returns 2 BYTE subIndex = GET_MOTION_SUB_INDEX(randomMotion); // Returns 3 ``` -------------------------------- ### Install Project Headers and CMake Configuration Files (CMake) Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/mio/CMakeLists.txt Installs the header files from the 'include/mio' directory to the system's include directory, preserving relative paths. It also installs the 'mio-headers' target and generates CMake configuration files ('mio-targets.cmake', 'mio-config-version.cmake', 'mio-config.cmake') for external projects to find and use the 'mio' library via `find_package`. ```cmake install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" FILES_MATCHING PATTERN "*.*pp") install(TARGETS mio mio-headers EXPORT mioTargets) if(WIN32) install(TARGETS mio_full_winapi mio_min_winapi EXPORT mioTargets) endif() install(EXPORT mioTargets FILE mio-targets.cmake NAMESPACE mio:: DESTINATION share/cmake/mio) write_basic_package_version_file("mio-config-version.cmake" VERSION ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion) configure_file( "${PROJECT_SOURCE_DIR}/cmake/mio-config.cmake.in" "${PROJECT_BINARY_DIR}/mio-config.cmake" @ONLY) install(FILES "${PROJECT_BINARY_DIR}/mio-config-version.cmake" "${PROJECT_BINARY_DIR}/mio-config.cmake" DESTINATION share/cmake/mio) ``` -------------------------------- ### Enabling zstd Compression at Runtime Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/zlibWrapper/README.md Demonstrates how to enable zstd compression for the zlib wrapper at runtime using a dedicated function. This provides flexibility to switch between zlib and zstd compression without recompiling. ```c void ZWRAP_useZSTDcompression(int turn_on); ``` -------------------------------- ### Run Basic Validation Tests Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/cryptopp/Install.txt This command executes the basic system checks and algorithm exercises provided by the Crypto++ test harness. The expected outcome is a report indicating '0 failed tests' at the end of the output. ```bash ./cryptest.exe v ``` -------------------------------- ### Configure Locale Settings from File Source: https://context7.com/d1str4ught/m2dev-client-src/llms.txt Loads locale configuration from 'locale_list.txt'. This function sets global variables for reporting port, code page, locale name, and constructs the locale path. It expects a file format of ' '. ```cpp #include "Locale.h" // Locale configuration file format (locale_list.txt): // // Example: 10000 1253 gr // Load locale configuration from file LocaleService_LoadConfig("locale_list.txt"); // This sets: // - MULTI_LOCALE_REPORT_PORT (error reporting port) // - MULTI_LOCALE_CODE (Windows code page) // - MULTI_LOCALE_NAME (locale identifier) // - MULTI_LOCALE_PATH (constructed as "locale/") ``` -------------------------------- ### Build and Test with Dynamic Configuration (Visual Studio/Xcode) Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/mio/README.md This snippet details the process of configuring, building, and running tests for the M2dev-Client-Src project with dynamic configuration build tools such as Visual Studio or Xcode. It includes CMake configuration, building the project, and executing tests via ctest or CMake's build tool mode. ```sh cd mkdir build cd build # Configure the build cmake -G <"Visual Studio 14 2015 Win64" | "Xcode"> .. # build the tests cmake --build . --config # run the tests via ctest... ctest --build-config # ... or via CMake build tool mode... cmake --build . --config --target test ``` -------------------------------- ### CMake Subproject and Installation Option Configuration Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/mio/CMakeLists.txt Configures options related to subproject integration and installation. It determines if the project is a subproject and manages the 'INSTALL_SUBPROJECTS' and 'mio.installation' options accordingly. The 'mio.installation' option is marked as advanced. ```cmake if(DEFINED PROJECT_NAME) set(subproject ON) if(NOT DEFINED INSTALL_SUBPROJECTS) set(INSTALL_SUBPROJECTS ON CACHE BOOL "Install subproject dependencies") endif() else() set(subproject OFF) set_property(GLOBAL PROPERTY USE_FOLDERS ON) endif() CMAKE_DEPENDENT_OPTION(mio.installation "Include mio in the install set" "${INSTALL_SUBPROJECTS}" "subproject" ON) mark_as_advanced(mio.installation) ``` -------------------------------- ### ZSTD Command Line Interface Usage Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/lib/dll/example/README.md Demonstrates the basic usage of the ZSTD command-line utility for compression. It supports gzip-like arguments and allows specifying input and output files. Advanced options for compression ratios and benchmarking are available. ```bash Usage: zstd [arg] [input] [output] ``` -------------------------------- ### Get ZSTD Decompressed Size (Deprecated) (C) Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/doc/zstd_manual.html An obsolete function to get the decompressed size of a ZSTD frame. It returns 0 for unknown, empty, or error states, making it less informative than `ZSTD_getFrameContentSize`. This function is replaced by `ZSTD_getFrameContentSize`. ```c ZSTD_DEPRECATED("Replaced by ZSTD_getFrameContentSize") ZSTDLIB_API unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize); ``` -------------------------------- ### Zstd Dictionary Compression Workflow Source: https://github.com/d1str4ught/m2dev-client-src/blob/main/vendor/zstd-1.5.7/README.md This snippet outlines the command-line steps to utilize Zstd's dictionary-based compression for small data. It covers dictionary training, compression with a dictionary, and decompression using the same dictionary. This method significantly improves compression ratios for small, correlated datasets. ```bash zstd --train FullPathToTrainingSet/* -o dictionaryName zstd -D dictionaryName FILE zstd -D dictionaryName --decompress FILE.zst ```