TWLCaptureSystemWriter: 量産機ベースで動作するTWLCapture生産工程用の書込みツール

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2733 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
aoki_ryoma 2009-01-16 07:06:19 +00:00
parent 0af40109e2
commit 5a4d921ab4
24 changed files with 1144 additions and 0 deletions

View File

@ -0,0 +1,154 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlIPL - systemMenu_RED - NandInitializer
# File: Makefile
#
# Copyright 2007 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$
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
#============================================================================
#製品鍵を使った書き込みを行う場合は、TwlIPL/build/buildtools/commondefsの"FIRM_USE_PRODUCT_KEYS=TRUE"を有効にしてください。
#============================================================================
#============================================================================
# NandInitializerRedと同様の動作をしますが自動フォーマットが強制的に実行され停止します。
MACRO_FLAGS += -DAUTO_FORMAT_MODE
#============================================================================
#============================================================================
# ワイヤレスの強制Disableフラグを設定可能にする場合定義します。要:Make Clean
#MACRO_FLAGS += -DUSE_WIRELESS_FORCE_DISABLE_SETTING
#============================================================================
#============================================================================
# 各種データを書き込み可能にする場合定義します。(要:Make Clean
# 具体的には TWLFontTable.dat wrap.bin cert.sys の3つです。
#MACRO_FLAGS += -DUSE_WRITE_VARIOUS_DATA
#============================================================================
#============================================================================
# dev.kpを書き込み可能にする場合定義します。要:Make Clean
#MACRO_FLAGS += -DWRITE_DEVKP_ENABLE
#============================================================================
#============================================================================
# マリクラデバッグ用として作成する場合定義します。(要:Make Clean
# ・自動処理において"nand:/shared2/launcher/wrap.bin"を作成します。
# ・自動処理において開発用CLSの証明書(cert.sys)を書き込みます。
# ・自動処理の最後に本体初期化を行います。
#MACRO_FLAGS += -DMARIOCLUB_VERSION
#============================================================================
MACRO_FLAGS += -DTWL_CAPTURE_VERSION
SYSM_DISABLE_DEBUG = FALSE
TARGET_FIRM = SYSTEMMENU
TARGET_PLATFORM = TWL
TWL_ARCHGEN = LIMITED
#TARGET_CODEGEN = THUMB
TITLEID_LO = 0NOA
#TARGET_TAD =
TARGET_BIN = TWLCaptureSystemWriter.srl
LCFILE_SPEC = ARM9-TS.lsf
ROM_SPEC = main.rsf
MAKEROM_ARM7_BASE = ../../NandInitializerRed/ARM7.TWL/bin/$(TWL_BUILDTYPE_ARM7)/armadillo
MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT)
SRCS = main.c \
kami_pxi.c \
font_data.c \
graphics.c \
keypad.c \
kami_font.c \
kami_write_nandfirm.c \
cursor.c \
process_format.c \
process_topmenu.c \
process_eticket.c \
process_import_twlc.c \
process_nandfirm_twlc.c \
process_norfirm.c \
process_auto.c \
process_fade.c \
process_mcu.c \
process_wireless_setting.c \
hwi.c \
debugger_hw_reset_control.c
LINCLUDES = ./include \
../../NandInitializerRed/common/include \
../../NandInitializerRed/ARM9.TWL/include \
$(ROOT)/build/libraries/lcfg/ARM9.TWL/include \
../../common/ARM9/include
SRCDIR = ./src \
../../NandInitializerRed/ARM9.TWL/src \
../../HWInfoWriter/ARM9/src \
../../common/ARM9/src
#LCFILE = # using default
#----------------------------------------------------------------------------
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
ifdef FIRM_USE_PRODUCT_KEYS
DATA_DIR = prod
else
DATA_DIR = dev
endif
MAKELCF_FLAGS += -DNANDFIRM_OBJ=./data/$(DATA_DIR)/nandfirm.o \
-DHNAA_OBJ=./data/$(DATA_DIR)/HNAA.o \
-DHNBA_OBJ=./data/$(DATA_DIR)/HNBA.o \
-DHNCA_OBJ=./data/$(DATA_DIR)/HNCA.o \
-DHNHA_OBJ=./data/$(DATA_DIR)/HNHA.o \
-DHNLA_OBJ=./data/$(DATA_DIR)/HNLA.o
MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \
-DCARD_REGION='$(CARD_REGION)' \
-DDISABLE_DEBUG='$(SYSM_DISABLE_DEBUG)'
MAKETAD_FLAGS += -s
SYSMENU_LIBS = \
libnamut$(TWL_LIBSUFFIX).a
SDK_APPEND_LIBS = \
libes$(TWL_LIBSUFFIX).a \
libboc$(TWL_LIBSUFFIX).a \
libsfs$(TWL_LIBSUFFIX).a \
libnam$(TWL_LIBSUFFIX).a \
libsea$(TWL_LIBSUFFIX).a \
liblcfg$(TWL_LIBSUFFIX).a \
libna$(TWL_LIBSUFFIX).a
LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS)
MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe
#LDIRT_CLEAN =
#INSTALL_TARGETS =
#INSTALL_DIR = $(SDK_NMENU_DATADIR)
#----------------------------------------------------------------------------
do-build: $(TARGETS)
#include $(TWLSDK_ROOT)/build/buildtools/modulerules
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,10 @@
ここ以下にdevとprod用のnandfirmとHNAA,HNBA,HNCA,HNHA,HNLAをオブジェクトファイル化した
nandfirm.o
hnaa.o
hnba.o
hnca.o
hnha.o
hnla.o
を配置する

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - NandInitializer
File: process_import_twlc.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 PROCESS_IMPORT_TWLC
#define PROCESS_IMPORT_TWLC
#ifdef __cplusplus
extern "C" {
#endif
/*===========================================================================*/
#include <twl.h>
/*---------------------------------------------------------------------------*
ŠÖ<EFBFBD>è`
*---------------------------------------------------------------------------*/
void* ImportProcessTWLC0(void);
void* ImportProcessTWLC1(void);
void* ImportProcessTWLC2(void);
/*===========================================================================*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif // PROCESS_IMPORT_TWLC

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - NandInitializer
File: process_nandfirm_twlc.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 PROCESS_NANDFIRM_TWLC
#define PROCESS_NANDFIRM_TWLC
#ifdef __cplusplus
extern "C" {
#endif
/*===========================================================================*/
#include <twl.h>
/*---------------------------------------------------------------------------*
ŠÖ<EFBFBD>è`
*---------------------------------------------------------------------------*/
void* NandfirmProcessTWLC0(void);
void* NandfirmProcessTWLC1(void);
void* NandfirmProcessTWLC2(void);
/*===========================================================================*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif // PROCESS_NANDFIRM_TWLC

View File

@ -0,0 +1,245 @@
#----------------------------------------------------------------------------
# Project: TwlSDK - include
# File: ROM-TS.rsf
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded insructions, 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$
#----------------------------------------------------------------------------
#
# TWL ROM SPEC FILE
#
Arm9
{
Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)"
OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)"
OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)"
Elf "$(MAKEROM_ARM9:r).tef"
}
Arm7
{
Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)"
OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)"
OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)"
Elf "$(MAKEROM_ARM7_BASE:r).tef"
}
Arm9.Ltd
{
Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)"
OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)"
OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)"
}
Arm7.Ltd
{
Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)"
OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)"
OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)"
}
Property
{
###
### Settings for FinalROM
###
#### BEGIN
#
# TITLE NAME: Your product name within 12bytes
#
TitleName "SysLogReader"
#
# MAKER CODE: Your company ID# in 2 ascii words
# issued by NINTENDO
#
MakerCode 01
#
# REMASTER VERSION: Mastering version
#
#RomVersion 0
#
# ROM SPEED TYPE: [MROM/1TROM/UNDEFINED]
#
RomSpeedType $(MAKEROM_ROMSPEED)
#
# ROM SIZE: in bit [64M/128M/256M/512M/1G/2G]
#
#RomSize 128M
#RomSize 256M
#
# ROM PADDING: TRUE if finalrom
#
#RomFootPadding TRUE
#
# ROM HEADER TEMPLATE: Provided to every product by NINTENDO
#
# RomHeaderTemplate $(ROM_HEADER_TEMPLATE)
#
# BANNER FILE: generated from Banner Spec File
#
#BannerFile ./etc/myGameBanner.bnr
BannerFile ../banner/banner.bnr
#
# Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE]
#
#PermitLandingNormalJump FALSE
#
# Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE]
#
#PermitLandingTmpJump FALSE
###
### Setting for TWL
###
#
# ROM HEADER Ltd: Provided to every product by NINTENDO
#
RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin
#
# Digest parameters:
#
DigestParam 1024 32
#
# WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD
# MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD]
# don't have to edit
#
WramMapping MAP_TS_SCR
#
# CardRegion: card region [Japan/America/Europe/Australia/China/Korea]
#
CardRegion ALL
#
# CommonClientKey: launcher deliver common client Key [TRUE/FALSE]
#
CommonClientKey TRUE
#
# HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE]
#
HwAESSlotB TRUE
#
# HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE]
#
#HwAESSlotC FALSE
#
# SDCardAccess: sd card access control [TRUE/FALSE]
#
SDCardAccess TRUE
#
# NANDAccess: NAND access control [TRUE/FALSE]
#
#NANDAccess FALSE
NANDAccess TRUE
#
# Codec mode:
# don't have to edit
#
CodecMode $(MAKEROM_CODEC_MODE)
#
# Disp WiFiConnection Icon for Launcher [TRUE/FALSE]
#
#WiFiConnectionIcon FALSE
#
# Disp DSWireless Icon for Launcher [TRUE/FALSE]
#
#DSWirelessIcon FALSE
LockSCFG TRUE
###
#### END
}
AppendProperty
{
#
# Publisher : "Nintendo"
# don't have to edit
Publisher Nintendo
#
# Application type : [USER/SYSTEM]
# don't have to edit
AppType SYSTEM
#
# launch title on the launcher : [TRUE/FALSE]
# don't have to edit
Launch TRUE
#
# Boot allowed Media: [GameCard]
#
Media GameCard
#
# Data only title : [TRUE/FALSE]
# don't have to edit
#DataOnly FALSE
#
# Secure title : [TRUE/FALSE]
# don't have to edit
Secure TRUE
#
# GameCode for TitleID : Your GameCode in 4 ascii words
#
GameCode $(TITLEID_LO)
#
# Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M]
#
#PublicSaveDataSize 32K
#
# Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M]
#
#PrivateSaveDataSize 16K
#
# Enable SubBannerFile
#SubBannerFile TRUE
}
RomSpec
{
Offset 0x00000000
Segment ALL
HostRoot $(MAKEROM_ROMROOT)
Root /
File $(MAKEROM_ROMFILES)
}

View File

@ -0,0 +1,391 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - NandInitializer
File: process_import_twlc.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 <twl/nam.h>
#include <sysmenu/namut.h>
#include "kami_pxi.h"
#include "kami_font.h"
#include "process_topmenu.h"
#include "process_import_twlc.h"
#include "process_auto.h"
#include "process_fade.h"
#include "cursor.h"
#include "keypad.h"
#include "common_utility.h"
#define NUM_IMPORT_TAD 5
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
// tad格納先のシンボル
extern void *hnaa_begin, *hnaa_end, *hnba_begin, *hnba_end, *hnca_begin, *hnca_end,
*hnha_begin, *hnha_end, *hnla_begin, *hnla_end;
static char* sFilename[] = {"HNAA", "HNBA", "HNCA", "HNHA", "HNLA" };
static void* spFileBegin[] = { &hnaa_begin, &hnba_begin, &hnca_begin, &hnha_begin, &hnla_begin};
static void* spFileEnd[] = { &hnaa_end, &hnba_end, &hnca_end, &hnha_end, &hnla_end};
static vu8 sNowImport = FALSE;
static void* spStack;
static u32 sCurrentProgress;
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
BOOL ImportTadTWLC(void* symbolBegin, void* symbolEnd);
static void ProgressThread(void*);
static void Destructor(void* /*arg*/);
void ProgressInit(void);
void ProgressDraw(f32 ratio);
static BOOL DumpTadInfo(FSFile *pInfo);
void* ImportProcessTWLC0(void)
{
int i;
// 文字列全クリア
kamiFontClear();
// バージョン表示
kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Import TAD from SD");
kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------");
// メニュー一覧
kamiFontPrintf(3, 4, FONT_COLOR_BLACK, "+--------------------+----+");
kamiFontPrintf(3, 5, FONT_COLOR_BLACK, "l OVERWRITE ALL l l");
kamiFontPrintf(3, 6, FONT_COLOR_BLACK, "+--------------------+----+");
kamiFontPrintf(3, 7, FONT_COLOR_BLACK, "l WRITE NONEXISTENT l l");
kamiFontPrintf(3, 8, FONT_COLOR_BLACK, "+--------------------+----+");
kamiFontPrintf(3, 9, FONT_COLOR_BLACK, "l SELECT FILE >> l l");
kamiFontPrintf(3, 10, FONT_COLOR_BLACK, "+--------------------+----+");
kamiFontPrintf(3, 11, FONT_COLOR_BLACK, "l RETURN l l");
kamiFontPrintf(3, 12, FONT_COLOR_BLACK, "+--------------------+----+");
// 背景全クリア
for (i=0;i<24;i++)
{
kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS );
}
// 背景上部
kamiFontFillChar( 0, BG_COLOR_PINK, BG_COLOR_PINK );
kamiFontFillChar( 1, BG_COLOR_PINK, BG_COLOR_PINK );
kamiFontFillChar( 2, BG_COLOR_PINK, BG_COLOR_TRANS );
// カーソル消去
SetCursorPos((u16)200, (u16)200);
FADE_IN_RETURN( ImportProcessTWLC1 );
}
void* ImportProcessTWLC1(void)
{
// オート実行用
if (gAutoFlag)
{
return ImportProcessTWLC2;
}
// can't reach
return ImportProcessTWLC1;
}
static void* ImportProcessTWLC2(void)
{
int i;
BOOL result = TRUE;
kamiFontPrintf(25, 5, FONT_COLOR_BLACK, "WAIT");
for (i=0;i<NUM_IMPORT_TAD;i++)
{
kamiFontPrintfConsole(CONSOLE_ORANGE, "import begin: %s\n", sFilename[i]) ;
// 強制上書き
if (ImportTadTWLC(spFileBegin[i], spFileEnd[i]) == FALSE)
{
result = FALSE;
}
}
if (result) { kamiFontPrintf(25, 5, FONT_COLOR_GREEN, " OK "); }
else { kamiFontPrintf(25, 5, FONT_COLOR_RED, " NG "); }
// Auto用
if (gAutoFlag)
{
if (result)
{
gAutoProcessResult[AUTO_PROCESS_MENU_IMPORT_TAD] = AUTO_PROCESS_RESULT_SUCCESS;
FADE_OUT_RETURN( AutoProcess1 );
}
else
{
gAutoProcessResult[AUTO_PROCESS_MENU_IMPORT_TAD] = AUTO_PROCESS_RESULT_FAILURE;
FADE_OUT_RETURN( AutoProcess2 );
}
}
return ImportProcessTWLC1;
}
#define THREAD_STACK_SIZE (16*1024)
BOOL ImportTadTWLC(void* symbolBegin, void* symbolEnd)
{
NAMTadInfo tadInfo;
FSFile file;
u32 filesize = (u32)symbolEnd - (u32)symbolBegin;
s32 nam_result = NAM_OK;
OSThread thread;
FS_InitFile(&file);
// メモリ上からtadとしてオープンするためにメモリ上にcreateして中身をコピー
kamiFontPrintfConsole(CONSOLE_ORANGE, "tad open from memory.\n") ;
FS_CreateFileFromMemory(&file, symbolBegin, filesize);
if( !DumpTadInfo(&file))
{
goto error_proc;
}
// 同titleIDのtadが既にインポートされているかチェック
// そんざいするばあいは、まずそれを削除してからインポートする
kamiFontPrintfConsole(CONSOLE_ORANGE, "imported tad check.\n") ;
// 情報を取得
nam_result = NAM_ReadTadInfoWithFile(&tadInfo, &file);
if(nam_result != NAM_OK)
{
goto error_proc;
}
nam_result = NAM_WasTitleInstalled(tadInfo.titleInfo.titleId);
if(nam_result == NAM_INSTALLED )
{
kamiFontPrintfConsole(CONSOLE_ORANGE, "matched tad is found.\n") ;
// tad削除
kamiFontPrintfConsole(CONSOLE_ORANGE, "delete tad completely.\n") ;
nam_result = NAM_DeleteTitleCompletely(tadInfo.titleInfo.titleId);
if( nam_result != NAM_OK )
{
goto error_proc;
}
}
else if( nam_result == NAM_NOT_INSTALLED )
{
kamiFontPrintfConsole(CONSOLE_ORANGE, "matched tad isn't found.\n") ;
}
else
{
// INSTALLEDとNOT_INSTALLED以外はエラー
goto error_proc;
}
// 進捗管理用スレッドを立てる
spStack = OS_Alloc(THREAD_STACK_SIZE);
OS_CreateThread(&thread, ProgressThread, NULL,
(void*)((u32)spStack + THREAD_STACK_SIZE), THREAD_STACK_SIZE,
OS_GetCurrentThread()->priority -1);
OS_SetThreadDestructor(&thread, Destructor);
OS_WakeupThreadDirect(&thread);
// Import開始
OS_Printf( "Import Start.\n" );
kamiFontPrintfConsole(CONSOLE_ORANGE, "Import Start.\n");
nam_result = NAM_ImportTadWithFile(&file);
// インポートが終わるまで待つ
while(sNowImport){};
OS_WaitVBlankIntr();
if(nam_result != NAM_OK)
{
goto error_proc;
}
kamiFontPrintfConsole(CONSOLE_ORANGE, "Import finished.\n");
FS_CloseFile(&file);
NAMUT_UpdateSoftBoxCount();
return TRUE;
error_proc:
// エラーの事後処理
kamiFontPrintfConsole(CONSOLE_RED, "\nfail! errorcode: %d.\n", nam_result) ;
FS_CloseFile(&file);
NAMUT_UpdateSoftBoxCount();
return FALSE;
}
/*---------------------------------------------------------------------------*
Name: ProgressThread
Description: .tad
100%
Arguments: arg - 使
Returns: None.
*---------------------------------------------------------------------------*/
static void ProgressThread(void* /*arg*/)
{
u32 currentSize;
u32 totalSize = 0;
u32 totalSizeBk = 0;
ProgressInit();
while (TRUE)
{
NAM_GetProgress(&currentSize, &totalSize);
if ((totalSize > 0 && totalSize == currentSize) || totalSizeBk > totalSize)
{
// 既にインポートが終了
ProgressDraw((f32)1.0);
break;
}
else if (totalSize > 0)
{
ProgressDraw((f32)currentSize/totalSize);
}
totalSizeBk = totalSize;
// Vブランク待ち
OS_WaitVBlankIntr();
}
sNowImport = FALSE;
}
static void Destructor(void* /*arg*/)
{
OS_Free(spStack);
}
/*---------------------------------------------------------------------------*
Name: ProgressInit
Description:
Arguments:
Returns: None.
*---------------------------------------------------------------------------*/
void ProgressInit(void)
{
sCurrentProgress = 0;
}
/*---------------------------------------------------------------------------*
Name: ProgressDraw
Description:
Arguments:
Returns: None.
*---------------------------------------------------------------------------*/
void ProgressDraw(f32 ratio)
{
char square[2] = { 0x01, 0x00 };
u32 temp;
s32 i;
temp = (u32)(32 * ratio);
if (temp > sCurrentProgress)
{
s32 diff = (s32)(temp - sCurrentProgress);
for (i=0;i<diff;i++)
{
kamiFontPrintfConsole(2, square);
}
}
sCurrentProgress = temp;
// フォントスクリーンデータロード
kamiFontLoadScreenData();
}
/*---------------------------------------------------------------------------*
Name: DumpTadInfo
Description: .tad
Arguments: arg - 使
Returns: TRUE,FALSEを返します.
*---------------------------------------------------------------------------*/
static BOOL DumpTadInfo(FSFile *pFile)
{
NAMTadInfo info;
s32 nam_result;
// TADファイルの情報取得
if ((nam_result = NAM_ReadTadInfoWithFile(&info, pFile)) == NAM_OK)
{
char temp[100];
u16 companyCode = MI_SwapEndian16(info.titleInfo.companyCode);
u32 gameCode = (u32)(info.titleInfo.titleId & 0xffffffff);
gameCode = MI_SwapEndian32(gameCode);
kamiFontPrintfConsole(CONSOLE_ORANGE, "------ tad profile -----\n");
// File Size
kamiFontPrintfConsole(CONSOLE_ORANGE, "fileSize = %d Byte\n", info.fileSize);
// Company Code
MI_CpuCopy8( &companyCode, temp, sizeof(companyCode) );
temp[sizeof(companyCode)] = NULL;
kamiFontPrintfConsole(CONSOLE_ORANGE, "Company Code = %s\n", temp);
// Game Code
MI_CpuCopy8( &gameCode, temp, sizeof(gameCode) );
temp[sizeof(gameCode)] = NULL;
kamiFontPrintfConsole(CONSOLE_ORANGE, "GameCode Code = %s\n", temp);
// Game Version
kamiFontPrintfConsole(CONSOLE_ORANGE, "GameVersion = %d\n", info.titleInfo.version);
// Public Save Size
kamiFontPrintfConsole(CONSOLE_ORANGE, "PublicSaveSize = %d\n", info.titleInfo.publicSaveSize);
// Private Save Size
kamiFontPrintfConsole(CONSOLE_ORANGE, "PrivateSaveSize = %d\n", info.titleInfo.privateSaveSize);
kamiFontPrintfConsole(CONSOLE_ORANGE, "--------------------------\n");
return TRUE;
}
else
{
kamiFontPrintfConsole(CONSOLE_RED, "Fail! retcode=%x\n", nam_result);
return FALSE;
}
}

