aboutsummaryrefslogtreecommitdiff
path: root/arm9/source/devices/input.h
diff options
context:
space:
mode:
authorBen Bridle <ben@derelict.engineering>2025-09-19 13:17:14 +1200
committerBen Bridle <ben@derelict.engineering>2025-09-19 13:32:32 +1200
commitbb1aa5958d1b67707dcf0f6b08bfaf0b408bd46e (patch)
treeb26d07ed58aaf7a5230fc3e28c103d616abfa9b8 /arm9/source/devices/input.h
parent9612c307f00c4313d73fe0c3a86c05c8d8cd514e (diff)
downloadbedrock-nds-bb1aa5958d1b67707dcf0f6b08bfaf0b408bd46e.zip
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.
Diffstat (limited to 'arm9/source/devices/input.h')
-rw-r--r--arm9/source/devices/input.h33
1 files changed, 19 insertions, 14 deletions
diff --git a/arm9/source/devices/input.h b/arm9/source/devices/input.h
index 4f91ed5..6df947b 100644
--- a/arm9/source/devices/input.h
+++ b/arm9/source/devices/input.h
@@ -1,21 +1,26 @@
-#include <nds.h>
-#include "../types/circbuf.h"
-
#ifndef INPUT_H_
#define INPUT_H_
+ #include "../bang.h"
+ #include "../types/circbuf.h"
+
+
+ // Bedrock input device.
typedef struct {
- bool pointer; // pointer active
- bool keyboard; // keyboard active
- CircBuf keybuffer; // queued keypresses
- u16 x,y; // pointer position
- u8 navigation; // navigation state
- u8 gamepad; // gamepad state
- bool wake; // wake flag
+ bool pointer; // Pointer active
+ bool keyboard; // Keyboard active
+ u16 x, y; // Pointer position
+ u16 x_read, y_read; // Read caches for pointer position
+ CircBuf keybuffer; // Queued keypresses
+ u8 gamepad; // Gamepad state
+ bool wake; // Wake flag
} InputDevice;
- void inp_receive_byte(InputDevice *inp, u8 byte);
- void inp_read_gamepad(InputDevice *inp);
- void inp_read_navigation(InputDevice *inp);
- void inp_read_touch(InputDevice *inp);
+ // Methods.
+ void input_reset(InputDevice *input);
+ void input_read_x(InputDevice *input);
+ void input_read_y(InputDevice *input);
+ void input_receive_key(InputDevice *input, u8 byte);
+ void input_update_gamepad(InputDevice *input);
+ void input_update_touch(InputDevice *input);
#endif