/*---------------------------------------------------------------------------* Project: TwlSDK - NandInitializer File: process_hw_info.c Copyright 2008 Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Date:: $ $Rev$ $Author$ *---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include "kami_font.h" #include "kami_pxi.h" #include "process_topmenu.h" #include "process_hw_info.h" #include "process_auto.h" #include "process_fade.h" #include "cursor.h" #include "keypad.h" #include "hwi.h" // #include "TWLHWInfo_api.h" #include "TWLSettings_api.h" // /*---------------------------------------------------------------------------* 型定義 *---------------------------------------------------------------------------*/ enum { MENU_REGION_JAPAN = 0, MENU_REGION_AMERICA, MENU_REGION_EUROPE, MENU_REGION_AUSTRALIA, MENU_REGION_CHINA, MENU_REGION_KOREA, MENU_RETURN, NUM_OF_MENU_SELECT }; /*---------------------------------------------------------------------------* 定数定義 *---------------------------------------------------------------------------*/ #define DOT_OF_MENU_SPACE 16 #define CHAR_OF_MENU_SPACE 2 #define MENU_TOP_LINE 5 #define CURSOR_ORIGIN_X 32 #define CURSOR_ORIGIN_Y 40 #define NANDINITIALIZER_SETTING_FILE_PATH_IN_SD "sdmc:/nandinitializer.ini" #define ROUND_UP(value, alignment) \ (((u32)(value) + (alignment-1)) & ~(alignment-1)) /*---------------------------------------------------------------------------* 内部変数定義 *---------------------------------------------------------------------------*/ static s8 sMenuSelectNo; static BOOL sWirelessForceOff; /*---------------------------------------------------------------------------* 内部関数宣言 *---------------------------------------------------------------------------*/ static BOOL WriteHWNormalInfoFile( void ); static BOOL WriteHWSecureInfoFile( u8 region ); //static BOOL DeleteHWInfoFile( void ); static BOOL GetNandInitializerSetting(u8* region, u8* wireless); /*---------------------------------------------------------------------------* プロセス関数定義 *---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------* Name: HWInfo プロセス0 Description: Arguments: None. Returns: next sequence *---------------------------------------------------------------------------*/ void* HWInfoProcess0(void) { int i; // 文字列全クリア kamiFontClear(); // バージョン表示 kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Write Hardware Information "); kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); // メニュー一覧 kamiFontPrintf(3, 4, FONT_COLOR_BLACK, "+--------------------+----+"); kamiFontPrintf(3, 5, FONT_COLOR_BLACK, "l REGION JAPAN l l"); kamiFontPrintf(3, 6, FONT_COLOR_BLACK, "+--------------------+----+"); kamiFontPrintf(3, 7, FONT_COLOR_BLACK, "l REGION AMERICA l l"); kamiFontPrintf(3, 8, FONT_COLOR_BLACK, "+--------------------+----+"); kamiFontPrintf(3, 9, FONT_COLOR_BLACK, "l REGION EUROPE l l"); kamiFontPrintf(3, 10, FONT_COLOR_BLACK, "+--------------------+----+"); kamiFontPrintf(3, 11, FONT_COLOR_BLACK, "l REGION AUSTRALIA l l"); kamiFontPrintf(3, 12, FONT_COLOR_BLACK, "+--------------------+----+"); kamiFontPrintf(3, 13, FONT_COLOR_BLACK, "l REGION CHINA l l"); kamiFontPrintf(3, 14, FONT_COLOR_BLACK, "+--------------------+----+"); kamiFontPrintf(3, 15, FONT_COLOR_BLACK, "l REGION KOREA l l"); kamiFontPrintf(3, 16, FONT_COLOR_BLACK, "+--------------------+----+"); kamiFontPrintf(3, 17, FONT_COLOR_BLACK, "l RETURN l l"); kamiFontPrintf(3, 18, FONT_COLOR_BLACK, "+--------------------+----+"); // 現在のリージョンに"now"と表示 kamiFontPrintf(26, (s16)(MENU_TOP_LINE+LCFG_THW_GetRegion()*CHAR_OF_MENU_SPACE), FONT_COLOR_BLACK, "now"); // 背景全クリア for (i=0;i<24;i++) { kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); } // 背景上部 kamiFontFillChar( 0, BG_COLOR_PURPLE, BG_COLOR_PURPLE ); kamiFontFillChar( 1, BG_COLOR_PURPLE, BG_COLOR_PURPLE ); kamiFontFillChar( 2, BG_COLOR_PURPLE, BG_COLOR_TRANS ); // カーソル除外 SetCursorPos((u16)200, (u16)200); FADE_IN_RETURN( HWInfoProcess1 ); } /*---------------------------------------------------------------------------* Name: HWInfo プロセス1 Description: Arguments: None. Returns: next sequence *---------------------------------------------------------------------------*/ void* HWInfoProcess1(void) { #ifndef NAND_INITIALIZER_LIMITED_MODE // オート実行用 if (gAutoFlag) { return HWInfoProcess2; } #endif // 選択メニューの変更 if ( kamiPadIsRepeatTrigger(PAD_KEY_UP) ) { if (--sMenuSelectNo < 0) sMenuSelectNo = NUM_OF_MENU_SELECT -1; } else if ( kamiPadIsRepeatTrigger(PAD_KEY_DOWN) ) { if (++sMenuSelectNo >= NUM_OF_MENU_SELECT) sMenuSelectNo = 0; } // カーソル配置 SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); // 決定 if (kamiPadIsTrigger(PAD_BUTTON_A)) { return HWInfoProcess2; } // トップメニューへ戻る else if (kamiPadIsTrigger(PAD_BUTTON_B)) { FADE_OUT_RETURN( TopmenuProcess0 ); } return HWInfoProcess1; } /*---------------------------------------------------------------------------* Name: HWInfo プロセス2 Description: Arguments: None. Returns: next sequence *---------------------------------------------------------------------------*/ void* HWInfoProcess2(void) { int i; BOOL result; #ifndef NAND_INITIALIZER_LIMITED_MODE // オート実行用 if (gAutoFlag) { // SDカードのnandinitializer.iniより設定を取得 if (!GetNandInitializerSetting((u8 *)&sMenuSelectNo, (u8 *)&sWirelessForceOff)) { // 設定の取得に失敗した場合はデフォルト設定(REGION_JAPAN/WIRELESS_ENABLE) sMenuSelectNo = 0; sWirelessForceOff = FALSE; } } else #endif { sWirelessForceOff = LCFG_THW_IsForceDisableWireless(); } switch( sMenuSelectNo ) { case MENU_REGION_JAPAN: case MENU_REGION_AMERICA: case MENU_REGION_EUROPE: case MENU_REGION_AUSTRALIA: case MENU_REGION_CHINA: case MENU_REGION_KOREA: result = WriteHWInfoFile( (u8)sMenuSelectNo, sWirelessForceOff ); // 全リージョンの結果をクリア for (i=0;i