From 8c46a655c636ecd9364434a55d6ecd517d91cafb Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 3 Jan 2018 14:06:25 +0100 Subject: [PATCH 1/3] Fixed: Wrong string conversions --HG-- branch : develop --- .../nel_export/nel_export_node_properties.cpp | 22 +++++++++---------- .../vertex_tree_paint.cpp | 6 ++--- .../plugin_max/tile_utility/tile_utility.cpp | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp index 68436304c..949395d14 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp @@ -508,41 +508,41 @@ INT_PTR CALLBACK AccelDialogCallback ( { for (uint i=0; _MaterialNames[i] != 0; ++i) { - SendMessage (GetDlgItem (hwndDlg, IDC_OCC_MODEL), CB_ADDSTRING, 0, (LPARAM)(_MaterialNames[i])); - SendMessage (GetDlgItem (hwndDlg, IDC_OPEN_OCC_MODEL), CB_ADDSTRING, 0, (LPARAM)(_MaterialNames[i])); + SendMessage (GetDlgItem (hwndDlg, IDC_OCC_MODEL), CB_ADDSTRING, 0, (LPARAM)_MaterialNames[i]); + SendMessage (GetDlgItem (hwndDlg, IDC_OPEN_OCC_MODEL), CB_ADDSTRING, 0, (LPARAM)_MaterialNames[i]); } } { for (uint i =0; _EnvironmentNames[i] != 0; ++i) { - SendMessage (GetDlgItem (hwndDlg, IDC_ENV_FX), CB_ADDSTRING, 0, (LPARAM)(_EnvironmentNames[i])); + SendMessage (GetDlgItem (hwndDlg, IDC_ENV_FX), CB_ADDSTRING, 0, (LPARAM)_EnvironmentNames[i]); } } { std::set::iterator first(_KnownSoundGroups.begin()), last(_KnownSoundGroups.end()); for (; first != last; ++first) { - SendMessage (GetDlgItem (hwndDlg, IDC_SOUND_GROUP), CB_ADDSTRING, 0, (LPARAM)(first->c_str())); + SendMessage (GetDlgItem (hwndDlg, IDC_SOUND_GROUP), CB_ADDSTRING, 0, (LPARAM)utf8ToTStr(*first)); } } // set the combo and edit box - if (SendMessage (GetDlgItem (hwndDlg, IDC_OCC_MODEL), CB_SELECTSTRING, -1, (LPARAM)(currentParam->OcclusionModel.c_str())) == CB_ERR) + if (SendMessage (GetDlgItem (hwndDlg, IDC_OCC_MODEL), CB_SELECTSTRING, -1, (LPARAM)utf8ToTStr(currentParam->OcclusionModel)) == CB_ERR) { // nlassert(false); } - if (SendMessage (GetDlgItem (hwndDlg, IDC_OPEN_OCC_MODEL), CB_SELECTSTRING, -1, (LPARAM)(currentParam->OpenOcclusionModel.c_str())) == CB_ERR) + if (SendMessage (GetDlgItem (hwndDlg, IDC_OPEN_OCC_MODEL), CB_SELECTSTRING, -1, (LPARAM)utf8ToTStr(currentParam->OpenOcclusionModel)) == CB_ERR) { // nlassert(false); } - if (SendMessage (GetDlgItem (hwndDlg, IDC_ENV_FX), CB_SELECTSTRING, -1, (LPARAM)(currentParam->EnvironmentFX.c_str())) == CB_ERR) + if (SendMessage (GetDlgItem (hwndDlg, IDC_ENV_FX), CB_SELECTSTRING, -1, (LPARAM)utf8ToTStr(currentParam->EnvironmentFX)) == CB_ERR) { // nlassert(false); } - if (SendMessage (GetDlgItem (hwndDlg, IDC_SOUND_GROUP), CB_SELECTSTRING, -1, (LPARAM)(currentParam->SoundGroup.c_str())) == CB_ERR) + if (SendMessage (GetDlgItem (hwndDlg, IDC_SOUND_GROUP), CB_SELECTSTRING, -1, (LPARAM)utf8ToTStr(currentParam->SoundGroup)) == CB_ERR) { // nlassert(false); } -// SendMessage(GetDlgItem(hwndDlg, IDC_SOUND_GROUP), WM_SETTEXT, 0, (LONG)(currentParam->SoundGroup.c_str())); +// SendMessage(GetDlgItem(hwndDlg, IDC_SOUND_GROUP), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(currentParam->SoundGroup)); bool accelerator = (currentParam->AcceleratorType != -1); CheckRadioButton (hwndDlg, IDC_RADIOACCELNO, IDC_RADIOACCELCLUSTER, accelerator?(IDC_RADIOACCELNO+(currentParam->AcceleratorType&NEL3D_APPDATA_ACCEL_TYPE)):0); @@ -1789,8 +1789,8 @@ INT_PTR CALLBACK VertexProgramDialogCallBack ( if(currentParam->VertexProgramId>=0) { // Init DropList. - SendDlgItemMessage(hwndDlg, IDC_COMBO_VP, CB_ADDSTRING, 0, (LPARAM)"Disable"); - SendDlgItemMessage(hwndDlg, IDC_COMBO_VP, CB_ADDSTRING, 0, (LPARAM)"Wind Tree"); + SendDlgItemMessage(hwndDlg, IDC_COMBO_VP, CB_ADDSTRING, 0, (LPARAM)_T("Disable")); + SendDlgItemMessage(hwndDlg, IDC_COMBO_VP, CB_ADDSTRING, 0, (LPARAM)_T("Wind Tree")); SendDlgItemMessage(hwndDlg, IDC_COMBO_VP, CB_SETCURSEL, currentParam->VertexProgramId, 0); EnableWindow( GetDlgItem(hwndDlg, IDC_COMBO_VP), TRUE); } diff --git a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp index 3a513683a..664ec0868 100644 --- a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp +++ b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp @@ -119,9 +119,9 @@ static INT_PTR CALLBACK VertexPaintDlgProc(HWND hWnd, UINT msg, WPARAM wParam, L // Init comboBox - SendDlgItemMessage(hWnd, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)"Tree Weight"); - SendDlgItemMessage(hWnd, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)"Phase Level 1"); - SendDlgItemMessage(hWnd, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)"Phase Level 2"); + SendDlgItemMessage(hWnd, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)_T("Tree Weight")); + SendDlgItemMessage(hWnd, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)_T("Phase Level 1")); + SendDlgItemMessage(hWnd, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)_T("Phase Level 2")); SendDlgItemMessage(hWnd, IDC_COMBO_TYPE, CB_SETCURSEL, mod->getEditionType(), 0); // If paint mode at last edit. diff --git a/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp b/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp index c9d5ca7f0..893f44eea 100644 --- a/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp +++ b/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp @@ -337,7 +337,7 @@ void Tile_utility::SetupUI () std::string name=Bank.getLand(nLand)->getName(); if (hCombo) { - SendMessage (hCombo, CB_INSERTSTRING, -1, (LPARAM) name.c_str()); + SendMessage (hCombo, CB_INSERTSTRING, -1, (LPARAM)utf8ToTStr(name)); } } From 8c253955b788bde2aef6800f6f2221933caf47d1 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 3 Jan 2018 14:09:46 +0100 Subject: [PATCH 2/3] Changed: Better support for Visual C++ 2017 --HG-- branch : develop --- code/CMakeModules/FindMSVC.cmake | 86 +++++++++++++++----------- code/CMakeModules/FindWindowsSDK.cmake | 4 +- 2 files changed, 52 insertions(+), 38 deletions(-) diff --git a/code/CMakeModules/FindMSVC.cmake b/code/CMakeModules/FindMSVC.cmake index 706541463..5dbc4f6a8 100644 --- a/code/CMakeModules/FindMSVC.cmake +++ b/code/CMakeModules/FindMSVC.cmake @@ -56,16 +56,18 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION) ENDMACRO() MACRO(DETECT_VC_VERSION _VERSION) - SET(VC${_VERSION}_FOUND OFF) - DETECT_VC_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION}) + IF(NOT VC_FOUND) + SET(VC${_VERSION}_FOUND OFF) + DETECT_VC_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION}) - IF(NOT VC${_VERSION}_FOUND) - DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION}) - ENDIF() + IF(NOT VC${_VERSION}_FOUND) + DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION}) + ENDIF() - IF(VC${_VERSION}_FOUND) - SET(VC_FOUND ON) - SET(VC_DIR "${VC${_VERSION}_DIR}") + IF(VC${_VERSION}_FOUND) + SET(VC_FOUND ON) + SET(VC_DIR "${VC${_VERSION}_DIR}") + ENDIF() ENDIF() ENDMACRO() @@ -77,7 +79,7 @@ MACRO(DETECT_EXPRESS_VERSION _VERSION) ENDIF() ENDMACRO() -IF(MSVC1411 OR MSVC1410) +IF(MSVC_VERSION GREATER 1909) DETECT_VC_VERSION("15.0") SET(MSVC_TOOLSET "140") @@ -98,44 +100,18 @@ IF(MSVC1411 OR MSVC1410) SET(VC_DIR "${VC_DIR}/${MSVC_TOOLCHAIN_VERSION}") SET(VC_INCLUDE_DIR "${VC_DIR}/include") - - IF(NOT MSVC14_REDIST_DIR) - # If you have VC++ 2017 Express, put x64/Microsoft.VC141.CRT/*.dll in ${EXTERNAL_PATH}/redist - # original files whould be in ${VC_DIR}/Redist/MSVC/14.11.25325/x64/Microsoft.VC141.CRT - SET(MSVC14_REDIST_DIR "${EXTERNAL_PATH}/redist") - ENDIF() ELSEIF(MSVC14) DETECT_VC_VERSION("14.0") SET(MSVC_TOOLSET "140") - - IF(NOT MSVC14_REDIST_DIR) - # If you have VC++ 2015 Express, put x64/Microsoft.VC140.CRT/*.dll in ${EXTERNAL_PATH}/redist - SET(MSVC14_REDIST_DIR "${EXTERNAL_PATH}/redist") - ENDIF() ELSEIF(MSVC12) DETECT_VC_VERSION("12.0") SET(MSVC_TOOLSET "120") - - IF(NOT MSVC12_REDIST_DIR) - # If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist - SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist") - ENDIF() ELSEIF(MSVC11) DETECT_VC_VERSION("11.0") SET(MSVC_TOOLSET "110") - - IF(NOT MSVC11_REDIST_DIR) - # If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist - SET(MSVC11_REDIST_DIR "${EXTERNAL_PATH}/redist") - ENDIF() ELSEIF(MSVC10) DETECT_VC_VERSION("10.0") SET(MSVC_TOOLSET "100") - - IF(NOT MSVC10_REDIST_DIR) - # If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist - SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist") - ENDIF() ELSEIF(MSVC90) DETECT_VC_VERSION("9.0") SET(MSVC_TOOLSET "90") @@ -147,6 +123,8 @@ ENDIF() # If you plan to use VC++ compilers with WINE, set VC_DIR environment variable IF(NOT VC_DIR) SET(VC_DIR $ENV{VC_DIR}) + # Fix path + FILE(TO_CMAKE_PATH ${VC_DIR} VC_DIR) ENDIF() IF(NOT VC_DIR) @@ -158,8 +136,44 @@ IF(NOT VC_DIR) STRING(REGEX REPLACE "/(bin|BIN|Bin)/.+" "" VC_DIR ${_COMPILER}) ENDIF() -IF(NOT VC_INCLUDE_DIR) +IF(NOT VC_INCLUDE_DIR AND VC_DIR AND EXISTS "${VC_DIR}") SET(VC_INCLUDE_DIR "${VC_DIR}/include") + IF(EXISTS "${VC_INCLUDE_DIR}") + SET(VC_FOUND ON) + ENDIF() +ENDIF() + +SET(MSVC_REDIST_DIR "${EXTERNAL_PATH}/redist") + +IF(NOT EXISTS "${MSVC_REDIST_DIR}") + SET(MSVC_REDIST_DIR "${VC_DIR}/redist") + + IF(NOT EXISTS "${MSVC_REDIST_DIR}") + SET(MSVC_REDIST_DIR) + ENDIF() +ENDIF() + +IF(MSVC_REDIST_DIR) + IF(MSVC1411 OR MSVC1410) + # If you have VC++ 2017 Express, put x64/Microsoft.VC141.CRT/*.dll in ${EXTERNAL_PATH}/redist + # original files whould be in ${VC_DIR}/Redist/MSVC/14.11.25325/x64/Microsoft.VC141.CRT + SET(MSVC14_REDIST_DIR "${MSVC_REDIST_DIR}") + ELSEIF(MSVC14) + SET(MSVC14_REDIST_DIR "${MSVC_REDIST_DIR}") + ELSEIF(MSVC12) + # If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist + SET(MSVC12_REDIST_DIR "${MSVC_REDIST_DIR}") + ELSEIF(MSVC11) + # If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist + SET(MSVC11_REDIST_DIR "${MSVC_REDIST_DIR}") + ELSEIF(MSVC10) + # If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist + SET(MSVC10_REDIST_DIR "${MSVC_REDIST_DIR}") + ELSEIF(MSVC90) + SET(MSVC90_REDIST_DIR "${MSVC_REDIST_DIR}") + ELSEIF(MSVC80) + SET(MSVC80_REDIST_DIR "${MSVC_REDIST_DIR}") + ENDIF() ENDIF() MESSAGE(STATUS "Using headers from ${VC_INCLUDE_DIR}") diff --git a/code/CMakeModules/FindWindowsSDK.cmake b/code/CMakeModules/FindWindowsSDK.cmake index 0e2735570..3d9c43bd9 100644 --- a/code/CMakeModules/FindWindowsSDK.cmake +++ b/code/CMakeModules/FindWindowsSDK.cmake @@ -240,7 +240,7 @@ MACRO(USE_CURRENT_WINSDK) IF(NOT WINSDK_DIR) # Use Windows SDK versions installed with VC++ when possible - IF(MSVC1411 OR MSVC1410) + IF(MSVC_VERSION GREATER 1909) # Special case, use Kits for SDK SET(WINSDK_VERSION "10.0") SET(WINSDK_DIR ${WINSDK_UCRT_DIR}) @@ -484,7 +484,7 @@ IF(WINSDK_INCLUDE_DIR) SET(CMAKE_LIBRARY_PATH ${WINSDK_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH}) - # Fix for using Windows SDK 7.1 with Visual C++ 2012, 2013 and 2015 + # Fix for using Windows SDK 7.1 with Visual C++ 2012, 2013, 2015 and 2017 IF(WINSDK_VERSION STREQUAL "7.1" AND (MSVC11 OR MSVC12 OR MSVC14)) ADD_DEFINITIONS(-D_USING_V110_SDK71_) ENDIF() From dcb3f2b149999d90633a1f41d91b0078c396fa67 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 3 Jan 2018 14:10:30 +0100 Subject: [PATCH 3/3] Fixed: Send an Unicode empty string --HG-- branch : develop --- code/nel/src/misc/win_displayer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/nel/src/misc/win_displayer.cpp b/code/nel/src/misc/win_displayer.cpp index b157448ec..d350f25f3 100644 --- a/code/nel/src/misc/win_displayer.cpp +++ b/code/nel/src/misc/win_displayer.cpp @@ -502,7 +502,7 @@ void CWinDisplayer::clear () SendMessageW (_HEdit, EM_SETSEL, 0, nIndex); // clear all the text - SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LPARAM) ""); + SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LPARAM) L""); SendMessageW(_HEdit,EM_SETMODIFY,(WPARAM)TRUE,(LPARAM)0); @@ -575,7 +575,7 @@ void CWinDisplayer::display_main () LRESULT oldIndex2 = SendMessageW (_HEdit, EM_LINEINDEX, nblineremove, 0); //nlassert (oldIndex2 != -1); SendMessageW (_HEdit, EM_SETSEL, oldIndex1, oldIndex2); - SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LPARAM) ""); + SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LPARAM) L""); // update the selection due to the erasing sint dt = (sint)(oldIndex2 - oldIndex1);