diff options
| author | notyouraveragehooman <65437533+notyouraveragehooman@users.noreply.github.com> | 2020-07-15 20:52:03 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-15 20:52:03 -0700 |
| commit | e7ae99c1fab713a66b57e9602da69ffaa4652f1c (patch) | |
| tree | a91f9e616335f1d5691a215f364a90be152c1257 /src/input.c | |
| parent | 400807e932ff1bd27b59c4a2cedeaa988d15ffd7 (diff) | |
| parent | 75223bab243e67eb7233edf32ffd8a15a94c6b34 (diff) | |
Merge pull request #26 from notyouraveragehooman/master
keese.c, input.c
Diffstat (limited to 'src/input.c')
| -rw-r--r-- | src/input.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/input.c b/src/input.c new file mode 100644 index 00000000..df5b2290 --- /dev/null +++ b/src/input.c @@ -0,0 +1,44 @@ +#include "global.h" +#include "entity.h" + +typedef struct { + u16 field_0x0; + u16 field_0x2; + u16 field_0x4; + u8 field_0x6; + u8 field_0x7; +} Input; + +void StoreKeyInput(Input *pkeyInput, u32 ioKeyInput); + +extern Input gUnk_03000FF0; + +void ReadKeyInput(void) +{ + u32 reg = ~*(u16*)0x04000130 & 0x3FF; + Input* input = &gUnk_03000FF0; + StoreKeyInput(input, reg); +} + +void StoreKeyInput(Input *input, u32 ioKeyInput) +{ + u32 difference; + u32 temp = input->field_0x0; + + difference = ioKeyInput & ~temp; + input->field_0x2 = difference; + if (ioKeyInput == temp) { + if (--input->field_0x7 == 0) { + input->field_0x7 = 4; + input->field_0x4 = ioKeyInput; + } + else { + input->field_0x4 = 0; + } + } + else { + input->field_0x7 = 0x14; + input->field_0x4 = difference; + } + input->field_0x0 = ioKeyInput; +}
\ No newline at end of file |
