openMSX
Main Page
Namespaces
Classes
Files
File List
File Members
memory
Rom.hh
Go to the documentation of this file.
1
#ifndef ROM_HH
2
#define ROM_HH
3
4
#include "
MemBuffer.hh
"
5
#include "
sha1.hh
"
6
#include "
openmsx.hh
"
7
#include "
noncopyable.hh
"
8
#include <string>
9
#include <memory>
10
#include <cassert>
11
12
namespace
openmsx {
13
14
class
MSXMotherBoard;
15
class
XMLElement
;
16
class
DeviceConfig;
17
class
File;
18
class
FileContext
;
19
class
CliComm;
20
class
RomDebuggable;
21
22
class
Rom
:
private
noncopyable
23
{
24
public
:
25
Rom
(
const
std::string& name,
const
std::string& description,
26
const
DeviceConfig
& config,
const
std::string&
id
=
""
);
27
virtual
~Rom
();
28
29
const
byte
&
operator[]
(
unsigned
address)
const
{
30
assert(address < size);
31
return
rom[address];
32
}
33
unsigned
getSize
()
const
{
return
size; }
34
35
std::string
getFilename
()
const
;
36
const
std::string&
getName
()
const
;
37
const
std::string&
getDescription
()
const
;
38
const
Sha1Sum
&
getOriginalSHA1
()
const
;
39
const
Sha1Sum
&
getPatchedSHA1
()
const
;
40
41
private
:
42
void
init(
MSXMotherBoard
& motherBoard,
const
XMLElement
& config,
43
const
FileContext
& context);
44
bool
checkSHA1(
const
XMLElement
& config);
45
46
const
byte
* rom;
47
MemBuffer<byte>
extendedRom;
48
49
std::unique_ptr<File> file;
50
51
mutable
Sha1Sum
originalSha1;
52
Sha1Sum
patchedSha1;
53
std::string name;
54
const
std::string description;
55
unsigned
size;
56
57
// This must come after 'name':
58
// the destructor of RomDebuggable calls Rom::getName(), which still
59
// needs the Rom::name member.
60
std::unique_ptr<RomDebuggable> romDebuggable;
61
};
62
63
}
// namespace openmsx
64
65
#endif
Generated on Mon May 20 2013 12:16:59 for openMSX by
1.8.1.2