This commit is contained in:
Nav
2023-05-01 14:05:44 +01:00
parent 9364e8f59f
commit 86a09b1a4a
3 changed files with 13 additions and 12 deletions

View File

@@ -42,6 +42,15 @@ namespace Bloom
for (const auto& snapshotFileEntry : snapshotFileEntries) {
auto snapshotFile = QFile(snapshotFileEntry.absoluteFilePath());
if (snapshots.size() >= MAX_SNAPSHOTS) {
Logger::warning(
"The total number of " + EnumToStringMappings::targetMemoryTypes.at(memoryType).toUpper().toStdString()
+ " snapshots exceeds the hard limit of " + std::to_string(MAX_SNAPSHOTS)
+ ". Only the most recent " + std::to_string(MAX_SNAPSHOTS) + " snapshots will be loaded."
);
break;
}
try {
if (!snapshotFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
throw Exceptions::Exception("Failed to open snapshot file");
@@ -57,15 +66,6 @@ namespace Bloom
}
snapshotFile.close();
if (snapshots.size() >= MAX_SNAPSHOTS) {
Logger::warning(
"The total number of " + EnumToStringMappings::targetMemoryTypes.at(memoryType).toUpper().toStdString()
+ " snapshots exceeds the hard limit of " + std::to_string(MAX_SNAPSHOTS)
+ ". Only the most recent " + std::to_string(MAX_SNAPSHOTS) + " snapshots will be loaded."
);
break;
}
}
return snapshots;

View File

@@ -1,5 +1,6 @@
#include "MemorySnapshot.hpp"
#include <QUuid>
#include <QByteArray>
#include <QJsonArray>
@@ -18,7 +19,8 @@ namespace Bloom
const std::vector<FocusedMemoryRegion>& focusedRegions,
const std::vector<ExcludedMemoryRegion>& excludedRegions
)
: name(name)
: id(QUuid::createUuid().toString(QUuid::StringFormat::WithoutBraces))
, name(name)
, description(description)
, memoryType(memoryType)
, data(data)

View File

@@ -4,7 +4,6 @@
#include <QString>
#include <utility>
#include <vector>
#include <QUuid>
#include <QJsonObject>
#include "src/Targets/TargetMemory.hpp"
@@ -18,7 +17,7 @@ namespace Bloom
struct MemorySnapshot
{
public:
QString id = QUuid::createUuid().toString(QUuid::StringFormat::WithoutBraces);
QString id;
QString name;
QString description;
Targets::TargetMemoryType memoryType;