Conversation
Add a ReceiveGamelogicFrames flag to DisplayComponent so individual displays can opt out of gamelogic engine frames, honored in DisplayPlayer's clear/update handlers. Flip RGB24 (Dmd24) frames vertically when copying into the texture via the new CopyRgb24FrameToTexture helper, fixing upside-down rendering. Introduce IDisplayFrameFormatPreference to let engines request a preferred display frame format.
Introduce IRomNameProvider as an optional capability interface so consumers (e.g. the DMD bridge resolving colorization) can read the running ROM name without reflecting over the concrete engine type. Also drop the stray "FLIPX" error log from mesh regeneration.
When another subscriber (e.g. the DMD bridge's in-scene destination) owns a display and feeds the component itself, the display player must not reconfigure it: resizing the texture and calling Clear() caused a visible flicker. Skip displays whose ReceiveGamelogicFrames is false. Also document the OnDisplayUpdateFrame contract (raise on the Unity main thread; frame buffer only valid for the synchronous call, so subscribers retaining it must copy) and switch a couple of dictionary lookups to TryGetValue.
Greptile SummaryThis PR adds an opt-in seam for external DMD frame handling. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (1): Last reviewed commit: "dmd: Skip externally-owned displays on d..." | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Small, additive changes to the GLE display seam so an external package
(
VisualPinball.Engine.DMD) can fan display frames out to real DMD hardware, an on-screen virtual DMD, and a colorization stage without touching the in-scene rendering path. Also includes two small correctness/perf fixes in the in-scene DMD.No behavior changes for existing setups. Every addition is opt-in and
ReceiveGamelogicFramesdefaults to the current behavior.
Game/Engine/IGamelogicEngine.cs- two optional capability interfaces + a documented contract:IRomNameProvider { string RomName }- lets a consumer resolve the active ROM (for colorizationlookup) without reflection.
IDisplayFrameFormatPreference { void RequestDisplayFrameFormat(string displayId, DisplayFrameFormat format) }- lets a consumer request a frame format per display (e.g.Dmd4for colorization vsDmd8).OnDisplayUpdateFrame: it must beraised on the Unity main thread, and
DisplayFrameData.Datais only valid for the duration of thecall (a subscriber that hands it to a worker thread must copy it).
Gamelogic engines opt in by implementing the interfaces (PinMAME does so in its own repo); engines
that don't are unaffected.
Display/DisplayComponent.cs- addsbool ReceiveGamelogicFrames(defaulttrue). When anexternal owner (e.g. the DMD bridge's in-scene destination) takes over a display, it flips this off
so the built-in
DisplayPlayerstops writing that display's texture.Game/DisplayPlayer.cs- honorsReceiveGamelogicFrameson frame-update, clear, anddisplay-requested events (the last one prevents a blank-frame flicker and a redundant
Texture2Dreallocation when an externally-owned display is re-requested mid-game). Minor
TryGetValuecleanups.Display/DotMatrixDisplayComponent.csthe gray (
Dmd2/4/8) path (CopyDatagained a destination offset so it can copy row-by-row).TryGetValueinstead ofContainsKey+ indexer (twodictionary lookups per pixel → one).
FLIPXdebug log.