NandFormatterを追加。実態としてはNandInitializerの機能制限版のようなもので

ソースファイルはNandInitializerのものを参照しています。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@892 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
kamikawa 2008-03-17 10:46:09 +00:00
parent 5271be0a70
commit 87337e3d4c
14 changed files with 470 additions and 146 deletions

View File

@ -0,0 +1,90 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlSDK - tests - camera-test
# 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$
#----------------------------------------------------------------------------
SUBDIRS =
#----------------------------------------------------------------------------
#============================================================================
# NandInitializerから一部の機能を削除するために定義を追加します。
MACRO_FLAGS += -DNAND_FORMATTER_MODE
#============================================================================
override TARGET_PLATFORM = TWL
override TWL_PROC = ARM7
TWL_ARCHGEN = LIMITED
TWL_NO_STD_PCHDR = True
#TWL_CODEGEN = THUMB
TARGET_TEF = main.tef
LCFILE_SPEC = ../../NandInitializer/ARM7.TWL/main.lsf
LCFILE_TEMPLATE = ../../NandInitializer/ARM7.TWL/racoon.lcf.template
LDRES_TEMPLATE = ../../NandInitializer/ARM7.TWL/racoon.response.template
SRCS = main.c \
kami_pxi.c \
formatter.c \
nvram_misc.c \
initScfg.c \
LINCLUDES = ../../NandInitializer/common/include \
../../NandInitializer/ARM7.TWL/include \
../common/include $(ROOT)/build/libraries/spi/ARM7/include
SRCDIR = ../../NandInitializer/ARM7.TWL/src
#LCFILE = # using default
include $(TWLSDK_ROOT)/build/buildtools/commondefs
ifdef TWLSDK_NOCRYPTO
CCFLAGS += -DSDK_NOCRYPTO
endif
ifndef TWLSDK_NOCRYPTO
MAKELCF_FLAGS += -DUSE_CRYPTO_LIBS='libsea_sp$(TWL_LIBSUFFIX).a libcrypto_sp$(TWL_LIBSUFFIX).a'
MACRO_FLAGS += -DSDK_SEA
endif
ifeq ($(TWL_PLATFORM),BB)
MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037e0000'
else
MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037c0000'
endif
MAKELCF_FLAGS += -DISDBG_LIBS_TWL='$(if $(ISDBG_LIBS_TWL),$(ISDBG_LIBS_TWL),libstubsistd_sp$(TWL_LIBSUFFIX).a)' \
-DISDBG_LIBS_NITRO='libstubsisd_sp$(TWL_LIBSUFFIX).a'
TWL_LIBS_EX = libcamera_sp$(TWL_LIBSUFFIX).a \
libfatfs_sp$(TWL_LIBSUFFIX).a \
libi2c_sp$(TWL_LIBSUFFIX).a \
libcamera_sp$(TWL_LIBSUFFIX).a \
libcdc_sp$(TWL_LIBSUFFIX).a \
libtpex_sp$(TWL_LIBSUFFIX).a
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,110 @@
#! 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$
#----------------------------------------------------------------------------
SUBDIRS =
#----------------------------------------------------------------------------
#============================================================================
#現時点で製品鍵を使った書き込みが行えてはダメなので、デフォルトOFFにしておいてください。
#USE_PRODUCT_KEY = TRUE
#============================================================================
#============================================================================
# NandInitializerから一部の機能を削除するために定義を追加します。
MACRO_FLAGS += -DNAND_FORMATTER_MODE
#============================================================================
TARGET_FIRM = SYSTEMMENU
TARGET_PLATFORM = TWL
TWL_ARCHGEN = LIMITED
#TWL_CODEGEN = THUMB
TITLEID_LO = FMTR
TARGET_TAD = $(BINDIR)/$(TITLEID_LO).$(TWL_BUILD_DIR)$(CODEGEN_ARCH).tad
TARGET_BIN = NandFormatter.srl
LCFILE_SPEC = ../../NandInitializer/ARM9.TWL/ARM9-TS.lsf
ROM_SPEC = ../../NandInitializer/ARM9.TWL/main.rsf
MAKEROM_ARM7_BASE = ../ARM7.TWL/bin/$(TWL_BUILDTYPE_ARM7)/main
MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT)
SRCS = main.c \
kami_pxi.c \
font_data.c \
graphics.c \
keypad.c \
kami_font.c \
cursor.c \
process_format.c \
process_topmenu.c \
process_hw_info.c \
process_fade.c \
sd_event.c \
hwi.c
LINCLUDES = ../../NandInitializer/common/include \
../../NandInitializer/ARM9.TWL/include \
$(ROOT)/build/libraries/lcfg/ARM9.TWL/include \
../../misc/include
SRCDIR = ../../NandInitializer/ARM9.TWL/src \
../../HWInfoWriter/ARM9/src
#LCFILE = # using default
ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),)
ifdef USE_PRODUCT_KEY
MACRO_FLAGS += -DUSE_PRODUCT_KEY
MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo.der'
else
MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo_dev.der'
endif
endif
MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \
-DPRIVKEY_PATH='$(TWL_KEYSDIR)/rsa'
MAKETAD_FLAGS += -s
LLIBRARIES += libes$(TWL_LIBSUFFIX).a \
libboc$(TWL_LIBSUFFIX).a \
libnam$(TWL_LIBSUFFIX).a \
libsea$(TWL_LIBSUFFIX).a \
libacsign_enc$(TWL_LIBSUFFIX).a \
libnamut$(TWL_LIBSUFFIX).a
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib
MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe
LDIRT_CLEAN = $(TARGET_TAD)
#INSTALL_TARGETS = $(TARGET_TAD)
#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,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 \
ARM7.TWL \
ARM9.TWL \
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,49 @@
#! 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: 592 B

