Wiimote: Added decryption function, it could be useful for debugging real Wiimote extensions

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2099 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-02-04 00:06:11 +00:00
parent c10d69fe07
commit ec39c45dd5
8 changed files with 48 additions and 17 deletions

View File

@ -288,10 +288,16 @@ void wiimote_gen_key(wiimote_key *key, u8 *keydata)
// ----------------
void wiimote_encrypt(wiimote_key *key, u8 *data, int addr, u8 len)
{
for(int i = 0; i < len; i++, addr++)
{
//Console::Print("data[%i] from %02x ", i, data[i]);
for(int i = 0; i < len; i++, addr++)
data[i] = (data[i] - key->ft[addr%8]) ^ key->sb[addr%8];
//Console::Print("to %02x\n", data[i]);
}
}
// ===================================================
/* Decrypt data */
// ----------------
void wiimote_decrypt(wiimote_key *key, u8 *data, int addr, u8 len)
{
for(int i = 0; i < len; i++, addr++)
data[i] = (data[i] ^ key->sb[addr%8]) + key->ft[addr%8];
}