Taking screenshots with ps2link
Taking screenshots with ps2link
I'm currently working on an application much like InLink. Becouse it's built using Qt it should run on Windows, Linux, Mac and more. One feature I really missed in InLink was the ability to make screenshots, so I modified ps2link to be able to save a screenshot (using the ps2sdk function ps2_screenshot_file).
I have a small problem though, I can't figure out how the display is setup, becouse it seems like the GS registers are write-only. So taking a screenshot becomes a little tricky becouse you need to manually specify: base-addr, width, height and bit-depth.
My questions:
- Would anyone be interested in an InLink replacement?
- Is a screenshot feature like this interesting for someone?
- What other features would you like?
I have a small problem though, I can't figure out how the display is setup, becouse it seems like the GS registers are write-only. So taking a screenshot becomes a little tricky becouse you need to manually specify: base-addr, width, height and bit-depth.
My questions:
- Would anyone be interested in an InLink replacement?
- Is a screenshot feature like this interesting for someone?
- What other features would you like?
Bricks-OS, Operating System for Game Consoles
Re: Taking screenshots with ps2link
Would it be possible to take a screenshot at any time? That would be nice.- Is a screenshot feature like this interesting for someone?
If you're modifying ps2link, please update the PAL/NTSC detection method to work with recent consoles. Check for detect_signal in recent gsKit sources.- What other features would you like?
You may also replace the ugly debug font. See http://forums.ps2dev.org/viewtopic.php?t=11663
---edited---
bah, the PAL/NTSC detection should be made at debug lib not at ps2link itself... My mistake.
BTW: Nice work with brickOS. Seems promising.
Yes, I've already made a few screenshots and they look great! But keep in mind that you need to manually specify where in GS memory to make the screenshot. So if an application uses double buffering and continuesly swaps the render-buffer with the display-buffer, only half of the screenshots will be from the display-buffer.Would it be possible to take a screenshot at any time? That would be nice.
I would like to add the screenshot feature, but who is currently maintaining ps2link?If you're modifying ps2link
Bricks-OS, Operating System for Game Consoles
@LionX: Good idea, I'll see what I can do.
As for the current status:
I found out taking screenshots when there is movement produces a mess. This is becouse the screenshot is taken and transferred line-by-line, while the application is still running in a different thread. To solve this I have to suspend all application threads, and resume them after the screenshot is taken.
I already have this working, but a lot of the applications I tested chash when suspending/resuming the threads.
The screenshot code is also very buggy: 16bit mode does not work at all, and a lot of applications/resolutions result in a crash. So perhaps I need to rewrite that part.
Anyway, here's some proof of the screenshots:
ps2dev tutorial 2a: (Looks good)
ps2dev tutorial 2b: (The text was moving, so it looks messed up!)
ps2dev tutorial 2d: (Captured the FRONT and BACK buffer at the same time)
All these images use double scan, so they should probably be stretched to make them look right.
As for the current status:
I found out taking screenshots when there is movement produces a mess. This is becouse the screenshot is taken and transferred line-by-line, while the application is still running in a different thread. To solve this I have to suspend all application threads, and resume them after the screenshot is taken.
I already have this working, but a lot of the applications I tested chash when suspending/resuming the threads.
The screenshot code is also very buggy: 16bit mode does not work at all, and a lot of applications/resolutions result in a crash. So perhaps I need to rewrite that part.
Anyway, here's some proof of the screenshots:
ps2dev tutorial 2a: (Looks good)
ps2dev tutorial 2b: (The text was moving, so it looks messed up!)
ps2dev tutorial 2d: (Captured the FRONT and BACK buffer at the same time)
All these images use double scan, so they should probably be stretched to make them look right.
Bricks-OS, Operating System for Game Consoles
I've uploaded a complete demo package. With it you should be able to make, and save your own screenshots. You can also suspend/resume the running application. Becouse it is all very experimental and a lot of applications do not work, I included a simple demo (ps2dev tutorial 2c) that does work, so give it a try, and let me know what you think.
[download] ~5MB
@LionX: The method used to make the screenshot differs from the one in the sony ps2linux manuals. So I think it crashes becouse registers are not setup/restored properly.
[download] ~5MB
@LionX: The method used to make the screenshot differs from the one in the sony ps2linux manuals. So I think it crashes becouse registers are not setup/restored properly.
Bricks-OS, Operating System for Game Consoles
The graphical interface will also be available "for Linux people". But if I have everything working properly I'll try to add screenshot support to ps2link as well.Could you also add screenshot support to ps2client (for Linux people)?
Status update:
The screenshot code from the debug library wasn't working for me becouse it coused a lot of ps2 crashes. I found the graph_vram_read function in the graph library to be very usefull, though I had to modify it to be able to capture line-by-line. As a result, a lot more applications work now, including ps2link itself.
16bit screenshots are also working now (turns out there are 2 16bit modes, and I was only using one).
I also removed the conversion to 32bit (on the ps2 side). Making 16bit screenshots twice as fast, and 24bit screenshots 1.5x faster.
ConsoleLink, capturing ps2link:
Full-HD - 1920x1080, 16bit, dithering (click to enlarge):
Bricks-OS, Operating System for Game Consoles