1 // SPDX-License-Identifier: MIT
8 static char*platform_names[PLATFORM_NUM] = {
15 int get_platform_index(char *name) {
16 if (!name || strlen(name) == 0)
19 for (int i = 0; i < PLATFORM_NUM; i++) {
20 if (strcmp(name, platform_names[i]) == 0)
26 void create_platform_amiga(struct platform_config *cfg, char *subsys);
27 void create_platform_mac68k(struct platform_config *cfg, char *subsys);
28 void create_platform_dummy(struct platform_config *cfg, char *subsys);
30 struct platform_config *make_platform_config(char *name, char *subsys) {
31 struct platform_config *cfg = NULL;
32 int platform_id = get_platform_index(name);
34 if (platform_id == -1) {
35 // Display a warning if no match is found for the config name, in case it was mistyped.
36 printf("No match found for platform name \'%s\', defaulting to none/generic.\n", name);
37 platform_id = PLATFORM_NONE;
40 printf("Creating platform config for %s...\n", name);
43 cfg = (struct platform_config *)malloc(sizeof(struct platform_config));
45 printf("Failed to allocate memory for new platform config!.\n");
48 memset(cfg, 0x00, sizeof(struct platform_config));
52 create_platform_amiga(cfg, subsys);
55 create_platform_mac68k(cfg, subsys);
60 create_platform_dummy(cfg, subsys);