[DiscordArchive] I've given up on the Jam info for now and thought I'd try my luck and crafting my own CDatastores an
[DiscordArchive] I've given up on the Jam info for now and thought I'd try my luck and crafting my own CDatastores an
hared_ptr<CDataStore> data(new CDataStore(Buffer.size()));Archived author: _mrfade_ • Posted: 2024-09-06T05:41:53.908000+00:00
Original source
I've given up on the Jam info for now and thought I'd try my luck and crafting my own CDatastores and buffers.
This is my CDatastore struct :
```cpp
struct CDataStore
{
intptr_t VTable;
uint8_t* Buffer;
unsigned int m_base; // 0x10
int m_alloc; // 0x14
uint32_t Length;
unsigned int m_read; // 0x1C
CDataStore(uint32_t size)
{
VTable = Offset::CDataStore_VTable;
Buffer = new uint8_t[size];
m_base = 0;
m_alloc = 0;
Length = size;
m_read = 10;
}
~CDataStore()
{
delete[] Buffer;
Buffer = nullptr;
}
};
```
And I am crafting it as such :
```cpp
ByteBuffer Buffer(0x3529); // Byte buffer calls SetOpCode() -> Internally it is just a put.
std:
hared_ptr<CDataStore> data(new CDataStore(Buffer.size()));
memcpy(data->Buffer, Buffer.contents(), Buffer.size());
pNetSend(a1, data.get(), 0);
```
My bytebuffer is based off an old packet frame work I found and I believe it's just basically ripped from TC :
https://github.com/ser0ja/PacketFramewor...teBuffer.h
I did slightly change the constructor of the byte buffer to resize bigger so that I can put my Opcode at 0x10 :
```cpp
ByteBuffer(uint32_t opcode) : _rpos(0), _wpos(0), _bitpos(InitialBitPos), _curbitval(0)
{
_storage.reserve(DEFAULT_SIZE);
_storage.resize(0x14); // was just 4
SetOpcode(opcode);
}
```
```cpp
void SetOpcode(uint32_t opcode)
{
put<uint32_t>(0x10, opcode);
}
```
Dumping out the info seems rather close to the orginal CDatastore but whenever i pass my crafted datastore to the SendNet I crash :/ Any ideas or tips ?