不要物などの削除

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/branches/20090601_test_sd_boot@2830 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
yoshida_teruhisa 2009-06-01 04:46:56 +00:00
parent 06f5daaae7
commit 10a6aa8aab
775 changed files with 0 additions and 100997 deletions

View File

@ -1,150 +0,0 @@
#/*---------------------------------------------------------------------------*
# Project: TwlIPL - tests - DisplaySystemInformation
# File: makefile
#
# Copyright **** 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
TARGET_PLATFORM = TWL
TWL_ARCHGEN = LIMITED
######################################
FILE_IDX = 0
IS_SECURE_APP = TRUE
IS_NAND_APP = FALSE
NAND_ACCESS = TRUE
AES_SLOT = FALSE
INVISIBLE_SCFG = TRUE
GAMECODE = 0BZA
######################################
ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin
LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a
MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=N -DVERSION_VIEWER=TRUE
TWL_NANDAPP = $(IS_NAND_APP)
DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation)
SUBDIRS =
MISC_DIR = ../../../systemMenu_RED/misc
SRCDIR = $(DISP_INFO)/ARM9/src
SRCS = main.c viewSystemInfo.c drawFunc.c control.c\
strResource.c misc.c util.c\
get_versionData.c \
$(MISC_DIR)/src/cmn.c
LINCLUDES += $(MISC_DIR)/include \
$(DISP_INFO)/common/include \
$(ES_ROOT)/twl/include
TARGET_NAME = AppVersionViewer
TARGET_BIN = $(TARGET_NAME).$(FILE_SUFFIX)
SYSMENU_LIBS = \
liblcfg$(TWL_LIBSUFFIX).a \
libsysmenu$(TWL_LIBSUFFIX).a \
libsysmmcu$(TWL_LIBSUFFIX).a \
libsysmutil$(TWL_LIBSUFFIX).a \
libboot$(TWL_LIBSUFFIX).a \
libds$(TWL_LIBSUFFIX).a \
liberrorlog$(TWL_LIBSUFFIX).a \
libhotsw$(TWL_LIBSUFFIX).a \
libdht$(TWL_LIBSUFFIX).a \
libreloc_info$(TWL_LIBSUFFIX).a \
libnamut$(TWL_LIBSUFFIX).a \
libsharedfont_launcher$(TWL_LIBSUFFIX).a \
WDS$(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 \
libreboot$(TWL_LIBSUFFIX).a \
libna$(TWL_LIBSUFFIX).a
LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS)
#=============================================================================
include $(TWLSDK_ROOT)/add-ins/es/commondefs.es
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
ifeq ($(IS_SECURE_APP),TRUE)
DEFAULT_COMP_ARM7 = armadillo
WRAM_MAP = MAP_TS_SCR
APPTYPE = SYSTEM
MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe
ROM_SPEC = main.rsf
MAKETAD_OPTION += -s
else
WRAM_MAP = $(MAKEROM_WRAM_MAPPING)
DEFAULT_COMP_ARM7 = racoon
APPTYPE = USER
ROM_SPEC = main_normal.rsf
endif
ifeq ($(IS_NAND_APP),TRUE)
MEDIA = NAND
FILE_SUFFIX = tad
else
MEDIA = GAMECARD
FILE_SUFFIX = srl
endif
ifeq ($(INVISIBLE_SCFG),TRUE)
SCFG_SUFFIX = LockSCFG
else
SCFG_SUFFIX = UnlockSCFG
endif
BINDIR = ./bin/$(TWL_BUILDTYPE)
OBJDIR = ./obj/$(TWL_BUILDTYPE)
MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \
-DDISPINFO_APPTYPE=$(APPTYPE) \
-DDISPINFO_SECURE=$(IS_SECURE_APP) \
-DDISPINFO_MEDIA=$(MEDIA) \
-DDISPINFO_NANDACCESS=$(NAND_ACCESS) \
-DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \
-DDISPINFO_AES=$(AES_SLOT) \
-DDISPINFO_GAMECODE=$(GAMECODE) \
-DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))'
DEFAULT_MAKEROM_ARM7_BASE = $(DISP_INFO)/ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7)
DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT)
#----------------------------------------------------------------------------
do-build: $(TARGETS)
#----------------------------------------------------------------------------
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
#include $(TWLSDK_ROOT)/build/buildtools/modulerules
#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules
#===== End of Makefile =====

View File

@ -1,248 +0,0 @@
#----------------------------------------------------------------------------
# Project: TwlSDK - include
# File: ROM-TS.rsf
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded insructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Date:: $
# $Rev$
# $Author$
#----------------------------------------------------------------------------
#
# TWL ROM SPEC FILE
#
Arm9
{
Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)"
OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)"
OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)"
Elf "$(MAKEROM_ARM9:r).tef"
}
Arm7
{
Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)"
OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)"
OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)"
Elf "$(MAKEROM_ARM7_BASE:r).tef"
}
Arm9.Ltd
{
Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)"
OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)"
OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)"
}
Arm7.Ltd
{
Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)"
OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)"
OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)"
}
Property
{
###
### Settings for FinalROM
###
#### BEGIN
#
# TITLE NAME: Your product name within 12bytes
#
TitleName "DispInfo"
#
# MAKER CODE: Your company ID# in 2 ascii words
# issued by NINTENDO
#
MakerCode 01
#
# REMASTER VERSION: Mastering version
#
#RomVersion 0
#
# ROM SPEED TYPE: [MROM/1TROM/UNDEFINED]
#
RomSpeedType $(MAKEROM_ROMSPEED)
#
# ROM SIZE: in bit [64M/128M/256M/512M/1G/2G]
#
#RomSize 128M
#RomSize 256M
#
# ROM PADDING: TRUE if finalrom
#
#RomFootPadding TRUE
#
# ROM HEADER TEMPLATE: Provided to every product by NINTENDO
#
RomHeaderTemplate $(ROM_HEADER_TEMPLATE)
#
# BANNER FILE: generated from Banner Spec File
#
#BannerFile ./etc/myGameBanner.bnr
BannerFile ../banner/banner.bnr
#
# Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE]
#
#PermitLandingNormalJump FALSE
#
# Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE]
#
#PermitLandingTmpJump FALSE
###
### Setting for TWL
###
#
# ROM HEADER Ltd: Provided to every product by NINTENDO
#
RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin
#
# Digest parameters:
#
DigestParam 1024 32
#
# WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD
# MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD]
# don't have to edit
#
WramMapping MAP_TS_SCR
#
# CardRegion: card region [Japan/America/Europe/Australia/China/Korea]
#
CardRegion ALL
#
# CommonClientKey: launcher deliver common client Key [TRUE/FALSE]
#
#CommonClientKey FALSE
#
# HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE]
#
#HwAESSlotB FALSE
#
# HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE]
#
#HwAESSlotC FALSE
#
# SDCardAccess: sd card access control [TRUE/FALSE]
#
#SDCardAccess $(DISPINFO_SDACCESS)
#
# NANDAccess: NAND access control [TRUE/FALSE]
#
#NANDAccess FALSE
NANDAccess $(DISPINFO_NANDACCESS)
#
# Codec mode:
# don't have to edit
#
CodecMode $(MAKEROM_CODEC_MODE)
#
# Disp WiFiConnection Icon for Launcher [TRUE/FALSE]
#
#WiFiConnectionIcon FALSE
#
# Disp DSWireless Icon for Launcher [TRUE/FALSE]
#
#DSWirelessIcon FALSE
LockSCFG $(DISPINFO_LOCKSCFG)
HwAESSlotA_SSLClientCert $(DISPINFO_AES)
DisableDebug TRUE
###
#### END
}
AppendProperty
{
#
# Publisher : "Nintendo"
# don't have to edit
#Publisher Nintendo
#
# Application type : [USER/SYSTEM]
# don't have to edit
AppType $(DISPINFO_APPTYPE)
# AppType SYSTEM
#
# launch title on the launcher : [TRUE/FALSE]
# don't have to edit
Launch TRUE
#
# Boot allowed Media: [GameCard]
#
Media $(DISPINFO_MEDIA)
# Media NAND
#
# Data only title : [TRUE/FALSE]
# don't have to edit
##DataOnly FALSE
#
# Secure title : [TRUE/FALSE]
# don't have to edit
Secure $(DISPINFO_SECURE)
# Secure TRUE
#
# GameCode for TitleID : Your GameCode in 4 ascii words
#
GameCode $(DISPINFO_GAMECODE)
#
# Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M]
#
#PublicSaveDataSize 0K
#
# Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M]
#
#PrivateSaveDataSize 0K
#
# Enable SubBannerFile
#SubBannerFile FALSE
}
RomSpec
{
Offset 0x00000000
Segment ALL
HostRoot ../../../systemMenu_RED/data
Root /data
File NTR_IPL_font_m.NFTR
}

View File

@ -1,49 +0,0 @@
#! 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)/icon.bmp
BANNER_SPEC = banner_v3.bsf
TARGETS = banner.bnr
INSTALL_DIR = ./
INSTALL_TARGETS = $(TARGETS)
BANNER_ICON_NAME = $(basename $(BANNER_ICON))
LDIRT_CLEAN = $(TARGETS) \
$(BANNER_ICON_NAME).nbfs \
$(BANNER_ICON_NAME).nbfc \
$(BANNER_ICON_NAME).nbfp \
$(TARGETS:.bnr=.srl)
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
#----------------------------------------------------------------------------
# build
#----------------------------------------------------------------------------
do-build: $(TARGETS)
$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON)
$(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \
$(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS)
#

Binary file not shown.

Before

Width:  |  Height:  |  Size: 630 B

View File

@ -1,47 +0,0 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlIPL - tests - CalcHMAC_forBroadOn
# 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$
#----------------------------------------------------------------------------
TARGET_PLATFORM := TWL
SRCS = CalcHMAC_forBroadOn.c
TARGET_BIN = CalcHMAC_forBroadOn.srl
TITLEID_LO = 0BRA
ROM_SPEC = main.rsf
include $(TWLSDK_ROOT)/build/buildtools/commondefs
LINCLUDES = $(ROOT)/build/libraries/lcfg/ARM9.TWL/include
LLIBRARIES = liblcfg$(TWL_LIBSUFFIX).a
ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),)
MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo.der'
endif
MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \
-DPRIVKEY_PATH='$(TWL_IPL_RED_PRIVATE_ROOT)/keys/rsa' \
-DCARD_REGION='$(CARD_REGION)'
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -1,171 +0,0 @@
#----------------------------------------------------------------------------
# Project: TwlSDK - include
# File: ROM-BB.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 2
#
# ROM SPEED TYPE: [MROM/1TROM/UNDEFINED]
#
RomSpeedType $(MAKEROM_ROMSPEED)
#
# ROM SIZE: in bit [64M/128M/256M/512M/1G/2G]
#
#RomSize 2G
#
# 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 $(TWLSDK_ROOT)/include/twl/specfiles/default.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 $(MAKEROM_WRAM_MAPPING)
#
# CardRegion: card region [Japan/America/Europe/Australia/China/Korea]
#
CardRegion ALL
#
# 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)
###
#### END
}
AppendProperty
{
#
# Publisher : "Nintendo"
# don't have to edit
Publisher Nintendo
#
# Boot allowed Media: [GameCard/NAND]
#
Media GameCard
#
# GameCode for TitleID : Your GameCode in 4 ascii words
#
GameCode $(TITLEID_LO)
}
RomSpec
{
Offset 0x00000000
Segment ALL
HostRoot $(PRIVKEY_PATH)
Root /key
File $(HWINFO_PRIVKEY)
}

View File

@ -1,368 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK
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.h>
#include <nitro/misc.h>
#include <twl/crypto/rsa.h>
#include <nitro/crypto/util.h>
#include <twl/lcfg/common/TWLHWInfo.h>
#include <twl/lcfg/common/api.h>
#include "TWLStoreFile.h"
// define data------------------------------------------------------------------
#define HWINFO_PRIVKEY_PATH "rom:key/private_HWInfo.der" // 製品用秘密鍵
#define RSA_KEY_LENGTH_1024 RSA_KEY_LENGTH
#define HWINFO_S_BODY_SIZE 0x1C
#define PATH_K00A317_JP "sdmc:/hwinfo_s/HWInfo_S.K00A317_JP.dat"
#define PATH_K00A317_US "sdmc:/hwinfo_s/HWInfo_S.K00A317_US.dat"
#define PATH_K00A317_EU "sdmc:/hwinfo_s/HWInfo_S.K00A317_EU.dat"
#define PATH_K00A317_AU "sdmc:/hwinfo_s/HWInfo_S.K00A317_AU.dat"
#define PATH_K00A319_JP "sdmc:/hwinfo_s/HWInfo_S.K00A319_JP.dat"
#define PATH_K00A319_US "sdmc:/hwinfo_s/HWInfo_S.K00A319_US.dat"
#define PATH_K00A319_EU "sdmc:/hwinfo_s/HWInfo_S.K00A319_EU.dat"
#define PATH_K00A319_AU "sdmc:/hwinfo_s/HWInfo_S.K00A319_AU.dat"
//------------------------------------------------------------------------------
extern s32 CRYPTO_RSA_Sign_custom(CRYPTORSASignContext *context, CRYPTORSASignParam *param);
//------------------------------------------------------------------------------
static u8 s_privKey[ 4096 ] ATTRIBUTE_ALIGN(32);
static TSFHeader s_header;
/*----------------------------------------------------------------------------*/
static const u64 FuseID_K00A317 = 0x08a1080105112134LLU;
static const u64 FuseID_K00A319 = 0x08a1080105112122LLU;
/*----------------------------------------------------------------------------*/
static const u8 HWINFO_S_K00A317_JP[HWINFO_S_BODY_SIZE] =
{
0x01, 0x00, 0x00, 0x00, /* validLanguageBitmap */
0x00, 0x00, 0x00, 0x00, /* flags, rsv */
0x00, /* region */
'T', 'J', 'N', '5', '6', '3', '2', '0',
'4', '0', '2', '0', 0x00, 'K', 0x00, /* serialNo */
'J', 'A', 'N', 'H' /* launcherTitleID_Lo */
};
static const u8 HWINFO_S_K00A317_US[HWINFO_S_BODY_SIZE] =
{
0x26, 0x00, 0x00, 0x00, /* validLanguageBitmap */
0x00, 0x00, 0x00, 0x00, /* flags, rsv */
0x01, /* region */
'T', 'N', '5', '6', '3', '2', '0', '4',
'0', '2', '0', 0x00, 0x00, 'K', 0x00, /* serialNo */
'E', 'A', 'N', 'H' /* launcherTitleID_Lo */
};
static const u8 HWINFO_S_K00A317_EU[HWINFO_S_BODY_SIZE] =
{
0x3E, 0x00, 0x00, 0x00, /* validLanguageBitmap */
0x00, 0x00, 0x00, 0x00, /* flags, rsv */
0x02, /* region */
'T', 'E', 'N', '5', '6', '3', '2', '0',
'4', '0', '2', '0', 0x00, 'K', 0x00, /* serialNo */
'P', 'A', 'N', 'H' /* launcherTitleID_Lo */
};
static const u8 HWINFO_S_K00A317_AU[HWINFO_S_BODY_SIZE] =
{
0x02, 0x00, 0x00, 0x00, /* validLanguageBitmap */
0x00, 0x00, 0x00, 0x00, /* flags, rsv */
0x03, /* region */
'T', 'A', 'N', '5', '6', '3', '2', '0',
'4', '0', '2', '0', 0x00, 'K', 0x00, /* serialNo */
'U', 'A', 'N', 'H' /* launcherTitleID_Lo */
};
/*----------------------------------------------------------------------------*/
static const u8 HWINFO_S_K00A319_JP[HWINFO_S_BODY_SIZE] =
{
0x01, 0x00, 0x00, 0x00, /* validLanguageBitmap */
0x00, 0x00, 0x00, 0x00, /* flags, rsv */
0x00, /* region */
'T', 'J', 'N', '3', '5', '3', '8', '9',
'0', '3', '3', '4', 0x00, 'K', 0x00, /* serialNo */
'J', 'A', 'N', 'H' /* launcherTitleID_Lo */
};
static const u8 HWINFO_S_K00A319_US[HWINFO_S_BODY_SIZE] =
{
0x26, 0x00, 0x00, 0x00, /* validLanguageBitmap */
0x00, 0x00, 0x00, 0x00, /* flags, rsv */
0x01, /* region */
'T', 'N', '3', '5', '3', '8', '9', '0',
'3', '3', '4', 0x00, 0x00, 'K', 0x00, /* serialNo */
'E', 'A', 'N', 'H' /* launcherTitleID_Lo */
};
static const u8 HWINFO_S_K00A319_EU[HWINFO_S_BODY_SIZE] =
{
0x3E, 0x00, 0x00, 0x00, /* validLanguageBitmap */
0x00, 0x00, 0x00, 0x00, /* flags, rsv */
0x02, /* region */
'T', 'E', 'N', '3', '5', '3', '8', '9',
'0', '3', '3', '4', 0x00, 'K', 0x00, /* serialNo */
'P', 'A', 'N', 'H' /* launcherTitleID_Lo */
};
static const u8 HWINFO_S_K00A319_AU[HWINFO_S_BODY_SIZE] =
{
0x02, 0x00, 0x00, 0x00, /* validLanguageBitmap */
0x00, 0x00, 0x00, 0x00, /* flags, rsv */
0x03, /* region */
'T', 'A', 'N', '3', '5', '3', '8', '9',
'0', '3', '3', '4', 0x00, 'K', 0x00, /* serialNo */
'U', 'A', 'N', 'H' /* launcherTitleID_Lo */
};
//================================================================================
static void CalcHWSecureInfoHMAC( void *pDstHMAC, const void* body, u64 fuseID )
{
u8 key[SVC_SHA1_DIGEST_SIZE];
int i;
SVC_CalcSHA1(key, &fuseID, sizeof(u64));
SVC_CalcHMACSHA1( pDstHMAC, body, HWINFO_S_BODY_SIZE, key, SVC_SHA1_DIGEST_SIZE);
OS_TPrintf( "key : " );
for( i = 0; i < SVC_SHA1_DIGEST_SIZE; i++ ) {
OS_TPrintf( "%02x", key[ i ] );
}
OS_TPrintf( "\n" );
OS_TPrintf( "hmac: " );
for( i = 0; i < SVC_SHA1_DIGEST_SIZE; i++ ) {
OS_TPrintf( "%02x", ((u8 *)pDstHMAC)[ i ] );
}
OS_TPrintf( "\n" );
return;
}
// 署名算出BERエンコードなし
static BOOL CalcSignature( void *pDstSign, const void *pSrc, u32 len, const u8 *pPrivKeyDER, u32 keyFileLen, u32 keyLen )
{
CRYPTORSASignContext context;
CRYPTORSASignInitParam initParam;
CRYPTORSASignParam param;
int result_len;
initParam.key = (void*)pPrivKeyDER;
initParam.key_len = keyFileLen;
if( CRYPTO_RSA_SignInit(&context, &initParam) != 0 ) {
return FALSE;
}
param.in = (void *)pSrc;
param.in_len = len;
param.out = pDstSign;
param.out_size = keyLen;
result_len = CRYPTO_RSA_Sign_custom(&context, &param);
if( result_len != keyLen ) {
return FALSE;
}
return CRYPTO_RSA_SignTerminate(&context) == 0 ? TRUE : FALSE;
}
static BOOL LCFGi_THW_WriteSecureInfoCustom( char *pPath, const LCFGTWLHWSecureInfo *pSrcInfo, u64 fuseID, const u8 *pPrivKeyDER, u32 keyFileLen )
{
TSFHeader header;
// ヘッダ初期化
MI_CpuClear8( &header, sizeof(TSFHeader) );
header.version = LCFG_TWL_HWINFO_SECURE_VERSION;
header.bodyLength = sizeof( LCFGTWLHWSecureInfo );
// ヘッダ署名算出
{
u8 hmac_sha1[ SVC_SHA1_DIGEST_SIZE ];
CalcHWSecureInfoHMAC( hmac_sha1, pSrcInfo, fuseID );
if( !CalcSignature( (void *)header.digest.rsa, hmac_sha1, SVC_SHA1_DIGEST_SIZE, pPrivKeyDER, keyFileLen, RSA_KEY_LENGTH_1024 ) ) {
return FALSE;
}
}
// ファイル生成
(void)FS_CreateFileAuto( pPath, FS_PERMIT_R | FS_PERMIT_W );
{
#define HWINFO_FILE_LEN ( 16 * 1024 )
FSFile file[1];
char *pBuffer = OS_Alloc( HWINFO_FILE_LEN );
if( !FS_OpenFileEx( file, pPath, FS_FILEMODE_RW ) ) {
return FALSE;
}
if( FS_SetFileLength( file, HWINFO_FILE_LEN ) != FS_RESULT_SUCCESS ) {
(void)FS_CloseFile( file );
return FALSE;
}
if( pBuffer ) {
MI_CpuFillFast( pBuffer, 0xffffffff, HWINFO_FILE_LEN );
(void)FS_WriteFile( file, pBuffer, HWINFO_FILE_LEN );
}
(void)FS_CloseFile( file );
}
// ライト
if( !LCFGi_TSF_WriteFile( pPath, &header, (const void *)pSrcInfo, NULL ) ) {
return FALSE;
}
return TRUE;
}
// 秘密鍵のリード
static BOOL ReadPrivateKey( void *pBuffer, u32 *pKeyFileLen, char *pPath )
{
BOOL retval = TRUE;
FSFile file;
FS_InitFile( &file );
if( !FS_OpenFileEx( &file, pPath, FS_FILEMODE_R ) )
{
OS_TPrintf( "PrivateKey read failed.\n" );
retval = FALSE;
}else {
*pKeyFileLen = FS_GetFileLength( &file );
if( *pKeyFileLen > 0 ) {
if( FS_ReadFile( &file, pBuffer, (s32)*pKeyFileLen ) == *pKeyFileLen ) {
OS_TPrintf( "PrivateKey read succeeded.\n" );
}else {
OS_TPrintf( "PrivateKey read failed.\n" );
retval = FALSE;
}
}
FS_CloseFile( &file );
}
return retval;
}
/*---------------------------------------------------------------------------*
Name: InitAllocSystem
Description: OS_Alloc 使
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitAllocSystem()
{
void* newArenaLo;
OSHeapHandle hHeap;
// メインアリーナのアロケートシステムを初期化
newArenaLo = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1);
OS_SetMainArenaLo(newArenaLo);
// メインアリーナ上にヒープを作成
hHeap = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi());
OS_SetCurrentHeap(OS_ARENA_MAIN, hHeap);
}
extern u64 g_HWInfoFuseROM;
extern char *g_pHwInfoPath;
/*---------------------------------------------------------------------------*
Name: TwlMain
Description: main
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void TwlMain(void)
{
BOOL retval;
u32 keyLen;
OS_Init();
InitAllocSystem();
(void)OS_SetIrqMask(0);
(void)OS_EnableIrq();
(void)OS_EnableInterrupts();
(void)OS_EnableIrqMask(OS_IE_SPFIFO_RECV);
FS_Init( FS_DMA_NOT_USE );
CRYPTO_SetMemAllocator( OS_AllocFromMain, OS_FreeToMain, NULL );
OS_TPrintf("---- HMAC over HWInfo_S for PROD boards @ BroadOn ----\n");
if( !ReadPrivateKey( s_privKey, &keyLen, HWINFO_PRIVKEY_PATH ) ) {
OS_TPrintf("PrivateKey read failed.\n");
}else {
OS_TPrintf("TS-Board: K00A317\n");
retval = LCFGi_THW_WriteSecureInfoCustom( PATH_K00A317_JP, (const LCFGTWLHWSecureInfo *)HWINFO_S_K00A317_JP, FuseID_K00A317, s_privKey, keyLen );
OS_TPrintf(" JP: %s\n", retval ? "succeeded" : "failed" );
retval = LCFGi_THW_WriteSecureInfoCustom( PATH_K00A317_US, (const LCFGTWLHWSecureInfo *)HWINFO_S_K00A317_US, FuseID_K00A317, s_privKey, keyLen );
OS_TPrintf(" US: %s\n", retval ? "succeeded" : "failed" );
retval = LCFGi_THW_WriteSecureInfoCustom( PATH_K00A317_EU, (const LCFGTWLHWSecureInfo *)HWINFO_S_K00A317_EU, FuseID_K00A317, s_privKey, keyLen );
OS_TPrintf(" EU: %s\n", retval ? "succeeded" : "failed" );
retval = LCFGi_THW_WriteSecureInfoCustom( PATH_K00A317_AU, (const LCFGTWLHWSecureInfo *)HWINFO_S_K00A317_AU, FuseID_K00A317, s_privKey, keyLen );
OS_TPrintf(" AU: %s\n", retval ? "succeeded" : "failed" );
OS_TPrintf("TS-Board: K00A319\n");
retval = LCFGi_THW_WriteSecureInfoCustom( PATH_K00A319_JP, (const LCFGTWLHWSecureInfo *)HWINFO_S_K00A319_JP, FuseID_K00A319, s_privKey, keyLen );
OS_TPrintf(" JP: %s\n", retval ? "succeeded" : "failed" );
retval = LCFGi_THW_WriteSecureInfoCustom( PATH_K00A319_US, (const LCFGTWLHWSecureInfo *)HWINFO_S_K00A319_US, FuseID_K00A319, s_privKey, keyLen );
OS_TPrintf(" US: %s\n", retval ? "succeeded" : "failed" );
retval = LCFGi_THW_WriteSecureInfoCustom( PATH_K00A319_EU, (const LCFGTWLHWSecureInfo *)HWINFO_S_K00A319_EU, FuseID_K00A319, s_privKey, keyLen );
OS_TPrintf(" EU: %s\n", retval ? "succeeded" : "failed" );
retval = LCFGi_THW_WriteSecureInfoCustom( PATH_K00A319_AU, (const LCFGTWLHWSecureInfo *)HWINFO_S_K00A319_AU, FuseID_K00A319, s_privKey, keyLen );
OS_TPrintf(" AU: %s\n", retval ? "succeeded" : "failed" );
}
#if 0
OS_TPrintf("---- Verify phase ----\n");
{
OS_TPrintf("TS-Board: K00A317\n");
g_HWInfoFuseROM = FuseID_K00A317;
g_pHwInfoPath = PATH_K00A317_JP;
retval = LCFG_ReadHWSecureInfo();
OS_TPrintf(" JP: %s\n", retval ? "succeeded" : "failed" );
g_pHwInfoPath = PATH_K00A317_US;
retval = LCFG_ReadHWSecureInfo();
OS_TPrintf(" US: %s\n", retval ? "succeeded" : "failed" );
g_pHwInfoPath = PATH_K00A317_EU;
retval = LCFG_ReadHWSecureInfo();
OS_TPrintf(" EU: %s\n", retval ? "succeeded" : "failed" );
g_pHwInfoPath = PATH_K00A317_AU;
retval = LCFG_ReadHWSecureInfo();
OS_TPrintf(" AU: %s\n", retval ? "succeeded" : "failed" );
OS_TPrintf("TS-Board: K00A319\n");
g_HWInfoFuseROM = FuseID_K00A319;
g_pHwInfoPath = PATH_K00A319_JP;
retval = LCFG_ReadHWSecureInfo();
OS_TPrintf(" JP: %s\n", retval ? "succeeded" : "failed" );
g_pHwInfoPath = PATH_K00A319_US;
retval = LCFG_ReadHWSecureInfo();
OS_TPrintf(" US: %s\n", retval ? "succeeded" : "failed" );
g_pHwInfoPath = PATH_K00A319_EU;
retval = LCFG_ReadHWSecureInfo();
OS_TPrintf(" EU: %s\n", retval ? "succeeded" : "failed" );
g_pHwInfoPath = PATH_K00A319_AU;
retval = LCFG_ReadHWSecureInfo();
OS_TPrintf(" AU: %s\n", retval ? "succeeded" : "failed" );
}
#endif
OS_Terminate();
}

View File

@ -1,32 +0,0 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlIPL - tests - CheckCardAccess
# 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$
#----------------------------------------------------------------------------
SUBDIRS =
SUBMAKES = Makefile.off Makefile.normal Makefile.game
include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/commondefs
#----------------------------------------------------------------------------
do-build : $(TARGETS)
include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules
#----------------------------------------------------------------------------
#===== End of Makefile =====

View File

@ -1,47 +0,0 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlIPL - tests - CheckCardAccess
# File: Makefile.game
#
# 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$
#----------------------------------------------------------------------------
TWL_NANDAPP = TRUE
#----------------------------------------------------------------------------
TARGET_PLATFORM := TWL
TARGET_NAME = finalize_check_game
BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME)
TARGET_BIN = $(TARGET_NAME).tad
SRCS = ./src/main.c ./src/font.c
MACRO_FLAGS += -DMY_TARGET_NAME=\"$(basename $(TARGET_BIN))\"
#-------------------------
ROM_SPEC = game_mode.rsf
include $(TWLSDK_ROOT)/build/buildtools/commondefs
include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib
#----------------------------------------------------------------------------
.PHONY: build_time
do-build: $(TARGETS)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -1,47 +0,0 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlIPL - tests - CheckCardAccess
# File: Makefile.normal
#
# 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$
#----------------------------------------------------------------------------
TWL_NANDAPP = TRUE
#----------------------------------------------------------------------------
TARGET_PLATFORM := TWL
TARGET_NAME = finalize_check_normal
BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME)
TARGET_BIN = $(TARGET_NAME).tad
SRCS = ./src/main.c ./src/font.c
MACRO_FLAGS += -DMY_TARGET_NAME=\"$(basename $(TARGET_BIN))\"
#-------------------------
ROM_SPEC = normal_mode.rsf
include $(TWLSDK_ROOT)/build/buildtools/commondefs
include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib
#----------------------------------------------------------------------------
.PHONY: build_time
do-build: $(TARGETS)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -1,47 +0,0 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlIPL - tests - CheckCardAccess
# File: Makefile.off
#
# 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$
#----------------------------------------------------------------------------
TWL_NANDAPP = TRUE
#----------------------------------------------------------------------------
TARGET_PLATFORM := TWL
TARGET_NAME = finalize_check_slotpoweroff
BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME)
TARGET_BIN = $(TARGET_NAME).tad
SRCS = ./src/main.c ./src/font.c
MACRO_FLAGS += -DMY_TARGET_NAME=\"$(basename $(TARGET_BIN))\"
#-------------------------
ROM_SPEC = slot_power_off.rsf
include $(TWLSDK_ROOT)/build/buildtools/commondefs
include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib
#----------------------------------------------------------------------------
.PHONY: build_time
do-build: $(TARGETS)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -1,243 +0,0 @@
#----------------------------------------------------------------------------
# Project: TwlSDK - include
# File: ROM-TS.rsf
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded insructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Date:: $
# $Rev$
# $Author$
#----------------------------------------------------------------------------
#
# TWL ROM SPEC FILE
#
Arm9
{
Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)"
OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)"
OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)"
Elf "$(MAKEROM_ARM9:r).tef"
}
Arm7
{
Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)"
OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)"
OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)"
Elf "$(MAKEROM_ARM7_BASE:r).tef"
}
Arm9.Ltd
{
Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)"
OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)"
OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)"
}
Arm7.Ltd
{
Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)"
OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)"
OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)"
}
Property
{
###
### Settings for FinalROM
###
#### BEGIN
#
# TITLE NAME: Your product name within 12bytes
#
#TitleName "MY APP NAME"
#
# MAKER CODE: Your company ID# in 2 ascii words
# issued by NINTENDO
#
#MakerCode 01
#
# REMASTER VERSION: Mastering version
#
#RomVersion 0
#
# ROM SPEED TYPE: [MROM/1TROM/UNDEFINED]
#
RomSpeedType $(MAKEROM_ROMSPEED)
#
# ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G]
#
#RomSize 256M
#
# ROM PADDING: TRUE if finalrom
#
#RomFootPadding TRUE
#
# ROM HEADER TEMPLATE: Provided to every product by NINTENDO
#
# RomHeaderTemplate ../rh/0C5A/rom_header_0c5a.template.sbin
#
# BANNER FILE: generated from Banner Spec File
#
# BannerFile "banner_LTD/banner.bnr"
#
# Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE]
#
#PermitLandingNormalJump FALSE
#
# Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE]
#
#PermitLandingTmpJump FALSE
###
### Setting for TWL
###
#
# ROM HEADER Ltd: Provided to every product by NINTENDO
#
RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin
#
# Digest parameters:
#
DigestParam 1024 32
#
# WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD
# MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD]
# don't have to edit
#
WramMapping $(MAKEROM_WRAM_MAPPING)
#
# CardRegion: card region [Japan/America/Europe/Australia/China/Korea]
#
CardRegion ALL
#
# Codec mode:
# don't have to edit
#
CodecMode $(MAKEROM_CODEC_MODE)
#
# Disp WiFiConnection Icon for Launcher [TRUE/FALSE]
#
#WiFiConnectionIcon FALSE
#
# Disp DSWireless Icon for Launcher [TRUE/FALSE]
#
#DSWirelessIcon FALSE
#
# Agree EULA [TRUE/FALSE]
#
#AgreeEULA FALSE
#
# Agree EULA version [1 - 255]
#
#AgreeEULAVersion 1
###
#### END
}
AppendProperty
{
#
# Boot allowed Media: [GameCard]
#
Media NAND
#
# GameCode for TitleID : Your GameCode in 4 ascii words
#
#GameCode 4CDA
#
# Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M]
#
#PublicSaveDataSize 0K
#
# Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M]
#
#PrivateSaveDataSize 0K
#
# Enable SubBannerFile
#SubBannerFile TRUE
#
# Game card power on: [TRUE/FALSE]
#
#GameCardOn FALSE
#
# Game card transferd to nitro mode: [TRUE/FALSE]
#
GameCardNitroMode TRUE
}
RomSpec
{
Offset 0x00000000
Segment ALL
HostRoot $(MAKEROM_ROMROOT)
Root /
File $(MAKEROM_ROMFILES)
}
Rating
{
#
# Permited age to play for each rating organization
#
# Supported organization
# - CERO (OGN0) : for Japan
# - ESRB (OGN1) : for North America
# - BBFC (OGN2) : obsolete organization
# - USK (OGN3) : for German
# - PEGI_GEN (OGN4) : for Europe
# - PEGI_FINLAND (OGN5) : obsolete organization
# - PEGI_PRT (OGN6) : for Portugal
# - PEGI_BBFC (OGN7) : for UK
# - OFLC (OGN8) : for Australia and NewZealand
# - GRB (OGN9) : for Korea
# - OGN10 : reserved
# - OGN11 : reserved
# - OGN12 : reserved
# - OGN13 : reserved
# - OGN14 : reserved
# - OGN15 : reserved
#
# Available age [ 0 - 31 / PENDING / FREE ]
CERO FREE
# ESRB FREE
# USK FREE
# PEGI_GEN FREE
# PEGI_PRT FREE
# PEGI_BBFC FREE
# OFLC FREE
# GRB FREE
}

View File

@ -1,243 +0,0 @@
#----------------------------------------------------------------------------
# Project: TwlSDK - include
# File: ROM-TS.rsf
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded insructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Date:: $
# $Rev$
# $Author$
#----------------------------------------------------------------------------
#
# TWL ROM SPEC FILE
#
Arm9
{
Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)"
OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)"
OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)"
Elf "$(MAKEROM_ARM9:r).tef"
}
Arm7
{
Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)"
OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)"
OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)"
Elf "$(MAKEROM_ARM7_BASE:r).tef"
}
Arm9.Ltd
{
Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)"
OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)"
OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)"
}
Arm7.Ltd
{
Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)"
OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)"
OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)"
}
Property
{
###
### Settings for FinalROM
###
#### BEGIN
#
# TITLE NAME: Your product name within 12bytes
#
#TitleName "MY APP NAME"
#
# MAKER CODE: Your company ID# in 2 ascii words
# issued by NINTENDO
#
#MakerCode 01
#
# REMASTER VERSION: Mastering version
#
#RomVersion 0
#
# ROM SPEED TYPE: [MROM/1TROM/UNDEFINED]
#
RomSpeedType $(MAKEROM_ROMSPEED)
#
# ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G]
#
#RomSize 256M
#
# ROM PADDING: TRUE if finalrom
#
#RomFootPadding TRUE
#
# ROM HEADER TEMPLATE: Provided to every product by NINTENDO
#
# RomHeaderTemplate ../rh/0C4A/rom_header_0c4a.template.sbin
#
# BANNER FILE: generated from Banner Spec File
#
# BannerFile "banner_LTD/banner.bnr"
#
# Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE]
#
#PermitLandingNormalJump FALSE
#
# Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE]
#
#PermitLandingTmpJump FALSE
###
### Setting for TWL
###
#
# ROM HEADER Ltd: Provided to every product by NINTENDO
#
RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin
#
# Digest parameters:
#
DigestParam 1024 32
#
# WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD
# MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD]
# don't have to edit
#
WramMapping $(MAKEROM_WRAM_MAPPING)
#
# CardRegion: card region [Japan/America/Europe/Australia/China/Korea]
#
CardRegion ALL
#
# Codec mode:
# don't have to edit
#
CodecMode $(MAKEROM_CODEC_MODE)
#
# Disp WiFiConnection Icon for Launcher [TRUE/FALSE]
#
#WiFiConnectionIcon FALSE
#
# Disp DSWireless Icon for Launcher [TRUE/FALSE]
#
#DSWirelessIcon FALSE
#
# Agree EULA [TRUE/FALSE]
#
#AgreeEULA FALSE
#
# Agree EULA version [1 - 255]
#
#AgreeEULAVersion 1
###
#### END
}
AppendProperty
{
#
# Boot allowed Media: [GameCard]
#
Media NAND
#
# GameCode for TitleID : Your GameCode in 4 ascii words
#
#GameCode 4CDA
#
# Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M]
#
#PublicSaveDataSize 0K
#
# Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M]
#
#PrivateSaveDataSize 0K
#
# Enable SubBannerFile
#SubBannerFile TRUE
#
# Game card power on: [TRUE/FALSE]
#
GameCardOn TRUE
#
# Game card transferd to nitro mode: [TRUE/FALSE]
#
#GameCardNitroMode FALSE
}
RomSpec
{
Offset 0x00000000
Segment ALL
HostRoot $(MAKEROM_ROMROOT)
Root /
File $(MAKEROM_ROMFILES)
}
Rating
{
#
# Permited age to play for each rating organization
#
# Supported organization
# - CERO (OGN0) : for Japan
# - ESRB (OGN1) : for North America
# - BBFC (OGN2) : obsolete organization
# - USK (OGN3) : for German
# - PEGI_GEN (OGN4) : for Europe
# - PEGI_FINLAND (OGN5) : obsolete organization
# - PEGI_PRT (OGN6) : for Portugal
# - PEGI_BBFC (OGN7) : for UK
# - OFLC (OGN8) : for Australia and NewZealand
# - GRB (OGN9) : for Korea
# - OGN10 : reserved
# - OGN11 : reserved
# - OGN12 : reserved
# - OGN13 : reserved
# - OGN14 : reserved
# - OGN15 : reserved
#
# Available age [ 0 - 31 / PENDING / FREE ]
CERO FREE
# ESRB FREE
# USK FREE
# PEGI_GEN FREE
# PEGI_PRT FREE
# PEGI_BBFC FREE
# OFLC FREE
# GRB FREE
}

View File

@ -1,243 +0,0 @@
#----------------------------------------------------------------------------
# Project: TwlSDK - include
# File: ROM-TS.rsf
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded insructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Date:: $
# $Rev$
# $Author$
#----------------------------------------------------------------------------
#
# TWL ROM SPEC FILE
#
Arm9
{
Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)"
OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)"
OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)"
Elf "$(MAKEROM_ARM9:r).tef"
}
Arm7
{
Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)"
OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)"
OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)"
Elf "$(MAKEROM_ARM7_BASE:r).tef"
}
Arm9.Ltd
{
Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)"
OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)"
OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)"
}
Arm7.Ltd
{
Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)"
OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)"
OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)"
}
Property
{
###
### Settings for FinalROM
###
#### BEGIN
#
# TITLE NAME: Your product name within 12bytes
#
#TitleName "MY APP NAME"
#
# MAKER CODE: Your company ID# in 2 ascii words
# issued by NINTENDO
#
#MakerCode 01
#
# REMASTER VERSION: Mastering version
#
#RomVersion 0
#
# ROM SPEED TYPE: [MROM/1TROM/UNDEFINED]
#
RomSpeedType $(MAKEROM_ROMSPEED)
#
# ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G]
#
#RomSize 256M
#
# ROM PADDING: TRUE if finalrom
#
#RomFootPadding TRUE
#
# ROM HEADER TEMPLATE: Provided to every product by NINTENDO
#
# RomHeaderTemplate ../rh/0C3A/rom_header_0c3a.template.sbin
#
# BANNER FILE: generated from Banner Spec File
#
# BannerFile "banner_LTD/banner.bnr"
#
# Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE]
#
#PermitLandingNormalJump FALSE
#
# Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE]
#
#PermitLandingTmpJump FALSE
###
### Setting for TWL
###
#
# ROM HEADER Ltd: Provided to every product by NINTENDO
#
RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin
#
# Digest parameters:
#
DigestParam 1024 32
#
# WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD
# MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD]
# don't have to edit
#
WramMapping $(MAKEROM_WRAM_MAPPING)
#
# CardRegion: card region [Japan/America/Europe/Australia/China/Korea]
#
CardRegion ALL
#
# Codec mode:
# don't have to edit
#
CodecMode $(MAKEROM_CODEC_MODE)
#
# Disp WiFiConnection Icon for Launcher [TRUE/FALSE]
#
#WiFiConnectionIcon FALSE
#
# Disp DSWireless Icon for Launcher [TRUE/FALSE]
#
#DSWirelessIcon FALSE
#
# Agree EULA [TRUE/FALSE]
#
#AgreeEULA FALSE
#
# Agree EULA version [1 - 255]
#
#AgreeEULAVersion 1
###
#### END
}
AppendProperty
{
#
# Boot allowed Media: [GameCard]
#
Media NAND
#
# GameCode for TitleID : Your GameCode in 4 ascii words
#
#GameCode 4CDA
#
# Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M]
#
#PublicSaveDataSize 0K
#
# Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M]
#
#PrivateSaveDataSize 0K
#
# Enable SubBannerFile
#SubBannerFile TRUE
#
# Game card power on: [TRUE/FALSE]
#
#GameCardOn FALSE
#
# Game card transferd to nitro mode: [TRUE/FALSE]
#
#GameCardNitroMode FALSE
}
RomSpec
{
Offset 0x00000000
Segment ALL
HostRoot $(MAKEROM_ROMROOT)
Root /
File $(MAKEROM_ROMFILES)
}
Rating
{
#
# Permited age to play for each rating organization
#
# Supported organization
# - CERO (OGN0) : for Japan
# - ESRB (OGN1) : for North America
# - BBFC (OGN2) : obsolete organization
# - USK (OGN3) : for German
# - PEGI_GEN (OGN4) : for Europe
# - PEGI_FINLAND (OGN5) : obsolete organization
# - PEGI_PRT (OGN6) : for Portugal
# - PEGI_BBFC (OGN7) : for UK
# - OFLC (OGN8) : for Australia and NewZealand
# - GRB (OGN9) : for Korea
# - OGN10 : reserved
# - OGN11 : reserved
# - OGN12 : reserved
# - OGN13 : reserved
# - OGN14 : reserved
# - OGN15 : reserved
#
# Available age [ 0 - 31 / PENDING / FREE ]
CERO FREE
# ESRB FREE
# USK FREE
# PEGI_GEN FREE
# PEGI_PRT FREE
# PEGI_BBFC FREE
# OFLC FREE
# GRB FREE
}

View File

@ -1,579 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - demos.TWL - snd - extraFunc
File: 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 "font.h"
/*---------------------------------------------------------------------------*
Character data
*---------------------------------------------------------------------------*/
const u32 d_CharData[8 * 256] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h
0x00011010, 0x01100010, 0x00000010, 0x00000010,
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
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h
0x00101001, 0x01010001, 0x01010001, 0x00001100,
0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h
0x00010010, 0x00100001, 0x01000000, 0x00000000,
0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h
0x00100001, 0x00111001, 0x01100101, 0x00011001,
0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h
0x00010000, 0x00011100, 0x00110010, 0x00001100,
0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h
0x00111110, 0x01100101, 0x00100101, 0x00010010,
0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h
0x00000110, 0x01000101, 0x01000101, 0x00111110,
0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h
0x01010010, 0x01010101, 0x01001101, 0x00100110,
0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h
0x00011111, 0x01000010, 0x01000010, 0x00111100,
0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h
0x01000010, 0x00100100, 0x00000100, 0x00000100,
0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h
0x01001001, 0x01001001, 0x00111000, 0x00000100,
0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah
0x00001000, 0x00011110, 0x00101001, 0x00000110,
0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh
0x00111010, 0x01000110, 0x01000000, 0x00111000,
0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech
0x01000110, 0x01000000, 0x00100000, 0x00011000,
0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh
0x01000011, 0x01001100, 0x01010010, 0x00111100,
0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh
0x00100110, 0x00100010, 0x00100011, 0x01000010,
0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh
0x01000011, 0x01000000, 0x01000010, 0x00111100,
0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h
0x01000010, 0x01000011, 0x01000010, 0x00110010,
0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h
0x01000110, 0x01000101, 0x01000101, 0x00111001,
0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h
0x00100100, 0x00100100, 0x00100010, 0x00010001,
0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h
0x00111111, 0x00001000, 0x00001000, 0x00001000,
0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h
0x00100001, 0x00100000, 0x00010000, 0x00001100,
0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h
0x00100001, 0x00100000, 0x00010000, 0x00001100,
0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h
0x00100000, 0x00100000, 0x00100000, 0x00111111,
0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h
0x00010010, 0x00010000, 0x00010000, 0x00001100,
0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h
0x00100100, 0x00010000, 0x00001000, 0x00000111,
0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h
0x00001000, 0x00001100, 0x00010010, 0x00100001,
0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah
0x00010010, 0x00000010, 0x00000010, 0x00111100,
0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh
0x00100000, 0x00010000, 0x00001000, 0x00000110,
0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch
0x00111001, 0x00100000, 0x00010000, 0x00001100,
0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh
0x01111111, 0x00010000, 0x00010000, 0x00001100,
0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh
0x00100000, 0x00010000, 0x00001000, 0x00000111,
0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh
0x00001000, 0x00001000, 0x00001000, 0x00000110
};
/*---------------------------------------------------------------------------*
Palette data
*---------------------------------------------------------------------------*/
const u32 d_PaletteData[8 * 16] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000, // black
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white
0x00000000, 0x00000000, 0x00000000, 0x00000000
};
/*---------------------------------------------------------------------------*
End of file
*---------------------------------------------------------------------------*/

