mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-01-09 06:41:07 +08:00
c++23: Replace Common::ToUnderlying with std::to_underlying
Requires at least GCC 11, Clang 13, MSVC 19.30 (VS2022 17.0), or AppleClang 13.1.6 (XCode 13.3).
This commit is contained in:
parent
cc0ce62e7f
commit
66f8bac10f
@ -7,7 +7,8 @@
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#include "Common/EnumUtils.h"
|
||||
#include <utility>
|
||||
|
||||
#include "Common/IniFile.h"
|
||||
#include "jni/AndroidCommon/AndroidCommon.h"
|
||||
#include "jni/AndroidCommon/IDCache.h"
|
||||
@ -70,7 +71,7 @@ Java_org_dolphinemu_dolphinemu_utils_GpuDriverHelper_00024Companion_getSystemDri
|
||||
properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
|
||||
properties2.pNext = &driverProperties;
|
||||
vkGetPhysicalDeviceProperties2(gpu_list.front(), &properties2);
|
||||
driverId = fmt::format("{}", Common::ToUnderlying(driverProperties.driverID));
|
||||
driverId = fmt::format("{}", std::to_underlying(driverProperties.driverID));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -11,9 +11,9 @@
|
||||
#include <initializer_list>
|
||||
#include <span>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
@ -237,8 +237,8 @@ public:
|
||||
m_hex |= static_cast<std::underlying_type_t<T>>(bit);
|
||||
}
|
||||
}
|
||||
auto operator[](T bit) { return FlagBit(&m_hex, Common::ToUnderlying(bit)); }
|
||||
auto operator[](T bit) const { return FlagBit(&m_hex, Common::ToUnderlying(bit)); }
|
||||
auto operator[](T bit) { return FlagBit(&m_hex, std::to_underlying(bit)); }
|
||||
auto operator[](T bit) const { return FlagBit(&m_hex, std::to_underlying(bit)); }
|
||||
|
||||
std::underlying_type_t<T> m_hex = 0;
|
||||
};
|
||||
|
||||
@ -60,7 +60,6 @@ add_library(common
|
||||
ENet.h
|
||||
EnumFormatter.h
|
||||
EnumMap.h
|
||||
EnumUtils.h
|
||||
Event.h
|
||||
FatFsUtil.cpp
|
||||
FatFsUtil.h
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace Common
|
||||
{
|
||||
// TODO: Replace with std::to_underlying in C++23
|
||||
template <typename Enum>
|
||||
constexpr std::underlying_type_t<Enum> ToUnderlying(Enum e) noexcept
|
||||
{
|
||||
return static_cast<std::underlying_type_t<Enum>>(e);
|
||||
}
|
||||
} // namespace Common
|
||||
@ -5,8 +5,9 @@
|
||||
|
||||
#include <SFML/Network/Packet.hpp>
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/Swap.h"
|
||||
#include "Common/TypeUtils.h"
|
||||
|
||||
@ -17,7 +18,7 @@ sf::Packet& operator>>(sf::Packet& packet, Common::BigEndianValue<u64>& data);
|
||||
template <Common::Enum Enum>
|
||||
sf::Packet& operator<<(sf::Packet& packet, Enum e)
|
||||
{
|
||||
packet << Common::ToUnderlying(e);
|
||||
packet << std::to_underlying(e);
|
||||
return packet;
|
||||
}
|
||||
|
||||
|
||||
@ -16,10 +16,10 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/TypeUtils.h"
|
||||
|
||||
std::string StringFromFormatV(const char* format, va_list args);
|
||||
@ -157,7 +157,7 @@ std::string ValueToString(s64 value);
|
||||
std::string ValueToString(bool value);
|
||||
std::string ValueToString(Common::Enum auto value)
|
||||
{
|
||||
return ValueToString(Common::ToUnderlying(value));
|
||||
return ValueToString(std::to_underlying(value));
|
||||
}
|
||||
|
||||
// Generates an hexdump-like representation of a binary data blob.
|
||||
|
||||
@ -7,12 +7,12 @@
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
@ -133,8 +133,7 @@ std::string DSPDisassembler::DisassembleParameters(const DSPOPCTemplate& opc, u1
|
||||
break;
|
||||
|
||||
default:
|
||||
ERROR_LOG_FMT(DSPLLE, "Unknown parameter type: {:x}",
|
||||
Common::ToUnderlying(opc.params[j].type));
|
||||
ERROR_LOG_FMT(DSPLLE, "Unknown parameter type: {:x}", std::to_underlying(opc.params[j].type));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
#include "Core/DSP/Jit/x64/DSPJitRegCache.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
|
||||
#include "Core/DSP/DSPCore.h"
|
||||
@ -367,38 +367,38 @@ void DSPJitRegCache::FlushRegs()
|
||||
}
|
||||
|
||||
ASSERT_MSG(DSPLLE, m_xregs[RSP].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}",
|
||||
Common::ToUnderlying(RSP));
|
||||
std::to_underlying(RSP));
|
||||
ASSERT_MSG(DSPLLE, m_xregs[RBX].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}",
|
||||
Common::ToUnderlying(RBX));
|
||||
std::to_underlying(RBX));
|
||||
ASSERT_MSG(DSPLLE, m_xregs[RBP].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||
Common::ToUnderlying(RBP));
|
||||
std::to_underlying(RBP));
|
||||
ASSERT_MSG(DSPLLE, m_xregs[RSI].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||
Common::ToUnderlying(RSI));
|
||||
std::to_underlying(RSI));
|
||||
ASSERT_MSG(DSPLLE, m_xregs[RDI].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||
Common::ToUnderlying(RDI));
|
||||
std::to_underlying(RDI));
|
||||
#ifdef STATIC_REG_ACCS
|
||||
ASSERT_MSG(DSPLLE, m_xregs[R8].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}",
|
||||
Common::ToUnderlying(R8));
|
||||
std::to_underlying(R8));
|
||||
ASSERT_MSG(DSPLLE, m_xregs[R9].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}",
|
||||
Common::ToUnderlying(R9));
|
||||
std::to_underlying(R9));
|
||||
#else
|
||||
ASSERT_MSG(DSPLLE, m_xregs[R8].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||
Common::ToUnderlying(R8));
|
||||
std::to_underlying(R8));
|
||||
ASSERT_MSG(DSPLLE, m_xregs[R9].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||
Common::ToUnderlying(R9));
|
||||
std::to_underlying(R9));
|
||||
#endif
|
||||
ASSERT_MSG(DSPLLE, m_xregs[R10].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||
Common::ToUnderlying(R10));
|
||||
std::to_underlying(R10));
|
||||
ASSERT_MSG(DSPLLE, m_xregs[R11].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||
Common::ToUnderlying(R11));
|
||||
std::to_underlying(R11));
|
||||
ASSERT_MSG(DSPLLE, m_xregs[R12].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||
Common::ToUnderlying(R12));
|
||||
std::to_underlying(R12));
|
||||
ASSERT_MSG(DSPLLE, m_xregs[R13].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||
Common::ToUnderlying(R13));
|
||||
std::to_underlying(R13));
|
||||
ASSERT_MSG(DSPLLE, m_xregs[R14].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||
Common::ToUnderlying(R14));
|
||||
std::to_underlying(R14));
|
||||
ASSERT_MSG(DSPLLE, m_xregs[R15].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}",
|
||||
Common::ToUnderlying(R15));
|
||||
std::to_underlying(R15));
|
||||
|
||||
m_use_ctr = 0;
|
||||
}
|
||||
@ -985,14 +985,14 @@ void DSPJitRegCache::SpillXReg(X64Reg reg)
|
||||
{
|
||||
ASSERT_MSG(DSPLLE, !m_regs[m_xregs[reg].guest_reg].used,
|
||||
"to be spilled host reg {:#x} (guest reg {:#x}) still in use!",
|
||||
Common::ToUnderlying(reg), m_xregs[reg].guest_reg);
|
||||
std::to_underlying(reg), m_xregs[reg].guest_reg);
|
||||
|
||||
MovToMemory(m_xregs[reg].guest_reg);
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT_MSG(DSPLLE, m_xregs[reg].guest_reg == DSP_REG_NONE,
|
||||
"to be spilled host reg {:#x} still in use!", Common::ToUnderlying(reg));
|
||||
"to be spilled host reg {:#x} still in use!", std::to_underlying(reg));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1037,7 +1037,7 @@ void DSPJitRegCache::GetXReg(X64Reg reg)
|
||||
{
|
||||
if (m_xregs[reg].guest_reg == DSP_REG_STATIC)
|
||||
{
|
||||
ERROR_LOG_FMT(DSPLLE, "Trying to get statically used XReg {}", Common::ToUnderlying(reg));
|
||||
ERROR_LOG_FMT(DSPLLE, "Trying to get statically used XReg {}", std::to_underlying(reg));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1053,7 +1053,7 @@ void DSPJitRegCache::PutXReg(X64Reg reg)
|
||||
{
|
||||
if (m_xregs[reg].guest_reg == DSP_REG_STATIC)
|
||||
{
|
||||
ERROR_LOG_FMT(DSPLLE, "Trying to put statically used XReg {}", Common::ToUnderlying(reg));
|
||||
ERROR_LOG_FMT(DSPLLE, "Trying to put statically used XReg {}", std::to_underlying(reg));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -8,10 +8,10 @@
|
||||
#include <cstdio>
|
||||
#include <functional>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Core/PowerPC/Gekko.h"
|
||||
|
||||
namespace Core
|
||||
@ -71,15 +71,15 @@ enum class BranchWatchSelectionInspection : u8
|
||||
constexpr BranchWatchSelectionInspection operator|(BranchWatchSelectionInspection lhs,
|
||||
BranchWatchSelectionInspection rhs)
|
||||
{
|
||||
return static_cast<BranchWatchSelectionInspection>(Common::ToUnderlying(lhs) |
|
||||
Common::ToUnderlying(rhs));
|
||||
return static_cast<BranchWatchSelectionInspection>(std::to_underlying(lhs) |
|
||||
std::to_underlying(rhs));
|
||||
}
|
||||
|
||||
constexpr BranchWatchSelectionInspection operator&(BranchWatchSelectionInspection lhs,
|
||||
BranchWatchSelectionInspection rhs)
|
||||
{
|
||||
return static_cast<BranchWatchSelectionInspection>(Common::ToUnderlying(lhs) &
|
||||
Common::ToUnderlying(rhs));
|
||||
return static_cast<BranchWatchSelectionInspection>(std::to_underlying(lhs) &
|
||||
std::to_underlying(rhs));
|
||||
}
|
||||
|
||||
constexpr BranchWatchSelectionInspection& operator|=(BranchWatchSelectionInspection& self,
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <fmt/format.h>
|
||||
@ -27,7 +28,6 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Common/Crypto/SHA1.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/Random.h"
|
||||
#include "Common/Timer.h"
|
||||
#include "Common/Version.h"
|
||||
@ -396,7 +396,7 @@ void DolphinAnalytics::MakePerGameBuilder()
|
||||
builder.AddData("cfg-gfx-multisamples", Config::Get(Config::GFX_MSAA));
|
||||
builder.AddData("cfg-gfx-ssaa", Config::Get(Config::GFX_SSAA));
|
||||
builder.AddData("cfg-gfx-anisotropy",
|
||||
Common::ToUnderlying(Config::Get(Config::GFX_ENHANCE_MAX_ANISOTROPY)));
|
||||
std::to_underlying(Config::Get(Config::GFX_ENHANCE_MAX_ANISOTROPY)));
|
||||
builder.AddData("cfg-gfx-vsync", Config::Get(Config::GFX_VSYNC));
|
||||
builder.AddData("cfg-gfx-aspect-ratio", static_cast<int>(Config::Get(Config::GFX_ASPECT_RATIO)));
|
||||
builder.AddData("cfg-gfx-efb-access", Config::Get(Config::GFX_HACK_EFB_ACCESS_ENABLE));
|
||||
|
||||
@ -5,11 +5,11 @@
|
||||
|
||||
#include <cmath>
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
|
||||
#include "Common/BitUtils.h"
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/Swap.h"
|
||||
@ -208,7 +208,7 @@ void Wiimote::HandleExtensionSwap(ExtensionNumber desired_extension_number,
|
||||
else
|
||||
{
|
||||
INFO_LOG_FMT(WIIMOTE, "Switching to Extension {} (Wiimote {} in slot {})",
|
||||
Common::ToUnderlying(desired_extension_number), m_index, m_bt_device_index);
|
||||
std::to_underlying(desired_extension_number), m_index, m_bt_device_index);
|
||||
|
||||
m_active_extension = desired_extension_number;
|
||||
}
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/NandPaths.h"
|
||||
@ -96,7 +95,7 @@ ESCore::ESCore(Kernel& ios) : m_ios(ios)
|
||||
if (result != FS::ResultCode::Success && result != FS::ResultCode::AlreadyExists)
|
||||
{
|
||||
ERROR_LOG_FMT(IOS_ES, "Failed to create {}: error {}", directory.path,
|
||||
Common::ToUnderlying(FS::ConvertResult(result)));
|
||||
std::to_underlying(FS::ConvertResult(result)));
|
||||
}
|
||||
|
||||
// Now update the UID/GID and other attributes.
|
||||
@ -1116,7 +1115,7 @@ ReturnCode ESCore::VerifyContainer(VerifyContainerType type, VerifyMode mode,
|
||||
if (ret != IPC_SUCCESS)
|
||||
{
|
||||
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_ImportCertificate(ca) failed with error {}",
|
||||
Common::ToUnderlying(ret));
|
||||
std::to_underlying(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1132,7 +1131,7 @@ ReturnCode ESCore::VerifyContainer(VerifyContainerType type, VerifyMode mode,
|
||||
if (ret != IPC_SUCCESS)
|
||||
{
|
||||
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_ImportCertificate(issuer) failed with error {}",
|
||||
Common::ToUnderlying(ret));
|
||||
std::to_underlying(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1142,7 +1141,7 @@ ReturnCode ESCore::VerifyContainer(VerifyContainerType type, VerifyMode mode,
|
||||
if (ret != IPC_SUCCESS)
|
||||
{
|
||||
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_VerifyPublicKeySign failed with error {}",
|
||||
Common::ToUnderlying(ret));
|
||||
std::to_underlying(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1152,13 +1151,13 @@ ReturnCode ESCore::VerifyContainer(VerifyContainerType type, VerifyMode mode,
|
||||
if (ret != IPC_SUCCESS)
|
||||
{
|
||||
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: Writing the issuer cert failed with return code {}",
|
||||
Common::ToUnderlying(ret));
|
||||
std::to_underlying(ret));
|
||||
}
|
||||
|
||||
ret = WriteNewCertToStore(ca_cert);
|
||||
if (ret != IPC_SUCCESS)
|
||||
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: Writing the CA cert failed with return code {}",
|
||||
Common::ToUnderlying(ret));
|
||||
std::to_underlying(ret));
|
||||
}
|
||||
|
||||
if (ret == IPC_SUCCESS && issuer_handle_out)
|
||||
|
||||
@ -3,11 +3,11 @@
|
||||
|
||||
#include "Core/IOS/ES/ES.h"
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/Crypto/SHA1.h"
|
||||
#include "Common/Crypto/ec.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/ScopeGuard.h"
|
||||
#include "Common/StringUtil.h"
|
||||
@ -165,7 +165,7 @@ ReturnCode ESCore::VerifySign(const std::vector<u8>& hash, const std::vector<u8>
|
||||
if (ret != IPC_SUCCESS)
|
||||
{
|
||||
ERROR_LOG_FMT(IOS_ES, "VerifySign: VerifyContainer(ng) failed with error {}",
|
||||
Common::ToUnderlying(ret));
|
||||
std::to_underlying(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ ReturnCode ESCore::VerifySign(const std::vector<u8>& hash, const std::vector<u8>
|
||||
if (ret != IPC_SUCCESS)
|
||||
{
|
||||
ERROR_LOG_FMT(IOS_ES, "VerifySign: IOSC_VerifyPublicKeySign(ap) failed with error {}",
|
||||
Common::ToUnderlying(ret));
|
||||
std::to_underlying(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ ReturnCode ESCore::VerifySign(const std::vector<u8>& hash, const std::vector<u8>
|
||||
if (ret != IPC_SUCCESS)
|
||||
{
|
||||
ERROR_LOG_FMT(IOS_ES, "VerifySign: IOSC_ImportPublicKey(ap) failed with error {}",
|
||||
Common::ToUnderlying(ret));
|
||||
std::to_underlying(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ ReturnCode ESCore::VerifySign(const std::vector<u8>& hash, const std::vector<u8>
|
||||
if (ret != IPC_SUCCESS)
|
||||
{
|
||||
ERROR_LOG_FMT(IOS_ES, "VerifySign: IOSC_VerifyPublicKeySign(data) failed with error {}",
|
||||
Common::ToUnderlying(ret));
|
||||
std::to_underlying(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
|
||||
#include "Common/Align.h"
|
||||
#include "Common/Crypto/SHA1.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/NandPaths.h"
|
||||
#include "Core/CommonTitles.h"
|
||||
@ -73,7 +72,7 @@ ReturnCode ESCore::ImportTicket(const std::vector<u8>& ticket_bytes,
|
||||
if (ret < 0)
|
||||
{
|
||||
ERROR_LOG_FMT(IOS_ES, "ImportTicket: Failed to unpersonalise ticket for {:016x} ({})",
|
||||
ticket.GetTitleId(), Common::ToUnderlying(ret));
|
||||
ticket.GetTitleId(), std::to_underlying(ret));
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@ -163,7 +162,7 @@ ReturnCode ESCore::ImportTmd(Context& context, const std::vector<u8>& tmd_bytes,
|
||||
if (ret != IPC_SUCCESS)
|
||||
{
|
||||
ERROR_LOG_FMT(IOS_ES, "ImportTmd: VerifyContainer failed with error {}",
|
||||
Common::ToUnderlying(ret));
|
||||
std::to_underlying(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -177,8 +176,7 @@ ReturnCode ESCore::ImportTmd(Context& context, const std::vector<u8>& tmd_bytes,
|
||||
&context.title_import_export.key_handle);
|
||||
if (ret != IPC_SUCCESS)
|
||||
{
|
||||
ERROR_LOG_FMT(IOS_ES, "ImportTmd: InitBackupKey failed with error {}",
|
||||
Common::ToUnderlying(ret));
|
||||
ERROR_LOG_FMT(IOS_ES, "ImportTmd: InitBackupKey failed with error {}", std::to_underlying(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -6,11 +6,11 @@
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/Swap.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
@ -120,7 +120,7 @@ static void LogResult(ResultCode code, fmt::format_string<Args...> format, Args&
|
||||
code == ResultCode::Success ? Common::Log::LogLevel::LINFO : Common::Log::LogLevel::LERROR;
|
||||
|
||||
GENERIC_LOG_FMT(Common::Log::LogType::IOS_FS, type, "Command: {}: Result {}", command,
|
||||
Common::ToUnderlying(ConvertResult(code)));
|
||||
std::to_underlying(ConvertResult(code)));
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/Timer.h"
|
||||
|
||||
@ -662,8 +661,8 @@ std::shared_ptr<Device> EmulationKernel::GetDeviceByFileDescriptor(const u32 fd)
|
||||
std::optional<IPCReply> EmulationKernel::OpenDevice(OpenRequest& request)
|
||||
{
|
||||
const s32 new_fd = GetFreeDeviceID();
|
||||
INFO_LOG_FMT(IOS, "Opening {} (mode {}, fd {})", request.path,
|
||||
Common::ToUnderlying(request.flags), new_fd);
|
||||
INFO_LOG_FMT(IOS, "Opening {} (mode {}, fd {})", request.path, std::to_underlying(request.flags),
|
||||
new_fd);
|
||||
if (new_fd < 0 || new_fd >= IPC_MAX_FDS)
|
||||
{
|
||||
ERROR_LOG_FMT(IOS, "Couldn't get a free fd, too many open files");
|
||||
@ -749,7 +748,7 @@ std::optional<IPCReply> EmulationKernel::HandleIPCCommand(const Request& request
|
||||
ret = device->IOCtlV(IOCtlVRequest{GetSystem(), request.address});
|
||||
break;
|
||||
default:
|
||||
ASSERT_MSG(IOS, false, "Unexpected command: {:#x}", Common::ToUnderlying(request.command));
|
||||
ASSERT_MSG(IOS, false, "Unexpected command: {:#x}", std::to_underlying(request.command));
|
||||
ret = IPCReply{IPC_EINVAL, 978_tbticks};
|
||||
break;
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <fmt/format.h>
|
||||
@ -17,7 +18,6 @@
|
||||
// clang-format on
|
||||
|
||||
#include "Common/Align.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/FatFsUtil.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/ScopeGuard.h"
|
||||
@ -212,7 +212,7 @@ static ErrorCode WriteFile(const std::string& filename, std::span<const u8> tmp_
|
||||
if (write_error_code != FR_OK)
|
||||
{
|
||||
ERROR_LOG_FMT(IOS_WC24, "Failed to write file {} to VFF: {}", filename,
|
||||
Common::ToUnderlying(write_error_code));
|
||||
std::to_underlying(write_error_code));
|
||||
return WC24_ERR_FILE_WRITE;
|
||||
}
|
||||
|
||||
|
||||
@ -52,7 +52,6 @@ typedef struct pollfd pollfd_t;
|
||||
#include <utility>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IOS/IOS.h"
|
||||
@ -291,7 +290,7 @@ public:
|
||||
if (socket_entry == WiiSockets.end())
|
||||
{
|
||||
ERROR_LOG_FMT(IOS_NET, "DoSock: Error, fd not found ({:08x}, {:08X}, {:08X})", sock,
|
||||
request.address, Common::ToUnderlying(type));
|
||||
request.address, std::to_underlying(type));
|
||||
EnqueueIPCReply(request, -SO_EBADF);
|
||||
}
|
||||
else
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include "Core/IOS/USB/Emulated/LogitechMic.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
@ -208,12 +209,12 @@ static constexpr u32 USBGETAID(u8 cs, u8 request, u16 index)
|
||||
|
||||
static constexpr u32 USBGETAID(FeatureUnitControlSelector cs, RequestCode request, u16 index)
|
||||
{
|
||||
return USBGETAID(Common::ToUnderlying(cs), Common::ToUnderlying(request), index);
|
||||
return USBGETAID(std::to_underlying(cs), std::to_underlying(request), index);
|
||||
}
|
||||
|
||||
static constexpr u32 USBGETAID(EndpointControlSelector cs, RequestCode request, u16 index)
|
||||
{
|
||||
return USBGETAID(Common::ToUnderlying(cs), Common::ToUnderlying(request), index);
|
||||
return USBGETAID(std::to_underlying(cs), std::to_underlying(request), index);
|
||||
}
|
||||
|
||||
int LogitechMic::GetAudioControl(std::unique_ptr<CtrlMessage>& cmd)
|
||||
@ -228,7 +229,7 @@ int LogitechMic::GetAudioControl(std::unique_ptr<CtrlMessage>& cmd)
|
||||
DEBUG_LOG_FMT(IOS_USB,
|
||||
"GetAudioControl: bCs={:02x} bCn={:02x} bRequestType={:02x} bRequest={:02x} "
|
||||
"bIndex={:02x} aid={:08x}",
|
||||
Common::ToUnderlying(cs), cn, cmd->request_type, Common::ToUnderlying(request),
|
||||
std::to_underlying(cs), cn, cmd->request_type, std::to_underlying(request),
|
||||
cmd->index, aid);
|
||||
switch (aid)
|
||||
{
|
||||
@ -281,7 +282,7 @@ int LogitechMic::GetAudioControl(std::unique_ptr<CtrlMessage>& cmd)
|
||||
WARN_LOG_FMT(IOS_USB,
|
||||
"GetAudioControl: Unknown request: bCs={:02x} bCn={:02x} bRequestType={:02x} "
|
||||
"bRequest={:02x} bIndex={:02x} aid={:08x}",
|
||||
Common::ToUnderlying(cs), cn, cmd->request_type, Common::ToUnderlying(request),
|
||||
std::to_underlying(cs), cn, cmd->request_type, std::to_underlying(request),
|
||||
cmd->index, aid);
|
||||
break;
|
||||
}
|
||||
@ -301,7 +302,7 @@ int LogitechMic::SetAudioControl(std::unique_ptr<CtrlMessage>& cmd)
|
||||
DEBUG_LOG_FMT(IOS_USB,
|
||||
"SetAudioControl: bCs={:02x} bCn={:02x} bRequestType={:02x} bRequest={:02x} "
|
||||
"bIndex={:02x} aid={:08x}",
|
||||
Common::ToUnderlying(cs), cn, cmd->request_type, Common::ToUnderlying(request),
|
||||
std::to_underlying(cs), cn, cmd->request_type, std::to_underlying(request),
|
||||
cmd->index, aid);
|
||||
switch (aid)
|
||||
{
|
||||
@ -344,7 +345,7 @@ int LogitechMic::SetAudioControl(std::unique_ptr<CtrlMessage>& cmd)
|
||||
WARN_LOG_FMT(IOS_USB,
|
||||
"SetAudioControl: Unknown request: bCs={:02x} bCn={:02x} bRequestType={:02x} "
|
||||
"bRequest={:02x} bIndex={:02x} aid={:08x}",
|
||||
Common::ToUnderlying(cs), cn, cmd->request_type, Common::ToUnderlying(request),
|
||||
std::to_underlying(cs), cn, cmd->request_type, std::to_underlying(request),
|
||||
cmd->index, aid);
|
||||
break;
|
||||
}
|
||||
@ -364,7 +365,7 @@ int LogitechMic::EndpointAudioControl(std::unique_ptr<CtrlMessage>& cmd)
|
||||
DEBUG_LOG_FMT(IOS_USB,
|
||||
"EndpointAudioControl: bCs={:02x} bCn={:02x} bRequestType={:02x} bRequest={:02x} "
|
||||
"bIndex={:02x} aid:{:08x}",
|
||||
Common::ToUnderlying(cs), cn, cmd->request_type, Common::ToUnderlying(request),
|
||||
std::to_underlying(cs), cn, cmd->request_type, std::to_underlying(request),
|
||||
cmd->index, aid);
|
||||
switch (aid)
|
||||
{
|
||||
@ -406,7 +407,7 @@ int LogitechMic::EndpointAudioControl(std::unique_ptr<CtrlMessage>& cmd)
|
||||
WARN_LOG_FMT(IOS_USB,
|
||||
"SetAudioControl: Unknown request: bCs={:02x} bCn={:02x} bRequestType={:02x} "
|
||||
"bRequest={:02x} bIndex={:02x} aid={:08x}",
|
||||
Common::ToUnderlying(cs), cn, cmd->request_type, Common::ToUnderlying(request),
|
||||
std::to_underlying(cs), cn, cmd->request_type, std::to_underlying(request),
|
||||
cmd->index, aid);
|
||||
break;
|
||||
}
|
||||
@ -544,7 +545,7 @@ static constexpr std::array<u8, 121> FULL_DESCRIPTOR = {
|
||||
|
||||
static constexpr u16 LogitechUSBHDR(u8 dir, u8 type, u8 recipient, RequestCode request)
|
||||
{
|
||||
return USBHDR(dir, type, recipient, Common::ToUnderlying(request));
|
||||
return USBHDR(dir, type, recipient, std::to_underlying(request));
|
||||
}
|
||||
|
||||
int LogitechMic::SubmitTransfer(std::unique_ptr<CtrlMessage> cmd)
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Crypto/AES.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/IOFile.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
@ -144,7 +143,7 @@ std::optional<IPCReply> WFSIDevice::IOCtl(const IOCtlRequest& request)
|
||||
m_continue_install = memory.Read_U32(request.buffer_in + 36);
|
||||
|
||||
INFO_LOG_FMT(IOS_WFS, "IOCTL_WFSI_IMPORT_TITLE_INIT: patch type {}, continue install: {}",
|
||||
Common::ToUnderlying(m_patch_type), m_continue_install ? "true" : "false");
|
||||
std::to_underlying(m_patch_type), m_continue_install ? "true" : "false");
|
||||
|
||||
if (m_patch_type == PatchType::PATCH_TYPE_2)
|
||||
{
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
#include <span>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ostream.h>
|
||||
@ -17,7 +18,6 @@
|
||||
#endif
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/GekkoDisassembler.h"
|
||||
#include "Common/HostDisassembler.h"
|
||||
#include "Common/IOFile.h"
|
||||
@ -1071,7 +1071,7 @@ bool Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
|
||||
ABI_CallFunctionP(PowerPC::CheckAndHandleBreakPointsFromJIT, &power_pc);
|
||||
ABI_PopRegistersAndAdjustStack({}, 0);
|
||||
MOV(64, R(RSCRATCH), ImmPtr(cpu.GetStatePtr()));
|
||||
CMP(32, MatR(RSCRATCH), Imm32(Common::ToUnderlying(CPU::State::Running)));
|
||||
CMP(32, MatR(RSCRATCH), Imm32(std::to_underlying(CPU::State::Running)));
|
||||
FixupBranch noBreakpoint = J_CC(CC_E);
|
||||
|
||||
Cleanup();
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
#include "Core/PowerPC/Jit64/JitAsm.h"
|
||||
|
||||
#include <climits>
|
||||
#include <utility>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/JitRegister.h"
|
||||
#include "Common/x64ABI.h"
|
||||
#include "Common/x64Emitter.h"
|
||||
@ -99,7 +99,7 @@ void Jit64AsmRoutineManager::Generate()
|
||||
if (enable_debugging)
|
||||
{
|
||||
MOV(64, R(RSCRATCH), ImmPtr(system.GetCPU().GetStatePtr()));
|
||||
CMP(32, MatR(RSCRATCH), Imm32(Common::ToUnderlying(CPU::State::Running)));
|
||||
CMP(32, MatR(RSCRATCH), Imm32(std::to_underlying(CPU::State::Running)));
|
||||
dbg_exit = J_CC(CC_NE, Jump::Near);
|
||||
}
|
||||
|
||||
@ -230,7 +230,7 @@ void Jit64AsmRoutineManager::Generate()
|
||||
// Check the state pointer to see if we are exiting
|
||||
// Gets checked on at the end of every slice
|
||||
MOV(64, R(RSCRATCH), ImmPtr(system.GetCPU().GetStatePtr()));
|
||||
CMP(32, MatR(RSCRATCH), Imm32(Common::ToUnderlying(CPU::State::Running)));
|
||||
CMP(32, MatR(RSCRATCH), Imm32(std::to_underlying(CPU::State::Running)));
|
||||
J_CC(CC_E, outerLoop);
|
||||
|
||||
// Landing pad for drec space
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/BitSet.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/VariantUtil.h"
|
||||
#include "Common/x64Emitter.h"
|
||||
@ -366,7 +365,7 @@ void RegCache::Discard(BitSet32 pregs)
|
||||
for (preg_t i : pregs)
|
||||
{
|
||||
ASSERT_MSG(DYNA_REC, !m_regs[i].IsLocked(), "Someone forgot to unlock PPC reg {} (X64 reg {}).",
|
||||
i, Common::ToUnderlying(RX(i)));
|
||||
i, std::to_underlying(RX(i)));
|
||||
ASSERT_MSG(DYNA_REC, !m_regs[i].IsRevertable(), "Register transaction is in progress for {}!",
|
||||
i);
|
||||
|
||||
@ -382,7 +381,7 @@ void RegCache::Flush(BitSet32 pregs, IgnoreDiscardedRegisters ignore_discarded_r
|
||||
for (preg_t i : pregs)
|
||||
{
|
||||
ASSERT_MSG(DYNA_REC, !m_regs[i].IsLocked(), "Someone forgot to unlock PPC reg {} (X64 reg {}).",
|
||||
i, Common::ToUnderlying(RX(i)));
|
||||
i, std::to_underlying(RX(i)));
|
||||
ASSERT_MSG(DYNA_REC, !m_regs[i].IsRevertable(), "Register transaction is in progress for {}!",
|
||||
i);
|
||||
|
||||
@ -451,7 +450,7 @@ BitSet32 RegCache::RegistersInUse() const
|
||||
void RegCache::FlushX(X64Reg reg)
|
||||
{
|
||||
ASSERT_MSG(DYNA_REC, reg < m_xregs.size(), "Flushing non-existent reg {}",
|
||||
Common::ToUnderlying(reg));
|
||||
std::to_underlying(reg));
|
||||
ASSERT(!m_xregs[reg].IsLocked());
|
||||
if (!m_xregs[reg].IsFree())
|
||||
{
|
||||
@ -489,7 +488,7 @@ void RegCache::BindToRegister(preg_t i, bool doLoad, bool makeDirty)
|
||||
[xr](const auto& r) {
|
||||
return r.IsInHostRegister() && r.GetHostRegister() == xr;
|
||||
}),
|
||||
"Xreg {} already bound", Common::ToUnderlying(xr));
|
||||
"Xreg {} already bound", std::to_underlying(xr));
|
||||
|
||||
m_regs[i].SetInHostRegister(xr, makeDirty);
|
||||
}
|
||||
@ -505,7 +504,7 @@ void RegCache::BindToRegister(preg_t i, bool doLoad, bool makeDirty)
|
||||
DiscardImm(i);
|
||||
|
||||
ASSERT_MSG(DYNA_REC, !m_xregs[RX(i)].IsLocked(),
|
||||
"WTF, this reg ({} -> {}) should have been flushed", i, Common::ToUnderlying(RX(i)));
|
||||
"WTF, this reg ({} -> {}) should have been flushed", i, std::to_underlying(RX(i)));
|
||||
}
|
||||
|
||||
void RegCache::StoreFromRegister(preg_t i, FlushMode mode,
|
||||
|
||||
@ -4,10 +4,10 @@
|
||||
#include "Core/PowerPC/Jit64Common/Jit64AsmCommon.h"
|
||||
|
||||
#include <array>
|
||||
#include <utility>
|
||||
|
||||
#include "Common/CPUDetect.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/FloatUtils.h"
|
||||
#include "Common/Intrinsics.h"
|
||||
#include "Common/JitRegister.h"
|
||||
@ -368,7 +368,7 @@ const u8* CommonAsmRoutines::GenQuantizedStoreRuntime(bool single, EQuantizeType
|
||||
GenQuantizedStore(single, type, -1);
|
||||
RET();
|
||||
Common::JitRegister::Register(start, GetCodePtr(), "JIT_QuantizedStore_{}_{}",
|
||||
Common::ToUnderlying(type), single);
|
||||
std::to_underlying(type), single);
|
||||
|
||||
return load;
|
||||
}
|
||||
@ -400,7 +400,7 @@ const u8* CommonAsmRoutines::GenQuantizedLoadRuntime(bool single, EQuantizeType
|
||||
GenQuantizedLoad(single, type, -1);
|
||||
RET();
|
||||
Common::JitRegister::Register(start, GetCodePtr(), "JIT_QuantizedLoad_{}_{}",
|
||||
Common::ToUnderlying(type), single);
|
||||
std::to_underlying(type), single);
|
||||
|
||||
return load;
|
||||
}
|
||||
|
||||
@ -7,13 +7,13 @@
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ostream.h>
|
||||
|
||||
#include "Common/Arm64Emitter.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/GekkoDisassembler.h"
|
||||
#include "Common/HostDisassembler.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
@ -1297,7 +1297,7 @@ bool JitArm64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
|
||||
|
||||
LDR(IndexType::Unsigned, ARM64Reg::W0, ARM64Reg::X0,
|
||||
MOVPage2R(ARM64Reg::X0, cpu.GetStatePtr()));
|
||||
static_assert(Common::ToUnderlying(CPU::State::Running) == 0);
|
||||
static_assert(std::to_underlying(CPU::State::Running) == 0);
|
||||
FixupBranch no_breakpoint = CBZ(ARM64Reg::W0);
|
||||
|
||||
Cleanup();
|
||||
|
||||
@ -5,11 +5,11 @@
|
||||
|
||||
#include <bit>
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
|
||||
#include "Common/Arm64Emitter.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/FloatUtils.h"
|
||||
#include "Common/JitRegister.h"
|
||||
#include "Common/MathUtil.h"
|
||||
@ -89,7 +89,7 @@ void JitArm64::GenerateAsm()
|
||||
{
|
||||
LDR(IndexType::Unsigned, ARM64Reg::W8, ARM64Reg::X8,
|
||||
MOVPage2R(ARM64Reg::X8, cpu.GetStatePtr()));
|
||||
static_assert(Common::ToUnderlying(CPU::State::Running) == 0);
|
||||
static_assert(std::to_underlying(CPU::State::Running) == 0);
|
||||
debug_exit = CBNZ(ARM64Reg::W8);
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ void JitArm64::GenerateAsm()
|
||||
// Check the state pointer to see if we are exiting
|
||||
// Gets checked on at the end of every slice
|
||||
LDR(IndexType::Unsigned, ARM64Reg::W8, ARM64Reg::X8, MOVPage2R(ARM64Reg::X8, cpu.GetStatePtr()));
|
||||
static_assert(Common::ToUnderlying(CPU::State::Running) == 0);
|
||||
static_assert(std::to_underlying(CPU::State::Running) == 0);
|
||||
FixupBranch exit = CBNZ(ARM64Reg::W8);
|
||||
|
||||
SetJumpTarget(to_start_of_timing_slice);
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Contains.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/HttpRequest.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
@ -80,7 +79,7 @@ static bool ImportWAD(IOS::HLE::Kernel& ios, const DiscIO::VolumeWAD& wad,
|
||||
if (ret != IOS::HLE::IOSC_FAIL_CHECKVALUE)
|
||||
{
|
||||
PanicAlertFmtT("WAD installation failed: Could not initialise title import (error {0}).",
|
||||
Common::ToUnderlying(ret));
|
||||
std::to_underlying(ret));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -546,7 +545,7 @@ UpdateResult OnlineSystemUpdater::InstallTitleFromNUS(const std::string& prefix_
|
||||
auto& es = m_ios.GetESCore();
|
||||
if ((ret = es.ImportTicket(ticket.first, ticket.second)) < 0)
|
||||
{
|
||||
ERROR_LOG_FMT(CORE, "Failed to import ticket: error {}", Common::ToUnderlying(ret));
|
||||
ERROR_LOG_FMT(CORE, "Failed to import ticket: error {}", std::to_underlying(ret));
|
||||
return UpdateResult::ImportFailed;
|
||||
}
|
||||
|
||||
@ -578,7 +577,7 @@ UpdateResult OnlineSystemUpdater::InstallTitleFromNUS(const std::string& prefix_
|
||||
IOS::HLE::ESCore::Context context;
|
||||
if ((ret = es.ImportTitleInit(context, tmd.first.GetBytes(), tmd.second)) < 0)
|
||||
{
|
||||
ERROR_LOG_FMT(CORE, "Failed to initialise title import: error {}", Common::ToUnderlying(ret));
|
||||
ERROR_LOG_FMT(CORE, "Failed to initialise title import: error {}", std::to_underlying(ret));
|
||||
return UpdateResult::ImportFailed;
|
||||
}
|
||||
|
||||
@ -597,7 +596,7 @@ UpdateResult OnlineSystemUpdater::InstallTitleFromNUS(const std::string& prefix_
|
||||
if ((ret = es.ImportContentBegin(context, title.id, content.id)) < 0)
|
||||
{
|
||||
ERROR_LOG_FMT(CORE, "Failed to initialise import for content {:08x}: error {}", content.id,
|
||||
Common::ToUnderlying(ret));
|
||||
std::to_underlying(ret));
|
||||
return UpdateResult::ImportFailed;
|
||||
}
|
||||
|
||||
@ -622,7 +621,7 @@ UpdateResult OnlineSystemUpdater::InstallTitleFromNUS(const std::string& prefix_
|
||||
if ((all_contents_imported && (ret = es.ImportTitleDone(context)) < 0) ||
|
||||
(!all_contents_imported && (ret = es.ImportTitleCancel(context)) < 0))
|
||||
{
|
||||
ERROR_LOG_FMT(CORE, "Failed to finalise title import: error {}", Common::ToUnderlying(ret));
|
||||
ERROR_LOG_FMT(CORE, "Failed to finalise title import: error {}", std::to_underlying(ret));
|
||||
return UpdateResult::ImportFailed;
|
||||
}
|
||||
|
||||
|
||||
@ -56,7 +56,6 @@
|
||||
<ClInclude Include="Common\ENet.h" />
|
||||
<ClInclude Include="Common\EnumFormatter.h" />
|
||||
<ClInclude Include="Common\EnumMap.h" />
|
||||
<ClInclude Include="Common\EnumUtils.h" />
|
||||
<ClInclude Include="Common\Event.h" />
|
||||
<ClInclude Include="Common\FatFsUtil.h" />
|
||||
<ClInclude Include="Common\FileSearch.h" />
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
|
||||
#include "DolphinQt/Config/Graphics/EnhancementsWidget.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
@ -10,7 +12,6 @@
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
|
||||
#include "Core/Config/GraphicsSettings.h"
|
||||
|
||||
@ -47,14 +48,14 @@ EnhancementsWidget::EnhancementsWidget(GraphicsPane* gfx_pane)
|
||||
});
|
||||
}
|
||||
|
||||
constexpr int ANISO_1x = Common::ToUnderlying(AnisotropicFilteringMode::Force1x);
|
||||
constexpr int ANISO_2X = Common::ToUnderlying(AnisotropicFilteringMode::Force2x);
|
||||
constexpr int ANISO_4X = Common::ToUnderlying(AnisotropicFilteringMode::Force4x);
|
||||
constexpr int ANISO_8X = Common::ToUnderlying(AnisotropicFilteringMode::Force8x);
|
||||
constexpr int ANISO_16X = Common::ToUnderlying(AnisotropicFilteringMode::Force16x);
|
||||
constexpr int FILTERING_DEFAULT = Common::ToUnderlying(TextureFilteringMode::Default);
|
||||
constexpr int FILTERING_NEAREST = Common::ToUnderlying(TextureFilteringMode::Nearest);
|
||||
constexpr int FILTERING_LINEAR = Common::ToUnderlying(TextureFilteringMode::Linear);
|
||||
constexpr int ANISO_1x = std::to_underlying(AnisotropicFilteringMode::Force1x);
|
||||
constexpr int ANISO_2X = std::to_underlying(AnisotropicFilteringMode::Force2x);
|
||||
constexpr int ANISO_4X = std::to_underlying(AnisotropicFilteringMode::Force4x);
|
||||
constexpr int ANISO_8X = std::to_underlying(AnisotropicFilteringMode::Force8x);
|
||||
constexpr int ANISO_16X = std::to_underlying(AnisotropicFilteringMode::Force16x);
|
||||
constexpr int FILTERING_DEFAULT = std::to_underlying(TextureFilteringMode::Default);
|
||||
constexpr int FILTERING_NEAREST = std::to_underlying(TextureFilteringMode::Nearest);
|
||||
constexpr int FILTERING_LINEAR = std::to_underlying(TextureFilteringMode::Linear);
|
||||
|
||||
void EnhancementsWidget::CreateWidgets()
|
||||
{
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
|
||||
#include "DolphinQt/Config/SettingsWindow.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QColor>
|
||||
#include <QDialogButtonBox>
|
||||
@ -14,8 +16,6 @@
|
||||
#include <QTabWidget>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Common/EnumUtils.h"
|
||||
|
||||
#include "DolphinQt/Config/ControllersPane.h"
|
||||
#include "DolphinQt/Config/Graphics/GraphicsPane.h"
|
||||
#include "DolphinQt/MainWindow.h"
|
||||
@ -206,5 +206,5 @@ SettingsWindow::SettingsWindow(MainWindow* parent) : StackedSettingsWindow{paren
|
||||
|
||||
void SettingsWindow::SelectPane(SettingsWindowPaneIndex index)
|
||||
{
|
||||
ActivatePane(Common::ToUnderlying(index));
|
||||
ActivatePane(std::to_underlying(index));
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
#include <algorithm>
|
||||
#include <bit>
|
||||
#include <ranges>
|
||||
#include <utility>
|
||||
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
@ -20,7 +21,6 @@
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/Swap.h"
|
||||
#include "Core/FifoPlayer/FifoPlayer.h"
|
||||
|
||||
@ -264,7 +264,7 @@ public:
|
||||
const u32 object_prim_size = num_vertices * vertex_size;
|
||||
|
||||
const u8 opcode =
|
||||
0x80 | Common::ToUnderlying(primitive) << OpcodeDecoder::GX_PRIMITIVE_SHIFT | vat;
|
||||
0x80 | std::to_underlying(primitive) << OpcodeDecoder::GX_PRIMITIVE_SHIFT | vat;
|
||||
text = QStringLiteral("PRIMITIVE %1 (%2) %3 vertices %4 bytes/vertex %5 total bytes")
|
||||
.arg(QString::fromStdString(name))
|
||||
.arg(opcode, 2, 16, QLatin1Char('0'))
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <utility>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
|
||||
@ -273,7 +273,7 @@ bool VKGfx::BindBackbuffer(const ClearColor& clear_color)
|
||||
else
|
||||
{
|
||||
ERROR_LOG_FMT(VIDEO, "Unknown present error {:#010X} {}, please report.",
|
||||
Common::ToUnderlying(res), VkResultToString(res));
|
||||
std::to_underlying(res), VkResultToString(res));
|
||||
m_swap_chain->RecreateSwapChain();
|
||||
}
|
||||
|
||||
@ -286,8 +286,8 @@ bool VKGfx::BindBackbuffer(const ClearColor& clear_color)
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlertFmt("Failed to grab image from swap chain: {:#010X} {}",
|
||||
Common::ToUnderlying(res), VkResultToString(res));
|
||||
PanicAlertFmt("Failed to grab image from swap chain: {:#010X} {}", std::to_underlying(res),
|
||||
VkResultToString(res));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
|
||||
#include <cstring>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Core/DolphinAnalytics.h"
|
||||
#include "Core/System.h"
|
||||
@ -112,7 +112,7 @@ void CPState::LoadCPReg(u8 sub_cmd, u32 value)
|
||||
WARN_LOG_FMT(VIDEO,
|
||||
"CP MATINDEX_A: an exact value of {:02x} was expected "
|
||||
"but instead a value of {:02x} was seen",
|
||||
Common::ToUnderlying(MATINDEX_A), sub_cmd);
|
||||
std::to_underlying(MATINDEX_A), sub_cmd);
|
||||
}
|
||||
|
||||
matrix_index_a.Hex = value;
|
||||
@ -125,7 +125,7 @@ void CPState::LoadCPReg(u8 sub_cmd, u32 value)
|
||||
WARN_LOG_FMT(VIDEO,
|
||||
"CP MATINDEX_B: an exact value of {:02x} was expected "
|
||||
"but instead a value of {:02x} was seen",
|
||||
Common::ToUnderlying(MATINDEX_B), sub_cmd);
|
||||
std::to_underlying(MATINDEX_B), sub_cmd);
|
||||
}
|
||||
|
||||
matrix_index_b.Hex = value;
|
||||
@ -138,7 +138,7 @@ void CPState::LoadCPReg(u8 sub_cmd, u32 value)
|
||||
WARN_LOG_FMT(VIDEO,
|
||||
"CP VCD_LO: an exact value of {:02x} was expected "
|
||||
"but instead a value of {:02x} was seen",
|
||||
Common::ToUnderlying(VCD_LO), sub_cmd);
|
||||
std::to_underlying(VCD_LO), sub_cmd);
|
||||
}
|
||||
|
||||
vtx_desc.low.Hex = value;
|
||||
@ -151,7 +151,7 @@ void CPState::LoadCPReg(u8 sub_cmd, u32 value)
|
||||
WARN_LOG_FMT(VIDEO,
|
||||
"CP VCD_HI: an exact value of {:02x} was expected "
|
||||
"but instead a value of {:02x} was seen",
|
||||
Common::ToUnderlying(VCD_HI), sub_cmd);
|
||||
std::to_underlying(VCD_HI), sub_cmd);
|
||||
}
|
||||
|
||||
vtx_desc.high.Hex = value;
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
|
||||
#include "VideoCommon/Resources/MaterialResource.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <xxh3.h>
|
||||
|
||||
#include "Common/VariantUtil.h"
|
||||
@ -30,7 +32,7 @@ SamplerState CalculateSamplerAnisotropy(const SamplerState& initial_sampler)
|
||||
if (g_ActiveConfig.iMaxAnisotropy != AnisotropicFilteringMode::Default &&
|
||||
IsAnisotropicEnhancementSafe(state.tm0))
|
||||
{
|
||||
state.tm0.anisotropic_filtering = Common::ToUnderlying(g_ActiveConfig.iMaxAnisotropy);
|
||||
state.tm0.anisotropic_filtering = std::to_underlying(g_ActiveConfig.iMaxAnisotropy);
|
||||
}
|
||||
|
||||
if (state.tm0.anisotropic_filtering != 0)
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/EnumUtils.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Hash.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
@ -1031,7 +1030,7 @@ SamplerState TextureCacheBase::GetSamplerState(u32 index, float custom_tex_scale
|
||||
if (g_ActiveConfig.iMaxAnisotropy != AnisotropicFilteringMode::Default &&
|
||||
IsAnisotropicEnhancementSafe(tm0))
|
||||
{
|
||||
state.tm0.anisotropic_filtering = Common::ToUnderlying(g_ActiveConfig.iMaxAnisotropy);
|
||||
state.tm0.anisotropic_filtering = std::to_underlying(g_ActiveConfig.iMaxAnisotropy);
|
||||
}
|
||||
|
||||
if (state.tm0.anisotropic_filtering != 0)
|
||||
|
||||
@ -3,7 +3,8 @@
|
||||
|
||||
#include "VideoCommon/UberShaderCommon.h"
|
||||
|
||||
#include "Common/EnumUtils.h"
|
||||
#include <utility>
|
||||
|
||||
#include "VideoCommon/NativeVertexFormat.h"
|
||||
#include "VideoCommon/ShaderGenCommon.h"
|
||||
#include "VideoCommon/VideoCommon.h"
|
||||
@ -120,11 +121,11 @@ void WriteVertexLighting(ShaderCode& out, APIType api_type, std::string_view wor
|
||||
out.Write(" if ({} != 0u) {{\n", BitfieldExtract<&LitChannel::enablelighting>("alphareg"));
|
||||
out.Write(" if ({} != 0u) {{\n", BitfieldExtract<&LitChannel::ambsource>("alphareg"));
|
||||
out.Write(" if ((components & ({}u << chan)) != 0u) // VB_HAS_COL0\n",
|
||||
Common::ToUnderlying(VB_HAS_COL0));
|
||||
std::to_underlying(VB_HAS_COL0));
|
||||
out.Write(" lacc.w = int(round(((chan == 0u) ? {}.w : {}.w) * 255.0));\n", in_color_0_var,
|
||||
in_color_1_var);
|
||||
out.Write(" else if ((components & {}u) != 0u) // VB_HAS_COLO0\n",
|
||||
Common::ToUnderlying(VB_HAS_COL0));
|
||||
std::to_underlying(VB_HAS_COL0));
|
||||
out.Write(" lacc.w = int(round({}.w * 255.0));\n", in_color_0_var);
|
||||
out.Write(" else\n"
|
||||
" lacc.w = 255;\n"
|
||||
|
||||
@ -3,7 +3,8 @@
|
||||
|
||||
#include "VideoCommon/UberShaderVertex.h"
|
||||
|
||||
#include "Common/EnumUtils.h"
|
||||
#include <utility>
|
||||
|
||||
#include "VideoCommon/ConstantManager.h"
|
||||
#include "VideoCommon/DriverDetails.h"
|
||||
#include "VideoCommon/NativeVertexFormat.h"
|
||||
@ -224,7 +225,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{
|
||||
"float3 N2;\n"
|
||||
"\n"
|
||||
"if ((components & {}u) != 0u) {{ // VB_HAS_POSMTXIDX\n",
|
||||
Common::ToUnderlying(VB_HAS_POSMTXIDX));
|
||||
std::to_underlying(VB_HAS_POSMTXIDX));
|
||||
LoadVertexAttribute(out, host_config, 2, "posmtx", "uint4", "ubyte4");
|
||||
out.Write(" // Vertex format has a per-vertex matrix\n"
|
||||
" int posidx = int(posmtx.r);\n"
|
||||
@ -256,7 +257,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{
|
||||
"float3 _rawbinormal;\n"
|
||||
"if ((components & {}u) != 0u) // VB_HAS_NORMAL\n"
|
||||
"{{\n",
|
||||
Common::ToUnderlying(VB_HAS_NORMAL));
|
||||
std::to_underlying(VB_HAS_NORMAL));
|
||||
LoadVertexAttribute(out, host_config, 2, "rawnormal", "float3", "float3");
|
||||
out.Write(" _rawnormal = rawnormal;\n"
|
||||
"}}\n"
|
||||
@ -267,7 +268,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{
|
||||
"\n"
|
||||
"if ((components & {}u) != 0u) // VB_HAS_TANGENT\n"
|
||||
"{{\n",
|
||||
Common::ToUnderlying(VB_HAS_TANGENT));
|
||||
std::to_underlying(VB_HAS_TANGENT));
|
||||
LoadVertexAttribute(out, host_config, 2, "rawtangent", "float3", "float3");
|
||||
out.Write(" _rawtangent = rawtangent;\n"
|
||||
"}}\n"
|
||||
@ -278,7 +279,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{
|
||||
"\n"
|
||||
"if ((components & {}u) != 0u) // VB_HAS_BINORMAL\n"
|
||||
"{{\n",
|
||||
Common::ToUnderlying(VB_HAS_BINORMAL));
|
||||
std::to_underlying(VB_HAS_BINORMAL));
|
||||
LoadVertexAttribute(out, host_config, 2, "rawbinormal", "float3", "float3");
|
||||
out.Write(" _rawbinormal = rawbinormal;\n"
|
||||
"}}\n"
|
||||
@ -320,14 +321,14 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{
|
||||
"}}\n"
|
||||
"else if ((components & {}u) != 0u) // VB_HAS_COL0\n"
|
||||
"{{\n",
|
||||
Common::ToUnderlying(VB_HAS_COL0));
|
||||
std::to_underlying(VB_HAS_COL0));
|
||||
LoadVertexAttribute(out, host_config, 2, "rawcolor0", "float4", "ubyte4");
|
||||
out.Write(" vertex_color_0 = rawcolor0;\n"
|
||||
" vertex_color_1 = rawcolor0;\n"
|
||||
"}}\n"
|
||||
"else if ((components & {}u) != 0u) // VB_HAS_COL1\n"
|
||||
"{{\n",
|
||||
Common::ToUnderlying(VB_HAS_COL1));
|
||||
std::to_underlying(VB_HAS_COL1));
|
||||
LoadVertexAttribute(out, host_config, 2, "rawcolor1", "float4", "ubyte4");
|
||||
out.Write(" vertex_color_0 = rawcolor1;\n"
|
||||
" vertex_color_1 = rawcolor1;\n"
|
||||
@ -347,7 +348,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{
|
||||
|
||||
if (host_config.backend_vs_point_line_expand)
|
||||
{
|
||||
out.Write("if (vs_expand == {}u) {{ // Line\n", Common::ToUnderlying(VSExpand::Line));
|
||||
out.Write("if (vs_expand == {}u) {{ // Line\n", std::to_underlying(VSExpand::Line));
|
||||
out.Write(" bool is_bottom = (gl_VertexID & 2) != 0;\n"
|
||||
" bool is_right = (gl_VertexID & 1) != 0;\n"
|
||||
" uint other_base_offset = vertex_base_offset;\n"
|
||||
@ -362,7 +363,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{
|
||||
" float4 other_p1 = P1;\n"
|
||||
" float4 other_p2 = P2;\n"
|
||||
" if ((components & {}u) != 0u) {{ // VB_HAS_POSMTXIDX\n",
|
||||
Common::ToUnderlying(VB_HAS_POSMTXIDX));
|
||||
std::to_underlying(VB_HAS_POSMTXIDX));
|
||||
out.Write(" uint other_posidx = load_input_uint4_ubyte4(other_base_offset, "
|
||||
"vertex_offset_posmtx).r;\n"
|
||||
" other_p0 = " I_TRANSFORMMATRICES "[other_posidx];\n"
|
||||
@ -372,7 +373,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{
|
||||
" float4 other_pos = float4(dot(other_p0, other_rawpos), "
|
||||
"dot(other_p1, other_rawpos), dot(other_p2, other_rawpos), 1.0);\n");
|
||||
GenerateVSLineExpansion(out, " ", num_texgen);
|
||||
out.Write("}} else if (vs_expand == {}u) {{ // Point\n", Common::ToUnderlying(VSExpand::Point));
|
||||
out.Write("}} else if (vs_expand == {}u) {{ // Point\n", std::to_underlying(VSExpand::Point));
|
||||
out.Write(" bool is_bottom = (gl_VertexID & 2) != 0;\n"
|
||||
" bool is_right = (gl_VertexID & 1) != 0;\n");
|
||||
GenerateVSPointExpansion(out, " ", num_texgen);
|
||||
@ -552,7 +553,7 @@ static void GenVertexShaderTexGens(APIType api_type, const ShaderHostConfig& hos
|
||||
out.Write(" case {:s}:\n", SourceRow::Normal);
|
||||
out.Write(" if ((components & {}u) != 0u) // VB_HAS_NORMAL\n"
|
||||
" {{\n",
|
||||
Common::ToUnderlying(VB_HAS_NORMAL));
|
||||
std::to_underlying(VB_HAS_NORMAL));
|
||||
LoadVertexAttribute(out, host_config, 6, "rawnormal", "float3", "float3");
|
||||
out.Write(" coord.xyz = rawnormal.xyz;\n"
|
||||
" }}\n"
|
||||
@ -560,7 +561,7 @@ static void GenVertexShaderTexGens(APIType api_type, const ShaderHostConfig& hos
|
||||
out.Write(" case {:s}:\n", SourceRow::BinormalT);
|
||||
out.Write(" if ((components & {}u) != 0u) // VB_HAS_TANGENT\n"
|
||||
" {{\n",
|
||||
Common::ToUnderlying(VB_HAS_TANGENT));
|
||||
std::to_underlying(VB_HAS_TANGENT));
|
||||
LoadVertexAttribute(out, host_config, 6, "rawtangent", "float3", "float3");
|
||||
out.Write(" coord.xyz = rawtangent.xyz;\n"
|
||||
" }}\n"
|
||||
@ -568,14 +569,14 @@ static void GenVertexShaderTexGens(APIType api_type, const ShaderHostConfig& hos
|
||||
out.Write(" case {:s}:\n", SourceRow::BinormalB);
|
||||
out.Write(" if ((components & {}u) != 0u) // VB_HAS_BINORMAL\n"
|
||||
" {{\n",
|
||||
Common::ToUnderlying(VB_HAS_BINORMAL));
|
||||
std::to_underlying(VB_HAS_BINORMAL));
|
||||
LoadVertexAttribute(out, host_config, 6, "rawbinormal", "float3", "float3");
|
||||
out.Write(" coord.xyz = rawbinormal.xyz;\n"
|
||||
" }}\n"
|
||||
" break;\n\n");
|
||||
for (u32 i = 0; i < 8; i++)
|
||||
{
|
||||
out.Write(" case {:s}:\n", static_cast<SourceRow>(Common::ToUnderlying(SourceRow::Tex0) + i));
|
||||
out.Write(" case {:s}:\n", static_cast<SourceRow>(std::to_underlying(SourceRow::Tex0) + i));
|
||||
out.Write(" if ((components & {}u) != 0u) // VB_HAS_UV{}\n"
|
||||
" {{\n",
|
||||
VB_HAS_UV0 << i, i);
|
||||
@ -632,7 +633,7 @@ static void GenVertexShaderTexGens(APIType api_type, const ShaderHostConfig& hos
|
||||
out.Write(" default:\n"
|
||||
" {{\n");
|
||||
out.Write(" if ((components & ({}u /* VB_HAS_TEXMTXIDX0 */ << texgen)) != 0u) {{\n",
|
||||
Common::ToUnderlying(VB_HAS_TEXMTXIDX0));
|
||||
std::to_underlying(VB_HAS_TEXMTXIDX0));
|
||||
if (host_config.backend_dynamic_vertex_loader || host_config.backend_vs_point_line_expand)
|
||||
{
|
||||
out.Write(" int tmp = int(load_input_float3_rawtex(vertex_base_offset, "
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user