+void deleteNodeFromList(ListNode **node_first, char *key,
+ void (*destructor_function)(void *))
+{
+ if (node_first == NULL || *node_first == NULL)
+ return;
+
+ printf("[CHECKING LIST KEY '%s' == '%s']\n",
+ (*node_first)->key, key);
+
+ if (strcmp((*node_first)->key, key) == 0)
+ {
+ printf("[DELETING LIST ENTRY]\n");
+
+ free((*node_first)->key);
+ if (destructor_function)
+ destructor_function((*node_first)->content);
+ *node_first = (*node_first)->next;
+ }
+ else
+ deleteNodeFromList(&(*node_first)->next, key, destructor_function);
+}
+
+ListNode *getNodeFromKey(ListNode *node_first, char *key)
+{
+ if (node_first == NULL)
+ return NULL;
+
+ if (strcmp(node_first->key, key) == 0)
+ return node_first;
+ else
+ return getNodeFromKey(node_first->next, key);
+}
+
+int getNumNodes(ListNode *node_first)
+{
+ return (node_first ? 1 + getNumNodes(node_first->next) : 0);
+}
+
+void dumpList(ListNode *node_first)
+{
+ ListNode *node = node_first;
+
+ while (node)
+ {
+ printf("['%s']\n", node->key);
+ node = node->next;
+ }
+
+ printf("[%d nodes]\n", getNumNodes(node_first));
+}
+
+static void LoadSoundsInfo()
+{
+ char *filename = getCustomSoundConfigFilename();
+ struct SetupFileList *setup_file_list;
+ int i;
+
+ /* always start with reliable default values */
+ for (i=0; i<num_sounds; i++)
+ sound_effect[i].filename = NULL;
+
+ if (filename == NULL)
+ return;
+
+ if ((setup_file_list = loadSetupFileList(filename)))
+ {
+ for (i=0; i<num_sounds; i++)
+ sound_effect[i].filename =
+ getStringCopy(getTokenValue(setup_file_list, sound_effect[i].text));
+
+ freeSetupFileList(setup_file_list);
+
+#if 1
+ for (i=0; i<num_sounds; i++)
+ printf("'%s' -> '%s'\n", sound_effect[i].text, sound_effect[i].filename);
+#endif
+ }
+}
+
+static void ReloadCustomSounds()
+{
+ int i;
+
+#if 1
+ printf("DEBUG: reloading sounds '%s' ...\n", artwork.sounds_set_current);
+#endif
+
+ LoadSoundsInfo();
+
+ for(i=0; i<num_sounds; i++)
+ {
+ if (sound_effect[i].filename)
+ LoadSoundToList(sound_effect[i].filename, i);
+ else
+ LoadSoundToList(sound_effect[i].default_filename, i);
+ }
+
+ /*
+ printf("list size == %d\n", getNumNodes(SoundFileList));
+ */
+ dumpList(SoundFileList);
+}
+
+static void ReloadCustomMusic()