summaryrefslogtreecommitdiff
path: root/tern.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2015-07-07 19:33:33 -0700
committerMichael Pavone <pavone@retrodev.com>2015-07-07 19:33:33 -0700
commit8af1d14863bb6ffad2c50b5275a848240c68c62e (patch)
tree0dc5406aafc64451f594ace900d3847e6559d9e1 /tern.c
parent358991e7fef42ae206231aabfeee045e5214dbe4 (diff)
Add support for reading cartridge memory map from ROM database, though without EEPROM support for now
Diffstat (limited to 'tern.c')
-rw-r--r--tern.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tern.c b/tern.c
index 2929bd6..e4f80f8 100644
--- a/tern.c
+++ b/tern.c
@@ -107,7 +107,11 @@ void * tern_find_ptr_default(tern_node * head, char * key, void * def)
{
tern_val ret;
if (tern_find(head, key, &ret)) {
- return ret.ptrval;
+ if (ret.intval & 1) {
+ return (void *)(ret.intval & ~1);
+ } else {
+ return ret.ptrval;
+ }
}
return def;
}
@@ -193,7 +197,7 @@ void tern_foreach_int(tern_node *head, iter_fun fun, void *data, char *keybuf, i
tern_foreach_int(head->straight.next, fun, data, keybuf, pos+1);
}
if (head->right) {
- tern_foreach_int(head->left, fun, data, keybuf, pos);
+ tern_foreach_int(head->right, fun, data, keybuf, pos);
}
}