summaryrefslogtreecommitdiff
path: root/arm9/source/types
diff options
context:
space:
mode:
authorBen Bridle <ben@derelict.engineering>2024-11-22 16:04:33 +1300
committerBen Bridle <ben@derelict.engineering>2024-11-22 16:07:48 +1300
commitfcbc3968bd95e4d19b37d9fa4bca51b1db8596ff (patch)
tree333c6cf63f4b2aea513a9691b29c8f397e139c46 /arm9/source/types
parente05888d141bc64e92d81859af0d87627e6fbc477 (diff)
downloadbedrock-nds-fcbc3968bd95e4d19b37d9fa4bca51b1db8596ff.zip
Implement name and author ports in system device
Diffstat (limited to 'arm9/source/types')
-rw-r--r--arm9/source/types/readbuf.c12
-rw-r--r--arm9/source/types/readbuf.h14
2 files changed, 26 insertions, 0 deletions
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 <nds.h>
+#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 <nds.h>
+
+#ifndef READBUF_H_
+ #define READBUF_H_
+
+ typedef struct {
+ u8 *mem;
+ u8 p;
+ } ReadBuf;
+
+ u8 rb_read(ReadBuf *buf);
+ void rb_reset(ReadBuf *buf);
+
+#endif