Merge branch 'feature/merge_ryzomcore171003' into develop

This commit is contained in:
compil 2017-12-07 22:44:50 +01:00
commit d10a1274c3
396 changed files with 191204 additions and 179951 deletions

View file

@ -28,10 +28,6 @@ IF(COMMAND cmake_policy)
# have absolute paths (e.g. -lpthread)
cmake_policy(SET CMP0003 NEW)
# Works around warnings about escaped quotes in ADD_DEFINITIONS
# statements
cmake_policy(SET CMP0005 OLD)
# allow to link to qtmain automatically under Windows
IF(POLICY CMP0020)
CMAKE_POLICY(SET CMP0020 NEW)
@ -64,8 +60,8 @@ SET(YEAR "2004-${CURRENT_YEAR}")
SET(AUTHOR "Winch Gate and The Ryzom Core Community")
SET(RYZOM_VERSION_MAJOR 3)
SET(RYZOM_VERSION_MINOR 1)
SET(RYZOM_VERSION_PATCH 0)
SET(RYZOM_VERSION_MINOR 2)
SET(RYZOM_VERSION_PATCH 1)
#-----------------------------------------------------------------------------
# Redirect output files
@ -168,6 +164,10 @@ IF(WITH_SSE2)
ENDIF()
ENDIF()
IF(APPLE)
FIND_LIBRARY(CARBON_FRAMEWORK Carbon)
FIND_LIBRARY(FOUNDATION_FRAMEWORK Foundation)
IF(APPLE_CERTIFICATE)
# Find codesign_allocate
@ -189,6 +189,7 @@ IF(APPLE_CERTIFICATE)
SET(CODESIGN_ALLOCATE)
ENDIF()
ENDIF()
ENDIF()
MACRO(ADD_QT_LIBRARY _NAME)
IF(WIN32)
@ -336,7 +337,7 @@ IF(WITH_QT5)
ENDIF()
# freetype is needed since Qt 5.5
FIND_PACKAGE(FreeType)
FIND_PACKAGE(Freetype)
IF(FREETYPE_FOUND)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIBRARIES})
@ -382,8 +383,6 @@ IF(WITH_QT5)
IF(APPLE)
FIND_LIBRARY(PCRE_LIBRARY pcre16 pcre)
FIND_LIBRARY(FOUNDATION_FRAMEWORK Foundation)
FIND_LIBRARY(CARBON_FRAMEWORK Carbon)
FIND_LIBRARY(SECURITY_FRAMEWORK Security)
SET(QT_LIBRARIES ${QT_LIBRARIES}
@ -448,6 +447,8 @@ IF(WITH_NEL)
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${INTL_LIBRARY})
ENDIF()
ENDIF()
ELSEIF(WIN32)
SET(CURL_LIBRARIES ${CURL_LIBRARIES} Crypt32.lib)
ENDIF()
ENDIF()
ENDIF()

View file

@ -28,14 +28,14 @@ IF(TARGET_CPU STREQUAL "armv7")
SET(TOOLCHAIN_ARCH "arm")
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi")
SET(MINIMUM_NDK_TARGET 4)
SET(MINIMUM_NDK_TARGET 9)
ELSEIF(TARGET_CPU STREQUAL "armv5")
SET(LIBRARY_ARCHITECTURE "armeabi")
SET(CMAKE_SYSTEM_PROCESSOR "armv5")
SET(TOOLCHAIN_ARCH "arm")
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi")
SET(MINIMUM_NDK_TARGET 4)
SET(MINIMUM_NDK_TARGET 9)
ELSEIF(TARGET_CPU STREQUAL "arm64")
SET(LIBRARY_ARCHITECTURE "arm64-v8a")
SET(CMAKE_SYSTEM_PROCESSOR "arm64")
@ -76,14 +76,9 @@ ELSE()
ENDIF()
SET(CLANG_TOOLCHAIN_PREFIX "llvm")
SET(ANDROID_COMPILER "GCC")
IF(NDK_TOOLCHAIN_VERSION STREQUAL "clang")
SET(ANDROID_COMPILER "clang")
SET(ANDROID_COMPILER "clang")
SET(CLANG ON)
ELSE()
SET(GCC_TOOLCHAIN_VERSION ${NDK_TOOLCHAIN_VERSION})
ENDIF()
IF(NOT NDK_TARGET)
SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
@ -94,88 +89,71 @@ ELSE()
ENDIF()
IF(CMAKE_HOST_WIN32)
SET(TOOLCHAIN_HOST "windows")
SET(TOOLCHAIN_HOST "windows-x86_64")
SET(TOOLCHAIN_BIN_SUFFIX ".exe")
ELSEIF(CMAKE_HOST_APPLE)
SET(TOOLCHAIN_HOST "apple")
SET(TOOLCHAIN_BIN_SUFFIX "")
ELSEIF(CMAKE_HOST_UNIX)
SET(TOOLCHAIN_HOST "linux")
SET(TOOLCHAIN_HOST "linux-x86_64")
SET(TOOLCHAIN_BIN_SUFFIX "")
ENDIF()
MACRO(SEARCH_TOOLCHAIN _COMPILER)
SET(${_COMPILER}_TOOLCHAIN_VERSIONS)
FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-*")
# clang
SET(CLANG_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${CLANG_TOOLCHAIN_PREFIX}/prebuilt/${TOOLCHAIN_HOST}")
IF(EXISTS ${CLANG_TOOLCHAIN_ROOT})
MESSAGE(STATUS "Found LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}")
ELSE()
MESSAGE(FATAL_ERROR "No LLVM toolchain found in default search path ${CLANG_TOOLCHAIN_ROOT}")
ENDIF()
# gcc
SET(GCC_TOOLCHAIN_VERSIONS)
FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${GCC_TOOLCHAIN_PREFIX}-*")
IF(_TOOLCHAIN_VERSIONS)
LIST(SORT _TOOLCHAIN_VERSIONS)
LIST(REVERSE _TOOLCHAIN_VERSIONS)
FOREACH(_TOOLCHAIN_VERSION ${_TOOLCHAIN_VERSIONS})
STRING(REGEX REPLACE ".+${_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}")
IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
LIST(APPEND ${_COMPILER}_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION})
LIST(APPEND GCC_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION})
ENDIF()
ENDFOREACH()
ENDIF()
# try prefixes without version
SET(_TOOLCHAIN_WITHOUT_VERSION "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}")
IF(EXISTS ${_TOOLCHAIN_WITHOUT_VERSION})
LIST(APPEND ${_COMPILER}_TOOLCHAIN_VERSIONS "default")
IF(NOT GCC_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No GCC version found in default search path ${NDK_ROOT}/toolchains")
ENDIF()
IF(NOT ${_COMPILER}_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No Android ${_COMPILER} toolchain found in default search path ${NDK_ROOT}/toolchains")
ENDIF()
IF(${_COMPILER}_TOOLCHAIN_VERSIONS)
LIST(FIND ${_COMPILER}_TOOLCHAIN_VERSIONS "${${_COMPILER}_TOOLCHAIN_VERSION}" _INDEX)
IF(GCC_TOOLCHAIN_VERSIONS)
LIST(FIND GCC_TOOLCHAIN_VERSIONS "${GCC_TOOLCHAIN_VERSION}" _INDEX)
IF(_INDEX EQUAL -1)
LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION)
LIST(GET GCC_TOOLCHAIN_VERSIONS 0 GCC_TOOLCHAIN_VERSION)
ENDIF()
ELSE()
LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION)
LIST(GET GCC_TOOLCHAIN_VERSIONS 0 GCC_TOOLCHAIN_VERSION)
ENDIF()
MESSAGE(STATUS "TOOLCHAIN_PREFIX = ${${_COMPILER}_TOOLCHAIN_VERSION}")
SET(GCC_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${GCC_TOOLCHAIN_PREFIX}-${GCC_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
IF("${${_COMPILER}_TOOLCHAIN_VERSION}" STREQUAL "default")
MESSAGE(STATUS "default")
SET(${_COMPILER}_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}/prebuilt/${TOOLCHAIN_HOST}")
ELSE()
MESSAGE(STATUS "not default")
SET(${_COMPILER}_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-${${_COMPILER}_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
ENDIF()
IF(NOT EXISTS "${${_COMPILER}_TOOLCHAIN_ROOT}")
FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*")
IF(NOT EXISTS "${GCC_TOOLCHAIN_ROOT}")
FILE(GLOB _TOOLCHAIN_PREFIXES "${GCC_TOOLCHAIN_ROOT}*")
IF(_TOOLCHAIN_PREFIXES)
LIST(GET _TOOLCHAIN_PREFIXES 0 ${_COMPILER}_TOOLCHAIN_ROOT)
LIST(GET _TOOLCHAIN_PREFIXES 0 GCC_TOOLCHAIN_ROOT)
ENDIF()
ENDIF()
ENDMACRO()
IF(CLANG)
SEARCH_TOOLCHAIN(CLANG)
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use clang ${CLANG_TOOLCHAIN_VERSION}")
ENDIF()
SEARCH_TOOLCHAIN(GCC)
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${GCC_TOOLCHAIN_VERSION}")
IF(CLANG_TOOLCHAIN_ROOT)
MESSAGE(STATUS "Found Android LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}")
ENDIF()
IF(GCC_TOOLCHAIN_ROOT)
MESSAGE(STATUS "Found Android GCC toolchain in ${GCC_TOOLCHAIN_ROOT}")
IF(EXISTS "${GCC_TOOLCHAIN_ROOT}")
MESSAGE(STATUS "Found GCC toolchain in ${GCC_TOOLCHAIN_ROOT}")
ELSE()
MESSAGE(FATAL_ERROR "No GCC toolchain found in default search path ${GCC_TOOLCHAIN_ROOT}")
ENDIF()
# NDK
SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}")
MESSAGE(STATUS "Found Android platform in ${PLATFORM_ROOT}")
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} found in ${PLATFORM_ROOT}")
# include dirs
SET(PLATFORM_INCLUDE_DIR "${PLATFORM_ROOT}/usr/include")
@ -208,17 +186,18 @@ MACRO(SET_TOOLCHAIN_BINARY_GCC _NAME _BINARY)
SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
ENDMACRO()
# Force the compilers to GCC for Android
include (CMakeForceCompiler)
IF(CLANG)
MESSAGE(STATUS "Using clang compiler")
SET(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_C_COMPILER clang)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_CXX_COMPILER clang++)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} clang)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} clang)
SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER})
SET(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN_BIN_PREFIX})
SET(CMAKE_C_COMPILER_FORCED TRUE)
SET(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER})
SET(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN_BIN_PREFIX})
SET(CMAKE_CXX_COMPILER_FORCED TRUE)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_ASM_COMPILER llvm-as)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_AR llvm-ar)
@ -231,19 +210,6 @@ IF(CLANG)
IF(NOT EXISTS "${CMAKE_AR}")
SET_TOOLCHAIN_BINARY_GCC(CMAKE_AR ar)
ENDIF()
ELSE()
MESSAGE(STATUS "Using GCC compiler")
SET_TOOLCHAIN_BINARY_GCC(CMAKE_C_COMPILER gcc)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_CXX_COMPILER g++)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_ASM_COMPILER as)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_AR ar)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_LINKER ld)
ENDIF()
SET_TOOLCHAIN_BINARY_GCC(CMAKE_STRIP strip)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_NM nm)

View file

@ -5,6 +5,24 @@
# VC_LIBRARY_DIR - where to find libraries
# VC_FOUND - True if MSVC found.
MACRO(ADD_TRAILING_SLASH _FILENAME_VAR)
# put content in a new variable
SET(_FILENAME ${${_FILENAME_VAR}})
# get length of the string
STRING(LENGTH ${_FILENAME} _LEN)
# convert length to last pos
MATH(EXPR _POS "${_LEN}-1")
# get last character of the string
STRING(SUBSTRING ${_FILENAME} ${_POS} 1 _FILENAME_END)
# compare it with a slash
IF(NOT _FILENAME_END STREQUAL "/")
# not a slash, append it
SET(${_FILENAME_VAR} "${_FILENAME}/")
ELSE()
# already a slash
ENDIF()
ENDMACRO()
MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
# Software/Wow6432Node/...
GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;${_VERSION}]" ABSOLUTE)
@ -12,7 +30,11 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
IF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_DIR)
GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;${_VERSION}]" ABSOLUTE)
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
# be sure it's finishing by a /
ADD_TRAILING_SLASH(VC${_VERSION}_DIR)
SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/")
ENDIF()
ENDIF()
@ -55,7 +77,34 @@ MACRO(DETECT_EXPRESS_VERSION _VERSION)
ENDIF()
ENDMACRO()
IF(MSVC14)
IF(MSVC1411 OR MSVC1410)
DETECT_VC_VERSION("15.0")
SET(MSVC_TOOLSET "140")
SET(VC_DIR "${VC_DIR}Tools/MSVC")
FILE(GLOB MSVC_TOOLCHAIN_VERSIONS RELATIVE ${VC_DIR} "${VC_DIR}/*")
IF(MSVC_TOOLCHAIN_VERSIONS)
LIST(SORT MSVC_TOOLCHAIN_VERSIONS)
LIST(REVERSE MSVC_TOOLCHAIN_VERSIONS)
ENDIF()
IF(NOT MSVC_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No MSVC version found in default search path ${VC_DIR}")
ENDIF()
LIST(GET MSVC_TOOLCHAIN_VERSIONS 0 MSVC_TOOLCHAIN_VERSION)
SET(VC_DIR "${VC_DIR}/${MSVC_TOOLCHAIN_VERSION}")
SET(VC_INCLUDE_DIR "${VC_DIR}/include")
IF(NOT MSVC14_REDIST_DIR)
# If you have VC++ 2017 Express, put x64/Microsoft.VC141.CRT/*.dll in ${EXTERNAL_PATH}/redist
# original files whould be in ${VC_DIR}/Redist/MSVC/14.11.25325/x64/Microsoft.VC141.CRT
SET(MSVC14_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF()
ELSEIF(MSVC14)
DETECT_VC_VERSION("14.0")
SET(MSVC_TOOLSET "140")
@ -109,6 +158,11 @@ IF(NOT VC_DIR)
STRING(REGEX REPLACE "/(bin|BIN|Bin)/.+" "" VC_DIR ${_COMPILER})
ENDIF()
IF(NOT VC_INCLUDE_DIR)
SET(VC_INCLUDE_DIR "${VC_DIR}/include")
ENDIF()
MESSAGE(STATUS "Using headers from ${VC_INCLUDE_DIR}")
SET(VC_INCLUDE_DIRS ${VC_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR})

View file

@ -35,7 +35,7 @@ MACRO(DETECT_WINKIT_VERSION _VERSION _SUFFIX)
SET(WINSDK${_VERSION}_FOUND ON)
SET(WINSDK${_VERSION}_VERSION_FULL "${_VERSION}")
IF(NOT WindowsSDK_FIND_QUIETLY)
MESSAGE(STATUS "Found Windows SDK ${_VERSION} in ${WINSDK${_VERSION}_DIR}")
MESSAGE(STATUS "Found Windows Kit ${_VERSION} in ${WINSDK${_VERSION}_DIR}")
ENDIF()
LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION})
ELSE()
@ -240,7 +240,11 @@ MACRO(USE_CURRENT_WINSDK)
IF(NOT WINSDK_DIR)
# Use Windows SDK versions installed with VC++ when possible
IF(MSVC14)
IF(MSVC1411 OR MSVC1410)
# Special case, use Kits for SDK
SET(WINSDK_VERSION "10.0")
SET(WINSDK_DIR ${WINSDK_UCRT_DIR})
ELSEIF(MSVC14)
SET(WINSDK_VERSION "8.1")
ELSEIF(MSVC12)
SET(WINSDK_VERSION "8.1")
@ -305,7 +309,7 @@ MACRO(USE_CURRENT_WINSDK)
ENDMACRO()
IF(MSVC14)
# Under VC++ 2015, stdio.h, stdlib.h, etc... are part of UCRT
# Under VC++ 2015 and 2017, stdio.h, stdlib.h, etc... are part of UCRT
SET(WINSDK_UCRT_VERSION "10.0")
ENDIF()
@ -314,6 +318,40 @@ IF(WINSDK_UCRT_VERSION AND WINSDK${WINSDK_UCRT_VERSION}_FOUND)
SET(WINSDK_UCRT_DIR "${WINSDK${WINSDK_UCRT_VERSION}_DIR}")
ENDIF()
IF(WINSDK_UCRT_DIR)
# determine exact UCRT version
SET(WINSDK_UCRT_INCLUDE_ROOT_DIR ${WINSDK_UCRT_DIR}/Include)
SET(WINSDK_UCRT_LIB_ROOT_DIR ${WINSDK_UCRT_DIR}/Lib)
FILE(GLOB UCRT_SUBDIRS RELATIVE ${WINSDK_UCRT_INCLUDE_ROOT_DIR} ${WINSDK_UCRT_INCLUDE_ROOT_DIR}/*)
SET(UCRT_VERSION)
FOREACH(UCRT_SUBDIR ${UCRT_SUBDIRS})
IF(NOT UCRT_VERSION OR UCRT_SUBDIR VERSION_GREATER UCRT_VERSION)
SET(UCRT_VERSION ${UCRT_SUBDIR})
ENDIF()
ENDFOREACH()
IF(UCRT_VERSION)
MESSAGE(STATUS "Using Windows UCRT ${UCRT_VERSION}")
SET(WINSDK10_INCLUDE_DIR ${WINSDK_UCRT_INCLUDE_ROOT_DIR}/${UCRT_VERSION})
SET(WINSDK10_LIBRARY_DIR ${WINSDK_UCRT_LIB_ROOT_DIR}/${UCRT_VERSION})
# directory where UCRT headers are found
FIND_PATH(WINSDK_UCRT_INCLUDE_DIR corecrt.h
HINTS
${WINSDK10_INCLUDE_DIR}/ucrt
)
# directory where UCRT libraries are found
FIND_PATH(WINSDK_UCRT_LIBRARY_DIR ucrt.lib
HINTS
${WINSDK10_LIBRARY_DIR}/ucrt/${WINSDK8_SUFFIX}
)
ENDIF()
ENDIF()
IF(WINSDK_VERSION STREQUAL "CURRENT")
USE_CURRENT_WINSDK()
ELSE()
@ -334,93 +372,87 @@ ENDIF()
# directory where Win32 headers are found
FIND_PATH(WINSDK_INCLUDE_DIR Windows.h
HINTS
${WINSDK_DIR}/Include/${UCRT_VERSION}/um
${WINSDK_DIR}/Include/um
${WINSDK_DIR}/Include
NO_DEFAULT_PATH
)
MESSAGE(STATUS "Found Windows.h in ${WINSDK_INCLUDE_DIR}")
# directory where WinRT headers are found
FIND_PATH(WINSDK_WINRT_INCLUDE_DIR winstring.h
HINTS
${WINSDK_DIR}/Include/${UCRT_VERSION}/winrt
${WINSDK_DIR}/Include/winrt
NO_DEFAULT_PATH
)
MESSAGE(STATUS "Found winstring.h in ${WINSDK_WINRT_INCLUDE_DIR}")
# directory where DirectX headers are found
FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h
HINTS
${WINSDK_DIR}/Include/${UCRT_VERSION}/shared
${WINSDK_DIR}/Include/shared
NO_DEFAULT_PATH
)
MESSAGE(STATUS "Found d3d9.h in ${WINSDK_SHARED_INCLUDE_DIR}")
# directory where OpenGL headers are found
FIND_PATH(WINSDK_OPENGL_INCLUDE_DIR GL.h
HINTS
${WINSDK_INCLUDE_DIR}/gl
${WINSDK_DIR}/Include/um/gl
${WINSDK_DIR}/Include/gl
NO_DEFAULT_PATH
)
MESSAGE(STATUS "Found GL.h in ${WINSDK_OPENGL_INCLUDE_DIR}")
SET(WINSDK_LIBRARY_DIRS
${WINSDK_DIR}/Lib/${UCRT_VERSION}/um/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Lib/winv6.3/um/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Lib/win8/um/${WINSDK8_SUFFIX}
)
IF(WINSDK_SUFFIXES)
FOREACH(_SUFFIX ${WINSDK_SUFFIXES})
SET(WINSDK_LIBRARY_DIRS ${WINSDK_LIBRARY_DIRS} ${WINSDK_DIR}/Lib/${_SUFFIX})
LIST(APPEND WINSDK_LIBRARY_DIRS ${WINSDK_DIR}/Lib/${_SUFFIX})
ENDFOREACH()
ELSE()
SET(WINSDK_LIBRARY_DIRS ${WINSDK_LIBRARY_DIRS} ${WINSDK_DIR}/Lib)
LIST(APPEND WINSDK_LIBRARY_DIRS ${WINSDK_DIR}/Lib)
ENDIF()
# directory where all libraries are found
FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib
HINTS
${WINSDK_LIBRARY_DIRS}
NO_DEFAULT_PATH
)
IF(WINSDK_UCRT_DIR)
# determine exact UCRT version
SET(WINSDK_UCRT_INCLUDE_ROOT_DIR ${WINSDK_UCRT_DIR}/Include)
SET(WINSDK_UCRT_LIB_ROOT_DIR ${WINSDK_UCRT_DIR}/Lib)
MESSAGE(STATUS "Found ComCtl32.lib in ${WINSDK_LIBRARY_DIR}")
FILE(GLOB UCRT_SUBDIRS RELATIVE ${WINSDK_UCRT_INCLUDE_ROOT_DIR} ${WINSDK_UCRT_INCLUDE_ROOT_DIR}/*)
SET(UCRT_VERSION)
FOREACH(UCRT_SUBDIR ${UCRT_SUBDIRS})
IF(NOT UCRT_VERSION OR UCRT_SUBDIR VERSION_GREATER UCRT_VERSION)
SET(UCRT_VERSION ${UCRT_SUBDIR})
ENDIF()
ENDFOREACH()
IF(UCRT_VERSION)
MESSAGE(STATUS "Using Windows UCRT ${UCRT_VERSION}")
# directory where UCRT headers are found
FIND_PATH(WINSDK_UCRT_INCLUDE_DIR corecrt.h
HINTS
${WINSDK_UCRT_INCLUDE_ROOT_DIR}/${UCRT_VERSION}/ucrt
SET(WINSDK_BINARY_DIRS
${WINSDK_DIR}/Bin/${UCRT_VERSION}/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Bin/x86
${WINSDK_DIR}/Bin
)
# directory where UCRT libraries are found
FIND_PATH(WINSDK_UCRT_LIBRARY_DIR ucrt.lib
HINTS
${WINSDK_UCRT_LIB_ROOT_DIR}/${UCRT_VERSION}/ucrt/${WINSDK8_SUFFIX}
)
ENDIF()
ENDIF()
# signtool is used to sign executables
FIND_PROGRAM(WINSDK_SIGNTOOL signtool
HINTS
${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Bin/x86
${WINSDK_DIR}/Bin
${WINSDK_BINARY_DIRS}
NO_DEFAULT_PATH
)
# midl is used to generate IDL interfaces
FIND_PROGRAM(WINSDK_MIDL midl
HINTS
${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Bin/x86
${WINSDK_DIR}/Bin
${WINSDK_BINARY_DIRS}
NO_DEFAULT_PATH
)
IF(WINSDK_INCLUDE_DIR)
@ -444,7 +476,7 @@ IF(WINSDK_INCLUDE_DIR)
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_WINRT_INCLUDE_DIR})
ENDIF()
INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS}) # TODO: Move this after all other includes somehow...
INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS})
IF(WINSDK_UCRT_LIBRARY_DIR)
SET(CMAKE_LIBRARY_PATH ${WINSDK_UCRT_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})

View file

@ -0,0 +1,115 @@
# Define OSX_SDK to force a specific version such as : -DOSX_SDK=10.11
#
# Example:
# cmake ../code -DCMAKE_TOOLCHAIN_FILE=../code/CMakeModules/OSXToolChain.cmake -DWITH_NEL_TESTS=OFF -DWITH_RYZOM_SERVER=OFF -DWITH_NEL_TOOLS=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_LUA51=OFF -DWITH_LUA53=ON -DCMAKE_BUILD_TYPE=Release -DWITH_RYZOM_INSTALLER=OFF -DWITH_RYZOM_PATCH=ON -DWITH_NEL_TESTS=OFF -DWITH_NEL_TOOLS=OFF -DWITH_TOOLS=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_WARNINGS=OFF -DWITH_QT5=OFF -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_STATIC_EXTERNAL=ON -DWITH_UNIX_STRUCTURE=OFF -DWITH_INSTALL_LIBRARIES=OFF -DWITH_RYZOM_SANDBOX=OFF -DOSX_SDK=10.11
# Don't forget to define environment variables:
#
# export MACOSX_DEPLOYMENT_TARGET=10.7
# export OSXCROSS_GCC_NO_STATIC_RUNTIME=1
# export PATH=$PATH:/home/src/osxcross/target/bin
#
# ln -s /usr/bin/hg /home/src/osxcross/target/bin/hg
#
# To install all dependencies:
# ./osxcross-macports install libxml2 jpeg curl libogg libvorbis freetype boost openssl zlib lua-5.3 giflib
# to compile Luabind
# export CMAKE_MODULE_PATH=$HOME/shard/tools/external/cmake/modules
# cmake .. -DCMAKE_TOOLCHAIN_FILE=$HOME/ryzomcore/code/CMakeModules/OSXToolChain.cmake -DWITH_SHARED=OFF -DWITH_STATIC=ON -DWITH_LUA51=OFF -DWITH_LUA53=ON -DCMAKE_INSTALL_PREFIX=$HOME/osxcross/target/external
IF(DEFINED CMAKE_CROSSCOMPILING)
# subsequent toolchain loading is not really needed
RETURN()
ENDIF()
# Force the compilers to Clang for OS X
SET(CMAKE_C_COMPILER x86_64-apple-darwin15-clang)
SET(CMAKE_CXX_COMPILER x86_64-apple-darwin15-clang++)
set(CMAKE_CXX_COMPILER_ID "AppleClang")
# Skip the platform compiler checks for cross compiling.
SET(CMAKE_CXX_COMPILER_FORCED TRUE)
SET(CMAKE_C_COMPILER_FORCED TRUE)
# Check if osxcross is installed
EXECUTE_PROCESS(COMMAND which ${CMAKE_CXX_COMPILER} OUTPUT_VARIABLE COMPILER_FULLPATH OUTPUT_STRIP_TRAILING_WHITESPACE)
IF(NOT COMPILER_FULLPATH)
MESSAGE(FATAL_ERROR "Unable to find ${CMAKE_CXX_COMPILER}, are you sure osxcross is installed and is in PATH?")
ENDIF()
# Default paths
GET_FILENAME_COMPONENT(CMAKE_OSX_TOOLCHAIN_ROOT ${COMPILER_FULLPATH} DIRECTORY)
# Parent directory
GET_FILENAME_COMPONENT(CMAKE_OSX_TOOLCHAIN_ROOT ${CMAKE_OSX_TOOLCHAIN_ROOT} DIRECTORY)
SET(CMAKE_OSX_SYSROOT ${CMAKE_OSX_TOOLCHAIN_ROOT}/SDK)
SET(MACPORTS_ROOT_DIR ${CMAKE_OSX_TOOLCHAIN_ROOT}/macports/pkgs/opt/local)
SET(EXTERNAL_OSX_PATH ${CMAKE_OSX_TOOLCHAIN_ROOT}/external)
# List of all SDKs that have been found
SET(OSX_SDKS)
FILE(GLOB _CMAKE_OSX_SDKS "${CMAKE_OSX_SYSROOT}/MacOSX*")
IF(_CMAKE_OSX_SDKS)
LIST(SORT _CMAKE_OSX_SDKS)
LIST(REVERSE _CMAKE_OSX_SDKS)
FOREACH(_CMAKE_OSX_SDK ${_CMAKE_OSX_SDKS})
STRING(REGEX REPLACE ".+MacOSX([0-9.]+)\\.sdk" "\\1" _OSX_SDK "${_CMAKE_OSX_SDK}")
LIST(APPEND OSX_SDKS ${_OSX_SDK})
ENDFOREACH()
ENDIF()
# Find and use the most recent OS X sdk
IF(NOT OSX_SDKS)
MESSAGE(FATAL_ERROR "No OS X SDK's found in default search path ${CMAKE_OSX_SYSROOT}.")
ENDIF()
# if a specific SDK is defined, try to use it
IF(OSX_SDK)
LIST(FIND OSX_SDKS "${OSX_SDK}" _INDEX)
IF(_INDEX EQUAL -1)
# if specified SDK doesn't exist, use the last one
LIST(GET OSX_SDKS 0 OSX_SDK)
ENDIF()
ELSE()
# use the last SDK
LIST(GET OSX_SDKS 0 OSX_SDK)
ENDIF()
MESSAGE(STATUS "Using OS X SDK ${OSX_SDK}")
# Define final OS X sysroot
SET(CMAKE_OSX_SYSROOT ${CMAKE_OSX_SYSROOT}/MacOSX${OSX_SDK}.sdk)
# Standard settings
SET(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM "Darwin-15.0.0")
set(CMAKE_SYSTEM_VERSION "15.0.0")
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
SET(UNIX ON)
SET(APPLE ON)
# Set the find root to the OS X developer roots and to user defined paths
SET(CMAKE_FIND_ROOT_PATH ${CMAKE_OSX_TOOLCHAIN_ROOT} ${CMAKE_OSX_SYSROOT} ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} ${MACPORTS_ROOT_DIR} ${EXTERNAL_OSX_PATH} $ENV{EXTERNAL_OSX_PATH} CACHE STRING "OS X find search path root")
# default to searching for frameworks first
SET(CMAKE_FIND_FRAMEWORK FIRST)
# set up the default search directories for frameworks
SET(CMAKE_SYSTEM_FRAMEWORK_PATH
${CMAKE_OSX_SYSROOT}/System/Library/Frameworks
${CMAKE_OSX_SYSROOT}/System/Library/PrivateFrameworks
${CMAKE_OSX_SYSROOT}/Developer/Library/Frameworks
)
# only search the OS X sdks, not the remainder of the host filesystem
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# determinate location for bin utils based on CMAKE_FIND_ROOT_PATH
INCLUDE(CMakeFindBinUtils)

View file

@ -114,12 +114,16 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS)
IF(oldProps)
LIST(APPEND _FLAGS ${oldProps})
SET(_FLAG ${oldProps})
SEPARATE_ARGUMENTS(_FLAG)
LIST(APPEND _FLAGS ${_FLAG})
ENDIF()
GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD})
IF(oldPropsBuild)
LIST(APPEND _FLAGS ${oldPropsBuild})
SET(_FLAG ${oldPropsBuild})
SEPARATE_ARGUMENTS(_FLAG)
LIST(APPEND _FLAGS ${_FLAG})
ENDIF()
GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES)
@ -205,6 +209,10 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
ENDIF()
ENDIF()
IF(USE_CPP0X AND gcc_compiler_version GREATER "6.2.0")
LIST(APPEND _FLAGS "-std=gnu++11")
ENDIF()
# Format definitions
IF(MSVC)
# Fix path with space
@ -316,7 +324,7 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS)
SET(_FLAGS "")
IF(APPLE)
SET(HEADER_FORMAT "objective-${HEADER_FORMAT}")
SET(_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch)
SET(_FLAGS ${OBJC_FLAGS})
ENDIF()
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} ${_FLAGS} -x ${HEADER_FORMAT} -o ${PCH_OUTPUT} -c ${PCH_INPUT})
ENDIF()
@ -402,7 +410,8 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
ENDIF()
IF(APPLE)
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-fobjc-abi-version=2 -fobjc-legacy-dispatch -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}")
STRING(REPLACE ";" " " OBJC_FLAGS_STR "${OBJC_FLAGS}")
SET(PCH_ADDITIONAL_COMPILER_FLAGS "${OBJC_FLAGS_STR} -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}")
ENDIF()
IF(WITH_PCH_DEBUG)

View file

@ -35,23 +35,6 @@ SET(UNIX ON)
SET(APPLE ON)
SET(IOS ON)
# Force the compilers to Clang for iOS
include (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER (clang Clang)
CMAKE_FORCE_CXX_COMPILER (clang++ Clang)
IF(CMAKE_CXX_COMPILER)
EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} --version
OUTPUT_VARIABLE CLANG_VERSION_RAW
OUTPUT_STRIP_TRAILING_WHITESPACE)
STRING(REGEX REPLACE "Apple LLVM version ([\\.0-9]+).*"
"\\1" CMAKE_CXX_COMPILER_VERSION "${CLANG_VERSION_RAW}")
SET(CMAKE_C_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION})
SET(CMAKE_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION})
ENDIF()
# Setup iOS platform
IF(NOT DEFINED IOS_PLATFORM)
SET(IOS_PLATFORM "OS")
@ -162,14 +145,14 @@ IF(CMAKE_GENERATOR MATCHES Xcode)
ENDIF()
ELSE()
IF(${IOS_PLATFORM} STREQUAL "OS")
SET(ARCHS "armv7;arm64")
SET(ARCHS armv7 arm64)
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
# iPhone simulator targets i386
SET(ARCHS "i386")
SET(CMAKE_SYSTEM_PROCESSOR "x86")
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
SET(ARCHS "armv7;arm64;i386;x86_64")
SET(ARCHS armv7 arm64 i386 x86_64)
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ENDIF()
ENDIF()
@ -198,5 +181,13 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# Force the compilers to Clang for iOS
SET(CMAKE_C_COMPILER clang)
SET(CMAKE_CXX_COMPILER clang++)
# Skip the platform compiler checks for cross compiling.
SET(CMAKE_CXX_COMPILER_FORCED TRUE)
SET(CMAKE_C_COMPILER_FORCED TRUE)
# determinate location for bin utils based on CMAKE_FIND_ROOT_PATH
include(CMakeFindBinUtils)
INCLUDE(CMakeFindBinUtils)

View file

@ -565,11 +565,18 @@ MACRO(NL_SETUP_BUILD)
ADD_PLATFORM_FLAGS("/X")
IF(MSVC14)
ADD_PLATFORM_FLAGS("/Gy- /MP")
# /Ox is working with VC++ 2015, but custom optimizations don't exist
ADD_PLATFORM_FLAGS("/Gy-")
# /Ox is working with VC++ 2015 and 2017, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
# Special cases for VC++ 2017
IF(MSVC_VERSION EQUAL "1911")
SET(MSVC1411 ON)
ELSEIF(MSVC_VERSION EQUAL "1910")
SET(MSVC1410 ON)
ENDIF()
ELSEIF(MSVC12)
ADD_PLATFORM_FLAGS("/Gy-")
# /Ox is working with VC++ 2013, but custom optimizations don't exist
@ -657,6 +664,8 @@ MACRO(NL_SETUP_BUILD)
ENDIF()
IF(APPLE)
SET(OBJC_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch -fobjc-weak)
IF(NOT XCODE)
IF(CMAKE_OSX_ARCHITECTURES)
SET(TARGETS_COUNT 0)
@ -1160,6 +1169,7 @@ MACRO(SETUP_EXTERNAL)
IF(APPLE)
IF(WITH_STATIC_EXTERNAL)
# Look only for static libraries because systems libraries are using Frameworks
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a)
ELSE()
SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so .a)
@ -1173,12 +1183,13 @@ MACRO(SETUP_EXTERNAL)
ENDIF()
ENDIF()
# Android and iOS have pthread
IF(ANDROID OR IOS)
# Android, iOS and Mac OS X have pthread, but no need to link to libpthread
IF(ANDROID OR APPLE)
SET(CMAKE_USE_PTHREADS_INIT 1)
SET(Threads_FOUND TRUE)
ELSE()
FIND_PACKAGE(Threads REQUIRED)
SET(THREADS_HAVE_PTHREAD_ARG ON)
FIND_PACKAGE(Threads)
# TODO: replace all -l<lib> by absolute path to <lib> in CMAKE_THREAD_LIBS_INIT
ENDIF()

View file

@ -0,0 +1,35 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CL_CURL_CERTIFICATES_HTML_H
#define CL_CURL_CERTIFICATES_HTML_H
#include <curl/curl.h>
#include "nel/misc/types_nl.h"
namespace NLGUI
{
#if defined(NL_OS_WINDOWS)
class CCurlCertificates {
public:
// cURL SSL certificate loading
static CURLcode sslCtxFunction(CURL *curl, void *sslctx, void *parm);
};
#endif // NL_OS_WINDOWS
} // namespace
#endif

View file

@ -264,6 +264,7 @@ namespace NLGUI
// because of multiline, thz parent container will be moved to top
// The good position can be restored by a press on enter then
bool _WantReturn : 1; // Want return char, don't call the enter action handler
bool _ClearOnEscape : 1; // clear content when ESC is pressed?
bool _Savable : 1; // should content be saved ?
bool _DefaultInputString : 1; // Is the current input string the default one (should not be edited)
bool _Frozen : 1; // is the control frozen? (cannot edit in it)

View file

@ -84,6 +84,7 @@ namespace NLGUI
FontOblique=false;
Underlined=false;
StrikeThrough=false;
GlobalColor=false;
Width=-1;
Height=-1;
MaxWidth=-1;
@ -94,6 +95,7 @@ namespace NLGUI
bool FontOblique;
std::string FontFamily;
NLMISC::CRGBA TextColor;
bool GlobalColor;
bool Underlined;
bool StrikeThrough;
sint32 Width;
@ -339,7 +341,7 @@ namespace NLGUI
void addString(const ucstring &str);
// Add an image in the current paragraph
void addImage(const char *image, bool globalColor, bool reloadImg=false, const CStyleParams &style = CStyleParams());
void addImage(const char *image, bool reloadImg=false, const CStyleParams &style = CStyleParams());
// Add a text area in the current paragraph
CInterfaceGroup *addTextArea (const std::string &templateName, const char *name, uint rows, uint cols, bool multiLine, const ucstring &content, uint maxlength);
@ -350,7 +352,7 @@ namespace NLGUI
// Add a button in the current paragraph. actionHandler, actionHandlerParams and tooltip can be NULL.
CCtrlButton *addButton(CCtrlButton::EType type, const std::string &name, const std::string &normalBitmap, const std::string &pushedBitmap,
const std::string &overBitmap, bool useGlobalColor, const char *actionHandler, const char *actionHandlerParams, const char *tooltip,
const std::string &overBitmap, const char *actionHandler, const char *actionHandlerParams, const char *tooltip,
const CStyleParams &style = CStyleParams());
// Set the background color
@ -712,7 +714,12 @@ namespace NLGUI
std::vector<CCellParams> _CellParams;
// Indentation
uint _Indent;
std::vector<uint> _Indent;
inline uint getIndent() const {
if (_Indent.empty())
return 0;
return _Indent.back();
}
// Current node is a title
bool _Title;
@ -791,7 +798,7 @@ namespace NLGUI
void doBrowseLocalFile(const std::string &filename);
// load remote content using either GET or POST
void doBrowseRemoteUrl(const std::string &url, const std::string &referer, bool doPost = false, const SFormFields &formfields = SFormFields());
void doBrowseRemoteUrl(std::string url, const std::string &referer, bool doPost = false, const SFormFields &formfields = SFormFields());
// render html string as new browser page
bool renderHtmlString(const std::string &html);
@ -805,33 +812,37 @@ namespace NLGUI
// ImageDownload system
enum TDataType {ImgType= 0, BnpType};
enum TImageType {NormalImage=0, OverImage};
struct CDataImageDownload
{
public:
CDataImageDownload(CViewBase *img, CStyleParams style): Image(img), Style(style)
CDataImageDownload(CViewBase *img, CStyleParams style, TImageType type): Image(img), Style(style), Type(type)
{
}
public:
CViewBase * Image;
CStyleParams Style;
TImageType Type;
};
struct CDataDownload
{
public:
CDataDownload(CURL *c, const std::string &u, const std::string &d, FILE *f, TDataType t, CViewBase *i, const std::string &s, const std::string &m, const CStyleParams &style = CStyleParams()) : curl(c), url(u), dest(d), luaScript(s), md5sum(m), type(t), fp(f)
CDataDownload(const std::string &u, const std::string &d, TDataType t, CViewBase *i, const std::string &s, const std::string &m, const CStyleParams &style = CStyleParams(), const TImageType imagetype = NormalImage)
: data(NULL), fp(NULL), url(u), dest(d), type(t), luaScript(s), md5sum(m), redirects(0)
{
if (t == ImgType) imgs.push_back(CDataImageDownload(i, style));
if (t == ImgType) imgs.push_back(CDataImageDownload(i, style, imagetype));
}
public:
CURL *curl;
CCurlWWWData *data;
std::string url;
std::string dest;
std::string luaScript;
std::string md5sum;
TDataType type;
uint32 redirects;
FILE *fp;
std::vector<CDataImageDownload> imgs;
};
@ -840,20 +851,22 @@ namespace NLGUI
CURLM *MultiCurl;
int RunningCurls;
bool startCurlDownload(CDataDownload &download);
void initImageDownload();
void checkImageDownload();
void addImageDownload(const std::string &url, CViewBase *img, const CStyleParams &style = CStyleParams());
void addImageDownload(const std::string &url, CViewBase *img, const CStyleParams &style = CStyleParams(), const TImageType type = NormalImage);
std::string localImageName(const std::string &url);
std::string getAbsoluteUrl(const std::string &url);
bool isTrustedDomain(const std::string &domain);
void setImage(CViewBase *view, const std::string &file);
void setImage(CViewBase *view, const std::string &file, const TImageType type);
void setImageSize(CViewBase *view, const CStyleParams &style = CStyleParams());
// BnpDownload system
void initBnpDownload();
void checkBnpDownload();
bool addBnpDownload(const std::string &url, const std::string &action, const std::string &script, const std::string &md5sum);
bool addBnpDownload(std::string url, const std::string &action, const std::string &script, const std::string &md5sum);
std::string localBnpName(const std::string &url);
void releaseDownloads();

View file

@ -97,6 +97,7 @@ namespace NLGUI
void addChildSortedByBitmap(SNode *pNode);
void setParentTree(CGroupTree *parent);
void setFather(SNode *father);
void openAll();
void closeAll();
void makeOrphan();
bool parse (xmlNodePtr cur, CGroupTree *parentGroup);

View file

@ -0,0 +1,77 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CL_HTTP_CACHE_H
#define CL_HTTP_CACHE_H
#include "nel/misc/types_nl.h"
namespace NLGUI
{
struct CHttpCacheObject
{
CHttpCacheObject(uint32 expires = 0, const std::string& lastModified = "", const std::string& etag = "")
: Expires(expires)
, LastModified(lastModified)
, Etag(etag){};
uint32 Expires;
std::string LastModified;
std::string Etag;
void serial(NLMISC::IStream& f);
};
/**
* Keeping track of downloaded files cache related headers
* \author Meelis Mägi (nimetu)
* \date 2017
*/
class CHttpCache
{
typedef std::map<std::string, CHttpCacheObject> THttpCacheMap;
public:
static CHttpCache* getInstance();
static void release();
public:
void setCacheIndex(const std::string& fname);
void init();
CHttpCacheObject lookup(const std::string& fname);
void store(const std::string& fname, const CHttpCacheObject& data);
void flushCache();
void serial(NLMISC::IStream& f);
private:
CHttpCache();
~CHttpCache();
void pruneCache();
static CHttpCache* instance;
THttpCacheMap _List;
std::string _IndexFilename;
bool _Initialized;
size_t _MaxObjects;
};
}
#endif

View file

@ -0,0 +1,73 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CL_HTTP_HSTS_H
#define CL_HTTP_HSTS_H
#include "nel/misc/types_nl.h"
namespace NLGUI
{
// ********************************************************************************
struct SHSTSObject
{
public:
SHSTSObject(uint64 expires = 0, bool includeSubDomains = false)
: Expires(expires)
, IncludeSubDomains(includeSubDomains)
{ }
uint64 Expires;
bool IncludeSubDomains;
};
/**
* Keeping track of HSTS header
* \author Meelis Mägi (nimetu)
* \date 2017
*/
class CStrictTransportSecurity
{
public:
typedef std::map<std::string, SHSTSObject> THSTSObject;
static CStrictTransportSecurity* getInstance();
static void release();
public:
bool isSecureHost(const std::string &domain) const;
// ************************************************************************
void init(const std::string& fname);
void save();
void erase(const std::string &domain);
void set(const std::string &domain, uint64 expires, bool includeSubDomains);
bool get(const std::string &domain, SHSTSObject &hsts) const;
void setFromHeader(const std::string &domain, const std::string &header);
void serial(NLMISC::IStream& f);
private:
static CStrictTransportSecurity* instance;
~CStrictTransportSecurity();
std::string _Filename;
THSTSObject _Domains;
};
}
#endif

