TwlIPL/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_check_console.c
kamikawa cd59bcdbfb SystemUpdaterRegionSelectの追加
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2562 b08762b0-b915-fc4b-9d8c-17b2551a87ff
2008-10-01 05:03:34 +00:00

199 lines
5.4 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: SystemUpdater
File: check_console.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 <twl.h>
#include "kami_global.h"
#include "kami_font.h"
#include "kami_pxi.h"
/*---------------------------------------------------------------------------*
Œ^’è‹`
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
“à•”è<E28099>è`
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
“à•”•Ï<E280A2>è`
*---------------------------------------------------------------------------*/
static RunningConsole sRunning = UNKNOWN;
/*---------------------------------------------------------------------------*
“à•”ŠÖ<C5A0><EFBFBD>錾
*---------------------------------------------------------------------------*/
static RunningConsole CheckConsole(void);
/*---------------------------------------------------------------------------*
ŠÖ<C5A0>è`
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
Name: ProcessCheckConsole
Description:
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void ProcessCheckConsole(void)
{
BOOL isAdapter;
u16 batLevel;
sRunning = CheckConsole();
switch (sRunning)
{
case IS_TWL_DEBUGGER:
kamiFontPrintfConsole( FONT_COLOR_GREEN, "Running on IS_TWL_DEBUGGER.\n");
break;
case IS_TWL_CAPTURE:
kamiFontPrintfConsole( FONT_COLOR_GREEN, "Running on IS_TWL_CAPTURE.\n");
break;
case TWL:
kamiFontPrintfConsole( FONT_COLOR_GREEN, "Running on TWL CONSOLE.\n");
break;
case UNKNOWN:
kamiFontPrintfConsole( FONT_COLOR_GREEN, "Running on UNKNOWN.\n");
break;
}
/*
#ifdef SYSM_BUILD_FOR_DEBUGGER
// ƒfƒoƒbƒKŒü¯SystemUpdaterÍŽÀ@ƃLƒƒƒvƒ`ƒƒÅÍ“®<E2809C>쳹Ȣ
if (sRunning != IS_TWL_DEBUGGER)
{
ProcessCancel((const char *)
L" Sorry,\n"
L" This SystemUpdater can not\n"
L" execute on TWL-CONSOLE. "
);
}
#else
// ŽÀ‹@Œü¯SystemUpdater̓fƒoƒbƒKÅÍ“®<E2809C>쳹Ȣ
if (sRunning == IS_TWL_DEBUGGER)
{
ProcessCancel((const char *)
L" Sorry,\n"
L" This SystemUpdater can not\n"
L" execute on IS-TWL-DEBUGGER. "
);
}
#endif // SYSM_BUILD_FOR_DEBUGGER
*/
// UNKNOWNÍ“®<E2809C>쳹Ȣ
if (sRunning == UNKNOWN)
{
ProcessCancel((const char *)
L" Sorry,\n"
L" This SystemUpdater can not\n"
L" execute on UNKNOWN CONSOLE. "
);
}
// “drŽc—ʪ<E2809A>­È¯êΓ®<E2809C>쳹Ȣ
while (PM_GetBatteryLevel( &batLevel ) != PM_RESULT_SUCCESS)
{
OS_Sleep(1);
}
while (PM_GetACAdapter( &isAdapter ) != PM_RESULT_SUCCESS)
{
OS_Sleep(1);
}
if (((batLevel <= 2) && ! isAdapter) ||
(batLevel <= 1))
{
ProcessCancel((const char *)
L" Sorry,\n"
L" This SystemUpdater can not\n"
L" execute if battery is low. "
);
}
kamiFontLoadScreenData();
}
/*---------------------------------------------------------------------------*
Name: CheckConsole
Description:
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
static RunningConsole CheckConsole(void)
{
u32 console = OS_GetRunningConsoleType();
RunningConsole running = UNKNOWN;
// SystemUpdater̓fƒoƒbƒO•s‰ÂÅ<E2809A>ì<EFBFBD>¬³êé½ßOS_CONSOLE_TWLªŽæ“¾³êé
// <20>Ô” ÉƒJ<C692>[ƒhð}µÄSystemUpdaterðŽÀ<C5BD>sµ½<E2809A>ê<EFBFBD>à“¯—l<E28094>iAµOS_CONSOLE_TWLTYPE_RETAILÉÍÈçÈ¢<E2809A>j
// ƒfƒoƒbƒK©Ç¤©Ì”»è̓<C38D>ƒƒŠƒTƒCƒYƒ`ƒFƒbƒNÉæè<E2809A>s¤
// ”O̽ßOS_CONSOLE_TWLTYPE_RETAILÅÈ¢±ÆàŠm”F·é
if ((console & OS_CONSOLE_SIZE_MASK) == OS_CONSOLE_SIZE_32MB)
{
if ((console & OS_CONSOLE_TWLTYPE_MASK) != OS_CONSOLE_TWLTYPE_RETAIL)
{
IsToolType type;
kamiGetIsToolType(&type);
if (type == IS_TOOL_TYPE_DEBUGGER)
{
running = IS_TWL_DEBUGGER;
}
else if (type == IS_TOOL_TYPE_ERROR) // TSƒ{<7B>[ƒhƒvƒ‰ƒX + ŒŽd—lƒfƒoƒbƒK
{
running = IS_TWL_DEBUGGER;
}
else if (type == IS_TOOL_TYPE_CAPTURE)
{
running = IS_TWL_CAPTURE;
}
}
}
else if ((console & OS_CONSOLE_MASK) == OS_CONSOLE_TWL)
{
IsToolType type;
kamiGetIsToolType(&type);
if (type == IS_TOOL_TYPE_CAPTURE)
{
running = IS_TWL_CAPTURE;
}
else
{
running = TWL;
}
}
return running;
}
/*---------------------------------------------------------------------------*
Name: GetConsole
Description:
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
RunningConsole GetConsole(void)
{
return sRunning;
}