VRAMObserver.hh 1.5 KB

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