Merge pull request #9561 from sepalani/fix-watches

Watches: Fix Save and Load from strings
This commit is contained in:
Léo Lam 2021-03-05 00:57:40 +01:00 committed by GitHub
commit 1e3e5680db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,6 +5,7 @@
#include "Common/Debug/Watches.h"
#include <algorithm>
#include <locale>
#include <sstream>
namespace Common::Debug
@ -88,11 +89,11 @@ void Watches::LoadFromStrings(const std::vector<std::string>& watches)
{
for (const std::string& watch : watches)
{
std::stringstream ss;
std::istringstream ss(watch);
ss.imbue(std::locale::classic());
u32 address;
std::string name;
ss << std::hex << watch;
ss >> address;
ss >> std::hex >> address;
ss >> std::ws;
std::getline(ss, name);
SetWatch(address, name);
@ -105,6 +106,7 @@ std::vector<std::string> Watches::SaveToStrings() const
for (const auto& watch : m_watches)
{
std::ostringstream ss;
ss.imbue(std::locale::classic());
ss << std::hex << watch.address << " " << watch.name;
watches.push_back(ss.str());
}