KENJCleaner追加。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@521 7061adef-622a-194b-ae81-725974e89856
This commit is contained in:
N1363 2010-09-29 09:51:02 +00:00
parent e6545bfbd3
commit bc6cd94f64
12 changed files with 1973 additions and 0 deletions

View File

@ -0,0 +1,50 @@
#! make -f
#----------------------------------------------------------------------------
# Project: Hello World!
# File: Makefile
#
# Copyright 2003,2004 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.
#
# $NoKeywords: $
#----------------------------------------------------------------------------
TARGET_PLATFORM := TWL
TWL_ARCHGEN := LIMITED
SUBDIRS = banner
#----------------------------------------------------------------------------
SRCS = main.c myFunc.c myChar.c
ROM_SPEC = demo.rsf
TARGET_BIN = KENJCleaner.srl
include $(TWLSDK_ROOT)/build/buildtools/commondefs
MAKEROM_ARM7_BASE = $(TWL_COMPONENTSDIR)/armadillo/$(TWL_BUILDTYPE_ARM7)/armadillo
MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT)
MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe
GLIBRARIES += \
liblcfg$(TWL_LIBSUFFIX).a \
libes$(TWL_LIBSUFFIX).a \
libboc$(TWL_LIBSUFFIX).a \
libsfs$(TWL_LIBSUFFIX).a \
libnam$(TWL_LIBSUFFIX).a \
libsea$(TWL_LIBSUFFIX).a \
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,49 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlSDK - nandApp - demos - backup
# 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
include $(TWLSDK_ROOT)/build/buildtools/commondefs
MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe
ICON_DIR = ./
BANNER_ICON = $(ICON_DIR)/myGameIcon.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 $(TWLSDK_ROOT)/build/buildtools/modulerules
#----------------------------------------------------------------------------
# build
#----------------------------------------------------------------------------
do-build: $(TARGETS)
$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE)
$(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS)
#

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

View File

@ -0,0 +1,224 @@
#----------------------------------------------------------------------------
# Project: TwlSDK - include
# File: ROM-TS.rsf
#
# Copyright 2007-2009 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
#
#RemasterVersion 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 ./etc/rom_header.template.sbin
#
# BANNER FILE: generated from Banner Spec File
#
BannerFile "banner/banner.bnr"
###
### Setting for TWL
###
#
# ROM HEADER Ltd:
# don't have to edit
#
RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin
#
# Digest parameters:
#
DigestParam 1024 32
#
# WRAM mapping: [MAP2_TS_HYB/MAP2_TS_LTD]
# don't have to edit
#
################################################################
WramMapping MAP_TS_SCR
################################################################
#
# CardRegion: card region [Japan/America/Europe/Australia]
#
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
NANDAccess TRUE
# SDCardAccess Read
#
# HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE]
#
HwAESSlotB TRUE
DisableDebug TRUE
###
#### END
}
AppendProperty
{
#
# Publisher : "Nintendo"
# don't have to edit
Publisher Nintendo
#
# Application type : [USER/SYSTEM]
# don't have to edit
AppType System
#
# launch title on the launcher : [TRUE/FALSE]
# don't have to edit
Launch TRUE
#
# Boot allowed Media: [GameCard/NAND]
#
Media GameCard
#
# Data only title : [TRUE/FALSE]
# don't have to edit
DataOnly FALSE
#
# Secure title : [TRUE/FALSE]
# don't have to edit
Secure TRUE
#
# GameCode for TitleID : Your GameCode in 4 ascii words
#
GameCode NTRJ
#
# 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 FALSE
}
RomSpec
{
Offset 0x00000000
Segment ALL
HostRoot $(MAKEROM_ROMROOT)
Root /
File $(MAKEROM_ROMFILES)
}

View File

@ -0,0 +1,71 @@
KENJCleaner チェックリスト
2009.10.28
KENJCleanerソフト仕様
・DSiWare「ほぼ日健康手帳」InitialCode:KENJのセーブデータを乱数フィルした後に、
 ソフト本体を消去する。
・日本リージョンのみ対象でOK。
・検査カードフラグ有効で、ランチャースキップ自動アプリ起動。
・ユーザー操作は一切受け付けない。
・起動したら、自動実行して、以下の結果を表示。
 KENJが見つかった場合
[動作]
   KENJのセーブデータクリア
   KENJのアプリ消去
 [結果表示]
   OK上画面は緑一色。
下画面に下記メッセージ表示。
 application found.
 Private Save : cleanup succeedded
 Public Save : cleanup succeedded
 Application : cleanup succeedded
   NG上画面は赤一色。
下画面に下記メッセージ表示。
 application found.
 Private Save : cleanup failed.(※いずれか失敗したもののみ)
 Public Save : cleanup failed.(同上)
 Application : cleanup failed.(同上)
 KENJが見つからなかった場合
[動作]
   何もしない
 [結果表示]
   上画面は黄色一色。
下画面に下記メッセージ表示。
application not found.
<チェック環境>
 開発実機ショップサーバDEV4で確認。
<チェックリスト>
1.前準備
 →開発実機を製品本体と同じ内蔵アプリ状態にする。
 →KENJ以外のいくつかのユーザーアプリをDL。
 →内蔵アプリ含めて、セーブデータがあるものは、セーブデータを作成しておく。
KENJが入っていない状態の確認。
 →TwlNMenuFullで、アプリ状態の確認。何がインポートされているか。
 →KENJClearnerを起動して、アプリが見つからなかったことを確認。
 →TwlNMenuFullで、アプリ状態に変化がないか確認。何がインポートされているか。
 →各アプリのセーブデータに変化がないか確認。
KENJが入った状態の確認。
 →ショップからKENJをDL。
 →KENJを起動して、セーブデータを作成。
 →TwlNMenuFullで、アプリ状態の確認。何がインポートされているか。
 →KENJCleanerを起動して、セーブデータアプリが消去されることを確認。
 →ランチャー上からKENJが消去されていることを確認。
 →TwlNMenuFullで、KENJに対してeTicketのみが残されていることを確認。
 →TwlNMenuFullで、アプリ状態に変化がないか確認。何がインポートされているか。
 →各アプリのセーブデータに変化がないか確認。
KENJの再DLの確認。
 →ショップからKENJを再DLできることを確認。
 →KENJを起動して、セーブデータが初期化されていることを確認。
 →セーブが行えることを確認。

View File

@ -0,0 +1,34 @@
KENJCleaner チェックリスト
2009.10.28
KENJCleanerソフト仕様
・DSiWare「ほぼ日健康手帳」InitialCode:KENJのセーブデータを乱数フィルした後に、
 ソフト本体を消去する。
・日本リージョンのみ対象でOK。
・検査カードフラグ有効で、ランチャースキップ自動アプリ起動。
・ユーザー操作は一切受け付けない。
・起動したら、自動実行して、以下の結果を表示。
 KENJが見つかった場合
[動作]
   KENJのセーブデータクリア
   KENJのアプリ消去
 [結果表示]
   OK上画面は緑一色。
下画面に下記メッセージ表示。
 application found.
 Private Save : cleanup succeedded
 Public Save : cleanup succeedded
 Application : cleanup succeedded
   NG上画面は赤一色。
下画面に下記メッセージ表示。
 application found.
 Private Save : cleanup failed.(※いずれか失敗したもののみ)
 Public Save : cleanup failed.(同上)
 Application : cleanup failed.(同上)
 KENJが見つからなかった場合
[動作]
   何もしない
 [結果表示]
   上画面は黄色一色。
下画面に下記メッセージ表示。
application not found.

View File

