19 , videoSourceSetting(getMotherBoard().getVideoSource())
32 if (refs.size() != 2) error =
true;
33 if (!error && !
dynamic_cast<VDP*
>(refs[0])) {
34 std::swap(refs[0], refs[1]);
36 if (!error) vdp =
dynamic_cast<VDP*
>(refs[0]);
37 if (!error) v9990 =
dynamic_cast<V9990*
>(refs[1]);
38 if (error || !vdp || !v9990) {
40 "Invalid Video9000 configuration: "
41 "need reference to VDP and V9990 device.");
59 if (newValue == value)
return;
64void Video9000::recalculate()
69 assert(!!v99x8Layer == !!v9990Layer);
74 bool showV99x8 = ((value & 0x10) == 0x10);
75 bool showV9990 = ((value & 0x18) != 0x10);
76 assert(showV99x8 || showV9990);
82 video9000id, showV9990 ?
FRONT :
NO);
83 activeLayer = showV9990 ? v9990Layer : v99x8Layer;
85 recalculateVideoSource();
88void Video9000::recalculateVideoSource()
93 bool superimpose = ((value & 0x18) == 0x18);
98void Video9000::preVideoSystemChange() noexcept
100 activeLayer =
nullptr;
103void Video9000::postVideoSystemChange() noexcept
109void Video9000::paint(OutputSurface& output)
116 activeLayer->
paint(output);
119void Video9000::takeRawScreenShot(
unsigned height,
const std::string& filename)
121 auto* layer =
dynamic_cast<VideoLayer*
>(activeLayer);
123 throw CommandException(
"TODO");
125 layer->takeRawScreenShot(height, filename);
128bool Video9000::signalEvent(
const Event& event)
133 const auto& ffe = get_event<FinishFrameEvent>(event);
134 if (ffe.isSkipped())
return false;
135 if (videoSourceSetting.
getSource() != video9000id)
return false;
137 bool superimpose = ((value & 0x18) == 0x18);
138 if (superimpose && v99x8Layer && v9990Layer &&
144 bool showV9990 = ((value & 0x18) != 0x10);
145 if (( showV9990 && v9990Layer && (ffe.getSource() == v9990Layer->
getVideoSource())) ||
146 (!showV9990 && v99x8Layer && (ffe.getSource() == v99x8Layer->
getVideoSource()))) {
148 FinishFrameEvent(video9000id, video9000id,
false));
153void Video9000::update(
const Setting&
setting)
noexcept
156 if (&
setting == &videoSourceSetting) {
157 recalculateVideoSource();
161template<
typename Archive>
164 ar.template serializeBase<MSXDevice>(*
this);
165 ar.serialize(
"value", value);
166 if constexpr (Archive::IS_LOADER) {
#define REGISTER_MSXDEVICE(CLASS, NAME)
void detach(VideoSystemChangeListener &listener)
void attach(VideoSystemChangeListener &listener)
void unregisterEventListener(EventType type, EventListener &listener)
Unregisters a previously registered event listener.
void distributeEvent(Event &&event)
Schedule the given event for delivery.
void registerEventListener(EventType type, EventListener &listener, Priority 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.
void setSuperimposeVdpFrame(const FrameSource *vdpSource)
Set the VDP frame on which to superimpose the 'normal' output of this PostProcessor.
FrameSource * getPaintFrame() const
Get the frame that would be displayed.
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
This file implemented 3 utility functions:
uint16_t word
16 bit unsigned integer
EventType getType(const Event &event)
std::variant< KeyUpEvent, KeyDownEvent, MouseMotionEvent, MouseButtonUpEvent, MouseButtonDownEvent, MouseWheelEvent, JoystickAxisMotionEvent, JoystickHatEvent, JoystickButtonUpEvent, JoystickButtonDownEvent, OsdControlReleaseEvent, OsdControlPressEvent, WindowEvent, TextEvent, FileDropEvent, QuitEvent, FinishFrameEvent, CliCommandEvent, GroupEvent, BootEvent, FrameDrawnEvent, BreakEvent, SwitchRendererEvent, TakeReverseSnapshotEvent, AfterTimedEvent, MachineLoadedEvent, MachineActivatedEvent, MachineDeactivatedEvent, MidiInReaderEvent, MidiInWindowsEvent, MidiInCoreMidiEvent, MidiInCoreMidiVirtualEvent, MidiInALSAEvent, Rs232TesterEvent, Rs232NetEvent, ImGuiDelayedActionEvent, ImGuiActiveEvent > Event
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)