OXYGENHUB
◆ main openmsx / src / video / VRAMObserver.hh
1.5 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#ifndef VRAMOBSERVER_HH
2
#define VRAMOBSERVER_HH
3
4
#include "EmuTime.hh"
5
6
namespace openmsx {
7
8
/** Interface that can be registered at VRAMWindow,
9
  * to be called when the contents of the VRAM inside that window change.
10
  */
11
class VRAMObserver {
12
public:
13
	/** Informs the observer of a change in VRAM contents.
14
	  * This update is sent just before the change,
15
	  * so the subcomponent can update itself to the given time
16
	  * based on the old contents.
17
	  * @param offset Offset of byte that will change,
18
	  *               relative to window base address.
19
	  * @param time The moment in emulated time this change occurs.
20
	  */
21
	virtual void updateVRAM(unsigned offset, EmuTime time) = 0;
22
23
	/** Informs the observer that the entire VRAM window will change.
24
	  * This update is sent just before the change,
25
	  * so the subcomponent can update itself to the given time
26
	  * based on the old contents.
27
	  * This happens if the base/index masks are changed,
28
	  * or if the window becomes disabled.
29
	  * TODO: Separate enable/disable from window move?
30
	  * @param enabled Will the window be enabled after the change?
31
	  *     If the observer keeps a cache which is based on VRAM contents,
32
	  *     it is only necessary to flush the cache if the new window
33
	  *     is enabled, because no reads are allowed from disabled windows.
34
	  * @param time The moment in emulated time this change occurs.
35
	  */
36
	virtual void updateWindow(bool enabled, EmuTime time) = 0;
37
38
protected:
39
	~VRAMObserver() = default;
40
};
41
42
} // namespace openmsx
43
44
#endif