DGen/SDL
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
pd.h
Go to the documentation of this file.
1
#ifndef __PD_H__
2
#define __PD_H__
3
4
#include <stdio.h>
5
#include <stdlib.h>
6
#include "
md.h
"
7
8
// DGen/SDL v1.17+
9
// Platform-dependent interface
10
// Your platform implementation needs to define all these functions and
11
// variables!
12
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
17
// bits-per-pixel.
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);
32
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
// Sound, if any, should be paused at first. Sound should start when this
46
// function is called.
47
void
pd_sound_start
();
48
// Likewise, sound should pause if this function is called.
49
void
pd_sound_pause
();
50
// This should return samples read/write indices in the buffer.
51
unsigned
int
pd_sound_rp
();
52
unsigned
int
pd_sound_wp
();
53
// And this function is called to commit the sound buffers to be played.
54
void
pd_sound_write
();
55
56
// Register platform-specific rc variables
57
void
pd_rc
();
58
// This should be a list of all the command-line options specific to this
59
// platform, in the form given to getopt(3), i.e "a:b::c".
60
extern
const
char
*
pd_options
;
61
// And, this is called to handle platform-specific stuff.
62
void
pd_option
(
char
c,
const
char
*optarg);
63
64
// This is called after displaying the base options for help, so that you may
65
// document your platform-specific command-line options etc.
66
void
pd_help
();
67
68
// This is called before each frame to handle events, and update the MegaDrive
69
// accordingly. It returns 1 to continue playing the game, or 0 to quit.
70
int
pd_handle_events
(
md
&megad);
71
72
// Tells whether DGen stopped intentionally so emulation can resume without
73
// skipping frames.
74
int
pd_stopped
();
75
76
// If true, stop emulation (display last frame repeatedly).
77
extern
bool
pd_freeze
;
78
79
// These are called to display and clear game messages.
80
void
pd_message
(
const
char
*fmt, ...);
81
void
pd_clear_message
();
82
// This should display cartridge header info. You can do this any way you like,
83
// I don't care. :)
84
void
pd_show_carthead
(
md
&megad);
85
86
// This should clean up the mess you made. ;)
87
void
pd_quit
();
88
89
#endif // __PD_H__
Generated on Sat Feb 9 2013 21:30:13 for DGen/SDL by
1.8.1.1