Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

settings don't save on android when closing app via "Recents" screen #14229

Closed
sotha1 opened this issue Jan 8, 2024 · 11 comments · Fixed by #14266
Closed

settings don't save on android when closing app via "Recents" screen #14229

sotha1 opened this issue Jan 8, 2024 · 11 comments · Fixed by #14266
Labels
Android Bug Issues that were confirmed to be a bug High priority @ Mainmenu

Comments

@sotha1
Copy link

sotha1 commented Jan 8, 2024

Minetest version

Minetest 5.8.0
irrlicht device: ANDROID
openGL ES 3.2 build

Active renderer

openGL ES 3.2 build

Irrlicht device

ANDROID

Operating system and version

android 9

CPU model

MediaTek MT6739 1.5 GHz 2gb ram

GPU model

integrated

OpenGL version

3.2 build

Summary

when i open my minetest settings and change any option and close the game, and open it again it doesn't save the changes

2024_01_08_10_50_16.mp4

Steps to reproduce

first download minetest from https://www.minetest.net/downloads/
all the three sources (f-droid, play store and the directly "download the apk" ) have the bug (i tested it in them all)
Captura de tela de 2024-01-08 11-10-49
(remembering that i downloaded the apk from my phone directly)
download it on your device
open the game and try to change any setting, after close the game and re-open it

@sotha1 sotha1 added the Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible label Jan 8, 2024
@sotha1
Copy link
Author

sotha1 commented Jan 8, 2024

edit: i tried to downloaded it from f-droid and play store and the bug still hapenning

@srifqi
Copy link
Member

srifqi commented Jan 9, 2024

What will happen if you tried to press the Back button to close Minetest instead of killing it from recent application list?

@sotha1
Copy link
Author

sotha1 commented Jan 9, 2024

What will happen if you tried to press the Back button to close Minetest instead of killing it from recent application list?

the game still working in background, so it keep saved

@tetsuo55
Copy link

tetsuo55 commented Jan 10, 2024

What it looks like to me is that minetest saves the settings to storage on exit and not when closing the settings dialogue.

When minetest crashes or is force closed the changed settings are lost, I can confirm, it's not just settings by the way, but also things like currently selected world

Exiting by using the menu to exit the game saves the settings as expected

The fix would be to save the settings/launcher status to storage when closing the settings menu/launching a game

@grorp grorp added Bug Issues that were confirmed to be a bug and removed Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible labels Jan 12, 2024
@grorp grorp changed the title settings don't save on android settings don't save on android when closing app via "Recents" screen Jan 12, 2024
@Unacceptium
Copy link

i known this for so long. workaround: set your setting and join a singleplayer world. for some reason it forces to save. NOT working with contentDB flags.

@sotha1
Copy link
Author

sotha1 commented Jan 17, 2024

I saw that clicking on "exit o.s" playing a world instead of closing directly through the recent section works, so I suggest creating a button in the main menu to be able to exit the game or automatically create a dialog when you press the "back" button asking if you really want to exit, then it automatically saves the settings ( (of course, this whole suggestion is in vain if it is possible to do something that automatically saves the game when exiting without needing a dialog box or buttons)

@Unacceptium
Copy link

@sotha1 full agree!

@grorp
Copy link
Member

grorp commented Jan 17, 2024

creating a button in the main menu to be able to exit the game

That's possible, but it probably wouldn't stop people from closing Minetest via the "Recents" screen and losing their setting changes.

automatically create a dialog when you press the "back" button asking if you really want to exit, then it automatically saves the settings

That wouldn't help, using the back button in the mainmenu already quits Minetest and saves the settings.

@sotha1
Copy link
Author

sotha1 commented Jan 17, 2024

That's possible, but it probably wouldn't stop people from closing Minetest via the "Recents" screen and losing their setting changes.

i know that, but if mt warn players that exiting without the action of pressing a button or accepting a dialog box will not save the game (or maybe people only realize this over time) They will have to get used to doing that anyway to avoid losing their game data.

@srifqi
Copy link
Member

srifqi commented Jan 19, 2024

Removing application from the Recents screen is the same as terminating/ending the process. It skips saving configuration/settings which is called when exiting normally (closing the window or pressing Esc or Back button in the main menu).

minetest/src/main.cpp

Lines 272 to 274 in 49ce5a2

// Update configuration file
if (!g_settings_path.empty())
g_settings->updateConfigFile(g_settings_path.c_str());

// Break out of menu-game loop to shut down cleanly
if (!m_rendering_engine->run() || *kill) {
if (!g_settings_path.empty())
g_settings->updateConfigFile(g_settings_path.c_str());
break;
}

Summary for Android version

Action Configuration is saved
Pressing Back button in the main menu ✅ Yes
Pressing Exit to OS in the (in-game) pause menu ✅ Yes
Removing Minetest from the Recents screen while Minetest is still running/playing ❌ No

@grorp
Copy link
Member

grorp commented Jan 19, 2024

That's a good summary 👍

Saving the settings in this place

// Break out of menu-game loop to shut down cleanly
if (!m_rendering_engine->run() || *kill) {
if (!g_settings_path.empty())
g_settings->updateConfigFile(g_settings_path.c_str());
break;
}

is useless as far as I can see, since the save code in main.cpp always runs after this save code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Bug Issues that were confirmed to be a bug High priority @ Mainmenu
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants