mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2024-11-12 01:10:49 +01:00
feat(extio): Add EXTIO command data structures
Reverse engineered from a real EXTIO device, open-io project as further reference
This commit is contained in:
parent
c22ec4fcff
commit
2bbbfccd13
4
src/main/extio/Module.mk
Normal file
4
src/main/extio/Module.mk
Normal file
@ -0,0 +1,4 @@
|
||||
libs += extio
|
||||
|
||||
src_extio := \
|
||||
cmd.c \
|
16
src/main/extio/cmd.c
Normal file
16
src/main/extio/cmd.c
Normal file
@ -0,0 +1,16 @@
|
||||
#include "cmd.h"
|
||||
|
||||
uint8_t extio_cmd_checksum(const struct extio_cmd_write *write)
|
||||
{
|
||||
const uint8_t *data;
|
||||
uint32_t checksum;
|
||||
|
||||
data = (const uint8_t *) write;
|
||||
|
||||
checksum = 0;
|
||||
checksum += data[0];
|
||||
checksum += data[1];
|
||||
checksum += data[2];
|
||||
|
||||
return (uint8_t) (checksum & 0x7F);
|
||||
}
|
49
src/main/extio/cmd.h
Normal file
49
src/main/extio/cmd.h
Normal file
@ -0,0 +1,49 @@
|
||||
#ifndef EXTIO_CMD_H
|
||||
#define EXTIO_CMD_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define EXTIO_PAD_LIGHT_MAX_PLAYERS 2
|
||||
|
||||
enum extio_status {
|
||||
EXTIO_STATUS_OK = 0x11,
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
struct extio_cmd_pad_light {
|
||||
uint8_t unknown : 3;
|
||||
uint8_t right : 1;
|
||||
uint8_t left : 1;
|
||||
uint8_t down : 1;
|
||||
uint8_t up : 1;
|
||||
uint8_t unknown_80 : 1;
|
||||
};
|
||||
|
||||
struct extio_cmd_write {
|
||||
struct extio_cmd_pad_light pad_lights[EXTIO_PAD_LIGHT_MAX_PLAYERS];
|
||||
|
||||
uint8_t unknown3 : 3;
|
||||
uint8_t sensor_read_mode : 3;
|
||||
uint8_t neons : 1;
|
||||
uint8_t unknown4 : 1;
|
||||
|
||||
uint8_t checksum;
|
||||
};
|
||||
|
||||
struct extio_cmd_read {
|
||||
uint8_t status;
|
||||
};
|
||||
|
||||
_Static_assert(
|
||||
sizeof(struct extio_cmd_write) == 4,
|
||||
"struct extio_cmd_write is the wrong size");
|
||||
_Static_assert(
|
||||
sizeof(struct extio_cmd_read) == 1,
|
||||
"struct extio_cmd_read is the wrong size");
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
uint8_t extio_cmd_checksum(const struct extio_cmd_write *write);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user