View File

@ -0,0 +1,156 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL - Tools - TWLCaptureSystemWriter
File: process_nandfirm_twlc.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$
*---------------------------------------------------------------------------*/
// ログファイルの書き出しが終わった後に、ROMの指定された位置に格納されたnandfirmを本体に書き戻す
// NandInitializerRed内のprocess_nandfirm.cを上書き
#include <twl.h>
#include <twl/nam.h>
#include "kami_pxi.h"
#include "kami_font.h"
#include "process_topmenu.h"
#include "process_nandfirm_twlc.h"
#include "process_import_twlc.h"
#include "process_auto.h"
#include "process_fade.h"
#include "cursor.h"
#include "keypad.h"
#include "kami_write_nandfirm.h"
#include "common_utility.h"
#define NAND_BLOCK_BYTE 0x200
#define NAND_START_OFFSET 0x200
#define NANDFIRM_FILE_START_OFFSET 0x200
// nandfirm格納先シンボル
extern void* nandfirm_begin;
extern void* nandfirm_end;
static BOOL writebackFirm( void );
void* NandfirmProcessTWLC0( void )
{
int i;
kamiFontClear();
// バージョン表示
kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Import NandFirm from SD");
kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------");
// 背景全クリア
for (i=0;i<24;i++)
{
kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS );
}
// 背景上部
kamiFontFillChar( 0, BG_COLOR_GREEN, BG_COLOR_GREEN );
kamiFontFillChar( 1, BG_COLOR_GREEN, BG_COLOR_GREEN );
kamiFontFillChar( 2, BG_COLOR_GREEN, BG_COLOR_TRANS );
// メニュー一覧
kamiFontPrintf((s16)3, (s16)4, FONT_COLOR_BLACK, "+--------------------+----+");
kamiFontPrintf((s16)3, (s16)5, FONT_COLOR_BLACK, "l %-16.16s l l", "included_file");
kamiFontPrintf((s16)3, (s16)6, FONT_COLOR_BLACK, "l RETURN l l");
kamiFontPrintf((s16)3, (s16)7, FONT_COLOR_BLACK, "+--------------------+----+");
// カーソル消去
SetCursorPos((u16)200, (u16)200);
FADE_IN_RETURN( NandfirmProcessTWLC1 );
}
void* NandfirmProcessTWLC1(void)
{
BOOL ret;
ret = writebackFirm();
if( ret )
{
gAutoProcessResult[AUTO_PROCESS_MENU_IMPORT_NANDFIRM] = AUTO_PROCESS_RESULT_SUCCESS;
kamiFontPrintfConsole(CONSOLE_ORANGE, "nandfirm write succeeded.") ;
FADE_OUT_RETURN(AutoProcess1);
}
else
{
gAutoProcessResult[AUTO_PROCESS_MENU_IMPORT_NANDFIRM] = AUTO_PROCESS_RESULT_FAILURE;
kamiFontPrintfConsole(CONSOLE_RED, "nandfirm write failed.") ;
FADE_OUT_RETURN(AutoProcess2);
}
}
static BOOL writebackFirm( void )
{
u8 *pBuf;
u8 *pVerifyBuf;
u32 allocSize;
u32 fileSize = (u32)(&nandfirm_end) - (u32)(&nandfirm_begin);
u32 nandfirmSize = fileSize - NANDFIRM_FILE_START_OFFSET;
u32 writeBlock;
u16 crc1,crc2;
BOOL ret = TRUE;
if( 800*1024 < fileSize )
{
kamiFontPrintfConsole(CONSOLE_RED, "too large file size." );
return FALSE;
}
// 書き込みサイズは512バイトのブロック単位なのでそれに配慮
allocSize = MATH_ROUNDUP(fileSize, 512);
pBuf = OS_Alloc(allocSize);
if(pBuf == NULL)
{
kamiFontPrintfConsole(CONSOLE_RED, "Alloc failed." );
return FALSE;
}
// データの読み出し
MI_CpuClear8(pBuf, allocSize);
DC_FlushRange(pBuf, allocSize);
MI_CpuCopy8( &nandfirm_begin, pBuf, fileSize);
// データの書き出し
writeBlock = fileSize/NAND_BLOCK_BYTE + (fileSize % NAND_BLOCK_BYTE != 0);
DC_FlushRange(pBuf, allocSize);
kamiFontPrintfConsole(CONSOLE_ORANGE, "nandfirm writing..." );
kamiNandWrite( NAND_START_OFFSET/NAND_BLOCK_BYTE, pBuf+NANDFIRM_FILE_START_OFFSET, writeBlock);
/*
// 書き込み後のCRCチェックを一応やっておく
pVerifyBuf = OS_Alloc(allocSize);
if (kamiNandRead(NAND_START_OFFSET/NAND_BLOCK_BYTE, pVerifyBuf, writeBlock ) == KAMI_RESULT_SEND_ERROR)
{
kamiFontPrintfConsoleEx(1, "kamiNandRead ... %s!\n", "ERROR");
}
DC_FlushRange(pVerifyBuf, allocSize);
crc1 = SVC_GetCRC16( 0xffff, pBuf, fileSize );
crc2 = SVC_GetCRC16( 0xffff, pVerifyBuf, fileSize );
if(crc1 != crc2)
{
ret = FALSE;
}
OS_Free(pVerifyBuf);*/
OS_Free(pBuf);
return ret;
}

