Merge branch 'development' into cmake/warn_virtual

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-09-10 20:27:01 -07:00
156 changed files with 35196 additions and 34784 deletions
@@ -689,9 +689,6 @@ namespace AZ::IO
return AZ::IO::InvalidHandle;
}
AZ_PROFILE_SCOPE(Game, "File: %.*s Archive: %p",
aznumeric_cast<int>(pName.size()), pName.data(), this);
SAutoCollectFileAccessTime accessTime(this);
AZ::IO::HandleType fileHandle = AZ::IO::InvalidHandle;
@@ -1915,7 +1912,7 @@ namespace AZ::IO
return m_pFileEntry->nFileDataOffset;
}
bool Archive::MakeDir(AZStd::string_view szPathIn, [[maybe_unused]] bool bGamePathMapping)
bool Archive::MakeDir(AZStd::string_view szPathIn)
{
AZ::IO::StackString pathStr{ szPathIn };
// Determine if there is a period ('.') after the last slash to determine if the path contains a file.
@@ -2330,7 +2327,9 @@ namespace AZ::IO
// we only want to record ASSET access
// assets are identified as things which start with no alias, or with the @assets@ alias
auto assetPath = AZ::IO::FileIOBase::GetInstance()->ConvertToAlias(szFilename);
if (assetPath && assetPath->Native().starts_with("@assets@"))
if (assetPath && (assetPath->Native().starts_with("@assets@")
|| assetPath->Native().starts_with("@root@")
|| assetPath->Native().starts_with("@projectplatformcache@")))
{
IResourceList* pList = GetResourceList(m_eRecordFileOpenList);
@@ -249,7 +249,7 @@ namespace AZ::IO
IArchive::SignedFileSize GetFileSizeOnDisk(AZStd::string_view filename) override;
// creates a directory
bool MakeDir(AZStd::string_view szPath, bool bGamePathMapping = false) override;
bool MakeDir(AZStd::string_view szPath) override;
// compresses the raw data into raw data. The buffer for compressed data itself with the heap passed. Uses method 8 (deflate)
// returns one of the Z_* errors (Z_OK upon success)
@@ -335,7 +335,7 @@ namespace AZ::IO
virtual IArchive::SignedFileSize GetFileSizeOnDisk(AZStd::string_view filename) = 0;
// creates a directory
virtual bool MakeDir(AZStd::string_view szPath, bool bGamePathMapping = false) = 0;
virtual bool MakeDir(AZStd::string_view szPath) = 0;
// open the physical archive file - creates if it doesn't exist
// returns NULL if it's invalid or can't open the file
@@ -287,11 +287,8 @@ namespace AZ
const char* assetAliasPath = GetAlias("@assets@");
if (path && assetAliasPath)
{
AZStd::string assetsAlias(assetAliasPath);
AZStd::string pathString = path;
AZStd::to_lower(assetsAlias.begin(), assetsAlias.end());
AZStd::to_lower(pathString.begin(), pathString.end());
if (AZ::IO::PathView(pathString.c_str()).IsRelativeTo(assetsAlias.c_str()))
const AZ::IO::PathView pathView(path);
if (pathView.IsRelativeTo(assetAliasPath))
{
AZ_Error("FileIO", false, "You may not alter data inside the asset cache. Please check the call stack and consider writing into the source asset folder instead.\n"
"Attempted write location: %s", path);
@@ -587,26 +584,11 @@ namespace AZ
// strings that are shorter than the alias's mapped path without checking.
if ((longestMatch == 0) || (resolvedAlias.size() > longestMatch) && (resolvedAlias.size() <= bufStringLength))
{
// custom strcmp that ignores slash directions
constexpr AZStd::string_view pathSeparators{ "/\\" };
bool allMatch = AZStd::equal(resolvedAlias.begin(), resolvedAlias.end(), inBuffer.begin(),
[&pathSeparators](const char lhs, const char rhs)
// Check if the input path is relative to the alias value
if (AZ::IO::PathView(inBuffer).IsRelativeTo(AZ::IO::PathView(resolvedAlias)))
{
const bool lhsIsSeparator = pathSeparators.find_first_of(lhs) != AZStd::string_view::npos;
const bool rhsIsSeparator = pathSeparators.find_first_of(lhs) != AZStd::string_view::npos;
return (lhsIsSeparator && rhsIsSeparator) || tolower(lhs) == tolower(rhs);
});
if (allMatch)
{
// Either the resolvedAlias path must match the path exactly or the path must have a path separator character
// right after the resolved alias
if (const size_t matchLen = resolvedAlias.size();
matchLen == bufStringLength || (pathSeparators.find_first_of(inBuffer[matchLen]) != AZStd::string_view::npos))
{
longestMatch = matchLen;
longestAlias = alias;
}
longestMatch = resolvedAlias.size();
longestAlias = alias;
}
}
}
@@ -712,6 +694,7 @@ namespace AZ
const char* assetAliasPath = GetAlias("@assets@");
const char* rootAliasPath = GetAlias("@root@");
const char* projectPlatformCacheAliasPath = GetAlias("@projectplatformcache@");
const bool lowercasePath = (assetAliasPath != nullptr && AZ::StringFunc::StartsWith(resolvedPath, assetAliasPath)) ||
(rootAliasPath != nullptr && AZ::StringFunc::StartsWith(resolvedPath, rootAliasPath)) ||
(projectPlatformCacheAliasPath != nullptr && AZ::StringFunc::StartsWith(resolvedPath, projectPlatformCacheAliasPath));
@@ -7,6 +7,7 @@
*/
#include "TerrainDataRequestBus.h"
#include <AzCore/Serialization/SerializeContext.h>
namespace AzFramework
{
@@ -45,8 +45,6 @@ namespace AzFramework
void EntityVisibilityBoundsUnionSystem::OnEntityActivated(AZ::Entity* entity)
{
AZ_PROFILE_FUNCTION(AzFramework);
// ignore any entity that might activate which does not have a TransformComponent
if (entity->GetTransform() == nullptr)
{
@@ -68,8 +66,6 @@ namespace AzFramework
void EntityVisibilityBoundsUnionSystem::OnEntityDeactivated(AZ::Entity* entity)
{
AZ_PROFILE_FUNCTION(AzFramework);
// ignore any entity that might deactivate which does not have a TransformComponent
if (entity->GetTransform() == nullptr)
{
@@ -89,8 +85,6 @@ namespace AzFramework
void EntityVisibilityBoundsUnionSystem::UpdateVisibilitySystem(AZ::Entity* entity, EntityVisibilityBoundsUnionInstance& instance)
{
AZ_PROFILE_FUNCTION(AzFramework);
if (const auto& localEntityBoundsUnions = instance.m_localEntityBoundsUnion; localEntityBoundsUnions.IsValid())
{
// note: worldEntityBounds will not be a 'tight-fit' Aabb but that of a transformed local aabb
@@ -155,8 +149,6 @@ namespace AzFramework
void EntityVisibilityBoundsUnionSystem::OnTransformUpdated(AZ::Entity* entity)
{
AZ_PROFILE_FUNCTION(AzFramework);
// update the world transform of the visibility bounds union
if (auto instance_it = m_entityVisibilityBoundsUnionInstanceMapping.find(entity);
instance_it != m_entityVisibilityBoundsUnionInstanceMapping.end())
@@ -21,9 +21,6 @@ namespace AzFramework
#elif PAL_TRAIT_LINUX_WINDOW_MANAGER_WAYLAND
#error "Linux Window Manager Wayland not supported."
return nullptr;
#elif PAL_TRAIT_LINUX_WINDOW_MANAGER_XLIB
#error "Linux Window Manager XLIB not supported."
return nullptr;
#else
#error "Linux Window Manager not recognized."
return nullptr;
@@ -5,6 +5,7 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzFramework/API/ApplicationAPI_Platform.h>
#include <AzFramework/Application/Application.h>
@@ -17,9 +17,6 @@ namespace AzFramework
#elif PAL_TRAIT_LINUX_WINDOW_MANAGER_WAYLAND
#error "Linux Window Manager Wayland not supported."
return nullptr;
#elif PAL_TRAIT_LINUX_WINDOW_MANAGER_XLIB
#error "Linux Window Manager XLIB not supported."
return nullptr;
#else
#error "Linux Window Manager not recognized."
return nullptr;
@@ -5,6 +5,7 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzFramework/API/ApplicationAPI_Platform.h>
#include <AzFramework/Application/Application.h>
@@ -7,7 +7,7 @@
#
# Based on the linux window manager trait, perform the appropriate additional build configurations
# Only 'xcb', 'wayland', and 'xlib' are recognized
# Only 'xcb' and 'wayland' are recognized
if (${PAL_TRAIT_LINUX_WINDOW_MANAGER} STREQUAL "xcb")
find_library(XCB_LIBRARY xcb)
@@ -23,10 +23,6 @@ elseif(PAL_TRAIT_LINUX_WINDOW_MANAGER STREQUAL "wayland")
set(LY_COMPILE_DEFINITIONS PUBLIC PAL_TRAIT_LINUX_WINDOW_MANAGER_WAYLAND)
elseif(PAL_TRAIT_LINUX_WINDOW_MANAGER STREQUAL "xlib")
set(LY_COMPILE_DEFINITIONS PUBLIC PAL_TRAIT_LINUX_WINDOW_MANAGER_XLIB)
else()
message(FATAL_ERROR, "Linux Window Manager ${PAL_TRAIT_LINUX_WINDOW_MANAGER} is not recognized")
@@ -608,6 +608,9 @@ namespace UnitTest
archive->ClosePack(genericArchiveFileName);
cpfio.Remove(genericArchiveFileName);
// create the asset alias directory
cpfio.CreatePath("@assets@");
// create generic file
HandleType normalFileHandle;
@@ -848,13 +851,17 @@ namespace UnitTest
const char *assetsPath = ioBase->GetAlias("@assets@");
ASSERT_NE(nullptr, assetsPath);
AZStd::string stringToAdd = AZStd::string::format("%s/textures/test.dds", assetsPath);
auto stringToAdd = AZ::IO::Path(assetsPath) / "textures" / "test.dds";
reslist->Clear();
reslist->Add(stringToAdd.c_str());
reslist->Add(stringToAdd.Native());
// it normalizes the string, so the slashes flip and everything is lowercased.
EXPECT_STREQ(reslist->GetFirst(), "@assets@/textures/test.dds");
AZ::IO::FixedMaxPath resolvedAddedPath;
AZ::IO::FixedMaxPath resolvedResourcePath;
EXPECT_TRUE(ioBase->ReplaceAlias(resolvedAddedPath, "@assets@/textures/test.dds"));
EXPECT_TRUE(ioBase->ReplaceAlias(resolvedResourcePath, reslist->GetFirst()));
EXPECT_EQ(resolvedAddedPath, resolvedResourcePath);
reslist->Clear();
}