SCP: video improvements #487
Closed
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.
Re-engineered sim_video support. Submitted as two commits so that it's easier to cherry-pick the second commit.
The first commit is the re-engineered video that removes the
SDL_main()
asymmetry between macOS, Linux and Windows -- they all useSDL_main()
if video is needed. Video is also automagically rescaled if it can't fit on the physical screen; SDL2 has been able to handle this for a long time. Audio is also asynchronous and won't stall the simulator while the tone plays out. There's a new "onto" API that allows the simulator to draw pixels directly into the SDL texture, reducing the amount of video frame buffering. Lastly, users can enable native hardware acceleration, for what it's worth; simulator video is not limited to the SDL software renderer.The second commit is sim_timer.c cleanups, notably using actual constants for various conversions, e.g.,
MSEC_PER_SEC_l
for millisecond to second (long) conversions. It also corrects the long-running issue on Windows whereSleep(1)
can sleep for 1 + 15 + 5 milliseconds (requested delay + timer interrupt periodicity + wakeup latency) by using waitable timers.