joncampbell123 / dosbox-x

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

Screenshot with SDL1 doesn't reflect original colors #727

Open hihihirokane opened 6 years ago

hihihirokane commented 6 years ago

This is a screenshot by the BETA (2018-5-18) version built with in-tree SDL1.x on OS X Mountain Lion. White color turns into yellow, green and red interchange their colors, and so on. dosbox_004 As a reference, a binary built with SDL2 didn't change colors on the screenshot. This may have nothing to do with PC-98 mode because 'machine=svga_s3' also caused this. dosbox_005

Here is the captured video (converted to GIF): dosbox_000

emendelson commented 6 years ago

It may be unlikely, but could this problem have anything to do with the various macOS problems in this thread:

https://www.vogons.org/viewtopic.php?f=32&t=54314

joncampbell123 commented 6 years ago

Right. Mac OS X bitmaps follow a strange RGBA pattern where the alpha channel is in the low 8 bits. I thought I fixed that...

emendelson commented 6 years ago

I think it's fixed in the way the macOS displays the screen. I haven't tested with current code, but I think this report is about what happens in a screen shot. Will test later if it's any help.

joncampbell123 commented 6 years ago

Ah, so the C_SHOT code needs to reverse RGBA again for libpng.

Does this also happen with video capture?

emendelson commented 6 years ago

I hope the OP will report on that - I don't have a current Mac version running, but can build one later on if needed.

emendelson commented 6 years ago

OK, I built the latest code, and can't find any way to make a screen shot or record video. The OP says that F12+Shift+S creates a screen shot, but that seems only to enter "S" at the command prompt. And I don't see screen shot or video recording on the mapper menu.

(Also, I think someone already reported that the menu is unresponsive at first to mouse-clicks. I was able to get it to respond but I don't know how - maybe by switching focus to another app and then coming back to DOSBox-X? I though that opening the mapper accomplished this, but it doesn't....)

I used the "build" script to build. Should I try something else?

hihihirokane commented 6 years ago

I may have configured the mapper myself about screenshot and video. I shouldn't have posted confusing description.

emendelson commented 6 years ago

OK - I'll stay out of this from here on...!

joncampbell123 commented 6 years ago

@emendelson The screenshot function requires that libz (zlib) and libpng are available to compile against. Are the headers and libraries available on your system when you build?

emendelson commented 6 years ago

Nope - no zlib and libpng headers available here. I may try to figure out how to make them available, but I'm trying to avoid Brew and MacPorts, so it will be a bit tricky. But hihihirokane is clearly better equipped to answer questions about this than I am!

joncampbell123 commented 6 years ago

I reported the menus are unresponsive to the first click. I had to click on it every compile cycle to check my progress when I was writing the NSMenu support, so having to click away and back to check if I got it right was irritating.

joncampbell123 commented 6 years ago

@emendelson Try to use Brew and MacPorts if you can.

I may consider modifying configure.ac to compile with the in-tree zlib and libpng if no external library of it is available, just as it does now the SDL2 library.

emendelson commented 6 years ago

OK, I used to use MacPorts, but stopped because I kept making apps that wouldn't work on other people's machines (long story). But it would be terrific if you could integrate zlib and libpng into the macOS version. (The only GitHub project of mine that actually works, or used to work, was a script called OneStopDOSBoxOSX that downloads the libraries and runs a build script that uses them; most of that script was based on ideas thought up by Dominus at Vogons.org, but it made it possible to build SVN in macOS with a few clicks.)

joncampbell123 commented 6 years ago

@emendelson It's possible your application linked to the libraries dynamically.

I've learned long ago that on Windows and Mac OS X it's generally easier to either statically link the library into your program or include the DLL or dylib files in your application. Never assume the other systems have it. You make your program more portable that way.

joncampbell123 commented 6 years ago

Linux is generally an exception because people are more likely to compile from source than run a binary.

emendelson commented 6 years ago

That's exactly what I've learned to do - after a lot of frustrations figuring out how to link statically. Getting that to work with DOSBox SVN on the Mac was a nightmare, and I still don't know how to do it - I simply follow Dominus's method without understanding it, and it works.