X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=config_file%2Fconfig_file.c;h=526efd64ad02145f1322823aaba6089c6ee18530;hb=f76580474731e9a4f3d2ec2b61bb7072053e8aa6;hp=a482041037b515aea652391f26e1acdbe6f48b76;hpb=5a120a647d9befd58710b38b65a13e06826ff6e8;p=pistorm diff --git a/config_file/config_file.c b/config_file/config_file.c index a482041..526efd6 100644 --- a/config_file/config_file.c +++ b/config_file/config_file.c @@ -544,3 +544,19 @@ int get_mapped_item_by_address(struct emulator_config *cfg, uint32_t address) { return -1; } + +uint8_t *get_mapped_data_pointer_by_address(struct emulator_config *cfg, uint32_t address) { + for (int i = 0; i < MAX_NUM_MAPPED_ITEMS; i++) { + if (cfg->map_type[i] == MAPTYPE_NONE || !cfg->map_data[i]) + continue; + if (address >= cfg->map_offset[i] && address < cfg->map_high[i]) { + if (cfg->map_type[i] == MAPTYPE_RAM || cfg->map_type[i] == MAPTYPE_RAM_NOALLOC) { + return cfg->map_data[i] + (address - cfg->map_offset[i]); + } else { + return NULL; + } + } + } + + return NULL; +}