Rev 130 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 130 | Rev 140 | ||
---|---|---|---|
1 | #include "config.h" |
1 | #include "config.h" |
2 | 2 | ||
3 | 3 | ||
4 | char *input_evdev_name; |
4 | char *input_evdev_name; |
- | 5 | char *input_joydev_name; |
|
5 | 6 | ||
6 | char *bluetooth_mac; |
7 | char *bluetooth_mac; |
7 | 8 | ||
8 | int mk_socket_port=0; |
9 | int mk_socket_port=0; |
9 | int loop_delay=0; |
10 | int loop_delay=0; |
10 | 11 | ||
11 | 12 | ||
12 | 13 | ||
13 | double nick_mul=0.3f; |
14 | double nick_mul=0.3f; |
14 | double roll_mul=0.3f; |
15 | double roll_mul=0.3f; |
15 | double gier_mul=0.3f; |
16 | double gier_mul=0.3f; |
16 | double gas_mul=0.3f; |
17 | double gas_mul=0.3f; |
17 | 18 | ||
- | 19 | ||
- | 20 | double nick_add=0.3f; |
|
- | 21 | double roll_add=0.3f; |
|
- | 22 | double gier_add=0.3f; |
|
- | 23 | double gas_add=0.3f; |
|
- | 24 | ||
18 | 25 | ||
19 | int rel_axis_nick=1; |
26 | int rel_axis_nick=1; |
20 | int rel_axis_roll=0; |
27 | int rel_axis_roll=0; |
21 | int rel_axis_gier=5; |
28 | int rel_axis_gier=5; |
22 | int rel_axis_gas=2; |
29 | int rel_axis_gas=2; |
23 | 30 | ||
24 | 31 | ||
25 | cfg_bool_t exit_after_init = cfg_false; |
32 | cfg_bool_t exit_after_init = cfg_false; |
26 | 33 | ||
27 | 34 | ||
28 | int parse_config(char* fname) |
35 | int parse_config(char* fname) |
29 | { |
36 | { |
30 | 37 | ||
31 | 38 | ||
32 | cfg_opt_t opts[] = { |
39 | cfg_opt_t opts[] = { |
33 | 40 | ||
34 | CFG_SIMPLE_STR("bluetooth_mac", &bluetooth_mac), |
41 | CFG_SIMPLE_STR("bluetooth_mac", &bluetooth_mac), |
35 | 42 | ||
36 | CFG_SIMPLE_BOOL("exit_after_init", &exit_after_init), |
43 | CFG_SIMPLE_BOOL("exit_after_init", &exit_after_init), |
37 | CFG_SIMPLE_STR("input_evdev", &input_evdev_name), |
44 | CFG_SIMPLE_STR("input_evdev", &input_evdev_name), |
- | 45 | CFG_SIMPLE_STR("input_joydev", &input_joydev_name), |
|
38 | CFG_SIMPLE_INT("loop_delay", &loop_delay), |
46 | CFG_SIMPLE_INT("loop_delay", &loop_delay), |
39 | CFG_SIMPLE_INT("mk_socket_port", &mk_socket_port), |
47 | CFG_SIMPLE_INT("mk_socket_port", &mk_socket_port), |
40 | 48 | ||
41 | CFG_SIMPLE_FLOAT("nick_mul", &nick_mul), |
49 | CFG_SIMPLE_FLOAT("nick_mul", &nick_mul), |
42 | CFG_SIMPLE_FLOAT("roll_mul", &roll_mul), |
50 | CFG_SIMPLE_FLOAT("roll_mul", &roll_mul), |
43 | CFG_SIMPLE_FLOAT("gier_mul", &gier_mul), |
51 | CFG_SIMPLE_FLOAT("gier_mul", &gier_mul), |
44 | CFG_SIMPLE_FLOAT("gas_mul", &gas_mul), |
52 | CFG_SIMPLE_FLOAT("gas_mul", &gas_mul), |
- | 53 | ||
- | 54 | CFG_SIMPLE_FLOAT("nick_add", &nick_add), |
|
- | 55 | CFG_SIMPLE_FLOAT("roll_add", &roll_add), |
|
- | 56 | CFG_SIMPLE_FLOAT("gier_add", &gier_add), |
|
- | 57 | CFG_SIMPLE_FLOAT("gas_add", &gas_add), |
|
45 | 58 | ||
46 | CFG_SIMPLE_INT("rel_axis_nick", &rel_axis_nick), |
59 | CFG_SIMPLE_INT("rel_axis_nick", &rel_axis_nick), |
47 | CFG_SIMPLE_INT("rel_axis_roll", &rel_axis_roll), |
60 | CFG_SIMPLE_INT("rel_axis_roll", &rel_axis_roll), |
48 | CFG_SIMPLE_INT("rel_axis_gier", &rel_axis_gier), |
61 | CFG_SIMPLE_INT("rel_axis_gier", &rel_axis_gier), |
49 | CFG_SIMPLE_INT("rel_axis_gas", &rel_axis_gas), |
62 | CFG_SIMPLE_INT("rel_axis_gas", &rel_axis_gas), |
- | 63 | ||
- | 64 | ||
- | 65 | ||
50 | 66 | ||
51 | CFG_END() |
67 | CFG_END() |
52 | }; |
68 | }; |
53 | 69 | ||
54 | cfg_t *cfg; |
70 | cfg_t *cfg; |
55 | 71 | ||
56 | 72 | ||
57 | printf("Parsing config file %s\n",fname); |
73 | printf("Parsing config file %s\n",fname); |
58 | 74 | ||
59 | cfg = cfg_init(opts, 0); |
75 | cfg = cfg_init(opts, 0); |
60 | 76 | ||
61 | cfg_parse(cfg,fname); |
77 | cfg_parse(cfg,fname); |
62 | 78 | ||
63 | 79 | ||
64 | return 0; |
80 | return 0; |
65 | } |
81 | } |
66 | 82 |