It's interesting because it exploits the same flaw used by 3dsavetool to decrypt saves.
To work, you'll need to take completely black photos, in order to know the value at a given spot in the image.
In fact, each photo number has its own key, and taking photos with the same number as the photos to decrypt lets you decrypt the pair of photos each time, using the same key.
Here's the source code:
Spoiler
/*********************************************
* Dead Or Alive: Dimensions Photo Decrypter *
*********************************************
* instructions: *
* - make photos in showcase mode if you *
* haven't *
* - find your dead or alive folder in *
* extdata on SD card. if you made photos *
* it should have folder 00000000 with *
* files with size of 400416B inside. EU *
* version is 0000038a *
* - move it off the sd card to your pc *
* - disable wireless switch on 3ds so no *
* DLC is received while you screw around *
* - check how many files there are in *
* the folder you put on your pc *
* - start the game, create new SD data *
* - go to showcase mode, set stage to *
* training stage and choose crouching *
* hayabusa figure *
* - make as many completely black pictures *
* of the background, as you have files in *
* the folder on your pc, with 3d switched *
* on. it is important that only black is *
* on your pictures!! *
* - switch off 3ds and remove SD card *
* - move the new folder to your pc, but do *
* NOT overwrite the original *
* - copy original back to the SD card *
* - you can switch wifi back on and play *
* - now you can decrypt. take picture files *
* with the same filename from both *
* folders. pictures are 400416B *
* - in cmd.exe, call: *
* doadpd.exe blackfile originalfile *
* - if black file was black and both files *
* have the same number, you should have *
* originalfile.l.tga and *
* originalfile.r.tga in same folder now *
* - you can open tga with GIMP to convert *
* to PNG or JPEG *
* https://www.gimp.org/ *
* - if you want, you can even make MPO file *
* with software called StereoPhoto Maker *
* so you can view in 3D: *
* https://stereo.jpn.org/eng/stphmkr/ *
* - if you can code, feel free to make *
* better program *
* no warranty, if you screw up and lose DLC *
* it's on you *
*********************************************
* _ _ _____ _____ _ _____ *
* / |/ \/ __// __// \ / __/ *
* | || || | _| | _| | | \ *
* /\_| || || |_//| |_//| |_/\| / *
* \____/\_/\____\\____\\____/\____\ *
* let's rock *
*********************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int
main (int argc, char *argv[])
{
unsigned short t[240][400];
unsigned int z[240][400];
unsigned short *i = malloc (384000);
unsigned short c[192000];
unsigned short b[8][8];
char *f[2];
int x, y, k, j, l;
FILE *hnd;
if (argc != 3)
{
printf ("needs two filenames");
return (0);
}
hnd = fopen (argv[1], "rb");
fseek (hnd, 16416, 0);
fread (c, 1, 384000, hnd);
fclose (hnd);
hnd = fopen (argv[2], "rb");
fseek (hnd, 16416, 0);
fread (i, 1, 384000, hnd);
fclose (hnd);
for (j = 0; j < 192000; j++)
{
i[j] = i[j] ^ c[j];
}
l = strlen (argv[2]);
f[0] = malloc (l + 7);
f[1] = malloc (l + 7);
strncpy (f[0], argv[2], l);
strncpy (f[1], argv[2], l);
strncpy (f[0] + l, ".l.tga", 7);
strncpy (f[1] + l, ".r.tga", 7);
for (k = 0; k < 2; k++)
{
for (x = 0; x < 400; x += 8)
{
for (y = 0; y < 240; y += 8)
{
for (j = 0; j < 8; j += 4)
{
t[y][x + j] = *i++;
t[y + 1][x + j] = *i++;
t[y][x + j + 1] = *i++;
t[y + 1][x + j + 1] = *i++;
t[y + 2][x + j] = *i++;
t[y + 3][x + j] = *i++;
t[y + 2][x + j + 1] = *i++;
t[y + 3][x + j + 1] = *i++;
t[y][x + j + 2] = *i++;
t[y + 1][x + j + 2] = *i++;
t[y][x + j + 3] = *i++;
t[y + 1][x + j + 3] = *i++;
t[y + 2][x + j + 2] = *i++;
t[y + 3][x + j + 2] = *i++;
t[y + 2][x + j + 3] = *i++;
t[y + 3][x + j + 3] = *i++;
t[y + 4][x + j] = *i++;
t[y + 5][x + j] = *i++;
t[y + 4][x + j + 1] = *i++;
t[y + 5][x + j + 1] = *i++;
t[y + 6][x + j] = *i++;
t[y + 7][x + j] = *i++;
t[y + 6][x + j + 1] = *i++;
t[y + 7][x + j + 1] = *i++;
t[y + 4][x + j + 2] = *i++;
t[y + 5][x + j + 2] = *i++;
t[y + 4][x + j + 3] = *i++;
t[y + 5][x + j + 3] = *i++;
t[y + 6][x + j + 2] = *i++;
t[y + 7][x + j + 2] = *i++;
t[y + 6][x + j + 3] = *i++;
t[y + 7][x + j + 3] = *i++;
}
}
}
hnd = fopen (f[k], "wb");
fwrite ("\0\0\2\0\0\0\0\020\0\0\0\0\220\01\360\0\40\0", 1, 18, hnd);
for (x = 0; x < 400; x++)
{
for (y = 0; y < 240; y++)
{
z[y][x] =
(t[y][x] & 0x1F) << 3 | (t[y][x] & 0x7E0) << 5 | (t[y][x] &
0xF800) << 8
| 0xFF000000;
}
}
fwrite (z, 4, 96000, hnd);
fclose (hnd);
}
return (0);
}
* Dead Or Alive: Dimensions Photo Decrypter *
*********************************************
* instructions: *
* - make photos in showcase mode if you *
* haven't *
* - find your dead or alive folder in *
* extdata on SD card. if you made photos *
* it should have folder 00000000 with *
* files with size of 400416B inside. EU *
* version is 0000038a *
* - move it off the sd card to your pc *
* - disable wireless switch on 3ds so no *
* DLC is received while you screw around *
* - check how many files there are in *
* the folder you put on your pc *
* - start the game, create new SD data *
* - go to showcase mode, set stage to *
* training stage and choose crouching *
* hayabusa figure *
* - make as many completely black pictures *
* of the background, as you have files in *
* the folder on your pc, with 3d switched *
* on. it is important that only black is *
* on your pictures!! *
* - switch off 3ds and remove SD card *
* - move the new folder to your pc, but do *
* NOT overwrite the original *
* - copy original back to the SD card *
* - you can switch wifi back on and play *
* - now you can decrypt. take picture files *
* with the same filename from both *
* folders. pictures are 400416B *
* - in cmd.exe, call: *
* doadpd.exe blackfile originalfile *
* - if black file was black and both files *
* have the same number, you should have *
* originalfile.l.tga and *
* originalfile.r.tga in same folder now *
* - you can open tga with GIMP to convert *
* to PNG or JPEG *
* https://www.gimp.org/ *
* - if you want, you can even make MPO file *
* with software called StereoPhoto Maker *
* so you can view in 3D: *
* https://stereo.jpn.org/eng/stphmkr/ *
* - if you can code, feel free to make *
* better program *
* no warranty, if you screw up and lose DLC *
* it's on you *
*********************************************
* _ _ _____ _____ _ _____ *
* / |/ \/ __// __// \ / __/ *
* | || || | _| | _| | | \ *
* /\_| || || |_//| |_//| |_/\| / *
* \____/\_/\____\\____\\____/\____\ *
* let's rock *
*********************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int
main (int argc, char *argv[])
{
unsigned short t[240][400];
unsigned int z[240][400];
unsigned short *i = malloc (384000);
unsigned short c[192000];
unsigned short b[8][8];
char *f[2];
int x, y, k, j, l;
FILE *hnd;
if (argc != 3)
{
printf ("needs two filenames");
return (0);
}
hnd = fopen (argv[1], "rb");
fseek (hnd, 16416, 0);
fread (c, 1, 384000, hnd);
fclose (hnd);
hnd = fopen (argv[2], "rb");
fseek (hnd, 16416, 0);
fread (i, 1, 384000, hnd);
fclose (hnd);
for (j = 0; j < 192000; j++)
{
i[j] = i[j] ^ c[j];
}
l = strlen (argv[2]);
f[0] = malloc (l + 7);
f[1] = malloc (l + 7);
strncpy (f[0], argv[2], l);
strncpy (f[1], argv[2], l);
strncpy (f[0] + l, ".l.tga", 7);
strncpy (f[1] + l, ".r.tga", 7);
for (k = 0; k < 2; k++)
{
for (x = 0; x < 400; x += 8)
{
for (y = 0; y < 240; y += 8)
{
for (j = 0; j < 8; j += 4)
{
t[y][x + j] = *i++;
t[y + 1][x + j] = *i++;
t[y][x + j + 1] = *i++;
t[y + 1][x + j + 1] = *i++;
t[y + 2][x + j] = *i++;
t[y + 3][x + j] = *i++;
t[y + 2][x + j + 1] = *i++;
t[y + 3][x + j + 1] = *i++;
t[y][x + j + 2] = *i++;
t[y + 1][x + j + 2] = *i++;
t[y][x + j + 3] = *i++;
t[y + 1][x + j + 3] = *i++;
t[y + 2][x + j + 2] = *i++;
t[y + 3][x + j + 2] = *i++;
t[y + 2][x + j + 3] = *i++;
t[y + 3][x + j + 3] = *i++;
t[y + 4][x + j] = *i++;
t[y + 5][x + j] = *i++;
t[y + 4][x + j + 1] = *i++;
t[y + 5][x + j + 1] = *i++;
t[y + 6][x + j] = *i++;
t[y + 7][x + j] = *i++;
t[y + 6][x + j + 1] = *i++;
t[y + 7][x + j + 1] = *i++;
t[y + 4][x + j + 2] = *i++;
t[y + 5][x + j + 2] = *i++;
t[y + 4][x + j + 3] = *i++;
t[y + 5][x + j + 3] = *i++;
t[y + 6][x + j + 2] = *i++;
t[y + 7][x + j + 2] = *i++;
t[y + 6][x + j + 3] = *i++;
t[y + 7][x + j + 3] = *i++;
}
}
}
hnd = fopen (f[k], "wb");
fwrite ("\0\0\2\0\0\0\0\020\0\0\0\0\220\01\360\0\40\0", 1, 18, hnd);
for (x = 0; x < 400; x++)
{
for (y = 0; y < 240; y++)
{
z[y][x] =
(t[y][x] & 0x1F) << 3 | (t[y][x] & 0x7E0) << 5 | (t[y][x] &
0xF800) << 8
| 0xFF000000;
}
}
fwrite (z, 4, 96000, hnd);
fclose (hnd);
}
return (0);
}
This content is for members only. Log in or register for free to see it.
Source