diff blastem.c @ 1326:071e761bcdcf

Fix a deficiency in the way types were handled in my ternary tree. Fixes in which some paths that were constructed from a template with variables would sometimes get an extra garbage character thrown in
author Michael Pavone <pavone@retrodev.com>
date Fri, 21 Apr 2017 23:35:32 -0700
parents 96ad1b9bbb3a
children 990a26391933
line wrap: on
line diff
--- a/blastem.c	Fri Apr 21 01:22:52 2017 -0700
+++ b/blastem.c	Fri Apr 21 23:35:32 2017 -0700
@@ -140,7 +140,7 @@
 void setup_saves(char *fname, rom_info *info, system_header *context)
 {
 	static uint8_t persist_save_registered;
-	char *savedir_template = tern_find_path(config, "ui\0save_path\0").ptrval;
+	char *savedir_template = tern_find_path(config, "ui\0save_path\0", TVAL_PTR).ptrval;
 	if (!savedir_template) {
 		savedir_template = "$USERDATA/blastem/$ROMNAME";
 	}
@@ -322,7 +322,7 @@
 	uint8_t menu = !loaded;
 	if (!loaded) {
 		//load menu
-		romfname = tern_find_path(config, "ui\0rom\0").ptrval;
+		romfname = tern_find_path(config, "ui\0rom\0", TVAL_PTR).ptrval;
 		if (!romfname) {
 			romfname = "menu.bin";
 		}
@@ -349,7 +349,7 @@
 	}
 	
 	int def_width = 0;
-	char *config_width = tern_find_path(config, "video\0width\0").ptrval;
+	char *config_width = tern_find_path(config, "video\0width\0", TVAL_PTR).ptrval;
 	if (config_width) {
 		def_width = atoi(config_width);
 	}
@@ -359,7 +359,7 @@
 	width = width < 320 ? def_width : width;
 	height = height < 240 ? (width/320) * 240 : height;
 
-	char *config_fullscreen = tern_find_path(config, "video\0fullscreen\0").ptrval;
+	char *config_fullscreen = tern_find_path(config, "video\0fullscreen\0", TVAL_PTR).ptrval;
 	if (config_fullscreen && !strcmp("on", config_fullscreen)) {
 		fullscreen = !fullscreen;
 	}