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) # have absolute paths (e.g. -lpthread)
cmake_policy(SET CMP0003 NEW) 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 # allow to link to qtmain automatically under Windows
IF(POLICY CMP0020) IF(POLICY CMP0020)
CMAKE_POLICY(SET CMP0020 NEW) CMAKE_POLICY(SET CMP0020 NEW)
@ -64,8 +60,8 @@ SET(YEAR "2004-${CURRENT_YEAR}")
SET(AUTHOR "Winch Gate and The Ryzom Core Community") SET(AUTHOR "Winch Gate and The Ryzom Core Community")
SET(RYZOM_VERSION_MAJOR 3) SET(RYZOM_VERSION_MAJOR 3)
SET(RYZOM_VERSION_MINOR 1) SET(RYZOM_VERSION_MINOR 2)
SET(RYZOM_VERSION_PATCH 0) SET(RYZOM_VERSION_PATCH 1)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Redirect output files # Redirect output files
@ -168,7 +164,11 @@ IF(WITH_SSE2)
ENDIF() ENDIF()
ENDIF() ENDIF()
IF(APPLE_CERTIFICATE) IF(APPLE)
FIND_LIBRARY(CARBON_FRAMEWORK Carbon)
FIND_LIBRARY(FOUNDATION_FRAMEWORK Foundation)
IF(APPLE_CERTIFICATE)
# Find codesign_allocate # Find codesign_allocate
# Xcode 7.0 and later versions # Xcode 7.0 and later versions
@ -188,6 +188,7 @@ IF(APPLE_CERTIFICATE)
MESSAGE(WARNING "Unable to find codesign_allocate in standard directories") MESSAGE(WARNING "Unable to find codesign_allocate in standard directories")
SET(CODESIGN_ALLOCATE) SET(CODESIGN_ALLOCATE)
ENDIF() ENDIF()
ENDIF()
ENDIF() ENDIF()
MACRO(ADD_QT_LIBRARY _NAME) MACRO(ADD_QT_LIBRARY _NAME)
@ -336,7 +337,7 @@ IF(WITH_QT5)
ENDIF() ENDIF()
# freetype is needed since Qt 5.5 # freetype is needed since Qt 5.5
FIND_PACKAGE(FreeType) FIND_PACKAGE(Freetype)
IF(FREETYPE_FOUND) IF(FREETYPE_FOUND)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIBRARIES}) SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIBRARIES})
@ -382,8 +383,6 @@ IF(WITH_QT5)
IF(APPLE) IF(APPLE)
FIND_LIBRARY(PCRE_LIBRARY pcre16 pcre) FIND_LIBRARY(PCRE_LIBRARY pcre16 pcre)
FIND_LIBRARY(FOUNDATION_FRAMEWORK Foundation)
FIND_LIBRARY(CARBON_FRAMEWORK Carbon)
FIND_LIBRARY(SECURITY_FRAMEWORK Security) FIND_LIBRARY(SECURITY_FRAMEWORK Security)
SET(QT_LIBRARIES ${QT_LIBRARIES} SET(QT_LIBRARIES ${QT_LIBRARIES}
@ -448,6 +447,8 @@ IF(WITH_NEL)
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${INTL_LIBRARY}) SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${INTL_LIBRARY})
ENDIF() ENDIF()
ENDIF() ENDIF()
ELSEIF(WIN32)
SET(CURL_LIBRARIES ${CURL_LIBRARIES} Crypt32.lib)
ENDIF() ENDIF()
ENDIF() ENDIF()
ENDIF() ENDIF()

View file

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

View file

