summaryrefslogtreecommitdiff
path: root/src/pso/PSOV3Encryption.cpp
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2023-03-07 15:23:51 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2023-03-07 15:23:51 -0400
commit09c901655db3bb42d2aac4b506846b18833d777c (patch)
treec980f1c6b42ee503a699200a55b4cabfded1ffd5 /src/pso/PSOV3Encryption.cpp
parent5df9bdde16d30a8bfe520e178c5810a7163e9d6c (diff)
global: Completly disable inlining
This is because it looks more, and more clear that the entire codebase was compiled without inlining. Likely to reduce code size from all the byteswap functions, only present on the GameCube version.
Diffstat (limited to 'src/pso/PSOV3Encryption.cpp')
-rw-r--r--src/pso/PSOV3Encryption.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/pso/PSOV3Encryption.cpp b/src/pso/PSOV3Encryption.cpp
index 38225bf..867c864 100644
--- a/src/pso/PSOV3Encryption.cpp
+++ b/src/pso/PSOV3Encryption.cpp
@@ -16,9 +16,9 @@ void PSOV3Encryption::update_stream() {
u32 *part1;
u32 *part2;
- part2 = m_buffer.start();
- m_buffer_start = m_buffer.start();
- ptr = m_buffer.start();
+ part2 = m_buffer;
+ m_buffer_start = m_buffer;
+ ptr = m_buffer;
part1 = &ptr[489];
for (; part1 != m_buffer_end; *ptr++ ^= *part1++);
@@ -27,10 +27,9 @@ void PSOV3Encryption::update_stream() {
}
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();
+ const size_t size = (sizeof(m_buffer)/sizeof(*m_buffer))-1;
+ m_buffer_end = &m_buffer[size+1];
+ m_buffer_start = m_buffer;
u32 value = 0;
for (int i = 0; i <= 16; ++i, *m_buffer_start++ = value) {
@@ -41,8 +40,8 @@ void PSOV3Encryption::init(u32 seed) {
}
--m_buffer_start;
- thing = m_buffer[0xf];
- *m_buffer_start = (m_buffer[0] >> 9) ^ (*m_buffer_start << 23) ^ thing;
+
+ *m_buffer_start = (*m_buffer_start << 23) ^ (m_buffer[0] >> 9) ^ m_buffer[0xf];
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++;
@@ -51,11 +50,11 @@ void PSOV3Encryption::init(u32 seed) {
update_stream();
update_stream();
update_stream();
- m_buffer_start = m_buffer.end();
+ m_buffer_start = &m_buffer[size-1];
}
PSOV3Encryption::~PSOV3Encryption() {
- m_buffer.fill(0);
+ memset(m_buffer, 0, sizeof(m_buffer));
m_buffer_start = nullptr;
m_buffer_end = nullptr;
}