marioparty4/include/TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf.h
dbalatoni13 cdb1d1fc37
Import gx, PadClamp, rest of mtx, TRK 2.6 and MSL (#525)
* Match mtx and Padclamp.c

* Match the rest of GX

* Import TRK 2.6

* Import MSL headers and files

* Merge some MSL headers into ours
2025-01-12 08:11:23 -06:00

50 lines
1.7 KiB
C

#ifndef METROTRK_PORTABLE_MSGBUF_H
#define METROTRK_PORTABLE_MSGBUF_H
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
#include "stddef.h"
#ifdef __cplusplus
extern "C" {
#endif
DSError TRKInitializeMessageBuffers(void);
DSError TRKSetBufferPosition(TRKBuffer* msg, u32 pos);
void* TRKGetBuffer(int);
void TRKResetBuffer(TRKBuffer* msg, BOOL keepData);
void* TRKGetBuffer(int idx);
void TRKReleaseBuffer(int idx);
DSError TRKGetFreeBuffer(int* msgID, TRKBuffer** outMsg);
DSError TRKAppendBuffer(TRKBuffer* msg, const void* data, size_t length);
DSError TRKAppendBuffer1_ui8(TRKBuffer* buffer, const u8 data);
inline DSError TRKAppendBuffer1_ui8(TRKBuffer* buffer, const u8 data)
{
if (buffer->position >= TRKMSGBUF_SIZE) {
return DS_MessageBufferOverflow;
}
buffer->data[buffer->position++] = data;
buffer->length++;
return DS_NoError;
}
DSError TRKAppendBuffer1_ui16(TRKBuffer* buffer, const u16 data);
DSError TRKAppendBuffer1_ui32(TRKBuffer* buffer, const u32 data);
DSError TRKAppendBuffer1_ui64(TRKBuffer* buffer, const u64 data);
DSError TRKAppendBuffer_ui8(TRKBuffer* buffer, const u8* data, int count);
DSError TRKAppendBuffer_ui32(TRKBuffer* buffer, const u32* data, int count);
DSError TRKReadBuffer1_ui8(TRKBuffer* buffer, u8* data);
DSError TRKReadBuffer1_ui16(TRKBuffer* buffer, u16* data);
DSError TRKReadBuffer1_ui32(TRKBuffer* buffer, u32* data);
DSError TRKReadBuffer1_ui64(TRKBuffer* buffer, u64* data);
DSError TRKReadBuffer_ui8(TRKBuffer* buffer, u8* data, int count);
DSError TRKReadBuffer_ui32(TRKBuffer* buffer, u32* data, int count);
DSError TRKReadBuffer(TRKBuffer* msg, void* data, size_t length);
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_MSGBUF_H */