fxies for AzFramework

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-07-30 17:33:50 -07:00
parent c5dcef180c
commit 63445e107a
12 changed files with 36 additions and 75 deletions
@@ -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
@@ -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
@@ -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);
}
}
}
}
@@ -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
{
@@ -33,7 +34,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 +55,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 +66,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!
@@ -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);
}
}
}
}
@@ -17,7 +17,6 @@ set(FILES
AzFramework/Process/ProcessCommon.h
AzFramework/Process/ProcessCommunicator_Linux.cpp
../Common/UnixLike/AzFramework/IO/LocalFileIO_UnixLike.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_Linux.cpp
@@ -17,7 +17,6 @@ set(FILES
AzFramework/Process/ProcessCommon.h
AzFramework/Process/ProcessCommunicator_Mac.cpp
../Common/UnixLike/AzFramework/IO/LocalFileIO_UnixLike.cpp
../Common/Default/AzFramework/Network/AssetProcessorConnection_Default.cpp
../Common/Unimplemented/AzFramework/StreamingInstall/StreamingInstall_Unimplemented.cpp
AzFramework/TargetManagement/TargetManagementComponent_Mac.cpp
AzFramework/Windowing/NativeWindow_Mac.mm
@@ -48,10 +48,10 @@ namespace AzFramework::AssetSystem::Platform
// Get the first module, because that will be the executable
if (EnumProcessModules(processHandle, &moduleHandle, sizeof(moduleHandle), &bytesNeededForAllProcessModules))
{
char processName[4096] = TEXT("<unknown>");
if (GetModuleBaseNameA(processHandle, moduleHandle, processName, AZ_ARRAY_SIZE(processName)) > 0)
wchar_t processName[4096] = L"<unknown>";
if (GetModuleBaseName(processHandle, moduleHandle, processName, AZ_ARRAY_SIZE(processName)) > 0)
{
if (azstricmp(processName, "AssetProcessor") == 0)
if (azwcsicmp(processName, L"AssetProcessor") == 0)
{
AllowSetForegroundWindow(processId);
}
@@ -126,7 +126,11 @@ namespace AzFramework::AssetSystem::Platform
si.wShowWindow = SW_MINIMIZE;
PROCESS_INFORMATION pi;
bool createResult = ::CreateProcessA(nullptr, fullLaunchCommand.data(), nullptr, nullptr, FALSE, 0, nullptr, AZ::IO::FixedMaxPathString{ executableDirectory }.c_str(), &si, &pi) != 0;
AZStd::wstring fullLaunchCommandW;
AZStd::to_wstring(fullLaunchCommandW, fullLaunchCommand.c_str());
AZStd::wstring execututableDirectoryW;
AZStd::to_wstring(execututableDirectoryW, executableDirectory.data());
bool createResult = ::CreateProcessW(nullptr, fullLaunchCommandW.data(), nullptr, nullptr, FALSE, 0, nullptr, execututableDirectoryW.c_str(), &si, &pi) != 0;
if (ap_tether_lifetime && apJob && createResult)
{
@@ -10,6 +10,7 @@
#include <AzCore/IO/SystemFile.h>
#include <AzCore/PlatformIncl.h>
#include <AzCore/Utils/Utils.h>
#include <AzCore/std/string/conversions.h>
namespace AzFramework
{
@@ -35,12 +36,12 @@ namespace AzFramework
AZStd::string GetNeighborhoodName()
{
AZStd::string neighborhoodName;
char localhost[MAX_COMPUTERNAME_LENGTH + 1];
wchar_t localhost[MAX_COMPUTERNAME_LENGTH + 1];
DWORD len = AZ_ARRAY_SIZE(localhost);
if (GetComputerName(localhost, &len))
if (GetComputerNameW(localhost, &len))
{
neighborhoodName = localhost;
AZStd::to_string(neighborhoodName, localhost);
}
return neighborhoodName;
@@ -11,6 +11,7 @@
#include <AzCore/Module/DynamicModuleHandle.h>
#include <AzCore/PlatformIncl.h>
#include <AzCore/std/string/conversions.h>
namespace AzFramework
{
@@ -41,7 +42,7 @@ namespace AzFramework
static DWORD ConvertToWin32WindowStyleMask(const WindowStyleMasks& styleMasks);
static LRESULT CALLBACK WindowCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static const char* s_defaultClassName;
static const wchar_t* s_defaultClassName;
void WindowSizeChanged(const uint32_t width, const uint32_t height);
@@ -57,7 +58,7 @@ namespace AzFramework
GetDpiForWindowType* m_getDpiFunction = nullptr;
};
const char* NativeWindowImpl_Win32::s_defaultClassName = "O3DEWin32Class";
const wchar_t* NativeWindowImpl_Win32::s_defaultClassName = L"O3DEWin32Class";
NativeWindow::Implementation* NativeWindow::Implementation::Create()
{
@@ -88,7 +89,7 @@ namespace AzFramework
// register window class if it does not exist
WNDCLASSEX windowClass;
if (GetClassInfoEx(hInstance, s_defaultClassName, &windowClass) == false)
if (GetClassInfoExW(hInstance, s_defaultClassName, &windowClass) == false)
{
windowClass.cbSize = sizeof(WNDCLASSEX);
windowClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
@@ -127,8 +128,10 @@ namespace AzFramework
m_height = geometry.m_height;
// create main window
m_win32Handle = CreateWindow(
s_defaultClassName, title.c_str(),
AZStd::wstring titleW;
AZStd::to_wstring(titleW, title);
m_win32Handle = CreateWindowW(
s_defaultClassName, titleW.c_str(),
windowStyle,
geometry.m_posX, geometry.m_posY, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top,
NULL, NULL, hInstance, NULL);
@@ -175,7 +178,9 @@ namespace AzFramework
void NativeWindowImpl_Win32::SetWindowTitle(const AZStd::string& title)
{
SetWindowText(m_win32Handle, title.c_str());
AZStd::wstring titleW;
AZStd::to_wstring(titleW, title);
SetWindowTextW(m_win32Handle, titleW.c_str());
}
DWORD NativeWindowImpl_Win32::ConvertToWin32WindowStyleMask(const WindowStyleMasks& styleMasks)
@@ -18,7 +18,6 @@ set(FILES
AzFramework/Process/ProcessCommunicator_Win.cpp
../Common/WinAPI/AzFramework/IO/LocalFileIO_WinAPI.cpp
AzFramework/IO/LocalFileIO_Windows.cpp
../Common/WinAPI/AzFramework/Network/AssetProcessorConnection_WinAPI.cpp
../Common/Unimplemented/AzFramework/StreamingInstall/StreamingInstall_Unimplemented.cpp
AzFramework/TargetManagement/TargetManagementComponent_Windows.cpp
AzFramework/Windowing/NativeWindow_Windows.cpp
@@ -14,7 +14,6 @@ set(FILES
AzFramework/Application/Application_iOS.mm
../Common/Unimplemented/AzFramework/Asset/AssetSystemComponentHelper_Unimplemented.cpp
../Common/UnixLike/AzFramework/IO/LocalFileIO_UnixLike.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_ios.mm