### Read and Inspect a Binary Parameter Archive Source: https://github.com/zeldamods/oead/blob/master/docs/source/aamp_py.rst Demonstrates loading a binary parameter archive from a file and accessing its properties and parameters. ```python import oead with open("Horse.baiprog", "rb") as f: pio = oead.aamp.ParameterIO.from_binary(f.read()) pio.version # 0 pio.type # "xml" pio.objects["DemoAIActionIdx"].params["Demo_Wait"] # Parameter(107) pio.objects["DemoAIActionIdx"].params["Demo_Wait"].v # 107 ``` -------------------------------- ### Configure Include Directories and Compiler Options Source: https://github.com/zeldamods/oead/blob/master/CMakeLists.txt Sets public and private include paths and applies compiler-specific warning flags. ```cmake target_include_directories(oead PUBLIC src/include) target_include_directories(oead PRIVATE src/) if (MSVC) target_compile_options(oead PRIVATE /W4 /wd4244 /wd4127 /Zc:__cplusplus) else() target_compile_options(oead PRIVATE -Wall -Wextra -fno-plt) endif() target_include_directories(oead SYSTEM PUBLIC lib/nonstd) ``` -------------------------------- ### Read and Access BYML Data Source: https://github.com/zeldamods/oead/blob/master/docs/source/byml_py.rst Demonstrates reading a binary BYML file and accessing its contents using dict-like and list-like indexing. ```python import oead with open("ActorInfo.product.byml", "rb") as f: info = oead.Byml.from_binary(f.read()) # info is a dict-like info["Actors"] # Array(...) info["Actors"][0] # Hash({'bugMask': Byml(S32(1)), ..., 'name': Byml('EnemyFortressMgrTag'), ...}) info["Actors"][0]["name"] # 'EnemyFortressMgrTag' ``` -------------------------------- ### CMake Project Configuration Source: https://github.com/zeldamods/oead/blob/master/py/CMakeLists.txt Sets the minimum required CMake version, project name, and standard C++17 requirements. ```cmake cmake_minimum_required(VERSION 3.10) project(oead CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_BUILD_TYPE Release) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) ``` -------------------------------- ### Set C++ Standard and Build Options Source: https://github.com/zeldamods/oead/blob/master/CMakeLists.txt Configures C++17 standard requirements and position-independent code settings. ```cmake set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_POSITION_INDEPENDENT_CODE ON) ``` -------------------------------- ### Linux/MinGW Archive Configuration Source: https://github.com/zeldamods/oead/blob/master/py/CMakeLists.txt Configures archive creation flags for GNU ar on Linux or MinGW environments. ```cmake if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW) # GNU ar: Create thin archive files. # Requires binutils-2.19 or later. set(CMAKE_C_ARCHIVE_CREATE " qcTP ") set(CMAKE_C_ARCHIVE_APPEND " qTP ") set(CMAKE_CXX_ARCHIVE_CREATE " qcTP ") set(CMAKE_CXX_ARCHIVE_APPEND " qTP ") endif() ``` -------------------------------- ### Configure CMake Project and Compiler Settings Source: https://github.com/zeldamods/oead/blob/master/CMakeLists.txt Sets the minimum CMake version, project name, and compiler-specific diagnostic flags. ```cmake cmake_minimum_required(VERSION 3.10) project(oead CXX) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") add_compile_options(-fdiagnostics-color=always) elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") add_compile_options(-fcolor-diagnostics) endif() ``` -------------------------------- ### Add Dependencies and Link Libraries Source: https://github.com/zeldamods/oead/blob/master/CMakeLists.txt Adds subdirectories for third-party libraries and links them to the oead target. ```cmake set(BUILD_TESTING OFF) add_subdirectory(lib/abseil) add_subdirectory(lib/EasyIterator) add_subdirectory(lib/libyaml) add_subdirectory(lib/ordered-map) add_subdirectory(lib/rapidyaml) # Enabling AVX2 would require users to have a recent CPU option(WITH_AVX2 "" OFF) option(ZLIB_ENABLE_TESTS "" OFF) add_subdirectory(lib/zlib-ng) target_link_libraries(oead PUBLIC absl::btree absl::flat_hash_map absl::hash EasyIterator tsl::ordered_map PRIVATE oead::res absl::inlined_vector absl::strings absl::str_format ryml yaml zlib ) ``` -------------------------------- ### oead.byml.from_binary Source: https://github.com/zeldamods/oead/blob/master/docs/source/byml_py.rst Parses a binary BYML file into a Python object. ```APIDOC ## oead.byml.from_binary(data) ### Description Reads a binary BYML file and returns a dict-like object representing the data. ### Parameters - **data** (bytes) - Required - The binary content of the BYML file. ``` -------------------------------- ### Define oead Library Target Source: https://github.com/zeldamods/oead/blob/master/CMakeLists.txt Lists source files and headers to be included in the oead library build. ```cmake add_library(oead src/include/oead/util/align.h src/include/oead/util/binary_reader.h src/include/oead/util/bit_utils.h src/include/oead/util/hash.h src/include/oead/util/iterator_utils.h src/include/oead/util/magic_utils.h src/include/oead/util/scope_guard.h src/include/oead/util/string_utils.h src/include/oead/util/swap.h src/include/oead/util/type_utils.h src/include/oead/util/variant_utils.h src/include/oead/aamp.h src/include/oead/byml.h src/include/oead/errors.h src/include/oead/gsheet.h src/include/oead/sarc.h src/include/oead/types.h src/include/oead/yaz0.h src/aamp.cpp src/aamp_text.cpp src/byml.cpp src/byml_text.cpp src/gsheet.cpp src/sarc.cpp src/yaml.cpp src/yaml.h src/yaz0.cpp ) ``` -------------------------------- ### Add Resource Library Source: https://github.com/zeldamods/oead/blob/master/CMakeLists.txt Includes external resource files into the build using the CMakeRC library. ```cmake include(CMakeRC.cmake) cmrc_add_resource_library(oead_res ALIAS oead::res NAMESPACE oead::res data/aglenv_file_info.json data/botw_hashed_names.txt data/botw_numbered_names.txt data/botw_resource_factory_info.tsv ) ``` -------------------------------- ### oead.byml.to_binary Source: https://github.com/zeldamods/oead/blob/master/docs/source/byml_py.rst Serializes a Python object into a binary BYML file. ```APIDOC ## oead.byml.to_binary(data) ### Description Converts a Python object into a binary BYML representation. ``` -------------------------------- ### Python Module Compilation Source: https://github.com/zeldamods/oead/blob/master/py/CMakeLists.txt Adds the pybind11 subdirectory and defines the oead-py module with its source files and library dependencies. ```cmake add_subdirectory(../lib/pybind11 pybind11) pybind11_add_module(oead-py main.h main.cpp py_aamp.cpp py_byml.cpp py_common_types.cpp py_gsheet.cpp py_sarc.cpp py_yaz0.cpp pybind11_common.h pybind11_variant_caster.h ) set_target_properties(oead-py PROPERTIES OUTPUT_NAME oead) add_subdirectory(../ oead) target_link_libraries(oead-py PRIVATE oead) ``` -------------------------------- ### ccache Integration Source: https://github.com/zeldamods/oead/blob/master/py/CMakeLists.txt Detects and configures ccache for faster compilation, including compiler-specific flag adjustments. ```cmake find_program(CCACHE_BIN ccache) if(CCACHE_BIN) set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_BIN}) set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_BIN}) # ccache uses -I when compiling without preprocessor, which makes clang complain. if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -fcolor-diagnostics") elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color") endif() endif() ``` -------------------------------- ### Include AAMP Header Source: https://github.com/zeldamods/oead/blob/master/docs/source/aamp.rst Include the necessary header file to access AAMP functionality. ```cpp #include ``` -------------------------------- ### oead.byml.from_text Source: https://github.com/zeldamods/oead/blob/master/docs/source/byml_py.rst Parses a YAML representation of a BYML file. ```APIDOC ## oead.byml.from_text(text) ### Description Parses a YAML string into a Python object. ``` -------------------------------- ### oead.byml.to_text Source: https://github.com/zeldamods/oead/blob/master/docs/source/byml_py.rst Serializes a Python object into a YAML string. ```APIDOC ## oead.byml.to_text(data) ### Description Converts a Python object into a YAML string representation. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.