-
Notifications
You must be signed in to change notification settings - Fork 6
/
core.c
98 lines (86 loc) · 2.65 KB
/
core.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
core.c - Support for legacy cores
*/
#include "core.h"
#include "core_atarist.h"
#include "core_c64.h"
#include "core_vic20.h"
#include "core_amiga.h"
#include "core_atari2600.h"
#include "sysctrl.h" // for core_id
#include "debug.h"
void core_set_default_images(void) {
debugf("Setting core specific defaults");
const char **images = NULL;
if(core_id == CORE_ID_ATARI_ST)
images = core_atarist_default_images;
else if(core_id == CORE_ID_C64)
images = core_c64_default_images;
else if(core_id == CORE_ID_VIC20)
images = core_vic20_default_images;
else if(core_id == CORE_ID_AMIGA)
images = core_amiga_default_images;
else if(core_id == CORE_ID_ATARI_2600)
images = core_atari2600_default_images;
else
debugf("%s: unsupported core %d", __func__, core_id);
if(images)
for(int drive=0;images[drive];drive++)
sdc_set_default(drive, images[drive]);
}
uint8_t core_map_key(uint8_t code) {
if(core_id == CORE_ID_ATARI_ST)
return core_atarist_keymap[code];
if(core_id == CORE_ID_C64)
return core_c64_keymap[code];
if(core_id == CORE_ID_VIC20)
return core_vic20_keymap[code];
if(core_id == CORE_ID_AMIGA)
return core_amiga_keymap[code];
if(core_id == CORE_ID_ATARI_2600)
return core_atari2600_keymap[code];
debugf("%s: unsupported core %d", __func__, core_id);
return 0;
}
uint8_t core_map_modifier_key(uint8_t code) {
if(core_id == CORE_ID_ATARI_ST)
return core_atarist_modifier[code];
if(core_id == CORE_ID_C64)
return core_c64_modifier[code];
if(core_id == CORE_ID_VIC20)
return core_vic20_modifier[code];
if(core_id == CORE_ID_AMIGA)
return core_amiga_modifier[code];
if(core_id == CORE_ID_ATARI_2600)
return core_atari2600_modifier[code];
debugf("%s: unsupported core %d", __func__, core_id);
return 0;
}
const char **core_get_forms(void) {
if(core_id == CORE_ID_ATARI_ST)
return core_atarist_forms;
if(core_id == CORE_ID_C64)
return core_c64_forms;
if(core_id == CORE_ID_VIC20)
return core_vic20_forms;
if(core_id == CORE_ID_AMIGA)
return core_amiga_forms;
if(core_id == CORE_ID_ATARI_2600)
return core_atari2600_forms;
debugf("%s: unsupported core %d", __func__, core_id);
return NULL;
}
menu_legacy_variable_t *core_get_variables(void) {
if(core_id == CORE_ID_ATARI_ST)
return core_atarist_variables;
if(core_id == CORE_ID_C64)
return core_c64_variables;
if(core_id == CORE_ID_VIC20)
return core_vic20_variables;
if(core_id == CORE_ID_AMIGA)
return core_amiga_variables;
if(core_id == CORE_ID_ATARI_2600)
return core_atari2600_variables;
debugf("%s: unsupported core %d", __func__, core_id);
return NULL;
}