diff options
| author | 2017-02-12 12:33:26 -0800 | |
|---|---|---|
| committer | 2017-02-12 12:33:26 -0800 | |
| commit | 443bb3d522916f9be2d27fc8b3d7b5cc942213df (patch) | |
| tree | 5a83052ad2f5888a282d4db2ef9b9f2d4e647a60 /src/video_core/regs.cpp | |
| parent | citra-qt: Don't attempt to scan files with unsupported extensions (#2402) (diff) | |
| parent | VideoCore: Split u64 Pica reg unions into 2 separate u32 unions (diff) | |
| download | yuzu-443bb3d522916f9be2d27fc8b3d7b5cc942213df.tar.gz yuzu-443bb3d522916f9be2d27fc8b3d7b5cc942213df.tar.xz yuzu-443bb3d522916f9be2d27fc8b3d7b5cc942213df.zip | |
Merge pull request #2550 from yuriks/pica-refactor2
Small VideoCore cleanups
Diffstat (limited to 'src/video_core/regs.cpp')
| -rw-r--r-- | src/video_core/regs.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/video_core/regs.cpp b/src/video_core/regs.cpp index f47e9e763..2699e710a 100644 --- a/src/video_core/regs.cpp +++ b/src/video_core/regs.cpp | |||
| @@ -2,8 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | ||
| 5 | #include <iterator> | 6 | #include <iterator> |
| 6 | #include <unordered_map> | ||
| 7 | #include <utility> | 7 | #include <utility> |
| 8 | 8 | ||
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| @@ -474,19 +474,14 @@ static const std::pair<u16, const char*> register_names[] = { | |||
| 474 | {0x2DD, "GPUREG_VSH_OPDESCS_DATA7"}, | 474 | {0x2DD, "GPUREG_VSH_OPDESCS_DATA7"}, |
| 475 | }; | 475 | }; |
| 476 | 476 | ||
| 477 | std::string Regs::GetCommandName(int index) { | 477 | const char* Regs::GetRegisterName(u16 index) { |
| 478 | static std::unordered_map<u32, const char*> map; | 478 | auto found = std::lower_bound(std::begin(register_names), std::end(register_names), index, |
| 479 | 479 | [](auto p, auto i) { return p.first < i; }); | |
| 480 | if (map.empty()) { | 480 | if (found->first == index) { |
| 481 | map.insert(std::begin(register_names), std::end(register_names)); | 481 | return found->second; |
| 482 | } | ||
| 483 | |||
| 484 | // Return empty string if no match is found | ||
| 485 | auto it = map.find(index); | ||
| 486 | if (it != map.end()) { | ||
| 487 | return it->second; | ||
| 488 | } else { | 482 | } else { |
| 489 | return std::string(); | 483 | // Return empty string if no match is found |
| 484 | return ""; | ||
| 490 | } | 485 | } |
| 491 | } | 486 | } |
| 492 | 487 | ||