Minor code fixes in order to compile on windows

This commit is contained in:
Vladyslav Baranovskyi
2024-05-23 23:58:45 +03:00
parent 1c56eb3c7b
commit 29108cab21
6 changed files with 34 additions and 25 deletions

View File

@@ -160,11 +160,11 @@ namespace OpenVulkano::AR
{
if (!m_colorWriter)
{
m_colorWriter = std::make_unique<MultiPartArchiveWriter>(m_settings.path, "color_{:05d}.tar", ArchiveConfig::TAR, m_settings.archiveSize, true);
m_depthWriter = std::make_unique<MultiPartArchiveWriter>(m_settings.path, "depth_{:05d}.tar", ArchiveConfig::TAR, m_settings.archiveSize, true);
m_confidenceWriter = std::make_unique<MultiPartArchiveWriter>(m_settings.path, "confidence_{:05d}.tar.gz", ArchiveConfig::TAR_GZ, m_settings.archiveSize, true);
m_metadataWriter = std::make_unique<MultiPartArchiveWriter>(m_settings.path, "meta_{:05d}.tar.gz", ArchiveConfig::TAR_GZ, m_settings.archiveSize, true);
m_highResWriter = std::make_unique<MultiPartArchiveWriter>(m_settings.path, "highres_{:05d}.tar", ArchiveConfig::TAR, m_settings.archiveSize, true);
m_colorWriter = std::make_unique<MultiPartArchiveWriter>(m_settings.path.string(), "color_{:05d}.tar", ArchiveConfig::TAR, m_settings.archiveSize, true);
m_depthWriter = std::make_unique<MultiPartArchiveWriter>(m_settings.path.string(), "depth_{:05d}.tar", ArchiveConfig::TAR, m_settings.archiveSize, true);
m_confidenceWriter = std::make_unique<MultiPartArchiveWriter>(m_settings.path.string(), "confidence_{:05d}.tar.gz", ArchiveConfig::TAR_GZ, m_settings.archiveSize, true);
m_metadataWriter = std::make_unique<MultiPartArchiveWriter>(m_settings.path.string(), "meta_{:05d}.tar.gz", ArchiveConfig::TAR_GZ, m_settings.archiveSize, true);
m_highResWriter = std::make_unique<MultiPartArchiveWriter>(m_settings.path.string(), "highres_{:05d}.tar", ArchiveConfig::TAR, m_settings.archiveSize, true);
std::ofstream platformInfoStream(m_settings.path / RECORDING_METADATA_FILENAME);
platformInfoStream << m_session->GetSessionMetadata().ToXML();

View File

@@ -50,7 +50,7 @@ namespace OpenVulkano
{
if (numberStr.empty()) return 0;
int tmp = 0;
std::from_chars(numberStr.begin(), numberStr.end(), tmp);
std::from_chars(numberStr.data(), numberStr.data() + numberStr.size(), tmp);
return tmp;
}

View File

@@ -6,6 +6,7 @@
#include "Data/Containers/Array.hpp"
#include <memory>
#include <string>
namespace OpenVulkano
{

View File

@@ -13,6 +13,10 @@
#include <Winsock.h>
#include <Winbase.h>
// NOTE(vb): Windows defines macros like GetUserName that are used to automatically select the appropriate function version (GetUserNameA for ANSI and GetUserNameW for Unicode)
// based on whether the _UNICODE macro is defined, so we manually undefine these macros to avoid naming collisions.
#undef GetUserName
namespace OpenVulkano
{
namespace
@@ -44,7 +48,7 @@ namespace OpenVulkano
{
switch(type)
{
case APP_MEM_TYPE::VM_MAX return counters.PeakWorkingSetSize;
case APP_MEM_TYPE::VM_MAX: return counters.PeakWorkingSetSize;
case APP_MEM_TYPE::USED: return counters.PrivateUsage;
}
}
@@ -55,12 +59,12 @@ namespace OpenVulkano
size_t SystemInfo::GetSystemRam()
{
return ReadSystemMemInfo(MEM_TYPE::TOTAL_PHYS);
return ReadSystemMemInfo(SYS_MEM_TYPE::TOTAL_PHYS);
}
size_t SystemInfo::GetSystemRamAvailable()
{
return ReadSystemMemInfo(MEM_TYPE::AVAIL_PHYS);
return ReadSystemMemInfo(SYS_MEM_TYPE::AVAIL_PHYS);
}
size_t SystemInfo::GetAppRamMax()
@@ -87,7 +91,7 @@ namespace OpenVulkano
{
char username[UNLEN+1];
DWORD username_len = UNLEN+1;
GetUserName(username, &username_len);
::GetUserNameA(username, &username_len);
return username;
}
@@ -121,21 +125,21 @@ namespace OpenVulkano
return "Windows";
}
Version SystemInfo::GetOsVersion()
OsVersion SystemInfo::GetOsVersion()
{
OSVERSIONINFOEX info;
ZeroMemory(&info, sizeof(OSVERSIONINFOEX));
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
GetVersionEx(&info);
return { info.dwMajorVersion, info.dwMinorVersion, 0, info.dwBuildNumber };
OSVERSIONINFOA info;
ZeroMemory(&info, sizeof(OSVERSIONINFOA));
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
GetVersionExA(&info);
return { (int)info.dwMajorVersion, (int)info.dwMinorVersion, 0, (int)info.dwBuildNumber };
}
std::string SystemInfo::GetOsNameHumanReadable()
{
OSVERSIONINFOEX info;
ZeroMemory(&info, sizeof(OSVERSIONINFOEX));
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
GetVersionEx(&info);
OSVERSIONINFOEXA info;
ZeroMemory(&info, sizeof(OSVERSIONINFOEXA));
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
GetVersionEx((OSVERSIONINFOA *)&info);
if (info.wProductType == VER_NT_WORKSTATION)
{
if (info.dwMajorVersion == 10)
@@ -151,7 +155,7 @@ namespace OpenVulkano
}
}
return "Windows " + std::string(info.dwMajorVersion) + "." + std::string(info.dwMinorVersion);
return "Windows " + std::to_string(info.dwMajorVersion) + "." + std::to_string(info.dwMinorVersion);
}
else
{
@@ -168,7 +172,7 @@ namespace OpenVulkano
}
}
return "Windows Server " + std::string(info.dwMajorVersion) + "." + std::string(info.dwMinorVersion);
return "Windows Server " + std::to_string(info.dwMajorVersion) + "." + std::to_string(info.dwMinorVersion);
}
}

View File

@@ -50,7 +50,7 @@ namespace OpenVulkano
CloseHandle(fileHandle);
return;
}
size = fileSize;
size = fileSize.QuadPart;
fileMappingHandle = CreateFileMapping(
fileHandle,
@@ -85,7 +85,7 @@ namespace OpenVulkano
~Internal()
{
UnmapViewOfFile(lpMapAddress);
UnmapViewOfFile(address);
CloseHandle(fileMappingHandle);
CloseHandle(fileHandle);
}
@@ -120,7 +120,7 @@ namespace OpenVulkano
MemMappedFile::MemMappedFile(const std::filesystem::path& path, FileMode fileMode)
{
m_internal = std::make_shared<Internal>(path.c_str(), fileMode);
m_internal = std::make_shared<Internal>(path.string().c_str(), fileMode);
m_data = m_internal->address;
m_size = (m_data) ? m_internal->size : 0;
}

View File

@@ -11,6 +11,10 @@
#include <memory>
#include <vector>
#ifdef _WIN32
# undef TRANSPARENT
#endif
namespace OpenVulkano::Scene
{
class Node;