X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=config_file%2Fconfig_file.c;h=b0b9a4804ab4826ac31b95c4aebfcfcdc734d323;hb=e4c00f2d33dfd2b3ea4c859798f05782f8d8150f;hp=f16782a89b7fffbd79291d3297bd5dc09125d8cc;hpb=93f7465e336c53528f8504227a2bf743ad5308e9;p=pistorm diff --git a/config_file/config_file.c b/config_file/config_file.c index f16782a..b0b9a48 100644 --- a/config_file/config_file.c +++ b/config_file/config_file.c @@ -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); @@ -210,6 +212,7 @@ void add_mapping(struct emulator_config *cfg, unsigned int type, unsigned int ad file_size = (int)ftell(in); if (size == 0) { cfg->map_size[index] = file_size; + cfg->map_high[index] = addr + cfg->map_size[index]; } fseek(in, 0, SEEK_SET); cfg->map_data[index] = (unsigned char *)calloc(1, cfg->map_size[index]); @@ -228,7 +231,9 @@ void add_mapping(struct emulator_config *cfg, unsigned int type, unsigned int ad break; } - printf("[MAP %d] Added %s mapping for range %.8lX-%.8lX ID: %s\n", index, map_type_names[type], cfg->map_offset[index], cfg->map_offset[index] + cfg->map_size[index] - 1, cfg->map_id[index] ? cfg->map_id[index] : "None"); + printf("[MAP %d] Added %s mapping for range %.8lX-%.8lX ID: %s\n", index, map_type_names[type], cfg->map_offset[index], cfg->map_high[index] - 1, cfg->map_id[index] ? cfg->map_id[index] : "None"); + if (cfg->map_size[index] == cfg->rom_size[index]) + m68k_add_rom_range(cfg->map_offset[index], cfg->map_high[index], cfg->map_data[index]); return; @@ -366,6 +371,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);