Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #10209 from Pokechu22/assert-fmt
Assertion and panic alert improvements
- Loading branch information
Showing
93 changed files
with
613 additions
and
506 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // Copyright 2021 Dolphin Emulator Project | ||
| // SPDX-License-Identifier: GPL-2.0-or-later | ||
|
|
||
| #include "HRWrap.h" | ||
|
|
||
| #include <comdef.h> | ||
| #include "Common/StringUtil.h" | ||
|
|
||
| namespace Common | ||
| { | ||
| std::string GetHResultMessage(HRESULT hr) | ||
| { | ||
| // See https://stackoverflow.com/a/7008111 | ||
| _com_error err(hr); | ||
| return TStrToUTF8(err.ErrorMessage()); | ||
| } | ||
| } // namespace Common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // Copyright 2021 Dolphin Emulator Project | ||
| // SPDX-License-Identifier: GPL-2.0-or-later | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <fmt/format.h> | ||
| #include <string> | ||
| #include <winerror.h> | ||
|
|
||
| namespace Common | ||
| { | ||
| std::string GetHResultMessage(HRESULT hr); | ||
|
|
||
| // Wrapper for HRESULT to be used with fmt. Note that we can't create a fmt::formatter directly | ||
| // for HRESULT as HRESULT is simply a typedef on long and not a distinct type. | ||
| struct HRWrap | ||
| { | ||
| constexpr explicit HRWrap(HRESULT hr) : m_hr(hr) {} | ||
| const HRESULT m_hr; | ||
| }; | ||
| } // namespace Common | ||
|
|
||
| template <> | ||
| struct fmt::formatter<Common::HRWrap> | ||
| { | ||
| constexpr auto parse(fmt::format_parse_context& ctx) { return ctx.begin(); } | ||
| template <typename FormatContext> | ||
| auto format(const Common::HRWrap& hr, FormatContext& ctx) | ||
| { | ||
| return fmt::format_to(ctx.out(), "{} ({:#010x})", Common::GetHResultMessage(hr.m_hr), | ||
| static_cast<u32>(hr.m_hr)); | ||
| } | ||
| }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.