From fcbc3968bd95e4d19b37d9fa4bca51b1db8596ff Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Fri, 22 Nov 2024 16:04:33 +1300 Subject: Implement name and author ports in system device --- arm9/source/types/readbuf.c | 12 ++++++++++++ arm9/source/types/readbuf.h | 14 ++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 arm9/source/types/readbuf.c create mode 100644 arm9/source/types/readbuf.h (limited to 'arm9/source/types') diff --git a/arm9/source/types/readbuf.c b/arm9/source/types/readbuf.c new file mode 100644 index 0000000..eaee27a --- /dev/null +++ b/arm9/source/types/readbuf.c @@ -0,0 +1,12 @@ +#include +#include "readbuf.h" + +u8 rb_read(ReadBuf *buf) { + u8 output = buf->mem[buf->p]; + if (output) buf->p++; + return output; +} + +void rb_reset(ReadBuf *buf) { + buf->p = 0; +} diff --git a/arm9/source/types/readbuf.h b/arm9/source/types/readbuf.h new file mode 100644 index 0000000..9077a69 --- /dev/null +++ b/arm9/source/types/readbuf.h @@ -0,0 +1,14 @@ +#include + +#ifndef READBUF_H_ + #define READBUF_H_ + + typedef struct { + u8 *mem; + u8 p; + } ReadBuf; + + u8 rb_read(ReadBuf *buf); + void rb_reset(ReadBuf *buf); + +#endif -- cgit v1.2.3-70-g09d2