system.h
 1  
 2  #ifndef _SYSTEM_H_
 3  #define _SYSTEM_H_
 4  
 5  /* Input devices */
 6  #define MAX_DEVICES         (5)     /* 1, or 5 with the MultiTap */
 7  #define DEVICE_2BUTTON      (0)     /* Standard 2-button pad */
 8  #define DEVICE_3BUTTON      (1)     /* 3-button pad */
 9  #define DEVICE_6BUTTON      (2)     /* 6-button pad */
10  #define DEVICE_MULTITAP     (3)     /* MultiTap device */
11  
12  /* Input bitmasks */
13  #define INPUT_B6        (0x00000800)    /* 6 button pad only */
14  #define INPUT_B5        (0x00000400)    /* 6 button pad only */
15  #define INPUT_B4        (0x00000200)    /* 6 button pad only */
16  #define INPUT_B3        (0x00000100)    /* 3/6 button pad only */
17  #define INPUT_B2        (0x00000080)
18  #define INPUT_B1        (0x00000040)
19  #define INPUT_RUN       (0x00000020)
20  #define INPUT_SELECT    (0x00000010)
21  #define INPUT_LEFT      (0x00000008)
22  #define INPUT_RIGHT     (0x00000004)
23  #define INPUT_DOWN      (0x00000002)
24  #define INPUT_UP        (0x00000001)
25  
26  /* System input bitmasks */
27  #define SYSTEM_TGX      (0x00000001)    /* System is 1=TGX, 0=PCE */
28  
29  typedef struct
30  
31  {
32      uint8 *data;        /* Bitmap data */
33      int width;          /* Bitmap width (32+512+32) */
34      int height;         /* Bitmap height (256) */
35      int depth;          /* Color depth (8 bits) */
36      int pitch;          /* Width of bitmap in bytes */
37      int granularity;    /* Size of each pixel in bytes */
38      struct {
39          int x;          /* X offset of viewport within bitmap */
40          int y;          /* Y offset of viewport within bitmap */
41          int w;          /* Width of viewport */
42          int h;          /* Height of viewport */
43          int ow;         /* Previous width of viewport */
44          int oh;         /* Previous height of viewport */
45          int changed;    /* 1= Viewport width or height have changed */
46      }viewport;
47  }t_bitmap;  
48  
49  typedef struct
50  {
51      uint8 dev[5];       /* Can be any of the DEVICE_* values */
52      uint32 pad[5];      /* Can be any of the INPUT_* bitmasks */
53      uint32 system;      /* Can be any of the SYSTEM_* bitmasks */
54  }t_input;
55  
56  typedef struct
57  {
58      int sample_rate;    /* Sample rate (8000-44100) */
59      int enabled;        /* 1= sound emulation is enabled */
60      int buffer_size;    /* Size of sound buffer (in bytes) */
61      int16 *buffer[2];   /* Signed 16-bit stereo sound data */
62  }t_snd;
63  
64  /* Global variables */
65  //extern t_bitmap bitmap;
66  extern t_input input;
67  extern t_snd pcesnd;
68  
69  /* Function prototypes */
70  int system_init(int sample_rate);
71  void audio_init(int rate);
72  void system_frame(int skip);
73  void system_reset(void);
74  void system_shutdown(void);
75  
76  #endif /* _SYSTEM_H_ */
77