WiiRd forum

Wii & Gamecube Hacking => Wii Game hacking help => Topic started by: Stuff on September 30, 2011, 04:31:18 AM

Title: gecko.net screencapture
Post by: Stuff on September 30, 2011, 04:31:18 AM
How does this work? Is there like a known area in memory that handles the screen? I feel stupid asking this. >.>
Title: Re: gecko.net screencapture
Post by: Bully@Wiiplaza on September 30, 2011, 11:02:46 AM
it would be great if someone finds a way to screen-cap to the sd card using a gecko code. :(
You weren´t first with that question though :D
Title: Re: gecko.net screencapture
Post by: matt123337 on September 30, 2011, 12:31:32 PM
Quote from: Bully@Wiiplaza on September 30, 2011, 11:02:46 AM
it would be great if someone finds a way to screen-cap to the sd card using a gecko code. :(
You weren´t first with that question though :D
For that, you would have to have a full (well, at least just writing) SD card filesystem as a cheat code. Storing it as a.bmp wouldn't be very hard tho...

I could be possible to do with the 32kb mem hack tho...
Title: Re: gecko.net screencapture
Post by: Bully@Wiiplaza on September 30, 2011, 02:47:32 PM
okay, I´m willing to test...
Title: Re: gecko.net screencapture
Post by: biolizard89 on September 30, 2011, 07:31:50 PM
Quote from: Stuff on September 30, 2011, 04:31:18 AM
How does this work? Is there like a known area in memory that handles the screen? I feel stupid asking this. >.>
There are two framebuffers on the GC/Wii (EFB and XFB), both of which are fairly simple to dump and are generally independent of the game.  I know GCNrd could dump both; I'm not certain which one Gecko.NET dumps.
Title: Re: gecko.net screencapture
Post by: Y.S. on October 01, 2011, 02:10:54 AM
Gecko.net captures the screen this way:
[spoiler]public Image Screenshot()
       {
           MemoryStream analyze;

           //Dump video registers
           analyze = new MemoryStream();
           Dump(0xCC002000, 0xCC002080, analyze);
           analyze.Seek(0, SeekOrigin.Begin);
           Byte[] viregs = new Byte[128];
           analyze.Read(viregs, 0, 128);
           analyze.Close();

           //Extract width, height and offset in memory
           UInt32  swidth = (UInt32)(viregs[0x49] << 3);
           UInt32 sheight = (UInt32)(((viregs[0] << 5) | (viregs[1] >> 3)) & 0x07FE);
           UInt32 soffset = (UInt32)((viregs[0x1D] << 16) | (viregs[0x1E] << 8 ) | viregs[0x1F]);
           if ( (viregs[0x1C] & 0x10) == 0x10)
               soffset <<= 5;
           soffset += 0x80000000;
           soffset -= (UInt32)((viregs[0x1C] & 0xF) << 3);

           //Dump video data
           analyze = new MemoryStream();
           Dump(soffset, soffset + sheight * swidth * 2, analyze);
           analyze.Seek(0, SeekOrigin.Begin);

           if (sheight > 600) //Progressive mode!
           {
               sheight = sheight / 2;
               swidth = swidth * 2;
           }

           Bitmap b = ProcessImage(swidth, sheight, analyze);
           analyze.Close();

           return b;
       }[/spoiler]
http://www.google.com/codesearch#HsfwLymuR-k/trunk/GeckoDotNET/Gecko%20dNet/USBGecko.cs&q=viregs%20package:http://geckowii%5C.googlecode%5C.com&l=1792
Title: Re: gecko.net screencapture
Post by: Stuff on October 01, 2011, 05:23:11 AM
I guess it would've made sense to look at the source code. >.<

I did want to be able to add screenshot functions to any game with a code. I'm sure I wasn't the first to want this. But from what everyone says, it might be too big of a code since you need to add sd card access to it. I had a thread before about the screencap on FFCC because that one is nice and can be done anywhere, if I'm not mistaken. With the extended code list it might fit. Can't the extended codelist work at the end of the main codelist? So that it could be used for more than debugging. I mean, "screencap anywhere" would be kind of useless if it needs a code that's only useful with a usbgecko. And then have "screencap anywhere" in a what's-it-called file so that it gets sent once or whatever. (not sure how that works. Just know extended code list is amazing and gecko os has unexplored functions)