aboutsummaryrefslogtreecommitdiff
path: root/arm9/source/types/readbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'arm9/source/types/readbuf.c')
-rw-r--r--arm9/source/types/readbuf.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/arm9/source/types/readbuf.c b/arm9/source/types/readbuf.c
index eaee27a..750ac4d 100644
--- a/arm9/source/types/readbuf.c
+++ b/arm9/source/types/readbuf.c
@@ -1,12 +1,20 @@
-#include <nds.h>
#include "readbuf.h"
-u8 rb_read(ReadBuf *buf) {
+
+// Populate a read buffer with a pointer to a string.
+void readbuf_populate(ReadBuf *buf, u8 *string) {
+ buf->mem = string;
+ buf->p = 0;
+}
+
+// Read the next byte of a read buffer, or zero if all bytes have been read.
+u8 readbuf_read(ReadBuf *buf) {
u8 output = buf->mem[buf->p];
if (output) buf->p++;
return output;
}
-void rb_reset(ReadBuf *buf) {
+// Move the pointer to the start of the buffer.
+void readbuf_set_pointer(ReadBuf *buf) {
buf->p = 0;
}