Commits

hominem_te_esse committed 3801159

fix for corrupted graphics when manipulating config files

  • Participants
  • Parent commits 6829f6a

Comments (0)

Files changed (4)

 	struct config_value_t *tail;
 	char *filename;
 	int modified;
+	u32 uid;
 } config_set_t;
 
 void configInit(char *prefix);
 typedef struct {
 	// Attributes for: AttributeImage
 	int currentUid;
-	int currentItemId;
+	u32 currentConfigId;
 	char* currentValue;
 
 	// Attributes  for: AttributeImage & GameImage
 	char* alias;
 	int displayMode;
 
-	int currentItemId;
+	u32 currentConfigId;
 	char* currentValue;
 } mutable_text_t;
 
 #define CONFIG_INDEX_LAST		1
 #define CONFIG_INDEX_APPS		2
 
+static u32 currentUID = 0;
 static config_set_t configFiles[CONFIG_FILE_NUM];
 static char configPath[255] = "mc?:SYS-CONF/IPCONFIG.DAT";
 
 	if (!configSet)
 		configSet = (config_set_t*) malloc(sizeof(config_set_t));
 
+	configSet->uid = ++currentUID;
 	configSet->type = type;
 	configSet->head = NULL;
 	configSet->tail = NULL;
 		char* value, char* alias, int displayMode, int sizingMode) {
 
 	mutable_text_t* mutableText = (mutable_text_t*) malloc(sizeof(mutable_text_t));
-	mutableText->currentItemId = -1;
+	mutableText->currentConfigId = 0;
 	mutableText->currentValue = NULL;
 	mutableText->alias = NULL;
 
 static void drawAttributeText(struct menu_list* menu, struct submenu_list* item, config_set_t* config, struct theme_element* elem) {
 	mutable_text_t* mutableText = (mutable_text_t*) elem->extended;
 	if (config) {
-		if (mutableText->currentItemId != item->item.id) {
+		if (mutableText->currentConfigId != config->uid) {
 			// force refresh
-			mutableText->currentItemId = item->item.id;
+			mutableText->currentConfigId = config->uid;
 			mutableText->currentValue = NULL;
 			if (configGetStr(config, mutableText->value, &mutableText->currentValue)) {
 				if (mutableText->sizingMode == SIZING_WRAP)
 
 	mutable_image_t* mutableImage = (mutable_image_t*) malloc(sizeof(mutable_image_t));
 	mutableImage->currentUid = -1;
-	mutableImage->currentItemId = -1;
+	mutableImage->currentConfigId = 0;
 	mutableImage->currentValue = NULL;
 	mutableImage->cache = NULL;
 	mutableImage->cacheLinked = 0;
 static void drawAttributeImage(struct menu_list* menu, struct submenu_list* item, config_set_t* config, struct theme_element* elem) {
 	mutable_image_t* attributeImage = (mutable_image_t*) elem->extended;
 	if (config) {
-		if (attributeImage->currentItemId != item->item.id) {
+		if (attributeImage->currentConfigId != config->uid) {
 			// force refresh
 			attributeImage->currentUid = -1;
-			attributeImage->currentItemId = item->item.id;
+			attributeImage->currentConfigId = config->uid;
 			attributeImage->currentValue = NULL;
 			configGetStr(config, attributeImage->cache->suffix, &attributeImage->currentValue);
 		}