Compare commits

..

No commits in common. "16b8807eb7f628680d4e32fdee92e254a3c35ea7" and "6cb52761be7b960a27d0e383879bca1b7bfb3513" have entirely different histories.

7 changed files with 115 additions and 99 deletions

View file

@ -26,7 +26,7 @@ set(CORRADE_BUILD_STATIC ON CACHE BOOL "" FORCE)
set(CORRADE_BUILD_STATIC_PIC ON CACHE BOOL "" FORCE)
set(CORRADE_BUILD_STATIC_UNIQUE_GLOBALS OFF CACHE BOOL "" FORCE)
set(CORRADE_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(CORRADE_WITH_INTERCONNECT OFF CACHE BOOL "" FORCE)
set(CORRADE_WITH_INTERCONNECT ON CACHE BOOL "" FORCE)
set(CORRADE_WITH_PLUGINMANAGER OFF CACHE BOOL "" FORCE)
set(CORRADE_WITH_TESTSUITE OFF CACHE BOOL "" FORCE)
set(CORRADE_WITH_MAIN ON CACHE BOOL "" FORCE)
@ -98,11 +98,10 @@ set(BUILD_TEST_APP OFF CACHE BOOL "" FORCE)
set(EFSW_INSTALL OFF CACHE BOOL "" FORCE)
add_subdirectory(third-party/efsw EXCLUDE_FROM_ALL)
set(BUILD_TESTING OFF CACHE BOOL "" FORCE)
set(BUILD_CURL_EXE OFF CACHE BOOL "" FORCE)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(ENABLE_UNICODE ON CACHE BOOL "" FORCE)
set(ENABLE_DEBUG OFF CACHE BOOL "" FORCE)
set(ENABLE_DEBUG ON CACHE BOOL "" FORCE)
set(ENABLE_THREADED_RESOLVER OFF CACHE BOOL "" FORCE)
set(HTTP_ONLY ON CACHE BOOL "" FORCE)
set(CURL_USE_SCHANNEL ON CACHE BOOL "" FORCE)

View file

@ -18,9 +18,9 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(SAVETOOL_PROJECT_VERSION 1.4.0-pre)
set(SAVETOOL_PROJECT_VERSION 1.3.5)
find_package(Corrade REQUIRED Main Containers Utility)
find_package(Corrade REQUIRED Main Containers Utility Interconnect)
find_package(Magnum REQUIRED GL Sdl2Application)
find_package(MagnumIntegration REQUIRED ImGui)
@ -101,14 +101,12 @@ add_library(UESaveFile STATIC EXCLUDE_FROM_ALL
UESaveFile/BinaryWriter.h
UESaveFile/BinaryWriter.cpp
UESaveFile/PropertySerialiser.h
UESaveFile/PropertySerialiser.cpp
)
UESaveFile/PropertySerialiser.cpp)
target_link_libraries(UESaveFile PRIVATE
Corrade::Containers
Corrade::Utility
Magnum::Magnum
)
Magnum::Magnum)
add_executable(MassBuilderSaveTool WIN32
main.cpp
@ -166,17 +164,14 @@ add_executable(MassBuilderSaveTool WIN32
FontAwesome/IconsFontAwesome5.h
FontAwesome/IconsFontAwesome5Brands.h
resource.rc
${Assets}
)
${Assets})
if(CMAKE_BUILD_TYPE STREQUAL Debug)
add_compile_definitions(SAVETOOL_DEBUG_BUILD)
endif()
add_compile_definitions(
SAVETOOL_VERSION="${SAVETOOL_PROJECT_VERSION}"
SAVETOOL_CODENAME="Enigmatic Ellenier"
SUPPORTED_GAME_VERSION="0.9.x"
)
add_compile_definitions(SAVETOOL_VERSION="${SAVETOOL_PROJECT_VERSION}"
SAVETOOL_CODENAME="Dickish Cyclops"
SUPPORTED_GAME_VERSION="0.8.6")
if(CMAKE_BUILD_TYPE STREQUAL Release)
set_target_properties(MassBuilderSaveTool PROPERTIES OUTPUT_NAME MassBuilderSaveTool-${SAVETOOL_PROJECT_VERSION})
@ -191,6 +186,7 @@ endif()
target_link_libraries(MassBuilderSaveTool PRIVATE
Corrade::Containers
Corrade::Utility
Corrade::Interconnect
Corrade::Main
Magnum::Magnum
Magnum::GL
@ -201,5 +197,4 @@ target_link_libraries(MassBuilderSaveTool PRIVATE
zip
libcurl
imm32
wtsapi32
)
wtsapi32)

