mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-05-09 03:41:10 +08:00
PIC: Offer a way for callbacks to retrieve what time they were meant to be called at
This commit is contained in:
parent
8689730070
commit
56da8f99a1
@ -49,6 +49,8 @@ extern Bitu PIC_Ticks;
|
||||
|
||||
typedef double pic_tickindex_t;
|
||||
|
||||
pic_tickindex_t PIC_GetCurrentEventTime(void);
|
||||
|
||||
static INLINE pic_tickindex_t PIC_TickIndex(void) {
|
||||
return ((pic_tickindex_t)(CPU_CycleMax-CPU_CycleLeft-CPU_Cycles)) / ((pic_tickindex_t)CPU_CycleMax);
|
||||
}
|
||||
|
@ -616,6 +616,13 @@ static void AddEntry(PICEntry * entry) {
|
||||
static bool InEventService = false;
|
||||
static pic_tickindex_t srv_lag = 0;
|
||||
|
||||
pic_tickindex_t PIC_GetCurrentEventTime(void) {
|
||||
if (InEventService)
|
||||
return (pic_tickindex_t)PIC_Ticks + srv_lag;
|
||||
else
|
||||
return PIC_FullIndex();
|
||||
}
|
||||
|
||||
void PIC_AddEvent(PIC_EventHandler handler,pic_tickindex_t delay,Bitu val) {
|
||||
if (GCC_UNLIKELY(!pic_queue.free_entry)) {
|
||||
LOG(LOG_PIC,LOG_ERROR)("Event queue full");
|
||||
|
Loading…
x
Reference in New Issue
Block a user