From eb38034b76e2e22596118fdf3c5829c5a6a56fe3 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Tue, 22 Jul 2025 00:10:19 +0300 Subject: [PATCH] Ask for confirmation before reset --- iOS/GBViewController.m | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/iOS/GBViewController.m b/iOS/GBViewController.m index 817e57f93..85effc896 100644 --- a/iOS/GBViewController.m +++ b/iOS/GBViewController.m @@ -978,10 +978,23 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp) - (void)reset { - [self stop]; - _skipAutoLoad = true; - GB_reset(&_gb); - [self start]; + UIAlertControllerStyle style = [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad? + UIAlertControllerStyleAlert : UIAlertControllerStyleActionSheet; + UIAlertController *menu = [UIAlertController alertControllerWithTitle:@"Reset Emulation?" + message:@"Unsaved progress will be lost." + preferredStyle:style]; + [menu addAction:[UIAlertAction actionWithTitle:@"Reset" + style:UIAlertActionStyleDestructive + handler:^(UIAlertAction *action) { + [self stop]; + _skipAutoLoad = true; + GB_reset(&_gb); + [self start]; + }]]; + [menu addAction:[UIAlertAction actionWithTitle:@"Cancel" + style:UIAlertActionStyleCancel + handler:nil]]; + [self presentViewController:menu animated:true completion:nil]; } - (void)openLibrary