@ -5,6 +5,24 @@
# VC_LIBRARY_DIR - where to find libraries # VC_LIBRARY_DIR - where to find libraries
# VC_FOUND - True if MSVC found. # 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) MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
# Software/Wow6432Node/... # Software/Wow6432Node/...
GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;${_VERSION}]" ABSOLUTE) 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") IF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_DIR) SET(VC${_VERSION}_DIR)
GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;${_VERSION}]" ABSOLUTE) 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") 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/") SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/")
ENDIF() ENDIF()
ENDIF() ENDIF()
@ -55,7 +77,34 @@ MACRO(DETECT_EXPRESS_VERSION _VERSION)
ENDIF() ENDIF()
ENDMACRO() 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") DETECT_VC_VERSION("14.0")
SET(MSVC_TOOLSET "140") SET(MSVC_TOOLSET "140")
@ -109,6 +158,11 @@ IF(NOT VC_DIR)
STRING(REGEX REPLACE "/(bin|BIN|Bin)/.+" "" VC_DIR ${_COMPILER}) STRING(REGEX REPLACE "/(bin|BIN|Bin)/.+" "" VC_DIR ${_COMPILER})
ENDIF() ENDIF()
SET(VC_INCLUDE_DIR "${VC_DIR}/include") 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}) SET(VC_INCLUDE_DIRS ${VC_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${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}_FOUND ON)
SET(WINSDK${_VERSION}_VERSION_FULL "${_VERSION}") SET(WINSDK${_VERSION}_VERSION_FULL "${_VERSION}")
IF(NOT WindowsSDK_FIND_QUIETLY) 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() ENDIF()
LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION}) LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION})
ELSE() ELSE()
@ -240,7 +240,11 @@ MACRO(USE_CURRENT_WINSDK)
IF(NOT WINSDK_DIR) IF(NOT WINSDK_DIR)
# Use Windows SDK versions installed with VC++ when possible # 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") SET(WINSDK_VERSION "8.1")
ELSEIF(MSVC12) ELSEIF(MSVC12)
SET(WINSDK_VERSION "8.1") SET(WINSDK_VERSION "8.1")
@ -305,7 +309,7 @@ MACRO(USE_CURRENT_WINSDK)
ENDMACRO() ENDMACRO()
IF(MSVC14) 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") SET(WINSDK_UCRT_VERSION "10.0")
ENDIF() ENDIF()
@ -314,6 +318,40 @@ IF(WINSDK_UCRT_VERSION AND WINSDK${WINSDK_UCRT_VERSION}_FOUND)
SET(WINSDK_UCRT_DIR "${WINSDK${WINSDK_UCRT_VERSION}_DIR}") SET(WINSDK_UCRT_DIR "${WINSDK${WINSDK_UCRT_VERSION}_DIR}")
ENDIF() 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") IF(WINSDK_VERSION STREQUAL "CURRENT")
USE_CURRENT_WINSDK() USE_CURRENT_WINSDK()
ELSE() ELSE()
@ -334,93 +372,87 @@ ENDIF()
# directory where Win32 headers are found # directory where Win32 headers are found
FIND_PATH(WINSDK_INCLUDE_DIR Windows.h FIND_PATH(WINSDK_INCLUDE_DIR Windows.h
HINTS HINTS
${WINSDK_DIR}/Include/${UCRT_VERSION}/um
${WINSDK_DIR}/Include/um ${WINSDK_DIR}/Include/um
${WINSDK_DIR}/Include ${WINSDK_DIR}/Include
NO_DEFAULT_PATH
) )
MESSAGE(STATUS "Found Windows.h in ${WINSDK_INCLUDE_DIR}")
# directory where WinRT headers are found # directory where WinRT headers are found
FIND_PATH(WINSDK_WINRT_INCLUDE_DIR winstring.h FIND_PATH(WINSDK_WINRT_INCLUDE_DIR winstring.h
HINTS HINTS
${WINSDK_DIR}/Include/${UCRT_VERSION}/winrt
${WINSDK_DIR}/Include/winrt ${WINSDK_DIR}/Include/winrt
NO_DEFAULT_PATH
) )
MESSAGE(STATUS "Found winstring.h in ${WINSDK_WINRT_INCLUDE_DIR}")
# directory where DirectX headers are found # directory where DirectX headers are found
FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h
HINTS HINTS
${WINSDK_DIR}/Include/${UCRT_VERSION}/shared
${WINSDK_DIR}/Include/shared ${WINSDK_DIR}/Include/shared
NO_DEFAULT_PATH
) )
MESSAGE(STATUS "Found d3d9.h in ${WINSDK_SHARED_INCLUDE_DIR}")
# directory where OpenGL headers are found # directory where OpenGL headers are found
FIND_PATH(WINSDK_OPENGL_INCLUDE_DIR GL.h FIND_PATH(WINSDK_OPENGL_INCLUDE_DIR GL.h
HINTS HINTS
${WINSDK_INCLUDE_DIR}/gl
${WINSDK_DIR}/Include/um/gl ${WINSDK_DIR}/Include/um/gl
${WINSDK_DIR}/Include/gl ${WINSDK_DIR}/Include/gl
NO_DEFAULT_PATH
) )
MESSAGE(STATUS "Found GL.h in ${WINSDK_OPENGL_INCLUDE_DIR}")
SET(WINSDK_LIBRARY_DIRS SET(WINSDK_LIBRARY_DIRS
${WINSDK_DIR}/Lib/${UCRT_VERSION}/um/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Lib/winv6.3/um/${WINSDK8_SUFFIX} ${WINSDK_DIR}/Lib/winv6.3/um/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Lib/win8/um/${WINSDK8_SUFFIX} ${WINSDK_DIR}/Lib/win8/um/${WINSDK8_SUFFIX}
) )
IF(WINSDK_SUFFIXES) IF(WINSDK_SUFFIXES)
FOREACH(_SUFFIX ${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() ENDFOREACH()
ELSE() ELSE()
SET(WINSDK_LIBRARY_DIRS ${WINSDK_LIBRARY_DIRS} ${WINSDK_DIR}/Lib) LIST(APPEND WINSDK_LIBRARY_DIRS ${WINSDK_DIR}/Lib)
ENDIF() ENDIF()
# directory where all libraries are found # directory where all libraries are found
FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib
HINTS HINTS
${WINSDK_LIBRARY_DIRS} ${WINSDK_LIBRARY_DIRS}
NO_DEFAULT_PATH
) )
IF(WINSDK_UCRT_DIR) MESSAGE(STATUS "Found ComCtl32.lib in ${WINSDK_LIBRARY_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(WINSDK_BINARY_DIRS
SET(UCRT_VERSION) ${WINSDK_DIR}/Bin/${UCRT_VERSION}/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX}
FOREACH(UCRT_SUBDIR ${UCRT_SUBDIRS}) ${WINSDK_DIR}/Bin/x86
IF(NOT UCRT_VERSION OR UCRT_SUBDIR VERSION_GREATER UCRT_VERSION) ${WINSDK_DIR}/Bin
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
)
# 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 # signtool is used to sign executables
FIND_PROGRAM(WINSDK_SIGNTOOL signtool FIND_PROGRAM(WINSDK_SIGNTOOL signtool
HINTS HINTS
${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX} ${WINSDK_BINARY_DIRS}
${WINSDK_DIR}/Bin/x86 NO_DEFAULT_PATH
${WINSDK_DIR}/Bin
) )
# midl is used to generate IDL interfaces # midl is used to generate IDL interfaces
FIND_PROGRAM(WINSDK_MIDL midl FIND_PROGRAM(WINSDK_MIDL midl
HINTS HINTS
${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX} ${WINSDK_BINARY_DIRS}
${WINSDK_DIR}/Bin/x86 NO_DEFAULT_PATH
${WINSDK_DIR}/Bin
) )
IF(WINSDK_INCLUDE_DIR) IF(WINSDK_INCLUDE_DIR)
@ -444,7 +476,7 @@ IF(WINSDK_INCLUDE_DIR)
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_WINRT_INCLUDE_DIR}) SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_WINRT_INCLUDE_DIR})
ENDIF() ENDIF()
INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS}) # TODO: Move this after all other includes somehow... INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS})
IF(WINSDK_UCRT_LIBRARY_DIR) IF(WINSDK_UCRT_LIBRARY_DIR)
SET(CMAKE_LIBRARY_PATH ${WINSDK_UCRT_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH}) 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) GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS)
IF(oldProps) IF(oldProps)
LIST(APPEND _FLAGS ${oldProps}) SET(_FLAG ${oldProps})
SEPARATE_ARGUMENTS(_FLAG)
LIST(APPEND _FLAGS ${_FLAG})
ENDIF() ENDIF()
GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD}) GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD})
IF(oldPropsBuild) IF(oldPropsBuild)
LIST(APPEND _FLAGS ${oldPropsBuild}) SET(_FLAG ${oldPropsBuild})
SEPARATE_ARGUMENTS(_FLAG)
LIST(APPEND _FLAGS ${_FLAG})
ENDIF() ENDIF()
GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES) GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES)
@ -205,6 +209,10 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
ENDIF() ENDIF()
ENDIF() ENDIF()
IF(USE_CPP0X AND gcc_compiler_version GREATER "6.2.0")
LIST(APPEND _FLAGS "-std=gnu++11")
ENDIF()
# Format definitions # Format definitions
IF(MSVC) IF(MSVC)
# Fix path with space # Fix path with space
@ -316,7 +324,7 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS)
SET(_FLAGS "") SET(_FLAGS "")
IF(APPLE) IF(APPLE)
SET(HEADER_FORMAT "objective-${HEADER_FORMAT}") SET(HEADER_FORMAT "objective-${HEADER_FORMAT}")
SET(_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch) SET(_FLAGS ${OBJC_FLAGS})
ENDIF() ENDIF()
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} ${_FLAGS} -x ${HEADER_FORMAT} -o ${PCH_OUTPUT} -c ${PCH_INPUT}) SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} ${_FLAGS} -x ${HEADER_FORMAT} -o ${PCH_OUTPUT} -c ${PCH_INPUT})
ENDIF() ENDIF()
@ -402,7 +410,8 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
ENDIF() ENDIF()
IF(APPLE) 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() ENDIF()
IF(WITH_PCH_DEBUG) IF(WITH_PCH_DEBUG)

