mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-26 02:54:17 +01:00
Fix inconsistency with int types
This commit is contained in:
parent
eb1983daa6
commit
a115921b43
@ -71,9 +71,9 @@ namespace iosu
|
|||||||
return CCR_NFC_ERROR;
|
return CCR_NFC_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
sint32 CCRNFCAESCTRCrypt(const uint8* key, const void* ivNonce, const void* inData, uint32_t inSize, void* outData, uint32_t outSize)
|
sint32 CCRNFCAESCTRCrypt(const uint8* key, const void* ivNonce, const void* inData, uint32 inSize, void* outData, uint32 outSize)
|
||||||
{
|
{
|
||||||
uint8_t tmpIv[0x10];
|
uint8 tmpIv[0x10];
|
||||||
memcpy(tmpIv, ivNonce, sizeof(tmpIv));
|
memcpy(tmpIv, ivNonce, sizeof(tmpIv));
|
||||||
|
|
||||||
memcpy(outData, inData, inSize);
|
memcpy(outData, inData, inSize);
|
||||||
@ -81,7 +81,7 @@ namespace iosu
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sint32 __CCRNFCGenerateKey(const uint8* hmacKey, uint32 hmacKeySize, const uint8* name, uint32_t nameSize, const uint8* inData, uint32_t inSize, uint8* outData, uint32_t outSize)
|
sint32 __CCRNFCGenerateKey(const uint8* hmacKey, uint32 hmacKeySize, const uint8* name, uint32 nameSize, const uint8* inData, uint32 inSize, uint8* outData, uint32 outSize)
|
||||||
{
|
{
|
||||||
if (nameSize != 0xe || outSize != 0x40)
|
if (nameSize != 0xe || outSize != 0x40)
|
||||||
{
|
{
|
||||||
@ -89,13 +89,13 @@ namespace iosu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a buffer containing 2 counter bytes, the key name, and the key data
|
// Create a buffer containing 2 counter bytes, the key name, and the key data
|
||||||
uint8_t buffer[0x50];
|
uint8 buffer[0x50];
|
||||||
buffer[0] = 0;
|
buffer[0] = 0;
|
||||||
buffer[1] = 0;
|
buffer[1] = 0;
|
||||||
memcpy(buffer + 2, name, nameSize);
|
memcpy(buffer + 2, name, nameSize);
|
||||||
memcpy(buffer + nameSize + 2, inData, inSize);
|
memcpy(buffer + nameSize + 2, inData, inSize);
|
||||||
|
|
||||||
uint16_t counter = 0;
|
uint16 counter = 0;
|
||||||
while (outSize > 0)
|
while (outSize > 0)
|
||||||
{
|
{
|
||||||
// Set counter bytes and increment counter
|
// Set counter bytes and increment counter
|
||||||
@ -118,9 +118,9 @@ namespace iosu
|
|||||||
|
|
||||||
sint32 __CCRNFCGenerateInternalKeys(const CCRNFCCryptData* in, const uint8* keyGenSalt)
|
sint32 __CCRNFCGenerateInternalKeys(const CCRNFCCryptData* in, const uint8* keyGenSalt)
|
||||||
{
|
{
|
||||||
uint8_t lockedSecretBuffer[0x40] = { 0 };
|
uint8 lockedSecretBuffer[0x40] = { 0 };
|
||||||
uint8_t unfixedInfosBuffer[0x40] = { 0 };
|
uint8 unfixedInfosBuffer[0x40] = { 0 };
|
||||||
uint8_t outBuffer[0x40] = { 0 };
|
uint8 outBuffer[0x40] = { 0 };
|
||||||
|
|
||||||
// Fill the locked secret buffer
|
// Fill the locked secret buffer
|
||||||
memcpy(lockedSecretBuffer, sLockedSecretMagicBytes, sizeof(sLockedSecretMagicBytes));
|
memcpy(lockedSecretBuffer, sLockedSecretMagicBytes, sizeof(sLockedSecretMagicBytes));
|
||||||
@ -193,7 +193,7 @@ namespace iosu
|
|||||||
sint32 __CCRNFCCryptData(const CCRNFCCryptData* in, CCRNFCCryptData* out, bool decrypt)
|
sint32 __CCRNFCCryptData(const CCRNFCCryptData* in, CCRNFCCryptData* out, bool decrypt)
|
||||||
{
|
{
|
||||||
// Decrypt key generation salt
|
// Decrypt key generation salt
|
||||||
uint8_t keyGenSalt[0x20];
|
uint8 keyGenSalt[0x20];
|
||||||
sint32 res = CCRNFCAESCTRCrypt(sNfcKey, sNfcKeyIV, in->data + in->keyGenSaltOffset, 0x20, keyGenSalt, sizeof(keyGenSalt));
|
sint32 res = CCRNFCAESCTRCrypt(sNfcKey, sNfcKeyIV, in->data + in->keyGenSaltOffset, 0x20, keyGenSalt, sizeof(keyGenSalt));
|
||||||
if (res != 0)
|
if (res != 0)
|
||||||
{
|
{
|
||||||
@ -227,7 +227,7 @@ namespace iosu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify HMACs
|
// Verify HMACs
|
||||||
uint8_t hmacBuffer[0x20];
|
uint8 hmacBuffer[0x20];
|
||||||
uint32 hmacLen = sizeof(hmacBuffer);
|
uint32 hmacLen = sizeof(hmacBuffer);
|
||||||
|
|
||||||
if (!HMAC(EVP_sha256(), sLockedSecretInternalHmacKey, sizeof(sLockedSecretInternalHmacKey), out->data + in->lockedSecretHmacOffset + 0x20, (in->dataSize - in->lockedSecretHmacOffset) - 0x20, hmacBuffer, &hmacLen))
|
if (!HMAC(EVP_sha256(), sLockedSecretInternalHmacKey, sizeof(sLockedSecretInternalHmacKey), out->data + in->lockedSecretHmacOffset + 0x20, (in->dataSize - in->lockedSecretHmacOffset) - 0x20, hmacBuffer, &hmacLen))
|
||||||
@ -258,7 +258,7 @@ namespace iosu
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint8_t hmacBuffer[0x20];
|
uint8 hmacBuffer[0x20];
|
||||||
uint32 hmacLen = sizeof(hmacBuffer);
|
uint32 hmacLen = sizeof(hmacBuffer);
|
||||||
|
|
||||||
if (!HMAC(EVP_sha256(), sLockedSecretInternalHmacKey, sizeof(sLockedSecretInternalHmacKey), out->data + in->lockedSecretHmacOffset + 0x20, (in->dataSize - in->lockedSecretHmacOffset) - 0x20, hmacBuffer, &hmacLen))
|
if (!HMAC(EVP_sha256(), sLockedSecretInternalHmacKey, sizeof(sLockedSecretInternalHmacKey), out->data + in->lockedSecretHmacOffset + 0x20, (in->dataSize - in->lockedSecretHmacOffset) - 0x20, hmacBuffer, &hmacLen))
|
||||||
|
@ -25,7 +25,7 @@ std::vector<TLV> TLV::FromBytes(const std::span<std::byte>& data)
|
|||||||
while (stream.GetRemaining() > 0 && !hasTerminator)
|
while (stream.GetRemaining() > 0 && !hasTerminator)
|
||||||
{
|
{
|
||||||
// Read the tag
|
// Read the tag
|
||||||
uint8_t byte;
|
uint8 byte;
|
||||||
stream >> byte;
|
stream >> byte;
|
||||||
Tag tag = static_cast<Tag>(byte);
|
Tag tag = static_cast<Tag>(byte);
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ std::vector<TLV> TLV::FromBytes(const std::span<std::byte>& data)
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
// Read the length
|
// Read the length
|
||||||
uint16_t length;
|
uint16 length;
|
||||||
stream >> byte;
|
stream >> byte;
|
||||||
length = byte;
|
length = byte;
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ std::vector<std::byte> TLV::ToBytes() const
|
|||||||
VectorStream stream(bytes, std::endian::big);
|
VectorStream stream(bytes, std::endian::big);
|
||||||
|
|
||||||
// Write tag
|
// Write tag
|
||||||
stream << std::uint8_t(mTag);
|
stream << uint8(mTag);
|
||||||
|
|
||||||
switch (mTag)
|
switch (mTag)
|
||||||
{
|
{
|
||||||
@ -99,12 +99,12 @@ std::vector<std::byte> TLV::ToBytes() const
|
|||||||
// Write length (decide if as a 8-bit or 16-bit value)
|
// Write length (decide if as a 8-bit or 16-bit value)
|
||||||
if (mValue.size() >= 0xff)
|
if (mValue.size() >= 0xff)
|
||||||
{
|
{
|
||||||
stream << std::uint8_t(0xff);
|
stream << uint8(0xff);
|
||||||
stream << std::uint16_t(mValue.size());
|
stream << uint16(mValue.size());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stream << std::uint8_t(mValue.size());
|
stream << uint8(mValue.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write value
|
// Write value
|
||||||
|
@ -9,17 +9,17 @@ namespace
|
|||||||
constexpr std::size_t kTagSize = 512u;
|
constexpr std::size_t kTagSize = 512u;
|
||||||
constexpr std::size_t kMaxBlockCount = kTagSize / sizeof(TagV0::Block);
|
constexpr std::size_t kMaxBlockCount = kTagSize / sizeof(TagV0::Block);
|
||||||
|
|
||||||
constexpr std::uint8_t kLockbyteBlock0 = 0xe;
|
constexpr uint8 kLockbyteBlock0 = 0xe;
|
||||||
constexpr std::uint8_t kLockbytesStart0 = 0x0;
|
constexpr uint8 kLockbytesStart0 = 0x0;
|
||||||
constexpr std::uint8_t kLockbytesEnd0 = 0x2;
|
constexpr uint8 kLockbytesEnd0 = 0x2;
|
||||||
constexpr std::uint8_t kLockbyteBlock1 = 0xf;
|
constexpr uint8 kLockbyteBlock1 = 0xf;
|
||||||
constexpr std::uint8_t kLockbytesStart1 = 0x2;
|
constexpr uint8 kLockbytesStart1 = 0x2;
|
||||||
constexpr std::uint8_t kLockbytesEnd1 = 0x8;
|
constexpr uint8 kLockbytesEnd1 = 0x8;
|
||||||
|
|
||||||
constexpr std::uint8_t kNDEFMagicNumber = 0xe1;
|
constexpr uint8 kNDEFMagicNumber = 0xe1;
|
||||||
|
|
||||||
// These blocks are not part of the locked area
|
// These blocks are not part of the locked area
|
||||||
constexpr bool IsBlockLockedOrReserved(std::uint8_t blockIdx)
|
constexpr bool IsBlockLockedOrReserved(uint8 blockIdx)
|
||||||
{
|
{
|
||||||
// Block 0 is the UID
|
// Block 0 is the UID
|
||||||
if (blockIdx == 0x0)
|
if (blockIdx == 0x0)
|
||||||
@ -153,7 +153,7 @@ std::vector<std::byte> TagV0::ToBytes() const
|
|||||||
|
|
||||||
// The rest will be the data area
|
// The rest will be the data area
|
||||||
auto dataIterator = dataArea.begin();
|
auto dataIterator = dataArea.begin();
|
||||||
for (std::uint8_t currentBlock = 0; currentBlock < kMaxBlockCount; currentBlock++)
|
for (uint8 currentBlock = 0; currentBlock < kMaxBlockCount; currentBlock++)
|
||||||
{
|
{
|
||||||
// All blocks which aren't locked make up the dataArea
|
// All blocks which aren't locked make up the dataArea
|
||||||
if (!IsBlockLocked(currentBlock))
|
if (!IsBlockLocked(currentBlock))
|
||||||
@ -189,15 +189,15 @@ void TagV0::SetNDEFData(const std::span<const std::byte>& data)
|
|||||||
|
|
||||||
bool TagV0::ParseLockedArea(const std::span<const std::byte>& data)
|
bool TagV0::ParseLockedArea(const std::span<const std::byte>& data)
|
||||||
{
|
{
|
||||||
std::uint8_t currentBlock = 0;
|
uint8 currentBlock = 0;
|
||||||
|
|
||||||
// Start by parsing the first set of lock bytes
|
// Start by parsing the first set of lock bytes
|
||||||
for (std::uint8_t i = kLockbytesStart0; i < kLockbytesEnd0; i++)
|
for (uint8 i = kLockbytesStart0; i < kLockbytesEnd0; i++)
|
||||||
{
|
{
|
||||||
std::uint8_t lockByte = std::uint8_t(data[kLockbyteBlock0 * sizeof(Block) + i]);
|
uint8 lockByte = uint8(data[kLockbyteBlock0 * sizeof(Block) + i]);
|
||||||
|
|
||||||
// Iterate over the individual bits in the lock byte
|
// Iterate over the individual bits in the lock byte
|
||||||
for (std::uint8_t j = 0; j < 8; j++)
|
for (uint8 j = 0; j < 8; j++)
|
||||||
{
|
{
|
||||||
// Is block locked?
|
// Is block locked?
|
||||||
if (lockByte & (1u << j))
|
if (lockByte & (1u << j))
|
||||||
@ -221,11 +221,11 @@ bool TagV0::ParseLockedArea(const std::span<const std::byte>& data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse the second set of lock bytes
|
// Parse the second set of lock bytes
|
||||||
for (std::uint8_t i = kLockbytesStart1; i < kLockbytesEnd1; i++) {
|
for (uint8 i = kLockbytesStart1; i < kLockbytesEnd1; i++) {
|
||||||
std::uint8_t lockByte = std::uint8_t(data[kLockbyteBlock1 * sizeof(Block) + i]);
|
uint8 lockByte = uint8(data[kLockbyteBlock1 * sizeof(Block) + i]);
|
||||||
|
|
||||||
// Iterate over the individual bits in the lock byte
|
// Iterate over the individual bits in the lock byte
|
||||||
for (std::uint8_t j = 0; j < 8; j++)
|
for (uint8 j = 0; j < 8; j++)
|
||||||
{
|
{
|
||||||
// Is block locked?
|
// Is block locked?
|
||||||
if (lockByte & (1u << j))
|
if (lockByte & (1u << j))
|
||||||
@ -251,14 +251,14 @@ bool TagV0::ParseLockedArea(const std::span<const std::byte>& data)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TagV0::IsBlockLocked(std::uint8_t blockIdx) const
|
bool TagV0::IsBlockLocked(uint8 blockIdx) const
|
||||||
{
|
{
|
||||||
return mLockedBlocks.contains(blockIdx) || IsBlockLockedOrReserved(blockIdx);
|
return mLockedBlocks.contains(blockIdx) || IsBlockLockedOrReserved(blockIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TagV0::ParseDataArea(const std::span<const std::byte>& data, std::vector<std::byte>& dataArea)
|
bool TagV0::ParseDataArea(const std::span<const std::byte>& data, std::vector<std::byte>& dataArea)
|
||||||
{
|
{
|
||||||
for (std::uint8_t currentBlock = 0; currentBlock < kMaxBlockCount; currentBlock++)
|
for (uint8 currentBlock = 0; currentBlock < kMaxBlockCount; currentBlock++)
|
||||||
{
|
{
|
||||||
// All blocks which aren't locked make up the dataArea
|
// All blocks which aren't locked make up the dataArea
|
||||||
if (!IsBlockLocked(currentBlock))
|
if (!IsBlockLocked(currentBlock))
|
||||||
@ -274,7 +274,7 @@ bool TagV0::ParseDataArea(const std::span<const std::byte>& data, std::vector<st
|
|||||||
bool TagV0::ValidateCapabilityContainer()
|
bool TagV0::ValidateCapabilityContainer()
|
||||||
{
|
{
|
||||||
// NDEF Magic Number
|
// NDEF Magic Number
|
||||||
std::uint8_t nmn = mCapabilityContainer[0];
|
uint8 nmn = mCapabilityContainer[0];
|
||||||
if (nmn != kNDEFMagicNumber)
|
if (nmn != kNDEFMagicNumber)
|
||||||
{
|
{
|
||||||
cemuLog_log(LogType::Force, "Error: CC: Invalid NDEF Magic Number");
|
cemuLog_log(LogType::Force, "Error: CC: Invalid NDEF Magic Number");
|
||||||
@ -282,7 +282,7 @@ bool TagV0::ValidateCapabilityContainer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Version Number
|
// Version Number
|
||||||
std::uint8_t vno = mCapabilityContainer[1];
|
uint8 vno = mCapabilityContainer[1];
|
||||||
if (vno >> 4 != 1)
|
if (vno >> 4 != 1)
|
||||||
{
|
{
|
||||||
cemuLog_log(LogType::Force, "Error: CC: Invalid Version Number");
|
cemuLog_log(LogType::Force, "Error: CC: Invalid Version Number");
|
||||||
@ -290,7 +290,7 @@ bool TagV0::ValidateCapabilityContainer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tag memory size
|
// Tag memory size
|
||||||
std::uint8_t tms = mCapabilityContainer[2];
|
uint8 tms = mCapabilityContainer[2];
|
||||||
if (8u * (tms + 1) < kTagSize)
|
if (8u * (tms + 1) < kTagSize)
|
||||||
{
|
{
|
||||||
cemuLog_log(LogType::Force, "Error: CC: Incomplete tag memory size");
|
cemuLog_log(LogType::Force, "Error: CC: Incomplete tag memory size");
|
||||||
|
@ -26,13 +26,13 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool ParseLockedArea(const std::span<const std::byte>& data);
|
bool ParseLockedArea(const std::span<const std::byte>& data);
|
||||||
bool IsBlockLocked(std::uint8_t blockIdx) const;
|
bool IsBlockLocked(uint8 blockIdx) const;
|
||||||
bool ParseDataArea(const std::span<const std::byte>& data, std::vector<std::byte>& dataArea);
|
bool ParseDataArea(const std::span<const std::byte>& data, std::vector<std::byte>& dataArea);
|
||||||
bool ValidateCapabilityContainer();
|
bool ValidateCapabilityContainer();
|
||||||
|
|
||||||
std::map<std::uint8_t, Block> mLockedOrReservedBlocks;
|
std::map<uint8, Block> mLockedOrReservedBlocks;
|
||||||
std::map<std::uint8_t, Block> mLockedBlocks;
|
std::map<uint8, Block> mLockedBlocks;
|
||||||
std::array<std::uint8_t, 0x4> mCapabilityContainer;
|
std::array<uint8, 0x4> mCapabilityContainer;
|
||||||
std::vector<TLV> mTLVs;
|
std::vector<TLV> mTLVs;
|
||||||
std::size_t mNdefTlvIdx;
|
std::size_t mNdefTlvIdx;
|
||||||
std::vector<std::byte> mLockedArea;
|
std::vector<std::byte> mLockedArea;
|
||||||
|
@ -19,20 +19,20 @@ namespace ndef
|
|||||||
Record rec;
|
Record rec;
|
||||||
|
|
||||||
// Read record header
|
// Read record header
|
||||||
uint8_t recHdr;
|
uint8 recHdr;
|
||||||
stream >> recHdr;
|
stream >> recHdr;
|
||||||
rec.mFlags = recHdr & ~NDEF_TNF_MASK;
|
rec.mFlags = recHdr & ~NDEF_TNF_MASK;
|
||||||
rec.mTNF = static_cast<TypeNameFormat>(recHdr & NDEF_TNF_MASK);
|
rec.mTNF = static_cast<TypeNameFormat>(recHdr & NDEF_TNF_MASK);
|
||||||
|
|
||||||
// Type length
|
// Type length
|
||||||
uint8_t typeLen;
|
uint8 typeLen;
|
||||||
stream >> typeLen;
|
stream >> typeLen;
|
||||||
|
|
||||||
// Payload length;
|
// Payload length;
|
||||||
uint32_t payloadLen;
|
uint32 payloadLen;
|
||||||
if (recHdr & NDEF_SR)
|
if (recHdr & NDEF_SR)
|
||||||
{
|
{
|
||||||
uint8_t len;
|
uint8 len;
|
||||||
stream >> len;
|
stream >> len;
|
||||||
payloadLen = len;
|
payloadLen = len;
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ namespace ndef
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ID length
|
// ID length
|
||||||
uint8_t idLen = 0;
|
uint8 idLen = 0;
|
||||||
if (recHdr & NDEF_IL)
|
if (recHdr & NDEF_IL)
|
||||||
{
|
{
|
||||||
stream >> idLen;
|
stream >> idLen;
|
||||||
@ -81,35 +81,35 @@ namespace ndef
|
|||||||
return rec;
|
return rec;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::byte> Record::ToBytes(uint8_t flags) const
|
std::vector<std::byte> Record::ToBytes(uint8 flags) const
|
||||||
{
|
{
|
||||||
std::vector<std::byte> bytes;
|
std::vector<std::byte> bytes;
|
||||||
VectorStream stream(bytes, std::endian::big);
|
VectorStream stream(bytes, std::endian::big);
|
||||||
|
|
||||||
// Combine flags (clear message begin and end flags)
|
// Combine flags (clear message begin and end flags)
|
||||||
std::uint8_t finalFlags = mFlags & ~(NDEF_MB | NDEF_ME);
|
uint8 finalFlags = mFlags & ~(NDEF_MB | NDEF_ME);
|
||||||
finalFlags |= flags;
|
finalFlags |= flags;
|
||||||
|
|
||||||
// Write flags + tnf
|
// Write flags + tnf
|
||||||
stream << std::uint8_t(finalFlags | std::uint8_t(mTNF));
|
stream << uint8(finalFlags | uint8(mTNF));
|
||||||
|
|
||||||
// Type length
|
// Type length
|
||||||
stream << std::uint8_t(mType.size());
|
stream << uint8(mType.size());
|
||||||
|
|
||||||
// Payload length
|
// Payload length
|
||||||
if (IsShort())
|
if (IsShort())
|
||||||
{
|
{
|
||||||
stream << std::uint8_t(mPayload.size());
|
stream << uint8(mPayload.size());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stream << std::uint32_t(mPayload.size());
|
stream << uint32(mPayload.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID length
|
// ID length
|
||||||
if (mFlags & NDEF_IL)
|
if (mFlags & NDEF_IL)
|
||||||
{
|
{
|
||||||
stream << std::uint8_t(mID.size());
|
stream << uint8(mID.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
@ -249,7 +249,7 @@ namespace ndef
|
|||||||
|
|
||||||
for (std::size_t i = 0; i < mRecords.size(); i++)
|
for (std::size_t i = 0; i < mRecords.size(); i++)
|
||||||
{
|
{
|
||||||
std::uint8_t flags = 0;
|
uint8 flags = 0;
|
||||||
|
|
||||||
// Add message begin flag to first record
|
// Add message begin flag to first record
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
|
@ -39,7 +39,7 @@ namespace ndef
|
|||||||
virtual ~Record();
|
virtual ~Record();
|
||||||
|
|
||||||
static std::optional<Record> FromStream(Stream& stream);
|
static std::optional<Record> FromStream(Stream& stream);
|
||||||
std::vector<std::byte> ToBytes(uint8_t flags = 0) const;
|
std::vector<std::byte> ToBytes(uint8 flags = 0) const;
|
||||||
|
|
||||||
TypeNameFormat GetTNF() const;
|
TypeNameFormat GetTNF() const;
|
||||||
const std::vector<std::byte>& GetID() const;
|
const std::vector<std::byte>& GetID() const;
|
||||||
@ -55,7 +55,7 @@ namespace ndef
|
|||||||
bool IsShort() const;
|
bool IsShort() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t mFlags;
|
uint8 mFlags;
|
||||||
TypeNameFormat mTNF;
|
TypeNameFormat mTNF;
|
||||||
std::vector<std::byte> mID;
|
std::vector<std::byte> mID;
|
||||||
std::vector<std::byte> mType;
|
std::vector<std::byte> mType;
|
||||||
|
@ -149,9 +149,9 @@ namespace nfc
|
|||||||
StackAllocator<NFCUid> uid;
|
StackAllocator<NFCUid> uid;
|
||||||
bool readOnly = false;
|
bool readOnly = false;
|
||||||
uint32 dataSize = 0;
|
uint32 dataSize = 0;
|
||||||
StackAllocator<uint8_t, 0x200> data;
|
StackAllocator<uint8, 0x200> data;
|
||||||
uint32 lockedDataSize = 0;
|
uint32 lockedDataSize = 0;
|
||||||
StackAllocator<uint8_t, 0x200> lockedData;
|
StackAllocator<uint8, 0x200> lockedData;
|
||||||
|
|
||||||
if (ctx->tag)
|
if (ctx->tag)
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@ std::endian Stream::GetEndianness() const
|
|||||||
|
|
||||||
Stream& Stream::operator>>(bool& val)
|
Stream& Stream::operator>>(bool& val)
|
||||||
{
|
{
|
||||||
std::uint8_t i;
|
uint8 i;
|
||||||
*this >> i;
|
*this >> i;
|
||||||
val = !!i;
|
val = !!i;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ Stream& Stream::operator>>(bool& val)
|
|||||||
|
|
||||||
Stream& Stream::operator>>(float& val)
|
Stream& Stream::operator>>(float& val)
|
||||||
{
|
{
|
||||||
std::uint32_t i;
|
uint32 i;
|
||||||
*this >> i;
|
*this >> i;
|
||||||
val = std::bit_cast<float>(i);
|
val = std::bit_cast<float>(i);
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ Stream& Stream::operator>>(float& val)
|
|||||||
|
|
||||||
Stream& Stream::operator>>(double& val)
|
Stream& Stream::operator>>(double& val)
|
||||||
{
|
{
|
||||||
std::uint64_t i;
|
uint64 i;
|
||||||
*this >> i;
|
*this >> i;
|
||||||
val = std::bit_cast<double>(i);
|
val = std::bit_cast<double>(i);
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ Stream& Stream::operator>>(double& val)
|
|||||||
|
|
||||||
Stream& Stream::operator<<(bool val)
|
Stream& Stream::operator<<(bool val)
|
||||||
{
|
{
|
||||||
std::uint8_t i = val;
|
uint8 i = val;
|
||||||
*this >> i;
|
*this >> i;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
@ -63,7 +63,7 @@ Stream& Stream::operator<<(bool val)
|
|||||||
|
|
||||||
Stream& Stream::operator<<(float val)
|
Stream& Stream::operator<<(float val)
|
||||||
{
|
{
|
||||||
std::uint32_t i = std::bit_cast<std::uint32_t>(val);
|
uint32 i = std::bit_cast<uint32>(val);
|
||||||
*this >> i;
|
*this >> i;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
@ -71,7 +71,7 @@ Stream& Stream::operator<<(float val)
|
|||||||
|
|
||||||
Stream& Stream::operator<<(double val)
|
Stream& Stream::operator<<(double val)
|
||||||
{
|
{
|
||||||
std::uint64_t i = std::bit_cast<std::uint64_t>(val);
|
uint64 i = std::bit_cast<uint64>(val);
|
||||||
*this >> i;
|
*this >> i;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
Loading…
Reference in New Issue
Block a user