View file

@ -94,6 +94,7 @@ namespace NLGUI
_XReal = _YReal = _WReal = _HReal = 0;
_X = _Y = _W = _H = 0;
//_Snap = 1;
_MarginLeft = 0;
_PosRef = Hotspot_BL;
_ParentPosRef = Hotspot_BL;
@ -178,6 +179,9 @@ namespace NLGUI
sint32 getH() const { return (_Active?_H:0); }
sint32 getH(bool bTestActive) const { return (bTestActive?(_Active?_H:0):_H); }
void setMarginLeft(sint32 m) { _MarginLeft = m; }
sint32 getMarginLeft() const { return _MarginLeft; }
/**
* Get the max width used by the window.
*
@ -568,6 +572,8 @@ namespace NLGUI
sint32 _W;
sint32 _H;
sint32 _MarginLeft;
//sint32 _Snap;
// position references e.g. : _PosRef=BL, _ParentPosref=MM : the bottom left corner of the element

View file

@ -149,6 +149,8 @@ namespace NLGUI
HTML_ATTR(IMG,USEMAP),
HTML_ATTR(IMG,VSPACE),
HTML_ATTR(IMG,WIDTH),
// not sorted to keep enum values
HTML_ATTR(IMG,DATA_OVER_SRC),
};
enum

View file

@ -93,7 +93,7 @@ namespace NLGUI
void setMultiLineSpace (sint nMultiLineSpace);
void setMultiLineMaxWOnly (bool state);
void setMultiLineClipEndSpace (bool state); // use it for multiline edit box for instance
void setFirstLineX (uint firstLineX);
void setFirstLineX (sint firstLineX);
void setMultiMaxLine(uint l) { _MultiMaxLine = l; }
void setMultiMinLine(uint l) { _MultiMinLine = l; }
@ -398,7 +398,7 @@ namespace NLGUI
uint _TextSelectionEnd;
// First line X coordinate
uint _FirstLineX;
sint _FirstLineX;
/// Dynamic tooltips
std::vector<CCtrlToolTip*> _Tooltips;

View file

@ -110,6 +110,11 @@ public:
*/
bool init (IStream &stream);
/** Return the error string.
* if not empty, something wrong appends
*/
static std::string getErrorString();
/** Release the resources used by the stream.
*/
void release ();
@ -172,7 +177,12 @@ public:
static bool getContentString (std::string &result, xmlNodePtr node);
/**
* Release meory used by libxml2, to only call before exit.
* Init all structures used by libxml2, to only call once.
*/
static void initLibXml();
/**
* Release memory used by libxml2, to only call before exit.
*/
static void releaseLibXml();
@ -234,13 +244,16 @@ private:
uint _ContentStringIndex;
// Error message
std::string _ErrorString;
static std::string _ErrorString;
// Try binary mode
bool _TryBinaryMode;
// If not NULL, binary mode detected, use this stream in serials
IStream *_BinaryStream;
// LibXml has been initialized
static bool _LibXmlIntialized;
};

View file

@ -80,7 +80,6 @@ class COXml : public IStream
{
friend int xmlOutputWriteCallbackForNeL ( void *context, const char *buffer, int len );
friend int xmlOutputCloseCallbackForNeL ( void *context );
friend void xmlGenericErrorFuncWrite (void *ctx, const char *msg, ...);
public:
/** Stream ctor
@ -100,7 +99,7 @@ public:
/** Return the error string.
* if not empty, something wrong appends
*/
const char *getErrorString () const;
static std::string getErrorString ();
/** Default dstor
*
@ -178,9 +177,6 @@ private:
// Current content string
std::string _ContentString;
// Error message
std::string _ErrorString;
};

View file

@ -166,6 +166,10 @@
# define NL_ISO_CPP0X_AVAILABLE
#endif
#if defined(NL_COMP_GCC) && (__cplusplus >= 201103L)
# define NL_NO_EXCEPTION_SPECS
#endif
// gcc 3.4 introduced ISO C++ with tough template rules
//
// NL_ISO_SYNTAX can be used using #if NL_ISO_SYNTAX or #if !NL_ISO_SYNTAX
@ -407,12 +411,21 @@ typedef unsigned int uint; // at least 32bits (depend of processor)
#ifndef NL_CPU_X86_64
// on x86_64, new and delete are already aligned on 16 bytes
#ifdef NL_NO_EXCEPTION_SPECS
extern void *operator new(size_t size);
extern void *operator new[](size_t size);
extern void operator delete(void *p) noexcept;
extern void operator delete[](void *p) noexcept;
#else
extern void *operator new(size_t size) throw(std::bad_alloc);
extern void *operator new[](size_t size) throw(std::bad_alloc);
extern void operator delete(void *p) throw();
extern void operator delete[](void *p) throw();
#endif
#endif
#else /* NL_HAS_SSE2 */
#define NL_DEFAULT_MEMORY_ALIGNMENT 4

View file

@ -32,6 +32,10 @@
#include "driver_direct3d.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -480,12 +480,21 @@ public:
virtual ~CStateRecord() {}
// use STL allocator for fast alloc. this works because objects are small ( < 128 bytes)
void *operator new(size_t size) { return CStateRecord::Allocator.allocate(size); }
void *operator new(size_t size, int /* blockUse */, char const * /* fileName */, int /* lineNumber */)
{
// TODO: add memory leaks detector
return CStateRecord::Allocator.allocate(size);
}
void operator delete(void *block) { CStateRecord::Allocator.deallocate((uint8 *) block, 1); }
void operator delete(void *block, int /* blockUse */, char const* /* fileName */, int /* lineNumber */)
{
// TODO: add memory leaks detector
CStateRecord::Allocator.deallocate((uint8 *)block, 1);
}
static std::allocator<uint8> Allocator;
};
// record of a single .fx pass
class CFXPassRecord
{

View file

@ -25,6 +25,10 @@
#include "driver_direct3d.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -17,6 +17,10 @@
#include "stddirect3d.h"
#include "driver_direct3d.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -26,6 +26,10 @@
#include "driver_direct3d.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -27,6 +27,10 @@
#include "driver_direct3d.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -26,6 +26,10 @@
#include "driver_direct3d.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -29,6 +29,10 @@
#include "driver_direct3d.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -19,6 +19,10 @@
#include "driver_direct3d.h"
#include "nel/misc/hierarchical_timer.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -27,6 +27,10 @@
#include "driver_direct3d.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -20,6 +20,10 @@
#include "nel/misc/path.h"
#include "nel/misc/file.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -26,6 +26,10 @@
#include "driver_direct3d.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -18,6 +18,10 @@
#include "driver_direct3d.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -26,6 +26,10 @@
#include "driver_direct3d.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -18,6 +18,10 @@
#include "driver_direct3d.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -30,6 +30,14 @@ ELSE()
SET(NLDRV_OGL_LIB "nel_drv_opengl")
ENDIF()
# This helps to debug issue 310
IF(DEBUG_OGL_SPECULAR_FALLBACK)
ADD_DEFINITIONS(-DDEBUG_OGL_SPECULAR_FALLBACK)
ENDIF()
IF(DEBUG_OGL_COMBINE43_DISABLE)
ADD_DEFINITIONS(-DDEBUG_OGL_COMBINE43_DISABLE)
ENDIF()
NL_TARGET_DRIVER(${NLDRV_OGL_LIB} ${SRC})
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})

