[PS2] Screenshot support for ps2link

Create a single thread for each patch to be added to the repository. Please try to stay on topic.
Post Reply
Maximus32
Posts: 40
Joined: Mon Aug 27, 2007 12:28 am
Contact:

[PS2] Screenshot support for ps2link

Post by Maximus32 »

This patch adds screenshot support to ps2link:

- screenshot is written to file host:screenshot.ps2 after screenshot command.
- screenshot command needs width, height, psm, and base-address parameters.
- screenshot.ps2 file uses a custom file format (so ps2 does not need to convert the pixel format).
- a dependency to libdma and libpacket is needed.

Please review the code, and feel free to comment.

[download patch]
[download sample application for windows] - fixed
[see forum topic]
Bricks-OS, Operating System for Game Consoles
misfire
Posts: 110
Joined: Mon Sep 06, 2004 7:53 am
Location: Germany

Post by misfire »

I think it would be better if you could specify the name of the screenshot file and not use host:screenshot.ps2 as a static target.

Also, we should add screenshot support to ps2client -- the standard client application for ps2link. In my option it's annoying to have an extra (Windows) program for a single ps2link command. I can help you with the integration, but I may need your help when it comes to converting the .ps2 format to .png or whatever.

Anyway, good job so far.
Maximus32
Posts: 40
Joined: Mon Aug 27, 2007 12:28 am
Contact:

Post by Maximus32 »

Thank you for your reply.

The command request currently looks like this:

Code: Select all

typedef struct {
	unsigned int cmd;
	unsigned short len;
	unsigned int base;
	unsigned int width;
	unsigned int height;
	unsigned short psm;
} __attribute__((packed)) pko_pkt_screenshot;
Adding a filename is a good idea:

Code: Select all

typedef struct {
	unsigned int cmd;
	unsigned short len;
	unsigned int base;
	unsigned int width;
	unsigned int height;
	unsigned short psm;
	char file[PKO_MAX_PATH];
} __attribute__((packed)) pko_pkt_screenshot;
Another thing that could be added to this structure is the selection of a sub-area. This could speeds up the transfer when not the entire screen is needed.

Code: Select all

typedef struct {
	unsigned int cmd;
	unsigned short len;
	unsigned int base;
	unsigned int fb_width; // width of the framebuffer
	unsigned short psm;
	unsigned int x; // x starting position of screenshot
	unsigned int y; // y starting position of screenshot
	unsigned int width; // width of screenshot
	unsigned int height; // height of screenshot
} __attribute__((packed)) pko_pkt_screenshot;
Any ideas what's best?

We should add screenshot support to ps2client, I agree. It would be nice if you could help out, but first we need the command request structure to be good. Becouse after it is committed it can't be changed.

I was also hoping someone would comment on the function "graph_vram_read_xy", as it's a modified version of "graph_vram_read", and probably should end up in libgraph. However, this does add another dependency to libgraph.

Converting from the .ps2 format needs to be done by a separate tool since the ps2 writes the file directly to your pc. I hate using a separate tool though, but I could make one if needed. I would prefer the ps2 to store the file in a more standard format, like bmp or tga? Do they support the ps2's 16/24/32bit format?
Bricks-OS, Operating System for Game Consoles
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

Code: Select all

Sending        ps2link/Makefile
Sending        ps2link/ee/Makefile
Sending        ps2link/ee/cmdHandler.c
Sending        ps2link/ee/ps2link.c
Sending        ps2link/include/hostlink.h
Sending        ps2link/iop/Makefile
Sending        ps2link/iop/cmdHandler.c
Transmitting file data .......
Committed revision 1594.
thanks
Post Reply