View File

@ -1,36 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - demos.TWL - snd - extraFunc
File: 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 FONT_H_
#define FONT_H_
#ifdef __cplusplus
extern "C" {
#endif
/*===========================================================================*/
#include <twl/types.h>
extern const u32 d_CharData[8 * 256];
extern const u32 d_PaletteData[8 * 16];
/*===========================================================================*/
#ifdef __cplusplus
} // extern "C"
#endif
#endif // FONT_H_

View File

@ -1,134 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL - HOTSW - include
File: type.h
Copyright 2007-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.
*---------------------------------------------------------------------------*/
#ifndef __HOTSW_TYPES_H__
#define __HOTSW_TYPES_H__
#include <twl.h>
#include <twl/os/common/format_rom.h>
#include "romSpec.h"
#ifdef __cplusplus
extern "C" {
#endif
static inline void HOTSW_WaitCardCtrl(void)
{
while( reg_MI_MCCNT1_A & REG_MI_MCCNT1_START_MASK ){}
}
// Define -------------------------------------------------------------------
// --- Boot Segment
#define BOOT_SEGMENT_SIZE 0x1000
// --- Secure Segment
#define SECURE_SEGMENT_START 0x4000
#define SECURE_SEGMENT_SIZE 0x4000
#define SECURE_SEGMENT_END (SECURE_SEGMENT_START + SECURE_SEGMENT_SIZE)
// --- TWL Card
#define TWLCARD_BORDER_OFFSET 0x80000
// --- Page / Segment (Byte)
#define PAGE_SIZE 0x200
#define ONE_SEGMENT_SIZE 0x1000
// --- Page / Segment (Word)
#define PAGE_WORD_SIZE 0x80
#define ONE_SEGMENT_WORD_SIZE 0x400
// --- Rom Emulation
#define ROM_EMULATION_DATA_SIZE 0x20
// --- Thread
#define HOTSW_THREAD_STACK_SIZE (1024 * 2)
#define HOTSW_DMA_MSG_NUM 8
#define HOTSW_INSERT_MSG_NUM 16
#define HOTSW_PULLED_MSG_NUM 16
#define HOTSW_CTRL_MSG_NUM 8
#define HOTSW_MSG_BUFFER_NUM (HOTSW_INSERT_MSG_NUM + HOTSW_PULLED_MSG_NUM + HOTSW_CTRL_MSG_NUM)
#define HOTSW_POLLING_CTRL_BUFFER_NUM 4
// --- Card Control Reg 0
#define HOTSW_E2PROM_CTRL_MASK 0x00ff
// --- Card Control Reg 1
#define START_FLG_MASK 0x80000000
#define READY_FLG_MASK 0x00800000
#define LATENCY1_SHIFT 0
#define LATENCY1_MASK 0x00001fff
#define DS_SHIFT 13
#define DS_MASK 0x00002000
#define SE_SHIFT 14
#define SE_MASK 0x00004000
#define SCR_SHIFT 15
#define SCR_MASK 0x00008000
#define LATENCY2_SHIFT 16
#define LATENCY2_MASK 0x003f0000
#define CS_SHIFT 22
#define CS_MASK 0x00400000
#define RDY_SHIFT 23
#define RDY_MASK 0x00800000
#define PC_SHIFT 24
#define PC_MASK 0x07000000
#define CT_SHIFT 27
#define CT_MASK 0x08000000
#define TRM_SHIFT 28
#define TRM_MASK 0x10000000
#define RESB_SHIFT 29
#define RESB_MASK 0x20000000
#define WR_SHIFT 30
#define WR_MASK 0x40000000
#define START_SHIFT 31
#define START_MASK 0x80000000
#define SCRAMBLE_MASK 0x1040e000 // スクランブル関係のフラグマスク
#define SECURE_COMMAND_SCRAMBLE_MASK 0x00406000 // CS SE DSのマスク
// --- Page Count
#define PAGE_0 0x0UL << PC_SHIFT
#define PAGE_1 0x1UL << PC_SHIFT
#define PAGE_2 0x2UL << PC_SHIFT
#define PAGE_4 0x3UL << PC_SHIFT
#define PAGE_8 0x4UL << PC_SHIFT
#define PAGE_16 0x5UL << PC_SHIFT
#define PAGE_32 0x6UL << PC_SHIFT
#define PAGE_STAT 0x7UL << PC_SHIFT
// union ---------------------------------------------------------------------
typedef union
{
u64 dw;
u8 b[8];
} Cmd64;
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif // __HOTSW_TYPES_H__

View File

@ -1,768 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - demos - CARD - hotswDebug
File: main_finalize.c
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.
*---------------------------------------------------------------------------*/
#include <twl.h>
#include <twl/os/common/format_rom.h>
#include "DEMO.h"
#include "hotswTypes.h"
#include "font.h"
#define SDK_MAKERCODE '10'
#define DIGEST_HASH_BLOCK_SIZE_SHA1 (512/8)
#define MY_TEMP_BUFFER_SIZE 0x80000
#define GAME_FIELD_START_ADDRESS 0x8000
#define ONE_SEGMENT_PAGE_NUM 8
#define READY_MASK 0x00800000
#define CARD_COMMAND_MASK 0x07000000
#define MY_ROMHEADER_TWL ((ROM_Header_Short *)HW_TWL_CARD_ROM_HEADER_BUF)
#define MY_ROMHEADER_NTR ((ROM_Header_Short *)HW_CARD_ROM_HEADER)
#define MY_ROMHEADER_NAND ((ROM_Header_Short *)HW_TWL_ROM_HEADER_BUF)
// ---------------------------------------------------------------
// HMACSHA1の鍵
static u8 s_digestDefaultKey[ DIGEST_HASH_BLOCK_SIZE_SHA1 ] = {
0x21, 0x06, 0xc0, 0xde,
0xba, 0x98, 0xce, 0x3f,
0xa6, 0x92, 0xe3, 0x9d,
0x46, 0xf2, 0xed, 0x01,
0x76, 0xe3, 0xcc, 0x08,
0x56, 0x23, 0x63, 0xfa,
0xca, 0xd4, 0xec, 0xdf,
0x9a, 0x62, 0x78, 0x34,
0x8f, 0x6d, 0x63, 0x3c,
0xfe, 0x22, 0xca, 0x92,
0x20, 0x88, 0x97, 0x23,
0xd2, 0xcf, 0xae, 0xc2,
0x32, 0x67, 0x8d, 0xfe,
0xca, 0x83, 0x64, 0x98,
0xac, 0xfd, 0x3e, 0x37,
0x87, 0x46, 0x58, 0x24
};
static u32 rhBuf[BOOT_SEGMENT_SIZE/sizeof(u32)];
static u32 checkBuf[MY_TEMP_BUFFER_SIZE/sizeof(u32)];
static u16 card_lock_id;
static BOOL error, flxhash, ltdhash, romheader;
static BOOL isTwlApplication;
static BOOL isTwlCard;
static ROM_Header_Short *rh;
static u16 screen[32 * 32] ATTRIBUTE_ALIGN(HW_CACHE_LINE_SIZE);
// ---------------------------------------------------------------
static void CheckMirrorImage(void);
static int CompRomHeaderForNTR(void* buf);
static void CheckRomHeader(void);
static BOOL CheckHashValue(void* buf, u32 size, void* digest);
static void MY_LoadCard_arm7Static(void);
static void MY_LoadCard_arm7LtdStatic(void);
static void CheckBackupDevice(void);
static void ShowResult(void);
static void debugMessage(void);
static void ReadBootSegNormal(void* buf);
static void SetCommand(Cmd64 *cndLE);
static void ReadPageGame(u32 start_addr, void* buf, u32 size);
static void ReadCardData(void* dest, s32 offset, s32 length);
static void VBlankIntr (void);
static void PrintString (s16 x, s16 y, u8 palette, char *text, ...);
static void VolumeSwitchCallback(SNDEXResult result, void* arg);
/*---------------------------------------------------------------------------*
Name: NitroMain
Description: .
*---------------------------------------------------------------------------*/
void NitroMain(void)
{
CARDRomHeader *card_header = (void*)CARD_GetRomHeader();
OS_Init();
OS_InitTick();
CARD_Init();
GX_Init();
GX_DispOff();
GXS_DispOff();
if ( card_header->maker_code == SDK_MAKERCODE )
{
CARD_Enable(TRUE);
}
/* 表示設定初期化 */
GX_SetBankForLCDC(GX_VRAM_LCDC_ALL);
MI_CpuClearFast((void*)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE);
(void)GX_DisableBankForLCDC();
MI_CpuFillFast((void*)HW_OAM, GX_LCD_SIZE_Y, HW_OAM_SIZE);
MI_CpuClearFast((void*)HW_PLTT, HW_PLTT_SIZE);
MI_CpuFillFast((void*)HW_DB_OAM, GX_LCD_SIZE_Y, HW_DB_OAM_SIZE);
MI_CpuClearFast((void*)HW_DB_PLTT, HW_DB_PLTT_SIZE);
GX_SetBankForBG(GX_VRAM_BG_128_A);
G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256,
GX_BG_COLORMODE_16,
GX_BG_SCRBASE_0xf800, // SCR ベースブロック 31
GX_BG_CHARBASE_0x00000, // CHR ベースブロック 0
GX_BG_EXTPLTT_01);
G2_SetBG0Priority(0);
GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D);
GX_SetVisiblePlane(GX_PLANEMASK_BG0);
GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData));
GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData));
MI_CpuClearFast((void*)screen, sizeof(screen));
DC_FlushRange(screen, sizeof(screen));
GX_LoadBG0Scr(screen, 0, sizeof(screen));
/* 割込み設定 */
OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
(void)OS_EnableIrqMask(OS_IE_V_BLANK);
(void)GX_VBlankIntr(TRUE);
(void)OS_EnableIrq();
(void)OS_EnableInterrupts();
/* LCD 表示開始 */
GX_DispOn();
GXS_DispOn();
PrintString(0, 0, 0xc, "+++ Card Access Check +++");
// NANDアプリがHYBの場合
if(MY_ROMHEADER_NAND->platform_code == 0x02){
PrintString(0, 2, 0x5, "<HYBRID ver.>");
}
else if(MY_ROMHEADER_NAND->platform_code == 0x03){
PrintString(0, 2, 0x6, "<LIMITED ver.>");
}
// カードアプリタイプを判別。使うRom Header Buffer を切替える
if(MY_ROMHEADER_NTR->platform_code & PLATFORM_CODE_FLAG_TWL){
PrintString(0, 5, 0xf, "- TWL Application -");
isTwlApplication = TRUE;
rh = MY_ROMHEADER_TWL;
}
else{
PrintString(0, 5, 0xf, "- NTR Application -");
isTwlApplication = FALSE;
rh = MY_ROMHEADER_NTR;
}
// カードタイプの判別
isTwlCard = (*(vu32 *)(HW_BOOT_CHECK_INFO_BUF) & HOTSW_ROMID_TWLROM_MASK) ? TRUE : FALSE;
// 注rhの初期化が終わってから呼び出す
// debugMessage();
// フラグの初期化
error = FALSE;
flxhash = TRUE;
ltdhash = TRUE;
romheader = TRUE;
// ロックIDを取得しておく
card_lock_id = (u16)OS_GetLockID();
if(isTwlApplication){
MY_LoadCard_arm7Static();
MY_LoadCard_arm7LtdStatic();
}
else{
CheckMirrorImage();
}
CheckRomHeader();
CheckBackupDevice();
ShowResult();
while(1){
// DEMO_DrawFlip();
OS_WaitVBlankIntr();
}
}
/*---------------------------------------------------------------------------*
Name: CheckMirrorImage
Description:
Gameモード時 Gameコマンド OK
Normalコマンド All 1
Normalモード時 Gameコマンド All 1
Normalコマンド OK
SlotPowerOff時 Gameコマンド All 0
Normalコマンド All 0
*---------------------------------------------------------------------------*/
static void CheckMirrorImage(void)
{
u32 buf1[PAGE_SIZE/sizeof(u32)];
u32 buf2[PAGE_SIZE/sizeof(u32)];
u32 buf_ff[PAGE_SIZE/sizeof(u32)];
u32 buf_00[PAGE_SIZE/sizeof(u32)];
MI_CpuFill8( buf_ff, 0xff, sizeof(buf_ff) );
MI_CpuFill8( buf_00, 0x0, sizeof(buf_00) );
CARD_LockRom(card_lock_id);
// GameモードのコマンドでKey Table領域とGame領域読む
ReadCardData(buf1, (s32)0x1000, (s32)PAGE_SIZE);
ReadCardData(buf2, (s32)0x8000, (s32)PAGE_SIZE);
CARD_UnlockRom(card_lock_id);
// GameモードでKey Table領域からGame領域のイメージが読めてなかったら、不明なモード
if(MI_CpuComp8( buf1, buf2, PAGE_SIZE )){
error = TRUE;
PrintString(0, 7, 0x1, "Unknown Mode");
}
else{
// 同じデータでも ALL 1(GameMode時) or ALL 0(SlotPowerOff時)ならちゃんと読めてないので、Normalモード
if(!MI_CpuComp8( buf_ff, buf2, PAGE_SIZE ) || !MI_CpuComp8( buf_00, buf2, PAGE_SIZE )){
flxhash = FALSE;
ltdhash = FALSE;
PrintString(0, 7, 0x1, "Flx Area : Not Accessible");
}
// Key Table領域読んで、Game領域のイメージが出てたらGameモード
else{
flxhash = TRUE;
ltdhash = FALSE;
PrintString(0, 7, 0x8, "Flx Area : Accessible");
}
}
}
/*---------------------------------------------------------------------------*
Name: CheckRomHeader
Description:
*---------------------------------------------------------------------------*/
static void CheckRomHeader(void)
{
int result;
u8* pBuf = (u8 *)rhBuf;
u8* romHeader = (u8 *)rh;
CARD_LockRom(card_lock_id);
ReadBootSegNormal(pBuf);
CARD_UnlockRom(card_lock_id);
// 実際に読んだRom HeaderとIPLで読んだRom Headerを比較
if(isTwlApplication){
result = MI_CpuComp8( pBuf, romHeader, HW_TWL_CARD_ROM_HEADER_BUF_SIZE );
}
else{
result = CompRomHeaderForNTR(pBuf);
}
// 結果
if(result){
romheader = FALSE;
PrintString(0, 11, 0x1, "Boot Segment : Not Accessible");
}
else{
romheader = TRUE;
PrintString(0, 11, 0x8, "Boot Segment : Accessible");
}
// DEMO_DrawFlip();
OS_WaitVBlankIntr();
}
static int CompRomHeaderForNTR(void* buf){
u8* pBuf = (u8 *)buf;
u8* romHeader = (u8 *)rh;
u32 remainSize = HW_CARD_ROM_HEADER_SIZE;
while(remainSize){
// マスクRomコントロール情報が変わってるので、そこは飛ばす。
if((HW_CARD_ROM_HEADER_SIZE - remainSize) == 0x60){
pBuf += 4;
romHeader += 4;
remainSize -= 4;
}
if(*pBuf == *romHeader){
remainSize--;
}
else{
// OS_TPrintf("Error (adr:0x%08x)\n", HW_CARD_ROM_HEADER_SIZE - remainSize);
// OS_TPrintf("read : 0x%02x real : 0x%02x\n", *pBuf, *romHeader);
break;
}
pBuf++;
romHeader++;
}
return (int)remainSize;
}
/*---------------------------------------------------------------------------*
Name: CheckHashValue
Description:
*---------------------------------------------------------------------------*/
static BOOL CheckHashValue(void* buf, u32 size, void* digest)
{
u8 sha1data[DIGEST_SIZE_SHA1];
BOOL retval = TRUE;
// クリア
MI_CpuClear8(sha1data, sizeof(sha1data));
// ARM7常駐モジュールのHash値照合
SVC_CalcHMACSHA1( sha1data,
buf,
size,
s_digestDefaultKey,
sizeof(s_digestDefaultKey) );
return SVC_CompareSHA1( sha1data, digest );
}
/*---------------------------------------------------------------------------*
Name: MY_LoadCard_arm7Static
Description: ARM7常駐モジュール
*---------------------------------------------------------------------------*/
static void MY_LoadCard_arm7Static(void)
{
BOOL result;
u32* pBuf = checkBuf;
CARD_LockRom(card_lock_id);
ReadCardData(pBuf, (s32)rh->sub_rom_offset, (s32)rh->sub_size);
CARD_UnlockRom(card_lock_id);
result = CheckHashValue(checkBuf, rh->sub_size, (void *)rh->sub_static_digest);
if(result){
flxhash = TRUE;
PrintString(0, 7, 0x8, "Flx Area : Accessible");
}
else{
flxhash = FALSE;
PrintString(0, 7, 0x1, "Flx Area : Not Accessible");
}
// DEMO_DrawFlip();
OS_WaitVBlankIntr();
}
/*---------------------------------------------------------------------------*
Name: MY_LoadCard_arm7LtdStatic
Description: ARM7拡張常駐モジュール
*---------------------------------------------------------------------------*/
static void MY_LoadCard_arm7LtdStatic(void)
{
BOOL result;
u32* pBuf = checkBuf;
CARD_LockRom(card_lock_id);
ReadCardData(pBuf, (s32)rh->sub_ltd_rom_offset, (s32)rh->sub_ltd_size);
CARD_UnlockRom(card_lock_id);
result = CheckHashValue(checkBuf, rh->sub_ltd_size, (void *)rh->sub_ltd_static_digest);
if(result){
ltdhash = TRUE;
PrintString(0, 9, 0x8, "Ltd Area : Accessible");
}
else{
ltdhash = FALSE;
PrintString(0, 9, 0x1, "Ltd Area : Not Accessible");
}
// DEMO_DrawFlip();
OS_WaitVBlankIntr();
}
/*---------------------------------------------------------------------------*
Name: CheckBackupDevice
Description: Backup Device
EEPROM 512 kbのサブ基盤と使って検査する
*---------------------------------------------------------------------------*/
static void CheckBackupDevice(void)
{
BOOL identify;
static CARDResult last_result = CARD_RESULT_SUCCESS;
CARD_LockBackup(card_lock_id);
identify = CARD_IdentifyBackup(CARD_BACKUP_TYPE_EEPROM_512KBITS);
if (!identify)
{
PrintString(0, 13, 0x1, "Backup Device Identify Error...");
error = TRUE;
CARD_UnlockBackup(card_lock_id);
return;
}
{
u32 pos = 0;
static u8 tmp_buf[65536];
int i;
const u32 page_size = CARD_GetBackupPageSize();
const u32 total_size = CARD_GetBackupTotalSize();
for (i = 0; i < page_size; ++i)
{
tmp_buf[i] = (u8)(pos * 3 + i);
}
if (!CARD_IsBackupEeprom()){
PrintString(0, 13, 0x1, "Please Use EEPROM...");
error = TRUE;
return;
}
PrintString(0, 13, 0xf, "Backup Device Check Start...");
// DEMO_DrawFlip();
while(pos < total_size){
CARD_WriteAndVerifyEepromAsync(pos, tmp_buf, page_size, NULL, NULL);
(void)CARD_WaitBackupAsync();
last_result = CARD_GetResultCode();
pos += page_size;
if (last_result != CARD_RESULT_SUCCESS){
break;
}
}
if (last_result != CARD_RESULT_SUCCESS){
PrintString(0, 14, 0x1, "Backup Device : Not Accessible");
error = TRUE;
}
else{
PrintString(0, 14, 0x8, "Backup Device : Accessible");
}
}
CARD_UnlockBackup(card_lock_id);
// DEMO_DrawFlip();
OS_WaitVBlankIntr();
}
/*---------------------------------------------------------------------------*
Name: ReadBootSegNormal
Description: Boot Segment読み込み
*---------------------------------------------------------------------------*/
#define TIME_OUT 1000
static void ReadBootSegNormal(void* buf)
{
u32 i, loop, pc, size, counter;
u64 page = 0;
Cmd64 cndLE;
BOOL isType1;
OSTick start;
isType1 = (*(vu32 *)(HW_BOOT_CHECK_INFO_BUF) & HOTSW_ROMID_1TROM_MASK) ? FALSE : TRUE;
if(isType1){
loop = 0x1UL;
pc = 0x4UL;
size = BOOT_SEGMENT_SIZE;
}
else{
loop = ONE_SEGMENT_PAGE_NUM;
pc = 0x1UL;
size = PAGE_SIZE;
}
counter = 0;
HOTSW_WaitCardCtrl();
for(i=0; i<loop; i++){
// リトルエンディアンで作って
cndLE.dw = HSWOP_N_OP_RD_PAGE;
cndLE.dw |= page << HSWOP_N_RD_PAGE_ADDR_SHIFT;
// MCCMD レジスタ設定
SetCommand(&cndLE);
// MCCNT0 レジスタ設定
reg_MI_MCCNT0_A = (u16)((reg_MI_MCCNT0_A & 0x00ff) | REG_MI_MCCNT0_E_MASK);
// MCCNT1 レジスタ設定
reg_MI_MCCNT1_A = START_MASK | CT_MASK | PC_MASK & (pc << PC_SHIFT) | LATENCY2_MASK | LATENCY1_MASK;
start = OS_GetTick();
while(reg_MI_MCCNT1_A & START_MASK){
while(!(reg_MI_MCCNT1_A & READY_MASK)){
if(OS_TicksToMilliSeconds(OS_GetTick()-start) > TIME_OUT){
return;
}
}
*((u32 *)buf + counter++) = reg_MI_MCD1_A;
}
page++;
OS_SpinWait( 100 );
}
}
/*---------------------------------------------------------------------------*
Name: HOTSWi_SetCommand
Description:
*---------------------------------------------------------------------------*/
static void SetCommand(Cmd64 *cndLE)
{
Cmd64 cndBE;
// ビッグエンディアンに直す
cndBE.b[7] = cndLE->b[0];
cndBE.b[6] = cndLE->b[1];
cndBE.b[5] = cndLE->b[2];
cndBE.b[4] = cndLE->b[3];
cndBE.b[3] = cndLE->b[4];
cndBE.b[2] = cndLE->b[5];
cndBE.b[1] = cndLE->b[6];
cndBE.b[0] = cndLE->b[7];
// MCCMD レジスタ設定
reg_MI_MCCMD0_A = *(u32*)cndBE.b;
reg_MI_MCCMD1_A = *(u32*)&cndBE.b[4];
}
/*---------------------------------------------------------------------------*
Name: ReadPageGame
Description:
*---------------------------------------------------------------------------*/
static void ReadPageGame(u32 start_addr, void* buf, u32 size)
{
u32 loop, counter=0;
u64 i, page;
Cmd64 cndLE;
u32 rom_ctrl = *(vu32 *)(HW_CARD_ROM_HEADER + 0x60);
OSTick start;
rom_ctrl = rom_ctrl & ~CARD_COMMAND_MASK;
page = (u32)(start_addr / PAGE_SIZE);
loop = (u32)(size / PAGE_SIZE);
loop = (size % PAGE_SIZE) ? loop + 1 : loop;
HOTSW_WaitCardCtrl();
for(i=0; i<loop; i++){
// コマンド作成
cndLE.dw = HSWOP_G_OP_RD_PAGE;
cndLE.dw |= (page + i) << HSWOP_G_RD_PAGE_ADDR_SHIFT;
// MCCMD レジスタ設定
SetCommand(&cndLE);
// MCCNT0 レジスタ設定
reg_MI_MCCNT0_A = (u16)((reg_MI_MCCNT0_A & 0x00ff) | REG_MI_MCCNT0_E_MASK);
// MCCNT1 レジスタ設定
reg_MI_MCCNT1_A = rom_ctrl | START_MASK | PAGE_1;
start = OS_GetTick();
while(reg_MI_MCCNT1_A & START_MASK){
while(!(reg_MI_MCCNT1_A & READY_MASK)){
if(OS_TicksToMilliSeconds(OS_GetTick()-start) > TIME_OUT){
return;
}
}
*((u32 *)buf + counter++) = reg_MI_MCD1_A;
}
}
OS_SpinWait( 100 );
}
/*---------------------------------------------------------------------------*
Name: ReadCardData
Description: (page途中)
*---------------------------------------------------------------------------*/
static void ReadCardData(void* dest, s32 offset, s32 length)
{
static u8 page_buffer[512];
u32 page_offset = (u32)(offset & -512);
u32 buffer_offset = (u32)(offset % 512);
u32 valid_length = 512 - buffer_offset;
u32 remain_length;
// 開始アドレスがページの途中
if ( offset % 512 )
{
ReadPageGame(page_offset, page_buffer, 512);
MI_CpuCopy8(page_buffer + buffer_offset, dest, (length < valid_length ? length : valid_length));
dest = (u8*)dest + valid_length;
offset += valid_length;
length -= valid_length;
if ( length < 0)
{
return;
}
}
remain_length = (u32)(length % 512);
ReadPageGame((u32)offset, dest, (u32)(length - remain_length));
// ケツがページ途中
if( remain_length ){
dest = (u8*)dest + (length - remain_length);
offset += length - remain_length;
ReadPageGame((u32)offset, page_buffer, 512);
MI_CpuCopy8(page_buffer, dest, remain_length);
}
}
/*---------------------------------------------------------------------------*
Name: ShowResult
Description: Result表示
*---------------------------------------------------------------------------*/
static void ShowResult(void)
{
PrintString(0, 16, 0xf, "-- Result --");
if(romheader && !flxhash && !ltdhash){
PrintString(0, 18, 0x4, "Normal Mode");
}
else if((!romheader && flxhash && !ltdhash) ||
(!romheader && flxhash && ltdhash && !isTwlCard)){
PrintString(0, 18, 0x5, "Game Mode");
}
else if(!romheader && !flxhash && !ltdhash){
PrintString(0, 18, 0x6, "Slot Power Off");
}
else{
PrintString(0, 18, 0x1, "Unknown Mode");
}
if(error){
PrintString(0, 20, 0x1, "Backup Device Error");
}
// DEMO_DrawFlip();
// OS_WaitVBlankIntr();
}
/*---------------------------------------------------------------------------*
Name: debugMessage
Description:
*---------------------------------------------------------------------------*/
static void debugMessage(void)
{
PrintString(0, 4, 0xf, "amr7 NmlRomOfs : 0x%08x", rh->sub_rom_offset);
PrintString(0, 5, 0xf, "amr7 LtdRomOfs : 0x%08x", rh->sub_ltd_rom_offset);
OS_TPrintf("amr7 NmlRomOfs : 0x%08x\n", rh->sub_rom_offset);
OS_TPrintf("amr7 NmlSize : 0x%08x\n", rh->sub_size);
OS_TPrintf("amr7 LtdRomOfs : 0x%08x\n", rh->sub_ltd_rom_offset);
OS_TPrintf("amr7 LtdSize : 0x%08x\n", rh->sub_ltd_size);
}
/*---------------------------------------------------------------------------*
Name: VBlankIntr
Description:
*---------------------------------------------------------------------------*/
static void VBlankIntr (void)
{
/* 仮想スクリーンを VRAM に反映 */
DC_FlushRange(screen, sizeof(screen));
GX_LoadBG0Scr(screen, 0, sizeof(screen));
/* IRQ チェックフラグをセット */
OS_SetIrqCheckFlag(OS_IE_V_BLANK);
}
/*---------------------------------------------------------------------------*
Name: PrintString
Description: 32
Arguments: x - x ( × 8 )
y - y ( × 8 )
palette -
text - NULL
... -
Returns: None.
*---------------------------------------------------------------------------*/
static void PrintString (s16 x, s16 y, u8 palette, 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; ; i++)
{
if (temp[i] == 0x00)
{
break;
}
screen[((y * 32) + x + i) % (32 * 32)] = (u16)((palette << 12) | temp[i]);
}
}

View File

@ -1,152 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL - HOTSW - include
File: romSpec.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 __HOTSW_ROMSPEC_H__
#define __HOTSW_ROMSPEC_H__
#ifdef __cplusplus
extern "C" {
#endif
// ROM memory map
#define HOTSW_PAGE_SIZE 0x200 // 512B
#define HOTSW_BOOT_SEG_SIZE 0x1000 // 4KB
#define HOTSW_LOAD_TABLE_SIZE 0x2000 // 8KB
#define HOTSW_KEYTABLE_AREA_SIZE 0x3000 // 12KB
#define HOTSW_KEYTABLE2_AREA_SIZE 0x3000 // 12KB
#define HOTSW_SECURE_AREA_SIZE 0x4000 // 16KB
#define HOTSW_SECURE2_AREA_SIZE 0x4000 // 16KB
#define HOTSW_ROMEMU_INFO_SIZE 0x20
#define HOTSW_BOOTSEGMENT_AREA_OFS 0x0000 // 0KB
#define HOTSW_KEYTABLE_AREA_OFS 0x1000 // 4KB
#define HOTSW_SECURE_AREA_OFS 0x4000 // 16KB
#define HOTSW_GAME_AREA_OFS 0x8000 // 32KB
#define HOTSW_SECURE2_AREA_OFS 0x3000 // 12KB
#define HOTSW_GAME2_AREA_OFS 0x7000 // 28KB
#define HOTSW_ROMEMU_INFO_OFS (HOTSW_SECURE_AREA_OFS - HOTSW_PAGE_SIZE + 0x160)
// ROM ID
#define HOTSW_ROMID_1TROM_MASK 0x80000000UL
#define HOTSW_ROMID_TWLROM_MASK 0x40000000UL
#define HOTSW_ROMID_RFSSUP_MASK 0x20000000UL
#define HOTSW_ROMID_SIZE_MASK 0x0000ff00UL
// ROM STATUS
#define HOTSW_ROMST_RFS_WARN_L1_MASK 0x00000004UL
#define HOTSW_ROMST_RFS_WARN_L2_MASK 0x00000008UL
#define HOTSW_ROMST_RFS_READY_MASK 0x00000020UL
// NORMAL command
#define HSWOP_N_OP_MASK 0xff00000000000000ULL
#define HSWOP_N_OP_SIZE 8
#define HSWOP_N_OP_RD_ID 0x9000000000000000ULL
#define HSWOP_N_OP_RD_PAGE 0x0000000000000000ULL
#define HSWOP_N_OP_WR_PAGE 0x8000000000000000ULL
#define HSWOP_N_OP_LD_TABLE 0x9f00000000000000ULL
#define HSWOP_N_OP_RD_CACHE_START 0x5800000000000000ULL
#define HSWOP_N_OP_RD_CACHE 0x6000000000000000ULL
#define HSWOP_N_OP_RD_CACHE_LAST 0x6800000000000000ULL
#define HSWOP_N_OP_RD_STAT 0xd600000000000000ULL
#define HSWOP_N_OP_RFS_BLK 0xb500000000000000ULL
#define HSWOP_N_OP_CHG_MODE 0x3c00000000000000ULL
#define HSWOP_N_OP_CHG2_MODE 0x3d00000000000000ULL
#define HSWOP_N_RD_ID_PAD 0x00ffffffffffffffULL
#define HSWOP_N_RD_PAGE_PAD 0x00fffffeff00ffffULL
#define HSWOP_N_CHG_MODE_PAD 0x00000000f00000ffULL
#define HSWOP_N_CHG2_MODE_PAD HSWOP_N_CHG_MODE_PAD
#define HSWOP_N_RD_PAGE_ADDR_SHIFT 33
#define HSWOP_N_RD_PAGE_ADDR_SIZE 23
#define HSWOP_N_RD_PAGE_ADDR_MASK 0x00fffffe00000000ULL
#define HSWOP_N_VAE_SHIFT 32
#define HSWOP_N_VAE_SIZE 24
#define HSWOP_N_VAE_MASK 0x00ffffff00000000ULL
#define HSWOP_N_VBI_SHIFT 8
#define HSWOP_N_VBI_SIZE 20
#define HSWOP_N_VBI_MASK 0x000000000fffff00ULL
// SECURE command
#define HSWOP_S_OP_MASK 0xf000000000000000ULL
#define HSWOP_S_OP_SIZE 4
#define HSWOP_S_OP_RD_ID 0x1000000000000000ULL
#define HSWOP_S_OP_RD_SEG 0x2000000000000000ULL
#define HSWOP_S_OP_PNG_ON 0x4000000000000000ULL
#define HSWOP_S_OP_PNG_OFF 0x6000000000000000ULL
#define HSWOP_S_OP_CHG_MODE 0xa000000000000000ULL
#define HSWOP_S_VA_SHIFT HSWOP_S_VB_SIZE
#define HSWOP_S_VA_SIZE 24
#define HSWOP_S_VA_MASK 0x00000ffffff00000ULL
#define HSWOP_S_VB_SHIFT 0
#define HSWOP_S_VB_SIZE 20
#define HSWOP_S_VB_MASK 0x00000000000fffffULL
#define HSWOP_S_VC_SHIFT (HSWOP_S_VA_SIZE + HSWOP_S_VB_SIZE)
#define HSWOP_S_VC_SIZE 16
#define HSWOP_S_VC_MASK 0x0ffff00000000000ULL
#define HSWOP_S_VD_SHIFT HSWOP_S_VA_SHIFT
#define HSWOP_S_VD_SIZE HSWOP_S_VA_SIZE
#define HSWOP_S_VD_MASK HSWOP_S_VA_MASK
// GAME command
#define HSWOP_G_OP_MASK 0xff00000000000000ULL
#define HSWOP_G_OP_SIZE 8
#define HSWOP_G_OP_RD_ID 0xb800000000000000ULL
#define HSWOP_G_OP_RD_UID 0xb900000000000000ULL
#define HSWOP_G_OP_RD_PAGE 0xb700000000000000ULL
#define HSWOP_G_OP_WR_PAGE 0x8000000000000000ULL
#define HSWOP_G_OP_RD_CACHE_START HSWOP_N_OP_RD_CACHE_START
#define HSWOP_G_OP_RD_CACHE HSWOP_N_OP_RD_CACHE
#define HSWOP_G_OP_RD_CACHE_LAST HSWOP_N_OP_RD_CACHE_LAST
#define HSWOP_G_OP_RD_STAT HSWOP_N_OP_RD_STAT
#define HSWOP_G_OP_RFS_BLK HSWOP_N_OP_RFS_BLK
#define HSWOP_G_RD_ID_PAD 0x00ffffffffffffffULL
#define HSWOP_G_RD_UID_PAD 0x00ffffffffffffffULL
#define HSWOP_G_RD_PAGE_PAD 0x00f0000000ffffffULL
#define HSWOP_G_RD_PAGE_ADDR_SHIFT 33
#define HSWOP_G_RD_PAGE_ADDR_SIZE 23
#define HSWOP_G_RD_PAGE_ADDR_MASK 0x000ffffe00000000ULL
#ifdef __cplusplus
} /* extern "C" */
#endif
/* __HOTSW_ROMSPEC_H__ */
#endif

View File

@ -1,37 +0,0 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlIPL - tests - CheckCardMode
# 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$
#----------------------------------------------------------------------------
TARGET_PLATFORM := TWL
SRCS = ./src/main.c ./src/font.c
TARGET_BIN = card_mode_check.srl
MACRO_FLAGS += -DMY_TARGET_NAME=\"$(basename $(TARGET_BIN))\"
#-------------------------
include $(TWLSDK_ROOT)/build/buildtools/commondefs
include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -1,579 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - demos.TWL - snd - extraFunc
File: 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 "font.h"
/*---------------------------------------------------------------------------*
Character data
*---------------------------------------------------------------------------*/
const u32 d_CharData[8 * 256] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h
0x00011010, 0x01100010, 0x00000010, 0x00000010,
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
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h
0x00101001, 0x01010001, 0x01010001, 0x00001100,
0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h
0x00010010, 0x00100001, 0x01000000, 0x00000000,
0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h
0x00100001, 0x00111001, 0x01100101, 0x00011001,
0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h
0x00010000, 0x00011100, 0x00110010, 0x00001100,
0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h
0x00111110, 0x01100101, 0x00100101, 0x00010010,
0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h
0x00000110, 0x01000101, 0x01000101, 0x00111110,
0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h
0x01010010, 0x01010101, 0x01001101, 0x00100110,
0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h
0x00011111, 0x01000010, 0x01000010, 0x00111100,
0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h
0x01000010, 0x00100100, 0x00000100, 0x00000100,
0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h
0x01001001, 0x01001001, 0x00111000, 0x00000100,
0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah
0x00001000, 0x00011110, 0x00101001, 0x00000110,
0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh
0x00111010, 0x01000110, 0x01000000, 0x00111000,
0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech
0x01000110, 0x01000000, 0x00100000, 0x00011000,
0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh
0x01000011, 0x01001100, 0x01010010, 0x00111100,
0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh
0x00100110, 0x00100010, 0x00100011, 0x01000010,
0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh
0x01000011, 0x01000000, 0x01000010, 0x00111100,
0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h
0x01000010, 0x01000011, 0x01000010, 0x00110010,
0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h
0x01000110, 0x01000101, 0x01000101, 0x00111001,
0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h
0x00100100, 0x00100100, 0x00100010, 0x00010001,
0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h
0x00111111, 0x00001000, 0x00001000, 0x00001000,
0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h
0x00100001, 0x00100000, 0x00010000, 0x00001100,
0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h
0x00100001, 0x00100000, 0x00010000, 0x00001100,
0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h
0x00100000, 0x00100000, 0x00100000, 0x00111111,
0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h
0x00010010, 0x00010000, 0x00010000, 0x00001100,
0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h
0x00100100, 0x00010000, 0x00001000, 0x00000111,
0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h
0x00001000, 0x00001100, 0x00010010, 0x00100001,
0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah
0x00010010, 0x00000010, 0x00000010, 0x00111100,
0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh
0x00100000, 0x00010000, 0x00001000, 0x00000110,
0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch
0x00111001, 0x00100000, 0x00010000, 0x00001100,
0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh
0x01111111, 0x00010000, 0x00010000, 0x00001100,
0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh
0x00100000, 0x00010000, 0x00001000, 0x00000111,
0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh
0x00001000, 0x00001000, 0x00001000, 0x00000110
};
/*---------------------------------------------------------------------------*
Palette data
*---------------------------------------------------------------------------*/
const u32 d_PaletteData[8 * 16] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000, // black
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white
0x00000000, 0x00000000, 0x00000000, 0x00000000
};
/*---------------------------------------------------------------------------*
End of file
*---------------------------------------------------------------------------*/

View File

@ -1,36 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - demos.TWL - snd - extraFunc
File: 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 FONT_H_
#define FONT_H_
#ifdef __cplusplus
extern "C" {
#endif
/*===========================================================================*/
#include <twl/types.h>
extern const u32 d_CharData[8 * 256];
extern const u32 d_PaletteData[8 * 16];
/*===========================================================================*/
#ifdef __cplusplus
} // extern "C"
#endif
#endif // FONT_H_

View File

@ -1,134 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL - HOTSW - include
File: type.h
Copyright 2007-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.
*---------------------------------------------------------------------------*/
#ifndef __HOTSW_TYPES_H__
#define __HOTSW_TYPES_H__
#include <twl.h>
#include <twl/os/common/format_rom.h>
#include "romSpec.h"
#ifdef __cplusplus
extern "C" {
#endif
static inline void HOTSW_WaitCardCtrl(void)
{
while( reg_MI_MCCNT1_A & REG_MI_MCCNT1_START_MASK ){}
}
// Define -------------------------------------------------------------------
// --- Boot Segment
#define BOOT_SEGMENT_SIZE 0x1000
// --- Secure Segment
#define SECURE_SEGMENT_START 0x4000
#define SECURE_SEGMENT_SIZE 0x4000
#define SECURE_SEGMENT_END (SECURE_SEGMENT_START + SECURE_SEGMENT_SIZE)
// --- TWL Card
#define TWLCARD_BORDER_OFFSET 0x80000
// --- Page / Segment (Byte)
#define PAGE_SIZE 0x200
#define ONE_SEGMENT_SIZE 0x1000
// --- Page / Segment (Word)
#define PAGE_WORD_SIZE 0x80
#define ONE_SEGMENT_WORD_SIZE 0x400
// --- Rom Emulation
#define ROM_EMULATION_DATA_SIZE 0x20
// --- Thread
#define HOTSW_THREAD_STACK_SIZE (1024 * 2)
#define HOTSW_DMA_MSG_NUM 8
#define HOTSW_INSERT_MSG_NUM 16
#define HOTSW_PULLED_MSG_NUM 16
#define HOTSW_CTRL_MSG_NUM 8
#define HOTSW_MSG_BUFFER_NUM (HOTSW_INSERT_MSG_NUM + HOTSW_PULLED_MSG_NUM + HOTSW_CTRL_MSG_NUM)
#define HOTSW_POLLING_CTRL_BUFFER_NUM 4
// --- Card Control Reg 0
#define HOTSW_E2PROM_CTRL_MASK 0x00ff
// --- Card Control Reg 1
#define START_FLG_MASK 0x80000000
#define READY_FLG_MASK 0x00800000
#define LATENCY1_SHIFT 0
#define LATENCY1_MASK 0x00001fff
#define DS_SHIFT 13
#define DS_MASK 0x00002000
#define SE_SHIFT 14
#define SE_MASK 0x00004000
#define SCR_SHIFT 15
#define SCR_MASK 0x00008000
#define LATENCY2_SHIFT 16
#define LATENCY2_MASK 0x003f0000
#define CS_SHIFT 22
#define CS_MASK 0x00400000
#define RDY_SHIFT 23
#define RDY_MASK 0x00800000
#define PC_SHIFT 24
#define PC_MASK 0x07000000
#define CT_SHIFT 27
#define CT_MASK 0x08000000
#define TRM_SHIFT 28
#define TRM_MASK 0x10000000
#define RESB_SHIFT 29
#define RESB_MASK 0x20000000
#define WR_SHIFT 30
#define WR_MASK 0x40000000
#define START_SHIFT 31
#define START_MASK 0x80000000
#define SCRAMBLE_MASK 0x1040e000 // スクランブル関係のフラグマスク
#define SECURE_COMMAND_SCRAMBLE_MASK 0x00406000 // CS SE DSのマスク
// --- Page Count
#define PAGE_0 0x0UL << PC_SHIFT
#define PAGE_1 0x1UL << PC_SHIFT
#define PAGE_2 0x2UL << PC_SHIFT
#define PAGE_4 0x3UL << PC_SHIFT
#define PAGE_8 0x4UL << PC_SHIFT
#define PAGE_16 0x5UL << PC_SHIFT
#define PAGE_32 0x6UL << PC_SHIFT
#define PAGE_STAT 0x7UL << PC_SHIFT
// union ---------------------------------------------------------------------
typedef union
{
u64 dw;
u8 b[8];
} Cmd64;
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif // __HOTSW_TYPES_H__

View File

@ -1,535 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - demos - CARD - hotswDebug
File: main.c
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.
*---------------------------------------------------------------------------*/
#include <twl.h>
#include <twl/os/common/format_rom.h>
#include "DEMO.h"
#include "hotswTypes.h"
#include "font.h"
#define SDK_MAKERCODE '10'
#define DIGEST_HASH_BLOCK_SIZE_SHA1 (512/8)
#define MY_TEMP_BUFFER_SIZE 0x80000
#define GAME_FIELD_START_ADDRESS 0x8000
#define READY_MASK 0x00800000
#define CARD_COMMAND_MASK 0x07000000
#define MY_ROMHEADER_TWL ((ROM_Header_Short *)HW_TWL_CARD_ROM_HEADER_BUF)
#define MY_ROMHEADER_NTR ((ROM_Header_Short *)HW_CARD_ROM_HEADER)
// ---------------------------------------------------------------
// HMACSHA1の鍵
static u8 s_digestDefaultKey[ DIGEST_HASH_BLOCK_SIZE_SHA1 ] = {
0x21, 0x06, 0xc0, 0xde,
0xba, 0x98, 0xce, 0x3f,
0xa6, 0x92, 0xe3, 0x9d,
0x46, 0xf2, 0xed, 0x01,
0x76, 0xe3, 0xcc, 0x08,
0x56, 0x23, 0x63, 0xfa,
0xca, 0xd4, 0xec, 0xdf,
0x9a, 0x62, 0x78, 0x34,
0x8f, 0x6d, 0x63, 0x3c,
0xfe, 0x22, 0xca, 0x92,
0x20, 0x88, 0x97, 0x23,
0xd2, 0xcf, 0xae, 0xc2,
0x32, 0x67, 0x8d, 0xfe,
0xca, 0x83, 0x64, 0x98,
0xac, 0xfd, 0x3e, 0x37,
0x87, 0x46, 0x58, 0x24
};
static u32 checkBuf[MY_TEMP_BUFFER_SIZE/sizeof(u32)] ATTRIBUTE_ALIGN(16);
static ROM_Header_Short *rh;
static BOOL isTwlApplication;
static BOOL isTwlCard;
static BOOL flxhash, ltdhash, mirrorimage;
static u16 card_lock_id;
static u16 screen[32 * 32] ATTRIBUTE_ALIGN(HW_CACHE_LINE_SIZE);
// ---------------------------------------------------------------
static BOOL CheckHashValue(void* buf, u32 size, void* digest);
static void MY_LoadCard_arm7Static(void);
static void MY_LoadCard_arm7LtdStatic(void);
static void debugMessage(void);
static void ShowResult(void);
static void SetCommand(Cmd64 *cndLE);
static void ReadIDGame(void);
static void ReadPageGame(u32 start_addr, void* buf, u32 size);
static void ReadCardData(void* dest, s32 offset, s32 length);
static void isGameModeForNTR(void);
static void VBlankIntr (void);
static void PrintString (s16 x, s16 y, u8 palette, char *text, ...);
static void VolumeSwitchCallback(SNDEXResult result, void* arg);
/*---------------------------------------------------------------------------*
Name: NitroMain
Description: .
*---------------------------------------------------------------------------*/
void NitroMain(void)
{
CARDRomHeader *card_header = (void*)CARD_GetRomHeader();
OS_Init();
OS_InitTick();
CARD_Init();
GX_Init();
GX_DispOff();
GXS_DispOff();
if ( card_header->maker_code == SDK_MAKERCODE )
{
CARD_Enable(TRUE);
}
/* 表示設定初期化 */
GX_SetBankForLCDC(GX_VRAM_LCDC_ALL);
MI_CpuClearFast((void*)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE);
(void)GX_DisableBankForLCDC();
MI_CpuFillFast((void*)HW_OAM, GX_LCD_SIZE_Y, HW_OAM_SIZE);
MI_CpuClearFast((void*)HW_PLTT, HW_PLTT_SIZE);
MI_CpuFillFast((void*)HW_DB_OAM, GX_LCD_SIZE_Y, HW_DB_OAM_SIZE);
MI_CpuClearFast((void*)HW_DB_PLTT, HW_DB_PLTT_SIZE);
GX_SetBankForBG(GX_VRAM_BG_128_A);
G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256,
GX_BG_COLORMODE_16,
GX_BG_SCRBASE_0xf800, // SCR ベースブロック 31
GX_BG_CHARBASE_0x00000, // CHR ベースブロック 0
GX_BG_EXTPLTT_01);
G2_SetBG0Priority(0);
GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D);
GX_SetVisiblePlane(GX_PLANEMASK_BG0);
GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData));
GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData));
MI_CpuClearFast((void*)screen, sizeof(screen));
DC_FlushRange(screen, sizeof(screen));
GX_LoadBG0Scr(screen, 0, sizeof(screen));
/* 割込み設定 */
OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
(void)OS_EnableIrqMask(OS_IE_V_BLANK);
(void)GX_VBlankIntr(TRUE);
(void)OS_EnableIrq();
(void)OS_EnableInterrupts();
/* LCD 表示開始 */
GX_DispOn();
GXS_DispOn();
PrintString(0, 0, 0xa, "***** Card Mode Check *****");
// カードアプリタイプを判別。使うRom Header Buffer を切替える
if(MY_ROMHEADER_NTR->platform_code & PLATFORM_CODE_FLAG_TWL){
PrintString(0, 2, 0xf, "- TWL Application -");
isTwlApplication = TRUE;
rh = MY_ROMHEADER_TWL;
}
else{
PrintString(0, 2, 0xf, "- NTR Application -");
isTwlApplication = FALSE;
rh = MY_ROMHEADER_NTR;
}
OS_Printf("Buf Adr : 0x%08x\n", checkBuf);
// カードタイプの判別
isTwlCard = (*(vu32 *)(HW_BOOT_CHECK_INFO_BUF) & HOTSW_ROMID_TWLROM_MASK) ? TRUE : FALSE;
// 注rhの初期化が終わってから呼び出す
debugMessage();
// フラグの初期化
flxhash = FALSE;
ltdhash = FALSE;
mirrorimage = FALSE;
// ロックIDを取得しておく
card_lock_id = (u16)OS_GetLockID();
if(isTwlApplication){
MY_LoadCard_arm7Static();
MY_LoadCard_arm7LtdStatic();
}
else{
isGameModeForNTR();
}
ShowResult();
while(1){
DEMO_DrawFlip();
OS_WaitVBlankIntr();
}
}
/*---------------------------------------------------------------------------*
Name: ShowResult
Description:
*---------------------------------------------------------------------------*/
static void ShowResult(void)
{
PrintString(0, 13, 0xf, "-- Result --");
if(flxhash && ltdhash){
if(isTwlCard){
PrintString(0, 15, 0x6, "Game2 Mode");
}
else{
PrintString(0, 15, 0x5, "Game Mode");
}
}
else if(mirrorimage){
PrintString(0, 15, 0x5, "Game Mode");
}
else{
PrintString(0, 15, 0x1, "Unknown Mode");
}
}
/*---------------------------------------------------------------------------*
Name: debugMessage
Description:
*---------------------------------------------------------------------------*/
static void debugMessage(void)
{
PrintString(0, 4, 0xf, "amr7 NmlRomOfs : 0x%08x", rh->sub_rom_offset);
PrintString(0, 5, 0xf, "amr7 LtdRomOfs : 0x%08x", rh->sub_ltd_rom_offset);
OS_TPrintf("amr7 NmlRomOfs : 0x%08x\n", rh->sub_rom_offset);
OS_TPrintf("amr7 NmlSize : 0x%08x\n", rh->sub_size);
OS_TPrintf("amr7 LtdRomOfs : 0x%08x\n", rh->sub_ltd_rom_offset);
OS_TPrintf("amr7 LtdSize : 0x%08x\n", rh->sub_ltd_size);
}
/*---------------------------------------------------------------------------*
Name: CheckHashValue
Description:
*---------------------------------------------------------------------------*/
static BOOL CheckHashValue(void* buf, u32 size, void* digest)
{
u8 sha1data[DIGEST_SIZE_SHA1];
BOOL retval = TRUE;
// クリア
MI_CpuClear8(sha1data, sizeof(sha1data));
// ARM7常駐モジュールのHash値照合
SVC_CalcHMACSHA1( sha1data,
buf,
size,
s_digestDefaultKey,
sizeof(s_digestDefaultKey) );
return SVC_CompareSHA1( sha1data, digest );
}
/*---------------------------------------------------------------------------*
Name: MY_LoadCard_arm7Static
Description: ARM7常駐モジュール
*---------------------------------------------------------------------------*/
static void MY_LoadCard_arm7Static(void)
{
BOOL result;
u32* pBuf = checkBuf;
CARD_LockRom(card_lock_id);
ReadCardData(pBuf, (s32)rh->sub_rom_offset, (s32)rh->sub_size);
CARD_UnlockRom(card_lock_id);
result = CheckHashValue(pBuf, rh->sub_size, (void *)rh->sub_static_digest);
if(result){
flxhash = TRUE;
PrintString(0, 7, 0x8, "Flx Area : Accessible");
}
else{
flxhash = FALSE;
PrintString(0, 7, 0x1, "Flx Area : Not Accessible");
}
}
/*---------------------------------------------------------------------------*
Name: MY_LoadCard_arm7LtdStatic
Description: ARM7拡張常駐モジュール
*---------------------------------------------------------------------------*/
static void MY_LoadCard_arm7LtdStatic(void)
{
BOOL result;
u32* pBuf = checkBuf;
CARD_LockRom(card_lock_id);
ReadCardData(pBuf, (s32)rh->sub_ltd_rom_offset, (s32)rh->sub_ltd_size);
CARD_UnlockRom(card_lock_id);
result = CheckHashValue(pBuf, rh->sub_ltd_size, (void *)rh->sub_ltd_static_digest);
if(result){
ltdhash = TRUE;
PrintString(0, 9, 0x8, "Ltd Area : Accessible");
}
else{
ltdhash = FALSE;
PrintString(0, 9, 0x1, "Ltd Area : Not Accessible");
}
}
/*---------------------------------------------------------------------------*
Name: isGameModeForNTR
Description: Gameモードかどうか判定する
*---------------------------------------------------------------------------*/
static void isGameModeForNTR(void)
{
u32 buf1[PAGE_SIZE/sizeof(u32)];
u32 buf2[PAGE_SIZE/sizeof(u32)];
int result;
/* Rom Header領域を読んで、Game領域のイメージが出てたらGameモード */
ReadCardData(buf1, (s32)0, (s32)PAGE_SIZE);
ReadCardData(buf2, (s32)GAME_FIELD_START_ADDRESS, (s32)PAGE_SIZE);
result = MI_CpuComp8( buf1, buf2, PAGE_SIZE );
if(result){
mirrorimage = FALSE;
PrintString(0, 7, 0x1, "Flx Area : Not Accessible");
}
else{
mirrorimage = TRUE;
PrintString(0, 7, 0x8, "Flx Area : Accessible");
}
}
/*---------------------------------------------------------------------------*
Name: HOTSWi_SetCommand
Description:
*---------------------------------------------------------------------------*/
static void SetCommand(Cmd64 *cndLE)
{
Cmd64 cndBE;
// ビッグエンディアンに直す
cndBE.b[7] = cndLE->b[0];
cndBE.b[6] = cndLE->b[1];
cndBE.b[5] = cndLE->b[2];
cndBE.b[4] = cndLE->b[3];
cndBE.b[3] = cndLE->b[4];
cndBE.b[2] = cndLE->b[5];
cndBE.b[1] = cndLE->b[6];
cndBE.b[0] = cndLE->b[7];
// MCCMD レジスタ設定
reg_MI_MCCMD0_A = *(u32*)cndBE.b;
reg_MI_MCCMD1_A = *(u32*)&cndBE.b[4];
}
/*---------------------------------------------------------------------------*
Name: ReadIDGame
Description: IDを読み込む
*---------------------------------------------------------------------------*/
static void ReadIDGame(void)
{
u32 id;
Cmd64 cndLE;
u32 rom_ctrl = *(vu32 *)(HW_CARD_ROM_HEADER + 0x60);
rom_ctrl = rom_ctrl & ~CARD_COMMAND_MASK;
// リトルエンディアンで作って
cndLE.dw = HSWOP_G_OP_RD_ID;
// MCCMD レジスタ設定
SetCommand(&cndLE);
// MCCNT0 レジスタ設定
reg_MI_MCCNT0_A = (u16)((reg_MI_MCCNT0_A & 0x00ff) | REG_MI_MCCNT0_E_MASK);
// MCCNT1 レジスタ設定
reg_MI_MCCNT1_A = rom_ctrl | START_MASK | PAGE_1;
while(reg_MI_MCCNT1_A & START_MASK){
while(!(reg_MI_MCCNT1_A & READY_MASK)){}
id = reg_MI_MCD1_A;
}
OS_Printf("Card ID : 0x%08x\n", id);
OS_SpinWait( 100 );
}
/*---------------------------------------------------------------------------*
Name: ReadPageGame
Description:
CT=150ns Pagecount=1page Latency=RomHeaderで指定の値
*---------------------------------------------------------------------------*/
static void ReadPageGame(u32 start_addr, void* buf, u32 size)
{
u32 loop, counter=0;
u64 i, page;
Cmd64 cndLE;
u32 rom_ctrl = *(vu32 *)(HW_CARD_ROM_HEADER + 0x60);
rom_ctrl = rom_ctrl & ~CARD_COMMAND_MASK;
page = (u32)(start_addr / PAGE_SIZE);
loop = (u32)(size / PAGE_SIZE);
loop = (size % PAGE_SIZE) ? loop + 1 : loop;
for(i=0; i<loop; i++){
// コマンド作成
cndLE.dw = HSWOP_G_OP_RD_PAGE;
cndLE.dw |= (page + i) << HSWOP_G_RD_PAGE_ADDR_SHIFT;
// MCCMD レジスタ設定
SetCommand(&cndLE);
// MCCNT0 レジスタ設定
reg_MI_MCCNT0_A = (u16)((reg_MI_MCCNT0_A & 0x00ff) | REG_MI_MCCNT0_E_MASK);
// MCCNT1 レジスタ設定
reg_MI_MCCNT1_A = rom_ctrl | START_MASK | PAGE_1;
while(reg_MI_MCCNT1_A & START_MASK){
while(!(reg_MI_MCCNT1_A & READY_MASK)){}
*((u32 *)buf + counter++) = reg_MI_MCD1_A;
}
}
OS_SpinWait( 100 );
}
/*---------------------------------------------------------------------------*
Name: ReadCardData
Description: (page途中)
*---------------------------------------------------------------------------*/
static void ReadCardData(void* dest, s32 offset, s32 length)
{
static u8 page_buffer[512];
u32 page_offset = (u32)(offset & -512);
u32 buffer_offset = (u32)(offset % 512);
u32 valid_length = 512 - buffer_offset;
u32 remain_length;
// 開始アドレスがページの途中
if ( offset % 512 )
{
ReadPageGame(page_offset, page_buffer, 512);
MI_CpuCopy8(page_buffer + buffer_offset, dest, (length < valid_length ? length : valid_length));
dest = (u8*)dest + valid_length;
offset += valid_length;
length -= valid_length;
if ( length < 0)
{
return;
}
}
remain_length = (u32)(length % 512);
ReadPageGame((u32)offset, dest, (u32)(length - remain_length));
// ケツがページ途中
if( remain_length ){
dest = (u8*)dest + (length - remain_length);
offset += length - remain_length;
ReadPageGame((u32)offset, page_buffer, 512);
MI_CpuCopy8(page_buffer, dest, remain_length);
}
}
/*---------------------------------------------------------------------------*
Name: VBlankIntr
Description:
*---------------------------------------------------------------------------*/
static void VBlankIntr (void)
{
/* 仮想スクリーンを VRAM に反映 */
DC_FlushRange(screen, sizeof(screen));
GX_LoadBG0Scr(screen, 0, sizeof(screen));
/* IRQ チェックフラグをセット */
OS_SetIrqCheckFlag(OS_IE_V_BLANK);
}
/*---------------------------------------------------------------------------*
Name: PrintString
Description: 32
Arguments: x - x ( × 8 )
y - y ( × 8 )
palette -
text - NULL
... -
Returns: None.
*---------------------------------------------------------------------------*/
static void PrintString (s16 x, s16 y, u8 palette, 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; ; i++)
{
if (temp[i] == 0x00)
{
break;
}
screen[((y * 32) + x + i) % (32 * 32)] = (u16)((palette << 12) | temp[i]);
}
}

View File

@ -1,152 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL - HOTSW - include
File: romSpec.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 __HOTSW_ROMSPEC_H__
#define __HOTSW_ROMSPEC_H__
#ifdef __cplusplus
extern "C" {
#endif
// ROM memory map
#define HOTSW_PAGE_SIZE 0x200 // 512B
#define HOTSW_BOOT_SEG_SIZE 0x1000 // 4KB
#define HOTSW_LOAD_TABLE_SIZE 0x2000 // 8KB
#define HOTSW_KEYTABLE_AREA_SIZE 0x3000 // 12KB
#define HOTSW_KEYTABLE2_AREA_SIZE 0x3000 // 12KB
#define HOTSW_SECURE_AREA_SIZE 0x4000 // 16KB
#define HOTSW_SECURE2_AREA_SIZE 0x4000 // 16KB
#define HOTSW_ROMEMU_INFO_SIZE 0x20
#define HOTSW_BOOTSEGMENT_AREA_OFS 0x0000 // 0KB
#define HOTSW_KEYTABLE_AREA_OFS 0x1000 // 4KB
#define HOTSW_SECURE_AREA_OFS 0x4000 // 16KB
#define HOTSW_GAME_AREA_OFS 0x8000 // 32KB
#define HOTSW_SECURE2_AREA_OFS 0x3000 // 12KB
#define HOTSW_GAME2_AREA_OFS 0x7000 // 28KB
#define HOTSW_ROMEMU_INFO_OFS (HOTSW_SECURE_AREA_OFS - HOTSW_PAGE_SIZE + 0x160)
// ROM ID
#define HOTSW_ROMID_1TROM_MASK 0x80000000UL
#define HOTSW_ROMID_TWLROM_MASK 0x40000000UL
#define HOTSW_ROMID_RFSSUP_MASK 0x20000000UL
#define HOTSW_ROMID_SIZE_MASK 0x0000ff00UL
// ROM STATUS
#define HOTSW_ROMST_RFS_WARN_L1_MASK 0x00000004UL
#define HOTSW_ROMST_RFS_WARN_L2_MASK 0x00000008UL
#define HOTSW_ROMST_RFS_READY_MASK 0x00000020UL
// NORMAL command
#define HSWOP_N_OP_MASK 0xff00000000000000ULL
#define HSWOP_N_OP_SIZE 8
#define HSWOP_N_OP_RD_ID 0x9000000000000000ULL
#define HSWOP_N_OP_RD_PAGE 0x0000000000000000ULL
#define HSWOP_N_OP_WR_PAGE 0x8000000000000000ULL
#define HSWOP_N_OP_LD_TABLE 0x9f00000000000000ULL
#define HSWOP_N_OP_RD_CACHE_START 0x5800000000000000ULL
#define HSWOP_N_OP_RD_CACHE 0x6000000000000000ULL
#define HSWOP_N_OP_RD_CACHE_LAST 0x6800000000000000ULL
#define HSWOP_N_OP_RD_STAT 0xd600000000000000ULL
#define HSWOP_N_OP_RFS_BLK 0xb500000000000000ULL
#define HSWOP_N_OP_CHG_MODE 0x3c00000000000000ULL
#define HSWOP_N_OP_CHG2_MODE 0x3d00000000000000ULL
#define HSWOP_N_RD_ID_PAD 0x00ffffffffffffffULL
#define HSWOP_N_RD_PAGE_PAD 0x00fffffeff00ffffULL
#define HSWOP_N_CHG_MODE_PAD 0x00000000f00000ffULL
#define HSWOP_N_CHG2_MODE_PAD HSWOP_N_CHG_MODE_PAD
#define HSWOP_N_RD_PAGE_ADDR_SHIFT 33
#define HSWOP_N_RD_PAGE_ADDR_SIZE 23
#define HSWOP_N_RD_PAGE_ADDR_MASK 0x00fffffe00000000ULL
#define HSWOP_N_VAE_SHIFT 32
#define HSWOP_N_VAE_SIZE 24
#define HSWOP_N_VAE_MASK 0x00ffffff00000000ULL
#define HSWOP_N_VBI_SHIFT 8
#define HSWOP_N_VBI_SIZE 20
#define HSWOP_N_VBI_MASK 0x000000000fffff00ULL
// SECURE command
#define HSWOP_S_OP_MASK 0xf000000000000000ULL
#define HSWOP_S_OP_SIZE 4
#define HSWOP_S_OP_RD_ID 0x1000000000000000ULL
#define HSWOP_S_OP_RD_SEG 0x2000000000000000ULL
#define HSWOP_S_OP_PNG_ON 0x4000000000000000ULL
#define HSWOP_S_OP_PNG_OFF 0x6000000000000000ULL
#define HSWOP_S_OP_CHG_MODE 0xa000000000000000ULL
#define HSWOP_S_VA_SHIFT HSWOP_S_VB_SIZE
#define HSWOP_S_VA_SIZE 24
#define HSWOP_S_VA_MASK 0x00000ffffff00000ULL
#define HSWOP_S_VB_SHIFT 0
#define HSWOP_S_VB_SIZE 20
#define HSWOP_S_VB_MASK 0x00000000000fffffULL
#define HSWOP_S_VC_SHIFT (HSWOP_S_VA_SIZE + HSWOP_S_VB_SIZE)
#define HSWOP_S_VC_SIZE 16
#define HSWOP_S_VC_MASK 0x0ffff00000000000ULL
#define HSWOP_S_VD_SHIFT HSWOP_S_VA_SHIFT
#define HSWOP_S_VD_SIZE HSWOP_S_VA_SIZE
#define HSWOP_S_VD_MASK HSWOP_S_VA_MASK
// GAME command
#define HSWOP_G_OP_MASK 0xff00000000000000ULL
#define HSWOP_G_OP_SIZE 8
#define HSWOP_G_OP_RD_ID 0xb800000000000000ULL
#define HSWOP_G_OP_RD_UID 0xb900000000000000ULL
#define HSWOP_G_OP_RD_PAGE 0xb700000000000000ULL
#define HSWOP_G_OP_WR_PAGE 0x8000000000000000ULL
#define HSWOP_G_OP_RD_CACHE_START HSWOP_N_OP_RD_CACHE_START
#define HSWOP_G_OP_RD_CACHE HSWOP_N_OP_RD_CACHE
#define HSWOP_G_OP_RD_CACHE_LAST HSWOP_N_OP_RD_CACHE_LAST
#define HSWOP_G_OP_RD_STAT HSWOP_N_OP_RD_STAT
#define HSWOP_G_OP_RFS_BLK HSWOP_N_OP_RFS_BLK
#define HSWOP_G_RD_ID_PAD 0x00ffffffffffffffULL
#define HSWOP_G_RD_UID_PAD 0x00ffffffffffffffULL
#define HSWOP_G_RD_PAGE_PAD 0x00f0000000ffffffULL
#define HSWOP_G_RD_PAGE_ADDR_SHIFT 33
#define HSWOP_G_RD_PAGE_ADDR_SIZE 23
#define HSWOP_G_RD_PAGE_ADDR_MASK 0x000ffffe00000000ULL
#ifdef __cplusplus
} /* extern "C" */
#endif
/* __HOTSW_ROMSPEC_H__ */
#endif

View File

@ -1,249 +0,0 @@
#----------------------------------------------------------------------------
# Project: TwlSDK - include
# File: ROM-TS.rsf
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded insructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Date:: $
# $Rev$
# $Author$
#----------------------------------------------------------------------------
#
# TWL ROM SPEC FILE
#
Arm9
{
Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)"
OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)"
OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)"
Elf "$(MAKEROM_ARM9:r).tef"
}
Arm7
{
Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)"
OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)"
OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)"
Elf "$(MAKEROM_ARM7_BASE:r).tef"
}
Arm9.Ltd
{
Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)"
OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)"
OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)"
}
Arm7.Ltd
{
Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)"
OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)"
OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)"
}
Property
{
###
### Settings for FinalROM
###
#### BEGIN
#
# TITLE NAME: Your product name within 12bytes
#
#TitleName "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 128M
#RomSize 256M
#
# 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 ./etc/myGameBanner.bnr
BannerFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr
#
# Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE]
#
#PermitLandingNormalJump FALSE
#
# Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE]
#
#PermitLandingTmpJump FALSE
###
### Setting for TWL
###
#
# ROM HEADER Ltd: Provided to every product by NINTENDO
#
RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin
#
# Digest parameters:
#
DigestParam 1024 32
#
# WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD
# MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD]
# don't have to edit
#
WramMapping $(MAKEROM_WRAM_MAPPING)
#
# CardRegion: card region [Japan/America/Europe/Australia/China/Korea]
#
CardRegion Japan
#
# CommonClientKey: launcher deliver common client Key [TRUE/FALSE]
#
#CommonClientKey FALSE
#
# HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE]
#
#HwAESSlotB FALSE
#
# HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE]
#
#HwAESSlotC FALSE
#
# SDCardAccess: sd card access control [TRUE/FALSE]
#
#SDCardAccess FALSE
#
# NANDAccess: NAND access control [TRUE/FALSE]
#
#NANDAccess FALSE
#
# Codec mode:
# don't have to edit
#
CodecMode $(MAKEROM_CODEC_MODE)
#
# Disp WiFiConnection Icon for Launcher [TRUE/FALSE]
#
#WiFiConnectionIcon FALSE
#
# Disp DSWireless Icon for Launcher [TRUE/FALSE]
#
#DSWirelessIcon FALSE
###
#### END
}
AppendProperty
{
#
# Publisher : "Nintendo"
# don't have to edit
Publisher Nintendo
#
# Application type : [USER/SYSTEM]
# don't have to edit
AppType User
#
# launch title on the launcher : [TRUE/FALSE]
# don't have to edit
Launch TRUE
#
# Boot allowed Media: [GameCard]
#
Media GameCard
#
# Data only title : [TRUE/FALSE]
# don't have to edit
DataOnly FALSE
#
# Secure title : [TRUE/FALSE]
# don't have to edit
Secure FALSE
#
# GameCode for TitleID : Your GameCode in 4 ascii words
#
#GameCode ABCJ
#
# Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M]
#
#PublicSaveDataSize 32K
#
# Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M]
#
#PrivateSaveDataSize 16K
#
# Enable SubBannerFile
#SubBannerFile TRUE
}
RomSpec
{
Offset 0x00000000
Segment ALL
HostRoot ../../systemMenu_RED/DSHashTable
Root /sign
File DSHashTable.bin
HostRoot $(MAKEROM_SRL_ROOT)
Root /srl
# File NA22E0.035 # 1st
# File NA22J0.024 # 2nd
# File NYZYE0.E81 # last-1
# File NYZZJ0.L57 # last
File NYRVJ0.J30 # max number of overlaies
File NALKJ1.879 # max overlay size
File NA39J0.357 # mario kart
}

View File

@ -1,48 +0,0 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlIPL - tests - CheckDSHashTable
# 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$
#----------------------------------------------------------------------------
SUBDIRS =
#----------------------------------------------------------------------------
TARGET_PLATFORM := TWL
TARGET_FIRM := SYSTEMMENU
override TWL_ARCHGEN := LIMITED
SRCS = main.c
TARGET_BIN = CheckDSHashTable.srl
ROM_SPEC = CheckDSHashTable.rsf
DS_HASH_TABLE_SRL_ROOT ?= D:/SRL
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
LLIBRARIES += libdht$(TWL_LIBSUFFIX).a
MAKEROM_FLAGS += -DMAKEROM_SRL_ROOT=$(DS_HASH_TABLE_SRL_ROOT)
#----------------------------------------------------------------------------
do-build: $(TARGETS)
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -1,285 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL - tests - CheckDSHashTable
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 <sysmenu/dht/dht.h>
#define HASH_PATH "/sign/DSHashTable.bin"
/*
CARD関数の代わりにFS関数で
DHTライブラリが実装されている前提である
*/
#define ROM_PATH "/srl"
#define DS_HASH_TABLE_NUMS 3000
#define DS_HASH_TABLE_SIZE (sizeof(DHTHeader) + DS_HASH_TABLE_NUMS * sizeof(DHTDatabase))
/*
DHTファイル読み込み先
*/
static u8 dht_buffer[DS_HASH_TABLE_SIZE] ATTRIBUTE_ALIGN(32);
static DHTFile *const dht = (DHTFile*)dht_buffer;
/*
Phase2用バッファ
*/
static DHTPhase2Work p2work;
/*
*/
#include <twl/ltdmain_begin.h>
static ROM_Header_Short rom_header ATTRIBUTE_ALIGN(32); // 使うのは DHT_DS_HEADER_SIZE だけ
static u8 rom_arm9[3*1024*1024] ATTRIBUTE_ALIGN(32);
static u8 rom_arm7[1024*1024] ATTRIBUTE_ALIGN(32);
#include <twl/ltdmain_end.h>
/*
API
*/
#if 1
// FS版 (arg == FSFile*)
static BOOL ReadImage(void* dest, s32 offset, s32 length, void* arg)
{
FSFile* fp = arg;
s32 result;
if ( !FS_SeekFile(fp, offset, FS_SEEK_SET) )
{
OS_TPrintf("Cannot seek to the offset (%d bytes).\n", offset);
return FALSE;
}
result = FS_ReadFile(fp, dest, length);
if ( result != length )
{
OS_TPrintf("Cannot read the data (%d bytes).\n", length);
return FALSE;
}
return TRUE;
}
static BOOL ReadImageEx(SVCHMACSHA1Context* ctx, s32 offset, s32 length, void* arg)
{
if ( !ReadImage(p2work.buffer, offset, length, arg) )
{
return FALSE;
}
DHT_CheckHashPhase2ExUpdate(ctx, p2work.buffer, length);
return TRUE;
}
#else
#ifdef SDK_ARM9
#define PAGE_SIZE 512
// CARD版 (arg == dma no)
static BOOL ReadImage(void* dest, s32 offset, s32 length, void* arg)
{
u32 dma = (u32)arg;
CARD_ReadRom(dma, (void*)offset, dest, (u32)length);
return TRUE;
}
#else
// HOTSW版 (arg == CardBootData* cdb)
#include <hotswTypes.h>
#include <dsCardCommon.h>
static BOOL ReadImage(void* dest, s32 offset, s32 length, void* arg)
{
HotSwState retval;
if ( offset % 512 )
{
static u8 page_buffer[512];
u32 page_offset = (u32)(offset & -512);
u32 buffer_offset = (u32)(offset % 512);
u32 valid_length = 512 - buffer_offset;
retval = ReadPageGame((CardBootData*)arg, page_offset, page_buffer, 512);
if (retval != HOTSW_SUCCESS)
{
return FALSE;
}
MI_CpuCopy8(page_buffer + buffer_offset, dest, (length < valid_length ? length : valid_length));
dest = (u8*)dest + valid_length;
offset += valid_length;
length -= valid_length;
if ( length < 0)
{
return TRUE;
}
}
retval = ReadPageGame((CardBootData*)arg, (u32)offset, dest, (u32)length);
return (retval == HOTSW_SUCCESS);
}
#endif
#endif
static void VBlankIntr( void )
{
OS_SetIrqCheckFlag(OS_IE_V_BLANK);
}
/*
*/
static BOOL CheckValidation(FSFile* fp)
{
const DHTDatabase *db;
s32 result;
// ヘッダの読み込み
result = FS_ReadFile(fp, &rom_header, DHT_DS_HEADER_SIZE);
if ( result != DHT_DS_HEADER_SIZE )
{
OS_TPrintf("Cannot read ROM header.\n");
return FALSE;
}
// ARM9部分
if ( rom_header.main_size > sizeof(rom_arm9) )
{
OS_TPrintf("Too large main size (%d > %d).\n", rom_header.main_size, sizeof(rom_arm9));
return FALSE;
}
if ( !FS_SeekFile(fp, (s32)rom_header.main_rom_offset, FS_SEEK_SET) )
{
OS_TPrintf("Cannot seek to ARM9 static.\n");
return FALSE;
}
result = FS_ReadFile(fp, rom_arm9, (s32)rom_header.main_size);
if ( result != rom_header.main_size )
{
OS_TPrintf("Cannot read ARM9 static.\n");
return FALSE;
}
// ARM7部分
if ( rom_header.sub_size > sizeof(rom_arm7) )
{
OS_TPrintf("Too large sub size (%d > %d).\n", rom_header.sub_size, sizeof(rom_arm7));
return FALSE;
}
if ( !FS_SeekFile(fp, (s32)rom_header.sub_rom_offset, FS_SEEK_SET) )
{
OS_TPrintf("Cannot seek to ARM7 static.\n");
return FALSE;
}
result = FS_ReadFile(fp, rom_arm7, (s32)rom_header.sub_size);
if ( result != rom_header.sub_size )
{
OS_TPrintf("Cannot read ARM7 static.\n");
return FALSE;
}
// データベースの検索
db = DHT_GetDatabase(dht, &rom_header);
if ( !db )
{
return FALSE;
}
//OS_TPrintf("FOUND: 0x%08X: %.4s(%d)\n", db, db->game_code, db->rom_version);
// ハッシュ計算 (1) - 隠蔽可能なはず
if ( !DHT_CheckHashPhase1(db->hash[0], &rom_header, rom_arm9, rom_arm7) )
{
return FALSE;
}
// ハッシュ計算 (2) - 隠蔽は難しいか
if ( !DHT_CheckHashPhase2(db->hash[1], &rom_header, &p2work, ReadImage, fp) )
{
// ハッシュ計算 (2ex) - 隠蔽は難しいか (失敗した場合も見ておく)
if ( !DHT_CheckHashPhase2Ex(db->hash[1], &rom_header, (DHTPhase2ExWork*)&p2work, ReadImage, ReadImageEx, fp) )
{
return FALSE;
}
return FALSE;
}
// ハッシュ計算 (2ex) - 隠蔽は難しいか
if ( !DHT_CheckHashPhase2Ex(db->hash[1], &rom_header, (DHTPhase2ExWork*)&p2work, ReadImage, ReadImageEx, fp) )
{
return FALSE;
}
return TRUE;
}
void TwlMain(void)
{
OS_Init();
OS_InitTick();
(void)OS_EnableIrq();
(void)OS_EnableInterrupts();
// 割り込み許可----------------------------
(void)OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
(void)OS_EnableIrqMask(OS_IE_V_BLANK);
(void)GX_VBlankIntr(TRUE);
FS_Init(FS_DMA_NOT_USE);
{
FSFile file;
if ( !FS_OpenFileEx(&file, HASH_PATH, FS_FILEMODE_R) )
{
OS_TPanic("Cannot open %s.\n", HASH_PATH);
}
// 署名ロード
if ( !DHT_PrepareDatabase(dht, &file) )
{
OS_TPanic("Cannot prepare the database.\n");
}
FS_CloseFile(&file);
}
// 本番
{
FSFile dir;
FSDirectoryEntryInfo info;
BOOL result;
result = FS_OpenDirectory(&dir, ROM_PATH, FS_FILEMODE_R);
if ( !result )
{
OS_TPanic("Cannot open " ROM_PATH ".\n");
}
while ( FS_ReadDirectory(&dir, &info) )
{
FSFile file;
OSTick begin;
char path[FS_ENTRY_LONGNAME_MAX+sizeof(ROM_PATH)+1];
if ( info.attributes & FS_ATTRIBUTE_IS_DIRECTORY )
{
OS_TPrintf("%s is directory.\n", info.longname);
continue;
}
STD_CopyString(path, ROM_PATH "/");
STD_ConcatenateString(path, info.longname);
if (!FS_OpenFileEx(&file, path, FS_FILEMODE_R))
{
OS_TPrintf("Cannot open %s.\n", path);
continue;
}
OS_TPrintf("\nTrying %s...\n", path);
begin = OS_GetTick();
if ( !CheckValidation(&file) )
{
OS_TPrintf("Failed. %d msec (includes loading static data).\n", (int)OS_TicksToMilliSeconds(OS_GetTick()-begin));
}
else
{
OS_TPrintf("Success. %d msec (includes loading static data).\n", (int)OS_TicksToMilliSeconds(OS_GetTick()-begin));
}
FS_CloseFile(&file);
}
FS_CloseDirectory(&dir);
}
OS_TPrintf("\nDone.\n");
OS_Terminate();
}

View File

@ -1,39 +0,0 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlIPL - tests - CheckPreloadParameters
# 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$
#----------------------------------------------------------------------------
TWL_NANDAPP = TRUE
TARGET_PLATFORM = TWL
SRCS = main.c
TARGET_BIN = main.tad
include $(TWLSDK_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS =
#----------------------------------------------------------------------------
do-build: $(TARGETS)
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -1,47 +0,0 @@
#! 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.

Before

Width:  |  Height:  |  Size: 630 B

View File

@ -1,457 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL - tests - CheckPreloadParameters
File: main.c
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.h>
#include <twl/lcfg/common/TWLSettings.h>
void VBlankIntr(void);
OSOwnerInfoEx s_owner;
static char *s_strCountry[ 256 ];
static char *s_strRegion[ OS_TWL_REGION_MAX ];
static char *s_strUserColor[ OS_FAVORITE_COLOR_MAX ];
static char *s_strRatingOgn[ OS_TWL_PCTL_OGN_MAX ];
static char *s_strLanguage[ OS_LANGUAGE_CODE_MAX ];
/*---------------------------------------------------------------------------*
Name: TwlMain
Description: main
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void TwlMain(void)
{
char string[ 256 ];
int srcLen, dstLen;
OS_Init();
//---- interrupt setting
OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
OS_EnableIrqMask(OS_IE_V_BLANK);
OS_EnableIrq();
GX_VBlankIntr(TRUE);
OS_GetOwnerInfoEx( &s_owner );
OS_TPrintf( "Language : %02x %s\n", s_owner.language, s_strLanguage[ s_owner.language ] );
OS_TPrintf( "UserColor : %02x %s\n", s_owner.favoriteColor, s_strUserColor[ s_owner.favoriteColor ] );
OS_TPrintf( "Birthday : %02d/%02d\n", s_owner.birthday.month, s_owner.birthday.day );
{
MI_CpuClear8( string, sizeof(string) );
srcLen = (int)s_owner.nickNameLength;
dstLen = sizeof(string);
STD_ConvertStringUnicodeToSjis( string, &dstLen, s_owner.nickName, &srcLen, NULL );
OS_TPrintf( "Nickname : %s\n", string );
MI_CpuClear8( string, sizeof(string) );
srcLen = (int)s_owner.commentLength;
dstLen = sizeof(string);
STD_ConvertStringUnicodeToSjis( string, &dstLen, s_owner.comment, &srcLen, NULL );
OS_TPrintf( "Comment : %s\n", string );
}
OS_TPrintf( "Country : %s\n", s_strCountry[ s_owner.country ] );
OS_TPrintf( "IsAgreeEULA : %s\n", OS_IsAgreeEULA() ? "Agree" : "Not agree" );
OS_TPrintf( "AgreedEULAVersion : %d\n", OS_GetAgreedEULAVersion() );
OS_TPrintf( "ROMHeaderEULAVersion : %d\n", OS_GetROMHeaderEULAVersion() );
OS_TPrintf( "AvailableWireless : %s\n", OS_IsAvailableWireless() ? "TRUE" : "FALSE" );
PMi_SetWirelessLED( OS_IsAvailableWireless() ? PM_WIRELESS_LED_ON : PM_WIRELESS_LED_OFF );
{
const LCFGTWLParentalControl *pPC = (const LCFGTWLParentalControl *)OS_GetParentalControlInfoPtr();
OS_TPrintf( "ParentalControls :\n");
OS_TPrintf( " isSetParentalControl : %s\n", pPC->flags.isSetParentalControl ? "TRUE" : "FALSE" );
OS_TPrintf( " PictoChat : %s\n", pPC->flags.pictoChat ? "TRUE" : "FALSE" );
OS_TPrintf( " DS Download : %s\n", pPC->flags.dsDownload ? "TRUE" : "FALSE" );
OS_TPrintf( " Browser : %s\n", pPC->flags.browser ? "TRUE" : "FALSE" );
OS_TPrintf( " WiiPoint : %s\n", pPC->flags.wiiPoint ? "TRUE" : "FALSE" );
OS_TPrintf( " PhotoExchange : %s\n", pPC->flags.photoExchange ? "TRUE" : "FALSE" );
OS_TPrintf( " UGC : %s\n", pPC->flags.ugc ? "TRUE" : "FALSE" );
OS_TPrintf( " RatingOgn : %s\n", pPC->ogn < LCFG_TWL_PCTL_OGN_MAX ? s_strRatingOgn[ pPC->ogn ] : s_strRatingOgn[ LCFG_TWL_PCTL_OGN_MAX ] );
OS_TPrintf( " RatingAge : %d\n", pPC->ratingAge );
OS_TPrintf( " SecretQ ID : %d\n", pPC->secretQuestionID );
OS_TPrintf( " Password : %s\n", pPC->password );
MI_CpuClear8( string, sizeof(string) );
srcLen = (int)pPC->secretAnswerLength;
dstLen = sizeof(string);
STD_ConvertStringUnicodeToSjis( string, &dstLen, pPC->secretAnswer, &srcLen, NULL );
OS_TPrintf( " SecretAnswer : %s\n", string );
}
{
int i;
const u8 *p = OS_GetMovableUniqueIDPtr();
OS_TPrintf( "MovableUniqueID :" );
for( i = 0; i < OS_TWL_HWINFO_MOVABLE_UNIQUE_ID_LEN; i++ ) {
if( ( i & 0x0f ) == 0 ) {
OS_TPrintf( "\n" );
}
OS_TPrintf( " %02x,", *p++ );
}
OS_TPrintf( "\n" );
}
OS_TPrintf( "ForceDisableWireless : %s\n", OS_IsForceDisableWireless() ? "TRUE" : "FALSE" );
OS_TPrintf( "Region : %02x %s\n", OS_GetRegion(), ( OS_GetRegion() == 0xff ) ? "Invalid" : s_strRegion[ OS_GetRegion() ] );
{
u8 string[ 16 ];
OS_GetSerialNo( string );
OS_TPrintf( "SerialNo : %s\n", string );
}
OS_TPrintf("***End of demo\n");
OS_Terminate();
}
/*---------------------------------------------------------------------------*
Name: VBlankIntr
Description: main
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void VBlankIntr(void)
{
OS_SetIrqCheckFlag(OS_IE_V_BLANK);
}
static char *s_strRegion[] = {
"JAPAN",
"AMERICA",
"EUROPA",
"AUSTRALIA",
"CHINA",
"KOREA",
};
static char *s_strUserColor[] = {
"GRAY ",
"BROWN ",
"RED ",
"PINK ",
"ORANGE ",
"YELLOW ",
"LIME_GREEN",
"GREEN ",
"DARK_GREEN",
"SEA_GREEN ",
"TURQUOISE ",
"BLUE ",
"DARK_BLUE ",
"PURPLE ",
"VIOLET ",
"MAGENTA ",
};
static char *s_strLanguage[] = {
"JAPANESE",
"ENGLISH",
"FRENCH",
"GERMAN",
"ITALIAN",
"SPANISH",
"CHINESE",
"KOREAN",
};
static char *s_strRatingOgn[] = {
"CERO",
"ESRB",
"RESERVED2",
"USK",
"PEGI_GENERAL",
"RESERVED5",
"PEGI_PORTUGAL",
"PEGI_BBFC",
"OFLC",
"GRB",
"RESERVED_A",
"RESERVED_B",
"RESERVED_C",
"RESERVED_D",
"RESERVED_E",
"UNKNOWN",
};
static char *s_strCountry[] = {
"UNDEFINED ", // 未設定
"JAPAN ", // 日本
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"Anguilla ", // アンギラ
"ANTIGUA_AND_BARBUDA", // アンティグア・バーブーダ
"ARGENTINA ", // アルゼンチン
"ARUBA", // アルバ
"BAHAMAS", // バハマ
"BARBADOS", // バルバドス
"BELIZE", // ベリーズ
"BOLIVIA", // ボリビア
"BRAZIL", // ブラジル
"BRITISH_VIRGIN_ISLANDS", // 英領ヴァージン諸島
"CANADA", // カナダ
"CAYMAN_ISLANDS", // ケイマン諸島
"CHILE ", // チリ
"COLOMBIA", // コロンビア
"COSTA_RICA", // コスタリカ
"DOMINICA", // ドミニカ国
"DOMINICAN_REPUBLIC", // ドミニカ共和国
"ECUADOR", // エクアドル
"EL_SALVADOR", // エルサルバドル
"FRENCH_GUIANA", // フランス領ギアナ
"GRENADA", // グレナダ
"GUADELOUPE", // グアドループ
"GUATEMALA ", // グアテマラ
"GUYANA", // ガイアナ
"HAITI", // ハイチ
"HONDURAS", // ホンジュラス
"JAMAICA", // ジャマイカ
"MARTINIQUE", // マルティニーク
"MEXICO", // メキシコ
"MONTSERRAT", // モントセラト
"NETHERLANDS_ANTILLES", // オランダ領アンティル
"NICARAGUA", // ニカラグア
"PANAMA ", // パナマ
"PARAGUAY", // パラグアイ
"PERU", // ペルー
"ST_KITTS_AND_NEVIS", // セントキッツ・ネイビス
"ST_LUCIA", // セントルシア
"ST_VINCENT_AND_THE_GRENADINES", // セントビンセント・グレナディーン
"SURINAME", // スリナム
"TRINIDAD_AND_TOBAGO", // トリニダード・トバゴ
"TURKS_AND_CAICOS_ISLANDS", // タークス・カイコス諸島
"UNITED_STATES", // アメリカ
"URUGUAY ", // ウルグアイ
"US_VIRGIN_ISLANDS", // 米領バージン諸島
"VENEZUELA", // ベネズエラ
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"ALBANIA ", // アルバニア
"AUSTRALIA", // オーストラリア
"AUSTRIA", // オーストリア
"BELGIUM", // ベルギー
"BOSNIA_AND_HERZEGOVINA", // ボスニア・ヘルツェゴビナ
"BOTSWANA", // ボツワナ
"BULGARIA ", // ブルガリア
"CROATIA", // クロアチア
"CYPRUS", // キプロス
"CZECH_REPUBLIC", // チェコ
"DENMARK", // デンマーク
"ESTONIA", // エストニア
"FINLAND", // フィンランド
"FRANCE", // フランス
"GERMANY", // ドイツ
"GREECE", // ギリシャ
"HUNGARY ", // ハンガリー
"ICELAND", // アイスランド
"IRELAND", // アイルランド
"ITALY", // イタリア
"LATVIA", // ラトビア
"LESOTHO", // レソト
"LIECHTENSTEIN", // リヒテンシュタイン
"LITHUANIA", // リトアニア
"LUXEMBOURG", // ルクセンブルク
"MACEDONIA", // マケドニア
"MALTA ", // マルタ
"MONTENEGRO", // モンテネグロ
"MOZAMBIQUE", // モザンビーク
"NAMIBIA", // ナミビア
"NETHERLANDS", // オランダ
"NEW_ZEALAND", // ニュージーランド
"NORWAY", // ノルウェー
"POLAND", // ポーランド
"PORTUGAL", // ポルトガル
"ROMANIA", // ルーマニア
"RUSSIA ", // ロシア
"SERBIA", // セルビア
"SLOVAKIA", // スロバキア
"SLOVENIA", // スロベニア
"SOUTH_AFRICA", // 南アフリカ
"SPAIN", // スペイン
"SWAZILAND", // スワジランド
"SWEDEN", // スウェーデン
"SWITZERLAND", // スイス
"TURKEY", // トルコ
"UNITED_KINGDOM ", // イギリス
"ZAMBIA", // ザンビア
"ZIMBABWE", // ジンバブエ
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"TAIWAN ", // 台湾
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"SOUTH_KOREA ", // 韓国
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"HONG_KONG ", // ホンコン
"MACAU", // マカオ
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"INDONESIA ", // インドネシア
"SINGAPORE ", // シンガポール
"THAILAND ", // タイ
"PHILIPPINES", // フィリピン
"MALAYSIA", // マレーシア
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"CHINA ", // 中国
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UAE ", // アラブ首長国連邦
"INDIA ", // インド
"EGYPT ", // エジプト
"OMAN", // オマーン
"QATAR", // カタール
"KUWAIT", // クウェート
"SAUDI_ARABIA", // サウジアラビア
"SYRIA", // シリア
"BAHRAIN", // バーレーン
"JORDAN", // ヨルダン
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"UNKNOWN",
"OTHERS ",
"UNKNOWN ",
};

View File

@ -1,42 +0,0 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlSDK - demos - FS - overlay
# 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_PLATFORM = TWL
TWL_ARCHGEN = LIMITED
SUBDIRS =
#----------------------------------------------------------------------------
TARGET_BIN = main.srl
SRCS = main.c loadSharedFont.c
LLIBRARIES += libsharedfont$(TWL_LIBSUFFIX).a libna$(TWL_LIBSUFFIX).a
ROM_SPEC = ROM-TS_nand.rsf
include $(TWLSDK_ROOT)/build/buildtools/commondefs
include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -1,263 +0,0 @@
#----------------------------------------------------------------------------
# Project: TwlSDK - include
# File: ROM-TS.rsf
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded insructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Date:: $
# $Rev$
# $Author$
#----------------------------------------------------------------------------
#
# TWL ROM SPEC FILE
#
Arm9
{
Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)"
OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)"
OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)"
Elf "$(MAKEROM_ARM9:r).tef"
}
Arm7
{
Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)"
OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)"
OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)"
Elf "$(MAKEROM_ARM7_BASE:r).tef"
}
Arm9.Ltd
{
Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)"
OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)"
OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)"
}
Arm7.Ltd
{
Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)"
OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)"
OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)"
}
Property
{
###
### Settings for FinalROM
###
#### BEGIN
#
# TITLE NAME: Your product name within 12bytes
#
#TitleName "MY APP NAME"
#
# 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 128M
#RomSize 256M
#
# 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 ./etc/myGameBanner.bnr
BannerFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr
#
# Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE]
#
#PermitLandingNormalJump FALSE
#
# Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE]
#
#PermitLandingTmpJump FALSE
###
### Setting for TWL
###
#
# ROM HEADER Ltd: Provided to every product by NINTENDO
#
RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin
#
# Digest parameters:
#
DigestParam 1024 32
#
# WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD
# MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD]
# don't have to edit
#
WramMapping $(MAKEROM_WRAM_MAPPING)
#
# CardRegion: card region [Japan/America/Europe/Australia/China/Korea]
#
CardRegion ALL
#
# SDCardAccess: sd card access control [TRUE/FALSE]
#
#SDCardAccess FALSE
#
# NANDAccess: NAND access control [TRUE/FALSE]
#
#NANDAccess FALSE
#
# Codec mode:
# don't have to edit
#
CodecMode $(MAKEROM_CODEC_MODE)
#
# Disp WiFiConnection Icon for Launcher [TRUE/FALSE]
#
#WiFiConnectionIcon FALSE
#
# Disp DSWireless Icon for Launcher [TRUE/FALSE]
#
#DSWirelessIcon FALSE
#
# Disable debug [TRUE/FALSE]
#
DisableDebug FALSE
#
# Agree EULA [TRUE/FALSE]
#
#AgreeEULA FALSE
#
# Agree EULA version [0 - 255]
#
#AgreeEULAVersion 0
###
#### END
}
AppendProperty
{
#
# Boot allowed Media: [GameCard]
#
Media NAND
#
# GameCode for TitleID : Your GameCode in 4 ascii words
#
#GameCode ABCJ
#
# Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M]
#
#PublicSaveDataSize 0K
#
# Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M]
#
#PrivateSaveDataSize 0K
#
# Enable SubBannerFile
#SubBannerFile TRUE
#
# Use Shared2 file index: [0-65535]
#Shared2FileIndex 0
#
# Use Shared2 file size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M]
#Shared2FileSize 0K
#
# Game card power on: [TRUE/FALSE]
#
#GameCardOn FALSE
}
RomSpec
{
Offset 0x00000000
Segment ALL
HostRoot $(MAKEROM_ROMROOT)
Root /
File $(MAKEROM_ROMFILES)
}
Rating
{
#
# Permited age to play for each rating organization [0 - 31, ALWAYS, FREE]
#
# Supported organization
# - CERO (OGN0) : for Japan
# - ESRB (OGN1) : for North America
# - BBFC (OGN2) : obsolete organization
# - USK (OGN3) : for German
# - PEGI_GEN (OGN4) : for Europe
# - PEGI_FINLAND (OGN5) : obsolete organization
# - PEGI_PRT (OGN6) : for Portugal
# - PEGI_BBFC (OGN7) : for UK
# - OFLC (OGN8) : for Australia and NewZealand
# - GRB (OGN9) : for Korea
# - OGN10 : reserved
# - OGN11 : reserved
# - OGN12 : reserved
# - OGN13 : reserved
# - OGN14 : reserved
# - OGN15 : reserved
#
# Available age [ 0 - 31 / ALWAYS / FREE ]
CERO FREE
# ESRB FREE
# USK FREE
# PEGI_GEN FREE
# PEGI_PRT FREE
# PEGI_BBFC FREE
# OFLC FREE
# GRB FREE
}

View File

@ -1,147 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL
File: loadSharedFont.c
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.h>
#include "loadSharedFont.h"
// extern data-----------------------------------------------------------------
// define data-----------------------------------------------------------------
#define FONT_LOAD_THREAD_PRIO 13
#define THREAD_STACK_SIZE 1024
// function's prototype-------------------------------------------------------
// global variable-------------------------------------------------------------
BOOL g_isSucceededLoad[ OS_SHARED_FONT_CN_KR_MAX + 1 ];
const char *str_fontname[ OS_SHARED_FONT_CN_KR_MAX + 1 ] = {
"SHARE_FONT_WW_L",
"SHARE_FONT_WW_M",
"SHARE_FONT_WW_S",
"SHARE_FONT_CN_L",
"SHARE_FONT_CN_M",
"SHARE_FONT_CN_S",
"SHARE_FONT_KR_L",
"SHARE_FONT_KR_M",
"SHARE_FONT_KR_S",
"SHARE_FONT_CN_KR_MAX",
};
// static variable-------------------------------------------------------------
static u64 s_fontLoadThreadStack[THREAD_STACK_SIZE / sizeof(u64)];
static OSThread s_fontLoadThread;
static OSTick s_fontLoadStartTick;
static u8 *s_pFontBuffer[ OS_SHARED_FONT_CN_KR_MAX + 1 ]; // 読み込みはテストなのでロード先はstatic変数にしている。
static BOOL s_isStarted = FALSE;
// const data------------------------------------------------------------------
// ============================================================================
// 共有フォントロード
// ============================================================================
BOOL LoadSharedFontInit( void )
{
u8 *pBuffer;
int size;
s_fontLoadStartTick = OS_GetTick();
// ロードスレッド生成
OS_CreateThread(&s_fontLoadThread,
LoadSharedFontThread,
NULL,
s_fontLoadThreadStack + THREAD_STACK_SIZE / sizeof(u64),
THREAD_STACK_SIZE, FONT_LOAD_THREAD_PRIO);
// フォントロード準備
if( !OS_InitSharedFont() ) {
OS_TPrintf( "OS_InitSharedFont failed.\n" );
return FALSE;
}
size = OS_GetSharedFontTableSize();
if( size < 0 ) {
OS_TPrintf( "OS_GetSharedTableSize failed.\n" );
return FALSE;
}
pBuffer = OS_Alloc( (u32)size );
if( pBuffer == NULL ) {
OS_TPrintf( "malloc failed.\n" );
return FALSE;
}
if( !OS_LoadSharedFontTable( pBuffer ) ) {
OS_TPrintf( "OS_LoadSharedTable failed.\n" );
return FALSE;
}
// ロードスレッド起動
OS_WakeupThreadDirect(&s_fontLoadThread);
s_isStarted = TRUE;
return TRUE;
}
void LoadSharedFontThread( void *arg )
{
#pragma unused(arg)
BOOL retval = TRUE;
OSSharedFontIndex i;
for( i = OS_SHARED_FONT_WW_L; i < OS_SHARED_FONT_CN_KR_MAX + 1; i++ ) {
int size;
OS_TPrintf( "%s read.\n", str_fontname[ i ] );
size = OS_GetSharedFontSize( i );
if( size < 0 ) {
OS_TPrintf( " get font size failed.\n" );
retval = FALSE;
}
// FSのキャッシュが怪しそうなので、とりあえずアラインメントをとっておく。
size = MATH_ROUNDUP( size, 32 );
s_pFontBuffer[ i ] = OS_Alloc( (u32)size );
if( s_pFontBuffer[ i ] == NULL ) {
OS_TPrintf( " malloc failed.\n" );
retval = FALSE;
}
if( OS_LoadSharedFont( i, s_pFontBuffer[ i ] ) ) {
OS_TPrintf( " load succeeded.\n" );
g_isSucceededLoad[ i ] = TRUE;
}else {
OS_TPrintf( " load failed.\n" );
g_isSucceededLoad[ i ] = FALSE;
retval = FALSE;
}
}
OS_TPrintf( "Shared Font load time = %dms\n", OS_TicksToMilliSeconds( OS_GetTick() - s_fontLoadStartTick ) );
}
BOOL IsFinishedLoadSharedFont( void )
{
if( s_isStarted ) {
return OS_IsThreadTerminated( &s_fontLoadThread );
}else {
return TRUE;
}
}

View File

@ -1,42 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL
File: loadSharedFont.h
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$
*---------------------------------------------------------------------------*/
#ifndef __LOAD_SHARED_FONT_H__
#define __LOAD_SHARED_FONT_H__
#include <twl.h>
#include <twl/os/common/sharedFont.h>
#ifdef __cplusplus
extern "C" {
#endif
// define data-------------------------------------------------------
// global variables--------------------------------------------------
extern BOOL g_isSucceededLoad[ OS_SHARED_FONT_CN_KR_MAX + 1 ];
extern const char *str_fontname[ OS_SHARED_FONT_CN_KR_MAX + 1 ];
// function----------------------------------------------------------
BOOL LoadSharedFontInit( void );
void LoadSharedFontThread( void *arg );
BOOL IsFinishedLoadSharedFont( void );
#ifdef __cplusplus
}
#endif
#endif // __LOAD_SHARED_FONT_H__

View File

@ -1,98 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - demos - FS - overlay
File: main.c
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 <nitro.h>
#include "DEMO.h"
#include "loadSharedFont.h"
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
Name: NitroMain
Description:
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void NitroMain(void)
{
OS_Init();
OS_InitTick();
(void)OS_EnableIrq();
(void)OS_EnableInterrupts();
{
OSHeapHandle hh;
void *tmp;
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_TPanic("ARM9: Fail to create heap...\n");
}
(void)OS_SetCurrentHeap(OS_ARENA_MAIN, hh);
}
DEMOInitCommon();
DEMOInitVRAM();
DEMOInitDisplayBitmap();
DEMOHookConsole();
DEMOSetBitmapTextColor(GX_RGBA(31, 31, 0, 1));
DEMOSetBitmapGroundColor(DEMO_RGB_CLEAR);
DEMOStartDisplay();
FS_Init(FS_DMA_NOT_USE);
OS_TPrintf("--------------------------------\n"
"Shared Font sample.\n");
if( LoadSharedFontInit() ) {
while( !IsFinishedLoadSharedFont() ) {
OS_WaitVBlankIntr();
}
// 結果表示
{
int i;
int ox = 10;
int oy = 60;
DEMOFillRect(0, 0, GX_LCD_SIZE_X, GX_LCD_SIZE_Y, DEMO_RGB_CLEAR);
DEMOSetBitmapTextColor(GX_RGBA(0, 31, 0, 1));
DEMOSetBitmapTextColor(GX_RGBA(31, 31, 31, 1));
DEMODrawFrame(ox, oy, 240, 10 + ( OS_SHARED_FONT_CN_KR_MAX + 1 ) * 10, GX_RGBA( 0, 31, 0, 1));
for (i = 0; i < OS_SHARED_FONT_CN_KR_MAX + 1; ++i)
{
DEMODrawText(ox + 10, oy + 5 + i * 10, "%s load %s",
str_fontname[ i ], g_isSucceededLoad[ i ] ? "suceeded" : "failed");
}
}
DEMO_DrawFlip();
OS_WaitVBlankIntr();
}
OS_Terminate();
}

View File

@ -1,60 +0,0 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlSDK - demos - simpleShoot-1
# File: Makefile
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Date:: $
# $Rev$
# $Author$
#----------------------------------------------------------------------------
SUBDIRS =
#----------------------------------------------------------------------------
TARGET_FIRM = SYSTEMMENU
TARGET_PLATFORM = TWL
TWL_ARCHGEN = LIMITED
TARGET_NUMBER = 0
TARGET_NAME = CreateDevKP
TARGET_BIN = $(TARGET_NAME).srl
TITLEID_LO = CDKP
#TARGET_TAD = $(BINDIR)/$(TITLEID_LO).$(TWL_BUILD_DIR)$(CODEGEN_ARCH).tad
ROM_SPEC = main.rsf
MISC_DIR = ../../../systemMenu_RED/misc
SRCS = main.c RomTypeTest.c \
$(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c
LINCLUDES = $(MISC_DIR)/include
MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)'
MAKETAD_FLAGS += -s
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe
#LDIRT_CLEAN = $(TARGET_TAD)
#----------------------------------------------------------------------------
do-build : $(TARGETS)
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
#----------------------------------------------------------------------------
#===== End of Makefile =====

View File

@ -1,204 +0,0 @@
#----------------------------------------------------------------------------
# Project: TwlSDK - include
# File: ROM-BB.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 128M
#RomSize 256M
#
# 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_0.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 $(MAKEROM_WRAM_MAPPING)
#
# CardRegion: card region [Japan/America/Europe/Australia/China/Korea]
#
CardRegion ALL
#
# Codec mode:
# don't have to edit
#
CodecMode $(MAKEROM_CODEC_MODE)
#
# SDCardAccess: sd card access control [TRUE/FALSE]
#
#SDCardAccess TRUE
SDCardAccess FALSE
#
# NandAccess: nand access control [TRUE/FALSE]
#
NANDAccess TRUE
###
#### END
}
AppendProperty
{
#
# Publisher : "Nintendo"
# don't have to edit
Publisher Nintendo
#
# Application type : [USER/SYSTEM]
# don't have to edit
#AppType USER
AppType SYSTEM
#
# launch title on the launcher : [TRUE/FALSE]
# don't have to edit
Launch TRUE
#
# Boot allowed Media: [GameCard/NAND]
#
Media GameCard
#Media NAND
#
# Secure title : [TRUE/FALSE]
# don't have to edit
Secure TRUE
#Secure FALSE
#
# 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 ../../../systemMenu_RED/data
Root /data
File NTR_IPL_font_m.NFTR
}

View File

@ -1,143 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL
File: DS_Chat.c
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.h>
#include <sysmenu.h>
#include "misc.h"
#include "RomTypeTest.h"
// define data------------------------------------------
#define RETURN_BUTTON_TOP_X 2
#define RETURN_BUTTON_TOP_Y 21
#define RETURN_BUTTON_BOTTOM_X ( RETURN_BUTTON_TOP_X + 8 )
#define RETURN_BUTTON_BOTTOM_Y ( RETURN_BUTTON_TOP_Y + 2 )
#define ENABLE_CONTENT 0
#define ENABLE_SHARED2 0
#if (ENABLE_CONTENT == 1)
#define CTRUE TRUE
#else
#define CTRUE FALSE
#endif
#if (ENABLE_SHARED2 == 1)
#define STRUE TRUE
#else
#define STRUE FALSE
#endif
#define TEST_NUM 15
typedef enum AccessPermission {
PERMISSION_NA = 0,
PERMISSION_RO,
PERMISSION_RW,
PERMISSION_ERROR,
PERMISSION_MAX
}
AccessPermission;
// extern data------------------------------------------
// function's prototype declaration---------------------
static AccessPermission RWExTestCore( char *path, char *testfile );
static AccessPermission SRLTest( void );
static AccessPermission ContentTest( void );
static void FinalizeRWTest( FSFile *file, char* filename );
static AccessPermission RWTestCore( char *path, char *testfile );
static AccessPermission RWTest( char *path );
static void TestFSPermission( void );
// global variable -------------------------------------
RTCDrawProperty g_rtcDraw = {
TRUE, RTC_DATE_TOP_X, RTC_DATE_TOP_Y, RTC_TIME_TOP_X, RTC_TIME_TOP_Y
};
// static variable -------------------------------------
// const data -----------------------------------------
static BOOL CreateFile( void )
{
int len;
FSFile file[1];
FS_InitFile( file );
// ファイル作成テスト
if ( FS_CreateFile("nand:/sys/dev.kp", FS_PERMIT_R | FS_PERMIT_W) )
{
// ファイルオープン
if ( !FS_OpenFileEx( file, "nand:/sys/dev.kp", FS_FILEMODE_W ) )
{
// ファイルオープン失敗
OS_TPrintf("%s:open failed.\n","nand:/sys/dev.kp");
return FALSE;
}
// ファイルライト
len = FS_WriteFile( file, "test", 5);
if( len != 5 )
{
// ライト失敗
OS_TPrintf("%s:write failed.\n","nand:/sys/dev.kp");
return FALSE;
}
// ファイルクローズ
if( !FS_CloseFile( file ) )
{
// クローズ失敗
OS_TPrintf("%s:close failed.\n","nand:/sys/dev.kp");
return FALSE;
}
}else
{
OS_TPrintf("%s:create failed.\n","nand:/sys/dev.kp");
return FALSE;
}
return TRUE;
}
// テストプログラムの初期化
void RomTypeTestInit( void )
{
BOOL res;
GX_DispOff();
GXS_DispOff();
NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_WHITE );
PrintfSJIS( 1 * 8, 9 * 8, TXT_COLOR_BLACK, "CreateFile");
GXS_SetVisiblePlane( GX_PLANEMASK_BG0 );
GX_DispOn();
GXS_DispOn();
res = CreateFile();
if(res)
{
PutStringUTF16( 1 * 8, 11 * 8, TXT_COLOR_BLACK, (const u16 *)L"Succeed." );
}else
{
PutStringUTF16( 1 * 8, 11 * 8, TXT_COLOR_BLACK, (const u16 *)L"NG." );
}
}

View File

@ -1,35 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL
File: RomTypeTest.h
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$
*---------------------------------------------------------------------------*/
#ifndef __ROM_TYPE_TEST_H__
#define __ROM_TYPE_TEST_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <twl.h>
// define data----------------------------------------------------------
void RomTypeTestInit( void );
#ifdef __cplusplus
}
#endif
#endif // __ROM_TYPE_TEST_H__

View File

@ -1,85 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL
File: main.c
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.h>
#include "misc.h"
#include "RomTypeTest.h"
// extern data-----------------------------------------------------------------
// define data-----------------------------------------------------------------
// function's prototype-------------------------------------------------------
static void INTR_VBlank( void );
// global variable-------------------------------------------------------------
// static variable-------------------------------------------------------------
// const data------------------------------------------------------------------
// ============================================================================
// function's description
// ============================================================================
void TwlMain(void)
{
// 初期化----------------------------------
OS_Init();
(void)OS_EnableIrq();
(void)OS_EnableInterrupts();
GX_Init();
GX_SetPower(GX_POWER_ALL); // 各ロジック パワーON
// 割り込み許可----------------------------
(void)OS_SetIrqFunction(OS_IE_V_BLANK, INTR_VBlank);
(void)OS_EnableIrqMask(OS_IE_V_BLANK);
(void)GX_VBlankIntr(TRUE);
// デバイス初期化-------------------------------
TP_Init();
(void)RTC_Init();
// システムの初期化------------------
InitAllocator();
InitBG();
RomTypeTestInit();
// メインループ----------------------------
while(1){
OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち
ReadKeyPad(); // キー入力の取得
ReadTP(); // TP入力の取得
}
}
// ============================================================================
// 割り込み処理
// ============================================================================
// Vブランク割り込み
static void INTR_VBlank(void)
{
OS_SetIrqCheckFlag(OS_IE_V_BLANK); // Vブランク割込チェックのセット
}

View File

@ -1,30 +0,0 @@
#! 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 $(TWLSDK_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = banner ARM9
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -1,48 +0,0 @@
#! 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
BNRNUM = 0
ICON_DIR = ./icon
BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf
MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe
TARGETS = banner_$(BNRNUM).bnr
INSTALL_DIR = ./
INSTALL_TARGETS = $(TARGETS)
BANNER_ICON_NAME = $(basename $(BANNER_ICON))
LDIRT_CLEAN = $(TARGETS) \
$(TARGETS:.bnr=.srl)
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
#----------------------------------------------------------------------------
# build
#----------------------------------------------------------------------------
do-build: $(TARGETS)
$(TARGETS): $(BANNER_SPEC)
$(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS)
#

Binary file not shown.

Before

Width:  |  Height:  |  Size: 630 B

View File

@ -1,74 +0,0 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlSDK - components - armadillo.TWL
# File: Makefile
#
# Copyright 2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Date:: $
# $Rev$
# $Author$
#----------------------------------------------------------------------------
override TARGET_PLATFORM = TWL
override TWL_PROC = ARM7
override TWL_ARCHGEN = LIMITED
##override TWL_PLATFORM = TS
TWL_NO_STD_PCHDR = True
override TARGET_CODEGEN = ARM
ifndef TWLSDK_NOCRYPTO
#----------------------------------------------------------------------------
SRCS = main.c \
kami_pxi.c \
formatter.c
TARGET_NAME = armadillo
TARGET_NEF = $(TARGET_NAME).tef
LCFILE_SPEC = $(TARGET_NAME).lsf
LCFILE_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).lcf.template
LDRES_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).response.template
CRT0_O = crt0.SCR.TWL.o
# スタック不足防止の為、インライン展開せずにコンパイルする
CCFLAGS_OPT = -O4 -inline off
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/commondefs
MACRO_FLAGS += -DSDK_ARM7COMP_LTD -DSDK_SEA
MAKELCF_FLAGS += -DISDBG_LIBS_TWL='$(if $(ISDBG_LIBS_TWL),$(ISDBG_LIBS_TWL),libstubsistd_sp$(TWL_LIBSUFFIX).a)' \
-DISDBG_LIBS_NITRO='libstubsisd_sp$(TWL_LIBSUFFIX).a'
LINCLUDES = $(ROOT)/build/libraries/spi/ARM7/include \
../common/include \
../../../systemMenu_tools/common/ARM7/include \
SRCDIR += ../../../systemMenu_tools/common/ARM7/src
LLIBRARIES += libwl_sp$(TWL_LIBSUFFIX).a \
libsdio_sp$(TWL_LIBSUFFIX).a \
libathdrv_sp$(TWL_LIBSUFFIX).a \
libwpa_sp$(TWL_LIBSUFFIX).a \
LDEPENDS_NEF = $(TWL_LIBS) $(LLIBRARIES)
do-build: $(TARGETS)
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#----------------------------------------------------------------------------
endif #ifndef TWLSDK_NOCRYPTO
#===== End of Makefile =====

View File

@ -1,86 +0,0 @@
#----------------------------------------------------------------------------
# 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)
}

View File

@ -1,44 +0,0 @@
/*---------------------------------------------------------------------------*
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
*---------------------------------------------------------------------------*/

View File

@ -1,262 +0,0 @@
/*---------------------------------------------------------------------------*
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>

View File

@ -1,576 +0,0 @@
/*---------------------------------------------------------------------------*
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 -
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 -
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();
}
}

View File

@ -1,57 +0,0 @@
#----------------------------------------------------------------------------
# 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)
}

View File

@ -1,150 +0,0 @@
#! make -f
#----------------------------------------------------------------------------
# Project: SystemUpdater
# File: Makefile
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Date:: $
# $Rev$
# $Author$
#----------------------------------------------------------------------------
#============================================================================
#製品鍵を使った書き込みを行う場合は、TwlIPL/build/buildtools/commondefsの"FIRM_USE_PRODUCT_KEYS=TRUE"を有効にしてください。
#============================================================================
# COMPILE SWITCH for build SystemUpdater
IGNORE_VERSION_CHECK ?= TRUE
# MAKEROM SWITCH for build SystemUpdater
SYSM_DISABLE_DEBUG ?= TRUE
TARGET_FIRM = SYSTEMMENU
TARGET_PLATFORM = TWL
TWL_ARCHGEN = LIMITED
#TARGET_CODEGEN = THUMB
TITLEID_LO = 0SUA
#TARGET_TAD =
TARGET_BIN = CustomSystemUpdater_$(SYSM_REGION).srl
LCFILE_SPEC = ARM9-TS.lsf
ROM_SPEC = main.rsf
MAKEROM_ARM7_BASE = ../ARM7.TWL/bin/$(TWL_BUILDTYPE_ARM7)/armadillo
MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT)
SRCS = main.c \
font_data.c \
graphics.c \
kami_font.c \
import.c \
hwi.c \
kami_pxi.c \
kami_write_nandfirm.c \
hw_info.c \
keypad.c \
kami_copy_file.c \
debugger_hw_reset_control.c \
debugger_card_rom.c
LINCLUDES = include \
../common/include \
$(ROOT)/build/libraries/lcfg/ARM9.TWL/include \
$(ROOT)/build/libraries/fs/common/include \
../../../systemMenu_tools/common/ARM9/include \
SRCDIR = src \
../../../systemMenu_tools/HWInfoWriter/ARM9/src \
../../../systemMenu_tools/common/ARM9/src \
#LCFILE = # using default
DATA_ROOT = ../data
ROMSET_FILE = ../romset
ROM_CHECKER = ../romchecker.rb
SUMAKER = ../sumaker.rb custom
#----------------------------------------------------------------------------
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),)
ifdef FIRM_USE_PRODUCT_KEYS
MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo.der' \
-DHWID_PRIVKEY='private_HWID.der'
else
MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo_dev.der' \
-DHWID_PRIVKEY='private_HWID_dev.der'
endif
endif
ifeq ($(IGNORE_VERSION_CHECK),TRUE)
MACRO_FLAGS += -DIGNORE_VERSION_CHECK
endif
MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \
-DPRIVKEY_PATH='$(TWL_KEYSDIR)/rsa' \
-DCARD_REGION='$(CARD_REGION)' \
-DDISABLE_DEBUG='$(SYSM_DISABLE_DEBUG)'
MAKETAD_FLAGS += -s
SYSMENU_LIBS = \
libnamut$(TWL_LIBSUFFIX).a \
libsysmenu$(TWL_LIBSUFFIX).a
SDK_APPEND_LIBS = \
libes$(TWL_LIBSUFFIX).a \
libboc$(TWL_LIBSUFFIX).a \
libsfs$(TWL_LIBSUFFIX).a \
libnam$(TWL_LIBSUFFIX).a \
libsea$(TWL_LIBSUFFIX).a \
liblcfg$(TWL_LIBSUFFIX).a
LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS)
MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe
#LDIRT_CLEAN =
INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN)
#INSTALL_DIR = $(SDK_NMENU_DATADIR)
INSTALL_DIR = ../bin
#----------------------------------------------------------------------------
#include $(ROMSET_FILE)
.PHONY: build_time check_rom sumaker
check_rom:
ifeq ($(DISABLE_ROMCHECK),)
$(ROM_CHECKER) $(ROMSET) $(SYSM_REGION)
$(ROM_CHECKER) $(ROMSET) VERUP
endif
#ifeq ($(DISABLE_ROMCHECK),)
# $(ROM_CHECKER) $(DATA_ROOT)/$(ROMSET)
#endif
build_time:
echo -n "#define BUILD_TIME \"`date \"+%Y/%m/%d %H:%M:%S\"`\"" > include/build_time.h
sumaker:
$(SUMAKER) $(ROMSET) $(SYSM_REGION)
do-build: sumaker check_rom build_time $(TARGETS)
#include $(TWLSDK_ROOT)/build/buildtools/modulerules
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -1,48 +0,0 @@
/*---------------------------------------------------------------------------*
Project: SystemUpdater
File: graphics.h
Copyright 2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Date:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#ifndef GRAPHICS_H_
#define GRAPHICS_H_
#ifdef __cplusplus
extern "C" {
#endif
/*===========================================================================*/
#include <nitro.h>
/*---------------------------------------------------------------------------*
ŠÖ<EFBFBD>è`
*---------------------------------------------------------------------------*/
void InitGraphics(void);
void DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color);
void DrawQuad(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color);
void DrawResult(BOOL result);
/*===========================================================================*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* GRAPHICS_H_ */
/*---------------------------------------------------------------------------*
End of file
*---------------------------------------------------------------------------*/

View File

@ -1,71 +0,0 @@
/*---------------------------------------------------------------------------*
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
*---------------------------------------------------------------------------*/

View File

@ -1,49 +0,0 @@
/*---------------------------------------------------------------------------*
Project: SystemUpdater
File: import.h
Copyright 2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Date:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#ifndef PROCESS_IMPORT_H_
#define PROCESS_IMPORT_H_
#ifdef __cplusplus
extern "C" {
#endif
/*===========================================================================*/
#include <nitro.h>
/*---------------------------------------------------------------------------*
Œ^è`
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
ŠÖ<EFBFBD>è`
*---------------------------------------------------------------------------*/
s32 kamiImportTad(int no, int total, const char* path);
/*===========================================================================*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* PROCESS_IMPORT_H_ */
/*---------------------------------------------------------------------------*
End of file
*---------------------------------------------------------------------------*/

View File

