SaveTool: remove unsafe mode.
It was just not good at all.
This commit is contained in:
parent
f1ea2bda25
commit
16b8807eb7
5 changed files with 9 additions and 31 deletions
|
@ -172,7 +172,6 @@ SaveTool::~SaveTool() {
|
||||||
Utility::Debug{} << "Saving the configuration...";
|
Utility::Debug{} << "Saving the configuration...";
|
||||||
|
|
||||||
_conf.setValue("cheat_mode"_s, _cheatMode);
|
_conf.setValue("cheat_mode"_s, _cheatMode);
|
||||||
_conf.setValue("unsafe_mode"_s, _unsafeMode);
|
|
||||||
_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);
|
||||||
|
|
||||||
|
|
|
@ -166,23 +166,16 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
|
||||||
template<typename Functor, typename... Args>
|
template<typename Functor, typename... Args>
|
||||||
auto drawUnsafeWidget(Functor func, Args... args) -> bool {
|
auto drawUnsafeWidget(Functor func, Args... args) -> bool {
|
||||||
GameState game_state = _gameState; // Copying the value to reduce the risk of a data race.
|
GameState game_state = _gameState; // Copying the value to reduce the risk of a data race.
|
||||||
if(!_unsafeMode && game_state != GameState::NotRunning) {
|
ImGui::BeginDisabled(game_state != GameState::NotRunning);
|
||||||
ImGui::BeginDisabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool result = func(std::forward<Args>(args)...);
|
bool result = func(std::forward<Args>(args)...);
|
||||||
|
|
||||||
if(!_unsafeMode && game_state != GameState::NotRunning) {
|
|
||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
} // Obviously, should only be used with ImGui widgets that return a bool.
|
} // 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...
|
// Also, func should be a lambda if there are any default arguments, like ImGui::Button(), etc...
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
void drawUnsafeText(Containers::StringView text, Args... args) { // Alternative to the above, for ImGui::Text*() variants.
|
void drawUnsafeText(Containers::StringView text, Args... args) { // Alternative to the above, for ImGui::Text*() variants.
|
||||||
if(!_unsafeMode && _gameState != GameState::NotRunning) {
|
if(_gameState != GameState::NotRunning) {
|
||||||
ImGui::TextDisabled(text, std::forward<Args>(args)...);
|
ImGui::TextDisabled(text, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -276,7 +269,6 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
|
||||||
|
|
||||||
bool _skipDisclaimer{false};
|
bool _skipDisclaimer{false};
|
||||||
bool _checkUpdatesOnStartup{true};
|
bool _checkUpdatesOnStartup{true};
|
||||||
bool _unsafeMode{false};
|
|
||||||
|
|
||||||
bool _updateAvailable{false};
|
bool _updateAvailable{false};
|
||||||
Containers::String _latestVersion;
|
Containers::String _latestVersion;
|
||||||
|
|
|
@ -54,13 +54,6 @@ void SaveTool::initialiseConfiguration() {
|
||||||
_conf.setValue("cheat_mode"_s, _cheatMode);
|
_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)) {
|
if(_conf.hasValue("startup_update_check"_s)) {
|
||||||
_checkUpdatesOnStartup = _conf.value<bool>("startup_update_check"_s);
|
_checkUpdatesOnStartup = _conf.value<bool>("startup_update_check"_s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,7 @@ auto SaveTool::drawRenamePopup(Containers::ArrayView<char> name_view) -> bool {
|
||||||
callback, nullptr);
|
callback, nullptr);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
GameState game_state = _gameState;
|
GameState game_state = _gameState;
|
||||||
if((!_unsafeMode && game_state != GameState::NotRunning) ||
|
if(game_state != GameState::NotRunning ||
|
||||||
!(len >= 6 && len <= 32) ||
|
!(len >= 6 && len <= 32) ||
|
||||||
!(name_view[0] != ' ' && name_view[len - 1] != ' '))
|
!(name_view[0] != ' ' && name_view[len - 1] != ' '))
|
||||||
{
|
{
|
||||||
|
@ -158,7 +158,7 @@ auto SaveTool::drawRenamePopup(Containers::ArrayView<char> name_view) -> bool {
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
if((!_unsafeMode && game_state != GameState::NotRunning) ||
|
if(game_state != GameState::NotRunning ||
|
||||||
!(len >= 6 && len <= 32) ||
|
!(len >= 6 && len <= 32) ||
|
||||||
!(name_view[0] != ' ' && name_view[len - 1] != ' '))
|
!(name_view[0] != ' ' && name_view[len - 1] != ' '))
|
||||||
{
|
{
|
||||||
|
@ -249,7 +249,7 @@ void SaveTool::drawGeneralInfo() {
|
||||||
}
|
}
|
||||||
drawTooltip("Story progress directly affects unlocked levels.");
|
drawTooltip("Story progress directly affects unlocked levels.");
|
||||||
if(ImGui::BeginPopup("StoryProgressMenu")) {
|
if(ImGui::BeginPopup("StoryProgressMenu")) {
|
||||||
if(!_unsafeMode && _gameState != GameState::NotRunning) {
|
if(_gameState != GameState::NotRunning) {
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
for(const auto& sp : story_progress) {
|
for(const auto& sp : story_progress) {
|
||||||
|
@ -473,7 +473,7 @@ void SaveTool::drawMassManager() {
|
||||||
|
|
||||||
ImGui::EndDragDropSource();
|
ImGui::EndDragDropSource();
|
||||||
}
|
}
|
||||||
if((_unsafeMode || _gameState == GameState::NotRunning) && ImGui::BeginDragDropTarget()) {
|
if(_gameState == GameState::NotRunning && ImGui::BeginDragDropTarget()) {
|
||||||
if(const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("StagedMass")) {
|
if(const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("StagedMass")) {
|
||||||
if(payload->DataSize != sizeof(Containers::String)) {
|
if(payload->DataSize != sizeof(Containers::String)) {
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error",
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error",
|
||||||
|
|
|
@ -103,12 +103,6 @@ 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("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::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")) {
|
||||||
|
|
Loading…
Reference in a new issue