summaryrefslogtreecommitdiff
path: root/include/pso/PSOV3Encryption.h
blob: 966ff70d7db46ba46d590dde377ca4f710e1cb4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef PSOV3ENCRYPTION_H
#define PSOV3ENCRYPTION_H

#include <global_types.h>
#include <string.h>
#include <pso/macros.h>
#include <pso/TArray.h>

class PSOEncryption {
public:
	PSOEncryption();
	virtual void update_stream() = 0;
	virtual ~PSOEncryption();
	virtual void init(u32 seed) = 0;
	virtual u32 next() = 0;
};

class PSOV3Encryption : public PSOEncryption {
public:
	PSOV3Encryption();
	virtual void update_stream() override;
	virtual ~PSOV3Encryption();
	virtual void init(u32 seed) override;
	virtual u32 next() override;

	PRIVATE_MEMBER_ACCESSORS_ARRAY(u32, buffer, 522);
	PRIVATE_MEMBER_ACCESSORS_NON_REF(u32 *, buffer_start);
	PRIVATE_MEMBER_ACCESSORS_NON_REF(u32 *, buffer_end);

private:
	TArray<u32, 522> m_buffer;
	u32 *m_buffer_start;
	u32 *m_buffer_end;
};

#endif