mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@72 b08762b0-b915-fc4b-9d8c-17b2551a87ff
169 lines
5.2 KiB
C
169 lines
5.2 KiB
C
/*---------------------------------------------------------------------------*
|
||
Project: TwlIPL
|
||
File: ninLogoFunc.c
|
||
|
||
Copyright 2007 Nintendo. All rights reserved.
|
||
|
||
These coded instructions, statements, and computer programs contain
|
||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||
Company Ltd., and are protected by Federal copyright law. They may
|
||
not be disclosed to third parties or copied or duplicated in any form,
|
||
in whole or in part, without the prior written consent of Nintendo.
|
||
|
||
$Date:: $
|
||
$Rev$
|
||
$Author$
|
||
*---------------------------------------------------------------------------*/
|
||
|
||
#include <twl.h>
|
||
#include <sysmenu/rom_header.h>
|
||
#include <sysmenu/sysmenu_lib/ARM9/sysmenu_api.h>
|
||
|
||
// define data-----------------------------------------------------------
|
||
|
||
// extern data-----------------------------------------------------------
|
||
|
||
// function's prototype--------------------------------------------------
|
||
static void UnCompNintendoLogo2(u16 *NintendoLogoDatap, u16 *dstp, u32 *temp);
|
||
static void SVC_DiffUnFilter16_16_2(u16 *srcp,u16 *dstp);
|
||
static s32 MEMBm_InitFunc(const u8 *devicep, void *ramp, const void *paramp);
|
||
static s32 MEMBm_TerminateFunc(const u8 *devicep);
|
||
static u8 MEMBm_ByteStreamFunc(const u8 *devicep);
|
||
static u32 MEMBm_WordStreamFunc(const u8 *devicep);
|
||
|
||
|
||
// global variable-------------------------------------------------------
|
||
|
||
// static variable-------------------------------------------------------
|
||
static MIUnpackBitsParam Nin_UnPackBitsParam2 = { (8 * 8 / 2) * ( 7 * 2 ), 1, 4, 0, 0 };
|
||
|
||
// const data------------------------------------------------------------
|
||
static const u8 Nin_Char_Diff_Huff_Table2[]={
|
||
0x24,0xd4,0x00,0x00,
|
||
0x0f,0x40,0x00,0x00,0x00,0x01,0x81,0x82,0x82,0x83,0x0f,0x83,0x0c,0xc3,0x03,0x83,
|
||
0x01,0x83,0x04,0xc3,0x08,0x0e,0x02,0xc2,0x0d,0xc2,0x07,0x0b,0x06,0x0a,0x05,0x09,
|
||
};
|
||
|
||
|
||
const MIReadStreamCallbacks memb_ifp2={
|
||
MEMBm_InitFunc,
|
||
MEMBm_TerminateFunc,
|
||
MEMBm_ByteStreamFunc,
|
||
NULL,
|
||
MEMBm_WordStreamFunc,
|
||
};
|
||
|
||
|
||
// function's description--------------------------------------------
|
||
|
||
// Nintendo<64><6F><EFBFBD>S<EFBFBD>f<EFBFBD>[<5B>^<5E>̓W<CC93>J<EFBFBD><4A><EFBFBD>[<5B>`<60><><EFBFBD>iOBJ2D<32>}<7D>b<EFBFBD>v<EFBFBD><76><EFBFBD>[<5B>h<EFBFBD>œW<C593>J<EFBFBD>j
|
||
// <20><>tempBuffp<66>ɂ́A0x700byte<74>K<EFBFBD>v<EFBFBD>ł<EFBFBD><C582>B
|
||
void SYSM_LoadNintendoLogo2D( u16 *ninLogoDatap, u16 *dstp, u16 color, u32 *tempBuffp )
|
||
{
|
||
u32 work[ 0x100 / sizeof(u32) ];
|
||
|
||
Nin_UnPackBitsParam2.destOffset = color - 1;
|
||
UnCompNintendoLogo2( ninLogoDatap, (u16 *)tempBuffp, work );
|
||
MI_CpuCopyFast( (u16 *)( (u32)tempBuffp + 0 ), dstp + 0x0000 / sizeof(u16), 0x1a0 );
|
||
MI_CpuCopyFast( (u16 *)( (u32)tempBuffp + 0x1a0), dstp + 0x0400 / sizeof(u16), 0x1a0 );
|
||
}
|
||
|
||
|
||
void SYSM_LoadNintendoLogo1D( u16 *ninLogoDatap, u16 *dstp, u16 color, u32 *tempBuffp )
|
||
{
|
||
u32 work[ 0x100 / sizeof(u32) ];
|
||
|
||
Nin_UnPackBitsParam2.destOffset = color - 1;
|
||
UnCompNintendoLogo2( ninLogoDatap, (u16 *)tempBuffp, work );
|
||
MI_CpuCopyFast( (u16 *)tempBuffp, dstp, 0x340 );
|
||
}
|
||
|
||
/* UnCompNintendoLogo2<6F><32><EFBFBD>[<5B>N<EFBFBD><4E><EFBFBD><EFBFBD>
|
||
|
||
<09><><EFBFBD>z<EFBFBD>u<EFBFBD>恄 dstp(0x700) temp(0x100)
|
||
|
||
Nintendo<64><6F><EFBFBD>S<EFBFBD>{<7B>w<EFBFBD>b<EFBFBD>_ 0x0c0
|
||
<09>n<EFBFBD>t<EFBFBD>}<7D><><EFBFBD>W<EFBFBD>J<EFBFBD>o<EFBFBD>b<EFBFBD>t<EFBFBD>@ 0x200
|
||
<09>n<EFBFBD>t<EFBFBD>}<7D><><EFBFBD>W<EFBFBD>J<EFBFBD><4A><EFBFBD>̃o<CC83>b<EFBFBD>t<EFBFBD>@ 0x0d0
|
||
diff<66><66><EFBFBD>̃f<CC83>[<5B>^ 0x0d0
|
||
UnpackBits<74><73><EFBFBD>̃f<CC83>[<5B>^ 0x700
|
||
|
||
*/
|
||
|
||
//<2F>@Nintendo<64><6F><EFBFBD>S<EFBFBD>W<EFBFBD>J<EFBFBD><4A><EFBFBD>[<5B>`<60><><EFBFBD>@(r0=<3D><><EFBFBD>S<EFBFBD><53><EFBFBD>k<EFBFBD>f<EFBFBD>[<5B>^ r1=<3D>W<EFBFBD>J<EFBFBD><4A><EFBFBD>A<EFBFBD>h<EFBFBD><68><EFBFBD>X)
|
||
#include <twl/code16.h>
|
||
static asm void UnCompNintendoLogo2(u16 *NintendoLogoDatap, u16 *dstp, u32 *temp)
|
||
{
|
||
push {r0-r2,r4, lr}
|
||
|
||
ldr r0, =Nin_Char_Diff_Huff_Table2
|
||
mov r1, r2 // r1 <- temp
|
||
mov r4, r1 // r4 <- temp
|
||
mov r2, #36
|
||
bl MIi_CpuCopy16 // Nintendo<64><6F><EFBFBD>S<EFBFBD>̈<EFBFBD><CC88>k<EFBFBD>e<EFBFBD>[<5B>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>݂̂<CC82><DD82>R<EFBFBD>s<EFBFBD>[<5B><><EFBFBD>Ă<EFBFBD><C482><EFBFBD>
|
||
|
||
ldr r0, [sp, #0] // r0 <- NintendoLogoDatap
|
||
mov r2, #36
|
||
add r1, r4, r2 // r1 <- temp + 36
|
||
mov r2, #NINTENDO_LOGO_LENGTH
|
||
bl MIi_CpuCopy16 // NintendoLogoDatap<61><70><EFBFBD><EFBFBD>Nintendo<64><6F><EFBFBD>S<EFBFBD>f<EFBFBD>[<5B>^<5E>{<7B>̂<EFBFBD><CC82>R<EFBFBD>s<EFBFBD>[<5B><><EFBFBD>Ă<EFBFBD><C482><EFBFBD>
|
||
|
||
mov r0, r4 // r0 <- temp
|
||
ldr r1, [sp, #4] // r1 <- dstp
|
||
mov r2, #1
|
||
lsl r2, r2, #8
|
||
add r2, r2, r1 // r2 <- dstp + 0x100
|
||
ldr r3, =memb_ifp2 // r3 <- memb_ifp2
|
||
bl SVC_UncompressHuffmanFromDevice // <20>n<EFBFBD>t<EFBFBD>}<7D><><EFBFBD>W<EFBFBD>J
|
||
|
||
ldr r0, [sp, #4]
|
||
ldr r2, =0x0000d082
|
||
str r2, [r0,#0]
|
||
|
||
mov r1, r4 // temp
|
||
bl SVC_DiffUnFilter16_16_2 // Diff<66>W<EFBFBD>J
|
||
|
||
mov r0, r4 // temp
|
||
ldr r1, [sp, #4] // dstp
|
||
ldr r2, =Nin_UnPackBitsParam2
|
||
bl SVC_UnpackBits // <20>r<EFBFBD>b<EFBFBD>g<EFBFBD>W<EFBFBD>J
|
||
|
||
pop {r0-r2,r4, pc}
|
||
}
|
||
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD>t<EFBFBD>B<EFBFBD><42><EFBFBD>^<5E>W<EFBFBD>J<EFBFBD>V<EFBFBD>X<EFBFBD>e<EFBFBD><65><EFBFBD>R<EFBFBD>[<5B><><EFBFBD>i16Bit<69><74>16Bit<69>j (r0=Srcp, r1=Destp)
|
||
static asm void SVC_DiffUnFilter16_16_2(u16 *srcp,u16 *dstp)
|
||
{
|
||
swi 24
|
||
bx lr
|
||
}
|
||
#include <twl/codereset.h>
|
||
|
||
|
||
// ============================================================================
|
||
// <20>o<EFBFBD>C<EFBFBD>g<EFBFBD>A<EFBFBD>N<EFBFBD>Z<EFBFBD>X<EFBFBD>\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>p<EFBFBD>A<EFBFBD>N<EFBFBD>Z<EFBFBD>X<EFBFBD><58><EFBFBD>[<5B>`<60><><EFBFBD>Q
|
||
// ============================================================================
|
||
static s32 MEMBm_InitFunc(const u8 *devicep, void *ramp, const void *paramp)
|
||
{
|
||
#pragma unused(ramp)
|
||
if(paramp) return (s32)MEMBm_WordStreamFunc(devicep);
|
||
else return 0;
|
||
}
|
||
|
||
static s32 MEMBm_TerminateFunc(const u8 *devicep)
|
||
{
|
||
#pragma unused(devicep)
|
||
return 0;
|
||
}
|
||
|
||
static u8 MEMBm_ByteStreamFunc(const u8 *devicep)
|
||
{
|
||
return *devicep;
|
||
}
|
||
|
||
static u32 MEMBm_WordStreamFunc(const u8 *devicep)
|
||
{
|
||
return *(u32 *)devicep;
|
||
}
|