Compare commits

..

No commits in common. "a290542f6ed7e6eb02b2840782830457a17573dc" and "e1e82c0c434f7ff31f81df43b146488b6f3829e1" have entirely different histories.

3 changed files with 56 additions and 117 deletions

View file

@ -175,50 +175,50 @@ Application::drawBackupListPopup() {
ImGui::TableSetColumnIndex(3); ImGui::TableSetColumnIndex(3);
ImGui::TextUnformatted("Actions"); ImGui::TextUnformatted("Actions");
//drawBackupFolder(_backupManager->vfs()); drawBackupFolder(_backupManager->vfs());
for(std::size_t i = 0; i < _backupManager->backups().size(); ++i) { //for(std::size_t i = 0; i < _backupManager->backups().size(); ++i) {
auto& backup = _backupManager->backups()[i]; // auto& backup = _backupManager->backups()[i];
ImGui::TableNextRow(); // ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0); // ImGui::TableSetColumnIndex(0);
ImGui::TextUnformatted(backup.company.cbegin(), backup.company.cend()); // ImGui::TextUnformatted(backup.company.cbegin(), backup.company.cend());
if(ImGui::IsItemHovered() && ImGui::BeginTooltip()) { // if(ImGui::IsItemHovered() && ImGui::BeginTooltip()) {
for(const auto& file : backup.includedFiles) { // for(const auto& file : backup.includedFiles) {
ImGui::TextUnformatted(file.cbegin()); // ImGui::TextUnformatted(file.cbegin());
} // }
ImGui::EndTooltip(); // ImGui::EndTooltip();
} // }
ImGui::TableSetColumnIndex(1); // ImGui::TableSetColumnIndex(1);
ImGui::Text("%.4i-%.2i-%.2i %.2i:%.2i:%.2i", // ImGui::Text("%.4i-%.2i-%.2i %.2i:%.2i:%.2i",
backup.timestamp.year, // backup.timestamp.year,
backup.timestamp.month, // backup.timestamp.month,
backup.timestamp.day, // backup.timestamp.day,
backup.timestamp.hour, // backup.timestamp.hour,
backup.timestamp.minute, // backup.timestamp.minute,
backup.timestamp.second); // backup.timestamp.second);
ImGui::TableSetColumnIndex(2); // ImGui::TableSetColumnIndex(2);
ImGui::TextUnformatted(backup.demo ? "Demo" : "Full"); // ImGui::TextUnformatted(backup.demo ? "Demo" : "Full");
ImGui::TableSetColumnIndex(3); // ImGui::TableSetColumnIndex(3);
ImGui::PushID(int(i)); // ImGui::PushID(int(i));
if(ImGui::SmallButton(ICON_FA_UNDO)) { // if(ImGui::SmallButton(ICON_FA_UNDO)) {
backup_index = i; // backup_index = i;
ImGui::OpenPopup("Restore backup##RestoreBackupModal"); // ImGui::OpenPopup("Restore backup##RestoreBackupModal");
} // }
drawTooltip("Restore"); // drawTooltip("Restore");
drawBackupRestorePopup(backup_index); // drawBackupRestorePopup(backup_index);
ImGui::SameLine(0.0f, 2.0f); // ImGui::SameLine(0.0f, 2.0f);
if(ImGui::SmallButton(ICON_FA_TRASH_ALT)) { // if(ImGui::SmallButton(ICON_FA_TRASH_ALT)) {
backup_index = i; // backup_index = i;
ImGui::OpenPopup("Delete backup##DeleteBackupModal"); // ImGui::OpenPopup("Delete backup##DeleteBackupModal");
} // }
drawTooltip("Delete"); // drawTooltip("Delete");
drawBackupDeletePopup(backup_index); // drawBackupDeletePopup(backup_index);
ImGui::PopID(); // ImGui::PopID();
} //}
ImGui::EndTable(); ImGui::EndTable();
} }

View file

