Improved MGL handling.

This commit is contained in:
Sorgelig
2022-02-28 02:12:48 +08:00
parent 41b8b1fc30
commit 1c250abbce
4 changed files with 96 additions and 92 deletions

View File

@@ -1138,7 +1138,7 @@ void user_io_init(const char *path, const char *xml)
}
video_mode_load();
if(strlen(cfg.font)) LoadFont(cfg.font);
if (strlen(cfg.font)) LoadFont(cfg.font);
load_volume();
user_io_send_buttons(1);
@@ -1150,17 +1150,17 @@ void user_io_init(const char *path, const char *xml)
printf("Unable to identify core (%x)!\n", core_type);
break;
case CORE_TYPE_SHARPMZ:
case CORE_TYPE_SHARPMZ:
printf("Identified Sharp MZ Series core");
user_io_set_core_name("sharpmz");
sharpmz_init();
sharpmz_init();
parse_buttons();
break;
case CORE_TYPE_8BIT:
// try to load config
name = user_io_create_config_name();
if(strlen(name) > 0)
if (strlen(name) > 0)
{
uint32_t status[2] = { 0, 0 };
if (!is_st() && !is_minimig())
@@ -1307,7 +1307,7 @@ void user_io_init(const char *path, const char *xml)
send_rtc(3);
// release reset
if(!is_minimig() && !is_st()) user_io_status(0, UIO_STATUS_RESET);
if (!is_minimig() && !is_st()) user_io_status(0, UIO_STATUS_RESET);
if (xml && isXmlName(xml) == 1) arcade_check_error();
break;
}
@@ -1353,7 +1353,14 @@ void user_io_init(const char *path, const char *xml)
SetMidiLinkMode(midilink);
SetUARTMode(uartmode);
if (mgl_get()->valid == 0xF) mgl_get()->timer = GetTimer(mgl_get()->delay * 1000);
if (mgl_get()->valid != 0xF || is_menu() || is_minimig() || is_st() || is_archie() || user_io_core_type() == CORE_TYPE_SHARPMZ)
{
mgl_get()->done = 1;
}
else
{
mgl_get()->timer = GetTimer(mgl_get()->delay * 1000);
}
}
static int joyswap = 0;
@@ -2913,7 +2920,6 @@ void user_io_poll()
if (core_type == CORE_TYPE_SHARPMZ) sharpmz_poll();
static uint8_t leds = 0;
static uint8_t ps2_scancode_f0 = 0;
if (use_ps2ctl && !is_minimig() && !is_archie())
{
@@ -2932,67 +2938,54 @@ void user_io_poll()
{
cmd = kbd_ctl;
if (ps2_scancode_f0 == 0)
switch (cmd)
{
switch (cmd)
{
case 0xff:
ps2_kbd_scan_set = 2;
kbd_reply(0xFA);
kbd_reply(0xAA);
break;
case 0xff:
ps2_kbd_scan_set = 2;
kbd_reply(0xFA);
kbd_reply(0xAA);
break;
case 0xf2:
kbd_reply(0xFA);
kbd_reply(0xAB);
kbd_reply(0x83);
break;
case 0xF0: // scan get/set
kbd_reply(0xFA);
ps2_scancode_f0 = 1;
break;
case 0xf2:
kbd_reply(0xFA);
kbd_reply(0xAB);
kbd_reply(0x83);
break;
case 0xF6: // set default parameters
kbd_reply(0xFA);
ps2_kbd_scan_set = 2;
break;
case 0xf0: // scan get/set
kbd_reply(0xFA);
byte++;
break;
case 0xf4:
case 0xf5:
case 0xfa:
kbd_reply(0xFA);
break;
case 0xf6: // set default parameters
kbd_reply(0xFA);
ps2_kbd_scan_set = 2;
break;
case 0xed:
kbd_reply(0xFA);
byte++;
break;
case 0xf3: // set type rate
kbd_reply(0xFA);
byte++;
break;
case 0xee:
kbd_reply(0xEE);
break;
case 0xf4:
case 0xf5:
case 0xfa:
kbd_reply(0xFA);
break;
default:
kbd_reply(0xFE);
break;
}
case 0xed:
kbd_reply(0xFA);
byte++;
break;
case 0xee:
kbd_reply(0xEE);
break;
default:
kbd_reply(0xFE);
break;
}
else
{
if (cmd <= 3) {
kbd_reply(0xFA);
if (!cmd) // get
kbd_reply(ps2_kbd_scan_set);
else // set
ps2_kbd_scan_set = cmd;
ps2_scancode_f0 = 0;
}
else {
kbd_reply(0xFE); // RESEND
}
}
}
else
{
@@ -3001,10 +2994,27 @@ void user_io_poll()
case 0xed:
kbd_reply(0xFA);
byte = 0;
if (kbd_ctl & 4) leds |= KBD_LED_CAPS_STATUS;
else leds &= ~KBD_LED_CAPS_STATUS;
break;
case 0xf0:
byte = 0;
if (kbd_ctl <= 3)
{
kbd_reply(0xFA);
if (!kbd_ctl) kbd_reply(ps2_kbd_scan_set); // get
else ps2_kbd_scan_set = kbd_ctl; // set
}
else
{
kbd_reply(0xFE); // RESEND
}
break;
case 0xf3: // set type rate
kbd_reply(0xFA);
byte = 0;
break;
default: