Opened 18 years ago

Closed 17 years ago

Last modified 20 months ago

#7996 closed patch

Screenshots (feature request #559626)

Reported by: eriktorbjorn Owned by: Kirben
Priority: normal Component: --Other--
Keywords: Cc:
Game:

Description

Looks like you can't attach files to feature requests so I'm submitting a patch instead. This is in regards to part of feature request #559626.

The screenshot feature should be trivial to add. At least for the SDL version, since there already is an SDL_SaveBMP() macro available. Admittedly, BMP isn't the sexiest image format around, but I didn't want to add dependencies on other libraries.

With this patch, you should be able to use Alt-S to make a screenshot.

It's still a bit rough. For instance, it always saves the screenshots to the current directory, and it doesn't hide the mouse cursor before the screenshot is made. (That first item could be partially adressed by patch #587694, by the way, since that puts the code to figure out save directory in a separate function.)

Of course, similar code would have to be added to the other versions.

The patch is made against an August 1 CVS snapshot.

Ticket imported from: #590233. Ticket imported from: patches/101.

Attachments (5)

screenshot.diff (1.3 KB ) - added by eriktorbjorn 18 years ago.
Proof-of-concept screenshot patch
screenshot2.diff (3.6 KB ) - added by eriktorbjorn 18 years ago.
Updated patch against a September 21 CVS snapshot
screenshot3.diff (6.4 KB ) - added by eriktorbjorn 18 years ago.
Patch against a September 26 CVS snapshot
screenshot4.diff (7.6 KB ) - added by eriktorbjorn 18 years ago.
Patch against an October 1 CVS snapshot
screenshot5.diff (3.1 KB ) - added by eriktorbjorn 17 years ago.
Patch against an August 10 CVS snapshot

Download all attachments as: .zip

Change History (14)

by eriktorbjorn, 18 years ago

Attachment: screenshot.diff added

Proof-of-concept screenshot patch

by eriktorbjorn, 18 years ago

Attachment: screenshot2.diff added

Updated patch against a September 21 CVS snapshot

comment:1 by eriktorbjorn, 18 years ago

For whatever it's worth, here's an updated version of the patch. I'm still not quite happy with it, for two reasons: a) It doesn't support the SDL/OpenGL backend at all, and b) it saves the screenshots in the current directory. I'd like for it to use the savegame directory instead.

comment:2 by eriktorbjorn, 18 years ago

I overheard Fingolfin saying that this feature could be implemented using the new grab_overlay() function. At least once all backends support it. I think he has a point.

Of course this means that I can no longer use SDL_SaveBMP(), which raises the question: What image format should we use for screenshots? PNG would be nice, but that would add new library dependencies for ScummVM. I guess I could make it a compile-time option. We can always add a built-in BMP writer later, if the need arises.

I'll look into it.

by eriktorbjorn, 18 years ago

Attachment: screenshot3.diff added

Patch against a September 26 CVS snapshot

comment:3 by eriktorbjorn, 18 years ago

Here's a new version of the patch. It's still too rough to be applied, I think, but it should do as a proof-of-concept.

It no longer depends on SDL, but it does currently depend on libpng so I've added a compile-time option for whether or not it should be included. It would be nice if we had some simpler image format (probably BMP) to use as a fallback.

The screenshots are always of the unscaled image. Perhaps we could add a function to OSystem to return the image that is actually being displayed?

The screenshots are always 320x240 pixels, even if the game window is smaller.

It's not currently possible to make screenshots of our shiny new GUI.

On the bright side, it does work for both SCUMM and Simon games.

by eriktorbjorn, 18 years ago

Attachment: screenshot4.diff added

Patch against an October 1 CVS snapshot

comment:4 by eriktorbjorn, 18 years ago

Another update to the patch, but still not quite ready to be applied.

As per Fingolfin's suggestion, this adds a function to OSystem to query whether or not the overlay is visible. More job for the porters, but at least it's possible to make screenshots of the NewGUI now...

I've also moved the test for the screenshot key back into the SDL backend. It's not that it's impossible to put it in the ScummVM core, it's just that there are so many event loops to add it to now. Scumm, Simon, NewGUI, launcher... any others?

Unresolved issues:

I still need some way of getting the actual size of the screen.

I still think it'd be nice to dump what's actually on screen, instead of the unscaled image.

comment:5 by fingolfin, 17 years ago

Hm, what about this? Do we want to try to make this work again?

by eriktorbjorn, 17 years ago

Attachment: screenshot5.diff added

Patch against an August 10 CVS snapshot

comment:6 by eriktorbjorn, 17 years ago

Since we now have more game engines than backends that can sensibly handle screenshots, maybe it is easier to put this functionality in the backend after all.

I've attached an updated patch for the SDL backend, that only handles BMP images.

In other words, I'm back to where I started again. :-)

(I'm not quite sure about how virtual functions really work, so I may have written something ugly here.)

comment:7 by Kirben, 17 years ago

Added to ScummVM cvs. Two suggestions though: An option to choose directory for snapshots would be very useful. Or at least use the save dir. again. Having the screenshot named after game alias/target would make sorting screenshots easier too, if possible.

comment:8 by Kirben, 17 years ago

Owner: set to Kirben
Status: newclosed

comment:9 by digitall, 20 months ago

Component: --Other--
Note: See TracTickets for help on using tickets.