fixes for Android
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
@@ -31,7 +31,6 @@ namespace AZ
|
||||
static const char* FileType = "JsonSerialization";
|
||||
static const char* VersionTag = "Version";
|
||||
static const char* ClassNameTag = "ClassName";
|
||||
static const char* ClassIdTag = "ClassId";
|
||||
static const char* ClassDataTag = "ClassData";
|
||||
|
||||
AZ::Outcome<void, AZStd::string> WriteJsonString(const rapidjson::Document& document, AZStd::string& jsonText, WriteJsonSettings settings)
|
||||
|
||||
@@ -867,7 +867,6 @@ namespace AZ
|
||||
const FloatType cols0 = {{ rows[0].v[0], rows[1].v[0], rows[2].v[0], 0.0f }};
|
||||
const FloatType cols1 = {{ rows[0].v[1], rows[1].v[1], rows[2].v[1], 0.0f }};
|
||||
const FloatType cols2 = {{ rows[0].v[2], rows[1].v[2], rows[2].v[2], 0.0f }};
|
||||
const FloatType cols3 = {{ rows[0].v[3], rows[1].v[3], rows[2].v[3], 1.0f }};
|
||||
out[0] = cols0;
|
||||
out[1] = cols1;
|
||||
out[2] = cols2;
|
||||
|
||||
@@ -632,6 +632,9 @@ namespace AzFramework
|
||||
|
||||
static void CreateUserCache(const AZ::IO::FixedMaxPath& cacheUserPath, AZ::IO::FileIOBase& fileIoBase)
|
||||
{
|
||||
constexpr const char* userCachePathFilename{ "Cache" };
|
||||
AZ::IO::FixedMaxPath userCachePath = cacheUserPath / userCachePathFilename;
|
||||
#if AZ_TRAIT_OS_IS_HOST_OS_PLATFORM
|
||||
// The number of max attempts ultimately dictates the number of Lumberyard instances that can run
|
||||
// simultaneously. This should be a reasonably high number so that it doesn't artificially limit
|
||||
// the number of instances (ex: parallel level exports via multiple Editor runs). It also shouldn't
|
||||
@@ -640,9 +643,6 @@ namespace AzFramework
|
||||
// 128 seems like a reasonable compromise.
|
||||
constexpr int maxAttempts = 128;
|
||||
|
||||
constexpr const char* userCachePathFilename{ "Cache" };
|
||||
AZ::IO::FixedMaxPath userCachePath = cacheUserPath / userCachePathFilename;
|
||||
#if AZ_TRAIT_OS_IS_HOST_OS_PLATFORM
|
||||
int attemptNumber;
|
||||
for (attemptNumber = 0; attemptNumber < maxAttempts; ++attemptNumber)
|
||||
{
|
||||
|
||||
@@ -92,7 +92,7 @@ using DetachEnvironmentFunction = void(*)();
|
||||
#define HMODULE void*
|
||||
static const char* gEnvName("MODULE_PATH");
|
||||
|
||||
static const char* GetModulePath()
|
||||
inline const char* GetModulePath()
|
||||
{
|
||||
return getenv(gEnvName);
|
||||
}
|
||||
@@ -107,8 +107,6 @@ inline void SetModulePath(const char* pModulePath)
|
||||
inline HMODULE CryLoadLibrary(const char* libName, bool bLazy = false, bool bInModulePath = true)
|
||||
{
|
||||
const char* libPath = nullptr;
|
||||
char pathBuffer[MAX_PATH] = {0};
|
||||
|
||||
libPath = libName;
|
||||
|
||||
#if !defined(AZ_PLATFORM_ANDROID)
|
||||
@@ -135,6 +133,7 @@ inline HMODULE CryLoadLibrary(const char* libName, bool bLazy = false, bool bInM
|
||||
}
|
||||
#endif
|
||||
}
|
||||
char pathBuffer[MAX_PATH] = {0};
|
||||
sprintf_s(pathBuffer, "%s/%s", modulePath, libName);
|
||||
libPath = pathBuffer;
|
||||
}
|
||||
|
||||
@@ -829,7 +829,7 @@ const int comparePathNames(const char* cpFirst, const char* cpSecond, unsigned i
|
||||
return memicmp(first.c_str(), second.c_str(), length);
|
||||
}
|
||||
|
||||
#if defined(LINUX) || defined(APPLE) || defined(DEFINE_FIX_ONE_PATH_ELEMENT)
|
||||
#if (defined(LINUX) || defined(APPLE)) && defined(DEFINE_FIX_ONE_PATH_ELEMENT)
|
||||
static bool FixOnePathElement(char* path)
|
||||
{
|
||||
if (*path == '\0')
|
||||
|
||||
@@ -164,60 +164,6 @@ SSystemCVars g_cvars;
|
||||
#include <AzCore/Component/ComponentApplication.h>
|
||||
#include "AZCoreLogSink.h"
|
||||
|
||||
#if defined(ANDROID)
|
||||
namespace
|
||||
{
|
||||
struct Callstack
|
||||
{
|
||||
Callstack()
|
||||
: addrs(NULL)
|
||||
, ignore(0)
|
||||
, count(0)
|
||||
{
|
||||
}
|
||||
Callstack(void** addrs, size_t ignore, size_t count)
|
||||
{
|
||||
this->addrs = addrs;
|
||||
this->ignore = ignore;
|
||||
this->count = count;
|
||||
}
|
||||
void** addrs;
|
||||
size_t ignore;
|
||||
size_t count;
|
||||
};
|
||||
|
||||
static _Unwind_Reason_Code trace_func(struct _Unwind_Context* context, void* arg)
|
||||
{
|
||||
Callstack* cs = static_cast<Callstack*>(arg);
|
||||
if (cs->count)
|
||||
{
|
||||
void* ip = (void*) _Unwind_GetIP(context);
|
||||
if (ip)
|
||||
{
|
||||
if (cs->ignore)
|
||||
{
|
||||
cs->ignore--;
|
||||
}
|
||||
else
|
||||
{
|
||||
cs->addrs[0] = ip;
|
||||
cs->addrs++;
|
||||
cs->count--;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _URC_NO_REASON;
|
||||
}
|
||||
|
||||
static int Backtrace(void** addrs, size_t ignore, size_t size)
|
||||
{
|
||||
Callstack cs(addrs, ignore, size);
|
||||
_Unwind_Backtrace(trace_func, (void*) &cs);
|
||||
return size - cs.count;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// System Implementation.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user