Allow setting manual clock for emu events
This commit is contained in:
parent
31e8802803
commit
73b19ca1c4
@ -6,10 +6,17 @@
|
|||||||
int first_clock_set = 0;
|
int first_clock_set = 0;
|
||||||
int64_t first_clock; /* First clock */
|
int64_t first_clock; /* First clock */
|
||||||
int64_t last_clock; /* Clock from the last event */
|
int64_t last_clock; /* Clock from the last event */
|
||||||
|
int64_t next_clock = -1; /* Clock for the next event */
|
||||||
|
|
||||||
int64_t get_clock(void)
|
int64_t get_clock(void)
|
||||||
{
|
{
|
||||||
|
if (next_clock >= 0) {
|
||||||
|
last_clock = next_clock;
|
||||||
|
next_clock = -1;
|
||||||
|
} else {
|
||||||
last_clock = (int64_t) ovni_clock_now();
|
last_clock = (int64_t) ovni_clock_now();
|
||||||
|
}
|
||||||
|
|
||||||
if (first_clock_set == 0) {
|
if (first_clock_set == 0) {
|
||||||
first_clock = last_clock;
|
first_clock = last_clock;
|
||||||
first_clock_set = 1;
|
first_clock_set = 1;
|
||||||
@ -18,6 +25,11 @@ int64_t get_clock(void)
|
|||||||
return last_clock;
|
return last_clock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_clock(int64_t t)
|
||||||
|
{
|
||||||
|
next_clock = t;
|
||||||
|
}
|
||||||
|
|
||||||
int64_t get_delta(void)
|
int64_t get_delta(void)
|
||||||
{
|
{
|
||||||
return last_clock - first_clock;
|
return last_clock - first_clock;
|
||||||
|
|||||||
@ -17,6 +17,7 @@ extern int64_t first_clock;
|
|||||||
extern int64_t last_clock;
|
extern int64_t last_clock;
|
||||||
|
|
||||||
int64_t get_clock(void);
|
int64_t get_clock(void);
|
||||||
|
void set_clock(int64_t t);
|
||||||
int64_t get_delta(void);
|
int64_t get_delta(void);
|
||||||
|
|
||||||
#define INSTR_0ARG(name, mcv) \
|
#define INSTR_0ARG(name, mcv) \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user