diasurgical / devilutionX

Diablo build for modern operating systems
Other
7.75k stars 760 forks source link

Arbitrary screenshots like in vanilla #6057

Open myself600 opened 1 year ago

myself600 commented 1 year ago

Operating System

Other (please specify)

DevilutionX version

1.4.1 (latest release)

Describe

I can't make screenshots using the built-in feature from

Reasoning:

This is needed to grab the screen before it is upscaled to 1920x1080

To Reproduce

In the description

Expected Behavior

No response

Additional context

Operating system: Manjaro ARM 23.02

Examples

Screenshot from 2023-04-28 18-17-17 Original PCX file - 374,2 KiB (169,3 KiB after recompression with WebP lossless)

Screenshot_20230428_181757 Original PNG screenshot captured by the OS - 2,5 MiB (1,9 MiB after recompression with WebP lossless)

AJenbo commented 1 year ago

The original did not support taking screen shots during load screens or cut scenes.

AJenbo commented 1 year ago

Current implementation does not take keymapper in to account and has some issue with capturing from the menu on some systems.

DakkJaniels commented 1 year ago

I fixed the keymapper issue at the very least. Capturing from menu, in terms of having accurate/complete screenshots, sounds like a different issue all together.

AJenbo commented 1 year ago

@DakkJaniels can we disable menu screen shots for now?

DakkJaniels commented 1 year ago

I think the problem that I haven't worked out yet was the SDL1 part, not the menu screenshots

StephenCWills commented 1 year ago

There are still three problems, right?

DakkJaniels commented 1 year ago

I'll try and wrap up at least the first two items this week. The third I'm not really sure about.

AJenbo commented 1 year ago

if you can just disable screen shots in the menu that would be good enough :)

StephenCWills commented 1 year ago

The menu screenshots are missing some or all of the on-screen visual elements ~on some platforms~.

Looks like this is not a matter of it occurring on some platforms and not others. It's just order of operations. The PrintScreen() function is invoked by UiHandleEvents() during UiPollAndRender().

https://github.com/diasurgical/devilutionX/blob/d055aa5cbd1439edcc521df7b299edd9edeac19c/Source/DiabloUI/diabloui.cpp#L787-L799

You may notice that UiRenderListItems() is called just a few lines down from that so list items haven't been rendered yet. That's why those elements are missing from AJenbo's screenshot of the selhero menu (see https://github.com/diasurgical/devilutionX/pull/6058#issuecomment-1528050070).

Also, the reason why AJenbo was not able to get a screenshot of the main menu was because he was using a widescreen resolution. DakkJaniels was able to get one at 640x480 because UiClearScreen() doesn't do anything in that menu at that resolution. The game doesn't bother clearing the screen because the ArtBackground will eventually be drawn over the entire visible space when UiRenderListItems() is called.

https://github.com/diasurgical/devilutionX/blob/d055aa5cbd1439edcc521df7b299edd9edeac19c/Source/DiabloUI/diabloui.cpp#L781-L785