Compare commits

..

2 commits

Author SHA1 Message Date
44656b32d5 Mass: use Logger.
Oh, and some stuff didn't initially get logged, so now I can have better
insight in case of errors.
2022-11-21 18:01:29 +01:00
9ec88fa521 Mass: QoL changes.
Now property names are behind defines, so if a name changes, I don't
have to hunt it down in up to six source files.
2022-11-21 18:00:38 +01:00
8 changed files with 517 additions and 279 deletions

View file

@ -159,6 +159,7 @@ add_executable(MassBuilderSaveTool WIN32
Mass/Mass_Weapons.cpp Mass/Mass_Weapons.cpp
Mass/Mass_Styles.cpp Mass/Mass_Styles.cpp
Mass/Mass_DecalsAccessories.cpp Mass/Mass_DecalsAccessories.cpp
Mass/PropertyNames.h
Mass/Weapon.h Mass/Weapon.h
Mass/Weapon.cpp Mass/Weapon.cpp
Mass/WeaponPart.h Mass/WeaponPart.h

View file

@ -18,9 +18,10 @@
#include <Corrade/Containers/Array.h> #include <Corrade/Containers/Array.h>
#include <Corrade/Containers/Pair.h> #include <Corrade/Containers/Pair.h>
#include <Corrade/Containers/ScopeGuard.h>
#include <Corrade/Utility/Path.h> #include <Corrade/Utility/Path.h>
#include "PropertyNames.h"
#include "../Logger/Logger.h"
#include "../UESaveFile/Types/ArrayProperty.h" #include "../UESaveFile/Types/ArrayProperty.h"
#include "../UESaveFile/Types/BoolProperty.h" #include "../UESaveFile/Types/BoolProperty.h"
#include "../UESaveFile/Types/ColourStructProperty.h" #include "../UESaveFile/Types/ColourStructProperty.h"
@ -46,28 +47,28 @@ auto Mass::lastError() -> Containers::StringView {
auto Mass::getNameFromFile(Containers::StringView path) -> Containers::Optional<Containers::String> { auto Mass::getNameFromFile(Containers::StringView path) -> Containers::Optional<Containers::String> {
if(!Utility::Path::exists(path)) { if(!Utility::Path::exists(path)) {
Utility::Error{} << path << "couldn't be found."_s; LOG_ERROR_FORMAT("{} couldn't be found.", path);
return Containers::NullOpt; return Containers::NullOpt;
} }
UESaveFile mass{path}; UESaveFile mass{path};
if(!mass.valid()) { if(!mass.valid()) {
Utility::Error{} << "The unit file seems to be corrupt."_s; LOG_ERROR_FORMAT("{} is invalid: {}", path, mass.lastError());
return Containers::NullOpt; return Containers::NullOpt;
} }
auto unit_data = mass.at<GenericStructProperty>("UnitData"_s); auto unit_data = mass.at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Couldn't find unit data in the file."_s; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, path);
return Containers::NullOpt; return Containers::NullOpt;
} }
auto name_prop = unit_data->at<StringProperty>("Name_45_A037C5D54E53456407BDF091344529BB"_s); auto name_prop = unit_data->at<StringProperty>(MASS_NAME);
if(!name_prop) { if(!name_prop) {
Utility::Error{} << "Couldn't find the name in the file."_s; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_NAME, path);
return Containers::NullOpt; return Containers::NullOpt;
} }
@ -75,47 +76,53 @@ auto Mass::getNameFromFile(Containers::StringView path) -> Containers::Optional<
} }
void Mass::refreshValues() { void Mass::refreshValues() {
Utility::Debug{} << "=Refreshing values for" << _filename << Utility::Debug::nospace << "="; LOG_INFO_FORMAT("Refreshing values for {}.", _filename);
Containers::ScopeGuard guard{[]{ Utility::Error{} << "Refresh failed."; }};
LOG_INFO("Checking if file exists.");
if(!Utility::Path::exists(Utility::Path::join(_folder, _filename))) { if(!Utility::Path::exists(Utility::Path::join(_folder, _filename))) {
Utility::Warning{} << _filename << "does not exist in" << _folder; LOG_WARNING_FORMAT("{} doesn't exist in {}.", _filename, _folder);
_state = State::Empty; _state = State::Empty;
return; return;
} }
if(!_mass) { if(!_mass) {
LOG_INFO("Reading the GVAS save.");
_mass.emplace(Utility::Path::join(_folder, _filename)); _mass.emplace(Utility::Path::join(_folder, _filename));
if(!_mass->valid()) { if(!_mass->valid()) {
Utility::Error{} << _mass->lastError(); LOG_ERROR(_mass->lastError());
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
} }
else { else {
LOG_INFO("Reloading the GVAS data.");
if(!_mass->reloadData()) { if(!_mass->reloadData()) {
Utility::Error{} << _mass->lastError(); LOG_ERROR(_mass->lastError());
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
} }
LOG_INFO("Checking the save file type.");
if(_mass->saveType() != "/Game/Core/Save/bpSaveGameUnit.bpSaveGameUnit_C"_s) { if(_mass->saveType() != "/Game/Core/Save/bpSaveGameUnit.bpSaveGameUnit_C"_s) {
Utility::Error{} << _filename << "is not a valid unit save."; LOG_ERROR_FORMAT("{} is not a valid unit save.", _filename);
}
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s);
if(!unit_data) {
Utility::Error{} << "Couldn't find unit data in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto name_prop = unit_data->at<StringProperty>("Name_45_A037C5D54E53456407BDF091344529BB"_s); LOG_INFO("Getting the unit data.");
auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) {
LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename);
_state = State::Invalid;
return;
}
LOG_INFO("Reading the M.A.S.S. name.");
auto name_prop = unit_data->at<StringProperty>(MASS_NAME);
if(!name_prop) { if(!name_prop) {
Utility::Error{} << "Couldn't find a M.A.S.S. name in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_NAME, _filename);
_name = Containers::NullOpt; _name = Containers::NullOpt;
_state = State::Invalid; _state = State::Invalid;
return; return;
@ -198,18 +205,16 @@ void Mass::refreshValues() {
return; return;
} }
LOG_INFO("Getting the associated account.");
auto account_prop = _mass->at<StringProperty>("Account"_s); auto account_prop = _mass->at<StringProperty>("Account"_s);
if(!account_prop) { if(!account_prop) {
Utility::Error{} << "Couldn't find an account ID in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_ACCOUNT, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
_account = account_prop->value; _account = account_prop->value;
guard.release();
guard = Containers::ScopeGuard{[]{Utility::Debug{} << "Refresh successful.";}};
_state = State::Valid; _state = State::Valid;
} }
@ -218,6 +223,7 @@ auto Mass::filename() -> Containers::StringView {
} }
auto Mass::name() -> Containers::StringView { auto Mass::name() -> Containers::StringView {
CORRADE_INTERNAL_ASSERT(_name);
return *_name; return *_name;
} }
@ -227,6 +233,7 @@ auto Mass::setName(Containers::StringView new_name) -> bool {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s);
if(!unit_data) { if(!unit_data) {
LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename);
_state = State::Invalid; _state = State::Invalid;
return false; return false;
} }
@ -234,6 +241,7 @@ auto Mass::setName(Containers::StringView new_name) -> bool {
auto name_prop = unit_data->at<StringProperty>("Name_45_A037C5D54E53456407BDF091344529BB"_s); auto name_prop = unit_data->at<StringProperty>("Name_45_A037C5D54E53456407BDF091344529BB"_s);
if(!name_prop) { if(!name_prop) {
LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_NAME, _filename);
_state = State::Invalid; _state = State::Invalid;
return false; return false;
} }
@ -261,17 +269,20 @@ void Mass::setDirty(bool dirty) {
} }
void Mass::getTuning() { void Mass::getTuning() {
getTuningCategory("Engine"_s, _tuning.engineId, "Gears"_s, _tuning.gearIds); getTuningCategory(MASS_ENGINE, _tuning.engineId,
MASS_GEARS, _tuning.gearIds);
if(_state == State::Invalid) { if(_state == State::Invalid) {
return; return;
} }
getTuningCategory("OS"_s, _tuning.osId, "Modules"_s, _tuning.moduleIds); getTuningCategory(MASS_OS, _tuning.osId,
MASS_MODULES, _tuning.moduleIds);
if(_state == State::Invalid) { if(_state == State::Invalid) {
return; return;
} }
getTuningCategory("Architect"_s, _tuning.archId, "Techs"_s, _tuning.techIds); getTuningCategory(MASS_ARCHITECT, _tuning.archId,
MASS_TECHS, _tuning.techIds);
if(_state == State::Invalid) { if(_state == State::Invalid) {
return; return;
} }
@ -308,10 +319,10 @@ auto Mass::account() -> Containers::StringView {
auto Mass::updateAccount(Containers::StringView new_account) -> bool { auto Mass::updateAccount(Containers::StringView new_account) -> bool {
_account = new_account; _account = new_account;
auto account = _mass->at<StringProperty>("Account"_s); auto account = _mass->at<StringProperty>(MASS_ACCOUNT);
if(!account) { if(!account) {
_lastError = "Couldn't find the " MASS_ACCOUNT " property."_s;
_state = State::Invalid; _state = State::Invalid;
_lastError = "Couldn't find the account property."_s;
return false; return false;
} }
@ -328,9 +339,11 @@ auto Mass::updateAccount(Containers::StringView new_account) -> bool {
void Mass::getTuningCategory(Containers::StringView big_node_prop_name, Int& big_node_id, void Mass::getTuningCategory(Containers::StringView big_node_prop_name, Int& big_node_id,
Containers::StringView small_nodes_prop_name, Containers::ArrayView<Int> small_nodes_ids) Containers::StringView small_nodes_prop_name, Containers::ArrayView<Int> small_nodes_ids)
{ {
LOG_INFO_FORMAT("Getting tuning data ({}, {}).", big_node_prop_name, small_nodes_prop_name);
auto node_id = _mass->at<IntProperty>(big_node_prop_name); auto node_id = _mass->at<IntProperty>(big_node_prop_name);
if(!node_id) { if(!node_id) {
Utility::Error{} << "Couldn't find" << big_node_prop_name << "in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", big_node_prop_name, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -338,13 +351,14 @@ void Mass::getTuningCategory(Containers::StringView big_node_prop_name, Int& big
auto node_ids = _mass->at<ArrayProperty>(small_nodes_prop_name); auto node_ids = _mass->at<ArrayProperty>(small_nodes_prop_name);
if(!node_ids) { if(!node_ids) {
Utility::Error{} << "Couldn't find" << small_nodes_prop_name << "in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", small_nodes_prop_name, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
if(node_ids->items.size() != small_nodes_ids.size()) { if(node_ids->items.size() != small_nodes_ids.size()) {
Utility::Error{} << "Node ID arrays are not of the same size. Expected" << small_nodes_ids.size() << Utility::Debug::nospace << ", got" << node_ids->items.size() << "instead."; LOG_ERROR_FORMAT("Node ID arrays are not of the same size. Expected {}, got {} instead.",
small_nodes_ids.size(), node_ids->items.size());
_state = State::Invalid; _state = State::Invalid;
return; return;
} }

View file

@ -16,6 +16,8 @@
#include <algorithm> #include <algorithm>
#include "PropertyNames.h"
#include "../Logger/Logger.h"
#include "../UESaveFile/Types/ArrayProperty.h" #include "../UESaveFile/Types/ArrayProperty.h"
#include "../UESaveFile/Types/ByteProperty.h" #include "../UESaveFile/Types/ByteProperty.h"
#include "../UESaveFile/Types/GenericStructProperty.h" #include "../UESaveFile/Types/GenericStructProperty.h"
@ -32,22 +34,25 @@ auto Mass::armourParts() -> Containers::ArrayView<ArmourPart> {
} }
void Mass::getArmourParts() { void Mass::getArmourParts() {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); LOG_INFO("Getting armour parts.");
auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Couldn't find unit data in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto armour_array = unit_data->at<ArrayProperty>("Armor_10_12E266C44116DDAF57E99ABB575A4B3C"_s); auto armour_array = unit_data->at<ArrayProperty>(MASS_ARMOUR_PARTS);
if(!armour_array) { if(!armour_array) {
Utility::Error{} << "Couldn't find the armour parts array in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_ARMOUR_PARTS, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
if(armour_array->items.size() != _armour.parts.size()) { if(armour_array->items.size() != _armour.parts.size()) {
Utility::Error{} << "Armour arrays are not of the same size. Expected" << _armour.parts.size() << Utility::Debug::nospace << ", got" << armour_array->items.size() << "instead."; LOG_ERROR_FORMAT("Armour part arrays are not of the same size. Expected {}, got {} instead.",
_armour.parts.size(), armour_array->items.size());
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -56,26 +61,28 @@ void Mass::getArmourParts() {
auto part_prop = armour_array->at<GenericStructProperty>(i); auto part_prop = armour_array->at<GenericStructProperty>(i);
auto& part = _armour.parts[i]; auto& part = _armour.parts[i];
auto& armour_slot = part_prop->at<ByteProperty>("Slot_3_408BA56F4C9605C7E805CF91B642249C"_s)->enumValue; auto& armour_slot = part_prop->at<ByteProperty>(MASS_ARMOUR_SLOT)->enumValue;
#define c(enumerator, strenum, name) if(armour_slot == (strenum)) { part.slot = ArmourSlot::enumerator; } else #define c(enumerator, strenum, name) if(armour_slot == (strenum)) { part.slot = ArmourSlot::enumerator; } else
#include "../Maps/ArmourSlots.hpp" #include "../Maps/ArmourSlots.hpp"
#undef c #undef c
{ {
LOG_ERROR_FORMAT("Invalid armour slot enumerator {}.", armour_slot);
_state = State::Invalid; _state = State::Invalid;
Utility::Warning{} << "Invalid armour slot enum value in getArmourParts()."_s; return;
} }
part.id = part_prop->at<IntProperty>("ID_5_ACD101864D3481DE96EDACACC09BDD25"_s)->value; part.id = part_prop->at<IntProperty>(MASS_ARMOUR_ID)->value;
auto part_styles = part_prop->at<ArrayProperty>("Styles_47_3E31870441DFD7DB8BEE5C85C26B365B"_s); auto part_styles = part_prop->at<ArrayProperty>(MASS_ARMOUR_STYLES);
if(!part_styles) { if(!part_styles) {
Utility::Error{} << "Part styles not found for part number" << i << "in" << _filename; LOG_ERROR_FORMAT("Part styles not found for part number {}.", i);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
if(part_styles->items.size() != part.styles.size()) { if(part_styles->items.size() != part.styles.size()) {
Utility::Error{} << "Part style arrays are not of the same size. Expected" << part.styles.size() << Utility::Debug::nospace << ", got" << part_styles->items.size() << "instead."; LOG_ERROR_FORMAT("Armour part style arrays are not of the same size. Expected {}, got {} instead.",
part.styles.size(), part_styles->items.size());
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -84,9 +91,9 @@ void Mass::getArmourParts() {
part.styles[j] = part_styles->at<IntProperty>(j)->value; part.styles[j] = part_styles->at<IntProperty>(j)->value;
} }
auto decals_array = part_prop->at<ArrayProperty>("Decals_42_F358794A4F18497970F56BA9627D3603"_s); auto decals_array = part_prop->at<ArrayProperty>(MASS_ARMOUR_DECALS);
if(!decals_array) { if(!decals_array) {
Utility::Error{} << "Part decals not found for part number" << i << "in" << _filename; LOG_ERROR_FORMAT("Part decals not found for part number {}.", i);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -95,9 +102,9 @@ void Mass::getArmourParts() {
getDecals(part.decals, decals_array); getDecals(part.decals, decals_array);
auto accs_array = part_prop->at<ArrayProperty>("Accessories_52_D902DD4241FA0050C2529596255153F3"_s); auto accs_array = part_prop->at<ArrayProperty>(MASS_ARMOUR_ACCESSORIES);
if(!accs_array) { if(!accs_array) {
Utility::Error{} << "Part accessories not found for part number" << i << "in" << _filename; LOG_WARNING_FORMAT("Part accessories not found for part number {}.", i);
part.accessories = Containers::Array<Accessory>{}; part.accessories = Containers::Array<Accessory>{};
continue; continue;
} }
@ -111,11 +118,25 @@ void Mass::getArmourParts() {
} }
auto Mass::writeArmourPart(ArmourSlot slot) -> bool { auto Mass::writeArmourPart(ArmourSlot slot) -> bool {
LOG_INFO_FORMAT("Writing armour part in slot {}.", static_cast<int>(slot));
auto& part = *std::find_if(_armour.parts.begin(), _armour.parts.end(), [&slot](const ArmourPart& part){ return slot == part.slot; }); auto& part = *std::find_if(_armour.parts.begin(), _armour.parts.end(), [&slot](const ArmourPart& part){ return slot == part.slot; });
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) {
_lastError = "Couldn't find the unit data in " + _filename + ".";
LOG_ERROR(_lastError);
_state = State::Invalid;
return false;
}
auto armour_array = unit_data->at<ArrayProperty>("Armor_10_12E266C44116DDAF57E99ABB575A4B3C"_s); auto armour_array = unit_data->at<ArrayProperty>(MASS_ARMOUR_PARTS);
if(!armour_array) {
_lastError = "Couldn't find the armour part array in " + _filename + ".";
LOG_ERROR(_lastError);
_state = State::Invalid;
return false;
}
Containers::StringView slot_str = nullptr; Containers::StringView slot_str = nullptr;
switch(slot) { switch(slot) {
@ -130,7 +151,7 @@ auto Mass::writeArmourPart(ArmourSlot slot) -> bool {
for(UnsignedInt i = 0; i < armour_array->items.size(); i++) { for(UnsignedInt i = 0; i < armour_array->items.size(); i++) {
part_prop = armour_array->at<GenericStructProperty>(i); part_prop = armour_array->at<GenericStructProperty>(i);
if(slot_str == part_prop->at<ByteProperty>("Slot_3_408BA56F4C9605C7E805CF91B642249C"_s)->enumValue) { if(slot_str == part_prop->at<ByteProperty>(MASS_ARMOUR_SLOT)->enumValue) {
break; break;
} }
else { else {
@ -147,21 +168,22 @@ auto Mass::writeArmourPart(ArmourSlot slot) -> bool {
#include "../Maps/ArmourSlots.hpp" #include "../Maps/ArmourSlots.hpp"
#undef c #undef c
} }
LOG_ERROR(_lastError);
return false; return false;
} }
part_prop->at<IntProperty>("ID_5_ACD101864D3481DE96EDACACC09BDD25"_s)->value = part.id; part_prop->at<IntProperty>(MASS_ARMOUR_ID)->value = part.id;
auto part_styles = part_prop->at<ArrayProperty>("Styles_47_3E31870441DFD7DB8BEE5C85C26B365B"_s); auto part_styles = part_prop->at<ArrayProperty>(MASS_ARMOUR_STYLES);
for(UnsignedInt i = 0; i < part.styles.size(); i++) { for(UnsignedInt i = 0; i < part.styles.size(); i++) {
part_styles->at<IntProperty>(i)->value = part.styles[i]; part_styles->at<IntProperty>(i)->value = part.styles[i];
} }
auto decals_array = part_prop->at<ArrayProperty>("Decals_42_F358794A4F18497970F56BA9627D3603"_s); auto decals_array = part_prop->at<ArrayProperty>(MASS_ARMOUR_DECALS);
writeDecals(part.decals, decals_array); writeDecals(part.decals, decals_array);
if(part.accessories.size() != 0) { if(part.accessories.size() != 0) {
auto accs_array = part_prop->at<ArrayProperty>("Accessories_52_D902DD4241FA0050C2529596255153F3"_s); auto accs_array = part_prop->at<ArrayProperty>(MASS_ARMOUR_ACCESSORIES);
writeAccessories(part.accessories, accs_array); writeAccessories(part.accessories, accs_array);
} }
@ -182,24 +204,27 @@ auto Mass::bulletLauncherAttachments() -> Containers::ArrayView<BulletLauncherAt
} }
void Mass::getBulletLauncherAttachments() { void Mass::getBulletLauncherAttachments() {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); LOG_INFO("Getting the bullet launcher attachment data.");
auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Couldn't find unit data in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto attach_style_prop = unit_data->at<ByteProperty>("WeaponBLAttachmentStyle_65_5943FCE8406F18D2C3F69285EB23A699"_s); auto attach_style_prop = unit_data->at<ByteProperty>(MASS_BL_ATTACHMENT_STYLE);
auto attach_array = unit_data->at<ArrayProperty>("WeaponBLAttachment_61_442D08F547510A4CEE1501BBAF297BA0"_s); auto attach_array = unit_data->at<ArrayProperty>(MASS_BL_ATTACHMENTS);
if(!attach_style_prop && !attach_array) { if(!attach_style_prop && !attach_array) {
LOG_WARNING_FORMAT("No bullet launcher attachment data found in {}.", _filename);
_armour.blAttachmentStyle = BulletLauncherAttachmentStyle::NotFound; _armour.blAttachmentStyle = BulletLauncherAttachmentStyle::NotFound;
return; return;
} }
if(attach_style_prop && !attach_array) { if(attach_style_prop && !attach_array) {
LOG_WARNING_FORMAT("No bullet launcher attachments found in {}.", _filename);
_armour.blAttachmentStyle = BulletLauncherAttachmentStyle::NotFound; _armour.blAttachmentStyle = BulletLauncherAttachmentStyle::NotFound;
Utility::Error{} << "Couldn't find bullet launcher attachments in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -211,25 +236,25 @@ void Mass::getBulletLauncherAttachments() {
auto attachment_prop = attach_array->at<GenericStructProperty>(i); auto attachment_prop = attach_array->at<GenericStructProperty>(i);
auto& attachment = _armour.blAttachment[i]; auto& attachment = _armour.blAttachment[i];
Containers::StringView socket = attachment_prop->at<StringProperty>("Socket_9_B9DBF30D4A1F0032A2BE2F8B342B35A9"_s)->value; Containers::StringView socket = attachment_prop->at<StringProperty>(MASS_BL_ATTACHMENT_SOCKET)->value;
#define c(enumerator, strenum, name) if(socket == (strenum)) { attachment.socket = BulletLauncherSocket::enumerator; } else #define c(enumerator, strenum, name) if(socket == (strenum)) { attachment.socket = BulletLauncherSocket::enumerator; } else
#include "../Maps/BulletLauncherSockets.hpp" #include "../Maps/BulletLauncherSockets.hpp"
#undef c #undef c
{ {
Utility::Error{} << "Invalid BL attachment socket."; LOG_ERROR_FORMAT("Invalid attachment socket {}.", socket);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto rel_loc_prop = attachment_prop->at<VectorStructProperty>("RelativeLocation_10_2F6E75DF4C40622658340E9A22D38B02"_s); auto rel_loc_prop = attachment_prop->at<VectorStructProperty>(MASS_BL_ATTACHMENT_RELLOC);
attachment.relativeLocation = Vector3{rel_loc_prop->x, rel_loc_prop->y, rel_loc_prop->z}; attachment.relativeLocation = Vector3{rel_loc_prop->x, rel_loc_prop->y, rel_loc_prop->z};
auto off_loc_prop = attachment_prop->at<VectorStructProperty>("OffsetLocation_11_F42B3DA3436948FF85752DB33722382F"_s); auto off_loc_prop = attachment_prop->at<VectorStructProperty>(MASS_BL_ATTACHMENT_OFFLOC);
attachment.offsetLocation = Vector3{off_loc_prop->x, off_loc_prop->y, off_loc_prop->z}; attachment.offsetLocation = Vector3{off_loc_prop->x, off_loc_prop->y, off_loc_prop->z};
auto rel_rot_prop = attachment_prop->at<VectorStructProperty>("RelativeRotation_12_578140464621245132CFF2A2AD85E735"_s); auto rel_rot_prop = attachment_prop->at<VectorStructProperty>(MASS_BL_ATTACHMENT_RELROT);
attachment.relativeRotation = Vector3{rel_rot_prop->x, rel_rot_prop->y, rel_rot_prop->z}; attachment.relativeRotation = Vector3{rel_rot_prop->x, rel_rot_prop->y, rel_rot_prop->z};
auto off_rot_prop = attachment_prop->at<VectorStructProperty>("OffsetRotation_13_B5980BCD47905D842D1490A1A520B064"_s); auto off_rot_prop = attachment_prop->at<VectorStructProperty>(MASS_BL_ATTACHMENT_OFFROT);
attachment.offsetRotation = Vector3{off_rot_prop->x, off_rot_prop->y, off_rot_prop->z}; attachment.offsetRotation = Vector3{off_rot_prop->x, off_rot_prop->y, off_rot_prop->z};
auto rel_scale_prop = attachment_prop->at<VectorStructProperty>("RelativeScale_16_37BC80EF42699F79533F7AA7B3094E38"_s); auto rel_scale_prop = attachment_prop->at<VectorStructProperty>(MASS_BL_ATTACHMENT_RELSCALE);
attachment.relativeScale = Vector3{rel_scale_prop->x, rel_scale_prop->y, rel_scale_prop->z}; attachment.relativeScale = Vector3{rel_scale_prop->x, rel_scale_prop->y, rel_scale_prop->z};
} }
} }
@ -240,7 +265,8 @@ void Mass::getBulletLauncherAttachments() {
#include "../Maps/BulletLauncherAttachmentStyles.hpp" #include "../Maps/BulletLauncherAttachmentStyles.hpp"
#undef c #undef c
{ {
Utility::Error{} << "Unknown BL attachment style enumerator."; LOG_ERROR_FORMAT("Invalid attachment style {}.", attach_style);
_state = State::Invalid;
} }
} }
else { else {
@ -249,26 +275,31 @@ void Mass::getBulletLauncherAttachments() {
} }
auto Mass::writeBulletLauncherAttachments() -> bool { auto Mass::writeBulletLauncherAttachments() -> bool {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); LOG_INFO("Writing bullet launcher attachments.");
auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) { if(!unit_data) {
_state = State::Invalid;
_lastError = "No unit data in " + _filename; _lastError = "No unit data in " + _filename;
LOG_ERROR(_lastError);
_state = State::Invalid;
return false; return false;
} }
auto attach_style_prop = unit_data->at<ByteProperty>("WeaponBLAttachmentStyle_65_5943FCE8406F18D2C3F69285EB23A699"_s); auto attach_style_prop = unit_data->at<ByteProperty>(MASS_BL_ATTACHMENT_STYLE);
auto attach_array = unit_data->at<ArrayProperty>("WeaponBLAttachment_61_442D08F547510A4CEE1501BBAF297BA0"_s); auto attach_array = unit_data->at<ArrayProperty>(MASS_BL_ATTACHMENTS);
if(!attach_style_prop && !attach_array) { if(!attach_style_prop && !attach_array) {
_armour.blAttachmentStyle = BulletLauncherAttachmentStyle::NotFound;
_lastError = "No attachment properties to write to in " + _filename; _lastError = "No attachment properties to write to in " + _filename;
LOG_ERROR(_lastError);
_armour.blAttachmentStyle = BulletLauncherAttachmentStyle::NotFound;
return false; return false;
} }
if(attach_style_prop && !attach_array) { if(attach_style_prop && !attach_array) {
_lastError = "Couldn't find the attachments in " + _filename;
LOG_ERROR(_lastError);
_armour.blAttachmentStyle = BulletLauncherAttachmentStyle::NotFound; _armour.blAttachmentStyle = BulletLauncherAttachmentStyle::NotFound;
_state = State::Invalid; _state = State::Invalid;
_lastError = "Couldn't find the attachments in " + _filename;
return false; return false;
} }
@ -279,33 +310,34 @@ auto Mass::writeBulletLauncherAttachments() -> bool {
auto attachment_prop = attach_array->at<GenericStructProperty>(i); auto attachment_prop = attach_array->at<GenericStructProperty>(i);
auto& attachment = _armour.blAttachment[i]; auto& attachment = _armour.blAttachment[i];
auto& socket = attachment_prop->at<StringProperty>("Socket_9_B9DBF30D4A1F0032A2BE2F8B342B35A9"_s)->value; auto& socket = attachment_prop->at<StringProperty>(MASS_BL_ATTACHMENT_SOCKET)->value;
switch(attachment.socket) { switch(attachment.socket) {
#define c(enumerator, strenum, name) case BulletLauncherSocket::enumerator: socket = strenum; break; #define c(enumerator, strenum, name) case BulletLauncherSocket::enumerator: socket = strenum; break;
#include "../Maps/BulletLauncherSockets.hpp" #include "../Maps/BulletLauncherSockets.hpp"
#undef c #undef c
default: default:
_lastError = "Invalid socket type."_s; _lastError = "Invalid socket type."_s;
LOG_ERROR(_lastError);
return false; return false;
} }
auto rel_loc_prop = attachment_prop->at<VectorStructProperty>("RelativeLocation_10_2F6E75DF4C40622658340E9A22D38B02"_s); auto rel_loc_prop = attachment_prop->at<VectorStructProperty>(MASS_BL_ATTACHMENT_RELLOC);
rel_loc_prop->x = attachment.relativeLocation.x(); rel_loc_prop->x = attachment.relativeLocation.x();
rel_loc_prop->y = attachment.relativeLocation.y(); rel_loc_prop->y = attachment.relativeLocation.y();
rel_loc_prop->z = attachment.relativeLocation.z(); rel_loc_prop->z = attachment.relativeLocation.z();
auto off_loc_prop = attachment_prop->at<VectorStructProperty>("OffsetLocation_11_F42B3DA3436948FF85752DB33722382F"_s); auto off_loc_prop = attachment_prop->at<VectorStructProperty>(MASS_BL_ATTACHMENT_OFFLOC);
off_loc_prop->x = attachment.offsetLocation.x(); off_loc_prop->x = attachment.offsetLocation.x();
off_loc_prop->y = attachment.offsetLocation.y(); off_loc_prop->y = attachment.offsetLocation.y();
off_loc_prop->z = attachment.offsetLocation.z(); off_loc_prop->z = attachment.offsetLocation.z();
auto rel_rot_prop = attachment_prop->at<VectorStructProperty>("RelativeRotation_12_578140464621245132CFF2A2AD85E735"_s); auto rel_rot_prop = attachment_prop->at<VectorStructProperty>(MASS_BL_ATTACHMENT_RELROT);
rel_rot_prop->x = attachment.relativeRotation.x(); rel_rot_prop->x = attachment.relativeRotation.x();
rel_rot_prop->y = attachment.relativeRotation.y(); rel_rot_prop->y = attachment.relativeRotation.y();
rel_rot_prop->z = attachment.relativeRotation.z(); rel_rot_prop->z = attachment.relativeRotation.z();
auto off_rot_prop = attachment_prop->at<VectorStructProperty>("OffsetRotation_13_B5980BCD47905D842D1490A1A520B064"_s); auto off_rot_prop = attachment_prop->at<VectorStructProperty>(MASS_BL_ATTACHMENT_OFFROT);
off_rot_prop->x = attachment.offsetRotation.x(); off_rot_prop->x = attachment.offsetRotation.x();
off_rot_prop->y = attachment.offsetRotation.y(); off_rot_prop->y = attachment.offsetRotation.y();
off_rot_prop->z = attachment.offsetRotation.z(); off_rot_prop->z = attachment.offsetRotation.z();
auto rel_scale_prop = attachment_prop->at<VectorStructProperty>("RelativeScale_16_37BC80EF42699F79533F7AA7B3094E38"_s); auto rel_scale_prop = attachment_prop->at<VectorStructProperty>(MASS_BL_ATTACHMENT_RELSCALE);
rel_scale_prop->x = attachment.relativeScale.x(); rel_scale_prop->x = attachment.relativeScale.x();
rel_scale_prop->y = attachment.relativeScale.y(); rel_scale_prop->y = attachment.relativeScale.y();
rel_scale_prop->z = attachment.relativeScale.z(); rel_scale_prop->z = attachment.relativeScale.z();
@ -314,7 +346,7 @@ auto Mass::writeBulletLauncherAttachments() -> bool {
if(!attach_style_prop) { if(!attach_style_prop) {
attach_style_prop = new ByteProperty; attach_style_prop = new ByteProperty;
attach_style_prop->name.emplace("WeaponBLAttachmentStyle_65_5943FCE8406F18D2C3F69285EB23A699"_s); attach_style_prop->name.emplace(MASS_BL_ATTACHMENT_STYLE);
attach_style_prop->enumType = "enuBLAttachmentStyle"_s; attach_style_prop->enumType = "enuBLAttachmentStyle"_s;
ByteProperty::ptr prop{attach_style_prop}; ByteProperty::ptr prop{attach_style_prop};
arrayAppend(unit_data->properties, std::move(prop)); arrayAppend(unit_data->properties, std::move(prop));
@ -329,6 +361,7 @@ auto Mass::writeBulletLauncherAttachments() -> bool {
#undef c #undef c
default: default:
_lastError = "Unknown BL attachment style."; _lastError = "Unknown BL attachment style.";
LOG_ERROR(_lastError);
return false; return false;
} }
@ -345,22 +378,25 @@ auto Mass::armourCustomStyles() -> Containers::ArrayView<CustomStyle> {
} }
void Mass::getArmourCustomStyles() { void Mass::getArmourCustomStyles() {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); LOG_INFO("Getting the custom armour styles.");
auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Couldn't find unit data in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto armour_styles = unit_data->at<ArrayProperty>("ArmorStyle_42_E2F6AC3647788CB366BD469B3B7E899E"_s); auto armour_styles = unit_data->at<ArrayProperty>(MASS_CUSTOM_ARMOUR_STYLES);
if(!armour_styles) { if(!armour_styles) {
Utility::Error{} << "Couldn't find custom armour styles in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_CUSTOM_ARMOUR_STYLES, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
if(armour_styles->items.size() != _armour.customStyles.size()) { if(armour_styles->items.size() != _armour.customStyles.size()) {
Utility::Error{} << "Custom armour style arrays are not of the same size. Expected" << _armour.customStyles.size() << Utility::Debug::nospace << ", got" << armour_styles->items.size() << "instead."; LOG_ERROR_FORMAT("Custom armour style arrays are not of the same size. Expected {}, got {} instead.",
_armour.customStyles.size(), armour_styles->items.size());
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -369,21 +405,26 @@ void Mass::getArmourCustomStyles() {
} }
auto Mass::writeArmourCustomStyle(UnsignedLong index) -> bool { auto Mass::writeArmourCustomStyle(UnsignedLong index) -> bool {
LOG_INFO_FORMAT("Writing custom armour style {}.", index);
if(index > _armour.customStyles.size()) { if(index > _armour.customStyles.size()) {
_lastError = "Style index out of range."_s; _lastError = "Style index out of range."_s;
LOG_ERROR(_lastError);
return false; return false;
} }
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) { if(!unit_data) {
_state = State::Invalid;
_lastError = "Couldn't find unit data in "_s + _filename; _lastError = "Couldn't find unit data in "_s + _filename;
LOG_ERROR(_lastError);
_state = State::Invalid;
return false; return false;
} }
auto armour_styles = unit_data->at<ArrayProperty>("ArmorStyle_42_E2F6AC3647788CB366BD469B3B7E899E"_s); auto armour_styles = unit_data->at<ArrayProperty>(MASS_CUSTOM_ARMOUR_STYLES);
if(!armour_styles) { if(!armour_styles) {
_lastError = "Couldn't find armour custom styles in "_s + _filename; _lastError = "Couldn't find armour custom styles in "_s + _filename;
LOG_ERROR(_lastError);
_state = State::Invalid; _state = State::Invalid;
return false; return false;
} }

View file

@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// 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 "PropertyNames.h"
#include "../UESaveFile/Types/ArrayProperty.h" #include "../UESaveFile/Types/ArrayProperty.h"
#include "../UESaveFile/Types/BoolProperty.h" #include "../UESaveFile/Types/BoolProperty.h"
#include "../UESaveFile/Types/ColourStructProperty.h" #include "../UESaveFile/Types/ColourStructProperty.h"
@ -34,21 +35,21 @@ void Mass::getDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal_a
CORRADE_INTERNAL_ASSERT(decal_prop); CORRADE_INTERNAL_ASSERT(decal_prop);
auto& decal = decals[i]; auto& decal = decals[i];
decal.id = decal_prop->at<IntProperty>("ID_3_694C0B35404D8A3168AEC89026BC8CF9"_s)->value; decal.id = decal_prop->at<IntProperty>(MASS_DECAL_ID)->value;
auto colour_prop = decal_prop->at<ColourStructProperty>("Color_8_1B0B9D2B43DA6AAB9FA549B374D3E606"_s); auto colour_prop = decal_prop->at<ColourStructProperty>(MASS_DECAL_COLOUR);
decal.colour = Color4{colour_prop->r, colour_prop->g, colour_prop->b, colour_prop->a}; decal.colour = Color4{colour_prop->r, colour_prop->g, colour_prop->b, colour_prop->a};
auto pos_prop = decal_prop->at<VectorStructProperty>("Position_41_022C8FE84E1AAFE587261E88F2C72250"_s); auto pos_prop = decal_prop->at<VectorStructProperty>(MASS_DECAL_POSITION);
decal.position = Vector3{pos_prop->x, pos_prop->y, pos_prop->z}; decal.position = Vector3{pos_prop->x, pos_prop->y, pos_prop->z};
auto u_prop = decal_prop->at<VectorStructProperty>("UAxis_37_EBEB715F45491AECACCC07A1AE4646D1"_s); auto u_prop = decal_prop->at<VectorStructProperty>(MASS_DECAL_UAXIS);
decal.uAxis = Vector3{u_prop->x, u_prop->y, u_prop->z}; decal.uAxis = Vector3{u_prop->x, u_prop->y, u_prop->z};
auto v_prop = decal_prop->at<VectorStructProperty>("VAxis_39_C31EB2664EE202CAECFBBB84100B5E35"_s); auto v_prop = decal_prop->at<VectorStructProperty>(MASS_DECAL_VAXIS);
decal.vAxis = Vector3{v_prop->x, v_prop->y, v_prop->z}; decal.vAxis = Vector3{v_prop->x, v_prop->y, v_prop->z};
auto offset_prop = decal_prop->at<Vector2DStructProperty>("Offset_29_B02BBBB74FC60F5EDBEBAB8020738020"_s); auto offset_prop = decal_prop->at<Vector2DStructProperty>(MASS_DECAL_OFFSET);
decal.offset = Vector2{offset_prop->x, offset_prop->y}; decal.offset = Vector2{offset_prop->x, offset_prop->y};
decal.scale = decal_prop->at<FloatProperty>("Scale_32_959D1C2747AFD8D62808468235CBBA40"_s)->value; decal.scale = decal_prop->at<FloatProperty>(MASS_DECAL_SCALE)->value;
decal.rotation = decal_prop->at<FloatProperty>("Rotation_27_12D7C314493D203D5C2326A03C5F910F"_s)->value; decal.rotation = decal_prop->at<FloatProperty>(MASS_DECAL_ROTATION)->value;
decal.flip = decal_prop->at<BoolProperty>("Flip_35_CECCFB184CCD9412BD93FE9A8B656BE1"_s)->value; decal.flip = decal_prop->at<BoolProperty>(MASS_DECAL_FLIP)->value;
decal.wrap = decal_prop->at<BoolProperty>("Wrap_43_A7C68CDF4A92AF2ECDA53F953EE7CA62"_s)->value; decal.wrap = decal_prop->at<BoolProperty>(MASS_DECAL_WRAP)->value;
} }
} }
@ -58,31 +59,31 @@ void Mass::writeDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal
CORRADE_INTERNAL_ASSERT(decal_prop); CORRADE_INTERNAL_ASSERT(decal_prop);
auto& decal = decals[i]; auto& decal = decals[i];
decal_prop->at<IntProperty>("ID_3_694C0B35404D8A3168AEC89026BC8CF9"_s)->value = decal.id; decal_prop->at<IntProperty>(MASS_DECAL_ID)->value = decal.id;
auto colour_prop = decal_prop->at<ColourStructProperty>("Color_8_1B0B9D2B43DA6AAB9FA549B374D3E606"_s); auto colour_prop = decal_prop->at<ColourStructProperty>(MASS_DECAL_COLOUR);
colour_prop->r = decal.colour.r(); colour_prop->r = decal.colour.r();
colour_prop->g = decal.colour.g(); colour_prop->g = decal.colour.g();
colour_prop->b = decal.colour.b(); colour_prop->b = decal.colour.b();
colour_prop->a = decal.colour.a(); colour_prop->a = decal.colour.a();
auto pos_prop = decal_prop->at<VectorStructProperty>("Position_41_022C8FE84E1AAFE587261E88F2C72250"_s); auto pos_prop = decal_prop->at<VectorStructProperty>(MASS_DECAL_POSITION);
pos_prop->x = decal.position.x(); pos_prop->x = decal.position.x();
pos_prop->y = decal.position.y(); pos_prop->y = decal.position.y();
pos_prop->z = decal.position.z(); pos_prop->z = decal.position.z();
auto u_prop = decal_prop->at<VectorStructProperty>("UAxis_37_EBEB715F45491AECACCC07A1AE4646D1"_s); auto u_prop = decal_prop->at<VectorStructProperty>(MASS_DECAL_UAXIS);
u_prop->x = decal.uAxis.x(); u_prop->x = decal.uAxis.x();
u_prop->y = decal.uAxis.y(); u_prop->y = decal.uAxis.y();
u_prop->z = decal.uAxis.z(); u_prop->z = decal.uAxis.z();
auto v_prop = decal_prop->at<VectorStructProperty>("VAxis_39_C31EB2664EE202CAECFBBB84100B5E35"_s); auto v_prop = decal_prop->at<VectorStructProperty>(MASS_DECAL_VAXIS);
v_prop->x = decal.vAxis.x(); v_prop->x = decal.vAxis.x();
v_prop->y = decal.vAxis.y(); v_prop->y = decal.vAxis.y();
v_prop->z = decal.vAxis.z(); v_prop->z = decal.vAxis.z();
auto offset_prop = decal_prop->at<Vector2DStructProperty>("Offset_29_B02BBBB74FC60F5EDBEBAB8020738020"_s); auto offset_prop = decal_prop->at<Vector2DStructProperty>(MASS_DECAL_OFFSET);
offset_prop->x = decal.offset.x(); offset_prop->x = decal.offset.x();
offset_prop->y = decal.offset.y(); offset_prop->y = decal.offset.y();
decal_prop->at<FloatProperty>("Scale_32_959D1C2747AFD8D62808468235CBBA40"_s)->value = decal.scale; decal_prop->at<FloatProperty>(MASS_DECAL_SCALE)->value = decal.scale;
decal_prop->at<FloatProperty>("Rotation_27_12D7C314493D203D5C2326A03C5F910F"_s)->value = decal.rotation; decal_prop->at<FloatProperty>(MASS_DECAL_ROTATION)->value = decal.rotation;
decal_prop->at<BoolProperty>("Flip_35_CECCFB184CCD9412BD93FE9A8B656BE1"_s)->value = decal.flip; decal_prop->at<BoolProperty>(MASS_DECAL_FLIP)->value = decal.flip;
decal_prop->at<BoolProperty>("Wrap_43_A7C68CDF4A92AF2ECDA53F953EE7CA62"_s)->value = decal.wrap; decal_prop->at<BoolProperty>(MASS_DECAL_WRAP)->value = decal.wrap;
} }
} }
@ -92,21 +93,21 @@ void Mass::getAccessories(Containers::ArrayView<Accessory> accessories, ArrayPro
CORRADE_INTERNAL_ASSERT(acc_prop); CORRADE_INTERNAL_ASSERT(acc_prop);
auto& accessory = accessories[i]; auto& accessory = accessories[i];
accessory.attachIndex = acc_prop->at<IntProperty>("AttachIndex_2_4AFCF6024E4BA7426C6B9F80B8179D20"_s)->value; accessory.attachIndex = acc_prop->at<IntProperty>(MASS_ACCESSORY_ATTACH_INDEX)->value;
accessory.id = acc_prop->at<IntProperty>("ID_4_5757B32647BAE263266259B8A7DFFFC1"_s)->value; accessory.id = acc_prop->at<IntProperty>(MASS_ACCESSORY_ID)->value;
auto acc_styles = acc_prop->at<ArrayProperty>("Styles_7_91DEB0F24E24D13FC9472882C11D0DFD"_s); auto acc_styles = acc_prop->at<ArrayProperty>(MASS_ACCESSORY_STYLES);
for(UnsignedInt j = 0; j < acc_styles->items.size(); j++) { for(UnsignedInt j = 0; j < acc_styles->items.size(); j++) {
accessory.styles[j] = acc_styles->at<IntProperty>(j)->value; accessory.styles[j] = acc_styles->at<IntProperty>(j)->value;
} }
auto rel_pos_prop = acc_prop->at<VectorStructProperty>("RelativePosition_14_BE8FB2A94074F34B3EDA6683B227D3A1"_s); auto rel_pos_prop = acc_prop->at<VectorStructProperty>(MASS_ACCESSORY_RELPOS);
accessory.relativePosition = Vector3{rel_pos_prop->x, rel_pos_prop->y, rel_pos_prop->z}; accessory.relativePosition = Vector3{rel_pos_prop->x, rel_pos_prop->y, rel_pos_prop->z};
auto rel_pos_offset_prop = acc_prop->at<VectorStructProperty>("RelativePositionOffset_15_98FD0CE74E44BBAFC2D46FB4CA4E0ED6"_s); auto rel_pos_offset_prop = acc_prop->at<VectorStructProperty>(MASS_ACCESSORY_OFFPOS);
accessory.relativePositionOffset = Vector3{rel_pos_offset_prop->x, rel_pos_offset_prop->y, rel_pos_offset_prop->z}; accessory.relativePositionOffset = Vector3{rel_pos_offset_prop->x, rel_pos_offset_prop->y, rel_pos_offset_prop->z};
auto rel_rot_prop = acc_prop->at<RotatorStructProperty>("RelativeRotation_20_C78C73274E6E78E7878F8C98ECA342C0"_s); auto rel_rot_prop = acc_prop->at<RotatorStructProperty>(MASS_ACCESSORY_RELROT);
accessory.relativeRotation = Vector3{rel_rot_prop->x, rel_rot_prop->y, rel_rot_prop->z}; accessory.relativeRotation = Vector3{rel_rot_prop->x, rel_rot_prop->y, rel_rot_prop->z};
auto rel_rot_offset_prop = acc_prop->at<RotatorStructProperty>("RelativeRotationOffset_21_E07FA0EC46728B7BA763C6861249ABAA"_s); auto rel_rot_offset_prop = acc_prop->at<RotatorStructProperty>(MASS_ACCESSORY_OFFROT);
accessory.relativeRotationOffset = Vector3{rel_rot_offset_prop->x, rel_rot_offset_prop->y, rel_rot_offset_prop->z}; accessory.relativeRotationOffset = Vector3{rel_rot_offset_prop->x, rel_rot_offset_prop->y, rel_rot_offset_prop->z};
auto local_scale_prop = acc_prop->at<VectorStructProperty>("LocalScale_24_DC2D93A742A41A46E7E61D988F15ED53"_s); auto local_scale_prop = acc_prop->at<VectorStructProperty>(MASS_ACCESSORY_SCALE);
accessory.localScale = Vector3{local_scale_prop->x, local_scale_prop->y, local_scale_prop->z}; accessory.localScale = Vector3{local_scale_prop->x, local_scale_prop->y, local_scale_prop->z};
} }
} }
@ -117,29 +118,29 @@ void Mass::writeAccessories(Containers::ArrayView<Accessory> accessories, ArrayP
CORRADE_INTERNAL_ASSERT(acc_prop); CORRADE_INTERNAL_ASSERT(acc_prop);
auto& accessory = accessories[i]; auto& accessory = accessories[i];
acc_prop->at<IntProperty>("AttachIndex_2_4AFCF6024E4BA7426C6B9F80B8179D20"_s)->value = accessory.attachIndex; acc_prop->at<IntProperty>(MASS_ACCESSORY_ATTACH_INDEX)->value = accessory.attachIndex;
acc_prop->at<IntProperty>("ID_4_5757B32647BAE263266259B8A7DFFFC1"_s)->value = accessory.id; acc_prop->at<IntProperty>(MASS_ACCESSORY_ID)->value = accessory.id;
auto acc_styles = acc_prop->at<ArrayProperty>("Styles_7_91DEB0F24E24D13FC9472882C11D0DFD"_s); auto acc_styles = acc_prop->at<ArrayProperty>(MASS_ACCESSORY_STYLES);
for(UnsignedInt j = 0; j < acc_styles->items.size(); j++) { for(UnsignedInt j = 0; j < acc_styles->items.size(); j++) {
acc_styles->at<IntProperty>(j)->value = accessory.styles[j]; acc_styles->at<IntProperty>(j)->value = accessory.styles[j];
} }
auto rel_pos_prop = acc_prop->at<VectorStructProperty>("RelativePosition_14_BE8FB2A94074F34B3EDA6683B227D3A1"_s); auto rel_pos_prop = acc_prop->at<VectorStructProperty>(MASS_ACCESSORY_RELPOS);
rel_pos_prop->x = accessory.relativePosition.x(); rel_pos_prop->x = accessory.relativePosition.x();
rel_pos_prop->y = accessory.relativePosition.y(); rel_pos_prop->y = accessory.relativePosition.y();
rel_pos_prop->z = accessory.relativePosition.z(); rel_pos_prop->z = accessory.relativePosition.z();
auto rel_pos_offset_prop = acc_prop->at<VectorStructProperty>("RelativePositionOffset_15_98FD0CE74E44BBAFC2D46FB4CA4E0ED6"_s); auto rel_pos_offset_prop = acc_prop->at<VectorStructProperty>(MASS_ACCESSORY_OFFPOS);
rel_pos_offset_prop->x = accessory.relativePositionOffset.x(); rel_pos_offset_prop->x = accessory.relativePositionOffset.x();
rel_pos_offset_prop->y = accessory.relativePositionOffset.y(); rel_pos_offset_prop->y = accessory.relativePositionOffset.y();
rel_pos_offset_prop->z = accessory.relativePositionOffset.z(); rel_pos_offset_prop->z = accessory.relativePositionOffset.z();
auto rel_rot_prop = acc_prop->at<RotatorStructProperty>("RelativeRotation_20_C78C73274E6E78E7878F8C98ECA342C0"_s); auto rel_rot_prop = acc_prop->at<RotatorStructProperty>(MASS_ACCESSORY_RELROT);
rel_rot_prop->x = accessory.relativeRotation.x(); rel_rot_prop->x = accessory.relativeRotation.x();
rel_rot_prop->y = accessory.relativeRotation.y(); rel_rot_prop->y = accessory.relativeRotation.y();
rel_rot_prop->z = accessory.relativeRotation.z(); rel_rot_prop->z = accessory.relativeRotation.z();
auto rel_rot_offset_prop = acc_prop->at<RotatorStructProperty>("RelativeRotationOffset_21_E07FA0EC46728B7BA763C6861249ABAA"_s); auto rel_rot_offset_prop = acc_prop->at<RotatorStructProperty>(MASS_ACCESSORY_OFFROT);
rel_rot_offset_prop->x = accessory.relativeRotationOffset.x(); rel_rot_offset_prop->x = accessory.relativeRotationOffset.x();
rel_rot_offset_prop->y = accessory.relativeRotationOffset.y(); rel_rot_offset_prop->y = accessory.relativeRotationOffset.y();
rel_rot_offset_prop->z = accessory.relativeRotationOffset.z(); rel_rot_offset_prop->z = accessory.relativeRotationOffset.z();
auto local_scale_prop = acc_prop->at<VectorStructProperty>("LocalScale_24_DC2D93A742A41A46E7E61D988F15ED53"_s); auto local_scale_prop = acc_prop->at<VectorStructProperty>(MASS_ACCESSORY_SCALE);
local_scale_prop->x = accessory.localScale.x(); local_scale_prop->x = accessory.localScale.x();
local_scale_prop->y = accessory.localScale.y(); local_scale_prop->y = accessory.localScale.y();
local_scale_prop->z = accessory.localScale.z(); local_scale_prop->z = accessory.localScale.z();

View file

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// 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 "PropertyNames.h"
#include "../Logger/Logger.h"
#include "../UESaveFile/Types/ArrayProperty.h" #include "../UESaveFile/Types/ArrayProperty.h"
#include "../UESaveFile/Types/ColourStructProperty.h" #include "../UESaveFile/Types/ColourStructProperty.h"
#include "../UESaveFile/Types/FloatProperty.h" #include "../UESaveFile/Types/FloatProperty.h"
@ -29,132 +31,137 @@ auto Mass::jointSliders() -> Joints& {
} }
void Mass::getJointSliders() { void Mass::getJointSliders() {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); LOG_INFO("Getting joint sliders.");
auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Can't find unit data in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto frame_prop = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653"_s); auto frame_prop = unit_data->at<GenericStructProperty>(MASS_FRAME);
if(!frame_prop) { if(!frame_prop) {
Utility::Error{} << "Can't find frame data in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_FRAME, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto length = frame_prop->at<FloatProperty>("NeckLength_6_ED6AF79849C27CD1A9D523A09E2BFE58"_s); auto length = frame_prop->at<FloatProperty>(MASS_JOINT_NECK);
_frame.joints.neck = (length ? length->value : 0.0f); _frame.joints.neck = (length ? length->value : 0.0f);
length = frame_prop->at<FloatProperty>("BodyLength_7_C16287754CBA96C93BAE36A5C154996A"_s); length = frame_prop->at<FloatProperty>(MASS_JOINT_BODY);
_frame.joints.body = (length ? length->value : 0.0f); _frame.joints.body = (length ? length->value : 0.0f);
length = frame_prop->at<FloatProperty>("ShoulderLength_8_220EDF304F1C1226F0D8D39117FB3883"_s); length = frame_prop->at<FloatProperty>(MASS_JOINT_SHOULDER);
_frame.joints.shoulders = (length ? length->value : 0.0f); _frame.joints.shoulders = (length ? length->value : 0.0f);
length = frame_prop->at<FloatProperty>("HipLength_14_02AEEEAC4376087B9C51F0AA7CC92818"_s); length = frame_prop->at<FloatProperty>(MASS_JOINT_HIP);
_frame.joints.hips = (length ? length->value : 0.0f); _frame.joints.hips = (length ? length->value : 0.0f);
length = frame_prop->at<FloatProperty>("ArmUpperLength_10_249FDA3E4F3B399E7B9E5C9B7C765EAE"_s); length = frame_prop->at<FloatProperty>(MASS_JOINT_ARM_UPPER);
_frame.joints.upperArms = (length ? length->value : 0.0f); _frame.joints.upperArms = (length ? length->value : 0.0f);
length = frame_prop->at<FloatProperty>("ArmLowerLength_12_ACD0F02745C28882619376926292FB36"_s); length = frame_prop->at<FloatProperty>(MASS_JOINT_ARM_LOWER);
_frame.joints.lowerArms = (length ? length->value : 0.0f); _frame.joints.lowerArms = (length ? length->value : 0.0f);
length = frame_prop->at<FloatProperty>("LegUpperLength_16_A7C4C71249A3776F7A543D96819C0C61"_s); length = frame_prop->at<FloatProperty>(MASS_JOINT_LEG_UPPER);
_frame.joints.upperLegs = (length ? length->value : 0.0f); _frame.joints.upperLegs = (length ? length->value : 0.0f);
length = frame_prop->at<FloatProperty>("LegLowerLength_18_D2DF39964EA0F2A2129D0491B08A032F"_s); length = frame_prop->at<FloatProperty>(MASS_JOINT_LEG_LOWER);
_frame.joints.lowerLegs = (length ? length->value : 0.0f); _frame.joints.lowerLegs = (length ? length->value : 0.0f);
} }
auto Mass::writeJointSliders() -> bool { auto Mass::writeJointSliders() -> bool {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); LOG_INFO("Writing joint sliders");
auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) { if(!unit_data) {
_state = State::Invalid;
_lastError = "No unit data in "_s + _filename; _lastError = "No unit data in "_s + _filename;
LOG_ERROR(_lastError);
_state = State::Invalid;
return false; return false;
} }
auto frame_prop = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653"_s); auto frame_prop = unit_data->at<GenericStructProperty>(MASS_FRAME);
if(!frame_prop) { if(!frame_prop) {
_state = State::Invalid;
_lastError = "No frame data in "_s + _filename; _lastError = "No frame data in "_s + _filename;
LOG_ERROR(_lastError);
_state = State::Invalid;
return false; return false;
} }
Containers::Array<UnrealPropertyBase::ptr> temp; Containers::Array<UnrealPropertyBase::ptr> temp;
auto length = frame_prop->atMove<FloatProperty>("NeckLength_6_ED6AF79849C27CD1A9D523A09E2BFE58"_s); auto length = frame_prop->atMove<FloatProperty>(MASS_JOINT_NECK);
if(_frame.joints.neck != 0.0f) { if(_frame.joints.neck != 0.0f) {
if(!length) { if(!length) {
length.emplace(); length.emplace();
length->name.emplace("NeckLength_6_ED6AF79849C27CD1A9D523A09E2BFE58"_s); length->name.emplace(MASS_JOINT_NECK);
} }
length->value = _frame.joints.neck; length->value = _frame.joints.neck;
arrayAppend(temp, std::move(length)); arrayAppend(temp, std::move(length));
} }
length = frame_prop->atMove<FloatProperty>("BodyLength_7_C16287754CBA96C93BAE36A5C154996A"_s); length = frame_prop->atMove<FloatProperty>(MASS_JOINT_BODY);
if(_frame.joints.body != 0.0f) { if(_frame.joints.body != 0.0f) {
if(!length) { if(!length) {
length.emplace(); length.emplace();
length->name.emplace("BodyLength_7_C16287754CBA96C93BAE36A5C154996A"_s); length->name.emplace(MASS_JOINT_BODY);
} }
length->value = _frame.joints.body; length->value = _frame.joints.body;
arrayAppend(temp, std::move(length)); arrayAppend(temp, std::move(length));
} }
length = frame_prop->atMove<FloatProperty>("ShoulderLength_8_220EDF304F1C1226F0D8D39117FB3883"_s); length = frame_prop->atMove<FloatProperty>(MASS_JOINT_SHOULDER);
if(_frame.joints.shoulders != 0.0f) { if(_frame.joints.shoulders != 0.0f) {
if(!length) { if(!length) {
length.emplace(); length.emplace();
length->name.emplace("ShoulderLength_8_220EDF304F1C1226F0D8D39117FB3883"_s); length->name.emplace(MASS_JOINT_SHOULDER);
} }
length->value = _frame.joints.shoulders; length->value = _frame.joints.shoulders;
arrayAppend(temp, std::move(length)); arrayAppend(temp, std::move(length));
} }
length = frame_prop->atMove<FloatProperty>("ArmUpperLength_10_249FDA3E4F3B399E7B9E5C9B7C765EAE"_s); length = frame_prop->atMove<FloatProperty>(MASS_JOINT_ARM_UPPER);
if(_frame.joints.upperArms != 0.0f) { if(_frame.joints.upperArms != 0.0f) {
if(!length) { if(!length) {
length.emplace(); length.emplace();
length->name.emplace("ArmUpperLength_10_249FDA3E4F3B399E7B9E5C9B7C765EAE"_s); length->name.emplace(MASS_JOINT_ARM_UPPER);
} }
length->value = _frame.joints.upperArms; length->value = _frame.joints.upperArms;
arrayAppend(temp, std::move(length)); arrayAppend(temp, std::move(length));
} }
length = frame_prop->atMove<FloatProperty>("ArmLowerLength_12_ACD0F02745C28882619376926292FB36"_s); length = frame_prop->atMove<FloatProperty>(MASS_JOINT_ARM_LOWER);
if(_frame.joints.lowerArms != 0.0f) { if(_frame.joints.lowerArms != 0.0f) {
if(!length) { if(!length) {
length.emplace(); length.emplace();
length->name.emplace("ArmLowerLength_12_ACD0F02745C28882619376926292FB36"_s); length->name.emplace(MASS_JOINT_ARM_LOWER);
} }
length->value = _frame.joints.lowerArms; length->value = _frame.joints.lowerArms;
arrayAppend(temp, std::move(length)); arrayAppend(temp, std::move(length));
} }
length = frame_prop->atMove<FloatProperty>("HipLength_14_02AEEEAC4376087B9C51F0AA7CC92818"_s); length = frame_prop->atMove<FloatProperty>(MASS_JOINT_HIP);
if(_frame.joints.hips != 0.0f) { if(_frame.joints.hips != 0.0f) {
if(!length) { if(!length) {
length.emplace(); length.emplace();
length->name.emplace("HipLength_14_02AEEEAC4376087B9C51F0AA7CC92818"_s); length->name.emplace(MASS_JOINT_HIP);
} }
length->value = _frame.joints.hips; length->value = _frame.joints.hips;
arrayAppend(temp, std::move(length)); arrayAppend(temp, std::move(length));
} }
length = frame_prop->atMove<FloatProperty>("LegUpperLength_16_A7C4C71249A3776F7A543D96819C0C61"_s); length = frame_prop->atMove<FloatProperty>(MASS_JOINT_LEG_UPPER);
if(_frame.joints.upperLegs != 0.0f) { if(_frame.joints.upperLegs != 0.0f) {
if(!length) { if(!length) {
length.emplace(); length.emplace();
length->name.emplace("LegUpperLength_16_A7C4C71249A3776F7A543D96819C0C61"_s); length->name.emplace(MASS_JOINT_LEG_UPPER);
} }
length->value = _frame.joints.upperLegs; length->value = _frame.joints.upperLegs;
arrayAppend(temp, std::move(length)); arrayAppend(temp, std::move(length));
} }
length = frame_prop->atMove<FloatProperty>("LegLowerLength_18_D2DF39964EA0F2A2129D0491B08A032F"_s); length = frame_prop->atMove<FloatProperty>(MASS_JOINT_LEG_LOWER);
if(_frame.joints.lowerLegs != 0.0f) { if(_frame.joints.lowerLegs != 0.0f) {
if(!length) { if(!length) {
length.emplace(); length.emplace();
length->name.emplace("LegLowerLength_18_D2DF39964EA0F2A2129D0491B08A032F"_s); length->name.emplace(MASS_JOINT_LEG_LOWER);
} }
length->value = _frame.joints.lowerLegs; length->value = _frame.joints.lowerLegs;
arrayAppend(temp, std::move(length)); arrayAppend(temp, std::move(length));
@ -179,29 +186,32 @@ auto Mass::frameStyles() -> Containers::ArrayView<Int> {
} }
void Mass::getFrameStyles() { void Mass::getFrameStyles() {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); LOG_INFO("Getting frame styles.");
auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Can't find unit data in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto frame_prop = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653"_s); auto frame_prop = unit_data->at<GenericStructProperty>(MASS_FRAME);
if(!frame_prop) { if(!frame_prop) {
Utility::Error{} << "Can't find frame data in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_FRAME, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto frame_styles = frame_prop->at<ArrayProperty>("Styles_32_00A3B3284B37F1E7819458844A20EB48"_s); auto frame_styles = frame_prop->at<ArrayProperty>(MASS_FRAME_STYLES);
if(!frame_styles) { if(!frame_styles) {
Utility::Error{} << "Can't find frame styles in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_FRAME_STYLES, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
if(frame_styles->items.size() != _frame.styles.size()) { if(frame_styles->items.size() != _frame.styles.size()) {
Utility::Error{} << "Frame style arrays are not of the same size. Expected" << _frame.styles.size() << Utility::Debug::nospace << ", got" << frame_styles->items.size() << "instead."; LOG_ERROR_FORMAT("Frame style arrays are not of the same size. Expected {}, got {} instead.",
_frame.styles.size(), frame_styles->items.size());
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -212,24 +222,29 @@ void Mass::getFrameStyles() {
} }
auto Mass::writeFrameStyles() -> bool { auto Mass::writeFrameStyles() -> bool {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); LOG_INFO("Writing frame styles.");
auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) { if(!unit_data) {
_state = State::Invalid;
_lastError = "No unit data in "_s + _filename; _lastError = "No unit data in "_s + _filename;
LOG_ERROR(_lastError);
_state = State::Invalid;
return false; return false;
} }
auto frame = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653"_s); auto frame = unit_data->at<GenericStructProperty>(MASS_FRAME);
if(!frame) { if(!frame) {
_state = State::Invalid;
_lastError = "No frame data in "_s + _filename; _lastError = "No frame data in "_s + _filename;
LOG_ERROR(_lastError);
_state = State::Invalid;
return false; return false;
} }
auto frame_styles = frame->at<ArrayProperty>("Styles_32_00A3B3284B37F1E7819458844A20EB48"_s); auto frame_styles = frame->at<ArrayProperty>(MASS_FRAME_STYLES);
if(!frame_styles) { if(!frame_styles) {
_state = State::Invalid;
_lastError = "No frame styles in "_s + _filename; _lastError = "No frame styles in "_s + _filename;
LOG_ERROR(_lastError);
_state = State::Invalid;
return false; return false;
} }
@ -250,23 +265,25 @@ auto Mass::eyeFlareColour() -> Color4& {
} }
void Mass::getEyeFlareColour() { void Mass::getEyeFlareColour() {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); LOG_INFO("Getting the eye flare colour.");
auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Can't find unit data in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto frame_prop = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653"_s); auto frame_prop = unit_data->at<GenericStructProperty>(MASS_FRAME);
if(!frame_prop) { if(!frame_prop) {
Utility::Error{} << "Can't find frame data in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_FRAME, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto eye_flare_prop = frame_prop->at<ColourStructProperty>("EyeFlareColor_36_AF79999C40FCA0E88A2F9A84488A38CA"_s); auto eye_flare_prop = frame_prop->at<ColourStructProperty>(MASS_EYE_FLARE);
if(!eye_flare_prop) { if(!eye_flare_prop) {
Utility::Error{} << "Can't find eye flare data in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_EYE_FLARE, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -275,24 +292,29 @@ void Mass::getEyeFlareColour() {
} }
auto Mass::writeEyeFlareColour() -> bool { auto Mass::writeEyeFlareColour() -> bool {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); LOG_INFO("Writing the eye flare colour.");
auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) { if(!unit_data) {
_state = State::Invalid;
_lastError = "No unit data in "_s + _filename; _lastError = "No unit data in "_s + _filename;
LOG_ERROR(_lastError);
_state = State::Invalid;
return false; return false;
} }
auto frame = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653"_s); auto frame = unit_data->at<GenericStructProperty>(MASS_FRAME);
if(!frame) { if(!frame) {
_state = State::Invalid;
_lastError = "No frame data in "_s + _filename; _lastError = "No frame data in "_s + _filename;
LOG_ERROR(_lastError);
_state = State::Invalid;
return false; return false;
} }
auto eye_flare_prop = frame->at<ColourStructProperty>("EyeFlareColor_36_AF79999C40FCA0E88A2F9A84488A38CA"_s); auto eye_flare_prop = frame->at<ColourStructProperty>(MASS_EYE_FLARE);
if(!eye_flare_prop) { if(!eye_flare_prop) {
_state = State::Invalid;
_lastError = "No eye flare property in "_s + _filename; _lastError = "No eye flare property in "_s + _filename;
LOG_ERROR(_lastError);
_state = State::Invalid;
return false; return false;
} }
@ -314,22 +336,25 @@ auto Mass::frameCustomStyles() -> Containers::ArrayView<CustomStyle> {
} }
void Mass::getFrameCustomStyles() { void Mass::getFrameCustomStyles() {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); LOG_INFO("Getting the frame's custom styles.");
auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Can't find unit data in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto frame_styles = unit_data->at<ArrayProperty>("FrameStyle_44_04A44C9440363CCEC5443D98BFAF22AA"_s); auto frame_styles = unit_data->at<ArrayProperty>(MASS_CUSTOM_FRAME_STYLES);
if(!frame_styles) { if(!frame_styles) {
Utility::Error{} << "Can't find frame styles in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_CUSTOM_FRAME_STYLES, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
if(frame_styles->items.size() != _frame.customStyles.size()) { if(frame_styles->items.size() != _frame.customStyles.size()) {
Utility::Error{} << "Frame custom style arrays are not of the same size. Expected" << _frame.customStyles.size() << Utility::Debug::nospace << ", got" << frame_styles->items.size() << "instead."; LOG_ERROR_FORMAT("Frame custom style arrays are not of the same size. Expected {}, got {} instead.",
_frame.customStyles.size(), frame_styles->items.size());
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -338,22 +363,27 @@ void Mass::getFrameCustomStyles() {
} }
auto Mass::writeFrameCustomStyle(UnsignedLong index) -> bool { auto Mass::writeFrameCustomStyle(UnsignedLong index) -> bool {
LOG_INFO_FORMAT("Writing frame custom style number {}.", index);
if(index > _frame.customStyles.size()) { if(index > _frame.customStyles.size()) {
_lastError = "Style index out of range."_s; _lastError = "Style index out of range."_s;
LOG_ERROR(_lastError);
return false; return false;
} }
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) { if(!unit_data) {
_state = State::Invalid;
_lastError = "No unit data in "_s + _filename; _lastError = "No unit data in "_s + _filename;
LOG_ERROR(_lastError);
_state = State::Invalid;
return false; return false;
} }
auto frame_styles = unit_data->at<ArrayProperty>("FrameStyle_44_04A44C9440363CCEC5443D98BFAF22AA"_s); auto frame_styles = unit_data->at<ArrayProperty>(MASS_CUSTOM_FRAME_STYLES);
if(!frame_styles) { if(!frame_styles) {
_state = State::Invalid;
_lastError = "No frame styles in "_s + _filename; _lastError = "No frame styles in "_s + _filename;
LOG_ERROR(_lastError);
_state = State::Invalid;
return false; return false;
} }

View file

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// 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 "PropertyNames.h"
#include "../Logger/Logger.h"
#include "../UESaveFile/Types/ArrayProperty.h" #include "../UESaveFile/Types/ArrayProperty.h"
#include "../UESaveFile/Types/ColourStructProperty.h" #include "../UESaveFile/Types/ColourStructProperty.h"
#include "../UESaveFile/Types/FloatProperty.h" #include "../UESaveFile/Types/FloatProperty.h"
@ -30,15 +32,18 @@ auto Mass::globalStyles() -> Containers::ArrayView<CustomStyle> {
} }
void Mass::getGlobalStyles() { void Mass::getGlobalStyles() {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); LOG_INFO("Getting global styles.");
auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Can't find unit data in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto global_styles = unit_data->at<ArrayProperty>("GlobalStyles_57_6A681C114035241F7BDAAE9B43A8BF1B"_s); auto global_styles = unit_data->at<ArrayProperty>(MASS_GLOBAL_STYLES);
if(!global_styles) { if(!global_styles) {
LOG_WARNING_FORMAT("Couldn't find global styles in {}.", _filename);
_globalStyles = Containers::Array<CustomStyle>{0}; _globalStyles = Containers::Array<CustomStyle>{0};
return; return;
} }
@ -51,22 +56,27 @@ void Mass::getGlobalStyles() {
} }
auto Mass::writeGlobalStyle(UnsignedLong index) -> bool { auto Mass::writeGlobalStyle(UnsignedLong index) -> bool {
LOG_INFO_FORMAT("Writing global style number {}.", index);
if(index > _globalStyles.size()) { if(index > _globalStyles.size()) {
_lastError = "Global style index out of range"_s; _lastError = "Global style index out of range"_s;
LOG_ERROR(_lastError);
return false; return false;
} }
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) { if(!unit_data) {
_state = State::Invalid;
_lastError = "No unit data found in "_s + _filename; _lastError = "No unit data found in "_s + _filename;
LOG_ERROR(_lastError);
_state = State::Invalid;
return false; return false;
} }
auto global_styles = unit_data->at<ArrayProperty>("GlobalStyles_57_6A681C114035241F7BDAAE9B43A8BF1B"_s); auto global_styles = unit_data->at<ArrayProperty>(MASS_GLOBAL_STYLES);
if(!global_styles) { if(!global_styles) {
_state = State::Invalid;
_lastError = "No global styles found in "_s + _filename; _lastError = "No global styles found in "_s + _filename;
LOG_ERROR(_lastError);
_state = State::Invalid;
return false; return false;
} }
@ -78,52 +88,53 @@ void Mass::getCustomStyles(Containers::ArrayView<CustomStyle> styles, ArrayPrope
auto style_prop = style_array->at<GenericStructProperty>(i); auto style_prop = style_array->at<GenericStructProperty>(i);
auto& style = styles[i]; auto& style = styles[i];
style.name = style_prop->at<StringProperty>("Name_27_1532115A46EF2B2FA283908DF561A86B"_s)->value; style.name = style_prop->at<StringProperty>(MASS_STYLE_NAME)->value;
auto colour_prop = style_prop->at<ColourStructProperty>("Color_5_F0D383DF40474C9464AE48A0984A212E"_s); auto colour_prop = style_prop->at<ColourStructProperty>(MASS_STYLE_COLOUR);
style.colour = Color4{colour_prop->r, colour_prop->g, colour_prop->b, colour_prop->a}; style.colour = Color4{colour_prop->r, colour_prop->g, colour_prop->b, colour_prop->a};
style.metallic = style_prop->at<FloatProperty>("Metallic_10_0A4CD1E4482CBF41CA61D0A856DE90B9"_s)->value; style.metallic = style_prop->at<FloatProperty>(MASS_STYLE_METALLIC)->value;
style.gloss = style_prop->at<FloatProperty>("Gloss_11_9769599842CC275A401C4282A236E240"_s)->value; style.gloss = style_prop->at<FloatProperty>(MASS_STYLE_GLOSS)->value;
style.glow = colour_prop->a == 0.0f ? false : true; style.glow = colour_prop->a != 0.0f;
style.patternId = style_prop->at<IntProperty>("PatternID_14_516DB85641DAF8ECFD2920BE2BDF1311"_s)->value; style.patternId = style_prop->at<IntProperty>(MASS_STYLE_PATTERN_ID)->value;
style.opacity = style_prop->at<FloatProperty>("Opacity_30_53BD060B4DFCA1C92302D6A0F7831131"_s)->value; style.opacity = style_prop->at<FloatProperty>(MASS_STYLE_PATTERN_OPACITY)->value;
style.offset = Vector2{ style.offset = Vector2{
style_prop->at<FloatProperty>("OffsetX_23_70FC2E814C64BBB82452748D2AF9CD48"_s)->value, style_prop->at<FloatProperty>(MASS_STYLE_PATTERN_OFFSETX)->value,
style_prop->at<FloatProperty>("OffsetY_24_5E1F866C4C054D9B2EE337ADC180C17F"_s)->value style_prop->at<FloatProperty>(MASS_STYLE_PATTERN_OFFSETY)->value
}; };
style.rotation = style_prop->at<FloatProperty>("Rotation_25_EC2DFAD84AD0A6BD3FA841ACD52EDD6D"_s)->value; style.rotation = style_prop->at<FloatProperty>(MASS_STYLE_PATTERN_ROTATION)->value;
style.scale = style_prop->at<FloatProperty>("Scale_26_19DF0708409262183E1247B317137671"_s)->value; style.scale = style_prop->at<FloatProperty>(MASS_STYLE_PATTERN_SCALE)->value;
} }
} }
auto Mass::writeCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array) -> bool { auto Mass::writeCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array) -> bool {
if(!style_array) { if(!style_array) {
_lastError = "Mass::setCustomStyle(): style_array is null."_s; _lastError = "style_array is null."_s;
LOG_ERROR(_lastError);
return false; return false;
} }
auto style_prop = style_array->at<GenericStructProperty>(index); auto style_prop = style_array->at<GenericStructProperty>(index);
if(!style_prop) { if(!style_prop) {
_lastError = "Style index is out of range in "_s + _filename; _lastError = "Style index is out of range in "_s + _filename;
LOG_ERROR(_lastError);
return false; return false;
} }
style_prop->at<StringProperty>("Name_27_1532115A46EF2B2FA283908DF561A86B"_s)->value = style.name; style_prop->at<StringProperty>(MASS_STYLE_NAME)->value = style.name;
auto colour_prop = style_prop->at<ColourStructProperty>("Color_5_F0D383DF40474C9464AE48A0984A212E"_s); auto colour_prop = style_prop->at<ColourStructProperty>(MASS_STYLE_COLOUR);
colour_prop->r = style.colour.r(); colour_prop->r = style.colour.r();
colour_prop->g = style.colour.g(); colour_prop->g = style.colour.g();
colour_prop->b = style.colour.b(); colour_prop->b = style.colour.b();
colour_prop->a = style.glow ? 1.0f : 0.0f; colour_prop->a = style.glow ? 1.0f : 0.0f;
style_prop->at<FloatProperty>("Metallic_10_0A4CD1E4482CBF41CA61D0A856DE90B9"_s)->value = style.metallic; style_prop->at<FloatProperty>(MASS_STYLE_METALLIC)->value = style.metallic;
style_prop->at<FloatProperty>("Gloss_11_9769599842CC275A401C4282A236E240"_s)->value = style.gloss; style_prop->at<FloatProperty>(MASS_STYLE_GLOSS)->value = style.gloss;
style_prop->at<IntProperty>("PatternID_14_516DB85641DAF8ECFD2920BE2BDF1311"_s)->value = style.patternId; style_prop->at<IntProperty>(MASS_STYLE_PATTERN_ID)->value = style.patternId;
style_prop->at<FloatProperty>("Opacity_30_53BD060B4DFCA1C92302D6A0F7831131"_s)->value = style.opacity; style_prop->at<FloatProperty>(MASS_STYLE_PATTERN_OPACITY)->value = style.opacity;
style_prop->at<FloatProperty>("OffsetX_23_70FC2E814C64BBB82452748D2AF9CD48"_s)->value = style.offset.x(); style_prop->at<FloatProperty>(MASS_STYLE_PATTERN_OFFSETX)->value = style.offset.x();
style_prop->at<FloatProperty>("OffsetY_24_5E1F866C4C054D9B2EE337ADC180C17F"_s)->value = style.offset.y(); style_prop->at<FloatProperty>(MASS_STYLE_PATTERN_OFFSETY)->value = style.offset.y();
style_prop->at<FloatProperty>("Rotation_25_EC2DFAD84AD0A6BD3FA841ACD52EDD6D"_s)->value = style.rotation; style_prop->at<FloatProperty>(MASS_STYLE_PATTERN_ROTATION)->value = style.rotation;
style_prop->at<FloatProperty>("Scale_26_19DF0708409262183E1247B317137671"_s)->value = style.scale; style_prop->at<FloatProperty>(MASS_STYLE_PATTERN_SCALE)->value = style.scale;
if(!_mass->saveToFile()) { if(!_mass->saveToFile()) {
_lastError = _mass->lastError(); _lastError = _mass->lastError();

View file

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// 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 "PropertyNames.h"
#include "../Logger/Logger.h"
#include "../UESaveFile/Types/ArrayProperty.h" #include "../UESaveFile/Types/ArrayProperty.h"
#include "../UESaveFile/Types/BoolProperty.h" #include "../UESaveFile/Types/BoolProperty.h"
#include "../UESaveFile/Types/ByteProperty.h" #include "../UESaveFile/Types/ByteProperty.h"
@ -31,11 +33,13 @@ auto Mass::meleeWeapons() -> Containers::ArrayView<Weapon> {
} }
void Mass::getMeleeWeapons() { void Mass::getMeleeWeapons() {
getWeaponType("WeaponCC_22_0BBEC58C4A0EA1DB9E037B9339EE26A7"_s, _weapons.melee); LOG_INFO("Getting melee weapons.");
getWeaponType(MASS_WEAPONS_MELEE, _weapons.melee);
} }
auto Mass::writeMeleeWeapons() -> bool { auto Mass::writeMeleeWeapons() -> bool {
return writeWeaponType("WeaponCC_22_0BBEC58C4A0EA1DB9E037B9339EE26A7"_s, _weapons.melee); LOG_INFO("Writing melee weapons.");
return writeWeaponType(MASS_WEAPONS_MELEE, _weapons.melee);
} }
auto Mass::shields() -> Containers::ArrayView<Weapon> { auto Mass::shields() -> Containers::ArrayView<Weapon> {
@ -43,11 +47,13 @@ auto Mass::shields() -> Containers::ArrayView<Weapon> {
} }
void Mass::getShields() { void Mass::getShields() {
getWeaponType("Shield_53_839BFD7945481BAEA3E43A9C5CA8E92E"_s, _weapons.shields); LOG_INFO("Getting shields.");
getWeaponType(MASS_WEAPONS_SHIELD, _weapons.shields);
} }
auto Mass::writeShields() -> bool { auto Mass::writeShields() -> bool {
return writeWeaponType("Shield_53_839BFD7945481BAEA3E43A9C5CA8E92E"_s, _weapons.shields); LOG_INFO("Writing shields.");
return writeWeaponType(MASS_WEAPONS_SHIELD, _weapons.shields);
} }
auto Mass::bulletShooters() -> Containers::ArrayView<Weapon> { auto Mass::bulletShooters() -> Containers::ArrayView<Weapon> {
@ -55,11 +61,13 @@ auto Mass::bulletShooters() -> Containers::ArrayView<Weapon> {
} }
void Mass::getBulletShooters() { void Mass::getBulletShooters() {
getWeaponType("WeaponBS_35_6EF6E0104FD7A138DF47F88CB57A83ED"_s, _weapons.bulletShooters); LOG_INFO("Getting bullet shooters.");
getWeaponType(MASS_WEAPONS_BSHOOTER, _weapons.bulletShooters);
} }
auto Mass::writeBulletShooters() -> bool { auto Mass::writeBulletShooters() -> bool {
return writeWeaponType("WeaponBS_35_6EF6E0104FD7A138DF47F88CB57A83ED"_s, _weapons.bulletShooters); LOG_INFO("Writing bullet shooters.");
return writeWeaponType(MASS_WEAPONS_BSHOOTER, _weapons.bulletShooters);
} }
auto Mass::energyShooters() -> Containers::ArrayView<Weapon> { auto Mass::energyShooters() -> Containers::ArrayView<Weapon> {
@ -67,11 +75,13 @@ auto Mass::energyShooters() -> Containers::ArrayView<Weapon> {
} }
void Mass::getEnergyShooters() { void Mass::getEnergyShooters() {
getWeaponType("WeaponES_37_1A295D544528623880A0B1AC2C7DEE99"_s, _weapons.energyShooters); LOG_INFO("Getting energy shooters.");
getWeaponType(MASS_WEAPONS_ESHOOTER, _weapons.energyShooters);
} }
auto Mass::writeEnergyShooters() -> bool { auto Mass::writeEnergyShooters() -> bool {
return writeWeaponType("WeaponES_37_1A295D544528623880A0B1AC2C7DEE99"_s, _weapons.energyShooters); LOG_INFO("Writing energy shooters.");
return writeWeaponType(MASS_WEAPONS_ESHOOTER, _weapons.energyShooters);
} }
auto Mass::bulletLaunchers() -> Containers::ArrayView<Weapon> { auto Mass::bulletLaunchers() -> Containers::ArrayView<Weapon> {
@ -79,11 +89,13 @@ auto Mass::bulletLaunchers() -> Containers::ArrayView<Weapon> {
} }
void Mass::getBulletLaunchers() { void Mass::getBulletLaunchers() {
getWeaponType("WeaponBL_36_5FD7C41E4613A75B44AB0E90B362846E"_s, _weapons.bulletLaunchers); LOG_INFO("Getting bullet launchers.");
getWeaponType(MASS_WEAPONS_BLAUNCHER, _weapons.bulletLaunchers);
} }
auto Mass::writeBulletLaunchers() -> bool { auto Mass::writeBulletLaunchers() -> bool {
return writeWeaponType("WeaponBL_36_5FD7C41E4613A75B44AB0E90B362846E"_s, _weapons.bulletLaunchers); LOG_INFO("Writing bullet launchers.");
return writeWeaponType(MASS_WEAPONS_BLAUNCHER, _weapons.bulletLaunchers);
} }
auto Mass::energyLaunchers() -> Containers::ArrayView<Weapon> { auto Mass::energyLaunchers() -> Containers::ArrayView<Weapon> {
@ -91,30 +103,33 @@ auto Mass::energyLaunchers() -> Containers::ArrayView<Weapon> {
} }
void Mass::getEnergyLaunchers() { void Mass::getEnergyLaunchers() {
getWeaponType("WeaponEL_38_9D23F3884ACA15902C9E6CA6E4995995"_s, _weapons.energyLaunchers); LOG_INFO("Getting energy launchers.");
getWeaponType(MASS_WEAPONS_ELAUNCHER, _weapons.energyLaunchers);
} }
auto Mass::writeEnergyLaunchers() -> bool { auto Mass::writeEnergyLaunchers() -> bool {
return writeWeaponType("WeaponEL_38_9D23F3884ACA15902C9E6CA6E4995995"_s, _weapons.energyLaunchers); LOG_INFO("Writing energy launchers.");
return writeWeaponType(MASS_WEAPONS_ELAUNCHER, _weapons.energyLaunchers);
} }
void Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayView<Weapon> weapon_array) { void Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayView<Weapon> weapon_array) {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Can't find unit data in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto prop = unit_data->at<ArrayProperty>(prop_name); auto prop = unit_data->at<ArrayProperty>(prop_name);
if(!prop) { if(!prop) {
Utility::Error{} << "Can't find" << prop_name << "in" << _filename; LOG_ERROR_FORMAT("Couldn't find {} in {}.", prop_name, _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
if(prop->items.size() != weapon_array.size()) { if(prop->items.size() != weapon_array.size()) {
Utility::Error{} << "Weapon arrays are not of the same size. Expected" << weapon_array.size() << Utility::Debug::nospace << ", got" << prop->items.size() << "instead."; LOG_ERROR_FORMAT("Weapon arrays are not of the same size. Expected {}, got {} instead.",
weapon_array.size(), prop->items.size());
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -123,38 +138,39 @@ void Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayView
auto weapon_prop = prop->at<GenericStructProperty>(i); auto weapon_prop = prop->at<GenericStructProperty>(i);
auto& weapon = weapon_array[i]; auto& weapon = weapon_array[i];
weapon.name = weapon_prop->at<StringProperty>("Name_13_7BF0D31F4E50C50C47231BB36A485D92"_s)->value; weapon.name = weapon_prop->at<StringProperty>(MASS_WEAPON_NAME)->value;
auto& weapon_type = weapon_prop->at<ByteProperty>("Type_2_35ABA8C3406F8D9BBF14A89CD6BCE976"_s)->enumValue; auto& weapon_type = weapon_prop->at<ByteProperty>(MASS_WEAPON_TYPE)->enumValue;
#define c(enumerator, strenum, name) if(weapon_type == (strenum)) { weapon.type = WeaponType::enumerator; } else #define c(enumerator, strenum, name) if(weapon_type == (strenum)) { weapon.type = WeaponType::enumerator; } else
#include "../Maps/WeaponTypes.hpp" #include "../Maps/WeaponTypes.hpp"
#undef c #undef c
{ {
LOG_ERROR_FORMAT("Invalid weapon type {} in {}.", weapon_type, _filename);
_state = State::Invalid; _state = State::Invalid;
Utility::Warning{} << "Invalid weapon type enum value in getWeaponType()."_s; return;
} }
auto parts_prop = weapon_prop->at<ArrayProperty>("Element_6_8E4617CC4B2C1F1490435599784EC6E0"_s); auto parts_prop = weapon_prop->at<ArrayProperty>(MASS_WEAPON_ELEMENT);
weapon.parts = Containers::Array<WeaponPart>{ValueInit, parts_prop->items.size()}; weapon.parts = Containers::Array<WeaponPart>{ValueInit, parts_prop->items.size()};
for(UnsignedInt j = 0; j < parts_prop->items.size(); j++) { for(UnsignedInt j = 0; j < parts_prop->items.size(); j++) {
auto part_prop = parts_prop->at<GenericStructProperty>(j); auto part_prop = parts_prop->at<GenericStructProperty>(j);
auto& part = weapon.parts[j]; auto& part = weapon.parts[j];
part.id = part_prop->at<IntProperty>("ID_2_A74D75434308158E5926178822DD28EE"_s)->value; part.id = part_prop->at<IntProperty>(MASS_WEAPON_PART_ID)->value;
auto part_styles = part_prop->at<ArrayProperty>("Styles_17_994C97C34A90667BE5B716BFD0B97588"_s); auto part_styles = part_prop->at<ArrayProperty>(MASS_WEAPON_PART_STYLES);
for(UnsignedInt k = 0; k < part_styles->items.size(); k++) { for(UnsignedInt k = 0; k < part_styles->items.size(); k++) {
part.styles[k] = part_styles->at<IntProperty>(k)->value; part.styles[k] = part_styles->at<IntProperty>(k)->value;
} }
auto part_decals = part_prop->at<ArrayProperty>("Decals_13_8B81112B453D7230C0CDE982185E14F1"_s); auto part_decals = part_prop->at<ArrayProperty>(MASS_WEAPON_PART_DECALS);
if(part_decals->items.size() != part.decals.size()) { if(part_decals->items.size() != part.decals.size()) {
part.decals = Containers::Array<Decal>{part_decals->items.size()}; part.decals = Containers::Array<Decal>{part_decals->items.size()};
} }
getDecals(part.decals, part_decals); getDecals(part.decals, part_decals);
auto part_accs = part_prop->at<ArrayProperty>("Accessories_21_3878DE8B4ED0EA0DB725E98BCDC20E0C"_s); auto part_accs = part_prop->at<ArrayProperty>(MASS_WEAPON_PART_ACCESSORIES);
if(!part_accs) { if(!part_accs) {
part.accessories = Containers::Array<Accessory>{0}; part.accessories = Containers::Array<Accessory>{0};
continue; continue;
@ -166,62 +182,69 @@ void Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayView
getAccessories(part.accessories, part_accs); getAccessories(part.accessories, part_accs);
} }
auto custom_styles = weapon_prop->at<ArrayProperty>("Styles_10_8C3C82444B986AD7A99595AD4985912D"_s); auto custom_styles = weapon_prop->at<ArrayProperty>(MASS_CUSTOM_WEAPON_STYLES);
if(!custom_styles) { if(!custom_styles) {
Utility::Error{} << "Can't find weapon custom styles in" << _filename; LOG_ERROR_FORMAT("Can't find weapon custom styles in {}", _filename);
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
if(custom_styles->items.size() != weapon.customStyles.size()) { if(custom_styles->items.size() != weapon.customStyles.size()) {
Utility::Error{} << "Weapon custom style arrays are not of the same size. Expected" << weapon.customStyles.size() << Utility::Debug::nospace << ", got" << custom_styles->items.size() << "instead."; LOG_ERROR_FORMAT("Custom weapon style arrays are not of the same size. Expected {}, got {} instead.",
weapon.customStyles.size(), custom_styles->items.size());
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
getCustomStyles(weapon.customStyles, custom_styles); getCustomStyles(weapon.customStyles, custom_styles);
weapon.attached = weapon_prop->at<BoolProperty>("Attach_15_D00AABBD4AD6A04778D56D81E51927B3"_s)->value; weapon.attached = weapon_prop->at<BoolProperty>(MASS_WEAPON_ATTACH)->value;
auto& damage_type = weapon_prop->at<ByteProperty>("DamageType_18_E1FFA53540591A9087EC698117A65C83"_s)->enumValue; auto& damage_type = weapon_prop->at<ByteProperty>(MASS_WEAPON_DAMAGE_TYPE)->enumValue;
#define c(enumerator, strenum) if(damage_type == (strenum)) { weapon.damageType = DamageType::enumerator; } else #define c(enumerator, strenum) if(damage_type == (strenum)) { weapon.damageType = DamageType::enumerator; } else
#include "../Maps/DamageTypes.hpp" #include "../Maps/DamageTypes.hpp"
#undef c #undef c
{ {
LOG_ERROR_FORMAT("Invalid damage type {} in {}.", damage_type, _filename);
_state = State::Invalid; _state = State::Invalid;
Utility::Warning{} << "Invalid damage type enum value in getWeaponType()."_s; return;
} }
weapon.dualWield = weapon_prop->at<BoolProperty>("DualWield_20_B2EB2CEA4A6A233DC7575996B6DD1222"_s)->value; weapon.dualWield = weapon_prop->at<BoolProperty>(MASS_WEAPON_DUAL_WIELD)->value;
auto& effect_colour_mode = weapon_prop->at<ByteProperty>("ColorEfxMode_24_D254BCF943E852BF9ADB8AAA8FD80014"_s)->enumValue; auto& effect_colour_mode = weapon_prop->at<ByteProperty>(MASS_WEAPON_COLOUR_EFX_MODE)->enumValue;
#define c(enumerator, strenum) if(effect_colour_mode == (strenum)) { weapon.effectColourMode = EffectColourMode::enumerator; } else #define c(enumerator, strenum) if(effect_colour_mode == (strenum)) { weapon.effectColourMode = EffectColourMode::enumerator; } else
#include "../Maps/EffectColourModes.hpp" #include "../Maps/EffectColourModes.hpp"
#undef c #undef c
{ {
LOG_ERROR_FORMAT("Invalid effect colour mode {} in {}.", effect_colour_mode, _filename);
_state = State::Invalid; _state = State::Invalid;
Utility::Warning{} << "Invalid effect colour mode in getWeaponType()."_s; return;
} }
auto effect_colour = weapon_prop->at<ColourStructProperty>("ColorEfx_26_D921B62946C493E487455A831F4520AC"_s); auto effect_colour = weapon_prop->at<ColourStructProperty>(MASS_WEAPON_COLOUR_EFX);
weapon.effectColour = Color4{effect_colour->r, effect_colour->g, effect_colour->b, effect_colour->a}; weapon.effectColour = Color4{effect_colour->r, effect_colour->g, effect_colour->b, effect_colour->a};
} }
} }
auto Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayView<Weapon> weapon_array) -> bool { auto Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayView<Weapon> weapon_array) -> bool {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); auto unit_data = _mass->at<GenericStructProperty>(MASS_UNIT_DATA);
if(!unit_data) { if(!unit_data) {
_state = State::Invalid;
_lastError = "No unit data in "_s + _filename; _lastError = "No unit data in "_s + _filename;
LOG_ERROR(_lastError);
_state = State::Invalid;
return false; return false;
} }
auto prop = unit_data->at<ArrayProperty>(prop_name); auto prop = unit_data->at<ArrayProperty>(prop_name);
if(!prop) { if(!prop) {
_state = State::Invalid;
_lastError = prop_name + " not found in "_s + _filename; _lastError = prop_name + " not found in "_s + _filename;
LOG_ERROR(_lastError);
_state = State::Invalid;
return false; return false;
} }
if(prop->items.size() != weapon_array.size()) { if(prop->items.size() != weapon_array.size()) {
_lastError = Utility::format("Weapon arrays are not of the same size. Expected {}, got {} instead.",
weapon_array.size(), prop->items.size());
LOG_ERROR(_lastError);
_state = State::Invalid; _state = State::Invalid;
_lastError = "Weapon type array size mismatch."_s;
return false; return false;
} }
@ -229,19 +252,23 @@ auto Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayVi
auto weapon_prop = prop->at<GenericStructProperty>(i); auto weapon_prop = prop->at<GenericStructProperty>(i);
auto& weapon = weapon_array[i]; auto& weapon = weapon_array[i];
weapon_prop->at<StringProperty>("Name_13_7BF0D31F4E50C50C47231BB36A485D92"_s)->value = weapon.name; weapon_prop->at<StringProperty>(MASS_WEAPON_NAME)->value = weapon.name;
switch(weapon.type) { switch(weapon.type) {
#define c(enumerator, strenum, name) case WeaponType::enumerator: weapon_prop->at<ByteProperty>("Type_2_35ABA8C3406F8D9BBF14A89CD6BCE976"_s)->enumValue = strenum; break; #define c(enumerator, strenum, name) case WeaponType::enumerator: weapon_prop->at<ByteProperty>(MASS_WEAPON_TYPE)->enumValue = strenum; break;
#include "../Maps/WeaponTypes.hpp" #include "../Maps/WeaponTypes.hpp"
#undef c #undef c
default: default:
Utility::Warning{} << "Invalid weapon type enum value in writeWeaponType()."_s; _lastError = Utility::format("Invalid weapon type at index {}.", i);
LOG_ERROR(_lastError);
return false;
} }
auto parts_prop = weapon_prop->at<ArrayProperty>("Element_6_8E4617CC4B2C1F1490435599784EC6E0"_s); auto parts_prop = weapon_prop->at<ArrayProperty>(MASS_WEAPON_ELEMENT);
if(parts_prop->items.size() != weapon.parts.size()) { if(parts_prop->items.size() != weapon.parts.size()) {
_lastError = Utility::format("Weapon part arrays are not of the same size. Expected {}, got {} instead.",
weapon.parts.size(), parts_prop->items.size());
LOG_ERROR(_lastError);
_state = State::Invalid; _state = State::Invalid;
_lastError = "Weapon parts array size mismatch."_s;
return false; return false;
} }
@ -249,40 +276,45 @@ auto Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayVi
auto part_prop = parts_prop->at<GenericStructProperty>(j); auto part_prop = parts_prop->at<GenericStructProperty>(j);
auto& part = weapon.parts[j]; auto& part = weapon.parts[j];
part_prop->at<IntProperty>("ID_2_A74D75434308158E5926178822DD28EE"_s)->value = part.id; part_prop->at<IntProperty>(MASS_WEAPON_PART_ID)->value = part.id;
auto part_styles = part_prop->at<ArrayProperty>("Styles_17_994C97C34A90667BE5B716BFD0B97588"_s); auto part_styles = part_prop->at<ArrayProperty>(MASS_WEAPON_PART_STYLES);
for(UnsignedInt k = 0; k < part_styles->items.size(); k++) { for(UnsignedInt k = 0; k < part_styles->items.size(); k++) {
part_styles->at<IntProperty>(k)->value = part.styles[k]; part_styles->at<IntProperty>(k)->value = part.styles[k];
} }
auto part_decals = part_prop->at<ArrayProperty>("Decals_13_8B81112B453D7230C0CDE982185E14F1"_s); auto part_decals = part_prop->at<ArrayProperty>(MASS_WEAPON_PART_DECALS);
writeDecals(part.decals, part_decals); writeDecals(part.decals, part_decals);
auto part_accs = part_prop->at<ArrayProperty>("Accessories_21_3878DE8B4ED0EA0DB725E98BCDC20E0C"_s); auto part_accs = part_prop->at<ArrayProperty>(MASS_WEAPON_PART_ACCESSORIES);
if(!part_accs) { if(!part_accs) {
continue; continue;
} }
if(part_accs->items.size() != part.accessories.size()) { if(part_accs->items.size() != part.accessories.size()) {
_lastError = Utility::format("Part accessory arrays are not of the same size. Expected {}, got {} instead.",
part.accessories.size(), part_accs->items.size());
LOG_ERROR(_lastError);
_state = State::Invalid; _state = State::Invalid;
_lastError = "Accessories array size mismatch."_s;
return false; return false;
} }
writeAccessories(part.accessories, part_accs); writeAccessories(part.accessories, part_accs);
} }
auto custom_styles = weapon_prop->at<ArrayProperty>("Styles_10_8C3C82444B986AD7A99595AD4985912D"_s); auto custom_styles = weapon_prop->at<ArrayProperty>(MASS_CUSTOM_WEAPON_STYLES);
if(!custom_styles) { if(!custom_styles) {
_state = State::Invalid;
_lastError = "No custom styles found for weapon."_s; _lastError = "No custom styles found for weapon."_s;
LOG_ERROR(_lastError);
_state = State::Invalid;
return false; return false;
} }
if(custom_styles->items.size() != weapon.customStyles.size()) { if(custom_styles->items.size() != weapon.customStyles.size()) {
_lastError = Utility::format("Custom style arrays are not of the same size. Expected {}, got {} instead.",
weapon.customStyles.size(), custom_styles->items.size());
LOG_ERROR(_lastError);
_state = State::Invalid; _state = State::Invalid;
_lastError = "Custom styles array size mismatch."_s;
return false; return false;
} }
@ -290,25 +322,29 @@ auto Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayVi
writeCustomStyle(weapon.customStyles[j], j, custom_styles); writeCustomStyle(weapon.customStyles[j], j, custom_styles);
} }
weapon_prop->at<BoolProperty>("Attach_15_D00AABBD4AD6A04778D56D81E51927B3"_s)->value = weapon.attached; weapon_prop->at<BoolProperty>(MASS_WEAPON_ATTACH)->value = weapon.attached;
switch(weapon.damageType) { switch(weapon.damageType) {
#define c(enumerator, strenum) case DamageType::enumerator: weapon_prop->at<ByteProperty>("DamageType_18_E1FFA53540591A9087EC698117A65C83"_s)->enumValue = strenum; break; #define c(enumerator, strenum) case DamageType::enumerator: weapon_prop->at<ByteProperty>(MASS_WEAPON_DAMAGE_TYPE)->enumValue = strenum; break;
#include "../Maps/DamageTypes.hpp" #include "../Maps/DamageTypes.hpp"
#undef c #undef c
default: default:
Utility::Warning{} << "Unknown damage type enum value in writeWeaponType()."_s; _lastError = Utility::format("Invalid damage type at index {}.", i);
LOG_ERROR(_lastError);
return false;
} }
weapon_prop->at<BoolProperty>("DualWield_20_B2EB2CEA4A6A233DC7575996B6DD1222"_s)->value = weapon.dualWield; weapon_prop->at<BoolProperty>(MASS_WEAPON_DUAL_WIELD)->value = weapon.dualWield;
switch(weapon.effectColourMode) { switch(weapon.effectColourMode) {
#define c(enumerator, enumstr) case EffectColourMode::enumerator: \ #define c(enumerator, enumstr) case EffectColourMode::enumerator: \
weapon_prop->at<ByteProperty>("ColorEfxMode_24_D254BCF943E852BF9ADB8AAA8FD80014"_s)->enumValue = enumstr; \ weapon_prop->at<ByteProperty>(MASS_WEAPON_COLOUR_EFX_MODE)->enumValue = enumstr; \
break; break;
#include "../Maps/EffectColourModes.hpp" #include "../Maps/EffectColourModes.hpp"
#undef c #undef c
default: default:
Utility::Warning{} << "Unknown effect colour mode in writeWeaponType()."_s; _lastError = Utility::format("Invalid damage type at index {}.", i);
LOG_ERROR(_lastError);
return false;
} }
auto effect_colour = weapon_prop->at<ColourStructProperty>("ColorEfx_26_D921B62946C493E487455A831F4520AC"_s); auto effect_colour = weapon_prop->at<ColourStructProperty>(MASS_WEAPON_COLOUR_EFX);
effect_colour->r = weapon.effectColour.r(); effect_colour->r = weapon.effectColour.r();
effect_colour->g = weapon.effectColour.g(); effect_colour->g = weapon.effectColour.g();
effect_colour->b = weapon.effectColour.b(); effect_colour->b = weapon.effectColour.b();

104
src/Mass/PropertyNames.h Normal file
View file

@ -0,0 +1,104 @@
#pragma once
#define MASS_UNIT_DATA "UnitData"
#define MASS_NAME "Name_45_A037C5D54E53456407BDF091344529BB"
#define MASS_ACCOUNT "Account"
#define MASS_GLOBAL_STYLES "GlobalStyles_57_6A681C114035241F7BDAAE9B43A8BF1B"
// Frame stuff
#define MASS_FRAME "Frame_3_F92B0F6A44A15088AF7F41B9FF290653"
#define MASS_JOINT_NECK "NeckLength_6_ED6AF79849C27CD1A9D523A09E2BFE58"
#define MASS_JOINT_BODY "BodyLength_7_C16287754CBA96C93BAE36A5C154996A"
#define MASS_JOINT_SHOULDER "ShoulderLength_8_220EDF304F1C1226F0D8D39117FB3883"
#define MASS_JOINT_ARM_UPPER "ArmUpperLength_10_249FDA3E4F3B399E7B9E5C9B7C765EAE"
#define MASS_JOINT_ARM_LOWER "ArmLowerLength_12_ACD0F02745C28882619376926292FB36"
#define MASS_JOINT_HIP "HipLength_14_02AEEEAC4376087B9C51F0AA7CC92818"
#define MASS_JOINT_LEG_UPPER "LegUpperLength_16_A7C4C71249A3776F7A543D96819C0C61"
#define MASS_JOINT_LEG_LOWER "LegLowerLength_18_D2DF39964EA0F2A2129D0491B08A032F"
#define MASS_FRAME_STYLES "Styles_32_00A3B3284B37F1E7819458844A20EB48"
#define MASS_EYE_FLARE "EyeFlareColor_36_AF79999C40FCA0E88A2F9A84488A38CA"
#define MASS_CUSTOM_FRAME_STYLES "FrameStyle_44_04A44C9440363CCEC5443D98BFAF22AA"
// Armour stuff
#define MASS_ARMOUR_PARTS "Armor_10_12E266C44116DDAF57E99ABB575A4B3C"
#define MASS_ARMOUR_SLOT "Slot_3_408BA56F4C9605C7E805CF91B642249C"
#define MASS_ARMOUR_ID "ID_5_ACD101864D3481DE96EDACACC09BDD25"
#define MASS_ARMOUR_STYLES "Styles_47_3E31870441DFD7DB8BEE5C85C26B365B"
#define MASS_ARMOUR_DECALS "Decals_42_F358794A4F18497970F56BA9627D3603"
#define MASS_ARMOUR_ACCESSORIES "Accessories_52_D902DD4241FA0050C2529596255153F3"
#define MASS_CUSTOM_ARMOUR_STYLES "ArmorStyle_42_E2F6AC3647788CB366BD469B3B7E899E"
// Weapon stuff
#define MASS_WEAPONS_MELEE "WeaponCC_22_0BBEC58C4A0EA1DB9E037B9339EE26A7"
#define MASS_WEAPONS_SHIELD "Shield_53_839BFD7945481BAEA3E43A9C5CA8E92E"
#define MASS_WEAPONS_BSHOOTER "WeaponBS_35_6EF6E0104FD7A138DF47F88CB57A83ED"
#define MASS_WEAPONS_ESHOOTER "WeaponES_37_1A295D544528623880A0B1AC2C7DEE99"
#define MASS_WEAPONS_BLAUNCHER "WeaponBL_36_5FD7C41E4613A75B44AB0E90B362846E"
#define MASS_WEAPONS_ELAUNCHER "WeaponEL_38_9D23F3884ACA15902C9E6CA6E4995995"
#define MASS_WEAPON_NAME "Name_13_7BF0D31F4E50C50C47231BB36A485D92"
#define MASS_WEAPON_TYPE "Type_2_35ABA8C3406F8D9BBF14A89CD6BCE976"
#define MASS_WEAPON_ELEMENT "Element_6_8E4617CC4B2C1F1490435599784EC6E0"
#define MASS_CUSTOM_WEAPON_STYLES "Styles_10_8C3C82444B986AD7A99595AD4985912D"
#define MASS_WEAPON_ATTACH "Attach_15_D00AABBD4AD6A04778D56D81E51927B3"
#define MASS_WEAPON_DAMAGE_TYPE "DamageType_18_E1FFA53540591A9087EC698117A65C83"
#define MASS_WEAPON_DUAL_WIELD "DualWield_20_B2EB2CEA4A6A233DC7575996B6DD1222"
#define MASS_WEAPON_COLOUR_EFX_MODE "ColorEfxMode_24_D254BCF943E852BF9ADB8AAA8FD80014"
#define MASS_WEAPON_COLOUR_EFX "ColorEfx_26_D921B62946C493E487455A831F4520AC"
// Weapon part stuff
#define MASS_WEAPON_PART_ID "ID_2_A74D75434308158E5926178822DD28EE"
#define MASS_WEAPON_PART_STYLES "Styles_17_994C97C34A90667BE5B716BFD0B97588"
#define MASS_WEAPON_PART_DECALS "Decals_13_8B81112B453D7230C0CDE982185E14F1"
#define MASS_WEAPON_PART_ACCESSORIES "Accessories_21_3878DE8B4ED0EA0DB725E98BCDC20E0C"
// BL attachment stuff
#define MASS_BL_ATTACHMENT_STYLE "WeaponBLAttachmentStyle_65_5943FCE8406F18D2C3F69285EB23A699"
#define MASS_BL_ATTACHMENTS "WeaponBLAttachment_61_442D08F547510A4CEE1501BBAF297BA0"
#define MASS_BL_ATTACHMENT_SOCKET "Socket_9_B9DBF30D4A1F0032A2BE2F8B342B35A9"
#define MASS_BL_ATTACHMENT_RELLOC "RelativeLocation_10_2F6E75DF4C40622658340E9A22D38B02"
#define MASS_BL_ATTACHMENT_OFFLOC "OffsetLocation_11_F42B3DA3436948FF85752DB33722382F"
#define MASS_BL_ATTACHMENT_RELROT "RelativeRotation_12_578140464621245132CFF2A2AD85E735"
#define MASS_BL_ATTACHMENT_OFFROT "OffsetRotation_13_B5980BCD47905D842D1490A1A520B064"
#define MASS_BL_ATTACHMENT_RELSCALE "RelativeScale_16_37BC80EF42699F79533F7AA7B3094E38"
// Style stuff
#define MASS_STYLE_NAME "Name_27_1532115A46EF2B2FA283908DF561A86B"
#define MASS_STYLE_COLOUR "Color_5_F0D383DF40474C9464AE48A0984A212E"
#define MASS_STYLE_METALLIC "Metallic_10_0A4CD1E4482CBF41CA61D0A856DE90B9"
#define MASS_STYLE_GLOSS "Gloss_11_9769599842CC275A401C4282A236E240"
#define MASS_STYLE_PATTERN_ID "PatternID_14_516DB85641DAF8ECFD2920BE2BDF1311"
#define MASS_STYLE_PATTERN_OPACITY "Opacity_30_53BD060B4DFCA1C92302D6A0F7831131"
#define MASS_STYLE_PATTERN_OFFSETX "OffsetX_23_70FC2E814C64BBB82452748D2AF9CD48"
#define MASS_STYLE_PATTERN_OFFSETY "OffsetY_24_5E1F866C4C054D9B2EE337ADC180C17F"
#define MASS_STYLE_PATTERN_ROTATION "Rotation_25_EC2DFAD84AD0A6BD3FA841ACD52EDD6D"
#define MASS_STYLE_PATTERN_SCALE "Scale_26_19DF0708409262183E1247B317137671"
// Decal stuff
#define MASS_DECAL_ID "ID_3_694C0B35404D8A3168AEC89026BC8CF9"
#define MASS_DECAL_COLOUR "Color_8_1B0B9D2B43DA6AAB9FA549B374D3E606"
#define MASS_DECAL_POSITION "Position_41_022C8FE84E1AAFE587261E88F2C72250"
#define MASS_DECAL_UAXIS "UAxis_37_EBEB715F45491AECACCC07A1AE4646D1"
#define MASS_DECAL_VAXIS "VAxis_39_C31EB2664EE202CAECFBBB84100B5E35"
#define MASS_DECAL_OFFSET "Offset_29_B02BBBB74FC60F5EDBEBAB8020738020"
#define MASS_DECAL_SCALE "Scale_32_959D1C2747AFD8D62808468235CBBA40"
#define MASS_DECAL_ROTATION "Rotation_27_12D7C314493D203D5C2326A03C5F910F"
#define MASS_DECAL_FLIP "Flip_35_CECCFB184CCD9412BD93FE9A8B656BE1"
#define MASS_DECAL_WRAP "Wrap_43_A7C68CDF4A92AF2ECDA53F953EE7CA62"
// Accessory stuff
#define MASS_ACCESSORY_ATTACH_INDEX "AttachIndex_2_4AFCF6024E4BA7426C6B9F80B8179D20"
#define MASS_ACCESSORY_ID "ID_4_5757B32647BAE263266259B8A7DFFFC1"
#define MASS_ACCESSORY_STYLES "Styles_7_91DEB0F24E24D13FC9472882C11D0DFD"
#define MASS_ACCESSORY_RELPOS "RelativePosition_14_BE8FB2A94074F34B3EDA6683B227D3A1"
#define MASS_ACCESSORY_OFFPOS "RelativePositionOffset_15_98FD0CE74E44BBAFC2D46FB4CA4E0ED6"
#define MASS_ACCESSORY_RELROT "RelativeRotation_20_C78C73274E6E78E7878F8C98ECA342C0"
#define MASS_ACCESSORY_OFFROT "RelativeRotationOffset_21_E07FA0EC46728B7BA763C6861249ABAA"
#define MASS_ACCESSORY_SCALE "LocalScale_24_DC2D93A742A41A46E7E61D988F15ED53"
// Tuning stuff
#define MASS_ENGINE "Engine"
#define MASS_GEARS "Gears"
#define MASS_OS "OS"
#define MASS_MODULES "Modules"
#define MASS_ARCHITECT "Architect"
#define MASS_TECHS "Techs"