1 #include "config.h"
2 #include "metadata/metadata.h"
3 #include "name.h"
4 
find_cart_metadata(uint32_t crc32,game_metadata_t * meta)5 int find_cart_metadata(uint32_t crc32, game_metadata_t *meta)
6 {
7     int i, found = 0;
8 
9     for (i = 0; name_list[i].name; i++)
10     {
11         if (name_list[i].crc32 == crc32)
12         {
13             found = 1;
14             break;
15         }
16     }
17 
18     if (found && meta)
19     {
20         if (!meta->name)
21             meta->name = strdup(name_list[i].name);
22 
23         if (!meta->short_name)
24             meta->short_name = strdup(name_list[i].name);
25 
26         if (meta->is_defaults || meta->ecs_compat == CMP_UNSPECIFIED)
27             meta->ecs_compat = name_list[i].ecs ? CMP_REQUIRES
28                                                 : CMP_UNSPECIFIED;
29 
30         if (meta->is_defaults || meta->voice_compat == CMP_UNSPECIFIED)
31             meta->voice_compat = name_list[i].ivc ? CMP_REQUIRES
32                                                   : CMP_UNSPECIFIED;
33 
34         /* Only bother adding a release date if metadata has none. */
35         if (!meta->release_dates)
36         {
37             game_date_t *dates  = CALLOC(game_date_t, 2);
38             dates[0].year       = name_list[i].year;
39             meta->release_dates = dates;
40         }
41     }
42 
43     return found;
44 }
45 
46