1 /** \file   archdep_icon_path.c
2  * \brief   Get path to icon file
3  *
4  * \author  Bas Wassink <b.wassink@ziggo.nl>
5  */
6 
7 /*
8  * This file is part of VICE, the Versatile Commodore Emulator.
9  * See README for copyright notice.
10  *
11  *  This program is free software; you can redistribute it and/or modify
12  *  it under the terms of the GNU General Public License as published by
13  *  the Free Software Foundation; either version 2 of the License, or
14  *  (at your option) any later version.
15  *
16  *  This program is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with this program; if not, write to the Free Software
23  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24  *  02111-1307  USA.
25  *
26  */
27 
28 #include "vice.h"
29 
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <string.h>
33 
34 #include "archdep_get_vice_datadir.h"
35 #include "archdep_join_paths.h"
36 #include "machine.h"
37 #include "lib.h"
38 
39 #include "archdep_icon_path.h"
40 
41 
42 /** \brief  Get path to emu-specific PNG icon of \a size pixels
43  *
44  * \param[in]   size    size in pixels (square)
45  *
46  * \return  path to PNG icon, free with lib_free()
47  */
archdep_app_icon_path_png(int size)48 char *archdep_app_icon_path_png(int size)
49 {
50     char buffer[1024];
51     char *datadir = archdep_get_vice_datadir();
52     char *path;
53     const char *icon;
54 
55     /*
56      * This sucks, but will have to do until I regenerate/repixel the icons
57      */
58     /* printf("MACHINE_NAME = %s\n", machine_name); */
59     switch (machine_class) {
60         case VICE_MACHINE_C64:      /* fall through */
61         case VICE_MACHINE_C64SC:
62             icon = "C64";
63             break;
64         case VICE_MACHINE_C64DTV:
65             icon = "DTV";
66             break;
67         case VICE_MACHINE_SCPU64:
68             icon = "SCPU";
69             break;
70         case VICE_MACHINE_C128:
71             icon = "C128";
72             break;
73         case VICE_MACHINE_PET:
74             icon = "PET";
75             break;
76         case VICE_MACHINE_VIC20:
77             icon = "VIC";
78             break;
79         case VICE_MACHINE_CBM5x0:   /* fall through */
80         case VICE_MACHINE_CBM6x0:
81             icon = "CBM2";
82             break;
83         case VICE_MACHINE_PLUS4:
84             icon = "Plus4";
85             break;
86         case VICE_MACHINE_VSID:
87             icon = "SID";
88             break;
89         default:
90             icon = "unknown-emulator-machine-class";
91     }
92 
93     snprintf(buffer, sizeof(buffer), "%s_%d.png", icon, size);
94     path = archdep_join_paths(datadir, "common", buffer, NULL);
95     lib_free(datadir);
96     return path;
97 }
98