mirror of https://github.com/mgba-emu/mgba.git
Core: Add mTimingScheduleAbsolute
This commit is contained in:
parent
6ab8193279
commit
549787227a
|
@ -35,6 +35,7 @@ void mTimingInit(struct mTiming* timing, int32_t* relativeCycles, int32_t* nextE
|
|||
void mTimingDeinit(struct mTiming* timing);
|
||||
void mTimingClear(struct mTiming* timing);
|
||||
void mTimingSchedule(struct mTiming* timing, struct mTimingEvent*, int32_t when);
|
||||
void mTimingScheduleAbsolute(struct mTiming* timing, struct mTimingEvent*, int32_t when);
|
||||
void mTimingDeschedule(struct mTiming* timing, struct mTimingEvent*);
|
||||
bool mTimingIsScheduled(const struct mTiming* timing, const struct mTimingEvent*);
|
||||
int32_t mTimingTick(struct mTiming* timing, int32_t cycles);
|
||||
|
|
|
@ -50,6 +50,10 @@ void mTimingSchedule(struct mTiming* timing, struct mTimingEvent* event, int32_t
|
|||
*previous = event;
|
||||
}
|
||||
|
||||
void mTimingScheduleAbsolute(struct mTiming* timing, struct mTimingEvent* event, int32_t when) {
|
||||
mTimingSchedule(timing, event, when - mTimingCurrentTime(timing));
|
||||
}
|
||||
|
||||
void mTimingDeschedule(struct mTiming* timing, struct mTimingEvent* event) {
|
||||
if (timing->reroot) {
|
||||
timing->root = timing->reroot;
|
||||
|
|
|
@ -109,9 +109,8 @@ void GBATimerUpdateRegister(struct GBA* gba, int timer, int32_t cyclesLate) {
|
|||
tickIncrement = (0x10000 - tickIncrement) << prescaleBits;
|
||||
currentTime += tickIncrement;
|
||||
currentTime &= ~tickMask;
|
||||
currentTime -= mTimingCurrentTime(&gba->timing);
|
||||
mTimingDeschedule(&gba->timing, ¤tTimer->event);
|
||||
mTimingSchedule(&gba->timing, ¤tTimer->event, currentTime);
|
||||
mTimingScheduleAbsolute(&gba->timing, ¤tTimer->event, currentTime);
|
||||
}
|
||||
|
||||
void GBATimerWriteTMCNT_LO(struct GBA* gba, int timer, uint16_t reload) {
|
||||
|
|
Loading…
Reference in New Issue