mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
CustomSystemUpdaterのコミット
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2220 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
e151090ca6
commit
7d99fb13b0
74
build/tests/CustomSystemUpdater/ARM7.TWL/Makefile
Normal file
74
build/tests/CustomSystemUpdater/ARM7.TWL/Makefile
Normal file
@ -0,0 +1,74 @@
|
||||
#! make -f
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: TwlSDK - components - armadillo.TWL
|
||||
# File: Makefile
|
||||
#
|
||||
# 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$
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
override TARGET_PLATFORM = TWL
|
||||
override TWL_PROC = ARM7
|
||||
override TWL_ARCHGEN = LIMITED
|
||||
##override TWL_PLATFORM = TS
|
||||
TWL_NO_STD_PCHDR = True
|
||||
override TARGET_CODEGEN = ARM
|
||||
|
||||
ifndef TWLSDK_NOCRYPTO
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
SRCS = main.c \
|
||||
kami_pxi.c \
|
||||
formatter.c
|
||||
|
||||
TARGET_NAME = armadillo
|
||||
|
||||
TARGET_NEF = $(TARGET_NAME).tef
|
||||
LCFILE_SPEC = $(TARGET_NAME).lsf
|
||||
LCFILE_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).lcf.template
|
||||
LDRES_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).response.template
|
||||
|
||||
CRT0_O = crt0.SCR.TWL.o
|
||||
|
||||
# スタック不足防止の為、インライン展開せずにコンパイルする
|
||||
CCFLAGS_OPT = -O4 -inline off
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
include $(TWLSDK_ROOT)/build/buildtools/commondefs
|
||||
|
||||
MACRO_FLAGS += -DSDK_ARM7COMP_LTD -DSDK_SEA
|
||||
|
||||
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'
|
||||
|
||||
LINCLUDES = $(ROOT)/build/libraries/spi/ARM7/include \
|
||||
../common/include \
|
||||
../../../systemMenu_tools/common/ARM7/include \
|
||||
|
||||
SRCDIR += ../../../systemMenu_tools/common/ARM7/src
|
||||
|
||||
LLIBRARIES += libwl_sp$(TWL_LIBSUFFIX).a \
|
||||
libsdio_sp$(TWL_LIBSUFFIX).a \
|
||||
libathdrv_sp$(TWL_LIBSUFFIX).a \
|
||||
libwpa_sp$(TWL_LIBSUFFIX).a \
|
||||
|
||||
LDEPENDS_NEF = $(TWL_LIBS) $(LLIBRARIES)
|
||||
|
||||
do-build: $(TARGETS)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
include $(TWLSDK_ROOT)/build/buildtools/modulerules
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
endif #ifndef TWLSDK_NOCRYPTO
|
||||
|
||||
#===== End of Makefile =====
|
||||
86
build/tests/CustomSystemUpdater/ARM7.TWL/armadillo.lsf
Normal file
86
build/tests/CustomSystemUpdater/ARM7.TWL/armadillo.lsf
Normal file
@ -0,0 +1,86 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: TwlSDK - components - armadillo.TWL
|
||||
# File: armadillo.lsf
|
||||
#
|
||||
# Copyright 2008 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$
|
||||
#----------------------------------------------------------------------------
|
||||
#
|
||||
# Nitro LCF SPEC FILE
|
||||
#
|
||||
#--------
|
||||
Static $(TARGET_NAME)
|
||||
{
|
||||
Address 0x02380000
|
||||
StackSize 1024 1024
|
||||
|
||||
Library $(CRT0_O)
|
||||
}
|
||||
|
||||
#--------
|
||||
Ltdautoload SCRWRAM
|
||||
{
|
||||
Address 0x03740000
|
||||
|
||||
Library libsubpsyscall.a
|
||||
Library libsyscall_sp.twl.a
|
||||
Library $(CW_LIBS)
|
||||
Library $(ISDBG_LIBS_TWL)
|
||||
Library $(ISDBG_LIBS_NITRO)
|
||||
|
||||
Object * (.etable)
|
||||
Object $(OBJDIR)/main.o
|
||||
Object $(OBJDIR)/kami_pxi.o
|
||||
Object $(OBJDIR)/formatter.o
|
||||
|
||||
Library libsea_sp$(LIBSUFFIX).a
|
||||
Library libcrypto_sp$(LIBSUFFIX).a
|
||||
|
||||
Library libos_sp$(LIBSUFFIX).a
|
||||
Library libmi_sp$(LIBSUFFIX).a
|
||||
Library libstd_sp$(LIBSUFFIX).a
|
||||
Library libmath_sp$(LIBSUFFIX).a
|
||||
Library libpxi_sp$(LIBSUFFIX).a
|
||||
Library libexi_sp$(LIBSUFFIX).a
|
||||
Library libi2c_sp$(LIBSUFFIX).a
|
||||
Library libsdio_sp$(LIBSUFFIX).a
|
||||
Library libpad_sp$(LIBSUFFIX).a
|
||||
Library libscfg_sp$(LIBSUFFIX).a
|
||||
Library libmcu_sp$(LIBSUFFIX).a
|
||||
Library libcdc_sp$(LIBSUFFIX).a
|
||||
Library libsnd_sp$(LIBSUFFIX).a
|
||||
Library libsndex_sp$(LIBSUFFIX).a
|
||||
Library libspi_sp$(LIBSUFFIX).a
|
||||
Library libpm_sp$(LIBSUFFIX).a
|
||||
Library libtp_sp$(LIBSUFFIX).a
|
||||
Library libtpex_sp$(LIBSUFFIX).a
|
||||
Library libmic_sp$(LIBSUFFIX).a
|
||||
Library libmicex_sp$(LIBSUFFIX).a
|
||||
Library libnvram_sp$(LIBSUFFIX).a
|
||||
Library librtc_sp$(LIBSUFFIX).a
|
||||
Library libfatfs_sp$(LIBSUFFIX).a
|
||||
# Library libwm_sp$(LIBSUFFIX).a
|
||||
# Library libnwm_sp$(LIBSUFFIX).a
|
||||
Library libwvr_sp$(LIBSUFFIX).a
|
||||
Library libwl_sp$(LIBSUFFIX).a
|
||||
Library libwpa_sp$(LIBSUFFIX).a
|
||||
Library libathdrv_sp$(LIBSUFFIX).a
|
||||
Library libfs_sp$(LIBSUFFIX).a
|
||||
Library libcard_sp$(LIBSUFFIX).a
|
||||
Library libcamera_sp$(LIBSUFFIX).a
|
||||
|
||||
Object * (.wram)
|
||||
Object * (.ltdwram)
|
||||
Object * (.rsvwram)
|
||||
Object * (.main)
|
||||
Object * (.ltdmain)
|
||||
}
|
||||
44
build/tests/CustomSystemUpdater/ARM7.TWL/include/kami_pxi.h
Normal file
44
build/tests/CustomSystemUpdater/ARM7.TWL/include/kami_pxi.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - NandInitializer
|
||||
File: kami_pxi.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 TWL_CAMERA_TEST_CAMERATEST_H_
|
||||
#define TWL_CAMERA_TEST_CAMERATEST_H_
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
’è<EFBFBD>”’è‹`
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
void KamiPxiInit( void );
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* TWL_CAMERA_TEST_CAMERATEST_H_ */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
End of file
|
||||
*---------------------------------------------------------------------------*/
|
||||
262
build/tests/CustomSystemUpdater/ARM7.TWL/src/kami_pxi.c
Normal file
262
build/tests/CustomSystemUpdater/ARM7.TWL/src/kami_pxi.c
Normal file
@ -0,0 +1,262 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - NandInitializer
|
||||
File: kami_pxi.c
|
||||
|
||||
Copyright 2008 Nintendo. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Date:: $
|
||||
$Rev$
|
||||
$Author$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <twl.h>
|
||||
#include <twl/exi/ARM7/genPort2.h>
|
||||
#include "kami_pxi.h"
|
||||
#include "fifo.h"
|
||||
#include "twl/cdc.h"
|
||||
#include "formatter.h"
|
||||
#include <twl/ltdmain_begin.h>
|
||||
#include <twl/mcu.h>
|
||||
#include <twl/camera.h>
|
||||
#include <twl/camera/ARM7/i2c_sharp.h>
|
||||
#include <twl/camera/ARM7/i2c_micron.h>
|
||||
|
||||
typedef unsigned char byte; /* Don't change */
|
||||
typedef unsigned short word; /* Don't change */
|
||||
typedef unsigned long dword; /* Don't change */
|
||||
#define BOOLEAN int
|
||||
|
||||
extern BOOL FATFSi_nandRtfsIo( int driveno, dword block, void* buffer, word count, BOOLEAN reading);
|
||||
extern BOOL sdmcFormatNandLog( BOOL verify_flag);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
定数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define KAMITEST_MESSAGE_ARRAY_MAX 4 // スレッド同期用メッセージキューのサイズ
|
||||
#define KAMITEST_THREAD_STACK_SIZE 2048 // スレッドのスタックサイズ
|
||||
|
||||
#define KAMITEST_THREAD_PRIORITY 6
|
||||
|
||||
// アライメント調整してコピーする
|
||||
#define KAMI_UNPACK_U16(d, s) \
|
||||
(*(d) = (u16)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8)))
|
||||
#define KAMI_UNPACK_U32(d, s) \
|
||||
(*(d) = (u32)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8) | (((u8*)s)[2] << 16) | (((u8*)s)[3] << 24)))
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
型定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
typedef struct KamiWork
|
||||
{
|
||||
BOOL result;
|
||||
u32 total;
|
||||
u32 current;
|
||||
KamiCommand command;
|
||||
u8 data[KAMITEST_PXI_DATA_SIZE_MAX]; // 後続データ格納用
|
||||
|
||||
OSMessageQueue msgQ; // スレッド同期用メッセージキュー
|
||||
OSMessage msgArray[KAMITEST_MESSAGE_ARRAY_MAX];
|
||||
// メッセージを格納するバッファ
|
||||
OSThread thread; // KAMI用スレッド
|
||||
u64 stack[KAMITEST_THREAD_STACK_SIZE / sizeof(u64)];
|
||||
// KAMI用スレッドのスタック
|
||||
}
|
||||
KamiWork;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
静的変数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
static BOOL kamiInitialized;
|
||||
static KamiWork kamiWork;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
内部関数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err);
|
||||
static void KamiReturnResult(KamiCommand command, KAMIPxiResult result);
|
||||
static void KamiReturnResultEx(KamiCommand command, KAMIPxiResult result, u8 size, u8* data);
|
||||
static void KamiThread(void *arg);
|
||||
|
||||
void KamiPxiInit(void)
|
||||
{
|
||||
if (kamiInitialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
kamiInitialized = TRUE;
|
||||
|
||||
PXI_Init();
|
||||
PXI_SetFifoRecvCallback(PXI_FIFO_TAG_KAMITEST, KamiPxiCallback);
|
||||
|
||||
OS_InitMessageQueue(&kamiWork.msgQ, kamiWork.msgArray, KAMITEST_MESSAGE_ARRAY_MAX);
|
||||
OS_CreateThread(&kamiWork.thread, KamiThread, 0,
|
||||
(void *)(kamiWork.stack + (KAMITEST_THREAD_STACK_SIZE / sizeof(u64))),
|
||||
KAMITEST_THREAD_STACK_SIZE, KAMITEST_THREAD_PRIORITY);
|
||||
OS_WakeupThreadDirect(&kamiWork.thread);
|
||||
}
|
||||
|
||||
static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err)
|
||||
{
|
||||
#pragma unused( tag )
|
||||
if (err)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (data & KAMITEST_PXI_START_BIT) // 先頭データ
|
||||
{
|
||||
kamiWork.total = (u8)((data & KAMITEST_PXI_DATA_NUMS_MASK) >> KAMITEST_PXI_DATA_NUMS_SHIFT);
|
||||
kamiWork.current = 0;
|
||||
kamiWork.command = (KamiCommand)((data & KAMITEST_PXI_COMMAND_MASK) >> KAMITEST_PXI_COMMAND_SHIFT);
|
||||
kamiWork.data[kamiWork.current++] = (u8)((data & KAMITEST_PXI_1ST_DATA_MASK) >> KAMITEST_PXI_1ST_DATA_SHIFT);
|
||||
}
|
||||
else // 後続データ
|
||||
{
|
||||
kamiWork.data[kamiWork.current++] = (u8)((data & 0xFF0000) >> 16);
|
||||
kamiWork.data[kamiWork.current++] = (u8)((data & 0x00FF00) >> 8);
|
||||
kamiWork.data[kamiWork.current++] = (u8)((data & 0x0000FF) >> 0);
|
||||
}
|
||||
if (kamiWork.current >= kamiWork.total)
|
||||
{
|
||||
switch (kamiWork.command)
|
||||
{
|
||||
case KAMI_EXE_FORMAT:
|
||||
case KAMI_NAND_IO:
|
||||
case KAMI_CLEAR_NAND_ERRORLOG:
|
||||
case KAMI_GET_IS_TOOL_TYPE:
|
||||
if (!OS_SendMessage(&kamiWork.msgQ, NULL, OS_MESSAGE_NOBLOCK))
|
||||
{
|
||||
KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_FATAL_ERROR);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_INVALID_COMMAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void KamiReturnResult(KamiCommand command, KAMIPxiResult result)
|
||||
{
|
||||
u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | KAMITEST_PXI_RESULT_BIT |
|
||||
((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) |
|
||||
((1 << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) |
|
||||
((result << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK));
|
||||
while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
static void KamiReturnResultEx(KamiCommand command, KAMIPxiResult result, u8 size, u8* data)
|
||||
{
|
||||
u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | KAMITEST_PXI_RESULT_BIT |
|
||||
((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) |
|
||||
(((size+1) << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) |
|
||||
((result << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK));
|
||||
int i;
|
||||
while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0))
|
||||
{
|
||||
}
|
||||
for (i = 0; i < size; i+= 3)
|
||||
{
|
||||
pxiData = (u32)((data[i] << 16) | (data[i+1] << 8) | data[i+2]);
|
||||
while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void KamiThread(void *arg)
|
||||
{
|
||||
#pragma unused( arg )
|
||||
OSMessage msg;
|
||||
BOOL result;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
(void)OS_ReceiveMessage(&kamiWork.msgQ, &msg, OS_MESSAGE_BLOCK);
|
||||
switch (kamiWork.command)
|
||||
{
|
||||
case KAMI_EXE_FORMAT:
|
||||
{
|
||||
result = ExeFormat((FormatMode)kamiWork.data[0]); // Quick or Full
|
||||
if (result)
|
||||
{
|
||||
KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case KAMI_NAND_IO:
|
||||
{
|
||||
BOOL is_read;
|
||||
u32 block;
|
||||
void* buffer;
|
||||
u32 count;
|
||||
|
||||
is_read = (BOOL)kamiWork.data[0];
|
||||
KAMI_UNPACK_U32(&block, &kamiWork.data[1]);
|
||||
KAMI_UNPACK_U32((u32 *)(&buffer), &kamiWork.data[5]);
|
||||
KAMI_UNPACK_U32(&count, &kamiWork.data[9]);
|
||||
|
||||
result = FATFSi_nandRtfsIo( 0, block, buffer, (u16)count, is_read );
|
||||
if (result)
|
||||
{
|
||||
KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case KAMI_CLEAR_NAND_ERRORLOG:
|
||||
{
|
||||
if (sdmcFormatNandLog(TRUE))
|
||||
{
|
||||
KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case KAMI_GET_IS_TOOL_TYPE:
|
||||
{
|
||||
IsToolType type = IS_TOOL_TYPE_ERROR;
|
||||
u8 temp = I2C_ReadRegister( I2C_SLAVE_DEBUGGER, 0);
|
||||
if (temp != (u8)(-1)) // 赤箱、キャプチャ以外は通信エラー
|
||||
{
|
||||
if (temp == 0x44)
|
||||
{
|
||||
type = IS_TOOL_TYPE_DEBUGGER;
|
||||
}
|
||||
else if (temp == 0x43)
|
||||
{
|
||||
type = IS_TOOL_TYPE_CAPTURE;
|
||||
}
|
||||
}
|
||||
|
||||
KamiReturnResultEx(kamiWork.command, KAMI_PXI_RESULT_SUCCESS, sizeof(IsToolType), (u8*)&type);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_INVALID_COMMAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include <twl/ltdmain_end.h>
|
||||
576
build/tests/CustomSystemUpdater/ARM7.TWL/src/main.c
Normal file
576
build/tests/CustomSystemUpdater/ARM7.TWL/src/main.c
Normal file
@ -0,0 +1,576 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - components - armadillo.TWL
|
||||
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 <nitro/types.h>
|
||||
#include <twl/init/crt0.h>
|
||||
#include <twl/memorymap_sp.h>
|
||||
#include <twl/os.h>
|
||||
#include <twl/os/common/codecmode.h>
|
||||
#include <nitro/pad.h>
|
||||
#include <twl/aes.h>
|
||||
#include <twl/sea.h>
|
||||
#include <twl/fatfs.h>
|
||||
#include <twl/nwm.h>
|
||||
#include <twl/camera.h>
|
||||
#include <twl/mcu.h>
|
||||
#include <twl/cdc.h>
|
||||
#include <nitro/snd.h>
|
||||
#include <twl/snd/ARM7/sndex_api.h>
|
||||
#include <twl/rtc.h>
|
||||
#include <nitro/wvr.h>
|
||||
#include <twl/spi.h>
|
||||
#include "nvram_sp.h"
|
||||
#include "kami_pxi.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
定数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
/* 各スレッド優先度 */
|
||||
#define THREAD_PRIO_SPI 2
|
||||
#define THREAD_PRIO_MCU 4 // 暫定
|
||||
#define THREAD_PRIO_SND 6
|
||||
#define THREAD_PRIO_NWM_EVENT 7
|
||||
#define THREAD_PRIO_NWM_SDIO 8
|
||||
#define THREAD_PRIO_FATFS 8
|
||||
#define THREAD_PRIO_NWM_COMMAND 9
|
||||
#define THREAD_PRIO_NWM_WPA 10
|
||||
#define THREAD_PRIO_HOTSW 11
|
||||
#define THREAD_PRIO_AES 12
|
||||
#define THREAD_PRIO_SEA 12
|
||||
#define THREAD_PRIO_RTC 12
|
||||
#define THREAD_PRIO_SNDEX 14
|
||||
#define THREAD_PRIO_FS 15
|
||||
/* OS_THREAD_LAUNCHER_PRIORITY 16 */
|
||||
|
||||
/* ROM 内登録エリアの拡張言語コード */
|
||||
#define ROMHEADER_FOR_CHINA_BIT 0x80
|
||||
#define ROMHEADER_FOR_KOREA_BIT 0x40
|
||||
|
||||
/* 使用 DMA 番号 */
|
||||
#define DMA_NO_FATFS FATFS_DMA_4 // = 0
|
||||
#define DMA_NO_NWM 3
|
||||
|
||||
/* カードチャタリングカウンタ */
|
||||
#define CHATTERING_COUNTER 0x1988 // 100ms分 (0x1988 * 15.3us = 100000us)
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
内部関数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void PrintDebugInfo(void);
|
||||
static OSHeapHandle InitializeAllocateSystem(void);
|
||||
static void InitializeFatfs(void);
|
||||
|
||||
static void ReadUserInfo(void);
|
||||
#ifdef NVRAM_CONFIG_DATA_EX_VERSION
|
||||
static BOOL IsValidConfigEx(void);
|
||||
static u16 GetRomValidLanguage(void);
|
||||
static s32 CheckCorrectNCDEx(NVRAMConfigEx* ncdsp);
|
||||
#else
|
||||
static s32 CheckCorrectNCD(NVRAMConfig* ncdsp);
|
||||
#endif
|
||||
static void VBlankIntr(void);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: TwlSpMain
|
||||
Description: 起動ベクタ。
|
||||
Arguments: None.
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
TwlSpMain(void)
|
||||
{
|
||||
OSHeapHandle heapHandle;
|
||||
|
||||
/* OS 初期化 */
|
||||
OS_Init();
|
||||
PrintDebugInfo();
|
||||
|
||||
/* NVRAM からユーザー情報読み出し */
|
||||
ReadUserInfo();
|
||||
|
||||
/* ヒープ領域設定 */
|
||||
heapHandle = InitializeAllocateSystem();
|
||||
|
||||
/* ボタン入力サーチ初期化 */
|
||||
(void)PAD_InitXYButton();
|
||||
|
||||
/* 割込み許可 */
|
||||
(void)OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
|
||||
(void)OS_EnableIrqMask(OS_IE_V_BLANK);
|
||||
(void)GX_VBlankIntr(TRUE);
|
||||
(void)OS_EnableIrq();
|
||||
(void)OS_EnableInterrupts();
|
||||
|
||||
/* 各ライブラリ初期化 */
|
||||
AES_Init(THREAD_PRIO_AES); // AES
|
||||
SEA_Init(THREAD_PRIO_SEA); // SEA
|
||||
FS_Init(FS_DMA_NOT_USE); // FS for CARD
|
||||
FS_CreateReadServerThread(THREAD_PRIO_FS); // FS for CARD
|
||||
InitializeFatfs(); // FAT-FS
|
||||
// InitializeNwm(heapHandle); // TWL 無線
|
||||
MCU_InitIrq(THREAD_PRIO_MCU); // マイコン
|
||||
CDC_InitLib(); // CODECライブラリ初期化
|
||||
CAMERA_Init(); // カメラ
|
||||
|
||||
SND_Init(THREAD_PRIO_SND); // サウンド
|
||||
SNDEX_Init(THREAD_PRIO_SNDEX); // サウンド拡張
|
||||
RTC_Init(THREAD_PRIO_RTC); // RTC
|
||||
// WVR_Begin(heapHandle); // NITRO 無線
|
||||
SPI_Init(THREAD_PRIO_SPI);
|
||||
|
||||
///////////////
|
||||
#ifndef NAND_INITIALIZER_LIMITED_MODE
|
||||
KamiPxiInit();
|
||||
#endif
|
||||
///////////////
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
OS_Halt();
|
||||
|
||||
/* ソフトウェアリセット要求は監視しない */
|
||||
/* AGB カートリッジの挿抜チェックは行わない */
|
||||
/* DS カードの挿抜チェックは行わない */
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: PrintDebugInfo
|
||||
Description: ARM7 コンポーネントの情報をデバッグ出力する。
|
||||
Arguments: None.
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
PrintDebugInfo(void)
|
||||
{
|
||||
OS_TPrintf("ARM7: This component is running on TWL.\n");
|
||||
OS_TPrintf("ARM7: This component is \"armadillo.TWL\".\n");
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: InitializeAllocateSystem
|
||||
Description: メモリ割当てシステムを初期化する。
|
||||
Arguments: None.
|
||||
Returns: OSHeapHandle - WRAM アリーナ上に確保されたヒープのハンドルを返す。
|
||||
*---------------------------------------------------------------------------*/
|
||||
static OSHeapHandle
|
||||
InitializeAllocateSystem(void)
|
||||
{
|
||||
OSHeapHandle hh;
|
||||
void* subLo = (void*)OS_GetWramSubArenaLo();
|
||||
void* subHi = (void*)OS_GetWramSubArenaHi();
|
||||
void* privLo = (void*)OS_GetWramSubPrivArenaLo();
|
||||
void* privHi = (void*)OS_GetWramSubPrivArenaHi();
|
||||
|
||||
if (((u32)privLo == HW_PRV_WRAM) && ((u32)subHi == HW_PRV_WRAM) && ((u32)subLo < HW_PRV_WRAM))
|
||||
{
|
||||
/* SUB アリーナを SUBPRIV アリーナに吸収 */
|
||||
OS_SetWramSubArenaHi(subLo);
|
||||
OS_SetWramSubPrivArenaLo(subLo);
|
||||
privLo = subLo;
|
||||
}
|
||||
|
||||
/* アリーナを 0 クリア */
|
||||
MI_CpuClear8(privLo, (u32)privHi - (u32)privLo);
|
||||
|
||||
/* ヒープ作成初期化 */
|
||||
privLo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV, privLo, privHi, 1);
|
||||
hh = OS_CreateHeap(OS_ARENA_WRAM_SUBPRIV, privLo, privHi);
|
||||
if (hh < 0)
|
||||
{
|
||||
OS_Panic("ARM7: Failed to create heap.\n");
|
||||
}
|
||||
|
||||
/* カレントヒープに設定 */
|
||||
(void)OS_SetCurrentHeap(OS_ARENA_WRAM_SUBPRIV, hh);
|
||||
|
||||
/* ヒープサイズの確認 */
|
||||
{
|
||||
u32 heapSize;
|
||||
|
||||
heapSize = (u32)OS_CheckHeap(OS_ARENA_WRAM_SUBPRIV, hh);
|
||||
|
||||
if (heapSize <= 0)
|
||||
{
|
||||
OS_Panic("ARM7: Failed to create heap.\n");
|
||||
}
|
||||
OS_TPrintf("ARM7: heap size [%d]\n", heapSize);
|
||||
}
|
||||
|
||||
return hh;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: InitializeFatfs
|
||||
Description: FATFSライブラリを初期化する。FATFS初期化関数内でスレッド休止
|
||||
する為、休止中動作するダミーのスレッドを立てる。
|
||||
Arguments: None.
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
InitializeFatfs(void)
|
||||
{
|
||||
// FATFSライブラリの初期化
|
||||
if(!FATFS_Init( FATFS_DMA_4, FATFS_DMA_5, THREAD_PRIO_FATFS))
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
//#ifdef WM_PRECALC_ALLOWEDCHANNEL
|
||||
//extern u16 WMSP_GetAllowedChannel(u16 bitField);
|
||||
//#endif
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: ReadUserInfo
|
||||
|
||||
Description: NVRAMからユーザー情報を読み出し、共有領域に展開する。
|
||||
ミラーリングされているバッファが両方壊れている場合は、
|
||||
共有領域のユーザー情報格納場所をクリアする。
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void ReadUserInfo(void)
|
||||
{
|
||||
s32 offset;
|
||||
#ifdef NVRAM_CONFIG_DATA_EX_VERSION
|
||||
NVRAMConfigEx temp[2];
|
||||
#else
|
||||
NVRAMConfig temp[2];
|
||||
#endif
|
||||
s32 check;
|
||||
u8 *p = OS_GetSystemWork()->nvramUserInfo;
|
||||
|
||||
// オフセット読み出し
|
||||
#ifdef NVRAM_CONFIG_CONST_ADDRESS
|
||||
offset = NVRAM_CONFIG_DATA_ADDRESS_DUMMY;
|
||||
#else
|
||||
NVRAM_ReadDataBytes(NVRAM_CONFIG_DATA_OFFSET_ADDRESS, NVRAM_CONFIG_DATA_OFFSET_SIZE,
|
||||
(u8 *)(&offset));
|
||||
offset <<= NVRAM_CONFIG_DATA_OFFSET_SHIFT;
|
||||
#endif
|
||||
|
||||
#ifdef NVRAM_CONFIG_DATA_EX_VERSION
|
||||
// ミラーされた2つのデータを読み出し
|
||||
NVRAM_ReadDataBytes((u32)offset, sizeof(NVRAMConfigEx), (u8 *)(&temp[0]));
|
||||
NVRAM_ReadDataBytes((u32)(offset + SPI_NVRAM_PAGE_SIZE), sizeof(NVRAMConfigEx),
|
||||
(u8 *)(&temp[1]));
|
||||
// 2つの内どちらを使うか判断
|
||||
check = CheckCorrectNCDEx(temp);
|
||||
#else
|
||||
// ミラーされた2つのデータを読み出し
|
||||
NVRAM_ReadDataBytes((u32)offset, sizeof(NVRAMConfig), (u8 *)(&temp[0]));
|
||||
NVRAM_ReadDataBytes((u32)(offset + SPI_NVRAM_PAGE_SIZE), sizeof(NVRAMConfig), (u8 *)(&temp[1]));
|
||||
// 2つの内どちらを使うか判断
|
||||
check = CheckCorrectNCD(temp);
|
||||
#endif
|
||||
|
||||
if (check >= 3)
|
||||
{
|
||||
// アプリケーションの起動を抑制
|
||||
MI_CpuFill32(p, 0xffffffff, sizeof(NVRAMConfig));
|
||||
}
|
||||
else if (check)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
// ニックネームを補正
|
||||
if (temp[check - 1].ncd.owner.nickname.length < NVRAM_CONFIG_NICKNAME_LENGTH)
|
||||
{
|
||||
for (i = NVRAM_CONFIG_NICKNAME_LENGTH;
|
||||
i > temp[check - 1].ncd.owner.nickname.length; i--)
|
||||
{
|
||||
temp[check - 1].ncd.owner.nickname.str[i - 1] = 0x0000;
|
||||
}
|
||||
}
|
||||
// コメントを補正
|
||||
if (temp[check - 1].ncd.owner.comment.length < NVRAM_CONFIG_COMMENT_LENGTH)
|
||||
{
|
||||
for (i = NVRAM_CONFIG_COMMENT_LENGTH; i > temp[check - 1].ncd.owner.comment.length;
|
||||
i--)
|
||||
{
|
||||
temp[check - 1].ncd.owner.comment.str[i - 1] = 0x0000;
|
||||
}
|
||||
}
|
||||
// 共有領域にストア
|
||||
MI_CpuCopy32(&temp[check - 1], p, sizeof(NVRAMConfig));
|
||||
}
|
||||
else
|
||||
{
|
||||
// 共有領域をクリア
|
||||
MI_CpuClear32(p, sizeof(NVRAMConfig));
|
||||
}
|
||||
|
||||
// 無線MACアドレスをユーザー情報の後ろに展開
|
||||
{
|
||||
u8 wMac[6];
|
||||
|
||||
// NVRAMからMACアドレスを読み出し
|
||||
NVRAM_ReadDataBytes(NVRAM_CONFIG_MACADDRESS_ADDRESS, 6, wMac);
|
||||
// 展開先アドレスを計算
|
||||
p = (u8 *)((u32)p + ((sizeof(NVRAMConfig) + 3) & ~0x00000003));
|
||||
// 共有領域に展開
|
||||
MI_CpuCopy8(wMac, p, 6);
|
||||
}
|
||||
/*
|
||||
#ifdef WM_PRECALC_ALLOWEDCHANNEL
|
||||
// 使用可能チャンネルから使用許可チャンネルを計算
|
||||
{
|
||||
u16 enableChannel;
|
||||
u16 allowedChannel;
|
||||
|
||||
// 使用可能チャンネルを読み出し
|
||||
NVRAM_ReadDataBytes(NVRAM_CONFIG_ENABLECHANNEL_ADDRESS, 2, (u8 *)(&enableChannel));
|
||||
// 使用許可チャンネルを計算
|
||||
allowedChannel = WMSP_GetAllowedChannel((u16)(enableChannel >> 1));
|
||||
// 展開先アドレスを計算(MACアドレスの後ろの2バイト)
|
||||
p = (u8 *)((u32)p + 6);
|
||||
// 共有領域に展開
|
||||
*((u16 *)p) = allowedChannel;
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
#ifdef NVRAM_CONFIG_DATA_EX_VERSION
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: IsValidConfigEx
|
||||
|
||||
Description: ユーザー情報が拡張コンフィグに対応しているかどうかを調査する。
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: BOOL - 拡張ユーザー情報が有効な場合にTRUEを返す。
|
||||
無効である場合はFALSEを返す。
|
||||
*---------------------------------------------------------------------------*/
|
||||
static BOOL IsValidConfigEx(void)
|
||||
{
|
||||
u8 ipl2_type;
|
||||
|
||||
NVRAM_ReadDataBytes(NVRAM_CONFIG_IPL2_TYPE_ADDRESS, NVRAM_CONFIG_IPL2_TYPE_SIZE, &ipl2_type);
|
||||
if (ipl2_type == NVRAM_CONFIG_IPL2_TYPE_NORMAL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (ipl2_type & NVRAM_CONFIG_IPL2_TYPE_EX_MASK)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: GetRomValidLanguage
|
||||
|
||||
Description: ROM内登録エリアの情報から、拡張言語コードの対応言語ビットマップ
|
||||
に関する情報を抽出する。
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: u16 - DSカード、もしくは マルチブートバイナリが対応している
|
||||
言語コードのビットマップを返す。DSカードが拡張言語
|
||||
コードに対応していない場合は 0 を返す。
|
||||
*---------------------------------------------------------------------------*/
|
||||
static u16 GetRomValidLanguage(void)
|
||||
{
|
||||
u16 ret = 0x0000;
|
||||
u8 langBit = OS_GetSystemWork()->rom_header[0x1d];
|
||||
|
||||
// ROM内登録エリアの拡張言語コードを確認
|
||||
if (langBit == ROMHEADER_FOR_CHINA_BIT)
|
||||
{
|
||||
// for CHINA
|
||||
ret |= (0x0001 << NVRAM_CONFIG_LANG_CHINESE);
|
||||
}
|
||||
else if (langBit == ROMHEADER_FOR_KOREA_BIT)
|
||||
{
|
||||
// for KOREA
|
||||
ret |= (0x0001 << NVRAM_CONFIG_LANG_HANGUL);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: CheckCorrectNCDEx
|
||||
|
||||
Description: ミラーリングされているユーザー情報のどちらを使うべきか判定する。
|
||||
|
||||
Arguments: nvdsp - 比較するコンフィグデータ2つの配列。
|
||||
|
||||
Returns: s32 - 0: 両方不適切。
|
||||
1: 配列[ 0 ]が適切。
|
||||
2: 配列[ 1 ]が適切。
|
||||
3: アプリの起動を抑制すべき。
|
||||
*---------------------------------------------------------------------------*/
|
||||
static s32 CheckCorrectNCDEx(NVRAMConfigEx * ncdsp)
|
||||
{
|
||||
u16 i;
|
||||
u16 calc_crc;
|
||||
s32 crc_flag = 0;
|
||||
u16 saveCount;
|
||||
|
||||
// IPLが拡張言語コードに対応しているか
|
||||
if (IsValidConfigEx())
|
||||
{
|
||||
// IPLが拡張言語コードに対応している場合
|
||||
u16 rom_valid_language = GetRomValidLanguage();
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData));
|
||||
if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX))
|
||||
{
|
||||
// CRC が正しく saveCount 値が 0x80 未満のデータを正当と判断
|
||||
calc_crc =
|
||||
SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd_ex), sizeof(NVRAMConfigDataEx));
|
||||
if ((ncdsp[i].crc16_ex == calc_crc)
|
||||
&& ((0x0001 << ncdsp[i].ncd_ex.language) &
|
||||
(ncdsp[i].ncd_ex.valid_language_bitmap)))
|
||||
{
|
||||
// 拡張データ用 CRC が正しく、設定言語コードが対応言語コードに含まれる場合に正当と判断
|
||||
if (rom_valid_language & ncdsp[i].ncd_ex.valid_language_bitmap)
|
||||
{
|
||||
// 拡張言語コードで通常言語コードを上書き
|
||||
ncdsp[i].ncd.option.language = ncdsp[i].ncd_ex.language;
|
||||
}
|
||||
if (rom_valid_language & (0x0001 << NVRAM_CONFIG_LANG_CHINESE) & ~ncdsp[i].
|
||||
ncd_ex.valid_language_bitmap)
|
||||
{
|
||||
// ROM 内登録エリアに"中国語"拡張言語コードが設定されているが、
|
||||
// IPL2の対応言語コードに"中国語"拡張言語コードが含まれない場合は起動を抑制
|
||||
return 3;
|
||||
}
|
||||
crc_flag |= (1 << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// IPLが拡張言語コードに対応していない場合
|
||||
u16 rom_valid_language = GetRomValidLanguage();
|
||||
|
||||
if (rom_valid_language & (0x0001 << NVRAM_CONFIG_LANG_CHINESE))
|
||||
{
|
||||
// ROM 内登録エリアに"中国語"拡張言語コードが設定されている場合は起動を抑制
|
||||
return 3;
|
||||
}
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData));
|
||||
if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX))
|
||||
{
|
||||
// CRC が正しく saveCount 値が 0x80 未満のデータを正当と判断
|
||||
crc_flag |= (1 << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 正当なデータのうちどのデータが有効かを判定する。
|
||||
switch (crc_flag)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
// 片方のCRCだけ正常
|
||||
return crc_flag;
|
||||
|
||||
case 3:
|
||||
// 両方ともCRCが正しければどちらが最新のデータか判断する。
|
||||
saveCount = (u8)((ncdsp[0].saveCount + 1) & NVRAM_CONFIG_SAVE_COUNT_MASK);
|
||||
if (saveCount == ncdsp[1].saveCount)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 両方ともCRCが不正
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: CheckCorrectNCD
|
||||
|
||||
Description: ミラーリングされているユーザー情報のどちらを使うべきか判定する。
|
||||
|
||||
Arguments: nvdsp - 比較するコンフィグデータ2つの配列。
|
||||
|
||||
Returns: s32 - 0: 両方不適切。
|
||||
1: 配列[ 0 ]が適切。
|
||||
2: 配列[ 1 ]が適切。
|
||||
*---------------------------------------------------------------------------*/
|
||||
static s32 CheckCorrectNCD(NVRAMConfig *ncdsp)
|
||||
{
|
||||
u16 i;
|
||||
u16 calc_crc;
|
||||
s32 crc_flag = 0;
|
||||
u16 saveCount;
|
||||
|
||||
// 各ミラーデータのCRC & saveCount正当性チェック
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData));
|
||||
|
||||
if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX))
|
||||
{
|
||||
// CRCが正しく、saveCount値が0x80未満のデータを正当と判断。
|
||||
crc_flag |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
// 正当なデータのうちどのデータが有効かを判定する。
|
||||
switch (crc_flag)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
// 片方のCRCだけ正常
|
||||
return crc_flag;
|
||||
|
||||
case 3:
|
||||
// 両方ともCRCが正しければどちらが最新のデータか判断する。
|
||||
saveCount = (u8)((ncdsp[0].saveCount + 1) & NVRAM_CONFIG_SAVE_COUNT_MASK);
|
||||
if (saveCount == ncdsp[1].saveCount)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 両方ともCRCが不正
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: VBlankIntr
|
||||
Description: V ブランク割り込みベクタ。
|
||||
Arguments: None.
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
extern BOOL PMi_Initialized;
|
||||
extern void PM_SelfBlinkProc(void);
|
||||
|
||||
static void
|
||||
VBlankIntr(void)
|
||||
{
|
||||
if (PMi_Initialized)
|
||||
{
|
||||
PM_SelfBlinkProc();
|
||||
}
|
||||
}
|
||||
57
build/tests/CustomSystemUpdater/ARM9.TWL/ARM9-TS.lsf
Normal file
57
build/tests/CustomSystemUpdater/ARM9.TWL/ARM9-TS.lsf
Normal file
@ -0,0 +1,57 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: SystemUpdater
|
||||
# File: ARM9-TS.lsf
|
||||
#
|
||||
# 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 LCF SPEC FILE
|
||||
#
|
||||
|
||||
Static $(TARGET_NAME)
|
||||
{
|
||||
Address $(ADDRESS_STATIC)
|
||||
Object $(OBJS_STATIC)
|
||||
Library $(LLIBS) $(GLIBS) $(CW_LIBS)
|
||||
StackSize 4096 4096
|
||||
}
|
||||
|
||||
Autoload ITCM
|
||||
{
|
||||
Address $(ADDRESS_ITCM)
|
||||
Object * (.itcm)
|
||||
Object $(OBJS_AUTOLOAD) (.text)
|
||||
Object $(OBJS_AUTOLOAD) (.rodata)
|
||||
Object $(OBJS_AUTOLOAD) (.init)
|
||||
Object $(OBJS_AUTOLOAD) (.ctor)
|
||||
Object $(OBJS_AUTOLOAD) (.sinit)
|
||||
}
|
||||
|
||||
Autoload DTCM
|
||||
{
|
||||
Address $(ADDRESS_DTCM)
|
||||
Object * (.dtcm)
|
||||
Object $(OBJS_AUTOLOAD) (.data)
|
||||
Object $(OBJS_AUTOLOAD) (.sdata)
|
||||
Object $(OBJS_AUTOLOAD) (.bss)
|
||||
Object $(OBJS_AUTOLOAD) (.sbss)
|
||||
}
|
||||
|
||||
Ltdautoload LTDMAIN
|
||||
{
|
||||
# NITRO/TWL 共有のオーバーレイが在る場合は、さらにその後ろに配置する必要があります。
|
||||
After $(TARGET_NAME)
|
||||
Object * (.ltdmain)
|
||||
Object $(OBJS_LTDAUTOLOAD)
|
||||
Library $(LLIBS_EX) $(GLIBS_EX)
|
||||
}
|
||||
124
build/tests/CustomSystemUpdater/ARM9.TWL/Makefile
Normal file
124
build/tests/CustomSystemUpdater/ARM9.TWL/Makefile
Normal file
@ -0,0 +1,124 @@
|
||||
#! make -f
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: SystemUpdater
|
||||
# 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"を有効にしてください。
|
||||
#============================================================================
|
||||
|
||||
# COMPILE SWITCH for build SystemUpdater
|
||||
IGNORE_VERSION_CHECK ?= TRUE
|
||||
|
||||
# MAKEROM SWITCH for build SystemUpdater
|
||||
SYSM_DISABLE_DEBUG ?= TRUE
|
||||
|
||||
TARGET_FIRM = SYSTEMMENU
|
||||
TARGET_PLATFORM = TWL
|
||||
TWL_ARCHGEN = LIMITED
|
||||
|
||||
#TARGET_CODEGEN = THUMB
|
||||
|
||||
TITLEID_LO = 0SUA
|
||||
#TARGET_TAD =
|
||||
|
||||
TARGET_BIN = CustomSystemUpdater.srl
|
||||
LCFILE_SPEC = ARM9-TS.lsf
|
||||
ROM_SPEC = main.rsf
|
||||
|
||||
MAKEROM_ARM7_BASE = ../ARM7.TWL/bin/$(TWL_BUILDTYPE_ARM7)/armadillo
|
||||
MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT)
|
||||
|
||||
SRCS = main.c \
|
||||
font_data.c \
|
||||
graphics.c \
|
||||
kami_font.c \
|
||||
import.c \
|
||||
hwi.c \
|
||||
kami_pxi.c \
|
||||
kami_write_nandfirm.c \
|
||||
hw_info.c \
|
||||
keypad.c \
|
||||
kami_copy_file.c \
|
||||
debugger_hw_reset_control.c \
|
||||
debugger_card_rom.c
|
||||
|
||||
LINCLUDES = include \
|
||||
../common/include \
|
||||
$(ROOT)/build/libraries/lcfg/ARM9.TWL/include \
|
||||
$(ROOT)/build/libraries/fs/common/include \
|
||||
../../../systemMenu_tools/common/ARM9/include \
|
||||
|
||||
SRCDIR = src \
|
||||
../../../systemMenu_tools/HWInfoWriter/ARM9/src \
|
||||
../../../systemMenu_tools/common/ARM9/src \
|
||||
|
||||
#LCFILE = # using default
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
|
||||
|
||||
ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),)
|
||||
ifdef FIRM_USE_PRODUCT_KEYS
|
||||
MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo.der' \
|
||||
-DHWID_PRIVKEY='private_HWID.der'
|
||||
else
|
||||
MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo_dev.der' \
|
||||
-DHWID_PRIVKEY='private_HWID_dev.der'
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(IGNORE_VERSION_CHECK),TRUE)
|
||||
MACRO_FLAGS += -DIGNORE_VERSION_CHECK
|
||||
endif
|
||||
|
||||
|
||||
MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \
|
||||
-DPRIVKEY_PATH='$(TWL_KEYSDIR)/rsa' \
|
||||
-DCARD_REGION='$(CARD_REGION)' \
|
||||
-DDISABLE_DEBUG='$(SYSM_DISABLE_DEBUG)'
|
||||
|
||||
MAKETAD_FLAGS += -s
|
||||
|
||||
SYSMENU_LIBS = \
|
||||
libnamut$(TWL_LIBSUFFIX).a \
|
||||
libsysmenu$(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
|
||||
|
||||
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 =====
|
||||
48
build/tests/CustomSystemUpdater/ARM9.TWL/include/graphics.h
Normal file
48
build/tests/CustomSystemUpdater/ARM9.TWL/include/graphics.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: SystemUpdater
|
||||
File: graphics.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 GRAPHICS_H_
|
||||
#define GRAPHICS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#include <nitro.h>
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
ŠÖ<EFBFBD>”’è‹`
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
void InitGraphics(void);
|
||||
void DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color);
|
||||
void DrawQuad(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color);
|
||||
void DrawResult(BOOL result);
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* GRAPHICS_H_ */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
End of file
|
||||
*---------------------------------------------------------------------------*/
|
||||
71
build/tests/CustomSystemUpdater/ARM9.TWL/include/hw_info.h
Normal file
71
build/tests/CustomSystemUpdater/ARM9.TWL/include/hw_info.h
Normal file
@ -0,0 +1,71 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - NandInitializer
|
||||
File: process_hw_info.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 HW_INFO_H_
|
||||
#define HW_INFO_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#include <nitro.h>
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
型定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
関数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: HW情報全体のライト
|
||||
|
||||
Description:
|
||||
|
||||
Arguments: region :
|
||||
wirelessForceOff : 無線強制OFFならTRUEを指定
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL WriteHWInfoFile( u8 region, BOOL wirelessForceOff );
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: HWInfoファイルの削除
|
||||
|
||||
Description:
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL DeleteHWInfoFile( void );
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* HW_INFO_H_ */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
End of file
|
||||
*---------------------------------------------------------------------------*/
|
||||
49
build/tests/CustomSystemUpdater/ARM9.TWL/include/import.h
Normal file
49
build/tests/CustomSystemUpdater/ARM9.TWL/include/import.h
Normal file
@ -0,0 +1,49 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: SystemUpdater
|
||||
File: import.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_H_
|
||||
#define PROCESS_IMPORT_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#include <nitro.h>
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Œ^’è‹`
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
ŠÖ<EFBFBD>”’è‹`
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
s32 kamiImportTad(int no, int total, const char* path);
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* PROCESS_IMPORT_H_ */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
End of file
|
||||
*---------------------------------------------------------------------------*/
|
||||
@ -0,0 +1,41 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - SystemUpdater
|
||||
File: kami_copy_file.h
|
||||
|
||||
Copyright 2008 Nintendo. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Date:: $
|
||||
$Rev$
|
||||
$Author$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef KAMI_COPY_FILE_H_
|
||||
#define KAMI_COPY_FILE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#include <twl.h>
|
||||
|
||||
BOOL kamiCopyFile(char* srcPath, char* dstPath);
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* KAMI_COPY_FILE_H_ */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
End of file
|
||||
*---------------------------------------------------------------------------*/
|
||||
94
build/tests/CustomSystemUpdater/ARM9.TWL/include/kami_font.h
Normal file
94
build/tests/CustomSystemUpdater/ARM9.TWL/include/kami_font.h
Normal file
@ -0,0 +1,94 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - NandInitializer
|
||||
File: kami_font.h
|
||||
|
||||
Copyright 2008 Nintendo. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Date:: $
|
||||
$Rev$
|
||||
$Author$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef KAMI_FONT_H_
|
||||
#define KAMI_FONT_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#include <twl.h>
|
||||
|
||||
extern u8 prog_state;
|
||||
enum
|
||||
{ STATE_NONE, STATE_SELECT, STATE_KS_PARENTINIT, STATE_KS_PARENT, STATE_KS_CHILDINIT,
|
||||
STATE_KS_CHILDSCAN, STATE_KS_CHILD
|
||||
};
|
||||
extern OSHeapHandle heapHandle; // Heapハンドル;
|
||||
|
||||
extern const u16 BgScDataMain[32 * 24];
|
||||
extern const u16 BgScDataSub[32 * 24];
|
||||
extern const u32 sampleCharData[8 * 0x100];
|
||||
extern const u16 PlttDataObj[16][16];
|
||||
extern const u16 PlttDataMain[16][16];
|
||||
extern const u16 PlttDataSub[16][16];
|
||||
|
||||
void kamiFontInit(void);
|
||||
void kamiFontClear(void);
|
||||
void kamiFontClearMain(void);
|
||||
void kamiFontPut(u16 x, u16 y, u16 color, u16 no);
|
||||
void kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...);
|
||||
void kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...);
|
||||
void kamiFontFill(s16 x, s16 y, u8 color, s16 value, s32 length);
|
||||
void kamiFontFillChar(int lineNo, u8 color1, u8 color2);
|
||||
void kamiFontLoadScreenData(void);
|
||||
void kamiFontPrintfConsole(u8 color, const char *text, ...);
|
||||
void kamiFontPrintfConsoleEx(u8 color, const char *text, ...);
|
||||
|
||||
// 上画面コンソール文字列用パレット
|
||||
#define CONSOLE_ORANGE 0
|
||||
#define CONSOLE_RED 1
|
||||
#define CONSOLE_GREEN 2
|
||||
|
||||
// 下画面フォント用パレット
|
||||
#define FONT_COLOR_BLACK 0
|
||||
#define FONT_COLOR_RED 1
|
||||
#define FONT_COLOR_GREEN 2
|
||||
#define FONT_COLOR_BLUE 3
|
||||
#define FONT_COLOR_YELLOW 4
|
||||
#define FONT_COLOR_CYAN 5
|
||||
#define FONT_COLOR_PURPLE 6
|
||||
|
||||
// 下画面背景用パレット
|
||||
#define BG_COLOR_TRANS 0
|
||||
#define BG_COLOR_WHITE 1
|
||||
#define BG_COLOR_BLACK 2
|
||||
#define BG_COLOR_GRAY 3
|
||||
#define BG_COLOR_PURPLE 4
|
||||
#define BG_COLOR_PINK 5
|
||||
#define BG_COLOR_BLUE 6
|
||||
#define BG_COLOR_GREEN 7
|
||||
#define BG_COLOR_VIOLET 8
|
||||
#define BG_COLOR_RED 9
|
||||
#define BG_COLOR_YELLOW 10
|
||||
|
||||
#define BG_COLOR_NONE 0xff
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* KAMI_FONT_H_ */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
End of file
|
||||
*---------------------------------------------------------------------------*/
|
||||
89
build/tests/CustomSystemUpdater/ARM9.TWL/include/kami_pxi.h
Normal file
89
build/tests/CustomSystemUpdater/ARM9.TWL/include/kami_pxi.h
Normal file
@ -0,0 +1,89 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - NandInitializer
|
||||
File: kami_pxi.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 TWL_KAMI_TEST_KAMITEST_H_
|
||||
#define TWL_KAMI_TEST_KAMITEST_H_
|
||||
|
||||
#include "fifo.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
定数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
// 処理結果定義
|
||||
typedef enum KAMIResult
|
||||
{
|
||||
KAMI_RESULT_SUCCESS = 0,
|
||||
KAMI_RESULT_SUCCESS_TRUE = 0,
|
||||
KAMI_RESULT_SUCCESS_FALSE,
|
||||
KAMI_RESULT_INVALID_COMMAND,
|
||||
KAMI_RESULT_INVALID_PARAMETER,
|
||||
KAMI_RESULT_ILLEGAL_STATUS,
|
||||
KAMI_RESULT_BUSY,
|
||||
KAMI_RESULT_FATAL_ERROR,
|
||||
KAMI_RESULT_SEND_ERROR,
|
||||
KAMI_RESULT_MAX
|
||||
}
|
||||
KAMIResult;
|
||||
|
||||
|
||||
typedef enum {
|
||||
FORMAT_MODE_QUICK, // Quickフォーマット
|
||||
FORMAT_MODE_FULL // Fullフォーマット(各パーティション内を0xFFで埋める)
|
||||
} FormatMode;
|
||||
|
||||
// コールバック
|
||||
typedef void (*KAMICallback)(KAMIResult result, void *arg);
|
||||
|
||||
|
||||
void KamiPxiInit( void );
|
||||
|
||||
KAMIResult ExeFormatAsync(FormatMode format_mode, KAMICallback callback);
|
||||
KAMIResult kamiNandIo(u32 block, void* buffer, u32 count, BOOL is_read);
|
||||
KAMIResult kamiClearNandErrorLog( void );
|
||||
KAMIResult kamiGetIsToolType( IsToolType *pType );
|
||||
|
||||
// (重要)
|
||||
// ARM7が読み書きするためリード前はInvalidate、ライト前はフラッシュしてください。
|
||||
//
|
||||
static KAMIResult kamiNandRead(u32 block, void* buffer, u32 count)
|
||||
{
|
||||
return kamiNandIo(block, buffer, count, TRUE);
|
||||
}
|
||||
static KAMIResult kamiNandWrite(u32 block, void* buffer, u32 count)
|
||||
{
|
||||
return kamiNandIo(block, buffer, count, FALSE);
|
||||
}
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* TWL_KAMI_TEST_KAMITEST_H_ */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
End of file
|
||||
*---------------------------------------------------------------------------*/
|
||||
@ -0,0 +1,52 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - NandInitializer
|
||||
File: kami_write_nandfirm.h
|
||||
|
||||
Copyright 2008 Nintendo. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Date:: $
|
||||
$Rev$
|
||||
$Author$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef KAMI_WRITE_NAND_FIRM
|
||||
#define KAMI_WRITE_NAND_FIRM
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#include <nitro.h>
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Œ^’è‹`
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
typedef void* (*KAMIAlloc)(u32 size);
|
||||
typedef void (*KAMIFree)(void* ptr);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
ŠÖ<EFBFBD>”’è‹`
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
BOOL kamiWriteNandfirm(const char* pFullPath, NAMAlloc allocFunc, NAMFree freeFunc);
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* KAMI_WRITE_NAND_FIRM */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
End of file
|
||||
*---------------------------------------------------------------------------*/
|
||||
48
build/tests/CustomSystemUpdater/ARM9.TWL/include/keypad.h
Normal file
48
build/tests/CustomSystemUpdater/ARM9.TWL/include/keypad.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - NandInitializer
|
||||
File: keypad.h
|
||||
|
||||
Copyright 2008 Nintendo. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Date:: $
|
||||
$Rev$
|
||||
$Author$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef KAMI_KEY_PAD_H_
|
||||
#define KAMI_KEY_PAD_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#include <nitro.h>
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
ŠÖ<EFBFBD>”’è‹`
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
void kamiPadRead(void);
|
||||
BOOL kamiPadIsTrigger(u16 key);
|
||||
BOOL kamiPadIsRepeatTrigger(u16 key);
|
||||
BOOL kamiPadIsPress(u16 key);
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* KAMI_KEY_PAD_H_ */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
End of file
|
||||
*---------------------------------------------------------------------------*/
|
||||
229
build/tests/CustomSystemUpdater/ARM9.TWL/main.rsf
Normal file
229
build/tests/CustomSystemUpdater/ARM9.TWL/main.rsf
Normal file
@ -0,0 +1,229 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# 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.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
|
||||
Root /data
|
||||
File HNAA.tad HNBA.tad HNCA.tad HNLA.tad HNHA.tad TWLFontTable.dat menu_launcher.nand
|
||||
HostRoot $(PRIVKEY_PATH)
|
||||
Root /key
|
||||
File $(HWINFO_PRIVKEY) $(HWID_PRIVKEY)
|
||||
}
|
||||
734
build/tests/CustomSystemUpdater/ARM9.TWL/src/font_data.c
Normal file
734
build/tests/CustomSystemUpdater/ARM9.TWL/src/font_data.c
Normal file
@ -0,0 +1,734 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: SystemUpdater
|
||||
File: font_data.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 <nitro.h>
|
||||
|
||||
/*---------------------- BGスクリーン ---------------------------*/
|
||||
|
||||
const u16 BgScDataMain[32 * 24] = {
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
};
|
||||
|
||||
const u16 BgScDataSub[32 * 24] = {
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
};
|
||||
|
||||
/*---------------------- パレットデータ ---------------------------*/
|
||||
#define RGB555(r,g,b) (b<<10|g<<5|r)
|
||||
|
||||
const u16 PlttDataObj[16][16] = {
|
||||
{RGB555( 0, 0, 0), RGB555(31, 10, 0), RGB555(31, 0, 0), RGB555(5, 5, 20),}, // Black
|
||||
{RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red
|
||||
{RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green
|
||||
{RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue
|
||||
{RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow
|
||||
{RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan
|
||||
{RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple
|
||||
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
|
||||
};
|
||||
|
||||
// 上画面コンソール文字列パレット
|
||||
const u16 PlttDataMain[16][16] = {
|
||||
{RGB555(31, 31, 31), RGB555(31, 10, 0), RGB555(0, 0, 0), RGB555(0, 0, 0),}, // Orange
|
||||
{RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red
|
||||
{RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green
|
||||
{RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue
|
||||
{RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow
|
||||
{RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan
|
||||
{RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple
|
||||
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
|
||||
{RGB555( 5, 5, 5), RGB555( 5, 5, 5), RGB555( 5, 5, 5), RGB555(31, 31, 31),}, // Black
|
||||
};
|
||||
|
||||
// 下画面コンソール文字列パレット
|
||||
const u16 PlttDataSub[16][16] = {
|
||||
{RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(25, 25, 25), RGB555(31, 31, 31),}, // Black
|
||||
{RGB555(31, 31, 31), RGB555(21, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red
|
||||
{RGB555(31, 31, 31), RGB555( 0, 21, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green
|
||||
{RGB555(31, 31, 31), RGB555( 0, 0, 21), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue
|
||||
{RGB555(31, 31, 31), RGB555(21, 21, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow
|
||||
{RGB555(31, 31, 31), RGB555(0, 21, 21), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan
|
||||
{RGB555(31, 31, 31), RGB555(21, 0, 21), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple
|
||||
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
|
||||
{RGB555(31, 31, 31), RGB555(20, 20, 20), RGB555(20, 20, 20), RGB555(20, 20, 20),}, // Gray
|
||||
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
|
||||
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
|
||||
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
|
||||
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
|
||||
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
|
||||
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
|
||||
|
||||
// 背景カラーはこの16番パレット
|
||||
// 白 黒 灰 むらさき ピンク みずいろ 緑 青紫 赤 黄
|
||||
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(20, 20, 20), RGB555(31, 15, 31), RGB555(31, 20, 20), RGB555(20, 29, 31), RGB555(20, 31, 20), RGB555(21, 21, 31), RGB555(31, 0, 0), RGB555(31, 31, 10), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), } // White
|
||||
};
|
||||
|
||||
/*---------------------- キャラクタデータ -------------------------*/
|
||||
|
||||
const u32 sampleCharData[8 * 0x100] = {
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x11111111, 0x11111111, // 0001h use for import progress bar
|
||||
0x11111111, 0x11111111, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h
|
||||
0x00100010, 0x00100010, 0x00100001, 0x00100001,
|
||||
0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h
|
||||
0x00000001, 0x00000001, 0x00000001, 0x01111110,
|
||||
0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h
|
||||
0x00100000, 0x00010000, 0x00001000, 0x00000110,
|
||||
0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h
|
||||
0x00010001, 0x00100001, 0x01000000, 0x00000000,
|
||||
0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h
|
||||
0x00001000, 0x00101010, 0x01001010, 0x01001001,
|
||||
0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h
|
||||
0x00010010, 0x00010010, 0x00010010, 0x00001001,
|
||||
0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h
|
||||
0x00011111, 0x00001000, 0x00000001, 0x00011110,
|
||||
0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h
|
||||
0x00000001, 0x00000110, 0x00011000, 0x00100000,
|
||||
0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah
|
||||
0x00010001, 0x00010001, 0x00010001, 0x00001010,
|
||||
0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh
|
||||
0x00000000, 0x00000001, 0x00000001, 0x00111110,
|
||||
0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch
|
||||
0x00010000, 0x00000001, 0x00000001, 0x00011110,
|
||||
0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh
|
||||
0x01000001, 0x01000001, 0x00100010, 0x00011100,
|
||||
0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh
|
||||
0x00010100, 0x00010100, 0x00011000, 0x00001100,
|
||||
0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh
|
||||
0x00010010, 0x00000010, 0x00000010, 0x00111100,
|
||||
0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h
|
||||
0x00111111, 0x00000100, 0x00000100, 0x00011000,
|
||||
0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h
|
||||
0x01110100, 0x00000010, 0x00001010, 0x01110010,
|
||||
0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h
|
||||
0x00011110, 0x00100001, 0x00100000, 0x00011110,
|
||||
0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h
|
||||
0x01000000, 0x01000000, 0x00100000, 0x00011100,
|
||||
0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h
|
||||
0x00001000, 0x00001000, 0x00001000, 0x00110000,
|
||||
0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h
|
||||
0x00000010, 0x00000001, 0x00000001, 0x00111110,
|
||||
0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h
|
||||
0x00010001, 0x00111001, 0x01010101, 0x00011001,
|
||||
0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h
|
||||
0x00010001, 0x00010001, 0x00001010, 0x00000100,
|
||||
0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h
|
||||
0x00101001, 0x01010001, 0x01010001, 0x00001100,
|
||||
0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h
|
||||
0x00010010, 0x00100001, 0x01000000, 0x00000000,
|
||||
0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah
|
||||
0x00010001, 0x00011001, 0x00110101, 0x00001001,
|
||||
0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh
|
||||
0x00010001, 0x00111001, 0x01010101, 0x00011001,
|
||||
0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch
|
||||
0x00010001, 0x00010001, 0x00001010, 0x00000100,
|
||||
0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh
|
||||
0x00101001, 0x01010001, 0x01010001, 0x00001100,
|
||||
0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh
|
||||
0x00010010, 0x00100001, 0x01000000, 0x00000000,
|
||||
0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh
|
||||
0x00010001, 0x00011001, 0x00110101, 0x00001001,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h
|
||||
0x00001000, 0x00001000, 0x00000000, 0x00001000,
|
||||
0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h
|
||||
0x00100100, 0x01111111, 0x00010010, 0x00010010,
|
||||
0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h
|
||||
0x00111110, 0x01001000, 0x00111111, 0x00001000,
|
||||
0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h
|
||||
0x00001000, 0x00100100, 0x01010010, 0x00100001,
|
||||
0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h
|
||||
0x01000110, 0x00101001, 0x00110001, 0x01001110,
|
||||
0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h
|
||||
0x00000100, 0x00000100, 0x00001000, 0x01110000,
|
||||
0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h
|
||||
0x00010000, 0x00010000, 0x00001000, 0x00000111,
|
||||
0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah
|
||||
0x00011100, 0x00101010, 0x01001001, 0x00001000,
|
||||
0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh
|
||||
0x01111111, 0x00001000, 0x00001000, 0x00001000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch
|
||||
0x00000000, 0x00001100, 0x00001000, 0x00000100,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh
|
||||
0x01111111, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00001100,
|
||||
0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh
|
||||
0x00001000, 0x00000100, 0x00000010, 0x00000001,
|
||||
0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h
|
||||
0x01000001, 0x01000001, 0x01000001, 0x00111110,
|
||||
0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h
|
||||
0x00010000, 0x00010000, 0x00010000, 0x00010000,
|
||||
0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h
|
||||
0x00111110, 0x00000001, 0x00000001, 0x01111111,
|
||||
0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h
|
||||
0x00111110, 0x01000000, 0x01000001, 0x00111110,
|
||||
0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h
|
||||
0x00100100, 0x00100010, 0x01111111, 0x00100000,
|
||||
0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h
|
||||
0x01000000, 0x01000000, 0x01000001, 0x00111110,
|
||||
0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h
|
||||
0x01000001, 0x01000001, 0x01000001, 0x00111110,
|
||||
0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h
|
||||
0x00010000, 0x00010000, 0x00001000, 0x00001000,
|
||||
0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h
|
||||
0x00111110, 0x01000001, 0x01000001, 0x00111110,
|
||||
0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h
|
||||
0x01000001, 0x01111110, 0x01000000, 0x00111110,
|
||||
0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah
|
||||
0x00000000, 0x00000000, 0x00001100, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh
|
||||
0x00000000, 0x00001100, 0x00001000, 0x00000100,
|
||||
0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch
|
||||
0x00000001, 0x00000110, 0x00011000, 0x01100000,
|
||||
0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh
|
||||
0x00000000, 0x00000000, 0x01111111, 0x00000000,
|
||||
0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh
|
||||
0x01000000, 0x00110000, 0x00001100, 0x00000011,
|
||||
0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh
|
||||
0x00110000, 0x00001000, 0x00000000, 0x00001000,
|
||||
0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h
|
||||
0x01010101, 0x01010101, 0x01010101, 0x00111010,
|
||||
0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h
|
||||
0x00100010, 0x00111110, 0x01000001, 0x01000001,
|
||||
0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h
|
||||
0x00111111, 0x01000001, 0x01000001, 0x00111111,
|
||||
0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h
|
||||
0x00000001, 0x00000001, 0x01000010, 0x00111100,
|
||||
0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h
|
||||
0x01000001, 0x01000001, 0x00100001, 0x00011111,
|
||||
0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h
|
||||
0x01111111, 0x00000001, 0x00000001, 0x01111111,
|
||||
0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h
|
||||
0x00111111, 0x00000001, 0x00000001, 0x00000001,
|
||||
0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h
|
||||
0x01111001, 0x01000001, 0x01000010, 0x00111100,
|
||||
0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h
|
||||
0x01111111, 0x01000001, 0x01000001, 0x01000001,
|
||||
0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h
|
||||
0x00001000, 0x00001000, 0x00001000, 0x00111110,
|
||||
0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah
|
||||
0x01000001, 0x01000001, 0x00100010, 0x00011100,
|
||||
0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh
|
||||
0x00000011, 0x00000101, 0x00011001, 0x01100001,
|
||||
0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch
|
||||
0x00000001, 0x00000001, 0x00000001, 0x01111111,
|
||||
0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh
|
||||
0x01001001, 0x01000001, 0x01000001, 0x01000001,
|
||||
0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh
|
||||
0x01001001, 0x01010001, 0x01100001, 0x01000001,
|
||||
0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh
|
||||
0x01000001, 0x01000001, 0x00100010, 0x00011100,
|
||||
0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h
|
||||
0x00111111, 0x00000001, 0x00000001, 0x00000001,
|
||||
0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h
|
||||
0x01000001, 0x01011001, 0x00100010, 0x01011100,
|
||||
0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h
|
||||
0x00111111, 0x01000001, 0x01000001, 0x01000001,
|
||||
0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h
|
||||
0x00111110, 0x01000000, 0x01000001, 0x00111110,
|
||||
0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h
|
||||
0x00001000, 0x00001000, 0x00001000, 0x00001000,
|
||||
0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h
|
||||
0x01000001, 0x01000001, 0x00100010, 0x00011100,
|
||||
0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h
|
||||
0x00100010, 0x00010100, 0x00010100, 0x00001000,
|
||||
0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h
|
||||
0x01001001, 0x01010101, 0x01100011, 0x01000001,
|
||||
0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h
|
||||
0x00001000, 0x00010100, 0x00100010, 0x01000001,
|
||||
0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h
|
||||
0x00001000, 0x00001000, 0x00001000, 0x00001000,
|
||||
0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah
|
||||
0x00001000, 0x00000100, 0x00000010, 0x01111111,
|
||||
0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh
|
||||
0x00000100, 0x00000100, 0x00000100, 0x01111100,
|
||||
0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch
|
||||
0x00001000, 0x00111110, 0x00001000, 0x00001000,
|
||||
0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh
|
||||
0x00010000, 0x00010000, 0x00010000, 0x00011111,
|
||||
0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh
|
||||
0x00000000, 0x00000000, 0x00000000, 0x01111111,
|
||||
0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h
|
||||
0x00111110, 0x00100001, 0x00100001, 0x01011110,
|
||||
0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h
|
||||
0x01000001, 0x01000001, 0x01000001, 0x00111111,
|
||||
0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h
|
||||
0x00000001, 0x00000001, 0x01000010, 0x00111100,
|
||||
0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h
|
||||
0x01000001, 0x01000001, 0x01000001, 0x01111110,
|
||||
0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h
|
||||
0x01111111, 0x00000001, 0x01000001, 0x00111110,
|
||||
0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h
|
||||
0x01111111, 0x00001000, 0x00001000, 0x00001000,
|
||||
0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h
|
||||
0x01000001, 0x01111110, 0x01000000, 0x00111110,
|
||||
0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h
|
||||
0x00111111, 0x01000001, 0x01000001, 0x01000001,
|
||||
0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h
|
||||
0x00001000, 0x00001000, 0x00001000, 0x00001000,
|
||||
0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah
|
||||
0x00100000, 0x00100001, 0x00100001, 0x00011110,
|
||||
0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh
|
||||
0x00011001, 0x00000111, 0x00011001, 0x01100001,
|
||||
0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch
|
||||
0x00001000, 0x00001000, 0x00001000, 0x00001000,
|
||||
0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh
|
||||
0x01001001, 0x01001001, 0x01001001, 0x01001001,
|
||||
0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh
|
||||
0x01000001, 0x01000001, 0x01000001, 0x01000001,
|
||||
0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh
|
||||
0x01000001, 0x01000001, 0x00100010, 0x00011100,
|
||||
0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h
|
||||
0x01000001, 0x01000011, 0x00111101, 0x00000001,
|
||||
0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h
|
||||
0x01000001, 0x01100001, 0x01011110, 0x01000000,
|
||||
0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h
|
||||
0x00000011, 0x00000001, 0x00000001, 0x00000001,
|
||||
0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h
|
||||
0x00001110, 0x00110000, 0x01000001, 0x00111110,
|
||||
0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h
|
||||
0x00000100, 0x00000100, 0x00000100, 0x01111000,
|
||||
0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h
|
||||
0x01000001, 0x01000001, 0x01000001, 0x01111110,
|
||||
0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h
|
||||
0x00100010, 0x00100010, 0x00010100, 0x00001000,
|
||||
0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h
|
||||
0x01001001, 0x00101010, 0x00101010, 0x00010100,
|
||||
0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h
|
||||
0x00001100, 0x00001100, 0x00010010, 0x00100001,
|
||||
0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h
|
||||
0x00100010, 0x00011100, 0x00001000, 0x00000110,
|
||||
0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah
|
||||
0x00001000, 0x00000100, 0x00000010, 0x00111111,
|
||||
0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh
|
||||
0x00011000, 0x00100100, 0x00000100, 0x01111000,
|
||||
0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch
|
||||
0x00011110, 0x00110101, 0x00101101, 0x00010010,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh
|
||||
0x00100001, 0x00100001, 0x00000001, 0x00000010,
|
||||
0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh
|
||||
0x00011110, 0x00100000, 0x00100000, 0x00011100,
|
||||
0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh
|
||||
0x00111110, 0x00010000, 0x00001100, 0x00110010,
|
||||
0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h
|
||||
0x01000100, 0x00011110, 0x00100101, 0x00010110,
|
||||
0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h
|
||||
0x00101011, 0x00100010, 0x00010100, 0x00000100,
|
||||
0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h
|
||||
0x00101011, 0x00101001, 0x00011001, 0x00000100,
|
||||
0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h
|
||||
0x00001000, 0x00011110, 0x00101001, 0x00000110,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h
|
||||
0x00100011, 0x00100000, 0x00100000, 0x00011100,
|
||||
0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h
|
||||
0x00111110, 0x01010101, 0x01001101, 0x00100110,
|
||||
0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h
|
||||
0x01000001, 0x01000001, 0x00000001, 0x00000010,
|
||||
0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h
|
||||
0x01000000, 0x01000000, 0x00100000, 0x00011100,
|
||||
0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h
|
||||
0x00010000, 0x00001000, 0x00010100, 0x01100010,
|
||||
0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah
|
||||
0x00111110, 0x01000101, 0x01000101, 0x00100010,
|
||||
0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh
|
||||
0x01010010, 0x00010010, 0x00010010, 0x00001001,
|
||||
0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch
|
||||
0x00111110, 0x00010000, 0x00000010, 0x00111100,
|
||||
0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh
|
||||
0x00000001, 0x00000110, 0x00011000, 0x00100000,
|
||||
0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh
|
||||
0x00100001, 0x00100001, 0x00100001, 0x00010010,
|
||||
0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh
|
||||
0x00000000, 0x00000001, 0x00000001, 0x00111110,
|
||||
0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h
|
||||
0x00100000, 0x00000010, 0x00000010, 0x00111100,
|
||||
0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h
|
||||
0x01000001, 0x01000001, 0x00100010, 0x00011100,
|
||||
0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h
|
||||
0x00010100, 0x00010100, 0x00011000, 0x00001100,
|
||||
0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h
|
||||
0x00100010, 0x00000010, 0x00000010, 0x01111100,
|
||||
0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h
|
||||
0x01111111, 0x00001000, 0x00001000, 0x00110000,
|
||||
0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h
|
||||
0x01110100, 0x00000010, 0x00001010, 0x01110010,
|
||||
0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h
|
||||
0x00111100, 0x01000010, 0x01000000, 0x00111100,
|
||||
0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h
|
||||
0x01000000, 0x01000000, 0x00100000, 0x00011100,
|
||||
0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h
|
||||
0x00001000, 0x00001000, 0x00001000, 0x00110000,
|
||||
0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h
|
||||
0x00000010, 0x00000001, 0x00000001, 0x00111110,
|
||||
0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah
|
||||
0x00010001, 0x00111100, 0x00010010, 0x00001100,
|
||||
0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh
|
||||
0x00000010, 0x00000010, 0x00001010, 0x01110010,
|
||||
0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch
|
||||
0x01001011, 0x01101101, 0x01010101, 0x00110010,
|
||||
0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh
|
||||
0x01000110, 0x01110010, 0x01001011, 0x00110010,
|
||||
0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh
|
||||
0x01001001, 0x01000101, 0x01000101, 0x00110010,
|
||||
0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh
|
||||
0x00100001, 0x00111001, 0x01100101, 0x00011001,
|
||||
0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h
|
||||
0x00100001, 0x00100001, 0x00010010, 0x00001100,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h
|
||||
0x00000000, 0x00000100, 0x00001010, 0x00000100,
|
||||
0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h
|
||||
0x00010000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h
|
||||
0x00001000, 0x00001000, 0x00001000, 0x00001110,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h
|
||||
0x00000000, 0x00000010, 0x00000100, 0x00000100,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h
|
||||
0x00011000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h
|
||||
0x01000000, 0x01000000, 0x00100000, 0x00011100,
|
||||
0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h
|
||||
0x00010100, 0x00001100, 0x00000100, 0x00000010,
|
||||
0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h
|
||||
0x00010000, 0x00001111, 0x00001000, 0x00001000,
|
||||
0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h
|
||||
0x00100001, 0x00100000, 0x00010000, 0x00001100,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah
|
||||
0x00001000, 0x00001000, 0x00001000, 0x01111111,
|
||||
0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh
|
||||
0x00011000, 0x00010100, 0x00010010, 0x00011001,
|
||||
0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach
|
||||
0x00100010, 0x00010010, 0x00000100, 0x00000100,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh
|
||||
0x00100000, 0x00100000, 0x00100000, 0x01111111,
|
||||
0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh
|
||||
0x00111110, 0x00100000, 0x00100000, 0x00111110,
|
||||
0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh
|
||||
0x00101010, 0x00100000, 0x00010000, 0x00001110,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h
|
||||
0x01111111, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h
|
||||
0x00011000, 0x00001000, 0x00001000, 0x00000100,
|
||||
0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h
|
||||
0x00010111, 0x00010000, 0x00010000, 0x00010000,
|
||||
0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h
|
||||
0x01000001, 0x01000000, 0x00100000, 0x00011000,
|
||||
0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h
|
||||
0x00001000, 0x00001000, 0x00001000, 0x01111111,
|
||||
0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h
|
||||
0x00101000, 0x00100100, 0x00100010, 0x00110001,
|
||||
0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h
|
||||
0x01000100, 0x01000100, 0x01000010, 0x00100001,
|
||||
0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h
|
||||
0x01111111, 0x00010000, 0x00010000, 0x00010000,
|
||||
0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h
|
||||
0x01000010, 0x01000000, 0x00100000, 0x00011000,
|
||||
0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h
|
||||
0x00100001, 0x00100000, 0x00010000, 0x00001100,
|
||||
0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah
|
||||
0x01000000, 0x01000000, 0x01000000, 0x01111110,
|
||||
0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh
|
||||
0x00100010, 0x00100000, 0x00010000, 0x00001100,
|
||||
0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch
|
||||
0x01000100, 0x00100000, 0x00011000, 0x00000111,
|
||||
0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh
|
||||
0x00010000, 0x00011000, 0x00100100, 0x01000011,
|
||||
0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh
|
||||
0x00100010, 0x00000010, 0x00000010, 0x01111100,
|
||||
0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh
|
||||
0x00100000, 0x00100000, 0x00011000, 0x00000110,
|
||||
0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h
|
||||
0x01110001, 0x01000000, 0x00100000, 0x00011000,
|
||||
0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h
|
||||
0x01111111, 0x00010000, 0x00010000, 0x00001100,
|
||||
0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h
|
||||
0x01000000, 0x00100000, 0x00010000, 0x00001110,
|
||||
0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h
|
||||
0x00010000, 0x00010000, 0x00001000, 0x00000110,
|
||||
0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h
|
||||
0x00011010, 0x01100010, 0x00000010, 0x00000010,
|
||||
0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h
|
||||
0x00010000, 0x00010000, 0x00001000, 0x00000110,
|
||||
0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h
|
||||
0x00000000, 0x00000000, 0x00000000, 0x01111111,
|
||||
0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h
|
||||
0x00101000, 0x00010000, 0x00101000, 0x01000110,
|
||||
0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h
|
||||
0x00010000, 0x00011100, 0x01101011, 0x00001000,
|
||||
0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h
|
||||
0x00100000, 0x00100000, 0x00011000, 0x00000111,
|
||||
0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah
|
||||
0x01000010, 0x01000010, 0x01000001, 0x01000001,
|
||||
0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh
|
||||
0x00000001, 0x00000001, 0x00000001, 0x01111110,
|
||||
0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch
|
||||
0x01000000, 0x00100000, 0x00010000, 0x00001110,
|
||||
0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh
|
||||
0x00010001, 0x00100001, 0x01000000, 0x00000000,
|
||||
0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh
|
||||
0x00001000, 0x00101010, 0x01001010, 0x01001001,
|
||||
0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh
|
||||
0x00100010, 0x00010100, 0x00001000, 0x00010000,
|
||||
0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h
|
||||
0x01110000, 0x00000110, 0x00011000, 0x01100000,
|
||||
0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h
|
||||
0x00000100, 0x00100010, 0x01000010, 0x01111111,
|
||||
0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h
|
||||
0x00101000, 0x00010000, 0x00101100, 0x01000011,
|
||||
0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h
|
||||
0x00000100, 0x00000100, 0x00000100, 0x01111000,
|
||||
0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h
|
||||
0x00100010, 0x00010100, 0x00000100, 0x00000100,
|
||||
0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h
|
||||
0x00100000, 0x00100000, 0x00100000, 0x01111111,
|
||||
0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h
|
||||
0x01111110, 0x01000000, 0x01000000, 0x01111110,
|
||||
0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h
|
||||
0x01000000, 0x01000000, 0x00100000, 0x00011100,
|
||||
0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h
|
||||
0x01000010, 0x01000000, 0x00100000, 0x00011000,
|
||||
0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h
|
||||
0x01001010, 0x01001010, 0x00101010, 0x00011001,
|
||||
0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah
|
||||
0x01000010, 0x00100010, 0x00010010, 0x00001110,
|
||||
0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh
|
||||
0x01000001, 0x01000001, 0x01000001, 0x01111111,
|
||||
0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch
|
||||
0x01000000, 0x01000000, 0x00100000, 0x00011100,
|
||||
0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh
|
||||
0x01000000, 0x00100000, 0x00010000, 0x00001111,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh 0
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh 1
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h 2
|
||||
0x00101001, 0x01010001, 0x01010001, 0x00001100,
|
||||
0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h 3
|
||||
0x00010010, 0x00100001, 0x01000000, 0x00000000,
|
||||
0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h 4
|
||||
0x00100001, 0x00111001, 0x01100101, 0x00011001,
|
||||
0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h 5
|
||||
0x00010000, 0x00011100, 0x00110010, 0x00001100,
|
||||
0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h 6
|
||||
0x00111110, 0x01100101, 0x00100101, 0x00010010,
|
||||
0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h 7
|
||||
0x00000110, 0x01000101, 0x01000101, 0x00111110,
|
||||
0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h 8
|
||||
0x01010010, 0x01010101, 0x01001101, 0x00100110,
|
||||
0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h 9
|
||||
0x00011111, 0x01000010, 0x01000010, 0x00111100,
|
||||
0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h 10
|
||||
0x01000010, 0x00100100, 0x00000100, 0x00000100,
|
||||
0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h 11
|
||||
0x01001001, 0x01001001, 0x00111000, 0x00000100,
|
||||
0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah 12
|
||||
0x00001000, 0x00011110, 0x00101001, 0x00000110,
|
||||
0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh 13
|
||||
0x00111010, 0x01000110, 0x01000000, 0x00111000,
|
||||
0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech 14
|
||||
0x01000110, 0x01000000, 0x00100000, 0x00011000,
|
||||
0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh 15
|
||||
0x01000011, 0x01001100, 0x01010010, 0x00111100,
|
||||
0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh 16
|
||||
0x00100110, 0x00100010, 0x00100011, 0x01000010,
|
||||
0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh 17
|
||||
0x01000011, 0x01000000, 0x01000010, 0x00111100,
|
||||
0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h 18
|
||||
0x01000010, 0x01000011, 0x01000010, 0x00110010,
|
||||
0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h 19
|
||||
0x01000110, 0x01000101, 0x01000101, 0x00111001,
|
||||
0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h 20
|
||||
0x00100100, 0x00100100, 0x00100010, 0x00010001,
|
||||
0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h 21
|
||||
0x00111111, 0x00001000, 0x00001000, 0x00001000,
|
||||
0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h 22
|
||||
0x00100001, 0x00100000, 0x00010000, 0x00001100,
|
||||
0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h 23
|
||||
0x00100001, 0x00100000, 0x00010000, 0x00001100,
|
||||
|
||||
0x33330000,
|
||||
0x33330000,
|
||||
0x33000000,
|
||||
0x33000000, // 00f6h
|
||||
0x33000000,
|
||||
0x33000000,
|
||||
0x33330000,
|
||||
0x33330000,
|
||||
|
||||
|
||||
0x00020000, // 00f7h
|
||||
0x00020000,
|
||||
0x00020000,
|
||||
0x22222222,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
|
||||
0x00000000, // 00f8h
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x11111111,
|
||||
0x11111111,
|
||||
0x11111111,
|
||||
0x11111111,
|
||||
|
||||
0x11111111, // 00f9h
|
||||
0x11111111,
|
||||
0x11111111,
|
||||
0x11111111,
|
||||
0x11111111,
|
||||
0x11111111,
|
||||
0x11111111,
|
||||
0x11111111,
|
||||
|
||||
0x11111111, // 00fah
|
||||
0x11111111,
|
||||
0x11111111,
|
||||
0x11111111,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
|
||||
0x00000000, // 00fbh
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x22222222,
|
||||
0x00020000,
|
||||
0x00020000,
|
||||
0x00020000,
|
||||
0x00020000,
|
||||
|
||||
0x00020000, // 00fch
|
||||
0x00020000,
|
||||
0x00020000,
|
||||
0x22222222,
|
||||
0x00020000,
|
||||
0x00020000,
|
||||
0x00020000,
|
||||
0x00020000,
|
||||
|
||||
0x00020000, // 00fdh
|
||||
0x00020000,
|
||||
0x00020000,
|
||||
0x00020000,
|
||||
0x00020000,
|
||||
0x00020000,
|
||||
0x00020000,
|
||||
0x00020000,
|
||||
|
||||
0x00000000, // 00feh
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x22222222,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
|
||||
0x00020000,
|
||||
0x00220000,
|
||||
0x02122222,
|
||||
0x21111112,
|
||||
0x21111112,
|
||||
0x02122222,
|
||||
0x00220000,
|
||||
0x00020000,
|
||||
|
||||
|
||||
|
||||
/*
|
||||
0x00022222,
|
||||
0x00002112,
|
||||
0x00021112,
|
||||
0x00211122,
|
||||
0x02111202,
|
||||
0x21112000,
|
||||
0x02120000,
|
||||
0x00200000,
|
||||
*/
|
||||
|
||||
/*
|
||||
0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh
|
||||
0x00001000, 0x00001000, 0x00001000, 0x00000110
|
||||
*/
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
End of file
|
||||
*---------------------------------------------------------------------------*/
|
||||
199
build/tests/CustomSystemUpdater/ARM9.TWL/src/graphics.c
Normal file
199
build/tests/CustomSystemUpdater/ARM9.TWL/src/graphics.c
Normal file
@ -0,0 +1,199 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: SystemUpdater
|
||||
File: praphics.c
|
||||
|
||||
Copyright 2008 Nintendo. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Date:: $
|
||||
$Rev$
|
||||
$Author$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <twl.h>
|
||||
//#include <twl/mic.h>
|
||||
#include <nitro/snd.h>
|
||||
#include "kami_font.h"
|
||||
#include "graphics.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
関数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: InitGraphics
|
||||
|
||||
Description: 表示の初期化処理
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
InitGraphics(void)
|
||||
{
|
||||
GX_DispOff();
|
||||
GXS_DispOff();
|
||||
|
||||
//---- VRAM クリア
|
||||
GX_SetBankForLCDC(GX_VRAM_LCDC_ALL);
|
||||
MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE);
|
||||
|
||||
//---- OAMとパレットクリア
|
||||
MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE);
|
||||
MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE);
|
||||
MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE);
|
||||
MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE);
|
||||
|
||||
//---- OBJバンクの設定
|
||||
GX_SetBankForOBJ(GX_VRAM_OBJ_128_A);
|
||||
GX_SetBankForSubOBJ(GX_VRAM_SUB_OBJ_128_D);
|
||||
|
||||
//---- BGバンクの設定
|
||||
GX_SetBankForBG(GX_VRAM_BG_128_B);
|
||||
GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C);
|
||||
|
||||
//---- 表示モード設定
|
||||
GX_SetGraphicsMode (GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_3D);
|
||||
GX_SetVisiblePlane (GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ);
|
||||
GXS_SetVisiblePlane(GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ);
|
||||
|
||||
//---- 3D初期化
|
||||
G3X_Init();
|
||||
G3X_InitMtxStack();
|
||||
G2_SetBG0Priority(3);
|
||||
G3X_AlphaTest(FALSE, 0);
|
||||
G3X_AntiAlias(TRUE);
|
||||
G3X_EdgeMarking(FALSE);
|
||||
G3X_SetFog(FALSE, (GXFogBlend)0, (GXFogSlope)0, 0);
|
||||
G3X_SetClearColor(0, 0, 0x7fff, 63, FALSE);
|
||||
G3_ViewPort(0, 0, 255, 191);
|
||||
G3_MtxMode(GX_MTXMODE_POSITION_VECTOR);
|
||||
|
||||
//---- 32KバイトのOBJで2Dマップモードで使用
|
||||
GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_2D);
|
||||
|
||||
// スクリーンオフセット及びキャラクターオフセットの設定
|
||||
GX_SetBGScrOffset(GX_BGSCROFFSET_0x00000);
|
||||
GX_SetBGCharOffset(GX_BGCHAROFFSET_0x10000);
|
||||
|
||||
G2_SetBG1Control(
|
||||
GX_BG_SCRSIZE_TEXT_256x256,
|
||||
GX_BG_COLORMODE_16,
|
||||
GX_BG_SCRBASE_0x0000 ,
|
||||
GX_BG_CHARBASE_0x00000,
|
||||
GX_BG_EXTPLTT_01
|
||||
);
|
||||
|
||||
G2S_SetBG0Control(
|
||||
GX_BG_SCRSIZE_TEXT_256x256,
|
||||
GX_BG_COLORMODE_16,
|
||||
GX_BG_SCRBASE_0x0000 ,
|
||||
GX_BG_CHARBASE_0x04000,
|
||||
GX_BG_EXTPLTT_01
|
||||
);
|
||||
|
||||
G2S_SetBG1Control(
|
||||
GX_BG_SCRSIZE_TEXT_256x256,
|
||||
GX_BG_COLORMODE_16,
|
||||
GX_BG_SCRBASE_0x2000 ,
|
||||
GX_BG_CHARBASE_0x04000,
|
||||
GX_BG_EXTPLTT_01
|
||||
);
|
||||
|
||||
G2_BG1Mosaic(FALSE);
|
||||
G2S_BG1Mosaic(FALSE);
|
||||
|
||||
//---- データロード
|
||||
GX_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData));
|
||||
GX_LoadBG1Char( sampleCharData, 0, sizeof(sampleCharData));
|
||||
GX_LoadBGPltt ( PlttDataMain, 0, sizeof(PlttDataMain));
|
||||
GX_LoadBG1Scr ( BgScDataMain, 0, sizeof(BgScDataMain));
|
||||
GX_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj));
|
||||
|
||||
GXS_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData));
|
||||
GXS_LoadBG0Char( sampleCharData, 0, sizeof(sampleCharData));
|
||||
GXS_LoadBGPltt ( PlttDataSub, 0, sizeof(PlttDataSub));
|
||||
GXS_LoadBG0Scr ( BgScDataSub, 0, sizeof(BgScDataSub));
|
||||
GXS_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj));
|
||||
|
||||
GX_DispOn();
|
||||
GXS_DispOn();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DrawLine
|
||||
|
||||
Description: 三角ポリゴンで線を描画
|
||||
|
||||
Arguments: sx - 描画する線の開始点のx座標
|
||||
sy - 描画する線の開始点のy座標
|
||||
ex - 描画する線の終点のx座標
|
||||
ey - 描画する線の終点のy座標
|
||||
color - 描画する線の色
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color)
|
||||
{
|
||||
fx16 fsx = (fx16)(((sx - 128) * 0x1000) / 128);
|
||||
fx16 fsy = (fx16)(((96 - sy) * 0x1000) / 96);
|
||||
fx16 fex = (fx16)(((ex - 128) * 0x1000) / 128);
|
||||
fx16 fey = (fx16)(((96 - ey) * 0x1000) / 96);
|
||||
|
||||
G3_Begin(GX_BEGIN_TRIANGLES);
|
||||
{
|
||||
G3_Color( color );
|
||||
G3_Vtx(fsx, fsy, 0);
|
||||
G3_Color( color );
|
||||
G3_Vtx(fex, fey, 0);
|
||||
G3_Color( color );
|
||||
G3_Vtx(fsx, fsy, 1);
|
||||
}
|
||||
G3_End();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DrawQuad
|
||||
|
||||
Description: 四角ポリゴンを描画
|
||||
|
||||
Arguments: sx - 描画する線の開始点のx座標
|
||||
sy - 描画する線の開始点のy座標
|
||||
ex - 描画する線の終点のx座標
|
||||
ey - 描画する線の終点のy座標
|
||||
color - 描画する線の色
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
DrawQuad(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color)
|
||||
{
|
||||
fx16 fsx = (fx16)(((sx - 128) * 0x1000) / 128);
|
||||
fx16 fsy = (fx16)(((96 - sy) * 0x1000) / 96);
|
||||
fx16 fex = (fx16)(((ex - 128) * 0x1000) / 128);
|
||||
fx16 fey = (fx16)(((96 - ey) * 0x1000) / 96);
|
||||
|
||||
G3_Begin(GX_BEGIN_QUADS);
|
||||
{
|
||||
G3_Color( color );
|
||||
G3_Vtx(fsx, fsy, 0);
|
||||
|
||||
G3_Color( color );
|
||||
G3_Vtx(fex, fsy, 0);
|
||||
|
||||
G3_Color( color );
|
||||
G3_Vtx(fex, fey, 0);
|
||||
|
||||
G3_Color( color );
|
||||
G3_Vtx(fsx, fey, 0);
|
||||
}
|
||||
G3_End();
|
||||
}
|
||||
|
||||
147
build/tests/CustomSystemUpdater/ARM9.TWL/src/hw_info.c
Normal file
147
build/tests/CustomSystemUpdater/ARM9.TWL/src/hw_info.c
Normal file
@ -0,0 +1,147 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - SystemUpdater
|
||||
File: hw_info.c
|
||||
|
||||
Copyright 2008 Nintendo. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Date:: $
|
||||
$Rev$
|
||||
$Author$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <twl.h>
|
||||
#include <nitro/snd.h>
|
||||
#include <twl/fatfs.h>
|
||||
#include <twl/lcfg.h>
|
||||
#include <nitro/card.h>
|
||||
#include <sysmenu/namut.h>
|
||||
#include "kami_font.h"
|
||||
#include "kami_pxi.h"
|
||||
#include "hwi.h"
|
||||
#include "hw_info.h"
|
||||
//
|
||||
#include "TWLHWInfo_api.h"
|
||||
#include "TWLSettings_api.h"
|
||||
//
|
||||
/*---------------------------------------------------------------------------*
|
||||
型定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
定数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
内部変数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
内部関数宣言
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
BOOL WriteHWNormalInfoFile( void );
|
||||
BOOL WriteHWSecureInfoFile( u8 region );
|
||||
BOOL DeleteHWInfoFile( void );
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: HW情報全体のライト
|
||||
|
||||
Description:
|
||||
|
||||
Arguments: region :
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
BOOL WriteHWInfoFile( u8 region, BOOL wirelessForceOff )
|
||||
{
|
||||
static const char *pMsgSecureWriting = "Writing Secure File...";
|
||||
static const char *pMsgNormalWriting = "Writing Normal File...";
|
||||
static const char *pMsgSignWriting = "Writing Sign File...";
|
||||
static const char *pMsgSucceeded = "Success!\n";
|
||||
static const char *pMsgFailed = "Failed!\n";
|
||||
u32 installedSoftBoxCount = 0;
|
||||
BOOL result = TRUE;
|
||||
|
||||
// セキュアファイルのライト
|
||||
if( HWI_WriteHWSecureInfoFile( region, NULL, wirelessForceOff ) ) { // とりあえず無線は有効で。
|
||||
// kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded );
|
||||
}else {
|
||||
kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed );
|
||||
result = FALSE;
|
||||
}
|
||||
|
||||
// ノーマルファイルのライト(移行可能なユニークIDのためにセキュアファイルの後で書き込む)
|
||||
if( HWI_WriteHWNormalInfoFile() ) {
|
||||
// kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded );
|
||||
}else {
|
||||
kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed );
|
||||
result = FALSE;
|
||||
}
|
||||
|
||||
// HWID署名ファイルのライト
|
||||
if( HWI_WriteHWIDSignFile() ) {
|
||||
// kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded );
|
||||
}else {
|
||||
kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed );
|
||||
result = FALSE;
|
||||
}
|
||||
|
||||
// CFGデータの修正
|
||||
if (!HWI_ModifyLanguage( region ))
|
||||
{
|
||||
kamiFontPrintfConsoleEx(CONSOLE_RED, "Fail! Write TWLSettings\n" );
|
||||
result = FALSE;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: HWInfoファイルの削除
|
||||
|
||||
Description:
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
BOOL DeleteHWInfoFile( void )
|
||||
{
|
||||
static const char *pMsgNormalDeleting = "Deleting Normal File...";
|
||||
static const char *pMsgSecureDeleting = "Deteting Secure File...";
|
||||
static const char *pMsgSucceeded = "Success!\n";
|
||||
static const char *pMsgFailed = "Failed!\n";
|
||||
BOOL result = TRUE;
|
||||
|
||||
// ノーマルファイル
|
||||
kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgNormalDeleting );
|
||||
if( HWI_DeleteHWNormalInfoFile() ) {
|
||||
OS_TPrintf( "%s delete succeeded.\n", (char *)LCFG_TWL_HWINFO_NORMAL_PATH );
|
||||
kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded );
|
||||
}else {
|
||||
OS_TPrintf( "%s delete failed.\n", (char *)LCFG_TWL_HWINFO_NORMAL_PATH );
|
||||
kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed );
|
||||
result = FALSE;
|
||||
}
|
||||
|
||||
// セキュアファイル
|
||||
kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSecureDeleting );
|
||||
if( HWI_DeleteHWSecureInfoFile() ) {
|
||||
OS_TPrintf( "%s delete succeeded.\n", (char *)LCFG_TWL_HWINFO_SECURE_PATH );
|
||||
kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded );
|
||||
}else {
|
||||
OS_TPrintf( "%s delete failed.\n", (char *)LCFG_TWL_HWINFO_SECURE_PATH );
|
||||
kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed );
|
||||
result = FALSE;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
194
build/tests/CustomSystemUpdater/ARM9.TWL/src/import.c
Normal file
194
build/tests/CustomSystemUpdater/ARM9.TWL/src/import.c
Normal file
@ -0,0 +1,194 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: SystemUpdater
|
||||
File: process_import.c
|
||||
|
||||
Copyright 2008 Nintendo. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Date:: $
|
||||
$Rev$
|
||||
$Author$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <twl.h>
|
||||
#include <nitro/snd.h>
|
||||
#include <twl/fatfs.h>
|
||||
#include <nitro/card.h>
|
||||
#include <twl/nam.h>
|
||||
#include <twl/lcfg.h>
|
||||
#include <sysmenu/namut.h>
|
||||
#include "kami_font.h"
|
||||
#include "import.h"
|
||||
#include "hw_info.h"
|
||||
#include "TWLHWInfo_api.h"
|
||||
#include "graphics.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
型定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
定数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#define THREAD_STACK_SIZE (16*1024)
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
内部変数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
static u32 sCurrentProgress;
|
||||
static vu8 sNowImport = FALSE;
|
||||
static vu8 sProgress = FALSE;
|
||||
static u8 sStack[THREAD_STACK_SIZE];
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
内部関数宣言
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
static void ProgressThread(void* arg);
|
||||
static void Destructor(void* arg);
|
||||
void ProgressDraw(f32 ratio);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
処理関数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: kamiImportTad
|
||||
|
||||
Description: .tad ファイルインポート
|
||||
|
||||
Arguments: no
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
s32 kamiImportTad(int no, int total, const char* path)
|
||||
{
|
||||
NAMTadInfo tadInfo;
|
||||
OSThread thread;
|
||||
s32 nam_result;
|
||||
|
||||
kamiFontPrintfMain( 4, 9, 8, "Now Updating... %d / %d", no, total );
|
||||
kamiFontLoadScreenData();
|
||||
|
||||
// tadファイルの情報取得
|
||||
nam_result = NAM_ReadTadInfo(&tadInfo, path);
|
||||
if ( nam_result != NAM_OK )
|
||||
{
|
||||
return nam_result;
|
||||
}
|
||||
|
||||
// ESの仕様で古い e-ticket があると新しい e-ticket を使ったインポートができない
|
||||
// 暫定対応として該当タイトルを完全削除してからインポートする
|
||||
nam_result = NAM_DeleteTitleCompletely(tadInfo.titleInfo.titleId);
|
||||
if ( nam_result != NAM_OK )
|
||||
{
|
||||
kamiFontPrintfConsole(CONSOLE_RED, "Fail! RetCode=%x\n", nam_result);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// インポート開始フラグを立てる
|
||||
sNowImport = TRUE;
|
||||
|
||||
// 進捗スレッド作成
|
||||
MI_CpuClear8(sStack, THREAD_STACK_SIZE);
|
||||
OS_CreateThread(&thread, ProgressThread, NULL,
|
||||
(void*)((u32)sStack + THREAD_STACK_SIZE), THREAD_STACK_SIZE, OS_GetCurrentThread()->priority - 1);
|
||||
OS_WakeupThreadDirect(&thread);
|
||||
|
||||
// Import開始
|
||||
nam_result = NAM_ImportTad( path );
|
||||
|
||||
// インポート開始フラグを下げる
|
||||
sNowImport = FALSE;
|
||||
|
||||
// 進捗スレッドの自力終了を待つ
|
||||
while (sProgress){};
|
||||
|
||||
// InstalledSoftBoxCount, FreeSoftBoxCount の値を現在のNANDの状態に合わせて更新します。
|
||||
(void)NAMUT_UpdateSoftBoxCount();
|
||||
|
||||
return nam_result;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: ProgressThread
|
||||
|
||||
Description: .tad ファイルインポートの進捗を表示するスレッド。
|
||||
進捗が100%に達すると処理を抜ける。
|
||||
|
||||
Arguments: arg - 使用しない。
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
static void ProgressThread(void* /*arg*/)
|
||||
{
|
||||
u32 currentSize;
|
||||
u32 totalSize = 0;
|
||||
u32 totalSizeBk = 0;
|
||||
|
||||
sProgress = TRUE;
|
||||
|
||||
while (sNowImport)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
sProgress = FALSE;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: ProgressDraw
|
||||
|
||||
Description: インポートの進捗を表示します
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
void ProgressDraw(f32 ratio)
|
||||
{
|
||||
s16 x = (s16)(30 + (226 - 30)*ratio);
|
||||
|
||||
// 3D初期化
|
||||
G3X_Reset();
|
||||
G3_Identity();
|
||||
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
|
||||
|
||||
// グリーンバー
|
||||
DrawQuad( 30, 90, x, 95, GX_RGB(12, 25, 12));
|
||||
|
||||
// グレーバー
|
||||
DrawQuad( 30, 90, 226, 95, GX_RGB(28, 28, 28));
|
||||
|
||||
// グレーダイアログ
|
||||
DrawQuad( 20, 60, 236, 110, GX_RGB(25, 25, 25));
|
||||
|
||||
// 3Dスワップ
|
||||
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
|
||||
}
|
||||
105
build/tests/CustomSystemUpdater/ARM9.TWL/src/kami_copy_file.c
Normal file
105
build/tests/CustomSystemUpdater/ARM9.TWL/src/kami_copy_file.c
Normal file
@ -0,0 +1,105 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - NandInitializer
|
||||
File: kami_copy_file.c
|
||||
|
||||
Copyright 2008 Nintendo. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Date:: $
|
||||
$Rev$
|
||||
$Author$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <twl.h>
|
||||
#include <nitro/snd.h>
|
||||
#include <twl/fatfs.h>
|
||||
#include <nitro/card.h>
|
||||
#include "kami_font.h"
|
||||
#include "kami_copy_file.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
マクロ
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#define ROUND_UP(value, alignment) \
|
||||
(((u32)(value) + (alignment-1)) & ~(alignment-1))
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
処理関数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
BOOL kamiCopyFile(char* srcPath, char* dstPath)
|
||||
{
|
||||
FSFile file;
|
||||
BOOL open_is_ok;
|
||||
BOOL read_is_ok;
|
||||
void* pTempBuf;
|
||||
u32 file_size;
|
||||
u32 alloc_size;
|
||||
BOOL result = TRUE;
|
||||
|
||||
// ROMファイルオープン
|
||||
FS_InitFile(&file);
|
||||
open_is_ok = FS_OpenFile(&file, srcPath);
|
||||
if (!open_is_ok)
|
||||
{
|
||||
OS_Printf("FS_OpenFile(\"%s\") ... ERROR!\n", srcPath);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// ROMファイルリード
|
||||
file_size = FS_GetFileLength(&file) ;
|
||||
alloc_size = ROUND_UP(file_size, 32) ;
|
||||
pTempBuf = OS_Alloc( alloc_size );
|
||||
SDK_NULL_ASSERT(pTempBuf);
|
||||
DC_InvalidateRange(pTempBuf, alloc_size);
|
||||
read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size );
|
||||
if (!read_is_ok)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_ReadFile(\"%s\") ... ERROR!\n", srcPath);
|
||||
FS_CloseFile(&file);
|
||||
OS_Free(pTempBuf);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// ROMファイルクローズ
|
||||
FS_CloseFile(&file);
|
||||
|
||||
// 一旦対象データを削除する
|
||||
(void)FS_DeleteFile(dstPath);
|
||||
|
||||
// ターゲットファイル作成
|
||||
if (!FS_CreateFile(dstPath, FS_PERMIT_R | FS_PERMIT_W))
|
||||
{
|
||||
kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_CreateFile(%s) failed.\n", dstPath);
|
||||
result = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ターゲットファイルオープン
|
||||
FS_InitFile(&file);
|
||||
open_is_ok = FS_OpenFileEx(&file, dstPath, FS_FILEMODE_W);
|
||||
if (!open_is_ok)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_OpenFile(%s) failed.\n", dstPath);
|
||||
result = FALSE;
|
||||
}
|
||||
// nand:sys/TWLFontTable.dat書き込み
|
||||
else if (FS_WriteFile(&file, pTempBuf, (s32)file_size) == -1)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_WritFile() failed.\n");
|
||||
result = FALSE;
|
||||
}
|
||||
(void)FS_CloseFile(&file);
|
||||
}
|
||||
|
||||
OS_Free(pTempBuf);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
407
build/tests/CustomSystemUpdater/ARM9.TWL/src/kami_font.c
Normal file
407
build/tests/CustomSystemUpdater/ARM9.TWL/src/kami_font.c
Normal file
@ -0,0 +1,407 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - NandInitializer
|
||||
File: kami_font.c
|
||||
|
||||
Copyright 2008 Nintendo. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Date:: $
|
||||
$Rev$
|
||||
$Author$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <twl.h>
|
||||
#include "kami_font.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
型定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
定数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#define SCREEN_DATA_COLOR_PLTT_SHIFT 12
|
||||
#define NUM_OF_PRINT_TARGET 2
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
内部変数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
static u8 sXPos;
|
||||
static u8 sYPos;
|
||||
|
||||
static u32 sBackColorCharData[24*8];
|
||||
|
||||
static u16 sFontScreenDataMain[32 * 24] = {
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
};
|
||||
|
||||
static u16 sFontScreenDataSub[24*32] = {
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
};
|
||||
|
||||
static u16 sBackColorScreenData[32 * 24] = {
|
||||
0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,
|
||||
0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,
|
||||
0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,
|
||||
0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,
|
||||
0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,
|
||||
0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,
|
||||
0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,
|
||||
0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,
|
||||
0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,
|
||||
0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,
|
||||
0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,
|
||||
0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,
|
||||
0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,
|
||||
0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,
|
||||
0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,
|
||||
0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,
|
||||
0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,
|
||||
0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,
|
||||
0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,
|
||||
0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,
|
||||
0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,
|
||||
0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,
|
||||
0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,
|
||||
0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
内部関数宣言
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
static void kamiFontReturnConsole( void );
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
関数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name:
|
||||
|
||||
Description:
|
||||
|
||||
Arguments: None
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
kamiFontInit(void)
|
||||
{
|
||||
// 背景用キャラクタデータ
|
||||
MI_CpuCopy32( &sampleCharData[8 * 0xde], sBackColorCharData, sizeof(sBackColorCharData) );
|
||||
|
||||
// 背景用スクリーンデータセット
|
||||
DC_FlushRange ( sBackColorScreenData, sizeof(sBackColorScreenData) );
|
||||
GXS_LoadBG1Scr ( sBackColorScreenData, 0, sizeof(sBackColorScreenData) );
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name:
|
||||
|
||||
Description:
|
||||
|
||||
Arguments: None
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
kamiFontLoadScreenData(void)
|
||||
{
|
||||
DC_FlushRange ( sFontScreenDataMain, sizeof(sFontScreenDataMain) );
|
||||
GX_LoadBG0Scr ( sFontScreenDataMain, 0, sizeof(sFontScreenDataMain) );
|
||||
|
||||
DC_FlushRange ( sFontScreenDataSub, sizeof(sFontScreenDataSub) );
|
||||
GXS_LoadBG0Scr ( sFontScreenDataSub, 0, sizeof(sFontScreenDataSub) );
|
||||
|
||||
// 背景キャラクタデータ書き換え
|
||||
DC_FlushRange( sBackColorCharData, sizeof(sBackColorCharData) );
|
||||
GXS_LoadBG0Char( sBackColorCharData, 0xde*32, sizeof(sBackColorCharData) );
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: kamiFontClear
|
||||
|
||||
Description: 仮想スクリーンをクリアする
|
||||
|
||||
Arguments: None
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
kamiFontClear(void)
|
||||
{
|
||||
MI_CpuClear8( sFontScreenDataSub, sizeof(sFontScreenDataSub) );
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: kamiFontClearMain
|
||||
|
||||
Description: 仮想スクリーンをクリアする
|
||||
|
||||
Arguments: None
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
kamiFontClearMain(void)
|
||||
{
|
||||
MI_CpuClear8( sFontScreenDataMain, sizeof(sFontScreenDataMain) );
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: kamiFontPrintf
|
||||
|
||||
Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。
|
||||
|
||||
Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。
|
||||
y - 文字列の先頭を配置する y 座標( × 8 ドット )。
|
||||
color - 文字の色をパレット番号で指定。
|
||||
text - 配置する文字列。終端文字はNULL。
|
||||
... - 仮想引数。
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...)
|
||||
{
|
||||
va_list vlist;
|
||||
char temp[32 + 2];
|
||||
s32 i;
|
||||
|
||||
va_start(vlist, text);
|
||||
(void)vsnprintf(temp, 33, text, vlist);
|
||||
va_end(vlist);
|
||||
|
||||
*(u16 *)(&temp[32]) = 0x0000;
|
||||
for (i = 0;temp[i] != 0x00; i++)
|
||||
{
|
||||
sFontScreenDataSub[((y * 32) + x + i) % (24 * 32)] =
|
||||
(u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: kamiFontPrintf
|
||||
|
||||
Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。
|
||||
|
||||
Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。
|
||||
y - 文字列の先頭を配置する y 座標( × 8 ドット )。
|
||||
color - 文字の色をパレット番号で指定。
|
||||
text - 配置する文字列。終端文字はNULL。
|
||||
... - 仮想引数。
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...)
|
||||
{
|
||||
va_list vlist;
|
||||
char temp[32 + 2];
|
||||
s32 i;
|
||||
|
||||
va_start(vlist, text);
|
||||
(void)vsnprintf(temp, 33, text, vlist);
|
||||
va_end(vlist);
|
||||
|
||||
*(u16 *)(&temp[32]) = 0x0000;
|
||||
for (i = 0;temp[i] != 0x00; i++)
|
||||
{
|
||||
sFontScreenDataMain[((y * 32) + x + i) % (24 * 32)] =
|
||||
(u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: kamiFontFillChar
|
||||
|
||||
Description: 仮想スクリーンに
|
||||
|
||||
Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。
|
||||
y - 文字列の先頭を配置する y 座標( × 8 ドット )。
|
||||
color - 文字の色をパレット番号で指定。
|
||||
value
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
kamiFontFillChar(int lineNo, u8 color1, u8 color2)
|
||||
{
|
||||
s32 i;
|
||||
u32 line;
|
||||
int charNo = 0xde + lineNo;
|
||||
|
||||
if (color1 < 0x10)
|
||||
{
|
||||
line = (u32)(0x11111111 * color1);
|
||||
|
||||
for (i = 0;i<4; i++)
|
||||
{
|
||||
sBackColorCharData[8 * lineNo + i] = line;
|
||||
}
|
||||
}
|
||||
|
||||
if (color2 < 0x10)
|
||||
{
|
||||
line = (u32)(0x11111111 * color2);
|
||||
|
||||
for (i = 4;i<8; i++)
|
||||
{
|
||||
sBackColorCharData[8 * lineNo + i] = line;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: kamiFontPrintfConsole
|
||||
|
||||
Description: 仮想コンソールに文字列を配置する。文字列は256文字まで。
|
||||
|
||||
Arguments: color - 文字の色をパレット番号で指定。
|
||||
text - 配置する文字列。終端文字はNULL。
|
||||
... - 仮想引数。
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
kamiFontPrintfConsole(u8 color, const char *text, ...)
|
||||
{
|
||||
va_list vlist;
|
||||
char temp[256 + 2];
|
||||
s32 i;
|
||||
|
||||
va_start(vlist, text);
|
||||
(void)vsnprintf(temp, 256, text, vlist);
|
||||
va_end(vlist);
|
||||
|
||||
// 終端追加
|
||||
*(u16 *)(&temp[256]) = 0x0000;
|
||||
|
||||
for(i=0; temp[i] != 0x00; i++)
|
||||
{
|
||||
if (temp[i] == 0x0A)
|
||||
{
|
||||
// 改行コード
|
||||
kamiFontReturnConsole();
|
||||
}
|
||||
else
|
||||
{
|
||||
// 一文字ずつ書き込み
|
||||
sFontScreenDataMain[((sYPos * 32) + sXPos) % (24 * 32)] =
|
||||
(u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]);
|
||||
|
||||
// X座標が右端に到達した場合は改行処理
|
||||
if (++sXPos >= 32)
|
||||
{
|
||||
kamiFontReturnConsole();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: kamiFontPrintfConsoleEx
|
||||
|
||||
Description: 仮想コンソールに文字列を配置する。文字列は256文字まで。
|
||||
OS_Printfもついでに実行する。
|
||||
|
||||
Arguments: color - 文字の色をパレット番号で指定。
|
||||
text - 配置する文字列。終端文字はNULL。
|
||||
... - 仮想引数。
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
kamiFontPrintfConsoleEx(u8 color, const char *text, ...)
|
||||
{
|
||||
va_list vlist;
|
||||
char temp[256 + 2];
|
||||
|
||||
va_start(vlist, text);
|
||||
(void)vsnprintf(temp, 256, text, vlist);
|
||||
va_end(vlist);
|
||||
|
||||
kamiFontPrintfConsole(color, temp);
|
||||
OS_TPrintf(temp);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: kamiFontReturnConsole
|
||||
|
||||
Description: 仮想コンソールにおける改行処理を行う
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
kamiFontReturnConsole( void )
|
||||
{
|
||||
sXPos = 0;
|
||||
if (sYPos < 23)
|
||||
{
|
||||
// 次の行へ
|
||||
sYPos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 既に最終行に到達している場合シフトを行う
|
||||
MI_CpuCopy32( &sFontScreenDataMain[32], sFontScreenDataMain, sizeof(u16)*32*23 );
|
||||
MI_CpuClear32( &sFontScreenDataMain[32*23], sizeof(u16)*32);
|
||||
}
|
||||
}
|
||||
|
||||
370
build/tests/CustomSystemUpdater/ARM9.TWL/src/kami_pxi.c
Normal file
370
build/tests/CustomSystemUpdater/ARM9.TWL/src/kami_pxi.c
Normal file
@ -0,0 +1,370 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - NandInitializer
|
||||
File: kami_pxi.c
|
||||
|
||||
Copyright 2008 Nintendo. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Date:: $
|
||||
$Rev$
|
||||
$Author$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <twl.h>
|
||||
#include "kami_pxi.h"
|
||||
#include "fifo.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
定数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
// 詰めてコピーする
|
||||
#define KAMI_PACK_U16(d, s) \
|
||||
((d)[0] = (u8)((*((u16*)s) >> 0) & 0xFF), \
|
||||
(d)[1] = (u8)((*((u16*)s) >> 8) & 0xFF))
|
||||
|
||||
#define KAMI_PACK_U32(d, s) \
|
||||
((d)[0] = (u8)((*((u32*)s) >> 0) & 0xFF), \
|
||||
(d)[1] = (u8)((*((u32*)s) >> 8) & 0xFF), \
|
||||
(d)[2] = (u8)((*((u32*)s) >> 16) & 0xFF), \
|
||||
(d)[3] = (u8)((*((u32*)s) >> 24) & 0xFF))
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
型定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
typedef struct KamiWork
|
||||
{
|
||||
BOOL lock;
|
||||
|
||||
KamiCommand command;
|
||||
KAMIPxiResult result;
|
||||
KAMICallback callback;
|
||||
void* arg;
|
||||
|
||||
u32 total;
|
||||
u32 current;
|
||||
u8* data;
|
||||
}
|
||||
KamiWork;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
静的変数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
static BOOL kamiInitialized;
|
||||
static KamiWork kamiWork;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
内部関数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
static BOOL KamiSendPxiCommand(KamiCommand command, u8 size, u8 data);
|
||||
static void KamiSendPxiData(u8 *pData);
|
||||
static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err);
|
||||
static void KamiDone(KAMIResult result);
|
||||
static void KamiWaitBusy(void);
|
||||
|
||||
|
||||
void KamiPxiInit( void )
|
||||
{
|
||||
kamiWork.lock = FALSE;
|
||||
|
||||
PXI_Init();
|
||||
while ( !PXI_IsCallbackReady(PXI_FIFO_TAG_KAMITEST, PXI_PROC_ARM7 ))
|
||||
{
|
||||
}
|
||||
PXI_SetFifoRecvCallback(PXI_FIFO_TAG_KAMITEST, KamiPxiCallback);
|
||||
if ( 0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, KAMITEST_PXI_START_BIT | (KAMI_TEST_COMMAND << KAMITEST_PXI_COMMAND_SHIFT), 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: フォーマット実行関数
|
||||
|
||||
Description:
|
||||
|
||||
Arguments: FormatMode
|
||||
|
||||
Returns:
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
KAMIResult ExeFormatAsync(FormatMode format_mode, KAMICallback callback)
|
||||
{
|
||||
OSIntrMode enabled;
|
||||
|
||||
// ロック
|
||||
enabled = OS_DisableInterrupts();
|
||||
if (kamiWork.lock)
|
||||
{
|
||||
(void)OS_RestoreInterrupts(enabled);
|
||||
return KAMI_RESULT_BUSY;
|
||||
}
|
||||
kamiWork.lock = TRUE;
|
||||
(void)OS_RestoreInterrupts(enabled);
|
||||
|
||||
kamiWork.callback = callback;
|
||||
kamiWork.arg = 0;
|
||||
kamiWork.data = 0;
|
||||
|
||||
if (KamiSendPxiCommand(KAMI_EXE_FORMAT, 1, format_mode) == FALSE)
|
||||
{
|
||||
return KAMI_RESULT_SEND_ERROR;
|
||||
}
|
||||
return KAMI_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: NANDアクセス関数
|
||||
|
||||
Description:
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns:
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
KAMIResult kamiNandIo(u32 block, void* buffer, u32 count, BOOL is_read)
|
||||
{
|
||||
OSIntrMode enabled;
|
||||
u8 data[12];
|
||||
int i;
|
||||
|
||||
// ロック
|
||||
enabled = OS_DisableInterrupts();
|
||||
if (kamiWork.lock)
|
||||
{
|
||||
(void)OS_RestoreInterrupts(enabled);
|
||||
return KAMI_RESULT_BUSY;
|
||||
}
|
||||
kamiWork.lock = TRUE;
|
||||
(void)OS_RestoreInterrupts(enabled);
|
||||
|
||||
kamiWork.callback = NULL;
|
||||
kamiWork.arg = 0;
|
||||
kamiWork.data = 0;
|
||||
|
||||
// データ作成
|
||||
KAMI_PACK_U32(&data[0], &block);
|
||||
KAMI_PACK_U32(&data[4], &buffer);
|
||||
KAMI_PACK_U32(&data[8], &count);
|
||||
|
||||
if (KamiSendPxiCommand(KAMI_NAND_IO, 12, (u8)is_read))
|
||||
{
|
||||
for (i = 0; i < 12; i+=3)
|
||||
{
|
||||
KamiSendPxiData(&data[i]);
|
||||
}
|
||||
KamiWaitBusy();
|
||||
return (KAMIResult)kamiWork.result;
|
||||
}
|
||||
return KAMI_RESULT_SEND_ERROR;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: kamiClearNandErrorLog
|
||||
|
||||
Description: NVRAMのNANDエラー情報をクリアします。
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns:
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
KAMIResult kamiClearNandErrorLog( void )
|
||||
{
|
||||
OSIntrMode enabled;
|
||||
|
||||
// ロック
|
||||
enabled = OS_DisableInterrupts();
|
||||
if (kamiWork.lock)
|
||||
{
|
||||
(void)OS_RestoreInterrupts(enabled);
|
||||
return KAMI_RESULT_BUSY;
|
||||
}
|
||||
kamiWork.lock = TRUE;
|
||||
(void)OS_RestoreInterrupts(enabled);
|
||||
|
||||
kamiWork.callback = NULL;
|
||||
kamiWork.arg = 0;
|
||||
kamiWork.data = 0;
|
||||
|
||||
if (KamiSendPxiCommand(KAMI_CLEAR_NAND_ERRORLOG, 0, (u8)0))
|
||||
{
|
||||
KamiWaitBusy();
|
||||
return (KAMIResult)kamiWork.result;
|
||||
}
|
||||
return KAMI_RESULT_SEND_ERROR;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: kamiGetIsToolType
|
||||
|
||||
Description: IS-TWL-DEBUGGER or CAPTURE を取得します(同期版)
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns:
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
KAMIResult kamiGetIsToolType( IsToolType *pType )
|
||||
{
|
||||
OSIntrMode enabled;
|
||||
|
||||
if (pType == NULL)
|
||||
{
|
||||
return KAMI_RESULT_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
enabled = OS_DisableInterrupts();
|
||||
if (kamiWork.lock)
|
||||
{
|
||||
(void)OS_RestoreInterrupts(enabled);
|
||||
return KAMI_RESULT_BUSY;
|
||||
}
|
||||
kamiWork.lock = TRUE;
|
||||
kamiWork.callback = NULL;
|
||||
kamiWork.arg = 0;
|
||||
kamiWork.data = (u8*)pType;
|
||||
(void)OS_RestoreInterrupts(enabled);
|
||||
|
||||
if (KamiSendPxiCommand(KAMI_GET_IS_TOOL_TYPE, 0, 0))
|
||||
{
|
||||
KamiWaitBusy();
|
||||
return (KAMIResult)kamiWork.result;
|
||||
}
|
||||
return KAMI_RESULT_SEND_ERROR;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
PXI関連
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
static BOOL KamiSendPxiCommand(KamiCommand command, u8 size, u8 data)
|
||||
{
|
||||
u32 pxiData = (u32)(KAMITEST_PXI_START_BIT |
|
||||
((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) |
|
||||
((size << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) |
|
||||
((data << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK));
|
||||
if (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void KamiSendPxiData(u8 *pData)
|
||||
{
|
||||
u32 pxiData = (u32)((pData[0] << 16) | (pData[1] << 8) | pData[2]);
|
||||
while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err)
|
||||
{
|
||||
#pragma unused( tag )
|
||||
if (err)
|
||||
{
|
||||
KamiDone(KAMI_RESULT_FATAL_ERROR);
|
||||
return;
|
||||
}
|
||||
if (data & KAMITEST_PXI_START_BIT) // 先頭データ
|
||||
{
|
||||
if (data & KAMITEST_PXI_RESULT_BIT)
|
||||
{
|
||||
kamiWork.total = (u8)((data & KAMITEST_PXI_DATA_NUMS_MASK) >> KAMITEST_PXI_DATA_NUMS_SHIFT);
|
||||
kamiWork.current = 0;
|
||||
kamiWork.command = (KamiCommand)((data & KAMITEST_PXI_COMMAND_MASK) >> KAMITEST_PXI_COMMAND_SHIFT);
|
||||
kamiWork.result = (KAMIPxiResult)((data & KAMITEST_PXI_1ST_DATA_MASK) >> KAMITEST_PXI_1ST_DATA_SHIFT);
|
||||
}
|
||||
else // 未知のデータ
|
||||
{
|
||||
KamiDone(KAMI_RESULT_FATAL_ERROR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else // 後続データ
|
||||
{
|
||||
if (kamiWork.data == NULL)
|
||||
{
|
||||
KamiDone(KAMI_RESULT_FATAL_ERROR);
|
||||
return;
|
||||
}
|
||||
if (kamiWork.current < kamiWork.total-1)
|
||||
{
|
||||
kamiWork.data[kamiWork.current++] = (u8)((data & 0xFF0000) >> 16);
|
||||
}
|
||||
if (kamiWork.current < kamiWork.total-1)
|
||||
{
|
||||
kamiWork.data[kamiWork.current++] = (u8)((data & 0x00FF00) >> 8);
|
||||
}
|
||||
if (kamiWork.current < kamiWork.total-1)
|
||||
{
|
||||
kamiWork.data[kamiWork.current++] = (u8)((data & 0x0000FF) >> 0);
|
||||
}
|
||||
}
|
||||
if (kamiWork.current == kamiWork.total-1)
|
||||
{
|
||||
KAMIResult result;
|
||||
switch (kamiWork.result)
|
||||
{
|
||||
case KAMI_PXI_RESULT_SUCCESS: // alias KAMI_PXI_RESULT_SUCCESS_TRUE
|
||||
result = KAMI_RESULT_SUCCESS; // alias KAMI_RESULT_SUCCESS_TRUE
|
||||
break;
|
||||
case KAMI_PXI_RESULT_SUCCESS_FALSE:
|
||||
result = KAMI_RESULT_SUCCESS_FALSE;
|
||||
break;
|
||||
case KAMI_PXI_RESULT_INVALID_COMMAND:
|
||||
result = KAMI_RESULT_INVALID_COMMAND;
|
||||
break;
|
||||
case KAMI_PXI_RESULT_INVALID_PARAMETER:
|
||||
result = KAMI_RESULT_INVALID_PARAMETER;
|
||||
break;
|
||||
case KAMI_PXI_RESULT_ILLEGAL_STATUS:
|
||||
result = KAMI_RESULT_ILLEGAL_STATUS;
|
||||
break;
|
||||
case KAMI_PXI_RESULT_BUSY:
|
||||
result = KAMI_RESULT_BUSY;
|
||||
break;
|
||||
default:
|
||||
result = KAMI_RESULT_FATAL_ERROR;
|
||||
}
|
||||
KamiDone(result);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
extern void PXIi_HandlerRecvFifoNotEmpty(void);
|
||||
static void KamiWaitBusy(void)
|
||||
{
|
||||
volatile BOOL *p = &kamiWork.lock;
|
||||
|
||||
while (*p)
|
||||
{
|
||||
if (OS_GetCpsrIrq() == OS_INTRMODE_IRQ_DISABLE)
|
||||
{
|
||||
PXIi_HandlerRecvFifoNotEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void KamiDone(KAMIResult result)
|
||||
{
|
||||
KAMICallback callback = kamiWork.callback;
|
||||
void* arg = kamiWork.arg;
|
||||
kamiWork.callback = NULL;
|
||||
kamiWork.arg = NULL;
|
||||
if (kamiWork.lock)
|
||||
{
|
||||
kamiWork.lock = FALSE;
|
||||
}
|
||||
if (callback)
|
||||
{
|
||||
callback(result, arg);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,302 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - NandInitializer
|
||||
File: kami_write_nandfirm.c
|
||||
|
||||
Copyright 2008 Nintendo. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Date:: $
|
||||
$Rev$
|
||||
$Author$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <twl.h>
|
||||
#include <twl/fatfs.h>
|
||||
#include <nitro/card.h>
|
||||
#include <twl/nam.h>
|
||||
#include <nitro/nvram.h>
|
||||
|
||||
#include "kami_font.h"
|
||||
#include "kami_pxi.h"
|
||||
|
||||
#include <firm/format/firm_common.h>
|
||||
#include "kami_write_nandfirm.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
マクロ定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
// NANDファーム書き込みの際にNVRAMの未割り当て領域+予約領域を0クリアする場合は定義します(開発用)
|
||||
//#define CLEAR_NON_ASIGNED_AREA_AND_RESERVED_AREA_ALL
|
||||
|
||||
#define ROUND_UP(value, alignment) \
|
||||
(((u32)(value) + (alignment-1)) & ~(alignment-1))
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
定数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#define NAND_BLOCK_BYTE 0x200
|
||||
#define NAND_FIRM_START_OFFSET 0x200
|
||||
|
||||
#define NVRAM_PAGE_SIZE 0x100
|
||||
#define NVRAM_NORFIRM_RESERVED_ADDRESS 0x200
|
||||
#define NVRAM_NORFIRM_NANDBOOT_FLAG_OFFSET 0xff
|
||||
#define NVRAM_NORFIRM_NANDBOOT_FLAG 0x80
|
||||
|
||||
#define NVRAM_NON_ASIGNED_AREA_ADDRESS 0x300
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
内部変数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
static u8 sNvramPageSizeBuffer[NVRAM_PAGE_SIZE] ATTRIBUTE_ALIGN(32); // ARM7からアクセスするためスタックでは駄目
|
||||
static u32 sReservedAreaEndAddress;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: kamiWriteNandfirm
|
||||
|
||||
Description:
|
||||
|
||||
Arguments: no
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL kamiWriteNandfirm(const char* pFullPath, NAMAlloc allocFunc, NAMFree freeFunc)
|
||||
{
|
||||
FSFile file;
|
||||
|
||||
BOOL open_is_ok;
|
||||
BOOL read_is_ok;
|
||||
u8* pTempBuf;
|
||||
u32 file_size;
|
||||
u32 alloc_size;
|
||||
u32 write_size;
|
||||
BOOL result = TRUE;
|
||||
u16 crc_w1, crc_w2;
|
||||
u16 crc_r1, crc_r2;
|
||||
u16 crc_norfirm_reserved_area_w, crc_norfirm_reserved_area_r;
|
||||
#ifdef CLEAR_NON_ASIGNED_AREA_AND_RESERVED_AREA_ALL
|
||||
u32 write_offset;
|
||||
#endif
|
||||
|
||||
// .nandファイルオープン
|
||||
FS_InitFile(&file);
|
||||
open_is_ok = FS_OpenFile(&file, pFullPath);
|
||||
if (!open_is_ok)
|
||||
{
|
||||
OS_Warning("Failure! FS_OpenFile");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// サイズチェック
|
||||
file_size = FS_GetFileLength(&file) ;
|
||||
if (file_size > (800*1024))
|
||||
{
|
||||
kamiFontPrintfConsoleEx(1, "too big file size!\n");
|
||||
FS_CloseFile(&file);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// バッファ確保
|
||||
alloc_size = ROUND_UP(file_size, 32) ;
|
||||
pTempBuf = allocFunc( alloc_size );
|
||||
if (pTempBuf == NULL)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(1, "Fail Alloc()!\n");
|
||||
FS_CloseFile(&file);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// .nandファイルリード
|
||||
DC_InvalidateRange(pTempBuf, alloc_size);
|
||||
read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size );
|
||||
DC_StoreRange(pTempBuf, file_size);
|
||||
if (!read_is_ok)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(1, "Fail FS_ReadFile!\n");
|
||||
FS_CloseFile(&file);
|
||||
freeFunc(pTempBuf);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// ファイルクローズ
|
||||
FS_CloseFile(&file);
|
||||
|
||||
// 書き込み前のCRCを計算
|
||||
crc_w1 = SVC_GetCRC16( 0xffff, pTempBuf, sizeof(NORHeaderDS) );
|
||||
crc_w2 = SVC_GetCRC16( 0xffff, pTempBuf+512, file_size-512 );
|
||||
|
||||
// まずNORHeaderDS領域を書き込む(40byte?)
|
||||
if (NVRAMi_Write(0, sizeof(NORHeaderDS), (void*)pTempBuf) != NVRAM_RESULT_SUCCESS)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Write()\n");
|
||||
result = FALSE;
|
||||
}
|
||||
|
||||
// CRCを計算するので念のためにクリアしてからリードする
|
||||
MI_CpuFill8( pTempBuf, 0xee, sizeof(NORHeaderDS) );
|
||||
DC_FlushRange(pTempBuf, sizeof(NORHeaderDS));
|
||||
|
||||
// CRCチェックのためNvramからリード
|
||||
if (NVRAMi_Read(0, sizeof(NORHeaderDS), pTempBuf) != NVRAM_RESULT_SUCCESS)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Read()!\n");
|
||||
}
|
||||
DC_StoreRange(pTempBuf, sizeof(NORHeaderDS));
|
||||
|
||||
// 書き込み後のCRCを計算
|
||||
crc_r1 = SVC_GetCRC16( 0xffff, pTempBuf, sizeof(NORHeaderDS) );
|
||||
|
||||
// NVRAM先頭部分のCRC比較
|
||||
if ( crc_w1 != crc_r1 )
|
||||
{
|
||||
freeFunc(pTempBuf);
|
||||
kamiFontPrintfConsoleEx(1, "Fail! CRC check %x!=%x\n", crc_w1, crc_r1);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// nandfirm 起動フラグを立てる
|
||||
MI_CpuClear8( sNvramPageSizeBuffer, NVRAM_PAGE_SIZE );
|
||||
sNvramPageSizeBuffer[NVRAM_NORFIRM_NANDBOOT_FLAG_OFFSET] = NVRAM_NORFIRM_NANDBOOT_FLAG;
|
||||
DC_FlushRange( sNvramPageSizeBuffer, NVRAM_PAGE_SIZE);
|
||||
|
||||
// NORファームリザーブ領域の書き込みデータのCRCを計算
|
||||
crc_norfirm_reserved_area_w = SVC_GetCRC16( 0xffff, sNvramPageSizeBuffer, NVRAM_PAGE_SIZE );
|
||||
|
||||
if (NVRAMi_Write(NVRAM_NORFIRM_RESERVED_ADDRESS, NVRAM_PAGE_SIZE, sNvramPageSizeBuffer) != NVRAM_RESULT_SUCCESS)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Write()\n");
|
||||
result = FALSE;
|
||||
}
|
||||
|
||||
// CRCを計算するので念のためにクリアしてからリードする
|
||||
MI_CpuFill8( sNvramPageSizeBuffer, 0xee, NVRAM_PAGE_SIZE );
|
||||
|
||||
// 読み込みはARM7が直接メモリに書き出すため
|
||||
DC_FlushRange(sNvramPageSizeBuffer, NVRAM_PAGE_SIZE);
|
||||
|
||||
if (NVRAMi_Read(NVRAM_NORFIRM_RESERVED_ADDRESS, NVRAM_PAGE_SIZE, sNvramPageSizeBuffer) != NVRAM_RESULT_SUCCESS)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Read()\n");
|
||||
result = FALSE;
|
||||
}
|
||||
|
||||
// 書き込み後のCRCを計算
|
||||
DC_StoreRange(sNvramPageSizeBuffer, NVRAM_PAGE_SIZE);
|
||||
crc_norfirm_reserved_area_r = SVC_GetCRC16( 0xffff, sNvramPageSizeBuffer, NVRAM_PAGE_SIZE );
|
||||
|
||||
// NORファームリザーブ領域のCRC比較
|
||||
if ( crc_norfirm_reserved_area_w != crc_norfirm_reserved_area_r )
|
||||
{
|
||||
kamiFontPrintfConsoleEx(1, "Fail! Norfirm Reserved Area CRC check %x!=%x\n", crc_norfirm_reserved_area_w, crc_norfirm_reserved_area_r);
|
||||
result = FALSE;
|
||||
}
|
||||
|
||||
#ifdef CLEAR_NON_ASIGNED_AREA_AND_RESERVED_AREA_ALL
|
||||
DC_InvalidateRange( sNvramPageSizeBuffer, NVRAM_PAGE_SIZE );
|
||||
// 未割り当て領域+予約領域を0クリアします(開発用)
|
||||
if (NVRAMi_Read(NVRAM_CONFIG_DATA_OFFSET_ADDRESS, NVRAM_PAGE_SIZE, &sNvramPageSizeBuffer) != NVRAM_RESULT_SUCCESS)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Read()\n");
|
||||
result = FALSE;
|
||||
}
|
||||
sReservedAreaEndAddress = (u32)(*(u16 *)sNvramPageSizeBuffer << NVRAM_CONFIG_DATA_OFFSET_SHIFT) - 0xA00;// TWL WiFi設定 + NTR WiFi設定 を差し引く
|
||||
//OS_Printf("end = %x\n", sReservedAreaEndAddress);
|
||||
|
||||
MI_CpuFill8( sNvramPageSizeBuffer, 0x00, NVRAM_PAGE_SIZE );
|
||||
DC_FlushRange( sNvramPageSizeBuffer, NVRAM_PAGE_SIZE );
|
||||
|
||||
for (write_offset=NVRAM_NON_ASIGNED_AREA_ADDRESS; write_offset < sReservedAreaEndAddress; write_offset += NVRAM_PAGE_SIZE)
|
||||
{
|
||||
if (NVRAMi_Write(write_offset, NVRAM_PAGE_SIZE, sNvramPageSizeBuffer) != NVRAM_RESULT_SUCCESS)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Write()\n");
|
||||
result = FALSE;
|
||||
}
|
||||
}
|
||||
//OS_Printf("write_offset = %x\n", write_offset);
|
||||
#else
|
||||
// 未割り当て領域先頭256byte+予約領域を0クリアします
|
||||
|
||||
MI_CpuFill8( sNvramPageSizeBuffer, 0x00, NVRAM_PAGE_SIZE );
|
||||
DC_FlushRange( sNvramPageSizeBuffer, NVRAM_PAGE_SIZE );
|
||||
|
||||
if (NVRAMi_Write(NVRAM_NON_ASIGNED_AREA_ADDRESS, NVRAM_PAGE_SIZE, sNvramPageSizeBuffer) != NVRAM_RESULT_SUCCESS)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Write()\n");
|
||||
result = FALSE;
|
||||
}
|
||||
|
||||
DC_InvalidateRange( sNvramPageSizeBuffer, NVRAM_PAGE_SIZE );
|
||||
if (NVRAMi_Read(NVRAM_CONFIG_DATA_OFFSET_ADDRESS, NVRAM_PAGE_SIZE, &sNvramPageSizeBuffer) != NVRAM_RESULT_SUCCESS)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Read()\n");
|
||||
result = FALSE;
|
||||
}
|
||||
sReservedAreaEndAddress = (u32)(*(u16 *)sNvramPageSizeBuffer << NVRAM_CONFIG_DATA_OFFSET_SHIFT) - 0xA00;// TWL WiFi設定 + NTR WiFi設定 を差し引く
|
||||
|
||||
MI_CpuFill8( sNvramPageSizeBuffer, 0x00, NVRAM_PAGE_SIZE );
|
||||
DC_FlushRange( sNvramPageSizeBuffer, NVRAM_PAGE_SIZE );
|
||||
|
||||
if (NVRAMi_Write(sReservedAreaEndAddress - 0x100, NVRAM_PAGE_SIZE, sNvramPageSizeBuffer) != NVRAM_RESULT_SUCCESS)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Write()\n");
|
||||
result = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
// NANDログ情報のクリア
|
||||
if (kamiClearNandErrorLog() != KAMI_RESULT_SUCCESS)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(1, "Fail kamiClearNandErrorLog()\n");
|
||||
result = FALSE;
|
||||
}
|
||||
|
||||
// kamiFontPrintfConsoleEx(0, "NAND Firm Import Start!\n");
|
||||
|
||||
// NAND書き込み
|
||||
write_size = file_size/NAND_BLOCK_BYTE + (file_size % NAND_BLOCK_BYTE != 0);
|
||||
kamiNandWrite( NAND_FIRM_START_OFFSET/NAND_BLOCK_BYTE, pTempBuf+NAND_FIRM_START_OFFSET, write_size ); // ブロック単位、バイト単位、ブロック単位
|
||||
|
||||
// kamiFontPrintfConsoleEx(0, "Start CRC check\n");
|
||||
kamiFontLoadScreenData();
|
||||
|
||||
// CRCを計算するので念のためにクリアしてからリードする
|
||||
MI_CpuClear8( pTempBuf, file_size );
|
||||
DC_FlushRange(pTempBuf, file_size);
|
||||
|
||||
// CRCチェックのためNandからリード
|
||||
if (kamiNandRead(0, pTempBuf, file_size/512 ) == KAMI_RESULT_SEND_ERROR)
|
||||
{
|
||||
kamiFontPrintfConsoleEx(1, "kamiNandRead ... %s!\n", "ERROR");
|
||||
}
|
||||
DC_StoreRange(pTempBuf, file_size);
|
||||
|
||||
// 書き込み後のCRCを計算
|
||||
crc_r2 = SVC_GetCRC16( 0xffff, pTempBuf+512, file_size-512 );
|
||||
|
||||
// NAND部分についてのCRCチェック
|
||||
if (crc_w2 == crc_r2)
|
||||
{
|
||||
// kamiFontPrintfConsoleEx(0, "Success! CRC check %x==%x\n", crc_w2, crc_r2);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = FALSE;
|
||||
kamiFontPrintfConsoleEx(1, "Fail! CRC check %x!=%x\n", crc_w2, crc_r2);
|
||||
}
|
||||
|
||||
// メモリ解放
|
||||
freeFunc(pTempBuf);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
85
build/tests/CustomSystemUpdater/ARM9.TWL/src/keypad.c
Normal file
85
build/tests/CustomSystemUpdater/ARM9.TWL/src/keypad.c
Normal file
@ -0,0 +1,85 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - NandInitializer
|
||||
File: keypad.c
|
||||
|
||||
Copyright 2008 Nintendo. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Date:: $
|
||||
$Rev$
|
||||
$Author$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <twl.h>
|
||||
#include "keypad.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
’è<EFBFBD>”’è‹`
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#define KEY_REPEAT_TRIGGER_START 20
|
||||
#define KEY_REPEAT_TRIGGER_TERM 5
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
“à•”•Ï<EFBFBD>”’è‹`
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
static u16 Cont;
|
||||
static u16 Trg;
|
||||
static u16 Release;
|
||||
static u16 RepeatTrg;
|
||||
static u8 key = 60;
|
||||
|
||||
static int repeat_counter;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
“à•”ŠÖ<EFBFBD>”’è‹`
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
kamiPadRead(void)
|
||||
{
|
||||
u16 ReadData;
|
||||
|
||||
ReadData = PAD_Read();
|
||||
Trg = (u16)(ReadData & (ReadData ^ Cont));
|
||||
Release = (u16)(Cont & (ReadData ^ Cont));
|
||||
Cont = ReadData;
|
||||
|
||||
RepeatTrg = Trg;
|
||||
if (++repeat_counter > (KEY_REPEAT_TRIGGER_START + KEY_REPEAT_TRIGGER_TERM))
|
||||
{
|
||||
repeat_counter = KEY_REPEAT_TRIGGER_START;
|
||||
}
|
||||
if (repeat_counter == KEY_REPEAT_TRIGGER_START)
|
||||
{
|
||||
RepeatTrg = ReadData;
|
||||
}
|
||||
if (!ReadData)
|
||||
{
|
||||
repeat_counter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL
|
||||
kamiPadIsTrigger(u16 key)
|
||||
{
|
||||
return (Trg & key)? TRUE : FALSE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
kamiPadIsRepeatTrigger(u16 key)
|
||||
{
|
||||
return (RepeatTrg & key)? TRUE : FALSE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
kamiPadIsPress(u16 key)
|
||||
{
|
||||
return (Cont & key)? TRUE : FALSE;
|
||||
}
|
||||
|
||||
760
build/tests/CustomSystemUpdater/ARM9.TWL/src/main.c
Normal file
760
build/tests/CustomSystemUpdater/ARM9.TWL/src/main.c
Normal file
@ -0,0 +1,760 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
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"
|
||||
|
||||
#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/menu_launcher.nand"
|
||||
|
||||
#define SYSTEM_UPDATER_MAGIC_CODE 44001111
|
||||
|
||||
// リトライ回数
|
||||
#define MAX_RETRY_COUNT 2
|
||||
|
||||
static const char* ImportTadFileList[] =
|
||||
{
|
||||
"rom:/data/HNAA.tad",
|
||||
"rom:/data/HNBA.tad",
|
||||
"rom:/data/HNCA.tad",
|
||||
"rom:/data/HNLA.tad",
|
||||
"rom:/data/HNHA.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;
|
||||
|
||||
// フォーマット実行
|
||||
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_GetRegion(), 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 ");
|
||||
kamiFontPrintfMain( 4, 5, 8, " --- ver %s %s ---", g_strSDKSvnRevision, g_strIPLSvnRevision );
|
||||
|
||||
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;
|
||||
}
|
||||
74
build/tests/CustomSystemUpdater/Makefile
Normal file
74
build/tests/CustomSystemUpdater/Makefile
Normal file
@ -0,0 +1,74 @@
|
||||
#! make -f
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: SystemUpdater
|
||||
# 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$
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
TARGET_FIRM = SYSTEMMENU
|
||||
|
||||
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
LAUNCHER_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/Launcher
|
||||
MACHINESETTINGS_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/MachineSettings
|
||||
WLANFIRM_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/wlanfirm
|
||||
DS_HASH_TABLE = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/DSHashTable
|
||||
SHARED_FONT_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/sharedFont
|
||||
NANDFIRM_DIR = $(TWL_IPL_RED_ROOT)/build/nandfirm/menu-launcher
|
||||
|
||||
# 既存データを使用する場合はTRUEを指定
|
||||
SKIP_CREATE_DATA = TRUE
|
||||
|
||||
ifeq ($(SKIP_CREATE_DATA),FALSE)
|
||||
SUBDIRS = $(LAUNCHER_DIR) \
|
||||
$(MACHINESETTINGS_DIR) \
|
||||
$(WLANFIRM_DIR) \
|
||||
$(DS_HASH_TABLE) \
|
||||
$(SHARED_FONT_DIR) \
|
||||
$(NANDFIRM_DIR) \
|
||||
data \
|
||||
banner \
|
||||
ARM7.TWL \
|
||||
ARM9.TWL
|
||||
else
|
||||
SUBDIRS = banner \
|
||||
ARM7.TWL \
|
||||
ARM9.TWL
|
||||
endif
|
||||
|
||||
# COMPILE SWITCH for build SystemMenu
|
||||
|
||||
export SYSM_UPDATER_RELEASE = TRUE
|
||||
|
||||
export SYSM_DO_NOT_SHOW_LAUNCHER = TRUE
|
||||
export SYSM_DISABLE_WDS_SCAN = FALSE
|
||||
export SYSM_IGNORE_WLFIRM_SIGNCHECK = FALSE
|
||||
export SYSM_DISABLE_WLFIRM_LOAD = FALSE
|
||||
export SYSM_DISABLE_INITIAL_SETTINGS = TRUE
|
||||
export SYSM_OUTSIDE_UI = TRUE
|
||||
|
||||
export SYSM_BUILD_FOR_PRODUCTION_TEST = FALSE
|
||||
|
||||
# MAKEROM SWITCH for build SystemMenu
|
||||
export SYSM_DISABLE_DEBUG = FALSE
|
||||
export SYSM_USE_WLANFIRM_LOCAL_PUBKEY = FALSE
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
|
||||
|
||||
#===== End of Makefile =====
|
||||
47
build/tests/CustomSystemUpdater/banner/Makefile
Normal file
47
build/tests/CustomSystemUpdater/banner/Makefile
Normal file
@ -0,0 +1,47 @@
|
||||
#! make -f
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: TwlIPL
|
||||
# File: Makefile
|
||||
#
|
||||
# Copyright 2007 Nintendo. All rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs contain
|
||||
# proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
# Company Ltd., and are protected by Federal copyright law. They may
|
||||
# not be disclosed to third parties or copied or duplicated in any form,
|
||||
# in whole or in part, without the prior written consent of Nintendo.
|
||||
#
|
||||
# $Date:: $
|
||||
# $Rev$
|
||||
# $Author$
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
|
||||
|
||||
ICON_DIR = ./icon
|
||||
|
||||
BANNER_ICON = $(ICON_DIR)/gameIcon.bmp
|
||||
BANNER_SPEC = banner_v3.bsf
|
||||
|
||||
TARGETS = banner.bnr
|
||||
INSTALL_DIR = ./
|
||||
INSTALL_TARGETS = $(TARGETS)
|
||||
|
||||
BANNER_ICON_NAME = $(basename $(BANNER_ICON))
|
||||
BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp)
|
||||
|
||||
LDIRT_CLEAN = $(TARGETS) \
|
||||
$(BANNER_ICON_MIDDLE) \
|
||||
$(TARGETS:.bnr=.srl)
|
||||
|
||||
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# build
|
||||
#----------------------------------------------------------------------------
|
||||
do-build: $(TARGETS)
|
||||
|
||||
$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE)
|
||||
$(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS)
|
||||
|
||||
#
|
||||
BIN
build/tests/CustomSystemUpdater/banner/banner_v3.bsf
Normal file
BIN
build/tests/CustomSystemUpdater/banner/banner_v3.bsf
Normal file
Binary file not shown.
BIN
build/tests/CustomSystemUpdater/banner/icon/gameIcon.bmp
Normal file
BIN
build/tests/CustomSystemUpdater/banner/icon/gameIcon.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 592 B |
90
build/tests/CustomSystemUpdater/common/include/fifo.h
Normal file
90
build/tests/CustomSystemUpdater/common/include/fifo.h
Normal file
@ -0,0 +1,90 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - SystemUpdater - include
|
||||
File: fifo.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 TWL_KAMI_TEST_FIFO_H_
|
||||
#define TWL_KAMI_TEST_FIFO_H_
|
||||
|
||||
#include <twl/types.h>
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
定数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define PXI_FIFO_TAG_KAMITEST PXI_FIFO_TAG_USER_1
|
||||
|
||||
#define KAMI_PXI_CONTINUOUS_PACKET_MAX 10
|
||||
#define KAMITEST_PXI_DATA_SIZE_MAX ((KAMI_PXI_CONTINUOUS_PACKET_MAX-1)*3+1) // 最大データ数
|
||||
|
||||
#define KAMITEST_PXI_START_BIT 0x02000000 // 先頭パケットを意味する
|
||||
#define KAMITEST_PXI_RESULT_BIT 0x00008000 // PXIの応答を示す
|
||||
|
||||
#define KAMITEST_PXI_COMMAND_SHIFT 8 // コマンド格納部分の位置
|
||||
#define KAMITEST_PXI_COMMAND_MASK 0x00007f00 // コマンド格納部分のマスク
|
||||
#define KAMITEST_PXI_DATA_NUMS_MASK 0x00ff0000 // データ数領域
|
||||
#define KAMITEST_PXI_DATA_NUMS_SHIFT 16 // データ数位置
|
||||
#define KAMITEST_PXI_1ST_DATA_MASK 0x000000ff // 先頭パケットのデータ領域
|
||||
#define KAMITEST_PXI_1ST_DATA_SHIFT 0 // 先頭パケットのデータ位置
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
typedef enum KAMIPxiResult
|
||||
{
|
||||
KAMI_PXI_RESULT_SUCCESS = 0, // 処理成功 (void/void*型) // 場合により後続パケットあり
|
||||
KAMI_PXI_RESULT_SUCCESS_TRUE = 0, // 処理成功 (BOOL型)
|
||||
KAMI_PXI_RESULT_SUCCESS_FALSE, // 処理成功 (BOOL型)
|
||||
KAMI_PXI_RESULT_INVALID_COMMAND, // 不正なPXIコマンド
|
||||
KAMI_PXI_RESULT_INVALID_PARAMETER, // 不正なパラメータ
|
||||
KAMI_PXI_RESULT_ILLEGAL_STATUS, // KAMIの状態により処理を実行不可
|
||||
KAMI_PXI_RESULT_BUSY, // 他のリクエストを実行中
|
||||
KAMI_PXI_RESULT_FATAL_ERROR, // その他何らかの原因で処理に失敗
|
||||
KAMI_PXI_RESULT_MAX
|
||||
}
|
||||
KAMIPxiResult;
|
||||
|
||||
|
||||
typedef enum KamiCommand
|
||||
{
|
||||
KAMI_TEST_COMMAND,
|
||||
KAMI_EXE_FORMAT,
|
||||
KAMI_NAND_IO,
|
||||
KAMI_CLEAR_NAND_ERRORLOG,
|
||||
KAMI_GET_IS_TOOL_TYPE
|
||||
}
|
||||
KamiCommand;
|
||||
|
||||
typedef enum _IsToolType
|
||||
{
|
||||
IS_TOOL_TYPE_ERROR,
|
||||
IS_TOOL_TYPE_DEBUGGER,
|
||||
IS_TOOL_TYPE_CAPTURE
|
||||
}
|
||||
IsToolType;
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* TWL_KAMI_TEST_FIFO_H_ */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
End of file
|
||||
*---------------------------------------------------------------------------*/
|
||||
9
build/tests/CustomSystemUpdater/custom_base.yaml
Normal file
9
build/tests/CustomSystemUpdater/custom_base.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
:DataPath: data
|
||||
:NandFirm: nandfirm_rcplus.nand
|
||||
:TargetPath: .
|
||||
:TemplatePath: template
|
||||
:RSF: ARM9.TWL/main.rsf
|
||||
:TadFiles:
|
||||
:SRC: ARM9.TWL/src/main.c
|
||||
:FontFile: TWLFontTable.dat
|
||||
14
build/tests/CustomSystemUpdater/default.yaml
Normal file
14
build/tests/CustomSystemUpdater/default.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
:SRC: ARM9.TWL/src/main.c
|
||||
:FontFile: TWLFontTable.dat
|
||||
:DataPath: data
|
||||
:NandFirm: menu_launcher.nand
|
||||
:TargetPath: .
|
||||
:TemplatePath: template
|
||||
:RSF: ARM9.TWL/main.rsf
|
||||
:TadFiles:
|
||||
- HNAA.tad
|
||||
- HNBA.tad
|
||||
- HNCA.tad
|
||||
- HNLA.tad
|
||||
- HNHA.tad
|
||||
174
build/tests/CustomSystemUpdater/sumaker.rb
Executable file
174
build/tests/CustomSystemUpdater/sumaker.rb
Executable file
@ -0,0 +1,174 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: TwlSDK
|
||||
# File: sumaker.rb
|
||||
#
|
||||
# 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$
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
require "yaml"
|
||||
require "fileutils"
|
||||
require "tempfile"
|
||||
|
||||
DEFAULT_CONFIG = "default.yaml"
|
||||
CUSTOM_CONFIG = "custom.yaml"
|
||||
|
||||
FILE_MATCH = /[a-zA-Z0-9\-_\.]+\z/
|
||||
|
||||
# デフォルト設定の作成
|
||||
def make_default_config
|
||||
config = {
|
||||
:TadFiles => [
|
||||
"HNAA.tad",
|
||||
"HNBA.tad",
|
||||
"HNCA.tad",
|
||||
"HNLA.tad",
|
||||
"HNHA.tad",
|
||||
],
|
||||
:FontFile => "TWLFontTable.dat",
|
||||
:NandFirm => "menu_launcher.nand",
|
||||
:TargetPath => ".",
|
||||
:TemplatePath => "template",
|
||||
:RSF => "ARM9.TWL/main.rsf",
|
||||
:SRC => "ARM9.TWL/src/main.c",
|
||||
:DataPath => "data",
|
||||
}
|
||||
write_config(DEFAULT_CONFIG, config)
|
||||
|
||||
end
|
||||
|
||||
# コンフィグファイルを読んで展開
|
||||
def read_config(filename)
|
||||
YAML.load(File.read(filename))
|
||||
end
|
||||
|
||||
# コンフィグのライト
|
||||
def write_config(filename, data)
|
||||
File.open(filename, "w") {|file|
|
||||
file.write data.to_yaml
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
# ファイル内の文字列を置き換える
|
||||
#def replace_data(filename, mark, data)
|
||||
#file = File.read(filename)
|
||||
#file.sub(/%#{mark}%/, data)
|
||||
#end
|
||||
|
||||
# データ内の文字列を置き換える
|
||||
def replace_data(src, mark, data)
|
||||
while src.index(/%#{mark}%/) != nil do
|
||||
src = src.sub(/%#{mark}%/, data)
|
||||
end
|
||||
src
|
||||
end
|
||||
|
||||
|
||||
# ファイルを書き込む
|
||||
def write_data(filename, data)
|
||||
temp = Tempfile.new("temp")
|
||||
temp.puts data
|
||||
temp.close
|
||||
FileUtils.cp(temp.path, filename)
|
||||
end
|
||||
|
||||
# main.rsfの書き換え
|
||||
def make_rsf(config)
|
||||
tadlist = config[:TadFiles].dup
|
||||
tadlist << config[:FontFile] << config[:NandFirm]
|
||||
tadlist = tadlist.join(" ")
|
||||
src = File.read(config[:TemplatePath] + "/" + config[:RSF])
|
||||
write_data(config[:TargetPath] + "/" + config[:RSF], replace_data(src, "filelist", tadlist))
|
||||
end
|
||||
|
||||
# main.c の書き換え
|
||||
def make_main(config)
|
||||
filelist = config[:TadFiles]
|
||||
data = []
|
||||
for t in filelist do
|
||||
data.push("\t\"rom:/data/" + t + "\", \n")
|
||||
end
|
||||
data = data.join
|
||||
src = File.read(config[:TemplatePath] + "/" + config[:SRC])
|
||||
mod = replace_data(src, "tadlist", data)
|
||||
mod = replace_data(mod, "nandfirm", config[:NandFirm])
|
||||
mod = replace_data(mod, "fontfile", config[:FontFile])
|
||||
write_data(config[:TargetPath] + "/" + config[:SRC], mod)
|
||||
end
|
||||
|
||||
# SystemUpdaterの設定を変更する
|
||||
def make_updater(filename)
|
||||
config = read_config(filename)
|
||||
make_rsf(config)
|
||||
make_main(config)
|
||||
end
|
||||
|
||||
# ディレクトリ内のtadを検索
|
||||
def pickup_tad(target_dir, name)
|
||||
Dir.glob(target_dir + name)
|
||||
end
|
||||
|
||||
|
||||
# こっからメイン
|
||||
|
||||
#sumaker mode [filename]
|
||||
|
||||
if ARGV.size == 0
|
||||
p "Usage: sumaker mode [filename]"
|
||||
exit
|
||||
end
|
||||
|
||||
mode = ARGV[0]
|
||||
|
||||
case mode
|
||||
when "default" then
|
||||
# デフォルト設定で作成
|
||||
make_default_config
|
||||
make_updater(DEFAULT_CONFIG)
|
||||
when "custom" then
|
||||
# カスタム設定で作成
|
||||
# 指定したコンフィグファイルをベースに
|
||||
# dataディレクトリ内のtadを追加する
|
||||
config = ""
|
||||
if ARGV.size == 1
|
||||
# コンフィグファイルが指定されてない場合デフォルトをベースに
|
||||
make_default_config
|
||||
config = DEFAULT_CONFIG
|
||||
else
|
||||
config = ARGV[1]
|
||||
end
|
||||
|
||||
# ベースコンフィグに、dataディレクトリ内のtadとnandを追加
|
||||
config = read_config(config)
|
||||
if config[:TadFiles] == nil
|
||||
config[:TadFiles] = []
|
||||
end
|
||||
tads = pickup_tad(config[:DataPath], "/*.tad")
|
||||
nand = pickup_tad(config[:DataPath], "/*.nand")
|
||||
font = pickup_tad(config[:DataPath], "/*.dat")
|
||||
if nand.size > 0
|
||||
config[:NandFirm] = nand[0].slice(FILE_MATCH)
|
||||
end
|
||||
if font.size > 0
|
||||
config[:FontFile] = font[0].slice(FILE_MATCH)
|
||||
end
|
||||
p tads
|
||||
for tad in tads do
|
||||
tad = tad.slice(FILE_MATCH)
|
||||
config[:TadFiles] << tad
|
||||
end
|
||||
config[:TadFiles] = config[:TadFiles].uniq
|
||||
write_config(CUSTOM_CONFIG, config)
|
||||
make_updater(CUSTOM_CONFIG)
|
||||
end
|
||||
|
||||
229
build/tests/CustomSystemUpdater/template/ARM9.TWL/main.rsf
Normal file
229
build/tests/CustomSystemUpdater/template/ARM9.TWL/main.rsf
Normal file
@ -0,0 +1,229 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# 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.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
|
||||
Root /data
|
||||
File %filelist%
|
||||
HostRoot $(PRIVKEY_PATH)
|
||||
Root /key
|
||||
File $(HWINFO_PRIVKEY) $(HWID_PRIVKEY)
|
||||
}
|
||||
755
build/tests/CustomSystemUpdater/template/ARM9.TWL/src/main.c
Normal file
755
build/tests/CustomSystemUpdater/template/ARM9.TWL/src/main.c
Normal file
@ -0,0 +1,755 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
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"
|
||||
|
||||
#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%"
|
||||
|
||||
#define SYSTEM_UPDATER_MAGIC_CODE 44001111
|
||||
|
||||
// リトライ回数
|
||||
#define MAX_RETRY_COUNT 2
|
||||
|
||||
static const char* ImportTadFileList[] =
|
||||
{
|
||||
%tadlist%
|
||||
};
|
||||
|
||||
static const CopyFileList sCopyFileList[] =
|
||||
{
|
||||
{ "rom:/data/%fontfile%", "nand:sys/%fontfile%" }
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
内部変数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
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;
|
||||
|
||||
// フォーマット実行
|
||||
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_GetRegion(), 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 ");
|
||||
kamiFontPrintfMain( 4, 5, 8, " --- ver %s %s ---", g_strSDKSvnRevision, g_strIPLSvnRevision );
|
||||
|
||||
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;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user