6 static char*platform_names[PLATFORM_NUM] = {
13 int get_platform_index(char *name) {
14 if (!name || strlen(name) == 0)
17 for (int i = 0; i < PLATFORM_NUM; i++) {
18 if (strcmp(name, platform_names[i]) == 0)
24 void create_platform_amiga(struct platform_config *cfg, char *subsys);
25 void create_platform_dummy(struct platform_config *cfg, char *subsys);
27 struct platform_config *make_platform_config(char *name, char *subsys) {
28 struct platform_config *cfg = NULL;
29 int platform_id = get_platform_index(name);
31 if (platform_id == -1) {
32 // Display a warning if no match is found for the config name, in case it was mistyped.
33 printf("No match found for platform name \'%s\', defaulting to none/generic.\n", name);
34 platform_id = PLATFORM_NONE;
37 printf("Creating platform config for %s...\n", name);
40 cfg = (struct platform_config *)malloc(sizeof(struct platform_config));
42 printf("Failed to allocate memory for new platform config!.\n");
45 memset(cfg, 0x00, sizeof(struct platform_config));
49 create_platform_amiga(cfg, subsys);
55 create_platform_dummy(cfg, subsys);