]> git.sesse.net Git - pistorm/blobdiff - config_file/config_file.c
More RTG acceleration, fix everything
[pistorm] / config_file / config_file.c
index 4ac96707a0ff989d0a70cae730264e01c0d2ef74..772c6ba39699d5800035b8c1b885f773f09887f7 100644 (file)
@@ -427,3 +427,14 @@ int get_named_mapped_item(struct emulator_config *cfg, char *name) {
 
   return -1;
 }
+
+int get_mapped_item_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])
+      return i;
+  }
+
+  return -1;
+}