2 This are just a few usefull routines for emulators on unix systems,
3 they can be used for games on unix in general.
4 Current implement stuff:
9 /* configuration part, set the correct defines for your system here or in the
12 HAVE_GETTIMEOFDAY -define this if your version of unix supports the
13 gettimeofday() routine, and you want it used for
15 HAVE_USLEEP -define this if your version of unix supports the
16 usleep() routine, and you want it used for
17 giving away unused CPU time.
18 JOYSTICK -define this if you want i386 style joystick
19 support, don't compile this if you don't
20 have the i386 style joystick driver, otherwise
21 emu_util won't compile.
23 /* #define HAVE_GETTIMEOFDAY */
24 /* #define JOYSTICK */
29 /* You should call this function before using slowdown, it calculates the
30 number of uclocks per screenrefresh.
31 Arguments: frames per second the emulation should be slowed to.
33 void slowdown_init(int frames_per_sec
);
35 /* When called once every frame update this function slowsdown the emulation
36 to the number of frames / sec given to init_slowdown.
37 it's return value can be used to automaticly skip frames, it returns:
38 1 if it actually slowed the emulation
39 0 if the emulation is too slow.
40 So if this function returns 1 draw the next frame. If it returns 0 skip the
41 next frame, to catch up speed.
43 int slowdown_slow(void);
45 /* This function should be called every time the emulation is stopped for
46 any reason at all. The slowdown routine's use this function together with
47 slowdown_start. To recalibrate there timing.
48 This function should be used in conjunction with slowdown_resume.
50 void slowdown_pause(void);
52 /* This function should be called every time the emulation is resumed after
53 being stopped for any reason at all. This function should be used in
54 conjunction with slowdown_pause.
56 void slowdown_resume(void);
58 /* This function returns the number of seconds the emulation is running.
59 Not counting the seconds the emulation has been paused by slowdown_pause.
61 int slowdown_seconds_running(void);
66 /* joystick data struct */
78 /* This function initialises all joystick related stuff,
79 it returns the nr of joysticks detected */
80 int joystick_init(void);
82 /* This functions cleans up all joystick related stuff */
83 void joystick_close(void);
85 /* This function reads the current joystick values and stores
86 them in the joydata structs which are given.
87 joy0 is mandatory, joy1 is optional and maybe NULL.
88 This functions returns:
90 1 if reading for joy0 failed
91 2 if reading for joy1 failed
93 The data stored in the structs is only valid when this functions
94 returns 0! The call will fail when joy2 is not NULL and only
95 one joystick is detected. (although the data in joy0 will still
97 int joystick_read(struct joy_data
*joy0
, struct joy_data
*joy1
);
99 #endif /* #ifdef JOYSTICK */