publish changes

This commit is contained in:
Archie 2024-09-29 02:04:03 +00:00
parent afc5064a7b
commit ac2c6ac843
1605 changed files with 3354 additions and 3354 deletions

View file

@ -10,7 +10,7 @@
#include <type_traits>
#if MPT_COMPILER_MSVC && MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#endif // MPT_COMPILER_MSVC && MPT_OS_WINDOWS

View file

@ -10,13 +10,13 @@
#ifndef UNICODE
#ifndef MPT_CHECK_WINDOWS_IGNORE_WARNING_NO_UNICODE
MPT_WARNING("windows.h uses MBCS TCHAR. Please #define UNICODE.")
MPT_WARNING("arch.h uses MBCS TCHAR. Please #define UNICODE.")
#endif
#endif
#ifndef NOMINMAX
#ifndef MPT_CHECK_WINDOWS_IGNORE_WARNING_NO_NOMINMAX
MPT_WARNING("windows.h defines min and max which conflicts with C++. Please #define NOMINMAX.")
MPT_WARNING("arch.h defines min and max which conflicts with C++. Please #define NOMINMAX.")
#endif
#endif

View file

@ -14,7 +14,7 @@
#include <string>
#if MPT_OS_WINDOWS
#include <windows.h> // must be before wincrypt.h for clang-cl
#include <arch.h> // must be before wincrypt.h for clang-cl
#include <wincrypt.h> // must be before ncrypt.h
#include <ncrypt.h>
#endif // MPT_OS_WINDOWS

View file

@ -19,7 +19,7 @@
#include <cstddef>
#if MPT_OS_WINDOWS
#include <windows.h> // must be before wincrypt.h for clang-cl
#include <arch.h> // must be before wincrypt.h for clang-cl
#include <bcrypt.h>
#endif // MPT_OS_WINDOWS

View file

@ -31,7 +31,7 @@
#include <cstring>
#if MPT_OS_WINDOWS
#include <windows.h> // must be before wincrypt.h for clang-cl
#include <arch.h> // must be before wincrypt.h for clang-cl
#include <bcrypt.h>
#include <wincrypt.h> // must be before ncrypt.h
#include <ncrypt.h>

View file

