Skip to content

Commit

Permalink
Disable screen dimming while emulation is running
Browse files Browse the repository at this point in the history
  • Loading branch information
LIJI32 committed Jun 9, 2024
1 parent e578843 commit 76c9325
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions iOS/GBViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,9 @@ - (UIStatusBarStyle)preferredStatusBarStyle

- (void)preRun
{
dispatch_async(dispatch_get_main_queue(), ^{
UIApplication.sharedApplication.idleTimerDisabled = true;
});
GB_set_pixels_output(&_gb, _gbView.pixels);
GB_set_sample_rate(&_gb, 96000);
if (![[[NSUserDefaults standardUserDefaults] stringForKey:@"GBAudioMode"] isEqual:@"off"]) {
Expand Down Expand Up @@ -934,6 +937,10 @@ - (void)postRun
[center addNotificationRequest:request withCompletionHandler:nil];
[[NSUserDefaults standardUserDefaults] setBool:true forKey:@"GBNotificationsUsed"];
}

dispatch_async(dispatch_get_main_queue(), ^{
UIApplication.sharedApplication.idleTimerDisabled = false;
});
}

- (void)start
Expand Down

0 comments on commit 76c9325

Please sign in to comment.