TwlIPL/build/systemMenu_RED/MachineSettings/ARM9/src/selectRegion.c
yosiokat c2ee48afc8 ・本体設定データの整理。
・HWNormalInfo, HWSecureInfo, TWLSettingsの3種類のファイルに分割。
  ・上記3つのファイルフォーマットを共通のTSFフォーマットにする。
・MachineSettingsで上記フォーマットに追随。
・HWInfoWriterも上記フォーマットに追随。
・Launcher
  ・OS_InitをSYSM_Init内に取り込んで、OS_SetMainArenaHiが有効になるようにする。
  ・SYSM_ReadParametersの処理を整理する。
  ・RTC補正値をセットするよう変更。
・hyena.TWL
  ・RTCリセット検出を行うようにする。
  ・SCFGレジスタ値をWRAMのシステム領域にコピーするよう変更。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@347 b08762b0-b915-fc4b-9d8c-17b2551a87ff
2007-12-11 13:00:58 +00:00

175 lines
5.1 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:: 2007-11-19#$
$Rev: 215 $
$Author: yosiokat $
*---------------------------------------------------------------------------*/
#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" );
if( g_initialSet ) {
PutStringUTF16( 8 * 8, 18 * 8, TXT_COLOR_RED, (const u16 *)L"Select region." );
}
// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//  ç©ß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>Ýè
TSD_SetFlagLanguage( TRUE ); // Language“ü—̓tƒ‰ƒOð—§Äé
//TSD_SetFlagCountry( TRUE ); // Country“ü—̓tƒ‰ƒOð—§Äé
(void)SYSM_WriteTWLSettingsFile();
MachineSettingInit();
return 0;
}else if( ( pad.trg & PAD_BUTTON_B ) || tp_cancel ) {
MachineSettingInit();
return 0;
}
return 0;
}