@ -1,41 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - SystemUpdater
File: kami_copy_file.h
Copyright 2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Date:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#ifndef KAMI_COPY_FILE_H_
#define KAMI_COPY_FILE_H_
#ifdef __cplusplus
extern "C" {
#endif
/*===========================================================================*/
#include <twl.h>
BOOL kamiCopyFile(char* srcPath, char* dstPath);
/*===========================================================================*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* KAMI_COPY_FILE_H_ */
/*---------------------------------------------------------------------------*
End of file
*---------------------------------------------------------------------------*/

View File

@ -1,94 +0,0 @@
/*---------------------------------------------------------------------------*
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
*---------------------------------------------------------------------------*/

View File

@ -1,89 +0,0 @@
/*---------------------------------------------------------------------------*
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
*---------------------------------------------------------------------------*/

View File

@ -1,52 +0,0 @@
/*---------------------------------------------------------------------------*
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
*---------------------------------------------------------------------------*/

View File

@ -1,48 +0,0 @@
/*---------------------------------------------------------------------------*
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
*---------------------------------------------------------------------------*/

View File

@ -1,734 +0,0 @@
/*---------------------------------------------------------------------------*
Project: SystemUpdater
File: font_data.c
Copyright 2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Date:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#include <nitro.h>
/*---------------------- BGスクリーン ---------------------------*/
const u16 BgScDataMain[32 * 24] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
const u16 BgScDataSub[32 * 24] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
/*---------------------- パレットデータ ---------------------------*/
#define RGB555(r,g,b) (b<<10|g<<5|r)
const u16 PlttDataObj[16][16] = {
{RGB555( 0, 0, 0), RGB555(31, 10, 0), RGB555(31, 0, 0), RGB555(5, 5, 20),}, // Black
{RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red
{RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green
{RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue
{RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow
{RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan
{RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
};
// 上画面コンソール文字列パレット
const u16 PlttDataMain[16][16] = {
{RGB555(31, 31, 31), RGB555(31, 10, 0), RGB555(0, 0, 0), RGB555(0, 0, 0),}, // Orange
{RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red
{RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green
{RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue
{RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow
{RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan
{RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
{RGB555( 5, 5, 5), RGB555( 5, 5, 5), RGB555( 5, 5, 5), RGB555(31, 31, 31),}, // Black
};
// 下画面コンソール文字列パレット
const u16 PlttDataSub[16][16] = {
{RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(25, 25, 25), RGB555(31, 31, 31),}, // Black
{RGB555(31, 31, 31), RGB555(21, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red
{RGB555(31, 31, 31), RGB555( 0, 21, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green
{RGB555(31, 31, 31), RGB555( 0, 0, 21), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue
{RGB555(31, 31, 31), RGB555(21, 21, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow
{RGB555(31, 31, 31), RGB555(0, 21, 21), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan
{RGB555(31, 31, 31), RGB555(21, 0, 21), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
{RGB555(31, 31, 31), RGB555(20, 20, 20), RGB555(20, 20, 20), RGB555(20, 20, 20),}, // Gray
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
// 背景カラーはこの16番パレット
// 白 黒 灰 むらさき ピンク みずいろ 緑 青紫 赤 黄
{RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(20, 20, 20), RGB555(31, 15, 31), RGB555(31, 20, 20), RGB555(20, 29, 31), RGB555(20, 31, 20), RGB555(21, 21, 31), RGB555(31, 0, 0), RGB555(31, 31, 10), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), } // White
};
/*---------------------- キャラクタデータ -------------------------*/
const u32 sampleCharData[8 * 0x100] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x11111111, 0x11111111, // 0001h use for import progress bar
0x11111111, 0x11111111, 0x00000000, 0x00000000,
0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h
0x00100010, 0x00100010, 0x00100001, 0x00100001,
0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h
0x00000001, 0x00000001, 0x00000001, 0x01111110,
0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h
0x00100000, 0x00010000, 0x00001000, 0x00000110,
0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h
0x00010001, 0x00100001, 0x01000000, 0x00000000,
0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h
0x00001000, 0x00101010, 0x01001010, 0x01001001,
0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h
0x00010010, 0x00010010, 0x00010010, 0x00001001,
0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h
0x00011111, 0x00001000, 0x00000001, 0x00011110,
0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h
0x00000001, 0x00000110, 0x00011000, 0x00100000,
0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah
0x00010001, 0x00010001, 0x00010001, 0x00001010,
0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh
0x00000000, 0x00000001, 0x00000001, 0x00111110,
0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch
0x00010000, 0x00000001, 0x00000001, 0x00011110,
0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh
0x01000001, 0x01000001, 0x00100010, 0x00011100,
0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh
0x00010100, 0x00010100, 0x00011000, 0x00001100,
0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh
0x00010010, 0x00000010, 0x00000010, 0x00111100,
0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h
0x00111111, 0x00000100, 0x00000100, 0x00011000,
0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h
0x01110100, 0x00000010, 0x00001010, 0x01110010,
0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h
0x00011110, 0x00100001, 0x00100000, 0x00011110,
0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h
0x01000000, 0x01000000, 0x00100000, 0x00011100,
0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h
0x00001000, 0x00001000, 0x00001000, 0x00110000,
0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h
0x00000010, 0x00000001, 0x00000001, 0x00111110,
0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h
0x00010001, 0x00111001, 0x01010101, 0x00011001,
0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h
0x00010001, 0x00010001, 0x00001010, 0x00000100,
0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h
0x00101001, 0x01010001, 0x01010001, 0x00001100,
0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h
0x00010010, 0x00100001, 0x01000000, 0x00000000,
0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah
0x00010001, 0x00011001, 0x00110101, 0x00001001,
0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh
0x00010001, 0x00111001, 0x01010101, 0x00011001,
0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch
0x00010001, 0x00010001, 0x00001010, 0x00000100,
0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh
0x00101001, 0x01010001, 0x01010001, 0x00001100,
0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh
0x00010010, 0x00100001, 0x01000000, 0x00000000,
0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh
0x00010001, 0x00011001, 0x00110101, 0x00001001,
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h
0x00001000, 0x00001000, 0x00000000, 0x00001000,
0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h
0x00100100, 0x01111111, 0x00010010, 0x00010010,
0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h
0x00111110, 0x01001000, 0x00111111, 0x00001000,
0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h
0x00001000, 0x00100100, 0x01010010, 0x00100001,
0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h
0x01000110, 0x00101001, 0x00110001, 0x01001110,
0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h
0x00000100, 0x00000100, 0x00001000, 0x01110000,
0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h
0x00010000, 0x00010000, 0x00001000, 0x00000111,
0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah
0x00011100, 0x00101010, 0x01001001, 0x00001000,
0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh
0x01111111, 0x00001000, 0x00001000, 0x00001000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch
0x00000000, 0x00001100, 0x00001000, 0x00000100,
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh
0x01111111, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh
0x00000000, 0x00000000, 0x00000000, 0x00001100,
0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh
0x00001000, 0x00000100, 0x00000010, 0x00000001,
0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h
0x01000001, 0x01000001, 0x01000001, 0x00111110,
0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h
0x00010000, 0x00010000, 0x00010000, 0x00010000,
0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h
0x00111110, 0x00000001, 0x00000001, 0x01111111,
0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h
0x00111110, 0x01000000, 0x01000001, 0x00111110,
0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h
0x00100100, 0x00100010, 0x01111111, 0x00100000,
0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h
0x01000000, 0x01000000, 0x01000001, 0x00111110,
0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h
0x01000001, 0x01000001, 0x01000001, 0x00111110,
0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h
0x00010000, 0x00010000, 0x00001000, 0x00001000,
0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h
0x00111110, 0x01000001, 0x01000001, 0x00111110,
0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h
0x01000001, 0x01111110, 0x01000000, 0x00111110,
0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah
0x00000000, 0x00000000, 0x00001100, 0x00000000,
0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh
0x00000000, 0x00001100, 0x00001000, 0x00000100,
0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch
0x00000001, 0x00000110, 0x00011000, 0x01100000,
0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh
0x00000000, 0x00000000, 0x01111111, 0x00000000,
0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh
0x01000000, 0x00110000, 0x00001100, 0x00000011,
0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh
0x00110000, 0x00001000, 0x00000000, 0x00001000,
0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h
0x01010101, 0x01010101, 0x01010101, 0x00111010,
0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h
0x00100010, 0x00111110, 0x01000001, 0x01000001,
0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h
0x00111111, 0x01000001, 0x01000001, 0x00111111,
0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h
0x00000001, 0x00000001, 0x01000010, 0x00111100,
0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h
0x01000001, 0x01000001, 0x00100001, 0x00011111,
0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h
0x01111111, 0x00000001, 0x00000001, 0x01111111,
0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h
0x00111111, 0x00000001, 0x00000001, 0x00000001,
0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h
0x01111001, 0x01000001, 0x01000010, 0x00111100,
0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h
0x01111111, 0x01000001, 0x01000001, 0x01000001,
0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h
0x00001000, 0x00001000, 0x00001000, 0x00111110,
0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah
0x01000001, 0x01000001, 0x00100010, 0x00011100,
0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh
0x00000011, 0x00000101, 0x00011001, 0x01100001,
0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch
0x00000001, 0x00000001, 0x00000001, 0x01111111,
0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh
0x01001001, 0x01000001, 0x01000001, 0x01000001,
0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh
0x01001001, 0x01010001, 0x01100001, 0x01000001,
0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh
0x01000001, 0x01000001, 0x00100010, 0x00011100,
0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h
0x00111111, 0x00000001, 0x00000001, 0x00000001,
0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h
0x01000001, 0x01011001, 0x00100010, 0x01011100,
0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h
0x00111111, 0x01000001, 0x01000001, 0x01000001,
0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h
0x00111110, 0x01000000, 0x01000001, 0x00111110,
0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h
0x00001000, 0x00001000, 0x00001000, 0x00001000,
0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h
0x01000001, 0x01000001, 0x00100010, 0x00011100,
0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h
0x00100010, 0x00010100, 0x00010100, 0x00001000,
0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h
0x01001001, 0x01010101, 0x01100011, 0x01000001,
0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h
0x00001000, 0x00010100, 0x00100010, 0x01000001,
0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h
0x00001000, 0x00001000, 0x00001000, 0x00001000,
0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah
0x00001000, 0x00000100, 0x00000010, 0x01111111,
0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh
0x00000100, 0x00000100, 0x00000100, 0x01111100,
0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch
0x00001000, 0x00111110, 0x00001000, 0x00001000,
0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh
0x00010000, 0x00010000, 0x00010000, 0x00011111,
0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh
0x00000000, 0x00000000, 0x00000000, 0x01111111,
0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h
0x00111110, 0x00100001, 0x00100001, 0x01011110,
0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h
0x01000001, 0x01000001, 0x01000001, 0x00111111,
0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h
0x00000001, 0x00000001, 0x01000010, 0x00111100,
0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h
0x01000001, 0x01000001, 0x01000001, 0x01111110,
0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h
0x01111111, 0x00000001, 0x01000001, 0x00111110,
0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h
0x01111111, 0x00001000, 0x00001000, 0x00001000,
0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h
0x01000001, 0x01111110, 0x01000000, 0x00111110,
0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h
0x00111111, 0x01000001, 0x01000001, 0x01000001,
0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h
0x00001000, 0x00001000, 0x00001000, 0x00001000,
0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah
0x00100000, 0x00100001, 0x00100001, 0x00011110,
0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh
0x00011001, 0x00000111, 0x00011001, 0x01100001,
0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch
0x00001000, 0x00001000, 0x00001000, 0x00001000,
0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh
0x01001001, 0x01001001, 0x01001001, 0x01001001,
0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh
0x01000001, 0x01000001, 0x01000001, 0x01000001,
0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh
0x01000001, 0x01000001, 0x00100010, 0x00011100,
0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h
0x01000001, 0x01000011, 0x00111101, 0x00000001,
0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h
0x01000001, 0x01100001, 0x01011110, 0x01000000,
0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h
0x00000011, 0x00000001, 0x00000001, 0x00000001,
0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h
0x00001110, 0x00110000, 0x01000001, 0x00111110,
0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h
0x00000100, 0x00000100, 0x00000100, 0x01111000,
0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h
0x01000001, 0x01000001, 0x01000001, 0x01111110,
0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h
0x00100010, 0x00100010, 0x00010100, 0x00001000,
0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h
0x01001001, 0x00101010, 0x00101010, 0x00010100,
0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h
0x00001100, 0x00001100, 0x00010010, 0x00100001,
0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h
0x00100010, 0x00011100, 0x00001000, 0x00000110,
0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah
0x00001000, 0x00000100, 0x00000010, 0x00111111,
0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh
0x00011000, 0x00100100, 0x00000100, 0x01111000,
0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch
0x00011110, 0x00110101, 0x00101101, 0x00010010,
0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh
0x00100001, 0x00100001, 0x00000001, 0x00000010,
0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh
0x00011110, 0x00100000, 0x00100000, 0x00011100,
0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh
0x00111110, 0x00010000, 0x00001100, 0x00110010,
0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h
0x01000100, 0x00011110, 0x00100101, 0x00010110,
0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h
0x00101011, 0x00100010, 0x00010100, 0x00000100,
0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h
0x00101011, 0x00101001, 0x00011001, 0x00000100,
0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h
0x00001000, 0x00011110, 0x00101001, 0x00000110,
0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h
0x00100011, 0x00100000, 0x00100000, 0x00011100,
0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h
0x00111110, 0x01010101, 0x01001101, 0x00100110,
0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h
0x01000001, 0x01000001, 0x00000001, 0x00000010,
0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h
0x01000000, 0x01000000, 0x00100000, 0x00011100,
0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h
0x00010000, 0x00001000, 0x00010100, 0x01100010,
0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah
0x00111110, 0x01000101, 0x01000101, 0x00100010,
0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh
0x01010010, 0x00010010, 0x00010010, 0x00001001,
0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch
0x00111110, 0x00010000, 0x00000010, 0x00111100,
0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh
0x00000001, 0x00000110, 0x00011000, 0x00100000,
0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh
0x00100001, 0x00100001, 0x00100001, 0x00010010,
0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh
0x00000000, 0x00000001, 0x00000001, 0x00111110,
0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h
0x00100000, 0x00000010, 0x00000010, 0x00111100,
0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h
0x01000001, 0x01000001, 0x00100010, 0x00011100,
0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h
0x00010100, 0x00010100, 0x00011000, 0x00001100,
0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h
0x00100010, 0x00000010, 0x00000010, 0x01111100,
0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h
0x01111111, 0x00001000, 0x00001000, 0x00110000,
0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h
0x01110100, 0x00000010, 0x00001010, 0x01110010,
0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h
0x00111100, 0x01000010, 0x01000000, 0x00111100,
0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h
0x01000000, 0x01000000, 0x00100000, 0x00011100,
0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h
0x00001000, 0x00001000, 0x00001000, 0x00110000,
0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h
0x00000010, 0x00000001, 0x00000001, 0x00111110,
0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah
0x00010001, 0x00111100, 0x00010010, 0x00001100,
0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh
0x00000010, 0x00000010, 0x00001010, 0x01110010,
0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch
0x01001011, 0x01101101, 0x01010101, 0x00110010,
0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh
0x01000110, 0x01110010, 0x01001011, 0x00110010,
0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh
0x01001001, 0x01000101, 0x01000101, 0x00110010,
0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh
0x00100001, 0x00111001, 0x01100101, 0x00011001,
0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h
0x00100001, 0x00100001, 0x00010010, 0x00001100,
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h
0x00000000, 0x00000100, 0x00001010, 0x00000100,
0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h
0x00010000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h
0x00001000, 0x00001000, 0x00001000, 0x00001110,
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h
0x00000000, 0x00000010, 0x00000100, 0x00000100,
0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h
0x00011000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h
0x01000000, 0x01000000, 0x00100000, 0x00011100,
0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h
0x00010100, 0x00001100, 0x00000100, 0x00000010,
0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h
0x00010000, 0x00001111, 0x00001000, 0x00001000,
0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h
0x00100001, 0x00100000, 0x00010000, 0x00001100,
0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah
0x00001000, 0x00001000, 0x00001000, 0x01111111,
0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh
0x00011000, 0x00010100, 0x00010010, 0x00011001,
0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach
0x00100010, 0x00010010, 0x00000100, 0x00000100,
0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh
0x00100000, 0x00100000, 0x00100000, 0x01111111,
0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh
0x00111110, 0x00100000, 0x00100000, 0x00111110,
0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh
0x00101010, 0x00100000, 0x00010000, 0x00001110,
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h
0x01111111, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h
0x00011000, 0x00001000, 0x00001000, 0x00000100,
0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h
0x00010111, 0x00010000, 0x00010000, 0x00010000,
0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h
0x01000001, 0x01000000, 0x00100000, 0x00011000,
0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h
0x00001000, 0x00001000, 0x00001000, 0x01111111,
0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h
0x00101000, 0x00100100, 0x00100010, 0x00110001,
0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h
0x01000100, 0x01000100, 0x01000010, 0x00100001,
0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h
0x01111111, 0x00010000, 0x00010000, 0x00010000,
0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h
0x01000010, 0x01000000, 0x00100000, 0x00011000,
0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h
0x00100001, 0x00100000, 0x00010000, 0x00001100,
0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah
0x01000000, 0x01000000, 0x01000000, 0x01111110,
0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh
0x00100010, 0x00100000, 0x00010000, 0x00001100,
0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch
0x01000100, 0x00100000, 0x00011000, 0x00000111,
0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh
0x00010000, 0x00011000, 0x00100100, 0x01000011,
0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh
0x00100010, 0x00000010, 0x00000010, 0x01111100,
0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh
0x00100000, 0x00100000, 0x00011000, 0x00000110,
0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h
0x01110001, 0x01000000, 0x00100000, 0x00011000,
0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h
0x01111111, 0x00010000, 0x00010000, 0x00001100,
0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h
0x01000000, 0x00100000, 0x00010000, 0x00001110,
0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h
0x00010000, 0x00010000, 0x00001000, 0x00000110,
0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h
0x00011010, 0x01100010, 0x00000010, 0x00000010,
0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h
0x00010000, 0x00010000, 0x00001000, 0x00000110,
0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h
0x00000000, 0x00000000, 0x00000000, 0x01111111,
0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h
0x00101000, 0x00010000, 0x00101000, 0x01000110,
0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h
0x00010000, 0x00011100, 0x01101011, 0x00001000,
0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h
0x00100000, 0x00100000, 0x00011000, 0x00000111,
0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah
0x01000010, 0x01000010, 0x01000001, 0x01000001,
0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh
0x00000001, 0x00000001, 0x00000001, 0x01111110,
0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch
0x01000000, 0x00100000, 0x00010000, 0x00001110,
0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh
0x00010001, 0x00100001, 0x01000000, 0x00000000,
0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh
0x00001000, 0x00101010, 0x01001010, 0x01001001,
0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh
0x00100010, 0x00010100, 0x00001000, 0x00010000,
0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h
0x01110000, 0x00000110, 0x00011000, 0x01100000,
0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h
0x00000100, 0x00100010, 0x01000010, 0x01111111,
0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h
0x00101000, 0x00010000, 0x00101100, 0x01000011,
0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h
0x00000100, 0x00000100, 0x00000100, 0x01111000,
0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h
0x00100010, 0x00010100, 0x00000100, 0x00000100,
0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h
0x00100000, 0x00100000, 0x00100000, 0x01111111,
0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h
0x01111110, 0x01000000, 0x01000000, 0x01111110,
0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h
0x01000000, 0x01000000, 0x00100000, 0x00011100,
0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h
0x01000010, 0x01000000, 0x00100000, 0x00011000,
0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h
0x01001010, 0x01001010, 0x00101010, 0x00011001,
0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah
0x01000010, 0x00100010, 0x00010010, 0x00001110,
0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh
0x01000001, 0x01000001, 0x01000001, 0x01111111,
0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch
0x01000000, 0x01000000, 0x00100000, 0x00011100,
0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh
0x01000000, 0x00100000, 0x00010000, 0x00001111,
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh 0
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh 1
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h 2
0x00101001, 0x01010001, 0x01010001, 0x00001100,
0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h 3
0x00010010, 0x00100001, 0x01000000, 0x00000000,
0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h 4
0x00100001, 0x00111001, 0x01100101, 0x00011001,
0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h 5
0x00010000, 0x00011100, 0x00110010, 0x00001100,
0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h 6
0x00111110, 0x01100101, 0x00100101, 0x00010010,
0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h 7
0x00000110, 0x01000101, 0x01000101, 0x00111110,
0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h 8
0x01010010, 0x01010101, 0x01001101, 0x00100110,
0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h 9
0x00011111, 0x01000010, 0x01000010, 0x00111100,
0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h 10
0x01000010, 0x00100100, 0x00000100, 0x00000100,
0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h 11
0x01001001, 0x01001001, 0x00111000, 0x00000100,
0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah 12
0x00001000, 0x00011110, 0x00101001, 0x00000110,
0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh 13
0x00111010, 0x01000110, 0x01000000, 0x00111000,
0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech 14
0x01000110, 0x01000000, 0x00100000, 0x00011000,
0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh 15
0x01000011, 0x01001100, 0x01010010, 0x00111100,
0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh 16
0x00100110, 0x00100010, 0x00100011, 0x01000010,
0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh 17
0x01000011, 0x01000000, 0x01000010, 0x00111100,
0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h 18
0x01000010, 0x01000011, 0x01000010, 0x00110010,
0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h 19
0x01000110, 0x01000101, 0x01000101, 0x00111001,
0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h 20
0x00100100, 0x00100100, 0x00100010, 0x00010001,
0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h 21
0x00111111, 0x00001000, 0x00001000, 0x00001000,
0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h 22
0x00100001, 0x00100000, 0x00010000, 0x00001100,
0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h 23
0x00100001, 0x00100000, 0x00010000, 0x00001100,
0x33330000,
0x33330000,
0x33000000,
0x33000000, // 00f6h
0x33000000,
0x33000000,
0x33330000,
0x33330000,
0x00020000, // 00f7h
0x00020000,
0x00020000,
0x22222222,
0x00000000,
0x00000000,
0x00000000,
0x00000000,
0x00000000, // 00f8h
0x00000000,
0x00000000,
0x00000000,
0x11111111,
0x11111111,
0x11111111,
0x11111111,
0x11111111, // 00f9h
0x11111111,
0x11111111,
0x11111111,
0x11111111,
0x11111111,
0x11111111,
0x11111111,
0x11111111, // 00fah
0x11111111,
0x11111111,
0x11111111,
0x00000000,
0x00000000,
0x00000000,
0x00000000,
0x00000000, // 00fbh
0x00000000,
0x00000000,
0x22222222,
0x00020000,
0x00020000,
0x00020000,
0x00020000,
0x00020000, // 00fch
0x00020000,
0x00020000,
0x22222222,
0x00020000,
0x00020000,
0x00020000,
0x00020000,
0x00020000, // 00fdh
0x00020000,
0x00020000,
0x00020000,
0x00020000,
0x00020000,
0x00020000,
0x00020000,
0x00000000, // 00feh
0x00000000,
0x00000000,
0x22222222,
0x00000000,
0x00000000,
0x00000000,
0x00000000,
0x00020000,
0x00220000,
0x02122222,
0x21111112,
0x21111112,
0x02122222,
0x00220000,
0x00020000,
/*
0x00022222,
0x00002112,
0x00021112,
0x00211122,
0x02111202,
0x21112000,
0x02120000,
0x00200000,
*/
/*
0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh
0x00001000, 0x00001000, 0x00001000, 0x00000110
*/
};
/*---------------------------------------------------------------------------*
End of file
*---------------------------------------------------------------------------*/

View File

@ -1,199 +0,0 @@
/*---------------------------------------------------------------------------*
Project: SystemUpdater
File: praphics.c
Copyright 2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Date:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#include <twl.h>
//#include <twl/mic.h>
#include <nitro/snd.h>
#include "kami_font.h"
#include "graphics.h"
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
Name: InitGraphics
Description:
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
void
InitGraphics(void)
{
GX_DispOff();
GXS_DispOff();
//---- VRAM クリア
GX_SetBankForLCDC(GX_VRAM_LCDC_ALL);
MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE);
//---- OAMとパレットクリア
MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE);
MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE);
MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE);
MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE);
//---- OBJバンクの設定
GX_SetBankForOBJ(GX_VRAM_OBJ_128_A);
GX_SetBankForSubOBJ(GX_VRAM_SUB_OBJ_128_D);
//---- BGバンクの設定
GX_SetBankForBG(GX_VRAM_BG_128_B);
GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C);
//---- 表示モード設定
GX_SetGraphicsMode (GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_3D);
GX_SetVisiblePlane (GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ);
GXS_SetVisiblePlane(GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ);
//---- 3D初期化
G3X_Init();
G3X_InitMtxStack();
G2_SetBG0Priority(3);
G3X_AlphaTest(FALSE, 0);
G3X_AntiAlias(TRUE);
G3X_EdgeMarking(FALSE);
G3X_SetFog(FALSE, (GXFogBlend)0, (GXFogSlope)0, 0);
G3X_SetClearColor(0, 0, 0x7fff, 63, FALSE);
G3_ViewPort(0, 0, 255, 191);
G3_MtxMode(GX_MTXMODE_POSITION_VECTOR);
//---- 32KバイトのOBJで2Dマップモードで使用
GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_2D);
// スクリーンオフセット及びキャラクターオフセットの設定
GX_SetBGScrOffset(GX_BGSCROFFSET_0x00000);
GX_SetBGCharOffset(GX_BGCHAROFFSET_0x10000);
G2_SetBG1Control(
GX_BG_SCRSIZE_TEXT_256x256,
GX_BG_COLORMODE_16,
GX_BG_SCRBASE_0x0000 ,
GX_BG_CHARBASE_0x00000,
GX_BG_EXTPLTT_01
);
G2S_SetBG0Control(
GX_BG_SCRSIZE_TEXT_256x256,
GX_BG_COLORMODE_16,
GX_BG_SCRBASE_0x0000 ,
GX_BG_CHARBASE_0x04000,
GX_BG_EXTPLTT_01
);
G2S_SetBG1Control(
GX_BG_SCRSIZE_TEXT_256x256,
GX_BG_COLORMODE_16,
GX_BG_SCRBASE_0x2000 ,
GX_BG_CHARBASE_0x04000,
GX_BG_EXTPLTT_01
);
G2_BG1Mosaic(FALSE);
G2S_BG1Mosaic(FALSE);
//---- データロード
GX_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData));
GX_LoadBG1Char( sampleCharData, 0, sizeof(sampleCharData));
GX_LoadBGPltt ( PlttDataMain, 0, sizeof(PlttDataMain));
GX_LoadBG1Scr ( BgScDataMain, 0, sizeof(BgScDataMain));
GX_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj));
GXS_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData));
GXS_LoadBG0Char( sampleCharData, 0, sizeof(sampleCharData));
GXS_LoadBGPltt ( PlttDataSub, 0, sizeof(PlttDataSub));
GXS_LoadBG0Scr ( BgScDataSub, 0, sizeof(BgScDataSub));
GXS_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj));
GX_DispOn();
GXS_DispOn();
}
/*---------------------------------------------------------------------------*
Name: DrawLine
Description:
Arguments: sx -
sy -
ex -
ey -
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 -
sy -
ex -
ey -
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();
}

View File

@ -1,147 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - SystemUpdater
File: hw_info.c
Copyright 2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Date:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#include <twl.h>
#include <nitro/snd.h>
#include <twl/fatfs.h>
#include <twl/lcfg.h>
#include <nitro/card.h>
#include <sysmenu/namut.h>
#include "kami_font.h"
#include "kami_pxi.h"
#include "hwi.h"
#include "hw_info.h"
//
#include "TWLHWInfo_api.h"
#include "TWLSettings_api.h"
//
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
BOOL WriteHWNormalInfoFile( void );
BOOL WriteHWSecureInfoFile( u8 region );
BOOL DeleteHWInfoFile( void );
/*---------------------------------------------------------------------------*
Name: HW情報全体のライト
Description:
Arguments: region :
Returns: None.
*---------------------------------------------------------------------------*/
BOOL WriteHWInfoFile( u8 region, BOOL wirelessForceOff )
{
static const char *pMsgSecureWriting = "Writing Secure File...";
static const char *pMsgNormalWriting = "Writing Normal File...";
static const char *pMsgSignWriting = "Writing Sign File...";
static const char *pMsgSucceeded = "Success!\n";
static const char *pMsgFailed = "Failed!\n";
u32 installedSoftBoxCount = 0;
BOOL result = TRUE;
// セキュアファイルのライト
if( HWI_WriteHWSecureInfoFile( region, NULL, wirelessForceOff ) ) { // とりあえず無線は有効で。
// kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded );
}else {
kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed );
result = FALSE;
}
// ノーマルファイルのライト(移行可能なユニークIDのためにセキュアファイルの後で書き込む
if( HWI_WriteHWNormalInfoFile() ) {
// kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded );
}else {
kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed );
result = FALSE;
}
// HWID署名ファイルのライト
if( HWI_WriteHWIDSignFile() ) {
// kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded );
}else {
kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed );
result = FALSE;
}
// CFGデータの修正
if (!HWI_ModifyLanguage( region ))
{
kamiFontPrintfConsoleEx(CONSOLE_RED, "Fail! Write TWLSettings\n" );
result = FALSE;
}
return result;
}
/*---------------------------------------------------------------------------*
Name: HWInfoファイルの削除
Description:
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
BOOL DeleteHWInfoFile( void )
{
static const char *pMsgNormalDeleting = "Deleting Normal File...";
static const char *pMsgSecureDeleting = "Deteting Secure File...";
static const char *pMsgSucceeded = "Success!\n";
static const char *pMsgFailed = "Failed!\n";
BOOL result = TRUE;
// ノーマルファイル
kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgNormalDeleting );
if( HWI_DeleteHWNormalInfoFile() ) {
OS_TPrintf( "%s delete succeeded.\n", (char *)LCFG_TWL_HWINFO_NORMAL_PATH );
kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded );
}else {
OS_TPrintf( "%s delete failed.\n", (char *)LCFG_TWL_HWINFO_NORMAL_PATH );
kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed );
result = FALSE;
}
// セキュアファイル
kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSecureDeleting );
if( HWI_DeleteHWSecureInfoFile() ) {
OS_TPrintf( "%s delete succeeded.\n", (char *)LCFG_TWL_HWINFO_SECURE_PATH );
kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded );
}else {
OS_TPrintf( "%s delete failed.\n", (char *)LCFG_TWL_HWINFO_SECURE_PATH );
kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed );
result = FALSE;
}
return result;
}

View File

@ -1,194 +0,0 @@
/*---------------------------------------------------------------------------*
Project: SystemUpdater
File: process_import.c
Copyright 2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Date:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#include <twl.h>
#include <nitro/snd.h>
#include <twl/fatfs.h>
#include <nitro/card.h>
#include <twl/nam.h>
#include <twl/lcfg.h>
#include <sysmenu/namut.h>
#include "kami_font.h"
#include "import.h"
#include "hw_info.h"
#include "TWLHWInfo_api.h"
#include "graphics.h"
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
#define THREAD_STACK_SIZE (16*1024)
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
static u32 sCurrentProgress;
static vu8 sNowImport = FALSE;
static vu8 sProgress = FALSE;
static u8 sStack[THREAD_STACK_SIZE];
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
static void ProgressThread(void* arg);
static void Destructor(void* arg);
void ProgressDraw(f32 ratio);
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
Name: kamiImportTad
Description: .tad
Arguments: no
Returns: None.
*---------------------------------------------------------------------------*/
s32 kamiImportTad(int no, int total, const char* path)
{
NAMTadInfo tadInfo;
OSThread thread;
s32 nam_result;
kamiFontPrintfMain( 4, 9, 8, "Now Updating... %d / %d", no, total );
kamiFontLoadScreenData();
// tadファイルの情報取得
nam_result = NAM_ReadTadInfo(&tadInfo, path);
if ( nam_result != NAM_OK )
{
return nam_result;
}
// ESの仕様で古い e-ticket があると新しい e-ticket を使ったインポートができない
// 暫定対応として該当タイトルを完全削除してからインポートする
nam_result = NAM_DeleteTitleCompletely(tadInfo.titleInfo.titleId);
if ( nam_result != NAM_OK )
{
kamiFontPrintfConsole(CONSOLE_RED, "Fail! RetCode=%x\n", nam_result);
return FALSE;
}
// インポート開始フラグを立てる
sNowImport = TRUE;
// 進捗スレッド作成
MI_CpuClear8(sStack, THREAD_STACK_SIZE);
OS_CreateThread(&thread, ProgressThread, NULL,
(void*)((u32)sStack + THREAD_STACK_SIZE), THREAD_STACK_SIZE, OS_GetCurrentThread()->priority - 1);
OS_WakeupThreadDirect(&thread);
// Import開始
nam_result = NAM_ImportTad( path );
// インポート開始フラグを下げる
sNowImport = FALSE;
// 進捗スレッドの自力終了を待つ
while (sProgress){};
// InstalledSoftBoxCount, FreeSoftBoxCount の値を現在のNANDの状態に合わせて更新します。
(void)NAMUT_UpdateSoftBoxCount();
return nam_result;
}
/*---------------------------------------------------------------------------*
Name: ProgressThread
Description: .tad
100%
Arguments: arg - 使
Returns: None.
*---------------------------------------------------------------------------*/
static void ProgressThread(void* /*arg*/)
{
u32 currentSize;
u32 totalSize = 0;
u32 totalSizeBk = 0;
sProgress = TRUE;
while (sNowImport)
{
NAM_GetProgress(&currentSize, &totalSize);
if ((totalSize > 0 && totalSize == currentSize) || totalSizeBk > totalSize)
{
// 既にインポートが終了
ProgressDraw((f32)1.0);
break;
}
else if (totalSize > 0)
{
ProgressDraw((f32)currentSize/totalSize);
}
totalSizeBk = totalSize;
// Vブランク待ち
OS_WaitVBlankIntr();
}
sProgress = FALSE;
}
/*---------------------------------------------------------------------------*
Name: ProgressDraw
Description:
Arguments:
Returns: None.
*---------------------------------------------------------------------------*/
void ProgressDraw(f32 ratio)
{
s16 x = (s16)(30 + (226 - 30)*ratio);
// 3D初期化
G3X_Reset();
G3_Identity();
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
// グリーンバー
DrawQuad( 30, 90, x, 95, GX_RGB(12, 25, 12));
// グレーバー
DrawQuad( 30, 90, 226, 95, GX_RGB(28, 28, 28));
// グレーダイアログ
DrawQuad( 20, 60, 236, 110, GX_RGB(25, 25, 25));
// 3Dスワップ
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
}

View File

@ -1,105 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - NandInitializer
File: kami_copy_file.c
Copyright 2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Date:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#include <twl.h>
#include <nitro/snd.h>
#include <twl/fatfs.h>
#include <nitro/card.h>
#include "kami_font.h"
#include "kami_copy_file.h"
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
#define ROUND_UP(value, alignment) \
(((u32)(value) + (alignment-1)) & ~(alignment-1))
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
BOOL kamiCopyFile(char* srcPath, char* dstPath)
{
FSFile file;
BOOL open_is_ok;
BOOL read_is_ok;
void* pTempBuf;
u32 file_size;
u32 alloc_size;
BOOL result = TRUE;
// ROMファイルオープン
FS_InitFile(&file);
open_is_ok = FS_OpenFile(&file, srcPath);
if (!open_is_ok)
{
OS_Printf("FS_OpenFile(\"%s\") ... ERROR!\n", srcPath);
return FALSE;
}
// ROMファイルリード
file_size = FS_GetFileLength(&file) ;
alloc_size = ROUND_UP(file_size, 32) ;
pTempBuf = OS_Alloc( alloc_size );
SDK_NULL_ASSERT(pTempBuf);
DC_InvalidateRange(pTempBuf, alloc_size);
read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size );
if (!read_is_ok)
{
kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_ReadFile(\"%s\") ... ERROR!\n", srcPath);
FS_CloseFile(&file);
OS_Free(pTempBuf);
return FALSE;
}
// ROMファイルクローズ
FS_CloseFile(&file);
// 一旦対象データを削除する
(void)FS_DeleteFile(dstPath);
// ターゲットファイル作成
if (!FS_CreateFile(dstPath, FS_PERMIT_R | FS_PERMIT_W))
{
kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_CreateFile(%s) failed.\n", dstPath);
result = FALSE;
}
else
{
// ターゲットファイルオープン
FS_InitFile(&file);
open_is_ok = FS_OpenFileEx(&file, dstPath, FS_FILEMODE_W);
if (!open_is_ok)
{
kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_OpenFile(%s) failed.\n", dstPath);
result = FALSE;
}
// nand:sys/TWLFontTable.dat書き込み
else if (FS_WriteFile(&file, pTempBuf, (s32)file_size) == -1)
{
kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_WritFile() failed.\n");
result = FALSE;
}
(void)FS_CloseFile(&file);
}
OS_Free(pTempBuf);
return result;
}

View File

@ -1,407 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - NandInitializer
File: kami_font.c
Copyright 2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Date:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#include <twl.h>
#include "kami_font.h"
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
#define SCREEN_DATA_COLOR_PLTT_SHIFT 12
#define NUM_OF_PRINT_TARGET 2
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
static u8 sXPos;
static u8 sYPos;
static u32 sBackColorCharData[24*8];
static u16 sFontScreenDataMain[32 * 24] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
static u16 sFontScreenDataSub[24*32] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
static u16 sBackColorScreenData[32 * 24] = {
0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,
0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,
0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,
0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,
0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,
0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,
0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,
0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,
0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,
0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,
0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,
0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,
0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,
0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,
0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,
0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,
0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,
0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,
0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,
0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,
0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,
0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,
0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,
0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,
};
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
static void kamiFontReturnConsole( void );
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
Name:
Description:
Arguments: None
Returns: None.
*---------------------------------------------------------------------------*/
void
kamiFontInit(void)
{
// 背景用キャラクタデータ
MI_CpuCopy32( &sampleCharData[8 * 0xde], sBackColorCharData, sizeof(sBackColorCharData) );
// 背景用スクリーンデータセット
DC_FlushRange ( sBackColorScreenData, sizeof(sBackColorScreenData) );
GXS_LoadBG1Scr ( sBackColorScreenData, 0, sizeof(sBackColorScreenData) );
}
/*---------------------------------------------------------------------------*
Name:
Description:
Arguments: None
Returns: None.
*---------------------------------------------------------------------------*/
void
kamiFontLoadScreenData(void)
{
DC_FlushRange ( sFontScreenDataMain, sizeof(sFontScreenDataMain) );
GX_LoadBG0Scr ( sFontScreenDataMain, 0, sizeof(sFontScreenDataMain) );
DC_FlushRange ( sFontScreenDataSub, sizeof(sFontScreenDataSub) );
GXS_LoadBG0Scr ( sFontScreenDataSub, 0, sizeof(sFontScreenDataSub) );
// 背景キャラクタデータ書き換え
DC_FlushRange( sBackColorCharData, sizeof(sBackColorCharData) );
GXS_LoadBG0Char( sBackColorCharData, 0xde*32, sizeof(sBackColorCharData) );
}
/*---------------------------------------------------------------------------*
Name: kamiFontClear
Description:
Arguments: None
Returns: None.
*---------------------------------------------------------------------------*/
void
kamiFontClear(void)
{
MI_CpuClear8( sFontScreenDataSub, sizeof(sFontScreenDataSub) );
}
/*---------------------------------------------------------------------------*
Name: kamiFontClearMain
Description:
Arguments: None
Returns: None.
*---------------------------------------------------------------------------*/
void
kamiFontClearMain(void)
{
MI_CpuClear8( sFontScreenDataMain, sizeof(sFontScreenDataMain) );
}
/*---------------------------------------------------------------------------*
Name: kamiFontPrintf
Description: 32
Arguments: x - x ( × 8 )
y - y ( × 8 )
color -
text - NULL
... -
Returns: None.
*---------------------------------------------------------------------------*/
void
kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...)
{
va_list vlist;
char temp[32 + 2];
s32 i;
va_start(vlist, text);
(void)vsnprintf(temp, 33, text, vlist);
va_end(vlist);
*(u16 *)(&temp[32]) = 0x0000;
for (i = 0;temp[i] != 0x00; i++)
{
sFontScreenDataSub[((y * 32) + x + i) % (24 * 32)] =
(u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]);
}
}
/*---------------------------------------------------------------------------*
Name: kamiFontPrintf
Description: 32
Arguments: x - x ( × 8 )
y - y ( × 8 )
color -
text - NULL
... -
Returns: None.
*---------------------------------------------------------------------------*/
void
kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...)
{
va_list vlist;
char temp[32 + 2];
s32 i;
va_start(vlist, text);
(void)vsnprintf(temp, 33, text, vlist);
va_end(vlist);
*(u16 *)(&temp[32]) = 0x0000;
for (i = 0;temp[i] != 0x00; i++)
{
sFontScreenDataMain[((y * 32) + x + i) % (24 * 32)] =
(u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]);
}
}
/*---------------------------------------------------------------------------*
Name: kamiFontFillChar
Description:
Arguments: x - x ( × 8 )
y - y ( × 8 )
color -
value
Returns: None.
*---------------------------------------------------------------------------*/
void
kamiFontFillChar(int lineNo, u8 color1, u8 color2)
{
s32 i;
u32 line;
int charNo = 0xde + lineNo;
if (color1 < 0x10)
{
line = (u32)(0x11111111 * color1);
for (i = 0;i<4; i++)
{
sBackColorCharData[8 * lineNo + i] = line;
}
}
if (color2 < 0x10)
{
line = (u32)(0x11111111 * color2);
for (i = 4;i<8; i++)
{
sBackColorCharData[8 * lineNo + i] = line;
}
}
}
/*---------------------------------------------------------------------------*
Name: kamiFontPrintfConsole
Description: 256
Arguments: color -
text - NULL
... -
Returns: None.
*---------------------------------------------------------------------------*/
void
kamiFontPrintfConsole(u8 color, const char *text, ...)
{
va_list vlist;
char temp[256 + 2];
s32 i;
va_start(vlist, text);
(void)vsnprintf(temp, 256, text, vlist);
va_end(vlist);
// 終端追加
*(u16 *)(&temp[256]) = 0x0000;
for(i=0; temp[i] != 0x00; i++)
{
if (temp[i] == 0x0A)
{
// 改行コード
kamiFontReturnConsole();
}
else
{
// 一文字ずつ書き込み
sFontScreenDataMain[((sYPos * 32) + sXPos) % (24 * 32)] =
(u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]);
// X座標が右端に到達した場合は改行処理
if (++sXPos >= 32)
{
kamiFontReturnConsole();
}
}
}
}
/*---------------------------------------------------------------------------*
Name: kamiFontPrintfConsoleEx
Description: 256
OS_Printfもついでに実行する
Arguments: color -
text - NULL
... -
Returns: None.
*---------------------------------------------------------------------------*/
void
kamiFontPrintfConsoleEx(u8 color, const char *text, ...)
{
va_list vlist;
char temp[256 + 2];
va_start(vlist, text);
(void)vsnprintf(temp, 256, text, vlist);
va_end(vlist);
kamiFontPrintfConsole(color, temp);
OS_TPrintf(temp);
}
/*---------------------------------------------------------------------------*
Name: kamiFontReturnConsole
Description:
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
static void
kamiFontReturnConsole( void )
{
sXPos = 0;
if (sYPos < 23)
{
// 次の行へ
sYPos++;
}
else
{
// 既に最終行に到達している場合シフトを行う
MI_CpuCopy32( &sFontScreenDataMain[32], sFontScreenDataMain, sizeof(u16)*32*23 );
MI_CpuClear32( &sFontScreenDataMain[32*23], sizeof(u16)*32);
}
}

View File

@ -1,370 +0,0 @@
/*---------------------------------------------------------------------------*
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);
}
}

View File

@ -1,332 +0,0 @@
/*---------------------------------------------------------------------------*
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の未割り当て領域予約領域をクリアする場合は定義します開発用
//#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予約領域をクリアします
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 ); // ブロック単位、バイト単位、ブロック単位
}
}

View File

@ -1,85 +0,0 @@
/*---------------------------------------------------------------------------*
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;
}

View File

@ -1,123 +0,0 @@
#! 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$
#----------------------------------------------------------------------------
override TARGET_PLATFORM = TWL
override TARGET_CODEGEN = THUMB
override TWL_ARCHGEN = LIMITED
TARGET_FIRM = SYSTEMMENU
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
#.PHONY: no_rom_set
#no_rom_set:
# echo "Usage: make ROMSET=dirname"
#
#ifeq ($(ROMSET),)
# no_rom_set
#endif
#
# リージョンが指定されてなかったら全部やる
ifeq ($(REGION),)
include $(TWLSDK_ROOT)/build/buildtools/commondefs
do-build: do-something
clean: do-something
clobber: do-something
install: do-something
do-build: MY_GOAL=
clean: MY_GOAL=clean
clobber: MY_GOAL=clobber
install: MY_GOAL=install
do-something:
-$(REMAKE) TWLSDK_PLATFORM=TWL REGION=JPN ROMSET=$(ROMSET) DISABLE_ROMCHECK=$(DISABLE_ROMCHECK) SKIP_SUBDIR=FALSE $(MY_GOAL)
-rm `find . -name "*autogen*"`
-$(REMAKE) TWLSDK_PLATFORM=TWL REGION=AUS ROMSET=$(ROMSET) DISABLE_ROMCHECK=$(DISABLE_ROMCHECK) SKIP_SUBDIR=FALSE $(MY_GOAL)
-rm `find . -name "*autogen*"`
-$(REMAKE) TWLSDK_PLATFORM=TWL REGION=USA ROMSET=$(ROMSET) DISABLE_ROMCHECK=$(DISABLE_ROMCHECK) SKIP_SUBDIR=FALSE $(MY_GOAL)
-rm `find . -name "*autogen*"`
-$(REMAKE) TWLSDK_PLATFORM=TWL REGION=EUR ROMSET=$(ROMSET) DISABLE_ROMCHECK=$(DISABLE_ROMCHECK) SKIP_SUBDIR=FALSE $(MY_GOAL)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
else
LAUNCHER_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/Launcher
MACHINESETTINGS_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/MachineSettings
WLANFIRM_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/wlanfirm
DS_HASH_TABLE = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/DSHashTable
SHARED_FONT_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/sharedFont
NANDFIRM_DIR = $(TWL_IPL_RED_ROOT)/build/nandfirm/menu-launcher
# 既存データを使用する場合はTRUEを指定
SKIP_CREATE_DATA = TRUE
ifeq ($(SKIP_CREATE_DATA),FALSE)
SUBDIRS = $(LAUNCHER_DIR) \
$(MACHINESETTINGS_DIR) \
$(WLANFIRM_DIR) \
$(DS_HASH_TABLE) \
$(SHARED_FONT_DIR) \
$(NANDFIRM_DIR) \
data \
banner \
ARM7.TWL \
ARM9.TWL
else
SUBDIRS = banner \
ARM7.TWL \
ARM9.TWL
endif
# CustomSystemUpdater
export SYSM_REGION = $(REGION)
export ROMSET := $(ROMSET)
export DISABLE_ROMCHECK := $(DISABLE_ROMCHECK)
# COMPILE SWITCH for build SystemMenu
export SYSM_UPDATER_RELEASE = TRUE
export SYSM_DO_NOT_SHOW_LAUNCHER = TRUE
export SYSM_DISABLE_WDS_SCAN = FALSE
export SYSM_IGNORE_WLFIRM_SIGNCHECK = FALSE
export SYSM_DISABLE_WLFIRM_LOAD = FALSE
export SYSM_DISABLE_INITIAL_SETTINGS = TRUE
export SYSM_OUTSIDE_UI = TRUE
export SYSM_BUILD_FOR_PRODUCTION_TEST = FALSE
# MAKEROM SWITCH for build SystemMenu
export SYSM_DISABLE_DEBUG = FALSE
export SYSM_USE_WLANFIRM_LOCAL_PUBKEY = FALSE
#----------------------------------------------------------------------------
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
endif
#===== End of Makefile =====

View File

@ -1,47 +0,0 @@
#! 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.

Before

Width:  |  Height:  |  Size: 592 B

View File

@ -1,90 +0,0 @@
/*---------------------------------------------------------------------------*
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
*---------------------------------------------------------------------------*/

View File

@ -1,10 +0,0 @@
---
:DataPath: .
:NandFirm: nandfirm_rcplus.nand
:TargetPath: .
:TemplatePath: template
:RSF: ARM9.TWL/main.rsf
:TadFiles:
:SRC: ARM9.TWL/src/main.c
:FontFile: TWLFontTable.dat
:Region: EUR

View File

@ -1,14 +0,0 @@
---
:SRC: ARM9.TWL/src/main.c
:FontFile: TWLFontTable.dat
:DataPath: data
:NandFirm: menu_launcher.nand
:TargetPath: .
:TemplatePath: template
:RSF: ARM9.TWL/main.rsf
:TadFiles:
- HNAA.tad
- HNBA.tad
- HNCA.tad
- HNLA.tad
- HNHA.tad

View File

@ -1,36 +0,0 @@
#!/bin/sh
#----------------------------------------------------------------------------
# Project: TwlSDK - tools
# File: autoupload.sh
#
# 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$
#----------------------------------------------------------------------------
gen_updater(){
#ruby sumaker.rb custom $1 $2
make ROMSET=$1 REGION=$2
rm `find . -name "*autogen*"`
}
if [ $# -lt 1 ];
then
echo "Usage: makecsu vername"
exit
fi
gen_updater $1 JPN
gen_updater $1 USA
gen_updater $1 AUS
gen_updater $1 EUR

View File

@ -1,207 +0,0 @@
#!/bin/ruby
#----------------------------------------------------------------------------
# Project: TwlSDK
# File: romchecker.rb
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Date:: $
# $Rev$
# $Author$
#----------------------------------------------------------------------------
ALL_REGION = [
"C", "D", "E", "H",
]
FIX_REGION = [
"A", "B", "F", "G", "I", "J", "K", "L",
]
HEADER = "HN"
ROM_DATA = {
"#{HEADER}A" => ["Launcher", "00030017"],
"#{HEADER}B" => ["本体設定", "00030015"],
"#{HEADER}C" => ["無線ファーム", "0003000f"],
"#{HEADER}D" => ["DSダウンロードプレイ", "00030005"],
"#{HEADER}E" => ["ピクトチャット", "00030005"],
"#{HEADER}F" => ["ショップ", "00030015"],
"#{HEADER}G" => ["フルブラウザ", "00030004"],
"#{HEADER}H" => ["DSハッシュリスト", "0003000f"],
"#{HEADER}I" => ["写真帳", "00030005"],
"#{HEADER}J" => ["ホットスポット", "00030005"],
"#{HEADER}K" => ["DSサウンド", "00030005"],
"#{HEADER}L" => ["バージョンデータ", "0003000f"],
}
REGION_DIRS = {
"AUS" => ["aus", "U"],
"EUR" => ["euro", "P"],
"JPN" => ["jp", "J"],
"USA" => ["usa", "E"],
"VERUP" => ["verup", "UPJE"],
}
REG_PATH = /[a-zA-Z0-9\.\-_]+\/[a-zA-Z0-9\.\-_*]+\z/
NAND_FIRM = "*.nand"
FONT_DATA = "*.dat"
# ファイルを検索し、ROM内に含まれるべきかどうかを判定する
# 条件に一致したファイル名の配列の要素数で判定
# 0 個 ファイルがない
# 1 個 正常っぽい
# 2 個以上 バージョン違いや、リージョン違いが混ざっている
def check_pickuped(path, print_success)
ret = true
files = Dir.glob(path)
p_path = path.slice(REG_PATH)
#p files
case
when files.size == 0
$stdout.printf( "NG:#{p_path} -- #{p_path} is not included ***********\n")
ret = false
when files.size == 1 && print_success
$stdout.printf( "OK:#{files[0].slice(REG_PATH)}\n")
when files.size >= 2
$stdout.printf("NG:")
files.each{|file|
$stdout.printf( "#{file.slice(REG_PATH)} ")
}
$stdout.printf("-- Too many files are included ***********\n")
ret = false
end
ret
end
def add_rom_list(rom_list, code, region, version, size)
rom_list << [code, region, version, size]
end
def make_rom_list(target_dir, region)
region_dir = REGION_DIRS[region][0]
region_codes = (REGION_DIRS[region][1] + "A").unpack("A" * (REGION_DIRS[region][1].size + 1))
#p region_codes
# 出力用リスト
rom_list = []
(ALL_REGION + FIX_REGION).each{|app_code|
region_codes.each{|region_code|
search_path = File.join(target_dir, region_dir, "#{HEADER}#{app_code}#{region_code}*.tad")
files = Dir.glob(search_path)
files.each{|tad|
add_rom_list(rom_list, "#{HEADER}#{app_code}", region_code, get_rom_version(tad), File.stat(tad).size)
}
}
}
write_rom_list(rom_list, "rom_list_#{region}.txt")
end
def write_rom_list(rom_list, file_name)
region_name = {
"A" => "ALL", "E" => "USA", "U" => "AUS", "J" => "JPN", "P" => "EUR"
}
out = ""
sp = [8, 20, 10, 17, 10, 14]
line = ""
sp.each{|s|
line += "+#{"-" * s}"
}
line += "+\n"
out += line
out += sprintf("|%#{sp[0]}s|%-#{sp[1]}s|%#{sp[2]}s|%-#{sp[3]}s|%#{sp[4]}s|%#{sp[5]}s|\n",
"コード", "名前", "リージョン", "タイトルID", "バージョン", "ファイルサイズ")
out += line
rom_list.each{|rom|
rom_data = ROM_DATA[rom[0]]
size = (rom[3].to_s).reverse.scan(/.{1,3}/).join(",").reverse
out += sprintf("|%#{sp[0]}s|%-#{sp[1]}s|%-#{sp[2]}s|%8s %8x|%#{sp[4]}s|%#{sp[5]}s|\n",
rom[0] + rom[1], rom_data[0],region_name[rom[1]], rom_data[1], (rom[0] + rom[1]).unpack("N")[0], rom[2], size);
}
out += line
File.open(file_name, "w") {|file|
file.puts out
}
end
def get_rom_version(path)
files = Dir.glob(path)
files[0].slice(/v[0-9]+/).delete("v")
end
def check(target_dir, region)
ret = true
if REGION_DIRS[region] == nil
puts "Invalid region, [JPN, USA, EUR, AUS, VERUP]"
return false
end
region_dir = REGION_DIRS[region][0]
region_code = REGION_DIRS[region][1]
# 出力用リスト
rom_list = []
ALL_REGION.each{|app_code|
# オールリージョンのロムが含まれているかのチェック
search_path = File.join(target_dir, region_dir, "#{HEADER}#{app_code}A*.tad")
#if ret &= check_pickuped(search_path, false)
#add_rom_list(rom_list, "#{HEADER}#{app_code}", "A", get_rom_version(search_path))
#end
check_pickuped(search_path, false)
}
FIX_REGION.each{|app_code|
# 各リージョン固有のロムが含まれているかのチェック
search_path = File.join(target_dir, region_dir, "#{HEADER}#{app_code}#{region_code}*.tad")
#if ret &= check_pickuped(search_path, false)
#add_rom_list(rom_list, "#{HEADER}#{app_code}", region_code, get_rom_version(search_path))
#end
ret &= check_pickuped(search_path, false)
}
(ALL_REGION + FIX_REGION).each{|app_code|
# HNxy が 各リージョンごと1つだけ存在するかのチェック
# HNxA と HNxU など、aとuが混在していたりするとここでひっかかる
search_path = File.join(target_dir, region_dir, "#{HEADER}#{app_code}*.tad")
ret &= check_pickuped(search_path, false)
}
# nand firm, font のチェック
search_path = File.join(target_dir, region_dir, NAND_FIRM)
ret &= check_pickuped(search_path, false)
search_path = File.join(target_dir, region_dir, FONT_DATA)
ret &= check_pickuped(search_path, false)
$stdout.printf("\n")
# CSUに含まれているロムの一覧を書き出す
# write_rom_list(rom_list, "rom_list_#{region}.txt")
# make_rom_list(target_dir, region)
ret
end
# こっからメイン
if ARGV.size < 2
p "Usage: #{__FILE__} targetdir region"
exit -1
end
# カレントディレクトリの変更
Dir.chdir(File.dirname(File.expand_path(__FILE__)))
target = ARGV[0]
region = ARGV[1]
make_rom_list(target, region)
if region == "VERUP"
exit 0
else
exit check(target,region) ? 0 : -1
end

View File

@ -1,212 +0,0 @@
#!/bin/ruby
#----------------------------------------------------------------------------
# Project: TwlSDK
# File: sumaker.rb
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Date:: $
# $Rev$
# $Author$
#----------------------------------------------------------------------------
require "yaml"
require "fileutils"
require "tempfile"
DEFAULT_CONFIG = "default.yaml"
CUSTOM_CONFIG = "custom.yaml"
FILE_MATCH = /[a-zA-Z0-9\-_\.]+\z/
REGION = {
"JPN" => "OS_TWL_REGION_JAPAN",
"EUR" => "OS_TWL_REGION_EUROPE",
"AUS" => "OS_TWL_REGION_AUSTRALIA",
"USA" => "OS_TWL_REGION_AMERICA",
}
REGION_PATH = {
"JPN" => "jp",
"EUR" => "euro",
"AUS" => "aus",
"USA" => "usa",
}
# デフォルト設定の作成
def make_default_config
config = {
:TadFiles => [
"HNAA.tad",
"HNBA.tad",
"HNCA.tad",
"HNLA.tad",
"HNHA.tad",
],
:FontFile => "TWLFontTable.dat",
:NandFirm => "menu_launcher.nand",
:TargetPath => ".",
:TemplatePath => "template",
:RSF => "ARM9.TWL/main.rsf",
:SRC => "ARM9.TWL/src/main.c",
:DataPath => ".",
:Region => "JPN",
}
write_config(DEFAULT_CONFIG, config)
end
# ファイル名にスクリプトを置いてあるディレクトリをくっつける
def calc_path(filename)
# File.join(File.dirname(File.expand_path(__FILE__)), filename)
filename
end
# コンフィグファイルを読んで展開
def read_config(filename)
YAML.load(File.read(calc_path(filename)))
end
# コンフィグのライト
def write_config(filename, data)
File.open(calc_path(filename), "w") {|file|
file.write data.to_yaml
}
end
# データ内の文字列を置き換える
def replace_data(src, mark, data)
while src.index(/%#{mark}%/) != nil do
src = src.sub(/%#{mark}%/, data)
end
src
end
# ファイルを書き込む
def write_data(filename, data)
temp = Tempfile.new("temp")
temp.puts data
temp.close
FileUtils.cp(temp.path, calc_path(filename))
end
# main.rsfの書き換え
def make_rsf(config)
tadlist = config[:TadFiles].dup
tadlist << config[:FontFile] << config[:NandFirm]
tadlist = tadlist.join(" ")
src = File.read(File.join(config[:TemplatePath], config[:RSF]))
#src = File.read(config[:TemplatePath] + "/" + config[:RSF])
src = replace_data(src, "datapath", config[:DataPath])
src = replace_data(src, "regionname", config[:Region])
write_data(File.join(config[:TargetPath], config[:RSF]), replace_data(src, "filelist", tadlist))
#write_data(config[:TargetPath] + "/" + config[:RSF], replace_data(src, "filelist", tadlist))
end
# main.c の書き換え
def make_main(config)
filelist = config[:TadFiles]
data = []
for t in filelist do
data.push("\t\"rom:/data/" + t + "\", \n")
end
data = data.join
#src = File.read(config[:TemplatePath] + "/" + config[:SRC])
src = File.read(File.join(config[:TemplatePath], config[:SRC]))
mod = replace_data(src, "tadlist", data)
mod = replace_data(mod, "nandfirm", config[:NandFirm])
mod = replace_data(mod, "fontfile", config[:FontFile])
# region
region_name = (config[:Region] != nil) ? config[:Region] : "JPN"
region = (REGION[region_name] != nil) ? REGION[region_name] : REGION["JPN"]
mod = replace_data(mod, "region", region)
mod = replace_data(mod, "regionname", region_name)
#write_data(config[:TargetPath] + "/" + config[:SRC], mod)
write_data(File.join(config[:TargetPath], config[:SRC]), mod)
end
# SystemUpdaterを作成する
def make_updater(filename)
config = read_config(filename)
make_rsf(config)
make_main(config)
end
# ディレクトリ内のtadを検索
def pickup_files(target_dir, name)
Dir.glob(target_dir + name)
end
# こっからメイン
#sumaker mode [filename]
if ARGV.size == 0
p "Usage: sumaker mode [filename]"
exit
end
mode = ARGV[0]
case mode
when "default" then
# デフォルト設定で作成
make_default_config
make_updater(DEFAULT_CONFIG)
when "custom" then
if ARGV.size < 3
p "Usage: sumaker custom target_dir region"
exit -1
end
# カスタム設定で作成
config = "custom_base.yaml"
region = ARGV[2]
# カレントディレクトリ変更
Dir.chdir(File.dirname(File.expand_path(__FILE__)))
# ベースコンフィグに、dataディレクトリ内のtadとnandを追加
config = read_config(config)
if config[:TadFiles] == nil
config[:TadFiles] = []
end
#config[:DataPath] += "/#{ARGV[1]}/#{REGION_PATH[region]}"
config[:DataPath] = File.join(config[:DataPath], ARGV[1], REGION_PATH[region])
config[:Region] = region
tads = pickup_files(config[:DataPath], "/*.tad")
nand = pickup_files(config[:DataPath], "/*.nand")
font = pickup_files(config[:DataPath], "/*.dat")
# フォントファイル名変更
system("mv #{font} #{File.join(config[:DataPath], "TWLFontTable")}.dat")
font = pickup_files(config[:DataPath], "/*.dat")
if nand.size > 0
config[:NandFirm] = nand[0].slice(FILE_MATCH)
end
if font.size > 0
config[:FontFile] = font[0].slice(FILE_MATCH)
end
for tad in tads do
tad = tad.slice(FILE_MATCH)
config[:TadFiles] << tad
end
config[:TadFiles] = config[:TadFiles].uniq
write_config(CUSTOM_CONFIG, config)
make_updater(CUSTOM_CONFIG)
exit 0
end

View File

@ -1,229 +0,0 @@
#----------------------------------------------------------------------------
# Project: SystemUpdater
# File: main.rsf
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded insructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Date:: $
# $Rev$
# $Author$
#----------------------------------------------------------------------------
#
# TWL ROM SPEC FILE
#
Arm9
{
Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)"
OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)"
OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)"
Elf "$(MAKEROM_ARM9:r).tef"
}
Arm7
{
Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)"
OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)"
OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)"
Elf "$(MAKEROM_ARM7_BASE:r).tef"
}
Arm9.Ltd
{
Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)"
OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)"
OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)"
}
Arm7.Ltd
{
Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)"
OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)"
OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)"
}
Property
{
###
### Settings for FinalROM
###
#### BEGIN
#
# TITLE NAME: Your product name within 12bytes
#
#TitleName "YourAppName"
#
# MAKER CODE: Your company ID# in 2 ascii words
# issued by NINTENDO
#
#MakerCode "00"
#
# REMASTER VERSION: Mastering version
#
#RomVersion 0
#
# ROM SPEED TYPE: [MROM/1TROM/UNDEFINED]
#
RomSpeedType $(MAKEROM_ROMSPEED)
#
# ROM SIZE: in bit [64M/128M/256M/512M/1G/2G]
#
RomSize 64M
#
# ROM PADDING: TRUE if finalrom
#
#RomFootPadding TRUE
#
# ROM HEADER TEMPLATE: Provided to every product by NINTENDO
#
#RomHeaderTemplate ./etc/rom_header.template.sbin
#
# BANNER FILE: generated from Banner Spec File
#
BannerFile ../banner/banner_%regionname%.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 ../%datapath%
Root /data
File %filelist%
HostRoot $(PRIVKEY_PATH)
Root /key
File $(HWINFO_PRIVKEY) $(HWID_PRIVKEY)
}

View File

@ -1,765 +0,0 @@
/*---------------------------------------------------------------------------*
Project: SystemUpdater
File: main.c
Copyright 2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Date:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#include <stdlib.h> // atoi
#include <twl.h>
#include <nitro/snd.h>
#include <twl/fatfs.h>
#include <twl/os/common/format_rom.h>
#include <sysmenu/namut.h>
#include <twl/nam.h>
#include "kami_pxi.h"
#include "kami_font.h"
#include "kami_write_nandfirm.h"
#include "kami_copy_file.h"
#include "import.h"
#include "hw_info.h"
#include "graphics.h"
#include "hwi.h"
#include "keypad.h"
#include "debugger_hw_reset_control.h"
#include "debugger_card_rom.h"
#include "build_time.h"
#define SCRAMBLE_MASK 0x00406000
extern const char *g_strIPLSvnRevision;
extern const char *g_strSDKSvnRevision;
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
typedef struct _SystemUpdaterLog
{
int magic_code;
int sdk_version;
int ipl_version;
int reserve[5];
} SystemUpdaterLog;
typedef struct _CopyFileList
{
char* srcPath;
char* dstPath;
} CopyFileList;
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
#define SYSTEM_UPDATER_LOG_PATH "nand:/sys/log/updater.log"
#define NAND_FIRM_PATH_IN_ROM "rom:/data/%nandfirm%"
#define SYSTEM_UPDATER_MAGIC_CODE 44001111
// リトライ回数
#define MAX_RETRY_COUNT 2
static const char* ImportTadFileList[] =
{
%tadlist%
};
static const CopyFileList sCopyFileList[] =
{
{ "rom:/data/%fontfile%", "nand:sys/%fontfile%" }
};
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
static NAMTitleId titleId;
static s16 printLine;
static vu8 sIsFormatFinish;
static u8 sFormatResult;
static s32 sLockId;
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
static void VBlankIntr(void);
static void InitAllocation(void);
static BOOL IgnoreRemoval(void);
static void DrawWaitButtonA(void);
static void DrawInvalidConsole(void);
static void DrawCancel(void);
static void DrawAlready(SystemUpdaterLog* log);
static void DrawResult(BOOL result);
static void FormatCallback(KAMIResult result, void* arg);
/*---------------------------------------------------------------------------*
Name: TwlMain
Description: main
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void
TwlMain()
{
BOOL result;
BOOL hw_info_result;
BOOL nand_firm_result;
int tadNum;
int i,j;
// 製品ビルドランチャー&デバッガ上での起動対応
if ( OS_GetRunningConsoleType() & OS_CONSOLE_TWLDEBUGGER )
{
ROM_Header *dh = (void *)HW_ROM_HEADER_BUF;
dh->s.game_cmd_param &= ~SCRAMBLE_MASK;
}
OS_Init();
OS_InitThread();
OS_InitTick();
OS_InitAlarm();
OS_InitArena();
PXI_Init();
OS_InitLock();
OS_InitArenaEx();
OS_InitIrqTable();
OS_SetIrqStackChecker();
MI_Init();
OS_InitVAlarm();
OSi_InitVramExclusive();
OS_InitThread();
OS_InitReset();
GX_Init();
FX_Init();
SND_Init();
TP_Init();
RTC_Init();
KamiPxiInit(); /* 独自PXI初期化 */
// Vブランク割り込み設定
OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
(void)OS_EnableIrqMask(OS_IE_V_BLANK);
(void)OS_EnableIrqMask(OS_IE_FIFO_RECV);
(void)OS_EnableIrq();
(void)GX_VBlankIntr(TRUE);
// initialize file-system
FS_Init(FS_DMA_NOT_USE);
InitAllocation();
// NAMライブラリ初期化
NAM_Init( OS_AllocFromMain, OS_FreeToMain );
NAMUT_Init( OS_AllocFromMain, OS_FreeToMain ); // SoftBoxCountの計算に必要
// 表示関連初期化
InitGraphics();
kamiFontInit();
// メインスレッドのカードロックID取得
sLockId = OS_GetLockID();
/* always preload FS table for faster directory access. */
{
u32 need_size = FS_GetTableSize();
void *p_table = OS_Alloc(need_size);
SDK_ASSERT(p_table != NULL);
(void)FS_LoadTable(p_table, need_size);
}
// コンソールチェック
{
u32 console = OS_GetRunningConsoleType();
enum { IS_TWL_DEBUGGER=0, IS_TWL_CAPTURE, TWL, UNKNOWN };
int running = UNKNOWN;
// SystemUpdaterはデバッグ不可で作成されるためOS_CONSOLE_TWLが取得される
// 赤箱にカードを挿してSystemUpdaterを実行した場合も同様但しOS_CONSOLE_TWLTYPE_RETAILにはならない
// デバッガかどうかの判定はメモリサイズチェックにより行う
// 念のためOS_CONSOLE_TWLTYPE_RETAILでないことも確認する
if ((console & OS_CONSOLE_SIZE_MASK) == OS_CONSOLE_SIZE_32MB)
{
if ((console & OS_CONSOLE_TWLTYPE_MASK) != OS_CONSOLE_TWLTYPE_RETAIL)
{
IsToolType type;
kamiGetIsToolType(&type);
if (type == IS_TOOL_TYPE_DEBUGGER)
{
running = IS_TWL_DEBUGGER;
}
else if (type == IS_TOOL_TYPE_ERROR) // TSボードプラス + 旧仕様デバッガ
{
running = IS_TWL_DEBUGGER;
}
else if (type == IS_TOOL_TYPE_CAPTURE)
{
running = IS_TWL_CAPTURE;
}
}
}
else if ((console & OS_CONSOLE_MASK) == OS_CONSOLE_TWL)
{
IsToolType type;
kamiGetIsToolType(&type);
if (type == IS_TOOL_TYPE_CAPTURE)
{
running = IS_TWL_CAPTURE;
}
else
{
running = TWL;
}
}
switch (running)
{
case IS_TWL_DEBUGGER:
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Running on IS_TWL_DEBUGGER.");
break;
case IS_TWL_CAPTURE:
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Running on IS_TWL_CAPTURE.");
break;
case TWL:
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Running on TWL CONSOLE.");
break;
case UNKNOWN:
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Running on UNKNOWN.");
break;
}
#ifdef SYSM_BUILD_FOR_DEBUGGER
// デバッガ向けSystemUpdaterは実機とキャプチャでは動作させない
if (running != IS_TWL_DEBUGGER)
{
kamiFontPrintfMain( 2, 9, 3, " Sorry, ");
kamiFontPrintfMain( 2, 10, 3, " This SystemUpdater can not ");
kamiFontPrintfMain( 2, 11, 3, " execute on TWL-CONSOLE. ");
DrawInvalidConsole();
}
#else
// 実機向けSystemUpdaterはデバッガでは動作させない
if (running == IS_TWL_DEBUGGER)
{
kamiFontPrintfMain( 2, 9, 3, " Sorry, ");
kamiFontPrintfMain( 2, 10, 3, " This SystemUpdater can not ");
kamiFontPrintfMain( 2, 11, 3, " execute on IS-TWL-DEBUGGER.");
DrawInvalidConsole();
}
#endif // SYSM_BUILD_FOR_DEBUGGER
// UNKNOWNはは動作させない
if (running == UNKNOWN)
{
kamiFontPrintfMain( 2, 9, 3, " Sorry, ");
kamiFontPrintfMain( 2, 10, 3, " This SystemUpdater can not ");
kamiFontPrintfMain( 2, 11, 3, " execute on UNKNOWN CONSOLE.");
DrawInvalidConsole();
}
}
// (更新可能条件)
// 1.ログが存在しない
// 2.ログが存在し、ログに記載のマジックコードが不正初版SystemUpdater実行後の状態
// 2.ログが存在し、ログに記載のマジックコードが正しくかつログに記載の
// SDK & IPL のバージョンが SystemUpdater のそれ以下である
#ifdef IGNORE_VERSION_CHECK
if( 0 )
#endif // IGNORE_VERSION_CHECK
{
SystemUpdaterLog log;
FSFile file;
FS_InitFile( &file );
if (FS_OpenFileEx(&file, SYSTEM_UPDATER_LOG_PATH, FS_FILEMODE_R) == TRUE)
{
DC_InvalidateRange(&log, sizeof(log));
if (FS_ReadFile(&file, &log, sizeof(log)) == sizeof(log))
{
// ログリード成功
OS_Printf("[%d, %d]\n", log.sdk_version, log.ipl_version);
// 初版SystemUpdater実行状態でないことをマジックコードで判別する
if (log.magic_code == SYSTEM_UPDATER_MAGIC_CODE)
{
// マジックコード、SDKバージョン、IPLバージョンの確認
if (log.sdk_version > atoi(g_strSDKSvnRevision) ||
log.ipl_version > atoi(g_strIPLSvnRevision))
{
// 更新不可
DrawAlready(&log);
}
}
}
else
{
// ログリード失敗
OS_Warning("Failure! FS_ReadFile");
}
FS_CloseFile(&file);
}
}
// Aボタン待ち
DrawWaitButtonA();
// TWLの更新処理を実行中です
CARD_LockRom((u16)sLockId);
(void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_NOW_UPDATE);
CARD_UnlockRom((u16)sLockId);
// ISデバッガのハードウェアリセットを禁止する
DEBUGGER_HwResetDisable();
// HWInfo関連の前準備
switch (HWI_Init( OS_AllocFromMain, OS_FreeToMain ))
{
case HWI_INIT_FAILURE:
OS_Warning(" Fail! : HWI_INIT()");
break;
case HWI_INIT_SUCCESS_PRO_SIGNATURE_MODE:
break;
case HWI_INIT_SUCCESS_DEV_SIGNATURE_MODE:
break;
case HWI_INIT_SUCCESS_NO_SIGNATRUE_MODE:
break;
}
result = TRUE;
// 完全に消去
NAMUT_Format();
// フォーマット実行
sIsFormatFinish = FALSE;
ExeFormatAsync(FORMAT_MODE_QUICK, FormatCallback);
kamiFontPrintfMain( 7, 11, 8, "Now Format...");
while(!sIsFormatFinish){};
if (sFormatResult)
{
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "NAND Format Success.");
}
else
{
kamiFontPrintf( 0, printLine++, FONT_COLOR_RED, "NAND Format Failure!");
}
kamiFontPrintfMain( 7, 11, 8, " ");
// フォーマット後はESに必要なファイルがなくなっているため
// ES_InitLibを呼び出すことで作成しておく
NAM_End( NULL, NULL );
NAM_Init( OS_AllocFromMain, OS_FreeToMain );
// 全ハードウェア情報の更新
for (i=0;i<MAX_RETRY_COUNT;i++)
{
hw_info_result = WriteHWInfoFile(%region%, OS_IsForceDisableWireless());
if (hw_info_result)
{
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Write Hardware Info Success.");
break;
}
else
{
kamiFontPrintfConsole(CONSOLE_RED, "Write Hardware Info Retry!\n");
}
}
if ( hw_info_result == FALSE)
{
result = FALSE;
kamiFontPrintf( 0, printLine++, FONT_COLOR_RED, "Write Hardware Info Failure!");
}
// 必要なファイルの書き込み
for (i=0;i<sizeof(sCopyFileList)/sizeof(sCopyFileList[0]);i++)
{
if (kamiCopyFile(sCopyFileList[i].srcPath, sCopyFileList[i].dstPath))
{
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Write Data File %d Success.", i);
}
else
{
result = FALSE;
kamiFontPrintf( 0, printLine++, FONT_COLOR_RED, "Write Data File %d Failure!", i);
}
}
// TADのインポート開始
tadNum = sizeof(ImportTadFileList)/sizeof(ImportTadFileList[0]);
for (i=0; i<tadNum; i++)
{
s32 nam_result;
// MAX_RETRY_COUNTまでリトライする
for (j=0; j<MAX_RETRY_COUNT; j++)
{
nam_result = kamiImportTad(i+1, tadNum, ImportTadFileList[i]);
if (nam_result == NAM_OK)
{
break;
}
else
{
kamiFontPrintfConsole(CONSOLE_RED, "Import %d Retry!\n", i+1);
}
}
if ( nam_result == NAM_OK)
{
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "List : %d Update Success.", i+1 );
}
else
{
kamiFontPrintf( 0, printLine++, FONT_COLOR_RED, "Error: %d : RetCode = %d", i+1, nam_result );
result = FALSE;
}
}
// NANDファームのインストール開始
for (j=0;j<MAX_RETRY_COUNT;j++)
{
nand_firm_result = kamiWriteNandfirm(NAND_FIRM_PATH_IN_ROM, OS_AllocFromMain, OS_FreeToMain);
if (nand_firm_result)
{
kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Firm Update Success.");
break;
}
else
{
kamiFontPrintfConsole(CONSOLE_RED, "Write Firm Retry!\n");
}
}
if ( nand_firm_result == FALSE)
{
result = FALSE;
kamiFontPrintf( 0, printLine++, FONT_COLOR_RED, "Firm Update Failure!");
}
// 更新ログを作成して再実行を防ぐ
#ifdef IGNORE_VERSION_CHECK
if( 0 )
#else
if (result)
#endif
{
SystemUpdaterLog log;
(void)FS_DeleteFile(SYSTEM_UPDATER_LOG_PATH);
if (FS_CreateFileAuto(SYSTEM_UPDATER_LOG_PATH, FS_PERMIT_R | FS_PERMIT_W))
{
FSFile file;
FS_InitFile( &file );
if (FS_OpenFileEx(&file, SYSTEM_UPDATER_LOG_PATH, FS_FILEMODE_W))
{
log.magic_code = SYSTEM_UPDATER_MAGIC_CODE;
log.sdk_version = atoi(g_strSDKSvnRevision);
log.ipl_version = atoi(g_strIPLSvnRevision);
DC_FlushRange(&log, sizeof(log));
if (FS_WriteFile(&file, (void*)&log, sizeof(log) ) == -1)
{
OS_Warning("Failure : FS_WriteFile\n");
}
FS_CloseFile(&file);
}
}
else
{
OS_Warning("Failure : FS_CreateFileAuto\n");
}
}
// ISデバッガのハードウェアリセットを許可する
DEBUGGER_HwResetEnable();
// TWLの更新処理が完了しました
CARD_LockRom((u16)sLockId);
(void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_FINISHED);
CARD_UnlockRom((u16)sLockId);
// 結果表示
while(1)
{
DrawResult(result);
OS_WaitVBlankIntr();
};
}
/*---------------------------------------------------------------------------*
Name: VBlankIntr
Description: VBlank割り込み処理
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
static void
VBlankIntr(void)
{
kamiFontLoadScreenData();
OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt
}
/*---------------------------------------------------------------------------*
Name: InitAllocation
Description: .
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
static void InitAllocation(void)
{
void *tmp;
OSHeapHandle hh;
/* アリーナの初期化 */
tmp = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1);
OS_SetArenaLo(OS_ARENA_MAIN, tmp);
hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi());
if (hh < 0)
OS_Panic("ARM9: Fail to create heap...\n");
hh = OS_SetCurrentHeap(OS_ARENA_MAIN, hh);
}
/*---------------------------------------------------------------------------*
Name: DrawWaitButtonA
Description: Aボタン待ちを表示します
Arguments:
Returns: None.
*---------------------------------------------------------------------------*/
static void DrawWaitButtonA(void)
{
// 液晶を見てください。
CARD_LockRom((u16)sLockId);
(void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_LOOK_SCREEN);
CARD_UnlockRom((u16)sLockId);
kamiFontPrintfMain( 5, 3, 8, " System Updater [%regionname%]");
kamiFontPrintfMain( 4, 5, 8, " --- ver %s %s ---", g_strSDKSvnRevision, g_strIPLSvnRevision );
kamiFontPrintfMain( 1, 6, 8, "Build time:%s", BUILD_TIME );
kamiFontPrintfMain( 5, 9, 3, " A Button: Start Update ");
kamiFontPrintfMain( 5, 10, 3, " B Button: Cancel Update ");
kamiFontPrintfMain( 3, 13, 1, "Do not turn off power");
kamiFontPrintfMain( 3, 14, 1, "while update is processing");
while(1)
{
G3X_Reset();
G3_Identity();
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
DrawQuad( 10, 54, 246, 150, GX_RGB(28, 28, 28));
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
kamiPadRead();
if (kamiPadIsTrigger(PAD_BUTTON_A))
{
kamiFontClearMain();
break;
}
else if (kamiPadIsTrigger(PAD_BUTTON_B))
{
kamiFontClearMain();
DrawCancel();
}
OS_WaitVBlankIntr();
}
G3X_Reset();
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
OS_WaitVBlankIntr();
}
/*---------------------------------------------------------------------------*
Name: DrawInvalidConsole
Description:
Arguments:
Returns: None.
*---------------------------------------------------------------------------*/
static void DrawInvalidConsole(void)
{
// キャンセルされました
CARD_LockRom((u16)sLockId);
(void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_CANCELED);
CARD_UnlockRom((u16)sLockId);
while(1)
{
G3X_Reset();
G3_Identity();
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
DrawQuad( 10, 50, 246, 120, GX_RGB(28, 28, 28));
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
OS_WaitVBlankIntr();
}
}
/*---------------------------------------------------------------------------*
Name: DrawCancel
Description: Cancelを表示します
Arguments:
Returns: None.
*---------------------------------------------------------------------------*/
static void DrawCancel(void)
{
// キャンセルされました
CARD_LockRom((u16)sLockId);
(void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_CANCELED);
CARD_UnlockRom((u16)sLockId);
kamiFontPrintfMain( 3, 9, 1, "--------------------------");
kamiFontPrintfMain( 3, 10, 1, " Update was Canceld.");
kamiFontPrintfMain( 3, 11, 1, "--------------------------");
while(1)
{
G3X_Reset();
G3_Identity();
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
DrawQuad( 10, 50, 246, 128, GX_RGB(28, 28, 28));
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
OS_WaitVBlankIntr();
}
}
/*---------------------------------------------------------------------------*
Name: DrawAlready
Description: Alreadyを表示します
Arguments:
Returns: None.
*---------------------------------------------------------------------------*/
static void DrawAlready(SystemUpdaterLog* log)
{
// 既にアップデート済み
CARD_LockRom((u16)sLockId);
(void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_ALREADY);
CARD_UnlockRom((u16)sLockId);
kamiFontPrintfMain( 3, 8, 1, "--------------------------");
kamiFontPrintfMain( 3, 9, 1, "This machine has already");
kamiFontPrintfMain( 3, 10, 1, "been updated.");
kamiFontPrintfMain( 3, 12, 1, "ver: %d %d", log->sdk_version, log->ipl_version );
kamiFontPrintfMain( 3, 13, 1, "--------------------------");
while(1)
{
G3X_Reset();
G3_Identity();
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
DrawQuad( 10, 50, 246, 128, GX_RGB(28, 28, 28));
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
OS_WaitVBlankIntr();
}
}
/*---------------------------------------------------------------------------*
Name: DrawResult
Description:
Arguments:
Returns: None.
*---------------------------------------------------------------------------*/
static void DrawResult(BOOL result)
{
// 3D初期化
G3X_Reset();
G3_Identity();
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0);
// "Now Updating.." を消去
kamiFontPrintfMain( 0, 9, 7, " ");
if (result)
{
kamiFontPrintfMain( 9, 10, 7, "Update Success!");
// グリーンダイアログ
DrawQuad( 50, 50, 206, 120, GX_RGB(12, 25, 12));
}
else
{
kamiFontPrintfMain( 9, 10, 7, "Update Failure!");
// レッドダイアログ
DrawQuad( 50, 50, 206, 120, GX_RGB(31, 0, 0));
}
kamiFontLoadScreenData();
// 3Dスワップ
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
}
/*---------------------------------------------------------------------------*
Name: FormatCallback
Description:
Arguments:
Returns: None.
*---------------------------------------------------------------------------*/
static void FormatCallback(KAMIResult result, void* /*arg*/)
{
if ( result == KAMI_RESULT_SUCCESS_TRUE )
{
sFormatResult = TRUE;
}
else
{
sFormatResult = FALSE;
}
sIsFormatFinish = TRUE;
}

