From 450181f2442655b45c9f988650858ac64c5329e6 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 3 Oct 2017 14:32:13 +0200 Subject: [PATCH 01/63] Fixed: Always link to Crypt32.lib for OpenSSL under Windows --HG-- branch : develop --- code/CMakeLists.txt | 6 ++++-- code/CMakeModules/FindMySQL.cmake | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index cce763bac..0e72cc5f9 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -112,6 +112,10 @@ FIND_PACKAGE(OpenSSL REQUIRED) FIND_PACKAGE(GIF) FIND_PACKAGE(Jpeg) +IF(WIN32) + SET(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} Crypt32.lib) +ENDIF() + IF(WITH_LIBOVR) FIND_PACKAGE(LibOVR) ENDIF() @@ -443,8 +447,6 @@ IF(WITH_NEL) SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${INTL_LIBRARY}) ENDIF() ENDIF() - ELSEIF(WIN32) - SET(CURL_LIBRARIES ${CURL_LIBRARIES} Crypt32.lib) ENDIF() ENDIF() ENDIF() diff --git a/code/CMakeModules/FindMySQL.cmake b/code/CMakeModules/FindMySQL.cmake index f2b62fc59..8a92cb0c4 100644 --- a/code/CMakeModules/FindMySQL.cmake +++ b/code/CMakeModules/FindMySQL.cmake @@ -69,6 +69,9 @@ ELSE() ENDIF() FIND_PACKAGE(OpenSSL) IF(OPENSSL_FOUND) + IF(WIN32) + SET(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} Crypt32.lib) + ENDIF() SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} ${OPENSSL_LIBRARIES}) ENDIF() ENDIF() From c9aa7142bc1d44cdaaf1b85c98a88f3cdb0ebebc Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 3 Oct 2017 14:33:25 +0200 Subject: [PATCH 02/63] Fixed: New versions of AssImp depend on IrrXML --HG-- branch : develop --- code/CMakeModules/Findassimp.cmake | 62 ++++++++++++++++----- code/nel/tools/3d/mesh_utils/CMakeLists.txt | 4 +- 2 files changed, 50 insertions(+), 16 deletions(-) diff --git a/code/CMakeModules/Findassimp.cmake b/code/CMakeModules/Findassimp.cmake index 41e53cf94..b4bf0da99 100644 --- a/code/CMakeModules/Findassimp.cmake +++ b/code/CMakeModules/Findassimp.cmake @@ -1,29 +1,63 @@ +IF(assimp_FIND_REQUIRED) + SET(ASSIMP_FIND_REQUIRED ON) +ENDIF() + FIND_PATH( - assimp_INCLUDE_DIRS + ASSIMP_INCLUDE_DIRS NAMES assimp/postprocess.h assimp/scene.h assimp/version.h assimp/config.h assimp/cimport.h PATHS /usr/local/include/ ) FIND_LIBRARY( - assimp_LIBRARIES + ASSIMP_LIBRARY_RELEASE NAMES assimp PATHS /usr/local/lib/ ) -IF (assimp_INCLUDE_DIRS AND assimp_LIBRARIES) - SET(assimp_FOUND TRUE) +FIND_LIBRARY( + IRRXML_LIBRARY_RELEASE + NAMES IrrXML + PATHS /usr/local/lib/ +) + +FIND_LIBRARY( + ASSIMP_LIBRARY_DEBUG + NAMES assimpd + PATHS /usr/local/lib/ +) + +FIND_LIBRARY( + IRRXML_LIBRARY_DEBUG + NAMES IrrXMLd + PATHS /usr/local/lib/ +) + +IF (ASSIMP_INCLUDE_DIRS) + SET(ASSIMP_FOUND TRUE) + IF(ASSIMP_LIBRARY_RELEASE) + SET(ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES} optimized ${ASSIMP_LIBRARY_RELEASE}) + ENDIF() + IF(ASSIMP_LIBRARY_DEBUG) + SET(ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES} debug ${ASSIMP_LIBRARY_DEBUG}) + ENDIF() FIND_PACKAGE(ZLIB) IF(ZLIB_FOUND) - SET(assimp_LIBRARIES ${assimp_LIBRARIES} ${ZLIB_LIBRARIES}) + SET(ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES} ${ZLIB_LIBRARIES}) ENDIF() -ENDIF (assimp_INCLUDE_DIRS AND assimp_LIBRARIES) + IF(IRRXML_LIBRARY_RELEASE) + SET(ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES} optimized ${IRRXML_LIBRARY_RELEASE}) + ENDIF() + IF(IRRXML_LIBRARY_DEBUG) + SET(ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES} debug ${IRRXML_LIBRARY_DEBUG}) + ENDIF() +ENDIF() -IF (assimp_FOUND) - IF (NOT assimp_FIND_QUIETLY) - MESSAGE(STATUS "Found asset importer library: ${assimp_LIBRARIES}") - ENDIF (NOT assimp_FIND_QUIETLY) -ELSE (assimp_FOUND) - IF (assimp_FIND_REQUIRED) +IF (ASSIMP_FOUND) + IF (NOT ASSIMP_FIND_QUIETLY) + MESSAGE(STATUS "Found asset importer library: ${ASSIMP_LIBRARIES}") + ENDIF () +ELSE (ASSIMP_FOUND) + IF (ASSIMP_FIND_REQUIRED) MESSAGE(FATAL_ERROR "Could not find asset importer library") - ENDIF (assimp_FIND_REQUIRED) -ENDIF (assimp_FOUND) + ENDIF () +ENDIF () diff --git a/code/nel/tools/3d/mesh_utils/CMakeLists.txt b/code/nel/tools/3d/mesh_utils/CMakeLists.txt index 0d9f6deb3..d8a5b29d9 100644 --- a/code/nel/tools/3d/mesh_utils/CMakeLists.txt +++ b/code/nel/tools/3d/mesh_utils/CMakeLists.txt @@ -3,11 +3,11 @@ FILE(GLOB HDRS *.h) SOURCE_GROUP("" FILES ${SRCS} ${HDRS}) -INCLUDE_DIRECTORIES(${assimp_INCLUDE_DIRS}) +INCLUDE_DIRECTORIES(${ASSIMP_INCLUDE_DIRS}) NL_TARGET_LIB(mesh_utils ${SRCS} ${HDRS}) -TARGET_LINK_LIBRARIES(mesh_utils ${assimp_LIBRARIES} nelmisc nelpipeline nel3d) +TARGET_LINK_LIBRARIES(mesh_utils ${ASSIMP_LIBRARIES} nelmisc nelpipeline nel3d) NL_DEFAULT_PROPS(mesh_utils "NeL, Tools, 3D: Mesh Utils") NL_ADD_RUNTIME_FLAGS(mesh_utils) From ef42c45da3f5c82328285613aee96830958cad11 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 3 Oct 2017 14:33:33 +0200 Subject: [PATCH 03/63] Fixed: Compilation --HG-- branch : develop --- code/nel/tools/logic/logic_editor_dll/logic_editor_interface.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/nel/tools/logic/logic_editor_dll/logic_editor_interface.h b/code/nel/tools/logic/logic_editor_dll/logic_editor_interface.h index f2ac7c13a..d0059571c 100644 --- a/code/nel/tools/logic/logic_editor_dll/logic_editor_interface.h +++ b/code/nel/tools/logic/logic_editor_dll/logic_editor_interface.h @@ -17,6 +17,8 @@ #ifndef LOGIC_EDITOR_INTERFACE #define LOGIC_EDITOR_INTERFACE +#include + #ifndef LOGIC_EDITOR_EXPORT #define LOGIC_EDITOR_EXPORT __declspec( dllimport ) #endif // LOGIC_EDITOR_EXPORT From cade235fe54b7e10a08bace5def8e4016442c703 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 14 Oct 2017 12:04:01 +0200 Subject: [PATCH 04/63] Fixed: Disable servers compilation with Travis because it's taking too much time --HG-- branch : develop --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c59df07eb..9c7337d55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ os: matrix: fast_finish: true env: - - CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS=OFF -DWITH_LUA51=ON" + - CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS=OFF -DWITH_LUA51=ON -DWITH_RYZOM_SERVER=OFF" - CMAKE_CONFIGURE_OPTIONS="-DCPPTEST_LIBRARY_DEBUG:STRING=/usr/lib/libcpptest.so" CMAKE_BUILD_OPTIONS="--target nel_unit_test -- -j 2" RUN="build/bin/nel_unit_test" From 68ccee68319538d0fa9e208c33428accb2ebfb89 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 14 Oct 2017 16:55:13 +0200 Subject: [PATCH 05/63] Changed: Also disable Ryzom tools for Travis --HG-- branch : develop --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9c7337d55..691112350 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ os: matrix: fast_finish: true env: - - CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS=OFF -DWITH_LUA51=ON -DWITH_RYZOM_SERVER=OFF" + - CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS=OFF -DWITH_LUA51=ON -DWITH_RYZOM_SERVER=OFF -DWOTH_RYZOM_TOOLS=OFF" - CMAKE_CONFIGURE_OPTIONS="-DCPPTEST_LIBRARY_DEBUG:STRING=/usr/lib/libcpptest.so" CMAKE_BUILD_OPTIONS="--target nel_unit_test -- -j 2" RUN="build/bin/nel_unit_test" From 4995760334870428d6f815cbe724262897ead2f3 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 14 Oct 2017 18:31:19 +0200 Subject: [PATCH 06/63] Fixed: Don't compile ryzom_servershare and ryzom_aishare if not using Ryzom server or tools --HG-- branch : develop --- code/ryzom/server/src/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/ryzom/server/src/CMakeLists.txt b/code/ryzom/server/src/CMakeLists.txt index 73e0536d1..fc91decc4 100644 --- a/code/ryzom/server/src/CMakeLists.txt +++ b/code/ryzom/server/src/CMakeLists.txt @@ -1,8 +1,10 @@ # Supporting modules and libraries. # Need servershare for build packed collision tool # Need aishare for build wmap tool -ADD_SUBDIRECTORY(server_share) -ADD_SUBDIRECTORY(ai_share) +IF(WITH_RYZOM_TOOLS OR WITH_RYZOM_SERVER) + ADD_SUBDIRECTORY(server_share) + ADD_SUBDIRECTORY(ai_share) +ENDIF() IF(WITH_RYZOM_SERVER) From 8c227708767a6cba85a0cbe67917013e29d6682b Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 15 Oct 2017 15:01:09 +0200 Subject: [PATCH 07/63] Fixed: Typo --HG-- branch : develop --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 691112350..18de2b579 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ os: matrix: fast_finish: true env: - - CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS=OFF -DWITH_LUA51=ON -DWITH_RYZOM_SERVER=OFF -DWOTH_RYZOM_TOOLS=OFF" + - CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS=OFF -DWITH_LUA51=ON -DWITH_RYZOM_SERVER=OFF -DWITH_RYZOM_TOOLS=OFF" - CMAKE_CONFIGURE_OPTIONS="-DCPPTEST_LIBRARY_DEBUG:STRING=/usr/lib/libcpptest.so" CMAKE_BUILD_OPTIONS="--target nel_unit_test -- -j 2" RUN="build/bin/nel_unit_test" From d721c661ea9aacf78eb84d8059bf7b8a68c5236b Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 15 Oct 2017 16:49:27 +0200 Subject: [PATCH 08/63] Changed: Disable NeL tools too (compilation is still taking more than 50 minutes... and is killed) --HG-- branch : develop --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 18de2b579..6bfad3c3b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ os: matrix: fast_finish: true env: - - CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS=OFF -DWITH_LUA51=ON -DWITH_RYZOM_SERVER=OFF -DWITH_RYZOM_TOOLS=OFF" + - CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS=OFF -DWITH_LUA51=ON -DWITH_RYZOM_SERVER=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_NEL_TOOLS=OFF" - CMAKE_CONFIGURE_OPTIONS="-DCPPTEST_LIBRARY_DEBUG:STRING=/usr/lib/libcpptest.so" CMAKE_BUILD_OPTIONS="--target nel_unit_test -- -j 2" RUN="build/bin/nel_unit_test" From 81adb6c78766367368f5e001f4ceade7b85a5dc6 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Mon, 16 Oct 2017 19:38:35 +0300 Subject: [PATCH 09/63] Fixed: Reading gif, off-by-one --HG-- branch : develop --- code/nel/src/misc/bitmap_gif.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/nel/src/misc/bitmap_gif.cpp b/code/nel/src/misc/bitmap_gif.cpp index 5b964998a..653942d08 100644 --- a/code/nel/src/misc/bitmap_gif.cpp +++ b/code/nel/src/misc/bitmap_gif.cpp @@ -215,9 +215,6 @@ uint8 CBitmap::readGIF( NLMISC::IStream &f ) for (uint32 x = 0; x < width; x++) { - srcOffset++; - dstOffset+= dstChannels; - uint32 index = curFrame->RasterBits[srcOffset]; if ((sint32)index != transparency) @@ -250,6 +247,9 @@ uint8 CBitmap::readGIF( NLMISC::IStream &f ) _Data[0][dstOffset+1] = g; _Data[0][dstOffset+2] = b; _Data[0][dstOffset+3] = a; + + srcOffset++; + dstOffset+= dstChannels; } // x loop } // y loop } // pass loop @@ -262,9 +262,6 @@ uint8 CBitmap::readGIF( NLMISC::IStream &f ) uint32 dstOffset = (y + offset_y)*gif->SWidth*dstChannels + offset_x*dstChannels; for (uint32 x = 0; x < width; x++) { - srcOffset++; - dstOffset+= dstChannels; - uint32 index = curFrame->RasterBits[srcOffset]; if ((sint32)index != transparency) @@ -297,6 +294,9 @@ uint8 CBitmap::readGIF( NLMISC::IStream &f ) _Data[0][dstOffset+1] = g; _Data[0][dstOffset+2] = b; _Data[0][dstOffset+3] = a; + + srcOffset++; + dstOffset+= dstChannels; } // x loop } // y loop } From b98bd576593570c97557d88b7124e661873a696f Mon Sep 17 00:00:00 2001 From: Nimetu Date: Tue, 17 Oct 2017 13:54:36 +0300 Subject: [PATCH 10/63] Fixed: Comparing HSTS timestamp value --HG-- branch : develop --- code/nel/src/gui/http_hsts.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/nel/src/gui/http_hsts.cpp b/code/nel/src/gui/http_hsts.cpp index 980bdabda..c69062538 100644 --- a/code/nel/src/gui/http_hsts.cpp +++ b/code/nel/src/gui/http_hsts.cpp @@ -55,7 +55,7 @@ namespace NLGUI { time_t currentTime; time(¤tTime); - return (hsts.Expires < currentTime); + return (hsts.Expires > currentTime); } return false; From e8c5960882e070e36c5c5d4022e9b5d9b17e3a22 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Tue, 17 Oct 2017 14:44:28 +0300 Subject: [PATCH 11/63] Fixed: Image with tooltip did not expire. --HG-- branch : develop --- code/nel/src/gui/group_html.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index c9977589f..7853ada77 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -4657,7 +4657,6 @@ namespace NLGUI if(!CFile::fileExists(normal)) { normal = "web_del.tga"; - addImageDownload(normalBitmap, ctrlButton, style); } else { @@ -4674,6 +4673,8 @@ namespace NLGUI normal = "web_del.tga"; } } + + addImageDownload(normalBitmap, ctrlButton, style); } } @@ -4698,10 +4699,7 @@ namespace NLGUI if (overBitmap != normalBitmap) { over = localImageName(overBitmap); - if (!CFile::fileExists(over)) - { - addImageDownload(overBitmap, ctrlButton, style, TImageType::OverImage); - } + addImageDownload(overBitmap, ctrlButton, style, TImageType::OverImage); } } From c1188a9e25694f584813909ccb2f93b5d9040998 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 25 Oct 2017 21:35:12 +0200 Subject: [PATCH 12/63] Fixed: Use our own defines for Windows editions to not rely on Windows 10 SDKs (not compatible with Windows XP) --HG-- branch : develop --- code/nel/src/misc/system_info.cpp | 711 ++++++++++++++++-------------- 1 file changed, 389 insertions(+), 322 deletions(-) diff --git a/code/nel/src/misc/system_info.cpp b/code/nel/src/misc/system_info.cpp index 545de0cc6..2afa8da09 100644 --- a/code/nel/src/misc/system_info.cpp +++ b/code/nel/src/misc/system_info.cpp @@ -23,6 +23,156 @@ # include # include # define nlcpuid(regs, idx) __cpuid(regs, idx) + +// define them here to not rely on Windows 10 SDKs +# define NL_PRODUCT_UNDEFINED 0x00000000 +# define NL_PRODUCT_ULTIMATE 0x00000001 +# define NL_PRODUCT_HOME_BASIC 0x00000002 +# define NL_PRODUCT_HOME_PREMIUM 0x00000003 +# define NL_PRODUCT_ENTERPRISE 0x00000004 +# define NL_PRODUCT_HOME_BASIC_N 0x00000005 +# define NL_PRODUCT_BUSINESS 0x00000006 +# define NL_PRODUCT_STANDARD_SERVER 0x00000007 +# define NL_PRODUCT_DATACENTER_SERVER 0x00000008 +# define NL_PRODUCT_SMALLBUSINESS_SERVER 0x00000009 +# define NL_PRODUCT_ENTERPRISE_SERVER 0x0000000A +# define NL_PRODUCT_STARTER 0x0000000B +# define NL_PRODUCT_DATACENTER_SERVER_CORE 0x0000000C +# define NL_PRODUCT_STANDARD_SERVER_CORE 0x0000000D +# define NL_PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E +# define NL_PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F +# define NL_PRODUCT_BUSINESS_N 0x00000010 +# define NL_PRODUCT_WEB_SERVER 0x00000011 +# define NL_PRODUCT_CLUSTER_SERVER 0x00000012 +# define NL_PRODUCT_HOME_SERVER 0x00000013 +# define NL_PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014 +# define NL_PRODUCT_STORAGE_STANDARD_SERVER 0x00000015 +# define NL_PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016 +# define NL_PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017 +# define NL_PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018 +# define NL_PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x00000019 +# define NL_PRODUCT_HOME_PREMIUM_N 0x0000001A +# define NL_PRODUCT_ENTERPRISE_N 0x0000001B +# define NL_PRODUCT_ULTIMATE_N 0x0000001C +# define NL_PRODUCT_WEB_SERVER_CORE 0x0000001D +# define NL_PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E +# define NL_PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F +# define NL_PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020 +# define NL_PRODUCT_SERVER_FOUNDATION 0x00000021 +# define NL_PRODUCT_HOME_PREMIUM_SERVER 0x00000022 +# define NL_PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023 +# define NL_PRODUCT_STANDARD_SERVER_V 0x00000024 +# define NL_PRODUCT_DATACENTER_SERVER_V 0x00000025 +# define NL_PRODUCT_ENTERPRISE_SERVER_V 0x00000026 +# define NL_PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027 +# define NL_PRODUCT_STANDARD_SERVER_CORE_V 0x00000028 +# define NL_PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029 +# define NL_PRODUCT_HYPERV 0x0000002A +# define NL_PRODUCT_STORAGE_EXPRESS_SERVER_CORE 0x0000002B +# define NL_PRODUCT_STORAGE_STANDARD_SERVER_CORE 0x0000002C +# define NL_PRODUCT_STORAGE_WORKGROUP_SERVER_CORE 0x0000002D +# define NL_PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE 0x0000002E +# define NL_PRODUCT_STARTER_N 0x0000002F +# define NL_PRODUCT_PROFESSIONAL 0x00000030 +# define NL_PRODUCT_PROFESSIONAL_N 0x00000031 +# define NL_PRODUCT_SB_SOLUTION_SERVER 0x00000032 +# define NL_PRODUCT_SERVER_FOR_SB_SOLUTIONS 0x00000033 +# define NL_PRODUCT_STANDARD_SERVER_SOLUTIONS 0x00000034 +# define NL_PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE 0x00000035 +# define NL_PRODUCT_SB_SOLUTION_SERVER_EM 0x00000036 +# define NL_PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM 0x00000037 +# define NL_PRODUCT_SOLUTION_EMBEDDEDSERVER 0x00000038 +# define NL_PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE 0x00000039 +# define NL_PRODUCT_PROFESSIONAL_EMBEDDED 0x0000003A +# define NL_PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT 0x0000003B +# define NL_PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL 0x0000003C +# define NL_PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC 0x0000003D +# define NL_PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC 0x0000003E +# define NL_PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE 0x0000003F +# define NL_PRODUCT_CLUSTER_SERVER_V 0x00000040 +# define NL_PRODUCT_EMBEDDED 0x00000041 +# define NL_PRODUCT_STARTER_E 0x00000042 +# define NL_PRODUCT_HOME_BASIC_E 0x00000043 +# define NL_PRODUCT_HOME_PREMIUM_E 0x00000044 +# define NL_PRODUCT_PROFESSIONAL_E 0x00000045 +# define NL_PRODUCT_ENTERPRISE_E 0x00000046 +# define NL_PRODUCT_ULTIMATE_E 0x00000047 +# define NL_PRODUCT_ENTERPRISE_EVALUATION 0x00000048 +# define NL_PRODUCT_MULTIPOINT_STANDARD_SERVER 0x0000004C +# define NL_PRODUCT_MULTIPOINT_PREMIUM_SERVER 0x0000004D +# define NL_PRODUCT_STANDARD_EVALUATION_SERVER 0x0000004F +# define NL_PRODUCT_DATACENTER_EVALUATION_SERVER 0x00000050 +# define NL_PRODUCT_ENTERPRISE_N_EVALUATION 0x00000054 +# define NL_PRODUCT_EMBEDDED_AUTOMOTIVE 0x00000055 +# define NL_PRODUCT_EMBEDDED_INDUSTRY_A 0x00000056 +# define NL_PRODUCT_THINPC 0x00000057 +# define NL_PRODUCT_EMBEDDED_A 0x00000058 +# define NL_PRODUCT_EMBEDDED_INDUSTRY 0x00000059 +# define NL_PRODUCT_EMBEDDED_E 0x0000005A +# define NL_PRODUCT_EMBEDDED_INDUSTRY_E 0x0000005B +# define NL_PRODUCT_EMBEDDED_INDUSTRY_A_E 0x0000005C +# define NL_PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER 0x0000005F +# define NL_PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER 0x00000060 +# define NL_PRODUCT_CORE_ARM 0x00000061 +# define NL_PRODUCT_CORE_N 0x00000062 +# define NL_PRODUCT_CORE_COUNTRYSPECIFIC 0x00000063 +# define NL_PRODUCT_CORE_SINGLELANGUAGE 0x00000064 +# define NL_PRODUCT_CORE 0x00000065 +# define NL_PRODUCT_PROFESSIONAL_WMC 0x00000067 +# define NL_PRODUCT_MOBILE_CORE 0x00000068 +# define NL_PRODUCT_EMBEDDED_INDUSTRY_EVAL 0x00000069 +# define NL_PRODUCT_EMBEDDED_INDUSTRY_E_EVAL 0x0000006A +# define NL_PRODUCT_EMBEDDED_EVAL 0x0000006B +# define NL_PRODUCT_EMBEDDED_E_EVAL 0x0000006C +# define NL_PRODUCT_CORE_SERVER 0x0000006D +# define NL_PRODUCT_CLOUD_STORAGE_SERVER 0x0000006E +# define NL_PRODUCT_CORE_CONNECTED 0x0000006F +# define NL_PRODUCT_PROFESSIONAL_STUDENT 0x00000070 +# define NL_PRODUCT_CORE_CONNECTED_N 0x00000071 +# define NL_PRODUCT_PROFESSIONAL_STUDENT_N 0x00000072 +# define NL_PRODUCT_CORE_CONNECTED_SINGLELANGUAGE 0x00000073 +# define NL_PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC 0x00000074 +# define NL_PRODUCT_CONNECTED_CAR 0x00000075 +# define NL_PRODUCT_INDUSTRY_HANDHELD 0x00000076 +# define NL_PRODUCT_PPI_PRO 0x00000077 +# define NL_PRODUCT_ARM64_SERVER 0x00000078 +# define NL_PRODUCT_EDUCATION 0x00000079 +# define NL_PRODUCT_EDUCATION_N 0x0000007A +# define NL_PRODUCT_IOTUAP 0x0000007B +# define NL_PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER 0x0000007C +# define NL_PRODUCT_ENTERPRISE_S 0x0000007D +# define NL_PRODUCT_ENTERPRISE_S_N 0x0000007E +# define NL_PRODUCT_PROFESSIONAL_S 0x0000007F +# define NL_PRODUCT_PROFESSIONAL_S_N 0x00000080 +# define NL_PRODUCT_ENTERPRISE_S_EVALUATION 0x00000081 +# define NL_PRODUCT_ENTERPRISE_S_N_EVALUATION 0x00000082 +# define NL_PRODUCT_HOLOGRAPHIC 0x00000087 +# define NL_PRODUCT_PRO_SINGLE_LANGUAGE 0x0000008A +# define NL_PRODUCT_PRO_CHINA 0x0000008B +# define NL_PRODUCT_ENTERPRISE_SUBSCRIPTION 0x0000008C +# define NL_PRODUCT_ENTERPRISE_SUBSCRIPTION_N 0x0000008D +# define NL_PRODUCT_DATACENTER_NANO_SERVER 0x0000008F +# define NL_PRODUCT_STANDARD_NANO_SERVER 0x00000090 +# define NL_PRODUCT_DATACENTER_A_SERVER_CORE 0x00000091 +# define NL_PRODUCT_STANDARD_A_SERVER_CORE 0x00000092 +# define NL_PRODUCT_DATACENTER_WS_SERVER_CORE 0x00000093 +# define NL_PRODUCT_STANDARD_WS_SERVER_CORE 0x00000094 +# define NL_PRODUCT_UTILITY_VM 0x00000095 +# define NL_PRODUCT_DATACENTER_EVALUATION_SERVER_CORE 0x0000009F +# define NL_PRODUCT_STANDARD_EVALUATION_SERVER_CORE 0x000000A0 +# define NL_PRODUCT_PRO_WORKSTATION 0x000000A1 +# define NL_PRODUCT_PRO_WORKSTATION_N 0x000000A2 +# define NL_PRODUCT_PRO_FOR_EDUCATION 0x000000A4 +# define NL_PRODUCT_PRO_FOR_EDUCATION_N 0x000000A5 +# define NL_PRODUCT_AZURE_SERVER_CORE 0x000000A8 +# define NL_PRODUCT_AZURE_NANO_SERVER 0x000000A9 +# define NL_PRODUCT_ENTERPRISEG 0x000000AB +# define NL_PRODUCT_ENTERPRISEGN 0x000000AC +# define NL_PRODUCT_SERVERRDSH 0x000000AF +# define NL_PRODUCT_CLOUD 0x000000B2 +# define NL_PRODUCT_CLOUDN 0x000000B3 +# define NL_PRODUCT_UNLICENSED 0xABCDABCD + #else # include # include @@ -443,544 +593,461 @@ string CSystemInfo::getOS() if (pGetProductInfo && pGetProductInfo(osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.wServicePackMajor, osvi.wServicePackMinor, &dwType)) { // Test for the specific product family. + // see https://msdn.microsoft.com/fr-fr/library/windows/desktop/ms724358(v=vs.85).aspx switch (dwType) { -#ifdef PRODUCT_UNLICENSED - case PRODUCT_UNLICENSED: + case NL_PRODUCT_UNLICENSED: OSString += " Unlicensed"; break; -#endif -#ifdef PRODUCT_ULTIMATE - case PRODUCT_ULTIMATE: + case NL_PRODUCT_ULTIMATE: OSString += " Ultimate"; break; -#endif -#ifdef PRODUCT_HOME_BASIC - case PRODUCT_HOME_BASIC: + case NL_PRODUCT_HOME_BASIC: OSString += " Home Basic"; break; -#endif -#ifdef PRODUCT_HOME_PREMIUM - case PRODUCT_HOME_PREMIUM: + case NL_PRODUCT_HOME_PREMIUM: OSString += " Home Premium"; break; -#endif -#ifdef PRODUCT_ENTERPRISE - case PRODUCT_ENTERPRISE: + case NL_PRODUCT_ENTERPRISE: OSString += " Enterprise"; break; -#endif -#ifdef PRODUCT_HOME_BASIC_N - case PRODUCT_HOME_BASIC_N: + case NL_PRODUCT_HOME_BASIC_N: OSString += " Home Basic N"; break; -#endif -#ifdef PRODUCT_BUSINESS - case PRODUCT_BUSINESS: + case NL_PRODUCT_BUSINESS: OSString += " Business"; break; -#endif -#ifdef PRODUCT_STANDARD_SERVER - case PRODUCT_STANDARD_SERVER: + case NL_PRODUCT_STANDARD_SERVER: OSString += " Server Standard"; break; -#endif -#ifdef PRODUCT_DATACENTER_SERVER - case PRODUCT_DATACENTER_SERVER: + case NL_PRODUCT_DATACENTER_SERVER: OSString += " Server Datacenter (full installation)"; break; -#endif -#ifdef PRODUCT_SMALLBUSINESS_SERVER - case PRODUCT_SMALLBUSINESS_SERVER: + case NL_PRODUCT_SMALLBUSINESS_SERVER: OSString += " Small Business Server"; break; -#endif -#ifdef PRODUCT_ENTERPRISE_SERVER - case PRODUCT_ENTERPRISE_SERVER: + case NL_PRODUCT_ENTERPRISE_SERVER: OSString += " Server Enterprise (full installation)"; break; -#endif -#ifdef PRODUCT_STARTER - case PRODUCT_STARTER: + case NL_PRODUCT_STARTER: OSString += " Starter"; break; -#endif -#ifdef PRODUCT_DATACENTER_SERVER_CORE - case PRODUCT_DATACENTER_SERVER_CORE: + case NL_PRODUCT_DATACENTER_SERVER_CORE: OSString += " Server Datacenter (core installation)"; break; -#endif -#ifdef PRODUCT_STANDARD_SERVER_CORE - case PRODUCT_STANDARD_SERVER_CORE: + case NL_PRODUCT_STANDARD_SERVER_CORE: OSString += " Server Standard (core installation)"; break; -#endif -#ifdef PRODUCT_ENTERPRISE_SERVER_CORE - case PRODUCT_ENTERPRISE_SERVER_CORE: + case NL_PRODUCT_ENTERPRISE_SERVER_CORE: OSString += " Server Enterprise (core installation)"; break; -#endif -#ifdef PRODUCT_ENTERPRISE_SERVER_IA64 - case PRODUCT_ENTERPRISE_SERVER_IA64: + case NL_PRODUCT_ENTERPRISE_SERVER_IA64: OSString += " Server Enterprise for Itanium-based Systems"; break; -#endif -#ifdef PRODUCT_BUSINESS_N - case PRODUCT_BUSINESS_N: + case NL_PRODUCT_BUSINESS_N: OSString += " Business N"; break; -#endif -#ifdef PRODUCT_WEB_SERVER - case PRODUCT_WEB_SERVER: + case NL_PRODUCT_WEB_SERVER: OSString += " Web Server (full installation)"; break; -#endif -#ifdef PRODUCT_CLUSTER_SERVER - case PRODUCT_CLUSTER_SERVER: + case NL_PRODUCT_CLUSTER_SERVER: OSString += " Server Hyper Core"; break; -#endif -#ifdef PRODUCT_HOME_SERVER - case PRODUCT_HOME_SERVER: + case NL_PRODUCT_HOME_SERVER: OSString += " Home Server"; break; -#endif -#ifdef PRODUCT_STORAGE_EXPRESS_SERVER - case PRODUCT_STORAGE_EXPRESS_SERVER: + case NL_PRODUCT_STORAGE_EXPRESS_SERVER: OSString += " Storage Server Express"; break; -#endif -#ifdef PRODUCT_STORAGE_STANDARD_SERVER - case PRODUCT_STORAGE_STANDARD_SERVER: + case NL_PRODUCT_STORAGE_STANDARD_SERVER: OSString += " Storage Server Standard"; break; -#endif -#ifdef PRODUCT_STORAGE_WORKGROUP_SERVER - case PRODUCT_STORAGE_WORKGROUP_SERVER: + case NL_PRODUCT_STORAGE_WORKGROUP_SERVER: OSString += " Storage Server Workgroup"; break; -#endif -#ifdef PRODUCT_STORAGE_ENTERPRISE_SERVER - case PRODUCT_STORAGE_ENTERPRISE_SERVER: + case NL_PRODUCT_STORAGE_ENTERPRISE_SERVER: OSString += " Storage Server Enterprise"; break; -#endif -#ifdef PRODUCT_SERVER_FOR_SMALLBUSINESS - case PRODUCT_SERVER_FOR_SMALLBUSINESS: + case NL_PRODUCT_SERVER_FOR_SMALLBUSINESS: OSString += " Essential Server Solutions"; break; -#endif -#ifdef PRODUCT_SMALLBUSINESS_SERVER_PREMIUM - case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM: + case NL_PRODUCT_SMALLBUSINESS_SERVER_PREMIUM: OSString += " Small Business Server Premium"; break; -#endif -#ifdef PRODUCT_HOME_PREMIUM_N - case PRODUCT_HOME_PREMIUM_N: + case NL_PRODUCT_HOME_PREMIUM_N: OSString += " Home Premium N"; break; -#endif -#ifdef PRODUCT_ENTERPRISE_N - case PRODUCT_ENTERPRISE_N: + case NL_PRODUCT_ENTERPRISE_N: OSString += " Enterprise N"; break; -#endif -#ifdef PRODUCT_ULTIMATE_N - case PRODUCT_ULTIMATE_N: + case NL_PRODUCT_ULTIMATE_N: OSString += " Ultimate N"; break; -#endif -#ifdef PRODUCT_WEB_SERVER_CORE - case PRODUCT_WEB_SERVER_CORE: + case NL_PRODUCT_WEB_SERVER_CORE: OSString += " Web Server (core installation)"; break; -#endif -#ifdef PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT - case PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT: + case NL_PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT: OSString += " Essential Business Server Management Server"; break; -#endif -#ifdef PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY - case PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY: + case NL_PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY: OSString += " Essential Business Server Security Server"; break; -#endif -#ifdef PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING - case PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING: + case NL_PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING: OSString += " Essential Business Server Messaging Server"; break; -#endif -#ifdef PRODUCT_SERVER_FOUNDATION - case PRODUCT_SERVER_FOUNDATION: + case NL_PRODUCT_SERVER_FOUNDATION: OSString += " Server Foundation"; break; -#endif -#ifdef PRODUCT_HOME_PREMIUM_SERVER - case PRODUCT_HOME_PREMIUM_SERVER: + case NL_PRODUCT_HOME_PREMIUM_SERVER: OSString += " Home Server"; break; -#endif -#ifdef PRODUCT_SERVER_FOR_SMALLBUSINESS_V - case PRODUCT_SERVER_FOR_SMALLBUSINESS_V: + case NL_PRODUCT_SERVER_FOR_SMALLBUSINESS_V: OSString += " Server without Hyper-V for Windows Essential Server Solutions"; break; -#endif -#ifdef PRODUCT_STANDARD_SERVER_V - case PRODUCT_STANDARD_SERVER_V: + case NL_PRODUCT_STANDARD_SERVER_V: OSString += " Server Standard without Hyper-V"; break; -#endif -#ifdef PRODUCT_DATACENTER_SERVER_V - case PRODUCT_DATACENTER_SERVER_V: + case NL_PRODUCT_DATACENTER_SERVER_V: OSString += " Server Datacenter without Hyper-V (full installation)"; break; -#endif -#ifdef PRODUCT_ENTERPRISE_SERVER_V - case PRODUCT_ENTERPRISE_SERVER_V: + case NL_PRODUCT_ENTERPRISE_SERVER_V: OSString += " Enterprise without Hyper-V (full installation)"; break; -#endif -#ifdef PRODUCT_DATACENTER_SERVER_CORE_V - case PRODUCT_DATACENTER_SERVER_CORE_V: + case NL_PRODUCT_DATACENTER_SERVER_CORE_V: OSString += " Datacenter without Hyper-V (core installation)"; break; -#endif -#ifdef PRODUCT_STANDARD_SERVER_CORE_V - case PRODUCT_STANDARD_SERVER_CORE_V: + case NL_PRODUCT_STANDARD_SERVER_CORE_V: OSString += " Standard without Hyper-V (core installation)"; break; -#endif -#ifdef PRODUCT_ENTERPRISE_SERVER_CORE_V - case PRODUCT_ENTERPRISE_SERVER_CORE_V: + case NL_PRODUCT_ENTERPRISE_SERVER_CORE_V: OSString += " Enterprise without Hyper-V (core installation)"; break; -#endif -#ifdef PRODUCT_HYPERV - case PRODUCT_HYPERV: + case NL_PRODUCT_HYPERV: OSString += " Hyper-V Server"; break; -#endif -#ifdef PRODUCT_STORAGE_EXPRESS_SERVER_CORE - case PRODUCT_STORAGE_EXPRESS_SERVER_CORE: + case NL_PRODUCT_STORAGE_EXPRESS_SERVER_CORE: OSString += " Storage Server Express (core installation)"; break; -#endif -#ifdef PRODUCT_STORAGE_STANDARD_SERVER_CORE - case PRODUCT_STORAGE_STANDARD_SERVER_CORE: + case NL_PRODUCT_STORAGE_STANDARD_SERVER_CORE: OSString += " Storage Server Standard (core installation)"; break; -#endif -#ifdef PRODUCT_STORAGE_WORKGROUP_SERVER_CORE - case PRODUCT_STORAGE_WORKGROUP_SERVER_CORE: + case NL_PRODUCT_STORAGE_WORKGROUP_SERVER_CORE: OSString += " Storage Server Workgroup (core installation)"; break; -#endif -#ifdef PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE - case PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE: + case NL_PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE: OSString += " Storage Server Enterprise (core installation)"; break; -#endif -#ifdef PRODUCT_STARTER_N - case PRODUCT_STARTER_N: + case NL_PRODUCT_STARTER_N: OSString += " Starter N Edition"; break; -#endif -#ifdef PRODUCT_PROFESSIONAL - case PRODUCT_PROFESSIONAL: + case NL_PRODUCT_PROFESSIONAL: OSString += " Professional"; break; -#endif -#ifdef PRODUCT_PROFESSIONAL_N - case PRODUCT_PROFESSIONAL_N: + case NL_PRODUCT_PROFESSIONAL_N: OSString += " Professional N"; break; -#endif -#ifdef PRODUCT_SB_SOLUTION_SERVER - case PRODUCT_SB_SOLUTION_SERVER: + case NL_PRODUCT_SB_SOLUTION_SERVER: OSString += " Small Business Server"; break; -#endif -#ifdef PRODUCT_SERVER_FOR_SB_SOLUTIONS - case PRODUCT_SERVER_FOR_SB_SOLUTIONS: + case NL_PRODUCT_SERVER_FOR_SB_SOLUTIONS: OSString += " Server For Small Business Solutions"; break; -#endif -#ifdef PRODUCT_STANDARD_SERVER_SOLUTIONS - case PRODUCT_STANDARD_SERVER_SOLUTIONS: + case NL_PRODUCT_STANDARD_SERVER_SOLUTIONS: OSString += " Server Solutions Premium"; break; -#endif -#ifdef PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE - case PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE: + case NL_PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE: OSString += " Server Solutions Premium (core installation)"; break; -#endif -#ifdef PRODUCT_SB_SOLUTION_SERVER_EM - case PRODUCT_SB_SOLUTION_SERVER_EM: + case NL_PRODUCT_SB_SOLUTION_SERVER_EM: OSString += " Server For Small Business Solutions EM"; break; -#endif -#ifdef PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM - case PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM: + case NL_PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM: OSString += " Server For Small Business Solutions EM"; break; -#endif - -#ifdef PRODUCT_SOLUTION_EMBEDDEDSERVER - case PRODUCT_SOLUTION_EMBEDDEDSERVER: + case NL_PRODUCT_SOLUTION_EMBEDDEDSERVER: OSString += " Solution Embedded Server (full installation)"; break; -#endif -#ifdef PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE - case PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE: + case NL_PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE: OSString += " Solution Embedded Server (core installation)"; break; -#endif -#ifdef PRODUCT_PROFESSIONAL_EMBEDDED - case PRODUCT_PROFESSIONAL_EMBEDDED: + case NL_PRODUCT_PROFESSIONAL_EMBEDDED: OSString += " Professional Embedded"; break; -#endif -#ifdef PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT - case PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT: + case NL_PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT: OSString += " Essential Server Solution Management"; break; -#endif -#ifdef PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL - case PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL: + case NL_PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL: OSString += " Essential Server Solution Additional"; break; -#endif -#ifdef PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC - case PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC: + case NL_PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC: OSString += " Essential Server Solution Management SVC"; break; -#endif -#ifdef PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC - case PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC: + case NL_PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC: OSString += " Essential Server Solution Additional SVC"; break; -#endif -#ifdef PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE - case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE: + case NL_PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE: OSString += " Small Business Server Premium (core installation)"; break; -#endif -#ifdef PRODUCT_CLUSTER_SERVER_V - case PRODUCT_CLUSTER_SERVER_V: + case NL_PRODUCT_CLUSTER_SERVER_V: OSString += " Server Hyper Core V"; break; -#endif -#ifdef PRODUCT_EMBEDDED - case PRODUCT_EMBEDDED: + case NL_PRODUCT_EMBEDDED: OSString += " Embedded"; break; -#endif -#ifdef PRODUCT_STARTER_E - case PRODUCT_STARTER_E: + case NL_PRODUCT_STARTER_E: OSString += " Starter E"; break; -#endif -#ifdef PRODUCT_HOME_BASIC_E - case PRODUCT_HOME_BASIC_E: + case NL_PRODUCT_HOME_BASIC_E: OSString += " Home Basic E"; break; -#endif -#ifdef PRODUCT_HOME_PREMIUM_E - case PRODUCT_HOME_PREMIUM_E: + case NL_PRODUCT_HOME_PREMIUM_E: OSString += " Home Premium E"; break; -#endif -#ifdef PRODUCT_PROFESSIONAL_E - case PRODUCT_PROFESSIONAL_E: + case NL_PRODUCT_PROFESSIONAL_E: OSString += " Professional E"; break; -#endif -#ifdef PRODUCT_ENTERPRISE_E - case PRODUCT_ENTERPRISE_E: + case NL_PRODUCT_ENTERPRISE_E: OSString += " Enterprise E"; break; -#endif -#ifdef PRODUCT_ULTIMATE_E - case PRODUCT_ULTIMATE_E: + case NL_PRODUCT_ULTIMATE_E: OSString += " Ultimate E"; break; -#endif -#ifdef PRODUCT_ENTERPRISE_EVALUATION - case PRODUCT_ENTERPRISE_EVALUATION: + case NL_PRODUCT_ENTERPRISE_EVALUATION: OSString += " Enterprise Evaluation"; break; -#endif -#ifdef PRODUCT_MULTIPOINT_STANDARD_SERVER - case PRODUCT_MULTIPOINT_STANDARD_SERVER: + // nothing from 0x49 to 0x4b + case NL_PRODUCT_MULTIPOINT_STANDARD_SERVER: OSString += " MultiPoint Server Standard (full installation)"; break; -#endif -#ifdef PRODUCT_MULTIPOINT_PREMIUM_SERVER - case PRODUCT_MULTIPOINT_PREMIUM_SERVER: + case NL_PRODUCT_MULTIPOINT_PREMIUM_SERVER: OSString += " MultiPoint Server Premium (full installation)"; break; -#endif -#ifdef PRODUCT_STANDARD_EVALUATION_SERVER - case PRODUCT_STANDARD_EVALUATION_SERVER: + case NL_PRODUCT_STANDARD_EVALUATION_SERVER: OSString += " Server Standard (evaluation installation)"; break; -#endif -#ifdef PRODUCT_DATACENTER_EVALUATION_SERVER - case PRODUCT_DATACENTER_EVALUATION_SERVER: + case NL_PRODUCT_DATACENTER_EVALUATION_SERVER: OSString += " Server Datacenter (evaluation installation)"; break; -#endif -#ifdef PRODUCT_ENTERPRISE_N_EVALUATION - case PRODUCT_ENTERPRISE_N_EVALUATION: + // nothing from 0x51 to 0x53 + case NL_PRODUCT_ENTERPRISE_N_EVALUATION: OSString += " Enterprise N (evaluation installation)"; break; -#endif -#ifdef PRODUCT_EMBEDDED_AUTOMOTIVE - case PRODUCT_EMBEDDED_AUTOMOTIVE: + case NL_PRODUCT_EMBEDDED_AUTOMOTIVE: OSString += " Embedded Automotive"; break; -#endif -#ifdef PRODUCT_EMBEDDED_INDUSTRY_A - case PRODUCT_EMBEDDED_INDUSTRY_A: + case NL_PRODUCT_EMBEDDED_INDUSTRY_A: OSString += " Embedded Industry A"; break; -#endif -#ifdef PRODUCT_THINPC - case PRODUCT_THINPC: + case NL_PRODUCT_THINPC: OSString += " Thin PC"; break; -#endif -#ifdef PRODUCT_EMBEDDED_A - case PRODUCT_EMBEDDED_A: + case NL_PRODUCT_EMBEDDED_A: OSString += " Embedded A"; break; -#endif -#ifdef PRODUCT_EMBEDDED_INDUSTRY - case PRODUCT_EMBEDDED_INDUSTRY: + case NL_PRODUCT_EMBEDDED_INDUSTRY: OSString += " Embedded Industry"; break; -#endif -#ifdef PRODUCT_EMBEDDED_E - case PRODUCT_EMBEDDED_E: + case NL_PRODUCT_EMBEDDED_E: OSString += " Embedded E"; break; -#endif -#ifdef PRODUCT_EMBEDDED_INDUSTRY_E - case PRODUCT_EMBEDDED_INDUSTRY_E: + case NL_PRODUCT_EMBEDDED_INDUSTRY_E: OSString += " Embedded Industry E"; break; -#endif -#ifdef PRODUCT_EMBEDDED_INDUSTRY_A_E - case PRODUCT_EMBEDDED_INDUSTRY_A_E: + case NL_PRODUCT_EMBEDDED_INDUSTRY_A_E: OSString += " Embedded Industry A E"; break; -#endif -#ifdef PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER - case PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER: + // nothing from 0x5d to 0x5e + case NL_PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER: OSString += " Storage Server Workgroup (evaluation installation)"; break; -#endif -#ifdef PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER - case PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER: + case NL_PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER: OSString += " Storage Server Standard (evaluation installation)"; break; -#endif -#ifdef PRODUCT_CORE_ARM - case PRODUCT_CORE_ARM: + case NL_PRODUCT_CORE_ARM: OSString += " RT"; break; -#endif -#ifdef PRODUCT_CORE_N - case PRODUCT_CORE_N: + case NL_PRODUCT_CORE_N: OSString += " Home N"; break; -#endif -#ifdef PRODUCT_CORE_COUNTRYSPECIFIC - case PRODUCT_CORE_COUNTRYSPECIFIC: + case NL_PRODUCT_CORE_COUNTRYSPECIFIC: OSString += " Home China"; break; -#endif -#ifdef PRODUCT_CORE_SINGLELANGUAGE - case PRODUCT_CORE_SINGLELANGUAGE: + case NL_PRODUCT_CORE_SINGLELANGUAGE: OSString += " Home Single Language"; break; -#endif -#ifdef PRODUCT_CORE - case PRODUCT_CORE: + case NL_PRODUCT_CORE: OSString += " Home"; break; -#endif -#ifdef PRODUCT_PROFESSIONAL_WMC - case PRODUCT_PROFESSIONAL_WMC: + // nothing at 0x66 + case NL_PRODUCT_PROFESSIONAL_WMC: OSString += " Professional with Media Center"; break; -#endif -#ifdef PRODUCT_MOBILE_CORE - case PRODUCT_MOBILE_CORE: + case NL_PRODUCT_MOBILE_CORE: OSString += " Mobile"; break; -#endif -#ifdef PRODUCT_EMBEDDED_INDUSTRY_EVAL - case PRODUCT_EMBEDDED_INDUSTRY_EVAL: + case NL_PRODUCT_EMBEDDED_INDUSTRY_EVAL: OSString += " Embedded Industry (evaluation installation)"; break; -#endif -#ifdef PRODUCT_EMBEDDED_INDUSTRY_E_EVAL - case PRODUCT_EMBEDDED_INDUSTRY_E_EVAL: + case NL_PRODUCT_EMBEDDED_INDUSTRY_E_EVAL: OSString += " Embedded Industry E (evaluation installation)"; break; -#endif -#ifdef PRODUCT_EMBEDDED_EVAL - case PRODUCT_EMBEDDED_EVAL: + case NL_PRODUCT_EMBEDDED_EVAL: OSString += " Embedded (evaluation installation)"; break; -#endif -#ifdef PRODUCT_EMBEDDED_E_EVAL - case PRODUCT_EMBEDDED_E_EVAL: + case NL_PRODUCT_EMBEDDED_E_EVAL: OSString += " Embedded E (evaluation installation)"; break; -#endif -#ifdef PRODUCT_CORE_SERVER - case PRODUCT_CORE_SERVER: + case NL_PRODUCT_CORE_SERVER: OSString += " Server"; break; -#endif -#ifdef PRODUCT_CLOUD_STORAGE_SERVER - case PRODUCT_CLOUD_STORAGE_SERVER: + case NL_PRODUCT_CLOUD_STORAGE_SERVER: OSString += " Server Could Storage"; break; -#endif -#ifdef PRODUCT_CORE_CONNECTED - case PRODUCT_CORE_CONNECTED: + case NL_PRODUCT_CORE_CONNECTED: OSString += " Home Connected"; break; -#endif -#ifdef PRODUCT_PROFESSIONAL_STUDENT - case PRODUCT_PROFESSIONAL_STUDENT: + case NL_PRODUCT_PROFESSIONAL_STUDENT: OSString += " Professional Student"; break; -#endif -#ifdef PRODUCT_CORE_CONNECTED_N - case PRODUCT_CORE_CONNECTED_N: + case NL_PRODUCT_CORE_CONNECTED_N: OSString += " Home N Connected"; break; -#endif -#ifdef PRODUCT_PROFESSIONAL_STUDENT_N - case PRODUCT_PROFESSIONAL_STUDENT_N: + case NL_PRODUCT_PROFESSIONAL_STUDENT_N: OSString += " Professional Student N"; break; -#endif -#ifdef PRODUCT_CORE_CONNECTED_SINGLELANGUAGE - case PRODUCT_CORE_CONNECTED_SINGLELANGUAGE: + case NL_PRODUCT_CORE_CONNECTED_SINGLELANGUAGE: OSString += " Home Single Language Connected"; break; -#endif -#ifdef PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC - case PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC: + case NL_PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC: OSString += " Home China Connected"; break; -#endif + case NL_PRODUCT_CONNECTED_CAR: + OSString += " Connected Car"; + break; + case NL_PRODUCT_INDUSTRY_HANDHELD: + OSString += " Industry Handheld"; + break; + case NL_PRODUCT_PPI_PRO: + OSString += " PPI Pro"; + break; + case NL_PRODUCT_ARM64_SERVER: + OSString += " ARM64 Server"; + break; + case NL_PRODUCT_EDUCATION: + OSString += " Education"; + break; + case NL_PRODUCT_EDUCATION_N: + OSString += " Education N"; + break; + case NL_PRODUCT_IOTUAP: + OSString += " IoT Core"; + break; + case NL_PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER: + OSString += " Cloud Host Infrastructure Server"; + break; + case NL_PRODUCT_ENTERPRISE_S: + OSString += " Product Enterprise S"; + break; + case NL_PRODUCT_ENTERPRISE_S_N: + OSString += " Enterprise S N"; + break; + case NL_PRODUCT_PROFESSIONAL_S: + OSString += " Professional S"; + break; + case NL_PRODUCT_PROFESSIONAL_S_N: + OSString += " Professional S N"; + break; + case NL_PRODUCT_ENTERPRISE_S_EVALUATION: + OSString += " Enterprise S Evaluation"; + break; + case NL_PRODUCT_ENTERPRISE_S_N_EVALUATION: + OSString += " Enterprise S N Evaluation"; + break; + // nothing from x83 to 0x86 + case NL_PRODUCT_HOLOGRAPHIC: + OSString += " Holographic"; + break; + // nothing from x88 to 0x89 + case NL_PRODUCT_PRO_SINGLE_LANGUAGE: + OSString += " Pro Single Language"; + break; + case NL_PRODUCT_PRO_CHINA: + OSString += " Pro China"; + break; + case NL_PRODUCT_ENTERPRISE_SUBSCRIPTION: + OSString += " Enterprise Subscription"; + break; + case NL_PRODUCT_ENTERPRISE_SUBSCRIPTION_N: + OSString += " Enterprise Subscription N"; + break; + // nothing at 0x8e + case NL_PRODUCT_DATACENTER_NANO_SERVER: + OSString += " Datacenter Nano Server"; + break; + case NL_PRODUCT_STANDARD_NANO_SERVER: + OSString += " Standard Nano Server"; + break; + case NL_PRODUCT_DATACENTER_A_SERVER_CORE: + OSString += " Datacenter A Server Core"; + break; + case NL_PRODUCT_STANDARD_A_SERVER_CORE: + OSString += " Standard A Server Core"; + break; + case NL_PRODUCT_DATACENTER_WS_SERVER_CORE: + OSString += " Datacenter WS Server Core"; + break; + case NL_PRODUCT_STANDARD_WS_SERVER_CORE: + OSString += " Standard WS Server Core"; + break; + case NL_PRODUCT_UTILITY_VM: + OSString += " Utility VM"; + break; + // nothing from 0x96 to 0x9e + case NL_PRODUCT_DATACENTER_EVALUATION_SERVER_CORE: + OSString += " Datacenter_evaluation_server_core"; + break; + case NL_PRODUCT_STANDARD_EVALUATION_SERVER_CORE: + OSString += " Standard Evaluation Server Core"; + break; + case NL_PRODUCT_PRO_WORKSTATION: + OSString += " Pro Workstation"; + break; + case NL_PRODUCT_PRO_WORKSTATION_N: + OSString += " Pro Workstation N"; + break; + // nothing at 0xa3 + case NL_PRODUCT_PRO_FOR_EDUCATION: + OSString += " Pro for Education"; + break; + case NL_PRODUCT_PRO_FOR_EDUCATION_N: + OSString += " Pro for Education N"; + break; + // nothing from 0xa6 to 0xa7 + case NL_PRODUCT_AZURE_SERVER_CORE: + OSString += " Azure Server Core"; + break; + case NL_PRODUCT_AZURE_NANO_SERVER: + OSString += " Azure Nano Server"; + break; + // nothing at 0xaa + case NL_PRODUCT_ENTERPRISEG: + OSString += " Enterprise G"; + break; + case NL_PRODUCT_ENTERPRISEGN: + OSString += " Enterprise GN"; + break; + // nothing from 0xad to 0xae + case NL_PRODUCT_SERVERRDSH: + OSString += " Server RDSH"; + break; + // nothing from 0xb0 to 0xb1 + case NL_PRODUCT_CLOUD: + OSString += " Cloud"; + break; + case NL_PRODUCT_CLOUDN: + OSString += " Cloud N"; + break; + default: OSString += toString(" Unknown Edition (0x%04x)", dwType); } From f1cdcd1654e9522e347001a0c1918f36b23b506a Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 5 Nov 2017 18:30:30 +0100 Subject: [PATCH 13/63] Changed: More memory leaks detection --HG-- branch : develop --- code/nel/src/net/buf_client.cpp | 4 +++ code/nel/src/net/inet_address.cpp | 4 +++ code/nel/src/net/module.cpp | 4 +++ code/nel/src/net/stdnet.h | 34 +++++++++++-------- code/nel/src/net/transport_class.cpp | 3 ++ code/nel/src/pacs/surface_quad.cpp | 4 +++ code/nel/src/sound/audio_mixer_user.cpp | 4 +++ code/nel/src/sound/sound_bank.cpp | 4 +++ code/nel/src/sound/stdsound.h | 17 ++++++++-- code/ryzom/client/src/far_tp.cpp | 6 ++++ code/ryzom/client/src/ig_callback.cpp | 3 ++ code/ryzom/client/src/init.cpp | 4 +++ .../src/interface_v3/action_phrase_faber.cpp | 4 +++ .../ryzom/client/src/motion/user_controls.cpp | 3 ++ code/ryzom/client/src/movie_shooter.cpp | 3 ++ code/ryzom/client/src/net_manager.cpp | 3 ++ code/ryzom/client/src/network_connection.cpp | 11 ++++++ code/ryzom/client/src/pacs_client.cpp | 4 +++ code/ryzom/client/src/scalable_time.cpp | 4 +++ code/ryzom/client/src/session_browser.cpp | 4 +++ .../ryzom/client/src/session_browser_impl.cpp | 4 +++ code/ryzom/client/src/sheet_manager.cpp | 3 ++ code/ryzom/client/src/sky.cpp | 4 +++ code/ryzom/client/src/sky_material_setup.cpp | 4 +++ code/ryzom/client/src/sky_object.cpp | 4 +++ code/ryzom/client/src/sky_render.cpp | 3 ++ code/ryzom/client/src/sound_manager.cpp | 4 +++ code/ryzom/client/src/stage.cpp | 3 ++ code/ryzom/client/src/streamable_entity.cpp | 3 ++ .../src/streamable_entity_composite.cpp | 4 +++ code/ryzom/client/src/streamable_ig.cpp | 4 +++ .../client/src/string_manager_client.cpp | 4 +++ code/ryzom/client/src/teleport.cpp | 3 ++ code/ryzom/client/src/text_manager.cpp | 4 +++ code/ryzom/client/src/time_client.cpp | 3 ++ code/ryzom/client/src/timed_fx_manager.cpp | 4 +-- code/ryzom/client/src/user_agent.cpp | 4 +++ code/ryzom/client/src/user_entity.cpp | 4 +++ code/ryzom/client/src/view.cpp | 4 +++ code/ryzom/client/src/village.cpp | 4 +++ code/ryzom/client/src/water_env_map_rdr.cpp | 4 +++ code/ryzom/client/src/water_map.cpp | 3 ++ code/ryzom/client/src/weather.cpp | 3 ++ .../client/src/weather_manager_client.cpp | 4 +++ .../ryzom/client/src/weather_setup_client.cpp | 3 ++ .../client/src/world_database_manager.cpp | 3 ++ code/ryzom/client/src/zone_util.cpp | 3 ++ code/ryzom/common/src/game_share/dms.cpp | 3 ++ code/ryzom/common/src/game_share/dyn_chat.cpp | 4 +++ code/ryzom/common/src/game_share/fame.cpp | 4 +++ .../src/game_share/generic_xml_msg_mngr.cpp | 4 +++ code/ryzom/common/src/game_share/mirror.cpp | 4 +++ .../src/game_share/mirror_prop_value.cpp | 3 ++ code/ryzom/common/src/game_share/object.cpp | 4 +++ .../src/game_share/persistent_data_tree.cpp | 3 ++ .../common/src/game_share/ring_access.cpp | 3 ++ code/ryzom/common/src/game_share/scenario.cpp | 4 +++ .../src/game_share/server_edition_module.cpp | 3 ++ code/ryzom/common/src/game_share/simlag.cpp | 4 +++ code/ryzom/common/src/game_share/stdpch.h | 13 ++++++- .../src/game_share/visual_slot_manager.cpp | 4 +++ 61 files changed, 264 insertions(+), 20 deletions(-) diff --git a/code/nel/src/net/buf_client.cpp b/code/nel/src/net/buf_client.cpp index 350b2d6db..18ce7babf 100644 --- a/code/nel/src/net/buf_client.cpp +++ b/code/nel/src/net/buf_client.cpp @@ -32,6 +32,10 @@ # include #endif +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; using namespace std; diff --git a/code/nel/src/net/inet_address.cpp b/code/nel/src/net/inet_address.cpp index 093bf8dcb..13ae02c39 100644 --- a/code/nel/src/net/inet_address.cpp +++ b/code/nel/src/net/inet_address.cpp @@ -121,6 +121,10 @@ BOOLEAN IN6_IS_ADDR_UNSPECIFIED(CONST IN6_ADDR *a) using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + #ifndef NI_MAXHOST # define NI_MAXHOST 1025 #endif diff --git a/code/nel/src/net/module.cpp b/code/nel/src/net/module.cpp index 73a1c7867..1b5e03bec 100644 --- a/code/nel/src/net/module.cpp +++ b/code/nel/src/net/module.cpp @@ -24,6 +24,10 @@ #include "nel/net/module_gateway.h" #include "nel/net/module_socket.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; using namespace NLNET; diff --git a/code/nel/src/net/stdnet.h b/code/nel/src/net/stdnet.h index 16e87c9f8..6ced991a5 100644 --- a/code/nel/src/net/stdnet.h +++ b/code/nel/src/net/stdnet.h @@ -17,20 +17,11 @@ #ifndef NL_STDNET_H #define NL_STDNET_H -#include "nel/misc/types_nl.h" - -#ifdef NL_OS_WINDOWS -# define WIN32_LEAN_AND_MEAN -# define _WIN32_WINDOWS 0x0500 -# ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0500 -# endif -# ifndef NL_COMP_MINGW -# define WINVER 0x0500 -# define NOMINMAX -# endif -# include -# include +#if defined(_MSC_VER) && defined(_DEBUG) +#define _CRTDBG_MAP_ALLOC +#include +#include +#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) #endif #include @@ -55,6 +46,7 @@ #include +#include "nel/misc/types_nl.h" #include "nel/misc/debug.h" #include "nel/misc/common.h" #include "nel/misc/stream.h" @@ -64,4 +56,18 @@ #include "nel/misc/mem_stream.h" #include "nel/misc/hierarchical_timer.h" +#ifdef NL_OS_WINDOWS +# define WIN32_LEAN_AND_MEAN +# define _WIN32_WINDOWS 0x0500 +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0500 +# endif +# ifndef NL_COMP_MINGW +# define WINVER 0x0500 +# define NOMINMAX +# endif +# include +# include +#endif + #endif diff --git a/code/nel/src/net/transport_class.cpp b/code/nel/src/net/transport_class.cpp index 810ea6928..9dade0190 100644 --- a/code/nel/src/net/transport_class.cpp +++ b/code/nel/src/net/transport_class.cpp @@ -33,6 +33,9 @@ #include "nel/net/transport_class.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif // // Namespace diff --git a/code/nel/src/pacs/surface_quad.cpp b/code/nel/src/pacs/surface_quad.cpp index dade8462c..308dc0054 100644 --- a/code/nel/src/pacs/surface_quad.cpp +++ b/code/nel/src/pacs/surface_quad.cpp @@ -19,6 +19,10 @@ #include "nel/misc/file.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; using namespace std; diff --git a/code/nel/src/sound/audio_mixer_user.cpp b/code/nel/src/sound/audio_mixer_user.cpp index 5a21650e0..854a2c1dc 100644 --- a/code/nel/src/sound/audio_mixer_user.cpp +++ b/code/nel/src/sound/audio_mixer_user.cpp @@ -56,6 +56,10 @@ #include "nel/sound/containers.h" #include "nel/sound/audio_decoder.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/sound/sound_bank.cpp b/code/nel/src/sound/sound_bank.cpp index ee00e1742..29621d337 100644 --- a/code/nel/src/sound/sound_bank.cpp +++ b/code/nel/src/sound/sound_bank.cpp @@ -33,6 +33,10 @@ #include "nel/georges/load_form.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; using namespace NLGEORGES; diff --git a/code/nel/src/sound/stdsound.h b/code/nel/src/sound/stdsound.h index 071e2c70c..474e64441 100644 --- a/code/nel/src/sound/stdsound.h +++ b/code/nel/src/sound/stdsound.h @@ -14,9 +14,15 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include "nel/misc/types_nl.h" -#include "nel/misc/common.h" -#include "nel/misc/debug.h" +#ifndef SOUND_STDPCH_H +#define SOUND_STDPCH_H + +#if defined(_MSC_VER) && defined(_DEBUG) +#define _CRTDBG_MAP_ALLOC +#include +#include +#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) +#endif #include #include @@ -40,6 +46,11 @@ #include +#include "nel/misc/types_nl.h" +#include "nel/misc/common.h" +#include "nel/misc/debug.h" #include "nel/misc/vector.h" #include "nel/misc/path.h" #include "nel/misc/file.h" + +#endif diff --git a/code/ryzom/client/src/far_tp.cpp b/code/ryzom/client/src/far_tp.cpp index bafb62103..577477ea2 100644 --- a/code/ryzom/client/src/far_tp.cpp +++ b/code/ryzom/client/src/far_tp.cpp @@ -45,6 +45,12 @@ #include "login_progress_post_thread.h" #include "interface_v3/action_handler_base.h" #include "item_group_manager.h" + +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + + using namespace NLMISC; using namespace NLNET; using namespace NL3D; diff --git a/code/ryzom/client/src/ig_callback.cpp b/code/ryzom/client/src/ig_callback.cpp index 49b790d77..bf7b41625 100644 --- a/code/ryzom/client/src/ig_callback.cpp +++ b/code/ryzom/client/src/ig_callback.cpp @@ -45,6 +45,9 @@ #include "client_sheets/plant_sheet.h" #include +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif #define RZ_PRIM_ZEXT_BLOCK_AVOIDANCE 2.0f diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index 244ef3384..6fc794d52 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -114,6 +114,10 @@ extern HWND SlashScreen; #include +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + /////////// // USING // /////////// diff --git a/code/ryzom/client/src/interface_v3/action_phrase_faber.cpp b/code/ryzom/client/src/interface_v3/action_phrase_faber.cpp index d872f4553..11f0b1b88 100644 --- a/code/ryzom/client/src/interface_v3/action_phrase_faber.cpp +++ b/code/ryzom/client/src/interface_v3/action_phrase_faber.cpp @@ -35,6 +35,10 @@ #include "skill_manager.h" #include "game_share/bot_chat_types.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/ryzom/client/src/motion/user_controls.cpp b/code/ryzom/client/src/motion/user_controls.cpp index 897cba9c1..a3a4751e7 100644 --- a/code/ryzom/client/src/motion/user_controls.cpp +++ b/code/ryzom/client/src/motion/user_controls.cpp @@ -37,6 +37,9 @@ // #include "../r2/editor.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif /////////// // Using // diff --git a/code/ryzom/client/src/movie_shooter.cpp b/code/ryzom/client/src/movie_shooter.cpp index 0bf6015bf..1358a20c4 100644 --- a/code/ryzom/client/src/movie_shooter.cpp +++ b/code/ryzom/client/src/movie_shooter.cpp @@ -31,6 +31,9 @@ #include "nel/misc/debug.h" #include "nel/misc/system_info.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif /////////// // USING // diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index 42285a167..d2789d2b9 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -89,6 +89,9 @@ // Std. #include +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif #define OLD_STRING_SYSTEM #define BAR_STEP_TP 2 diff --git a/code/ryzom/client/src/network_connection.cpp b/code/ryzom/client/src/network_connection.cpp index 2638f4162..730cb3477 100644 --- a/code/ryzom/client/src/network_connection.cpp +++ b/code/ryzom/client/src/network_connection.cpp @@ -98,6 +98,11 @@ using namespace CLFECOMMON; #include #include #include + +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + // Stat: array of vectors of cycles when a pos is received, indexed by TCLEntityId struct TRDateState { @@ -215,6 +220,12 @@ NLMISC_COMMAND( displayReceiveLog, "Flush the receive log into ReceiveLog.log", return true; } +#else + +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + #endif // MEASURE_RECEIVE_DATES extern NL3D::UDriver *Driver; diff --git a/code/ryzom/client/src/pacs_client.cpp b/code/ryzom/client/src/pacs_client.cpp index 8e622d410..c021f7c1c 100644 --- a/code/ryzom/client/src/pacs_client.cpp +++ b/code/ryzom/client/src/pacs_client.cpp @@ -27,6 +27,10 @@ #include "ig_callback.h" #include "ig_client.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + /////////// // USING // /////////// diff --git a/code/ryzom/client/src/scalable_time.cpp b/code/ryzom/client/src/scalable_time.cpp index dac59e198..9beb70795 100644 --- a/code/ryzom/client/src/scalable_time.cpp +++ b/code/ryzom/client/src/scalable_time.cpp @@ -21,6 +21,10 @@ #include "time_client.h" #include "nel/misc/time_nl.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + // ************************************************************************************************* CScalableTime::CScalableTime() { diff --git a/code/ryzom/client/src/session_browser.cpp b/code/ryzom/client/src/session_browser.cpp index 46ef37a0a..e2fa97c6d 100644 --- a/code/ryzom/client/src/session_browser.cpp +++ b/code/ryzom/client/src/session_browser.cpp @@ -20,6 +20,10 @@ #include "game_share/r2_share_itf.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; using namespace NLNET; diff --git a/code/ryzom/client/src/session_browser_impl.cpp b/code/ryzom/client/src/session_browser_impl.cpp index 9e82a6d15..9762c4a90 100644 --- a/code/ryzom/client/src/session_browser_impl.cpp +++ b/code/ryzom/client/src/session_browser_impl.cpp @@ -34,6 +34,10 @@ // #include "game_share/shard_names.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; using namespace RSMGR; diff --git a/code/ryzom/client/src/sheet_manager.cpp b/code/ryzom/client/src/sheet_manager.cpp index 38a185d15..1c7f1f5ca 100644 --- a/code/ryzom/client/src/sheet_manager.cpp +++ b/code/ryzom/client/src/sheet_manager.cpp @@ -40,6 +40,9 @@ // Game Share #include "game_share/visual_slot_manager.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif /////////// // USING // diff --git a/code/ryzom/client/src/sky.cpp b/code/ryzom/client/src/sky.cpp index 9b3474ada..eb7f70d7c 100644 --- a/code/ryzom/client/src/sky.cpp +++ b/code/ryzom/client/src/sky.cpp @@ -19,6 +19,10 @@ #include "sky.h" #include "client_sheets/sky_sheet.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NL3D; using namespace NLMISC; diff --git a/code/ryzom/client/src/sky_material_setup.cpp b/code/ryzom/client/src/sky_material_setup.cpp index 8ee2d2a27..10074ba6b 100644 --- a/code/ryzom/client/src/sky_material_setup.cpp +++ b/code/ryzom/client/src/sky_material_setup.cpp @@ -22,6 +22,10 @@ #include "nel/3d/u_instance_material.h" #include "sky_material_setup.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NL3D; H_AUTO_DECL(RZ_SkyMaterialSetup) diff --git a/code/ryzom/client/src/sky_object.cpp b/code/ryzom/client/src/sky_object.cpp index ad6b7615f..94185ef93 100644 --- a/code/ryzom/client/src/sky_object.cpp +++ b/code/ryzom/client/src/sky_object.cpp @@ -26,6 +26,10 @@ #include "sky_object.h" #include "sky.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; using namespace NL3D; diff --git a/code/ryzom/client/src/sky_render.cpp b/code/ryzom/client/src/sky_render.cpp index fc3f3b09f..e917d3680 100644 --- a/code/ryzom/client/src/sky_render.cpp +++ b/code/ryzom/client/src/sky_render.cpp @@ -32,6 +32,9 @@ #include "light_cycle_manager.h" #include "global.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif H_AUTO_DECL(RZ_SkyRender) diff --git a/code/ryzom/client/src/sound_manager.cpp b/code/ryzom/client/src/sound_manager.cpp index 5c1f49b1c..8a91c81ff 100644 --- a/code/ryzom/client/src/sound_manager.cpp +++ b/code/ryzom/client/src/sound_manager.cpp @@ -53,6 +53,10 @@ # include "view.h" #endif +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + extern CLightCycleManager LightCycleManager; extern NL3D::UDriver *Driver; extern NL3D::UCamera MainCam; diff --git a/code/ryzom/client/src/stage.cpp b/code/ryzom/client/src/stage.cpp index 9211f3d6c..05db01768 100644 --- a/code/ryzom/client/src/stage.cpp +++ b/code/ryzom/client/src/stage.cpp @@ -24,6 +24,9 @@ #include "stage.h" #include "game_share/entity_types.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif /////////// // USING // diff --git a/code/ryzom/client/src/streamable_entity.cpp b/code/ryzom/client/src/streamable_entity.cpp index f1c19efd9..1bba624dc 100644 --- a/code/ryzom/client/src/streamable_entity.cpp +++ b/code/ryzom/client/src/streamable_entity.cpp @@ -19,6 +19,9 @@ #include "stdpch.h" #include "streamable_entity.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif H_AUTO_DECL(RZ_StreamableEntity) diff --git a/code/ryzom/client/src/streamable_entity_composite.cpp b/code/ryzom/client/src/streamable_entity_composite.cpp index ae9f1998e..01e4aff17 100644 --- a/code/ryzom/client/src/streamable_entity_composite.cpp +++ b/code/ryzom/client/src/streamable_entity_composite.cpp @@ -21,6 +21,10 @@ #include "streamable_entity_composite.h" #include "nel/misc/progress_callback.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + H_AUTO_DECL(RZ_StremableEntityComposite) //=============================================================================== diff --git a/code/ryzom/client/src/streamable_ig.cpp b/code/ryzom/client/src/streamable_ig.cpp index e93b62c4c..eaaea24f5 100644 --- a/code/ryzom/client/src/streamable_ig.cpp +++ b/code/ryzom/client/src/streamable_ig.cpp @@ -28,6 +28,10 @@ #include "streamable_ig.h" #include "continent_manager.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + extern CContinentManager ContinentMngr; H_AUTO_DECL(RZ_StremableIG) diff --git a/code/ryzom/client/src/string_manager_client.cpp b/code/ryzom/client/src/string_manager_client.cpp index b4edce7e1..cf83a1e0a 100644 --- a/code/ryzom/client/src/string_manager_client.cpp +++ b/code/ryzom/client/src/string_manager_client.cpp @@ -27,6 +27,10 @@ #include "misc.h" #include "entity_cl.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/ryzom/client/src/teleport.cpp b/code/ryzom/client/src/teleport.cpp index c85c938fa..60d96c794 100644 --- a/code/ryzom/client/src/teleport.cpp +++ b/code/ryzom/client/src/teleport.cpp @@ -29,6 +29,9 @@ #include "nel/georges/u_form_elm.h" #include "nel/georges/u_form_loader.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif /////////// // USING // diff --git a/code/ryzom/client/src/text_manager.cpp b/code/ryzom/client/src/text_manager.cpp index 9d152dcc9..bb78bffff 100644 --- a/code/ryzom/client/src/text_manager.cpp +++ b/code/ryzom/client/src/text_manager.cpp @@ -25,6 +25,10 @@ #include "text_manager.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + /////////// // USING // /////////// diff --git a/code/ryzom/client/src/time_client.cpp b/code/ryzom/client/src/time_client.cpp index 495e0af66..c67f70d05 100644 --- a/code/ryzom/client/src/time_client.cpp +++ b/code/ryzom/client/src/time_client.cpp @@ -34,6 +34,9 @@ #include "weather.h" #include "game_share/light_cycle.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif /////////// // USING // diff --git a/code/ryzom/client/src/timed_fx_manager.cpp b/code/ryzom/client/src/timed_fx_manager.cpp index d37ab782f..8741e5197 100644 --- a/code/ryzom/client/src/timed_fx_manager.cpp +++ b/code/ryzom/client/src/timed_fx_manager.cpp @@ -32,8 +32,8 @@ #include "nel/misc/check_fpu.h" -#if defined(NL_DEBUG) && defined(NL_OS_WINDOWS) - #include +#ifdef DEBUG_NEW +#define new DEBUG_NEW #endif using namespace std::rel_ops; diff --git a/code/ryzom/client/src/user_agent.cpp b/code/ryzom/client/src/user_agent.cpp index 7ba2b4e38..25e84bcb7 100644 --- a/code/ryzom/client/src/user_agent.cpp +++ b/code/ryzom/client/src/user_agent.cpp @@ -47,6 +47,10 @@ #define RYZOM_CLIENT_ICON "ryzom_client" #endif +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + std::string getUserAgent() { return getUserAgentName() + "/" + getUserAgentVersion(); diff --git a/code/ryzom/client/src/user_entity.cpp b/code/ryzom/client/src/user_entity.cpp index cad200aeb..80fccf07c 100644 --- a/code/ryzom/client/src/user_entity.cpp +++ b/code/ryzom/client/src/user_entity.cpp @@ -80,6 +80,10 @@ // r2 #include "r2/editor.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + /////////// // USING // /////////// diff --git a/code/ryzom/client/src/view.cpp b/code/ryzom/client/src/view.cpp index 4bc52af08..8d097d142 100644 --- a/code/ryzom/client/src/view.cpp +++ b/code/ryzom/client/src/view.cpp @@ -37,6 +37,10 @@ #include "motion/user_controls.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using NL3D::UVisualCollisionManager; extern UVisualCollisionManager *CollisionManager; diff --git a/code/ryzom/client/src/village.cpp b/code/ryzom/client/src/village.cpp index 5a94d93d3..41d698782 100644 --- a/code/ryzom/client/src/village.cpp +++ b/code/ryzom/client/src/village.cpp @@ -33,6 +33,10 @@ #include "pacs_client.h" #include "client_cfg.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; using namespace std; diff --git a/code/ryzom/client/src/water_env_map_rdr.cpp b/code/ryzom/client/src/water_env_map_rdr.cpp index a5294a74d..a1d87ae23 100644 --- a/code/ryzom/client/src/water_env_map_rdr.cpp +++ b/code/ryzom/client/src/water_env_map_rdr.cpp @@ -27,6 +27,10 @@ #include "nel/misc/matrix.h" #include "nel/misc/vectord.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NL3D; using namespace NLMISC; diff --git a/code/ryzom/client/src/water_map.cpp b/code/ryzom/client/src/water_map.cpp index 76a4119f7..727b48311 100644 --- a/code/ryzom/client/src/water_map.cpp +++ b/code/ryzom/client/src/water_map.cpp @@ -31,6 +31,9 @@ #include "nel/misc/path.h" #include "nel/misc/file.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif extern NL3D::UScene *Scene; extern NL3D::UDriver *Driver; diff --git a/code/ryzom/client/src/weather.cpp b/code/ryzom/client/src/weather.cpp index 91fad6f7c..5891ecb9f 100644 --- a/code/ryzom/client/src/weather.cpp +++ b/code/ryzom/client/src/weather.cpp @@ -36,6 +36,9 @@ // #include "r2/editor.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif H_AUTO_DECL(RZ_Weather) diff --git a/code/ryzom/client/src/weather_manager_client.cpp b/code/ryzom/client/src/weather_manager_client.cpp index 8c0018fdf..81bf0236f 100644 --- a/code/ryzom/client/src/weather_manager_client.cpp +++ b/code/ryzom/client/src/weather_manager_client.cpp @@ -31,6 +31,10 @@ #include "sound_manager.h" #include "client_cfg.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + H_AUTO_DECL(RZ_WeatherManagerClient) using namespace NLMISC; diff --git a/code/ryzom/client/src/weather_setup_client.cpp b/code/ryzom/client/src/weather_setup_client.cpp index 54df5d05f..519b29d3a 100644 --- a/code/ryzom/client/src/weather_setup_client.cpp +++ b/code/ryzom/client/src/weather_setup_client.cpp @@ -25,6 +25,9 @@ using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif H_AUTO_DECL(RZ_WeatherSetupClient) diff --git a/code/ryzom/client/src/world_database_manager.cpp b/code/ryzom/client/src/world_database_manager.cpp index a735ab982..72add4415 100644 --- a/code/ryzom/client/src/world_database_manager.cpp +++ b/code/ryzom/client/src/world_database_manager.cpp @@ -25,6 +25,9 @@ #include "world_database_manager.h" #include "continent_manager.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif ///////////// // GLOBALS // diff --git a/code/ryzom/client/src/zone_util.cpp b/code/ryzom/client/src/zone_util.cpp index c5616d0e0..33b7fdf68 100644 --- a/code/ryzom/client/src/zone_util.cpp +++ b/code/ryzom/client/src/zone_util.cpp @@ -23,6 +23,9 @@ using namespace std; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif bool getPosFromZoneName(const std::string &name,NLMISC::CVector2f &dest) { diff --git a/code/ryzom/common/src/game_share/dms.cpp b/code/ryzom/common/src/game_share/dms.cpp index 8f8af5b51..3619c294c 100644 --- a/code/ryzom/common/src/game_share/dms.cpp +++ b/code/ryzom/common/src/game_share/dms.cpp @@ -45,6 +45,9 @@ #include "server_edition_module.h" #include "server_animation_module.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace R2; using namespace NLNET; diff --git a/code/ryzom/common/src/game_share/dyn_chat.cpp b/code/ryzom/common/src/game_share/dyn_chat.cpp index aae0015d7..eed4f33b0 100644 --- a/code/ryzom/common/src/game_share/dyn_chat.cpp +++ b/code/ryzom/common/src/game_share/dyn_chat.cpp @@ -17,6 +17,10 @@ #include "stdpch.h" #include "dyn_chat.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; NL_INSTANCE_COUNTER_IMPL(CDynChatSession); diff --git a/code/ryzom/common/src/game_share/fame.cpp b/code/ryzom/common/src/game_share/fame.cpp index 919ee3c93..a0e633199 100644 --- a/code/ryzom/common/src/game_share/fame.cpp +++ b/code/ryzom/common/src/game_share/fame.cpp @@ -24,6 +24,10 @@ //#include "../entities_game_service/egs_variables.h" //#include "pvp_clan.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; using namespace STRING_MANAGER; diff --git a/code/ryzom/common/src/game_share/generic_xml_msg_mngr.cpp b/code/ryzom/common/src/game_share/generic_xml_msg_mngr.cpp index b3c002015..fd30af70d 100644 --- a/code/ryzom/common/src/game_share/generic_xml_msg_mngr.cpp +++ b/code/ryzom/common/src/game_share/generic_xml_msg_mngr.cpp @@ -22,6 +22,10 @@ #include "nel/misc/file.h" #include "nel/misc/xml_auto_ptr.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/ryzom/common/src/game_share/mirror.cpp b/code/ryzom/common/src/game_share/mirror.cpp index 0e634afaf..23e975831 100644 --- a/code/ryzom/common/src/game_share/mirror.cpp +++ b/code/ryzom/common/src/game_share/mirror.cpp @@ -21,6 +21,10 @@ #include "synchronised_message.h" #include "tick_proxy_time_measure.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; using namespace NLNET; using namespace std; diff --git a/code/ryzom/common/src/game_share/mirror_prop_value.cpp b/code/ryzom/common/src/game_share/mirror_prop_value.cpp index 5383a2443..5bb63e2d0 100644 --- a/code/ryzom/common/src/game_share/mirror_prop_value.cpp +++ b/code/ryzom/common/src/game_share/mirror_prop_value.cpp @@ -19,6 +19,9 @@ #include "stdpch.h" #include "mirror_prop_value.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif sint32 NbAllocdListCells = 0; sint32 MaxNbAllocdListCells = 0; diff --git a/code/ryzom/common/src/game_share/object.cpp b/code/ryzom/common/src/game_share/object.cpp index f914085e4..326e6dd1f 100644 --- a/code/ryzom/common/src/game_share/object.cpp +++ b/code/ryzom/common/src/game_share/object.cpp @@ -25,6 +25,10 @@ #include +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace R2 { diff --git a/code/ryzom/common/src/game_share/persistent_data_tree.cpp b/code/ryzom/common/src/game_share/persistent_data_tree.cpp index d10f01013..a8a15f06a 100644 --- a/code/ryzom/common/src/game_share/persistent_data_tree.cpp +++ b/code/ryzom/common/src/game_share/persistent_data_tree.cpp @@ -77,6 +77,9 @@ #include "stdpch.h" #include "persistent_data_tree.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif //----------------------------------------------------------------------------- // Namespaces diff --git a/code/ryzom/common/src/game_share/ring_access.cpp b/code/ryzom/common/src/game_share/ring_access.cpp index 9e0ba8ce4..479b69291 100644 --- a/code/ryzom/common/src/game_share/ring_access.cpp +++ b/code/ryzom/common/src/game_share/ring_access.cpp @@ -35,6 +35,9 @@ #include "nel/misc/xml_auto_ptr.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace std; using namespace R2; diff --git a/code/ryzom/common/src/game_share/scenario.cpp b/code/ryzom/common/src/game_share/scenario.cpp index e2437eac2..3782c45cf 100644 --- a/code/ryzom/common/src/game_share/scenario.cpp +++ b/code/ryzom/common/src/game_share/scenario.cpp @@ -31,6 +31,10 @@ #include "nel/misc/file.h" #include "nel/misc/algo.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace R2; //---------------------------------------------------------------- namespace R2 diff --git a/code/ryzom/common/src/game_share/server_edition_module.cpp b/code/ryzom/common/src/game_share/server_edition_module.cpp index b3e4c6b53..79cf9a6f2 100644 --- a/code/ryzom/common/src/game_share/server_edition_module.cpp +++ b/code/ryzom/common/src/game_share/server_edition_module.cpp @@ -60,6 +60,9 @@ //#include "server_admin_module.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace std; using namespace NLMISC; diff --git a/code/ryzom/common/src/game_share/simlag.cpp b/code/ryzom/common/src/game_share/simlag.cpp index 0468caa2b..86f61b60b 100644 --- a/code/ryzom/common/src/game_share/simlag.cpp +++ b/code/ryzom/common/src/game_share/simlag.cpp @@ -22,6 +22,10 @@ // Includes // +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + // // Using // diff --git a/code/ryzom/common/src/game_share/stdpch.h b/code/ryzom/common/src/game_share/stdpch.h index cdec993d9..46c71bcfe 100644 --- a/code/ryzom/common/src/game_share/stdpch.h +++ b/code/ryzom/common/src/game_share/stdpch.h @@ -14,7 +14,15 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include "nel/misc/types_nl.h" +#ifndef GAMESHARE_STDPCH_H +#define GAMESHARE_STDPCH_H + +#if defined(_MSC_VER) && defined(_DEBUG) +#define _CRTDBG_MAP_ALLOC +#include +#include +#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) +#endif #include #include @@ -38,6 +46,7 @@ #include #include +#include "nel/misc/types_nl.h" #include #include @@ -75,3 +84,5 @@ # include # include #endif + +#endif diff --git a/code/ryzom/common/src/game_share/visual_slot_manager.cpp b/code/ryzom/common/src/game_share/visual_slot_manager.cpp index bc2410eea..4c4470a5b 100644 --- a/code/ryzom/common/src/game_share/visual_slot_manager.cpp +++ b/code/ryzom/common/src/game_share/visual_slot_manager.cpp @@ -30,6 +30,10 @@ #include "visual_slot_manager.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + //////////////////// // STATIC MEMBERS // //////////////////// From 7f1168293a82f1714a2c6deee1539c73d2d68fd2 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 5 Nov 2017 19:05:14 +0100 Subject: [PATCH 14/63] Fixed: Compilation --HG-- branch : develop --- code/ryzom/client/src/network_connection.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/code/ryzom/client/src/network_connection.cpp b/code/ryzom/client/src/network_connection.cpp index 730cb3477..133f92af1 100644 --- a/code/ryzom/client/src/network_connection.cpp +++ b/code/ryzom/client/src/network_connection.cpp @@ -2976,7 +2976,15 @@ void CNetworkConnection::reinit() // Reuse the udp socket _Connection.~CUdpSimSock(); + +#ifdef new +#undef new +#endif new (&_Connection) CUdpSimSock(); + +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif } // sends system sync acknowledge From d099e98dae6674e7689cbe72a93a82b95c2985e5 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 5 Nov 2017 19:06:03 +0100 Subject: [PATCH 15/63] Changed: Moved strFindReplaceAll to algo.h --HG-- branch : develop --- code/nel/include/nel/misc/algo.h | 8 ++++++++ code/nel/src/gui/lua_ihm.cpp | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/code/nel/include/nel/misc/algo.h b/code/nel/include/nel/misc/algo.h index 72d9ae3ae..50493538f 100644 --- a/code/nel/include/nel/misc/algo.h +++ b/code/nel/include/nel/misc/algo.h @@ -211,6 +211,14 @@ bool strFindReplace(T &str, const char *strFind, const U &strReplace) return strFindReplace(str, tempStr, strReplace); } +template +T strFindReplaceAll(const T &str, const T &search, const T &replace) +{ + T ret = str; + while (strFindReplace(ret, search, replace)); + return ret; +} + // set flags in a bit set template inline void setFlags(T &dest, U mask, bool on) diff --git a/code/nel/src/gui/lua_ihm.cpp b/code/nel/src/gui/lua_ihm.cpp index fed1340a0..0b4a1d0dc 100644 --- a/code/nel/src/gui/lua_ihm.cpp +++ b/code/nel/src/gui/lua_ihm.cpp @@ -1817,9 +1817,7 @@ namespace NLGUI ucstring CLuaIHM::findReplaceAll(const ucstring &str, const ucstring &search, const ucstring &replace) { //H_AUTO(Lua_CLuaIHM_findReplaceAll) - ucstring ret= str; - while(strFindReplace(ret, search, replace)); - return ret; + return strFindReplaceAll(str, search, replace); } // *************************************************************************** From 93c2f55290101bcfba2f2f0927de592c583e639d Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 5 Nov 2017 19:07:19 +0100 Subject: [PATCH 16/63] Changed: Minor changes --HG-- branch : develop --- code/nel/src/misc/common.cpp | 8 ++++---- code/ryzom/client/src/login_patch.cpp | 4 ++-- code/ryzom/client/src/user_entity.h | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index 7eebdafbf..4d849b2d5 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -894,8 +894,8 @@ bool launchProgram(const std::string &programName, const std::string &arguments, int status = vfork (); ///////////////////////////////////////////////////////// - /// WARNING : NO MORE INSTRUCTION AFTER VFORK ! - /// READ VFORK manual + // WARNING : NO MORE INSTRUCTION AFTER VFORK ! + // READ VFORK manual ///////////////////////////////////////////////////////// if (status == -1) { @@ -1000,8 +1000,8 @@ bool launchProgramArray (const std::string &programName, const std::vector arguments; - + std::string startupPath = Args.getStartupPath(); // 3 first parameters are Ryzom client full path, patch directory full path and client root directory full path diff --git a/code/ryzom/client/src/user_entity.h b/code/ryzom/client/src/user_entity.h index 7e693536b..1b2745cdd 100644 --- a/code/ryzom/client/src/user_entity.h +++ b/code/ryzom/client/src/user_entity.h @@ -423,6 +423,7 @@ public: void tp(const NLMISC::CVectorD &dest); /// Teleport the player to correct his position. void correctPos(const NLMISC::CVectorD &dest); + /// Skill Up void skillUp(); /// get the level of the player (max of all skills) From 3e4a873429d56fc24a5ae37871cd11cef90b6cdc Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 5 Nov 2017 19:07:51 +0100 Subject: [PATCH 17/63] Changed: Implement escapeArgument function --HG-- branch : develop --- code/nel/include/nel/misc/common.h | 3 +++ code/nel/src/misc/common.cpp | 35 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/code/nel/include/nel/misc/common.h b/code/nel/include/nel/misc/common.h index 4c2b38cca..180139ec0 100644 --- a/code/nel/include/nel/misc/common.h +++ b/code/nel/include/nel/misc/common.h @@ -394,6 +394,9 @@ std::string expandEnvironmentVariables(const std::string &s); bool explodeArguments(const std::string &str, std::vector &args); std::string joinArguments(const std::vector &args); +/// Escape an argument to not evaluate environment variables or special cases +std::string escapeArgument(const std::string &arg); + /// This function kills a program using his pid (on unix, it uses the kill() POSIX function) bool killProgram(uint32 pid); diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index 4d849b2d5..23b02e668 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -1247,6 +1247,41 @@ std::string joinArguments(const std::vector &args) return res; } +std::string escapeArgument(const std::string &arg) +{ +#ifdef NL_OS_WINDOWS + // we can't escape %VARIABLE% on command-line under Windows + return arg; +#else + // characters to escapce, only " and $ (to prevent a $something replaced by an environment variable) + static const char s_charsToEscape[] = "\"$"; + + std::string res; + std::string::size_type pos = 0, lastPos = 0; + + // to avoid reallocations + res.reserve(arg.size() * 2); + + while ((pos = arg.find_first_of(s_charsToEscape, lastPos)) != std::string::npos) + { + // add previous part + res += arg.substr(lastPos, pos - lastPos); + + // not already escaped + if (!pos || arg[pos - 1] != '\\') res += '\\'; + + // add escaped character + res += arg[pos]; + + lastPos = pos+1; + } + + res += arg.substr(lastPos); + + return res; +#endif +} + /* * Display the bits (with 0 and 1) composing a byte (from right to left) */ From ed884644af83c55a561ac454736da2807d121c3f Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 5 Nov 2017 19:08:47 +0100 Subject: [PATCH 18/63] Changed: Merged changes from compatibility-develop --HG-- branch : develop --- code/ryzom/client/src/net_manager.cpp | 19 +++++++++++++------ code/ryzom/client/src/user_entity.cpp | 10 ++++++++++ code/ryzom/client/src/user_entity.h | 16 +++++++++++++++- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index d2789d2b9..2d5a4e2be 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -1407,12 +1407,19 @@ void impulseCorrectPos(NLMISC::CBitMemStream &impulse) if(UserEntity->mode() != MBEHAV::COMBAT_FLOAT) { - // Compute the destination. - CVectorD dest = CVectorD((float)x/1000.0f, (float)y/1000.0f, (float)z/1000.0f); - // Update the position for the vision. - NetMngr.setReferencePosition(dest); - // Change the user poisition. - UserEntity->correctPos(dest); + if (x == 0) // Get SpeedAdjustement + { + UserEntity->setSpeedServerAdjust(-0.2f); + } + else + { + // Compute the destination. + CVectorD dest = CVectorD((float)x/1000.0f, (float)y/1000.0f, (float)z/1000.0f); + // Update the position for the vision. + NetMngr.setReferencePosition(dest); + // Change the user poisition. + UserEntity->correctPos(dest); + } } }// impulseCorrectPos // diff --git a/code/ryzom/client/src/user_entity.cpp b/code/ryzom/client/src/user_entity.cpp index 80fccf07c..180832d7d 100644 --- a/code/ryzom/client/src/user_entity.cpp +++ b/code/ryzom/client/src/user_entity.cpp @@ -148,6 +148,8 @@ CUserEntity::CUserEntity() _FrontVelocity = 0.0f; _LateralVelocity = 0.0f; + _SpeedServerAdjust = 1.0f; + // \todo GUIGUI : do it more generic. _First_Pos = false; @@ -1209,7 +1211,11 @@ void CUserEntity::applyMotion(CEntityCL *target) speed = CVectorD::Null; } else + { speed = getVelocity()*_SpeedFactor.getValue(); + _SpeedFactor.addFactorValue(0.005f); + } + // SPEED VECTOR NULL -> NO MOVE if(speed == CVectorD::Null) return; @@ -1231,6 +1237,9 @@ void CUserEntity::applyMotion(CEntityCL *target) // Third Person View else { + double modif = (100.0f/(float)NetMngr.getMsPerTick()); + clamp(modif, 0.0, 1.0); + speed *= modif; speed += pos(); sint64 x = (sint64)((sint32)(speed.x * 1000.0)); sint64 y = (sint64)((sint32)(speed.y * 1000.0)); @@ -3483,6 +3492,7 @@ void CUserEntity::light() void CUserEntity::CSpeedFactor::init() { _Value = 1.0f; // Default speed factor is 1. + _ServerFactor = 1.0f; CInterfaceManager *IM = CInterfaceManager::getInstance (); CCDBNodeLeaf *pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:SPEED_FACTOR", false); if(pNodeLeaf) diff --git a/code/ryzom/client/src/user_entity.h b/code/ryzom/client/src/user_entity.h index 1b2745cdd..11501d2a0 100644 --- a/code/ryzom/client/src/user_entity.h +++ b/code/ryzom/client/src/user_entity.h @@ -297,6 +297,8 @@ public: // get the velocity vector of the entity NLMISC::CVector getVelocity() const; + inline void setSpeedServerAdjust(float speed) {_SpeedFactor.addFactorValue(speed);} + /// Check if the mount is able to run, and force walking mode if not void checkMountAbleToRun(); @@ -497,13 +499,23 @@ protected: /// Release void release(); /// Return the speed factor. - float getValue() const {return _Value;} + float getValue() const { return _Value * _ServerFactor; } + void setFactorValue(float value) {_ServerFactor = value;} + void addFactorValue(float value) { + _ServerFactor += value; + if (_ServerFactor > 1.0) + _ServerFactor = 1.0; + if (_ServerFactor < 0.1) + _ServerFactor = 0.1; + } + virtual void serial(class NLMISC::IStream &f) throw(NLMISC::EStream) {f.serial(_Value);} protected: /// Method called when the ping message is back. virtual void update(NLMISC::ICDBNode* leaf); private: float _Value; + float _ServerFactor; }; class CMountHunger @@ -546,6 +558,8 @@ protected: /// Velocity : Front and Lateral float _FrontVelocity; float _LateralVelocity; + /// Speed adjustement from gpms + float _SpeedServerAdjust; /// Head Pitch double _HeadPitch; /// Height of the eyes (camera). From 8c4cf11534fcca2ccb49c36bedbda186a841e06d Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 5 Nov 2017 19:09:29 +0100 Subject: [PATCH 19/63] Changed: Write a message in log to tell that we're creating the patch script --HG-- branch : develop --- code/ryzom/client/src/login_patch.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index ca19036e7..d2620af9c 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -881,6 +881,10 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool string err = toString("Can't open file '%s' for writing: code=%d %s (error code 29)", batchFilename.c_str(), errno, strerror(errno)); throw Exception (err); } + else + { + nlinfo("Creating %s...", batchFilename.c_str()); + } string contentPrefix; From bea0240cbba0af22d82facffdc454afc441fe6d0 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 5 Nov 2017 19:11:27 +0100 Subject: [PATCH 20/63] Fixed: Escape password and login to prevent errors with special characters (such as | or &) --HG-- branch : develop --- code/ryzom/client/src/login_patch.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index d2620af9c..a7b4fa43f 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -897,9 +897,9 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool contentPrefix += "set STARTUPPATH=%~4\n"; contentPrefix += toString("set UPGRADE_FILE=%%ROOTPATH%%\\%s\n", UpgradeBatchFilename.c_str()); contentPrefix += "\n"; - contentPrefix += "set LOGIN=%5\n"; - contentPrefix += "set PASSWORD=%6\n"; - contentPrefix += "set SHARDID=%7\n"; + contentPrefix += "set LOGIN=%~5\n"; + contentPrefix += "set PASSWORD=%~6\n"; + contentPrefix += "set SHARDID=%~7\n"; #else contentPrefix += "#!/bin/sh\n"; contentPrefix += "export RYZOM_CLIENT=\"$1\"\n"; @@ -908,9 +908,9 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool contentPrefix += "export STARTUPPATH=\"$4\"\n"; contentPrefix += toString("export UPGRADE_FILE=$ROOTPATH/%s\n", UpgradeBatchFilename.c_str()); contentPrefix += "\n"; - contentPrefix += "LOGIN=$5\n"; - contentPrefix += "PASSWORD=$6\n"; - contentPrefix += "SHARDID=$7\n"; + contentPrefix += "LOGIN=\"$5\"\n"; + contentPrefix += "PASSWORD=\"$6\"\n"; + contentPrefix += "SHARDID=\"$7\"\n"; #endif contentPrefix += "\n"; @@ -932,7 +932,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool if (wantRyzomRestart) { // client shouldn't be in memory anymore else it couldn't be overwritten - contentSuffix += toString("start \"\" /D \"%%STARTUPPATH%%\" \"%%RYZOM_CLIENT%%\" %s %%LOGIN%% %%PASSWORD%% %%SHARDID%%\n", additionalParams.c_str()); + contentSuffix += toString("start \"\" /D \"%%STARTUPPATH%%\" \"%%RYZOM_CLIENT%%\" %s \"%%LOGIN%%\ \"%%PASSWORD%%\" \"%%SHARDID%%\"\n", additionalParams.c_str()); } #else if (wantRyzomRestart) @@ -955,9 +955,9 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool // launch new client #ifdef NL_OS_MAC // use exec command under OS X - contentSuffix += toString("exec \"$RYZOM_CLIENT\" %s $LOGIN $PASSWORD $SHARDID\n", additionalParams.c_str()); + contentSuffix += toString("exec \"$RYZOM_CLIENT\" %s \"$LOGIN\" \"$PASSWORD\" \"$SHARDID\"\n", additionalParams.c_str()); #else - contentSuffix += toString("\"$RYZOM_CLIENT\" %s $LOGIN $PASSWORD $SHARDID &\n", additionalParams.c_str()); + contentSuffix += toString("\"$RYZOM_CLIENT\" %s \"$LOGIN\" \"$PASSWORD\" \"$SHARDID\" &\n", additionalParams.c_str()); #endif } #endif From 106f18a8c82b6fd0030047939ca2d84986de3a50 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 5 Nov 2017 19:24:50 +0100 Subject: [PATCH 21/63] Changed: More memory leaks detection --HG-- branch : develop --- code/ryzom/client/src/interface_v3/group_map.cpp | 4 ++++ code/ryzom/client/src/interface_v3/inventory_manager.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/code/ryzom/client/src/interface_v3/group_map.cpp b/code/ryzom/client/src/interface_v3/group_map.cpp index e38bb3d62..929e35f71 100644 --- a/code/ryzom/client/src/interface_v3/group_map.cpp +++ b/code/ryzom/client/src/interface_v3/group_map.cpp @@ -61,6 +61,10 @@ #include +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + extern CContinentManager ContinentMngr; extern NL3D::UDriver *Driver; extern NL3D::UScene *Scene; diff --git a/code/ryzom/client/src/interface_v3/inventory_manager.cpp b/code/ryzom/client/src/interface_v3/inventory_manager.cpp index 1ab8fe1f3..746ad9ea4 100644 --- a/code/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/code/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -51,6 +51,10 @@ #include "../misc.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; From 8febcb1f60b3e93d93e2bfe42e371d2b61b10fdf Mon Sep 17 00:00:00 2001 From: Nimetu Date: Wed, 15 Nov 2017 15:13:00 +0200 Subject: [PATCH 22/63] Fixed: Detecting video mem on ATI cards --HG-- branch : develop --- code/nel/src/3d/driver/opengl/driver_opengl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.cpp b/code/nel/src/3d/driver/opengl/driver_opengl.cpp index 80b424cba..023997065 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl.cpp @@ -1195,11 +1195,11 @@ sint CDriverGL::getTotalVideoMemory() const if (_Extensions.ATIMeminfo) { - GLint memoryInKiB = 0; - glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, &memoryInKiB); + GLint params[4]; + glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, params); - nlinfo("3D: GL_TEXTURE_FREE_MEMORY_ATI returned %d KiB", memoryInKiB); - return memoryInKiB; + nlinfo("3D: GL_TEXTURE_FREE_MEMORY_ATI returned %d KiB", params[0]); + return params[0]; } #if defined(NL_OS_WINDOWS) From ea84023e4897ab4e3c739af8bd918c6cb648ed27 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 20 Nov 2017 15:41:48 +0100 Subject: [PATCH 23/63] Fixed: Missing quote in .bat --HG-- branch : develop --- code/ryzom/client/src/login_patch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index a7b4fa43f..f13d1a782 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -932,7 +932,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool if (wantRyzomRestart) { // client shouldn't be in memory anymore else it couldn't be overwritten - contentSuffix += toString("start \"\" /D \"%%STARTUPPATH%%\" \"%%RYZOM_CLIENT%%\" %s \"%%LOGIN%%\ \"%%PASSWORD%%\" \"%%SHARDID%%\"\n", additionalParams.c_str()); + contentSuffix += toString("start \"\" /D \"%%STARTUPPATH%%\" \"%%RYZOM_CLIENT%%\" %s \"%%LOGIN%%\" \"%%PASSWORD%%\" \"%%SHARDID%%\"\n", additionalParams.c_str()); } #else if (wantRyzomRestart) From c4b9b0eb58eca5b1d431aa2e0634fc22bdbfcfa0 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 20 Nov 2017 15:43:13 +0100 Subject: [PATCH 24/63] Changed: shape command syntax --HG-- branch : develop --- code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index c0a3e167d..241e8f269 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -2024,7 +2024,7 @@ int CLuaIHMRyzom::getIslandId(CLuaState &ls) // *************************************************************************** // -// addShape("shape", x, y, z, "angle", scale, collision?) +// addShape("shape", .x, .y, .z, "angle", .scale, collision?, "context", "url", highlight?, transparency?, "texture", "skeleton") // //******** int CLuaIHMRyzom::addShape(CLuaState &ls) From b00d62d4ce827127eb379621d3c426b7d4d7c488 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Mon, 20 Nov 2017 16:00:51 +0200 Subject: [PATCH 25/63] Fixed: Client exit on unicode composite character errors --HG-- branch : develop --- code/nel/src/3d/font_generator.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/code/nel/src/3d/font_generator.cpp b/code/nel/src/3d/font_generator.cpp index 0adf29418..f50b61c5b 100644 --- a/code/nel/src/3d/font_generator.cpp +++ b/code/nel/src/3d/font_generator.cpp @@ -271,7 +271,14 @@ void CFontGenerator::getSizes (ucchar c, uint32 size, uint32 &width, uint32 &hei error = FT_Load_Glyph (_Face, glyph_index, FT_LOAD_DEFAULT); if (error) { - nlerror ("FT_Load_Glyph() failed: %s", getFT2Error(error)); + // use fallback for glyph/character errors (composite char limit for example) + nlwarning ("FT_Load_Glyph() failed: %s", getFT2Error(error)); + + error = FT_Load_Glyph (_Face, 0, FT_LOAD_DEFAULT); + if (error) + { + nlerror("FT_Load_Glyph() fallback failed: %s", getFT2Error(error)); + } } // convert 24.6 fixed point into integer @@ -302,7 +309,14 @@ uint8 *CFontGenerator::getBitmap (ucchar c, uint32 size, bool embolden, bool obl error = FT_Load_Glyph (_Face, glyph_index, FT_LOAD_DEFAULT); if (error) { - nlerror ("FT_Load_Glyph() failed: %s", getFT2Error(error)); + // use fallback for glyph/character errors (composite char limit for example) + nlwarning ("FT_Load_Glyph() failed: %s", getFT2Error(error)); + + error = FT_Load_Glyph (_Face, 0, FT_LOAD_DEFAULT); + if (error) + { + nlerror("FT_Load_Glyph() fallback failed: %s", getFT2Error(error)); + } } if (size == 0) From 9e9b005b3be7fb9f0d9b4e739282f32d6ece53ac Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 2 Dec 2017 16:44:38 +0100 Subject: [PATCH 26/63] Changed: Centralize hexadecimal conversions --HG-- branch : develop --- code/nel/include/nel/misc/common.h | 20 ++++ code/nel/src/misc/common.cpp | 103 ++++++++++++++++++ code/nel/src/misc/md5.cpp | 41 +------ .../common/src/game_share/entity_types.h | 11 -- 4 files changed, 125 insertions(+), 50 deletions(-) diff --git a/code/nel/include/nel/misc/common.h b/code/nel/include/nel/misc/common.h index 180139ec0..eb70fce9e 100644 --- a/code/nel/include/nel/misc/common.h +++ b/code/nel/include/nel/misc/common.h @@ -233,6 +233,26 @@ char toLower ( const char ch ); // convert only one character std::string toUpper ( const std::string &str); void toUpper ( char *str); + +/** + * Convert to an hexadecimal std::string + */ +std::string toHexa(const uint8 &b); +std::string toHexa(const uint8 *data, uint size); +std::string toHexa(const std::string &str); +std::string toHexa(const char *str); + +/** +* Convert from an hexadecimal std::string +*/ +bool fromHexa(const std::string &hexa, uint8 &b); +bool fromHexa(const std::string &hexa, uint8 *data); +bool fromHexa(const std::string &hexa, std::string &str); +bool fromHexa(const char *hexa, uint8 &b); +bool fromHexa(const char *hexa, uint8 *data); +bool fromHexa(const char *hexa, std::string &str); +bool fromHexa(const char hexa, uint8 &b); + // Remove all the characters <= 32 (tab, space, new line, return, vertical tab etc..) at the beginning and at the end of a string template T trim (const T &str) { diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index 23b02e668..bb6badd18 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -662,6 +662,109 @@ void toUpper(char *str) } } +std::string toHexa(const uint8 &b) +{ + return toString("%02hhx", b); +} + +std::string toHexa(const uint8 *data, uint size) +{ + std::string res; + + // hexadecimal string will be always twice the original size + res.reserve(size * 2); + + // process each byte + for (uint i = 0; i < size; ++i) + { + res += toHexa(data[i]); + } + + return res; +} + +std::string toHexa(const std::string &str) +{ + return toHexa((uint8*)str.c_str(), (uint)str.length()); +} + +std::string toHexa(const char *str) +{ + return toHexa((uint8*)str, (uint)strlen(str)); +} + +bool fromHexa(const std::string &hexa, uint8 &b) +{ + return fromHexa(hexa.c_str(), b); +} + +bool fromHexa(const std::string &hexa, uint8 *data) +{ + return fromHexa(hexa.c_str(), data); +} + +bool fromHexa(const std::string &hexa, std::string &str) +{ + return fromHexa(hexa.c_str(), str); +} + +bool fromHexa(const char *hexa, uint8 &b) +{ + char c1 = *hexa; + char c2 = *(hexa+1); + uint8 x1, x2; + if (!fromHexa(c1, x1)) return false; + if (!fromHexa(c2, x2)) return false; + + b = (x1 << 4) | x2; + + return true; +} + +bool fromHexa(const char *hexa, uint8 *data) +{ + // length of the string + uint len = strlen(hexa); + + // process each byte + for (uint i = 0; i < len; i += 2) + { + if (!fromHexa(hexa + i, *(data++))) return false; + } + + return true; +} + +bool fromHexa(const char *hexa, std::string &str) +{ + str.resize(strlen(hexa) * 2); + + return fromHexa(hexa, (uint8*)str.c_str()); +} + +bool fromHexa(const char hexa, uint8 &b) +{ + if (hexa >= '0' && hexa <= '9') + { + b = hexa - '0'; + return true; + } + + if (hexa >= 'A' && hexa <= 'F') + { + b = hexa - 'A' + 10; + return true; + } + + if (hexa >= 'a' && hexa <= 'f') + { + b = hexa - 'a' + 10; + return true; + } + + return false; +} + std::string formatThousands(const std::string& s) { sint i, k; diff --git a/code/nel/src/misc/md5.cpp b/code/nel/src/misc/md5.cpp index eaf9df6cc..052bfa0b2 100644 --- a/code/nel/src/misc/md5.cpp +++ b/code/nel/src/misc/md5.cpp @@ -118,31 +118,6 @@ CHashKeyMD5 getMD5(const uint8 *buffer, uint32 size) return Message_Digest; } -// **************************************************************************** -// Helper -// **************************************************************************** -static bool fromHex(char c, uint8 &x) -{ - if (c >= '0' && c <= '9') - { - x = c - '0'; - return true; - } - else if (c >= 'A' && c <= 'F') - { - x = c - 'A' + 10; - return true; - } - else if (c >= 'a' && c <= 'f') - { - x = c - 'a' + 10; - return true; - } - - nlwarning("cannot convert to hexa"); - return false; -} - // **************************************************************************** // **************************************************************************** // CHashKeyMD5 @@ -159,10 +134,7 @@ void CHashKeyMD5::clear() // **************************************************************************** string CHashKeyMD5::toString() const { - string sTmp; - for (uint32 i = 0; i < 16; ++i) - sTmp += NLMISC::toString("%02x", Data[i]); - return sTmp; + return toHexa(Data, 16); } // **************************************************************************** @@ -174,16 +146,7 @@ bool CHashKeyMD5::fromString(const std::string &in) return false; } - for (uint32 i = 0; i < 16; ++i) - { - char c1 = in[2*i]; - char c2 = in[2*i+1]; - uint8 x1, x2; - if (!fromHex(c1, x1)) return false; - if (!fromHex(c2, x2)) return false; - Data[i] = (x1 << 4) | x2; - } - return true; + return fromHexa(in, Data); } // **************************************************************************** diff --git a/code/ryzom/common/src/game_share/entity_types.h b/code/ryzom/common/src/game_share/entity_types.h index 189e7c803..23f4bd700 100644 --- a/code/ryzom/common/src/game_share/entity_types.h +++ b/code/ryzom/common/src/game_share/entity_types.h @@ -560,17 +560,6 @@ inline CLFECOMMON::TCoord getAbsoluteCoordinateFrom64( uint64 posvalue ) }*/ -inline std::string toHexaString(const std::vector &v) -{ - std::string res; - for (uint i = 0; i < v.size(); i++) - { - res += NLMISC::toString("%x",v[i]); - } - return res; -} - - #endif // NL_ENTITY_TYPES_H /* End of entity_types.h */ From d799dde5add26a6e4f0d94e55bc03eb2a1333d4d Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 2 Dec 2017 16:45:12 +0100 Subject: [PATCH 27/63] Added: Steam client support --HG-- branch : develop --- code/ryzom/client/src/steam_client.cpp | 434 +++++++++++++++++++++++++ code/ryzom/client/src/steam_client.h | 65 ++++ 2 files changed, 499 insertions(+) create mode 100644 code/ryzom/client/src/steam_client.cpp create mode 100644 code/ryzom/client/src/steam_client.h diff --git a/code/ryzom/client/src/steam_client.cpp b/code/ryzom/client/src/steam_client.cpp new file mode 100644 index 000000000..ac12324bc --- /dev/null +++ b/code/ryzom/client/src/steam_client.cpp @@ -0,0 +1,434 @@ +// Ryzom - MMORPG Framework +// 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 . + + + +#include "stdpch.h" + +#ifdef RZ_USE_STEAM + +#include "steam_client.h" + +#include "nel/misc/cmd_args.h" + +#include +#include + +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + +// prototypes definitions for Steam API functions we'll call +typedef bool (__cdecl *SteamAPI_InitFuncPtr)(); +typedef void (__cdecl *SteamAPI_ShutdownFuncPtr)(); +typedef HSteamUser (__cdecl *SteamAPI_GetHSteamUserFuncPtr)(); +typedef HSteamPipe (__cdecl *SteamAPI_GetHSteamPipeFuncPtr)(); +typedef void* (__cdecl *SteamInternal_CreateInterfaceFuncPtr)(const char *ver); +typedef void (__cdecl *SteamAPI_RegisterCallbackFuncPtr)(class CCallbackBase *pCallback, int iCallback); +typedef void (__cdecl *SteamAPI_UnregisterCallbackFuncPtr)(class CCallbackBase *pCallback); +typedef void (__cdecl *SteamAPI_RunCallbacksFuncPtr)(); + +// macros to simplify dynamic functions loading +#define NL_DECLARE_SYMBOL(symbol) symbol##FuncPtr nl##symbol = NULL +#define NL_LOAD_SYMBOL(symbol) \ +nl##symbol = (symbol##FuncPtr)NLMISC::nlGetSymbolAddress(_Handle, #symbol); \ +if (nl##symbol == NULL) return false + +NL_DECLARE_SYMBOL(SteamAPI_Init); +NL_DECLARE_SYMBOL(SteamAPI_Shutdown); + +NL_DECLARE_SYMBOL(SteamAPI_GetHSteamUser); +NL_DECLARE_SYMBOL(SteamAPI_GetHSteamPipe); +NL_DECLARE_SYMBOL(SteamInternal_CreateInterface); + +NL_DECLARE_SYMBOL(SteamAPI_RegisterCallback); +NL_DECLARE_SYMBOL(SteamAPI_UnregisterCallback); +NL_DECLARE_SYMBOL(SteamAPI_RunCallbacks); + +// instances of classes +static ISteamClient *s_SteamClient = NULL; +static ISteamUser *s_SteamUser = NULL; +static ISteamApps *s_SteamApps = NULL; +static ISteamFriends *s_SteamFriends = NULL; +static ISteamUtils *s_SteamUtils = NULL; + +// taken from steam_api.h, we needed to change it to use our dynamically loaded functions + +// Declares a callback member function plus a helper member variable which +// registers the callback on object creation and unregisters on destruction. +// The optional fourth 'var' param exists only for backwards-compatibility +// and can be ignored. +#define NL_STEAM_CALLBACK( thisclass, func, .../*callback_type, [deprecated] var*/ ) \ + _NL_STEAM_CALLBACK_SELECT( ( __VA_ARGS__, 4, 3 ), ( /**/, thisclass, func, __VA_ARGS__ ) ) + +//----------------------------------------------------------------------------- +// The following macros are implementation details, not intended for public use +//----------------------------------------------------------------------------- +#define _NL_STEAM_CALLBACK_AUTO_HOOK( thisclass, func, param ) +#define _NL_STEAM_CALLBACK_HELPER( _1, _2, SELECTED, ... ) _NL_STEAM_CALLBACK_##SELECTED +#define _NL_STEAM_CALLBACK_SELECT( X, Y ) _NL_STEAM_CALLBACK_HELPER X Y +#define _NL_STEAM_CALLBACK_3( extra_code, thisclass, func, param ) \ + struct CCallbackInternal_ ## func : private CSteamCallbackImpl< sizeof( param ) > { \ + CCallbackInternal_ ## func () { extra_code nlSteamAPI_RegisterCallback( this, param::k_iCallback ); } \ + CCallbackInternal_ ## func ( const CCallbackInternal_ ## func & ) { extra_code nlSteamAPI_RegisterCallback( this, param::k_iCallback ); } \ + CCallbackInternal_ ## func & operator=( const CCallbackInternal_ ## func & ) { return *this; } \ + private: virtual void Run( void *pvParam ) { _NL_STEAM_CALLBACK_AUTO_HOOK( thisclass, func, param ) \ + thisclass *pOuter = reinterpret_cast( reinterpret_cast(this) - offsetof( thisclass, m_steamcallback_ ## func ) ); \ + pOuter->func( reinterpret_cast( pvParam ) ); \ + } \ + } m_steamcallback_ ## func ; void func( param *pParam ) +#define _NL_STEAM_CALLBACK_4( _, thisclass, func, param, var ) \ + CSteamCallback< thisclass, param > var; void func( param *pParam ) + +//----------------------------------------------------------------------------- +// Purpose: templated base for callbacks - internal implementation detail +//----------------------------------------------------------------------------- +template< int sizeof_P > +class CSteamCallbackImpl : protected CCallbackBase +{ +public: + ~CSteamCallbackImpl() { if ( m_nCallbackFlags & k_ECallbackFlagsRegistered ) nlSteamAPI_UnregisterCallback( this ); } + void SetGameserverFlag() { m_nCallbackFlags |= k_ECallbackFlagsGameServer; } + +protected: + virtual void Run( void *pvParam ) = 0; + virtual void Run( void *pvParam, bool /*bIOFailure*/, SteamAPICall_t /*hSteamAPICall*/ ) { Run( pvParam ); } + virtual int GetCallbackSizeBytes() { return sizeof_P; } +}; + +//----------------------------------------------------------------------------- +// Purpose: maps a steam callback to a class member function +// template params: T = local class, P = parameter struct, +// bGameserver = listen for gameserver callbacks instead of client callbacks +//----------------------------------------------------------------------------- +template< class T, class P, bool bGameserver = false > +class CSteamCallback : public CSteamCallbackImpl< sizeof( P ) > +{ +public: + typedef void (T::*func_t)(P*); + + // NOTE: If you can't provide the correct parameters at construction time, you should + // use the CCallbackManual callback object (STEAM_CALLBACK_MANUAL macro) instead. + CSteamCallback( T *pObj, func_t func ) : m_pObj( NULL ), m_Func( NULL ) + { + if ( bGameserver ) + { + this->SetGameserverFlag(); + } + Register( pObj, func ); + } + + // manual registration of the callback + void Register( T *pObj, func_t func ) + { + if ( !pObj || !func ) + return; + + if ( this->m_nCallbackFlags & CCallbackBase::k_ECallbackFlagsRegistered ) + Unregister(); + + m_pObj = pObj; + m_Func = func; + // SteamAPI_RegisterCallback sets k_ECallbackFlagsRegistered + nlSteamAPI_RegisterCallback( this, P::k_iCallback ); + } + + void Unregister() + { + // SteamAPI_UnregisterCallback removes k_ECallbackFlagsRegistered + nlSteamAPI_UnregisterCallback( this ); + } + +protected: + virtual void Run( void *pvParam ) + { + (m_pObj->*m_Func)( (P *)pvParam ); + } + + T *m_pObj; + func_t m_Func; +}; + +extern NLMISC::CCmdArgs Args; + +// listener called by Steam when AuthSessionTicket is available +class CAuthSessionTicketListener +{ +public: + CAuthSessionTicketListener():_AuthSessionTicketResponse(this, &CAuthSessionTicketListener::OnAuthSessionTicketResponse) + { + _AuthSessionTicketHandle = 0; + _AuthSessionTicketSize = 0; + + _AuthSessionTicketCallbackCalled = false; + _AuthSessionTicketCallbackError = false;; + _AuthSessionTicketCallbackTimeout = false; + } + + // wait until a ticket is available or return if no ticket received after specified ms + bool waitTicket(uint32 ms) + { + // call Steam method + _AuthSessionTicketHandle = s_SteamUser->GetAuthSessionTicket(_AuthSessionTicketData, sizeof(_AuthSessionTicketData), &_AuthSessionTicketSize); + + nldebug("GetAuthSessionTicket returned %u bytes, handle %u", _AuthSessionTicketSize, _AuthSessionTicketHandle); + + nlinfo("Waiting for Steam GetAuthSessionTicket callback..."); + + // define expiration time + NLMISC::TTime expirationTime = NLMISC::CTime::getLocalTime() + ms; + + // wait until callback method is called or expiration + while(!_AuthSessionTicketCallbackCalled && !_AuthSessionTicketCallbackTimeout) + { + // call registered callbacks + nlSteamAPI_RunCallbacks(); + + // check if expired + if (NLMISC::CTime::getLocalTime() > expirationTime) + _AuthSessionTicketCallbackTimeout = true; + } + + // expired + if (_AuthSessionTicketCallbackTimeout) + { + nlwarning("GetAuthSessionTicket callback never called"); + return false; + } + + nlinfo("GetAuthSessionTicket called"); + + // got an error + if (_AuthSessionTicketCallbackError) + { + nlwarning("GetAuthSessionTicket callback returned error"); + return false; + } + + return true; + } + + // return ticket if available in hexadecimal + std::string getTicket() const + { + // if expired or error, ticket is not available + if (!_AuthSessionTicketCallbackCalled || _AuthSessionTicketCallbackError || _AuthSessionTicketCallbackTimeout) return ""; + + // convert buffer to hexadecimal string + return NLMISC::toHexa(_AuthSessionTicketData, _AuthSessionTicketSize); + } + +private: + // ticket handle + HAuthTicket _AuthSessionTicketHandle; + + // buffer of ticket data + uint8 _AuthSessionTicketData[1024]; + + // size of buffer + uint32 _AuthSessionTicketSize; + + // different states of callback + bool _AuthSessionTicketCallbackCalled; + bool _AuthSessionTicketCallbackError; + bool _AuthSessionTicketCallbackTimeout; + + // callback declaration + NL_STEAM_CALLBACK(CAuthSessionTicketListener, OnAuthSessionTicketResponse, GetAuthSessionTicketResponse_t, _AuthSessionTicketResponse); +}; + +// method called by Steam +void CAuthSessionTicketListener::OnAuthSessionTicketResponse(GetAuthSessionTicketResponse_t *inCallback) +{ + _AuthSessionTicketCallbackCalled = true; + + if (inCallback->m_eResult != k_EResultOK) + { + _AuthSessionTicketCallbackError = true; + } +} + +CSteamClient::CSteamClient():_Handle(NULL), _Initialized(false) +{ +} + +CSteamClient::~CSteamClient() +{ + release(); +} + +static void SteamWarningMessageHook(int severity, const char *message) +{ + switch(severity) + { + case 1: // warning + nlwarning("%s", message); + break; + + case 0: // message + nlinfo("%s", message); + break; + + default: // unknown + nlwarning("Unknown severity %d: %s", severity, message); + break; + } +} + +bool CSteamClient::init() +{ + std::string filename; + +#if defined(NL_OS_WIN64) + filename = "steam_api64.dll"; +#elif defined(NL_OS_WINDOWS) + filename = "steam_api.dll"; +#elif defined(NL_OS_MAC) + filename = "libsteam_api.dylib"; +#else + filename = "libsteam_api.so"; +#endif + + // try to load library with absolute path + _Handle = NLMISC::nlLoadLibrary(Args.getProgramPath() + filename); + + if (!_Handle) + { + // try to load library with relative path (will search in system paths) + _Handle = NLMISC::nlLoadLibrary(filename); + + if (!_Handle) + { + nlwarning("Unable to load Steam client"); + return false; + } + } + + // load Steam functions + NL_LOAD_SYMBOL(SteamAPI_Init); + NL_LOAD_SYMBOL(SteamAPI_Shutdown); + + // check if function was found + if (!nlSteamAPI_Init) + { + nlwarning("Unable to get a pointer on SteamAPI_Init"); + return false; + } + + // initialize Steam API + if (!nlSteamAPI_Init()) + { + nlwarning("Unable to initialize Steam client"); + return false; + } + + _Initialized = true; + + // load more Steam functions + NL_LOAD_SYMBOL(SteamAPI_GetHSteamUser); + NL_LOAD_SYMBOL(SteamAPI_GetHSteamPipe); + NL_LOAD_SYMBOL(SteamInternal_CreateInterface); + + HSteamUser hSteamUser = nlSteamAPI_GetHSteamUser(); + HSteamPipe hSteamPipe = nlSteamAPI_GetHSteamPipe(); + + if (!hSteamPipe) + { + nlwarning("Unable to get Steam pipe"); + return false; + } + + // instanciate all used Steam classes + s_SteamClient = (ISteamClient*)nlSteamInternal_CreateInterface(STEAMCLIENT_INTERFACE_VERSION); + if (!s_SteamClient) + return false; + + s_SteamUser = s_SteamClient->GetISteamUser(hSteamUser, hSteamPipe, STEAMUSER_INTERFACE_VERSION); + if (!s_SteamUser) + return false; + + s_SteamApps = s_SteamClient->GetISteamApps(hSteamUser, hSteamPipe, STEAMAPPS_INTERFACE_VERSION); + if (!s_SteamApps) + return false; + + s_SteamFriends = s_SteamClient->GetISteamFriends(hSteamUser, hSteamPipe, STEAMFRIENDS_INTERFACE_VERSION); + if (!s_SteamFriends) + return false; + + s_SteamUtils = s_SteamClient->GetISteamUtils(hSteamPipe, STEAMUTILS_INTERFACE_VERSION); + if (!s_SteamUtils) + return false; + + // set warning messages hook + s_SteamClient->SetWarningMessageHook(SteamWarningMessageHook); + + bool loggedOn = s_SteamUser->BLoggedOn(); + + nlinfo("Steam AppID: %u", s_SteamUtils->GetAppID()); + nlinfo("Steam login: %s", s_SteamFriends->GetPersonaName()); + nlinfo("Steam user logged: %s", loggedOn ? "yes":"no"); + + const char *lang = s_SteamApps->GetCurrentGameLanguage(); + + if (lang && strlen(lang) > 0) + { + nlinfo("Steam language: %s", lang); + NLMISC::CI18N::setSystemLanguageCode(lang); + } + + // don't need to continue, if not connected + if (!loggedOn) return false; + + // load symbols used by AuthSessionTicket + NL_LOAD_SYMBOL(SteamAPI_RegisterCallback); + NL_LOAD_SYMBOL(SteamAPI_UnregisterCallback); + NL_LOAD_SYMBOL(SteamAPI_RunCallbacks); + + CAuthSessionTicketListener listener; + + // wait 5 seconds to get ticket + if (!listener.waitTicket(5000)) return false; + + // save ticket + _AuthSessionTicket = listener.getTicket(); + + nldebug("Auth ticket: %s", _AuthSessionTicket.c_str()); + + return true; +} + +bool CSteamClient::release() +{ + if (!_Handle) return false; + + if (_Initialized) + { + // only shutdown Steam if initialized + nlSteamAPI_Shutdown(); + + _Initialized = false; + } + + // free Steam library from memory + bool res = NLMISC::nlFreeLibrary(_Handle); + + _Handle = NULL; + + return res; +} + + +#endif diff --git a/code/ryzom/client/src/steam_client.h b/code/ryzom/client/src/steam_client.h new file mode 100644 index 000000000..b11f3c6d1 --- /dev/null +++ b/code/ryzom/client/src/steam_client.h @@ -0,0 +1,65 @@ +// Ryzom - MMORPG Framework +// 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 . + + +#ifndef CL_STEAM_CLIENT_H +#define CL_STEAM_CLIENT_H + +#include "nel/misc/types_nl.h" +#include "nel/misc/dynloadlib.h" + +/** + * Steam API helper to be able to call Steam functions/methods without linking to any library. + * The library is dynamically loaded and is optional. + * + * \author Cedric 'Kervala' OCHS + * \date 2016 + */ +class CSteamClient +{ +public: + CSteamClient(); + ~CSteamClient(); + + /** + * Dynamically load Steam client library and functions pointers. + * Also retrieve authentication session ticket if available. + * If no authentication session ticket retrieved, returns false. + */ + bool init(); + + /** + * Shutdown Steam client and unload library. + */ + bool release(); + + /** + * Return the authentication session ticket if available. + */ + std::string getAuthSessionTicket() const { return _AuthSessionTicket; } + +private: + // handle on Steam DLL + NLMISC::NL_LIB_HANDLE _Handle; + + // true if succeeded to initialize (must call shutdown) + bool _Initialized; + + // the retrieved authentication session ticket + std::string _AuthSessionTicket; +}; + +#endif From 7b2b0c93109a5b2d85c5c02407109efdbba6aafa Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 2 Dec 2017 16:46:17 +0100 Subject: [PATCH 28/63] Fixed: Encode password in hexadecimal on command-line when patching to avoid invalid characters --HG-- branch : develop --- code/ryzom/client/src/client.cpp | 13 +++++++++++++ code/ryzom/client/src/login_patch.cpp | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/client.cpp b/code/ryzom/client/src/client.cpp index c92bb887b..4c0121d2e 100644 --- a/code/ryzom/client/src/client.cpp +++ b/code/ryzom/client/src/client.cpp @@ -205,6 +205,19 @@ int main(int argc, char **argv) { LoginPassword = Args.getAdditionalArg("password").front(); + // password in hexadecimal + if (LoginPassword.compare(0, 2, "0x") == 0) + { + std::string decodedPassword; + + // decode password + if (fromHexa(LoginPassword.substr(2), decodedPassword)) + { + // only use it if real hexadecimal + LoginPassword = decodedPassword; + } + } + if (Args.haveAdditionalArg("shard_id")) sLoginShardId = Args.getAdditionalArg("shard_id").front(); } diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index f13d1a782..27ade135e 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -1036,7 +1036,8 @@ void CPatchManager::executeBatchFile() if (!LoginPassword.empty()) { - arguments.push_back(LoginPassword); + // encode password in hexadecimal to avoid invalid characters on command-line + arguments.push_back("0x" + toHexa(LoginPassword)); if (!r2Mode) { From e2dda1585d3225cebb33ed06bb915d7d74f54cb1 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 2 Dec 2017 16:46:44 +0100 Subject: [PATCH 29/63] Changed: Minor changes --HG-- branch : develop --- .../include/nel/misc/fixed_size_allocator.h | 2 +- code/nel/include/nel/misc/mouse_smoother.h | 2 +- code/nel/src/gui/group_menu.cpp | 2 +- code/nel/src/misc/common.cpp | 6 +-- code/nel/src/net/unified_network.cpp | 1 - code/ryzom/client/src/entities.cpp | 41 +++++++++++++------ code/ryzom/client/src/login_patch.cpp | 2 +- 7 files changed, 36 insertions(+), 20 deletions(-) diff --git a/code/nel/include/nel/misc/fixed_size_allocator.h b/code/nel/include/nel/misc/fixed_size_allocator.h index ffc975250..643217f5d 100644 --- a/code/nel/include/nel/misc/fixed_size_allocator.h +++ b/code/nel/include/nel/misc/fixed_size_allocator.h @@ -53,7 +53,7 @@ public: uint getNumAllocatedBlocks() const { return _NumAlloc; } private: class CChunk; - + class NL_ALIGN(NL_DEFAULT_MEMORY_ALIGNMENT) CNode { public: diff --git a/code/nel/include/nel/misc/mouse_smoother.h b/code/nel/include/nel/misc/mouse_smoother.h index f909cde96..18d741996 100644 --- a/code/nel/include/nel/misc/mouse_smoother.h +++ b/code/nel/include/nel/misc/mouse_smoother.h @@ -46,7 +46,7 @@ public: double getSamplingPeriod() const { return _SamplingPeriod; } // Reset smoother. The next returned position will be the exact position of mouse (no smoothing with previous position is done) void reset(); - // \return trueif no sampling has occurred since last resetor construction + // \return true if no sampling has occurred since last resetor construction bool isReseted() const { return !_Init; } // Sample pos, and return smoothed position CVector2f samplePos(const CVector2f &wantedPos, double date); diff --git a/code/nel/src/gui/group_menu.cpp b/code/nel/src/gui/group_menu.cpp index d2e11a2c9..7d002cfd6 100644 --- a/code/nel/src/gui/group_menu.cpp +++ b/code/nel/src/gui/group_menu.cpp @@ -1802,7 +1802,7 @@ namespace NLGUI return 0; } - // ------------------------------------------------------------------------------------------------ + // ------------------------------------------------------------------------------------------------ int CGroupSubMenu::luaAddIconLine(CLuaState &ls) { const char *funcName = "addIconLine"; diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index bb6badd18..db605f4f1 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -633,7 +633,7 @@ void toLower(char *str) } } -std::string toUpper(const std::string &str) +std::string toUpper(const std::string &str) { string res; res.reserve(str.size()); @@ -647,7 +647,7 @@ std::string toUpper(const std::string &str) return res; } -void toUpper(char *str) +void toUpper(char *str) { if (str == 0) return; @@ -1356,7 +1356,7 @@ std::string escapeArgument(const std::string &arg) // we can't escape %VARIABLE% on command-line under Windows return arg; #else - // characters to escapce, only " and $ (to prevent a $something replaced by an environment variable) + // characters to escape, only " and $ (to prevent a $something replaced by an environment variable) static const char s_charsToEscape[] = "\"$"; std::string res; diff --git a/code/nel/src/net/unified_network.cpp b/code/nel/src/net/unified_network.cpp index 3a57b4b0d..2589e1cbf 100644 --- a/code/nel/src/net/unified_network.cpp +++ b/code/nel/src/net/unified_network.cpp @@ -828,7 +828,6 @@ void CUnifiedNetwork::addService(const string &name, const vector for (uint i = 0; i < addr.size(); i++) { // first we have to look if we have a network that can established the connection - uint j = 0; // it's loopback ip address, it's ok diff --git a/code/ryzom/client/src/entities.cpp b/code/ryzom/client/src/entities.cpp index b46d7ce29..2e5555b79 100644 --- a/code/ryzom/client/src/entities.cpp +++ b/code/ryzom/client/src/entities.cpp @@ -800,7 +800,8 @@ bool CEntityManager::setupInstance(uint32 idx, const vector &keys, const if (param == "transparency") { uint t; - if( fromString( values[i], t ) ) { + if (fromString(values[i], t)) + { t = max(0, min((int)t, 255)); makeInstanceTransparent(instance, t, t == 255); } @@ -864,9 +865,12 @@ bool CEntityManager::setupInstance(uint32 idx, const vector &keys, const float v; CVector pos = getInstancePos(idx); - if( getRelativeFloatFromString( values[i], v ) ) { + if (getRelativeFloatFromString(values[i], v)) + { updateVector(param, pos, v, true); - } else { + } + else + { updateVector(param, pos, v, false); } setInstancePos(idx, pos); @@ -877,9 +881,12 @@ bool CEntityManager::setupInstance(uint32 idx, const vector &keys, const float v; CVector rot = getInstanceRot(idx); - if( getRelativeFloatFromString( values[i], v ) ) { + if (getRelativeFloatFromString(values[i], v)) + { updateVector(param, rot, v, true); - } else { + } + else + { updateVector(param, rot, v, false); } setInstanceRot(idx, rot); @@ -889,9 +896,12 @@ bool CEntityManager::setupInstance(uint32 idx, const vector &keys, const float v; CVector scale = instance.getScale(); - if( getRelativeFloatFromString( values[i], v ) ) { + if (getRelativeFloatFromString(values[i], v)) + { updateVector(param, scale, v, true); - } else { + } + else + { updateVector(param, scale, v, false); } instance.setScale(scale); @@ -909,9 +919,12 @@ bool CEntityManager::setupInstance(uint32 idx, const vector &keys, const CVector size = CVector(width, depth, height); float v; - if( getRelativeFloatFromString( values[i], v ) ) { + if (getRelativeFloatFromString(values[i], v)) + { updateVector(param, size, v, true); - } else { + } + else + { updateVector(param, size, v, false); } primitive->setSize(size.x, size.y); @@ -922,9 +935,12 @@ bool CEntityManager::setupInstance(uint32 idx, const vector &keys, const CVector pos = instance.getPos(); float v; - if( getRelativeFloatFromString( values[i], v ) ) { + if (getRelativeFloatFromString(values[i], v)) + { updateVector(param, _ShapeInstances[idx].PrimRelativePos, v, false); - } else { + } + else + { if (param == "col pos x") _ShapeInstances[idx].PrimRelativePos.x = v - pos.x; if (param == "col pos y") @@ -1023,7 +1039,8 @@ CShapeInstanceReference CEntityManager::getShapeInstanceUnderPos(float x, float // if intersect the bbox NLMISC::CAABBox bbox; //= _ShapeInstances[i].SelectionBox; - if(!_ShapeInstances[i].Instance.empty()) { + if(!_ShapeInstances[i].Instance.empty()) + { _ShapeInstances[i].Instance.getShapeAABBox(bbox); CVector bbox_min; CVector bbox_max; diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index 27ade135e..5cf77aae7 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -1033,7 +1033,7 @@ void CPatchManager::executeBatchFile() if (!LoginLogin.empty()) { arguments.push_back(LoginLogin); - + if (!LoginPassword.empty()) { // encode password in hexadecimal to avoid invalid characters on command-line From 403f34215601fb8032c8bac1f652b89a88d2ab4e Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 2 Dec 2017 16:49:48 +0100 Subject: [PATCH 30/63] Changed: Disable NeL samples for Travis --HG-- branch : develop --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6bfad3c3b..ec12c9989 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ os: matrix: fast_finish: true env: - - CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS=OFF -DWITH_LUA51=ON -DWITH_RYZOM_SERVER=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_NEL_TOOLS=OFF" + - CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_LUA51=ON -DWITH_RYZOM_SERVER=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_NEL_TOOLS=OFF" - CMAKE_CONFIGURE_OPTIONS="-DCPPTEST_LIBRARY_DEBUG:STRING=/usr/lib/libcpptest.so" CMAKE_BUILD_OPTIONS="--target nel_unit_test -- -j 2" RUN="build/bin/nel_unit_test" From 1526c7ea84b6a0145e610b7ab64a944fa95aa803 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 3 Dec 2017 12:53:49 +0100 Subject: [PATCH 31/63] Changed: Define Clang features for OS X cross compilation --HG-- branch : develop --- code/CMakeModules/OSXToolChain.cmake | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/code/CMakeModules/OSXToolChain.cmake b/code/CMakeModules/OSXToolChain.cmake index 3036aec01..3169aec78 100644 --- a/code/CMakeModules/OSXToolChain.cmake +++ b/code/CMakeModules/OSXToolChain.cmake @@ -24,9 +24,25 @@ IF(DEFINED CMAKE_CROSSCOMPILING) ENDIF() # Force the compilers to Clang for OS X + +# C SET(CMAKE_C_COMPILER x86_64-apple-darwin15-clang) +SET(CMAKE_C_STANDARD_COMPUTED_DEFAULT "11") +SET(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert") +SET(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") +SET(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") +SET(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") + +# C++ SET(CMAKE_CXX_COMPILER x86_64-apple-darwin15-clang++) -set(CMAKE_CXX_COMPILER_ID "AppleClang") +SET(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17") +SET(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") +SET(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") +SET(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") +SET(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") + +# make +SET(CMAKE_MAKE_PROGRAM make) # Skip the platform compiler checks for cross compiling. SET(CMAKE_CXX_COMPILER_FORCED TRUE) @@ -86,9 +102,10 @@ 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(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) @@ -112,4 +129,3 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # determinate location for bin utils based on CMAKE_FIND_ROOT_PATH INCLUDE(CMakeFindBinUtils) - From b039f3cd6139769463dc5afe894e3098bc5c2c8c Mon Sep 17 00:00:00 2001 From: Nimetu Date: Mon, 4 Dec 2017 18:45:21 +0200 Subject: [PATCH 32/63] Added: /loot command and keyboard shortcut --HG-- branch : develop --- code/ryzom/client/data/gamedev/interfaces_v3/actions.xml | 1 + code/ryzom/client/data/gamedev/interfaces_v3/commands.xml | 2 ++ code/ryzom/client/data/gamedev/interfaces_v3/keys.xml | 1 + code/ryzom/client/src/interface_v3/inventory_manager.cpp | 3 +++ 4 files changed, 7 insertions(+) diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/actions.xml b/code/ryzom/client/data/gamedev/interfaces_v3/actions.xml index d628a6996..42c931e29 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/actions.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/actions.xml @@ -235,6 +235,7 @@ + diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/commands.xml b/code/ryzom/client/data/gamedev/interfaces_v3/commands.xml index d7aabccae..31a1a7099 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/commands.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/commands.xml @@ -120,6 +120,8 @@ + + diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/keys.xml b/code/ryzom/client/data/gamedev/interfaces_v3/keys.xml index ae212a589..40ecd1c75 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/keys.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/keys.xml @@ -278,6 +278,7 @@ +