|
|
1.1 root 1: /*
2: Host system dependencies such as (real)time synchronizaton and events that
3: occur on host threads (e.g. VBL & timers) which need to be synchronized
4: to Previous CPU threads.
5: */
6:
7: #pragma once
8:
9: #ifndef __HOST_H__
10: #define __HOST_H__
11:
12: #include <SDL.h>
13: #include <stdbool.h>
14:
15: #ifdef __cplusplus
16: extern "C" {
17: #endif
18: #define REALTIME_INT_LVL 1
19:
20: #ifdef __MINGW32__
21: #define FMT_ll "I64"
22: #define FMT_zu "u"
23: #else
24: #define FMT_ll "ll"
25: #define FMT_zu "zu"
26: #endif
27:
28: enum {
29: MAIN_DISPLAY,
30: ND_DISPLAY,
31: ND_VIDEO,
32: };
33:
34: typedef SDL_SpinLock lock_t;
35: typedef SDL_Thread thread_t;
36: typedef SDL_ThreadFunction thread_func_t;
37:
38: void host_reset(void);
39: void host_realtime(bool state);
40: void host_blank(int slot, int src, bool state);
41: bool host_blank_state(int slot, int src);
42: Uint64 host_time_us(void);
43: Uint32 host_time_ms(void);
44: double host_time_sec(void);
45: void host_time(double* realTime, double* hostTime);
46: time_t host_unix_time(void);
47: void host_set_unix_time(time_t now);
48: void host_sleep_sec(double sec);
49: void host_sleep_ms(Uint32 ms);
50: void host_sleep_us(Uint64 us);
51: int host_num_cpus(void);
52: void host_hardclock(int expected, int actual);
53: double host_real_time_offset(void);
54: void host_pause_time(bool pausing);
55: const char* host_report(double realTime, double hostTime);
56: void host_darkmatter(bool state);
57:
58: void host_lock(lock_t* lock);
59: void host_unlock(lock_t* lock);
60: int host_trylock(lock_t* lock);
61: thread_t* host_thread_create(thread_func_t, void* data);
62: int host_thread_wait(thread_t* thread);
63:
64: #ifdef __cplusplus
65: }
66: #endif
67:
68: #endif /* __HOST_H__ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.