From b1fdbe61a0342bb850099b76f5503d5fa5c124d7 Mon Sep 17 00:00:00 2001 From: Zegeri Date: Sun, 21 Oct 2018 20:06:47 +0200 Subject: [PATCH 1/7] xrGame: Add ik/*.cxx files to cmake --- cmake/utils.cmake | 2 +- src/xrGame/ik/limb.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/utils.cmake b/cmake/utils.cmake index b9b35d2aa76..c380e23740f 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -5,7 +5,7 @@ macro(add_dir DIRS) file( GLOB ${dir}__INCLUDES_H ${dir} ${dir}/*.h) file( GLOB ${dir}__INCLUDES_HPP ${dir} ${dir}/*.hpp) list( APPEND ${PROJECT_NAME}__INCLUDES ${${dir}__INCLUDES_H} ${${dir}__INCLUDES_HPP} ) - file( GLOB ${dir}__SOURCES_CPP ${dir} ${dir}/*.cpp) + file( GLOB ${dir}__SOURCES_CPP ${dir} ${dir}/*.cpp ${dir}/*.cxx) file( GLOB ${dir}__SOURCES_C ${dir} ${dir}/*.c) list( APPEND ${PROJECT_NAME}__SOURCES ${${dir}__SOURCES_C} ${${dir}__SOURCES_CPP} ) endforeach() diff --git a/src/xrGame/ik/limb.cpp b/src/xrGame/ik/limb.cpp index c2041ebf530..03f1e7d41cf 100644 --- a/src/xrGame/ik/limb.cpp +++ b/src/xrGame/ik/limb.cpp @@ -33,6 +33,10 @@ #include "StdAfx.h" #include "limb.h" +#ifdef LINUX +#undef roundup // defined in +#endif + enum { SolvePosOnly = 1, From 03a32d296ea604eeb5fbef24b7e35fb9bab0d009 Mon Sep 17 00:00:00 2001 From: Zegeri Date: Mon, 22 Oct 2018 18:51:45 +0200 Subject: [PATCH 2/7] xrAICore: Fix hash_fixed_vertex_manager::to_u32 in Linux Hopefully this time it doesn't break Windows. --- src/xrAICore/Navigation/graph_engine.h | 4 ++-- .../Navigation/vertex_manager_hash_fixed_inline.h | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/xrAICore/Navigation/graph_engine.h b/src/xrAICore/Navigation/graph_engine.h index 262fee08917..b9c30aaa39e 100644 --- a/src/xrAICore/Navigation/graph_engine.h +++ b/src/xrAICore/Navigation/graph_engine.h @@ -13,12 +13,12 @@ #include "xrAICore/Navigation/vertex_manager_fixed.h" #include "xrAICore/Navigation/vertex_allocator_fixed.h" #include "xrAICore/Navigation/data_storage_bucket_list.h" +#include "xrAICore/Navigation/PathManagers/path_manager.h" +#include "xrAICore/Navigation/graph_engine_space.h" #ifndef AI_COMPILER #include "xrAICore/Navigation/vertex_manager_hash_fixed.h" #include "xrAICore/Navigation/data_storage_binary_heap.h" #endif -#include "xrAICore/Navigation/PathManagers/path_manager.h" -#include "xrAICore/Navigation/graph_engine_space.h" #include "xrEngine/profiler.h" #include "xrAICore/Components/problem_solver.h" #include "xrAICore/Components/operator_condition.h" diff --git a/src/xrAICore/Navigation/vertex_manager_hash_fixed_inline.h b/src/xrAICore/Navigation/vertex_manager_hash_fixed_inline.h index 6f524262656..11c8af82984 100644 --- a/src/xrAICore/Navigation/vertex_manager_hash_fixed_inline.h +++ b/src/xrAICore/Navigation/vertex_manager_hash_fixed_inline.h @@ -8,6 +8,12 @@ #pragma once +namespace hash_fixed_vertex_manager +{ +extern u32 to_u32(const GraphEngineSpace::CWorldState& other); +extern u32 to_u32(const shared_str& other); +} + #define TEMPLATE_SPECIALIZATION \ template \ template @@ -67,11 +73,7 @@ inline bool CHashFixedVertexManager::is_opened(const Vertex& vertex) const { ret TEMPLATE_SPECIALIZATION inline u32 CHashFixedVertexManager::hash_index(const Index& vertex_id) const { -#ifdef LINUX // FIXME!! - return 0; -#else return hash_fixed_vertex_manager::to_u32(vertex_id) % HashSize; -#endif } TEMPLATE_SPECIALIZATION From 692dd12aac2d7ca5681e65792b6115a431f5d19e Mon Sep 17 00:00:00 2001 From: Zegeri Date: Mon, 22 Oct 2018 19:02:34 +0200 Subject: [PATCH 3/7] Use upper case in directory Localization in fsgame.ltx Lazy solution for Linux's case-sensitive behaviour. A proper solution might be required in the future. --- res/fsgame.ltx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/fsgame.ltx b/res/fsgame.ltx index 4082c5030bd..560f9988ca9 100644 --- a/res/fsgame.ltx +++ b/res/fsgame.ltx @@ -4,7 +4,7 @@ $arch_dir$ = false| false| $fs_root$ $game_arch_mp$ = false| false| $fs_root$| mp\ $arch_dir_levels$ = false| false| $fs_root$| levels\ $arch_dir_resources$ = false| false| $fs_root$| resources\ -$arch_dir_localization$ = false| false| $fs_root$| localization\ +$arch_dir_localization$ = false| false| $fs_root$| Localization\ $arch_dir_patches$ = false| true| $fs_root$| patches\ $game_data$ = false| true| $fs_root$| gamedata\ $game_ai$ = true| false| $game_data$| ai\ From 497ab31a97d961d57b683cbb089cdfecd27d66be Mon Sep 17 00:00:00 2001 From: Zegeri Date: Mon, 22 Oct 2018 19:05:42 +0200 Subject: [PATCH 4/7] xrAICore: Remove -DAI_COMPILER in cmake. This flag is supposed to be used when compiling the xrAI tool --- src/xrAICore/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xrAICore/CMakeLists.txt b/src/xrAICore/CMakeLists.txt index 01c1f3d90ad..e0e10952682 100644 --- a/src/xrAICore/CMakeLists.txt +++ b/src/xrAICore/CMakeLists.txt @@ -23,7 +23,7 @@ include_directories( # endif() #endforeach() -add_definitions(-DXRAICORE_EXPORTS) +add_definitions(-DXRAICORE_EXPORTS -D_SECURE_SCL=0) add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}__SOURCES} ${${PROJECT_NAME}__INCLUDES}) set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "pch.hpp") From 666e3c06d249f25339e45b01b471441ceb22c210 Mon Sep 17 00:00:00 2001 From: Zegeri Date: Mon, 22 Oct 2018 19:09:33 +0200 Subject: [PATCH 5/7] Don't use DELIMITER for textures defined in xml files with "\" --- src/Layers/xrRender/dxUIRender.cpp | 2 +- src/xrGame/HUDCrosshair.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Layers/xrRender/dxUIRender.cpp b/src/Layers/xrRender/dxUIRender.cpp index 26d07cc3b6d..413d18e4ac9 100644 --- a/src/Layers/xrRender/dxUIRender.cpp +++ b/src/Layers/xrRender/dxUIRender.cpp @@ -160,7 +160,7 @@ LPCSTR dxUIRender::UpdateShaderName(LPCSTR tex_name, LPCSTR sh_name) u32 v_need = CAP_VERSION(2, 0); // strstr(Core.Params,"-ps_movie") && if ((v_dev >= v_need) && FS.exist(buff, "$game_textures$", tex_name, ".ogm")) - return "hud" DELIMITER "movie"; + return "hud\\movie"; else return sh_name; } diff --git a/src/xrGame/HUDCrosshair.cpp b/src/xrGame/HUDCrosshair.cpp index 7286d62621d..500fbe03675 100644 --- a/src/xrGame/HUDCrosshair.cpp +++ b/src/xrGame/HUDCrosshair.cpp @@ -9,7 +9,7 @@ CHUDCrosshair::CHUDCrosshair() { - hShader->create("hud" DELIMITER "crosshair"); + hShader->create("hud\\crosshair"); radius = 0; } From 0e19f8186d936cd58ef1ba471771f2224929e4a3 Mon Sep 17 00:00:00 2001 From: Zegeri Date: Thu, 25 Oct 2018 13:33:45 +0200 Subject: [PATCH 6/7] xrUICore: Export color_animation symbol --- src/xrUICore/Static/UILanimController.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/xrUICore/Static/UILanimController.h b/src/xrUICore/Static/UILanimController.h index 78b9f16300c..637cb094fc4 100644 --- a/src/xrUICore/Static/UILanimController.h +++ b/src/xrUICore/Static/UILanimController.h @@ -20,6 +20,7 @@ struct XRUICORE_API color_animation Flags8 m_lanimFlags; }; +// Unused struct xform_animation : public color_animation { xform_animation(); From 93682da13338e3154bfb0e7804055c6ac14242f2 Mon Sep 17 00:00:00 2001 From: Zegeri Date: Thu, 25 Oct 2018 13:46:04 +0200 Subject: [PATCH 7/7] Use xrCore's locks instead of std::mutex I suggest that in the future Lock should become a wrapper of std::mutex and the current Lock should be renamed to RecursiveLock. --- src/xrUICore/XML/UITextureMaster.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/xrUICore/XML/UITextureMaster.cpp b/src/xrUICore/XML/UITextureMaster.cpp index 837cef0635e..6d3cd97dae3 100644 --- a/src/xrUICore/XML/UITextureMaster.cpp +++ b/src/xrUICore/XML/UITextureMaster.cpp @@ -13,8 +13,9 @@ #include "uiabstract.h" #include "xrUIXmlParser.h" #include "Include/xrRender/UIShader.h" +#include "xrCore/Threading/Lock.hpp" +#include "xrCore/Threading/ScopeLock.hpp" #include -#include xr_map CUITextureMaster::m_textures; xr_map CUITextureMaster::m_shaders; @@ -55,10 +56,8 @@ void CUITextureMaster::ParseShTexInfo(pcstr path, pcstr xml_file) /* avo: fix issue when values were not updated (silently skipped) when same key is encountered more than once. This is how std::map is designed. /* Also used more efficient C++11 std::map::emplace method instead of outdated std::pair::make_pair */ /* XXX: avo: note that xxx.insert(mk_pair(v1,v2)) pattern is used extensively throughout solution so there is a good potential for other bug fixes/improvements */ -#ifdef LINUX - static std::mutex new_texture_mutex; - std::scoped_lock new_texture_lock (new_texture_mutex); -#endif + static Lock new_texture_lock; + ScopeLock new_texture_guard(&new_texture_lock); if (m_textures.find(id) == m_textures.end()) m_textures.emplace(id, info); else