1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Save the settings in more cases to avoid losing setting changes (especially on Android) (#14266)

This commit is contained in:
grorp 2024-01-23 21:33:27 +01:00
parent 00f6bd0f08
commit 50edb30a18
4 changed files with 55 additions and 4 deletions

View file

@ -247,11 +247,8 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
}
// 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());
if (!m_rendering_engine->run() || *kill)
break;
}
m_rendering_engine->get_video_driver()->setTextureCreationFlag(
video::ETCF_CREATE_MIP_MAPS, g_settings->getBool("mip_map"));
@ -292,6 +289,16 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
receiver->m_touchscreengui = NULL;
#endif
/* Save the settings when leaving the game.
* This makes sure that setting changes made in-game are persisted even
* in case of a later unclean exit from the mainmenu.
* This is especially useful on Android because closing the app from the
* "Recents screen" results in an unclean exit.
* Caveat: This means that the settings are saved twice when exiting Minetest.
*/
if (!g_settings_path.empty())
g_settings->updateConfigFile(g_settings_path.c_str());
// If no main menu, show error and exit
if (skip_main_menu) {
if (!error_message.empty()) {
@ -555,6 +562,16 @@ void ClientLauncher::main_menu(MainMenuData *menudata)
/* leave scene manager in a clean state */
m_rendering_engine->get_scene_manager()->clear();
/* Save the settings when leaving the mainmenu.
* This makes sure that setting changes made in the mainmenu are persisted
* even in case of a later unclean exit from the game.
* This is especially useful on Android because closing the app from the
* "Recents screen" results in an unclean exit.
* Caveat: This means that the settings are saved twice when exiting Minetest.
*/
if (!g_settings_path.empty())
g_settings->updateConfigFile(g_settings_path.c_str());
}
void ClientLauncher::speed_tests()