Ask for confirmation before reset

This commit is contained in:
Lior Halphon
2025-07-22 00:10:19 +03:00
parent c6a968ed74
commit eb38034b76

View File

@@ -978,10 +978,23 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp)
- (void)reset - (void)reset
{ {
[self stop]; UIAlertControllerStyle style = [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad?
_skipAutoLoad = true; UIAlertControllerStyleAlert : UIAlertControllerStyleActionSheet;
GB_reset(&_gb); UIAlertController *menu = [UIAlertController alertControllerWithTitle:@"Reset Emulation?"
[self start]; 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 - (void)openLibrary