From 8af1d14863bb6ffad2c50b5275a848240c68c62e Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Tue, 7 Jul 2015 19:33:33 -0700 Subject: Add support for reading cartridge memory map from ROM database, though without EEPROM support for now --- tern.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tern.c') 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); } } -- cgit v1.2.3