bio2emu: refactor BIO2 emulation

This commit is contained in:
Will Xyen
2020-08-02 23:02:13 -07:00
parent c54a41410b
commit 350ba00549
12 changed files with 122 additions and 100 deletions
+106
View File
@@ -0,0 +1,106 @@
#ifndef BIO2_BI2A_IIDX
#define BIO2_BI2A_IIDX
#include "bio2/bio2.h"
#pragma pack(push, 1)
struct bi2a_iidx_slider {
uint8_t s_unk : 4;
uint8_t s_val : 4;
};
struct bi2a_iidx_system {
uint8_t v_unk1 : 1;
uint8_t v_coin : 1;
uint8_t v_service : 1;
uint8_t v_test : 1;
uint8_t v_unk2 : 4;
};
struct bi2a_iidx_button {
uint8_t b_unk : 7;
uint8_t b_val : 1;
};
struct bi2a_iidx_panel {
uint8_t y_unk : 4;
uint8_t y_effect : 1;
uint8_t y_vefx : 1;
uint8_t y_start2 : 1;
uint8_t y_start1 : 1;
};
struct bi2a_iidx_state_out {
struct bi2a_iidx_slider SLIDER1;
struct bi2a_iidx_system SYSTEM;
struct bi2a_iidx_slider SLIDER2;
uint8_t UNK1;
struct bi2a_iidx_slider SLIDER3;
uint8_t UNK2;
struct bi2a_iidx_slider SLIDER4;
struct bi2a_iidx_slider SLIDER5;
uint8_t UNK3; // coin mech?
struct bi2a_iidx_panel PANEL;
uint8_t UNK4;
uint8_t UNK5;
uint8_t UNK6;
uint8_t UNK7;
uint8_t UNK8;
uint8_t UNK9;
uint8_t TURNTABLE1;
uint8_t TURNTABLE2;
struct bi2a_iidx_button P1SW1;
uint8_t UNK11;
struct bi2a_iidx_button P1SW2;
uint8_t UNK12;
struct bi2a_iidx_button P1SW3;
uint8_t UNK13;
struct bi2a_iidx_button P1SW4;
uint8_t UNK14;
struct bi2a_iidx_button P1SW5;
uint8_t UNK15;
struct bi2a_iidx_button P1SW6;
uint8_t UNK16;
struct bi2a_iidx_button P1SW7;
uint8_t UNK17;
struct bi2a_iidx_button P2SW1;
uint8_t UNK21;
struct bi2a_iidx_button P2SW2;
uint8_t UNK22;
struct bi2a_iidx_button P2SW3;
uint8_t UNK23;
struct bi2a_iidx_button P2SW4;
uint8_t UNK24;
struct bi2a_iidx_button P2SW5;
uint8_t UNK25;
struct bi2a_iidx_button P2SW6;
uint8_t UNK26;
struct bi2a_iidx_button P2SW7;
uint8_t UNK27;
};
struct bi2a_iidx_light {
uint8_t l_unk : 7;
uint8_t l_state : 1;
};
struct bi2a_iidx_state_in {
struct bi2a_iidx_light UNK1[3];
struct bi2a_iidx_light PANEL[4];
struct bi2a_iidx_light DECKSW[14];
uint8_t UNK2[2];
uint8_t SEG16[9];
struct bi2a_iidx_light SPOTLIGHT1[4];
struct bi2a_iidx_light NEONLAMP;
struct bi2a_iidx_light SPOTLIGHT2[4];
uint8_t UNK3[7];
};
_Static_assert(
sizeof(struct bi2a_iidx_state_in) == 48,
"bi2a_iidx_state_in is the wrong size");
_Static_assert(
sizeof(struct bi2a_iidx_state_out) == 46,
"bi2a_iidx_state_out is the wrong size");
#pragma pack(pop)
#endif
+75
View File
@@ -0,0 +1,75 @@
#ifndef BIO2_BI2A_SDVX
#define BIO2_BI2A_SDVX
#include "bio2/bio2.h"
#pragma pack(push, 1)
struct bi2a_sdvx_analog {
uint16_t unk1 : 1;
uint16_t a_coin : 1;
uint16_t a_service : 1;
uint16_t a_test : 1;
uint16_t unk2 : 2;
uint16_t a_val : 10;
};
struct bi2a_sdvx_buttons1 {
uint8_t b_fxl : 1;
uint8_t b_d : 1;
uint8_t b_c : 1;
uint8_t b_b : 1;
uint8_t b_a : 1;
uint8_t b_start : 1;
uint8_t b_recorder : 1;
uint8_t b_headphone : 1;
};
struct bi2a_sdvx_buttons2 {
uint8_t unk : 5;
uint8_t b_ex2 : 1;
uint8_t b_ex1 : 1;
uint8_t b_fxr : 1;
};
struct bio2_bi2a_state {
union {
uint16_t raw[8];
struct {
struct bi2a_sdvx_analog analogs[4];
uint8_t unk_1; // coin mech?
struct bi2a_sdvx_buttons1 buttons_1;
struct bi2a_sdvx_buttons2 buttons_2;
uint8_t unk_2[5];
};
};
};
struct bio2_bi2a_state_out {
uint8_t unk1[2];
uint8_t c_block;
uint8_t woof_r;
uint8_t woof_g;
uint8_t unk2;
uint8_t woof_b;
uint8_t controller[3];
uint8_t unk3;
uint8_t gpio[7]; // START, ABCD, FXL, FXR
uint8_t unk4[3];
uint8_t generator[3];
uint8_t unk5[3];
uint8_t gpio2[3]; // pop, titleL, titleR
uint8_t unk6;
uint8_t wingUpper[3];
uint8_t wingLower[3];
uint8_t unk7[3];
};
_Static_assert(
sizeof(struct bio2_bi2a_state) == 16,
"bio2_bi2a_state_in is the wrong size");
_Static_assert(
sizeof(struct bio2_bi2a_state_out) == 40,
"bio2_bi2a_state_out is the wrong size");
#pragma pack(pop)
#endif
+15
View File
@@ -0,0 +1,15 @@
#ifndef BIO2_BIO2
#define BIO2_BIO2
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
enum bio2_bi2a_cmd {
// Custom Stuff
BIO2_BI2A_CMD_UNK_0100 = 0x0100,
BIO2_BI2A_CMD_UNK_0120 = 0x0120,
BIO2_BI2A_CMD_POLL = 0x0152, // For IIDX
};
#endif