| 1 |
#include "MSXRom.hh" |
| 2 |
|
| 3 |
#include "RomInfo.hh" |
| 4 |
|
| 5 |
#include "TclObject.hh" |
| 6 |
#include "XMLElement.hh" |
| 7 |
|
| 8 |
namespace openmsx { |
| 9 |
|
| 10 |
MSXRom::MSXRom(const DeviceConfig& config, Rom&& rom_) |
| 11 |
: MSXDevice(config, rom_.getName()) |
| 12 |
, rom(std::move(rom_)) |
| 13 |
{ |
| 14 |
} |
| 15 |
|
| 16 |
void MSXRom::writeMem(uint16_t , byte , EmuTime ) |
| 17 |
{ |
| 18 |
|
| 19 |
} |
| 20 |
|
| 21 |
byte* MSXRom::getWriteCacheLine(uint16_t ) |
| 22 |
{ |
| 23 |
return unmappedWrite.data(); |
| 24 |
} |
| 25 |
|
| 26 |
std::string_view MSXRom::getMapperTypeString() const |
| 27 |
{ |
| 28 |
|
| 29 |
|
| 30 |
const auto* mapper = getDeviceConfig().findChild("mappertype"); |
| 31 |
assert(mapper); |
| 32 |
return mapper->getData(); |
| 33 |
} |
| 34 |
|
| 35 |
RomType MSXRom::getRomType() const |
| 36 |
{ |
| 37 |
auto result = RomInfo::nameToRomType(getMapperTypeString()); |
| 38 |
assert(result != RomType::UNKNOWN); |
| 39 |
return result; |
| 40 |
} |
| 41 |
|
| 42 |
void MSXRom::getInfo(TclObject& result) const |
| 43 |
{ |
| 44 |
std::array<char, 40> buf1; |
| 45 |
std::array<char, 40> buf2; |
| 46 |
|
| 47 |
result.addDictKeyValues("mappertype", getMapperTypeString(), |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
"actualSHA1", rom.getSHA1().toString(buf1), |
| 52 |
|
| 53 |
|
| 54 |
"originalSHA1", rom.getOriginalSHA1().toString(buf2)); |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
} |
| 59 |
|
| 60 |
void MSXRom::getExtraDeviceInfo(TclObject& result) const |
| 61 |
{ |
| 62 |
getInfo(result); |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
result.addDictKeyValue("filename", rom.getFilename()); |
| 67 |
} |
| 68 |
|
| 69 |
} |