--- uae/src/include/events.h 2018/04/24 17:17:09 1.1.1.13 +++ uae/src/include/events.h 2018/04/24 17:18:59 1.1.1.14 @@ -9,9 +9,7 @@ * Copyright 1995-1998 Bernd Schmidt */ -#include "machdep/rpt.h" - -extern int use_gtod; +typedef unsigned long frame_time_t; extern frame_time_t vsynctime, vsyncmintime; extern frame_time_t gtod_resolution; @@ -22,16 +20,14 @@ extern unsigned long gtod_secs; extern unsigned long nr_gtod_to_skip; extern unsigned long nr_gtod_done, gtod_counter; -extern int rpt_available; - -extern void reset_frame_rate_hack (void); -extern void compute_vsynctime (void); -extern void time_vsync (void); +extern int sync_with_sound; +extern int use_gtod; extern unsigned long currcycle, nextevent; extern int is_lastline; -extern volatile int blocking_on_sound; +extern volatile int delaying_for_sound; +extern int active_fs_packets; typedef void (*evfunc)(void); @@ -49,16 +45,19 @@ enum { extern struct ev eventtab[ev_max]; +extern void reset_frame_rate_hack (void); +extern void compute_vsynctime (void); +extern void time_vsync (void); + +extern void init_gtod (void); + STATIC_INLINE frame_time_t get_current_time (int redo_secs) { - if (use_gtod) { - struct timeval tv; - gettimeofday (&tv, NULL); - if (redo_secs) - gtod_secs = tv.tv_sec; - return tv.tv_usec + (tv.tv_sec - gtod_secs) * 1000000; - } - return read_processor_time (); + struct timeval tv; + gettimeofday (&tv, NULL); + if (redo_secs) + gtod_secs = tv.tv_sec; + return tv.tv_usec + (tv.tv_sec - gtod_secs) * 1000000; } STATIC_INLINE void events_schedule (void) @@ -78,7 +77,7 @@ STATIC_INLINE void events_schedule (void STATIC_INLINE void do_cycles_slow (unsigned long cycles_to_add) { - if (blocking_on_sound) + if (delaying_for_sound) return; if (is_lastline @@ -91,10 +90,6 @@ STATIC_INLINE void do_cycles_slow (unsig return; gtod_counter = 0; curr = get_current_time (0); - if (is_lastline == 1) { - is_lastline = 2; - first_measured_gtod = curr; - } if ((long int)(curr - vsyncmintime) < 0) { nr_gtod_done++; @@ -120,26 +115,6 @@ STATIC_INLINE void do_cycles_slow (unsig currcycle += cycles_to_add; } -STATIC_INLINE void do_cycles_fast (void) -{ - if (is_lastline && eventtab[ev_hsync].evtime - currcycle <= 1 - && (long int)(read_processor_time () - vsyncmintime) < 0) - return; - - currcycle++; - if (nextevent == currcycle) { - int i; - - for (i = 0; i < ev_max; i++) { - if (eventtab[i].active && eventtab[i].evtime == currcycle) { - (*eventtab[i].handler) (); - } - } - events_schedule(); - } - -} - /* This is a special-case function. Normally, all events should lie in the future; they should only ever be active at the current cycle during do_cycles. However, a snapshot is saved during do_cycles, and so when @@ -161,8 +136,4 @@ STATIC_INLINE unsigned long get_cycles ( extern void init_eventtab (void); -#if /* M68K_SPEED == 1 */ 0 -#define do_cycles do_cycles_fast -#else #define do_cycles do_cycles_slow -#endif