mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
NAMUT_Init関数を追加しました。(Alloc/Free)を渡します。
ImportJump がうまく動作しない問題を修正。 git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1376 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
575bcaf2b2
commit
bac39e78df
@ -69,7 +69,6 @@ static const char* sFillFileList[] =
|
||||
"nand:/shared1/TWLCFG1.dat"
|
||||
};
|
||||
|
||||
|
||||
static u8 sClearData[CLEAR_DATA_SIZE] ATTRIBUTE_ALIGN(32);
|
||||
static u32 sNCFGAddr;
|
||||
|
||||
@ -77,6 +76,8 @@ static u32 sNCFGAddr;
|
||||
内部変数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
static NAMUTAlloc spAllocFunc;
|
||||
static NAMUTFree spFreeFunc;
|
||||
static FSDirectoryEntryInfo sEntryInfo;
|
||||
static NAMTitleId sTitleIdArray[TITLE_LIST_MAX];
|
||||
static char sCurrentFullPath[FS_ENTRY_LONGNAME_MAX];
|
||||
@ -90,11 +91,32 @@ static BOOL NAMUTi_DeleteNonprotectedTitleEntity(const char* path);
|
||||
static BOOL NAMUTi_ClearSavedataAll(void);
|
||||
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 BOOL NAMUTi_RandClearFile(const char* path);
|
||||
static void NAMUTi_ClearWiFiSettings( void );
|
||||
static void PrintDirectory(s32 depth, const char* path);
|
||||
static void PrintFile(s32 depth, const char* path);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: NAMUT_Init
|
||||
|
||||
Description: NAMUT ライブラリの初期化を行います。
|
||||
|
||||
Arguments: allocFunc: メモリ確保関数へのポインタ。
|
||||
freeFunc: メモリ解放関数へのポインタ。
|
||||
|
||||
Returns: なし。
|
||||
*---------------------------------------------------------------------------*/
|
||||
void NAMUT_Init(NAMUTAlloc allocFunc, NAMUTFree freeFunc)
|
||||
{
|
||||
SDK_ASSERT( spAllocFunc == NULL );
|
||||
SDK_ASSERT( spFreeFunc == NULL );
|
||||
SDK_POINTER_ASSERT(allocFunc);
|
||||
SDK_POINTER_ASSERT(freeFunc);
|
||||
|
||||
spAllocFunc = allocFunc;
|
||||
spFreeFunc = freeFunc;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: NAMUT_Format
|
||||
|
||||
@ -124,13 +146,13 @@ BOOL NAMUT_Format(void)
|
||||
OS_TWarning("Fail! NAMUTi_ClearSavedataAll()\n");
|
||||
}
|
||||
|
||||
// 指定ファイルを0xffでクリアします
|
||||
// 指定ファイルを乱数でクリアします
|
||||
for (i=0; i<sizeof(sFillFileList)/sizeof(sFillFileList[0]); i++)
|
||||
{
|
||||
if (!NAMUTi_FillFile(sFillFileList[i]))
|
||||
if (!NAMUTi_RandClearFile(sFillFileList[i]))
|
||||
{
|
||||
ret = FALSE;
|
||||
OS_TWarning("Fail! NAMUTi_FillFile(%s)\n", sFillFileList[i]);
|
||||
OS_TWarning("Fail! NAMUTi_RandClearFile(%s)\n", sFillFileList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -310,7 +332,7 @@ static BOOL NAMUTi_DeleteNonprotectedTitleEntity(const char* path)
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: NAMUTi_ClearSavedataAll
|
||||
|
||||
Description: 全セーブデータのFFクリア&フォーマットを行います
|
||||
Description: 全セーブデータの乱数クリア&フォーマットを行います
|
||||
|
||||
Arguments: None
|
||||
|
||||
@ -374,7 +396,7 @@ static BOOL NAMUTi_ClearSavedataAll( void )
|
||||
Name: NAMUTi_ClearSavedataPublic
|
||||
|
||||
Description: 指定したセーブデータファイルに対して
|
||||
FFクリア&フォーマットを行います。
|
||||
乱数クリア&フォーマットを行います。
|
||||
|
||||
Arguments: None
|
||||
|
||||
@ -382,10 +404,10 @@ static BOOL NAMUTi_ClearSavedataAll( void )
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL NAMUTi_ClearSavedataPublic(const char* path, u64 titleID)
|
||||
{
|
||||
//----- FFクリア
|
||||
if (NAMUTi_FillFile(path) == FALSE)
|
||||
//----- 乱数クリア
|
||||
if (NAMUTi_RandClearFile(path) == FALSE)
|
||||
{
|
||||
OS_Warning(" Fail NAMUTi_FillFile");
|
||||
OS_Warning(" Fail NAMUTi_RandClearFile");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -397,7 +419,7 @@ BOOL NAMUTi_ClearSavedataPublic(const char* path, u64 titleID)
|
||||
Name: NAMUTi_ClearSavedataPrivate
|
||||
|
||||
Description: 指定したセーブデータファイルに対して
|
||||
FFクリア&フォーマットを行います。
|
||||
乱数クリア&フォーマットを行います。
|
||||
|
||||
Arguments: None
|
||||
|
||||
@ -405,10 +427,10 @@ BOOL NAMUTi_ClearSavedataPublic(const char* path, u64 titleID)
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL NAMUTi_ClearSavedataPrivate(const char* path, u64 titleID)
|
||||
{
|
||||
//----- FFクリア
|
||||
if (NAMUTi_FillFile(path) == FALSE)
|
||||
//----- 乱数クリア
|
||||
if (NAMUTi_RandClearFile(path) == FALSE)
|
||||
{
|
||||
OS_Warning(" Fail NAMUTi_FillFile");
|
||||
OS_Warning(" Fail NAMUTi_RandClearFile");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -420,8 +442,7 @@ BOOL NAMUTi_ClearSavedataPrivate(const char* path, u64 titleID)
|
||||
Name: NAMUTi_DestroySubBanner
|
||||
|
||||
Description: 指定したサブバナーのCRC破壊を試みます。
|
||||
指定したサブバナーが存在しない可能性もありますが
|
||||
その場合でもTRUEを返します。(コードはOS_DeleteSubBannerFileのパクリ)
|
||||
(コードはOS_DeleteSubBannerFileのパクリ)
|
||||
|
||||
Arguments: None
|
||||
|
||||
@ -429,36 +450,42 @@ BOOL NAMUTi_ClearSavedataPrivate(const char* path, u64 titleID)
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL NAMUTi_DestroySubBanner(const char* path)
|
||||
{
|
||||
TWLSubBannerFile buf[1]; // 4KBあるのでよくない。NAM関数のアロケータが使いたい・・
|
||||
TWLSubBannerFile* pBanner;
|
||||
u16 crc, solt;
|
||||
FSFile file[1];
|
||||
BOOL ret = FALSE;
|
||||
|
||||
// R属性でファイルをオープンを試みてファイルの存在有無を確認する
|
||||
// 存在しない場合はTRUEで返す
|
||||
FS_InitFile(file);
|
||||
if ( !FS_OpenFileEx(file, path, FS_FILEMODE_R) )
|
||||
if ( !spAllocFunc || !spFreeFunc )
|
||||
{
|
||||
return TRUE;
|
||||
OS_TPrintf("NAMUT_Init should be called previously.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// RWL属性で開きなおす
|
||||
|
||||
pBanner = spAllocFunc( sizeof(TWLSubBannerFile) );
|
||||
|
||||
if (!pBanner)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// RWL属性で開く
|
||||
FS_InitFile(file);
|
||||
if ( !FS_OpenFileEx(file, path, FS_FILEMODE_RWL) )
|
||||
{
|
||||
OS_TPrintf("OS_DeleteSubBannerFile : banner file open failed.\n");
|
||||
spFreeFunc( pBanner );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// CRCを改竄して書き戻す
|
||||
if( FS_ReadFile( file, buf, sizeof(TWLSubBannerFile) ) != -1 )
|
||||
if( FS_ReadFile( file, pBanner, sizeof(TWLSubBannerFile) ) != -1 )
|
||||
{
|
||||
crc = SVC_GetCRC16( 0xffff, &buf->anime, sizeof(BannerAnime) );
|
||||
crc = SVC_GetCRC16( 0xffff, &pBanner->anime, sizeof(BannerAnime) );
|
||||
solt = 1;
|
||||
crc += solt;
|
||||
buf->h.crc16_anime = crc;
|
||||
pBanner->h.crc16_anime = crc;
|
||||
FS_SeekFile( file, 0, FS_SEEK_SET );
|
||||
if( sizeof(BannerHeader) == FS_WriteFile(file, &buf->h, sizeof(BannerHeader)) )
|
||||
if( sizeof(BannerHeader) == FS_WriteFile(file, &pBanner->h, sizeof(BannerHeader)) )
|
||||
{
|
||||
OS_TPrintf("OS_DeleteSubBannerFile : banner file write succeed.\n");
|
||||
ret = TRUE;
|
||||
@ -471,7 +498,8 @@ BOOL NAMUTi_DestroySubBanner(const char* path)
|
||||
OS_TPrintf("OS_DeleteSubBannerFile : banner file read failed.\n");
|
||||
}
|
||||
FS_CloseFile(file);
|
||||
|
||||
|
||||
spFreeFunc( pBanner );
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -520,15 +548,15 @@ static BOOL NAMUTi_MountAndFormatOtherTitleSaveData(u64 titleID, const char *arc
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: NAMUTi_FillFile
|
||||
Name: NAMUTi_RandClearFile
|
||||
|
||||
Description: 指定したファイルを0xFFで埋めます。
|
||||
Description: 指定したファイルを乱数で埋めます。
|
||||
|
||||
Arguments: path
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
static BOOL NAMUTi_FillFile(const char* path)
|
||||
static BOOL NAMUTi_RandClearFile(const char* path)
|
||||
{
|
||||
FSFile file;
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
#include <twl.h>
|
||||
#include <twl/sea.h>
|
||||
#include <sysmenu/namut.h>
|
||||
#include "misc.h"
|
||||
#include "MachineSetting.h"
|
||||
|
||||
@ -72,6 +73,7 @@ void TwlMain(void)
|
||||
|
||||
// NAMライブラリ初期化
|
||||
NAM_Init( Alloc, Free ); // NAMUTライブラリがNAMライブラリを使用している
|
||||
NAMUT_Init( Alloc, Free );
|
||||
|
||||
// ※本来ならランチャーからのパラメータチェックを行い、
|
||||
// 初回起動シーケンスに入るパスがある
|
||||
|
||||
@ -35,7 +35,7 @@ typedef struct _ImportJumpSetting
|
||||
u32 magicCode; // = TWLD
|
||||
u32 clearPublicSaveData :1; // publicセーブデータをクリアする(デフォルトOFF)
|
||||
u32 clearPrivateSaveData :1; // privareセーブデータをクリアする(デフォルトOFF)
|
||||
u32 clearSaveBannerFile:1; // セーブバナーファイルをクリアする(デフォルトOFF)
|
||||
u32 clearSubBannerFile:1; // サブバナーファイルをクリアする(デフォルトOFF)
|
||||
u32 importTad:1; // パスで指定されたTADファイルをインポートするか(TADの更新有無に依存)
|
||||
u32 rsv :28; // 予約
|
||||
u32 tadRomOffset; // TADをロードしたエミュレーションROMオフセット
|
||||
|
||||
@ -154,7 +154,7 @@ Property
|
||||
#
|
||||
# DisableDebug :最終ROMではデバッグできないようにTRUEにする必要があります。
|
||||
#
|
||||
DisableDebug TRUE
|
||||
DisableDebug FALSE
|
||||
|
||||
###
|
||||
#### END
|
||||
|
||||
@ -163,46 +163,43 @@ BOOL kamiImportTad(NAMTitleId* pTitleID)
|
||||
if ( NAM_GetTitleSaveFilePath(savePublicPath, savePrivatePath, tadInfo.titleInfo.titleId) != NAM_OK )
|
||||
{
|
||||
OS_Warning(" Fail! NAM_GetTitleSaveFilePath\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// publicセーブデータFFクリア&フォーマット
|
||||
if (GetImportJumpSetting()->clearPublicSaveData && tadInfo.titleInfo.publicSaveSize > 0)
|
||||
else
|
||||
{
|
||||
if (NAMUTi_ClearSavedataPublic(savePublicPath, tadInfo.titleInfo.titleId) == FALSE)
|
||||
// publicセーブデータFFクリア&フォーマット
|
||||
if (GetImportJumpSetting()->clearPublicSaveData && tadInfo.titleInfo.publicSaveSize > 0)
|
||||
{
|
||||
OS_Warning(" Fail! NAMUTi_ClearSavedataPublic\n");
|
||||
return FALSE;
|
||||
if (NAMUTi_ClearSavedataPublic(savePublicPath, tadInfo.titleInfo.titleId) == FALSE)
|
||||
{
|
||||
OS_Warning(" Fail! NAMUTi_ClearSavedataPublic\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// privateセーブデータFFクリア&フォーマット
|
||||
if (GetImportJumpSetting()->clearPrivateSaveData && tadInfo.titleInfo.privateSaveSize > 0)
|
||||
{
|
||||
if (NAMUTi_ClearSavedataPublic(savePrivatePath, tadInfo.titleInfo.titleId) == FALSE)
|
||||
// privateセーブデータFFクリア&フォーマット
|
||||
if (GetImportJumpSetting()->clearPrivateSaveData && tadInfo.titleInfo.privateSaveSize > 0)
|
||||
{
|
||||
OS_Warning(" Fail! NAMUTi_ClearSavedataPrivate\n");
|
||||
return FALSE;
|
||||
if (NAMUTi_ClearSavedataPublic(savePrivatePath, tadInfo.titleInfo.titleId) == FALSE)
|
||||
{
|
||||
OS_Warning(" Fail! NAMUTi_ClearSavedataPrivate\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// サブバナークリア処理
|
||||
if (GetImportJumpSetting()->clearSaveBannerFile)
|
||||
if (GetImportJumpSetting()->clearSubBannerFile)
|
||||
{
|
||||
// サブバナーパス取得
|
||||
if ( NAM_GetTitleBannerFilePath(subBannerPath, tadInfo.titleInfo.titleId) != NAM_OK )
|
||||
{
|
||||
OS_Warning(" Fail! NAM_GetTitleBannerFilePath\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// サブバナー破壊
|
||||
else
|
||||
{
|
||||
// サブバナー破壊
|
||||
if (NAMUTi_DestroySubBanner(subBannerPath) == FALSE)
|
||||
{
|
||||
OS_Warning(" Fail! NAMUTi_DestroySubBanner\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,6 +21,8 @@
|
||||
#include <nitro/card.h>
|
||||
#include <twl/nam.h>
|
||||
#include <twl/os/common/format_rom.h>
|
||||
#include <sysmenu/namut.h>
|
||||
|
||||
#include "kami_font.h"
|
||||
#include "import.h"
|
||||
#include "graphics.h"
|
||||
@ -97,7 +99,8 @@ TwlMain()
|
||||
FS_Init(FS_DMA_NOT_USE);
|
||||
|
||||
// NAMライブラリ初期化
|
||||
NAM_Init( OS_AllocFromMain, OS_FreeToMain);
|
||||
NAM_Init( OS_AllocFromMain, OS_FreeToMain );
|
||||
NAMUT_Init( OS_AllocFromMain, OS_FreeToMain );
|
||||
|
||||
// 表示関連初期化
|
||||
InitGraphics();
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
#include <twl/fatfs.h>
|
||||
#include <nitro/card.h>
|
||||
#include <twl/nam.h>
|
||||
#include <sysmenu/namut.h>
|
||||
#include "kami_font.h"
|
||||
#include "process_format.h"
|
||||
#include "process_topmenu.h"
|
||||
@ -102,6 +103,7 @@ TwlMain()
|
||||
|
||||
// NAMライブラリ初期化
|
||||
NAM_Init( OS_AllocFromMain, OS_FreeToMain);
|
||||
NAMUT_Init( OS_AllocFromMain, OS_FreeToMain);
|
||||
|
||||
// 表示関連初期化
|
||||
InitGraphics();
|
||||
|
||||
@ -24,6 +24,21 @@ extern "C" {
|
||||
|
||||
#ifdef SDK_ARM9
|
||||
|
||||
typedef void* (*NAMUTAlloc)(u32 size);
|
||||
typedef void (*NAMUTFree)(void* ptr);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: NAMUT_Init
|
||||
|
||||
Description: NAMUT ライブラリの初期化を行います。
|
||||
|
||||
Arguments: allocFunc: メモリ確保関数へのポインタ。
|
||||
freeFunc: メモリ解放関数へのポインタ。
|
||||
|
||||
Returns: なし。
|
||||
*---------------------------------------------------------------------------*/
|
||||
void NAMUT_Init(NAMUTAlloc allocFunc, NAMUTFree freeFunc);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: NAMUT_Format
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user