iidxhook8: Rename bi2a structs to be more clear

This commit is contained in:
Will Xyen
2019-10-12 14:16:22 -04:00
parent 1c415eb207
commit 0c1bbe08c0
2 changed files with 43 additions and 45 deletions
+5 -5
View File
@@ -140,8 +140,8 @@ static void bio2_emu_bi2a_send_status(struct ac_io_emu *emu, const struct ac_io_
static void bio2_emu_bi2a_send_state(struct ac_io_emu *emu, const struct ac_io_message *req) static void bio2_emu_bi2a_send_state(struct ac_io_emu *emu, const struct ac_io_message *req)
{ {
struct ac_io_message resp; struct ac_io_message resp;
struct bio2_bi2a_state *body; struct bi2a_iidx_state_out *body;
struct bio2_bi2a_state_in *req_bi2a; struct bi2a_iidx_state_in *req_bi2a;
uint8_t input_sys = 0; uint8_t input_sys = 0;
uint8_t input_panel = 0; uint8_t input_panel = 0;
@@ -156,8 +156,8 @@ static void bio2_emu_bi2a_send_state(struct ac_io_emu *emu, const struct ac_io_m
resp.addr = req->addr | AC_IO_RESPONSE_FLAG; resp.addr = req->addr | AC_IO_RESPONSE_FLAG;
resp.cmd.code = req->cmd.code; resp.cmd.code = req->cmd.code;
resp.cmd.seq_no = req->cmd.seq_no; resp.cmd.seq_no = req->cmd.seq_no;
resp.cmd.nbytes = sizeof(struct bio2_bi2a_state); resp.cmd.nbytes = sizeof(struct bi2a_iidx_state_out);
req_bi2a = (struct bio2_bi2a_state_in*)req->cmd.raw; req_bi2a = (struct bi2a_iidx_state_in*)req->cmd.raw;
packed_lights.panel_lights = 0; packed_lights.panel_lights = 0;
for (size_t i = 0; i < 4; ++i) { for (size_t i = 0; i < 4; ++i) {
@@ -199,7 +199,7 @@ static void bio2_emu_bi2a_send_state(struct ac_io_emu *emu, const struct ac_io_m
} }
body = (struct bio2_bi2a_state *)&resp.cmd.raw; body = (struct bio2_bi2a_state *)&resp.cmd.raw;
memset(body, 0, sizeof(struct bio2_bi2a_state)); memset(body, 0, sizeof(struct bi2a_iidx_state_out));
// IIDX25 polls really really fast, this limits it to 1000Hz // IIDX25 polls really really fast, this limits it to 1000Hz
if (poll_delay) { if (poll_delay) {
+38 -40
View File
@@ -5,9 +5,9 @@
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
#include "acioemu/emu.h" #include "bio2emu/emu.h"
enum bio2_bi2a_cmd { enum bio2_iidx_cmd {
// Custom Stuff // Custom Stuff
BIO2_BI2A_CMD_UNK_0100 = 0x0100, BIO2_BI2A_CMD_UNK_0100 = 0x0100,
BIO2_BI2A_CMD_UNK_0120 = 0x0120, BIO2_BI2A_CMD_UNK_0120 = 0x0120,
@@ -15,12 +15,12 @@ enum bio2_bi2a_cmd {
}; };
#pragma pack(push, 1) #pragma pack(push, 1)
struct _slider { struct bi2a_iidx_slider {
uint8_t s_unk : 4; uint8_t s_unk : 4;
uint8_t s_val : 4; uint8_t s_val : 4;
}; };
struct _system { struct bi2a_iidx_system {
uint8_t v_unk1 : 1; uint8_t v_unk1 : 1;
uint8_t v_coin : 1; uint8_t v_coin : 1;
uint8_t v_service : 1; uint8_t v_service : 1;
@@ -28,12 +28,12 @@ struct _system {
uint8_t v_unk2 : 4; uint8_t v_unk2 : 4;
}; };
struct _button { struct bi2a_iidx_button {
uint8_t b_unk : 7; uint8_t b_unk : 7;
uint8_t b_val : 1; uint8_t b_val : 1;
}; };
struct _panel { struct bi2a_iidx_panel {
uint8_t y_unk : 4; uint8_t y_unk : 4;
uint8_t y_effect : 1; uint8_t y_effect : 1;
uint8_t y_vefx : 1; uint8_t y_vefx : 1;
@@ -41,17 +41,17 @@ struct _panel {
uint8_t y_start1 : 1; uint8_t y_start1 : 1;
}; };
struct bio2_bi2a_state { struct bi2a_iidx_state_out {
struct _slider SLIDER1; struct bi2a_iidx_slider SLIDER1;
struct _system SYSTEM; struct bi2a_iidx_system SYSTEM;
struct _slider SLIDER2; struct bi2a_iidx_slider SLIDER2;
uint8_t UNK1; uint8_t UNK1;
struct _slider SLIDER3; struct bi2a_iidx_slider SLIDER3;
uint8_t UNK2; uint8_t UNK2;
struct _slider SLIDER4; struct bi2a_iidx_slider SLIDER4;
struct _slider SLIDER5; struct bi2a_iidx_slider SLIDER5;
uint8_t UNK3; // coin mech? uint8_t UNK3; // coin mech?
struct _panel PANEL; struct bi2a_iidx_panel PANEL;
uint8_t UNK4; uint8_t UNK4;
uint8_t UNK5; uint8_t UNK5;
uint8_t UNK6; uint8_t UNK6;
@@ -60,58 +60,56 @@ struct bio2_bi2a_state {
uint8_t UNK9; uint8_t UNK9;
uint8_t TURNTABLE1; uint8_t TURNTABLE1;
uint8_t TURNTABLE2; uint8_t TURNTABLE2;
struct _button P1SW1; struct bi2a_iidx_button P1SW1;
uint8_t UNK11; uint8_t UNK11;
struct _button P1SW2; struct bi2a_iidx_button P1SW2;
uint8_t UNK12; uint8_t UNK12;
struct _button P1SW3; struct bi2a_iidx_button P1SW3;
uint8_t UNK13; uint8_t UNK13;
struct _button P1SW4; struct bi2a_iidx_button P1SW4;
uint8_t UNK14; uint8_t UNK14;
struct _button P1SW5; struct bi2a_iidx_button P1SW5;
uint8_t UNK15; uint8_t UNK15;
struct _button P1SW6; struct bi2a_iidx_button P1SW6;
uint8_t UNK16; uint8_t UNK16;
struct _button P1SW7; struct bi2a_iidx_button P1SW7;
uint8_t UNK17; uint8_t UNK17;
struct _button P2SW1; struct bi2a_iidx_button P2SW1;
uint8_t UNK21; uint8_t UNK21;
struct _button P2SW2; struct bi2a_iidx_button P2SW2;
uint8_t UNK22; uint8_t UNK22;
struct _button P2SW3; struct bi2a_iidx_button P2SW3;
uint8_t UNK23; uint8_t UNK23;
struct _button P2SW4; struct bi2a_iidx_button P2SW4;
uint8_t UNK24; uint8_t UNK24;
struct _button P2SW5; struct bi2a_iidx_button P2SW5;
uint8_t UNK25; uint8_t UNK25;
struct _button P2SW6; struct bi2a_iidx_button P2SW6;
uint8_t UNK26; uint8_t UNK26;
struct _button P2SW7; struct bi2a_iidx_button P2SW7;
uint8_t UNK27; uint8_t UNK27;
}; };
struct _light { struct bi2a_iidx_light {
uint8_t l_unk : 7; uint8_t l_unk : 7;
uint8_t l_state : 1; uint8_t l_state : 1;
}; };
struct bio2_bi2a_state_in { struct bi2a_iidx_state_in {
struct _light UNK1[3]; struct bi2a_iidx_light UNK1[3];
struct _light PANEL[4]; struct bi2a_iidx_light PANEL[4];
struct _light DECKSW[14]; struct bi2a_iidx_light DECKSW[14];
uint8_t UNK2[2]; uint8_t UNK2[2];
uint8_t SEG16[9]; uint8_t SEG16[9];
struct _light SPOTLIGHT1[4]; struct bi2a_iidx_light SPOTLIGHT1[4];
struct _light NEONLAMP; struct bi2a_iidx_light NEONLAMP;
struct _light SPOTLIGHT2[4]; struct bi2a_iidx_light SPOTLIGHT2[4];
uint8_t UNK3[7]; uint8_t UNK3[7];
}; };
_Static_assert(sizeof(struct bio2_bi2a_state_in) == 48, "bio2_bi2a_state_in is the wrong size"); _Static_assert(sizeof(struct bi2a_iidx_state_in) == 48, "bio2_bi2a_state_in is the wrong size");
_Static_assert(sizeof(struct bio2_bi2a_state) == 46, "bio2_bi2a_state_out is the wrong size"); _Static_assert(sizeof(struct bi2a_iidx_state_out) == 46, "bio2_bi2a_state_out is the wrong size");
#pragma pack(pop) #pragma pack(pop)
struct bio2emu_port;
void bio2_emu_bi2a_init(struct bio2emu_port *in, bool disable_poll_limiter); void bio2_emu_bi2a_init(struct bio2emu_port *in, bool disable_poll_limiter);
void bio2_emu_bi2a_dispatch_request(struct bio2emu_port *bio2port, const struct ac_io_message *req); void bio2_emu_bi2a_dispatch_request(struct bio2emu_port *bio2port, const struct ac_io_message *req);