openMSX
MSXRom.cc
Go to the documentation of this file.
1 #include "MSXRom.hh"
2 #include "XMLElement.hh"
3 #include "TclObject.hh"
4 
5 namespace openmsx {
6 
7 MSXRom::MSXRom(const DeviceConfig& config, Rom&& rom_)
8  : MSXDevice(config, rom_.getName())
9  , rom(std::move(rom_))
10 {
11 }
12 
13 void MSXRom::writeMem(word /*address*/, byte /*value*/, EmuTime::param /*time*/)
14 {
15  // nothing
16 }
17 
18 byte* MSXRom::getWriteCacheLine(word /*address*/) const
19 {
20  return unmappedWrite;
21 }
22 
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 XMLElement* 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  // add original filename, e.g. to be able to see whether it comes
39  // from a system_rom pool
40  "filename", rom.getFilename());
41 }
42 
43 } // namespace openmsx
void getExtraDeviceInfo(TclObject &result) const override
Definition: MSXRom.cc:23
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
const Sha1Sum & getSHA1() const
Definition: Rom.cc:362
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
const XMLElement * findChild(string_view name) const
Definition: XMLElement.cc:94
STL namespace.
const std::string & getData() const
Definition: XMLElement.hh:35
const Sha1Sum & getOriginalSHA1() const
Definition: Rom.cc:354
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
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX...
Definition: MSXDevice.hh:31
std::string getFilename() const
Definition: Rom.cc:349
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
std::string toString() const
Definition: utils/sha1.cc:232
static byte unmappedWrite[0x10000]
Definition: MSXDevice.hh:275
void addDictKeyValues(Args &&... args)
Definition: TclObject.hh:138
string getName(KeyCode keyCode)
Translate key code to key name.
Definition: Keys.cc:589
const XMLElement & getDeviceConfig() const
Get the configuration section for this device.
Definition: MSXDevice.hh:218
MSXRom(const DeviceConfig &config, Rom &&rom)
Definition: MSXRom.cc:7