Make android save more robust
This commit is contained in:
parent
3ba403f30e
commit
e8cba9dc15
14 changed files with 61 additions and 33 deletions
19
src/main.cpp
19
src/main.cpp
|
|
@ -616,6 +616,9 @@ void regular_draw(MainStruct& mS) {
|
|||
}
|
||||
|
||||
SDL_AppResult SDL_AppIterate(void *appstate) {
|
||||
#ifdef __ANDROID__
|
||||
std::scoped_lock a{AndroidJNICalls::globalMutex};
|
||||
#endif
|
||||
std::chrono::steady_clock::time_point frameTimeStart = std::chrono::steady_clock::now();
|
||||
|
||||
MainStruct& mS = *((MainStruct*)appstate);
|
||||
|
|
@ -626,12 +629,8 @@ SDL_AppResult SDL_AppIterate(void *appstate) {
|
|||
#endif
|
||||
mS.m->update();
|
||||
|
||||
if(mS.m->setToQuit) {
|
||||
#ifdef __ANDROID__
|
||||
mS.m->input_app_about_to_go_to_background_callback();
|
||||
#endif
|
||||
if(mS.m->setToQuit)
|
||||
return SDL_APP_SUCCESS;
|
||||
}
|
||||
|
||||
if(mS.m->input.hideCursor) {
|
||||
SDL_HideCursor();
|
||||
|
|
@ -659,6 +658,10 @@ SDL_AppResult SDL_AppIterate(void *appstate) {
|
|||
}
|
||||
|
||||
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) {
|
||||
#ifdef __ANDROID__
|
||||
std::scoped_lock a{AndroidJNICalls::globalMutex};
|
||||
#endif
|
||||
|
||||
MainStruct& mS = *((MainStruct*)appstate);
|
||||
|
||||
#ifdef NDEBUG
|
||||
|
|
@ -840,12 +843,8 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) {
|
|||
}
|
||||
#endif
|
||||
|
||||
if(mS.m->setToQuit) {
|
||||
#ifdef __ANDROID__
|
||||
mS.m->input_app_about_to_go_to_background_callback();
|
||||
#endif
|
||||
if(mS.m->setToQuit)
|
||||
return SDL_APP_SUCCESS;
|
||||
}
|
||||
return SDL_APP_CONTINUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue