![]() |
|
An ignorable improvement for reading Wii ISO file - Printable Version +- Dolphin, the GameCube and Wii emulator - Forums (https://forums.dolphin-emu.org) +-- Forum: Dolphin Emulator Discussion and Support (https://forums.dolphin-emu.org/Forum-dolphin-emulator-discussion-and-support) +--- Forum: Development Discussion (https://forums.dolphin-emu.org/Forum-development-discussion) +--- Thread: An ignorable improvement for reading Wii ISO file (/Thread-an-ignorable-improvement-for-reading-wii-iso-file) |
An ignorable improvement for reading Wii ISO file - SamSun - 10-21-2014 Hi, I have found following code for reading Wii iso file may be optimized, although the improvement is ignorable under modern OS (ex: Windows) When emulator read data from Wii iso file via VolumeWiiCrypted.cpp CVolumeWiiCrypted::Read (), it always reads 32Kbyte data, even only 1 byte is requested. This is strange. // read current block if (!m_pReader->Read(m_VolumeOffset + m_dataOffset + Block * 0x8000, 0x8000, m_pBuffer)) { return(false); } if (m_LastDecryptedBlockOffset != Block) { memcpy(IV, m_pBuffer + 0x3d0, 16); aes_crypt_cbc(m_AES_ctx.get(), AES_DECRYPT, 0x7C00, IV, m_pBuffer + 0x400, m_LastDecryptedBlock); m_LastDecryptedBlockOffset = Block; } I think it can be optimized by following code: if (m_LastDecryptedBlockOffset != Block) { if (!m_pReader->Read(m_VolumeOffset + dataOffset + Block * 0x8000, 0x8000, m_pBuffer)) return(false); memcpy(IV, m_pBuffer + 0x3d0, 16); aes_crypt_cbc(m_AES_ctx, AES_DECRYPT, 0x7C00, IV, m_pBuffer + 0x400, m_LastDecryptedBlock); m_LastDecryptedBlockOffset = Block; } RE: An ignorable improvement for reading Wii ISO file - JMC47 - 10-22-2014 If someone made a PR it would get reviewed regardless. RE: An ignorable improvement for reading Wii ISO file - Buddybenj - 10-23-2014 If it doesn't cause any regressions, LGTM. You should submit a PR on GitHub. RE: An ignorable improvement for reading Wii ISO file - Jack Frost - 10-24-2014 I don't really understand your change (without context); you moved the reading into the if? How is that supposed to change things if you need to decrypt the whole block anyways to read the data (even if its just one byte)? RE: An ignorable improvement for reading Wii ISO file - tueidj - 10-24-2014 The change is intended to avoid unnecessarily reading the encrypted block from the disc/iso file if the same block is already sitting decrypted in m_LastDecryptedBlock. I doubt it would have noticeable effect due to OS-level disk caching, you'd be better off implementing a cache for decrypted blocks if you wanted to speed things up. |