Compare commits
No commits in common. "76210e147aedef4455fc48339c044020557563d6" and "8f1e3668a3318ad46aaf3b15e6f92be3c04ab848" have entirely different histories.
76210e147a
...
8f1e3668a3
9 changed files with 72 additions and 197 deletions
|
@ -136,7 +136,7 @@ add_executable(MassBuilderSaveTool WIN32
|
|||
Mass/WeaponPart.h
|
||||
Maps/Accessories.h
|
||||
Maps/ArmourSets.h
|
||||
Maps/ArmourSlots.hpp
|
||||
Maps/ArmourSlots.h
|
||||
Maps/DamageTypes.hpp
|
||||
Maps/LastMissionId.h
|
||||
Maps/StoryProgress.h
|
||||
|
@ -144,7 +144,6 @@ add_executable(MassBuilderSaveTool WIN32
|
|||
Maps/WeaponTypes.hpp
|
||||
ToastQueue/ToastQueue.h
|
||||
ToastQueue/ToastQueue.cpp
|
||||
Utilities/Crc32.h
|
||||
FontAwesome/IconsFontAwesome5.h
|
||||
FontAwesome/IconsFontAwesome5Brands.h
|
||||
resource.rc
|
||||
|
|
61
src/Maps/ArmourSlots.h
Normal file
61
src/Maps/ArmourSlots.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
#pragma once
|
||||
|
||||
// MassBuilderSaveTool
|
||||
// Copyright (C) 2021-2022 Guillaume Jacquemin
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
static const std::unordered_map<std::string, const char*> armour_slots {
|
||||
{"enuArmorSlots::NewEnumerator0", "Face"},
|
||||
{"enuArmorSlots::NewEnumerator1", "Upper head"},
|
||||
{"enuArmorSlots::NewEnumerator2", "Lower head"},
|
||||
{"enuArmorSlots::NewEnumerator3", "Neck"},
|
||||
{"enuArmorSlots::NewEnumerator4", "Upper body"},
|
||||
{"enuArmorSlots::NewEnumerator5", "Middle body"},
|
||||
{"enuArmorSlots::NewEnumerator23", "Backpack"},
|
||||
{"enuArmorSlots::NewEnumerator6", "Lower body"},
|
||||
{"enuArmorSlots::NewEnumerator7", "Front waist"},
|
||||
{"enuArmorSlots::NewEnumerator8", "Left front skirt"},
|
||||
{"enuArmorSlots::NewEnumerator9", "Right front skirt"},
|
||||
{"enuArmorSlots::NewEnumerator10", "Left side skirt"},
|
||||
{"enuArmorSlots::NewEnumerator11", "Right side skirt"},
|
||||
{"enuArmorSlots::NewEnumerator12", "Left back skirt"},
|
||||
{"enuArmorSlots::NewEnumerator13", "Right side skirt"},
|
||||
{"enuArmorSlots::NewEnumerator14", "Back waist"},
|
||||
{"enuArmorSlots::NewEnumerator15", "Left shoulder"},
|
||||
{"enuArmorSlots::NewEnumerator16", "Right shoulder"},
|
||||
{"enuArmorSlots::NewEnumerator17", "Left upper arm"},
|
||||
{"enuArmorSlots::NewEnumerator18", "Right upper arm"},
|
||||
{"enuArmorSlots::NewEnumerator19", "Left elbow"},
|
||||
{"enuArmorSlots::NewEnumerator20", "Right elbow"},
|
||||
{"enuArmorSlots::NewEnumerator21", "Left lower arm"},
|
||||
{"enuArmorSlots::NewEnumerator22", "Right lower arm"},
|
||||
{"enuArmorSlots::NewEnumerator24", "Left hand"},
|
||||
{"enuArmorSlots::NewEnumerator25", "Right hand"},
|
||||
{"enuArmorSlots::NewEnumerator26", "Left upper leg"},
|
||||
{"enuArmorSlots::NewEnumerator27", "Right upper leg"},
|
||||
{"enuArmorSlots::NewEnumerator28", "Left knee"},
|
||||
{"enuArmorSlots::NewEnumerator29", "Right knee"},
|
||||
{"enuArmorSlots::NewEnumerator30", "Left lower leg"},
|
||||
{"enuArmorSlots::NewEnumerator31", "Right lower leg"},
|
||||
{"enuArmorSlots::NewEnumerator32", "Left ankle"},
|
||||
{"enuArmorSlots::NewEnumerator33", "Right ankle"},
|
||||
{"enuArmorSlots::NewEnumerator34", "Left heel"},
|
||||
{"enuArmorSlots::NewEnumerator35", "Right heel"},
|
||||
{"enuArmorSlots::NewEnumerator36", "Left foot"},
|
||||
{"enuArmorSlots::NewEnumerator37", "Right foot"},
|
||||
};
|
|
@ -1,56 +0,0 @@
|
|||
// MassBuilderSaveTool
|
||||
// Copyright (C) 2021-2022 Guillaume Jacquemin
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#ifdef c
|
||||
c(Face, "enuArmorSlots::NewEnumerator0", "Face")
|
||||
c(UpperHead, "enuArmorSlots::NewEnumerator1", "Upper head")
|
||||
c(LowerHead, "enuArmorSlots::NewEnumerator2", "Lower head")
|
||||
c(Neck, "enuArmorSlots::NewEnumerator3", "Neck")
|
||||
c(UpperBody, "enuArmorSlots::NewEnumerator4", "Upper body")
|
||||
c(MiddleBody, "enuArmorSlots::NewEnumerator5", "Middle body")
|
||||
c(LowerBody, "enuArmorSlots::NewEnumerator6", "Lower body")
|
||||
c(FrontWaist, "enuArmorSlots::NewEnumerator7", "Front waist")
|
||||
c(LeftFrontSkirt, "enuArmorSlots::NewEnumerator8", "Left front skirt")
|
||||
c(RightFrontSkirt, "enuArmorSlots::NewEnumerator9", "Right front skirt")
|
||||
c(LeftSideSkirt, "enuArmorSlots::NewEnumerator10", "Left side skirt")
|
||||
c(RightSideSkirt, "enuArmorSlots::NewEnumerator11", "Right side skirt")
|
||||
c(LeftBackSkirt, "enuArmorSlots::NewEnumerator12", "Left back skirt")
|
||||
c(RightBackSkirt, "enuArmorSlots::NewEnumerator13", "Right back skirt")
|
||||
c(BackWaist, "enuArmorSlots::NewEnumerator14", "Back waist")
|
||||
c(LeftShoulder, "enuArmorSlots::NewEnumerator15", "Left shoulder")
|
||||
c(RightShoulder, "enuArmorSlots::NewEnumerator16", "Right shoulder")
|
||||
c(LeftUpperArm, "enuArmorSlots::NewEnumerator17", "Left upper arm")
|
||||
c(RightUpperArm, "enuArmorSlots::NewEnumerator18", "Right upper arm")
|
||||
c(LeftElbow, "enuArmorSlots::NewEnumerator19", "Left elbow")
|
||||
c(RightElbow, "enuArmorSlots::NewEnumerator20", "Right elbow")
|
||||
c(LeftLowerArm, "enuArmorSlots::NewEnumerator21", "Left lower arm")
|
||||
c(RightLowerArm, "enuArmorSlots::NewEnumerator22", "Right lower arm")
|
||||
c(Backpack, "enuArmorSlots::NewEnumerator23", "Backpack")
|
||||
c(LeftHand, "enuArmorSlots::NewEnumerator24", "Left hand")
|
||||
c(RightHand, "enuArmorSlots::NewEnumerator25", "Right hand")
|
||||
c(LeftUpperLeg, "enuArmorSlots::NewEnumerator26", "Left upper leg")
|
||||
c(RightUpperLeg, "enuArmorSlots::NewEnumerator27", "Right upper leg")
|
||||
c(LeftKnee, "enuArmorSlots::NewEnumerator28", "Left knee")
|
||||
c(RightKnee, "enuArmorSlots::NewEnumerator29", "Right knee")
|
||||
c(LeftLowerLeg, "enuArmorSlots::NewEnumerator30", "Left lower leg")
|
||||
c(RightLowerLeg, "enuArmorSlots::NewEnumerator31", "Right lower leg")
|
||||
c(LeftAnkle, "enuArmorSlots::NewEnumerator32", "Left ankle")
|
||||
c(RightAnkle, "enuArmorSlots::NewEnumerator33", "Right ankle")
|
||||
c(LeftHeel, "enuArmorSlots::NewEnumerator34", "Left heel")
|
||||
c(RightHeel, "enuArmorSlots::NewEnumerator35", "Right heel")
|
||||
c(LeftFoot, "enuArmorSlots::NewEnumerator36", "Left foot")
|
||||
c(RightFoot, "enuArmorSlots::NewEnumerator37", "Right foot")
|
||||
#endif
|
|
@ -28,49 +28,8 @@
|
|||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
enum class ArmourSlot {
|
||||
Face = 0,
|
||||
UpperHead = 1,
|
||||
LowerHead = 2,
|
||||
Neck = 3,
|
||||
UpperBody = 4,
|
||||
MiddleBody = 5,
|
||||
LowerBody = 6,
|
||||
FrontWaist = 7,
|
||||
LeftFrontSkirt = 8,
|
||||
RightFrontSkirt = 9,
|
||||
LeftSideSkirt = 10,
|
||||
RightSideSkirt = 11,
|
||||
LeftBackSkirt = 12,
|
||||
RightBackSkirt = 13,
|
||||
BackWaist = 14,
|
||||
LeftShoulder = 15,
|
||||
RightShoulder = 16,
|
||||
LeftUpperArm = 17,
|
||||
RightUpperArm = 18,
|
||||
LeftElbow = 19,
|
||||
RightElbow = 20,
|
||||
LeftLowerArm = 21,
|
||||
RightLowerArm = 22,
|
||||
Backpack = 23,
|
||||
LeftHand = 24,
|
||||
RightHand = 25,
|
||||
LeftUpperLeg = 26,
|
||||
RightUpperLeg = 27,
|
||||
LeftKnee = 28,
|
||||
RightKnee = 29,
|
||||
LeftLowerLeg = 30,
|
||||
RightLowerLeg = 31,
|
||||
LeftAnkle = 32,
|
||||
RightAnkle = 33,
|
||||
LeftHeel = 34,
|
||||
RightHeel = 35,
|
||||
LeftFoot = 36,
|
||||
RightFoot = 37,
|
||||
};
|
||||
|
||||
struct ArmourPart {
|
||||
ArmourSlot slot = ArmourSlot::Face;
|
||||
std::string slot;
|
||||
Int id = 0;
|
||||
Containers::StaticArray<4, Int> styles{ValueInit};
|
||||
UnsignedInt demoDecals = 8;
|
||||
|
|
|
@ -583,15 +583,7 @@ void Mass::getArmourParts() {
|
|||
auto part_prop = armour_array->at<GenericStructProperty>(i);
|
||||
auto& part = _armour.parts[i];
|
||||
|
||||
auto& armour_slot = part_prop->at<ByteProperty>("Slot_3_408BA56F4C9605C7E805CF91B642249C")->enumValue;
|
||||
#define c(enumerator, strenum, name) if(armour_slot == (strenum)) { part.slot = ArmourSlot::enumerator; } else
|
||||
#include "../Maps/ArmourSlots.hpp"
|
||||
#undef c
|
||||
{
|
||||
_state = State::Invalid;
|
||||
Utility::Warning{} << "Invalid armour slot enum value in getArmourParts().";
|
||||
}
|
||||
|
||||
part.slot = part_prop->at<ByteProperty>("Slot_3_408BA56F4C9605C7E805CF91B642249C")->enumValue;
|
||||
part.id = part_prop->at<IntProperty>("ID_5_ACD101864D3481DE96EDACACC09BDD25")->value;
|
||||
|
||||
auto part_styles = part_prop->at<ArrayProperty>("Styles_47_3E31870441DFD7DB8BEE5C85C26B365B");
|
||||
|
@ -652,16 +644,8 @@ auto Mass::writeArmourPart(UnsignedLong index) -> bool {
|
|||
|
||||
auto& part = _armour.parts[index];
|
||||
|
||||
auto& armour_slot = part_prop->at<ByteProperty>("Slot_3_408BA56F4C9605C7E805CF91B642249C")->enumValue;
|
||||
switch(part.slot) {
|
||||
#define c(enumerator, strenum, name) case ArmourSlot::enumerator: \
|
||||
if((strenum) != armour_slot) { \
|
||||
_lastError = "Armour part slot doesn't match save file."; \
|
||||
return false; \
|
||||
} \
|
||||
break;
|
||||
#include "../Maps/ArmourSlots.hpp"
|
||||
#undef c
|
||||
if(part_prop->at<ByteProperty>("Slot_3_408BA56F4C9605C7E805CF91B642249C")->enumValue != part.slot) {
|
||||
return false;
|
||||
}
|
||||
|
||||
part_prop->at<IntProperty>("ID_5_ACD101864D3481DE96EDACACC09BDD25")->value = part.id;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "../Maps/Accessories.h"
|
||||
#include "../Maps/ArmourSets.h"
|
||||
#include "../Maps/ArmourSlots.h"
|
||||
#include "../Maps/StyleNames.h"
|
||||
|
||||
#include "../FontAwesome/IconsFontAwesome5.h"
|
||||
|
@ -457,12 +458,6 @@ void SaveTool::drawArmour() {
|
|||
return;
|
||||
}
|
||||
|
||||
static const char* slot_labels[] = {
|
||||
#define c(enumerator, strenum, name) name,
|
||||
#include "../Maps/ArmourSlots.hpp"
|
||||
#undef c
|
||||
};
|
||||
|
||||
for(UnsignedInt i = 0; i < _currentMass->armourParts().size(); i++) {
|
||||
ImGui::PushID(i);
|
||||
|
||||
|
@ -473,10 +468,10 @@ void SaveTool::drawArmour() {
|
|||
std::memset(header, '\0', 129);
|
||||
|
||||
if(armour_sets.find(part.id) != armour_sets.cend()) {
|
||||
std::snprintf(header, 128, "%s: %s###%u", slot_labels[UnsignedInt(part.slot)], armour_sets.at(part.id).name, UnsignedInt(part.slot));
|
||||
std::snprintf(header, 128, "%s: %s###%s", armour_slots.at(part.slot), armour_sets.at(part.id).name, part.slot.c_str());
|
||||
}
|
||||
else {
|
||||
std::snprintf(header, 128, "%s: %i###%u", slot_labels[UnsignedInt(part.slot)], part.id, UnsignedInt(part.slot));
|
||||
std::snprintf(header, 128, "%s: %i###%s", armour_slots.at(part.slot), part.id, part.slot.c_str());
|
||||
}
|
||||
|
||||
if(ImGui::CollapsingHeader(header)) {
|
||||
|
@ -484,7 +479,7 @@ void SaveTool::drawArmour() {
|
|||
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvailWidth() * 0.491f);
|
||||
if(ImGui::BeginListBox("##ChangePart")) {
|
||||
if(std::strncmp("Neck", slot_labels[UnsignedInt(part.slot)], 4) != 0) {
|
||||
if(std::strncmp("Neck", armour_slots.at(part.slot), 4) != 0) {
|
||||
for(auto& set : armour_sets) {
|
||||
if(ImGui::Selectable(set.second.name, set.first == part.id, ImGuiSelectableFlags_SpanAvailWidth)) {
|
||||
part.id = set.first;
|
||||
|
@ -867,7 +862,7 @@ void SaveTool::drawWeaponEditor(Weapon& weapon) {
|
|||
}
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
static const char* labels[] {
|
||||
const char* labels[] {
|
||||
#define c(enumerator, strenum, name) name,
|
||||
#include "../Maps/WeaponTypes.hpp"
|
||||
#undef c
|
||||
|
|
|
@ -46,10 +46,6 @@ auto BinaryWriter::position() -> Long {
|
|||
return _ftelli64(_file);
|
||||
}
|
||||
|
||||
auto BinaryWriter::array() const -> Containers::ArrayView<const char> {
|
||||
return _data;
|
||||
}
|
||||
|
||||
auto BinaryWriter::arrayPosition() const -> UnsignedLong {
|
||||
return _index;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ class BinaryWriter {
|
|||
|
||||
auto position() -> Long;
|
||||
|
||||
auto array() const -> Containers::ArrayView<const char>;
|
||||
auto arrayPosition() const -> UnsignedLong;
|
||||
auto flushToFile() -> bool;
|
||||
|
||||
|
@ -75,7 +74,7 @@ class BinaryWriter {
|
|||
|
||||
template<typename T, typename U = std::conditional_t<std::is_trivially_copyable<T>::value, T, T&>>
|
||||
auto writeValueToArray(U value) -> UnsignedLong {
|
||||
Containers::ArrayView<T> view{&value, 1};
|
||||
Containers::ArrayView<U> view{&value, 1};
|
||||
return writeDataToArray(view);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
// MassBuilderSaveTool
|
||||
// Copyright (C) 2021-2022 Guillaume Jacquemin
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <Corrade/Containers/ArrayView.h>
|
||||
#include <Corrade/Containers/StaticArray.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
struct Crc32 {
|
||||
static const Containers::StaticArray<256, UnsignedInt> table;
|
||||
|
||||
static auto update(UnsignedInt initial, Containers::ArrayView<const void> data) -> UnsignedInt {
|
||||
UnsignedInt c = initial ^ 0xFFFFFFFF;
|
||||
auto u = Containers::arrayCast<const UnsignedByte>(data);
|
||||
|
||||
for(std::size_t i = 0; i < data.size(); ++i) {
|
||||
c = table[(c ^ u[i]) & 0xFF] ^ (c >> 8);
|
||||
}
|
||||
|
||||
return c ^ 0xFFFFFFFF;
|
||||
}
|
||||
};
|
||||
|
||||
const Containers::StaticArray<256, UnsignedInt> Crc32::table = []{
|
||||
UnsignedInt polynomial = 0xEDB88320;
|
||||
Containers::StaticArray<256, UnsignedInt> temp{ValueInit};
|
||||
|
||||
for(UnsignedInt i = 0; i < 256; i++) {
|
||||
UnsignedInt c = i;
|
||||
|
||||
for(std::size_t j = 0; j < 8; j++) {
|
||||
if(c & 1) {
|
||||
c = polynomial ^ (c >> 1);
|
||||
}
|
||||
else {
|
||||
c >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
temp[i] = c;
|
||||
}
|
||||
|
||||
return temp;
|
||||
}();
|
Loading…
Reference in a new issue