dolphin/Source/Core/Common/HRWrap.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
591 B
C++
Raw Normal View History

// Copyright 2021 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "HRWrap.h"
2024-08-29 22:02:28 +02:00
#ifndef _MSC_VER
#include <comdef.h>
#endif
#include "Common/StringUtil.h"
namespace Common
{
2024-08-29 22:02:28 +02:00
#ifdef _MSC_VER
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);
}
2024-08-29 22:02:28 +02:00
#else
std::string GetHResultMessage(HRESULT hr)
{
_com_error err(hr);
return TStrToUTF8(err.ErrorMessage());
}
#endif
} // namespace Common