From bb1aa5958d1b67707dcf0f6b08bfaf0b408bd46e Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Fri, 19 Sep 2025 13:17:14 +1200 Subject: Massive rewrite This commit rewrites the emulator halfway from scratch to make it easier to change and maintain in the future. The emulator core was rewritten to adhere to the released Bedrock specification (earlier versions implemented an older prototype specification, which is no longer relevant). This commit also adds proper support for running multiple concurrent Bedrock instances. This was previously supported in a limited manner for the on-screen keyboard, but now works for any regular program as well, with switching being performed by pressing the L or R bumper buttons. This is disabled by default, as programs will still need to be baked into the emulator and hand-loaded. --- arm9/source/types/readbuf.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'arm9/source/types/readbuf.c') 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 #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; } -- cgit v1.2.3-70-g09d2