@ -95,39 +95,16 @@ File::saveToFile() {
return false; return false;
} }
if(!writer.writeArray(arrayView(_magicBytes))) { if(!writer.writeArray(arrayView(_magicBytes)) ||
_lastError = "Couldn't write the magic bytes."_s; !writer.writeUint32(_saveVersion) ||
LOG_ERROR(_lastError); !writer.writeUint32(_packageVersion) ||
return false; !writer.writeUint16(_engineVersion.major) ||
}
if(!writer.writeUint32(_saveVersion)) {
_lastError = "Couldn't write the save version."_s;
LOG_ERROR(_lastError);
return false;
}
if(!writer.writeUint32(_packageVersion)) {
_lastError = "Couldn't write the package version."_s;
LOG_ERROR(_lastError);
return false;
}
if(_saveVersion == 3) {
if(!writer.writeUint32(_unknown)) {
_lastError = "Couldn't write some unknown bytes."_s;
LOG_ERROR(_lastError);
return false;
}
}
if(!writer.writeUint16(_engineVersion.major) ||
!writer.writeUint16(_engineVersion.minor) || !writer.writeUint16(_engineVersion.minor) ||
!writer.writeUint16(_engineVersion.patch) || !writer.writeUint16(_engineVersion.patch) ||
!writer.writeUint32(_engineVersion.build) || !writer.writeUint32(_engineVersion.build) ||
!writer.writeUEString(_engineVersion.buildId)) !writer.writeUEString(_engineVersion.buildId))
{ {
_lastError = "Couldn't write the engine version."_s; _lastError = "Couldn't write the header."_s;
LOG_ERROR(_lastError); LOG_ERROR(_lastError);
return false; return false;
} }
@ -221,53 +198,15 @@ File::loadData() {
return; return;
} }
if(!reader.readUint32(_saveVersion)) { if(!reader.readUint32(_saveVersion) ||
_lastError = "Couldn't read save version."; !reader.readUint32(_packageVersion) ||
LOG_ERROR(_lastError); !reader.readUint16(_engineVersion.major) ||
return; !reader.readUint16(_engineVersion.minor) ||
} !reader.readUint16(_engineVersion.patch) ||
!reader.readUint32(_engineVersion.build) ||
if(!reader.readUint32(_packageVersion)) { !reader.readUEString(_engineVersion.buildId))
_lastError = "Couldn't read package version.";
LOG_ERROR(_lastError);
return;
}
if(_saveVersion == 3) {
if(!reader.readUint32(_unknown)) {
_lastError = "Couldn't read some unknown bytes.";
LOG_ERROR(_lastError);
return;
}
}
if(!reader.readUint16(_engineVersion.major)) {
_lastError = "Couldn't read major engine version.";
LOG_ERROR(_lastError);
return;
}
if(!reader.readUint16(_engineVersion.minor)) {
_lastError = "Couldn't read minor engine version.";
LOG_ERROR(_lastError);
return;
}
if(!reader.readUint16(_engineVersion.patch)) {
_lastError = "Couldn't read patch engine version.";
LOG_ERROR(_lastError);
return;
}
if(!reader.readUint32(_engineVersion.build)) {
_lastError = "Couldn't read engine build.";
LOG_ERROR(_lastError);
return;
}
if(!reader.readUEString(_engineVersion.buildId))
{ {
_lastError = "Couldn't read engine build ID string."; _lastError = "Couldn't read version data.";
LOG_ERROR(_lastError); LOG_ERROR(_lastError);
return; return;
} }

View file

@ -17,6 +17,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <Corrade/Containers/ArrayView.h> #include <Corrade/Containers/ArrayView.h>
#include <Corrade/Containers/GrowableArray.h>
#include <Corrade/Containers/Reference.h> #include <Corrade/Containers/Reference.h>
#include <Corrade/Containers/StaticArray.h> #include <Corrade/Containers/StaticArray.h>
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>
@ -72,7 +73,6 @@ class File {
std::uint32_t _saveVersion = 0; std::uint32_t _saveVersion = 0;
std::uint32_t _packageVersion = 0; std::uint32_t _packageVersion = 0;
std::uint32_t _unknown = 0;
struct { struct {
std::uint16_t major = 0; std::uint16_t major = 0;
std::uint16_t minor = 0; std::uint16_t minor = 0;