53 using std::unique_ptr;
58 namespace RomFactory {
66 const byte* data = &rom[0];
69 if ((size <= 0x4000) &&
70 (data[0] ==
'A') && (data[1] ==
'B')) {
71 word initAddr = data[2] + 256 * data[3];
72 word textAddr = data[8] + 256 * data[9];
73 if ((textAddr & 0xC000) == 0x8000) {
74 if ((initAddr == 0) ||
75 (((initAddr & 0xC000) == 0x8000) &&
76 (data[initAddr & (size - 1)] == 0xC9))) {
93 for (
int i = 0; i < size - 3; ++i) {
94 if (data[i] == 0x32) {
95 word value = data[i + 1] + (data[i + 2] << 8);
133 if (typeGuess[i] && (typeGuess[i] >= typeGuess[type])) {
134 type =
static_cast<RomType>(i);
151 auto rom = make_unique<Rom>(config.
getAttribute(
"id"),
"rom", config);
156 if (typestr ==
"auto") {
160 type = guessRomType(*rom);
169 unique_ptr<MSXRom> result;
172 result = make_unique<RomPlain>(
176 result = make_unique<RomPlain>(
183 result = make_unique<RomPlain>(
185 (type & 7) * 0x2000);
191 result = make_unique<RomPlain>(
193 (type & 7) * 0x2000);
205 result = make_unique<RomPageNN>(config, move(rom), type & 0xF);
208 result = make_unique<RomDRAM>(config, move(rom));
211 result = make_unique<RomGeneric8kB>(config, move(rom));
214 result = make_unique<RomGeneric16kB>(config, move(rom));
217 result = make_unique<RomKonamiSCC>(config, move(rom));
220 result = make_unique<RomKonami>(config, move(rom));
223 result = make_unique<RomKonamiKeyboardMaster>(config, move(rom));
226 result = make_unique<RomAscii8kB>(config, move(rom));
229 result = make_unique<RomAscii16kB>(config, move(rom));
232 result = make_unique<RomPadial8kB>(config, move(rom));
235 result = make_unique<RomPadial16kB>(config, move(rom));
238 result = make_unique<RomSuperLodeRunner>(config, move(rom));
241 result = make_unique<RomMSXDOS2>(config, move(rom));
244 result = make_unique<RomRType>(config, move(rom));
247 result = make_unique<RomCrossBlaim>(config, move(rom));
250 result = make_unique<RomHarryFox>(config, move(rom));
253 result = make_unique<RomAscii8_8>(
257 result = make_unique<RomAscii8_8>(
261 result = make_unique<RomAscii8_8>(
265 result = make_unique<RomAscii8_8>(
269 result = make_unique<RomAscii16_2>(config, move(rom));
272 result = make_unique<RomGameMaster2>(config, move(rom));
275 result = make_unique<RomPanasonic>(config, move(rom));
278 result = make_unique<RomNational>(config, move(rom));
281 result = make_unique<RomMajutsushi>(config, move(rom));
284 result = make_unique<RomSynthesizer>(config, move(rom));
287 result = make_unique<RomPlayBall>(config, move(rom));
290 result = make_unique<RomNettouYakyuu>(config, move(rom));
293 result = make_unique<RomHalnote>(config, move(rom));
296 result = make_unique<RomZemina80in1>(config, move(rom));
299 result = make_unique<RomZemina90in1>(config, move(rom));
302 result = make_unique<RomZemina126in1>(config, move(rom));
305 result = make_unique<RomHolyQuran>(config, move(rom));
308 result = make_unique<RomHolyQuran2>(config, move(rom));
311 result = make_unique<RomFSA1FM1>(config, move(rom));
314 result = make_unique<RomFSA1FM2>(config, move(rom));
320 result = make_unique<RomManbow2>(config, move(rom), type);
323 result = make_unique<RomMatraInk>(config, move(rom));
326 result = make_unique<RomArc>(config, move(rom));
329 result = make_unique<MegaFlashRomSCCPlus>(config, move(rom));
332 result = make_unique<RomDooly>(config, move(rom));
335 result = make_unique<RomMSXtra>(config, move(rom));
338 result = make_unique<RomMultiRom>(config, move(rom));