diff --git a/Source/Android/jni/GpuDriver.cpp b/Source/Android/jni/GpuDriver.cpp index 0631ce81cb..bb2d7b3208 100644 --- a/Source/Android/jni/GpuDriver.cpp +++ b/Source/Android/jni/GpuDriver.cpp @@ -7,6 +7,7 @@ #include +#include "Common/EnumUtils.h"` #include "Common/IniFile.h" #include "jni/AndroidCommon/AndroidCommon.h" #include "jni/AndroidCommon/IDCache.h" @@ -69,7 +70,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("{}", driverProperties.driverID); + driverId = fmt::format("{}", Common::ToUnderlying(driverProperties.driverID)); } else { diff --git a/Source/Core/Common/HRWrap.cpp b/Source/Core/Common/HRWrap.cpp index d815078fec..54fda4a890 100644 --- a/Source/Core/Common/HRWrap.cpp +++ b/Source/Core/Common/HRWrap.cpp @@ -3,8 +3,6 @@ #include "HRWrap.h" -#include - namespace Common { std::string GetHResultMessage(HRESULT hr) @@ -12,4 +10,8 @@ std::string GetHResultMessage(HRESULT hr) auto err = winrt::hresult_error(hr); return winrt::to_string(err.message()); } +std::string GetHResultMessage(const winrt::hresult& hr) +{ + return GetHResultMessage(hr.value); +} } // namespace Common diff --git a/Source/Core/Common/HRWrap.h b/Source/Core/Common/HRWrap.h index e1a82f51fd..9fefc353bd 100644 --- a/Source/Core/Common/HRWrap.h +++ b/Source/Core/Common/HRWrap.h @@ -6,6 +6,7 @@ #include #include #include +#include #include "Common/CommonTypes.h" @@ -33,3 +34,14 @@ struct fmt::formatter static_cast(hr.m_hr)); } }; + +template <> +struct fmt::formatter +{ + constexpr auto parse(fmt::format_parse_context& ctx) { return ctx.begin(); } + template + auto format(const winrt::hresult& hr, FormatContext& ctx) const + { + return fmt::format_to(ctx.out(), "{} ({:#010x})", Common::GetHResultMessage(hr), hr.value); + } +}; diff --git a/Source/Core/Common/Swap.h b/Source/Core/Common/Swap.h index 531d4b4cd0..965d1aabc2 100644 --- a/Source/Core/Common/Swap.h +++ b/Source/Core/Common/Swap.h @@ -16,6 +16,8 @@ #include #endif +#include + #include "Common/CommonTypes.h" namespace Common @@ -183,3 +185,15 @@ private: value_type raw; }; } // Namespace Common + +template +struct fmt::formatter> +{ + fmt::formatter m_formatter; + constexpr auto parse(format_parse_context& ctx) { return m_formatter.parse(ctx); } + template + auto format(const Common::BigEndianValue& value, FormatContext& ctx) const + { + return m_formatter.format(value.operator value_type(), ctx); + } +}; diff --git a/Source/Core/InputCommon/ControllerInterface/WGInput/WGInput.cpp b/Source/Core/InputCommon/ControllerInterface/WGInput/WGInput.cpp index fc6441bb8d..b31c5f1f8e 100644 --- a/Source/Core/InputCommon/ControllerInterface/WGInput/WGInput.cpp +++ b/Source/Core/InputCommon/ControllerInterface/WGInput/WGInput.cpp @@ -23,6 +23,7 @@ #include +#include "Common/HRWrap.h" #include "Common/Logging/Log.h" #include "Common/StringUtil.h" #include "InputCommon/ControllerInterface/ControllerInterface.h" @@ -506,7 +507,7 @@ private: catch (winrt::hresult_error error) { ERROR_LOG_FMT(CONTROLLERINTERFACE, - "WGInput: IRawGameController::GetCurrentReading failed: {:x}", error.code()); + "WGInput: IRawGameController::GetCurrentReading failed: {}", error.code()); } // IGamepad: @@ -518,7 +519,7 @@ private: } catch (winrt::hresult_error error) { - ERROR_LOG_FMT(CONTROLLERINTERFACE, "WGInput: IGamepad::GetCurrentReading failed: {:x}", + ERROR_LOG_FMT(CONTROLLERINTERFACE, "WGInput: IGamepad::GetCurrentReading failed: {}", error.code()); } } diff --git a/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.cpp b/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.cpp index 99c3e9487e..cbb3046f4d 100644 --- a/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.cpp +++ b/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.cpp @@ -4,7 +4,8 @@ #include "VideoCommon/Assets/DirectFilesystemAssetLibrary.h" #include -#include + +#include #include "Common/FileUtil.h" #include "Common/Logging/Log.h" diff --git a/Source/Core/VideoCommon/BPMemory.h b/Source/Core/VideoCommon/BPMemory.h index 974e00dfa3..db3e32763e 100644 --- a/Source/Core/VideoCommon/BPMemory.h +++ b/Source/Core/VideoCommon/BPMemory.h @@ -1863,7 +1863,7 @@ enum class ColorChannel : u32 template <> struct fmt::formatter : EnumFormatter { - formatter() : EnumFormatter({"Red", "Green", "Blue", "Alpha"}) {} + constexpr formatter() : EnumFormatter({"Red", "Green", "Blue", "Alpha"}) {} }; enum class KonstSel : u32 diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index 3c942ed8c2..7c8b74fb5e 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -98,7 +98,6 @@ struct EFBCopyParams template <> struct fmt::formatter { - std::shared_ptr state; constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); } template auto format(const EFBCopyParams& uid, FormatContext& ctx) const