View file

@ -172,6 +172,7 @@ SaveTool::~SaveTool() {
Utility::Debug{} << "Saving the configuration...";
_conf.setValue("cheat_mode"_s, _cheatMode);
_conf.setValue("unsafe_mode"_s, _unsafeMode);
_conf.setValue("startup_update_check"_s, _checkUpdatesOnStartup);
_conf.setValue("skip_disclaimer"_s, _skipDisclaimer);

View file

@ -166,16 +166,23 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
template<typename Functor, typename... Args>
auto drawUnsafeWidget(Functor func, Args... args) -> bool {
GameState game_state = _gameState; // Copying the value to reduce the risk of a data race.
ImGui::BeginDisabled(game_state != GameState::NotRunning);
if(!_unsafeMode && game_state != GameState::NotRunning) {
ImGui::BeginDisabled();
}
bool result = func(std::forward<Args>(args)...);
if(!_unsafeMode && game_state != GameState::NotRunning) {
ImGui::EndDisabled();
}
return result;
} // Obviously, should only be used with ImGui widgets that return a bool.
// Also, func should be a lambda if there are any default arguments, like ImGui::Button(), etc...
template<typename... Args>
void drawUnsafeText(Containers::StringView text, Args... args) { // Alternative to the above, for ImGui::Text*() variants.
if(_gameState != GameState::NotRunning) {
if(!_unsafeMode && _gameState != GameState::NotRunning) {
ImGui::TextDisabled(text, std::forward<Args>(args)...);
}
else {
@ -269,6 +276,7 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
bool _skipDisclaimer{false};
bool _checkUpdatesOnStartup{true};
bool _unsafeMode{false};
bool _updateAvailable{false};
Containers::String _latestVersion;

View file

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

View file

@ -146,7 +146,7 @@ auto SaveTool::drawRenamePopup(Containers::ArrayView<char> name_view) -> bool {
callback, nullptr);
ImGui::SameLine();
GameState game_state = _gameState;
if(game_state != GameState::NotRunning ||
if((!_unsafeMode && game_state != GameState::NotRunning) ||
!(len >= 6 && len <= 32) ||
!(name_view[0] != ' ' && name_view[len - 1] != ' '))
{
@ -158,7 +158,7 @@ auto SaveTool::drawRenamePopup(Containers::ArrayView<char> name_view) -> bool {
ImGui::CloseCurrentPopup();
}
if(game_state != GameState::NotRunning ||
if((!_unsafeMode && game_state != GameState::NotRunning) ||
!(len >= 6 && len <= 32) ||
!(name_view[0] != ' ' && name_view[len - 1] != ' '))
{
@ -249,7 +249,7 @@ void SaveTool::drawGeneralInfo() {
}
drawTooltip("Story progress directly affects unlocked levels.");
if(ImGui::BeginPopup("StoryProgressMenu")) {
if(_gameState != GameState::NotRunning) {
if(!_unsafeMode && _gameState != GameState::NotRunning) {
ImGui::CloseCurrentPopup();
}
for(const auto& sp : story_progress) {
@ -473,7 +473,7 @@ void SaveTool::drawMassManager() {
ImGui::EndDragDropSource();
}
if(_gameState == GameState::NotRunning && ImGui::BeginDragDropTarget()) {
if((_unsafeMode || _gameState == GameState::NotRunning) && ImGui::BeginDragDropTarget()) {
if(const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("StagedMass")) {
if(payload->DataSize != sizeof(Containers::String)) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error",

View file

@ -103,6 +103,12 @@ void SaveTool::drawMainMenu() {
drawHelpMarker("This gives access to save edition features that can be considered cheats.",
Float(windowSize().x()) * 0.4f);
ImGui::Checkbox("Unsafe mode", &_unsafeMode);
ImGui::SameLine();
ImGui::AlignTextToFramePadding();
drawHelpMarker("This allows changing the state of save files in the game's save folder even when the game is running.",
Float(windowSize().x()) * 0.4f);
ImGui::Checkbox("Check for updates on startup", &_checkUpdatesOnStartup);
ImGui::SameLine();
if(ImGui::Button(ICON_FA_SYNC_ALT " Check now")) {