summaryrefslogtreecommitdiff
path: root/src/pso
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2023-02-28 09:21:45 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2023-02-28 09:26:29 -0400
commit8453a85359ef9dca831f78d56e56da8eb8415707 (patch)
tree7328bfdb5196fdda17cad909e59eeca31a2a5f1d /src/pso
parent5df5d5e1c2acbcabace6936ee7b763f7995f9d0a (diff)
PSOV3Encryption: Rename `encrypt()` -> `init()`
Shoutouts to fuziqersoftware for pointing this out.
Diffstat (limited to 'src/pso')
-rw-r--r--src/pso/PSOV3Encryption.cpp9
1 files changed, 3 insertions, 6 deletions
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);
}