@ -20,7 +20,7 @@
#include <cstdlib>
#if MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#endif // MPT_OS_WINDOWS
@ -38,7 +38,7 @@ inline std::optional<mpt::ustring> getenv(const mpt::ustring & env_var) {
std::vector<WCHAR> buf(32767);
DWORD size = GetEnvironmentVariable(mpt::transcode<std::wstring>(env_var).c_str(), buf.data(), 32767);
if (size == 0) {
mpt::windows::ExpectError(ERROR_ENVVAR_NOT_FOUND);
mpt::arch::ExpectError(ERROR_ENVVAR_NOT_FOUND);
return std::nullopt;
}
return mpt::transcode<mpt::ustring>(buf.data());

View file

@ -22,7 +22,7 @@
#include <vector>
#if MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#elif MPT_OS_ANDROID
#elif defined(MPT_WITH_DL)
#include <dlfcn.h>

View file

@ -42,7 +42,7 @@
#endif
#endif
#elif MPT_MUTEX_WIN32
#include <windows.h>
#include <arch.h>
#endif // MPT_MUTEX

View file

@ -10,7 +10,7 @@
#include "mpt/base/namespace.hpp"
#if MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#endif // MPT_OS_WINDOWS
@ -22,7 +22,7 @@ inline namespace MPT_INLINE_NS {
namespace osinfo {
namespace windows {
namespace arch {
@ -111,7 +111,7 @@ public:
return Version();
}
constexpr Version(mpt::osinfo::windows::Version::System system, mpt::osinfo::windows::Version::ServicePack servicePack, mpt::osinfo::windows::Version::Build build, mpt::osinfo::windows::Version::TypeId type) noexcept
constexpr Version(mpt::osinfo::arch::Version::System system, mpt::osinfo::arch::Version::ServicePack servicePack, mpt::osinfo::arch::Version::Build build, mpt::osinfo::arch::Version::TypeId type) noexcept
: m_SystemIsWindows(true)
, m_System(system)
, m_ServicePack(servicePack)
@ -122,64 +122,64 @@ public:
public:
#if MPT_OS_WINDOWS
static mpt::osinfo::windows::Version FromSDK() noexcept {
static mpt::osinfo::arch::Version FromSDK() noexcept {
// Initialize to used SDK version
#if defined(NTDDI_VERSION)
#if NTDDI_VERSION >= 0x0A00000B // NTDDI_WIN10_CO Win11
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 22000, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 22000, 0);
#elif NTDDI_VERSION >= 0x0A00000A // NTDDI_WIN10_FE 21H2
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 19044, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 19044, 0);
//#elif // NTDDI_WIN10_FE 21H1
// return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 19043, 0);
// return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 19043, 0);
//#elif // NTDDI_WIN10_FE 20H2
// return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 19042, 0);
// return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 19042, 0);
#elif NTDDI_VERSION >= 0x0A000009 // NTDDI_WIN10_MN 2004/20H1
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 19041, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 19041, 0);
#elif NTDDI_VERSION >= 0x0A000008 // NTDDI_WIN10_VB 1909/19H2
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 18363, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 18363, 0);
#elif NTDDI_VERSION >= 0x0A000007 // NTDDI_WIN10_19H1 1903/19H1
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 18362, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 18362, 0);
#elif NTDDI_VERSION >= 0x0A000006 // NTDDI_WIN10_RS5 1809
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 17763, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 17763, 0);
#elif NTDDI_VERSION >= 0x0A000005 // NTDDI_WIN10_RS4 1803
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 17134, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 17134, 0);
#elif NTDDI_VERSION >= 0x0A000004 // NTDDI_WIN10_RS3 1709
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 16299, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 16299, 0);
#elif NTDDI_VERSION >= 0x0A000003 // NTDDI_WIN10_RS2 1703
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 15063, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 15063, 0);
#elif NTDDI_VERSION >= 0x0A000002 // NTDDI_WIN10_RS1 1607
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 14393, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 14393, 0);
#elif NTDDI_VERSION >= 0x0A000001 // NTDDI_WIN10_TH2 1511
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 10586, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 10586, 0);
#elif NTDDI_VERSION >= 0x0A000000 // NTDDI_WIN10 1507
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 10240, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 10240, 0);
#elif NTDDI_VERSION >= 0x06030000 // NTDDI_WINBLUE
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win81, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win81, mpt::osinfo::arch::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
#elif NTDDI_VERSION >= 0x06020000 // NTDDI_WIN8
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win8, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win8, mpt::osinfo::arch::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
#elif NTDDI_VERSION >= 0x06010000 // NTDDI_WIN7
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win7, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win7, mpt::osinfo::arch::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
#elif NTDDI_VERSION >= 0x06000000 // NTDDI_VISTA
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::WinVista, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::WinVista, mpt::osinfo::arch::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
#elif NTDDI_VERSION >= 0x05020000 // NTDDI_WS03
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::WinXP64, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::WinXP64, mpt::osinfo::arch::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
#elif NTDDI_VERSION >= NTDDI_WINXP
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::WinXP, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::WinXP, mpt::osinfo::arch::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
#elif NTDDI_VERSION >= NTDDI_WIN2K
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win2000, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win2000, mpt::osinfo::arch::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
#else
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::WinNT4, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::WinNT4, mpt::osinfo::arch::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
#endif
#elif defined(_WIN32_WINNT)
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::System((static_cast<uint64>(_WIN32_WINNT) & 0xff00u) >> 8, (static_cast<uint64>(_WIN32_WINNT) & 0x00ffu) >> 0), mpt::osinfo::windows::Version::ServicePack(0, 0), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::System((static_cast<uint64>(_WIN32_WINNT) & 0xff00u) >> 8, (static_cast<uint64>(_WIN32_WINNT) & 0x00ffu) >> 0), mpt::osinfo::arch::Version::ServicePack(0, 0), 0, 0);
#else
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::System(0, 0), mpt::osinfo::windows::Version::ServicePack(0, 0), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::System(0, 0), mpt::osinfo::arch::Version::ServicePack(0, 0), 0, 0);
#endif
}
static mpt::osinfo::windows::Version GatherWindowsVersion() noexcept {
static mpt::osinfo::arch::Version GatherWindowsVersion() noexcept {
#if MPT_OS_WINDOWS_WINRT
return mpt::osinfo::windows::Version::FromSDK();
return mpt::osinfo::arch::Version::FromSDK();
#else // !MPT_OS_WINDOWS_WINRT
OSVERSIONINFOEXW versioninfoex{};
versioninfoex.dwOSVersionInfoSize = sizeof(versioninfoex);
@ -193,7 +193,7 @@ public:
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif // MPT_COMPILER_CLANG
if (GetVersionExW((LPOSVERSIONINFOW)&versioninfoex) == FALSE) {
return mpt::osinfo::windows::Version::FromSDK();
return mpt::osinfo::arch::Version::FromSDK();
}
#if MPT_COMPILER_MSVC
#pragma warning(pop)
@ -202,7 +202,7 @@ public:
#pragma clang diagnostic pop
#endif // MPT_COMPILER_CLANG
if (versioninfoex.dwPlatformId != VER_PLATFORM_WIN32_NT) {
return mpt::osinfo::windows::Version::FromSDK();
return mpt::osinfo::arch::Version::FromSDK();
}
DWORD dwProductType = 0;
#if (_WIN32_WINNT >= 0x0600) // _WIN32_WINNT_VISTA
@ -211,9 +211,9 @@ public:
dwProductType = PRODUCT_UNDEFINED;
}
#endif
return mpt::osinfo::windows::Version(
mpt::osinfo::windows::Version::System(versioninfoex.dwMajorVersion, versioninfoex.dwMinorVersion),
mpt::osinfo::windows::Version::ServicePack(versioninfoex.wServicePackMajor, versioninfoex.wServicePackMinor),
return mpt::osinfo::arch::Version(
mpt::osinfo::arch::Version::System(versioninfoex.dwMajorVersion, versioninfoex.dwMinorVersion),
mpt::osinfo::arch::Version::ServicePack(versioninfoex.wServicePackMajor, versioninfoex.wServicePackMinor),
versioninfoex.dwBuildNumber,
dwProductType);
#endif // MPT_OS_WINDOWS_WINRT
@ -222,11 +222,11 @@ public:
#endif // MPT_OS_WINDOWS
public:
static mpt::osinfo::windows::Version Current() noexcept {
static mpt::osinfo::arch::Version Current() noexcept {
#if MPT_OS_WINDOWS
return GatherWindowsVersion();
#else // !MPT_OS_WINDOWS
return mpt::osinfo::windows::Version::NoWindows();
return mpt::osinfo::arch::Version::NoWindows();
#endif // MPT_OS_WINDOWS
}
@ -235,14 +235,14 @@ public:
return m_SystemIsWindows;
}
bool IsBefore(mpt::osinfo::windows::Version::System version) const noexcept {
bool IsBefore(mpt::osinfo::arch::Version::System version) const noexcept {
if (!m_SystemIsWindows) {
return false;
}
return m_System < version;
}
bool IsBefore(mpt::osinfo::windows::Version::System version, mpt::osinfo::windows::Version::ServicePack servicePack) const noexcept {
bool IsBefore(mpt::osinfo::arch::Version::System version, mpt::osinfo::arch::Version::ServicePack servicePack) const noexcept {
if (!m_SystemIsWindows) {
return false;
}
@ -255,7 +255,7 @@ public:
return m_ServicePack < servicePack;
}
bool IsBefore(mpt::osinfo::windows::Version::System version, mpt::osinfo::windows::Version::Build build) const noexcept {
bool IsBefore(mpt::osinfo::arch::Version::System version, mpt::osinfo::arch::Version::Build build) const noexcept {
if (!m_SystemIsWindows) {
return false;
}
@ -268,7 +268,7 @@ public:
return m_Build < build;
}
bool IsBefore(mpt::osinfo::windows::Version::System version, mpt::osinfo::windows::Version::ServicePack servicePack, mpt::osinfo::windows::Version::Build build) const noexcept {
bool IsBefore(mpt::osinfo::arch::Version::System version, mpt::osinfo::arch::Version::ServicePack servicePack, mpt::osinfo::arch::Version::Build build) const noexcept {
if (!m_SystemIsWindows) {
return false;
}
@ -287,18 +287,18 @@ public:
return m_Build < build;
}
bool IsBefore(mpt::osinfo::windows::Version version) const noexcept {
bool IsBefore(mpt::osinfo::arch::Version version) const noexcept {
return IsBefore(version.GetSystem(), version.GetServicePack(), version.GetBuild());
}
bool IsAtLeast(mpt::osinfo::windows::Version::System version) const noexcept {
bool IsAtLeast(mpt::osinfo::arch::Version::System version) const noexcept {
if (!m_SystemIsWindows) {
return false;
}
return m_System >= version;
}
bool IsAtLeast(mpt::osinfo::windows::Version::System version, mpt::osinfo::windows::Version::ServicePack servicePack) const noexcept {
bool IsAtLeast(mpt::osinfo::arch::Version::System version, mpt::osinfo::arch::Version::ServicePack servicePack) const noexcept {
if (!m_SystemIsWindows) {
return false;
}
@ -311,7 +311,7 @@ public:
return m_ServicePack >= servicePack;
}
bool IsAtLeast(mpt::osinfo::windows::Version::System version, mpt::osinfo::windows::Version::Build build) const noexcept {
bool IsAtLeast(mpt::osinfo::arch::Version::System version, mpt::osinfo::arch::Version::Build build) const noexcept {
if (!m_SystemIsWindows) {
return false;
}
@ -324,7 +324,7 @@ public:
return m_Build >= build;
}
bool IsAtLeast(mpt::osinfo::windows::Version::System version, mpt::osinfo::windows::Version::ServicePack servicePack, mpt::osinfo::windows::Version::Build build) const noexcept {
bool IsAtLeast(mpt::osinfo::arch::Version::System version, mpt::osinfo::arch::Version::ServicePack servicePack, mpt::osinfo::arch::Version::Build build) const noexcept {
if (!m_SystemIsWindows) {
return false;
}
@ -343,23 +343,23 @@ public:
return m_Build >= build;
}
bool IsAtLeast(mpt::osinfo::windows::Version version) const noexcept {
bool IsAtLeast(mpt::osinfo::arch::Version version) const noexcept {
return IsAtLeast(version.GetSystem(), version.GetServicePack(), version.GetBuild());
}
mpt::osinfo::windows::Version::System GetSystem() const noexcept {
mpt::osinfo::arch::Version::System GetSystem() const noexcept {
return m_System;
}
mpt::osinfo::windows::Version::ServicePack GetServicePack() const noexcept {
mpt::osinfo::arch::Version::ServicePack GetServicePack() const noexcept {
return m_ServicePack;
}
mpt::osinfo::windows::Version::Build GetBuild() const noexcept {
mpt::osinfo::arch::Version::Build GetBuild() const noexcept {
return m_Build;
}
mpt::osinfo::windows::Version::TypeId GetTypeId() const noexcept {
mpt::osinfo::arch::Version::TypeId GetTypeId() const noexcept {
return m_Type;
}
@ -394,8 +394,8 @@ public:
}
private:
static mpt::osinfo::windows::wine::version FromInteger(uint32 version) {
mpt::osinfo::windows::wine::version result;
static mpt::osinfo::arch::wine::version FromInteger(uint32 version) {
mpt::osinfo::arch::wine::version result;
result.valid = (version <= 0xffffff);
result.vmajor = static_cast<uint8>(version >> 16);
result.vminor = static_cast<uint8>(version >> 8);
@ -411,13 +411,13 @@ private:
}
public:
bool IsBefore(mpt::osinfo::windows::wine::version other) const {
bool IsBefore(mpt::osinfo::arch::wine::version other) const {
if (!IsValid()) {
return false;
}
return (AsInteger() < other.AsInteger());
}
bool IsAtLeast(mpt::osinfo::windows::wine::version other) const {
bool IsAtLeast(mpt::osinfo::arch::wine::version other) const {
if (!IsValid()) {
return false;
}
@ -438,7 +438,7 @@ public:
} // namespace windows
} // namespace arch
} // namespace osinfo

View file

@ -15,7 +15,7 @@
#include <utility>
#if MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#endif // MPT_OS_WINDOWS

View file

@ -160,28 +160,28 @@ inline StringBufRefImpl<typename std::basic_string<typename std::remove_const<Tc
#if MPT_OS_WINDOWS
template <typename Tchar, std::size_t size>
inline StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type> ReadWinBuf(const std::array<Tchar, size> & buf) {
return StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type>(buf.data(), size);
inline StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type> ReadWinBuf(const std::array<Tchar, size> & buf) {
return StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type>(buf.data(), size);
}
template <typename Tchar, std::size_t size>
inline StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type> ReadWinBuf(const Tchar (&buf)[size]) {
return StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type>(buf, size);
inline StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type> ReadWinBuf(const Tchar (&buf)[size]) {
return StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type>(buf, size);
}
template <typename Tchar>
inline StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type> ReadWinBuf(const Tchar * buf, std::size_t size) {
return StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type>(buf, size);
inline StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type> ReadWinBuf(const Tchar * buf, std::size_t size) {
return StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type>(buf, size);
}
template <typename Tchar, std::size_t size>
inline StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar> WriteWinBuf(std::array<Tchar, size> & buf) {
return StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar>(buf.data(), size);
inline StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar> WriteWinBuf(std::array<Tchar, size> & buf) {
return StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar>(buf.data(), size);
}
template <typename Tchar, std::size_t size>
inline StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar> WriteWinBuf(Tchar (&buf)[size]) {
return StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar>(buf, size);
inline StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar> WriteWinBuf(Tchar (&buf)[size]) {
return StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar>(buf, size);
}
template <typename Tchar>
inline StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar> WriteWinBuf(Tchar * buf, std::size_t size) {
return StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar>(buf, size);
inline StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar> WriteWinBuf(Tchar * buf, std::size_t size) {
return StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar>(buf, size);
}
#endif // MPT_OS_WINDOWS

View file

@ -17,7 +17,7 @@
#include <cstddef>
#if MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#endif // MPT_OS_WINDOWS
@ -34,7 +34,7 @@ enum class common_encoding {
iso8859_15,
cp850,
cp437,
windows1252,
arch1252,
amiga,
riscos,
iso8859_1_no_c1,
@ -44,7 +44,7 @@ enum class common_encoding {
enum class logical_encoding {
locale, // CP_ACP on windows, system configured C locale otherwise
locale, // CP_ACP on arch, system configured C locale otherwise
active_locale, // active C/C++ global locale
};
@ -204,13 +204,13 @@ using exception_string = std::basic_string<char, mpt::logical_encoding_char_trai
#if MPT_OS_WINDOWS
template <typename Tchar>
struct windows_char_traits { };
struct arch_char_traits { };
template <>
struct windows_char_traits<CHAR> { using string_type = mpt::lstring; };
struct arch_char_traits<CHAR> { using string_type = mpt::lstring; };
template <>
struct windows_char_traits<WCHAR> { using string_type = std::wstring; };
struct arch_char_traits<WCHAR> { using string_type = std::wstring; };
using tstring = windows_char_traits<TCHAR>::string_type;
using tstring = arch_char_traits<TCHAR>::string_type;
using winstring = mpt::tstring;

View file

@ -29,7 +29,7 @@
#endif // MPT_OS_DJGPP
#if MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#endif // MPT_OS_WINDOWS
#if MPT_OS_DJGPP
@ -538,7 +538,7 @@ inline bool has_codepage(UINT cp) {
return IsValidCodePage(cp) ? true : false;
}
inline bool windows_has_encoding(common_encoding encoding) {
inline bool arch_has_encoding(common_encoding encoding) {
bool result = false;
switch (encoding) {
case common_encoding::utf8:
@ -559,7 +559,7 @@ inline bool windows_has_encoding(common_encoding encoding) {
case common_encoding::cp437:
result = has_codepage(437);
break;
case common_encoding::windows1252:
case common_encoding::arch1252:
result = has_codepage(1252);
break;
case common_encoding::amiga:
@ -581,7 +581,7 @@ inline bool windows_has_encoding(common_encoding encoding) {
return result;
}
inline bool windows_has_encoding(logical_encoding encoding) {
inline bool arch_has_encoding(logical_encoding encoding) {
bool result = false;
switch (encoding) {
case logical_encoding::locale:
@ -628,7 +628,7 @@ inline UINT codepage_from_encoding(common_encoding encoding) {
case common_encoding::cp437:
result = 437;
break;
case common_encoding::windows1252:
case common_encoding::arch1252:
result = 1252;
break;
case common_encoding::amiga:
@ -923,7 +923,7 @@ inline Tdststring encode(common_encoding encoding, const mpt::widestring & src)
static_assert(sizeof(typename Tdststring::value_type) == sizeof(char));
static_assert(mpt::is_character<typename Tdststring::value_type>::value);
#if MPT_OS_WINDOWS
if (windows_has_encoding(encoding)) {
if (arch_has_encoding(encoding)) {
return encode_codepage<Tdststring>(codepage_from_encoding(encoding), src);
}
#endif
@ -946,7 +946,7 @@ inline Tdststring encode(common_encoding encoding, const mpt::widestring & src)
case common_encoding::cp850:
return encode_8bit<Tdststring>(src, CharsetTableCP850);
break;
case common_encoding::windows1252:
case common_encoding::arch1252:
return encode_8bit<Tdststring>(src, CharsetTableWindows1252);
break;
case common_encoding::amiga:
@ -973,7 +973,7 @@ inline Tdststring encode(logical_encoding encoding, const mpt::widestring & src)
static_assert(sizeof(typename Tdststring::value_type) == sizeof(char));
static_assert(mpt::is_character<typename Tdststring::value_type>::value);
#if MPT_OS_WINDOWS
if (windows_has_encoding(encoding)) {
if (arch_has_encoding(encoding)) {
return encode_codepage<Tdststring>(codepage_from_encoding(encoding), src);
}
#endif
@ -1032,7 +1032,7 @@ inline mpt::widestring decode(common_encoding encoding, const Tsrcstring & src)
static_assert(sizeof(typename Tsrcstring::value_type) == sizeof(char));
static_assert(mpt::is_character<typename Tsrcstring::value_type>::value);
#if MPT_OS_WINDOWS
if (windows_has_encoding(encoding)) {
if (arch_has_encoding(encoding)) {
return decode_codepage(codepage_from_encoding(encoding), src);
}
#endif
@ -1055,7 +1055,7 @@ inline mpt::widestring decode(common_encoding encoding, const Tsrcstring & src)
case common_encoding::cp850:
return decode_8bit(src, CharsetTableCP850);
break;
case common_encoding::windows1252:
case common_encoding::arch1252:
return decode_8bit(src, CharsetTableWindows1252);
break;
case common_encoding::amiga:
@ -1082,7 +1082,7 @@ inline mpt::widestring decode(logical_encoding encoding, const Tsrcstring & src)
static_assert(sizeof(typename Tsrcstring::value_type) == sizeof(char));
static_assert(mpt::is_character<typename Tsrcstring::value_type>::value);
#if MPT_OS_WINDOWS
if (windows_has_encoding(encoding)) {
if (arch_has_encoding(encoding)) {
return decode_codepage(codepage_from_encoding(encoding), src);
}
#endif

View file

@ -22,7 +22,7 @@
#endif // MPT_OS_WINDOWS
#if MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#endif // MPT_OS_WINDOWS
@ -36,7 +36,7 @@ inline namespace MPT_INLINE_NS {
namespace windows {
namespace arch {
@ -113,7 +113,7 @@ inline HANDLE CheckFileHANDLE(HANDLE handle) {
if ((err == ERROR_NOT_ENOUGH_MEMORY) || (err == ERROR_OUTOFMEMORY)) {
mpt::throw_out_of_memory();
}
throw windows::error(err);
throw arch::error(err);
}
return handle;
}
@ -125,7 +125,7 @@ inline HANDLE CheckHANDLE(HANDLE handle) {
if ((err == ERROR_NOT_ENOUGH_MEMORY) || (err == ERROR_OUTOFMEMORY)) {
mpt::throw_out_of_memory();
}
throw windows::error(err);
throw arch::error(err);
}
return handle;
}
@ -137,7 +137,7 @@ inline void CheckBOOL(BOOL result) {
if ((err == ERROR_NOT_ENOUGH_MEMORY) || (err == ERROR_OUTOFMEMORY)) {
mpt::throw_out_of_memory();
}
throw windows::error(err);
throw arch::error(err);
}
}
@ -148,13 +148,13 @@ inline void ExpectError(DWORD expected) {
if ((err == ERROR_NOT_ENOUGH_MEMORY) || (err == ERROR_OUTOFMEMORY)) {
mpt::throw_out_of_memory();
}
throw windows::error(err);
throw arch::error(err);
}
}
} // namespace windows
} // namespace arch

View file

@ -37,7 +37,7 @@ inline namespace MPT_INLINE_NS {
// COM CLSID<->string conversion
// A CLSID string is not necessarily a standard UUID string,
// it might also be a symbolic name for the interface.
// (see CLSIDFromString ( http://msdn.microsoft.com/en-us/library/windows/desktop/ms680589%28v=vs.85%29.aspx ))
// (see CLSIDFromString ( http://msdn.microsoft.com/en-us/library/arch/desktop/ms680589%28v=vs.85%29.aspx ))
inline mpt::winstring CLSIDToString(CLSID clsid) {
std::wstring str;

View file

@ -12,7 +12,7 @@
#include "mpt/base/detect.hpp"
#include "mpt/base/saturate_round.hpp"
#include "mpt/osinfo/class.hpp"
#include "mpt/osinfo/windows_version.hpp"
#include "mpt/osinfo/arch_version.hpp"
#include "mpt/string/types.hpp"
#include "openmpt/base/FlagSet.hpp"
#include "openmpt/base/Types.hpp"
@ -28,7 +28,7 @@
#include <cstdint>
#if MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#endif // MPT_OS_WINDOWS
#if defined(MODPLUG_TRACKER)
@ -308,10 +308,10 @@ struct SysInfo
{
public:
mpt::osinfo::osclass SystemClass = mpt::osinfo::osclass::Unknown;
mpt::osinfo::windows::Version WindowsVersion = mpt::osinfo::windows::Version::NoWindows();
mpt::osinfo::arch::Version WindowsVersion = mpt::osinfo::arch::Version::NoWindows();
bool IsWine = false;
mpt::osinfo::osclass WineHostClass = mpt::osinfo::osclass::Unknown;
mpt::osinfo::windows::wine::version WineVersion;
mpt::osinfo::arch::wine::version WineVersion;
public:
bool IsOriginal() const { return !IsWine; }
@ -326,15 +326,15 @@ public:
assert(SystemClass != mpt::osinfo::osclass::Windows);
return;
}
SysInfo(mpt::osinfo::osclass systemClass, mpt::osinfo::windows::Version windowsVersion)
SysInfo(mpt::osinfo::osclass systemClass, mpt::osinfo::arch::Version archVersion)
: SystemClass(systemClass)
, WindowsVersion(windowsVersion)
, WindowsVersion(archVersion)
{
return;
}
SysInfo(mpt::osinfo::osclass systemClass, mpt::osinfo::windows::Version windowsVersion, bool isWine, mpt::osinfo::osclass wineHostClass, mpt::osinfo::windows::wine::version wineVersion)
SysInfo(mpt::osinfo::osclass systemClass, mpt::osinfo::arch::Version archVersion, bool isWine, mpt::osinfo::osclass wineHostClass, mpt::osinfo::arch::wine::version wineVersion)
: SystemClass(systemClass)
, WindowsVersion(windowsVersion)
, WindowsVersion(archVersion)
, IsWine(isWine)
, WineHostClass(wineHostClass)
, WineVersion(wineVersion)
@ -461,7 +461,7 @@ struct Flags
// wide audio engine. It does not happen for exclusive mode WASAPI streams
// or direct WaveRT (labeled WDM-KS in PortAudio) streams. As there is no
// known way to disable this annoying behavior, avoid unclipped samples on
// affected windows versions and clip them ourselves before handing them to
// affected arch versions and clip them ourselves before handing them to
// the APIs.
bool WantsClippedOutput;
Flags()

View file

@ -27,7 +27,7 @@
#include <vector>
#if MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#endif // MPT_OS_WINDOWS
@ -86,10 +86,10 @@ static BOOL WINAPI DSEnumCallback(GUID *lpGuid, LPCTSTR lpstrDescription, LPCTST
info.useNameAsIdentifier = false;
// clang-format off
info.flags = {
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsOriginal() && sysInfo.WindowsVersion.IsBefore(mpt::osinfo::windows::Version::Win7) ? Info::Usability::Usable : Info::Usability::Deprecated : Info::Usability::NotAvailable,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsOriginal() && sysInfo.WindowsVersion.IsBefore(mpt::osinfo::arch::Version::Win7) ? Info::Usability::Usable : Info::Usability::Deprecated : Info::Usability::NotAvailable,
Info::Level::Primary,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows && sysInfo.IsWindowsWine() ? Info::Compatible::Yes : Info::Compatible::No,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsWine() ? Info::Api::Emulated : sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista) ? Info::Api::Emulated : Info::Api::Native : Info::Api::Emulated,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsWine() ? Info::Api::Emulated : sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista) ? Info::Api::Emulated : Info::Api::Native : Info::Api::Emulated,
Info::Io::OutputOnly,
Info::Mixing::Software,
Info::Implementor::OpenMPT
@ -143,7 +143,7 @@ SoundDevice::Caps CDSoundDevice::InternalGetDeviceCaps()
caps.HasNamedInputSources = false;
caps.CanDriverPanel = false;
caps.ExclusiveModeDescription = MPT_USTRING("Use primary buffer");
caps.DefaultSettings.sampleFormat = (GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista)) ? SampleFormat::Float32 : SampleFormat::Int16;
caps.DefaultSettings.sampleFormat = (GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista)) ? SampleFormat::Float32 : SampleFormat::Int16;
IDirectSound *dummy = nullptr;
IDirectSound *ds = nullptr;
if(m_piDS)
@ -220,7 +220,7 @@ SoundDevice::DynamicCaps CDSoundDevice::GetDeviceDynamicCaps(const std::vector<u
}
}
}
if(GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista))
if(GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista))
{
// Vista
caps.supportedSampleFormats = {SampleFormat::Float32};
@ -362,7 +362,7 @@ bool CDSoundDevice::InternalOpen()
}
m_dwWritePos = 0xFFFFFFFF;
SetWakeupInterval(std::min(m_Settings.UpdateInterval, m_nDSoundBufferSize / (2.0 * m_Settings.GetBytesPerSecond())));
m_Flags.WantsClippedOutput = (GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista));
m_Flags.WantsClippedOutput = (GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista));
return true;
}

View file

@ -250,12 +250,12 @@ void Manager::ReEnumerate(bool firstRun)
{ // Wine
typeDefault[SoundDevice::TypePORTAUDIO_WASAPI].value = Info::DefaultFor::System;
typeDefault[SoundDevice::TypeDSOUND].value = Info::DefaultFor::LowLevel;
} else if(GetSysInfo().SystemClass == mpt::osinfo::osclass::Windows && GetSysInfo().WindowsVersion.IsBefore(mpt::osinfo::windows::Version::WinVista))
} else if(GetSysInfo().SystemClass == mpt::osinfo::osclass::Windows && GetSysInfo().WindowsVersion.IsBefore(mpt::osinfo::arch::Version::WinVista))
{ // WinXP
typeDefault[SoundDevice::TypeWAVEOUT].value = Info::DefaultFor::System;
typeDefault[SoundDevice::TypeASIO].value = Info::DefaultFor::ProAudio;
typeDefault[SoundDevice::TypePORTAUDIO_WDMKS].value = Info::DefaultFor::LowLevel;
} else if(GetSysInfo().SystemClass == mpt::osinfo::osclass::Windows && GetSysInfo().WindowsVersion.IsBefore(mpt::osinfo::windows::Version::Win7))
} else if(GetSysInfo().SystemClass == mpt::osinfo::osclass::Windows && GetSysInfo().WindowsVersion.IsBefore(mpt::osinfo::arch::Version::Win7))
{ // Vista
typeDefault[SoundDevice::TypeWAVEOUT].value = Info::DefaultFor::System;
typeDefault[SoundDevice::TypeASIO].value = Info::DefaultFor::ProAudio;

View file

@ -33,7 +33,7 @@
#endif
#if MPT_OS_WINDOWS
#include <shellapi.h>
#include <windows.h>
#include <arch.h>
#endif
#endif
@ -189,10 +189,10 @@ bool CPortaudioDevice::InternalOpen()
framesPerBuffer = paFramesPerBufferUnspecified; // let portaudio choose
} else if(m_HostApiType == paMME)
{
m_Flags.WantsClippedOutput = (GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista));
m_Flags.WantsClippedOutput = (GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista));
} else if(m_HostApiType == paDirectSound)
{
m_Flags.WantsClippedOutput = (GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista));
m_Flags.WantsClippedOutput = (GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista));
} else
{
m_Flags.WantsClippedOutput = false;
@ -219,7 +219,7 @@ bool CPortaudioDevice::InternalOpen()
}
} else
{
if(!GetSysInfo().IsWine && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::Win7))
if(!GetSysInfo().IsWine && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::Win7))
{ // retry with automatic stream format conversion (i.e. resampling)
#if MPT_OS_WINDOWS
m_WasapiStreamInfo.flags |= paWinWasapiAutoConvert;
@ -452,7 +452,7 @@ SoundDevice::Caps CPortaudioDevice::InternalGetDeviceCaps()
caps.DefaultSettings.sampleFormat = SampleFormat::Int32;
} else if(m_HostApiType == paDirectSound)
{
if(GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista))
if(GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista))
{
caps.DefaultSettings.sampleFormat = SampleFormat::Float32;
} else
@ -464,7 +464,7 @@ SoundDevice::Caps CPortaudioDevice::InternalGetDeviceCaps()
if(GetSysInfo().IsWine)
{
caps.DefaultSettings.sampleFormat = SampleFormat::Int16;
} else if(GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista))
} else if(GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista))
{
caps.DefaultSettings.sampleFormat = SampleFormat::Float32;
} else
@ -477,13 +477,13 @@ SoundDevice::Caps CPortaudioDevice::InternalGetDeviceCaps()
}
if(m_HostApiType == paDirectSound)
{
if(GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista))
if(GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista))
{
caps.HasInternalDither = false;
}
} else if(m_HostApiType == paMME)
{
if(GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista))
if(GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista))
{
caps.HasInternalDither = false;
}
@ -529,13 +529,13 @@ SoundDevice::DynamicCaps CPortaudioDevice::GetDeviceDynamicCaps(const std::vecto
}
if(m_HostApiType == paDirectSound)
{
if(GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista))
if(GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista))
{
caps.supportedSampleFormats = {SampleFormat::Float32};
}
} else if(m_HostApiType == paMME)
{
if(GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista))
if(GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista))
{
caps.supportedSampleFormats = {SampleFormat::Float32};
}
@ -633,7 +633,7 @@ SoundDevice::DynamicCaps CPortaudioDevice::GetDeviceDynamicCaps(const std::vecto
}
#endif // MPT_OS_WINDOWS
#if MPT_OS_WINDOWS
if((m_HostApiType == paWASAPI) && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::Win7))
if((m_HostApiType == paWASAPI) && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::Win7))
{
caps.supportedSampleRates = baseSampleRates;
}
@ -660,7 +660,7 @@ bool CPortaudioDevice::OpenDriverSettings()
{
return false;
}
bool hasVista = GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista);
bool hasVista = GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista);
mpt::winstring controlEXE;
TCHAR systemDir[MAX_PATH] = {};
if(GetSystemDirectory(systemDir, mpt::saturate_cast<UINT>(std::size(systemDir))) > 0)
@ -808,10 +808,10 @@ std::vector<SoundDevice::Info> CPortaudioDevice::EnumerateDevices(ILogger &logge
result.apiName = MPT_USTRING("DirectSound");
result.default_ = ((Pa_GetHostApiInfo(Pa_GetDeviceInfo(dev)->hostApi)->defaultOutputDevice == static_cast<PaDeviceIndex>(dev)) ? Info::Default::Managed : Info::Default::None);
result.flags = {
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsOriginal() && sysInfo.WindowsVersion.IsBefore(mpt::osinfo::windows::Version::Win7) ? Info::Usability::Usable : Info::Usability::Deprecated : Info::Usability::NotAvailable,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsOriginal() && sysInfo.WindowsVersion.IsBefore(mpt::osinfo::arch::Version::Win7) ? Info::Usability::Usable : Info::Usability::Deprecated : Info::Usability::NotAvailable,
Info::Level::Secondary,
Info::Compatible::No,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsWine() ? Info::Api::Emulated : sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista) ? Info::Api::Emulated : Info::Api::Native : Info::Api::Emulated,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsWine() ? Info::Api::Emulated : sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista) ? Info::Api::Emulated : Info::Api::Native : Info::Api::Emulated,
Info::Io::FullDuplex,
Info::Mixing::Software,
Info::Implementor::External
@ -821,10 +821,10 @@ std::vector<SoundDevice::Info> CPortaudioDevice::EnumerateDevices(ILogger &logge
result.apiName = MPT_USTRING("MME");
result.default_ = ((Pa_GetHostApiInfo(Pa_GetDeviceInfo(dev)->hostApi)->defaultOutputDevice == static_cast<PaDeviceIndex>(dev)) ? Info::Default::Named : Info::Default::None);
result.flags = {
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsOriginal() && sysInfo.WindowsVersion.IsBefore(mpt::osinfo::windows::Version::Win7) ? Info::Usability::Usable : Info::Usability::Legacy : Info::Usability::NotAvailable,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsOriginal() && sysInfo.WindowsVersion.IsBefore(mpt::osinfo::arch::Version::Win7) ? Info::Usability::Usable : Info::Usability::Legacy : Info::Usability::NotAvailable,
Info::Level::Secondary,
Info::Compatible::No,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsWine() ? Info::Api::Emulated : sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista) ? Info::Api::Emulated : Info::Api::Native : Info::Api::Emulated,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsWine() ? Info::Api::Emulated : sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista) ? Info::Api::Emulated : Info::Api::Native : Info::Api::Emulated,
Info::Io::FullDuplex,
Info::Mixing::Software,
Info::Implementor::External
@ -889,20 +889,20 @@ std::vector<SoundDevice::Info> CPortaudioDevice::EnumerateDevices(ILogger &logge
Info::Usability::Usable,
Info::Level::Primary,
Info::Compatible::No,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows && sysInfo.IsWindowsOriginal() && sysInfo.WindowsVersion.IsBefore(mpt::osinfo::windows::Version::WinVista) ? Info::Api::Native : Info::Api::Emulated,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows && sysInfo.IsWindowsOriginal() && sysInfo.WindowsVersion.IsBefore(mpt::osinfo::arch::Version::WinVista) ? Info::Api::Native : Info::Api::Emulated,
Info::Io::FullDuplex,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows && sysInfo.IsWindowsOriginal() && sysInfo.WindowsVersion.IsBefore(mpt::osinfo::windows::Version::WinVista) ? Info::Mixing::Hardware : Info::Mixing::Software,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows && sysInfo.IsWindowsOriginal() && sysInfo.WindowsVersion.IsBefore(mpt::osinfo::arch::Version::WinVista) ? Info::Mixing::Hardware : Info::Mixing::Software,
Info::Implementor::External
};
break;
case paWDMKS:
result.apiName = sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista) ? MPT_USTRING("WaveRT") : MPT_USTRING("WDM-KS");
result.apiName = sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista) ? MPT_USTRING("WaveRT") : MPT_USTRING("WDM-KS");
result.default_ = ((Pa_GetHostApiInfo(Pa_GetDeviceInfo(dev)->hostApi)->defaultOutputDevice == static_cast<PaDeviceIndex>(dev)) ? Info::Default::Named : Info::Default::None);
result.flags = {
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsOriginal() ? sysInfo.WindowsVersion.IsBefore(mpt::osinfo::windows::Version::WinVista) ? Info::Usability::Usable : Info::Usability::Usable : Info::Usability::Broken : Info::Usability::NotAvailable,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsOriginal() ? sysInfo.WindowsVersion.IsBefore(mpt::osinfo::arch::Version::WinVista) ? Info::Usability::Usable : Info::Usability::Usable : Info::Usability::Broken : Info::Usability::NotAvailable,
Info::Level::Primary,
Info::Compatible::No,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsOriginal() ? sysInfo.WindowsVersion.IsBefore(mpt::osinfo::windows::Version::WinVista) ? Info::Api::Native : Info::Api::Native : Info::Api::Emulated : Info::Api::Emulated,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsOriginal() ? sysInfo.WindowsVersion.IsBefore(mpt::osinfo::arch::Version::WinVista) ? Info::Api::Native : Info::Api::Native : Info::Api::Emulated : Info::Api::Emulated,
Info::Io::FullDuplex,
Info::Mixing::Hardware,
Info::Implementor::External
@ -927,10 +927,10 @@ std::vector<SoundDevice::Info> CPortaudioDevice::EnumerateDevices(ILogger &logge
result.flags = {
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ?
sysInfo.IsWindowsOriginal() ?
sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::Win7) ?
sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::Win7) ?
Info::Usability::Usable
:
sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista) ?
sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista) ?
Info::Usability::Experimental
:
Info::Usability::NotAvailable

