diff --git a/build/tools/RepairExportSaveData/Makefile b/build/tools/RepairExportSaveData/Makefile new file mode 100644 index 0000000..bedd93c --- /dev/null +++ b/build/tools/RepairExportSaveData/Makefile @@ -0,0 +1,56 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: RepairExportSaveData +# 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 + +TARGET_BIN = RepairExportSaveData.srl + +INCDIR = ./include $(ROOT)/build/libraries/os/common/include +SRCDIR = ./src + +SRCS = main.c screen.c font.c common.c RepairExportSaveData.c + +LLIBRARIES = liblcfg$(TWL_LIBSUFFIX).a \ + libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a \ + libnam$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +# libnamut$(TWL_LIBSUFFIX).a\ + +ROM_SPEC = ./ROM-TS_sys.rsf + +COMPONENT_NAME = armadillo_SYSMENU +MAKEROM_ARM7_BASE = $(TWL_COMPONENTSDIR)/$(COMPONENT_NAME)/$(TWL_BUILDTYPE_ARM7)/$(COMPONENT_NAME) +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +MAKEROM := $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== + + diff --git a/build/tools/RepairExportSaveData/ROM-TS_sys.rsf b/build/tools/RepairExportSaveData/ROM-TS_sys.rsf new file mode 100644 index 0000000..d63ba79 --- /dev/null +++ b/build/tools/RepairExportSaveData/ROM-TS_sys.rsf @@ -0,0 +1,288 @@ +#---------------------------------------------------------------------------- +# Project: RepairExportSaveData +# 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/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./resource/rom_header_0tca.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + # PermitLandingNormalJump TRUE + + # + # 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 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 + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + + # + # 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 [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### 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] + # + 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 0TCA + + # + # 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 +} + +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 +} diff --git a/build/tools/RepairExportSaveData/include/RepairExportSaveData.h b/build/tools/RepairExportSaveData/include/RepairExportSaveData.h new file mode 100644 index 0000000..19207da --- /dev/null +++ b/build/tools/RepairExportSaveData/include/RepairExportSaveData.h @@ -0,0 +1,35 @@ +/*---------------------------------------------------------------------------* + Project: RepairExportSaveData + File: RepairExportSaveData.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 __REPAIR_EXPORT_SAVEDATA_H__ +#define __REPAIR_EXPORT_SAVEDATA_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +// define data---------------------------------------------------------- +void RepairSaveDataInit( void ); +void RepairSaveDataMain( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __REPAIR_EXPORT_SAVEDATA_H__ diff --git a/build/tools/RepairExportSaveData/include/common.h b/build/tools/RepairExportSaveData/include/common.h new file mode 100644 index 0000000..a0d7975 --- /dev/null +++ b/build/tools/RepairExportSaveData/include/common.h @@ -0,0 +1,67 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - tests - appjumpTest + File: common.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 COMMON_H_ +#define COMMON_H_ + +#ifdef __cplusplus + +extern "C" { +#endif + +/*===========================================================================*/ +#include + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define KEY_REPEAT_START 25 // キーリピート開始までのフレーム数 +#define KEY_REPEAT_SPAN 10 // キーリピートの間隔フレーム数 + +/*---------------------------------------------------------------------------* + 構造体 定義 + *---------------------------------------------------------------------------*/ + +// キー入力情報 +typedef struct KeyInfo +{ + u16 cnt; // 未加工入力値 + u16 trg; // 押しトリガ入力 + u16 up; // 離しトリガ入力 + u16 rep; // 押し維持リピート入力 +} KeyInfo; + +/*---------------------------------------------------------------------------* + Prototype + *---------------------------------------------------------------------------*/ +void InitCommon(void); + +void ReadKey(KeyInfo* pKey); + +void VBlankIntr(void); + +/*===========================================================================*/ +#ifdef __cplusplus + +} /* extern "C" */ +#endif + +#endif /* COMMON_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tools/RepairExportSaveData/include/font.h b/build/tools/RepairExportSaveData/include/font.h new file mode 100644 index 0000000..641a882 --- /dev/null +++ b/build/tools/RepairExportSaveData/include/font.h @@ -0,0 +1,41 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - WCM - demos - wcm-list-2 + File: font.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. + + $Date:: $ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus + +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ +#ifdef __cplusplus + +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tools/RepairExportSaveData/include/screen.h b/build/tools/RepairExportSaveData/include/screen.h new file mode 100644 index 0000000..f76cca9 --- /dev/null +++ b/build/tools/RepairExportSaveData/include/screen.h @@ -0,0 +1,49 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - WCM - demos - wcm-list-2 + File: screen.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. + + $Date:: $ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus + +extern "C" { +#endif + +/*===========================================================================*/ +#include + +/*---------------------------------------------------------------------------* + 関数 定義 + *---------------------------------------------------------------------------*/ +void InitScreen(void); +void ClearScreen(void); +void ClearMainScreen(void); +void ClearSubScreen(void); +void PutMainScreen(s32 x, s32 y, u8 palette, char* text, ...); +void PutSubScreen(s32 x, s32 y, u8 palette, char* text, ...); +void UpdateScreen(void); + +/*===========================================================================*/ +#ifdef __cplusplus + +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tools/RepairExportSaveData/readme.txt b/build/tools/RepairExportSaveData/readme.txt new file mode 100644 index 0000000..feb313a --- /dev/null +++ b/build/tools/RepairExportSaveData/readme.txt @@ -0,0 +1,5 @@ + +本ツールは、TwlSDKの下記ブランチでのみビルドできます。 + +http://10.114.1.206:80/~twl-dev/svn/TwlSDK/branches/branch-5_0rcplus_UIG_plus_CARDBOARD/ + diff --git a/build/tools/RepairExportSaveData/src/RepairExportSaveData.c b/build/tools/RepairExportSaveData/src/RepairExportSaveData.c new file mode 100644 index 0000000..acdd71b --- /dev/null +++ b/build/tools/RepairExportSaveData/src/RepairExportSaveData.c @@ -0,0 +1,453 @@ +/*---------------------------------------------------------------------------* + Project: RepairExportSaveData + File: RepairExportSaveData.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 +#include +#include "RepairExportSaveData.h" +#include "common.h" +#include "screen.h" + +// define data------------------------------------------ +typedef enum DetectError +{ + DETECT_ERROR_NONE = 0, + DETECT_ERROR_DIR_OPEN = 1, + DETECT_ERROR_RESCUE_DATA = 2, + DETECT_ERROR_VERIFY_DATA = 3, + DETECT_ERROR_MAX +} +DetectError; + +typedef enum RunningMode +{ + MODE_WRITABLE = 0, + MODE_NOSD = 1, + MODE_PROC = 2, + MODE_RESULT = 3, + MODE_MAX +} +RunningMode; + +typedef enum SDStat +{ + SDSTAT_INSERTED = 0, + SDSTAT_REMOVED = 1, + SDSTAT_MAX +} +SDStat; + +// extern data------------------------------------------ + +// function's prototype declaration--------------------- +static void MenuScene( void ); +DetectError ResucuSDSaveData( void ); +static void* AllocForNAM(u32 size); +static void FreeForNAM(void* ptr); + +// global variable ------------------------------------- + +// static variable ------------------------------------- +static DetectError s_result; + +static char s_mode = 0; +static s32 s_SDCheck = 0; +static BOOL s_protected = FALSE; +static BOOL s_protect_checked = FALSE; +static FSEventHook s_hook; + +static s32 s_debug = 0; + +static KeyInfo gKey; + +// const data ----------------------------------------- +static const char *s_result_message[ DETECT_ERROR_MAX ] = +{ + "Success", + "Directory Access Error", + "Rescue Save Data Error", + "Verify Save Data Error" +}; + + +//****************************************************************************** +// SD抜け監視コールバック +//****************************************************************************** +static void subCallBack( void* userdata, FSEvent event, void* argument ) +{ +#pragma unused( userdata, argument ) + + if( event == FS_EVENT_MEDIA_INSERTED ) + { + s_SDCheck = SDSTAT_INSERTED; //挿入 + s_protect_checked = FALSE; + } + else if( event == FS_EVENT_MEDIA_REMOVED ) + { + s_SDCheck = SDSTAT_REMOVED; //抜け + } +} + +static BOOL IsSDProtected( void ) +{ + FSPathInfo info; + if( TRUE == FS_GetPathInfo("sdmc:/", &info) ) + { + if( info.attributes & FS_ATTRIBUTE_IS_PROTECTED ) + { + return TRUE; + } + } + return FALSE; +} + +static FSResult IsSDExist( void ) +{ + FSPathInfo info; + if( TRUE == FS_GetPathInfo("sdmc:/", &info) ) + { + return FS_RESULT_SUCCESS; + }else + { + return FS_GetArchiveResultCode("sdmc:/"); + } +} + +static BOOL IsCardRemoved( void ) +{ + // SD カードが抜けたか、いきなりプロテクトがかかったら、 + // SD カード見当たらないモードへ + if( ( s_SDCheck == SDSTAT_REMOVED ) || s_protected ) + { + s_mode = MODE_NOSD; + return TRUE; + } + return FALSE; +} + +/*---------------------------------------------------------------------------* + Name: DrawMainScene + + Description: 描画まとめ + + メモ: + 0xf0, // 黒 0xf1, // 赤 0xf2, // 緑 + 0xf3, // 青 0xf4, // 黄 0xf5, // ピンク + 0xf6, // 水色 0xf7, // くすんだ赤 0xf8, // くすんだ緑 + 0xf9, // くすんだ青 0xfa, // くすんだ黄色 0xfb, // 紫 + 0xfc, // うすい青 0xfd, // 灰色 0xfe, // 濃い灰色 + *---------------------------------------------------------------------------*/ +static void DrawMainScene( void ) +{ + PutMainScreen( 2, 2, 0xff, "+--------------------------+"); + PutMainScreen( 2, 3, 0xff, "+ +"); + PutMainScreen( 2, 4, 0xff, "+ Repair Exported SaveData +"); + PutMainScreen( 2, 5, 0xff, "+ +"); + PutMainScreen( 2, 6, 0xff, "+--------------------------+"); + + // モードごとの描画処理 + switch( s_mode ) + { + case MODE_WRITABLE: + // ライト可モード + PutMainScreen( 3, 12, 0xf6, "Press A Button to start."); + break; + case MODE_NOSD: + // SD カード見当たらないモード + if( ( s_SDCheck == SDSTAT_INSERTED ) && s_protected) + { + PutMainScreen( 1, 12, 0xf1, "SD card is locked."); + PutMainScreen( 1, 14, 0xf1, "Please insert unlocked SD card."); + }else + { + PutMainScreen( 3, 12, 0xf1, "Please insert SD card."); + } + break; + case MODE_PROC: + PutMainScreen( 3, 12, 0xf4, "Now Accessing SD card"); + PutMainScreen( 3, 14, 0xf4, "Please Do not Touch SD card"); + break; + case MODE_RESULT: + if( s_result == DETECT_ERROR_NONE ) + { + PutMainScreen( 5, 12, 0xf2, "%s", s_result_message[s_result]); + } + else + { + PutMainScreen( 6, 12, 0xf1, "%s", s_result_message[s_result]); + PutMainScreen( 7, 14, 0xf1, "Error Code : %d", s_debug); + } + break; + default: + break; + } +} + + +/*---------------------------------------------------------------------------* + Name: CheckCard + + Description: + *---------------------------------------------------------------------------*/ +static void CheckCard( void ) +{ + return; +} + + +/*---------------------------------------------------------------------------* + Name: RepairSaveDataInit + + Description: 初期化 + *---------------------------------------------------------------------------*/ +void RepairSaveDataInit( void ) +{ + NAM_Init(AllocForNAM, FreeForNAM); + + FS_Init(3); + + OS_InitTick(); + + { + FSResult fsr = IsSDExist(); + s_protected = IsSDProtected(); + + if( fsr == FS_RESULT_SUCCESS ) + { + s_SDCheck = SDSTAT_INSERTED; + }else + { + s_SDCheck = SDSTAT_REMOVED; + } + + if( ( fsr == FS_RESULT_SUCCESS ) && !s_protected ) + { + // 書き込み準備万端 + s_mode = MODE_WRITABLE; + }else + { + // SD カードが無いかプロテクトされてる + s_mode = MODE_NOSD; + } + + // ここから SD カード挿抜を見はじめる + FS_RegisterEventHook("sdmc", &s_hook, subCallBack, NULL); + } + + // 表示 + DrawMainScene(); +} + + +/*---------------------------------------------------------------------------* + Name: RepairSaveDataMain + + Description: メインループ + *---------------------------------------------------------------------------*/ +void RepairSaveDataMain(void) +{ + OSIntrMode intrmode; + + // 再表示 + DrawMainScene(); + + // SD カードが刺さったら一回だけプロテクトチェックする + // 再び刺さるまでチェックしない + + // 割り込み禁止 + intrmode = OS_DisableInterrupts(); + if( !s_protect_checked ) + { + s_protect_checked = TRUE; + // ここで割り込み禁止解除しないとかえってこなくなる + OS_RestoreInterrupts( intrmode ); + s_protected = IsSDProtected(); + }else + { + // こちらでも割り込み禁止解除 + OS_RestoreInterrupts( intrmode ); + } + + ReadKey(&gKey); + + // モードごとのメイン処理(キー処理、モード遷移など) + switch( s_mode ) + { + // ライト可モード + case MODE_WRITABLE: + // カード、SDカード抜け検出と共通モードチェンジ + if ( IsCardRemoved() == TRUE ) + { + break; + } + + // キー入力があれば読み込みスレッド起動してライティングモードへ + if( gKey.trg == PAD_BUTTON_A ) + { + //OS_CreateThread( &readwrite_thread, SaveCardToSD, NULL, stack+STACK_SIZE/sizeof(u64), STACK_SIZE, THREAD_PRIO ); + //OS_WakeupThreadDirect( &readwrite_thread ); + s_mode = MODE_PROC; + break; + } + + break; + + // SD カード見当たらないモード + case MODE_NOSD: + // SD カードが刺さったらライト可モードへ + // ただしプロテクトがかかってたら遷移しない + if( s_SDCheck == SDSTAT_INSERTED ) + { + if( !s_protected ) + { + s_mode = MODE_WRITABLE; + break; + } + } + + break; + + // 処理モード + case MODE_PROC: + s_result = ResucuSDSaveData(); + + // SDカード抜け検出 + if ( IsCardRemoved() == TRUE ) + { + // とりあえず読み込みスレッド終了を待ってから終わる + // そうしないと読み込み用スレッド並立してしまう可能性 + //while( !OS_IsThreadTerminated( &readwrite_thread ) ){} + break; + } + + // 読み込みスレッドが終了したらライト可モードへ + /*if( OS_IsThreadTerminated( &readwrite_thread ) ) + { + s_mode = MODE_WRITABLE; + s_read_count = 0; // 読み込みスレッド終わってからでないとかっこわるい + break; + }*/ + + /* + if( gKey.trg == PAD_BUTTON_A ) + { + s_mode = MODE_RESULT; + } + */ + s_mode = MODE_RESULT; + break; + + // 結果モード + case MODE_RESULT: + break; + default: + break; + } +} + + +/*---------------------------------------------------------------------------* + Name: ResucuSDSaveData + + Description: SDカードに退避されたアプリのセーブデータの署名を付け替える + *---------------------------------------------------------------------------*/ +DetectError ResucuSDSaveData( void ) +{ + FSFile file; + FSDirectoryEntryInfo dir; + DetectError retval = DETECT_ERROR_NONE; + + FS_InitFile(&file); + + if( FS_OpenDirectory(&file, "sdmc:/private/ds/title", FS_PERMIT_R ) ) + { + OS_TPrintf("Open Directory Fail...\n"); + } + + while( FS_ReadDirectory(&file, &dir) ) + { + char* pExtension; + char path_buf[FS_ENTRY_LONGNAME_MAX]; + + // 拡張子が .bin のものだけ処理を行う + pExtension = STD_SearchCharReverse( dir.longname, '.'); + if( pExtension ) + { + if(!STD_CompareString( pExtension, ".bin")) + { + STD_TSNPrintf( path_buf, FS_ENTRY_LONGNAME_MAX, "sdmc:/private/ds/title/%s", dir.longname ); + + OS_TPrintf("%s\n", path_buf); + + { + FSFile tempFile; + BOOL result; + + FS_InitFile(&tempFile); + result = FS_OpenFileEx( &tempFile, path_buf, FS_FILEMODE_R); + + if( result ) + { + OS_TPrintf("opne success\n"); + } + FS_CloseFile(&tempFile); + } + + s_debug = NAM_RescueBkp( path_buf ); + + // セーブデータの救済処置 + if(s_debug == NAM_OK) + { + // 処理が成功したらベリファイ + if(NAM_VerifyBkpStrict( path_buf ) != NAM_OK) + { + retval = DETECT_ERROR_VERIFY_DATA; + break; + } + } + else + { + retval = DETECT_ERROR_RESCUE_DATA; + break; + } + } + } + } + + FS_CloseDirectory(&file); + + return retval; +} + + +static void* AllocForNAM(u32 size) +{ + void* ptr; + ptr = OS_AllocFromMain(size); + + if (ptr == NULL) + { + OS_Panic("alloc failed."); + } + + return ptr; + +} + +static void FreeForNAM(void* ptr) +{ + OS_FreeToMain(ptr); +} + diff --git a/build/tools/RepairExportSaveData/src/common.c b/build/tools/RepairExportSaveData/src/common.c new file mode 100644 index 0000000..c236eb0 --- /dev/null +++ b/build/tools/RepairExportSaveData/src/common.c @@ -0,0 +1,157 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - tests - appjumpTest + File: common.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 "common.h" + +static void InitInterrupts(void); +static void InitHeap(void); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: InitCommon + + Description: 基本的な初期化関数をここで呼ぶ。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void InitCommon(void) +{ + OS_Init(); + OS_InitTick(); + + OS_InitAlarm(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + CARD_Init(); // 新規追加 + CARD_Enable(TRUE); // 新規追加 + + InitHeap(); + InitInterrupts(); +} + +/*---------------------------------------------------------------------------* + Name: ReadKey + + Description: キー入力情報を取得し、入力情報構造体を編集する。 + 押しトリガ、離しトリガ、押し継続リピートトリガ を検出する。 + + Arguments: pKey - 編集するキー入力情報構造体を指定する。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void ReadKey(KeyInfo* pKey) +{ + static u16 repeat_count[12]; + int i; + u16 r; + + r = PAD_Read(); + pKey->trg = 0x0000; + pKey->up = 0x0000; + pKey->rep = 0x0000; + + for (i = 0; i < 12; i++) + { + if (r & (0x0001 << i)) + { + if (!(pKey->cnt & (0x0001 << i))) + { + pKey->trg |= (0x0001 << i); // 押しトリガ + repeat_count[i] = 1; + } + else + { + if (repeat_count[i] > KEY_REPEAT_START) + { + pKey->rep |= (0x0001 << i); // 押し継続リピート + repeat_count[i] = (u16) (KEY_REPEAT_START - KEY_REPEAT_SPAN); + } + else + { + repeat_count[i]++; + } + } + } + else + { + if (pKey->cnt & (0x0001 << i)) + { + pKey->up |= (0x0001 << i); // 離しトリガ + } + } + } + + pKey->cnt = r; // 未加工キー入力 +} + +/*---------------------------------------------------------------------------* + Name: InitInterrupts + + Description: 割り込み設定を初期化する。 + V ブランク割り込みを許可し、割り込みハンドラを設定する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitInterrupts(void) +{ + // V ブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + + // 割り込み許可 + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); +} + +/*---------------------------------------------------------------------------* + Name: InitHeap + + Description: メインメモリ上のアリーナにてメモリ割当てシステムを初期化する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +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); +} + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tools/RepairExportSaveData/src/font.c b/build/tools/RepairExportSaveData/src/font.c new file mode 100644 index 0000000..ebc10e7 --- /dev/null +++ b/build/tools/RepairExportSaveData/src/font.c @@ -0,0 +1,585 @@ +/*---------------------------------------------------------------------------* + Project: NitroWiFi - WCM - demos - wcm-list + File: font.c + + Copyright 2005-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. + + $Log: font.c,v $ + Revision 1.2 2006/03/10 09:22:43 kitase_hirotake + INDENT SOURCE + + Revision 1.1 2005/07/21 08:21:06 adachi_hiroaki + 新規追加 + + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#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 + *---------------------------------------------------------------------------*/ diff --git a/build/tools/RepairExportSaveData/src/main.c b/build/tools/RepairExportSaveData/src/main.c new file mode 100644 index 0000000..e2cbd5d --- /dev/null +++ b/build/tools/RepairExportSaveData/src/main.c @@ -0,0 +1,172 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tests - appjumpTest - Nand-2 + 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 +//#include +//#include +//#include +//#include + +#include "RepairExportSaveData.h" +#include "common.h" +#include "screen.h" + +/*---------------------------------------------------------------------------* + 変数 定義 + *---------------------------------------------------------------------------*/ +/* +typedef void* (*NAMUTAlloc)(u32 size); +typedef void (*NAMUTFree)(void* ptr); + +static NAMUTAlloc spAllocFunc; +static NAMUTFree spFreeFunc; + +// キー入力 +static KeyInfo gKey; +*/ +/*---------------------------------------------------------------------------* + Prototype + *---------------------------------------------------------------------------*/ +/* +static void DrawScene(void); +static void* AllocForNAM(u32 size); +static void FreeForNAM(void* ptr); + +void* MyNAMUT_Alloc(u32 size); +void MyNAMUT_Free(void* buffer); +*/ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: メイン関数 + *---------------------------------------------------------------------------*/ +void TwlMain(void) +{ + InitCommon(); + InitScreen(); + + GX_DispOn(); + GXS_DispOn(); + + ClearScreen(); + RepairSaveDataInit(); + +// spAllocFunc = AllocForNAM; +// spFreeFunc = FreeForNAM; + +// FS_Init( FS_DMA_NOT_USE ); + +// NAM_Init(AllocForNAM, FreeForNAM); + +// PutMainScreen( 7, 12, 0xf6, "--- Now Loading ---"); +// PutSubScreen( 7, 12, 0xf6, "--- Now Loading ---"); + + while(TRUE) + { + // 処理 + RepairSaveDataMain(); + + // Vブランク待ち + OS_WaitVBlankIntr(); + + // 画面クリア + ClearScreen(); + } + + // Vブランク待ち 最後に画面を更新してから終了 + OS_WaitVBlankIntr(); + OS_Terminate(); +} + + +/*---------------------------------------------------------------------------* + Name: DrawScene + + Description: 画面描画関数 + + メモ: + 0xf0, // 黒 0xf1, // 赤 0xf2, // 緑 + 0xf3, // 青 0xf4, // 黄 0xf5, // ピンク + 0xf6, // 水色 0xf7, // くすんだ赤 0xf8, // くすんだ緑 + 0xf9, // くすんだ青 0xfa, // くすんだ黄色 0xfb, // 紫 + 0xfc, // うすい青 0xfd, // 灰色 0xfe, // 濃い灰色 + *---------------------------------------------------------------------------*/ +/* +#define COMMON_COLOR ((u8)0xff) +#define PERSONALIZED_COLOR ((u8)0xfc) + +#define GAME_CODE_BASE_X 1 + +static void DrawScene(void) +{ + PutMainScreen( 10, 12, 0xf1, "--- Error ---"); + PutSubScreen( 10, 12, 0xf1, "--- Error ---"); +} + + +void* MyNAMUT_Alloc(u32 size) +{ + const u32 allocSize = MATH_ROUNDUP32(size); + SDK_ASSERTMSG( spAllocFunc != NULL, "NAMUT_Init should be called previously.\n"); + return spAllocFunc(allocSize); +} + + +static void* AllocForNAM(u32 size) +{ + void* ptr; + ptr = OS_AllocFromMain(size); + + if (ptr == NULL) + { + OS_Panic("alloc failed."); + } + + return ptr; +} + + +void MyNAMUT_Free(void* buffer) +{ + SDK_ASSERTMSG( spFreeFunc != NULL, "NAMUT_Init should be called previously.\n"); + if (buffer) + { + spFreeFunc(buffer); + } +} + + +static void FreeForNAM(void* ptr) +{ + OS_FreeToMain(ptr); +} +*/ + +void VBlankIntr(void) +{ + // テキスト表示を更新 + UpdateScreen(); + + // IRQ チェックフラグ47をセット + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tools/RepairExportSaveData/src/screen.c b/build/tools/RepairExportSaveData/src/screen.c new file mode 100644 index 0000000..b1ee321 --- /dev/null +++ b/build/tools/RepairExportSaveData/src/screen.c @@ -0,0 +1,194 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - WCM - demos - wcm-list-2 + File: screen.c + + 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. + + $Date:: $ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#include +#include "screen.h" +#include "font.h" + +/*---------------------------------------------------------------------------* + 定数 定義 + *---------------------------------------------------------------------------*/ +#define TEXT_SCREEN_SIZE 2048 + +/*---------------------------------------------------------------------------* + 内部変数 定義 + *---------------------------------------------------------------------------*/ + +// 仮想スクリーン[ 上下画面 ][ BG 枚数 ][ キャラクタ数 ] +static u16 gScreen[2 ][ 1 ][ TEXT_SCREEN_SIZE / sizeof(u16) ] ATTRIBUTE_ALIGN(32); + +/*---------------------------------------------------------------------------* + Name: InitScreen + + Description: 文字表示システムのために、表示設定を初期化する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void InitScreen(void) +{ + // 各 V-RAM 初期化 + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void*)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + // OAM 初期化 + MI_CpuFillFast((void*)HW_OAM, 0xc0, HW_OAM_SIZE); + MI_CpuFillFast((void*)HW_DB_OAM, 0xc0, HW_DB_OAM_SIZE); + + // パレット初期化 + MI_CpuClearFast((void*)HW_PLTT, HW_PLTT_SIZE); + MI_CpuClearFast((void*)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + // 上画面設定 + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + + GX_SetBankForBG(GX_VRAM_BG_128_A); + 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); + + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + ((u16*)HW_PLTT)[0] = 0x0000; // black + MI_CpuFillFast(gScreen[0][0], 0, TEXT_SCREEN_SIZE); + DC_StoreRange(gScreen[0][0], TEXT_SCREEN_SIZE); + GX_LoadBG0Scr(gScreen[0][0], 0, TEXT_SCREEN_SIZE); + + // 下画面設定 + GX_SetBankForSubBG(GX_VRAM_SUB_BG_32_H); + 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); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + ((u16*)HW_DB_PLTT)[0] = 0x0000; // black + MI_CpuFillFast(gScreen[1][0], 0, TEXT_SCREEN_SIZE); + DC_StoreRange(gScreen[1][0], TEXT_SCREEN_SIZE); + GXS_LoadBG0Scr(gScreen[1][0], 0, TEXT_SCREEN_SIZE); +} + +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: 画面のテキスト表示をクリアする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast(gScreen[0][0], TEXT_SCREEN_SIZE); + MI_CpuClearFast(gScreen[1][0], TEXT_SCREEN_SIZE); +} +void ClearMainScreen(void) +{ + MI_CpuClearFast(gScreen[0][0], TEXT_SCREEN_SIZE); + +} +void ClearSubScreen(void) +{ + MI_CpuClearFast(gScreen[1][0], TEXT_SCREEN_SIZE); +} +/*---------------------------------------------------------------------------* + Name: PutMainScreen + + Description: メイン画面にテキスト出力する。 + + Arguments: text - 出力する文字列。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void PutMainScreen(s32 x, s32 y, u8 palette, char* text, ...) +{ + va_list vlist; + char temp[33]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + for (i = 0; i < 32; i++) + { + if (temp[i] == 0x00) + { + break; + } + + gScreen[0][0][((y * 32) + x + i) % (32 * 32)] = (u16) (palette << 12 | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: PrintSubScreen + + Description: サブ画面にテキスト出力する。 + + Arguments: text - 出力する文字列。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void PutSubScreen(s32 x, s32 y, u8 palette, char* text, ...) +{ + va_list vlist; + char temp[33]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + for (i = 0; i < 32; i++) + { + if (temp[i] == 0x00) + { + break; + } + + gScreen[1][0][((y * 32) + x + i) % (32 * 32)] = (u16) (palette << 12 | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: UpdateScreen + + Description: 仮想スクリーンを V-RAM に反映する。 + V ブランク期間中での呼び出しを想定。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void UpdateScreen(void) +{ + // 仮想スクリーンを V-RAM に反映 + DC_StoreRange(gScreen[0][0], TEXT_SCREEN_SIZE); + GX_LoadBG0Scr(gScreen[0][0], 0, TEXT_SCREEN_SIZE); + DC_StoreRange(gScreen[1][0], TEXT_SCREEN_SIZE); + GXS_LoadBG0Scr(gScreen[1][0], 0, TEXT_SCREEN_SIZE); +} + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/