extend mmap wrapper functionality
[libpicofe.git] / common / config.c
index ddf7f80..9950b13 100644 (file)
@@ -19,6 +19,7 @@ static char *mystrip(char *str);
 #ifndef _MSC_VER
 
 #include "menu.h"
+#include "menu_pico.h"
 #include "emu.h"
 #include <pico/pico.h>
 
@@ -84,7 +85,7 @@ static void keys_write(FILE *fn, const char *bind_str, int dev_id, const int *bi
                        continue;
                }
 
-               for (i = 0; i < sizeof(me_ctrl_actions) / sizeof(me_ctrl_actions[0]); i++) {
+               for (i = 0; me_ctrl_actions[i].name != NULL; i++) {
                        mask = me_ctrl_actions[i].mask;
                        if (mask & binds[IN_BIND_OFFS(k, IN_BINDTYPE_PLAYER12)]) {
                                strncpy(act, me_ctrl_actions[i].name, 31);
@@ -576,7 +577,7 @@ static int parse_bind_val(const char *val, int *type)
                        shift = 16;
 
                *type = IN_BINDTYPE_PLAYER12;
-               for (i = 0; i < sizeof(me_ctrl_actions) / sizeof(me_ctrl_actions[0]); i++) {
+               for (i = 0; me_ctrl_actions[i].name != NULL; i++) {
                        if (strncasecmp(me_ctrl_actions[i].name, val + 8, strlen(val + 8)) == 0)
                                return me_ctrl_actions[i].mask << shift;
                }
@@ -756,7 +757,6 @@ int config_readsect(const char *fname, const char *section)
        keys_encountered = 0;
        memset(input_dev_map, 0xff, sizeof(input_dev_map));
 
-       in_config_start();
        while (!feof(f))
        {
                ret = config_get_var_val(f, line, sizeof(line), &var, &val);
@@ -765,7 +765,6 @@ int config_readsect(const char *fname, const char *section)
 
                parse(var, val);
        }
-       in_config_end();
 
        fclose(f);
        return 0;