From d8a83ee6472cf8824cce623e45369d1c87980a74 Mon Sep 17 00:00:00 2001 From: N2614 Date: Fri, 16 Mar 2012 07:04:43 +0000 Subject: [PATCH] =?UTF-8?q?QR=E3=82=B3=E3=83=BC=E3=83=89=E3=81=AE=E3=83=90?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=92=E4=B8=8B=E3=81=92?= =?UTF-8?q?=E3=81=A6=E5=A4=A7=E3=81=8D=E3=81=84=E3=83=95=E3=82=A9=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=82=92=E4=BD=BF=E3=81=86=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@669 385bec56-5757-e545-9c3a-d8741f4650f1 --- .../sources/common/QrImage.cpp | 36 ++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/trunk/ConsoleDataMigration/sources/common/QrImage.cpp b/trunk/ConsoleDataMigration/sources/common/QrImage.cpp index 9436f49..c77f99a 100644 --- a/trunk/ConsoleDataMigration/sources/common/QrImage.cpp +++ b/trunk/ConsoleDataMigration/sources/common/QrImage.cpp @@ -16,10 +16,18 @@ #include "QrImage.h" #include "HeapManager.h" #include "Util.h" +#include #include +#include "ResFont.h" #include +namespace +{ +char s_DeviceIdStr[32]; +char s_SerialNumberStr[32]; +} + namespace common { @@ -34,21 +42,39 @@ QrImage::~QrImage() // TODO Auto-generated destructor stub } +void DrawDeviceId() +{ + GetTextWriter()->Printf("DeviceId = %s", s_DeviceIdStr); +} + +void DrawSerialNumber() +{ + GetTextWriter()->Printf("SerialNo. = %s", s_SerialNumberStr); +} + void QrImage::Draw(demo::RenderSystemDrawing& renderSystem, bit64 deviceId, u8* serialNo, bool flip) { char deviceIdStr[32]; nn::nstd::TSNPrintf(deviceIdStr, sizeof(deviceIdStr), "%llu", deviceId); - renderSystem.SetRenderTarget(Util::GetRenderTarget(NN_GX_DISPLAY0, flip)); - renderSystem.Clear(); std::string deviceIdString(deviceIdStr); Util::SplitDeviceidWithSpace(deviceIdString); - renderSystem.DrawText(0, 0, "DeviceId = %s", deviceIdString.c_str()); + std::strlcpy(s_DeviceIdStr, deviceIdString.c_str(), sizeof(s_DeviceIdStr)); + std::strlcpy(s_SerialNumberStr, reinterpret_cast(serialNo), sizeof(s_SerialNumberStr)); + + renderSystem.SetRenderTarget(Util::GetRenderTarget(NN_GX_DISPLAY0, flip)); + renderSystem.Clear(); + GetTextWriter()->SetTextColor(nn::util::Color8(255, 255, 255, 255)); + SetDrawTextHandler(DrawDeviceId); + DrawResFont(Util::GetRenderTarget(NN_GX_DISPLAY0, flip)); DrawStringinQr(renderSystem, reinterpret_cast(deviceIdStr), Util::GetRenderTarget(NN_GX_DISPLAY0, flip)); renderSystem.SwapBuffers(); + renderSystem.SetRenderTarget(Util::GetRenderTarget(NN_GX_DISPLAY1, flip)); renderSystem.Clear(); - renderSystem.DrawText(0, 0, "SerialNo. = %s", serialNo); + GetTextWriter()->SetTextColor(nn::util::Color8(255, 255, 255, 255)); + SetDrawTextHandler(DrawSerialNumber); + DrawResFont(Util::GetRenderTarget(NN_GX_DISPLAY1, flip)); DrawStringinQr(renderSystem, serialNo, Util::GetRenderTarget(NN_GX_DISPLAY1, flip)); renderSystem.SwapBuffers(); } @@ -71,7 +97,7 @@ void QrImage::DrawStringinQr(demo::RenderSystemDrawing& renderSystem, u8* str, u /* 作成するQRコードの情報を設定 */ EncodeData info; // バージョン2で数字34文字OK - info.version = 12; + info.version = 10; /* 誤り訂正レベルH */ info.ecc_level = ECC_LEVEL_H; /* コンテンツ文字列の情報 */