openMSX
MSXRom.cc
Go to the documentation of this file.
1#include "MSXRom.hh"
2#include "XMLElement.hh"
3#include "TclObject.hh"
4
5namespace openmsx {
6
7MSXRom::MSXRom(const DeviceConfig& config, Rom&& rom_)
8 : MSXDevice(config, rom_.getName())
9 , rom(std::move(rom_))
10{
11}
12
13void MSXRom::writeMem(word /*address*/, byte /*value*/, EmuTime::param /*time*/)
14{
15 // nothing
16}
17
18byte* MSXRom::getWriteCacheLine(word /*address*/) const
19{
20 return unmappedWrite.data();
21}
22
23void MSXRom::getInfo(TclObject& result) const
24{
25 // Add detected rom type. This value is guaranteed to be stored in
26 // the device config (and 'auto' is already changed to actual type).
27 const auto* mapper = getDeviceConfig().findChild("mappertype");
28 assert(mapper);
29 result.addDictKeyValues("mappertype", mapper->getData(),
30
31 // add sha1sum, to be able to get a unique key for this ROM device,
32 // so that it can be used to look up things in databases
33 "actualSHA1", rom.getSHA1().toString(),
34
35 // add original sha1sum
36 "originalSHA1", rom.getOriginalSHA1().toString());
37
38 // note that we're not using rom.getInfo(result); because we don't want
39 // the filename included for this method...
40}
41
43{
44 getInfo(result);
45
46 // add original filename, e.g. to be able to see whether it comes
47 // from a system_rom pool
48 result.addDictKeyValue("filename", rom.getFilename());
49}
50
51} // namespace openmsx
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:36
static std::array< byte, 0x10000 > unmappedWrite
Definition: MSXDevice.hh:305
const XMLElement & getDeviceConfig() const
Get the configuration section for this device.
Definition: MSXDevice.hh:234
MSXRom(const DeviceConfig &config, Rom &&rom)
Definition: MSXRom.cc:7
void writeMem(word address, byte value, EmuTime::param time) override
Write a given byte to a given location at a certain time to this device.
Definition: MSXRom.cc:13
void getExtraDeviceInfo(TclObject &result) const override
Definition: MSXRom.cc:42
byte * getWriteCacheLine(word address) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: MSXRom.cc:18
void getInfo(TclObject &result) const
Add dict values with info to result.
Definition: MSXRom.cc:23
const Sha1Sum & getSHA1() const
Definition: Rom.cc:357
const Sha1Sum & getOriginalSHA1() const
Definition: Rom.cc:349
std::string_view getFilename() const
Definition: Rom.cc:344
std::string toString() const
Definition: utils/sha1.cc:230
void addDictKeyValue(const Key &key, const Value &value)
Definition: TclObject.hh:142
void addDictKeyValues(Args &&... args)
Definition: TclObject.hh:145
const XMLElement * findChild(std::string_view childName) const
Definition: XMLElement.cc:19
std::string getName(KeyCode keyCode)
Translate key code to key name.
Definition: Keys.cc:730
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
STL namespace.