X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=config_file%2Fconfig_file.c;h=f848ba51cd00bfa762ef7abaa59078aa7520cff6;hb=ce1c064e71706992b3de778af96aa9321575b114;hp=12ba4b4e99955384a09dc5f833f954bc1ec14c63;hpb=b550b0d6325d5d863d75b25f6b6e09251806606a;p=pistorm diff --git a/config_file/config_file.c b/config_file/config_file.c index 12ba4b4..f848ba5 100644 --- a/config_file/config_file.c +++ b/config_file/config_file.c @@ -27,7 +27,8 @@ const char *map_type_names[MAPTYPE_NUM] = { "rom", "ram", "register", - "ram (no alloc)", + "ram_noalloc", + "wtcram", }; const char *config_item_names[CONFITEM_NUM] = { @@ -213,6 +214,9 @@ void add_mapping(struct emulator_config *cfg, unsigned int type, unsigned int ad cfg->map_high[index] = addr + size; cfg->map_mirror[index] = mirr_addr; if (strlen(map_id)) { + if (cfg->map_id[index]) { + free(cfg->map_id[index]); + } cfg->map_id[index] = (char *)malloc(strlen(map_id) + 1); strcpy(cfg->map_id[index], map_id); } @@ -222,14 +226,23 @@ void add_mapping(struct emulator_config *cfg, unsigned int type, unsigned int ad printf("[CFG] Adding %d byte (%d MB) RAM mapping %s...\n", size, size / 1024 / 1024, map_id); cfg->map_data[index] = (unsigned char *)filename; break; + case MAPTYPE_RAM_WTC: + printf("[CFG] Allocating %d bytes for Write-Through Cached RAM mapping (%.1f MB)...\n", size, (float)size / 1024.0f / 1024.0f); + goto alloc_mapram; + break; case MAPTYPE_RAM: printf("[CFG] Allocating %d bytes for RAM mapping (%d MB)...\n", size, size / 1024 / 1024); +alloc_mapram: cfg->map_data[index] = (unsigned char *)malloc(size); if (!cfg->map_data[index]) { printf("[CFG] ERROR: Unable to allocate memory for mapped RAM!\n"); goto mapping_failed; } memset(cfg->map_data[index], 0x00, size); + if (type == MAPTYPE_RAM_WTC) { + // This may look a bit weird, but it adds a read range for the WTC RAM. Writes still go through to the mapped read/write functions. + m68k_add_rom_range(cfg->map_offset[index], cfg->map_high[index], cfg->map_data[index]); + } break; case MAPTYPE_ROM: in = fopen(filename, "rb");