View file

@ -35,23 +35,6 @@ SET(UNIX ON)
SET(APPLE ON) SET(APPLE ON)
SET(IOS 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 # Setup iOS platform
IF(NOT DEFINED IOS_PLATFORM) IF(NOT DEFINED IOS_PLATFORM)
SET(IOS_PLATFORM "OS") SET(IOS_PLATFORM "OS")
@ -162,14 +145,14 @@ IF(CMAKE_GENERATOR MATCHES Xcode)
ENDIF() ENDIF()
ELSE() ELSE()
IF(${IOS_PLATFORM} STREQUAL "OS") IF(${IOS_PLATFORM} STREQUAL "OS")
SET(ARCHS "armv7;arm64") SET(ARCHS armv7 arm64)
SET(CMAKE_SYSTEM_PROCESSOR "armv7") SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR") ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
# iPhone simulator targets i386 # iPhone simulator targets i386
SET(ARCHS "i386") SET(ARCHS "i386")
SET(CMAKE_SYSTEM_PROCESSOR "x86") SET(CMAKE_SYSTEM_PROCESSOR "x86")
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL") ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
SET(ARCHS "armv7;arm64;i386;x86_64") SET(ARCHS armv7 arm64 i386 x86_64)
SET(CMAKE_SYSTEM_PROCESSOR "armv7") SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ENDIF() ENDIF()
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_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE 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 # 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") ADD_PLATFORM_FLAGS("/X")
IF(MSVC14) IF(MSVC14)
ADD_PLATFORM_FLAGS("/Gy- /MP") ADD_PLATFORM_FLAGS("/Gy-")
# /Ox is working with VC++ 2015, but custom optimizations don't exist # /Ox is working with VC++ 2015 and 2017, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again # without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}") 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) ELSEIF(MSVC12)
ADD_PLATFORM_FLAGS("/Gy-") ADD_PLATFORM_FLAGS("/Gy-")
# /Ox is working with VC++ 2013, but custom optimizations don't exist # /Ox is working with VC++ 2013, but custom optimizations don't exist
@ -657,6 +664,8 @@ MACRO(NL_SETUP_BUILD)
ENDIF() ENDIF()
IF(APPLE) IF(APPLE)
SET(OBJC_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch -fobjc-weak)
IF(NOT XCODE) IF(NOT XCODE)
IF(CMAKE_OSX_ARCHITECTURES) IF(CMAKE_OSX_ARCHITECTURES)
SET(TARGETS_COUNT 0) SET(TARGETS_COUNT 0)
@ -1160,6 +1169,7 @@ MACRO(SETUP_EXTERNAL)
IF(APPLE) IF(APPLE)
IF(WITH_STATIC_EXTERNAL) IF(WITH_STATIC_EXTERNAL)
# Look only for static libraries because systems libraries are using Frameworks
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a) SET(CMAKE_FIND_LIBRARY_SUFFIXES .a)
ELSE() ELSE()
SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so .a) SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so .a)
@ -1173,12 +1183,13 @@ MACRO(SETUP_EXTERNAL)
ENDIF() ENDIF()
ENDIF() ENDIF()
# Android and iOS have pthread # Android, iOS and Mac OS X have pthread, but no need to link to libpthread
IF(ANDROID OR IOS) IF(ANDROID OR APPLE)
SET(CMAKE_USE_PTHREADS_INIT 1) SET(CMAKE_USE_PTHREADS_INIT 1)
SET(Threads_FOUND TRUE) SET(Threads_FOUND TRUE)
ELSE() 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 # TODO: replace all -l<lib> by absolute path to <lib> in CMAKE_THREAD_LIBS_INIT
ENDIF() 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 // because of multiline, thz parent container will be moved to top
// The good position can be restored by a press on enter then // 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 _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 _Savable : 1; // should content be saved ?
bool _DefaultInputString : 1; // Is the current input string the default one (should not be edited) 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) bool _Frozen : 1; // is the control frozen? (cannot edit in it)

