mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
SystemUpdaterRegionSelectの追加
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2562 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
eb1d5235a0
commit
cd59bcdbfb
@ -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 \
|
||||||
|
../../common/ARM7/include
|
||||||
|
|
||||||
|
SRCDIR += ../../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 =====
|
||||||
@ -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)
|
||||||
|
}
|
||||||
@ -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
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
@ -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>
|
||||||
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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)
|
||||||
|
}
|
||||||
@ -0,0 +1,140 @@
|
|||||||
|
#! 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"を有効にしてください。
|
||||||
|
#============================================================================
|
||||||
|
|
||||||
|
# SystemMenuファイルの置かれているフォルダを指定(相対もしくは絶対)
|
||||||
|
UPDATER_HOST_ROOT_DIR = ../data_sysmenu
|
||||||
|
|
||||||
|
# COMPILE SWITCH for build SystemUpdater
|
||||||
|
IGNORE_VERSION_CHECK ?= FALSE
|
||||||
|
|
||||||
|
# MAKEROM SWITCH for build SystemUpdater
|
||||||
|
SYSM_DISABLE_DEBUG ?= FALSE
|
||||||
|
|
||||||
|
TARGET_FIRM = SYSTEMMENU
|
||||||
|
TARGET_PLATFORM = TWL
|
||||||
|
TWL_ARCHGEN = LIMITED
|
||||||
|
|
||||||
|
#TARGET_CODEGEN = THUMB
|
||||||
|
|
||||||
|
TITLEID_LO = 0SUA
|
||||||
|
#TARGET_TAD =
|
||||||
|
|
||||||
|
TARGET_BIN = SystemUpdater.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.c \
|
||||||
|
font_data.c \
|
||||||
|
graphics.c \
|
||||||
|
kami_font.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 \
|
||||||
|
process_select_region.c \
|
||||||
|
process_cancel.c \
|
||||||
|
process_check_log.c \
|
||||||
|
process_note.c \
|
||||||
|
process_check_console.c \
|
||||||
|
process_format.c \
|
||||||
|
process_hwinfo.c \
|
||||||
|
process_log.c \
|
||||||
|
process_finish.c \
|
||||||
|
process_import.c \
|
||||||
|
process_write_files.c \
|
||||||
|
process_nandfirm.c \
|
||||||
|
fade.c
|
||||||
|
|
||||||
|
LINCLUDES = include \
|
||||||
|
../common/include \
|
||||||
|
$(ROOT)/build/libraries/lcfg/ARM9.TWL/include \
|
||||||
|
$(ROOT)/build/libraries/fs/common/include \
|
||||||
|
../../common/ARM9/include
|
||||||
|
|
||||||
|
SRCDIR = src \
|
||||||
|
../../HWInfoWriter/ARM9/src \
|
||||||
|
../../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)' \
|
||||||
|
-DUPDATER_HOST_ROOT_DIR='$(UPDATER_HOST_ROOT_DIR)'
|
||||||
|
|
||||||
|
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 =====
|
||||||
@ -0,0 +1,100 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
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_NNS_FONT_H_
|
||||||
|
#define KAMI_NNS_FONT_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
#include <twl.h>
|
||||||
|
#include <nnsys/g2d/g2d_TextCanvas.h>
|
||||||
|
#include <nnsys/g2d/g2d_CharCanvas.h>
|
||||||
|
#include <nnsys/g2d/load/g2d_NFT_load.h>
|
||||||
|
#include <nnsys/g2d/g2di_Char.h>
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
定数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// 文字列描画関数が扱う文字をUnicodeにする
|
||||||
|
#define NNS_G2D_UNICODE
|
||||||
|
|
||||||
|
#define CANVAS_WIDTH 32 // 文字描画域の幅 (キャラクタ単位)
|
||||||
|
#define CANVAS_HEIGHT 24 // 文字描画域の高さ (キャラクタ単位)
|
||||||
|
#define CANVAS_LEFT 0 // 文字描画域の位置X (キャラクタ単位)
|
||||||
|
#define CANVAS_TOP 0 // 文字描画域の位置Y (キャラクタ単位)
|
||||||
|
|
||||||
|
#define TEXT_HSPACE 1 // 文字列描画時の文字間 (ピクセル単位)
|
||||||
|
#define TEXT_VSPACE 1 // 文字列描画時の行間 (ピクセル単位)
|
||||||
|
|
||||||
|
#define CHARACTER_OFFSET 1 // 使用するキャラクタ列の開始番号
|
||||||
|
|
||||||
|
// DrawText での左上寄せ
|
||||||
|
#define TXT_DRAWTEXT_FLAG_DEFAULT (NNS_G2D_VERTICALORIGIN_TOP | NNS_G2D_HORIZONTALORIGIN_LEFT | NNS_G2D_HORIZONTALALIGN_LEFT)
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
型定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// TXTColorPalette の色名 16色パレットへのロードを想定
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
// パレット0 TXT_CPALETTE_MAIN
|
||||||
|
TXT_COLOR_WHITE=0, // 0
|
||||||
|
TXT_COLOR_BLACK, // 1
|
||||||
|
TXT_COLOR_GREEN, // 2
|
||||||
|
TXT_COLOR_RED, // 3
|
||||||
|
TXT_COLOR_WHITE_BASE_START, // 4
|
||||||
|
TXT_COLOR_WHITE_BASE, // 5
|
||||||
|
TXT_COLOR_BLACK_BASE_START = TXT_COLOR_WHITE_BASE_START+4, // 8
|
||||||
|
TXT_COLOR_BLACK_BASE = TXT_COLOR_WHITE_BASE+4, // 9
|
||||||
|
TXT_COLOR_FREE_BASE_START = TXT_COLOR_BLACK_BASE_START+4, // 12
|
||||||
|
TXT_COLOR_FREE_BASE = TXT_COLOR_BLACK_BASE+4 // 13
|
||||||
|
};
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
外部変数宣言
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
extern NNSG2dFont gFont; // フォント
|
||||||
|
extern NNSG2dCharCanvas gCanvas; // CharCanvas
|
||||||
|
extern NNSG2dTextCanvas gTextCanvas; // TextCanvas
|
||||||
|
extern NNSG2dCharCanvas gCanvas2; // CharCanvas
|
||||||
|
extern NNSG2dTextCanvas gTextCanvas2; // TextCanvas
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
関数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void InitFont(void);
|
||||||
|
void UpdateFreePltt(u16 color);
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* KAMI_NNS_FONT_H_ */
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
End of file
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
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 DrawQuadWithColors(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color1, GXRgb color2);
|
||||||
|
void DrawQuadWithAlpha(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color, s16 alpha);
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* GRAPHICS_H_ */
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
End of 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
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
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>
|
||||||
|
|
||||||
|
#define WRAP_DATA_FILE_PATH_IN_NAND "nand:/shared2/launcher/wrap.bin"
|
||||||
|
|
||||||
|
BOOL kamiCopyFile(char* srcPath, char* dstPath);
|
||||||
|
BOOL kamiWriteWrapData(void);
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* KAMI_COPY_FILE_H_ */
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
End of 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
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
@ -0,0 +1,95 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: TwlSDK - NandInitializer
|
||||||
|
File: kami_global.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_GROBAL_H_
|
||||||
|
#define KAMI_GROBAL_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
#include <twl.h>
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
型定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef struct _SystemUpdaterLog
|
||||||
|
{
|
||||||
|
int magic_code;
|
||||||
|
int sdk_version;
|
||||||
|
int ipl_version;
|
||||||
|
int reserve[5];
|
||||||
|
} SystemUpdaterLog;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
IS_TWL_DEBUGGER=0, IS_TWL_CAPTURE, TWL, UNKNOWN
|
||||||
|
} RunningConsole;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
定数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define SYSTEM_UPDATER_LOG_PATH "nand:/sys/log/updater.log"
|
||||||
|
#define SYSTEM_UPDATER_MAGIC_CODE 44001111
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
グローバル変数宣言
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
extern const char *g_strIPLSvnRevision;
|
||||||
|
extern const char *g_strSDKSvnRevision;
|
||||||
|
extern s32 gLockId;
|
||||||
|
extern const u16* sRegionStringArray[4];
|
||||||
|
extern OSTWLRegion gRegion;
|
||||||
|
extern const char* gDirectoryNameConsole[];
|
||||||
|
extern const char* gDirectoryNameRegion[];
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
関数宣言
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
extern void ProcessSelectRegion(void);
|
||||||
|
extern void ProcessCancel(const char* string);
|
||||||
|
extern void ProcessCheckLog(void);
|
||||||
|
extern void ProcessNote(void);
|
||||||
|
extern void ProcessCheckConsole(void);
|
||||||
|
extern BOOL ProcessFormat(void);
|
||||||
|
extern BOOL ProcessHwinfo(void);
|
||||||
|
extern void ProcessLog(void);
|
||||||
|
extern void ProcessFinish(BOOL result);
|
||||||
|
extern BOOL ProcessImport(void);
|
||||||
|
extern BOOL ProcessWriteFiles(void);
|
||||||
|
extern BOOL FadeOutTick(void);
|
||||||
|
extern BOOL FadeInTick(void);
|
||||||
|
extern BOOL FadeInMaster(void);
|
||||||
|
extern RunningConsole GetConsole(void);
|
||||||
|
extern BOOL ProcessNandfirm(void);
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* KAMI_GROBAL_H_ */
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
End of 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
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
@ -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
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
@ -0,0 +1,232 @@
|
|||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# 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 $(UPDATER_HOST_ROOT_DIR)
|
||||||
|
Root /data
|
||||||
|
File *
|
||||||
|
HostRoot ../data
|
||||||
|
Root /font
|
||||||
|
File tbf_ww_s.NFTR
|
||||||
|
HostRoot $(PRIVKEY_PATH)
|
||||||
|
Root /key
|
||||||
|
File $(HWINFO_PRIVKEY) $(HWID_PRIVKEY)
|
||||||
|
}
|
||||||
@ -0,0 +1,77 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: TwlSDK - NandInitializer
|
||||||
|
File: fade.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_global.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
’è<EFBFBD>”’è‹`
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
“à•”•Ï<EFBFBD>”’è‹`
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
static int brightness = 0;
|
||||||
|
static int master_brightness = -16;
|
||||||
|
static int counter;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
“à•”ŠÖ<EFBFBD>”’è‹`
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
BOOL FadeOutTick(void)
|
||||||
|
{
|
||||||
|
if ( brightness < 16)
|
||||||
|
{
|
||||||
|
// if (++counter == 2)
|
||||||
|
// {
|
||||||
|
counter = 0;
|
||||||
|
G2_SetBlendBrightness( GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1, ++brightness );
|
||||||
|
// }
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL FadeInTick(void)
|
||||||
|
{
|
||||||
|
if ( brightness > 0)
|
||||||
|
{
|
||||||
|
// if (++counter == 2)
|
||||||
|
// {
|
||||||
|
counter = 0;
|
||||||
|
G2_SetBlendBrightness( GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1, --brightness );
|
||||||
|
// }
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL FadeInMaster(void)
|
||||||
|
{
|
||||||
|
if ( master_brightness < 0)
|
||||||
|
{
|
||||||
|
if (++counter == 2)
|
||||||
|
{
|
||||||
|
counter = 0;
|
||||||
|
GX_SetMasterBrightness( ++master_brightness );
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,322 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
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 <twl.h>
|
||||||
|
#include <nnsys/g2d/g2d_TextCanvas.h>
|
||||||
|
#include <nnsys/g2d/g2d_CharCanvas.h>
|
||||||
|
#include <nnsys/g2d/load/g2d_NFT_load.h>
|
||||||
|
#include <nnsys/g2d/g2di_Char.h>
|
||||||
|
#include "font.h"
|
||||||
|
#include "kami_global.h"
|
||||||
|
|
||||||
|
// 文字列描画関数が扱う文字をUnicodeにする
|
||||||
|
#define NNS_G2D_UNICODE
|
||||||
|
|
||||||
|
#define CANVAS_WIDTH 32 // 文字描画域の幅 (キャラクタ単位)
|
||||||
|
#define CANVAS_HEIGHT 24 // 文字描画域の高さ (キャラクタ単位)
|
||||||
|
#define CANVAS_LEFT 0 // 文字描画域の位置X (キャラクタ単位)
|
||||||
|
#define CANVAS_TOP 0 // 文字描画域の位置Y (キャラクタ単位)
|
||||||
|
|
||||||
|
#define TEXT_HSPACE 1 // 文字列描画時の文字間 (ピクセル単位)
|
||||||
|
#define TEXT_VSPACE 1 // 文字列描画時の行間 (ピクセル単位)
|
||||||
|
|
||||||
|
#define CHARACTER_OFFSET 1 // 使用するキャラクタ列の開始番号
|
||||||
|
|
||||||
|
// DrawText での左上寄せ
|
||||||
|
#define TXT_DRAWTEXT_FLAG_DEFAULT (NNS_G2D_VERTICALORIGIN_TOP | NNS_G2D_HORIZONTALORIGIN_LEFT | NNS_G2D_HORIZONTALALIGN_LEFT)
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
型定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
グローバル変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
NNSG2dFont gFont; // フォント
|
||||||
|
NNSG2dCharCanvas gCanvas; // CharCanvas
|
||||||
|
NNSG2dCharCanvas gCanvas2; // CharCanvas
|
||||||
|
NNSG2dTextCanvas gTextCanvas; // TextCanvas
|
||||||
|
NNSG2dTextCanvas gTextCanvas2; // TextCanvas
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部定数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
const int max_colors = 32;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// バックドロップ色(白) + 黒 + 緑 + 赤 + 最大フォント階調数 (32階調まで)
|
||||||
|
static u16 colorPalette[1 + 1 + 1 + 1 + max_colors*5] =
|
||||||
|
{
|
||||||
|
GX_RGB(31, 31, 31), GX_RGB(0, 0, 0), GX_RGB(0, 31, 0), GX_RGB(31, 0, 0)
|
||||||
|
};
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部関数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
static u32 LoadFile(void** ppFile, const char* fpath);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: LoadFile
|
||||||
|
|
||||||
|
Description: ファイルをメモリにロードします。
|
||||||
|
ファイルデータが不要になった場合は
|
||||||
|
CMN_UnloadFile( *ppFile, pAlloc ) でファイルデータを
|
||||||
|
解放します。
|
||||||
|
|
||||||
|
Arguments: ppFile: ファイルをロードしたメモリアドレスを受け取る
|
||||||
|
バッファへのポインタ。
|
||||||
|
fpath: ロードするファイルのパス
|
||||||
|
pAlloc: アロケータへのポインタ
|
||||||
|
|
||||||
|
Returns: ロードしたファイルのファイルサイズを返します。
|
||||||
|
0 の場合はファイルロードに失敗した事を表します。
|
||||||
|
この場合 *ppFile の値は無効です。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
static u32 LoadFile(void** ppFile, const char* fpath)
|
||||||
|
{
|
||||||
|
BOOL bSuccess;
|
||||||
|
FSFile f;
|
||||||
|
u32 length;
|
||||||
|
u32 read;
|
||||||
|
|
||||||
|
SDK_NULL_ASSERT( ppFile );
|
||||||
|
SDK_NULL_ASSERT( fpath );
|
||||||
|
|
||||||
|
FS_InitFile(&f);
|
||||||
|
|
||||||
|
bSuccess = FS_OpenFile(&f, fpath);
|
||||||
|
if( ! bSuccess )
|
||||||
|
{
|
||||||
|
OS_Warning("file (%s) not found", fpath);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
length = FS_GetLength(&f);
|
||||||
|
*ppFile = OS_AllocFromMain(length);
|
||||||
|
if( *ppFile == NULL )
|
||||||
|
{
|
||||||
|
OS_Warning("cant allocate memory for file: %s", fpath);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
read = (u32)FS_ReadFile(&f, *ppFile, (s32)length);
|
||||||
|
if( read != length )
|
||||||
|
{
|
||||||
|
OS_Warning("fail to load file: %s", fpath);
|
||||||
|
OS_FreeToMain(*ppFile);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bSuccess = FS_CloseFile(&f);
|
||||||
|
if( ! bSuccess )
|
||||||
|
{
|
||||||
|
OS_Warning("fail to close file: %s", fpath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: InitCanvas
|
||||||
|
|
||||||
|
Description: 文字列描画の初期化をします。
|
||||||
|
|
||||||
|
Arguments: なし。
|
||||||
|
|
||||||
|
Returns: なし。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
static void InitCanvas(void)
|
||||||
|
{
|
||||||
|
GXCharFmt16* pCharBase = (GXCharFmt16*)G2_GetBG1CharPtr();
|
||||||
|
GXCharFmt16* pCharBase2 = (GXCharFmt16*)G2_GetBG2CharPtr();
|
||||||
|
int cOffset = CHARACTER_OFFSET;
|
||||||
|
|
||||||
|
// フォントを読み込みます
|
||||||
|
{
|
||||||
|
// 他のデモと同じように TXT_LoadFont を使ってもフォントを読み込めます。
|
||||||
|
// このデモでは NNS_G2dFontInitUTF16 を使う場合を示しています。
|
||||||
|
// TXT_LoadFont( &gFont, "/data/fontu16.NFTR" );
|
||||||
|
|
||||||
|
void* pFontFile;
|
||||||
|
u32 size;
|
||||||
|
|
||||||
|
size = LoadFile( &pFontFile, "/font/tbf_ww_s.NFTR" );
|
||||||
|
NNS_G2D_ASSERT( size > 0 );
|
||||||
|
|
||||||
|
NNS_G2dFontInitUTF16(&gFont, pFontFile);
|
||||||
|
NNS_G2dPrintFont(&gFont);
|
||||||
|
}
|
||||||
|
|
||||||
|
// CharCanvas の初期化
|
||||||
|
NNS_G2dCharCanvasInitForBG(
|
||||||
|
&gCanvas,
|
||||||
|
pCharBase + cOffset,
|
||||||
|
CANVAS_WIDTH,
|
||||||
|
CANVAS_HEIGHT,
|
||||||
|
NNS_G2D_CHARA_COLORMODE_16
|
||||||
|
);
|
||||||
|
NNS_G2dCharCanvasInitForBG(
|
||||||
|
&gCanvas2,
|
||||||
|
pCharBase2 + cOffset,
|
||||||
|
CANVAS_WIDTH,
|
||||||
|
CANVAS_HEIGHT,
|
||||||
|
NNS_G2D_CHARA_COLORMODE_16
|
||||||
|
);
|
||||||
|
|
||||||
|
// TextCanvasの初期化
|
||||||
|
NNS_G2dTextCanvasInit(
|
||||||
|
&gTextCanvas,
|
||||||
|
&gCanvas,
|
||||||
|
&gFont,
|
||||||
|
TEXT_HSPACE,
|
||||||
|
TEXT_VSPACE
|
||||||
|
);
|
||||||
|
NNS_G2dTextCanvasInit(
|
||||||
|
&gTextCanvas2,
|
||||||
|
&gCanvas2,
|
||||||
|
&gFont,
|
||||||
|
TEXT_HSPACE,
|
||||||
|
TEXT_VSPACE
|
||||||
|
);
|
||||||
|
|
||||||
|
// スクリーンを設定
|
||||||
|
NNS_G2dMapScrToCharText(
|
||||||
|
G2_GetBG1ScrPtr(),
|
||||||
|
CANVAS_WIDTH,
|
||||||
|
CANVAS_HEIGHT,
|
||||||
|
CANVAS_LEFT,
|
||||||
|
CANVAS_TOP,
|
||||||
|
NNS_G2D_TEXT_BG_WIDTH_256,
|
||||||
|
CHARACTER_OFFSET,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
NNS_G2dMapScrToCharText(
|
||||||
|
G2_GetBG2ScrPtr(),
|
||||||
|
CANVAS_WIDTH,
|
||||||
|
CANVAS_HEIGHT,
|
||||||
|
CANVAS_LEFT,
|
||||||
|
CANVAS_TOP,
|
||||||
|
NNS_G2D_TEXT_BG_WIDTH_256,
|
||||||
|
CHARACTER_OFFSET,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
// パレットをロード
|
||||||
|
{
|
||||||
|
// ロードしたフォントに応じてカラーパレットを作成
|
||||||
|
{
|
||||||
|
const int nColors = MATH_IMin((1 << NNS_G2dFontGetBpp(&gFont)), max_colors);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// 白地用パレット 31,20,10, 0
|
||||||
|
for( i = 0; i < nColors; ++i )
|
||||||
|
{
|
||||||
|
int level = ((nColors - 1 - i) * (max_colors - 1) / (nColors - 1));
|
||||||
|
|
||||||
|
colorPalette[i+TXT_COLOR_WHITE_BASE_START] = GX_RGB(level, level, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 黒地用パレット 0, 10, 20, 31
|
||||||
|
for( i = 0; i < nColors; ++i )
|
||||||
|
{
|
||||||
|
int level = ((i) * (max_colors - 1) / (nColors - 1));
|
||||||
|
|
||||||
|
colorPalette[i+TXT_COLOR_BLACK_BASE_START] = GX_RGB(level, level, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 水色地用パレット
|
||||||
|
for( i = 0; i < nColors; ++i )
|
||||||
|
{
|
||||||
|
int level = ((nColors - 1 - i) * (max_colors - 1) / (nColors - 1));
|
||||||
|
|
||||||
|
colorPalette[i+TXT_COLOR_FREE_BASE_START] = GX_RGB((int)(level*0.7), (int)(level*0.9), level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// カラーパレットをロード
|
||||||
|
GX_LoadBGPltt(colorPalette, 0, sizeof(colorPalette));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: UpdateFreePltt
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
Arguments: なし。
|
||||||
|
|
||||||
|
Returns: なし。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
void UpdateFreePltt(u16 color)
|
||||||
|
{
|
||||||
|
const int nColors = MATH_IMin((1 << NNS_G2dFontGetBpp(&gFont)), max_colors);
|
||||||
|
s32 i;
|
||||||
|
|
||||||
|
// フリーパレット
|
||||||
|
for( i = 0; i < nColors; ++i )
|
||||||
|
{
|
||||||
|
int level = ((nColors - 1 - i) * (max_colors - 1) / (nColors - 1));
|
||||||
|
|
||||||
|
colorPalette[i+TXT_COLOR_FREE_BASE_START] =
|
||||||
|
GX_RGB( (int)(level*((color & GX_RGBA_R_MASK)>>GX_RGBA_R_SHIFT)/32.0),
|
||||||
|
(int)(level*((color & GX_RGBA_G_MASK)>>GX_RGBA_G_SHIFT)/32.0),
|
||||||
|
(int)(level*((color & GX_RGBA_B_MASK)>>GX_RGBA_B_SHIFT)/32.0));
|
||||||
|
}
|
||||||
|
|
||||||
|
// カラーパレットをロード
|
||||||
|
GX_LoadBGPltt(colorPalette, 0, sizeof(colorPalette));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: InitFont
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
Arguments: なし。
|
||||||
|
|
||||||
|
Returns: なし。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
void InitFont(void)
|
||||||
|
{
|
||||||
|
char string1[256];
|
||||||
|
u16 string2[256];
|
||||||
|
|
||||||
|
InitCanvas();
|
||||||
|
|
||||||
|
MI_CpuClear8(string1, sizeof(string1));
|
||||||
|
MI_CpuClear8(string2, sizeof(string2));
|
||||||
|
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
NNS_G2dCharCanvasClear(&gCanvas, TXT_COLOR_WHITE);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
NNS_G2dCharCanvasClear(&gCanvas2, TXT_COLOR_WHITE);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 0, 256, 30);
|
||||||
|
|
||||||
|
STD_TSPrintf(string1, "System Updater rev.%s-%s", g_strSDKSvnRevision, g_strIPLSvnRevision);
|
||||||
|
STD_ConvertStringSjisToUnicode(string2, NULL, string1, NULL, NULL);
|
||||||
|
|
||||||
|
NNS_G2dTextCanvasDrawText(&gTextCanvas2, 30, 6,
|
||||||
|
TXT_COLOR_BLACK_BASE, TXT_DRAWTEXT_FLAG_DEFAULT,
|
||||||
|
(const char *)string2
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -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( 0, 0, 0), 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
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
@ -0,0 +1,292 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
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_BG2 | GX_PLANEMASK_OBJ);
|
||||||
|
GXS_SetVisiblePlane(GX_PLANEMASK_BG0 | GX_PLANEMASK_OBJ);
|
||||||
|
|
||||||
|
//---- 3D初期化
|
||||||
|
G3X_Init();
|
||||||
|
G3X_InitMtxStack();
|
||||||
|
G2_SetBG0Priority(3);
|
||||||
|
G2_SetBG1Priority(2);
|
||||||
|
G2_SetBG2Priority(1);
|
||||||
|
G2_SetBG3Priority(0);
|
||||||
|
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);
|
||||||
|
|
||||||
|
G3X_Reset();
|
||||||
|
G3_Identity();
|
||||||
|
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
|
||||||
|
|
||||||
|
//---- 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
|
||||||
|
);
|
||||||
|
|
||||||
|
G2_SetBG2ControlText(
|
||||||
|
GX_BG_SCRSIZE_TEXT_256x256,
|
||||||
|
GX_BG_COLORMODE_16,
|
||||||
|
GX_BG_SCRBASE_0x4000 ,
|
||||||
|
GX_BG_CHARBASE_0x08000
|
||||||
|
);
|
||||||
|
|
||||||
|
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_SetMasterBrightness(-16);
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: DrawQuadWithColors
|
||||||
|
|
||||||
|
Description: 四角ポリゴンを描画
|
||||||
|
|
||||||
|
Arguments: sx - 描画する線の開始点のx座標
|
||||||
|
sy - 描画する線の開始点のy座標
|
||||||
|
ex - 描画する線の終点のx座標
|
||||||
|
ey - 描画する線の終点のy座標
|
||||||
|
color - 描画する線の色
|
||||||
|
|
||||||
|
Returns: None.
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
DrawQuadWithColors(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color1, GXRgb color2)
|
||||||
|
{
|
||||||
|
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( color1 );
|
||||||
|
G3_Vtx(fsx, fsy, 0);
|
||||||
|
|
||||||
|
G3_Color( color2 );
|
||||||
|
G3_Vtx(fex, fsy, 0);
|
||||||
|
|
||||||
|
G3_Color( color2 );
|
||||||
|
G3_Vtx(fex, fey, 0);
|
||||||
|
|
||||||
|
G3_Color( color1 );
|
||||||
|
G3_Vtx(fsx, fey, 0);
|
||||||
|
}
|
||||||
|
G3_End();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: DrawQuad
|
||||||
|
|
||||||
|
Description: 四角ポリゴンを描画
|
||||||
|
|
||||||
|
Arguments: sx - 描画する線の開始点のx座標
|
||||||
|
sy - 描画する線の開始点のy座標
|
||||||
|
ex - 描画する線の終点のx座標
|
||||||
|
ey - 描画する線の終点のy座標
|
||||||
|
color - 描画する線の色
|
||||||
|
|
||||||
|
Returns: None.
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
DrawQuadWithAlpha(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color, s16 alpha)
|
||||||
|
{
|
||||||
|
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_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, alpha, 0);
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
@ -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...\n";
|
||||||
|
static const char *pMsgNormalWriting = "Writing Normal File...\n";
|
||||||
|
static const char *pMsgSignWriting = "Writing Sign File...\n";
|
||||||
|
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...\n";
|
||||||
|
static const char *pMsgSecureDeleting = "Deteting Secure File...\n";
|
||||||
|
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;
|
||||||
|
}
|
||||||
@ -0,0 +1,135 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
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_CreateFileAuto(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;
|
||||||
|
}
|
||||||
|
// ターゲットファイルへ書き込み
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ダミーのDSメニューラッピング用ファイル作成(UIGランチャーが作っているもの)
|
||||||
|
BOOL kamiWriteWrapData(void)
|
||||||
|
{
|
||||||
|
FSFile file;
|
||||||
|
BOOL open_is_ok;
|
||||||
|
const int FATFS_CLUSTER_SIZE = 16 * 1024;
|
||||||
|
|
||||||
|
// 既に存在するなら何もしない
|
||||||
|
FS_InitFile(&file);
|
||||||
|
open_is_ok = FS_OpenFile(&file, WRAP_DATA_FILE_PATH_IN_NAND);
|
||||||
|
if (open_is_ok)
|
||||||
|
{
|
||||||
|
FS_CloseFile(&file);
|
||||||
|
OS_Printf("%s is already exist.\n", WRAP_DATA_FILE_PATH_IN_NAND);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( FS_CreateFileAuto( WRAP_DATA_FILE_PATH_IN_NAND, FS_PERMIT_R | FS_PERMIT_W ) )
|
||||||
|
{
|
||||||
|
FSFile file;
|
||||||
|
if( FS_OpenFileEx( &file, WRAP_DATA_FILE_PATH_IN_NAND, FS_FILEMODE_RW ) )
|
||||||
|
{
|
||||||
|
(void)FS_SetFileLength( &file, FATFS_CLUSTER_SIZE );
|
||||||
|
FS_CloseFile( &file );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
@ -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
|
||||||
|
{
|
||||||
|
// 一文字ずつ書き込み
|
||||||
|
sFontScreenDataSub[((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( &sFontScreenDataSub[32], sFontScreenDataSub, sizeof(u16)*32*23 );
|
||||||
|
MI_CpuClear32( &sFontScreenDataSub[32*23], sizeof(u16)*32);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -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,332 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
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 NAND_BLOCK_BYTE 0x200
|
||||||
|
#define NAND_FIRM_START_OFFSET 0x200
|
||||||
|
#define NAND_FIRM_START_OFFSET_IN_FILE 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;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部関数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void kamiEraseNandfirmVersion( u32 nandfirmsize );
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
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 nandfirm_size;
|
||||||
|
u32 alloc_size;
|
||||||
|
u32 write_block;
|
||||||
|
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 // CLEAR_NON_ASIGNED_AREA_AND_RESERVED_AREA_ALL
|
||||||
|
|
||||||
|
// .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;
|
||||||
|
}
|
||||||
|
|
||||||
|
nandfirm_size = file_size - NAND_FIRM_START_OFFSET_IN_FILE;
|
||||||
|
|
||||||
|
// バッファ確保
|
||||||
|
// 書き込みがブロック単位(512byte)であることを考慮し512アライメントを確保
|
||||||
|
alloc_size = MATH_ROUNDUP(file_size, 512);
|
||||||
|
pTempBuf = allocFunc( alloc_size );
|
||||||
|
if (pTempBuf == NULL)
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsoleEx(1, "Fail Alloc()!\n");
|
||||||
|
FS_CloseFile(&file);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
MI_CpuClear8( pTempBuf, alloc_size );
|
||||||
|
|
||||||
|
// .nandファイルリード
|
||||||
|
DC_FlushRange(pTempBuf, alloc_size);
|
||||||
|
read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size );
|
||||||
|
DC_FlushRange(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+NAND_FIRM_START_OFFSET_IN_FILE, nandfirm_size );
|
||||||
|
|
||||||
|
// まずNORHeaderDS領域を書き込む(40byte?)
|
||||||
|
if (NVRAMi_Write(0, sizeof(NORHeaderDS), (void*)pTempBuf) != NVRAM_RESULT_SUCCESS)
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Write()\n");
|
||||||
|
result = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CRCを計算するので念のためにクリアしてからリードする
|
||||||
|
MI_CpuClear8( pTempBuf, 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_FlushRange(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_CpuClear8( sNvramPageSizeBuffer, 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_FlushRange(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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// nandfirmバージョンの消去(デバッグ用)
|
||||||
|
kamiEraseNandfirmVersion(nandfirm_size);
|
||||||
|
|
||||||
|
// kamiFontPrintfConsoleEx(0, "NAND Firm Import Start!\n");
|
||||||
|
|
||||||
|
// NAND書き込み
|
||||||
|
write_block = nandfirm_size/NAND_BLOCK_BYTE + (nandfirm_size % NAND_BLOCK_BYTE != 0);
|
||||||
|
kamiNandWrite( NAND_FIRM_START_OFFSET/NAND_BLOCK_BYTE, pTempBuf+NAND_FIRM_START_OFFSET, write_block ); // ブロック単位、バイト単位、ブロック単位
|
||||||
|
kamiFontLoadScreenData();
|
||||||
|
|
||||||
|
// CRCを計算するので念のためにクリアしてからリードする
|
||||||
|
MI_CpuClear8( pTempBuf, nandfirm_size );
|
||||||
|
DC_FlushRange(pTempBuf, nandfirm_size);
|
||||||
|
|
||||||
|
// CRCチェックのためNandからリード
|
||||||
|
if (kamiNandRead(NAND_FIRM_START_OFFSET/NAND_BLOCK_BYTE, pTempBuf, write_block ) == KAMI_RESULT_SEND_ERROR)
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsoleEx(1, "kamiNandRead ... %s!\n", "ERROR");
|
||||||
|
}
|
||||||
|
DC_FlushRange(pTempBuf, nandfirm_size);
|
||||||
|
|
||||||
|
// 書き込み後のCRCを計算
|
||||||
|
crc_r2 = SVC_GetCRC16( 0xffff, pTempBuf, nandfirm_size );
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: kamiEraseNandfirmVersion
|
||||||
|
|
||||||
|
Description: nandfirmのバージョン情報を消去します。(デバッグ用)
|
||||||
|
|
||||||
|
Arguments: no
|
||||||
|
|
||||||
|
Returns: None.
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
void kamiEraseNandfirmVersion( u32 nandfirmsize )
|
||||||
|
{
|
||||||
|
u8 buffer[NAND_BLOCK_BYTE];
|
||||||
|
u32 blockNo;
|
||||||
|
|
||||||
|
if ((nandfirmsize % NAND_BLOCK_BYTE)==0)
|
||||||
|
{
|
||||||
|
blockNo = NAND_FIRM_START_OFFSET/NAND_BLOCK_BYTE + nandfirmsize/NAND_BLOCK_BYTE;
|
||||||
|
MI_CpuClear8( buffer, NAND_BLOCK_BYTE );
|
||||||
|
DC_FlushRange(buffer, NAND_BLOCK_BYTE);
|
||||||
|
kamiNandWrite( blockNo, buffer, 1 ); // ブロック単位、バイト単位、ブロック単位
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,243 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
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 <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_copy_file.h"
|
||||||
|
#include "graphics.h"
|
||||||
|
#include "hwi.h"
|
||||||
|
#include "keypad.h"
|
||||||
|
#include "debugger_hw_reset_control.h"
|
||||||
|
#include "debugger_card_rom.h"
|
||||||
|
#include "font.h"
|
||||||
|
#include "kami_global.h"
|
||||||
|
|
||||||
|
#define SCRAMBLE_MASK 0x00406000
|
||||||
|
|
||||||
|
extern void InitFont(void);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
型定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部定数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
s32 gLockId;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部関数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
static void VBlankIntr(void);
|
||||||
|
static void InitAllocation(void);
|
||||||
|
static BOOL IgnoreRemoval(void);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: TwlMain
|
||||||
|
|
||||||
|
Description: main
|
||||||
|
|
||||||
|
Arguments: None
|
||||||
|
|
||||||
|
Returns: None
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
TwlMain()
|
||||||
|
{
|
||||||
|
BOOL result;
|
||||||
|
|
||||||
|
// 製品ビルドランチャー&デバッガ上での起動対応
|
||||||
|
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();
|
||||||
|
kamiFontPrintfConsole(FONT_COLOR_GREEN, "Log Window:\n");
|
||||||
|
|
||||||
|
// メインスレッドのカードロックID取得
|
||||||
|
gLockId = 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// フォント初期化
|
||||||
|
InitFont();
|
||||||
|
|
||||||
|
// コンソールチェック
|
||||||
|
ProcessCheckConsole();
|
||||||
|
|
||||||
|
// ログ情報確認
|
||||||
|
ProcessCheckLog();
|
||||||
|
|
||||||
|
// リージョン選択
|
||||||
|
ProcessSelectRegion();
|
||||||
|
|
||||||
|
// Note表示
|
||||||
|
ProcessNote();
|
||||||
|
|
||||||
|
// TWLの更新処理を実行中です
|
||||||
|
CARD_LockRom((u16)gLockId);
|
||||||
|
(void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_NOW_UPDATE);
|
||||||
|
CARD_UnlockRom((u16)gLockId);
|
||||||
|
|
||||||
|
// ISデバッガのハードウェアリセットを禁止する
|
||||||
|
DEBUGGER_HwResetDisable();
|
||||||
|
|
||||||
|
// HWInfo関連の前準備
|
||||||
|
switch (HWI_Init( OS_AllocFromMain, OS_FreeToMain ))
|
||||||
|
{
|
||||||
|
case HWI_INIT_FAILURE:
|
||||||
|
kamiFontPrintfConsole(FONT_COLOR_RED, " Fail! : HWI_INIT()\n");
|
||||||
|
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;
|
||||||
|
|
||||||
|
// フォーマット
|
||||||
|
// result &= ProcessFormat();
|
||||||
|
|
||||||
|
// 全ハードウェア情報の更新
|
||||||
|
result &= ProcessHwinfo();
|
||||||
|
|
||||||
|
// 必要なファイルの書き込み
|
||||||
|
result &= ProcessWriteFiles();
|
||||||
|
|
||||||
|
// ダミーのラッピングデータ書き込み
|
||||||
|
// result &= kamiWriteWrapData();
|
||||||
|
|
||||||
|
// TADのインポート開始
|
||||||
|
result &= ProcessImport();
|
||||||
|
|
||||||
|
// NANDファームのインストール開始
|
||||||
|
result &= ProcessNandfirm();
|
||||||
|
|
||||||
|
// 更新ログを作成してVersionDownを防ぐ
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
ProcessLog();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ISデバッガのハードウェアリセットを許可する
|
||||||
|
DEBUGGER_HwResetEnable();
|
||||||
|
|
||||||
|
// 結果表示
|
||||||
|
ProcessFinish( result );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
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);
|
||||||
|
}
|
||||||
@ -0,0 +1,81 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: SystemUpdater
|
||||||
|
File: process_cancel.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 "font.h"
|
||||||
|
#include "graphics.h"
|
||||||
|
#include "keypad.h"
|
||||||
|
#include "debugger_hw_reset_control.h"
|
||||||
|
#include "debugger_card_rom.h"
|
||||||
|
#include "kami_global.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
型定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
グローバル変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部定数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部関数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: ProcessCancel
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
Arguments: なし。
|
||||||
|
|
||||||
|
Returns: なし。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
void ProcessCancel(const char* string)
|
||||||
|
{
|
||||||
|
// キャンセルされました
|
||||||
|
CARD_LockRom((u16)gLockId);
|
||||||
|
(void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_CANCELED);
|
||||||
|
CARD_UnlockRom((u16)gLockId);
|
||||||
|
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_WHITE, 0, 30, 256, 100);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 130, 256, 62);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
|
||||||
|
NNS_G2dTextCanvasDrawText(&gTextCanvas, 40, 60,
|
||||||
|
TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, string);
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
G3X_Reset();
|
||||||
|
G3_Identity();
|
||||||
|
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
|
||||||
|
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
FadeInTick();
|
||||||
|
FadeInMaster();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,198 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: SystemUpdater
|
||||||
|
File: check_console.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_global.h"
|
||||||
|
#include "kami_font.h"
|
||||||
|
#include "kami_pxi.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
型定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部定数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
static RunningConsole sRunning = UNKNOWN;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部関数宣言
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
static RunningConsole CheckConsole(void);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
関数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: ProcessCheckConsole
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
Arguments: None
|
||||||
|
|
||||||
|
Returns: None
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
void ProcessCheckConsole(void)
|
||||||
|
{
|
||||||
|
BOOL isAdapter;
|
||||||
|
u16 batLevel;
|
||||||
|
|
||||||
|
sRunning = CheckConsole();
|
||||||
|
|
||||||
|
switch (sRunning)
|
||||||
|
{
|
||||||
|
case IS_TWL_DEBUGGER:
|
||||||
|
kamiFontPrintfConsole( FONT_COLOR_GREEN, "Running on IS_TWL_DEBUGGER.\n");
|
||||||
|
break;
|
||||||
|
case IS_TWL_CAPTURE:
|
||||||
|
kamiFontPrintfConsole( FONT_COLOR_GREEN, "Running on IS_TWL_CAPTURE.\n");
|
||||||
|
break;
|
||||||
|
case TWL:
|
||||||
|
kamiFontPrintfConsole( FONT_COLOR_GREEN, "Running on TWL CONSOLE.\n");
|
||||||
|
break;
|
||||||
|
case UNKNOWN:
|
||||||
|
kamiFontPrintfConsole( FONT_COLOR_GREEN, "Running on UNKNOWN.\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
#ifdef SYSM_BUILD_FOR_DEBUGGER
|
||||||
|
// デバッガ向けSystemUpdaterは実機とキャプチャでは動作させない
|
||||||
|
if (sRunning != IS_TWL_DEBUGGER)
|
||||||
|
{
|
||||||
|
ProcessCancel((const char *)
|
||||||
|
L" Sorry,\n"
|
||||||
|
L" This SystemUpdater can not\n"
|
||||||
|
L" execute on TWL-CONSOLE. "
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// 実機向けSystemUpdaterはデバッガでは動作させない
|
||||||
|
if (sRunning == IS_TWL_DEBUGGER)
|
||||||
|
{
|
||||||
|
ProcessCancel((const char *)
|
||||||
|
L" Sorry,\n"
|
||||||
|
L" This SystemUpdater can not\n"
|
||||||
|
L" execute on IS-TWL-DEBUGGER. "
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endif // SYSM_BUILD_FOR_DEBUGGER
|
||||||
|
*/
|
||||||
|
// UNKNOWNは動作させない
|
||||||
|
if (sRunning == UNKNOWN)
|
||||||
|
{
|
||||||
|
ProcessCancel((const char *)
|
||||||
|
L" Sorry,\n"
|
||||||
|
L" This SystemUpdater can not\n"
|
||||||
|
L" execute on UNKNOWN CONSOLE. "
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 電池残量が少なければ動作させない
|
||||||
|
while (PM_GetBatteryLevel( &batLevel ) != PM_RESULT_SUCCESS)
|
||||||
|
{
|
||||||
|
OS_Sleep(1);
|
||||||
|
}
|
||||||
|
while (PM_GetACAdapter( &isAdapter ) != PM_RESULT_SUCCESS)
|
||||||
|
{
|
||||||
|
OS_Sleep(1);
|
||||||
|
}
|
||||||
|
if (((batLevel <= 2) && ! isAdapter) ||
|
||||||
|
(batLevel <= 1))
|
||||||
|
{
|
||||||
|
ProcessCancel((const char *)
|
||||||
|
L" Sorry,\n"
|
||||||
|
L" This SystemUpdater can not\n"
|
||||||
|
L" execute if battery is low. "
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
kamiFontLoadScreenData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: CheckConsole
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
Arguments: None
|
||||||
|
|
||||||
|
Returns: None
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
static RunningConsole CheckConsole(void)
|
||||||
|
{
|
||||||
|
u32 console = OS_GetRunningConsoleType();
|
||||||
|
RunningConsole 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return running;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: GetConsole
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
Arguments: None
|
||||||
|
|
||||||
|
Returns: None
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
RunningConsole GetConsole(void)
|
||||||
|
{
|
||||||
|
return sRunning;
|
||||||
|
}
|
||||||
@ -0,0 +1,136 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: SystemUpdater
|
||||||
|
File: process_check_log.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 "font.h"
|
||||||
|
#include "graphics.h"
|
||||||
|
#include "keypad.h"
|
||||||
|
#include "debugger_hw_reset_control.h"
|
||||||
|
#include "debugger_card_rom.h"
|
||||||
|
#include "kami_global.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
型定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
グローバル変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部定数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部関数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
static void DrawAlready(SystemUpdaterLog* log);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: ProcessCheckLog
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
Arguments: なし。
|
||||||
|
|
||||||
|
Returns: なし。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
void ProcessCheckLog(void)
|
||||||
|
{
|
||||||
|
// (更新可能条件)
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: DrawAlready
|
||||||
|
|
||||||
|
Description: Alreadyを表示します
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
Returns: None.
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
static void DrawAlready(SystemUpdaterLog* log)
|
||||||
|
{
|
||||||
|
char string1[256];
|
||||||
|
u16 string2[256];
|
||||||
|
|
||||||
|
MI_CpuClear8(string1, sizeof(string1));
|
||||||
|
MI_CpuClear8(string2, sizeof(string2));
|
||||||
|
|
||||||
|
// 既にアップデート済み
|
||||||
|
CARD_LockRom((u16)gLockId);
|
||||||
|
(void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_ALREADY);
|
||||||
|
CARD_UnlockRom((u16)gLockId);
|
||||||
|
|
||||||
|
STD_TSPrintf(string1, "This machine has already\nbeen updated.\n\n ver: %d %d", log->sdk_version, log->ipl_version);
|
||||||
|
STD_ConvertStringSjisToUnicode(string2, NULL, string1, NULL, NULL);
|
||||||
|
|
||||||
|
NNS_G2dTextCanvasDrawText(&gTextCanvas, 48, 58,
|
||||||
|
TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char *)string2);
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: SystemUpdater
|
||||||
|
File: process_finish.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 "font.h"
|
||||||
|
#include "graphics.h"
|
||||||
|
#include "keypad.h"
|
||||||
|
#include "debugger_hw_reset_control.h"
|
||||||
|
#include "debugger_card_rom.h"
|
||||||
|
#include "kami_global.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
型定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
グローバル変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部定数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部関数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: ProcessNote
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
Arguments: なし。
|
||||||
|
|
||||||
|
Returns: なし。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
void ProcessFinish(BOOL result)
|
||||||
|
{
|
||||||
|
// TWLの更新処理が完了しました
|
||||||
|
CARD_LockRom((u16)gLockId);
|
||||||
|
(void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_FINISHED);
|
||||||
|
CARD_UnlockRom((u16)gLockId);
|
||||||
|
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_WHITE, 0, 30, 256, 100);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 130, 256, 62);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
UpdateFreePltt(GX_RGB(0, 21, 0));
|
||||||
|
NNS_G2dTextCanvasDrawText(&gTextCanvas, 78, 72,
|
||||||
|
TXT_COLOR_FREE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*)
|
||||||
|
L"Update Success!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UpdateFreePltt(GX_RGB(31, 0, 0));
|
||||||
|
NNS_G2dTextCanvasDrawText(&gTextCanvas, 78, 72,
|
||||||
|
TXT_COLOR_FREE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*)
|
||||||
|
L"Update Failure!");
|
||||||
|
}
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
DrawQuad( 0, 30, 256, 131, GX_RGB(0, 21, 0));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawQuad( 0, 30, 256, 131, GX_RGB(31, 0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
|
||||||
|
G3X_Reset();
|
||||||
|
G3_Identity();
|
||||||
|
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
|
||||||
|
|
||||||
|
FadeInTick();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,124 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: SystemUpdater
|
||||||
|
File: process_format.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 <twl/nam.h>
|
||||||
|
#include "font.h"
|
||||||
|
#include "graphics.h"
|
||||||
|
#include "keypad.h"
|
||||||
|
#include "debugger_hw_reset_control.h"
|
||||||
|
#include "debugger_card_rom.h"
|
||||||
|
#include "kami_global.h"
|
||||||
|
#include "kami_pxi.h"
|
||||||
|
#include "kami_font.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
型定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
グローバル変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部定数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
static vu8 sIsFormatFinish;
|
||||||
|
static u8 sFormatResult;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部関数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
static void FormatCallback(KAMIResult result, void* arg);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: ProcessFormat
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
Arguments: なし。
|
||||||
|
|
||||||
|
Returns: なし。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
BOOL ProcessFormat(void)
|
||||||
|
{
|
||||||
|
NNS_G2dCharCanvasClear(&gCanvas, TXT_COLOR_BLACK);
|
||||||
|
NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_WHITE, 0, 30, 256, 100);
|
||||||
|
|
||||||
|
NNS_G2dTextCanvasDrawText(&gTextCanvas, 40, 60,
|
||||||
|
TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, "Now Format");
|
||||||
|
|
||||||
|
// フォーマット実行
|
||||||
|
sIsFormatFinish = FALSE;
|
||||||
|
ExeFormatAsync(FORMAT_MODE_QUICK, FormatCallback);
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
G3X_Reset();
|
||||||
|
G3_Identity();
|
||||||
|
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
|
||||||
|
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
|
||||||
|
if (sIsFormatFinish) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sFormatResult)
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsole(FONT_COLOR_GREEN, "NAND Format Success.\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsole(FONT_COLOR_RED, "NAND Format Failure!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// フォーマット後はESに必要なファイルがなくなっているため
|
||||||
|
// ES_InitLibを呼び出すことで作成しておく
|
||||||
|
NAM_End( NULL, NULL );
|
||||||
|
NAM_Init( OS_AllocFromMain, OS_FreeToMain );
|
||||||
|
|
||||||
|
return sFormatResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
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;
|
||||||
|
}
|
||||||
@ -0,0 +1,89 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: SystemUpdater
|
||||||
|
File: process_hwinfo.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 <twl/nam.h>
|
||||||
|
#include "font.h"
|
||||||
|
#include "graphics.h"
|
||||||
|
#include "keypad.h"
|
||||||
|
#include "debugger_hw_reset_control.h"
|
||||||
|
#include "debugger_card_rom.h"
|
||||||
|
#include "kami_global.h"
|
||||||
|
#include "kami_pxi.h"
|
||||||
|
#include "kami_font.h"
|
||||||
|
#include "hw_info.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
型定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
グローバル変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部定数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部関数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: ProcessHwinfo
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
Arguments: なし。
|
||||||
|
|
||||||
|
Returns: なし。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
BOOL ProcessHwinfo(void)
|
||||||
|
{
|
||||||
|
const int MAX_RETRY_COUNT = 2;
|
||||||
|
BOOL hw_info_result;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// 全ハードウェア情報の更新
|
||||||
|
for (i=0;i<MAX_RETRY_COUNT;i++)
|
||||||
|
{
|
||||||
|
hw_info_result = WriteHWInfoFile(gRegion, OS_IsForceDisableWireless());
|
||||||
|
if (hw_info_result)
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsole( FONT_COLOR_GREEN, "Write Hardware Info Success.\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsole(CONSOLE_RED, "Write Hardware Info Retry!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( hw_info_result)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsole(FONT_COLOR_RED, "Write Hardware Info Failure!\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,321 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
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 "hw_info.h"
|
||||||
|
#include "TWLHWInfo_api.h"
|
||||||
|
#include "graphics.h"
|
||||||
|
#include "kami_global.h"
|
||||||
|
#include "font.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
型定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
定数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define THREAD_STACK_SIZE (16*1024)
|
||||||
|
|
||||||
|
const char* gDirectoryNameRegion[] =
|
||||||
|
{
|
||||||
|
"japan",
|
||||||
|
"america",
|
||||||
|
"europe",
|
||||||
|
"australia"
|
||||||
|
};
|
||||||
|
|
||||||
|
const char* gDirectoryNameConsole[] =
|
||||||
|
{
|
||||||
|
"debugger", // IS_TWL_DEBUGGER
|
||||||
|
"standalone", // IS_TWL_CAPTURE
|
||||||
|
"standalone", // TWL
|
||||||
|
"" // UNKNOWN
|
||||||
|
};
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
static u32 sCurrentProgress;
|
||||||
|
static vu8 sNowImport = FALSE;
|
||||||
|
static vu8 sProgress = FALSE;
|
||||||
|
static u8 sStack[THREAD_STACK_SIZE];
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部関数宣言
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
static s32 kamiImportTad(const char* path);
|
||||||
|
static void ProgressThread(void* arg);
|
||||||
|
static void Destructor(void* arg);
|
||||||
|
void ProgressDraw(f32 ratio);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
処理関数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: ProcessImport
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
Arguments: なし。
|
||||||
|
|
||||||
|
Returns: なし。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
BOOL ProcessImport(void)
|
||||||
|
{
|
||||||
|
FSFile dir;
|
||||||
|
FSDirectoryEntryInfo info[1];
|
||||||
|
const s32 MAX_RETRY_COUNT = 2;
|
||||||
|
BOOL result = TRUE;
|
||||||
|
char full_path[FS_ENTRY_LONGNAME_MAX+6];
|
||||||
|
s32 i=0;
|
||||||
|
s32 j=0;
|
||||||
|
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_WHITE, 0, 30, 256, 100);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 130, 256, 62);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
|
||||||
|
while(!FadeInTick())
|
||||||
|
{
|
||||||
|
G3X_Reset();
|
||||||
|
G3_Identity();
|
||||||
|
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
|
||||||
|
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 適切なディレクトリを開く
|
||||||
|
STD_TSNPrintf(full_path, sizeof(full_path), "rom:/data/%s/%s/", gDirectoryNameConsole[GetConsole()], gDirectoryNameRegion[gRegion]);
|
||||||
|
|
||||||
|
FS_InitFile(&dir);
|
||||||
|
if (!FS_OpenDirectory(&dir, full_path, FS_FILEMODE_R))
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsole(CONSOLE_RED, "Error FS_OpenDirectory()\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// tadファイルを検索してインポート
|
||||||
|
while (FS_ReadDirectory(&dir, info))
|
||||||
|
{
|
||||||
|
s32 nam_result;
|
||||||
|
char string1[256];
|
||||||
|
u16 string2[256];
|
||||||
|
|
||||||
|
MI_CpuClear8(string2, sizeof(string2));
|
||||||
|
|
||||||
|
if ((info->attributes & (FS_ATTRIBUTE_DOS_DIRECTORY | FS_ATTRIBUTE_IS_DIRECTORY)) == 0)
|
||||||
|
{
|
||||||
|
char* pExtension;
|
||||||
|
|
||||||
|
// 拡張子のチェック
|
||||||
|
pExtension = STD_SearchCharReverse( info->longname, '.');
|
||||||
|
if (pExtension)
|
||||||
|
{
|
||||||
|
if (!STD_CompareString( pExtension, ".tad") || !STD_CompareString( pExtension, ".TAD") )
|
||||||
|
{
|
||||||
|
|
||||||
|
STD_TSPrintf(string1, "List %d ", ++i);
|
||||||
|
STD_ConvertStringSjisToUnicode(string2, NULL, string1, NULL, NULL);
|
||||||
|
|
||||||
|
NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_WHITE, 0, 60, 256, 20);
|
||||||
|
NNS_G2dTextCanvasDrawText(&gTextCanvas, 40, 60,
|
||||||
|
TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*)L"Now Import..");
|
||||||
|
NNS_G2dTextCanvasDrawText(&gTextCanvas, 135, 60,
|
||||||
|
TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*)string2);
|
||||||
|
|
||||||
|
STD_TSNPrintf(full_path, sizeof(full_path), "rom:/data/%s/%s/%s", gDirectoryNameConsole[GetConsole()], gDirectoryNameRegion[gRegion], info->longname);
|
||||||
|
// kamiFontPrintfConsole(CONSOLE_GREEN, " %s\n", full_path);
|
||||||
|
|
||||||
|
// MAX_RETRY_COUNTまでリトライする
|
||||||
|
for (j=0; j<MAX_RETRY_COUNT; j++)
|
||||||
|
{
|
||||||
|
nam_result = kamiImportTad(full_path);
|
||||||
|
if (nam_result == NAM_OK)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsole(CONSOLE_RED, "Import %d Retry!\n", i+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( nam_result == NAM_OK)
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsole(FONT_COLOR_GREEN, "List : %d Import Success.\n", i+1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsole(FONT_COLOR_RED, "Error: %d : RetCode = %d\n", i+1, nam_result );
|
||||||
|
result = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
kamiFontLoadScreenData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!FadeOutTick())
|
||||||
|
{
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: kamiImportTad
|
||||||
|
|
||||||
|
Description: .tad ファイルインポート
|
||||||
|
|
||||||
|
Arguments: no
|
||||||
|
|
||||||
|
Returns: None.
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
static s32 kamiImportTad(const char* path)
|
||||||
|
{
|
||||||
|
NAMTadInfo tadInfo;
|
||||||
|
OSThread thread;
|
||||||
|
s32 nam_result;
|
||||||
|
|
||||||
|
// 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){};
|
||||||
|
|
||||||
|
// きちんと表示する
|
||||||
|
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
|
||||||
|
// 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ブランク待ち
|
||||||
|
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
|
||||||
|
// 3D初期化
|
||||||
|
G3X_Reset();
|
||||||
|
G3_Identity();
|
||||||
|
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
sProgress = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: ProgressDraw
|
||||||
|
|
||||||
|
Description: インポートの進捗を表示します
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
Returns: None.
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void ProgressDraw(f32 ratio)
|
||||||
|
{
|
||||||
|
s16 x = (s16)(30 + (226 - 30)*ratio);
|
||||||
|
|
||||||
|
// グリーンバー
|
||||||
|
DrawQuadWithColors( 30, 86, x, 95, GX_RGB(22, 31, 22), GX_RGB(12, 25, 12));
|
||||||
|
|
||||||
|
// グレーバー
|
||||||
|
DrawQuad( 30, 86, 226, 95, GX_RGB(28, 28, 28));
|
||||||
|
}
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: SystemUpdater
|
||||||
|
File: process_log.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 "font.h"
|
||||||
|
#include "kami_font.h"
|
||||||
|
#include "kami_global.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
型定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
グローバル変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部定数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部関数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: ProcessLog
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
Arguments: なし。
|
||||||
|
|
||||||
|
Returns: なし。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
void ProcessLog(void)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsole(FONT_COLOR_RED, "Failure : FS_WriteFile\n");
|
||||||
|
}
|
||||||
|
FS_CloseFile(&file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsole(FONT_COLOR_RED, "Failure : FS_CreateFileAuto\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,124 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: SystemUpdater
|
||||||
|
File: process_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 <stdlib.h> // atoi
|
||||||
|
#include <twl.h>
|
||||||
|
#include <twl/nam.h>
|
||||||
|
#include "font.h"
|
||||||
|
#include "graphics.h"
|
||||||
|
#include "keypad.h"
|
||||||
|
#include "debugger_hw_reset_control.h"
|
||||||
|
#include "debugger_card_rom.h"
|
||||||
|
#include "kami_global.h"
|
||||||
|
#include "kami_pxi.h"
|
||||||
|
#include "kami_font.h"
|
||||||
|
#include "hw_info.h"
|
||||||
|
#include "kami_write_nandfirm.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
型定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
グローバル変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部定数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部関数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: ProcessNandfirm
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
Arguments: なし。
|
||||||
|
|
||||||
|
Returns: なし。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
BOOL ProcessNandfirm(void)
|
||||||
|
{
|
||||||
|
FSFile dir;
|
||||||
|
FSDirectoryEntryInfo info[1];
|
||||||
|
char full_path[FS_ENTRY_LONGNAME_MAX+6];
|
||||||
|
const int MAX_RETRY_COUNT = 2;
|
||||||
|
BOOL result = FALSE;
|
||||||
|
BOOL find = FALSE;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// 適切なディレクトリを開く
|
||||||
|
STD_TSNPrintf(full_path, sizeof(full_path), "rom:/data/%s/%s/", gDirectoryNameConsole[GetConsole()], gDirectoryNameRegion[gRegion]);
|
||||||
|
|
||||||
|
FS_InitFile(&dir);
|
||||||
|
if (!FS_OpenDirectory(&dir, full_path, FS_FILEMODE_R))
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsole(CONSOLE_RED, "Error FS_OpenDirectory()\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// .nandファイルを検索してインポート
|
||||||
|
while (FS_ReadDirectory(&dir, info))
|
||||||
|
{
|
||||||
|
if ((info->attributes & (FS_ATTRIBUTE_DOS_DIRECTORY | FS_ATTRIBUTE_IS_DIRECTORY)) == 0)
|
||||||
|
{
|
||||||
|
char* pExtension;
|
||||||
|
|
||||||
|
// 拡張子のチェック
|
||||||
|
pExtension = STD_SearchCharReverse( info->longname, '.');
|
||||||
|
if (pExtension)
|
||||||
|
{
|
||||||
|
if (!STD_CompareString( pExtension, ".nand") || !STD_CompareString( pExtension, ".NAND") )
|
||||||
|
{
|
||||||
|
STD_TSNPrintf(full_path, sizeof(full_path), "rom:/data/%s/%s/%s", gDirectoryNameConsole[GetConsole()], gDirectoryNameRegion[gRegion], info->longname);
|
||||||
|
find = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (find)
|
||||||
|
{
|
||||||
|
for (i=0;i<MAX_RETRY_COUNT;i++)
|
||||||
|
{
|
||||||
|
result = kamiWriteNandfirm(full_path, OS_AllocFromMain, OS_FreeToMain);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsole(FONT_COLOR_GREEN, "Firm Update Success.\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsole(CONSOLE_RED, "Write Firm Retry!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (result == FALSE)
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsole(FONT_COLOR_RED, "Firm Update Failure!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
@ -0,0 +1,132 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: SystemUpdater
|
||||||
|
File: process_note.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 "font.h"
|
||||||
|
#include "graphics.h"
|
||||||
|
#include "keypad.h"
|
||||||
|
#include "debugger_hw_reset_control.h"
|
||||||
|
#include "debugger_card_rom.h"
|
||||||
|
#include "kami_global.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
型定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
グローバル変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部定数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部関数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: ProcessNote
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
Arguments: なし。
|
||||||
|
|
||||||
|
Returns: なし。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
void ProcessNote(void)
|
||||||
|
{
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_WHITE, 0, 30, 256, 100);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 130, 256, 62);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
|
||||||
|
// NNS_G2dTextCanvasDrawText(&gTextCanvas, 20, 40,
|
||||||
|
// TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT,
|
||||||
|
// (const char *)L"Please Select System Menu Region."
|
||||||
|
// );
|
||||||
|
|
||||||
|
NNS_G2dTextCanvasDrawText(&gTextCanvas2, 60, 140,
|
||||||
|
TXT_COLOR_BLACK_BASE, TXT_DRAWTEXT_FLAG_DEFAULT,
|
||||||
|
(const char *)
|
||||||
|
L"\xe000 ok! start update.\n"
|
||||||
|
L"\xe001 cancel.\n"
|
||||||
|
);
|
||||||
|
/*
|
||||||
|
NNS_G2dTextCanvasDrawText(&gTextCanvas, 50, 40,
|
||||||
|
TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*)
|
||||||
|
L" -- Note --"
|
||||||
|
);
|
||||||
|
|
||||||
|
NNS_G2dTextCanvasDrawText(&gTextCanvas, 44, 60,
|
||||||
|
TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*)
|
||||||
|
L"・All data in nand flash \n"
|
||||||
|
L" memory will be lost."
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
|
||||||
|
NNS_G2dTextCanvasDrawText(&gTextCanvas, 80, 50,
|
||||||
|
TXT_COLOR_FREE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*)
|
||||||
|
sRegionStringArray[gRegion]
|
||||||
|
);
|
||||||
|
|
||||||
|
NNS_G2dTextCanvasDrawText(&gTextCanvas, 44, 80,
|
||||||
|
TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*)
|
||||||
|
L"・Do not shut down while\n"
|
||||||
|
L" update is processing."
|
||||||
|
);
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
G3X_Reset();
|
||||||
|
G3_Identity();
|
||||||
|
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
|
||||||
|
|
||||||
|
kamiPadRead();
|
||||||
|
|
||||||
|
if (FadeInTick())
|
||||||
|
{
|
||||||
|
if (kamiPadIsTrigger(PAD_BUTTON_B))
|
||||||
|
{
|
||||||
|
while (!FadeOutTick())
|
||||||
|
{
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
}
|
||||||
|
ProcessCancel((const char *)L"\n Update was Canceld.");
|
||||||
|
}
|
||||||
|
else if (kamiPadIsTrigger(PAD_BUTTON_A))
|
||||||
|
{
|
||||||
|
while (!FadeOutTick())
|
||||||
|
{
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
}
|
||||||
|
NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 130, 256, 62);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DrawQuadWithColors( 0, 50, 128, 62, GX_RGB(31, 31, 31), GX_RGB(22, 28, 31));
|
||||||
|
DrawQuadWithColors( 128, 50, 256, 62, GX_RGB(22, 28, 31), GX_RGB(31, 31, 31));
|
||||||
|
|
||||||
|
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,162 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: SystemUpdater
|
||||||
|
File: process_select_region.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 "font.h"
|
||||||
|
#include "graphics.h"
|
||||||
|
#include "keypad.h"
|
||||||
|
#include "kami_global.h"
|
||||||
|
#include "debugger_hw_reset_control.h"
|
||||||
|
#include "debugger_card_rom.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
型定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
グローバル変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
OSTWLRegion gRegion = OS_TWL_REGION_JAPAN;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部定数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
static const u16 POS_Y_JAPAN = 52;
|
||||||
|
static const u16 POS_Y_AMERICA = 66;
|
||||||
|
static const u16 POS_Y_EUROPE = 80;
|
||||||
|
static const u16 POS_Y_AUSTRALIA = 94;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
static const u16 sPosArray[4] =
|
||||||
|
{
|
||||||
|
POS_Y_JAPAN,
|
||||||
|
POS_Y_AMERICA,
|
||||||
|
POS_Y_EUROPE,
|
||||||
|
POS_Y_AUSTRALIA
|
||||||
|
};
|
||||||
|
|
||||||
|
const u16* sRegionStringArray[4] =
|
||||||
|
{
|
||||||
|
L"region Japan",
|
||||||
|
L"region America",
|
||||||
|
L"region Europe",
|
||||||
|
L"region Australia"
|
||||||
|
};
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部関数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: ProcessSelectRegion
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
Arguments: なし。
|
||||||
|
|
||||||
|
Returns: なし。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
void ProcessSelectRegion(void)
|
||||||
|
{
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_WHITE, 0, 30, 256, 100);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 130, 256, 62);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
|
||||||
|
NNS_G2dTextCanvasDrawText(&gTextCanvas2, 60, 140,
|
||||||
|
TXT_COLOR_BLACK_BASE, TXT_DRAWTEXT_FLAG_DEFAULT,
|
||||||
|
(const char *)
|
||||||
|
L"\xe006 change region.\n"
|
||||||
|
L"\xe000 choice.\n"
|
||||||
|
L"\xe001 cancel.\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
// 液晶を見てください。
|
||||||
|
CARD_LockRom((u16)gLockId);
|
||||||
|
(void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_LOOK_SCREEN);
|
||||||
|
CARD_UnlockRom((u16)gLockId);
|
||||||
|
|
||||||
|
gRegion = OS_GetRegion();
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
s32 i;
|
||||||
|
G3X_Reset();
|
||||||
|
G3_Identity();
|
||||||
|
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
|
||||||
|
|
||||||
|
kamiPadRead();
|
||||||
|
|
||||||
|
if (FadeInMaster())
|
||||||
|
{
|
||||||
|
if (kamiPadIsRepeatTrigger(PAD_KEY_DOWN))
|
||||||
|
{
|
||||||
|
if (++gRegion > OS_TWL_REGION_AUSTRALIA)
|
||||||
|
{
|
||||||
|
gRegion = OS_TWL_REGION_JAPAN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (kamiPadIsRepeatTrigger(PAD_KEY_UP))
|
||||||
|
{
|
||||||
|
if (--gRegion < OS_TWL_REGION_JAPAN)
|
||||||
|
{
|
||||||
|
gRegion = OS_TWL_REGION_AUSTRALIA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kamiPadIsTrigger(PAD_BUTTON_B))
|
||||||
|
{
|
||||||
|
ProcessCancel((const char *)L"\n Update was Canceld.");
|
||||||
|
}
|
||||||
|
else if (kamiPadIsTrigger(PAD_BUTTON_A))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0;i<OS_TWL_REGION_AUSTRALIA+1;i++)
|
||||||
|
{
|
||||||
|
if (gRegion != i)
|
||||||
|
{
|
||||||
|
NNS_G2dTextCanvasDrawText(&gTextCanvas, 76, sPosArray[i], TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*)sRegionStringArray[i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NNS_G2dTextCanvasDrawText(&gTextCanvas, 76, sPosArray[i], TXT_COLOR_FREE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*)sRegionStringArray[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawQuadWithColors( 0, (s16)(sPosArray[gRegion]+2), 84, (s16)(sPosArray[gRegion]+12), GX_RGB(31, 31, 31), GX_RGB(22, 28, 31));
|
||||||
|
DrawQuadWithColors( 84, (s16)(sPosArray[gRegion]+2), 172, (s16)(sPosArray[gRegion]+12), GX_RGB(22, 28, 31), GX_RGB(22, 28, 31));
|
||||||
|
DrawQuadWithColors( 172, (s16)(sPosArray[gRegion]+2), 256, (s16)(sPosArray[gRegion]+12), GX_RGB(22, 28, 31), GX_RGB(31, 31, 31));
|
||||||
|
|
||||||
|
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
|
||||||
|
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!FadeOutTick())
|
||||||
|
{
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,136 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: SystemUpdater
|
||||||
|
File: process_write_files.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 "font.h"
|
||||||
|
#include "graphics.h"
|
||||||
|
#include "keypad.h"
|
||||||
|
#include "debugger_hw_reset_control.h"
|
||||||
|
#include "debugger_card_rom.h"
|
||||||
|
#include "kami_global.h"
|
||||||
|
#include "kami_copy_file.h"
|
||||||
|
#include "kami_font.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
型定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef struct _CopyFileList
|
||||||
|
{
|
||||||
|
char* srcPath;
|
||||||
|
char* dstPath;
|
||||||
|
} CopyFileList;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
グローバル変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部定数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
/*
|
||||||
|
static const CopyFileList sCopyFileList[] =
|
||||||
|
{
|
||||||
|
{ "rom:/data/TWLFontTable.dat", "nand:sys/TWLFontTable.dat" },
|
||||||
|
{ "rom:/data/cert.sys", "nand:/sys/cert.sys" }
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部変数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部関数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: ProcessWriteFiles
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
Arguments: なし。
|
||||||
|
|
||||||
|
Returns: なし。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
BOOL ProcessWriteFiles(void)
|
||||||
|
{
|
||||||
|
FSFile dir;
|
||||||
|
FSDirectoryEntryInfo info[1];
|
||||||
|
char full_path[FS_ENTRY_LONGNAME_MAX+6];
|
||||||
|
BOOL find = FALSE;
|
||||||
|
BOOL result = TRUE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_WHITE, 0, 30, 256, 100);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 130, 256, 62);
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
|
||||||
|
NNS_G2dTextCanvasDrawText(&gTextCanvas, 84, 60,
|
||||||
|
TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*)
|
||||||
|
L"Write Files.."
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 適切なディレクトリを開く
|
||||||
|
STD_TSNPrintf(full_path, sizeof(full_path), "rom:/data/%s/%s/", gDirectoryNameConsole[GetConsole()], gDirectoryNameRegion[gRegion]);
|
||||||
|
|
||||||
|
FS_InitFile(&dir);
|
||||||
|
if (!FS_OpenDirectory(&dir, full_path, FS_FILEMODE_R))
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsole(CONSOLE_RED, "Error FS_OpenDirectory()\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// .datファイルを検索
|
||||||
|
while (FS_ReadDirectory(&dir, info))
|
||||||
|
{
|
||||||
|
if ((info->attributes & (FS_ATTRIBUTE_DOS_DIRECTORY | FS_ATTRIBUTE_IS_DIRECTORY)) == 0)
|
||||||
|
{
|
||||||
|
char* pExtension;
|
||||||
|
|
||||||
|
// 拡張子のチェック
|
||||||
|
pExtension = STD_SearchCharReverse( info->longname, '.');
|
||||||
|
if (pExtension)
|
||||||
|
{
|
||||||
|
if (!STD_CompareString( pExtension, ".dat") || !STD_CompareString( pExtension, ".DAT") )
|
||||||
|
{
|
||||||
|
STD_TSNPrintf(full_path, sizeof(full_path), "rom:/data/%s/%s/%s", gDirectoryNameConsole[GetConsole()], gDirectoryNameRegion[gRegion], info->longname);
|
||||||
|
find = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (find)
|
||||||
|
{
|
||||||
|
if (kamiCopyFile(full_path, "nand:sys/TWLFontTable.dat"))
|
||||||
|
{
|
||||||
|
kamiFontPrintfConsole(FONT_COLOR_GREEN, "Write Font Data Success.\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = FALSE;
|
||||||
|
kamiFontPrintfConsole(FONT_COLOR_RED, "Write Font Data Failure!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
33
build/systemMenu_tools/SystemUpdaterRegionSelect/Makefile
Normal file
33
build/systemMenu_tools/SystemUpdaterRegionSelect/Makefile
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#! 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
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
SUBDIRS = banner \
|
||||||
|
ARM7.TWL \
|
||||||
|
ARM9.TWL
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
|
||||||
|
|
||||||
|
#===== End of Makefile =====
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
#! make -f
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# Project: TwlIPL
|
||||||
|
# File: Makefile
|
||||||
|
#
|
||||||
|
# Copyright 2007 Nintendo. All rights reserved.
|
||||||
|
#
|
||||||
|
# These coded instructions, statements, and computer programs contain
|
||||||
|
# proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||||
|
# Company Ltd., and are protected by Federal copyright law. They may
|
||||||
|
# not be disclosed to third parties or copied or duplicated in any form,
|
||||||
|
# in whole or in part, without the prior written consent of Nintendo.
|
||||||
|
#
|
||||||
|
# $Date:: $
|
||||||
|
# $Rev$
|
||||||
|
# $Author$
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
|
||||||
|
|
||||||
|
ICON_DIR = ./icon
|
||||||
|
|
||||||
|
BANNER_ICON = $(ICON_DIR)/gameIcon.bmp
|
||||||
|
BANNER_SPEC = banner_v3.bsf
|
||||||
|
|
||||||
|
TARGETS = banner.bnr
|
||||||
|
INSTALL_DIR = ./
|
||||||
|
INSTALL_TARGETS = $(TARGETS)
|
||||||
|
|
||||||
|
BANNER_ICON_NAME = $(basename $(BANNER_ICON))
|
||||||
|
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)
|
||||||
|
|
||||||
|
#
|
||||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 592 B |
@ -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
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
Binary file not shown.
20
build/systemMenu_tools/SystemUpdaterRegionSelect/readme.txt
Normal file
20
build/systemMenu_tools/SystemUpdaterRegionSelect/readme.txt
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
以下のディレクトリ構成でsystemMenuを用意して
|
||||||
|
ARM9/Makefileの UPDATER_HOST_ROOT_DIR変数で指定してください。
|
||||||
|
|
||||||
|
xxxxx
|
||||||
|
+debugger
|
||||||
|
l +america/*
|
||||||
|
l +australia/*
|
||||||
|
l +europe/*
|
||||||
|
l +japan/*
|
||||||
|
l
|
||||||
|
+standalone
|
||||||
|
+america/*
|
||||||
|
+australia/*
|
||||||
|
+europe/*
|
||||||
|
+japan/*
|
||||||
|
|
||||||
|
|
||||||
|
上記の*には、
|
||||||
|
全tadとnandファームとフォントデータを置いてください。
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user