mirror of
https://github.com/libAthena/athena.git
synced 2025-12-10 14:07:44 +00:00
* Start to fill in save related classes
* Fix silly bug in WiiSave * Fix typos in Utilitiy.*
This commit is contained in:
@@ -22,4 +22,36 @@ MCFile::MCFile()
|
||||
{
|
||||
}
|
||||
|
||||
// TODO: Rewrite this to be more optimized, the current solution takes quite a few cycles
|
||||
atUint8* reverse(atUint8* data, atUint32 length)
|
||||
{
|
||||
atUint32 a = 0;
|
||||
atUint32 swap;
|
||||
|
||||
for (;a<--length; a++)
|
||||
{
|
||||
swap = data[a];
|
||||
data[a] = data[length];
|
||||
data[length] = swap;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
atUint8* MCFile::unscramble(atUint8* data, atUint32 length)
|
||||
{
|
||||
if (!data)
|
||||
return nullptr;
|
||||
|
||||
for (atUint32 i = 0; i < length; i += 8)
|
||||
{
|
||||
atUint32 block1 = *(atUint32*)reverse((data + i), 4);
|
||||
atUint32 block2 = *(atUint32*)reverse((data + i + 4), 4);
|
||||
*(atUint32*)(data + i) = block2;
|
||||
*(atUint32*)(data + i + 4) = block1;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
} // zelda
|
||||
|
||||
Reference in New Issue
Block a user