Files
wiicompiled/runtime/include/wiimote_ext_crypto.h
T
patchzyy dfe32f61e1 Real Wii Remote support over Bluetooth (#323)
* pass real wii remotes through emulated bluetooth

* build bluetooth tests on macos ci

* address review comments

* cancel replaced bluetooth reads
2026-10-20 12:21:46 +02:00

25 lines
739 B
C++

#pragma once
// The Wii's extension controller encryption: the game writes a random key to
// the extension, which then XORs and offsets every byte it reports.
#include <array>
#include <cstddef>
#include <cstdint>
#include <optional>
namespace Wiimote::ExtCrypto {
struct Tables {
std::array<uint8_t, 8> ft{};
std::array<uint8_t, 8> sb{};
void Encrypt(uint8_t* data, uint32_t address, size_t length) const;
void Decrypt(uint8_t* data, uint32_t address, size_t length) const;
};
// Tables for the key the game wrote to registers 0x40..0x4F, or nullopt when it
// does not come from the first-party key schedule.
std::optional<Tables> FromKey(const std::array<uint8_t, 16>& keyData);
} // namespace Wiimote::ExtCrypto