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 ); + } + } +} +