How to make an ingame screenshot tool ?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Locked
loko
Posts: 6
Joined: Sat Jul 23, 2005 11:07 pm

How to make an ingame screenshot tool ?

Post by loko »

How to make an ingame screenshot tool ? How method do I need to use, and simply is that just possible ?
Andon
Posts: 15
Joined: Sun Jul 10, 2005 10:01 pm
Location: Florida

Post by Andon »

You need to know the framebuffer pixel format first of all, either 16 or 32-bit (and the order of the color channels), and then it's pretty easy.

Pseudo Code:

Code: Select all

#include "pspge.h"

char* frame_buf;

...

frame_buf = (char *) sceGeEdramGetAddr ();
Now frame_buf points to the VRAM.

Now, each pixel is either 2 or 4 bytes long, so for a full screenshot (480x272), you'd read (pixel_bytes * 480 * 272) from frame_buf into your own buffer.

You could write this straight to the Memory Stick and use it as is, but normally you'd want to encode it into TGA, PNG, JPG, etc. Depending on your encoder of choice, you may need convert each pixel swapping Blue and Red, range (de)compressing color channels and such before you can even encode it.

Encoding to TGA is fairly trivial and can be done without any library. PNG and JPEG both have PSP ports you can use, look in SVN. I believe there was also a tutorial several months ago on writing to a BMP, search the forum...
User avatar
Saotome
Posts: 182
Joined: Sat Apr 03, 2004 3:45 am

Post by Saotome »

There were already threads on this topic providing even complete source code. I bet if you use the search function you'll find at least two threads.
infj
User avatar
Agoln
Posts: 326
Joined: Wed Jun 08, 2005 3:14 am
Location: Fort Wayne, IN

Post by Agoln »

Lego of my Ago!
Locked