Merge branch 'development' of https://github.com/aws-lumberyard-dev/o3de into mnaumov/2372
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AtomCore/std/containers/vector_set_base.h>
|
||||
#include <AzCore/std/containers/fixed_vector.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
|
||||
@@ -728,6 +728,7 @@ namespace AZ
|
||||
DestroyReflectionManager();
|
||||
|
||||
static_cast<SettingsRegistryImpl*>(m_settingsRegistry.get())->ClearNotifiers();
|
||||
static_cast<SettingsRegistryImpl*>(m_settingsRegistry.get())->ClearMergeEvents();
|
||||
|
||||
// Uninit and unload any dynamic modules.
|
||||
m_moduleManager->UnloadModules();
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Math/Crc.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
|
||||
#include <AzCore/std/containers/unordered_set.h>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#define AZCORE_ENTITY_ID_H
|
||||
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
/** @file
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <type_traits>
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/std/limits.h>
|
||||
#include <AzCore/std/string/string_view.h>
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ namespace AZ
|
||||
void DebugBreak();
|
||||
#endif
|
||||
void Terminate(int exitCode);
|
||||
void OutputToDebugger(const char* window, const char* message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,11 @@ namespace AZ
|
||||
{
|
||||
namespace Debug
|
||||
{
|
||||
namespace Platform
|
||||
{
|
||||
void OutputToDebugger(const char* window, const char* message);
|
||||
}
|
||||
|
||||
/// Global instance to the tracer.
|
||||
extern class Trace g_tracer;
|
||||
|
||||
|
||||
@@ -58,6 +58,12 @@ namespace AZ
|
||||
|
||||
Event& operator=(Event&& rhs);
|
||||
|
||||
//! Take the handlers registered with the other event
|
||||
//! and move them to this event. The other will event
|
||||
//! will be cleared after call
|
||||
//! @param other event to move handlers
|
||||
Event& ClaimHandlers(Event&& other);
|
||||
|
||||
//! Returns true if at least one handler is connected to this event.
|
||||
bool HasHandlerConnected() const;
|
||||
|
||||
|
||||
@@ -207,6 +207,32 @@ namespace AZ
|
||||
}
|
||||
|
||||
|
||||
template <typename... Params>
|
||||
auto Event<Params...>::ClaimHandlers(Event&& other) -> Event&
|
||||
{
|
||||
auto handlers = AZStd::move(other.m_handlers);
|
||||
auto addList = AZStd::move(other.m_addList);
|
||||
other.m_freeList = {};
|
||||
other.m_updating = false;
|
||||
|
||||
AZStd::array handlerContainers{ &handlers, &addList };
|
||||
for (AZStd::vector<Handler*>* handlerList : handlerContainers)
|
||||
{
|
||||
for (Handler* handler : *handlerList)
|
||||
{
|
||||
if (handler != nullptr)
|
||||
{
|
||||
handler->m_index = 0;
|
||||
handler->m_event = this;
|
||||
Connect(*handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template <typename... Params>
|
||||
bool Event<Params...>::HasHandlerConnected() const
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/IO/Path/Path_fwd.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/std/string/fixed_string.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Module/Environment.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/std/parallel/shared_mutex.h>
|
||||
#include <AzCore/std/typetraits/is_constructible.h>
|
||||
#include <AzCore/std/typetraits/is_assignable.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/base.h>
|
||||
|
||||
#include <AzCore/std/hash.h>
|
||||
#include <AzCore/std/string/string_view.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -108,7 +108,7 @@ namespace AZ
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
template<>
|
||||
template<>
|
||||
struct hash<AZ::Crc32>
|
||||
{
|
||||
size_t operator()(const AZ::Crc32& id) const
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/Math/Random_Platform.h>
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
#include <AzCore/std/containers/array.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Math/Internal/MathTypes.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Math/Internal/MathTypes.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -1006,12 +1006,6 @@ namespace AZ
|
||||
AZ_TYPE_INFO_INTERNAL_FUNCTION_VARIATION_SPECIALIZATION(AZStd::function, "{C9F9C644-CCC3-4F77-A792-F5B5DBCA746E}");
|
||||
} // namespace AZ
|
||||
|
||||
#define AZ_TYPE_INFO_INTERNAL_1(_ClassName) static_assert(false, "You must provide a ClassName,ClassUUID")
|
||||
#define AZ_TYPE_INFO_INTERNAL_2(_ClassName, _ClassUuid) \
|
||||
void TYPEINFO_Enable(){} \
|
||||
static const char* TYPEINFO_Name() { return #_ClassName; } \
|
||||
static const AZ::TypeId& TYPEINFO_Uuid() { static AZ::TypeId s_uuid(_ClassUuid); return s_uuid; }
|
||||
|
||||
// Template class type info
|
||||
#define AZ_TYPE_INFO_INTERNAL_TEMPLATE(_ClassName, _ClassUuid, ...)\
|
||||
void TYPEINFO_Enable() {}\
|
||||
@@ -1050,39 +1044,11 @@ namespace AZ
|
||||
#define AZ_TYPE_INFO_INTERNAL_17 AZ_TYPE_INFO_INTERNAL_TEMPLATE
|
||||
#define AZ_TYPE_INFO_INTERNAL(...) AZ_MACRO_SPECIALIZE(AZ_TYPE_INFO_INTERNAL_, AZ_VA_NUM_ARGS(__VA_ARGS__), (__VA_ARGS__))
|
||||
|
||||
#define AZ_TYPE_INFO_1 AZ_TYPE_INFO_INTERNAL_1
|
||||
#define AZ_TYPE_INFO_2 AZ_TYPE_INFO_INTERNAL_2
|
||||
#define AZ_TYPE_INFO_3 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_4 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_5 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_6 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_7 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_8 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_9 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_10 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_11 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_12 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_13 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_14 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_15 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_16 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
#define AZ_TYPE_INFO_17 AZ_TYPE_INFO_INTERNAL_TEMPLATE_DEPRECATED
|
||||
|
||||
// Fall-back for the original version of AZ_TYPE_INFO that accepted template arguments. This should not be used, unless
|
||||
// to fix issues where AZ_TYPE_INFO was incorrectly used and the old UUID has to be maintained.
|
||||
#define AZ_TYPE_INFO_LEGACY AZ_TYPE_INFO_INTERNAL
|
||||
|
||||
/**
|
||||
* Use this macro inside a class to allow it to be identified across modules and serialized (in different contexts).
|
||||
* The expected input is the class and the assigned uuid as a string or an instance of a uuid.
|
||||
* Example:
|
||||
* class MyClass
|
||||
* {
|
||||
* public:
|
||||
* AZ_TYPE_INFO(MyClass, "{BD5B1568-D232-4EBF-93BD-69DB66E3773F}");
|
||||
* ...
|
||||
*/
|
||||
#define AZ_TYPE_INFO(...) AZ_MACRO_SPECIALIZE(AZ_TYPE_INFO_, AZ_VA_NUM_ARGS(__VA_ARGS__), (__VA_ARGS__))
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
|
||||
/**
|
||||
* Use this macro outside a class to allow it to be identified across modules and serialized (in different contexts).
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Math/Uuid.h>
|
||||
#include <AzCore/std/typetraits/is_enum.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
using TypeId = AZ::Uuid;
|
||||
}
|
||||
|
||||
#define AZ_TYPE_INFO_INTERNAL_1(_ClassName) static_assert(false, "You must provide a ClassName,ClassUUID")
|
||||
#define AZ_TYPE_INFO_INTERNAL_2(_ClassName, _ClassUuid) \
|
||||
void TYPEINFO_Enable(){} \
|
||||
static const char* TYPEINFO_Name() { return #_ClassName; } \
|
||||
static const AZ::TypeId& TYPEINFO_Uuid() { static AZ::TypeId s_uuid(_ClassUuid); return s_uuid; }
|
||||
|
||||
#define AZ_TYPE_INFO_1 AZ_TYPE_INFO_INTERNAL_1
|
||||
#define AZ_TYPE_INFO_2 AZ_TYPE_INFO_INTERNAL_2
|
||||
|
||||
/**
|
||||
* Use this macro inside a class to allow it to be identified across modules and serialized (in different contexts).
|
||||
* The expected input is the class and the assigned uuid as a string or an instance of a uuid.
|
||||
* Example:
|
||||
* class MyClass
|
||||
* {
|
||||
* public:
|
||||
* AZ_TYPE_INFO(MyClass, "{BD5B1568-D232-4EBF-93BD-69DB66E3773F}");
|
||||
* ...
|
||||
*/
|
||||
#define AZ_TYPE_INFO(...) AZ_MACRO_SPECIALIZE(AZ_TYPE_INFO_, AZ_VA_NUM_ARGS(__VA_ARGS__), (__VA_ARGS__))
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#define AZCORE_DATA_OVERLAY_H
|
||||
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <AzCore/Serialization/Json/BaseJsonSerializer.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <AzCore/Serialization/Json/BaseJsonSerializer.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <AzCore/Serialization/Json/BaseJsonSerializer.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -123,6 +123,36 @@ namespace AZ
|
||||
using NotifyEvent = AZ::Event<AZStd::string_view, Type>;
|
||||
using NotifyEventHandler = typename NotifyEvent::Handler;
|
||||
|
||||
using PreMergeEventCallback = AZStd::function<void(AZStd::string_view path, AZStd::string_view rootKey)>;
|
||||
using PostMergeEventCallback = AZStd::function<void(AZStd::string_view path, AZStd::string_view rootKey)>;
|
||||
using PreMergeEvent = AZ::Event<AZStd::string_view, AZStd::string_view>;
|
||||
using PostMergeEvent = AZ::Event<AZStd::string_view, AZStd::string_view>;
|
||||
using PreMergeEventHandler = typename PreMergeEvent::Handler;
|
||||
using PostMergeEventHandler = typename PostMergeEvent::Handler;
|
||||
|
||||
struct ScopedMergeEvent
|
||||
{
|
||||
ScopedMergeEvent(
|
||||
PreMergeEvent& preMergeEvent, PostMergeEvent& postMergeEvent, AZStd::string_view filePath, AZStd::string_view rootKey)
|
||||
: m_preMergeEvent{ preMergeEvent }
|
||||
, m_postMergeEvent{ postMergeEvent }
|
||||
, m_filePath{ filePath }
|
||||
, m_rootKey{ rootKey }
|
||||
{
|
||||
preMergeEvent.Signal(m_filePath, m_rootKey);
|
||||
}
|
||||
|
||||
~ScopedMergeEvent()
|
||||
{
|
||||
m_postMergeEvent.Signal(m_filePath, m_rootKey);
|
||||
}
|
||||
|
||||
PreMergeEvent& m_preMergeEvent;
|
||||
PostMergeEvent& m_postMergeEvent;
|
||||
AZStd::string_view m_filePath;
|
||||
AZStd::string_view m_rootKey;
|
||||
};
|
||||
|
||||
using VisitorCallback =
|
||||
AZStd::function<VisitResponse(AZStd::string_view path, AZStd::string_view valueName, VisitAction action, Type type)>;
|
||||
//! Base class for the visitor class during traversal over the Settings Registry. The type-agnostic function is always
|
||||
@@ -169,6 +199,20 @@ namespace AZ
|
||||
//! @callback The function to call when an entry gets a new/updated value.
|
||||
[[nodiscard]] virtual NotifyEventHandler RegisterNotifier(NotifyCallback&& callback) = 0;
|
||||
|
||||
//! Register a function that will be called before a file is merged.
|
||||
//! @callback The function to call before a file is merged.
|
||||
[[nodiscard]] virtual PreMergeEventHandler RegisterPreMergeEvent(const PreMergeEventCallback& callback) = 0;
|
||||
//! Register a function that will be called before a file is merged.
|
||||
//! @callback The function to call before a file is merged.
|
||||
[[nodiscard]] virtual PreMergeEventHandler RegisterPreMergeEvent (PreMergeEventCallback&& callback) = 0;
|
||||
|
||||
//! Register a function that will be called after a file is merged.
|
||||
//! @callback The function to call after a file is merged.
|
||||
[[nodiscard]] virtual PostMergeEventHandler RegisterPostMergeEvent(const PostMergeEventCallback& callback) = 0;
|
||||
//! Register a function that will be called after a file is merged.
|
||||
//! @callback The function to call after a file is merged.
|
||||
[[nodiscard]] virtual PostMergeEventHandler RegisterPostMergeEvent (PostMergeEventCallback&& callback) = 0;
|
||||
|
||||
//! Gets the boolean value at the provided path.
|
||||
//! @param result The target to write the result to.
|
||||
//! @param path The path to the value.
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
namespace AZ
|
||||
{
|
||||
template<typename T>
|
||||
bool SettingsRegistryImpl::SetValueInternal(AZStd::string_view path, T value, SettingsRegistryInterface::Type type)
|
||||
bool SettingsRegistryImpl::SetValueInternal(AZStd::string_view path, T value)
|
||||
{
|
||||
if (path.empty())
|
||||
{
|
||||
@@ -56,7 +56,6 @@ namespace AZ
|
||||
static_assert(!AZStd::is_same_v<T, T>, "SettingsRegistryImpl::SetValueInternal called with unsupported type.");
|
||||
}
|
||||
|
||||
m_notifiers.Signal(path, type);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -157,11 +156,11 @@ namespace AZ
|
||||
// Setting to empty string to prevent assert
|
||||
path = "";
|
||||
}
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
|
||||
rapidjson::Pointer pointer(path.data(), path.length());
|
||||
if (pointer.IsValid())
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
const rapidjson::Value* value = pointer.Get(m_settings);
|
||||
if (value)
|
||||
{
|
||||
@@ -207,7 +206,7 @@ namespace AZ
|
||||
{
|
||||
NotifyEventHandler notifyHandler{ callback };
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
AZStd::scoped_lock lock(m_notifierMutex);
|
||||
notifyHandler.Connect(m_notifiers);
|
||||
}
|
||||
return notifyHandler;
|
||||
@@ -217,7 +216,7 @@ namespace AZ
|
||||
{
|
||||
NotifyEventHandler notifyHandler{ AZStd::move(callback) };
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
AZStd::scoped_lock lock(m_notifierMutex);
|
||||
notifyHandler.Connect(m_notifiers);
|
||||
}
|
||||
return notifyHandler;
|
||||
@@ -225,10 +224,82 @@ namespace AZ
|
||||
|
||||
void SettingsRegistryImpl::ClearNotifiers()
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
AZStd::scoped_lock lock(m_notifierMutex);
|
||||
m_notifiers.DisconnectAllHandlers();
|
||||
}
|
||||
|
||||
auto SettingsRegistryImpl::RegisterPreMergeEvent(const PreMergeEventCallback& callback) -> PreMergeEventHandler
|
||||
{
|
||||
PreMergeEventHandler preMergeHandler{ callback };
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
preMergeHandler.Connect(m_preMergeEvent);
|
||||
}
|
||||
return preMergeHandler;
|
||||
}
|
||||
|
||||
auto SettingsRegistryImpl::RegisterPreMergeEvent(PreMergeEventCallback&& callback) -> PreMergeEventHandler
|
||||
{
|
||||
PreMergeEventHandler preMergeHandler{ AZStd::move(callback) };
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
preMergeHandler.Connect(m_preMergeEvent);
|
||||
}
|
||||
return preMergeHandler;
|
||||
}
|
||||
|
||||
auto SettingsRegistryImpl::RegisterPostMergeEvent(const PostMergeEventCallback& callback) -> PostMergeEventHandler
|
||||
{
|
||||
PostMergeEventHandler postMergeHandler{ callback };
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
postMergeHandler.Connect(m_postMergeEvent);
|
||||
}
|
||||
return postMergeHandler;
|
||||
}
|
||||
|
||||
auto SettingsRegistryImpl::RegisterPostMergeEvent(PostMergeEventCallback&& callback) -> PostMergeEventHandler
|
||||
{
|
||||
PostMergeEventHandler postMergeHandler{ AZStd::move(callback) };
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
postMergeHandler.Connect(m_postMergeEvent);
|
||||
}
|
||||
return postMergeHandler;
|
||||
}
|
||||
|
||||
void SettingsRegistryImpl::ClearMergeEvents()
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
m_preMergeEvent.DisconnectAllHandlers();
|
||||
m_postMergeEvent.DisconnectAllHandlers();
|
||||
}
|
||||
|
||||
void SettingsRegistryImpl::SignalNotifier(AZStd::string_view jsonPath, Type type)
|
||||
{
|
||||
// Move the Notifier AZ::Event to a local AZ::Event in order to allow
|
||||
// the notifier handlers to be signaled outside of the notifier mutex
|
||||
// This allows other threads to register notifiers while this thread
|
||||
// is invoking the handlers
|
||||
decltype(m_notifiers) localNotifierEvent;
|
||||
{
|
||||
AZStd::scoped_lock lock(m_notifierMutex);
|
||||
localNotifierEvent = AZStd::move(m_notifiers);
|
||||
}
|
||||
|
||||
localNotifierEvent.Signal(jsonPath, type);
|
||||
|
||||
{
|
||||
// Swap the local handlers with the current m_notifiers which
|
||||
// will contain any handlers added during the signaling of the
|
||||
// local event
|
||||
AZStd::scoped_lock lock(m_notifierMutex);
|
||||
AZStd::swap(m_notifiers, localNotifierEvent);
|
||||
// Append any added handlers to the m_notifier structure
|
||||
m_notifiers.ClaimHandlers(AZStd::move(localNotifierEvent));
|
||||
}
|
||||
}
|
||||
|
||||
SettingsRegistryInterface::Type SettingsRegistryImpl::GetType(AZStd::string_view path) const
|
||||
{
|
||||
if (path.empty())
|
||||
@@ -239,11 +310,11 @@ namespace AZ
|
||||
path = "";
|
||||
}
|
||||
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
|
||||
rapidjson::Pointer pointer(path.data(), path.length());
|
||||
if (pointer.IsValid())
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
const rapidjson::Value* value = pointer.Get(m_settings);
|
||||
if (value)
|
||||
{
|
||||
@@ -316,11 +387,11 @@ namespace AZ
|
||||
// Setting to empty string to prevent assert
|
||||
path = "";
|
||||
}
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
|
||||
rapidjson::Pointer pointer(path.data(), path.length());
|
||||
if (pointer.IsValid())
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
const rapidjson::Value* value = pointer.Get(m_settings);
|
||||
if (value)
|
||||
{
|
||||
@@ -333,32 +404,52 @@ namespace AZ
|
||||
|
||||
bool SettingsRegistryImpl::Set(AZStd::string_view path, bool value)
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
return SetValueInternal(path, value, Type::Boolean);
|
||||
if (AZStd::scoped_lock lock(m_settingMutex); !SetValueInternal(path, value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
SignalNotifier(path, Type::Boolean);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SettingsRegistryImpl::Set(AZStd::string_view path, s64 value)
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
return SetValueInternal(path, value, Type::Integer);
|
||||
if (AZStd::scoped_lock lock(m_settingMutex); !SetValueInternal(path, value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
SignalNotifier(path, Type::Integer);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SettingsRegistryImpl::Set(AZStd::string_view path, u64 value)
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
return SetValueInternal(path, value, Type::Integer);
|
||||
if (AZStd::scoped_lock lock(m_settingMutex); !SetValueInternal(path, value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
SignalNotifier(path, Type::Integer);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SettingsRegistryImpl::Set(AZStd::string_view path, double value)
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
return SetValueInternal(path, value, Type::FloatingPoint);
|
||||
if (AZStd::scoped_lock lock(m_settingMutex); !SetValueInternal(path, value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
SignalNotifier(path, Type::FloatingPoint);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SettingsRegistryImpl::Set(AZStd::string_view path, AZStd::string_view value)
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
return SetValueInternal(path, value, Type::String);
|
||||
if (AZStd::scoped_lock lock(m_settingMutex); !SetValueInternal(path, value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
SignalNotifier(path, Type::String);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SettingsRegistryImpl::Set(AZStd::string_view path, const char* value)
|
||||
@@ -376,7 +467,6 @@ namespace AZ
|
||||
path = "";
|
||||
}
|
||||
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
|
||||
rapidjson::Pointer pointer(path.data(), path.length());
|
||||
if (pointer.IsValid())
|
||||
@@ -386,9 +476,10 @@ namespace AZ
|
||||
value, nullptr, valueTypeID, m_serializationSettings);
|
||||
if (jsonResult.GetProcessing() != JsonSerializationResult::Processing::Halted)
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
rapidjson::Value& setting = pointer.Create(m_settings, m_settings.GetAllocator());
|
||||
setting = AZStd::move(store);
|
||||
m_notifiers.Signal(path, Type::Object);
|
||||
SignalNotifier(path, Type::Object);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -404,13 +495,13 @@ namespace AZ
|
||||
// Setting to empty string to prevent assert
|
||||
path = "";
|
||||
}
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
rapidjson::Pointer pointerPath(path.data(), path.size());
|
||||
if (!pointerPath.IsValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
return pointerPath.Erase(m_settings);
|
||||
}
|
||||
|
||||
@@ -540,7 +631,7 @@ namespace AZ
|
||||
return false;
|
||||
}
|
||||
|
||||
m_notifiers.Signal("", Type::Object);
|
||||
SignalNotifier("", Type::Object);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -562,8 +653,6 @@ namespace AZ
|
||||
scratchBuffer = &buffer;
|
||||
}
|
||||
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
|
||||
bool result = false;
|
||||
if (path[path.length()] == 0)
|
||||
{
|
||||
@@ -577,6 +666,8 @@ namespace AZ
|
||||
R"(Path "%.*s" is too long. Either make sure that the provided path is terminated or use a shorter path.)",
|
||||
static_cast<int>(path.length()), path.data());
|
||||
Pointer pointer(AZ_SETTINGS_REGISTRY_HISTORY_KEY "/-");
|
||||
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
Value pathValue(path.data(), aznumeric_caster(path.length()), m_settings.GetAllocator());
|
||||
pointer.Create(m_settings, m_settings.GetAllocator()).SetObject()
|
||||
.AddMember(StringRef("Error"), StringRef("Unable to read registry file."), m_settings.GetAllocator())
|
||||
@@ -622,6 +713,7 @@ namespace AZ
|
||||
{
|
||||
AZ_Error("Settings Registry", false, "Folder path for the Setting Registry is too long: %.*s",
|
||||
static_cast<int>(path.size()), path.data());
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
pointer.Create(m_settings, m_settings.GetAllocator()).SetObject()
|
||||
.AddMember(StringRef("Error"), StringRef("Folder path for the Setting Registry is too long."), m_settings.GetAllocator())
|
||||
.AddMember(StringRef("Path"), Value(path.data(), aznumeric_caster(path.length()), m_settings.GetAllocator()), m_settings.GetAllocator());
|
||||
@@ -659,6 +751,7 @@ namespace AZ
|
||||
if (fileList.size() >= MaxRegistryFolderEntries)
|
||||
{
|
||||
AZ_Error("Settings Registry", false, "Too many files in registry folder.");
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
pointer.Create(m_settings, m_settings.GetAllocator()).SetObject()
|
||||
.AddMember(StringRef("Error"), StringRef("Too many files in registry folder."), m_settings.GetAllocator())
|
||||
.AddMember(StringRef("Path"), Value(folderPath.c_str(), aznumeric_caster(folderPath.size()), m_settings.GetAllocator()), m_settings.GetAllocator())
|
||||
@@ -678,7 +771,6 @@ namespace AZ
|
||||
SystemFile::FindFiles(folderPath.c_str(), callback);
|
||||
|
||||
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
if (!platform.empty())
|
||||
{
|
||||
// Move the folderPath prefix back to the supplied path before the wildcard
|
||||
@@ -696,6 +788,7 @@ namespace AZ
|
||||
if (fileList.size() >= MaxRegistryFolderEntries)
|
||||
{
|
||||
AZ_Error("Settings Registry", false, "Too many files in registry folder.");
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
pointer.Create(m_settings, m_settings.GetAllocator()).SetObject()
|
||||
.AddMember(StringRef("Error"), StringRef("Too many files in registry folder."), m_settings.GetAllocator())
|
||||
.AddMember(StringRef("Path"), Value(folderPath.c_str(), aznumeric_caster(folderPath.size()), m_settings.GetAllocator()), m_settings.GetAllocator())
|
||||
@@ -923,6 +1016,8 @@ namespace AZ
|
||||
collisionFound = true;
|
||||
AZ_Error("Settings Registry", false, R"(Two registry files in "%.*s" point to the same specialization: "%s" and "%s")",
|
||||
AZ_STRING_ARG(folderPath), lhs.m_relativePath.c_str(), rhs.m_relativePath.c_str());
|
||||
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
historyPointer.Create(m_settings, m_settings.GetAllocator()).SetObject()
|
||||
.AddMember(StringRef("Error"), StringRef("Too many files in registry folder."), m_settings.GetAllocator())
|
||||
.AddMember(StringRef("Path"),
|
||||
@@ -1077,6 +1172,7 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
pointer.Create(m_settings, m_settings.GetAllocator()).SetObject()
|
||||
.AddMember(StringRef("Error"), StringRef("Unable to parse registry file due to invalid json."), m_settings.GetAllocator())
|
||||
.AddMember(StringRef("Path"), Value(path, m_settings.GetAllocator()), m_settings.GetAllocator())
|
||||
@@ -1102,6 +1198,7 @@ namespace AZ
|
||||
R"(To merge the supplied settings registry file, the settings within it must be placed within a JSON Object '{}')"
|
||||
R"( in order to allow moving of its fields using the root-key as an anchor.)", path);
|
||||
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
pointer.Create(m_settings, m_settings.GetAllocator()).SetObject()
|
||||
.AddMember(StringRef("Error"), StringRef("Cannot merge registry file with a root which is not a JSON Object,"
|
||||
" an empty root key and a merge approach of JsonMergePatch. Otherwise the Settings Registry would be overridden."
|
||||
@@ -1115,9 +1212,12 @@ namespace AZ
|
||||
return false;
|
||||
}
|
||||
|
||||
ScopedMergeEvent scopedMergeEvent(m_preMergeEvent, m_postMergeEvent, path, rootKey);
|
||||
|
||||
JsonSerializationResult::ResultCode mergeResult(JsonSerializationResult::Tasks::Merge);
|
||||
if (rootKey.empty())
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
mergeResult = JsonSerialization::ApplyPatch(m_settings, m_settings.GetAllocator(), jsonPatch, mergeApproach, m_applyPatchSettings);
|
||||
}
|
||||
else
|
||||
@@ -1125,6 +1225,7 @@ namespace AZ
|
||||
Pointer root(rootKey.data(), rootKey.length());
|
||||
if (root.IsValid())
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
Value& rootValue = root.Create(m_settings, m_settings.GetAllocator());
|
||||
mergeResult = JsonSerialization::ApplyPatch(rootValue, m_settings.GetAllocator(), jsonPatch, mergeApproach, m_applyPatchSettings);
|
||||
}
|
||||
@@ -1132,6 +1233,7 @@ namespace AZ
|
||||
{
|
||||
AZ_Error("Settings Registry", false, R"(Failed to root path "%.*s" is invalid.)",
|
||||
aznumeric_cast<int>(rootKey.length()), rootKey.data());
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
pointer.Create(m_settings, m_settings.GetAllocator()).SetObject()
|
||||
.AddMember(StringRef("Error"), StringRef("Invalid root key."), m_settings.GetAllocator())
|
||||
.AddMember(StringRef("Path"), Value(path, m_settings.GetAllocator()), m_settings.GetAllocator());
|
||||
@@ -1141,15 +1243,19 @@ namespace AZ
|
||||
if (mergeResult.GetProcessing() != JsonSerializationResult::Processing::Completed)
|
||||
{
|
||||
AZ_Error("Settings Registry", false, R"(Failed to fully merge registry file "%s".)", path);
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
pointer.Create(m_settings, m_settings.GetAllocator()).SetObject()
|
||||
.AddMember(StringRef("Error"), StringRef("Failed to fully merge registry file."), m_settings.GetAllocator())
|
||||
.AddMember(StringRef("Path"), Value(path, m_settings.GetAllocator()), m_settings.GetAllocator());
|
||||
return false;
|
||||
}
|
||||
|
||||
pointer.Create(m_settings, m_settings.GetAllocator()).SetString(path, m_settings.GetAllocator());
|
||||
{
|
||||
AZStd::scoped_lock lock(m_settingMutex);
|
||||
pointer.Create(m_settings, m_settings.GetAllocator()).SetString(path, m_settings.GetAllocator());
|
||||
}
|
||||
|
||||
m_notifiers.Signal("", Type::Object);
|
||||
SignalNotifier("", Type::Object);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -48,6 +48,12 @@ namespace AZ
|
||||
[[nodiscard]] NotifyEventHandler RegisterNotifier(NotifyCallback&& callback) override;
|
||||
void ClearNotifiers();
|
||||
|
||||
[[nodiscard]] PreMergeEventHandler RegisterPreMergeEvent(const PreMergeEventCallback& callback) override;
|
||||
[[nodiscard]] PreMergeEventHandler RegisterPreMergeEvent(PreMergeEventCallback&& callback) override;
|
||||
[[nodiscard]] PostMergeEventHandler RegisterPostMergeEvent(const PostMergeEventCallback& callback) override;
|
||||
[[nodiscard]] PostMergeEventHandler RegisterPostMergeEvent(PostMergeEventCallback&& callback) override;
|
||||
void ClearMergeEvents();
|
||||
|
||||
bool Get(bool& result, AZStd::string_view path) const override;
|
||||
bool Get(s64& result, AZStd::string_view path) const override;
|
||||
bool Get(u64& result, AZStd::string_view path) const override;
|
||||
@@ -89,7 +95,7 @@ namespace AZ
|
||||
using RegistryFileList = AZStd::fixed_vector<RegistryFile, MaxRegistryFolderEntries>;
|
||||
|
||||
template<typename T>
|
||||
bool SetValueInternal(AZStd::string_view path, T value, SettingsRegistryInterface::Type type);
|
||||
bool SetValueInternal(AZStd::string_view path, T value);
|
||||
template<typename T>
|
||||
bool GetValueInternal(T& result, AZStd::string_view path) const;
|
||||
VisitResponse Visit(Visitor& visitor, StackedString& path, AZStd::string_view valueName,
|
||||
@@ -100,9 +106,15 @@ namespace AZ
|
||||
const rapidjson::Pointer& historyPointer, AZStd::string_view folderPath);
|
||||
bool ExtractFileDescription(RegistryFile& output, const char* filename, const Specializations& specializations);
|
||||
bool MergeSettingsFileInternal(const char* path, Format format, AZStd::string_view rootKey, AZStd::vector<char>& scratchBuffer);
|
||||
|
||||
void SignalNotifier(AZStd::string_view jsonPath, Type type);
|
||||
|
||||
mutable AZStd::recursive_mutex m_settingMutex;
|
||||
mutable AZStd::recursive_mutex m_notifierMutex;
|
||||
NotifyEvent m_notifiers;
|
||||
PreMergeEvent m_preMergeEvent;
|
||||
PostMergeEvent m_postMergeEvent;
|
||||
|
||||
rapidjson::Document m_settings;
|
||||
JsonSerializerSettings m_serializationSettings;
|
||||
JsonDeserializerSettings m_deserializationSettings;
|
||||
|
||||
@@ -25,6 +25,10 @@ namespace AZ
|
||||
MOCK_CONST_METHOD2(Visit, bool(const VisitorCallback&, AZStd::string_view));
|
||||
MOCK_METHOD1(RegisterNotifier, NotifyEventHandler(const NotifyCallback&));
|
||||
MOCK_METHOD1(RegisterNotifier, NotifyEventHandler(NotifyCallback&&));
|
||||
MOCK_METHOD1(RegisterPreMergeEvent, PreMergeEventHandler(const PreMergeEventCallback&));
|
||||
MOCK_METHOD1(RegisterPreMergeEvent, PreMergeEventHandler(PreMergeEventCallback&&));
|
||||
MOCK_METHOD1(RegisterPostMergeEvent, PostMergeEventHandler(const PostMergeEventCallback&));
|
||||
MOCK_METHOD1(RegisterPostMergeEvent, PostMergeEventHandler(PostMergeEventCallback&&));
|
||||
|
||||
MOCK_CONST_METHOD2(Get, bool(bool&, AZStd::string_view));
|
||||
MOCK_CONST_METHOD2(Get, bool(s64&, AZStd::string_view));
|
||||
|
||||
@@ -434,6 +434,7 @@ set(FILES
|
||||
Preprocessor/Sequences.h
|
||||
RTTI/RTTI.h
|
||||
RTTI/TypeInfo.h
|
||||
RTTI/TypeInfoSimple.h
|
||||
RTTI/ReflectContext.h
|
||||
RTTI/ReflectContext.cpp
|
||||
RTTI/ReflectionManager.h
|
||||
|
||||
@@ -51,88 +51,86 @@
|
||||
# define azvscprintf(_format, _va_list) _vscprintf(_format, _va_list)
|
||||
# define azscwprintf _scwprintf
|
||||
# define azvscwprintf _vscwprintf
|
||||
# define azstrtok(_buffer, _size, _delim, _context) strtok_s(_buffer, _delim, _context)
|
||||
# define azstrcat strcat_s
|
||||
# define azstrncat strncat_s
|
||||
# define strtoll _strtoi64
|
||||
# define strtoull _strtoui64
|
||||
# define azsscanf sscanf_s
|
||||
# define azstrcpy strcpy_s
|
||||
# define azstrncpy strncpy_s
|
||||
# define azstricmp _stricmp
|
||||
# define azstrnicmp _strnicmp
|
||||
# define azisfinite _finite
|
||||
# define azltoa _ltoa_s
|
||||
# define azitoa _itoa_s
|
||||
# define azui64toa _ui64toa_s
|
||||
# define azswscanf swscanf_s
|
||||
# define azwcsicmp _wcsicmp
|
||||
# define azwcsnicmp _wcsnicmp
|
||||
# define azmemicmp _memicmp
|
||||
# define azstrtok(_buffer, _size, _delim, _context) strtok_s(_buffer, _delim, _context)
|
||||
# define azstrcat(_dest, _destSize, _src) strcat_s(_dest, _destSize, _src)
|
||||
# define azstrncat(_dest, _destSize, _src, _count) strncat_s(_dest, _destSize, _src, _count)
|
||||
# define strtoll _strtoi64
|
||||
# define strtoull _strtoui64
|
||||
# define azsscanf sscanf_s
|
||||
# define azstrcpy(_dest, _destSize, _src) strcpy_s(_dest, _destSize, _src)
|
||||
# define azstrncpy(_dest, _destSize, _src, _count) strncpy_s(_dest, _destSize, _src, _count)
|
||||
# define azstricmp _stricmp
|
||||
# define azstrnicmp _strnicmp
|
||||
# define azisfinite _finite
|
||||
# define azltoa _ltoa_s
|
||||
# define azitoa _itoa_s
|
||||
# define azui64toa _ui64toa_s
|
||||
# define azswscanf swscanf_s
|
||||
# define azwcsicmp _wcsicmp
|
||||
# define azwcsnicmp _wcsnicmp
|
||||
|
||||
// note: for cross-platform compatibility, do not use the return value of azfopen. On Windows, it's an errno_t and 0 indicates success. On other platforms, the return value is a FILE*, and a 0 value indicates failure.
|
||||
# define azfopen fopen_s
|
||||
# define azfscanf fscanf_s
|
||||
# define azfopen(_fp, _filename, _attrib) fopen_s(_fp, _filename, _attrib)
|
||||
# define azfscanf fscanf_s
|
||||
|
||||
# define azsprintf(_buffer, ...) sprintf_s(_buffer, AZ_ARRAY_SIZE(_buffer), __VA_ARGS__)
|
||||
# define azstrlwr _strlwr_s
|
||||
# define azvsprintf vsprintf_s
|
||||
# define azwcscpy wcscpy_s
|
||||
# define azstrtime _strtime_s
|
||||
# define azstrdate _strdate_s
|
||||
# define azlocaltime(time, result) localtime_s(result, time)
|
||||
# define azsprintf(_buffer, ...) sprintf_s(_buffer, AZ_ARRAY_SIZE(_buffer), __VA_ARGS__)
|
||||
# define azstrlwr _strlwr_s
|
||||
# define azvsprintf vsprintf_s
|
||||
# define azwcscpy wcscpy_s
|
||||
# define azstrtime _strtime_s
|
||||
# define azstrdate _strdate_s
|
||||
# define azlocaltime(time, result) localtime_s(result, time)
|
||||
#else
|
||||
# define azsnprintf snprintf
|
||||
# define azvsnprintf vsnprintf
|
||||
# define azsnprintf snprintf
|
||||
# define azvsnprintf vsnprintf
|
||||
# if AZ_TRAIT_COMPILER_DEFINE_AZSWNPRINTF_AS_SWPRINTF
|
||||
# define azsnwprintf swprintf
|
||||
# define azvsnwprintf vswprintf
|
||||
# define azsnwprintf swprintf
|
||||
# define azvsnwprintf vswprintf
|
||||
# else
|
||||
# define azsnwprintf snwprintf
|
||||
# define azvsnwprintf vsnwprintf
|
||||
# define azsnwprintf snwprintf
|
||||
# define azvsnwprintf vsnwprintf
|
||||
# endif
|
||||
# define azscprintf(...) azsnprintf(nullptr, static_cast<size_t>(0), __VA_ARGS__);
|
||||
# define azvscprintf(_format, _va_list) azvsnprintf(nullptr, static_cast<size_t>(0), _format, _va_list);
|
||||
# define azscwprintf(...) azsnwprintf(nullptr, static_cast<size_t>(0), __VA_ARGS__);
|
||||
# define azvscwprintf(_format, _va_list) azvsnwprintf(nullptr, static_cast<size_t>(0), _format, _va_list);
|
||||
# define azstrtok(_buffer, _size, _delim, _context) strtok(_buffer, _delim)
|
||||
# define azstrcat(_dest, _destSize, _src) strcat(_dest, _src)
|
||||
# define azstrncat(_dest, _destSize, _src, _count) strncat(_dest, _src, _count)
|
||||
# define azsscanf sscanf
|
||||
# define azstrcpy(_dest, _destSize, _src) strcpy(_dest, _src)
|
||||
# define azstrncpy(_dest, _destSize, _src, _count) strncpy(_dest, _src, _count)
|
||||
# define azstricmp strcasecmp
|
||||
# define azstrnicmp strncasecmp
|
||||
# define azscprintf(...) azsnprintf(nullptr, static_cast<size_t>(0), __VA_ARGS__);
|
||||
# define azvscprintf(_format, _va_list) azvsnprintf(nullptr, static_cast<size_t>(0), _format, _va_list);
|
||||
# define azscwprintf(...) azsnwprintf(nullptr, static_cast<size_t>(0), __VA_ARGS__);
|
||||
# define azvscwprintf(_format, _va_list) azvsnwprintf(nullptr, static_cast<size_t>(0), _format, _va_list);
|
||||
# define azstrtok(_buffer, _size, _delim, _context) strtok(_buffer, _delim)
|
||||
# define azstrcat(_dest, _destSize, _src) strcat(_dest, _src)
|
||||
# define azstrncat(_dest, _destSize, _src, _count) strncat(_dest, _src, _count)
|
||||
# define azsscanf sscanf
|
||||
# define azstrcpy(_dest, _destSize, _src) strcpy(_dest, _src)
|
||||
# define azstrncpy(_dest, _destSize, _src, _count) strncpy(_dest, _src, _count)
|
||||
# define azstricmp strcasecmp
|
||||
# define azstrnicmp strncasecmp
|
||||
# if defined(NDK_REV_MAJOR) && NDK_REV_MAJOR < 16
|
||||
# define azisfinite __isfinitef
|
||||
# define azisfinite __isfinitef
|
||||
# else
|
||||
# define azisfinite isfinite
|
||||
# define azisfinite isfinite
|
||||
# endif
|
||||
# define azltoa(_value, _buffer, _size, _radix) ltoa(_value, _buffer, _radix)
|
||||
# define azitoa(_value, _buffer, _size, _radix) itoa(_value, _buffer, _radix)
|
||||
# define azui64toa(_value, _buffer, _size, _radix) _ui64toa(_value, _buffer, _radix)
|
||||
# define azswscanf swscanf
|
||||
# define azwcsicmp wcsicmp
|
||||
# define azwcsnicmp wcsnicmp
|
||||
# define azmemicmp memicmp
|
||||
# define azltoa(_value, _buffer, _size, _radix) ltoa(_value, _buffer, _radix)
|
||||
# define azitoa(_value, _buffer, _size, _radix) itoa(_value, _buffer, _radix)
|
||||
# define azui64toa(_value, _buffer, _size, _radix) _ui64toa(_value, _buffer, _radix)
|
||||
# define azswscanf swscanf
|
||||
# define azwcsicmp wcscasecmp
|
||||
# define azwcsnicmp wcsnicmp
|
||||
|
||||
// note: for cross-platform compatibility, do not use the return value of azfopen. On Windows, it's an errno_t and 0 indicates success. On other platforms, the return value is a FILE*, and a 0 value indicates failure.
|
||||
# define azfopen(_fp, _filename, _attrib) *(_fp) = fopen(_filename, _attrib)
|
||||
# define azfscanf fscanf
|
||||
# define azfopen(_fp, _filename, _attrib) *(_fp) = fopen(_filename, _attrib)
|
||||
# define azfscanf fscanf
|
||||
|
||||
# define azsprintf sprintf
|
||||
# define azstrlwr(_buffer, _size) strlwr(_buffer)
|
||||
# define azvsprintf vsprintf
|
||||
# define azwcscpy(_dest, _size, _buffer) wcscpy(_dest, _buffer)
|
||||
# define azstrtime _strtime
|
||||
# define azstrdate _strdate
|
||||
# define azlocaltime localtime_r
|
||||
# define azsprintf sprintf
|
||||
# define azstrlwr(_buffer, _size) strlwr(_buffer)
|
||||
# define azvsprintf vsprintf
|
||||
# define azwcscpy(_dest, _size, _buffer) wcscpy(_dest, _buffer)
|
||||
# define azstrtime _strtime
|
||||
# define azstrdate _strdate
|
||||
# define azlocaltime localtime_r
|
||||
#endif
|
||||
|
||||
#if AZ_TRAIT_USE_POSIX_STRERROR_R
|
||||
# define azstrerror_s(_dst, _num, _err) strerror_r(_err, _dst, _num)
|
||||
# define azstrerror_s(_dst, _num, _err) strerror_r(_err, _dst, _num)
|
||||
#else
|
||||
# define azstrerror_s strerror_s
|
||||
# define azstrerror_s strerror_s
|
||||
#endif
|
||||
|
||||
#define AZ_INVALID_POINTER reinterpret_cast<void*>(0x0badf00dul)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <AzCore/std/base.h>
|
||||
#include <AzCore/std/typetraits/integral_constant.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <AzCore/std/typetraits/integral_constant.h>
|
||||
#include <AzCore/std/typetraits/void_t.h>
|
||||
#include <AzCore/std/createdestroy.h>
|
||||
#include <AzCore/std/limits.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include <AzCore/std/base.h>
|
||||
#include <AzCore/std/ratio.h>
|
||||
#include <AzCore/std/utils.h>
|
||||
#include <AzCore/std/typetraits/common_type.h>
|
||||
#include <AzCore/std/typetraits/is_convertible.h>
|
||||
#include <AzCore/std/typetraits/is_floating_point.h>
|
||||
|
||||
@@ -5,14 +5,17 @@
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef AZSTD_DEQUE_H
|
||||
#define AZSTD_DEQUE_H 1
|
||||
|
||||
|
||||
#include <AzCore/std/allocator.h>
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/std/createdestroy.h>
|
||||
#include <AzCore/std/typetraits/aligned_storage.h>
|
||||
#include <AzCore/std/typetraits/alignment_of.h>
|
||||
#include <AzCore/std/typetraits/is_integral.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
@@ -1242,4 +1245,3 @@ namespace AZStd
|
||||
}
|
||||
|
||||
#endif // AZSTD_DEQUE_H
|
||||
#pragma once
|
||||
|
||||
@@ -7,12 +7,14 @@
|
||||
*/
|
||||
#ifndef AZSTD_LIST_H
|
||||
#define AZSTD_LIST_H 1
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/std/allocator.h>
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/std/createdestroy.h>
|
||||
#include <AzCore/std/typetraits/alignment_of.h>
|
||||
#include <AzCore/std/typetraits/is_constructible.h>
|
||||
#include <AzCore/std/typetraits/is_integral.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
@@ -1346,4 +1348,3 @@ namespace AZStd
|
||||
}
|
||||
|
||||
#endif // AZSTD_LIST_H
|
||||
#pragma once
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/std/createdestroy.h>
|
||||
#include <AzCore/std/utils.h>
|
||||
//#include <AzCore/std/containers/deque.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#ifndef AZSTD_VECTOR_H
|
||||
#define AZSTD_VECTOR_H 1
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/std/allocator.h>
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/std/createdestroy.h>
|
||||
#include <AzCore/std/typetraits/alignment_of.h>
|
||||
#include <AzCore/std/typetraits/is_integral.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
@@ -1395,6 +1395,3 @@ namespace AZStd
|
||||
return removedCount;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // AZSTD_VECTOR_H
|
||||
#pragma once
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <AzCore/std/typetraits/is_function.h>
|
||||
#include <AzCore/std/typetraits/is_trivially_copyable.h>
|
||||
#include <AzCore/std/typetraits/is_void.h>
|
||||
#include <AzCore/std/utils.h> // AZStd::addressof
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <AzCore/std/typetraits/type_id.h>
|
||||
#include <AzCore/std/typetraits/alignment_of.h>
|
||||
#include <AzCore/std/typetraits/is_member_pointer.h>
|
||||
#include <AzCore/std/typetraits/is_const.h>
|
||||
#include <AzCore/std/typetraits/remove_cvref.h>
|
||||
#include <AzCore/std/createdestroy.h>
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <AzCore/std/function/function_base.h>
|
||||
#include <AzCore/std/function/invoke.h>
|
||||
#include <AzCore/std/typetraits/is_integral.h>
|
||||
#include <AzCore/std/typetraits/remove_cvref.h>
|
||||
#include <AzCore/std/allocator.h>
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Math/MathUtils.h>
|
||||
#include <AzCore/std/containers/node_handle.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/containers/fixed_vector.h>
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/std/base.h>
|
||||
#include <AzCore/std/utils.h>
|
||||
#include <AzCore/std/typetraits/integral_constant.h>
|
||||
#include <AzCore/std/typetraits/void_t.h>
|
||||
#include <AzCore/std/typetraits/is_convertible.h>
|
||||
|
||||
#include <AzCore/std/typetraits/is_base_of.h> // use by ConstIteratorCast
|
||||
#include <AzCore/std/typetraits/remove_cv.h>
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/std/parallel/config.h>
|
||||
#include <AzCore/std/typetraits/conditional.h>
|
||||
#include <AzCore/std/typetraits/is_integral.h>
|
||||
#include <atomic>
|
||||
|
||||
namespace AZStd
|
||||
|
||||
@@ -38,13 +38,13 @@ namespace AZStd
|
||||
|
||||
binary_semaphore(bool initialState = false)
|
||||
{
|
||||
m_event = CreateEvent(nullptr, false, initialState, nullptr);
|
||||
m_event = CreateEventW(nullptr, false, initialState, nullptr);
|
||||
AZ_Assert(m_event != NULL, "CreateEvent error: %d\n", GetLastError());
|
||||
}
|
||||
binary_semaphore(const char* name, bool initialState = false)
|
||||
{
|
||||
(void)name; // name is used only for debug, if we pass it to the semaphore it will become named semaphore
|
||||
m_event = CreateEvent(nullptr, false, initialState, nullptr);
|
||||
m_event = CreateEventW(nullptr, false, initialState, nullptr);
|
||||
AZ_Assert(m_event != NULL, "CreateEvent error: %d\n", GetLastError());
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#ifndef AZSTD_SMART_PTR_INTRUSIVE_PTR_H
|
||||
#define AZSTD_SMART_PTR_INTRUSIVE_PTR_H
|
||||
#pragma once
|
||||
|
||||
//
|
||||
// intrusive_ptr.hpp
|
||||
@@ -19,10 +18,10 @@
|
||||
//
|
||||
// See http://www.boost.org/libs/smart_ptr/intrusive_ptr.html for documentation.
|
||||
//
|
||||
|
||||
#include <AzCore/std/smart_ptr/sp_convertible.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/std/smart_ptr/sp_convertible.h>
|
||||
#include <AzCore/std/typetraits/is_abstract.h>
|
||||
#include <AzCore/std/typetraits/typetraits.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
@@ -112,7 +111,7 @@ namespace AZStd
|
||||
CountPolicy::add_ref(px);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
~intrusive_ptr()
|
||||
{
|
||||
if (px != 0)
|
||||
@@ -120,7 +119,7 @@ namespace AZStd
|
||||
CountPolicy::release(px);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class U>
|
||||
enable_if_t<is_convertible<U*, T*>::value, intrusive_ptr&> operator=(intrusive_ptr<U> const& rhs)
|
||||
{
|
||||
@@ -157,28 +156,28 @@ namespace AZStd
|
||||
this_type(rhs).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
intrusive_ptr& operator=(T* rhs)
|
||||
{
|
||||
this_type(rhs).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void reset()
|
||||
{
|
||||
this_type().swap(*this);
|
||||
}
|
||||
|
||||
|
||||
void reset(T* rhs)
|
||||
{
|
||||
this_type(rhs).swap(*this);
|
||||
}
|
||||
|
||||
|
||||
T* get() const
|
||||
{
|
||||
return px;
|
||||
}
|
||||
|
||||
|
||||
T& operator*() const
|
||||
{
|
||||
AZ_Assert(px != 0, "You can't dereference a null pointer");
|
||||
@@ -298,6 +297,3 @@ namespace AZStd
|
||||
|
||||
// operator<< - not supported
|
||||
} // namespace AZStd
|
||||
|
||||
#endif // #ifndef AZSTD_SMART_PTR_INTRUSIVE_PTR_H
|
||||
#pragma once
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/std/string/string.h>
|
||||
#include <AzCore/std/string/fixed_string.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <wctype.h>
|
||||
@@ -30,41 +31,93 @@ namespace AZStd
|
||||
template<size_t Size = sizeof(wchar_t)>
|
||||
struct WCharTPlatformConverter
|
||||
{
|
||||
template<class Allocator1>
|
||||
static inline void to_string(AZStd::basic_string<string::value_type, string::traits_type, Allocator1>& dest, const wchar_t* first, const wchar_t* last)
|
||||
static_assert(Size == size_t{ 2 } || Size == size_t{ 4 }, "only wchar_t types of size 2 or 4 can be converted to utf8");
|
||||
|
||||
template<class Allocator>
|
||||
static inline void to_string(AZStd::basic_string<string::value_type, string::traits_type, Allocator>& dest, AZStd::wstring_view src)
|
||||
{
|
||||
if constexpr (Size == 2)
|
||||
{
|
||||
Utf8::Unchecked::utf16to8(first, last, AZStd::back_inserter(dest));
|
||||
Utf8::Unchecked::utf16to8(src.begin(), src.end(), AZStd::back_inserter(dest), dest.max_size());
|
||||
}
|
||||
else if constexpr (Size == 4)
|
||||
{
|
||||
Utf8::Unchecked::utf32to8(first, last, AZStd::back_inserter(dest));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Workaround to defer static_assert evaluation until this function is invoked by using the template parameter
|
||||
using StringType = AZStd::basic_string<string::value_type, string::traits_type, Allocator1>;
|
||||
static_assert(!AZStd::is_same_v<StringType, StringType>, "only wchar_t types of size 2 or 4 can be converted to utf8");
|
||||
Utf8::Unchecked::utf32to8(src.begin(), src.end(), AZStd::back_inserter(dest), dest.max_size());
|
||||
}
|
||||
}
|
||||
|
||||
template<class Allocator1>
|
||||
static inline void to_wstring(AZStd::basic_string<wstring::value_type, wstring::traits_type, Allocator1>& dest, const char* first, const char* last)
|
||||
template<size_t MaxElementCount>
|
||||
static inline void to_string(AZStd::basic_fixed_string<string::value_type, MaxElementCount, string::traits_type>& dest, AZStd::wstring_view src)
|
||||
{
|
||||
if constexpr (Size == 2)
|
||||
{
|
||||
Utf8::Unchecked::utf8to16(first, last, AZStd::back_inserter(dest));
|
||||
Utf8::Unchecked::utf16to8(src.begin(), src.end(), AZStd::back_inserter(dest), dest.max_size());
|
||||
}
|
||||
else if constexpr (Size == 4)
|
||||
{
|
||||
Utf8::Unchecked::utf8to32(first, last, AZStd::back_inserter(dest));
|
||||
Utf8::Unchecked::utf32to8(src.begin(), src.end(), AZStd::back_inserter(dest), dest.max_size());
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
static inline char* to_string(char* dest, size_t destSize, AZStd::wstring_view src)
|
||||
{
|
||||
if constexpr (Size == 2)
|
||||
{
|
||||
// Workaround to defer static_assert evaluation until this function is invoked by using the template parameter
|
||||
using StringType = AZStd::basic_string<string::value_type, string::traits_type, Allocator1>;
|
||||
static_assert(!AZStd::is_same_v<StringType, StringType>, "Cannot convert a utf8 string to a wchar_t that isn't size 2 or 4");
|
||||
return Utf8::Unchecked::utf16to8(src.begin(), src.end(), dest, destSize);
|
||||
}
|
||||
else if constexpr (Size == 4)
|
||||
{
|
||||
return Utf8::Unchecked::utf32to8(src.begin(), src.end(), dest, destSize);
|
||||
}
|
||||
}
|
||||
|
||||
static inline size_t to_string_length(AZStd::wstring_view src)
|
||||
{
|
||||
if constexpr (Size == 2)
|
||||
{
|
||||
return Utf8::Unchecked::utf16ToUtf8BytesRequired(src.begin(), src.end());
|
||||
}
|
||||
else if constexpr (Size == 4)
|
||||
{
|
||||
return Utf8::Unchecked::utf32ToUtf8BytesRequired(src.begin(), src.end());
|
||||
}
|
||||
}
|
||||
|
||||
template<class Allocator>
|
||||
static inline void to_wstring(AZStd::basic_string<wstring::value_type, wstring::traits_type, Allocator>& dest, AZStd::string_view src)
|
||||
{
|
||||
if constexpr (Size == 2)
|
||||
{
|
||||
Utf8::Unchecked::utf8to16(src.begin(), src.end(), AZStd::back_inserter(dest), dest.max_size());
|
||||
}
|
||||
else if constexpr (Size == 4)
|
||||
{
|
||||
Utf8::Unchecked::utf8to32(src.begin(), src.end(), AZStd::back_inserter(dest), dest.max_size());
|
||||
}
|
||||
}
|
||||
|
||||
template<size_t MaxElementCount>
|
||||
static inline void to_wstring(AZStd::basic_fixed_string<wstring::value_type, MaxElementCount, wstring::traits_type>& dest, AZStd::string_view src)
|
||||
{
|
||||
if constexpr (Size == 2)
|
||||
{
|
||||
Utf8::Unchecked::utf8to16(src.begin(), src.end(), AZStd::back_inserter(dest), dest.max_size());
|
||||
}
|
||||
else if constexpr (Size == 4)
|
||||
{
|
||||
Utf8::Unchecked::utf8to32(src.begin(), src.end(), AZStd::back_inserter(dest), dest.max_size());
|
||||
}
|
||||
}
|
||||
|
||||
static inline wchar_t* to_wstring(wchar_t* dest, size_t destSize, AZStd::string_view src)
|
||||
{
|
||||
if constexpr (Size == 2)
|
||||
{
|
||||
return Utf8::Unchecked::utf8to16(src.begin(), src.end(), dest, destSize);
|
||||
}
|
||||
else if constexpr (Size == 4)
|
||||
{
|
||||
return Utf8::Unchecked::utf8to32(src.begin(), src.end(), dest, destSize);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -244,26 +297,32 @@ namespace AZStd
|
||||
inline AZStd::string to_string(long double val) { AZStd::string str; to_string(str, val); return str; }
|
||||
|
||||
// In our engine we assume AZStd::string is Utf8 encoded!
|
||||
template<class Allocator1>
|
||||
void to_string(AZStd::basic_string<string::value_type, string::traits_type, Allocator1>& dest, const wchar_t* str, size_t srcLen = 0)
|
||||
template<class Allocator>
|
||||
void to_string(AZStd::basic_string<string::value_type, string::traits_type, Allocator>& dest, AZStd::wstring_view src)
|
||||
{
|
||||
dest.clear();
|
||||
Internal::WCharTPlatformConverter<>::to_string(dest, src);
|
||||
}
|
||||
|
||||
if (srcLen == 0)
|
||||
{
|
||||
srcLen = wcslen(str);
|
||||
}
|
||||
template<size_t MaxElementCount>
|
||||
void to_string(AZStd::basic_fixed_string<string::value_type, MaxElementCount, string::traits_type>& dest, AZStd::wstring_view src)
|
||||
{
|
||||
dest.clear();
|
||||
Internal::WCharTPlatformConverter<>::to_string(dest, src);
|
||||
}
|
||||
|
||||
if (srcLen > 0)
|
||||
inline void to_string(char* dest, size_t destSize, AZStd::wstring_view src)
|
||||
{
|
||||
char* endStr = Internal::WCharTPlatformConverter<>::to_string(dest, destSize, src);
|
||||
if (endStr < (dest + destSize))
|
||||
{
|
||||
Internal::WCharTPlatformConverter<>::to_string(dest, str, str + srcLen);
|
||||
*endStr = '\0'; // null terminator
|
||||
}
|
||||
}
|
||||
|
||||
template<class Allocator1, class Allocator2>
|
||||
void to_string(AZStd::basic_string<string::value_type, string::traits_type, Allocator1>& dest, const AZStd::basic_string<wstring::value_type, wstring::traits_type, Allocator2>& src)
|
||||
inline size_t to_string_length(AZStd::wstring_view src)
|
||||
{
|
||||
return to_string(dest, src.c_str(), src.length());
|
||||
return Internal::WCharTPlatformConverter<>::to_string_length(src);
|
||||
}
|
||||
|
||||
template<class Allocator>
|
||||
@@ -362,26 +421,27 @@ namespace AZStd
|
||||
inline AZStd::wstring to_wstring(unsigned long long val) { AZStd::wstring wstr; to_wstring(wstr, val); return wstr; }
|
||||
inline AZStd::wstring to_wstring(long double val) { AZStd::wstring wstr; to_wstring(wstr, val); return wstr; }
|
||||
|
||||
template<class Allocator1>
|
||||
void to_wstring(AZStd::basic_string<wstring::value_type, wstring::traits_type, Allocator1>& dest, const char* str, size_t strLen = 0)
|
||||
template<class Allocator>
|
||||
void to_wstring(AZStd::basic_string<wstring::value_type, wstring::traits_type, Allocator>& dest, AZStd::string_view src)
|
||||
{
|
||||
dest.clear();
|
||||
|
||||
if (strLen == 0)
|
||||
{
|
||||
strLen = strlen(str);
|
||||
}
|
||||
|
||||
if (strLen > 0)
|
||||
{
|
||||
Internal::WCharTPlatformConverter<>::to_wstring(dest, str, str + strLen);
|
||||
}
|
||||
Internal::WCharTPlatformConverter<>::to_wstring(dest, src);
|
||||
}
|
||||
|
||||
template<class Allocator1, class Allocator2>
|
||||
void to_wstring(AZStd::basic_string<wstring::value_type, wstring::traits_type, Allocator1>& dest, const AZStd::basic_string<string::value_type, string::traits_type, Allocator2>& src)
|
||||
template<size_t MaxElementCount>
|
||||
void to_wstring(AZStd::basic_fixed_string<wstring::value_type, MaxElementCount, wstring::traits_type>& dest, AZStd::string_view src)
|
||||
{
|
||||
return to_wstring(dest, src.c_str(), src.length());
|
||||
dest.clear();
|
||||
Internal::WCharTPlatformConverter<>::to_wstring(dest, src);
|
||||
}
|
||||
|
||||
inline void to_wstring(wchar_t* dest, size_t destSize, AZStd::string_view src)
|
||||
{
|
||||
wchar_t* endWStr = Internal::WCharTPlatformConverter<>::to_wstring(dest, destSize, src);
|
||||
if (endWStr < (dest + destSize))
|
||||
{
|
||||
*endWStr = '\0'; // null terminator
|
||||
}
|
||||
}
|
||||
|
||||
// Convert a range of chars to lower case
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <AzCore/std/base.h>
|
||||
#include <AzCore/std/iterator.h>
|
||||
#include <AzCore/std/allocator.h>
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/std/typetraits/alignment_of.h>
|
||||
#include <AzCore/std/typetraits/is_integral.h>
|
||||
|
||||
|
||||
@@ -8,15 +8,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/std/createdestroy.h>
|
||||
#include <AzCore/std/iterator.h>
|
||||
#include <AzCore/std/hash.h>
|
||||
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
namespace StringInternal
|
||||
{
|
||||
constexpr size_t min_size(size_t left, size_t right) { return (left < right) ? left : right; }
|
||||
|
||||
template<class Traits, class CharT, class SizeT>
|
||||
constexpr SizeT char_find(const CharT* s, size_t count, CharT ch, SizeT npos = static_cast<SizeT>(-1)) noexcept
|
||||
{
|
||||
@@ -83,7 +84,7 @@ namespace AZStd
|
||||
}
|
||||
|
||||
// Add one to offset so that for loop condition can check against 0 as the breakout condition
|
||||
size_t lastIndex = (AZStd::min)(offset, size - count) + 1;
|
||||
size_t lastIndex = StringInternal::min_size(offset, size - count) + 1;
|
||||
|
||||
for (; lastIndex; --lastIndex)
|
||||
{
|
||||
@@ -576,7 +577,7 @@ namespace AZStd
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
size_type rlen = AZStd::min<size_type>(count, size() - pos);
|
||||
size_type rlen = StringInternal::min_size(count, size() - pos);
|
||||
Traits::copy(dest, data() + pos, rlen);
|
||||
return rlen;
|
||||
}
|
||||
@@ -584,12 +585,12 @@ namespace AZStd
|
||||
constexpr basic_string_view substr(size_type pos = 0, size_type count = npos) const
|
||||
{
|
||||
AZ_Assert(pos <= size(), "Cannot create substring where position is larger than size");
|
||||
return pos > size() ? basic_string_view() : basic_string_view(data() + pos, AZStd::min<size_type>(count, size() - pos));
|
||||
return pos > size() ? basic_string_view() : basic_string_view(data() + pos, StringInternal::min_size(count, size() - pos));
|
||||
}
|
||||
|
||||
constexpr int compare(basic_string_view other) const
|
||||
{
|
||||
size_t cmpSize = AZStd::min<size_type>(size(), other.size());
|
||||
size_t cmpSize = StringInternal::min_size(size(), other.size());
|
||||
int cmpval = cmpSize == 0 ? 0 : Traits::compare(data(), other.data(), cmpSize);
|
||||
if (cmpval == 0)
|
||||
{
|
||||
@@ -891,6 +892,8 @@ namespace AZStd
|
||||
return hash;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
struct hash;
|
||||
template<class Element, class Traits>
|
||||
struct hash<basic_string_view<Element, Traits>>
|
||||
{
|
||||
|
||||
@@ -92,33 +92,58 @@ namespace Utf8::Unchecked
|
||||
return temp;
|
||||
}
|
||||
|
||||
static Iterator to_utf8_sequence(AZ::u32 cp, Iterator result)
|
||||
static Iterator to_utf8_sequence(AZ::u32 cp, Iterator& result, size_t& resultMaxSize)
|
||||
{
|
||||
if (cp < 0x80)
|
||||
{
|
||||
// one octet
|
||||
resultMaxSize -= 1; // no need to check the calling function will exit the loop
|
||||
*(result++) = static_cast<AZ::u8>(cp);
|
||||
}
|
||||
else if (cp < 0x800)
|
||||
{
|
||||
// two octets
|
||||
*(result++) = static_cast<AZ::u8>((cp >> 6) | 0xc0);
|
||||
*(result++) = static_cast<AZ::u8>((cp & 0x3f) | 0x80);
|
||||
if (resultMaxSize >= 2)
|
||||
{
|
||||
*(result++) = static_cast<AZ::u8>((cp >> 6) | 0xc0);
|
||||
*(result++) = static_cast<AZ::u8>((cp & 0x3f) | 0x80);
|
||||
resultMaxSize -= 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
resultMaxSize = 0;
|
||||
}
|
||||
}
|
||||
else if (cp < 0x10000)
|
||||
{
|
||||
// three octets
|
||||
*(result++) = static_cast<AZ::u8>((cp >> 12) | 0xe0);
|
||||
*(result++) = static_cast<AZ::u8>(((cp >> 6) & 0x3f) | 0x80);
|
||||
*(result++) = static_cast<AZ::u8>((cp & 0x3f) | 0x80);
|
||||
if (resultMaxSize >= 3)
|
||||
{
|
||||
*(result++) = static_cast<AZ::u8>((cp >> 12) | 0xe0);
|
||||
*(result++) = static_cast<AZ::u8>(((cp >> 6) & 0x3f) | 0x80);
|
||||
*(result++) = static_cast<AZ::u8>((cp & 0x3f) | 0x80);
|
||||
resultMaxSize -= 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
resultMaxSize = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// four octets
|
||||
*(result++) = static_cast<AZ::u8>((cp >> 18) | 0xf0);
|
||||
*(result++) = static_cast<AZ::u8>(((cp >> 12) & 0x3f) | 0x80);
|
||||
*(result++) = static_cast<AZ::u8>(((cp >> 6) & 0x3f) | 0x80);
|
||||
*(result++) = static_cast<AZ::u8>((cp & 0x3f) | 0x80);
|
||||
if (resultMaxSize >= 4)
|
||||
{
|
||||
*(result++) = static_cast<AZ::u8>((cp >> 18) | 0xf0);
|
||||
*(result++) = static_cast<AZ::u8>(((cp >> 12) & 0x3f) | 0x80);
|
||||
*(result++) = static_cast<AZ::u8>(((cp >> 6) & 0x3f) | 0x80);
|
||||
*(result++) = static_cast<AZ::u8>((cp & 0x3f) | 0x80);
|
||||
resultMaxSize -= 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
resultMaxSize = 0;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -155,8 +180,99 @@ namespace Utf8::Unchecked
|
||||
};
|
||||
|
||||
template <typename u16bit_iterator, typename Utf8Iterator>
|
||||
Utf8Iterator utf16to8(u16bit_iterator start, u16bit_iterator end, Utf8Iterator result)
|
||||
Utf8Iterator utf16to8(u16bit_iterator start, u16bit_iterator end, Utf8Iterator result, size_t resultMaxSize)
|
||||
{
|
||||
while (start != end && resultMaxSize > 0)
|
||||
{
|
||||
AZ::u32 cp = Utf8::Internal::mask16(*start++);
|
||||
// Take care of surrogate pairs first
|
||||
if (Utf8::Internal::is_lead_surrogate(cp))
|
||||
{
|
||||
AZ::u32 trail_surrogate = Utf8::Internal::mask16(*start++);
|
||||
cp = (cp << 10) + trail_surrogate + Internal::SURROGATE_OFFSET;
|
||||
}
|
||||
octet_iterator<Utf8Iterator>::to_utf8_sequence(cp, result, resultMaxSize);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename u16bit_iterator, typename Utf8Iterator>
|
||||
u16bit_iterator utf8to16(Utf8Iterator start, Utf8Iterator end, u16bit_iterator result, size_t resultMaxSize)
|
||||
{
|
||||
octet_iterator utf8Start(start);
|
||||
octet_iterator utf8Last(end);
|
||||
while (utf8Start != utf8Last && resultMaxSize > 0)
|
||||
{
|
||||
AZ::u32 cp = *utf8Start++;
|
||||
if (cp > 0xffff)
|
||||
{
|
||||
//make a surrogate pair
|
||||
if (resultMaxSize >= 2)
|
||||
{
|
||||
*result++ = static_cast<AZ::u16>((cp >> 10) + Internal::LEAD_OFFSET);
|
||||
*result++ = static_cast<AZ::u16>((cp & 0x3ff) + Internal::TRAIL_SURROGATE_MIN);
|
||||
resultMaxSize -= 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
resultMaxSize = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*result++ = static_cast<AZ::u16>(cp);
|
||||
resultMaxSize -= 1;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename Utf8Iterator, typename u32bit_iterator>
|
||||
Utf8Iterator utf32to8(u32bit_iterator start, u32bit_iterator end, Utf8Iterator result, size_t resultMaxSize)
|
||||
{
|
||||
while (start != end && resultMaxSize > 0)
|
||||
{
|
||||
octet_iterator<Utf8Iterator>::to_utf8_sequence(*start++, result, resultMaxSize);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename Utf8Iterator, typename u32bit_iterator>
|
||||
u32bit_iterator utf8to32(Utf8Iterator start, Utf8Iterator end, u32bit_iterator result, size_t resultMaxSize)
|
||||
{
|
||||
octet_iterator utf8Start(start);
|
||||
octet_iterator utf8Last(end);
|
||||
while (utf8Start != utf8Last && resultMaxSize > 0)
|
||||
{
|
||||
*result++ = *utf8Start++;
|
||||
--resultMaxSize;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static constexpr size_t utf8_codepoint_length(AZ::u32 cp)
|
||||
{
|
||||
if (cp < 0x80)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if (cp < 0x800)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else if (cp < 0x10000)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
|
||||
template <typename u16bit_iterator>
|
||||
size_t utf16ToUtf8BytesRequired(u16bit_iterator start, u16bit_iterator end)
|
||||
{
|
||||
size_t bytesRequired = 0;
|
||||
while (start != end)
|
||||
{
|
||||
AZ::u32 cp = Utf8::Internal::mask16(*start++);
|
||||
@@ -166,56 +282,23 @@ namespace Utf8::Unchecked
|
||||
AZ::u32 trail_surrogate = Utf8::Internal::mask16(*start++);
|
||||
cp = (cp << 10) + trail_surrogate + Internal::SURROGATE_OFFSET;
|
||||
}
|
||||
octet_iterator<Utf8Iterator>::to_utf8_sequence(cp, result);
|
||||
bytesRequired += utf8_codepoint_length(cp);
|
||||
}
|
||||
return result;
|
||||
return bytesRequired;
|
||||
}
|
||||
|
||||
template <typename u16bit_iterator, typename Utf8Iterator>
|
||||
u16bit_iterator utf8to16(Utf8Iterator start, Utf8Iterator end, u16bit_iterator result)
|
||||
{
|
||||
octet_iterator utf8Start(start);
|
||||
octet_iterator utf8Last(end);
|
||||
while (utf8Start != utf8Last)
|
||||
{
|
||||
AZ::u32 cp = *utf8Start++;
|
||||
if (cp > 0xffff)
|
||||
{
|
||||
//make a surrogate pair
|
||||
*result++ = static_cast<AZ::u16>((cp >> 10) + Internal::LEAD_OFFSET);
|
||||
*result++ = static_cast<AZ::u16>((cp & 0x3ff) + Internal::TRAIL_SURROGATE_MIN);
|
||||
}
|
||||
else
|
||||
{
|
||||
*result++ = static_cast<AZ::u16>(cp);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename Utf8Iterator, typename u32bit_iterator>
|
||||
Utf8Iterator utf32to8(u32bit_iterator start, u32bit_iterator end, Utf8Iterator result)
|
||||
template <typename u32bit_iterator>
|
||||
size_t utf32ToUtf8BytesRequired(u32bit_iterator start, u32bit_iterator end)
|
||||
{
|
||||
size_t bytesRequired = 0;
|
||||
while (start != end)
|
||||
{
|
||||
octet_iterator<Utf8Iterator>::to_utf8_sequence(*start++, result);
|
||||
bytesRequired += utf8_codepoint_length(*start++);
|
||||
}
|
||||
|
||||
return result;
|
||||
return bytesRequired;
|
||||
}
|
||||
|
||||
template <typename Utf8Iterator, typename u32bit_iterator>
|
||||
u32bit_iterator utf8to32(Utf8Iterator start, Utf8Iterator end, u32bit_iterator result)
|
||||
{
|
||||
octet_iterator utf8Start(start);
|
||||
octet_iterator utf8Last(end);
|
||||
while (utf8Start != utf8Last)
|
||||
{
|
||||
*result++ = *utf8Start++;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
} // namespace Utf8::Unchecked
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/std/typetraits/conditional.h>
|
||||
#include <AzCore/std/typetraits/integral_constant.h> // for true_type
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
|
||||
@@ -9,11 +9,12 @@
|
||||
|
||||
#include <AzCore/std/typetraits/aligned_storage.h>
|
||||
#include <AzCore/std/typetraits/alignment_of.h>
|
||||
#include <AzCore/std/utils.h>
|
||||
#include <AzCore/std/typetraits/conditional.h>
|
||||
#include <AzCore/std/parallel/atomic.h>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
using std::forward;
|
||||
// Extension: static_storage: Used to initialize statics in a thread-safe manner
|
||||
// These are similar to default_delete/no_delete, except they just invoke the destructor (or not)
|
||||
template <class T>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <AzCore/std/typetraits/is_lvalue_reference.h>
|
||||
#include <AzCore/std/typetraits/void_t.h>
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
namespace AZStd
|
||||
{
|
||||
|
||||
@@ -72,6 +72,7 @@ namespace AZ
|
||||
|
||||
void OutputToDebugger(const char*, const char*)
|
||||
{
|
||||
// std::cout << title << ": " << message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -11,6 +11,7 @@
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/std/parallel/mutex.h>
|
||||
#include <AzCore/std/parallel/condition_variable.h>
|
||||
#include <AzCore/std/parallel/atomic.h>
|
||||
|
||||
namespace AZ::Platform
|
||||
{
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/Debug/TraceMessageBus.h>
|
||||
#include <AzCore/Debug/TraceMessagesDrillerBus.h>
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
#include <AzCore/std/string/fixed_string.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -22,7 +24,7 @@ namespace AZ
|
||||
LPTOP_LEVEL_EXCEPTION_FILTER g_previousExceptionHandler = nullptr;
|
||||
#endif
|
||||
|
||||
const int g_maxMessageLength = 4096;
|
||||
constexpr int g_maxMessageLength = 4096;
|
||||
|
||||
namespace Debug
|
||||
{
|
||||
@@ -58,19 +60,18 @@ namespace AZ
|
||||
TerminateProcess(GetCurrentProcess(), exitCode);
|
||||
}
|
||||
|
||||
void OutputToDebugger(const char* window, const char* message)
|
||||
void OutputToDebugger([[maybe_unused]] const char* window, const char* message)
|
||||
{
|
||||
AZ_UNUSED(window);
|
||||
#ifdef _UNICODE
|
||||
wchar_t messageW[g_maxMessageLength];
|
||||
size_t numCharsConverted;
|
||||
if (mbstowcs_s(&numCharsConverted, messageW, message, g_maxMessageLength - 1) == 0)
|
||||
AZStd::fixed_wstring<g_maxMessageLength> tmpW;
|
||||
if(window)
|
||||
{
|
||||
OutputDebugStringW(messageW);
|
||||
AZStd::to_wstring(tmpW, window);
|
||||
tmpW += L": ";
|
||||
OutputDebugStringW(tmpW.c_str());
|
||||
tmpW.clear();
|
||||
}
|
||||
#else // !_UNICODE
|
||||
OutputDebugString(message);
|
||||
#endif // !_UNICODE
|
||||
AZStd::to_wstring(tmpW, message);
|
||||
OutputDebugStringW(tmpW.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ namespace
|
||||
//=========================================================================
|
||||
DWORD GetAttributes(const char* fileName)
|
||||
{
|
||||
#ifdef _UNICODE
|
||||
wchar_t fileNameW[AZ_MAX_PATH_LEN];
|
||||
size_t numCharsConverted;
|
||||
if (mbstowcs_s(&numCharsConverted, fileNameW, fileName, AZ_ARRAY_SIZE(fileNameW) - 1) == 0)
|
||||
@@ -39,9 +38,6 @@ namespace
|
||||
{
|
||||
return INVALID_FILE_ATTRIBUTES;
|
||||
}
|
||||
#else //!_UNICODE
|
||||
return GetFileAttributes(fileName);
|
||||
#endif // !_UNICODE
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
@@ -51,7 +47,6 @@ namespace
|
||||
//=========================================================================
|
||||
BOOL SetAttributes(const char* fileName, DWORD fileAttributes)
|
||||
{
|
||||
#ifdef _UNICODE
|
||||
wchar_t fileNameW[AZ_MAX_PATH_LEN];
|
||||
size_t numCharsConverted;
|
||||
if (mbstowcs_s(&numCharsConverted, fileNameW, fileName, AZ_ARRAY_SIZE(fileNameW) - 1) == 0)
|
||||
@@ -62,9 +57,6 @@ namespace
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
#else //!_UNICODE
|
||||
return SetFileAttributes(fileName, fileAttributes);
|
||||
#endif // !_UNICODE
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
@@ -76,7 +68,6 @@ namespace
|
||||
// * GetLastError() on Windows-like platforms
|
||||
// * errno on Unix platforms
|
||||
//=========================================================================
|
||||
#if defined(_UNICODE)
|
||||
bool CreateDirRecursive(wchar_t* dirPath)
|
||||
{
|
||||
if (CreateDirectoryW(dirPath, nullptr))
|
||||
@@ -112,53 +103,6 @@ namespace
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
bool CreateDirRecursive(char* dirPath)
|
||||
{
|
||||
if (CreateDirectory(dirPath, nullptr))
|
||||
{
|
||||
return true; // Created without error
|
||||
}
|
||||
DWORD error = GetLastError();
|
||||
if (error == ERROR_PATH_NOT_FOUND)
|
||||
{
|
||||
// try to create our parent hierarchy
|
||||
for (size_t i = strlen(dirPath); i > 0; --i)
|
||||
{
|
||||
if (dirPath[i] == '/' || dirPath[i] == '\\')
|
||||
{
|
||||
char delimiter = dirPath[i];
|
||||
dirPath[i] = 0; // null-terminate at the previous slash
|
||||
bool ret = CreateDirRecursive(dirPath);
|
||||
dirPath[i] = delimiter; // restore slash
|
||||
if (ret)
|
||||
{
|
||||
// now that our parent is created, try to create again
|
||||
if (CreateDirectory(dirPath, nullptr))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
DWORD creationError = GetLastError();
|
||||
if (creationError == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
DWORD attributes = GetFileAttributes(dirPath);
|
||||
return (attributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// if we reach here then there was no parent folder to create, so we failed for other reasons
|
||||
}
|
||||
else if (error == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
DWORD attributes = GetFileAttributes(dirPath);
|
||||
return (attributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const SystemFile::FileHandleType PlatformSpecificInvalidHandle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
@@ -208,7 +152,6 @@ bool SystemFile::PlatformOpen(int mode, int platformFlags)
|
||||
CreatePath(m_fileName.c_str());
|
||||
}
|
||||
|
||||
# ifdef _UNICODE
|
||||
wchar_t fileNameW[AZ_MAX_PATH_LEN];
|
||||
size_t numCharsConverted;
|
||||
m_handle = INVALID_HANDLE_VALUE;
|
||||
@@ -216,9 +159,6 @@ bool SystemFile::PlatformOpen(int mode, int platformFlags)
|
||||
{
|
||||
m_handle = CreateFileW(fileNameW, dwDesiredAccess, dwShareMode, 0, dwCreationDisposition, dwFlagsAndAttributes, 0);
|
||||
}
|
||||
# else //!_UNICODE
|
||||
m_handle = CreateFile(m_fileName.c_str(), dwDesiredAccess, dwShareMode, 0, dwCreationDisposition, dwFlagsAndAttributes, 0);
|
||||
# endif // !_UNICODE
|
||||
|
||||
if (m_handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
@@ -417,7 +357,6 @@ namespace Platform
|
||||
HANDLE hFile;
|
||||
int lastError;
|
||||
|
||||
#ifdef _UNICODE
|
||||
wchar_t filterW[AZ_MAX_PATH_LEN];
|
||||
size_t numCharsConverted;
|
||||
hFile = INVALID_HANDLE_VALUE;
|
||||
@@ -425,39 +364,28 @@ namespace Platform
|
||||
{
|
||||
hFile = FindFirstFile(filterW, &fd);
|
||||
}
|
||||
#else // !_UNICODE
|
||||
hFile = FindFirstFile(filter, &fd);
|
||||
#endif // !_UNICODE
|
||||
|
||||
if (hFile != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
const char* fileName;
|
||||
|
||||
#ifdef _UNICODE
|
||||
char fileNameA[AZ_MAX_PATH_LEN];
|
||||
fileName = NULL;
|
||||
if (wcstombs_s(&numCharsConverted, fileNameA, fd.cFileName, AZ_ARRAY_SIZE(fileNameA) - 1) == 0)
|
||||
{
|
||||
fileName = fileNameA;
|
||||
}
|
||||
#else // !_UNICODE
|
||||
fileName = fd.cFileName;
|
||||
#endif // !_UNICODE
|
||||
|
||||
cb(fileName, (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0);
|
||||
|
||||
// List all the other files in the directory.
|
||||
while (FindNextFile(hFile, &fd) != 0)
|
||||
while (FindNextFileW(hFile, &fd) != 0)
|
||||
{
|
||||
#ifdef _UNICODE
|
||||
fileName = NULL;
|
||||
if (wcstombs_s(&numCharsConverted, fileNameA, fd.cFileName, AZ_ARRAY_SIZE(fileNameA) - 1) == 0)
|
||||
{
|
||||
fileName = fileNameA;
|
||||
}
|
||||
#else // !_UNICODE
|
||||
fileName = fd.cFileName;
|
||||
#endif // !_UNICODE
|
||||
|
||||
cb(fileName, (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0);
|
||||
}
|
||||
@@ -483,16 +411,12 @@ namespace Platform
|
||||
{
|
||||
HANDLE handle = nullptr;
|
||||
|
||||
#ifdef _UNICODE
|
||||
wchar_t fileNameW[AZ_MAX_PATH_LEN];
|
||||
size_t numCharsConverted;
|
||||
if (mbstowcs_s(&numCharsConverted, fileNameW, fileName, AZ_ARRAY_SIZE(fileNameW) - 1) == 0)
|
||||
{
|
||||
handle = CreateFileW(fileNameW, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
|
||||
}
|
||||
#else // !_UNICODE
|
||||
handle = CreateFileA(fileName, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
|
||||
#endif // !_UNICODE
|
||||
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
@@ -524,16 +448,12 @@ namespace Platform
|
||||
WIN32_FILE_ATTRIBUTE_DATA data = { 0 };
|
||||
BOOL result = FALSE;
|
||||
|
||||
#ifdef _UNICODE
|
||||
wchar_t fileNameW[AZ_MAX_PATH_LEN];
|
||||
size_t numCharsConverted;
|
||||
if (mbstowcs_s(&numCharsConverted, fileNameW, fileName, AZ_ARRAY_SIZE(fileNameW) - 1) == 0)
|
||||
{
|
||||
result = GetFileAttributesExW(fileNameW, GetFileExInfoStandard, &data);
|
||||
}
|
||||
#else // !_UNICODE
|
||||
result = GetFileAttributesExA(fileName, GetFileExInfoStandard, &data);
|
||||
#endif // !_UNICODE
|
||||
|
||||
if (result)
|
||||
{
|
||||
@@ -553,7 +473,6 @@ namespace Platform
|
||||
|
||||
bool Delete(const char* fileName)
|
||||
{
|
||||
#ifdef _UNICODE
|
||||
wchar_t fileNameW[AZ_MAX_PATH_LEN];
|
||||
size_t numCharsConverted;
|
||||
if (mbstowcs_s(&numCharsConverted, fileNameW, fileName, AZ_ARRAY_SIZE(fileNameW) - 1) == 0)
|
||||
@@ -568,20 +487,12 @@ namespace Platform
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#else // !_UNICODE
|
||||
if (DeleteFile(fileName) == 0)
|
||||
{
|
||||
EBUS_EVENT(FileIOEventBus, OnError, nullptr, fileName, (int)GetLastError());
|
||||
return false;
|
||||
}
|
||||
#endif // !_UNICODE
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Rename(const char* sourceFileName, const char* targetFileName, bool overwrite)
|
||||
{
|
||||
#ifdef _UNICODE
|
||||
wchar_t sourceFileNameW[AZ_MAX_PATH_LEN];
|
||||
wchar_t targetFileNameW[AZ_MAX_PATH_LEN];
|
||||
size_t numCharsConverted;
|
||||
@@ -598,13 +509,6 @@ namespace Platform
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#else // !_UNICODE
|
||||
if (MoveFileEx(sourceFileName, targetFileName, overwrite ? MOVEFILE_REPLACE_EXISTING : 0) == 0)
|
||||
{
|
||||
EBUS_EVENT(FileIOEventBus, OnError, nullptr, sourceFileName, (int)GetLastError());
|
||||
return false;
|
||||
}
|
||||
#endif // !_UNICODE
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -639,7 +543,6 @@ namespace Platform
|
||||
{
|
||||
if (dirName)
|
||||
{
|
||||
#if defined(_UNICODE)
|
||||
wchar_t dirPath[AZ_MAX_PATH_LEN];
|
||||
size_t numCharsConverted;
|
||||
if (mbstowcs_s(&numCharsConverted, dirPath, dirName, AZ_ARRAY_SIZE(dirPath) - 1) == 0)
|
||||
@@ -651,18 +554,6 @@ namespace Platform
|
||||
}
|
||||
return success;
|
||||
}
|
||||
#else
|
||||
char dirPath[AZ_MAX_PATH_LEN];
|
||||
if (azstrcpy(dirPath, AZ_ARRAY_SIZE(dirPath), dirName) == 0)
|
||||
{
|
||||
bool success = CreateDirRecursive(dirPath);
|
||||
if (!success)
|
||||
{
|
||||
EBUS_EVENT(FileIOEventBus, OnError, nullptr, dirName, (int)GetLastError());
|
||||
}
|
||||
return success;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -671,16 +562,12 @@ namespace Platform
|
||||
{
|
||||
if (dirName)
|
||||
{
|
||||
#if defined(_UNICODE)
|
||||
wchar_t dirNameW[AZ_MAX_PATH_LEN];
|
||||
size_t numCharsConverted;
|
||||
if (mbstowcs_s(&numCharsConverted, dirNameW, dirName, AZ_ARRAY_SIZE(dirNameW) - 1) == 0)
|
||||
{
|
||||
return RemoveDirectory(dirNameW) != 0;
|
||||
}
|
||||
#else
|
||||
return RemoveDirectory(dirName) != 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
-5
@@ -98,7 +98,6 @@ namespace AZ
|
||||
|
||||
bool alreadyLoaded = false;
|
||||
|
||||
# ifdef _UNICODE
|
||||
wchar_t fileNameW[MAX_PATH];
|
||||
size_t numCharsConverted;
|
||||
errno_t wcharResult = mbstowcs_s(&numCharsConverted, fileNameW, m_fileName.c_str(), AZ_ARRAY_SIZE(fileNameW) - 1);
|
||||
@@ -114,10 +113,6 @@ namespace AZ
|
||||
m_handle = NULL;
|
||||
return LoadStatus::LoadFailure;
|
||||
}
|
||||
# else //!_UNICODE
|
||||
alreadyLoaded = NULL != GetModuleHandleA(m_fileName.c_str());
|
||||
m_handle = LoadLibraryA(m_fileName.c_str());
|
||||
# endif // !_UNICODE
|
||||
|
||||
if (m_handle)
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/std/optional.h>
|
||||
#include <AzCore/std/string/fixed_string.h>
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -29,7 +30,8 @@ namespace AZ
|
||||
result.m_pathIncludesFilename = true;
|
||||
// Platform specific get exe path: http://stackoverflow.com/a/1024937
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulefilenamea
|
||||
const DWORD pathLen = GetModuleFileNameA(nullptr, exeStorageBuffer, static_cast<DWORD>(exeStorageSize));
|
||||
wchar_t pathBufferW[AZ::IO::MaxPathLength] = { 0 };
|
||||
const DWORD pathLen = GetModuleFileNameW(nullptr, pathBufferW, static_cast<DWORD>(AZStd::size(pathBufferW)));
|
||||
const DWORD errorCode = GetLastError();
|
||||
if (pathLen == exeStorageSize && errorCode == ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
@@ -39,6 +41,18 @@ namespace AZ
|
||||
{
|
||||
result.m_pathStored = ExecutablePathResult::GeneralError;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t utf8PathSize = AZStd::to_string_length({ pathBufferW, pathLen });
|
||||
if (utf8PathSize >= exeStorageSize)
|
||||
{
|
||||
result.m_pathStored = ExecutablePathResult::BufferSizeNotLargeEnough;
|
||||
}
|
||||
else
|
||||
{
|
||||
AZStd::to_string(exeStorageBuffer, exeStorageSize, pathBufferW);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -71,27 +71,11 @@ extern "C"
|
||||
using LPSECURITY_ATTRIBUTES = SECURITY_ATTRIBUTES*;
|
||||
|
||||
// Semaphore
|
||||
AZ_DLL_IMPORT HANDLE _stdcall CreateSemaphoreA(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCSTR lpName);
|
||||
AZ_DLL_IMPORT HANDLE _stdcall CreateSemaphoreW(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCWSTR lpName);
|
||||
AZ_DLL_IMPORT BOOL _stdcall ReleaseSemaphore(HANDLE hSemaphore, LONG lReleaseCount, LPLONG lpPreviousCount);
|
||||
#ifndef CreateSemaphore
|
||||
#ifdef UNICODE
|
||||
#define CreateSemaphore CreateSemaphoreW
|
||||
#else
|
||||
#define CreateSemaphore CreateSemaphoreA
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Event
|
||||
AZ_DLL_IMPORT HANDLE _stdcall CreateEventA(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName);
|
||||
AZ_DLL_IMPORT HANDLE _stdcall CreateEventW(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCWSTR lpName);
|
||||
#ifndef CreateEvent
|
||||
#ifdef UNICODE
|
||||
#define CreateEvent CreateEventW
|
||||
#else
|
||||
#define CreateEvent CreateEventA
|
||||
#endif
|
||||
#endif
|
||||
AZ_DLL_IMPORT BOOL _stdcall SetEvent(HANDLE);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -15,14 +15,14 @@ namespace AZStd
|
||||
{
|
||||
inline semaphore::semaphore(unsigned int initialCount, unsigned int maximumCount)
|
||||
{
|
||||
m_semaphore = CreateSemaphore(NULL, initialCount, maximumCount, 0);
|
||||
m_semaphore = CreateSemaphoreW(NULL, initialCount, maximumCount, 0);
|
||||
AZ_Assert(m_semaphore != NULL, "CreateSemaphore error: %d\n", GetLastError());
|
||||
}
|
||||
|
||||
inline semaphore::semaphore(const char* name, unsigned int initialCount, unsigned int maximumCount)
|
||||
{
|
||||
(void)name; // name is used only for debug, if we pass it to the semaphore it will become named semaphore
|
||||
m_semaphore = CreateSemaphore(NULL, initialCount, maximumCount, 0);
|
||||
m_semaphore = CreateSemaphoreW(NULL, initialCount, maximumCount, 0);
|
||||
AZ_Assert(m_semaphore != NULL, "CreateSemaphore error: %d\n", GetLastError());
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <AzCore/Debug/Trace.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
@@ -14,8 +15,9 @@ namespace AZ
|
||||
{
|
||||
namespace Platform
|
||||
{
|
||||
void OutputToDebugger(const char*, const char*)
|
||||
void OutputToDebugger([[maybe_unused]] const char* title, [[maybe_unused]] const char* message)
|
||||
{
|
||||
// std::cout << title << ": " << message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,20 +29,19 @@ namespace AZ
|
||||
return errno;
|
||||
}
|
||||
|
||||
void SharedMemory_Mac::ComposeMutexName(char* dest, size_t length, const char* name)
|
||||
void ComposeName(char* dest, size_t length, const char* name, const char* suffix)
|
||||
{
|
||||
azstrncpy(m_name, AZ_ARRAY_SIZE(m_name), name, strlen(name));
|
||||
|
||||
// sem_open doesn't support paths bigger than 31, so call it s_Mtx.
|
||||
// While this is enough for Profiler, maybe the code should be smarter
|
||||
// and trim the name instead
|
||||
azsnprintf(dest, length, "/tmp/%s_Mtx", name);
|
||||
azsnprintf(dest, length, "/tmp/%s_%s", name, suffix);
|
||||
}
|
||||
|
||||
SharedMemory_Common::CreateResult SharedMemory_Mac::Create(const char* name, unsigned int size, bool openIfCreated)
|
||||
{
|
||||
char fullName[256];
|
||||
ComposeMutexName(fullName, AZ_ARRAY_SIZE(fullName), name);
|
||||
azstrncpy(m_name, AZ_ARRAY_SIZE(m_name), name, strlen(name));
|
||||
ComposeName(fullName, AZ_ARRAY_SIZE(fullName), name, "Mtx");
|
||||
|
||||
m_globalMutex = sem_open(fullName, O_CREAT | O_EXCL, 0600, 1);
|
||||
int error = errno;
|
||||
@@ -59,7 +58,7 @@ namespace AZ
|
||||
}
|
||||
|
||||
// Create the file mapping.
|
||||
azsnprintf(fullName, AZ_ARRAY_SIZE(fullName), "%s_Data", name);
|
||||
ComposeName(fullName, AZ_ARRAY_SIZE(fullName), name, "Data");
|
||||
m_mapHandle = shm_open(fullName, O_RDWR | O_CREAT | O_EXCL, 0600);
|
||||
error = errno;
|
||||
if (error == EEXIST)
|
||||
@@ -80,7 +79,8 @@ namespace AZ
|
||||
bool SharedMemory_Mac::Open(const char* name)
|
||||
{
|
||||
char fullName[256];
|
||||
ComposeMutexName(fullName, AZ_ARRAY_SIZE(fullName), name);
|
||||
azstrncpy(m_name, AZ_ARRAY_SIZE(m_name), name, strlen(name));
|
||||
ComposeName(fullName, AZ_ARRAY_SIZE(fullName), name, "Mtx");
|
||||
|
||||
m_globalMutex = sem_open(fullName, 0);
|
||||
AZ_Warning("AZSystem", m_globalMutex != nullptr, "Failed to open OS mutex [%s]\n", m_name);
|
||||
@@ -90,7 +90,7 @@ namespace AZ
|
||||
return false;
|
||||
}
|
||||
|
||||
azsnprintf(fullName, AZ_ARRAY_SIZE(fullName), "%s_Data", name);
|
||||
ComposeName(fullName, AZ_ARRAY_SIZE(fullName), name, "Data");
|
||||
m_mapHandle = shm_open(fullName, O_RDWR, 0600);
|
||||
if (m_mapHandle == -1)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,6 @@ namespace AZ
|
||||
|
||||
static int GetLastError();
|
||||
|
||||
void ComposeMutexName(char* dest, size_t length, const char* name);
|
||||
CreateResult Create(const char* name, unsigned int size, bool openIfCreated);
|
||||
bool Open(const char* name);
|
||||
void Close();
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
#include <AzCore/Debug/StackTracer.h>
|
||||
#include <AzCore/Math/MathUtils.h>
|
||||
#include <AzCore/Math/Crc.h>
|
||||
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/std/containers/fixed_vector.h>
|
||||
@@ -90,7 +91,7 @@ namespace AZ {
|
||||
{
|
||||
case CBA_EVENT:
|
||||
evt = (PIMAGEHLP_CBA_EVENT)CallbackData;
|
||||
_tprintf(_T("%s"), (PTSTR)evt->desc);
|
||||
printf("%s", evt->desc);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -300,7 +301,7 @@ namespace AZ {
|
||||
return;
|
||||
}
|
||||
|
||||
const HMODULE hNtDll = GetModuleHandle(_T("ntdll.dll"));
|
||||
const HMODULE hNtDll = GetModuleHandleW(L"ntdll.dll");
|
||||
m_LdrRegisterDllNotification = reinterpret_cast<PLDR_REGISTER_DLL_NOTIFICATION>(GetProcAddress(hNtDll, "LdrRegisterDllNotification"));
|
||||
|
||||
if (m_LdrRegisterDllNotification)
|
||||
@@ -324,7 +325,7 @@ namespace AZ {
|
||||
return;
|
||||
}
|
||||
|
||||
const HMODULE hNtDll = GetModuleHandle(_T("ntdll.dll"));
|
||||
const HMODULE hNtDll = GetModuleHandleW(L"ntdll.dll");
|
||||
m_LdrUnregisterDllNotification = reinterpret_cast<PLDR_UNREGISTER_DLL_NOTIFICATION>(GetProcAddress(hNtDll, "LdrUnregisterDllNotification"));
|
||||
|
||||
if (m_LdrUnregisterDllNotification)
|
||||
@@ -609,8 +610,8 @@ namespace AZ {
|
||||
if (GetFileVersionInfoA(szImg, dwHandle, dwSize, vData) != 0)
|
||||
{
|
||||
UINT len;
|
||||
TCHAR szSubBlock[] = _T("\\");
|
||||
if (VerQueryValue(vData, szSubBlock, (LPVOID*) &fInfo, &len) == 0)
|
||||
TCHAR szSubBlock[] = L"\\";
|
||||
if (VerQueryValueW(vData, szSubBlock, (LPVOID*) &fInfo, &len) == 0)
|
||||
{
|
||||
fInfo = NULL;
|
||||
}
|
||||
@@ -711,7 +712,7 @@ namespace AZ {
|
||||
typedef BOOL (__stdcall * tM32N)(HANDLE hSnapshot, LPMODULEENTRY32 lpme);
|
||||
|
||||
// try both dlls...
|
||||
const TCHAR* dllname[] = { _T("kernel32.dll"), _T("tlhelp32.dll") };
|
||||
const TCHAR* dllname[] = { L"kernel32.dll", L"tlhelp32.dll" };
|
||||
HINSTANCE hToolhelp = NULL;
|
||||
tCT32S pCT32S = NULL;
|
||||
tM32F pM32F = NULL;
|
||||
@@ -822,7 +823,7 @@ namespace AZ {
|
||||
const SIZE_T TTBUFLEN = 8096;
|
||||
int cnt = 0;
|
||||
|
||||
hPsapi = LoadLibrary(_T("psapi.dll"));
|
||||
hPsapi = LoadLibraryW(L"psapi.dll");
|
||||
if (hPsapi == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
@@ -956,10 +957,10 @@ cleanup:
|
||||
// In that scenario, we may try to load and older dbghelp.dll which could cause issues
|
||||
// To overcome this, we try to load dbghelp.dll from the Win 10 SDK folder, if that doesn't
|
||||
// work, load the default.
|
||||
g_dbgHelpDll = LoadLibrary(_T(R"(C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\dbghelp.dll)"));
|
||||
g_dbgHelpDll = LoadLibraryW(LR"(C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\dbghelp.dll)");
|
||||
if (g_dbgHelpDll == NULL)
|
||||
{
|
||||
g_dbgHelpDll = LoadLibrary(_T("dbghelp.dll"));
|
||||
g_dbgHelpDll = LoadLibrary(L"dbghelp.dll");
|
||||
}
|
||||
}
|
||||
if (g_dbgHelpDll == NULL)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <AzCore/std/typetraits/decay.h>
|
||||
#include <AzCore/std/typetraits/is_unsigned.h>
|
||||
#include <AzCore/StringFunc/StringFunc.h>
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
|
||||
namespace AZ::IO
|
||||
{
|
||||
@@ -467,8 +468,10 @@ namespace AZ::IO
|
||||
DWORD createFlags = m_constructionOptions.m_enableUnbufferedReads ? (FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING) : FILE_FLAG_OVERLAPPED;
|
||||
DWORD shareMode = (m_constructionOptions.m_enableSharing || data.m_sharedRead) ? FILE_SHARE_READ: 0;
|
||||
|
||||
file = ::CreateFile(
|
||||
data.m_path.GetAbsolutePath(), // file name
|
||||
AZStd::wstring filenameW;
|
||||
AZStd::to_wstring(filenameW, data.m_path.GetAbsolutePath());
|
||||
file = ::CreateFileW(
|
||||
filenameW.c_str(), // file name
|
||||
FILE_GENERIC_READ, // desired access
|
||||
shareMode, // share mode
|
||||
nullptr, // security attributes
|
||||
@@ -806,7 +809,9 @@ namespace AZ::IO
|
||||
}
|
||||
|
||||
WIN32_FILE_ATTRIBUTE_DATA attributes;
|
||||
if (::GetFileAttributesEx(fileExists.m_path.GetAbsolutePath(), GetFileExInfoStandard, &attributes))
|
||||
AZStd::wstring filenameW;
|
||||
AZStd::to_wstring(filenameW, fileExists.m_path.GetAbsolutePath());
|
||||
if (::GetFileAttributesExW(filenameW.c_str(), GetFileExInfoStandard, &attributes))
|
||||
{
|
||||
if ((attributes.dwFileAttributes != INVALID_FILE_ATTRIBUTES) &&
|
||||
((attributes.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0))
|
||||
@@ -863,7 +868,9 @@ namespace AZ::IO
|
||||
else
|
||||
{
|
||||
WIN32_FILE_ATTRIBUTE_DATA attributes;
|
||||
if (::GetFileAttributesEx(command.m_path.GetAbsolutePath(), GetFileExInfoStandard, &attributes) &&
|
||||
AZStd::wstring filenameW;
|
||||
AZStd::to_wstring(filenameW, command.m_path.GetAbsolutePath());
|
||||
if (::GetFileAttributesExW(filenameW.c_str(), GetFileExInfoStandard, &attributes) &&
|
||||
(attributes.dwFileAttributes != INVALID_FILE_ATTRIBUTES) && ((attributes.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0))
|
||||
{
|
||||
fileSize.LowPart = attributes.nFileSizeLow;
|
||||
|
||||
+2
-2
@@ -290,7 +290,7 @@ namespace AZ::IO
|
||||
static bool CollectHardwareInfo(HardwareInformation& hardwareInfo, bool addAllDrives, bool reportHardware)
|
||||
{
|
||||
char drives[512];
|
||||
if (::GetLogicalDriveStrings(sizeof(drives) - 1, drives))
|
||||
if (::GetLogicalDriveStringsA(sizeof(drives) - 1, drives))
|
||||
{
|
||||
AZStd::unordered_map<DWORD, DriveInformation> driveMappings;
|
||||
char* driveIt = drives;
|
||||
@@ -318,7 +318,7 @@ namespace AZ::IO
|
||||
deviceName += driveIt;
|
||||
deviceName.erase(deviceName.length() - 1); // Erase the slash.
|
||||
|
||||
HANDLE deviceHandle = ::CreateFile(
|
||||
HANDLE deviceHandle = ::CreateFileA(
|
||||
deviceName.c_str(), 0, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr);
|
||||
if (deviceHandle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
#include <AzCore/IPC/SharedMemory.h>
|
||||
#include <AzCore/std/parallel/spin_mutex.h>
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
#include <AzCore/std/string/fixed_string.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
@@ -20,16 +22,18 @@ namespace AZ
|
||||
{
|
||||
}
|
||||
|
||||
void SharedMemory_Windows::ComposeMutexName(char* dest, size_t length, const char* name)
|
||||
void ComposeName(AZStd::fixed_wstring<256>& dest, const char* name, const wchar_t* suffix)
|
||||
{
|
||||
azstrncpy(m_name, AZ_ARRAY_SIZE(m_name), name, strlen(name));
|
||||
azsnprintf(dest, length, "%s_Mutex", name);
|
||||
AZStd::to_wstring(dest, name);
|
||||
dest += L"_";
|
||||
dest += suffix;
|
||||
}
|
||||
|
||||
SharedMemory_Common::CreateResult SharedMemory_Windows::Create(const char* name, unsigned int size, bool openIfCreated)
|
||||
{
|
||||
char fullName[256];
|
||||
ComposeMutexName(fullName, AZ_ARRAY_SIZE(fullName), name);
|
||||
azstrncpy(m_name, AZ_ARRAY_SIZE(m_name), name, strlen(name));
|
||||
AZStd::fixed_wstring<256> fullName;
|
||||
ComposeName(fullName, name, L"Mutex");
|
||||
|
||||
// Security attributes
|
||||
SECURITY_ATTRIBUTES secAttr;
|
||||
@@ -41,7 +45,7 @@ namespace AZ
|
||||
SetSecurityDescriptorDacl(secAttr.lpSecurityDescriptor, TRUE, 0, FALSE);
|
||||
|
||||
// Obtain global mutex
|
||||
m_globalMutex = CreateMutex(&secAttr, FALSE, fullName);
|
||||
m_globalMutex = CreateMutexW(&secAttr, FALSE, fullName.c_str());
|
||||
DWORD error = GetLastError();
|
||||
if (m_globalMutex == NULL || (error == ERROR_ALREADY_EXISTS && openIfCreated == false))
|
||||
{
|
||||
@@ -50,8 +54,8 @@ namespace AZ
|
||||
}
|
||||
|
||||
// Create the file mapping.
|
||||
azsnprintf(fullName, AZ_ARRAY_SIZE(fullName), "%s_Data", name);
|
||||
m_mapHandle = CreateFileMapping(INVALID_HANDLE_VALUE, &secAttr, PAGE_READWRITE, 0, size, fullName);
|
||||
ComposeName(fullName, name, L"Data");
|
||||
m_mapHandle = CreateFileMappingW(INVALID_HANDLE_VALUE, &secAttr, PAGE_READWRITE, 0, size, fullName.c_str());
|
||||
error = GetLastError();
|
||||
if (m_mapHandle == NULL || (error == ERROR_ALREADY_EXISTS && openIfCreated == false))
|
||||
{
|
||||
@@ -64,10 +68,11 @@ namespace AZ
|
||||
|
||||
bool SharedMemory_Windows::Open(const char* name)
|
||||
{
|
||||
char fullName[256];
|
||||
ComposeMutexName(fullName, AZ_ARRAY_SIZE(fullName), name);
|
||||
azstrncpy(m_name, AZ_ARRAY_SIZE(m_name), name, strlen(name));
|
||||
AZStd::fixed_wstring<256> fullName;
|
||||
ComposeName(fullName, name, L"Mutex");
|
||||
|
||||
m_globalMutex = OpenMutex(SYNCHRONIZE, TRUE, fullName);
|
||||
m_globalMutex = OpenMutex(SYNCHRONIZE, TRUE, fullName.c_str());
|
||||
AZ_Warning("AZSystem", m_globalMutex != NULL, "Failed to open OS mutex [%s]\n", m_name);
|
||||
if (m_globalMutex == NULL)
|
||||
{
|
||||
@@ -75,8 +80,8 @@ namespace AZ
|
||||
return false;
|
||||
}
|
||||
|
||||
azsnprintf(fullName, AZ_ARRAY_SIZE(fullName), "%s_Data", name);
|
||||
m_mapHandle = OpenFileMapping(FILE_MAP_WRITE, false, fullName);
|
||||
ComposeName(fullName, name, L"Data");
|
||||
m_mapHandle = OpenFileMapping(FILE_MAP_WRITE, false, fullName.c_str());
|
||||
if (m_mapHandle == NULL)
|
||||
{
|
||||
AZ_TracePrintf("AZSystem", "OpenFileMapping %s failed with error %d\n", m_name, GetLastError());
|
||||
|
||||
@@ -41,9 +41,6 @@ namespace AZ
|
||||
HANDLE m_mapHandle;
|
||||
HANDLE m_globalMutex;
|
||||
int m_lastLockResult;
|
||||
|
||||
private:
|
||||
void ComposeMutexName(char* dest, size_t length, const char* name);
|
||||
};
|
||||
|
||||
using SharedMemory_Platform = SharedMemory_Windows;
|
||||
|
||||
+10
-3
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <AzCore/Math/MathUtils.h>
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -105,11 +106,17 @@ namespace
|
||||
{
|
||||
// Set the text for window title, message, buttons.
|
||||
info = (DlgInfo*)lParam;
|
||||
SetWindowText(hDlg, info->m_title.c_str());
|
||||
SetWindowText(GetDlgItem(hDlg, 0), info->m_message.c_str());
|
||||
AZStd::wstring titleW;
|
||||
AZStd::to_wstring(titleW, info->m_title.c_str());
|
||||
SetWindowTextW(hDlg, titleW.c_str());
|
||||
AZStd::wstring messageW;
|
||||
AZStd::to_wstring(messageW, info->m_message.c_str());
|
||||
SetWindowTextW(GetDlgItem(hDlg, 0), messageW.c_str());
|
||||
for (int i = 0; i < info->m_options.size(); i++)
|
||||
{
|
||||
SetWindowText(GetDlgItem(hDlg, i + 1), info->m_options[i].c_str());
|
||||
AZStd::wstring optionW;
|
||||
AZStd::to_wstring(optionW, info->m_options[i].c_str());
|
||||
SetWindowTextW(GetDlgItem(hDlg, i + 1), optionW.c_str());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define UNICODE
|
||||
//#define NOGDICAPMASKS //- CC_*, LC_*, PC_*, CP_*, TC_*, RC_
|
||||
//#define NOVIRTUALKEYCODES //- VK_*
|
||||
//#define NOWINMESSAGES //- WM_*, EM_*, LB_*, CB_*
|
||||
|
||||
@@ -31,13 +31,13 @@ namespace AZ
|
||||
// Query the machine guid generated at install time by windows, which is generated from
|
||||
// hardware signatures. This guid is not enough, because images (AWS) may duplicate this,
|
||||
// so include the hostname/username as well
|
||||
TCHAR machineInfo[MAX_COMPUTERNAME_LENGTH + 1024] = { 0 };
|
||||
ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Cryptography", 0, KEY_QUERY_VALUE, &key);
|
||||
wchar_t machineInfo[MAX_COMPUTERNAME_LENGTH + 1024] = { 0 };
|
||||
ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Cryptography", 0, KEY_QUERY_VALUE, &key);
|
||||
if (ret == ERROR_SUCCESS)
|
||||
{
|
||||
DWORD dataType = REG_SZ;
|
||||
DWORD dataSize = sizeof(machineInfo);
|
||||
ret = RegQueryValueEx(key, "MachineGuid", 0, &dataType, (LPBYTE)machineInfo, &dataSize);
|
||||
ret = RegQueryValueExW(key, L"MachineGuid", 0, &dataType, (LPBYTE)machineInfo, &dataSize);
|
||||
RegCloseKey(key);
|
||||
}
|
||||
else
|
||||
@@ -45,24 +45,24 @@ namespace AZ
|
||||
AZ_Error("System", false, "Failed to open HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography\\MachineGuid!")
|
||||
}
|
||||
|
||||
TCHAR* hostname = machineInfo + _tcslen(machineInfo);
|
||||
wchar_t* hostname = machineInfo + wcslen(machineInfo);
|
||||
// salt the guid time with ComputerName/UserName
|
||||
DWORD bufCharCount = DWORD(sizeof(machineInfo) - (hostname - machineInfo));
|
||||
if (!::GetComputerName(hostname, &bufCharCount))
|
||||
if (!::GetComputerNameW(hostname, &bufCharCount))
|
||||
{
|
||||
AZ_Error("System", false, "GetComputerName filed with code %d", GetLastError());
|
||||
}
|
||||
|
||||
TCHAR* username = hostname + _tcslen(hostname);
|
||||
wchar_t* username = hostname + wcslen(hostname);
|
||||
bufCharCount = DWORD(sizeof(machineInfo) - (username - machineInfo));
|
||||
if( !GetUserName( username, &bufCharCount ) )
|
||||
if(!GetUserNameW(username, &bufCharCount))
|
||||
{
|
||||
AZ_Error("System",false,"GetUserName filed with code %d",GetLastError());
|
||||
}
|
||||
|
||||
Sha1 hash;
|
||||
AZ::u32 digest[5] = { 0 };
|
||||
hash.ProcessBytes(machineInfo, _tcslen(machineInfo) * sizeof(TCHAR));
|
||||
hash.ProcessBytes(machineInfo, wcslen(machineInfo) * sizeof(TCHAR));
|
||||
hash.GetDigest(digest);
|
||||
s_machineId = digest[0];
|
||||
if (s_machineId == 0)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -15,7 +16,11 @@ namespace AZ::Utils
|
||||
{
|
||||
void NativeErrorMessageBox(const char* title, const char* message)
|
||||
{
|
||||
::MessageBox(0, message, title, MB_OK | MB_ICONERROR);
|
||||
AZStd::wstring wtitle;
|
||||
AZStd::to_wstring(wtitle, title);
|
||||
AZStd::wstring wmessage;
|
||||
AZStd::to_wstring(wmessage, message);
|
||||
::MessageBoxW(0, wmessage.c_str(), wtitle.c_str(), MB_OK | MB_ICONERROR);
|
||||
}
|
||||
|
||||
AZ::IO::FixedMaxPathString GetHomeDirectory()
|
||||
|
||||
+13
-9
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/std/parallel/thread.h>
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
|
||||
#include <process.h>
|
||||
|
||||
@@ -37,17 +38,20 @@ namespace AZStd
|
||||
// SetThreadDescription was added in 1607 (aka RS1). Since we can't guarantee the user is running 1607 or later, we need to ask for the function from the kernel.
|
||||
using SetThreadDescriptionFunc = HRESULT(WINAPI*)(_In_ HANDLE hThread, _In_ PCWSTR lpThreadDescription);
|
||||
|
||||
auto setThreadDescription = reinterpret_cast<SetThreadDescriptionFunc>(::GetProcAddress(::GetModuleHandle("Kernel32.dll"), "SetThreadDescription"));
|
||||
if (setThreadDescription)
|
||||
HMODULE kernel32Handle = ::GetModuleHandleW(L"Kernel32.dll");
|
||||
if (kernel32Handle)
|
||||
{
|
||||
// Convert the thread name to Unicode
|
||||
wchar_t threadNameW[MAX_PATH];
|
||||
size_t numCharsConverted;
|
||||
errno_t wcharResult = mbstowcs_s(&numCharsConverted, threadNameW, threadName, AZ_ARRAY_SIZE(threadNameW) - 1);
|
||||
if (wcharResult == 0)
|
||||
SetThreadDescriptionFunc setThreadDescription = reinterpret_cast<SetThreadDescriptionFunc>(::GetProcAddress(kernel32Handle, "SetThreadDescription"));
|
||||
if (setThreadDescription)
|
||||
{
|
||||
setThreadDescription(hThread, threadNameW);
|
||||
return true;
|
||||
// Convert the thread name to Unicode
|
||||
AZStd::wstring threadNameW;
|
||||
AZStd::to_wstring(threadNameW, threadName);
|
||||
if (!threadNameW.empty())
|
||||
{
|
||||
setThreadDescription(hThread, threadNameW.c_str());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2051,10 +2051,11 @@ namespace UnitTest
|
||||
|
||||
TEST_F(SmartPtr, IntrusivePtr_DynamicCast)
|
||||
{
|
||||
|
||||
AZStd::intrusive_ptr<RefCountedClass> basePointer = new RefCountedSubclass;
|
||||
|
||||
AZStd::intrusive_ptr<RefCountedSubclass> correctCast = dynamic_pointer_cast<RefCountedSubclass>(basePointer);
|
||||
AZStd::intrusive_ptr<RefCountedSubclassB> wrongCast = dynamic_pointer_cast<RefCountedSubclassB>(basePointer);
|
||||
AZStd::intrusive_ptr<RefCountedSubclass> correctCast = azdynamic_cast<RefCountedSubclass *>(basePointer);
|
||||
AZStd::intrusive_ptr<RefCountedSubclassB> wrongCast = azdynamic_cast<RefCountedSubclassB *>(basePointer);
|
||||
|
||||
EXPECT_TRUE(correctCast.get() == basePointer.get());
|
||||
EXPECT_TRUE(wrongCast.get() == nullptr);
|
||||
|
||||
@@ -628,10 +628,6 @@ namespace UnitTest
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(AZ_COMPILER_MSVC)
|
||||
# pragma warning(push)
|
||||
# pragma warning( disable: 4428 ) // universal-character-name encountered in source
|
||||
#endif // AZ_COMPILER_MSVC
|
||||
TEST_F(String, Algorithms)
|
||||
{
|
||||
string str = string::format("%s %d", "BlaBla", 5);
|
||||
@@ -678,6 +674,7 @@ namespace UnitTest
|
||||
string str1;
|
||||
to_string(str1, wstr);
|
||||
AZ_TEST_ASSERT(str1 == "BlaBla 5");
|
||||
EXPECT_EQ(8, to_string_length(wstr));
|
||||
|
||||
str1 = string::format("%ls", wstr.c_str());
|
||||
AZ_TEST_ASSERT(str1 == "BlaBla 5");
|
||||
@@ -690,6 +687,32 @@ namespace UnitTest
|
||||
wstr1 = wstring::format(L"%hs", str.c_str());
|
||||
AZ_TEST_ASSERT(wstr1 == L"BLABLA 5");
|
||||
|
||||
// wstring to char buffer
|
||||
char strBuffer[9];
|
||||
to_string(strBuffer, 9, wstr1.c_str());
|
||||
AZ_TEST_ASSERT(0 == azstricmp(strBuffer, "BLABLA 5"));
|
||||
EXPECT_EQ(8, to_string_length(wstr1));
|
||||
|
||||
// wstring to char with unicode
|
||||
wstring ws1InfinityEscaped = L"Infinity: \u221E"; // escaped
|
||||
EXPECT_EQ(13, to_string_length(ws1InfinityEscaped));
|
||||
|
||||
// wchar_t buffer to char buffer
|
||||
wchar_t wstrBuffer[9] = L"BLABLA 5";
|
||||
memset(strBuffer, 0, AZ_ARRAY_SIZE(strBuffer));
|
||||
to_string(strBuffer, 9, wstrBuffer);
|
||||
AZ_TEST_ASSERT(0 == azstricmp(strBuffer, "BLABLA 5"));
|
||||
|
||||
// string to wchar_t buffer
|
||||
memset(wstrBuffer, 0, AZ_ARRAY_SIZE(wstrBuffer));
|
||||
to_wstring(wstrBuffer, 9, str1.c_str());
|
||||
AZ_TEST_ASSERT(0 == azwcsicmp(wstrBuffer, L"BlaBla 5"));
|
||||
|
||||
// char buffer to wchar_t buffer
|
||||
memset(wstrBuffer, L' ', AZ_ARRAY_SIZE(wstrBuffer)); // to check that the null terminator is properly placed
|
||||
to_wstring(wstrBuffer, 9, strBuffer);
|
||||
AZ_TEST_ASSERT(0 == azwcsicmp(wstrBuffer, L"BLABLA 5"));
|
||||
|
||||
// wchar UTF16/UTF32 to/from Utf8
|
||||
wstr1 = L"this is a \u20AC \u00A3 test"; // that's a euro and a pound sterling
|
||||
AZStd::to_string(str, wstr1);
|
||||
@@ -1114,11 +1137,6 @@ namespace UnitTest
|
||||
EXPECT_FALSE(other2.Valid());
|
||||
}
|
||||
|
||||
// StringAlgorithmTest-End
|
||||
#if defined(AZ_COMPILER_MSVC)
|
||||
# pragma warning(pop)
|
||||
#endif // AZ_COMPILER_MSVC
|
||||
|
||||
TEST_F(String, ConstString)
|
||||
{
|
||||
string_view cstr1;
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace UnitTest
|
||||
int isFoundModule = 0;
|
||||
char expectedNameBuffer[AZ_ARRAY_SIZE(SymbolStorage::ModuleInfo::m_modName)];
|
||||
#if defined(AZCORETEST_DLL_NAME)
|
||||
azstrncpy(expectedNameBuffer, AZCORETEST_DLL_NAME, AZ_ARRAY_SIZE(expectedNameBuffer));
|
||||
azstrncpy(expectedNameBuffer, AZ_ARRAY_SIZE(expectedNameBuffer), AZCORETEST_DLL_NAME, AZ_ARRAY_SIZE(expectedNameBuffer));
|
||||
#else
|
||||
azstrncpy(expectedNameBuffer, "azcoretests.dll", AZ_ARRAY_SIZE(expectedNameBuffer));
|
||||
#endif
|
||||
@@ -65,7 +65,7 @@ namespace UnitTest
|
||||
for (u32 i = 0; i < SymbolStorage::GetNumLoadedModules(); ++i)
|
||||
{
|
||||
char nameBuffer[AZ_ARRAY_SIZE(SymbolStorage::ModuleInfo::m_modName)];
|
||||
azstrncpy(nameBuffer, SymbolStorage::GetModuleInfo(i)->m_fileName, AZ_ARRAY_SIZE(nameBuffer));
|
||||
azstrncpy(nameBuffer, AZ_ARRAY_SIZE(nameBuffer), SymbolStorage::GetModuleInfo(i)->m_fileName, AZ_ARRAY_SIZE(nameBuffer));
|
||||
AZStd::to_lower(nameBuffer, nameBuffer + AZ_ARRAY_SIZE(nameBuffer));
|
||||
|
||||
if (strstr(nameBuffer, expectedNameBuffer))
|
||||
|
||||
@@ -240,6 +240,37 @@ namespace UnitTest
|
||||
static_assert(!AZStd::is_copy_assignable_v<AZ::Event<int32_t>>, "AZ Events should not be copy assignable");
|
||||
}
|
||||
|
||||
TEST_F(EventTests, TestClaimHandlers_TakesAllSourceHandlers)
|
||||
{
|
||||
AZ::Event<> testEvent1;
|
||||
AZ::Event<> testEvent2;
|
||||
|
||||
int32_t handlerInvokeCount{};
|
||||
auto handlerCallback = [&handlerInvokeCount]()
|
||||
{
|
||||
++handlerInvokeCount;
|
||||
};
|
||||
AZ::Event<>::Handler testHandler1(handlerCallback);
|
||||
AZ::Event<>::Handler testHandler2(handlerCallback);
|
||||
|
||||
testHandler1.Connect(testEvent1);
|
||||
testHandler2.Connect(testEvent2);
|
||||
|
||||
EXPECT_TRUE(testEvent1.HasHandlerConnected());
|
||||
EXPECT_TRUE(testEvent2.HasHandlerConnected());
|
||||
|
||||
testEvent1.ClaimHandlers(AZStd::move(testEvent2));
|
||||
EXPECT_TRUE(testEvent1.HasHandlerConnected());
|
||||
EXPECT_FALSE(testEvent2.HasHandlerConnected());
|
||||
|
||||
// testEvent1 should have both handlers
|
||||
testEvent1.Signal();
|
||||
EXPECT_EQ(2, handlerInvokeCount);
|
||||
// testEvent2 should have neither of the handlers
|
||||
testEvent2.Signal();
|
||||
EXPECT_EQ(2, handlerInvokeCount);
|
||||
}
|
||||
|
||||
TEST_F(EventTests, HandlerMoveAssignment_ProperlyDisconnectsFromOldEvent)
|
||||
{
|
||||
AZ::Event<> testEvent1;
|
||||
|
||||
@@ -418,7 +418,7 @@ namespace UnitTest
|
||||
|
||||
// Check each operator/= and append overload for success
|
||||
{
|
||||
AZStd::fixed_string<AZ::IO::MaxPathLength> pathString{ "foo" };
|
||||
AZ::IO::FixedMaxPathString pathString{ "foo" };
|
||||
AZ::IO::FixedMaxPath testPath('/');
|
||||
testPath /= AZ::IO::PathView(pathString);
|
||||
testPath /= pathString;
|
||||
@@ -428,7 +428,7 @@ namespace UnitTest
|
||||
EXPECT_STREQ("foo/foo/foo/foo/f", testPath.c_str());
|
||||
}
|
||||
{
|
||||
AZStd::fixed_string<AZ::IO::MaxPathLength> pathString{ "foo" };
|
||||
AZ::IO::FixedMaxPathString pathString{ "foo" };
|
||||
AZ::IO::FixedMaxPath testPath('/');
|
||||
testPath.Append(AZ::IO::PathView(pathString));
|
||||
testPath.Append(pathString);
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace AZ::IO::ArchiveInternal
|
||||
}
|
||||
return convertedPath;
|
||||
}
|
||||
return AZStd::make_optional<AZStd::fixed_string<AZ::IO::MaxPathLength>>(sourcePath);
|
||||
return AZStd::make_optional<AZ::IO::FixedMaxPathString>(sourcePath);
|
||||
}
|
||||
|
||||
struct CCachedFileRawData
|
||||
@@ -614,7 +614,7 @@ namespace AZ::IO
|
||||
|
||||
const char* Archive::AdjustFileName(AZStd::string_view src, char* dst, size_t dstSize, uint32_t, bool)
|
||||
{
|
||||
AZStd::fixed_string<AZ::IO::MaxPathLength> srcPath{ src };
|
||||
AZ::IO::FixedMaxPathString srcPath{ src };
|
||||
return AZ::IO::FileIOBase::GetDirectInstance()->ResolvePath(srcPath.c_str(), dst, dstSize) ? dst : nullptr;
|
||||
}
|
||||
|
||||
@@ -2407,14 +2407,14 @@ namespace AZ::IO
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool Archive::RemoveFile(AZStd::string_view pName)
|
||||
{
|
||||
AZStd::fixed_string<AZ::IO::MaxPathLength> szFullPath{ pName };
|
||||
AZ::IO::FixedMaxPathString szFullPath{ pName };
|
||||
return AZ::IO::FileIOBase::GetDirectInstance()->Remove(szFullPath.c_str()) == AZ::IO::ResultCode::Success;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool Archive::RemoveDir(AZStd::string_view pName)
|
||||
{
|
||||
AZStd::fixed_string<AZ::IO::MaxPathLength> szFullPath{ pName };
|
||||
AZ::IO::FixedMaxPathString szFullPath{ pName };
|
||||
|
||||
if (AZ::IO::FileIOBase::GetDirectInstance()->IsDirectory(szFullPath.c_str()))
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <AzCore/EBus/Event.h>
|
||||
#include <AzCore/IO/FileIO.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/std/containers/map.h>
|
||||
#include <AzCore/std/smart_ptr/intrusive_base.h>
|
||||
#include <AzCore/std/smart_ptr/intrusive_ptr.h>
|
||||
@@ -30,7 +31,7 @@ namespace AZ::IO
|
||||
struct INestedArchive;
|
||||
struct IArchive;
|
||||
|
||||
using PathString = AZStd::fixed_string<AZ::IO::MaxPathLength>;
|
||||
using PathString = AZ::IO::FixedMaxPathString;
|
||||
using StackString = AZStd::fixed_string<512>;
|
||||
|
||||
struct MemoryBlock;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace AZ::IO
|
||||
return ZipDir::ZD_ERROR_INVALID_CALL;
|
||||
}
|
||||
|
||||
AZStd::fixed_string<AZ::IO::MaxPathLength> fullPath = AdjustPath(szRelativePath);
|
||||
AZ::IO::FixedMaxPathString fullPath = AdjustPath(szRelativePath);
|
||||
if (fullPath.empty())
|
||||
{
|
||||
return ZipDir::ZD_ERROR_INVALID_PATH;
|
||||
@@ -63,7 +63,7 @@ namespace AZ::IO
|
||||
return ZipDir::ZD_ERROR_INVALID_CALL;
|
||||
}
|
||||
|
||||
AZStd::fixed_string<AZ::IO::MaxPathLength> fullPath = AdjustPath(szRelativePath);
|
||||
AZ::IO::FixedMaxPathString fullPath = AdjustPath(szRelativePath);
|
||||
if (fullPath.empty())
|
||||
{
|
||||
return ZipDir::ZD_ERROR_INVALID_PATH;
|
||||
@@ -81,7 +81,7 @@ namespace AZ::IO
|
||||
return ZipDir::ZD_ERROR_INVALID_CALL;
|
||||
}
|
||||
|
||||
AZStd::fixed_string<AZ::IO::MaxPathLength> fullPath = AdjustPath(szRelativePath);
|
||||
AZ::IO::FixedMaxPathString fullPath = AdjustPath(szRelativePath);
|
||||
if (fullPath.empty())
|
||||
{
|
||||
return ZipDir::ZD_ERROR_INVALID_PATH;
|
||||
@@ -105,7 +105,7 @@ namespace AZ::IO
|
||||
return ZipDir::ZD_ERROR_INVALID_CALL;
|
||||
}
|
||||
|
||||
AZStd::fixed_string<AZ::IO::MaxPathLength> fullPath = AdjustPath(szRelativePath);
|
||||
AZ::IO::FixedMaxPathString fullPath = AdjustPath(szRelativePath);
|
||||
if (fullPath.empty())
|
||||
{
|
||||
return ZipDir::ZD_ERROR_INVALID_PATH;
|
||||
@@ -122,7 +122,7 @@ namespace AZ::IO
|
||||
return ZipDir::ZD_ERROR_INVALID_CALL;
|
||||
}
|
||||
|
||||
AZStd::fixed_string<AZ::IO::MaxPathLength> fullPath = AdjustPath(szRelativePath);
|
||||
AZ::IO::FixedMaxPathString fullPath = AdjustPath(szRelativePath);
|
||||
if (fullPath.empty())
|
||||
{
|
||||
return ZipDir::ZD_ERROR_INVALID_PATH;
|
||||
@@ -141,7 +141,7 @@ namespace AZ::IO
|
||||
return ZipDir::ZD_ERROR_INVALID_CALL;
|
||||
}
|
||||
|
||||
AZStd::fixed_string<AZ::IO::MaxPathLength> fullPath = AdjustPath(szRelativePath);
|
||||
AZ::IO::FixedMaxPathString fullPath = AdjustPath(szRelativePath);
|
||||
if (fullPath.empty())
|
||||
{
|
||||
return ZipDir::ZD_ERROR_INVALID_PATH;
|
||||
@@ -152,7 +152,7 @@ namespace AZ::IO
|
||||
// finds the file; you don't have to close the returned handle
|
||||
auto NestedArchive::FindFile(AZStd::string_view szRelativePath) -> Handle
|
||||
{
|
||||
AZStd::fixed_string<AZ::IO::MaxPathLength> fullPath = AdjustPath(szRelativePath);
|
||||
AZ::IO::FixedMaxPathString fullPath = AdjustPath(szRelativePath);
|
||||
if (fullPath.empty())
|
||||
{
|
||||
return nullptr;
|
||||
@@ -249,7 +249,7 @@ namespace AZ::IO
|
||||
|
||||
if (m_nFlags & FLAGS_RELATIVE_PATHS_ONLY)
|
||||
{
|
||||
return AZStd::fixed_string<AZ::IO::MaxPathLength>{ szRelativePath };
|
||||
return AZ::IO::FixedMaxPathString{ szRelativePath };
|
||||
}
|
||||
|
||||
if ((szRelativePath.size() > 1 && szRelativePath[1] == ':') || (m_nFlags & FLAGS_ABSOLUTE_PATHS))
|
||||
|
||||
@@ -440,7 +440,7 @@ namespace AZ::IO::ZipDir
|
||||
azstrcpy(volume, AZ_ARRAY_SIZE(volume), filename);
|
||||
}
|
||||
|
||||
AZStd::fixed_string<AZ::IO::MaxPathLength> drive{ AZ::IO::PathView(volume).RootName().Native() };
|
||||
AZ::IO::FixedMaxPathString drive{ AZ::IO::PathView(volume).RootName().Native() };
|
||||
if (drive.empty())
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzFramework/Asset/SimpleAsset.h>
|
||||
|
||||
namespace AzFramework
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace AzFramework
|
||||
AZStd::array<char, MaxMessageSize> buffer;
|
||||
azsnprintf(buffer.data(), buffer.size(), "(%p/%#" PRIxPTR "): %s\n", this, numericThreadId, msg.data());
|
||||
|
||||
Platform::DebugOutput(buffer.data());
|
||||
AZ::Debug::Platform::OutputToDebugger("AssetProcessorConnection", buffer.data());
|
||||
#else // ASSETPROCESORCONNECTION_VERBOSE_LOGGING is not defined
|
||||
(void)format;
|
||||
#endif
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/std/containers/array.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/std/containers/array.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <AzCore/Math/Aabb.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
#include <AzCore/Math/Uuid.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/std/hash.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
class SerializeContext;
|
||||
} // namespace AZ
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
//! Represents the camera state populated by the viewport camera.
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -10,6 +10,17 @@
|
||||
|
||||
#include <AzCore/Console/IConsole.h>
|
||||
|
||||
void OnVsyncIntervalChanged(uint32_t const& interval)
|
||||
{
|
||||
AzFramework::WindowNotificationBus::Broadcast(
|
||||
&AzFramework::WindowNotificationBus::Events::OnVsyncIntervalChanged, AZ::GetClamp(interval, 0u, 4u));
|
||||
}
|
||||
|
||||
// NOTE: On change, broadcasts the new requested vsync interval to all windows.
|
||||
// The value of the vsync interval is constrained between 0 and 4
|
||||
// Vsync intervals greater than 1 are not currently supported on the Vulkan RHI (see #2061 for discussion)
|
||||
AZ_CVAR(uint32_t, vsync_interval, 1, OnVsyncIntervalChanged, AZ::ConsoleFunctorFlags::Null, "Set swapchain vsync interval");
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -122,6 +133,16 @@ namespace AzFramework
|
||||
return m_pimpl->GetDpiScaleFactor();
|
||||
}
|
||||
|
||||
uint32_t NativeWindow::GetDisplayRefreshRate() const
|
||||
{
|
||||
return m_pimpl->GetDisplayRefreshRate();
|
||||
}
|
||||
|
||||
uint32_t NativeWindow::GetSyncInterval() const
|
||||
{
|
||||
return vsync_interval;
|
||||
}
|
||||
|
||||
/*static*/ bool NativeWindow::GetFullScreenStateOfDefaultWindow()
|
||||
{
|
||||
NativeWindowHandle defaultWindowHandle = nullptr;
|
||||
@@ -240,4 +261,10 @@ namespace AzFramework
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
uint32_t NativeWindow::Implementation::GetDisplayRefreshRate() const
|
||||
{
|
||||
// Default to 60
|
||||
return 60;
|
||||
}
|
||||
|
||||
} // namespace AzFramework
|
||||
|
||||
@@ -130,6 +130,8 @@ namespace AzFramework
|
||||
bool CanToggleFullScreenState() const override;
|
||||
void ToggleFullScreenState() override;
|
||||
float GetDpiScaleFactor() const override;
|
||||
uint32_t GetSyncInterval() const override;
|
||||
uint32_t GetDisplayRefreshRate() const override;
|
||||
|
||||
//! Get the full screen state of the default window.
|
||||
//! \return True if the default window is currently in full screen, false otherwise.
|
||||
@@ -172,6 +174,7 @@ namespace AzFramework
|
||||
virtual void SetFullScreenState(bool fullScreenState);
|
||||
virtual bool CanToggleFullScreenState() const;
|
||||
virtual float GetDpiScaleFactor() const;
|
||||
virtual uint32_t GetDisplayRefreshRate() const;
|
||||
|
||||
protected:
|
||||
uint32_t m_width = 0;
|
||||
|
||||
@@ -74,6 +74,12 @@ namespace AzFramework
|
||||
//! to a "standard" value of 96, the default for Windows in a DPI unaware setting. This can
|
||||
//! be used to scale user interface elements to ensure legibility on high density displays.
|
||||
virtual float GetDpiScaleFactor() const = 0;
|
||||
|
||||
//! Returns the sync interval which tells the drivers the number of v-blanks to synchronize with
|
||||
virtual uint32_t GetSyncInterval() const = 0;
|
||||
|
||||
//! Returns the refresh rate of the main display
|
||||
virtual uint32_t GetDisplayRefreshRate() const = 0;
|
||||
};
|
||||
using WindowRequestBus = AZ::EBus<WindowRequests>;
|
||||
|
||||
@@ -101,6 +107,9 @@ namespace AzFramework
|
||||
|
||||
//! This is called when vsync interval is changed.
|
||||
virtual void OnVsyncIntervalChanged(uint32_t interval) { AZ_UNUSED(interval); };
|
||||
|
||||
//! This is called if the main display's refresh rate changes
|
||||
virtual void OnRefreshRateChanged([[maybe_unused]] uint32_t refreshRate) {}
|
||||
};
|
||||
using WindowNotificationBus = AZ::EBus<WindowNotifications>;
|
||||
|
||||
|
||||
+6
-1
@@ -25,7 +25,7 @@ namespace AzFramework
|
||||
const WindowGeometry& geometry,
|
||||
const WindowStyleMasks& styleMasks) override;
|
||||
NativeWindowHandle GetWindowHandle() const override;
|
||||
|
||||
uint32_t GetDisplayRefreshRate() const override;
|
||||
private:
|
||||
ANativeWindow* m_nativeWindow = nullptr;
|
||||
};
|
||||
@@ -55,4 +55,9 @@ namespace AzFramework
|
||||
return reinterpret_cast<NativeWindowHandle>(m_nativeWindow);
|
||||
}
|
||||
|
||||
uint32_t NativeWindowImpl_Android::GetDisplayRefreshRate() const
|
||||
{
|
||||
// Using 60 for now until proper support is added
|
||||
return 60;
|
||||
}
|
||||
} // namespace AzFramework
|
||||
|
||||
@@ -14,7 +14,6 @@ set(FILES
|
||||
AzFramework/Application/Application_Android.cpp
|
||||
../Common/Unimplemented/AzFramework/Asset/AssetSystemComponentHelper_Unimplemented.cpp
|
||||
AzFramework/IO/LocalFileIO_Android.cpp
|
||||
../Common/Default/AzFramework/Network/AssetProcessorConnection_Default.cpp
|
||||
../Common/Unimplemented/AzFramework/StreamingInstall/StreamingInstall_Unimplemented.cpp
|
||||
../Common/Default/AzFramework/TargetManagement/TargetManagementComponent_Default.cpp
|
||||
AzFramework/Windowing/NativeWindow_Android.cpp
|
||||
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
namespace AssetSystem
|
||||
{
|
||||
namespace Platform
|
||||
{
|
||||
void DebugOutput(const char* message)
|
||||
{
|
||||
fputs("AssetProcessorConnection:", stdout);
|
||||
fputs(message, stdout);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
-8
@@ -9,6 +9,7 @@
|
||||
#include <AzFramework/IO/LocalFileIO.h>
|
||||
#include <AzCore/IO/SystemFile.h>
|
||||
#include <AzCore/std/functional.h>
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
@@ -19,7 +20,9 @@ namespace AZ
|
||||
char resolvedPath[AZ_MAX_PATH_LEN];
|
||||
ResolvePath(filePath, resolvedPath, AZ_MAX_PATH_LEN);
|
||||
|
||||
DWORD fileAttributes = GetFileAttributesA(resolvedPath);
|
||||
wchar_t resolvedPathW[AZ_MAX_PATH_LEN];
|
||||
AZStd::to_wstring(resolvedPathW, AZ_MAX_PATH_LEN, resolvedPath);
|
||||
DWORD fileAttributes = GetFileAttributesW(resolvedPathW);
|
||||
if (fileAttributes == INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
return false;
|
||||
@@ -33,7 +36,7 @@ namespace AZ
|
||||
char resolvedPath[AZ_MAX_PATH_LEN];
|
||||
ResolvePath(filePath, resolvedPath, AZ_MAX_PATH_LEN);
|
||||
|
||||
AZ::OSString searchPattern;
|
||||
AZStd::string searchPattern;
|
||||
if ((resolvedPath[0] == 0) || (resolvedPath[1] == 0))
|
||||
{
|
||||
return ResultCode::Error; // not a valid path.
|
||||
@@ -54,7 +57,9 @@ namespace AZ
|
||||
searchPattern += "\\*.*"; // use our own filtering function!
|
||||
|
||||
WIN32_FIND_DATA findData;
|
||||
HANDLE hFind = FindFirstFile(searchPattern.c_str(), &findData);
|
||||
AZStd::wstring searchPatternW;
|
||||
AZStd::to_wstring(searchPatternW, searchPattern.c_str());
|
||||
HANDLE hFind = FindFirstFileW(searchPatternW.c_str(), &findData);
|
||||
|
||||
if (hFind != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
@@ -63,15 +68,17 @@ namespace AZ
|
||||
char tempBuffer[AZ_MAX_PATH_LEN];
|
||||
do
|
||||
{
|
||||
AZStd::string_view filenameView = findData.cFileName;
|
||||
AZStd::string fileName;
|
||||
AZStd::to_string(fileName, findData.cFileName);
|
||||
AZStd::string_view filenameView = fileName;
|
||||
// Skip over the current directory and parent directory paths to prevent infinite recursion
|
||||
if (filenameView == "." || filenameView == ".." || !NameMatchesFilter(findData.cFileName, filter))
|
||||
if (filenameView == "." || filenameView == ".." || !NameMatchesFilter(fileName.c_str(), filter))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
AZ::OSString foundFilePath = CheckForTrailingSlash(resolvedPath);
|
||||
foundFilePath += findData.cFileName;
|
||||
AZStd::string foundFilePath = CheckForTrailingSlash(resolvedPath);
|
||||
foundFilePath += fileName;
|
||||
AZStd::replace(foundFilePath.begin(), foundFilePath.end(), '\\', '/');
|
||||
|
||||
// if aliased, de-alias!
|
||||
@@ -169,7 +176,7 @@ namespace AZ
|
||||
|
||||
bool LocalFileIO::IsAbsolutePath(const char* path) const
|
||||
{
|
||||
char drive[16];
|
||||
char drive[16] = { 0 };
|
||||
_splitpath_s(path, drive, 16, nullptr, 0, nullptr, 0, nullptr, 0);
|
||||
return strlen(drive) > 0;
|
||||
}
|
||||
|
||||
+2
-2
@@ -59,7 +59,7 @@ namespace AzFramework
|
||||
{
|
||||
// Convert the valid UTF-16 surrogate pair to a UTF-8 code point
|
||||
const wchar_t codePointUTF16[2] = { m_leadSurrogate, codeUnitUTF16 };
|
||||
AZStd::to_string(codePointUTF8, codePointUTF16, 2);
|
||||
AZStd::to_string(codePointUTF8, { codePointUTF16, 2 });
|
||||
m_leadSurrogate = 0;
|
||||
}
|
||||
else
|
||||
@@ -72,7 +72,7 @@ namespace AzFramework
|
||||
{
|
||||
// Convert the standalone UTF-16 code point to a UTF-8 code point
|
||||
const wchar_t codePointUTF16[1] = { codeUnitUTF16 };
|
||||
AZStd::to_string(codePointUTF8, codePointUTF16, 1);
|
||||
AZStd::to_string(codePointUTF8, { codePointUTF16, 1 });
|
||||
m_leadSurrogate = 0;
|
||||
}
|
||||
|
||||
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/base.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
namespace AssetSystem
|
||||
{
|
||||
namespace Platform
|
||||
{
|
||||
void DebugOutput(const char* message)
|
||||
{
|
||||
OutputDebugString("AssetProcessorConnection:");
|
||||
OutputDebugString(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ namespace AzFramework
|
||||
const WindowGeometry& geometry,
|
||||
const WindowStyleMasks& styleMasks) override;
|
||||
NativeWindowHandle GetWindowHandle() const override;
|
||||
uint32_t GetDisplayRefreshRate() const override;
|
||||
};
|
||||
|
||||
NativeWindow::Implementation* NativeWindow::Implementation::Create()
|
||||
@@ -44,4 +45,9 @@ namespace AzFramework
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t NativeWindowImpl_Linux::GetDisplayRefreshRate() const
|
||||
{
|
||||
//Using 60 for now until proper support is added
|
||||
return 60;
|
||||
}
|
||||
} // namespace AzFramework
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user