Skip to content

Commit

Permalink
libpinmame: fix timefence, move time_to_quit into cpu_timeslice
Browse files Browse the repository at this point in the history
  • Loading branch information
jsm174 committed Sep 21, 2024
1 parent 05916c1 commit 0a7eef8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 7 additions & 1 deletion src/cpuexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ void time_fence_post()

int time_fence_wait(double secs)
{
int ns = max((int)ceil(secs * 1000000000.), 1);
int64_t ns = max((int64_t)ceil(secs * 1000000000.), (int64_t)1);
dispatch_time_t wait_length = dispatch_time(DISPATCH_TIME_NOW, ns);
return time_fence_is_supported() && (dispatch_semaphore_wait(time_fence_semaphore, wait_length) == 0);
}
Expand Down Expand Up @@ -967,6 +967,12 @@ static void cpu_timeslice(void)
win_process_events();
#endif

#if defined(LIBPINMAME)
extern int libpinmame_time_to_quit(void);
if (libpinmame_time_to_quit())
time_to_quit = 1;
#endif

// PinMAME: allow external synchronization by suspending emulation when a time fence is reached
// NOTE: if debugging stutter issues or the like, disable this mechanism in the core scripts, or directly here
if (options.time_fence != 0.0 && time_fence_is_supported())
Expand Down
7 changes: 0 additions & 7 deletions src/usrintrf.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ extern unsigned int coinlockedout[COIN_COUNTERS];
static int game_paused = 0; /* not zero if the game is paused */
#endif

#if defined(LIBPINMAME)
extern int libpinmame_time_to_quit(void);
#endif



/***************************************************************************
Expand Down Expand Up @@ -3877,9 +3873,6 @@ int handle_user_interface(struct mame_bitmap *bitmap)
#if defined(PINMAME) && defined(PROC_SUPPORT)
|| code_pressed(PROC_ESC_SEQ)
#endif /* PINMAME && PROC_SUPPORT */
#if defined(LIBPINMAME)
|| libpinmame_time_to_quit()
#endif /* LIBPINMAME_SUPPORT */
#if defined(LISY_SUPPORT)
//check in lisy for SIGUSR1
//and quit if we received it
Expand Down

0 comments on commit 0a7eef8

Please sign in to comment.