ctr_Repair/trunk/ConsoleDataMigration/common/DrawSystemState.cpp
N2614 c47f5a49d4 ファームバージョンに変わりCUP、NUPバージョンを表示するように
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@26 385bec56-5757-e545-9c3a-d8741f4650f1
2011-02-07 09:35:21 +00:00

130 lines
4.8 KiB
C++

/*---------------------------------------------------------------------------*
Project: Horizon
File: DrawSystemState.cpp
Copyright 2009 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.
$Rev$
*---------------------------------------------------------------------------*/
#include "DrawSystemState.h"
const u16 PROGRESS_MAX_LINES = 129;
namespace common
{
u32 GetRenderTarget(u32 target, bool flip)
{
if(flip)
{
if(target == NN_GX_DISPLAY0)
{
return NN_GX_DISPLAY1;
}
else
{
return NN_GX_DISPLAY0;
}
}
else
{
return target;
}
}
void DrawSystemState
(
const char* toolName,
demo::RenderSystemDrawing& renderSystem,
nn::util::FloatColor titleColor,
bool flip,
std::string& adapterState,
const char* toolVersion,
common::VerDef* mVerData,
u8 batteryRemain,
bit32 deviceId,
u64 friendCode,
u32 progress,
bool isBackupFailed,
bool isBackupSucceeded,
char8* macAddress,
::std::vector<std::string>& operationMessage,
nn::cfg::CTR::CfgRegionCode region,
const nn::os::ReadOnlySharedInfo& rosi,
u8* s_SerialNo
)
{
// デフォルトで上画面に描画するもの
renderSystem.SetRenderTarget(GetRenderTarget(NN_GX_DISPLAY0, flip));
if (isBackupSucceeded)
{
renderSystem.SetClearColor(GetRenderTarget(NN_GX_DISPLAY0, flip), SUCCESS_COLOR);
}
if (isBackupFailed)
{
renderSystem.SetClearColor(GetRenderTarget(NN_GX_DISPLAY0, flip), FAIL_COLOR);
}
renderSystem.Clear();
renderSystem.SetColor(1.f, 1.f, 1.f);
u32 line = 0;
size_t fontSize = 8;
size_t spaceSize = fontSize + 2;
renderSystem.SetFontSize(fontSize);
renderSystem.DrawText(0, line++ * spaceSize, "%s %s Rev.%s", toolName, __DATE__, toolVersion);
renderSystem.SetColor(titleColor.r, titleColor.g, titleColor.b);
renderSystem.FillRectangle(0, (line - 1) * spaceSize, 400, spaceSize);
renderSystem.SetColor(1.f, 1.f, 1.f);
renderSystem.DrawText(0, line++ * spaceSize, "");
fontSize += 2;
spaceSize = fontSize + 2;
renderSystem.SetFontSize(fontSize);
renderSystem.DrawText(0, line++ * spaceSize, "System Ver. %d.%d.%d-%d", mVerData->cup.majorVersion, mVerData->cup.minorVersion, mVerData->cup.microVersion,
mVerData->nup.majorVersion);
renderSystem.DrawText(0, line++ * spaceSize, "System Region %s", nn::cfg::CTR::GetRegionCodeA3(region));
renderSystem.DrawText(0, line++ * spaceSize, "Serial No. %s", s_SerialNo);
renderSystem.DrawText(0, line++ * spaceSize, "Device ID %X", deviceId);
renderSystem.DrawText(0, line++ * spaceSize, "MAC Address %s", macAddress);
renderSystem.DrawText(0, line++ * spaceSize, "Friend Code %04u-%04u-%04u", static_cast<u32> (friendCode
/ 100000000ULL % 10000ULL), static_cast<u32> (friendCode / 10000ULL % 10000ULL),
static_cast<u32> (friendCode % 10000ULL));
renderSystem.DrawText(0, line++ * spaceSize, "Battery %d%%", batteryRemain);
renderSystem.DrawText(0, line++ * spaceSize, "AC Adaper %s", adapterState.c_str());
renderSystem.DrawText(0, line++ * spaceSize, "Progress %02d%%", progress);
renderSystem.SetColor(0.f, 0.2f, 0.f);
renderSystem.DrawLine(19 * fontSize, (line - 1) * spaceSize, 19 * fontSize + PROGRESS_MAX_LINES, (line - 1)
* spaceSize);
renderSystem.DrawLine(19 * fontSize, (line - 1) * spaceSize, 19 * fontSize, (line) * spaceSize);
renderSystem.DrawLine(19 * fontSize, (line) * spaceSize, 19 * fontSize + PROGRESS_MAX_LINES, (line) * spaceSize);
renderSystem.DrawLine(19 * fontSize + PROGRESS_MAX_LINES, (line - 1) * spaceSize, 19 * fontSize
+ PROGRESS_MAX_LINES, (line) * spaceSize + 1);
renderSystem.SetColor(0.f, 0.5f, 0.f);
renderSystem.FillRectangle(19 * fontSize, (line - 1) * spaceSize, progress * PROGRESS_MAX_LINES / 100 + 1,
spaceSize);
renderSystem.SetColor(1.f, 1.f, 1.f);
renderSystem.DrawText(0, line++ * spaceSize, "");
::std::vector<std::string>::iterator it;
for (it = operationMessage.begin(); it != operationMessage.end(); it++)
{
renderSystem.DrawText(0, line++ * spaceSize, "%s", it->c_str());
}
fontSize -= 2;
renderSystem.SetFontSize(fontSize);
}
}