ハードウェア情報を書き込めていなかったのを修正。(追加コミットし忘れ)

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1243 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
kamikawa 2008-04-23 08:21:13 +00:00
parent aab4e17a5a
commit 9d4ac30b6a
2 changed files with 271 additions and 0 deletions

View File

@ -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 <nitro.h>
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
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
*---------------------------------------------------------------------------*/

View File

@ -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 <twl.h>
#include <nitro/snd.h>
#include <twl/fatfs.h>
#include <twl/lcfg.h>
#include <nitro/card.h>
#include <sysmenu/namut.h>
#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 );
}
}
}