OBattler / PCem-X

PCem with enhancements

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Taking screenshots

SharkyRawr opened this issue · comments

Hey there,
I started working on a screenshot feature, something that I personally missed in PCem. :)
You can check out my progress here: schumann2k/PCem-X@1f260f0a472ac3fbd182820fb1afee6f9556ec87

I'm not going to open a pull request just yet, since there are a few thing's I'd like to iron out before proposing a merge; see notes below.

  • I had to add -mno-ms-bitfields to CFLAGS to get the structs written properly (without padding), not sure why __attribute__((packed, aligned(1))) and/or __attribute__((gcc_struct)) wouldn't work with my gcc version (gcc.exe (Rev4, Built by MSYS2 project) 5.2.0).
    No clue if -mno-ms-bitfields will break some other part of PCem, hope I can find a way so I don't have to use it.
  • So far only the video.c:buffer32 backbuffer is written to the bmp file; haven't checked out what's needed to dump video.c:buffer yet (since I don't use CGA/Hercules emulation ;) so, it only seems to work with (S)VGA cards so far.

Constructive criticism and comments welcome. :)

Hey @timofonic, I plan on finishing this up by Wednesday, but at that point I just plan on outputting the screen buffer to a file (letters at first, and then colors). I'm not sure if this is what you want? I guess you would like to save the screenshot as a bitmap?

I already have second branch that has a screenshot feature already. It saves a screenshot as BMP when using DirectDraw, and PNG when using Direct3D. Link: http://goo.gl/JYoP4k .

Edit: And my code takes screenshots of CGA, MDA, and Hercules with no problems as well. It is also going to be submitted as a patch to mainline PCem (by TomWalker) after v11 is released.