mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
NAMUT_Format で、ファイルクリア時のパターンをランダム値に変更。
また、WiFi設定データもクリアするよう変更。 git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1318 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
c7ad147378
commit
f8a61f2215
@ -22,8 +22,10 @@
|
||||
#include <twl/fatfs.h>
|
||||
#include <twl/os/common/format_rom.h>
|
||||
#include <twl/nam.h>
|
||||
#include <twl/aes.h>
|
||||
#include <twl/os/common/banner.h>
|
||||
#include <sysmenu/namut.h>
|
||||
#include <nitro/nvram.h>
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
定数定義
|
||||
@ -60,32 +62,16 @@ static const char* sDeleteNonProtecedDirectoryList[] =
|
||||
};
|
||||
|
||||
// 擬似フォーマット実行時に
|
||||
// 指定ファイルは0xffでFillされます。
|
||||
// 指定ファイルはランダムデータでFillされます。
|
||||
static const char* sFillFileList[] =
|
||||
{
|
||||
"nand:/shared1/TWLCFG0.dat",
|
||||
"nand:/shared1/TWLCFG1.dat"
|
||||
};
|
||||
|
||||
static const u8 sClearData[CLEAR_DATA_SIZE] =
|
||||
{
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
|
||||
};
|
||||
|
||||
static u8 sClearData[CLEAR_DATA_SIZE] ATTRIBUTE_ALIGN(32);
|
||||
static u32 sNCFGAddr;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
内部変数定義
|
||||
@ -106,6 +92,7 @@ static BOOL NAMUTi_DeleteNandDirectory(const char *path);
|
||||
static BOOL NAMUTi_MountAndFormatOtherTitleSaveData(u64 titleID, const char *arcname);
|
||||
static void NAMUTi_DrawNandTree(s32 depth, const char *path);
|
||||
static BOOL NAMUTi_FillFile(const char* path);
|
||||
static void NAMUTi_ClearWiFiSettings( void );
|
||||
static void PrintDirectory(s32 depth, const char* path);
|
||||
static void PrintFile(s32 depth, const char* path);
|
||||
|
||||
@ -159,6 +146,9 @@ BOOL NAMUT_Format(void)
|
||||
}
|
||||
}
|
||||
|
||||
// WiFi設定データをクリアします
|
||||
NAMUTi_ClearWiFiSettings();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -549,10 +539,14 @@ static BOOL NAMUTi_FillFile(const char* path)
|
||||
// ファイルオープン
|
||||
if (FS_OpenFileEx(&file, path, (FS_FILEMODE_RWL)))
|
||||
{
|
||||
// ファイルを0xFFでクリア
|
||||
// ファイルをランダムデータでクリア
|
||||
u32 filesize = FS_GetFileLength(&file);
|
||||
for (; filesize > CLEAR_DATA_SIZE; filesize -= CLEAR_DATA_SIZE)
|
||||
{
|
||||
if( AES_Rand(sClearData, CLEAR_DATA_SIZE) != AES_RESULT_SUCCESS )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
FS_WriteFile(&file, sClearData, CLEAR_DATA_SIZE);
|
||||
}
|
||||
FS_WriteFile(&file, sClearData, (s32)filesize);
|
||||
@ -696,6 +690,41 @@ static void NAMUTi_DrawNandTree(s32 depth, const char *path)
|
||||
FS_CloseDirectory(&dir);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: NAMUTi_ClearWiFiSettings
|
||||
|
||||
Description: NVRAMのWiFi設定データをクリアする。
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void NAMUTi_ClearWiFiSettings( void )
|
||||
{
|
||||
#define NCFG_ADDR 0x20
|
||||
#define NTR_WIFI_DATA_SIZE 0x400
|
||||
#define TWL_WIFI_DATA_SIZE 0x600
|
||||
int len = ( NTR_WIFI_DATA_SIZE + TWL_WIFI_DATA_SIZE );
|
||||
|
||||
if (!NVRAMi_IsInitialized()) {
|
||||
NVRAMi_Init();
|
||||
}
|
||||
DC_FlushRange( &sNCFGAddr, 2 );
|
||||
sNCFGAddr = 0;
|
||||
NVRAMi_Read( NCFG_ADDR, 2, (u8 *)&sNCFGAddr);
|
||||
sNCFGAddr = (u32)( ( sNCFGAddr << 3 ) - len );
|
||||
|
||||
MI_CpuFillFast( sClearData, 0xffffffff, CLEAR_DATA_SIZE);
|
||||
DC_FlushRange( sClearData, CLEAR_DATA_SIZE );
|
||||
while( len > 0 ) {
|
||||
NVRAMi_Write( sNCFGAddr, CLEAR_DATA_SIZE , sClearData );
|
||||
sNCFGAddr += CLEAR_DATA_SIZE;
|
||||
len -= CLEAR_DATA_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: PrintDirectory
|
||||
|
||||
|
||||
@ -131,7 +131,7 @@ extern void SYSM_GoSleepMode( void );
|
||||
|
||||
// ペアレンタルコントロール問い合わせ
|
||||
u32 SYSM_CalcPCTLInquiryCode( void ); // 問い合わせコード(10進8桁)算出
|
||||
u32 SYSM_CalcPCTLMasterKey( void ); // マスターキー (10進5桁)算出
|
||||
u32 SYSM_CalcPCTLMasterKey( void ); // マスターキー (10進5桁)算出(※内部でRTC_GetDateを使用します。)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user