From 8453a85359ef9dca831f78d56e56da8eb8415707 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Tue, 28 Feb 2023 09:21:45 -0400 Subject: PSOV3Encryption: Rename `encrypt()` -> `init()` Shoutouts to fuziqersoftware for pointing this out. --- src/pso/PSOV3Encryption.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/pso/PSOV3Encryption.cpp') diff --git a/src/pso/PSOV3Encryption.cpp b/src/pso/PSOV3Encryption.cpp index 465249e..30c5586 100644 --- a/src/pso/PSOV3Encryption.cpp +++ b/src/pso/PSOV3Encryption.cpp @@ -26,12 +26,13 @@ void PSOV3Encryption::update_stream() { for (u32 *p = ptr; p != m_buffer_end; *p++ ^= *start++); } -void PSOV3Encryption::encrypt(u32 seed) { +void PSOV3Encryption::init(u32 seed) { const size_t size = m_buffer.size(); u32 thing; m_buffer_end = &m_buffer[size]; m_buffer_start = m_buffer.start(); u32 value = 0; + for (int i = 0; i <= 16; ++i, *m_buffer_start++ = value) { for (int j = 32; j; --j) { seed *= 0x5d588b65; @@ -39,13 +40,9 @@ void PSOV3Encryption::encrypt(u32 seed) { } } - //u32 *smth = &m_buffer[0]; - //u32 *smth2 = &m_buffer[1]; --m_buffer_start; thing = m_buffer[0xf]; *m_buffer_start = (m_buffer[0] >> 9) ^ (*m_buffer_start << 23) ^ thing; - //u32 *buf_val = &m_buffer[0]; - //u32 *next_buf_val = &m_buffer[1]; for (u32 *buf_val = &m_buffer[0], *next_buf_val = &m_buffer[1], *buf = m_buffer_start++; m_buffer_start != m_buffer_end;) { *m_buffer_start++ = (*buf_val++ << 23) ^ (*next_buf_val++ >> 9) ^ *buf++; @@ -64,7 +61,7 @@ PSOV3Encryption::~PSOV3Encryption() { } PSOV3Encryption::PSOV3Encryption() : PSOEncryption() { - encrypt(0); + init(0); } -- cgit v1.2.3-13-gbd6f