View file

@ -786,7 +786,13 @@ static bool setupNVTextureEnvCombine4(const char *glext)
{
H_AUTO_OGL(setupNVTextureEnvCombine4);
CHECK_EXT("GL_NV_texture_env_combine4");
#ifdef DEBUG_OGL_COMBINE43_DISABLE
// issue 310: disable extension to debug bug around CDriverGL::setupSpecularPass()
nlwarning("GL_NV_texture_env_combine4 disabled by request (DEBUG_OGL_COMBINE43_DISABLE)");
return false;
#else
return true;
#endif
}
// *********************************
@ -802,7 +808,13 @@ static bool setupATITextureEnvCombine3(const char *glext)
// #endif
CHECK_EXT("GL_ATI_texture_env_combine3");
#ifdef DEBUG_OGL_COMBINE43_DISABLE
// issue 310: disable extension to debug bug around CDriverGL::setupSpecularPass()
nlwarning("GL_ATI_texture_env_combine3 disabled by request (DEBUG_OGL_COMBINE43_DISABLE)");
return false;
#else
return true;
#endif
}
// *********************************

View file

@ -1425,6 +1425,11 @@ void CDriverGL::setupSpecularPass(uint pass)
}
else
{
// Disabled because of Intel GPU texture bug (issue 310)
// CMake options to debug
// -DDEBUG_OGL_SPECULAR_FALLBACK=ON enables this
// -DDEBUG_OGL_COMBINE43_DISABLE=ON disables GL_NV_texture_env_combine4/GL_ATI_texture_env_combine3
#ifdef DEBUG_OGL_SPECULAR_FALLBACK
// Multiply texture1 by alpha_texture0 and display with add
_DriverGLStates.enableBlend(true);
_DriverGLStates.blendFunc(GL_ONE, GL_ONE);
@ -1457,6 +1462,7 @@ void CDriverGL::setupSpecularPass(uint pass)
}
activateTexEnvMode(1, env);
#endif // DEBUG_OGL_SPECULAR_FALLBACK
}
}
}

View file

@ -226,7 +226,8 @@ void CMeshVPWindTree::initVertexPrograms()
{
// setup of the VPLight fragment
uint numPls= i/4;
bool normalize= (i&1)!=0;
// FIXME: normalize=true makes trees dance, workaround for issue #160
bool normalize= false; //(i&1)!=0;
bool specular= (i&2)!=0;
// combine

View file

@ -24,6 +24,10 @@
#include "nel/georges/form.h"
#include "nel/georges/form_loader.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace NLMISC;
namespace NLGEORGES

View file

@ -24,6 +24,10 @@
#include "nel/georges/form_loader.h"
#include "nel/georges/form_elm.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace NLMISC;
using namespace std;

View file

@ -25,6 +25,10 @@
#include "nel/georges/form_loader.h"
#include "nel/georges/type.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace NLMISC;
using namespace std;

View file

@ -27,6 +27,10 @@
#include "nel/georges/form.h"
#include "nel/georges/form_dfn.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace NLMISC;
using namespace std;

View file

@ -22,6 +22,10 @@
#include "nel/georges/header.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace NLMISC;
namespace NLGEORGES

View file

@ -14,6 +14,16 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef STDGEORGES_H
#define STDGEORGES_H
#if defined(_MSC_VER) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#endif
#include "nel/misc/types_nl.h"
#include <cmath>
#include <list>
@ -27,3 +37,5 @@
// Include from libxml2
#include <libxml/parser.h>
#endif

View file

@ -27,6 +27,10 @@
#include "nel/georges/form_loader.h"
#include "nel/georges/type.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace NLMISC;
using namespace std;

View file

@ -0,0 +1,123 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//#include <crtdbg.h>
#include "stdpch.h"
#include "nel/gui/curl_certificates.h"
#include <openssl/x509.h>
#include <openssl/ssl.h>
#if defined(NL_OS_WINDOWS)
#pragma comment(lib, "crypt32.lib")
#pragma comment(lib, "cryptui.lib")
#endif
using namespace std;
using namespace NLMISC;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NLGUI
{
#if defined(NL_OS_WINDOWS)
static std::vector<X509 *> x509CertList;
//
// x509CertList lifetime manager
//
class SX509Certificates {
public:
SX509Certificates()
{
curl_version_info_data *data;
data = curl_version_info(CURLVERSION_NOW);
if (!(data && data->features & CURL_VERSION_SSPI))
{
addCertificatesFrom("CA");
addCertificatesFrom("AuthRoot");
addCertificatesFrom("ROOT");
}
}
~SX509Certificates()
{
for (uint i = 0; i < x509CertList.size(); ++i)
{
X509_free(x509CertList[i]);
}
x509CertList.clear();
}
void addCertificatesFrom(LPCSTR root)
{
HCERTSTORE hStore;
PCCERT_CONTEXT pContext = NULL;
X509 *x509;
hStore = CertOpenSystemStore(NULL, root);
if (hStore)
{
while (pContext = CertEnumCertificatesInStore(hStore, pContext))
{
x509 = NULL;
x509 = d2i_X509(NULL, (const unsigned char **)&pContext->pbCertEncoded, pContext->cbCertEncoded);
if (x509)
{
x509CertList.push_back(x509);
}
}
CertFreeCertificateContext(pContext);
CertCloseStore(hStore, 0);
}
// this is called before debug context is set and log ends up in log.log
//nlinfo("Loaded %d certificates from '%s' certificate store", List.size(), root);
}
};
/// this will be initialized on startup and cleared on exit
static SX509Certificates x509CertListManager;
// ***************************************************************************
// static
CURLcode CCurlCertificates::sslCtxFunction(CURL *curl, void *sslctx, void *parm)
{
if (x509CertList.size() > 0)
{
SSL_CTX *ctx = (SSL_CTX*)sslctx;
X509_STORE *x509store = SSL_CTX_get_cert_store(ctx);
if (x509store)
{
for (uint i = 0; i < x509CertList.size(); ++i)
{
X509_STORE_add_cert(x509store, x509CertList[i]);
}
}
else
{
nlwarning("SSL_CTX_get_cert_store returned NULL");
}
}
return CURLE_OK;
}
#endif // NL_OS_WINDOWS
}// namespace

View file

@ -77,6 +77,7 @@ namespace NLGUI
_ResetFocusOnHide(false),
_BackupFatherContainerPos(false),
_WantReturn(false),
_ClearOnEscape(false),
_Savable(true),
_DefaultInputString(false),
_Frozen(false),
@ -239,6 +240,11 @@ namespace NLGUI
return toString( _WantReturn );
}
else
if( name == "clear_on_escape" )
{
return toString( _ClearOnEscape );
}
else
if( name == "savable" )
{
return toString( _Savable );
@ -413,6 +419,14 @@ namespace NLGUI
return;
}
else
if( name == "clear_on_escape" )
{
bool b;
if( fromString( value, b ) )
_ClearOnEscape = b;
return;
}
else
if( name == "savable" )
{
bool b;
@ -514,6 +528,7 @@ namespace NLGUI
xmlSetProp( node, BAD_CAST "backup_father_container_pos",
BAD_CAST toString( _BackupFatherContainerPos ).c_str() );
xmlSetProp( node, BAD_CAST "want_return", BAD_CAST toString( _WantReturn ).c_str() );
xmlSetProp( node, BAD_CAST "clear_on_escape", BAD_CAST toString( _ClearOnEscape ).c_str() );
xmlSetProp( node, BAD_CAST "savable", BAD_CAST toString( _Savable ).c_str() );
xmlSetProp( node, BAD_CAST "max_float_prec", BAD_CAST toString( _MaxFloatPrec ).c_str() );
@ -620,6 +635,9 @@ namespace NLGUI
prop = (char*) xmlGetProp( cur, (xmlChar*)"want_return" );
if (prop) _WantReturn = convertBool(prop);
prop = (char*) xmlGetProp( cur, (xmlChar*)"clear_on_escape" );
if (prop) _ClearOnEscape = convertBool(prop);
prop = (char*) xmlGetProp( cur, (xmlChar*)"savable" );
if (prop) _Savable = convertBool(prop);
@ -991,6 +1009,11 @@ namespace NLGUI
// stop selection
_CurrSelection = NULL;
_CursorAtPreviousLineEnd = false;
if (_ClearOnEscape)
{
setInputString(ucstring(""));
triggerOnChangeAH();
}
break;
case KeyTAB:
makeTopWindow();

File diff suppressed because it is too large Load diff

View file

@ -1209,6 +1209,13 @@ namespace NLGUI
// ----------------------------------------------------------------------------
sint32 CGroupTable::getMaxUsedW() const
{
// Return table width if its requested by user.
// Need to do this because width of long line of text in here is calculated
// differently than final cell width in updateCoords()
// This will break tables with too narrow width set by user.
if (ForceWidthMin > 0)
return ForceWidthMin;
uint i;
uint column = 0;
vector<sint32> columns;

View file

@ -271,6 +271,14 @@ namespace NLGUI
pNode->setFather(this);
}
// ----------------------------------------------------------------------------
void CGroupTree::SNode::openAll()
{
Opened = true;
for (uint i = 0; i < Children.size(); ++i)
Children[i]->openAll();
}
// ----------------------------------------------------------------------------
void CGroupTree::SNode::closeAll()
{
@ -1082,7 +1090,9 @@ namespace NLGUI
}
}
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftdown)
bool toggleOne = (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftdown);
bool toggleAll = (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouserightdown);
if (toggleOne || toggleAll)
{
// line selection
if (bText)
@ -1118,6 +1128,13 @@ namespace NLGUI
{
// open/close the node
changedNode->Opened = !changedNode->Opened;
if (toggleAll)
{
if (changedNode->Opened)
changedNode->openAll();
else
changedNode->closeAll();
}
}
// else must close all necessary nodes.
else

View file

@ -0,0 +1,212 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "nel/gui/http_cache.h"
using namespace std;
using namespace NLMISC;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
#if defined(GCC_VERSION) && !defined(CLANG_VERSION) && defined(NL_ISO_CPP0X_AVAILABLE) && (GCC_VERSION <= 40804)
// hack to fix std::map::erase wrong return type (void instead of iterator in C++11) in GCC 4.8.4
#undef NL_ISO_CPP0X_AVAILABLE
#endif
namespace NLGUI
{
CHttpCache* CHttpCache::instance = NULL;
CHttpCache* CHttpCache::getInstance()
{
if (!instance)
{
instance = new CHttpCache();
}
return instance;
}
void CHttpCache::release()
{
delete instance;
instance = NULL;
}
CHttpCache::CHttpCache()
: _Initialized(false)
, _MaxObjects(100)
{ };
CHttpCache::~CHttpCache()
{
flushCache();
}
void CHttpCache::setCacheIndex(const std::string& fname)
{
_IndexFilename = fname;
_Initialized = false;
}
CHttpCacheObject CHttpCache::lookup(const std::string& fname)
{
if (!_Initialized)
init();
if (_List.count(fname) > 0)
return _List[fname];
return CHttpCacheObject();
}
void CHttpCache::store(const std::string& fname, const CHttpCacheObject& data)
{
if (!_Initialized)
init();
_List[fname] = data;
}
void CHttpCache::init()
{
if (_Initialized)
return;
_Initialized = true;
if (_IndexFilename.empty() || !CFile::fileExists(_IndexFilename))
return;
CIFile in;
if (!in.open(_IndexFilename)) {
nlwarning("Unable to open %s for reading", _IndexFilename.c_str());
return;
}
serial(in);
}
void CHttpCacheObject::serial(NLMISC::IStream& f)
{
f.serialVersion(1);
f.serial(Expires);
f.serial(LastModified);
f.serial(Etag);
}
void CHttpCache::serial(NLMISC::IStream& f)
{
// saved state is ignored when version checks fail
try {
f.serialVersion(1);
// CacheIdx
f.serialCheck(NELID("hcaC"));
f.serialCheck(NELID("xdIe"));
if (f.isReading())
{
uint32 numFiles;
f.serial(numFiles);
_List.clear();
for (uint k = 0; k < numFiles; ++k)
{
std::string fname;
f.serial(fname);
CHttpCacheObject obj;
obj.serial(f);
_List[fname] = obj;
}
}
else
{
uint32 numFiles = _List.size();
f.serial(numFiles);
for (THttpCacheMap::iterator it = _List.begin(); it != _List.end(); ++it)
{
std::string fname(it->first);
f.serial(fname);
(*it).second.serial(f);
}
}
} catch (...) {
_List.clear();
nlwarning("Invalid cache index format (%s)", _IndexFilename.c_str());
return;
}
}
void CHttpCache::pruneCache()
{
if (_List.size() < _MaxObjects)
return;
size_t mustDrop = _List.size() - _MaxObjects;
time_t currentTime;
time(&currentTime);
// if we over object limit, then start removing expired objects
// this does not guarantee that max limit is reached
for (THttpCacheMap::iterator it = _List.begin(); it != _List.end();)
{
if (it->second.Expires <= currentTime)
{
#ifdef NL_ISO_CPP0X_AVAILABLE
it = _List.erase(it);
#else
THttpCacheMap::iterator itToErase = it++;
_List.erase(itToErase);
#endif
--mustDrop;
if (mustDrop == 0)
break;
}
else
{
++it;
}
}
}
void CHttpCache::flushCache()
{
if (_IndexFilename.empty())
return;
pruneCache();
COFile out;
if (!out.open(_IndexFilename))
{
nlwarning("Unable to open %s for writing", _IndexFilename.c_str());
return;
}
serial(out);
out.close();
}
}

View file

@ -0,0 +1,245 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "nel/gui/http_hsts.h"
using namespace std;
using namespace NLMISC;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NLGUI {
CStrictTransportSecurity* CStrictTransportSecurity::instance = NULL;
CStrictTransportSecurity* CStrictTransportSecurity::getInstance()
{
if (!instance)
{
instance= new CStrictTransportSecurity();
}
return instance;
}
void CStrictTransportSecurity::release()
{
delete instance;
instance = NULL;
}
CStrictTransportSecurity::~CStrictTransportSecurity()
{
save();
}
// ************************************************************************
bool CStrictTransportSecurity::isSecureHost(const std::string &domain) const
{
SHSTSObject hsts;
if (get(domain, hsts))
{
time_t currentTime;
time(&currentTime);
return (hsts.Expires < currentTime);
}
return false;
}
// ************************************************************************
void CStrictTransportSecurity::erase(const std::string &domain)
{
if (_Domains.count(domain) > 0)
{
_Domains.erase(domain);
}
}
void CStrictTransportSecurity::set(const std::string &domain, uint64 expires, bool includeSubDomains)
{
if (expires == 0)
{
erase(domain);
return;
}
_Domains[domain].Expires = expires;
_Domains[domain].IncludeSubDomains = includeSubDomains;
}
bool CStrictTransportSecurity::get(const std::string &domain, SHSTSObject &hsts) const
{
if (domain.empty() || _Domains.empty())
return false;
if (_Domains.count(domain) > 0)
{
hsts = _Domains.at(domain);
return true;
}
size_t firstOf = domain.find_first_of(".");
size_t lastOf = domain.find_last_of(".");
while(firstOf != lastOf)
{
std::string tmp;
tmp = domain.substr(firstOf+1);
if (_Domains.count(tmp))
{
if (_Domains.at(tmp).IncludeSubDomains)
{
hsts = _Domains.at(tmp);
return true;
}
return false;
}
firstOf = domain.find_first_of(".", firstOf + 1);
}
return false;
}
void CStrictTransportSecurity::init(const std::string &fname)
{
_Domains.clear();
_Filename = fname;
if (_Filename.empty() || !CFile::fileExists(_Filename))
{
return;
}
CIFile in;
if (!in.open(_Filename))
{
nlwarning("Unable to open %s for reading", _Filename.c_str());
return;
}
serial(in);
}
void CStrictTransportSecurity::save()
{
if (_Filename.empty())
return;
if (_Domains.empty())
{
CFile::deleteFile(_Filename);
return;
}
COFile out;
if (!out.open(_Filename))
{
nlwarning("Unable to open %s for writing", _Filename.c_str());
return;
}
serial(out);
out.close();
}
void CStrictTransportSecurity::serial(NLMISC::IStream& f)
{
try
{
f.serialVersion(1);
// HSTS
f.serialCheck(NELID("STSH"));
if (f.isReading())
{
uint32 nbItems;
f.serial(nbItems);
for(uint32 k = 0; k < nbItems; ++k)
{
std::string domain;
f.serial(domain);
f.serial(_Domains[domain].Expires);
f.serial(_Domains[domain].IncludeSubDomains);
}
}
else
{
uint32 nbItems = _Domains.size();
f.serial(nbItems);
for (THSTSObject::iterator it = _Domains.begin(); it != _Domains.end(); ++it)
{
std::string domain(it->first);
f.serial(domain);
f.serial(_Domains[domain].Expires);
f.serial(_Domains[domain].IncludeSubDomains);
}
}
}
catch (...)
{
_Domains.clear();
nlwarning("Invalid HTST file format (%s)", _Filename.c_str());
}
}
// ***************************************************************************
void CStrictTransportSecurity::setFromHeader(const std::string &domain, const std::string &header)
{
// max-age=<seconds>; includeSubdomains; preload;
std::vector<std::string> elements;
NLMISC::splitString(toLower(header), ";", elements);
if (elements.empty()) return;
time_t currentTime;
time(&currentTime);
uint64 expire = 0;
bool includeSubDomains = false;
for(uint i=0; i< elements.size(); ++i)
{
std::string str(trim(elements[i]));
if (str.substr(0, 8) == "max-age=")
{
uint64 ttl;
if (fromString(str.substr(8), ttl))
{
if (ttl > 0)
{
expire = currentTime + ttl;
}
}
}
else if (str == "includesubdomains")
{
includeSubDomains = true;
}
}
if (expire == 0)
{
erase(domain);
}
else
{
set(domain, expire, includeSubDomains);
}
}
}

View file

@ -509,7 +509,7 @@ namespace NLGUI
// ------------------------------------------------------------------------------------------------
void CInterfaceElement::updateCoords()
{
_XReal = _X;
_XReal = _X + _MarginLeft;
_YReal = _Y;
_WReal = getW();
_HReal = getH();
@ -526,7 +526,7 @@ namespace NLGUI
if (el == NULL)
return;
_XReal += el->_XReal;
_XReal += el->_XReal - el->_MarginLeft;
_YReal += el->_YReal;
THotSpot hsParent = _ParentPosRef;

View file

@ -1457,7 +1457,7 @@ namespace NLGUI
}
CViewBase::updateCoords();
_XReal += _OffsetX;
_XReal += _OffsetX + _MarginLeft;
_YReal += _OffsetY;
//update all children elements
@ -1468,7 +1468,7 @@ namespace NLGUI
pIE->updateCoords();
}
_XReal -= _OffsetX;
_XReal -= _OffsetX - _MarginLeft;
_YReal -= _OffsetY;
}
@ -1958,9 +1958,9 @@ namespace NLGUI
newSciH = newSciH - ((newSciY+newSciH)-(oldSciY+oldSciH));
}
newSciXDest = newSciX;
newSciXDest = newSciX - _MarginLeft;
newSciYDest = newSciY;
newSciWDest = newSciW;
newSciWDest = newSciW + _MarginLeft;
newSciHDest = newSciH;
}

