[Q] How to take a screenshot (i.e, in the app code itself)?

Discussion in '3DS - Homebrew Development and Emulators' started by LeifEricson, Nov 1, 2015.

  1. LeifEricson
    OP

    LeifEricson Coming Soon™

    Member
    212
    165
    Jun 22, 2012
    United States
    New York, USA
    I'm wondering how HANS manages to take screenshots of the game, like is there some way to do this in my own app?

    I only ask because I'm looking into the plausibility of creating a "video" recorder -- one that simply takes frame by frame screenshots of the game which can then later be compiled into a video. This way, when the 3DS inevitably slows to a crawl, it wouldn't matter, because the app will simply be taking screenshots at its own pace.

    Anyways, long story short just wanted to know if anyone knows how it's done yet.
     
  2. TheCruel

    TheCruel Developer

    Banned
    1,351
    2,882
    Dec 6, 2013
    United States
    It dumps the framebuffer to a file. It's in a raw (.bmp-like) file until you run the screenshot tool app that converts to png.

    These raw images aren't compressed and SD card writing is slow. Recording would easily be around 3MB per second. Unless the game is very simple (not requiring much CPU), it not feasible to encode in real-time. Even then, I'm guessing the SD card writing would be the bottleneck.

    I mean, I haven't used it, but doesn't HANS cause a momentary pause in the game when capturing screenshot? Now imagine doing that 30 times per second...
     
  3. LeifEricson
    OP

    LeifEricson Coming Soon™

    Member
    212
    165
    Jun 22, 2012
    United States
    New York, USA
    Yes, HANS pauses to write a screenshot, and yes, real time gameplay would be impossible, but imagine having the ability to record Pokemon battle videos/Sm4sh replays without having to have a capture card installed. Dunno about you, but there are a couple great battles/replays that I wouldn't mind letting my 3DS record overnight for. In those types of situations, time is not important (well, to an extent, it's how long would you mind waiting for it).

    Plus, even if it can't encode in real time, it could always just save the screenshots as screenshots and the encoding can be done on a PC.

    Having these limitations in mind, do you think it would be possible?
     
  4. TheCruel

    TheCruel Developer

    Banned
    1,351
    2,882
    Dec 6, 2013
    United States
    Yeah, with several GBs available on SD card and a post-processing app to encode them into a video.

    imo, it would likely be more trouble than it's worth, being so slow. And I can't think of a decent way to capture audio.
     
  5. LeifEricson
    OP

    LeifEricson Coming Soon™

    Member
    212
    165
    Jun 22, 2012
    United States
    New York, USA
    I'll make a POC and see what I can make of it. One last thing, how would I go about "running" the game in the card slot? I've dabbled in homebrew, just nothing dealing with actual games.
     
    Ammako likes this.
  6. thekarter104

    thekarter104 GBAtemp Maniac

    Member
    1,210
    367
    Mar 28, 2013
    United States
    Do you know how to get BOTH top AND bottom screens in 1 picture? HANS and NTR doesn't seem to do that.
     
  7. TheCruel

    TheCruel Developer

    Banned
    1,351
    2,882
    Dec 6, 2013
    United States
    I don't know anything about that, and HANS isn't yet open source. Perhaps look at the title launching software already made (FBI, SunShell, etc), but I'm not sure if the cart is different than running any other title (e.g. installed CIA).
     
  8. WeedZ

    WeedZ Possibly an enlightened being

    Member
    GBAtemp Patron
    WeedZ is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    2,715
    5,219
    Jan 13, 2015
    United States
    Hardware modifications for streaming video is the best way to go
     
  9. thekarter104

    thekarter104 GBAtemp Maniac

    Member
    1,210
    367
    Mar 28, 2013
    United States
    What about making it like, when you press X+Y for example, it will take screenshots in 30 FPS, but does not write to the SD card yet, but when you press HOME for example, it will write to the SD card. It will look like the 3DS is frozen, but ofcourse it's actually not because it writes to SD. Is that possible that way then?
     
  10. Ermelber

    Ermelber GBAtemp Regular

    Member
    129
    81
    Sep 21, 2012
    Italy
    Como, Lombardia
    You'd always have to save these 30 frames per second somewhere, that's why it'd be totally impossible.
     
  11. hippy dave

    hippy dave Butts Butts Megabutts

    Member
    2,571
    1,791
    Apr 30, 2012
    Photoshop.
     
    TheTess likes this.
  12. LeifEricson
    OP

    LeifEricson Coming Soon™

    Member
    212
    165
    Jun 22, 2012
    United States
    New York, USA
    My plan is to write it frame by frame. There's not enough ram to store large amounts of screenshots, especially with a game running. The lag will be pretty intense, but again this tool will be used for pre-recorded events such as battle videos or replays in Sm4sh. Audio might not be possible unless I could read from the buffer, but it seems unlikely.