Update vga.js - #1622
Open
Godlance wants to merge 1 commit into
Open
Conversation
fix: prevent image freezes caused by svga_offset
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.
fix: prevent image freezes caused by svga_offset
This PR fixes a screen freeze in some svga dependant games.
The SVGA 8bpp fast path in
screen_fill_bufferignoressvga_offset, causing permanent display freezes with page-flipped double buffering.VGAScreen.prototype.screen_fill_buffer's fast path for 8bpp SVGA modes reads the displayed frame starting at byte0ofsvga_memoryalways,which ignores
svga_offsetthatport1CF_writesets fromVBE_DISPI_INDEX_X_OFFSET/VBE_DISPI_INDEX_Y_OFFSET.This is the standard VBE "Set Display Start" call that real VESA-aware software uses for page-flipped double buffering, it renders the next frame into a back buffer
elsewhere in
svga_memoryand then flips the display-start offset to it instead of copying pixels.Since this fast path always paints from offset
0, any program that flips the display start away from0gets a display that silently freezes onwhatever was last drawn at offset
0while the program keeps rendering correctly into the buffer v86 no longer looks at.Given that there is no error, it was really hard to debug from my side.
The existing code already has a comment to this fact:
This PR fixes the second XXX.
I've tested it with Master of Orion 2 and display freeze is fully resolved.
This will help any 90s era game that uses page flipping.