diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/Makefile b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/Makefile new file mode 100644 index 00000000..b306a550 --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/Makefile @@ -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 ===== diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/##about## b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/##about## new file mode 100644 index 00000000..b0a0b372 --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/##about## @@ -0,0 +1,10 @@ +ここ以下にdevとprod用のnandfirmとHNAA,HNBA,HNCA,HNHA,HNLAをオブジェクトファイル化した + +nandfirm.o +hnaa.o +hnba.o +hnca.o +hnha.o +hnla.o + +を配置する \ No newline at end of file diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNAA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNAA.o new file mode 100644 index 00000000..145084bf Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNAA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNBA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNBA.o new file mode 100644 index 00000000..e687b896 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNBA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNCA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNCA.o new file mode 100644 index 00000000..93faa273 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNCA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNHA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNHA.o new file mode 100644 index 00000000..c5786100 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNHA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNLA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNLA.o new file mode 100644 index 00000000..8565c92b Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNLA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/nandfirm.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/nandfirm.o new file mode 100644 index 00000000..459cb429 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/nandfirm.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNAA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNAA.o new file mode 100644 index 00000000..587fe350 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNAA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNBA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNBA.o new file mode 100644 index 00000000..79ed40f4 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNBA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNCA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNCA.o new file mode 100644 index 00000000..d3887188 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNCA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNHA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNHA.o new file mode 100644 index 00000000..383c8226 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNHA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNLA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNLA.o new file mode 100644 index 00000000..3b208339 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNLA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/nandfirm.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/nandfirm.o new file mode 100644 index 00000000..7d818096 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/nandfirm.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/include/process_import_twlc.h b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/include/process_import_twlc.h new file mode 100644 index 00000000..0d28f694 --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/include/process_import_twlc.h @@ -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 + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void* ImportProcessTWLC0(void); +void* ImportProcessTWLC1(void); +void* ImportProcessTWLC2(void); + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // PROCESS_IMPORT_TWLC \ No newline at end of file diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/include/process_nandfirm_twlc.h b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/include/process_nandfirm_twlc.h new file mode 100644 index 00000000..058e2222 --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/include/process_nandfirm_twlc.h @@ -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 + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void* NandfirmProcessTWLC0(void); +void* NandfirmProcessTWLC1(void); +void* NandfirmProcessTWLC2(void); + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // PROCESS_NANDFIRM_TWLC \ No newline at end of file diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/main.rsf b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/main.rsf new file mode 100644 index 00000000..13e4cbcc --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/main.rsf @@ -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) + +} diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/src/process_import_twlc.c b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/src/process_import_twlc.c new file mode 100644 index 00000000..e8174fc7 --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/src/process_import_twlc.c @@ -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 +#include +#include +#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;ipriority -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(¤tSize, &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 +#include +#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; +} diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/Makefile b/build/systemMenu_tools/TWLCaptureSystemWriter/Makefile new file mode 100644 index 00000000..bc9c1ea3 --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/Makefile @@ -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 ===== diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/about.txt b/build/systemMenu_tools/TWLCaptureSystemWriter/about.txt new file mode 100644 index 00000000..2cba8de8 --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/about.txt @@ -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] diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/banner/Makefile b/build/systemMenu_tools/TWLCaptureSystemWriter/banner/Makefile new file mode 100644 index 00000000..01bd65f4 --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/banner/Makefile @@ -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) diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/banner/banner_v3.bsf b/build/systemMenu_tools/TWLCaptureSystemWriter/banner/banner_v3.bsf new file mode 100644 index 00000000..8d127a7a Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/banner/banner_v3.bsf differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/banner/icon/gameicon.bmp b/build/systemMenu_tools/TWLCaptureSystemWriter/banner/icon/gameicon.bmp new file mode 100644 index 00000000..e7d5d619 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/banner/icon/gameicon.bmp differ