DGen/SDL
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
rc.h
Go to the documentation of this file.
1
// DGen/SDL v1.23+
2
#ifndef RC_H_
3
#define RC_H_
4
5
#include <stddef.h>
6
#include <stdio.h>
7
#include <stdint.h>
8
9
// Define the different craptv types
10
#define NUM_CTV 5 // Include CTV_OFF
11
#define NUM_SCALING 3
12
#define CTV_OFF 0
13
#define CTV_BLUR 1
14
#define CTV_SCANLINE 2
15
#define CTV_INTERLACE 3
16
#define CTV_SWAB 4
17
18
// Define OR masks for key modifiers
19
#define KEYSYM_MOD_ALT 0x40000000
20
#define KEYSYM_MOD_SHIFT 0x20000000
21
#define KEYSYM_MOD_CTRL 0x10000000
22
#define KEYSYM_MOD_META 0x08000000
23
#define KEYSYM_MOD_MASK 0x78000000
24
25
// Macros to manage joystick buttons.
26
//
27
// Integer format (32b): 000000tt iiiiiiii aaaaaaaa bbbbbbbb
28
//
29
// t: type (0-3):
30
// 0 if not configured/invalid.
31
// 1 for a normal button, "a" is ignored, "b" is the button index.
32
// 2 for an axis, "a" is the axis index, "b" is the axis direction.
33
// 3 for a hat, "a" is the hat index, "b" is the hat direction.
34
// i: system identifier for joystick/joypad (0-255).
35
// a: axis or hat index (0-255).
36
// b: button number (0-255), axis direction (0 if negative, 128 if between,
37
// 255 if positive), or hat direction (0 = center, 1 = up, 2 = right-up,
38
// 3 = right, 4 = right-down, 5 = down, 6 = left-down, 7 = left,
39
// 8 = left-up).
40
#define JS_AXIS_NEGATIVE 0x00
41
#define JS_AXIS_BETWEEN 0x80
42
#define JS_AXIS_POSITIVE 0xff
43
44
#define JS_HAT_CENTERED 0
45
#define JS_HAT_UP 1
46
#define JS_HAT_RIGHT_UP 2
47
#define JS_HAT_RIGHT 3
48
#define JS_HAT_RIGHT_DOWN 4
49
#define JS_HAT_DOWN 5
50
#define JS_HAT_LEFT_DOWN 6
51
#define JS_HAT_LEFT 7
52
#define JS_HAT_LEFT_UP 8
53
54
#define JS_TYPE_BUTTON 0x01
55
#define JS_TYPE_AXIS 0x02
56
#define JS_TYPE_HAT 0x03
57
58
#define JS_MAKE_IDENTIFIER(i) (((i) & 0xff) << 16)
59
#define JS_MAKE_BUTTON(b) \
60
((JS_TYPE_BUTTON << 24) | ((b) & 0xff))
61
#define JS_MAKE_AXIS(a, d) \
62
((JS_TYPE_AXIS << 24) | (((a) & 0xff) << 8) | ((d) & 0xff))
63
#define JS_MAKE_HAT(h, d) \
64
((JS_TYPE_HAT << 24) | (((h) & 0xff) << 8) | ((d) & 0xff))
65
66
#define JS_GET_IDENTIFIER(v) (((v) >> 16) & 0xff)
67
#define JS_IS_BUTTON(v) ((((v) >> 24) & 0xff) == JS_TYPE_BUTTON)
68
#define JS_IS_AXIS(v) ((((v) >> 24) & 0xff) == JS_TYPE_AXIS)
69
#define JS_IS_HAT(v) ((((v) >> 24) & 0xff) == JS_TYPE_HAT)
70
#define JS_GET_BUTTON(v) ((v) & 0xff)
71
#define JS_GET_AXIS(v) (((v) >> 8) & 0xff)
72
#define JS_GET_AXIS_DIR(v) JS_GET_BUTTON(v)
73
#define JS_GET_HAT(v) JS_GET_AXIS(v)
74
#define JS_GET_HAT_DIR(v) JS_GET_BUTTON(v)
75
76
#define JS_BUTTON(id, button) \
77
(JS_MAKE_IDENTIFIER(id) | \
78
JS_MAKE_BUTTON(button))
79
#define JS_AXIS(id, axis, direction) \
80
(JS_MAKE_IDENTIFIER(id) | \
81
JS_MAKE_AXIS((axis), (direction)))
82
#define JS_HAT(id, hat, direction) \
83
(JS_MAKE_IDENTIFIER(id) | \
84
JS_MAKE_HAT((hat), (direction)))
85
86
// All the CTV engine names, in string form for the RC and message bar
87
extern
const
char
*
ctv_names
[];
88
89
// Scaling algorithms names
90
extern
const
char
*
scaling_names
[];
91
92
// CPU names
93
extern
const
char
*
emu_z80_names
[];
94
extern
const
char
*
emu_m68k_names
[];
95
96
// Provide a prototype to the parse_rc function in rc.cpp
97
extern
void
parse_rc
(FILE *file,
const
char
*
name
);
98
99
extern
char
*
dump_keysym
(intptr_t k);
100
extern
char
*
dump_joypad
(intptr_t k);
101
extern
void
dump_rc
(FILE *file);
102
103
extern
intptr_t
rc_number
(
const
char
*value, intptr_t *);
104
extern
intptr_t
rc_keysym
(
const
char
*
code
, intptr_t *);
105
extern
intptr_t
rc_boolean
(
const
char
*value, intptr_t *);
106
extern
intptr_t
rc_joypad
(
const
char
*desc, intptr_t *);
107
extern
intptr_t
rc_ctv
(
const
char
*value, intptr_t *);
108
extern
intptr_t
rc_scaling
(
const
char
*value, intptr_t *);
109
extern
intptr_t
rc_emu_z80
(
const
char
*value, intptr_t *);
110
extern
intptr_t
rc_emu_m68k
(
const
char
*value, intptr_t *);
111
extern
intptr_t
rc_region
(
const
char
*value, intptr_t *);
112
extern
intptr_t
rc_string
(
const
char
*value, intptr_t *);
113
extern
intptr_t
rc_rom_path
(
const
char
*value, intptr_t *);
114
extern
intptr_t
rc_bind
(
const
char
*value, intptr_t *variable);
115
116
extern
struct
rc_str
*
rc_str_list
;
117
extern
void
rc_str_cleanup
(
void
);
118
119
struct
rc_field
{
120
const
char
*
fieldname
;
121
intptr_t (*
parser
)(
const
char
*, intptr_t *);
122
intptr_t *
variable
;
123
};
124
125
#define RC_BIND_PREFIX "bind_"
126
127
struct
rc_binding
{
128
struct
rc_binding
*
prev
;
129
struct
rc_binding
*
next
;
130
unsigned
int
type
:1;
// 0 for keysym, 1 for joypad.
131
intptr_t
code
;
// keysym or joypad code.
132
char
*
rc
;
// RC name for this binding.
133
// struct rc_field.variable points to the following member.
134
char
*
to
;
// Related action.
135
// Internal storage, don't touch.
136
// char rc[];
137
};
138
139
#define RC_FIELDS_SIZE 1024
140
141
extern
struct
rc_field
rc_fields
[
RC_FIELDS_SIZE
];
142
extern
struct
rc_binding
rc_binding_head
;
143
144
extern
struct
rc_field
*
rc_binding_add
(
const
char
*rc,
const
char
*to);
145
extern
void
rc_binding_del
(
struct
rc_field
*rcf);
146
147
struct
rc_keysym
{
148
const
char
*
name
;
149
long
keysym
;
150
};
151
152
extern
struct
rc_keysym
rc_keysyms
[];
153
154
#endif // RC_H_
Generated on Sat Feb 9 2013 21:30:13 for DGen/SDL by
1.8.1.1