Created
May 6, 2016 20:46
-
-
Save TuxSH/ea0a4c4f014b55792a14bc8bc44a281f to your computer and use it in GitHub Desktop.
screenshots
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// taken from d9wip | |
#define TOP_SCREEN0 (u8*)(*(u32*)0x23FFFE00) | |
#define TOP_SCREEN1 (u8*)(*(u32*)0x23FFFE00) | |
#define BOT_SCREEN0 (u8*)(*(u32*)0x23FFFE08) | |
void Screenshot(const char* path) | |
{ | |
u8* buffer = (u8*) 0x21000054; // careful, this area is used by other functions in Decrypt9 | |
u8* buffer_t = buffer + 54 + (400 * 240 * 3); | |
u8 bmp_header[54] = { | |
0x42, 0x4D, 0x36, 0xCA, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, | |
0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, | |
0x00, 0x00, 0x00, 0xCA, 0x08, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x00, 0x00, | |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | |
}; | |
memcpy(buffer, bmp_header, 54); | |
buffer += 54; | |
for(u32 i = 0; i < 400 * 240 * 3 * 2; i++) buffer[i] = 0x1F; | |
for (u32 x = 0; x < 400; x++) | |
for (u32 y = 0; y < 240; y++) | |
memcpy(buffer_t + (y*400 + x) * 3, TOP_SCREEN0 + (x*240 + y) * 3, 3); | |
for (u32 x = 0; x < 320; x++) | |
for (u32 y = 0; y < 240; y++) | |
memcpy(buffer + (y*400 + x + 40) * 3, BOT_SCREEN0 + (x*240 + y) * 3, 3); | |
fileWrite(buffer - 54, path, 54 + 400 * 240 * 3 * 2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment