diff options
author | Narr the Reg <juangerman-13@hotmail.com> | 2023-04-20 03:01:23 +0200 |
---|---|---|
committer | german77 <juangerman-13@hotmail.com> | 2023-05-06 06:02:59 +0200 |
commit | 94151097b9abadf35c55ea06a31925c9848f4c62 (patch) | |
tree | 28a00c878f90492ffd2bb95521c2cc3990cc4323 /src/core/hle/service/nfc/mifare_types.h | |
parent | core: service: Add FunctionInfoTyped to allow expanding existing interfaces (diff) | |
download | yuzu-94151097b9abadf35c55ea06a31925c9848f4c62.tar yuzu-94151097b9abadf35c55ea06a31925c9848f4c62.tar.gz yuzu-94151097b9abadf35c55ea06a31925c9848f4c62.tar.bz2 yuzu-94151097b9abadf35c55ea06a31925c9848f4c62.tar.lz yuzu-94151097b9abadf35c55ea06a31925c9848f4c62.tar.xz yuzu-94151097b9abadf35c55ea06a31925c9848f4c62.tar.zst yuzu-94151097b9abadf35c55ea06a31925c9848f4c62.zip |
Diffstat (limited to 'src/core/hle/service/nfc/mifare_types.h')
-rw-r--r-- | src/core/hle/service/nfc/mifare_types.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/core/hle/service/nfc/mifare_types.h b/src/core/hle/service/nfc/mifare_types.h new file mode 100644 index 000000000..75b59f021 --- /dev/null +++ b/src/core/hle/service/nfc/mifare_types.h @@ -0,0 +1,63 @@ +// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include <array> + +#include "common/common_funcs.h" +#include "common/common_types.h" + +namespace Service::NFC { + +enum class MifareCmd : u8 { + AuthA = 0x60, + AuthB = 0x61, + Read = 0x30, + Write = 0xA0, + Transfer = 0xB0, + Decrement = 0xC0, + Increment = 0xC1, + Store = 0xC2 +}; + +using DataBlock = std::array<u8, 0x10>; +using KeyData = std::array<u8, 0x6>; + +struct SectorKey { + MifareCmd command; + u8 unknown; // Usually 1 + INSERT_PADDING_BYTES(0x6); + KeyData sector_key; + INSERT_PADDING_BYTES(0x2); +}; +static_assert(sizeof(SectorKey) == 0x10, "SectorKey is an invalid size"); + +// This is nn::nfc::MifareReadBlockParameter +struct MifareReadBlockParameter { + u8 sector_number; + INSERT_PADDING_BYTES(0x7); + SectorKey sector_key; +}; +static_assert(sizeof(MifareReadBlockParameter) == 0x18, + "MifareReadBlockParameter is an invalid size"); + +// This is nn::nfc::MifareReadBlockData +struct MifareReadBlockData { + DataBlock data; + u8 sector_number; + INSERT_PADDING_BYTES(0x7); +}; +static_assert(sizeof(MifareReadBlockData) == 0x18, "MifareReadBlockData is an invalid size"); + +// This is nn::nfc::MifareWriteBlockParameter +struct MifareWriteBlockParameter { + DataBlock data; + u8 sector_number; + INSERT_PADDING_BYTES(0x7); + SectorKey sector_key; +}; +static_assert(sizeof(MifareWriteBlockParameter) == 0x28, + "MifareWriteBlockParameter is an invalid size"); + +} // namespace Service::NFC |