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
@@ -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