View File

@ -11,8 +11,8 @@
in whole or in part, without the prior written consent of Nintendo.
$Date:: $
$Rev:$
$Author:$
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#include <nitro/types.h>
@ -57,28 +57,26 @@ typedef struct FileProperty {
#define FATFS_CLUSTER_SIZE ( 16 * 1024 )
// FATFSのクラスタサイズは16KBなので、データサイズが決まっていないものは、余裕を持たせて16KBにしておく
static const FileProperty s_fileList[] = {
{ 128, "F:/sys/ID.sgn" }, // 現状、全部サイズは適当。中身も空。
{ FATFS_CLUSTER_SIZE, "F:/sys/HWINFO.dat" },
{ FATFS_CLUSTER_SIZE, "F:/shared1/TWLCFG0.dat" },
{ FATFS_CLUSTER_SIZE, "F:/shared1/TWLCFG1.dat" }, // ミラー
// { FATFS_CLUSTER_SIZE, "F:/shared1/WIFICFG0.dat" },
// { FATFS_CLUSTER_SIZE, "F:/shared1/WIFICFG1.dat" }, // ミラー
{ 128, "nand:/sys/ID.sgn" }, // 現状、全部サイズは適当。中身も空。
{ FATFS_CLUSTER_SIZE, "nand:/sys/HWINFO.dat" },
{ FATFS_CLUSTER_SIZE, "nand:/shared1/TWLCFG0.dat" },
{ FATFS_CLUSTER_SIZE, "nand:/shared1/TWLCFG1.dat" }, // ミラー
{ 0, NULL },
};
static const char *s_pDirList0[] = {
(const char *)"sys",
(const char *)"title",
(const char *)"ticket",
(const char *)"shared1",
(const char *)"import",
(const char *)"tmp",
(const char *)"nand:/sys",
(const char *)"nand:/title",
(const char *)"nand:/ticket",
(const char *)"nand:/shared1",
(const char *)"nand:/import",
(const char *)"nand:/tmp",
NULL,
};
static const char *s_pDirList1[] = {
(const char *)"photo",
(const char *)"shared2",
(const char *)"nand2:/photo",
(const char *)"nand2:/shared2",
NULL,
};
@ -118,6 +116,10 @@ ExeFormat(FormatMode format_mode)
// NANDをフォーマット
{
int i;
u8 drive_nand;
u8 drive_nand2;
char drive_nand_path[4];
char drive_nand2_path[4];
/* パーティションサイズをプロンプトから設定 */
u32 partition_MB_size[5];
@ -126,12 +128,27 @@ ExeFormat(FormatMode format_mode)
partition_MB_size[2] = PARTITION_1_SIZE; // FAT1領域
nand_fat_partition_num = NAND_FAT_PARTITION_NUM;
// F G ドライブアンマウント
for( i=0; i<nand_fat_partition_num; i++) {
char drive[4];
STD_TSPrintf( drive, "%c:", 'F'+i);
FATFS_UnmountDrive( drive);
}
// OSMountInfoよりnand&nand2のドライブ割り当てを調べる
{
const OSMountInfo *info;
for (info = OS_GetMountInfo(); *info->drive; ++info)
{
if (!STD_CompareNString( "nand2", info->archiveName, 5 ))
{
drive_nand2 = *(info->drive);
STD_TSPrintf(drive_nand2_path, "%c:", drive_nand2);
}
else if (!STD_CompareNString( "nand", info->archiveName, 4 ))
{
drive_nand = *(info->drive);
STD_TSPrintf(drive_nand_path, "%c:", drive_nand);
}
}
}
// nand nand2 ドライブアンマウント
FATFS_UnmountDrive( drive_nand_path );
FATFS_UnmountDrive( drive_nand2_path );
// NANDのパーティションを指定
// sizeInMB : パーティションサイズをメガバイト単位で格納した配列
@ -139,17 +156,15 @@ ExeFormat(FormatMode format_mode)
if (FATFSi_SetNANDPartitions(partition_MB_size, nand_fat_partition_num))
{
// マウント
if (FATFS_MountDrive("F", FATFS_MEDIA_TYPE_NAND, 0))
if (FATFS_MountDrive(drive_nand_path, FATFS_MEDIA_TYPE_NAND, 0))
{
const char *path = "F:"; // "F:"がFAT0パーティションになる。
// デフォルトドライブ設定
if (!FATFS_SetDefaultDrive(path))
if (!FATFS_SetDefaultDrive(drive_nand_path))
{
return FALSE;
}
// 指定のパスが指すドライブを含むメディア全体を初期化
else if(!FATFS_FormatMedia(path))
else if(!FATFS_FormatMedia(drive_nand_path))
{
return FALSE;
}
@ -159,31 +174,27 @@ ExeFormat(FormatMode format_mode)
return FALSE;
}
// 指定のパスが指すドライブ全体を初期化
else if(!FATFS_FormatDrive(path))
else if(!FATFS_FormatDrive(drive_nand_path))
{
return FALSE;
}
else
{
// F以降のドライブの初期化
// FAT1パーティションの初期化
for (i = 1; i < nand_fat_partition_num; ++i)
{
char drive[4];
STD_TSPrintf(drive, "%c:", 'F' + i);
if(!FATFS_MountDrive(drive, FATFS_MEDIA_TYPE_NAND, (u32)i))
if(!FATFS_MountDrive(drive_nand2_path, FATFS_MEDIA_TYPE_NAND, (u32)i))
{
return FALSE;
}
}
for (i = 1; i < nand_fat_partition_num; ++i)
{
char drive[4];
STD_TSPrintf(drive, "%c:", 'F' + i);
if (format_mode == FORMAT_MODE_FULL && !FATFSi_nandFillPartition( i, init_datbuf, 16))
{
return FALSE;
}
else if (!FATFS_FormatDrive(drive))
else if (!FATFS_FormatDrive(drive_nand2_path))
{
return FALSE;
}
@ -197,29 +208,15 @@ ExeFormat(FormatMode format_mode)
OS_Free( init_datbuf );
// ディレクトリ生成&チェック
if (!CreateDirectory( "F:", s_pDirList0 )) { return FALSE; }
if (!CheckDirectory ( "F:", s_pDirList0 )) { return FALSE; }
if (!CreateDirectory( "G:", s_pDirList1 )) { return FALSE; }
if (!CheckDirectory ( "G:", s_pDirList1 )) { return FALSE; }
if (!CreateDirectory( "nand:", s_pDirList0 )) { return FALSE; }
if (!CheckDirectory ( "nand:", s_pDirList0 )) { return FALSE; }
if (!CreateDirectory( "nand2:", s_pDirList1 )) { return FALSE; }
if (!CheckDirectory ( "nand2:", s_pDirList1 )) { return FALSE; }
// ファイル生成&チェック
if (!CreateFile( &s_fileList[0] )) { return FALSE; }
if (!CheckFile ( &s_fileList[0] )) { return FALSE; }
// F,Gドライブアンマウント
{
int i;
for( i=0; i<nand_fat_partition_num; i++) {
char drive[4];
STD_TSPrintf( drive, "%c:", 'F'+i);
FATFS_UnmountDrive( drive);
}
}
// デフォルトマウント状態に戻しておく
FATFS_MountDrive("F", FATFS_MEDIA_TYPE_NAND, 0);
FATFS_MountDrive("G", FATFS_MEDIA_TYPE_SD, 0);
// 成功
return TRUE;
}

View File

@ -49,6 +49,7 @@ static void VBlankIntr(void);
static void InitializeFatfs(void);
static void InitializeCdc(void);
static void DummyThread(void* arg);
static void RegisterMountInfo(void);
/*---------------------------------------------------------------------------*
@ -98,6 +99,9 @@ void TwlSpMain(void)
(void*)((u32)stack + (sizeof(u32) * 18)), sizeof(u32) * 18, OS_THREAD_PRIORITY_MAX);
OS_WakeupThreadDirect(&thread);
// マウント情報をを強制上書き(暫定処置)
RegisterMountInfo();
// ファイルシステム初期化
FS_Init(FS_DMA_NOT_USE);
FS_CreateReadServerThread(THREAD_PRIO_FS);
@ -418,3 +422,36 @@ VBlankIntr(void)
PM_SelfBlinkProc();
}
}
/*---------------------------------------------------------------------------*
Name: RegisterMountInfo
Description:
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
extern BOOL sdmc_aes_attach_for_nand; // 強制AESマウント用
static void RegisterMountInfo(void)
{
// デフォルトマウント情報リスト
OSMountInfo DefaultSettings[] ATTRIBUTE_ALIGN(4) = {
// drive device target pertitionIdx resource userPermission rsvA B archive path
{ 'A', OS_MOUNT_DEVICE_SD, OS_MOUNT_TGT_ROOT, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "sdmc", "/" },
{ 'B', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_ROOT, 0, OS_MOUNT_RSC_WRAM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "nand", "/" }, // ユーザーアプリはこのアーカイブではWrite不可
{ 'C', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_ROOT, 1, OS_MOUNT_RSC_WRAM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "nand2", "/" }, // ユーザーアプリはこのアーカイブではWrite不可
// { 'D', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_DIR, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "shared2", "nand2:/shared2" },
// { 'E', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_DIR, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "photo", "nand2:/photo" },
// { 'F', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_FILE, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "dataPrv", NULL }, // NANDにセーブデータがないアプリの場合は、マウントされない。
// { 'G', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_FILE, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "dataPub", NULL }, // NANDにセーブデータがないアプリの場合は、マウントされない。
{ 0, },
};
MI_CpuCopy8(DefaultSettings, (void*)OS_GetMountInfo(), sizeof(DefaultSettings));
// 強制AESマウント
sdmc_aes_attach_for_nand = TRUE;
}

View File

@ -35,7 +35,7 @@ TWL_ARCHGEN = LIMITED
TITLEID_LO = NINI
TARGET_TAD = $(BINDIR)/$(TITLEID_LO).$(TWL_BUILD_DIR)$(CODEGEN_ARCH).tad
TARGET_BIN = main.srl
TARGET_BIN = NandInitializer.srl
LCFILE_SPEC = ARM9-TS.lsf
ROM_SPEC = main.rsf
@ -65,7 +65,6 @@ LINCLUDES = ../common/include \
$(ROOT)/build/libraries/lcfg/ARM9.TWL/include
SRCDIR = src \
$(ROOT)/build/demos.TWL/camera/saveShoot-1/src \
../../HWInfoWriter/ARM9/src
#LCFILE = # using default
@ -97,8 +96,8 @@ MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe
LDIRT_CLEAN = $(TARGET_TAD)
INSTALL_TARGETS = $(TARGET_TAD)
INSTALL_DIR = $(SDK_NMENU_DATADIR)
#INSTALL_TARGETS = $(TARGET_TAD)
#INSTALL_DIR = $(SDK_NMENU_DATADIR)
#----------------------------------------------------------------------------

View File

@ -189,7 +189,7 @@ RomSpec
{
Offset 0x00000000
Segment ALL
HostRoot ../data
HostRoot $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/NandInitializer/data
Root /data
File *.*
HostRoot $(PRIVKEY_PATH)

View File

@ -42,7 +42,6 @@ static FSEventHook sSDHook;
*---------------------------------------------------------------------------*/
static void VBlankIntr(void);
static void InitAllocation(void);
static void RegisterMountInfo(void);
/*---------------------------------------------------------------------------*
Name: TwlMain
@ -90,15 +89,14 @@ TwlMain()
// SDカードの挿抜イベント監視コールバック設定
FS_RegisterEventHook("sdmc", &sSDHook, SDEvents, NULL);
// Fドライブ、Gドライブを登録暫定処置
RegisterMountInfo();
// SD起動などあらゆるマウント状態に対応する
/*
FATFS_UnmountDrive("F:");
FATFS_UnmountDrive("G:");
FATFS_MountDrive("F", FATFS_MEDIA_TYPE_NAND, 0);
FATFS_MountDrive("G", FATFS_MEDIA_TYPE_SD, 0);
*/
// NAMライブラリ初期化
NAM_Init( OS_AllocFromMain, OS_FreeToMain);
@ -117,13 +115,14 @@ TwlMain()
// 初期シーケンス設定
sProcess = TopmenuProcess0;
kamiFontPrintfConsole( CONSOLE_ORANGE, "Thank you for using program.\n");
kamiFontPrintfConsole( CONSOLE_ORANGE, "How to \n");
kamiFontPrintfConsole( CONSOLE_ORANGE, "+---------------------------+\n");
kamiFontPrintfConsole( CONSOLE_ORANGE, "l A Button : Select Menu l\n");
kamiFontPrintfConsole( CONSOLE_ORANGE, "l Up/Down Key : Change Menu l\n");
kamiFontPrintfConsole( CONSOLE_ORANGE, "l L&R Button : Auto Init * l\n");
#ifndef NAND_FORMATTER_MODE
kamiFontPrintfConsole( CONSOLE_ORANGE, "l L&R Button : Auto Init l\n");
#endif
kamiFontPrintfConsole( CONSOLE_ORANGE, "+---------------------------+\n");
kamiFontPrintfConsole( CONSOLE_ORANGE, "* Note that nand memory is deleted.\n");
while (1)
{
@ -185,44 +184,3 @@ static void InitAllocation(void)
hh = OS_SetCurrentHeap(OS_ARENA_MAIN, hh);
}
/*---------------------------------------------------------------------------*
Name: RegisterMountInfo
Description: F:G:
NAM関数がマウント情報をもとに一時的にマウントに使用する
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
static void RegisterMountInfo(void)
{
const OSMountInfo info_nand = { 'F', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_ROOT, 0, OS_MOUNT_RSC_WRAM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "nand", "/" };
const OSMountInfo info_sd = { 'G', OS_MOUNT_DEVICE_SD, OS_MOUNT_TGT_ROOT, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "sdmc", "/" };
OSMountInfo* pRegisteredInfo;
BOOL existNAND = FALSE;
BOOL existSD = FALSE;
pRegisteredInfo = (OSMountInfo*)OS_GetMountInfo();
for( ; pRegisteredInfo->drive[0] != '\0'; ++pRegisteredInfo )
{
if ( pRegisteredInfo->drive[0] == 'F') { existNAND = TRUE; }
else if ( pRegisteredInfo->drive[0] == 'G') { existSD = TRUE; }
}
if (!existNAND)
{
MI_CpuCopy8(&info_nand, pRegisteredInfo, sizeof(info_nand));
pRegisteredInfo->drive[0] = 'F';
++pRegisteredInfo;
}
if (!existSD)
{
MI_CpuCopy8(&info_sd, pRegisteredInfo, sizeof(info_sd));
pRegisteredInfo->drive[0] = 'G';
}
}

View File

@ -34,11 +34,25 @@
*---------------------------------------------------------------------------*/
enum {
MENU_EASY_FORMAT=0,
MENU_CHECK_DISK,
#ifndef NAND_FORMATTER_MODE
MENU_NORMAL_FORMAT,
MENU_FILL_FORMAT,
#endif
MENU_RETURN,
NUM_OF_MENU_SELECT
};
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
#define NUM_OF_MENU_SELECT 5
// NANDの簡易フォーマットを実行する際に
// ツリー情報を出力する場合は定義します
//#define DUMP_NAND_TREE
#define DOT_OF_MENU_SPACE 16
#define CURSOR_ORIGIN_X 32
#define CURSOR_ORIGIN_Y 56
@ -85,16 +99,21 @@ void* FormatProcess0(void)
// メニュー一覧
kamiFontPrintf(3, 6, FONT_COLOR_BLACK, "+-------------------+-----+");
kamiFontPrintf(3, 7, FONT_COLOR_BLACK, "l FORMAT <Easy> l l");
kamiFontPrintf(3, 7, FONT_COLOR_BLACK, "l FORMAT l l");
kamiFontPrintf(3, 8, FONT_COLOR_BLACK, "+-------------------+-----+");
kamiFontPrintf(3, 9, FONT_COLOR_BLACK, "l FORMAT <Normal> l l");
kamiFontPrintf(3, 9, FONT_COLOR_BLACK, "l CHECK DISK l l");
kamiFontPrintf(3, 10, FONT_COLOR_BLACK, "+-------------------+-----+");
kamiFontPrintf(3, 11, FONT_COLOR_BLACK, "l FORMAT <Fill ff> l l");
#ifndef NAND_FORMATTER_MODE
kamiFontPrintf(3, 11, FONT_COLOR_BLACK, "l FORMAT <Normal> l l");
kamiFontPrintf(3, 12, FONT_COLOR_BLACK, "+-------------------+-----+");
kamiFontPrintf(3, 13, FONT_COLOR_BLACK, "l CHECK DISK l l");
kamiFontPrintf(3, 13, FONT_COLOR_BLACK, "l FORMAT <Fill FF> l l");
kamiFontPrintf(3, 14, FONT_COLOR_BLACK, "+-------------------+-----+");
kamiFontPrintf(3, 15, FONT_COLOR_BLACK, "l RETURN l l");
kamiFontPrintf(3, 16, FONT_COLOR_BLACK, "+-------------------+-----+");
#else
kamiFontPrintf(3, 11, FONT_COLOR_BLACK, "l RETURN l l");
kamiFontPrintf(3, 12, FONT_COLOR_BLACK, "+-------------------+-----+");
#endif
// 背景全クリア
for (i=0;i<24;i++)
@ -125,12 +144,14 @@ void* FormatProcess0(void)
void* FormatProcess1(void)
{
#ifndef NAND_FORMATTER_MODE
// オート実行用
if (gAutoFlag)
{
sMenuSelectNo = 1;
sMenuSelectNo = MENU_NORMAL_FORMAT;
return FormatProcess2;
}
#endif
// 選択メニューの変更
if ( kamiPadIsRepeatTrigger(PAD_KEY_UP) )
@ -177,8 +198,13 @@ void* FormatProcess2(void)
switch( sMenuSelectNo )
{
case 0: // 擬似フォーマット
// NAMUT_DrawNandTree();
case MENU_EASY_FORMAT: // 簡易フォーマット
#ifdef DUMP_NAND_TREE
NAMUT_DrawNandTree();
#endif
kamiFontPrintf(24, y_pos, FONT_COLOR_GREEN, " WAIT");
kamiFontLoadScreenData();
if (NAMUT_Format())
{
kamiFontPrintf(24, y_pos, FONT_COLOR_GREEN, " OK ");
@ -187,39 +213,32 @@ void* FormatProcess2(void)
{
kamiFontPrintf(24, y_pos, FONT_COLOR_RED, " NG ");
}
// NAMUT_DrawNandTree();
#ifdef DUMP_NAND_TREE
OS_Printf("\n");
NAMUT_DrawNandTree();
#endif
return FormatProcess1;
case 1: // ノーマルフォーマット
sLock = TRUE;
ExeFormatAsync(FORMAT_MODE_QUICK, FormatCallback);
kamiFontPrintf(24, y_pos, FONT_COLOR_BLACK, " ");
return FormatProcess3;
case 2: // フルフォーマット
sLock = TRUE;
ExeFormatAsync(FORMAT_MODE_FULL, FormatCallback);
kamiFontPrintf(24, y_pos, FONT_COLOR_BLACK, " ");
return FormatProcess3;
case 3: // チェックディスク
case MENU_CHECK_DISK: // チェックディスク
{
FATFSDiskInfo info;
BOOL result = FALSE;
kamiFontPrintf(24, y_pos, FONT_COLOR_BLACK, " ");
kamiFontPrintf(24, y_pos, FONT_COLOR_BLACK, " WAIT");
kamiFontLoadScreenData();
FATFS_UnmountDrive("F:");
FATFS_UnmountDrive("G:");
// FATFS_UnmountDrive("F:");
// FATFS_UnmountDrive("G:");
// 指定のNANDパーティション0をFドライブにマウント
if (FATFS_MountDrive("F", FATFS_MEDIA_TYPE_NAND, 0))
// if (FATFS_MountDrive("F", FATFS_MEDIA_TYPE_NAND, 0))
{
// チェックディスク実行
if (FATFS_CheckDisk("F:", &info, TRUE, TRUE, TRUE))
if (FATFS_CheckDisk("nand:", &info, TRUE, TRUE, TRUE))
{
// 指定のNANDパーティション1をGドライブにマウント
if (FATFS_MountDrive("G", FATFS_MEDIA_TYPE_NAND, 1))
// if (FATFS_MountDrive("G", FATFS_MEDIA_TYPE_NAND, 1))
{
// チェックディスク実行
if (FATFS_CheckDisk("G:", &info, TRUE, TRUE, TRUE))
if (FATFS_CheckDisk("nand2:", &info, TRUE, TRUE, TRUE))
{
result = TRUE;
}
@ -228,15 +247,27 @@ void* FormatProcess2(void)
}
// デフォルトマウント状態に戻しておく
FATFS_UnmountDrive("G:");
FATFS_MountDrive("G", FATFS_MEDIA_TYPE_SD, 0);
// FATFS_UnmountDrive("G:");
// FATFS_MountDrive("G", FATFS_MEDIA_TYPE_SD, 0);
if (result == TRUE) { kamiFontPrintf(24, y_pos, FONT_COLOR_GREEN, " OK "); }
else { kamiFontPrintf(24, y_pos, FONT_COLOR_RED, " NG "); }
return FormatProcess1;
}
case 4:
#ifndef NAND_FORMATTER_MODE
case MENU_NORMAL_FORMAT: // ノーマルフォーマット
sLock = TRUE;
ExeFormatAsync(FORMAT_MODE_QUICK, FormatCallback);
kamiFontPrintf(24, y_pos, FONT_COLOR_BLACK, " ");
return FormatProcess3;
case MENU_FILL_FORMAT: // フルフォーマット
sLock = TRUE;
ExeFormatAsync(FORMAT_MODE_FULL, FormatCallback);
kamiFontPrintf(24, y_pos, FONT_COLOR_BLACK, " ");
return FormatProcess3;
#endif
case MENU_RETURN:
FADE_OUT_RETURN( TopmenuProcess0 );
}
}
@ -276,26 +307,25 @@ static void FormatCallback(KAMIResult result, void* /*arg*/)
void* FormatProcess3(void)
{
static s32 progress;
s16 y_pos;
s16 y_pos = (s16)(7 + sMenuSelectNo * CHAR_OF_MENU_SPACE);
// 処理終了判定
if (sLock == FALSE)
{
progress = 0;
#ifndef NAND_FORMATTER_MODE
// Auto用
if (gAutoFlag)
{
if (sFormatResult == TRUE) { FADE_OUT_RETURN( AutoProcess1 ); }
else { FADE_OUT_RETURN( AutoProcess2 ); }
}
#endif
return FormatProcess1;
}
if ( sMenuSelectNo == 0 ) { y_pos = 7; }
else { y_pos = 9; }
// 進捗表示更新
if ( ++progress >= 30*5 )
{

View File

@ -208,12 +208,14 @@ void* HWInfoProcess0(void)
void* HWInfoProcess1(void)
{
#ifndef NAND_FORMATTER_MODE
// オート実行用
if (gAutoFlag)
{
sMenuSelectNo = 0;
return HWInfoProcess2;
}
#endif
// 選択メニューの変更
if ( kamiPadIsRepeatTrigger(PAD_KEY_UP) )
@ -291,12 +293,14 @@ void* HWInfoProcess2(void)
kamiFontPrintf(26, (s16)(7+sMenuSelectNo*CHAR_OF_MENU_SPACE), FONT_COLOR_RED, "NG");
}
#ifndef NAND_FORMATTER_MODE
// Auto用
if (gAutoFlag)
{
if (result) { FADE_OUT_RETURN( AutoProcess1 ); }
else { FADE_OUT_RETURN( AutoProcess2 ); }
}
#endif
return HWInfoProcess1;
}
@ -320,8 +324,8 @@ static BOOL WriteHWInfoFile( u8 region )
static const char *pMsgNormalWriting = "Writing Normal File...";
static const char *pMsgSecureWriting = "Writing Secure File...";
static const char *pMsgSignWriting = "Writing Sign File...";
static const char *pMsgSucceeded = "Succeeded!";
static const char *pMsgFailed = "Failed!";
static const char *pMsgSucceeded = "Success!\n";
static const char *pMsgFailed = "Failed!\n";
BOOL result = TRUE;
// ノーマルファイルのライト
@ -373,8 +377,8 @@ static BOOL DeleteHWInfoFile( void )
{
static const char *pMsgNormalDeleting = "Deleting Normal File...";
static const char *pMsgSecureDeleting = "Deteting Secure File...";
static const char *pMsgSucceeded = "Succeeded!";
static const char *pMsgFailed = "Failed!";
static const char *pMsgSucceeded = "Success!\n";
static const char *pMsgFailed = "Failed!\n";
BOOL result = TRUE;
// ノーマルファイル

View File

@ -37,7 +37,12 @@
*---------------------------------------------------------------------------*/
#ifndef NAND_FORMATTER_MODE
#define NUM_OF_MENU_SELECT 6
#else
#define NUM_OF_MENU_SELECT 2
#endif
#define DOT_OF_MENU_SPACE 16
#define CURSOR_ORIGIN_X 32
#define CURSOR_ORIGIN_Y 56
@ -74,15 +79,21 @@ void* TopmenuProcess0(void)
kamiFontClear();
// バージョン表示
#ifndef NAND_FORMATTER_MODE
kamiFontPrintf(4, 2, 0, "Nand Initializer ver 0.1");
#else
kamiFontPrintf(4, 2, 0, "Nand Formatter ver 0.1");
#endif
// メニュー一覧
kamiFontPrintf(3, 7, FONT_COLOR_BLACK, " FORMAT NAND ");
kamiFontPrintf(3, 9, FONT_COLOR_BLACK, " WRITE HARDWARE INFO ");
#ifndef NAND_FORMATTER_MODE
kamiFontPrintf(3, 11, FONT_COLOR_BLACK, " WRITE ETICKET SIGN ");
kamiFontPrintf(3, 13, FONT_COLOR_BLACK, " INPORT TAD FROM SD ");
kamiFontPrintf(3, 15, FONT_COLOR_BLACK, " INPORT NANDFIRM FROM SD");
kamiFontPrintf(3, 17, FONT_COLOR_BLACK, " INPORT NORFIRM FROM SD");
#endif
// 背景全クリア
for (i=0;i<24;i++)
@ -98,7 +109,7 @@ void* TopmenuProcess0(void)
kamiFontFillChar( 8, BG_COLOR_NONE, BG_COLOR_PURPLE );
kamiFontFillChar( 9, BG_COLOR_PURPLE, BG_COLOR_PURPLE );
kamiFontFillChar(10, BG_COLOR_PURPLE, BG_COLOR_TRANS );
#ifndef NAND_FORMATTER_MODE
kamiFontFillChar(10, BG_COLOR_NONE, BG_COLOR_GRAY );
kamiFontFillChar(11, BG_COLOR_GRAY, BG_COLOR_GRAY );
kamiFontFillChar(12, BG_COLOR_GRAY, BG_COLOR_TRANS );
@ -114,6 +125,7 @@ void* TopmenuProcess0(void)
kamiFontFillChar(16, BG_COLOR_NONE, BG_COLOR_VIOLET );
kamiFontFillChar(17, BG_COLOR_VIOLET, BG_COLOR_VIOLET );
kamiFontFillChar(18, BG_COLOR_VIOLET, BG_COLOR_TRANS );
#endif
// カーソル消去
SetCursorPos((u16)200, (u16)200);
@ -152,11 +164,13 @@ void* TopmenuProcess1(void)
return TopmenuProcess2;
}
#ifndef NAND_FORMATTER_MODE
// L&R同時押しでオート実行
if (kamiPadIsPress(PAD_BUTTON_L) && kamiPadIsPress(PAD_BUTTON_R))
{
FADE_OUT_RETURN( AutoProcess0 );
}
#endif
return TopmenuProcess1;
}
@ -179,6 +193,7 @@ void* TopmenuProcess2(void)
FADE_OUT_RETURN( FormatProcess0 );
case 1:
FADE_OUT_RETURN( HWInfoProcess0 );
#ifndef NAND_FORMATTER_MODE
case 2:
FADE_OUT_RETURN( eTicketProcess0 );
case 3:
@ -187,6 +202,7 @@ void* TopmenuProcess2(void)
FADE_OUT_RETURN( NandfirmProcess0 );
case 5:
FADE_OUT_RETURN( NorfirmProcess0 );
#endif
}
return TopmenuProcess1;