mai2io: add camera LED control functions (#91)

This is a follow-up to the previous PR. I realized I omitted the camera LED control interface, so I'm adding it now to complete the v1.02 API set.

**Changes:**
* Added `mai2_io_led_cam_set` to the 0x0102 API.
* Wired IO4 GPIO outputs to forward code reader/player camera light states.
* Updated `mai2hook.def` to export the new symbol.
* Updated `MAI2_DLL_SYM_COUNT_V102` to reflect the additional symbol count.

**Versioning Note:**
Since the previous PR was just merged and v1.02 hasn't been officially released yet, I've opted to include this in the existing **0x0102** version rather than bumping to 0x0103.

Reviewed-on: https://gitea.tendokyu.moe/TeamTofuShop/segatools/pulls/91
Co-authored-by: グローランプ <130208311+Gl0w1amp@users.noreply.github.com>
Co-committed-by: グローランプ <130208311+Gl0w1amp@users.noreply.github.com>
This commit is contained in:
グローランプ
2026-01-04 08:41:56 +00:00
committed by Dniel97
parent 41d7ce111d
commit ff28d4ff09
6 changed files with 54 additions and 2 deletions

View File

@@ -177,6 +177,28 @@ static HRESULT mai2_io4_write_gpio(uint8_t* payload, size_t len) {
dprintf(" Camera Ring: %s\n", (payload[1] & 0x80) ? "ON" : "OFF");
dprintf(" Camera Rec: %s\n", (payload[1] & 0x40) ? "ON" : "OFF");
#endif
if (mai2_dll.led_cam_set != NULL) {
uint8_t state = 0;
if (payload[0] & 0x20) {
state |= MAI2_IO_LED_CAM_CODE_READER_1P;
}
if (payload[0] & 0x04) {
state |= MAI2_IO_LED_CAM_CODE_READER_2P;
}
if (payload[1] & 0x80) {
state |= MAI2_IO_LED_CAM_RING;
}
if (payload[1] & 0x40) {
state |= MAI2_IO_LED_CAM_REC;
}
mai2_dll.led_cam_set(state);
}
}
return S_OK;
}
@@ -212,4 +234,4 @@ static HRESULT mai2_io4_write_unique(uint8_t* payload, size_t len) {
}
return S_OK;
}
}

View File

@@ -10,7 +10,7 @@
enum {
MAI2_DLL_SYM_COUNT_V101 = 11,
MAI2_DLL_SYM_COUNT_V102 = 12,
MAI2_DLL_SYM_COUNT_V102 = 13,
};
const struct dll_bind_sym mai2_dll_syms[] = {
@@ -50,6 +50,9 @@ const struct dll_bind_sym mai2_dll_syms[] = {
}, {
.sym = "mai2_io_led_billboard_set",
.off = offsetof(struct mai2_dll, led_set_leds),
}, {
.sym = "mai2_io_led_cam_set",
.off = offsetof(struct mai2_dll, led_cam_set),
},
};

View File

@@ -18,6 +18,7 @@ struct mai2_dll {
void (*led_dc_update)(uint8_t board, const uint8_t *rgb);
void (*led_gs_update)(uint8_t board, const uint8_t *rgb);
void (*led_set_leds)(uint8_t board, const uint8_t *rgb);
void (*led_cam_set)(uint8_t state);
};
struct mai2_dll_config {

View File

@@ -24,3 +24,4 @@ EXPORTS
mai2_io_led_dc_update
mai2_io_led_gs_update
mai2_io_led_billboard_set
mai2_io_led_cam_set

View File

@@ -273,3 +273,14 @@ void mai2_io_led_billboard_set(uint8_t board, const uint8_t *rgb) {
#endif
return;
}
void mai2_io_led_cam_set(uint8_t state) {
#if 0
dprintf("Mai2 LED cam: CodeReader1P=%s CodeReader2P=%s Ring=%s Rec=%s\n",
(state & MAI2_IO_LED_CAM_CODE_READER_1P) ? "ON" : "OFF",
(state & MAI2_IO_LED_CAM_CODE_READER_2P) ? "ON" : "OFF",
(state & MAI2_IO_LED_CAM_RING) ? "ON" : "OFF",
(state & MAI2_IO_LED_CAM_REC) ? "ON" : "OFF");
#endif
return;
}

View File

@@ -199,3 +199,17 @@ void mai2_io_led_gs_update(uint8_t board, const uint8_t *rgb);
Minimum API version: 0x0102 */
void mai2_io_led_billboard_set(uint8_t board, const uint8_t *rgb);
enum {
MAI2_IO_LED_CAM_CODE_READER_1P = 0x01,
MAI2_IO_LED_CAM_CODE_READER_2P = 0x02,
MAI2_IO_LED_CAM_RING = 0x04,
MAI2_IO_LED_CAM_REC = 0x08,
};
/* Update the Code Reader and Player Camera lights. State is a bitmask of
MAI2_IO_LED_CAM_* values.
Minimum API version: 0x0102 */
void mai2_io_led_cam_set(uint8_t state);