Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
130 | ligi | 1 | #include "config.h" |
2 | |||
3 | |||
4 | char *input_evdev_name; |
||
140 | ligi | 5 | char *input_joydev_name; |
130 | ligi | 6 | |
7 | char *bluetooth_mac; |
||
8 | |||
9 | int mk_socket_port=0; |
||
10 | int loop_delay=0; |
||
11 | |||
12 | |||
13 | |||
14 | double nick_mul=0.3f; |
||
15 | double roll_mul=0.3f; |
||
16 | double gier_mul=0.3f; |
||
17 | double gas_mul=0.3f; |
||
18 | |||
19 | |||
140 | ligi | 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 | |||
25 | |||
130 | ligi | 26 | int rel_axis_nick=1; |
27 | int rel_axis_roll=0; |
||
28 | int rel_axis_gier=5; |
||
29 | int rel_axis_gas=2; |
||
30 | |||
31 | |||
32 | cfg_bool_t exit_after_init = cfg_false; |
||
33 | |||
34 | |||
35 | int parse_config(char* fname) |
||
36 | { |
||
37 | |||
38 | |||
39 | cfg_opt_t opts[] = { |
||
40 | |||
41 | CFG_SIMPLE_STR("bluetooth_mac", &bluetooth_mac), |
||
42 | |||
43 | CFG_SIMPLE_BOOL("exit_after_init", &exit_after_init), |
||
44 | CFG_SIMPLE_STR("input_evdev", &input_evdev_name), |
||
140 | ligi | 45 | CFG_SIMPLE_STR("input_joydev", &input_joydev_name), |
130 | ligi | 46 | CFG_SIMPLE_INT("loop_delay", &loop_delay), |
47 | CFG_SIMPLE_INT("mk_socket_port", &mk_socket_port), |
||
48 | |||
49 | CFG_SIMPLE_FLOAT("nick_mul", &nick_mul), |
||
50 | CFG_SIMPLE_FLOAT("roll_mul", &roll_mul), |
||
51 | CFG_SIMPLE_FLOAT("gier_mul", &gier_mul), |
||
52 | CFG_SIMPLE_FLOAT("gas_mul", &gas_mul), |
||
140 | ligi | 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), |
||
130 | ligi | 58 | |
59 | CFG_SIMPLE_INT("rel_axis_nick", &rel_axis_nick), |
||
60 | CFG_SIMPLE_INT("rel_axis_roll", &rel_axis_roll), |
||
61 | CFG_SIMPLE_INT("rel_axis_gier", &rel_axis_gier), |
||
62 | CFG_SIMPLE_INT("rel_axis_gas", &rel_axis_gas), |
||
140 | ligi | 63 | |
64 | |||
65 | |||
130 | ligi | 66 | |
67 | CFG_END() |
||
68 | }; |
||
69 | |||
70 | cfg_t *cfg; |
||
71 | |||
72 | |||
73 | printf("Parsing config file %s\n",fname); |
||
74 | |||
75 | cfg = cfg_init(opts, 0); |
||
76 | |||
77 | cfg_parse(cfg,fname); |
||
78 | |||
79 | |||
80 | return 0; |
||
81 | } |