@ -2,8 +2,8 @@
// Licensed under GPLv2 or any later version
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
// Refer to the license.txt file included.
# include <algorithm>
# include <iterator>
# include <iterator>
# include <unordered_map>
# include <utility>
# include <utility>
# include "common/common_types.h"
# include "common/common_types.h"
@ -474,19 +474,14 @@ static const std::pair<u16, const char*> register_names[] = {
{ 0x2DD , " GPUREG_VSH_OPDESCS_DATA7 " } ,
{ 0x2DD , " GPUREG_VSH_OPDESCS_DATA7 " } ,
} ;
} ;
std : : string Regs : : GetCommandName ( int index ) {
const char * Regs : : GetRegisterName ( u16 index ) {
static std : : unordered_map < u32 , const char * > map ;
auto found = std : : lower_bound ( std : : begin ( register_names ) , std : : end ( register_names ) , index ,
[ ] ( auto p , auto i ) { return p . first < i ; } ) ;
if ( map . empty ( ) ) {
if ( found - > first = = index ) {
map . insert ( std : : begin ( register_names ) , std : : end ( register_names ) ) ;
return found - > second ;
}
// Return empty string if no match is found
auto it = map . find ( index ) ;
if ( it ! = map . end ( ) ) {
return it - > second ;
} else {
} else {
return std : : string ( ) ;
// Return empty string if no match is found
return " " ;
}
}
}
}