+ // if that fails, set current transparency to reliable default value
+ if (transparency_current == NULL)
+ transparency_current =
+ getTreeInfoFromIdentifier(transparencies,
+ i_to_a(TOUCH_TRANSPARENCY_DEFAULT));
+
+ // if that also fails, set current transparency to first available value
+ if (transparency_current == NULL)
+ transparency_current = transparencies;
+ }
+
+ for (i = 0; i < 2; i++)
+ {
+ for (j = 0; j < 2; j++)
+ {
+ if (grid_sizes[i][j] == NULL)
+ {
+ for (k = 0; grid_sizes_list[k].value != -1; k++)
+ {
+ TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED);
+ char identifier[32], name[32];
+ int value = grid_sizes_list[k].value;
+ char *text = grid_sizes_list[k].text;
+
+ ti->node_top = &grid_sizes[i][j];
+ ti->sort_priority = value;
+
+ sprintf(identifier, "%d", value);
+ sprintf(name, "%s", text);
+
+ setString(&ti->identifier, identifier);
+ setString(&ti->name, name);
+ setString(&ti->name_sorting, name);
+ setString(&ti->infotext,
+ (i == 0 ?
+ (j == 0 ?
+ STR_SETUP_CHOOSE_GRID_XSIZE_0 :
+ STR_SETUP_CHOOSE_GRID_YSIZE_0) :
+ (j == 0 ?
+ STR_SETUP_CHOOSE_GRID_XSIZE_1 :
+ STR_SETUP_CHOOSE_GRID_YSIZE_1)));
+
+ pushTreeInfo(&grid_sizes[i][j], ti);
+ }
+
+ // sort grid size values to start with lowest grid size value
+ sortTreeInfo(&grid_sizes[i][j]);
+
+ // set current grid size value to configured grid size value
+ grid_size_current[i][j] =
+ getTreeInfoFromIdentifier(grid_sizes[i][j],
+ i_to_a(j == 0 ?
+ setup.touch.grid_xsize[i] :
+ setup.touch.grid_ysize[i]));
+
+ // if that fails, set current grid size to reliable default value
+ if (grid_size_current[i][j] == NULL)
+ grid_size_current[i][j] =
+ getTreeInfoFromIdentifier(grid_sizes[i][j],
+ i_to_a(j == 0 ?
+ DEFAULT_GRID_XSIZE(i) :
+ DEFAULT_GRID_YSIZE(i)));
+
+ // if that also fails, set current grid size to first available value
+ if (grid_size_current[i][j] == NULL)
+ grid_size_current[i][j] = grid_sizes[i][j];
+ }
+ }
+ }
+
+ setup.touch.control_type = touch_control_current->identifier;
+ setup.touch.move_distance = atoi(move_distance_current->identifier);
+ setup.touch.drop_distance = atoi(drop_distance_current->identifier);
+ setup.touch.transparency = atoi(transparency_current->identifier);
+
+ for (i = 0; i < 2; i++)
+ {
+ setup.touch.grid_xsize[i] = atoi(grid_size_current[i][0]->identifier);
+ setup.touch.grid_ysize[i] = atoi(grid_size_current[i][1]->identifier);
+
+ if (i == GRID_ACTIVE_NR())
+ {
+ overlay.grid_xsize = setup.touch.grid_xsize[i];
+ overlay.grid_ysize = setup.touch.grid_ysize[i];
+ }
+ }
+
+ // needed for displaying value text instead of identifier
+ touch_controls_text = touch_control_current->name;
+ move_distance_text = move_distance_current->name;
+ drop_distance_text = drop_distance_current->name;
+ transparency_text = transparency_current->name;
+
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 2; j++)
+ grid_size_text[i][j] = grid_size_current[i][j]->name;
+
+ setup_mode = SETUP_MODE_TOUCH;
+
+ DrawSetupScreen();
+}
+
+static void execSetupArtwork(void)
+{
+#if 0
+ printf("::: '%s', '%s', '%s'\n",
+ artwork.gfx_current->subdir,
+ artwork.gfx_current->fullpath,
+ artwork.gfx_current->basepath);
+#endif
+
+ setup.graphics_set = artwork.gfx_current->identifier;
+ setup.sounds_set = artwork.snd_current->identifier;
+ setup.music_set = artwork.mus_current->identifier;
+
+ // needed if last screen (setup choice) changed graphics, sounds or music
+ ReloadCustomArtwork(0);
+
+ // needed for displaying artwork name instead of artwork identifier
+ graphics_set_name = artwork.gfx_current->name;