diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index c2f217b1f08f..47bc0ec20508 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -9,3 +9,17 @@ # Reformat Android code 248ee12aed057acd0bdd310359c328e8d4fd5e5a + +# Enum and struct indentation cleanup +40182a48a56b8e294e126c64f5f37910a40c67cd +ebb48d019eec1c29a37a406e2db16d7565367faa + +# SVN line-ending conversion +30c883bcfc65761dc9fb61fea16a25fb61a7e220 + +# Trailing whitespace +c579637eafb9e9eb7f83711569254bd8da6d09d2 +664c8d30a055f4762a2a60be77c1c8eaec1a5d85 + +# Additional reformatting +40bb9974f21878e64fb03d70e717cb996bf13a29 diff --git a/CMake/CCache.cmake b/CMake/CCache.cmake index 9388b0a28fcd..775256cd3b97 100644 --- a/CMake/CCache.cmake +++ b/CMake/CCache.cmake @@ -1,7 +1,6 @@ -find_program(CCACHE_BIN ccache) +find_program(CCACHE_BIN NAMES ccache sccache) 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") diff --git a/CMake/CheckAndAddFlag.cmake b/CMake/CheckAndAddFlag.cmake index edd0e8cc7eac..226e57083341 100644 --- a/CMake/CheckAndAddFlag.cmake +++ b/CMake/CheckAndAddFlag.cmake @@ -29,20 +29,27 @@ function(check_and_add_flag var flag) set(is_c "$") set(is_cxx "$") + set(test_flags_c) + set(test_flags_cxx) # The Visual Studio generators don't support COMPILE_LANGUAGE # So we fail all the C flags and only actually test CXX ones if(CMAKE_GENERATOR MATCHES "Visual Studio") set(is_c "0") set(is_cxx "1") + else() + # Otherwise assume the compile follows GCC syntax + # and fail when the option is known but invalid. + set(test_flags_c "${test_flags_c}-Werror ") + set(test_flags_cxx "${test_flags_cxx}-Werror ") endif() - check_c_compiler_flag(${flag} FLAG_C_${var}) + check_c_compiler_flag("${test_flags_c}${flag}" FLAG_C_${var}) if(FLAG_C_${var}) add_compile_options("$<$:${flag}>") endif() - check_cxx_compiler_flag(${flag} FLAG_CXX_${var}) + check_cxx_compiler_flag("${test_flags_cxx}${flag}" FLAG_CXX_${var}) if(FLAG_CXX_${var}) add_compile_options("$<$:${flag}>") endif() diff --git a/CMake/FindBlueZ.cmake b/CMake/FindBlueZ.cmake index b82e7bdb0fd7..3b80a703ae78 100644 --- a/CMake/FindBlueZ.cmake +++ b/CMake/FindBlueZ.cmake @@ -6,7 +6,7 @@ # # vim: expandtab sw=4 ts=4 sts=4: -include(FindPkgConfig) +find_package(PkgConfig QUIET) pkg_check_modules (BlueZ_PKG QUIET bluez) find_path(BlueZ_INCLUDE_DIR NAMES bluetooth/bluetooth.h diff --git a/CMake/FindCubeb.cmake b/CMake/FindCUBEB.cmake similarity index 100% rename from CMake/FindCubeb.cmake rename to CMake/FindCUBEB.cmake diff --git a/CMake/FindLibevdev.cmake b/CMake/FindLIBEVDEV.cmake similarity index 94% rename from CMake/FindLibevdev.cmake rename to CMake/FindLIBEVDEV.cmake index e89a5f229d6b..f01e41a562de 100644 --- a/CMake/FindLibevdev.cmake +++ b/CMake/FindLIBEVDEV.cmake @@ -27,7 +27,7 @@ set(LIBEVDEV_LIBRARIES ${LIBEVDEV_LIBRARY} ) set(LIBEVDEV_INCLUDE_DIRS ${LIBEVDEV_INCLUDE_DIR} ) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(libevdev DEFAULT_MSG +find_package_handle_standard_args(LIBEVDEV DEFAULT_MSG LIBEVDEV_LIBRARY LIBEVDEV_INCLUDE_DIR) mark_as_advanced(LIBEVDEV_INCLUDE_DIR LIBEVDEV_LIBRARY ) diff --git a/CMake/FindLibudev.cmake b/CMake/FindLIBUDEV.cmake similarity index 100% rename from CMake/FindLibudev.cmake rename to CMake/FindLIBUDEV.cmake diff --git a/CMake/FindMbedTLS.cmake b/CMake/FindMBEDTLS.cmake similarity index 100% rename from CMake/FindMbedTLS.cmake rename to CMake/FindMBEDTLS.cmake diff --git a/CMake/FindMiniupnpc.cmake b/CMake/FindMINIUPNPC.cmake similarity index 100% rename from CMake/FindMiniupnpc.cmake rename to CMake/FindMINIUPNPC.cmake diff --git a/CMake/FindOpenXR.cmake b/CMake/FindOpenXR.cmake new file mode 100644 index 000000000000..1870754f5ef7 --- /dev/null +++ b/CMake/FindOpenXR.cmake @@ -0,0 +1,335 @@ +# Copyright 2019 Collabora, Ltd. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# +# Original Author: +# 2019 Ryan Pavlik + +#.rst: +# FindOpenXR +# ---------- +# +# Find various parts of OpenXR 1.0. +# +# COMPONENTS +# ^^^^^^^^^^ +# +# This module respects several COMPONENTS: ``headers``, ``loader``, ``registry``, ``specscripts``, and +# ``sdkscripts``. If no components are specified, ``headers`` and ``loader`` are assumed. +# +# Cache variables +# ^^^^^^^^^^^^^^^ +# +# The following cache variables may also be set to assist/control the operation of this module: +# +# Related to the ``OpenXR-SDK`` repo (this is the repo with pre-built headers), +# the ``OpenXR-SDK-Source`` repo , or the internal Khronos GitLab ``openxr`` repo: +# +# ``OPENXR_SDK_SRC_DIR`` +# Path to the root of the ``openxr``, ``OpenXR-SDK``, or ``OpenXR-SDK-Source`` repo source. +# ``OPENXR_SDK_BUILD_DIR`` +# Path to the root of the build directory corresponding to the ``openxr``, ``OpenXR-SDK``, or ``OpenXR-SDK-Source`` repo. +# + +# Normalize paths +foreach(PATHVAR OPENXR_SDK_DIR OPENXR_SDK_BUILD_DIR) + if(${${PATHVAR}}) + file(TO_CMAKE_PATH ${${PATHVAR}} ${PATHVAR}) + endif() +endforeach() + +# Set up cache variables +set(OPENXR_SDK_SRC_DIR "${OPENXR_SDK_SRC_DIR}" + CACHE PATH "The root of your OpenXR-SDK, OpenXR-SDK-Source, or GitLab openxr source directory - see https://github.com/KhronosGroup/OpenXR-SDK") +set(OPENXR_SDK_BUILD_DIR "${OPENXR_SDK_BUILD_DIR}" + CACHE PATH "The root of your OpenXR-SDK, OpenXR-SDK-Source, or GitLab openxr build directory.") + +# Currently only explicitly supporting 1.0 +set(OPENXR_MAJOR_VER 1) +set(OPENXR_MINOR_VER 0) +set(OPENXR_OUT_DIR ${OPENXR_MAJOR_VER}.${OPENXR_MINOR_VER}) +if(WIN32) + set(OPENXR_STATIC ON) +else() + set(OPENXR_STATIC OFF) +endif() + +### +# Assemble lists of places to look +### +set(_oxr_include_search_dirs) +set(_oxr_loader_search_dirs) +set(_oxr_specscripts_search_dirs) +set(_oxr_sdkscripts_search_dirs) +set(_oxr_registry_search_dirs) + +# These are macros to avoid a new variable scope. + +# Macro to extend search locations given a source dir. +macro(_oxr_handle_potential_root_src_dir _dir) + list(APPEND _oxr_include_search_dirs + "${_dir}/include" + "${_dir}/specification/out/${OPENXR_OUT_DIR}") + list(APPEND _oxr_registry_search_dirs + "${_dir}/specification/registry/") + list(APPEND _oxr_specscripts_search_dirs + "${_dir}/specification/scripts/") + list(APPEND _oxr_sdkscripts_search_dirs + "${_dir}/src/scripts/") +endmacro() + +# Macro to extend search locations given a build dir. +macro(_oxr_handle_potential_root_build_dir _dir) + list(APPEND _oxr_include_search_dirs + "${_dir}/include") + list(APPEND _oxr_loader_search_dirs + "${_dir}/src/loader") +endmacro() + +set(_oxr_build_tag) +if(OPENXR_STATIC) + set(_oxr_build_type static) +else() + set(_oxr_build_type dynamic) +endif() +if(MSVC_VERSION GREATER 1919) + # Can use 2019 + set(_oxr_build_tag msvs2019_${_oxr_build_type}) +endif() + +set(_oxr_lib_path_suffixes) +if(WIN32) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + list(APPEND _oxr_lib_path_suffixes lib) + if(_oxr_build_tag) + list(APPEND _oxr_lib_path_suffixes ${_oxr_build_tag}/lib) + endif() + else() + list(APPEND _oxr_lib_path_suffixes lib32) + if(_oxr_build_tag) + list(APPEND _oxr_lib_path_suffixes ${_oxr_build_tag}/lib32) + endif() + list(APPEND _oxr_lib_path_suffixes lib) + endif() +endif() + +# User-supplied directories +if(OPENXR_SDK_SRC_DIR) + _oxr_handle_potential_root_src_dir(${OPENXR_SDK_SRC_DIR}) +endif() +if(OPENXR_ROOT_BUILD_DIR) + _oxr_handle_potential_root_build_dir(${OPENXR_ROOT_BUILD_DIR}) +endif() + +# Guessed build dir based on src dir +if(OPENXR_SDK_SRC_DIR) + _oxr_handle_potential_root_build_dir("${OPENXR_SDK_SRC_DIR}/build") +endif() + +# Guesses of sibling directories by name - last resort. +foreach(_dir "${CMAKE_SOURCE_DIR}/../OpenXR-SDK" "${CMAKE_SOURCE_DIR}/../OpenXR-SDK-Source" "${CMAKE_SOURCE_DIR}/../openxr") + _oxr_handle_potential_root_src_dir(${_dir}) + _oxr_handle_potential_root_build_dir(${_dir}/build) +endforeach() + +### +# Search for includes +### + +# This must also contain openxr/openxr_platform.h +find_path(OPENXR_OPENXR_INCLUDE_DIR + NAMES + openxr/openxr.h + PATHS + ${_oxr_include_search_dirs} +) + +find_path(OPENXR_PLATFORM_DEFINES_INCLUDE_DIR + NAMES + openxr/openxr_platform_defines.h + PATHS + ${_oxr_include_search_dirs} +) + +### +# Search for other parts +### +find_library(OPENXR_loader_LIBRARY + NAMES + libopenxr_loader + openxr_loader + openxr_loader-${OPENXR_MAJOR_VER}_${OPENXR_MINOR_VER} + PATHS + ${_oxr_loader_search_dirs} + PATH_SUFFIXES + ${_oxr_lib_path_suffixes}) + +find_path(OPENXR_SPECSCRIPTS_DIR + NAMES + reg.py + PATHS + ${_oxr_specscripts_search_dirs}) + +find_path(OPENXR_SDKSCRIPTS_DIR + NAMES + automatic_source_generator.py + PATHS + ${_oxr_sdkscripts_search_dirs}) + +find_file(OPENXR_REGISTRY + NAMES xr.xml + PATHS + ${_oxr_registry_search_dirs}) + +### +# Fix up list of requested components +### +if(NOT OpenXR_FIND_COMPONENTS) + # Default to headers and loader + set(OpenXR_FIND_COMPONENTS headers loader) +endif() + +if("${OpenXR_FIND_COMPONENTS}" MATCHES "scripts" AND NOT "${OpenXR_FIND_COMPONENTS}" MATCHES "registry") + # scripts depend on registry (mostly). + list(APPEND OpenXR_FIND_COMPONENTS registry) +endif() + +if("${OpenXR_FIND_COMPONENTS}" MATCHES "loader" AND NOT "${OpenXR_FIND_COMPONENTS}" MATCHES "headers") + # loader depends on headers. + list(APPEND OpenXR_FIND_COMPONENTS headers) +endif() + +if("${OpenXR_FIND_COMPONENTS}" MATCHES "sdkscripts" AND NOT "${OpenXR_FIND_COMPONENTS}" MATCHES "specscripts") + # source scripts depend on spec scripts. + list(APPEND OpenXR_FIND_COMPONENTS specscripts) +endif() + +### +# Determine if the various requested components are found. +### +set(_oxr_component_required_vars) +foreach(_comp IN LISTS OpenXR_FIND_COMPONENTS) + + if(${_comp} STREQUAL "headers") + list(APPEND _oxr_component_required_vars + OPENXR_OPENXR_INCLUDE_DIR + OPENXR_PLATFORM_DEFINES_INCLUDE_DIR) + if(EXISTS "${OPENXR_OPENXR_INCLUDE_DIR}/openxr/openxr.h" + AND EXISTS "${OPENXR_OPENXR_INCLUDE_DIR}/openxr/openxr_platform.h" + AND EXISTS "${OPENXR_PLATFORM_DEFINES_INCLUDE_DIR}/openxr/openxr_platform_defines.h" + AND EXISTS "${OPENXR_PLATFORM_DEFINES_INCLUDE_DIR}/openxr/openxr_reflection.h") + set(OpenXR_headers_FOUND TRUE) + mark_as_advanced(OPENXR_OPENXR_INCLUDE_DIR OPENXR_PLATFORM_DEFINES_INCLUDE_DIR) + else() + set(OpenXR_headers_FOUND FALSE) + endif() + + elseif(${_comp} STREQUAL "loader") + list(APPEND _oxr_component_required_vars OPENXR_loader_LIBRARY) + if(EXISTS "${OPENXR_loader_LIBRARY}") + set(OpenXR_loader_FOUND TRUE) + mark_as_advanced(OPENXR_loader_LIBRARY) + else() + set(OpenXR_loader_FOUND FALSE) + endif() + + elseif(${_comp} STREQUAL "registry") + list(APPEND _oxr_component_required_vars OPENXR_REGISTRY) + if(EXISTS "${OPENXR_REGISTRY}") + set(OpenXR_registry_FOUND TRUE) + mark_as_advanced(OPENXR_REGISTRY) + else() + set(OpenXR_registry_FOUND FALSE) + endif() + + elseif(${_comp} STREQUAL "specscripts") + list(APPEND _oxr_component_required_vars OPENXR_SPECSCRIPTS_DIR) + if(EXISTS "${OPENXR_SPECSCRIPTS_DIR}/generator.py" + AND EXISTS "${OPENXR_SPECSCRIPTS_DIR}/reg.py" + AND EXISTS "${OPENXR_SPECSCRIPTS_DIR}/genxr.py") + set(OpenXR_specscripts_FOUND TRUE) + mark_as_advanced(OPENXR_SPECSCRIPTS_DIR) + else() + set(OpenXR_specscripts_FOUND FALSE) + endif() + + elseif(${_comp} STREQUAL "sdkscripts") + list(APPEND _oxr_component_required_vars OPENXR_SDKSCRIPTS_DIR) + if(EXISTS "${OPENXR_SDKSCRIPTS_DIR}/automatic_source_generator.py" + AND EXISTS "${OPENXR_SDKSCRIPTS_DIR}/src_genxr.py") + set(OpenXR_sdkscripts_FOUND TRUE) + mark_as_advanced(OPENXR_SDKSCRIPTS_DIR) + else() + set(OpenXR_sdkscripts_FOUND FALSE) + endif() + + else() + message(WARNING "${_comp} is not a recognized OpenXR component") + set(OpenXR_${_comp}_FOUND FALSE) + endif() +endforeach() +unset(_comp) + +### +# FPHSA call +### +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(OpenXR + REQUIRED_VARS + ${_oxr_component_required_vars} + HANDLE_COMPONENTS + FAIL_MESSAGE + "Could NOT find the requested OpenXR components, try setting OPENXR_SDK_SRC_DIR and/or OPENXR_SDK_BUILD_DIR" +) +### +# If found, set variables and create targets +### + +# Component: headers +if(OpenXR_headers_FOUND) + set(OPENXR_INCLUDE_DIRS + ${OPENXR_OPENXR_INCLUDE_DIR} + ${OPENXR_PLATFORM_DEFINES_INCLUDE_DIR}) + list(REMOVE_DUPLICATES OPENXR_INCLUDE_DIRS) + + # This target just provides the headers with prototypes. + # You may have linker errors if you try using this + # without linking to the loader + if(NOT TARGET OpenXR::Headers) + add_library(OpenXR::Headers INTERFACE IMPORTED) + endif() + set_target_properties(OpenXR::Headers PROPERTIES + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_oxr_include_dirs}") + + # This target just provides the headers, without any prototypes. + # Finding and loading the loader at runtime is your problem. + if(NOT TARGET OpenXR::HeadersNoPrototypes) + add_library(OpenXR::HeadersNoPrototypes INTERFACE IMPORTED) + endif() + set_target_properties(OpenXR::HeadersNoPrototypes PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "XR_NO_PROTOTYPES" + INTERFACE_LINK_LIBRARIES "OpenXR::Headers") + +endif() + +# Component: loader +if(OpenXR_loader_FOUND AND OpenXR_headers_FOUND) + set(_oxr_loader_interface_libs OpenXR::Headers) + # include dl library for statically-linked loader + get_filename_component(_oxr_loader_ext ${OPENXR_loader_LIBRARY} EXT) + if(_oxr_loader_ext STREQUAL CMAKE_STATIC_LIBRARY_SUFFIX) + set(_oxr_loader_lib_type STATIC) + list(APPEND _oxr_loader_interface_libs ${CMAKE_DL_LIBS}) + else() + set(_oxr_loader_lib_type SHARED) + endif() + + if(NOT TARGET OpenXR::Loader) + add_library(OpenXR::Loader UNKNOWN IMPORTED) + endif() + set_target_properties(OpenXR::Loader PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${OPENXR_loader_LIBRARY}" + INTERFACE_LINK_LIBRARIES "${_oxr_loader_interface_libs}") +endif() diff --git a/CMake/FindPulseAudio.cmake b/CMake/FindPulseAudio.cmake index 6046898cc425..bebbed3e11df 100644 --- a/CMake/FindPulseAudio.cmake +++ b/CMake/FindPulseAudio.cmake @@ -6,7 +6,7 @@ # # vim: expandtab sw=4 ts=4 sts=4: -include(FindPkgConfig) +find_package(PkgConfig QUIET) pkg_check_modules (PulseAudio_PKG QUIET libpulse) find_path(PulseAudio_INCLUDE_DIR NAMES pulse/pulseaudio.h diff --git a/CMake/FindLibsystemd.cmake b/CMake/FindSYSTEMD.cmake similarity index 95% rename from CMake/FindLibsystemd.cmake rename to CMake/FindSYSTEMD.cmake index f75558a44430..d3a706ad1988 100644 --- a/CMake/FindLibsystemd.cmake +++ b/CMake/FindSYSTEMD.cmake @@ -1,5 +1,6 @@ -include(FindPkgConfig) +find_package(PkgConfig QUIET) pkg_check_modules(PC_SYSTEMD QUIET "libsystemd") + if (PC_SYSTEMD_FOUND) add_definitions(${PC_SYSTEMD_CFLAGS} ${PC_SYSTEMD_CFLAGS_OTHER}) endif(PC_SYSTEMD_FOUND) diff --git a/CMake/FlagsOverride.cmake b/CMake/FlagsOverride.cmake new file mode 100644 index 000000000000..39c55aa62af4 --- /dev/null +++ b/CMake/FlagsOverride.cmake @@ -0,0 +1,7 @@ +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + foreach(f CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO) + if("${${f}}" MATCHES "/Zi") + string(REGEX REPLACE "/Zi" "/Z7" "${f}" "${${f}}") + endif() + endforeach() +endif() \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index f369a2651895..00617e758ba1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,8 @@ set(CMAKE_OSX_ARCHITECTURES "x86_64") # handle configuration options set(CMAKE_OSX_DEPLOYMENT_TARGET "10.12.0" CACHE STRING "") +set(CMAKE_USER_MAKE_RULES_OVERRIDE "CMake/FlagsOverride.cmake") + project(dolphin-emu) # Name of the Dolphin distributor. If you redistribute Dolphin builds (forks, @@ -17,10 +19,12 @@ project(dolphin-emu) # unique name here. set(DISTRIBUTOR "None" CACHE STRING "Name of the distributor.") +set(DOLPHIN_DEFAULT_UPDATE_TRACK "" CACHE STRING "Name of the default update track. If empty, disables auto-update.") + if(UNIX AND NOT APPLE AND NOT ANDROID) option(ENABLE_X11 "Enables X11 Support" ON) endif() -if(NOT WIN32 AND NOT APPLE) +if(NOT WIN32 AND NOT APPLE AND NOT HAIKU) option(ENABLE_EGL "Enables EGL OpenGL Interface" ON) endif() @@ -35,6 +39,7 @@ option(ENABLE_ALSA "Enables ALSA sound backend" ON) option(ENABLE_PULSEAUDIO "Enables PulseAudio sound backend" ON) option(ENABLE_LLVM "Enables LLVM support, for disassembly" ON) option(ENABLE_TESTS "Enables building the unit tests" ON) +option(ENABLE_VULKAN "Enables vulkan video backend" ON) option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence, show the current game on Discord" ON) # Maintainers: if you consider blanket disabling this for your users, please @@ -49,7 +54,7 @@ option(ENCODE_FRAMEDUMPS "Encode framedumps in AVI format" ON) option(ENABLE_GPROF "Enable gprof profiling (must be using Debug build)" OFF) option(FASTLOG "Enable all logs" OFF) -option(GDBSTUB "Enable gdb stub for remote debugging." OFF) +option(GDBSTUB "Enable gdb stub for remote debugging." ON) option(OPROFILING "Enable profiling" OFF) # TODO: Add DSPSpy @@ -114,8 +119,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries) if (WIN32) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/Binary) - if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") - string(APPEND CMAKE_RUNTIME_OUTPUT_DIRECTORY /ARM64) + if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64") + string(APPEND CMAKE_RUNTIME_OUTPUT_DIRECTORY /x64) + elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") + string(APPEND CMAKE_RUNTIME_OUTPUT_DIRECTORY /ARM64) endif() set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) @@ -205,7 +212,7 @@ elseif(_ARCH_64 AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64") add_definitions(-D_M_X86=1) add_definitions(-D_M_X86_64=1) check_and_add_flag(HAVE_SSE2 -msse2) -elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") +elseif(_ARCH_64 AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64") set(_M_ARM_64 1) add_definitions(-D_M_ARM_64=1) # CRC instruction set is used in the CRC32 hash function @@ -241,27 +248,19 @@ if(CMAKE_C_COMPILER_ID MATCHES "MSVC") add_compile_options(/Zc:throwingNew) # Enforce strict volatile semantics as per ISO C++ add_compile_options(/volatile:iso) + # Fix non-conformant lambda behavior (constexpr variables shouldn't need capturing) + add_compile_options(/experimental:newLambdaProcessor) + # Fix various other non-conformant behaviors + add_compile_options(/Zc:externConstexpr,lambda,preprocessor) + + # Temporarily disable warnings to enable /Zc:preprocessor compatibility with WinSDK headers. + add_compile_options( + /wd5105 # macro expansion producing 'defined' has undefined behavior + ) string(APPEND CMAKE_EXE_LINKER_FLAGS " /NXCOMPAT") else() add_definitions(-D_DEFAULT_SOURCE) - check_and_add_flag(HAVE_WALL -Wall) - # TODO: would like these but they produce overwhelming amounts of warnings - #check_and_add_flag(EXTRA -Wextra) - #check_and_add_flag(MISSING_FIELD_INITIALIZERS -Wmissing-field-initializers) - #check_and_add_flag(SWITCH_DEFAULT -Wswitch-default) - #check_and_add_flag(FLOAT_EQUAL -Wfloat-equal) - #check_and_add_flag(CONVERSION -Wconversion) - #check_and_add_flag(ZERO_AS_NULL_POINTER_CONSTANT -Wzero-as-null-pointer-constant) - check_and_add_flag(TYPE_LIMITS -Wtype-limits) - check_and_add_flag(SIGN_COMPARE -Wsign-compare) - check_and_add_flag(IGNORED_QUALIFIERS -Wignored-qualifiers) - check_and_add_flag(UNINITIALIZED -Wuninitialized) - check_and_add_flag(LOGICAL_OP -Wlogical-op) - check_and_add_flag(SHADOW -Wshadow) - check_and_add_flag(INIT_SELF -Winit-self) - check_and_add_flag(MISSING_DECLARATIONS -Wmissing-declarations) - check_and_add_flag(MISSING_VARIABLE_DECLARATIONS -Wmissing-variable-declarations) # gcc uses some optimizations which might break stuff without this flag check_and_add_flag(NO_STRICT_ALIASING -fno-strict-aliasing) @@ -298,6 +297,9 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin") list(APPEND CMAKE_PREFIX_PATH "/usr") endif() + # Prevents Xcode from overriding the -fno-strict-aliasing flag + set(CMAKE_XCODE_ATTRIBUTE_GCC_STRICT_ALIASING NO) + # Specify target CPUs. check_and_add_flag(HAVE_MSSSE3 -mssse3) check_and_add_flag(HAVE_ARCH_CORE2 -march=core2) @@ -306,6 +308,11 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin") # Drop unreachable code and data. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-dead_strip,-dead_strip_dylibs") + # Set FMT_EXCEPTIONS = 0, for consistency with -fno-exceptions earlier. + # If we set only -fno-exceptions, fmt fails to compile when included from + # Objective-C++ because fmt tries try to use throw because __EXCEPTIONS is defined. + add_definitions(-DFMT_EXCEPTIONS=0) + find_library(APPKIT_LIBRARY AppKit) find_library(APPSERV_LIBRARY ApplicationServices) find_library(CARBON_LIBRARY Carbon) @@ -439,8 +446,6 @@ if(ENABLE_X11) check_lib(XRANDR xrandr Xrandr) if(XRANDR_FOUND) add_definitions(-DHAVE_XRANDR=1) - else() - add_definitions(-DHAVE_XRANDR=0) endif() pkg_check_modules(X11_INPUT REQUIRED xi>=1.5.0) message(STATUS "X11 support enabled") @@ -483,8 +488,8 @@ if(OPROFILING) endif() if(ENABLE_EVDEV) - find_package(Libudev REQUIRED) - find_package(Libevdev REQUIRED) + find_package(LIBUDEV REQUIRED) + find_package(LIBEVDEV REQUIRED) if(LIBUDEV_FOUND AND LIBEVDEV_FOUND) message(STATUS "libevdev/libudev found, enabling evdev controller backend") add_definitions(-DHAVE_LIBUDEV=1) @@ -533,7 +538,8 @@ if (_M_X86) add_subdirectory(Externals/Bochs_disasm) endif() add_subdirectory(Externals/cpp-optparse) -find_package(fmt 6.0) + +find_package(fmt 7.1) if(fmt_FOUND) message(STATUS "Using shared fmt ${fmt_VERSION}") else() @@ -541,8 +547,17 @@ else() message(STATUS "Using static fmt from Externals") add_subdirectory(Externals/fmt EXCLUDE_FROM_ALL) endif() -add_subdirectory(Externals/glslang) add_subdirectory(Externals/imgui) +add_subdirectory(Externals/glslang) + +if(ENABLE_VULKAN) + add_definitions(-DHAS_VULKAN) +endif() + +if(NOT WIN32 OR (NOT (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64"))) + # OpenGL is available on all platforms except windows-arm64 + add_definitions(-DHAS_OPENGL) +endif() find_package(pugixml) if(NOT pugixml_FOUND) @@ -608,12 +623,17 @@ else() add_subdirectory(Externals/liblzma) endif() -find_package(zstd) -if(ZSTD_FOUND) - message(STATUS "Using shared zstd") +pkg_check_modules(ZSTD QUIET libzstd>=1.4.0) +check_include_file(zstd.h HAVE_ZSTD_H) +if(ZSTD_FOUND AND HAVE_ZSTD_H) + message(STATUS "Using shared zstd version: " ${ZSTD_VERSION}) else() check_vendoring_approved(zstd) - message(STATUS "Shared zstd not found, falling back to the static library") + if(ZSTD_FOUND AND NOT HAVE_ZSTD_H) + message(STATUS "Shared zstd found but lacks headers, falling back to the static library") + else() + message(STATUS "Shared zstd not found, falling back to the static library") + endif() add_subdirectory(Externals/zstd) endif() @@ -629,6 +649,7 @@ endif() pkg_check_modules(MINIZIP minizip>=2.0.0) if(MINIZIP_FOUND) message(STATUS "Using shared minizip") + include_directories(${MINIZIP_INCLUDE_DIRS}) else() check_vendoring_approved(minizip) message(STATUS "Shared minizip not found, falling back to the static library") @@ -676,7 +697,7 @@ endif() add_subdirectory(Externals/soundtouch) include_directories(Externals/soundtouch) -find_package(Cubeb) +find_package(CUBEB) if(CUBEB_FOUND) message(STATUS "Using the system cubeb") else() @@ -718,7 +739,7 @@ endif() if(USE_UPNP) if(NOT APPLE) - find_package(Miniupnpc) + find_package(MINIUPNPC) endif() if(MINIUPNPC_FOUND AND MINIUPNPC_API_VERSION GREATER 8) message(STATUS "Using shared miniupnpc") @@ -731,7 +752,7 @@ if(USE_UPNP) endif() if(NOT APPLE) - find_package(MbedTLS) + find_package(MBEDTLS) endif() if(MBEDTLS_FOUND) message(STATUS "Using shared mbed TLS") @@ -782,11 +803,11 @@ endif() if(USE_DISCORD_PRESENCE) message(STATUS "Using static DiscordRPC from Externals") - add_subdirectory(Externals/discord-rpc) + add_subdirectory(Externals/discord-rpc EXCLUDE_FROM_ALL) include_directories(Externals/discord-rpc/include) endif() -find_package(Libsystemd) +find_package(SYSTEMD) if(SYSTEMD_FOUND) message(STATUS "libsystemd found, enabling traversal server watchdog support") add_definitions(-DHAVE_LIBSYSTEMD) @@ -795,11 +816,22 @@ else() endif() if (WIN32) + include_directories(Externals/WIL/include) include_directories(Externals/OpenAL/include) endif() include_directories(Externals/picojson) +find_package(OpenXR) +if(OpenXR_loader_FOUND) +message(STATUS "Using shared OpenXR") +set(USE_OPENXR 1) +else() +message(STATUS "OpenXR not found") +endif() + +add_subdirectory(Externals/rangeset) + ######################################## # Pre-build events: Define configuration variables and write SCM info header # diff --git a/CMakeSettings.json b/CMakeSettings.json index 66db74ffad5f..c571312285aa 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -11,7 +11,7 @@ "variables": [ { "name": "Qt5_DIR", - "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.14.1\\msvc2019_64\\lib\\cmake\\Qt5" + "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.15.0\\msvc2019_64\\lib\\cmake\\Qt5" } ] }, @@ -26,7 +26,7 @@ "variables": [ { "name": "Qt5_DIR", - "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.14.1\\msvc2019_64\\lib\\cmake\\Qt5" + "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.15.0\\msvc2019_64\\lib\\cmake\\Qt5" } ] }, @@ -41,7 +41,7 @@ "variables": [ { "name": "Qt5_DIR", - "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.14.1\\msvc2019_arm64\\lib\\cmake\\Qt5" + "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.15.0\\msvc2019_arm64\\lib\\cmake\\Qt5" }, { "name": "CMAKE_SYSTEM_NAME", @@ -64,7 +64,7 @@ "variables": [ { "name": "Qt5_DIR", - "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.14.1\\msvc2019_arm64\\lib\\cmake\\Qt5" + "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.15.0\\msvc2019_arm64\\lib\\cmake\\Qt5" }, { "name": "CMAKE_SYSTEM_NAME", diff --git a/Contributing.md b/Contributing.md index 2bcfeafcfd6e..b11bc3b74896 100644 --- a/Contributing.md +++ b/Contributing.md @@ -203,6 +203,7 @@ Summary: ```c++ do { + // code } while (false); ``` diff --git a/Data/Sys/GameSettings/D85.ini b/Data/Sys/GameSettings/D85.ini new file mode 100644 index 000000000000..3064b4c826f8 --- /dev/null +++ b/Data/Sys/GameSettings/D85.ini @@ -0,0 +1,15 @@ +# D85E01 - Interactive Multi Game Demo Disc v12 + +[Core] +# Values set here will override the main Dolphin settings. +FPRF = True +MMU = True + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. diff --git a/Data/Sys/GameSettings/D86.ini b/Data/Sys/GameSettings/D86.ini new file mode 100644 index 000000000000..0768da96977d --- /dev/null +++ b/Data/Sys/GameSettings/D86.ini @@ -0,0 +1,15 @@ +# D86P01 - Interactive Multi Game Demo Disc v12 + +[Core] +# Values set here will override the main Dolphin settings. +FPRF = True +MMU = True + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. diff --git a/Data/Sys/GameSettings/D93U01.ini b/Data/Sys/GameSettings/D93U01.ini new file mode 100644 index 000000000000..8b37570f2f35 --- /dev/null +++ b/Data/Sys/GameSettings/D93U01.ini @@ -0,0 +1,4 @@ +# D93U01 - Interactive Multi-Game Demo Disk: November 2003 + +[Core] +FPRF = True diff --git a/Data/Sys/GameSettings/D95.ini b/Data/Sys/GameSettings/D95.ini new file mode 100644 index 000000000000..cf21815deccb --- /dev/null +++ b/Data/Sys/GameSettings/D95.ini @@ -0,0 +1,14 @@ +# D95P01 - Interactive Multi Game Demo Disc v5 + +[Core] +# Values set here will override the main Dolphin settings. +FPRF = True + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. diff --git a/Data/Sys/GameSettings/DAX.ini b/Data/Sys/GameSettings/DAX.ini new file mode 100644 index 000000000000..f02ea1326fb0 --- /dev/null +++ b/Data/Sys/GameSettings/DAX.ini @@ -0,0 +1,20 @@ +# DAXP01, DAXE01 - The Legend of Zelda Skyward Sword + +[Core] +# Values set here will override the main Dolphin settings. + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. + +[Video_Hacks] +EFBAccessEnable = True +EFBEmulateFormatChanges = True + +[Video_Enhancements] +ArbitraryMipmapDetection = True diff --git a/Data/Sys/GameSettings/DPOJ8P.ini b/Data/Sys/GameSettings/DPOJ8P.ini new file mode 100644 index 000000000000..741d746830fe --- /dev/null +++ b/Data/Sys/GameSettings/DPOJ8P.ini @@ -0,0 +1,18 @@ +# DPOJ8P - PHANTASY STAR ONLINE EPISODE I&II TRIAL EDITION + +[Core] +# Values set here will override the main Dolphin settings. + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. +$Bypass Modem Detection +04194f40 4182002c + +[Video_Settings] +SafeTextureCacheColorSamples = 512 diff --git a/Data/Sys/GameSettings/DPSJ8P.ini b/Data/Sys/GameSettings/DPSJ8P.ini new file mode 100644 index 000000000000..7f5a9a2904ea --- /dev/null +++ b/Data/Sys/GameSettings/DPSJ8P.ini @@ -0,0 +1,16 @@ +# DPSJ8P - PHANTASY STAR ONLINE EPISODE III TRIAL EDITION + +[Core] +# Values set here will override the main Dolphin settings. + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. + +[Video_Settings] +SafeTextureCacheColorSamples = 512 diff --git a/Data/Sys/GameSettings/E5W.ini b/Data/Sys/GameSettings/G4P.ini similarity index 82% rename from Data/Sys/GameSettings/E5W.ini rename to Data/Sys/GameSettings/G4P.ini index 58ee249ee1af..0fca83219ef9 100644 --- a/Data/Sys/GameSettings/E5W.ini +++ b/Data/Sys/GameSettings/G4P.ini @@ -1,4 +1,4 @@ -# E5WE8P - Wonder Boy II +# G4PJ13 - The Sims [Core] # Values set here will override the main Dolphin settings. @@ -14,3 +14,6 @@ [Video_Settings] SafeTextureCacheColorSamples = 0 + +[Video_Hacks] +EFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/G5D.ini b/Data/Sys/GameSettings/G5D.ini new file mode 100644 index 000000000000..aec2b0b34106 --- /dev/null +++ b/Data/Sys/GameSettings/G5D.ini @@ -0,0 +1,17 @@ +# G5DE78, G5DP78 - Scooby-Doo! Unmasked + +[Core] +# Values set here will override the main Dolphin settings. +# The JIT cache causes problems with emulated icache invalidation in this game resulting in areas failing to load +DisableICache = True +# Disabling ICache causes issues with the GameCube Main Menu. +HLE_BS2 = True + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. diff --git a/Data/Sys/GameSettings/G95.ini b/Data/Sys/GameSettings/G95.ini new file mode 100644 index 000000000000..b4dee1baf5b5 --- /dev/null +++ b/Data/Sys/GameSettings/G95.ini @@ -0,0 +1,14 @@ +# D95P01, G95E01 - Interactive Multi Game Demo Disc v5 + +[Core] +# Values set here will override the main Dolphin settings. +FPRF = True + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. diff --git a/Data/Sys/GameSettings/G99.ini b/Data/Sys/GameSettings/G99.ini new file mode 100644 index 000000000000..05df9c171599 --- /dev/null +++ b/Data/Sys/GameSettings/G99.ini @@ -0,0 +1,14 @@ +# G99E01, G99P01 - Interactive Multi Game Demo Disc v1 + +[Core] +# Values set here will override the main Dolphin settings. +MMU = True + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. diff --git a/Data/Sys/GameSettings/GC3.ini b/Data/Sys/GameSettings/GC3.ini new file mode 100644 index 000000000000..872b09d354f4 --- /dev/null +++ b/Data/Sys/GameSettings/GC3.ini @@ -0,0 +1,17 @@ +# GC3F78, GC3P78, GC3D78, GC3E78 - Scooby-Doo! Mystery Mayhem + +[Core] +# Values set here will override the main Dolphin settings. +# The JIT cache causes problems with emulated icache invalidation in this game resulting in areas failing to load +DisableICache = True +# Disabling ICache causes issues with the GameCube Main Menu. +HLE_BS2 = True + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. diff --git a/Data/Sys/GameSettings/GC6E01.ini b/Data/Sys/GameSettings/GC6E01.ini new file mode 100644 index 000000000000..7fa89bcfadf5 --- /dev/null +++ b/Data/Sys/GameSettings/GC6E01.ini @@ -0,0 +1,27 @@ +# GC6E01 - Pokémon Colosseum + +[OnFrame] +# This game has extra memory card checks compared to most games, +# presumably to prevent Pokémon duping. These can interfere with +# saving your game when using savestates. +# +# 0x801cfc2c: +# Originally a branch that checks if the save counter in memory +# matches the one on the memory card. We patch this to instead +# overwrite the counter in memory with the one from the memory +# card. We need to do this because each memory card file actually +# contains three save slots the game rotates when saving, and +# when loading it loads the save with the biggest save counter. +# So we need to make sure the newly written save (which uses +# the value from memory + 1) is higher than any save currently +# on the card. +# +# 0x801cfc7c: +# Another branch. Not entirely sure what this one checks, but +# not patching this one sometimes still makes it recognize the +# memory card as 'not the same Memory Card as the one used to +# load the saved data', so nop it out. +# +$Allow Memory Card saving with Savestates +0x801cfc2c:dword:0x9005002c +0x801cfc7c:dword:0x60000000 diff --git a/Data/Sys/GameSettings/GC6J01.ini b/Data/Sys/GameSettings/GC6J01.ini new file mode 100644 index 000000000000..5368a547a0cc --- /dev/null +++ b/Data/Sys/GameSettings/GC6J01.ini @@ -0,0 +1,27 @@ +# GC6J01 - ポケモンコロシアム + +[OnFrame] +# This game has extra memory card checks compared to most games, +# presumably to prevent Pokémon duping. These can interfere with +# saving your game when using savestates. +# +# 0x801cb5b8: +# Originally a branch that checks if the save counter in memory +# matches the one on the memory card. We patch this to instead +# overwrite the counter in memory with the one from the memory +# card. We need to do this because each memory card file actually +# contains three save slots the game rotates when saving, and +# when loading it loads the save with the biggest save counter. +# So we need to make sure the newly written save (which uses +# the value from memory + 1) is higher than any save currently +# on the card. +# +# 0x801cb608: +# Another branch. Not entirely sure what this one checks, but +# not patching this one sometimes still makes it recognize the +# memory card as 'not the same Memory Card as the one used to +# load the saved data', so nop it out. +# +$Allow Memory Card saving with Savestates +0x801cb5b8:dword:0x9005002c +0x801cb608:dword:0x60000000 diff --git a/Data/Sys/GameSettings/GC6P01.ini b/Data/Sys/GameSettings/GC6P01.ini new file mode 100644 index 000000000000..cfc8c6cbe046 --- /dev/null +++ b/Data/Sys/GameSettings/GC6P01.ini @@ -0,0 +1,27 @@ +# GC6P01 - Pokémon Colosseum + +[OnFrame] +# This game has extra memory card checks compared to most games, +# presumably to prevent Pokémon duping. These can interfere with +# saving your game when using savestates. +# +# 0x801d429c: +# Originally a branch that checks if the save counter in memory +# matches the one on the memory card. We patch this to instead +# overwrite the counter in memory with the one from the memory +# card. We need to do this because each memory card file actually +# contains three save slots the game rotates when saving, and +# when loading it loads the save with the biggest save counter. +# So we need to make sure the newly written save (which uses +# the value from memory + 1) is higher than any save currently +# on the card. +# +# 0x801d42ec: +# Another branch. Not entirely sure what this one checks, but +# not patching this one sometimes still makes it recognize the +# memory card as 'not the same Memory Card as the one used to +# load the saved data', so nop it out. +# +$Allow Memory Card saving with Savestates +0x801d429c:dword:0x9005002c +0x801d42ec:dword:0x60000000 diff --git a/Data/Sys/GameSettings/GCC.ini b/Data/Sys/GameSettings/GCC.ini index a23e4365a520..5b84adf7e00f 100644 --- a/Data/Sys/GameSettings/GCC.ini +++ b/Data/Sys/GameSettings/GCC.ini @@ -17,4 +17,8 @@ SafeTextureCacheColorSamples = 512 [Video_Hacks] EFBEmulateFormatChanges = True - +# With this setting enabled, the memory corruption caused by a game bug is not +# faithful to real hardware, leading to a crash at Goblin Wall. Note that with +# DeferEFBCopies enabled (the default), Dolphin still doesn't match hardware. +# Instead, the corruption disappears, which is arguably better than parity. +EFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/GCCE01.ini b/Data/Sys/GameSettings/GCCE01.ini index 97cf1d7fab3f..0c03724b845a 100644 --- a/Data/Sys/GameSettings/GCCE01.ini +++ b/Data/Sys/GameSettings/GCCE01.ini @@ -1,10 +1,10 @@ # GCCE01 - FINAL FANTASY Crystal Chronicles -[OnLoad] -# Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. +# Fix incorrect bounds check before an EFB to RAM copy that causes buffer overruns. +# With this patch enabled, it is safe to set EFBToTextureEnable = True. +$Fix buffer overrun bug (crash at Goblin Wall) +0x80017B16:word:0x00003430 [ActionReplay] # Add action replay cheats here. diff --git a/Data/Sys/GameSettings/GCDP08.ini b/Data/Sys/GameSettings/GCDP08.ini new file mode 100644 index 000000000000..6aa46f36714e --- /dev/null +++ b/Data/Sys/GameSettings/GCDP08.ini @@ -0,0 +1,5 @@ +# GCDP08 - Resident Evil Code: Veronica X (PAL) + +[Video_Hacks] +# Needed for language selection menu to appear +EFBAccessEnable = True diff --git a/Data/Sys/GameSettings/GCI.ini b/Data/Sys/GameSettings/GCI.ini index 0637292debee..75f637762081 100644 --- a/Data/Sys/GameSettings/GCI.ini +++ b/Data/Sys/GameSettings/GCI.ini @@ -1,7 +1,19 @@ # GCIE69, GCIP69 - The Sims + [Core] +# Values set here will override the main Dolphin settings. + +[OnLoad] +# Add memory patches to be loaded once on boot here. + [OnFrame] +# Add memory patches to be applied every frame here. + [ActionReplay] -[Gecko] +# Add action replay cheats here. + [Video_Settings] SafeTextureCacheColorSamples = 0 + +[Video_Hacks] +EFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/GE9.ini b/Data/Sys/GameSettings/GE9.ini index a2c85fe446e1..6e374c406a36 100644 --- a/Data/Sys/GameSettings/GE9.ini +++ b/Data/Sys/GameSettings/GE9.ini @@ -2,6 +2,10 @@ [Core] # Values set here will override the main Dolphin settings. +# The JIT cache causes problems with emulated icache invalidation in this game resulting in areas failing to load +DisableICache = True +# Disabling ICache causes issues with the GameCube Main Menu. +HLE_BS2 = True [OnLoad] # Add memory patches to be loaded once on boot here. diff --git a/Data/Sys/GameSettings/GHAE08.ini b/Data/Sys/GameSettings/GHAE08.ini new file mode 100644 index 000000000000..373cbb45e392 --- /dev/null +++ b/Data/Sys/GameSettings/GHAE08.ini @@ -0,0 +1,16 @@ +# GHAE08 - Resident Evil 2 + +[OnFrame] +# Work around a game bug that causes background sounds to be zeroed during load. +# The bug was masked on real hardware by dcache. This patch fully fixes the bug +# and should also work on real hardware. Dolphin doesn't emulate dcache because +# the performance hit would be huge. +$Fix audio issues +# main.dol +0x800339E4:dword:0x60000000 +# leon.rel +0x8055ACBC:dword:0x60000000:0x4BAA8445 +# claire.rel +0x8055AB54:dword:0x60000000:0x4BAA85AD +[OnFrame_Enabled] +$Fix audio issues diff --git a/Data/Sys/GameSettings/GHAJ08.ini b/Data/Sys/GameSettings/GHAJ08.ini new file mode 100644 index 000000000000..9bb3feec95d9 --- /dev/null +++ b/Data/Sys/GameSettings/GHAJ08.ini @@ -0,0 +1,16 @@ +# GHAJ08 - Biohazard 2 + +[OnFrame] +# Work around a game bug that causes background sounds to be zeroed during load. +# The bug was masked on real hardware by dcache. This patch fully fixes the bug +# and should also work on real hardware. Dolphin doesn't emulate dcache because +# the performance hit would be huge. +$Fix audio issues +# main.dol +0x80065FFC:dword:0x60000000 +# leon.rel +0x805C5CC4:dword:0x60000000:0x4BA3D43D +# claire.rel +0x805C5BFC:dword:0x60000000:0x4BA3D505 +[OnFrame_Enabled] +$Fix audio issues diff --git a/Data/Sys/GameSettings/GHAP08.ini b/Data/Sys/GameSettings/GHAP08.ini new file mode 100644 index 000000000000..d6e39d5c1701 --- /dev/null +++ b/Data/Sys/GameSettings/GHAP08.ini @@ -0,0 +1,32 @@ +# GHAP08 - Resident Evil 2 + +[OnFrame] +# Work around a game bug that causes background sounds to be zeroed during load. +# The bug was masked on real hardware by dcache. This patch fully fixes the bug +# and should also work on real hardware. Dolphin doesn't emulate dcache because +# the performance hit would be huge. +$Fix audio issues +# main.dol +0x80033D60:dword:0x60000000 +# leon.rel +0x8055C5F8:dword:0x60000000:0x4BAA6B09 +# claire.rel +0x8055C490:dword:0x60000000:0x4BAA6C71 +# leon_g.rel +0x8055C3B8:dword:0x60000000:0x4BAA6D49 +# claire_g.rel +0x8055C328:dword:0x60000000:0x4BAA6DD9 +# leon_f.rel +0x8055D188:dword:0x60000000:0x4BAA5F79 +# claire_f.rel +0x8055D068:dword:0x60000000:0x4BAA6099 +# leon_s.rel +0x8055D100:dword:0x60000000:0x4BAA6001 +# claire_s.rel +0x8055D064:dword:0x60000000:0x4BAA609D +# leon_i.rel +0x8055CFDC:dword:0x60000000:0x4BAA6125 +# claire_i.rel +0x8055CEBC:dword:0x60000000:0x4BAA6245 +[OnFrame_Enabled] +$Fix audio issues diff --git a/Data/Sys/GameSettings/GJD.ini b/Data/Sys/GameSettings/GJD.ini new file mode 100644 index 000000000000..4312948d643a --- /dev/null +++ b/Data/Sys/GameSettings/GJD.ini @@ -0,0 +1,4 @@ +# GJDX7D, GJDE5S, GJDY7D - Judge Dredd: Dredd vs. Death + +[Video_Hacks] +ImmediateXFBEnable = False diff --git a/Data/Sys/GameSettings/GLEE08.ini b/Data/Sys/GameSettings/GLEE08.ini new file mode 100644 index 000000000000..90759a99a91a --- /dev/null +++ b/Data/Sys/GameSettings/GLEE08.ini @@ -0,0 +1,12 @@ +# GLEE08 - Resident Evil 3: Nemesis + +[OnFrame] +# Work around a game bug that causes background sounds to be zeroed during load. +# The bug was masked on real hardware by dcache. This patch fully fixes the bug +# and should also work on real hardware. Dolphin doesn't emulate dcache because +# the performance hit would be huge. +$Fix audio issues +# main.dol +0x80150E94:dword:0x60000000 +[OnFrame_Enabled] +$Fix audio issues diff --git a/Data/Sys/GameSettings/GLEJ08.ini b/Data/Sys/GameSettings/GLEJ08.ini new file mode 100644 index 000000000000..5c8ebc84fc9e --- /dev/null +++ b/Data/Sys/GameSettings/GLEJ08.ini @@ -0,0 +1,12 @@ +# GLEJ08 - BioHazard 3: Last Escape + +[OnFrame] +# Work around a game bug that causes background sounds to be zeroed during load. +# The bug was masked on real hardware by dcache. This patch fully fixes the bug +# and should also work on real hardware. Dolphin doesn't emulate dcache because +# the performance hit would be huge. +$Fix audio issues +# main.dol +0x8015110C:dword:0x60000000 +[OnFrame_Enabled] +$Fix audio issues diff --git a/Data/Sys/GameSettings/GLEP08.ini b/Data/Sys/GameSettings/GLEP08.ini new file mode 100644 index 000000000000..9c947103aced --- /dev/null +++ b/Data/Sys/GameSettings/GLEP08.ini @@ -0,0 +1,20 @@ +# GLEP08 - Resident Evil 3: Nemesis + +[OnFrame] +# Work around a game bug that causes background sounds to be zeroed during load. +# The bug was masked on real hardware by dcache. This patch fully fixes the bug +# and should also work on real hardware. Dolphin doesn't emulate dcache because +# the performance hit would be huge. +$Fix audio issues +# eng.rel +0x8058C174:dword:0x60000000:0x4BA76F8D +# ger.rel +0x8058CE40:dword:0x60000000:0x4BA762C1 +# fra.rel +0x8058D03C:dword:0x60000000:0x4BA760C5 +# spa.rel +0x8058D024:dword:0x60000000:0x4BA760DD +# ita.rel +0x8058CEA4:dword:0x60000000:0x4BA7625D +[OnFrame_Enabled] +$Fix audio issues diff --git a/Data/Sys/GameSettings/GLR.ini b/Data/Sys/GameSettings/GLR.ini index 3eca76673a3b..2d95bcd08148 100644 --- a/Data/Sys/GameSettings/GLR.ini +++ b/Data/Sys/GameSettings/GLR.ini @@ -20,3 +20,4 @@ MMU = 1 [Video_Hacks] EFBToTextureEnable = False ImmediateXFBEnable = False +DeferEFBCopies = False diff --git a/Data/Sys/GameSettings/GMPE01.ini b/Data/Sys/GameSettings/GMPE01.ini index 66b139057476..ec144338fd25 100644 --- a/Data/Sys/GameSettings/GMPE01.ini +++ b/Data/Sys/GameSettings/GMPE01.ini @@ -8,78 +8,79 @@ [ActionReplay] # Add action replay cheats here. -$All Mini Games Unlocked + +$All Mini Games Unlocked [Datel] 0218FDF0 0003FFFF -$Player 1 Max Coins +$Player 1 Max Coins [Datel] 0218FC54 000003E7 -$Player 1 No Coins +$Player 1 No Coins [Datel] 0218FC54 00000000 -$Player 1 Max Stars +$Player 1 Max Stars [Datel] 0218FC62 000003E7 -$Player 1 No Stars +$Player 1 No Stars [Datel] 0218FC62 00000000 -$Player 1 Always Has Magic Lamp +$Player 1 Always Has Magic Lamp [Datel] 0018FC3D 0000000C -$Player 2 Max Coins +$Player 2 Max Coins [Datel] 0218FC84 000003E7 -$Player 2 No Coins +$Player 2 No Coins [Datel] 0218FC84 00000000 -$Player 2 Max Stars +$Player 2 Max Stars [Datel] 0018FC92 000003E7 -$Player 2 No Stars +$Player 2 No Stars [Datel] 0018FC92 00000000 -$Player 2 Always Has Magic Lamp +$Player 2 Always Has Magic Lamp [Datel] 0018FC6D 0000000C -$Player 3 Max Coins +$Player 3 Max Coins [Datel] 0218FCB4 000003E7 -$Player 3 No Coins +$Player 3 No Coins [Datel] 0218FCB4 000003E7 -$Player 3 Max Stars +$Player 3 Max Stars [Datel] 0218FCC2 000003E7 -$Player 3 No Stars +$Player 3 No Stars [Datel] 0218FCC2 00000000 -$Player 3 Always Has Magic Lamp +$Player 3 Always Has Magic Lamp [Datel] 0018FC9D 0000000C -$Player 4 Max Coins +$Player 4 Max Coins [Datel] 0218FCE4 000003E7 -$Player 4 No Coins +$Player 4 No Coins [Datel] 0218FCE4 00000000 -$Player 4 Max Stars +$Player 4 Max Stars [Datel] 0218FCF2 000003E7 -$Player 4 No Stars +$Player 4 No Stars [Datel] 0218FCF2 00000000 -$Player 4 Always Has Magic Lamp +$Player 4 Always Has Magic Lamp [Datel] 0018FCCD 0000000C -$Hold Y To Roll 10 +$Hold Y To Roll 10 [Datel] 3A1E67F0 00000800 0416B928 41200000 -$Hold L To Roll 1 +$Hold L To Roll 1 [Datel] 3A1E67F0 00000040 0416B928 3F000000 -$L+X No More Moves(Use While Moving) +$L+X No More Moves(Use While Moving) [Datel] 8A1E67F0 00000440 0018FC42 00000001 0018FC72 00000001 @@ -87,7 +88,7 @@ $L+X No More Moves(Use While Moving) 0018FCD2 00000001 00000000 40000000 -$L+Y Infinite Moves(While Moving) +$L+Y Infinite Moves(While Moving) [Datel] 8A1E67F0 00000840 0018FC42 0000000A 0018FC72 0000000A @@ -95,26 +96,65 @@ $L+Y Infinite Moves(While Moving) 0018FCD2 0000000A 00000000 40000000 -$Press Z+R To Be On Turn 20 +$Press Z+R To Be On Turn 20 [Datel] 0A1E67F0 00000030 0018FCFC 00000014 -$Press Z+L To Be On Turn 1 +$Press Z+L To Be On Turn 1 [Datel] 0A1E67F0 00000050 0018FCFC 00000001 [Gecko] -$Netplay Community Settings +# Add gecko cheats here. + +$!!! - README +*There is a glitch here minigames may randomly award a player 999 coins. It may be linked to code usage. Enable these at your own risk! + +$QOL - Allow Digital Presses for Map Screen [gamemasterplc] c2086774 00000002 70000020 2c000020 60000000 00000000 c2073c7c 00000002 735a0020 281a0020 60000000 00000000 +*Fixes a bug where only analog inputs work while using the triggers. + +$QOL - Faster Boot Time [Ralf] +04056168 38607FFF +*Automatically advance through the initial cutscences. + +$QOL - Increased Board Speed [gamemasterplc] 04066dd8 38c0000d +20432574 2c1c002d +04432570 3b9c0002 +e2000001 80008000 +040786a0 c02281f0 +0406e314 c02281f0 +0408FB64 3860001E +0408FC08 3860001E +0408FCAC 3860001E +0408FD50 3860001E +0408FA78 3BDE0002 +20432574 2C1C002D +04432570 3B9C0002 +E2000001 80008000 +0408F4D4 38600005 +0408F53C 3860000F +0408F0E4 3BFF0002 +0408F154 3BFF0002 +*Board animations happen faster. + +$QOL - Increased Taunt Capabilities [gamemasterplc] 04061d5c 60000000 04061eb8 60000000 +*Taunt during your turn. +*Also removes the cap on how fast you can taunt. + +$QOL - Instant Text Display [gamemasterplc] 04044808 38600000 +*Text is displayed instantly. + +$QOL - Show Controller Port Number of Who Paused in Mini-Games [gamemasterplc] c203e9b4 00000002 807f0050 906d0000 38600000 00000000 @@ -131,13 +171,10 @@ c2031b88 0000000c 3ce08000 60e7aff4 7ce903a6 4e800421 57a0083c 00000000 -040786a0 c02281f0 -0406e314 c02281f0 +*Check which player is pausing during minigames. + +$QOL - Unlock Everything [gamemasterplc] 040310BC 3880FFFF -20441D98 2C000001 -04441D94 38000001 -044396FC 38000001 -E2000001 80008000 20446064 4082002C 04445FA4 38000001 0444605C 38000001 @@ -158,54 +195,71 @@ E2000001 80008000 04449674 38A000FF 044495B4 380000FF E2000001 80008000 -20432574 2c1c002d -04432570 3b9c0002 -e2000001 80008000 -*WARNING: This set of cheats is meant for Netplay only. This can 100% your save so make sure you make backups. -*This Cheat includes -*Game Mechanics - Increased Board Speed -*Game Mechanics - Increased Taunt Capabilities -*Game Mechanics - Speed Up Many Animations -*Miscellaneous - Instant Text Display -*Miscellaneous - Show Controller Port Number of Who Paused in Mini-Games -*as well as some cheats to 100% the game. We wont tell you which ones they are because that ruins the fun of playing. - -$Netplay Safe Kill Music -041d3d1c 00000001 -*This cheat makes it so all in-game music will be turned off. -* -*This can safely be used in a Netplay game without desync. +20441D98 2C000001 +04441D94 38000001 +044396FC 38000001 +E2000001 80008000 +*Unlocks Everything in the game. +*Permanent once saved! -$Board - Boo's Haunted Bash: Red Boo Always On +$Board: Boo's Haunted Bash - Red Boo Always On [gamemasterplc] 0018fd08 00000000 -*This cheat makes the Boo's Haunted Bash Red Boo Bridges Always Active. +*Red Boo's bridges are always active in the board Boo's Haunted Bash. -$Board - Bowser's Gnarly Party: Bridges Fall After One Cross +$Board: Bowser's Gnarly Party - Bridges Fall After One Cross [gamemasterplc] 2043801c 4182004c 04438294 38000002 e2000001 80008000 -*This cheat makes the Bowser's Gnarly Party Bridges fall after one crossing. +*Bridges fall after one crossing instead of three in the board Bowser's Gnarly Party. -$Board - Goomba's Greedy Gala: Free Roulette +$Board: Goomba's Greedy Gala - Free Roulette [gamemasterplc] 2043b934 2c1f0005 0443b92c 386003e7 0443bb08 38800000 e2000001 80008000 -*This cheat makes it so you don't have to bribe Goomba to rig your casino roll. +*Goomba does not need to be bribed at the roulette in the board Goomba's Greedy Gala. + +$Board: Goomba's Greedy Gala - Never Go Back To Start [gamemasterplc] +20432D5C 3860000A +04432D60 38600009 +E2000001 80008000 +*Goomba always loses in the dice minigame in the board Goomba's Greedy Gala. +*This means the only way back to start is in the top right section and requires extensive use of Happening Spaces and Mini Mushroom Pipes. -$Board - Koopa's Seaside Soiree: Banana Peel is a Normal Junction +$Board - Koopa's Seaside Soiree: Banana Peel is a Normal Junction [gamemasterplc] 2043030c 48000088 044326fc 4e800020 e2000001 80008000 -*This cheat removes the random banana peel junctions with normal junctions +*Replaces the banana peel junctions with normal junctions in Koopa's Seaside Soiree. -$Board - Toad's Midway Madness: Teacups are Normal Junctions +$Board - Toad's Midway Madness: Teacups are Normal Junctions [gamemasterplc] 20435308 80010008 044352f4 4e800020 e2000001 80008000 -*This cheat removes the random teacup junctions with normal junctions. +*Replaces the teacup junctions with normal junctions in Toad's Midway Madness. + +$Extra - 30Hz Gameplay [gamemasterplc] +041D3B00 40000000 +041D3B04 00000002 +04035480 38600001 +C200592C 00000009 +3C808000 6084D01C +7C8903A6 4E800421 +3C808000 60845B4C +7C8903A6 4E800421 +38800000 908D8688 +908D868C 38600001 +3C808000 6084D01C +7C8903A6 4E800421 +60000000 00000000 +*Game runs at 30Hz but still feel like 60FPS. Great for people with bad PCs +*Can break certain minigames -$Game Mechanics - Event Accessibility Doesn't Depend on Mini/Mega Status +$Extra - Disable Music +041d3d1c 00000001 +*Disables all in-game music. + +$Game Mechanics - Event Accessibility Doesn't Depend on Mini/Mega Status [Celerizer] 04075ff0 38600000 040a50a4 38600000 04077c50 38600000 @@ -229,171 +283,120 @@ e2000001 80008000 20430338 2c030002 0443033c 4800000c e2000001 80008000 -*This cheat makes it so you can access all board events. - -$Game Mechanics - Increased Board Speed -04066dd8 38c0000d -20432574 2c1c002d -04432570 3b9c0002 -e2000001 80008000 -*This cheat makes the players move faster while playing a Mario Party board. +*Access all board events regardless of Mega / Mini Mushrooms. -$Game Mechanics - Increased Taunt Capabilities -04061d5c 60000000 -04061eb8 60000000 -*This cheat makes it so you can taunt during your turn. - -$Game Mechanics - Speed Up Many Animations -040786a0 c02281f0 -0406e314 c02281f0 -*This cheat speeds up game animations. - -$Game Mechanics - Free Lottery Game +$Game Mechanics - Free Lottery Game [Celerizer] 0407b28c 38600005 0407bd04 38800000 -*This cheat makes the lottery free. +*Makes the lottery cost nothing instead of the usual 5 coins. +*You need to have 5 coins but you do not lose them. + +$Game Mechanics - Item Deletion [Rain] +c208d424 00000002 +987d0001 3c608000 +93a30010 00000000 +c208a07c 0000001f +9421ffe0 7c0802a6 +9001001c 90a10018 +3c608018 6063fcf8 +8883000a 1c840030 +3c608018 6063fc38 +7c632214 88830004 +5485083c 3c80801d +60843ad0 7c842a14 +88840000 80a10018 +2c040020 41820008 +48000090 3ca08000 +60a50010 80a50000 +88a50001 2c050000 +41820018 2c050001 +41820038 2c050002 +41820050 48000064 +3ca00000 60a500ff +88c30006 88e30007 +98c30005 98e30006 +98a30007 3ca00000 +60a50200 4800003c +88c30007 98c30006 +3cc00000 60c600ff +98c30007 3ca00000 +60a50200 4800001c +3cc00000 60c600ff +98c30007 3ca00000 +60a50200 48000004 +8001001c 94210020 +7c0803a6 7cbd2b78 +60000000 00000000 +*Item Deletion is now a thing. +*Press B to view your items, then delete the item with R. -$Game Mechanics - Free Stars +$Game Mechanics - Free Stars [gamemasterplc] 040843cc 2c030000 04084590 2c030000 040845cc 2c030000 04084720 38800000 -*This cheat makes Stars cost nothing instead of the usual 20 coins. +*Stars cost nothing instead of the usual 20 coins. -$Game Mechanics - Mega Status No Longer Steals Coins +$Game Mechanics - Mega Status No Longer Steals Coins [gamemasterplc] 0406be70 38600000 0406beac 38600000 0406be1c 38600000 -*This cheat makes the Mega Mushroom not steal coins. +*Mega Mushroom no longer steal coins when you pass players. -$Game Mechanics - Mini Pipes Work at Normal Size +$Game Mechanics - Mini Pipes Work at Normal Size [gamemasterplc] 04066348 60000000 04064ed0 60000000 04065114 60000000 -*This cheat makes the Mini Pipes not require a Mini Mushroom. +*Mini Pipes do not require a Mini Mushroom to pass. -$Game Mechanics - Mini Status Rolls 1-10 +$Game Mechanics - Mini Status Rolls 1-10 [gamemasterplc] 04085d74 3800000a -*This cheat makes the Mini Mushroom roll a 1-10. +*Mini Mushroom rolls a 1-10 dice instead of a 1-5 dice. -$Minigame - Take a Breather: Mash Only L +$Minigame - Bowser's Bigger Blast [gamemasterplc] +20431174 3803FFFF +04431174 38030000 +E2000001 80008000 +*Infinite time is given in the minigame Bowser's Bigger Blast + +$Minigame - Domination: More Thwomps [UnclePunch] +C203220C 0000001F +A0610008 2C03000F +408200E8 807F0004 +4800002D 7C8802A6 +A0A40000 7CA00734 +2C00FFFF 41820054 +80C40002 7CA32A14 +90C50000 38840006 +4BFFFFE0 4E800021 +00200000 4C60016C +38600528 24BC281F +04B0393C 280004B0 +27C0281F 012C2608 +281F04B4 2664281F +04B42850 380304B0 +29A83804 04B0FFFF +807F0004 48000031 +7C8802A6 A0A40000 +38840002 A0C40000 +7CC00734 2C00FFFF +41820058 7CC33214 +90A60000 38840002 +4BFFFFE4 4E800021 +39908490 849884A0 +84A884B0 84B884E0 +84E884F0 84F88500 +85088530 85388550 +85588560 856885E0 +85E88630 86388640 +864886F0 86F88730 +87388B10 8B18FFFF +38600000 00000000 +*Increases the limit from 160 to 300 Thwomps per player in the minigame Dominiation + +$Minigame - Take a Breather: Mash Only L [gamemasterplc] 20420834 408209b8 04420818 38a00000 044207f0 38600000 e2000001 80008000 -*This cheat makes this minigame easier to play. - -$Miscellaneous: Allow Digital Presses for Map Screen -c2086774 00000002 -70000020 2c000020 -60000000 00000000 -c2073c7c 00000002 -735a0020 281a0020 -60000000 00000000 -*This cheat fixes a bug where only analog inputs work while using the triggers. - -$Miscellaneous - Instant Text Display -04044808 38600000 -*This cheat makes it so text is displayed instantly. - -$Miscellaneous - Show Controller Port Number of Who Paused in Mini-Games -c203e9b4 00000002 -807f0050 906d0000 -38600000 00000000 -c2031b88 0000000c -3860012c 3880000a -38a0002d 38c00028 -38e000ff 90ed0004 -38ed0004 3d008000 -6108b150 7d0903a6 -4e800421 3860012c -3880000a 3ca08013 -38a5db52 80cd0000 -38c60001 c02283c0 -3ce08000 60e7aff4 -7ce903a6 4e800421 -57a0083c 00000000 -*This cheat will display a number on the pause screen of a minigame to see which port paused it. - -$Miscellaneous - Widescreen -041D4980 44555555 -0400C040 2C000356 -C200B0F4 00000003 -1C000004 3BA00003 -7C00EFD6 B01F0004 -60000000 00000000 -041D49F8 44400000 -041D4F0C 44400000 -C20CF3D8 00000005 -3C003B2A 6000AAAB -80830000 7C002000 -40820010 3C00BF40 -60000000 9003000C -C003000C 00000000 -C20423EC 00000002 -3C004410 9001000C -C041000C 00000000 -C20BBC08 00000003 -3FE03FAB 93E30000 -C3830000 EF620732 -60000000 00000000 -C20BBE04 00000003 -3C003FAB 90030000 -C0A30000 EFA20172 -60000000 00000000 -04014874 38600001 -0405DDBC 4E800020 -C208955C 00000005 -3CA03FAB 90A1FFFC -C001FFFC C03F0004 -EC010032 3CA042C0 -90A1FFFC C021FFFC -EC200828 00000000 -C20885A4 00000005 -3CA03FAB 90A1FFFC -C001FFFC C03F0004 -EC010032 3CA042C0 -90A1FFFC C021FFFC -EC200828 00000000 -C208B500 00000005 -3C803FAB 90810040 -C0210040 7C03042E -EC210032 3C8042C0 -90810040 C0010040 -EC010028 00000000 -C208C4B4 00000005 -3C803FAB 90810040 -C0210040 7C03042E -EC210032 3C8042C0 -90810040 C0010040 -EC010028 00000000 -C208C1A8 00000006 -83C10044 3CA03FAB -90A10044 C3C10044 -7FE4042E EFFE07F2 -3CA042C0 90A10044 -C3C10044 EFFFF028 -93C10044 00000000 -48000000 800030C8 -DE000000 80008180 -30010010 C0010064 -D2010088 00000005 -3C803FAB 908100A4 -C04100A4 C01F0110 -EC420032 3C8042C0 -908100A4 C00100A4 -EC020028 00000000 -E0000000 80008000 -2043C994 4180FF98 -C243C950 00000005 -C03B0008 3C803FAB -90810044 C0410044 -EC420072 3C8042C0 -90810044 C0210044 -EC220828 00000000 -C243C964 00000003 -C03B0010 3C803FAB -90810044 C0410044 -EC220072 00000000 -E2000001 80008000 -*This cheat makes the game appear in widescreen. +*Mash just L in the minigame Take a Breather. diff --git a/Data/Sys/GameSettings/GOW.ini b/Data/Sys/GameSettings/GOW.ini index 871191e82cea..fd085a01b11d 100644 --- a/Data/Sys/GameSettings/GOW.ini +++ b/Data/Sys/GameSettings/GOW.ini @@ -2,3 +2,6 @@ [Core] JITFollowBranch = False + +[Video] +PerfQueriesEnable = True diff --git a/Data/Sys/GameSettings/GP5E01.ini b/Data/Sys/GameSettings/GP5E01.ini index a4399736e527..7d2aa5d059f2 100644 --- a/Data/Sys/GameSettings/GP5E01.ini +++ b/Data/Sys/GameSettings/GP5E01.ini @@ -8,390 +8,391 @@ [ActionReplay] # Add action replay cheats here. -$All Mini-Games Unlocked + +$All Mini-Games Unlocked [Datel] 044E31C6 08000000 0222A77C 0005FFFF -$P1 Max/ Infinite Coins +$P1 Max/ Infinite Coins [Datel] 044E31C8 08000000 08224AF4 00000042 0222A090 000003E7 -$P1 No Coins +$P1 No Coins [Datel] 044E31C9 08000000 08224AF4 00000042 0222A090 00000000 -$P1 Max/Infinite Stars +$P1 Max/Infinite Stars [Datel] 044E31CA 08000000 08224AF4 00000042 0222A0A4 000003E7 -$P1 No Stars +$P1 No Stars [Datel] 044E31CB 08000000 08224AF4 00000042 0222A0A4 00000000 -$P1 Never Has Any Capsules +$P1 Never Has Any Capsules [Datel] 08224AF4 00000042 0022A075 000002FF -$P2 Max/Infinite Coins +$P2 Max/Infinite Coins [Datel] 044E3228 08000000 08224AF4 00000042 0222A198 000003E7 -$P2 No Coins +$P2 No Coins [Datel] 044E3229 08000000 08224AF4 00000042 0222A198 00000000 -$P2 Max/Infinite Stars +$P2 Max/Infinite Stars [Datel] 044E322A 08000000 08224AF4 00000042 0222A1AC 000003E7 -$P2 No Stars +$P2 No Stars [Datel] 044E322B 08000000 08224AF4 00000042 0222A1AC 00000000 -$P2 Never Has Any Capsules +$P2 Never Has Any Capsules [Datel] 044E322C 08000000 08224AF4 00000042 0022A17D 000002FF -$P3 Max/Infinite Coins +$P3 Max/Infinite Coins [Datel] 044E3288 08000000 08224AF4 00000042 0222A2A0 000003E7 -$P3 No Coins +$P3 No Coins [Datel] 044E3289 08000000 08224AF4 00000042 0222A2A0 00000000 -$P3 Max/Infinite Stars +$P3 Max/Infinite Stars [Datel] 044E328A 08000000 08224AF4 00000042 0222A2B4 000003E7 -$P3 No Stars +$P3 No Stars [Datel] 044E328B 08000000 08224AF4 00000042 0222A2B4 00000000 -$P3 Never Has Any Capsules +$P3 Never Has Any Capsules [Datel] 044E328C 08000000 08224AF4 00000042 0022A285 000002FF -$P4 Max/Infinite Coins +$P4 Max/Infinite Coins [Datel] 044E32E8 08000000 08224AF4 00000042 0222A3A8 000003E7 -$P4 No Coins +$P4 No Coins [Datel] 044E32E9 08000000 08224AF4 00000042 0222A3A8 00000000 -$P4 Max/Infinite Stars +$P4 Max/Infinite Stars [Datel] 044E32EA 08000000 08224AF4 00000042 0222A3BC 000003E7 -$P4 No Stars +$P4 No Stars [Datel] 044E32EB 08000000 08224AF4 00000042 0222A3BC 00000000 -$P4 Never Has Any Capsules +$P4 Never Has Any Capsules [Datel] 044E32EC 08000000 08224AF4 00000042 0022A38D 000002FF -$P1 Max Mini-Game Coins +$P1 Max Mini-Game Coins [Datel] 044E3349 08000000 08224AF4 00000042 0222A092 000003E7 -$P1 No Mini-Game Coins +$P1 No Mini-Game Coins [Datel] 044E334A 08000000 08224AF4 00000042 0222A092 00000000 -$P1 Max Blue Spaces +$P1 Max Blue Spaces [Datel] 044E334B 08000000 08224AF4 00000042 0022A084 000000FF -$P1 No Blue Spaces +$P1 No Blue Spaces [Datel] 044E334C 08000000 08224AF4 00000042 0022A084 00000000 -$P1 Max Red Spaces +$P1 Max Red Spaces [Datel] 044E334D 08000000 08224AF4 00000042 0022A085 000000FF -$P1 No Red Spaces +$P1 No Red Spaces [Datel] 044E334E 08000000 08224AF4 00000042 0022A085 00000000 -$P1 Max Capsule Spaces +$P1 Max Capsule Spaces [Datel] 044E334F 08000000 08224AF4 00000042 0022A086 000000FF -$P1 No Capsule Spaces +$P1 No Capsule Spaces [Datel] 044E3350 08000000 08224AF4 00000042 0022A086 00000000 -$P1 Max Question Mark Spaces +$P1 Max Question Mark Spaces [Datel] 044E3351 08000000 08224AF4 00000042 0022A087 000000FF -$P1 No Question Mark Spaces +$P1 No Question Mark Spaces [Datel] 044E3352 08000000 08224AF4 00000042 0022A087 00000000 -$P1 Max Bowser Spaces +$P1 Max Bowser Spaces [Datel] 044E3353 08000000 08224AF4 00000042 0022A088 000000FF -$P1 No Bowser Spaces +$P1 No Bowser Spaces [Datel] 044E3354 08000000 08224AF4 00000042 0022A088 00000000 -$P1 Max Donkey Kong Spaces +$P1 Max Donkey Kong Spaces [Datel] 044E3355 08000000 08224AF4 00000042 0022A089 000000FF -$P1 No Donkey Kong Spaces +$P1 No Donkey Kong Spaces [Datel] 044E3356 08000000 08224AF4 00000042 0022A089 00000000 -$P2 Max Mini-Game Coins +$P2 Max Mini-Game Coins [Datel] 044E3358 08000000 08224AF4 00000042 0222A19A 000003E7 -$P2 No Mini-Game Coins +$P2 No Mini-Game Coins [Datel] 044E3359 08000000 08224AF4 00000042 0222A19A 00000000 -$P2 Max Blue Spaces +$P2 Max Blue Spaces [Datel] 044E335A 08000000 08224AF4 00000042 0022A18C 000000FF -$P2 No Blue Spaces +$P2 No Blue Spaces [Datel] 044E335B 08000000 08224AF4 00000042 0022A18C 00000000 -$P2 Max Red Spaces +$P2 Max Red Spaces [Datel] 044E335C 08000000 08224AF4 00000042 0022A18D 000000FF -$P2 No Red Spaces +$P2 No Red Spaces [Datel] 044E335D 08000000 08224AF4 00000042 0022A18D 00000000 -$P2 Max Capsule Spaces -044E335E 08000000 +$P2 Max Capsule Spaces [Datel] +044E335E 08000000 08224AF4 00000042 0022A18E 000000FF -$P2 No Capsule Spaces +$P2 No Capsule Spaces [Datel] 044E335F 08000000 08224AF4 00000042 0022A18E 00000000 -$P2 Max Question Mark Spaces +$P2 Max Question Mark Spaces [Datel] 044E3360 08000000 08224AF4 00000042 0022A18F 000000FF -$P2 No Question Mark Spaces +$P2 No Question Mark Spaces [Datel] 044E3361 08000000 08224AF4 00000042 0022A18F 00000000 -$P2 Max Bowser Spaces +$P2 Max Bowser Spaces [Datel] 044E3362 08000000 08224AF4 00000042 0022A190 000000FF -$P2 No Bowser Spaces +$P2 No Bowser Spaces [Datel] 044E3363 08000000 08224AF4 00000042 0022A190 00000000 -$P2 Max Donkey Kong Spaces +$P2 Max Donkey Kong Spaces [Datel] 044E3364 08000000 08224AF4 00000042 0022A191 000000FF -$P2 No Donkey Kong Spaces +$P2 No Donkey Kong Spaces [Datel] 044E3365 08000000 08224AF4 00000042 0022A191 00000000 -$P3 Max Mini-Game Coins +$P3 Max Mini-Game Coins [Datel] 044E3367 08000000 08224AF4 00000042 0222A2A2 000003E7 -$P3 No Mini-Game Coins +$P3 No Mini-Game Coins [Datel] 044E3368 08000000 08224AF4 00000042 0222A2A2 00000000 -$P3 Max Blue Spaces +$P3 Max Blue Spaces [Datel] 044E3369 08000000 08224AF4 00000042 0022A294 000000FF -$P3 No Blue Spaces +$P3 No Blue Spaces [Datel] 044E336A 08000000 08224AF4 00000042 0022A294 00000000 -$P3 Max Red Spaces +$P3 Max Red Spaces [Datel] 044E336B 08000000 08224AF4 00000042 0022A295 000000FF -$P3 No Red Spaces +$P3 No Red Spaces [Datel] 044E336C 08000000 08224AF4 00000042 0022A295 00000000 -$P3 Max Capsule Spaces +$P3 Max Capsule Spaces [Datel] 044E336D 08000000 08224AF4 00000042 0022A296 000000FF -$P3 No Capsule Spaces +$P3 No Capsule Spaces [Datel] 044E336E 08000000 08224AF4 00000042 0022A296 00000000 -$P3 Max Question Mark Spaces +$P3 Max Question Mark Spaces [Datel] 044E336F 08000000 08224AF4 00000042 0022A297 000000FF -$P3 No Question Mark Spaces +$P3 No Question Mark Spaces [Datel] 044E3370 08000000 08224AF4 00000042 0022A297 00000000 -$P3 Max Bowser Spaces +$P3 Max Bowser Spaces [Datel] 044E3371 08000000 08224AF4 00000042 0022A298 000000FF -$P3 No Bowser Spaces +$P3 No Bowser Spaces [Datel] 044E3372 08000000 08224AF4 00000042 0022A298 00000000 -$P3 Max Donkey Kong Spaces +$P3 Max Donkey Kong Spaces [Datel] 044E3373 08000000 08224AF4 00000042 0022A299 000000FF -$P3 No Donkey Kong Spaces +$P3 No Donkey Kong Spaces [Datel] 044E3374 08000000 08224AF4 00000042 0022A299 00000000 -$P4 Max Mini-Game Coins +$P4 Max Mini-Game Coins [Datel] 044E3376 08000000 08224AF4 00000042 0222A3AA 000003E7 -$P4 No Mini-Game Coins +$P4 No Mini-Game Coins [Datel] 044E3377 08000000 08224AF4 00000042 0222A3AA 00000000 -$P4 Max Blue Spaces +$P4 Max Blue Spaces [Datel] 044E3378 08000000 08224AF4 00000042 0022A39C 000000FF -$P4 No Blue Spaces +$P4 No Blue Spaces [Datel] 044E3379 08000000 08224AF4 00000042 0022A39C 00000000 -$P4 Max Red Spaces +$P4 Max Red Spaces [Datel] 044E337A 08000000 08224AF4 00000042 0022A39D 000000FF -$P4 No Red Spaces +$P4 No Red Spaces [Datel] 044E337B 08000000 08224AF4 00000042 0022A39D 00000000 -$P4 Max Capsule Spaces +$P4 Max Capsule Spaces [Datel] 044E337C 08000000 08224AF4 00000042 0022A39E 000000FF -$P4 No Capsule Spaces +$P4 No Capsule Spaces [Datel] 044E337D 08000000 08224AF4 00000042 0022A39E 00000000 -$P4 Max Question Mark Spaces +$P4 Max Question Mark Spaces [Datel] 044E337E 08000000 08224AF4 00000042 0022A39F 000000FF -$P4 No Question Mark Spaces +$P4 No Question Mark Spaces [Datel] 044E337F 08000000 08224AF4 00000042 0022A39F 00000000 -$P4 Max Bowser Spaces +$P4 Max Bowser Spaces [Datel] 044E3380 08000000 08224AF4 00000042 0022A3A0 000000FF -$P4 No Bowser Spaces +$P4 No Bowser Spaces [Datel] 044E3381 08000000 08224AF4 00000042 0022A3A0 00000000 -$P4 Max Donkey Kong Spaces +$P4 Max Donkey Kong Spaces [Datel] 044E3382 08000000 08224AF4 00000042 0022A3A1 000000FF -$P4 No Donkey Kong Spaces +$P4 No Donkey Kong Spaces [Datel] 044E3383 08000000 08224AF4 00000042 0022A3A1 00000000 -$Press L+Y: Player Keeps Moving +$Press L+Y: Player Keeps Moving [Datel] 044E3386 08000000 8A2885F8 00004840 0022A07A 0000000A @@ -400,7 +401,7 @@ $Press L+Y: Player Keeps Moving 0022A392 0000000A 00000000 40000000 -$Press L+X: Player Stops Moving +$Press L+X: Player Stops Moving [Datel] 044E3387 08000000 8A2885F8 00004440 0022A07A 00000001 @@ -409,7 +410,7 @@ $Press L+X: Player Stops Moving 0022A392 00000001 00000000 40000000 -$Press L+Y: Player Keeps Moving +$Press L+Y: Player Keeps Moving [Datel] 044E338B 08000000 8A2885FA 00004840 0022A07A 0000000A @@ -418,16 +419,16 @@ $Press L+Y: Player Keeps Moving 0022A392 0000000A 00000000 40000000 -$Press L+X: Player Stops Moving +$Press L+X: Player Stops Moving [Datel] 044E338C 08000000 8A2885FA 00004440 0022A07A 00000001 -0022A182 00000001 +0022A182 00000001 0022A28A 00000001 0022A392 00000001 00000000 40000000 -$Press L+Y: Player Keeps Moving +$Press L+Y: Player Keeps Moving [Datel] 044E3390 08000000 8A2885FC 00004840 0022A07A 0000000A @@ -436,7 +437,7 @@ $Press L+Y: Player Keeps Moving 0022A392 0000000A 00000000 40000000 -$Press L+X: Player Stops Moving +$Press L+X: Player Stops Moving [Datel] 044E3391 08000000 8A2885FC 00004440 0022A07A 00000001 @@ -445,7 +446,7 @@ $Press L+X: Player Stops Moving 0022A392 00000001 00000000 40000000 -$Press L+Y: Player Keeps Moving +$Press L+Y: Player Keeps Moving [Datel] 044E3395 08000000 8A2885FE 00004840 0022A07A 0000000A @@ -454,7 +455,7 @@ $Press L+Y: Player Keeps Moving 0022A392 0000000A 00000000 40000000 -$Press L+X: Player Stops Moving +$Press L+X: Player Stops Moving [Datel] 044E3396 08000000 8A2885FE 00004440 0022A07A 00000001 @@ -464,109 +465,146 @@ $Press L+X: Player Stops Moving 00000000 40000000 [Gecko] -$Netplay Community Settings +# Add gecko cheats here. +$QOL - Auto Scrolling Text Boxes [gamemasterplc] +F6000001 80008180 +A81F019C 7C001838 +1400000C 60000000 +E0000000 80008000 +*Automatically scrolls the text boxes without pushing A + +$QOL - Faster Boot Time [gamemasterplc] +F6000001 80008180 +38610030 38800002 +14000014 38007FFF +E0000000 80008000 +*Automatically advance through the initial cutscences. + +$QOL - Increased Board Speed [gamemasterplc] c2096910 00000002 a9010014 39200002 7d084fd6 00000000 +0409696C 7D150E70 +*Board animations happen faster. + +$QOL - Increased Capsule Throwing Speed [gamemasterplc] c20c3ca4 00000002 801f0020 38800002 7c0027d6 00000000 c20c3864 00000002 801f0020 38800002 7c0027d6 00000000 +*Throw capsules faster + +$QOL - Increased Taunt Capabilities [gamemasterplc] 0413220c 60000000 041322c4 60000000 0413216c 60000000 04132180 60000000 +*Taunt during your turn. +*Also removes the cap on how fast you can taunt. + +$QOL - Instant Text Display [gamemasterplc] 0404a560 38000000 -0409696c 7d150e70 -c2040178 00000002 -807f0050 906d0000 +*Text is displayed instantly. + +$QOL - Show Controller Port Number of Who Paused in Mini-Games [gamemasterplc] +C2040178 00000002 +807F0050 906D0000 38600000 00000000 -c20396a8 0000000c -3860012c 3880000a -38a00036 38c00030 -38e000ff 90ed0004 -38ed0004 3d008000 -6108b5c4 7d0903a6 -4e800421 3860012c -3880000a 3ca0801c -38a5aed0 80cd0000 -38c60001 c022831c -3ce08000 60e7b468 -7ce903a6 4e800421 -57a0083c 00000000 -f6000002 80008180 -5460d808 54640ffe -7c040050 5400283e -14000020 3c80ffff -14000024 6084ffff -e0000000 80008000 -82000001 8022ab74 -86200001 00000018 -84000001 8022ab74 -82000001 8022ab74 -86200001 0000003f -84000001 8022ab74 -82000001 8022ab74 +C20396A8 0000000C +3860012C 3880000A +38A00036 38C00030 +38E000FF 90ED0004 +38ED0004 3D008000 +6108B5C4 7D0903A6 +4E800421 3860012C +3880000A 3CA0801C +38A5AED0 80CD0000 +38C60001 C022831C +3CE08000 60E7B468 +7CE903A6 4E800421 +57A0083C 00000000 +*Check which player is pausing during minigames. + +$QOL - Unlock Everything +82000001 8022AB74 86200001 00000020 -84000001 8022ab74 -*WARNING: This set of cheats is meant for Netplay only. This can 100% your save so make sure you make backups. -*WARNING: These Cheats will create a save game on Party Mode. Launch it, if you want crashes. -*This Cheat includes -*Game Mechanics - Increased Board Speed -*Game Mechanics - Increased Capsule Throwing Speed -*Game Mechanics - Increased Taunt Capabilities -*Miscellaneous - Instant Text Display -*Miscellaneous - Show Controller Port Number of Who Paused in Mini-Games -*as well as some cheats to 100% the game. We wont tell you which ones they are because that ruins the fun of playing. - -$Netplay Safe Kill Music -042888A4 00000001 -20468E38 80630000 -04468E3C 38600000 +84000001 8022AB74 +82000001 8022AB74 +86200001 00000018 +84000001 8022AB74 +20472838 A083000C +04472838 3880FFFF +0446BFCC 38C0FFFF E2000001 80008000 -*This cheat makes it so all in-game music will be turned off. -* -*This can safely be used in a Netplay game without desync. +*Unlocks Everything in the game. -$Game Mechanics - Battle Coins Don't Affect Mini-Game Star -2046d354 b0030022 -0446d350 60000000 -e2000001 80008000 -*This cheat makes battle minigames not count towards the Mini-Game Star. +$Board: Bowser Nightmare - Bowser does not Steal Coins [gamemasterplc] +20457D58 3880FFF6 +04457D58 38800000 +E2000001 80008000 +*Bowser does not steal coins in the board Bowser Nightmare. -$Board - Future Dream: 60 Seconds in Rocket Ship Game +$Board: Future Dream - 60 Seconds in Rocket Ship Game [gamemasterplc] 2046EF60 38800708 0446EF60 38800E10 E2000001 80008000 -*This cheat makes the Future Dream rocket game easier to win. +*Timer is set to 60 seconds during the Rocket Game in the board Future Dream. -$Board - Future Dream: Free Taxi Ride +$Board: Future Dream - Free Taxi Ride [gamemasterplc] 2046DA84 386002F6 0446DA80 48000038 0446E414 2C070000 0446E4A4 2C050000 0446E4C4 38800000 E2000001 80008000 -*This cheat makes the Taxi from Future Dream not force charge you 10 coins. +*Taxi does not charge you 10 coins in the board Future Dream. + +$Board: Pirate Dream - Free Thwomps [gamemasterplc] +0412811C 4800002C +04128210 38800000 +*Thwomp is now free to pass in the board Pirate Dream. -$Board - Rainbow Dream: Free Bridge Crossings +$Board: Rainbow Dream - Free Bridge Crossings [gamemasterplc] 2046A0B0 2C030005 0446A0B0 2C030000 0446A138 2C040000 0446A294 2C030000 0446A308 38800000 E2000001 80008000 -*This cheat makes the rainbow bridges cost nothing instead of the usual 5 coins. +*Rainbow Bridges cost nothing in the board Rainbow Dream. -$Board - Sweet Dream: Disable Topmost Happenning Space +$Board: Sweet Dream - Disable Topmost Happening Space [gamemasterplc] 2045B2F4 F3E10148 0445B2E4 4E800020 E2000001 80008000 -*This cheat disables the topmost Happenning space in Sweet Dream. +*Disables the topmost Happening Space in the board Sweet Dream. + +$Extra - Disable Music [gamemasterplc] +042888A4 00000001 +20468E38 80630000 +04468E3C 38600000 +E2000001 80008000 +*Disables all in-game music. + +$Mechanics - Battle Minigames Don't Affect Mini-Game Star [gamemasterplc] +2046d354 b0030022 +0446d350 60000000 +e2000001 80008000 +*Battle Minigames do not count towards the Mini-Game Star. + +$Mechanics - Disable Capsules [gamemasterplc] +F6000001 80008180 +3BC50005 887E0000 +D2000004 00000002 +386000FF 987E0000 +60000000 00000000 +E0000000 80008000 +*Disables all usage of Capsules. +*Capsules already on spaces will continue to exist. -$Game Mechanics - Free Stars +$Mechanics - Free Stars [gamemasterplc] f6000001 80008180 4080002c 386002f0 14000000 4800002c @@ -579,63 +617,123 @@ f6000001 80008180 14000000 2c030000 14000618 38800000 e0000000 80008000 -*This cheat makes Stars cost nothing instead of the usual 20 coins. - -$Game Mechanics - Increased Board Speed -c2096910 00000002 -a9010014 39200002 -7d084fd6 00000000 -0409696C 7D150E70 -*This cheat makes the players move faster while playing a Mario Party board. - -$Game Mechanics - Increased Capsule Throwing Speed -c20c3ca4 00000002 -801f0020 38800002 -7c0027d6 00000000 -c20c3864 00000002 -801f0020 38800002 -7c0027d6 00000000 -*This cheat makes capsules appear to be thrown faster. - -$Game Mechanics - Increased Taunt Capabilities -0413220c 60000000 -041322c4 60000000 -0413216c 60000000 -04132180 60000000 -*This cheat makes it so you can taunt during your turn. - -$Minigame - Bound of Music: No Bricks -2046e0a8 7c033000 -0446e0ac 60000000 -e2000001 80008000 -*This cheat makes it so Bound of Music is more balanced. - -$Minigame - Coney Island: Start With 60 Seconds -2046EA6C 38800708 -0446EA6C 38800710 +*Stars cost nothing instead of the usual 20 coins. + +$Mechanics - Improved Item RNG [gamemasterplc] +C20C8FA0 0000001B +9421FFF0 7C0802A6 +90010014 93E10000 +3860002A 3C808003 +6084B0F4 7C8903A6 +4E800421 2C030007 +40820008 38600006 +2C030008 40820008 +38600006 2C030009 +40820008 38600006 +2C030012 40820008 +38600011 2C030013 +40820008 38600011 +2C03001A 40820008 +38600019 2C03001B +40820008 38600019 +2C03001C 40820008 +38600019 2C03001D +40820008 38600019 +2C030022 40820008 +38600021 2C030025 +40820008 38600024 +2C030026 40820008 +38600024 2C030027 +40820008 38600024 +83E10000 80010014 +7C0803A6 38210010 +4E800020 00000000 +*Improves the RNG of what items are received. + +$Mechanics - Last 5 Turns is x3 Coins on Spaces [gamemasterplc] +20288860 00000076 +045152BC 00000001 +E2100000 80008000 +20288860 00000078 +044FE3BC 00000001 E2000001 80008000 -*This cheat makes it so Coney Island is more balanced. - -$Minigame - Coney Island: Bigger Cones Don't Slow You Down -204763E4 3C608048 -044763E0 38000000 -0447663C 38000000 +*Last 5 Turns Event is always x3 Coins on Spaces. + +$Mechanics- Last 5 Turns is 5 Star Spaces [gamemasterplc] +20288860 00000076 +045152BC 00000003 +E2100000 80008000 +20288860 00000078 +044FE3BC 00000003 E2000001 80008000 -*This cheat makes it so Coney Island is more balanced. - -$Minigame - Flower Shower: All Flowers Worth 3 Points -20459BEC 801F003C -04459BEC 38000003 +*Last 5 Turns Event is always 5 Star Spaces. + +$Mechanics - Last 5 Turns is Capsule Spaces on Every Space [gamemasterplc] +20288860 00000076 +045152BC 00000001 +E2100000 80008000 +20288860 00000078 +044FE3BC 00000001 +E2000001 80008000 +*Last 5 Turns Event forces all spaces to Have Capsule Events. + +$Mechanics - Last 5 Turns is Disabled [gamemasterplc] +F6000002 80008180 +88030005 7C040050 +2C000005 4080000C +1400000C 4800000C +E0000000 80008000 +*Last 5 Turns Event never happens. + +$Mechanics - Last 5 Turns is Red Spaces are Bowser Spaces [gamemasterplc] +20288860 00000076 +045152BC 00000002 +E2100000 80008000 +20288860 00000078 +044FE3BC 00000002 E2000001 80008000 -*This cheat makes it so Flower Shower is more balanced. +*Last 5 Turns Event forces Red Spaces to turn into Bowser Spaces. + +$Mechanics - Same Space Duels Don't Happen [gamemasterplc] +F6000001 80008180 +7C1D0000 40820048 +14000004 48000048 +E0000000 80008000 +*Duels never happen if you are on the same space. + +$Mechanics - Use Capsules on Yourself For Free [gamemasterplc] +F6000001 80008180 +7C802A14 80640014 +14000004 38600000 +E0000000 80008000 +*Capsules can be used on yourself for free. + +$Minigame: Beam Team - 20 Second Timer [Airsola] +20288860 00000025 +28467572 00000708 +02467572 000004b0 +e2000002 80008000 +*Shortens the Timer in the minigame Beam Team. + +$Minigame: Bound of Music - No Bricks [gamemasterplc] +2046e0a8 7c033000 +0446e0ac 60000000 +e2000001 80008000 +*Bricks are removed in the minigame Bound of Music. -$Minigame - Ground Pound Down: No Rocks Until End +$Minigame: Ground Pound Down - No Rocks Until End [gamemasterplc] 2046FCC4 4180FF6C 0446FCC4 60000000 E2000001 80008000 -*This cheat makes it so Ground Pound Down is more balanced. +*Rocks are not present until the end in the minigame Ground Pound Down. + +$Minigame: Later Skater - Only 1 Lap [gamemasterplc] +20472A48 38030001 +04472A48 38000005 +E2000001 80008000 +*Only one lap around in the minigame Later Skater. -$Minigame - Mathletes: Always Multiplication +$Minigame: Mathletes - Always Multiplication [gamemasterplc] 2045D2AC 38030001 C245D2AC 00000004 3DC08047 81CE815C @@ -643,301 +741,75 @@ C245D2AC 00000004 38600000 38030001 60000000 00000000 E2000001 80008000 -*This cheat makes it so Mathletes is more balanced. +*Multiplication is only present in the minigame Mathletes. + +$Minigame: Pop Star Piranhas - Halved Time to Pick [gamemasterplc] +20288860 00000016 +28541d52 0000012b +02541d52 000000b3 +e2000002 80008000 +*Shortens the timer in the minigame Pop Star Piranhas. + +$Minigame: Will Flower - Flower Rises Faster +20470778 D3FF0014 +C2440778 00000003 +3DC04000 91C20020 +C1E20020 EFEF07F2 +D3FF0014 00000000 +E2000001 80008000 +*Flowers rise more per button press in the minigame Will Flower. -$Minigame - Pop Star Piranhas: Halved Time to Pick -2046983c 3880012c -0446983c 38800096 -e2000001 80008000 -*This cheat makes it so Pop Star Piranhas is more balanced. +$Minigame Replacement - Big Top Drop ➜ Squared Away [Nora] +2822A4C4 00000018 +0222A4C4 00000011 +E2000001 80008000 + +$Minigame Replacement - Curvy Curbs ➜ Tube It or Lose It [Nora] +2822A4C4 0000004C +0222A4C4 00000043 +E2000001 80008000 -$Minigame Replacement - Get a Rope ➜ Piece Out +$Minigame Replacement - Get a Rope ➜ Piece Out [Nora] 2822A4C4 0000002D 0222A4C4 00000033 E2000001 80008000 -$Minigame Replacement - Lucky Lineup ➜ Astro-Logical +$Minigame Replacement - Lucky Lineup ➜ Astro-Logical [Nora] 2822A4C4 00000026 0222A4C4 00000022 E2000001 80008000 -$Minigame Replacement - Replace Mathletes ➜ Flatiator +$Minigame Replacement - Replace Mathletes ➜ Flatiator [Nora] 2822a4c4 00000044 0222a4c4 00000010 e2000001 80008000 -$Minigame Replacement - Replace Pound Peril ➜ Sky Survivor +$Minigame Replacement - Replace Pound Peril ➜ Sky Survivor [Nora] 2822a4c4 00000032 0222a4c4 00000036 e2000001 80008000 -$Minigame Replacement - Replace Random Ride ➜ Twist 'n' Out +$Minigame Replacement - Replace Random Ride ➜ Twist 'n' Out [Nora] 2822a4c4 00000027 0222a4c4 00000025 e2000001 80008000 -$Minigame Replacement - Replace Rumble Fumble ➜ Fish Upon a Star +$Minigame Replacement - Replace Rumble Fumble ➜ Fish Upon a Star [Nora] 2822a4c4 00000041 0222a4c4 00000040 e2000001 80008000 -* -$Minigame Replacement - Replace Scaldin' Cauldron ➜ Rain of Fire + +$Minigame Replacement - Replace Scaldin' Cauldron ➜ Rain of Fire [Nora] 2822A4C4 0000003C 0222A4C4 0000003A E2000001 80008000 -$Minigame Replacement - Replace Vicious Vending ➜ Coin Cache +$Minigame Replacement - Replace Vicious Vending ➜ Coin Cache [Nora] 2822a4c4 00000017 0222a4c4 0000000f e2000001 80008000 -$Minigame Replacement - Replace Whomp Maze ➜ Shock Absorbers +$Minigame Replacement - Replace Whomp Maze ➜ Shock Absorbers [Nora] 2822a4c4 0000002a 0222a4c4 00000028 e2000001 80008000 - -$Miscellaneous - Instant Text Display -0404a560 38000000 -*This cheat makes it so text is displayed instantly. - -$Miscellaneous - Show Controller Port Number of Who Paused in Mini-Games -C2040178 00000002 -807F0050 906D0000 -38600000 00000000 -C20396A8 0000000C -3860012C 3880000A -38A00036 38C00030 -38E000FF 90ED0004 -38ED0004 3D008000 -6108B5C4 7D0903A6 -4E800421 3860012C -3880000A 3CA0801C -38A5AED0 80CD0000 -38C60001 C022831C -3CE08000 60E7B468 -7CE903A6 4E800421 -57A0083C 00000000 -*This cheat will display a number on the pause screen of a minigame to see which port paused it. - -$Miscellaneous - Widescreen -04289518 44400000 -04289AD8 44400000 -042894A0 44555555 -0428A3C0 44400000 -C2047EB4 00000002 -3C004410 90010014 -C0410014 00000000 -0400C4B4 2C000356 -204584E4 4180FA38 -044569DC 38600133 -04456A98 386000CE -C24584B8 00000002 -1C720004 38800003 -7C6327D6 00000000 -C245840C 00000002 -1C720004 38800003 -7C6327D6 00000000 -C24583AC 00000002 -1C720004 38800003 -7C6327D6 00000000 -E2000001 80008000 -20457268 3C60001F -C2457248 00000006 -38800000 3CA041AB -90A1FFFC C021FFFC -3CA03F80 90A1FFFC -C041FFFC 3CA08000 -60A5EFA8 7CA903A6 -4E800421 00000000 -E2000001 80008000 -C2157F68 00000005 -3C803B2A 6084AAAB -80030000 7C002000 -4082000C 3C00BF40 -9003000C C003000C -60000000 00000000 -041BA844 3FCCCCCD -C20238D4 00000005 -9421FFF4 D8A10000 -3C003FAB 90010008 -C0A10008 EC850132 -C8A10000 3821000C -9421FFE0 00000000 -04289610 3FCCCCCD -20460110 C07F0004 -C246010C 00000003 -3C803F99 6084999A -909F000C C05F000C -60000000 00000000 -E2000001 80008000 -2048DC98 38610064 -C248DC88 00000003 -3C803F99 6084999A -909F000C C05F000C -60000000 00000000 -E2000001 80008000 -2049CA64 43700000 -C24763D8 00000007 -EC23002A D021006C -8081006C 3CA04390 -7C042800 38800000 -9081006C C041006C -41810010 3C80C2C0 -9081006C C041006C -EC22082A 00000000 -C2476C7C 00000007 -EC23002A D021006C -8081006C 3CA04390 -7C042800 38800000 -9081006C C041006C -41810010 3C80C2C0 -9081006C C041006C -EC22082A 00000000 -C24737E8 00000005 -EC2007B2 3C803FAB -9081FFFC C041FFFC -EC220072 3C80C2C0 -9081FFFC C041FFFC -EC22082A 00000000 -E2000001 80008000 -20472B58 4180FED4 -C2472AE8 00000005 -7C24042E 3C803FAB -9081FFFC C041FFFC -EC220072 3C80C2C0 -9081FFFC C041FFFC -EC22082A 00000000 -C247072C 00000005 -EC210028 3C803FAB -90810014 C0410014 -EC220072 3C80C2C0 -90810014 C0410014 -EC22082A 00000000 -E2000001 80008000 -20475FF4 3B800000 -C2475ED4 00000003 -3C604280 90610014 -C0210014 EC01002A -D001001C 00000000 -C2475FD0 00000003 -3C604280 9061000C -C021000C EC01002A -D0010024 00000000 -C2475768 00000003 -3FC04390 7C1E1800 -41810008 3C604428 -907F0030 00000000 -E2000001 80008000 -2046A704 C0440000 -C246A6F8 00000005 -EC210032 3C803FAB -9081FFFC C041FFFC -EC220072 3C80C2C0 -9081FFFC C041FFFC -EC22082A 00000000 -E2000001 80008000 -C20B812C 00000005 -C03E0010 3C803FAB -9081FFFC C041FFFC -EC220072 3C80C2C0 -9081FFFC C041FFFC -EC22082A 00000000 -C20B8D28 00000005 -C03E0008 3C803FAB -9081FFFC C041FFFC -EC220072 3C80C2C0 -9081FFFC C041FFFC -EC22082A 00000000 -C20B8DD8 00000005 -C03E0010 3C803FAB -9081FFFC C041FFFC -EC220072 3C80C2C0 -9081FFFC C041FFFC -EC22082A 00000000 -C20B7E68 00000005 -C03F0010 3C803FAB -9081FFFC C041FFFC -EC220072 3C80C2C0 -9081FFFC C041FFFC -EC22082A 00000000 -C20B7288 00000005 -C0210008 3C803FAB -9081FFFC C041FFFC -EC220072 3C80C2C0 -9081FFFC C041FFFC -EC22082A 00000000 -040A9248 C0428190 -040A95B4 60000000 -C212FF58 00000006 -3C803F40 90810018 -C0210018 C0030000 -EC010032 D0030000 -C003000C EC010032 -D003000C 38800001 -60000000 00000000 -2046E8D8 38610064 -C246E8C8 00000003 -3C803F99 6084999A -909F000C C05F000C -60000000 00000000 -E2000001 80008000 -20487900 38610064 -C24878F0 00000003 -3C803F99 6084999A -909F000C C05F000C -60000000 00000000 -E2000001 80008000 -2045C384 38610064 -C245C374 00000003 -3C803F99 6084999A -909F000C C05F000C -60000000 00000000 -E2000001 80008000 -204792DC 38610064 -C24792CC 00000003 -3C803F99 6084999A -909F000C C05F000C -60000000 00000000 -E2000001 80008000 -20458EE4 38610064 -C2458ED4 00000003 -3C803F99 6084999A -909F000C C05F000C -60000000 00000000 -E2000001 80008000 -2047B840 38610064 -C247B830 00000003 -3C803F99 6084999A -909F000C C05F000C -60000000 00000000 -E2000001 80008000 -20460CD8 38610064 -C2460CC8 00000003 -3C803F99 6084999A -909F000C C05F000C -60000000 00000000 -E2000001 80008000 -20478618 42700000 -04478614 47FFFFFF -04224B54 3F99999A -E2000001 80008000 -2047636C 43700000 -04476368 44280000 -044762D8 44280000 -C2472738 00000002 -3C804410 9081FFFC -C001FFFC 00000000 -C247273C 00000005 -EC2007F2 3C803FAB -9081FFFC C041FFFC -EC220072 3C80C2C0 -9081FFFC C041FFFC -EC22082A 00000000 -C2472924 00000005 -EC24002A 3C803FAB -9081FFFC C041FFFC -EC220072 3C80C2C0 -9081FFFC C041FFFC -EC22082A 00000000 -E2000001 80008000 -*This cheat makes the game appear in widescreen. diff --git a/Data/Sys/GameSettings/GP6E01.ini b/Data/Sys/GameSettings/GP6E01.ini index 505fb18aa26e..7a52d3a50e20 100644 --- a/Data/Sys/GameSettings/GP6E01.ini +++ b/Data/Sys/GameSettings/GP6E01.ini @@ -6,8 +6,468 @@ [OnFrame] # Add memory patches to be applied every frame here. +[ActionReplay] +# Add action replay cheats here. + +$Game - Orb Expansion [Airsola] +042bd220 00050a05 +042bd230 010f140a +042bd240 020f140a +042bd250 03050505 +042bd260 040f140a +042bd270 05141414 +042bd280 061e1e1e +042bd290 0a050505 +042bd2a0 0b0a0a0a +042bd2b0 0c0a0a0a +042bd2c0 0d050505 +042bd2d0 0f0a0a0a +042bd2e0 10050505 +042bd2f0 110a0f05 +042bd300 14050a05 +042bd310 150f140a +042bd320 160f0f0f +042bd330 170f140a +042bd340 18050a05 +042bd350 190f140a +042bd360 1e141414 +042bd370 1f0f140a +042bd380 ff000000 +8c2c0254 0000007b +042bd224 07070707 +042bd234 07070707 +042bd244 0e0e0e0e +042bd254 0b0b0b0b +042bd264 0a0a0a0a +042bd274 00000000 +042bd284 00000000 +042bd294 03030303 +042bd2a4 00000000 +042bd2b4 00000000 +042bd2c4 06060606 +042bd2d4 00000000 +042bd2e4 00000000 +042bd2f4 03030303 +042bd304 05050505 +042bd314 05050505 +042bd324 00000000 +042bd334 06060606 +042bd344 06060606 +042bd354 0e0e0e0e +042bd364 00000000 +042bd374 03030303 +042bd228 0e070700 +042bd238 0007070d +042bd248 0e0e0e0d +042bd258 0b0b0b0b +042bd268 0a0a0a0a +042bd278 0000000c +042bd288 00000005 +042bd298 00030300 +042bd2a8 03000000 +042bd2b8 00000003 +042bd2c8 06060605 +042bd2d8 00000003 +042bd2e8 03000000 +042bd2f8 00030300 +042bd308 0a050500 +042bd318 0005050a +042bd328 0d000000 +042bd338 0006060c +042bd348 0d060600 +042bd358 000e0e00 +042bd368 00000000 +042bd378 03030303 +042bd22c 0e070700 +042bd23c 0007070d +042bd24c 0e0e0e0d +042bd25c 0b0b0b0b +042bd26c 0a0a0a0a +042bd27c 0000000c +042bd28c 00000005 +042bd29c 00030300 +042bd2ac 03000000 +042bd2bc 00000003 +042bd2cc 06060605 +042bd2dc 00000003 +042bd2ec 03000000 +042bd2fc 00030300 +042bd30c 0d050500 +042bd31c 0005050a +042bd32c 0a000000 +042bd33c 0006060c +042bd34c 0d060600 +042bd35c 000e0e00 +042bd36c 00000000 +042bd37c 03030303 +00000000 40000000 +8c2c0254 0000007c +042bd224 07070707 +042bd234 07070707 +042bd244 0e0e0e0e +042bd254 0c0c0c0c +042bd264 0c0c0c0c +042bd274 00000000 +042bd284 00000000 +042bd294 03030303 +042bd2a4 00000000 +042bd2b4 00000000 +042bd2c4 06060606 +042bd2d4 00000000 +042bd2e4 00000000 +042bd2f4 03030303 +042bd304 05050505 +042bd314 05050505 +042bd324 00000000 +042bd334 06060606 +042bd344 06060606 +042bd354 0e0e0e0e +042bd364 00000000 +042bd374 00000000 +042bd228 0e070700 +042bd238 0007070d +042bd248 0e0e0e0d +042bd258 0c0c0c0c +042bd268 0b0c0c0b +042bd278 0000000c +042bd288 00000005 +042bd298 00030300 +042bd2a8 03000000 +042bd2b8 00000003 +042bd2c8 06060605 +042bd2d8 00000003 +042bd2e8 03000000 +042bd2f8 00030300 +042bd308 0b050500 +042bd318 0005050b +042bd328 0d000000 +042bd338 0006060c +042bd348 0d060600 +042bd358 000e0e00 +042bd368 00000000 +042bd378 00000000 +042bd22c 0e070700 +042bd23c 0007070d +042bd24c 0e0e0e0d +042bd25c 0c0c0c0c +042bd26c 0b0c0c0b +042bd27c 0000000c +042bd28c 00000005 +042bd29c 00030300 +042bd2ac 03000000 +042bd2bc 00000003 +042bd2cc 06060605 +042bd2dc 00000003 +042bd2ec 03000000 +042bd2fc 00030300 +042bd30c 0b050500 +042bd31c 0005050b +042bd32c 0d000000 +042bd33c 0006060c +042bd34c 0d060600 +042bd35c 000e0e00 +042bd36c 00000000 +042bd37c 00000000 +00000000 40000000 +8c2c0254 0000007d +042bd224 06060606 +042bd234 06060606 +042bd244 0c0c0c0c +042bd254 08080808 +042bd264 08080808 +042bd274 00000000 +042bd284 00000000 +042bd294 08080808 +042bd2a4 00000000 +042bd2b4 00000000 +042bd2c4 0c0c0c0c +042bd2d4 00000000 +042bd2e4 00000000 +042bd2f4 08080808 +042bd304 04040404 +042bd314 04040404 +042bd324 00000000 +042bd334 06060606 +042bd344 06060606 +042bd354 0c0c0c0c +042bd364 00000000 +042bd374 00000000 +042bd228 0c060600 +042bd238 0006060b +042bd248 0c0c0c0b +042bd258 08080808 +042bd268 08080808 +042bd278 0000000b +042bd288 00000005 +042bd298 00080800 +042bd2a8 08000000 +042bd2b8 00000008 +042bd2c8 0c0c0c0b +042bd2d8 00000008 +042bd2e8 08000000 +042bd2f8 00080800 +042bd308 08040400 +042bd318 00040408 +042bd328 0c000000 +042bd338 0006060b +042bd348 0c060600 +042bd358 000c0c00 +042bd368 00000000 +042bd378 00000000 +042bd22c 0c060600 +042bd23c 0006060b +042bd24c 0c0c0c0b +042bd25c 08080808 +042bd26c 08080808 +042bd27c 0000000b +042bd28c 00000005 +042bd29c 00080800 +042bd2ac 08000000 +042bd2bc 00000008 +042bd2cc 0c0c0c0b +042bd2dc 00000008 +042bd2ec 08000000 +042bd2fc 00080800 +042bd30c 08040400 +042bd31c 00040408 +042bd32c 0c000000 +042bd33c 0006060b +042bd34c 0c060600 +042bd35c 000c0c00 +042bd36c 00000000 +042bd37c 00000000 +00000000 40000000 +8c2c0254 0000007e +042bd224 06060606 +042bd234 06060606 +042bd244 0c0c0c0c +042bd254 07070707 +042bd264 06060606 +042bd274 00000000 +042bd284 00000000 +042bd294 06060606 +042bd2a4 00000000 +042bd2b4 00000000 +042bd2c4 0c0c0c0c +042bd2d4 00000000 +042bd2e4 00000000 +042bd2f4 06060606 +042bd304 04040404 +042bd314 04040404 +042bd324 00000000 +042bd334 06060606 +042bd344 06060606 +042bd354 0c0c0c0c +042bd364 07070707 +042bd374 00000000 +042bd228 0c060600 +042bd238 0006060c +042bd248 0c0c0c0c +042bd258 07070707 +042bd268 07060607 +042bd278 0000000c +042bd288 00000000 +042bd298 00060600 +042bd2a8 06000000 +042bd2b8 00000006 +042bd2c8 0c0c0c0c +042bd2d8 00000006 +042bd2e8 06000000 +042bd2f8 00060600 +042bd308 07040400 +042bd318 00040407 +042bd328 0c000000 +042bd338 0006060c +042bd348 0c060600 +042bd358 000c0c00 +042bd368 07070707 +042bd378 00000000 +042bd22c 0c060600 +042bd23c 0006060c +042bd24c 0c0c0c0c +042bd25c 07070707 +042bd26c 07060607 +042bd27c 0000000c +042bd28c 00000000 +042bd29c 00060600 +042bd2ac 06000000 +042bd2bc 00000006 +042bd2cc 0c0c0c0c +042bd2dc 00000006 +042bd2ec 06000000 +042bd2fc 00060600 +042bd30c 07040400 +042bd31c 00040407 +042bd32c 0c000000 +042bd33c 0006060c +042bd34c 0c060600 +042bd35c 000c0c00 +042bd36c 07070707 +042bd37c 00000000 +00000000 40000000 +8c2c0254 0000007f +042bd224 07070707 +042bd234 07070707 +042bd244 0e0e0e0e +042bd254 0b0b0b0b +042bd264 0a0a0a0a +042bd274 00000000 +042bd284 00000000 +042bd294 03030303 +042bd2a4 00000000 +042bd2b4 00000000 +042bd2c4 06060606 +042bd2d4 00000000 +042bd2e4 00000000 +042bd2f4 03030303 +042bd304 05050505 +042bd314 05050505 +042bd324 00000000 +042bd334 06060606 +042bd344 06060606 +042bd354 0e0e0e0e +042bd364 00000000 +042bd374 03030303 +042bd228 0e070700 +042bd238 0007070e +042bd248 0e0e0e0e +042bd258 0b0b0b0b +042bd268 0a0a0a0a +042bd278 0000000d +042bd288 00000000 +042bd298 00030300 +042bd2a8 03000000 +042bd2b8 00000003 +042bd2c8 06060606 +042bd2d8 00000003 +042bd2e8 03000000 +042bd2f8 00030300 +042bd308 0a050500 +042bd318 0005050a +042bd328 0d000000 +042bd338 0006060d +042bd348 0d060600 +042bd358 000e0e00 +042bd368 00000000 +042bd378 03030303 +042bd22c 0e070700 +042bd23c 0007070e +042bd24c 0e0e0e0e +042bd25c 0b0b0b0b +042bd26c 0a0a0a0a +042bd27c 0000000d +042bd28c 00000000 +042bd29c 00030300 +042bd2ac 03000000 +042bd2bc 00000003 +042bd2cc 06060606 +042bd2dc 00000003 +042bd2ec 03000000 +042bd2fc 00030300 +042bd30c 0a050500 +042bd31c 0005050a +042bd32c 0d000000 +042bd33c 0006060d +042bd34c 0d060600 +042bd35c 000e0e00 +042bd36c 00000000 +042bd37c 03030303 +00000000 40000000 +8c2c0254 00000080 +042bd224 07070707 +042bd234 07070707 +042bd244 0e0e0e0e +042bd254 0c0c0c0c +042bd264 0c0c0c0c +042bd274 00000000 +042bd284 00000000 +042bd294 03030303 +042bd2a4 00000000 +042bd2b4 00000000 +042bd2c4 06060606 +042bd2d4 00000000 +042bd2e4 00000000 +042bd2f4 03030303 +042bd304 05050505 +042bd314 05050505 +042bd324 00000000 +042bd334 06060606 +042bd344 06060606 +042bd354 0e0e0e0e +042bd364 00000000 +042bd374 00000000 +042bd228 0e070700 +042bd238 0007070e +042bd248 0e0e0e0e +042bd258 0c0c0c0c +042bd268 0b0c0c0b +042bd278 0000000d +042bd288 00000000 +042bd298 00030300 +042bd2a8 03000000 +042bd2b8 00000003 +042bd2c8 06060606 +042bd2d8 00000003 +042bd2e8 03000000 +042bd2f8 00030300 +042bd308 0b050500 +042bd318 0005050b +042bd328 0d000000 +042bd338 0006060d +042bd348 0d060600 +042bd358 000e0e00 +042bd368 00000000 +042bd378 00000000 +042bd22c 0e070700 +042bd23c 0007070e +042bd24c 0e0e0e0e +042bd25c 0c0c0c0c +042bd26c 0b0c0c0b +042bd27c 0000000d +042bd28c 00000000 +042bd29c 00030300 +042bd2ac 03000000 +042bd2bc 00000003 +042bd2cc 06060606 +042bd2dc 00000003 +042bd2ec 03000000 +042bd2fc 00030300 +042bd30c 0b050500 +042bd31c 0005050b +042bd32c 0d000000 +042bd33c 0006060d +042bd34c 0d060600 +042bd35c 000e0e00 +042bd36c 00000000 +042bd37c 00000000 +00000000 40000000 +*(Almost) all Orbs become obtainable on each board. Orb prices are rebalanced. + [Gecko] -$Netplay Community Settings +# Add gecko cheats here. + +$QOL - Auto Advance Text Boxes [gamemasterplc] +F6000002 80008180 +A81F01A0 7C001838 +28000000 41820128 +1400000C 60000000 +E0000000 80008000 +*Automatically scrolls the text boxes without pushing A + +$QOL - Faster Boot Time [gamemasterplc] +204cdc74 386003e8 +044cdc34 48000038 +044cdc4c 48000020 +e2000001 80008000 +204cc980 41820078 +044cc980 60000000 +e2000001 80008000 +204CCE7C 3BDE0001 +044CCE7C 3BC00DB6 +E2000001 80008000 +*Automatically advance through the initial cutscences. + +$QOL - Increased Board Speed [Celerizer] 041556d4 7d170e70 042c31b4 41f00000 041b02ac 60000000 @@ -23,13 +483,28 @@ c21c28bc 00000002 c21c245c 00000002 801f0020 38800002 7c0027d6 00000000 + +$QOL - Increased Orb Throwing Speed [Celerizer] +c21c28bc 00000002 +801f0020 38800002 +7c0027d6 00000000 +c21c245c 00000002 +801f0020 38800002 +7c0027d6 00000000 +*Throw orbs faster + +$QOL - Increased Taunt Capabilities [Celerizer] 0420526c 60000000 0420518c 60000000 0420516c 60000000 +*Taunt during your turn. +*Also removes the cap on how fast you can taunt. + +$QOL - Instant Text Display [Celerizer] 0404f51c 38000000 -0417e908 60000000 -0415f198 60000000 -0415f1a0 60000000 +*Text is displayed instantly. + +$QOL - Show Controller Port Number of Who Paused in Mini-Games [Celerizer] C20456D4 00000002 807F0050 906D0000 38600000 00000000 @@ -46,12 +521,9 @@ C203E1FC 0000000C 3CE08000 60E7C354 7CE903A6 4E800421 57A0083C 00000000 -F6000002 80008180 -5460D808 54640FFE -7C040050 5400283E -14000020 3C80FFFF -14000024 6084FFFF -E0000000 80008000 +*Check which player is pausing during minigames. + +$QOL - Unlock Everything [gamemasterplc] F6000001 80008180 80A405A8 38800001 14000000 38A0FFFF @@ -60,29 +532,145 @@ F6000001 80008180 80A405A0 38800001 14000000 38A0FFFF E0000000 80008000 -*WARNING: This set of cheats is meant for Netplay only. This can 100% your save so make sure you make backups. -*This Cheat includes -*Game Mechanics - Increased Board Speed -*Game Mechanics - Increased Coin Gain/Loss Speed -*Game Mechanics - Increased Orb Throwing Speed -*Game Mechanics - Increased Taunt Capabilities -*Game Mechanics - Instant Text Display -*Miscellaneous - Show Controller Port Number of Who Paused in Mini-Games -*as well as some cheats to 100% the game. We wont tell you which ones they are because that ruins the fun of playing. - -$Netplay Safe Kill Music +*Unlocks Everything in the game. + +$Board - Snowflake Lake: Chomps Roll 7 during daytime, and 3 per dice during nighttime [gamemasterplc] +204cc818 4bcbbacd +c24cc810 00000005 +3b200007 3c608026 +88635b80 5463d7fe +28030000 4182000c +1f3d0003 3b390003 +60000000 00000000 +e2000001 80008000 +*Change dice prices in the board Snowflake Lake. + +$Board - Snowflake Lake: Chomps Sell Stars (40 Coins), Players Start with 0 Stars [gamemasterplc] +0418040c 480000f0 +204cadfc 48001595 +48000000 802c0364 +de000000 80008180 +14014f64 7834300a +e2000001 80008000 +204cadfc 48001595 +c24cc390 00000021 +9421ffe0 7c0802a6 +90010024 93e10008 +93c1000c 93a10018 +7c7f1b78 3fc08015 +63decd40 7fc903a6 +4e800421 2c030028 +418000b4 1c7f0108 +3c808026 7c632214 +88635750 70630020 +40820050 38600001 +3c800027 38840003 +38a00006 38c00000 +3fc08016 63debce8 +7fc903a6 4e800421 +3fc08016 63decda8 +7fc903a6 4e800421 +3fc08016 63decafc +7fc903a6 4e800421 +2c030000 40820050 +7fe3fb78 3880ffd8 +3fc08017 63dee824 +7fc903a6 4e800421 +7fe3fb78 38800000 +38a00001 38c00001 +3fc08017 63defef0 +7fc903a6 4e800421 +38600014 3fc08016 +63deec68 7fc903a6 +4e800421 83a10018 +83c1000c 83e10008 +80010024 7c0803a6 +38210020 4e800020 +60000000 00000000 +044cb09c 480000a0 +e2000001 80008000 +*Chain Chomps sell stars instead of stealing stars in the board Snowflake Lake. + +$Board - Snowflake Lake: Start at 3 Stars [Airsola] +204cb0dc 389b0005 +044cb0dc 389b0003 +e2000001 80008000 +*Everyone starts with 3 stars instead of 5 in the board Snowflake Lake. + +$Board - Towering Treetop: Woody Always Sneezes [Airsola] +202c0254 0000007b +044fde9c 60000000 +044fde84 60000000 +e2000001 80008000 +*Woody always sneezes on his happening space in the board Towering Treetop. + +$Extra - 30Hz Gameplay [gamemasterplc] +042C0038 40000000 +042C003C 00000002 +040440F0 38600001 +C2005AB0 00000009 +3C808000 6084E37C +7C8903A6 4E800421 +3C808000 60845D90 +7C8903A6 4E800421 +38800000 908D8900 +908D8904 38600001 +3C808000 6084E37C +7C8903A6 4E800421 +60000000 00000000 +C2049194 00000002 +7C9F2378 7CA50E70 +60000000 00000000 +*Game runs at 30Hz but still feel like 60FPS. Great for people with bad PCs +*Can break certain minigames + +$Extra - Disable Music [gamemasterplc] 042c02a4 00000001 -*This cheat makes it so all in-game music will be turned off. -* -*This can safely be used in a Netplay game without desync. +*Disables all in-game music. -$Game Mechanics - Battle Coins Don't Affect Mini-Game Star +$Extra - Random Music [Celerizer] +C214427C 00000004 +7C7D1B78 3860006E +3C808003 6084FCD4 +7C8903A6 4E800421 +7C7D1B78 00000000 +*Music selection becomes totally random. + +$Mechanics - Always Day [Ralf] +02265b80 00000000 +*Starts an eternal day. + +$Mechanics - Always Night [Ralf] +02265b80 00004000 +*Starts an eternal night. + +$Mechanics - Battle Minigames Don't Affect Mini-Game Star [Celerizer] 204cddc8 b003001e 044cddc4 60000000 e2000001 80008000 -*This cheat makes battle minigames not count towards the Mini-Game Star. +*Battle Minigames do not count towards the Mini-Game Star. -$Game Mechanics - Free Stars +$Mechanics - Coin Star Replaces Orb Star [Rain] +204ecf4c a8c70034 +044ecf4c a8c70022 +e2000001 00000000 +204ed07c a8e30034 +044ed07c a8e30022 +e2000001 00000000 +2053109c 54686973 +0453109c 54686973 +045310a0 10697310 +045310a4 796f7572 +045310a8 106d6178 +045310ac 10636f69 +045310b0 6e731063 +045310b4 6f6c6c65 +045310b8 63746564 +045310bc 85000000 +e2000001 00000000 +*The return of the classic Coin Star. + +$Mechanics - Free Stars [gamemasterplc] 0418333C 2C030000 0418342C 2C030000 041834C4 2C030000 @@ -95,157 +683,241 @@ C2183590 00000002 044DAC30 388000FF 044DB9DC 38800000 E2000001 80008000 -*This cheat makes Stars cost nothing instead of the usual 20 coins. +*Stars cost nothing instead of the usual 20 coins. -$Game Mechanics - Increased Board Speed -041556d4 7d170e70 -042c31b4 41f00000 -041b02ac 60000000 -04161758 38030002 -04161764 38030002 -204cdb1c 281e0018 -044cdb18 3bde0002 -e2000001 80008000 -042c3e94 42200000 -*This cheat makes the players move faster while playing a Mario Party board. +$Mechanics - Last 5 Turns is x3 Coins on Spaces [gamemasterplc] +04202314 38000000 +*Last 5 Turns Event is always x3 Coins on spaces. -$Game Mechanics - Increased Coin Gain/Loss Speed -c21c28bc 00000002 -801f0020 38800002 -7c0027d6 00000000 -c21c245c 00000002 -801f0020 38800002 -7c0027d6 00000000 -*This cheat makes the coin animation appear faster then the stock animation. +$Mechanics - Last 5 Turns is 40 Coin Bonus [gamemasterplc] +04202314 38000001 +*Last 5 Turns Event is always a 40 coin bonus for last place. -$Game Mechanics - Increased Orb Throwing Speed -c21c28bc 00000002 -801f0020 38800002 -7c0027d6 00000000 -c21c245c 00000002 -801f0020 38800002 -7c0027d6 00000000 -*This cheat makes orbs appear to be thrown faster. +$Mechanics - Last 5 Turns is 5 Character Spaces [gamemasterplc] +04202314 38000002 [gamemasterplc] +*Last 5 Turns Event is always 5 extra character spaces for last place. -$Game Mechanics - Increased Taunt Capabilities -0420526c 60000000 -0420518c 60000000 -0420516c 60000000 -*This cheat makes it so you can taunt during your turn. +$Mechanics - Last 5 Turns is Bowser Revolution [gamemasterplc] +04202314 38000003 +*Last 5 Turns Event is always a Bowser Revolution. +*This makes everyones coins equal. + +$Mechanics - Pink Boo Steals 15 Coins Minimum [Airsola] +c21b3498 00000002 +3884000d 9081002c +60000000 00000000 +*Pink Boo is worth your time by stealing 15 coins minimum instead of not being capped. -$Game Mechanics - Sluggish Shroom Rolls 1-5 +$Mechanics - Same Space Duels Always Happen [Ralf] +04154348 60000000 +*Duels always happen if you are on the same space. + +$Mechanics - Same Space Duels Never Happen [Ralf] +04154348 48000048 +*Duels never happen if you are on the same space. + +$Mechanics - Sluggish Shroom Rolls 1-3 [Celerizer] +04186608 38000003 +04186b80 4bfffff8 +*Sluggish Shroom rolls 1-3 instead of a 1-10. + +$Mechanics - Sluggish Shroom Rolls 1-5 [Celerizer] 04186608 38000005 04186b80 4bfffff8 -*This cheat makes this orb a little more balanced. +*Sluggish Shroom rolls 1-5 instead of a 1-10. -$Minigame - Crate and Peril: Ability to Jump +$Minigame: Body Builder - Faster Wheel [Airsola] +202c0254 0000002d +204d4d28 3fe66666 +044d4d28 40b00000 +e2000002 80008000 +202c0254 0000002d +204d4d64 3fe66666 +044d4d64 40b00000 +e2000002 80008000 +202c0254 0000002d +204d4da0 3fe66666 +044d4da0 40b00000 +e2000002 80008000 +202c0254 0000002d +204d4ddc 3fe66666 +044d4ddc 40b00000 +e2000002 80008000 +*Harder to time the wheel in the minigame Body Builder. + +$Minigame: Crate & Peril - 3 Players can Jump [Airsola, gamemasterplc] +202c0254 00000025 0408074c 60fb0003 -*This cheat makes it so Crate and Peril is more balanced. +e2000001 80008000 +222c0254 00000025 +0408074c 7cfb3b78 +e2000001 80008000 +*The 3 Players can jump in the minigame Crate & Peril. -$Minigame - Dizzy Rotisserie: Lower Starting Time +$Minigame: Dizzy Rotisserie - Lower Starting Time [Celerizer] 204F3F84 38800708 044F3F84 388004B0 E2000001 80008000 -*This cheat makes it so Dizzy Rotisserie is more balanced. +*Lower the amount of time you can save in the minigame Dizzy Rotisserie. + +$Minigame: Dust Till Dawn - Easy Clean [gamemasterplc] +204FCC40 C01F009C +044FCC40 C01F008C +E2000001 80008000 +*Cleaning is easier in the minigame Dust Till Dawn. + +$Minigame: Insectiride - Balance Changes [Airsola] +202c0254 00000034 +204a176c c48d4000 +044a176c c49c4000 +e2000002 80008000 +202c0254 00000034 +204de52c c48d4000 +044de52c c49c4000 +e2000002 80008000 +202c0254 00000034 +204a183c 3f800000 +044a183c 3fc00000 +e2000002 80008000 +202c0254 00000034 +204d670c 40555555 +044d670c 4079999a +e2000002 80008000 +*Grasshopper takes 6 jumps to finish instead of 5. Snail extends faster. Beetle takes 17 presses to finish instead of 20. Ladybug unchanged. + +$Minigame: Mass Meteor - Quicker Finish [Airsola] +202c0254 0000003d +20538c60 3f800000 +04538c60 4400c000 +e2000002 80008000 +202c0254 0000003d +20538ce0 3f800000 +04538ce0 4400c000 +e2000002 80008000 +*The finish line will be located directly after the last set of meteors. -$Minigame - Mass Meteor: Ties are Always Ties +$Minigame: Mass Meteor - Ties are Always Ties [Celerizer] 204cf648 4082005c 044cf648 4800005c e2000001 80008000 -*This cheat makes it so Mass Meteor is more balanced. +*Mass Meteor will tie now instead of choosing a winner. -$Minigame - Mole it All: All Moles Worth 3 Points -204D57F0 A8A10008 -044D57F0 38A00003 -E2000001 80008000 -*This cheat makes it so Mole it All is more balanced. +$Minigame: Memory Lane - No Trail [Airsola] +202c0254 00000011 +204d6a0f 00000000 +044d699f 0000003f +e2000002 80008000 +*Shy Guy will no longer leave a trail durning the demo in the minigame Memory Lane. -$Minigame - Sink or Swim: Infinite Air -204CF1A4 3803FFFF -044CF1A4 38000258 -E2000001 80008000 -*This cheat makes it so Sink or Swim is more balanced. +$Minigame: Odd Card Out - Spam Prevention [Airsola] +202c0254 00000007 +204d0530 b0a30052 +044d0530 60000000 +e2000002 80008000 +*Choosing incorrectly causes you to die in the minigame Odd Card Out. + +$Minigame: Ray of Fright - Slower Laser [Airsola, Rain] +202c0254 00000026 +044d2cfc 41a00000 +e2000001 80008000 +*The laser is slower and travels less distance in the minigame Ray of Fright. + +$Minigame: Sink or Swim - Half Air Tank & Less Air Recovery [gamemasterplc] +202c0254 0000001e +204cf0b4 38030005 +044cf0b4 38030003 +044cf1a4 3803fffe +e2000002 80008000 +*The 3 players have 5 seconds of air instead of 10. They also recover 3 units of air instead of 5 while above water. + +$Minigame: Stage Fright - 25 Second Timer [Airsola] +202c0254 00000023 +204ebe52 00000708 +044ebe52 000005dc +e2000002 80008000 +*25 second timer in the minigame Stage Fright. -$Minigame - Trap Ease Artist: All Goombas Worth 1 Point +$Minigame: Trap Ease Artist - All Goombas Worth 1 Point [Celerizer] 204d3128 38000003 044d3128 38000001 e2000001 80008000 -*This cheat makes it so Trap Ease Artist is more balanced. +*Golden Goombas are gone in the minigame Trap Ease Artist. -$Minigame - Treasure Trawlers: All Scavenged Items are Regular Chests +$Minigame: Treasure Trawlers - All Scavenged Items are Regular Chests [Celerizer] 20501374 e3e100a8 c24fc478 00000003 2c030000 40810008 38600000 7c7c1b78 60000000 00000000 e2000001 80008000 -*This cheat makes it so Treasure Trawlers is more balanced. +*Removes Bombs and Golden Chests in the minigame Treasure Trawlers. -$Minigame Replacement - Replace Odd Card Out ➜ What Goes Up... +$Minigame Replacement - Crate and Peril ➜ Snow Brawl [Nora] +28265ba8 0000001f +02265ba8 00000019 +e2000001 80008000 + +$Minigame Replacement - Cash Flow ➜ Conveyor Bolt [Nora] +28265ba8 00000016 +02265ba8 0000001e +e2000001 80008000 + +$Minigame Replacement - Cashapult ➜ Jump The Gun [Nora] +28265ba8 00000029 +02265ba8 0000002a +e2000001 80008000 + +$Minigame Replacement - Insectiride ➜ Hyper Sniper [Nora] +28265ba8 0000002e +02265ba8 0000002d +e2000001 80008000 + +$Minigame Replacement - Money Belts ➜ Throw Me a Bone [Nora] +28265ba8 00000015 +02265ba8 00000031 +e2000001 80008000 + +$Minigame Replacement - Odd Card Out ➜ What Goes Up... [Nora] 28265ba8 00000001 02265ba8 00000003 e2000001 80008000 -$Minigame Replacement - Replace Pitifall ➜ Cog Jog +$Minigame Replacement - Pitifall ➜ Cog Jog [Nora] 28265ba8 00000036 02265ba8 00000017 +e2000001 8000800 + +$Minigame Replacement - Pixel Perfect ➜ Light Breeze [Nora] +28265ba8 00000023 +02265ba8 00000026 e2000001 80008000 -$Minigame Replacement - Replace Trick or Tree ➜ Boo Off the Stage +$Minigame Replacement - Ray of Fright ➜ Conveyor Bolt [Nora] +28265ba8 00000020 +02265ba8 0000001e +e2000001 80008000 + +$Minigame Replacement - Slot Trot ➜ Clean Team [Nora] +28265ba8 00000024 +02265ba8 0000002C +e2000001 80008000 + +$Minigame Replacement - Trap Ease Artist ➜ What Goes Up... [Nora] +28265ba8 00000013 +02265ba8 00000003 +e2000001 80008000 + +$Minigame Replacement - Trick or Tree ➜ Boo Off the Stage [Nora] 28265ba8 0000003d 02265ba8 0000003b e2000001 80008000 -$Minigame Replacement - Replace Tricky Tires ➜ Cannonball Fun +$Minigame Replacement - Tricky Tires ➜ Cannonball Fun [Nora] 28265ba8 00000009 02265ba8 0000000d e2000001 80008000 -$Miscellaneous - Instant Text Display -0404f51c 38000000 -*This cheat makes it so text is displayed instantly. - -$Miscellaneous - Random Music -C214427C 00000004 -7C7D1B78 3860006E -3C808003 6084FCD4 -7C8903A6 4E800421 -7C7D1B78 00000000 -*This cheat makes the music selection totally random. - -$Miscellaneous - Show Controller Port Number of Who Paused in Mini-Games -C20456D4 00000002 -807F0050 906D0000 -38600000 00000000 -C203E1FC 0000000C -3860012C 3880000A -38A0002D 38C00028 -38E000FF 90ED0004 -38ED0004 3D008000 -6108C4B0 7D0903A6 -4E800421 3860012C -3880000A 3CA08023 -38A5ABEF 80CD0000 -38C60001 C0228350 -3CE08000 60E7C354 -7CE903A6 4E800421 -57A0083C 00000000 -*This cheat will display a number on the pause screen of a minigame to see which port paused it. - -$Miscellaneous - Widescreen -040183EC 38600001 -C20A17B0 00000002 -C0A29F48 EFA22824 -60000000 00000000 -C20A152C 00000002 -C0029F48 EF620024 -60000000 00000000 -042C30F8 3FCCCCCD -C202C18C 00000002 -C01F000C C3A29F48 -EC00E824 00000000 -0414E760 C3A30000 -041932E0 388002D0 -042C14B8 3FCCCCCD -04151324 38600001 -*This cheat makes the game appear in widescreen. +$Minigame Replacement - Wrasslin' Rapids ➜ Insectiride [Nora] +28265ba8 00000013 +02265ba8 00000003 +e2000001 80008000 diff --git a/Data/Sys/GameSettings/GP7E01.ini b/Data/Sys/GameSettings/GP7E01.ini index 3a6da7096711..df94346e3fc5 100644 --- a/Data/Sys/GameSettings/GP7E01.ini +++ b/Data/Sys/GameSettings/GP7E01.ini @@ -5,109 +5,684 @@ [OnFrame] # Add memory patches to be applied every frame here. - [ActionReplay] # Add action replay cheats here. -$Infinite Mileage + +$QOL - Infinite Mileage [Datel] 02510C6A 0000C350 -$Unlock All Minigames +$QOL - Unlock All Minigames [Datel] 02291804 0005FFFF -$Unlock all Souvieners +$QOL - Unlock All Souvieners [Datel] 002922F8 000001FF 002922FD 000002FF -$Unlock All Sounds +$QOL - Unlock All Sounds [Datel] 002922FA 000001FF +$Mechanics - Orb Expansion [Airsola] +042ef588 00050505 +042ef598 0114140f +042ef5a8 0214140f +042ef5b8 03050505 +042ef5c8 04000000 +042ef5d8 050f0f0a +042ef5e8 0619140f +042ef5f8 071e1e19 +042ef608 0a0a0a05 +042ef618 0b0f0f0a +042ef628 0c0f0a0a +042ef638 0d0a0a05 +042ef648 0e0f0f0a +042ef658 0f0f0f0a +042ef668 100a0a05 +042ef678 1114140f +042ef688 140a0a05 +042ef698 150f0f0a +042ef6a8 160f0f0a +042ef6b8 170f0f0a +042ef6c8 180a0a05 +042ef6d8 1914140f +042ef6e8 1e0f0f0a +042ef6f8 1f0a0a05 +042ef708 200f0a05 +042ef718 210f0f0a +042ef728 22140f0a +042ef738 28000000 +042ef748 ff000000 +8c2f2f3c 0000007a +042ef58c 06060606 +042ef59c 03030303 +042ef5ac 0c0c0c0c +042ef5bc 00000000 +042ef5cc 00000000 +042ef5dc 0c0c0c0c +042ef5ec 00000000 +042ef5fc 00000000 +042ef60c 00000000 +042ef61c 00000000 +042ef62c 02020202 +042ef63c 00000000 +042ef64c 00000000 +042ef65c 02020202 +042ef66c 00000000 +042ef67c 02020202 +042ef68c 04040404 +042ef69c 04040404 +042ef6ac 0c0c0c0c +042ef6bc 0c0c0c0c +042ef6cc 00000000 +042ef6dc 00000000 +042ef6ec 09090909 +042ef6fc 08080808 +042ef70c 00000000 +042ef71c 09090909 +042ef72c 03030303 +042ef73c 00000000 +042ef590 0b060600 +042ef5a0 00030309 +042ef5b0 0b0c0c0a +042ef5c0 08000000 +042ef5d0 00000004 +042ef5e0 0b0c0c09 +042ef5f0 00000000 +042ef600 00000000 +042ef610 02000000 +042ef620 00000002 +042ef630 00020200 +042ef640 02000000 +042ef650 00000002 +042ef660 00020200 +042ef670 00000000 +042ef680 02020202 +042ef690 08040400 +042ef6a0 00040408 +042ef6b0 000c0c00 +042ef6c0 0b0c0c09 +042ef6d0 0b000000 +042ef6e0 0000000a +042ef6f0 09090909 +042ef700 00080800 +042ef710 00000008 +042ef720 09090909 +042ef730 00030309 +042ef740 05000000 +042ef594 0c000000 +042ef5a4 000a0000 +042ef5b4 0c0a0000 +042ef5c4 04000000 +042ef5d4 00000000 +042ef5e4 0c0a0000 +042ef5f4 00000000 +042ef604 00000000 +042ef614 01000000 +042ef624 00010000 +042ef634 01010000 +042ef644 01000000 +042ef654 00010000 +042ef664 01010000 +042ef674 00000000 +042ef684 02020000 +042ef694 08000000 +042ef6a4 00070000 +042ef6b4 06070000 +042ef6c4 0c0a0000 +042ef6d4 06000000 +042ef6e4 00050000 +042ef6f4 09070000 +042ef704 04060000 +042ef714 00070000 +042ef724 09070000 +042ef734 000a0000 +042ef744 00000000 +00000000 40000000 +8c2f2f3c 0000007b +042ef58c 06060606 +042ef59c 03030303 +042ef5ac 0c0c0c0c +042ef5bc 00000000 +042ef5cc 00000000 +042ef5dc 0c0c0c0c +042ef5ec 00000000 +042ef5fc 00000000 +042ef60c 00000000 +042ef61c 00000000 +042ef62c 05050505 +042ef63c 00000000 +042ef64c 00000000 +042ef65c 05050505 +042ef66c 00000000 +042ef67c 06060606 +042ef68c 03030303 +042ef69c 03030303 +042ef6ac 0c0c0c0c +042ef6bc 0c0c0c0c +042ef6cc 00000000 +042ef6dc 00000000 +042ef6ec 06060606 +042ef6fc 06060606 +042ef70c 00000000 +042ef71c 06060606 +042ef72c 03030303 +042ef73c 00000000 +042ef590 0b060600 +042ef5a0 0003030a +042ef5b0 0b0c0c0a +042ef5c0 06000000 +042ef5d0 00000000 +042ef5e0 0b0c0c0a +042ef5f0 00000000 +042ef600 00000000 +042ef610 05000000 +042ef620 00000005 +042ef630 00050500 +042ef640 06000000 +042ef650 00000005 +042ef660 00050500 +042ef670 00000000 +042ef680 06060606 +042ef690 05030300 +042ef6a0 00030306 +042ef6b0 000c0c00 +042ef6c0 0b0c0c0a +042ef6d0 0b000000 +042ef6e0 0000000a +042ef6f0 06060606 +042ef700 00060600 +042ef710 00000006 +042ef720 06060606 +042ef730 0003030a +042ef740 05000000 +042ef594 0c000000 +042ef5a4 000a0000 +042ef5b4 0c0a0000 +042ef5c4 03000000 +042ef5d4 00000000 +042ef5e4 0c0a0000 +042ef5f4 00000000 +042ef604 00000000 +042ef614 02000000 +042ef624 00020000 +042ef634 02020000 +042ef644 03000000 +042ef654 00020000 +042ef664 03020000 +042ef674 00000000 +042ef684 06050000 +042ef694 06000000 +042ef6a4 00050000 +042ef6b4 06050000 +042ef6c4 0c0a0000 +042ef6d4 06000000 +042ef6e4 00050000 +042ef6f4 06060000 +042ef704 03050000 +042ef714 00050000 +042ef724 06060000 +042ef734 000a0000 +042ef744 00000000 +00000000 40000000 +8c2f2f3c 0000007c +042ef58c 06060606 +042ef59c 03030303 +042ef5ac 0c0c0c0c +042ef5bc 00000000 +042ef5cc 00000000 +042ef5dc 0c0c0c0c +042ef5ec 05050505 +042ef5fc 00000000 +042ef60c 00000000 +042ef61c 00000000 +042ef62c 05050505 +042ef63c 00000000 +042ef64c 00000000 +042ef65c 05050505 +042ef66c 00000000 +042ef67c 05050505 +042ef68c 02020202 +042ef69c 02020202 +042ef6ac 0c0c0c0c +042ef6bc 0c0c0c0c +042ef6cc 00000000 +042ef6dc 00000000 +042ef6ec 06060606 +042ef6fc 05050505 +042ef70c 00000000 +042ef71c 05050505 +042ef72c 03030303 +042ef73c 00000000 +042ef590 0b060600 +042ef5a0 0003030a +042ef5b0 0b0c0c0a +042ef5c0 05000000 +042ef5d0 00000000 +042ef5e0 0b0c0c0a +042ef5f0 05050505 +042ef600 00000000 +042ef610 05000000 +042ef620 00000005 +042ef630 00050500 +042ef640 05000000 +042ef650 00000005 +042ef660 00050500 +042ef670 00000000 +042ef680 05050505 +042ef690 05020200 +042ef6a0 00020205 +042ef6b0 000c0c00 +042ef6c0 0b0c0c0a +042ef6d0 0b000000 +042ef6e0 0000000a +042ef6f0 05060605 +042ef700 00050500 +042ef710 00000005 +042ef720 05050505 +042ef730 0003030a +042ef740 05000000 +042ef594 0c000000 +042ef5a4 000a0000 +042ef5b4 0c0a0000 +042ef5c4 02000000 +042ef5d4 00000000 +042ef5e4 0c0a0000 +042ef5f4 05050000 +042ef604 00000000 +042ef614 02000000 +042ef624 00020000 +042ef634 02020000 +042ef644 02000000 +042ef654 00020000 +042ef664 02020000 +042ef674 00000000 +042ef684 05040000 +042ef694 06000000 +042ef6a4 00050000 +042ef6b4 06050000 +042ef6c4 0c0a0000 +042ef6d4 06000000 +042ef6e4 00050000 +042ef6f4 06050000 +042ef704 02040000 +042ef714 00040000 +042ef724 06050000 +042ef734 000a0000 +042ef744 00000000 +00000000 40000000 +8c2f2f3c 0000007d +042ef58c 06060606 +042ef59c 03030303 +042ef5ac 0c0c0c0c +042ef5bc 00000000 +042ef5cc 00000000 +042ef5dc 0c0c0c0c +042ef5ec 00000000 +042ef5fc 00000000 +042ef60c 00000000 +042ef61c 00000000 +042ef62c 02020202 +042ef63c 00000000 +042ef64c 00000000 +042ef65c 02020202 +042ef66c 00000000 +042ef67c 02020202 +042ef68c 04040404 +042ef69c 04040404 +042ef6ac 0c0c0c0c +042ef6bc 0c0c0c0c +042ef6cc 00000000 +042ef6dc 00000000 +042ef6ec 09090909 +042ef6fc 08080808 +042ef70c 00000000 +042ef71c 09090909 +042ef72c 03030303 +042ef73c 00000000 +042ef590 0b060600 +042ef5a0 0003030a +042ef5b0 0b0c0c0a +042ef5c0 08000000 +042ef5d0 00000000 +042ef5e0 0b0c0c0a +042ef5f0 00000000 +042ef600 00000007 +042ef610 02000000 +042ef620 00000002 +042ef630 00020200 +042ef640 02000000 +042ef650 00000002 +042ef660 00020200 +042ef670 00000000 +042ef680 02020202 +042ef690 08040400 +042ef6a0 00040407 +042ef6b0 000c0c00 +042ef6c0 0b0c0c0a +042ef6d0 0b000000 +042ef6e0 0000000a +042ef6f0 09090907 +042ef700 00080800 +042ef710 00000006 +042ef720 09090907 +042ef730 0003030a +042ef740 05000000 +042ef594 0c000000 +042ef5a4 000a0000 +042ef5b4 0c0a0000 +042ef5c4 04000000 +042ef5d4 00000000 +042ef5e4 0c0a0000 +042ef5f4 00000000 +042ef604 06060000 +042ef614 01000000 +042ef624 00010000 +042ef634 01010000 +042ef644 01000000 +042ef654 00010000 +042ef664 01010000 +042ef674 00000000 +042ef684 02020000 +042ef694 06000000 +042ef6a4 00050000 +042ef6b4 06050000 +042ef6c4 0c0a0000 +042ef6d4 06000000 +042ef6e4 00050000 +042ef6f4 07060000 +042ef704 04050000 +042ef714 00060000 +042ef724 07060000 +042ef734 000a0000 +042ef744 00000000 +00000000 40000000 +8c2f2f3c 0000007e +042ef58c 04040404 +042ef59c 02020202 +042ef5ac 0a0a0a0a +042ef5bc 00000000 +042ef5cc 00000000 +042ef5dc 0a0a0a0a +042ef5ec 00000000 +042ef5fc 00000000 +042ef60c 00000000 +042ef61c 00000000 +042ef62c 03030303 +042ef63c 00000000 +042ef64c 00000000 +042ef65c 07070707 +042ef66c 03030303 +042ef67c 00000000 +042ef68c 05050505 +042ef69c 05050505 +042ef6ac 09090909 +042ef6bc 0a0a0a0a +042ef6cc 00000000 +042ef6dc 00000000 +042ef6ec 0a0a0a0a +042ef6fc 0a0a0a0a +042ef70c 00000000 +042ef71c 0a0a0a0a +042ef72c 02020202 +042ef73c 00000000 +042ef590 08040400 +042ef5a0 00020207 +042ef5b0 090a0a08 +042ef5c0 0a000000 +042ef5d0 00000000 +042ef5e0 080a0a07 +042ef5f0 00000000 +042ef600 00000000 +042ef610 04000000 +042ef620 00000004 +042ef630 00030300 +042ef640 03000000 +042ef650 00000003 +042ef660 00070700 +042ef670 04030304 +042ef680 00000000 +042ef690 0b050500 +042ef6a0 0005050b +042ef6b0 00090900 +042ef6c0 080a0a07 +042ef6d0 08000000 +042ef6e0 00000007 +042ef6f0 0b0a0a0c +042ef700 000a0a00 +042ef710 0000000b +042ef720 0b0a0a0c +042ef730 00020207 +042ef740 05000000 +042ef594 09000000 +042ef5a4 00070000 +042ef5b4 09080000 +042ef5c4 0c000000 +042ef5d4 00000000 +042ef5e4 09070000 +042ef5f4 00000000 +042ef604 00000000 +042ef614 01000000 +042ef624 00010000 +042ef634 01010000 +042ef644 01000000 +042ef654 00010000 +042ef664 01010000 +042ef674 03030000 +042ef684 00000000 +042ef694 09000000 +042ef6a4 00090000 +042ef6b4 04030000 +042ef6c4 08080000 +042ef6d4 04000000 +042ef6e4 00030000 +042ef6f4 0a0a0000 +042ef704 09090000 +042ef714 000c0000 +042ef724 0a0a0000 +042ef734 00070000 +042ef744 00000000 +00000000 40000000 +8c2f2f3c 0000007f +042ef58c 06060606 +042ef59c 03030303 +042ef5ac 0c0c0c0c +042ef5bc 00000000 +042ef5cc 00000000 +042ef5dc 0c0c0c0c +042ef5ec 00000000 +042ef5fc 00000000 +042ef60c 00000000 +042ef61c 00000000 +042ef62c 02020202 +042ef63c 00000000 +042ef64c 00000000 +042ef65c 02020202 +042ef66c 00000000 +042ef67c 02020202 +042ef68c 04040404 +042ef69c 04040404 +042ef6ac 0c0c0c0c +042ef6bc 0c0c0c0c +042ef6cc 00000000 +042ef6dc 00000000 +042ef6ec 09090909 +042ef6fc 08080808 +042ef70c 00000000 +042ef71c 09090909 +042ef72c 03030303 +042ef73c 00000000 +042ef590 0b060600 +042ef5a0 00030309 +042ef5b0 0b0c0c0a +042ef5c0 08000000 +042ef5d0 00000004 +042ef5e0 0b0c0c09 +042ef5f0 00000000 +042ef600 00000000 +042ef610 02000000 +042ef620 00000002 +042ef630 00020200 +042ef640 02000000 +042ef650 00000002 +042ef660 00020200 +042ef670 00000000 +042ef680 02020202 +042ef690 08040400 +042ef6a0 00040408 +042ef6b0 000c0c00 +042ef6c0 0b0c0c09 +042ef6d0 0b000000 +042ef6e0 0000000a +042ef6f0 09090909 +042ef700 00080800 +042ef710 00000008 +042ef720 09090909 +042ef730 00030309 +042ef740 05000000 +042ef594 0c000000 +042ef5a4 000a0000 +042ef5b4 0c0a0000 +042ef5c4 04000000 +042ef5d4 00000000 +042ef5e4 0c0a0000 +042ef5f4 00000000 +042ef604 00000000 +042ef614 01000000 +042ef624 00010000 +042ef634 01010000 +042ef644 01000000 +042ef654 00010000 +042ef664 01010000 +042ef674 00000000 +042ef684 02020000 +042ef694 08000000 +042ef6a4 00070000 +042ef6b4 06070000 +042ef6c4 0c0a0000 +042ef6d4 06000000 +042ef6e4 00050000 +042ef6f4 09070000 +042ef704 04060000 +042ef714 00070000 +042ef724 09070000 +042ef734 000a0000 +042ef744 00000000 +00000000 40000000 +*Use with the Allow All Character Orbs cheat below. +*(Almost) all Orbs become obtainable on each board. Orb prices are rebalanced. CPUs cannot use character orbs that are not their own. Triple Shroom is removed, as this code is meant to be used in conjunction with the Orb balancing codes. + [Gecko] -$Netplay Community Settings -041604B0 38C0000A -204E317C 281E000C -044E2F08 3BDE0002 -044E3178 3BDE0002 -044E31EC 3BDE0002 -044E344C 3BDE0002 -044E3844 3BDE0002 -E2000001 80008000 -041E3110 38030002 +# Add gecko cheats here. +$QOL - Auto Advance Text Boxes [gamemasterplc] +04050ddc 60000000 +*Automatically scrolls the text boxes without pushing A + +$QOL - Faster Boot Time [gamemasterplc] +204dd974 2c030000 +044dd978 60000000 +e2000001 80008000 +204e17d0 41820014 +044e17d0 60000000 +e2000001 80008000 +204dffcc 41820014 +044dffcc 60000000 +e2000001 80008000 +204df868 3bde0001 +044df868 3bc00db6 +e2000001 80008000 +204e879c 41820014 +044e879c 60000000 +e2000001 80008000 +*Automatically advance through the initial cutscences. + +$QOL - Increased Board Speed [gamemasterplc] +04160ad8 38030002 +041604b0 38c0000a +204e317c 281e000c +044e2f08 3bde0002 +044e3178 3bde0002 +044e31ec 3bde0002 +044e344c 3bde0002 +044e3844 3bde0002 +e2000001 80008000 +*Board animations happen faster. + +$QOL - Increased Orb Throwing Speed [gamemasterplc] +041e3110 38030002 +*Throw orbs faster. + +$QOL - Increased Taunt Capabilities [gamemasterplc] 04235abc 60000000 04235b0c 60000000 04235b90 60000000 -04050A70 38800000 -C2047400 00000002 -807F0050 906D0000 +*Taunt during your turn. +*Also removes the cap on how fast you can taunt. + +$QOL - Instant Text Display [gamemasterplc] +04050a70 38800000 +*Text is displayed instantly. + +$QOL - Show Controller Port Number of Who Paused in Mini-Games [gamemasterplc] +c2047400 00000002 +807f0050 906d0000 38600000 00000000 -C20402FC 0000000C -3860012C 3880000A -38A0002D 38C00028 -38E000FF 90ED0004 -38ED0004 3D008000 -6108CA28 7D0903A6 -4E800421 3860012C -3880000A 3CA08025 -38A548EF 80CD0000 -38C60001 C0228388 -3CE08000 60E7C8CC -7CE903A6 4E800421 -57A0083C 00000000 -204E8A28 3CC08050 -C24E8A34 00000002 -38A00002 98A40000 -88A40000 00000000 -E2000001 80008000 +c20402fc 0000000c +3860012c 3880000a +38a0002d 38c00028 +38e000ff 90ed0004 +38ed0004 3d008000 +6108ca28 7d0903a6 +4e800421 3860012c +3880000a 3ca08025 +38a548ef 80cd0000 +38c60001 c0228388 +3ce08000 60e7c8cc +7ce903a6 4e800421 +57a0083c 00000000 +*Check which player is pausing during minigames. + +$QOL - Unlock Everything [gamemasterplc] +0403EDC0 38600001 +82200001 802922F8 +86200001 00000006 +84200001 802922F8 +82200001 802922F8 +86200001 00000008 +84200001 802922F8 +82200001 802922F8 +86200001 00000040 +84200001 802922F8 +82200001 802922FC +86200001 00040000 +84200001 802922FC 204E1B7C 3C608051 044E1B88 38600001 044E1B8C 98640002 044E1B90 60000000 E2000001 80008000 -82200001 802922FC -86200001 00040000 -84200001 802922FC 204F6C64 4182001C 044F6C64 60000000 044E9AFC 60000000 E2000001 80008000 -204F0BC4 2C030000 -044F0BC0 38600001 -044F0C4C 38600001 -044F0CD8 38600001 -044F0CFC 38600001 -044F0D18 38600001 +204E8A28 3CC08050 +C24E8A34 00000002 +38A00002 98A40000 +88A40000 00000000 E2000001 80008000 -82200001 802922F8 -86200001 00000040 -84200001 802922F8 -82200001 802922F8 -86200001 00000008 -84200001 802922F8 -82200001 802922F8 -86200001 00000006 -84200001 802922F8 -0403EDC0 38600001 -*WARNING: This set of cheats is meant for Netplay only. This can 100% your save so make sure you make backups. -*This Cheat includes -*Game Mechanics - Increased Board Speed -*Game Mechanics - Increased Orb Throwing Speed -*Game Mechanics - Increased Taunt Capabilities -*Miscellaneous - Instant Text Display -*Miscellaneous - Show Controller Port Number of Who Paused in Mini-Games -*as well as some cheats to 100% the game. We wont tell you which ones they are because that ruins the fun of playing. - -$Netplay Force Player 1 to CPU -0422d898 60000000 -04053a50 60000000 -*This cheat makes it so the player on port 1 will be turned into a computer. This can be useful for games when the player with port 1 drops. - -$Netplay Safe Kill Music -0414AAF0 4E800020 -*This cheat makes it so all in-game music will be turned off. -* -*This can safely be used in a Netplay game without desync. - -$Board - Neon Heights: Balance Changes -204e0f0c 7c9e2378 +*Unlocks everything in the game. +*Permanent once saved! + +$Board - Neon Heights: Balance Changes [gamemasterplc] +202f2f3c 0000007d +c24ec2b0 00000003 +a87e02e8 2803000f +41a20008 38600000 +60000000 00000000 +c24ec414 00000004 +7c9e82ae 2804000f +41a2000c 38800000 +48000008 3880000a +60000000 00000000 +044e0574 38000014 044e0bac 38a00014 044e08d8 38000014 044e06c4 38000014 @@ -116,38 +691,190 @@ $Board - Neon Heights: Balance Changes 044e2564 3b200014 044e269c 3b000014 e2000001 80008000 -*This cheat makes the chests now cost 20 coins, and Bob-omb/nothing chests now contain 20 coins. +202f2f3c 0000007d +28527bfa 00000256 +04527c78 4039999a +e2000002 80008000 +*All chests cost 20 coins, and the non-star chests both contain 20 coins. The shooting board event now awards 10 coins, but only if the player hits all the targets. It is now possible for 1 player to reach the star in the rocket happening event in the board Neon Heights. -$Board - Neon Heights: Bowser Path for Free -204FDEF4 2C03000A -044FDEF4 2C030000 -044FDF5C 38A00000 -E2000001 80008000 -*This cheat makes that path Koopa Kid is blocking not cost any coins to traverse. +$Board - Neon Heights: Bowser Path for Free [gamemasterplc] +204fdef4 2c03000a +044fdef4 2c030000 +044fdf5c 38a00000 +e2000001 80008000 +*Use Koopa Kid's path for free instead of paying 10 coins in the board Neon Heights. -$Board - Pagoda Peak: Bottle Rocket Launch Always Succeeds -204DF8A0 2803004B -044DF8A4 60000000 -E2000001 80008000 -*This cheat makes the Pagoda Peak bottle rocket always go towards the top. - -$Board - Pyramid Park: Free Chomp Rides -204E10B4 7C03D000 -044E10B0 386003E7 -044E1114 386003E7 -044E14EC 386003E7 -044E17A4 38A00000 -E2000001 80008000 -*This cheat makes the Pyramid Park Chain Chomps free. +$Board - Pagoda Peak: Bottle Rocket Launch Always Succeeds [gamemasterplc] +204df8a0 2803004b +044df8a4 60000000 +e2000001 80008000 +*Bottle Rockets always go towards the top in the board Pagoda Peak. -$Board - Windmillville: Free Flower Glider -204E1F00 7C600734 -044E1EFC 386003E7 -044E7D10 38A00000 -E2000001 80008000 -*This cheat makes the Windmillville flower glider free. +$Board - Pyramid Park: Chomps Sell Stars, Players Start with 0 Stars +204ddf34 4180ffb8 +044ddee0 48000058 +c24e0f2c 00000032 +9421ffe0 7c0802a6 +90010024 93e10008 +93c1000c 93a10018 +93810014 3b800014 +2c050000 41820008 +3b800028 7c7f1b78 +3fc08016 63de6bbc +7fc903a6 4e800421 +7c03e000 41800124 +1c7f0110 3c808029 +7c632214 88630c98 +70630020 40820090 +38610010 388d8724 +7f85e378 3fc0800f +63de8fdc 7fc903a6 +4e800421 38600002 +3c80000c 38840001 +38a00000 38c00000 +3fc08016 63def030 +7fc903a6 4e800421 +7c7d1b78 38810010 +38a00000 3fc08016 +63defe20 7fc903a6 +4e800421 7fa3eb78 +3fc08016 63deffe8 +7fc903a6 4e800421 +7fa3eb78 3fc08016 +63defd90 7fc903a6 +4e800421 2c030000 +40820080 38600000 +7fe4fb78 7cbc00d0 +38c0ffff 38e00001 +39000001 39200000 +39400001 3fc08018 +63de3f28 7fc903a6 +4e800421 7fe3fb78 +38800000 38a00001 +38c00001 38e00000 +3fc08018 63de61e8 +7fc903a6 4e800421 +7fe3fb78 3fc08018 +63de7ad0 7fc903a6 +4e800421 3860000d +3fc08017 63de2304 +7fc903a6 4e800421 +83810014 83a10018 +83c1000c 83e10008 +80010024 7c0803a6 +38210020 4e800020 +60000000 00000000 +e2000001 80008000 +*Chain Chomps sell stars instead of stealing stars in the board Pyramid Park. + +$Board - Pyramid Park: Free Chomp Rides [gamemasterplc] +204e10b4 7c03d000 +044e10b0 386003e7 +044e1114 386003e7 +044e14ec 386003e7 +044e17a4 38a00000 +e2000001 80008000 +*Chain Chomps are free in the board Pyramid Park. + +$Board - Pyramid Park: Start with 3 Stars [Airsola] +204ddf18 7fc4f378 +044ddf18 38800003 +e2000001 80008000 +*Start with 3 stars instead of 5 in the board Pyramid Park. + +$Board - Windmillville: Free Flower Glider [gamemasterplc] +204e1f00 7c600734 +044e1efc 386003e7 +044e7d10 38a00000 +e2000001 80008000 +*Flower Glider becomes free in the board Windmillville. + +$Extra - 30Hz Gameplay [gamemasterplc] +042f2cf8 40000000 +042f2cfc 00000002 +04045e20 38600001 +c2005ab0 00000009 +3c808000 6084e8f4 +7c8903a6 4e800421 +3c808000 60845d90 +7c8903a6 4e800421 +38800000 908d8ac0 +908d8ac4 38600001 +3c808000 6084e8f4 +7c8903a6 4e800421 +60000000 00000000 +c204a98c 00000002 +7c9f2378 7ca50e70 +60000000 00000000 +*Game runs at 30Hz but still feel like 60FPS. Great for people with bad PCs +*Can break certain minigames + +$Extra - Disables Music [Ralf] +0414aaf0 4e800020 +*Disables all in-game music. + +$Mechanics - Orb Star Becomes Coin Star [Airsola] +204e4ae0 48000210 +044e4a38 48000014 +044e4a6c 38000000 +e2000001 80008000 +204e16b0 a8ca003c +044e16b0 a8ca002c +e2000001 80008000 +204e18d4 a8c3003c +044e18d4 a8c3002c +e2000001 80008000 +*The return of the classic Coin Star. +*Incompatible with Fixed Bonus Star because it implements it. + +$Mechanics - Able To Hold 5 Orbs [Ralf] +041675b8 38600005 +04167604 3ba00005 +04167730 38800005 +041678e0 38e00005 +041679bc 3be00005 +04167b80 38e00005 +04167ca8 39600005 +041935fc 48000034 +*Hold up to 5 orbs instead of 3. + +$Mechanics - All Orbs Last Turn [Airsola] +04272098 01010101 +04169074 38a00002 +02272096 00000102 + +$Mechanics - Allow All Character Orbs [Ralf] +041ee17c 38600000 +041ee23c 48000014 +041f5f98 8803001b +041f5f9c 2c00001f +041f5fa4 60000000 +041f5fa8 2c000020 +041f5fb0 4800004c +041f60c4 8803001b +041f60c8 2c00001f +041f60d0 60000000 +041f60d4 2c000020 +041f60dc 48000064 +041f6230 8803001b +041f6234 2c00001f +041f623c 60000000 +041f6240 2c000020 +041f6248 48000050 +061ED118 0000002C +2C19001E 4180002C +2C190023 41810024 +7C6C42E6 68638408 +70630007 28030005 +4181FFF0 3863001E +60000000 00000000 +*Allows everyone to use all character orbs. + +$Mechanics - Always Bowser Time [Ralf] +00291524 00000038 +*WARNING! This can make the game last an extra hour -$Game Mechanics - Battle Coins Don't Affect Mini-Game Star +$Mechanics - Battle Minigames Do not Affect Mini-Game Star [gamemasterplc] 204e628c 7c080734 c24e6288 00000006 3d008029 a9081558 @@ -157,280 +884,248 @@ c24e6288 00000006 40820008 38a00000 7c051a14 00000000 e2000001 80008000 -*This cheat makes battle minigames not count towards the Mini-Game Star. +*Battle Minigames do not count towards the Mini-Game Star. -$Game Mechanics - DK and Bowser Give Only Multiplayer Games -041d19a0 3b600004 -041d5058 3b200005 -*This cheat makes it so DK and Bowser only give multiplayer minigames which are inclusive and not stupidly broken. +$Mechanics - Disable Bowser Time [gamemasterplc] +c2152080 00000002 +38000000 9803000c +60000000 00000000 +*Bowser Time game event does not appear. This can save 5-20 minutes of Board Events on boards such as Grand Canal, but break boards such as Bowser's Enchanted Inferno. -$Game Mechanics - Disable Character Orbs +$Mechanics - Disable Character Orbs [gamemasterplc] 042f12e8 00000000 042f12a8 00000000 042f12c8 00000000 042f1308 00000000 042f1328 00000000 042f1348 00000000 -*This cheat makes it so character orbs (the blue ones) don't appear. +*Stops Character Orbs (the blue ones) from appearing. -$Game Mechanics - Disable Mic Spaces +$Mechanics - Disable Mic Spaces [gamemasterplc] 0417afd0 60000000 -*This cheat makes Mic Spaces act like the Green Spaces from Mario Party 9. This means that they do nothing. This does however save time with the Disable Microphone cheat on, so the transition screen doesn't appear. +*Disables Microphone Minigame Spaces. -$Game Mechanics - Disable Bowser Time -C2152080 00000002 -38000000 9803000C -60000000 00000000 -*This cheat makes it so the Bowser Time game event doesn't appear. This can save 5-20 minutes of Board Events on boards such as Grand Canal, but break boards such as Bowser's Enchanted Inferno. +$Mechanics - Disable Shops [gamemasterplc] +04215688 480018C4 +*Disables Orb Shops -$Game Mechanics - Force Mini-Game/Orb/Happening Bonus Stars +$Mechanics - DK and Bowser Give Only Multiplayer Games [gamemasterplc] +041d19a0 3b600004 +041d5058 3b200005 +*DK and Bowser only give multiplayer minigames which are inclusive and not stupidly broken. + +$Mechanics - Force Mini-Game/Orb/Happening Bonus Stars [gamemasterplc] 204e4ae0 48000210 044e4a38 48000014 044e4a6c 38000000 e2000001 80008000 -*This cheat makes the Bonus Stars always the same. +*Bonus Stars are always the same. -$Game Mechanics - Free Stars -04188774 3B800000 -0418876C 3B800000 -204ED598 40800030 -044ED598 48000030 -044ED754 38800000 -E2000001 80008000 -204F62C0 38030001 -044F62C4 38000000 -044F690C 38600000 -E2000001 80008000 -*This cheat makes Stars cost nothing instead of the usual 20 coins. - -$Game Mechanics - Koopa Kid Orbs Can Be Purchased -0419EB0C 48000024 -04274ADC 00000001 -06004860 0000002C -88030000 28000028 -4082001C 3C80802E -6084F598 38A00010 -4BFFECC9 38000028 -98030000 3B9C0001 -481E5098 00000000 -041E991C 4BE1AF44 -*This cheat makes Koopa Kid Orbs findable in stores as well as the Orb spawn spots on the board. - -$Game Mechanics - Increased Board Speed -041604B0 38C0000A -204E317C 281E000C -044E2F08 3BDE0002 -044E3178 3BDE0002 -044E31EC 3BDE0002 -044E344C 3BDE0002 -044E3844 3BDE0002 -E2000001 80008000 -*This cheat makes the players move faster while playing a Mario Party board. +$Mechanics - Flower Orb Gives 1 Coin Per Space [Airsola] +041c4f24 3b400001 +*The Flower Orb gives 1 coin per space instead of 3. -$Game Mechanics - Increased Orb Throwing Speed -041E3110 38030002 -*This cheat makes orbs appear to be thrown faster. +$Mechanics - Fireball Orb Steals 20 Coins [Airsola] +041c148c 38a0ffec +041c1464 3b800014 +*The Fireball Orb steals 20 coins instead of 10 when passing a player. -$Game Mechanics - Increased Taunt Capabilities -04235abc 60000000 -04235b0c 60000000 -04235b90 60000000 -*This cheat makes it so you can taunt during your turn. +$Mechanics - Free Stars [gamemasterplc] +04188774 3b800000 +0418876c 3b800000 +204ed598 40800030 +044ed598 48000030 +044ed754 38800000 +e2000001 80008000 +204f62c0 38030001 +044f62c4 38000000 +044f690c 38600000 +e2000001 80008000 +*Stars cost nothing instead of the usual 20 coins. + +$Mechanics - Hammer Bro Orb Steals 20 Coins [Ralf] +041A902C 3AC00014 +041A9A28 38A0FFEC +*Hammer Bro steals 20 coins instead of 10 when landing on his space. + +$Mechanics - Happening Star Becomes Star Star [Airsola] +204e4ae0 48000210 +044e4a38 48000014 +044e4a6c 38000000 +e2000001 80008000 +204e16ec 8903001f +044e16ec 8903003b +e2000001 80008000 +204e1a0c 8903001f +044e1a0c 8903003b +e2000001 80008000 +*The Happening Star will become a bonus star awarded to the player who held the highest amount of stars at any point of the game. Recommended only for Windmillville, or Pyramid Park. +*Incompatible with Fixed Bonus Star because it implements it. + +$Mechanics - Improved Duel Results [Airsola] +c21d8ed0 00000007 +2c030001 4082000c +38600000 48000020 +2c030005 4082000c +38600004 48000010 +2c030003 40820008 +38600000 7c711b78 +60000000 00000000 +041d8f68 3aa00028 +*(X) -> 40 Coins, 10 Coins -> 40 Coins, Half Coins -> 40 Coins, 2 Stars -> 1 Star + +$Mechanics - Last 5 Turns Event Is Always x3 Coins on Spaces +042311A8 38000000 + +$Mechanics - Last 5 Turns Event Is Always 10 More Koopa Kid Spaces +042311A8 38000001 + +$Mechanics - Last 5 Turns Event Is Always 40 Coin Bonus +042311A8 38000002 + +$Mechanics - Last 5 Turns Event Is Always Stars are 10 Coins +042311A8 38000003 -$Game Mechanics - Mic Minigames Have A 10% Chance Of Appearing Instead Of 20% -042F7A04 41200000 -*This cheat makes it so you see less Mic Minigames and see more standard minigames. +$Mechanics - Last 5 Turns Event Is Always Red Spaces are Bowser Spaces +042311A8 38000004 -$Game Mechanics - Microphone Always Off +$Mechanics - Last 5 Turns Event Is Always Chain Chomp Ride for 5 Coins (Pyramid Park) +042311A8 38000005 +*Only use on Pyramid Park + +$Mechanics - Mic Minigames Have A 10% Chance Of Appearing Instead Of 20% [gamemasterplc] +042f7a04 41200000 +*Less Mic Minigames and see more standard minigames. + +$Mechanics - Microphone Always Off [gamemasterplc] 04098fc4 3800002c 04098fc8 980317e6 04098fcc 38600000 -*This cheat makes the microphone game setting stay off while playing Mario Party 7. - -$Game Mechanics - Orbs Can Only Be Placed On Your Current Space -041E7128 60000000 -*This cheat makes it so Orbs are most balanced. To be fair a human cannot throw that far. +*Microphone game setting stays off while playing Mario Party 7. -$Game Mechanics - Replace "Nothing" Duel Result With "Half Coins" -c21d8ed0 00000003 -2c030003 40820008 -38600001 7c711b78 -60000000 00000000 -*This cheat makes it so duels don't end in a dud. +$Mechanics - Orbs Can Only Be Placed On Your Current Space [gamemasterplc] +041e7128 60000000 +*Orb is more aggressively balanced. -$Game Mechanics - Slow 'Shroom Orb Rolls 1-5 +$Mechanics - Slow Shroom Orb Rolls 1-5 [gamemasterplc] 0418ccc8 38000005 0418d1ac 40820020 -*This cheat makes this orb a little more balanced. - -$Miscellaneous - Replace Daisy with Koopa Kid -057FAFE4 4BEBD7A8 -057FAFE8 001BB312 -057FAFF0 4C191720 -057FAFF4 00039C5A -057FAFFC 4C1CB37C -057FB000 0001D5AE -057FB008 4C1E892C -057FB00C 0001BCD2 -057FB014 4C204600 -057FB018 00012E20 -057FB020 4C217420 -057FB024 0000D456 -057FB02C 4C224878 -057FB030 00052266 -*This cheat safely swaps Daisy's Model with Koopa Kid's. This cheat makes Koopa Kid a playable character. - -$Miscellaneous - Instant Text Display -04050A70 38800000 -*This cheat makes it so text is displayed instantly. - -$Miscellaneous - Show Controller Port Number of Who Paused in Mini-Games -C2047400 00000002 -807F0050 906D0000 -38600000 00000000 -C20402FC 0000000C -3860012C 3880000A -38A0002D 38C00028 -38E000FF 90ED0004 -38ED0004 3D008000 -6108CA28 7D0903A6 -4E800421 3860012C -3880000A 3CA08025 -38A548EF 80CD0000 -38C60001 C0228388 -3CE08000 60E7C8CC -7CE903A6 4E800421 -57A0083C 00000000 -*This cheat will display a number on the pause screen of a minigame to see which port paused it. - -$Miscellaneous - Widescreen -200018A8 9421FF58 -C60A07E0 800018A8 -E2000001 80008000 -200010A8 9421FF58 -C60A07E0 800010A8 -E2000001 80008000 -041555C4 C3A30000 -041794DC 60000000 -040189C4 38600001 -C20A7948 00000003 -93E10024 3FE03FAB -93E30000 C0A30000 -EFA50772 00000000 -C20A76C0 00000003 -3FE03FAB 93E30000 -C0030000 EF6000B2 -60000000 00000000 -042F3E30 44555555 -042F3ED0 44400000 -0404EF48 C0828110 -04177F94 C0828110 -C20BD108 00000004 -A8830000 2C043B2A -4082000C 3C80BF40 -9083000C C003000C -60000000 00000000 -204DFA10 38800100 -C24DF9F8 00000006 -3C803FAB 9081FFFC -C021FFFC C04280C0 -3C808001 608409A0 -7C8903A6 4E800421 -3C804295 9081FFFC -C021FFFC 00000000 -E2000001 80008000 -204E5ABC 3800FFFF -C24E5A9C 00000002 -3C803F2B 9081FFFC -C021FFFC 00000000 -044E7318 C1955555 -E2000001 80008000 -204DF4D8 38040040 -C24DF4B0 00000005 -EC200828 3CA03FAB -90A100B4 C04100B4 -EC220072 3CA0C2C0 -90A100B4 C04100B4 -EC22082A 00000000 -C24DF510 00000002 -3C803F99 9081FFFC -C021FFFC 00000000 -E2000001 80008000 -204E7360 43300000 -C24DE590 00000006 -3C803FAB 9081FFFC -C021FFFC C04280C0 -3C808001 608409A0 -7C8903A6 4E800421 -3C80C2D0 9081FFFC -C021FFFC 00000000 -044E735C C1180000 -C24E1F20 00000003 -3C60C2C0 9061000C -C021000C EC3D082A -D3A10008 00000000 -044E73F0 41000000 -C24E1E0C 00000003 -3C60C2C0 9061000C -C021000C EC3F082A -D3E10008 00000000 -E2000001 80008000 -C204DFFC 00000008 -3C80804D 6084E634 -80A10064 7C042800 -40820024 3C803FAB -9081FFFC C021FFFC -C04280C0 3C808001 -608409A0 7C8903A6 -4E800421 C03F0078 -60000000 00000000 -0401187C 60000000 -C21949C0 00000005 -C03F0014 3C803FAB -9081FFFC C041FFFC -EC220072 3C80C2C0 -9081FFFC C041FFFC -EC22082A 00000000 -C21937C8 00000005 -C0210008 3C803FAB -9081FFFC C041FFFC -EC220072 3C80C2C0 -9081FFFC C041FFFC -EC22082A 00000000 -C2194320 00000005 -C03F0014 3C803FAB -9081FFFC C041FFFC -EC220072 3C80C2C0 -9081FFFC C041FFFC -EC22082A 00000000 -204EA934 FC20F890 -C24EA924 00000005 -C3FF0004 3C803FAB -9081FFFC C041FFFC -EFE207F2 3C80C2C0 -9081FFFC C041FFFC -EFE2F82A 00000000 -C24EAB40 00000005 -C03F0010 3C803FAB -9081FFFC C041FFFC -EC220072 3C80C2C0 -9081FFFC C041FFFC -EC22082A 00000000 -E2000001 80008000 -C2046A88 00000005 -C03F0008 3C803FAB -9081FFFC C041FFFC -EC220072 3C80C2C0 -9081FFFC C041FFFC -EC22082A 00000000 -C216E5F4 00000005 -C0210008 3C603FAB -9061001C C041001C -EC220072 3C60C2C0 -9061001C C041001C -EC22082A 00000000 -C22179E4 00000003 -808100DC 1C840004 -38A00003 7C842FD6 -3884FF96 00000000 -*This cheat makes the game appear in widescreen. +*Orb is more balanced. + +$Mechanics - Use Multiple Orbs in the Same Turn [Nora] +041E3764 3860FFFF +*Does not work with CPUs + +$Mechanics - Vaccum Orb Always Steals 5 Coins +041c8a34 38600005 + +$Minigame: Balloonatic - 25 Second Timer [Airsola] +202f2f3c 0000001c +28584892 00000708 +02584892 000005dc +e2000002 80008000 + +$Minigame: Bridge Work - 60 Second Timer [Airsola] +202f2f3c 0000003a +287d2f68 0000440a +025429f2 00000e10 +e2000002 80008000 + +$Minigame: Balloonatic - 60 Second Timer [Airsola] +202f2f3c 00000042 +207e3d18 4479ffff +025179f2 00000e10 +e2000002 80008000 + +$Minigame: Clock Watchers - Timer always 10 Seconds [Airsola] +202f2f3c 00000016 +c24e153c 00000001 +38800258 00000000 +e2000001 80008000 + +$Minigame: Gimme a Sign - Faster [Airsola] +202f2f3c 00000039 +287d8652 00000000 +027d8652 00000003 +e2000002 80008000 +202f2f3c 00000039 +287d8652 0000000f +027d8652 0000000d +e2000002 80008000 +*Does not work with CPUs + +$Minigame: La Bomba - Always 4 Bombs [Airsola, Rain] +202f2f3c 0000001a +044e8cec 00000004 +044e8cf0 00000004 +044e8cf4 00000004 +e2000001 80008000 + +$Minigame: Pogo-a-Go-Go - Spin Faster/Less Airtime [Airsola] +202f2f3c 00000026 +044eae38 3fe00000 +044eaecc 40c80000 +e2000001 80008000 +*The 1P can spin the platform faster. The 3P have less airtime on their hops + +$Mingiame: Spinner Cell - Faster Machines [Airsola, Rain] +202f2f3c 0000001d +044ef5d0 40c00000 +044ef5d4 41100000 +e2000001 80008000 + +$Minigame: Spray Anything - Faster Bubbles/Less Cooldown [Airsola, gamemasterplc] +202f2f3c 0000001b +0450bc40 c10a872b +0450bc48 3fa00000 +e2000001 80008000 + +$Minigame Replacement - Bridge Work ➜ Mad Props +28291558 00000034 +02291558 00000032 +e2000001 80008000 + +$Minigame Replacement - Cointagious ➜ Take Me Ohm +28291558 00000004 +02291558 0000000c +e2000001 80008000 + +$Minigame Replacement - Fish & Cheeps ➜ Weight for It +28291558 0000003c +02291558 0000002e +e2000001 80008000 + +$Minigame Replacement - Flashfright ➜ Think Tank +28291558 00000019 +02291558 00000018 +e2000001 80008000 + +$Minigame Replacement - Gimme a Sign ➜ Royal Rumpus +28291558 00000033 +02291558 00000039 +e2000001 80008000 + +$Minigame Replacement - La Bomba ➜ Easy Pickings +28291558 00000014 +02291558 0000001b +e2000001 80008000 + +$Minigame Replacement - Light Speed ➜ Camp Ukiki +28291558 0000003a +02291558 0000003d +e2000001 80008000 + +$Minigame Replacement - Spin Doctor ➜ Hip Hop Drop +28291558 00000035 +02291558 00000036 +e2000001 80008000 + +$Minigame Replacement - Warp Pipe Dreams ➜ Apes of Wrath +28291558 00000031 +02291558 00000038 +e2000001 80008000 + +$Minigame Replacement: - Pogo-a-Go-Go ➜ Balloonatic +28291558 00000020 +02291558 00000016 +e2000001 80008000 diff --git a/Data/Sys/GameSettings/GPH.ini b/Data/Sys/GameSettings/GPH.ini index af928c182d00..ef8b49edb29b 100644 --- a/Data/Sys/GameSettings/GPH.ini +++ b/Data/Sys/GameSettings/GPH.ini @@ -1,4 +1,4 @@ -# GPHD52, GPHE52, GPHP52 - Pitfall: The Lost Expedition +# GPHD52, GPHE52, GPHF52, GPHP52 - Pitfall: The Lost Expedition [Core] # Values set here will override the main Dolphin settings. @@ -13,5 +13,7 @@ # Add action replay cheats here. [Video_Settings] -SafeTextureCacheColorSamples = 512 - +# Safe Texture Cache has to be set somewhere between "Safe" and "Medium" +# for the "Pitfall!" and "Lost Cavern" Atari 2600 games to render correctly. +# Otherwise the retro games appear to be stuttering. +SafeTextureCacheColorSamples = 2048 diff --git a/Data/Sys/GameSettings/GR6.ini b/Data/Sys/GameSettings/GR6.ini new file mode 100644 index 000000000000..24f94b53c7cc --- /dev/null +++ b/Data/Sys/GameSettings/GR6.ini @@ -0,0 +1,19 @@ +# GR6P78, GR6E78, GR6D78, GR6F78 - Bratz: Rock Angelz + +[Core] +# Values set here will override the main Dolphin settings. + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. + +[Video_Settings] +SafeTextureCacheColorSamples = 0 + +[Video_Hacks] +EFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/GREJ08.ini b/Data/Sys/GameSettings/GREJ08.ini new file mode 100644 index 000000000000..fefc59063f1b --- /dev/null +++ b/Data/Sys/GameSettings/GREJ08.ini @@ -0,0 +1,5 @@ +# GREJ08 - Rockman EXE Transmission + +[Video_Settings] +# Fixes mangled font +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/GV4E69.ini b/Data/Sys/GameSettings/GV4E69.ini new file mode 100644 index 000000000000..77ffcaf74949 --- /dev/null +++ b/Data/Sys/GameSettings/GV4E69.ini @@ -0,0 +1,7 @@ +# GV4E69 - MVP Baseball 2005 + +[OnFrame] +$Fix 2D Rendering +0x80319214:dword:0x48113250 +[OnFrame_Enabled] +$Fix 2D Rendering diff --git a/Data/Sys/GameSettings/GVPE69.ini b/Data/Sys/GameSettings/GVPE69.ini new file mode 100644 index 000000000000..afc48b4b4357 --- /dev/null +++ b/Data/Sys/GameSettings/GVPE69.ini @@ -0,0 +1,7 @@ +# GVPE69 - MVP Baseball 2004 + +[OnFrame] +$Fix 2D Rendering +0x803C92D4:dword:0x480DA8E4 +[OnFrame_Enabled] +$Fix 2D Rendering diff --git a/Data/Sys/GameSettings/GWLE6L.ini b/Data/Sys/GameSettings/GWLE6L.ini index a6a33eaa414e..579430712f06 100644 --- a/Data/Sys/GameSettings/GWLE6L.ini +++ b/Data/Sys/GameSettings/GWLE6L.ini @@ -3,3 +3,5 @@ [OnFrame] $Bypass FIFO reset 0x8028EF00:dword:0x48000638 +[OnFrame_Enabled] +$Bypass FIFO reset diff --git a/Data/Sys/GameSettings/GWLX6L.ini b/Data/Sys/GameSettings/GWLX6L.ini index fa5d56e4c2e1..fdf558ac8c23 100644 --- a/Data/Sys/GameSettings/GWLX6L.ini +++ b/Data/Sys/GameSettings/GWLX6L.ini @@ -3,3 +3,5 @@ [OnFrame] $Bypass FIFO reset 0x8028EE80:dword:0x48000638 +[OnFrame_Enabled] +$Bypass FIFO reset diff --git a/Data/Sys/GameSettings/GXXE01.ini b/Data/Sys/GameSettings/GXXE01.ini new file mode 100644 index 000000000000..fa16f3d897b5 --- /dev/null +++ b/Data/Sys/GameSettings/GXXE01.ini @@ -0,0 +1,7 @@ +# GXXE01 - Pokémon XD: Gale of Darkness + +[OnFrame] +# Very similar to Pokémon Colosseum's save check, see those files for details. +$Allow Memory Card saving with Savestates +0x801cc304:dword:0x90e5002c +0x801cc4b0:dword:0x60000000 diff --git a/Data/Sys/GameSettings/GXXJ01.ini b/Data/Sys/GameSettings/GXXJ01.ini new file mode 100644 index 000000000000..a03a774a0d81 --- /dev/null +++ b/Data/Sys/GameSettings/GXXJ01.ini @@ -0,0 +1,7 @@ +# GXXJ01 - ポケモンXD 闇の旋風ダーク・ルギア + +[OnFrame] +# Very similar to Pokémon Colosseum's save check, see those files for details. +$Allow Memory Card saving with Savestates +0x801c7984:dword:0x90e5002c +0x801c7b30:dword:0x60000000 diff --git a/Data/Sys/GameSettings/GXXP01.ini b/Data/Sys/GameSettings/GXXP01.ini new file mode 100644 index 000000000000..837c59c3e446 --- /dev/null +++ b/Data/Sys/GameSettings/GXXP01.ini @@ -0,0 +1,7 @@ +# GXXP01 - Pokémon XD: Gale of Darkness + +[OnFrame] +# Very similar to Pokémon Colosseum's save check, see those files for details. +$Allow Memory Card saving with Savestates +0x801cd764:dword:0x90e5002c +0x801cd910:dword:0x60000000 diff --git a/Data/Sys/GameSettings/GYA.ini b/Data/Sys/GameSettings/GYA.ini new file mode 100644 index 000000000000..0d538ff1520c --- /dev/null +++ b/Data/Sys/GameSettings/GYA.ini @@ -0,0 +1,17 @@ +# GYAP78, GYAD78, GYAE78, GYAX78 - Barnyard (GC) + +[Core] +# Values set here will override the main Dolphin settings. + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. + +[Video_Hacks] +EFBToTextureEnable = False +DeferEFBCopies = False diff --git a/Data/Sys/GameSettings/HA9.ini b/Data/Sys/GameSettings/HA9.ini index 9c00d7516d57..18596f258a7d 100644 --- a/Data/Sys/GameSettings/HA9.ini +++ b/Data/Sys/GameSettings/HA9.ini @@ -1,4 +1,4 @@ -# HA8xxx - Super Mario Bros. (Brawl VC) +# HA9xxx - Super Mario Bros. (Brawl VC) [Core] # Values set here will override the main Dolphin settings. diff --git a/Data/Sys/GameSettings/HAG.ini b/Data/Sys/GameSettings/HAG.ini new file mode 100644 index 000000000000..d81b15de1df7 --- /dev/null +++ b/Data/Sys/GameSettings/HAG.ini @@ -0,0 +1,5 @@ +# HAGP01, HAGA01, HAGJ01, HAGE01 - News Channel + +[Video_Hacks] +# Needed to correctly render loading screen +XFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/HC2.ini b/Data/Sys/GameSettings/HC2.ini new file mode 100644 index 000000000000..6aaaf7b9a08f --- /dev/null +++ b/Data/Sys/GameSettings/HC2.ini @@ -0,0 +1,4 @@ +# HC2DAX - Watchever Channel + +[Core] +MMU = True diff --git a/Data/Sys/GameSettings/HC4.ini b/Data/Sys/GameSettings/HC4.ini new file mode 100644 index 000000000000..b7a5d42428fb --- /dev/null +++ b/Data/Sys/GameSettings/HC4.ini @@ -0,0 +1,14 @@ +# HC4E9Z, HC4P9Z - Crunchyroll Channel + +[Core] +# Values set here will override the main Dolphin settings. +MMU = True + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. diff --git a/Data/Sys/GameSettings/JAP.ini b/Data/Sys/GameSettings/JAP.ini new file mode 100644 index 000000000000..cb0a0e6b83b3 --- /dev/null +++ b/Data/Sys/GameSettings/JAP.ini @@ -0,0 +1,5 @@ +# JAPJ01 - Fire Emblem: Seisen no Keifu + +[Video_Hacks] +# Fixes black screen. +EFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/JB6.ini b/Data/Sys/GameSettings/JB6.ini new file mode 100644 index 000000000000..f0040b14a0c0 --- /dev/null +++ b/Data/Sys/GameSettings/JB6.ini @@ -0,0 +1,5 @@ +# JB6J01 - Treasure Hunter G + +[Video_Hacks] +# Fixes black screen. +EFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/JBH.ini b/Data/Sys/GameSettings/JBH.ini new file mode 100644 index 000000000000..0723d71bf6de --- /dev/null +++ b/Data/Sys/GameSettings/JBH.ini @@ -0,0 +1,5 @@ +# JBHJ01 - Heracles no Eikō IV: Kamigami-kara no Okurimono + +[Video_Hacks] +# Fixes black screen. +EFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/JBO.ini b/Data/Sys/GameSettings/JBO.ini new file mode 100644 index 000000000000..e172f8ef0933 --- /dev/null +++ b/Data/Sys/GameSettings/JBO.ini @@ -0,0 +1,5 @@ +# JBOJ01, JBOQ01 - Panel de Pon + +[Core] +# Values set here will override the main Dolphin settings. +CPUThread = False diff --git a/Data/Sys/GameSettings/JC6.ini b/Data/Sys/GameSettings/JC6.ini new file mode 100644 index 000000000000..e01302df6f50 --- /dev/null +++ b/Data/Sys/GameSettings/JC6.ini @@ -0,0 +1,5 @@ +# JC6J01 - Romancing SaGa 2 + +[Video_Hacks] +# Fixes black screen. +EFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/JC9.ini b/Data/Sys/GameSettings/JC9.ini new file mode 100644 index 000000000000..1a12a9e5de62 --- /dev/null +++ b/Data/Sys/GameSettings/JC9.ini @@ -0,0 +1,5 @@ +# JC9J01 - Final Fantasy V + +[Video_Hacks] +# Fixes black screen. +EFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/JCE.ini b/Data/Sys/GameSettings/JCE.ini new file mode 100644 index 000000000000..29a560839c54 --- /dev/null +++ b/Data/Sys/GameSettings/JCE.ini @@ -0,0 +1,5 @@ +# JCEJ01 - Fire Emblem: Thracia 776 + +[Video_Hacks] +# Fixes black screen. +EFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/LAD.ini b/Data/Sys/GameSettings/LAD.ini new file mode 100644 index 000000000000..315051140a05 --- /dev/null +++ b/Data/Sys/GameSettings/LAD.ini @@ -0,0 +1,6 @@ +# LADP8P, LADJ8P, LADE8P - Phantasy Star + +[Video_Hacks] +# Fixes purple screen. +XFBToTextureEnable = False +ImmediateXFBEnable = False diff --git a/Data/Sys/GameSettings/LAF.ini b/Data/Sys/GameSettings/LAF.ini new file mode 100644 index 000000000000..4b78485273c5 --- /dev/null +++ b/Data/Sys/GameSettings/LAF.ini @@ -0,0 +1,6 @@ +# LAFP8P, LAFN8P, LAFJ8P - Rambo: First Blood Part II + +[Video_Hacks] +# Fixes purple screen. +XFBToTextureEnable = False +ImmediateXFBEnable = False diff --git a/Data/Sys/GameSettings/LAK.ini b/Data/Sys/GameSettings/LAK.ini new file mode 100644 index 000000000000..35488a56d45d --- /dev/null +++ b/Data/Sys/GameSettings/LAK.ini @@ -0,0 +1,6 @@ +# LAKP8P, LAKJ8P, LAKE8P - Wonder Boy in Monster Land + +[Video_Hacks] +# Fixes purple screen. +XFBToTextureEnable = False +ImmediateXFBEnable = False diff --git a/Data/Sys/GameSettings/LAL.ini b/Data/Sys/GameSettings/LAL.ini new file mode 100644 index 000000000000..38ac8e87c929 --- /dev/null +++ b/Data/Sys/GameSettings/LAL.ini @@ -0,0 +1,6 @@ +# LALP8P, LALJ8P, LALE8P - Fantasy Zone II: The Tears of Opa-Opa + +[Video_Hacks] +# Fixes purple screen. +XFBToTextureEnable = False +ImmediateXFBEnable = False diff --git a/Data/Sys/GameSettings/LAO.ini b/Data/Sys/GameSettings/LAO.ini new file mode 100644 index 000000000000..ab8e956abc3a --- /dev/null +++ b/Data/Sys/GameSettings/LAO.ini @@ -0,0 +1,6 @@ +# LAOP8P, LAOE8P, LAOJ8P - R-Type + +[Video_Hacks] +# Fixes purple screen. +XFBToTextureEnable = False +ImmediateXFBEnable = False diff --git a/Data/Sys/GameSettings/LAP.ini b/Data/Sys/GameSettings/LAP.ini new file mode 100644 index 000000000000..986060e1d63d --- /dev/null +++ b/Data/Sys/GameSettings/LAP.ini @@ -0,0 +1,6 @@ +# LAPP8P, LAPE8P Wonder Boy III: The Dragon's Trap + +[Video_Hacks] +# Fixes purple screen. +XFBToTextureEnable = False +ImmediateXFBEnable = False diff --git a/Data/Sys/GameSettings/MB3.ini b/Data/Sys/GameSettings/MB3.ini index 21bf1665b83f..a0a18b49c246 100644 --- a/Data/Sys/GameSettings/MB3.ini +++ b/Data/Sys/GameSettings/MB3.ini @@ -1,6 +1,6 @@ -# MB3E8P - Monster World IV - -[Video_Settings] +# MB3L8P, MB3J8P, MB3E8P - Monster World IV [Video_Hacks] +# Fixes purple screen. +XFBToTextureEnable = False ImmediateXFBEnable = False diff --git a/Data/Sys/GameSettings/MB9.ini b/Data/Sys/GameSettings/MB9.ini new file mode 100644 index 000000000000..b525f0c33cba --- /dev/null +++ b/Data/Sys/GameSettings/MB9.ini @@ -0,0 +1,6 @@ +# MB9J8P - Pepenga Pengo + +[Video_Hacks] +# Fixes purple screen. +XFBToTextureEnable = False +ImmediateXFBEnable = False diff --git a/Data/Sys/GameSettings/MBA.ini b/Data/Sys/GameSettings/MBA.ini index 0e2cf17b8c44..8c7cfa9ccf2f 100644 --- a/Data/Sys/GameSettings/MBA.ini +++ b/Data/Sys/GameSettings/MBA.ini @@ -1,6 +1,8 @@ -# MBAN8P - Pulseman +# MBAN8P, MBAJ8P, MBAL8P - Pulseman -[Video_Settings] +[Core] +# Values set here will override the main Dolphin settings. +CPUThread = False [Video_Hacks] ImmediateXFBEnable = False diff --git a/Data/Sys/GameSettings/MCT.ini b/Data/Sys/GameSettings/MCT.ini new file mode 100644 index 000000000000..c461ac16c9ed --- /dev/null +++ b/Data/Sys/GameSettings/MCT.ini @@ -0,0 +1,6 @@ +# MCTE8P, MCTP8P - ClayFighter + +[Video_Hacks] +# Fixes purple screen. +XFBToTextureEnable = False +ImmediateXFBEnable = False diff --git a/Data/Sys/GameSettings/MCV.ini b/Data/Sys/GameSettings/MCV.ini index 4797ed3c6351..e0804cbca5fd 100644 --- a/Data/Sys/GameSettings/MCV.ini +++ b/Data/Sys/GameSettings/MCV.ini @@ -1,6 +1,8 @@ -# MCVE8P - Pitfall +# MCVP8P, MCVJ8P, MCVE8P - Pitfall: The Mayan Adventure -[Video_Settings] +[Core] +# Values set here will override the main Dolphin settings. +CPUThread = False [Video_Hacks] ImmediateXFBEnable = False diff --git a/Data/Sys/GameSettings/MCY.ini b/Data/Sys/GameSettings/MCY.ini index 272290b05b78..97a6116b567b 100644 --- a/Data/Sys/GameSettings/MCY.ini +++ b/Data/Sys/GameSettings/MCY.ini @@ -1,6 +1,8 @@ -# MCYE8P - Revenge of Shinobi +# MCYE8P, MCYJ8P, MCYP8P - Revenge of Shinobi -[Video_Settings] +[Core] +# Values set here will override the main Dolphin settings. +CPUThread = False [Video_Hacks] ImmediateXFBEnable = False diff --git a/Data/Sys/GameSettings/NAK.ini b/Data/Sys/GameSettings/NAK.ini index 0084763bd6f5..911330e8434f 100644 --- a/Data/Sys/GameSettings/NAK.ini +++ b/Data/Sys/GameSettings/NAK.ini @@ -14,3 +14,7 @@ [Video_Hacks] EFBToTextureEnable = False + +[Video_Settings] +# Breaks photo appraisal +MSAA = 1 diff --git a/Data/Sys/GameSettings/NAL.ini b/Data/Sys/GameSettings/NAL.ini index a03b2d8a22a5..b902a4ae315c 100644 --- a/Data/Sys/GameSettings/NAL.ini +++ b/Data/Sys/GameSettings/NAL.ini @@ -18,4 +18,6 @@ StereoConvergence = 5000 [Video_Settings] # This game creates a large number of EFB copies at different addresses, resulting # in a large texture cache which takes considerable time to save. -SaveTextureCacheToState = False \ No newline at end of file +SaveTextureCacheToState = False +# This game crashes very soon after boot if above 1x IR +InternalResolution = 1 diff --git a/Data/Sys/GameSettings/NAT.ini b/Data/Sys/GameSettings/NAT.ini index ede4c317668f..bcb8cfd6027e 100644 --- a/Data/Sys/GameSettings/NAT.ini +++ b/Data/Sys/GameSettings/NAT.ini @@ -15,4 +15,6 @@ [Video_Settings] # This game creates a large number of EFB copies at different addresses, resulting # in a large texture cache which takes considerable time to save. -SaveTextureCacheToState = False \ No newline at end of file +SaveTextureCacheToState = False +# This game crashes very soon after boot if above 1x IR +InternalResolution = 1 diff --git a/Data/Sys/GameSettings/PM4.ini b/Data/Sys/GameSettings/PM4.ini new file mode 100644 index 000000000000..a11ebd5d54af --- /dev/null +++ b/Data/Sys/GameSettings/PM4.ini @@ -0,0 +1,5 @@ +# PM4E01 - Mario Kart: Double Dash‼ Bonus Disc + +[Core] +MMU = True +FPRF = True diff --git a/Data/Sys/GameSettings/R38.ini b/Data/Sys/GameSettings/R38.ini index 4a3a419a19ee..2eb103d6a366 100644 --- a/Data/Sys/GameSettings/R38.ini +++ b/Data/Sys/GameSettings/R38.ini @@ -12,5 +12,9 @@ [ActionReplay] # Add action replay cheats here. +[Video_Settings] +SafeTextureCacheColorSamples = 512 + [Video_Hacks] EFBToTextureEnable = False +DeferEFBCopies = False diff --git a/Data/Sys/GameSettings/R3S.ini b/Data/Sys/GameSettings/R3S.ini new file mode 100644 index 000000000000..e0dd3a04c927 --- /dev/null +++ b/Data/Sys/GameSettings/R3S.ini @@ -0,0 +1,5 @@ +# R3SP52, R3SE52 - Spider-Man: Web of Shadows + +[Video_Enhancements] +# FMVs get messed up if this is on +ForceFiltering = False diff --git a/Data/Sys/GameSettings/R6B.ini b/Data/Sys/GameSettings/R6B.ini index 814b65454a45..61dfb94edd60 100644 --- a/Data/Sys/GameSettings/R6B.ini +++ b/Data/Sys/GameSettings/R6B.ini @@ -17,4 +17,4 @@ ForceFiltering = False [Video_Hacks] EFBToTextureEnable = False - +DeferEFBCopies = False diff --git a/Data/Sys/GameSettings/R8P.ini b/Data/Sys/GameSettings/R8P.ini index 94f107f58dd5..db015bfd1bc1 100644 --- a/Data/Sys/GameSettings/R8P.ini +++ b/Data/Sys/GameSettings/R8P.ini @@ -15,3 +15,5 @@ [Video_Hacks] EFBToTextureEnable = False BBoxEnable = True +ImmediateXFBEnable = False +DeferEFBCopies = False diff --git a/Data/Sys/GameSettings/R9I.ini b/Data/Sys/GameSettings/R9I.ini index 8707249b34ee..363616ce687a 100644 --- a/Data/Sys/GameSettings/R9I.ini +++ b/Data/Sys/GameSettings/R9I.ini @@ -13,4 +13,8 @@ # Add action replay cheats here. [Video_Hacks] -EFBAccessEnable = True \ No newline at end of file +EFBAccessEnable = True + +[Video_Settings] +# Breaks camera angles +MSAA = 1 diff --git a/Data/Sys/GameSettings/RBK.ini b/Data/Sys/GameSettings/RBK.ini index 3fb30e2eb946..f94dda699711 100644 --- a/Data/Sys/GameSettings/RBK.ini +++ b/Data/Sys/GameSettings/RBK.ini @@ -14,13 +14,3 @@ [Video_Settings] # Add any video settings here - -[Wiimote.Shake] -Soft = 3.0 -Medium = 4.0 -Hard = 4.8 - -[Wiimote.Swing] -Slow = 3.5 -Medium = 4.8 -Fast = 6 \ No newline at end of file diff --git a/Data/Sys/GameSettings/RBP.ini b/Data/Sys/GameSettings/RBP.ini index 3f1cbbca1a0a..bd308645091f 100644 --- a/Data/Sys/GameSettings/RBP.ini +++ b/Data/Sys/GameSettings/RBP.ini @@ -1,4 +1,7 @@ # RBPE4Z, RBPPGT - Brunswick Pro Bowling +[Core] +CPUThread = False + [Video_Settings] SuggestedAspectRatio = 2 diff --git a/Data/Sys/GameSettings/RBY.ini b/Data/Sys/GameSettings/RBY.ini new file mode 100644 index 000000000000..9429e3a209e5 --- /dev/null +++ b/Data/Sys/GameSettings/RBY.ini @@ -0,0 +1,17 @@ +# RBYP78, RBYJ78, RBYE78 - Barnyard (Wii) + +[Core] +# Values set here will override the main Dolphin settings. + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. + +[Video_Hacks] +EFBToTextureEnable = False +DeferEFBCopies = False diff --git a/Data/Sys/GameSettings/RCV.ini b/Data/Sys/GameSettings/RCV.ini new file mode 100644 index 000000000000..051c708460e4 --- /dev/null +++ b/Data/Sys/GameSettings/RCV.ini @@ -0,0 +1,5 @@ +# RCVP41, RCVE41 - Far Cry Vengeance + +[Video_Settings] +# Fixes intro FMV +SafeTextureCacheColorSamples = 512 diff --git a/Data/Sys/GameSettings/RDF.ini b/Data/Sys/GameSettings/RDF.ini index 78b505add053..2fd071237f52 100644 --- a/Data/Sys/GameSettings/RDF.ini +++ b/Data/Sys/GameSettings/RDF.ini @@ -14,3 +14,4 @@ [Video_Hacks] EFBToTextureEnable = False +DeferEFBCopies = False diff --git a/Data/Sys/GameSettings/REF.ini b/Data/Sys/GameSettings/REF.ini index aed571de7ef4..d885227071ef 100644 --- a/Data/Sys/GameSettings/REF.ini +++ b/Data/Sys/GameSettings/REF.ini @@ -1,4 +1,5 @@ # REFP41 - My French Coach: Improve Your French [Video_Settings] +SafeTextureCacheColorSamples = 0 SuggestedAspectRatio = 2 diff --git a/Data/Sys/GameSettings/RES.ini b/Data/Sys/GameSettings/RES.ini index e297cc2ce446..3f5b96db8c69 100644 --- a/Data/Sys/GameSettings/RES.ini +++ b/Data/Sys/GameSettings/RES.ini @@ -1,4 +1,5 @@ # RESP41 - My Spanish Coach: Improve Your Spanish [Video_Settings] +SafeTextureCacheColorSamples = 0 SuggestedAspectRatio = 2 diff --git a/Data/Sys/GameSettings/RFN.ini b/Data/Sys/GameSettings/RFN.ini new file mode 100644 index 000000000000..dd12b6cd8bff --- /dev/null +++ b/Data/Sys/GameSettings/RFN.ini @@ -0,0 +1,9 @@ +# RFNP01, RFNJ01, RFNW01, RFNE01, RFNK01 - Wii Fit and Wii Fit Channel + +[Video_Hacks] +# The Wii Fit Channel shows Mii faces and a graph; however, EFBToTextureEnable must be disabled for this to work. +# Since both the channel and the main game update these images, it must be disabled for both. (They both have the same GameID, though.) +# However, this has a performance impact, so if the Wii Fit Channel is not going to be used, this does not need to be disabled. +#EFBToTextureEnable = False +# Having EFBToTextureEnable disabled causes hangs in mini games if DeferEFBCopies is enabled. +DeferEFBCopies = False diff --git a/Data/Sys/GameSettings/RFP.ini b/Data/Sys/GameSettings/RFP.ini new file mode 100644 index 000000000000..b5c5b531cfdc --- /dev/null +++ b/Data/Sys/GameSettings/RFP.ini @@ -0,0 +1,13 @@ +# RFPE01, RFPJ01, RFPR01, RFPP01, RFPK01, RFPW01 - Wii Fit Plus and Wii Fit Plus Channel + +[Core] +# Dualcore causes hangs in the Rhythm Parade mini game. +CPUThread = False + +[Video_Hacks] +# The Wii Fit Plus Channel shows Mii faces and a graph; however, EFBToTextureEnable must be disabled for this to work. +# Since both the channel and the main game update these images, it must be disabled for both. (They both have the same GameID, though.) +# However, this has a performance impact, so if the Wii Fit Channel is not going to be used, this does not need to be disabled. +#EFBToTextureEnable = False +# Having EFBToTextureEnable disabled causes hangs in mini games if DeferEFBCopies is enabled. +DeferEFBCopies = False diff --git a/Data/Sys/GameSettings/RH2.ini b/Data/Sys/GameSettings/RH2.ini index 36b7d0f1d509..5cd947b9a5d4 100644 --- a/Data/Sys/GameSettings/RH2.ini +++ b/Data/Sys/GameSettings/RH2.ini @@ -2,3 +2,6 @@ [Video_Settings] SuggestedAspectRatio = 2 + +[Video_Hacks] +XFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/RHF.ini b/Data/Sys/GameSettings/RHF.ini index d075a021ad96..a3bea1d0f1b5 100644 --- a/Data/Sys/GameSettings/RHF.ini +++ b/Data/Sys/GameSettings/RHF.ini @@ -2,3 +2,5 @@ [Video_Settings] SuggestedAspectRatio = 2 +# The JIT cache causes problems with emulated icache invalidation in this game resulting in a crash on starting the game +DisableICache = True diff --git a/Data/Sys/GameSettings/RKF.ini b/Data/Sys/GameSettings/RKF.ini index c540d56fdfb2..ceb8117f7360 100644 --- a/Data/Sys/GameSettings/RKF.ini +++ b/Data/Sys/GameSettings/RKF.ini @@ -1,4 +1,7 @@ # RKFEH4, RKFKZA, RKFP7U - The King of Fighters Collection: The Orochi Saga +[Core] +CPUThread = False + [Video_Settings] SuggestedAspectRatio = 2 diff --git a/Data/Sys/GameSettings/RM8E01.ini b/Data/Sys/GameSettings/RM8E01.ini index 6c490ab66373..ce96e76253ac 100644 --- a/Data/Sys/GameSettings/RM8E01.ini +++ b/Data/Sys/GameSettings/RM8E01.ini @@ -6,11 +6,27 @@ [OnFrame] # Add memory patches to be applied every frame here. +[ActionReplay] +# Add action replay cheats here. + [Gecko] -$Netplay Community Settings -282287CC 00000032 -022287CC 0000003A -E2000001 80008000 +# Add gecko cheats here. + +$!!! - README +*Mario Party 8 Cheats can cause the game to stop saving. Be Warned +*Mario Party 8 Cheats can also cause unintended consequences due to to hacky nature of specific codes. + +$QOL - Faster Boot Time [Celerizer] +20744de4 a003de20 +04744dec 60000000 +e2000001 80008000 +20741c30 38600008 +04741c48 60000000 +04741c14 60000000 +e2000001 80008000 +*Automatically advance through the initial cutscences. + +$QOL - Increased Board Speed [gamemasterplc] 48000000 800030c8 de000000 80008180 300a14c4 4081ff48 @@ -137,220 +153,243 @@ de000000 80008180 14151048 38030002 1415cd04 3b9c0002 e0000000 80008000 -48000000 800030C8 -DE000000 80008180 -300966F8 901F0010 -140966F0 60000000 -1409671C 60000000 +*Board animations happen faster. + +$QOL - Increased Taunt Capabilities [gamemasterplc] +48000000 800030c8 +de000000 80008180 +300966f8 901f0010 +140966f0 60000000 +1409671c 60000000 14096730 60000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -30098C3C 901F0010 -14098C34 60000000 -14098C60 60000000 -14098C74 60000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -300BB770 901F0010 -140BB768 60000000 -140BB794 60000000 -140BB7A8 60000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -3009F30C 901F0010 -1409F304 60000000 -1409F330 60000000 -1409F344 60000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -300941F8 901F0010 -140941F0 60000000 -1409421C 60000000 +e0000000 80008000 +48000000 800030c8 +de000000 80008180 +30098c3c 901f0010 +14098c34 60000000 +14098c60 60000000 +14098c74 60000000 +e0000000 80008000 +48000000 800030c8 +de000000 80008180 +300bb770 901f0010 +140bb768 60000000 +140bb794 60000000 +140bb7a8 60000000 +e0000000 80008000 +48000000 800030c8 +de000000 80008180 +3009f30c 901f0010 +1409f304 60000000 +1409f330 60000000 +1409f344 60000000 +e0000000 80008000 +48000000 800030c8 +de000000 80008180 +300941f8 901f0010 +140941f0 60000000 +1409421c 60000000 14094230 60000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -3009BFD4 901F0010 -1409BFCC 60000000 -1409BFF8 60000000 -1409C00C 60000000 -E0000000 80008000 -04106A24 83DE6404 -04106A28 60000000 -20744DE4 A003DE20 -04744DEC 60000000 -E2000001 80008000 -04045A78 3800FFFF -04045468 3800FFFF -*WARNING: This set of cheats is meant for Netplay only. This can 100% your save so make sure you make backups. -*This Cheat includes -*Game Mechanics - Increased Board Speed -*Game Mechanics - Increased Taunt Capabilities -*Miscellaneous - Instant Text Display -*as well as some cheats to 100% the game. We wont tell you which ones they are because that ruins the fun of playing. -* -*These Cheats implement the use of the GC Mod for Mario Party 8. This makes Mario Party 8 run via an emulated GameCube controller not a GameCube controller configured for a WiiMote. -*http://www.mariopartylegacy.com/forum/index.php?topic=16319.0 +e0000000 80008000 +48000000 800030c8 +de000000 80008180 +3009bfd4 901f0010 +1409bfcc 60000000 +1409bff8 60000000 +1409c00c 60000000 +e0000000 80008000 +*Taunt during your turn. +*Also removes the cap on how fast you can taunt. + +$QOL - Increased Text Display [Nora] +0405DED4 60000000 +*Text is displayed instantly. + +$QOL - Remove Explanations [Rain] +82200001 80228760 +86300001 ffffbfff +84200001 80228760 +*Remove Minigame Explanations in all minigames. + +$Board: DK's Treetop Temple - Free Cannon [gamemasterplc] +48000000 800030c8 +de000000 80008180 +3001a2dc 387f00c8 +1401a2d8 60000000 +1401a160 2c040000 +e0000000 80008000 +*Cannon usage is free in the board DK's Treetop Temple + +$Board: Goomba's Booty Boardwalk - Remove Dolphin Shuttles [gamemasterplc] +2057bc40 437f0000 +0457bc3c 42700000 +e2000001 80008000 +*A long tedious path forms in the board Goomba's Booty Boardwalk. + +$Board: King Boo's Haunted Hideaway - Make the Whomp Toll Free [gamemasterplc] +48000000 800030c8 +de000000 80008180 +3003f0e0 387f01c0 +1403f0dc 60000000 +1403f04c 2c03000a +e0000000 80008000 +*Whomp toll is free in the board King Boo's Haunted Hideaway + +$Board - King Boo's Haunted Hideaway: Map Always Revealed [gamemasterplc] +042287bc ffffffff +*King Boo's Haunted Hideaway becomes less secret. -$Netplay Force Player 1 to CPU +$Extra - Disable Music [gamemasterplc] +042CE168 00000001 +0404D9FC 60000000 +*Disables all in-game music. + +$Mechanics - Cashzap Candy Steals Coins [gamemasterplc] 48000000 800030c8 de000000 80008180 -301a0218 4bffb149 -141a0204 48000030 +301020d8 80bf01a8 +d21020c4 00000005 +3dc08023 89ee876a +39ce82f8 1def0118 +7dcf7214 a1ee0026 +7def1a14 b1ee0026 +907f01a8 00000000 e0000000 80008000 48000000 800030c8 de000000 80008180 -301a96d4 4bffb149 -141a96c0 48000030 +3010d220 80bf01a8 +d210d20c 00000005 +3dc08023 89ee876a +39ce82f8 1def0118 +7dcf7214 a1ee0026 +7def1a14 b1ee0026 +907f01a8 00000000 e0000000 80008000 48000000 800030c8 de000000 80008180 -301c6194 4bffb149 -141c6180 48000030 +30128f9c 80bf01a8 +d2128f88 00000005 +3dc08023 89ee876a +39ce82f8 1def0118 +7dcf7214 a1ee0026 +7def1a14 b1ee0026 +907f01a8 00000000 e0000000 80008000 48000000 800030c8 de000000 80008180 -301a4954 4bffb149 -141a4940 48000030 +30106b8c 80bf01a8 +d2106b78 00000005 +3dc08023 89ee876a +39ce82f8 1def0118 +7dcf7214 a1ee0026 +7def1a14 b1ee0026 +907f01a8 00000000 e0000000 80008000 48000000 800030c8 de000000 80008180 -301a24e8 4bffb149 -141a24d4 48000030 +30104498 80bf01a8 +d2104484 00000005 +3dc08023 89ee876a +39ce82f8 1def0118 +7dcf7214 a1ee0026 +7def1a14 b1ee0026 +907f01a8 00000000 e0000000 80008000 48000000 800030c8 de000000 80008180 -301a6ba0 4bffb149 -141a6b8c 48000030 +30109890 80bf01a8 +d210987c 00000005 +3dc08023 89ee876a +39ce82f8 1def0118 +7dcf7214 a1ee0026 +7def1a14 b1ee0026 +907f01a8 00000000 e0000000 80008000 -*This cheat makes it so the player on port 1 will be turned into a computer. This can be useful for games when the player with port 1 drops. +*Cashzap Candy steals coins rather then destroying. -$Netplay Safe Kill Music -042ce168 00000001 -0404d9fc 60000000 -*This cheat makes it so all in-game music will be turned off. -* -*This can safely be used in a Netplay game without desync. +$Mechanics - Disable Duelo Candy [Nora, Rain, jdaster] +c0000000 00000010 +3821ffdc 90610010 +90810014 90a10018 +90c1001c 90e10020 +3c608022 606382fe +38a00000 38c00000 +38e00000 7c8518ae +2c04000f 40a20008 +7ce519ae 38a50001 +2c050003 4082ffe8 +38c60001 2c060004 +41820010 38a00000 +38630118 4bffffd0 +80610010 80810014 +80a10018 80c1001c +80e10020 38210024 +4e800020 00000000 +*Replaces Duelo Candy with Twice Candy -$Board - Goomba's Booty Boardwalk: Remove Dolphin Shuttles -2057BC40 437F0000 -0457BC3C 42700000 -E2000001 80008000 -*This cheat makes Goomba's Booty Boardwalk a long teadious path. - -$Board - King Boo's Haunted Hideaway: Map Always Revealed -042287BC FFFFFFFF -*This cheat makes King Boo's Haunted Hideaway not that secret. - -$Game Mechanics - Cashzap Candy Steals Coins -48000000 800030C8 -DE000000 80008180 -301020D8 80BF01A8 -D21020C4 00000005 -3DC08023 89EE876A -39CE82F8 1DEF0118 -7DCF7214 A1EE0026 -7DEF1A14 B1EE0026 -907F01A8 00000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -3010D220 80BF01A8 -D210D20C 00000005 -3DC08023 89EE876A -39CE82F8 1DEF0118 -7DCF7214 A1EE0026 -7DEF1A14 B1EE0026 -907F01A8 00000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -30128F9C 80BF01A8 -D2128F88 00000005 -3DC08023 89EE876A -39CE82F8 1DEF0118 -7DCF7214 A1EE0026 -7DEF1A14 B1EE0026 -907F01A8 00000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -30106B8C 80BF01A8 -D2106B78 00000005 -3DC08023 89EE876A -39CE82F8 1DEF0118 -7DCF7214 A1EE0026 -7DEF1A14 B1EE0026 -907F01A8 00000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -30104498 80BF01A8 -D2104484 00000005 -3DC08023 89EE876A -39CE82F8 1DEF0118 -7DCF7214 A1EE0026 -7DEF1A14 B1EE0026 -907F01A8 00000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -30109890 80BF01A8 -D210987C 00000005 -3DC08023 89EE876A -39CE82F8 1DEF0118 -7DCF7214 A1EE0026 -7DEF1A14 B1EE0026 -907F01A8 00000000 -E0000000 80008000 -*This cheat makes the Cashzap Candy steal coins rather then destroying. - -$Game Mechanics - Disable Lucky Spaces -48000000 800030C8 -DE000000 80008180 -3001BAEC 4E800020 -1401BAF0 4E800020 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -30019F18 4E800020 -14019F1C 4E800020 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -3003C990 4E800020 -1403C994 4E800020 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -300022E8 4E800020 -140022EC 4E800020 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -30015870 4E800020 -14015874 4E800020 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -30010778 4E800020 -1401077C 4E800020 -E0000000 80008000 -*This cheat disables the overpowered Lucky Spaces. - -$Game Mechanics - Force Mini-Game/Candy/Happening Bonus Stars -48000000 800030C8 -DE000000 80008180 -30006CD4 4800005C -14006C94 48000014 -E0000000 80008000 -*This cheat makes the Bonus Stars always the same. - -$Game Mechanics - Free Stars +$Mechanics - Disable Lucky Spaces [gamemasterplc] +48000000 800030c8 +de000000 80008180 +3001baec 4e800020 +1401baf0 4e800020 +e0000000 80008000 +48000000 800030c8 +de000000 80008180 +30019f18 4e800020 +14019f1c 4e800020 +e0000000 80008000 +48000000 800030c8 +de000000 80008180 +3003c990 4e800020 +1403c994 4e800020 +e0000000 80008000 +48000000 800030c8 +de000000 80008180 +300022e8 4e800020 +140022ec 4e800020 +e0000000 80008000 +48000000 800030c8 +de000000 80008180 +30015870 4e800020 +14015874 4e800020 +e0000000 80008000 +48000000 800030c8 +de000000 80008180 +30010778 4e800020 +1401077c 4e800020 +e0000000 80008000 +*Disables the overpowered Lucky Spaces. +*Disables certain happening spaces due to the level of assembly needed for this patch. + +$Mechanics - Disable Slogo Candy [Nora, Rain, jdaster] +c0000000 00000010 +3821ffdc 90610010 +90810014 90a10018 +90c1001c 90e10020 +3c608022 606382fe +38a00000 38c00000 +38e00000 7c8518ae +2c040002 40a20008 +7ce519ae 38a50001 +2c050003 4082ffe8 +38c60001 2c060004 +41820010 38a00000 +38630118 4bffffd0 +80610010 80810014 +80a10018 80c1001c +80e10020 38210024 +4e800020 00000000 +*Replaces Slogo Candy with Twice Candy + +$Mechanics - Force Mini-Game/Candy/Happening Bonus Stars [gamemasterplc] +48000000 800030c8 +de000000 80008180 +30006cd4 4800005c +14006c94 48000014 +e0000000 80008000 +*Bonus Stars are always the same. + +$Extra - Free Stars [gamemasterplc] 48000000 800030c8 de000000 80008180 30031f80 387f03f8 @@ -368,301 +407,135 @@ de000000 80008180 3001e728 7c03e800 1401e604 38600000 e0000000 80008000 -*This cheat makes Stars cost nothing instead of the usual 20 coins. +*Stars cost nothing instead of the usual 20 coins. -$Game Mechanics - Increased Board Speed +$Mechanics - No 1 or 5 Coin Duel Rewards [gamemasterplc] 48000000 800030c8 de000000 80008180 -300a14c4 4081ff48 -140a14bc 3b9c0002 -140a1714 3bbd0002 -140a18f0 3bbd0002 -140a0f04 3bde0002 -140a10dc 3b9c0002 -1415dce4 3b5a0002 -1415ddd4 3b9c0002 -1415d3b4 3b9c0002 -14164c0c 3b5a0002 -14164d0c 3b390002 -14164d98 3b9c0002 -14149a18 3b9c0002 -14151914 3bbd0002 -1415b7c4 3b9c0002 -14155c00 38030002 -14155a60 38030002 -1416171c 3b9c0002 +30170058 3800000a +14170040 3800000a +1417004c 3860000a e0000000 80008000 48000000 800030c8 de000000 80008180 -3009eef8 4081ff48 -1409eef0 3b9c0002 -1409f148 3bbd0002 -1409f324 3bbd0002 -1409e938 3bde0002 -1409eb10 3b9c0002 -1415b6a8 3b5a0002 -1415b798 3b9c0002 -1415ad98 3b9c0002 -141625d0 3b5a0002 -141626d0 3b390002 -1416275c 3b9c0002 -141473dc 3b9c0002 -1414f2d8 3bbd0002 -14159188 3b9c0002 -141535c4 38030002 -14153424 38030002 -1415f0e0 3b9c0002 +30164efc 3800000a +14164ee4 3800000a +14164ef0 3860000a e0000000 80008000 48000000 800030c8 de000000 80008180 -300a482c 4081ff48 -140a4824 3b9c0002 -140a4a7c 3bbd0002 -140a4c58 3bbd0002 -140a426c 3bde0002 -140a4444 3b9c0002 -14160aa0 3b5a0002 -14160b90 3b9c0002 -14160170 3b9c0002 -141679c8 3b5a0002 -14167ac8 3b390002 -14167b54 3b9c0002 -1414c7d4 3b9c0002 -141546d0 3bbd0002 -1415e580 3b9c0002 -141589bc 38030002 -1415881c 38030002 -141644d8 3b9c0002 +3018bd00 3800000a +1418bce8 3800000a +1418bcf4 3860000a e0000000 80008000 48000000 800030c8 de000000 80008180 -300c3f70 4081ff48 -140c3f68 3b9c0002 -140c41c0 3bbd0002 -140c439c 3bbd0002 -140c39b0 3bde0002 -140c3b88 3b9c0002 -141800d0 3b5a0002 -141801c0 3b9c0002 -1417f7a0 3b9c0002 -14186ff8 3b5a0002 -141870f8 3b390002 -14187184 3b9c0002 -1416be04 3b9c0002 -14173d00 3bbd0002 -1417dbb0 3b9c0002 -14177fec 38030002 -14177e4c 38030002 -14183b08 3b9c0002 +301672d8 3800000a +141672c0 3800000a +141672cc 3860000a e0000000 80008000 48000000 800030c8 de000000 80008180 -300a7b64 4081ff48 -140a7b5c 3b9c0002 -140a7db4 3bbd0002 -140a7f90 3bbd0002 -140a75a4 3bde0002 -140a777c 3b9c0002 -14164428 3b5a0002 -14164518 3b9c0002 -14163af8 3b9c0002 -1416b350 3b5a0002 -1416b450 3b390002 -1416b4dc 3b9c0002 -1415015c 3b9c0002 -14158058 3bbd0002 -14161f08 3b9c0002 -1415c344 38030002 -1415c1a4 38030002 -14167e60 3b9c0002 +30169914 3800000a +141698fc 3800000a +14169908 3860000a e0000000 80008000 48000000 800030c8 de000000 80008180 -3009ca80 4081ff48 -1409ca78 3b9c0002 -1409ccd0 3bbd0002 -1409ceac 3bbd0002 -1409c4c0 3bde0002 -1409c698 3b9c0002 -141592cc 3b5a0002 -141593bc 3b9c0002 -1415899c 3b9c0002 -141601f4 3b5a0002 -141602f4 3b390002 -14160380 3b9c0002 -14145000 3b9c0002 -1414cefc 3bbd0002 -14156dac 3b9c0002 -141511e8 38030002 -14151048 38030002 -1415cd04 3b9c0002 +3016c6d0 3800000a +1416c6b8 3800000a +1416c6c4 3860000a e0000000 80008000 -*This cheat makes the players move faster while playing a Mario Party board. +*Duels are now worth it. -$Game Mechanics - Increased Taunt Capabilities -48000000 800030C8 -DE000000 80008180 -300966F8 901F0010 -140966F0 60000000 -1409671C 60000000 -14096730 60000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -30098C3C 901F0010 -14098C34 60000000 -14098C60 60000000 -14098C74 60000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -300BB770 901F0010 -140BB768 60000000 -140BB794 60000000 -140BB7A8 60000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -3009F30C 901F0010 -1409F304 60000000 -1409F330 60000000 -1409F344 60000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -300941F8 901F0010 -140941F0 60000000 -1409421C 60000000 -14094230 60000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -3009BFD4 901F0010 -1409BFCC 60000000 -1409BFF8 60000000 -1409C00C 60000000 -E0000000 80008000 -*This cheat makes it so you can taunt during your turn. - -$Game Mechanics - No 1 or 5 Coin Duel Rewards -48000000 800030C8 -DE000000 80008180 -30170058 3800000A -14170040 3800000A -1417004C 3860000A -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -30164EFC 3800000A -14164EE4 3800000A -14164EF0 3860000A -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -3018BD00 3800000A -1418BCE8 3800000A -1418BCF4 3860000A -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -301672D8 3800000A -141672C0 3800000A -141672CC 3860000A -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -30169914 3800000A -141698FC 3800000A -14169908 3860000A -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -3016C6D0 3800000A -1416C6B8 3800000A -1416C6C4 3860000A -E0000000 80008000 -*This cheat makes duels not steal very few coins. - -$Game Mechanics - Thwomp Candy Steals Coins -48000000 800030C8 -DE000000 80008180 -30159750 408202E4 -D2159868 00000005 -3DC08023 89EE876A -39CE82F8 1DEF0118 -7DCF7214 A1EE0026 -7DEF0214 B1EE0026 -901F0180 00000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -301648AC 408202E4 -D21649C4 00000005 -3DC08023 89EE876A -39CE82F8 1DEF0118 -7DCF7214 A1EE0026 -7DEF0214 B1EE0026 -901F0180 00000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -30180554 408202E4 -D218066C 00000005 -3DC08023 89EE876A -39CE82F8 1DEF0118 -7DCF7214 A1EE0026 -7DEF0214 B1EE0026 -901F0180 00000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -3015E168 408202E4 -D215E280 00000005 -3DC08023 89EE876A -39CE82F8 1DEF0118 -7DCF7214 A1EE0026 -7DEF0214 B1EE0026 -901F0180 00000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -3015BB2C 408202E4 -D215BC44 00000005 -3DC08023 89EE876A -39CE82F8 1DEF0118 -7DCF7214 A1EE0026 -7DEF0214 B1EE0026 -901F0180 00000000 -E0000000 80008000 -48000000 800030C8 -DE000000 80008180 -30160F24 408202E4 -D216103C 00000005 -3DC08023 89EE876A -39CE82F8 1DEF0118 -7DCF7214 A1EE0026 -7DEF0214 B1EE0026 -901F0180 00000000 -E0000000 80008000 -*This cheat makes the Thwomp Candy Steals coins rather then Destroying - -$Minigame - Attention Grabber: Ship is 5000 Units Away -48000000 800030C8 -DE000000 80008180 -300091D0 46A02800 -140091D4 459C4000 -E0000000 80008000 -*This cheat makes it so Attention Grabber is more balanced - -$Minigame - Lob to Rob: All Targets Worth 30 Points -48000000 800030C8 -DE000000 80008180 -3000CBD4 80010008 -1400CBD4 3800001E -E0000000 80008000 -*This cheat makes it so Lob to Rob is more balanced - -$Minigame - Rudder Madness: Double Rudder Speed +$Mechanics - Thwomp Candy Steals Coins [gamemasterplc] +48000000 800030c8 +de000000 80008180 +30159750 408202e4 +d2159868 00000005 +3dc08023 89ee876a +39ce82f8 1def0118 +7dcf7214 a1ee0026 +7def0214 b1ee0026 +901f0180 00000000 +e0000000 80008000 +48000000 800030c8 +de000000 80008180 +301648ac 408202e4 +d21649c4 00000005 +3dc08023 89ee876a +39ce82f8 1def0118 +7dcf7214 a1ee0026 +7def0214 b1ee0026 +901f0180 00000000 +e0000000 80008000 +48000000 800030c8 +de000000 80008180 +30180554 408202e4 +d218066c 00000005 +3dc08023 89ee876a +39ce82f8 1def0118 +7dcf7214 a1ee0026 +7def0214 b1ee0026 +901f0180 00000000 +e0000000 80008000 +48000000 800030c8 +de000000 80008180 +3015e168 408202e4 +d215e280 00000005 +3dc08023 89ee876a +39ce82f8 1def0118 +7dcf7214 a1ee0026 +7def0214 b1ee0026 +901f0180 00000000 +e0000000 80008000 +48000000 800030c8 +de000000 80008180 +3015bb2c 408202e4 +d215bc44 00000005 +3dc08023 89ee876a +39ce82f8 1def0118 +7dcf7214 a1ee0026 +7def0214 b1ee0026 +901f0180 00000000 +e0000000 80008000 +48000000 800030c8 +de000000 80008180 +30160f24 408202e4 +d216103c 00000005 +3dc08023 89ee876a +39ce82f8 1def0118 +7dcf7214 a1ee0026 +7def0214 b1ee0026 +901f0180 00000000 +e0000000 80008000 +*Thwomp Candy steals coins rather than destroying them. + +$Minigame - Attention Grabber: Ship is 5000 Units Away [gamemasterplc] +48000000 800030c8 +de000000 80008180 +300091d0 46a02800 +140091d4 459c4000 +e0000000 80008000 +*Ship is closer in the minigame Attention Grabber. + +$Minigame - Cosmic Slalom: Infinite Boosts [gamemasterplc] +48000000 800030c8 +de000000 80008180 +30012d2c 2c000000 +14012d54 38030000 +e0000000 80008000 +*Carry Infinite Boosts instad of 3 in the minigame Cosmic Slalom + +$Minigame - Lob to Rob: All Targets Worth 30 Points [gamemasterplc] +48000000 800030c8 +de000000 80008180 +3000cbd4 80010008 +1400cbd4 3800001e +e0000000 80008000 +*Targets are worth 30 points in the minigame Lob to Rob. + +$Minigame - Rudder Madness: Double Rudder Speed [gamemasterplc] 48000000 800030c8 de000000 80008180 3000abdc 807e005c @@ -671,20 +544,52 @@ d200abd8 00000003 c3ff0060 ec1f0032 efe1002a 00000000 e0000000 80008000 -*This cheat makes it so Rudder Madness is more balanced - -$Minigame - Cosmic Slalom: Infinite Boosts -48000000 800030C8 -DE000000 80008180 -30012D2C 2C000000 -14012D54 38030000 -E0000000 80008000 -*This cheat makes it so Cosmic Slalom is more balanced - -$Minigame - Surf's Way Up: All Targets Worth 100 Points -48000000 800030C8 -DE000000 80008180 -3000B34C 881E0000 -1400B348 3BA00064 -E0000000 80008000 -*This cheat makes it so Surfs Way Up is more balanced +*Rudders mode faster in the minigame Rudder Madness. + +$Minigame - Surf's Way Up: All Targets Worth 100 Points [gamemasterplc] +48000000 800030c8 +de000000 80008180 +3000b34c 881e0000 +1400b348 3ba00064 +e0000000 80008000 +*Targets are worth 100 points in the minigame Surf's Way Up. + +$Minigame Replacement - Bob-ombs Away ➜ Power Trip [gamemasterplc] +282287CC 00000012 +022287CC 00000011 +E2000001 80008000 + +$Minigame Replacement - Cardiators ➜ Frozen Assets [gamemasterplc] +282287CC 00000039 +022287CC 00000031 +E2000001 80008000 + +$Minigame Replacement - Cut from the Team ➜ Snipe for the Picking [gamemasterplc] +282287CC 00000024 +022287CC 00000025 +E2000001 80008000 + +$Minigame Replacement - Glacial Meltdown ➜ Saucer Swarm [gamemasterplc] +282287CC 00000027 +022287CC 00000026 +E2000001 80008000 + +$Minigame Replacement - Gun the Runner ➜ Snow Way Out [gamemasterplc] +282287cc 0000000f +022287cc 00000015 +e2000001 80008000 + +$Minigame Replacement - Specter Inspector ➜ Loco Motives [gamemasterplc] +282287CC 00000030 +022287CC 0000002F +E2000001 80008000 + +$Minigame Replacement - Thrash 'n' Crash ➜ Swervin' Skies [gamemasterplc] +282287CC 00000016 +022287CC 00000013 +E2000001 80008000 + +$Minigame Replacement - You're the Bob-omb ➜ Lava Lobbers [gamemasterplc] +282287CC 00000037 +022287CC 0000002E +E2000001 80008000 diff --git a/Data/Sys/GameSettings/RMHE08.ini b/Data/Sys/GameSettings/RMHE08.ini index 4e5fd02c12ca..4da564f560c4 100644 --- a/Data/Sys/GameSettings/RMHE08.ini +++ b/Data/Sys/GameSettings/RMHE08.ini @@ -6,8 +6,8 @@ [OnFrame] # Add memory patches to be applied every frame here. $Bloom OFF -0x04056FF4:dword:0xC022FFE4 -0x0479DA84:dword:0x3F800000 +0x80056FF4:dword:0xC022FFE4 +0x8079DA84:dword:0x3F800000 [ActionReplay] # Add action replay cheats here. diff --git a/Data/Sys/GameSettings/RMHJ08.ini b/Data/Sys/GameSettings/RMHJ08.ini index a9698545771f..ea9108648ee7 100644 --- a/Data/Sys/GameSettings/RMHJ08.ini +++ b/Data/Sys/GameSettings/RMHJ08.ini @@ -1,4 +1,4 @@ -# RMHJ08 - MONSTER HUNTER 3 +# RMHJ08 - Monster Hunter Tri [OnLoad] # Add memory patches to be loaded once on boot here. @@ -12,6 +12,3 @@ $Bloom OFF [ActionReplay] # Add action replay cheats here. - -[Video_Settings] -SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/RMHP08.ini b/Data/Sys/GameSettings/RMHP08.ini index 248792da39ea..83850071ac16 100644 --- a/Data/Sys/GameSettings/RMHP08.ini +++ b/Data/Sys/GameSettings/RMHP08.ini @@ -6,8 +6,8 @@ [OnFrame] # Add memory patches to be applied every frame here. $Bloom OFF -0x00057058:dword:0xC022FFE4 -0x0079FF44:dword:0x3F800000 +0x80057058:dword:0xC022FFE4 +0x8079FF44:dword:0x3F800000 [ActionReplay] # Add action replay cheats here. diff --git a/Data/Sys/GameSettings/RNB.ini b/Data/Sys/GameSettings/RNB.ini new file mode 100644 index 000000000000..41e9a1061888 --- /dev/null +++ b/Data/Sys/GameSettings/RNB.ini @@ -0,0 +1,18 @@ +# RNBE69, RNBP69, RNBX69 - NBA Live 08 + +[Core] +# Values set here will override the main Dolphin settings. +CPUThread = False + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. + +[Video_Hacks] +EFBToTextureEnable = False +DeferEFBCopies = False diff --git a/Data/Sys/GameSettings/RNC.ini b/Data/Sys/GameSettings/RNC.ini index 3abfb4f5d207..f69597f11364 100644 --- a/Data/Sys/GameSettings/RNC.ini +++ b/Data/Sys/GameSettings/RNC.ini @@ -1,4 +1,7 @@ # RNCEH4, RNCPH4 - SNK Arcade Classics Volume 1 +[Core] +CPUThread = False + [Video_Settings] SuggestedAspectRatio = 2 diff --git a/Data/Sys/GameSettings/RPF.ini b/Data/Sys/GameSettings/RPF.ini new file mode 100644 index 000000000000..247b835bb5d9 --- /dev/null +++ b/Data/Sys/GameSettings/RPF.ini @@ -0,0 +1,19 @@ +# RPFP52, RPFE52, RPFU52 - Pitfall: The Big Adventure + +[Core] +# Values set here will override the main Dolphin settings. + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. + +[Video_Settings] +# Safe Texture Cache has to be set somewhere between "Safe" and "Medium" +# for the "Pitfall!" and "Lost Cavern" Atari 2600 games to render correctly. +# Otherwise the retro games appear to be stuttering. +SafeTextureCacheColorSamples = 2048 diff --git a/Data/Sys/GameSettings/RPY.ini b/Data/Sys/GameSettings/RPY.ini index 66fb07f01bfc..696c1e206f0e 100644 --- a/Data/Sys/GameSettings/RPY.ini +++ b/Data/Sys/GameSettings/RPY.ini @@ -2,6 +2,7 @@ [Core] # Values set here will override the main Dolphin settings. +FPRF = True [OnLoad] # Add memory patches to be loaded once on boot here. diff --git a/Data/Sys/GameSettings/RST.ini b/Data/Sys/GameSettings/RST.ini new file mode 100644 index 000000000000..3ab01532bdb5 --- /dev/null +++ b/Data/Sys/GameSettings/RST.ini @@ -0,0 +1,16 @@ +# RSTJ52, RSTP64, RSTE64 - Star Wars: The Force Unleashed + +[Core] +# Values set here will override the main Dolphin settings. + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. + +[Video_Hacks] +DeferEFBCopies = False diff --git a/Data/Sys/GameSettings/RT7.ini b/Data/Sys/GameSettings/RT7.ini new file mode 100644 index 000000000000..5912c033cec9 --- /dev/null +++ b/Data/Sys/GameSettings/RT7.ini @@ -0,0 +1,4 @@ +# RT7E69, RT7F69, RT7P69 - Tiger Woods PGA Tour 07 + +[Video_Settings] +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/RTH.ini b/Data/Sys/GameSettings/RTH.ini new file mode 100644 index 000000000000..b9fa18cc3f92 --- /dev/null +++ b/Data/Sys/GameSettings/RTH.ini @@ -0,0 +1,19 @@ +# RTHP52, RTHE52 - Tony Hawk's Downhill Jam + +[Core] +# Values set here will override the main Dolphin settings. + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. + +[Video_Settings] +SafeTextureCacheColorSamples = 0 + +[Video_Hacks] +EFBAccessEnable = False diff --git a/Data/Sys/GameSettings/RUZ.ini b/Data/Sys/GameSettings/RUZ.ini new file mode 100644 index 000000000000..e5a9eb211072 --- /dev/null +++ b/Data/Sys/GameSettings/RUZ.ini @@ -0,0 +1,4 @@ +# RUZE7T - Ultimate I SPY + +[Video_Hacks] +EFBAccessEnable = True \ No newline at end of file diff --git a/Data/Sys/GameSettings/RW7.ini b/Data/Sys/GameSettings/RW7.ini new file mode 100644 index 000000000000..8c284e2dfe2f --- /dev/null +++ b/Data/Sys/GameSettings/RW7.ini @@ -0,0 +1,17 @@ +# RW7E41 - Shaun White Snowboarding: Road Trip - Target Limited Edition + +[Core] +# Values set here will override the main Dolphin settings. + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. + +[Video_Hacks] +EFBToTextureEnable = False +DeferEFBCopies = False diff --git a/Data/Sys/GameSettings/RX4E4Z.ini b/Data/Sys/GameSettings/RX4E4Z.ini index 6a6e25ca91b1..093e76cca6ba 100644 --- a/Data/Sys/GameSettings/RX4E4Z.ini +++ b/Data/Sys/GameSettings/RX4E4Z.ini @@ -24,3 +24,5 @@ # $Fix file reads (dcache bypass) 0x800d2e68:dword:0x60000000 +[OnFrame_Enabled] +$Fix file reads (dcache bypass) diff --git a/Data/Sys/GameSettings/RX4PMT.ini b/Data/Sys/GameSettings/RX4PMT.ini index c8ad7c3ff4fa..d23a80774423 100644 --- a/Data/Sys/GameSettings/RX4PMT.ini +++ b/Data/Sys/GameSettings/RX4PMT.ini @@ -24,3 +24,5 @@ # $Fix file reads (dcache bypass) 0x80164b90:dword:0x60000000 +[OnFrame_Enabled] +$Fix file reads (dcache bypass) diff --git a/Data/Sys/GameSettings/RYB.ini b/Data/Sys/GameSettings/RYB.ini index 41b1b63ef25b..6f908435fedd 100644 --- a/Data/Sys/GameSettings/RYB.ini +++ b/Data/Sys/GameSettings/RYB.ini @@ -15,13 +15,3 @@ SyncGPU = True [Video_Settings] # Add any video settings here - -[Wiimote.Shake] -Soft = 3.0 -Medium = 4.0 -Hard = 4.8 - -[Wiimote.Swing] -Slow = 3.5 -Medium = 4.8 -Fast = 6 \ No newline at end of file diff --git a/Data/Sys/GameSettings/RZDK01.ini b/Data/Sys/GameSettings/RZDK01.ini new file mode 100644 index 000000000000..cc92b01b5d7e --- /dev/null +++ b/Data/Sys/GameSettings/RZDK01.ini @@ -0,0 +1,41 @@ +# RZDK01 - The Legend of Zelda: Twilight Princess [Wii] + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. +$Hyrule Field Speed Hack +0x80047DEC:dword:0x60000000 +0x80047E08:dword:0x60000000 +0x80047E20:dword:0x60000000 +0x80047E3C:dword:0x60000000 + +0x80047E40:dword:0x60000000 +0x80047E44:dword:0x60000000 +0x80047E48:dword:0x60000000 +0x80047E4C:dword:0x60000000 +0x80047E50:dword:0x60000000 +0x80047E54:dword:0x60000000 +0x80047E58:dword:0x60000000 +0x80047E5C:dword:0x60000000 +0x80047E60:dword:0x60000000 +0x80047E64:dword:0x60000000 +0x80047E68:dword:0x60000000 +0x80047E6C:dword:0x60000000 +0x80047E70:dword:0x60000000 +0x80047E74:dword:0x60000000 +0x80047E78:dword:0x60000000 +0x80047E7C:dword:0x60000000 +0x80047E80:dword:0x60000000 +0x80047E84:dword:0x60000000 +0x80047E88:dword:0x60000000 +0x80047E8C:dword:0x60000000 + +0x80047E94:dword:0x60000000 +0x80047EB0:dword:0x60000000 +0x80047EC8:dword:0x60000000 +0x80047EE4:dword:0x60000000 + +[ActionReplay] +# Add action replay cheats here. diff --git a/Data/Sys/GameSettings/S25.ini b/Data/Sys/GameSettings/S25.ini new file mode 100644 index 000000000000..88e5f1a2811b --- /dev/null +++ b/Data/Sys/GameSettings/S25.ini @@ -0,0 +1,9 @@ +# S25JGD - Dragon Quest 25 Shuunen Kinen: Famicom & Super Famicom Dragon Quest I-II-III + +[Video_Settings] +# Fixes cursor freeze. +SafeTextureCacheColorSamples = 0 + +[Video_Hacks] +# Fixes black screen. +EFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/S2D.ini b/Data/Sys/GameSettings/S2D.ini new file mode 100644 index 000000000000..c0ee2f07a379 --- /dev/null +++ b/Data/Sys/GameSettings/S2D.ini @@ -0,0 +1,4 @@ +# S2DPML - Dance! It's Your Stage + +[Core] +CPUThread = False diff --git a/Data/Sys/GameSettings/SAOE78.ini b/Data/Sys/GameSettings/SAOE78.ini new file mode 100644 index 000000000000..190419f79ce3 --- /dev/null +++ b/Data/Sys/GameSettings/SAOE78.ini @@ -0,0 +1,9 @@ +# SAOE78 - Monster High: Ghoul Spirit + +[OnFrame] +# The first call to GXCopyDisp() corrupts game data, but on real hardware +# it isn't observed thanks to the data cache. Skipping the call works too. +$Fix crash on boot +0x803A5F20:dword:0x60000000 +[OnFrame_Enabled] +$Fix crash on boot diff --git a/Data/Sys/GameSettings/SAOEVZ.ini b/Data/Sys/GameSettings/SAOEVZ.ini new file mode 100644 index 000000000000..a737692c5b5f --- /dev/null +++ b/Data/Sys/GameSettings/SAOEVZ.ini @@ -0,0 +1,9 @@ +# SAOEVZ - Monster High: Ghoul Spirit + +[OnFrame] +# The first call to GXCopyDisp() corrupts game data, but on real hardware +# it isn't observed thanks to the data cache. Skipping the call works too. +$Fix crash on boot +0x803A64D0:dword:0x60000000 +[OnFrame_Enabled] +$Fix crash on boot diff --git a/Data/Sys/GameSettings/SBK.ini b/Data/Sys/GameSettings/SBK.ini new file mode 100644 index 000000000000..f5dc3b50b748 --- /dev/null +++ b/Data/Sys/GameSettings/SBK.ini @@ -0,0 +1,4 @@ +# SBKEPZ - Brunswick Zone: Cosmic Bowling + +[Video_Hacks] +ImmediateXFBEnable = False diff --git a/Data/Sys/GameSettings/SDV.ini b/Data/Sys/GameSettings/SDV.ini new file mode 100644 index 000000000000..0c143d76ae10 --- /dev/null +++ b/Data/Sys/GameSettings/SDV.ini @@ -0,0 +1,5 @@ +# SDVP41, SDVE41 - Driver: San Francisco + +[Video_Settings] +# Needed for comic book images to load +SafeTextureCacheColorSamples = 512 diff --git a/Data/Sys/GameSettings/SE2.ini b/Data/Sys/GameSettings/SE2.ini index 5b4aaf8f9d99..d91614ee3393 100644 --- a/Data/Sys/GameSettings/SE2.ini +++ b/Data/Sys/GameSettings/SE2.ini @@ -18,3 +18,6 @@ SafeTextureCacheColorSamples = 512 [Video_Enhancements] ForceFiltering = False +[Video_Hacks] +# Needed to correctly render clothing +EFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/E6M.ini b/Data/Sys/GameSettings/SEC.ini similarity index 81% rename from Data/Sys/GameSettings/E6M.ini rename to Data/Sys/GameSettings/SEC.ini index b782f5e8d556..8c735964eebb 100644 --- a/Data/Sys/GameSettings/E6M.ini +++ b/Data/Sys/GameSettings/SEC.ini @@ -1,4 +1,4 @@ -# E6ME9B - TECMO BOWL +# SECP69, SECE69 - Create [Core] # Values set here will override the main Dolphin settings. @@ -14,3 +14,6 @@ [Video_Settings] SafeTextureCacheColorSamples = 0 + +[Video_Hacks] +EFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/SEU.ini b/Data/Sys/GameSettings/SEU.ini new file mode 100644 index 000000000000..68f027da3fb2 --- /dev/null +++ b/Data/Sys/GameSettings/SEU.ini @@ -0,0 +1,4 @@ +# SEUPEY - Retro City Rampage DX+ + +[Video_Settings] +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/SEV.ini b/Data/Sys/GameSettings/SEV.ini new file mode 100644 index 000000000000..e19365d4e119 --- /dev/null +++ b/Data/Sys/GameSettings/SEV.ini @@ -0,0 +1,4 @@ +# SEVPEY - Shakedown: Hawaii + +[Video_Settings] +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/SGX.ini b/Data/Sys/GameSettings/SGX.ini new file mode 100644 index 000000000000..dfa3c720722f --- /dev/null +++ b/Data/Sys/GameSettings/SGX.ini @@ -0,0 +1,4 @@ +# SGXP41, SGXE41 - Battle of Giants: Dinosaurs Strike + +[Video_Hacks] +EFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/SHP.ini b/Data/Sys/GameSettings/SHP.ini new file mode 100644 index 000000000000..949d8d3dfed9 --- /dev/null +++ b/Data/Sys/GameSettings/SHP.ini @@ -0,0 +1,5 @@ +# SHPE5G - Our House: Party! + +[Video_Hacks] +# Needed for drawing minigames +EFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/SJC.ini b/Data/Sys/GameSettings/SJC.ini index 0ebd49cd7c04..a96952e28151 100644 --- a/Data/Sys/GameSettings/SJC.ini +++ b/Data/Sys/GameSettings/SJC.ini @@ -1,4 +1,5 @@ # SJCEZW - Jerry Rice & Nitus' Dog Football [Video_Settings] +SafeTextureCacheColorSamples = 0 SuggestedAspectRatio = 2 diff --git a/Data/Sys/GameSettings/SM2.ini b/Data/Sys/GameSettings/SM2.ini new file mode 100644 index 000000000000..1bbfbde77234 --- /dev/null +++ b/Data/Sys/GameSettings/SM2.ini @@ -0,0 +1,5 @@ +# SM2P52, SM2E52 - 10 Minute Solution + +[Video_Settings] +# Fixes mangled font +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/SMN.ini b/Data/Sys/GameSettings/SMN.ini index 139cf28fb448..85e4ec9e9184 100644 --- a/Data/Sys/GameSettings/SMN.ini +++ b/Data/Sys/GameSettings/SMN.ini @@ -12,9 +12,6 @@ [ActionReplay] # Add action replay cheats here. -[Video_Settings] -SafeTextureCacheColorSamples = 512 - [Video_Hacks] [Video_Stereoscopy] diff --git a/Data/Sys/GameSettings/SNQ.ini b/Data/Sys/GameSettings/SNQ.ini new file mode 100644 index 000000000000..ae9dec921583 --- /dev/null +++ b/Data/Sys/GameSettings/SNQ.ini @@ -0,0 +1,4 @@ +# SNQE7U, SNQPLG - National Geographic Challenge! + +[Core] +CPUThread = False diff --git a/Data/Sys/GameSettings/SOM.ini b/Data/Sys/GameSettings/SOM.ini index 1b29c25d3272..bb59fb9c4b28 100644 --- a/Data/Sys/GameSettings/SOM.ini +++ b/Data/Sys/GameSettings/SOM.ini @@ -12,11 +12,6 @@ [ActionReplay] # Add action replay cheats here. -[Video] - -[Video_Settings] - [Video_Hacks] ImmediateXFBEnable = False - -[Video_Enhancements] \ No newline at end of file +EFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/SP7.ini b/Data/Sys/GameSettings/SP7.ini new file mode 100644 index 000000000000..9534891199de --- /dev/null +++ b/Data/Sys/GameSettings/SP7.ini @@ -0,0 +1,4 @@ +# SP7PAF, SP7EAF, SP7JAF - Pac-Man Party + +[Video_Hacks] +EFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/STN.ini b/Data/Sys/GameSettings/STN.ini new file mode 100644 index 000000000000..81c498ab806b --- /dev/null +++ b/Data/Sys/GameSettings/STN.ini @@ -0,0 +1,5 @@ +# STNE41, STNP41 - The Adventures of Tintin: The Game + +[Video_Settings] +# Fixes glitching in opening credits. +SafeTextureCacheColorSamples = 512 diff --git a/Data/Sys/GameSettings/SU4.ini b/Data/Sys/GameSettings/SU4.ini new file mode 100644 index 000000000000..8cc6e09860e8 --- /dev/null +++ b/Data/Sys/GameSettings/SU4.ini @@ -0,0 +1,4 @@ +# SU4P78, SU4E78 - UFC Personal Trainer: The Ultimate Fitness System + +[Video_Hacks] +SafeTextureCacheColorSamples = 512 diff --git a/Data/Sys/GameSettings/SVM.ini b/Data/Sys/GameSettings/SVM.ini index e4d69ea546de..ea94d7e7abf5 100644 --- a/Data/Sys/GameSettings/SVM.ini +++ b/Data/Sys/GameSettings/SVM.ini @@ -1,4 +1,4 @@ -# SVME01, SVMJ01, SVMP01 - super mario collection +# SVME01, SVMJ01, SVMP01 - Super Mario All-Stars: 25th Anniversary Edition [Core] # Values set here will override the main Dolphin settings. @@ -12,6 +12,8 @@ [ActionReplay] # Add action replay cheats here. +[Video_Settings] +SafeTextureCacheColorSamples = 0 + [Video_Hacks] EFBToTextureEnable = False - diff --git a/Data/Sys/GameSettings/WL9.ini b/Data/Sys/GameSettings/WL9.ini new file mode 100644 index 000000000000..83dae83b5a2d --- /dev/null +++ b/Data/Sys/GameSettings/WL9.ini @@ -0,0 +1,16 @@ +# WL9EYD - Let's Create! Pottery + +[Core] +# Values set here will override the main Dolphin settings. + +[OnLoad] +# Add memory patches to be loaded once on boot here. + +[OnFrame] +# Add memory patches to be applied every frame here. + +[ActionReplay] +# Add action replay cheats here. + +[Video_Hacks] +EFBToTextureEnable = False diff --git a/Data/Sys/GameSettings/WW2.ini b/Data/Sys/GameSettings/WW2.ini index edcc72b00d9a..e0c69b08f3af 100644 --- a/Data/Sys/GameSettings/WW2.ini +++ b/Data/Sys/GameSettings/WW2.ini @@ -2,3 +2,7 @@ [Video_Settings] SuggestedAspectRatio = 2 + +[Video_Hacks] +XFBToTextureEnable = False +ImmediateXFBenable = False diff --git a/Data/Sys/GameSettings/WW3.ini b/Data/Sys/GameSettings/WW3.ini index d1b95c295fd9..77914a0e28f7 100644 --- a/Data/Sys/GameSettings/WW3.ini +++ b/Data/Sys/GameSettings/WW3.ini @@ -2,3 +2,7 @@ [Video_Settings] SuggestedAspectRatio = 2 + +[Video_Hacks] +XFBToTextureEnable = False +ImmediateXFBenable = False diff --git a/Data/Sys/GameSettings/WWI.ini b/Data/Sys/GameSettings/WWI.ini index adcb673844ea..38333161946f 100644 --- a/Data/Sys/GameSettings/WWI.ini +++ b/Data/Sys/GameSettings/WWI.ini @@ -2,3 +2,7 @@ [Video_Settings] SuggestedAspectRatio = 2 + +[Video_Hacks] +XFBToTextureEnable = False +ImmediateXFBenable = False diff --git a/Data/Sys/GameSettings/XAA.ini b/Data/Sys/GameSettings/XAA.ini new file mode 100644 index 000000000000..6f412d78b43f --- /dev/null +++ b/Data/Sys/GameSettings/XAA.ini @@ -0,0 +1,5 @@ +# XAAJJ8 - Eggy + +[Video_Settings] +# Fixes graphical glitches +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/XAB.ini b/Data/Sys/GameSettings/XAB.ini new file mode 100644 index 000000000000..83cb63544637 --- /dev/null +++ b/Data/Sys/GameSettings/XAB.ini @@ -0,0 +1,5 @@ +# XABJJ8 - Aleste + +[Video_Settings] +# Fixes graphical glitches +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/XAD.ini b/Data/Sys/GameSettings/XAD.ini new file mode 100644 index 000000000000..c288b0c7da60 --- /dev/null +++ b/Data/Sys/GameSettings/XAD.ini @@ -0,0 +1,5 @@ +# XADJJ8 - Yie-Gah-kōtei no Gyakushū: Yie Ar Kung-Fu 2 + +[Video_Settings] +# Fixes graphical glitches +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/XAE.ini b/Data/Sys/GameSettings/XAE.ini new file mode 100644 index 000000000000..eedd119d6d5e --- /dev/null +++ b/Data/Sys/GameSettings/XAE.ini @@ -0,0 +1,5 @@ +# XAEJJ8 - Space Manbow + +[Video_Settings] +# Fixes graphical glitches +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/XAF.ini b/Data/Sys/GameSettings/XAF.ini new file mode 100644 index 000000000000..a287fa43994e --- /dev/null +++ b/Data/Sys/GameSettings/XAF.ini @@ -0,0 +1,5 @@ +# XAFJJ8 - Metal Gear (MSX) + +[Video_Settings] +# Fixes graphical glitches +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/XAG.ini b/Data/Sys/GameSettings/XAG.ini new file mode 100644 index 000000000000..f69982c8b77b --- /dev/null +++ b/Data/Sys/GameSettings/XAG.ini @@ -0,0 +1,5 @@ +# XAGJJ8 - Road Fighter + +[Video_Settings] +# Fixes graphical glitches +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/XAH.ini b/Data/Sys/GameSettings/XAH.ini new file mode 100644 index 000000000000..cdcee70bd03f --- /dev/null +++ b/Data/Sys/GameSettings/XAH.ini @@ -0,0 +1,5 @@ +# XAHJJ8 - Yumetairiku Adventure + +[Video_Settings] +# Fixes graphical glitches +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/XAI.ini b/Data/Sys/GameSettings/XAI.ini new file mode 100644 index 000000000000..489ec44dc676 --- /dev/null +++ b/Data/Sys/GameSettings/XAI.ini @@ -0,0 +1,5 @@ +# XAIJJ8 - Quarth + +[Video_Settings] +# Fixes graphical glitches +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/XAK.ini b/Data/Sys/GameSettings/XAK.ini new file mode 100644 index 000000000000..7c3122d79d9a --- /dev/null +++ b/Data/Sys/GameSettings/XAK.ini @@ -0,0 +1,5 @@ +# XAKJJ8 - Parodius: Tako wa Chikyū wo Sukū + +[Video_Settings] +# Fixes graphical glitches +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/XAL.ini b/Data/Sys/GameSettings/XAL.ini new file mode 100644 index 000000000000..56a231fe6861 --- /dev/null +++ b/Data/Sys/GameSettings/XAL.ini @@ -0,0 +1,5 @@ +# XALJJ8 - Contra + +[Video_Settings] +# Fixes graphical glitches +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/XAM.ini b/Data/Sys/GameSettings/XAM.ini new file mode 100644 index 000000000000..a157ccd9ef29 --- /dev/null +++ b/Data/Sys/GameSettings/XAM.ini @@ -0,0 +1,5 @@ +# XAMJJ8 - Knightmare: Majou Densetsu + +[Video_Settings] +# Fixes graphical glitches +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/XAN.ini b/Data/Sys/GameSettings/XAN.ini new file mode 100644 index 000000000000..48d15b5b1cac --- /dev/null +++ b/Data/Sys/GameSettings/XAN.ini @@ -0,0 +1,5 @@ +# XANJJ8 - Gradius 2 (MSX) + +[Video_Settings] +# Fixes graphical glitches +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/XAO.ini b/Data/Sys/GameSettings/XAO.ini new file mode 100644 index 000000000000..5493da394147 --- /dev/null +++ b/Data/Sys/GameSettings/XAO.ini @@ -0,0 +1,5 @@ +# XAOJJ8 - Gofer no Yabou: Episode II + +[Video_Settings] +# Fixes graphical glitches +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/XAP.ini b/Data/Sys/GameSettings/XAP.ini new file mode 100644 index 000000000000..2d9301510021 --- /dev/null +++ b/Data/Sys/GameSettings/XAP.ini @@ -0,0 +1,5 @@ +# XAPJJ8 - Metal Gear 2: Solid Snake + +[Video_Settings] +# Fixes graphical glitches +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/XAQ.ini b/Data/Sys/GameSettings/XAQ.ini new file mode 100644 index 000000000000..fcb2411fec25 --- /dev/null +++ b/Data/Sys/GameSettings/XAQ.ini @@ -0,0 +1,5 @@ +# XAQJJ8 - Salamander (MSX) + +[Video_Settings] +# Fixes graphical glitches +SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/Profiles/Wiimote/Wii Remote with MotionPlus Pointing.ini b/Data/Sys/Profiles/Wiimote/Wii Remote with MotionPlus Pointing.ini new file mode 100644 index 000000000000..408c2ed0b403 --- /dev/null +++ b/Data/Sys/Profiles/Wiimote/Wii Remote with MotionPlus Pointing.ini @@ -0,0 +1,71 @@ +[Profile] +Device = Bluetooth/0/Wii Remote +Buttons/A = `A` +Buttons/B = `B` +Buttons/1 = `1` +Buttons/2 = `2` +Buttons/- = `-` +Buttons/+ = `+` +Buttons/Home = `HOME` +IMUAccelerometer/Up = `Accel Up` +IMUAccelerometer/Down = `Accel Down` +IMUAccelerometer/Left = `Accel Left` +IMUAccelerometer/Right = `Accel Right` +IMUAccelerometer/Forward = `Accel Forward` +IMUAccelerometer/Backward = `Accel Backward` +IMUGyroscope/Dead Zone = 3 +IMUGyroscope/Pitch Up = `Gyro Pitch Up` +IMUGyroscope/Pitch Down = `Gyro Pitch Down` +IMUGyroscope/Roll Left = `Gyro Roll Left` +IMUGyroscope/Roll Right = `Gyro Roll Right` +IMUGyroscope/Yaw Left = `Gyro Yaw Left` +IMUGyroscope/Yaw Right = `Gyro Yaw Right` +IMUIR/Enabled = True +Extension/Attach MotionPlus = `Attached MotionPlus` +Extension = `Attached Extension` +Nunchuk/Buttons/C = `Nunchuk C` +Nunchuk/Buttons/Z = `Nunchuk Z` +Nunchuk/Stick/Up = `Nunchuk Y+` +Nunchuk/Stick/Down = `Nunchuk Y-` +Nunchuk/Stick/Left = `Nunchuk X-` +Nunchuk/Stick/Right = `Nunchuk X+` +Nunchuk/Stick/Calibration = 100 100 100 100 100 100 100 100 +Nunchuk/IMUAccelerometer/Up = `Nunchuk Accel Up` +Nunchuk/IMUAccelerometer/Down = `Nunchuk Accel Down` +Nunchuk/IMUAccelerometer/Left = `Nunchuk Accel Left` +Nunchuk/IMUAccelerometer/Right = `Nunchuk Accel Right` +Nunchuk/IMUAccelerometer/Forward = `Nunchuk Accel Forward` +Nunchuk/IMUAccelerometer/Backward = `Nunchuk Accel Backward` +Classic/Buttons/A = `Classic A` +Classic/Buttons/B = `Classic B` +Classic/Buttons/X = `Classic X` +Classic/Buttons/Y = `Classic Y` +Classic/Buttons/ZL = `Classic ZL` +Classic/Buttons/ZR = `Classic ZR` +Classic/Buttons/- = `Classic -` +Classic/Buttons/+ = `Classic +` +Classic/Buttons/Home = `Classic HOME` +Classic/Left Stick/Up = `Classic Left Y+` +Classic/Left Stick/Down = `Classic Left Y-` +Classic/Left Stick/Left = `Classic Left X-` +Classic/Left Stick/Right = `Classic Left X+` +Classic/Left Stick/Calibration = 100 100 100 100 100 100 100 100 +Classic/Right Stick/Up = `Classic Right Y+` +Classic/Right Stick/Down = `Classic Right Y-` +Classic/Right Stick/Left = `Classic Right X-` +Classic/Right Stick/Right = `Classic Right X+` +Classic/Right Stick/Calibration = 100 100 100 100 100 100 100 100 +Classic/Triggers/L = `Classic L` +Classic/Triggers/R = `Classic R` +Classic/Triggers/L-Analog = `Classic L-Analog` +Classic/Triggers/R-Analog = `Classic R-Analog` +Classic/D-Pad/Up = `Classic Up` +Classic/D-Pad/Down = `Classic Down` +Classic/D-Pad/Left = `Classic Left` +Classic/D-Pad/Right = `Classic Right` +Rumble/Motor = `Motor` +D-Pad/Up = `Up` +D-Pad/Down = `Down` +D-Pad/Left = `Left` +D-Pad/Right = `Right` +Options/Battery = `Battery` diff --git a/Data/Sys/Shaders/asciiart.glsl b/Data/Sys/Shaders/asciiart.glsl deleted file mode 100644 index 52fec3da6d36..000000000000 --- a/Data/Sys/Shaders/asciiart.glsl +++ /dev/null @@ -1,91 +0,0 @@ -const int char_width = 8; -const int char_height = 13; -const int char_count = 95; -const int char_pixels = char_width*char_height; -const float2 char_dim = float2(char_width, char_height); -const float2 font_scale = float2(1.0/float(char_width)/float(char_count), 1.0/float(char_height)); - -void main() -{ - float2 char_pos = floor(GetCoordinates()*GetResolution()/char_dim); - float2 pixel_offset = floor(GetCoordinates()*GetResolution()) - char_pos*char_dim; - - // just a big number - float mindiff = float(char_width*char_height) * 100.0; - - float minc = 0.0; - float4 mina = float4(0.0, 0.0, 0.0, 0.0); - float4 minb = float4(0.0, 0.0, 0.0, 0.0); - - for (int i=0; i - - - - Debug - ARM64 - - - Debug - x64 - - - Release - ARM64 - - - Release - x64 - - + + + {8ADA04D7-6DB1-4DA4-AB55-64FB12A0997B} - 10.0 - - StaticLibrary - v142 - Unicode - - - true - - - false - + - - + - - + + diff --git a/Externals/ExternalsReferenceAll.props b/Externals/ExternalsReferenceAll.props new file mode 100644 index 000000000000..0d7de6fecd80 --- /dev/null +++ b/Externals/ExternalsReferenceAll.props @@ -0,0 +1,89 @@ + + + + + {D79392F7-06D6-4B4B-A39F-4D587C215D3A} + + + {41279555-f94f-4ebc-99de-af863c10c5c4} + + + {0e033be3-2e08-428e-9ae9-bc673efa12b5} + + + {8ada04d7-6db1-4da4-ab55-64fb12a0997b} + + + {1d8c51d2-ffa4-418e-b183-9f42b6a6717e} + + + {c636d9d1-82fe-42b5-9987-63b7d4836341} + + + {8ea11166-6512-44fc-b7a5-a4d1ecc81170} + + + {bb00605c-125f-4a21-b33b-7bf418322dcb} + + + {4482fd2a-ec43-3ffb-ac20-2e5c54b05ead} + + + {5bdf4b91-1491-4fb0-bc27-78e9a8e97dc3} + + + {cbc76802-c128-4b17-bf6c-23b08c313e5e} + + + {8498f2fa-5ca6-4169-9971-de5b1fe6132c} + + + {d178061b-84d3-44f9-beed-efd18d9033f0} + + + {4c3b2264-ea73-4a7b-9cfe-65b0fd635ebb} + + + {055a775f-b4f5-4970-9240-f6cf7661f37b} + + + {4c9f135b-a85e-430c-bad4-4c67ef5fc12c} + + + {349ee8f9-7d25-4909-aaf5-ff3fade72187} + + + {ab993f38-c31d-4897-b139-a620c42bc565} + + + {bdb6578b-0691-4e80-a46c-df21639fd3b8} + + + {31643fdb-1bb8-4965-9de7-000fc88d35ae} + + + {23114507-079a-4418-9707-cfa81a03ca99} + + + {2c0d058e-de35-4471-ad99-e68a2caf9e18} + + + {38fee76f-f347-484b-949c-b4649381cffb} + + + {93d73454-2512-424e-9cda-4bb357fe13dd} + + + {ec082900-b4d8-42e9-9663-77f02f6936ae} + + + {677ea016-1182-440c-9345-dc88d1e98c0c} + + + {ff213b23-2c26-4214-9f88-85271e557e87} + + + {1bea10f3-80ce-4bc4-9331-5769372cdf99} + + + diff --git a/Externals/FreeSurround/FreeSurround.vcxproj b/Externals/FreeSurround/FreeSurround.vcxproj index e94b3781e58f..cfc29e5dc25b 100644 --- a/Externals/FreeSurround/FreeSurround.vcxproj +++ b/Externals/FreeSurround/FreeSurround.vcxproj @@ -1,46 +1,18 @@  - - - - Debug - ARM64 - - - Debug - x64 - - - Release - ARM64 - - - Release - x64 - - + + + {8498F2FA-5CA6-4169-9971-DE5B1FE6132C} - 10.0 - - StaticLibrary - v142 - Unicode - - - true - - - false - + - - + - - + + diff --git a/Externals/LZO/LZO.vcxproj b/Externals/LZO/LZO.vcxproj index 83af62194229..fd30576fe3d3 100644 --- a/Externals/LZO/LZO.vcxproj +++ b/Externals/LZO/LZO.vcxproj @@ -1,46 +1,18 @@  - - - - Debug - ARM64 - - - Debug - x64 - - - Release - ARM64 - - - Release - x64 - - + + + {AB993F38-C31D-4897-B139-A620C42BC565} - 10.0 - - StaticLibrary - v142 - Unicode - - - true - - - false - + - - + - - + + diff --git a/Externals/MoltenVK/libvulkan.dylib b/Externals/MoltenVK/libvulkan.dylib index 4860478731c3..efb0db74b867 100755 Binary files a/Externals/MoltenVK/libvulkan.dylib and b/Externals/MoltenVK/libvulkan.dylib differ diff --git a/Externals/MoltenVK/version.txt b/Externals/MoltenVK/version.txt index 622f36d60ea3..9f1cd7fc3dad 100644 --- a/Externals/MoltenVK/version.txt +++ b/Externals/MoltenVK/version.txt @@ -1,3 +1 @@ -MoltenVK/macOS/dynamic/libMoltenVK.dylib from vulkansdk-macos-1.2.131.2, renamed to libvulkan.dylib - -Downloaded from: https://sdk.lunarg.com/sdk/download/1.2.131.2/mac/vulkansdk-macos-1.2.131.2.tar.gz +MoltenVK from https://github.com/KhronosGroup/MoltenVK, commit b9b78def172074872bfbb1015ccf75eeec554ae2 diff --git a/Externals/OpenXR/OpenXR.vcxproj b/Externals/OpenXR/OpenXR.vcxproj new file mode 100644 index 000000000000..7f00e60927c7 --- /dev/null +++ b/Externals/OpenXR/OpenXR.vcxproj @@ -0,0 +1,98 @@ + + + + + Debug + x64 + + + Release + x64 + + + + + + + + + + 10.0 + {DF3A8E77-C1FA-4FFB-A2FD-CBF927573698} + + + + Utility + v142 + Unicode + + + true + + + false + + + + + + + + + + + + $(VC_IncludePath);$(WindowsSDK_IncludePath); + + + + + $(VC_IncludePath);$(WindowsSDK_IncludePath); + + + + + + + + + + + + true + + + + + + + xcopy "$(ProjectDir)native\x64\release\bin\openxr_loader.dll" "$(BinaryOutputDir)" /y + $(BinaryOutputDir)openxr_loader.dll + $(ProjectDir)native\x64\release\bin\openxr_loader.dll + Copying openxr_loader.dll + + + + + + + + + + + + + + + + + xcopy "$(ProjectDir)native\x64\release\bin\openxr_loader.dll" "$(BinaryOutputDir)" /y + $(BinaryOutputDir)openxr_loader.dll + $(ProjectDir)native\x64\release\bin\openxr_loader.dll + Copying openxr_loader.dll + + + + + + \ No newline at end of file diff --git a/Externals/OpenXR/include/openxr/openxr.h b/Externals/OpenXR/include/openxr/openxr.h new file mode 100644 index 000000000000..b99817733418 --- /dev/null +++ b/Externals/OpenXR/include/openxr/openxr.h @@ -0,0 +1,2389 @@ +#ifndef OPENXR_H_ +#define OPENXR_H_ 1 + +/* +** Copyright (c) 2017-2021, The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 OR MIT +*/ + +/* +** This header is generated from the Khronos OpenXR XML API Registry. +** +*/ + + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define XR_VERSION_1_0 1 +#include "openxr_platform_defines.h" +#define XR_MAKE_VERSION(major, minor, patch) \ + ((((major) & 0xffffULL) << 48) | (((minor) & 0xffffULL) << 32) | ((patch) & 0xffffffffULL)) + +// OpenXR current version number. +#define XR_CURRENT_API_VERSION XR_MAKE_VERSION(1, 0, 15) + +#define XR_VERSION_MAJOR(version) (uint16_t)(((uint64_t)(version) >> 48)& 0xffffULL) +#define XR_VERSION_MINOR(version) (uint16_t)(((uint64_t)(version) >> 32) & 0xffffULL) +#define XR_VERSION_PATCH(version) (uint32_t)((uint64_t)(version) & 0xffffffffULL) + +#if !defined(XR_NULL_HANDLE) +#if (XR_PTR_SIZE == 8) && XR_CPP_NULLPTR_SUPPORTED + #define XR_NULL_HANDLE nullptr +#else + #define XR_NULL_HANDLE 0 +#endif +#endif + + + +#define XR_NULL_SYSTEM_ID 0 + + +#define XR_NULL_PATH 0 + + +#define XR_SUCCEEDED(result) ((result) >= 0) + + +#define XR_FAILED(result) ((result) < 0) + + +#define XR_UNQUALIFIED_SUCCESS(result) ((result) == 0) + + +#define XR_NO_DURATION 0 + + +#define XR_INFINITE_DURATION 0x7fffffffffffffffLL + + +#define XR_MIN_HAPTIC_DURATION -1 + + +#define XR_FREQUENCY_UNSPECIFIED 0 + + +#define XR_MAX_EVENT_DATA_SIZE sizeof(XrEventDataBuffer) + + +#if !defined(XR_MAY_ALIAS) +#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 4)) +#define XR_MAY_ALIAS __attribute__((__may_alias__)) +#else +#define XR_MAY_ALIAS +#endif +#endif + + +#if !defined(XR_DEFINE_HANDLE) +#if (XR_PTR_SIZE == 8) + #define XR_DEFINE_HANDLE(object) typedef struct object##_T* object; +#else + #define XR_DEFINE_HANDLE(object) typedef uint64_t object; +#endif +#endif + + + +#if !defined(XR_DEFINE_ATOM) + #define XR_DEFINE_ATOM(object) typedef uint64_t object; +#endif + + +typedef uint64_t XrVersion; +typedef uint64_t XrFlags64; +XR_DEFINE_ATOM(XrSystemId) +typedef uint32_t XrBool32; +XR_DEFINE_ATOM(XrPath) +typedef int64_t XrTime; +typedef int64_t XrDuration; +XR_DEFINE_HANDLE(XrInstance) +XR_DEFINE_HANDLE(XrSession) +XR_DEFINE_HANDLE(XrSpace) +XR_DEFINE_HANDLE(XrAction) +XR_DEFINE_HANDLE(XrSwapchain) +XR_DEFINE_HANDLE(XrActionSet) +#define XR_TRUE 1 +#define XR_FALSE 0 +#define XR_MAX_EXTENSION_NAME_SIZE 128 +#define XR_MAX_API_LAYER_NAME_SIZE 256 +#define XR_MAX_API_LAYER_DESCRIPTION_SIZE 256 +#define XR_MAX_SYSTEM_NAME_SIZE 256 +#define XR_MAX_APPLICATION_NAME_SIZE 128 +#define XR_MAX_ENGINE_NAME_SIZE 128 +#define XR_MAX_RUNTIME_NAME_SIZE 128 +#define XR_MAX_PATH_LENGTH 256 +#define XR_MAX_STRUCTURE_NAME_SIZE 64 +#define XR_MAX_RESULT_STRING_SIZE 64 +#define XR_MIN_COMPOSITION_LAYERS_SUPPORTED 16 +#define XR_MAX_ACTION_SET_NAME_SIZE 64 +#define XR_MAX_LOCALIZED_ACTION_SET_NAME_SIZE 128 +#define XR_MAX_ACTION_NAME_SIZE 64 +#define XR_MAX_LOCALIZED_ACTION_NAME_SIZE 128 + +typedef enum XrResult { + XR_SUCCESS = 0, + XR_TIMEOUT_EXPIRED = 1, + XR_SESSION_LOSS_PENDING = 3, + XR_EVENT_UNAVAILABLE = 4, + XR_SPACE_BOUNDS_UNAVAILABLE = 7, + XR_SESSION_NOT_FOCUSED = 8, + XR_FRAME_DISCARDED = 9, + XR_ERROR_VALIDATION_FAILURE = -1, + XR_ERROR_RUNTIME_FAILURE = -2, + XR_ERROR_OUT_OF_MEMORY = -3, + XR_ERROR_API_VERSION_UNSUPPORTED = -4, + XR_ERROR_INITIALIZATION_FAILED = -6, + XR_ERROR_FUNCTION_UNSUPPORTED = -7, + XR_ERROR_FEATURE_UNSUPPORTED = -8, + XR_ERROR_EXTENSION_NOT_PRESENT = -9, + XR_ERROR_LIMIT_REACHED = -10, + XR_ERROR_SIZE_INSUFFICIENT = -11, + XR_ERROR_HANDLE_INVALID = -12, + XR_ERROR_INSTANCE_LOST = -13, + XR_ERROR_SESSION_RUNNING = -14, + XR_ERROR_SESSION_NOT_RUNNING = -16, + XR_ERROR_SESSION_LOST = -17, + XR_ERROR_SYSTEM_INVALID = -18, + XR_ERROR_PATH_INVALID = -19, + XR_ERROR_PATH_COUNT_EXCEEDED = -20, + XR_ERROR_PATH_FORMAT_INVALID = -21, + XR_ERROR_PATH_UNSUPPORTED = -22, + XR_ERROR_LAYER_INVALID = -23, + XR_ERROR_LAYER_LIMIT_EXCEEDED = -24, + XR_ERROR_SWAPCHAIN_RECT_INVALID = -25, + XR_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED = -26, + XR_ERROR_ACTION_TYPE_MISMATCH = -27, + XR_ERROR_SESSION_NOT_READY = -28, + XR_ERROR_SESSION_NOT_STOPPING = -29, + XR_ERROR_TIME_INVALID = -30, + XR_ERROR_REFERENCE_SPACE_UNSUPPORTED = -31, + XR_ERROR_FILE_ACCESS_ERROR = -32, + XR_ERROR_FILE_CONTENTS_INVALID = -33, + XR_ERROR_FORM_FACTOR_UNSUPPORTED = -34, + XR_ERROR_FORM_FACTOR_UNAVAILABLE = -35, + XR_ERROR_API_LAYER_NOT_PRESENT = -36, + XR_ERROR_CALL_ORDER_INVALID = -37, + XR_ERROR_GRAPHICS_DEVICE_INVALID = -38, + XR_ERROR_POSE_INVALID = -39, + XR_ERROR_INDEX_OUT_OF_RANGE = -40, + XR_ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED = -41, + XR_ERROR_ENVIRONMENT_BLEND_MODE_UNSUPPORTED = -42, + XR_ERROR_NAME_DUPLICATED = -44, + XR_ERROR_NAME_INVALID = -45, + XR_ERROR_ACTIONSET_NOT_ATTACHED = -46, + XR_ERROR_ACTIONSETS_ALREADY_ATTACHED = -47, + XR_ERROR_LOCALIZED_NAME_DUPLICATED = -48, + XR_ERROR_LOCALIZED_NAME_INVALID = -49, + XR_ERROR_GRAPHICS_REQUIREMENTS_CALL_MISSING = -50, + XR_ERROR_ANDROID_THREAD_SETTINGS_ID_INVALID_KHR = -1000003000, + XR_ERROR_ANDROID_THREAD_SETTINGS_FAILURE_KHR = -1000003001, + XR_ERROR_CREATE_SPATIAL_ANCHOR_FAILED_MSFT = -1000039001, + XR_ERROR_SECONDARY_VIEW_CONFIGURATION_TYPE_NOT_ENABLED_MSFT = -1000053000, + XR_ERROR_CONTROLLER_MODEL_KEY_INVALID_MSFT = -1000055000, + XR_ERROR_DISPLAY_REFRESH_RATE_UNSUPPORTED_FB = -1000101000, + XR_ERROR_COLOR_SPACE_UNSUPPORTED_FB = -1000108000, + XR_RESULT_MAX_ENUM = 0x7FFFFFFF +} XrResult; + +typedef enum XrStructureType { + XR_TYPE_UNKNOWN = 0, + XR_TYPE_API_LAYER_PROPERTIES = 1, + XR_TYPE_EXTENSION_PROPERTIES = 2, + XR_TYPE_INSTANCE_CREATE_INFO = 3, + XR_TYPE_SYSTEM_GET_INFO = 4, + XR_TYPE_SYSTEM_PROPERTIES = 5, + XR_TYPE_VIEW_LOCATE_INFO = 6, + XR_TYPE_VIEW = 7, + XR_TYPE_SESSION_CREATE_INFO = 8, + XR_TYPE_SWAPCHAIN_CREATE_INFO = 9, + XR_TYPE_SESSION_BEGIN_INFO = 10, + XR_TYPE_VIEW_STATE = 11, + XR_TYPE_FRAME_END_INFO = 12, + XR_TYPE_HAPTIC_VIBRATION = 13, + XR_TYPE_EVENT_DATA_BUFFER = 16, + XR_TYPE_EVENT_DATA_INSTANCE_LOSS_PENDING = 17, + XR_TYPE_EVENT_DATA_SESSION_STATE_CHANGED = 18, + XR_TYPE_ACTION_STATE_BOOLEAN = 23, + XR_TYPE_ACTION_STATE_FLOAT = 24, + XR_TYPE_ACTION_STATE_VECTOR2F = 25, + XR_TYPE_ACTION_STATE_POSE = 27, + XR_TYPE_ACTION_SET_CREATE_INFO = 28, + XR_TYPE_ACTION_CREATE_INFO = 29, + XR_TYPE_INSTANCE_PROPERTIES = 32, + XR_TYPE_FRAME_WAIT_INFO = 33, + XR_TYPE_COMPOSITION_LAYER_PROJECTION = 35, + XR_TYPE_COMPOSITION_LAYER_QUAD = 36, + XR_TYPE_REFERENCE_SPACE_CREATE_INFO = 37, + XR_TYPE_ACTION_SPACE_CREATE_INFO = 38, + XR_TYPE_EVENT_DATA_REFERENCE_SPACE_CHANGE_PENDING = 40, + XR_TYPE_VIEW_CONFIGURATION_VIEW = 41, + XR_TYPE_SPACE_LOCATION = 42, + XR_TYPE_SPACE_VELOCITY = 43, + XR_TYPE_FRAME_STATE = 44, + XR_TYPE_VIEW_CONFIGURATION_PROPERTIES = 45, + XR_TYPE_FRAME_BEGIN_INFO = 46, + XR_TYPE_COMPOSITION_LAYER_PROJECTION_VIEW = 48, + XR_TYPE_EVENT_DATA_EVENTS_LOST = 49, + XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING = 51, + XR_TYPE_EVENT_DATA_INTERACTION_PROFILE_CHANGED = 52, + XR_TYPE_INTERACTION_PROFILE_STATE = 53, + XR_TYPE_SWAPCHAIN_IMAGE_ACQUIRE_INFO = 55, + XR_TYPE_SWAPCHAIN_IMAGE_WAIT_INFO = 56, + XR_TYPE_SWAPCHAIN_IMAGE_RELEASE_INFO = 57, + XR_TYPE_ACTION_STATE_GET_INFO = 58, + XR_TYPE_HAPTIC_ACTION_INFO = 59, + XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO = 60, + XR_TYPE_ACTIONS_SYNC_INFO = 61, + XR_TYPE_BOUND_SOURCES_FOR_ACTION_ENUMERATE_INFO = 62, + XR_TYPE_INPUT_SOURCE_LOCALIZED_NAME_GET_INFO = 63, + XR_TYPE_COMPOSITION_LAYER_CUBE_KHR = 1000006000, + XR_TYPE_INSTANCE_CREATE_INFO_ANDROID_KHR = 1000008000, + XR_TYPE_COMPOSITION_LAYER_DEPTH_INFO_KHR = 1000010000, + XR_TYPE_VULKAN_SWAPCHAIN_FORMAT_LIST_CREATE_INFO_KHR = 1000014000, + XR_TYPE_EVENT_DATA_PERF_SETTINGS_EXT = 1000015000, + XR_TYPE_COMPOSITION_LAYER_CYLINDER_KHR = 1000017000, + XR_TYPE_COMPOSITION_LAYER_EQUIRECT_KHR = 1000018000, + XR_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT = 1000019000, + XR_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT = 1000019001, + XR_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT = 1000019002, + XR_TYPE_DEBUG_UTILS_LABEL_EXT = 1000019003, + XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR = 1000023000, + XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR = 1000023001, + XR_TYPE_GRAPHICS_BINDING_OPENGL_XCB_KHR = 1000023002, + XR_TYPE_GRAPHICS_BINDING_OPENGL_WAYLAND_KHR = 1000023003, + XR_TYPE_SWAPCHAIN_IMAGE_OPENGL_KHR = 1000023004, + XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_KHR = 1000023005, + XR_TYPE_GRAPHICS_BINDING_OPENGL_ES_ANDROID_KHR = 1000024001, + XR_TYPE_SWAPCHAIN_IMAGE_OPENGL_ES_KHR = 1000024002, + XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_ES_KHR = 1000024003, + XR_TYPE_GRAPHICS_BINDING_VULKAN_KHR = 1000025000, + XR_TYPE_SWAPCHAIN_IMAGE_VULKAN_KHR = 1000025001, + XR_TYPE_GRAPHICS_REQUIREMENTS_VULKAN_KHR = 1000025002, + XR_TYPE_GRAPHICS_BINDING_D3D11_KHR = 1000027000, + XR_TYPE_SWAPCHAIN_IMAGE_D3D11_KHR = 1000027001, + XR_TYPE_GRAPHICS_REQUIREMENTS_D3D11_KHR = 1000027002, + XR_TYPE_GRAPHICS_BINDING_D3D12_KHR = 1000028000, + XR_TYPE_SWAPCHAIN_IMAGE_D3D12_KHR = 1000028001, + XR_TYPE_GRAPHICS_REQUIREMENTS_D3D12_KHR = 1000028002, + XR_TYPE_SYSTEM_EYE_GAZE_INTERACTION_PROPERTIES_EXT = 1000030000, + XR_TYPE_EYE_GAZE_SAMPLE_TIME_EXT = 1000030001, + XR_TYPE_VISIBILITY_MASK_KHR = 1000031000, + XR_TYPE_EVENT_DATA_VISIBILITY_MASK_CHANGED_KHR = 1000031001, + XR_TYPE_SESSION_CREATE_INFO_OVERLAY_EXTX = 1000033000, + XR_TYPE_EVENT_DATA_MAIN_SESSION_VISIBILITY_CHANGED_EXTX = 1000033003, + XR_TYPE_COMPOSITION_LAYER_COLOR_SCALE_BIAS_KHR = 1000034000, + XR_TYPE_SPATIAL_ANCHOR_CREATE_INFO_MSFT = 1000039000, + XR_TYPE_SPATIAL_ANCHOR_SPACE_CREATE_INFO_MSFT = 1000039001, + XR_TYPE_VIEW_CONFIGURATION_DEPTH_RANGE_EXT = 1000046000, + XR_TYPE_GRAPHICS_BINDING_EGL_MNDX = 1000048004, + XR_TYPE_SPATIAL_GRAPH_NODE_SPACE_CREATE_INFO_MSFT = 1000049000, + XR_TYPE_SYSTEM_HAND_TRACKING_PROPERTIES_EXT = 1000051000, + XR_TYPE_HAND_TRACKER_CREATE_INFO_EXT = 1000051001, + XR_TYPE_HAND_JOINTS_LOCATE_INFO_EXT = 1000051002, + XR_TYPE_HAND_JOINT_LOCATIONS_EXT = 1000051003, + XR_TYPE_HAND_JOINT_VELOCITIES_EXT = 1000051004, + XR_TYPE_SYSTEM_HAND_TRACKING_MESH_PROPERTIES_MSFT = 1000052000, + XR_TYPE_HAND_MESH_SPACE_CREATE_INFO_MSFT = 1000052001, + XR_TYPE_HAND_MESH_UPDATE_INFO_MSFT = 1000052002, + XR_TYPE_HAND_MESH_MSFT = 1000052003, + XR_TYPE_HAND_POSE_TYPE_INFO_MSFT = 1000052004, + XR_TYPE_SECONDARY_VIEW_CONFIGURATION_SESSION_BEGIN_INFO_MSFT = 1000053000, + XR_TYPE_SECONDARY_VIEW_CONFIGURATION_STATE_MSFT = 1000053001, + XR_TYPE_SECONDARY_VIEW_CONFIGURATION_FRAME_STATE_MSFT = 1000053002, + XR_TYPE_SECONDARY_VIEW_CONFIGURATION_FRAME_END_INFO_MSFT = 1000053003, + XR_TYPE_SECONDARY_VIEW_CONFIGURATION_LAYER_INFO_MSFT = 1000053004, + XR_TYPE_SECONDARY_VIEW_CONFIGURATION_SWAPCHAIN_CREATE_INFO_MSFT = 1000053005, + XR_TYPE_CONTROLLER_MODEL_KEY_STATE_MSFT = 1000055000, + XR_TYPE_CONTROLLER_MODEL_NODE_PROPERTIES_MSFT = 1000055001, + XR_TYPE_CONTROLLER_MODEL_PROPERTIES_MSFT = 1000055002, + XR_TYPE_CONTROLLER_MODEL_NODE_STATE_MSFT = 1000055003, + XR_TYPE_CONTROLLER_MODEL_STATE_MSFT = 1000055004, + XR_TYPE_VIEW_CONFIGURATION_VIEW_FOV_EPIC = 1000059000, + XR_TYPE_HOLOGRAPHIC_WINDOW_ATTACHMENT_MSFT = 1000063000, + XR_TYPE_ANDROID_SURFACE_SWAPCHAIN_CREATE_INFO_FB = 1000070000, + XR_TYPE_INTERACTION_PROFILE_ANALOG_THRESHOLD_VALVE = 1000079000, + XR_TYPE_LOADER_INIT_INFO_ANDROID_KHR = 1000089000, + XR_TYPE_VULKAN_INSTANCE_CREATE_INFO_KHR = 1000090000, + XR_TYPE_VULKAN_DEVICE_CREATE_INFO_KHR = 1000090001, + XR_TYPE_VULKAN_GRAPHICS_DEVICE_GET_INFO_KHR = 1000090003, + XR_TYPE_COMPOSITION_LAYER_EQUIRECT2_KHR = 1000091000, + XR_TYPE_EVENT_DATA_DISPLAY_REFRESH_RATE_CHANGED_FB = 1000101000, + XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB = 1000108000, + XR_TYPE_BINDING_MODIFICATIONS_KHR = 1000120000, + XR_TYPE_VIEW_LOCATE_FOVEATED_RENDERING_VARJO = 1000121000, + XR_TYPE_FOVEATED_VIEW_CONFIGURATION_VIEW_VARJO = 1000121001, + XR_TYPE_SYSTEM_FOVEATED_RENDERING_PROPERTIES_VARJO = 1000121002, + XR_TYPE_COMPOSITION_LAYER_DEPTH_TEST_VARJO = 1000122000, + XR_TYPE_GRAPHICS_BINDING_VULKAN2_KHR = XR_TYPE_GRAPHICS_BINDING_VULKAN_KHR, + XR_TYPE_SWAPCHAIN_IMAGE_VULKAN2_KHR = XR_TYPE_SWAPCHAIN_IMAGE_VULKAN_KHR, + XR_TYPE_GRAPHICS_REQUIREMENTS_VULKAN2_KHR = XR_TYPE_GRAPHICS_REQUIREMENTS_VULKAN_KHR, + XR_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF +} XrStructureType; + +typedef enum XrFormFactor { + XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY = 1, + XR_FORM_FACTOR_HANDHELD_DISPLAY = 2, + XR_FORM_FACTOR_MAX_ENUM = 0x7FFFFFFF +} XrFormFactor; + +typedef enum XrViewConfigurationType { + XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO = 1, + XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO = 2, + XR_VIEW_CONFIGURATION_TYPE_PRIMARY_QUAD_VARJO = 1000037000, + XR_VIEW_CONFIGURATION_TYPE_SECONDARY_MONO_FIRST_PERSON_OBSERVER_MSFT = 1000054000, + XR_VIEW_CONFIGURATION_TYPE_MAX_ENUM = 0x7FFFFFFF +} XrViewConfigurationType; + +typedef enum XrEnvironmentBlendMode { + XR_ENVIRONMENT_BLEND_MODE_OPAQUE = 1, + XR_ENVIRONMENT_BLEND_MODE_ADDITIVE = 2, + XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND = 3, + XR_ENVIRONMENT_BLEND_MODE_MAX_ENUM = 0x7FFFFFFF +} XrEnvironmentBlendMode; + +typedef enum XrReferenceSpaceType { + XR_REFERENCE_SPACE_TYPE_VIEW = 1, + XR_REFERENCE_SPACE_TYPE_LOCAL = 2, + XR_REFERENCE_SPACE_TYPE_STAGE = 3, + XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT = 1000038000, + XR_REFERENCE_SPACE_TYPE_COMBINED_EYE_VARJO = 1000121000, + XR_REFERENCE_SPACE_TYPE_MAX_ENUM = 0x7FFFFFFF +} XrReferenceSpaceType; + +typedef enum XrActionType { + XR_ACTION_TYPE_BOOLEAN_INPUT = 1, + XR_ACTION_TYPE_FLOAT_INPUT = 2, + XR_ACTION_TYPE_VECTOR2F_INPUT = 3, + XR_ACTION_TYPE_POSE_INPUT = 4, + XR_ACTION_TYPE_VIBRATION_OUTPUT = 100, + XR_ACTION_TYPE_MAX_ENUM = 0x7FFFFFFF +} XrActionType; + +typedef enum XrEyeVisibility { + XR_EYE_VISIBILITY_BOTH = 0, + XR_EYE_VISIBILITY_LEFT = 1, + XR_EYE_VISIBILITY_RIGHT = 2, + XR_EYE_VISIBILITY_MAX_ENUM = 0x7FFFFFFF +} XrEyeVisibility; + +typedef enum XrSessionState { + XR_SESSION_STATE_UNKNOWN = 0, + XR_SESSION_STATE_IDLE = 1, + XR_SESSION_STATE_READY = 2, + XR_SESSION_STATE_SYNCHRONIZED = 3, + XR_SESSION_STATE_VISIBLE = 4, + XR_SESSION_STATE_FOCUSED = 5, + XR_SESSION_STATE_STOPPING = 6, + XR_SESSION_STATE_LOSS_PENDING = 7, + XR_SESSION_STATE_EXITING = 8, + XR_SESSION_STATE_MAX_ENUM = 0x7FFFFFFF +} XrSessionState; + +typedef enum XrObjectType { + XR_OBJECT_TYPE_UNKNOWN = 0, + XR_OBJECT_TYPE_INSTANCE = 1, + XR_OBJECT_TYPE_SESSION = 2, + XR_OBJECT_TYPE_SWAPCHAIN = 3, + XR_OBJECT_TYPE_SPACE = 4, + XR_OBJECT_TYPE_ACTION_SET = 5, + XR_OBJECT_TYPE_ACTION = 6, + XR_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT = 1000019000, + XR_OBJECT_TYPE_SPATIAL_ANCHOR_MSFT = 1000039000, + XR_OBJECT_TYPE_HAND_TRACKER_EXT = 1000051000, + XR_OBJECT_TYPE_MAX_ENUM = 0x7FFFFFFF +} XrObjectType; +typedef XrFlags64 XrInstanceCreateFlags; + +// Flag bits for XrInstanceCreateFlags + +typedef XrFlags64 XrSessionCreateFlags; + +// Flag bits for XrSessionCreateFlags + +typedef XrFlags64 XrSpaceVelocityFlags; + +// Flag bits for XrSpaceVelocityFlags +static const XrSpaceVelocityFlags XR_SPACE_VELOCITY_LINEAR_VALID_BIT = 0x00000001; +static const XrSpaceVelocityFlags XR_SPACE_VELOCITY_ANGULAR_VALID_BIT = 0x00000002; + +typedef XrFlags64 XrSpaceLocationFlags; + +// Flag bits for XrSpaceLocationFlags +static const XrSpaceLocationFlags XR_SPACE_LOCATION_ORIENTATION_VALID_BIT = 0x00000001; +static const XrSpaceLocationFlags XR_SPACE_LOCATION_POSITION_VALID_BIT = 0x00000002; +static const XrSpaceLocationFlags XR_SPACE_LOCATION_ORIENTATION_TRACKED_BIT = 0x00000004; +static const XrSpaceLocationFlags XR_SPACE_LOCATION_POSITION_TRACKED_BIT = 0x00000008; + +typedef XrFlags64 XrSwapchainCreateFlags; + +// Flag bits for XrSwapchainCreateFlags +static const XrSwapchainCreateFlags XR_SWAPCHAIN_CREATE_PROTECTED_CONTENT_BIT = 0x00000001; +static const XrSwapchainCreateFlags XR_SWAPCHAIN_CREATE_STATIC_IMAGE_BIT = 0x00000002; + +typedef XrFlags64 XrSwapchainUsageFlags; + +// Flag bits for XrSwapchainUsageFlags +static const XrSwapchainUsageFlags XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT = 0x00000001; +static const XrSwapchainUsageFlags XR_SWAPCHAIN_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000002; +static const XrSwapchainUsageFlags XR_SWAPCHAIN_USAGE_UNORDERED_ACCESS_BIT = 0x00000004; +static const XrSwapchainUsageFlags XR_SWAPCHAIN_USAGE_TRANSFER_SRC_BIT = 0x00000008; +static const XrSwapchainUsageFlags XR_SWAPCHAIN_USAGE_TRANSFER_DST_BIT = 0x00000010; +static const XrSwapchainUsageFlags XR_SWAPCHAIN_USAGE_SAMPLED_BIT = 0x00000020; +static const XrSwapchainUsageFlags XR_SWAPCHAIN_USAGE_MUTABLE_FORMAT_BIT = 0x00000040; +static const XrSwapchainUsageFlags XR_SWAPCHAIN_USAGE_INPUT_ATTACHMENT_BIT_MND = 0x00000080; + +typedef XrFlags64 XrCompositionLayerFlags; + +// Flag bits for XrCompositionLayerFlags +static const XrCompositionLayerFlags XR_COMPOSITION_LAYER_CORRECT_CHROMATIC_ABERRATION_BIT = 0x00000001; +static const XrCompositionLayerFlags XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT = 0x00000002; +static const XrCompositionLayerFlags XR_COMPOSITION_LAYER_UNPREMULTIPLIED_ALPHA_BIT = 0x00000004; + +typedef XrFlags64 XrViewStateFlags; + +// Flag bits for XrViewStateFlags +static const XrViewStateFlags XR_VIEW_STATE_ORIENTATION_VALID_BIT = 0x00000001; +static const XrViewStateFlags XR_VIEW_STATE_POSITION_VALID_BIT = 0x00000002; +static const XrViewStateFlags XR_VIEW_STATE_ORIENTATION_TRACKED_BIT = 0x00000004; +static const XrViewStateFlags XR_VIEW_STATE_POSITION_TRACKED_BIT = 0x00000008; + +typedef XrFlags64 XrInputSourceLocalizedNameFlags; + +// Flag bits for XrInputSourceLocalizedNameFlags +static const XrInputSourceLocalizedNameFlags XR_INPUT_SOURCE_LOCALIZED_NAME_USER_PATH_BIT = 0x00000001; +static const XrInputSourceLocalizedNameFlags XR_INPUT_SOURCE_LOCALIZED_NAME_INTERACTION_PROFILE_BIT = 0x00000002; +static const XrInputSourceLocalizedNameFlags XR_INPUT_SOURCE_LOCALIZED_NAME_COMPONENT_BIT = 0x00000004; + +typedef void (XRAPI_PTR *PFN_xrVoidFunction)(void); +typedef struct XrApiLayerProperties { + XrStructureType type; + void* XR_MAY_ALIAS next; + char layerName[XR_MAX_API_LAYER_NAME_SIZE]; + XrVersion specVersion; + uint32_t layerVersion; + char description[XR_MAX_API_LAYER_DESCRIPTION_SIZE]; +} XrApiLayerProperties; + +typedef struct XrExtensionProperties { + XrStructureType type; + void* XR_MAY_ALIAS next; + char extensionName[XR_MAX_EXTENSION_NAME_SIZE]; + uint32_t extensionVersion; +} XrExtensionProperties; + +typedef struct XrApplicationInfo { + char applicationName[XR_MAX_APPLICATION_NAME_SIZE]; + uint32_t applicationVersion; + char engineName[XR_MAX_ENGINE_NAME_SIZE]; + uint32_t engineVersion; + XrVersion apiVersion; +} XrApplicationInfo; + +typedef struct XrInstanceCreateInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrInstanceCreateFlags createFlags; + XrApplicationInfo applicationInfo; + uint32_t enabledApiLayerCount; + const char* const* enabledApiLayerNames; + uint32_t enabledExtensionCount; + const char* const* enabledExtensionNames; +} XrInstanceCreateInfo; + +typedef struct XrInstanceProperties { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrVersion runtimeVersion; + char runtimeName[XR_MAX_RUNTIME_NAME_SIZE]; +} XrInstanceProperties; + +typedef struct XrEventDataBuffer { + XrStructureType type; + const void* XR_MAY_ALIAS next; + uint8_t varying[4000]; +} XrEventDataBuffer; + +typedef struct XrSystemGetInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrFormFactor formFactor; +} XrSystemGetInfo; + +typedef struct XrSystemGraphicsProperties { + uint32_t maxSwapchainImageHeight; + uint32_t maxSwapchainImageWidth; + uint32_t maxLayerCount; +} XrSystemGraphicsProperties; + +typedef struct XrSystemTrackingProperties { + XrBool32 orientationTracking; + XrBool32 positionTracking; +} XrSystemTrackingProperties; + +typedef struct XrSystemProperties { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrSystemId systemId; + uint32_t vendorId; + char systemName[XR_MAX_SYSTEM_NAME_SIZE]; + XrSystemGraphicsProperties graphicsProperties; + XrSystemTrackingProperties trackingProperties; +} XrSystemProperties; + +typedef struct XrSessionCreateInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrSessionCreateFlags createFlags; + XrSystemId systemId; +} XrSessionCreateInfo; + +typedef struct XrVector3f { + float x; + float y; + float z; +} XrVector3f; + +// XrSpaceVelocity extends XrSpaceLocation +typedef struct XrSpaceVelocity { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrSpaceVelocityFlags velocityFlags; + XrVector3f linearVelocity; + XrVector3f angularVelocity; +} XrSpaceVelocity; + +typedef struct XrQuaternionf { + float x; + float y; + float z; + float w; +} XrQuaternionf; + +typedef struct XrPosef { + XrQuaternionf orientation; + XrVector3f position; +} XrPosef; + +typedef struct XrReferenceSpaceCreateInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrReferenceSpaceType referenceSpaceType; + XrPosef poseInReferenceSpace; +} XrReferenceSpaceCreateInfo; + +typedef struct XrExtent2Df { + float width; + float height; +} XrExtent2Df; + +typedef struct XrActionSpaceCreateInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrAction action; + XrPath subactionPath; + XrPosef poseInActionSpace; +} XrActionSpaceCreateInfo; + +typedef struct XrSpaceLocation { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrSpaceLocationFlags locationFlags; + XrPosef pose; +} XrSpaceLocation; + +typedef struct XrViewConfigurationProperties { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrViewConfigurationType viewConfigurationType; + XrBool32 fovMutable; +} XrViewConfigurationProperties; + +typedef struct XrViewConfigurationView { + XrStructureType type; + void* XR_MAY_ALIAS next; + uint32_t recommendedImageRectWidth; + uint32_t maxImageRectWidth; + uint32_t recommendedImageRectHeight; + uint32_t maxImageRectHeight; + uint32_t recommendedSwapchainSampleCount; + uint32_t maxSwapchainSampleCount; +} XrViewConfigurationView; + +typedef struct XrSwapchainCreateInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrSwapchainCreateFlags createFlags; + XrSwapchainUsageFlags usageFlags; + int64_t format; + uint32_t sampleCount; + uint32_t width; + uint32_t height; + uint32_t faceCount; + uint32_t arraySize; + uint32_t mipCount; +} XrSwapchainCreateInfo; + +typedef struct XR_MAY_ALIAS XrSwapchainImageBaseHeader { + XrStructureType type; + void* XR_MAY_ALIAS next; +} XrSwapchainImageBaseHeader; + +typedef struct XrSwapchainImageAcquireInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; +} XrSwapchainImageAcquireInfo; + +typedef struct XrSwapchainImageWaitInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrDuration timeout; +} XrSwapchainImageWaitInfo; + +typedef struct XrSwapchainImageReleaseInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; +} XrSwapchainImageReleaseInfo; + +typedef struct XrSessionBeginInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrViewConfigurationType primaryViewConfigurationType; +} XrSessionBeginInfo; + +typedef struct XrFrameWaitInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; +} XrFrameWaitInfo; + +typedef struct XrFrameState { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrTime predictedDisplayTime; + XrDuration predictedDisplayPeriod; + XrBool32 shouldRender; +} XrFrameState; + +typedef struct XrFrameBeginInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; +} XrFrameBeginInfo; + +typedef struct XR_MAY_ALIAS XrCompositionLayerBaseHeader { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrCompositionLayerFlags layerFlags; + XrSpace space; +} XrCompositionLayerBaseHeader; + +typedef struct XrFrameEndInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrTime displayTime; + XrEnvironmentBlendMode environmentBlendMode; + uint32_t layerCount; + const XrCompositionLayerBaseHeader* const* layers; +} XrFrameEndInfo; + +typedef struct XrViewLocateInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrViewConfigurationType viewConfigurationType; + XrTime displayTime; + XrSpace space; +} XrViewLocateInfo; + +typedef struct XrViewState { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrViewStateFlags viewStateFlags; +} XrViewState; + +typedef struct XrFovf { + float angleLeft; + float angleRight; + float angleUp; + float angleDown; +} XrFovf; + +typedef struct XrView { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrPosef pose; + XrFovf fov; +} XrView; + +typedef struct XrActionSetCreateInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; + char actionSetName[XR_MAX_ACTION_SET_NAME_SIZE]; + char localizedActionSetName[XR_MAX_LOCALIZED_ACTION_SET_NAME_SIZE]; + uint32_t priority; +} XrActionSetCreateInfo; + +typedef struct XrActionCreateInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; + char actionName[XR_MAX_ACTION_NAME_SIZE]; + XrActionType actionType; + uint32_t countSubactionPaths; + const XrPath* subactionPaths; + char localizedActionName[XR_MAX_LOCALIZED_ACTION_NAME_SIZE]; +} XrActionCreateInfo; + +typedef struct XrActionSuggestedBinding { + XrAction action; + XrPath binding; +} XrActionSuggestedBinding; + +typedef struct XrInteractionProfileSuggestedBinding { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrPath interactionProfile; + uint32_t countSuggestedBindings; + const XrActionSuggestedBinding* suggestedBindings; +} XrInteractionProfileSuggestedBinding; + +typedef struct XrSessionActionSetsAttachInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; + uint32_t countActionSets; + const XrActionSet* actionSets; +} XrSessionActionSetsAttachInfo; + +typedef struct XrInteractionProfileState { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrPath interactionProfile; +} XrInteractionProfileState; + +typedef struct XrActionStateGetInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrAction action; + XrPath subactionPath; +} XrActionStateGetInfo; + +typedef struct XrActionStateBoolean { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrBool32 currentState; + XrBool32 changedSinceLastSync; + XrTime lastChangeTime; + XrBool32 isActive; +} XrActionStateBoolean; + +typedef struct XrActionStateFloat { + XrStructureType type; + void* XR_MAY_ALIAS next; + float currentState; + XrBool32 changedSinceLastSync; + XrTime lastChangeTime; + XrBool32 isActive; +} XrActionStateFloat; + +typedef struct XrVector2f { + float x; + float y; +} XrVector2f; + +typedef struct XrActionStateVector2f { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrVector2f currentState; + XrBool32 changedSinceLastSync; + XrTime lastChangeTime; + XrBool32 isActive; +} XrActionStateVector2f; + +typedef struct XrActionStatePose { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrBool32 isActive; +} XrActionStatePose; + +typedef struct XrActiveActionSet { + XrActionSet actionSet; + XrPath subactionPath; +} XrActiveActionSet; + +typedef struct XrActionsSyncInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; + uint32_t countActiveActionSets; + const XrActiveActionSet* activeActionSets; +} XrActionsSyncInfo; + +typedef struct XrBoundSourcesForActionEnumerateInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrAction action; +} XrBoundSourcesForActionEnumerateInfo; + +typedef struct XrInputSourceLocalizedNameGetInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrPath sourcePath; + XrInputSourceLocalizedNameFlags whichComponents; +} XrInputSourceLocalizedNameGetInfo; + +typedef struct XrHapticActionInfo { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrAction action; + XrPath subactionPath; +} XrHapticActionInfo; + +typedef struct XR_MAY_ALIAS XrHapticBaseHeader { + XrStructureType type; + const void* XR_MAY_ALIAS next; +} XrHapticBaseHeader; + +typedef struct XR_MAY_ALIAS XrBaseInStructure { + XrStructureType type; + const struct XrBaseInStructure* next; +} XrBaseInStructure; + +typedef struct XR_MAY_ALIAS XrBaseOutStructure { + XrStructureType type; + struct XrBaseOutStructure* next; +} XrBaseOutStructure; + +typedef struct XrOffset2Di { + int32_t x; + int32_t y; +} XrOffset2Di; + +typedef struct XrExtent2Di { + int32_t width; + int32_t height; +} XrExtent2Di; + +typedef struct XrRect2Di { + XrOffset2Di offset; + XrExtent2Di extent; +} XrRect2Di; + +typedef struct XrSwapchainSubImage { + XrSwapchain swapchain; + XrRect2Di imageRect; + uint32_t imageArrayIndex; +} XrSwapchainSubImage; + +typedef struct XrCompositionLayerProjectionView { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrPosef pose; + XrFovf fov; + XrSwapchainSubImage subImage; +} XrCompositionLayerProjectionView; + +typedef struct XrCompositionLayerProjection { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrCompositionLayerFlags layerFlags; + XrSpace space; + uint32_t viewCount; + const XrCompositionLayerProjectionView* views; +} XrCompositionLayerProjection; + +typedef struct XrCompositionLayerQuad { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrCompositionLayerFlags layerFlags; + XrSpace space; + XrEyeVisibility eyeVisibility; + XrSwapchainSubImage subImage; + XrPosef pose; + XrExtent2Df size; +} XrCompositionLayerQuad; + +typedef struct XR_MAY_ALIAS XrEventDataBaseHeader { + XrStructureType type; + const void* XR_MAY_ALIAS next; +} XrEventDataBaseHeader; + +typedef struct XrEventDataEventsLost { + XrStructureType type; + const void* XR_MAY_ALIAS next; + uint32_t lostEventCount; +} XrEventDataEventsLost; + +typedef struct XrEventDataInstanceLossPending { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrTime lossTime; +} XrEventDataInstanceLossPending; + +typedef struct XrEventDataSessionStateChanged { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrSession session; + XrSessionState state; + XrTime time; +} XrEventDataSessionStateChanged; + +typedef struct XrEventDataReferenceSpaceChangePending { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrSession session; + XrReferenceSpaceType referenceSpaceType; + XrTime changeTime; + XrBool32 poseValid; + XrPosef poseInPreviousSpace; +} XrEventDataReferenceSpaceChangePending; + +typedef struct XrEventDataInteractionProfileChanged { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrSession session; +} XrEventDataInteractionProfileChanged; + +typedef struct XrHapticVibration { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrDuration duration; + float frequency; + float amplitude; +} XrHapticVibration; + +typedef struct XrOffset2Df { + float x; + float y; +} XrOffset2Df; + +typedef struct XrRect2Df { + XrOffset2Df offset; + XrExtent2Df extent; +} XrRect2Df; + +typedef struct XrVector4f { + float x; + float y; + float z; + float w; +} XrVector4f; + +typedef struct XrColor4f { + float r; + float g; + float b; + float a; +} XrColor4f; + +typedef XrResult (XRAPI_PTR *PFN_xrGetInstanceProcAddr)(XrInstance instance, const char* name, PFN_xrVoidFunction* function); +typedef XrResult (XRAPI_PTR *PFN_xrEnumerateApiLayerProperties)(uint32_t propertyCapacityInput, uint32_t* propertyCountOutput, XrApiLayerProperties* properties); +typedef XrResult (XRAPI_PTR *PFN_xrEnumerateInstanceExtensionProperties)(const char* layerName, uint32_t propertyCapacityInput, uint32_t* propertyCountOutput, XrExtensionProperties* properties); +typedef XrResult (XRAPI_PTR *PFN_xrCreateInstance)(const XrInstanceCreateInfo* createInfo, XrInstance* instance); +typedef XrResult (XRAPI_PTR *PFN_xrDestroyInstance)(XrInstance instance); +typedef XrResult (XRAPI_PTR *PFN_xrGetInstanceProperties)(XrInstance instance, XrInstanceProperties* instanceProperties); +typedef XrResult (XRAPI_PTR *PFN_xrPollEvent)(XrInstance instance, XrEventDataBuffer* eventData); +typedef XrResult (XRAPI_PTR *PFN_xrResultToString)(XrInstance instance, XrResult value, char buffer[XR_MAX_RESULT_STRING_SIZE]); +typedef XrResult (XRAPI_PTR *PFN_xrStructureTypeToString)(XrInstance instance, XrStructureType value, char buffer[XR_MAX_STRUCTURE_NAME_SIZE]); +typedef XrResult (XRAPI_PTR *PFN_xrGetSystem)(XrInstance instance, const XrSystemGetInfo* getInfo, XrSystemId* systemId); +typedef XrResult (XRAPI_PTR *PFN_xrGetSystemProperties)(XrInstance instance, XrSystemId systemId, XrSystemProperties* properties); +typedef XrResult (XRAPI_PTR *PFN_xrEnumerateEnvironmentBlendModes)(XrInstance instance, XrSystemId systemId, XrViewConfigurationType viewConfigurationType, uint32_t environmentBlendModeCapacityInput, uint32_t* environmentBlendModeCountOutput, XrEnvironmentBlendMode* environmentBlendModes); +typedef XrResult (XRAPI_PTR *PFN_xrCreateSession)(XrInstance instance, const XrSessionCreateInfo* createInfo, XrSession* session); +typedef XrResult (XRAPI_PTR *PFN_xrDestroySession)(XrSession session); +typedef XrResult (XRAPI_PTR *PFN_xrEnumerateReferenceSpaces)(XrSession session, uint32_t spaceCapacityInput, uint32_t* spaceCountOutput, XrReferenceSpaceType* spaces); +typedef XrResult (XRAPI_PTR *PFN_xrCreateReferenceSpace)(XrSession session, const XrReferenceSpaceCreateInfo* createInfo, XrSpace* space); +typedef XrResult (XRAPI_PTR *PFN_xrGetReferenceSpaceBoundsRect)(XrSession session, XrReferenceSpaceType referenceSpaceType, XrExtent2Df* bounds); +typedef XrResult (XRAPI_PTR *PFN_xrCreateActionSpace)(XrSession session, const XrActionSpaceCreateInfo* createInfo, XrSpace* space); +typedef XrResult (XRAPI_PTR *PFN_xrLocateSpace)(XrSpace space, XrSpace baseSpace, XrTime time, XrSpaceLocation* location); +typedef XrResult (XRAPI_PTR *PFN_xrDestroySpace)(XrSpace space); +typedef XrResult (XRAPI_PTR *PFN_xrEnumerateViewConfigurations)(XrInstance instance, XrSystemId systemId, uint32_t viewConfigurationTypeCapacityInput, uint32_t* viewConfigurationTypeCountOutput, XrViewConfigurationType* viewConfigurationTypes); +typedef XrResult (XRAPI_PTR *PFN_xrGetViewConfigurationProperties)(XrInstance instance, XrSystemId systemId, XrViewConfigurationType viewConfigurationType, XrViewConfigurationProperties* configurationProperties); +typedef XrResult (XRAPI_PTR *PFN_xrEnumerateViewConfigurationViews)(XrInstance instance, XrSystemId systemId, XrViewConfigurationType viewConfigurationType, uint32_t viewCapacityInput, uint32_t* viewCountOutput, XrViewConfigurationView* views); +typedef XrResult (XRAPI_PTR *PFN_xrEnumerateSwapchainFormats)(XrSession session, uint32_t formatCapacityInput, uint32_t* formatCountOutput, int64_t* formats); +typedef XrResult (XRAPI_PTR *PFN_xrCreateSwapchain)(XrSession session, const XrSwapchainCreateInfo* createInfo, XrSwapchain* swapchain); +typedef XrResult (XRAPI_PTR *PFN_xrDestroySwapchain)(XrSwapchain swapchain); +typedef XrResult (XRAPI_PTR *PFN_xrEnumerateSwapchainImages)(XrSwapchain swapchain, uint32_t imageCapacityInput, uint32_t* imageCountOutput, XrSwapchainImageBaseHeader* images); +typedef XrResult (XRAPI_PTR *PFN_xrAcquireSwapchainImage)(XrSwapchain swapchain, const XrSwapchainImageAcquireInfo* acquireInfo, uint32_t* index); +typedef XrResult (XRAPI_PTR *PFN_xrWaitSwapchainImage)(XrSwapchain swapchain, const XrSwapchainImageWaitInfo* waitInfo); +typedef XrResult (XRAPI_PTR *PFN_xrReleaseSwapchainImage)(XrSwapchain swapchain, const XrSwapchainImageReleaseInfo* releaseInfo); +typedef XrResult (XRAPI_PTR *PFN_xrBeginSession)(XrSession session, const XrSessionBeginInfo* beginInfo); +typedef XrResult (XRAPI_PTR *PFN_xrEndSession)(XrSession session); +typedef XrResult (XRAPI_PTR *PFN_xrRequestExitSession)(XrSession session); +typedef XrResult (XRAPI_PTR *PFN_xrWaitFrame)(XrSession session, const XrFrameWaitInfo* frameWaitInfo, XrFrameState* frameState); +typedef XrResult (XRAPI_PTR *PFN_xrBeginFrame)(XrSession session, const XrFrameBeginInfo* frameBeginInfo); +typedef XrResult (XRAPI_PTR *PFN_xrEndFrame)(XrSession session, const XrFrameEndInfo* frameEndInfo); +typedef XrResult (XRAPI_PTR *PFN_xrLocateViews)(XrSession session, const XrViewLocateInfo* viewLocateInfo, XrViewState* viewState, uint32_t viewCapacityInput, uint32_t* viewCountOutput, XrView* views); +typedef XrResult (XRAPI_PTR *PFN_xrStringToPath)(XrInstance instance, const char* pathString, XrPath* path); +typedef XrResult (XRAPI_PTR *PFN_xrPathToString)(XrInstance instance, XrPath path, uint32_t bufferCapacityInput, uint32_t* bufferCountOutput, char* buffer); +typedef XrResult (XRAPI_PTR *PFN_xrCreateActionSet)(XrInstance instance, const XrActionSetCreateInfo* createInfo, XrActionSet* actionSet); +typedef XrResult (XRAPI_PTR *PFN_xrDestroyActionSet)(XrActionSet actionSet); +typedef XrResult (XRAPI_PTR *PFN_xrCreateAction)(XrActionSet actionSet, const XrActionCreateInfo* createInfo, XrAction* action); +typedef XrResult (XRAPI_PTR *PFN_xrDestroyAction)(XrAction action); +typedef XrResult (XRAPI_PTR *PFN_xrSuggestInteractionProfileBindings)(XrInstance instance, const XrInteractionProfileSuggestedBinding* suggestedBindings); +typedef XrResult (XRAPI_PTR *PFN_xrAttachSessionActionSets)(XrSession session, const XrSessionActionSetsAttachInfo* attachInfo); +typedef XrResult (XRAPI_PTR *PFN_xrGetCurrentInteractionProfile)(XrSession session, XrPath topLevelUserPath, XrInteractionProfileState* interactionProfile); +typedef XrResult (XRAPI_PTR *PFN_xrGetActionStateBoolean)(XrSession session, const XrActionStateGetInfo* getInfo, XrActionStateBoolean* state); +typedef XrResult (XRAPI_PTR *PFN_xrGetActionStateFloat)(XrSession session, const XrActionStateGetInfo* getInfo, XrActionStateFloat* state); +typedef XrResult (XRAPI_PTR *PFN_xrGetActionStateVector2f)(XrSession session, const XrActionStateGetInfo* getInfo, XrActionStateVector2f* state); +typedef XrResult (XRAPI_PTR *PFN_xrGetActionStatePose)(XrSession session, const XrActionStateGetInfo* getInfo, XrActionStatePose* state); +typedef XrResult (XRAPI_PTR *PFN_xrSyncActions)(XrSession session, const XrActionsSyncInfo* syncInfo); +typedef XrResult (XRAPI_PTR *PFN_xrEnumerateBoundSourcesForAction)(XrSession session, const XrBoundSourcesForActionEnumerateInfo* enumerateInfo, uint32_t sourceCapacityInput, uint32_t* sourceCountOutput, XrPath* sources); +typedef XrResult (XRAPI_PTR *PFN_xrGetInputSourceLocalizedName)(XrSession session, const XrInputSourceLocalizedNameGetInfo* getInfo, uint32_t bufferCapacityInput, uint32_t* bufferCountOutput, char* buffer); +typedef XrResult (XRAPI_PTR *PFN_xrApplyHapticFeedback)(XrSession session, const XrHapticActionInfo* hapticActionInfo, const XrHapticBaseHeader* hapticFeedback); +typedef XrResult (XRAPI_PTR *PFN_xrStopHapticFeedback)(XrSession session, const XrHapticActionInfo* hapticActionInfo); + +#ifndef XR_NO_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrGetInstanceProcAddr( + XrInstance instance, + const char* name, + PFN_xrVoidFunction* function); + +XRAPI_ATTR XrResult XRAPI_CALL xrEnumerateApiLayerProperties( + uint32_t propertyCapacityInput, + uint32_t* propertyCountOutput, + XrApiLayerProperties* properties); + +XRAPI_ATTR XrResult XRAPI_CALL xrEnumerateInstanceExtensionProperties( + const char* layerName, + uint32_t propertyCapacityInput, + uint32_t* propertyCountOutput, + XrExtensionProperties* properties); + +XRAPI_ATTR XrResult XRAPI_CALL xrCreateInstance( + const XrInstanceCreateInfo* createInfo, + XrInstance* instance); + +XRAPI_ATTR XrResult XRAPI_CALL xrDestroyInstance( + XrInstance instance); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetInstanceProperties( + XrInstance instance, + XrInstanceProperties* instanceProperties); + +XRAPI_ATTR XrResult XRAPI_CALL xrPollEvent( + XrInstance instance, + XrEventDataBuffer* eventData); + +XRAPI_ATTR XrResult XRAPI_CALL xrResultToString( + XrInstance instance, + XrResult value, + char buffer[XR_MAX_RESULT_STRING_SIZE]); + +XRAPI_ATTR XrResult XRAPI_CALL xrStructureTypeToString( + XrInstance instance, + XrStructureType value, + char buffer[XR_MAX_STRUCTURE_NAME_SIZE]); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetSystem( + XrInstance instance, + const XrSystemGetInfo* getInfo, + XrSystemId* systemId); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetSystemProperties( + XrInstance instance, + XrSystemId systemId, + XrSystemProperties* properties); + +XRAPI_ATTR XrResult XRAPI_CALL xrEnumerateEnvironmentBlendModes( + XrInstance instance, + XrSystemId systemId, + XrViewConfigurationType viewConfigurationType, + uint32_t environmentBlendModeCapacityInput, + uint32_t* environmentBlendModeCountOutput, + XrEnvironmentBlendMode* environmentBlendModes); + +XRAPI_ATTR XrResult XRAPI_CALL xrCreateSession( + XrInstance instance, + const XrSessionCreateInfo* createInfo, + XrSession* session); + +XRAPI_ATTR XrResult XRAPI_CALL xrDestroySession( + XrSession session); + +XRAPI_ATTR XrResult XRAPI_CALL xrEnumerateReferenceSpaces( + XrSession session, + uint32_t spaceCapacityInput, + uint32_t* spaceCountOutput, + XrReferenceSpaceType* spaces); + +XRAPI_ATTR XrResult XRAPI_CALL xrCreateReferenceSpace( + XrSession session, + const XrReferenceSpaceCreateInfo* createInfo, + XrSpace* space); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetReferenceSpaceBoundsRect( + XrSession session, + XrReferenceSpaceType referenceSpaceType, + XrExtent2Df* bounds); + +XRAPI_ATTR XrResult XRAPI_CALL xrCreateActionSpace( + XrSession session, + const XrActionSpaceCreateInfo* createInfo, + XrSpace* space); + +XRAPI_ATTR XrResult XRAPI_CALL xrLocateSpace( + XrSpace space, + XrSpace baseSpace, + XrTime time, + XrSpaceLocation* location); + +XRAPI_ATTR XrResult XRAPI_CALL xrDestroySpace( + XrSpace space); + +XRAPI_ATTR XrResult XRAPI_CALL xrEnumerateViewConfigurations( + XrInstance instance, + XrSystemId systemId, + uint32_t viewConfigurationTypeCapacityInput, + uint32_t* viewConfigurationTypeCountOutput, + XrViewConfigurationType* viewConfigurationTypes); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetViewConfigurationProperties( + XrInstance instance, + XrSystemId systemId, + XrViewConfigurationType viewConfigurationType, + XrViewConfigurationProperties* configurationProperties); + +XRAPI_ATTR XrResult XRAPI_CALL xrEnumerateViewConfigurationViews( + XrInstance instance, + XrSystemId systemId, + XrViewConfigurationType viewConfigurationType, + uint32_t viewCapacityInput, + uint32_t* viewCountOutput, + XrViewConfigurationView* views); + +XRAPI_ATTR XrResult XRAPI_CALL xrEnumerateSwapchainFormats( + XrSession session, + uint32_t formatCapacityInput, + uint32_t* formatCountOutput, + int64_t* formats); + +XRAPI_ATTR XrResult XRAPI_CALL xrCreateSwapchain( + XrSession session, + const XrSwapchainCreateInfo* createInfo, + XrSwapchain* swapchain); + +XRAPI_ATTR XrResult XRAPI_CALL xrDestroySwapchain( + XrSwapchain swapchain); + +XRAPI_ATTR XrResult XRAPI_CALL xrEnumerateSwapchainImages( + XrSwapchain swapchain, + uint32_t imageCapacityInput, + uint32_t* imageCountOutput, + XrSwapchainImageBaseHeader* images); + +XRAPI_ATTR XrResult XRAPI_CALL xrAcquireSwapchainImage( + XrSwapchain swapchain, + const XrSwapchainImageAcquireInfo* acquireInfo, + uint32_t* index); + +XRAPI_ATTR XrResult XRAPI_CALL xrWaitSwapchainImage( + XrSwapchain swapchain, + const XrSwapchainImageWaitInfo* waitInfo); + +XRAPI_ATTR XrResult XRAPI_CALL xrReleaseSwapchainImage( + XrSwapchain swapchain, + const XrSwapchainImageReleaseInfo* releaseInfo); + +XRAPI_ATTR XrResult XRAPI_CALL xrBeginSession( + XrSession session, + const XrSessionBeginInfo* beginInfo); + +XRAPI_ATTR XrResult XRAPI_CALL xrEndSession( + XrSession session); + +XRAPI_ATTR XrResult XRAPI_CALL xrRequestExitSession( + XrSession session); + +XRAPI_ATTR XrResult XRAPI_CALL xrWaitFrame( + XrSession session, + const XrFrameWaitInfo* frameWaitInfo, + XrFrameState* frameState); + +XRAPI_ATTR XrResult XRAPI_CALL xrBeginFrame( + XrSession session, + const XrFrameBeginInfo* frameBeginInfo); + +XRAPI_ATTR XrResult XRAPI_CALL xrEndFrame( + XrSession session, + const XrFrameEndInfo* frameEndInfo); + +XRAPI_ATTR XrResult XRAPI_CALL xrLocateViews( + XrSession session, + const XrViewLocateInfo* viewLocateInfo, + XrViewState* viewState, + uint32_t viewCapacityInput, + uint32_t* viewCountOutput, + XrView* views); + +XRAPI_ATTR XrResult XRAPI_CALL xrStringToPath( + XrInstance instance, + const char* pathString, + XrPath* path); + +XRAPI_ATTR XrResult XRAPI_CALL xrPathToString( + XrInstance instance, + XrPath path, + uint32_t bufferCapacityInput, + uint32_t* bufferCountOutput, + char* buffer); + +XRAPI_ATTR XrResult XRAPI_CALL xrCreateActionSet( + XrInstance instance, + const XrActionSetCreateInfo* createInfo, + XrActionSet* actionSet); + +XRAPI_ATTR XrResult XRAPI_CALL xrDestroyActionSet( + XrActionSet actionSet); + +XRAPI_ATTR XrResult XRAPI_CALL xrCreateAction( + XrActionSet actionSet, + const XrActionCreateInfo* createInfo, + XrAction* action); + +XRAPI_ATTR XrResult XRAPI_CALL xrDestroyAction( + XrAction action); + +XRAPI_ATTR XrResult XRAPI_CALL xrSuggestInteractionProfileBindings( + XrInstance instance, + const XrInteractionProfileSuggestedBinding* suggestedBindings); + +XRAPI_ATTR XrResult XRAPI_CALL xrAttachSessionActionSets( + XrSession session, + const XrSessionActionSetsAttachInfo* attachInfo); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetCurrentInteractionProfile( + XrSession session, + XrPath topLevelUserPath, + XrInteractionProfileState* interactionProfile); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetActionStateBoolean( + XrSession session, + const XrActionStateGetInfo* getInfo, + XrActionStateBoolean* state); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetActionStateFloat( + XrSession session, + const XrActionStateGetInfo* getInfo, + XrActionStateFloat* state); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetActionStateVector2f( + XrSession session, + const XrActionStateGetInfo* getInfo, + XrActionStateVector2f* state); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetActionStatePose( + XrSession session, + const XrActionStateGetInfo* getInfo, + XrActionStatePose* state); + +XRAPI_ATTR XrResult XRAPI_CALL xrSyncActions( + XrSession session, + const XrActionsSyncInfo* syncInfo); + +XRAPI_ATTR XrResult XRAPI_CALL xrEnumerateBoundSourcesForAction( + XrSession session, + const XrBoundSourcesForActionEnumerateInfo* enumerateInfo, + uint32_t sourceCapacityInput, + uint32_t* sourceCountOutput, + XrPath* sources); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetInputSourceLocalizedName( + XrSession session, + const XrInputSourceLocalizedNameGetInfo* getInfo, + uint32_t bufferCapacityInput, + uint32_t* bufferCountOutput, + char* buffer); + +XRAPI_ATTR XrResult XRAPI_CALL xrApplyHapticFeedback( + XrSession session, + const XrHapticActionInfo* hapticActionInfo, + const XrHapticBaseHeader* hapticFeedback); + +XRAPI_ATTR XrResult XRAPI_CALL xrStopHapticFeedback( + XrSession session, + const XrHapticActionInfo* hapticActionInfo); +#endif /* !XR_NO_PROTOTYPES */ + + +#define XR_KHR_composition_layer_cube 1 +#define XR_KHR_composition_layer_cube_SPEC_VERSION 8 +#define XR_KHR_COMPOSITION_LAYER_CUBE_EXTENSION_NAME "XR_KHR_composition_layer_cube" +typedef struct XrCompositionLayerCubeKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrCompositionLayerFlags layerFlags; + XrSpace space; + XrEyeVisibility eyeVisibility; + XrSwapchain swapchain; + uint32_t imageArrayIndex; + XrQuaternionf orientation; +} XrCompositionLayerCubeKHR; + + + +#define XR_KHR_composition_layer_depth 1 +#define XR_KHR_composition_layer_depth_SPEC_VERSION 5 +#define XR_KHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME "XR_KHR_composition_layer_depth" +// XrCompositionLayerDepthInfoKHR extends XrCompositionLayerProjectionView +typedef struct XrCompositionLayerDepthInfoKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrSwapchainSubImage subImage; + float minDepth; + float maxDepth; + float nearZ; + float farZ; +} XrCompositionLayerDepthInfoKHR; + + + +#define XR_KHR_composition_layer_cylinder 1 +#define XR_KHR_composition_layer_cylinder_SPEC_VERSION 4 +#define XR_KHR_COMPOSITION_LAYER_CYLINDER_EXTENSION_NAME "XR_KHR_composition_layer_cylinder" +typedef struct XrCompositionLayerCylinderKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrCompositionLayerFlags layerFlags; + XrSpace space; + XrEyeVisibility eyeVisibility; + XrSwapchainSubImage subImage; + XrPosef pose; + float radius; + float centralAngle; + float aspectRatio; +} XrCompositionLayerCylinderKHR; + + + +#define XR_KHR_composition_layer_equirect 1 +#define XR_KHR_composition_layer_equirect_SPEC_VERSION 3 +#define XR_KHR_COMPOSITION_LAYER_EQUIRECT_EXTENSION_NAME "XR_KHR_composition_layer_equirect" +typedef struct XrCompositionLayerEquirectKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrCompositionLayerFlags layerFlags; + XrSpace space; + XrEyeVisibility eyeVisibility; + XrSwapchainSubImage subImage; + XrPosef pose; + float radius; + XrVector2f scale; + XrVector2f bias; +} XrCompositionLayerEquirectKHR; + + + +#define XR_KHR_visibility_mask 1 +#define XR_KHR_visibility_mask_SPEC_VERSION 2 +#define XR_KHR_VISIBILITY_MASK_EXTENSION_NAME "XR_KHR_visibility_mask" + +typedef enum XrVisibilityMaskTypeKHR { + XR_VISIBILITY_MASK_TYPE_HIDDEN_TRIANGLE_MESH_KHR = 1, + XR_VISIBILITY_MASK_TYPE_VISIBLE_TRIANGLE_MESH_KHR = 2, + XR_VISIBILITY_MASK_TYPE_LINE_LOOP_KHR = 3, + XR_VISIBILITY_MASK_TYPE_MAX_ENUM_KHR = 0x7FFFFFFF +} XrVisibilityMaskTypeKHR; +typedef struct XrVisibilityMaskKHR { + XrStructureType type; + void* XR_MAY_ALIAS next; + uint32_t vertexCapacityInput; + uint32_t vertexCountOutput; + XrVector2f* vertices; + uint32_t indexCapacityInput; + uint32_t indexCountOutput; + uint32_t* indices; +} XrVisibilityMaskKHR; + +typedef struct XrEventDataVisibilityMaskChangedKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrSession session; + XrViewConfigurationType viewConfigurationType; + uint32_t viewIndex; +} XrEventDataVisibilityMaskChangedKHR; + +typedef XrResult (XRAPI_PTR *PFN_xrGetVisibilityMaskKHR)(XrSession session, XrViewConfigurationType viewConfigurationType, uint32_t viewIndex, XrVisibilityMaskTypeKHR visibilityMaskType, XrVisibilityMaskKHR* visibilityMask); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrGetVisibilityMaskKHR( + XrSession session, + XrViewConfigurationType viewConfigurationType, + uint32_t viewIndex, + XrVisibilityMaskTypeKHR visibilityMaskType, + XrVisibilityMaskKHR* visibilityMask); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ + + +#define XR_KHR_composition_layer_color_scale_bias 1 +#define XR_KHR_composition_layer_color_scale_bias_SPEC_VERSION 5 +#define XR_KHR_COMPOSITION_LAYER_COLOR_SCALE_BIAS_EXTENSION_NAME "XR_KHR_composition_layer_color_scale_bias" +// XrCompositionLayerColorScaleBiasKHR extends XrCompositionLayerBaseHeader +typedef struct XrCompositionLayerColorScaleBiasKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrColor4f colorScale; + XrColor4f colorBias; +} XrCompositionLayerColorScaleBiasKHR; + + + +#define XR_KHR_loader_init 1 +#define XR_KHR_loader_init_SPEC_VERSION 1 +#define XR_KHR_LOADER_INIT_EXTENSION_NAME "XR_KHR_loader_init" +typedef struct XR_MAY_ALIAS XrLoaderInitInfoBaseHeaderKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; +} XrLoaderInitInfoBaseHeaderKHR; + +typedef XrResult (XRAPI_PTR *PFN_xrInitializeLoaderKHR)(const XrLoaderInitInfoBaseHeaderKHR* loaderInitInfo); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrInitializeLoaderKHR( + const XrLoaderInitInfoBaseHeaderKHR* loaderInitInfo); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ + + +#define XR_KHR_composition_layer_equirect2 1 +#define XR_KHR_composition_layer_equirect2_SPEC_VERSION 1 +#define XR_KHR_COMPOSITION_LAYER_EQUIRECT2_EXTENSION_NAME "XR_KHR_composition_layer_equirect2" +typedef struct XrCompositionLayerEquirect2KHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrCompositionLayerFlags layerFlags; + XrSpace space; + XrEyeVisibility eyeVisibility; + XrSwapchainSubImage subImage; + XrPosef pose; + float radius; + float centralHorizontalAngle; + float upperVerticalAngle; + float lowerVerticalAngle; +} XrCompositionLayerEquirect2KHR; + + + +#define XR_KHR_binding_modification 1 +#define XR_KHR_binding_modification_SPEC_VERSION 1 +#define XR_KHR_BINDING_MODIFICATION_EXTENSION_NAME "XR_KHR_binding_modification" +typedef struct XrBindingModificationBaseHeaderKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; +} XrBindingModificationBaseHeaderKHR; + +// XrBindingModificationsKHR extends XrInteractionProfileSuggestedBinding +typedef struct XrBindingModificationsKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + uint32_t bindingModificationCount; + const XrBindingModificationBaseHeaderKHR* const* bindingModifications; +} XrBindingModificationsKHR; + + + +#define XR_EXT_performance_settings 1 +#define XR_EXT_performance_settings_SPEC_VERSION 2 +#define XR_EXT_PERFORMANCE_SETTINGS_EXTENSION_NAME "XR_EXT_performance_settings" + +typedef enum XrPerfSettingsDomainEXT { + XR_PERF_SETTINGS_DOMAIN_CPU_EXT = 1, + XR_PERF_SETTINGS_DOMAIN_GPU_EXT = 2, + XR_PERF_SETTINGS_DOMAIN_MAX_ENUM_EXT = 0x7FFFFFFF +} XrPerfSettingsDomainEXT; + +typedef enum XrPerfSettingsSubDomainEXT { + XR_PERF_SETTINGS_SUB_DOMAIN_COMPOSITING_EXT = 1, + XR_PERF_SETTINGS_SUB_DOMAIN_RENDERING_EXT = 2, + XR_PERF_SETTINGS_SUB_DOMAIN_THERMAL_EXT = 3, + XR_PERF_SETTINGS_SUB_DOMAIN_MAX_ENUM_EXT = 0x7FFFFFFF +} XrPerfSettingsSubDomainEXT; + +typedef enum XrPerfSettingsLevelEXT { + XR_PERF_SETTINGS_LEVEL_POWER_SAVINGS_EXT = 0, + XR_PERF_SETTINGS_LEVEL_SUSTAINED_LOW_EXT = 25, + XR_PERF_SETTINGS_LEVEL_SUSTAINED_HIGH_EXT = 50, + XR_PERF_SETTINGS_LEVEL_BOOST_EXT = 75, + XR_PERF_SETTINGS_LEVEL_MAX_ENUM_EXT = 0x7FFFFFFF +} XrPerfSettingsLevelEXT; + +typedef enum XrPerfSettingsNotificationLevelEXT { + XR_PERF_SETTINGS_NOTIF_LEVEL_NORMAL_EXT = 0, + XR_PERF_SETTINGS_NOTIF_LEVEL_WARNING_EXT = 25, + XR_PERF_SETTINGS_NOTIF_LEVEL_IMPAIRED_EXT = 75, + XR_PERF_SETTINGS_NOTIFICATION_LEVEL_MAX_ENUM_EXT = 0x7FFFFFFF +} XrPerfSettingsNotificationLevelEXT; +typedef struct XrEventDataPerfSettingsEXT { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrPerfSettingsDomainEXT domain; + XrPerfSettingsSubDomainEXT subDomain; + XrPerfSettingsNotificationLevelEXT fromLevel; + XrPerfSettingsNotificationLevelEXT toLevel; +} XrEventDataPerfSettingsEXT; + +typedef XrResult (XRAPI_PTR *PFN_xrPerfSettingsSetPerformanceLevelEXT)(XrSession session, XrPerfSettingsDomainEXT domain, XrPerfSettingsLevelEXT level); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrPerfSettingsSetPerformanceLevelEXT( + XrSession session, + XrPerfSettingsDomainEXT domain, + XrPerfSettingsLevelEXT level); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ + + +#define XR_EXT_thermal_query 1 +#define XR_EXT_thermal_query_SPEC_VERSION 1 +#define XR_EXT_THERMAL_QUERY_EXTENSION_NAME "XR_EXT_thermal_query" +typedef XrResult (XRAPI_PTR *PFN_xrThermalGetTemperatureTrendEXT)(XrSession session, XrPerfSettingsDomainEXT domain, XrPerfSettingsNotificationLevelEXT* notificationLevel, float* tempHeadroom, float* tempSlope); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrThermalGetTemperatureTrendEXT( + XrSession session, + XrPerfSettingsDomainEXT domain, + XrPerfSettingsNotificationLevelEXT* notificationLevel, + float* tempHeadroom, + float* tempSlope); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ + + +#define XR_EXT_debug_utils 1 +XR_DEFINE_HANDLE(XrDebugUtilsMessengerEXT) +#define XR_EXT_debug_utils_SPEC_VERSION 3 +#define XR_EXT_DEBUG_UTILS_EXTENSION_NAME "XR_EXT_debug_utils" +typedef XrFlags64 XrDebugUtilsMessageSeverityFlagsEXT; + +// Flag bits for XrDebugUtilsMessageSeverityFlagsEXT +static const XrDebugUtilsMessageSeverityFlagsEXT XR_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT = 0x00000001; +static const XrDebugUtilsMessageSeverityFlagsEXT XR_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT = 0x00000010; +static const XrDebugUtilsMessageSeverityFlagsEXT XR_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT = 0x00000100; +static const XrDebugUtilsMessageSeverityFlagsEXT XR_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT = 0x00001000; + +typedef XrFlags64 XrDebugUtilsMessageTypeFlagsEXT; + +// Flag bits for XrDebugUtilsMessageTypeFlagsEXT +static const XrDebugUtilsMessageTypeFlagsEXT XR_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT = 0x00000001; +static const XrDebugUtilsMessageTypeFlagsEXT XR_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT = 0x00000002; +static const XrDebugUtilsMessageTypeFlagsEXT XR_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT = 0x00000004; +static const XrDebugUtilsMessageTypeFlagsEXT XR_DEBUG_UTILS_MESSAGE_TYPE_CONFORMANCE_BIT_EXT = 0x00000008; + +typedef struct XrDebugUtilsObjectNameInfoEXT { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrObjectType objectType; + uint64_t objectHandle; + const char* objectName; +} XrDebugUtilsObjectNameInfoEXT; + +typedef struct XrDebugUtilsLabelEXT { + XrStructureType type; + const void* XR_MAY_ALIAS next; + const char* labelName; +} XrDebugUtilsLabelEXT; + +typedef struct XrDebugUtilsMessengerCallbackDataEXT { + XrStructureType type; + const void* XR_MAY_ALIAS next; + const char* messageId; + const char* functionName; + const char* message; + uint32_t objectCount; + XrDebugUtilsObjectNameInfoEXT* objects; + uint32_t sessionLabelCount; + XrDebugUtilsLabelEXT* sessionLabels; +} XrDebugUtilsMessengerCallbackDataEXT; + +typedef XrBool32 (XRAPI_PTR *PFN_xrDebugUtilsMessengerCallbackEXT)( + XrDebugUtilsMessageSeverityFlagsEXT messageSeverity, + XrDebugUtilsMessageTypeFlagsEXT messageTypes, + const XrDebugUtilsMessengerCallbackDataEXT* callbackData, + void* userData); + + +// XrDebugUtilsMessengerCreateInfoEXT extends XrInstanceCreateInfo +typedef struct XrDebugUtilsMessengerCreateInfoEXT { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrDebugUtilsMessageSeverityFlagsEXT messageSeverities; + XrDebugUtilsMessageTypeFlagsEXT messageTypes; + PFN_xrDebugUtilsMessengerCallbackEXT userCallback; + void* XR_MAY_ALIAS userData; +} XrDebugUtilsMessengerCreateInfoEXT; + +typedef XrResult (XRAPI_PTR *PFN_xrSetDebugUtilsObjectNameEXT)(XrInstance instance, const XrDebugUtilsObjectNameInfoEXT* nameInfo); +typedef XrResult (XRAPI_PTR *PFN_xrCreateDebugUtilsMessengerEXT)(XrInstance instance, const XrDebugUtilsMessengerCreateInfoEXT* createInfo, XrDebugUtilsMessengerEXT* messenger); +typedef XrResult (XRAPI_PTR *PFN_xrDestroyDebugUtilsMessengerEXT)(XrDebugUtilsMessengerEXT messenger); +typedef XrResult (XRAPI_PTR *PFN_xrSubmitDebugUtilsMessageEXT)(XrInstance instance, XrDebugUtilsMessageSeverityFlagsEXT messageSeverity, XrDebugUtilsMessageTypeFlagsEXT messageTypes, const XrDebugUtilsMessengerCallbackDataEXT* callbackData); +typedef XrResult (XRAPI_PTR *PFN_xrSessionBeginDebugUtilsLabelRegionEXT)(XrSession session, const XrDebugUtilsLabelEXT* labelInfo); +typedef XrResult (XRAPI_PTR *PFN_xrSessionEndDebugUtilsLabelRegionEXT)(XrSession session); +typedef XrResult (XRAPI_PTR *PFN_xrSessionInsertDebugUtilsLabelEXT)(XrSession session, const XrDebugUtilsLabelEXT* labelInfo); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrSetDebugUtilsObjectNameEXT( + XrInstance instance, + const XrDebugUtilsObjectNameInfoEXT* nameInfo); + +XRAPI_ATTR XrResult XRAPI_CALL xrCreateDebugUtilsMessengerEXT( + XrInstance instance, + const XrDebugUtilsMessengerCreateInfoEXT* createInfo, + XrDebugUtilsMessengerEXT* messenger); + +XRAPI_ATTR XrResult XRAPI_CALL xrDestroyDebugUtilsMessengerEXT( + XrDebugUtilsMessengerEXT messenger); + +XRAPI_ATTR XrResult XRAPI_CALL xrSubmitDebugUtilsMessageEXT( + XrInstance instance, + XrDebugUtilsMessageSeverityFlagsEXT messageSeverity, + XrDebugUtilsMessageTypeFlagsEXT messageTypes, + const XrDebugUtilsMessengerCallbackDataEXT* callbackData); + +XRAPI_ATTR XrResult XRAPI_CALL xrSessionBeginDebugUtilsLabelRegionEXT( + XrSession session, + const XrDebugUtilsLabelEXT* labelInfo); + +XRAPI_ATTR XrResult XRAPI_CALL xrSessionEndDebugUtilsLabelRegionEXT( + XrSession session); + +XRAPI_ATTR XrResult XRAPI_CALL xrSessionInsertDebugUtilsLabelEXT( + XrSession session, + const XrDebugUtilsLabelEXT* labelInfo); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ + + +#define XR_EXT_eye_gaze_interaction 1 +#define XR_EXT_eye_gaze_interaction_SPEC_VERSION 1 +#define XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME "XR_EXT_eye_gaze_interaction" +// XrSystemEyeGazeInteractionPropertiesEXT extends XrSystemProperties +typedef struct XrSystemEyeGazeInteractionPropertiesEXT { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrBool32 supportsEyeGazeInteraction; +} XrSystemEyeGazeInteractionPropertiesEXT; + +// XrEyeGazeSampleTimeEXT extends XrSpaceLocation +typedef struct XrEyeGazeSampleTimeEXT { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrTime time; +} XrEyeGazeSampleTimeEXT; + + + +#define XR_EXTX_overlay 1 +#define XR_EXTX_overlay_SPEC_VERSION 5 +#define XR_EXTX_OVERLAY_EXTENSION_NAME "XR_EXTX_overlay" +typedef XrFlags64 XrOverlaySessionCreateFlagsEXTX; + +// Flag bits for XrOverlaySessionCreateFlagsEXTX + +typedef XrFlags64 XrOverlayMainSessionFlagsEXTX; + +// Flag bits for XrOverlayMainSessionFlagsEXTX +static const XrOverlayMainSessionFlagsEXTX XR_OVERLAY_MAIN_SESSION_ENABLED_COMPOSITION_LAYER_INFO_DEPTH_BIT_EXTX = 0x00000001; + +// XrSessionCreateInfoOverlayEXTX extends XrSessionCreateInfo +typedef struct XrSessionCreateInfoOverlayEXTX { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrOverlaySessionCreateFlagsEXTX createFlags; + uint32_t sessionLayersPlacement; +} XrSessionCreateInfoOverlayEXTX; + +typedef struct XrEventDataMainSessionVisibilityChangedEXTX { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrBool32 visible; + XrOverlayMainSessionFlagsEXTX flags; +} XrEventDataMainSessionVisibilityChangedEXTX; + + + +#define XR_VARJO_quad_views 1 +#define XR_VARJO_quad_views_SPEC_VERSION 1 +#define XR_VARJO_QUAD_VIEWS_EXTENSION_NAME "XR_VARJO_quad_views" + + +#define XR_MSFT_unbounded_reference_space 1 +#define XR_MSFT_unbounded_reference_space_SPEC_VERSION 1 +#define XR_MSFT_UNBOUNDED_REFERENCE_SPACE_EXTENSION_NAME "XR_MSFT_unbounded_reference_space" + + +#define XR_MSFT_spatial_anchor 1 +XR_DEFINE_HANDLE(XrSpatialAnchorMSFT) +#define XR_MSFT_spatial_anchor_SPEC_VERSION 1 +#define XR_MSFT_SPATIAL_ANCHOR_EXTENSION_NAME "XR_MSFT_spatial_anchor" +typedef struct XrSpatialAnchorCreateInfoMSFT { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrSpace space; + XrPosef pose; + XrTime time; +} XrSpatialAnchorCreateInfoMSFT; + +typedef struct XrSpatialAnchorSpaceCreateInfoMSFT { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrSpatialAnchorMSFT anchor; + XrPosef poseInAnchorSpace; +} XrSpatialAnchorSpaceCreateInfoMSFT; + +typedef XrResult (XRAPI_PTR *PFN_xrCreateSpatialAnchorMSFT)(XrSession session, const XrSpatialAnchorCreateInfoMSFT* createInfo, XrSpatialAnchorMSFT* anchor); +typedef XrResult (XRAPI_PTR *PFN_xrCreateSpatialAnchorSpaceMSFT)(XrSession session, const XrSpatialAnchorSpaceCreateInfoMSFT* createInfo, XrSpace* space); +typedef XrResult (XRAPI_PTR *PFN_xrDestroySpatialAnchorMSFT)(XrSpatialAnchorMSFT anchor); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrCreateSpatialAnchorMSFT( + XrSession session, + const XrSpatialAnchorCreateInfoMSFT* createInfo, + XrSpatialAnchorMSFT* anchor); + +XRAPI_ATTR XrResult XRAPI_CALL xrCreateSpatialAnchorSpaceMSFT( + XrSession session, + const XrSpatialAnchorSpaceCreateInfoMSFT* createInfo, + XrSpace* space); + +XRAPI_ATTR XrResult XRAPI_CALL xrDestroySpatialAnchorMSFT( + XrSpatialAnchorMSFT anchor); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ + + +#define XR_MND_headless 1 +#define XR_MND_headless_SPEC_VERSION 2 +#define XR_MND_HEADLESS_EXTENSION_NAME "XR_MND_headless" + + +#define XR_OCULUS_android_session_state_enable 1 +#define XR_OCULUS_android_session_state_enable_SPEC_VERSION 1 +#define XR_OCULUS_ANDROID_SESSION_STATE_ENABLE_EXTENSION_NAME "XR_OCULUS_android_session_state_enable" + + +#define XR_EXT_view_configuration_depth_range 1 +#define XR_EXT_view_configuration_depth_range_SPEC_VERSION 1 +#define XR_EXT_VIEW_CONFIGURATION_DEPTH_RANGE_EXTENSION_NAME "XR_EXT_view_configuration_depth_range" +// XrViewConfigurationDepthRangeEXT extends XrViewConfigurationView +typedef struct XrViewConfigurationDepthRangeEXT { + XrStructureType type; + void* XR_MAY_ALIAS next; + float recommendedNearZ; + float minNearZ; + float recommendedFarZ; + float maxFarZ; +} XrViewConfigurationDepthRangeEXT; + + + +#define XR_EXT_conformance_automation 1 +#define XR_EXT_conformance_automation_SPEC_VERSION 2 +#define XR_EXT_CONFORMANCE_AUTOMATION_EXTENSION_NAME "XR_EXT_conformance_automation" +typedef XrResult (XRAPI_PTR *PFN_xrSetInputDeviceActiveEXT)(XrSession session, XrPath interactionProfile, XrPath topLevelPath, XrBool32 isActive); +typedef XrResult (XRAPI_PTR *PFN_xrSetInputDeviceStateBoolEXT)(XrSession session, XrPath topLevelPath, XrPath inputSourcePath, XrBool32 state); +typedef XrResult (XRAPI_PTR *PFN_xrSetInputDeviceStateFloatEXT)(XrSession session, XrPath topLevelPath, XrPath inputSourcePath, float state); +typedef XrResult (XRAPI_PTR *PFN_xrSetInputDeviceStateVector2fEXT)(XrSession session, XrPath topLevelPath, XrPath inputSourcePath, XrVector2f state); +typedef XrResult (XRAPI_PTR *PFN_xrSetInputDeviceLocationEXT)(XrSession session, XrPath topLevelPath, XrPath inputSourcePath, XrSpace space, XrPosef pose); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrSetInputDeviceActiveEXT( + XrSession session, + XrPath interactionProfile, + XrPath topLevelPath, + XrBool32 isActive); + +XRAPI_ATTR XrResult XRAPI_CALL xrSetInputDeviceStateBoolEXT( + XrSession session, + XrPath topLevelPath, + XrPath inputSourcePath, + XrBool32 state); + +XRAPI_ATTR XrResult XRAPI_CALL xrSetInputDeviceStateFloatEXT( + XrSession session, + XrPath topLevelPath, + XrPath inputSourcePath, + float state); + +XRAPI_ATTR XrResult XRAPI_CALL xrSetInputDeviceStateVector2fEXT( + XrSession session, + XrPath topLevelPath, + XrPath inputSourcePath, + XrVector2f state); + +XRAPI_ATTR XrResult XRAPI_CALL xrSetInputDeviceLocationEXT( + XrSession session, + XrPath topLevelPath, + XrPath inputSourcePath, + XrSpace space, + XrPosef pose); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ + + +#define XR_MSFT_spatial_graph_bridge 1 +#define XR_MSFT_spatial_graph_bridge_SPEC_VERSION 1 +#define XR_MSFT_SPATIAL_GRAPH_BRIDGE_EXTENSION_NAME "XR_MSFT_spatial_graph_bridge" + +typedef enum XrSpatialGraphNodeTypeMSFT { + XR_SPATIAL_GRAPH_NODE_TYPE_STATIC_MSFT = 1, + XR_SPATIAL_GRAPH_NODE_TYPE_DYNAMIC_MSFT = 2, + XR_SPATIAL_GRAPH_NODE_TYPE_MAX_ENUM_MSFT = 0x7FFFFFFF +} XrSpatialGraphNodeTypeMSFT; +typedef struct XrSpatialGraphNodeSpaceCreateInfoMSFT { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrSpatialGraphNodeTypeMSFT nodeType; + uint8_t nodeId[16]; + XrPosef pose; +} XrSpatialGraphNodeSpaceCreateInfoMSFT; + +typedef XrResult (XRAPI_PTR *PFN_xrCreateSpatialGraphNodeSpaceMSFT)(XrSession session, const XrSpatialGraphNodeSpaceCreateInfoMSFT* createInfo, XrSpace* space); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrCreateSpatialGraphNodeSpaceMSFT( + XrSession session, + const XrSpatialGraphNodeSpaceCreateInfoMSFT* createInfo, + XrSpace* space); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ + + +#define XR_MSFT_hand_interaction 1 +#define XR_MSFT_hand_interaction_SPEC_VERSION 1 +#define XR_MSFT_HAND_INTERACTION_EXTENSION_NAME "XR_MSFT_hand_interaction" + + +#define XR_EXT_hand_tracking 1 + +#define XR_HAND_JOINT_COUNT_EXT 26 + +XR_DEFINE_HANDLE(XrHandTrackerEXT) +#define XR_EXT_hand_tracking_SPEC_VERSION 3 +#define XR_EXT_HAND_TRACKING_EXTENSION_NAME "XR_EXT_hand_tracking" + +typedef enum XrHandEXT { + XR_HAND_LEFT_EXT = 1, + XR_HAND_RIGHT_EXT = 2, + XR_HAND_MAX_ENUM_EXT = 0x7FFFFFFF +} XrHandEXT; + +typedef enum XrHandJointEXT { + XR_HAND_JOINT_PALM_EXT = 0, + XR_HAND_JOINT_WRIST_EXT = 1, + XR_HAND_JOINT_THUMB_METACARPAL_EXT = 2, + XR_HAND_JOINT_THUMB_PROXIMAL_EXT = 3, + XR_HAND_JOINT_THUMB_DISTAL_EXT = 4, + XR_HAND_JOINT_THUMB_TIP_EXT = 5, + XR_HAND_JOINT_INDEX_METACARPAL_EXT = 6, + XR_HAND_JOINT_INDEX_PROXIMAL_EXT = 7, + XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT = 8, + XR_HAND_JOINT_INDEX_DISTAL_EXT = 9, + XR_HAND_JOINT_INDEX_TIP_EXT = 10, + XR_HAND_JOINT_MIDDLE_METACARPAL_EXT = 11, + XR_HAND_JOINT_MIDDLE_PROXIMAL_EXT = 12, + XR_HAND_JOINT_MIDDLE_INTERMEDIATE_EXT = 13, + XR_HAND_JOINT_MIDDLE_DISTAL_EXT = 14, + XR_HAND_JOINT_MIDDLE_TIP_EXT = 15, + XR_HAND_JOINT_RING_METACARPAL_EXT = 16, + XR_HAND_JOINT_RING_PROXIMAL_EXT = 17, + XR_HAND_JOINT_RING_INTERMEDIATE_EXT = 18, + XR_HAND_JOINT_RING_DISTAL_EXT = 19, + XR_HAND_JOINT_RING_TIP_EXT = 20, + XR_HAND_JOINT_LITTLE_METACARPAL_EXT = 21, + XR_HAND_JOINT_LITTLE_PROXIMAL_EXT = 22, + XR_HAND_JOINT_LITTLE_INTERMEDIATE_EXT = 23, + XR_HAND_JOINT_LITTLE_DISTAL_EXT = 24, + XR_HAND_JOINT_LITTLE_TIP_EXT = 25, + XR_HAND_JOINT_MAX_ENUM_EXT = 0x7FFFFFFF +} XrHandJointEXT; + +typedef enum XrHandJointSetEXT { + XR_HAND_JOINT_SET_DEFAULT_EXT = 0, + XR_HAND_JOINT_SET_MAX_ENUM_EXT = 0x7FFFFFFF +} XrHandJointSetEXT; +// XrSystemHandTrackingPropertiesEXT extends XrSystemProperties +typedef struct XrSystemHandTrackingPropertiesEXT { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrBool32 supportsHandTracking; +} XrSystemHandTrackingPropertiesEXT; + +typedef struct XrHandTrackerCreateInfoEXT { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrHandEXT hand; + XrHandJointSetEXT handJointSet; +} XrHandTrackerCreateInfoEXT; + +typedef struct XrHandJointsLocateInfoEXT { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrSpace baseSpace; + XrTime time; +} XrHandJointsLocateInfoEXT; + +typedef struct XrHandJointLocationEXT { + XrSpaceLocationFlags locationFlags; + XrPosef pose; + float radius; +} XrHandJointLocationEXT; + +typedef struct XrHandJointVelocityEXT { + XrSpaceVelocityFlags velocityFlags; + XrVector3f linearVelocity; + XrVector3f angularVelocity; +} XrHandJointVelocityEXT; + +typedef struct XrHandJointLocationsEXT { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrBool32 isActive; + uint32_t jointCount; + XrHandJointLocationEXT* jointLocations; +} XrHandJointLocationsEXT; + +// XrHandJointVelocitiesEXT extends XrHandJointLocationsEXT +typedef struct XrHandJointVelocitiesEXT { + XrStructureType type; + void* XR_MAY_ALIAS next; + uint32_t jointCount; + XrHandJointVelocityEXT* jointVelocities; +} XrHandJointVelocitiesEXT; + +typedef XrResult (XRAPI_PTR *PFN_xrCreateHandTrackerEXT)(XrSession session, const XrHandTrackerCreateInfoEXT* createInfo, XrHandTrackerEXT* handTracker); +typedef XrResult (XRAPI_PTR *PFN_xrDestroyHandTrackerEXT)(XrHandTrackerEXT handTracker); +typedef XrResult (XRAPI_PTR *PFN_xrLocateHandJointsEXT)(XrHandTrackerEXT handTracker, const XrHandJointsLocateInfoEXT* locateInfo, XrHandJointLocationsEXT* locations); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrCreateHandTrackerEXT( + XrSession session, + const XrHandTrackerCreateInfoEXT* createInfo, + XrHandTrackerEXT* handTracker); + +XRAPI_ATTR XrResult XRAPI_CALL xrDestroyHandTrackerEXT( + XrHandTrackerEXT handTracker); + +XRAPI_ATTR XrResult XRAPI_CALL xrLocateHandJointsEXT( + XrHandTrackerEXT handTracker, + const XrHandJointsLocateInfoEXT* locateInfo, + XrHandJointLocationsEXT* locations); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ + + +#define XR_MSFT_hand_tracking_mesh 1 +#define XR_MSFT_hand_tracking_mesh_SPEC_VERSION 3 +#define XR_MSFT_HAND_TRACKING_MESH_EXTENSION_NAME "XR_MSFT_hand_tracking_mesh" + +typedef enum XrHandPoseTypeMSFT { + XR_HAND_POSE_TYPE_TRACKED_MSFT = 0, + XR_HAND_POSE_TYPE_REFERENCE_OPEN_PALM_MSFT = 1, + XR_HAND_POSE_TYPE_MAX_ENUM_MSFT = 0x7FFFFFFF +} XrHandPoseTypeMSFT; +// XrSystemHandTrackingMeshPropertiesMSFT extends XrSystemProperties +typedef struct XrSystemHandTrackingMeshPropertiesMSFT { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrBool32 supportsHandTrackingMesh; + uint32_t maxHandMeshIndexCount; + uint32_t maxHandMeshVertexCount; +} XrSystemHandTrackingMeshPropertiesMSFT; + +typedef struct XrHandMeshSpaceCreateInfoMSFT { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrHandPoseTypeMSFT handPoseType; + XrPosef poseInHandMeshSpace; +} XrHandMeshSpaceCreateInfoMSFT; + +typedef struct XrHandMeshUpdateInfoMSFT { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrTime time; + XrHandPoseTypeMSFT handPoseType; +} XrHandMeshUpdateInfoMSFT; + +typedef struct XrHandMeshIndexBufferMSFT { + uint32_t indexBufferKey; + uint32_t indexCapacityInput; + uint32_t indexCountOutput; + uint32_t* indices; +} XrHandMeshIndexBufferMSFT; + +typedef struct XrHandMeshVertexMSFT { + XrVector3f position; + XrVector3f normal; +} XrHandMeshVertexMSFT; + +typedef struct XrHandMeshVertexBufferMSFT { + XrTime vertexUpdateTime; + uint32_t vertexCapacityInput; + uint32_t vertexCountOutput; + XrHandMeshVertexMSFT* vertices; +} XrHandMeshVertexBufferMSFT; + +typedef struct XrHandMeshMSFT { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrBool32 isActive; + XrBool32 indexBufferChanged; + XrBool32 vertexBufferChanged; + XrHandMeshIndexBufferMSFT indexBuffer; + XrHandMeshVertexBufferMSFT vertexBuffer; +} XrHandMeshMSFT; + +// XrHandPoseTypeInfoMSFT extends XrHandTrackerCreateInfoEXT +typedef struct XrHandPoseTypeInfoMSFT { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrHandPoseTypeMSFT handPoseType; +} XrHandPoseTypeInfoMSFT; + +typedef XrResult (XRAPI_PTR *PFN_xrCreateHandMeshSpaceMSFT)(XrHandTrackerEXT handTracker, const XrHandMeshSpaceCreateInfoMSFT* createInfo, XrSpace* space); +typedef XrResult (XRAPI_PTR *PFN_xrUpdateHandMeshMSFT)(XrHandTrackerEXT handTracker, const XrHandMeshUpdateInfoMSFT* updateInfo, XrHandMeshMSFT* handMesh); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrCreateHandMeshSpaceMSFT( + XrHandTrackerEXT handTracker, + const XrHandMeshSpaceCreateInfoMSFT* createInfo, + XrSpace* space); + +XRAPI_ATTR XrResult XRAPI_CALL xrUpdateHandMeshMSFT( + XrHandTrackerEXT handTracker, + const XrHandMeshUpdateInfoMSFT* updateInfo, + XrHandMeshMSFT* handMesh); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ + + +#define XR_MSFT_secondary_view_configuration 1 +#define XR_MSFT_secondary_view_configuration_SPEC_VERSION 1 +#define XR_MSFT_SECONDARY_VIEW_CONFIGURATION_EXTENSION_NAME "XR_MSFT_secondary_view_configuration" +// XrSecondaryViewConfigurationSessionBeginInfoMSFT extends XrSessionBeginInfo +typedef struct XrSecondaryViewConfigurationSessionBeginInfoMSFT { + XrStructureType type; + const void* XR_MAY_ALIAS next; + uint32_t viewConfigurationCount; + const XrViewConfigurationType* enabledViewConfigurationTypes; +} XrSecondaryViewConfigurationSessionBeginInfoMSFT; + +typedef struct XrSecondaryViewConfigurationStateMSFT { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrViewConfigurationType viewConfigurationType; + XrBool32 active; +} XrSecondaryViewConfigurationStateMSFT; + +// XrSecondaryViewConfigurationFrameStateMSFT extends XrFrameState +typedef struct XrSecondaryViewConfigurationFrameStateMSFT { + XrStructureType type; + void* XR_MAY_ALIAS next; + uint32_t viewConfigurationCount; + XrSecondaryViewConfigurationStateMSFT* viewConfigurationStates; +} XrSecondaryViewConfigurationFrameStateMSFT; + +typedef struct XrSecondaryViewConfigurationLayerInfoMSFT { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrViewConfigurationType viewConfigurationType; + XrEnvironmentBlendMode environmentBlendMode; + uint32_t layerCount; + const XrCompositionLayerBaseHeader* const* layers; +} XrSecondaryViewConfigurationLayerInfoMSFT; + +// XrSecondaryViewConfigurationFrameEndInfoMSFT extends XrFrameEndInfo +typedef struct XrSecondaryViewConfigurationFrameEndInfoMSFT { + XrStructureType type; + const void* XR_MAY_ALIAS next; + uint32_t viewConfigurationCount; + const XrSecondaryViewConfigurationLayerInfoMSFT* viewConfigurationLayersInfo; +} XrSecondaryViewConfigurationFrameEndInfoMSFT; + +// XrSecondaryViewConfigurationSwapchainCreateInfoMSFT extends XrSwapchainCreateInfo +typedef struct XrSecondaryViewConfigurationSwapchainCreateInfoMSFT { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrViewConfigurationType viewConfigurationType; +} XrSecondaryViewConfigurationSwapchainCreateInfoMSFT; + + + +#define XR_MSFT_first_person_observer 1 +#define XR_MSFT_first_person_observer_SPEC_VERSION 1 +#define XR_MSFT_FIRST_PERSON_OBSERVER_EXTENSION_NAME "XR_MSFT_first_person_observer" + + +#define XR_MSFT_controller_model 1 + +#define XR_NULL_CONTROLLER_MODEL_KEY_MSFT 0 + +XR_DEFINE_ATOM(XrControllerModelKeyMSFT) +#define XR_MSFT_controller_model_SPEC_VERSION 2 +#define XR_MSFT_CONTROLLER_MODEL_EXTENSION_NAME "XR_MSFT_controller_model" +#define XR_MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT 64 +typedef struct XrControllerModelKeyStateMSFT { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrControllerModelKeyMSFT modelKey; +} XrControllerModelKeyStateMSFT; + +typedef struct XrControllerModelNodePropertiesMSFT { + XrStructureType type; + void* XR_MAY_ALIAS next; + char parentNodeName[XR_MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT]; + char nodeName[XR_MAX_CONTROLLER_MODEL_NODE_NAME_SIZE_MSFT]; +} XrControllerModelNodePropertiesMSFT; + +typedef struct XrControllerModelPropertiesMSFT { + XrStructureType type; + void* XR_MAY_ALIAS next; + uint32_t nodeCapacityInput; + uint32_t nodeCountOutput; + XrControllerModelNodePropertiesMSFT* nodeProperties; +} XrControllerModelPropertiesMSFT; + +typedef struct XrControllerModelNodeStateMSFT { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrPosef nodePose; +} XrControllerModelNodeStateMSFT; + +typedef struct XrControllerModelStateMSFT { + XrStructureType type; + void* XR_MAY_ALIAS next; + uint32_t nodeCapacityInput; + uint32_t nodeCountOutput; + XrControllerModelNodeStateMSFT* nodeStates; +} XrControllerModelStateMSFT; + +typedef XrResult (XRAPI_PTR *PFN_xrGetControllerModelKeyMSFT)(XrSession session, XrPath topLevelUserPath, XrControllerModelKeyStateMSFT* controllerModelKeyState); +typedef XrResult (XRAPI_PTR *PFN_xrLoadControllerModelMSFT)(XrSession session, XrControllerModelKeyMSFT modelKey, uint32_t bufferCapacityInput, uint32_t* bufferCountOutput, uint8_t* buffer); +typedef XrResult (XRAPI_PTR *PFN_xrGetControllerModelPropertiesMSFT)(XrSession session, XrControllerModelKeyMSFT modelKey, XrControllerModelPropertiesMSFT* properties); +typedef XrResult (XRAPI_PTR *PFN_xrGetControllerModelStateMSFT)(XrSession session, XrControllerModelKeyMSFT modelKey, XrControllerModelStateMSFT* state); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrGetControllerModelKeyMSFT( + XrSession session, + XrPath topLevelUserPath, + XrControllerModelKeyStateMSFT* controllerModelKeyState); + +XRAPI_ATTR XrResult XRAPI_CALL xrLoadControllerModelMSFT( + XrSession session, + XrControllerModelKeyMSFT modelKey, + uint32_t bufferCapacityInput, + uint32_t* bufferCountOutput, + uint8_t* buffer); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetControllerModelPropertiesMSFT( + XrSession session, + XrControllerModelKeyMSFT modelKey, + XrControllerModelPropertiesMSFT* properties); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetControllerModelStateMSFT( + XrSession session, + XrControllerModelKeyMSFT modelKey, + XrControllerModelStateMSFT* state); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ + + +#define XR_EXT_win32_appcontainer_compatible 1 +#define XR_EXT_win32_appcontainer_compatible_SPEC_VERSION 1 +#define XR_EXT_WIN32_APPCONTAINER_COMPATIBLE_EXTENSION_NAME "XR_EXT_win32_appcontainer_compatible" + + +#define XR_EPIC_view_configuration_fov 1 +#define XR_EPIC_view_configuration_fov_SPEC_VERSION 2 +#define XR_EPIC_VIEW_CONFIGURATION_FOV_EXTENSION_NAME "XR_EPIC_view_configuration_fov" +// XrViewConfigurationViewFovEPIC extends XrViewConfigurationView +typedef struct XrViewConfigurationViewFovEPIC { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrFovf recommendedFov; + XrFovf maxMutableFov; +} XrViewConfigurationViewFovEPIC; + + + +#define XR_HUAWEI_controller_interaction 1 +#define XR_HUAWEI_controller_interaction_SPEC_VERSION 1 +#define XR_HUAWEI_CONTROLLER_INTERACTION_EXTENSION_NAME "XR_HUAWEI_controller_interaction" + + +#define XR_VALVE_analog_threshold 1 +#define XR_VALVE_analog_threshold_SPEC_VERSION 1 +#define XR_VALVE_ANALOG_THRESHOLD_EXTENSION_NAME "XR_VALVE_analog_threshold" +// XrInteractionProfileAnalogThresholdVALVE extends XrInteractionProfileSuggestedBinding +typedef struct XrInteractionProfileAnalogThresholdVALVE { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrAction action; + XrPath binding; + float onThreshold; + float offThreshold; + const XrHapticBaseHeader* onHaptic; + const XrHapticBaseHeader* offHaptic; +} XrInteractionProfileAnalogThresholdVALVE; + + + +#define XR_EXT_samsung_odyssey_controller 1 +#define XR_EXT_samsung_odyssey_controller_SPEC_VERSION 1 +#define XR_EXT_SAMSUNG_ODYSSEY_CONTROLLER_EXTENSION_NAME "XR_EXT_samsung_odyssey_controller" + + +#define XR_EXT_hp_mixed_reality_controller 1 +#define XR_EXT_hp_mixed_reality_controller_SPEC_VERSION 1 +#define XR_EXT_HP_MIXED_REALITY_CONTROLLER_EXTENSION_NAME "XR_EXT_hp_mixed_reality_controller" + + +#define XR_MND_swapchain_usage_input_attachment_bit 1 +#define XR_MND_swapchain_usage_input_attachment_bit_SPEC_VERSION 2 +#define XR_MND_SWAPCHAIN_USAGE_INPUT_ATTACHMENT_BIT_EXTENSION_NAME "XR_MND_swapchain_usage_input_attachment_bit" + + +#define XR_FB_display_refresh_rate 1 +#define XR_FB_display_refresh_rate_SPEC_VERSION 1 +#define XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME "XR_FB_display_refresh_rate" +typedef struct XrEventDataDisplayRefreshRateChangedFB { + XrStructureType type; + const void* XR_MAY_ALIAS next; + float fromDisplayRefreshRate; + float toDisplayRefreshRate; +} XrEventDataDisplayRefreshRateChangedFB; + +typedef XrResult (XRAPI_PTR *PFN_xrEnumerateDisplayRefreshRatesFB)(XrSession session, uint32_t displayRefreshRateCapacityInput, uint32_t* displayRefreshRateCountOutput, float* displayRefreshRates); +typedef XrResult (XRAPI_PTR *PFN_xrGetDisplayRefreshRateFB)(XrSession session, float* displayRefreshRate); +typedef XrResult (XRAPI_PTR *PFN_xrRequestDisplayRefreshRateFB)(XrSession session, float displayRefreshRate); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrEnumerateDisplayRefreshRatesFB( + XrSession session, + uint32_t displayRefreshRateCapacityInput, + uint32_t* displayRefreshRateCountOutput, + float* displayRefreshRates); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetDisplayRefreshRateFB( + XrSession session, + float* displayRefreshRate); + +XRAPI_ATTR XrResult XRAPI_CALL xrRequestDisplayRefreshRateFB( + XrSession session, + float displayRefreshRate); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ + + +#define XR_HTC_vive_cosmos_controller_interaction 1 +#define XR_HTC_vive_cosmos_controller_interaction_SPEC_VERSION 1 +#define XR_HTC_VIVE_COSMOS_CONTROLLER_INTERACTION_EXTENSION_NAME "XR_HTC_vive_cosmos_controller_interaction" + + +#define XR_FB_color_space 1 +#define XR_FB_color_space_SPEC_VERSION 1 +#define XR_FB_COLOR_SPACE_EXTENSION_NAME "XR_FB_color_space" + +typedef enum XrColorSpaceFB { + XR_COLOR_SPACE_UNMANAGED_FB = 0, + XR_COLOR_SPACE_REC2020_FB = 1, + XR_COLOR_SPACE_REC709_FB = 2, + XR_COLOR_SPACE_RIFT_CV1_FB = 3, + XR_COLOR_SPACE_RIFT_S_FB = 4, + XR_COLOR_SPACE_QUEST_FB = 5, + XR_COLOR_SPACE_P3_FB = 6, + XR_COLOR_SPACE_ADOBE_RGB_FB = 7, + XR_COLOR_SPACE_MAX_ENUM_FB = 0x7FFFFFFF +} XrColorSpaceFB; +typedef struct XrSystemColorSpacePropertiesFB { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrColorSpaceFB colorSpace; +} XrSystemColorSpacePropertiesFB; + +typedef XrResult (XRAPI_PTR *PFN_xrEnumerateColorSpacesFB)(XrSession session, uint32_t colorSpaceCapacityInput, uint32_t* colorSpaceCountOutput, XrColorSpaceFB* colorSpaces); +typedef XrResult (XRAPI_PTR *PFN_xrSetColorSpaceFB)(XrSession session, const XrColorSpaceFB colorspace); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrEnumerateColorSpacesFB( + XrSession session, + uint32_t colorSpaceCapacityInput, + uint32_t* colorSpaceCountOutput, + XrColorSpaceFB* colorSpaces); + +XRAPI_ATTR XrResult XRAPI_CALL xrSetColorSpaceFB( + XrSession session, + const XrColorSpaceFB colorspace); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ + + +#define XR_VARJO_foveated_rendering 1 +#define XR_VARJO_foveated_rendering_SPEC_VERSION 1 +#define XR_VARJO_FOVEATED_RENDERING_EXTENSION_NAME "XR_VARJO_foveated_rendering" +// XrViewLocateFoveatedRenderingVARJO extends XrViewLocateInfo +typedef struct XrViewLocateFoveatedRenderingVARJO { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrBool32 foveatedRenderingActive; +} XrViewLocateFoveatedRenderingVARJO; + +// XrFoveatedViewConfigurationViewVARJO extends XrViewConfigurationView +typedef struct XrFoveatedViewConfigurationViewVARJO { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrBool32 foveatedRenderingActive; +} XrFoveatedViewConfigurationViewVARJO; + +// XrSystemFoveatedRenderingPropertiesVARJO extends XrSystemProperties +typedef struct XrSystemFoveatedRenderingPropertiesVARJO { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrBool32 supportsFoveatedRendering; +} XrSystemFoveatedRenderingPropertiesVARJO; + + + +#define XR_VARJO_composition_layer_depth_test 1 +#define XR_VARJO_composition_layer_depth_test_SPEC_VERSION 1 +#define XR_VARJO_COMPOSITION_LAYER_DEPTH_TEST_EXTENSION_NAME "XR_VARJO_composition_layer_depth_test" +// XrCompositionLayerDepthTestVARJO extends XrCompositionLayerProjection +typedef struct XrCompositionLayerDepthTestVARJO { + XrStructureType type; + const void* XR_MAY_ALIAS next; + float depthTestRangeNearZ; + float depthTestRangeFarZ; +} XrCompositionLayerDepthTestVARJO; + + + +#define XR_VARJO_environment_depth_estimation 1 +#define XR_VARJO_environment_depth_estimation_SPEC_VERSION 1 +#define XR_VARJO_ENVIRONMENT_DEPTH_ESTIMATION_EXTENSION_NAME "XR_VARJO_environment_depth_estimation" +typedef XrResult (XRAPI_PTR *PFN_xrSetEnvironmentDepthEstimationVARJO)(XrSession session, XrBool32 enabled); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrSetEnvironmentDepthEstimationVARJO( + XrSession session, + XrBool32 enabled); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Externals/OpenXR/include/openxr/openxr_platform.h b/Externals/OpenXR/include/openxr/openxr_platform.h new file mode 100644 index 000000000000..bd5d6f65554c --- /dev/null +++ b/Externals/OpenXR/include/openxr/openxr_platform.h @@ -0,0 +1,572 @@ +#ifndef OPENXR_PLATFORM_H_ +#define OPENXR_PLATFORM_H_ 1 + +/* +** Copyright (c) 2017-2021, The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 OR MIT +*/ + +/* +** This header is generated from the Khronos OpenXR XML API Registry. +** +*/ + +#include "openxr.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef XR_USE_PLATFORM_ANDROID + +#define XR_KHR_android_thread_settings 1 +#define XR_KHR_android_thread_settings_SPEC_VERSION 5 +#define XR_KHR_ANDROID_THREAD_SETTINGS_EXTENSION_NAME "XR_KHR_android_thread_settings" + +typedef enum XrAndroidThreadTypeKHR { + XR_ANDROID_THREAD_TYPE_APPLICATION_MAIN_KHR = 1, + XR_ANDROID_THREAD_TYPE_APPLICATION_WORKER_KHR = 2, + XR_ANDROID_THREAD_TYPE_RENDERER_MAIN_KHR = 3, + XR_ANDROID_THREAD_TYPE_RENDERER_WORKER_KHR = 4, + XR_ANDROID_THREAD_TYPE_MAX_ENUM_KHR = 0x7FFFFFFF +} XrAndroidThreadTypeKHR; +typedef XrResult (XRAPI_PTR *PFN_xrSetAndroidApplicationThreadKHR)(XrSession session, XrAndroidThreadTypeKHR threadType, uint32_t threadId); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrSetAndroidApplicationThreadKHR( + XrSession session, + XrAndroidThreadTypeKHR threadType, + uint32_t threadId); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ +#endif /* XR_USE_PLATFORM_ANDROID */ + +#ifdef XR_USE_PLATFORM_ANDROID + +#define XR_KHR_android_surface_swapchain 1 +#define XR_KHR_android_surface_swapchain_SPEC_VERSION 4 +#define XR_KHR_ANDROID_SURFACE_SWAPCHAIN_EXTENSION_NAME "XR_KHR_android_surface_swapchain" +typedef XrResult (XRAPI_PTR *PFN_xrCreateSwapchainAndroidSurfaceKHR)(XrSession session, const XrSwapchainCreateInfo* info, XrSwapchain* swapchain, jobject* surface); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrCreateSwapchainAndroidSurfaceKHR( + XrSession session, + const XrSwapchainCreateInfo* info, + XrSwapchain* swapchain, + jobject* surface); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ +#endif /* XR_USE_PLATFORM_ANDROID */ + +#ifdef XR_USE_PLATFORM_ANDROID + +#define XR_KHR_android_create_instance 1 +#define XR_KHR_android_create_instance_SPEC_VERSION 3 +#define XR_KHR_ANDROID_CREATE_INSTANCE_EXTENSION_NAME "XR_KHR_android_create_instance" +// XrInstanceCreateInfoAndroidKHR extends XrInstanceCreateInfo +typedef struct XrInstanceCreateInfoAndroidKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + void* XR_MAY_ALIAS applicationVM; + void* XR_MAY_ALIAS applicationActivity; +} XrInstanceCreateInfoAndroidKHR; + +#endif /* XR_USE_PLATFORM_ANDROID */ + +#ifdef XR_USE_GRAPHICS_API_VULKAN + +#define XR_KHR_vulkan_swapchain_format_list 1 +#define XR_KHR_vulkan_swapchain_format_list_SPEC_VERSION 4 +#define XR_KHR_VULKAN_SWAPCHAIN_FORMAT_LIST_EXTENSION_NAME "XR_KHR_vulkan_swapchain_format_list" +typedef struct XrVulkanSwapchainFormatListCreateInfoKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + uint32_t viewFormatCount; + const VkFormat* viewFormats; +} XrVulkanSwapchainFormatListCreateInfoKHR; + +#endif /* XR_USE_GRAPHICS_API_VULKAN */ + +#ifdef XR_USE_GRAPHICS_API_OPENGL + +#define XR_KHR_opengl_enable 1 +#define XR_KHR_opengl_enable_SPEC_VERSION 9 +#define XR_KHR_OPENGL_ENABLE_EXTENSION_NAME "XR_KHR_opengl_enable" +#ifdef XR_USE_PLATFORM_WIN32 +// XrGraphicsBindingOpenGLWin32KHR extends XrSessionCreateInfo +typedef struct XrGraphicsBindingOpenGLWin32KHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + HDC hDC; + HGLRC hGLRC; +} XrGraphicsBindingOpenGLWin32KHR; +#endif // XR_USE_PLATFORM_WIN32 + +#ifdef XR_USE_PLATFORM_XLIB +// XrGraphicsBindingOpenGLXlibKHR extends XrSessionCreateInfo +typedef struct XrGraphicsBindingOpenGLXlibKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + Display* xDisplay; + uint32_t visualid; + GLXFBConfig glxFBConfig; + GLXDrawable glxDrawable; + GLXContext glxContext; +} XrGraphicsBindingOpenGLXlibKHR; +#endif // XR_USE_PLATFORM_XLIB + +#ifdef XR_USE_PLATFORM_XCB +// XrGraphicsBindingOpenGLXcbKHR extends XrSessionCreateInfo +typedef struct XrGraphicsBindingOpenGLXcbKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + xcb_connection_t* connection; + uint32_t screenNumber; + xcb_glx_fbconfig_t fbconfigid; + xcb_visualid_t visualid; + xcb_glx_drawable_t glxDrawable; + xcb_glx_context_t glxContext; +} XrGraphicsBindingOpenGLXcbKHR; +#endif // XR_USE_PLATFORM_XCB + +#ifdef XR_USE_PLATFORM_WAYLAND +// XrGraphicsBindingOpenGLWaylandKHR extends XrSessionCreateInfo +typedef struct XrGraphicsBindingOpenGLWaylandKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + struct wl_display* display; +} XrGraphicsBindingOpenGLWaylandKHR; +#endif // XR_USE_PLATFORM_WAYLAND + +typedef struct XrSwapchainImageOpenGLKHR { + XrStructureType type; + void* XR_MAY_ALIAS next; + uint32_t image; +} XrSwapchainImageOpenGLKHR; + +typedef struct XrGraphicsRequirementsOpenGLKHR { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrVersion minApiVersionSupported; + XrVersion maxApiVersionSupported; +} XrGraphicsRequirementsOpenGLKHR; + +typedef XrResult (XRAPI_PTR *PFN_xrGetOpenGLGraphicsRequirementsKHR)(XrInstance instance, XrSystemId systemId, XrGraphicsRequirementsOpenGLKHR* graphicsRequirements); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrGetOpenGLGraphicsRequirementsKHR( + XrInstance instance, + XrSystemId systemId, + XrGraphicsRequirementsOpenGLKHR* graphicsRequirements); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ +#endif /* XR_USE_GRAPHICS_API_OPENGL */ + +#ifdef XR_USE_GRAPHICS_API_OPENGL_ES + +#define XR_KHR_opengl_es_enable 1 +#define XR_KHR_opengl_es_enable_SPEC_VERSION 7 +#define XR_KHR_OPENGL_ES_ENABLE_EXTENSION_NAME "XR_KHR_opengl_es_enable" +#ifdef XR_USE_PLATFORM_ANDROID +// XrGraphicsBindingOpenGLESAndroidKHR extends XrSessionCreateInfo +typedef struct XrGraphicsBindingOpenGLESAndroidKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + EGLDisplay display; + EGLConfig config; + EGLContext context; +} XrGraphicsBindingOpenGLESAndroidKHR; +#endif // XR_USE_PLATFORM_ANDROID + +typedef struct XrSwapchainImageOpenGLESKHR { + XrStructureType type; + void* XR_MAY_ALIAS next; + uint32_t image; +} XrSwapchainImageOpenGLESKHR; + +typedef struct XrGraphicsRequirementsOpenGLESKHR { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrVersion minApiVersionSupported; + XrVersion maxApiVersionSupported; +} XrGraphicsRequirementsOpenGLESKHR; + +typedef XrResult (XRAPI_PTR *PFN_xrGetOpenGLESGraphicsRequirementsKHR)(XrInstance instance, XrSystemId systemId, XrGraphicsRequirementsOpenGLESKHR* graphicsRequirements); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrGetOpenGLESGraphicsRequirementsKHR( + XrInstance instance, + XrSystemId systemId, + XrGraphicsRequirementsOpenGLESKHR* graphicsRequirements); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ +#endif /* XR_USE_GRAPHICS_API_OPENGL_ES */ + +#ifdef XR_USE_GRAPHICS_API_VULKAN + +#define XR_KHR_vulkan_enable 1 +#define XR_KHR_vulkan_enable_SPEC_VERSION 8 +#define XR_KHR_VULKAN_ENABLE_EXTENSION_NAME "XR_KHR_vulkan_enable" +// XrGraphicsBindingVulkanKHR extends XrSessionCreateInfo +typedef struct XrGraphicsBindingVulkanKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + VkInstance instance; + VkPhysicalDevice physicalDevice; + VkDevice device; + uint32_t queueFamilyIndex; + uint32_t queueIndex; +} XrGraphicsBindingVulkanKHR; + +typedef struct XrSwapchainImageVulkanKHR { + XrStructureType type; + void* XR_MAY_ALIAS next; + VkImage image; +} XrSwapchainImageVulkanKHR; + +typedef struct XrGraphicsRequirementsVulkanKHR { + XrStructureType type; + void* XR_MAY_ALIAS next; + XrVersion minApiVersionSupported; + XrVersion maxApiVersionSupported; +} XrGraphicsRequirementsVulkanKHR; + +typedef XrResult (XRAPI_PTR *PFN_xrGetVulkanInstanceExtensionsKHR)(XrInstance instance, XrSystemId systemId, uint32_t bufferCapacityInput, uint32_t* bufferCountOutput, char* buffer); +typedef XrResult (XRAPI_PTR *PFN_xrGetVulkanDeviceExtensionsKHR)(XrInstance instance, XrSystemId systemId, uint32_t bufferCapacityInput, uint32_t* bufferCountOutput, char* buffer); +typedef XrResult (XRAPI_PTR *PFN_xrGetVulkanGraphicsDeviceKHR)(XrInstance instance, XrSystemId systemId, VkInstance vkInstance, VkPhysicalDevice* vkPhysicalDevice); +typedef XrResult (XRAPI_PTR *PFN_xrGetVulkanGraphicsRequirementsKHR)(XrInstance instance, XrSystemId systemId, XrGraphicsRequirementsVulkanKHR* graphicsRequirements); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrGetVulkanInstanceExtensionsKHR( + XrInstance instance, + XrSystemId systemId, + uint32_t bufferCapacityInput, + uint32_t* bufferCountOutput, + char* buffer); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetVulkanDeviceExtensionsKHR( + XrInstance instance, + XrSystemId systemId, + uint32_t bufferCapacityInput, + uint32_t* bufferCountOutput, + char* buffer); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetVulkanGraphicsDeviceKHR( + XrInstance instance, + XrSystemId systemId, + VkInstance vkInstance, + VkPhysicalDevice* vkPhysicalDevice); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetVulkanGraphicsRequirementsKHR( + XrInstance instance, + XrSystemId systemId, + XrGraphicsRequirementsVulkanKHR* graphicsRequirements); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ +#endif /* XR_USE_GRAPHICS_API_VULKAN */ + +#ifdef XR_USE_GRAPHICS_API_D3D11 + +#define XR_KHR_D3D11_enable 1 +#define XR_KHR_D3D11_enable_SPEC_VERSION 5 +#define XR_KHR_D3D11_ENABLE_EXTENSION_NAME "XR_KHR_D3D11_enable" +// XrGraphicsBindingD3D11KHR extends XrSessionCreateInfo +typedef struct XrGraphicsBindingD3D11KHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + ID3D11Device* device; +} XrGraphicsBindingD3D11KHR; + +typedef struct XrSwapchainImageD3D11KHR { + XrStructureType type; + void* XR_MAY_ALIAS next; + ID3D11Texture2D* texture; +} XrSwapchainImageD3D11KHR; + +typedef struct XrGraphicsRequirementsD3D11KHR { + XrStructureType type; + void* XR_MAY_ALIAS next; + LUID adapterLuid; + D3D_FEATURE_LEVEL minFeatureLevel; +} XrGraphicsRequirementsD3D11KHR; + +typedef XrResult (XRAPI_PTR *PFN_xrGetD3D11GraphicsRequirementsKHR)(XrInstance instance, XrSystemId systemId, XrGraphicsRequirementsD3D11KHR* graphicsRequirements); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrGetD3D11GraphicsRequirementsKHR( + XrInstance instance, + XrSystemId systemId, + XrGraphicsRequirementsD3D11KHR* graphicsRequirements); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ +#endif /* XR_USE_GRAPHICS_API_D3D11 */ + +#ifdef XR_USE_GRAPHICS_API_D3D12 + +#define XR_KHR_D3D12_enable 1 +#define XR_KHR_D3D12_enable_SPEC_VERSION 7 +#define XR_KHR_D3D12_ENABLE_EXTENSION_NAME "XR_KHR_D3D12_enable" +// XrGraphicsBindingD3D12KHR extends XrSessionCreateInfo +typedef struct XrGraphicsBindingD3D12KHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + ID3D12Device* device; + ID3D12CommandQueue* queue; +} XrGraphicsBindingD3D12KHR; + +typedef struct XrSwapchainImageD3D12KHR { + XrStructureType type; + void* XR_MAY_ALIAS next; + ID3D12Resource* texture; +} XrSwapchainImageD3D12KHR; + +typedef struct XrGraphicsRequirementsD3D12KHR { + XrStructureType type; + void* XR_MAY_ALIAS next; + LUID adapterLuid; + D3D_FEATURE_LEVEL minFeatureLevel; +} XrGraphicsRequirementsD3D12KHR; + +typedef XrResult (XRAPI_PTR *PFN_xrGetD3D12GraphicsRequirementsKHR)(XrInstance instance, XrSystemId systemId, XrGraphicsRequirementsD3D12KHR* graphicsRequirements); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrGetD3D12GraphicsRequirementsKHR( + XrInstance instance, + XrSystemId systemId, + XrGraphicsRequirementsD3D12KHR* graphicsRequirements); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ +#endif /* XR_USE_GRAPHICS_API_D3D12 */ + +#ifdef XR_USE_PLATFORM_WIN32 + +#define XR_KHR_win32_convert_performance_counter_time 1 +#define XR_KHR_win32_convert_performance_counter_time_SPEC_VERSION 1 +#define XR_KHR_WIN32_CONVERT_PERFORMANCE_COUNTER_TIME_EXTENSION_NAME "XR_KHR_win32_convert_performance_counter_time" +typedef XrResult (XRAPI_PTR *PFN_xrConvertWin32PerformanceCounterToTimeKHR)(XrInstance instance, const LARGE_INTEGER* performanceCounter, XrTime* time); +typedef XrResult (XRAPI_PTR *PFN_xrConvertTimeToWin32PerformanceCounterKHR)(XrInstance instance, XrTime time, LARGE_INTEGER* performanceCounter); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrConvertWin32PerformanceCounterToTimeKHR( + XrInstance instance, + const LARGE_INTEGER* performanceCounter, + XrTime* time); + +XRAPI_ATTR XrResult XRAPI_CALL xrConvertTimeToWin32PerformanceCounterKHR( + XrInstance instance, + XrTime time, + LARGE_INTEGER* performanceCounter); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ +#endif /* XR_USE_PLATFORM_WIN32 */ + +#ifdef XR_USE_TIMESPEC + +#define XR_KHR_convert_timespec_time 1 +#define XR_KHR_convert_timespec_time_SPEC_VERSION 1 +#define XR_KHR_CONVERT_TIMESPEC_TIME_EXTENSION_NAME "XR_KHR_convert_timespec_time" +typedef XrResult (XRAPI_PTR *PFN_xrConvertTimespecTimeToTimeKHR)(XrInstance instance, const struct timespec* timespecTime, XrTime* time); +typedef XrResult (XRAPI_PTR *PFN_xrConvertTimeToTimespecTimeKHR)(XrInstance instance, XrTime time, struct timespec* timespecTime); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrConvertTimespecTimeToTimeKHR( + XrInstance instance, + const struct timespec* timespecTime, + XrTime* time); + +XRAPI_ATTR XrResult XRAPI_CALL xrConvertTimeToTimespecTimeKHR( + XrInstance instance, + XrTime time, + struct timespec* timespecTime); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ +#endif /* XR_USE_TIMESPEC */ + +#ifdef XR_USE_PLATFORM_ANDROID + +#define XR_KHR_loader_init_android 1 +#define XR_KHR_loader_init_android_SPEC_VERSION 1 +#define XR_KHR_LOADER_INIT_ANDROID_EXTENSION_NAME "XR_KHR_loader_init_android" +typedef struct XrLoaderInitInfoAndroidKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + void* XR_MAY_ALIAS applicationVM; + void* XR_MAY_ALIAS applicationContext; +} XrLoaderInitInfoAndroidKHR; + +#endif /* XR_USE_PLATFORM_ANDROID */ + +#ifdef XR_USE_GRAPHICS_API_VULKAN + +#define XR_KHR_vulkan_enable2 1 +#define XR_KHR_vulkan_enable2_SPEC_VERSION 2 +#define XR_KHR_VULKAN_ENABLE2_EXTENSION_NAME "XR_KHR_vulkan_enable2" +typedef XrFlags64 XrVulkanInstanceCreateFlagsKHR; + +// Flag bits for XrVulkanInstanceCreateFlagsKHR + +typedef XrFlags64 XrVulkanDeviceCreateFlagsKHR; + +// Flag bits for XrVulkanDeviceCreateFlagsKHR + +typedef struct XrVulkanInstanceCreateInfoKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrSystemId systemId; + XrVulkanInstanceCreateFlagsKHR createFlags; + PFN_vkGetInstanceProcAddr pfnGetInstanceProcAddr; + const VkInstanceCreateInfo* vulkanCreateInfo; + const VkAllocationCallbacks* vulkanAllocator; +} XrVulkanInstanceCreateInfoKHR; + +typedef struct XrVulkanDeviceCreateInfoKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrSystemId systemId; + XrVulkanDeviceCreateFlagsKHR createFlags; + PFN_vkGetInstanceProcAddr pfnGetInstanceProcAddr; + VkPhysicalDevice vulkanPhysicalDevice; + const VkDeviceCreateInfo* vulkanCreateInfo; + const VkAllocationCallbacks* vulkanAllocator; +} XrVulkanDeviceCreateInfoKHR; + +typedef XrGraphicsBindingVulkanKHR XrGraphicsBindingVulkan2KHR; + +typedef struct XrVulkanGraphicsDeviceGetInfoKHR { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrSystemId systemId; + VkInstance vulkanInstance; +} XrVulkanGraphicsDeviceGetInfoKHR; + +typedef XrSwapchainImageVulkanKHR XrSwapchainImageVulkan2KHR; + +typedef XrGraphicsRequirementsVulkanKHR XrGraphicsRequirementsVulkan2KHR; + +typedef XrResult (XRAPI_PTR *PFN_xrCreateVulkanInstanceKHR)(XrInstance instance, const XrVulkanInstanceCreateInfoKHR*createInfo, VkInstance* vulkanInstance, VkResult* vulkanResult); +typedef XrResult (XRAPI_PTR *PFN_xrCreateVulkanDeviceKHR)(XrInstance instance, const XrVulkanDeviceCreateInfoKHR* createInfo, VkDevice* vulkanDevice, VkResult* vulkanResult); +typedef XrResult (XRAPI_PTR *PFN_xrGetVulkanGraphicsDevice2KHR)(XrInstance instance, const XrVulkanGraphicsDeviceGetInfoKHR* getInfo, VkPhysicalDevice* vulkanPhysicalDevice); +typedef XrResult (XRAPI_PTR *PFN_xrGetVulkanGraphicsRequirements2KHR)(XrInstance instance, XrSystemId systemId, XrGraphicsRequirementsVulkanKHR* graphicsRequirements); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrCreateVulkanInstanceKHR( + XrInstance instance, + const XrVulkanInstanceCreateInfoKHR* createInfo, + VkInstance* vulkanInstance, + VkResult* vulkanResult); + +XRAPI_ATTR XrResult XRAPI_CALL xrCreateVulkanDeviceKHR( + XrInstance instance, + const XrVulkanDeviceCreateInfoKHR* createInfo, + VkDevice* vulkanDevice, + VkResult* vulkanResult); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetVulkanGraphicsDevice2KHR( + XrInstance instance, + const XrVulkanGraphicsDeviceGetInfoKHR* getInfo, + VkPhysicalDevice* vulkanPhysicalDevice); + +XRAPI_ATTR XrResult XRAPI_CALL xrGetVulkanGraphicsRequirements2KHR( + XrInstance instance, + XrSystemId systemId, + XrGraphicsRequirementsVulkanKHR* graphicsRequirements); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ +#endif /* XR_USE_GRAPHICS_API_VULKAN */ + +#ifdef XR_USE_PLATFORM_EGL + +#define XR_MNDX_egl_enable 1 +#define XR_MNDX_egl_enable_SPEC_VERSION 1 +#define XR_MNDX_EGL_ENABLE_EXTENSION_NAME "XR_MNDX_egl_enable" +// XrGraphicsBindingEGLMNDX extends XrSessionCreateInfo +typedef struct XrGraphicsBindingEGLMNDX { + XrStructureType type; + const void* XR_MAY_ALIAS next; + PFNEGLGETPROCADDRESSPROC getProcAddress; + EGLDisplay display; + EGLConfig config; + EGLContext context; +} XrGraphicsBindingEGLMNDX; + +#endif /* XR_USE_PLATFORM_EGL */ + +#ifdef XR_USE_PLATFORM_WIN32 + +#define XR_MSFT_perception_anchor_interop 1 +#define XR_MSFT_perception_anchor_interop_SPEC_VERSION 1 +#define XR_MSFT_PERCEPTION_ANCHOR_INTEROP_EXTENSION_NAME "XR_MSFT_perception_anchor_interop" +typedef XrResult (XRAPI_PTR *PFN_xrCreateSpatialAnchorFromPerceptionAnchorMSFT)(XrSession session, IUnknown* perceptionAnchor, XrSpatialAnchorMSFT* anchor); +typedef XrResult (XRAPI_PTR *PFN_xrTryGetPerceptionAnchorFromSpatialAnchorMSFT)(XrSession session, XrSpatialAnchorMSFT anchor, IUnknown** perceptionAnchor); + +#ifndef XR_NO_PROTOTYPES +#ifdef XR_EXTENSION_PROTOTYPES +XRAPI_ATTR XrResult XRAPI_CALL xrCreateSpatialAnchorFromPerceptionAnchorMSFT( + XrSession session, + IUnknown* perceptionAnchor, + XrSpatialAnchorMSFT* anchor); + +XRAPI_ATTR XrResult XRAPI_CALL xrTryGetPerceptionAnchorFromSpatialAnchorMSFT( + XrSession session, + XrSpatialAnchorMSFT anchor, + IUnknown** perceptionAnchor); +#endif /* XR_EXTENSION_PROTOTYPES */ +#endif /* !XR_NO_PROTOTYPES */ +#endif /* XR_USE_PLATFORM_WIN32 */ + +#ifdef XR_USE_PLATFORM_WIN32 + +#define XR_MSFT_holographic_window_attachment 1 +#define XR_MSFT_holographic_window_attachment_SPEC_VERSION 1 +#define XR_MSFT_HOLOGRAPHIC_WINDOW_ATTACHMENT_EXTENSION_NAME "XR_MSFT_holographic_window_attachment" +#ifdef XR_USE_PLATFORM_WIN32 +// XrHolographicWindowAttachmentMSFT extends XrSessionCreateInfo +typedef struct XrHolographicWindowAttachmentMSFT { + XrStructureType type; + const void* XR_MAY_ALIAS next; + IUnknown* holographicSpace; + IUnknown* coreWindow; +} XrHolographicWindowAttachmentMSFT; +#endif // XR_USE_PLATFORM_WIN32 + +#endif /* XR_USE_PLATFORM_WIN32 */ + +#ifdef XR_USE_PLATFORM_ANDROID + +#define XR_FB_android_surface_swapchain_create 1 +#define XR_FB_android_surface_swapchain_create_SPEC_VERSION 1 +#define XR_FB_ANDROID_SURFACE_SWAPCHAIN_CREATE_EXTENSION_NAME "XR_FB_android_surface_swapchain_create" +typedef XrFlags64 XrAndroidSurfaceSwapchainFlagsFB; + +// Flag bits for XrAndroidSurfaceSwapchainFlagsFB +static const XrAndroidSurfaceSwapchainFlagsFB XR_ANDROID_SURFACE_SWAPCHAIN_SYNCHRONOUS_BIT_FB = 0x00000001; +static const XrAndroidSurfaceSwapchainFlagsFB XR_ANDROID_SURFACE_SWAPCHAIN_USE_TIMESTAMPS_BIT_FB = 0x00000002; + +#ifdef XR_USE_PLATFORM_ANDROID +// XrAndroidSurfaceSwapchainCreateInfoFB extends XrSwapchainCreateInfo +typedef struct XrAndroidSurfaceSwapchainCreateInfoFB { + XrStructureType type; + const void* XR_MAY_ALIAS next; + XrAndroidSurfaceSwapchainFlagsFB createFlags; +} XrAndroidSurfaceSwapchainCreateInfoFB; +#endif // XR_USE_PLATFORM_ANDROID + +#endif /* XR_USE_PLATFORM_ANDROID */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Externals/OpenXR/include/openxr/openxr_platform_defines.h b/Externals/OpenXR/include/openxr/openxr_platform_defines.h new file mode 100644 index 000000000000..9781ba0b4876 --- /dev/null +++ b/Externals/OpenXR/include/openxr/openxr_platform_defines.h @@ -0,0 +1,110 @@ +/* +** Copyright (c) 2017-2021, The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 OR MIT +*/ + +#ifndef OPENXR_PLATFORM_DEFINES_H_ +#define OPENXR_PLATFORM_DEFINES_H_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* Platform-specific calling convention macros. + * + * Platforms should define these so that OpenXR clients call OpenXR functions + * with the same calling conventions that the OpenXR implementation expects. + * + * XRAPI_ATTR - Placed before the return type in function declarations. + * Useful for C++11 and GCC/Clang-style function attribute syntax. + * XRAPI_CALL - Placed after the return type in function declarations. + * Useful for MSVC-style calling convention syntax. + * XRAPI_PTR - Placed between the '(' and '*' in function pointer types. + * + * Function declaration: XRAPI_ATTR void XRAPI_CALL xrFunction(void); + * Function pointer type: typedef void (XRAPI_PTR *PFN_xrFunction)(void); + */ +#if defined(_WIN32) +#define XRAPI_ATTR +// On Windows, functions use the stdcall convention +#define XRAPI_CALL __stdcall +#define XRAPI_PTR XRAPI_CALL +#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 +#error "API not supported for the 'armeabi' NDK ABI" +#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) +// On Android 32-bit ARM targets, functions use the "hardfloat" +// calling convention, i.e. float parameters are passed in registers. This +// is true even if the rest of the application passes floats on the stack, +// as it does by default when compiling for the armeabi-v7a NDK ABI. +#define XRAPI_ATTR __attribute__((pcs("aapcs-vfp"))) +#define XRAPI_CALL +#define XRAPI_PTR XRAPI_ATTR +#else +// On other platforms, use the default calling convention +#define XRAPI_ATTR +#define XRAPI_CALL +#define XRAPI_PTR +#endif + +#include + +#if !defined(XR_NO_STDINT_H) +#if defined(_MSC_VER) && (_MSC_VER < 1600) +typedef signed __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef signed __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef signed __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +#include +#endif +#endif // !defined( XR_NO_STDINT_H ) + +// XR_PTR_SIZE (in bytes) +#if (defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)) +#define XR_PTR_SIZE 8 +#else +#define XR_PTR_SIZE 4 +#endif + +// Needed so we can use clang __has_feature portably. +#if !defined(XR_COMPILER_HAS_FEATURE) +#if defined(__clang__) +#define XR_COMPILER_HAS_FEATURE(x) __has_feature(x) +#else +#define XR_COMPILER_HAS_FEATURE(x) 0 +#endif +#endif + +// Identifies if the current compiler has C++11 support enabled. +// Does not by itself identify if any given C++11 feature is present. +#if !defined(XR_CPP11_ENABLED) && defined(__cplusplus) +#if defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__) +#define XR_CPP11_ENABLED 1 +#elif defined(_MSC_VER) && (_MSC_VER >= 1600) +#define XR_CPP11_ENABLED 1 +#elif (__cplusplus >= 201103L) // 201103 is the first C++11 version. +#define XR_CPP11_ENABLED 1 +#endif +#endif + +// Identifies if the current compiler supports C++11 nullptr. +#if !defined(XR_CPP_NULLPTR_SUPPORTED) +#if defined(XR_CPP11_ENABLED) && \ + ((defined(__clang__) && XR_COMPILER_HAS_FEATURE(cxx_nullptr)) || \ + (defined(__GNUC__) && (((__GNUC__ * 1000) + __GNUC_MINOR__) >= 4006)) || \ + (defined(_MSC_VER) && (_MSC_VER >= 1600)) || \ + (defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 403))) +#define XR_CPP_NULLPTR_SUPPORTED 1 +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Externals/OpenXR/include/openxr/openxr_reflection.h b/Externals/OpenXR/include/openxr/openxr_reflection.h new file mode 100644 index 000000000000..9c6212928114 --- /dev/null +++ b/Externals/OpenXR/include/openxr/openxr_reflection.h @@ -0,0 +1,1775 @@ +#ifndef OPENXR_REFLECTION_H_ +#define OPENXR_REFLECTION_H_ 1 + +/* +** Copyright (c) 2017-2021, The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 OR MIT +*/ + +/* +** This header is generated from the Khronos OpenXR XML API Registry. +** +*/ + +#include "openxr.h" + +/* +This file contains expansion macros (X Macros) for OpenXR enumerations and structures. +Example of how to use expansion macros to make an enum-to-string function: + +#define XR_ENUM_CASE_STR(name, val) case name: return #name; +#define XR_ENUM_STR(enumType) \ + constexpr const char* XrEnumStr(enumType e) { \ + switch (e) { \ + XR_LIST_ENUM_##enumType(XR_ENUM_CASE_STR) \ + default: return "Unknown"; \ + } \ + } \ + +XR_ENUM_STR(XrResult); +*/ + +#define XR_LIST_ENUM_XrResult(_) \ + _(XR_SUCCESS, 0) \ + _(XR_TIMEOUT_EXPIRED, 1) \ + _(XR_SESSION_LOSS_PENDING, 3) \ + _(XR_EVENT_UNAVAILABLE, 4) \ + _(XR_SPACE_BOUNDS_UNAVAILABLE, 7) \ + _(XR_SESSION_NOT_FOCUSED, 8) \ + _(XR_FRAME_DISCARDED, 9) \ + _(XR_ERROR_VALIDATION_FAILURE, -1) \ + _(XR_ERROR_RUNTIME_FAILURE, -2) \ + _(XR_ERROR_OUT_OF_MEMORY, -3) \ + _(XR_ERROR_API_VERSION_UNSUPPORTED, -4) \ + _(XR_ERROR_INITIALIZATION_FAILED, -6) \ + _(XR_ERROR_FUNCTION_UNSUPPORTED, -7) \ + _(XR_ERROR_FEATURE_UNSUPPORTED, -8) \ + _(XR_ERROR_EXTENSION_NOT_PRESENT, -9) \ + _(XR_ERROR_LIMIT_REACHED, -10) \ + _(XR_ERROR_SIZE_INSUFFICIENT, -11) \ + _(XR_ERROR_HANDLE_INVALID, -12) \ + _(XR_ERROR_INSTANCE_LOST, -13) \ + _(XR_ERROR_SESSION_RUNNING, -14) \ + _(XR_ERROR_SESSION_NOT_RUNNING, -16) \ + _(XR_ERROR_SESSION_LOST, -17) \ + _(XR_ERROR_SYSTEM_INVALID, -18) \ + _(XR_ERROR_PATH_INVALID, -19) \ + _(XR_ERROR_PATH_COUNT_EXCEEDED, -20) \ + _(XR_ERROR_PATH_FORMAT_INVALID, -21) \ + _(XR_ERROR_PATH_UNSUPPORTED, -22) \ + _(XR_ERROR_LAYER_INVALID, -23) \ + _(XR_ERROR_LAYER_LIMIT_EXCEEDED, -24) \ + _(XR_ERROR_SWAPCHAIN_RECT_INVALID, -25) \ + _(XR_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED, -26) \ + _(XR_ERROR_ACTION_TYPE_MISMATCH, -27) \ + _(XR_ERROR_SESSION_NOT_READY, -28) \ + _(XR_ERROR_SESSION_NOT_STOPPING, -29) \ + _(XR_ERROR_TIME_INVALID, -30) \ + _(XR_ERROR_REFERENCE_SPACE_UNSUPPORTED, -31) \ + _(XR_ERROR_FILE_ACCESS_ERROR, -32) \ + _(XR_ERROR_FILE_CONTENTS_INVALID, -33) \ + _(XR_ERROR_FORM_FACTOR_UNSUPPORTED, -34) \ + _(XR_ERROR_FORM_FACTOR_UNAVAILABLE, -35) \ + _(XR_ERROR_API_LAYER_NOT_PRESENT, -36) \ + _(XR_ERROR_CALL_ORDER_INVALID, -37) \ + _(XR_ERROR_GRAPHICS_DEVICE_INVALID, -38) \ + _(XR_ERROR_POSE_INVALID, -39) \ + _(XR_ERROR_INDEX_OUT_OF_RANGE, -40) \ + _(XR_ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED, -41) \ + _(XR_ERROR_ENVIRONMENT_BLEND_MODE_UNSUPPORTED, -42) \ + _(XR_ERROR_NAME_DUPLICATED, -44) \ + _(XR_ERROR_NAME_INVALID, -45) \ + _(XR_ERROR_ACTIONSET_NOT_ATTACHED, -46) \ + _(XR_ERROR_ACTIONSETS_ALREADY_ATTACHED, -47) \ + _(XR_ERROR_LOCALIZED_NAME_DUPLICATED, -48) \ + _(XR_ERROR_LOCALIZED_NAME_INVALID, -49) \ + _(XR_ERROR_GRAPHICS_REQUIREMENTS_CALL_MISSING, -50) \ + _(XR_ERROR_ANDROID_THREAD_SETTINGS_ID_INVALID_KHR, -1000003000) \ + _(XR_ERROR_ANDROID_THREAD_SETTINGS_FAILURE_KHR, -1000003001) \ + _(XR_ERROR_CREATE_SPATIAL_ANCHOR_FAILED_MSFT, -1000039001) \ + _(XR_ERROR_SECONDARY_VIEW_CONFIGURATION_TYPE_NOT_ENABLED_MSFT, -1000053000) \ + _(XR_ERROR_CONTROLLER_MODEL_KEY_INVALID_MSFT, -1000055000) \ + _(XR_ERROR_DISPLAY_REFRESH_RATE_UNSUPPORTED_FB, -1000101000) \ + _(XR_ERROR_COLOR_SPACE_UNSUPPORTED_FB, -1000108000) \ + _(XR_RESULT_MAX_ENUM, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrStructureType(_) \ + _(XR_TYPE_UNKNOWN, 0) \ + _(XR_TYPE_API_LAYER_PROPERTIES, 1) \ + _(XR_TYPE_EXTENSION_PROPERTIES, 2) \ + _(XR_TYPE_INSTANCE_CREATE_INFO, 3) \ + _(XR_TYPE_SYSTEM_GET_INFO, 4) \ + _(XR_TYPE_SYSTEM_PROPERTIES, 5) \ + _(XR_TYPE_VIEW_LOCATE_INFO, 6) \ + _(XR_TYPE_VIEW, 7) \ + _(XR_TYPE_SESSION_CREATE_INFO, 8) \ + _(XR_TYPE_SWAPCHAIN_CREATE_INFO, 9) \ + _(XR_TYPE_SESSION_BEGIN_INFO, 10) \ + _(XR_TYPE_VIEW_STATE, 11) \ + _(XR_TYPE_FRAME_END_INFO, 12) \ + _(XR_TYPE_HAPTIC_VIBRATION, 13) \ + _(XR_TYPE_EVENT_DATA_BUFFER, 16) \ + _(XR_TYPE_EVENT_DATA_INSTANCE_LOSS_PENDING, 17) \ + _(XR_TYPE_EVENT_DATA_SESSION_STATE_CHANGED, 18) \ + _(XR_TYPE_ACTION_STATE_BOOLEAN, 23) \ + _(XR_TYPE_ACTION_STATE_FLOAT, 24) \ + _(XR_TYPE_ACTION_STATE_VECTOR2F, 25) \ + _(XR_TYPE_ACTION_STATE_POSE, 27) \ + _(XR_TYPE_ACTION_SET_CREATE_INFO, 28) \ + _(XR_TYPE_ACTION_CREATE_INFO, 29) \ + _(XR_TYPE_INSTANCE_PROPERTIES, 32) \ + _(XR_TYPE_FRAME_WAIT_INFO, 33) \ + _(XR_TYPE_COMPOSITION_LAYER_PROJECTION, 35) \ + _(XR_TYPE_COMPOSITION_LAYER_QUAD, 36) \ + _(XR_TYPE_REFERENCE_SPACE_CREATE_INFO, 37) \ + _(XR_TYPE_ACTION_SPACE_CREATE_INFO, 38) \ + _(XR_TYPE_EVENT_DATA_REFERENCE_SPACE_CHANGE_PENDING, 40) \ + _(XR_TYPE_VIEW_CONFIGURATION_VIEW, 41) \ + _(XR_TYPE_SPACE_LOCATION, 42) \ + _(XR_TYPE_SPACE_VELOCITY, 43) \ + _(XR_TYPE_FRAME_STATE, 44) \ + _(XR_TYPE_VIEW_CONFIGURATION_PROPERTIES, 45) \ + _(XR_TYPE_FRAME_BEGIN_INFO, 46) \ + _(XR_TYPE_COMPOSITION_LAYER_PROJECTION_VIEW, 48) \ + _(XR_TYPE_EVENT_DATA_EVENTS_LOST, 49) \ + _(XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING, 51) \ + _(XR_TYPE_EVENT_DATA_INTERACTION_PROFILE_CHANGED, 52) \ + _(XR_TYPE_INTERACTION_PROFILE_STATE, 53) \ + _(XR_TYPE_SWAPCHAIN_IMAGE_ACQUIRE_INFO, 55) \ + _(XR_TYPE_SWAPCHAIN_IMAGE_WAIT_INFO, 56) \ + _(XR_TYPE_SWAPCHAIN_IMAGE_RELEASE_INFO, 57) \ + _(XR_TYPE_ACTION_STATE_GET_INFO, 58) \ + _(XR_TYPE_HAPTIC_ACTION_INFO, 59) \ + _(XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO, 60) \ + _(XR_TYPE_ACTIONS_SYNC_INFO, 61) \ + _(XR_TYPE_BOUND_SOURCES_FOR_ACTION_ENUMERATE_INFO, 62) \ + _(XR_TYPE_INPUT_SOURCE_LOCALIZED_NAME_GET_INFO, 63) \ + _(XR_TYPE_COMPOSITION_LAYER_CUBE_KHR, 1000006000) \ + _(XR_TYPE_INSTANCE_CREATE_INFO_ANDROID_KHR, 1000008000) \ + _(XR_TYPE_COMPOSITION_LAYER_DEPTH_INFO_KHR, 1000010000) \ + _(XR_TYPE_VULKAN_SWAPCHAIN_FORMAT_LIST_CREATE_INFO_KHR, 1000014000) \ + _(XR_TYPE_EVENT_DATA_PERF_SETTINGS_EXT, 1000015000) \ + _(XR_TYPE_COMPOSITION_LAYER_CYLINDER_KHR, 1000017000) \ + _(XR_TYPE_COMPOSITION_LAYER_EQUIRECT_KHR, 1000018000) \ + _(XR_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT, 1000019000) \ + _(XR_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT, 1000019001) \ + _(XR_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT, 1000019002) \ + _(XR_TYPE_DEBUG_UTILS_LABEL_EXT, 1000019003) \ + _(XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR, 1000023000) \ + _(XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR, 1000023001) \ + _(XR_TYPE_GRAPHICS_BINDING_OPENGL_XCB_KHR, 1000023002) \ + _(XR_TYPE_GRAPHICS_BINDING_OPENGL_WAYLAND_KHR, 1000023003) \ + _(XR_TYPE_SWAPCHAIN_IMAGE_OPENGL_KHR, 1000023004) \ + _(XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_KHR, 1000023005) \ + _(XR_TYPE_GRAPHICS_BINDING_OPENGL_ES_ANDROID_KHR, 1000024001) \ + _(XR_TYPE_SWAPCHAIN_IMAGE_OPENGL_ES_KHR, 1000024002) \ + _(XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_ES_KHR, 1000024003) \ + _(XR_TYPE_GRAPHICS_BINDING_VULKAN_KHR, 1000025000) \ + _(XR_TYPE_SWAPCHAIN_IMAGE_VULKAN_KHR, 1000025001) \ + _(XR_TYPE_GRAPHICS_REQUIREMENTS_VULKAN_KHR, 1000025002) \ + _(XR_TYPE_GRAPHICS_BINDING_D3D11_KHR, 1000027000) \ + _(XR_TYPE_SWAPCHAIN_IMAGE_D3D11_KHR, 1000027001) \ + _(XR_TYPE_GRAPHICS_REQUIREMENTS_D3D11_KHR, 1000027002) \ + _(XR_TYPE_GRAPHICS_BINDING_D3D12_KHR, 1000028000) \ + _(XR_TYPE_SWAPCHAIN_IMAGE_D3D12_KHR, 1000028001) \ + _(XR_TYPE_GRAPHICS_REQUIREMENTS_D3D12_KHR, 1000028002) \ + _(XR_TYPE_SYSTEM_EYE_GAZE_INTERACTION_PROPERTIES_EXT, 1000030000) \ + _(XR_TYPE_EYE_GAZE_SAMPLE_TIME_EXT, 1000030001) \ + _(XR_TYPE_VISIBILITY_MASK_KHR, 1000031000) \ + _(XR_TYPE_EVENT_DATA_VISIBILITY_MASK_CHANGED_KHR, 1000031001) \ + _(XR_TYPE_SESSION_CREATE_INFO_OVERLAY_EXTX, 1000033000) \ + _(XR_TYPE_EVENT_DATA_MAIN_SESSION_VISIBILITY_CHANGED_EXTX, 1000033003) \ + _(XR_TYPE_COMPOSITION_LAYER_COLOR_SCALE_BIAS_KHR, 1000034000) \ + _(XR_TYPE_SPATIAL_ANCHOR_CREATE_INFO_MSFT, 1000039000) \ + _(XR_TYPE_SPATIAL_ANCHOR_SPACE_CREATE_INFO_MSFT, 1000039001) \ + _(XR_TYPE_VIEW_CONFIGURATION_DEPTH_RANGE_EXT, 1000046000) \ + _(XR_TYPE_GRAPHICS_BINDING_EGL_MNDX, 1000048004) \ + _(XR_TYPE_SPATIAL_GRAPH_NODE_SPACE_CREATE_INFO_MSFT, 1000049000) \ + _(XR_TYPE_SYSTEM_HAND_TRACKING_PROPERTIES_EXT, 1000051000) \ + _(XR_TYPE_HAND_TRACKER_CREATE_INFO_EXT, 1000051001) \ + _(XR_TYPE_HAND_JOINTS_LOCATE_INFO_EXT, 1000051002) \ + _(XR_TYPE_HAND_JOINT_LOCATIONS_EXT, 1000051003) \ + _(XR_TYPE_HAND_JOINT_VELOCITIES_EXT, 1000051004) \ + _(XR_TYPE_SYSTEM_HAND_TRACKING_MESH_PROPERTIES_MSFT, 1000052000) \ + _(XR_TYPE_HAND_MESH_SPACE_CREATE_INFO_MSFT, 1000052001) \ + _(XR_TYPE_HAND_MESH_UPDATE_INFO_MSFT, 1000052002) \ + _(XR_TYPE_HAND_MESH_MSFT, 1000052003) \ + _(XR_TYPE_HAND_POSE_TYPE_INFO_MSFT, 1000052004) \ + _(XR_TYPE_SECONDARY_VIEW_CONFIGURATION_SESSION_BEGIN_INFO_MSFT, 1000053000) \ + _(XR_TYPE_SECONDARY_VIEW_CONFIGURATION_STATE_MSFT, 1000053001) \ + _(XR_TYPE_SECONDARY_VIEW_CONFIGURATION_FRAME_STATE_MSFT, 1000053002) \ + _(XR_TYPE_SECONDARY_VIEW_CONFIGURATION_FRAME_END_INFO_MSFT, 1000053003) \ + _(XR_TYPE_SECONDARY_VIEW_CONFIGURATION_LAYER_INFO_MSFT, 1000053004) \ + _(XR_TYPE_SECONDARY_VIEW_CONFIGURATION_SWAPCHAIN_CREATE_INFO_MSFT, 1000053005) \ + _(XR_TYPE_CONTROLLER_MODEL_KEY_STATE_MSFT, 1000055000) \ + _(XR_TYPE_CONTROLLER_MODEL_NODE_PROPERTIES_MSFT, 1000055001) \ + _(XR_TYPE_CONTROLLER_MODEL_PROPERTIES_MSFT, 1000055002) \ + _(XR_TYPE_CONTROLLER_MODEL_NODE_STATE_MSFT, 1000055003) \ + _(XR_TYPE_CONTROLLER_MODEL_STATE_MSFT, 1000055004) \ + _(XR_TYPE_VIEW_CONFIGURATION_VIEW_FOV_EPIC, 1000059000) \ + _(XR_TYPE_HOLOGRAPHIC_WINDOW_ATTACHMENT_MSFT, 1000063000) \ + _(XR_TYPE_ANDROID_SURFACE_SWAPCHAIN_CREATE_INFO_FB, 1000070000) \ + _(XR_TYPE_INTERACTION_PROFILE_ANALOG_THRESHOLD_VALVE, 1000079000) \ + _(XR_TYPE_LOADER_INIT_INFO_ANDROID_KHR, 1000089000) \ + _(XR_TYPE_VULKAN_INSTANCE_CREATE_INFO_KHR, 1000090000) \ + _(XR_TYPE_VULKAN_DEVICE_CREATE_INFO_KHR, 1000090001) \ + _(XR_TYPE_VULKAN_GRAPHICS_DEVICE_GET_INFO_KHR, 1000090003) \ + _(XR_TYPE_COMPOSITION_LAYER_EQUIRECT2_KHR, 1000091000) \ + _(XR_TYPE_EVENT_DATA_DISPLAY_REFRESH_RATE_CHANGED_FB, 1000101000) \ + _(XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB, 1000108000) \ + _(XR_TYPE_BINDING_MODIFICATIONS_KHR, 1000120000) \ + _(XR_TYPE_VIEW_LOCATE_FOVEATED_RENDERING_VARJO, 1000121000) \ + _(XR_TYPE_FOVEATED_VIEW_CONFIGURATION_VIEW_VARJO, 1000121001) \ + _(XR_TYPE_SYSTEM_FOVEATED_RENDERING_PROPERTIES_VARJO, 1000121002) \ + _(XR_TYPE_COMPOSITION_LAYER_DEPTH_TEST_VARJO, 1000122000) \ + _(XR_STRUCTURE_TYPE_MAX_ENUM, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrFormFactor(_) \ + _(XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY, 1) \ + _(XR_FORM_FACTOR_HANDHELD_DISPLAY, 2) \ + _(XR_FORM_FACTOR_MAX_ENUM, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrViewConfigurationType(_) \ + _(XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO, 1) \ + _(XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO, 2) \ + _(XR_VIEW_CONFIGURATION_TYPE_PRIMARY_QUAD_VARJO, 1000037000) \ + _(XR_VIEW_CONFIGURATION_TYPE_SECONDARY_MONO_FIRST_PERSON_OBSERVER_MSFT, 1000054000) \ + _(XR_VIEW_CONFIGURATION_TYPE_MAX_ENUM, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrEnvironmentBlendMode(_) \ + _(XR_ENVIRONMENT_BLEND_MODE_OPAQUE, 1) \ + _(XR_ENVIRONMENT_BLEND_MODE_ADDITIVE, 2) \ + _(XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND, 3) \ + _(XR_ENVIRONMENT_BLEND_MODE_MAX_ENUM, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrReferenceSpaceType(_) \ + _(XR_REFERENCE_SPACE_TYPE_VIEW, 1) \ + _(XR_REFERENCE_SPACE_TYPE_LOCAL, 2) \ + _(XR_REFERENCE_SPACE_TYPE_STAGE, 3) \ + _(XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT, 1000038000) \ + _(XR_REFERENCE_SPACE_TYPE_COMBINED_EYE_VARJO, 1000121000) \ + _(XR_REFERENCE_SPACE_TYPE_MAX_ENUM, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrActionType(_) \ + _(XR_ACTION_TYPE_BOOLEAN_INPUT, 1) \ + _(XR_ACTION_TYPE_FLOAT_INPUT, 2) \ + _(XR_ACTION_TYPE_VECTOR2F_INPUT, 3) \ + _(XR_ACTION_TYPE_POSE_INPUT, 4) \ + _(XR_ACTION_TYPE_VIBRATION_OUTPUT, 100) \ + _(XR_ACTION_TYPE_MAX_ENUM, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrEyeVisibility(_) \ + _(XR_EYE_VISIBILITY_BOTH, 0) \ + _(XR_EYE_VISIBILITY_LEFT, 1) \ + _(XR_EYE_VISIBILITY_RIGHT, 2) \ + _(XR_EYE_VISIBILITY_MAX_ENUM, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrSessionState(_) \ + _(XR_SESSION_STATE_UNKNOWN, 0) \ + _(XR_SESSION_STATE_IDLE, 1) \ + _(XR_SESSION_STATE_READY, 2) \ + _(XR_SESSION_STATE_SYNCHRONIZED, 3) \ + _(XR_SESSION_STATE_VISIBLE, 4) \ + _(XR_SESSION_STATE_FOCUSED, 5) \ + _(XR_SESSION_STATE_STOPPING, 6) \ + _(XR_SESSION_STATE_LOSS_PENDING, 7) \ + _(XR_SESSION_STATE_EXITING, 8) \ + _(XR_SESSION_STATE_MAX_ENUM, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrObjectType(_) \ + _(XR_OBJECT_TYPE_UNKNOWN, 0) \ + _(XR_OBJECT_TYPE_INSTANCE, 1) \ + _(XR_OBJECT_TYPE_SESSION, 2) \ + _(XR_OBJECT_TYPE_SWAPCHAIN, 3) \ + _(XR_OBJECT_TYPE_SPACE, 4) \ + _(XR_OBJECT_TYPE_ACTION_SET, 5) \ + _(XR_OBJECT_TYPE_ACTION, 6) \ + _(XR_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT, 1000019000) \ + _(XR_OBJECT_TYPE_SPATIAL_ANCHOR_MSFT, 1000039000) \ + _(XR_OBJECT_TYPE_HAND_TRACKER_EXT, 1000051000) \ + _(XR_OBJECT_TYPE_MAX_ENUM, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrAndroidThreadTypeKHR(_) \ + _(XR_ANDROID_THREAD_TYPE_APPLICATION_MAIN_KHR, 1) \ + _(XR_ANDROID_THREAD_TYPE_APPLICATION_WORKER_KHR, 2) \ + _(XR_ANDROID_THREAD_TYPE_RENDERER_MAIN_KHR, 3) \ + _(XR_ANDROID_THREAD_TYPE_RENDERER_WORKER_KHR, 4) \ + _(XR_ANDROID_THREAD_TYPE_MAX_ENUM_KHR, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrVisibilityMaskTypeKHR(_) \ + _(XR_VISIBILITY_MASK_TYPE_HIDDEN_TRIANGLE_MESH_KHR, 1) \ + _(XR_VISIBILITY_MASK_TYPE_VISIBLE_TRIANGLE_MESH_KHR, 2) \ + _(XR_VISIBILITY_MASK_TYPE_LINE_LOOP_KHR, 3) \ + _(XR_VISIBILITY_MASK_TYPE_MAX_ENUM_KHR, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrPerfSettingsDomainEXT(_) \ + _(XR_PERF_SETTINGS_DOMAIN_CPU_EXT, 1) \ + _(XR_PERF_SETTINGS_DOMAIN_GPU_EXT, 2) \ + _(XR_PERF_SETTINGS_DOMAIN_MAX_ENUM_EXT, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrPerfSettingsSubDomainEXT(_) \ + _(XR_PERF_SETTINGS_SUB_DOMAIN_COMPOSITING_EXT, 1) \ + _(XR_PERF_SETTINGS_SUB_DOMAIN_RENDERING_EXT, 2) \ + _(XR_PERF_SETTINGS_SUB_DOMAIN_THERMAL_EXT, 3) \ + _(XR_PERF_SETTINGS_SUB_DOMAIN_MAX_ENUM_EXT, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrPerfSettingsLevelEXT(_) \ + _(XR_PERF_SETTINGS_LEVEL_POWER_SAVINGS_EXT, 0) \ + _(XR_PERF_SETTINGS_LEVEL_SUSTAINED_LOW_EXT, 25) \ + _(XR_PERF_SETTINGS_LEVEL_SUSTAINED_HIGH_EXT, 50) \ + _(XR_PERF_SETTINGS_LEVEL_BOOST_EXT, 75) \ + _(XR_PERF_SETTINGS_LEVEL_MAX_ENUM_EXT, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrPerfSettingsNotificationLevelEXT(_) \ + _(XR_PERF_SETTINGS_NOTIF_LEVEL_NORMAL_EXT, 0) \ + _(XR_PERF_SETTINGS_NOTIF_LEVEL_WARNING_EXT, 25) \ + _(XR_PERF_SETTINGS_NOTIF_LEVEL_IMPAIRED_EXT, 75) \ + _(XR_PERF_SETTINGS_NOTIFICATION_LEVEL_MAX_ENUM_EXT, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrSpatialGraphNodeTypeMSFT(_) \ + _(XR_SPATIAL_GRAPH_NODE_TYPE_STATIC_MSFT, 1) \ + _(XR_SPATIAL_GRAPH_NODE_TYPE_DYNAMIC_MSFT, 2) \ + _(XR_SPATIAL_GRAPH_NODE_TYPE_MAX_ENUM_MSFT, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrHandEXT(_) \ + _(XR_HAND_LEFT_EXT, 1) \ + _(XR_HAND_RIGHT_EXT, 2) \ + _(XR_HAND_MAX_ENUM_EXT, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrHandJointEXT(_) \ + _(XR_HAND_JOINT_PALM_EXT, 0) \ + _(XR_HAND_JOINT_WRIST_EXT, 1) \ + _(XR_HAND_JOINT_THUMB_METACARPAL_EXT, 2) \ + _(XR_HAND_JOINT_THUMB_PROXIMAL_EXT, 3) \ + _(XR_HAND_JOINT_THUMB_DISTAL_EXT, 4) \ + _(XR_HAND_JOINT_THUMB_TIP_EXT, 5) \ + _(XR_HAND_JOINT_INDEX_METACARPAL_EXT, 6) \ + _(XR_HAND_JOINT_INDEX_PROXIMAL_EXT, 7) \ + _(XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT, 8) \ + _(XR_HAND_JOINT_INDEX_DISTAL_EXT, 9) \ + _(XR_HAND_JOINT_INDEX_TIP_EXT, 10) \ + _(XR_HAND_JOINT_MIDDLE_METACARPAL_EXT, 11) \ + _(XR_HAND_JOINT_MIDDLE_PROXIMAL_EXT, 12) \ + _(XR_HAND_JOINT_MIDDLE_INTERMEDIATE_EXT, 13) \ + _(XR_HAND_JOINT_MIDDLE_DISTAL_EXT, 14) \ + _(XR_HAND_JOINT_MIDDLE_TIP_EXT, 15) \ + _(XR_HAND_JOINT_RING_METACARPAL_EXT, 16) \ + _(XR_HAND_JOINT_RING_PROXIMAL_EXT, 17) \ + _(XR_HAND_JOINT_RING_INTERMEDIATE_EXT, 18) \ + _(XR_HAND_JOINT_RING_DISTAL_EXT, 19) \ + _(XR_HAND_JOINT_RING_TIP_EXT, 20) \ + _(XR_HAND_JOINT_LITTLE_METACARPAL_EXT, 21) \ + _(XR_HAND_JOINT_LITTLE_PROXIMAL_EXT, 22) \ + _(XR_HAND_JOINT_LITTLE_INTERMEDIATE_EXT, 23) \ + _(XR_HAND_JOINT_LITTLE_DISTAL_EXT, 24) \ + _(XR_HAND_JOINT_LITTLE_TIP_EXT, 25) \ + _(XR_HAND_JOINT_MAX_ENUM_EXT, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrHandJointSetEXT(_) \ + _(XR_HAND_JOINT_SET_DEFAULT_EXT, 0) \ + _(XR_HAND_JOINT_SET_MAX_ENUM_EXT, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrHandPoseTypeMSFT(_) \ + _(XR_HAND_POSE_TYPE_TRACKED_MSFT, 0) \ + _(XR_HAND_POSE_TYPE_REFERENCE_OPEN_PALM_MSFT, 1) \ + _(XR_HAND_POSE_TYPE_MAX_ENUM_MSFT, 0x7FFFFFFF) + +#define XR_LIST_ENUM_XrColorSpaceFB(_) \ + _(XR_COLOR_SPACE_UNMANAGED_FB, 0) \ + _(XR_COLOR_SPACE_REC2020_FB, 1) \ + _(XR_COLOR_SPACE_REC709_FB, 2) \ + _(XR_COLOR_SPACE_RIFT_CV1_FB, 3) \ + _(XR_COLOR_SPACE_RIFT_S_FB, 4) \ + _(XR_COLOR_SPACE_QUEST_FB, 5) \ + _(XR_COLOR_SPACE_P3_FB, 6) \ + _(XR_COLOR_SPACE_ADOBE_RGB_FB, 7) \ + _(XR_COLOR_SPACE_MAX_ENUM_FB, 0x7FFFFFFF) + +#define XR_LIST_BITS_XrInstanceCreateFlags(_) + +#define XR_LIST_BITS_XrSessionCreateFlags(_) + +#define XR_LIST_BITS_XrSpaceVelocityFlags(_) \ + _(XR_SPACE_VELOCITY_LINEAR_VALID_BIT, 0x00000001) \ + _(XR_SPACE_VELOCITY_ANGULAR_VALID_BIT, 0x00000002) \ + +#define XR_LIST_BITS_XrSpaceLocationFlags(_) \ + _(XR_SPACE_LOCATION_ORIENTATION_VALID_BIT, 0x00000001) \ + _(XR_SPACE_LOCATION_POSITION_VALID_BIT, 0x00000002) \ + _(XR_SPACE_LOCATION_ORIENTATION_TRACKED_BIT, 0x00000004) \ + _(XR_SPACE_LOCATION_POSITION_TRACKED_BIT, 0x00000008) \ + +#define XR_LIST_BITS_XrSwapchainCreateFlags(_) \ + _(XR_SWAPCHAIN_CREATE_PROTECTED_CONTENT_BIT, 0x00000001) \ + _(XR_SWAPCHAIN_CREATE_STATIC_IMAGE_BIT, 0x00000002) \ + +#define XR_LIST_BITS_XrSwapchainUsageFlags(_) \ + _(XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT, 0x00000001) \ + _(XR_SWAPCHAIN_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, 0x00000002) \ + _(XR_SWAPCHAIN_USAGE_UNORDERED_ACCESS_BIT, 0x00000004) \ + _(XR_SWAPCHAIN_USAGE_TRANSFER_SRC_BIT, 0x00000008) \ + _(XR_SWAPCHAIN_USAGE_TRANSFER_DST_BIT, 0x00000010) \ + _(XR_SWAPCHAIN_USAGE_SAMPLED_BIT, 0x00000020) \ + _(XR_SWAPCHAIN_USAGE_MUTABLE_FORMAT_BIT, 0x00000040) \ + _(XR_SWAPCHAIN_USAGE_INPUT_ATTACHMENT_BIT_MND, 0x00000080) \ + +#define XR_LIST_BITS_XrCompositionLayerFlags(_) \ + _(XR_COMPOSITION_LAYER_CORRECT_CHROMATIC_ABERRATION_BIT, 0x00000001) \ + _(XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT, 0x00000002) \ + _(XR_COMPOSITION_LAYER_UNPREMULTIPLIED_ALPHA_BIT, 0x00000004) \ + +#define XR_LIST_BITS_XrViewStateFlags(_) \ + _(XR_VIEW_STATE_ORIENTATION_VALID_BIT, 0x00000001) \ + _(XR_VIEW_STATE_POSITION_VALID_BIT, 0x00000002) \ + _(XR_VIEW_STATE_ORIENTATION_TRACKED_BIT, 0x00000004) \ + _(XR_VIEW_STATE_POSITION_TRACKED_BIT, 0x00000008) \ + +#define XR_LIST_BITS_XrInputSourceLocalizedNameFlags(_) \ + _(XR_INPUT_SOURCE_LOCALIZED_NAME_USER_PATH_BIT, 0x00000001) \ + _(XR_INPUT_SOURCE_LOCALIZED_NAME_INTERACTION_PROFILE_BIT, 0x00000002) \ + _(XR_INPUT_SOURCE_LOCALIZED_NAME_COMPONENT_BIT, 0x00000004) \ + +#define XR_LIST_BITS_XrVulkanInstanceCreateFlagsKHR(_) + +#define XR_LIST_BITS_XrVulkanDeviceCreateFlagsKHR(_) + +#define XR_LIST_BITS_XrDebugUtilsMessageSeverityFlagsEXT(_) \ + _(XR_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT, 0x00000001) \ + _(XR_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT, 0x00000010) \ + _(XR_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT, 0x00000100) \ + _(XR_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT, 0x00001000) \ + +#define XR_LIST_BITS_XrDebugUtilsMessageTypeFlagsEXT(_) \ + _(XR_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT, 0x00000001) \ + _(XR_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT, 0x00000002) \ + _(XR_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT, 0x00000004) \ + _(XR_DEBUG_UTILS_MESSAGE_TYPE_CONFORMANCE_BIT_EXT, 0x00000008) \ + +#define XR_LIST_BITS_XrOverlaySessionCreateFlagsEXTX(_) + +#define XR_LIST_BITS_XrOverlayMainSessionFlagsEXTX(_) \ + _(XR_OVERLAY_MAIN_SESSION_ENABLED_COMPOSITION_LAYER_INFO_DEPTH_BIT_EXTX, 0x00000001) \ + +#define XR_LIST_BITS_XrAndroidSurfaceSwapchainFlagsFB(_) \ + _(XR_ANDROID_SURFACE_SWAPCHAIN_SYNCHRONOUS_BIT_FB, 0x00000001) \ + _(XR_ANDROID_SURFACE_SWAPCHAIN_USE_TIMESTAMPS_BIT_FB, 0x00000002) \ + +#define XR_LIST_STRUCT_XrApiLayerProperties(_) \ + _(type) \ + _(next) \ + _(layerName) \ + _(specVersion) \ + _(layerVersion) \ + _(description) \ + +#define XR_LIST_STRUCT_XrExtensionProperties(_) \ + _(type) \ + _(next) \ + _(extensionName) \ + _(extensionVersion) \ + +#define XR_LIST_STRUCT_XrApplicationInfo(_) \ + _(applicationName) \ + _(applicationVersion) \ + _(engineName) \ + _(engineVersion) \ + _(apiVersion) \ + +#define XR_LIST_STRUCT_XrInstanceCreateInfo(_) \ + _(type) \ + _(next) \ + _(createFlags) \ + _(applicationInfo) \ + _(enabledApiLayerCount) \ + _(enabledApiLayerNames) \ + _(enabledExtensionCount) \ + _(enabledExtensionNames) \ + +#define XR_LIST_STRUCT_XrInstanceProperties(_) \ + _(type) \ + _(next) \ + _(runtimeVersion) \ + _(runtimeName) \ + +#define XR_LIST_STRUCT_XrEventDataBuffer(_) \ + _(type) \ + _(next) \ + _(varying) \ + +#define XR_LIST_STRUCT_XrSystemGetInfo(_) \ + _(type) \ + _(next) \ + _(formFactor) \ + +#define XR_LIST_STRUCT_XrSystemGraphicsProperties(_) \ + _(maxSwapchainImageHeight) \ + _(maxSwapchainImageWidth) \ + _(maxLayerCount) \ + +#define XR_LIST_STRUCT_XrSystemTrackingProperties(_) \ + _(orientationTracking) \ + _(positionTracking) \ + +#define XR_LIST_STRUCT_XrSystemProperties(_) \ + _(type) \ + _(next) \ + _(systemId) \ + _(vendorId) \ + _(systemName) \ + _(graphicsProperties) \ + _(trackingProperties) \ + +#define XR_LIST_STRUCT_XrSessionCreateInfo(_) \ + _(type) \ + _(next) \ + _(createFlags) \ + _(systemId) \ + +#define XR_LIST_STRUCT_XrVector3f(_) \ + _(x) \ + _(y) \ + _(z) \ + +#define XR_LIST_STRUCT_XrSpaceVelocity(_) \ + _(type) \ + _(next) \ + _(velocityFlags) \ + _(linearVelocity) \ + _(angularVelocity) \ + +#define XR_LIST_STRUCT_XrQuaternionf(_) \ + _(x) \ + _(y) \ + _(z) \ + _(w) \ + +#define XR_LIST_STRUCT_XrPosef(_) \ + _(orientation) \ + _(position) \ + +#define XR_LIST_STRUCT_XrReferenceSpaceCreateInfo(_) \ + _(type) \ + _(next) \ + _(referenceSpaceType) \ + _(poseInReferenceSpace) \ + +#define XR_LIST_STRUCT_XrExtent2Df(_) \ + _(width) \ + _(height) \ + +#define XR_LIST_STRUCT_XrActionSpaceCreateInfo(_) \ + _(type) \ + _(next) \ + _(action) \ + _(subactionPath) \ + _(poseInActionSpace) \ + +#define XR_LIST_STRUCT_XrSpaceLocation(_) \ + _(type) \ + _(next) \ + _(locationFlags) \ + _(pose) \ + +#define XR_LIST_STRUCT_XrViewConfigurationProperties(_) \ + _(type) \ + _(next) \ + _(viewConfigurationType) \ + _(fovMutable) \ + +#define XR_LIST_STRUCT_XrViewConfigurationView(_) \ + _(type) \ + _(next) \ + _(recommendedImageRectWidth) \ + _(maxImageRectWidth) \ + _(recommendedImageRectHeight) \ + _(maxImageRectHeight) \ + _(recommendedSwapchainSampleCount) \ + _(maxSwapchainSampleCount) \ + +#define XR_LIST_STRUCT_XrSwapchainCreateInfo(_) \ + _(type) \ + _(next) \ + _(createFlags) \ + _(usageFlags) \ + _(format) \ + _(sampleCount) \ + _(width) \ + _(height) \ + _(faceCount) \ + _(arraySize) \ + _(mipCount) \ + +#define XR_LIST_STRUCT_XrSwapchainImageBaseHeader(_) \ + _(type) \ + _(next) \ + +#define XR_LIST_STRUCT_XrSwapchainImageAcquireInfo(_) \ + _(type) \ + _(next) \ + +#define XR_LIST_STRUCT_XrSwapchainImageWaitInfo(_) \ + _(type) \ + _(next) \ + _(timeout) \ + +#define XR_LIST_STRUCT_XrSwapchainImageReleaseInfo(_) \ + _(type) \ + _(next) \ + +#define XR_LIST_STRUCT_XrSessionBeginInfo(_) \ + _(type) \ + _(next) \ + _(primaryViewConfigurationType) \ + +#define XR_LIST_STRUCT_XrFrameWaitInfo(_) \ + _(type) \ + _(next) \ + +#define XR_LIST_STRUCT_XrFrameState(_) \ + _(type) \ + _(next) \ + _(predictedDisplayTime) \ + _(predictedDisplayPeriod) \ + _(shouldRender) \ + +#define XR_LIST_STRUCT_XrFrameBeginInfo(_) \ + _(type) \ + _(next) \ + +#define XR_LIST_STRUCT_XrCompositionLayerBaseHeader(_) \ + _(type) \ + _(next) \ + _(layerFlags) \ + _(space) \ + +#define XR_LIST_STRUCT_XrFrameEndInfo(_) \ + _(type) \ + _(next) \ + _(displayTime) \ + _(environmentBlendMode) \ + _(layerCount) \ + _(layers) \ + +#define XR_LIST_STRUCT_XrViewLocateInfo(_) \ + _(type) \ + _(next) \ + _(viewConfigurationType) \ + _(displayTime) \ + _(space) \ + +#define XR_LIST_STRUCT_XrViewState(_) \ + _(type) \ + _(next) \ + _(viewStateFlags) \ + +#define XR_LIST_STRUCT_XrFovf(_) \ + _(angleLeft) \ + _(angleRight) \ + _(angleUp) \ + _(angleDown) \ + +#define XR_LIST_STRUCT_XrView(_) \ + _(type) \ + _(next) \ + _(pose) \ + _(fov) \ + +#define XR_LIST_STRUCT_XrActionSetCreateInfo(_) \ + _(type) \ + _(next) \ + _(actionSetName) \ + _(localizedActionSetName) \ + _(priority) \ + +#define XR_LIST_STRUCT_XrActionCreateInfo(_) \ + _(type) \ + _(next) \ + _(actionName) \ + _(actionType) \ + _(countSubactionPaths) \ + _(subactionPaths) \ + _(localizedActionName) \ + +#define XR_LIST_STRUCT_XrActionSuggestedBinding(_) \ + _(action) \ + _(binding) \ + +#define XR_LIST_STRUCT_XrInteractionProfileSuggestedBinding(_) \ + _(type) \ + _(next) \ + _(interactionProfile) \ + _(countSuggestedBindings) \ + _(suggestedBindings) \ + +#define XR_LIST_STRUCT_XrSessionActionSetsAttachInfo(_) \ + _(type) \ + _(next) \ + _(countActionSets) \ + _(actionSets) \ + +#define XR_LIST_STRUCT_XrInteractionProfileState(_) \ + _(type) \ + _(next) \ + _(interactionProfile) \ + +#define XR_LIST_STRUCT_XrActionStateGetInfo(_) \ + _(type) \ + _(next) \ + _(action) \ + _(subactionPath) \ + +#define XR_LIST_STRUCT_XrActionStateBoolean(_) \ + _(type) \ + _(next) \ + _(currentState) \ + _(changedSinceLastSync) \ + _(lastChangeTime) \ + _(isActive) \ + +#define XR_LIST_STRUCT_XrActionStateFloat(_) \ + _(type) \ + _(next) \ + _(currentState) \ + _(changedSinceLastSync) \ + _(lastChangeTime) \ + _(isActive) \ + +#define XR_LIST_STRUCT_XrVector2f(_) \ + _(x) \ + _(y) \ + +#define XR_LIST_STRUCT_XrActionStateVector2f(_) \ + _(type) \ + _(next) \ + _(currentState) \ + _(changedSinceLastSync) \ + _(lastChangeTime) \ + _(isActive) \ + +#define XR_LIST_STRUCT_XrActionStatePose(_) \ + _(type) \ + _(next) \ + _(isActive) \ + +#define XR_LIST_STRUCT_XrActiveActionSet(_) \ + _(actionSet) \ + _(subactionPath) \ + +#define XR_LIST_STRUCT_XrActionsSyncInfo(_) \ + _(type) \ + _(next) \ + _(countActiveActionSets) \ + _(activeActionSets) \ + +#define XR_LIST_STRUCT_XrBoundSourcesForActionEnumerateInfo(_) \ + _(type) \ + _(next) \ + _(action) \ + +#define XR_LIST_STRUCT_XrInputSourceLocalizedNameGetInfo(_) \ + _(type) \ + _(next) \ + _(sourcePath) \ + _(whichComponents) \ + +#define XR_LIST_STRUCT_XrHapticActionInfo(_) \ + _(type) \ + _(next) \ + _(action) \ + _(subactionPath) \ + +#define XR_LIST_STRUCT_XrHapticBaseHeader(_) \ + _(type) \ + _(next) \ + +#define XR_LIST_STRUCT_XrBaseInStructure(_) \ + _(type) \ + _(next) \ + +#define XR_LIST_STRUCT_XrBaseOutStructure(_) \ + _(type) \ + _(next) \ + +#define XR_LIST_STRUCT_XrOffset2Di(_) \ + _(x) \ + _(y) \ + +#define XR_LIST_STRUCT_XrExtent2Di(_) \ + _(width) \ + _(height) \ + +#define XR_LIST_STRUCT_XrRect2Di(_) \ + _(offset) \ + _(extent) \ + +#define XR_LIST_STRUCT_XrSwapchainSubImage(_) \ + _(swapchain) \ + _(imageRect) \ + _(imageArrayIndex) \ + +#define XR_LIST_STRUCT_XrCompositionLayerProjectionView(_) \ + _(type) \ + _(next) \ + _(pose) \ + _(fov) \ + _(subImage) \ + +#define XR_LIST_STRUCT_XrCompositionLayerProjection(_) \ + _(type) \ + _(next) \ + _(layerFlags) \ + _(space) \ + _(viewCount) \ + _(views) \ + +#define XR_LIST_STRUCT_XrCompositionLayerQuad(_) \ + _(type) \ + _(next) \ + _(layerFlags) \ + _(space) \ + _(eyeVisibility) \ + _(subImage) \ + _(pose) \ + _(size) \ + +#define XR_LIST_STRUCT_XrEventDataBaseHeader(_) \ + _(type) \ + _(next) \ + +#define XR_LIST_STRUCT_XrEventDataEventsLost(_) \ + _(type) \ + _(next) \ + _(lostEventCount) \ + +#define XR_LIST_STRUCT_XrEventDataInstanceLossPending(_) \ + _(type) \ + _(next) \ + _(lossTime) \ + +#define XR_LIST_STRUCT_XrEventDataSessionStateChanged(_) \ + _(type) \ + _(next) \ + _(session) \ + _(state) \ + _(time) \ + +#define XR_LIST_STRUCT_XrEventDataReferenceSpaceChangePending(_) \ + _(type) \ + _(next) \ + _(session) \ + _(referenceSpaceType) \ + _(changeTime) \ + _(poseValid) \ + _(poseInPreviousSpace) \ + +#define XR_LIST_STRUCT_XrEventDataInteractionProfileChanged(_) \ + _(type) \ + _(next) \ + _(session) \ + +#define XR_LIST_STRUCT_XrHapticVibration(_) \ + _(type) \ + _(next) \ + _(duration) \ + _(frequency) \ + _(amplitude) \ + +#define XR_LIST_STRUCT_XrOffset2Df(_) \ + _(x) \ + _(y) \ + +#define XR_LIST_STRUCT_XrRect2Df(_) \ + _(offset) \ + _(extent) \ + +#define XR_LIST_STRUCT_XrVector4f(_) \ + _(x) \ + _(y) \ + _(z) \ + _(w) \ + +#define XR_LIST_STRUCT_XrColor4f(_) \ + _(r) \ + _(g) \ + _(b) \ + _(a) \ + +#define XR_LIST_STRUCT_XrCompositionLayerCubeKHR(_) \ + _(type) \ + _(next) \ + _(layerFlags) \ + _(space) \ + _(eyeVisibility) \ + _(swapchain) \ + _(imageArrayIndex) \ + _(orientation) \ + +#define XR_LIST_STRUCT_XrInstanceCreateInfoAndroidKHR(_) \ + _(type) \ + _(next) \ + _(applicationVM) \ + _(applicationActivity) \ + +#define XR_LIST_STRUCT_XrCompositionLayerDepthInfoKHR(_) \ + _(type) \ + _(next) \ + _(subImage) \ + _(minDepth) \ + _(maxDepth) \ + _(nearZ) \ + _(farZ) \ + +#define XR_LIST_STRUCT_XrVulkanSwapchainFormatListCreateInfoKHR(_) \ + _(type) \ + _(next) \ + _(viewFormatCount) \ + _(viewFormats) \ + +#define XR_LIST_STRUCT_XrCompositionLayerCylinderKHR(_) \ + _(type) \ + _(next) \ + _(layerFlags) \ + _(space) \ + _(eyeVisibility) \ + _(subImage) \ + _(pose) \ + _(radius) \ + _(centralAngle) \ + _(aspectRatio) \ + +#define XR_LIST_STRUCT_XrCompositionLayerEquirectKHR(_) \ + _(type) \ + _(next) \ + _(layerFlags) \ + _(space) \ + _(eyeVisibility) \ + _(subImage) \ + _(pose) \ + _(radius) \ + _(scale) \ + _(bias) \ + +#define XR_LIST_STRUCT_XrGraphicsBindingOpenGLWin32KHR(_) \ + _(type) \ + _(next) \ + _(hDC) \ + _(hGLRC) \ + +#define XR_LIST_STRUCT_XrGraphicsBindingOpenGLXlibKHR(_) \ + _(type) \ + _(next) \ + _(xDisplay) \ + _(visualid) \ + _(glxFBConfig) \ + _(glxDrawable) \ + _(glxContext) \ + +#define XR_LIST_STRUCT_XrGraphicsBindingOpenGLXcbKHR(_) \ + _(type) \ + _(next) \ + _(connection) \ + _(screenNumber) \ + _(fbconfigid) \ + _(visualid) \ + _(glxDrawable) \ + _(glxContext) \ + +#define XR_LIST_STRUCT_XrGraphicsBindingOpenGLWaylandKHR(_) \ + _(type) \ + _(next) \ + _(display) \ + +#define XR_LIST_STRUCT_XrSwapchainImageOpenGLKHR(_) \ + _(type) \ + _(next) \ + _(image) \ + +#define XR_LIST_STRUCT_XrGraphicsRequirementsOpenGLKHR(_) \ + _(type) \ + _(next) \ + _(minApiVersionSupported) \ + _(maxApiVersionSupported) \ + +#define XR_LIST_STRUCT_XrGraphicsBindingOpenGLESAndroidKHR(_) \ + _(type) \ + _(next) \ + _(display) \ + _(config) \ + _(context) \ + +#define XR_LIST_STRUCT_XrSwapchainImageOpenGLESKHR(_) \ + _(type) \ + _(next) \ + _(image) \ + +#define XR_LIST_STRUCT_XrGraphicsRequirementsOpenGLESKHR(_) \ + _(type) \ + _(next) \ + _(minApiVersionSupported) \ + _(maxApiVersionSupported) \ + +#define XR_LIST_STRUCT_XrGraphicsBindingVulkanKHR(_) \ + _(type) \ + _(next) \ + _(instance) \ + _(physicalDevice) \ + _(device) \ + _(queueFamilyIndex) \ + _(queueIndex) \ + +#define XR_LIST_STRUCT_XrSwapchainImageVulkanKHR(_) \ + _(type) \ + _(next) \ + _(image) \ + +#define XR_LIST_STRUCT_XrGraphicsRequirementsVulkanKHR(_) \ + _(type) \ + _(next) \ + _(minApiVersionSupported) \ + _(maxApiVersionSupported) \ + +#define XR_LIST_STRUCT_XrGraphicsBindingD3D11KHR(_) \ + _(type) \ + _(next) \ + _(device) \ + +#define XR_LIST_STRUCT_XrSwapchainImageD3D11KHR(_) \ + _(type) \ + _(next) \ + _(texture) \ + +#define XR_LIST_STRUCT_XrGraphicsRequirementsD3D11KHR(_) \ + _(type) \ + _(next) \ + _(adapterLuid) \ + _(minFeatureLevel) \ + +#define XR_LIST_STRUCT_XrGraphicsBindingD3D12KHR(_) \ + _(type) \ + _(next) \ + _(device) \ + _(queue) \ + +#define XR_LIST_STRUCT_XrSwapchainImageD3D12KHR(_) \ + _(type) \ + _(next) \ + _(texture) \ + +#define XR_LIST_STRUCT_XrGraphicsRequirementsD3D12KHR(_) \ + _(type) \ + _(next) \ + _(adapterLuid) \ + _(minFeatureLevel) \ + +#define XR_LIST_STRUCT_XrVisibilityMaskKHR(_) \ + _(type) \ + _(next) \ + _(vertexCapacityInput) \ + _(vertexCountOutput) \ + _(vertices) \ + _(indexCapacityInput) \ + _(indexCountOutput) \ + _(indices) \ + +#define XR_LIST_STRUCT_XrEventDataVisibilityMaskChangedKHR(_) \ + _(type) \ + _(next) \ + _(session) \ + _(viewConfigurationType) \ + _(viewIndex) \ + +#define XR_LIST_STRUCT_XrCompositionLayerColorScaleBiasKHR(_) \ + _(type) \ + _(next) \ + _(colorScale) \ + _(colorBias) \ + +#define XR_LIST_STRUCT_XrLoaderInitInfoBaseHeaderKHR(_) \ + _(type) \ + _(next) \ + +#define XR_LIST_STRUCT_XrLoaderInitInfoAndroidKHR(_) \ + _(type) \ + _(next) \ + _(applicationVM) \ + _(applicationContext) \ + +#define XR_LIST_STRUCT_XrVulkanInstanceCreateInfoKHR(_) \ + _(type) \ + _(next) \ + _(systemId) \ + _(createFlags) \ + _(pfnGetInstanceProcAddr) \ + _(vulkanCreateInfo) \ + _(vulkanAllocator) \ + +#define XR_LIST_STRUCT_XrVulkanDeviceCreateInfoKHR(_) \ + _(type) \ + _(next) \ + _(systemId) \ + _(createFlags) \ + _(pfnGetInstanceProcAddr) \ + _(vulkanPhysicalDevice) \ + _(vulkanCreateInfo) \ + _(vulkanAllocator) \ + +#define XR_LIST_STRUCT_XrVulkanGraphicsDeviceGetInfoKHR(_) \ + _(type) \ + _(next) \ + _(systemId) \ + _(vulkanInstance) \ + +#define XR_LIST_STRUCT_XrCompositionLayerEquirect2KHR(_) \ + _(type) \ + _(next) \ + _(layerFlags) \ + _(space) \ + _(eyeVisibility) \ + _(subImage) \ + _(pose) \ + _(radius) \ + _(centralHorizontalAngle) \ + _(upperVerticalAngle) \ + _(lowerVerticalAngle) \ + +#define XR_LIST_STRUCT_XrBindingModificationBaseHeaderKHR(_) \ + _(type) \ + _(next) \ + +#define XR_LIST_STRUCT_XrBindingModificationsKHR(_) \ + _(type) \ + _(next) \ + _(bindingModificationCount) \ + _(bindingModifications) \ + +#define XR_LIST_STRUCT_XrEventDataPerfSettingsEXT(_) \ + _(type) \ + _(next) \ + _(domain) \ + _(subDomain) \ + _(fromLevel) \ + _(toLevel) \ + +#define XR_LIST_STRUCT_XrDebugUtilsObjectNameInfoEXT(_) \ + _(type) \ + _(next) \ + _(objectType) \ + _(objectHandle) \ + _(objectName) \ + +#define XR_LIST_STRUCT_XrDebugUtilsLabelEXT(_) \ + _(type) \ + _(next) \ + _(labelName) \ + +#define XR_LIST_STRUCT_XrDebugUtilsMessengerCallbackDataEXT(_) \ + _(type) \ + _(next) \ + _(messageId) \ + _(functionName) \ + _(message) \ + _(objectCount) \ + _(objects) \ + _(sessionLabelCount) \ + _(sessionLabels) \ + +#define XR_LIST_STRUCT_XrDebugUtilsMessengerCreateInfoEXT(_) \ + _(type) \ + _(next) \ + _(messageSeverities) \ + _(messageTypes) \ + _(userCallback) \ + _(userData) \ + +#define XR_LIST_STRUCT_XrSystemEyeGazeInteractionPropertiesEXT(_) \ + _(type) \ + _(next) \ + _(supportsEyeGazeInteraction) \ + +#define XR_LIST_STRUCT_XrEyeGazeSampleTimeEXT(_) \ + _(type) \ + _(next) \ + _(time) \ + +#define XR_LIST_STRUCT_XrSessionCreateInfoOverlayEXTX(_) \ + _(type) \ + _(next) \ + _(createFlags) \ + _(sessionLayersPlacement) \ + +#define XR_LIST_STRUCT_XrEventDataMainSessionVisibilityChangedEXTX(_) \ + _(type) \ + _(next) \ + _(visible) \ + _(flags) \ + +#define XR_LIST_STRUCT_XrSpatialAnchorCreateInfoMSFT(_) \ + _(type) \ + _(next) \ + _(space) \ + _(pose) \ + _(time) \ + +#define XR_LIST_STRUCT_XrSpatialAnchorSpaceCreateInfoMSFT(_) \ + _(type) \ + _(next) \ + _(anchor) \ + _(poseInAnchorSpace) \ + +#define XR_LIST_STRUCT_XrViewConfigurationDepthRangeEXT(_) \ + _(type) \ + _(next) \ + _(recommendedNearZ) \ + _(minNearZ) \ + _(recommendedFarZ) \ + _(maxFarZ) \ + +#define XR_LIST_STRUCT_XrGraphicsBindingEGLMNDX(_) \ + _(type) \ + _(next) \ + _(getProcAddress) \ + _(display) \ + _(config) \ + _(context) \ + +#define XR_LIST_STRUCT_XrSpatialGraphNodeSpaceCreateInfoMSFT(_) \ + _(type) \ + _(next) \ + _(nodeType) \ + _(nodeId) \ + _(pose) \ + +#define XR_LIST_STRUCT_XrSystemHandTrackingPropertiesEXT(_) \ + _(type) \ + _(next) \ + _(supportsHandTracking) \ + +#define XR_LIST_STRUCT_XrHandTrackerCreateInfoEXT(_) \ + _(type) \ + _(next) \ + _(hand) \ + _(handJointSet) \ + +#define XR_LIST_STRUCT_XrHandJointsLocateInfoEXT(_) \ + _(type) \ + _(next) \ + _(baseSpace) \ + _(time) \ + +#define XR_LIST_STRUCT_XrHandJointLocationEXT(_) \ + _(locationFlags) \ + _(pose) \ + _(radius) \ + +#define XR_LIST_STRUCT_XrHandJointVelocityEXT(_) \ + _(velocityFlags) \ + _(linearVelocity) \ + _(angularVelocity) \ + +#define XR_LIST_STRUCT_XrHandJointLocationsEXT(_) \ + _(type) \ + _(next) \ + _(isActive) \ + _(jointCount) \ + _(jointLocations) \ + +#define XR_LIST_STRUCT_XrHandJointVelocitiesEXT(_) \ + _(type) \ + _(next) \ + _(jointCount) \ + _(jointVelocities) \ + +#define XR_LIST_STRUCT_XrSystemHandTrackingMeshPropertiesMSFT(_) \ + _(type) \ + _(next) \ + _(supportsHandTrackingMesh) \ + _(maxHandMeshIndexCount) \ + _(maxHandMeshVertexCount) \ + +#define XR_LIST_STRUCT_XrHandMeshSpaceCreateInfoMSFT(_) \ + _(type) \ + _(next) \ + _(handPoseType) \ + _(poseInHandMeshSpace) \ + +#define XR_LIST_STRUCT_XrHandMeshUpdateInfoMSFT(_) \ + _(type) \ + _(next) \ + _(time) \ + _(handPoseType) \ + +#define XR_LIST_STRUCT_XrHandMeshIndexBufferMSFT(_) \ + _(indexBufferKey) \ + _(indexCapacityInput) \ + _(indexCountOutput) \ + _(indices) \ + +#define XR_LIST_STRUCT_XrHandMeshVertexMSFT(_) \ + _(position) \ + _(normal) \ + +#define XR_LIST_STRUCT_XrHandMeshVertexBufferMSFT(_) \ + _(vertexUpdateTime) \ + _(vertexCapacityInput) \ + _(vertexCountOutput) \ + _(vertices) \ + +#define XR_LIST_STRUCT_XrHandMeshMSFT(_) \ + _(type) \ + _(next) \ + _(isActive) \ + _(indexBufferChanged) \ + _(vertexBufferChanged) \ + _(indexBuffer) \ + _(vertexBuffer) \ + +#define XR_LIST_STRUCT_XrHandPoseTypeInfoMSFT(_) \ + _(type) \ + _(next) \ + _(handPoseType) \ + +#define XR_LIST_STRUCT_XrSecondaryViewConfigurationSessionBeginInfoMSFT(_) \ + _(type) \ + _(next) \ + _(viewConfigurationCount) \ + _(enabledViewConfigurationTypes) \ + +#define XR_LIST_STRUCT_XrSecondaryViewConfigurationStateMSFT(_) \ + _(type) \ + _(next) \ + _(viewConfigurationType) \ + _(active) \ + +#define XR_LIST_STRUCT_XrSecondaryViewConfigurationFrameStateMSFT(_) \ + _(type) \ + _(next) \ + _(viewConfigurationCount) \ + _(viewConfigurationStates) \ + +#define XR_LIST_STRUCT_XrSecondaryViewConfigurationLayerInfoMSFT(_) \ + _(type) \ + _(next) \ + _(viewConfigurationType) \ + _(environmentBlendMode) \ + _(layerCount) \ + _(layers) \ + +#define XR_LIST_STRUCT_XrSecondaryViewConfigurationFrameEndInfoMSFT(_) \ + _(type) \ + _(next) \ + _(viewConfigurationCount) \ + _(viewConfigurationLayersInfo) \ + +#define XR_LIST_STRUCT_XrSecondaryViewConfigurationSwapchainCreateInfoMSFT(_) \ + _(type) \ + _(next) \ + _(viewConfigurationType) \ + +#define XR_LIST_STRUCT_XrControllerModelKeyStateMSFT(_) \ + _(type) \ + _(next) \ + _(modelKey) \ + +#define XR_LIST_STRUCT_XrControllerModelNodePropertiesMSFT(_) \ + _(type) \ + _(next) \ + _(parentNodeName) \ + _(nodeName) \ + +#define XR_LIST_STRUCT_XrControllerModelPropertiesMSFT(_) \ + _(type) \ + _(next) \ + _(nodeCapacityInput) \ + _(nodeCountOutput) \ + _(nodeProperties) \ + +#define XR_LIST_STRUCT_XrControllerModelNodeStateMSFT(_) \ + _(type) \ + _(next) \ + _(nodePose) \ + +#define XR_LIST_STRUCT_XrControllerModelStateMSFT(_) \ + _(type) \ + _(next) \ + _(nodeCapacityInput) \ + _(nodeCountOutput) \ + _(nodeStates) \ + +#define XR_LIST_STRUCT_XrViewConfigurationViewFovEPIC(_) \ + _(type) \ + _(next) \ + _(recommendedFov) \ + _(maxMutableFov) \ + +#define XR_LIST_STRUCT_XrHolographicWindowAttachmentMSFT(_) \ + _(type) \ + _(next) \ + _(holographicSpace) \ + _(coreWindow) \ + +#define XR_LIST_STRUCT_XrAndroidSurfaceSwapchainCreateInfoFB(_) \ + _(type) \ + _(next) \ + _(createFlags) \ + +#define XR_LIST_STRUCT_XrInteractionProfileAnalogThresholdVALVE(_) \ + _(type) \ + _(next) \ + _(action) \ + _(binding) \ + _(onThreshold) \ + _(offThreshold) \ + _(onHaptic) \ + _(offHaptic) \ + +#define XR_LIST_STRUCT_XrEventDataDisplayRefreshRateChangedFB(_) \ + _(type) \ + _(next) \ + _(fromDisplayRefreshRate) \ + _(toDisplayRefreshRate) \ + +#define XR_LIST_STRUCT_XrSystemColorSpacePropertiesFB(_) \ + _(type) \ + _(next) \ + _(colorSpace) \ + +#define XR_LIST_STRUCT_XrViewLocateFoveatedRenderingVARJO(_) \ + _(type) \ + _(next) \ + _(foveatedRenderingActive) \ + +#define XR_LIST_STRUCT_XrFoveatedViewConfigurationViewVARJO(_) \ + _(type) \ + _(next) \ + _(foveatedRenderingActive) \ + +#define XR_LIST_STRUCT_XrSystemFoveatedRenderingPropertiesVARJO(_) \ + _(type) \ + _(next) \ + _(supportsFoveatedRendering) \ + +#define XR_LIST_STRUCT_XrCompositionLayerDepthTestVARJO(_) \ + _(type) \ + _(next) \ + _(depthTestRangeNearZ) \ + _(depthTestRangeFarZ) \ + + + +#define XR_LIST_STRUCTURE_TYPES_CORE(_) \ + _(XrApiLayerProperties, XR_TYPE_API_LAYER_PROPERTIES) \ + _(XrExtensionProperties, XR_TYPE_EXTENSION_PROPERTIES) \ + _(XrInstanceCreateInfo, XR_TYPE_INSTANCE_CREATE_INFO) \ + _(XrInstanceProperties, XR_TYPE_INSTANCE_PROPERTIES) \ + _(XrEventDataBuffer, XR_TYPE_EVENT_DATA_BUFFER) \ + _(XrSystemGetInfo, XR_TYPE_SYSTEM_GET_INFO) \ + _(XrSystemProperties, XR_TYPE_SYSTEM_PROPERTIES) \ + _(XrSessionCreateInfo, XR_TYPE_SESSION_CREATE_INFO) \ + _(XrSpaceVelocity, XR_TYPE_SPACE_VELOCITY) \ + _(XrReferenceSpaceCreateInfo, XR_TYPE_REFERENCE_SPACE_CREATE_INFO) \ + _(XrActionSpaceCreateInfo, XR_TYPE_ACTION_SPACE_CREATE_INFO) \ + _(XrSpaceLocation, XR_TYPE_SPACE_LOCATION) \ + _(XrViewConfigurationProperties, XR_TYPE_VIEW_CONFIGURATION_PROPERTIES) \ + _(XrViewConfigurationView, XR_TYPE_VIEW_CONFIGURATION_VIEW) \ + _(XrSwapchainCreateInfo, XR_TYPE_SWAPCHAIN_CREATE_INFO) \ + _(XrSwapchainImageAcquireInfo, XR_TYPE_SWAPCHAIN_IMAGE_ACQUIRE_INFO) \ + _(XrSwapchainImageWaitInfo, XR_TYPE_SWAPCHAIN_IMAGE_WAIT_INFO) \ + _(XrSwapchainImageReleaseInfo, XR_TYPE_SWAPCHAIN_IMAGE_RELEASE_INFO) \ + _(XrSessionBeginInfo, XR_TYPE_SESSION_BEGIN_INFO) \ + _(XrFrameWaitInfo, XR_TYPE_FRAME_WAIT_INFO) \ + _(XrFrameState, XR_TYPE_FRAME_STATE) \ + _(XrFrameBeginInfo, XR_TYPE_FRAME_BEGIN_INFO) \ + _(XrFrameEndInfo, XR_TYPE_FRAME_END_INFO) \ + _(XrViewLocateInfo, XR_TYPE_VIEW_LOCATE_INFO) \ + _(XrViewState, XR_TYPE_VIEW_STATE) \ + _(XrView, XR_TYPE_VIEW) \ + _(XrActionSetCreateInfo, XR_TYPE_ACTION_SET_CREATE_INFO) \ + _(XrActionCreateInfo, XR_TYPE_ACTION_CREATE_INFO) \ + _(XrInteractionProfileSuggestedBinding, XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING) \ + _(XrSessionActionSetsAttachInfo, XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO) \ + _(XrInteractionProfileState, XR_TYPE_INTERACTION_PROFILE_STATE) \ + _(XrActionStateGetInfo, XR_TYPE_ACTION_STATE_GET_INFO) \ + _(XrActionStateBoolean, XR_TYPE_ACTION_STATE_BOOLEAN) \ + _(XrActionStateFloat, XR_TYPE_ACTION_STATE_FLOAT) \ + _(XrActionStateVector2f, XR_TYPE_ACTION_STATE_VECTOR2F) \ + _(XrActionStatePose, XR_TYPE_ACTION_STATE_POSE) \ + _(XrActionsSyncInfo, XR_TYPE_ACTIONS_SYNC_INFO) \ + _(XrBoundSourcesForActionEnumerateInfo, XR_TYPE_BOUND_SOURCES_FOR_ACTION_ENUMERATE_INFO) \ + _(XrInputSourceLocalizedNameGetInfo, XR_TYPE_INPUT_SOURCE_LOCALIZED_NAME_GET_INFO) \ + _(XrHapticActionInfo, XR_TYPE_HAPTIC_ACTION_INFO) \ + _(XrCompositionLayerProjectionView, XR_TYPE_COMPOSITION_LAYER_PROJECTION_VIEW) \ + _(XrCompositionLayerProjection, XR_TYPE_COMPOSITION_LAYER_PROJECTION) \ + _(XrCompositionLayerQuad, XR_TYPE_COMPOSITION_LAYER_QUAD) \ + _(XrEventDataEventsLost, XR_TYPE_EVENT_DATA_EVENTS_LOST) \ + _(XrEventDataInstanceLossPending, XR_TYPE_EVENT_DATA_INSTANCE_LOSS_PENDING) \ + _(XrEventDataSessionStateChanged, XR_TYPE_EVENT_DATA_SESSION_STATE_CHANGED) \ + _(XrEventDataReferenceSpaceChangePending, XR_TYPE_EVENT_DATA_REFERENCE_SPACE_CHANGE_PENDING) \ + _(XrEventDataInteractionProfileChanged, XR_TYPE_EVENT_DATA_INTERACTION_PROFILE_CHANGED) \ + _(XrHapticVibration, XR_TYPE_HAPTIC_VIBRATION) \ + _(XrCompositionLayerCubeKHR, XR_TYPE_COMPOSITION_LAYER_CUBE_KHR) \ + _(XrCompositionLayerDepthInfoKHR, XR_TYPE_COMPOSITION_LAYER_DEPTH_INFO_KHR) \ + _(XrCompositionLayerCylinderKHR, XR_TYPE_COMPOSITION_LAYER_CYLINDER_KHR) \ + _(XrCompositionLayerEquirectKHR, XR_TYPE_COMPOSITION_LAYER_EQUIRECT_KHR) \ + _(XrVisibilityMaskKHR, XR_TYPE_VISIBILITY_MASK_KHR) \ + _(XrEventDataVisibilityMaskChangedKHR, XR_TYPE_EVENT_DATA_VISIBILITY_MASK_CHANGED_KHR) \ + _(XrCompositionLayerColorScaleBiasKHR, XR_TYPE_COMPOSITION_LAYER_COLOR_SCALE_BIAS_KHR) \ + _(XrCompositionLayerEquirect2KHR, XR_TYPE_COMPOSITION_LAYER_EQUIRECT2_KHR) \ + _(XrBindingModificationsKHR, XR_TYPE_BINDING_MODIFICATIONS_KHR) \ + _(XrEventDataPerfSettingsEXT, XR_TYPE_EVENT_DATA_PERF_SETTINGS_EXT) \ + _(XrDebugUtilsObjectNameInfoEXT, XR_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT) \ + _(XrDebugUtilsLabelEXT, XR_TYPE_DEBUG_UTILS_LABEL_EXT) \ + _(XrDebugUtilsMessengerCallbackDataEXT, XR_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT) \ + _(XrDebugUtilsMessengerCreateInfoEXT, XR_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT) \ + _(XrSystemEyeGazeInteractionPropertiesEXT, XR_TYPE_SYSTEM_EYE_GAZE_INTERACTION_PROPERTIES_EXT) \ + _(XrEyeGazeSampleTimeEXT, XR_TYPE_EYE_GAZE_SAMPLE_TIME_EXT) \ + _(XrSessionCreateInfoOverlayEXTX, XR_TYPE_SESSION_CREATE_INFO_OVERLAY_EXTX) \ + _(XrEventDataMainSessionVisibilityChangedEXTX, XR_TYPE_EVENT_DATA_MAIN_SESSION_VISIBILITY_CHANGED_EXTX) \ + _(XrSpatialAnchorCreateInfoMSFT, XR_TYPE_SPATIAL_ANCHOR_CREATE_INFO_MSFT) \ + _(XrSpatialAnchorSpaceCreateInfoMSFT, XR_TYPE_SPATIAL_ANCHOR_SPACE_CREATE_INFO_MSFT) \ + _(XrViewConfigurationDepthRangeEXT, XR_TYPE_VIEW_CONFIGURATION_DEPTH_RANGE_EXT) \ + _(XrSpatialGraphNodeSpaceCreateInfoMSFT, XR_TYPE_SPATIAL_GRAPH_NODE_SPACE_CREATE_INFO_MSFT) \ + _(XrSystemHandTrackingPropertiesEXT, XR_TYPE_SYSTEM_HAND_TRACKING_PROPERTIES_EXT) \ + _(XrHandTrackerCreateInfoEXT, XR_TYPE_HAND_TRACKER_CREATE_INFO_EXT) \ + _(XrHandJointsLocateInfoEXT, XR_TYPE_HAND_JOINTS_LOCATE_INFO_EXT) \ + _(XrHandJointLocationsEXT, XR_TYPE_HAND_JOINT_LOCATIONS_EXT) \ + _(XrHandJointVelocitiesEXT, XR_TYPE_HAND_JOINT_VELOCITIES_EXT) \ + _(XrSystemHandTrackingMeshPropertiesMSFT, XR_TYPE_SYSTEM_HAND_TRACKING_MESH_PROPERTIES_MSFT) \ + _(XrHandMeshSpaceCreateInfoMSFT, XR_TYPE_HAND_MESH_SPACE_CREATE_INFO_MSFT) \ + _(XrHandMeshUpdateInfoMSFT, XR_TYPE_HAND_MESH_UPDATE_INFO_MSFT) \ + _(XrHandMeshMSFT, XR_TYPE_HAND_MESH_MSFT) \ + _(XrHandPoseTypeInfoMSFT, XR_TYPE_HAND_POSE_TYPE_INFO_MSFT) \ + _(XrSecondaryViewConfigurationSessionBeginInfoMSFT, XR_TYPE_SECONDARY_VIEW_CONFIGURATION_SESSION_BEGIN_INFO_MSFT) \ + _(XrSecondaryViewConfigurationStateMSFT, XR_TYPE_SECONDARY_VIEW_CONFIGURATION_STATE_MSFT) \ + _(XrSecondaryViewConfigurationFrameStateMSFT, XR_TYPE_SECONDARY_VIEW_CONFIGURATION_FRAME_STATE_MSFT) \ + _(XrSecondaryViewConfigurationLayerInfoMSFT, XR_TYPE_SECONDARY_VIEW_CONFIGURATION_LAYER_INFO_MSFT) \ + _(XrSecondaryViewConfigurationFrameEndInfoMSFT, XR_TYPE_SECONDARY_VIEW_CONFIGURATION_FRAME_END_INFO_MSFT) \ + _(XrSecondaryViewConfigurationSwapchainCreateInfoMSFT, XR_TYPE_SECONDARY_VIEW_CONFIGURATION_SWAPCHAIN_CREATE_INFO_MSFT) \ + _(XrControllerModelKeyStateMSFT, XR_TYPE_CONTROLLER_MODEL_KEY_STATE_MSFT) \ + _(XrControllerModelNodePropertiesMSFT, XR_TYPE_CONTROLLER_MODEL_NODE_PROPERTIES_MSFT) \ + _(XrControllerModelPropertiesMSFT, XR_TYPE_CONTROLLER_MODEL_PROPERTIES_MSFT) \ + _(XrControllerModelNodeStateMSFT, XR_TYPE_CONTROLLER_MODEL_NODE_STATE_MSFT) \ + _(XrControllerModelStateMSFT, XR_TYPE_CONTROLLER_MODEL_STATE_MSFT) \ + _(XrViewConfigurationViewFovEPIC, XR_TYPE_VIEW_CONFIGURATION_VIEW_FOV_EPIC) \ + _(XrInteractionProfileAnalogThresholdVALVE, XR_TYPE_INTERACTION_PROFILE_ANALOG_THRESHOLD_VALVE) \ + _(XrEventDataDisplayRefreshRateChangedFB, XR_TYPE_EVENT_DATA_DISPLAY_REFRESH_RATE_CHANGED_FB) \ + _(XrSystemColorSpacePropertiesFB, XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB) \ + _(XrViewLocateFoveatedRenderingVARJO, XR_TYPE_VIEW_LOCATE_FOVEATED_RENDERING_VARJO) \ + _(XrFoveatedViewConfigurationViewVARJO, XR_TYPE_FOVEATED_VIEW_CONFIGURATION_VIEW_VARJO) \ + _(XrSystemFoveatedRenderingPropertiesVARJO, XR_TYPE_SYSTEM_FOVEATED_RENDERING_PROPERTIES_VARJO) \ + _(XrCompositionLayerDepthTestVARJO, XR_TYPE_COMPOSITION_LAYER_DEPTH_TEST_VARJO) \ + + + + +#if defined(XR_USE_GRAPHICS_API_D3D11) +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_D3D11(_) \ + _(XrGraphicsBindingD3D11KHR, XR_TYPE_GRAPHICS_BINDING_D3D11_KHR) \ + _(XrSwapchainImageD3D11KHR, XR_TYPE_SWAPCHAIN_IMAGE_D3D11_KHR) \ + _(XrGraphicsRequirementsD3D11KHR, XR_TYPE_GRAPHICS_REQUIREMENTS_D3D11_KHR) \ + + +#else +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_D3D11(_) +#endif + +#if defined(XR_USE_GRAPHICS_API_D3D12) +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_D3D12(_) \ + _(XrGraphicsBindingD3D12KHR, XR_TYPE_GRAPHICS_BINDING_D3D12_KHR) \ + _(XrSwapchainImageD3D12KHR, XR_TYPE_SWAPCHAIN_IMAGE_D3D12_KHR) \ + _(XrGraphicsRequirementsD3D12KHR, XR_TYPE_GRAPHICS_REQUIREMENTS_D3D12_KHR) \ + + +#else +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_D3D12(_) +#endif + +#if defined(XR_USE_GRAPHICS_API_OPENGL) +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL(_) \ + _(XrSwapchainImageOpenGLKHR, XR_TYPE_SWAPCHAIN_IMAGE_OPENGL_KHR) \ + _(XrGraphicsRequirementsOpenGLKHR, XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_KHR) \ + + +#else +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL(_) +#endif + +#if defined(XR_USE_GRAPHICS_API_OPENGL) && defined(XR_USE_PLATFORM_WAYLAND) +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL_XR_USE_PLATFORM_WAYLAND(_) \ + _(XrGraphicsBindingOpenGLWaylandKHR, XR_TYPE_GRAPHICS_BINDING_OPENGL_WAYLAND_KHR) \ + + +#else +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL_XR_USE_PLATFORM_WAYLAND(_) +#endif + +#if defined(XR_USE_GRAPHICS_API_OPENGL) && defined(XR_USE_PLATFORM_WIN32) +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL_XR_USE_PLATFORM_WIN32(_) \ + _(XrGraphicsBindingOpenGLWin32KHR, XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR) \ + + +#else +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL_XR_USE_PLATFORM_WIN32(_) +#endif + +#if defined(XR_USE_GRAPHICS_API_OPENGL) && defined(XR_USE_PLATFORM_XCB) +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL_XR_USE_PLATFORM_XCB(_) \ + _(XrGraphicsBindingOpenGLXcbKHR, XR_TYPE_GRAPHICS_BINDING_OPENGL_XCB_KHR) \ + + +#else +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL_XR_USE_PLATFORM_XCB(_) +#endif + +#if defined(XR_USE_GRAPHICS_API_OPENGL) && defined(XR_USE_PLATFORM_XLIB) +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL_XR_USE_PLATFORM_XLIB(_) \ + _(XrGraphicsBindingOpenGLXlibKHR, XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR) \ + + +#else +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL_XR_USE_PLATFORM_XLIB(_) +#endif + +#if defined(XR_USE_GRAPHICS_API_OPENGL_ES) +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL_ES(_) \ + _(XrSwapchainImageOpenGLESKHR, XR_TYPE_SWAPCHAIN_IMAGE_OPENGL_ES_KHR) \ + _(XrGraphicsRequirementsOpenGLESKHR, XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_ES_KHR) \ + + +#else +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL_ES(_) +#endif + +#if defined(XR_USE_GRAPHICS_API_OPENGL_ES) && defined(XR_USE_PLATFORM_ANDROID) +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL_ES_XR_USE_PLATFORM_ANDROID(_) \ + _(XrGraphicsBindingOpenGLESAndroidKHR, XR_TYPE_GRAPHICS_BINDING_OPENGL_ES_ANDROID_KHR) \ + + +#else +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL_ES_XR_USE_PLATFORM_ANDROID(_) +#endif + +#if defined(XR_USE_GRAPHICS_API_VULKAN) +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_VULKAN(_) \ + _(XrVulkanSwapchainFormatListCreateInfoKHR, XR_TYPE_VULKAN_SWAPCHAIN_FORMAT_LIST_CREATE_INFO_KHR) \ + _(XrGraphicsBindingVulkanKHR, XR_TYPE_GRAPHICS_BINDING_VULKAN_KHR) \ + _(XrSwapchainImageVulkanKHR, XR_TYPE_SWAPCHAIN_IMAGE_VULKAN_KHR) \ + _(XrGraphicsRequirementsVulkanKHR, XR_TYPE_GRAPHICS_REQUIREMENTS_VULKAN_KHR) \ + _(XrVulkanInstanceCreateInfoKHR, XR_TYPE_VULKAN_INSTANCE_CREATE_INFO_KHR) \ + _(XrVulkanDeviceCreateInfoKHR, XR_TYPE_VULKAN_DEVICE_CREATE_INFO_KHR) \ + _(XrVulkanGraphicsDeviceGetInfoKHR, XR_TYPE_VULKAN_GRAPHICS_DEVICE_GET_INFO_KHR) \ + + +#else +#define XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_VULKAN(_) +#endif + +#if defined(XR_USE_PLATFORM_ANDROID) +#define XR_LIST_STRUCTURE_TYPES_XR_USE_PLATFORM_ANDROID(_) \ + _(XrInstanceCreateInfoAndroidKHR, XR_TYPE_INSTANCE_CREATE_INFO_ANDROID_KHR) \ + _(XrLoaderInitInfoAndroidKHR, XR_TYPE_LOADER_INIT_INFO_ANDROID_KHR) \ + _(XrAndroidSurfaceSwapchainCreateInfoFB, XR_TYPE_ANDROID_SURFACE_SWAPCHAIN_CREATE_INFO_FB) \ + + +#else +#define XR_LIST_STRUCTURE_TYPES_XR_USE_PLATFORM_ANDROID(_) +#endif + +#if defined(XR_USE_PLATFORM_EGL) +#define XR_LIST_STRUCTURE_TYPES_XR_USE_PLATFORM_EGL(_) \ + _(XrGraphicsBindingEGLMNDX, XR_TYPE_GRAPHICS_BINDING_EGL_MNDX) \ + + +#else +#define XR_LIST_STRUCTURE_TYPES_XR_USE_PLATFORM_EGL(_) +#endif + +#if defined(XR_USE_PLATFORM_WIN32) +#define XR_LIST_STRUCTURE_TYPES_XR_USE_PLATFORM_WIN32(_) \ + _(XrHolographicWindowAttachmentMSFT, XR_TYPE_HOLOGRAPHIC_WINDOW_ATTACHMENT_MSFT) \ + + +#else +#define XR_LIST_STRUCTURE_TYPES_XR_USE_PLATFORM_WIN32(_) +#endif + +#define XR_LIST_STRUCTURE_TYPES(_) \ + XR_LIST_STRUCTURE_TYPES_CORE(_) \ + XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_D3D11(_) \ + XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_D3D12(_) \ + XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL(_) \ + XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL_XR_USE_PLATFORM_WAYLAND(_) \ + XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL_XR_USE_PLATFORM_WIN32(_) \ + XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL_XR_USE_PLATFORM_XCB(_) \ + XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL_XR_USE_PLATFORM_XLIB(_) \ + XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL_ES(_) \ + XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_OPENGL_ES_XR_USE_PLATFORM_ANDROID(_) \ + XR_LIST_STRUCTURE_TYPES_XR_USE_GRAPHICS_API_VULKAN(_) \ + XR_LIST_STRUCTURE_TYPES_XR_USE_PLATFORM_ANDROID(_) \ + XR_LIST_STRUCTURE_TYPES_XR_USE_PLATFORM_EGL(_) \ + XR_LIST_STRUCTURE_TYPES_XR_USE_PLATFORM_WIN32(_) \ + + +#define XR_LIST_EXTENSIONS(_) \ + _(XR_KHR_android_thread_settings, 4) \ + _(XR_KHR_android_surface_swapchain, 5) \ + _(XR_KHR_composition_layer_cube, 7) \ + _(XR_KHR_android_create_instance, 9) \ + _(XR_KHR_composition_layer_depth, 11) \ + _(XR_KHR_vulkan_swapchain_format_list, 15) \ + _(XR_EXT_performance_settings, 16) \ + _(XR_EXT_thermal_query, 17) \ + _(XR_KHR_composition_layer_cylinder, 18) \ + _(XR_KHR_composition_layer_equirect, 19) \ + _(XR_EXT_debug_utils, 20) \ + _(XR_KHR_opengl_enable, 24) \ + _(XR_KHR_opengl_es_enable, 25) \ + _(XR_KHR_vulkan_enable, 26) \ + _(XR_KHR_D3D11_enable, 28) \ + _(XR_KHR_D3D12_enable, 29) \ + _(XR_EXT_eye_gaze_interaction, 31) \ + _(XR_KHR_visibility_mask, 32) \ + _(XR_EXTX_overlay, 34) \ + _(XR_KHR_composition_layer_color_scale_bias, 35) \ + _(XR_KHR_win32_convert_performance_counter_time, 36) \ + _(XR_KHR_convert_timespec_time, 37) \ + _(XR_VARJO_quad_views, 38) \ + _(XR_MSFT_unbounded_reference_space, 39) \ + _(XR_MSFT_spatial_anchor, 40) \ + _(XR_MND_headless, 43) \ + _(XR_OCULUS_android_session_state_enable, 45) \ + _(XR_EXT_view_configuration_depth_range, 47) \ + _(XR_EXT_conformance_automation, 48) \ + _(XR_MNDX_egl_enable, 49) \ + _(XR_MSFT_spatial_graph_bridge, 50) \ + _(XR_MSFT_hand_interaction, 51) \ + _(XR_EXT_hand_tracking, 52) \ + _(XR_MSFT_hand_tracking_mesh, 53) \ + _(XR_MSFT_secondary_view_configuration, 54) \ + _(XR_MSFT_first_person_observer, 55) \ + _(XR_MSFT_controller_model, 56) \ + _(XR_MSFT_perception_anchor_interop, 57) \ + _(XR_EXT_win32_appcontainer_compatible, 58) \ + _(XR_EPIC_view_configuration_fov, 60) \ + _(XR_MSFT_holographic_window_attachment, 64) \ + _(XR_HUAWEI_controller_interaction, 70) \ + _(XR_FB_android_surface_swapchain_create, 71) \ + _(XR_VALVE_analog_threshold, 80) \ + _(XR_KHR_loader_init, 89) \ + _(XR_KHR_loader_init_android, 90) \ + _(XR_KHR_vulkan_enable2, 91) \ + _(XR_KHR_composition_layer_equirect2, 92) \ + _(XR_EXT_samsung_odyssey_controller, 95) \ + _(XR_EXT_hp_mixed_reality_controller, 96) \ + _(XR_MND_swapchain_usage_input_attachment_bit, 97) \ + _(XR_FB_display_refresh_rate, 102) \ + _(XR_HTC_vive_cosmos_controller_interaction, 103) \ + _(XR_FB_color_space, 109) \ + _(XR_KHR_binding_modification, 121) \ + _(XR_VARJO_foveated_rendering, 122) \ + _(XR_VARJO_composition_layer_depth_test, 123) \ + _(XR_VARJO_environment_depth_estimation, 124) \ + + +#endif + diff --git a/Externals/OpenXR/native/x64/release/bin/openxr_loader.dll b/Externals/OpenXR/native/x64/release/bin/openxr_loader.dll new file mode 100644 index 000000000000..13752d833b9b Binary files /dev/null and b/Externals/OpenXR/native/x64/release/bin/openxr_loader.dll differ diff --git a/Externals/OpenXR/native/x64/release/lib/openxr_loader.lib b/Externals/OpenXR/native/x64/release/lib/openxr_loader.lib new file mode 100644 index 000000000000..14b4c20b9bbf Binary files /dev/null and b/Externals/OpenXR/native/x64/release/lib/openxr_loader.lib differ diff --git a/Externals/Qt b/Externals/Qt index a14e340be1ad..5ab31b5fdf1c 160000 --- a/Externals/Qt +++ b/Externals/Qt @@ -1 +1 @@ -Subproject commit a14e340be1ad66e0cb1d8180485896a9134800e0 +Subproject commit 5ab31b5fdf1cdc59b9e8c82a0f7c12d5fe878cd8 diff --git a/Externals/SFML/build/vc2010/SFML_Network.vcxproj b/Externals/SFML/build/vc2010/SFML_Network.vcxproj index dedb7a7153bb..e5d944b7148f 100644 --- a/Externals/SFML/build/vc2010/SFML_Network.vcxproj +++ b/Externals/SFML/build/vc2010/SFML_Network.vcxproj @@ -1,46 +1,18 @@  - - - - Debug - ARM64 - - - Debug - x64 - - - Release - ARM64 - - - Release - x64 - - + + + {93D73454-2512-424E-9CDA-4BB357FE13DD} - 10.0 - - StaticLibrary - v142 - Unicode - - - true - - - false - + - - + - - + + diff --git a/Externals/bzip2/bzip2.vcxproj b/Externals/bzip2/bzip2.vcxproj index 5d123f4edd31..cd3c043b2d41 100644 --- a/Externals/bzip2/bzip2.vcxproj +++ b/Externals/bzip2/bzip2.vcxproj @@ -1,48 +1,18 @@ - - - - Debug - ARM64 - - - Debug - x64 - - - Release - ARM64 - - - Release - x64 - - + + + - 16.0 {1D8C51D2-FFA4-418E-B183-9F42B6A6717E} - bzip2 - 10.0 - - StaticLibrary - v142 - Unicode - - - true - - - false - + - - + - - + + diff --git a/Externals/cpp-optparse/cpp-optparse.vcxproj b/Externals/cpp-optparse/cpp-optparse.vcxproj index 2398db0a8242..7c7d89099a2e 100644 --- a/Externals/cpp-optparse/cpp-optparse.vcxproj +++ b/Externals/cpp-optparse/cpp-optparse.vcxproj @@ -1,46 +1,18 @@  - - - - Debug - ARM64 - - - Debug - x64 - - - Release - ARM64 - - - Release - x64 - - + + + {C636D9D1-82FE-42B5-9987-63B7D4836341} - 10.0 - - StaticLibrary - v142 - Unicode - - - true - - - false - + - - + - - + + diff --git a/Externals/cubeb/msvc/cubeb.vcxproj b/Externals/cubeb/msvc/cubeb.vcxproj index 2875d8ea198a..cc2a52cea136 100644 --- a/Externals/cubeb/msvc/cubeb.vcxproj +++ b/Externals/cubeb/msvc/cubeb.vcxproj @@ -1,45 +1,20 @@  - - - - Debug - ARM64 - - - Debug - x64 - - - Release - ARM64 - - - Release - x64 - - + + + {8EA11166-6512-44FC-B7A5-A4D1ECC81170} - 10.0 - - StaticLibrary - v142 - Unicode - - - true - - - false - + + - - + + + ..\include;..\src;..\msvc;%(AdditionalIncludeDirectories) diff --git a/Externals/curl/curl.vcxproj b/Externals/curl/curl.vcxproj index d22b7b5ae310..9f74333f734f 100644 --- a/Externals/curl/curl.vcxproj +++ b/Externals/curl/curl.vcxproj @@ -1,23 +1,26 @@  - - - - Debug - ARM64 - - - Debug - x64 - - - Release - ARM64 - - - Release - x64 - - + + + + + {BB00605C-125F-4A21-B33B-7BF418322DCB} + + + + + + + + + + + + + + $(ExternalsDir)curl\lib;%(AdditionalIncludeDirectories) + CURL_STATICLIB;CURL_DISABLE_LDAP;USE_WINDOWS_SSPI;USE_SCHANNEL;%(PreprocessorDefinitions) + + true @@ -357,43 +360,6 @@ - - - {ff213b23-2c26-4214-9f88-85271e557e87} - - - - {BB00605C-125F-4A21-B33B-7BF418322DCB} - 10.0 - - - - StaticLibrary - v142 - Unicode - - - true - - - false - - - - - - - - - - - - - - $(ExternalsDir)curl\lib;%(AdditionalIncludeDirectories) - CURL_STATICLIB;CURL_DISABLE_LDAP;USE_WINDOWS_SSPI;USE_SCHANNEL;%(PreprocessorDefinitions) - - diff --git a/Externals/curl/lib/CMakeLists.txt b/Externals/curl/lib/CMakeLists.txt index 00b6a7c2cc42..a4be4013ef01 100644 --- a/Externals/curl/lib/CMakeLists.txt +++ b/Externals/curl/lib/CMakeLists.txt @@ -1,5 +1,7 @@ -if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows") - add_definitions(-DHAVE_CONFIG_H) +if(CMAKE_SYSTEM_NAME MATCHES "Windows") + add_definitions(-DUSE_SCHANNEL -DUSE_WINDOWS_SSPI) +else() + add_definitions(-DHAVE_CONFIG_H) endif() include_directories(.) @@ -11,5 +13,5 @@ add_library( ${SRCS} ) -target_link_libraries(curl ${MBEDTLS_LIBRARIES}) +target_link_libraries(curl ${MBEDTLS_LIBRARIES} z) target_compile_definitions(curl PUBLIC CURL_STATICLIB PRIVATE CURL_DISABLE_LDAP) diff --git a/Externals/discord-rpc/src/discord-rpc.vcxproj b/Externals/discord-rpc/src/discord-rpc.vcxproj index 18eaf56887a1..41c1cc2d041e 100644 --- a/Externals/discord-rpc/src/discord-rpc.vcxproj +++ b/Externals/discord-rpc/src/discord-rpc.vcxproj @@ -1,85 +1,28 @@  - - - - Debug - ARM64 - - - Debug - x64 - - - Release - ARM64 - - - Release - x64 - - + + + {4482FD2A-EC43-3FFB-AC20-2E5C54B05EAD} - 10.0 - Win32Proj - x64 - discord-rpc - - StaticLibrary - v142 - Unicode - + - - + - - + + - - <_ProjectFileVersion>10.0.20506.1 - - + ..\include;..\thirdparty\include;%(AdditionalIncludeDirectories) - WIN32;_WINDOWS;_DEBUG;DISCORD_WINDOWS;%(PreprocessorDefinitions) + WIN32;_WINDOWS;DISCORD_WINDOWS;%(PreprocessorDefinitions) ..\include;..\thirdparty\rapidjson-1.1.0\include;%(AdditionalIncludeDirectories) - - ..\include;..\thirdparty\rapidjson-1.1.0\include;%(AdditionalIncludeDirectories) - $(ProjectDir)/$(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - - - - ..\include;..\thirdparty\include;%(AdditionalIncludeDirectories) - - - - - WIN32;_WINDOWS;NDEBUG;DISCORD_WINDOWS;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions) - ..\include;..\thirdparty\rapidjson-1.1.0\include;%(AdditionalIncludeDirectories) - - - ..\include;..\thirdparty\rapidjson-1.1.0\include;%(AdditionalIncludeDirectories) - $(ProjectDir)/$(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - diff --git a/Externals/ed25519/ed25519.vcxproj b/Externals/ed25519/ed25519.vcxproj index 23aadafabed6..2aa00291d7a4 100644 --- a/Externals/ed25519/ed25519.vcxproj +++ b/Externals/ed25519/ed25519.vcxproj @@ -1,23 +1,20 @@  - - - - Debug - ARM64 - - - Debug - x64 - - - Release - ARM64 - - - Release - x64 - - + + + + + {5BDF4B91-1491-4FB0-BC27-78E9A8E97DC3} + + + + + + + + + + + @@ -39,31 +36,6 @@ - - {5BDF4B91-1491-4FB0-BC27-78E9A8E97DC3} - 10.0 - - - - StaticLibrary - v142 - Unicode - - - true - - - false - - - - - - - - - - diff --git a/Externals/enet/CMakeLists.txt b/Externals/enet/CMakeLists.txt index 24f039651593..f364ff7f5b2c 100644 --- a/Externals/enet/CMakeLists.txt +++ b/Externals/enet/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8.12) project(enet) diff --git a/Externals/enet/enet.vcxproj b/Externals/enet/enet.vcxproj index 087b5a5e4410..75e3b4a7f6db 100644 --- a/Externals/enet/enet.vcxproj +++ b/Externals/enet/enet.vcxproj @@ -1,23 +1,20 @@  - - - - Debug - ARM64 - - - Debug - x64 - - - Release - ARM64 - - - Release - x64 - - + + + + + {CBC76802-C128-4B17-BF6C-23B08C313E5E} + + + + + + + + + + + @@ -47,32 +44,6 @@ - - {CBC76802-C128-4B17-BF6C-23B08C313E5E} - 10.0 - - - - StaticLibrary - v142 - Unicode - - - true - - - false - - - - - - - - - - - diff --git a/Externals/fmt/.gitignore b/Externals/fmt/.gitignore deleted file mode 100755 index 694f8f8f2bf3..000000000000 --- a/Externals/fmt/.gitignore +++ /dev/null @@ -1,34 +0,0 @@ -.vscode/ - -*.iml -.idea/ -.externalNativeBuild/ -.gradle/ -gradle/ -gradlew* -local.properties -build/ - -bin/ -/_CPack_Packages -/CMakeScripts -/doc/doxyxml -/doc/html -virtualenv -/Testing -/install_manifest.txt -*~ -*.a -*.so* -*.xcodeproj -*.zip -cmake_install.cmake -CPack*.cmake -fmt-*.cmake -CTestTestfile.cmake -CMakeCache.txt -CMakeFiles -FMT.build -Makefile -run-msbuild.bat -fmt.pc diff --git a/Externals/fmt/CMakeLists.txt b/Externals/fmt/CMakeLists.txt index 3b6b79ef9b9c..f21cf4561ee5 100755 --- a/Externals/fmt/CMakeLists.txt +++ b/Externals/fmt/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1.0) +cmake_minimum_required(VERSION 3.1...3.18) -# Use newer policies if available, up to most recent tested version of CMake. -if(${CMAKE_VERSION} VERSION_LESS 3.11) +# Fallback for using newer policies on CMake <3.12. +if(${CMAKE_VERSION} VERSION_LESS 3.12) cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) -else() - cmake_policy(VERSION 3.11) endif() # Determine if fmt is built as a subproject (using add_subdirectory) @@ -24,15 +22,40 @@ function(join result_var) set(${result_var} "${result}" PARENT_SCOPE) endfunction() +include(CMakeParseArguments) + +# Sets a cache variable with a docstring joined from multiple arguments: +# set( ... CACHE ...) +# This allows splitting a long docstring for readability. +function(set_verbose) + # cmake_parse_arguments is broken in CMake 3.4 (cannot parse CACHE) so use + # list instead. + list(GET ARGN 0 var) + list(REMOVE_AT ARGN 0) + list(GET ARGN 0 val) + list(REMOVE_AT ARGN 0) + list(REMOVE_AT ARGN 0) + list(GET ARGN 0 type) + list(REMOVE_AT ARGN 0) + join(doc ${ARGN}) + set(${var} ${val} CACHE ${type} ${doc}) +endfunction() + # Set the default CMAKE_BUILD_TYPE to Release. # This should be done before the project command since the latter can set # CMAKE_BUILD_TYPE itself (it does so for nmake). if (MASTER_PROJECT AND NOT CMAKE_BUILD_TYPE) - join(doc "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or " - "CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.") - set(CMAKE_BUILD_TYPE Release CACHE STRING ${doc}) + set_verbose(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or " + "CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.") endif () +project(FMT CXX) +include(GNUInstallDirs) +set_verbose(FMT_INC_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE STRING + "Installation directory for include files, a relative path that " + "will be joined with ${CMAKE_INSTALL_PREFIX} or an absolute path.") + option(FMT_PEDANTIC "Enable extra warnings and expensive tests." OFF) option(FMT_WERROR "Halt the compilation with an error on compiler warnings." OFF) @@ -43,8 +66,7 @@ option(FMT_INSTALL "Generate the install target." ${MASTER_PROJECT}) option(FMT_TEST "Generate the test target." ${MASTER_PROJECT}) option(FMT_FUZZ "Generate the fuzz target." OFF) option(FMT_CUDA_TEST "Generate the cuda-test target." OFF) - -project(FMT CXX) +option(FMT_OS "Include core requiring OS (Windows/Posix) " ON) # Get version from core.h file(READ include/fmt/core.h core_h) @@ -61,26 +83,35 @@ message(STATUS "Version: ${FMT_VERSION}") message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +endif () set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/support/cmake") include(cxx14) include(CheckCXXCompilerFlag) +include(JoinPaths) -set(FMT_REQUIRED_FEATURES cxx_auto_type cxx_variadic_templates) +list(FIND CMAKE_CXX_COMPILE_FEATURES "cxx_variadic_templates" index) +if (${index} GREATER -1) + # Use cxx_variadic_templates instead of more appropriate cxx_std_11 for + # compatibility with older CMake versions. + set(FMT_REQUIRED_FEATURES cxx_variadic_templates) +endif () +message(STATUS "Required features: ${FMT_REQUIRED_FEATURES}") if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") set(PEDANTIC_COMPILE_FLAGS -pedantic-errors -Wall -Wextra -pedantic -Wold-style-cast -Wundef -Wredundant-decls -Wwrite-strings -Wpointer-arith -Wcast-qual -Wformat=2 -Wmissing-include-dirs - -Wcast-align -Wnon-virtual-dtor + -Wcast-align -Wctor-dtor-privacy -Wdisabled-optimization -Winvalid-pch -Woverloaded-virtual - -Wconversion -Wswitch-enum - -Wno-ctor-dtor-privacy -Wno-format-nonliteral -Wno-shadow) + -Wconversion -Wswitch-enum -Wundef + -Wno-ctor-dtor-privacy -Wno-format-nonliteral) if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6) set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wnoexcept -Wno-dangling-else -Wno-unused-local-typedefs) @@ -98,8 +129,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") endif () if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -pedantic -Wconversion - -Wno-sign-conversion -Wdeprecated -Wweak-vtables) + set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -pedantic -Wconversion -Wundef + -Wdeprecated -Wweak-vtables) check_cxx_compiler_flag(-Wzero-as-null-pointer-constant HAS_NULLPTR_WARNING) if (HAS_NULLPTR_WARNING) set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} @@ -123,7 +154,9 @@ if (MASTER_PROJECT AND CMAKE_GENERATOR MATCHES "Visual Studio") set(MSBUILD_SETUP "call \"${WINSDK_SETENV}\"") endif () # Set FrameworkPathOverride to get rid of MSB3644 warnings. - set(netfxpath "C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0") + join(netfxpath + "C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\" + ".NETFramework\\v4.0") file(WRITE run-msbuild.bat " ${MSBUILD_SETUP} ${CMAKE_MAKE_PROGRAM} -p:FrameworkPathOverride=\"${netfxpath}\" %*") @@ -151,8 +184,12 @@ endfunction() # Define the fmt library, its includes and the needed defines. add_headers(FMT_HEADERS chrono.h color.h compile.h core.h format.h format-inl.h - locale.h ostream.h posix.h printf.h ranges.h) -set(FMT_SOURCES src/format.cc src/posix.cc) + locale.h os.h ostream.h posix.h printf.h ranges.h) +if (FMT_OS) + set(FMT_SOURCES src/format.cc src/os.cc) +else() + set(FMT_SOURCES src/format.cc) +endif () add_library(fmt ${FMT_SOURCES} ${FMT_HEADERS} README.rst ChangeLog.rst) add_library(fmt::fmt ALIAS fmt) @@ -161,6 +198,13 @@ if (HAVE_STRTOD_L) target_compile_definitions(fmt PUBLIC FMT_LOCALE) endif () +if (MINGW) + check_cxx_compiler_flag("Wa,-mbig-obj" FMT_HAS_MBIG_OBJ) + if (${FMT_HAS_MBIG_OBJ}) + target_compile_options(fmt PUBLIC "-Wa,-mbig-obj") + endif() +endif () + if (FMT_WERROR) target_compile_options(fmt PRIVATE ${WERROR_FLAG}) endif () @@ -172,14 +216,24 @@ target_compile_features(fmt INTERFACE ${FMT_REQUIRED_FEATURES}) target_include_directories(fmt PUBLIC $ - $) + $) + +set(FMT_DEBUG_POSTFIX d CACHE STRING "Debug library postfix.") set_target_properties(fmt PROPERTIES VERSION ${FMT_VERSION} SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR} - DEBUG_POSTFIX d) + DEBUG_POSTFIX "${FMT_DEBUG_POSTFIX}") + +# Set FMT_LIB_NAME for pkg-config fmt.pc. We cannot use the OUTPUT_NAME target +# property because it's not set by default. +set(FMT_LIB_NAME fmt) +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + set(FMT_LIB_NAME ${FMT_LIB_NAME}${FMT_DEBUG_POSTFIX}) +endif () if (BUILD_SHARED_LIBS) - if (UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") + if (UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" AND + NOT EMSCRIPTEN) # Fix rpmlint warning: # unused-direct-shlib-dependency /usr/lib/libformat.so.1.1.0 /lib/libm.so.6. target_link_libraries(fmt -Wl,--as-needed) @@ -194,43 +248,42 @@ add_library(fmt-header-only INTERFACE) add_library(fmt::fmt-header-only ALIAS fmt-header-only) target_compile_definitions(fmt-header-only INTERFACE FMT_HEADER_ONLY=1) - target_compile_features(fmt-header-only INTERFACE ${FMT_REQUIRED_FEATURES}) target_include_directories(fmt-header-only INTERFACE $ - $) + $) # Install targets. if (FMT_INSTALL) - include(GNUInstallDirs) include(CMakePackageConfigHelpers) - set(FMT_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/fmt CACHE STRING - "Installation directory for cmake files, relative to ${CMAKE_INSTALL_PREFIX}.") + set_verbose(FMT_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/fmt CACHE STRING + "Installation directory for cmake files, a relative path that " + "will be joined with ${CMAKE_INSTALL_PREFIX} or an absolute " + "path.") set(version_config ${PROJECT_BINARY_DIR}/fmt-config-version.cmake) set(project_config ${PROJECT_BINARY_DIR}/fmt-config.cmake) set(pkgconfig ${PROJECT_BINARY_DIR}/fmt.pc) set(targets_export_name fmt-targets) - set (INSTALL_TARGETS fmt) - if (TARGET fmt-header-only) - set(INSTALL_TARGETS ${INSTALL_TARGETS} fmt-header-only) - endif () - - set(FMT_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING - "Installation directory for libraries, relative to ${CMAKE_INSTALL_PREFIX}.") - - set(FMT_INC_DIR ${CMAKE_INSTALL_INCLUDEDIR}/fmt CACHE STRING - "Installation directory for include files, relative to ${CMAKE_INSTALL_PREFIX}.") + set_verbose(FMT_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING + "Installation directory for libraries, a relative path that " + "will be joined to ${CMAKE_INSTALL_PREFIX} or an absolute path.") - set(FMT_PKGCONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig CACHE PATH - "Installation directory for pkgconfig (.pc) files, relative to ${CMAKE_INSTALL_PREFIX}.") + set_verbose(FMT_PKGCONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig CACHE PATH + "Installation directory for pkgconfig (.pc) files, a relative " + "path that will be joined with ${CMAKE_INSTALL_PREFIX} or an " + "absolute path.") # Generate the version, config and target files into the build directory. write_basic_package_version_file( ${version_config} VERSION ${FMT_VERSION} COMPATIBILITY AnyNewerVersion) + + join_paths(libdir_for_pc_file "\${exec_prefix}" "${FMT_LIB_DIR}") + join_paths(includedir_for_pc_file "\${prefix}" "${FMT_INC_DIR}") + configure_file( "${PROJECT_SOURCE_DIR}/support/cmake/fmt.pc.in" "${pkgconfig}" @@ -239,6 +292,8 @@ if (FMT_INSTALL) ${PROJECT_SOURCE_DIR}/support/cmake/fmt-config.cmake.in ${project_config} INSTALL_DESTINATION ${FMT_CMAKE_DIR}) + + set(INSTALL_TARGETS fmt fmt-header-only) # Use a namespace because CMake provides better diagnostics for namespaced # imported targets. export(TARGETS ${INSTALL_TARGETS} NAMESPACE fmt:: @@ -259,7 +314,7 @@ if (FMT_INSTALL) install(FILES $ DESTINATION ${FMT_LIB_DIR} OPTIONAL) - install(FILES ${FMT_HEADERS} DESTINATION ${FMT_INC_DIR}) + install(FILES ${FMT_HEADERS} DESTINATION "${FMT_INC_DIR}/fmt") install(FILES "${pkgconfig}" DESTINATION "${FMT_PKGCONFIG_DIR}") endif () @@ -275,13 +330,20 @@ endif () # Control fuzzing independent of the unit tests. if (FMT_FUZZ) add_subdirectory(test/fuzzing) + + # The FMT_FUZZ macro is used to prevent resource exhaustion in fuzzing + # mode and make fuzzing practically possible. It is similar to + # FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION but uses a different name to + # avoid interfering with fuzzing of projects that use {fmt}. + # See also https://llvm.org/docs/LibFuzzer.html#fuzzer-friendly-build-mode. + target_compile_definitions(fmt PUBLIC FMT_FUZZ) endif () set(gitignore ${PROJECT_SOURCE_DIR}/.gitignore) if (MASTER_PROJECT AND EXISTS ${gitignore}) # Get the list of ignored files from .gitignore. file (STRINGS ${gitignore} lines) - LIST(REMOVE_ITEM lines /doc/html) + list(REMOVE_ITEM lines /doc/html) foreach (line ${lines}) string(REPLACE "." "[.]" line "${line}") string(REPLACE "*" ".*" line "${line}") diff --git a/Externals/fmt/CONTRIBUTING.md b/Externals/fmt/CONTRIBUTING.md index 3532bd11e4bd..b82f145069a8 100644 --- a/Externals/fmt/CONTRIBUTING.md +++ b/Externals/fmt/CONTRIBUTING.md @@ -14,4 +14,7 @@ exceptions: * snake_case should be used instead of UpperCamelCase for function and type names +All documentation must adhere to the [Google Developer Documentation Style +Guide](https://developers.google.com/style). + Thanks for contributing! diff --git a/Externals/fmt/ChangeLog.rst b/Externals/fmt/ChangeLog.rst index 75a009e4c653..f9a2d8ebbec0 100755 --- a/Externals/fmt/ChangeLog.rst +++ b/Externals/fmt/ChangeLog.rst @@ -1,3 +1,941 @@ +7.1.0 - 2020-10-25 +------------------ + +* Switched from `Grisu3 + `_ + to `Dragonbox `_ for the default + floating-point formatting which gives the shortest decimal representation + with round-trip guarantee and correct rounding + (`#1882 `_, + `#1887 `_, + `#1894 `_). This makes {fmt} up to + 20-30x faster than common implementations of ``std::ostringstream`` and + ``sprintf`` on `dtoa-benchmark `_ + and faster than double-conversion and Ryū: + + .. image:: https://user-images.githubusercontent.com/576385/ + 95684665-11719600-0ba8-11eb-8e5b-972ff4e49428.png + + It is possible to get even better performance at the cost of larger binary + size by compiling with the ``FMT_USE_FULL_CACHE_DRAGONBOX`` macro set to 1. + + Thanks `@jk-jeon (Junekey Jeon) `_. + +* Added an experimental unsynchronized file output API which, together with + `format string compilation `_, + can give `5-9 times speed up compared to fprintf + `_ + on common platforms (`godbolt `__): + + .. code:: c++ + + #include + + int main() { + auto f = fmt::output_file("guide"); + f.print("The answer is {}.", 42); + } + +* Added a formatter for ``std::chrono::time_point`` + (`#1819 `_, + `#1837 `_). For example + (`godbolt `__): + + .. code:: c++ + + #include + + int main() { + auto now = std::chrono::system_clock::now(); + fmt::print("The time is {:%H:%M:%S}.\n", now); + } + + Thanks `@adamburgess (Adam Burgess) `_. + +* Added support for ranges with non-const ``begin``/``end`` to ``fmt::join`` + (`#1784 `_, + `#1786 `_). For example + (`godbolt `__): + + .. code:: c++ + + #include + #include + + int main() { + using std::literals::string_literals::operator""s; + auto strs = std::array{"a"s, "bb"s, "ccc"s}; + auto range = strs | ranges::views::filter( + [] (const std::string &x) { return x.size() != 2; } + ); + fmt::print("{}\n", fmt::join(range, "")); + } + + prints "accc". + + Thanks `@tonyelewis (Tony E Lewis) `_. + +* Added a ``memory_buffer::append`` overload that takes a range + (`#1806 `_). + Thanks `@BRevzin (Barry Revzin) `_. + +* Improved handling of single code units in ``FMT_COMPILE``. For example: + + .. code:: c++ + + #include + + char* f(char* buf) { + return fmt::format_to(buf, FMT_COMPILE("x{}"), 42); + } + + compiles to just (`godbolt `__): + + .. code:: asm + + _Z1fPc: + movb $120, (%rdi) + xorl %edx, %edx + cmpl $42, _ZN3fmt2v76detail10basic_dataIvE23zero_or_powers_of_10_32E+8(%rip) + movl $3, %eax + seta %dl + subl %edx, %eax + movzwl _ZN3fmt2v76detail10basic_dataIvE6digitsE+84(%rip), %edx + cltq + addq %rdi, %rax + movw %dx, -2(%rax) + ret + + Here a single ``mov`` instruction writes ``'x'`` (``$120``) to the output + buffer. + +* Added dynamic width support to format string compilation + (`#1809 `_). + +* Improved error reporting for unformattable types: now you'll get the type name + directly in the error message instead of the note: + + .. code:: c++ + + #include + + struct how_about_no {}; + + int main() { + fmt::print("{}", how_about_no()); + } + + Error (`godbolt `__): + + ``fmt/core.h:1438:3: error: static_assert failed due to requirement + 'fmt::v7::formattable()' "Cannot format an argument. + To make type T formattable provide a formatter specialization: + https://fmt.dev/latest/api.html#udt" + ...`` + +* Added the `make_args_checked `_ + function template that allows you to write formatting functions with + compile-time format string checks and avoid binary code bloat + (`godbolt `__): + + .. code:: c++ + + void vlog(const char* file, int line, fmt::string_view format, + fmt::format_args args) { + fmt::print("{}: {}: ", file, line); + fmt::vprint(format, args); + } + + template + void log(const char* file, int line, const S& format, Args&&... args) { + vlog(file, line, format, + fmt::make_args_checked(format, args...)); + } + + #define MY_LOG(format, ...) \ + log(__FILE__, __LINE__, FMT_STRING(format), __VA_ARGS__) + + MY_LOG("invalid squishiness: {}", 42); + +* Replaced ``snprintf`` fallback with a faster internal IEEE 754 ``float`` and + ``double`` formatter for arbitrary precision. For example + (`godbolt `__): + + .. code:: c++ + + #include + + int main() { + fmt::print("{:.500}\n", 4.9406564584124654E-324); + } + + prints + + ``4.9406564584124654417656879286822137236505980261432476442558568250067550727020875186529983636163599237979656469544571773092665671035593979639877479601078187812630071319031140452784581716784898210368871863605699873072305000638740915356498438731247339727316961514003171538539807412623856559117102665855668676818703956031062493194527159149245532930545654440112748012970999954193198940908041656332452475714786901472678015935523861155013480352649347201937902681071074917033322268447533357208324319360923829e-324``. + +* Made ``format_to_n`` and ``formatted_size`` part of the `core API + `__ + (`godbolt `__): + + .. code:: c++ + + #include + + int main() { + char buffer[10]; + auto result = fmt::format_to_n(buffer, sizeof(buffer), "{}", 42); + } + +* Added ``fmt::format_to_n`` overload with format string compilation + (`#1764 `_, + `#1767 `_, + `#1869 `_). For example + (`godbolt `__): + + .. code:: c++ + + #include + + int main() { + char buffer[8]; + fmt::format_to_n(buffer, sizeof(buffer), FMT_COMPILE("{}"), 42); + } + + Thanks `@Kurkin (Dmitry Kurkin) `_, + `@alexezeder (Alexey Ochapov) `_. + +* Added ``fmt::format_to`` overload that take ``text_style`` + (`#1593 `_, + `#1842 `_, + `#1843 `_). For example + (`godbolt `__): + + .. code:: c++ + + #include + + int main() { + std::string out; + fmt::format_to(std::back_inserter(out), + fmt::emphasis::bold | fg(fmt::color::red), + "The answer is {}.", 42); + } + + Thanks `@Naios (Denis Blank) `_. + +* Made the ``#`` specifier emit trailing zeros in addition to the decimal point + (`#1797 `_). For example + (`godbolt `__): + + .. code:: c++ + + #include + + int main() { + fmt::print("{:#.2g}", 0.5); + } + + prints ``0.50``. + +* Changed the default floating point format to not include ``.0`` for + consistency with ``std::format`` and ``std::to_chars`` + (`#1893 `_, + `#1943 `_). It is possible to get + the decimal point and trailing zero with the ``#`` specifier. + +* Fixed an issue with floating-point formatting that could result in addition of + a non-significant trailing zero in rare cases e.g. ``1.00e-34`` instead of + ``1.0e-34`` (`#1873 `_, + `#1917 `_). + +* Made ``fmt::to_string`` fallback on ``ostream`` insertion operator if + the ``formatter`` specialization is not provided + (`#1815 `_, + `#1829 `_). + Thanks `@alexezeder (Alexey Ochapov) `_. + +* Added support for the append mode to the experimental file API and + improved ``fcntl.h`` detection. + (`#1847 `_, + `#1848 `_). + Thanks `@t-wiser `_. + +* Fixed handling of types that have both an implicit conversion operator and + an overloaded ``ostream`` insertion operator + (`#1766 `_). + +* Fixed a slicing issue in an internal iterator type + (`#1822 `_). + Thanks `@BRevzin (Barry Revzin) `_. + +* Fixed an issue in locale-specific integer formatting + (`#1927 `_). + +* Fixed handling of exotic code unit types + (`#1870 `_, + `#1932 `_). + +* Improved ``FMT_ALWAYS_INLINE`` + (`#1878 `_). + Thanks `@jk-jeon (Junekey Jeon) `_. + +* Removed dependency on ``windows.h`` + (`#1900 `_). + Thanks `@bernd5 (Bernd Baumanns) `_. + +* Optimized counting of decimal digits on MSVC + (`#1890 `_). + Thanks `@mwinterb `_. + +* Improved documentation + (`#1772 `_, + `#1775 `_, + `#1792 `_, + `#1838 `_, + `#1888 `_, + `#1918 `_, + `#1939 `_). + Thanks `@leolchat (Léonard Gérard) `_, + `@pepsiman (Malcolm Parsons) `_, + `@Klaim (Joël Lamotte) `_, + `@ravijanjam (Ravi J) `_, + `@francesco-st `_, + `@udnaan (Adnan) `_. + +* Added the ``FMT_REDUCE_INT_INSTANTIATIONS`` CMake option that reduces the + binary code size at the cost of some integer formatting performance. This can + be useful for extremely memory-constrained embedded systems + (`#1778 `_, + `#1781 `_). + Thanks `@kammce (Khalil Estell) `_. + +* Added the ``FMT_USE_INLINE_NAMESPACES`` macro to control usage of inline + namespaces (`#1945 `_). + Thanks `@darklukee `_. + +* Improved build configuration + (`#1760 `_, + `#1770 `_, + `#1779 `_, + `#1783 `_, + `#1823 `_). + Thanks `@dvetutnev (Dmitriy Vetutnev) `_, + `@xvitaly (Vitaly Zaitsev) `_, + `@tambry (Raul Tambre) `_, + `@medithe `_, + `@martinwuehrer (Martin Wührer) `_. + +* Fixed various warnings and compilation issues + (`#1790 `_, + `#1802 `_, + `#1808 `_, + `#1810 `_, + `#1811 `_, + `#1812 `_, + `#1814 `_, + `#1816 `_, + `#1817 `_, + `#1818 `_, + `#1825 `_, + `#1836 `_, + `#1855 `_, + `#1856 `_, + `#1860 `_, + `#1877 `_, + `#1879 `_, + `#1880 `_, + `#1896 `_, + `#1897 `_, + `#1898 `_, + `#1904 `_, + `#1908 `_, + `#1911 `_, + `#1912 `_, + `#1928 `_, + `#1929 `_, + `#1935 `_ + `#1937 `_, + `#1942 `_, + `#1949 `_). + Thanks `@TheQwertiest `_, + `@medithe `_, + `@martinwuehrer (Martin Wührer) `_, + `@n16h7hunt3r `_, + `@Othereum (Seokjin Lee) `_, + `@gsjaardema (Greg Sjaardema) `_, + `@AlexanderLanin (Alexander Lanin) `_, + `@gcerretani (Giovanni Cerretani) `_, + `@chronoxor (Ivan Shynkarenka) `_, + `@noizefloor (Jan Schwers) `_, + `@akohlmey (Axel Kohlmeyer) `_, + `@jk-jeon (Junekey Jeon) `_, + `@rimathia `_, + `@rglarix (Riccardo Ghetta (larix)) `_, + `@moiwi `_, + `@heckad (Kazantcev Andrey) `_, + `@MarcDirven `_. + `@BartSiwek (Bart Siwek) `_, + `@darklukee `_. + +7.0.3 - 2020-08-06 +------------------ + +* Worked around broken ``numeric_limits`` for 128-bit integers + (`#1787 `_). + +* Added error reporting on missing named arguments + (`#1796 `_). + +* Stopped using 128-bit integers with clang-cl + (`#1800 `_). + Thanks `@Kingcom `_. + +* Fixed issues in locale-specific integer formatting + (`#1782 `_, + `#1801 `_). + +7.0.2 - 2020-07-29 +------------------ + +* Worked around broken ``numeric_limits`` for 128-bit integers + (`#1725 `_). + +* Fixed compatibility with CMake 3.4 + (`#1779 `_). + +* Fixed handling of digit separators in locale-specific formatting + (`#1782 `_). + +7.0.1 - 2020-07-07 +------------------ + +* Updated the inline version namespace name. + +* Worked around a gcc bug in mangling of alias templates + (`#1753 `_). + +* Fixed a linkage error on Windows + (`#1757 `_). + Thanks `@Kurkin (Dmitry Kurkin) `_. + +* Fixed minor issues with the documentation. + +7.0.0 - 2020-07-05 +------------------ + +* Reduced the library size. For example, on macOS a stripped test binary + statically linked with {fmt} `shrank from ~368k to less than 100k + `_. + +* Added a simpler and more efficient `format string compilation API + `_: + + .. code:: c++ + + #include + + // Converts 42 into std::string using the most efficient method and no + // runtime format string processing. + std::string s = fmt::format(FMT_COMPILE("{}"), 42); + + The old ``fmt::compile`` API is now deprecated. + +* Optimized integer formatting: ``format_to`` with format string compilation + and a stack-allocated buffer is now `faster than to_chars on both + libc++ and libstdc++ + `_. + +* Optimized handling of small format strings. For example, + + .. code:: c++ + + fmt::format("Result: {}: ({},{},{},{})", str1, str2, str3, str4, str5) + + is now ~40% faster (`#1685 `_). + +* Applied extern templates to improve compile times when using the core API + and ``fmt/format.h`` (`#1452 `_). + For example, on macOS with clang the compile time of a test translation unit + dropped from 2.3s to 0.3s with ``-O2`` and from 0.6s to 0.3s with the default + settings (``-O0``). + + Before (``-O2``):: + + % time c++ -c test.cc -I include -std=c++17 -O2 + c++ -c test.cc -I include -std=c++17 -O2 2.22s user 0.08s system 99% cpu 2.311 total + + After (``-O2``):: + + % time c++ -c test.cc -I include -std=c++17 -O2 + c++ -c test.cc -I include -std=c++17 -O2 0.26s user 0.04s system 98% cpu 0.303 total + + Before (default):: + + % time c++ -c test.cc -I include -std=c++17 + c++ -c test.cc -I include -std=c++17 0.53s user 0.06s system 98% cpu 0.601 total + + After (default):: + + % time c++ -c test.cc -I include -std=c++17 + c++ -c test.cc -I include -std=c++17 0.24s user 0.06s system 98% cpu 0.301 total + + It is still recommended to use ``fmt/core.h`` instead of ``fmt/format.h`` but + the compile time difference is now smaller. Thanks + `@alex3d `_ for the suggestion. + +* Named arguments are now stored on stack (no dynamic memory allocations) and + the compiled code is more compact and efficient. For example + + .. code:: c++ + + #include + + int main() { + fmt::print("The answer is {answer}\n", fmt::arg("answer", 42)); + } + + compiles to just (`godbolt `__) + + .. code:: asm + + .LC0: + .string "answer" + .LC1: + .string "The answer is {answer}\n" + main: + sub rsp, 56 + mov edi, OFFSET FLAT:.LC1 + mov esi, 23 + movabs rdx, 4611686018427387905 + lea rax, [rsp+32] + lea rcx, [rsp+16] + mov QWORD PTR [rsp+8], 1 + mov QWORD PTR [rsp], rax + mov DWORD PTR [rsp+16], 42 + mov QWORD PTR [rsp+32], OFFSET FLAT:.LC0 + mov DWORD PTR [rsp+40], 0 + call fmt::v6::vprint(fmt::v6::basic_string_view, + fmt::v6::format_args) + xor eax, eax + add rsp, 56 + ret + + .L.str.1: + .asciz "answer" + +* Implemented compile-time checks for dynamic width and precision + (`#1614 `_): + + .. code:: c++ + + #include + + int main() { + fmt::print(FMT_STRING("{0:{1}}"), 42); + } + + now gives a compilation error because argument 1 doesn't exist:: + + In file included from test.cc:1: + include/fmt/format.h:2726:27: error: constexpr variable 'invalid_format' must be + initialized by a constant expression + FMT_CONSTEXPR_DECL bool invalid_format = + ^ + ... + include/fmt/core.h:569:26: note: in call to + '&checker(s, {}).context_->on_error(&"argument not found"[0])' + if (id >= num_args_) on_error("argument not found"); + ^ + +* Added sentinel support to ``fmt::join`` + (`#1689 `_) + + .. code:: c++ + + struct zstring_sentinel {}; + bool operator==(const char* p, zstring_sentinel) { return *p == '\0'; } + bool operator!=(const char* p, zstring_sentinel) { return *p != '\0'; } + + struct zstring { + const char* p; + const char* begin() const { return p; } + zstring_sentinel end() const { return {}; } + }; + + auto s = fmt::format("{}", fmt::join(zstring{"hello"}, "_")); + // s == "h_e_l_l_o" + + Thanks `@BRevzin (Barry Revzin) `_. + +* Added support for named arguments, ``clear`` and ``reserve`` to + ``dynamic_format_arg_store`` + (`#1655 `_, + `#1663 `_, + `#1674 `_, + `#1677 `_). + Thanks `@vsolontsov-ll (Vladimir Solontsov) + `_. + +* Added support for the ``'c'`` format specifier to integral types for + compatibility with ``std::format`` + (`#1652 `_). + +* Replaced the ``'n'`` format specifier with ``'L'`` for compatibility with + ``std::format`` (`#1624 `_). + The ``'n'`` specifier can be enabled via the ``FMT_DEPRECATED_N_SPECIFIER`` + macro. + +* The ``'='`` format specifier is now disabled by default for compatibility with + ``std::format``. It can be enabled via the ``FMT_DEPRECATED_NUMERIC_ALIGN`` + macro. + +* Removed the following deprecated APIs: + + * ``FMT_STRING_ALIAS`` and ``fmt`` macros - replaced by ``FMT_STRING`` + * ``fmt::basic_string_view::char_type`` - replaced by + ``fmt::basic_string_view::value_type`` + * ``convert_to_int`` + * ``format_arg_store::types`` + * ``*parse_context`` - replaced by ``*format_parse_context`` + * ``FMT_DEPRECATED_INCLUDE_OS`` + * ``FMT_DEPRECATED_PERCENT`` - incompatible with ``std::format`` + * ``*writer`` - replaced by compiled format API + +* Renamed the ``internal`` namespace to ``detail`` + (`#1538 `_). The former is still + provided as an alias if the ``FMT_USE_INTERNAL`` macro is defined. + +* Improved compatibility between ``fmt::printf`` with the standard specs + (`#1595 `_, + `#1682 `_, + `#1683 `_, + `#1687 `_, + `#1699 `_). + Thanks `@rimathia `_. + +* Fixed handling of ``operator<<`` overloads that use ``copyfmt`` + (`#1666 `_). + +* Added the ``FMT_OS`` CMake option to control inclusion of OS-specific APIs + in the fmt target. This can be useful for embedded platforms + (`#1654 `_, + `#1656 `_). + Thanks `@kwesolowski (Krzysztof Wesolowski) + `_. + +* Replaced ``FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION`` with the ``FMT_FUZZ`` + macro to prevent interferring with fuzzing of projects using {fmt} + (`#1650 `_). + Thanks `@asraa (Asra Ali) `_. + +* Fixed compatibility with emscripten + (`#1636 `_, + `#1637 `_). + Thanks `@ArthurSonzogni (Arthur Sonzogni) + `_. + +* Improved documentation + (`#704 `_, + `#1643 `_, + `#1660 `_, + `#1681 `_, + `#1691 `_, + `#1706 `_, + `#1714 `_, + `#1721 `_, + `#1739 `_, + `#1740 `_, + `#1741 `_, + `#1751 `_). + Thanks `@senior7515 (Alexander Gallego) `_, + `@lsr0 (Lindsay Roberts) `_, + `@puetzk (Kevin Puetz) `_, + `@fpelliccioni (Fernando Pelliccioni) `_, + Alexey Kuzmenko, `@jelly (jelle van der Waa) `_, + `@claremacrae (Clare Macrae) `_, + `@jiapengwen (文佳鹏) `_, + `@gsjaardema (Greg Sjaardema) `_, + `@alexey-milovidov `_. + +* Implemented various build configuration fixes and improvements + (`#1603 `_, + `#1657 `_, + `#1702 `_, + `#1728 `_). + Thanks `@scramsby (Scott Ramsby) `_, + `@jtojnar (Jan Tojnar) `_, + `@orivej (Orivej Desh) `_, + `@flagarde `_. + +* Fixed various warnings and compilation issues + (`#1616 `_, + `#1620 `_, + `#1622 `_, + `#1625 `_, + `#1627 `_, + `#1628 `_, + `#1629 `_, + `#1631 `_, + `#1633 `_, + `#1649 `_, + `#1658 `_, + `#1661 `_, + `#1667 `_, + `#1668 `_, + `#1669 `_, + `#1692 `_, + `#1696 `_, + `#1697 `_, + `#1707 `_, + `#1712 `_, + `#1716 `_, + `#1722 `_, + `#1724 `_, + `#1729 `_, + `#1738 `_, + `#1742 `_, + `#1743 `_, + `#1744 `_, + `#1747 `_, + `#1750 `_). + Thanks `@gsjaardema (Greg Sjaardema) `_, + `@gabime (Gabi Melman) `_, + `@johnor (Johan) `_, + `@Kurkin (Dmitry Kurkin) `_, + `@invexed (James Beach) `_, + `@peterbell10 `_, + `@daixtrose (Markus Werle) `_, + `@petrutlucian94 (Lucian Petrut) `_, + `@Neargye (Daniil Goncharov) `_, + `@ambitslix (Attila M. Szilagyi) `_, + `@gabime (Gabi Melman) `_, + `@erthink (Leonid Yuriev) `_, + `@tohammer (Tobias Hammer) `_, + `@0x8000-0000 (Florin Iucha) `_. + +6.2.1 - 2020-05-09 +------------------ + +* Fixed ostream support in ``sprintf`` + (`#1631 `_). + +* Fixed type detection when using implicit conversion to ``string_view`` and + ostream ``operator<<`` inconsistently + (`#1662 `_). + +6.2.0 - 2020-04-05 +------------------ + +* Improved error reporting when trying to format an object of a non-formattable + type: + + .. code:: c++ + + fmt::format("{}", S()); + + now gives:: + + include/fmt/core.h:1015:5: error: static_assert failed due to requirement + 'formattable' "Cannot format argument. To make type T formattable provide a + formatter specialization: + https://fmt.dev/latest/api.html#formatting-user-defined-types" + static_assert( + ^ + ... + note: in instantiation of function template specialization + 'fmt::v6::format' requested here + fmt::format("{}", S()); + ^ + + if ``S`` is not formattable. + +* Reduced the library size by ~10%. + +* Always print decimal point if ``#`` is specified + (`#1476 `_, + `#1498 `_): + + .. code:: c++ + + fmt::print("{:#.0f}", 42.0); + + now prints ``42.`` + +* Implemented the ``'L'`` specifier for locale-specific numeric formatting to + improve compatibility with ``std::format``. The ``'n'`` specifier is now + deprecated and will be removed in the next major release. + +* Moved OS-specific APIs such as ``windows_error`` from ``fmt/format.h`` to + ``fmt/os.h``. You can define ``FMT_DEPRECATED_INCLUDE_OS`` to automatically + include ``fmt/os.h`` from ``fmt/format.h`` for compatibility but this will be + disabled in the next major release. + +* Added precision overflow detection in floating-point formatting. + +* Implemented detection of invalid use of ``fmt::arg``. + +* Used ``type_identity`` to block unnecessary template argument deduction. + Thanks Tim Song. + +* Improved UTF-8 handling + (`#1109 `_): + + .. code:: c++ + + fmt::print("┌{0:─^{2}}┐\n" + "│{1: ^{2}}│\n" + "└{0:─^{2}}┘\n", "", "Привет, мир!", 20); + + now prints:: + + ┌────────────────────┐ + │ Привет, мир! │ + └────────────────────┘ + + on systems that support Unicode. + +* Added experimental dynamic argument storage + (`#1170 `_, + `#1584 `_): + + .. code:: c++ + + fmt::dynamic_format_arg_store store; + store.push_back("answer"); + store.push_back(42); + fmt::vprint("The {} is {}.\n", store); + + prints:: + + The answer is 42. + + Thanks `@vsolontsov-ll (Vladimir Solontsov) + `_. + +* Made ``fmt::join`` accept ``initializer_list`` + (`#1591 `_). + Thanks `@Rapotkinnik (Nikolay Rapotkin) `_. + +* Fixed handling of empty tuples + (`#1588 `_). + +* Fixed handling of output iterators in ``format_to_n`` + (`#1506 `_). + +* Fixed formatting of ``std::chrono::duration`` types to wide output + (`#1533 `_). + Thanks `@zeffy (pilao) `_. + +* Added const ``begin`` and ``end`` overload to buffers + (`#1553 `_). + Thanks `@dominicpoeschko `_. + +* Added the ability to disable floating-point formatting via ``FMT_USE_FLOAT``, + ``FMT_USE_DOUBLE`` and ``FMT_USE_LONG_DOUBLE`` macros for extremely + memory-constrained embedded system + (`#1590 `_). + Thanks `@albaguirre (Alberto Aguirre) `_. + +* Made ``FMT_STRING`` work with ``constexpr`` ``string_view`` + (`#1589 `_). + Thanks `@scramsby (Scott Ramsby) `_. + +* Implemented a minor optimization in the format string parser + (`#1560 `_). + Thanks `@IkarusDeveloper `_. + +* Improved attribute detection + (`#1469 `_, + `#1475 `_, + `#1576 `_). + Thanks `@federico-busato (Federico) `_, + `@chronoxor (Ivan Shynkarenka) `_, + `@refnum `_. + +* Improved documentation + (`#1481 `_, + `#1523 `_). + Thanks `@JackBoosY (Jack·Boos·Yu) `_, + `@imba-tjd (谭九鼎) `_. + +* Fixed symbol visibility on Linux when compiling with ``-fvisibility=hidden`` + (`#1535 `_). + Thanks `@milianw (Milian Wolff) `_. + +* Implemented various build configuration fixes and improvements + (`#1264 `_, + `#1460 `_, + `#1534 `_, + `#1536 `_, + `#1545 `_, + `#1546 `_, + `#1566 `_, + `#1582 `_, + `#1597 `_, + `#1598 `_). + Thanks `@ambitslix (Attila M. Szilagyi) `_, + `@jwillikers (Jordan Williams) `_, + `@stac47 (Laurent Stacul) `_. + +* Fixed various warnings and compilation issues + (`#1433 `_, + `#1461 `_, + `#1470 `_, + `#1480 `_, + `#1485 `_, + `#1492 `_, + `#1493 `_, + `#1504 `_, + `#1505 `_, + `#1512 `_, + `#1515 `_, + `#1516 `_, + `#1518 `_, + `#1519 `_, + `#1520 `_, + `#1521 `_, + `#1522 `_, + `#1524 `_, + `#1530 `_, + `#1531 `_, + `#1532 `_, + `#1539 `_, + `#1547 `_, + `#1548 `_, + `#1554 `_, + `#1567 `_, + `#1568 `_, + `#1569 `_, + `#1571 `_, + `#1573 `_, + `#1575 `_, + `#1581 `_, + `#1583 `_, + `#1586 `_, + `#1587 `_, + `#1594 `_, + `#1596 `_, + `#1604 `_, + `#1606 `_, + `#1607 `_, + `#1609 `_). + Thanks `@marti4d (Chris Martin) `_, + `@iPherian `_, + `@parkertomatoes `_, + `@gsjaardema (Greg Sjaardema) `_, + `@chronoxor (Ivan Shynkarenka) `_, + `@DanielaE (Daniela Engert) `_, + `@torsten48 `_, + `@tohammer (Tobias Hammer) `_, + `@lefticus (Jason Turner) `_, + `@ryusakki (Haise) `_, + `@adnsv (Alex Denisov) `_, + `@fghzxm `_, + `@refnum `_, + `@pramodk (Pramod Kumbhar) `_, + `@Spirrwell `_, + `@scramsby (Scott Ramsby) `_. + 6.1.2 - 2019-12-11 ------------------ @@ -374,16 +1312,16 @@ #include auto f = fmt::compile("{}"); - std::string s = fmt::format(f, 42); // can be called multiple times to format - // different values + std::string s = fmt::format(f, 42); // can be called multiple times to + // format different values // s == "42" It moves the cost of parsing a format string outside of the format function which can be beneficial when identically formatting many objects of the same types. Thanks `@stryku (Mateusz Janek) `_. -* Added the ``%`` format specifier that formats floating-point values as - percentages (`#1060 `_, +* Added experimental ``%`` format specifier that formats floating-point values + as percentages (`#1060 `_, `#1069 `_, `#1071 `_): @@ -1146,7 +2084,7 @@ * Implemented ``constexpr`` parsing of format strings and `compile-time format string checks - `_. For + `_. For example .. code:: c++ @@ -1207,7 +2145,7 @@ throw format_error("invalid specifier"); * Added `iterator support - `_: + `_: .. code:: c++ @@ -1218,7 +2156,7 @@ fmt::format_to(std::back_inserter(out), "{}", 42); * Added the `format_to_n - `_ + `_ function that restricts the output to the specified number of characters (`#298 `_): @@ -1229,7 +2167,7 @@ // out == "1234" (without terminating '\0') * Added the `formatted_size - `_ + `_ function for computing the output size: .. code:: c++ @@ -1239,7 +2177,7 @@ auto size = fmt::formatted_size("{}", 12345); // size == 5 * Improved compile times by reducing dependencies on standard headers and - providing a lightweight `core API `_: + providing a lightweight `core API `_: .. code:: c++ @@ -1251,7 +2189,7 @@ `_. * Added the `make_format_args - `_ + `_ function for capturing formatting arguments: .. code:: c++ @@ -1333,7 +2271,7 @@ fmt::format("{} {two}", 1, fmt::arg("two", 2)); * Removed the write API in favor of the `format API - `_ with compile-time handling of + `_ with compile-time handling of format strings. * Disallowed formatting of multibyte strings into a wide character target diff --git a/Externals/fmt/README.rst b/Externals/fmt/README.rst index 162382ceca7b..acddc70ef183 100755 --- a/Externals/fmt/README.rst +++ b/Externals/fmt/README.rst @@ -7,153 +7,174 @@ .. image:: https://ci.appveyor.com/api/projects/status/ehjkiefde6gucy1v :target: https://ci.appveyor.com/project/vitaut/fmt -.. image:: https://oss-fuzz-build-logs.storage.googleapis.com/badges/libfmt.svg - :alt: fmt is continuously fuzzed att oss-fuzz - :target: https://bugs.chromium.org/p/oss-fuzz/issues/list?colspec=ID%20Type%20Component%20Status%20Proj%20Reported%20Owner%20Summary&q=proj%3Dlibfmt&can=1 +.. image:: https://oss-fuzz-build-logs.storage.googleapis.com/badges/fmt.svg + :alt: fmt is continuously fuzzed at oss-fuzz + :target: https://bugs.chromium.org/p/oss-fuzz/issues/list?\ + colspec=ID%20Type%20Component%20Status%20Proj%20Reported%20Owner%20\ + Summary&q=proj%3Dfmt&can=1 .. image:: https://img.shields.io/badge/stackoverflow-fmt-blue.svg :alt: Ask questions at StackOverflow with the tag fmt - :target: http://stackoverflow.com/questions/tagged/fmt + :target: https://stackoverflow.com/questions/tagged/fmt -**{fmt}** is an open-source formatting library for C++. -It can be used as a safe and fast alternative to (s)printf and iostreams. +**{fmt}** is an open-source formatting library providing a fast and safe +alternative to C stdio and C++ iostreams. -`Documentation `__ +If you like this project, please consider donating to BYSOL, +an initiative to help victims of political repressions in Belarus: +https://www.facebook.com/donate/759400044849707/108388587646909/. -Q&A: ask questions on `StackOverflow with the tag fmt `_. +`Documentation `__ + +Q&A: ask questions on `StackOverflow with the tag fmt +`_. + +Try {fmt} in `Compiler Explorer `_. Features -------- -* Replacement-based `format API `_ with - positional arguments for localization. -* `Format string syntax `_ similar to the one - of `str.format `_ - in Python. +* Simple `format API `_ with positional arguments + for localization +* Implementation of `C++20 std::format + `__ +* `Format string syntax `_ similar to Python's + `format `_ +* Fast IEEE 754 floating-point formatter with correct rounding, shortness and + round-trip guarantees * Safe `printf implementation - `_ including - the POSIX extension for positional arguments. -* Implementation of `C++20 std::format `__. -* Support for user-defined types. + `_ including the POSIX + extension for positional arguments +* Extensibility: `support for user-defined types + `_ * High performance: faster than common standard library implementations of - `printf `_ and - iostreams. See `Speed tests`_ and `Fast integer to string conversion in C++ - `_. -* Small code size both in terms of source code (the minimum configuration - consists of just three header files, ``core.h``, ``format.h`` and - ``format-inl.h``) and compiled code. See `Compile time and code bloat`_. -* Reliability: the library has an extensive set of `unit tests - `_ and is continuously fuzzed. + ``(s)printf``, iostreams, ``to_string`` and ``to_chars``, see `Speed tests`_ + and `Converting a hundred million integers to strings per second + `_ +* Small code size both in terms of source code with the minimum configuration + consisting of just three files, ``core.h``, ``format.h`` and ``format-inl.h``, + and compiled code; see `Compile time and code bloat`_ +* Reliability: the library has an extensive set of `tests + `_ and is `continuously fuzzed + `_ * Safety: the library is fully type safe, errors in format strings can be reported at compile time, automatic memory management prevents buffer overflow - errors. + errors * Ease of use: small self-contained code base, no external dependencies, permissive MIT `license `_ * `Portability `_ with - consistent output across platforms and support for older compilers. -* Clean warning-free codebase even on high warning levels - (``-Wall -Wextra -pedantic``). -* Support for wide strings. -* Optional header-only configuration enabled with the ``FMT_HEADER_ONLY`` macro. + consistent output across platforms and support for older compilers +* Clean warning-free codebase even on high warning levels such as + ``-Wall -Wextra -pedantic`` +* Locale-independence by default +* Optional header-only configuration enabled with the ``FMT_HEADER_ONLY`` macro -See the `documentation `_ for more details. +See the `documentation `_ for more details. Examples -------- -Print ``Hello, world!`` to ``stdout``: +**Print to stdout** (`run `_) + +.. code:: c++ + + #include + + int main() { + fmt::print("Hello, world!\n"); + } + +**Format a string** (`run `_) .. code:: c++ - fmt::print("Hello, {}!", "world"); // Python-like format string syntax - fmt::printf("Hello, %s!", "world"); // printf format string syntax + std::string s = fmt::format("The answer is {}.", 42); + // s == "The answer is 42." -Format a string and use positional arguments: +**Format a string using positional arguments** (`run `_) .. code:: c++ std::string s = fmt::format("I'd rather be {1} than {0}.", "right", "happy"); // s == "I'd rather be happy than right." -Check a format string at compile time: +**Print chrono durations** (`run `_) .. code:: c++ - // test.cc - #include - std::string s = format(FMT_STRING("{2}"), 42); + #include -.. code:: + int main() { + using namespace std::literals::chrono_literals; + fmt::print("Default format: {} {}\n", 42s, 100ms); + fmt::print("strftime-like format: {:%H:%M:%S}\n", 3h + 15min + 30s); + } + +Output:: - $ c++ -Iinclude -std=c++14 test.cc - ... - test.cc:4:17: note: in instantiation of function template specialization 'fmt::v5::format' requested here - std::string s = format(FMT_STRING("{2}"), 42); - ^ - include/fmt/core.h:778:19: note: non-constexpr function 'on_error' cannot be used in a constant expression - ErrorHandler::on_error(message); - ^ - include/fmt/format.h:2226:16: note: in call to '&checker.context_->on_error(&"argument index out of range"[0])' - context_.on_error("argument index out of range"); - ^ + Default format: 42s 100ms + strftime-like format: 03:15:30 -Use {fmt} as a safe portable replacement for ``itoa`` -(`godbolt `_): +**Print a container** (`run `_) .. code:: c++ - fmt::memory_buffer buf; - format_to(buf, "{}", 42); // replaces itoa(42, buffer, 10) - format_to(buf, "{:x}", 42); // replaces itoa(42, buffer, 16) - // access the string with to_string(buf) or buf.data() + #include + #include -Format objects of user-defined types via a simple `extension API -`_: + int main() { + std::vector v = {1, 2, 3}; + fmt::print("{}\n", v); + } -.. code:: c++ +Output:: - #include "fmt/format.h" + {1, 2, 3} - struct date { - int year, month, day; - }; +**Check a format string at compile time** - template <> - struct fmt::formatter { - constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); } +.. code:: c++ - template - auto format(const date& d, FormatContext& ctx) { - return format_to(ctx.out(), "{}-{}-{}", d.year, d.month, d.day); - } - }; + std::string s = fmt::format(FMT_STRING("{:d}"), "don't panic"); - std::string s = fmt::format("The date is {}", date{2012, 12, 9}); - // s == "The date is 2012-12-9" +This gives a compile-time error because ``d`` is an invalid format specifier for +a string. -Create your own functions similar to `format -`_ and -`print `_ -which take arbitrary arguments (`godbolt `_): +**Write a file from a single thread** .. code:: c++ - // Prints formatted error message. - void vreport_error(const char* format, fmt::format_args args) { - fmt::print("Error: "); - fmt::vprint(format, args); + #include + + int main() { + auto out = fmt::output_file("guide.txt"); + out.print("Don't {}", "Panic"); } - template - void report_error(const char* format, const Args & ... args) { - vreport_error(format, fmt::make_format_args(args...)); + +This can be `5 to 9 times faster than fprintf +`_. + +**Print with colors and text styles** + +.. code:: c++ + + #include + + int main() { + fmt::print(fg(fmt::color::crimson) | fmt::emphasis::bold, + "Hello, {}!\n", "world"); + fmt::print(fg(fmt::color::floral_white) | bg(fmt::color::slate_gray) | + fmt::emphasis::underline, "Hello, {}!\n", "мир"); + fmt::print(fg(fmt::color::steel_blue) | fmt::emphasis::italic, + "Hello, {}!\n", "世界"); } - report_error("file not found: {}", path); +Output on a modern terminal: -Note that ``vreport_error`` is not parameterized on argument types which can -improve compile times and reduce code size compared to a fully parameterized -version. +.. image:: https://user-images.githubusercontent.com/ + 576385/88485597-d312f600-cf2b-11ea-9cbe-61f535a86e28.png Benchmarks ---------- @@ -174,18 +195,20 @@ Folly Format folly::format 2.23 {fmt} is the fastest of the benchmarked methods, ~35% faster than ``printf``. The above results were generated by building ``tinyformat_test.cpp`` on macOS -10.14.6 with ``clang++ -O3 -DSPEED_TEST -DHAVE_FORMAT``, and taking the best of -three runs. In the test, the format string ``"%0.10f:%04d:%+g:%s:%p:%c:%%\n"`` +10.14.6 with ``clang++ -O3 -DNDEBUG -DSPEED_TEST -DHAVE_FORMAT``, and taking the +best of three runs. In the test, the format string ``"%0.10f:%04d:%+g:%s:%p:%c:%%\n"`` or equivalent is filled 2,000,000 times with output sent to ``/dev/null``; for further details refer to the `source `_. -{fmt} is 10x faster than ``std::ostringstream`` and ``sprintf`` on floating-point -formatting (`dtoa-benchmark `_) -and as fast as `double-conversion `_: +{fmt} is up to 20-30x faster than ``std::ostringstream`` and ``sprintf`` on +floating-point formatting (`dtoa-benchmark `_) +and faster than `double-conversion `_ and +`ryu `_: -.. image:: https://user-images.githubusercontent.com/576385/69767160-cdaca400-112f-11ea-9fc5-347c9f83caad.png - :target: https://fmt.dev/unknown_mac64_clang10.0.html +.. image:: https://user-images.githubusercontent.com/576385/ + 95684665-11719600-0ba8-11eb-8e5b-972ff4e49428.png + :target: https://fmt.dev/unknown_mac64_clang12.0.html Compile time and code bloat ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -264,86 +287,110 @@ or the bloat test:: Projects using this library --------------------------- -* `0 A.D. `_: A free, open-source, cross-platform real-time - strategy game +* `0 A.D. `_: a free, open-source, cross-platform + real-time strategy game * `AMPL/MP `_: - An open-source library for mathematical programming - -* `AvioBook `_: A comprehensive aircraft + an open-source library for mathematical programming + +* `Aseprite `_: + animated sprite editor & pixel art tool + +* `AvioBook `_: a comprehensive aircraft operations suite -* `Celestia `_: Real-time 3D visualization of space +* `Blizzard Battle.net `_: an online gaming platform + +* `Celestia `_: real-time 3D visualization of space + +* `Ceph `_: a scalable distributed storage system -* `Ceph `_: A scalable distributed storage system +* `ccache `_: a compiler cache -* `ccache `_: A compiler cache +* `ClickHouse `_: analytical database + management system * `CUAUV `_: Cornell University's autonomous underwater vehicle -* `HarpyWar/pvpgn `_: - Player vs Player Gaming Network with tweaks +* `Drake `_: a planning, control, and analysis toolbox + for nonlinear dynamical systems (MIT) -* `KBEngine `_: An open-source MMOG server engine +* `Envoy `_: C++ L7 proxy and communication bus + (Lyft) -* `Keypirinha `_: A semantic launcher for Windows +* `FiveM `_: a modification framework for GTA V -* `Kodi `_ (formerly xbmc): Home theater software +* `Folly `_: Facebook open-source library -* `Lifeline `_: A 2D game +* `HarpyWar/pvpgn `_: + Player vs Player Gaming Network with tweaks -* `Drake `_: A planning, control, and analysis toolbox - for nonlinear dynamical systems (MIT) +* `KBEngine `_: an open-source MMOG server + engine -* `Envoy `_: C++ L7 proxy and communication bus - (Lyft) +* `Keypirinha `_: a semantic launcher for Windows -* `FiveM `_: a modification framework for GTA V +* `Kodi `_ (formerly xbmc): home theater software + +* `Knuth `_: high-performance Bitcoin full-node -* `MongoDB `_: Distributed document database +* `Microsoft Verona `_: + research programming language for concurrent ownership -* `MongoDB Smasher `_: A small tool to +* `MongoDB `_: distributed document database + +* `MongoDB Smasher `_: a small tool to generate randomized datasets -* `OpenSpace `_: An open-source astrovisualization - framework +* `OpenSpace `_: an open-source + astrovisualization framework + +* `PenUltima Online (POL) `_: + an MMO server, compatible with most Ultima Online clients -* `PenUltima Online (POL) `_: - An MMO server, compatible with most Ultima Online clients +* `PyTorch `_: an open-source machine + learning library -* `quasardb `_: A distributed, high-performance, +* `quasardb `_: a distributed, high-performance, associative database + +* `Quill `_: asynchronous low-latency logging library -* `readpe `_: Read Portable Executable +* `QKW `_: generalizing aliasing to simplify + navigation, and executing complex multi-line terminal command sequences -* `redis-cerberus `_: A Redis cluster +* `redis-cerberus `_: a Redis cluster proxy -* `rpclib `_: A modern C++ msgpack-RPC server and client - library +* `redpanda `_: a 10x faster Kafka® replacement + for mission critical systems written in C++ -* `Saddy `_: - Small crossplatform 2D graphic engine +* `rpclib `_: a modern C++ msgpack-RPC server and client + library -* `Salesforce Analytics Cloud `_: - Business intelligence software +* `Salesforce Analytics Cloud + `_: + business intelligence software -* `Scylla `_: A Cassandra-compatible NoSQL data store +* `Scylla `_: a Cassandra-compatible NoSQL data store that can handle 1 million transactions per second on a single server -* `Seastar `_: An advanced, open-source C++ +* `Seastar `_: an advanced, open-source C++ framework for high-performance server applications on modern hardware -* `spdlog `_: Super fast C++ logging library +* `spdlog `_: super fast C++ logging library -* `Stellar `_: Financial platform +* `Stellar `_: financial platform -* `Touch Surgery `_: Surgery simulator +* `Touch Surgery `_: surgery simulator -* `TrinityCore `_: Open-source +* `TrinityCore `_: open-source MMORPG framework +* `Windows Terminal `_: the new Windows + terminal + `More... `_ If you are aware of other projects using this library, please let me know @@ -368,7 +415,7 @@ The good thing about ``printf`` is that it is pretty fast and readily available being a part of the C standard library. The main drawback is that it doesn't support user-defined types. ``printf`` also has safety issues although they are somewhat mitigated with `__attribute__ ((format (printf, ...)) -`_ in GCC. +`_ in GCC. There is a POSIX extension that adds positional arguments required for `i18n `_ to ``printf`` but it is not a part of C99 and may not be available on some @@ -400,15 +447,15 @@ Boost Format This is a very powerful library which supports both ``printf``-like format strings and positional arguments. Its main drawback is performance. According to -various benchmarks it is much slower than other methods considered here. Boost +various, benchmarks it is much slower than other methods considered here. Boost Format also has excessive build times and severe code bloat issues (see `Benchmarks`_). FastFormat ~~~~~~~~~~ -This is an interesting library which is fast, safe and has positional -arguments. However it has significant limitations, citing its author: +This is an interesting library which is fast, safe and has positional arguments. +However, it has significant limitations, citing its author: Three features that have no hope of being accommodated within the current design are: @@ -417,8 +464,8 @@ arguments. However it has significant limitations, citing its author: * Octal/hexadecimal encoding * Runtime width/alignment specification -It is also quite big and has a heavy dependency, STLSoft, which might be -too restrictive for using it in some projects. +It is also quite big and has a heavy dependency, STLSoft, which might be too +restrictive for using it in some projects. Boost Spirit.Karma ~~~~~~~~~~~~~~~~~~ @@ -426,32 +473,9 @@ Boost Spirit.Karma This is not really a formatting library but I decided to include it here for completeness. As iostreams, it suffers from the problem of mixing verbatim text with arguments. The library is pretty fast, but slower on integer formatting -than ``fmt::format_int`` on Karma's own benchmark, -see `Fast integer to string conversion in C++ -`_. - -FAQ ---- - -Q: how can I capture formatting arguments and format them later? - -A: use ``std::tuple``: - -.. code:: c++ - - template - auto capture(const Args&... args) { - return std::make_tuple(args...); - } - - auto print_message = [](const auto&... args) { - fmt::print(args...); - }; - - // Capture and store arguments: - auto args = capture("{} {}", 42, "foo"); - // Do formatting: - std::apply(print_message, args); +than ``fmt::format_to`` with format string compilation on Karma's own benchmark, +see `Converting a hundred million integers to strings per second +`_. License ------- @@ -459,18 +483,19 @@ License {fmt} is distributed under the MIT `license `_. -The `Format String Syntax -`_ +Documentation License +--------------------- + +The `Format String Syntax `_ section in the documentation is based on the one from Python `string module -documentation `_ -adapted for the current library. For this reason the documentation is -distributed under the Python Software Foundation license available in -`doc/python-license.txt +documentation `_. +For this reason the documentation is distributed under the Python Software +Foundation license available in `doc/python-license.txt `_. -It only applies if you distribute the documentation of fmt. +It only applies if you distribute the documentation of {fmt}. -Acknowledgments ---------------- +Maintainers +----------- The {fmt} library is maintained by Victor Zverovich (`vitaut `_) and Jonathan Müller (`foonathan @@ -479,23 +504,3 @@ See `Contributors `_ and `Releases `_ for some of the names. Let us know if your contribution is not listed or mentioned incorrectly and we'll make it right. - -The benchmark section of this readme file and the performance tests are taken -from the excellent `tinyformat `_ library -written by Chris Foster. Boost Format library is acknowledged transitively -since it had some influence on tinyformat. -Some ideas used in the implementation are borrowed from `Loki -`_ SafeFormat and `Diagnostic API -`_ in -`Clang `_. -Format string syntax and the documentation are based on Python's `str.format -`_. -Thanks `Doug Turnbull `_ for his valuable -comments and contribution to the design of the type-safe API and -`Gregory Czajkowski `_ for implementing binary -formatting. Thanks `Ruslan Baratov `_ for comprehensive -`comparison of integer formatting algorithms `_ -and useful comments regarding performance, `Boris Kaul `_ for -`C++ counting digits benchmark `_. -Thanks to `CarterLi `_ for contributing various -improvements to the code. diff --git a/Externals/fmt/include/fmt/chrono.h b/Externals/fmt/include/fmt/chrono.h index ca4ed30ae69c..1a3b8d5e5cd8 100755 --- a/Externals/fmt/include/fmt/chrono.h +++ b/Externals/fmt/include/fmt/chrono.h @@ -8,14 +8,14 @@ #ifndef FMT_CHRONO_H_ #define FMT_CHRONO_H_ -#include "format.h" -#include "locale.h" - #include #include #include #include +#include "format.h" +#include "locale.h" + FMT_BEGIN_NAMESPACE // Enable safe chrono durations, unless explicitly disabled. @@ -48,7 +48,7 @@ FMT_CONSTEXPR To lossless_integral_conversion(const From from, int& ec) { // From fits in To without any problem. } else { // From does not always fit in To, resort to a dynamic check. - if (from < T::min() || from > T::max()) { + if (from < (T::min)() || from > (T::max)()) { // outside range. ec = 1; return {}; @@ -72,43 +72,27 @@ FMT_CONSTEXPR To lossless_integral_conversion(const From from, int& ec) { static_assert(F::is_integer, "From must be integral"); static_assert(T::is_integer, "To must be integral"); - if (F::is_signed && !T::is_signed) { + if (detail::const_check(F::is_signed && !T::is_signed)) { // From may be negative, not allowed! - if (fmt::internal::is_negative(from)) { + if (fmt::detail::is_negative(from)) { ec = 1; return {}; } - // From is positive. Can it always fit in To? - if (F::digits <= T::digits) { - // yes, From always fits in To. - } else { - // from may not fit in To, we have to do a dynamic check - if (from > static_cast(T::max())) { - ec = 1; - return {}; - } + if (F::digits > T::digits && + from > static_cast(detail::max_value())) { + ec = 1; + return {}; } } - if (!F::is_signed && T::is_signed) { - // can from be held in To? - if (F::digits < T::digits) { - // yes, From always fits in To. - } else { - // from may not fit in To, we have to do a dynamic check - if (from > static_cast(T::max())) { - // outside range. - ec = 1; - return {}; - } - } + if (!F::is_signed && T::is_signed && F::digits >= T::digits && + from > static_cast(detail::max_value())) { + ec = 1; + return {}; } - - // reaching here means all is ok for lossless conversion. - return static_cast(from); - -} // function + return static_cast(from); // Lossless conversion. +} template ::value)> @@ -141,7 +125,7 @@ FMT_CONSTEXPR To safe_float_conversion(const From from, int& ec) { // catch the only happy case if (std::isfinite(from)) { - if (from >= T::lowest() && from <= T::max()) { + if (from >= T::lowest() && from <= (T::max)()) { return static_cast(from); } // not within range. @@ -190,17 +174,16 @@ To safe_duration_cast(std::chrono::duration from, // safe conversion to IntermediateRep IntermediateRep count = lossless_integral_conversion(from.count(), ec); - if (ec) { - return {}; - } + if (ec) return {}; // multiply with Factor::num without overflow or underflow - if (Factor::num != 1) { - const auto max1 = internal::max_value() / Factor::num; + if (detail::const_check(Factor::num != 1)) { + const auto max1 = detail::max_value() / Factor::num; if (count > max1) { ec = 1; return {}; } - const auto min1 = std::numeric_limits::min() / Factor::num; + const auto min1 = + (std::numeric_limits::min)() / Factor::num; if (count < min1) { ec = 1; return {}; @@ -208,17 +191,9 @@ To safe_duration_cast(std::chrono::duration from, count *= Factor::num; } - // this can't go wrong, right? den>0 is checked earlier. - if (Factor::den != 1) { - count /= Factor::den; - } - // convert to the to type, safely - using ToRep = typename To::rep; - const ToRep tocount = lossless_integral_conversion(count, ec); - if (ec) { - return {}; - } - return To{tocount}; + if (detail::const_check(Factor::den != 1)) count /= Factor::den; + auto tocount = lossless_integral_conversion(count, ec); + return ec ? To() : To(tocount); } /** @@ -269,7 +244,7 @@ To safe_duration_cast(std::chrono::duration from, // multiply with Factor::num without overflow or underflow if (Factor::num != 1) { - constexpr auto max1 = internal::max_value() / + constexpr auto max1 = detail::max_value() / static_cast(Factor::num); if (count > max1) { ec = 1; @@ -306,12 +281,12 @@ To safe_duration_cast(std::chrono::duration from, // Usage: f FMT_NOMACRO() #define FMT_NOMACRO -namespace internal { +namespace detail { inline null<> localtime_r FMT_NOMACRO(...) { return null<>(); } inline null<> localtime_s(...) { return null<>(); } inline null<> gmtime_r(...) { return null<>(); } inline null<> gmtime_s(...) { return null<>(); } -} // namespace internal +} // namespace detail // Thread-safe replacement for std::localtime inline std::tm localtime(std::time_t time) { @@ -322,22 +297,22 @@ inline std::tm localtime(std::time_t time) { dispatcher(std::time_t t) : time_(t) {} bool run() { - using namespace fmt::internal; + using namespace fmt::detail; return handle(localtime_r(&time_, &tm_)); } bool handle(std::tm* tm) { return tm != nullptr; } - bool handle(internal::null<>) { - using namespace fmt::internal; + bool handle(detail::null<>) { + using namespace fmt::detail; return fallback(localtime_s(&tm_, &time_)); } bool fallback(int res) { return res == 0; } #if !FMT_MSC_VER - bool fallback(internal::null<>) { - using namespace fmt::internal; + bool fallback(detail::null<>) { + using namespace fmt::detail; std::tm* tm = std::localtime(&time_); if (tm) tm_ = *tm; return tm != nullptr; @@ -350,6 +325,11 @@ inline std::tm localtime(std::time_t time) { return lt.tm_; } +inline std::tm localtime( + std::chrono::time_point time_point) { + return localtime(std::chrono::system_clock::to_time_t(time_point)); +} + // Thread-safe replacement for std::gmtime inline std::tm gmtime(std::time_t time) { struct dispatcher { @@ -359,21 +339,21 @@ inline std::tm gmtime(std::time_t time) { dispatcher(std::time_t t) : time_(t) {} bool run() { - using namespace fmt::internal; + using namespace fmt::detail; return handle(gmtime_r(&time_, &tm_)); } bool handle(std::tm* tm) { return tm != nullptr; } - bool handle(internal::null<>) { - using namespace fmt::internal; + bool handle(detail::null<>) { + using namespace fmt::detail; return fallback(gmtime_s(&tm_, &time_)); } bool fallback(int res) { return res == 0; } #if !FMT_MSC_VER - bool fallback(internal::null<>) { + bool fallback(detail::null<>) { std::tm* tm = std::gmtime(&time_); if (tm) tm_ = *tm; return tm != nullptr; @@ -386,17 +366,33 @@ inline std::tm gmtime(std::time_t time) { return gt.tm_; } -namespace internal { -inline std::size_t strftime(char* str, std::size_t count, const char* format, - const std::tm* time) { +inline std::tm gmtime( + std::chrono::time_point time_point) { + return gmtime(std::chrono::system_clock::to_time_t(time_point)); +} + +namespace detail { +inline size_t strftime(char* str, size_t count, const char* format, + const std::tm* time) { return std::strftime(str, count, format, time); } -inline std::size_t strftime(wchar_t* str, std::size_t count, - const wchar_t* format, const std::tm* time) { +inline size_t strftime(wchar_t* str, size_t count, const wchar_t* format, + const std::tm* time) { return std::wcsftime(str, count, format, time); } -} // namespace internal +} // namespace detail + +template +struct formatter, Char> + : formatter { + template + auto format(std::chrono::time_point val, + FormatContext& ctx) -> decltype(ctx.out()) { + std::tm time = localtime(val); + return formatter::format(time, ctx); + } +}; template struct formatter { template @@ -405,7 +401,7 @@ template struct formatter { if (it != ctx.end() && *it == ':') ++it; auto end = it; while (end != ctx.end() && *end != '}') ++end; - tm_format.reserve(internal::to_unsigned(end - it + 1)); + tm_format.reserve(detail::to_unsigned(end - it + 1)); tm_format.append(it, end); tm_format.push_back('\0'); return end; @@ -414,11 +410,10 @@ template struct formatter { template auto format(const std::tm& tm, FormatContext& ctx) -> decltype(ctx.out()) { basic_memory_buffer buf; - std::size_t start = buf.size(); + size_t start = buf.size(); for (;;) { - std::size_t size = buf.capacity() - start; - std::size_t count = - internal::strftime(&buf[start], size, &tm_format[0], &tm); + size_t size = buf.capacity() - start; + size_t count = detail::strftime(&buf[start], size, &tm_format[0], &tm); if (count != 0) { buf.resize(start + count); break; @@ -430,7 +425,7 @@ template struct formatter { // https://github.com/fmtlib/fmt/issues/367 break; } - const std::size_t MIN_GROWTH = 10; + const size_t MIN_GROWTH = 10; buf.reserve(buf.capacity() + (size > MIN_GROWTH ? size : MIN_GROWTH)); } return std::copy(buf.begin(), buf.end(), ctx.out()); @@ -439,7 +434,7 @@ template struct formatter { basic_memory_buffer tm_format; }; -namespace internal { +namespace detail { template FMT_CONSTEXPR const char* get_units() { return nullptr; } @@ -495,12 +490,12 @@ FMT_CONSTEXPR const Char* parse_chrono_format(const Char* begin, handler.on_text(ptr - 1, ptr); break; case 'n': { - const char newline[] = "\n"; + const Char newline[] = {'\n'}; handler.on_text(newline, newline + 1); break; } case 't': { - const char tab[] = "\t"; + const Char tab[] = {'\t'}; handler.on_text(tab, tab + 1); break; } @@ -759,18 +754,36 @@ inline std::chrono::duration get_milliseconds( return std::chrono::duration(static_cast(ms)); } -template -OutputIt format_chrono_duration_value(OutputIt out, Rep val, int precision) { - if (precision >= 0) return format_to(out, "{:.{}f}", val, precision); - return format_to(out, std::is_floating_point::value ? "{:g}" : "{}", +template +OutputIt format_duration_value(OutputIt out, Rep val, int precision) { + const Char pr_f[] = {'{', ':', '.', '{', '}', 'f', '}', 0}; + if (precision >= 0) return format_to(out, pr_f, val, precision); + const Char fp_f[] = {'{', ':', 'g', '}', 0}; + const Char format[] = {'{', '}', 0}; + return format_to(out, std::is_floating_point::value ? fp_f : format, val); } +template +OutputIt copy_unit(string_view unit, OutputIt out, Char) { + return std::copy(unit.begin(), unit.end(), out); +} + +template +OutputIt copy_unit(string_view unit, OutputIt out, wchar_t) { + // This works when wchar_t is UTF-32 because units only contain characters + // that have the same representation in UTF-16 and UTF-32. + utf8_to_utf16 u(unit); + return std::copy(u.c_str(), u.c_str() + u.size(), out); +} -template -static OutputIt format_chrono_duration_unit(OutputIt out) { - if (const char* unit = get_units()) return format_to(out, "{}", unit); - if (Period::den == 1) return format_to(out, "[{}]s", Period::num); - return format_to(out, "[{}/{}]s", Period::num, Period::den); +template +OutputIt format_duration_unit(OutputIt out) { + if (const char* unit = get_units()) + return copy_unit(string_view(unit), out, Char()); + const Char num_f[] = {'[', '{', '}', ']', 's', 0}; + if (const_check(Period::den == 1)) return format_to(out, num_f, Period::num); + const Char num_def_f[] = {'[', '{', '}', '/', '{', '}', ']', 's', 0}; + return format_to(out, num_def_f, Period::num, Period::den); } template n = to_unsigned(to_nonnegative_int(value, max_value())); - int num_digits = internal::count_digits(n); + int num_digits = detail::count_digits(n); if (width > num_digits) out = std::fill_n(out, width - num_digits, '0'); - out = format_decimal(out, n, num_digits); + out = format_decimal(out, n, num_digits).end; } void write_nan() { std::copy_n("nan", 3, out); } void write_pinf() { std::copy_n("inf", 3, out); } void write_ninf() { std::copy_n("-inf", 4, out); } - void format_localized(const tm& time, const char* format) { + void format_localized(const tm& time, char format, char modifier = 0) { if (isnan(val)) return write_nan(); auto locale = context.locale().template get(); auto& facet = std::use_facet>(locale); std::basic_ostringstream os; os.imbue(locale); - facet.put(os, os, ' ', &time, format, format + std::strlen(format)); + facet.put(os, os, ' ', &time, format, modifier); auto str = os.str(); std::copy(str.begin(), str.end(), out); } @@ -907,7 +920,7 @@ struct chrono_formatter { if (ns == numeric_system::standard) return write(hour(), 2); auto time = tm(); time.tm_hour = to_nonnegative_int(hour(), 24); - format_localized(time, "%OH"); + format_localized(time, 'H', 'O'); } void on_12_hour(numeric_system ns) { @@ -916,7 +929,7 @@ struct chrono_formatter { if (ns == numeric_system::standard) return write(hour12(), 2); auto time = tm(); time.tm_hour = to_nonnegative_int(hour12(), 12); - format_localized(time, "%OI"); + format_localized(time, 'I', 'O'); } void on_minute(numeric_system ns) { @@ -925,7 +938,7 @@ struct chrono_formatter { if (ns == numeric_system::standard) return write(minute(), 2); auto time = tm(); time.tm_min = to_nonnegative_int(minute(), 60); - format_localized(time, "%OM"); + format_localized(time, 'M', 'O'); } void on_second(numeric_system ns) { @@ -950,13 +963,12 @@ struct chrono_formatter { } auto time = tm(); time.tm_sec = to_nonnegative_int(second(), 60); - format_localized(time, "%OS"); + format_localized(time, 'S', 'O'); } void on_12_hour_time() { if (handle_nan_inf()) return; - - format_localized(time(), "%r"); + format_localized(time(), 'r'); } void on_24_hour_time() { @@ -980,25 +992,27 @@ struct chrono_formatter { void on_am_pm() { if (handle_nan_inf()) return; - format_localized(time(), "%p"); + format_localized(time(), 'p'); } void on_duration_value() { if (handle_nan_inf()) return; write_sign(); - out = format_chrono_duration_value(out, val, precision); + out = format_duration_value(out, val, precision); } - void on_duration_unit() { out = format_chrono_duration_unit(out); } + void on_duration_unit() { + out = format_duration_unit(out); + } }; -} // namespace internal +} // namespace detail template struct formatter, Char> { private: basic_format_specs specs; int precision; - using arg_ref_type = internal::arg_ref; + using arg_ref_type = detail::arg_ref; arg_ref_type width_ref; arg_ref_type precision_ref; mutable basic_string_view format_str; @@ -1019,12 +1033,12 @@ struct formatter, Char> { return arg_ref_type(arg_id); } - FMT_CONSTEXPR arg_ref_type make_arg_ref(internal::auto_id) { + FMT_CONSTEXPR arg_ref_type make_arg_ref(detail::auto_id) { return arg_ref_type(context.next_arg_id()); } void on_error(const char* msg) { FMT_THROW(format_error(msg)); } - void on_fill(Char fill) { f.specs.fill[0] = fill; } + void on_fill(basic_string_view fill) { f.specs.fill = fill; } void on_align(align_t align) { f.specs.align = align; } void on_width(int width) { f.specs.width = width; } void on_precision(int _precision) { f.precision = _precision; } @@ -1049,17 +1063,17 @@ struct formatter, Char> { auto begin = ctx.begin(), end = ctx.end(); if (begin == end || *begin == '}') return {begin, begin}; spec_handler handler{*this, ctx, format_str}; - begin = internal::parse_align(begin, end, handler); + begin = detail::parse_align(begin, end, handler); if (begin == end) return {begin, begin}; - begin = internal::parse_width(begin, end, handler); + begin = detail::parse_width(begin, end, handler); if (begin == end) return {begin, begin}; if (*begin == '.') { if (std::is_floating_point::value) - begin = internal::parse_precision(begin, end, handler); + begin = detail::parse_precision(begin, end, handler); else handler.on_error("precision not allowed for this argument type"); } - end = parse_chrono_format(begin, end, internal::chrono_format_checker()); + end = parse_chrono_format(begin, end, detail::chrono_format_checker()); return {begin, end}; } @@ -1070,7 +1084,7 @@ struct formatter, Char> { -> decltype(ctx.begin()) { auto range = do_parse(ctx); format_str = basic_string_view( - &*range.begin, internal::to_unsigned(range.end - range.begin)); + &*range.begin, detail::to_unsigned(range.end - range.begin)); return range.end; } @@ -1081,23 +1095,21 @@ struct formatter, Char> { // is not specified. basic_memory_buffer buf; auto out = std::back_inserter(buf); - using range = internal::output_range; - internal::basic_writer w(range(ctx.out())); - internal::handle_dynamic_spec(specs.width, - width_ref, ctx); - internal::handle_dynamic_spec( - precision, precision_ref, ctx); + detail::handle_dynamic_spec(specs.width, width_ref, + ctx); + detail::handle_dynamic_spec(precision, + precision_ref, ctx); if (begin == end || *begin == '}') { - out = internal::format_chrono_duration_value(out, d.count(), precision); - internal::format_chrono_duration_unit(out); + out = detail::format_duration_value(out, d.count(), precision); + detail::format_duration_unit(out); } else { - internal::chrono_formatter f( + detail::chrono_formatter f( ctx, out, d); f.precision = precision; parse_chrono_format(begin, end, f); } - w.write(buf.data(), buf.size(), specs); - return w.out(); + return detail::write( + ctx.out(), basic_string_view(buf.data(), buf.size()), specs); } }; diff --git a/Externals/fmt/include/fmt/color.h b/Externals/fmt/include/fmt/color.h index 362a95e142e7..789105895091 100755 --- a/Externals/fmt/include/fmt/color.h +++ b/Externals/fmt/include/fmt/color.h @@ -198,7 +198,7 @@ struct rgb { uint8_t b; }; -namespace internal { +namespace detail { // color is a struct of either a rgb color or a terminal color. struct color_type { @@ -221,7 +221,7 @@ struct color_type { uint32_t rgb_color; } value; }; -} // namespace internal +} // namespace detail // Experimental text formatting support. class text_style { @@ -298,11 +298,11 @@ class text_style { FMT_CONSTEXPR bool has_emphasis() const FMT_NOEXCEPT { return static_cast(ems) != 0; } - FMT_CONSTEXPR internal::color_type get_foreground() const FMT_NOEXCEPT { + FMT_CONSTEXPR detail::color_type get_foreground() const FMT_NOEXCEPT { FMT_ASSERT(has_foreground(), "no foreground specified for this style"); return foreground_color; } - FMT_CONSTEXPR internal::color_type get_background() const FMT_NOEXCEPT { + FMT_CONSTEXPR detail::color_type get_background() const FMT_NOEXCEPT { FMT_ASSERT(has_background(), "no background specified for this style"); return background_color; } @@ -313,7 +313,7 @@ class text_style { private: FMT_CONSTEXPR text_style(bool is_foreground, - internal::color_type text_color) FMT_NOEXCEPT + detail::color_type text_color) FMT_NOEXCEPT : set_foreground_color(), set_background_color(), ems() { @@ -326,23 +326,23 @@ class text_style { } } - friend FMT_CONSTEXPR_DECL text_style fg(internal::color_type foreground) + friend FMT_CONSTEXPR_DECL text_style fg(detail::color_type foreground) FMT_NOEXCEPT; - friend FMT_CONSTEXPR_DECL text_style bg(internal::color_type background) + friend FMT_CONSTEXPR_DECL text_style bg(detail::color_type background) FMT_NOEXCEPT; - internal::color_type foreground_color; - internal::color_type background_color; + detail::color_type foreground_color; + detail::color_type background_color; bool set_foreground_color; bool set_background_color; emphasis ems; }; -FMT_CONSTEXPR text_style fg(internal::color_type foreground) FMT_NOEXCEPT { +FMT_CONSTEXPR text_style fg(detail::color_type foreground) FMT_NOEXCEPT { return text_style(/*is_foreground=*/true, foreground); } -FMT_CONSTEXPR text_style bg(internal::color_type background) FMT_NOEXCEPT { +FMT_CONSTEXPR text_style bg(detail::color_type background) FMT_NOEXCEPT { return text_style(/*is_foreground=*/false, background); } @@ -350,21 +350,21 @@ FMT_CONSTEXPR text_style operator|(emphasis lhs, emphasis rhs) FMT_NOEXCEPT { return text_style(lhs) | rhs; } -namespace internal { +namespace detail { template struct ansi_color_escape { - FMT_CONSTEXPR ansi_color_escape(internal::color_type text_color, + FMT_CONSTEXPR ansi_color_escape(detail::color_type text_color, const char* esc) FMT_NOEXCEPT { // If we have a terminal color, we need to output another escape code // sequence. if (!text_color.is_rgb) { - bool is_background = esc == internal::data::background_color; + bool is_background = esc == detail::data::background_color; uint32_t value = text_color.value.term_color; // Background ASCII codes are the same as the foreground ones but with // 10 more. if (is_background) value += 10u; - std::size_t index = 0; + size_t index = 0; buffer[index++] = static_cast('\x1b'); buffer[index++] = static_cast('['); @@ -398,7 +398,7 @@ template struct ansi_color_escape { if (em_bits & static_cast(emphasis::strikethrough)) em_codes[3] = 9; - std::size_t index = 0; + size_t index = 0; for (int i = 0; i < 4; ++i) { if (!em_codes[i]) continue; buffer[index++] = static_cast('\x1b'); @@ -412,7 +412,7 @@ template struct ansi_color_escape { FMT_CONSTEXPR const Char* begin() const FMT_NOEXCEPT { return buffer; } FMT_CONSTEXPR const Char* end() const FMT_NOEXCEPT { - return buffer + std::strlen(buffer); + return buffer + std::char_traits::length(buffer); } private: @@ -429,14 +429,14 @@ template struct ansi_color_escape { template FMT_CONSTEXPR ansi_color_escape make_foreground_color( - internal::color_type foreground) FMT_NOEXCEPT { - return ansi_color_escape(foreground, internal::data::foreground_color); + detail::color_type foreground) FMT_NOEXCEPT { + return ansi_color_escape(foreground, detail::data::foreground_color); } template FMT_CONSTEXPR ansi_color_escape make_background_color( - internal::color_type background) FMT_NOEXCEPT { - return ansi_color_escape(background, internal::data::background_color); + detail::color_type background) FMT_NOEXCEPT { + return ansi_color_escape(background, detail::data::background_color); } template @@ -455,73 +455,71 @@ inline void fputs(const wchar_t* chars, FILE* stream) FMT_NOEXCEPT { } template inline void reset_color(FILE* stream) FMT_NOEXCEPT { - fputs(internal::data::reset_color, stream); + fputs(detail::data::reset_color, stream); } template <> inline void reset_color(FILE* stream) FMT_NOEXCEPT { - fputs(internal::data::wreset_color, stream); + fputs(detail::data::wreset_color, stream); } template -inline void reset_color(basic_memory_buffer& buffer) FMT_NOEXCEPT { +inline void reset_color(buffer& buffer) FMT_NOEXCEPT { const char* begin = data::reset_color; const char* end = begin + sizeof(data::reset_color) - 1; buffer.append(begin, end); } template -void vformat_to(basic_memory_buffer& buf, const text_style& ts, +void vformat_to(buffer& buf, const text_style& ts, basic_string_view format_str, - basic_format_args> args) { + basic_format_args>> args) { bool has_style = false; if (ts.has_emphasis()) { has_style = true; - auto emphasis = internal::make_emphasis(ts.get_emphasis()); + auto emphasis = detail::make_emphasis(ts.get_emphasis()); buf.append(emphasis.begin(), emphasis.end()); } if (ts.has_foreground()) { has_style = true; - auto foreground = - internal::make_foreground_color(ts.get_foreground()); + auto foreground = detail::make_foreground_color(ts.get_foreground()); buf.append(foreground.begin(), foreground.end()); } if (ts.has_background()) { has_style = true; - auto background = - internal::make_background_color(ts.get_background()); + auto background = detail::make_background_color(ts.get_background()); buf.append(background.begin(), background.end()); } - vformat_to(buf, format_str, args); - if (has_style) { - internal::reset_color(buf); - } + detail::vformat_to(buf, format_str, args); + if (has_style) detail::reset_color(buf); } -} // namespace internal +} // namespace detail template > void vprint(std::FILE* f, const text_style& ts, const S& format, - basic_format_args> args) { + basic_format_args>> args) { basic_memory_buffer buf; - internal::vformat_to(buf, ts, to_string_view(format), args); + detail::vformat_to(buf, ts, to_string_view(format), args); buf.push_back(Char(0)); - internal::fputs(buf.data(), f); + detail::fputs(buf.data(), f); } /** + \rst Formats a string and prints it to the specified file stream using ANSI escape sequences to specify text formatting. - Example: + + **Example**:: + fmt::print(fmt::emphasis::bold | fg(fmt::color::red), "Elapsed time: {0:.2f} seconds", 1.23); + \endrst */ template ::value)> + FMT_ENABLE_IF(detail::is_string::value)> void print(std::FILE* f, const text_style& ts, const S& format_str, const Args&... args) { - internal::check_format_string(format_str); - using context = buffer_context>; - format_arg_store as{args...}; - vprint(f, ts, format_str, basic_format_args(as)); + vprint(f, ts, format_str, + fmt::make_args_checked(format_str, args...)); } /** @@ -532,7 +530,7 @@ void print(std::FILE* f, const text_style& ts, const S& format_str, "Elapsed time: {0:.2f} seconds", 1.23); */ template ::value)> + FMT_ENABLE_IF(detail::is_string::value)> void print(const text_style& ts, const S& format_str, const Args&... args) { return print(stdout, ts, format_str, args...); } @@ -540,9 +538,9 @@ void print(const text_style& ts, const S& format_str, const Args&... args) { template > inline std::basic_string vformat( const text_style& ts, const S& format_str, - basic_format_args> args) { + basic_format_args>> args) { basic_memory_buffer buf; - internal::vformat_to(buf, ts, to_string_view(format_str), args); + detail::vformat_to(buf, ts, to_string_view(format_str), args); return fmt::to_string(buf); } @@ -562,7 +560,41 @@ template > inline std::basic_string format(const text_style& ts, const S& format_str, const Args&... args) { return vformat(ts, to_string_view(format_str), - {internal::make_args_checked(format_str, args...)}); + fmt::make_args_checked(format_str, args...)); +} + +/** + Formats a string with the given text_style and writes the output to ``out``. + */ +template ::value)> +OutputIt vformat_to( + OutputIt out, const text_style& ts, basic_string_view format_str, + basic_format_args>> args) { + decltype(detail::get_buffer(out)) buf(detail::get_buffer_init(out)); + detail::vformat_to(buf, ts, format_str, args); + return detail::get_iterator(buf); +} + +/** + \rst + Formats arguments with the given text_style, writes the result to the output + iterator ``out`` and returns the iterator past the end of the output range. + + **Example**:: + + std::vector out; + fmt::format_to(std::back_inserter(out), + fmt::emphasis::bold | fg(fmt::color::red), "{}", 42); + \endrst +*/ +template >::value&& + detail::is_string::value)> +inline OutputIt format_to(OutputIt out, const text_style& ts, + const S& format_str, Args&&... args) { + return vformat_to(out, ts, to_string_view(format_str), + fmt::make_args_checked(format_str, args...)); } FMT_END_NAMESPACE diff --git a/Externals/fmt/include/fmt/compile.h b/Externals/fmt/include/fmt/compile.h index 5829f623f10b..7db610d90f0e 100644 --- a/Externals/fmt/include/fmt/compile.h +++ b/Externals/fmt/include/fmt/compile.h @@ -9,10 +9,37 @@ #define FMT_COMPILE_H_ #include + #include "format.h" FMT_BEGIN_NAMESPACE -namespace internal { +namespace detail { + +// A compile-time string which is compiled into fast formatting code. +class compiled_string {}; + +template +struct is_compiled_string : std::is_base_of {}; + +/** + \rst + Converts a string literal *s* into a format string that will be parsed at + compile time and converted into efficient formatting code. Requires C++17 + ``constexpr if`` compiler support. + + **Example**:: + + // Converts 42 into std::string using the most efficient method and no + // runtime format string processing. + std::string s = fmt::format(FMT_COMPILE("{}"), 42); + \endrst + */ +#define FMT_COMPILE(s) FMT_STRING_IMPL(s, fmt::detail::compiled_string) + +template +const T& first(const T& value, const Tail&...) { + return value; +} // Part of a compiled format string. It can be either literal text or a // replacement field. @@ -61,13 +88,15 @@ template struct part_counter { if (begin != end) ++num_parts; } - FMT_CONSTEXPR void on_arg_id() { ++num_parts; } - FMT_CONSTEXPR void on_arg_id(int) { ++num_parts; } - FMT_CONSTEXPR void on_arg_id(basic_string_view) { ++num_parts; } + FMT_CONSTEXPR int on_arg_id() { return ++num_parts, 0; } + FMT_CONSTEXPR int on_arg_id(int) { return ++num_parts, 0; } + FMT_CONSTEXPR int on_arg_id(basic_string_view) { + return ++num_parts, 0; + } - FMT_CONSTEXPR void on_replacement_field(const Char*) {} + FMT_CONSTEXPR void on_replacement_field(int, const Char*) {} - FMT_CONSTEXPR const Char* on_format_specs(const Char* begin, + FMT_CONSTEXPR const Char* on_format_specs(int, const Char* begin, const Char* end) { // Find the matching brace. unsigned brace_counter = 0; @@ -115,25 +144,28 @@ class format_string_compiler : public error_handler { handler_(part::make_text({begin, to_unsigned(end - begin)})); } - FMT_CONSTEXPR void on_arg_id() { + FMT_CONSTEXPR int on_arg_id() { part_ = part::make_arg_index(parse_context_.next_arg_id()); + return 0; } - FMT_CONSTEXPR void on_arg_id(int id) { + FMT_CONSTEXPR int on_arg_id(int id) { parse_context_.check_arg_id(id); part_ = part::make_arg_index(id); + return 0; } - FMT_CONSTEXPR void on_arg_id(basic_string_view id) { + FMT_CONSTEXPR int on_arg_id(basic_string_view id) { part_ = part::make_arg_name(id); + return 0; } - FMT_CONSTEXPR void on_replacement_field(const Char* ptr) { + FMT_CONSTEXPR void on_replacement_field(int, const Char* ptr) { part_.arg_id_end = ptr; handler_(part_); } - FMT_CONSTEXPR const Char* on_format_specs(const Char* begin, + FMT_CONSTEXPR const Char* on_format_specs(int, const Char* begin, const Char* end) { auto repl = typename part::replacement(); dynamic_specs_handler> handler( @@ -159,23 +191,24 @@ FMT_CONSTEXPR void compile_format_string(basic_string_view format_str, format_string_compiler(format_str, handler)); } -template +template void format_arg( - basic_format_parse_context& parse_ctx, + basic_format_parse_context& parse_ctx, Context& ctx, Id arg_id) { - ctx.advance_to( - visit_format_arg(arg_formatter(ctx, &parse_ctx), ctx.arg(arg_id))); + ctx.advance_to(visit_format_arg( + arg_formatter(ctx, &parse_ctx), + ctx.arg(arg_id))); } // vformat_to is defined in a subnamespace to prevent ADL. namespace cf { -template -auto vformat_to(Range out, CompiledFormat& cf, basic_format_args args) - -> typename Context::iterator { +template +auto vformat_to(OutputIt out, CompiledFormat& cf, + basic_format_args args) -> typename Context::iterator { using char_type = typename Context::char_type; basic_format_parse_context parse_ctx( to_string_view(cf.format_str_)); - Context ctx(out.begin(), args); + Context ctx(out, args); const auto& parts = cf.parts(); for (auto part_it = std::begin(parts); part_it != std::end(parts); @@ -196,12 +229,12 @@ auto vformat_to(Range out, CompiledFormat& cf, basic_format_args args) case format_part_t::kind::arg_index: advance_to(parse_ctx, part.arg_id_end); - internal::format_arg(parse_ctx, ctx, value.arg_index); + detail::format_arg(parse_ctx, ctx, value.arg_index); break; case format_part_t::kind::arg_name: advance_to(parse_ctx, part.arg_id_end); - internal::format_arg(parse_ctx, ctx, value.str); + detail::format_arg(parse_ctx, ctx, value.str); break; case format_part_t::kind::replacement: { @@ -225,7 +258,9 @@ auto vformat_to(Range out, CompiledFormat& cf, basic_format_args args) advance_to(parse_ctx, part.arg_id_end); ctx.advance_to( - visit_format_arg(arg_formatter(ctx, nullptr, &specs), arg)); + visit_format_arg(arg_formatter( + ctx, nullptr, &specs), + arg)); break; } } @@ -239,7 +274,7 @@ struct basic_compiled_format {}; template struct compiled_format_base : basic_compiled_format { using char_type = char_t; - using parts_container = std::vector>; + using parts_container = std::vector>; parts_container compiled_parts; @@ -304,7 +339,7 @@ struct compiled_format_base::value>> const parts_container& parts() const { static FMT_CONSTEXPR_DECL const auto compiled_parts = compile_to_parts( - internal::to_string_view(S())); + detail::to_string_view(S())); return compiled_parts.data; } }; @@ -317,8 +352,8 @@ class compiled_format : private compiled_format_base { private: basic_string_view format_str_; - template - friend auto cf::vformat_to(Range out, CompiledFormat& cf, + template + friend auto cf::vformat_to(OutputIt out, CompiledFormat& cf, basic_format_args args) -> typename Context::iterator; @@ -333,7 +368,8 @@ template struct type_list {}; // Returns a reference to the argument at index N from [first, rest...]. template -constexpr const auto& get(const T& first, const Args&... rest) { +constexpr const auto& get([[maybe_unused]] const T& first, + [[maybe_unused]] const Args&... rest) { static_assert(N < 1 + sizeof...(Args), "index is out of bounds"); if constexpr (N == 0) return first; @@ -350,49 +386,39 @@ template struct get_type_impl> { template using get_type = typename get_type_impl::type; +template struct is_compiled_format : std::false_type {}; + template struct text { basic_string_view data; using char_type = Char; template OutputIt format(OutputIt out, const Args&...) const { - // TODO: reserve - return copy_str(data.begin(), data.end(), out); + return write(out, data); } }; +template +struct is_compiled_format> : std::true_type {}; + template constexpr text make_text(basic_string_view s, size_t pos, size_t size) { return {{&s[pos], size}}; } -template , int> = 0> -OutputIt format_default(OutputIt out, T value) { - // TODO: reserve - format_int fi(value); - return std::copy(fi.data(), fi.data() + fi.size(), out); -} - -template -OutputIt format_default(OutputIt out, double value) { - writer w(out); - w.write(value); - return w.out(); -} +template struct code_unit { + Char value; + using char_type = Char; -template -OutputIt format_default(OutputIt out, Char value) { - *out++ = value; - return out; -} + template + OutputIt format(OutputIt out, const Args&...) const { + return write(out, value); + } +}; -template -OutputIt format_default(OutputIt out, const Char* value) { - auto length = std::char_traits::length(value); - return copy_str(value, value + length, out); -} +template +struct is_compiled_format> : std::true_type {}; // A replacement field that refers to argument N. template struct field { @@ -402,10 +428,32 @@ template struct field { OutputIt format(OutputIt out, const Args&... args) const { // This ensures that the argument type is convertile to `const T&`. const T& arg = get(args...); - return format_default(out, arg); + return write(out, arg); } }; +template +struct is_compiled_format> : std::true_type {}; + +// A replacement field that refers to argument N and has format specifiers. +template struct spec_field { + using char_type = Char; + mutable formatter fmt; + + template + OutputIt format(OutputIt out, const Args&... args) const { + // This ensures that the argument type is convertile to `const T&`. + const T& arg = get(args...); + const auto& vargs = + make_format_args>(args...); + basic_format_context ctx(out, vargs); + return fmt.format(arg, ctx); + } +}; + +template +struct is_compiled_format> : std::true_type {}; + template struct concat { L lhs; R rhs; @@ -418,6 +466,9 @@ template struct concat { } }; +template +struct is_compiled_format> : std::true_type {}; + template constexpr concat make_concat(L lhs, R rhs) { return {lhs, rhs}; @@ -438,7 +489,8 @@ constexpr auto compile_format_string(S format_str); template constexpr auto parse_tail(T head, S format_str) { - if constexpr (POS != to_string_view(format_str).size()) { + if constexpr (POS != + basic_string_view(format_str).size()) { constexpr auto tail = compile_format_string(format_str); if constexpr (std::is_same, unknown_format>()) @@ -450,6 +502,22 @@ constexpr auto parse_tail(T head, S format_str) { } } +template struct parse_specs_result { + formatter fmt; + size_t end; + int next_arg_id; +}; + +template +constexpr parse_specs_result parse_specs(basic_string_view str, + size_t pos, int arg_id) { + str.remove_prefix(pos); + auto ctx = basic_format_parse_context(str, {}, arg_id + 1); + auto f = formatter(); + auto end = f.parse(ctx); + return {f, pos + (end - str.data()) + 1, ctx.next_arg_id()}; +} + // Compiles a non-empty format string and returns the compiled representation // or unknown_format() on unrecognized input. template @@ -463,12 +531,13 @@ constexpr auto compile_format_string(S format_str) { return parse_tail(make_text(str, POS, 1), format_str); } else if constexpr (str[POS + 1] == '}') { using type = get_type; - if constexpr (std::is_same::value) { - return parse_tail(field(), - format_str); - } else { - return unknown_format(); - } + return parse_tail(field(), + format_str); + } else if constexpr (str[POS + 1] == ':') { + using type = get_type; + constexpr auto result = parse_specs(str, POS + 2, ID); + return parse_tail( + spec_field{result.fmt}, format_str); } else { return unknown_format(); } @@ -478,106 +547,152 @@ constexpr auto compile_format_string(S format_str) { return parse_tail(make_text(str, POS, 1), format_str); } else { constexpr auto end = parse_text(str, POS + 1); - return parse_tail(make_text(str, POS, end - POS), - format_str); + if constexpr (end - POS > 1) { + return parse_tail(make_text(str, POS, end - POS), + format_str); + } else { + return parse_tail(code_unit{str[POS]}, + format_str); + } } } -#endif // __cpp_if_constexpr -} // namespace internal -#if FMT_USE_CONSTEXPR -# ifdef __cpp_if_constexpr template ::value)> + FMT_ENABLE_IF(is_compile_string::value || + detail::is_compiled_string::value)> constexpr auto compile(S format_str) { constexpr basic_string_view str = format_str; if constexpr (str.size() == 0) { - return internal::make_text(str, 0, 0); + return detail::make_text(str, 0, 0); } else { constexpr auto result = - internal::compile_format_string, 0, 0>( + detail::compile_format_string, 0, 0>( format_str); if constexpr (std::is_same, - internal::unknown_format>()) { - return internal::compiled_format(to_string_view(format_str)); + detail::unknown_format>()) { + return detail::compiled_format(to_string_view(format_str)); } else { return result; } } } +#else +template ::value)> +constexpr auto compile(S format_str) -> detail::compiled_format { + return detail::compiled_format(to_string_view(format_str)); +} +#endif // __cpp_if_constexpr + +// Compiles the format string which must be a string literal. +template +auto compile(const Char (&format_str)[N]) + -> detail::compiled_format { + return detail::compiled_format( + basic_string_view(format_str, N - 1)); +} +} // namespace detail + +// DEPRECATED! use FMT_COMPILE instead. +template +FMT_DEPRECATED auto compile(const Args&... args) + -> decltype(detail::compile(args...)) { + return detail::compile(args...); +} + +#if FMT_USE_CONSTEXPR +# ifdef __cpp_if_constexpr template ::value)> -std::basic_string format(const CompiledFormat& cf, const Args&... args) { + FMT_ENABLE_IF(detail::is_compiled_format::value)> +FMT_INLINE std::basic_string format(const CompiledFormat& cf, + const Args&... args) { basic_memory_buffer buffer; - cf.format(std::back_inserter(buffer), args...); + cf.format(detail::buffer_appender(buffer), args...); return to_string(buffer); } template ::value)> + FMT_ENABLE_IF(detail::is_compiled_format::value)> OutputIt format_to(OutputIt out, const CompiledFormat& cf, const Args&... args) { return cf.format(out, args...); } -# else -template ::value)> -constexpr auto compile(S format_str) -> internal::compiled_format { - return internal::compiled_format(to_string_view(format_str)); -} # endif // __cpp_if_constexpr #endif // FMT_USE_CONSTEXPR -// Compiles the format string which must be a string literal. -template -auto compile(const Char (&format_str)[N]) - -> internal::compiled_format { - return internal::compiled_format( - basic_string_view(format_str, N - 1)); -} - template ::value)> std::basic_string format(const CompiledFormat& cf, const Args&... args) { basic_memory_buffer buffer; - using range = buffer_range; using context = buffer_context; - internal::cf::vformat_to(range(buffer), cf, - {make_format_args(args...)}); + detail::cf::vformat_to(detail::buffer_appender(buffer), cf, + make_format_args(args...)); return to_string(buffer); } +template ::value)> +FMT_INLINE std::basic_string format(const S&, + Args&&... args) { +#ifdef __cpp_if_constexpr + if constexpr (std::is_same::value) { + constexpr basic_string_view str = S(); + if (str.size() == 2 && str[0] == '{' && str[1] == '}') + return fmt::to_string(detail::first(args...)); + } +#endif + constexpr auto compiled = detail::compile(S()); + return format(compiled, std::forward(args)...); +} + template ::value)> OutputIt format_to(OutputIt out, const CompiledFormat& cf, const Args&... args) { using char_type = typename CompiledFormat::char_type; - using range = internal::output_range; using context = format_context_t; - return internal::cf::vformat_to( - range(out), cf, {make_format_args(args...)}); + return detail::cf::vformat_to(out, cf, + make_format_args(args...)); +} + +template ::value)> +OutputIt format_to(OutputIt out, const S&, const Args&... args) { + constexpr auto compiled = detail::compile(S()); + return format_to(out, compiled, args...); } template ::value)> + FMT_ENABLE_IF(detail::is_output_iterator< + OutputIt, typename CompiledFormat::char_type>::value&& + std::is_base_of::value)> format_to_n_result format_to_n(OutputIt out, size_t n, const CompiledFormat& cf, const Args&... args) { auto it = - format_to(internal::truncating_iterator(out, n), cf, args...); + format_to(detail::truncating_iterator(out, n), cf, args...); + return {it.base(), it.count()}; +} + +template ::value)> +format_to_n_result format_to_n(OutputIt out, size_t n, const S&, + const Args&... args) { + constexpr auto compiled = detail::compile(S()); + auto it = format_to(detail::truncating_iterator(out, n), compiled, + args...); return {it.base(), it.count()}; } template -std::size_t formatted_size(const CompiledFormat& cf, const Args&... args) { - return format_to(internal::counting_iterator(), cf, args...).count(); +size_t formatted_size(const CompiledFormat& cf, const Args&... args) { + return format_to(detail::counting_iterator(), cf, args...).count(); } FMT_END_NAMESPACE diff --git a/Externals/fmt/include/fmt/core.h b/Externals/fmt/include/fmt/core.h index 9fd8df287851..2903be5a0715 100755 --- a/Externals/fmt/include/fmt/core.h +++ b/Externals/fmt/include/fmt/core.h @@ -10,30 +10,20 @@ #include // std::FILE #include +#include #include +#include #include #include +#include // The fmt library version in the form major * 10000 + minor * 100 + patch. -#define FMT_VERSION 60102 +#define FMT_VERSION 70100 -#ifdef __has_feature -# define FMT_HAS_FEATURE(x) __has_feature(x) -#else -# define FMT_HAS_FEATURE(x) 0 -#endif - -#if defined(__has_include) && !defined(__INTELLISENSE__) && \ - !(defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1600) -# define FMT_HAS_INCLUDE(x) __has_include(x) +#ifdef __clang__ +# define FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__) #else -# define FMT_HAS_INCLUDE(x) 0 -#endif - -#ifdef __has_cpp_attribute -# define FMT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) -#else -# define FMT_HAS_CPP_ATTRIBUTE(x) 0 +# define FMT_CLANG_VERSION 0 #endif #if defined(__GNUC__) && !defined(__clang__) @@ -42,6 +32,12 @@ # define FMT_GCC_VERSION 0 #endif +#if defined(__INTEL_COMPILER) +# define FMT_ICC_VERSION __INTEL_COMPILER +#else +# define FMT_ICC_VERSION 0 +#endif + #if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) # define FMT_HAS_GXX_CXX11 FMT_GCC_VERSION #else @@ -56,17 +52,44 @@ #ifdef _MSC_VER # define FMT_MSC_VER _MSC_VER +# define FMT_SUPPRESS_MSC_WARNING(n) __pragma(warning(suppress : n)) #else # define FMT_MSC_VER 0 +# define FMT_SUPPRESS_MSC_WARNING(n) #endif +#ifdef __has_feature +# define FMT_HAS_FEATURE(x) __has_feature(x) +#else +# define FMT_HAS_FEATURE(x) 0 +#endif + +#if defined(__has_include) && !defined(__INTELLISENSE__) && \ + (!FMT_ICC_VERSION || FMT_ICC_VERSION >= 1600) +# define FMT_HAS_INCLUDE(x) __has_include(x) +#else +# define FMT_HAS_INCLUDE(x) 0 +#endif + +#ifdef __has_cpp_attribute +# define FMT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) +#else +# define FMT_HAS_CPP_ATTRIBUTE(x) 0 +#endif + +#define FMT_HAS_CPP14_ATTRIBUTE(attribute) \ + (__cplusplus >= 201402L && FMT_HAS_CPP_ATTRIBUTE(attribute)) + +#define FMT_HAS_CPP17_ATTRIBUTE(attribute) \ + (__cplusplus >= 201703L && FMT_HAS_CPP_ATTRIBUTE(attribute)) + // Check if relaxed C++14 constexpr is supported. // GCC doesn't allow throw in constexpr until version 6 (bug 67371). #ifndef FMT_USE_CONSTEXPR # define FMT_USE_CONSTEXPR \ (FMT_HAS_FEATURE(cxx_relaxed_constexpr) || FMT_MSC_VER >= 1910 || \ (FMT_GCC_VERSION >= 600 && __cplusplus >= 201402L)) && \ - !FMT_NVCC + !FMT_NVCC && !FMT_ICC_VERSION #endif #if FMT_USE_CONSTEXPR # define FMT_CONSTEXPR constexpr @@ -77,7 +100,7 @@ #endif #ifndef FMT_OVERRIDE -# if FMT_HAS_FEATURE(cxx_override) || \ +# if FMT_HAS_FEATURE(cxx_override_control) || \ (FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1900 # define FMT_OVERRIDE override # else @@ -117,19 +140,20 @@ # endif #endif -// [[noreturn]] is disabled on MSVC because of bogus unreachable code warnings. -#if FMT_EXCEPTIONS && FMT_HAS_CPP_ATTRIBUTE(noreturn) && !FMT_MSC_VER +// [[noreturn]] is disabled on MSVC and NVCC because of bogus unreachable code +// warnings. +#if FMT_EXCEPTIONS && FMT_HAS_CPP_ATTRIBUTE(noreturn) && !FMT_MSC_VER && \ + !FMT_NVCC # define FMT_NORETURN [[noreturn]] #else # define FMT_NORETURN #endif #ifndef FMT_DEPRECATED -# if (FMT_HAS_CPP_ATTRIBUTE(deprecated) && __cplusplus >= 201402L) || \ - FMT_MSC_VER >= 1900 +# if FMT_HAS_CPP14_ATTRIBUTE(deprecated) || FMT_MSC_VER >= 1900 # define FMT_DEPRECATED [[deprecated]] # else -# if defined(__GNUC__) || defined(__clang__) +# if (defined(__GNUC__) && !defined(__LCC__)) || defined(__clang__) # define FMT_DEPRECATED __attribute__((deprecated)) # elif FMT_MSC_VER # define FMT_DEPRECATED __declspec(deprecated) @@ -139,16 +163,32 @@ # endif #endif -// Workaround broken [[deprecated]] in the Intel compiler and NVCC. -#if defined(__INTEL_COMPILER) || FMT_NVCC +// Workaround broken [[deprecated]] in the Intel, PGI and NVCC compilers. +#if FMT_ICC_VERSION || defined(__PGI) || FMT_NVCC # define FMT_DEPRECATED_ALIAS #else # define FMT_DEPRECATED_ALIAS FMT_DEPRECATED #endif -#ifndef FMT_BEGIN_NAMESPACE +#ifndef FMT_INLINE +# if FMT_GCC_VERSION || FMT_CLANG_VERSION +# define FMT_INLINE inline __attribute__((always_inline)) +# else +# define FMT_INLINE inline +# endif +#endif + +#ifndef FMT_USE_INLINE_NAMESPACES # if FMT_HAS_FEATURE(cxx_inline_namespaces) || FMT_GCC_VERSION >= 404 || \ - FMT_MSC_VER >= 1900 + (FMT_MSC_VER >= 1900 && !_MANAGED) +# define FMT_USE_INLINE_NAMESPACES 1 +# else +# define FMT_USE_INLINE_NAMESPACES 0 +# endif +#endif + +#ifndef FMT_BEGIN_NAMESPACE +# if FMT_USE_INLINE_NAMESPACES # define FMT_INLINE_NAMESPACE inline namespace # define FMT_END_NAMESPACE \ } \ @@ -157,21 +197,26 @@ # define FMT_INLINE_NAMESPACE namespace # define FMT_END_NAMESPACE \ } \ - using namespace v6; \ + using namespace v7; \ } # endif # define FMT_BEGIN_NAMESPACE \ namespace fmt { \ - FMT_INLINE_NAMESPACE v6 { + FMT_INLINE_NAMESPACE v7 { #endif #if !defined(FMT_HEADER_ONLY) && defined(_WIN32) +# define FMT_CLASS_API FMT_SUPPRESS_MSC_WARNING(4275) # ifdef FMT_EXPORT # define FMT_API __declspec(dllexport) +# define FMT_EXTERN_TEMPLATE_API FMT_API +# define FMT_EXPORTED # elif defined(FMT_SHARED) # define FMT_API __declspec(dllimport) # define FMT_EXTERN_TEMPLATE_API FMT_API # endif +#else +# define FMT_CLASS_API #endif #ifndef FMT_API # define FMT_API @@ -179,6 +224,9 @@ #ifndef FMT_EXTERN_TEMPLATE_API # define FMT_EXTERN_TEMPLATE_API #endif +#ifndef FMT_INSTANTIATION_DEF_API +# define FMT_INSTANTIATION_DEF_API FMT_API +#endif #ifndef FMT_HEADER_ONLY # define FMT_EXTERN extern @@ -197,9 +245,16 @@ # define FMT_USE_EXPERIMENTAL_STRING_VIEW #endif +#ifndef FMT_UNICODE +# define FMT_UNICODE !FMT_MSC_VER +#endif +#if FMT_UNICODE && FMT_MSC_VER +# pragma execution_character_set("utf-8") +#endif + FMT_BEGIN_NAMESPACE -// Implementations of enable_if_t and other types for pre-C++14 systems. +// Implementations of enable_if_t and other metafunctions for older systems. template using enable_if_t = typename std::enable_if::type; template @@ -211,6 +266,8 @@ template using remove_const_t = typename std::remove_const::type; template using remove_cvref_t = typename std::remove_cv>::type; +template struct type_identity { using type = T; }; +template using type_identity_t = typename type_identity::type; struct monostate {}; @@ -219,21 +276,23 @@ struct monostate {}; // to workaround a bug in MSVC 2019 (see #1140 and #1186). #define FMT_ENABLE_IF(...) enable_if_t<(__VA_ARGS__), int> = 0 -namespace internal { +namespace detail { -// A workaround for gcc 4.8 to make void_t work in a SFINAE context. -template struct void_t_impl { using type = void; }; +// A helper function to suppress "conditional expression is constant" warnings. +template constexpr T const_check(T value) { return value; } -FMT_API void assert_fail(const char* file, int line, const char* message); +FMT_NORETURN FMT_API void assert_fail(const char* file, int line, + const char* message); #ifndef FMT_ASSERT # ifdef NDEBUG -# define FMT_ASSERT(condition, message) +// FMT_ASSERT is not empty to avoid -Werror=empty-body. +# define FMT_ASSERT(condition, message) ((void)0) # else -# define FMT_ASSERT(condition, message) \ - ((condition) \ - ? void() \ - : fmt::internal::assert_fail(__FILE__, __LINE__, (message))) +# define FMT_ASSERT(condition, message) \ + ((condition) /* void() fails with -Winvalid-constexpr on clang 4.0.1 */ \ + ? (void)0 \ + : ::fmt::detail::assert_fail(__FILE__, __LINE__, (message))) # endif #endif @@ -248,7 +307,8 @@ template struct std_string_view {}; #ifdef FMT_USE_INT128 // Do nothing. -#elif defined(__SIZEOF_INT128__) +#elif defined(__SIZEOF_INT128__) && !FMT_NVCC && \ + !(FMT_CLANG_VERSION && FMT_MSC_VER) # define FMT_USE_INT128 1 using int128_t = __int128_t; using uint128_t = __uint128_t; @@ -266,10 +326,24 @@ FMT_CONSTEXPR typename std::make_unsigned::type to_unsigned(Int value) { FMT_ASSERT(value >= 0, "negative value"); return static_cast::type>(value); } -} // namespace internal -template -using void_t = typename internal::void_t_impl::type; +FMT_SUPPRESS_MSC_WARNING(4566) constexpr unsigned char micro[] = "\u00B5"; + +template constexpr bool is_unicode() { + return FMT_UNICODE || sizeof(Char) != 1 || + (sizeof(micro) == 3 && micro[0] == 0xC2 && micro[1] == 0xB5); +} + +#ifdef __cpp_char8_t +using char8_type = char8_t; +#else +enum char8_type : unsigned char {}; +#endif +} // namespace detail + +#ifdef FMT_USE_INTERNAL +namespace internal = detail; // DEPRECATED +#endif /** An implementation of ``std::basic_string_view`` for pre-C++17. It provides a @@ -284,13 +358,13 @@ template class basic_string_view { size_t size_; public: - using char_type = Char; + using value_type = Char; using iterator = const Char*; - FMT_CONSTEXPR basic_string_view() FMT_NOEXCEPT : data_(nullptr), size_(0) {} + constexpr basic_string_view() FMT_NOEXCEPT : data_(nullptr), size_(0) {} /** Constructs a string reference object from a C string and a size. */ - FMT_CONSTEXPR basic_string_view(const Char* s, size_t count) FMT_NOEXCEPT + constexpr basic_string_view(const Char* s, size_t count) FMT_NOEXCEPT : data_(s), size_(count) {} @@ -300,6 +374,9 @@ template class basic_string_view { the size with ``std::char_traits::length``. \endrst */ +#if __cplusplus >= 201703L // C++17's char_traits::length() is constexpr. + FMT_CONSTEXPR +#endif basic_string_view(const Char* s) : data_(s), size_(std::char_traits::length(s)) {} @@ -310,22 +387,21 @@ template class basic_string_view { : data_(s.data()), size_(s.size()) {} - template < - typename S, - FMT_ENABLE_IF(std::is_same>::value)> + template >::value)> FMT_CONSTEXPR basic_string_view(S s) FMT_NOEXCEPT : data_(s.data()), size_(s.size()) {} /** Returns a pointer to the string data. */ - FMT_CONSTEXPR const Char* data() const { return data_; } + constexpr const Char* data() const { return data_; } /** Returns the string size. */ - FMT_CONSTEXPR size_t size() const { return size_; } + constexpr size_t size() const { return size_; } - FMT_CONSTEXPR iterator begin() const { return data_; } - FMT_CONSTEXPR iterator end() const { return data_ + size_; } + constexpr iterator begin() const { return data_; } + constexpr iterator end() const { return data_ + size_; } - FMT_CONSTEXPR const Char& operator[](size_t pos) const { return data_[pos]; } + constexpr const Char& operator[](size_t pos) const { return data_[pos]; } FMT_CONSTEXPR void remove_prefix(size_t n) { data_ += n; @@ -364,16 +440,11 @@ template class basic_string_view { using string_view = basic_string_view; using wstring_view = basic_string_view; -#ifndef __cpp_char8_t -// A UTF-8 code unit type. -enum char8_t : unsigned char {}; -#endif - /** Specifies if ``T`` is a character type. Can be specialized by users. */ template struct is_char : std::false_type {}; template <> struct is_char : std::true_type {}; template <> struct is_char : std::true_type {}; -template <> struct is_char : std::true_type {}; +template <> struct is_char : std::true_type {}; template <> struct is_char : std::true_type {}; template <> struct is_char : std::true_type {}; @@ -410,14 +481,13 @@ inline basic_string_view to_string_view(basic_string_view s) { } template >::value)> -inline basic_string_view to_string_view( - internal::std_string_view s) { + FMT_ENABLE_IF(!std::is_empty>::value)> +inline basic_string_view to_string_view(detail::std_string_view s) { return s; } // A base class for compile-time strings. It is defined in the fmt namespace to -// make formatting functions visible via ADL, e.g. format(fmt("{}"), 42). +// make formatting functions visible via ADL, e.g. format(FMT_STRING("{}"), 42). struct compile_string {}; template @@ -428,9 +498,9 @@ constexpr basic_string_view to_string_view(const S& s) { return s; } -namespace internal { +namespace detail { void to_string_view(...); -using fmt::v6::to_string_view; +using fmt::v7::to_string_view; // Specifies whether S is a string type convertible to fmt::basic_string_view. // It should be a constexpr function but MSVC 2017 fails to compile it in @@ -442,20 +512,32 @@ struct is_string : std::is_class()))> { template struct char_t_impl {}; template struct char_t_impl::value>> { using result = decltype(to_string_view(std::declval())); - using type = typename result::char_type; + using type = typename result::value_type; }; +// Reports a compile-time error if S is not a valid format string. +template ::value)> +FMT_INLINE void check_format_string(const S&) { +#ifdef FMT_ENFORCE_COMPILE_STRING + static_assert(is_compile_string::value, + "FMT_ENFORCE_COMPILE_STRING requires all format strings to use " + "FMT_STRING."); +#endif +} +template ::value)> +void check_format_string(S); + struct error_handler { - FMT_CONSTEXPR error_handler() = default; - FMT_CONSTEXPR error_handler(const error_handler&) = default; + constexpr error_handler() = default; + constexpr error_handler(const error_handler&) = default; // This function is intentionally not constexpr to give a compile-time error. FMT_NORETURN FMT_API void on_error(const char* message); }; -} // namespace internal +} // namespace detail /** String's character type. */ -template using char_t = typename internal::char_t_impl::type; +template using char_t = typename detail::char_t_impl::type; /** \rst @@ -473,7 +555,7 @@ template using char_t = typename internal::char_t_impl::type; +-----------------------+-------------------------------------+ \endrst */ -template +template class basic_format_parse_context : private ErrorHandler { private: basic_string_view format_str_; @@ -483,26 +565,25 @@ class basic_format_parse_context : private ErrorHandler { using char_type = Char; using iterator = typename basic_string_view::iterator; - explicit FMT_CONSTEXPR basic_format_parse_context( - basic_string_view format_str, ErrorHandler eh = ErrorHandler()) - : ErrorHandler(eh), format_str_(format_str), next_arg_id_(0) {} + explicit constexpr basic_format_parse_context( + basic_string_view format_str, ErrorHandler eh = {}, + int next_arg_id = 0) + : ErrorHandler(eh), format_str_(format_str), next_arg_id_(next_arg_id) {} /** Returns an iterator to the beginning of the format string range being parsed. */ - FMT_CONSTEXPR iterator begin() const FMT_NOEXCEPT { - return format_str_.begin(); - } + constexpr iterator begin() const FMT_NOEXCEPT { return format_str_.begin(); } /** Returns an iterator past the end of the format string range being parsed. */ - FMT_CONSTEXPR iterator end() const FMT_NOEXCEPT { return format_str_.end(); } + constexpr iterator end() const FMT_NOEXCEPT { return format_str_.end(); } /** Advances the begin iterator to ``it``. */ FMT_CONSTEXPR void advance_to(iterator it) { - format_str_.remove_prefix(internal::to_unsigned(it - begin())); + format_str_.remove_prefix(detail::to_unsigned(it - begin())); } /** @@ -510,6 +591,8 @@ class basic_format_parse_context : private ErrorHandler { the next argument index and switches to the automatic indexing. */ FMT_CONSTEXPR int next_arg_id() { + // Don't check if the argument id is valid to avoid overhead and because it + // will be checked during formatting anyway. if (next_arg_id_ >= 0) return next_arg_id_++; on_error("cannot switch from manual to automatic argument indexing"); return 0; @@ -532,20 +615,15 @@ class basic_format_parse_context : private ErrorHandler { ErrorHandler::on_error(message); } - FMT_CONSTEXPR ErrorHandler error_handler() const { return *this; } + constexpr ErrorHandler error_handler() const { return *this; } }; using format_parse_context = basic_format_parse_context; using wformat_parse_context = basic_format_parse_context; -template -using basic_parse_context FMT_DEPRECATED_ALIAS = - basic_format_parse_context; -using parse_context FMT_DEPRECATED_ALIAS = basic_format_parse_context; -using wparse_context FMT_DEPRECATED_ALIAS = basic_format_parse_context; - template class basic_format_arg; template class basic_format_args; +template class dynamic_format_arg_store; // A formatter for objects of type T. template @@ -554,43 +632,62 @@ struct formatter { formatter() = delete; }; -template -struct FMT_DEPRECATED convert_to_int - : bool_constant::value && - std::is_convertible::value> {}; - // Specifies if T has an enabled formatter specialization. A type can be // formattable even if it doesn't have a formatter e.g. via a conversion. template using has_formatter = std::is_constructible>; -namespace internal { +// Checks whether T is a container with contiguous storage. +template struct is_contiguous : std::false_type {}; +template +struct is_contiguous> : std::true_type {}; + +namespace detail { + +// Extracts a reference to the container from back_insert_iterator. +template +inline Container& get_container(std::back_insert_iterator it) { + using bi_iterator = std::back_insert_iterator; + struct accessor : bi_iterator { + accessor(bi_iterator iter) : bi_iterator(iter) {} + using bi_iterator::container; + }; + return *accessor(it).container; +} -/** A contiguous memory buffer with an optional growing ability. */ +/** + \rst + A contiguous memory buffer with an optional growing ability. It is an internal + class and shouldn't be used directly, only via `~fmt::basic_memory_buffer`. + \endrst + */ template class buffer { private: T* ptr_; - std::size_t size_; - std::size_t capacity_; + size_t size_; + size_t capacity_; protected: // Don't initialize ptr_ since it is not accessed to save a few cycles. - buffer(std::size_t sz) FMT_NOEXCEPT : size_(sz), capacity_(sz) {} + FMT_SUPPRESS_MSC_WARNING(26495) + buffer(size_t sz) FMT_NOEXCEPT : size_(sz), capacity_(sz) {} - buffer(T* p = nullptr, std::size_t sz = 0, std::size_t cap = 0) FMT_NOEXCEPT + buffer(T* p = nullptr, size_t sz = 0, size_t cap = 0) FMT_NOEXCEPT : ptr_(p), size_(sz), capacity_(cap) {} + ~buffer() = default; + /** Sets the buffer data and capacity. */ - void set(T* buf_data, std::size_t buf_capacity) FMT_NOEXCEPT { + void set(T* buf_data, size_t buf_capacity) FMT_NOEXCEPT { ptr_ = buf_data; capacity_ = buf_capacity; } /** Increases the buffer capacity to hold at least *capacity* elements. */ - virtual void grow(std::size_t capacity) = 0; + virtual void grow(size_t capacity) = 0; public: using value_type = T; @@ -598,16 +695,18 @@ template class buffer { buffer(const buffer&) = delete; void operator=(const buffer&) = delete; - virtual ~buffer() = default; T* begin() FMT_NOEXCEPT { return ptr_; } T* end() FMT_NOEXCEPT { return ptr_ + size_; } + const T* begin() const FMT_NOEXCEPT { return ptr_; } + const T* end() const FMT_NOEXCEPT { return ptr_ + size_; } + /** Returns the size of this buffer. */ - std::size_t size() const FMT_NOEXCEPT { return size_; } + size_t size() const FMT_NOEXCEPT { return size_; } /** Returns the capacity of this buffer. */ - std::size_t capacity() const FMT_NOEXCEPT { return capacity_; } + size_t capacity() const FMT_NOEXCEPT { return capacity_; } /** Returns a pointer to the buffer data. */ T* data() FMT_NOEXCEPT { return ptr_; } @@ -615,60 +714,182 @@ template class buffer { /** Returns a pointer to the buffer data. */ const T* data() const FMT_NOEXCEPT { return ptr_; } - /** - Resizes the buffer. If T is a POD type new elements may not be initialized. - */ - void resize(std::size_t new_size) { - reserve(new_size); - size_ = new_size; - } - /** Clears this buffer. */ void clear() { size_ = 0; } - /** Reserves space to store at least *capacity* elements. */ - void reserve(std::size_t new_capacity) { + // Tries resizing the buffer to contain *count* elements. If T is a POD type + // the new elements may not be initialized. + void try_resize(size_t count) { + try_reserve(count); + size_ = count <= capacity_ ? count : capacity_; + } + + // Tries increasing the buffer capacity to *new_capacity*. It can increase the + // capacity by a smaller amount than requested but guarantees there is space + // for at least one additional element either by increasing the capacity or by + // flushing the buffer if it is full. + void try_reserve(size_t new_capacity) { if (new_capacity > capacity_) grow(new_capacity); } void push_back(const T& value) { - reserve(size_ + 1); + try_reserve(size_ + 1); ptr_[size_++] = value; } /** Appends data to the end of the buffer. */ template void append(const U* begin, const U* end); - T& operator[](std::size_t index) { return ptr_[index]; } - const T& operator[](std::size_t index) const { return ptr_[index]; } + template T& operator[](I index) { return ptr_[index]; } + template const T& operator[](I index) const { + return ptr_[index]; + } +}; + +struct buffer_traits { + explicit buffer_traits(size_t) {} + size_t count() const { return 0; } + size_t limit(size_t size) { return size; } +}; + +class fixed_buffer_traits { + private: + size_t count_ = 0; + size_t limit_; + + public: + explicit fixed_buffer_traits(size_t limit) : limit_(limit) {} + size_t count() const { return count_; } + size_t limit(size_t size) { + size_t n = limit_ - count_; + count_ += size; + return size < n ? size : n; + } }; -// A container-backed buffer. +// A buffer that writes to an output iterator when flushed. +template +class iterator_buffer final : public Traits, public buffer { + private: + OutputIt out_; + enum { buffer_size = 256 }; + T data_[buffer_size]; + + protected: + void grow(size_t) final FMT_OVERRIDE { + if (this->size() == buffer_size) flush(); + } + void flush(); + + public: + explicit iterator_buffer(OutputIt out, size_t n = buffer_size) + : Traits(n), + buffer(data_, 0, n < size_t(buffer_size) ? n : size_t(buffer_size)), + out_(out) {} + ~iterator_buffer() { flush(); } + + OutputIt out() { + flush(); + return out_; + } + size_t count() const { return Traits::count() + this->size(); } +}; + +template class iterator_buffer final : public buffer { + protected: + void grow(size_t) final FMT_OVERRIDE {} + + public: + explicit iterator_buffer(T* out, size_t = 0) : buffer(out, 0, ~size_t()) {} + + T* out() { return &*this->end(); } +}; + +// A buffer that writes to a container with the contiguous storage. template -class container_buffer : public buffer { +class iterator_buffer, + enable_if_t::value, + typename Container::value_type>> + final : public buffer { private: Container& container_; protected: - void grow(std::size_t capacity) FMT_OVERRIDE { + void grow(size_t capacity) final FMT_OVERRIDE { container_.resize(capacity); this->set(&container_[0], capacity); } public: - explicit container_buffer(Container& c) + explicit iterator_buffer(Container& c) : buffer(c.size()), container_(c) {} + explicit iterator_buffer(std::back_insert_iterator out, size_t = 0) + : iterator_buffer(get_container(out)) {} + std::back_insert_iterator out() { + return std::back_inserter(container_); + } }; -// Extracts a reference to the container from back_insert_iterator. -template -inline Container& get_container(std::back_insert_iterator it) { - using bi_iterator = std::back_insert_iterator; - struct accessor : bi_iterator { - accessor(bi_iterator iter) : bi_iterator(iter) {} - using bi_iterator::container; - }; - return *accessor(it).container; +// A buffer that counts the number of code units written discarding the output. +template class counting_buffer final : public buffer { + private: + enum { buffer_size = 256 }; + T data_[buffer_size]; + size_t count_ = 0; + + protected: + void grow(size_t) final FMT_OVERRIDE { + if (this->size() != buffer_size) return; + count_ += this->size(); + this->clear(); + } + + public: + counting_buffer() : buffer(data_, 0, buffer_size) {} + + size_t count() { return count_ + this->size(); } +}; + +// An output iterator that appends to the buffer. +// It is used to reduce symbol sizes for the common case. +template +class buffer_appender : public std::back_insert_iterator> { + using base = std::back_insert_iterator>; + + public: + explicit buffer_appender(buffer& buf) : base(buf) {} + buffer_appender(base it) : base(it) {} + + buffer_appender& operator++() { + base::operator++(); + return *this; + } + + buffer_appender operator++(int) { + buffer_appender tmp = *this; + ++*this; + return tmp; + } +}; + +// Maps an output iterator into a buffer. +template +iterator_buffer get_buffer(OutputIt); +template buffer& get_buffer(buffer_appender); + +template OutputIt get_buffer_init(OutputIt out) { + return out; +} +template buffer& get_buffer_init(buffer_appender out) { + return get_container(out); +} + +template +auto get_iterator(Buffer& buf) -> decltype(buf.out()) { + return buf.out(); +} +template buffer_appender get_iterator(buffer& buf) { + return buffer_appender(buf); } template @@ -681,12 +902,80 @@ template using has_fallback_formatter = std::is_constructible>; -template struct named_arg_base; -template struct named_arg; +struct view {}; + +template struct named_arg : view { + const Char* name; + const T& value; + named_arg(const Char* n, const T& v) : name(n), value(v) {} +}; -enum type { +template struct named_arg_info { + const Char* name; + int id; +}; + +template +struct arg_data { + // args_[0].named_args points to named_args_ to avoid bloating format_args. + // +1 to workaround a bug in gcc 7.5 that causes duplicated-branches warning. + T args_[1 + (NUM_ARGS != 0 ? NUM_ARGS : +1)]; + named_arg_info named_args_[NUM_NAMED_ARGS]; + + template + arg_data(const U&... init) : args_{T(named_args_, NUM_NAMED_ARGS), init...} {} + arg_data(const arg_data& other) = delete; + const T* args() const { return args_ + 1; } + named_arg_info* named_args() { return named_args_; } +}; + +template +struct arg_data { + // +1 to workaround a bug in gcc 7.5 that causes duplicated-branches warning. + T args_[NUM_ARGS != 0 ? NUM_ARGS : +1]; + + template + FMT_INLINE arg_data(const U&... init) : args_{init...} {} + FMT_INLINE const T* args() const { return args_; } + FMT_INLINE std::nullptr_t named_args() { return nullptr; } +}; + +template +inline void init_named_args(named_arg_info*, int, int) {} + +template +void init_named_args(named_arg_info* named_args, int arg_count, + int named_arg_count, const T&, const Tail&... args) { + init_named_args(named_args, arg_count + 1, named_arg_count, args...); +} + +template +void init_named_args(named_arg_info* named_args, int arg_count, + int named_arg_count, const named_arg& arg, + const Tail&... args) { + named_args[named_arg_count++] = {arg.name, arg_count}; + init_named_args(named_args, arg_count + 1, named_arg_count, args...); +} + +template +FMT_INLINE void init_named_args(std::nullptr_t, int, int, const Args&...) {} + +template struct is_named_arg : std::false_type {}; + +template +struct is_named_arg> : std::true_type {}; + +template constexpr size_t count() { return B ? 1 : 0; } +template constexpr size_t count() { + return (B1 ? 1 : 0) + count(); +} + +template constexpr size_t count_named_args() { + return count::value...>(); +} + +enum class type { none_type, - named_arg_type, // Integer types should go first, int_type, uint_type, @@ -710,13 +999,13 @@ enum type { // Maps core type T to the corresponding type enum constant. template -struct type_constant : std::integral_constant {}; +struct type_constant : std::integral_constant {}; #define FMT_TYPE_CONSTANT(Type, constant) \ template \ - struct type_constant : std::integral_constant {} + struct type_constant \ + : std::integral_constant {} -FMT_TYPE_CONSTANT(const named_arg_base&, named_arg_type); FMT_TYPE_CONSTANT(int, int_type); FMT_TYPE_CONSTANT(unsigned, uint_type); FMT_TYPE_CONSTANT(long long, long_long_type); @@ -732,23 +1021,26 @@ FMT_TYPE_CONSTANT(const Char*, cstring_type); FMT_TYPE_CONSTANT(basic_string_view, string_type); FMT_TYPE_CONSTANT(const void*, pointer_type); -FMT_CONSTEXPR bool is_integral_type(type t) { - FMT_ASSERT(t != named_arg_type, "invalid argument type"); - return t > none_type && t <= last_integer_type; +constexpr bool is_integral_type(type t) { + return t > type::none_type && t <= type::last_integer_type; } -FMT_CONSTEXPR bool is_arithmetic_type(type t) { - FMT_ASSERT(t != named_arg_type, "invalid argument type"); - return t > none_type && t <= last_numeric_type; +constexpr bool is_arithmetic_type(type t) { + return t > type::none_type && t <= type::last_numeric_type; } template struct string_value { const Char* data; - std::size_t size; + size_t size; +}; + +template struct named_arg_value { + const named_arg_info* data; + size_t size; }; template struct custom_value { - using parse_context = basic_format_parse_context; + using parse_context = typename Context::parse_context_type; const void* value; void (*format)(const void* arg, parse_context& parse_ctx, Context& ctx); }; @@ -773,28 +1065,30 @@ template class value { const void* pointer; string_value string; custom_value custom; - const named_arg_base* named_arg; + named_arg_value named_args; }; - FMT_CONSTEXPR value(int val = 0) : int_value(val) {} - FMT_CONSTEXPR value(unsigned val) : uint_value(val) {} - value(long long val) : long_long_value(val) {} - value(unsigned long long val) : ulong_long_value(val) {} - value(int128_t val) : int128_value(val) {} - value(uint128_t val) : uint128_value(val) {} - value(float val) : float_value(val) {} - value(double val) : double_value(val) {} - value(long double val) : long_double_value(val) {} - value(bool val) : bool_value(val) {} - value(char_type val) : char_value(val) {} - value(const char_type* val) { string.data = val; } - value(basic_string_view val) { + constexpr FMT_INLINE value(int val = 0) : int_value(val) {} + constexpr FMT_INLINE value(unsigned val) : uint_value(val) {} + FMT_INLINE value(long long val) : long_long_value(val) {} + FMT_INLINE value(unsigned long long val) : ulong_long_value(val) {} + FMT_INLINE value(int128_t val) : int128_value(val) {} + FMT_INLINE value(uint128_t val) : uint128_value(val) {} + FMT_INLINE value(float val) : float_value(val) {} + FMT_INLINE value(double val) : double_value(val) {} + FMT_INLINE value(long double val) : long_double_value(val) {} + FMT_INLINE value(bool val) : bool_value(val) {} + FMT_INLINE value(char_type val) : char_value(val) {} + FMT_INLINE value(const char_type* val) { string.data = val; } + FMT_INLINE value(basic_string_view val) { string.data = val.data(); string.size = val.size(); } - value(const void* val) : pointer(val) {} + FMT_INLINE value(const void* val) : pointer(val) {} + FMT_INLINE value(const named_arg_info* args, size_t size) + : named_args{args, size} {} - template value(const T& val) { + template FMT_INLINE value(const T& val) { custom.value = &val; // Get the formatter type through the context to allow different contexts // have different extension points, e.g. `formatter` for `format` and @@ -805,14 +1099,12 @@ template class value { fallback_formatter>>; } - value(const named_arg_base& val) { named_arg = &val; } - private: // Formats an argument of a custom type, such as a user-defined class. template - static void format_custom_arg( - const void* arg, basic_format_parse_context& parse_ctx, - Context& ctx) { + static void format_custom_arg(const void* arg, + typename Context::parse_context_type& parse_ctx, + Context& ctx) { Formatter f; parse_ctx.advance_to(f.parse(parse_ctx)); ctx.advance_to(f.format(*static_cast(arg), ctx)); @@ -828,6 +1120,8 @@ enum { long_short = sizeof(long) == sizeof(int) }; using long_type = conditional_t; using ulong_type = conditional_t; +struct unformattable {}; + // Maps formatting arguments to core types. template struct arg_mapper { using char_type = typename Context::char_type; @@ -869,7 +1163,8 @@ template struct arg_mapper { template , T>::value && - !is_string::value)> + !is_string::value && !has_formatter::value && + !has_fallback_formatter::value)> FMT_CONSTEXPR basic_string_view map(const T& val) { return basic_string_view(val); } @@ -878,7 +1173,8 @@ template struct arg_mapper { FMT_ENABLE_IF( std::is_constructible, T>::value && !std::is_constructible, T>::value && - !is_string::value && !has_formatter::value)> + !is_string::value && !has_formatter::value && + !has_fallback_formatter::value)> FMT_CONSTEXPR basic_string_view map(const T& val) { return std_string_view(val); } @@ -890,6 +1186,14 @@ template struct arg_mapper { static_assert(std::is_same::value, "invalid string type"); return reinterpret_cast(val); } + FMT_CONSTEXPR const char* map(signed char* val) { + const auto* const_val = val; + return map(const_val); + } + FMT_CONSTEXPR const char* map(unsigned char* val) { + const auto* const_val = val; + return map(const_val); + } FMT_CONSTEXPR const void* map(void* val) { return val; } FMT_CONSTEXPR const void* map(const void* val) { return val; } @@ -907,29 +1211,26 @@ template struct arg_mapper { FMT_ENABLE_IF(std::is_enum::value && !has_formatter::value && !has_fallback_formatter::value)> - FMT_CONSTEXPR auto map(const T& val) -> decltype( - map(static_cast::type>(val))) { + FMT_CONSTEXPR auto map(const T& val) + -> decltype(std::declval().map( + static_cast::type>(val))) { return map(static_cast::type>(val)); } - template < - typename T, - FMT_ENABLE_IF( - !is_string::value && !is_char::value && - !std::is_constructible, T>::value && - (has_formatter::value || - (has_fallback_formatter::value && - !std::is_constructible, T>::value)))> + template ::value && !is_char::value && + (has_formatter::value || + has_fallback_formatter::value))> FMT_CONSTEXPR const T& map(const T& val) { return val; } template - FMT_CONSTEXPR const named_arg_base& map( - const named_arg& val) { - auto arg = make_arg(val.value); - std::memcpy(val.data, &arg, sizeof(arg)); - return val; + FMT_CONSTEXPR auto map(const named_arg& val) + -> decltype(std::declval().map(val.value)) { + return map(val.value); } + + unformattable map(...) { return {}; } }; // A type constant after applying arg_mapper. @@ -938,23 +1239,22 @@ using mapped_type_constant = type_constant().map(std::declval())), typename Context::char_type>; -enum { packed_arg_bits = 5 }; +enum { packed_arg_bits = 4 }; // Maximum number of arguments with packed types. -enum { max_packed_args = 63 / packed_arg_bits }; +enum { max_packed_args = 62 / packed_arg_bits }; enum : unsigned long long { is_unpacked_bit = 1ULL << 63 }; - -template class arg_map; -} // namespace internal +enum : unsigned long long { has_named_args_bit = 1ULL << 62 }; +} // namespace detail // A formatting argument. It is a trivially copyable/constructible type to // allow storage in basic_memory_buffer. template class basic_format_arg { private: - internal::value value_; - internal::type type_; + detail::value value_; + detail::type type_; template - friend FMT_CONSTEXPR basic_format_arg internal::make_arg( + friend FMT_CONSTEXPR basic_format_arg detail::make_arg( const T& value); template @@ -963,34 +1263,40 @@ template class basic_format_arg { -> decltype(vis(0)); friend class basic_format_args; - friend class internal::arg_map; + friend class dynamic_format_arg_store; using char_type = typename Context::char_type; + template + friend struct detail::arg_data; + + basic_format_arg(const detail::named_arg_info* args, size_t size) + : value_(args, size) {} + public: class handle { public: - explicit handle(internal::custom_value custom) : custom_(custom) {} + explicit handle(detail::custom_value custom) : custom_(custom) {} - void format(basic_format_parse_context& parse_ctx, + void format(typename Context::parse_context_type& parse_ctx, Context& ctx) const { custom_.format(custom_.value, parse_ctx, ctx); } private: - internal::custom_value custom_; + detail::custom_value custom_; }; - FMT_CONSTEXPR basic_format_arg() : type_(internal::none_type) {} + constexpr basic_format_arg() : type_(detail::type::none_type) {} - FMT_CONSTEXPR explicit operator bool() const FMT_NOEXCEPT { - return type_ != internal::none_type; + constexpr explicit operator bool() const FMT_NOEXCEPT { + return type_ != detail::type::none_type; } - internal::type type() const { return type_; } + detail::type type() const { return type_; } - bool is_integral() const { return internal::is_integral_type(type_); } - bool is_arithmetic() const { return internal::is_arithmetic_type(type_); } + bool is_integral() const { return detail::is_integral_type(type_); } + bool is_arithmetic() const { return detail::is_arithmetic_type(type_); } }; /** @@ -1001,92 +1307,86 @@ template class basic_format_arg { \endrst */ template -FMT_CONSTEXPR auto visit_format_arg(Visitor&& vis, - const basic_format_arg& arg) - -> decltype(vis(0)) { +FMT_CONSTEXPR_DECL FMT_INLINE auto visit_format_arg( + Visitor&& vis, const basic_format_arg& arg) -> decltype(vis(0)) { using char_type = typename Context::char_type; switch (arg.type_) { - case internal::none_type: - break; - case internal::named_arg_type: - FMT_ASSERT(false, "invalid argument type"); + case detail::type::none_type: break; - case internal::int_type: + case detail::type::int_type: return vis(arg.value_.int_value); - case internal::uint_type: + case detail::type::uint_type: return vis(arg.value_.uint_value); - case internal::long_long_type: + case detail::type::long_long_type: return vis(arg.value_.long_long_value); - case internal::ulong_long_type: + case detail::type::ulong_long_type: return vis(arg.value_.ulong_long_value); #if FMT_USE_INT128 - case internal::int128_type: + case detail::type::int128_type: return vis(arg.value_.int128_value); - case internal::uint128_type: + case detail::type::uint128_type: return vis(arg.value_.uint128_value); #else - case internal::int128_type: - case internal::uint128_type: + case detail::type::int128_type: + case detail::type::uint128_type: break; #endif - case internal::bool_type: + case detail::type::bool_type: return vis(arg.value_.bool_value); - case internal::char_type: + case detail::type::char_type: return vis(arg.value_.char_value); - case internal::float_type: + case detail::type::float_type: return vis(arg.value_.float_value); - case internal::double_type: + case detail::type::double_type: return vis(arg.value_.double_value); - case internal::long_double_type: + case detail::type::long_double_type: return vis(arg.value_.long_double_value); - case internal::cstring_type: + case detail::type::cstring_type: return vis(arg.value_.string.data); - case internal::string_type: + case detail::type::string_type: return vis(basic_string_view(arg.value_.string.data, arg.value_.string.size)); - case internal::pointer_type: + case detail::type::pointer_type: return vis(arg.value_.pointer); - case internal::custom_type: + case detail::type::custom_type: return vis(typename basic_format_arg::handle(arg.value_.custom)); } return vis(monostate()); } -namespace internal { -// A map from argument names to their values for named arguments. -template class arg_map { - private: - using char_type = typename Context::char_type; +template struct formattable : std::false_type {}; - struct entry { - basic_string_view name; - basic_format_arg arg; - }; +namespace detail { + +// A workaround for gcc 4.8 to make void_t work in a SFINAE context. +template struct void_t_impl { using type = void; }; +template +using void_t = typename detail::void_t_impl::type; - entry* map_; - unsigned size_; +template +struct is_output_iterator : std::false_type {}; - void push_back(value val) { - const auto& named = *val.named_arg; - map_[size_] = {named.name, named.template deserialize()}; - ++size_; - } +template +struct is_output_iterator< + It, T, + void_t::iterator_category, + decltype(*std::declval() = std::declval())>> + : std::true_type {}; - public: - arg_map(const arg_map&) = delete; - void operator=(const arg_map&) = delete; - arg_map() : map_(nullptr), size_(0) {} - void init(const basic_format_args& args); - ~arg_map() { delete[] map_; } - - basic_format_arg find(basic_string_view name) const { - // The list is unsorted, so just return the first matching name. - for (entry *it = map_, *end = map_ + size_; it != end; ++it) { - if (it->name == name) return it->arg; - } - return {}; - } -}; +template +struct is_back_insert_iterator : std::false_type {}; +template +struct is_back_insert_iterator> + : std::true_type {}; + +template +struct is_contiguous_back_insert_iterator : std::false_type {}; +template +struct is_contiguous_back_insert_iterator> + : is_contiguous {}; +template +struct is_contiguous_back_insert_iterator> + : std::true_type {}; // A type-erased reference to an std::locale to avoid heavy include. class locale_ref { @@ -1106,7 +1406,7 @@ template constexpr unsigned long long encode_types() { return 0; } template constexpr unsigned long long encode_types() { - return mapped_type_constant::value | + return static_cast(mapped_type_constant::value) | (encode_types() << packed_arg_bits); } @@ -1118,18 +1418,73 @@ FMT_CONSTEXPR basic_format_arg make_arg(const T& value) { return arg; } -template int check(unformattable) { + static_assert( + formattable(), + "Cannot format an argument. To make type T formattable provide a " + "formatter specialization: https://fmt.dev/latest/api.html#udt"); + return 0; +} +template inline const U& check(const U& val) { + return val; +} + +// The type template parameter is there to avoid an ODR violation when using +// a fallback formatter in one translation unit and an implicit conversion in +// another (not recommended). +template inline value make_arg(const T& val) { - return arg_mapper().map(val); + return check(arg_mapper().map(val)); } -template inline basic_format_arg make_arg(const T& value) { return make_arg(value); } -} // namespace internal + +template struct is_reference_wrapper : std::false_type {}; +template +struct is_reference_wrapper> : std::true_type {}; + +template const T& unwrap(const T& v) { return v; } +template const T& unwrap(const std::reference_wrapper& v) { + return static_cast(v); +} + +class dynamic_arg_list { + // Workaround for clang's -Wweak-vtables. Unlike for regular classes, for + // templates it doesn't complain about inability to deduce single translation + // unit for placing vtable. So storage_node_base is made a fake template. + template struct node { + virtual ~node() = default; + std::unique_ptr> next; + }; + + template struct typed_node : node<> { + T value; + + template + FMT_CONSTEXPR typed_node(const Arg& arg) : value(arg) {} + + template + FMT_CONSTEXPR typed_node(const basic_string_view& arg) + : value(arg.data(), arg.size()) {} + }; + + std::unique_ptr> head_; + + public: + template const T& push(const Arg& arg) { + auto new_node = std::unique_ptr>(new typed_node(arg)); + auto& value = new_node->value; + new_node->next = std::move(head_); + head_ = std::move(new_node); + return value; + } +}; +} // namespace detail // Formatting context. template class basic_format_context { @@ -1140,12 +1495,12 @@ template class basic_format_context { private: OutputIt out_; basic_format_args args_; - internal::arg_map map_; - internal::locale_ref loc_; + detail::locale_ref loc_; public: using iterator = OutputIt; using format_arg = basic_format_arg; + using parse_context_type = basic_format_parse_context; template using formatter_type = formatter; basic_format_context(const basic_format_context&) = delete; @@ -1156,34 +1511,38 @@ template class basic_format_context { */ basic_format_context(OutputIt out, basic_format_args ctx_args, - internal::locale_ref loc = internal::locale_ref()) + detail::locale_ref loc = detail::locale_ref()) : out_(out), args_(ctx_args), loc_(loc) {} format_arg arg(int id) const { return args_.get(id); } + format_arg arg(basic_string_view name) { return args_.get(name); } + int arg_id(basic_string_view name) { return args_.get_id(name); } + const basic_format_args& args() const { return args_; } - // Checks if manual indexing is used and returns the argument with the - // specified name. - format_arg arg(basic_string_view name); - - internal::error_handler error_handler() { return {}; } + detail::error_handler error_handler() { return {}; } void on_error(const char* message) { error_handler().on_error(message); } // Returns an iterator to the beginning of the output range. iterator out() { return out_; } // Advances the begin iterator to ``it``. - void advance_to(iterator it) { out_ = it; } + void advance_to(iterator it) { + if (!detail::is_back_insert_iterator()) out_ = it; + } - internal::locale_ref locale() { return loc_; } + detail::locale_ref locale() { return loc_; } }; template using buffer_context = - basic_format_context>, - Char>; + basic_format_context, Char>; using format_context = buffer_context; using wformat_context = buffer_context; +// Workaround an alias issue: https://stackoverflow.com/q/62767544/471164. +#define FMT_BUFFER_CONTEXT(Char) \ + basic_format_context, Char> + /** \rst An array of references to arguments. It can be implicitly converted into @@ -1191,31 +1550,50 @@ using wformat_context = buffer_context; such as `~fmt::vformat`. \endrst */ -template class format_arg_store { +template +class format_arg_store +#if FMT_GCC_VERSION && FMT_GCC_VERSION < 409 + // Workaround a GCC template argument substitution bug. + : public basic_format_args +#endif +{ private: static const size_t num_args = sizeof...(Args); - static const bool is_packed = num_args < internal::max_packed_args; + static const size_t num_named_args = detail::count_named_args(); + static const bool is_packed = num_args <= detail::max_packed_args; - using value_type = conditional_t, + using value_type = conditional_t, basic_format_arg>; - // If the arguments are not packed, add one more element to mark the end. - value_type data_[num_args + (num_args == 0 ? 1 : 0)]; + detail::arg_data + data_; friend class basic_format_args; - public: - static constexpr unsigned long long types = - is_packed ? internal::encode_types() - : internal::is_unpacked_bit | num_args; + static constexpr unsigned long long desc = + (is_packed ? detail::encode_types() + : detail::is_unpacked_bit | num_args) | + (num_named_args != 0 + ? static_cast(detail::has_named_args_bit) + : 0); + public: format_arg_store(const Args&... args) - : data_{internal::make_arg(args)...} {} + : +#if FMT_GCC_VERSION && FMT_GCC_VERSION < 409 + basic_format_args(*this), +#endif + data_{detail::make_arg< + is_packed, Context, + detail::mapped_type_constant::value>(args)...} { + detail::init_named_args(data_.named_args(), 0, 0, args...); + } }; /** \rst - Constructs an `~fmt::format_arg_store` object that contains references to + Constructs a `~fmt::format_arg_store` object that contains references to arguments and can be implicitly converted to `~fmt::format_args`. `Context` can be omitted in which case it defaults to `~fmt::context`. See `~fmt::arg` for lifetime considerations. @@ -1227,56 +1605,266 @@ inline format_arg_store make_format_args( return {args...}; } -/** Formatting arguments. */ +/** + \rst + Constructs a `~fmt::format_arg_store` object that contains references + to arguments and can be implicitly converted to `~fmt::format_args`. + If ``format_str`` is a compile-time string then `make_args_checked` checks + its validity at compile time. + \endrst + */ +template > +inline auto make_args_checked(const S& format_str, + const remove_reference_t&... args) + -> format_arg_store, remove_reference_t...> { + static_assert( + detail::count<( + std::is_base_of>::value && + std::is_reference::value)...>() == 0, + "passing views as lvalues is disallowed"); + detail::check_format_string(format_str); + return {args...}; +} + +/** + \rst + Returns a named argument to be used in a formatting function. It should only + be used in a call to a formatting function. + + **Example**:: + + fmt::print("Elapsed time: {s:.2f} seconds", fmt::arg("s", 1.23)); + \endrst + */ +template +inline detail::named_arg arg(const Char* name, const T& arg) { + static_assert(!detail::is_named_arg(), "nested named arguments"); + return {name, arg}; +} + +/** + \rst + A dynamic version of `fmt::format_arg_store`. + It's equipped with a storage to potentially temporary objects which lifetimes + could be shorter than the format arguments object. + + It can be implicitly converted into `~fmt::basic_format_args` for passing + into type-erased formatting functions such as `~fmt::vformat`. + \endrst + */ +template +class dynamic_format_arg_store +#if FMT_GCC_VERSION && FMT_GCC_VERSION < 409 + // Workaround a GCC template argument substitution bug. + : public basic_format_args +#endif +{ + private: + using char_type = typename Context::char_type; + + template struct need_copy { + static constexpr detail::type mapped_type = + detail::mapped_type_constant::value; + + enum { + value = !(detail::is_reference_wrapper::value || + std::is_same>::value || + std::is_same>::value || + (mapped_type != detail::type::cstring_type && + mapped_type != detail::type::string_type && + mapped_type != detail::type::custom_type)) + }; + }; + + template + using stored_type = conditional_t::value, + std::basic_string, T>; + + // Storage of basic_format_arg must be contiguous. + std::vector> data_; + std::vector> named_info_; + + // Storage of arguments not fitting into basic_format_arg must grow + // without relocation because items in data_ refer to it. + detail::dynamic_arg_list dynamic_args_; + + friend class basic_format_args; + + unsigned long long get_types() const { + return detail::is_unpacked_bit | data_.size() | + (named_info_.empty() + ? 0ULL + : static_cast(detail::has_named_args_bit)); + } + + const basic_format_arg* data() const { + return named_info_.empty() ? data_.data() : data_.data() + 1; + } + + template void emplace_arg(const T& arg) { + data_.emplace_back(detail::make_arg(arg)); + } + + template + void emplace_arg(const detail::named_arg& arg) { + if (named_info_.empty()) { + constexpr const detail::named_arg_info* zero_ptr{nullptr}; + data_.insert(data_.begin(), {zero_ptr, 0}); + } + data_.emplace_back(detail::make_arg(detail::unwrap(arg.value))); + auto pop_one = [](std::vector>* data) { + data->pop_back(); + }; + std::unique_ptr>, decltype(pop_one)> + guard{&data_, pop_one}; + named_info_.push_back({arg.name, static_cast(data_.size() - 2u)}); + data_[0].value_.named_args = {named_info_.data(), named_info_.size()}; + guard.release(); + } + + public: + /** + \rst + Adds an argument into the dynamic store for later passing to a formatting + function. + + Note that custom types and string types (but not string views) are copied + into the store dynamically allocating memory if necessary. + + **Example**:: + + fmt::dynamic_format_arg_store store; + store.push_back(42); + store.push_back("abc"); + store.push_back(1.5f); + std::string result = fmt::vformat("{} and {} and {}", store); + \endrst + */ + template void push_back(const T& arg) { + if (detail::const_check(need_copy::value)) + emplace_arg(dynamic_args_.push>(arg)); + else + emplace_arg(detail::unwrap(arg)); + } + + /** + \rst + Adds a reference to the argument into the dynamic store for later passing to + a formatting function. Supports named arguments wrapped in + ``std::reference_wrapper`` via ``std::ref()``/``std::cref()``. + + **Example**:: + + fmt::dynamic_format_arg_store store; + char str[] = "1234567890"; + store.push_back(std::cref(str)); + int a1_val{42}; + auto a1 = fmt::arg("a1_", a1_val); + store.push_back(std::cref(a1)); + + // Changing str affects the output but only for string and custom types. + str[0] = 'X'; + + std::string result = fmt::vformat("{} and {a1_}"); + assert(result == "X234567890 and 42"); + \endrst + */ + template void push_back(std::reference_wrapper arg) { + static_assert( + detail::is_named_arg::type>::value || + need_copy::value, + "objects of built-in types and string views are always copied"); + emplace_arg(arg.get()); + } + + /** + Adds named argument into the dynamic store for later passing to a formatting + function. ``std::reference_wrapper`` is supported to avoid copying of the + argument. + */ + template + void push_back(const detail::named_arg& arg) { + const char_type* arg_name = + dynamic_args_.push>(arg.name).c_str(); + if (detail::const_check(need_copy::value)) { + emplace_arg( + fmt::arg(arg_name, dynamic_args_.push>(arg.value))); + } else { + emplace_arg(fmt::arg(arg_name, arg.value)); + } + } + + /** Erase all elements from the store */ + void clear() { + data_.clear(); + named_info_.clear(); + dynamic_args_ = detail::dynamic_arg_list(); + } + + /** + \rst + Reserves space to store at least *new_cap* arguments including + *new_cap_named* named arguments. + \endrst + */ + void reserve(size_t new_cap, size_t new_cap_named) { + FMT_ASSERT(new_cap >= new_cap_named, + "Set of arguments includes set of named arguments"); + data_.reserve(new_cap); + named_info_.reserve(new_cap_named); + } +}; + +/** + \rst + A view of a collection of formatting arguments. To avoid lifetime issues it + should only be used as a parameter type in type-erased functions such as + ``vformat``:: + + void vlog(string_view format_str, format_args args); // OK + format_args args = make_format_args(42); // Error: dangling reference + \endrst + */ template class basic_format_args { public: using size_type = int; using format_arg = basic_format_arg; private: - // To reduce compiled code size per formatting function call, types of first - // max_packed_args arguments are passed in the types_ field. - unsigned long long types_; + // A descriptor that contains information about formatting arguments. + // If the number of arguments is less or equal to max_packed_args then + // argument types are passed in the descriptor. This reduces binary code size + // per formatting function call. + unsigned long long desc_; union { - // If the number of arguments is less than max_packed_args, the argument - // values are stored in values_, otherwise they are stored in args_. - // This is done to reduce compiled code size as storing larger objects + // If is_packed() returns true then argument values are stored in values_; + // otherwise they are stored in args_. This is done to improve cache + // locality and reduce compiled code size since storing larger objects // may require more code (at least on x86-64) even if the same amount of // data is actually copied to stack. It saves ~10% on the bloat test. - const internal::value* values_; + const detail::value* values_; const format_arg* args_; }; - bool is_packed() const { return (types_ & internal::is_unpacked_bit) == 0; } - - internal::type type(int index) const { - int shift = index * internal::packed_arg_bits; - unsigned int mask = (1 << internal::packed_arg_bits) - 1; - return static_cast((types_ >> shift) & mask); + bool is_packed() const { return (desc_ & detail::is_unpacked_bit) == 0; } + bool has_named_args() const { + return (desc_ & detail::has_named_args_bit) != 0; } - friend class internal::arg_map; - - void set_data(const internal::value* values) { values_ = values; } - void set_data(const format_arg* args) { args_ = args; } - - format_arg do_get(int index) const { - format_arg arg; - if (!is_packed()) { - auto num_args = max_size(); - if (index < num_args) arg = args_[index]; - return arg; - } - if (index > internal::max_packed_args) return arg; - arg.type_ = type(index); - if (arg.type_ == internal::none_type) return arg; - internal::value& val = arg.value_; - val = values_[index]; - return arg; + detail::type type(int index) const { + int shift = index * detail::packed_arg_bits; + unsigned int mask = (1 << detail::packed_arg_bits) - 1; + return static_cast((desc_ >> shift) & mask); } + basic_format_args(unsigned long long desc, + const detail::value* values) + : desc_(desc), values_(values) {} + basic_format_args(unsigned long long desc, const format_arg* args) + : desc_(desc), args_(args) {} + public: - basic_format_args() : types_(0) {} + basic_format_args() : desc_(0) {} /** \rst @@ -1284,10 +1872,17 @@ template class basic_format_args { \endrst */ template - basic_format_args(const format_arg_store& store) - : types_(store.types) { - set_data(store.data_); - } + FMT_INLINE basic_format_args(const format_arg_store& store) + : basic_format_args(store.desc, store.data_.args()) {} + + /** + \rst + Constructs a `basic_format_args` object from + `~fmt::dynamic_format_arg_store`. + \endrst + */ + FMT_INLINE basic_format_args(const dynamic_format_arg_store& store) + : basic_format_args(store.get_types(), store.data()) {} /** \rst @@ -1295,22 +1890,42 @@ template class basic_format_args { \endrst */ basic_format_args(const format_arg* args, int count) - : types_(internal::is_unpacked_bit | internal::to_unsigned(count)) { - set_data(args); - } + : basic_format_args(detail::is_unpacked_bit | detail::to_unsigned(count), + args) {} - /** Returns the argument at specified index. */ - format_arg get(int index) const { - format_arg arg = do_get(index); - if (arg.type_ == internal::named_arg_type) - arg = arg.value_.named_arg->template deserialize(); + /** Returns the argument with the specified id. */ + format_arg get(int id) const { + format_arg arg; + if (!is_packed()) { + if (id < max_size()) arg = args_[id]; + return arg; + } + if (id >= detail::max_packed_args) return arg; + arg.type_ = type(id); + if (arg.type_ == detail::type::none_type) return arg; + arg.value_ = values_[id]; return arg; } + template format_arg get(basic_string_view name) const { + int id = get_id(name); + return id >= 0 ? get(id) : format_arg(); + } + + template int get_id(basic_string_view name) const { + if (!has_named_args()) return -1; + const auto& named_args = + (is_packed() ? values_[-1] : args_[-1].value_).named_args; + for (size_t i = 0; i < named_args.size; ++i) { + if (named_args.data[i].name == name) return named_args.data[i].id; + } + return -1; + } + int max_size() const { - unsigned long long max_packed = internal::max_packed_args; + unsigned long long max_packed = detail::max_packed_args; return static_cast(is_packed() ? max_packed - : types_ & ~internal::is_unpacked_bit); + : desc_ & ~detail::is_unpacked_bit); } }; @@ -1318,145 +1933,121 @@ template class basic_format_args { // It is a separate type rather than an alias to make symbols readable. struct format_args : basic_format_args { template - format_args(Args&&... args) - : basic_format_args(std::forward(args)...) {} + FMT_INLINE format_args(const Args&... args) : basic_format_args(args...) {} }; struct wformat_args : basic_format_args { - template - wformat_args(Args&&... args) - : basic_format_args(std::forward(args)...) {} + using basic_format_args::basic_format_args; }; -template struct is_contiguous : std::false_type {}; - -template -struct is_contiguous> : std::true_type {}; - -template -struct is_contiguous> : std::true_type {}; - -namespace internal { +namespace detail { -template -struct is_contiguous_back_insert_iterator : std::false_type {}; -template -struct is_contiguous_back_insert_iterator> - : is_contiguous {}; - -template struct named_arg_base { - basic_string_view name; - - // Serialized value. - mutable char data[sizeof(basic_format_arg>)]; +template ::value)> +std::basic_string vformat( + basic_string_view format_str, + basic_format_args>> args); - named_arg_base(basic_string_view nm) : name(nm) {} +FMT_API std::string vformat(string_view format_str, format_args args); - template basic_format_arg deserialize() const { - basic_format_arg arg; - std::memcpy(&arg, data, sizeof(basic_format_arg)); - return arg; - } -}; +template +void vformat_to( + buffer& buf, basic_string_view format_str, + basic_format_args)> args, + detail::locale_ref loc = {}); -template struct named_arg : named_arg_base { - const T& value; +template ::value)> +inline void vprint_mojibake(std::FILE*, basic_string_view, const Args&) {} - named_arg(basic_string_view name, const T& val) - : named_arg_base(name), value(val) {} -}; - -template ::value)> -inline void check_format_string(const S&) { -#if defined(FMT_ENFORCE_COMPILE_STRING) - static_assert(is_compile_string::value, - "FMT_ENFORCE_COMPILE_STRING requires all format strings to " - "utilize FMT_STRING() or fmt()."); +FMT_API void vprint_mojibake(std::FILE*, string_view, format_args); +#ifndef _WIN32 +inline void vprint_mojibake(std::FILE*, string_view, format_args) {} #endif -} -template ::value)> -void check_format_string(S); +} // namespace detail -struct view {}; -template struct bool_pack; -template -using all_true = - std::is_same, bool_pack>; - -template > -inline format_arg_store, remove_reference_t...> -make_args_checked(const S& format_str, - const remove_reference_t&... args) { - static_assert(all_true<(!std::is_base_of>() || - !std::is_reference())...>::value, - "passing views as lvalues is disallowed"); - check_format_string>...>(format_str); - return {args...}; +/** Formats a string and writes the output to ``out``. */ +// GCC 8 and earlier cannot handle std::back_insert_iterator with +// vformat_to(...) overload, so SFINAE on iterator type instead. +template , + FMT_ENABLE_IF(detail::is_output_iterator::value)> +OutputIt vformat_to( + OutputIt out, const S& format_str, + basic_format_args>> args) { + decltype(detail::get_buffer(out)) buf(detail::get_buffer_init(out)); + detail::vformat_to(buf, to_string_view(format_str), args); + return detail::get_iterator(buf); } -template -std::basic_string vformat(basic_string_view format_str, - basic_format_args> args); - -template -typename buffer_context::iterator vformat_to( - buffer& buf, basic_string_view format_str, - basic_format_args> args); -} // namespace internal - /** - \rst - Returns a named argument to be used in a formatting function. + \rst + Formats arguments, writes the result to the output iterator ``out`` and returns + the iterator past the end of the output range. - The named argument holds a reference and does not extend the lifetime - of its arguments. - Consequently, a dangling reference can accidentally be created. - The user should take care to only pass this function temporaries when - the named argument is itself a temporary, as per the following example. + **Example**:: - **Example**:: - - fmt::print("Elapsed time: {s:.2f} seconds", fmt::arg("s", 1.23)); - \endrst + std::vector out; + fmt::format_to(std::back_inserter(out), "{}", 42); + \endrst */ -template > -inline internal::named_arg arg(const S& name, const T& arg) { - static_assert(internal::is_string::value, ""); - return {name, arg}; +// We cannot use FMT_ENABLE_IF because of a bug in gcc 8.3. +template >::value> +inline auto format_to(OutputIt out, const S& format_str, Args&&... args) -> + typename std::enable_if::type { + const auto& vargs = fmt::make_args_checked(format_str, args...); + return vformat_to(out, to_string_view(format_str), vargs); } -// Disable nested named arguments, e.g. ``arg("a", arg("b", 42))``. -template -void arg(S, internal::named_arg) = delete; +template struct format_to_n_result { + /** Iterator past the end of the output range. */ + OutputIt out; + /** Total (not truncated) output size. */ + size_t size; +}; + +template ::value)> +inline format_to_n_result vformat_to_n( + OutputIt out, size_t n, basic_string_view format_str, + basic_format_args>> args) { + detail::iterator_buffer buf(out, + n); + detail::vformat_to(buf, format_str, args); + return {buf.out(), buf.count()}; +} -/** Formats a string and writes the output to ``out``. */ -// GCC 8 and earlier cannot handle std::back_insert_iterator with -// vformat_to(...) overload, so SFINAE on iterator type instead. -template , - FMT_ENABLE_IF( - internal::is_contiguous_back_insert_iterator::value)> -OutputIt vformat_to(OutputIt out, const S& format_str, - basic_format_args> args) { - using container = remove_reference_t; - internal::container_buffer buf((internal::get_container(out))); - internal::vformat_to(buf, to_string_view(format_str), args); - return out; +/** + \rst + Formats arguments, writes up to ``n`` characters of the result to the output + iterator ``out`` and returns the total output size and the iterator past the + end of the output range. + \endrst + */ +template >::value)> +inline format_to_n_result format_to_n(OutputIt out, size_t n, + const S& format_str, + const Args&... args) { + const auto& vargs = fmt::make_args_checked(format_str, args...); + return vformat_to_n(out, n, to_string_view(format_str), vargs); } -template ::value&& internal::is_string::value)> -inline std::back_insert_iterator format_to( - std::back_insert_iterator out, const S& format_str, - Args&&... args) { - return vformat_to( - out, to_string_view(format_str), - {internal::make_args_checked(format_str, args...)}); +/** + Returns the number of characters in the output of + ``format(format_str, args...)``. + */ +template +inline size_t formatted_size(string_view format_str, Args&&... args) { + const auto& vargs = fmt::make_args_checked(format_str, args...); + detail::counting_buffer<> buf; + detail::vformat_to(buf, format_str, vargs); + return buf.count(); } template > -inline std::basic_string vformat( - const S& format_str, basic_format_args> args) { - return internal::vformat(to_string_view(format_str), args); +FMT_INLINE std::basic_string vformat( + const S& format_str, + basic_format_args>> args) { + return detail::vformat(to_string_view(format_str), args); } /** @@ -1472,47 +2063,51 @@ inline std::basic_string vformat( // Pass char_t as a default template parameter instead of using // std::basic_string> to reduce the symbol size. template > -inline std::basic_string format(const S& format_str, Args&&... args) { - return internal::vformat( - to_string_view(format_str), - {internal::make_args_checked(format_str, args...)}); +FMT_INLINE std::basic_string format(const S& format_str, Args&&... args) { + const auto& vargs = fmt::make_args_checked(format_str, args...); + return detail::vformat(to_string_view(format_str), vargs); } -FMT_API void vprint(std::FILE* f, string_view format_str, format_args args); -FMT_API void vprint(string_view format_str, format_args args); +FMT_API void vprint(string_view, format_args); +FMT_API void vprint(std::FILE*, string_view, format_args); /** \rst - Prints formatted data to the file *f*. For wide format strings, - *f* should be in wide-oriented mode set via ``fwide(f, 1)`` or - ``_setmode(_fileno(f), _O_U8TEXT)`` on Windows. + Formats ``args`` according to specifications in ``format_str`` and writes the + output to the file ``f``. Strings are assumed to be Unicode-encoded unless the + ``FMT_UNICODE`` macro is set to 0. **Example**:: fmt::print(stderr, "Don't {}!", "panic"); \endrst */ -template ::value)> +template > inline void print(std::FILE* f, const S& format_str, Args&&... args) { - vprint(f, to_string_view(format_str), - internal::make_args_checked(format_str, args...)); + const auto& vargs = fmt::make_args_checked(format_str, args...); + return detail::is_unicode() + ? vprint(f, to_string_view(format_str), vargs) + : detail::vprint_mojibake(f, to_string_view(format_str), vargs); } /** \rst - Prints formatted data to ``stdout``. + Formats ``args`` according to specifications in ``format_str`` and writes + the output to ``stdout``. Strings are assumed to be Unicode-encoded unless + the ``FMT_UNICODE`` macro is set to 0. **Example**:: fmt::print("Elapsed time: {0:.2f} seconds", 1.23); \endrst */ -template ::value)> +template > inline void print(const S& format_str, Args&&... args) { - vprint(to_string_view(format_str), - internal::make_args_checked(format_str, args...)); + const auto& vargs = fmt::make_args_checked(format_str, args...); + return detail::is_unicode() + ? vprint(to_string_view(format_str), vargs) + : detail::vprint_mojibake(stdout, to_string_view(format_str), + vargs); } FMT_END_NAMESPACE diff --git a/Externals/fmt/include/fmt/format-inl.h b/Externals/fmt/include/fmt/format-inl.h index 72b304665df9..b7cb3209c855 100755 --- a/Externals/fmt/include/fmt/format-inl.h +++ b/Externals/fmt/include/fmt/format-inl.h @@ -8,56 +8,40 @@ #ifndef FMT_FORMAT_INL_H_ #define FMT_FORMAT_INL_H_ -#include "format.h" - #include #include #include #include #include -#include // for std::memmove +#include // std::memmove #include -#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR) -# include -#endif +#include -#if FMT_USE_WINDOWS_H -# if !defined(FMT_HEADER_ONLY) && !defined(WIN32_LEAN_AND_MEAN) -# define WIN32_LEAN_AND_MEAN -# endif -# if defined(NOMINMAX) || defined(FMT_WIN_MINMAX) -# include -# else -# define NOMINMAX -# include -# undef NOMINMAX -# endif +#ifndef FMT_STATIC_THOUSANDS_SEPARATOR +# include #endif -#if FMT_EXCEPTIONS -# define FMT_TRY try -# define FMT_CATCH(x) catch (x) -#else -# define FMT_TRY if (true) -# define FMT_CATCH(x) if (false) +#ifdef _WIN32 +# include // _isatty #endif -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable : 4702) // unreachable code -#endif +#include "format.h" // Dummy implementations of strerror_r and strerror_s called if corresponding // system functions are not available. -inline fmt::internal::null<> strerror_r(int, char*, ...) { return {}; } -inline fmt::internal::null<> strerror_s(char*, std::size_t, ...) { return {}; } +inline fmt::detail::null<> strerror_r(int, char*, ...) { return {}; } +inline fmt::detail::null<> strerror_s(char*, size_t, ...) { return {}; } FMT_BEGIN_NAMESPACE -namespace internal { +namespace detail { FMT_FUNC void assert_fail(const char* file, int line, const char* message) { - print(stderr, "{}:{}: assertion failed: {}", file, line, message); - std::abort(); + // Use unchecked std::fprintf to avoid triggering another assertion when + // writing to stderr fails + std::fprintf(stderr, "%s:%d: assertion failed: %s", file, line, message); + // Chosen instead of std::abort to satisfy Clang in CUDA mode during device + // code pass. + std::terminate(); } #ifndef _MSC_VER @@ -73,8 +57,6 @@ inline int fmt_snprintf(char* buffer, size_t size, const char* format, ...) { # define FMT_SNPRINTF fmt_snprintf #endif // _MSC_VER -using format_func = void (*)(internal::buffer&, int, string_view); - // A portable thread-safe version of strerror. // Sets buffer to point to a string describing the error code. // This can be either a pointer to a string stored in buffer, @@ -84,15 +66,15 @@ using format_func = void (*)(internal::buffer&, int, string_view); // ERANGE - buffer is not large enough to store the error message // other - failure // Buffer should be at least of size 1. -FMT_FUNC int safe_strerror(int error_code, char*& buffer, - std::size_t buffer_size) FMT_NOEXCEPT { +inline int safe_strerror(int error_code, char*& buffer, + size_t buffer_size) FMT_NOEXCEPT { FMT_ASSERT(buffer != nullptr && buffer_size != 0, "invalid buffer"); class dispatcher { private: int error_code_; char*& buffer_; - std::size_t buffer_size_; + size_t buffer_size_; // A noop assignment operator to avoid bogus warnings. void operator=(const dispatcher&) {} @@ -104,6 +86,7 @@ FMT_FUNC int safe_strerror(int error_code, char*& buffer, } // Handle the result of GNU-specific version of strerror_r. + FMT_MAYBE_UNUSED int handle(char* message) { // If the buffer is full then the message is probably truncated. if (message == buffer_ && strlen(buffer_) == buffer_size_ - 1) @@ -113,11 +96,13 @@ FMT_FUNC int safe_strerror(int error_code, char*& buffer, } // Handle the case when strerror_r is not available. - int handle(internal::null<>) { + FMT_MAYBE_UNUSED + int handle(detail::null<>) { return fallback(strerror_s(buffer_, buffer_size_, error_code_)); } // Fallback to strerror_s when strerror_r is not available. + FMT_MAYBE_UNUSED int fallback(int result) { // If the buffer is full then the message is probably truncated. return result == 0 && strlen(buffer_) == buffer_size_ - 1 ? ERANGE @@ -126,7 +111,7 @@ FMT_FUNC int safe_strerror(int error_code, char*& buffer, #if !FMT_MSC_VER // Fallback to strerror if strerror_r and strerror_s are not available. - int fallback(internal::null<>) { + int fallback(detail::null<>) { errno = 0; buffer_ = strerror(error_code_); return errno; @@ -134,7 +119,7 @@ FMT_FUNC int safe_strerror(int error_code, char*& buffer, #endif public: - dispatcher(int err_code, char*& buf, std::size_t buf_size) + dispatcher(int err_code, char*& buf, size_t buf_size) : error_code_(err_code), buffer_(buf), buffer_size_(buf_size) {} int run() { return handle(strerror_r(error_code_, buffer_, buffer_size_)); } @@ -142,41 +127,29 @@ FMT_FUNC int safe_strerror(int error_code, char*& buffer, return dispatcher(error_code, buffer, buffer_size).run(); } -FMT_FUNC void format_error_code(internal::buffer& out, int error_code, +FMT_FUNC void format_error_code(detail::buffer& out, int error_code, string_view message) FMT_NOEXCEPT { // Report error code making sure that the output fits into // inline_buffer_size to avoid dynamic memory allocation and potential // bad_alloc. - out.resize(0); + out.try_resize(0); static const char SEP[] = ": "; static const char ERROR_STR[] = "error "; // Subtract 2 to account for terminating null characters in SEP and ERROR_STR. - std::size_t error_code_size = sizeof(SEP) + sizeof(ERROR_STR) - 2; + size_t error_code_size = sizeof(SEP) + sizeof(ERROR_STR) - 2; auto abs_value = static_cast>(error_code); - if (internal::is_negative(error_code)) { + if (detail::is_negative(error_code)) { abs_value = 0 - abs_value; ++error_code_size; } - error_code_size += internal::to_unsigned(internal::count_digits(abs_value)); - internal::writer w(out); - if (message.size() <= inline_buffer_size - error_code_size) { - w.write(message); - w.write(SEP); - } - w.write(ERROR_STR); - w.write(error_code); + error_code_size += detail::to_unsigned(detail::count_digits(abs_value)); + auto it = buffer_appender(out); + if (message.size() <= inline_buffer_size - error_code_size) + format_to(it, "{}{}", message, SEP); + format_to(it, "{}{}", ERROR_STR, error_code); assert(out.size() <= inline_buffer_size); } -// A wrapper around fwrite that throws on error. -FMT_FUNC void fwrite_fully(const void* ptr, size_t size, size_t count, - FILE* stream) { - size_t written = std::fwrite(ptr, size, count, stream); - if (written < count) { - FMT_THROW(system_error(errno, "cannot write to file")); - } -} - FMT_FUNC void report_error(format_func func, int error_code, string_view message) FMT_NOEXCEPT { memory_buffer full_message; @@ -185,10 +158,17 @@ FMT_FUNC void report_error(format_func func, int error_code, (void)std::fwrite(full_message.data(), full_message.size(), 1, stderr); std::fputc('\n', stderr); } -} // namespace internal + +// A wrapper around fwrite that throws on error. +inline void fwrite_fully(const void* ptr, size_t size, size_t count, + FILE* stream) { + size_t written = std::fwrite(ptr, size, count, stream); + if (written < count) FMT_THROW(system_error(errno, "cannot write to file")); +} +} // namespace detail #if !defined(FMT_STATIC_THOUSANDS_SEPARATOR) -namespace internal { +namespace detail { template locale_ref::locale_ref(const Locale& loc) : locale_(&loc) { @@ -211,18 +191,16 @@ template FMT_FUNC Char decimal_point_impl(locale_ref loc) { return std::use_facet>(loc.get()) .decimal_point(); } -} // namespace internal +} // namespace detail #else template -FMT_FUNC std::string internal::grouping_impl(locale_ref) { +FMT_FUNC std::string detail::grouping_impl(locale_ref) { return "\03"; } -template -FMT_FUNC Char internal::thousands_sep_impl(locale_ref) { +template FMT_FUNC Char detail::thousands_sep_impl(locale_ref) { return FMT_STATIC_THOUSANDS_SEPARATOR; } -template -FMT_FUNC Char internal::decimal_point_impl(locale_ref) { +template FMT_FUNC Char detail::decimal_point_impl(locale_ref) { return '.'; } #endif @@ -239,9 +217,9 @@ FMT_FUNC void system_error::init(int err_code, string_view format_str, base = std::runtime_error(to_string(buffer)); } -namespace internal { +namespace detail { -template <> FMT_FUNC int count_digits<4>(internal::fallback_uintptr n) { +template <> FMT_FUNC int count_digits<4>(detail::fallback_uintptr n) { // fallback_uintptr is always stored in little endian. int i = static_cast(sizeof(void*)) - 1; while (i > 0 && n.value[i] == 0) --i; @@ -250,12 +228,24 @@ template <> FMT_FUNC int count_digits<4>(internal::fallback_uintptr n) { } template -const char basic_data::digits[] = - "0001020304050607080910111213141516171819" - "2021222324252627282930313233343536373839" - "4041424344454647484950515253545556575859" - "6061626364656667686970717273747576777879" - "8081828384858687888990919293949596979899"; +const typename basic_data::digit_pair basic_data::digits[] = { + {'0', '0'}, {'0', '1'}, {'0', '2'}, {'0', '3'}, {'0', '4'}, {'0', '5'}, + {'0', '6'}, {'0', '7'}, {'0', '8'}, {'0', '9'}, {'1', '0'}, {'1', '1'}, + {'1', '2'}, {'1', '3'}, {'1', '4'}, {'1', '5'}, {'1', '6'}, {'1', '7'}, + {'1', '8'}, {'1', '9'}, {'2', '0'}, {'2', '1'}, {'2', '2'}, {'2', '3'}, + {'2', '4'}, {'2', '5'}, {'2', '6'}, {'2', '7'}, {'2', '8'}, {'2', '9'}, + {'3', '0'}, {'3', '1'}, {'3', '2'}, {'3', '3'}, {'3', '4'}, {'3', '5'}, + {'3', '6'}, {'3', '7'}, {'3', '8'}, {'3', '9'}, {'4', '0'}, {'4', '1'}, + {'4', '2'}, {'4', '3'}, {'4', '4'}, {'4', '5'}, {'4', '6'}, {'4', '7'}, + {'4', '8'}, {'4', '9'}, {'5', '0'}, {'5', '1'}, {'5', '2'}, {'5', '3'}, + {'5', '4'}, {'5', '5'}, {'5', '6'}, {'5', '7'}, {'5', '8'}, {'5', '9'}, + {'6', '0'}, {'6', '1'}, {'6', '2'}, {'6', '3'}, {'6', '4'}, {'6', '5'}, + {'6', '6'}, {'6', '7'}, {'6', '8'}, {'6', '9'}, {'7', '0'}, {'7', '1'}, + {'7', '2'}, {'7', '3'}, {'7', '4'}, {'7', '5'}, {'7', '6'}, {'7', '7'}, + {'7', '8'}, {'7', '9'}, {'8', '0'}, {'8', '1'}, {'8', '2'}, {'8', '3'}, + {'8', '4'}, {'8', '5'}, {'8', '6'}, {'8', '7'}, {'8', '8'}, {'8', '9'}, + {'9', '0'}, {'9', '1'}, {'9', '2'}, {'9', '3'}, {'9', '4'}, {'9', '5'}, + {'9', '6'}, {'9', '7'}, {'9', '8'}, {'9', '9'}}; template const char basic_data::hex_digits[] = "0123456789abcdef"; @@ -271,18 +261,18 @@ const uint64_t basic_data::powers_of_10_64[] = { 10000000000000000000ULL}; template -const uint32_t basic_data::zero_or_powers_of_10_32[] = {0, +const uint32_t basic_data::zero_or_powers_of_10_32[] = {0, 0, FMT_POWERS_OF_10(1)}; template const uint64_t basic_data::zero_or_powers_of_10_64[] = { - 0, FMT_POWERS_OF_10(1), FMT_POWERS_OF_10(1000000000ULL), + 0, 0, FMT_POWERS_OF_10(1), FMT_POWERS_OF_10(1000000000ULL), 10000000000000000000ULL}; // Normalized 64-bit significands of pow(10, k), for k = -348, -340, ..., 340. // These are generated by support/compute-powers.py. template -const uint64_t basic_data::pow10_significands[] = { +const uint64_t basic_data::grisu_pow10_significands[] = { 0xfa8fd5a0081c0288, 0xbaaee17fa23ebf76, 0x8b16fb203055ac76, 0xcf42894a5dce35ea, 0x9a6bb0aa55653b2d, 0xe61acf033d1a45df, 0xab70fe17c79ac6ca, 0xff77b1fcbebcdc4f, 0xbe5691ef416bd60c, @@ -317,7 +307,7 @@ const uint64_t basic_data::pow10_significands[] = { // Binary exponents of pow(10, k), for k = -348, -340, ..., 340, corresponding // to significands above. template -const int16_t basic_data::pow10_exponents[] = { +const int16_t basic_data::grisu_pow10_exponents[] = { -1220, -1193, -1166, -1140, -1113, -1087, -1060, -1034, -1007, -980, -954, -927, -901, -874, -847, -821, -794, -768, -741, -715, -688, -661, -635, -608, -582, -555, -529, -502, -475, -449, -422, -396, -369, @@ -327,6 +317,744 @@ const int16_t basic_data::pow10_exponents[] = { 534, 561, 588, 614, 641, 667, 694, 720, 747, 774, 800, 827, 853, 880, 907, 933, 960, 986, 1013, 1039, 1066}; +template +const divtest_table_entry basic_data::divtest_table_for_pow5_32[] = + {{0x00000001, 0xffffffff}, {0xcccccccd, 0x33333333}, + {0xc28f5c29, 0x0a3d70a3}, {0x26e978d5, 0x020c49ba}, + {0x3afb7e91, 0x0068db8b}, {0x0bcbe61d, 0x0014f8b5}, + {0x68c26139, 0x000431bd}, {0xae8d46a5, 0x0000d6bf}, + {0x22e90e21, 0x00002af3}, {0x3a2e9c6d, 0x00000897}, + {0x3ed61f49, 0x000001b7}}; + +template +const divtest_table_entry basic_data::divtest_table_for_pow5_64[] = + {{0x0000000000000001, 0xffffffffffffffff}, + {0xcccccccccccccccd, 0x3333333333333333}, + {0x8f5c28f5c28f5c29, 0x0a3d70a3d70a3d70}, + {0x1cac083126e978d5, 0x020c49ba5e353f7c}, + {0xd288ce703afb7e91, 0x0068db8bac710cb2}, + {0x5d4e8fb00bcbe61d, 0x0014f8b588e368f0}, + {0x790fb65668c26139, 0x000431bde82d7b63}, + {0xe5032477ae8d46a5, 0x0000d6bf94d5e57a}, + {0xc767074b22e90e21, 0x00002af31dc46118}, + {0x8e47ce423a2e9c6d, 0x0000089705f4136b}, + {0x4fa7f60d3ed61f49, 0x000001b7cdfd9d7b}, + {0x0fee64690c913975, 0x00000057f5ff85e5}, + {0x3662e0e1cf503eb1, 0x000000119799812d}, + {0xa47a2cf9f6433fbd, 0x0000000384b84d09}, + {0x54186f653140a659, 0x00000000b424dc35}, + {0x7738164770402145, 0x0000000024075f3d}, + {0xe4a4d1417cd9a041, 0x000000000734aca5}, + {0xc75429d9e5c5200d, 0x000000000170ef54}, + {0xc1773b91fac10669, 0x000000000049c977}, + {0x26b172506559ce15, 0x00000000000ec1e4}, + {0xd489e3a9addec2d1, 0x000000000002f394}, + {0x90e860bb892c8d5d, 0x000000000000971d}, + {0x502e79bf1b6f4f79, 0x0000000000001e39}, + {0xdcd618596be30fe5, 0x000000000000060b}}; + +template +const uint64_t basic_data::dragonbox_pow10_significands_64[] = { + 0x81ceb32c4b43fcf5, 0xa2425ff75e14fc32, 0xcad2f7f5359a3b3f, + 0xfd87b5f28300ca0e, 0x9e74d1b791e07e49, 0xc612062576589ddb, + 0xf79687aed3eec552, 0x9abe14cd44753b53, 0xc16d9a0095928a28, + 0xf1c90080baf72cb2, 0x971da05074da7bef, 0xbce5086492111aeb, + 0xec1e4a7db69561a6, 0x9392ee8e921d5d08, 0xb877aa3236a4b44a, + 0xe69594bec44de15c, 0x901d7cf73ab0acda, 0xb424dc35095cd810, + 0xe12e13424bb40e14, 0x8cbccc096f5088cc, 0xafebff0bcb24aaff, + 0xdbe6fecebdedd5bf, 0x89705f4136b4a598, 0xabcc77118461cefd, + 0xd6bf94d5e57a42bd, 0x8637bd05af6c69b6, 0xa7c5ac471b478424, + 0xd1b71758e219652c, 0x83126e978d4fdf3c, 0xa3d70a3d70a3d70b, + 0xcccccccccccccccd, 0x8000000000000000, 0xa000000000000000, + 0xc800000000000000, 0xfa00000000000000, 0x9c40000000000000, + 0xc350000000000000, 0xf424000000000000, 0x9896800000000000, + 0xbebc200000000000, 0xee6b280000000000, 0x9502f90000000000, + 0xba43b74000000000, 0xe8d4a51000000000, 0x9184e72a00000000, + 0xb5e620f480000000, 0xe35fa931a0000000, 0x8e1bc9bf04000000, + 0xb1a2bc2ec5000000, 0xde0b6b3a76400000, 0x8ac7230489e80000, + 0xad78ebc5ac620000, 0xd8d726b7177a8000, 0x878678326eac9000, + 0xa968163f0a57b400, 0xd3c21bcecceda100, 0x84595161401484a0, + 0xa56fa5b99019a5c8, 0xcecb8f27f4200f3a, 0x813f3978f8940984, + 0xa18f07d736b90be5, 0xc9f2c9cd04674ede, 0xfc6f7c4045812296, + 0x9dc5ada82b70b59d, 0xc5371912364ce305, 0xf684df56c3e01bc6, + 0x9a130b963a6c115c, 0xc097ce7bc90715b3, 0xf0bdc21abb48db20, + 0x96769950b50d88f4, 0xbc143fa4e250eb31, 0xeb194f8e1ae525fd, + 0x92efd1b8d0cf37be, 0xb7abc627050305ad, 0xe596b7b0c643c719, + 0x8f7e32ce7bea5c6f, 0xb35dbf821ae4f38b, 0xe0352f62a19e306e}; + +template +const uint128_wrapper basic_data::dragonbox_pow10_significands_128[] = { +#if FMT_USE_FULL_CACHE_DRAGONBOX + {0xff77b1fcbebcdc4f, 0x25e8e89c13bb0f7b}, + {0x9faacf3df73609b1, 0x77b191618c54e9ad}, + {0xc795830d75038c1d, 0xd59df5b9ef6a2418}, + {0xf97ae3d0d2446f25, 0x4b0573286b44ad1e}, + {0x9becce62836ac577, 0x4ee367f9430aec33}, + {0xc2e801fb244576d5, 0x229c41f793cda740}, + {0xf3a20279ed56d48a, 0x6b43527578c11110}, + {0x9845418c345644d6, 0x830a13896b78aaaa}, + {0xbe5691ef416bd60c, 0x23cc986bc656d554}, + {0xedec366b11c6cb8f, 0x2cbfbe86b7ec8aa9}, + {0x94b3a202eb1c3f39, 0x7bf7d71432f3d6aa}, + {0xb9e08a83a5e34f07, 0xdaf5ccd93fb0cc54}, + {0xe858ad248f5c22c9, 0xd1b3400f8f9cff69}, + {0x91376c36d99995be, 0x23100809b9c21fa2}, + {0xb58547448ffffb2d, 0xabd40a0c2832a78b}, + {0xe2e69915b3fff9f9, 0x16c90c8f323f516d}, + {0x8dd01fad907ffc3b, 0xae3da7d97f6792e4}, + {0xb1442798f49ffb4a, 0x99cd11cfdf41779d}, + {0xdd95317f31c7fa1d, 0x40405643d711d584}, + {0x8a7d3eef7f1cfc52, 0x482835ea666b2573}, + {0xad1c8eab5ee43b66, 0xda3243650005eed0}, + {0xd863b256369d4a40, 0x90bed43e40076a83}, + {0x873e4f75e2224e68, 0x5a7744a6e804a292}, + {0xa90de3535aaae202, 0x711515d0a205cb37}, + {0xd3515c2831559a83, 0x0d5a5b44ca873e04}, + {0x8412d9991ed58091, 0xe858790afe9486c3}, + {0xa5178fff668ae0b6, 0x626e974dbe39a873}, + {0xce5d73ff402d98e3, 0xfb0a3d212dc81290}, + {0x80fa687f881c7f8e, 0x7ce66634bc9d0b9a}, + {0xa139029f6a239f72, 0x1c1fffc1ebc44e81}, + {0xc987434744ac874e, 0xa327ffb266b56221}, + {0xfbe9141915d7a922, 0x4bf1ff9f0062baa9}, + {0x9d71ac8fada6c9b5, 0x6f773fc3603db4aa}, + {0xc4ce17b399107c22, 0xcb550fb4384d21d4}, + {0xf6019da07f549b2b, 0x7e2a53a146606a49}, + {0x99c102844f94e0fb, 0x2eda7444cbfc426e}, + {0xc0314325637a1939, 0xfa911155fefb5309}, + {0xf03d93eebc589f88, 0x793555ab7eba27cb}, + {0x96267c7535b763b5, 0x4bc1558b2f3458df}, + {0xbbb01b9283253ca2, 0x9eb1aaedfb016f17}, + {0xea9c227723ee8bcb, 0x465e15a979c1cadd}, + {0x92a1958a7675175f, 0x0bfacd89ec191eca}, + {0xb749faed14125d36, 0xcef980ec671f667c}, + {0xe51c79a85916f484, 0x82b7e12780e7401b}, + {0x8f31cc0937ae58d2, 0xd1b2ecb8b0908811}, + {0xb2fe3f0b8599ef07, 0x861fa7e6dcb4aa16}, + {0xdfbdcece67006ac9, 0x67a791e093e1d49b}, + {0x8bd6a141006042bd, 0xe0c8bb2c5c6d24e1}, + {0xaecc49914078536d, 0x58fae9f773886e19}, + {0xda7f5bf590966848, 0xaf39a475506a899f}, + {0x888f99797a5e012d, 0x6d8406c952429604}, + {0xaab37fd7d8f58178, 0xc8e5087ba6d33b84}, + {0xd5605fcdcf32e1d6, 0xfb1e4a9a90880a65}, + {0x855c3be0a17fcd26, 0x5cf2eea09a550680}, + {0xa6b34ad8c9dfc06f, 0xf42faa48c0ea481f}, + {0xd0601d8efc57b08b, 0xf13b94daf124da27}, + {0x823c12795db6ce57, 0x76c53d08d6b70859}, + {0xa2cb1717b52481ed, 0x54768c4b0c64ca6f}, + {0xcb7ddcdda26da268, 0xa9942f5dcf7dfd0a}, + {0xfe5d54150b090b02, 0xd3f93b35435d7c4d}, + {0x9efa548d26e5a6e1, 0xc47bc5014a1a6db0}, + {0xc6b8e9b0709f109a, 0x359ab6419ca1091c}, + {0xf867241c8cc6d4c0, 0xc30163d203c94b63}, + {0x9b407691d7fc44f8, 0x79e0de63425dcf1e}, + {0xc21094364dfb5636, 0x985915fc12f542e5}, + {0xf294b943e17a2bc4, 0x3e6f5b7b17b2939e}, + {0x979cf3ca6cec5b5a, 0xa705992ceecf9c43}, + {0xbd8430bd08277231, 0x50c6ff782a838354}, + {0xece53cec4a314ebd, 0xa4f8bf5635246429}, + {0x940f4613ae5ed136, 0x871b7795e136be9a}, + {0xb913179899f68584, 0x28e2557b59846e40}, + {0xe757dd7ec07426e5, 0x331aeada2fe589d0}, + {0x9096ea6f3848984f, 0x3ff0d2c85def7622}, + {0xb4bca50b065abe63, 0x0fed077a756b53aa}, + {0xe1ebce4dc7f16dfb, 0xd3e8495912c62895}, + {0x8d3360f09cf6e4bd, 0x64712dd7abbbd95d}, + {0xb080392cc4349dec, 0xbd8d794d96aacfb4}, + {0xdca04777f541c567, 0xecf0d7a0fc5583a1}, + {0x89e42caaf9491b60, 0xf41686c49db57245}, + {0xac5d37d5b79b6239, 0x311c2875c522ced6}, + {0xd77485cb25823ac7, 0x7d633293366b828c}, + {0x86a8d39ef77164bc, 0xae5dff9c02033198}, + {0xa8530886b54dbdeb, 0xd9f57f830283fdfd}, + {0xd267caa862a12d66, 0xd072df63c324fd7c}, + {0x8380dea93da4bc60, 0x4247cb9e59f71e6e}, + {0xa46116538d0deb78, 0x52d9be85f074e609}, + {0xcd795be870516656, 0x67902e276c921f8c}, + {0x806bd9714632dff6, 0x00ba1cd8a3db53b7}, + {0xa086cfcd97bf97f3, 0x80e8a40eccd228a5}, + {0xc8a883c0fdaf7df0, 0x6122cd128006b2ce}, + {0xfad2a4b13d1b5d6c, 0x796b805720085f82}, + {0x9cc3a6eec6311a63, 0xcbe3303674053bb1}, + {0xc3f490aa77bd60fc, 0xbedbfc4411068a9d}, + {0xf4f1b4d515acb93b, 0xee92fb5515482d45}, + {0x991711052d8bf3c5, 0x751bdd152d4d1c4b}, + {0xbf5cd54678eef0b6, 0xd262d45a78a0635e}, + {0xef340a98172aace4, 0x86fb897116c87c35}, + {0x9580869f0e7aac0e, 0xd45d35e6ae3d4da1}, + {0xbae0a846d2195712, 0x8974836059cca10a}, + {0xe998d258869facd7, 0x2bd1a438703fc94c}, + {0x91ff83775423cc06, 0x7b6306a34627ddd0}, + {0xb67f6455292cbf08, 0x1a3bc84c17b1d543}, + {0xe41f3d6a7377eeca, 0x20caba5f1d9e4a94}, + {0x8e938662882af53e, 0x547eb47b7282ee9d}, + {0xb23867fb2a35b28d, 0xe99e619a4f23aa44}, + {0xdec681f9f4c31f31, 0x6405fa00e2ec94d5}, + {0x8b3c113c38f9f37e, 0xde83bc408dd3dd05}, + {0xae0b158b4738705e, 0x9624ab50b148d446}, + {0xd98ddaee19068c76, 0x3badd624dd9b0958}, + {0x87f8a8d4cfa417c9, 0xe54ca5d70a80e5d7}, + {0xa9f6d30a038d1dbc, 0x5e9fcf4ccd211f4d}, + {0xd47487cc8470652b, 0x7647c32000696720}, + {0x84c8d4dfd2c63f3b, 0x29ecd9f40041e074}, + {0xa5fb0a17c777cf09, 0xf468107100525891}, + {0xcf79cc9db955c2cc, 0x7182148d4066eeb5}, + {0x81ac1fe293d599bf, 0xc6f14cd848405531}, + {0xa21727db38cb002f, 0xb8ada00e5a506a7d}, + {0xca9cf1d206fdc03b, 0xa6d90811f0e4851d}, + {0xfd442e4688bd304a, 0x908f4a166d1da664}, + {0x9e4a9cec15763e2e, 0x9a598e4e043287ff}, + {0xc5dd44271ad3cdba, 0x40eff1e1853f29fe}, + {0xf7549530e188c128, 0xd12bee59e68ef47d}, + {0x9a94dd3e8cf578b9, 0x82bb74f8301958cf}, + {0xc13a148e3032d6e7, 0xe36a52363c1faf02}, + {0xf18899b1bc3f8ca1, 0xdc44e6c3cb279ac2}, + {0x96f5600f15a7b7e5, 0x29ab103a5ef8c0ba}, + {0xbcb2b812db11a5de, 0x7415d448f6b6f0e8}, + {0xebdf661791d60f56, 0x111b495b3464ad22}, + {0x936b9fcebb25c995, 0xcab10dd900beec35}, + {0xb84687c269ef3bfb, 0x3d5d514f40eea743}, + {0xe65829b3046b0afa, 0x0cb4a5a3112a5113}, + {0x8ff71a0fe2c2e6dc, 0x47f0e785eaba72ac}, + {0xb3f4e093db73a093, 0x59ed216765690f57}, + {0xe0f218b8d25088b8, 0x306869c13ec3532d}, + {0x8c974f7383725573, 0x1e414218c73a13fc}, + {0xafbd2350644eeacf, 0xe5d1929ef90898fb}, + {0xdbac6c247d62a583, 0xdf45f746b74abf3a}, + {0x894bc396ce5da772, 0x6b8bba8c328eb784}, + {0xab9eb47c81f5114f, 0x066ea92f3f326565}, + {0xd686619ba27255a2, 0xc80a537b0efefebe}, + {0x8613fd0145877585, 0xbd06742ce95f5f37}, + {0xa798fc4196e952e7, 0x2c48113823b73705}, + {0xd17f3b51fca3a7a0, 0xf75a15862ca504c6}, + {0x82ef85133de648c4, 0x9a984d73dbe722fc}, + {0xa3ab66580d5fdaf5, 0xc13e60d0d2e0ebbb}, + {0xcc963fee10b7d1b3, 0x318df905079926a9}, + {0xffbbcfe994e5c61f, 0xfdf17746497f7053}, + {0x9fd561f1fd0f9bd3, 0xfeb6ea8bedefa634}, + {0xc7caba6e7c5382c8, 0xfe64a52ee96b8fc1}, + {0xf9bd690a1b68637b, 0x3dfdce7aa3c673b1}, + {0x9c1661a651213e2d, 0x06bea10ca65c084f}, + {0xc31bfa0fe5698db8, 0x486e494fcff30a63}, + {0xf3e2f893dec3f126, 0x5a89dba3c3efccfb}, + {0x986ddb5c6b3a76b7, 0xf89629465a75e01d}, + {0xbe89523386091465, 0xf6bbb397f1135824}, + {0xee2ba6c0678b597f, 0x746aa07ded582e2d}, + {0x94db483840b717ef, 0xa8c2a44eb4571cdd}, + {0xba121a4650e4ddeb, 0x92f34d62616ce414}, + {0xe896a0d7e51e1566, 0x77b020baf9c81d18}, + {0x915e2486ef32cd60, 0x0ace1474dc1d122f}, + {0xb5b5ada8aaff80b8, 0x0d819992132456bb}, + {0xe3231912d5bf60e6, 0x10e1fff697ed6c6a}, + {0x8df5efabc5979c8f, 0xca8d3ffa1ef463c2}, + {0xb1736b96b6fd83b3, 0xbd308ff8a6b17cb3}, + {0xddd0467c64bce4a0, 0xac7cb3f6d05ddbdf}, + {0x8aa22c0dbef60ee4, 0x6bcdf07a423aa96c}, + {0xad4ab7112eb3929d, 0x86c16c98d2c953c7}, + {0xd89d64d57a607744, 0xe871c7bf077ba8b8}, + {0x87625f056c7c4a8b, 0x11471cd764ad4973}, + {0xa93af6c6c79b5d2d, 0xd598e40d3dd89bd0}, + {0xd389b47879823479, 0x4aff1d108d4ec2c4}, + {0x843610cb4bf160cb, 0xcedf722a585139bb}, + {0xa54394fe1eedb8fe, 0xc2974eb4ee658829}, + {0xce947a3da6a9273e, 0x733d226229feea33}, + {0x811ccc668829b887, 0x0806357d5a3f5260}, + {0xa163ff802a3426a8, 0xca07c2dcb0cf26f8}, + {0xc9bcff6034c13052, 0xfc89b393dd02f0b6}, + {0xfc2c3f3841f17c67, 0xbbac2078d443ace3}, + {0x9d9ba7832936edc0, 0xd54b944b84aa4c0e}, + {0xc5029163f384a931, 0x0a9e795e65d4df12}, + {0xf64335bcf065d37d, 0x4d4617b5ff4a16d6}, + {0x99ea0196163fa42e, 0x504bced1bf8e4e46}, + {0xc06481fb9bcf8d39, 0xe45ec2862f71e1d7}, + {0xf07da27a82c37088, 0x5d767327bb4e5a4d}, + {0x964e858c91ba2655, 0x3a6a07f8d510f870}, + {0xbbe226efb628afea, 0x890489f70a55368c}, + {0xeadab0aba3b2dbe5, 0x2b45ac74ccea842f}, + {0x92c8ae6b464fc96f, 0x3b0b8bc90012929e}, + {0xb77ada0617e3bbcb, 0x09ce6ebb40173745}, + {0xe55990879ddcaabd, 0xcc420a6a101d0516}, + {0x8f57fa54c2a9eab6, 0x9fa946824a12232e}, + {0xb32df8e9f3546564, 0x47939822dc96abfa}, + {0xdff9772470297ebd, 0x59787e2b93bc56f8}, + {0x8bfbea76c619ef36, 0x57eb4edb3c55b65b}, + {0xaefae51477a06b03, 0xede622920b6b23f2}, + {0xdab99e59958885c4, 0xe95fab368e45ecee}, + {0x88b402f7fd75539b, 0x11dbcb0218ebb415}, + {0xaae103b5fcd2a881, 0xd652bdc29f26a11a}, + {0xd59944a37c0752a2, 0x4be76d3346f04960}, + {0x857fcae62d8493a5, 0x6f70a4400c562ddc}, + {0xa6dfbd9fb8e5b88e, 0xcb4ccd500f6bb953}, + {0xd097ad07a71f26b2, 0x7e2000a41346a7a8}, + {0x825ecc24c873782f, 0x8ed400668c0c28c9}, + {0xa2f67f2dfa90563b, 0x728900802f0f32fb}, + {0xcbb41ef979346bca, 0x4f2b40a03ad2ffba}, + {0xfea126b7d78186bc, 0xe2f610c84987bfa9}, + {0x9f24b832e6b0f436, 0x0dd9ca7d2df4d7ca}, + {0xc6ede63fa05d3143, 0x91503d1c79720dbc}, + {0xf8a95fcf88747d94, 0x75a44c6397ce912b}, + {0x9b69dbe1b548ce7c, 0xc986afbe3ee11abb}, + {0xc24452da229b021b, 0xfbe85badce996169}, + {0xf2d56790ab41c2a2, 0xfae27299423fb9c4}, + {0x97c560ba6b0919a5, 0xdccd879fc967d41b}, + {0xbdb6b8e905cb600f, 0x5400e987bbc1c921}, + {0xed246723473e3813, 0x290123e9aab23b69}, + {0x9436c0760c86e30b, 0xf9a0b6720aaf6522}, + {0xb94470938fa89bce, 0xf808e40e8d5b3e6a}, + {0xe7958cb87392c2c2, 0xb60b1d1230b20e05}, + {0x90bd77f3483bb9b9, 0xb1c6f22b5e6f48c3}, + {0xb4ecd5f01a4aa828, 0x1e38aeb6360b1af4}, + {0xe2280b6c20dd5232, 0x25c6da63c38de1b1}, + {0x8d590723948a535f, 0x579c487e5a38ad0f}, + {0xb0af48ec79ace837, 0x2d835a9df0c6d852}, + {0xdcdb1b2798182244, 0xf8e431456cf88e66}, + {0x8a08f0f8bf0f156b, 0x1b8e9ecb641b5900}, + {0xac8b2d36eed2dac5, 0xe272467e3d222f40}, + {0xd7adf884aa879177, 0x5b0ed81dcc6abb10}, + {0x86ccbb52ea94baea, 0x98e947129fc2b4ea}, + {0xa87fea27a539e9a5, 0x3f2398d747b36225}, + {0xd29fe4b18e88640e, 0x8eec7f0d19a03aae}, + {0x83a3eeeef9153e89, 0x1953cf68300424ad}, + {0xa48ceaaab75a8e2b, 0x5fa8c3423c052dd8}, + {0xcdb02555653131b6, 0x3792f412cb06794e}, + {0x808e17555f3ebf11, 0xe2bbd88bbee40bd1}, + {0xa0b19d2ab70e6ed6, 0x5b6aceaeae9d0ec5}, + {0xc8de047564d20a8b, 0xf245825a5a445276}, + {0xfb158592be068d2e, 0xeed6e2f0f0d56713}, + {0x9ced737bb6c4183d, 0x55464dd69685606c}, + {0xc428d05aa4751e4c, 0xaa97e14c3c26b887}, + {0xf53304714d9265df, 0xd53dd99f4b3066a9}, + {0x993fe2c6d07b7fab, 0xe546a8038efe402a}, + {0xbf8fdb78849a5f96, 0xde98520472bdd034}, + {0xef73d256a5c0f77c, 0x963e66858f6d4441}, + {0x95a8637627989aad, 0xdde7001379a44aa9}, + {0xbb127c53b17ec159, 0x5560c018580d5d53}, + {0xe9d71b689dde71af, 0xaab8f01e6e10b4a7}, + {0x9226712162ab070d, 0xcab3961304ca70e9}, + {0xb6b00d69bb55c8d1, 0x3d607b97c5fd0d23}, + {0xe45c10c42a2b3b05, 0x8cb89a7db77c506b}, + {0x8eb98a7a9a5b04e3, 0x77f3608e92adb243}, + {0xb267ed1940f1c61c, 0x55f038b237591ed4}, + {0xdf01e85f912e37a3, 0x6b6c46dec52f6689}, + {0x8b61313bbabce2c6, 0x2323ac4b3b3da016}, + {0xae397d8aa96c1b77, 0xabec975e0a0d081b}, + {0xd9c7dced53c72255, 0x96e7bd358c904a22}, + {0x881cea14545c7575, 0x7e50d64177da2e55}, + {0xaa242499697392d2, 0xdde50bd1d5d0b9ea}, + {0xd4ad2dbfc3d07787, 0x955e4ec64b44e865}, + {0x84ec3c97da624ab4, 0xbd5af13bef0b113f}, + {0xa6274bbdd0fadd61, 0xecb1ad8aeacdd58f}, + {0xcfb11ead453994ba, 0x67de18eda5814af3}, + {0x81ceb32c4b43fcf4, 0x80eacf948770ced8}, + {0xa2425ff75e14fc31, 0xa1258379a94d028e}, + {0xcad2f7f5359a3b3e, 0x096ee45813a04331}, + {0xfd87b5f28300ca0d, 0x8bca9d6e188853fd}, + {0x9e74d1b791e07e48, 0x775ea264cf55347e}, + {0xc612062576589dda, 0x95364afe032a819e}, + {0xf79687aed3eec551, 0x3a83ddbd83f52205}, + {0x9abe14cd44753b52, 0xc4926a9672793543}, + {0xc16d9a0095928a27, 0x75b7053c0f178294}, + {0xf1c90080baf72cb1, 0x5324c68b12dd6339}, + {0x971da05074da7bee, 0xd3f6fc16ebca5e04}, + {0xbce5086492111aea, 0x88f4bb1ca6bcf585}, + {0xec1e4a7db69561a5, 0x2b31e9e3d06c32e6}, + {0x9392ee8e921d5d07, 0x3aff322e62439fd0}, + {0xb877aa3236a4b449, 0x09befeb9fad487c3}, + {0xe69594bec44de15b, 0x4c2ebe687989a9b4}, + {0x901d7cf73ab0acd9, 0x0f9d37014bf60a11}, + {0xb424dc35095cd80f, 0x538484c19ef38c95}, + {0xe12e13424bb40e13, 0x2865a5f206b06fba}, + {0x8cbccc096f5088cb, 0xf93f87b7442e45d4}, + {0xafebff0bcb24aafe, 0xf78f69a51539d749}, + {0xdbe6fecebdedd5be, 0xb573440e5a884d1c}, + {0x89705f4136b4a597, 0x31680a88f8953031}, + {0xabcc77118461cefc, 0xfdc20d2b36ba7c3e}, + {0xd6bf94d5e57a42bc, 0x3d32907604691b4d}, + {0x8637bd05af6c69b5, 0xa63f9a49c2c1b110}, + {0xa7c5ac471b478423, 0x0fcf80dc33721d54}, + {0xd1b71758e219652b, 0xd3c36113404ea4a9}, + {0x83126e978d4fdf3b, 0x645a1cac083126ea}, + {0xa3d70a3d70a3d70a, 0x3d70a3d70a3d70a4}, + {0xcccccccccccccccc, 0xcccccccccccccccd}, + {0x8000000000000000, 0x0000000000000000}, + {0xa000000000000000, 0x0000000000000000}, + {0xc800000000000000, 0x0000000000000000}, + {0xfa00000000000000, 0x0000000000000000}, + {0x9c40000000000000, 0x0000000000000000}, + {0xc350000000000000, 0x0000000000000000}, + {0xf424000000000000, 0x0000000000000000}, + {0x9896800000000000, 0x0000000000000000}, + {0xbebc200000000000, 0x0000000000000000}, + {0xee6b280000000000, 0x0000000000000000}, + {0x9502f90000000000, 0x0000000000000000}, + {0xba43b74000000000, 0x0000000000000000}, + {0xe8d4a51000000000, 0x0000000000000000}, + {0x9184e72a00000000, 0x0000000000000000}, + {0xb5e620f480000000, 0x0000000000000000}, + {0xe35fa931a0000000, 0x0000000000000000}, + {0x8e1bc9bf04000000, 0x0000000000000000}, + {0xb1a2bc2ec5000000, 0x0000000000000000}, + {0xde0b6b3a76400000, 0x0000000000000000}, + {0x8ac7230489e80000, 0x0000000000000000}, + {0xad78ebc5ac620000, 0x0000000000000000}, + {0xd8d726b7177a8000, 0x0000000000000000}, + {0x878678326eac9000, 0x0000000000000000}, + {0xa968163f0a57b400, 0x0000000000000000}, + {0xd3c21bcecceda100, 0x0000000000000000}, + {0x84595161401484a0, 0x0000000000000000}, + {0xa56fa5b99019a5c8, 0x0000000000000000}, + {0xcecb8f27f4200f3a, 0x0000000000000000}, + {0x813f3978f8940984, 0x4000000000000000}, + {0xa18f07d736b90be5, 0x5000000000000000}, + {0xc9f2c9cd04674ede, 0xa400000000000000}, + {0xfc6f7c4045812296, 0x4d00000000000000}, + {0x9dc5ada82b70b59d, 0xf020000000000000}, + {0xc5371912364ce305, 0x6c28000000000000}, + {0xf684df56c3e01bc6, 0xc732000000000000}, + {0x9a130b963a6c115c, 0x3c7f400000000000}, + {0xc097ce7bc90715b3, 0x4b9f100000000000}, + {0xf0bdc21abb48db20, 0x1e86d40000000000}, + {0x96769950b50d88f4, 0x1314448000000000}, + {0xbc143fa4e250eb31, 0x17d955a000000000}, + {0xeb194f8e1ae525fd, 0x5dcfab0800000000}, + {0x92efd1b8d0cf37be, 0x5aa1cae500000000}, + {0xb7abc627050305ad, 0xf14a3d9e40000000}, + {0xe596b7b0c643c719, 0x6d9ccd05d0000000}, + {0x8f7e32ce7bea5c6f, 0xe4820023a2000000}, + {0xb35dbf821ae4f38b, 0xdda2802c8a800000}, + {0xe0352f62a19e306e, 0xd50b2037ad200000}, + {0x8c213d9da502de45, 0x4526f422cc340000}, + {0xaf298d050e4395d6, 0x9670b12b7f410000}, + {0xdaf3f04651d47b4c, 0x3c0cdd765f114000}, + {0x88d8762bf324cd0f, 0xa5880a69fb6ac800}, + {0xab0e93b6efee0053, 0x8eea0d047a457a00}, + {0xd5d238a4abe98068, 0x72a4904598d6d880}, + {0x85a36366eb71f041, 0x47a6da2b7f864750}, + {0xa70c3c40a64e6c51, 0x999090b65f67d924}, + {0xd0cf4b50cfe20765, 0xfff4b4e3f741cf6d}, + {0x82818f1281ed449f, 0xbff8f10e7a8921a4}, + {0xa321f2d7226895c7, 0xaff72d52192b6a0d}, + {0xcbea6f8ceb02bb39, 0x9bf4f8a69f764490}, + {0xfee50b7025c36a08, 0x02f236d04753d5b4}, + {0x9f4f2726179a2245, 0x01d762422c946590}, + {0xc722f0ef9d80aad6, 0x424d3ad2b7b97ef5}, + {0xf8ebad2b84e0d58b, 0xd2e0898765a7deb2}, + {0x9b934c3b330c8577, 0x63cc55f49f88eb2f}, + {0xc2781f49ffcfa6d5, 0x3cbf6b71c76b25fb}, + {0xf316271c7fc3908a, 0x8bef464e3945ef7a}, + {0x97edd871cfda3a56, 0x97758bf0e3cbb5ac}, + {0xbde94e8e43d0c8ec, 0x3d52eeed1cbea317}, + {0xed63a231d4c4fb27, 0x4ca7aaa863ee4bdd}, + {0x945e455f24fb1cf8, 0x8fe8caa93e74ef6a}, + {0xb975d6b6ee39e436, 0xb3e2fd538e122b44}, + {0xe7d34c64a9c85d44, 0x60dbbca87196b616}, + {0x90e40fbeea1d3a4a, 0xbc8955e946fe31cd}, + {0xb51d13aea4a488dd, 0x6babab6398bdbe41}, + {0xe264589a4dcdab14, 0xc696963c7eed2dd1}, + {0x8d7eb76070a08aec, 0xfc1e1de5cf543ca2}, + {0xb0de65388cc8ada8, 0x3b25a55f43294bcb}, + {0xdd15fe86affad912, 0x49ef0eb713f39ebe}, + {0x8a2dbf142dfcc7ab, 0x6e3569326c784337}, + {0xacb92ed9397bf996, 0x49c2c37f07965404}, + {0xd7e77a8f87daf7fb, 0xdc33745ec97be906}, + {0x86f0ac99b4e8dafd, 0x69a028bb3ded71a3}, + {0xa8acd7c0222311bc, 0xc40832ea0d68ce0c}, + {0xd2d80db02aabd62b, 0xf50a3fa490c30190}, + {0x83c7088e1aab65db, 0x792667c6da79e0fa}, + {0xa4b8cab1a1563f52, 0x577001b891185938}, + {0xcde6fd5e09abcf26, 0xed4c0226b55e6f86}, + {0x80b05e5ac60b6178, 0x544f8158315b05b4}, + {0xa0dc75f1778e39d6, 0x696361ae3db1c721}, + {0xc913936dd571c84c, 0x03bc3a19cd1e38e9}, + {0xfb5878494ace3a5f, 0x04ab48a04065c723}, + {0x9d174b2dcec0e47b, 0x62eb0d64283f9c76}, + {0xc45d1df942711d9a, 0x3ba5d0bd324f8394}, + {0xf5746577930d6500, 0xca8f44ec7ee36479}, + {0x9968bf6abbe85f20, 0x7e998b13cf4e1ecb}, + {0xbfc2ef456ae276e8, 0x9e3fedd8c321a67e}, + {0xefb3ab16c59b14a2, 0xc5cfe94ef3ea101e}, + {0x95d04aee3b80ece5, 0xbba1f1d158724a12}, + {0xbb445da9ca61281f, 0x2a8a6e45ae8edc97}, + {0xea1575143cf97226, 0xf52d09d71a3293bd}, + {0x924d692ca61be758, 0x593c2626705f9c56}, + {0xb6e0c377cfa2e12e, 0x6f8b2fb00c77836c}, + {0xe498f455c38b997a, 0x0b6dfb9c0f956447}, + {0x8edf98b59a373fec, 0x4724bd4189bd5eac}, + {0xb2977ee300c50fe7, 0x58edec91ec2cb657}, + {0xdf3d5e9bc0f653e1, 0x2f2967b66737e3ed}, + {0x8b865b215899f46c, 0xbd79e0d20082ee74}, + {0xae67f1e9aec07187, 0xecd8590680a3aa11}, + {0xda01ee641a708de9, 0xe80e6f4820cc9495}, + {0x884134fe908658b2, 0x3109058d147fdcdd}, + {0xaa51823e34a7eede, 0xbd4b46f0599fd415}, + {0xd4e5e2cdc1d1ea96, 0x6c9e18ac7007c91a}, + {0x850fadc09923329e, 0x03e2cf6bc604ddb0}, + {0xa6539930bf6bff45, 0x84db8346b786151c}, + {0xcfe87f7cef46ff16, 0xe612641865679a63}, + {0x81f14fae158c5f6e, 0x4fcb7e8f3f60c07e}, + {0xa26da3999aef7749, 0xe3be5e330f38f09d}, + {0xcb090c8001ab551c, 0x5cadf5bfd3072cc5}, + {0xfdcb4fa002162a63, 0x73d9732fc7c8f7f6}, + {0x9e9f11c4014dda7e, 0x2867e7fddcdd9afa}, + {0xc646d63501a1511d, 0xb281e1fd541501b8}, + {0xf7d88bc24209a565, 0x1f225a7ca91a4226}, + {0x9ae757596946075f, 0x3375788de9b06958}, + {0xc1a12d2fc3978937, 0x0052d6b1641c83ae}, + {0xf209787bb47d6b84, 0xc0678c5dbd23a49a}, + {0x9745eb4d50ce6332, 0xf840b7ba963646e0}, + {0xbd176620a501fbff, 0xb650e5a93bc3d898}, + {0xec5d3fa8ce427aff, 0xa3e51f138ab4cebe}, + {0x93ba47c980e98cdf, 0xc66f336c36b10137}, + {0xb8a8d9bbe123f017, 0xb80b0047445d4184}, + {0xe6d3102ad96cec1d, 0xa60dc059157491e5}, + {0x9043ea1ac7e41392, 0x87c89837ad68db2f}, + {0xb454e4a179dd1877, 0x29babe4598c311fb}, + {0xe16a1dc9d8545e94, 0xf4296dd6fef3d67a}, + {0x8ce2529e2734bb1d, 0x1899e4a65f58660c}, + {0xb01ae745b101e9e4, 0x5ec05dcff72e7f8f}, + {0xdc21a1171d42645d, 0x76707543f4fa1f73}, + {0x899504ae72497eba, 0x6a06494a791c53a8}, + {0xabfa45da0edbde69, 0x0487db9d17636892}, + {0xd6f8d7509292d603, 0x45a9d2845d3c42b6}, + {0x865b86925b9bc5c2, 0x0b8a2392ba45a9b2}, + {0xa7f26836f282b732, 0x8e6cac7768d7141e}, + {0xd1ef0244af2364ff, 0x3207d795430cd926}, + {0x8335616aed761f1f, 0x7f44e6bd49e807b8}, + {0xa402b9c5a8d3a6e7, 0x5f16206c9c6209a6}, + {0xcd036837130890a1, 0x36dba887c37a8c0f}, + {0x802221226be55a64, 0xc2494954da2c9789}, + {0xa02aa96b06deb0fd, 0xf2db9baa10b7bd6c}, + {0xc83553c5c8965d3d, 0x6f92829494e5acc7}, + {0xfa42a8b73abbf48c, 0xcb772339ba1f17f9}, + {0x9c69a97284b578d7, 0xff2a760414536efb}, + {0xc38413cf25e2d70d, 0xfef5138519684aba}, + {0xf46518c2ef5b8cd1, 0x7eb258665fc25d69}, + {0x98bf2f79d5993802, 0xef2f773ffbd97a61}, + {0xbeeefb584aff8603, 0xaafb550ffacfd8fa}, + {0xeeaaba2e5dbf6784, 0x95ba2a53f983cf38}, + {0x952ab45cfa97a0b2, 0xdd945a747bf26183}, + {0xba756174393d88df, 0x94f971119aeef9e4}, + {0xe912b9d1478ceb17, 0x7a37cd5601aab85d}, + {0x91abb422ccb812ee, 0xac62e055c10ab33a}, + {0xb616a12b7fe617aa, 0x577b986b314d6009}, + {0xe39c49765fdf9d94, 0xed5a7e85fda0b80b}, + {0x8e41ade9fbebc27d, 0x14588f13be847307}, + {0xb1d219647ae6b31c, 0x596eb2d8ae258fc8}, + {0xde469fbd99a05fe3, 0x6fca5f8ed9aef3bb}, + {0x8aec23d680043bee, 0x25de7bb9480d5854}, + {0xada72ccc20054ae9, 0xaf561aa79a10ae6a}, + {0xd910f7ff28069da4, 0x1b2ba1518094da04}, + {0x87aa9aff79042286, 0x90fb44d2f05d0842}, + {0xa99541bf57452b28, 0x353a1607ac744a53}, + {0xd3fa922f2d1675f2, 0x42889b8997915ce8}, + {0x847c9b5d7c2e09b7, 0x69956135febada11}, + {0xa59bc234db398c25, 0x43fab9837e699095}, + {0xcf02b2c21207ef2e, 0x94f967e45e03f4bb}, + {0x8161afb94b44f57d, 0x1d1be0eebac278f5}, + {0xa1ba1ba79e1632dc, 0x6462d92a69731732}, + {0xca28a291859bbf93, 0x7d7b8f7503cfdcfe}, + {0xfcb2cb35e702af78, 0x5cda735244c3d43e}, + {0x9defbf01b061adab, 0x3a0888136afa64a7}, + {0xc56baec21c7a1916, 0x088aaa1845b8fdd0}, + {0xf6c69a72a3989f5b, 0x8aad549e57273d45}, + {0x9a3c2087a63f6399, 0x36ac54e2f678864b}, + {0xc0cb28a98fcf3c7f, 0x84576a1bb416a7dd}, + {0xf0fdf2d3f3c30b9f, 0x656d44a2a11c51d5}, + {0x969eb7c47859e743, 0x9f644ae5a4b1b325}, + {0xbc4665b596706114, 0x873d5d9f0dde1fee}, + {0xeb57ff22fc0c7959, 0xa90cb506d155a7ea}, + {0x9316ff75dd87cbd8, 0x09a7f12442d588f2}, + {0xb7dcbf5354e9bece, 0x0c11ed6d538aeb2f}, + {0xe5d3ef282a242e81, 0x8f1668c8a86da5fa}, + {0x8fa475791a569d10, 0xf96e017d694487bc}, + {0xb38d92d760ec4455, 0x37c981dcc395a9ac}, + {0xe070f78d3927556a, 0x85bbe253f47b1417}, + {0x8c469ab843b89562, 0x93956d7478ccec8e}, + {0xaf58416654a6babb, 0x387ac8d1970027b2}, + {0xdb2e51bfe9d0696a, 0x06997b05fcc0319e}, + {0x88fcf317f22241e2, 0x441fece3bdf81f03}, + {0xab3c2fddeeaad25a, 0xd527e81cad7626c3}, + {0xd60b3bd56a5586f1, 0x8a71e223d8d3b074}, + {0x85c7056562757456, 0xf6872d5667844e49}, + {0xa738c6bebb12d16c, 0xb428f8ac016561db}, + {0xd106f86e69d785c7, 0xe13336d701beba52}, + {0x82a45b450226b39c, 0xecc0024661173473}, + {0xa34d721642b06084, 0x27f002d7f95d0190}, + {0xcc20ce9bd35c78a5, 0x31ec038df7b441f4}, + {0xff290242c83396ce, 0x7e67047175a15271}, + {0x9f79a169bd203e41, 0x0f0062c6e984d386}, + {0xc75809c42c684dd1, 0x52c07b78a3e60868}, + {0xf92e0c3537826145, 0xa7709a56ccdf8a82}, + {0x9bbcc7a142b17ccb, 0x88a66076400bb691}, + {0xc2abf989935ddbfe, 0x6acff893d00ea435}, + {0xf356f7ebf83552fe, 0x0583f6b8c4124d43}, + {0x98165af37b2153de, 0xc3727a337a8b704a}, + {0xbe1bf1b059e9a8d6, 0x744f18c0592e4c5c}, + {0xeda2ee1c7064130c, 0x1162def06f79df73}, + {0x9485d4d1c63e8be7, 0x8addcb5645ac2ba8}, + {0xb9a74a0637ce2ee1, 0x6d953e2bd7173692}, + {0xe8111c87c5c1ba99, 0xc8fa8db6ccdd0437}, + {0x910ab1d4db9914a0, 0x1d9c9892400a22a2}, + {0xb54d5e4a127f59c8, 0x2503beb6d00cab4b}, + {0xe2a0b5dc971f303a, 0x2e44ae64840fd61d}, + {0x8da471a9de737e24, 0x5ceaecfed289e5d2}, + {0xb10d8e1456105dad, 0x7425a83e872c5f47}, + {0xdd50f1996b947518, 0xd12f124e28f77719}, + {0x8a5296ffe33cc92f, 0x82bd6b70d99aaa6f}, + {0xace73cbfdc0bfb7b, 0x636cc64d1001550b}, + {0xd8210befd30efa5a, 0x3c47f7e05401aa4e}, + {0x8714a775e3e95c78, 0x65acfaec34810a71}, + {0xa8d9d1535ce3b396, 0x7f1839a741a14d0d}, + {0xd31045a8341ca07c, 0x1ede48111209a050}, + {0x83ea2b892091e44d, 0x934aed0aab460432}, + {0xa4e4b66b68b65d60, 0xf81da84d5617853f}, + {0xce1de40642e3f4b9, 0x36251260ab9d668e}, + {0x80d2ae83e9ce78f3, 0xc1d72b7c6b426019}, + {0xa1075a24e4421730, 0xb24cf65b8612f81f}, + {0xc94930ae1d529cfc, 0xdee033f26797b627}, + {0xfb9b7cd9a4a7443c, 0x169840ef017da3b1}, + {0x9d412e0806e88aa5, 0x8e1f289560ee864e}, + {0xc491798a08a2ad4e, 0xf1a6f2bab92a27e2}, + {0xf5b5d7ec8acb58a2, 0xae10af696774b1db}, + {0x9991a6f3d6bf1765, 0xacca6da1e0a8ef29}, + {0xbff610b0cc6edd3f, 0x17fd090a58d32af3}, + {0xeff394dcff8a948e, 0xddfc4b4cef07f5b0}, + {0x95f83d0a1fb69cd9, 0x4abdaf101564f98e}, + {0xbb764c4ca7a4440f, 0x9d6d1ad41abe37f1}, + {0xea53df5fd18d5513, 0x84c86189216dc5ed}, + {0x92746b9be2f8552c, 0x32fd3cf5b4e49bb4}, + {0xb7118682dbb66a77, 0x3fbc8c33221dc2a1}, + {0xe4d5e82392a40515, 0x0fabaf3feaa5334a}, + {0x8f05b1163ba6832d, 0x29cb4d87f2a7400e}, + {0xb2c71d5bca9023f8, 0x743e20e9ef511012}, + {0xdf78e4b2bd342cf6, 0x914da9246b255416}, + {0x8bab8eefb6409c1a, 0x1ad089b6c2f7548e}, + {0xae9672aba3d0c320, 0xa184ac2473b529b1}, + {0xda3c0f568cc4f3e8, 0xc9e5d72d90a2741e}, + {0x8865899617fb1871, 0x7e2fa67c7a658892}, + {0xaa7eebfb9df9de8d, 0xddbb901b98feeab7}, + {0xd51ea6fa85785631, 0x552a74227f3ea565}, + {0x8533285c936b35de, 0xd53a88958f87275f}, + {0xa67ff273b8460356, 0x8a892abaf368f137}, + {0xd01fef10a657842c, 0x2d2b7569b0432d85}, + {0x8213f56a67f6b29b, 0x9c3b29620e29fc73}, + {0xa298f2c501f45f42, 0x8349f3ba91b47b8f}, + {0xcb3f2f7642717713, 0x241c70a936219a73}, + {0xfe0efb53d30dd4d7, 0xed238cd383aa0110}, + {0x9ec95d1463e8a506, 0xf4363804324a40aa}, + {0xc67bb4597ce2ce48, 0xb143c6053edcd0d5}, + {0xf81aa16fdc1b81da, 0xdd94b7868e94050a}, + {0x9b10a4e5e9913128, 0xca7cf2b4191c8326}, + {0xc1d4ce1f63f57d72, 0xfd1c2f611f63a3f0}, + {0xf24a01a73cf2dccf, 0xbc633b39673c8cec}, + {0x976e41088617ca01, 0xd5be0503e085d813}, + {0xbd49d14aa79dbc82, 0x4b2d8644d8a74e18}, + {0xec9c459d51852ba2, 0xddf8e7d60ed1219e}, + {0x93e1ab8252f33b45, 0xcabb90e5c942b503}, + {0xb8da1662e7b00a17, 0x3d6a751f3b936243}, + {0xe7109bfba19c0c9d, 0x0cc512670a783ad4}, + {0x906a617d450187e2, 0x27fb2b80668b24c5}, + {0xb484f9dc9641e9da, 0xb1f9f660802dedf6}, + {0xe1a63853bbd26451, 0x5e7873f8a0396973}, + {0x8d07e33455637eb2, 0xdb0b487b6423e1e8}, + {0xb049dc016abc5e5f, 0x91ce1a9a3d2cda62}, + {0xdc5c5301c56b75f7, 0x7641a140cc7810fb}, + {0x89b9b3e11b6329ba, 0xa9e904c87fcb0a9d}, + {0xac2820d9623bf429, 0x546345fa9fbdcd44}, + {0xd732290fbacaf133, 0xa97c177947ad4095}, + {0x867f59a9d4bed6c0, 0x49ed8eabcccc485d}, + {0xa81f301449ee8c70, 0x5c68f256bfff5a74}, + {0xd226fc195c6a2f8c, 0x73832eec6fff3111}, + {0x83585d8fd9c25db7, 0xc831fd53c5ff7eab}, + {0xa42e74f3d032f525, 0xba3e7ca8b77f5e55}, + {0xcd3a1230c43fb26f, 0x28ce1bd2e55f35eb}, + {0x80444b5e7aa7cf85, 0x7980d163cf5b81b3}, + {0xa0555e361951c366, 0xd7e105bcc332621f}, + {0xc86ab5c39fa63440, 0x8dd9472bf3fefaa7}, + {0xfa856334878fc150, 0xb14f98f6f0feb951}, + {0x9c935e00d4b9d8d2, 0x6ed1bf9a569f33d3}, + {0xc3b8358109e84f07, 0x0a862f80ec4700c8}, + {0xf4a642e14c6262c8, 0xcd27bb612758c0fa}, + {0x98e7e9cccfbd7dbd, 0x8038d51cb897789c}, + {0xbf21e44003acdd2c, 0xe0470a63e6bd56c3}, + {0xeeea5d5004981478, 0x1858ccfce06cac74}, + {0x95527a5202df0ccb, 0x0f37801e0c43ebc8}, + {0xbaa718e68396cffd, 0xd30560258f54e6ba}, + {0xe950df20247c83fd, 0x47c6b82ef32a2069}, + {0x91d28b7416cdd27e, 0x4cdc331d57fa5441}, + {0xb6472e511c81471d, 0xe0133fe4adf8e952}, + {0xe3d8f9e563a198e5, 0x58180fddd97723a6}, + {0x8e679c2f5e44ff8f, 0x570f09eaa7ea7648}, + {0xb201833b35d63f73, 0x2cd2cc6551e513da}, + {0xde81e40a034bcf4f, 0xf8077f7ea65e58d1}, + {0x8b112e86420f6191, 0xfb04afaf27faf782}, + {0xadd57a27d29339f6, 0x79c5db9af1f9b563}, + {0xd94ad8b1c7380874, 0x18375281ae7822bc}, + {0x87cec76f1c830548, 0x8f2293910d0b15b5}, + {0xa9c2794ae3a3c69a, 0xb2eb3875504ddb22}, + {0xd433179d9c8cb841, 0x5fa60692a46151eb}, + {0x849feec281d7f328, 0xdbc7c41ba6bcd333}, + {0xa5c7ea73224deff3, 0x12b9b522906c0800}, + {0xcf39e50feae16bef, 0xd768226b34870a00}, + {0x81842f29f2cce375, 0xe6a1158300d46640}, + {0xa1e53af46f801c53, 0x60495ae3c1097fd0}, + {0xca5e89b18b602368, 0x385bb19cb14bdfc4}, + {0xfcf62c1dee382c42, 0x46729e03dd9ed7b5}, + {0x9e19db92b4e31ba9, 0x6c07a2c26a8346d1}, + {0xc5a05277621be293, 0xc7098b7305241885}, + {0xf70867153aa2db38, 0xb8cbee4fc66d1ea7} +#else + {0xff77b1fcbebcdc4f, 0x25e8e89c13bb0f7b}, + {0xce5d73ff402d98e3, 0xfb0a3d212dc81290}, + {0xa6b34ad8c9dfc06f, 0xf42faa48c0ea481f}, + {0x86a8d39ef77164bc, 0xae5dff9c02033198}, + {0xd98ddaee19068c76, 0x3badd624dd9b0958}, + {0xafbd2350644eeacf, 0xe5d1929ef90898fb}, + {0x8df5efabc5979c8f, 0xca8d3ffa1ef463c2}, + {0xe55990879ddcaabd, 0xcc420a6a101d0516}, + {0xb94470938fa89bce, 0xf808e40e8d5b3e6a}, + {0x95a8637627989aad, 0xdde7001379a44aa9}, + {0xf1c90080baf72cb1, 0x5324c68b12dd6339}, + {0xc350000000000000, 0x0000000000000000}, + {0x9dc5ada82b70b59d, 0xf020000000000000}, + {0xfee50b7025c36a08, 0x02f236d04753d5b4}, + {0xcde6fd5e09abcf26, 0xed4c0226b55e6f86}, + {0xa6539930bf6bff45, 0x84db8346b786151c}, + {0x865b86925b9bc5c2, 0x0b8a2392ba45a9b2}, + {0xd910f7ff28069da4, 0x1b2ba1518094da04}, + {0xaf58416654a6babb, 0x387ac8d1970027b2}, + {0x8da471a9de737e24, 0x5ceaecfed289e5d2}, + {0xe4d5e82392a40515, 0x0fabaf3feaa5334a}, + {0xb8da1662e7b00a17, 0x3d6a751f3b936243}, + {0x95527a5202df0ccb, 0x0f37801e0c43ebc8} +#endif +}; + +#if !FMT_USE_FULL_CACHE_DRAGONBOX +template +const uint64_t basic_data::powers_of_5_64[] = { + 0x0000000000000001, 0x0000000000000005, 0x0000000000000019, + 0x000000000000007d, 0x0000000000000271, 0x0000000000000c35, + 0x0000000000003d09, 0x000000000001312d, 0x000000000005f5e1, + 0x00000000001dcd65, 0x00000000009502f9, 0x0000000002e90edd, + 0x000000000e8d4a51, 0x0000000048c27395, 0x000000016bcc41e9, + 0x000000071afd498d, 0x0000002386f26fc1, 0x000000b1a2bc2ec5, + 0x000003782dace9d9, 0x00001158e460913d, 0x000056bc75e2d631, + 0x0001b1ae4d6e2ef5, 0x000878678326eac9, 0x002a5a058fc295ed, + 0x00d3c21bcecceda1, 0x0422ca8b0a00a425, 0x14adf4b7320334b9}; + +template +const uint32_t basic_data::dragonbox_pow10_recovery_errors[] = { + 0x50001400, 0x54044100, 0x54014555, 0x55954415, 0x54115555, 0x00000001, + 0x50000000, 0x00104000, 0x54010004, 0x05004001, 0x55555544, 0x41545555, + 0x54040551, 0x15445545, 0x51555514, 0x10000015, 0x00101100, 0x01100015, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x04450514, 0x45414110, + 0x55555145, 0x50544050, 0x15040155, 0x11054140, 0x50111514, 0x11451454, + 0x00400541, 0x00000000, 0x55555450, 0x10056551, 0x10054011, 0x55551014, + 0x69514555, 0x05151109, 0x00155555}; +#endif + template const char basic_data::foreground_color[] = "\x1b[38;2;"; template @@ -334,6 +1062,10 @@ const char basic_data::background_color[] = "\x1b[48;2;"; template const char basic_data::reset_color[] = "\x1b[0m"; template const wchar_t basic_data::wreset_color[] = L"\x1b[0m"; template const char basic_data::signs[] = {0, '-', '+', ' '}; +template +const char basic_data::left_padding_shifts[] = {31, 31, 0, 1, 0}; +template +const char basic_data::right_padding_shifts[] = {0, 31, 0, 1, 0}; template struct bits { static FMT_CONSTEXPR_DECL const int value = @@ -356,6 +1088,14 @@ class fp { private: using significand_type = uint64_t; + template + using is_supported_float = bool_constant; + + public: + significand_type f; + int e; + // All sizes are in bits. // Subtract 1 to account for an implicit most significant bit in the // normalized form. @@ -363,11 +1103,6 @@ class fp { std::numeric_limits::digits - 1; static FMT_CONSTEXPR_DECL const uint64_t implicit_bit = 1ULL << double_significand_size; - - public: - significand_type f; - int e; - static FMT_CONSTEXPR_DECL const int significand_size = bits::value; @@ -378,80 +1113,56 @@ class fp { // errors on platforms where double is not IEEE754. template explicit fp(Double d) { assign(d); } - // Normalizes the value converted from double and multiplied by (1 << SHIFT). - template friend fp normalize(fp value) { - // Handle subnormals. - const auto shifted_implicit_bit = fp::implicit_bit << SHIFT; - while ((value.f & shifted_implicit_bit) == 0) { - value.f <<= 1; - --value.e; - } - // Subtract 1 to account for hidden bit. - const auto offset = - fp::significand_size - fp::double_significand_size - SHIFT - 1; - value.f <<= offset; - value.e -= offset; - return value; - } - // Assigns d to this and return true iff predecessor is closer than successor. - template - bool assign(Double d) { - // Assume double is in the format [sign][exponent][significand]. - using limits = std::numeric_limits; + template ::value)> + bool assign(Float d) { + // Assume float is in the format [sign][exponent][significand]. + using limits = std::numeric_limits; + const int float_significand_size = limits::digits - 1; const int exponent_size = - bits::value - double_significand_size - 1; // -1 for sign - const uint64_t significand_mask = implicit_bit - 1; + bits::value - float_significand_size - 1; // -1 for sign + const uint64_t float_implicit_bit = 1ULL << float_significand_size; + const uint64_t significand_mask = float_implicit_bit - 1; const uint64_t exponent_mask = (~0ULL >> 1) & ~significand_mask; const int exponent_bias = (1 << exponent_size) - limits::max_exponent - 1; - auto u = bit_cast(d); + constexpr bool is_double = sizeof(Float) == sizeof(uint64_t); + auto u = bit_cast>(d); f = u & significand_mask; - auto biased_e = (u & exponent_mask) >> double_significand_size; + int biased_e = + static_cast((u & exponent_mask) >> float_significand_size); // Predecessor is closer if d is a normalized power of 2 (f == 0) other than // the smallest normalized number (biased_e > 1). bool is_predecessor_closer = f == 0 && biased_e > 1; if (biased_e != 0) - f += implicit_bit; + f += float_implicit_bit; else biased_e = 1; // Subnormals use biased exponent 1 (min exponent). - e = static_cast(biased_e - exponent_bias - double_significand_size); + e = biased_e - exponent_bias - float_significand_size; return is_predecessor_closer; } - template - bool assign(Double) { + template ::value)> + bool assign(Float) { *this = fp(); return false; } +}; - // Assigns d to this together with computing lower and upper boundaries, - // where a boundary is a value half way between the number and its predecessor - // (lower) or successor (upper). The upper boundary is normalized and lower - // has the same exponent but may be not normalized. - template boundaries assign_with_boundaries(Double d) { - bool is_lower_closer = assign(d); - fp lower = - is_lower_closer ? fp((f << 2) - 1, e - 2) : fp((f << 1) - 1, e - 1); - // 1 in normalize accounts for the exponent shift above. - fp upper = normalize<1>(fp((f << 1) + 1, e - 1)); - lower.f <<= lower.e - upper.e; - return boundaries{lower.f, upper.f}; - } - - template boundaries assign_float_with_boundaries(Double d) { - assign(d); - constexpr int min_normal_e = std::numeric_limits::min_exponent - - std::numeric_limits::digits; - significand_type half_ulp = 1 << (std::numeric_limits::digits - - std::numeric_limits::digits - 1); - if (min_normal_e > e) half_ulp <<= min_normal_e - e; - fp upper = normalize<0>(fp(f + half_ulp, e)); - fp lower = fp( - f - (half_ulp >> ((f == implicit_bit && e > min_normal_e) ? 1 : 0)), e); - lower.f <<= lower.e - upper.e; - return boundaries{lower.f, upper.f}; +// Normalizes the value converted from double and multiplied by (1 << SHIFT). +template fp normalize(fp value) { + // Handle subnormals. + const auto shifted_implicit_bit = fp::implicit_bit << SHIFT; + while ((value.f & shifted_implicit_bit) == 0) { + value.f <<= 1; + --value.e; } -}; + // Subtract 1 to account for hidden bit. + const auto offset = + fp::significand_size - fp::double_significand_size - SHIFT - 1; + value.f <<= offset; + value.e -= offset; + return value; +} inline bool operator==(fp x, fp y) { return x.f == y.f && x.e == y.e; } @@ -477,14 +1188,13 @@ inline fp operator*(fp x, fp y) { return {multiply(x.f, y.f), x.e + y.e + 64}; } // Returns a cached power of 10 `c_k = c_k.f * pow(2, c_k.e)` such that its // (binary) exponent satisfies `min_exponent <= c_k.e <= min_exponent + 28`. -FMT_FUNC fp get_cached_power(int min_exponent, int& pow10_exponent) { - const uint64_t one_over_log2_10 = 0x4d104d42; // round(pow(2, 32) / log2(10)) +inline fp get_cached_power(int min_exponent, int& pow10_exponent) { + const int shift = 32; + const auto significand = static_cast(data::log10_2_significand); int index = static_cast( - static_cast( - (min_exponent + fp::significand_size - 1) * one_over_log2_10 + - ((uint64_t(1) << 32) - 1) // ceil - ) >> - 32 // arithmetic shift + ((min_exponent + fp::significand_size - 1) * (significand >> shift) + + ((int64_t(1) << shift) - 1)) // ceil + >> 32 // arithmetic shift ); // Decimal exponent of the first (smallest) cached power of 10. const int first_dec_exp = -348; @@ -492,7 +1202,8 @@ FMT_FUNC fp get_cached_power(int min_exponent, int& pow10_exponent) { const int dec_exp_step = 8; index = (index - first_dec_exp - 1) / dec_exp_step + 1; pow10_exponent = first_dec_exp + index * dec_exp_step; - return {data::pow10_significands[index], data::pow10_exponents[index]}; + return {data::grisu_pow10_significands[index], + data::grisu_pow10_exponents[index]}; } // A simple accumulator to hold the sums of terms in bigint::square if uint128_t @@ -526,20 +1237,23 @@ class bigint { basic_memory_buffer bigits_; int exp_; + bigit operator[](int index) const { return bigits_[to_unsigned(index)]; } + bigit& operator[](int index) { return bigits_[to_unsigned(index)]; } + static FMT_CONSTEXPR_DECL const int bigit_bits = bits::value; friend struct formatter; void subtract_bigits(int index, bigit other, bigit& borrow) { - auto result = static_cast(bigits_[index]) - other - borrow; - bigits_[index] = static_cast(result); + auto result = static_cast((*this)[index]) - other - borrow; + (*this)[index] = static_cast(result); borrow = static_cast(result >> (bigit_bits * 2 - 1)); } void remove_leading_zeros() { int num_bigits = static_cast(bigits_.size()) - 1; - while (num_bigits > 0 && bigits_[num_bigits] == 0) --num_bigits; - bigits_.resize(num_bigits + 1); + while (num_bigits > 0 && (*this)[num_bigits] == 0) --num_bigits; + bigits_.resize(to_unsigned(num_bigits + 1)); } // Computes *this -= other assuming aligned bigints and *this >= other. @@ -548,10 +1262,8 @@ class bigint { FMT_ASSERT(compare(*this, other) >= 0, ""); bigit borrow = 0; int i = other.exp_ - exp_; - for (int j = 0, n = static_cast(other.bigits_.size()); j != n; - ++i, ++j) { + for (size_t j = 0, n = other.bigits_.size(); j != n; ++i, ++j) subtract_bigits(i, other.bigits_[j], borrow); - } while (borrow > 0) subtract_bigits(i, 0, borrow); remove_leading_zeros(); } @@ -593,14 +1305,15 @@ class bigint { void operator=(const bigint&) = delete; void assign(const bigint& other) { - bigits_.resize(other.bigits_.size()); + auto size = other.bigits_.size(); + bigits_.resize(size); auto data = other.bigits_.data(); - std::copy(data, data + other.bigits_.size(), bigits_.data()); + std::copy(data, data + size, make_checked(bigits_.data(), size)); exp_ = other.exp_; } void assign(uint64_t n) { - int num_bigits = 0; + size_t num_bigits = 0; do { bigits_[num_bigits++] = n & ~bigit(0); n >>= bigit_bits; @@ -611,7 +1324,7 @@ class bigint { int num_bigits() const { return static_cast(bigits_.size()) + exp_; } - bigint& operator<<=(int shift) { + FMT_NOINLINE bigint& operator<<=(int shift) { assert(shift >= 0); exp_ += shift / bigit_bits; shift %= bigit_bits; @@ -641,7 +1354,7 @@ class bigint { int end = i - j; if (end < 0) end = 0; for (; i >= end; --i, --j) { - bigit lhs_bigit = lhs.bigits_[i], rhs_bigit = rhs.bigits_[j]; + bigit lhs_bigit = lhs[i], rhs_bigit = rhs[j]; if (lhs_bigit != rhs_bigit) return lhs_bigit > rhs_bigit ? 1 : -1; } if (i != j) return i > j ? 1 : -1; @@ -656,7 +1369,7 @@ class bigint { if (max_lhs_bigits + 1 < num_rhs_bigits) return -1; if (max_lhs_bigits > num_rhs_bigits) return 1; auto get_bigit = [](const bigint& n, int i) -> bigit { - return i >= n.exp_ && i < n.num_bigits() ? n.bigits_[i - n.exp_] : 0; + return i >= n.exp_ && i < n.num_bigits() ? n[i - n.exp_] : 0; }; double_bigit borrow = 0; int min_exp = (std::min)((std::min)(lhs1.exp_, lhs2.exp_), rhs.exp_); @@ -696,7 +1409,7 @@ class bigint { basic_memory_buffer n(std::move(bigits_)); int num_bigits = static_cast(bigits_.size()); int num_result_bigits = 2 * num_bigits; - bigits_.resize(num_result_bigits); + bigits_.resize(to_unsigned(num_result_bigits)); using accumulator_t = conditional_t; auto sum = accumulator_t(); for (int bigit_index = 0; bigit_index < num_bigits; ++bigit_index) { @@ -706,7 +1419,7 @@ class bigint { // Most terms are multiplied twice which can be optimized in the future. sum += static_cast(n[i]) * n[j]; } - bigits_[bigit_index] = static_cast(sum); + (*this)[bigit_index] = static_cast(sum); sum >>= bits::value; // Compute the carry. } // Do the same for the top half. @@ -714,7 +1427,7 @@ class bigint { ++bigit_index) { for (int j = num_bigits - 1, i = bigit_index - j; i < num_bigits;) sum += static_cast(n[i++]) * n[j--]; - bigits_[bigit_index] = static_cast(sum); + (*this)[bigit_index] = static_cast(sum); sum >>= bits::value; } --num_result_bigits; @@ -722,22 +1435,26 @@ class bigint { exp_ *= 2; } + // If this bigint has a bigger exponent than other, adds trailing zero to make + // exponents equal. This simplifies some operations such as subtraction. + void align(const bigint& other) { + int exp_difference = exp_ - other.exp_; + if (exp_difference <= 0) return; + int num_bigits = static_cast(bigits_.size()); + bigits_.resize(to_unsigned(num_bigits + exp_difference)); + for (int i = num_bigits - 1, j = i + exp_difference; i >= 0; --i, --j) + bigits_[j] = bigits_[i]; + std::uninitialized_fill_n(bigits_.data(), exp_difference, 0); + exp_ -= exp_difference; + } + // Divides this bignum by divisor, assigning the remainder to this and // returning the quotient. int divmod_assign(const bigint& divisor) { FMT_ASSERT(this != &divisor, ""); if (compare(*this, divisor) < 0) return 0; - int num_bigits = static_cast(bigits_.size()); - FMT_ASSERT(divisor.bigits_[divisor.bigits_.size() - 1] != 0, ""); - int exp_difference = exp_ - divisor.exp_; - if (exp_difference > 0) { - // Align bigints by adding trailing zeros to simplify subtraction. - bigits_.resize(num_bigits + exp_difference); - for (int i = num_bigits - 1, j = i + exp_difference; i >= 0; --i, --j) - bigits_[j] = bigits_[i]; - std::uninitialized_fill_n(bigits_.data(), exp_difference, 0); - exp_ -= exp_difference; - } + FMT_ASSERT(divisor.bigits_[divisor.bigits_.size() - 1u] != 0, ""); + align(divisor); int quotient = 0; do { subtract_aligned(divisor); @@ -747,7 +1464,7 @@ class bigint { } }; -enum round_direction { unknown, up, down }; +enum class round_direction { unknown, up, down }; // Given the divisor (normally a power of 10), the remainder = v % divisor for // some number v and the error, returns whether v should be rounded up, down, or @@ -760,13 +1477,13 @@ inline round_direction get_round_direction(uint64_t divisor, uint64_t remainder, FMT_ASSERT(error < divisor - error, ""); // error * 2 won't overflow. // Round down if (remainder + error) * 2 <= divisor. if (remainder <= divisor - remainder && error * 2 <= divisor - remainder * 2) - return down; + return round_direction::down; // Round up if (remainder - error) * 2 >= divisor. if (remainder >= error && remainder - error >= divisor - (remainder - error)) { - return up; + return round_direction::up; } - return unknown; + return round_direction::unknown; } namespace digits { @@ -842,8 +1559,7 @@ FMT_ALWAYS_INLINE digits::result grisu_gen_digits(fp value, uint64_t error, FMT_ASSERT(false, "invalid number of digits"); } --exp; - uint64_t remainder = - (static_cast(integral) << -one.e) + fractional; + auto remainder = (static_cast(integral) << -one.e) + fractional; result = handler.on_digit(static_cast('0' + digit), data::powers_of_10_64[exp] << -one.e, remainder, error, exp, true); @@ -853,8 +1569,7 @@ FMT_ALWAYS_INLINE digits::result grisu_gen_digits(fp value, uint64_t error, for (;;) { fractional *= 10; error *= 10; - char digit = - static_cast('0' + static_cast(fractional >> -one.e)); + char digit = static_cast('0' + (fractional >> -one.e)); fractional &= one.f - 1; --exp; result = handler.on_digit(digit, one.f, fractional, error, exp, false); @@ -882,8 +1597,8 @@ struct fixed_handler { if (precision > 0) return digits::more; if (precision < 0) return digits::done; auto dir = get_round_direction(divisor, remainder, error); - if (dir == unknown) return digits::error; - buf[size++] = dir == up ? '1' : '0'; + if (dir == round_direction::unknown) return digits::error; + buf[size++] = dir == round_direction::up ? '1' : '0'; return digits::done; } @@ -891,6 +1606,7 @@ struct fixed_handler { uint64_t error, int, bool integral) { FMT_ASSERT(remainder < divisor, ""); buf[size++] = digit; + if (!integral && error >= remainder) return digits::error; if (size < precision) return digits::more; if (!integral) { // Check if error * 2 < divisor with overflow prevention. @@ -901,7 +1617,8 @@ struct fixed_handler { FMT_ASSERT(error == 1 && divisor > 2, ""); } auto dir = get_round_direction(divisor, remainder, error); - if (dir != up) return dir == down ? digits::done : digits::error; + if (dir != round_direction::up) + return dir == round_direction::down ? digits::done : digits::error; ++buf[size - 1]; for (int i = size - 1; i > 0 && buf[i] > '9'; --i) { buf[i] = '0'; @@ -909,59 +1626,684 @@ struct fixed_handler { } if (buf[0] > '9') { buf[0] = '1'; - buf[size++] = '0'; + if (fixed) + buf[size++] = '0'; + else + ++exp10; } return digits::done; } }; -// The shortest representation digit handler. -struct grisu_shortest_handler { - char* buf; - int size; - // Distance between scaled value and upper bound (wp_W in Grisu3). - uint64_t diff; +// Implementation of Dragonbox algorithm: https://github.com/jk-jeon/dragonbox. +namespace dragonbox { +// Computes 128-bit result of multiplication of two 64-bit unsigned integers. +FMT_SAFEBUFFERS inline uint128_wrapper umul128(uint64_t x, + uint64_t y) FMT_NOEXCEPT { +#if FMT_USE_INT128 + return static_cast(x) * static_cast(y); +#elif defined(_MSC_VER) && defined(_M_X64) + uint128_wrapper result; + result.low_ = _umul128(x, y, &result.high_); + return result; +#else + const uint64_t mask = (uint64_t(1) << 32) - uint64_t(1); + + uint64_t a = x >> 32; + uint64_t b = x & mask; + uint64_t c = y >> 32; + uint64_t d = y & mask; + + uint64_t ac = a * c; + uint64_t bc = b * c; + uint64_t ad = a * d; + uint64_t bd = b * d; + + uint64_t intermediate = (bd >> 32) + (ad & mask) + (bc & mask); + + return {ac + (intermediate >> 32) + (ad >> 32) + (bc >> 32), + (intermediate << 32) + (bd & mask)}; +#endif +} + +// Computes upper 64 bits of multiplication of two 64-bit unsigned integers. +FMT_SAFEBUFFERS inline uint64_t umul128_upper64(uint64_t x, + uint64_t y) FMT_NOEXCEPT { +#if FMT_USE_INT128 + auto p = static_cast(x) * static_cast(y); + return static_cast(p >> 64); +#elif defined(_MSC_VER) && defined(_M_X64) + return __umulh(x, y); +#else + return umul128(x, y).high(); +#endif +} + +// Computes upper 64 bits of multiplication of a 64-bit unsigned integer and a +// 128-bit unsigned integer. +FMT_SAFEBUFFERS inline uint64_t umul192_upper64(uint64_t x, uint128_wrapper y) + FMT_NOEXCEPT { + uint128_wrapper g0 = umul128(x, y.high()); + g0 += umul128_upper64(x, y.low()); + return g0.high(); +} + +// Computes upper 32 bits of multiplication of a 32-bit unsigned integer and a +// 64-bit unsigned integer. +inline uint32_t umul96_upper32(uint32_t x, uint64_t y) FMT_NOEXCEPT { + return static_cast(umul128_upper64(x, y)); +} + +// Computes middle 64 bits of multiplication of a 64-bit unsigned integer and a +// 128-bit unsigned integer. +FMT_SAFEBUFFERS inline uint64_t umul192_middle64(uint64_t x, uint128_wrapper y) + FMT_NOEXCEPT { + uint64_t g01 = x * y.high(); + uint64_t g10 = umul128_upper64(x, y.low()); + return g01 + g10; +} + +// Computes lower 64 bits of multiplication of a 32-bit unsigned integer and a +// 64-bit unsigned integer. +inline uint64_t umul96_lower64(uint32_t x, uint64_t y) FMT_NOEXCEPT { + return x * y; +} + +// Computes floor(log10(pow(2, e))) for e in [-1700, 1700] using the method from +// https://fmt.dev/papers/Grisu-Exact.pdf#page=5, section 3.4. +inline int floor_log10_pow2(int e) FMT_NOEXCEPT { + FMT_ASSERT(e <= 1700 && e >= -1700, "too large exponent"); + const int shift = 22; + return (e * static_cast(data::log10_2_significand >> (64 - shift))) >> + shift; +} + +// Various fast log computations. +inline int floor_log2_pow10(int e) FMT_NOEXCEPT { + FMT_ASSERT(e <= 1233 && e >= -1233, "too large exponent"); + const uint64_t log2_10_integer_part = 3; + const uint64_t log2_10_fractional_digits = 0x5269e12f346e2bf9; + const int shift_amount = 19; + return (e * static_cast( + (log2_10_integer_part << shift_amount) | + (log2_10_fractional_digits >> (64 - shift_amount)))) >> + shift_amount; +} +inline int floor_log10_pow2_minus_log10_4_over_3(int e) FMT_NOEXCEPT { + FMT_ASSERT(e <= 1700 && e >= -1700, "too large exponent"); + const uint64_t log10_4_over_3_fractional_digits = 0x1ffbfc2bbc780375; + const int shift_amount = 22; + return (e * static_cast(data::log10_2_significand >> + (64 - shift_amount)) - + static_cast(log10_4_over_3_fractional_digits >> + (64 - shift_amount))) >> + shift_amount; +} + +// Returns true iff x is divisible by pow(2, exp). +inline bool divisible_by_power_of_2(uint32_t x, int exp) FMT_NOEXCEPT { + FMT_ASSERT(exp >= 1, ""); + FMT_ASSERT(x != 0, ""); +#ifdef FMT_BUILTIN_CTZ + return FMT_BUILTIN_CTZ(x) >= exp; +#else + return exp < num_bits() && x == ((x >> exp) << exp); +#endif +} +inline bool divisible_by_power_of_2(uint64_t x, int exp) FMT_NOEXCEPT { + FMT_ASSERT(exp >= 1, ""); + FMT_ASSERT(x != 0, ""); +#ifdef FMT_BUILTIN_CTZLL + return FMT_BUILTIN_CTZLL(x) >= exp; +#else + return exp < num_bits()) && x == ((x >> exp) << exp); +#endif +} + +// Returns true iff x is divisible by pow(5, exp). +inline bool divisible_by_power_of_5(uint32_t x, int exp) FMT_NOEXCEPT { + FMT_ASSERT(exp <= 10, "too large exponent"); + return x * data::divtest_table_for_pow5_32[exp].mod_inv <= + data::divtest_table_for_pow5_32[exp].max_quotient; +} +inline bool divisible_by_power_of_5(uint64_t x, int exp) FMT_NOEXCEPT { + FMT_ASSERT(exp <= 23, "too large exponent"); + return x * data::divtest_table_for_pow5_64[exp].mod_inv <= + data::divtest_table_for_pow5_64[exp].max_quotient; +} + +// Replaces n by floor(n / pow(5, N)) returning true if and only if n is +// divisible by pow(5, N). +// Precondition: n <= 2 * pow(5, N + 1). +template +bool check_divisibility_and_divide_by_pow5(uint32_t& n) FMT_NOEXCEPT { + static constexpr struct { + uint32_t magic_number; + int bits_for_comparison; + uint32_t threshold; + int shift_amount; + } infos[] = {{0xcccd, 16, 0x3333, 18}, {0xa429, 8, 0x0a, 20}}; + constexpr auto info = infos[N - 1]; + n *= info.magic_number; + const uint32_t comparison_mask = (1u << info.bits_for_comparison) - 1; + bool result = (n & comparison_mask) <= info.threshold; + n >>= info.shift_amount; + return result; +} + +// Computes floor(n / pow(10, N)) for small n and N. +// Precondition: n <= pow(10, N + 1). +template uint32_t small_division_by_pow10(uint32_t n) FMT_NOEXCEPT { + static constexpr struct { + uint32_t magic_number; + int shift_amount; + uint32_t divisor_times_10; + } infos[] = {{0xcccd, 19, 100}, {0xa3d8, 22, 1000}}; + constexpr auto info = infos[N - 1]; + FMT_ASSERT(n <= info.divisor_times_10, "n is too large"); + return n * info.magic_number >> info.shift_amount; +} + +// Computes floor(n / 10^(kappa + 1)) (float) +inline uint32_t divide_by_10_to_kappa_plus_1(uint32_t n) FMT_NOEXCEPT { + return n / float_info::big_divisor; +} +// Computes floor(n / 10^(kappa + 1)) (double) +inline uint64_t divide_by_10_to_kappa_plus_1(uint64_t n) FMT_NOEXCEPT { + return umul128_upper64(n, 0x83126e978d4fdf3c) >> 9; +} + +// Various subroutines using pow10 cache +template struct cache_accessor; + +template <> struct cache_accessor { + using carrier_uint = float_info::carrier_uint; + using cache_entry_type = uint64_t; + + static uint64_t get_cached_power(int k) FMT_NOEXCEPT { + FMT_ASSERT(k >= float_info::min_k && k <= float_info::max_k, + "k is out of range"); + return data::dragonbox_pow10_significands_64[k - float_info::min_k]; + } + + static carrier_uint compute_mul(carrier_uint u, + const cache_entry_type& cache) FMT_NOEXCEPT { + return umul96_upper32(u, cache); + } + + static uint32_t compute_delta(const cache_entry_type& cache, + int beta_minus_1) FMT_NOEXCEPT { + return static_cast(cache >> (64 - 1 - beta_minus_1)); + } + + static bool compute_mul_parity(carrier_uint two_f, + const cache_entry_type& cache, + int beta_minus_1) FMT_NOEXCEPT { + FMT_ASSERT(beta_minus_1 >= 1, ""); + FMT_ASSERT(beta_minus_1 < 64, ""); + + return ((umul96_lower64(two_f, cache) >> (64 - beta_minus_1)) & 1) != 0; + } + + static carrier_uint compute_left_endpoint_for_shorter_interval_case( + const cache_entry_type& cache, int beta_minus_1) FMT_NOEXCEPT { + return static_cast( + (cache - (cache >> (float_info::significand_bits + 2))) >> + (64 - float_info::significand_bits - 1 - beta_minus_1)); + } + + static carrier_uint compute_right_endpoint_for_shorter_interval_case( + const cache_entry_type& cache, int beta_minus_1) FMT_NOEXCEPT { + return static_cast( + (cache + (cache >> (float_info::significand_bits + 1))) >> + (64 - float_info::significand_bits - 1 - beta_minus_1)); + } + + static carrier_uint compute_round_up_for_shorter_interval_case( + const cache_entry_type& cache, int beta_minus_1) FMT_NOEXCEPT { + return (static_cast( + cache >> + (64 - float_info::significand_bits - 2 - beta_minus_1)) + + 1) / + 2; + } +}; + +template <> struct cache_accessor { + using carrier_uint = float_info::carrier_uint; + using cache_entry_type = uint128_wrapper; + + static uint128_wrapper get_cached_power(int k) FMT_NOEXCEPT { + FMT_ASSERT(k >= float_info::min_k && k <= float_info::max_k, + "k is out of range"); + +#if FMT_USE_FULL_CACHE_DRAGONBOX + return data::dragonbox_pow10_significands_128[k - + float_info::min_k]; +#else + static const int compression_ratio = 27; + + // Compute base index. + int cache_index = (k - float_info::min_k) / compression_ratio; + int kb = cache_index * compression_ratio + float_info::min_k; + int offset = k - kb; + + // Get base cache. + uint128_wrapper base_cache = + data::dragonbox_pow10_significands_128[cache_index]; + if (offset == 0) return base_cache; + + // Compute the required amount of bit-shift. + int alpha = floor_log2_pow10(kb + offset) - floor_log2_pow10(kb) - offset; + FMT_ASSERT(alpha > 0 && alpha < 64, "shifting error detected"); + + // Try to recover the real cache. + uint64_t pow5 = data::powers_of_5_64[offset]; + uint128_wrapper recovered_cache = umul128(base_cache.high(), pow5); + uint128_wrapper middle_low = + umul128(base_cache.low() - (kb < 0 ? 1 : 0), pow5); + + recovered_cache += middle_low.high(); + + uint64_t high_to_middle = recovered_cache.high() << (64 - alpha); + uint64_t middle_to_low = recovered_cache.low() << (64 - alpha); + + recovered_cache = + uint128_wrapper{(recovered_cache.low() >> alpha) | high_to_middle, + ((middle_low.low() >> alpha) | middle_to_low)}; + + if (kb < 0) recovered_cache += 1; + + // Get error. + int error_idx = (k - float_info::min_k) / 16; + uint32_t error = (data::dragonbox_pow10_recovery_errors[error_idx] >> + ((k - float_info::min_k) % 16) * 2) & + 0x3; + + // Add the error back. + FMT_ASSERT(recovered_cache.low() + error >= recovered_cache.low(), ""); + return {recovered_cache.high(), recovered_cache.low() + error}; +#endif + } + + static carrier_uint compute_mul(carrier_uint u, + const cache_entry_type& cache) FMT_NOEXCEPT { + return umul192_upper64(u, cache); + } + + static uint32_t compute_delta(cache_entry_type const& cache, + int beta_minus_1) FMT_NOEXCEPT { + return static_cast(cache.high() >> (64 - 1 - beta_minus_1)); + } + + static bool compute_mul_parity(carrier_uint two_f, + const cache_entry_type& cache, + int beta_minus_1) FMT_NOEXCEPT { + FMT_ASSERT(beta_minus_1 >= 1, ""); + FMT_ASSERT(beta_minus_1 < 64, ""); + + return ((umul192_middle64(two_f, cache) >> (64 - beta_minus_1)) & 1) != 0; + } + + static carrier_uint compute_left_endpoint_for_shorter_interval_case( + const cache_entry_type& cache, int beta_minus_1) FMT_NOEXCEPT { + return (cache.high() - + (cache.high() >> (float_info::significand_bits + 2))) >> + (64 - float_info::significand_bits - 1 - beta_minus_1); + } - digits::result on_start(uint64_t, uint64_t, uint64_t, int&) { - return digits::more; + static carrier_uint compute_right_endpoint_for_shorter_interval_case( + const cache_entry_type& cache, int beta_minus_1) FMT_NOEXCEPT { + return (cache.high() + + (cache.high() >> (float_info::significand_bits + 1))) >> + (64 - float_info::significand_bits - 1 - beta_minus_1); } - // Decrement the generated number approaching value from above. - void round(uint64_t d, uint64_t divisor, uint64_t& remainder, - uint64_t error) { - while ( - remainder < d && error - remainder >= divisor && - (remainder + divisor < d || d - remainder >= remainder + divisor - d)) { - --buf[size - 1]; - remainder += divisor; + static carrier_uint compute_round_up_for_shorter_interval_case( + const cache_entry_type& cache, int beta_minus_1) FMT_NOEXCEPT { + return ((cache.high() >> + (64 - float_info::significand_bits - 2 - beta_minus_1)) + + 1) / + 2; + } +}; + +// Various integer checks +template +bool is_left_endpoint_integer_shorter_interval(int exponent) FMT_NOEXCEPT { + return exponent >= + float_info< + T>::case_shorter_interval_left_endpoint_lower_threshold && + exponent <= + float_info::case_shorter_interval_left_endpoint_upper_threshold; +} +template +bool is_endpoint_integer(typename float_info::carrier_uint two_f, + int exponent, int minus_k) FMT_NOEXCEPT { + if (exponent < float_info::case_fc_pm_half_lower_threshold) return false; + // For k >= 0. + if (exponent <= float_info::case_fc_pm_half_upper_threshold) return true; + // For k < 0. + if (exponent > float_info::divisibility_check_by_5_threshold) return false; + return divisible_by_power_of_5(two_f, minus_k); +} + +template +bool is_center_integer(typename float_info::carrier_uint two_f, int exponent, + int minus_k) FMT_NOEXCEPT { + // Exponent for 5 is negative. + if (exponent > float_info::divisibility_check_by_5_threshold) return false; + if (exponent > float_info::case_fc_upper_threshold) + return divisible_by_power_of_5(two_f, minus_k); + // Both exponents are nonnegative. + if (exponent >= float_info::case_fc_lower_threshold) return true; + // Exponent for 2 is negative. + return divisible_by_power_of_2(two_f, minus_k - exponent + 1); +} + +// Remove trailing zeros from n and return the number of zeros removed (float) +FMT_ALWAYS_INLINE int remove_trailing_zeros(uint32_t& n) FMT_NOEXCEPT { +#ifdef FMT_BUILTIN_CTZ + int t = FMT_BUILTIN_CTZ(n); +#else + int t = ctz(n); +#endif + if (t > float_info::max_trailing_zeros) + t = float_info::max_trailing_zeros; + + const uint32_t mod_inv1 = 0xcccccccd; + const uint32_t max_quotient1 = 0x33333333; + const uint32_t mod_inv2 = 0xc28f5c29; + const uint32_t max_quotient2 = 0x0a3d70a3; + + int s = 0; + for (; s < t - 1; s += 2) { + if (n * mod_inv2 > max_quotient2) break; + n *= mod_inv2; + } + if (s < t && n * mod_inv1 <= max_quotient1) { + n *= mod_inv1; + ++s; + } + n >>= s; + return s; +} + +// Removes trailing zeros and returns the number of zeros removed (double) +FMT_ALWAYS_INLINE int remove_trailing_zeros(uint64_t& n) FMT_NOEXCEPT { +#ifdef FMT_BUILTIN_CTZLL + int t = FMT_BUILTIN_CTZLL(n); +#else + int t = ctzll(n); +#endif + if (t > float_info::max_trailing_zeros) + t = float_info::max_trailing_zeros; + // Divide by 10^8 and reduce to 32-bits + // Since ret_value.significand <= (2^64 - 1) / 1000 < 10^17, + // both of the quotient and the r should fit in 32-bits + + const uint32_t mod_inv1 = 0xcccccccd; + const uint32_t max_quotient1 = 0x33333333; + const uint64_t mod_inv8 = 0xc767074b22e90e21; + const uint64_t max_quotient8 = 0x00002af31dc46118; + + // If the number is divisible by 1'0000'0000, work with the quotient + if (t >= 8) { + auto quotient_candidate = n * mod_inv8; + + if (quotient_candidate <= max_quotient8) { + auto quotient = static_cast(quotient_candidate >> 8); + + int s = 8; + for (; s < t; ++s) { + if (quotient * mod_inv1 > max_quotient1) break; + quotient *= mod_inv1; + } + quotient >>= (s - 8); + n = quotient; + return s; } } - // Implements Grisu's round_weed. - digits::result on_digit(char digit, uint64_t divisor, uint64_t remainder, - uint64_t error, int exp, bool integral) { - buf[size++] = digit; - if (remainder >= error) return digits::more; - uint64_t unit = integral ? 1 : data::powers_of_10_64[-exp]; - uint64_t up = (diff - 1) * unit; // wp_Wup - round(up, divisor, remainder, error); - uint64_t down = (diff + 1) * unit; // wp_Wdown - if (remainder < down && error - remainder >= divisor && - (remainder + divisor < down || - down - remainder > remainder + divisor - down)) { - return digits::error; + // Otherwise, work with the remainder + auto quotient = static_cast(n / 100000000); + auto remainder = static_cast(n - 100000000 * quotient); + + if (t == 0 || remainder * mod_inv1 > max_quotient1) { + return 0; + } + remainder *= mod_inv1; + + if (t == 1 || remainder * mod_inv1 > max_quotient1) { + n = (remainder >> 1) + quotient * 10000000ull; + return 1; + } + remainder *= mod_inv1; + + if (t == 2 || remainder * mod_inv1 > max_quotient1) { + n = (remainder >> 2) + quotient * 1000000ull; + return 2; + } + remainder *= mod_inv1; + + if (t == 3 || remainder * mod_inv1 > max_quotient1) { + n = (remainder >> 3) + quotient * 100000ull; + return 3; + } + remainder *= mod_inv1; + + if (t == 4 || remainder * mod_inv1 > max_quotient1) { + n = (remainder >> 4) + quotient * 10000ull; + return 4; + } + remainder *= mod_inv1; + + if (t == 5 || remainder * mod_inv1 > max_quotient1) { + n = (remainder >> 5) + quotient * 1000ull; + return 5; + } + remainder *= mod_inv1; + + if (t == 6 || remainder * mod_inv1 > max_quotient1) { + n = (remainder >> 6) + quotient * 100ull; + return 6; + } + remainder *= mod_inv1; + + n = (remainder >> 7) + quotient * 10ull; + return 7; +} + +// The main algorithm for shorter interval case +template +FMT_ALWAYS_INLINE FMT_SAFEBUFFERS decimal_fp shorter_interval_case( + int exponent) FMT_NOEXCEPT { + decimal_fp ret_value; + // Compute k and beta + const int minus_k = floor_log10_pow2_minus_log10_4_over_3(exponent); + const int beta_minus_1 = exponent + floor_log2_pow10(-minus_k); + + // Compute xi and zi + using cache_entry_type = typename cache_accessor::cache_entry_type; + const cache_entry_type cache = cache_accessor::get_cached_power(-minus_k); + + auto xi = cache_accessor::compute_left_endpoint_for_shorter_interval_case( + cache, beta_minus_1); + auto zi = cache_accessor::compute_right_endpoint_for_shorter_interval_case( + cache, beta_minus_1); + + // If the left endpoint is not an integer, increase it + if (!is_left_endpoint_integer_shorter_interval(exponent)) ++xi; + + // Try bigger divisor + ret_value.significand = zi / 10; + + // If succeed, remove trailing zeros if necessary and return + if (ret_value.significand * 10 >= xi) { + ret_value.exponent = minus_k + 1; + ret_value.exponent += remove_trailing_zeros(ret_value.significand); + return ret_value; + } + + // Otherwise, compute the round-up of y + ret_value.significand = + cache_accessor::compute_round_up_for_shorter_interval_case( + cache, beta_minus_1); + ret_value.exponent = minus_k; + + // When tie occurs, choose one of them according to the rule + if (exponent >= float_info::shorter_interval_tie_lower_threshold && + exponent <= float_info::shorter_interval_tie_upper_threshold) { + ret_value.significand = ret_value.significand % 2 == 0 + ? ret_value.significand + : ret_value.significand - 1; + } else if (ret_value.significand < xi) { + ++ret_value.significand; + } + return ret_value; +} + +template +FMT_SAFEBUFFERS decimal_fp to_decimal(T x) FMT_NOEXCEPT { + // Step 1: integer promotion & Schubfach multiplier calculation. + + using carrier_uint = typename float_info::carrier_uint; + using cache_entry_type = typename cache_accessor::cache_entry_type; + auto br = bit_cast(x); + + // Extract significand bits and exponent bits. + const carrier_uint significand_mask = + (static_cast(1) << float_info::significand_bits) - 1; + carrier_uint significand = (br & significand_mask); + int exponent = static_cast((br & exponent_mask()) >> + float_info::significand_bits); + + if (exponent != 0) { // Check if normal. + exponent += float_info::exponent_bias - float_info::significand_bits; + + // Shorter interval case; proceed like Schubfach. + if (significand == 0) return shorter_interval_case(exponent); + + significand |= + (static_cast(1) << float_info::significand_bits); + } else { + // Subnormal case; the interval is always regular. + if (significand == 0) return {0, 0}; + exponent = float_info::min_exponent - float_info::significand_bits; + } + + const bool include_left_endpoint = (significand % 2 == 0); + const bool include_right_endpoint = include_left_endpoint; + + // Compute k and beta. + const int minus_k = floor_log10_pow2(exponent) - float_info::kappa; + const cache_entry_type cache = cache_accessor::get_cached_power(-minus_k); + const int beta_minus_1 = exponent + floor_log2_pow10(-minus_k); + + // Compute zi and deltai + // 10^kappa <= deltai < 10^(kappa + 1) + const uint32_t deltai = cache_accessor::compute_delta(cache, beta_minus_1); + const carrier_uint two_fc = significand << 1; + const carrier_uint two_fr = two_fc | 1; + const carrier_uint zi = + cache_accessor::compute_mul(two_fr << beta_minus_1, cache); + + // Step 2: Try larger divisor; remove trailing zeros if necessary + + // Using an upper bound on zi, we might be able to optimize the division + // better than the compiler; we are computing zi / big_divisor here + decimal_fp ret_value; + ret_value.significand = divide_by_10_to_kappa_plus_1(zi); + uint32_t r = static_cast(zi - float_info::big_divisor * + ret_value.significand); + + if (r > deltai) { + goto small_divisor_case_label; + } else if (r < deltai) { + // Exclude the right endpoint if necessary + if (r == 0 && !include_right_endpoint && + is_endpoint_integer(two_fr, exponent, minus_k)) { + --ret_value.significand; + r = float_info::big_divisor; + goto small_divisor_case_label; + } + } else { + // r == deltai; compare fractional parts + // Check conditions in the order different from the paper + // to take advantage of short-circuiting + const carrier_uint two_fl = two_fc - 1; + if ((!include_left_endpoint || + !is_endpoint_integer(two_fl, exponent, minus_k)) && + !cache_accessor::compute_mul_parity(two_fl, cache, beta_minus_1)) { + goto small_divisor_case_label; } - return 2 * unit <= remainder && remainder <= error - 4 * unit - ? digits::done - : digits::error; } -}; + ret_value.exponent = minus_k + float_info::kappa + 1; + + // We may need to remove trailing zeros + ret_value.exponent += remove_trailing_zeros(ret_value.significand); + return ret_value; + + // Step 3: Find the significand with the smaller divisor + +small_divisor_case_label: + ret_value.significand *= 10; + ret_value.exponent = minus_k + float_info::kappa; + + const uint32_t mask = (1u << float_info::kappa) - 1; + auto dist = r - (deltai / 2) + (float_info::small_divisor / 2); + + // Is dist divisible by 2^kappa? + if ((dist & mask) == 0) { + const bool approx_y_parity = + ((dist ^ (float_info::small_divisor / 2)) & 1) != 0; + dist >>= float_info::kappa; + + // Is dist divisible by 5^kappa? + if (check_divisibility_and_divide_by_pow5::kappa>(dist)) { + ret_value.significand += dist; + + // Check z^(f) >= epsilon^(f) + // We have either yi == zi - epsiloni or yi == (zi - epsiloni) - 1, + // where yi == zi - epsiloni if and only if z^(f) >= epsilon^(f) + // Since there are only 2 possibilities, we only need to care about the + // parity. Also, zi and r should have the same parity since the divisor + // is an even number + if (cache_accessor::compute_mul_parity(two_fc, cache, beta_minus_1) != + approx_y_parity) { + --ret_value.significand; + } else { + // If z^(f) >= epsilon^(f), we might have a tie + // when z^(f) == epsilon^(f), or equivalently, when y is an integer + if (is_center_integer(two_fc, exponent, minus_k)) { + ret_value.significand = ret_value.significand % 2 == 0 + ? ret_value.significand + : ret_value.significand - 1; + } + } + } + // Is dist not divisible by 5^kappa? + else { + ret_value.significand += dist; + } + } + // Is dist not divisible by 2^kappa? + else { + // Since we know dist is small, we might be able to optimize the division + // better than the compiler; we are computing dist / small_divisor here + ret_value.significand += + small_division_by_pow10::kappa>(dist); + } + return ret_value; +} +} // namespace dragonbox // Formats value using a variation of the Fixed-Precision Positive // Floating-Point Printout ((FPP)^2) algorithm by Steele & White: // https://fmt.dev/p372-steele.pdf. template -void fallback_format(Double d, buffer& buf, int& exp10) { +void fallback_format(Double d, int num_digits, bool binary32, buffer& buf, + int& exp10) { bigint numerator; // 2 * R in (FPP)^2. bigint denominator; // 2 * S in (FPP)^2. // lower and upper are differences between value and corresponding boundaries. @@ -972,8 +2314,9 @@ void fallback_format(Double d, buffer& buf, int& exp10) { // Shift numerator and denominator by an extra bit or two (if lower boundary // is closer) to make lower and upper integers. This eliminates multiplication // by 2 during later computations. - // TODO: handle float - int shift = value.assign(d) ? 2 : 1; + const bool is_predecessor_closer = + binary32 ? value.assign(static_cast(d)) : value.assign(d); + int shift = is_predecessor_closer ? 2 : 1; uint64_t significand = value.f << shift; if (value.e >= 0) { numerator.assign(significand); @@ -1008,42 +2351,76 @@ void fallback_format(Double d, buffer& buf, int& exp10) { upper = &upper_store; } } - if (!upper) upper = &lower; // Invariant: value == (numerator / denominator) * pow(10, exp10). - bool even = (value.f & 1) == 0; - int num_digits = 0; - char* data = buf.data(); - for (;;) { - int digit = numerator.divmod_assign(denominator); - bool low = compare(numerator, lower) - even < 0; // numerator <[=] lower. - // numerator + upper >[=] pow10: - bool high = add_compare(numerator, *upper, denominator) + even > 0; - data[num_digits++] = static_cast('0' + digit); - if (low || high) { - if (!low) { - ++data[num_digits - 1]; - } else if (high) { - int result = add_compare(numerator, numerator, denominator); - // Round half to even. - if (result > 0 || (result == 0 && (digit % 2) != 0)) + if (num_digits < 0) { + // Generate the shortest representation. + if (!upper) upper = &lower; + bool even = (value.f & 1) == 0; + num_digits = 0; + char* data = buf.data(); + for (;;) { + int digit = numerator.divmod_assign(denominator); + bool low = compare(numerator, lower) - even < 0; // numerator <[=] lower. + // numerator + upper >[=] pow10: + bool high = add_compare(numerator, *upper, denominator) + even > 0; + data[num_digits++] = static_cast('0' + digit); + if (low || high) { + if (!low) { ++data[num_digits - 1]; + } else if (high) { + int result = add_compare(numerator, numerator, denominator); + // Round half to even. + if (result > 0 || (result == 0 && (digit % 2) != 0)) + ++data[num_digits - 1]; + } + buf.try_resize(to_unsigned(num_digits)); + exp10 -= num_digits - 1; + return; } - buf.resize(num_digits); - exp10 -= num_digits - 1; - return; + numerator *= 10; + lower *= 10; + if (upper != &lower) *upper *= 10; } + } + // Generate the given number of digits. + exp10 -= num_digits - 1; + if (num_digits == 0) { + buf.try_resize(1); + denominator *= 10; + buf[0] = add_compare(numerator, numerator, denominator) > 0 ? '1' : '0'; + return; + } + buf.try_resize(to_unsigned(num_digits)); + for (int i = 0; i < num_digits - 1; ++i) { + int digit = numerator.divmod_assign(denominator); + buf[i] = static_cast('0' + digit); numerator *= 10; - lower *= 10; - if (upper != &lower) *upper *= 10; } + int digit = numerator.divmod_assign(denominator); + auto result = add_compare(numerator, numerator, denominator); + if (result > 0 || (result == 0 && (digit % 2) != 0)) { + if (digit == 9) { + const auto overflow = '0' + 10; + buf[num_digits - 1] = overflow; + // Propagate the carry. + for (int i = num_digits - 1; i > 0 && buf[i] == overflow; --i) { + buf[i] = '0'; + ++buf[i - 1]; + } + if (buf[0] == overflow) { + buf[0] = '1'; + ++exp10; + } + return; + } + ++digit; + } + buf[num_digits - 1] = static_cast('0' + digit); } -// Formats value using the Grisu algorithm -// (https://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/printf.pdf) -// if T is a IEEE754 binary32 or binary64 and snprintf otherwise. template int format_float(T value, int precision, float_specs specs, buffer& buf) { - static_assert(!std::is_same(), ""); + static_assert(!std::is_same::value, ""); FMT_ASSERT(value >= 0, "value is negative"); const bool fixed = specs.format == float_format::fixed; @@ -1052,73 +2429,64 @@ int format_float(T value, int precision, float_specs specs, buffer& buf) { buf.push_back('0'); return 0; } - buf.resize(to_unsigned(precision)); + buf.try_resize(to_unsigned(precision)); std::uninitialized_fill_n(buf.data(), precision, '0'); return -precision; } if (!specs.use_grisu) return snprintf_float(value, precision, specs, buf); + if (precision < 0) { + // Use Dragonbox for the shortest format. + if (specs.binary32) { + auto dec = dragonbox::to_decimal(static_cast(value)); + write(buffer_appender(buf), dec.significand); + return dec.exponent; + } + auto dec = dragonbox::to_decimal(static_cast(value)); + write(buffer_appender(buf), dec.significand); + return dec.exponent; + } + + // Use Grisu + Dragon4 for the given precision: + // https://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/printf.pdf. int exp = 0; const int min_exp = -60; // alpha in Grisu. int cached_exp10 = 0; // K in Grisu. - if (precision != -1) { - if (precision > 17) return snprintf_float(value, precision, specs, buf); - fp normalized = normalize(fp(value)); - const auto cached_pow = get_cached_power( - min_exp - (normalized.e + fp::significand_size), cached_exp10); - normalized = normalized * cached_pow; - fixed_handler handler{buf.data(), 0, precision, -cached_exp10, fixed}; - if (grisu_gen_digits(normalized, 1, exp, handler) == digits::error) - return snprintf_float(value, precision, specs, buf); - int num_digits = handler.size; - if (!fixed) { - // Remove trailing zeros. - while (num_digits > 0 && buf[num_digits - 1] == '0') { - --num_digits; - ++exp; - } - } - buf.resize(to_unsigned(num_digits)); + fp normalized = normalize(fp(value)); + const auto cached_pow = get_cached_power( + min_exp - (normalized.e + fp::significand_size), cached_exp10); + normalized = normalized * cached_pow; + // Limit precision to the maximum possible number of significant digits in an + // IEEE754 double because we don't need to generate zeros. + const int max_double_digits = 767; + if (precision > max_double_digits) precision = max_double_digits; + fixed_handler handler{buf.data(), 0, precision, -cached_exp10, fixed}; + if (grisu_gen_digits(normalized, 1, exp, handler) == digits::error) { + exp += handler.size - cached_exp10 - 1; + fallback_format(value, handler.precision, specs.binary32, buf, exp); } else { - fp fp_value; - auto boundaries = specs.binary32 - ? fp_value.assign_float_with_boundaries(value) - : fp_value.assign_with_boundaries(value); - fp_value = normalize(fp_value); - // Find a cached power of 10 such that multiplying value by it will bring - // the exponent in the range [min_exp, -32]. - const fp cached_pow = get_cached_power( - min_exp - (fp_value.e + fp::significand_size), cached_exp10); - // Multiply value and boundaries by the cached power of 10. - fp_value = fp_value * cached_pow; - boundaries.lower = multiply(boundaries.lower, cached_pow.f); - boundaries.upper = multiply(boundaries.upper, cached_pow.f); - assert(min_exp <= fp_value.e && fp_value.e <= -32); - --boundaries.lower; // \tilde{M}^- - 1 ulp -> M^-_{\downarrow}. - ++boundaries.upper; // \tilde{M}^+ + 1 ulp -> M^+_{\uparrow}. - // Numbers outside of (lower, upper) definitely do not round to value. - grisu_shortest_handler handler{buf.data(), 0, - boundaries.upper - fp_value.f}; - auto result = - grisu_gen_digits(fp(boundaries.upper, fp_value.e), - boundaries.upper - boundaries.lower, exp, handler); - if (result == digits::error) { - exp += handler.size - cached_exp10 - 1; - fallback_format(value, buf, exp); - return exp; + exp += handler.exp10; + buf.try_resize(to_unsigned(handler.size)); + } + if (!fixed && !specs.showpoint) { + // Remove trailing zeros. + auto num_digits = buf.size(); + while (num_digits > 0 && buf[num_digits - 1] == '0') { + --num_digits; + ++exp; } - buf.resize(to_unsigned(handler.size)); + buf.try_resize(num_digits); } - return exp - cached_exp10; -} + return exp; +} // namespace detail template int snprintf_float(T value, int precision, float_specs specs, buffer& buf) { // Buffer capacity must be non-zero, otherwise MSVC's vsnprintf_s will fail. FMT_ASSERT(buf.capacity() > buf.size(), "empty buffer"); - static_assert(!std::is_same(), ""); + static_assert(!std::is_same::value, ""); // Subtract 1 to account for the difference in precision since we use %e for // both general and exponent format. @@ -1127,11 +2495,11 @@ int snprintf_float(T value, int precision, float_specs specs, precision = (precision >= 0 ? precision : 6) - 1; // Build the format string. - enum { max_format_size = 7 }; // Ths longest format is "%#.*Le". + enum { max_format_size = 7 }; // The longest format is "%#.*Le". char format[max_format_size]; char* format_ptr = format; *format_ptr++ = '%'; - if (specs.trailing_zeros) *format_ptr++ = '#'; + if (specs.showpoint && specs.format == float_format::hex) *format_ptr++ = '#'; if (precision >= 0) { *format_ptr++ = '.'; *format_ptr++ = '*'; @@ -1147,30 +2515,32 @@ int snprintf_float(T value, int precision, float_specs specs, for (;;) { auto begin = buf.data() + offset; auto capacity = buf.capacity() - offset; -#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION +#ifdef FMT_FUZZ if (precision > 100000) throw std::runtime_error( "fuzz mode - avoid large allocation inside snprintf"); #endif // Suppress the warning about a nonliteral format string. - auto snprintf_ptr = FMT_SNPRINTF; + // Cannot use auto because of a bug in MinGW (#1532). + int (*snprintf_ptr)(char*, size_t, const char*, ...) = FMT_SNPRINTF; int result = precision >= 0 ? snprintf_ptr(begin, capacity, format, precision, value) : snprintf_ptr(begin, capacity, format, value); if (result < 0) { - buf.reserve(buf.capacity() + 1); // The buffer will grow exponentially. + // The buffer will grow exponentially. + buf.try_reserve(buf.capacity() + 1); continue; } - unsigned size = to_unsigned(result); + auto size = to_unsigned(result); // Size equal to capacity means that the last character was truncated. if (size >= capacity) { - buf.reserve(size + offset + 1); // Add 1 for the terminating '\0'. + buf.try_reserve(size + offset + 1); // Add 1 for the terminating '\0'. continue; } auto is_digit = [](char c) { return c >= '0' && c <= '9'; }; if (specs.format == float_format::fixed) { if (precision == 0) { - buf.resize(size); + buf.try_resize(size); return 0; } // Find and remove the decimal point. @@ -1179,12 +2549,12 @@ int snprintf_float(T value, int precision, float_specs specs, --p; } while (is_digit(*p)); int fraction_size = static_cast(end - p - 1); - std::memmove(p, p + 1, fraction_size); - buf.resize(size - 1); + std::memmove(p, p + 1, to_unsigned(fraction_size)); + buf.try_resize(size - 1); return -fraction_size; } if (specs.format == float_format::hex) { - buf.resize(size + offset); + buf.try_resize(size + offset); return 0; } // Find and parse the exponent. @@ -1208,25 +2578,86 @@ int snprintf_float(T value, int precision, float_specs specs, while (*fraction_end == '0') --fraction_end; // Move the fractional part left to get rid of the decimal point. fraction_size = static_cast(fraction_end - begin - 1); - std::memmove(begin + 1, begin + 2, fraction_size); + std::memmove(begin + 1, begin + 2, to_unsigned(fraction_size)); } - buf.resize(fraction_size + offset + 1); + buf.try_resize(to_unsigned(fraction_size) + offset + 1); return exp - fraction_size; } } -} // namespace internal -template <> struct formatter { +// A public domain branchless UTF-8 decoder by Christopher Wellons: +// https://github.com/skeeto/branchless-utf8 +/* Decode the next character, c, from buf, reporting errors in e. + * + * Since this is a branchless decoder, four bytes will be read from the + * buffer regardless of the actual length of the next character. This + * means the buffer _must_ have at least three bytes of zero padding + * following the end of the data stream. + * + * Errors are reported in e, which will be non-zero if the parsed + * character was somehow invalid: invalid byte sequence, non-canonical + * encoding, or a surrogate half. + * + * The function returns a pointer to the next character. When an error + * occurs, this pointer will be a guess that depends on the particular + * error, but it will always advance at least one byte. + */ +inline const char* utf8_decode(const char* buf, uint32_t* c, int* e) { + static const int masks[] = {0x00, 0x7f, 0x1f, 0x0f, 0x07}; + static const uint32_t mins[] = {4194304, 0, 128, 2048, 65536}; + static const int shiftc[] = {0, 18, 12, 6, 0}; + static const int shifte[] = {0, 6, 4, 2, 0}; + + int len = code_point_length(buf); + const char* next = buf + len; + + // Assume a four-byte character and load four bytes. Unused bits are + // shifted out. + auto s = reinterpret_cast(buf); + *c = uint32_t(s[0] & masks[len]) << 18; + *c |= uint32_t(s[1] & 0x3f) << 12; + *c |= uint32_t(s[2] & 0x3f) << 6; + *c |= uint32_t(s[3] & 0x3f) << 0; + *c >>= shiftc[len]; + + // Accumulate the various error conditions. + *e = (*c < mins[len]) << 6; // non-canonical encoding + *e |= ((*c >> 11) == 0x1b) << 7; // surrogate half? + *e |= (*c > 0x10FFFF) << 8; // out of range? + *e |= (s[1] & 0xc0) >> 2; + *e |= (s[2] & 0xc0) >> 4; + *e |= (s[3]) >> 6; + *e ^= 0x2a; // top two bits of each tail byte correct? + *e >>= shifte[len]; + + return next; +} + +struct stringifier { + template FMT_INLINE std::string operator()(T value) const { + return to_string(value); + } + std::string operator()(basic_format_arg::handle h) const { + memory_buffer buf; + format_parse_context parse_ctx({}); + format_context format_ctx(buffer_appender(buf), {}, {}); + h.format(parse_ctx, format_ctx); + return to_string(buf); + } +}; +} // namespace detail + +template <> struct formatter { format_parse_context::iterator parse(format_parse_context& ctx) { return ctx.begin(); } - format_context::iterator format(const internal::bigint& n, + format_context::iterator format(const detail::bigint& n, format_context& ctx) { auto out = ctx.out(); bool first = true; for (auto i = n.bigits_.size(); i > 0; --i) { - auto value = n.bigits_[i - 1]; + auto value = n.bigits_[i - 1u]; if (first) { out = format_to(out, "{:x}", value); first = false; @@ -1235,107 +2666,43 @@ template <> struct formatter { out = format_to(out, "{:08x}", value); } if (n.exp_ > 0) - out = format_to(out, "p{}", n.exp_ * internal::bigint::bigit_bits); + out = format_to(out, "p{}", n.exp_ * detail::bigint::bigit_bits); return out; } }; -#if FMT_USE_WINDOWS_H - -FMT_FUNC internal::utf8_to_utf16::utf8_to_utf16(string_view s) { - static const char ERROR_MSG[] = "cannot convert string from UTF-8 to UTF-16"; - if (s.size() > INT_MAX) - FMT_THROW(windows_error(ERROR_INVALID_PARAMETER, ERROR_MSG)); - int s_size = static_cast(s.size()); - if (s_size == 0) { - // MultiByteToWideChar does not support zero length, handle separately. - buffer_.resize(1); - buffer_[0] = 0; - return; - } - - int length = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, s.data(), - s_size, nullptr, 0); - if (length == 0) FMT_THROW(windows_error(GetLastError(), ERROR_MSG)); - buffer_.resize(length + 1); - length = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, s.data(), s_size, - &buffer_[0], length); - if (length == 0) FMT_THROW(windows_error(GetLastError(), ERROR_MSG)); - buffer_[length] = 0; -} - -FMT_FUNC internal::utf16_to_utf8::utf16_to_utf8(wstring_view s) { - if (int error_code = convert(s)) { - FMT_THROW(windows_error(error_code, - "cannot convert string from UTF-16 to UTF-8")); - } -} - -FMT_FUNC int internal::utf16_to_utf8::convert(wstring_view s) { - if (s.size() > INT_MAX) return ERROR_INVALID_PARAMETER; - int s_size = static_cast(s.size()); - if (s_size == 0) { - // WideCharToMultiByte does not support zero length, handle separately. - buffer_.resize(1); - buffer_[0] = 0; - return 0; - } - - int length = WideCharToMultiByte(CP_UTF8, 0, s.data(), s_size, nullptr, 0, - nullptr, nullptr); - if (length == 0) return GetLastError(); - buffer_.resize(length + 1); - length = WideCharToMultiByte(CP_UTF8, 0, s.data(), s_size, &buffer_[0], - length, nullptr, nullptr); - if (length == 0) return GetLastError(); - buffer_[length] = 0; - return 0; -} - -FMT_FUNC void windows_error::init(int err_code, string_view format_str, - format_args args) { - error_code_ = err_code; - memory_buffer buffer; - internal::format_windows_error(buffer, err_code, vformat(format_str, args)); - std::runtime_error& base = *this; - base = std::runtime_error(to_string(buffer)); -} - -FMT_FUNC void internal::format_windows_error(internal::buffer& out, - int error_code, - string_view message) FMT_NOEXCEPT { - FMT_TRY { - wmemory_buffer buf; - buf.resize(inline_buffer_size); - for (;;) { - wchar_t* system_message = &buf[0]; - int result = FormatMessageW( - FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, - error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), system_message, - static_cast(buf.size()), nullptr); - if (result != 0) { - utf16_to_utf8 utf8_message; - if (utf8_message.convert(system_message) == ERROR_SUCCESS) { - internal::writer w(out); - w.write(message); - w.write(": "); - w.write(utf8_message); - return; - } - break; - } - if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) - break; // Can't get error message, report error code instead. - buf.resize(buf.size() * 2); +FMT_FUNC detail::utf8_to_utf16::utf8_to_utf16(string_view s) { + auto transcode = [this](const char* p) { + auto cp = uint32_t(); + auto error = 0; + p = utf8_decode(p, &cp, &error); + if (error != 0) FMT_THROW(std::runtime_error("invalid utf8")); + if (cp <= 0xFFFF) { + buffer_.push_back(static_cast(cp)); + } else { + cp -= 0x10000; + buffer_.push_back(static_cast(0xD800 + (cp >> 10))); + buffer_.push_back(static_cast(0xDC00 + (cp & 0x3FF))); } + return p; + }; + auto p = s.data(); + const size_t block_size = 4; // utf8_decode always reads blocks of 4 chars. + if (s.size() >= block_size) { + for (auto end = p + s.size() - block_size + 1; p < end;) p = transcode(p); } - FMT_CATCH(...) {} - format_error_code(out, error_code, message); + if (auto num_chars_left = s.data() + s.size() - p) { + char buf[2 * block_size - 1] = {}; + memcpy(buf, p, to_unsigned(num_chars_left)); + p = buf; + do { + p = transcode(p); + } while (p - buf < num_chars_left); + } + buffer_.push_back(0); } -#endif // FMT_USE_WINDOWS_H - -FMT_FUNC void format_system_error(internal::buffer& out, int error_code, +FMT_FUNC void format_system_error(detail::buffer& out, int error_code, string_view message) FMT_NOEXCEPT { FMT_TRY { memory_buffer buf; @@ -1343,12 +2710,10 @@ FMT_FUNC void format_system_error(internal::buffer& out, int error_code, for (;;) { char* system_message = &buf[0]; int result = - internal::safe_strerror(error_code, system_message, buf.size()); + detail::safe_strerror(error_code, system_message, buf.size()); if (result == 0) { - internal::writer w(out); - w.write(message); - w.write(": "); - w.write(system_message); + format_to(detail::buffer_appender(out), "{}: {}", message, + system_message); return; } if (result != ERANGE) @@ -1360,7 +2725,7 @@ FMT_FUNC void format_system_error(internal::buffer& out, int error_code, format_error_code(out, error_code, message); } -FMT_FUNC void internal::error_handler::on_error(const char* message) { +FMT_FUNC void detail::error_handler::on_error(const char* message) { FMT_THROW(format_error(message)); } @@ -1369,19 +2734,55 @@ FMT_FUNC void report_system_error(int error_code, report_error(format_system_error, error_code, message); } -#if FMT_USE_WINDOWS_H -FMT_FUNC void report_windows_error(int error_code, - fmt::string_view message) FMT_NOEXCEPT { - report_error(internal::format_windows_error, error_code, message); +FMT_FUNC std::string detail::vformat(string_view format_str, format_args args) { + if (format_str.size() == 2 && equal2(format_str.data(), "{}")) { + auto arg = args.get(0); + if (!arg) error_handler().on_error("argument not found"); + return visit_format_arg(stringifier(), arg); + } + memory_buffer buffer; + detail::vformat_to(buffer, format_str, args); + return to_string(buffer); } + +#ifdef _WIN32 +namespace detail { +using dword = conditional_t; +extern "C" __declspec(dllimport) int __stdcall WriteConsoleW( // + void*, const void*, dword, dword*, void*); +} // namespace detail #endif FMT_FUNC void vprint(std::FILE* f, string_view format_str, format_args args) { memory_buffer buffer; - internal::vformat_to(buffer, format_str, - basic_format_args>(args)); - internal::fwrite_fully(buffer.data(), 1, buffer.size(), f); + detail::vformat_to(buffer, format_str, + basic_format_args>(args)); +#ifdef _WIN32 + auto fd = _fileno(f); + if (_isatty(fd)) { + detail::utf8_to_utf16 u16(string_view(buffer.data(), buffer.size())); + auto written = detail::dword(); + if (!detail::WriteConsoleW(reinterpret_cast(_get_osfhandle(fd)), + u16.c_str(), static_cast(u16.size()), + &written, nullptr)) { + FMT_THROW(format_error("failed to write to console")); + } + return; + } +#endif + detail::fwrite_fully(buffer.data(), 1, buffer.size(), f); +} + +#ifdef _WIN32 +// Print assuming legacy (non-Unicode) encoding. +FMT_FUNC void detail::vprint_mojibake(std::FILE* f, string_view format_str, + format_args args) { + memory_buffer buffer; + detail::vformat_to(buffer, format_str, + basic_format_args>(args)); + fwrite_fully(buffer.data(), 1, buffer.size(), f); } +#endif FMT_FUNC void vprint(string_view format_str, format_args args) { vprint(stdout, format_str, args); @@ -1389,8 +2790,4 @@ FMT_FUNC void vprint(string_view format_str, format_args args) { FMT_END_NAMESPACE -#ifdef _MSC_VER -# pragma warning(pop) -#endif - #endif // FMT_FORMAT_INL_H_ diff --git a/Externals/fmt/include/fmt/format.h b/Externals/fmt/include/fmt/format.h index 01f41f5cbdd3..ad039c35e262 100755 --- a/Externals/fmt/include/fmt/format.h +++ b/Externals/fmt/include/fmt/format.h @@ -33,8 +33,6 @@ #ifndef FMT_FORMAT_H_ #define FMT_FORMAT_H_ -#include "core.h" - #include #include #include @@ -43,11 +41,7 @@ #include #include -#ifdef __clang__ -# define FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__) -#else -# define FMT_CLANG_VERSION 0 -#endif +#include "core.h" #ifdef __INTEL_COMPILER # define FMT_ICC_VERSION __INTEL_COMPILER @@ -69,27 +63,52 @@ # define FMT_HAS_BUILTIN(x) 0 #endif -#if FMT_HAS_CPP_ATTRIBUTE(fallthrough) && \ - (__cplusplus >= 201703 || FMT_GCC_VERSION != 0) +#if FMT_GCC_VERSION || FMT_CLANG_VERSION +# define FMT_NOINLINE __attribute__((noinline)) +#else +# define FMT_NOINLINE +#endif + +#if __cplusplus == 201103L || __cplusplus == 201402L +# if defined(__INTEL_COMPILER) || defined(__PGI) +# define FMT_FALLTHROUGH +# elif defined(__clang__) +# define FMT_FALLTHROUGH [[clang::fallthrough]] +# elif FMT_GCC_VERSION >= 700 && \ + (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 520) +# define FMT_FALLTHROUGH [[gnu::fallthrough]] +# else +# define FMT_FALLTHROUGH +# endif +#elif FMT_HAS_CPP17_ATTRIBUTE(fallthrough) || \ + (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) # define FMT_FALLTHROUGH [[fallthrough]] #else # define FMT_FALLTHROUGH #endif +#ifndef FMT_MAYBE_UNUSED +# if FMT_HAS_CPP17_ATTRIBUTE(maybe_unused) +# define FMT_MAYBE_UNUSED [[maybe_unused]] +# else +# define FMT_MAYBE_UNUSED +# endif +#endif + #ifndef FMT_THROW # if FMT_EXCEPTIONS -# if FMT_MSC_VER +# if FMT_MSC_VER || FMT_NVCC FMT_BEGIN_NAMESPACE -namespace internal { +namespace detail { template inline void do_throw(const Exception& x) { - // Silence unreachable code warnings in MSVC because these are nearly - // impossible to fix in a generic code. + // Silence unreachable code warnings in MSVC and NVCC because these + // are nearly impossible to fix in a generic code. volatile bool b = true; if (b) throw x; } -} // namespace internal +} // namespace detail FMT_END_NAMESPACE -# define FMT_THROW(x) internal::do_throw(x) +# define FMT_THROW(x) detail::do_throw(x) # else # define FMT_THROW(x) throw x # endif @@ -102,12 +121,19 @@ FMT_END_NAMESPACE # endif #endif +#if FMT_EXCEPTIONS +# define FMT_TRY try +# define FMT_CATCH(x) catch (x) +#else +# define FMT_TRY if (true) +# define FMT_CATCH(x) if (false) +#endif + #ifndef FMT_USE_USER_DEFINED_LITERALS -// For Intel and NVIDIA compilers both they and the system gcc/msc support UDLs. -# if (FMT_HAS_FEATURE(cxx_user_literals) || FMT_GCC_VERSION >= 407 || \ - FMT_MSC_VER >= 1900) && \ - (!(FMT_ICC_VERSION || FMT_CUDA_VERSION) || FMT_ICC_VERSION >= 1500 || \ - FMT_CUDA_VERSION >= 700) +// EDG based compilers (Intel, NVIDIA, Elbrus, etc), GCC and MSVC support UDLs. +# if (FMT_HAS_FEATURE(cxx_user_literals) || FMT_GCC_VERSION >= 407 || \ + FMT_MSC_VER >= 1900) && \ + (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= /* UDL feature */ 480) # define FMT_USE_USER_DEFINED_LITERALS 1 # else # define FMT_USE_USER_DEFINED_LITERALS 0 @@ -115,19 +141,39 @@ FMT_END_NAMESPACE #endif #ifndef FMT_USE_UDL_TEMPLATE -// EDG front end based compilers (icc, nvcc) do not support UDL templates yet -// and GCC 9 warns about them. -# if FMT_USE_USER_DEFINED_LITERALS && FMT_ICC_VERSION == 0 && \ - FMT_CUDA_VERSION == 0 && \ - ((FMT_GCC_VERSION >= 600 && FMT_GCC_VERSION <= 900 && \ - __cplusplus >= 201402L) || \ - FMT_CLANG_VERSION >= 304) +// EDG frontend based compilers (icc, nvcc, PGI, etc) and GCC < 6.4 do not +// properly support UDL templates and GCC >= 9 warns about them. +# if FMT_USE_USER_DEFINED_LITERALS && \ + (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 501) && \ + ((FMT_GCC_VERSION >= 604 && __cplusplus >= 201402L) || \ + FMT_CLANG_VERSION >= 304) && \ + !defined(__PGI) && !defined(__NVCC__) # define FMT_USE_UDL_TEMPLATE 1 # else # define FMT_USE_UDL_TEMPLATE 0 # endif #endif +#ifndef FMT_USE_FLOAT +# define FMT_USE_FLOAT 1 +#endif + +#ifndef FMT_USE_DOUBLE +# define FMT_USE_DOUBLE 1 +#endif + +#ifndef FMT_USE_LONG_DOUBLE +# define FMT_USE_LONG_DOUBLE 1 +#endif + +// Defining FMT_REDUCE_INT_INSTANTIATIONS to 1, will reduce the number of +// int_writer template instances to just one by only using the largest integer +// type. This results in a reduction in binary size but will cause a decrease in +// integer formatting performance. +#if !defined(FMT_REDUCE_INT_INSTANTIATIONS) +# define FMT_REDUCE_INT_INSTANTIATIONS 0 +#endif + // __builtin_clz is broken in clang with Microsoft CodeGen: // https://github.com/fmtlib/fmt/issues/519 #if (FMT_GCC_VERSION || FMT_HAS_BUILTIN(__builtin_clz)) && !FMT_MSC_VER @@ -136,76 +182,98 @@ FMT_END_NAMESPACE #if (FMT_GCC_VERSION || FMT_HAS_BUILTIN(__builtin_clzll)) && !FMT_MSC_VER # define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n) #endif +#if (FMT_GCC_VERSION || FMT_HAS_BUILTIN(__builtin_ctz)) +# define FMT_BUILTIN_CTZ(n) __builtin_ctz(n) +#endif +#if (FMT_GCC_VERSION || FMT_HAS_BUILTIN(__builtin_ctzll)) +# define FMT_BUILTIN_CTZLL(n) __builtin_ctzll(n) +#endif + +#if FMT_MSC_VER +# include // _BitScanReverse[64], _BitScanForward[64], _umul128 +#endif // Some compilers masquerade as both MSVC and GCC-likes or otherwise support // __builtin_clz and __builtin_clzll, so only define FMT_BUILTIN_CLZ using the // MSVC intrinsics if the clz and clzll builtins are not available. -#if FMT_MSC_VER && !defined(FMT_BUILTIN_CLZLL) && !defined(_MANAGED) -# include // _BitScanReverse, _BitScanReverse64 - +#if FMT_MSC_VER && !defined(FMT_BUILTIN_CLZLL) && \ + !defined(FMT_BUILTIN_CTZLL) && !defined(_MANAGED) FMT_BEGIN_NAMESPACE -namespace internal { +namespace detail { // Avoid Clang with Microsoft CodeGen's -Wunknown-pragmas warning. # ifndef __clang__ +# pragma intrinsic(_BitScanForward) # pragma intrinsic(_BitScanReverse) # endif -inline uint32_t clz(uint32_t x) { +# if defined(_WIN64) && !defined(__clang__) +# pragma intrinsic(_BitScanForward64) +# pragma intrinsic(_BitScanReverse64) +# endif + +inline int clz(uint32_t x) { unsigned long r = 0; _BitScanReverse(&r, x); - FMT_ASSERT(x != 0, ""); // Static analysis complains about using uninitialized data // "r", but the only way that can happen is if "x" is 0, // which the callers guarantee to not happen. -# pragma warning(suppress : 6102) - return 31 - r; + FMT_SUPPRESS_MSC_WARNING(6102) + return 31 ^ static_cast(r); } -# define FMT_BUILTIN_CLZ(n) internal::clz(n) +# define FMT_BUILTIN_CLZ(n) detail::clz(n) -# if defined(_WIN64) && !defined(__clang__) -# pragma intrinsic(_BitScanReverse64) -# endif - -inline uint32_t clzll(uint64_t x) { +inline int clzll(uint64_t x) { unsigned long r = 0; # ifdef _WIN64 _BitScanReverse64(&r, x); # else // Scan the high 32 bits. - if (_BitScanReverse(&r, static_cast(x >> 32))) return 63 - (r + 32); - + if (_BitScanReverse(&r, static_cast(x >> 32))) return 63 ^ (r + 32); // Scan the low 32 bits. _BitScanReverse(&r, static_cast(x)); # endif + FMT_ASSERT(x != 0, ""); + FMT_SUPPRESS_MSC_WARNING(6102) // Suppress a bogus static analysis warning. + return 63 ^ static_cast(r); +} +# define FMT_BUILTIN_CLZLL(n) detail::clzll(n) +inline int ctz(uint32_t x) { + unsigned long r = 0; + _BitScanForward(&r, x); FMT_ASSERT(x != 0, ""); - // Static analysis complains about using uninitialized data - // "r", but the only way that can happen is if "x" is 0, - // which the callers guarantee to not happen. -# pragma warning(suppress : 6102) - return 63 - r; + FMT_SUPPRESS_MSC_WARNING(6102) // Suppress a bogus static analysis warning. + return static_cast(r); +} +# define FMT_BUILTIN_CTZ(n) detail::ctz(n) + +inline int ctzll(uint64_t x) { + unsigned long r = 0; + FMT_ASSERT(x != 0, ""); + FMT_SUPPRESS_MSC_WARNING(6102) // Suppress a bogus static analysis warning. +# ifdef _WIN64 + _BitScanForward64(&r, x); +# else + // Scan the low 32 bits. + if (_BitScanForward(&r, static_cast(x))) return static_cast(r); + // Scan the high 32 bits. + _BitScanForward(&r, static_cast(x >> 32)); + r += 32; +# endif + return static_cast(r); } -# define FMT_BUILTIN_CLZLL(n) internal::clzll(n) -} // namespace internal +# define FMT_BUILTIN_CTZLL(n) detail::ctzll(n) +} // namespace detail FMT_END_NAMESPACE #endif // Enable the deprecated numeric alignment. -#ifndef FMT_NUMERIC_ALIGN -# define FMT_NUMERIC_ALIGN 1 -#endif - -// Enable the deprecated percent specifier. -#ifndef FMT_DEPRECATED_PERCENT -# define FMT_DEPRECATED_PERCENT 0 +#ifndef FMT_DEPRECATED_NUMERIC_ALIGN +# define FMT_DEPRECATED_NUMERIC_ALIGN 0 #endif FMT_BEGIN_NAMESPACE -namespace internal { - -// A helper function to suppress bogus "conditional expression is constant" -// warnings. -template inline T const_check(T value) { return value; } +namespace detail { // An equivalent of `*reinterpret_cast(&source)` that doesn't have // undefined behavior (e.g. due to type aliasing). @@ -219,7 +287,7 @@ inline Dest bit_cast(const Source& source) { } inline bool is_big_endian() { - auto u = 1u; + const auto u = 1u; struct bytes { char data[sizeof(u)]; }; @@ -257,47 +325,25 @@ template constexpr T max_value() { template constexpr int num_bits() { return std::numeric_limits::digits; } +// std::numeric_limits::digits may return 0 for 128-bit ints. +template <> constexpr int num_bits() { return 128; } +template <> constexpr int num_bits() { return 128; } template <> constexpr int num_bits() { return static_cast(sizeof(void*) * std::numeric_limits::digits); } +FMT_INLINE void assume(bool condition) { + (void)condition; +#if FMT_HAS_BUILTIN(__builtin_assume) + __builtin_assume(condition); +#endif +} + // An approximation of iterator_t for pre-C++20 systems. template using iterator_t = decltype(std::begin(std::declval())); - -// Detect the iterator category of *any* given type in a SFINAE-friendly way. -// Unfortunately, older implementations of std::iterator_traits are not safe -// for use in a SFINAE-context. -template -struct iterator_category : std::false_type {}; - -template struct iterator_category { - using type = std::random_access_iterator_tag; -}; - -template -struct iterator_category> { - using type = typename It::iterator_category; -}; - -// Detect if *any* given type models the OutputIterator concept. -template class is_output_iterator { - // Check for mutability because all iterator categories derived from - // std::input_iterator_tag *may* also meet the requirements of an - // OutputIterator, thereby falling into the category of 'mutable iterators' - // [iterator.requirements.general] clause 4. The compiler reveals this - // property only at the point of *actually dereferencing* the iterator! - template - static decltype(*(std::declval())) test(std::input_iterator_tag); - template static char& test(std::output_iterator_tag); - template static const char& test(...); - - using type = decltype(test(typename iterator_category::type{})); - - public: - static const bool value = !std::is_const>::value; -}; +template using sentinel_t = decltype(std::end(std::declval())); // A workaround for std::string not having mutable data() until C++17. template inline Char* get_data(std::basic_string& s) { @@ -308,28 +354,61 @@ inline typename Container::value_type* get_data(Container& c) { return c.data(); } -#ifdef _SECURE_SCL +#if defined(_SECURE_SCL) && _SECURE_SCL // Make a checked iterator to avoid MSVC warnings. template using checked_ptr = stdext::checked_array_iterator; -template checked_ptr make_checked(T* p, std::size_t size) { +template checked_ptr make_checked(T* p, size_t size) { return {p, size}; } #else template using checked_ptr = T*; -template inline T* make_checked(T* p, std::size_t) { return p; } +template inline T* make_checked(T* p, size_t) { return p; } #endif template ::value)> -inline checked_ptr reserve( - std::back_insert_iterator& it, std::size_t n) { +#if FMT_CLANG_VERSION +__attribute__((no_sanitize("undefined"))) +#endif +inline checked_ptr +reserve(std::back_insert_iterator it, size_t n) { Container& c = get_container(it); - std::size_t size = c.size(); + size_t size = c.size(); c.resize(size + n); return make_checked(get_data(c) + size, n); } +template +inline buffer_appender reserve(buffer_appender it, size_t n) { + buffer& buf = get_container(it); + buf.try_reserve(buf.size() + n); + return it; +} + +template inline Iterator& reserve(Iterator& it, size_t) { + return it; +} + +template +constexpr T* to_pointer(OutputIt, size_t) { + return nullptr; +} +template T* to_pointer(buffer_appender it, size_t n) { + buffer& buf = get_container(it); + auto size = buf.size(); + if (buf.capacity() < size + n) return nullptr; + buf.try_resize(size + n); + return buf.data() + size; +} + +template ::value)> +inline std::back_insert_iterator base_iterator( + std::back_insert_iterator& it, + checked_ptr) { + return it; +} + template -inline Iterator& reserve(Iterator& it, std::size_t) { +inline Iterator base_iterator(Iterator, Iterator it) { return it; } @@ -337,7 +416,7 @@ inline Iterator& reserve(Iterator& it, std::size_t) { // discards them. class counting_iterator { private: - std::size_t count_; + size_t count_; public: using iterator_category = std::output_iterator_tag; @@ -352,33 +431,38 @@ class counting_iterator { counting_iterator() : count_(0) {} - std::size_t count() const { return count_; } + size_t count() const { return count_; } counting_iterator& operator++() { ++count_; return *this; } - counting_iterator operator++(int) { auto it = *this; ++*this; return it; } + friend counting_iterator operator+(counting_iterator it, difference_type n) { + it.count_ += static_cast(n); + return it; + } + value_type operator*() const { return {}; } }; template class truncating_iterator_base { protected: OutputIt out_; - std::size_t limit_; - std::size_t count_; + size_t limit_; + size_t count_; - truncating_iterator_base(OutputIt out, std::size_t limit) + truncating_iterator_base(OutputIt out, size_t limit) : out_(out), limit_(limit), count_(0) {} public: using iterator_category = std::output_iterator_tag; + using value_type = typename std::iterator_traits::value_type; using difference_type = void; using pointer = void; using reference = void; @@ -386,7 +470,7 @@ template class truncating_iterator_base { truncating_iterator_base; // Mark iterator as checked. OutputIt base() const { return out_; } - std::size_t count() const { return count_; } + size_t count() const { return count_; } }; // An output iterator that truncates the output and counts the number of objects @@ -399,14 +483,12 @@ class truncating_iterator; template class truncating_iterator : public truncating_iterator_base { - using traits = std::iterator_traits; - - mutable typename traits::value_type blackhole_; + mutable typename truncating_iterator_base::value_type blackhole_; public: - using value_type = typename traits::value_type; + using value_type = typename truncating_iterator_base::value_type; - truncating_iterator(OutputIt out, std::size_t limit) + truncating_iterator(OutputIt out, size_t limit) : truncating_iterator_base(out, limit) {} truncating_iterator& operator++() { @@ -429,13 +511,11 @@ template class truncating_iterator : public truncating_iterator_base { public: - using value_type = typename OutputIt::container_type::value_type; - - truncating_iterator(OutputIt out, std::size_t limit) + truncating_iterator(OutputIt out, size_t limit) : truncating_iterator_base(out, limit) {} - truncating_iterator& operator=(value_type val) { - if (this->count_++ < this->limit_) this->out_ = val; + template truncating_iterator& operator=(T val) { + if (this->count_++ < this->limit_) *this->out_++ = val; return *this; } @@ -444,30 +524,14 @@ class truncating_iterator truncating_iterator& operator*() { return *this; } }; -// A range with the specified output iterator and value type. -template -class output_range { - private: - OutputIt it_; - - public: - using value_type = T; - using iterator = OutputIt; - struct sentinel {}; - - explicit output_range(OutputIt it) : it_(it) {} - OutputIt begin() const { return it_; } - sentinel end() const { return {}; } // Sentinel is not used yet. -}; - template inline size_t count_code_points(basic_string_view s) { return s.size(); } // Counts the number of code points in a UTF-8 string. -inline size_t count_code_points(basic_string_view s) { - const char8_t* data = s.data(); +inline size_t count_code_points(basic_string_view s) { + const char* data = s.data(); size_t num_code_points = 0; for (size_t i = 0, size = s.size(); i != size; ++i) { if ((data[i] & 0xc0) != 0x80) ++num_code_points; @@ -475,6 +539,11 @@ inline size_t count_code_points(basic_string_view s) { return num_code_points; } +inline size_t count_code_points(basic_string_view s) { + return count_code_points(basic_string_view( + reinterpret_cast(s.data()), s.size())); +} + template inline size_t code_point_index(basic_string_view s, size_t n) { size_t size = s.size(); @@ -482,8 +551,8 @@ inline size_t code_point_index(basic_string_view s, size_t n) { } // Calculates the index of the nth code point in a UTF-8 string. -inline size_t code_point_index(basic_string_view s, size_t n) { - const char8_t* data = s.data(); +inline size_t code_point_index(basic_string_view s, size_t n) { + const char8_type* data = s.data(); size_t num_code_points = 0; for (size_t i = 0, size = s.size(); i != size; ++i) { if ((data[i] & 0xc0) != 0x80 && ++num_code_points > n) { @@ -493,13 +562,11 @@ inline size_t code_point_index(basic_string_view s, size_t n) { return s.size(); } -inline char8_t to_char8_t(char c) { return static_cast(c); } - template using needs_conversion = bool_constant< std::is_same::value_type, char>::value && - std::is_same::value>; + std::is_same::value>; template ::value)> @@ -510,56 +577,44 @@ OutputIt copy_str(InputIt begin, InputIt end, OutputIt it) { template ::value)> OutputIt copy_str(InputIt begin, InputIt end, OutputIt it) { - return std::transform(begin, end, it, to_char8_t); + return std::transform(begin, end, it, + [](char c) { return static_cast(c); }); } -#ifndef FMT_USE_GRISU -# define FMT_USE_GRISU 1 -#endif - -template constexpr bool use_grisu() { - return FMT_USE_GRISU && std::numeric_limits::is_iec559 && - sizeof(T) <= sizeof(double); +template +inline counting_iterator copy_str(InputIt begin, InputIt end, + counting_iterator it) { + return it + (end - begin); } +template +using is_fast_float = bool_constant::is_iec559 && + sizeof(T) <= sizeof(double)>; + +#ifndef FMT_USE_FULL_CACHE_DRAGONBOX +# define FMT_USE_FULL_CACHE_DRAGONBOX 0 +#endif + template template void buffer::append(const U* begin, const U* end) { - std::size_t new_size = size_ + to_unsigned(end - begin); - reserve(new_size); - std::uninitialized_copy(begin, end, make_checked(ptr_, capacity_) + size_); - size_ = new_size; + do { + auto count = to_unsigned(end - begin); + try_reserve(size_ + count); + auto free_cap = capacity_ - size_; + if (free_cap < count) count = free_cap; + std::uninitialized_copy_n(begin, count, make_checked(ptr_ + size_, count)); + size_ += count; + begin += count; + } while (begin != end); } -} // namespace internal - -// A range with an iterator appending to a buffer. -template -class buffer_range : public internal::output_range< - std::back_insert_iterator>, T> { - public: - using iterator = std::back_insert_iterator>; - using internal::output_range::output_range; - buffer_range(internal::buffer& buf) - : internal::output_range(std::back_inserter(buf)) {} -}; -// A UTF-8 string view. -class u8string_view : public basic_string_view { - public: - u8string_view(const char* s) - : basic_string_view(reinterpret_cast(s)) {} - u8string_view(const char* s, size_t count) FMT_NOEXCEPT - : basic_string_view(reinterpret_cast(s), count) { - } -}; - -#if FMT_USE_USER_DEFINED_LITERALS -inline namespace literals { -inline u8string_view operator"" _u(const char* s, std::size_t n) { - return {s, n}; +template +void iterator_buffer::flush() { + out_ = std::copy_n(data_, this->limit(this->size()), out_); + this->clear(); } -} // namespace literals -#endif +} // namespace detail // The number of characters to store in the basic_memory_buffer object itself // to avoid dynamic memory allocation. @@ -594,42 +649,44 @@ enum { inline_buffer_size = 500 }; The output can be converted to an ``std::string`` with ``to_string(out)``. \endrst */ -template > -class basic_memory_buffer : private Allocator, public internal::buffer { +class basic_memory_buffer final : public detail::buffer { private: T store_[SIZE]; + // Don't inherit from Allocator avoid generating type_info for it. + Allocator alloc_; + // Deallocate memory allocated by the buffer. void deallocate() { T* data = this->data(); - if (data != store_) Allocator::deallocate(data, this->capacity()); + if (data != store_) alloc_.deallocate(data, this->capacity()); } protected: - void grow(std::size_t size) FMT_OVERRIDE; + void grow(size_t size) final FMT_OVERRIDE; public: using value_type = T; using const_reference = const T&; explicit basic_memory_buffer(const Allocator& alloc = Allocator()) - : Allocator(alloc) { + : alloc_(alloc) { this->set(store_, SIZE); } - ~basic_memory_buffer() FMT_OVERRIDE { deallocate(); } + ~basic_memory_buffer() { deallocate(); } private: // Move data from other to this buffer. void move(basic_memory_buffer& other) { - Allocator &this_alloc = *this, &other_alloc = other; - this_alloc = std::move(other_alloc); + alloc_ = std::move(other.alloc_); T* data = other.data(); - std::size_t size = other.size(), capacity = other.capacity(); + size_t size = other.size(), capacity = other.capacity(); if (data == other.store_) { this->set(store_, capacity); std::uninitialized_copy(other.store_, other.store_ + size, - internal::make_checked(store_, capacity)); + detail::make_checked(store_, capacity)); } else { this->set(data, capacity); // Set pointer to the inline array so that delete is not called @@ -661,33 +718,55 @@ class basic_memory_buffer : private Allocator, public internal::buffer { } // Returns a copy of the allocator associated with this buffer. - Allocator get_allocator() const { return *this; } + Allocator get_allocator() const { return alloc_; } + + /** + Resizes the buffer to contain *count* elements. If T is a POD type new + elements may not be initialized. + */ + void resize(size_t count) { this->try_resize(count); } + + /** Increases the buffer capacity to *new_capacity*. */ + void reserve(size_t new_capacity) { this->try_reserve(new_capacity); } + + // Directly append data into the buffer + using detail::buffer::append; + template + void append(const ContiguousRange& range) { + append(range.data(), range.data() + range.size()); + } }; -template -void basic_memory_buffer::grow(std::size_t size) { -#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION - if (size > 1000) throw std::runtime_error("fuzz mode - won't grow that much"); +template +void basic_memory_buffer::grow(size_t size) { +#ifdef FMT_FUZZ + if (size > 5000) throw std::runtime_error("fuzz mode - won't grow that much"); #endif - std::size_t old_capacity = this->capacity(); - std::size_t new_capacity = old_capacity + old_capacity / 2; + size_t old_capacity = this->capacity(); + size_t new_capacity = old_capacity + old_capacity / 2; if (size > new_capacity) new_capacity = size; T* old_data = this->data(); - T* new_data = std::allocator_traits::allocate(*this, new_capacity); + T* new_data = + std::allocator_traits::allocate(alloc_, new_capacity); // The following code doesn't throw, so the raw pointer above doesn't leak. std::uninitialized_copy(old_data, old_data + this->size(), - internal::make_checked(new_data, new_capacity)); + detail::make_checked(new_data, new_capacity)); this->set(new_data, new_capacity); // deallocate must not throw according to the standard, but even if it does, // the buffer already uses the new storage and will deallocate it in // destructor. - if (old_data != store_) Allocator::deallocate(old_data, old_capacity); + if (old_data != store_) alloc_.deallocate(old_data, old_capacity); } using memory_buffer = basic_memory_buffer; using wmemory_buffer = basic_memory_buffer; +template +struct is_contiguous> : std::true_type { +}; + /** A formatting error such as invalid format string. */ +FMT_CLASS_API class FMT_API format_error : public std::runtime_error { public: explicit format_error(const char* message) : std::runtime_error(message) {} @@ -700,43 +779,134 @@ class FMT_API format_error : public std::runtime_error { ~format_error() FMT_NOEXCEPT FMT_OVERRIDE; }; -namespace internal { +namespace detail { + +template +using is_signed = + std::integral_constant::is_signed || + std::is_same::value>; // Returns true if value is negative, false otherwise. // Same as `value < 0` but doesn't produce warnings if T is an unsigned type. -template ::is_signed)> +template ::value)> FMT_CONSTEXPR bool is_negative(T value) { return value < 0; } -template ::is_signed)> +template ::value)> FMT_CONSTEXPR bool is_negative(T) { return false; } +template ::value)> +FMT_CONSTEXPR bool is_supported_floating_point(T) { + return (std::is_same::value && FMT_USE_FLOAT) || + (std::is_same::value && FMT_USE_DOUBLE) || + (std::is_same::value && FMT_USE_LONG_DOUBLE); +} + // Smallest of uint32_t, uint64_t, uint128_t that is large enough to -// represent all values of T. +// represent all values of an integral type T. template -using uint32_or_64_or_128_t = conditional_t< - std::numeric_limits::digits <= 32, uint32_t, - conditional_t::digits <= 64, uint64_t, uint128_t>>; +using uint32_or_64_or_128_t = + conditional_t() <= 32 && !FMT_REDUCE_INT_INSTANTIATIONS, + uint32_t, + conditional_t() <= 64, uint64_t, uint128_t>>; + +// 128-bit integer type used internally +struct FMT_EXTERN_TEMPLATE_API uint128_wrapper { + uint128_wrapper() = default; + +#if FMT_USE_INT128 + uint128_t internal_; + + uint128_wrapper(uint64_t high, uint64_t low) FMT_NOEXCEPT + : internal_{static_cast(low) | + (static_cast(high) << 64)} {} + + uint128_wrapper(uint128_t u) : internal_{u} {} + + uint64_t high() const FMT_NOEXCEPT { return uint64_t(internal_ >> 64); } + uint64_t low() const FMT_NOEXCEPT { return uint64_t(internal_); } + + uint128_wrapper& operator+=(uint64_t n) FMT_NOEXCEPT { + internal_ += n; + return *this; + } +#else + uint64_t high_; + uint64_t low_; + + uint128_wrapper(uint64_t high, uint64_t low) FMT_NOEXCEPT : high_{high}, + low_{low} {} + + uint64_t high() const FMT_NOEXCEPT { return high_; } + uint64_t low() const FMT_NOEXCEPT { return low_; } + + uint128_wrapper& operator+=(uint64_t n) FMT_NOEXCEPT { +# if defined(_MSC_VER) && defined(_M_X64) + unsigned char carry = _addcarry_u64(0, low_, n, &low_); + _addcarry_u64(carry, high_, 0, &high_); + return *this; +# else + uint64_t sum = low_ + n; + high_ += (sum < low_ ? 1 : 0); + low_ = sum; + return *this; +# endif + } +#endif +}; + +// Table entry type for divisibility test used internally +template struct FMT_EXTERN_TEMPLATE_API divtest_table_entry { + T mod_inv; + T max_quotient; +}; // Static data is placed in this class template for the header-only config. template struct FMT_EXTERN_TEMPLATE_API basic_data { static const uint64_t powers_of_10_64[]; static const uint32_t zero_or_powers_of_10_32[]; static const uint64_t zero_or_powers_of_10_64[]; - static const uint64_t pow10_significands[]; - static const int16_t pow10_exponents[]; - static const char digits[]; + static const uint64_t grisu_pow10_significands[]; + static const int16_t grisu_pow10_exponents[]; + static const divtest_table_entry divtest_table_for_pow5_32[]; + static const divtest_table_entry divtest_table_for_pow5_64[]; + static const uint64_t dragonbox_pow10_significands_64[]; + static const uint128_wrapper dragonbox_pow10_significands_128[]; + // log10(2) = 0x0.4d104d427de7fbcc... + static const uint64_t log10_2_significand = 0x4d104d427de7fbcc; +#if !FMT_USE_FULL_CACHE_DRAGONBOX + static const uint64_t powers_of_5_64[]; + static const uint32_t dragonbox_pow10_recovery_errors[]; +#endif + // GCC generates slightly better code for pairs than chars. + using digit_pair = char[2]; + static const digit_pair digits[]; static const char hex_digits[]; static const char foreground_color[]; static const char background_color[]; static const char reset_color[5]; static const wchar_t wreset_color[5]; static const char signs[]; + static const char left_padding_shifts[5]; + static const char right_padding_shifts[5]; }; +// Maps bsr(n) to ceil(log10(pow(2, bsr(n) + 1) - 1)). +// This is a function instead of an array to workaround a bug in GCC10 (#1810). +FMT_INLINE uint16_t bsr2log10(int bsr) { + static constexpr uint16_t data[] = { + 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, + 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, + 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15, + 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 19, 20}; + return data[bsr]; +} + +#ifndef FMT_EXPORTED FMT_EXTERN template struct basic_data; +#endif // This is a struct rather than an alias to avoid shadowing warnings in gcc. struct data : basic_data<> {}; @@ -745,10 +915,9 @@ struct data : basic_data<> {}; // Returns the number of decimal digits in n. Leading zeros are not counted // except for n == 0 in which case count_digits returns 1. inline int count_digits(uint64_t n) { - // Based on http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10 - // and the benchmark https://github.com/localvoid/cxx-benchmark-count-digits. - int t = (64 - FMT_BUILTIN_CLZLL(n | 1)) * 1233 >> 12; - return t - (n < data::zero_or_powers_of_10_64[t]) + 1; + // https://github.com/fmtlib/format-benchmark/blob/master/digits10 + auto t = bsr2log10(FMT_BUILTIN_CLZLL(n | 1) ^ 63); + return t - (n < data::zero_or_powers_of_10_64[t]); } #else // Fallback version of count_digits used when __builtin_clz is not available. @@ -794,22 +963,37 @@ template inline int count_digits(UInt n) { return num_digits; } -template <> int count_digits<4>(internal::fallback_uintptr n); +template <> int count_digits<4>(detail::fallback_uintptr n); #if FMT_GCC_VERSION || FMT_CLANG_VERSION # define FMT_ALWAYS_INLINE inline __attribute__((always_inline)) +#elif FMT_MSC_VER +# define FMT_ALWAYS_INLINE __forceinline #else -# define FMT_ALWAYS_INLINE +# define FMT_ALWAYS_INLINE inline +#endif + +// To suppress unnecessary security cookie checks +#if FMT_MSC_VER && !FMT_CLANG_VERSION +# define FMT_SAFEBUFFERS __declspec(safebuffers) +#else +# define FMT_SAFEBUFFERS #endif #ifdef FMT_BUILTIN_CLZ // Optional version of count_digits for better performance on 32-bit platforms. inline int count_digits(uint32_t n) { - int t = (32 - FMT_BUILTIN_CLZ(n | 1)) * 1233 >> 12; - return t - (n < data::zero_or_powers_of_10_32[t]) + 1; + auto t = bsr2log10(FMT_BUILTIN_CLZ(n | 1) ^ 31); + return t - (n < data::zero_or_powers_of_10_32[t]); } #endif +template constexpr int digits10() FMT_NOEXCEPT { + return std::numeric_limits::digits10; +} +template <> constexpr int digits10() FMT_NOEXCEPT { return 38; } +template <> constexpr int digits10() FMT_NOEXCEPT { return 38; } + template FMT_API std::string grouping_impl(locale_ref loc); template inline std::string grouping(locale_ref loc) { return grouping_impl(loc); @@ -834,57 +1018,60 @@ template <> inline wchar_t decimal_point(locale_ref loc) { return decimal_point_impl(loc); } -// Formats a decimal unsigned integer value writing into buffer. -// add_thousands_sep is called after writing each char to add a thousands -// separator if necessary. -template -inline Char* format_decimal(Char* buffer, UInt value, int num_digits, - F add_thousands_sep) { - FMT_ASSERT(num_digits >= 0, "invalid digit count"); - buffer += num_digits; - Char* end = buffer; +// Compares two characters for equality. +template bool equal2(const Char* lhs, const char* rhs) { + return lhs[0] == rhs[0] && lhs[1] == rhs[1]; +} +inline bool equal2(const char* lhs, const char* rhs) { + return memcmp(lhs, rhs, 2) == 0; +} + +// Copies two characters from src to dst. +template void copy2(Char* dst, const char* src) { + *dst++ = static_cast(*src++); + *dst = static_cast(*src); +} +FMT_INLINE void copy2(char* dst, const char* src) { memcpy(dst, src, 2); } + +template struct format_decimal_result { + Iterator begin; + Iterator end; +}; + +// Formats a decimal unsigned integer value writing into out pointing to a +// buffer of specified size. The caller must ensure that the buffer is large +// enough. +template +inline format_decimal_result format_decimal(Char* out, UInt value, + int size) { + FMT_ASSERT(size >= count_digits(value), "invalid digit count"); + out += size; + Char* end = out; while (value >= 100) { // Integer division is slow so do it for a group of two digits instead // of for every digit. The idea comes from the talk by Alexandrescu // "Three Optimization Tips for C++". See speed-test for a comparison. - auto index = static_cast((value % 100) * 2); + out -= 2; + copy2(out, data::digits[value % 100]); value /= 100; - *--buffer = static_cast(data::digits[index + 1]); - add_thousands_sep(buffer); - *--buffer = static_cast(data::digits[index]); - add_thousands_sep(buffer); } if (value < 10) { - *--buffer = static_cast('0' + value); - return end; + *--out = static_cast('0' + value); + return {out, end}; } - auto index = static_cast(value * 2); - *--buffer = static_cast(data::digits[index + 1]); - add_thousands_sep(buffer); - *--buffer = static_cast(data::digits[index]); - return end; -} - -template constexpr int digits10() noexcept { - return std::numeric_limits::digits10; + out -= 2; + copy2(out, data::digits[value]); + return {out, end}; } -template <> constexpr int digits10() noexcept { return 38; } -template <> constexpr int digits10() noexcept { return 38; } -template -inline Iterator format_decimal(Iterator out, UInt value, int num_digits, - F add_thousands_sep) { - FMT_ASSERT(num_digits >= 0, "invalid digit count"); - // Buffer should be large enough to hold all digits (<= digits10 + 1). - enum { max_size = digits10() + 1 }; - Char buffer[2 * max_size]; - auto end = format_decimal(buffer, value, num_digits, add_thousands_sep); - return internal::copy_str(buffer, end, out); -} - -template -inline It format_decimal(It out, UInt value, int num_digits) { - return format_decimal(out, value, num_digits, [](Char*) {}); +template >::value)> +inline format_decimal_result format_decimal(Iterator out, UInt value, + int size) { + // Buffer is large enough to hold all digits (digits10 + 1). + Char buffer[digits10() + 1]; + auto end = format_decimal(buffer, value, size).end; + return {out, detail::copy_str(buffer, end, out)}; } template @@ -902,7 +1089,7 @@ inline Char* format_uint(Char* buffer, UInt value, int num_digits, } template -Char* format_uint(Char* buffer, internal::fallback_uintptr n, int num_digits, +Char* format_uint(Char* buffer, detail::fallback_uintptr n, int num_digits, bool = false) { auto char_digits = std::numeric_limits::digits / 4; int start = (num_digits + char_digits - 1) / char_digits - 1; @@ -925,67 +1112,52 @@ Char* format_uint(Char* buffer, internal::fallback_uintptr n, int num_digits, template inline It format_uint(It out, UInt value, int num_digits, bool upper = false) { + if (auto ptr = to_pointer(out, to_unsigned(num_digits))) { + format_uint(ptr, value, num_digits, upper); + return out; + } // Buffer should be large enough to hold all digits (digits / BASE_BITS + 1). char buffer[num_bits() / BASE_BITS + 1]; format_uint(buffer, value, num_digits, upper); - return internal::copy_str(buffer, buffer + num_digits, out); + return detail::copy_str(buffer, buffer + num_digits, out); } -#ifndef _WIN32 -# define FMT_USE_WINDOWS_H 0 -#elif !defined(FMT_USE_WINDOWS_H) -# define FMT_USE_WINDOWS_H 1 -#endif - -// Define FMT_USE_WINDOWS_H to 0 to disable use of windows.h. -// All the functionality that relies on it will be disabled too. -#if FMT_USE_WINDOWS_H // A converter from UTF-8 to UTF-16. -// It is only provided for Windows since other systems support UTF-8 natively. class utf8_to_utf16 { private: wmemory_buffer buffer_; public: FMT_API explicit utf8_to_utf16(string_view s); - operator wstring_view() const { return wstring_view(&buffer_[0], size()); } + operator wstring_view() const { return {&buffer_[0], size()}; } size_t size() const { return buffer_.size() - 1; } const wchar_t* c_str() const { return &buffer_[0]; } - std::wstring str() const { return std::wstring(&buffer_[0], size()); } + std::wstring str() const { return {&buffer_[0], size()}; } }; -// A converter from UTF-16 to UTF-8. -// It is only provided for Windows since other systems support UTF-8 natively. -class utf16_to_utf8 { - private: - memory_buffer buffer_; - - public: - utf16_to_utf8() {} - FMT_API explicit utf16_to_utf8(wstring_view s); - operator string_view() const { return string_view(&buffer_[0], size()); } - size_t size() const { return buffer_.size() - 1; } - const char* c_str() const { return &buffer_[0]; } - std::string str() const { return std::string(&buffer_[0], size()); } - - // Performs conversion returning a system error code instead of - // throwing exception on conversion error. This method may still throw - // in case of memory allocation error. - FMT_API int convert(wstring_view s); -}; - -FMT_API void format_windows_error(internal::buffer& out, int error_code, - string_view message) FMT_NOEXCEPT; -#endif - template struct null {}; // Workaround an array initialization issue in gcc 4.8. template struct fill_t { private: - Char data_[6]; + enum { max_size = 4 }; + Char data_[max_size]; + unsigned char size_; public: + FMT_CONSTEXPR void operator=(basic_string_view s) { + auto size = s.size(); + if (size > max_size) { + FMT_THROW(format_error("invalid fill")); + return; + } + for (size_t i = 0; i < size; ++i) data_[i] = s[i]; + size_ = static_cast(size); + } + + size_t size() const { return size_; } + const Char* data() const { return data_; } + FMT_CONSTEXPR Char& operator[](size_t index) { return data_[index]; } FMT_CONSTEXPR const Char& operator[](size_t index) const { return data_[index]; @@ -994,10 +1166,11 @@ template struct fill_t { static FMT_CONSTEXPR fill_t make() { auto fill = fill_t(); fill[0] = Char(' '); + fill.size_ = 1; return fill; } }; -} // namespace internal +} // namespace detail // We cannot use enum classes as bit fields because of a gcc bug // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414. @@ -1019,7 +1192,7 @@ template struct basic_format_specs { align_t align : 4; sign_t sign : 3; bool alt : 1; // Alternate form ('#'). - internal::fill_t fill; + detail::fill_t fill; constexpr basic_format_specs() : width(0), @@ -1028,12 +1201,84 @@ template struct basic_format_specs { align(align::none), sign(sign::none), alt(false), - fill(internal::fill_t::make()) {} + fill(detail::fill_t::make()) {} }; using format_specs = basic_format_specs; -namespace internal { +namespace detail { +namespace dragonbox { + +// Type-specific information that Dragonbox uses. +template struct float_info; + +template <> struct float_info { + using carrier_uint = uint32_t; + static const int significand_bits = 23; + static const int exponent_bits = 8; + static const int min_exponent = -126; + static const int max_exponent = 127; + static const int exponent_bias = -127; + static const int decimal_digits = 9; + static const int kappa = 1; + static const int big_divisor = 100; + static const int small_divisor = 10; + static const int min_k = -31; + static const int max_k = 46; + static const int cache_bits = 64; + static const int divisibility_check_by_5_threshold = 39; + static const int case_fc_pm_half_lower_threshold = -1; + static const int case_fc_pm_half_upper_threshold = 6; + static const int case_fc_lower_threshold = -2; + static const int case_fc_upper_threshold = 6; + static const int case_shorter_interval_left_endpoint_lower_threshold = 2; + static const int case_shorter_interval_left_endpoint_upper_threshold = 3; + static const int shorter_interval_tie_lower_threshold = -35; + static const int shorter_interval_tie_upper_threshold = -35; + static const int max_trailing_zeros = 7; +}; + +template <> struct float_info { + using carrier_uint = uint64_t; + static const int significand_bits = 52; + static const int exponent_bits = 11; + static const int min_exponent = -1022; + static const int max_exponent = 1023; + static const int exponent_bias = -1023; + static const int decimal_digits = 17; + static const int kappa = 2; + static const int big_divisor = 1000; + static const int small_divisor = 100; + static const int min_k = -292; + static const int max_k = 326; + static const int cache_bits = 128; + static const int divisibility_check_by_5_threshold = 86; + static const int case_fc_pm_half_lower_threshold = -2; + static const int case_fc_pm_half_upper_threshold = 9; + static const int case_fc_lower_threshold = -4; + static const int case_fc_upper_threshold = 9; + static const int case_shorter_interval_left_endpoint_lower_threshold = 2; + static const int case_shorter_interval_left_endpoint_upper_threshold = 3; + static const int shorter_interval_tie_lower_threshold = -77; + static const int shorter_interval_tie_upper_threshold = -77; + static const int max_trailing_zeros = 16; +}; + +template struct decimal_fp { + using significand_type = typename float_info::carrier_uint; + significand_type significand; + int exponent; +}; + +template decimal_fp to_decimal(T x) FMT_NOEXCEPT; +} // namespace dragonbox + +template +constexpr typename dragonbox::float_info::carrier_uint exponent_mask() { + using uint_type = typename dragonbox::float_info::carrier_uint; + return ((uint_type(1) << dragonbox::float_info::exponent_bits) - 1) + << dragonbox::float_info::significand_bits; +} // A floating-point presentation format. enum class float_format : unsigned char { @@ -1049,10 +1294,9 @@ struct float_specs { sign_t sign : 8; bool upper : 1; bool locale : 1; - bool percent : 1; bool binary32 : 1; bool use_grisu : 1; - bool trailing_zeros : 1; + bool showpoint : 1; }; // Writes the exponent exp in the form "[+-]d{2,3}" to buffer. @@ -1065,123 +1309,17 @@ template It write_exponent(int exp, It it) { *it++ = static_cast('+'); } if (exp >= 100) { - const char* top = data::digits + (exp / 100) * 2; + const char* top = data::digits[exp / 100]; if (exp >= 1000) *it++ = static_cast(top[0]); *it++ = static_cast(top[1]); exp %= 100; } - const char* d = data::digits + exp * 2; + const char* d = data::digits[exp]; *it++ = static_cast(d[0]); *it++ = static_cast(d[1]); return it; } -template class float_writer { - private: - // The number is given as v = digits_ * pow(10, exp_). - const char* digits_; - int num_digits_; - int exp_; - size_t size_; - float_specs specs_; - Char decimal_point_; - - template It prettify(It it) const { - // pow(10, full_exp - 1) <= v <= pow(10, full_exp). - int full_exp = num_digits_ + exp_; - if (specs_.format == float_format::exp) { - // Insert a decimal point after the first digit and add an exponent. - *it++ = static_cast(*digits_); - int num_zeros = specs_.precision - num_digits_; - bool trailing_zeros = num_zeros > 0 && specs_.trailing_zeros; - if (num_digits_ > 1 || trailing_zeros) *it++ = decimal_point_; - it = copy_str(digits_ + 1, digits_ + num_digits_, it); - if (trailing_zeros) - it = std::fill_n(it, num_zeros, static_cast('0')); - *it++ = static_cast(specs_.upper ? 'E' : 'e'); - return write_exponent(full_exp - 1, it); - } - if (num_digits_ <= full_exp) { - // 1234e7 -> 12340000000[.0+] - it = copy_str(digits_, digits_ + num_digits_, it); - it = std::fill_n(it, full_exp - num_digits_, static_cast('0')); - if (specs_.trailing_zeros) { - *it++ = decimal_point_; - int num_zeros = specs_.precision - full_exp; - if (num_zeros <= 0) { - if (specs_.format != float_format::fixed) - *it++ = static_cast('0'); - return it; - } -#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION - if (num_zeros > 1000) - throw std::runtime_error("fuzz mode - avoiding excessive cpu use"); -#endif - it = std::fill_n(it, num_zeros, static_cast('0')); - } - } else if (full_exp > 0) { - // 1234e-2 -> 12.34[0+] - it = copy_str(digits_, digits_ + full_exp, it); - if (!specs_.trailing_zeros) { - // Remove trailing zeros. - int num_digits = num_digits_; - while (num_digits > full_exp && digits_[num_digits - 1] == '0') - --num_digits; - if (num_digits != full_exp) *it++ = decimal_point_; - return copy_str(digits_ + full_exp, digits_ + num_digits, it); - } - *it++ = decimal_point_; - it = copy_str(digits_ + full_exp, digits_ + num_digits_, it); - if (specs_.precision > num_digits_) { - // Add trailing zeros. - int num_zeros = specs_.precision - num_digits_; - it = std::fill_n(it, num_zeros, static_cast('0')); - } - } else { - // 1234e-6 -> 0.001234 - *it++ = static_cast('0'); - int num_zeros = -full_exp; - if (specs_.precision >= 0 && specs_.precision < num_zeros) - num_zeros = specs_.precision; - int num_digits = num_digits_; - if (!specs_.trailing_zeros) - while (num_digits > 0 && digits_[num_digits - 1] == '0') --num_digits; - if (num_zeros != 0 || num_digits != 0) { - *it++ = decimal_point_; - it = std::fill_n(it, num_zeros, static_cast('0')); - it = copy_str(digits_, digits_ + num_digits, it); - } - } - return it; - } - - public: - float_writer(const char* digits, int num_digits, int exp, float_specs specs, - Char decimal_point) - : digits_(digits), - num_digits_(num_digits), - exp_(exp), - specs_(specs), - decimal_point_(decimal_point) { - int full_exp = num_digits + exp - 1; - int precision = specs.precision > 0 ? specs.precision : 16; - if (specs_.format == float_format::general && - !(full_exp >= -4 && full_exp < precision)) { - specs_.format = float_format::exp; - } - size_ = prettify(counting_iterator()).count(); - size_ += specs.sign ? 1 : 0; - } - - size_t size() const { return size_; } - size_t width() const { return size(); } - - template void operator()(It&& it) { - if (specs_.sign) *it++ = static_cast(data::signs[specs_.sign]); - it = prettify(it); - } -}; - template int format_float(T value, int precision, float_specs specs, buffer& buf); @@ -1191,7 +1329,7 @@ int snprintf_float(T value, int precision, float_specs specs, buffer& buf); template T promote_float(T value) { return value; } -inline double promote_float(float value) { return value; } +inline double promote_float(float value) { return static_cast(value); } template FMT_CONSTEXPR void handle_int_type_spec(char spec, Handler&& handler) { @@ -1211,9 +1349,15 @@ FMT_CONSTEXPR void handle_int_type_spec(char spec, Handler&& handler) { case 'o': handler.on_oct(); break; +#ifdef FMT_DEPRECATED_N_SPECIFIER case 'n': +#endif + case 'L': handler.on_num(); break; + case 'c': + handler.on_chr(); + break; default: handler.on_error(); } @@ -1223,11 +1367,11 @@ template FMT_CONSTEXPR float_specs parse_float_type_spec( const basic_format_specs& specs, ErrorHandler&& eh = {}) { auto result = float_specs(); - result.trailing_zeros = specs.alt; + result.showpoint = specs.alt; switch (specs.type) { case 0: result.format = float_format::general; - result.trailing_zeros |= specs.precision != 0; + result.showpoint |= specs.precision > 0; break; case 'G': result.upper = true; @@ -1240,28 +1384,25 @@ FMT_CONSTEXPR float_specs parse_float_type_spec( FMT_FALLTHROUGH; case 'e': result.format = float_format::exp; - result.trailing_zeros |= specs.precision != 0; + result.showpoint |= specs.precision != 0; break; case 'F': result.upper = true; FMT_FALLTHROUGH; case 'f': result.format = float_format::fixed; - result.trailing_zeros |= specs.precision != 0; - break; -#if FMT_DEPRECATED_PERCENT - case '%': - result.format = float_format::fixed; - result.percent = true; + result.showpoint |= specs.precision != 0; break; -#endif case 'A': result.upper = true; FMT_FALLTHROUGH; case 'a': result.format = float_format::hex; break; +#ifdef FMT_DEPRECATED_N_SPECIFIER case 'n': +#endif + case 'L': result.locale = true; break; default: @@ -1310,6 +1451,7 @@ template class int_type_checker : private ErrorHandler { FMT_CONSTEXPR void on_bin() {} FMT_CONSTEXPR void on_oct() {} FMT_CONSTEXPR void on_num() {} + FMT_CONSTEXPR void on_chr() {} FMT_CONSTEXPR void on_error() { ErrorHandler::on_error("invalid type specifier"); @@ -1341,386 +1483,669 @@ class cstring_type_checker : public ErrorHandler { FMT_CONSTEXPR void on_pointer() {} }; -template -void arg_map::init(const basic_format_args& args) { - if (map_) return; - map_ = new entry[internal::to_unsigned(args.max_size())]; - if (args.is_packed()) { - for (int i = 0;; ++i) { - internal::type arg_type = args.type(i); - if (arg_type == internal::none_type) return; - if (arg_type == internal::named_arg_type) push_back(args.values_[i]); - } - } - for (int i = 0, n = args.max_size(); i < n; ++i) { - auto type = args.args_[i].type_; - if (type == internal::named_arg_type) push_back(args.args_[i].value_); - } +template +FMT_NOINLINE OutputIt fill(OutputIt it, size_t n, const fill_t& fill) { + auto fill_size = fill.size(); + if (fill_size == 1) return std::fill_n(it, n, fill[0]); + for (size_t i = 0; i < n; ++i) it = std::copy_n(fill.data(), fill_size, it); + return it; } -template struct nonfinite_writer { - sign_t sign; - const char* str; - static constexpr size_t str_size = 3; - - size_t size() const { return str_size + (sign ? 1 : 0); } - size_t width() const { return size(); } - - template void operator()(It&& it) const { - if (sign) *it++ = static_cast(data::signs[sign]); - it = copy_str(str, str + str_size, it); +// Writes the output of f, padded according to format specifications in specs. +// size: output size in code units. +// width: output display width in (terminal) column positions. +template +inline OutputIt write_padded(OutputIt out, + const basic_format_specs& specs, size_t size, + size_t width, F&& f) { + static_assert(align == align::left || align == align::right, ""); + unsigned spec_width = to_unsigned(specs.width); + size_t padding = spec_width > width ? spec_width - width : 0; + auto* shifts = align == align::left ? data::left_padding_shifts + : data::right_padding_shifts; + size_t left_padding = padding >> shifts[specs.align]; + auto it = reserve(out, size + padding * specs.fill.size()); + it = fill(it, left_padding, specs.fill); + it = f(it); + it = fill(it, padding - left_padding, specs.fill); + return base_iterator(out, it); +} + +template +inline OutputIt write_padded(OutputIt out, + const basic_format_specs& specs, size_t size, + F&& f) { + return write_padded(out, specs, size, size, f); +} + +template +OutputIt write_bytes(OutputIt out, string_view bytes, + const basic_format_specs& specs) { + using iterator = remove_reference_t; + return write_padded(out, specs, bytes.size(), [bytes](iterator it) { + const char* data = bytes.data(); + return copy_str(data, data + bytes.size(), it); + }); +} + +// Data for write_int that doesn't depend on output iterator type. It is used to +// avoid template code bloat. +template struct write_int_data { + size_t size; + size_t padding; + + write_int_data(int num_digits, string_view prefix, + const basic_format_specs& specs) + : size(prefix.size() + to_unsigned(num_digits)), padding(0) { + if (specs.align == align::numeric) { + auto width = to_unsigned(specs.width); + if (width > size) { + padding = width - size; + size = width; + } + } else if (specs.precision > num_digits) { + size = prefix.size() + to_unsigned(specs.precision); + padding = to_unsigned(specs.precision - num_digits); + } } }; -// This template provides operations for formatting and writing data into a -// character range. -template class basic_writer { - public: - using char_type = typename Range::value_type; - using iterator = typename Range::iterator; - using format_specs = basic_format_specs; - - private: - iterator out_; // Output iterator. - locale_ref locale_; - - // Attempts to reserve space for n extra characters in the output range. - // Returns a pointer to the reserved range or a reference to out_. - auto reserve(std::size_t n) -> decltype(internal::reserve(out_, n)) { - return internal::reserve(out_, n); +// Writes an integer in the format +// +// where are written by f(it). +template +OutputIt write_int(OutputIt out, int num_digits, string_view prefix, + const basic_format_specs& specs, F f) { + auto data = write_int_data(num_digits, prefix, specs); + using iterator = remove_reference_t; + return write_padded(out, specs, data.size, [=](iterator it) { + if (prefix.size() != 0) + it = copy_str(prefix.begin(), prefix.end(), it); + it = std::fill_n(it, data.padding, static_cast('0')); + return f(it); + }); +} + +template +OutputIt write(OutputIt out, basic_string_view s, + const basic_format_specs& specs) { + auto data = s.data(); + auto size = s.size(); + if (specs.precision >= 0 && to_unsigned(specs.precision) < size) + size = code_point_index(s, to_unsigned(specs.precision)); + auto width = specs.width != 0 + ? count_code_points(basic_string_view(data, size)) + : 0; + using iterator = remove_reference_t; + return write_padded(out, specs, size, width, [=](iterator it) { + return copy_str(data, data + size, it); + }); +} + +// The handle_int_type_spec handler that writes an integer. +template struct int_writer { + OutputIt out; + locale_ref locale; + const basic_format_specs& specs; + UInt abs_value; + char prefix[4]; + unsigned prefix_size; + + using iterator = + remove_reference_t(), 0))>; + + string_view get_prefix() const { return string_view(prefix, prefix_size); } + + template + int_writer(OutputIt output, locale_ref loc, Int value, + const basic_format_specs& s) + : out(output), + locale(loc), + specs(s), + abs_value(static_cast(value)), + prefix_size(0) { + static_assert(std::is_same, UInt>::value, ""); + if (is_negative(value)) { + prefix[0] = '-'; + ++prefix_size; + abs_value = 0 - abs_value; + } else if (specs.sign != sign::none && specs.sign != sign::minus) { + prefix[0] = specs.sign == sign::plus ? '+' : ' '; + ++prefix_size; + } } - template struct padded_int_writer { - size_t size_; - string_view prefix; - char_type fill; - std::size_t padding; - F f; - - size_t size() const { return size_; } - size_t width() const { return size_; } + void on_dec() { + auto num_digits = count_digits(abs_value); + out = write_int( + out, num_digits, get_prefix(), specs, [this, num_digits](iterator it) { + return format_decimal(it, abs_value, num_digits).end; + }); + } - template void operator()(It&& it) const { - if (prefix.size() != 0) - it = copy_str(prefix.begin(), prefix.end(), it); - it = std::fill_n(it, padding, fill); - f(it); + void on_hex() { + if (specs.alt) { + prefix[prefix_size++] = '0'; + prefix[prefix_size++] = specs.type; } - }; - - // Writes an integer in the format - // - // where are written by f(it). - template - void write_int(int num_digits, string_view prefix, format_specs specs, F f) { - std::size_t size = prefix.size() + to_unsigned(num_digits); - char_type fill = specs.fill[0]; - std::size_t padding = 0; - if (specs.align == align::numeric) { - auto unsiged_width = to_unsigned(specs.width); - if (unsiged_width > size) { - padding = unsiged_width - size; - size = unsiged_width; - } - } else if (specs.precision > num_digits) { - size = prefix.size() + to_unsigned(specs.precision); - padding = to_unsigned(specs.precision - num_digits); - fill = static_cast('0'); + int num_digits = count_digits<4>(abs_value); + out = write_int(out, num_digits, get_prefix(), specs, + [this, num_digits](iterator it) { + return format_uint<4, Char>(it, abs_value, num_digits, + specs.type != 'x'); + }); + } + + void on_bin() { + if (specs.alt) { + prefix[prefix_size++] = '0'; + prefix[prefix_size++] = static_cast(specs.type); + } + int num_digits = count_digits<1>(abs_value); + out = write_int(out, num_digits, get_prefix(), specs, + [this, num_digits](iterator it) { + return format_uint<1, Char>(it, abs_value, num_digits); + }); + } + + void on_oct() { + int num_digits = count_digits<3>(abs_value); + if (specs.alt && specs.precision <= num_digits && abs_value != 0) { + // Octal prefix '0' is counted as a digit, so only add it if precision + // is not greater than the number of digits. + prefix[prefix_size++] = '0'; } - if (specs.align == align::none) specs.align = align::right; - write_padded(specs, padded_int_writer{size, prefix, fill, padding, f}); + out = write_int(out, num_digits, get_prefix(), specs, + [this, num_digits](iterator it) { + return format_uint<3, Char>(it, abs_value, num_digits); + }); } - // Writes a decimal integer. - template void write_decimal(Int value) { - auto abs_value = static_cast>(value); - bool negative = is_negative(value); - // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer. - if (negative) abs_value = ~abs_value + 1; + enum { sep_size = 1 }; + + void on_num() { + std::string groups = grouping(locale); + if (groups.empty()) return on_dec(); + auto sep = thousands_sep(locale); + if (!sep) return on_dec(); int num_digits = count_digits(abs_value); - auto&& it = reserve((negative ? 1 : 0) + static_cast(num_digits)); - if (negative) *it++ = static_cast('-'); - it = format_decimal(it, abs_value, num_digits); - } - - // The handle_int_type_spec handler that writes an integer. - template struct int_writer { - using unsigned_type = uint32_or_64_or_128_t; - - basic_writer& writer; - const Specs& specs; - unsigned_type abs_value; - char prefix[4]; - unsigned prefix_size; - - string_view get_prefix() const { return string_view(prefix, prefix_size); } - - int_writer(basic_writer& w, Int value, const Specs& s) - : writer(w), - specs(s), - abs_value(static_cast(value)), - prefix_size(0) { - if (is_negative(value)) { - prefix[0] = '-'; - ++prefix_size; - abs_value = 0 - abs_value; - } else if (specs.sign != sign::none && specs.sign != sign::minus) { - prefix[0] = specs.sign == sign::plus ? '+' : ' '; - ++prefix_size; + int size = num_digits, n = num_digits; + std::string::const_iterator group = groups.cbegin(); + while (group != groups.cend() && n > *group && *group > 0 && + *group != max_value()) { + size += sep_size; + n -= *group; + ++group; + } + if (group == groups.cend()) size += sep_size * ((n - 1) / groups.back()); + char digits[40]; + format_decimal(digits, abs_value, num_digits); + basic_memory_buffer buffer; + size += static_cast(prefix_size); + const auto usize = to_unsigned(size); + buffer.resize(usize); + basic_string_view s(&sep, sep_size); + // Index of a decimal digit with the least significant digit having index 0. + int digit_index = 0; + group = groups.cbegin(); + auto p = buffer.data() + size - 1; + for (int i = num_digits - 1; i > 0; --i) { + *p-- = static_cast(digits[i]); + if (*group <= 0 || ++digit_index % *group != 0 || + *group == max_value()) + continue; + if (group + 1 != groups.cend()) { + digit_index = 0; + ++group; } + std::uninitialized_copy(s.data(), s.data() + s.size(), + make_checked(p, s.size())); + p -= s.size(); } + *p-- = static_cast(*digits); + if (prefix_size != 0) *p = static_cast('-'); + auto data = buffer.data(); + out = write_padded( + out, specs, usize, usize, + [=](iterator it) { return copy_str(data, data + size, it); }); + } - struct dec_writer { - unsigned_type abs_value; - int num_digits; + void on_chr() { *out++ = static_cast(abs_value); } - template void operator()(It&& it) const { - it = internal::format_decimal(it, abs_value, num_digits); - } - }; + FMT_NORETURN void on_error() { + FMT_THROW(format_error("invalid type specifier")); + } +}; - void on_dec() { - int num_digits = count_digits(abs_value); - writer.write_int(num_digits, get_prefix(), specs, - dec_writer{abs_value, num_digits}); - } +template +OutputIt write_nonfinite(OutputIt out, bool isinf, + const basic_format_specs& specs, + const float_specs& fspecs) { + auto str = + isinf ? (fspecs.upper ? "INF" : "inf") : (fspecs.upper ? "NAN" : "nan"); + constexpr size_t str_size = 3; + auto sign = fspecs.sign; + auto size = str_size + (sign ? 1 : 0); + using iterator = remove_reference_t; + return write_padded(out, specs, size, [=](iterator it) { + if (sign) *it++ = static_cast(data::signs[sign]); + return copy_str(str, str + str_size, it); + }); +} - struct hex_writer { - int_writer& self; - int num_digits; +// A decimal floating-point number significand * pow(10, exp). +struct big_decimal_fp { + const char* significand; + int significand_size; + int exponent; +}; - template void operator()(It&& it) const { - it = format_uint<4, char_type>(it, self.abs_value, num_digits, - self.specs.type != 'x'); - } - }; +inline int get_significand_size(const big_decimal_fp& fp) { + return fp.significand_size; +} +template +inline int get_significand_size(const dragonbox::decimal_fp& fp) { + return count_digits(fp.significand); +} + +template +inline OutputIt write_significand(OutputIt out, const char* significand, + int& significand_size) { + return copy_str(significand, significand + significand_size, out); +} +template +inline OutputIt write_significand(OutputIt out, UInt significand, + int significand_size) { + return format_decimal(out, significand, significand_size).end; +} + +template ::value)> +inline Char* write_significand(Char* out, UInt significand, + int significand_size, int integral_size, + Char decimal_point) { + if (!decimal_point) + return format_decimal(out, significand, significand_size).end; + auto end = format_decimal(out + 1, significand, significand_size).end; + if (integral_size == 1) + out[0] = out[1]; + else + std::copy_n(out + 1, integral_size, out); + out[integral_size] = decimal_point; + return end; +} - void on_hex() { - if (specs.alt) { - prefix[prefix_size++] = '0'; - prefix[prefix_size++] = specs.type; - } - int num_digits = count_digits<4>(abs_value); - writer.write_int(num_digits, get_prefix(), specs, - hex_writer{*this, num_digits}); +template >::value)> +inline OutputIt write_significand(OutputIt out, UInt significand, + int significand_size, int integral_size, + Char decimal_point) { + // Buffer is large enough to hold digits (digits10 + 1) and a decimal point. + Char buffer[digits10() + 2]; + auto end = write_significand(buffer, significand, significand_size, + integral_size, decimal_point); + return detail::copy_str(buffer, end, out); +} + +template +inline OutputIt write_significand(OutputIt out, const char* significand, + int significand_size, int integral_size, + Char decimal_point) { + out = detail::copy_str(significand, significand + integral_size, out); + if (!decimal_point) return out; + *out++ = decimal_point; + return detail::copy_str(significand + integral_size, + significand + significand_size, out); +} + +template +OutputIt write_float(OutputIt out, const DecimalFP& fp, + const basic_format_specs& specs, float_specs fspecs, + Char decimal_point) { + auto significand = fp.significand; + int significand_size = get_significand_size(fp); + static const Char zero = static_cast('0'); + auto sign = fspecs.sign; + size_t size = to_unsigned(significand_size) + (sign ? 1 : 0); + using iterator = remove_reference_t; + + int output_exp = fp.exponent + significand_size - 1; + auto use_exp_format = [=]() { + if (fspecs.format == float_format::exp) return true; + if (fspecs.format != float_format::general) return false; + // Use the fixed notation if the exponent is in [exp_lower, exp_upper), + // e.g. 0.0001 instead of 1e-04. Otherwise use the exponent notation. + const int exp_lower = -4, exp_upper = 16; + return output_exp < exp_lower || + output_exp >= (fspecs.precision > 0 ? fspecs.precision : exp_upper); + }; + if (use_exp_format()) { + int num_zeros = 0; + if (fspecs.showpoint) { + num_zeros = (std::max)(fspecs.precision - significand_size, 0); + size += to_unsigned(num_zeros); + } else if (significand_size == 1) { + decimal_point = Char(); + } + auto abs_output_exp = output_exp >= 0 ? output_exp : -output_exp; + int exp_digits = 2; + if (abs_output_exp >= 100) exp_digits = abs_output_exp >= 1000 ? 4 : 3; + + size += to_unsigned((decimal_point ? 1 : 0) + 2 + exp_digits); + char exp_char = fspecs.upper ? 'E' : 'e'; + auto write = [=](iterator it) { + if (sign) *it++ = static_cast(data::signs[sign]); + // Insert a decimal point after the first digit and add an exponent. + it = write_significand(it, significand, significand_size, 1, + decimal_point); + if (num_zeros > 0) it = std::fill_n(it, num_zeros, zero); + *it++ = static_cast(exp_char); + return write_exponent(output_exp, it); + }; + return specs.width > 0 ? write_padded(out, specs, size, write) + : base_iterator(out, write(reserve(out, size))); + } + + int exp = fp.exponent + significand_size; + if (fp.exponent >= 0) { + // 1234e5 -> 123400000[.0+] + size += to_unsigned(fp.exponent); + int num_zeros = fspecs.precision - exp; +#ifdef FMT_FUZZ + if (num_zeros > 5000) + throw std::runtime_error("fuzz mode - avoiding excessive cpu use"); +#endif + if (fspecs.showpoint) { + if (num_zeros <= 0 && fspecs.format != float_format::fixed) num_zeros = 1; + if (num_zeros > 0) size += to_unsigned(num_zeros); } + return write_padded(out, specs, size, [&](iterator it) { + if (sign) *it++ = static_cast(data::signs[sign]); + it = write_significand(it, significand, significand_size); + it = std::fill_n(it, fp.exponent, zero); + if (!fspecs.showpoint) return it; + *it++ = decimal_point; + return num_zeros > 0 ? std::fill_n(it, num_zeros, zero) : it; + }); + } else if (exp > 0) { + // 1234e-2 -> 12.34[0+] + int num_zeros = fspecs.showpoint ? fspecs.precision - significand_size : 0; + size += 1 + to_unsigned(num_zeros > 0 ? num_zeros : 0); + return write_padded(out, specs, size, [&](iterator it) { + if (sign) *it++ = static_cast(data::signs[sign]); + it = write_significand(it, significand, significand_size, exp, + decimal_point); + return num_zeros > 0 ? std::fill_n(it, num_zeros, zero) : it; + }); + } + // 1234e-6 -> 0.001234 + int num_zeros = -exp; + if (significand_size == 0 && fspecs.precision >= 0 && + fspecs.precision < num_zeros) { + num_zeros = fspecs.precision; + } + size += 2 + to_unsigned(num_zeros); + return write_padded(out, specs, size, [&](iterator it) { + if (sign) *it++ = static_cast(data::signs[sign]); + *it++ = zero; + if (num_zeros == 0 && significand_size == 0 && !fspecs.showpoint) return it; + *it++ = decimal_point; + it = std::fill_n(it, num_zeros, zero); + return write_significand(it, significand, significand_size); + }); +} + +template ::value)> +OutputIt write(OutputIt out, T value, basic_format_specs specs, + locale_ref loc = {}) { + if (const_check(!is_supported_floating_point(value))) return out; + float_specs fspecs = parse_float_type_spec(specs); + fspecs.sign = specs.sign; + if (std::signbit(value)) { // value < 0 is false for NaN so use signbit. + fspecs.sign = sign::minus; + value = -value; + } else if (fspecs.sign == sign::minus) { + fspecs.sign = sign::none; + } + + if (!std::isfinite(value)) + return write_nonfinite(out, std::isinf(value), specs, fspecs); + + if (specs.align == align::numeric && fspecs.sign) { + auto it = reserve(out, 1); + *it++ = static_cast(data::signs[fspecs.sign]); + out = base_iterator(out, it); + fspecs.sign = sign::none; + if (specs.width != 0) --specs.width; + } + + memory_buffer buffer; + if (fspecs.format == float_format::hex) { + if (fspecs.sign) buffer.push_back(data::signs[fspecs.sign]); + snprintf_float(promote_float(value), specs.precision, fspecs, buffer); + return write_bytes(out, {buffer.data(), buffer.size()}, specs); + } + int precision = specs.precision >= 0 || !specs.type ? specs.precision : 6; + if (fspecs.format == float_format::exp) { + if (precision == max_value()) + FMT_THROW(format_error("number is too big")); + else + ++precision; + } + if (const_check(std::is_same())) fspecs.binary32 = true; + fspecs.use_grisu = is_fast_float(); + int exp = format_float(promote_float(value), precision, fspecs, buffer); + fspecs.precision = precision; + Char point = + fspecs.locale ? decimal_point(loc) : static_cast('.'); + auto fp = big_decimal_fp{buffer.data(), static_cast(buffer.size()), exp}; + return write_float(out, fp, specs, fspecs, point); +} - template struct bin_writer { - unsigned_type abs_value; - int num_digits; +template ::value)> +OutputIt write(OutputIt out, T value) { + if (const_check(!is_supported_floating_point(value))) return out; - template void operator()(It&& it) const { - it = format_uint(it, abs_value, num_digits); - } - }; + using floaty = conditional_t::value, double, T>; + using uint_type = typename dragonbox::float_info::carrier_uint; + auto bits = bit_cast(value); - void on_bin() { - if (specs.alt) { - prefix[prefix_size++] = '0'; - prefix[prefix_size++] = static_cast(specs.type); - } - int num_digits = count_digits<1>(abs_value); - writer.write_int(num_digits, get_prefix(), specs, - bin_writer<1>{abs_value, num_digits}); - } + auto fspecs = float_specs(); + auto sign_bit = bits & (uint_type(1) << (num_bits() - 1)); + if (sign_bit != 0) { + fspecs.sign = sign::minus; + value = -value; + } - void on_oct() { - int num_digits = count_digits<3>(abs_value); - if (specs.alt && specs.precision <= num_digits && abs_value != 0) { - // Octal prefix '0' is counted as a digit, so only add it if precision - // is not greater than the number of digits. - prefix[prefix_size++] = '0'; - } - writer.write_int(num_digits, get_prefix(), specs, - bin_writer<3>{abs_value, num_digits}); - } + static const auto specs = basic_format_specs(); + uint_type mask = exponent_mask(); + if ((bits & mask) == mask) + return write_nonfinite(out, std::isinf(value), specs, fspecs); - enum { sep_size = 1 }; - - struct num_writer { - unsigned_type abs_value; - int size; - const std::string& groups; - char_type sep; - - template void operator()(It&& it) const { - basic_string_view s(&sep, sep_size); - // Index of a decimal digit with the least significant digit having - // index 0. - int digit_index = 0; - std::string::const_iterator group = groups.cbegin(); - it = format_decimal( - it, abs_value, size, - [this, s, &group, &digit_index](char_type*& buffer) { - if (*group <= 0 || ++digit_index % *group != 0 || - *group == max_value()) - return; - if (group + 1 != groups.cend()) { - digit_index = 0; - ++group; - } - buffer -= s.size(); - std::uninitialized_copy(s.data(), s.data() + s.size(), - make_checked(buffer, s.size())); - }); - } - }; + auto dec = dragonbox::to_decimal(static_cast(value)); + return write_float(out, dec, specs, fspecs, static_cast('.')); +} - void on_num() { - std::string groups = grouping(writer.locale_); - if (groups.empty()) return on_dec(); - auto sep = thousands_sep(writer.locale_); - if (!sep) return on_dec(); - int num_digits = count_digits(abs_value); - int size = num_digits; - std::string::const_iterator group = groups.cbegin(); - while (group != groups.cend() && num_digits > *group && *group > 0 && - *group != max_value()) { - size += sep_size; - num_digits -= *group; - ++group; - } - if (group == groups.cend()) - size += sep_size * ((num_digits - 1) / groups.back()); - writer.write_int(size, get_prefix(), specs, - num_writer{abs_value, size, groups, sep}); - } +template ::value && + !is_fast_float::value)> +inline OutputIt write(OutputIt out, T value) { + return write(out, value, basic_format_specs()); +} - FMT_NORETURN void on_error() { - FMT_THROW(format_error("invalid type specifier")); - } +template +OutputIt write_char(OutputIt out, Char value, + const basic_format_specs& specs) { + using iterator = remove_reference_t; + return write_padded(out, specs, 1, [=](iterator it) { + *it++ = value; + return it; + }); +} + +template +OutputIt write_ptr(OutputIt out, UIntPtr value, + const basic_format_specs* specs) { + int num_digits = count_digits<4>(value); + auto size = to_unsigned(num_digits) + size_t(2); + using iterator = remove_reference_t; + auto write = [=](iterator it) { + *it++ = static_cast('0'); + *it++ = static_cast('x'); + return format_uint<4, Char>(it, value, num_digits); }; + return specs ? write_padded(out, *specs, size, write) + : base_iterator(out, write(reserve(out, size))); +} - template struct str_writer { - const Char* s; - size_t size_; +template struct is_integral : std::is_integral {}; +template <> struct is_integral : std::true_type {}; +template <> struct is_integral : std::true_type {}; - size_t size() const { return size_; } - size_t width() const { - return count_code_points(basic_string_view(s, size_)); - } +template +OutputIt write(OutputIt out, monostate) { + FMT_ASSERT(false, ""); + return out; +} - template void operator()(It&& it) const { - it = copy_str(s, s + size_, it); - } - }; +template ::value)> +OutputIt write(OutputIt out, string_view value) { + auto it = reserve(out, value.size()); + it = copy_str(value.begin(), value.end(), it); + return base_iterator(out, it); +} + +template +OutputIt write(OutputIt out, basic_string_view value) { + auto it = reserve(out, value.size()); + it = std::copy(value.begin(), value.end(), it); + return base_iterator(out, it); +} - template struct pointer_writer { - UIntPtr value; - int num_digits; +template +buffer_appender write(buffer_appender out, + basic_string_view value) { + get_container(out).append(value.begin(), value.end()); + return out; +} + +template ::value && + !std::is_same::value && + !std::is_same::value)> +OutputIt write(OutputIt out, T value) { + auto abs_value = static_cast>(value); + bool negative = is_negative(value); + // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer. + if (negative) abs_value = ~abs_value + 1; + int num_digits = count_digits(abs_value); + auto size = (negative ? 1 : 0) + static_cast(num_digits); + auto it = reserve(out, size); + if (auto ptr = to_pointer(it, size)) { + if (negative) *ptr++ = static_cast('-'); + format_decimal(ptr, abs_value, num_digits); + return out; + } + if (negative) *it++ = static_cast('-'); + it = format_decimal(it, abs_value, num_digits).end; + return base_iterator(out, it); +} - size_t size() const { return to_unsigned(num_digits) + 2; } - size_t width() const { return size(); } +template +OutputIt write(OutputIt out, bool value) { + return write(out, string_view(value ? "true" : "false")); +} - template void operator()(It&& it) const { - *it++ = static_cast('0'); - *it++ = static_cast('x'); - it = format_uint<4, char_type>(it, value, num_digits); - } - }; +template +OutputIt write(OutputIt out, Char value) { + auto it = reserve(out, 1); + *it++ = value; + return base_iterator(out, it); +} - public: - explicit basic_writer(Range out, locale_ref loc = locale_ref()) - : out_(out.begin()), locale_(loc) {} - - iterator out() const { return out_; } - - // Writes a value in the format - // - // where is written by f(it). - template void write_padded(const format_specs& specs, F&& f) { - // User-perceived width (in code points). - unsigned width = to_unsigned(specs.width); - size_t size = f.size(); // The number of code units. - size_t num_code_points = width != 0 ? f.width() : size; - if (width <= num_code_points) return f(reserve(size)); - auto&& it = reserve(width + (size - num_code_points)); - char_type fill = specs.fill[0]; - std::size_t padding = width - num_code_points; - if (specs.align == align::right) { - it = std::fill_n(it, padding, fill); - f(it); - } else if (specs.align == align::center) { - std::size_t left_padding = padding / 2; - it = std::fill_n(it, left_padding, fill); - f(it); - it = std::fill_n(it, padding - left_padding, fill); - } else { - f(it); - it = std::fill_n(it, padding, fill); - } +template +OutputIt write(OutputIt out, const Char* value) { + if (!value) { + FMT_THROW(format_error("string pointer is null")); + } else { + auto length = std::char_traits::length(value); + out = write(out, basic_string_view(value, length)); } + return out; +} - void write(int value) { write_decimal(value); } - void write(long value) { write_decimal(value); } - void write(long long value) { write_decimal(value); } +template +OutputIt write(OutputIt out, const void* value) { + return write_ptr(out, to_uintptr(value), nullptr); +} - void write(unsigned value) { write_decimal(value); } - void write(unsigned long value) { write_decimal(value); } - void write(unsigned long long value) { write_decimal(value); } +template +auto write(OutputIt out, const T& value) -> typename std::enable_if< + mapped_type_constant>::value == + type::custom_type, + OutputIt>::type { + using context_type = basic_format_context; + using formatter_type = + conditional_t::value, + typename context_type::template formatter_type, + fallback_formatter>; + context_type ctx(out, {}, {}); + return formatter_type().format(value, ctx); +} -#if FMT_USE_INT128 - void write(int128_t value) { write_decimal(value); } - void write(uint128_t value) { write_decimal(value); } -#endif +// An argument visitor that formats the argument and writes it via the output +// iterator. It's a class and not a generic lambda for compatibility with C++11. +template struct default_arg_formatter { + using context = basic_format_context; - template - void write_int(T value, const Spec& spec) { - handle_int_type_spec(spec.type, int_writer(*this, value, spec)); + OutputIt out; + basic_format_args args; + locale_ref loc; + + template OutputIt operator()(T value) { + return write(out, value); } - template ::value)> - void write(T value, format_specs specs = {}) { - float_specs fspecs = parse_float_type_spec(specs); - fspecs.sign = specs.sign; - if (std::signbit(value)) { // value < 0 is false for NaN so use signbit. - fspecs.sign = sign::minus; - value = -value; - } else if (fspecs.sign == sign::minus) { - fspecs.sign = sign::none; - } + OutputIt operator()(typename basic_format_arg::handle handle) { + basic_format_parse_context parse_ctx({}); + basic_format_context format_ctx(out, args, loc); + handle.format(parse_ctx, format_ctx); + return format_ctx.out(); + } +}; - if (!std::isfinite(value)) { - auto str = std::isinf(value) ? (fspecs.upper ? "INF" : "inf") - : (fspecs.upper ? "NAN" : "nan"); - return write_padded(specs, nonfinite_writer{fspecs.sign, str}); - } +template +class arg_formatter_base { + public: + using iterator = OutputIt; + using char_type = Char; + using format_specs = basic_format_specs; - if (specs.align == align::none) { - specs.align = align::right; - } else if (specs.align == align::numeric) { - if (fspecs.sign) { - auto&& it = reserve(1); - *it++ = static_cast(data::signs[fspecs.sign]); - fspecs.sign = sign::none; - if (specs.width != 0) --specs.width; - } - specs.align = align::right; - } + private: + iterator out_; + locale_ref locale_; + format_specs* specs_; - memory_buffer buffer; - if (fspecs.format == float_format::hex) { - if (fspecs.sign) buffer.push_back(data::signs[fspecs.sign]); - snprintf_float(promote_float(value), specs.precision, fspecs, buffer); - write_padded(specs, str_writer{buffer.data(), buffer.size()}); - return; - } - int precision = specs.precision >= 0 || !specs.type ? specs.precision : 6; - if (fspecs.format == float_format::exp) ++precision; - if (const_check(std::is_same())) fspecs.binary32 = true; - fspecs.use_grisu = use_grisu(); - if (const_check(FMT_DEPRECATED_PERCENT) && fspecs.percent) value *= 100; - int exp = format_float(promote_float(value), precision, fspecs, buffer); - if (const_check(FMT_DEPRECATED_PERCENT) && fspecs.percent) { - buffer.push_back('%'); - --exp; // Adjust decimal place position. - } - fspecs.precision = precision; - char_type point = fspecs.locale ? decimal_point(locale_) - : static_cast('.'); - write_padded(specs, float_writer(buffer.data(), - static_cast(buffer.size()), - exp, fspecs, point)); + // Attempts to reserve space for n extra characters in the output range. + // Returns a pointer to the reserved range or a reference to out_. + auto reserve(size_t n) -> decltype(detail::reserve(out_, n)) { + return detail::reserve(out_, n); + } + + using reserve_iterator = remove_reference_t(), 0))>; + + template void write_int(T value, const format_specs& spec) { + using uint_type = uint32_or_64_or_128_t; + int_writer w(out_, locale_, value, spec); + handle_int_type_spec(spec.type, w); + out_ = w.out; } void write(char value) { @@ -1728,191 +2153,193 @@ template class basic_writer { *it++ = value; } - template ::value)> - void write(Char value) { - auto&& it = reserve(1); - *it++ = value; + template ::value)> + void write(Ch value) { + out_ = detail::write(out_, value); } void write(string_view value) { auto&& it = reserve(value.size()); - it = copy_str(value.begin(), value.end(), it); + it = copy_str(value.begin(), value.end(), it); } void write(wstring_view value) { - static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); auto&& it = reserve(value.size()); it = std::copy(value.begin(), value.end(), it); } - template - void write(const Char* s, std::size_t size, const format_specs& specs) { - write_padded(specs, str_writer{s, size}); + template + void write(const Ch* s, size_t size, const format_specs& specs) { + auto width = specs.width != 0 + ? count_code_points(basic_string_view(s, size)) + : 0; + out_ = write_padded(out_, specs, size, width, [=](reserve_iterator it) { + return copy_str(s, s + size, it); + }); } - template - void write(basic_string_view s, const format_specs& specs = {}) { - const Char* data = s.data(); - std::size_t size = s.size(); - if (specs.precision >= 0 && to_unsigned(specs.precision) < size) - size = code_point_index(s, to_unsigned(specs.precision)); - write(data, size, specs); + template + void write(basic_string_view s, const format_specs& specs = {}) { + out_ = detail::write(out_, s, specs); } - template - void write_pointer(UIntPtr value, const format_specs* specs) { - int num_digits = count_digits<4>(value); - auto pw = pointer_writer{value, num_digits}; - if (!specs) return pw(reserve(to_unsigned(num_digits) + 2)); - format_specs specs_copy = *specs; - if (specs_copy.align == align::none) specs_copy.align = align::right; - write_padded(specs_copy, pw); + void write_pointer(const void* p) { + out_ = write_ptr(out_, to_uintptr(p), specs_); } -}; - -using writer = basic_writer>; -template struct is_integral : std::is_integral {}; -template <> struct is_integral : std::true_type {}; -template <> struct is_integral : std::true_type {}; + struct char_spec_handler : ErrorHandler { + arg_formatter_base& formatter; + Char value; -template -class arg_formatter_base { - public: - using char_type = typename Range::value_type; - using iterator = typename Range::iterator; - using format_specs = basic_format_specs; + char_spec_handler(arg_formatter_base& f, Char val) + : formatter(f), value(val) {} - private: - using writer_type = basic_writer; - writer_type writer_; - format_specs* specs_; + void on_int() { + // char is only formatted as int if there are specs. + formatter.write_int(static_cast(value), *formatter.specs_); + } + void on_char() { + if (formatter.specs_) + formatter.out_ = write_char(formatter.out_, value, *formatter.specs_); + else + formatter.write(value); + } + }; - struct char_writer { - char_type value; + struct cstring_spec_handler : error_handler { + arg_formatter_base& formatter; + const Char* value; - size_t size() const { return 1; } - size_t width() const { return 1; } + cstring_spec_handler(arg_formatter_base& f, const Char* val) + : formatter(f), value(val) {} - template void operator()(It&& it) const { *it++ = value; } + void on_string() { formatter.write(value); } + void on_pointer() { formatter.write_pointer(value); } }; - void write_char(char_type value) { - if (specs_) - writer_.write_padded(*specs_, char_writer{value}); - else - writer_.write(value); - } - - void write_pointer(const void* p) { - writer_.write_pointer(internal::to_uintptr(p), specs_); - } - protected: - writer_type& writer() { return writer_; } - FMT_DEPRECATED format_specs* spec() { return specs_; } + iterator out() { return out_; } format_specs* specs() { return specs_; } - iterator out() { return writer_.out(); } void write(bool value) { - string_view sv(value ? "true" : "false"); - specs_ ? writer_.write(sv, *specs_) : writer_.write(sv); + if (specs_) + write(string_view(value ? "true" : "false"), *specs_); + else + out_ = detail::write(out_, value); } - void write(const char_type* value) { + void write(const Char* value) { if (!value) { FMT_THROW(format_error("string pointer is null")); } else { auto length = std::char_traits::length(value); basic_string_view sv(value, length); - specs_ ? writer_.write(sv, *specs_) : writer_.write(sv); + specs_ ? write(sv, *specs_) : write(sv); } } public: - arg_formatter_base(Range r, format_specs* s, locale_ref loc) - : writer_(r, loc), specs_(s) {} + arg_formatter_base(OutputIt out, format_specs* s, locale_ref loc) + : out_(out), locale_(loc), specs_(s) {} iterator operator()(monostate) { FMT_ASSERT(false, "invalid argument type"); - return out(); + return out_; } template ::value)> - iterator operator()(T value) { + FMT_INLINE iterator operator()(T value) { if (specs_) - writer_.write_int(value, *specs_); + write_int(value, *specs_); else - writer_.write(value); - return out(); + out_ = detail::write(out_, value); + return out_; } - iterator operator()(char_type value) { - internal::handle_char_specs( - specs_, char_spec_handler(*this, static_cast(value))); - return out(); + iterator operator()(Char value) { + handle_char_specs(specs_, + char_spec_handler(*this, static_cast(value))); + return out_; } iterator operator()(bool value) { if (specs_ && specs_->type) return (*this)(value ? 1 : 0); write(value != 0); - return out(); + return out_; } template ::value)> iterator operator()(T value) { - writer_.write(value, specs_ ? *specs_ : format_specs()); - return out(); + auto specs = specs_ ? *specs_ : format_specs(); + if (const_check(is_supported_floating_point(value))) + out_ = detail::write(out_, value, specs, locale_); + else + FMT_ASSERT(false, "unsupported float argument type"); + return out_; } - struct char_spec_handler : ErrorHandler { - arg_formatter_base& formatter; - char_type value; - - char_spec_handler(arg_formatter_base& f, char_type val) - : formatter(f), value(val) {} - - void on_int() { - if (formatter.specs_) - formatter.writer_.write_int(value, *formatter.specs_); - else - formatter.writer_.write(value); - } - void on_char() { formatter.write_char(value); } - }; - - struct cstring_spec_handler : internal::error_handler { - arg_formatter_base& formatter; - const char_type* value; - - cstring_spec_handler(arg_formatter_base& f, const char_type* val) - : formatter(f), value(val) {} - - void on_string() { formatter.write(value); } - void on_pointer() { formatter.write_pointer(value); } - }; - - iterator operator()(const char_type* value) { - if (!specs_) return write(value), out(); - internal::handle_cstring_type_spec(specs_->type, - cstring_spec_handler(*this, value)); - return out(); + iterator operator()(const Char* value) { + if (!specs_) return write(value), out_; + handle_cstring_type_spec(specs_->type, cstring_spec_handler(*this, value)); + return out_; } - iterator operator()(basic_string_view value) { + iterator operator()(basic_string_view value) { if (specs_) { - internal::check_string_type_spec(specs_->type, internal::error_handler()); - writer_.write(value, *specs_); + check_string_type_spec(specs_->type, error_handler()); + write(value, *specs_); } else { - writer_.write(value); + write(value); } - return out(); + return out_; } iterator operator()(const void* value) { - if (specs_) - check_pointer_type_spec(specs_->type, internal::error_handler()); + if (specs_) check_pointer_type_spec(specs_->type, error_handler()); write_pointer(value); - return out(); + return out_; + } +}; + +/** The default argument formatter. */ +template +class arg_formatter : public arg_formatter_base { + private: + using char_type = Char; + using base = arg_formatter_base; + using context_type = basic_format_context; + + context_type& ctx_; + basic_format_parse_context* parse_ctx_; + const Char* ptr_; + + public: + using iterator = typename base::iterator; + using format_specs = typename base::format_specs; + + /** + \rst + Constructs an argument formatter object. + *ctx* is a reference to the formatting context, + *specs* contains format specifier information for standard argument types. + \endrst + */ + explicit arg_formatter( + context_type& ctx, + basic_format_parse_context* parse_ctx = nullptr, + format_specs* specs = nullptr, const Char* ptr = nullptr) + : base(ctx.out(), specs, ctx.locale()), + ctx_(ctx), + parse_ctx_(parse_ctx), + ptr_(ptr) {} + + using base::operator(); + + /** Formats an argument of a user-defined type. */ + iterator operator()(typename basic_format_arg::handle handle) { + if (ptr_) advance_to(*parse_ctx_, ptr_); + handle.format(*parse_ctx_, ctx_); + return ctx_.out(); } }; @@ -1926,10 +2353,6 @@ template FMT_CONSTEXPR int parse_nonnegative_int(const Char*& begin, const Char* end, ErrorHandler&& eh) { FMT_ASSERT(begin != end && '0' <= *begin && *begin <= '9', ""); - if (*begin == '0') { - ++begin; - return 0; - } unsigned value = 0; // Convert to unsigned to prevent a warning. constexpr unsigned max_int = max_value(); @@ -1959,12 +2382,11 @@ template class custom_formatter { Context& ctx) : parse_ctx_(parse_ctx), ctx_(ctx) {} - bool operator()(typename basic_format_arg::handle h) const { + void operator()(typename basic_format_arg::handle h) const { h.format(parse_ctx_, ctx_); - return true; } - template bool operator()(T) const { return false; } + template void operator()(T) const {} }; template @@ -2023,7 +2445,9 @@ template class specs_setter { : specs_(other.specs_) {} FMT_CONSTEXPR void on_align(align_t align) { specs_.align = align; } - FMT_CONSTEXPR void on_fill(Char fill) { specs_.fill[0] = fill; } + FMT_CONSTEXPR void on_fill(basic_string_view fill) { + specs_.fill = fill; + } FMT_CONSTEXPR void on_plus() { specs_.sign = sign::plus; } FMT_CONSTEXPR void on_minus() { specs_.sign = sign::minus; } FMT_CONSTEXPR void on_space() { specs_.sign = sign::space; } @@ -2050,7 +2474,7 @@ template class specs_setter { template class numeric_specs_checker { public: - FMT_CONSTEXPR numeric_specs_checker(ErrorHandler& eh, internal::type arg_type) + FMT_CONSTEXPR numeric_specs_checker(ErrorHandler& eh, detail::type arg_type) : error_handler_(eh), arg_type_(arg_type) {} FMT_CONSTEXPR void require_numeric_argument() { @@ -2060,31 +2484,37 @@ template class numeric_specs_checker { FMT_CONSTEXPR void check_sign() { require_numeric_argument(); - if (is_integral_type(arg_type_) && arg_type_ != int_type && - arg_type_ != long_long_type && arg_type_ != internal::char_type) { + if (is_integral_type(arg_type_) && arg_type_ != type::int_type && + arg_type_ != type::long_long_type && arg_type_ != type::char_type) { error_handler_.on_error("format specifier requires signed argument"); } } FMT_CONSTEXPR void check_precision() { - if (is_integral_type(arg_type_) || arg_type_ == internal::pointer_type) + if (is_integral_type(arg_type_) || arg_type_ == type::pointer_type) error_handler_.on_error("precision not allowed for this argument type"); } private: ErrorHandler& error_handler_; - internal::type arg_type_; + detail::type arg_type_; }; // A format specifier handler that checks if specifiers are consistent with the // argument type. template class specs_checker : public Handler { + private: + numeric_specs_checker checker_; + + // Suppress an MSVC warning about using this in initializer list. + FMT_CONSTEXPR Handler& error_handler() { return *this; } + public: - FMT_CONSTEXPR specs_checker(const Handler& handler, internal::type arg_type) - : Handler(handler), checker_(*this, arg_type) {} + FMT_CONSTEXPR specs_checker(const Handler& handler, detail::type arg_type) + : Handler(handler), checker_(error_handler(), arg_type) {} FMT_CONSTEXPR specs_checker(const specs_checker& other) - : Handler(other), checker_(*this, other.arg_type_) {} + : Handler(other), checker_(error_handler(), other.arg_type_) {} FMT_CONSTEXPR void on_align(align_t align) { if (align == align::numeric) checker_.require_numeric_argument(); @@ -2117,9 +2547,6 @@ template class specs_checker : public Handler { } FMT_CONSTEXPR void end_precision() { checker_.check_precision(); } - - private: - numeric_specs_checker checker_; }; template