TwlIPL/build/systemMenu_RED/MachineSettings/ARM9/src/selectRegion.c
yosiokat 8634f14535 SYSMライブラリの一部をUTLライブラリ、BANNERライブラリに切り出し。
TwlIPL内のライブラリとTwlSDKで追加使用するライブラリをcommondefs内ではなく、各アプリ内で
それぞれ指定するよう変更。
使用していなかったヘッダ類を削除。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1444 b08762b0-b915-fc4b-9d8c-17b2551a87ff
2008-05-21 11:01:42 +00:00

171 lines
4.9 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*---------------------------------------------------------------------------*
Project: TwlIPL
File: SelectRegion.c
Copyright 2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Date:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#include <twl.h>
#include "misc.h"
#include "MachineSetting.h"
// define data------------------------------------------
#define CANCEL_BUTTON_TOP_X ( 2 * 8 )
#define CANCEL_BUTTON_TOP_Y ( 21 * 8 )
#define CANCEL_BUTTON_BOTTOM_X ( (CANCEL_BUTTON_TOP_X + 8 ) * 8 )
#define CANCEL_BUTTON_BOTTOM_Y ( (CANCEL_BUTTON_TOP_Y + 2 ) * 8 )
// extern data------------------------------------------
// function's prototype declaration---------------------
// global variable -------------------------------------
// static variable -------------------------------------
static TWLRegion s_regionCode; // ƒŠ<C692>[ƒWƒ‡ƒ“
// const data -----------------------------------------
static const u16 *const s_pStrRegion[] = {
(const u16 *)L"NCL",
(const u16 *)L"NOA",
(const u16 *)L"NOE",
(const u16 *)L"NAL ",
(const u16 *)L"IQue",
(const u16 *)L"NOK ",
};
static MenuPos s_regionPos[] = {
{ TRUE, 4 * 8, 6 * 8 },
{ TRUE, 4 * 8, 8 * 8 },
{ TRUE, 4 * 8, 10 * 8 },
{ TRUE, 4 * 8, 12 * 8 },
{ TRUE, 4 * 8, 14 * 8 },
{ TRUE, 4 * 8, 16 * 8 },
};
static const MenuParam regionSel = {
6,
TXT_COLOR_BLACK,
TXT_COLOR_GREEN,
TXT_COLOR_RED,
&s_regionPos[ 0 ],
(const u16 **)&s_pStrRegion,
};
TWLLangCode default_lang_list[TWL_REGION_MAX] =
{
TWL_LANG_JAPANESE,
TWL_LANG_ENGLISH,
TWL_LANG_ENGLISH,
TWL_LANG_ENGLISH,
TWL_LANG_SIMP_CHINESE,
TWL_LANG_KOREAN
};
TWLCountryCode default_country_list[TWL_REGION_MAX] =
{
TWL_COUNTRY_JAPAN,
TWL_COUNTRY_Anguilla,
TWL_COUNTRY_ALBANIA,
TWL_COUNTRY_ALBANIA,
TWL_COUNTRY_CHINA,
TWL_COUNTRY_SOUTH_KOREA
};
//======================================================
// function's description
//======================================================
// ƒŠ<C692>[ƒWƒ‡ƒ“<C692>ÝèÌ<E2809A>‰Šú‰»
void SelectRegionInit( void )
{
GX_DispOff();
GXS_DispOff();
NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL );
PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"REGION SELECT" );
PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_COLOR_CYAN, (const u16 *)L"CANCEL" );
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//  ç©ßTWL<57>Ýèƒf<C692>[ƒ^ƒtƒ@ƒCƒ©ç“ÇÝ<E2809A>žÝ<E2809A>ÏÝÌ<E2809A>ÝèðŽæ“¾
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// ƒŠ<C692>[ƒWƒ‡ƒ“̎擾
s_regionCode = (TWLRegion)THW_GetRegion();
DrawMenu( (u16)s_regionCode, &regionSel );
SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 );
GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1);
GXS_SetVisiblePlane( GX_PLANEMASK_BG0 );
GX_DispOn();
GXS_DispOn();
}
// ƒŠ<C692>[ƒWƒ‡ƒ“Ið
int SelectRegionMain( void )
{
BOOL tp_select,tp_cancel = FALSE;
ReadTP(); // TP“ü—Í̎擾
//--------------------------------------
// ƒL<C692>[“ü—Í<E28094>ˆ<CB86>
//--------------------------------------
if( pad.trg & PAD_KEY_DOWN ) { // ƒJ<C692>[ƒ\ƒ‹‚̈ړ®
if( ++s_regionCode == TWL_REGION_MAX ) {
s_regionCode = (TWLRegion)0;
}
}
if( pad.trg & PAD_KEY_UP ) {
if( --s_regionCode < 0 ) {
s_regionCode = (TWLRegion)( TWL_REGION_MAX - 1 );
}
}
tp_select = SelectMenuByTP( (u16 *)&s_regionCode, &regionSel );
DrawMenu( (u16)s_regionCode, &regionSel );
// [CANCEL]ƒ{ƒ^ƒ“‰Ÿ‰ºƒ`ƒFƒbƒN
if( tpd.disp.touch ) {
tp_cancel = WithinRangeTP( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y,
CANCEL_BUTTON_BOTTOM_X, CANCEL_BUTTON_BOTTOM_Y, &tpd.disp );
}
if( ( pad.trg & PAD_BUTTON_A ) || tp_select ) { // ƒ<>ƒjƒ…<C692>[<5B>ÚÖÌ•ªŠò
// ::::::::::::::::::::::::::::::::::::::::::::::
// HWƒZƒLƒ…ƒA<C692>î•ñƒtƒ@ƒCƒÖÌ<E2809A>«<E2809A>žÝ<E2809A>iˆÃ<CB86>†‰»Èµ<E2809A>j
// ::::::::::::::::::::::::::::::::::::::::::::::
THW_SetRegion( s_regionCode );
(void)THW_WriteSecureInfo( NULL );
// ::::::::::::::::::::::::::::::::::::::::::::::
// TWL<57>Ýèƒf<C692>[ƒ^ƒtƒ@ƒCƒÖÌ<E2809A>«<E2809A>žÝ
// ::::::::::::::::::::::::::::::::::::::::::::::
TSD_SetLanguage( default_lang_list[s_regionCode] ); // ƒfƒtƒHƒƒgŒ¾ŒêÉ­<E280B9>§<EFBFBD>Ýè
TSD_SetCountry( default_country_list[s_regionCode] ); // ƒfƒtƒHƒƒg<C692>É­<E280B9>§<EFBFBD>Ýè
if( !MY_WriteTWLSettings() ) {
OS_TPrintf( "TWL settings write failed.\n" );
}
MachineSettingInit();
return 0;
}else if( ( pad.trg & PAD_BUTTON_B ) || tp_cancel ) {
MachineSettingInit();
return 0;
}
return 0;
}