From 5df5d5e1c2acbcabace6936ee7b763f7995f9d0a Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Mon, 27 Feb 2023 19:50:41 -0400 Subject: PSOV3Encryption: Add, and fully match `PSOV3Encryption` Boy, that took way too long to match, mainly due to regalloc issues in `update_stream()`. --- include/pso/PSOV3Encryption.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 include/pso/PSOV3Encryption.h (limited to 'include/pso/PSOV3Encryption.h') diff --git a/include/pso/PSOV3Encryption.h b/include/pso/PSOV3Encryption.h new file mode 100644 index 0000000..5def0f2 --- /dev/null +++ b/include/pso/PSOV3Encryption.h @@ -0,0 +1,36 @@ +#ifndef PSOV3ENCRYPTION_H +#define PSOV3ENCRYPTION_H + +#include +#include +#include +#include + +class PSOEncryption { +public: + PSOEncryption(); + virtual void update_stream() = 0; + virtual ~PSOEncryption(); + virtual void encrypt(u32 seed) = 0; + virtual u32 next() = 0; +}; + +class PSOV3Encryption : public PSOEncryption { +public: + PSOV3Encryption(); + virtual void update_stream() override; + virtual ~PSOV3Encryption(); + virtual void encrypt(u32 seed) override; + virtual u32 next() override; + + PRIVATE_MEMBER_ACCESSORS_ARRAY(u32, buffer, 522); + PRIVATE_MEMBER_ACCESSORS(u32 *, buffer_start); + PRIVATE_MEMBER_ACCESSORS(u32 *, buffer_end); + +private: + TArray m_buffer; + u32 *m_buffer_start; + u32 *m_buffer_end; +}; + +#endif -- cgit v1.2.3-13-gbd6f