PCMCIA support rewrite.

This commit is contained in:
Toni Wilen 2019-06-18 20:30:32 +03:00
parent f5d8397496
commit d07ec9ed07
13 changed files with 362 additions and 210 deletions

View File

@ -1100,15 +1100,13 @@ static void write_filesys_config (struct uae_prefs *p, struct zfile *f)
} else if (ct >= HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST && ct <= HD_CONTROLLER_TYPE_IDE_LAST) {
_stprintf(hdcs, _T("ide%d_%s"), ci->controller_unit, expansionroms[ct - HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST].name);
romtype = expansionroms[ct - HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST].romtype;
} else if (ct >= HD_CONTROLLER_TYPE_CUSTOM_FIRST && ct <= HD_CONTROLLER_TYPE_CUSTOM_LAST) {
_stprintf(hdcs, _T("custom%d_%s"), ci->controller_unit, expansionroms[ct - HD_CONTROLLER_TYPE_CUSTOM_FIRST].name);
romtype = expansionroms[ct - HD_CONTROLLER_TYPE_CUSTOM_FIRST].romtype;
} else if (ct == HD_CONTROLLER_TYPE_SCSI_AUTO) {
_stprintf(hdcs, _T("scsi%d"), ci->controller_unit);
} else if (ct == HD_CONTROLLER_TYPE_IDE_AUTO) {
_stprintf(hdcs, _T("ide%d"), ci->controller_unit);
} else if (ct == HD_CONTROLLER_TYPE_PCMCIA) {
if (ci->controller_type_unit == 0)
_tcscpy(hdcs, _T("scsram"));
else
_tcscpy(hdcs, _T("scide"));
} else if (ct == HD_CONTROLLER_TYPE_UAE) {
_stprintf(hdcs, _T("uae%d"), ci->controller_unit);
}
@ -1120,7 +1118,7 @@ static void write_filesys_config (struct uae_prefs *p, struct zfile *f)
}
}
}
if (ci->controller_type_unit > 0 && ct != HD_CONTROLLER_TYPE_PCMCIA)
if (ci->controller_type_unit > 0)
_stprintf(hdcs + _tcslen(hdcs), _T("-%d"), ci->controller_type_unit + 1);
str1b = cfgfile_escape (str1, _T(":,"), true);
@ -1452,7 +1450,7 @@ static void cfgfile_write_board_rom(struct uae_prefs *prefs, struct zfile *f, st
_stprintf(buf, _T("%s%s_rom"), name, i ? _T("_ext") : _T(""));
cfgfile_dwrite_str (f, buf, rc->romident);
}
if (rc->autoboot_disabled || ert->subtypes || ert->settings || ert->id_jumper || br->device_order > 0 || is_custom_romboard(br)) {
if (rc->autoboot_disabled || rc->inserted || ert->subtypes || ert->settings || ert->id_jumper || br->device_order > 0 || is_custom_romboard(br)) {
TCHAR buf2[256], *p;
buf2[0] = 0;
p = buf2;
@ -1477,6 +1475,11 @@ static void cfgfile_write_board_rom(struct uae_prefs *prefs, struct zfile *f, st
_tcscat(buf2, _T(","));
_tcscat(buf2, _T("autoboot_disabled=true"));
}
if (rc->inserted) {
if (buf2[0])
_tcscat(buf2, _T(","));
_tcscat(buf2, _T("inserted=true"));
}
if (ert->id_jumper) {
TCHAR tmp[256];
_stprintf(tmp, _T("id=%d"), rc->device_id);
@ -2370,7 +2373,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
_tcscat(s, _T(",default"));
if (cr->filterprofile[0]) {
TCHAR *se = cfgfile_escape(cr->filterprofile, _T(","), true);
s += _stprintf(s, _T(",filter=%s"), cr->filterprofile);
s += _stprintf(s, _T(",filter=%s"), se);
xfree(se);
}
if (cr->commands[0]) {
@ -4408,19 +4411,16 @@ static void get_filesys_controller (const TCHAR *hdc, int *type, int *typenum, i
hdunit = hdc[3] - '0';
if (hdunit < 0 || hdunit >= 6)
hdunit = 0;
} else if(_tcslen (hdc) >= 5 && !_tcsncmp (hdc, _T("scsi"), 4)) {
} else if (_tcslen(hdc) >= 5 && !_tcsncmp(hdc, _T("scsi"), 4)) {
hdcv = HD_CONTROLLER_TYPE_SCSI_AUTO;
hdunit = hdc[4] - '0';
if (hdunit < 0 || hdunit >= 8 + 2)
hdunit = 0;
} else if (_tcslen(hdc) >= 6 && !_tcsncmp(hdc, _T("scsram"), 6)) {
hdcv = HD_CONTROLLER_TYPE_PCMCIA;
hdunit = 0;
idx = 0;
} else if (_tcslen(hdc) >= 5 && !_tcsncmp(hdc, _T("scide"), 5)) {
hdcv = HD_CONTROLLER_TYPE_PCMCIA;
hdunit = 0;
idx = 1;
} else if (_tcslen(hdc) >= 7 && !_tcsncmp(hdc, _T("custom"), 6)) {
hdcv = HD_CONTROLLER_TYPE_CUSTOM_FIRST;
hdunit = hdc[6] - '0';
if (hdunit < 0 || hdunit >= 8)
hdunit = 0;
}
if (hdcv == HD_CONTROLLER_TYPE_UAE) {
hdunit = _tstol(hdc + 3);
@ -4449,15 +4449,20 @@ static void get_filesys_controller (const TCHAR *hdc, int *type, int *typenum, i
if (hdcontrollers[i].romtype) {
for (int j = 0; expansionroms[j].name; j++) {
if ((expansionroms[j].romtype & ROMTYPE_MASK) == hdcontrollers[i].romtype) {
hdcv = hdcv == HD_CONTROLLER_TYPE_IDE_AUTO ? j + HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST : j + HD_CONTROLLER_TYPE_SCSI_EXPANSION_FIRST;
if (hdcv == HD_CONTROLLER_TYPE_IDE_AUTO) {
hdcv = j + HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST;
} else if (hdcv == HD_CONTROLLER_TYPE_SCSI_AUTO) {
hdcv = j + HD_CONTROLLER_TYPE_SCSI_EXPANSION_FIRST;
} else {
hdcv = j + HD_CONTROLLER_TYPE_CUSTOM_FIRST;
}
break;
}
}
}
if (hdcv == HD_CONTROLLER_TYPE_IDE_AUTO) {
hdcv = i;
}
else if (hdcv == HD_CONTROLLER_TYPE_SCSI_AUTO) {
} else if (hdcv == HD_CONTROLLER_TYPE_SCSI_AUTO) {
hdcv = i + HD_CONTROLLER_EXPANSION_MAX;
}
found = true;
@ -4471,9 +4476,10 @@ static void get_filesys_controller (const TCHAR *hdc, int *type, int *typenum, i
if (_tcslen(ert->name) == len && !_tcsnicmp(ext, ert->name, len)) {
if (hdcv == HD_CONTROLLER_TYPE_IDE_AUTO) {
hdcv = HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST + i;
}
else {
} else if (hdcv == HD_CONTROLLER_TYPE_SCSI_AUTO) {
hdcv = HD_CONTROLLER_TYPE_SCSI_EXPANSION_FIRST + i;
} else {
hdcv = HD_CONTROLLER_TYPE_CUSTOM_FIRST + i;
}
break;
}
@ -5184,6 +5190,9 @@ static bool cfgfile_read_board_rom(struct uae_prefs *p, const TCHAR *option, con
if (cfgfile_option_bool(buf2, _T("autoboot_disabled")) == 1) {
brc->roms[idx].autoboot_disabled = true;
}
if (cfgfile_option_bool(buf2, _T("inserted")) == 1) {
brc->roms[idx].inserted= true;
}
p = cfgfile_option_get(buf2, _T("order"));
if (p) {
brc->device_order = _tstol(p);

View File

@ -4920,6 +4920,12 @@ const struct expansionromtype expansionroms[] = {
/* SCSI/IDE expansion */
{
_T("pcmciaide"), _T("PCMCIA IDE"), NULL,
NULL, gayle_init_board_io_pcmcia, NULL, NULL, ROMTYPE_PCMCIAIDE | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true,
NULL, 0,
false, EXPANSIONTYPE_IDE | EXPANSIONTYPE_PCMCIA,
},
{
_T("apollo"), _T("Apollo 500/2000"), _T("3-State"),
NULL, apollo_init_hd, NULL, apollo_add_scsi_unit, ROMTYPE_APOLLOHD, 0, 0, BOARD_AUTOCONFIG_Z2, false,
@ -4934,6 +4940,12 @@ const struct expansionromtype expansionroms[] = {
false, EXPANSIONTYPE_SCSI,
8498, 27, 0, true, NULL
},
{
_T("overdrivehd"), _T("Overdrive HD"), _T("Archos"),
NULL, gayle_init_board_common_pcmcia, NULL, NULL, ROMTYPE_ARCHOSHD, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true,
NULL, 0,
false, EXPANSIONTYPE_IDE | EXPANSIONTYPE_PCMCIA,
},
{
_T("addhard"), _T("AddHard"), _T("Ashcom Design"),
NULL, addhard_init, NULL, addhard_add_scsi_unit, ROMTYPE_ADDHARD, 0, 0, BOARD_AUTOCONFIG_Z2, false,
@ -5692,10 +5704,10 @@ const struct expansionromtype expansionroms[] = {
{ 0x82, 0x64, 0x32, 0x00, 4626 >> 8, 4626 & 255, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00 }
},
{
_T("ne2000_pcmcia"), _T("RTL8019 PCMCIA (NE2000 compatible)"), NULL,
NULL, gayle_init_ne2000_pcmcia, NULL, NULL, ROMTYPE_NE2KPCMCIA | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true,
_T("ne2000pcmcia"), _T("RTL8019 PCMCIA (NE2000 compatible)"), NULL,
NULL, gayle_init_board_io_pcmcia, NULL, NULL, ROMTYPE_NE2KPCMCIA | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true,
NULL, 0,
false, EXPANSIONTYPE_NET,
false, EXPANSIONTYPE_NET | EXPANSIONTYPE_PCMCIA,
0, 0, 0, false, NULL,
false, 0, ethernet_settings,
},
@ -5778,13 +5790,19 @@ const struct expansionromtype expansionroms[] = {
},
{
_T("pcmcia_mb"), _T("A600/A1200 PCMCIA"), _T("Commodore"),
NULL, gayle_pcmcia_init, NULL, gayle_add_pcmcia_unit, ROMTYPE_MB_PCMCIA | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true,
NULL, gayle_init_pcmcia, NULL, NULL, ROMTYPE_MB_PCMCIA | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true,
NULL, 0,
false, EXPANSIONTYPE_INTERNAL
},
// misc
{
_T("pcmciasram"), _T("PCMCIA SRAM"), NULL,
NULL, gayle_init_board_common_pcmcia, NULL, NULL, ROMTYPE_PCMCIASRAM | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true,
NULL, 0,
false, EXPANSIONTYPE_CUSTOM | EXPANSIONTYPE_PCMCIA | EXPANSIONTYPE_CUSTOMDISK,
},
{
_T("uaeboard_z2"), _T("UAEBOARD Z2"), NULL,
NULL, uaesndboard_init_z2, NULL, NULL, ROMTYPE_UAEBOARDZ2 | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, true,

View File

@ -1113,6 +1113,7 @@ static void initialize_mountinfo (void)
if (added)
break;
}
#if 0
} else if (type == HD_CONTROLLER_TYPE_PCMCIA) {
if (uci->controller_type_unit == 0) {
gayle_add_pcmcia_sram_unit (uci);
@ -1121,6 +1122,7 @@ static void initialize_mountinfo (void)
gayle_add_pcmcia_ide_unit (uci);
added = true;
}
#endif
}
if (added)
allocuci (&currprefs, nr, -1);
@ -2227,17 +2229,6 @@ int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_conf
return 0;
}
int hardfile_added (struct uaedev_config_info *ci)
{
if (ci->controller_type == HD_CONTROLLER_TYPE_PCMCIA) {
if (ci->controller_type_unit == 1)
return gayle_add_pcmcia_ide_unit(ci);
if (ci->controller_type_unit == 0)
return gayle_add_pcmcia_sram_unit(ci);
}
return 0;
}
int hardfile_media_change (struct hardfiledata *hfd, struct uaedev_config_info *ci, bool inserted, bool timer)
{
if (!hfd)

333
gayle.cpp
View File

@ -39,6 +39,7 @@
#define PCMCIA_SRAM 1
#define PCMCIA_IDE 2
#define PCMCIA_NE2000 3
#define PCMCIA_ARCHOSHD 4
/*
600000 to 9FFFFF 4 MB Credit Card memory if CC present
@ -146,6 +147,7 @@ DE0000 to DEFFFF 64 KB Motherboard resources
#define PCMCIA_IDE_ID 2
static struct ide_hdf *idedrive[TOTAL_IDE * 2];
static struct ide_hdf *archoshd[2];
struct hd_hardfiledata *pcmcia_sram;
static int pcmcia_card;
@ -158,7 +160,7 @@ static int gayle_id_cnt;
static uae_u8 gayle_irq, gayle_int, gayle_cs, gayle_cs_mask, gayle_cfg;
static int ide_splitter;
static struct ide_thread_state gayle_its;
static struct ide_thread_state gayle_its, pcmcia_its;
static bool ne2000_pcmcia_irq;
@ -838,7 +840,6 @@ static void REGPARAM2 gayle2_bput (uaecptr addr, uae_u32 value)
}
static uae_u8 ramsey_config;
static int garyidoffset;
static int gary_coldboot;
int gary_timeout;
int gary_toenb;
@ -848,11 +849,9 @@ static void mbres_write (uaecptr addr, uae_u32 val, int size)
addr &= 0xffff;
if (MBRES_LOG > 0)
write_log (_T("MBRES_WRITE %08X=%08X (%d) PC=%08X S=%d\n"), addr, val, size, M68K_GETPC, regs.s);
if (addr < 0x8000 && (1 || regs.s)) { /* CPU FC = supervisor only */
if (addr < 0x8000) {
uae_u32 addr2 = addr & 3;
uae_u32 addr64 = (addr >> 6) & 3;
if (addr == 0x1002)
garyidoffset = -1;
if (addr64 == 0 && addr2 == 0x03)
ramsey_config = val;
if (addr2 == 0x02)
@ -870,47 +869,37 @@ static uae_u32 mbres_read (uaecptr addr, int size)
addr &= 0xffff;
if (1 || regs.s) { /* CPU FC = supervisor only (only newest ramsey/gary? never implemented?) */
uae_u32 addr2 = addr & 3;
uae_u32 addr64 = (addr >> 6) & 3;
/* Gary ID (I don't think this exists in real chips..) */
if (addr == 0x1002 && currprefs.cs_fatgaryrev >= 0) {
garyidoffset++;
garyidoffset &= 7;
v = (currprefs.cs_fatgaryrev << garyidoffset) & 0x80;
}
for (;;) {
if (addr64 == 1 && addr2 == 0x03) { /* RAMSEY revision */
if (currprefs.cs_ramseyrev >= 0)
v = currprefs.cs_ramseyrev;
break;
}
if (addr64 == 0 && addr2 == 0x03) { /* RAMSEY config */
if (currprefs.cs_ramseyrev >= 0)
v = ramsey_config;
break;
}
if (addr2 == 0x03) {
v = 0xff;
break;
}
if (addr2 == 0x02) { /* coldreboot flag */
if (currprefs.cs_fatgaryrev >= 0)
v = gary_coldboot ? 0x80 : 0x00;
}
if (addr2 == 0x01) { /* toenb flag */
if (currprefs.cs_fatgaryrev >= 0)
v = gary_toenb ? 0x80 : 0x00;
}
if (addr2 == 0x00) { /* timeout flag */
if (currprefs.cs_fatgaryrev >= 0)
v = gary_timeout ? 0x80 : 0x00;
}
v |= 0x7f;
uae_u32 addr2 = addr & 3;
uae_u32 addr64 = (addr >> 6) & 3;
for (;;) {
if (addr64 == 1 && addr2 == 0x03) { /* RAMSEY revision */
if (currprefs.cs_ramseyrev >= 0)
v = currprefs.cs_ramseyrev;
break;
}
} else {
v = 0xff;
if (addr64 == 0 && addr2 == 0x03) { /* RAMSEY config */
if (currprefs.cs_ramseyrev >= 0)
v = ramsey_config;
break;
}
if (addr2 == 0x03) {
v = 0xff;
break;
}
if (addr2 == 0x02) { /* coldreboot flag */
if (currprefs.cs_fatgaryrev >= 0)
v = gary_coldboot ? 0x80 : 0x00;
}
if (addr2 == 0x01) { /* toenb flag */
if (currprefs.cs_fatgaryrev >= 0)
v = gary_toenb ? 0x80 : 0x00;
}
if (addr2 == 0x00) { /* timeout flag */
if (currprefs.cs_fatgaryrev >= 0)
v = gary_timeout ? 0x80 : 0x00;
}
v |= 0x7f;
break;
}
if (MBRES_LOG > 0)
write_log (_T("MBRES_READ %08X=%08X (%d) PC=%08X S=%d\n"), addr, v, size, M68K_GETPC, regs.s);
@ -992,6 +981,8 @@ void gayle_hsync(void)
ne2000->hsync(ne2000_board_state);
if (ide_interrupt_hsync(idedrive[0]) || ide_interrupt_hsync(idedrive[2]) || ide_interrupt_hsync(idedrive[4]) || checkpcmciane2000irq())
devices_rethink_all(rethink_gayle);
if (archoshd[0])
ide_interrupt_hsync(archoshd[0]);
}
static uaecptr from_gayle_pcmcmia(uaecptr addr)
@ -1369,10 +1360,12 @@ static void initsramattr (int size, int readonly)
*p++ = 0xff;
}
static void checkflush (int addr)
static void check_sram_flush (int addr)
{
if (pcmcia_card == 0 || pcmcia_sram == 0)
return;
if (pcmcia_readonly)
return;
if (addr >= 0 && pcmcia_common[0] == 0 && pcmcia_common[1] == 0 && pcmcia_common[2] == 0)
return; // do not flush periodically if used as a ram expension
if (addr < 0) {
@ -1402,7 +1395,7 @@ static void checkflush (int addr)
static int freepcmcia (int reset)
{
if (pcmcia_sram) {
checkflush (-1);
check_sram_flush(-1);
if (reset) {
hdf_hd_close (pcmcia_sram);
xfree (pcmcia_sram);
@ -1516,6 +1509,34 @@ static int initpcmcia (const TCHAR *path, int readonly, int type, int reset, str
pcmcia_card = 1;
initne2000attr();
}
} else if (type == PCMCIA_ARCHOSHD) {
pcmcia_sram->hfd.drive_empty = 0;
pcmcia_common_size = 0;
pcmcia_readonly = 1;
pcmcia_type = type;
pcmcia_common_size = 4 * 1024 * 1024;
pcmcia_common = xcalloc(uae_u8, pcmcia_common_size);
pcmcia_attrs_size = 0;
pcmcia_card = 1;
struct romconfig *rc = get_device_romconfig(&currprefs, ROMTYPE_ARCHOSHD, 0);
if (rc) {
load_rom_rc(rc, ROMTYPE_ARCHOSHD, 32768, 0, pcmcia_common, pcmcia_common_size, 0);
}
pcmcia_its.idetable = archoshd;
pcmcia_its.idetotal = 2;
start_ide_thread(&pcmcia_its);
alloc_ide_mem(archoshd, 2, &pcmcia_its);
if (reset && path) {
add_ide_unit(archoshd, 2, 0, uci, rc);
archoshd[0]->byteswap = true;
}
ide_initialize(archoshd, 0);
}
if (pcmcia_card && !(gayle_cs & GAYLE_CS_DIS)) {
@ -1528,7 +1549,17 @@ static int initpcmcia (const TCHAR *path, int readonly, int type, int reset, str
return 1;
}
static uae_u32 gayle_common_read (uaecptr addr)
static int archoshd_reg(uaecptr addr)
{
if ((addr & 0x7f80) != 0x7f80)
return -1;
int reg = (addr >> 2) & 7;
if (addr & 0x40)
reg |= IDE_SECONDARY;
return reg;
}
static uae_u32 gayle_common_read_byte(uaecptr addr)
{
uae_u8 v = 0;
if (PCMCIA_LOG > 2)
@ -1537,25 +1568,40 @@ static uae_u32 gayle_common_read (uaecptr addr)
return 0;
addr -= PCMCIA_COMMON_START & (PCMCIA_COMMON_SIZE - 1);
addr &= PCMCIA_COMMON_SIZE - 1;
if (addr < pcmcia_common_size)
if (addr < pcmcia_common_size) {
if (pcmcia_type == PCMCIA_ARCHOSHD) {
if (addr >= 0x7fa0) {
int reg = archoshd_reg(addr);
v = ide_read_reg(archoshd[0], reg);
return v;
}
}
v = pcmcia_common[addr];
}
return v;
}
static void gayle_common_write (uaecptr addr, uae_u32 v)
static void gayle_common_write_byte(uaecptr addr, uae_u32 v)
{
if (PCMCIA_LOG > 2)
write_log (_T("PCMCIA COMMON W: %x=%x %x\n"), addr, v, M68K_GETPC);
if (!pcmcia_common_size)
return;
if (pcmcia_readonly)
return;
addr -= PCMCIA_COMMON_START & (PCMCIA_COMMON_SIZE - 1);
addr &= PCMCIA_COMMON_SIZE - 1;
if (addr < pcmcia_common_size) {
if (pcmcia_common[addr] != v) {
checkflush (addr);
pcmcia_common[addr] = v;
if (pcmcia_type == PCMCIA_ARCHOSHD) {
if (addr >= 0x7fa0) {
int reg = archoshd_reg(addr);
ide_write_reg(archoshd[0], reg, v);
}
} else {
if (pcmcia_readonly)
return;
if (pcmcia_common[addr] != v) {
check_sram_flush(addr);
pcmcia_common[addr] = v;
}
}
}
}
@ -1696,13 +1742,17 @@ static uae_u32 REGPARAM2 gayle_common_lget (uaecptr addr)
static uae_u32 REGPARAM2 gayle_common_wget (uaecptr addr)
{
uae_u16 v;
v = gayle_common_bget (addr) << 8;
v |= gayle_common_bget (addr + 1);
if (pcmcia_type == PCMCIA_ARCHOSHD && archoshd_reg(addr) >= 0) {
v = ide_get_data(archoshd[0]);
} else {
v = gayle_common_bget(addr) << 8;
v |= gayle_common_bget(addr + 1);
}
return v;
}
static uae_u32 REGPARAM2 gayle_common_bget (uaecptr addr)
{
return gayle_common_read (addr);
return gayle_common_read_byte (addr);
}
static void REGPARAM2 gayle_common_lput (uaecptr addr, uae_u32 value)
{
@ -1711,25 +1761,30 @@ static void REGPARAM2 gayle_common_lput (uaecptr addr, uae_u32 value)
}
static void REGPARAM2 gayle_common_wput (uaecptr addr, uae_u32 value)
{
gayle_common_bput (addr, value >> 8);
gayle_common_bput (addr + 1, value & 0xff);
if (pcmcia_type == PCMCIA_ARCHOSHD && archoshd_reg(addr) >= 0) {
ide_put_data(archoshd[0], value);
} else {
gayle_common_bput(addr, value >> 8);
gayle_common_bput(addr + 1, value & 0xff);
}
}
static void REGPARAM2 gayle_common_bput (uaecptr addr, uae_u32 value)
{
gayle_common_write (addr, value);
gayle_common_write_byte (addr, value);
}
void gayle_map_pcmcia (void)
{
if (currprefs.cs_pcmcia == 0)
return;
struct autoconfig_info *aci = expansion_get_autoconfig_by_address(&currprefs, 6 * 1024 * 1024);
if (pcmcia_card == 0 || (gayle_cs & GAYLE_CS_DIS)) {
map_banks_cond (&dummy_bank, 0xa0, 8, 0);
if (currprefs.chipmem_size <= 4 * 1024 * 1024 && !expansion_get_autoconfig_by_address(&currprefs, 4 * 1024 * 1024))
if (currprefs.chipmem_size <= 4 * 1024 * 1024 && (!aci || aci->zorro == 0))
map_banks_cond (&dummy_bank, PCMCIA_COMMON_START >> 16, PCMCIA_COMMON_SIZE >> 16, 0);
} else {
map_banks_cond (&gayle_attr_bank, 0xa0, 8, 0);
if (currprefs.chipmem_size <= 4 * 1024 * 1024 && !expansion_get_autoconfig_by_address(&currprefs, 4 * 1024 * 1024))
if (currprefs.chipmem_size <= 4 * 1024 * 1024 && (!aci || aci->zorro == 0))
map_banks_cond (&gayle_common_bank, PCMCIA_COMMON_START >> 16, PCMCIA_COMMON_SIZE >> 16, 0);
}
}
@ -1784,60 +1839,126 @@ bool gayle_ide_init(struct autoconfig_info *aci)
return true;
}
static int gayle_ne2000_unit(int insert)
bool gayle_init_board_io_pcmcia(struct autoconfig_info *aci)
{
if (insert)
return initpcmcia(NULL, 0, PCMCIA_NE2000, 1, NULL);
else
return freepcmcia(0);
}
bool gayle_init_ne2000_pcmcia(struct autoconfig_info *aci)
{
aci->start = 0xa00000;
aci->size = 0x1000;
aci->start = PCMCIA_ATTRIBUTE_START;
aci->size = PCMCIA_ATTRIBUTE_SIZE;
aci->zorro = 0;
aci->parent_address_space = true;
return true;
}
int gayle_add_pcmcia_sram_unit (struct uaedev_config_info *uci)
bool gayle_init_board_common_pcmcia(struct autoconfig_info *aci)
{
return initpcmcia (uci->rootdir, uci->readonly, PCMCIA_SRAM, 1, NULL);
aci->start = PCMCIA_COMMON_START;
aci->size = PCMCIA_COMMON_SIZE;
aci->zorro = 0;
aci->parent_address_space = true;
return true;
}
int gayle_add_pcmcia_ide_unit (struct uaedev_config_info *uci)
bool gayle_init_pcmcia(struct autoconfig_info *aci)
{
return initpcmcia (uci->rootdir, 0, PCMCIA_IDE, 1, uci);
}
int gayle_modify_pcmcia_sram_unit (struct uaedev_config_info *uci, int insert)
{
if (insert)
return initpcmcia (uci->rootdir, uci->readonly, PCMCIA_SRAM, pcmcia_sram ? 0 : 1, NULL);
else
return freepcmcia (0);
}
int gayle_modify_pcmcia_ide_unit (struct uaedev_config_info *uci, int insert)
{
if (insert)
return initpcmcia (uci->rootdir, 0, PCMCIA_IDE, pcmcia_sram ? 0 : 1, uci);
else
return freepcmcia (0);
}
void gayle_add_pcmcia_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc)
{
}
bool gayle_pcmcia_init(struct autoconfig_info *aci)
{
aci->start = 0x600000;
aci->start = PCMCIA_COMMON_START;
aci->size = 0xa80000 - aci->start;
aci->zorro = 0;
return true;
}
// eject any inserted PCMCIA card
void pcmcia_eject(struct uae_prefs *p)
{
for (int i = 0; i < MAX_EXPANSION_BOARDS; i++) {
struct boardromconfig *brc_changed = &changed_prefs.expansionboard[i];
struct boardromconfig *brc = &p->expansionboard[i];
if (brc->device_type) {
const struct expansionromtype *ert = get_device_expansion_rom(brc->device_type);
if (ert && (ert->deviceflags & EXPANSIONTYPE_PCMCIA) && brc->roms[0].inserted) {
write_log(_T("PCMCIA: '%s' removed\n"), ert->friendlyname);
brc->roms[0].inserted = false;
brc_changed->roms[0].inserted = false;
freepcmcia(0);
}
}
}
}
static void pcmcia_card_check(int changecheck)
{
// allow only max single PCMCIA care inserted
bool found = false;
for (int i = 0; i < MAX_EXPANSION_BOARDS; i++) {
struct boardromconfig *brc_prev = &currprefs.expansionboard[i];
struct boardromconfig *brc = &changed_prefs.expansionboard[i];
if (brc->device_type) {
const struct expansionromtype *ert = get_device_expansion_rom(brc->device_type);
if (ert && ert->deviceflags & EXPANSIONTYPE_PCMCIA) {
if (found) {
brc->roms[0].inserted = false;
brc_prev->roms[0].inserted = false;
} else if (brc->roms[0].inserted) {
found = true;
}
}
}
}
for (int i = 0; i < MAX_EXPANSION_BOARDS; i++) {
struct boardromconfig *brc_prev = &currprefs.expansionboard[i];
struct boardromconfig *brc = &changed_prefs.expansionboard[i];
if (brc->device_type) {
const struct expansionromtype *ert = get_device_expansion_rom(brc->device_type);
if (ert && ert->deviceflags & EXPANSIONTYPE_PCMCIA) {
if ((changecheck && brc->roms[0].inserted != brc_prev->roms[0].inserted) || (!changecheck && brc->roms[0].inserted)) {
write_log(_T("PCMCIA: '%s' inserted=%d\n"), ert->friendlyname, brc->roms[0].inserted);
if (!brc->roms[0].inserted) {
// eject card
freepcmcia(0);
} else {
// find matching disk (if it exist)
struct uaedev_config_data *ucd = NULL;
for (int i = 0; i < currprefs.mountitems; i++) {
struct uaedev_config_data *ucdx = &currprefs.mountconfig[i];
const struct expansionromtype *ert = get_unit_expansion_rom(ucdx->ci.controller_type);
if (ert && ert->romtype == brc->device_type) {
ucd = ucdx;
break;
}
}
int readonly = 1;
switch (brc->device_type & ROMTYPE_MASK)
{
case ROMTYPE_NE2KPCMCIA:
pcmcia_type = PCMCIA_NE2000;
break;
case ROMTYPE_ARCHOSHD:
pcmcia_type = PCMCIA_ARCHOSHD;
break;
case ROMTYPE_PCMCIAIDE:
pcmcia_type = PCMCIA_IDE;
if (ucd)
readonly = ucd->ci.readonly;
break;
case ROMTYPE_PCMCIASRAM:
pcmcia_type = PCMCIA_SRAM;
if (ucd)
readonly = ucd->ci.readonly;
break;
}
if (ucd) {
// insert (disk type)
initpcmcia(ucd->ci.rootdir, readonly, pcmcia_type, 1, &ucd->ci);
} else {
// insert (other, for example NIC)
initpcmcia(NULL, 0, pcmcia_type, 1, NULL);
}
}
board_prefs_changed(brc->device_type, 0);
}
}
}
}
}
static void initide (void)
{
@ -1861,6 +1982,7 @@ static void initide (void)
void gayle_free (void)
{
stop_ide_thread(&gayle_its);
stop_ide_thread(&pcmcia_its);
}
void gayle_reset (int hardreset)
@ -1886,18 +2008,15 @@ void gayle_reset (int hardreset)
#endif
gayle_bank.name = bankname;
gayle_dataflyer_enable(false);
if (is_board_enabled(&currprefs, ROMTYPE_NE2KPCMCIA, 0))
gayle_ne2000_unit(1);
pcmcia_card_check(0);
}
void check_prefs_changed_gayle(void)
{
if (!currprefs.cs_pcmcia)
return;
if (is_board_enabled(&currprefs, ROMTYPE_NE2KPCMCIA, 0) != is_board_enabled(&changed_prefs, ROMTYPE_NE2KPCMCIA, 0)) {
board_prefs_changed(ROMTYPE_NE2KPCMCIA, 0);
gayle_ne2000_unit(is_board_enabled(&currprefs, ROMTYPE_NE2KPCMCIA, 0));
}
pcmcia_card_check(1);
}
uae_u8 *restore_gayle (uae_u8 *src)

View File

@ -2347,6 +2347,7 @@ void hardfile_do_disk_change (struct uaedev_config_data *uci, bool insert)
int fsid = uci->configoffset;
struct hardfiledata *hfd;
#if 0
if (uci->ci.controller_type == HD_CONTROLLER_TYPE_PCMCIA) {
if (uci->ci.controller_type_unit == 0) {
gayle_modify_pcmcia_sram_unit (&uci->ci, insert);
@ -2355,6 +2356,7 @@ void hardfile_do_disk_change (struct uaedev_config_data *uci, bool insert)
}
return;
}
#endif
hfd = get_hardfile_data (fsid);
if (!hfd)
return;

View File

@ -189,6 +189,8 @@ typedef void(*DEVICE_MEMORY_CALLBACK)(struct romconfig*, uae_u8*, int);
#define EXPANSIONTYPE_FALLBACK_DISABLE 0x8000
#define EXPANSIONTYPE_HAS_FALLBACK 0x10000
#define EXPANSIONTYPE_X86_EXPANSION 0x20000
#define EXPANSIONTYPE_PCMCIA 0x40000
#define EXPANSIONTYPE_CUSTOMDISK 0x80000
#define EXPANSIONBOARD_CHECKBOX 0
#define EXPANSIONBOARD_MULTI 1

View File

@ -96,8 +96,8 @@ struct hd_hardfiledata {
int ansi_version;
};
#define HD_CONTROLLER_EXPANSION_MAX 120
#define HD_CONTROLLER_NEXT_UNIT 300
#define HD_CONTROLLER_EXPANSION_MAX 190
#define HD_CONTROLLER_NEXT_UNIT 600
#define HD_CONTROLLER_TYPE_UAE 0
#define HD_CONTROLLER_TYPE_IDE_AUTO (HD_CONTROLLER_TYPE_UAE + 1)
@ -110,7 +110,8 @@ struct hd_hardfiledata {
#define HD_CONTROLLER_TYPE_SCSI_EXPANSION_FIRST (HD_CONTROLLER_TYPE_SCSI_FIRST + 1)
#define HD_CONTROLLER_TYPE_SCSI_LAST (HD_CONTROLLER_TYPE_SCSI_EXPANSION_FIRST + HD_CONTROLLER_EXPANSION_MAX - 1)
#define HD_CONTROLLER_TYPE_PCMCIA (HD_CONTROLLER_TYPE_SCSI_LAST + 1)
#define HD_CONTROLLER_TYPE_CUSTOM_FIRST (HD_CONTROLLER_TYPE_SCSI_LAST + 1)
#define HD_CONTROLLER_TYPE_CUSTOM_LAST (HD_CONTROLLER_TYPE_CUSTOM_FIRST + HD_CONTROLLER_EXPANSION_MAX - 1)
#define FILESYS_VIRTUAL 0
#define FILESYS_HARDFILE 1
@ -140,7 +141,6 @@ extern int get_native_path(TrapContext *ctx, uae_u32 lock, TCHAR *out);
extern void hardfile_do_disk_change (struct uaedev_config_data *uci, bool insert);
extern void hardfile_send_disk_change (struct hardfiledata *hfd, bool insert);
extern int hardfile_media_change (struct hardfiledata *hfd, struct uaedev_config_info *ci, bool inserted, bool timer);
extern int hardfile_added (struct uaedev_config_info *ci);
void hdf_hd_close(struct hd_hardfiledata *hfd);
int hdf_hd_open(struct hd_hardfiledata *hfd);

View File

@ -8,24 +8,22 @@ extern void gayle_hsync (void);
extern void gayle_free (void);
extern void gayle_add_ide_unit (int ch, struct uaedev_config_info *ci, struct romconfig *rc);
extern bool gayle_ide_init(struct autoconfig_info*);
extern int gayle_modify_pcmcia_sram_unit (struct uaedev_config_info*, int insert);
extern int gayle_modify_pcmcia_ide_unit (struct uaedev_config_info*, int insert);
extern int gayle_add_pcmcia_sram_unit (struct uaedev_config_info*);
extern int gayle_add_pcmcia_ide_unit(struct uaedev_config_info*);
extern void gayle_free_units (void);
extern void rethink_gayle (void);
extern void gayle_map_pcmcia (void);
extern void check_prefs_changed_gayle(void);
extern void gayle_add_pcmcia_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc);
extern bool gayle_pcmcia_init(struct autoconfig_info*);
extern bool gayle_init_ne2000_pcmcia(struct autoconfig_info *aci);
extern bool gayle_init_pcmcia(struct autoconfig_info *aci);
extern bool gayle_init_board_io_pcmcia(struct autoconfig_info *aci);
extern bool gayle_init_board_common_pcmcia(struct autoconfig_info *aci);
void pcmcia_eject(struct uae_prefs *p);
extern int gary_toenb; // non-existing memory access = bus error.
extern int gary_timeout; // non-existing memory access = delay
#define PCMCIA_COMMON_START 0x600000
#define PCMCIA_COMMON_SIZE 0x400000
#define PCMCIA_ATTRIBUTE_START 0xa00000
#define PCMCIA_ATTRIBUTE_SIZE 0x80000
extern void gayle_dataflyer_enable(bool);

View File

@ -380,6 +380,7 @@ struct romconfig
TCHAR romident[256];
uae_u32 board_ram_size;
bool autoboot_disabled;
bool inserted;
int device_id;
int device_settings;
int subtype;

View File

@ -187,6 +187,9 @@ extern int decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size);
#define ROMTYPE_PRELUDE 0x0010007c
#define ROMTYPE_PRELUDE1200 0x0010007d
#define ROMTYPE_TANDEM 0x0010007e
#define ROMTYPE_ARCHOSHD 0x0010007f
#define ROMTYPE_PCMCIASRAM 0x00100080
#define ROMTYPE_PCMCIAIDE 0x00100081
#define ROMTYPE_NOT 0x00800000
#define ROMTYPE_QUAD 0x01000000

View File

@ -3541,6 +3541,7 @@ int win32_hardfile_media_change (const TCHAR *drvname, int inserted)
}
}
}
#if 0
for (i = 0; i < currprefs.mountitems; i++) {
extern struct hd_hardfiledata *pcmcia_sram;
int reopen = 0;
@ -3549,7 +3550,7 @@ int win32_hardfile_media_change (const TCHAR *drvname, int inserted)
hmc_check (&pcmcia_sram->hfd, uci, &rescanned, &reopen, &gotinsert, drvname, inserted);
}
}
#endif
//write_log (_T("win32_hardfile_media_change returned %d\n"), gotinsert);
return gotinsert;
}

View File

@ -5071,6 +5071,9 @@ static void InitializeListView (HWND hDlg)
else if (canbang && (aci->addrbank->flags & ABFLAG_ALLOCINDIRECT))
lvstruct.lParam |= 16;
}
if (aci->rc && aci->ert && (aci->ert->deviceflags & EXPANSIONTYPE_PCMCIA) && !aci->rc->inserted) {
lvstruct.lParam |= 2;
}
}
lvstruct.iItem = i;
lvstruct.iSubItem = 0;
@ -5359,18 +5362,20 @@ static void InitializeListView (HWND hDlg)
}
harddisktype (volname_str, ci);
_tcscpy (bootpri_str, _T("n/a"));
} else if (ctype == HD_CONTROLLER_TYPE_PCMCIA) {
if (ci->controller_type_unit == 0) {
_tcscpy (blocksize_str, _T("n/a"));
_tcscpy(devname_str, _T("PCMCIA SRAM"));
_tcscpy (volname_str, _T("PCMCIA"));
_tcscpy (bootpri_str, _T("n/a"));
} else if (ctype >= HD_CONTROLLER_TYPE_CUSTOM_FIRST && ctype <= HD_CONTROLLER_TYPE_CUSTOM_LAST) {
TCHAR sid[8];
const struct expansionromtype *ert = get_unit_expansion_rom(ctype);
_stprintf(sid, _T("%d"), ci->controller_unit);
if (ert) {
if (ci->controller_type_unit == 0)
_stprintf(devname_str, _T("%s:%s"), ert->friendlyname, sid);
else
_stprintf(devname_str, _T("%s:%s/%d"), ert->friendlyname, sid, ci->controller_type_unit + 1);
} else {
_tcscpy (blocksize_str, _T("n/a"));
_tcscpy(devname_str, _T("PCMCIA IDE"));
_tcscpy (volname_str, _T("PCMCIA"));
_tcscpy (bootpri_str, _T("n/a"));
_stprintf(devname_str, _T("PCMCIA"));
}
harddisktype(volname_str, ci);
_tcscpy(bootpri_str, _T("n/a"));
} else if (type == FILESYS_HARDFILE) {
_stprintf (blocksize_str, _T("%d"), ci->blocksize);
_tcscpy (devname_str, ci->devname);
@ -10169,6 +10174,7 @@ static void values_from_expansion2dlg(HWND hDlg)
getromfile(hDlg, IDC_SCSIROMFILE, brc->roms[index].romfile, MAX_DPATH / sizeof(TCHAR));
}
brc->roms[index].autoboot_disabled = ischecked(hDlg, IDC_SCSIROMFILEAUTOBOOT);
brc->roms[index].inserted = ischecked(hDlg, IDC_SCSIROMFILEPCMCIA);
int v = SendDlgItemMessage(hDlg, IDC_SCSIROMID, CB_GETCURSEL, 0, 0L);
if (v != CB_ERR && !isnew)
@ -10240,6 +10246,7 @@ static void values_to_expansion2_expansion_roms(HWND hDlg, UAEREG *fkey)
}
ew(hDlg, IDC_SCSIROMFILE, true);
ew(hDlg, IDC_SCSIROMCHOOSER, true);
hide(hDlg, IDC_SCSIROMFILEAUTOBOOT, 0);
if (romtype & ROMTYPE_NOT) {
hide(hDlg, IDC_SCSIROMCHOOSER, 1);
hide(hDlg, IDC_SCSIROMFILE, 1);
@ -10253,12 +10260,23 @@ static void values_to_expansion2_expansion_roms(HWND hDlg, UAEREG *fkey)
addromfiles(fkey, hDlg, IDC_SCSIROMFILE, brc ? brc->roms[index].romfile : NULL, romtype, romtype_extra);
setchecked(hDlg, IDC_SCSIROMFILEAUTOBOOT, brc && brc->roms[index].autoboot_disabled);
}
if (ert->deviceflags & EXPANSIONTYPE_PCMCIA) {
setchecked(hDlg, IDC_SCSIROMFILEPCMCIA, brc && brc->roms[index].inserted);
hide(hDlg, IDC_SCSIROMFILEPCMCIA, 0);
} else {
hide(hDlg, IDC_SCSIROMFILEPCMCIA, 1);
if (brc)
brc->roms[index].inserted = false;
}
} else {
hide(hDlg, IDC_SCSIROMCHOOSER, 0);
hide(hDlg, IDC_SCSIROMFILE, 0);
hide(hDlg, IDC_SCSIROMSELECTED, 1);
hide(hDlg, IDC_SCSIROMFILEPCMCIA, 1);
hide(hDlg, IDC_SCSIROMFILEAUTOBOOT, 1);
setchecked(hDlg, IDC_SCSIROMSELECTED, false);
setchecked(hDlg, IDC_SCSIROMFILEAUTOBOOT, false);
setchecked(hDlg, IDC_SCSIROMFILEPCMCIA, false);
SendDlgItemMessage(hDlg, IDC_SCSIROMFILE, CB_RESETCONTENT, 0, 0);
ew(hDlg, IDC_SCSIROMFILE, false);
ew(hDlg, IDC_SCSIROMCHOOSER, false);
@ -10563,6 +10581,7 @@ static INT_PTR CALLBACK Expansion2DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LP
values_from_expansion2dlg(hDlg);
break;
case IDC_SCSIROMFILEAUTOBOOT:
case IDC_SCSIROMFILEPCMCIA:
values_from_expansion2dlg(hDlg);
break;
case IDC_SOCKETS:
@ -10619,7 +10638,7 @@ static INT_PTR CALLBACK Expansion2DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LP
break;
case IDC_SCSIROMSELECTCAT:
val = SendDlgItemMessage(hDlg, IDC_SCSIROMSELECTCAT, CB_GETCURSEL, 0, 0);
if (val != CB_ERR) {
if (val != CB_ERR && val != scsiromselectedcatnum) {
scsiromselectedcatnum = val;
scsiromselected = 0;
init_expansion2(hDlg, false);
@ -13411,7 +13430,7 @@ static void hardfile_testrdb (struct hfdlg_vals *hdf)
for (i = 0; i < 16; i++) {
hdf_read_rdb (&hfd, id, i * 512, 512);
if (i == 0 && !memcmp (id + 2, "CIS", 3)) {
hdf->ci.controller_type = HD_CONTROLLER_TYPE_PCMCIA;
hdf->ci.controller_type = HD_CONTROLLER_TYPE_CUSTOM_FIRST;
hdf->ci.controller_type_unit = 0;
break;
}
@ -13745,7 +13764,7 @@ static void sethardfile (HWND hDlg)
hide(hDlg, IDC_RESERVED_TEXT, rdb);
hide(hDlg, IDC_CYLINDERS_TEXT, !rdb);
gui_set_string_cursor(hdmenutable, hDlg, IDC_HDF_CONTROLLER, current_hfdlg.ci.controller_type + current_hfdlg.ci.controller_type_unit * HD_CONTROLLER_NEXT_UNIT);
SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_hfdlg.ci.controller_type != HD_CONTROLLER_TYPE_PCMCIA ? current_hfdlg.ci.controller_unit : current_hfdlg.ci.controller_type_unit, 0);
SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_hfdlg.ci.controller_unit, 0);
sethardfiletypes(hDlg);
}
@ -13806,14 +13825,25 @@ static void inithdcontroller (HWND hDlg, int ctype, int ctype_unit, int devtype,
}
}
#if 0
gui_add_string(hdmenutable, hDlg, IDC_HDF_CONTROLLER, 0, _T(""));
for (int i = 0; expansionroms[i].name; i++) {
const struct expansionromtype *erc = &expansionroms[i];
if ((erc->romtype & ROMTYPE_MASK) == ROMTYPE_MB_PCMCIA) {
addhdcontroller(hDlg, erc, hdmenutable, HD_CONTROLLER_TYPE_PCMCIA, 0);
addhdcontroller(hDlg, erc, hdmenutable, HD_CONTROLLER_TYPE_CUSTOM_FIRST + i, 0);
ctype_unit = 0;
}
}
#endif
gui_add_string(hdmenutable, hDlg, IDC_HDF_CONTROLLER, 0, _T(""));
for (int i = 0; expansionroms[i].name; i++) {
const struct expansionromtype *erc = &expansionroms[i];
if (erc->deviceflags & EXPANSIONTYPE_CUSTOMDISK) {
addhdcontroller(hDlg, erc, hdmenutable, HD_CONTROLLER_TYPE_CUSTOM_FIRST + i, EXPANSIONTYPE_CUSTOMDISK);
break;
}
}
gui_set_string_cursor(hdmenutable, hDlg, IDC_HDF_CONTROLLER, ctype + ctype_unit * HD_CONTROLLER_NEXT_UNIT);
@ -13850,10 +13880,8 @@ static void inithdcontroller (HWND hDlg, int ctype, int ctype_unit, int devtype,
}
if (media)
ew(hDlg, IDC_HDF_CONTROLLER_UNIT, TRUE);
} else if (ctype == HD_CONTROLLER_TYPE_PCMCIA) {
SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("SRAM"));
SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("IDE"));
ew(hDlg, IDC_HDF_CONTROLLER_UNIT, TRUE);
} else if (ctype >= HD_CONTROLLER_TYPE_CUSTOM_FIRST && ctype <= HD_CONTROLLER_TYPE_CUSTOM_LAST) {
ew(hDlg, IDC_HDF_CONTROLLER_UNIT, FALSE);
} else if (ctype == HD_CONTROLLER_TYPE_UAE) {
for (int i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
TCHAR tmp[100];
@ -14000,7 +14028,7 @@ static void updatehdfinfo (HWND hDlg, bool force, bool defaults)
int heads = phys ? current_hfdlg.ci.pheads : current_hfdlg.ci.surfaces;
int secs = phys ? current_hfdlg.ci.psecs : current_hfdlg.ci.sectors;
if (!cyls && current_hfdlg.ci.blocksize && secs && heads) {
cyls = bsize / (current_hfdlg.ci.blocksize * secs * heads);
cyls = bsize / ((uae_u64)current_hfdlg.ci.blocksize * secs * heads);
}
blocks = cyls * (secs * heads);
if (!blocks && current_hfdlg.ci.blocksize)
@ -14033,7 +14061,7 @@ static void updatehdfinfo (HWND hDlg, bool force, bool defaults)
blocks, (int)(bsize / current_hfdlg.ci.blocksize),
(double)blocks * 1.0 * current_hfdlg.ci.blocksize / (1024.0 * 1024.0),
(double)bsize / (1024.0 * 1024.0));
if (cyls * heads * secs > bsize / current_hfdlg.ci.blocksize) {
if ((uae_u64)cyls * heads * secs > bsize / current_hfdlg.ci.blocksize) {
_tcscat (tmp2, _T(" [Geometry larger than drive!]"));
} else if (cyls > 65535) {
_tcscat (tmp2, _T(" [Too many cyls]"));
@ -14098,7 +14126,7 @@ static INT_PTR CALLBACK TapeDriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara
case WM_INITDIALOG:
recursive++;
inithdcontroller(hDlg, current_tapedlg.ci.controller_type, current_tapedlg.ci.controller_type_unit, UAEDEV_TAPE, current_tapedlg.ci.rootdir[0] != 0);
SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_tapedlg.ci.controller_type != HD_CONTROLLER_TYPE_PCMCIA ? current_tapedlg.ci.controller_unit : current_tapedlg.ci.controller_type_unit, 0);
SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_tapedlg.ci.controller_unit, 0);
setautocomplete (hDlg, IDC_PATH_NAME);
addhistorymenu(hDlg, current_tapedlg.ci.rootdir, IDC_PATH_NAME, HISTORY_TAPE, false);
readonly = !tape_can_write(current_tapedlg.ci.rootdir);
@ -14128,19 +14156,14 @@ static INT_PTR CALLBACK TapeDriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara
if (posn != CB_ERR) {
current_tapedlg.ci.controller_type = posn % HD_CONTROLLER_NEXT_UNIT;
current_tapedlg.ci.controller_type_unit = posn / HD_CONTROLLER_NEXT_UNIT;
if (current_tapedlg.ci.controller_type == HD_CONTROLLER_TYPE_PCMCIA)
current_tapedlg.ci.controller_type_unit = 1;
inithdcontroller(hDlg, current_tapedlg.ci.controller_type, current_tapedlg.ci.controller_type_unit, UAEDEV_TAPE, current_tapedlg.ci.rootdir);
SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_tapedlg.ci.controller_type != HD_CONTROLLER_TYPE_PCMCIA ? current_tapedlg.ci.controller_unit : current_tapedlg.ci.controller_type_unit, 0);
SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_tapedlg.ci.controller_unit, 0);
}
break;
case IDC_HDF_CONTROLLER_UNIT:
posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_GETCURSEL, 0, 0);
if (posn != CB_ERR) {
if (current_tapedlg.ci.controller_type == HD_CONTROLLER_TYPE_PCMCIA)
current_tapedlg.ci.controller_type_unit = posn;
else
current_tapedlg.ci.controller_unit = posn;
current_tapedlg.ci.controller_unit = posn;
}
break;
}
@ -14213,7 +14236,7 @@ static INT_PTR CALLBACK CDDriveSettingsProc (HWND hDlg, UINT msg, WPARAM wParam,
is_board_enabled(&workprefs, ROMTYPE_GVPS2, 0) || is_board_enabled(&workprefs, ROMTYPE_A4091, 0) ||
(workprefs.cs_mbdmac & 3)) ? HD_CONTROLLER_TYPE_SCSI_AUTO : HD_CONTROLLER_TYPE_IDE_AUTO;
inithdcontroller(hDlg, current_cddlg.ci.controller_type, current_cddlg.ci.controller_type_unit, UAEDEV_CD, current_cddlg.ci.rootdir[0] != 0);
SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_cddlg.ci.controller_type != HD_CONTROLLER_TYPE_PCMCIA ? current_cddlg.ci.controller_unit : current_cddlg.ci.controller_type_unit, 0);
SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_cddlg.ci.controller_unit, 0);
InitializeListView (hDlg);
recursive--;
customDlgType = IDD_CDDRIVE;
@ -14243,19 +14266,14 @@ static INT_PTR CALLBACK CDDriveSettingsProc (HWND hDlg, UINT msg, WPARAM wParam,
if (posn != CB_ERR) {
current_cddlg.ci.controller_type = posn % HD_CONTROLLER_NEXT_UNIT;
current_cddlg.ci.controller_type_unit = posn / HD_CONTROLLER_NEXT_UNIT;
if (current_cddlg.ci.controller_type == HD_CONTROLLER_TYPE_PCMCIA)
current_cddlg.ci.controller_type_unit = 1;
inithdcontroller(hDlg, current_cddlg.ci.controller_type, current_cddlg.ci.controller_type_unit, UAEDEV_CD, current_cddlg.ci.rootdir[0] != 0);
SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_cddlg.ci.controller_type != HD_CONTROLLER_TYPE_PCMCIA ? current_cddlg.ci.controller_unit : current_cddlg.ci.controller_type_unit, 0);
SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_cddlg.ci.controller_unit, 0);
}
break;
case IDC_HDF_CONTROLLER_UNIT:
posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_GETCURSEL, 0, 0);
if (posn != CB_ERR) {
if (current_cddlg.ci.controller_type == HD_CONTROLLER_TYPE_PCMCIA)
current_cddlg.ci.controller_type_unit = posn;
else
current_cddlg.ci.controller_unit = posn;
current_cddlg.ci.controller_unit = posn;
}
break;
}
@ -14401,8 +14419,6 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
if (posn != CB_ERR) {
current_hfdlg.ci.controller_type = posn % HD_CONTROLLER_NEXT_UNIT;
current_hfdlg.ci.controller_type_unit = posn / HD_CONTROLLER_NEXT_UNIT;
if (current_hfdlg.ci.controller_type == HD_CONTROLLER_TYPE_PCMCIA)
current_hfdlg.ci.controller_type_unit = 1;
inithdcontroller(hDlg, current_hfdlg.ci.controller_type, current_hfdlg.ci.controller_type_unit, UAEDEV_HDF, current_hfdlg.ci.rootdir[0] != 0);
sethardfile(hDlg);
}
@ -14410,10 +14426,7 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
case IDC_HDF_CONTROLLER_UNIT:
posn = SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_GETCURSEL, 0, 0);
if (posn != CB_ERR) {
if (current_hfdlg.ci.controller_type == HD_CONTROLLER_TYPE_PCMCIA)
current_hfdlg.ci.controller_type_unit = posn;
else
current_hfdlg.ci.controller_unit = posn;
current_hfdlg.ci.controller_unit = posn;
sethardfile(hDlg);
}
break;
@ -14608,7 +14621,7 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara
if (index >= 0) {
SendDlgItemMessage (hDlg, IDC_HARDDRIVE, CB_SETCURSEL, index, 0);
gui_set_string_cursor(hdmenutable, hDlg, IDC_HDF_CONTROLLER, current_hfdlg.ci.controller_type + current_hfdlg.ci.controller_type_unit * HD_CONTROLLER_NEXT_UNIT);
SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_hfdlg.ci.controller_type != HD_CONTROLLER_TYPE_PCMCIA ? current_hfdlg.ci.controller_unit : current_hfdlg.ci.controller_type_unit, 0);
SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_hfdlg.ci.controller_unit, 0);
SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_TYPE, CB_SETCURSEL, current_hfdlg.ci.controller_media_type, 0);
SendDlgItemMessage(hDlg, IDC_HDF_FEATURE_LEVEL, CB_SETCURSEL, current_hfdlg.ci.unit_feature_level, 0);
}
@ -14720,7 +14733,7 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara
if (!(flags & 1))
current_hfdlg.ci.loadidentity = false;
gui_set_string_cursor(hdmenutable, hDlg, IDC_HDF_CONTROLLER, current_hfdlg.ci.controller_type + current_hfdlg.ci.controller_type_unit * MAX_DUPLICATE_EXPANSION_BOARDS);
SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_hfdlg.ci.controller_type != HD_CONTROLLER_TYPE_PCMCIA ? current_hfdlg.ci.controller_unit : current_hfdlg.ci.controller_type_unit, 0);
SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_hfdlg.ci.controller_unit, 0);
CheckDlgButton(hDlg, IDC_HDF_RW, !current_hfdlg.ci.readonly);
_tcscpy (current_hfdlg.ci.rootdir, hdf_getnameharddrive ((int)posn, 4, &current_hfdlg.ci.blocksize, NULL, NULL));
setharddrive(hDlg);
@ -14739,17 +14752,14 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara
SetDlgItemText(hDlg, IDC_HDFINFO3, _T(""));
updatehdfinfo (hDlg, true, true);
inithdcontroller(hDlg, current_hfdlg.ci.controller_type, current_hfdlg.ci.controller_type_unit, UAEDEV_HDF, current_hfdlg.ci.rootdir[0] != 0);
SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_hfdlg.ci.controller_type != HD_CONTROLLER_TYPE_PCMCIA ? current_hfdlg.ci.controller_unit : current_hfdlg.ci.controller_type_unit, 0);
SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_hfdlg.ci.controller_unit, 0);
sethardfiletypes(hDlg);
}
break;
case IDC_HDF_CONTROLLER_UNIT:
posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_GETCURSEL, 0, 0);
if (posn != CB_ERR) {
if (current_hfdlg.ci.controller_type == HD_CONTROLLER_TYPE_PCMCIA)
current_hfdlg.ci.controller_type_unit = posn;
else
current_hfdlg.ci.controller_unit = posn;
current_hfdlg.ci.controller_unit = posn;
}
break;
case IDC_HDF_CONTROLLER_TYPE:
@ -14863,8 +14873,6 @@ static void new_hardfile (HWND hDlg, int entry)
struct hardfiledata *hfd = get_hardfile_data (uci->configoffset);
if (hfd)
hardfile_media_change (hfd, &ci, true, false);
else
hardfile_added(&ci);
}
}
@ -14877,8 +14885,6 @@ static void new_harddrive (HWND hDlg, int entry)
struct hardfiledata *hfd = get_hardfile_data (uci->configoffset);
if (hfd)
hardfile_media_change (hfd, &current_hfdlg.ci, true, false);
else
hardfile_added(&current_hfdlg.ci);
}
}

View File

@ -2143,6 +2143,8 @@ const struct expansionromtype *get_unit_expansion_rom(int hdunit)
return &expansionroms[hdunit - HD_CONTROLLER_TYPE_SCSI_EXPANSION_FIRST];
if (hdunit >= HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST && hdunit <= HD_CONTROLLER_TYPE_IDE_LAST)
return &expansionroms[hdunit - HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST];
if (hdunit >= HD_CONTROLLER_TYPE_CUSTOM_FIRST && hdunit <= HD_CONTROLLER_TYPE_CUSTOM_LAST)
return &expansionroms[hdunit - HD_CONTROLLER_TYPE_CUSTOM_FIRST];
return NULL;
}