View File

@ -1,48 +0,0 @@
#!/bin/sh
#! bash -f
#----------------------------------------------------------------------------
# Project: TwlSDK - tools
# File: aftercls.sh
#
# 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$
#----------------------------------------------------------------------------
AQUA='//10.116.1.5'
CLSED_PATH="${AQUA}/TWL_debug/sysmenu/rom/debug_rom/CLS_processed"
DAILY_CLSED_DIR=`date +'%Y%m%d'`_cls
if [ $# -lt 1 ];
then
echo "input target dir name"
exit
fi
echo "tocsu.sh"
./tocsu.sh $1
echo "toaqua.rb"
./toaqua.rb $1
# Aquaへコピー
echo "Copying to Aqua"
cp -r $1_foraqua ${CLSED_PATH}/${DAILY_CLSED_DIR}
# Shop ROM のコピー
shopdir="${AQUA}/TWL_debug/shop/rom/cls/${DAILY_CLSED_DIR}"
/bin/mkdir ${shopdir}
/bin/cp $1_foraqua/verup/tad/shop* ${shopdir}
# NZV ROM のコピー
nzvdir="${AQUA}/TWL_debug/nintendo_spot/rom/clsprocessed/"`date +'%Y%m%d'`
/bin/mkdir ${nzvdir}
/bin/cp -r $1/HNJ* ${nzvdir}

View File

@ -1,51 +0,0 @@
#!/bin/sh
#! bash -f
#----------------------------------------------------------------------------
# Project: TwlSDK - tools
# File: conv2svnDir.sh
#
# 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$
#----------------------------------------------------------------------------
move_data_to_tmp() {
tmp=tmp/$1
install -d $tmp
for src in `find $1 -name v* -type d`
do
mv $src $tmp
done
}
do_cls() {
tmp=tmp/$1
for target in `find $tmp -name v* -type d | sort -t / -n -k 3.2`
do
cp -rp $target $1
t=`echo "$target" | cut -c 5-`
if [ -f $t/*.cls ]; then
echo "$t:Already cls processed"
else
genLic $1
fi
# genLic $1
done
}
for app in `find . -maxdepth 1 -mindepth 1 -type d`
do
name=`echo "$app" | cut -c 3-`
move_data_to_tmp $name
do_cls $name
done
rm -rf tmp

View File

@ -1,151 +0,0 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys, os, struct
import string, random
import re, shutil, binascii
def roundup(val, align):
return int((val+align-1)/align)*align
def randstr(n):
words = ''.join([string.digits,string.letters,'.','+'])
return ''.join(random.choice(words) for i in xrange(n))
def main():
try:
tadfile = sys.argv[1]
except:
print '%s : please specfy the tad file' % (sys.argv[0])
exit(-1)
#--- parse *.tad
fin = open(tadfile, 'rb')
try:
tadData = fin.read()
except:
fin.close()
start, end = 0, struct.calcsize('>l2sh6l')
(hdrSize, tadType, tadVersion, certSize, crlSize, ticketSize, tmdSize,
contentSize, metaSize) = struct.unpack('>l2sh6l', tadData[start:end])
certOffset = roundup(hdrSize, 64)
crlOffset = roundup(certOffset + certSize, 64)
ticketOffset = roundup(crlOffset + crlSize, 64)
tmdOffset = roundup(ticketOffset + ticketSize, 64)
contentOffset = roundup(tmdOffset + tmdSize, 64)
metaOffset = roundup(contentOffset + contentSize, 64)
fileSize = roundup(metaOffset + metaSize, 64)
#print '-'*20+'\n'
#print ' hdrSize %s\n' % hdrSize,
#print ' tadType %s\n' % tadType,
#print ' tadVersion, %s\n' % tadVersion,
#print ' certSize, %s\n' % certSize,
#print ' crlSize, %s\n' % crlSize,
#print ' ticketSize, %s\n' % ticketSize,
#print ' tmdSize, %s\n' % tmdSize,
#print ' contentSize, %s\n' % contentSize,
#print ' metaSize %s'
#print '\n'+'-'*20
#open("cert.bin", 'wb').write(tadData[certOffset:certOffset+certSize])
#open("crl.bin", 'wb').write(tadData[crlOffset:crlOffset+crlSize])
#open("ticket.bin", 'wb').write(tadData[ticketOffset:ticketOffset+ticketSize])
#open("tmd.bin", 'wb').write(tadData[tmdOffset:tmdOffset+tmdSize])
#open("content.bin", 'wb').write(tadData[contentOffset:contentOffset+contentSize])
#open("meta.bin", 'wb').write(tadData[metaOffset:metaOffset+metaSize])
#--- parse TMD
tmd = tadData[tmdOffset:tmdOffset+tmdSize]
#--- RSA2048 signature
(sigB, sigE) = (0, struct.calcsize('>i256s60s64s'))
(IOSCCertSigType, IOSCRsaSig2048, IOSCSigDummy, IOSCName)\
= struct.unpack('>i256s60s64s', tmd[sigB:sigE])
#print "=== RSA2048 signature ==============="
#print "IOSCCertSigType : %x" % IOSCCertSigType
#print "IOSCRsaSig2048 : %s" % IOSCRsaSig2048
#print "IOSCSigDummy : %s" % IOSCSigDummy
#print "IOSCName : %s" % IOSCName
#--- ESTitleMetaHeader
(tmhB, tmhE) = (sigE, sigE+struct.calcsize('>4B5iH62si3H'))
(version,
caCrlVersion,
signerCrlVersion,
dummy,
sysVersion_H,
sysVersion_L,
titleId_H,
titleId_L,
titleType,
groupID,
reserved,
accessRights,
titleVersion,
numContents,
bootIndex) = struct.unpack('>4B5iH62si3H',tmd[tmhB:tmhE])
print "=== ESTitleMetaHeader ==============="
#print ('version : %d ') % version
#print ('caCrlVersion : %d ') % caCrlVersion
#print ('signerCrlVersion : %d ') % signerCrlVersion
#print ('dummy : %s ') % dummy
#print ('sysVersion_H : %x ') % sysVersion_H
#print ('sysVersion_L : %x ') % sysVersion_L
print ('titleId_H : %08x ') % titleId_H
print ('titleId_L : %08x ') % titleId_L
#print ('titleType : %x ') % titleType
print ('groupID : %x ') % groupID
#print ('reserved[62] : %s ') % reserved
#print ('accessRights : %d ') % accessRights
print ('titleVersion : %d ') % titleVersion
#print ('numContents : %d ') % numContents
#print ('bootIndex : %d ') % bootIndex
#--- make directory for cls
tadpath = os.path.dirname(tadfile)
gamecode = binascii.unhexlify('%x'%titleId_L)
keycode = gamecode[:3]
sysdic = { 'HNA':'menu',
'HNB':'setting',
'HNC':'wfirm',
'HND':'dlplay',
'HNE':'pchat',
'HNF':'shop',
'HNG':'browser',
'HNH':'whlist',
'HNI':'photo',
'HNJ':'nzv',
'HNK':'sound',
'HNL':'verdata',
}
try:
suffix = sysdic.get(keycode)
if suffix:
clsdir = ''.join(['./',gamecode,'-',suffix])
else:
clsdir = ''.join(['./',gamecode])
os.mkdir(clsdir)
except:
print '%s : can not create dir %s' % (sys.argv[0],clsdir)
#--- write properties
properties = open(''.join([clsdir,'/properties']),'w')
properties.write('TITLE_ID\t\t\t\t%08x%08x\n' % (titleId_H, titleId_L))
properties.write('TITLE_NAME\t\t\t\t%s\n' % gamecode)
properties.write('TITLE_TYPE\t\t\t\t%s\n' % 'TWL_SYS')
properties.write('PASSWORD\t\t\t\t%s\n' % randstr(64))
properties.write('ALLOW_COMMON_TICKET\t\t%s\n' % '1')
#--- make version dir
verdir = ''.join([clsdir,'/v',str(titleVersion)])
try:
os.mkdir(verdir)
except:
print '%s : can not create dir %s' % (sys.argv[0],verdir)
else:
shutil.copy(tadfile,verdir)
if __name__ == '__main__':
sys.exit(main() or 0)

View File

@ -1,55 +0,0 @@
#!/bin/sh
#! bash -f
#---- commands
LS='/bin/ls'
ECHO='/bin/echo'
HEAD='/bin/head'
FIND='/bin/find'
COPY='/bin/cp'
DATE='/bin/date'
XARGS='/bin/xargs'
MKDIR='/bin/mkdir'
CHDIR='cd'
#---- values
aqua_server='//10.116.1.5'
debug_dir="${aqua_server}/TWL_debug/sysmenu/rom/debug_rom"
redroms="${debug_dir}/sd.roms.template*"
clsbase="${debug_dir}/CLS_base"
datedir=`${DATE} +%Y%m%d`
regions='jp usa euro aus'
#---- call pickup_tad.pl
${ECHO} "===== getting latest apps files ====="
perl ./pickup_tad.pl
#---- gets the latest sd.roms.template roms
#redrom_dir=`${LS} -d --full-time ${redroms} | sort -k 7,10 | tail -n 1`
redrom_dir=`${LS} -dt ${redroms} | ${HEAD} -n 1`
${ECHO} -e "===== getting sd.roms.template* rom files ====="
${ECHO} -e "sd.roms.template dir : ${redrom_dir}"
${ECHO} -e "copy *.(tad|dat|nand) file -> ${datedir} dir\n"
${FIND} ${redrom_dir} -regextype posix-egrep -regex ".*.(tad|dat|nand)" | ${XARGS} ${COPY} -fut ${datedir} > /dev/null
#---- gets the cls base roms
${ECHO} -e "===== getting sd.roms.template* rom files ====="
${ECHO} -e "CLS_base dir : ${clsbase}"
${ECHO} -e "copy *.tad file -> ${datedir} dir"
${FIND} ${clsbase} -name "*.tad" | ${XARGS} ${COPY} -fut ${datedir} > /dev/null
#---- call mkcls.py
${ECHO} -e "===== create forcls dirs ====="
${MKDIR} ${datedir}_forcls
${CHDIR} ${datedir}_forcls
${FIND} ../${datedir} -name "*.tad" -exec ../mkcls.py {} \;
${ECHO} -e "===== copy *.nand *.dat files -> (jp|usa|euro|aus) dirs =====\n"
for region in ${regions}
do
${MKDIR} ${region}
${COPY} ../${datedir}/*.nand ${region}
${COPY} ../${datedir}/*.dat ${region}
done
${COPY} ../cls.sh ./

View File

@ -1,146 +0,0 @@
#!/usr/bin/perl -w -I/usr/local/bin
use File::Copy;
use File::Copy::Recursive qw(fcopy rcopy dircopy);
use Class::Struct;
use POSIX 'strftime';
use File::Find;
require "util.pl";
my @apps = ("download_play",
"full_browser",
"nintendo_spot",
"photo",
"pictchat",
"shop",
"sound",
"sysmenu");
my $flgDate = 0;
my $i;
my $date_dir = "";
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
my $str_today = sprintf("%04d%02d%02d", $year+1900, $mon+1, $mday);
my $flghelp = 0;
my $err;
my @list_tad;
for ($i = 0; $i < $#ARGV+1; $i++) {
my $opt = $ARGV[$i];
if ( $opt eq "-d" ) {
$flgDate = 1;
unless ( $#ARGV <= $i ) {
#$date_dir = $aqua_dir."/SD_".$ARGV[$i+1];
$str_today = $ARGV[$i+1];
$err = [ 1, "Not date (\"$date_dir\") !!"] if ( $date_dir !~ /[0-9]{8}/ );
$i++;
} else {
$err = [1,"No argument after -d !!"];
}
} elsif ( $opt eq "-h" ) {
&show_help;
exit 0;
} else {
print "Unknown option: $opt\n";
&show_help;
exit 1;
}
do {
print "*** Error *** : $err->[1]";
exit 1;
} if ( $err->[0] );
}
# each application directory
foreach $app ( @apps )
{
my $dir_date;
#$dir_app = sprintf('//Aqua/TWL_debug/%s/rom/tad', $app);
$dir_app = sprintf('//10.116.1.5/TWL_debug/%s/rom/tad', $app);
$dir_app_date = &search_date_dir($dir_app);
print "* $dir_app\n - $dir_app_date\n\n";
find( sub
{
do {
push @list_tad, $File::Find::name }if (/\.tad$/);
}, $dir_app_date
);
#foreach ( @list_tad ) { print " * $_\n"; }
}
#print "Date: $date_dir\n";
# Actually not today
mkdir($str_today);
# copy to the local date directory
foreach ( @list_tad ) {
print("$_\n");
copy($_, $str_today);
}
#
exit 0;
#-----------------------------------------------------------------------
# name : show_help
# function :
#-----------------------------------------------------------------------
sub show_help
{
print <<__MSG_HELP__;
Usage:
\$ perl pickup_tad.pl [-d yyyymmdd]
__MSG_HELP__
}
#-----------------------------------------------------------------------
# name : search_date_dir
# function :
#-----------------------------------------------------------------------
sub search_date_dir
{
my $root_dir;
my $date_dir;
my $prefix = ($#_<1) ? "" : $_[1];
my $full_prefix;
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900;
$mon += 1;
$root_dir = ( $#_ < 0 ) ? "." : $_[0];
$full_prefix = $root_dir."/".$prefix;
$date_dir = $full_prefix.sprintf("%04d%02d%02d", $year, $mon, $mday);
# search directory on going back date
while ( $year >= 2000 ) {
if ( -e "$date_dir" and -d "$date_dir") {
return "$date_dir";
} else {
$mday -= 1;
$date_dir = $full_prefix.sprintf("%04d%02d%02d", $year, $mon, $mday);
}
do {
$mday = 31; # constant
$mon -= 1;
unless ( $mon ) {
$mon = 12;
$year -= 1;
}
} unless ( $mday ) ;
}
print "*** Error *** : Can't find the date directory !!\n";
return 0;
}
__END__

View File

@ -1,92 +0,0 @@
#!/bin/ruby
#----------------------------------------------------------------------------
# Project: TwlSDK - tools
# File: toaqua.sh
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Date:: $
# $Rev$
# $Author$
#----------------------------------------------------------------------------
require "find"
require "fileutils"
REGION_DIR = {
"U" => ["aus"],
"E" => ["usa"],
"J" => ["jp"],
"P" => ["euro"],
"A" => ["aus", "usa", "jp", "euro"],
}
VERUP_DIR = "verup"
VERUP_CLS = "#{VERUP_DIR}/cls"
VERUP_TAD = "#{VERUP_DIR}/tad"
def proc(target_dir, output_dir)
Find.find(target_dir){ |path|
next unless File.file?(path) && (/[a-z0-9A-Z]{4}-.*v[0-9]+\.tad\.out/ =~ path) != nil
# p path
src = path
# ディレクトリ内のtadファイルの.tadより前を取り出す
dest = ""
version = ""
Find.find(File.split(src)[0]){|tad|
# .tad が見つかった
if (/.*\.tad\z/ =~ tad) != nil
dest = File.split(tad)[1]
end
if (/.*\.cls\z/ =~ tad) != nil
p tad
version = tad.slice(/v[0-9]+/)
end
}
dest = /\.tad/.match(dest).pre_match + "-" + version + ".tad"
# リージョンを判別してコピー
regions = REGION_DIR[File.split(src)[1][3..3]]
for region in regions do
if version != "v0"
p version
p src
system("cp #{src} #{[output_dir, "#{VERUP_TAD}", dest].join("/")}")
system("cp #{src.sub(/\.tad\.out/, ".cls")} #{[output_dir, "#{VERUP_CLS}", dest.sub(/\.tad/, ".cls")].join("/")}")
else
system("cp #{src} #{[output_dir, region, dest].join("/")}")
end
end
}
end
# こっからメイン
if ARGV.size < 1
$stdout.printf("Usage:#{__FILE__} target_clsed_dir output_dir")
exit -1
end
src = ARGV[0].sub(/\/\z/, "")
out = "#{src}_foraqua"
system("mkdir #{out}")
system("mkdir #{out}/aus")
system("mkdir #{out}/usa")
system("mkdir #{out}/euro")
system("mkdir #{out}/jp")
system("mkdir #{out}/#{VERUP_DIR}")
system("mkdir #{out}/#{VERUP_CLS}")
system("mkdir #{out}/#{VERUP_TAD}")
system("cp -rf #{src}/aus #{out}")
system("cp -rf #{src}/usa #{out}")
system("cp -rf #{src}/euro #{out}")
system("cp -rf #{src}/jp #{out}")
proc(src, out)

View File

@ -1,51 +0,0 @@
#!/bin/sh
#! bash -f
#----------------------------------------------------------------------------
# Project: TwlSDK - tools
# File: conv2svnDir.sh
#
# 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$
#----------------------------------------------------------------------------
if [ $# -lt 1 ];
then
echo "input target dir name"
exit
fi
target=`echo $1 | sed -e 's/\/$//'`
target=$target"_forcls"
echo $target
mkdir $target
cd $target
find ../$1 -name "*.tad" -exec ../mkcls.py {} \;
cp ../cls.sh ./
# nandファームと、フォントを一応リージョン毎にコピー
mkdir jp
mkdir aus
mkdir usa
mkdir euro
cp `find ../$1/jp -name "*.nand"` jp
cp `find ../$1/jp -name "*.nand"` aus
cp `find ../$1/jp -name "*.nand"` usa
cp `find ../$1/jp -name "*.nand"` euro
cp `find ../$1/jp -name "*.dat"` jp
cp `find ../$1/jp -name "*.dat"` aus
cp `find ../$1/jp -name "*.dat"` usa
cp `find ../$1/jp -name "*.dat"` euro

View File

@ -1,66 +0,0 @@
#!/bin/sh
#! bash -f
#----------------------------------------------------------------------------
# Project: TwlSDK - tools
# File: tocsu.sh
#
# 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$
#----------------------------------------------------------------------------
if [ $# -lt 1 ];
then
echo "input target dir name"
exit
fi
target=`echo $1 | sed -e 's/\/$//'`
target=$target"_forcsu"
echo $target
tmp=`echo $1 | sed -e 's/\/$//'`_tmp
mkdir $target
cd $target
mkdir jp
mkdir aus
mkdir usa
mkdir euro
cp -rf ../$1/jp .
cp -rf ../$1/aus .
cp -rf ../$1/usa .
cp -rf ../$1/euro .
mkdir verup
mkdir $tmp
find ../$1 -name "*.out" -exec cp {} $tmp \;
find $tmp -regex "[^/]*/...[jaJA].*v0\.tad\.out" | gawk -F/ '{printf("cp %s jp/%s\n",$0, $2)}' | sed -e 's/\.out$//g' > jp.sh
find $tmp -regex "[^/]*/...[uaUA].*v0\.tad\.out" | gawk -F/ '{printf("cp %s aus/%s\n",$0, $2)}' | sed -e 's/\.out$//g' > aus.sh
find $tmp -regex "[^/]*/...[paPA].*v0\.tad\.out" | gawk -F/ '{printf("cp %s euro/%s\n",$0, $2)}' | sed -e 's/\.out$//g' > euro.sh
find $tmp -regex "[^/]*/...[eaEA].*v0\.tad\.out" | gawk -F/ '{printf("cp %s usa/%s\n",$0, $2)}' | sed -e 's/\.out$//g' > usa.sh
find $tmp -regex "[^/]*/.*v[^0][0-9]*\.tad\.out" | gawk -F/ '{printf("cp %s verup/%s\n",$0, $2)}' | sed -e 's/\.out$//g' > verup.sh
./jp.sh
./aus.sh
./euro.sh
./usa.sh
./verup.sh
mv $tmp ../
rm -rf *.sh

View File

@ -1,110 +0,0 @@
package util;
#-----------------------------------------------------------------------
# name : get_title_version
# function : get the title version from the specified tad file
#-----------------------------------------------------------------------
sub get_title_version {
my $titleVersion = 0 ;
my $cmdPython = "/usr/bin/python.exe";
my $scrpPython = "/usr/local/bin/mkcls.py";
$tad = $_[0];
open(PY, "$cmdPython $scrpPython $tad | ") or die "$!";
$titleVersion = $1 if ( <PY> =~ /([0-9]{1,})/) ;
close(PY);
$titleVersion;
}
#-----------------------------------------------------------------------
# name : get_nlist
# function : get the list of the specified directory except "." and ".."
#-----------------------------------------------------------------------
sub get_nlist {
my $dirname = ( $#_ < 0) ? "." : $_[0];
my @list;
unless ( opendir(DIR, "$dirname") ) {
print "Can't open directory: $dirname\n";
return "";
}
foreach $node ( readdir(DIR) ) {
push(@list, $node) unless ( $node =~ /^\.{1,2}$/ );
}
closedir(DIR);
@list;
}
#-----------------------------------------------------------------------
# name : fecheck
# function : check the specified file existence (Error if no file)
#-----------------------------------------------------------------------
sub fecheck {
my $filename = $_[0];
unless ( -e $filename ) {
print <<ERROR_NO_FILE;
[ # Error] No such file : $filename
ERROR_NO_FILE
return 0;
}
1;
}
#-----------------------------------------------------------------------
# name : fwcheck
# function : check the specified file existence (Warning if no file)
#-----------------------------------------------------------------------
sub fwcheck {
my $filename = $_[0];
unless ( -e $filename ) {
print <<WARN_NO_FILE;
[ = Warn ] No such file : $filename
WARN_NO_FILE
return 0;
}
1;
}
sub get_filebody {
my ($filename_body) = @_;
$filename_body = $1 if ( $filename_body =~ /(.{1,})\.[^.]{1,}$/);
$filename_body;
}
sub get_fileext {
my ($filename_ext) = @_;
$filename_ext = $1 if ( $filename_ext =~ /.{1,}\.([^.]{1,})$/);
$filename_ext;
}
#-----------------------------------------------------------------------
# name : cnv_str2hex
# function : check the specified file existence (Warning if no file)
#-----------------------------------------------------------------------
sub cnv_str2hex {
my $instr = $_[0];
my $outstr = "" ;
my $i;
my $len = ($#_<1) ? 1 : $_[1];
#print (substr($instr, 0, 1));
#print (substr($instr, 1, 1));
for ( $i=0; $i<$len; $i++) {
$outstr .= chr ( (hex(substr($_[0], $i*2, 1))<<4)
| (hex(substr($_[0], $i*2+1, 1)) ) );
#print $outstr."\n";
}
return $outstr;
}
return 1;
__END__

Some files were not shown because too many files have changed in this diff Show More