mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
(佐々木@PSEG1)CSUのMakefileにロムチェック省略のオプションを追加
DISABLE_ROMCHECK=TRUEでロムチェックを無効(規定のtad以外を追加できるようになる) romchecker, sumaker のパス文字列の扱いをより安全な形に変更 git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2303 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
7977d290bf
commit
d918110d49
@ -116,9 +116,9 @@ LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS)
|
||||
MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe
|
||||
|
||||
#LDIRT_CLEAN =
|
||||
#INSTALL_TARGETS =
|
||||
INSTALL_DIR = $(SDK_NMENU_DATADIR)
|
||||
#INSTALL_DIR = $(TWL_IPL_RED_ROOT)/build/tests/CustomSystemUpdater/bin
|
||||
INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN)
|
||||
#INSTALL_DIR = $(SDK_NMENU_DATADIR)
|
||||
INSTALL_DIR = ../bin
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
@ -128,7 +128,12 @@ INSTALL_DIR = $(SDK_NMENU_DATADIR)
|
||||
.PHONY: build_time check_rom sumaker
|
||||
|
||||
check_rom:
|
||||
$(ROM_CHECKER) $(DATA_ROOT)/$(ROMSET)
|
||||
ifeq ($(DISABLE_ROMCHECK),)
|
||||
$(ROM_CHECKER) $(ROMSET)
|
||||
endif
|
||||
#ifeq ($(DISABLE_ROMCHECK),)
|
||||
# $(ROM_CHECKER) $(DATA_ROOT)/$(ROMSET)
|
||||
#endif
|
||||
|
||||
build_time:
|
||||
echo -n "#define BUILD_TIME \"`date \"+%Y/%m/%d %H:%M:%S\"`\"" > include/build_time.h
|
||||
|
||||
@ -1,229 +0,0 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: SystemUpdater
|
||||
# File: main.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 "YourAppName"
|
||||
|
||||
#
|
||||
# MAKER CODE: Your company ID# in 2 ascii words
|
||||
# issued by NINTENDO
|
||||
#
|
||||
#MakerCode "00"
|
||||
|
||||
#
|
||||
# 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 64M
|
||||
|
||||
#
|
||||
# ROM PADDING: TRUE if finalrom
|
||||
#
|
||||
#RomFootPadding TRUE
|
||||
|
||||
#
|
||||
# ROM HEADER TEMPLATE: Provided to every product by NINTENDO
|
||||
#
|
||||
#RomHeaderTemplate ./etc/rom_header.template.sbin
|
||||
|
||||
#
|
||||
# BANNER FILE: generated from Banner Spec File
|
||||
#
|
||||
BannerFile ../banner/banner_EUR.bnr
|
||||
|
||||
###
|
||||
### 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]
|
||||
# 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]
|
||||
#
|
||||
# ========= SystemUpdaterは特別な鍵を使う =========
|
||||
CommonClientKey TRUE
|
||||
#CommonClientKeyForDebugger TRUE
|
||||
|
||||
#
|
||||
# HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE]
|
||||
#
|
||||
HwAESSlotB TRUE
|
||||
|
||||
#
|
||||
# HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE]
|
||||
#
|
||||
HwAESSlotC TRUE
|
||||
|
||||
#
|
||||
# SDCardAccess: sd card access control [TRUE/FALSE]
|
||||
#
|
||||
SDCardAccess TRUE
|
||||
|
||||
#
|
||||
# NANDAccess: NAND access control [TRUE/FALSE]
|
||||
#
|
||||
NANDAccess TRUE
|
||||
|
||||
#
|
||||
# Codec mode:
|
||||
# don't have to edit
|
||||
#
|
||||
CodecMode $(MAKEROM_CODEC_MODE)
|
||||
|
||||
#
|
||||
# DisableDebug :最終ROMでは、実行時にデバッグできないようにTRUEにする必要があります。
|
||||
#
|
||||
DisableDebug $(DISABLE_DEBUG)
|
||||
|
||||
###
|
||||
#### 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
|
||||
|
||||
#
|
||||
# Data only title : [TRUE/FALSE]
|
||||
# don't have to edit
|
||||
DataOnly FALSE
|
||||
|
||||
#
|
||||
# Secure title : [TRUE/FALSE]
|
||||
# don't have to edit
|
||||
Secure TRUE
|
||||
|
||||
#
|
||||
# Boot allowed Media: [GameCard/NAND]
|
||||
#
|
||||
Media GameCard
|
||||
|
||||
#
|
||||
# GameCode for TitleID : Your GameCode in 4 ascii words
|
||||
#
|
||||
GameCode $(TITLEID_LO)
|
||||
|
||||
#
|
||||
# Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M]
|
||||
#
|
||||
#PublicSaveDataSize 32K
|
||||
|
||||
#
|
||||
# Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M]
|
||||
#
|
||||
#PrivateSaveDataSize 16K
|
||||
|
||||
#
|
||||
# Enable SubBannerFile
|
||||
#SubBannerFile TRUE
|
||||
}
|
||||
|
||||
|
||||
RomSpec
|
||||
{
|
||||
Offset 0x00000000
|
||||
Segment ALL
|
||||
HostRoot ../data/20080822_cls/euro
|
||||
Root /data
|
||||
File hnap-v0.tad hnbp-v0.tad hnca-v0.tad hnda-v0.tad hnea-v0.tad hnfp-v0.tad hngp-v0.tad hnha-v0.tad hnip-v0.tad hnjp-v0.tad hnkp-v0.tad hnlp-v0.tad TWLFontTable.dat nandfirm_rcplus.nand
|
||||
HostRoot $(PRIVKEY_PATH)
|
||||
Root /key
|
||||
File $(HWINFO_PRIVKEY) $(HWID_PRIVKEY)
|
||||
}
|
||||
@ -1,772 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: SystemUpdater
|
||||
File: main.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 <stdlib.h> // atoi
|
||||
#include <twl.h>
|
||||
#include <nitro/snd.h>
|
||||
#include <twl/fatfs.h>
|
||||
#include <twl/os/common/format_rom.h>
|
||||
#include <sysmenu/namut.h>
|
||||
#include <twl/nam.h>
|
||||
#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"
|
||||
#include "hwi.h"
|
||||
#include "keypad.h"
|
||||
#include "debugger_hw_reset_control.h"
|
||||
#include "debugger_card_rom.h"
|
||||
#include "build_time.h"
|
||||
|
||||
#define SCRAMBLE_MASK 0x00406000
|
||||
|
||||
extern const char *g_strIPLSvnRevision;
|
||||
extern const char *g_strSDKSvnRevision;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
型定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
typedef struct _SystemUpdaterLog
|
||||
{
|
||||
int magic_code;
|
||||
int sdk_version;
|
||||
int ipl_version;
|
||||
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/nandfirm_rcplus.nand"
|
||||
|
||||
#define SYSTEM_UPDATER_MAGIC_CODE 44001111
|
||||
|
||||
// リトライ回数
|
||||
#define MAX_RETRY_COUNT 2
|
||||
|
||||
static const char* ImportTadFileList[] =
|
||||
{
|
||||
"rom:/data/hnap-v0.tad",
|
||||
"rom:/data/hnbp-v0.tad",
|
||||
"rom:/data/hnca-v0.tad",
|
||||
"rom:/data/hnda-v0.tad",
|
||||
"rom:/data/hnea-v0.tad",
|
||||
"rom:/data/hnfp-v0.tad",
|
||||
"rom:/data/hngp-v0.tad",
|
||||
"rom:/data/hnha-v0.tad",
|
||||
"rom:/data/hnip-v0.tad",
|
||||
"rom:/data/hnjp-v0.tad",
|
||||
"rom:/data/hnkp-v0.tad",
|
||||
"rom:/data/hnlp-v0.tad",
|
||||
|
||||
};
|
||||
|
||||
static const CopyFileList sCopyFileList[] =
|
||||
{
|
||||
{ "rom:/data/TWLFontTable.dat", "nand:sys/TWLFontTable.dat" }
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
内部変数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
static NAMTitleId titleId;
|
||||
static s16 printLine;
|
||||
static vu8 sIsFormatFinish;
|
||||
static u8 sFormatResult;
|
||||
static s32 sLockId;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
内部関数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void VBlankIntr(void);
|
||||
static void InitAllocation(void);
|
||||
static BOOL IgnoreRemoval(void);
|
||||
static void DrawWaitButtonA(void);
|
||||
static void DrawInvalidConsole(void);
|
||||
static void DrawCancel(void);
|
||||
static void DrawAlready(SystemUpdaterLog* log);
|
||||
static void DrawResult(BOOL result);
|
||||
static void FormatCallback(KAMIResult result, void* arg);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: TwlMain
|
||||
|
||||
Description: main
|
||||
|
||||
Arguments: None
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
TwlMain()
|
||||
{
|
||||
BOOL result;
|
||||
BOOL hw_info_result;
|
||||
BOOL nand_firm_result;
|
||||
int tadNum;
|
||||
int i,j;
|
||||
|
||||
// 製品ビルドランチャー&デバッガ上での起動対応
|
||||
if ( OS_GetRunningConsoleType() & OS_CONSOLE_TWLDEBUGGER )
|
||||
{
|
||||
ROM_Header *dh = (void *)HW_ROM_HEADER_BUF;
|
||||
dh->s.game_cmd_param &= ~SCRAMBLE_MASK;
|
||||
}
|
||||
|
||||
OS_Init();
|
||||
OS_InitThread();
|
||||
OS_InitTick();
|
||||
OS_InitAlarm();
|
||||
OS_InitArena();
|
||||
PXI_Init();
|
||||
OS_InitLock();
|
||||
OS_InitArenaEx();
|
||||
OS_InitIrqTable();
|
||||
OS_SetIrqStackChecker();
|
||||
MI_Init();
|
||||
OS_InitVAlarm();
|
||||
OSi_InitVramExclusive();
|
||||
OS_InitThread();
|
||||
OS_InitReset();
|
||||
GX_Init();
|
||||
FX_Init();
|
||||
SND_Init();
|
||||
TP_Init();
|
||||
RTC_Init();
|
||||
|
||||
KamiPxiInit(); /* 独自PXI初期化 */
|
||||
|
||||
// Vブランク割り込み設定
|
||||
OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
|
||||
(void)OS_EnableIrqMask(OS_IE_V_BLANK);
|
||||
(void)OS_EnableIrqMask(OS_IE_FIFO_RECV);
|
||||
(void)OS_EnableIrq();
|
||||
(void)GX_VBlankIntr(TRUE);
|
||||
|
||||
// initialize file-system
|
||||
FS_Init(FS_DMA_NOT_USE);
|
||||
|
||||
InitAllocation();
|
||||
|
||||
// NAMライブラリ初期化
|
||||
NAM_Init( OS_AllocFromMain, OS_FreeToMain );
|
||||
NAMUT_Init( OS_AllocFromMain, OS_FreeToMain ); // SoftBoxCountの計算に必要
|
||||
|
||||
// 表示関連初期化
|
||||
InitGraphics();
|
||||
kamiFontInit();
|
||||
|
||||
// メインスレッドのカードロックID取得
|
||||
sLockId = OS_GetLockID();
|
||||
|
||||
/* always preload FS table for faster directory access. */
|
||||
{
|
||||
u32 need_size = FS_GetTableSize();
|
||||
void *p_table = OS_Alloc(need_size);
|
||||
SDK_ASSERT(p_table != NULL);
|
||||
(void)FS_LoadTable(p_table, need_size);
|
||||
}
|
||||
|
||||
// コンソールチェック
|
||||
{
|
||||
u32 console = OS_GetRunningConsoleType();
|
||||
enum { IS_TWL_DEBUGGER=0, IS_TWL_CAPTURE, TWL, UNKNOWN };
|
||||
int running = UNKNOWN;
|
||||
|
||||
// SystemUpdaterはデバッグ不可で作成されるためOS_CONSOLE_TWLが取得される
|
||||
// 赤箱にカードを挿してSystemUpdaterを実行した場合も同様(但しOS_CONSOLE_TWLTYPE_RETAILにはならない)
|
||||
// デバッガかどうかの判定はメモリサイズチェックにより行う
|
||||
// 念のためOS_CONSOLE_TWLTYPE_RETAILでないことも確認する
|
||||
|
||||
if ((console & OS_CONSOLE_SIZE_MASK) == OS_CONSOLE_SIZE_32MB)
|
||||
{
|
||||
if ((console & OS_CONSOLE_TWLTYPE_MASK) != OS_CONSOLE_TWLTYPE_RETAIL)
|
||||
{
|
||||
IsToolType type;
|
||||
kamiGetIsToolType(&type);
|
||||
if (type == IS_TOOL_TYPE_DEBUGGER)
|
||||
{
|
||||
running = IS_TWL_DEBUGGER;
|
||||
}
|
||||
else if (type == IS_TOOL_TYPE_ERROR) // TSボードプラス + 旧仕様デバッガ
|
||||
{
|
||||
running = IS_TWL_DEBUGGER;
|
||||
}
|
||||
else if (type == IS_TOOL_TYPE_CAPTURE)
|
||||
{
|
||||
running = IS_TWL_CAPTURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((console & OS_CONSOLE_MASK) == OS_CONSOLE_TWL)
|
||||
{
|
||||
IsToolType type;
|
||||
kamiGetIsToolType(&type);
|
||||
if (type == IS_TOOL_TYPE_CAPTURE)
|
||||
{
|
||||
running = IS_TWL_CAPTURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
running = TWL;
|
||||
}
|
||||
}
|
||||
|
||||
switch (running)
|
||||
{
|
||||
case IS_TWL_DEBUGGER:
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Running on IS_TWL_DEBUGGER.");
|
||||
break;
|
||||
case IS_TWL_CAPTURE:
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Running on IS_TWL_CAPTURE.");
|
||||
break;
|
||||
case TWL:
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Running on TWL CONSOLE.");
|
||||
break;
|
||||
case UNKNOWN:
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Running on UNKNOWN.");
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef SYSM_BUILD_FOR_DEBUGGER
|
||||
// デバッガ向けSystemUpdaterは実機とキャプチャでは動作させない
|
||||
if (running != IS_TWL_DEBUGGER)
|
||||
{
|
||||
kamiFontPrintfMain( 2, 9, 3, " Sorry, ");
|
||||
kamiFontPrintfMain( 2, 10, 3, " This SystemUpdater can not ");
|
||||
kamiFontPrintfMain( 2, 11, 3, " execute on TWL-CONSOLE. ");
|
||||
DrawInvalidConsole();
|
||||
}
|
||||
#else
|
||||
// 実機向けSystemUpdaterはデバッガでは動作させない
|
||||
if (running == IS_TWL_DEBUGGER)
|
||||
{
|
||||
kamiFontPrintfMain( 2, 9, 3, " Sorry, ");
|
||||
kamiFontPrintfMain( 2, 10, 3, " This SystemUpdater can not ");
|
||||
kamiFontPrintfMain( 2, 11, 3, " execute on IS-TWL-DEBUGGER.");
|
||||
DrawInvalidConsole();
|
||||
}
|
||||
#endif // SYSM_BUILD_FOR_DEBUGGER
|
||||
|
||||
// UNKNOWNはは動作させない
|
||||
if (running == UNKNOWN)
|
||||
{
|
||||
kamiFontPrintfMain( 2, 9, 3, " Sorry, ");
|
||||
kamiFontPrintfMain( 2, 10, 3, " This SystemUpdater can not ");
|
||||
kamiFontPrintfMain( 2, 11, 3, " execute on UNKNOWN CONSOLE.");
|
||||
DrawInvalidConsole();
|
||||
}
|
||||
}
|
||||
|
||||
// (更新可能条件)
|
||||
// 1.ログが存在しない
|
||||
// 2.ログが存在し、ログに記載のマジックコードが不正(初版SystemUpdater実行後の状態)
|
||||
// 2.ログが存在し、ログに記載のマジックコードが正しくかつログに記載の
|
||||
// SDK & IPL のバージョンが SystemUpdater のそれ以下である
|
||||
|
||||
#ifdef IGNORE_VERSION_CHECK
|
||||
if( 0 )
|
||||
#endif // IGNORE_VERSION_CHECK
|
||||
{
|
||||
SystemUpdaterLog log;
|
||||
FSFile file;
|
||||
FS_InitFile( &file );
|
||||
|
||||
if (FS_OpenFileEx(&file, SYSTEM_UPDATER_LOG_PATH, FS_FILEMODE_R) == TRUE)
|
||||
{
|
||||
DC_InvalidateRange(&log, sizeof(log));
|
||||
|
||||
if (FS_ReadFile(&file, &log, sizeof(log)) == sizeof(log))
|
||||
{
|
||||
// ログリード成功
|
||||
OS_Printf("[%d, %d]\n", log.sdk_version, log.ipl_version);
|
||||
|
||||
// 初版SystemUpdater実行状態でないことをマジックコードで判別する
|
||||
if (log.magic_code == SYSTEM_UPDATER_MAGIC_CODE)
|
||||
{
|
||||
// マジックコード、SDKバージョン、IPLバージョンの確認
|
||||
if (log.sdk_version > atoi(g_strSDKSvnRevision) ||
|
||||
log.ipl_version > atoi(g_strIPLSvnRevision))
|
||||
{
|
||||
// 更新不可
|
||||
DrawAlready(&log);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// ログリード失敗
|
||||
OS_Warning("Failure! FS_ReadFile");
|
||||
}
|
||||
|
||||
FS_CloseFile(&file);
|
||||
}
|
||||
}
|
||||
|
||||
// Aボタン待ち
|
||||
DrawWaitButtonA();
|
||||
|
||||
// TWLの更新処理を実行中です
|
||||
CARD_LockRom((u16)sLockId);
|
||||
(void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_NOW_UPDATE);
|
||||
CARD_UnlockRom((u16)sLockId);
|
||||
|
||||
// ISデバッガのハードウェアリセットを禁止する
|
||||
DEBUGGER_HwResetDisable();
|
||||
|
||||
// HWInfo関連の前準備
|
||||
switch (HWI_Init( OS_AllocFromMain, OS_FreeToMain ))
|
||||
{
|
||||
case HWI_INIT_FAILURE:
|
||||
OS_Warning(" Fail! : HWI_INIT()");
|
||||
break;
|
||||
case HWI_INIT_SUCCESS_PRO_SIGNATURE_MODE:
|
||||
break;
|
||||
case HWI_INIT_SUCCESS_DEV_SIGNATURE_MODE:
|
||||
break;
|
||||
case HWI_INIT_SUCCESS_NO_SIGNATRUE_MODE:
|
||||
break;
|
||||
}
|
||||
|
||||
result = TRUE;
|
||||
|
||||
// 完全に消去
|
||||
NAMUT_Format();
|
||||
|
||||
// フォーマット実行
|
||||
sIsFormatFinish = FALSE;
|
||||
ExeFormatAsync(FORMAT_MODE_QUICK, FormatCallback);
|
||||
kamiFontPrintfMain( 7, 11, 8, "Now Format...");
|
||||
while(!sIsFormatFinish){};
|
||||
if (sFormatResult)
|
||||
{
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "NAND Format Success.");
|
||||
}
|
||||
else
|
||||
{
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_RED, "NAND Format Failure!");
|
||||
}
|
||||
kamiFontPrintfMain( 7, 11, 8, " ");
|
||||
|
||||
// フォーマット後はESに必要なファイルがなくなっているため
|
||||
// ES_InitLibを呼び出すことで作成しておく
|
||||
NAM_End( NULL, NULL );
|
||||
NAM_Init( OS_AllocFromMain, OS_FreeToMain );
|
||||
|
||||
// 全ハードウェア情報の更新
|
||||
for (i=0;i<MAX_RETRY_COUNT;i++)
|
||||
{
|
||||
hw_info_result = WriteHWInfoFile(OS_TWL_REGION_EUROPE, OS_IsForceDisableWireless());
|
||||
if (hw_info_result)
|
||||
{
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Write Hardware Info Success.");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
kamiFontPrintfConsole(CONSOLE_RED, "Write Hardware Info Retry!\n");
|
||||
}
|
||||
}
|
||||
if ( hw_info_result == FALSE)
|
||||
{
|
||||
result = FALSE;
|
||||
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のインポート開始
|
||||
tadNum = sizeof(ImportTadFileList)/sizeof(ImportTadFileList[0]);
|
||||
|
||||
for (i=0; i<tadNum; i++)
|
||||
{
|
||||
s32 nam_result;
|
||||
|
||||
// MAX_RETRY_COUNTまでリトライする
|
||||
for (j=0; j<MAX_RETRY_COUNT; j++)
|
||||
{
|
||||
nam_result = kamiImportTad(i+1, tadNum, ImportTadFileList[i]);
|
||||
if (nam_result == NAM_OK)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
kamiFontPrintfConsole(CONSOLE_RED, "Import %d Retry!\n", i+1);
|
||||
}
|
||||
}
|
||||
|
||||
if ( nam_result == NAM_OK)
|
||||
{
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "List : %d Update Success.", i+1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_RED, "Error: %d : RetCode = %d", i+1, nam_result );
|
||||
result = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// NANDファームのインストール開始
|
||||
for (j=0;j<MAX_RETRY_COUNT;j++)
|
||||
{
|
||||
nand_firm_result = kamiWriteNandfirm(NAND_FIRM_PATH_IN_ROM, OS_AllocFromMain, OS_FreeToMain);
|
||||
if (nand_firm_result)
|
||||
{
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Firm Update Success.");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
kamiFontPrintfConsole(CONSOLE_RED, "Write Firm Retry!\n");
|
||||
}
|
||||
}
|
||||
if ( nand_firm_result == FALSE)
|
||||
{
|
||||
result = FALSE;
|
||||
kamiFontPrintf( 0, printLine++, FONT_COLOR_RED, "Firm Update Failure!");
|
||||
}
|
||||
|
||||
// 更新ログを作成して再実行を防ぐ
|
||||
if (result)
|
||||
{
|
||||
SystemUpdaterLog log;
|
||||
|
||||
(void)FS_DeleteFile(SYSTEM_UPDATER_LOG_PATH);
|
||||
|
||||
if (FS_CreateFileAuto(SYSTEM_UPDATER_LOG_PATH, FS_PERMIT_R | FS_PERMIT_W))
|
||||
{
|
||||
FSFile file;
|
||||
FS_InitFile( &file );
|
||||
if (FS_OpenFileEx(&file, SYSTEM_UPDATER_LOG_PATH, FS_FILEMODE_W))
|
||||
{
|
||||
log.magic_code = SYSTEM_UPDATER_MAGIC_CODE;
|
||||
log.sdk_version = atoi(g_strSDKSvnRevision);
|
||||
log.ipl_version = atoi(g_strIPLSvnRevision);
|
||||
|
||||
DC_FlushRange(&log, sizeof(log));
|
||||
|
||||
if (FS_WriteFile(&file, (void*)&log, sizeof(log) ) == -1)
|
||||
{
|
||||
OS_Warning("Failure : FS_WriteFile\n");
|
||||
}
|
||||
FS_CloseFile(&file);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OS_Warning("Failure : FS_CreateFileAuto\n");
|
||||
}
|
||||
}
|
||||
|
||||
// ISデバッガのハードウェアリセットを許可する
|
||||
DEBUGGER_HwResetEnable();
|
||||
|
||||
// TWLの更新処理が完了しました
|
||||
CARD_LockRom((u16)sLockId);
|
||||
(void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_FINISHED);
|
||||
CARD_UnlockRom((u16)sLockId);
|
||||
|
||||
// 結果表示
|
||||
while(1)
|
||||
{
|
||||
DrawResult(result);
|
||||
OS_WaitVBlankIntr();
|
||||
};
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: VBlankIntr
|
||||
|
||||
Description: VBlank割り込み処理
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
VBlankIntr(void)
|
||||
{
|
||||
kamiFontLoadScreenData();
|
||||
OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: InitAllocation
|
||||
|
||||
Description: ヒープの初期化.
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void InitAllocation(void)
|
||||
{
|
||||
void *tmp;
|
||||
OSHeapHandle hh;
|
||||
|
||||
/* アリーナの初期化 */
|
||||
tmp = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1);
|
||||
OS_SetArenaLo(OS_ARENA_MAIN, tmp);
|
||||
hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi());
|
||||
if (hh < 0)
|
||||
OS_Panic("ARM9: Fail to create heap...\n");
|
||||
hh = OS_SetCurrentHeap(OS_ARENA_MAIN, hh);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DrawWaitButtonA
|
||||
|
||||
Description: Aボタン待ちを表示します
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void DrawWaitButtonA(void)
|
||||
{
|
||||
// 液晶を見てください。
|
||||
CARD_LockRom((u16)sLockId);
|
||||
(void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_LOOK_SCREEN);
|
||||
CARD_UnlockRom((u16)sLockId);
|
||||
|
||||
kamiFontPrintfMain( 5, 3, 8, " System Updater [EUR]");
|
||||
kamiFontPrintfMain( 4, 5, 8, " --- ver %s %s ---", g_strSDKSvnRevision, g_strIPLSvnRevision );
|
||||
kamiFontPrintfMain( 1, 6, 8, "Build time:%s", BUILD_TIME );
|
||||
|
||||
kamiFontPrintfMain( 5, 9, 3, " A Button: Start Update ");
|
||||
kamiFontPrintfMain( 5, 10, 3, " B Button: Cancel Update ");
|
||||
|
||||
kamiFontPrintfMain( 3, 13, 1, "Do not turn off power");
|
||||
kamiFontPrintfMain( 3, 14, 1, "while update is processing");
|
||||
|
||||
|
||||
while(1)
|
||||
{
|
||||
G3X_Reset();
|
||||
G3_Identity();
|
||||
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
|
||||
|
||||
DrawQuad( 10, 54, 246, 150, GX_RGB(28, 28, 28));
|
||||
|
||||
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
|
||||
|
||||
kamiPadRead();
|
||||
if (kamiPadIsTrigger(PAD_BUTTON_A))
|
||||
{
|
||||
kamiFontClearMain();
|
||||
break;
|
||||
}
|
||||
else if (kamiPadIsTrigger(PAD_BUTTON_B))
|
||||
{
|
||||
kamiFontClearMain();
|
||||
DrawCancel();
|
||||
}
|
||||
|
||||
OS_WaitVBlankIntr();
|
||||
}
|
||||
|
||||
G3X_Reset();
|
||||
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
|
||||
OS_WaitVBlankIntr();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DrawInvalidConsole
|
||||
|
||||
Description: コンソール条件による失敗を表示します。
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void DrawInvalidConsole(void)
|
||||
{
|
||||
// キャンセルされました
|
||||
CARD_LockRom((u16)sLockId);
|
||||
(void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_CANCELED);
|
||||
CARD_UnlockRom((u16)sLockId);
|
||||
|
||||
while(1)
|
||||
{
|
||||
G3X_Reset();
|
||||
G3_Identity();
|
||||
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
|
||||
|
||||
DrawQuad( 10, 50, 246, 120, GX_RGB(28, 28, 28));
|
||||
|
||||
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
|
||||
|
||||
OS_WaitVBlankIntr();
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DrawCancel
|
||||
|
||||
Description: Cancelを表示します
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void DrawCancel(void)
|
||||
{
|
||||
// キャンセルされました
|
||||
CARD_LockRom((u16)sLockId);
|
||||
(void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_CANCELED);
|
||||
CARD_UnlockRom((u16)sLockId);
|
||||
|
||||
kamiFontPrintfMain( 3, 9, 1, "--------------------------");
|
||||
kamiFontPrintfMain( 3, 10, 1, " Update was Canceld.");
|
||||
kamiFontPrintfMain( 3, 11, 1, "--------------------------");
|
||||
|
||||
while(1)
|
||||
{
|
||||
G3X_Reset();
|
||||
G3_Identity();
|
||||
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
|
||||
|
||||
DrawQuad( 10, 50, 246, 128, GX_RGB(28, 28, 28));
|
||||
|
||||
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
|
||||
|
||||
OS_WaitVBlankIntr();
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DrawAlready
|
||||
|
||||
Description: Alreadyを表示します
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void DrawAlready(SystemUpdaterLog* log)
|
||||
{
|
||||
// 既にアップデート済み
|
||||
CARD_LockRom((u16)sLockId);
|
||||
(void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_ALREADY);
|
||||
CARD_UnlockRom((u16)sLockId);
|
||||
|
||||
kamiFontPrintfMain( 3, 8, 1, "--------------------------");
|
||||
kamiFontPrintfMain( 3, 9, 1, "This machine has already");
|
||||
kamiFontPrintfMain( 3, 10, 1, "been updated.");
|
||||
kamiFontPrintfMain( 3, 12, 1, "ver: %d %d", log->sdk_version, log->ipl_version );
|
||||
kamiFontPrintfMain( 3, 13, 1, "--------------------------");
|
||||
|
||||
while(1)
|
||||
{
|
||||
G3X_Reset();
|
||||
G3_Identity();
|
||||
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
|
||||
|
||||
DrawQuad( 10, 50, 246, 128, GX_RGB(28, 28, 28));
|
||||
|
||||
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
|
||||
|
||||
OS_WaitVBlankIntr();
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DrawResult
|
||||
|
||||
Description: 処理結果を表示します。
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void DrawResult(BOOL result)
|
||||
{
|
||||
// 3D初期化
|
||||
G3X_Reset();
|
||||
G3_Identity();
|
||||
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
|
||||
|
||||
// "Now Updating.." を消去
|
||||
kamiFontPrintfMain( 0, 9, 7, " ");
|
||||
|
||||
if (result)
|
||||
{
|
||||
kamiFontPrintfMain( 9, 10, 7, "Update Success!");
|
||||
// グリーンダイアログ
|
||||
DrawQuad( 50, 50, 206, 120, GX_RGB(12, 25, 12));
|
||||
}
|
||||
else
|
||||
{
|
||||
kamiFontPrintfMain( 9, 10, 7, "Update Failure!");
|
||||
// レッドダイアログ
|
||||
DrawQuad( 50, 50, 206, 120, GX_RGB(31, 0, 0));
|
||||
}
|
||||
|
||||
kamiFontLoadScreenData();
|
||||
|
||||
// 3Dスワップ
|
||||
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: FormatCallback
|
||||
|
||||
Description: フォーマットコールバック
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void FormatCallback(KAMIResult result, void* /*arg*/)
|
||||
{
|
||||
if ( result == KAMI_RESULT_SUCCESS_TRUE )
|
||||
{
|
||||
sFormatResult = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sFormatResult = FALSE;
|
||||
}
|
||||
|
||||
sIsFormatFinish = TRUE;
|
||||
}
|
||||
@ -51,13 +51,13 @@ clobber: MY_GOAL=clobber
|
||||
install: MY_GOAL=install
|
||||
|
||||
do-something:
|
||||
-$(REMAKE) TWLSDK_PLATFORM=TWL REGION=JPN ROMSET=$(ROMSET) SKIP_SUBDIR=FALSE $(MY_GOAL)
|
||||
-$(REMAKE) TWLSDK_PLATFORM=TWL REGION=JPN ROMSET=$(ROMSET) DISABLE_ROMCHECK=$(DISABLE_ROMCHECK) SKIP_SUBDIR=FALSE $(MY_GOAL)
|
||||
-rm `find . -name "*autogen*"`
|
||||
-$(REMAKE) TWLSDK_PLATFORM=TWL REGION=AUS ROMSET=$(ROMSET) SKIP_SUBDIR=FALSE $(MY_GOAL)
|
||||
-$(REMAKE) TWLSDK_PLATFORM=TWL REGION=AUS ROMSET=$(ROMSET) DISABLE_ROMCHECK=$(DISABLE_ROMCHECK) SKIP_SUBDIR=FALSE $(MY_GOAL)
|
||||
-rm `find . -name "*autogen*"`
|
||||
-$(REMAKE) TWLSDK_PLATFORM=TWL REGION=USA ROMSET=$(ROMSET) SKIP_SUBDIR=FALSE $(MY_GOAL)
|
||||
-$(REMAKE) TWLSDK_PLATFORM=TWL REGION=USA ROMSET=$(ROMSET) DISABLE_ROMCHECK=$(DISABLE_ROMCHECK) SKIP_SUBDIR=FALSE $(MY_GOAL)
|
||||
-rm `find . -name "*autogen*"`
|
||||
-$(REMAKE) TWLSDK_PLATFORM=TWL REGION=EUR ROMSET=$(ROMSET) SKIP_SUBDIR=FALSE $(MY_GOAL)
|
||||
-$(REMAKE) TWLSDK_PLATFORM=TWL REGION=EUR ROMSET=$(ROMSET) DISABLE_ROMCHECK=$(DISABLE_ROMCHECK) SKIP_SUBDIR=FALSE $(MY_GOAL)
|
||||
|
||||
include $(TWLSDK_ROOT)/build/buildtools/modulerules
|
||||
|
||||
@ -92,9 +92,10 @@ SUBDIRS = banner \
|
||||
ARM9.TWL
|
||||
endif
|
||||
|
||||
# CustomRegion
|
||||
# CustomSystemUpdater
|
||||
export SYSM_REGION = $(REGION)
|
||||
export ROMSET := $(ROMSET)
|
||||
export DISABLE_ROMCHECK := $(DISABLE_ROMCHECK)
|
||||
|
||||
# COMPILE SWITCH for build SystemMenu
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
---
|
||||
:DataPath: data
|
||||
:DataPath: .
|
||||
:NandFirm: nandfirm_rcplus.nand
|
||||
:TargetPath: .
|
||||
:TemplatePath: template
|
||||
|
||||
@ -46,6 +46,7 @@ def check_pickuped(path, print_success)
|
||||
ret = true
|
||||
files = Dir.glob(path)
|
||||
p_path = path.slice(REG_PATH)
|
||||
#p files
|
||||
case
|
||||
when files.size == 0
|
||||
$stdout.printf( "NG:#{p_path} -- #{p_path} is not included ***********\n")
|
||||
@ -69,25 +70,26 @@ def check(target_dir)
|
||||
REGION_DIRS.each{|region_dir, region_code|
|
||||
ALL_REGION.each{|app_code|
|
||||
# オールリージョンのロムが含まれているかのチェック
|
||||
search_path = "#{target_dir}/#{region_dir}/#{HEADER}#{app_code}A*.tad"
|
||||
search_path = File.join(target_dir, region_dir, "#{HEADER}#{app_code}A*.tad")
|
||||
#p search_path
|
||||
ret &= check_pickuped(search_path, false)
|
||||
}
|
||||
FIX_REGION.each{|app_code|
|
||||
# 各リージョン固有のロムが含まれているかのチェック
|
||||
search_path = "#{target_dir}/#{region_dir}/#{HEADER}#{app_code}#{region_code}*.tad"
|
||||
search_path = File.join(target_dir, region_dir, "#{HEADER}#{app_code}#{region_code}*.tad")
|
||||
ret &= check_pickuped(search_path, false)
|
||||
}
|
||||
(ALL_REGION + FIX_REGION).each{|app_code|
|
||||
# HNxy が 各リージョンごと1つだけ存在するかのチェック
|
||||
# HNxA と HNxU など、aとuが混在していたりするとここでひっかかる
|
||||
search_path = "#{target_dir}/#{region_dir}/#{HEADER}#{app_code}*.tad"
|
||||
search_path = File.join(target_dir, region_dir, "#{HEADER}#{app_code}*.tad")
|
||||
ret &= check_pickuped(search_path, false)
|
||||
}
|
||||
|
||||
# nand firm, font のチェック
|
||||
search_path = "#{target_dir}/#{region_dir}/#{NAND_FIRM}"
|
||||
search_path = File.join(target_dir, region_dir, NAND_FIRM)
|
||||
ret &= check_pickuped(search_path, false)
|
||||
search_path = "#{target_dir}/#{region_dir}/#{FONT_DATA}"
|
||||
search_path = File.join(target_dir, region_dir, FONT_DATA)
|
||||
ret &= check_pickuped(search_path, false)
|
||||
|
||||
$stdout.printf("\n")
|
||||
@ -102,6 +104,10 @@ if ARGV.size < 1
|
||||
exit -1
|
||||
end
|
||||
|
||||
# カレントディレクトリの変更
|
||||
Dir.chdir(File.dirname(File.expand_path(__FILE__)))
|
||||
|
||||
|
||||
target = ARGV[0]
|
||||
|
||||
exit (check target) ? 0 : -1
|
||||
|
||||
@ -54,7 +54,7 @@ def make_default_config
|
||||
:TemplatePath => "template",
|
||||
:RSF => "ARM9.TWL/main.rsf",
|
||||
:SRC => "ARM9.TWL/src/main.c",
|
||||
:DataPath => "data",
|
||||
:DataPath => ".",
|
||||
:Region => "JPN",
|
||||
}
|
||||
write_config(DEFAULT_CONFIG, config)
|
||||
@ -101,10 +101,12 @@ def make_rsf(config)
|
||||
tadlist = config[:TadFiles].dup
|
||||
tadlist << config[:FontFile] << config[:NandFirm]
|
||||
tadlist = tadlist.join(" ")
|
||||
src = File.read(config[:TemplatePath] + "/" + config[:RSF])
|
||||
src = File.read(File.join(config[:TemplatePath], config[:RSF]))
|
||||
#src = File.read(config[:TemplatePath] + "/" + config[:RSF])
|
||||
src = replace_data(src, "datapath", config[:DataPath])
|
||||
src = replace_data(src, "regionname", config[:Region])
|
||||
write_data(config[:TargetPath] + "/" + config[:RSF], replace_data(src, "filelist", tadlist))
|
||||
write_data(File.join(config[:TargetPath], config[:RSF]), replace_data(src, "filelist", tadlist))
|
||||
#write_data(config[:TargetPath] + "/" + config[:RSF], replace_data(src, "filelist", tadlist))
|
||||
end
|
||||
|
||||
# main.c ‚Ì<E2809A>‘‚«Š·‚¦
|
||||
@ -115,7 +117,8 @@ def make_main(config)
|
||||
data.push("\t\"rom:/data/" + t + "\", \n")
|
||||
end
|
||||
data = data.join
|
||||
src = File.read(config[:TemplatePath] + "/" + config[:SRC])
|
||||
#src = File.read(config[:TemplatePath] + "/" + config[:SRC])
|
||||
src = File.read(File.join(config[:TemplatePath], config[:SRC]))
|
||||
mod = replace_data(src, "tadlist", data)
|
||||
mod = replace_data(mod, "nandfirm", config[:NandFirm])
|
||||
mod = replace_data(mod, "fontfile", config[:FontFile])
|
||||
@ -125,7 +128,9 @@ def make_main(config)
|
||||
region = (REGION[region_name] != nil) ? REGION[region_name] : REGION["JPN"]
|
||||
mod = replace_data(mod, "region", region)
|
||||
mod = replace_data(mod, "regionname", region_name)
|
||||
write_data(config[:TargetPath] + "/" + config[:SRC], mod)
|
||||
#write_data(config[:TargetPath] + "/" + config[:SRC], mod)
|
||||
write_data(File.join(config[:TargetPath], config[:SRC]), mod)
|
||||
|
||||
end
|
||||
|
||||
# SystemUpdater‚ð<E2809A>ì<EFBFBD>¬‚·‚é
|
||||
@ -176,7 +181,9 @@ when "custom" then
|
||||
config[:TadFiles] = []
|
||||
end
|
||||
|
||||
config[:DataPath] += "/#{ARGV[1]}/#{REGION_PATH[region]}"
|
||||
|
||||
#config[:DataPath] += "/#{ARGV[1]}/#{REGION_PATH[region]}"
|
||||
config[:DataPath] = File.join(config[:DataPath], ARGV[1], REGION_PATH[region])
|
||||
config[:Region] = region
|
||||
tads = pickup_files(config[:DataPath], "/*.tad")
|
||||
nand = pickup_files(config[:DataPath], "/*.nand")
|
||||
|
||||
@ -455,7 +455,12 @@ TwlMain()
|
||||
}
|
||||
|
||||
// 更新ログを作成して再実行を防ぐ
|
||||
if (result)
|
||||
|
||||
#ifdef IGNORE_VERSION_CHECK
|
||||
if( 0 )
|
||||
#else
|
||||
if (result)
|
||||
#endif
|
||||
{
|
||||
SystemUpdaterLog log;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user