Compare commits

..

3 commits

Author SHA1 Message Date
4ea694ea6e SaveTool: add advanced mode.
This'll help hide undocumented values.
2022-11-25 17:10:56 +01:00
722cc511d6 Main: don't forget to initialise Logger.
Especially on release builds...
2022-11-25 17:10:26 +01:00
924838ecb4 Logger: cleanup. 2022-11-25 17:10:01 +01:00
8 changed files with 93 additions and 68 deletions

View file

@ -14,16 +14,10 @@
// 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/>.
#ifdef SAVETOOL_DEBUG_BUILD
#include <iostream> #include <iostream>
#endif
#include <mutex>
#include <Corrade/Containers/GrowableArray.h>
#include <Corrade/Utility/Debug.h> #include <Corrade/Utility/Debug.h>
#include <Magnum/Types.h>
#include "Logger.h" #include "Logger.h"
using Containers::Array; using Containers::Array;

View file

@ -19,7 +19,9 @@
#include <ctime> #include <ctime>
#include <mutex> #include <mutex>
#ifndef SAVETOOL_DEBUG_BUILD
#include <fstream> #include <fstream>
#endif
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>
#include <Corrade/Containers/ArrayView.h> #include <Corrade/Containers/ArrayView.h>

View file

@ -167,6 +167,7 @@ SaveTool::~SaveTool() {
LOG_INFO("Saving the configuration."); LOG_INFO("Saving the configuration.");
_conf.setValue("cheat_mode"_s, _cheatMode); _conf.setValue("cheat_mode"_s, _cheatMode);
_conf.setValue("advanced_mode"_s, _advancedMode);
_conf.setValue("startup_update_check"_s, _checkUpdatesOnStartup); _conf.setValue("startup_update_check"_s, _checkUpdatesOnStartup);
_conf.setValue("skip_disclaimer"_s, _skipDisclaimer); _conf.setValue("skip_disclaimer"_s, _skipDisclaimer);

View file

@ -291,4 +291,5 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
bool _eLaunchersDirty{false}; bool _eLaunchersDirty{false};
bool _cheatMode{false}; bool _cheatMode{false};
bool _advancedMode{false};
}; };

View file

@ -58,6 +58,13 @@ void SaveTool::initialiseConfiguration() {
_conf.setValue("cheat_mode"_s, _cheatMode); _conf.setValue("cheat_mode"_s, _cheatMode);
} }
if(_conf.hasValue("advanced_mode"_s)) {
_advancedMode = _conf.value<bool>("advanced_mode"_s);
}
else {
_conf.setValue("advanced_mode"_s, _advancedMode);
}
if(_conf.hasValue("startup_update_check"_s)) { if(_conf.hasValue("startup_update_check"_s)) {
_checkUpdatesOnStartup = _conf.value<bool>("startup_update_check"_s); _checkUpdatesOnStartup = _conf.value<bool>("startup_update_check"_s);
} }

View file

