1 /* 2 * KCemu -- The emulator for the KC85 homecomputer series and much more. 3 * Copyright (C) 1997-2010 Torsten Paul 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 */ 19 20 #ifndef __kc_prefs_types_h 21 #define __kc_prefs_types_h 22 23 #include <stdarg.h> 24 #include <list> 25 #include <string> 26 27 #include "kc/system.h" 28 29 #include "kc/prefs/profile.h" 30 31 using namespace std; 32 33 typedef enum { 34 KC_TYPE_NONE = 0, 35 KC_TYPE_85_1 = (1 << 0), 36 KC_TYPE_85_2 = (1 << 1), 37 KC_TYPE_85_3 = (1 << 2), 38 KC_TYPE_85_4 = (1 << 3), 39 KC_TYPE_85_5 = (1 << 4), 40 KC_TYPE_87 = (1 << 5), 41 KC_TYPE_LC80 = (1 << 6), 42 KC_TYPE_Z1013 = (1 << 7), 43 KC_TYPE_A5105 = (1 << 8), 44 KC_TYPE_POLY880 = (1 << 9), 45 KC_TYPE_KRAMERMC = (1 << 10), 46 KC_TYPE_MUGLERPC = (1 << 11), 47 KC_TYPE_VCS80 = (1 << 12), 48 KC_TYPE_C80 = (1 << 13), 49 KC_TYPE_85_1_CLASS = KC_TYPE_85_1 | KC_TYPE_87, 50 KC_TYPE_85_2_CLASS = KC_TYPE_85_2 | KC_TYPE_85_3 | KC_TYPE_85_4 | KC_TYPE_85_5, 51 KC_TYPE_ALL = (KC_TYPE_85_1_CLASS | 52 KC_TYPE_85_2_CLASS | 53 KC_TYPE_LC80 | 54 KC_TYPE_Z1013 | 55 KC_TYPE_A5105 | 56 KC_TYPE_POLY880 | 57 KC_TYPE_KRAMERMC | 58 KC_TYPE_MUGLERPC | 59 KC_TYPE_VCS80 | 60 KC_TYPE_C80) 61 } kc_type_t; 62 63 typedef enum { 64 KC_VARIANT_NONE = 0, 65 KC_VARIANT_85_1_10 = 0, 66 KC_VARIANT_85_1_11 = 1, 67 KC_VARIANT_87_10 = 0, 68 KC_VARIANT_87_11 = 1, 69 KC_VARIANT_87_20 = 2, 70 KC_VARIANT_87_21 = 3, 71 KC_VARIANT_87_30 = 4, 72 KC_VARIANT_87_31 = 5, 73 KC_VARIANT_Z1013_01 = 0, 74 KC_VARIANT_Z1013_12 = 1, 75 KC_VARIANT_Z1013_16 = 3, 76 KC_VARIANT_Z1013_64 = 4, 77 KC_VARIANT_Z1013_A2 = 5, 78 KC_VARIANT_Z1013_RB = 6, 79 KC_VARIANT_Z1013_SURL = 7, 80 KC_VARIANT_Z1013_BL4 = 8, 81 KC_VARIANT_LC80_1k = 0, 82 KC_VARIANT_LC80_2k = 1, 83 KC_VARIANT_LC80e = 2, 84 KC_VARIANT_A5105_K1505 = 0, 85 KC_VARIANT_A5105_A5105 = 1, 86 KC_VARIANT_POLY880 = 0, 87 KC_VARIANT_POLY880_SC1 = 1, 88 } kc_variant_t; 89 90 class EmulationType; 91 typedef list<EmulationType *> emulation_type_list_t; 92 93 class EmulationType { 94 private: 95 96 string _name; 97 string _short_name; 98 string _config_name; 99 string _icon_name; 100 string _image_name; 101 string _keyboard_filename; 102 string _help_topic; 103 string _help_topic_module; 104 105 int _module_slots; 106 107 word_t _power_on_addr; 108 word_t _reset_addr; 109 110 /** emulation type as given on the commandline, or -1 if no commandline parameter exists */ 111 int _type; 112 113 kc_type_t _kc_type; 114 115 static emulation_type_list_t _emulation_type_list; 116 117 public: 118 static EmulationType _emulation_type_kc85_1; 119 static EmulationType _emulation_type_kc85_2; 120 static EmulationType _emulation_type_kc85_3; 121 static EmulationType _emulation_type_kc85_4; 122 static EmulationType _emulation_type_kc85_5; 123 static EmulationType _emulation_type_kc87; 124 static EmulationType _emulation_type_lc80; 125 static EmulationType _emulation_type_z1013; 126 static EmulationType _emulation_type_a5105; 127 static EmulationType _emulation_type_poly880; 128 static EmulationType _emulation_type_kramermc; 129 static EmulationType _emulation_type_muglerpc; 130 static EmulationType _emulation_type_vcs80; 131 static EmulationType _emulation_type_c80; 132 133 EmulationType(kc_type_t kc_type, int type, string name, string short_name, string config_name, string icon_name, string image_name, string keyboard_filename, string help_topic, string help_topic_module, int module_slots, word_t power_on_addr, word_t reset_addr); 134 virtual ~EmulationType(void); 135 136 virtual const char * get_name(void) const; 137 virtual const char * get_short_name(void) const; 138 virtual const char * get_config_name(void) const; 139 virtual const char * get_icon_name(void) const; 140 virtual const char * get_image_name(void) const; 141 virtual const char * get_keyboard_filename(void) const; 142 virtual const char * get_help_topic(void) const; 143 virtual const char * get_help_topic_module(void) const; 144 virtual const int get_module_slots(void) const; 145 virtual const word_t get_power_on_addr(void) const; 146 virtual const word_t get_reset_addr(void) const; 147 virtual int get_type(void) const; 148 virtual kc_type_t get_kc_type(void) const; 149 150 static emulation_type_list_t & get_emulation_types(void); 151 }; 152 153 class ROMEntry { 154 private: 155 string _filename; 156 string _description; 157 bool _is_default; 158 public: 159 ROMEntry(const char *filename, const char *description, bool is_default = false); 160 virtual ~ROMEntry(void); 161 162 const string get_filename(void) const; 163 const string get_description(void) const; 164 const bool is_default(void) const; 165 }; 166 167 typedef list<ROMEntry *> rom_entry_list_t; 168 169 class SystemROM { 170 private: 171 int _size; 172 string _name; 173 bool _mandatory; 174 rom_entry_list_t _roms; 175 176 public: 177 static const char * ROM_KEY_CAOSC; 178 static const char * ROM_KEY_CAOSE; 179 static const char * ROM_KEY_SYSTEM; 180 static const char * ROM_KEY_SYSTEM1; 181 static const char * ROM_KEY_SYSTEM2; 182 static const char * ROM_KEY_SYSTEM3; 183 static const char * ROM_KEY_SYSTEM4; 184 static const char * ROM_KEY_USER; 185 static const char * ROM_KEY_BASIC; 186 static const char * ROM_KEY_DEBUGGER; 187 static const char * ROM_KEY_REASSEMBLER; 188 static const char * ROM_KEY_EDITOR; 189 static const char * ROM_KEY_ASSEMBLER; 190 static const char * ROM_KEY_CHARGEN; 191 static const char * ROM_KEY_D004_FC; 192 static const char * ROM_KEY_D004_F8; 193 194 public: 195 SystemROM(const char *name, bool mandatory, int size); 196 virtual ~SystemROM(void); 197 198 int get_size(void) const; 199 bool is_mandatory(void) const; 200 const string get_name(void) const; 201 const rom_entry_list_t & get_roms(void) const; 202 const ROMEntry * get_default_rom(void) const; 203 204 void add_rom(const char *name, const char *filename, bool is_default); 205 }; 206 207 typedef list<SystemROM *> system_rom_list_t; 208 209 class SystemType { 210 int _sort; 211 int _type; 212 string _name; 213 string _display_name; 214 bool _is_default; 215 kc_variant_t _kc_variant; 216 string _description; 217 EmulationType& _emulation_type; 218 unsigned long long _ui_callback_value; 219 unsigned long long _ui_callback_retrace_value; 220 221 string _rom_dir; 222 system_rom_list_t _rom_list; 223 224 virtual void add_rom(const char *name, bool mandatory, int size, int default_idx, const char *filename, const char *description, va_list ap); 225 226 public: 227 SystemType(int sort, string name, int type, EmulationType &emulation_type, kc_variant_t kc_variant, string description); 228 virtual ~SystemType(void); 229 230 virtual const char * get_name(void) const; 231 232 virtual const char * get_display_name(void) const; 233 virtual SystemType & set_display_name(const char *display_name); 234 235 virtual const string get_rom_directory(void) const; 236 virtual SystemType & set_rom_directory(const char *romdir); 237 238 virtual const unsigned long long get_ui_callback_value(void) const; 239 virtual SystemType & set_ui_callback_value(unsigned long long value); 240 241 virtual const unsigned long long get_ui_callback_retrace_value(void) const; 242 virtual SystemType & set_ui_callback_retrace_value(unsigned long long value); 243 244 virtual const system_rom_list_t & get_rom_list(void) const; 245 virtual const SystemROM * get_rom(const char *key) const; 246 virtual SystemType & add_rom(const char *name, int size, const char *filename, const char *description, ...); 247 virtual SystemType & add_rom(const char *name, int size, int default_idx, const char *filename, const char *description, ...); 248 virtual SystemType & add_optional_rom(const char *name, int size, const char *filename, const char *description, ...); 249 250 virtual int get_sort(void) const; 251 virtual int get_type(void) const; 252 virtual bool is_default(int type) const; 253 254 virtual kc_type_t get_kc_type(void) const; 255 virtual kc_variant_t get_kc_variant(void) const; 256 virtual const char * get_kc_variant_name(void) const; 257 virtual const char * get_description(void) const; 258 virtual const EmulationType & get_emulation_type(void) const; 259 }; 260 261 typedef list<SystemType *> system_type_list_t; 262 263 class SystemInformation { 264 private: 265 static SystemInformation *_instance; 266 267 system_type_list_t _system_type_list; 268 269 protected: 270 SystemType & add_system_type(int sort, string name, int type, EmulationType& emulation_type, kc_variant_t kc_variant, string description); 271 272 public: 273 SystemInformation(); 274 virtual ~SystemInformation(void); 275 276 static SystemInformation * instance(void); 277 278 virtual void show_types(void); 279 virtual void show_types_with_description(void); 280 281 virtual system_type_list_t & get_system_types(void); 282 virtual const SystemType * get_system_type(kc_type_t kc_type, kc_variant_t kc_variant) const; 283 }; 284 285 #endif /* __kc_prefs_types_h */ 286