From 9d4ac30b6a22cdd6c705bde9b188f2ca5615b406 Mon Sep 17 00:00:00 2001 From: kamikawa Date: Wed, 23 Apr 2008 08:21:13 +0000 Subject: [PATCH] =?UTF-8?q?=E3=83=8F=E3=83=BC=E3=83=89=E3=82=A6=E3=82=A7?= =?UTF-8?q?=E3=82=A2=E6=83=85=E5=A0=B1=E3=82=92=E6=9B=B8=E3=81=8D=E8=BE=BC?= =?UTF-8?q?=E3=82=81=E3=81=A6=E3=81=84=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F?= =?UTF-8?q?=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=82=EF=BC=88=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=E3=82=B3=E3=83=9F=E3=83=83=E3=83=88=E3=81=97=E5=BF=98?= =?UTF-8?q?=E3=82=8C=EF=BC=89?= 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@1243 b08762b0-b915-fc4b-9d8c-17b2551a87ff --- .../SystemUpdater/ARM9.TWL/include/hw_info.h | 83 ++++++++ .../SystemUpdater/ARM9.TWL/src/hw_info.c | 188 ++++++++++++++++++ 2 files changed, 271 insertions(+) create mode 100644 build/systemMenu_RED/SystemUpdater/ARM9.TWL/include/hw_info.h create mode 100644 build/systemMenu_RED/SystemUpdater/ARM9.TWL/src/hw_info.c diff --git a/build/systemMenu_RED/SystemUpdater/ARM9.TWL/include/hw_info.h b/build/systemMenu_RED/SystemUpdater/ARM9.TWL/include/hw_info.h new file mode 100644 index 00000000..33dddbb3 --- /dev/null +++ b/build/systemMenu_RED/SystemUpdater/ARM9.TWL/include/hw_info.h @@ -0,0 +1,83 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_hw_info.h + + Copyright 2008 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$ + *---------------------------------------------------------------------------*/ + +#ifndef HW_INFO_H_ +#define HW_INFO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: HW情報全体のライト + + Description: + + Arguments: region : + wirelessForceOff : 無線強制OFFならTRUEを指定 + + Returns: None. + *---------------------------------------------------------------------------*/ +BOOL WriteHWInfoFile( u8 region, BOOL wirelessForceOff ); + + +/*---------------------------------------------------------------------------* + Name: HWInfoファイルの削除 + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +BOOL DeleteHWInfoFile( void ); + +/*---------------------------------------------------------------------------* + Name: UpdateNandBoxCount + + Description: InstalledSoftBoxCount, FreeSoftBoxCount の値を + 現在のNANDの状態に合わせて更新します。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void UpdateNandBoxCount( void ); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* HW_INFO_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_RED/SystemUpdater/ARM9.TWL/src/hw_info.c b/build/systemMenu_RED/SystemUpdater/ARM9.TWL/src/hw_info.c new file mode 100644 index 00000000..33f22972 --- /dev/null +++ b/build/systemMenu_RED/SystemUpdater/ARM9.TWL/src/hw_info.c @@ -0,0 +1,188 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - SystemUpdater + File: hw_info.c + + Copyright 2008 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 +#include +#include +#include +#include +#include +#include "kami_font.h" +#include "kami_pxi.h" +#include "hwi.h" +#include "hw_info.h" +// +#include "TWLHWInfo_api.h" +#include "TWLSettings_api.h" +// +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +BOOL WriteHWNormalInfoFile( void ); +BOOL WriteHWSecureInfoFile( u8 region ); +BOOL DeleteHWInfoFile( void ); + +/*---------------------------------------------------------------------------* + Name: HW情報全体のライト + + Description: + + Arguments: region : + + Returns: None. + *---------------------------------------------------------------------------*/ + +BOOL WriteHWInfoFile( u8 region, BOOL wirelessForceOff ) +{ + static const char *pMsgNormalWriting = "Writing Normal File..."; + static const char *pMsgSecureWriting = "Writing Secure File..."; + static const char *pMsgSignWriting = "Writing Sign File..."; + static const char *pMsgSucceeded = "Success!\n"; + static const char *pMsgFailed = "Failed!\n"; + u32 installedSoftBoxCount = 0; + BOOL result = TRUE; + + // ノーマルファイルのライト + if( HWI_WriteHWNormalInfoFile() ) { +// kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + // セキュアファイルのライト + if( HWI_WriteHWSecureInfoFile( region, NULL, wirelessForceOff ) ) { // とりあえず無線は有効で。 +// kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + // HWID署名ファイルのライト + if( HWI_WriteHWIDSignFile() ) { +// kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + // CFGデータの修正 + if (!HWI_ModifyLanguage( region )) + { + kamiFontPrintfConsoleEx(CONSOLE_RED, "Fail! Write TWLSettings\n" ); + result = FALSE; + } + + // InstalledSoftBoxCount, FreeSoftBoxCount の値を現在のNANDの状態に合わせて更新します。 + UpdateNandBoxCount(); + + return result; +} + +/*---------------------------------------------------------------------------* + Name: HWInfoファイルの削除 + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ + +BOOL DeleteHWInfoFile( void ) +{ + static const char *pMsgNormalDeleting = "Deleting Normal File..."; + static const char *pMsgSecureDeleting = "Deteting Secure File..."; + static const char *pMsgSucceeded = "Success!\n"; + static const char *pMsgFailed = "Failed!\n"; + BOOL result = TRUE; + + // ノーマルファイル + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgNormalDeleting ); + if( HWI_DeleteHWNormalInfoFile() ) { + OS_TPrintf( "%s delete succeeded.\n", (char *)LCFG_TWL_HWINFO_NORMAL_PATH ); + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + OS_TPrintf( "%s delete failed.\n", (char *)LCFG_TWL_HWINFO_NORMAL_PATH ); + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + // セキュアファイル + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSecureDeleting ); + if( HWI_DeleteHWSecureInfoFile() ) { + OS_TPrintf( "%s delete succeeded.\n", (char *)LCFG_TWL_HWINFO_SECURE_PATH ); + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + OS_TPrintf( "%s delete failed.\n", (char *)LCFG_TWL_HWINFO_SECURE_PATH ); + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + return result; +} + +/*---------------------------------------------------------------------------* + Name: UpdateNandBoxCount + + Description: InstalledSoftBoxCount, FreeSoftBoxCount の値を + 現在のNANDの状態に合わせて更新します。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ + +void UpdateNandBoxCount( void ) +{ + u32 installedSoftBoxCount; + u32 freeSoftBoxCount; + + // InstalledSoftBoxCount, FreeSoftBoxCount を数えなおす + installedSoftBoxCount = NAMUT_SearchInstalledSoftBoxCount(); + freeSoftBoxCount = LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX - installedSoftBoxCount; + +// OS_Printf("installedSoftBoxCount = %d\n", installedSoftBoxCount); +// OS_Printf("freeSoftBoxCount = %d\n", freeSoftBoxCount); + + // LCFGライブラリの静的変数に対する更新 + LCFG_TSD_SetInstalledSoftBoxCount( (u8)installedSoftBoxCount ); + LCFG_TSD_SetFreeSoftBoxCount( (u8)freeSoftBoxCount ); + + // LCFGライブラリの静的変数の値をNANDに反映 + { + u8 *pBuffer = OS_Alloc( LCFG_WRITE_TEMP ); + if( pBuffer ) { + (void)LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer ); + OS_Free( pBuffer ); + } + } +} +