9 // Platform-dependent interface
10 // Your platform implementation needs to define all these functions and
13 // Return the number of microseconds elapsed since an unspecified time.
14 unsigned long pd_usecs(void);
15 // This is the struct bmap setup by your implementation.
16 // It should be 336x240 (or 336x256 in PAL mode), in 8, 12, 15, 16, 24 or 32
18 extern struct bmap mdscr
;
19 // Also, you should allocate a 256-char palette array, if need be. Otherwise
20 // this can be NULL if you don't have a paletted display.
21 extern unsigned char *mdpal
;
22 // Initialize graphics, in NTSC (320x224) or PAL (320x240) mode.
23 // Since many interfaces require that DGen be setuid-root, this should also
24 // discard root priviledges, if at all necessary.
25 // It should return 1 on successful setup, or 0 if something wrong happened.
26 int pd_graphics_init(int want_sound
, int want_pal
, int hz
);
27 int pd_graphics_reinit(int want_sound
, int want_pal
, int hz
);
28 // This updats the palette, if necessary.
29 void pd_graphics_palette_update();
30 // This updates the screen, with the mdscr bitmap.
31 void pd_graphics_update(bool update
);
33 // This is the struct sndinfo, also setup by your implementation.
34 // Note that the buffers pointed to in this struct should ALWAYS be 16-bit
35 // signed format, regardless of the actual audio format.
36 extern struct sndinfo sndi
;
37 // Initialize sound, with the given frequency and number of samples.
38 // It should keep samples' worth of sound buffered.
39 // The parameters should all be modified to reflect the actual characteristics.
40 // This is always called after pd_graphics_init, so you can count on graphics
41 // stuff being initialized. :)
42 // It should return 1 on successful setup, or 0 if something wrong happened.
43 int pd_sound_init(long &freq
, unsigned int &samples
);
44 void pd_sound_deinit();
45 // This should return samples read/write indices in the buffer.
46 unsigned int pd_sound_rp();
47 unsigned int pd_sound_wp();
48 // And this function is called to commit the sound buffers to be played.
49 void pd_sound_write();
51 // Register platform-specific rc variables
53 // This should be a list of all the command-line options specific to this
54 // platform, in the form given to getopt(3), i.e "a:b::c".
55 extern const char *pd_options
;
56 // And, this is called to handle platform-specific stuff.
57 void pd_option(char c
, const char *optarg
);
59 // This is called after displaying the base options for help, so that you may
60 // document your platform-specific command-line options etc.
63 // This is called before each frame to handle events, and update the MegaDrive
64 // accordingly. It returns 1 to continue playing the game, or 0 to quit.
65 int pd_handle_events(md
&megad
);
67 // Tells whether DGen stopped intentionally so emulation can resume without
71 // If true, stop emulation (display last frame repeatedly).
72 extern bool pd_freeze
;
74 // These are called to display and clear game messages.
75 void pd_message(const char *fmt
, ...);
76 void pd_clear_message();
77 // This should display cartridge header info. You can do this any way you like,
79 void pd_show_carthead(md
&megad
);
81 // This should clean up the mess you made. ;)