#142241 - Ishi - Sat Oct 06, 2007 8:36 pm
I spent last night looking things up for this and getting it working, so I thought I'd share what I learned.
This basically allows you to dump a screenshot straight to a file on your DS card, and then convert it into a proper image file on your PC. Really handy for showing glitches that you need help fixing or something like that.
It requires a free VRAM bank unfortunately. I don't think there's a way to do this without using a bank, but if there is I'd love to be shown how.
I'm using this on 3D on the top screen, settings may need to be changed if you're doing anything different. Again, clarification on that would be fantastic :)
1.
Get your game up and running. Keep one of the main VRAM banks free (I use D).
Amongst the usual headers, you'll need:
Don't forget to initialise the file system for saving the image later. Usually done right after powerON() etc.
2.
When you want to take the screenshot (probably when the user presses a button or something), change the video mode and enable display capture:
3.
At this point I let it render a couple of frames before I grab the image. When I tried grabbing it straight away there was glitches on the image, probably caused by the switch in video mode.
4.
Time to get the image.
That saves the current screen data to the root directory of your card.
Finally, return the video mode to what it used to be, and the game should carry on running as normal. Note that MODE_0_3D is just an example here, you can set whatever video mode you need to.
5.
Copy/move the screenshot file off the DS onto your PC. Drag & Drop it onto my converter program - http://www.ishisoft.remakes.org/misc/ds_screenshot_converter.zip - and if all goes well, your screenshot should be saved out as a 256x192 .png image. (like so: http://www.ishisoft.remakes.org/misc/screenshot1.png ).
Hope this is useful for someone. It's not exactly comprehensive or detailed, but it gets the job done.
Note that you can save the screenshot file as whatever you want. Mine outputs incrementally numbered files so that you can take more than one screenshot at a time. I left that kind of thing out of this tutorial for the sake of simpicity.
This basically allows you to dump a screenshot straight to a file on your DS card, and then convert it into a proper image file on your PC. Really handy for showing glitches that you need help fixing or something like that.
It requires a free VRAM bank unfortunately. I don't think there's a way to do this without using a bank, but if there is I'd love to be shown how.
I'm using this on 3D on the top screen, settings may need to be changed if you're doing anything different. Again, clarification on that would be fantastic :)
1.
Get your game up and running. Keep one of the main VRAM banks free (I use D).
Amongst the usual headers, you'll need:
Code: |
#include <stdio.h>
#include <fat.h> |
Don't forget to initialise the file system for saving the image later. Usually done right after powerON() etc.
Code: |
fatInitDefault(); //file system |
2.
When you want to take the screenshot (probably when the user presses a button or something), change the video mode and enable display capture:
Code: |
//set up frame buffer video mode
videoSetMode(MODE_FB3); //frame buffer 3 DISP_CAPTURE = DCAP_ENABLE | //enables display capturing DCAP_BANK(3) | //which vram bank to use - 0=A, 1=B, 2=C, 3=D DCAP_SIZE(3) | //3 = full size 256 x 192 DCAP_SRC(1); //capture source - not sure what this does |
3.
At this point I let it render a couple of frames before I grab the image. When I tried grabbing it straight away there was glitches on the image, probably caused by the switch in video mode.
4.
Time to get the image.
Code: |
//dump the screenshot to file
FILE *file = fopen("/screenshot", "wb"); if(file) { fwrite((void*)0x6860000, //memory location of the screen buffer - this might only apply to VRAM bank D, I'm not sure tbh 2, //each pixel is two bytes 256 * 192, //total number of pixels (49152) file); fclose(file); } |
That saves the current screen data to the root directory of your card.
Finally, return the video mode to what it used to be, and the game should carry on running as normal. Note that MODE_0_3D is just an example here, you can set whatever video mode you need to.
Code: |
//return to default video mode
videoSetMode(MODE_0_3D); DISP_CAPTURE = 0; //disable display capture |
5.
Copy/move the screenshot file off the DS onto your PC. Drag & Drop it onto my converter program - http://www.ishisoft.remakes.org/misc/ds_screenshot_converter.zip - and if all goes well, your screenshot should be saved out as a 256x192 .png image. (like so: http://www.ishisoft.remakes.org/misc/screenshot1.png ).
Hope this is useful for someone. It's not exactly comprehensive or detailed, but it gets the job done.
Note that you can save the screenshot file as whatever you want. Mine outputs incrementally numbered files so that you can take more than one screenshot at a time. I left that kind of thing out of this tutorial for the sake of simpicity.