設定画面とPictoChat、それぞれにNMenuから起動するための応急措置を適用

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@105 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
yoshida_teruhisa 2007-11-06 08:18:31 +00:00
parent d1e6f438a4
commit 99667e44ab
3 changed files with 73 additions and 0 deletions

View File

@ -18,6 +18,7 @@
#include <twl.h>
#include "misc.h"
#include "MachineSetting.h"
#include "nand_app_hack.h"
// extern data-----------------------------------------------------------------
@ -73,6 +74,11 @@ void TwlMain(void)
if( SYSM_ReadTWLSettingsFile() ) {
SYSM_CaribrateTP();
}
{
// ファイルシステム切り替え応急処置
FS_IdentifyTitle(0x4d534554);//MSET
}
InitBG();
GetAndDrawRTCData( &g_rtcDraw, TRUE );

View File

@ -18,6 +18,7 @@
#include <twl.h>
#include "misc.h"
#include "PictoChat.h"
#include "nand_app_hack.h"
// extern data-----------------------------------------------------------------
@ -61,6 +62,11 @@ void TwlMain(void)
InitAllocator();
CMN_InitFileSystem( &g_allocator );
{
// ファイルシステム切り替え応急処置
FS_IdentifyTitle(0x50434854);//PCHT
}
InitBG();
PictoChatInit();
// メインループ----------------------------

61
include/nand_app_hack.h Normal file
View File

@ -0,0 +1,61 @@
// とにかく.appファイル内のSRLを直接読み込むコールバック
//#define WAD_SRL_OFFSET 0x12C0
#define WAD_SRL_OFFSET 0
static FSResult ReadFromWad(FSArchive *arc, void *buffer, u32 offset, u32 length)
{
FSFile *file = (FSFile *)FS_GetArchiveBase(arc);
(void)FS_SeekFile(file, (int)(WAD_SRL_OFFSET + offset), FS_SEEK_SET);
return (FS_ReadFile(file, buffer, (int)length) >= 0) ?
FS_RESULT_SUCCESS : FS_GetResultCode(file);
}
// 指定のタイトルIDで起動したNANDアプリであると仮定して"rom"アーカイブを置換
static BOOL FS_IdentifyTitle(u32 titleLo)
{
BOOL retval = FALSE;
static struct
{
BOOL initialized;
FSFile file[1];
}
context;
if (!context.initialized)
{
context.initialized = TRUE;
// if (OS_GetBootType() == OS_BOOTTYPE_NAND)
{
char path[FS_ENTRY_LONGNAME_MAX];
STD_TSPrintf(path, "nand:/title_e/00010001/%02X%02X%02X%02X/content/12123434.app",
((titleLo / 1000) % 10) + '0',
((titleLo / 100) % 10) + '0',
((titleLo / 10) % 10) + '0',
((titleLo / 1) % 10) + '0');
if (!FS_IsAvailable())
{
FS_Init(FS_DMA_NOT_USE);
}
if (FS_OpenFileEx(context.file, path, FS_FILEMODE_R))
{
CARDRomHeader header[1];
(void)FS_SeekFile(context.file, (int)(WAD_SRL_OFFSET + 0), FS_SEEK_SET);
if (FS_ReadFile(context.file, header, sizeof(header)) == sizeof(header))
{
FSArchive *arc = FS_FindArchive("rom", 3);
(void)FS_UnloadArchive(arc);
if (FS_LoadArchive(arc, (u32)context.file,
header->fat.offset, header->fat.length,
header->fnt.offset, header->fnt.length,
ReadFromWad, NULL))
{
retval = TRUE;
}
}
if (!retval)
{
(void)FS_CloseFile(context.file);
}
}
}
}
return retval;
}