mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
正式なフォーマット後にTWLCFG*.datを生成していなかった不具合を修正(これまでは再起動後にリカバリ生成されていました)
namut : エラー出力を改善 git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1019 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
e7279e61d2
commit
b20cab0606
@ -122,22 +122,38 @@ BOOL NAMUT_Format(void)
|
||||
BOOL ret = TRUE;
|
||||
|
||||
// プロテクトされていないタイトルの削除を行います
|
||||
ret &= NAMUTi_DeleteNonprotectedTitle();
|
||||
if (!NAMUTi_DeleteNonprotectedTitle())
|
||||
{
|
||||
ret = FALSE;
|
||||
OS_TWarning("Fail! NAMUTi_DeleteNonprotectedTitle()\n");
|
||||
}
|
||||
|
||||
// プロテクトタイトルのセーブデータをフォーマットします
|
||||
ret &= NAMUTi_ClearSavedataAll(TRUE);
|
||||
if (!NAMUTi_ClearSavedataAll(TRUE))
|
||||
{
|
||||
ret = FALSE;
|
||||
OS_TWarning("Fail! NAMUTi_ClearSavedataAll()\n");
|
||||
}
|
||||
|
||||
// 指定ファイルを0xffでクリアします
|
||||
for (i=0; i<sizeof(sFillFileList)/sizeof(sFillFileList[0]); i++)
|
||||
{
|
||||
ret &= NAMUTi_FillFile(sFillFileList[i]);
|
||||
if (!NAMUTi_FillFile(sFillFileList[i]))
|
||||
{
|
||||
ret = FALSE;
|
||||
OS_TWarning("Fail! NAMUTi_FillFile(%s)\n", sFillFileList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// temp以下を消去します
|
||||
// NAM関数でtempが作成&使用される可能性があるため最後に実行します
|
||||
for (i=0; i<sizeof(sDeleteDirectoryList)/sizeof(char*); i++)
|
||||
{
|
||||
ret &= NAMUTi_DeleteNandDirectory(sDeleteDirectoryList[i]);
|
||||
if (!NAMUTi_DeleteNandDirectory(sDeleteDirectoryList[i]))
|
||||
{
|
||||
ret = FALSE;
|
||||
OS_TWarning("NAMUTi_DeleteNandDirectory(%s)\n", sDeleteDirectoryList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -164,7 +180,7 @@ static BOOL NAMUTi_DeleteNandDirectory(const char *path)
|
||||
// 引数で指定されたディレクトリを開く
|
||||
if (!FS_OpenDirectory(&dir, path, FS_FILEMODE_R))
|
||||
{
|
||||
SDK_ASSERTMSG(0, "Fail! FS_OpenDirectory(%s) in %s\n", path, __func__);
|
||||
OS_TWarning("Fail! FS_OpenDirectory(%s) in %s\n", path, __func__);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -184,14 +200,20 @@ static BOOL NAMUTi_DeleteNandDirectory(const char *path)
|
||||
// ディレクトリ
|
||||
if (entryInfo.attributes & FS_ATTRIBUTE_IS_DIRECTORY)
|
||||
{
|
||||
ret &= FS_DeleteDirectoryAuto(sCurrentFullPath);
|
||||
SDK_ASSERTMSG(ret, "Fail! FS_DeleteDirectoryAuto(%s) in %s\n", sCurrentFullPath, __func__);
|
||||
if (!FS_DeleteDirectoryAuto(sCurrentFullPath))
|
||||
{
|
||||
ret = FALSE;
|
||||
OS_TWarning("Fail! FS_DeleteDirectoryAuto(%s) in %s\n", sCurrentFullPath, __func__);
|
||||
}
|
||||
}
|
||||
// ファイル
|
||||
else
|
||||
{
|
||||
ret &= FS_DeleteFileAuto(sCurrentFullPath);
|
||||
SDK_ASSERTMSG(ret, "Fail! FS_DeleteFileAuto(%s) in %s\n", sCurrentFullPath, __func__);
|
||||
if (!FS_DeleteFileAuto(sCurrentFullPath))
|
||||
{
|
||||
ret = FALSE;
|
||||
OS_TWarning("Fail! FS_DeleteFileAuto(%s) in %s\n", sCurrentFullPath, __func__);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,7 +265,7 @@ static BOOL NAMUTi_DeleteNonprotectedTitleEntity(const char* path)
|
||||
// 引数で指定されたディレクトリを開く
|
||||
if (!FS_OpenDirectory(&dir, path, FS_FILEMODE_R))
|
||||
{
|
||||
SDK_ASSERTMSG(0, "Fail! FS_OpenDirectory(%s) in %s\n", path, __func__);
|
||||
OS_TWarning("Fail! FS_OpenDirectory(%s) in %s\n", path, __func__);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -268,15 +290,21 @@ static BOOL NAMUTi_DeleteNonprotectedTitleEntity(const char* path)
|
||||
STD_ConcatenateLString(sCurrentFullPath, "/", FS_ENTRY_LONGNAME_MAX);
|
||||
STD_ConcatenateLString(sCurrentFullPath, entryInfo.longname, FS_ENTRY_LONGNAME_MAX);
|
||||
|
||||
ret &= FS_DeleteDirectoryAuto(sCurrentFullPath);
|
||||
SDK_ASSERTMSG(ret, "Fail! FS_DeleteDirectoryAuto(%s) in %s\n", sCurrentFullPath, __func__);
|
||||
if (!FS_DeleteDirectoryAuto(sCurrentFullPath))
|
||||
{
|
||||
ret = FALSE;
|
||||
OS_TWarning("Fail! FS_DeleteDirectoryAuto(%s) in %s\n", sCurrentFullPath, __func__);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ディレクトリを閉じる
|
||||
ret &= FS_CloseDirectory(&dir);
|
||||
SDK_ASSERTMSG(ret, "Fail! FS_CloseDirectory() in %s\n", __func__);
|
||||
if (!FS_CloseDirectory(&dir))
|
||||
{
|
||||
ret = FALSE;
|
||||
OS_TWarning("Fail! FS_CloseDirectory() in %s\n", __func__);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -446,6 +474,7 @@ static BOOL NAMUTi_FillFile(const char* path)
|
||||
}
|
||||
else
|
||||
{
|
||||
OS_TWarning("Fail! FS_OpenFileEx(%s)\n", path);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
@ -470,7 +499,7 @@ u32 NAMUT_SearchInstalledSoftBoxCount( void )
|
||||
// タイトルリスト取得
|
||||
if (NAM_GetTitleList(sTitleIdArray, TITLE_LIST_MAX) != NAM_OK)
|
||||
{
|
||||
SDK_ASSERTMSG(0, "Fail! NAM_GetTitleList() in %s\n", __func__);
|
||||
OS_TWarning("Fail! NAM_GetTitleList() in %s\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -242,17 +242,22 @@ static BOOL VerifyData( const u8 *pTgt, const u8 *pOrg, u32 len )
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns: None.
|
||||
Returns: BOOL
|
||||
*---------------------------------------------------------------------------*/
|
||||
void HWI_ModifyLanguage( u8 region )
|
||||
BOOL HWI_ModifyLanguage( u8 region )
|
||||
{
|
||||
#pragma unused( region )
|
||||
u32 langBitmap = LCFG_THW_GetValidLanguageBitmap();
|
||||
u8 nowLanguage = LCFG_TSD_GetLanguage();
|
||||
BOOL result = TRUE;
|
||||
|
||||
// TSDが存在しない場合はここでリカバリ生成
|
||||
ReadTWLSettings();
|
||||
|
||||
// TSDが読み込めていないなら、何もせずリターン
|
||||
if( !s_isReadTSD ) {
|
||||
return;
|
||||
OS_TPrintf("TWLSetting is not Readed!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if( langBitmap & ( 0x0001 << nowLanguage ) ) {
|
||||
@ -279,10 +284,16 @@ void HWI_ModifyLanguage( u8 region )
|
||||
{
|
||||
u8 *pBuffer = spAlloc( LCFG_WRITE_TEMP );
|
||||
if( pBuffer ) {
|
||||
(void)LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer );
|
||||
if (!LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer ))
|
||||
{
|
||||
result = FALSE;
|
||||
OS_TPrintf("Fail! LCFG_WriteTWLSettings()\n");
|
||||
}
|
||||
spFree( pBuffer );
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
|
||||
@ -37,7 +37,7 @@ typedef enum
|
||||
HwiInitResult;
|
||||
|
||||
HwiInitResult HWI_Init( void *(*pAlloc)( u32 ), void (*pFree)( void * ) );
|
||||
void HWI_ModifyLanguage( u8 region );
|
||||
BOOL HWI_ModifyLanguage( u8 region );
|
||||
BOOL HWI_WriteHWNormalInfoFile( void );
|
||||
BOOL HWI_WriteHWSecureInfoFile( u8 region, const u8 *pSerialNo, BOOL isDisableWireless );
|
||||
BOOL HWI_WriteHWIDSignFile( void );
|
||||
|
||||
@ -61,11 +61,11 @@ typedef struct FileProperty {
|
||||
|
||||
// FATFSのクラスタサイズは16KBなので、データサイズが決まっていないものは、余裕を持たせて16KBにしておく
|
||||
//static const FileProperty s_fileList[] = {
|
||||
// { 128, "nand:/sys/ID.sgn" }, // 現状、全部サイズは適当。中身も空。
|
||||
// { RSA_KEY_LENGTH, LCFG_TWL_HWID_SIGN_PATH }, // 現状、全部サイズは適当。中身も空。
|
||||
// { LCFG_TWL_HWINFO_FILE_LENGTH, LCFG_TWL_HWINFO_NORMAL_PATH },
|
||||
// { LCFG_TWL_HWINFO_FILE_LENGTH, LCFG_TWL_HWINFO_SECURE_PATH },
|
||||
// { FATFS_CLUSTER_SIZE, "nand:/shared1/TWLCFG0.dat" },
|
||||
// { FATFS_CLUSTER_SIZE, "nand:/shared1/TWLCFG1.dat" }, // ミラー
|
||||
// { LCFG_TWL_HWINFO_FILE_LENGTH, "nand:/shared1/TWLCFG0.dat" },
|
||||
// { LCFG_TWL_HWINFO_FILE_LENGTH, "nand:/shared1/TWLCFG1.dat" }, // ミラー
|
||||
// { 0, NULL },
|
||||
//};
|
||||
|
||||
@ -305,7 +305,7 @@ static BOOL CreateFile( const FileProperty *pFileList )
|
||||
}
|
||||
pTemp++;
|
||||
}
|
||||
pBuffer = OS_Alloc( length );
|
||||
pBuffer = OS_AllocFromSubPrivWram( length );
|
||||
if( pBuffer == NULL ) {
|
||||
OS_TPrintf( "memory allocate error.\n" );
|
||||
ERROR_RETURN();
|
||||
@ -346,7 +346,7 @@ static BOOL CreateFile( const FileProperty *pFileList )
|
||||
pFileList++;
|
||||
}
|
||||
// メモリ解放
|
||||
OS_Free( pBuffer );
|
||||
OS_FreeToSubPrivWram( pBuffer );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -378,7 +378,7 @@ static BOOL CheckFile( const FileProperty *pFileList )
|
||||
ERROR_RETURN();
|
||||
}
|
||||
// バッファ メモリ確保
|
||||
pBuffer = OS_Alloc( pFileList->length );
|
||||
pBuffer = OS_AllocFromSubPrivWram( pFileList->length );
|
||||
if( pBuffer == NULL ) {
|
||||
OS_TPrintf( "memory allocate error.\n" );
|
||||
ERROR_RETURN();
|
||||
@ -406,7 +406,7 @@ static BOOL CheckFile( const FileProperty *pFileList )
|
||||
}
|
||||
OS_TPrintf( " [VerifyTime : %dms] ", OS_TicksToMilliSeconds( OS_GetTick() - start ) );
|
||||
// メモリ解放
|
||||
OS_Free( pBuffer );
|
||||
OS_FreeToSubPrivWram( pBuffer );
|
||||
// ファイルクローズ
|
||||
(void)FATFS_CloseFile( file );
|
||||
OS_TPrintf( "ok.\n" );
|
||||
|
||||
@ -42,6 +42,17 @@ void* HWInfoProcess2(void);
|
||||
void* HWInfoProcess3(void);
|
||||
void* HWInfoProcess4(void);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: HW情報全体のライト
|
||||
|
||||
Description:
|
||||
|
||||
Arguments: region :
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL WriteHWInfoFile( u8 region );
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: UpdateNandBoxCount
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
#include <nitro/snd.h>
|
||||
#include <twl/fatfs.h>
|
||||
#include <nitro/card.h>
|
||||
#include <twl/lcfg.h>
|
||||
#include "kami_font.h"
|
||||
#include "kami_pxi.h"
|
||||
#include "process_topmenu.h"
|
||||
@ -209,13 +210,22 @@ void* FormatProcess2(void)
|
||||
kamiFontPrintf(24, y_pos, FONT_COLOR_BLACK, " WAIT");
|
||||
kamiFontLoadScreenData();
|
||||
|
||||
if (NAMUT_Format())
|
||||
{
|
||||
kamiFontPrintf(24, y_pos, FONT_COLOR_GREEN, " OK ");
|
||||
}
|
||||
else
|
||||
{
|
||||
kamiFontPrintf(24, y_pos, FONT_COLOR_RED, " NG ");
|
||||
// 現在のリージョンを保存しておきフォーマット後に保存リージョンで初期化する
|
||||
u8 region = LCFG_THW_GetRegion();
|
||||
BOOL result = TRUE;
|
||||
|
||||
result &= NAMUT_Format();
|
||||
result &= WriteHWInfoFile(region);
|
||||
|
||||
if (result)
|
||||
{
|
||||
kamiFontPrintf(24, y_pos, FONT_COLOR_GREEN, " OK ");
|
||||
}
|
||||
else
|
||||
{
|
||||
kamiFontPrintf(24, y_pos, FONT_COLOR_RED, " NG ");
|
||||
}
|
||||
}
|
||||
#ifdef DUMP_NAND_TREE
|
||||
OS_Printf("\n");
|
||||
|
||||
@ -63,7 +63,6 @@ static BOOL s_isReadTSD;
|
||||
内部関数宣言
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
static BOOL WriteHWInfoFile( u8 region );
|
||||
static BOOL WriteHWNormalInfoFile( void );
|
||||
static BOOL WriteHWSecureInfoFile( u8 region );
|
||||
//static BOOL DeleteHWInfoFile( void );
|
||||
@ -252,12 +251,12 @@ void* HWInfoProcess2(void)
|
||||
|
||||
Description:
|
||||
|
||||
Arguments: None.
|
||||
Arguments: region :
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
static BOOL WriteHWInfoFile( u8 region )
|
||||
BOOL WriteHWInfoFile( u8 region )
|
||||
{
|
||||
static const char *pMsgNormalWriting = "Writing Normal File...";
|
||||
static const char *pMsgSecureWriting = "Writing Secure File...";
|
||||
@ -297,7 +296,12 @@ static BOOL WriteHWInfoFile( u8 region )
|
||||
result = FALSE;
|
||||
}
|
||||
|
||||
HWI_ModifyLanguage( region );
|
||||
// CFGデータの修正
|
||||
if (!HWI_ModifyLanguage( region ))
|
||||
{
|
||||
kamiFontPrintfConsoleEx(CONSOLE_RED, "Fail! Write TWLSettings\n" );
|
||||
result = FALSE;
|
||||
}
|
||||
|
||||
// InstalledSoftBoxCount, FreeSoftBoxCount の値を現在のNANDの状態に合わせて更新します。
|
||||
UpdateNandBoxCount();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user