2022-02-18 07:37:54 +00:00
|
|
|
#include "CMemoryStreamOut.hpp"
|
2022-02-25 07:45:25 +00:00
|
|
|
|
2022-02-18 07:37:54 +00:00
|
|
|
#include <cstring>
|
|
|
|
|
|
|
|
namespace metaforce {
|
|
|
|
CMemoryStreamOut::~CMemoryStreamOut() {
|
|
|
|
Flush();
|
|
|
|
|
|
|
|
if (x88_owned) {
|
|
|
|
delete[] x7c_ptr;
|
|
|
|
}
|
|
|
|
}
|
2022-02-25 07:45:25 +00:00
|
|
|
|
2022-02-18 07:37:54 +00:00
|
|
|
void CMemoryStreamOut::Write(const u8* ptr, u32 len) {
|
|
|
|
const auto offset = (x80_len - x84_position);
|
|
|
|
if (offset < len) {
|
|
|
|
len = offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (len != 0) {
|
|
|
|
memcpy(x7c_ptr + x84_position, ptr, len);
|
2022-02-28 01:11:10 +00:00
|
|
|
x84_position += len;
|
2022-02-18 07:37:54 +00:00
|
|
|
}
|
|
|
|
}
|
2022-02-25 07:45:25 +00:00
|
|
|
} // namespace metaforce
|