diff --git a/Source/Core/Core/DSP/DSPTables.cpp b/Source/Core/Core/DSP/DSPTables.cpp index cb8a224396..191f8b3622 100644 --- a/Source/Core/Core/DSP/DSPTables.cpp +++ b/Source/Core/Core/DSP/DSPTables.cpp @@ -10,6 +10,8 @@ #include #include +#include + #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" @@ -492,18 +494,15 @@ const std::array regnames = }}; // clang-format on -const char* pdname(u16 val) +std::string pdname(u16 val) { - static char tmpstr[12]; // nasty - for (const pdlabel_t& pdlabel : pdlabels) { if (pdlabel.addr == val) return pdlabel.name; } - sprintf(tmpstr, "0x%04x", val); - return tmpstr; + return fmt::format("0x{:04x}", val); } const char* pdregname(int val) diff --git a/Source/Core/Core/DSP/DSPTables.h b/Source/Core/Core/DSP/DSPTables.h index e2a90d8e7f..8dead3acad 100644 --- a/Source/Core/Core/DSP/DSPTables.h +++ b/Source/Core/Core/DSP/DSPTables.h @@ -93,7 +93,7 @@ struct pdlabel_t extern const std::array regnames; extern const std::array pdlabels; -const char* pdname(u16 val); +std::string pdname(u16 val); const char* pdregname(int val); const char* pdregnamelong(int val);