View file

@ -282,7 +282,7 @@ bool CRtAudioDevice::InternalOpen()
m_Flags.WantsClippedOutput = true;
} else if(m_RtAudio->getCurrentApi() == RtAudio::Api::WINDOWS_DS)
{
m_Flags.WantsClippedOutput = (GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista));
m_Flags.WantsClippedOutput = (GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista));
}
m_RtAudio->openStream((m_OutputStreamParameters.nChannels > 0) ? &m_OutputStreamParameters : nullptr, (m_InputStreamParameters.nChannels > 0) ? &m_InputStreamParameters : nullptr, SampleFormatToRtAudioFormat(m_Settings.sampleFormat), m_Settings.Samplerate, &m_FramesPerChunk, &RtAudioCallback, this, &m_StreamOptions, nullptr);
} catch(const RtAudioError &e)
@ -708,10 +708,10 @@ std::vector<SoundDevice::Info> CRtAudioDevice::EnumerateDevices(ILogger &logger,
info.flags = {
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ?
sysInfo.IsWindowsOriginal() ?
sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::Win7) ?
sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::Win7) ?
Info::Usability::Usable
:
sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista) ?
sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista) ?
Info::Usability::Experimental
:
Info::Usability::NotAvailable
@ -747,7 +747,7 @@ std::vector<SoundDevice::Info> CRtAudioDevice::EnumerateDevices(ILogger &logger,
Info::Usability::Broken, // sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsOriginal() && sysInfo.WindowsVersion.IsBefore(mpt::Windows::Version::Win7) ? Info::Usability:Usable : Info::Usability::Deprecated : Info::Usability::NotAvailable,
Info::Level::Secondary,
Info::Compatible::No,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsWine() ? Info::Api::Emulated : sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista) ? Info::Api::Emulated : Info::Api::Native : Info::Api::Emulated,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsWine() ? Info::Api::Emulated : sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista) ? Info::Api::Emulated : Info::Api::Native : Info::Api::Emulated,
Info::Io::FullDuplex,
Info::Mixing::Software,
Info::Implementor::External

