forked from Dniel97/segatools
chusan, fgo, mu3: fixed LED 15093 board
This commit is contained in:
parent
793417e891
commit
3dd6054a1e
@ -24,7 +24,6 @@
|
||||
|
||||
#include "board/led15093-cmd.h"
|
||||
#include "board/led15093-frame.h"
|
||||
|
||||
#include "board/led15093.h"
|
||||
|
||||
#include "hook/iobuf.h"
|
||||
@ -101,43 +100,39 @@ static char led15093_chip_num[5];
|
||||
static char led15093_boot_chip_num[5];
|
||||
static uint8_t led15093_fw_ver;
|
||||
static uint16_t led15093_fw_sum;
|
||||
static uint8_t led15093_host_adr = 255;
|
||||
static uint8_t led15093_board_adr = 1;
|
||||
static uint8_t led15093_host_adr = 1;
|
||||
|
||||
HRESULT led15093_hook_init(
|
||||
const struct led15093_config *cfg,
|
||||
unsigned int port_no_0,
|
||||
unsigned int port_no_1)
|
||||
HRESULT led15093_hook_init(const struct led15093_config *cfg, unsigned int first_port,
|
||||
unsigned int num_boards, uint8_t board_adr, uint8_t host_adr)
|
||||
{
|
||||
|
||||
assert(cfg != NULL);
|
||||
unsigned int port_no[2] = {port_no_0, port_no_1};
|
||||
|
||||
if (!cfg->enable) {
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
for (int i = 0; i < led15093_nboards; i++) {
|
||||
if (cfg->port_no[i] != 0) {
|
||||
port_no[i] = cfg->port_no[i];
|
||||
}
|
||||
if (cfg->port_no != 0) {
|
||||
first_port = cfg->port_no;
|
||||
}
|
||||
|
||||
led15093_board_adr = board_adr;
|
||||
led15093_host_adr = host_adr;
|
||||
|
||||
memcpy(led15093_board_num, cfg->board_number, sizeof(led15093_board_num));
|
||||
memcpy(led15093_chip_num, cfg->chip_number, sizeof(led15093_chip_num));
|
||||
memcpy(led15093_boot_chip_num, cfg->boot_chip_number, sizeof(led15093_boot_chip_num));
|
||||
led15093_fw_ver = cfg->fw_ver;
|
||||
led15093_fw_sum = cfg->fw_sum;
|
||||
|
||||
for (int i = 0; i < led15093_nboards; i++)
|
||||
for (int i = 0; i < num_boards; i++)
|
||||
{
|
||||
_led15093_per_board_vars *vb = &led15093_per_board_vars[i];
|
||||
|
||||
InitializeCriticalSection(&vb->lock);
|
||||
|
||||
if (port_no[i] == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uart_init(&vb->boarduart, port_no[i]);
|
||||
uart_init(&vb->boarduart, first_port + i);
|
||||
if (cfg->high_baudrate) {
|
||||
vb->boarduart.baud.BaudRate = 460800;
|
||||
} else {
|
||||
@ -160,7 +155,7 @@ HRESULT led15093_hook_init(
|
||||
led15093_clear_status(i, 1 + j);
|
||||
led15093_clear_report(i, 1 + j);
|
||||
vn->boardstatus[3] = 1; // DIPSW1 ON
|
||||
vn->boardadr = 1 + j;
|
||||
vn->boardadr = led15093_board_adr + j;
|
||||
vn->enable_bootloader = false;
|
||||
vn->enable_response = true;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
struct led15093_config {
|
||||
bool enable;
|
||||
bool high_baudrate;
|
||||
unsigned int port_no[2];
|
||||
unsigned int port_no;
|
||||
char board_number[8];
|
||||
char chip_number[5];
|
||||
char boot_chip_number[5];
|
||||
@ -16,7 +16,6 @@ struct led15093_config {
|
||||
uint16_t fw_sum;
|
||||
};
|
||||
|
||||
HRESULT led15093_hook_init(
|
||||
const struct led15093_config *cfg,
|
||||
unsigned int port_no_0,
|
||||
unsigned int port_no_1);
|
||||
HRESULT led15093_hook_init(const struct led15093_config *cfg, unsigned int first_port,
|
||||
unsigned int num_boards, uint8_t board_adr, uint8_t host_adr);
|
||||
|
||||
|
@ -102,7 +102,7 @@ static DWORD CALLBACK carol_pre_startup(void)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = sg_reader_hook_init(&carol_hook_cfg.aime, 10, carol_hook_mod);
|
||||
hr = sg_reader_hook_init(&carol_hook_cfg.aime, 10, 1, carol_hook_mod);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
goto fail;
|
||||
|
@ -55,8 +55,7 @@ void led15093_config_load(struct led15093_config *cfg, const wchar_t *filename)
|
||||
memset(cfg->boot_chip_number, ' ', sizeof(cfg->boot_chip_number));
|
||||
|
||||
cfg->enable = GetPrivateProfileIntW(L"led15093", L"enable", 1, filename);
|
||||
cfg->port_no[0] = GetPrivateProfileIntW(L"led15093", L"portNo0", 0, filename);
|
||||
cfg->port_no[1] = GetPrivateProfileIntW(L"led15093", L"portNo1", 0, filename);
|
||||
cfg->port_no = 0;
|
||||
cfg->high_baudrate = GetPrivateProfileIntW(L"led15093", L"highBaudrate", 0, filename);
|
||||
cfg->fw_ver = GetPrivateProfileIntW(L"led15093", L"fwVer", 0x90, filename);
|
||||
cfg->fw_sum = GetPrivateProfileIntW(L"led15093", L"fwSum", 0xadf7, filename);
|
||||
|
@ -96,7 +96,7 @@ static DWORD CALLBACK chuni_pre_startup(void)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = led15093_hook_init(&chuni_hook_cfg.led15093, 10, 11);
|
||||
hr = led15093_hook_init(&chuni_hook_cfg.led15093, 10, 2, 2, 1);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
goto fail;
|
||||
|
@ -84,18 +84,7 @@ void led15093_config_load(struct led15093_config *cfg, const wchar_t *filename)
|
||||
memset(cfg->boot_chip_number, ' ', sizeof(cfg->boot_chip_number));
|
||||
|
||||
cfg->enable = GetPrivateProfileIntW(L"led15093", L"enable", 1, filename);
|
||||
cvt_port = GetPrivateProfileIntW(L"led15093", L"cvtPort", 0, filename);
|
||||
|
||||
if (!cvt_port) {
|
||||
// SP mode: COM20, COM21
|
||||
cfg->port_no[0] = 20;
|
||||
cfg->port_no[1] = 21;
|
||||
} else {
|
||||
// CVT mode: COM2, COM3
|
||||
cfg->port_no[0] = 2;
|
||||
cfg->port_no[1] = 3;
|
||||
}
|
||||
|
||||
cfg->port_no = 0;
|
||||
cfg->high_baudrate = GetPrivateProfileIntW(L"led15093", L"highBaudrate", 0, filename);
|
||||
cfg->fw_ver = GetPrivateProfileIntW(L"led15093", L"fwVer", 0x90, filename);
|
||||
cfg->fw_sum = GetPrivateProfileIntW(L"led15093", L"fwSum", 0xadf7, filename);
|
||||
@ -143,7 +132,6 @@ void led15093_config_load(struct led15093_config *cfg, const wchar_t *filename)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void chusan_hook_config_load(
|
||||
struct chusan_hook_config *cfg,
|
||||
const wchar_t *filename)
|
||||
|
@ -99,7 +99,33 @@ static DWORD CALLBACK chusan_pre_startup(void)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = led15093_hook_init(&chusan_hook_cfg.led15093, 20, 21);
|
||||
bool *dipsw = &chusan_hook_cfg.platform.dipsw.dipsw[0];
|
||||
|
||||
if (dipsw[1] != dipsw[2]) {
|
||||
dprintf("DipSw: DipSw2 and 3 must be set to the same value!\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
dprintf("DipSw: NetInstall: %s\n", dipsw[0] ? "Server" : "Client");
|
||||
break;
|
||||
|
||||
case 1:
|
||||
dprintf("DipSw: Monitor Type: %dFPS\n", dipsw[1] ? 60 : 120);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
dprintf("DipSw: Aime Reader: %s\n", dipsw[2] ? "CVT" : "SP");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int first_port = dipsw[1] ? 2 : 20;
|
||||
|
||||
hr = led15093_hook_init(&chusan_hook_cfg.led15093, first_port, 2, 2, 1);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
goto fail;
|
||||
|
7
dist/chusan/segatools.ini
vendored
7
dist/chusan/segatools.ini
vendored
@ -46,22 +46,21 @@ enable=1
|
||||
dipsw1=1
|
||||
; Monitor type: 0 = 120FPS (SP), 1 = 60FPS (CVT)
|
||||
dipsw2=1
|
||||
; Aime reader hardware type: 0 = SP, 1 = CVT
|
||||
; Aime reader hardware type: 0 = SP, 1 = CVT. Both dipsw2 and dipsw3 must be
|
||||
; the same value.
|
||||
dipsw3=1
|
||||
|
||||
[gfx]
|
||||
; Force the game to run windowed.
|
||||
windowed=1
|
||||
; Add a frame to the game window if running windowed.
|
||||
framed=1
|
||||
framed=0
|
||||
; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen)
|
||||
monitor=0
|
||||
|
||||
[led15093]
|
||||
; 837-15093-06 LED strip emulation setting.
|
||||
enable=1
|
||||
; Set to 1 if running game in 60FPS (CVT) mode.
|
||||
cvtPort=0
|
||||
|
||||
[chuniio]
|
||||
; Uncomment this if you have custom chuniio implementation.
|
||||
|
4
dist/fgo/segatools.ini
vendored
4
dist/fgo/segatools.ini
vendored
@ -64,8 +64,8 @@ portNo=17
|
||||
[led15093]
|
||||
; 837-15093-06 LED board emulation setting.
|
||||
enable=1
|
||||
; COM port number for the first LED board. Has to be the same as the FTDI port.
|
||||
portNo0=17
|
||||
; COM port number for the LED board. Has to be the same as the FTDI port.
|
||||
portNo=17
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Input settings
|
||||
|
@ -47,11 +47,10 @@ void led15093_config_load(struct led15093_config *cfg, const wchar_t *filename)
|
||||
memset(cfg->boot_chip_number, ' ', sizeof(cfg->boot_chip_number));
|
||||
|
||||
cfg->enable = GetPrivateProfileIntW(L"led15093", L"enable", 1, filename);
|
||||
cfg->port_no[0] = GetPrivateProfileIntW(L"led15093", L"portNo0", 0, filename);
|
||||
cfg->port_no[1] = GetPrivateProfileIntW(L"led15093", L"portNo1", 0, filename);
|
||||
cfg->port_no = GetPrivateProfileIntW(L"led15093", L"portNo", 0, filename);
|
||||
cfg->high_baudrate = GetPrivateProfileIntW(L"led15093", L"highBaudrate", 0, filename);
|
||||
cfg->fw_ver = GetPrivateProfileIntW(L"led15093", L"fwVer", 0xA0, filename);
|
||||
cfg->fw_sum = GetPrivateProfileIntW(L"led15093", L"fwSum", 0xaa53, filename);
|
||||
cfg->fw_sum = GetPrivateProfileIntW(L"led15093", L"fwSum", 0xAA53, filename);
|
||||
|
||||
GetPrivateProfileStringW(
|
||||
L"led15093",
|
||||
|
@ -96,7 +96,7 @@ static DWORD CALLBACK fgo_pre_startup(void)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = led15093_hook_init(&fgo_hook_cfg.led15093, 17, 0);
|
||||
hr = led15093_hook_init(&fgo_hook_cfg.led15093, 17, 1, 1, 2);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
goto fail;
|
||||
|
@ -1042,7 +1042,7 @@ static HRESULT deck_frame_encode_byte(struct iobuf *dest, uint8_t byte) {
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// C310FWDLusb stubs
|
||||
// C3XXFWDLusb stubs
|
||||
|
||||
int fwdlusb_open(uint16_t *rResult) {
|
||||
dprintf("Printer: C3XXFWDLusb: %s\n", __func__);
|
||||
@ -1674,7 +1674,7 @@ int chcusb_getPrinterInfo(uint16_t tagNumber, uint8_t *rBuffer, uint32_t *rLen)
|
||||
break;
|
||||
|
||||
case 20: // printMode
|
||||
dprintf("Printer: C3xxusb: Unimpl tagNumber 20\n");
|
||||
dprintf("Printer: C3XXusb: Unimpl tagNumber 20\n");
|
||||
break;
|
||||
|
||||
case 26: // getPrinterSerial
|
||||
@ -1683,7 +1683,7 @@ int chcusb_getPrinterInfo(uint16_t tagNumber, uint8_t *rBuffer, uint32_t *rLen)
|
||||
break;
|
||||
|
||||
case 30: // TODO
|
||||
dprintf("Printer: C3xxusb: Unimpl tagNumber 30\n");
|
||||
dprintf("Printer: C3XXusb: Unimpl tagNumber 30\n");
|
||||
break;
|
||||
|
||||
case 31: // TODO, possibly CardRFIDCheck?
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <stddef.h>
|
||||
|
||||
#include "board/config.h"
|
||||
#include "board/led15093.h"
|
||||
|
||||
#include "gfxhook/gfx.h"
|
||||
|
||||
@ -18,6 +19,7 @@ struct mu3_hook_config {
|
||||
struct dvd_config dvd;
|
||||
struct io4_config io4;
|
||||
struct gfx_config gfx;
|
||||
struct led15093_config led15093;
|
||||
struct mu3_dll_config dll;
|
||||
};
|
||||
|
||||
|
@ -61,7 +61,13 @@ static DWORD CALLBACK mu3_pre_startup(void)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hr = sg_reader_hook_init(&mu3_hook_cfg.aime, 1, mu3_hook_mod);
|
||||
hr = led15093_hook_init(&mu3_hook_cfg.led15093, 3, 1, 1, 2);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = sg_reader_hook_init(&mu3_hook_cfg.aime, 1, 1, mu3_hook_mod);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
goto fail;
|
||||
|
@ -74,7 +74,7 @@ static void dipsw_read_sysfile(const wchar_t *sys_file)
|
||||
|
||||
if (f == NULL)
|
||||
{
|
||||
dprintf("First run detected, DipSw settings can only be applied AFTER the first run\n");
|
||||
dprintf("DipSw: First run detected, DipSw settings can only be applied AFTER the first run\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ static void dipsw_read_sysfile(const wchar_t *sys_file)
|
||||
|
||||
if (file_size != 0x6000)
|
||||
{
|
||||
dprintf("Invalid sysfile.dat file size\n");
|
||||
dprintf("DipSw: Invalid sysfile.dat file size\n");
|
||||
fclose(f);
|
||||
|
||||
return;
|
||||
@ -94,7 +94,6 @@ static void dipsw_read_sysfile(const wchar_t *sys_file)
|
||||
fread(dip_switches.data, 1, file_size, f);
|
||||
fclose(f);
|
||||
|
||||
// memcpy(dip_switches.dip_switch_block, dip_switches.data + 0x2800, BLOCK_SIZE);
|
||||
memcpy(&dip_switches.dip_switch_block, dip_switches.data + 0x2800, BLOCK_SIZE);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user