archie: use generic 8bit type.

This commit is contained in:
sorgelig
2019-12-21 02:25:29 +08:00
parent 0e2e0a4b45
commit 7b949f3ded
3 changed files with 73 additions and 50 deletions

View File

@@ -1080,7 +1080,7 @@ void HandleUI(void)
SelectFile(0, SCANO_CORES, MENU_CORE_FILE_SELECTED1, MENU_NONE1);
}
else if (user_io_core_type() == CORE_TYPE_MIST) menustate = MENU_MIST_MAIN1;
else if (user_io_core_type() == CORE_TYPE_ARCHIE) menustate = MENU_ARCHIE_MAIN1;
else if (is_archie_core()) menustate = MENU_ARCHIE_MAIN1;
else {
if (is_menu_core())
{
@@ -1747,7 +1747,7 @@ void HandleUI(void)
else
{
MenuWrite(n++);
MenuWrite(n++, " Reset settings", menusub == 9, user_io_core_type() == CORE_TYPE_ARCHIE);
MenuWrite(n++, " Reset settings", menusub == 9, is_archie_core());
MenuWrite(n++, " Save settings", menusub == 10, 0);
}
@@ -1852,7 +1852,7 @@ void HandleUI(void)
}
break;
case 9:
if (user_io_core_type() != CORE_TYPE_ARCHIE)
if (!is_archie_core())
{
menustate = MENU_RESET1;
menusub = 1;
@@ -1869,7 +1869,7 @@ void HandleUI(void)
menustate = MENU_8BIT_MAIN1;
menusub = 0;
if (user_io_core_type() == CORE_TYPE_ARCHIE)
if (is_archie_core())
{
archie_save_config();
menustate = MENU_ARCHIE_MAIN1;
@@ -1929,6 +1929,11 @@ void HandleUI(void)
menusub = 0;
menustate = MENU_MAIN1;
}
else if (is_archie_core())
{
menusub = 0;
menustate = MENU_ARCHIE_MAIN1;
}
else
{
menusub = 0;
@@ -2133,6 +2138,11 @@ void HandleUI(void)
menusub = 0;
menustate = MENU_MAIN1;
}
else if (is_archie_core())
{
menusub = 0;
menustate = MENU_ARCHIE_MAIN1;
}
else
{
menusub = 0;

View File

@@ -173,11 +173,6 @@ unsigned char user_io_core_type()
return core_type;
}
char is_archie()
{
return(core_type == CORE_TYPE_ARCHIE);
}
char is_sharpmz()
{
return(core_type == CORE_TYPE_SHARPMZ);
@@ -303,6 +298,14 @@ char is_megacd_core()
return (is_megacd_type == 1);
}
static int is_archie_type = 0;
char is_archie_core()
{
if (core_type == CORE_TYPE_ARCHIE) return 1;
if (!is_archie_type) is_archie_type = strcasecmp(core_name, "ARCHIE") ? 2 : 1;
return (is_archie_type == 1);
}
static int is_no_type = 0;
static int disable_osd = 0;
char has_menu()
@@ -838,6 +841,11 @@ void user_io_init(const char *path, const char *xml)
x86_config_load();
x86_init();
}
else if (is_archie_core())
{
puts("Identified Archimedes core");
archie_init();
}
else
{
if (!strlen(path) || !user_io_file_tx(path, 0, 0, 0, 1))
@@ -1894,7 +1902,7 @@ void user_io_send_buttons(char force)
//special reset for some cores
if ((key_map & BUTTON2) && !(map & BUTTON2))
{
if (is_archie()) fpga_load_rbf(name[0] ? name : "Archie.rbf");
if (is_archie_core()) fpga_load_rbf(name[0] ? name : "Archie.rbf");
if (is_minimig()) minimig_reset();
if (is_megacd_core()) mcd_reset();
}
@@ -2604,7 +2612,7 @@ void user_io_poll()
}
}
if (core_type == CORE_TYPE_8BIT && !is_menu_core() && !is_minimig())
if (core_type == CORE_TYPE_8BIT && !is_menu_core() && !is_minimig() && !is_archie_core())
{
// frequently check ps2 mouse for events
if (CheckTimer(mouse_timer))
@@ -2692,11 +2700,11 @@ void user_io_poll()
send_rtc(1);
}
if (core_type == CORE_TYPE_ARCHIE) archie_poll();
if (core_type == CORE_TYPE_ARCHIE || is_archie_core()) archie_poll();
if (core_type == CORE_TYPE_SHARPMZ) sharpmz_poll();
static uint8_t leds = 0;
if(use_ps2ctl && !is_minimig())
if(use_ps2ctl && !is_minimig() && !is_archie_core())
{
leds |= (KBD_LED_FLAG_STATUS | KBD_LED_CAPS_CONTROL);
@@ -3003,6 +3011,41 @@ static void send_keycode(unsigned short key, int press)
return;
}
if (core_type == CORE_TYPE_ARCHIE || is_archie_core())
{
if (press > 1) return;
uint32_t code = get_archie_code(key);
if (code == NONE) return;
//WIN+...
if (get_key_mod() & (RGUI | LGUI))
{
switch (code)
{
case 0x00: code = 0xf; //ESC = BRAKE
break;
case 0x11: code = 0x73; // 1 = Mouse extra 1
break;
case 0x12: code = 0x74; // 2 = Mouse extra 2
break;
case 0x13: code = 0x25; // 3 = KP#
break;
}
}
if (code == 0 && (get_key_mod() & (RGUI | LGUI)))
{
code = 0xF;
}
if (!press) code |= 0x8000;
archie_kbd(code);
return;
}
if (core_type == CORE_TYPE_8BIT)
{
uint32_t code = get_ps2_code(key);
@@ -3075,40 +3118,6 @@ static void send_keycode(unsigned short key, int press)
}
}
if (core_type == CORE_TYPE_ARCHIE)
{
if (press > 1) return;
uint32_t code = get_archie_code(key);
if (code == NONE) return;
//WIN+...
if (get_key_mod() & (RGUI | LGUI))
{
switch(code)
{
case 0x00: code = 0xf; //ESC = BRAKE
break;
case 0x11: code = 0x73; // 1 = Mouse extra 1
break;
case 0x12: code = 0x74; // 2 = Mouse extra 2
break;
case 0x13: code = 0x25; // 3 = KP#
break;
}
}
if (code == 0 && (get_key_mod() & (RGUI | LGUI)))
{
code = 0xF;
}
if (!press) code |= 0x8000;
archie_kbd(code);
}
if (core_type == CORE_TYPE_SHARPMZ)
{
uint32_t code = get_ps2_code(key);
@@ -3144,6 +3153,10 @@ void user_io_mouse(unsigned char b, int16_t x, int16_t y, int16_t w)
mouse_pos[Y] += y;
mouse_flags |= 0x80 | (b & 7);
}
else if (is_archie_core())
{
archie_mouse(b, x, y);
}
else
{
mouse_pos[X] += x;
@@ -3336,14 +3349,14 @@ void user_io_kbd(uint16_t key, int press)
{
if (is_menu_core() && !video_fb_state()) printf("PS2 code(make)%s for core: %d(0x%X)\n", (code & EXT) ? "(ext)" : "", code & 255, code & 255);
if (!osd_is_visible && !is_menu_core() && key == KEY_MENU && press == 3) open_joystick_setup();
else if ((has_menu() || osd_is_visible || (get_key_mod() & (LALT | RALT | RGUI | LGUI))) && (((key == KEY_F12) && ((!is_x86_core() && !is_archie()) || (get_key_mod() & (RGUI | LGUI)))) || key == KEY_MENU)) menu_key_set(KEY_F12);
else if ((has_menu() || osd_is_visible || (get_key_mod() & (LALT | RALT | RGUI | LGUI))) && (((key == KEY_F12) && ((!is_x86_core() && !is_archie_core()) || (get_key_mod() & (RGUI | LGUI)))) || key == KEY_MENU)) menu_key_set(KEY_F12);
else if (osd_is_visible)
{
if (press == 1) menu_key_set(key);
}
else
{
if (((code & EMU_SWITCH_1) || ((code & EMU_SWITCH_2) && !use_ps2ctl && !is_archie())) && !is_menu_core())
if (((code & EMU_SWITCH_1) || ((code & EMU_SWITCH_2) && !use_ps2ctl && !is_archie_core())) && !is_menu_core())
{
if (press == 1)
{

View File

@@ -279,13 +279,13 @@ void diskled_on();
void parse_cue_file(void);
char is_minimig();
char is_archie();
char is_sharpmz();
char is_menu_core();
char is_x86_core();
char is_snes_core();
char is_neogeo_core();
char is_megacd_core();
char is_archie_core();
#define HomeDir (is_menu_core() ? "Scripts" : user_io_get_core_path())
#define CoreName (is_menu_core() ? "Scripts" : user_io_get_core_name())