mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
QRコードのバージョンを下げて大きいフォントを使うように
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
This commit is contained in:
parent
160e26c6d3
commit
d8a83ee647
@ -16,10 +16,18 @@
|
||||
#include "QrImage.h"
|
||||
#include "HeapManager.h"
|
||||
#include "Util.h"
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include "ResFont.h"
|
||||
|
||||
#include <qre.h>
|
||||
|
||||
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<char*>(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<u8*>(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;
|
||||
/* コンテンツ文字列の情報 */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user