Compare commits

..

No commits in common. "0904384e0d32f72a66d03dfe319e9daa024a571d" and "e77cce5b4292f8d4f896555fb19052ffb87de9d2" have entirely different histories.

3 changed files with 16 additions and 236 deletions

View file

@ -100,8 +100,6 @@ void Mass::refreshValues() {
return;
}
// region MassName
{
auto name_prop = unit_data->at<StringProperty>("Name_45_A037C5D54E53456407BDF091344529BB");
if(!name_prop) {
@ -111,10 +109,7 @@ void Mass::refreshValues() {
}
_name = name_prop->value;
}
// endregion
// region FrameData
{
auto frame_prop = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653");
@ -147,11 +142,6 @@ void Mass::refreshValues() {
return;
}
if(frame_styles->items.size() != 4) {
_state = State::Invalid;
return;
}
for(UnsignedInt i = 0; i < 4; i++) {
_frame.styles[i] = frame_styles->at<IntProperty>(i)->value;
}
@ -164,130 +154,6 @@ void Mass::refreshValues() {
_frame.eyeFlare = Color4{eye_flare_prop->r, eye_flare_prop->g, eye_flare_prop->b, eye_flare_prop->a};
}
// endregion
// region FrameStyles
{
auto frame_styles = unit_data->at<ArrayProperty>("FrameStyle_44_04A44C9440363CCEC5443D98BFAF22AA");
if(!frame_styles) {
_state = State::Invalid;
return;
}
if(frame_styles->items.size() != 16) {
_state = State::Invalid;
return;
}
for(UnsignedInt i = 0; i < frame_styles->items.size(); i++) {
auto style_prop = frame_styles->at<GenericStructProperty>(i);
CustomStyle style;
style.name = style_prop->at<StringProperty>("Name_27_1532115A46EF2B2FA283908DF561A86B")->value;
auto colour_prop = style_prop->at<ColourStructProperty>("Color_5_F0D383DF40474C9464AE48A0984A212E");
style.colour = Color4{colour_prop->r, colour_prop->g, colour_prop->b, colour_prop->a};
style.metallic = style_prop->at<FloatProperty>("Metallic_10_0A4CD1E4482CBF41CA61D0A856DE90B9")->value;
style.gloss = style_prop->at<FloatProperty>("Gloss_11_9769599842CC275A401C4282A236E240")->value;
style.glow = colour_prop->a == 0.0f ? false : true;
style.patternId = style_prop->at<IntProperty>("PatternID_14_516DB85641DAF8ECFD2920BE2BDF1311")->value;
style.opacity = style_prop->at<FloatProperty>("Opacity_30_53BD060B4DFCA1C92302D6A0F7831131")->value;
style.offset = Vector2{
style_prop->at<FloatProperty>("OffsetX_23_70FC2E814C64BBB82452748D2AF9CD48")->value,
style_prop->at<FloatProperty>("OffsetY_24_5E1F866C4C054D9B2EE337ADC180C17F")->value
};
style.rotation = style_prop->at<FloatProperty>("Rotation_25_EC2DFAD84AD0A6BD3FA841ACD52EDD6D")->value;
style.scale = style_prop->at<FloatProperty>("Scale_26_19DF0708409262183E1247B317137671")->value;
_frame.customStyles[i] = std::move(style);
}
}
// endregion
// TODO: armour
// region ArmourStyles
{
auto armour_styles = unit_data->at<ArrayProperty>("ArmorStyle_42_E2F6AC3647788CB366BD469B3B7E899E");
if(!armour_styles) {
_state = State::Invalid;
return;
}
if(armour_styles->items.size() != 16) {
_state = State::Invalid;
return;
}
for(UnsignedInt i = 0; i < armour_styles->items.size(); i++) {
auto style_prop = armour_styles->at<GenericStructProperty>(i);
CustomStyle style;
style.name = style_prop->at<StringProperty>("Name_27_1532115A46EF2B2FA283908DF561A86B")->value;
auto colour_prop = style_prop->at<ColourStructProperty>("Color_5_F0D383DF40474C9464AE48A0984A212E");
style.colour = Color4{colour_prop->r, colour_prop->g, colour_prop->b, colour_prop->a};
style.metallic = style_prop->at<FloatProperty>("Metallic_10_0A4CD1E4482CBF41CA61D0A856DE90B9")->value;
style.gloss = style_prop->at<FloatProperty>("Gloss_11_9769599842CC275A401C4282A236E240")->value;
style.glow = colour_prop->a == 0.0f ? false : true;
style.patternId = style_prop->at<IntProperty>("PatternID_14_516DB85641DAF8ECFD2920BE2BDF1311")->value;
style.opacity = style_prop->at<FloatProperty>("Opacity_30_53BD060B4DFCA1C92302D6A0F7831131")->value;
style.offset = Vector2{
style_prop->at<FloatProperty>("OffsetX_23_70FC2E814C64BBB82452748D2AF9CD48")->value,
style_prop->at<FloatProperty>("OffsetY_24_5E1F866C4C054D9B2EE337ADC180C17F")->value
};
style.rotation = style_prop->at<FloatProperty>("Rotation_25_EC2DFAD84AD0A6BD3FA841ACD52EDD6D")->value;
style.scale = style_prop->at<FloatProperty>("Scale_26_19DF0708409262183E1247B317137671")->value;
_armour.customStyles[i] = std::move(style);
}
}
// endregion
// TODO: weapons
// region GlobalStyles
{
auto global_styles = unit_data->at<ArrayProperty>("GlobalStyles_57_6A681C114035241F7BDAAE9B43A8BF1B");
if(!global_styles) {
_state = State::Invalid;
return;
}
if(global_styles->items.size() != 16) {
_state = State::Invalid;
return;
}
for(UnsignedInt i = 0; i < global_styles->items.size(); i++) {
auto style_prop = global_styles->at<GenericStructProperty>(i);
CustomStyle style;
style.name = style_prop->at<StringProperty>("Name_27_1532115A46EF2B2FA283908DF561A86B")->value;
auto colour_prop = style_prop->at<ColourStructProperty>("Color_5_F0D383DF40474C9464AE48A0984A212E");
style.colour = Color4{colour_prop->r, colour_prop->g, colour_prop->b, colour_prop->a};
style.metallic = style_prop->at<FloatProperty>("Metallic_10_0A4CD1E4482CBF41CA61D0A856DE90B9")->value;
style.gloss = style_prop->at<FloatProperty>("Gloss_11_9769599842CC275A401C4282A236E240")->value;
style.glow = colour_prop->a == 0.0f ? false : true;
style.patternId = style_prop->at<IntProperty>("PatternID_14_516DB85641DAF8ECFD2920BE2BDF1311")->value;
style.opacity = style_prop->at<FloatProperty>("Opacity_30_53BD060B4DFCA1C92302D6A0F7831131")->value;
style.offset = Vector2{
style_prop->at<FloatProperty>("OffsetX_23_70FC2E814C64BBB82452748D2AF9CD48")->value,
style_prop->at<FloatProperty>("OffsetY_24_5E1F866C4C054D9B2EE337ADC180C17F")->value
};
style.rotation = style_prop->at<FloatProperty>("Rotation_25_EC2DFAD84AD0A6BD3FA841ACD52EDD6D")->value;
style.scale = style_prop->at<FloatProperty>("Scale_26_19DF0708409262183E1247B317137671")->value;
_globalStyles[i] = std::move(style);
}
}
// endregion
// TODO: tuning
auto account_prop = _mass->at<StringProperty>("Account");
if(!account_prop) {
@ -517,48 +383,6 @@ auto Mass::setEyeFlareColour(Color4 new_colour) -> bool {
return _mass->saveToFile();
}
auto Mass::frameCustomStyles() -> Containers::StaticArrayView<16, CustomStyle> {
return _frame.customStyles;
}
auto Mass::setFrameCustomStyle(CustomStyle style, UnsignedLong index) -> bool {
if(index > _frame.customStyles.size()) {
return false;
}
_frame.customStyles[index] = std::move(style);
return setCustomStyle(_frame.customStyles[index], index, "FrameStyle_44_04A44C9440363CCEC5443D98BFAF22AA");
}
auto Mass::armourCustomStyles() -> Containers::StaticArrayView<16, CustomStyle> {
return _armour.customStyles;
}
auto Mass::setArmourCustomStyle(CustomStyle style, UnsignedLong index) -> bool {
if(index > _armour.customStyles.size()) {
return false;
}
_armour.customStyles[index] = std::move(style);
return setCustomStyle(_armour.customStyles[index], index, "ArmorStyle_42_E2F6AC3647788CB366BD469B3B7E899E");
}
auto Mass::globalStyles() -> Containers::StaticArrayView<16, CustomStyle> {
return _globalStyles;
}
auto Mass::setGlobalStyle(CustomStyle style, UnsignedLong index) -> bool {
if(index > _globalStyles.size()) {
return false;
}
_globalStyles[index] = std::move(style);
return setCustomStyle(_globalStyles[index], index, "GlobalStyles_57_6A681C114035241F7BDAAE9B43A8BF1B");
}
auto Mass::updateSteamId(const std::string& steam_id) -> bool {
_steamId = steam_id;
@ -578,37 +402,3 @@ auto Mass::updateSteamId(const std::string& steam_id) -> bool {
return _mass->saveToFile();
}
auto Mass::setCustomStyle(const CustomStyle& style, UnsignedLong index, const char* prop_name) -> bool {
auto unit_data = _mass->at<GenericStructProperty>("UnitData");
if(!unit_data) {
_state = State::Invalid;
return false;
}
auto frame_styles = unit_data->at<ArrayProperty>(prop_name);
if(!frame_styles) {
_state = State::Invalid;
return false;
}
auto style_prop = frame_styles->at<GenericStructProperty>(index);
style_prop->at<StringProperty>("Name_27_1532115A46EF2B2FA283908DF561A86B")->value = style.name;
auto colour_prop = style_prop->at<ColourStructProperty>("Color_5_F0D383DF40474C9464AE48A0984A212E");
colour_prop->r = style.colour.r();
colour_prop->g = style.colour.g();
colour_prop->b = style.colour.b();
colour_prop->a = style.glow ? 1.0f : 0.0f;
style_prop->at<FloatProperty>("Metallic_10_0A4CD1E4482CBF41CA61D0A856DE90B9")->value = style.metallic;
style_prop->at<FloatProperty>("Gloss_11_9769599842CC275A401C4282A236E240")->value = style.gloss;
style_prop->at<IntProperty>("PatternID_14_516DB85641DAF8ECFD2920BE2BDF1311")->value = style.patternId;
style_prop->at<FloatProperty>("Opacity_30_53BD060B4DFCA1C92302D6A0F7831131")->value = style.opacity;
style_prop->at<FloatProperty>("OffsetX_23_70FC2E814C64BBB82452748D2AF9CD48")->value = style.offset.x();
style_prop->at<FloatProperty>("OffsetY_24_5E1F866C4C054D9B2EE337ADC180C17F")->value = style.offset.y();
style_prop->at<FloatProperty>("Rotation_25_EC2DFAD84AD0A6BD3FA841ACD52EDD6D")->value = style.rotation;
style_prop->at<FloatProperty>("Scale_26_19DF0708409262183E1247B317137671")->value = style.scale;
return _mass->saveToFile();
}

View file

@ -51,10 +51,11 @@ struct CustomStyle {
bool glow = false;
Int patternId = 0;
Float opacity = 0.5f;
Vector2 offset{0.0f};
Float opacity = 0.0f;
Float offsetX = 0.0f;
Float offsetY = 0.0f;
Float rotation = 0.0f;
Float scale = 1.0f;
Float scale = 0.0f;
};
struct Decal {
@ -81,7 +82,7 @@ struct Accessory {
Vector3 localScale{1.0f};
};
struct ArmourPart {
struct Armour {
std::string slot;
Int id = 0;
Containers::StaticArray<4, Int> styles{ValueInit};
@ -147,20 +148,9 @@ class Mass {
auto eyeFlareColour() const -> Color4 const&;
auto setEyeFlareColour(Color4 new_colour) -> bool;
auto frameCustomStyles() -> Containers::StaticArrayView<16, CustomStyle>;
auto setFrameCustomStyle(CustomStyle style, UnsignedLong index) -> bool;
auto armourCustomStyles() -> Containers::StaticArrayView<16, CustomStyle>;
auto setArmourCustomStyle(CustomStyle style, UnsignedLong index) -> bool;
auto globalStyles() -> Containers::StaticArrayView<16, CustomStyle>;
auto setGlobalStyle(CustomStyle style, UnsignedLong index) -> bool;
auto updateSteamId(const std::string& steam_id) -> bool;
private:
auto setCustomStyle(const CustomStyle& style, UnsignedLong index, const char* prop_name) -> bool;
Containers::Optional<UESaveFile> _mass;
static std::string _lastError;
@ -180,13 +170,13 @@ class Mass {
Color4 eyeFlare{0.0f};
Containers::StaticArray<16, CustomStyle> customStyles;
Containers::StaticArray<16, CustomStyle> frameCustomStyles;
} _frame;
struct {
Containers::StaticArray<38, ArmourPart> parts;
Containers::StaticArray<38, Armour> parts;
Containers::StaticArray<16, CustomStyle> customStyles;
Containers::StaticArray<16, CustomStyle> armourCustomStyles;
} _armour;
struct {

View file

@ -439,7 +439,7 @@ void SaveTool::drawMassManager() {
ImGui::EndDragDropSource();
}
if((_unsafeMode || _gameState == GameState::NotRunning) && ImGui::BeginDragDropTarget()) {
if((!_unsafeMode && _gameState == GameState::NotRunning) && ImGui::BeginDragDropTarget()) {
if(const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("StagedMass")) {
if(payload->DataSize != sizeof(std::string)) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error",