mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
TWLアニメーションバナー対応の下準備
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@535 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
d3ce60c97e
commit
6c92e276eb
@ -79,7 +79,7 @@ static BOOL SYSMi_CheckBannerFile( NTRBannerFile *pBanner )
|
||||
BOOL retval = TRUE;
|
||||
u16 calc_crc = 0xffff;
|
||||
u16 *pHeaderCRC = (u16 *)&pBanner->h.crc16_v1;
|
||||
BannerCheckParam bannerCheckList[ NTR_BNR_VER_MAX ];
|
||||
BannerCheckParam bannerCheckList[ BANNER_VER_NTR_MAX ];
|
||||
BannerCheckParam *pChk = &bannerCheckList[ 0 ];
|
||||
|
||||
bannerCheckList[ 0 ].pSrc = (u8 *)&( pBanner->v1 );
|
||||
@ -89,7 +89,7 @@ static BOOL SYSMi_CheckBannerFile( NTRBannerFile *pBanner )
|
||||
bannerCheckList[ 2 ].pSrc = (u8 *)&( pBanner->v3 );
|
||||
bannerCheckList[ 2 ].size = sizeof( BannerFileV3 );
|
||||
|
||||
for( i = 0; i < NTR_BNR_VER_MAX; i++ ) {
|
||||
for( i = 0; i < BANNER_VER_NTR_MAX; i++ ) {
|
||||
if( i < pBanner->h.version ) {
|
||||
calc_crc = SVC_GetCRC16( calc_crc, pChk->pSrc, pChk->size );
|
||||
if( calc_crc != *pHeaderCRC++ ) {
|
||||
|
||||
@ -46,7 +46,7 @@ MISC_DIR = ../../misc
|
||||
BG_DIR = ../../data
|
||||
|
||||
SRCS_LOGO = logoDemo.c logoData.c
|
||||
SRCS = main.c launcher.c sound.c\
|
||||
SRCS = main.c launcher.c sound.c bannerCounter.c \
|
||||
$(addprefix $(LOGO_DIR)/, $(SRCS_LOGO)) \
|
||||
$(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c \
|
||||
$(BG_DIR)/BGData_Launcher.c
|
||||
|
||||
59
build/systemMenu_RED/Launcher/ARM9/src/bannerCounter.c
Normal file
59
build/systemMenu_RED/Launcher/ARM9/src/bannerCounter.c
Normal file
@ -0,0 +1,59 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlIPL
|
||||
File: launcher.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:: 2008-01-29#$
|
||||
$Rev: 533 $
|
||||
$Author: yoshida_teruhisa $
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "bannerCounter.h"
|
||||
|
||||
// define data------------------------------------------
|
||||
|
||||
// extern data------------------------------------------
|
||||
|
||||
// function's prototype declaration---------------------
|
||||
|
||||
// global variable -------------------------------------
|
||||
|
||||
// static variable -------------------------------------
|
||||
|
||||
// const data -----------------------------------------
|
||||
|
||||
//===============================================
|
||||
// bannerCounter.c
|
||||
//===============================================
|
||||
|
||||
FrameAnimeData BNC_getFAD( BannerCounter *c )
|
||||
{
|
||||
FrameAnimeData ret;
|
||||
if( c->banner->h.platform == BANNER_PLATFORM_NTR )
|
||||
{
|
||||
ret.image = c->banner->v1.image;
|
||||
ret.pltt = c->banner->v1.pltt;
|
||||
ret.vflip = FALSE;
|
||||
ret.hflip = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO:TWLアニメーションバナーのデータを読んでフレームのデータを返す
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
FrameAnimeData BNC_getFADAndIncCount( BannerCounter *c )
|
||||
{
|
||||
FrameAnimeData ret = BNC_getFAD( c );
|
||||
BNC_incrementCount( c );
|
||||
return ret;
|
||||
}
|
||||
|
||||
82
build/systemMenu_RED/Launcher/ARM9/src/bannerCounter.h
Normal file
82
build/systemMenu_RED/Launcher/ARM9/src/bannerCounter.h
Normal file
@ -0,0 +1,82 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlIPL
|
||||
File: bannerCounter.h
|
||||
|
||||
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:: 2007-11-20#$
|
||||
$Rev: 231 $
|
||||
$Author: yoshida_teruhisa $
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __BANNERCOUNTER_H__
|
||||
#define __BANNERCOUNTER_H__
|
||||
|
||||
#include <twl.h>
|
||||
#include <sysmenu.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// define data-------------------------------------------------------
|
||||
|
||||
typedef struct BannerCounter
|
||||
{
|
||||
u32 count;
|
||||
TWLBannerFile *banner;
|
||||
}
|
||||
BannerCounter;
|
||||
|
||||
typedef struct FrameAnimeData{
|
||||
u8 *image;
|
||||
u8 *pltt;
|
||||
BOOL vflip;
|
||||
BOOL hflip;
|
||||
}
|
||||
FrameAnimeData;
|
||||
|
||||
// global variables--------------------------------------------------
|
||||
|
||||
// function----------------------------------------------------------
|
||||
|
||||
static inline void BNC_resetCount( BannerCounter *c )
|
||||
{
|
||||
c->count = 0;
|
||||
}
|
||||
|
||||
static inline void BNC_initCounter( BannerCounter *c, TWLBannerFile *b)
|
||||
{
|
||||
c->banner = b;
|
||||
c->count = 0;
|
||||
}
|
||||
|
||||
static inline void BNC_setBanner( BannerCounter *c, TWLBannerFile *b)
|
||||
{
|
||||
c->banner = b;
|
||||
}
|
||||
|
||||
static inline TWLBannerFile* BNC_getBanner( BannerCounter *c )
|
||||
{
|
||||
return c->banner;
|
||||
}
|
||||
|
||||
static inline void BNC_incrementCount( BannerCounter *c )
|
||||
{
|
||||
c->count++;
|
||||
}
|
||||
|
||||
FrameAnimeData BNC_getFAD( BannerCounter *c );
|
||||
FrameAnimeData BNC_getFADAndIncCount( BannerCounter *c );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __BANNERCOUNTER_H__
|
||||
@ -18,6 +18,7 @@
|
||||
#include <twl.h>
|
||||
#include "misc.h"
|
||||
#include "launcher.h"
|
||||
#include "bannerCounter.h"
|
||||
#include "sound.h"
|
||||
#include <math.h>
|
||||
|
||||
@ -98,8 +99,6 @@ static int s_csr = 0; //
|
||||
// 移動するのに必要なフレーム数で表すための変数
|
||||
static int csr_v = 0; // s_csrの速度的変数
|
||||
|
||||
static u64 old_titleIdArray[ LAUNCHER_TITLE_LIST_NUM ];
|
||||
|
||||
static TWLBannerFile *empty_banner;
|
||||
static TWLBannerFile *nobanner_banner;
|
||||
static TWLBannerFile *no_card_banner;
|
||||
@ -108,6 +107,7 @@ static int selected = 0;
|
||||
static int bar_left = BAR_ZERO_X;
|
||||
static fx32 s_selected_banner_size;
|
||||
static BOOL s_wavstop = FALSE;
|
||||
static BannerCounter banner_counter[LAUNCHER_TITLE_LIST_NUM];
|
||||
|
||||
//static StreamInfo strm; // stream info
|
||||
|
||||
@ -144,11 +144,16 @@ static void BannerInit( void )
|
||||
int l;
|
||||
LoadBannerFiles();
|
||||
|
||||
MI_CpuClearFast(old_titleIdArray, sizeof(old_titleIdArray) );
|
||||
MI_DmaFill32(3, banner_oam_attr, 192, sizeof(banner_oam_attr)); // let out of the screen if not display
|
||||
|
||||
// OBJModeの設定
|
||||
GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_128K); // 2D mapping mode
|
||||
|
||||
// BannerCounterの初期化
|
||||
for( l=0; l<LAUNCHER_TITLE_LIST_NUM; l++ )
|
||||
{
|
||||
BNC_initCounter( &banner_counter[l], empty_banner);
|
||||
}
|
||||
|
||||
//OBJATTRの初期化……表示前には値を弄る
|
||||
for(l=0;l<MAX_SHOW_BANNER;l++)
|
||||
@ -218,6 +223,24 @@ static void SetAffineAnimation( int cursor )
|
||||
G2_SetOBJAffine((GXOamAffine *)(&banner_oam_attr[4]), &mtx);
|
||||
}
|
||||
|
||||
static void SetBannerCounter( TitleProperty *titleprop )
|
||||
{
|
||||
int l;
|
||||
for( l=0; l<LAUNCHER_TITLE_LIST_NUM; l++ )
|
||||
{
|
||||
// nandも一応毎回セット
|
||||
BNC_setBanner( &banner_counter[l], titleprop[l].pBanner);
|
||||
if( l==0 )
|
||||
{
|
||||
// カードの場合、バナーヘッダのv1のCRCが違ったらカウントをリセット
|
||||
if ( BNC_getBanner( &banner_counter[l] )->h.crc16_v1 != titleprop[l].pBanner->h.crc16_v1)
|
||||
{
|
||||
BNC_resetCount( &banner_counter[l] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// バナー関係の描画
|
||||
// 思ったよりVRAMへのロードが高速だったので、
|
||||
// 特に難しいことを考えず表示するイメージデータだけ毎フレームVRAMにロード
|
||||
@ -234,19 +257,24 @@ static void BannerDraw(int cursor, int selected, TitleProperty *titleprop)
|
||||
|
||||
// アフィンパラメータだけ先に設定しておく
|
||||
SetAffineAnimation( cursor );
|
||||
|
||||
// バナーカウンタのバナーセット
|
||||
SetBannerCounter( titleprop );
|
||||
|
||||
// OAMデータ設定
|
||||
for (l=0;l<MAX_SHOW_BANNER;l++)
|
||||
{
|
||||
int num = div1 - 2 + l;
|
||||
if(-1 < num && num < LAUNCHER_TITLE_LIST_NUM){
|
||||
// バナーカウンタからフレームデータを取得し、カウンタをインクリメント
|
||||
FrameAnimeData fad = BNC_getFADAndIncCount( &banner_counter[num] );
|
||||
|
||||
// パレットのロード
|
||||
GX_LoadOBJPltt( titleprop[num].pBanner->v1.pltt, (u16)(l * BNR_PLTT_SIZE), BNR_PLTT_SIZE );
|
||||
GX_LoadOBJPltt( fad.pltt, (u16)(l * BANNER_PLTT_SIZE), BANNER_PLTT_SIZE );
|
||||
G2_SetOBJMode(&banner_oam_attr[l], GX_OAM_MODE_NORMAL, l);
|
||||
|
||||
// バナー画像のロード
|
||||
GX_LoadOBJ(((TWLBannerFile *)titleprop[num].pBanner)->v1.image, (u32)l*BNR_IMAGE_SIZE , BNR_IMAGE_SIZE);
|
||||
GX_LoadOBJ( fad.image, (u32)l*BANNER_IMAGE_SIZE , BANNER_IMAGE_SIZE);
|
||||
|
||||
// 表示画像の設定、キャラクタネーム境界128バイトである事に注意
|
||||
banner_oam_attr[l].charNo = l*4;
|
||||
@ -275,7 +303,7 @@ static void BannerDraw(int cursor, int selected, TitleProperty *titleprop)
|
||||
// アプリ名表示
|
||||
if(selected != old_selected)
|
||||
{
|
||||
NNSG2dChar *str = ((TWLBannerFile *)titleprop[selected].pBanner)->v1.comment[ LCFG_TSD_GetLanguage() ];
|
||||
NNSG2dChar *str = ((TWLBannerFile *)titleprop[selected].pBanner)->v1.gameName[ LCFG_TSD_GetLanguage() ];
|
||||
NNSG2dTextRect rect = NNS_G2dTextCanvasGetTextRect( &gTextCanvas, str );
|
||||
NNS_G2dCharCanvasClearArea( &gCanvas, TXT_COLOR_NULL, 0, 24, WINDOW_WIDTH, 32 );
|
||||
PutStringUTF16( (WINDOW_WIDTH-rect.width)>>1, TITLE_V_CENTER - (rect.height>>1), TXT_COLOR_BLACK, str );
|
||||
|
||||
@ -664,8 +664,8 @@ BOOL WithinRangeTP( int top_x, int top_y, int bottom_x, int bottom_y, TPData *tg
|
||||
// バナーアイコンOBJのロード
|
||||
void SetBannerIconOBJ( GXOamAttr *pDstOAM, BannerFileV1 *bannerp )
|
||||
{
|
||||
GXS_LoadOBJPltt( bannerp->pltt, 15, BNR_PLTT_SIZE );
|
||||
MI_CpuCopyFast( bannerp->image, (void *)(HW_DB_OBJ_VRAM + 0x20), BNR_IMAGE_SIZE );
|
||||
GXS_LoadOBJPltt( bannerp->pltt, 15, BANNER_PLTT_SIZE );
|
||||
MI_CpuCopyFast( bannerp->image, (void *)(HW_DB_OBJ_VRAM + 0x20), BANNER_IMAGE_SIZE );
|
||||
G2_SetOBJAttr( pDstOAM, // OAM pointer
|
||||
32, // X position
|
||||
32, // Y position
|
||||
|
||||
@ -26,9 +26,9 @@
|
||||
#include <twl.h>
|
||||
#include <twl/os/common/format_rom.h>
|
||||
#include <twl/hw/common/mmap_parameter.h>
|
||||
#include <twl/os/common/banner.h>
|
||||
#include <twl/lcfg.h>
|
||||
#include <sysmenu/sysmenu_lib.h>
|
||||
#include <sysmenu/banner.h>
|
||||
#include <sysmenu/boot.h>
|
||||
#include <sysmenu/memorymap.h>
|
||||
#include <sysmenu/hotsw.h>
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
#include <twl.h>
|
||||
#include <twl/nam.h>
|
||||
#include <twl/os/common/format_rom.h>
|
||||
#include <sysmenu/banner.h>
|
||||
#include <twl/os/common/banner.h>
|
||||
#include <sysmenu/sysmenu_lib/common/sysmenu_work.h>
|
||||
#include <sysmenu/reloc_info/common/reloc_info.h>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user