View file

@ -84,6 +84,7 @@ namespace NLGUI
FontOblique=false; FontOblique=false;
Underlined=false; Underlined=false;
StrikeThrough=false; StrikeThrough=false;
GlobalColor=false;
Width=-1; Width=-1;
Height=-1; Height=-1;
MaxWidth=-1; MaxWidth=-1;
@ -94,6 +95,7 @@ namespace NLGUI
bool FontOblique; bool FontOblique;
std::string FontFamily; std::string FontFamily;
NLMISC::CRGBA TextColor; NLMISC::CRGBA TextColor;
bool GlobalColor;
bool Underlined; bool Underlined;
bool StrikeThrough; bool StrikeThrough;
sint32 Width; sint32 Width;
@ -339,7 +341,7 @@ namespace NLGUI
void addString(const ucstring &str); void addString(const ucstring &str);
// Add an image in the current paragraph // 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 // 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); 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. // 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, 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()); const CStyleParams &style = CStyleParams());
// Set the background color // Set the background color
@ -712,7 +714,12 @@ namespace NLGUI
std::vector<CCellParams> _CellParams; std::vector<CCellParams> _CellParams;
// Indentation // Indentation
uint _Indent; std::vector<uint> _Indent;
inline uint getIndent() const {
if (_Indent.empty())
return 0;
return _Indent.back();
}
// Current node is a title // Current node is a title
bool _Title; bool _Title;
@ -791,7 +798,7 @@ namespace NLGUI
void doBrowseLocalFile(const std::string &filename); void doBrowseLocalFile(const std::string &filename);
// load remote content using either GET or POST // 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 // render html string as new browser page
bool renderHtmlString(const std::string &html); bool renderHtmlString(const std::string &html);
@ -805,33 +812,37 @@ namespace NLGUI
// ImageDownload system // ImageDownload system
enum TDataType {ImgType= 0, BnpType}; enum TDataType {ImgType= 0, BnpType};
enum TImageType {NormalImage=0, OverImage};
struct CDataImageDownload struct CDataImageDownload
{ {
public: public:
CDataImageDownload(CViewBase *img, CStyleParams style): Image(img), Style(style) CDataImageDownload(CViewBase *img, CStyleParams style, TImageType type): Image(img), Style(style), Type(type)
{ {
} }
public: public:
CViewBase * Image; CViewBase * Image;
CStyleParams Style; CStyleParams Style;
TImageType Type;
}; };
struct CDataDownload struct CDataDownload
{ {
public: 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: public:
CURL *curl; CCurlWWWData *data;
std::string url; std::string url;
std::string dest; std::string dest;
std::string luaScript; std::string luaScript;
std::string md5sum; std::string md5sum;
TDataType type; TDataType type;
uint32 redirects;
FILE *fp; FILE *fp;
std::vector<CDataImageDownload> imgs; std::vector<CDataImageDownload> imgs;
}; };
@ -840,20 +851,22 @@ namespace NLGUI
CURLM *MultiCurl; CURLM *MultiCurl;
int RunningCurls; int RunningCurls;
bool startCurlDownload(CDataDownload &download);
void initImageDownload(); void initImageDownload();
void checkImageDownload(); 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 localImageName(const std::string &url);
std::string getAbsoluteUrl(const std::string &url); std::string getAbsoluteUrl(const std::string &url);
bool isTrustedDomain(const std::string &domain); 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()); void setImageSize(CViewBase *view, const CStyleParams &style = CStyleParams());
// BnpDownload system // BnpDownload system
void initBnpDownload(); void initBnpDownload();
void checkBnpDownload(); 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); std::string localBnpName(const std::string &url);
void releaseDownloads(); void releaseDownloads();

View file

@ -97,6 +97,7 @@ namespace NLGUI
void addChildSortedByBitmap(SNode *pNode); void addChildSortedByBitmap(SNode *pNode);
void setParentTree(CGroupTree *parent); void setParentTree(CGroupTree *parent);
void setFather(SNode *father); void setFather(SNode *father);
void openAll();
void closeAll(); void closeAll();
void makeOrphan(); void makeOrphan();
bool parse (xmlNodePtr cur, CGroupTree *parentGroup); 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; _XReal = _YReal = _WReal = _HReal = 0;
_X = _Y = _W = _H = 0; _X = _Y = _W = _H = 0;
//_Snap = 1; //_Snap = 1;
_MarginLeft = 0;
_PosRef = Hotspot_BL; _PosRef = Hotspot_BL;
_ParentPosRef = Hotspot_BL; _ParentPosRef = Hotspot_BL;
@ -178,6 +179,9 @@ namespace NLGUI
sint32 getH() const { return (_Active?_H:0); } sint32 getH() const { return (_Active?_H:0); }
sint32 getH(bool bTestActive) const { return (bTestActive?(_Active?_H:0):_H); } 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. * Get the max width used by the window.
* *
@ -568,6 +572,8 @@ namespace NLGUI
sint32 _W; sint32 _W;
sint32 _H; sint32 _H;
sint32 _MarginLeft;
//sint32 _Snap; //sint32 _Snap;
// position references e.g. : _PosRef=BL, _ParentPosref=MM : the bottom left corner of the element // 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,USEMAP),
HTML_ATTR(IMG,VSPACE), HTML_ATTR(IMG,VSPACE),
HTML_ATTR(IMG,WIDTH), HTML_ATTR(IMG,WIDTH),
// not sorted to keep enum values
HTML_ATTR(IMG,DATA_OVER_SRC),
}; };
enum enum

View file

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

View file

@ -110,6 +110,11 @@ public:
*/ */
bool init (IStream &stream); 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. /** Release the resources used by the stream.
*/ */
void release (); void release ();
@ -172,7 +177,12 @@ public:
static bool getContentString (std::string &result, xmlNodePtr node); 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(); static void releaseLibXml();
@ -234,13 +244,16 @@ private:
uint _ContentStringIndex; uint _ContentStringIndex;
// Error message // Error message
std::string _ErrorString; static std::string _ErrorString;
// Try binary mode // Try binary mode
bool _TryBinaryMode; bool _TryBinaryMode;
// If not NULL, binary mode detected, use this stream in serials // If not NULL, binary mode detected, use this stream in serials
IStream *_BinaryStream; 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 xmlOutputWriteCallbackForNeL ( void *context, const char *buffer, int len );
friend int xmlOutputCloseCallbackForNeL ( void *context ); friend int xmlOutputCloseCallbackForNeL ( void *context );
friend void xmlGenericErrorFuncWrite (void *ctx, const char *msg, ...);
public: public:
/** Stream ctor /** Stream ctor
@ -100,7 +99,7 @@ public:
/** Return the error string. /** Return the error string.
* if not empty, something wrong appends * if not empty, something wrong appends
*/ */
const char *getErrorString () const; static std::string getErrorString ();
/** Default dstor /** Default dstor
* *
@ -178,9 +177,6 @@ private:
// Current content string // Current content string
std::string _ContentString; std::string _ContentString;
// Error message
std::string _ErrorString;
}; };

View file

@ -166,6 +166,10 @@
# define NL_ISO_CPP0X_AVAILABLE # define NL_ISO_CPP0X_AVAILABLE
#endif #endif
#if defined(NL_COMP_GCC) && (__cplusplus >= 201103L)
# define NL_NO_EXCEPTION_SPECS
#endif
// gcc 3.4 introduced ISO C++ with tough template rules // 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 // 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 #ifndef NL_CPU_X86_64
// on x86_64, new and delete are already aligned on 16 bytes // 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 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();
extern void operator delete[](void *p) throw(); extern void operator delete[](void *p) throw();
#endif #endif
#endif
#else /* NL_HAS_SSE2 */ #else /* NL_HAS_SSE2 */
#define NL_DEFAULT_MEMORY_ALIGNMENT 4 #define NL_DEFAULT_MEMORY_ALIGNMENT 4

View file

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

View file

@ -480,12 +480,21 @@ public:
virtual ~CStateRecord() {} virtual ~CStateRecord() {}
// use STL allocator for fast alloc. this works because objects are small ( < 128 bytes) // 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) { 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) { 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; static std::allocator<uint8> Allocator;
}; };
// record of a single .fx pass // record of a single .fx pass
class CFXPassRecord class CFXPassRecord
{ {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -30,6 +30,14 @@ ELSE()
SET(NLDRV_OGL_LIB "nel_drv_opengl") SET(NLDRV_OGL_LIB "nel_drv_opengl")
ENDIF() 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}) NL_TARGET_DRIVER(${NLDRV_OGL_LIB} ${SRC})
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) 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); H_AUTO_OGL(setupNVTextureEnvCombine4);
CHECK_EXT("GL_NV_texture_env_combine4"); 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; return true;
#endif
} }
// ********************************* // *********************************
@ -802,7 +808,13 @@ static bool setupATITextureEnvCombine3(const char *glext)
// #endif // #endif
CHECK_EXT("GL_ATI_texture_env_combine3"); 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; return true;
#endif
} }
// ********************************* // *********************************

View file

@ -1425,6 +1425,11 @@ void CDriverGL::setupSpecularPass(uint pass)
} }
else 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 // Multiply texture1 by alpha_texture0 and display with add
_DriverGLStates.enableBlend(true); _DriverGLStates.enableBlend(true);
_DriverGLStates.blendFunc(GL_ONE, GL_ONE); _DriverGLStates.blendFunc(GL_ONE, GL_ONE);
@ -1457,6 +1462,7 @@ void CDriverGL::setupSpecularPass(uint pass)
} }
activateTexEnvMode(1, env); activateTexEnvMode(1, env);
#endif // DEBUG_OGL_SPECULAR_FALLBACK
} }
} }
} }

View file

@ -226,7 +226,8 @@ void CMeshVPWindTree::initVertexPrograms()
{ {
// setup of the VPLight fragment // setup of the VPLight fragment
uint numPls= i/4; 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; bool specular= (i&2)!=0;
// combine // combine

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,6 +14,16 @@
// You should have received a copy of the GNU Affero General Public License // 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/>. // 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 "nel/misc/types_nl.h"
#include <cmath> #include <cmath>
#include <list> #include <list>
@ -27,3 +37,5 @@
// Include from libxml2 // Include from libxml2
#include <libxml/parser.h> #include <libxml/parser.h>
#endif

View file

@ -27,6 +27,10 @@
#include "nel/georges/form_loader.h" #include "nel/georges/form_loader.h"
#include "nel/georges/type.h" #include "nel/georges/type.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace NLMISC; using namespace NLMISC;
using namespace std; 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), _ResetFocusOnHide(false),
_BackupFatherContainerPos(false), _BackupFatherContainerPos(false),
_WantReturn(false), _WantReturn(false),
_ClearOnEscape(false),
_Savable(true), _Savable(true),
_DefaultInputString(false), _DefaultInputString(false),
_Frozen(false), _Frozen(false),
@ -239,6 +240,11 @@ namespace NLGUI
return toString( _WantReturn ); return toString( _WantReturn );
} }
else else
if( name == "clear_on_escape" )
{
return toString( _ClearOnEscape );
}
else
if( name == "savable" ) if( name == "savable" )
{ {
return toString( _Savable ); return toString( _Savable );
@ -413,6 +419,14 @@ namespace NLGUI
return; return;
} }
else else
if( name == "clear_on_escape" )
{
bool b;
if( fromString( value, b ) )
_ClearOnEscape = b;
return;
}
else
if( name == "savable" ) if( name == "savable" )
{ {
bool b; bool b;
@ -514,6 +528,7 @@ namespace NLGUI
xmlSetProp( node, BAD_CAST "backup_father_container_pos", xmlSetProp( node, BAD_CAST "backup_father_container_pos",
BAD_CAST toString( _BackupFatherContainerPos ).c_str() ); BAD_CAST toString( _BackupFatherContainerPos ).c_str() );
xmlSetProp( node, BAD_CAST "want_return", BAD_CAST toString( _WantReturn ).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 "savable", BAD_CAST toString( _Savable ).c_str() );
xmlSetProp( node, BAD_CAST "max_float_prec", BAD_CAST toString( _MaxFloatPrec ).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" ); prop = (char*) xmlGetProp( cur, (xmlChar*)"want_return" );
if (prop) _WantReturn = convertBool(prop); if (prop) _WantReturn = convertBool(prop);
prop = (char*) xmlGetProp( cur, (xmlChar*)"clear_on_escape" );
if (prop) _ClearOnEscape = convertBool(prop);
prop = (char*) xmlGetProp( cur, (xmlChar*)"savable" ); prop = (char*) xmlGetProp( cur, (xmlChar*)"savable" );
if (prop) _Savable = convertBool(prop); if (prop) _Savable = convertBool(prop);
@ -991,6 +1009,11 @@ namespace NLGUI
// stop selection // stop selection
_CurrSelection = NULL; _CurrSelection = NULL;
_CursorAtPreviousLineEnd = false; _CursorAtPreviousLineEnd = false;
if (_ClearOnEscape)
{
setInputString(ucstring(""));
triggerOnChangeAH();
}
break; break;
case KeyTAB: case KeyTAB:
makeTopWindow(); makeTopWindow();

File diff suppressed because it is too large Load diff

View file

@ -1209,6 +1209,13 @@ namespace NLGUI
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
sint32 CGroupTable::getMaxUsedW() const 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 i;
uint column = 0; uint column = 0;
vector<sint32> columns; vector<sint32> columns;

View file

@ -271,6 +271,14 @@ namespace NLGUI
pNode->setFather(this); pNode->setFather(this);
} }
// ----------------------------------------------------------------------------
void CGroupTree::SNode::openAll()
{
Opened = true;
for (uint i = 0; i < Children.size(); ++i)
Children[i]->openAll();
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void CGroupTree::SNode::closeAll() 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 // line selection
if (bText) if (bText)
@ -1118,6 +1128,13 @@ namespace NLGUI
{ {
// open/close the node // open/close the node
changedNode->Opened = !changedNode->Opened; changedNode->Opened = !changedNode->Opened;
if (toggleAll)
{
if (changedNode->Opened)
changedNode->openAll();
else
changedNode->closeAll();
}
} }
// else must close all necessary nodes. // else must close all necessary nodes.
else 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() void CInterfaceElement::updateCoords()
{ {
_XReal = _X; _XReal = _X + _MarginLeft;
_YReal = _Y; _YReal = _Y;
_WReal = getW(); _WReal = getW();
_HReal = getH(); _HReal = getH();
@ -526,7 +526,7 @@ namespace NLGUI
if (el == NULL) if (el == NULL)
return; return;
_XReal += el->_XReal; _XReal += el->_XReal - el->_MarginLeft;
_YReal += el->_YReal; _YReal += el->_YReal;
THotSpot hsParent = _ParentPosRef; THotSpot hsParent = _ParentPosRef;

View file

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

View file

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

View file

@ -26,6 +26,7 @@
#include <string> #include <string>
#include <limits> #include <limits>
#include <ctime>
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/misc/algo.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; _FirstLineX = firstLineX;
} }

View file

@ -202,7 +202,9 @@ ENDIF()
IF(UNIX) IF(UNIX)
TARGET_LINK_LIBRARIES(nelmisc -lc -ldl) TARGET_LINK_LIBRARIES(nelmisc -lc -ldl)
IF(NOT APPLE) IF(APPLE)
TARGET_LINK_LIBRARIES(nelmisc ${CARBON_FRAMEWORK})
ELSE()
TARGET_LINK_LIBRARIES(nelmisc -lrt) TARGET_LINK_LIBRARIES(nelmisc -lrt)
ENDIF() ENDIF()
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) #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 *operator new(size_t size) throw(std::bad_alloc)
{ {
void *p = aligned_malloc(size, NL_DEFAULT_MEMORY_ALIGNMENT); void *p = aligned_malloc(size, NL_DEFAULT_MEMORY_ALIGNMENT);
@ -105,6 +130,7 @@ void operator delete[](void *p) throw()
{ {
aligned_free(p); aligned_free(p);
} }
#endif
#endif /* NL_HAS_SSE2 */ #endif /* NL_HAS_SSE2 */

View file

@ -17,7 +17,6 @@
#include "stdmisc.h" #include "stdmisc.h"
#include "nel/misc/i_xml.h" #include "nel/misc/i_xml.h"
#include "nel/misc/sstring.h"
#ifndef NL_DONT_USE_EXTERNAL_CODE #ifndef NL_DONT_USE_EXTERNAL_CODE
@ -39,6 +38,10 @@ namespace NLMISC
const char SEPARATOR = ' '; const char SEPARATOR = ' ';
std::string CIXml::_ErrorString;
bool CIXml::_LibXmlIntialized = false;
// *************************************************************************** // ***************************************************************************
#define readnumber(dest,digits) \ #define readnumber(dest,digits) \
@ -124,7 +127,7 @@ void xmlGenericErrorFuncRead (void *ctx, const char *msg, ...)
// Get the error string // Get the error string
string str; string str;
NLMISC_CONVERT_VARGS (str, msg, NLMISC::MaxCStringSize); 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
release (); release ();
xmlInitParser(); initLibXml();
// Default : XML mode // Default : XML mode
_BinaryStream = NULL; _BinaryStream = NULL;
@ -190,12 +193,7 @@ bool CIXml::init (IStream &stream)
} }
} }
// Set error handler
_ErrorString.clear(); _ErrorString.clear();
xmlSetGenericErrorFunc (this, xmlGenericErrorFuncRead);
// Ask to get debug info
xmlLineNumbersDefault(1);
// The parser context // The parser context
_Parser = xmlCreatePushParserCtxt(NULL, NULL, buffer, 4, NULL); _Parser = xmlCreatePushParserCtxt(NULL, NULL, buffer, 4, NULL);
@ -1068,6 +1066,7 @@ bool CIXml::getPropertyString (std::string &result, xmlNodePtr node, const std::
// Found // Found
return true; return true;
} }
return false; 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) int CIXml::getIntProperty(xmlNodePtr node, const std::string &property, int defaultValue)
{ {
CSString s; std::string s;
bool b;
b=getPropertyString(s,node,property); bool b = getPropertyString(s, node, property);
if (b==false)
if (!b)
return defaultValue; return defaultValue;
s=s.strip(); // remove leading and trailing spaces
sint val=s.atoi(); s = trim(s);
if (val==0 && s!="0")
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; 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) double CIXml::getFloatProperty(xmlNodePtr node, const std::string &property, float defaultValue)
{ {
CSString s; std::string s;
bool b;
b=getPropertyString(s,node,property); bool b = getPropertyString(s, node, property);
if (b==false)
if (!b)
return defaultValue; 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 CIXml::getStringProperty(xmlNodePtr node, const std::string &property, const std::string& defaultValue)
{ {
std::string s; std::string s;
bool b;
b=getPropertyString(s,node,property); bool b = getPropertyString(s, node, property);
if (b==false)
if (!b)
return defaultValue; return defaultValue;
return s; 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() void CIXml::releaseLibXml()
{ {
if (!_LibXmlIntialized) return;
xmlCleanupParser(); xmlCleanupParser();
_LibXmlIntialized = false;
}
std::string CIXml::getErrorString()
{
return _ErrorString;
} }
} // NLMISC } // NLMISC

View file

@ -17,6 +17,7 @@
#include "stdmisc.h" #include "stdmisc.h"
#include "nel/misc/o_xml.h" #include "nel/misc/o_xml.h"
#include "nel/misc/i_xml.h"
#ifndef NL_DONT_USE_EXTERNAL_CODE #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) bool COXml::init (IStream *stream, const std::string &version)
{ {
resetPtrTable(); resetPtrTable();
CIXml::initLibXml();
// Output stream ? // Output stream ?
if (!stream->isReading()) if (!stream->isReading())
{ {
// Set error handler
_ErrorString.clear();
xmlSetGenericErrorFunc (this, xmlGenericErrorFuncWrite);
// Set XML mode // Set XML mode
setXMLMode (true); 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 } // NLMISC

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,6 +14,16 @@
// You should have received a copy of the GNU Affero General Public License // 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/>. // 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" #include "nel/misc/types_nl.h"
#define EAX_AVAILABLE 0 #define EAX_AVAILABLE 0
@ -44,4 +54,5 @@
#include "nel/sound/driver/source.h" #include "nel/sound/driver/source.h"
#include "nel/sound/driver/listener.h" #include "nel/sound/driver/listener.h"
#endif
/* end of file */ /* end of file */

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,6 +14,16 @@
// You should have received a copy of the GNU Affero General Public License // 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/>. // 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> #include <nel/misc/types_nl.h>
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
@ -42,4 +52,6 @@
#include "nel/sound/driver/source.h" #include "nel/sound/driver/source.h"
#include "nel/sound/driver/listener.h" #include "nel/sound/driver/listener.h"
#endif
/* end of file */ /* end of file */

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -26,6 +26,10 @@
#include "effect_xaudio2.h" #include "effect_xaudio2.h"
#include "source_xaudio2.h" #include "source_xaudio2.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace std; using namespace std;
using namespace NLMISC; 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_DEFAULT_PROPS(nel_unit_test "Unit Tests")
NL_ADD_RUNTIME_FLAGS(nel_unit_test) 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}) INSTALL(TARGETS nel_unit_test RUNTIME DESTINATION ${NL_BIN_PREFIX})

View file

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

View file

@ -220,6 +220,21 @@
</parameter> </parameter>
</action> </action>
<action name="phrase_cancel_cast" hardtext="uiCancelCast" contexts="game, r2ed_anim_test"/> <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>
<action_category name="chat" hardtext="uiChat" contexts="game, r2ed, r2ed_anim_test"> <!-- not available in r2ed for now --> <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" /> <root id="interface" x="0" y="0" w="800" h="600" active="true" />
<lua file="bg_downloader.lua" /> <lua file="bg_downloader.lua" />
<proc id="bg_downloader_active"> <proc id="bg_downloader_active">
<action handler="set" params="dblink=UI:VARIABLES:ISACTIVE:BG_DOWNLOADER|value=1" /> <action handler="set" params="dblink=UI:VARIABLES:ISACTIVE:BG_DOWNLOADER|value=1" />
</proc> </proc>
<proc id="bg_downloader_deactive"> <proc id="bg_downloader_deactive">
<action handler="set" params="dblink=UI:VARIABLES:ISACTIVE:BG_DOWNLOADER|value=0" /> <action handler="set" params="dblink=UI:VARIABLES:ISACTIVE:BG_DOWNLOADER|value=0" />
</proc> </proc>
<!-- Window for the background downloader --> <!-- Window for the background downloader -->
<group type="container" id="bg_downloader" title="uiBGD_WindowTitle" global_color="false" line_at_bottom="false" <group type="container" id="bg_downloader" title="uiBGD_WindowTitle" global_color="false" line_at_bottom="false"
movable="true" opened="true" openable="false" movable="true" opened="true" openable="false"
@ -22,20 +25,42 @@
savable="true" savable="true"
header_color="UI:SAVE:WIN:COLORS:OPT" header_color="UI:SAVE:WIN:COLORS:OPT"
on_deactive="proc" on_deactive_params="bg_downloader_deactive" on_deactive="proc" on_deactive_params="bg_downloader_deactive"
on_active="proc" on_active_params="bg_downloader_active"> 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 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>
<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>
<group id="content" x="0" y="0" sizeref="wh" w="0" h="0" posref="TL TL" > <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="text" active="true" y="-12" posref="TM TM" hardtext="" fontsize="10" color="255 255 255 255"
<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" /> auto_clamp="true"
<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" /> 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="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"/> <instance template="combo_box_def1" tooltip="uiBGD_PriorityTooltip"/>
<combo_text name="uiBGD_Paused" /> <combo_text name="uiBGD_Paused" />
<combo_text name="uiBGD_LowPriority" /> <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" <variable entry="UI:SAVE:ISENABLED:DYNAMIC_CHAT$i"
type="sint32" type="sint32"
value="1" value="1"
value="0"
size="%max_dyn_chan_per_player" /> size="%max_dyn_chan_per_player" />
<variable entry="UI:SAVE:ISENABLED:DYNAMIC_CHAT$i" <variable entry="UI:SAVE:ISENABLED:DYNAMIC_CHAT$i"
type="sint32" type="sint32"

View file

@ -529,10 +529,8 @@
posref="TL TL" posref="TL TL"
group_onclick_r="active_menu" group_onclick_r="active_menu"
group_params_r="menu=ui:interface:base_menu_with_color"> 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_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" /> <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>
<group id="content" <group id="content"
x="0" x="0"

View file

@ -1294,4 +1294,170 @@
</group> </group>
</group> </group>
<tree node="web_transactions" /> <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> </interface_config>

View file

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

View file

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

View file

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

View file

@ -217,7 +217,7 @@ end
-- Is its level known (not too high ...) -- Is its level known (not too high ...)
-- Boss/Mini-bosses/Names colored ring -- Boss/Mini-bosses/Names colored ring
function game:updateTargetConsiderUI() function game:updateTargetConsiderUI()
--debugInfo("Updating consider widget") -- debugInfo("Updating consider widget")
local targetWindow = getUI("ui:interface:target") local targetWindow = getUI("ui:interface:target")
-- --
@ -228,12 +228,14 @@ function game:updateTargetConsiderUI()
local wgToolTip = targetWindow:find("target_tooltip") local wgToolTip = targetWindow:find("target_tooltip")
local wgPvPTag = targetWindow:find("pvp_tags") local wgPvPTag = targetWindow:find("pvp_tags")
local wgHeader = targetWindow:find("header_opened") local wgHeader = targetWindow:find("header_opened")
local wgLock = targetWindow:find("lock")
wgTargetSlotForce.active = true wgTargetSlotForce.active = true
wgImpossible.active = true wgImpossible.active = true
-- no selection ? -- no selection ?
if twGetTargetLevel() == -1 then if twGetTargetLevel() == -1 then
wgLock.active = false
wgTargetSlotForce.active = false wgTargetSlotForce.active = false
wgTargetLevel.active = false wgTargetLevel.active = false
wgImpossible.active = false wgImpossible.active = false
@ -254,20 +256,36 @@ function game:updateTargetConsiderUI()
wgPvPTag.active = false wgPvPTag.active = false
wgHeader.h = 34; 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 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 if (twIsTargetPlayer()) then
-- don't display anything ... -- don't display anything ...
wgLock.active = false
wgTargetSlotForce.active = false wgTargetSlotForce.active = false
wgTargetLevel.active = false wgTargetLevel.active = false
wgImpossible.active = false wgImpossible.active = false
wgSlotRing.active = false wgSlotRing.active = false
wgToolTip.tooltip = "" wgToolTip.tooltip = ""
if twIsTargetInPVPMode() then if twIsTargetInPVPMode() then
debugInfo("target in pvp")
wgPvPTag.active = true wgPvPTag.active = true
wgHeader.h = 56; wgHeader.h = 56;
end end
return 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 end
-- depending on the number of people in the group, set the max diff for visibility between player level -- 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" global_color="false"
render_layer="1" render_layer="1"
active="true" /> 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" <ctrl type="tooltip"
id="target_tooltip" id="target_tooltip"
tooltip="uittConsiderTargetNoSelection" tooltip="uittConsiderTargetNoSelection"

View file

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

View file

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

View file

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

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