2022-02-18 07:37:54 +00:00
|
|
|
#pragma once
|
2022-02-19 13:04:45 +00:00
|
|
|
#include "COutputStream.hpp"
|
2022-02-18 07:37:54 +00:00
|
|
|
|
|
|
|
namespace metaforce {
|
|
|
|
class CMemoryStreamOut final : public COutputStream {
|
|
|
|
public:
|
|
|
|
enum class EOwnerShip {
|
|
|
|
Owned,
|
2022-05-14 06:47:29 +00:00
|
|
|
NotOwned,
|
2022-02-18 07:37:54 +00:00
|
|
|
};
|
2022-02-25 07:45:25 +00:00
|
|
|
|
2022-02-18 07:37:54 +00:00
|
|
|
private:
|
|
|
|
u8* x7c_ptr = nullptr;
|
|
|
|
u32 x80_len = 0;
|
|
|
|
u32 x84_position = 0;
|
|
|
|
bool x88_owned;
|
|
|
|
|
2022-03-22 08:37:10 +00:00
|
|
|
protected:
|
|
|
|
void Write(const u8* ptr, u32 len) override;
|
2022-02-18 07:37:54 +00:00
|
|
|
public:
|
2022-03-22 08:37:10 +00:00
|
|
|
CMemoryStreamOut(u8* workBuf, u32 len, EOwnerShip ownership = EOwnerShip::NotOwned, s32 blockLen = 4096)
|
|
|
|
: COutputStream(blockLen), x7c_ptr(workBuf), x80_len(len), x88_owned(ownership == EOwnerShip::Owned) {}
|
2022-02-18 07:37:54 +00:00
|
|
|
|
|
|
|
~CMemoryStreamOut() override;
|
|
|
|
|
2022-02-28 01:11:10 +00:00
|
|
|
u32 GetWritePosition() const { return x84_position; }
|
2022-02-18 07:37:54 +00:00
|
|
|
};
|
2022-02-25 07:45:25 +00:00
|
|
|
} // namespace metaforce
|