@ -394,9 +394,12 @@ auto SaveTool::drawCustomStyle(CustomStyle& style) -> DCSResult {
void SaveTool::drawDecalEditor(Decal& decal) { void SaveTool::drawDecalEditor(Decal& decal) {
ImGui::Text("ID: %i", decal.id); ImGui::Text("ID: %i", decal.id);
if(ImGui::BeginTable("##DecalTable", 2, ImGuiTableFlags_BordersInnerV)) { if(ImGui::BeginTable("##DecalTable", _advancedMode ? 2 : 1, ImGuiTableFlags_BordersInnerV)) {
ImGui::TableSetupColumn("##Normal", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("##Normal", ImGuiTableColumnFlags_WidthStretch);
ImGui::TableSetupColumn("##Advanced", ImGuiTableColumnFlags_WidthStretch);
if(_advancedMode) {
ImGui::TableSetupColumn("##Advanced", ImGuiTableColumnFlags_WidthStretch);
}
ImGui::TableNextRow(); ImGui::TableNextRow();
@ -440,52 +443,53 @@ void SaveTool::drawDecalEditor(Decal& decal) {
ImGui::Checkbox("##Wrap", &decal.wrap); ImGui::Checkbox("##Wrap", &decal.wrap);
ImGui::EndGroup(); ImGui::EndGroup();
if(_advancedMode) {
ImGui::TableNextColumn();
ImGui::TableNextColumn(); ImGui::TextColored(ImColor(255, 255, 0), ICON_FA_EXCLAMATION_TRIANGLE);
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::TextUnformatted("Advanced settings. Touch these at your own risk.");
ImGui::TextColored(ImColor(255, 255, 0), ICON_FA_EXCLAMATION_TRIANGLE); ImGui::BeginGroup();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); drawAlignedText("Position:");
ImGui::TextUnformatted("Advanced settings. Touch these at your own risk."); drawAlignedText("U axis:");
drawAlignedText("V axis:");
ImGui::EndGroup();
ImGui::BeginGroup(); ImGui::SameLine();
drawAlignedText("Position:");
drawAlignedText("U axis:");
drawAlignedText("V axis:");
ImGui::EndGroup();
ImGui::SameLine(); ImGui::BeginGroup();
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
ImGui::DragFloat("##PosX", &decal.position.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f");
ImGui::PopItemWidth();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::DragFloat("##PosY", &decal.position.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f");
ImGui::PopItemWidth();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::DragFloat("##PosZ", &decal.position.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f");
ImGui::PopItemWidth();
ImGui::BeginGroup(); ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); ImGui::DragFloat("##UX", &decal.uAxis.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f");
ImGui::DragFloat("##PosX", &decal.position.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f"); ImGui::PopItemWidth();
ImGui::PopItemWidth(); ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); ImGui::DragFloat("##UY", &decal.uAxis.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f");
ImGui::DragFloat("##PosY", &decal.position.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f"); ImGui::PopItemWidth();
ImGui::PopItemWidth(); ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); ImGui::DragFloat("##UZ", &decal.uAxis.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f");
ImGui::DragFloat("##PosZ", &decal.position.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f"); ImGui::PopItemWidth();
ImGui::PopItemWidth();
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
ImGui::DragFloat("##UX", &decal.uAxis.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f"); ImGui::DragFloat("##VX", &decal.vAxis.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f");
ImGui::PopItemWidth(); ImGui::PopItemWidth();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::DragFloat("##UY", &decal.uAxis.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f"); ImGui::DragFloat("##VY", &decal.vAxis.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f");
ImGui::PopItemWidth(); ImGui::PopItemWidth();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::DragFloat("##UZ", &decal.uAxis.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f"); ImGui::DragFloat("##VZ", &decal.vAxis.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f");
ImGui::PopItemWidth(); ImGui::PopItemWidth();
ImGui::EndGroup();
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); }
ImGui::DragFloat("##VX", &decal.vAxis.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f");
ImGui::PopItemWidth();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::DragFloat("##VY", &decal.vAxis.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f");
ImGui::PopItemWidth();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::DragFloat("##VZ", &decal.vAxis.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f");
ImGui::PopItemWidth();
ImGui::EndGroup();
ImGui::EndTable(); ImGui::EndTable();
} }
@ -632,9 +636,13 @@ void SaveTool::drawAccessoryEditor(Accessory& accessory, Containers::ArrayView<C
ImGui::BeginGroup(); ImGui::BeginGroup();
drawAlignedText("Styles:"); drawAlignedText("Styles:");
drawAlignedText("Base position:"); if(_advancedMode) {
drawAlignedText("Base position:");
}
drawAlignedText("Position offset:"); drawAlignedText("Position offset:");
drawAlignedText("Base rotation:"); if(_advancedMode) {
drawAlignedText("Base rotation:");
}
drawAlignedText("Rotation offset:"); drawAlignedText("Rotation offset:");
drawAlignedText("Scale:"); drawAlignedText("Scale:");
ImGui::EndGroup(); ImGui::EndGroup();
@ -665,15 +673,17 @@ void SaveTool::drawAccessoryEditor(Accessory& accessory, Containers::ArrayView<C
} }
ImGui::PopItemWidth(); ImGui::PopItemWidth();
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); if(_advancedMode) {
ImGui::DragFloat("##PosX", &accessory.relativePosition.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f"); ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
ImGui::PopItemWidth(); ImGui::DragFloat("##PosX", &accessory.relativePosition.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f");
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); ImGui::PopItemWidth();
ImGui::DragFloat("##PosY", &accessory.relativePosition.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f"); ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::PopItemWidth(); ImGui::DragFloat("##PosY", &accessory.relativePosition.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f");
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); ImGui::PopItemWidth();
ImGui::DragFloat("##PosZ", &accessory.relativePosition.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f"); ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::PopItemWidth(); ImGui::DragFloat("##PosZ", &accessory.relativePosition.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f");
ImGui::PopItemWidth();
}
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
ImGui::SliderFloat("##PosOffsetX", &accessory.relativePositionOffset.x(), -500.0f, +500.0f, "X: %.3f"); ImGui::SliderFloat("##PosOffsetX", &accessory.relativePositionOffset.x(), -500.0f, +500.0f, "X: %.3f");
@ -687,15 +697,17 @@ void SaveTool::drawAccessoryEditor(Accessory& accessory, Containers::ArrayView<C
ImGui::SameLine(); ImGui::SameLine();
drawHelpMarker("+/-500.0 = +/-250 in-game"); drawHelpMarker("+/-500.0 = +/-250 in-game");
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); if(_advancedMode) {
ImGui::DragFloat("##RotX", &accessory.relativeRotation.x(), 1.0f, -FLT_MAX, +FLT_MAX, "Roll: %.3f"); ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
ImGui::PopItemWidth(); ImGui::DragFloat("##RotX", &accessory.relativeRotation.x(), 1.0f, -FLT_MAX, +FLT_MAX, "Roll: %.3f");
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); ImGui::PopItemWidth();
ImGui::DragFloat("##RotY", &accessory.relativeRotation.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Yaw: %.3f"); ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::PopItemWidth(); ImGui::DragFloat("##RotY", &accessory.relativeRotation.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Yaw: %.3f");
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); ImGui::PopItemWidth();
ImGui::DragFloat("##RotZ", &accessory.relativeRotation.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Pitch: %.3f"); ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::PopItemWidth(); ImGui::DragFloat("##RotZ", &accessory.relativeRotation.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Pitch: %.3f");
ImGui::PopItemWidth();
}
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
ImGui::SliderFloat("##RotOffsetX", &accessory.relativeRotationOffset.x(), -180.0f, +180.0f, "Roll: %.3f"); ImGui::SliderFloat("##RotOffsetX", &accessory.relativeRotationOffset.x(), -180.0f, +180.0f, "Roll: %.3f");

View file

@ -86,6 +86,12 @@ void SaveTool::drawMainMenu() {
drawHelpMarker("This gives access to save edition features that can be considered cheats.", drawHelpMarker("This gives access to save edition features that can be considered cheats.",
Float(windowSize().x()) * 0.4f); Float(windowSize().x()) * 0.4f);
ImGui::Checkbox("Advanced mode", &_advancedMode);
ImGui::SameLine();
ImGui::AlignTextToFramePadding();
drawHelpMarker("This gives access to editing values that have unknown purposes or are undocumented.",
Float(windowSize().x()) * 0.4f);
ImGui::Checkbox("Check for updates on startup", &_checkUpdatesOnStartup); ImGui::Checkbox("Check for updates on startup", &_checkUpdatesOnStartup);
ImGui::SameLine(); ImGui::SameLine();
if(ImGui::Button(ICON_FA_SYNC_ALT " Check now")) { if(ImGui::Button(ICON_FA_SYNC_ALT " Check now")) {

View file

@ -36,6 +36,8 @@ int main(int argc, char** argv) {
Warning warning_intercept{&warning_intercept_stream}; Warning warning_intercept{&warning_intercept_stream};
Error error_intercept{&error_intercept_stream}; Error error_intercept{&error_intercept_stream};
logger().initialise();
LOG_INFO("Initialising M.A.S.S. Builder Save Tool version " SAVETOOL_VERSION "."); LOG_INFO("Initialising M.A.S.S. Builder Save Tool version " SAVETOOL_VERSION ".");
auto str = std::setlocale(LC_ALL, ".utf-8"); auto str = std::setlocale(LC_ALL, ".utf-8");