View file

@ -28,7 +28,7 @@
#include <avrt.h>
#endif
#include <mmsystem.h>
#include <windows.h>
#include <arch.h>
#endif // MPT_OS_WINDOWS
#if !MPT_OS_WINDOWS

View file

@ -24,7 +24,7 @@
#if MPT_OS_WINDOWS
#include <mmreg.h>
#include <windows.h>
#include <arch.h>
#endif // MPT_OS_WINDOWS

View file

@ -31,7 +31,7 @@
#include <cstddef>
#if MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#endif // MPT_OS_WINDOWS
@ -111,7 +111,7 @@ SoundDevice::Caps CWaveDevice::InternalGetDeviceCaps()
if(GetSysInfo().IsWine)
{
caps.DefaultSettings.sampleFormat = SampleFormat::Int16;
} else if(GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista))
} else if(GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista))
{
caps.DefaultSettings.sampleFormat = SampleFormat::Float32;
} else
@ -126,7 +126,7 @@ SoundDevice::DynamicCaps CWaveDevice::GetDeviceDynamicCaps(const std::vector<uin
{
MPT_SOUNDDEV_TRACE_SCOPE();
SoundDevice::DynamicCaps caps;
if(GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista))
if(GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista))
{ // emulated on WASAPI
caps.supportedSampleFormats = {SampleFormat::Float32};
caps.supportedExclusiveModeSampleFormats = {SampleFormat::Float32};
@ -137,7 +137,7 @@ SoundDevice::DynamicCaps CWaveDevice::GetDeviceDynamicCaps(const std::vector<uin
}
if(GetDeviceIndex() > 0)
{ // direct mode
if((GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista)) || !GetSysInfo().IsOriginal())
if((GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista)) || !GetSysInfo().IsOriginal())
{ // emulated on WASAPI, or Wine
WAVEOUTCAPS woc = {};
caps.supportedExclusiveModeSampleFormats.clear();
@ -293,7 +293,7 @@ bool CWaveDevice::InternalOpen()
}
SetWakeupEvent(m_ThreadWakeupEvent);
SetWakeupInterval(m_nWaveBufferSize * 1.0 / m_Settings.GetBytesPerSecond());
m_Flags.WantsClippedOutput = (GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista));
m_Flags.WantsClippedOutput = (GetSysInfo().IsOriginal() && GetSysInfo().WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista));
return true;
}
@ -684,10 +684,10 @@ std::vector<SoundDevice::Info> CWaveDevice::EnumerateDevices(ILogger &logger, So
info.default_ = ((index == 0) ? Info::Default::Managed : Info::Default::None);
// clang-format off
info.flags = {
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsOriginal() && sysInfo.WindowsVersion.IsBefore(mpt::osinfo::windows::Version::Win7) ? Info::Usability::Usable : Info::Usability::Legacy : Info::Usability::NotAvailable,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsOriginal() && sysInfo.WindowsVersion.IsBefore(mpt::osinfo::arch::Version::Win7) ? Info::Usability::Usable : Info::Usability::Legacy : Info::Usability::NotAvailable,
Info::Level::Primary,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows && sysInfo.IsWindowsOriginal() ? Info::Compatible::Yes : Info::Compatible::No,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsWine() ? Info::Api::Emulated : sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::windows::Version::WinVista) ? Info::Api::Emulated : Info::Api::Native : Info::Api::Emulated,
sysInfo.SystemClass == mpt::osinfo::osclass::Windows ? sysInfo.IsWindowsWine() ? Info::Api::Emulated : sysInfo.WindowsVersion.IsAtLeast(mpt::osinfo::arch::Version::WinVista) ? Info::Api::Emulated : Info::Api::Native : Info::Api::Emulated,
Info::Io::OutputOnly,
Info::Mixing::Software,
Info::Implementor::OpenMPT

View file

@ -22,7 +22,7 @@
#if MPT_OS_WINDOWS
#include <MMSystem.h>
#include <windows.h>
#include <arch.h>
#endif // MPT_OS_WINDOWS