View File

@ -0,0 +1,34 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlSDK - tests - camera
# File: Makefile
#
# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = \
banner \
../NandInitializerRed/ARM7.TWL \
ARM9.TWL
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,20 @@
##概要
量産ベースで動作するTWLCaptureの生産工程で使用する書込みツール
NandInitializerの機能をベースに
・sdmcブートではなくmemory-launcherからのブートを前提
同ディレクトリからtadを検索するのではなく、objectファイルとしてromに内包
・書き込むtadはhnaa,hnba,hnca,hnha,hnlaに決め打ち
・HWInfoなどを書き込まない
といった変更を施したもの
##つかいかた
1. ARM9.TWL/data/dev,prod以下に書き込むtadファイルとnandfirmを入れる
既にオブジェクトファイル化したものがあるならそれでもOK、
ただし、[gamecode].beginと[gamecode].endを
開始、終了位置シンボルとして埋め込んでいないと駄目)
2. ./make.rb [dev または prod または full]

View File

@ -0,0 +1,47 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlIPL
# File: Makefile
#
# Copyright 2007 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_IPL_RED_ROOT)/build/buildtools/commondefs
ICON_DIR = ./icon
BANNER_ICON = $(ICON_DIR)/gameIcon.bmp
BANNER_SPEC = banner_v3.bsf
TARGETS = banner.bnr
INSTALL_DIR = ./
INSTALL_TARGETS = $(TARGETS)
BANNER_ICON_NAME = $(basename $(BANNER_ICON))
LDIRT_CLEAN = $(TARGETS) \
$(BANNER_ICON_NAME).nbfs \
$(BANNER_ICON_NAME).nbfc \
$(BANNER_ICON_NAME).nbfp \
$(TARGETS:.bnr=.srl)
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
#----------------------------------------------------------------------------
# build
#----------------------------------------------------------------------------
do-build: $(TARGETS)
$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON)
$(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \
$(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS)

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B