Skip to content

Commit acf2be8

Browse files
committed
Fixed edge case where window may not close when 'Close window after exiting' is enabled if the game has switched executables since launch. Fixed fast-forward bezel getting stuck on-screen if the window is closed while fast-forwarding.
1 parent 1a8d0bf commit acf2be8

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

Boxer/BXSession+BXEmulatorControls.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,11 @@ - (IBAction) fastForward: (id)sender
332332

333333
- (IBAction) releaseFastForward: (id)sender
334334
{
335-
if (!self.isEmulating) return;
336-
337-
if (self.emulator.turboSpeed)
335+
if (self.emulator.turboSpeed || _waitingForFastForwardRelease)
338336
{
339-
self.emulator.turboSpeed = NO;
337+
if (self.isEmulating)
338+
self.emulator.turboSpeed = NO;
339+
340340
BXBezelController *bezel = [BXBezelController controller];
341341
if (bezel.currentBezel == bezel.fastForwardBezel)
342342
[bezel hideBezel];

Boxer/BXSession.m

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -817,11 +817,15 @@ - (void) emulatorDidInitialize: (NSNotification *)notification
817817

818818
- (void) emulatorDidFinish: (NSNotification *)notification
819819
{
820+
//If we were fast-forwarding, clear the bezel now.
821+
[self releaseFastForward: self];
822+
820823
//Flag that we're no longer emulating
821824
self.emulating = NO;
825+
822826
//Turn off display-sleep suppression
823827
[self _syncSuppressesDisplaySleep];
824-
828+
825829
//Clear our program caches
826830
self.lastExecutedProgramPath = nil;
827831
self.lastLaunchedProgramPath = nil;
@@ -1008,14 +1012,16 @@ - (void) emulatorDidFinishProgram: (NSNotification *)notification
10081012
//Clear the last executed program when a startup program or 'non-defaultable'
10091013
//program finishes. This way, programWillStart: won't hang onto programs
10101014
//we can't use as the default, such as autoexec commands or dispatch batchfiles.
1011-
//(Note that the last executed program is always cleared down in didReturnToShell:)
1015+
1016+
//Note that we don't clear lastLaunchedProgramPath here, since the program may be
1017+
//passing control on to another program afterwards and we want to maintain a record
1018+
//of which program the user themselves actually launched. Both the last executed
1019+
//and the last launched program are always cleared down in didReturnToShell:.
10121020
NSString *executedPath = self.lastExecutedProgramPath;
10131021
BOOL executedPathCanBeDefault = (executedPath && _hasLaunched && [self.gamePackage validateTargetPath: &executedPath error: nil]);
10141022
if (!executedPathCanBeDefault)
10151023
{
10161024
self.lastExecutedProgramPath = nil;
1017-
//TODO: do we need to extend this to lastLaunchedProgramPath too?
1018-
//The logic here is pretty damn fuzzy.
10191025
}
10201026

10211027
//Check the running time of the program. If it was suspiciously short,
@@ -1224,8 +1230,8 @@ - (BOOL) _shouldCloseOnProgramExit
12241230
//Don't close if the auto-close preference is disabled for this gamebox
12251231
if (!self.gamePackage.closeOnExit) return NO;
12261232

1227-
//Don't close if we've been running a program other than the default program for the gamebox
1228-
if (![self.activeProgramPath isEqualToString: self.gamePackage.targetPath]) return NO;
1233+
//Don't close if we launched a program other than the default program for the gamebox
1234+
if (![self.lastLaunchedProgramPath isEqualToString: self.gamePackage.targetPath]) return NO;
12291235

12301236
//Don't close if there are drive imports in progress
12311237
if (self.isImportingDrives) return NO;

0 commit comments

Comments
 (0)