From 6c92e276eb07920d6cdc241b900a6f5a2175dc58 Mon Sep 17 00:00:00 2001 From: yoshida_teruhisa Date: Tue, 29 Jan 2008 06:52:05 +0000 Subject: [PATCH] =?UTF-8?q?TWL=E3=82=A2=E3=83=8B=E3=83=A1=E3=83=BC?= =?UTF-8?q?=E3=82=B7=E3=83=A7=E3=83=B3=E3=83=90=E3=83=8A=E3=83=BC=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C=E3=81=AE=E4=B8=8B=E6=BA=96=E5=82=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@535 b08762b0-b915-fc4b-9d8c-17b2551a87ff --- .../sysmenu/ARM9/src/banner.c | 4 +- build/systemMenu_RED/Launcher/ARM9/Makefile | 2 +- .../Launcher/ARM9/src/bannerCounter.c | 59 +++++++++++++ .../Launcher/ARM9/src/bannerCounter.h | 82 +++++++++++++++++++ .../Launcher/ARM9/src/launcher.c | 40 +++++++-- build/systemMenu_RED/misc/src/misc.c | 4 +- include/sysmenu.h | 2 +- .../sysmenu/sysmenu_lib/ARM9/sysmenu_api.h | 2 +- 8 files changed, 182 insertions(+), 13 deletions(-) create mode 100644 build/systemMenu_RED/Launcher/ARM9/src/bannerCounter.c create mode 100644 build/systemMenu_RED/Launcher/ARM9/src/bannerCounter.h diff --git a/build/libraries_sysmenu/sysmenu/ARM9/src/banner.c b/build/libraries_sysmenu/sysmenu/ARM9/src/banner.c index b848b23c..2d239f7b 100644 --- a/build/libraries_sysmenu/sysmenu/ARM9/src/banner.c +++ b/build/libraries_sysmenu/sysmenu/ARM9/src/banner.c @@ -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++ ) { diff --git a/build/systemMenu_RED/Launcher/ARM9/Makefile b/build/systemMenu_RED/Launcher/ARM9/Makefile index c8072c6f..a6a11b2e 100644 --- a/build/systemMenu_RED/Launcher/ARM9/Makefile +++ b/build/systemMenu_RED/Launcher/ARM9/Makefile @@ -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 diff --git a/build/systemMenu_RED/Launcher/ARM9/src/bannerCounter.c b/build/systemMenu_RED/Launcher/ARM9/src/bannerCounter.c new file mode 100644 index 00000000..179c3f63 --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/src/bannerCounter.c @@ -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; +} + diff --git a/build/systemMenu_RED/Launcher/ARM9/src/bannerCounter.h b/build/systemMenu_RED/Launcher/ARM9/src/bannerCounter.h new file mode 100644 index 00000000..85a1df89 --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/src/bannerCounter.h @@ -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 +#include + +#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__ diff --git a/build/systemMenu_RED/Launcher/ARM9/src/launcher.c b/build/systemMenu_RED/Launcher/ARM9/src/launcher.c index 8a95c0d6..5b0fa852 100644 --- a/build/systemMenu_RED/Launcher/ARM9/src/launcher.c +++ b/build/systemMenu_RED/Launcher/ARM9/src/launcher.c @@ -18,6 +18,7 @@ #include #include "misc.h" #include "launcher.h" +#include "bannerCounter.h" #include "sound.h" #include @@ -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; lh.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;lv1.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 ); diff --git a/build/systemMenu_RED/misc/src/misc.c b/build/systemMenu_RED/misc/src/misc.c index ba358cfd..83c47f27 100644 --- a/build/systemMenu_RED/misc/src/misc.c +++ b/build/systemMenu_RED/misc/src/misc.c @@ -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 diff --git a/include/sysmenu.h b/include/sysmenu.h index 8c79925c..087e5413 100644 --- a/include/sysmenu.h +++ b/include/sysmenu.h @@ -26,9 +26,9 @@ #include #include #include +#include #include #include -#include #include #include #include diff --git a/include/sysmenu/sysmenu_lib/ARM9/sysmenu_api.h b/include/sysmenu/sysmenu_lib/ARM9/sysmenu_api.h index 5e04d7d3..b4b0eb02 100644 --- a/include/sysmenu/sysmenu_lib/ARM9/sysmenu_api.h +++ b/include/sysmenu/sysmenu_lib/ARM9/sysmenu_api.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include