src/mess/osd/windows/rc_cfg.c
| r3176 | r3177 | |
| 1 | | //============================================================ |
| 2 | | // |
| 3 | | // rc_cfg.c - rc handling in XML .cfg files |
| 4 | | // |
| 5 | | // Tasks: |
| 6 | | // 1. Create code to allow MESS to read INI info in CFG |
| 7 | | // 2. Modify existing code to not trample on CFG settings |
| 8 | | // 3. Make MESSGUI CFG aware |
| 9 | | // |
| 10 | | //============================================================ |
| 11 | | |
| 12 | | #include <windows.h> |
| 13 | | |
| 14 | | #include "rc_cfg.h" |
| 15 | | #include "windows/config.h" |
| 16 | | |
| 17 | | static struct rc_struct *win_rc; |
| 18 | | |
| 19 | | static void config_rc_load(int config_type, struct xml_data_node *parentnode) |
| 20 | | { |
| 21 | | } |
| 22 | | |
| 23 | | |
| 24 | | |
| 25 | | static void config_rc_write(struct xml_data_node *node, const struct rc_option *option) |
| 26 | | { |
| 27 | | int i; |
| 28 | | const char *s; |
| 29 | | char buf[32]; |
| 30 | | |
| 31 | | for(i = 0; option[i].type; i++) |
| 32 | | { |
| 33 | | s = NULL; |
| 34 | | switch (option[i].type) |
| 35 | | { |
| 36 | | case rc_seperator: |
| 37 | | break; |
| 38 | | |
| 39 | | case rc_link: |
| 40 | | config_rc_write(node, option[i].dest); |
| 41 | | break; |
| 42 | | |
| 43 | | case rc_string: |
| 44 | | s = *(char **)option[i].dest; |
| 45 | | break; |
| 46 | | |
| 47 | | case rc_bool: |
| 48 | | case rc_int: |
| 49 | | snprintf(buf, sizeof(buf) / sizeof(buf[0]), "%d", *(int *)option[i].dest); |
| 50 | | s = buf; |
| 51 | | break; |
| 52 | | |
| 53 | | case rc_float: |
| 54 | | snprintf(buf, sizeof(buf) / sizeof(buf[0]), "%f", *(float *)option[i].dest); |
| 55 | | s = buf; |
| 56 | | break; |
| 57 | | } |
| 58 | | if (s && *s) |
| 59 | | xml_add_child(node, option[i].name, s); |
| 60 | | } |
| 61 | | } |
| 62 | | |
| 63 | | |
| 64 | | |
| 65 | | static void config_rc_save(int config_type, struct xml_data_node *parentnode) |
| 66 | | { |
| 67 | | extern struct rc_struct *rc; |
| 68 | | |
| 69 | | switch(config_type) |
| 70 | | { |
| 71 | | case CONFIG_TYPE_GAME: |
| 72 | | case CONFIG_TYPE_DEFAULT: |
| 73 | | config_rc_write(parentnode, rc_get_options(rc)); |
| 74 | | break; |
| 75 | | } |
| 76 | | } |
| 77 | | |
| 78 | | |
| 79 | | |
| 80 | | void win_config_rc_register(void) |
| 81 | | { |
| 82 | | config_register("windows", config_rc_load, config_rc_save); |
| 83 | | } |
| 84 | | |
| 85 | | |