@ -0,0 +1,606 @@
/********************************************************************/
/* main.c */
/* SaveDataCleaner */
/* */
/* Copyright (C) 2003-2006 NINTENDO Co.,Ltd. */
/********************************************************************/
/*
*/
#include <twl.h>
#include <twl/aes.h>
#include <twl/na.h>
#include <twl/na/ARM9/init.h>
#include <twl/sea.h>
#include <twl/nam.h>
#include "myChar.h"
#include "myFunc.h"
// define data-----------------------------------------------------------------
#define MY_DEBUG 0
#define ROUND_UP(value, alignment) \
(((u32)(value) + (alignment-1)) & ~(alignment-1))
#define STREAMING_BUFFER_SIZE (128 * 1024)
#define TITLEID_HI_USER_NAND 0x0003000400000000LL
#define TARGET_INITIALCODE_SPEC_FILE "SaveDataCleaner.spec"
// extern data-----------------------------------------------------------------
// function's prototype--------------------------------------------------------
static void INTR_VBlank( void );
static void InitHeap( void );
BOOL SearchTitle( OSTitleId titleID, BOOL *pIsPrivSave, BOOL *pIsPubSave );
BOOL CleanupSaveDataDrive( const char *pDriveName , OSTitleId titleID );
BOOL CreateFileWithLength( char *path, u32 length );
BOOL DeleteDirectoryRecursively( const char *path );
BOOL FillFileRandom( const char* path );
BOOL DumpFile( const char* pPath );
BOOL ReadTargetFileFromSD( const char *pFilename, char **ppDst, u32 *pFileSize );
// global variables------------------------------------------------------------
u8 targetGameCode[ 5 ] = { 'K', 'E', 'N', 'J', 0x00 };
// static variables------------------------------------------------------------
static u8 sStreamBuffer[ STREAMING_BUFFER_SIZE ] ATTRIBUTE_ALIGN(32);
static FSFATFSArchiveWork sOtherTitleWork ATTRIBUTE_ALIGN(32);
// const data------------------------------------------------------------------
// ============================================================================
// function's description
// ============================================================================
void TwlMain(void)
{
BOOL isFound = FALSE;
BOOL isPrivSave = FALSE;
BOOL isPubSave = FALSE;
BOOL isFailed = FALSE;
BOOL isAutoExe = TRUE;
u16 pad_old = 0;
u16 pad = 0;
u16 trg = 0;
OSTitleId titleID;
(void)OS_EnableIrq();
(void)OS_EnableInterrupts();
OS_Init();
SEA_Init();
FS_Init( 3 );
// AES_Init();
InitHeap();
InitDispMain();
InitDispSub ();
NAM_Init( OS_AllocFromMain, OS_FreeToMain );
// Vブランク割り込み許可----------------------------
(void)OS_SetIrqFunction( OS_IE_V_BLANK, INTR_VBlank );
(void)OS_EnableIrqMask ( OS_IE_V_BLANK );
(void)GX_VBlankIntr( TRUE );
//---- 表示開始
GX_DispOn();
GXS_DispOn();
PrintStringS( 1, 0, YELLOW, "SaveData Clearner" );
// SDカード上のSPECファイルから、ターゲットのGameCodeを読み込み
#if USE_SDCARD
{
u32 size;
char *pSrc = TARGET_INITIALCODE_SPEC_FILE;
char *pSDFileBuffer;
if( !ReadTargetFileFromSD( pSrc, &pSDFileBuffer, &size ) ) {
PrintStringS( 1, 6, RED, "SD card specfile read failed." );
PrintStringS( 1, 8, WHITE, "Please set" );
PrintStringS( 1, 10, WHITE, " \"%s\"", TARGET_INITIALCODE_SPEC_FILE );
SVC_WaitVBlankIntr();
OS_Terminate();
}
if( !STD_TSScanf( pSDFileBuffer, "%4s", targetGameCode ) ||
STD_StrLen( (const char *)targetGameCode ) != 4 ) {
PrintStringS( 1, 6, RED, "SD card specfile format failed." );
PrintStringS( 1, 8, WHITE, "Please set InitialCode." );
SVC_WaitVBlankIntr();
OS_Terminate();
}
OS_TPrintf( "%s\n", targetGameCode );
OS_Free( pSDFileBuffer );
}
#endif
// targetGameCode から titleID を作成
{
int i;
u8 *pDst = (u8 *)&titleID;
titleID = TITLEID_HI_USER_NAND;
for( i = 0; i < 4; i++ ) {
*pDst++ = targetGameCode[ 3 -i ];
}
}
// セーブデータサーチ
isFound = SearchTitle( titleID, &isPrivSave, &isPubSave );
PrintStringS( 1, 6, WHITE, "InitialCode : %s", targetGameCode );
if( isFound ) {
PrintStringS( 1, 8, GREEN, "application found.", targetGameCode );
PrintStringS( 1, 10, WHITE, "Press [A] to Cleanup START." );
PrintStringS( 1, 11, WHITE, "Press [B] to STOP." );
}else {
PrintStringS( 1, 8, YELLOW, "application not found.", targetGameCode );
*(u16 *)0x05000006 = myPalette[ YELLOW ][ 1 ];
}
SVC_WaitVBlankIntr();
// メインループ----------------------------
trg = PAD_Read(); // パッドデータ読み取り
while( isFound ){
// パッドデータ読み取り
pad_old = pad;
pad = PAD_Read();
trg = (u16)( pad ^ pad_old );
if( ( trg & ( PAD_BUTTON_A | PAD_BUTTON_B ) ) || isAutoExe ) {
ClearRectangleS( 1, 10, 31, 1 );
ClearRectangleS( 1, 11, 31, 1 );
}
if( ( trg & PAD_BUTTON_A ) || isAutoExe ) {
// セーブデータクリア実行
// Privateセーブデータ
PrintStringS( 1, 10, WHITE, "Private Save:" );
if( isPrivSave ) {
PrintStringS( 14, 10, YELLOW, "cleanup executing..." );
if( CleanupSaveDataDrive( "otherPrv", titleID ) ) {
PrintStringS( 14, 10, GREEN, "cleanup succeedded. " );
}else {
PrintStringS( 14, 10, RED, "cleanup failed. " );
isFailed = TRUE;
}
}else {
PrintStringS( 14, 10, YELLOW, "not existed." );
}
// Publicセーブデータ
PrintStringS( 1, 11, WHITE, "Public Save:" );
if( isPubSave ) {
PrintStringS( 14, 11, YELLOW, "cleanup executing." );
if( CleanupSaveDataDrive( "otherPub", titleID ) ) {
PrintStringS( 14, 11, GREEN, "cleanup succeedded. " );
}else {
PrintStringS( 14, 11, RED, "cleanup failed. " );
isFailed = TRUE;
}
}else {
PrintStringS( 14, 11, YELLOW, "not existed." );
}
PrintStringS( 1, 12, WHITE, "Application :" );
PrintStringS( 14, 12, YELLOW, "cleanup executing." );
if( NAM_DeleteTitle( titleID ) == NAM_OK ) {
PrintStringS( 14, 12, GREEN, "cleanup succeedded. " );
}else {
PrintStringS( 14, 12, RED, "cleanup failed. " );
isFailed = TRUE;
}
if( isFailed ) {
*(u16 *)0x05000006 = myPalette[ RED ][ 1 ];
}else {
*(u16 *)0x05000006 = myPalette[ LIGHTGREEN ][ 1 ];
}
break;
}else if( trg & PAD_BUTTON_B ) {
// セーブデータクリアキャンセル。
PrintStringS( 1, 10, YELLOW, "Cancel SaveData cleanup." );
break;
}
SVC_WaitVBlankIntr(); // Vブランク割込終了待ち
}
SVC_WaitVBlankIntr();
OS_Terminate();
}
// Vブランク割り込み
static void INTR_VBlank(void)
{
//---- BG-VRAMの更新
DC_FlushRange( bg0BakM, sizeof(bg0BakM) );
MI_CpuCopyFast ( bg0BakM, (void*)( HW_BG_VRAM + BG0_SCREEN_BASE ), sizeof(bg0BakM) );
DC_FlushRange( bg0BakS, sizeof(bg0BakS) );
MI_CpuCopyFast ( bg0BakS, (void*)( HW_DB_BG_VRAM + BG0_SCREEN_BASE ), sizeof(bg0BakS) );
//---- 割り込みチェックフラグ
OS_SetIrqCheckFlag( OS_IE_V_BLANK );
}
// ヒープ初期化
static void InitHeap( void )
{
void* tempLo;
OSHeapHandle hh;
// メインメモリ上のアリーナにヒープをひとつ作成
tempLo = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1);
OS_SetArenaLo(OS_ARENA_MAIN, tempLo);
hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi());
if (hh < 0) {
// ヒープ作成に失敗した場合は異常終了
OS_Panic("ARM9: Fail to create heap...\n");
}
(void)OS_SetCurrentHeap(OS_ARENA_MAIN, hh);
}
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
// 指定タイトルが存在するか確認し、存在するなら、sameMakerFlag を強制セットし、Privateセーブデータ、Publicセーブデータの存在有無を返す。
BOOL SearchTitle( OSTitleId titleID, BOOL *pIsPrivSave, BOOL *pIsPubSave )
{
int i;
int index, shift;
OSTitleIDList *pList = (OSTitleIDList *)HW_OS_TITLE_ID_LIST;
for ( i = 0; i < pList->num; i++ ) {
if( pList->TitleID[ i ] == titleID ) {
break;
}
}
if( i == pList->num ) {
*pIsPrivSave = FALSE;
*pIsPubSave = FALSE;
return FALSE;
}
index = i >> 3;
shift = i % 8;
pList->sameMakerFlag[ index ] |= 0x01 << shift;
// pList->privateFlag[ index ] |= 0x01 << shift; // ユーザーアプリなら、privateFlagも問題ないはず。
*pIsPrivSave = ( pList->privateFlag[ index ] & ( 0x01 << shift ) ) ? TRUE : FALSE;
*pIsPubSave = ( pList->publicFlag [ index ] & ( 0x01 << shift ) ) ? TRUE : FALSE;
return TRUE;
}
// 指定されたセーブデータドライブのセーブデータ消去
BOOL CleanupSaveDataDrive( const char *pDriveName , OSTitleId titleID ) // otherPrv, otherPub
{
#define TEMP_FILE "temp.bin"
BOOL result = TRUE;
FSArchiveResource rsc, rsc2;
char path[ FS_ENTRY_LONGNAME_MAX ];
if( pDriveName == NULL ) {
OS_TPrintf( "drive name invalid.\n" );
return FALSE;
}
// Privateセーブデータをマウント
if( FSi_MountSpecialArchive( titleID, pDriveName, &sOtherTitleWork) != FS_RESULT_SUCCESS ) {
return FALSE;
}
// Privateセーブデータドライブ上の全データ削除
STD_TSPrintf( path, "%s:/", pDriveName );
if( !DeleteDirectoryRecursively( path ) ) {
OS_TPrintf( "%s delete recursively failed.\n", path );
result = FALSE;
goto END;
}
// ドライブの空き領域を取得
if( !FS_GetArchiveResource( path, &rsc ) ) {
OS_TPrintf( "FS_GetArchiveResource(%s) failed : code = %08x\n", path, FS_GetArchiveResultCode( &rsc ) );
result = FALSE;
goto END;
}
// 空き領域が32bitを超えていた場合はエラー
if( rsc.availableSize > 0x0000000100000000LL ) {
OS_TPrintf( "%s : availableSize over 32bit.\n", pDriveName );
result = FALSE;
goto END;
}
STD_TSPrintf( path, "%s:/%s", pDriveName, TEMP_FILE );
#if MY_DEBUG
(void)CreateFileWithLength( path, (u32)rsc.availableSize );
(void)DumpFile( path );
(void)FS_DeleteFile( path );
#endif
// ドライブの空きサイズMAXで、TEMPファイル生成
if( !CreateFileWithLength( path, (u32)rsc.availableSize ) ) {
OS_TPrintf( "CreateFileWithLength(%s, %08x) failed.\n", path, (u32)rsc.availableSize );
result = FALSE;
goto END;
}
// ファイルランダムフィル
if( !FillFileRandom( path ) ) {
OS_TPrintf( "FillFileRandom(%s) failed.\n", path );
result = FALSE;
}
// ファイル削除
if( !FS_DeleteFile( path ) ) {
OS_TPrintf( "FS_DeleteFile(%s) failed.\n", path );
result = FALSE;
}
// 再度ドライブの空き領域を取得
if( !FS_GetArchiveResource( path, &rsc2 ) ) {
OS_TPrintf( "FS_GetArchiveResource(%s) failed : code = %08x\n", path, FS_GetArchiveResultCode( &rsc2 ) );
result = FALSE;
}
#if MY_DEBUG
(void)CreateFileWithLength( path, (u32)rsc.availableSize );
(void)DumpFile( path );
(void)FS_DeleteFile( path );
#endif
// 空きサイズが同じかチェック
OS_TPrintf( "Before available size : %016llx\n", rsc.availableSize );
OS_TPrintf( "After available size : %016llx\n", rsc2.availableSize );
if( rsc.availableSize != rsc2.availableSize ) {
OS_TPrintf( "available size error.\n" );
result = FALSE;
}
END:
// セーブデータのマウント解除
(void)FSi_MountSpecialArchive(0, NULL, &sOtherTitleWork);
return result;
}
// 指定パス以下のディレクトリを消去
BOOL DeleteDirectoryRecursively( const char *pPath )
{
FSFile dir;
FSDirectoryEntryInfo entryInfo;
BOOL ret = TRUE;
char path[ FS_ENTRY_LONGNAME_MAX ];
FS_InitFile( &dir );
// 引数で指定されたディレクトリを開く
if ( !FS_OpenDirectory( &dir, pPath, FS_FILEMODE_R ) ) {
OS_TWarning( "Fail! FS_OpenDirectory(%s) in %s\n", pPath, __func__ );
return FALSE;
}
// ディレクトリの中身を読む
while ( FS_ReadDirectory( &dir, &entryInfo ) )
{
if ( STD_CompareString( entryInfo.longname, "." ) == 0 ||
STD_CompareString( entryInfo.longname, ".." ) == 0 ) {
continue;
}
STD_CopyLString( path, pPath, FS_ENTRY_LONGNAME_MAX );
STD_ConcatenateLString( path, "/", FS_ENTRY_LONGNAME_MAX );
STD_ConcatenateLString( path, entryInfo.longname, FS_ENTRY_LONGNAME_MAX );
// ディレクトリ
if (entryInfo.attributes & FS_ATTRIBUTE_IS_DIRECTORY) {
if (!FS_DeleteDirectoryAuto(path)) {
ret = FALSE;
OS_TWarning( "Fail! FS_DeleteDirectoryAuto(%s) in %s\n", path, __func__ );
}
}else {
// ファイル
if ( !FS_DeleteFileAuto( path ) ) {
ret = FALSE;
OS_TWarning( "Fail! FS_DeleteFileAuto(%s) in %s\n", path, __func__ );
}
}
}
// ディレクトリを閉じる
FS_CloseDirectory( &dir );
return ret;
}
// 指定ファイルを指定サイズで作成
BOOL CreateFileWithLength( char *path, u32 length )
{
FSFile file;
BOOL result = TRUE;
// Privateセーブデータドライブ上にTEMPファイル作成
if ( !FS_CreateFile( path, FS_PERMIT_R | FS_PERMIT_RW ) )
{
OS_TPrintf( "FS_CreateFile(%s) failed.\n", path );
return FALSE;
}
// TEMPファイルオープン
FS_InitFile(&file);
if ( !FS_OpenFileEx( &file, path, FS_FILEMODE_W ) )
{
OS_TPrintf( "FS_OpenFile(%s) failed.\n", path );
result = FALSE;
goto END;
}
// ファイルサイズをセット
if ( FS_SetFileLength( &file, length ) != FS_RESULT_SUCCESS )
{
OS_TPrintf( "FS_SetFileLength(%s) failed.\n", path );
result = FALSE;
}
END:
// ファイルクローズ
(void)FS_CloseFile( &file );
return result;
}
// 指定ファイルをランダムデータでフィル
BOOL FillFileRandom( const char* pPath )
{
u64 seed;
MATHRandContext32 rndctx;
u32 *pBuffer = (u32 *)sStreamBuffer;
s32 result = TRUE;
FSFile f;
// 乱数のSEED設定
if( AES_Rand( &seed, sizeof(seed) ) != AES_RESULT_SUCCESS ) {
return FALSE;
}
MATH_InitRand32( &rndctx, seed );
// ファイルフィル
FS_InitFile( &f );
if( !FS_OpenFileEx( &f, pPath, FS_FILEMODE_RWL ) ) {
return FALSE;
}else {
u32 fileSize;
u32 current;
fileSize = FS_GetFileLength(&f);
for( current = 0; current < fileSize; current += STREAMING_BUFFER_SIZE ) {
const u32 nextSize = MATH_MIN( STREAMING_BUFFER_SIZE, fileSize - current);
const u32 nextU32 = MATH_DIVUP( nextSize, sizeof(u32) );
u32 i;
s32 writtenSize;
u32* p = pBuffer;
for( i = 0; i < nextU32; ++i ) {
*p++ = MATH_Rand32( &rndctx, 0 );
}
writtenSize = FS_WriteFile( &f, pBuffer, (s32)nextSize );
if( writtenSize != (s32)nextSize ) {
result = FALSE;
break;
}
}
(void)FS_CloseFile( &f );
}
return result;
}
// 指定ファイルをストリームバッファに読み捨て
BOOL DumpFile( const char* pPath )
{
u32 *pBuffer = (u32 *)sStreamBuffer;
s32 result = TRUE;
FSFile f;
// ファイルフィル
FS_InitFile( &f );
if( !FS_OpenFileEx( &f, pPath, FS_FILEMODE_R ) ) {
return FALSE;
}else {
u32 fileSize;
u32 current;
fileSize = FS_GetFileLength(&f);
for( current = 0; current < fileSize; current += STREAMING_BUFFER_SIZE ) {
const u32 nextSize = MATH_MIN( STREAMING_BUFFER_SIZE, fileSize - current);
const u32 nextU32 = MATH_DIVUP( nextSize, sizeof(u32) );
s32 readSize;
readSize = FS_ReadFile( &f, pBuffer, (s32)nextSize );
if( readSize != (s32)nextSize ) {
result = FALSE;
break;
}
}
(void)FS_CloseFile( &f );
}
return result;
}
// SDカードのルートディレクトリ上の指定ファイルをバッファに読み込み
BOOL ReadTargetFileFromSD( const char *pFilename, char **ppDst, u32 *pFileSize )
{
FSFile dir, file;
BOOL open_is_ok;
BOOL read_is_ok;
u32 allocSize;
BOOL result = TRUE;
char fullPath[FS_ENTRY_LONGNAME_MAX+6];
// バッファのクリア
MI_CpuClear8( fullPath, sizeof(fullPath) );
// SDカードのルートディレクトリを検索
FS_InitFile(&dir);
if ( !FS_OpenDirectory(&dir, "sdmc:/", FS_FILEMODE_R) )
{
OS_TPrintf("Error FS_OpenDirectory(sdmc:/)");
}
else
{
FSDirectoryEntryInfo info[1];
// ルートディレクトリ上でターゲットファイルを探す
while (FS_ReadDirectory(&dir, info))
{
if ((info->attributes & (FS_ATTRIBUTE_DOS_DIRECTORY | FS_ATTRIBUTE_IS_DIRECTORY)) == 0 )
{
if (!STD_CompareNString(info->longname, pFilename, STD_GetStringLength( pFilename ) ) )
{
STD_CopyString( fullPath, "sdmc:/" );
STD_ConcatenateString( fullPath, pFilename );
break;
}
}
}
(void)FS_CloseDirectory(&dir);
}
// ファイルオープン
FS_InitFile(&file);
open_is_ok = FS_OpenFile(&file, fullPath);
if (!open_is_ok)
{
OS_TPrintf( "FS_OpenFile(\"%s\") ... ERROR!\n", fullPath);
return FALSE;
}
// ファイルリード
*pFileSize = FS_GetFileLength(&file) ;
allocSize = ROUND_UP(*pFileSize, 32) ;
*ppDst = OS_Alloc( allocSize );
SDK_NULL_ASSERT(*ppDst);
DC_InvalidateRange(*ppDst, allocSize);
read_is_ok = FS_ReadFile( &file, *ppDst, (s32)*pFileSize );
FS_CloseFile(&file);
if (!read_is_ok)
{
OS_TPrintf( "FS_ReadFile(\"%s\") ... ERROR!\n", fullPath);
OS_Free(*ppDst);
return FALSE;
}
return TRUE;
}

