summaryrefslogtreecommitdiff
path: root/include/utils.h
diff options
context:
space:
mode:
authornotyourav <65437533+notyourav@users.noreply.github.com>2021-03-21 22:55:31 -0700
committerGitHub <noreply@github.com>2021-03-21 22:55:31 -0700
commit725efbe2d0b7253ba2a3ee935f830b3bfbe8eb7f (patch)
tree269a5ee1b44bb2600a63fbb2e9223a0b997f46f0 /include/utils.h
parenteb1643b9b7b513b74b2fb752c8409f175f14ed73 (diff)
parentf0d610f385dcbac0973a3c4b2f48621417492b5a (diff)
Merge pull request #142 from notyourav/static
TU squashing
Diffstat (limited to 'include/utils.h')
-rw-r--r--include/utils.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/include/utils.h b/include/utils.h
new file mode 100644
index 00000000..040eacee
--- /dev/null
+++ b/include/utils.h
@@ -0,0 +1,64 @@
+typedef struct {
+ u16 heldKeys;
+ u16 newKeys;
+ u16 unk4;
+ u8 unk6;
+ u8 unk7;
+} Input;
+
+extern Input gInput;
+
+/**
+ * Fill memory with 16 bit value.
+ */
+void MemFill16(u32 value, void* dest, u32 size);
+
+/**
+ * Fill memory with 32 bit value.
+ */
+void MemFill32(u32 value, void* dest, u32 size);
+
+/**
+ * Clear memory.
+ */
+void MemClear(void* dest, u32 size);
+
+/**
+ * Copy memory.
+ */
+void MemCopy(const void* src, void* dest, u32 size);
+
+/**
+ * Refresh gInput from hardware registers.
+ */
+void ReadKeyInput(void);
+
+void LoadPalettes(const u8*, int, int);
+void LoadPaletteGroup(u32 group);
+
+/**
+ * Allocate memory on heap.
+ *
+ * The heap size is 0x1000 bytes and should be used sparingly.
+ * It is customary for entities store the returned handle in their 'myHeap' field.
+ *
+ * @param size u32 Size to be allocated
+ * @return void* Pointer to allocated memory
+ */
+void* zMalloc(u32 size);
+
+/**
+ * Free memory from heap.
+ *
+ * The entity system will automatically free the address stored in the 'myHeap' field.
+ *
+ * @param ptr void* Handle to be freed
+ */
+void zFree(void* ptr);
+
+/**
+ * Reset All display hardware registers.
+ *
+ * @param updateHUD bool32 Request refresh of HUD layer (bg 0)
+ */
+void DispReset(bool32 updateHUD);