IDE support for Uneon core.

This commit is contained in:
Sorgelig
2023-10-24 22:36:22 +08:00
parent 64b6cc5a88
commit 4fab9a5aa7
5 changed files with 41 additions and 8 deletions

View File

@@ -2333,6 +2333,12 @@ void HandleUI(void)
}
else
{
if (!bit && is_uneon())
{
x86_ide_set();
menustate = MENU_NONE1;
}
if (is_megacd())
{
if (!bit) mcd_set_image(0, "");
@@ -2462,7 +2468,7 @@ void HandleUI(void)
char idx = user_io_ext_idx(selPath, fs_pFileExt) << 6 | ioctl_index;
if (addon[0] == 'f' && addon[1] != '1') process_addon(addon, idx);
else if (is_x86() || is_pcxt())
else if (is_x86() || is_pcxt() || (is_uneon() && idx >= 2))
{
x86_set_image(ioctl_index, selPath);
}

View File

@@ -212,7 +212,7 @@ typedef struct
char img_name[6][1024];
} x86_config;
static x86_config config;
static x86_config config = {};
struct hddInfo* FindHDDInfoBySize(uint64_t size)
{
@@ -508,6 +508,11 @@ static uint8_t bin2bcd(unsigned val)
return ((val / 10) << 4) + (val % 10);
}
void x86_ide_set()
{
for (int i = 0; i < 4; i++) hdd_set(i, config.img_name[i + 2]);
}
void x86_init()
{
user_io_status_set("[0]", 1);
@@ -719,9 +724,9 @@ static void fdd_io(uint8_t read)
}
}
void x86_poll()
void x86_poll(int only_ide)
{
x86_share_poll();
if(!only_ide) x86_share_poll();
uint16_t sd_req = ide_check();
if (sd_req)
@@ -733,7 +738,7 @@ void x86_poll()
ide_io(1, sd_req & 7);
sd_req >>= 3;
if (sd_req & 3) fdd_io(sd_req & 1);
if (!only_ide && (sd_req & 3)) fdd_io(sd_req & 1);
}
}

View File

@@ -2,7 +2,8 @@
#define X86_H
void x86_init();
void x86_poll();
void x86_poll(int only_ide);
void x86_ide_set();
void x86_set_image(int num, char *filename);
const char* x86_get_image_name(int num);

View File

@@ -332,6 +332,13 @@ char is_n64()
return (is_n64_type == 1);
}
static int is_uneon_type = 0;
char is_uneon()
{
if (!is_uneon_type) is_uneon_type = strcasecmp(orig_name, "Uneon") ? 2 : 1;
return (is_uneon_type == 1);
}
static int is_no_type = 0;
static int disable_osd = 0;
char has_menu()
@@ -361,6 +368,7 @@ void user_io_read_core_name()
is_c128_type = 0;
is_st_type = 0;
is_pcxt_type = 0;
is_uneon_type = 0;
core_name[0] = 0;
char *p = user_io_get_confstr(0);
@@ -879,7 +887,7 @@ static void parse_config()
{
int idx = p[2] - '0';
StoreIdx_S(idx, str);
if (is_x86() || is_pcxt())
if (is_x86() || is_pcxt() || (is_uneon() && idx >= 2))
{
x86_set_image(idx, str);
}
@@ -1362,6 +1370,9 @@ void user_io_init(const char *path, const char *xml)
sleep(1);
}
uint8_t hotswap[4] = {};
ide_reset(hotswap);
parse_config();
if (!xml && defmra[0] && FileExists(defmra))
{
@@ -1461,6 +1472,8 @@ void user_io_init(const char *path, const char *xml)
{
const char *home = HomeDir();
if (is_uneon()) x86_ide_set();
if (!strlen(path) || !user_io_file_tx(path, 0, 0, 0, 1))
{
if (!is_cpc())
@@ -2809,6 +2822,7 @@ void user_io_send_buttons(char force)
if (is_pce()) pcecd_reset();
if (is_saturn()) saturn_reset();
if (is_x86() || is_pcxt()) x86_init();
if (is_uneon()) x86_ide_set();
if (is_st()) tos_reset(0);
ResetUART();
}
@@ -2935,7 +2949,7 @@ void user_io_poll()
// sd card emulation
if (is_x86() || is_pcxt())
{
x86_poll();
x86_poll(0);
}
else if ((core_type == CORE_TYPE_8BIT) && !is_menu() && !is_minimig())
{
@@ -2951,6 +2965,12 @@ void user_io_poll()
uint64_t lba;
uint32_t blksz, blks, sz;
if (is_uneon() && i == 3)
{
x86_poll(1);
break;
}
uint16_t c = spi_uio_cmd_cont(UIO_GET_SDSTAT);
if (c & 0x8000)
{

View File

@@ -280,6 +280,7 @@ char is_arcade();
char is_saturn();
char is_pcxt();
char is_n64();
char is_uneon();
#define HomeDir(x) user_io_get_core_path(x)
#define CoreName user_io_get_core_name()