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...";
|
||||
|
||||
_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);
|
||||
|
||||
|
|
|
@ -166,23 +166,16 @@ 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.
|
||||
if(!_unsafeMode && game_state != GameState::NotRunning) {
|
||||
ImGui::BeginDisabled();
|
||||
}
|
||||
|
||||
ImGui::BeginDisabled(game_state != GameState::NotRunning);
|
||||
bool result = func(std::forward<Args>(args)...);
|
||||
|
||||
if(!_unsafeMode && game_state != GameState::NotRunning) {
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
|
||||
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(!_unsafeMode && _gameState != GameState::NotRunning) {
|
||||
if(_gameState != GameState::NotRunning) {
|
||||
ImGui::TextDisabled(text, std::forward<Args>(args)...);
|
||||
}
|
||||
else {
|
||||
|
@ -276,7 +269,6 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
|
|||
|
||||
bool _skipDisclaimer{false};
|
||||
bool _checkUpdatesOnStartup{true};
|
||||
bool _unsafeMode{false};
|
||||
|
||||
bool _updateAvailable{false};
|
||||
Containers::String _latestVersion;
|
||||
|
|
|
@ -54,13 +54,6 @@ 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);
|
||||
}
|
||||
|
|
|
@ -146,8 +146,8 @@ auto SaveTool::drawRenamePopup(Containers::ArrayView<char> name_view) -> bool {
|
|||
callback, nullptr);
|
||||
ImGui::SameLine();
|
||||
GameState game_state = _gameState;
|
||||
if((!_unsafeMode && game_state != GameState::NotRunning) ||
|
||||
!(len >= 6 && len <= 32) ||
|
||||
if(game_state != GameState::NotRunning ||
|
||||
!(len >= 6 && len <= 32) ||
|
||||
!(name_view[0] != ' ' && name_view[len - 1] != ' '))
|
||||
{
|
||||
ImGui::BeginDisabled();
|
||||
|
@ -158,8 +158,8 @@ auto SaveTool::drawRenamePopup(Containers::ArrayView<char> name_view) -> bool {
|
|||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
||||
if((!_unsafeMode && game_state != GameState::NotRunning) ||
|
||||
!(len >= 6 && len <= 32) ||
|
||||
if(game_state != GameState::NotRunning ||
|
||||
!(len >= 6 && len <= 32) ||
|
||||
!(name_view[0] != ' ' && name_view[len - 1] != ' '))
|
||||
{
|
||||
ImGui::EndDisabled();
|
||||
|
@ -249,7 +249,7 @@ void SaveTool::drawGeneralInfo() {
|
|||
}
|
||||
drawTooltip("Story progress directly affects unlocked levels.");
|
||||
if(ImGui::BeginPopup("StoryProgressMenu")) {
|
||||
if(!_unsafeMode && _gameState != GameState::NotRunning) {
|
||||
if(_gameState != GameState::NotRunning) {
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
for(const auto& sp : story_progress) {
|
||||
|
@ -473,7 +473,7 @@ void SaveTool::drawMassManager() {
|
|||
|
||||
ImGui::EndDragDropSource();
|
||||
}
|
||||
if((_unsafeMode || _gameState == GameState::NotRunning) && ImGui::BeginDragDropTarget()) {
|
||||
if(_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",
|
||||
|
|
|
@ -103,12 +103,6 @@ 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")) {
|
||||
|
|
Loading…
Reference in a new issue