Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions location/drivers/android.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/

#include "../../command.h"
#include "../../location_driver.h"
#include "../../retroarch.h"

Expand Down Expand Up @@ -134,12 +135,26 @@ static bool android_location_start(void *data)

static void android_location_stop(void *data)
{
struct android_app *android_app = (struct android_app*)g_android;
androidlocation_t *androidlocation = (androidlocation_t*)data;
JNIEnv *env = jni_thread_getenv();
if (!env)
if (!androidlocation || !env)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why the original PR added this check. If androidlocation is nullptr, handling it like this is probably wrong.

Thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷 Probably in case the app was told to stop multiple times, to avoid multiple unnecessary writes? Not sure it really matters, the calls are supposed to be smart enough to know that nothing needs to be written.

return;

#if 0
Copy link
Contributor Author

@fishcu fishcu Feb 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the iOS version: https://github.com/libretro/RetroArch/blob/master/ui/drivers/ui_cocoatouch.m#L793

We can see that the only event called is CMD_EVENT_SAVE_FILES. I commented out this code block for now but left the code until I gain more clarity from the discussion in other threads.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS is probably wrong here.

settings_t* settings = config_get_ptr();
if (settings->bools.auto_save_state)
{
/* Make a save state */
command_event(CMD_EVENT_SAVE_STATE, NULL);

/* Flush the auto save state to disk */
command_event(CMD_EVENT_AUTOSAVE_DELETE, NULL);
}
#endif

command_event(CMD_EVENT_SAVE_FILES, NULL);

struct android_app *android_app = (struct android_app*)g_android;
CALL_VOID_METHOD(env, android_app->activity->clazz,
androidlocation->onLocationStop);
}
Expand Down
Loading