-
Notifications
You must be signed in to change notification settings - Fork 0
/
system.h
91 lines (75 loc) · 1.92 KB
/
system.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef _SYSTEM_H_
#define _SYSTEM_H_
#define APP_NAME "SMS Plus"
#define APP_VERSION "1.2"
#define PALETTE_SIZE 0x20
/* Mask for removing unused pixel data */
#define PIXEL_MASK 0x1F
/* These can be used for 'input.pad[]' */
#define INPUT_UP 0x00000001
#define INPUT_DOWN 0x00000002
#define INPUT_LEFT 0x00000004
#define INPUT_RIGHT 0x00000008
#define INPUT_BUTTON2 0x00000010
#define INPUT_BUTTON1 0x00000020
/* These can be used for 'input.system' */
#define INPUT_START 0x00000001 /* Game Gear only */
#define INPUT_PAUSE 0x00000002 /* Master System only */
#define INPUT_RESET 0x00000004 /* Master System only */
enum {
SRAM_SAVE = 0,
SRAM_LOAD = 1
};
/* User input structure */
typedef struct
{
uint32 pad[2];
int analog[2][2];
uint32 system;
} input_t;
/* Game image structure */
typedef struct
{
uint8 *rom;
uint8 pages;
uint32 crc;
uint32 sram_crc;
int mapper;
uint8 sram[0x8000];
uint8 fcr[4];
} cart_t;
/* Bitmap structure */
typedef struct
{
unsigned char *data;
int width;
int height;
int pitch;
int depth;
int granularity;
struct {
int x, y, w, h;
int ox, oy, ow, oh;
int changed;
} viewport;
struct
{
uint8 color[PALETTE_SIZE][3];
uint8 dirty[PALETTE_SIZE];
uint8 update;
}pal;
} bitmap_t;
/* Global variables */
extern bitmap_t bitmap; /* Display bitmap */
extern cart_t cart; /* Game cartridge data */
extern input_t input; /* Controller input */
/* Function prototypes */
void system_frame(int skip_render);
void system_init(void);
void system_reinit(void);
void system_shutdown(void);
void system_reset(void);
void system_manage_sram(uint8 *sram, int slot, int mode);
void system_poweron(void);
void system_poweroff(void);
#endif /* _SYSTEM_H_ */