mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
SystemUpdater で フォントデータ(TWLFontTable.dat)を書き込むようにしました。
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1364 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
1cb042a69e
commit
bc2db58440
@ -52,7 +52,8 @@ SRCS = main.c \
|
||||
kami_pxi.c \
|
||||
kami_write_nandfirm.c \
|
||||
hw_info.c \
|
||||
keypad.c
|
||||
keypad.c \
|
||||
kami_copy_file.c
|
||||
|
||||
LINCLUDES = include \
|
||||
../common/include \
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - SystemUpdater
|
||||
File: kami_copy_file.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 KAMI_COPY_FILE_H_
|
||||
#define KAMI_COPY_FILE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#include <twl.h>
|
||||
|
||||
BOOL kamiCopyFile(char* srcPath, char* dstPath);
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* KAMI_COPY_FILE_H_ */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
End of file
|
||||
*---------------------------------------------------------------------------*/
|
||||
@ -228,5 +228,5 @@ RomSpec
|
||||
File $(HWINFO_PRIVKEY)
|
||||
HostRoot $(TWL_IPL_RED_ROOT)/build/systemMenu_tools/NandInitializerRed/data
|
||||
Root /data
|
||||
File camera_volatile_info.bin
|
||||
File camera_volatile_info.bin TWLFontTable.dat
|
||||
}
|
||||
|
||||
@ -0,0 +1,105 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - NandInitializer
|
||||
File: kami_copy_file.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 <nitro/card.h>
|
||||
#include "kami_font.h"
|
||||
#include "kami_copy_file.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
マクロ
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#define ROUND_UP(value, alignment) \
|
||||
(((u32)(value) + (alignment-1)) & ~(alignment-1))
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
処理関数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
BOOL kamiCopyFile(char* srcPath, char* dstPath)
|
||||
{
|
||||
FSFile file;
|
||||
BOOL open_is_ok;
|
||||
BOOL read_is_ok;
|
||||
void* pTempBuf;
|
||||
u32 file_size;
|
||||
u32 alloc_size;
|
||||
BOOL result = TRUE;
|
||||
|
||||
// ROMファイルオープン
|
||||
FS_InitFile(&file);
|
||||
open_is_ok = FS_OpenFile(&file, srcPath);
|
||||
if (!open_is_ok)
|
||||
{
|
||||
OS_Printf("FS_OpenFile(\"%s\") ... ERROR!\n", srcPath);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// ROMファイルリード
|
||||
file_size = FS_GetFileLength(&file) ;
|
||||
alloc_size = ROUND_UP(file_size, 32) ;
|
||||
pTempBuf = OS_Alloc( alloc_size );
|
||||
SDK_NULL_ASSERT(pTempBuf);
|
||||
DC_InvalidateRange(pTempBuf, alloc_size);
|
||||
read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size );
|
||||
if (!read_is_ok)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_ReadFile(\"%s\") ... ERROR!\n", srcPath);
|
||||
FS_CloseFile(&file);
|
||||
OS_Free(pTempBuf);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// ROMファイルクローズ
|
||||
FS_CloseFile(&file);
|
||||
|
||||
// 一旦対象データを削除する
|
||||
(void)FS_DeleteFile(dstPath);
|
||||
|
||||
// ターゲットファイル作成
|
||||
if (!FS_CreateFile(dstPath, FS_PERMIT_R | FS_PERMIT_W))
|
||||
{
|
||||
kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_CreateFile(%s) failed.\n", dstPath);
|
||||
result = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ターゲットファイルオープン
|
||||
FS_InitFile(&file);
|
||||
open_is_ok = FS_OpenFileEx(&file, dstPath, FS_FILEMODE_W);
|
||||
if (!open_is_ok)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_OpenFile(%s) failed.\n", dstPath);
|
||||
result = FALSE;
|
||||
}
|
||||
// nand:sys/TWLFontTable.dat書き込み
|
||||
else if (FS_WriteFile(&file, pTempBuf, (s32)file_size) == -1)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_WritFile() failed.\n");
|
||||
result = FALSE;
|
||||
}
|
||||
(void)FS_CloseFile(&file);
|
||||
}
|
||||
|
||||
OS_Free(pTempBuf);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
#include "kami_pxi.h"
|
||||
#include "kami_font.h"
|
||||
#include "kami_write_nandfirm.h"
|
||||
#include "kami_copy_file.h"
|
||||
#include "import.h"
|
||||
#include "hw_info.h"
|
||||
#include "graphics.h"
|
||||
@ -45,11 +46,18 @@ typedef struct _SystemUpdaterLog
|
||||
int reserve[5];
|
||||
} SystemUpdaterLog;
|
||||
|
||||
typedef struct _CopyFileList
|
||||
{
|
||||
char* srcPath;
|
||||
char* dstPath;
|
||||
} CopyFileList;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
内部定数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#define SYSTEM_UPDATER_LOG_PATH "nand:/sys/log/updater.log"
|
||||
#define NAND_FIRM_PATH_IN_ROM "rom:/data/menu_launcher.nand"
|
||||
|
||||
#define SYSTEM_UPDATER_MAGIC_CODE 44001111
|
||||
|
||||
@ -63,13 +71,17 @@ static const char* ImportTadFileList[] =
|
||||
"rom:/data/HNCA.tad"
|
||||
};
|
||||
|
||||
static const char* NandFirmPath = "rom:/data/menu_launcher.nand";
|
||||
static const CopyFileList sCopyFileList[] =
|
||||
{
|
||||
{ "rom:/data/TWLFontTable.dat", "nand:sys/TWLFontTable.dat" }
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
内部変数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
static NAMTitleId titleId;
|
||||
static s16 printLine;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
内部関数定義
|
||||
@ -215,7 +227,7 @@ TwlMain()
|
||||
hw_info_result = WriteHWInfoFile(OS_GetRegion(), OS_IsForceDisableWireless());
|
||||
if (hw_info_result)
|
||||
{
|
||||
kamiFontPrintf( 0, (s16)0, FONT_COLOR_GREEN, "Write Hardware Info Success.");
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Write Hardware Info Success.");
|
||||
break;
|
||||
}
|
||||
else
|
||||
@ -226,7 +238,21 @@ TwlMain()
|
||||
if ( hw_info_result == FALSE)
|
||||
{
|
||||
result = FALSE;
|
||||
kamiFontPrintf( 0, (s16)0, FONT_COLOR_RED, "Write Hardware Info Failure!");
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_RED, "Write Hardware Info Failure!");
|
||||
}
|
||||
|
||||
// 必要なファイルの書き込み
|
||||
for (i=0;i<sizeof(sCopyFileList)/sizeof(sCopyFileList[0]);i++)
|
||||
{
|
||||
if (kamiCopyFile(sCopyFileList[i].srcPath, sCopyFileList[i].dstPath))
|
||||
{
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Write Data File %d Success.", i);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = FALSE;
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_RED, "Write Data File %d Failure!", i);
|
||||
}
|
||||
}
|
||||
|
||||
// TADのインポート開始
|
||||
@ -252,11 +278,11 @@ TwlMain()
|
||||
|
||||
if ( nam_result == NAM_OK)
|
||||
{
|
||||
kamiFontPrintf( 0, (s16)(i+1), FONT_COLOR_GREEN, "List : %d Update Success.", i+1 );
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "List : %d Update Success.", i+1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
kamiFontPrintf( 0, (s16)(i+1), FONT_COLOR_RED, "Error: %d : RetCode = %d", i+1, nam_result );
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_RED, "Error: %d : RetCode = %d", i+1, nam_result );
|
||||
result = FALSE;
|
||||
}
|
||||
}
|
||||
@ -264,10 +290,10 @@ TwlMain()
|
||||
// NANDファームのインストール開始
|
||||
for (j=0;j<MAX_RETRY_COUNT;j++)
|
||||
{
|
||||
nand_firm_result = kamiWriteNandfirm(NandFirmPath, OS_AllocFromMain, OS_FreeToMain);
|
||||
nand_firm_result = kamiWriteNandfirm(NAND_FIRM_PATH_IN_ROM, OS_AllocFromMain, OS_FreeToMain);
|
||||
if (nand_firm_result)
|
||||
{
|
||||
kamiFontPrintf( 0, (s16)(i+1), FONT_COLOR_GREEN, "Firm Update Success.");
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Firm Update Success.");
|
||||
break;
|
||||
}
|
||||
else
|
||||
@ -278,7 +304,7 @@ TwlMain()
|
||||
if ( nand_firm_result == FALSE)
|
||||
{
|
||||
result = FALSE;
|
||||
kamiFontPrintf( 0, (s16)(i+1), FONT_COLOR_RED, "Firm Update Failure!");
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_RED, "Firm Update Failure!");
|
||||
}
|
||||
|
||||
// 更新ログを作成して再実行を防ぐ
|
||||
|
||||
@ -24,11 +24,13 @@ include $(TWLSDK_ROOT)/build/buildtools/commondefs
|
||||
LAUNCHER_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/Launcher
|
||||
MACHINESETTINGS_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/MachineSettings
|
||||
WLANFIRM_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/wlanfirm
|
||||
SHARED_FONT_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/sharedFont
|
||||
NANDFIRM_DIR = $(TWL_IPL_RED_ROOT)/build/nandfirm/menu-launcher
|
||||
|
||||
SUBDIRS = $(LAUNCHER_DIR) \
|
||||
$(MACHINESETTINGS_DIR) \
|
||||
$(WLANFIRM_DIR) \
|
||||
$(SHARED_FONT_DIR) \
|
||||
$(NANDFIRM_DIR) \
|
||||
data \
|
||||
banner \
|
||||
|
||||
Loading…
Reference in New Issue
Block a user