mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
TwlIPL内のライブラリとTwlSDKで追加使用するライブラリをcommondefs内ではなく、各アプリ内で それぞれ指定するよう変更。 使用していなかったヘッダ類を削除。 git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1444 b08762b0-b915-fc4b-9d8c-17b2551a87ff
171 lines
4.9 KiB
C
171 lines
4.9 KiB
C
/*---------------------------------------------------------------------------*
|
||
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, ®ionSel );
|
||
|
||
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, ®ionSel );
|
||
DrawMenu( (u16)s_regionCode, ®ionSel );
|
||
|
||
// [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;
|
||
}
|
||
|
||
|