20 , videoSourceSetting(getMotherBoard().getVideoSource())
26 activeLayer =
nullptr;
37 if (refs.size() != 2) error =
true;
38 if (!error && !
dynamic_cast<VDP*
>(refs[0])) {
39 std::swap(refs[0], refs[1]);
41 if (!error) vdp =
dynamic_cast<VDP*
>(refs[0]);
42 if (!error) v9990 =
dynamic_cast<V9990*
>(refs[1]);
43 if (error || !vdp || !v9990) {
45 "Invalid Video9000 configuration: "
46 "need reference to VDP and V9990 device.");
64 if (newValue == value)
return;
69 void Video9000::recalc()
74 assert(!!v99x8Layer == !!v9990Layer);
79 bool showV99x8 = ((value & 0x10) == 0x10);
80 bool showV9990 = ((value & 0x18) != 0x10);
81 assert(showV99x8 || showV9990);
90 activeLayer = showV9990 ? v9990Layer : v99x8Layer;
95 void Video9000::recalcVideoSource()
100 bool superimpose = ((value & 0x18) == 0x18);
105 void Video9000::preVideoSystemChange() noexcept
107 activeLayer =
nullptr;
110 void Video9000::postVideoSystemChange() noexcept
116 void Video9000::paint(OutputSurface& output)
123 activeLayer->
paint(output);
126 void Video9000::takeRawScreenShot(
unsigned height,
const std::string&
filename)
128 auto* layer =
dynamic_cast<VideoLayer*
>(activeLayer);
130 throw CommandException(
"TODO");
132 layer->takeRawScreenShot(height,
filename);
135 int Video9000::signalEvent(
const std::shared_ptr<const Event>& event) noexcept
137 int video9000id = getVideoSource();
140 const auto& ffe = checked_cast<const FinishFrameEvent&>(*event);
141 if (ffe.isSkipped())
return 0;
142 if (videoSourceSetting.getSource() != video9000id)
return 0;
144 bool superimpose = ((value & 0x18) == 0x18);
145 if (superimpose && v99x8Layer && v9990Layer &&
146 (ffe.getSource() == v99x8Layer->getVideoSource())) {
148 v9990Layer->setSuperimposeVdpFrame(v99x8Layer->getPaintFrame());
151 bool showV9990 = ((value & 0x18) != 0x10);
152 if (( showV9990 && v9990Layer && (ffe.getSource() == v9990Layer->getVideoSource())) ||
153 (!showV9990 && v99x8Layer && (ffe.getSource() == v99x8Layer->getVideoSource()))) {
154 getReactor().getEventDistributor().distributeEvent(
155 std::make_shared<FinishFrameEvent>(
156 video9000id, video9000id,
false));
161 void Video9000::update(
const Setting& setting) noexcept
164 if (&setting == &videoSourceSetting) {
169 template<
typename Archive>
172 ar.template serializeBase<MSXDevice>(*
this);
173 ar.serialize(
"value", value);
void detach(VideoSystemChangeListener &listener)
void attach(VideoSystemChangeListener &listener)
void unregisterEventListener(EventType type, EventListener &listener)
Unregisters a previously registered event listener.
void registerEventListener(EventType type, EventListener &listener, Priority priority=OTHER)
Registers a given object to receive certain events.
virtual void paint(OutputSurface &output)=0
Paint this layer.
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Reactor & getReactor() const
const Devices & getReferences() const
Get the device references that are specified for this device.
EventDistributor & getEventDistributor()
Implementation of the Yamaha V9990 VDP as used in the GFX9000 cartridge by Sunrise.
void setExternalVideoSource(bool enable)
Is there an external video source available to superimpose on.
PostProcessor * getPostProcessor() const
Used by Video9000 to be able to couple the VDP and V9990 output.
Unified implementation of MSX Video Display Processors (VDPs).
PostProcessor * getPostProcessor() const
Used by Video9000 to be able to couple the VDP and V9990 output.
Video9000(const DeviceConfig &config)
void reset(EmuTime::param time) override
This method is called on reset.
void serialize(Archive &ar, unsigned version)
void writeIO(word port, byte value, EmuTime::param time) override
Write a byte to a given IO port at a certain time to this device.
int getVideoSource() const
Returns the ID for this videolayer.
void setVideo9000Active(int video9000Source_, Video9000Active active)
void update(const Setting &setting) noexcept override
VideoLayer(const VideoLayer &)=delete
string getName(KeyCode keyCode)
Translate key code to key name.
This file implemented 3 utility functions:
@ OPENMSX_FINISH_FRAME_EVENT
Sent when VDP (V99x8 or V9990) reaches the end of a frame.
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
constexpr const char *const filename
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)