View File

@ -0,0 +1,678 @@
/********************************************************************/
/* myChar.c */
/* HelloWorld */
/* */
/* Copyright (C) 2003-2006 NINTENDO Co.,Ltd. */
/********************************************************************/
/*
*/
#include "myFunc.h"
// パレットデータ----------------------------------------------------
#define RGB555( r, g, b ) ( b << 10 | g << 5 | r )
// 背景黒ベース
const u16 myPalette[ 13 ][ 16 ] = {
{RGB555( 0, 0, 0), RGB555(31, 31, 31), RGB555(15, 15, 15), RGB555( 0, 0, 0),}, // White
{RGB555( 0, 0, 0), RGB555(31, 0, 0), RGB555( 0, 0, 0), RGB555( 0, 0, 0),}, // Red
{RGB555( 0, 0, 0), RGB555( 0, 19, 0), RGB555( 0, 0, 0), RGB555( 0, 0, 0),}, // Green
{RGB555( 0, 0, 0), RGB555( 0, 11, 31), RGB555( 0, 0, 0), RGB555( 0, 0, 0),}, // Blue
{RGB555( 0, 0, 0), RGB555(31, 31, 0), RGB555( 0, 0, 0), RGB555( 0, 0, 0),}, // Yellow
{RGB555( 0, 0, 0), RGB555( 0, 31, 31), RGB555( 0, 0, 0), RGB555( 0, 0, 0),}, // Cyan
{RGB555( 0, 0, 0), RGB555(31, 0, 31), RGB555( 0, 0, 0), RGB555( 0, 0, 0),}, // Purple
{RGB555( 0, 0, 0), RGB555( 0, 31, 0), RGB555( 0, 0, 0), RGB555( 0, 0, 0),}, // Light Green
{RGB555( 0, 0, 0), RGB555( 0, 0, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // HighLight Yellow
{RGB555( 0, 0, 0), RGB555( 0, 0, 0), RGB555( 0, 31, 31), RGB555( 0, 31, 31),}, // HighLight CYAN
{RGB555( 0, 0, 0), RGB555( 0, 0, 0), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // HighLight WHITE
{RGB555( 0, 0, 0), RGB555( 0, 0, 0), RGB555( 0, 11, 31), RGB555( 0, 11, 31),}, // HighLight BLUE
{RGB555( 0, 0, 0), RGB555( 0, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // HighLight RED
};
// キャラクタデータ--------------------------------------------------
// ※ASCIIコード順に並んでいます。
const u16 myChar[ 0x20 * 0x140 / sizeof(u16) ]={
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //0
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //2
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //3
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //4
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //5
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //6
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //7
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //8
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //a
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //b
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //c
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //d
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //e
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //f
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //10
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //11
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //12
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //13
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //14
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //15
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //16
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //17
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //18
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //19
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1a
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1b
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1c
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1d
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1e
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1f
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //20
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x1333,0x3321,0x1333,0x3321,0x1333,0x3321, //21
0x1333,0x3321,0x2333,0x3332,0x1333,0x3321,0x2333,0x3332,
0x2113,0x3211,0x2113,0x3211,0x2123,0x3212,0x3213,0x3321, //22
0x3323,0x3332,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x2133,0x3321,0x1113,0x3211,0x2123,0x3321, //23
0x2133,0x3321,0x1113,0x3211,0x2123,0x3321,0x3233,0x3332,
0x3333,0x3333,0x1333,0x3332,0x1133,0x3211,0x1213,0x3322, //24
0x1123,0x3311,0x1233,0x2112,0x1113,0x3211,0x1223,0x3322,
0x3333,0x3333,0x2133,0x2133,0x1213,0x3212,0x2123,0x3321, //25
0x1233,0x3212,0x2133,0x2121,0x3213,0x3212,0x3323,0x3323,
0x3333,0x3333,0x1133,0x3331,0x2113,0x3212,0x1123,0x3321, //26
0x2113,0x2111,0x3213,0x3213,0x1123,0x2121,0x2233,0x3232,
0x1133,0x3332,0x1133,0x3332,0x1233,0x3332,0x2133,0x3333, //27
0x3233,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3213,0x3333,0x3321,0x1333,0x3332, //28
0x1333,0x3332,0x1333,0x3332,0x2333,0x3331,0x3333,0x3312,
0x3333,0x3333,0x3133,0x3333,0x1233,0x3333,0x2333,0x3321, //29
0x3333,0x3321,0x3333,0x3321,0x1333,0x3332,0x2133,0x3333,
0x3333,0x3333,0x1333,0x3332,0x1213,0x3212,0x1133,0x3321, //2a
0x1233,0x3332,0x1133,0x3321,0x1213,0x3212,0x1323,0x3222,
0x3333,0x3333,0x3333,0x3333,0x1333,0x3332,0x1333,0x3332, //2b
0x1113,0x3211,0x1223,0x3222,0x1333,0x3332,0x2333,0x3332,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //2c
0x1133,0x3332,0x1133,0x3332,0x1233,0x3332,0x2133,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //2d
0x1113,0x3211,0x2223,0x3222,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //2e
0x3333,0x3333,0x3333,0x3333,0x2133,0x3333,0x2233,0x3333,
0x3333,0x3333,0x3333,0x2133,0x3333,0x3213,0x3333,0x3321, //2f
0x1333,0x3332,0x2133,0x3333,0x3213,0x3333,0x3323,0x3333,
0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2113, //30
0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322,
0x3333,0x3333,0x1333,0x3321,0x1133,0x3321,0x1233,0x3321, //31
0x1333,0x3321,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322,
0x3333,0x3333,0x1113,0x3211,0x2223,0x2112,0x1133,0x3211, //32
0x2113,0x3322,0x2113,0x3333,0x1113,0x2111,0x2223,0x3222,
0x3333,0x3333,0x1113,0x3211,0x2223,0x2112,0x1133,0x3211, //33
0x2233,0x2112,0x3333,0x2113,0x1113,0x3211,0x2223,0x3322,
0x3333,0x3333,0x3333,0x3211,0x1333,0x3211,0x2133,0x3211, //34
0x3213,0x3211,0x1113,0x2111,0x2223,0x3211,0x3333,0x3322,
0x3333,0x3333,0x1113,0x3211,0x2213,0x3322,0x1113,0x3211, //35
0x2223,0x2112,0x3333,0x2113,0x1113,0x3211,0x2223,0x3322,
0x3333,0x3333,0x1133,0x3211,0x2113,0x3322,0x1113,0x3211, //36
0x2113,0x2112,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322,
0x3333,0x3333,0x1113,0x2111,0x2223,0x2122,0x3333,0x3213, //37
0x3333,0x3321,0x1333,0x3321,0x1333,0x3321,0x2333,0x3332,
0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x1123,0x3211, //38
0x2113,0x2112,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322,
0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2113, //39
0x1123,0x2111,0x2233,0x2112,0x1133,0x3211,0x2233,0x3322,
0x3333,0x3333,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, //3a
0x3333,0x3333,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322,
0x3333,0x3333,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, //3b
0x3333,0x3333,0x1333,0x3321,0x1333,0x3321,0x2333,0x3321,
0x3333,0x3333,0x3333,0x3321,0x1333,0x3332,0x2133,0x3333, //3c
0x2133,0x3333,0x1233,0x3333,0x2333,0x3321,0x3333,0x3322,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1133,0x3211, //3d
0x2233,0x3222,0x1133,0x3211,0x2233,0x3222,0x3333,0x3333,
0x3333,0x3333,0x1333,0x3333,0x2333,0x3331,0x3333,0x3212, //3e
0x3333,0x3213,0x3333,0x3321,0x1333,0x3332,0x2333,0x3333,
0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2113, //3f
0x3223,0x3211,0x1333,0x3321,0x2333,0x3332,0x1333,0x3321,
0x3333,0x3333,0x1133,0x3321,0x2213,0x3212,0x1213,0x2121, //40
0x2113,0x2121,0x2113,0x2121,0x1213,0x3211,0x1123,0x2121,
0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2113, //41
0x1113,0x2111,0x2113,0x2112,0x2113,0x2113,0x2223,0x2223,
0x3333,0x3333,0x1113,0x3211,0x2113,0x2112,0x1113,0x3211, //42
0x2113,0x2112,0x2113,0x2113,0x1113,0x3211,0x2223,0x3322,
0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2223, //43
0x2113,0x3333,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322,
0x3333,0x3333,0x1113,0x3211,0x2113,0x2112,0x2113,0x2113, //44
0x2113,0x2113,0x2113,0x2113,0x1113,0x3211,0x2223,0x3322,
0x3333,0x3333,0x1113,0x2111,0x2113,0x2222,0x1113,0x3211, //45
0x2113,0x3222,0x2113,0x3333,0x1113,0x2111,0x2223,0x2222,
0x3333,0x3333,0x1113,0x2111,0x2113,0x2222,0x1113,0x3211, //46
0x2113,0x3222,0x2113,0x3333,0x2113,0x3333,0x2223,0x3333,
0x3333,0x3333,0x1133,0x3211,0x2113,0x3322,0x2113,0x2111, //47
0x2113,0x2112,0x2113,0x2113,0x1123,0x2111,0x2233,0x3222,
0x3333,0x3333,0x2113,0x2113,0x2113,0x2113,0x1113,0x2111, //48
0x2113,0x2112,0x2113,0x2113,0x2113,0x2113,0x2223,0x2223,
0x3333,0x3333,0x1333,0x3321,0x1333,0x3321,0x1333,0x3321, //49
0x1333,0x3321,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322,
0x3333,0x3333,0x3333,0x2113,0x3333,0x2113,0x3333,0x2113, //4a
0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322,
0x3333,0x3333,0x2113,0x2113,0x2113,0x3211,0x1113,0x3322, //4b
0x1113,0x3331,0x2113,0x3311,0x2113,0x2112,0x2223,0x2223,
0x3333,0x3333,0x2113,0x3333,0x2113,0x3333,0x2113,0x3333, //4c
0x2113,0x3333,0x2113,0x3333,0x1113,0x2111,0x2223,0x2222,
0x3333,0x3333,0x2133,0x2133,0x1113,0x1112,0x1113,0x1112, //4d
0x1113,0x1111,0x2113,0x1121,0x2113,0x1121,0x3223,0x2232,
0x3333,0x3333,0x2113,0x2113,0x1113,0x2112,0x1113,0x2112, //4e
0x2113,0x2111,0x2113,0x2111,0x2113,0x2112,0x2223,0x2223,
0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2113, //4f
0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322,
0x3333,0x3333,0x1113,0x3211,0x2113,0x2112,0x1113,0x3211, //50
0x2113,0x3322,0x2113,0x3333,0x2113,0x3333,0x2223,0x3333,
0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2113, //51
0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x2111,
0x3333,0x3333,0x1113,0x3211,0x2113,0x2112,0x1113,0x3211, //52
0x2113,0x2112,0x2113,0x2113,0x2113,0x2113,0x2223,0x2223,
0x3333,0x3333,0x1133,0x2111,0x2113,0x3222,0x1123,0x3331, //53
0x1233,0x3311,0x2333,0x2112,0x1113,0x3211,0x2223,0x3322,
0x3333,0x3333,0x1113,0x2111,0x1223,0x3221,0x1333,0x3321, //54
0x1333,0x3321,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322,
0x3333,0x3333,0x2113,0x2113,0x2113,0x2113,0x2113,0x2113, //55
0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322,
0x3333,0x3333,0x2113,0x2113,0x2113,0x2113,0x2113,0x2113, //56
0x2113,0x2113,0x2123,0x3213,0x1233,0x3321,0x2333,0x3332,
0x3333,0x3333,0x2113,0x1121,0x2113,0x1121,0x2113,0x1121, //57
0x1113,0x1111,0x1123,0x2112,0x2133,0x2133,0x3233,0x3233,
0x3333,0x3333,0x2113,0x2113,0x2113,0x2113,0x1123,0x3211, //58
0x1233,0x3211,0x2113,0x2112,0x2113,0x2113,0x3223,0x3223,
0x3333,0x3333,0x2113,0x2113,0x2113,0x2113,0x2133,0x3213, //59
0x1133,0x3211,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322,
0x3333,0x3333,0x1113,0x2111,0x2223,0x2112,0x1333,0x3221, //5a
0x1133,0x3332,0x2113,0x3333,0x1113,0x2111,0x2223,0x2222,
0x3333,0x3333,0x1333,0x3321,0x1333,0x3322,0x1333,0x3332, //5b
0x1333,0x3332,0x1333,0x3332,0x1333,0x3321,0x2333,0x3322,
0x3333,0x3333,0x3313,0x3333,0x3123,0x3333,0x1233,0x3333, //5c
0x2333,0x3331,0x3333,0x3312,0x3333,0x3123,0x3333,0x3233,
0x3333,0x3333,0x1333,0x3321,0x2333,0x3321,0x3333,0x3321, //5d
0x3333,0x3321,0x3333,0x3321,0x1333,0x3321,0x2333,0x3322,
0x3333,0x3333,0x1333,0x3332,0x2133,0x3321,0x3233,0x3322, //5e
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //5f
0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2223,0x2222,
0x1333,0x3321,0x1333,0x3321,0x1333,0x3332,0x2333,0x3321, //60
0x3333,0x3332,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2213,0x2112, //61
0x1123,0x2111,0x2113,0x2112,0x1123,0x2111,0x2233,0x2222,
0x2113,0x3333,0x2113,0x3333,0x1113,0x3211,0x2113,0x2112, //62
0x2113,0x2113,0x2113,0x2113,0x1113,0x3211,0x2223,0x3322,
0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2113,0x2122, //63
0x2113,0x3233,0x2113,0x2133,0x1123,0x3211,0x2233,0x3322,
0x3333,0x2113,0x3333,0x2113,0x1133,0x2111,0x2113,0x2112, //64
0x2113,0x2113,0x2113,0x2113,0x1123,0x2111,0x2233,0x2222,
0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2113,0x2112, //65
0x1113,0x2111,0x2113,0x3222,0x1123,0x2111,0x2233,0x3222,
0x1333,0x3211,0x1133,0x3322,0x1113,0x3321,0x1123,0x3332, //66
0x1133,0x3332,0x1133,0x3332,0x1133,0x3332,0x2233,0x3333,
0x3333,0x3333,0x3333,0x3333,0x1133,0x2111,0x2113,0x2112, //67
0x2113,0x2113,0x1123,0x2111,0x2213,0x2112,0x1133,0x3211,
0x2113,0x3333,0x2113,0x3333,0x1113,0x3311,0x2113,0x2112, //68
0x2113,0x2113,0x2113,0x2113,0x2113,0x2113,0x2223,0x2223,
0x1333,0x3321,0x2333,0x3332,0x1333,0x3321,0x1333,0x3321, //69
0x1333,0x3321,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322,
0x3333,0x3211,0x3333,0x3322,0x3333,0x3211,0x3333,0x3211, //6a
0x3333,0x3211,0x3333,0x3211,0x3213,0x3211,0x1123,0x3321,
0x2113,0x3333,0x2113,0x3213,0x2113,0x3211,0x1113,0x3321, //6b
0x1113,0x3321,0x2113,0x3311,0x2113,0x2112,0x2223,0x3223,
0x1333,0x3321,0x1333,0x3321,0x1333,0x3321,0x1333,0x3321, //6c
0x1333,0x3321,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322,
0x3333,0x3333,0x3333,0x3333,0x1111,0x2111,0x1211,0x1121, //6d
0x1211,0x1121,0x1211,0x1121,0x1211,0x1121,0x2322,0x2232,
0x3333,0x3333,0x3333,0x3333,0x1113,0x3211,0x2113,0x2112, //6e
0x2113,0x2113,0x2113,0x2113,0x2113,0x2113,0x2223,0x2223,
0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2113,0x2112, //6f
0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322,
0x3333,0x3333,0x3333,0x3333,0x1113,0x3211,0x2113,0x2112, //70
0x2113,0x2113,0x1113,0x3211,0x2113,0x3322,0x2113,0x3333,
0x3333,0x3333,0x3333,0x3333,0x1133,0x2111,0x2113,0x2112, //71
0x2113,0x2113,0x1123,0x2111,0x2233,0x2112,0x3333,0x2113,
0x3333,0x3333,0x3333,0x3333,0x1133,0x2112,0x1133,0x2111, //72
0x1133,0x3222,0x1133,0x3332,0x1133,0x3332,0x2233,0x3332,
0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x1113,0x3322, //73
0x1133,0x3211,0x2233,0x2111,0x1133,0x3211,0x2233,0x3322,
0x1133,0x3332,0x1113,0x3321,0x1123,0x3332,0x1133,0x3332, //74
0x1133,0x3332,0x1133,0x3332,0x1233,0x3321,0x2333,0x3332,
0x3333,0x3333,0x3333,0x3333,0x2113,0x2113,0x2113,0x2113, //75
0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322,
0x3333,0x3333,0x3333,0x3333,0x2113,0x2113,0x2113,0x2113, //76
0x2113,0x2113,0x2113,0x3213,0x1113,0x3321,0x2223,0x3332,
0x3333,0x3333,0x3333,0x3333,0x1211,0x1121,0x1211,0x1121, //77
0x1211,0x1121,0x1211,0x1121,0x1111,0x2111,0x2222,0x3222,
0x3333,0x3333,0x3333,0x3333,0x2113,0x2113,0x2113,0x2113, //78
0x1123,0x3211,0x2113,0x2112,0x2113,0x2113,0x3223,0x3223,
0x3333,0x3333,0x3333,0x3333,0x2113,0x2113,0x2113,0x2113, //79
0x2113,0x2113,0x1123,0x2111,0x2233,0x2112,0x1133,0x3211,
0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2223,0x3211, //7a
0x1333,0x3321,0x1133,0x3332,0x1113,0x2111,0x2223,0x2222,
0x3333,0x3333,0x3333,0x3321,0x1333,0x3332,0x1333,0x3332, //7b
0x2133,0x3333,0x1333,0x3332,0x1333,0x3332,0x3333,0x3321,
0x3333,0x3333,0x1333,0x3332,0x1333,0x3332,0x1333,0x3332, //7c
0x1333,0x3332,0x1333,0x3332,0x1333,0x3332,0x2333,0x3332,
0x3333,0x3333,0x1333,0x3332,0x3333,0x3321,0x3333,0x3321, //7d
0x3333,0x3213,0x3333,0x3321,0x3333,0x3321,0x1333,0x3332,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3113,0x3333, //7e
0x1221,0x2133,0x2332,0x3211,0x3333,0x3322,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //7f
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x2211,0x2222,0x2211,0x2222,0x2211,0x2222,0x2211,0x2222, //80
0x2211,0x2222,0x2211,0x2222,0x2211,0x2222,0x2211,0x2222,
0x1111,0x2222,0x1111,0x2222,0x1111,0x2222,0x1111,0x2222, //81
0x1111,0x2222,0x1111,0x2222,0x1111,0x2222,0x1111,0x2222,
0x1111,0x2211,0x1111,0x2211,0x1111,0x2211,0x1111,0x2211, //82
0x1111,0x2211,0x1111,0x2211,0x1111,0x2211,0x1111,0x2211,
0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111, //83
0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,
0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222, //84
0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,
0x1333,0x3331,0x1333,0x3331,0x1333,0x3331,0x1333,0x3331, //85
0x1333,0x3331,0x1333,0x3331,0x1333,0x3331,0x1333,0x3331,
0x1333,0x3331,0x1333,0x3331,0x1333,0x3331,0x1333,0x3331, //86
0x1111,0x1111,0x1333,0x3331,0x1333,0x3331,0x1333,0x3331,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //87
0x1111,0x1111,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x1113,0x3333,0x2213, //88
0x3333,0x1213,0x3333,0x1213,0x3333,0x1213,0x3333,0x1213,
0x3333,0x3333,0x3333,0x3333,0x1111,0x1111,0x2222,0x2222, //89
0x1111,0x1111,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x1111,0x1111,0x2222,0x2222, //8a
0x1111,0x1111,0x1333,0x3331,0x1333,0x3331,0x1333,0x3331,
0x3333,0x1213,0x3333,0x1213,0x3333,0x1213,0x3333,0x1213, //8b
0x3333,0x1213,0x3333,0x1213,0x3333,0x1213,0x3333,0x1213,
0x3133,0x3333,0x1133,0x3333,0x1133,0x3331,0x1133,0x3311, //8c
0x1133,0x3321,0x1133,0x3332,0x2133,0x3333,0x3233,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1113,0x3332, //8d
0x2123,0x3213,0x1133,0x3321,0x1213,0x3212,0x2113,0x3321,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //8e
0x3333,0x3321,0x3213,0x3213,0x3213,0x3213,0x2133,0x3323,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1333,0x3332, //8f
0x1133,0x3332,0x2213,0x3321,0x3323,0x3321,0x1133,0x3332,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x2133,0x3333, //90
0x1113,0x3321,0x1223,0x3332,0x2133,0x3333,0x1213,0x3321,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1113,0x3312, //91
0x2123,0x3323,0x1113,0x3321,0x2113,0x3213,0x2113,0x3321,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3213,0x3321, //92
0x1123,0x3211,0x2113,0x3212,0x1223,0x3322,0x1333,0x3332,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1333,0x3332, //93
0x1213,0x3321,0x1113,0x3212,0x1213,0x3211,0x1323,0x3322,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1333,0x3332, //94
0x1333,0x3321,0x1133,0x3332,0x1213,0x3321,0x1123,0x3332,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //95
0x1333,0x3321,0x2113,0x3212,0x3223,0x3213,0x1333,0x3321,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //96
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //97
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //98
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //99
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9a
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9b
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9c
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9d
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9e
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9f
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //a0
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //a1
0x3333,0x3333,0x1133,0x3321,0x2133,0x3321,0x1133,0x3321,
0x3333,0x3333,0x1333,0x3211,0x1333,0x3322,0x1333,0x3332, //a2
0x1333,0x3332,0x2333,0x3332,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3321, //a3
0x3333,0x3321,0x3333,0x3321,0x1133,0x3321,0x2233,0x3322,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //a4
0x3333,0x3333,0x3333,0x3333,0x2133,0x3333,0x1333,0x3332,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //a5
0x1333,0x3332,0x2333,0x3332,0x3333,0x3333,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2223,0x2122, //a6
0x1113,0x2111,0x2223,0x2122,0x3333,0x3213,0x1113,0x3321,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1113,0x3321, //a7
0x2223,0x3321,0x2133,0x3321,0x2133,0x3332,0x3213,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3321, //a8
0x1133,0x3332,0x2111,0x3333,0x2122,0x3333,0x2133,0x3333,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1333,0x3332, //a9
0x1113,0x3211,0x2213,0x3212,0x3323,0x3321,0x1133,0x3332,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //aa
0x1133,0x3321,0x1233,0x3332,0x1333,0x3332,0x1113,0x3211,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3321, //ab
0x1113,0x3211,0x2223,0x3321,0x1333,0x3321,0x2113,0x3321,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1213,0x3211, //ac
0x2111,0x3212,0x2122,0x3323,0x1333,0x3332,0x1333,0x3332,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //ad
0x1113,0x3321,0x2223,0x3321,0x3333,0x3321,0x1113,0x3211,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1133,0x3211, //ae
0x2233,0x3212,0x1133,0x3211,0x2233,0x3212,0x1133,0x3211,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //af
0x1213,0x3212,0x2323,0x3213,0x3333,0x3321,0x1133,0x3332,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //b0
0x3333,0x3333,0x1113,0x3211,0x2223,0x3322,0x3333,0x3333,
0x3333,0x3333,0x3333,0x3333,0x1111,0x2111,0x2222,0x3212, //b1
0x2133,0x3213,0x2133,0x3321,0x2133,0x3332,0x3211,0x3333,
0x3333,0x3333,0x3333,0x2133,0x3333,0x3213,0x1333,0x3321, //b2
0x2113,0x3321,0x3223,0x3321,0x3333,0x3321,0x3333,0x3321,
0x3333,0x3333,0x1333,0x3332,0x1113,0x2111,0x2213,0x2122, //b3
0x3323,0x2133,0x3333,0x3213,0x3333,0x3321,0x1133,0x3332,
0x3333,0x3333,0x3333,0x3333,0x1113,0x3211,0x1223,0x3322, //b4
0x1333,0x3332,0x1333,0x3332,0x1333,0x3332,0x1111,0x2111,
0x3333,0x3333,0x3333,0x3213,0x1113,0x2111,0x2223,0x3212, //b5
0x3333,0x3211,0x1333,0x3212,0x1333,0x3212,0x2113,0x3213,
0x3333,0x3333,0x1333,0x3332,0x1113,0x2111,0x1223,0x2122, //b6
0x1333,0x2132,0x2133,0x2133,0x2133,0x2133,0x3213,0x3213,
0x3333,0x3333,0x1333,0x3332,0x1113,0x2111,0x2223,0x3221, //b7
0x3333,0x3321,0x1113,0x1111,0x2223,0x2212,0x3333,0x3213,
0x3333,0x3333,0x1133,0x2111,0x2133,0x2122,0x3213,0x2133, //b8
0x3323,0x3213,0x3333,0x3213,0x3333,0x3321,0x1133,0x3332,
0x3333,0x3333,0x3213,0x3333,0x1113,0x2111,0x2213,0x3212, //b9
0x3321,0x3213,0x3332,0x3321,0x3333,0x3321,0x1133,0x3332,
0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2223,0x2122, //ba
0x3333,0x2133,0x3333,0x2133,0x3333,0x2133,0x1113,0x2111,
0x3333,0x3333,0x3213,0x3213,0x1111,0x2111,0x2212,0x3212, //bb
0x3213,0x3213,0x3323,0x3213,0x3333,0x3321,0x1133,0x3332,
0x3333,0x3333,0x3333,0x3333,0x2113,0x2133,0x3223,0x2133, //bc
0x2113,0x2133,0x3223,0x2133,0x3333,0x3213,0x1113,0x3321,
0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2223,0x3212, //bd
0x3333,0x3321,0x3333,0x3321,0x1333,0x3212,0x2113,0x2133,
0x3333,0x3333,0x2133,0x3333,0x1133,0x2111,0x2111,0x2122, //be
0x2122,0x3213,0x2133,0x3323,0x2133,0x3333,0x1133,0x2111,
0x3333,0x3333,0x3333,0x3333,0x3213,0x2133,0x3213,0x2133, //bf
0x2123,0x3213,0x3233,0x3213,0x3333,0x3321,0x1133,0x3332,
0x3333,0x3333,0x1133,0x2111,0x2133,0x2122,0x2133,0x2133, //c0
0x1213,0x2111,0x2323,0x2122,0x3333,0x3213,0x1133,0x3321,
0x3333,0x3333,0x3333,0x3213,0x1113,0x3321,0x2223,0x3321, //c1
0x1111,0x2111,0x2222,0x3221,0x3333,0x3321,0x1133,0x3332,
0x3333,0x3333,0x3333,0x3333,0x1213,0x2132,0x1213,0x2132, //c2
0x2323,0x2133,0x3333,0x2133,0x3333,0x3213,0x1113,0x3321,
0x3333,0x3333,0x1113,0x3211,0x2223,0x3322,0x1111,0x2111, //c3
0x2222,0x3221,0x3333,0x3321,0x1333,0x3332,0x2113,0x3333,
0x3333,0x3333,0x2133,0x3333,0x2133,0x3333,0x2133,0x3333, //c4
0x1133,0x3332,0x2133,0x3211,0x2133,0x3322,0x2133,0x3333,
0x3333,0x3333,0x3333,0x3321,0x1111,0x2111,0x2222,0x3221, //c5
0x3333,0x3321,0x3333,0x3321,0x1333,0x3332,0x2113,0x3333,
0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2233,0x3322, //c6
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,
0x3333,0x3333,0x3333,0x3333,0x1111,0x2111,0x2222,0x3212, //c7
0x3133,0x3321,0x1233,0x3332,0x2133,0x3321,0x3211,0x3213,
0x3333,0x3333,0x1333,0x3332,0x1111,0x2111,0x2222,0x3212, //c8
0x3333,0x3321,0x1133,0x3212,0x1211,0x2132,0x1322,0x3232,
0x3333,0x3333,0x3333,0x3213,0x3333,0x3213,0x3333,0x3213, //c9
0x3333,0x3321,0x3333,0x3321,0x1333,0x3332,0x2113,0x3333,
0x3333,0x3333,0x1333,0x3332,0x3333,0x3321,0x3213,0x3213, //ca
0x3213,0x3213,0x3321,0x2133,0x3321,0x2133,0x3321,0x2133,
0x3333,0x3333,0x3213,0x2133,0x3213,0x3211,0x1113,0x3322, //cb
0x2213,0x3333,0x3213,0x3333,0x3213,0x3333,0x1133,0x2111,
0x3333,0x3333,0x3333,0x3333,0x1111,0x2111,0x2222,0x2122, //cc
0x3333,0x3213,0x3333,0x3213,0x3333,0x3321,0x1113,0x3332,
0x3333,0x3333,0x3333,0x3333,0x2133,0x3333,0x1213,0x3332, //cd
0x3321,0x3321,0x3332,0x3213,0x3333,0x2133,0x3333,0x3233,
0x3333,0x3333,0x1333,0x3332,0x1111,0x2111,0x1222,0x3222, //ce
0x1213,0x3212,0x1213,0x2132,0x1321,0x2132,0x1321,0x2132,
0x3333,0x3333,0x3333,0x3333,0x1111,0x2111,0x2222,0x2122, //cf
0x3213,0x3213,0x2133,0x3321,0x1333,0x3332,0x3333,0x3321,
0x3333,0x3333,0x3113,0x3333,0x1223,0x3311,0x2333,0x2122, //d0
0x1133,0x3231,0x2233,0x3212,0x1113,0x3322,0x2223,0x2111,
0x3333,0x3333,0x1333,0x3332,0x2133,0x3333,0x3213,0x3333, //d1
0x3213,0x3213,0x3321,0x2133,0x3321,0x2133,0x1111,0x2111,
0x3333,0x3333,0x3333,0x3213,0x3213,0x3213,0x2133,0x3321, //d2
0x1333,0x3332,0x1333,0x3332,0x2133,0x3321,0x3211,0x3213,
0x3333,0x3333,0x3333,0x3333,0x1111,0x2111,0x2122,0x3222, //d3
0x1111,0x2111,0x2122,0x3222,0x2133,0x3333,0x1133,0x2111,
0x3333,0x3333,0x2133,0x3333,0x1133,0x2111,0x2111,0x2122, //d4
0x2122,0x3213,0x2133,0x3323,0x1333,0x3332,0x1333,0x3332,
0x3333,0x3333,0x3333,0x3333,0x1113,0x3321,0x2223,0x3321, //d5
0x3333,0x3321,0x3333,0x3321,0x3333,0x3321,0x1111,0x2111,
0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2223,0x2122, //d6
0x1113,0x2111,0x2223,0x2122,0x3333,0x2133,0x1113,0x2111,
0x3333,0x3333,0x1113,0x3211,0x2223,0x3322,0x1111,0x2111, //d7
0x2222,0x2122,0x3333,0x2133,0x3333,0x3213,0x1113,0x3321,
0x3333,0x3333,0x3213,0x3213,0x3213,0x3213,0x3213,0x3213, //d8
0x3213,0x3213,0x3323,0x3213,0x3333,0x3321,0x1113,0x3332,
0x3333,0x3333,0x1333,0x3332,0x1213,0x3332,0x1213,0x3332, //d9
0x1213,0x2132,0x1213,0x2132,0x1213,0x3212,0x1321,0x3321,
0x3333,0x3333,0x3213,0x3333,0x3213,0x3333,0x3213,0x3333, //da
0x3213,0x3213,0x3213,0x3213,0x3213,0x3321,0x1113,0x3332,
0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2213,0x2122, //db
0x3213,0x2133,0x3213,0x2133,0x3213,0x2133,0x1113,0x2111,
0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2213,0x2122, //dc
0x3323,0x2133,0x3333,0x2133,0x3333,0x3213,0x1133,0x3321,
0x3333,0x3333,0x3333,0x3333,0x1113,0x2132,0x2223,0x2133, //dd
0x3333,0x2133,0x3333,0x2133,0x3333,0x3213,0x1113,0x3321,
0x3333,0x1313,0x1333,0x2322,0x1113,0x2111,0x1223,0x2122, //de
0x1333,0x2132,0x2133,0x2133,0x2133,0x2133,0x3213,0x3213,
0x3333,0x1313,0x1333,0x2322,0x1113,0x2111,0x2223,0x3221, //df
0x3333,0x3321,0x1113,0x1111,0x2223,0x2212,0x3333,0x3213,
0x3333,0x1213,0x3333,0x2323,0x1133,0x2111,0x2133,0x2122, //e0
0x3213,0x3213,0x3323,0x3213,0x3333,0x3321,0x1133,0x3332,
0x3333,0x1313,0x3213,0x2323,0x1113,0x2111,0x2213,0x3212, //e1
0x3321,0x3213,0x3332,0x3321,0x3333,0x3321,0x1133,0x3332,
0x3333,0x1313,0x3333,0x2323,0x1113,0x2111,0x2223,0x2122, //e2
0x3333,0x2133,0x3333,0x2133,0x3333,0x2133,0x1113,0x2111,
0x3333,0x1313,0x3333,0x2323,0x3213,0x3213,0x1111,0x2111, //e3
0x2212,0x3212,0x3213,0x3213,0x3323,0x3321,0x1133,0x3332,
0x3333,0x1313,0x3333,0x2323,0x2113,0x2133,0x3223,0x2133, //e4
0x2113,0x2133,0x3223,0x2133,0x3333,0x3213,0x1113,0x3321,
0x3333,0x1313,0x3333,0x2323,0x1113,0x2111,0x2223,0x3212, //e5
0x3333,0x3321,0x3333,0x3321,0x1333,0x3212,0x2113,0x2133,
0x3333,0x1313,0x2133,0x2323,0x1133,0x2111,0x2111,0x2122, //e6
0x2122,0x3213,0x2133,0x3323,0x2133,0x3333,0x1133,0x2111,
0x3333,0x1313,0x3333,0x2323,0x3213,0x2133,0x3213,0x2133, //e7
0x2123,0x3213,0x3233,0x3213,0x3333,0x3321,0x1133,0x3332,
0x3333,0x1313,0x3333,0x2323,0x1133,0x2111,0x2133,0x2122, //e8
0x1213,0x2111,0x2323,0x2122,0x3333,0x3213,0x1133,0x3321,
0x3333,0x1313,0x3333,0x2323,0x1113,0x3211,0x2223,0x3321, //e9
0x1111,0x2111,0x2222,0x3221,0x3333,0x3321,0x1133,0x3332,
0x3333,0x1313,0x3333,0x2323,0x1213,0x2132,0x1213,0x2132, //ea
0x2323,0x2133,0x3333,0x2133,0x3333,0x3213,0x1113,0x3321,
0x3333,0x1313,0x3333,0x2323,0x1113,0x3211,0x2223,0x3322, //eb
0x1111,0x2111,0x2222,0x3221,0x3333,0x3321,0x1113,0x3332,
0x3333,0x3333,0x2133,0x1313,0x2133,0x2323,0x2133,0x3333, //ec
0x1133,0x3333,0x2133,0x3211,0x2133,0x3322,0x2133,0x3333,
0x3333,0x1313,0x1333,0x2323,0x3333,0x3331,0x3213,0x3213, //ed
0x3213,0x3213,0x3321,0x2133,0x3321,0x2133,0x3321,0x2133,
0x3333,0x1313,0x3213,0x2323,0x3213,0x2111,0x1113,0x3222, //ee
0x2213,0x3333,0x3213,0x3333,0x3213,0x3333,0x1123,0x2111,
0x3333,0x1313,0x3333,0x2323,0x1111,0x2111,0x2222,0x2122, //ef
0x3333,0x3213,0x3333,0x3213,0x3333,0x3321,0x1113,0x3332,
0x3333,0x3333,0x3333,0x1313,0x2133,0x2323,0x1213,0x3332, //f0
0x3321,0x3321,0x3332,0x3213,0x3333,0x2133,0x3333,0x3233,
0x3333,0x1313,0x1333,0x2323,0x1111,0x2111,0x1222,0x3222, //f1
0x1213,0x3212,0x1213,0x2132,0x1321,0x2132,0x1321,0x2132,
0x3333,0x1313,0x1333,0x2322,0x1113,0x2111,0x2213,0x2122, //f2
0x3323,0x2133,0x3333,0x3213,0x3333,0x3321,0x1133,0x3332,
0x3333,0x3133,0x1333,0x1212,0x3333,0x2121,0x3213,0x3213, //f3
0x3213,0x3213,0x3321,0x2133,0x3321,0x2133,0x3321,0x2133,
0x3333,0x3133,0x3213,0x1213,0x3213,0x2111,0x1113,0x3222, //f4
0x2213,0x3333,0x3213,0x3333,0x3213,0x3333,0x1133,0x2111,
0x3333,0x3133,0x3333,0x1213,0x1111,0x2111,0x2222,0x2122, //f5
0x3333,0x3213,0x3333,0x3213,0x3333,0x3321,0x1113,0x3332,
0x3333,0x3133,0x3333,0x1213,0x2133,0x2123,0x1213,0x3232, //f6
0x3321,0x3321,0x3332,0x3213,0x3333,0x2133,0x3333,0x3233,
0x3333,0x3133,0x1333,0x1212,0x1111,0x2111,0x1222,0x3222, //f7
0x1213,0x3212,0x1213,0x2132,0x1321,0x2132,0x1321,0x2132,
0x3333,0x3333,0x1333,0x3332,0x1113,0x3211,0x2123,0x3322, //f8
0x1113,0x2113,0x1223,0x3221,0x2133,0x3332,0x1133,0x2111,
0x3333,0x3333,0x1333,0x3332,0x1113,0x3321,0x2123,0x2132, //f9
0x1113,0x3211,0x2121,0x2121,0x1321,0x2132,0x2113,0x3213,
0x3333,0x3333,0x3213,0x3333,0x3213,0x3213,0x3213,0x2133, //fa
0x3213,0x2133,0x3213,0x2133,0x1213,0x3232,0x2133,0x3333,
0x3333,0x3333,0x1133,0x3321,0x2233,0x3332,0x1333,0x3211, //fb
0x2113,0x2122,0x3223,0x2133,0x3333,0x3213,0x1133,0x3321,
0x3333,0x3333,0x1133,0x3321,0x2233,0x3332,0x1113,0x3211, //fc
0x2223,0x3321,0x1333,0x3332,0x2133,0x3321,0x3213,0x2113,
0x3333,0x3333,0x2133,0x2133,0x1133,0x2121,0x2113,0x3232, //fd
0x1123,0x3211,0x2113,0x2122,0x2121,0x2133,0x2113,0x3213,
0x3333,0x3333,0x3333,0x3321,0x2133,0x3213,0x1111,0x2132, //fe
0x2122,0x2121,0x3213,0x3321,0x3321,0x3321,0x1132,0x3332,
0x3333,0x3333,0x1333,0x3332,0x1113,0x3211,0x2223,0x3321, //ff
0x1133,0x2111,0x2233,0x3212,0x3313,0x3323,0x1133,0x3211,
0x3333,0x3333,0x3333,0x3213,0x3333,0x3321,0x1333,0x3332, //100
0x2133,0x3333,0x1333,0x3332,0x3333,0x3321,0x3333,0x3213,
0x3333,0x3333,0x3333,0x3213,0x1213,0x2111,0x2213,0x3212, //101
0x3213,0x3213,0x3213,0x3213,0x2133,0x3213,0x3233,0x3321,
0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2233,0x2122, //102
0x3333,0x3213,0x3333,0x3323,0x3213,0x3333,0x1133,0x2111,
0x3333,0x3333,0x1333,0x3332,0x1113,0x3211,0x2223,0x3321, //103
0x3333,0x3212,0x3333,0x3213,0x3213,0x3333,0x1123,0x3211,
0x3333,0x3333,0x3333,0x3333,0x3213,0x3333,0x3213,0x3333, //104
0x3213,0x3333,0x3213,0x3333,0x3213,0x3213,0x1123,0x3321,
0x3333,0x3333,0x3333,0x3321,0x1113,0x2111,0x2223,0x3221, //105
0x1133,0x3321,0x2133,0x3321,0x1333,0x3321,0x1113,0x3332,
0x3333,0x3333,0x3333,0x3333,0x3213,0x3321,0x1113,0x2111, //106
0x3211,0x3321,0x3212,0x3321,0x3213,0x2133,0x1133,0x3211,
0x3333,0x3333,0x2133,0x2133,0x2133,0x2133,0x3233,0x3213, //107
0x1113,0x2111,0x1223,0x3222,0x2133,0x3333,0x1333,0x2111,
0x3333,0x3333,0x1333,0x3332,0x1113,0x3211,0x2123,0x3322, //108
0x3213,0x2111,0x3213,0x3222,0x1213,0x3332,0x3321,0x2111,
0x3333,0x3333,0x1333,0x3332,0x1113,0x3211,0x2123,0x3322, //109
0x1213,0x3311,0x2113,0x2122,0x3223,0x2133,0x1333,0x3211,
0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2211,0x2122, //10a
0x3322,0x2133,0x3333,0x2133,0x3333,0x3213,0x1133,0x3321,
0x3333,0x3333,0x3333,0x2113,0x1133,0x3211,0x2211,0x3321, //10b
0x1322,0x3332,0x1333,0x3332,0x3333,0x3321,0x3333,0x2113,
0x3333,0x3333,0x3213,0x3333,0x3213,0x2133,0x2133,0x3211, //10c
0x1133,0x3322,0x2213,0x3333,0x3213,0x3333,0x1133,0x2111,
0x3333,0x3333,0x2133,0x3333,0x1111,0x2112,0x2212,0x3223, //10d
0x3213,0x3213,0x1321,0x3211,0x2132,0x2112,0x1333,0x3221,
0x3333,0x3333,0x3333,0x3333,0x1213,0x2111,0x2213,0x3222, //10e
0x3213,0x3333,0x3213,0x3333,0x3213,0x3321,0x2133,0x2113,
0x3333,0x3333,0x3333,0x3321,0x3213,0x3321,0x1213,0x3211, //10f
0x2113,0x2121,0x1121,0x2112,0x2121,0x2121,0x3213,0x3211,
0x3333,0x3333,0x3333,0x3333,0x3213,0x3211,0x1211,0x2122, //110
0x2112,0x2133,0x3213,0x2111,0x3211,0x2121,0x3212,0x3211,
0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2113,0x2122, //111
0x2121,0x2133,0x2121,0x2133,0x2121,0x2133,0x3213,0x3213,
0x3333,0x3333,0x3333,0x3213,0x1121,0x2111,0x2221,0x3212, //112
0x3321,0x3213,0x1321,0x3211,0x2121,0x2112,0x1332,0x3221,
0x3333,0x3333,0x2133,0x3333,0x2111,0x3213,0x3212,0x2113, //113
0x3321,0x3213,0x3321,0x3213,0x3321,0x3321,0x1113,0x3332,
0x3333,0x3333,0x1133,0x3333,0x2233,0x3321,0x3333,0x3332, //114
0x1213,0x3332,0x3321,0x2121,0x3321,0x2121,0x1132,0x3232,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1133,0x3332, //115
0x2213,0x3321,0x3321,0x3213,0x3332,0x2133,0x3333,0x2233,
0x3333,0x3333,0x1321,0x2111,0x2321,0x3212,0x1321,0x2111, //116
0x2321,0x3212,0x1321,0x3211,0x2121,0x2112,0x1213,0x3221,
0x3333,0x3333,0x1113,0x3211,0x2223,0x3321,0x1113,0x3211, //117
0x2223,0x3321,0x1113,0x3321,0x2221,0x3211,0x1113,0x3322,
0x3333,0x3333,0x1113,0x3321,0x1223,0x3332,0x2133,0x3213, //118
0x1113,0x3211,0x2121,0x2112,0x3211,0x3213,0x3322,0x3321,
0x3333,0x3333,0x2133,0x3333,0x1111,0x3212,0x2122,0x2133, //119
0x2113,0x3333,0x2121,0x2133,0x3213,0x2133,0x1133,0x3211,
0x3333,0x3333,0x3333,0x3321,0x1213,0x3211,0x2113,0x2121, //11a
0x1211,0x2132,0x1121,0x2132,0x2121,0x2133,0x3213,0x3213,
0x3333,0x3333,0x1333,0x3332,0x1113,0x3321,0x2123,0x3332, //11b
0x1113,0x3321,0x2123,0x2132,0x2133,0x2133,0x1333,0x3211,
0x3333,0x3333,0x3333,0x3321,0x1213,0x3211,0x2113,0x2121, //11c
0x3211,0x2132,0x2122,0x3213,0x2133,0x3323,0x1333,0x3332,
0x3333,0x3333,0x1333,0x3332,0x1321,0x3211,0x1121,0x2122, //11d
0x1211,0x2132,0x1321,0x2132,0x1332,0x3212,0x2133,0x3323,
0x3333,0x3333,0x1333,0x3332,0x1333,0x3211,0x1333,0x3322, //11e
0x1333,0x3332,0x1113,0x3321,0x1221,0x3212,0x2113,0x3323,
0x3333,0x3333,0x1133,0x3321,0x2233,0x3332,0x2133,0x3211, //11f
0x1213,0x2122,0x2113,0x2133,0x3223,0x2133,0x1333,0x3211,
0x3333,0x3333,0x2133,0x3333,0x3213,0x3213,0x3213,0x3213, //120
0x2113,0x3213,0x3223,0x3213,0x3333,0x3321,0x1133,0x3332,
0x3333,0x3333,0x1113,0x3211,0x2223,0x3321,0x1333,0x3211, //121
0x2113,0x2122,0x1221,0x2121,0x2132,0x2121,0x1333,0x3211,
0x3333,0x3333,0x3333,0x3211,0x1213,0x3212,0x1211,0x3212, //122
0x2112,0x3213,0x3213,0x3213,0x3211,0x3213,0x3212,0x2133,
0x3333,0x3333,0x1333,0x3211,0x2113,0x3321,0x1223,0x3332, //123
0x1133,0x3211,0x2211,0x2122,0x3322,0x2133,0x1333,0x3211,
0x3333,0x3333,0x3333,0x3333,0x3213,0x3311,0x1211,0x2122, //124
0x2112,0x2133,0x3213,0x2133,0x3211,0x2133,0x3212,0x3211,
0x3333,0x3333,0x3333,0x3333,0x1333,0x3332,0x1333,0x3332, //125
0x2133,0x3333,0x1133,0x3332,0x1213,0x2132,0x3321,0x3211,
0x3333,0x1313,0x3333,0x2323,0x2133,0x3213,0x1111,0x2132, //126
0x2122,0x2121,0x3213,0x3221,0x3321,0x3321,0x1132,0x3332,
0x3333,0x1313,0x1333,0x2322,0x1113,0x3211,0x2223,0x3321, //127
0x1133,0x2111,0x2233,0x3212,0x3313,0x3323,0x1123,0x3211,
0x3333,0x1313,0x3333,0x2323,0x3333,0x3321,0x1333,0x3332, //128
0x2133,0x3333,0x1233,0x3333,0x2333,0x3331,0x3333,0x3312,
0x3333,0x1313,0x3333,0x2323,0x1213,0x2111,0x3213,0x3213, //129
0x3213,0x3213,0x3213,0x3213,0x2123,0x3213,0x3233,0x3321,
0x3333,0x1313,0x3333,0x2323,0x1133,0x3211,0x2233,0x2122, //12a
0x3333,0x3213,0x3333,0x3323,0x3213,0x3333,0x1123,0x3111,
0x3333,0x1313,0x1333,0x2322,0x1113,0x3211,0x2223,0x3321, //12b
0x3333,0x3212,0x3333,0x3213,0x3213,0x3323,0x1123,0x3211,
0x3333,0x3333,0x3333,0x3131,0x3213,0x3232,0x3213,0x3333, //12c
0x3213,0x3333,0x3213,0x3333,0x3213,0x3213,0x1133,0x3321,
0x3333,0x1313,0x3333,0x2321,0x1113,0x2111,0x2223,0x3321, //12d
0x1133,0x3321,0x2133,0x3321,0x1333,0x3321,0x1113,0x3332,
0x3333,0x1313,0x3333,0x2323,0x3213,0x3321,0x1113,0x2111, //12e
0x2211,0x3221,0x3212,0x3321,0x3213,0x2132,0x1133,0x3211,
0x3333,0x1313,0x2133,0x2323,0x2133,0x2133,0x3233,0x3213, //12f
0x1113,0x3111,0x1223,0x3222,0x2133,0x3333,0x1233,0x2111,
0x3333,0x1313,0x1333,0x2322,0x1113,0x3211,0x2123,0x3322, //130
0x3213,0x2111,0x3213,0x3222,0x1213,0x3332,0x2321,0x2111,
0x3333,0x1313,0x1333,0x2322,0x1113,0x3211,0x2123,0x3322, //131
0x1213,0x3211,0x2113,0x2122,0x3223,0x2133,0x1333,0x3211,
0x3333,0x1313,0x3333,0x2323,0x1133,0x3211,0x2211,0x2122, //132
0x3322,0x2133,0x3333,0x2133,0x3333,0x3213,0x1133,0x3321,
0x3333,0x1313,0x3333,0x2323,0x1133,0x2111,0x2211,0x3221, //133
0x1322,0x3332,0x1333,0x3332,0x3333,0x3321,0x3333,0x2113,
0x3333,0x1313,0x3213,0x2323,0x3213,0x2133,0x2133,0x3211, //134
0x1133,0x3322,0x2213,0x3333,0x3213,0x3333,0x1133,0x2111,
0x3333,0x1313,0x3333,0x2323,0x1121,0x2111,0x2221,0x3212, //135
0x3321,0x3213,0x1321,0x3211,0x2121,0x2112,0x1332,0x3221,
0x3333,0x1313,0x2133,0x2323,0x2111,0x3213,0x3212,0x2113, //136
0x3321,0x3213,0x3321,0x3213,0x3321,0x3321,0x1113,0x3332,
0x3333,0x1313,0x1133,0x2323,0x2233,0x3321,0x3333,0x3332, //137
0x1213,0x3332,0x2321,0x2121,0x3321,0x2121,0x1132,0x3232,
0x3333,0x3333,0x3333,0x3131,0x3333,0x3232,0x1133,0x3332, //138
0x2213,0x3321,0x3321,0x3213,0x3332,0x2133,0x3333,0x3233,
0x3333,0x1313,0x1321,0x2321,0x2321,0x3212,0x1321,0x2111, //139
0x2321,0x3212,0x1321,0x3211,0x2121,0x2112,0x1213,0x3221,
0x3333,0x3133,0x3333,0x1213,0x1121,0x2111,0x2221,0x3212, //13a
0x3321,0x3213,0x1321,0x3211,0x2121,0x2112,0x1332,0x3221,
0x3333,0x3133,0x2133,0x1213,0x2111,0x2123,0x3213,0x1113, //13b
0x3321,0x2213,0x3321,0x3213,0x3321,0x3321,0x1113,0x3332,
0x3333,0x3133,0x1133,0x1213,0x2233,0x2121,0x3333,0x3232, //13c
0x1213,0x3332,0x3321,0x2121,0x3321,0x2121,0x1132,0x3232,
0x3333,0x3313,0x3333,0x2121,0x3333,0x3212,0x1133,0x3322, //13d
0x2213,0x3321,0x3321,0x3213,0x3332,0x2133,0x3333,0x3233,
0x3333,0x3133,0x1321,0x1211,0x2321,0x2112,0x1321,0x2111, //13e
0x2321,0x3212,0x1321,0x3211,0x2121,0x2112,0x1213,0x3221,
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //13f
0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,
};

View File

@ -0,0 +1,48 @@
/********************************************************************/
/* myChar.h */
/* HelloWolrd */
/* */
/* Copyright (C) 2003-2006 NINTENDO Co.,Ltd. */
/********************************************************************/
/*
 
*/
#ifndef __MY_CHAR_H__
#define __MY_CHAR_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <nitro.h>
// define data ------------------------------------------------------
// パレットカラー
#define WHITE 0
#define RED 1
#define GREEN 2
#define BLUE 3
#define YELLOW 4
#define CYAN 5
#define PURPLE 6
#define LIGHTGREEN 7
#define HIGHLIGHT_Y 8
#define HIGHLIGHT_C 9
// global variable---------------------------------------------------
// const data--------------------------------------------------------
extern const u16 myPalette[ 13 ][ 16 ]; // パレットデータ
extern const u16 myChar[ 0x20 * 0x140 / sizeof(u16) ]; // キャラクターデータ
// function----------------------------------------------------------
#ifdef __cplusplus
}
#endif
#endif // __MY_CHAR_H__

View File

@ -0,0 +1,163 @@
/********************************************************************/
/* myFunc.c */
/* HelloWorld */
/* */
/* Copyright (C) 2003-2006 NINTENDO Co.,Ltd. */
/********************************************************************/
/*
*/
#include <nitro.h>
#include "myFunc.h"
#include "myChar.h"
// define data-------------------------------------------------------
// function's prototype----------------------------------------------
static void ClearVRAM( void );
static void PrintStringCore( BOOL sel_lcd, s32 x, s32 y, u16 color, const char *strp );
// extern data-------------------------------------------------------
// global variable---------------------------------------------------
u16 bg0BakM[ SCREEN_X_CHAR * SCREEN_Y_CHAR ] ATTRIBUTE_ALIGN(32); // メインBG0 バックアップ
u16 bg0BakS[ SCREEN_X_CHAR * SCREEN_Y_CHAR ] ATTRIBUTE_ALIGN(32); // サブ BG0 バックアップ
// static variable---------------------------------------------------
// const data--------------------------------------------------------
// ==================================================================
// function's description
// ==================================================================
// VRAMクリア
static void ClearVRAM( void )
{
static BOOL cleared = FALSE;
if( !cleared ) {
GX_SetBankForLCDC( GX_VRAM_LCDC_ALL ); // VRAMクリアのために一時的にLCDCにVRAMを全て割り当てる。
MI_CpuClearFast( (void*)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE );
(void)GX_DisableBankForLCDC();
cleared = TRUE;
}
}
// 画面初期化
void InitDispMain( void )
{
// 画面設定-----------------------------------
GX_DispOff(); // LCDC OFF
// VRAMクリア
ClearVRAM();
//---- パレットクリア
MI_CpuClearFast( (void*)HW_PLTT, HW_PLTT_SIZE );
//---- VRAMの割り当て
GX_SetBankForBG ( GX_VRAM_BG_128_A );
//---- グラフィックス表示モードにする
GX_SetGraphicsMode( GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D );
//---- BG0の設定
G2_SetBG0Control( GX_BG_SCRSIZE_TEXT_256x256,
GX_BG_COLORMODE_16,
GX_BG_SCRBASE_0x0000,
GX_BG_CHARBASE_0x04000,
GX_BG_EXTPLTT_01 );
G2_SetBG0Priority( 0 ); // BGコントロール セット
//---- BG0の表示のみON
GX_SetVisiblePlane( GX_PLANEMASK_BG0 );
//---- データロード
MI_CpuCopy16( myChar, (void *)( HW_BG_VRAM + BG0_CHAR_BASE ), sizeof(myChar) ); // BGキャラクタ セット
MI_CpuCopy16( myPalette, (void *)HW_BG_PLTT, sizeof(myPalette) ); // BGパレット セット
// スクリーンバッファクリア
MI_CpuClear32( bg0BakM, sizeof(bg0BakM) );
}
// サブ画面初期化
void InitDispSub( void )
{
// 画面設定-----------------------------------
GXS_DispOff(); // LCDC OFF
// VRAMクリア
ClearVRAM();
//---- パレットクリア
MI_CpuClearFast( (void*)HW_DB_PLTT, HW_DB_PLTT_SIZE );
//---- VRAMの割り当て
GX_SetBankForSubBG ( GX_VRAM_SUB_BG_128_C );
//---- グラフィックス表示モードにする
GXS_SetGraphicsMode( GX_BGMODE_0 );
//---- BG0の設定
G2S_SetBG0Control( GX_BG_SCRSIZE_TEXT_256x256,
GX_BG_COLORMODE_16,
GX_BG_SCRBASE_0x0000,
GX_BG_CHARBASE_0x04000,
GX_BG_EXTPLTT_01 );
G2S_SetBG0Priority( 0 ); // BGコントロール セット
//---- BG0の表示のみON
GXS_SetVisiblePlane( GX_PLANEMASK_BG0 );
//---- データロード
MI_CpuCopy16( myChar, (void *)( HW_DB_BG_VRAM + BG0_CHAR_BASE ), sizeof(myChar) ); // BGキャラクタ セット
MI_CpuCopy16( myPalette, (void *)HW_DB_BG_PLTT, sizeof(myPalette) ); // BGパレット セット
// スクリーンバッファクリア
MI_CpuClear32( bg0BakS, sizeof(bg0BakS) );
}
// DSスクリーンへの文字列出力
void PrintString( BOOL sel_lcd, s32 x, s32 y, u16 color, const char *fmt, ... )
{
char buf[ 64 + 2 ];
va_list vlist;
va_start( vlist, fmt );
(void)OS_VSNPrintf( buf, sizeof(buf) - 2, fmt, vlist );
va_end( vlist );
PrintStringCore( sel_lcd, x, y, color, (const char *)buf );
}
// DSスクリーンバッファへの文字列書き出し
static void PrintStringCore( BOOL sel_lcd, s32 x, s32 y, u16 color, const char *strp )
{
u16 *buffp = ( sel_lcd ) ? (u16 *)bg0BakM : (u16 *)bg0BakS;
u16 *dstp = buffp + x + ( y * SCREEN_X_CHAR );
while( *strp ) {
*dstp++ = (u16)( ( color << GX_SCRFMT_TEXT_COLORPLTT_SHIFT ) | *strp++ );
}
}
// 矩形スクリーンクリア
void ClearRectangle( u16 *pScreen, u16 pos_x, u16 pos_y, u8 width, u8 height )
{
u16 i,j;
pScreen += pos_x + ( pos_y << 5 );
for(i=0;i<height;i++) {
for( j = 0; j < width; j++ ) {
*pScreen++ = 0x0020;
}
pScreen += 0x20 - width;
}
}

View File

@ -0,0 +1,50 @@
/********************************************************************/
/* myChar.h */
/* HelloWorld */
/* */
/* Copyright (C) 2003-2006 NINTENDO Co.,Ltd. */
/********************************************************************/
/*
 
*/
#ifndef __MY_FUNC_H__
#define __MY_FUNC_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <nitro.h>
// define data ------------------------------------------------------
#define SCREEN_X_CHAR 32 // スクリーン横キャラクタ数
#define SCREEN_Y_CHAR 24 // スクリーン縦キャラクタ数
#define BG0_CHAR_BASE 0x4000
#define BG0_SCREEN_BASE 0x0000
#define PrintStringM(...) PrintString( 1, __VA_ARGS__ )
#define PrintStringS(...) PrintString( 0, __VA_ARGS__ )
#define ClearRectangleM(...) ClearRectangle( bg0BakM, __VA_ARGS__ )
#define ClearRectangleS(...) ClearRectangle( bg0BakS, __VA_ARGS__ )
// global variable---------------------------------------------------
extern u16 bg0BakM[ SCREEN_X_CHAR * SCREEN_Y_CHAR ]; // メインBG0 バックアップ
extern u16 bg0BakS[ SCREEN_X_CHAR * SCREEN_Y_CHAR ]; // サブ BG0 バックアップ
// const data--------------------------------------------------------
// function----------------------------------------------------------
void InitDispMain( void );
void InitDispSub ( void );
void PrintString( BOOL sel_lcd, s32 x, s32 y, u16 color, const char *fmt, ... ); // 64文字までの書式付き文字列を画面に出力
void ClearRectangle( u16 *pScreen, u16 pos_x, u16 pos_y, u8 width, u8 height ); // 矩形スクリーンクリア
#ifdef __cplusplus
}
#endif
#endif // __MY_FUNC_H__