Skip to content

Instantly share code, notes, and snippets.

@TuxSH
Last active January 18, 2017 21:52
Show Gist options
  • Save TuxSH/430ac5099815a07456098cf16105fadc to your computer and use it in GitHub Desktop.
Save TuxSH/430ac5099815a07456098cf16105fadc to your computer and use it in GitHub Desktop.
signed int __fastcall sub_300B78(_BYTE *a1, _BYTE *a2, int a3, int screen_mode)
{
signed int result; // r0@8
signed int v5; // r3@9
signed int v6; // r1@10
u16 *v7; // r7@11
signed int v8; // r1@15
signed int v9; // r3@16
u16 v10; // r5@17
u16 *v11; // r6@17
signed int v12; // r1@7
signed int v13; // r3@21
u16 v14; // r5@22
u16 *v15; // r6@22
if ( a1 && a2 && a3 )
{
if ( screen_mode ) // interpolation needed? 0 = 256x200
{
if ( screen_mode == 1 ) // 3DS bottom screen size
{
*a1 = 5;
*a2 = 15;
v8 = 0;
do
{
v9 = 0;
while ( *a1 > v9 )
{
// symmetrical matrix if the 1st column is removed
v10 = *(&word_34A7F4[5 * v8 + 6] + v9);// text0:0034A800 DCW 0, 0x4E, 0x11D, 0x1E3, 0x1C1; 0
// text0:0034A800 DCW 0,0xFCA5,0xF8D0,0xF69D,0xF873; 5
// text0:0034A800 DCW 0, 0xD47,0x1E35,0x2F08,0x3B6F; 10
// text0:0034A800 DCW 0x4000,0x3B6F,0x2F08,0x1E35, 0xD47; 15
// text0:0034A800 DCW 0,0xF873,0xF69D,0xF8D0,0xFCA5; 20
// text0:0034A800 DCW 0, 0x1C1, 0x1E3, 0x11D, 0x4E; 25
v11 = (u16 *)(12 * v9++ + a3);
v11[v8] = v10;
}
++v8;
}
while ( v8 < 6 );
}
else if ( screen_mode == 2 ) // part of 3DS top screen size
{
*a1 = 6;
*a2 = 27;
v12 = 0;
do
{
v13 = 0;
while ( *a1 > v13 )
{
v14 = *(&word_34A7F4[6 * v12 + 36] + v13);
// text0:0034A83C DCW 0, 0, 0, 0, 0, 0; 0
// text0:0034A83C DCW 0, 0, 0, 0, 0, 0; 6
// text0:0034A83C DCW 0,0x2000,0x4000, 0,0x2000,0x4000; 12
// text0:0034A83C DCW 0x4000,0x2000, 0,0x4000,0x2000, 0; 18
// text0:0034A83C DCW 0, 0, 0, 0, 0, 0; 24
// text0:0034A83C DCW 0, 0, 0, 0, 0, 0; 30
v15 = (u16 *)(12 * v13++ + a3);
v15[v12] = v14;
}
++v12;
}
while ( v12 < 6 );
}
}
else
{
*a1 = 4;
v5 = 0;
*a2 = 15;
do
{
v6 = 0;
while ( *a1 > v6 )
{
v7 = (u16 *)(12 * v6++ + a3);
v7[v5] = word_34A7F4[v5]; // 0, 0, 0,0x4000, 0, 0
}
++v5;
}
while ( v5 < 6 );
}
result = 1;
}
else
{
result = 0;
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment