joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.64k stars 374 forks source link

Memory inspection function, formatted and behaving like the current display window #1981

Open MobyGamer opened 3 years ago

MobyGamer commented 3 years ago

I'm in need of a memory inspection function that lets the user inspect an area of memory as if it were the current display, but coming from a user-definable offset. It should effectively operate like a second display card that matches the existing display card, but showing the contents of user-defined RAM. Implementation can be either a secondary window (SDL2), or just a wider expansion of the existing display (SDL1) to accommodate the additional information. The additional information should be able to be saved to .AVI just like the main display window can (the SDL1 display expansion idea should easily facilitate this). The user-defined inspection location should be able to be adjusted realtime with keys as the emulated program runs, so that the proper location can be found with a minimum of trial and error.

The primary use case is observing how games draw their scene before making the results visible. Examples include CGA games that build the entire display in system RAM before moving it to display RAM at B800 (Turbo Champions, Jet, Sidearms, Flight Simulator, many others); MCGA games that do the same; showing the hidden page of EGA and VGA games instead of the visible page; etc.

Some console emulators already have similar functionality; there are many youtube videos of NES, SNES, GBA, and Genesis emulators showing tile maps updating realtime, showing multiple background layers separated into different displays, sprite layers only, etc. In the DOS space, there is an AGI and/or SCI emulator (scummvm?) that can show scenes being drawn, slowly, before they're just blitted to the display buffer.

Future enhancements to this feature could include changing how the inspection window is formatted. For example, many CGA games build to an offscreen buffer that is formatted linearly, then blitted in the expected interleaved fashion; other games build to a buffer that is not the exact byte width of the current display, and only a portion is blitted. Inspection window controls would allow for these kinds of adjustments so that such offscreen buffers could be inspected in a visual form that matches the visible end results.

Wengier commented 3 years ago

Perhaps @joncampbell123 wants to look at this?

joncampbell123 commented 3 years ago

I've thought of a similar feature for showing how unchained 256-color mode games like DOOM draw in video memory before presenting it on screen through hardware page flipping.

To implement this, it would help to discuss what you think the controls should do. I'm thinking controls for: