]> git.sesse.net Git - pistorm/blobdiff - config_file/config_file.c
More tiny optimizations, some Z2/Z3 fixes
[pistorm] / config_file / config_file.c
index f16782a89b7fffbd79291d3297bd5dc09125d8cc..76d0bb6011e565a53636d56e5e02ac242964f316 100644 (file)
@@ -33,6 +33,7 @@ const char *config_item_names[CONFITEM_NUM] = {
   "mouse",
   "keyboard",
   "platform",
+  "setvar",
 };
 
 const char *mapcmd_names[MAPCMD_NUM] = {
@@ -184,6 +185,7 @@ void add_mapping(struct emulator_config *cfg, unsigned int type, unsigned int ad
   cfg->map_type[index] = type;
   cfg->map_offset[index] = addr;
   cfg->map_size[index] = size;
+  cfg->map_high[index] = addr + size;
   cfg->map_mirror[index] = mirr_addr;
   if (strlen(map_id)) {
     cfg->map_id[index] = (char *)malloc(strlen(map_id) + 1);
@@ -366,6 +368,21 @@ struct emulator_config *load_config_file(char *filename) {
         cfg->platform = make_platform_config(platform_name, platform_sub);
         break;
       }
+      case CONFITEM_SETVAR: {
+        if (!cfg->platform) {
+          printf("Warning: esetvar used in config file with no platform specified.\n");
+          break;
+        }
+
+        char var_name[128], var_value[128];
+        memset(var_name, 0x00, 128);
+        memset(var_value, 0x00, 128);
+        get_next_string(parse_line, var_name, &str_pos, ' ');
+        get_next_string(parse_line, var_value, &str_pos, ' ');
+        cfg->platform->setvar(var_name, var_value);
+
+        break;
+      }
       case CONFITEM_NONE:
       default:
         printf("Unknown config item %s on line %d.\n", cur_cmd, cur_line);