View file

@ -150,6 +150,8 @@ namespace NLGUI
HTML_ATTR(IMG,USEMAP),
HTML_ATTR(IMG,VSPACE),
HTML_ATTR(IMG,WIDTH),
// not sorted to keep enum values
HTML_ATTR(IMG,DATA-OVER-SRC),
{ 0 }
};

View file

@ -26,6 +26,7 @@
#include <string>
#include <limits>
#include <ctime>
#include "nel/misc/types_nl.h"
#include "nel/misc/algo.h"

View file

@ -2494,7 +2494,7 @@ namespace NLGUI
}
// ***************************************************************************
void CViewText::setFirstLineX(uint firstLineX)
void CViewText::setFirstLineX(sint firstLineX)
{
_FirstLineX = firstLineX;
}

View file

@ -202,7 +202,9 @@ ENDIF()
IF(UNIX)
TARGET_LINK_LIBRARIES(nelmisc -lc -ldl)
IF(NOT APPLE)
IF(APPLE)
TARGET_LINK_LIBRARIES(nelmisc ${CARBON_FRAMEWORK})
ELSE()
TARGET_LINK_LIBRARIES(nelmisc -lrt)
ENDIF()
ENDIF()

View file

@ -82,6 +82,31 @@ extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); }
#if defined(NL_HAS_SSE2) && !defined(NL_CPU_X86_64)
#ifdef NL_NO_EXCEPTION_SPECS
void *operator new(size_t size)
{
void *p = aligned_malloc(size, NL_DEFAULT_MEMORY_ALIGNMENT);
if (p == NULL) throw std::bad_alloc();
return p;
}
void *operator new[](size_t size)
{
void *p = aligned_malloc(size, NL_DEFAULT_MEMORY_ALIGNMENT);
if (p == NULL) throw std::bad_alloc();
return p;
}
void operator delete(void *p) noexcept
{
aligned_free(p);
}
void operator delete[](void *p) noexcept
{
aligned_free(p);
}
#else
void *operator new(size_t size) throw(std::bad_alloc)
{
void *p = aligned_malloc(size, NL_DEFAULT_MEMORY_ALIGNMENT);
@ -105,6 +130,7 @@ void operator delete[](void *p) throw()
{
aligned_free(p);
}
#endif
#endif /* NL_HAS_SSE2 */

View file

@ -17,7 +17,6 @@
#include "stdmisc.h"
#include "nel/misc/i_xml.h"
#include "nel/misc/sstring.h"
#ifndef NL_DONT_USE_EXTERNAL_CODE
@ -39,6 +38,10 @@ namespace NLMISC
const char SEPARATOR = ' ';
std::string CIXml::_ErrorString;
bool CIXml::_LibXmlIntialized = false;
// ***************************************************************************
#define readnumber(dest,digits) \
@ -124,7 +127,7 @@ void xmlGenericErrorFuncRead (void *ctx, const char *msg, ...)
// Get the error string
string str;
NLMISC_CONVERT_VARGS (str, msg, NLMISC::MaxCStringSize);
((CIXml*)ctx)->_ErrorString += str;
CIXml::_ErrorString += str;
}
// ***************************************************************************
@ -134,7 +137,7 @@ bool CIXml::init (IStream &stream)
// Release
release ();
xmlInitParser();
initLibXml();
// Default : XML mode
_BinaryStream = NULL;
@ -190,12 +193,7 @@ bool CIXml::init (IStream &stream)
}
}
// Set error handler
_ErrorString.clear();
xmlSetGenericErrorFunc (this, xmlGenericErrorFuncRead);
// Ask to get debug info
xmlLineNumbersDefault(1);
// The parser context
_Parser = xmlCreatePushParserCtxt(NULL, NULL, buffer, 4, NULL);
@ -1068,6 +1066,7 @@ bool CIXml::getPropertyString (std::string &result, xmlNodePtr node, const std::
// Found
return true;
}
return false;
}
@ -1075,18 +1074,21 @@ bool CIXml::getPropertyString (std::string &result, xmlNodePtr node, const std::
int CIXml::getIntProperty(xmlNodePtr node, const std::string &property, int defaultValue)
{
CSString s;
bool b;
std::string s;
b=getPropertyString(s,node,property);
if (b==false)
bool b = getPropertyString(s, node, property);
if (!b)
return defaultValue;
s=s.strip();
sint val=s.atoi();
if (val==0 && s!="0")
// remove leading and trailing spaces
s = trim(s);
sint val;
if (!fromString(s, val) || (val == 0 && s != "0"))
{
nlwarning("bad integer value: %s",s.c_str());
nlwarning("Bad integer value: %s",s.c_str());
return defaultValue;
}
@ -1097,14 +1099,25 @@ int CIXml::getIntProperty(xmlNodePtr node, const std::string &property, int defa
double CIXml::getFloatProperty(xmlNodePtr node, const std::string &property, float defaultValue)
{
CSString s;
bool b;
std::string s;
b=getPropertyString(s,node,property);
if (b==false)
bool b = getPropertyString(s, node, property);
if (!b)
return defaultValue;
return s.strip().atof();
// remove leading and trailing spaces
s = trim(s);
float val;
if (!fromString(s, val))
{
nlwarning("Bad float value: %s", s.c_str());
return defaultValue;
}
return val;
}
// ***************************************************************************
@ -1112,10 +1125,10 @@ double CIXml::getFloatProperty(xmlNodePtr node, const std::string &property, flo
std::string CIXml::getStringProperty(xmlNodePtr node, const std::string &property, const std::string& defaultValue)
{
std::string s;
bool b;
b=getPropertyString(s,node,property);
if (b==false)
bool b = getPropertyString(s, node, property);
if (!b)
return defaultValue;
return s;
@ -1141,9 +1154,43 @@ bool CIXml::getContentString (std::string &result, xmlNodePtr node)
// ***************************************************************************
void CIXml::initLibXml()
{
if (_LibXmlIntialized) return;
_ErrorString.clear();
// Set error handler
xmlSetGenericErrorFunc (NULL, xmlGenericErrorFuncRead);
LIBXML_TEST_VERSION
// an error occured during initialization
if (!_ErrorString.empty())
{
throw EXmlParsingError (_ErrorString);
}
// Ask to get debug info
xmlLineNumbersDefault(1);
_LibXmlIntialized = true;
}
// ***************************************************************************
void CIXml::releaseLibXml()
{
if (!_LibXmlIntialized) return;
xmlCleanupParser();
_LibXmlIntialized = false;
}
std::string CIXml::getErrorString()
{
return _ErrorString;
}
} // NLMISC

View file

@ -17,6 +17,7 @@
#include "stdmisc.h"
#include "nel/misc/o_xml.h"
#include "nel/misc/i_xml.h"
#ifndef NL_DONT_USE_EXTERNAL_CODE
@ -142,27 +143,15 @@ COXml::COXml () : IStream (false /* Output mode */)
// ***************************************************************************
void xmlGenericErrorFuncWrite (void *ctx, const char *msg, ...)
{
// Get the error string
string str;
NLMISC_CONVERT_VARGS (str, msg, NLMISC::MaxCStringSize);
((COXml*)ctx)->_ErrorString += str;
}
// ***************************************************************************
bool COXml::init (IStream *stream, const std::string &version)
{
resetPtrTable();
CIXml::initLibXml();
// Output stream ?
if (!stream->isReading())
{
// Set error handler
_ErrorString.clear();
xmlSetGenericErrorFunc (this, xmlGenericErrorFuncWrite);
// Set XML mode
setXMLMode (true);
@ -673,9 +662,10 @@ bool COXml::isStringValidForProperties (const std::string &str)
// ***************************************************************************
const char *COXml::getErrorString () const
std::string COXml::getErrorString()
{
return _ErrorString.c_str ();
// error string is managed by CIXml
return CIXml::getErrorString();
}
} // NLMISC

View file

@ -1390,7 +1390,7 @@ uint64 CSystemInfo::availableHDSpace (const string &filename)
struct statfs stfs;
if (::statfs(path.c_str(), &stfs) != 0) return 0;
return (uint64)(stfs.f_bavail * stfs.f_bsize);
return (uint64)stfs.f_bavail * (uint64)stfs.f_bsize;
#else
ULARGE_INTEGER freeSpace = {0};
BOOL bRes = ::GetDiskFreeSpaceExW(utf8ToWide(path), &freeSpace, NULL, NULL);

View file

@ -23,6 +23,10 @@
#include <windows.h>
#include <mmsystem.h>
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace NLMISC;
using namespace std;

View file

@ -18,6 +18,9 @@
#include "listener_dsound.h"
#include "sound_driver_dsound.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace NLMISC;

View file

@ -31,6 +31,9 @@
#include "sound_driver_dsound.h"
#include "listener_dsound.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -21,6 +21,9 @@
#include "buffer_dsound.h"
#include "listener_dsound.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace NLMISC;
using namespace std;

View file

@ -14,6 +14,16 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef STDDSOUND_H
#define STDDSOUND_H
#if defined(_MSC_VER) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#endif
#include "nel/misc/types_nl.h"
#define EAX_AVAILABLE 0
@ -44,4 +54,5 @@
#include "nel/sound/driver/source.h"
#include "nel/sound/driver/listener.h"
#endif
/* end of file */

View file

@ -25,6 +25,10 @@
# include <mmsystem.h>
#endif
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace NLMISC;
using namespace std;

View file

@ -18,6 +18,9 @@
#include "listener_fmod.h"
#include "sound_driver_fmod.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace NLMISC;

View file

@ -18,6 +18,10 @@
#include "music_channel_fmod.h"
#include "sound_driver_fmod.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -26,6 +26,10 @@
#include <Windows.h>
#endif
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -21,6 +21,9 @@
#include "buffer_fmod.h"
#include "listener_fmod.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace NLMISC;
using namespace std;

View file

@ -14,6 +14,16 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef STDFMOD_H
#define STDFMOD_H
#if defined(_MSC_VER) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#endif
#include <nel/misc/types_nl.h>
#ifdef NL_OS_WINDOWS
@ -42,4 +52,6 @@
#include "nel/sound/driver/source.h"
#include "nel/sound/driver/listener.h"
#endif
/* end of file */

View file

@ -18,6 +18,10 @@
#include "sound_driver_al.h"
#include "buffer_al.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace NLMISC;
namespace NLSOUND

View file

@ -19,6 +19,10 @@
#include "effect_al.h"
#include "sound_driver_al.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
// using namespace NLMISC;

View file

@ -18,6 +18,10 @@
#include "listener_al.h"
#include "sound_driver_al.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace NLMISC;
namespace NLSOUND {

View file

@ -22,6 +22,10 @@
#include "ext_al.h"
#include "effect_al.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -22,6 +22,10 @@
#include "source_al.h"
#include "ext_al.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
// #define NLSOUND_DEBUG_GAIN
using namespace std;

View file

@ -20,6 +20,10 @@
#include "buffer_xaudio2.h"
#include "adpcm_xaudio2.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
// using namespace NLMISC;

View file

@ -20,6 +20,10 @@
#include "buffer_xaudio2.h"
#include "sound_driver_xaudio2.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -21,6 +21,10 @@
#include "listener_xaudio2.h"
#include "effect_xaudio2.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -20,6 +20,10 @@
#include "sound_driver_xaudio2.h"
#include "listener_xaudio2.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -22,6 +22,10 @@
#include "effect_xaudio2.h"
#include "sound_driver_xaudio2.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -26,6 +26,10 @@
#include "effect_xaudio2.h"
#include "source_xaudio2.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLMISC;

View file

@ -8,6 +8,6 @@ TARGET_LINK_LIBRARIES(nel_unit_test ${CPPTEST_LIBRARIES} nelmisc nelnet nelligo)
NL_DEFAULT_PROPS(nel_unit_test "Unit Tests")
NL_ADD_RUNTIME_FLAGS(nel_unit_test)
ADD_DEFINITIONS(-DNEL_UNIT_BASE="${PROJECT_SOURCE_DIR}/tools/nel_unit_test/")
ADD_DEFINITIONS(-DNEL_UNIT_BASE="${PROJECT_SOURCE_DIR}/nel/tools/nel_unit_test/")
INSTALL(TARGETS nel_unit_test RUNTIME DESTINATION ${NL_BIN_PREFIX})

View file

@ -1,9 +1,9 @@
//////////////////////////
//////////////////////////
/// CLIENT CONFIG FILE ///
//////////////////////////
//////////////////////////
//////////////////////////
// If you set this variable to 1, your client.cfg will be overwritten when you quit the client.
// You will loose all the comments and identation in this file.
@ -319,6 +319,7 @@ CameraHeight = 2.2; // Camera Height (in meter) from the g
CameraDistance = 3.0; // Camera Distance(in meter) from the user (for the Third Person View).
CameraDistStep = 1.0;
CameraDistMin = 1.0;
CameraDistMax = 25.0;
CameraDistMax = 250.0;
CameraAccel = 5.0;
CameraSpeedMin = 2.0;
@ -350,8 +351,7 @@ SoundGameMusicVolume_max = 1.0;
SoundGameMusicVolume_step = 0.001;
// MISC
PreDataPath = { "user", "data", "patch", "examples", };
DataPath = { "data" };
PreDataPath = { "user", "patch", "data", "examples" };
NeedComputeVS = 0;
NegFiltersDebug = {"Update DB", "Reading:", "Read Value :", "impulseCallBack", "CLIMPD:", "LNET" };
@ -493,6 +493,7 @@ XMLInterfaceFiles = {
"ring_access_point_filter.xml",
"ring_window.xml",
"bg_downloader.xml",
"ryzhome_toolbar.xml"
};
XMLR2EDInterfaceFiles =

View file

@ -220,6 +220,21 @@
</parameter>
</action>
<action name="phrase_cancel_cast" hardtext="uiCancelCast" contexts="game, r2ed_anim_test"/>
<action name="item_group_equip" hardtext="uiMacroItemGroupEquip" contexts="game, r2ed_anim_test">
<parameter hardtext="uiMacroItemGroupName" type="%action_param_user_name" name="name" />
</action>
<action name="item_group_move" hardtext="uiMacroItemGroupMove" contexts="game, r2ed_anim_test">
<parameter hardtext="uiMacroItemGroupName" type="%action_param_user_name" name="name" />
<parameter hardtext="uiMacroItemGroupDestination" type="%action_param_constant" name="destination" value="bag">
<value value="bag" hardtext="uimMtBag" />
<value value="pet_animal1" hardtext="uimMtPaPacker0" />
<value value="pet_animal2" hardtext="uimMtPaPacker1" />
<value value="pet_animal3" hardtext="uimMtPaPacker2" />
<value value="pet_animal4" hardtext="uimMtPaPacker3" />
<value value="player_room" hardtext="uimMtRoom" />
<value value="guild" hardtext="uimMtGuild" />
</parameter>
</action>
</action_category>
<action_category name="chat" hardtext="uiChat" contexts="game, r2ed, r2ed_anim_test"> <!-- not available in r2ed for now -->

View file

@ -2,16 +2,19 @@
<root id="interface" x="0" y="0" w="800" h="600" active="true" />
<lua file="bg_downloader.lua" />
<proc id="bg_downloader_active">
<action handler="set" params="dblink=UI:VARIABLES:ISACTIVE:BG_DOWNLOADER|value=1" />
</proc>
<proc id="bg_downloader_deactive">
<action handler="set" params="dblink=UI:VARIABLES:ISACTIVE:BG_DOWNLOADER|value=0" />
</proc>
<!-- Window for the background downloader -->
<group type="container" id="bg_downloader" title="uiBGD_WindowTitle" global_color="false" line_at_bottom="false"
movable="true" opened="true" openable="false"
@ -22,20 +25,42 @@
savable="true"
header_color="UI:SAVE:WIN:COLORS:OPT"
on_deactive="proc" on_deactive_params="bg_downloader_deactive"
on_active="proc" on_active_params="bg_downloader_active">
<group id="header_closed" x="0" y="0" child_resize_w="true" h="16" posref="TL TL" group_onclick_r="active_menu" group_params_r="menu=ui:interface:base_menu_with_color">
on_active="proc" on_active_params="bg_downloader_active"
>
<group id="header_closed" x="0" y="0" child_resize_w="true" h="16" posref="TL TL"
group_onclick_r="active_menu"
group_params_r="menu=ui:interface:base_menu_with_color"
>
</group>
<group id="header_opened" x="0" y="0" w="800" h="16" posref="TL TL" group_onclick_r="active_menu" group_params_r="menu=ui:interface:base_menu_with_color">
<group id="header_opened" x="0" y="0" w="800" h="16" posref="TL TL"
group_onclick_r="active_menu"
group_params_r="menu=ui:interface:base_menu_with_color"
>
</group>
<group id="content" x="0" y="0" sizeref="wh" w="0" h="0" posref="TL TL" >
<view type="text" id="text" active="true" y="-12" posref="TM TM" hardtext="" fontsize="10" color="255 255 255 255" auto_clamp="true" global_color="false" />
<view type="text" id="ellipsis" active="true" y="0" posref="BR BL" posparent="text" hardtext="" fontsize="13" color="255 255 255 255" global_color="false" />
<view type="bitmap" id="bm" active="false" y="1" x="-1" texture="W_answer_16_valid.tga" posparent="text" posref="ML MR" global_color="false" />
<view type="bar" id="progress" parent="" active="true" posparent="text" posref="BM TM" y="-2" global_color="false" />
<group type="combo_box" id="prio" sizeref="w" w="32" x="0" y="-8" child_resize_h="true" child_resize_hmargin="6" linked_to_db="false" posref="BM TM" posparent="progress" on_change="lua:bgdownloader:onChangePriority()" on_change_params="" tooltip="uiBGD_PriorityTooltip" global_color="false">
<view type="text" id="text" active="true" y="-12" posref="TM TM" hardtext="" fontsize="10" color="255 255 255 255"
auto_clamp="true"
global_color="false"
/>
<view type="text" id="ellipsis" active="true" y="0" posref="BR BL" posparent="text" hardtext="" fontsize="13" color="255 255 255 255"
global_color="false"
/>
<view type="bitmap" id="bm" active="false" y="1" x="-1" texture="W_answer_16_valid.tga" posparent="text" posref="ML MR"
global_color="false"
/>
<view type="bar" id="progress" parent="" active="true" posparent="text" posref="BM TM" y="-2"
global_color="false"
/>
<group type="combo_box" id="prio" sizeref="w" w="32" x="0" y="-8" child_resize_h="true" child_resize_hmargin="6" linked_to_db="false"
posref="BM TM"
posparent="progress"
on_change="lua:bgdownloader:onChangePriority()" on_change_params=""
tooltip="uiBGD_PriorityTooltip"
global_color="false"
>
<instance template="combo_box_def1" tooltip="uiBGD_PriorityTooltip"/>
<combo_text name="uiBGD_Paused" />
<combo_text name="uiBGD_LowPriority" />

View file

@ -3712,6 +3712,7 @@ This MUST follow the Enum MISSION_DESC::TIconId
<variable entry="UI:SAVE:ISENABLED:DYNAMIC_CHAT$i"
type="sint32"
value="1"
value="0"
size="%max_dyn_chan_per_player" />
<variable entry="UI:SAVE:ISENABLED:DYNAMIC_CHAT$i"
type="sint32"

View file

@ -529,10 +529,8 @@
posref="TL TL"
group_onclick_r="active_menu"
group_params_r="menu=ui:interface:base_menu_with_color">
<!--
<view type="text_number" id="fps" posref="MR MR" x="-20" y="-2" color="255 255 255 255" shadow="true" fontsize="10" value="UI:VARIABLES:FPS" global_color="false" positive="true"/>
<view type="text" id="fpstext" posref="MR MR" x="-40" y="-2" color="255 255 255 255" shadow="true" fontsize="10" global_color="false" positive="true" hardtext="uiFPS" />
-->
</group>
<group id="content"
x="0"

View file

@ -1294,4 +1294,170 @@
</group>
</group>
<tree node="web_transactions" />
<group type="container"
id="web_lua_action"
w="480"
h="400"
title=""
global_color="false"
open_button="false"
force_open_out="true"
header_color="UI:SAVE:WIN:COLORS:COM"
resizer="true"
pop_min_w="220"
pop_min_h="96"
pop_max_w="2000"
pop_max_h="1600"
title_bar_open="false"
lockable="true"
openable="false"
opened="true"
movable="true"
active="true">
<group id="header_closed"
x="0"
y="0"
h="12"
posref="TL TL"></group>
<group id="header_opened"
x="0"
y="0"
w="480"
h="16"
posref="TL TL">
<!-- must be frozen by default cause no undo/redo at start -->
<ctrl style="text_button_header"
button_type="push_button"
id="browse_redo"
posref="MR MR"
x="-16"
y="0"
hardtext="uiBrowseRedoButton"
tooltip="uittBrowseRedo"
onclick_l="browse_redo"
params_l="name=ui:interface:web_lua_action:content:html"
frozen="true" />
<ctrl style="text_button_header"
button_type="push_button"
id="browse_undo"
posparent="browse_redo"
posref="ML MR"
x="-4"
y="0"
hardtext="uiBrowseUndoButton"
tooltip="uittBrowseUndo"
onclick_l="browse_undo"
params_l="name=ui:interface:web_lua_action:content:html"
frozen="true" />
<ctrl style="text_button_header"
button_type="push_button"
id="browse_refresh"
posparent="browse_undo"
posref="ML MR"
x="-4"
y="0"
hardtext="uiBrowseRefresh"
tooltip="uittBrowseRefresh"
onclick_l="browse_refresh"
params_l="name=ui:interface:web_lua_action:content:html" />
<ctrl style="text_button_header"
button_type="push_button"
id="browse_home"
posparent="browse_refresh"
posref="ML MR"
x="-4"
y="0"
hardtext="uiBrowseHome"
tooltip="uittBrowseHome"
onclick_l="browse_home"
params_l="name=ui:interface:web_lua_action:content:html" />
</group>
<group id="content"
x="0"
y="0"
w="0"
h="0"
posref="TL TL">
<group type="webig_html"
id="html"
posref="TL TL"
url=""
home="http://app.ryzom.com/"
sizeref="wh"
x="0"
y="0"
w="0"
h="0"
background_color="0 0 0 255"
error_color="255 240 48 255"
link_color="240 155 100 255"
text_color="210 210 210 255"
h1_color="255 255 255 255"
h2_color="255 255 255 255"
h3_color="255 255 255 255"
h4_color="255 255 255 255"
h5_color="255 255 255 255"
h6_color="255 255 255 255"
text_font_size="10"
h1_font_size="20"
h2_font_size="18"
h3_font_size="16"
h4_font_size="14"
h5_font_size="12"
h6_font_size="12"
paragraph_begin_space="12"
multi_line_space_factor="0.25"
td_begin_space="0"
li_begin_space="4"
ul_begin_space="12"
li_indent="-10"
ul_indent="30"
checkbox_bitmap_normal="w_slot_on.tga"
checkbox_bitmap_pushed="w_opacity_on.tga"
checkbox_bitmap_over=""
background_bitmap_view="black2"
browse_next_time="false"
form_text_area_group="edit_box_widget_multiline"
browse_refresh="ui:interface:web_lua_action:header_opened:browse_refresh"
browse_undo="ui:interface:web_lua_action:header_opened:browse_undo"
browse_redo="ui:interface:web_lua_action:header_opened:browse_redo">
<group id="black"
posref="BR BR"
sizeref="hw"
w="-10"
h="-12"
inherit_gc_alpha="true" />
<instance template="inner_thin_border"
posparent="black"
inherit_gc_alpha="true" />
<view type="bitmap"
id="black2"
posparent="black"
posref="MM MM"
sizeref="wh"
w="-2"
h="-2"
inherit_gc_alpha="true"
scale="true"
texture="blank.tga"
global_color="false" />
<group type="list"
id="text_list"
fontsize="9"
posref="TL TL"
posparent="black"
x="2"
y="-2"
space="0"
sizeref="hw"
w="-4"
h="-4"
maxelements="2000" />
<ctrl style="skin_scroll"
id="scroll_bar" />
</group>
</group>
</group>
<tree node="web_lua_action" />
</interface_config>

View file

@ -906,7 +906,6 @@
group_params_r="menu=ui:interface:base_menu_with_color"
on_active="lua"
on_active_params="help:openCSBrowserHeader('cs_browser')">
</group>
<group id="content"
x="0"
@ -2830,7 +2829,7 @@
global_color_normal="true"
global_color_over="true"
global_color_pushed="true"
text_y="-0"
text_y="0"
fontsize="10"
shadow="true"
case_mode="%case_upper"

View file

@ -110,14 +110,14 @@
<tree node="connection"/>
<tree node="keys" >
<tree node="keys_player"/>
<tree node="keys_movement"/>
<tree node="keys_view"/>
<tree node="keys_actionbar"/>
<tree node="keys_fight"/>
<tree node="keys_actions"/>
<tree node="keys_chat"/>
<tree node="keys_edit"/>
<tree node="keys_view"/>
<tree node="keys_windows"/>
<tree node="keys_miscellaneous"/>
<tree node="keys_system"/>
<tree node="keys_edit"/>
<tree node="keys_debug"/>
</tree>
<!-- done with template teditcmd now <tree node="editkey" />-->

View file

@ -1431,6 +1431,8 @@ function game:onInGameDbInitialized()
end
game:setInfoPlayerCharacterRace()
runAH(nil, "sort_tribefame", "")
end
function game:onWebIgReady()

View file

@ -228,12 +228,14 @@ function game:updateTargetConsiderUI()
local wgToolTip = targetWindow:find("target_tooltip")
local wgPvPTag = targetWindow:find("pvp_tags")
local wgHeader = targetWindow:find("header_opened")
local wgLock = targetWindow:find("lock")
wgTargetSlotForce.active = true
wgImpossible.active = true
-- no selection ?
if twGetTargetLevel() == -1 then
wgLock.active = false
wgTargetSlotForce.active = false
wgTargetLevel.active = false
wgImpossible.active = false
@ -254,20 +256,36 @@ function game:updateTargetConsiderUI()
wgPvPTag.active = false
wgHeader.h = 34;
-- /luaScript getUI("ui:interface:target:header_opened:lock").active=true
-- if the selection is a player, then both the local & targeted player must be in PVP mode for the level to be displayed
if (twIsTargetPlayer()) then
-- don't display anything ...
wgLock.active = false
wgTargetSlotForce.active = false
wgTargetLevel.active = false
wgImpossible.active = false
wgSlotRing.active = false
wgToolTip.tooltip = ""
if twIsTargetInPVPMode() then
debugInfo("target in pvp")
wgPvPTag.active = true
wgHeader.h = 56;
end
return
else
wgLock.active = false
local level = getDbProp(getDefine("target_player_level"))
if level == 2 then -- Locked by team of player
wgLock.active = true
wgLock.color = "50 250 250 255"
else
if level == 1 then -- Locked by another team
wgLock.active = true
wgLock.color = "250 50 50 255"
end
end
end
-- depending on the number of people in the group, set the max diff for visibility between player level

View file

@ -277,6 +277,19 @@
global_color="false"
render_layer="1"
active="true" />
<view type="bitmap"
id="lock"
posref="BR BR"
posparent="slot_force"
x="-5"
y="-3"
h="14"
w="14"
color="255 255 255 255"
texture="w_win_lock.tga"
global_color="false"
render_layer="3"
active="true" />
<ctrl type="tooltip"
id="target_tooltip"
tooltip="uittConsiderTargetNoSelection"

View file

@ -549,7 +549,7 @@
pop_min_h="240"
pop_max_w="920"
pop_max_h="1600"
w="300"
w="400"
h="400"
movable="true"
active="false"

View file

@ -37,6 +37,10 @@
type="I10" />
<leaf name="QUANTITY"
type="I10" />
<leaf name="CREATE_TIME"
type="I32" />
<leaf name="SERIAL"
type="I32" />
<leaf name="USER_COLOR"
type="I3" />
<leaf name="LOCKED"
@ -79,6 +83,10 @@
type="I10" />
<leaf name="QUANTITY"
type="I10" />
<leaf name="CREATE_TIME"
type="I32" />
<leaf name="SERIAL"
type="I32" />
<leaf name="USER_COLOR"
type="I3" />
<leaf name="LOCKED"
@ -130,6 +138,10 @@
type="I10" />
<leaf name="QUANTITY"
type="I10" />
<leaf name="CREATE_TIME"
type="I32" />
<leaf name="SERIAL"
type="I32" />
<leaf name="USER_COLOR"
type="I3" />
<!-- No LOCKED state -->
@ -168,6 +180,10 @@
type="I10" />
<leaf name="QUANTITY"
type="I10" />
<leaf name="CREATE_TIME"
type="I32" />
<leaf name="SERIAL"
type="I32" />
<leaf name="USER_COLOR"
type="I3" />
<leaf name="WEIGHT"
@ -223,6 +239,10 @@
type="I10" />
<leaf name="QUANTITY"
type="I10" />
<leaf name="CREATE_TIME"
type="I32" />
<leaf name="SERIAL"
type="I32" />
<leaf name="USER_COLOR"
type="I3" />
<leaf name="LOCKED"
@ -278,6 +298,10 @@
type="I10" />
<leaf name="QUANTITY"
type="I10" />
<leaf name="CREATE_TIME"
type="I32" />
<leaf name="SERIAL"
type="I32" />
<leaf name="USER_COLOR"
type="I3" />
<!-- <leaf name="LOCKED" type="I10"/> No longer needed -->
@ -309,6 +333,10 @@
type="I10" />
<leaf name="QUANTITY"
type="I10" />
<leaf name="CREATE_TIME"
type="I32" />
<leaf name="SERIAL"
type="I32" />
<leaf name="USER_COLOR"
type="I3" />
<!-- <leaf name="LOCKED" type="I10"/> No longer needed -->
@ -352,6 +380,10 @@
type="I10" />
<leaf name="QUANTITY"
type="I10" />
<leaf name="CREATE_TIME"
type="I32" />
<leaf name="SERIAL"
type="I32" />
<!-- No LOCKED state -->
<leaf name="USER_COLOR"
type="I3" />

View file

@ -27,7 +27,6 @@
<group id="checkpass" posref="MM MM" w="1024" h="768" active="false"
on_active="init_res_lod" on_deactive="uninit_res_lod" >
<group id="content" x="0" y="0" w="1024" h="768" posref="TL TL" >
<!-- BACKGROUND -->

Some files were not shown because too many files have changed in this diff Show more