static int blit_linecyclecounter, blit_misscyclecounter;
#ifdef CPUEMU_6
-extern uae_u8 cycle_line[];
+extern int cycle_line[];
#endif
static long blit_firstline_cycles;
extern int is_bitplane_dma (int hpos);
STATIC_INLINE int canblit (int hpos)
{
- if (cycle_line[hpos] == 0 && !is_bitplane_dma (hpos))
+ if (is_bitplane_dma (hpos))
+ return 0;
+ if (cycle_line[hpos] == 0)
return 1;
+ if (cycle_line[hpos] & (CYCLE_REFRESH | CYCLE_SPRITE | CYCLE_MISC))
+ return -1;
return 0;
}
break;
}
#if 1
- if (c && !canblit(blit_last_hpos))
+ if (c && canblit(blit_last_hpos) <= 0)
break;
#endif
#if 1
}
#endif
for (;;) {
+ int v;
+
if (c == 5) { /* real idle cycle */
blit_cyclecounter++;
break;
}
-
+
/* all cycles need free bus, even idle cycles (except fillmode idle) */
- if (!canblit (blit_last_hpos)) {
+ v = canblit (blit_last_hpos);
+ if (v < 0 && c == 0) {
+ blit_cyclecounter++;
+ break;
+ }
+ if (v <= 0) {
blit_misscyclecounter++;
break;
}
#ifndef BLITTER_DEBUG
warned = 1;
#endif
- write_log ("warning: Program does not wait for blitter %p vpos=%d tc=%d\n",
- m68k_getpc(), vpos, blit_cyclecounter);
+ if (m68k_getpc() < 0xe0000 || m68k_getpc() >= 0x10000000)
+ write_log ("warning: Program does not wait for blitter %p vpos=%d tc=%d\n",
+ m68k_getpc(), vpos, blit_cyclecounter);
}
if (currprefs.blitter_cycle_exact) {
device_func[DF_SCSI] = &devicefunc_win32_spti;
installed = 1;
}
- if (currprefs.win32_aspi || !installed) {
+ if (currprefs.win32_uaescsimode >= 1 || !installed) {
device_func[DF_SCSI] = &devicefunc_win32_aspi;
device_func[DF_IOCTL] = 0;
}
"gfx_immediate_blits", "gfx_ntsc", "win32", "gfx_filter_bits",
"sound_pri_cutoff", "sound_pri_time", "sound_min_buff",
"gfx_test_speed", "gfxlib_replacement", "enforcer", "catweasel_io",
- "kickstart_key_file",
+ "kickstart_key_file", "fast_copper",
0
};
for (i = 0; i < 2; i++) {
int v = i == 0 ? p->jport0 : p->jport1;
char tmp1[100], tmp2[50];
- if (v < JSEM_JOYS) {
+ if (v < 0) {
+ strcpy (tmp2, "none");
+ } else if (v < JSEM_JOYS) {
sprintf (tmp2, "kbd%d", v + 1);
} else if (v < JSEM_MICE) {
sprintf (tmp2, "joy%d", v - JSEM_JOYS);
if (strcmp (option, "joyport0") == 0 || strcmp (option, "joyport1") == 0) {
int port = strcmp (option, "joyport0") == 0 ? 0 : 1;
- int start = -1;
+ int start = -1, got = 0;
char *pp = 0;
if (strncmp (value, "kbd", 3) == 0) {
start = JSEM_KBDLAYOUT;
pp = value + 3;
+ got = 1;
} else if (strncmp (value, "joy", 3) == 0) {
start = JSEM_JOYS;
pp = value + 3;
+ got = 1;
} else if (strncmp (value, "mouse", 5) == 0) {
start = JSEM_MICE;
pp = value + 5;
+ got = 1;
+ } else if (strcmp (value, "none") == 0) {
+ got = 2;
}
- if (pp) {
- int v = atol (pp);
- if (start >= 0) {
- if (start == JSEM_KBDLAYOUT)
- v--;
- if (v >= 0) {
- start += v;
- if (port)
- p->jport1 = start;
- else
- p->jport0 = start;
+ if (got) {
+ if (pp) {
+ int v = atol (pp);
+ if (start >= 0) {
+ if (start == JSEM_KBDLAYOUT)
+ v--;
+ if (v >= 0) {
+ start += v;
+ got = 2;
+ }
}
}
+ if (got == 2) {
+ if (port)
+ p->jport1 = start;
+ else
+ p->jport0 = start;
+ }
}
return 1;
}
int div10 = (get_cycles () - eventtab[ev_cia].oldcycles) % DIV10;
int cycles;
- cycles = 2 * CYCLE_UNIT / 2;
+ cycles = 5 * CYCLE_UNIT / 2;
if (div10 > DIV10 * ECLOCK_DATA_CYCLE / 10) {
cycles += DIV10 - div10;
cycles += DIV10 * ECLOCK_DATA_CYCLE / 10;
X86_PROCESSOR_max
};
-static const char * x86_processor_string_table[X86_PROCESSOR_max] = {
- "80386",
- "80486",
- "Pentium",
- "PentiumPro",
- "K6",
- "Athlon",
- "Pentium4",
- "K8"
-};
-
static struct ptt {
const int align_loop;
const int align_loop_max_skip;
const int align_jump_max_skip;
const int align_func;
}
-x86_alignments[X86_PROCESSOR_max] = {
+x86_alignments[X86_PROCESSOR_max + 1] = {
{ 4, 3, 4, 3, 4 },
{ 16, 15, 16, 15, 16 },
{ 16, 7, 16, 7, 16 },
{ 32, 7, 32, 7, 32 },
{ 16, 7, 16, 7, 16 },
{ 0, 0, 0, 0, 0 },
- { 16, 7, 16, 7, 16 }
+ { 16, 7, 16, 7, 16 },
+ { 0, 0, 0, 0, 0 }
};
static void
}
break;
}
- if (c->x86_processor == X86_PROCESSOR_max) {
- write_log ("Error: unknown processor type\n");
- write_log ("..Family : %d\n", c->x86);
- write_log ("..Model : %d\n", c->x86_model);
- write_log ("..Mask : %d\n", c->x86_mask);
- write_log (" Vendor : %s [%d]\n", c->x86_vendor_id, c->x86_vendor);
- if (c->x86_brand_id)
- write_log(" BrandID : %02x\n", c->x86_brand_id);
- abort();
- }
/* Have CMOV support? */
have_cmov = c->x86_hwcap & (1 << 15);
align_jumps = x86_alignments[c->x86_processor].align_jump;
}
- write_log("Max CPUID level=%d Processor is %s [%s]\n",
- c->cpuid_level, c->x86_vendor_id,
- x86_processor_string_table[c->x86_processor]);
+ write_log ("CPUID level=%d, Family=%d, Model=%d, Mask=%d, Vendor=%s [%d]\n",
+ c->cpuid_level, c->x86, c->x86_model, c->x86_mask, c->x86_vendor_id, c->x86_vendor);
}
#if 0
static int sprite_width, sprres, sprite_buffer_res;
#ifdef CPUEMU_6
-uae_u8 cycle_line[256];
+int cycle_line[256];
#endif
static uae_u32 bpl1dat;
*p &= ~val;
}
+static void hsyncdelay(void)
+{
+#if 0
+ static int prevhpos;
+ while (current_hpos () == prevhpos)
+ do_cycles(CYCLE_UNIT);
+ prevhpos = current_hpos();
+#endif
+}
+
STATIC_INLINE int current_hpos (void)
{
return (get_cycles () - eventtab[ev_hsync].oldcycles) / CYCLE_UNIT;
}
static int fetchmode;
-static int maxplanes_ocs[]={ 6,4,0,0 };
-static int maxplanes_ecs[]={ 6,4,2,0 };
-static int maxplanes_aga[]={ 8,4,2,0, 8,8,4,0, 8,8,8,0 };
-
-static int get_maxplanes (int res)
-{
- int *planes;
- if (currprefs.chipset_mask & CSMASK_AGA)
- planes = maxplanes_aga;
- else if (! (currprefs.chipset_mask & CSMASK_ECS_DENISE))
- planes = maxplanes_ocs;
- else
- planes = maxplanes_ecs;
- return planes[fetchmode * 4 + res];
-}
+static int real_bitplane_number[3][3][9];
-/* Disable bitplane DMA if planes > maxplanes. This is needed e.g. by the
- Sanity WOC demo (at the "Party Effect"). */
-STATIC_INLINE int GET_PLANES_LIMIT (uae_u16 v)
+/* Disable bitplane DMA if planes > available DMA slots. This is needed
+ e.g. by the Sanity WOC demo (at the "Party Effect"). */
+STATIC_INLINE int GET_PLANES_LIMIT (uae_u16 bc0)
{
- if (GET_PLANES(v) > get_maxplanes (GET_RES(v)))
- v &= ~0x7010;
- return GET_PLANES (v);
+ int res = GET_RES(bc0);
+ int planes = GET_PLANES(bc0);
+ return real_bitplane_number[fetchmode][res][planes];
}
/* The HRM says 0xD8, but that can't work... */
static int fetchstarts[] = { 3,2,1,0, 4,3,2,0, 5,4,3,0 };
static int fm_maxplanes[] = { 3,2,1,0, 3,3,2,0, 3,3,3,0 };
-static uae_u8 cycle_diagram_table[3][3][9][32];
-static uae_u8 cycle_diagram_free_cycles[3][3][9];
-static uae_u8 cycle_diagram_total_cycles[3][3][9];
-static uae_u8 *curr_diagram;
-static uae_u8 cycle_sequences[3*8] = { 2,1,2,1,2,1,2,1, 4,2,3,1,4,2,3,1, 8,4,6,2,7,3,5,1 };
+static int cycle_diagram_table[3][3][9][32];
+static int cycle_diagram_free_cycles[3][3][9];
+static int cycle_diagram_total_cycles[3][3][9];
+static int *curr_diagram;
+static int cycle_sequences[3 * 8] = { 2,1,2,1,2,1,2,1, 4,2,3,1,4,2,3,1, 8,4,6,2,7,3,5,1 };
static void debug_cycle_diagram(void)
{
static void create_cycle_diagram_table(void)
{
- int fm, res, cycle, planes, v;
+ int fm, res, cycle, planes, rplanes, v;
int fetch_start, max_planes, freecycles;
- uae_u8 *cycle_sequence;
+ int *cycle_sequence;
for (fm = 0; fm <= 2; fm++) {
for (res = 0; res <= 2; res++) {
}
cycle_diagram_free_cycles[fm][res][planes] = freecycles;
cycle_diagram_total_cycles[fm][res][planes] = fetch_start;
+ rplanes = planes;
+ if (rplanes > max_planes)
+ rplanes = 0;
+ if (rplanes == 7 && fm == 0 && res == 0 && !(currprefs.chipset_mask & CSMASK_AGA))
+ rplanes = 4;
+ real_bitplane_number[fm][res][planes] = rplanes;
}
}
}
we can do more work at once. */
static int toscr_nbits;
+/* undocumented bitplane delay hardware feature */
static int delayoffset;
STATIC_INLINE void compute_delay_offset (void)
{
- delayoffset = (((plfstrt - HARD_DDF_START) & fetchstart_mask) << 1) & ~7;
- if (delayoffset == 8)
+ delayoffset = (16 << fetchmode) - (((plfstrt - HARD_DDF_START) & fetchstart_mask) << 1);
+#if 0
+ /* maybe we can finally get rid of this stupid table.. */
+ if (tmp == 4)
+ delayoffset = 4; // Loons Docs
+ else if (tmp == 8)
delayoffset = 8;
- else if (delayoffset == 16) /* Overkill AGA */
+ else if (tmp == 12) // Loons Docs
+ delayoffset = 4;
+ else if (tmp == 16) /* Overkill AGA */
delayoffset = 48;
- else if (delayoffset == 24) /* AB 2 */
+ else if (tmp == 24) /* AB 2 */
delayoffset = 8;
- else if (delayoffset == 32)
+ else if (tmp == 32)
delayoffset = 32;
- else if (delayoffset == 48) /* Pinball Illusions AGA, ingame */
+ else if (tmp == 48) /* Pinball Illusions AGA, ingame */
delayoffset = 16;
else /* what about 40 and 56? */
delayoffset = 0;
+ //write_log("%d:%d ", vpos, delayoffset);
+#endif
}
static void expand_fmodes (void)
return;
if (hpos <= plfstrt)
return;
- if (hpos > plfstop)
+ if (hpos > plfstop - fetchunit)
return;
if (ddfstate != DIW_waiting_start)
passed_plfstop = 1;
The data is recorded either in lores pixels (if ECS), or in hires pixels
(if AGA). No support for SHRES sprites. */
-static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16 *datb, unsigned int ctl)
+static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16 *datb, unsigned int ctl, unsigned int ctlx)
{
struct sprite_entry *e = curr_sprite_entries + next_sprite_entry;
int i;
/* We have 8 bits per pixel in spixstate, two for every sprite pair. The
low order bit records whether the attach bit was set for this pair. */
-
- if ((sprctl[num] & 0x80) || (sprctl[num ^ 1] & 0x80)) {
+ if ((sprctl[num] & 0x80) || (!(currprefs.chipset_mask & CSMASK_AGA) && (sprctl[num ^ 1] & 0x80))) {
uae_u32 state = 0x01010101 << (num & ~1);
uae_u32 *stbuf = spixstate.words + (word_offs >> 2);
uae_u8 *stb1 = spixstate.bytes + word_offs;
}
for (i = 0; i < count; i++) {
int nr = nrs[i];
- record_sprite (next_lineno, nr, spr[nr].xpos, sprdata[nr], sprdatb[nr], sprctl[nr]);
+ record_sprite (next_lineno, nr, spr[nr].xpos, sprdata[nr], sprdatb[nr], sprctl[nr], sprctl[nr ^ 1]);
}
last_sprite_point = point;
}
/* display mode changed (lores, doubling etc..), recalculate everything */
void init_custom (void)
{
+ create_cycle_diagram_table ();
reset_drawing ();
init_hz ();
calcdiw ();
#if 0
write_log ("vposr %x at %x\n", vp, m68k_getpc());
#endif
+ if (currprefs.cpu_level >= 2)
+ hsyncdelay();
return vp;
}
static void VPOSW (uae_u16 v)
uae_u16 v = GETVPOS() << 8;
uae_u16 hp = GETHPOS();
v |= hp;
+ if (currprefs.cpu_level >= 2)
+ hsyncdelay();
return v;
}
if (dmaen (DMA_COPPER)) {
copper_enabled_thisline = 1;
set_special (SPCFLAG_COPPER);
- } else if (oldstrobe != num) {
+ } else if (oldstrobe > 0 && oldstrobe != num) {
/* dma disabled and accessing both COPxJMPs -> copper stops! */
cop_state.state = COP_stop;
}
#ifdef CPUEMU_6
if (currprefs.cpu_cycle_exact || currprefs.blitter_cycle_exact) {
decide_blitter (hpos);
- memset (cycle_line, 0, MAXHPOS);
+ memset (cycle_line, 0, sizeof(cycle_line));
#if 1
{
cycle_line[maxhpos - 1] = CYCLE_REFRESH;
void REGPARAM2 custom_bput (uaecptr addr, uae_u32 value)
{
static int warned;
- /* Is this correct now? (There are people who bput things to the upper byte of AUDxVOL). */
+
uae_u16 rval = (value << 8) | (value & 0xFF);
#ifdef JIT
special_mem |= S_WRITE;
decide_fetch (hpos);
}
-STATIC_INLINE int dma_cycle(void)
+STATIC_INLINE void dma_cycle(void)
{
- int hpos, cycles = 0;
+ int hpos;
static int bnasty;
for (;;) {
int bpldma;
int blitpri = dmaen (DMA_BLITPRI);
do_cycles (1 * CYCLE_UNIT);
- cycles += CYCLE_UNIT;
hpos = current_hpos ();
sync_copper (hpos);
decide_line (hpos);
break;
}
decide_blitter (hpos);
- bnasty++;
- } else if (bpldma || cycle_line[hpos]) {
- bnasty++;
+ if (dmaen(DMA_BLITTER))
+ bnasty++;
}
if (cycle_line[hpos] == 0 && !bpldma)
break;
}
bnasty = 0;
cycle_line[hpos] |= CYCLE_CPU;
- return cycles;
}
uae_u32 wait_cpu_cycle_read (uaecptr addr, int mode)
return v;
}
+#if 0
uae_u32 wait_cpu_cycle_read_cycles (uaecptr addr, int mode, int *cycles)
{
uae_u32 v = 0;
do_cycles (1 * CYCLE_UNIT);
return v;
}
+#endif
void wait_cpu_cycle_write (uaecptr addr, int mode, uae_u32 v)
{
void do_cycles_ce (long cycles)
{
- int hpos, bpldma;
+ int hpos;
while (cycles > 0) {
do_cycles (1 * CYCLE_UNIT);
cycles -= CYCLE_UNIT;
sync_copper (hpos);
decide_line (hpos);
decide_fetch_ce (hpos);
- bpldma = is_bitplane_dma (hpos);
- if (cycle_line[hpos] == 0 && !bpldma)
- decide_blitter (hpos);
+ decide_blitter (hpos);
}
}
" fd Remove all breakpoints\n"
" f <addr1> <addr2> Step forward until <addr1> <= PC <= <addr2>\n"
" e Dump contents of all custom registers\n"
- " i Dump contents of interrupt and trap vectors\n"
+ " i [<addr>] Dump contents of interrupt and trap vectors\n"
" o <1|2|addr> [<lines>]View memory as Copper instructions\n"
" O Display bitplane offsets\n"
" O <plane> <offset> Offset a bitplane\n"
free (p2);
}
-static void dump_vectors (void)
+static void dump_vectors (uaecptr addr)
{
int i = 0, j = 0;
+
+ if (addr == 0xffffffff)
+ addr = regs.vbr;
while (int_labels[i].name || trap_labels[j].name) {
if (int_labels[i].name) {
- console_out ("$%08X: %s \t $%08X\t", int_labels[i].adr + regs.vbr,
- int_labels[i].name, get_long (int_labels[i].adr + (int_labels[i].adr == 4 ? 0 : regs.vbr)));
+ console_out ("$%08X: %s \t $%08X\t", int_labels[i].adr + addr,
+ int_labels[i].name, get_long (int_labels[i].adr + (int_labels[i].adr == 4 ? 0 : addr)));
i++;
} else {
console_out ("\t\t\t\t");
}
if (trap_labels[j].name) {
- console_out("$%08X: %s \t $%08X", trap_labels[j].adr + regs.vbr,
- trap_labels[j].name, get_long (trap_labels[j].adr + regs.vbr));
+ console_out("$%08X: %s \t $%08X", trap_labels[j].adr + addr,
+ trap_labels[j].name, get_long (trap_labels[j].adr + addr));
j++;
}
console_out ("\n");
static void debug_1 (void)
{
char input[80];
- uaecptr nxdis,nxmem,nxcopper;
+ uaecptr nxdis, nxmem, nxcopper, addr;
m68k_dumpstate (stdout, &nextpc);
nxdis = nextpc; nxmem = nxcopper = 0;
cmd = next_char (&inptr);
switch (cmd) {
case 'c': dumpcia (); dumpdisk (); dumpcustom (); break;
- case 'i': dump_vectors (); break;
+ case 'i':
+ addr = 0xffffffff;
+ if (more_params (&inptr))
+ addr = readhex (&inptr);
+ dump_vectors (addr);
+ break;
case 'e': dump_custom_regs (); break;
case 'r': if (more_params(&inptr))
m68k_modify (&inptr);
b0 = 0, b1 = 0, b2 = 0, b3 = 0, b4 = 0, b5 = 0, b6 = 0, b7 = 0;
switch (planes) {
#ifdef AGA
- case 8: b0 = GETLONG ((uae_u32 *)real_bplpt[7]); real_bplpt[7] += 4;
- case 7: b1 = GETLONG ((uae_u32 *)real_bplpt[6]); real_bplpt[6] += 4;
+ case 8: b0 = GETLONG (real_bplpt[7]); real_bplpt[7] += 4;
+ case 7: b1 = GETLONG (real_bplpt[6]); real_bplpt[6] += 4;
#endif
- case 6: b2 = GETLONG ((uae_u32 *)real_bplpt[5]); real_bplpt[5] += 4;
- case 5: b3 = GETLONG ((uae_u32 *)real_bplpt[4]); real_bplpt[4] += 4;
- case 4: b4 = GETLONG ((uae_u32 *)real_bplpt[3]); real_bplpt[3] += 4;
- case 3: b5 = GETLONG ((uae_u32 *)real_bplpt[2]); real_bplpt[2] += 4;
- case 2: b6 = GETLONG ((uae_u32 *)real_bplpt[1]); real_bplpt[1] += 4;
- case 1: b7 = GETLONG ((uae_u32 *)real_bplpt[0]); real_bplpt[0] += 4;
+ case 6: b2 = GETLONG (real_bplpt[5]); real_bplpt[5] += 4;
+ case 5: b3 = GETLONG (real_bplpt[4]); real_bplpt[4] += 4;
+ case 4: b4 = GETLONG (real_bplpt[3]); real_bplpt[3] += 4;
+ case 3: b5 = GETLONG (real_bplpt[2]); real_bplpt[2] += 4;
+ case 2: b6 = GETLONG (real_bplpt[1]); real_bplpt[1] += 4;
+ case 1: b7 = GETLONG (real_bplpt[0]); real_bplpt[0] += 4;
}
MERGE (b0, b1, 0x55555555, 1);
{
UnitInfo *ui = mountinfo->ui + nr;
static char errmsg[1024];
+ int i;
if (nr >= mountinfo->num_units)
return "No slot allocated for this unit";
+ for (i = 0; i < mountinfo->num_units; i++) {
+ if (nr == i)
+ continue;
+ if (!strcmpi (mountinfo->ui[i].rootdir, rootdir)) {
+ sprintf (errmsg, "directory/hardfile '%s' already added", rootdir);
+ return errmsg;
+ }
+ }
+
ui->devname = 0;
ui->volname = 0;
ui->rootdir = 0;
}
static void
-action_lock (Unit *unit, dpacket packet)
+action_lock(Unit *unit, dpacket packet)
{
uaecptr lock = GET_PCK_ARG1 (packet) << 2;
uaecptr name = GET_PCK_ARG2 (packet) << 2;
PUT_PCK_RES1 (packet, DOS_TRUE);
}
-static void
-action_dup_lock (Unit *unit, dpacket packet)
+static uaecptr
+action_dup_lock_2 (Unit *unit, dpacket packet, uaecptr lock)
{
- uaecptr lock = GET_PCK_ARG1 (packet) << 2;
+ uaecptr out;
a_inode *a;
TRACE(("ACTION_DUP_LOCK(0x%lx)\n", lock));
DUMPLOCK(unit, lock);
if (!lock) {
PUT_PCK_RES1 (packet, 0);
- return;
+ return 0;
}
a = lookup_aino (unit, get_long (lock + 4));
if (a == 0) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_OBJECT_NOT_AROUND);
- return;
+ return 0;
}
/* DupLock()ing exclusive locks isn't possible, says the Autodoc, but
* at least the RAM-Handler seems to allow it. Let's see what happens
if (a->elock) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_OBJECT_IN_USE);
- return;
+ return 0;
}
a->shlock++;
de_recycle_aino (unit, a);
- PUT_PCK_RES1 (packet, make_lock (unit, a->uniq, -2) >> 2);
+ out = make_lock (unit, a->uniq, -2) >> 2;
+ PUT_PCK_RES1 (packet, out);
+ return out;
+}
+
+static void
+action_dup_lock (Unit *unit, dpacket packet)
+{
+ uaecptr lock = GET_PCK_ARG1 (packet) << 2;
+ action_dup_lock_2 (unit, packet, lock);
}
/* convert time_t to/from AmigaDOS time */
PUT_PCK_RES1 (packet, DOS_TRUE);
}
+static void
+action_lock_from_fh (Unit *unit, dpacket packet)
+{
+ uaecptr out;
+ Key *k = lookup_key (unit, GET_PCK_ARG1 (packet));
+ write_log("lock_from_fh %x\n", k);
+ if (k == 0) {
+ PUT_PCK_RES1 (packet, DOS_FALSE);
+ return;
+ }
+ out = action_dup_lock_2 (unit, packet, make_lock (unit, k->aino->uniq, -2) >> 2);
+ write_log("=%x\n", out);
+}
+
static void
action_fh_from_lock (Unit *unit, dpacket packet)
{
case ACTION_SET_FILE_SIZE: action_set_file_size (unit, pck); break;
case ACTION_EXAMINE_FH: action_examine_fh (unit, pck); break;
case ACTION_FH_FROM_LOCK: action_fh_from_lock (unit, pck); break;
+ case ACTION_COPY_DIR_FH: action_lock_from_fh (unit, pck); break;
case ACTION_CHANGE_MODE: action_change_mode (unit, pck); break;
case ACTION_PARENT_FH: action_parent_fh (unit, pck); break;
case ACTION_ADD_NOTIFY: action_add_notify (unit, pck); break;
/* unsupported packets */
case ACTION_LOCK_RECORD:
case ACTION_FREE_RECORD:
- case ACTION_COPY_DIR_FH:
case ACTION_EXAMINE_ALL:
case ACTION_MAKE_LINK:
case ACTION_READ_LINK:
printf ("\t%s = get_word_prefetch (%d) << 16;\n", name, r + 2);
printf ("\t%s |= regs.irc;\n", name);
insn_n_cycles += 4;
- } else
+ } else {
printf ("\t%s %s = get_long_prefetch (%d);\n", type, name, r + 2);
insn_n_cycles += 8;
+ }
} else {
insn_n_cycles += 8;
printf ("\t%s %s = get_ilong (%d);\n", type, name, r);
fill_prefetch_next_1 ();
}
+#if 0
static void fill_prefetch_next_delay (int extracycles)
{
if (!using_prefetch)
fill_prefetch_next ();
}
}
+#endif
static void fill_prefetch_finish (void)
{
printf ("\tsrc %c= dst;\n", curi->mnemo == i_OR ? '|' : curi->mnemo == i_AND ? '&' : '^');
genflags (flag_logical, curi->size, "src", "", "");
if (curi->size == sz_long && isreg (curi->dmode))
- tmpc += curi->mnemo == i_AND ? 2 : 4;
- fill_prefetch_next_delay (tmpc);
+ addcycles (curi->mnemo == i_AND ? 2 : 4);
+ fill_prefetch_next ();
genastore ("src", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_ORSR:
if (curi->size == sz_byte) {
printf ("\tsrc &= 0xFF;\n");
}
- fill_prefetch_next_delay (4);
+ addcycles (4);
+ fill_prefetch_next ();
printf ("\tregs.sr %c= src;\n", curi->mnemo == i_EORSR ? '^' : '|');
printf ("\tMakeFromSR();\n");
break;
if (curi->size == sz_byte) {
printf ("\tsrc |= 0xFF00;\n");
}
- fill_prefetch_next_delay (4);
+ addcycles (4);
+ fill_prefetch_next ();
printf ("\tregs.sr &= src;\n");
printf ("\tMakeFromSR();\n");
break;
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
if (isreg (curi->dmode)) {
if (curi->dmode == Dreg && curi->size == sz_long)
- tmpc += (curi->smode == imm || curi->smode == immi) ? 4 : 2;
+ addcycles ((curi->smode == imm || curi->smode == immi) ? 4 : 2);
}
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next ();
start_brace ();
genflags (flag_sub, curi->size, "newv", "src", "dst");
genastore ("newv", curi->dmode, "dstreg", curi->size, "dst");
if (isreg (curi->dmode) && curi->dmode == Areg) {
tmpc += curi->size == sz_long ? 2 : 4;
if (curi->size == sz_long)
- tmpc += (isreg (curi->smode) || curi->smode == imm) ? 2 : 0;
+ tmpc += (isreg (curi->smode) || curi->smode == imm) ? 2 : 0;
+ addcycles (4);
}
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next ();
start_brace ();
printf ("\tuae_u32 newv = dst - src;\n");
genastore ("newv", curi->dmode, "dstreg", sz_long, "dst");
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, GF_AA);
if ((isreg (curi->smode) && curi->size == sz_long) || !isreg (curi->smode))
- tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ addcycles (2);
+ fill_prefetch_next ();
start_brace ();
printf ("\tuae_u32 newv = dst - src - (GET_XFLG ? 1 : 0);\n");
genflags (flag_subx, curi->size, "newv", "src", "dst");
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
if (isreg (curi->dmode)) {
if (curi->dmode == Dreg && curi->size == sz_long)
- tmpc += (curi->smode == imm || curi->smode == immi) ? 4 : 2;
+ addcycles ((curi->smode == imm || curi->smode == immi) ? 4 : 2);
}
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next ();
start_brace ();
genflags (flag_add, curi->size, "newv", "src", "dst");
genastore ("newv", curi->dmode, "dstreg", curi->size, "dst");
if (isreg (curi->dmode) && curi->dmode == Areg) {
tmpc += curi->size == sz_long ? 2 : 4;
if (curi->size == sz_long)
- tmpc += (isreg (curi->smode) || curi->smode == imm) ? 2 : 0;
+ tmpc += (isreg (curi->smode) || curi->smode == imm) ? 2 : 0;
+ addcycles (tmpc);
}
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next ();
start_brace ();
printf ("\tuae_u32 newv = dst + src;\n");
genastore ("newv", curi->dmode, "dstreg", sz_long, "dst");
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, GF_AA);
if ((isreg (curi->smode) && curi->size == sz_long) || !isreg (curi->smode))
- tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ addcycles (2);
+ fill_prefetch_next ();
start_brace ();
printf ("\tuae_u32 newv = dst + src + (GET_XFLG ? 1 : 0);\n");
genflags (flag_addx, curi->size, "newv", "src", "dst");
break;
case i_NEG:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
- if (isreg (curi->smode) && curi->size == sz_long) tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ if (isreg (curi->smode) && curi->size == sz_long)
+ addcycles (2);
+ fill_prefetch_next ();
start_brace ();
genflags (flag_sub, curi->size, "dst", "src", "0");
genastore_rev ("dst", curi->smode, "srcreg", curi->size, "src");
break;
case i_NEGX:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
- if (isreg (curi->smode) && curi->size == sz_long) tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ if (isreg (curi->smode) && curi->size == sz_long)
+ addcycles (2);
+ fill_prefetch_next ();
start_brace ();
printf ("\tuae_u32 newv = 0 - src - (GET_XFLG ? 1 : 0);\n");
genflags (flag_subx, curi->size, "newv", "src", "0");
break;
case i_NBCD:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
- if (isreg (curi->smode)) tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ if (isreg (curi->smode))
+ addcycles (2);
+ fill_prefetch_next ();
start_brace ();
printf ("\tuae_u16 newv_lo = - (src & 0xF) - (GET_XFLG ? 1 : 0);\n");
printf ("\tuae_u16 newv_hi = - (src & 0xF0);\n");
break;
case i_CLR:
genamode (curi->smode, "srcreg", curi->size, "src", cpu_level == 0 ? 1 : 2, 0, 0);
- if (isreg (curi->smode) && curi->size == sz_long) tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ if (isreg (curi->smode) && curi->size == sz_long)
+ addcycles (2);
+ fill_prefetch_next ();
genflags (flag_logical, curi->size, "0", "", "");
genastore_rev ("0", curi->smode, "srcreg", curi->size, "src");
break;
case i_NOT:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
- if (isreg (curi->smode) && curi->size == sz_long) tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ if (isreg (curi->smode) && curi->size == sz_long)
+ addcycles (2);
+ fill_prefetch_next ();
start_brace ();
printf ("\tuae_u32 dst = ~src;\n");
genflags (flag_logical, curi->size, "dst", "", "");
case i_BTST:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
- if (isreg (curi->dmode)) tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ if (isreg (curi->dmode))
+ addcycles (2);
+ fill_prefetch_next ();
if (curi->size == sz_byte)
printf ("\tsrc &= 7;\n");
else
case i_BCHG:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
- if (isreg (curi->dmode)) tmpc += 4;
- fill_prefetch_next_delay (tmpc);
+ if (isreg (curi->dmode))
+ addcycles (4);
+ fill_prefetch_next ();
if (curi->size == sz_byte)
printf ("\tsrc &= 7;\n");
else
case i_BCLR:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
- if (isreg (curi->dmode)) tmpc += 4;
- fill_prefetch_next_delay (tmpc);
+ if (isreg (curi->dmode))
+ addcycles (4);
+ fill_prefetch_next ();
if (curi->size == sz_byte)
printf ("\tsrc &= 7;\n");
else
case i_BSET:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
- if (isreg (curi->dmode)) tmpc += 4;
- fill_prefetch_next_delay (tmpc);
+ if (isreg (curi->dmode))
+ addcycles (4);
+ fill_prefetch_next ();
if (curi->size == sz_byte)
printf ("\tsrc &= 7;\n");
else
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
if (isreg (curi->dmode)) {
if (curi->dmode == Areg || (curi->dmode == Dreg && curi->size == sz_long))
- tmpc += 2;
+ addcycles (2);
}
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next ();
start_brace ();
genflags (flag_cmp, curi->size, "newv", "src", "dst");
break;
genamode (curi->dmode, "dstreg", sz_long, "dst", 1, 0, 0);
if (isreg (curi->dmode)) {
if (curi->dmode == Areg || (curi->dmode == Dreg && curi->size == sz_long))
- tmpc += 2;
+ addcycles (2);
}
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next ();
start_brace ();
genflags (flag_cmp, sz_long, "newv", "src", "dst");
break;
case i_MVPRM:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
printf ("\tuaecptr memp = m68k_areg(regs, dstreg) + (uae_s32)(uae_s16)%s;\n", gen_nextiword (0));
- fill_prefetch_next ();
if (using_ce) {
if (curi->size == sz_word) {
printf ("\tput_byte_ce (memp, src >> 8); put_byte_ce (memp + 2, src);\n");
printf ("\tput_byte (memp + 4, src >> 8); put_byte (memp + 6, src);\n");
}
}
+ fill_prefetch_next ();
break;
case i_MVPMR:
printf ("\tuaecptr memp = m68k_areg(regs, srcreg) + (uae_s32)(uae_s16)%s;\n", gen_nextiword (0));
genastore ("val", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_MOVE:
- genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
- genamode (curi->dmode, "dstreg", curi->size, "dst", 2, 0, 1);
- genastore ("src", curi->dmode, "dstreg", curi->size, "dst");
- genflags (flag_logical, curi->size, "src", "", "");
- sync_m68k_pc ();
- fill_prefetch_next ();
- break;
case i_MOVEA:
- genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
- genamode (curi->dmode, "dstreg", curi->size, "dst", 2, 0, 1);
- if (curi->size == sz_word) {
- printf ("\tuae_u32 val = (uae_s32)(uae_s16)src;\n");
- } else {
- printf ("\tuae_u32 val = src;\n");
+ {
+ /* moves have special prefetch sequences:
+ * - MOVE <x>,-(An) = prefetch is before writes
+ * - MOVE <x>,(xxx).L, the most stupid ever. 2 prefetches after write
+ * if <x> is not register or immediate
+ * - all others = prefetch is done after writes
+ */
+ int prefetch_done = 0;
+ int dualprefetch = curi->dmode == absl && (curi->smode != Dreg && curi->smode != Areg && curi->smode != imm);
+ genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
+ genamode (curi->dmode, "dstreg", curi->size, "dst", 2, 0, 1 | (dualprefetch ? GF_NOREFILL : 0));
+ if (curi->mnemo == i_MOVEA && curi->size == sz_word)
+ printf ("\tsrc = (uae_s32)(uae_s16)src;\n");
+ if (curi->dmode == Apdi) {
+ fill_prefetch_next ();
+ prefetch_done = 1;
+ }
+ genastore ("src", curi->dmode, "dstreg", curi->size, "dst");
+ if (curi->mnemo == i_MOVE)
+ genflags (flag_logical, curi->size, "src", "", "");
+ sync_m68k_pc ();
+ if (dualprefetch) {
+ fill_prefetch_full ();
+ prefetch_done = 1;
+ }
+ if (!prefetch_done)
+ fill_prefetch_next ();
}
- fill_prefetch_next ();
- genastore ("val", curi->dmode, "dstreg", sz_long, "dst");
break;
case i_MVSR2:
genamode (curi->smode, "srcreg", sz_word, "src", 2, 0, 0);
- if (isreg (curi->smode)) tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ if (isreg (curi->smode))
+ addcycles (2);
+ fill_prefetch_next ();
printf ("\tMakeSR();\n");
if (curi->size == sz_byte)
genastore ("regs.sr & 0xff", curi->smode, "srcreg", sz_word, "src");
case i_MV2SR:
genamode (curi->smode, "srcreg", sz_word, "src", 1, 0, 0);
if (curi->size == sz_byte) {
- tmpc += 8;
+ addcycles (8);
printf ("\tMakeSR();\n\tregs.sr &= 0xFF00;\n\tregs.sr |= src & 0xFF;\n");
} else {
- tmpc += 4;
+ addcycles (4);
printf ("\tregs.sr = src;\n");
}
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next ();
printf ("\tMakeFromSR();\n");
break;
case i_SWAP:
case i_EXG:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
- fill_prefetch_next_delay (2);
+ addcycles (2);
+ fill_prefetch_next ();
genastore ("dst", curi->smode, "srcreg", curi->size, "src");
genastore ("src", curi->dmode, "dstreg", curi->size, "dst");
break;
genamode (curi->smode, "srcreg", curi->size, "src", 0, 0, GF_AA);
genamode (curi->dmode, "dstreg", curi->size, "dst", 2, 0, GF_AA);
if (curi->smode == Ad8r || curi->smode == PC8r)
- tmpc += 4;
- fill_prefetch_next_delay (tmpc);
+ addcycles (4);
+ fill_prefetch_next ();
genastore ("srca", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_PEA:
genamode (curi->smode, "srcreg", curi->size, "src", 0, 0, GF_AA);
genamode (Apdi, "7", sz_long, "dst", 2, 0, GF_AA);
if (curi->smode == Ad8r || curi->smode == PC8r)
- tmpc += 4;
- fill_prefetch_next_delay (tmpc);
+ addcycles (4);
+ if (!(curi->smode == absw || curi->smode == absl))
+ fill_prefetch_next ();
genastore ("srca", Apdi, "7", sz_long, "dst");
+ if ((curi->smode == absw || curi->smode == absl))
+ fill_prefetch_next ();
break;
case i_DBcc:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA | GF_NOREFILL);
if (using_ce) {
printf ("\tint cycles = 0;\n");
if (isreg (curi->smode))
- printf ("\tif (val) cycles += 2 * %d;\n", CYCLE_UNIT / 2);
+ printf ("\tif (val) cycles += 2 * %d;\n", CYCLE_UNIT / 2);
addcycles3 ("\t");
}
genastore ("val", curi->smode, "srcreg", curi->size, "src");
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
sync_m68k_pc ();
- fill_prefetch_next_delay (6);
+ addcycles (6);
+ fill_prefetch_next ();
printf ("\tif ((uae_s32)dst < 0) {\n");
printf ("\t\tSET_NFLG (1);\n");
printf ("\t\tException (6, oldpc);\n");
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
genflags (flag_logical, curi->size, "src", "", "");
if (!isreg (curi->smode))
- tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ addcycles (2);
+ fill_prefetch_next ();
printf ("\tsrc |= 0x80;\n");
genastore ("src", curi->smode, "srcreg", curi->size, "src");
break;
}
#ifdef CPUEMU_6
+
+#if 0
STATIC_INLINE uae_u32 mem_access_delay_word_read_cycles (uaecptr addr, int *cycles)
{
if (addr < 0x200000 || (addr >= 0xc00000 && addr < 0xe00000)) {
}
return get_word (addr);
}
+#endif
+
STATIC_INLINE uae_u32 mem_access_delay_word_read (uaecptr addr)
{
if (addr < 0x200000 || (addr >= 0xc00000 && addr < 0xe00000)) {
return v;
}
+#if 0
STATIC_INLINE int get_word_ce_prefetch_cycles (int o)
{
int cycles = 0;
regs.irc = mem_access_delay_word_read_cycles (m68k_getpc() + o, &cycles);
return cycles;
}
+#endif
STATIC_INLINE void put_word_ce (uaecptr addr, uae_u16 v)
{
int win32_automount_netdrives;
int win32_midioutdev;
int win32_midiindev;
- int win32_aspi;
+ int win32_uaescsimode;
int win32_soundcard;
int win32_norecyclebin;
int win32_specialkey;
{
if (p->z3fastmem_size > max_z3fastmem)
p->z3fastmem_size = max_z3fastmem;
- p->z3fastmem_size = 0;
+ else
+ p->z3fastmem_size = 0;
write_log ("Unsupported Zorro III fastmem size!\n");
err = 1;
}
if (i + 1 < argc)
i++;
} else if (strncmp (argv[i], "-config=", 8) == 0) {
+#ifdef FILESYS
+ free_mountinfo (currprefs.mountinfo);
+#endif
target_cfgfile_load (&currprefs, argv[i] + 8, -1, 1);
}
/* Check for new-style "-f xxx" argument, where xxx is config-file */
}
}
if (f) {
+ write_log("ROM.key loaded '%s'\n", tmp);
zfile_fseek (f, 0, SEEK_END);
keysize = zfile_ftell (f);
if (keysize > 0) {
if (f == NULL) {
sprintf (currprefs.romfile, "%s../shared/rom/kick.rom", start_path_data);
f = zfile_fopen (currprefs.romfile, "rb");
+ if (f == NULL) {
+ sprintf (currprefs.romfile, "%s../System/rom/kick.rom", start_path_data);
+ f = zfile_fopen (currprefs.romfile, "rb");
+ }
}
}
} else {
#include "sysconfig.h"
#include "sysdeps.h"
+#include "options.h"
#include "memory.h"
static struct scsi_info si[MAX_TOTAL_DEVICES];
static int unitcnt;
+char *get_nero_aspi_path(void)
+{
+ static char path[MAX_DPATH];
+ HKEY key;
+ DWORD type = REG_SZ;
+ DWORD size = sizeof (path);
+
+ if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "SOFTWARE\\Ahead\\shared", 0, KEY_ALL_ACCESS, &key) == ERROR_SUCCESS) {
+ if (RegQueryValueEx (key, "NeroAPI", 0, &type, (LPBYTE)path, &size) == ERROR_SUCCESS) {
+ HANDLE al;
+ strcat (path, "\\wnaspi32.dll");
+ RegCloseKey (key);
+ al = LoadLibrary(path);
+ if (al) {
+ FreeLibrary(al);
+ return path;
+ }
+ return NULL;
+ }
+ RegCloseKey (key);
+ }
+ return NULL;
+}
+
static int ha_inquiry (SCSI *scgp, int id, SRB_HAInquiry *ip)
{
DWORD Status;
BYTE ASPIStatus;
int i;
int nero;
- HKEY key;
- DWORD type = REG_SZ;
- DWORD size = sizeof (path);
/*
* Check if ASPI library is already loaded yet
nero = 0;
strcpy (path, "WNASPI32");
- if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "SOFTWARE\\Ahead\\shared", 0, KEY_ALL_ACCESS, &key) == ERROR_SUCCESS) {
- if (RegQueryValueEx (key, "NeroAPI", 0, &type, (LPBYTE)path, &size) == ERROR_SUCCESS) {
- strcat (path, "\\wnaspi32.dll");
- RegCloseKey (key);
+ if (currprefs.win32_uaescsimode == 2) {
+ char *p = get_nero_aspi_path();
+ if (p) {
+ strcpy (path, p);
nero = 1;
}
}
if (inq.type == INQ_ROMD) {
write_log ("CDROM");
use = 1;
- } else if (!flags && ((inq.type >= INQ_SEQD && inq.type < INQ_COMM && inq.type != INQ_PROCD && aspi_allow_misc) || aspi_allow_all)) {
+ } else if ((inq.type >= INQ_SEQD && inq.type < INQ_COMM && aspi_allow_misc) || aspi_allow_all) {
write_log ("%d", inq.type);
use = 1;
} else {
*/
+#define WIN32_LEAN_AND_MEAN
+#define _WIN32_WINNT 0x500
+
#include "sysconfig.h"
#include "sysdeps.h"
#include <stddef.h>
-#include <windows.h>
+#include <devioctl.h>
+#include <ntddstor.h>
+#include <winioctl.h>
#include <initguid.h> // Guid definition
#include <devguid.h> // Device guids
#include <setupapi.h> // for SetupDiXxx functions.
#include <cfgmgr32.h> // for SetupDiXxx functions.
-#include <devioctl.h>
+
#include <ntddscsi.h>
struct dev_info_spti {
char *drvpath;
+ char *name;
int mediainserted;
HANDLE handle;
int isatapi;
int type;
+ int bus, path, target, lun;
};
static uae_sem_t scgp_sem;
static struct dev_info_spti dev_info[MAX_TOTAL_DEVICES];
static uae_u8 *scsibuf;
-static int doscsi (HANDLE *h, SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER *swb, int *err)
+static int doscsi (int unitnum, SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER *swb, int *err)
{
DWORD status, returned;
+ struct dev_info_spti *di = &dev_info[unitnum];
*err = 0;
if (log_scsi) {
- write_log ("SCSI, H=%X: ", h);
+ write_log ("SCSI, H=%X:%d:%d:%d:%d: ", di->handle, di->bus, di->path, di->target, di->lun);
scsi_log_before (swb->spt.Cdb, swb->spt.CdbLength,
swb->spt.DataIn == SCSI_IOCTL_DATA_OUT ? swb->spt.DataBuffer : 0,swb->spt.DataTransferLength);
}
gui_cd_led (1);
- status = DeviceIoControl (h, IOCTL_SCSI_PASS_THROUGH_DIRECT,
+ swb->spt.ScsiStatus = 0;
+ if (di->bus >= 0) {
+ swb->spt.PathId = di->path;
+ swb->spt.TargetId = di->target;
+ swb->spt.Lun = di->lun;
+ }
+ status = DeviceIoControl (di->handle, IOCTL_SCSI_PASS_THROUGH_DIRECT,
swb, sizeof (SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER),
swb, sizeof (SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER),
&returned, NULL);
if (!status) {
int lasterror = GetLastError();
*err = lasterror;
- write_log("SCSI ERROR, H=%X: ", h);
+ write_log("SCSI ERROR, H=%X:%d:%d:%d:%d: ", di->handle, di->bus, di->path, di->target, di->lun);
write_log("Error code = %d, LastError=%d\n", swb->spt.ScsiStatus, lasterror);
scsi_log_before (swb->spt.Cdb, swb->spt.CdbLength,
swb->spt.DataIn == SCSI_IOCTL_DATA_OUT ? swb->spt.DataBuffer : 0,swb->spt.DataTransferLength);
swb.spt.SenseInfoOffset = offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, SenseBuf);
swb.spt.SenseInfoLength = 32;
memcpy (swb.spt.Cdb, data, len);
- status = doscsi (dev_info[unitnum].handle, &swb, &err);
+ status = doscsi (unitnum, &swb, &err);
uae_sem_post (&scgp_sem);
dolen = swb.spt.DataTransferLength;
if (!status)
swb.spt.DataTransferLength = scsi_len;
swb.spt.DataBuffer = scsi_datap;
- status = doscsi (dev_info[unitnum].handle, &swb, &err);
+ status = doscsi (unitnum, &swb, &err);
put_word (acmd + 18, status == 0 ? 0 : scsi_cmd_len_orig); /* fake scsi_CmdActual */
put_byte (acmd + 21, swb.spt.ScsiStatus); /* scsi_Status */
static int total_devices;
-static int adddrive (char *drvpath, int type)
+static int adddrive (char *drvpath, int bus, int pathid, int targetid, int lunid)
{
+ struct dev_info_spti *di;
int cnt = total_devices, i;
+
if (cnt >= MAX_TOTAL_DEVICES)
return 0;
for (i = 0; i < total_devices; i++) {
- if (!strcmp(drvpath, dev_info[i].drvpath))
+ di = &dev_info[i];
+ if (!strcmp(drvpath, di->drvpath))
return 0;
}
- dev_info[cnt].drvpath = my_strdup(drvpath);
- dev_info[cnt].type = type;
- write_log ("SPTI: uaescsi.device:%d ('%s')\n", cnt, drvpath);
+ write_log("SPTI: unit %d '%s' added\n", total_devices, drvpath);
+ di = &dev_info[total_devices];
+ di->drvpath = my_strdup(drvpath);
+ di->type = 0;
+ di->bus = bus;
+ di->path = pathid;
+ di->target = targetid;
+ di->lun = lunid;
total_devices++;
return 1;
}
static void close_scsi_bus (void)
{
+ int i;
VirtualFree (scsibuf, 0, MEM_RELEASE);
scsibuf = 0;
+ for (i = 0; i < total_devices; i++) {
+ xfree(dev_info[i].name);
+ xfree(dev_info[i].drvpath);
+ dev_info[i].name = NULL;
+ dev_info[i].drvpath = NULL;
+ }
}
-static int isatapi (int unitnum)
+static int inquiry (int unitnum, int *type, uae_u8 *inquirydata, int *inqlen)
{
uae_u8 cmd[6] = { 0x12,0,0,0,36,0 }; /* INQUIRY */
uae_u8 out[36];
uae_u8 *p = execscsicmd_in (unitnum, cmd, sizeof (cmd), &outlen);
int v = 0;
+ *inqlen = 0;
+ *type = 0x1f;
if (!p) {
if (log_scsi)
- write_log("INQUIRY failed!?\n");
+ write_log("SPTI: INQUIRY failed!?\n");
return 0;
}
+ *inqlen = outlen > 36 ? 36 : outlen;
+ if (outlen >= 1)
+ *type = p[0] & 31;
if (outlen >= 2 && (p[0] & 31) == 5 && (p[2] & 7) == 0)
v = 1;
+ memcpy (inquirydata, p, *inqlen);
if (log_scsi) {
if (outlen >= 36)
- write_log("INQUIRY: %02.2X%02.2X%02.2X %d '%-8.8s' '%-16.16s'\n",
+ write_log("SPTI: INQUIRY: %02.2X%02.2X%02.2X %d '%-8.8s' '%-16.16s'\n",
p[0], p[1], p[2], v, p + 8, p + 16);
}
return v;
return v >= 0 ? 1 : 0;
}
+static void close_scsi_device (int unitnum)
+{
+ write_log ("SPTI: cd unit %d closed\n", unitnum);
+ if (dev_info[unitnum].handle != INVALID_HANDLE_VALUE)
+ CloseHandle (dev_info[unitnum].handle);
+ dev_info[unitnum].handle = INVALID_HANDLE_VALUE;
+}
+
int open_scsi_device (int unitnum)
{
HANDLE h;
char *dev;
+ struct dev_info_spti *di;
- dev = dev_info[unitnum].drvpath;
- if (!dev)
+ di = &dev_info[unitnum];
+ if (unitnum >= total_devices)
+ return 0;
+ if (!di)
return 0;
+ if (di->bus >= 0) {
+ dev = xmalloc (100);
+ sprintf (dev, "\\\\.\\Scsi%d:", di->bus);
+ } else {
+ dev = my_strdup(di->drvpath);
+ }
h = CreateFile(dev,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,NULL);
- dev_info[unitnum].handle = h;
+ di->handle = h;
if (h == INVALID_HANDLE_VALUE) {
- write_log ("failed to open cd unit %d err=%d ('%s')\n", unitnum, GetLastError(), dev);
+ write_log ("SPTI: failed to open cd unit %d err=%d ('%s')\n", unitnum, GetLastError(), dev);
} else {
+ uae_u8 inqdata[37] = { 0 };
+ int inqlen;
+ dev_info[unitnum].isatapi = inquiry (unitnum, &dev_info[unitnum].type, inqdata, &inqlen);
+ if (inqlen == 0) {
+ write_log ("SPTI: inquiry failed unit %d ('%s':%d:%d:%d:%d)\n", unitnum, dev,
+ di->bus, di->path, di->target, di->lun);
+ close_scsi_device (unitnum);
+ xfree (dev);
+ return 0;
+ }
+ inqdata[36] = 0;
if (dev_info[unitnum].type == INQ_ROMD) {
dev_info[unitnum].mediainserted = mediacheck (unitnum);
- dev_info[unitnum].isatapi = isatapi (unitnum);
- write_log ("scsi cd unit %d opened (%s), %s ('%s')\n", unitnum,
- dev_info[unitnum].isatapi ? "[ATAPI]" : "[SCSI]",
- dev_info[unitnum].mediainserted ? "CD inserted" : "Drive empty", dev);
+ write_log ("SPTI: unit %d opened [%s], %s, '%s'\n", unitnum,
+ dev_info[unitnum].isatapi ? "ATAPI" : "SCSI",
+ dev_info[unitnum].mediainserted ? "CD inserted" : "Drive empty", inqdata + 8);
} else {
- write_log ("scsi unit %d, type %d opened ('%s')\n",
- unitnum, dev_info[unitnum].type, dev);
+ write_log ("SPTI: unit %d, '%s'\n",
+ unitnum, dev_info[unitnum].type, inqdata + 8);
}
+ dev_info[unitnum].name = my_strdup (inqdata + 8);
+ xfree (dev);
return 1;
}
+ xfree (dev);
return 0;
}
-static void close_scsi_device (int unitnum)
-{
- write_log ("cd unit %d closed\n", unitnum);
- if (dev_info[unitnum].handle != INVALID_HANDLE_VALUE)
- CloseHandle (dev_info[unitnum].handle);
- dev_info[unitnum].handle = INVALID_HANDLE_VALUE;
-}
-
static struct device_info *info_device (int unitnum, struct device_info *di)
{
if (unitnum >= MAX_TOTAL_DEVICES || dev_info[unitnum].handle == INVALID_HANDLE_VALUE)
return 0;
- di->label = my_strdup(dev_info[unitnum].drvpath);
+ di->label = my_strdup(dev_info[unitnum].name);
di->bus = 0;
di->target = unitnum;
di->lun = 0;
void win32_spti_media_change (char driveletter, int insert)
{
-#if 1
int i, now;
for (i = 0; i < total_devices; i++) {
}
}
}
-#else
- int i;
-
- for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
- if (dev_info[i].drvletter == driveletter && dev_info[i].mediainserted != insert) {
- write_log ("SPTI: media change %c %d\n", driveletter, insert);
- dev_info[i].mediainserted = insert;
- scsi_do_disk_change (driveletter, insert);
- }
- }
-#endif
}
static int check_isatapi (int unitnum)
0, 0, 0, 0, 0, 0, 0, check_isatapi
};
+#define SCSI_INFO_BUFFER_SIZE 0x5000 // Big enough to hold all Bus/Device info.
+static char* BusType[] = {
+ "UNKNOWN", // 0x00
+ "SCSI",
+ "ATAPI",
+ "ATA",
+ "IEEE 1394",
+ "SSA",
+ "FIBRE",
+ "USB",
+ "RAID"
+};
+
+static void GetInquiryData(PCTSTR pDevId, DWORD idx)
+{
+ SP_DEVICE_INTERFACE_DATA interfaceData;
+ PSP_DEVICE_INTERFACE_DETAIL_DATA interfaceDetailData = NULL;
+ STORAGE_PROPERTY_QUERY query;
+ PSTORAGE_ADAPTER_DESCRIPTOR adpDesc;
+ PSCSI_BUS_DATA BusData;
+ PSCSI_INQUIRY_DATA InquiryData;
+ PSCSI_ADAPTER_BUS_INFO AdapterInfo;
+ HANDLE hDevice;
+ BOOL status;
+ DWORD index = 0;
+ HDEVINFO hIntDevInfo;
+ UCHAR outBuf[512];
+ BOOL Claimed;
+ ULONG returnedLength;
+ SHORT Bus,
+ Luns;
+ DWORD interfaceDetailDataSize,
+ reqSize,
+ errorCode;
+
+
+ hIntDevInfo = SetupDiGetClassDevs (
+ &StoragePortClassGuid,
+ pDevId, // Enumerator
+ NULL, // Parent Window
+ (DIGCF_PRESENT | DIGCF_INTERFACEDEVICE // Only Devices present & Interface class
+ ));
+
+ if (hIntDevInfo == INVALID_HANDLE_VALUE) {
+ write_log ("SetupDiGetClassDevs failed with error: %d\n", GetLastError());
+ return;
+ }
+
+ interfaceData.cbSize = sizeof (SP_INTERFACE_DEVICE_DATA);
+
+ status = SetupDiEnumDeviceInterfaces (
+ hIntDevInfo, // Interface Device Info handle
+ 0,
+ (LPGUID) &StoragePortClassGuid,
+ index, // Member
+ &interfaceData // Device Interface Data
+ );
+
+ if (status == FALSE) {
+ errorCode = GetLastError();
+ if (errorCode == ERROR_NO_MORE_ITEMS)
+ return;
+ write_log ("SetupDiEnumDeviceInterfaces failed with error: %d\n", errorCode);
+ return;
+ }
+
+ //
+ // Find out required buffer size, so pass NULL
+ //
+
+ status = SetupDiGetDeviceInterfaceDetail (
+ hIntDevInfo, // Interface Device info handle
+ &interfaceData, // Interface data for the event class
+ NULL, // Checking for buffer size
+ 0, // Checking for buffer size
+ &reqSize, // Buffer size required to get the detail data
+ NULL // Checking for buffer size
+ );
+
+ //
+ // This call returns ERROR_INSUFFICIENT_BUFFER with reqSize
+ // set to the required buffer size. Ignore the above error and
+ // pass a bigger buffer to get the detail data
+ //
+
+ if (status == FALSE) {
+ errorCode = GetLastError();
+ if (errorCode != ERROR_INSUFFICIENT_BUFFER) {
+ write_log ("SetupDiGetDeviceInterfaceDetail failed with error: %d\n", errorCode);
+ return;
+ }
+ }
+
+ //
+ // Allocate memory to get the interface detail data
+ // This contains the devicepath we need to open the device
+ //
+
+ interfaceDetailDataSize = reqSize;
+ interfaceDetailData = malloc (interfaceDetailDataSize);
+ if (interfaceDetailData == NULL) {
+ write_log ("Unable to allocate memory to get the interface detail data.\n");
+ return;
+ }
+ interfaceDetailData->cbSize = sizeof (SP_INTERFACE_DEVICE_DETAIL_DATA);
+
+ status = SetupDiGetDeviceInterfaceDetail (
+ hIntDevInfo, // Interface Device info handle
+ &interfaceData, // Interface data for the event class
+ interfaceDetailData, // Interface detail data
+ interfaceDetailDataSize, // Interface detail data size
+ &reqSize, // Buffer size required to get the detail data
+ NULL); // Interface device info
+
+ if (status == FALSE) {
+ write_log ("Error in SetupDiGetDeviceInterfaceDetail failed with error: %d\n", GetLastError());
+ return;
+ }
+
+ //
+ // Now we have the device path. Open the device interface
+ // to get adapter property and inquiry data
+
+
+ hDevice = CreateFile(
+ interfaceDetailData->DevicePath, // device interface name
+ GENERIC_READ | GENERIC_WRITE, // dwDesiredAccess
+ FILE_SHARE_READ | FILE_SHARE_WRITE, // dwShareMode
+ NULL, // lpSecurityAttributes
+ OPEN_EXISTING, // dwCreationDistribution
+ 0, // dwFlagsAndAttributes
+ NULL // hTemplateFile
+ );
+
+ //
+ // We have the handle to talk to the device.
+ // So we can release the interfaceDetailData buffer
+ //
+
+ free (interfaceDetailData);
+
+ if (hDevice == INVALID_HANDLE_VALUE) {
+ write_log ("CreateFile failed with error: %d\n", GetLastError());
+ CloseHandle ( hDevice );
+ return;
+ }
+
+ query.PropertyId = StorageAdapterProperty;
+ query.QueryType = PropertyStandardQuery;
+
+ status = DeviceIoControl(
+ hDevice,
+ IOCTL_STORAGE_QUERY_PROPERTY,
+ &query,
+ sizeof(STORAGE_PROPERTY_QUERY),
+ &outBuf,
+ 512,
+ &returnedLength,
+ NULL
+ );
+ if (!status) {
+ write_log ("IOCTL failed with error code%d.\n\n", GetLastError());
+ } else {
+ adpDesc = (PSTORAGE_ADAPTER_DESCRIPTOR) outBuf;
+ write_log ("\nAdapter Properties\n");
+ write_log ("------------------\n");
+ write_log ("Bus Type : %s\n", BusType[adpDesc->BusType]);
+ write_log ("Max. Tr. Length: 0x%x\n", adpDesc->MaximumTransferLength );
+ write_log ("Max. Phy. Pages: 0x%x\n", adpDesc->MaximumPhysicalPages );
+ write_log ("Alignment Mask : 0x%x\n", adpDesc->AlignmentMask );
+ }
+
+ AdapterInfo = (PSCSI_ADAPTER_BUS_INFO) malloc(SCSI_INFO_BUFFER_SIZE) ;
+ if (AdapterInfo == NULL) {
+ CloseHandle (hDevice);
+ return;
+ }
+
+ // Get the SCSI inquiry data for all devices for the given SCSI bus
+ status = DeviceIoControl(
+ hDevice,
+ IOCTL_SCSI_GET_INQUIRY_DATA,
+ NULL,
+ 0,
+ AdapterInfo,
+ SCSI_INFO_BUFFER_SIZE,
+ &returnedLength,
+ NULL );
+
+ if (!status) {
+ write_log ("Error in IOCTL_SCSI_GET_INQUIRY_DATA\n" );
+ free (AdapterInfo);
+ CloseHandle (hDevice);
+ return;
+ }
+
+ write_log ("Initiator Path ID Target ID LUN Claimed Device \n");
+ write_log ("---------------------------------------------------------\n");
+
+ for (Bus = 0; Bus < AdapterInfo->NumberOfBuses; Bus++) {
+ BusData = &AdapterInfo->BusData[Bus];
+ InquiryData = (PSCSI_INQUIRY_DATA) ( (PUCHAR) AdapterInfo + BusData->InquiryDataOffset );
+ for (Luns = 0; Luns < BusData->NumberOfLogicalUnits; Luns++) {
+ char label[100];
+ int type = InquiryData->InquiryData[0] & 0x1f;
+ Claimed = InquiryData->DeviceClaimed;
+ write_log (" %3d %d %d %d %s %d\n",
+ BusData->InitiatorBusId, InquiryData->PathId, InquiryData->TargetId,
+ InquiryData->Lun, Claimed ? "Yes" : "No ", type);
+ if (!Claimed) {
+ sprintf (label, "SCSI(%d):%d:%d:%d:%d", idx, BusData->InitiatorBusId,
+ InquiryData->PathId, InquiryData->TargetId, InquiryData->Lun);
+ adddrive (label, idx, InquiryData->PathId, InquiryData->TargetId, InquiryData->Lun);
+ }
+ InquiryData = (PSCSI_INQUIRY_DATA) ( (PUCHAR) AdapterInfo + InquiryData->NextInquiryDataOffset );
+ } // for Luns
+ } // for Bus
+
+ write_log ("\n" );
+ free (AdapterInfo);
+ CloseHandle (hDevice);
+}
+
+static void GetChildDevices(DEVINST DevInst)
+{
+ DEVINST childDevInst;
+ DEVINST siblingDevInst;
+ CONFIGRET configRetVal;
+ TCHAR deviceInstanceId[MAX_DEVICE_ID_LEN];
+// HDEVINFO tmpdi;
+
+ configRetVal = CM_Get_Child (
+ &childDevInst,
+ DevInst,
+ 0 );
+
+ if (configRetVal == CR_NO_SUCH_DEVNODE) {
+ write_log ("No child devices\n");
+ return;
+ }
+
+ if (configRetVal != CR_SUCCESS) {
+ write_log ("CM_Get_Child failed with error: %x\n", configRetVal);
+ return;
+ }
+
+ do {
+
+ // Get the Device Instance ID using the handle
+ configRetVal = CM_Get_Device_ID(
+ childDevInst,
+ deviceInstanceId,
+ sizeof(deviceInstanceId)/sizeof(TCHAR),
+ 0
+ );
+ if (configRetVal != CR_SUCCESS) {
+ write_log ("CM_Get_Device_ID: Get Device Instance ID failed with error: %x\n", configRetVal);
+ return;
+ }
+
+ write_log ("'%s'\n", deviceInstanceId);
+#if 0
+ tmpdi = SetupDiCreateDeviceInfoList (NULL, NULL);
+ if (tmpdi) {
+ SP_DEVINFO_DATA did;
+ did.cbSize = sizeof (did);
+ SetupDiOpenDeviceInfo(tmpdi, deviceInstanceId, NULL, 0, &did);
+ adddrive (deviceInstanceId, -1, -1, -1, -1);
+ SetupDiDestroyDeviceInfoList (tmpdi);
+ }
+#endif
+ // Get sibling
+ configRetVal = CM_Get_Sibling (
+ &siblingDevInst,
+ childDevInst,
+ 0 );
+
+ if (configRetVal == CR_NO_SUCH_DEVNODE)
+ return;
+
+ if (configRetVal != CR_SUCCESS) {
+ write_log ("CM_Get_Sibling failed with error: 0x%X\n", configRetVal);
+ return;
+ }
+ childDevInst = siblingDevInst;
+
+ } while (TRUE);
+
+}
+
+static BOOL GetRegistryProperty(HDEVINFO DevInfo, DWORD Index, int *first)
+{
+ SP_DEVINFO_DATA deviceInfoData;
+ DWORD errorCode;
+ DWORD bufferSize = 0;
+ DWORD dataType;
+ LPTSTR buffer = NULL;
+ BOOL status;
+ CONFIGRET configRetVal;
+ TCHAR deviceInstanceId[MAX_DEVICE_ID_LEN];
+
+ // Get the DEVINFO data. This has the handle to device instance
+ deviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
+ status = SetupDiEnumDeviceInfo(
+ DevInfo, // Device info set
+ Index, // Index in the info set
+ &deviceInfoData); // Info data. Contains handle to dev inst
+
+ if (status == FALSE) {
+ errorCode = GetLastError();
+ if (errorCode == ERROR_NO_MORE_ITEMS) {
+ if (*first)
+ write_log ("SPTI: No SCSI adapters detected\n");
+ return FALSE;
+ }
+ write_log ("SetupDiEnumDeviceInfo failed with error: %d\n", errorCode);
+ return FALSE;
+ }
+ *first = 0;
+
+ // Get the Device Instance ID using the handle
+ configRetVal = CM_Get_Device_ID(
+ deviceInfoData.DevInst, // Handle to dev inst
+ deviceInstanceId, // Buffer to receive dev inst
+ sizeof(deviceInstanceId)/sizeof(TCHAR), // Buffer size
+ 0); // Must be zero
+ if (configRetVal != CR_SUCCESS) {
+ write_log ("CM_Get_Device_ID failed with error: %d\n", configRetVal);
+ return FALSE;
+ }
+
+ //
+ // We won't know the size of the HardwareID buffer until we call
+ // this function. So call it with a null to begin with, and then
+ // use the required buffer size to Alloc the necessary space.
+ // Call it again with the obtained buffer size
+ //
+ status = SetupDiGetDeviceRegistryProperty(
+ DevInfo,
+ &deviceInfoData,
+ SPDRP_HARDWAREID,
+ &dataType,
+ (PBYTE)buffer,
+ bufferSize,
+ &bufferSize);
+
+ if (status == FALSE) {
+ errorCode = GetLastError();
+ if (errorCode != ERROR_INSUFFICIENT_BUFFER) {
+ if (errorCode == ERROR_INVALID_DATA) {
+ //
+ // May be a Legacy Device with no HardwareID. Continue.
+ //
+ write_log ("No Hardware ID, may be a legacy device!\n");
+ } else {
+ write_log ("SetupDiGetDeviceRegistryProperty failed with error: %d\n", errorCode);
+ return FALSE;
+ }
+ }
+ }
+
+ //
+ // We need to change the buffer size.
+ //
+ buffer = LocalAlloc(LPTR, bufferSize);
+ status = SetupDiGetDeviceRegistryProperty(
+ DevInfo,
+ &deviceInfoData,
+ SPDRP_HARDWAREID,
+ &dataType,
+ (PBYTE)buffer,
+ bufferSize,
+ &bufferSize);
+
+ if (status == FALSE) {
+ errorCode = GetLastError();
+ if (errorCode == ERROR_INVALID_DATA) {
+ //
+ // May be a Legacy Device with no HardwareID. Continue.
+ //
+ write_log ("No Hardware ID, may be a legacy device!\n");
+ } else {
+ write_log ("SetupDiGetDeviceRegistryProperty failed with error: %d\n", errorCode);
+ return FALSE;
+ }
+ }
+ write_log ("Device ID '%s'\n",buffer);
+
+ if (buffer)
+ LocalFree(buffer);
+
+ // **** Now get the Device Description
+
+ //
+ // We won't know the size of the Location Information buffer until
+ // we call this function. So call it with a null to begin with,
+ // and then use the required buffer size to Alloc the necessary space.
+ // Call it again with the obtained buffer size
+ //
+
+ status = SetupDiGetDeviceRegistryProperty(
+ DevInfo,
+ &deviceInfoData,
+ SPDRP_DEVICEDESC,
+ &dataType,
+ (PBYTE)buffer,
+ bufferSize,
+ &bufferSize);
+
+ if (status == FALSE) {
+ errorCode = GetLastError();
+ if (errorCode != ERROR_INSUFFICIENT_BUFFER) {
+ if (errorCode == ERROR_INVALID_DATA) {
+ write_log("No Device Description!\n");
+ } else {
+ write_log("SetupDiGetDeviceRegistryProperty failed with error: %d\n", errorCode);
+ return FALSE;
+ }
+ }
+ }
+
+ //
+ // We need to change the buffer size.
+ //
+
+ buffer = LocalAlloc(LPTR, bufferSize);
+
+ status = SetupDiGetDeviceRegistryProperty(
+ DevInfo,
+ &deviceInfoData,
+ SPDRP_DEVICEDESC,
+ &dataType,
+ (PBYTE)buffer,
+ bufferSize,
+ &bufferSize);
+
+ if (status == FALSE) {
+ errorCode = GetLastError();
+ if (errorCode == ERROR_INVALID_DATA) {
+ write_log ("No Device Description!\n");
+ } else {
+ write_log ("SetupDiGetDeviceRegistryProperty failed with error: %d\n", errorCode);
+ return FALSE;
+ }
+ }
+
+ write_log ("Device Description '%s'\n",buffer);
+
+ if (buffer)
+ LocalFree(buffer);
+
+ // Reenumerate the SCSI adapter device node
+ configRetVal = CM_Reenumerate_DevNode(deviceInfoData.DevInst, 0);
+
+ if (configRetVal != CR_SUCCESS) {
+ write_log ("CM_Reenumerate_DevNode failed with error: %d\n", configRetVal);
+ return FALSE;
+ }
+
+ GetInquiryData ((PCTSTR)&deviceInstanceId, Index);
+
+ // Find the children devices
+ GetChildDevices (deviceInfoData.DevInst);
+
+ return TRUE;
+}
+
static int getCDROMProperty(int idx, HDEVINFO DevInfo, const GUID *guid)
{
SP_DEVICE_INTERFACE_DATA interfaceData;
if (status == FALSE)
return FALSE;
- adddrive (interfaceDetailData->DevicePath, INQ_ROMD);
+ adddrive (interfaceDetailData->DevicePath, -1, -1, -1, -1);
free (interfaceDetailData);
return TRUE;
}
-static const GUID *guids[] = {
- &GUID_DEVINTERFACE_CDROM,
- &GUID_DEVINTERFACE_TAPE,
- &GUID_DEVINTERFACE_WRITEONCEDISK,
- &GUID_DEVINTERFACE_MEDIUMCHANGER,
- &GUID_DEVINTERFACE_CDCHANGER,
- &GUID_DEVINTERFACE_STORAGEPORT,
- NULL};
+static const GUID *guids[] = { &GUID_DEVINTERFACE_CDROM, NULL };
+static const char *scsinames[] = { "Tape", "Scanner", NULL };
static int rescan(void)
{
HDEVINFO hDevInfo;
+ HANDLE h;
int idx, idx2;
+ int first;
+ char tmp[100];
- write_log("Scan starts..\n");
for (idx2 = 0; guids[idx2]; idx2++) {
hDevInfo = SetupDiGetClassDevs(
guids[idx2],
NULL, NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
if (hDevInfo != INVALID_HANDLE_VALUE) {
- write_log("%d:\n", idx2);
for (idx = 0; ; idx++) {
if (!getCDROMProperty(idx, hDevInfo, guids[idx2]))
break;
SetupDiDestroyDeviceInfoList(hDevInfo);
}
}
- write_log("finished.\n");
+
+ for (idx2 = 0; scsinames[idx2]; idx2++) {
+ for (idx = 0; idx < 10; idx++) {
+ sprintf (tmp, "\\\\.\\%s%d", scsinames[idx2], idx);
+ h = CreateFile(tmp, GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL, OPEN_EXISTING, 0, NULL);
+ if (h != INVALID_HANDLE_VALUE) {
+ adddrive(tmp, -1, -1, -1, -1);
+ CloseHandle(h);
+ }
+ }
+ }
+
+ first = 1;
+ hDevInfo = SetupDiGetClassDevs(&GUID_DEVCLASS_SCSIADAPTER, NULL, NULL, DIGCF_PRESENT);
+ if (hDevInfo != INVALID_HANDLE_VALUE) {
+ for (idx = 0; ; idx++) {
+ if (!GetRegistryProperty(hDevInfo, idx, &first))
+ break;
+ }
+ }
+ SetupDiDestroyDeviceInfoList(hDevInfo);
return 1;
}
+
#endif
verts[3].sx = left - 0.5f; verts[3].sy = bottom - 0.5f; verts[3].sz = z;
// set the texture
- hr = IDirect3DDevice9_SetTexture(dev, 0, src);
+ hr = IDirect3DDevice9_SetTexture(dev, 0, (IDirect3DBaseTexture9*)src);
if (FAILED (hr))
write_log ("IDirect3DDevice9_SetTexture failed: %s\n", D3D_ErrorString (hr));
static int hdf_seek (struct hardfiledata *hfd, uae_u64 offset)
{
DWORD high, ret;
-
+
+ if (hfd->handle_valid == 0) {
+ gui_message ("hd: hdf handle is not valid. bug.");
+ abort();
+ }
if (hfd->offset != hfd->offset2 || hfd->size != hfd->size2) {
gui_message ("hd: memory corruption detected in seek");
abort ();
uae_u32 size;
uae_u32 add = 0x11000000;
uae_u32 inc = 0x100000;
+ uae_u64 size64, total64;
MEMORYSTATUS memstats;
#ifdef CPU_64_BIT
memstats.dwLength = sizeof(memstats);
GlobalMemoryStatus(&memstats);
- max_z3fastmem = 16 * 1024 * 1024;
- while ((uae_u64)memstats.dwAvailPageFile + (uae_u64)memstats.dwAvailPhys >= ((uae_u64)max_z3fastmem << 1)
- && max_z3fastmem != ((uae_u64)2048 * 1024 * 1024))
- max_z3fastmem <<= 1;
- size = max_z3fastmem;
- if (size > max_allowed_mman * 1024 * 1024)
- size = max_allowed_mman * 1024 * 1024;
+ size64 = 16 * 1024 * 1024;
+ total64 = (uae_u64)memstats.dwAvailPageFile + (uae_u64)memstats.dwAvailPhys;
+ while (total64 >= (size64 << 1)
+ && size64 != ((uae_u64)2048) * 1024 * 1024)
+ size64 <<= 1;
+ if (size64 > max_allowed_mman * 1024 * 1024)
+ size64 = max_allowed_mman * 1024 * 1024;
+ if (size64 > 0x20000000)
+ size64 = 0x20000000;
+ if (size64 < 8 * 1024 * 1024)
+ size64 = 8 * 1024 * 1024;
+ size = max_z3fastmem = (uae_u32)size64;
canbang = 0;
gfxoffs = 0;
#define IDC_D0 1532
#define IDC_STATE_CAPTURE 1532
#define IDC_D1 1533
-#define IDC_STATE_CAPTURE2 1533
#define IDC_KBLED_USB 1533
#define IDC_D2 1534
#define IDC_D3 1535
#define IDC_FILTERPRESETSAVE 1633
#define IDC_FLOPPYSPD_TEXT 1634
#define IDC_FILTERPRESETDELETE 1634
-#define IDC_KAILLERA 1635
#define IDC_HARDDRIVE 1635
#define IDC_INACTIVE_PRI 1635
-#define IDC_KAILLERA_CHAT 1636
#define IDC_SOUNDPRIMARY 1636
#define IDC_MINIMIZED_PRI 1636
-#define IDC_KAILLERA_CHAT_TEXT 1637
#define IDC_VOLUME_BOOTPRI_TEXT 1637
-#define IDC_KAILLERA_CHAT_SEND 1638
#define IDC_VOLUME_BOOTPRI 1638
-#define IDC_KAILLERA_LIST 1639
#define IDC_KBLED1 1639
-#define IDC_KAILLERAFELLOW 1640
#define IDC_KBLED2 1640
#define IDC_SOUNDFILTER 1640
-#define IDC_KAILLERAJOY 1641
#define IDC_KBLED3 1641
#define IDC_SOUNDCALIBRATE 1641
-#define IDC_KAILLERAJOYKEYBOARD 1642
-#define IDC_ACTIVEPRIORITY 1642
#define IDC_ACTIVE_PRIORITY 1642
#define IDC_SOUNDDRIVE 1642
-#define IDC_KAILLERAOPTIONS 1643
#define IDC_INACTIVE_PRIORITY 1643
-#define IDC_KAILLERASUPPRESSWARNINGS 1644
#define IDC_ACTIVE_PRI 1644
-#define IDC_KAILLERANONE 1645
#define IDC_MINIMIZED_PRIORITY 1645
#define IDC_AVIOUTPUT_FRAMELIMITER 1645
-#define IDC_KAILLERACONTROLS 1646
#define IDC_STATE_RATE 1646
-#define IDC_KAILLERANOFPSLIMIT 1647
#define IDC_STATE_BUFFERSIZE 1647
#define IDC_SOUNDDRIVESELECT 1647
#define IDC_PANELTREE 1647
#define IDC_FE_INFO 1701
#define IDC_FE_INFO2 1702
#define IDC_FE_SCREENSHOT 1702
+#define IDC_PATHS_DEFAULTTYPE 1704
+#define IDC_SCSIMODE 1705
#define ID__FLOPPYDRIVES 40004
#define ID_FLOPPYDRIVES_DF0 40005
#define ID_ST_CONFIGURATION 40010
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 249
#define _APS_NEXT_COMMAND_VALUE 40021
-#define _APS_NEXT_CONTROL_VALUE 1704
+#define _APS_NEXT_CONTROL_VALUE 1705
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
- GROUPBOX "Advanced:",IDC_STATIC,8,4,285,103
+ GROUPBOX "Advanced:",IDC_STATIC,8,4,285,110
CONTROL "Middle-Mouse-Button --> ALT-TAB",IDC_JULIAN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,19,120,10
CONTROL "Show GUI on startup",IDC_SHOWGUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,34,120,10
CONTROL "On-Screen LEDs",IDC_SHOWLEDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,49,115,10
CONTROL "BSDsocket.library emulation",IDC_SOCKETS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,19,120,10
CONTROL "Use CTRL-F11 to quit",IDC_CTRLF11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,34,120,10
CONTROL "Don't use RGB overlays",IDC_NOOVERLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,49,120,10
- CONTROL "Use ASPI SCSI layer",IDC_ASPI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,64,115,10
CONTROL "Syncronize clock",IDC_CLOCKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,78,115,10
- GROUPBOX "Keyboard LEDs:",IDC_STATIC,7,110,85,104
- COMBOBOX IDC_KBLED1,22,123,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- COMBOBOX IDC_KBLED2,22,142,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- COMBOBOX IDC_KBLED3,22,162,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- GROUPBOX "Logging:",IDC_STATIC,97,110,195,25
- CONTROL "Create log file",IDC_CREATELOGFILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,120,72,10,0,HIDC_CREATELOGFILE
- CONTROL "Illegal mem accesses",IDC_ILLEGAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,120,80,10
- GROUPBOX "State files:",IDC_STATIC,98,137,195,78
- PUSHBUTTON "Load state...",IDC_DOLOADSTATE,105,156,49,14
- PUSHBUTTON "Save state...",IDC_DOSAVESTATE,106,182,49,14
- CONTROL "Enable state recording",IDC_STATE_CAPTURE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,188,155,88,10
- RTEXT "Recording rate (seconds)",IDC_STATE_RATE_TEXT,157,173,86,10,SS_CENTERIMAGE | WS_TABSTOP
- COMBOBOX IDC_STATE_RATE,248,171,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
- RTEXT "Recording buffer (MB)",IDC_STATE_BUFFERSIZE_TEXT,157,193,83,10,SS_CENTERIMAGE | WS_TABSTOP
- COMBOBOX IDC_STATE_BUFFERSIZE,248,191,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
+ GROUPBOX "Keyboard LEDs:",IDC_STATIC,7,120,85,94
+ COMBOBOX IDC_KBLED1,22,134,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_KBLED2,22,153,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_KBLED3,22,173,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ GROUPBOX "Logging:",IDC_STATIC,97,120,195,25
+ CONTROL "Create log file",IDC_CREATELOGFILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,130,72,10,0,HIDC_CREATELOGFILE
+ CONTROL "Illegal mem accesses",IDC_ILLEGAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,130,80,10
+ GROUPBOX "State files:",IDC_STATIC,98,146,195,69
+ PUSHBUTTON "Load state...",IDC_DOLOADSTATE,105,162,49,14
+ PUSHBUTTON "Save state...",IDC_DOSAVESTATE,106,188,49,14
+ CONTROL "Enable state recording",IDC_STATE_CAPTURE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,188,161,88,10
+ RTEXT "Recording rate (seconds)",IDC_STATE_RATE_TEXT,157,179,86,10,SS_CENTERIMAGE | WS_TABSTOP
+ COMBOBOX IDC_STATE_RATE,248,177,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
+ RTEXT "Recording buffer (MB)",IDC_STATE_BUFFERSIZE_TEXT,157,199,83,10,SS_CENTERIMAGE | WS_TABSTOP
+ COMBOBOX IDC_STATE_BUFFERSIZE,248,197,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
CONTROL "Always on top",IDC_ALWAYSONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,92,117,10
CONTROL "Catweasel",IDC_CATWEASEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,92,115,10
- CONTROL "USB-mode",IDC_KBLED_USB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,185,64,10
+ CONTROL "USB-mode",IDC_KBLED_USB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,196,64,10
+ COMBOBOX IDC_SCSIMODE,159,62,104,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
IDD_HARDFILE DIALOGEX 0, 0, 299, 212
PUSHBUTTON "Help",IDHELP,366,259,50,14,WS_DISABLED
END
-IDD_PATHS DIALOGEX 0, 0, 300, 221
+IDD_PATHS DIALOGEX 0, 0, 300, 237
STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
LTEXT "Saveimage path:",IDC_PATHS_SAVEIMAGEL,14,163,260,8,SS_CENTERIMAGE
EDITTEXT IDC_PATHS_SAVEIMAGE,14,175,261,15,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_PATHS_SAVEIMAGES,281,175,11,15
- PUSHBUTTON "Reset to defaults",IDC_PATHS_DEFAULT,13,199,73,14
- PUSHBUTTON "Rescan ROMs",IDC_ROM_RESCAN,97,199,73,14
- PUSHBUTTON "Clear registry",IDC_RESETREGISTRY,219,199,73,14
+ PUSHBUTTON "Reset to defaults",IDC_PATHS_DEFAULT,14,199,92,14
+ PUSHBUTTON "Rescan ROMs",IDC_ROM_RESCAN,14,218,92,14
+ PUSHBUTTON "Clear registry",IDC_RESETREGISTRY,190,217,85,14
+ COMBOBOX IDC_PATHS_DEFAULTTYPE,112,199,163,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
END
IDD_QUICKSTART DIALOGEX 0, 0, 300, 242
RECT amigawin_rect;
static UINT TaskbarRestart;
static int TaskbarRestartOk;
+static int forceroms;
char VersionStr[256];
char start_path_data[MAX_DPATH];
char start_path_exe[MAX_DPATH];
+char start_path_af[MAX_DPATH];
char help_file[MAX_DPATH];
+int af_path_2005, af_path_old, winuae_path;
extern int harddrive_dangerous, do_rdbdump, aspi_allow_all, no_rawinput;
int log_scsi;
int WIN32_RegisterClasses( void )
{
WNDCLASS wc;
- HDC hDC = GetDC( NULL );
-
+ HDC hDC;
+
+ hDC = GetDC( NULL );
if (GetDeviceCaps (hDC, NUMCOLORS) != -1)
g_dwBackgroundColor = RGB (255, 0, 255);
ReleaseDC (NULL, hDC);
debugfile = 0;
}
+extern char *get_nero_aspi_path(void);
+
void target_default_options (struct uae_prefs *p, int type)
{
if (type == 2 || type == 0) {
p->win32_automount_drives = 0;
p->win32_automount_netdrives = 0;
p->win32_kbledmode = 0;
+ p->win32_uaescsimode = get_nero_aspi_path() ? 2 : ((os_winnt && os_winnt_admin) ? 0 : 1);
}
if (type == 1 || type == 0) {
p->win32_midioutdev = -2;
}
}
+static const char *scsimode[] = { "SPTI", "AdaptecASPI", "NeroASPI", 0 };
+
void target_save_options (struct zfile *f, struct uae_prefs *p)
{
cfgfile_target_write (f, "middle_mouse=%s\n", p->win32_middle_mouse ? "true" : "false");
cfgfile_target_write (f, "midiout_device=%d\n", p->win32_midioutdev );
cfgfile_target_write (f, "midiin_device=%d\n", p->win32_midiindev );
cfgfile_target_write (f, "no_overlay=%s\n", p->win32_no_overlay ? "true" : "false" );
- cfgfile_target_write (f, "aspi=%s\n", p->win32_aspi ? "true" : "false" );
+ cfgfile_target_write (f, "uaescsimode=%s\n", scsimode[p->win32_uaescsimode]);
cfgfile_target_write (f, "soundcard=%d\n", p->win32_soundcard );
cfgfile_target_write (f, "cpu_idle=%d\n", p->cpu_idle);
cfgfile_target_write (f, "notaskbarbutton=%s\n", p->win32_notaskbarbutton ? "true" : "false");
cfgfile_target_write (f, "always_on_top=%s\n", p->win32_alwaysontop ? "true" : "false");
cfgfile_target_write (f, "no_recyclebin=%s\n", p->win32_norecyclebin ? "true" : "false");
cfgfile_target_write (f, "specialkey=0x%x\n", p->win32_specialkey);
- cfgfile_target_write (f, "kbledmode=%d\n", p->win32_kbledmode);}
+ cfgfile_target_write (f, "kbledmode=%d\n", p->win32_kbledmode);
+
+}
static int fetchpri (int pri, int defpri)
{
0
};
-
int target_parse_option (struct uae_prefs *p, char *option, char *value)
{
int i, v;
|| cfgfile_yesno (option, value, "logfile", &p->win32_logfile)
|| cfgfile_yesno (option, value, "networking", &p->socket_emu)
|| cfgfile_yesno (option, value, "no_overlay", &p->win32_no_overlay)
- || cfgfile_yesno (option, value, "aspi", &p->win32_aspi)
|| cfgfile_yesno (option, value, "inactive_pause", &p->win32_inactive_pause)
|| cfgfile_yesno (option, value, "inactive_nosound", &p->win32_inactive_nosound)
|| cfgfile_yesno (option, value, "iconified_pause", &p->win32_iconified_pause)
|| cfgfile_intval (option, value, "kbledmode", &p->win32_kbledmode, 1)
|| cfgfile_intval (option, value, "cpu_idle", &p->cpu_idle, 1));
+
+ if (cfgfile_yesno (option, value, "aspi", &v)) {
+ p->win32_uaescsimode = 0;
+ if (v)
+ p->win32_uaescsimode = get_nero_aspi_path() ? 2 : 1;
+ return 1;
+ }
+
+ if (cfgfile_strval (option, value, "uaescsimode", &p->win32_uaescsimode, scsimode, 0))
+ return 1;
+
+
if (cfgfile_intval (option, value, "active_priority", &v, 1)) {
p->win32_active_priority = fetchpri (v, 1);
return 1;
DWORD v = GetFileAttributes (tmp);
if (v == INVALID_FILE_ATTRIBUTES || !(v & FILE_ATTRIBUTE_DIRECTORY))
strcpy (tmp, start_path_data);
+ if (af_path_2005) {
+ strcpy (tmp, start_path_af);
+ strcat (tmp, "System\\rom");
+ } else if (af_path_old) {
+ strcpy (tmp, start_path_exe);
+ strcat (tmp, "..\\shared\\rom");
+ }
}
strcat (tmp, "\\");
}
extern int scan_roms (char*);
-void read_rom_list (int force)
+void read_rom_list (void)
{
char tmp2[1000];
DWORD size2;
KEY_READ | KEY_WRITE, NULL, &fkey, &disp);
if (fkey == NULL)
return;
- if (disp == REG_CREATED_NEW_KEY || force)
+ if (disp == REG_CREATED_NEW_KEY || forceroms)
scan_roms (NULL);
+ forceroms = 0;
idx = 0;
for (;;) {
int err;
char version[100];
HKEY hWinUAEKeyLocal = NULL;
HKEY fkey;
- int forceroms = 0;
HKEY rkey;
char rpath1[MAX_DPATH], rpath2[MAX_DPATH], rpath3[MAX_DPATH];
RegSetValueEx(hWinUAEKey, "yPosGUI", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof(colortype));
}
size = sizeof (version);
+ dwType = REG_SZ;
if (RegQueryValueEx (hWinUAEKey, "Version", 0, &dwType, (LPBYTE)&version, &size) == ERROR_SUCCESS) {
if (checkversion (version))
RegSetValueEx (hWinUAEKey, "Version", 0, REG_SZ, (CONST BYTE *)VersionStr, strlen (VersionStr) + 1);
}
size = sizeof (version);
+ dwType = REG_SZ;
if (RegQueryValueEx (hWinUAEKey, "ROMCheckVersion", 0, &dwType, (LPBYTE)&version, &size) == ERROR_SUCCESS) {
if (checkversion (version)) {
if (RegSetValueEx (hWinUAEKey, "ROMCheckVersion", 0, REG_SZ, (CONST BYTE *)VersionStr, strlen (VersionStr) + 1) == ERROR_SUCCESS)
forceroms = 1;
}
+ dwType = REG_DWORD;
RegQueryValueEx(hWinUAEKey, "DisplayInfo", 0, &dwType, (LPBYTE)&colortype, &dwDisplayInfoSize);
if (colortype == 0) /* No color information stored in the registry yet */
{
WIN32GFX_FigurePixelFormats(colortype);
}
size = sizeof (quickstart);
+ dwType = REG_DWORD;
RegQueryValueEx(hWinUAEKey, "QuickStartMode", 0, &dwType, (LPBYTE)&quickstart, &size);
}
fetch_path ("ConfigurationPath", path, sizeof (path));
fkey = read_disk_history ();
if (fkey)
RegCloseKey (fkey);
- read_rom_list (forceroms);
+ read_rom_list ();
}
static void betamessage (void)
typedef HRESULT (CALLBACK* SHGETFOLDERPATH)(HWND,int,HANDLE,DWORD,LPTSTR);
typedef BOOL (CALLBACK* SHGETSPECIALFOLDERPATH)(HWND,LPTSTR,int,BOOL);
-
+extern int path_type;
static void getstartpaths(int start_data)
{
SHGETFOLDERPATH pSHGetFolderPath;
SHGETSPECIALFOLDERPATH pSHGetSpecialFolderPath;
char *posn, *p;
+ char tmp[MAX_DPATH], prevpath[MAX_DPATH];
DWORD v;
+ HKEY key;
+ DWORD dispo;
+ int path_done;
+ path_done = 0;
+ path_type = 2005;
+ if (RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Arabuusimiehet\\WinUAE", 0, "", REG_OPTION_NON_VOLATILE,
+ KEY_WRITE | KEY_READ, NULL, &key, &dispo) == ERROR_SUCCESS)
+ {
+ DWORD size = sizeof (prevpath);
+ DWORD dwType = REG_SZ;
+ if (RegQueryValueEx (key, "PathMode", 0, &dwType, (LPBYTE)&prevpath, &size) != ERROR_SUCCESS)
+ prevpath[0] = 0;
+ RegCloseKey(key);
+ }
pSHGetFolderPath = (SHGETFOLDERPATH)GetProcAddress(
GetModuleHandle("shell32.dll"), "SHGetFolderPathA");
pSHGetSpecialFolderPath = (SHGETSPECIALFOLDERPATH)GetProcAddress(
strcpy (start_path_exe, _pgmptr );
if((posn = strrchr (start_path_exe, '\\')))
posn[1] = 0;
+
+ strcpy (tmp, start_path_exe);
+ strcat (tmp, "..\\shared\\rom\\rom.key");
+ v = GetFileAttributes(tmp);
+ if (v != INVALID_FILE_ATTRIBUTES) {
+ af_path_old = 1;
+ if (!strcmp (prevpath, "AF")) {
+ path_done = 1;
+ path_type = 1;
+ }
+
+ }
+
+ strcpy (tmp, start_path_exe);
+ strcat (tmp, "roms");
+ v = GetFileAttributes(tmp);
+ if (v != INVALID_FILE_ATTRIBUTES && (v & FILE_ATTRIBUTE_DIRECTORY)) {
+ WIN32_FIND_DATA fd;
+ HANDLE h;
+ int i;
+ strcat (tmp, "\\*.*");
+ h = FindFirstFile(tmp, &fd);
+ if (h != INVALID_HANDLE_VALUE) {
+ for (i = 0; i < 3; i++) {
+ if (!FindNextFile (h, &fd))
+ break;
+ }
+ if (i == 3) {
+ winuae_path = 1;
+ if (!strcmp (prevpath, "WinUAE")) {
+ path_done = 1;
+ path_type = 0;
+ }
+ }
+ FindClose(h);
+ }
+ }
+
p = getenv("AMIGAFOREVERDATA");
- if (start_data == 0 && p) {
- strcpy (start_path_data, p);
- v = GetFileAttributes(start_path_data);
- strcat(start_path_data, "\\WinUAE");
- if (v != INVALID_FILE_ATTRIBUTES && (v & FILE_ATTRIBUTE_DIRECTORY))
+ if (start_data == 0 && p ) {
+ strcpy (tmp, p);
+ strcpy (start_path_af, p);
+ v = GetFileAttributes(tmp);
+ if (v != INVALID_FILE_ATTRIBUTES && (v & FILE_ATTRIBUTE_DIRECTORY)) {
+ if (path_done == 0) {
+ strcpy (start_path_data, start_path_af);
+ strcat (start_path_data, "WinUAE");
+ path_done = 1;
+ }
start_data = 1;
+ af_path_2005 = 1;
+ }
}
+
if (start_data == 0) {
BOOL ok = FALSE;
if (pSHGetFolderPath)
else if (pSHGetSpecialFolderPath)
ok = pSHGetSpecialFolderPath(NULL, start_path_data, CSIDL_COMMON_DOCUMENTS, 0);
if (ok) {
- strcat(start_path_data, "\\My Amiga Files\\WinUAE");
- v = GetFileAttributes(start_path_data);
- if (v != INVALID_FILE_ATTRIBUTES && (v & FILE_ATTRIBUTE_DIRECTORY))
+ strcpy (start_path_af, start_path_data);
+ strcat (start_path_af, "\\Amiga Files\\");
+ strcpy (tmp, start_path_af);
+ strcat(tmp, "WinUAE");
+ v = GetFileAttributes(tmp);
+ if (v != INVALID_FILE_ATTRIBUTES && (v & FILE_ATTRIBUTE_DIRECTORY)) {
+ if (path_done == 0) {
+ strcpy (start_path_data, start_path_af);
+ strcat (start_path_data, "WinUAE");
+ path_done = 1;
+ }
start_data = 1;
+ af_path_2005 = 1;
+ }
}
}
+
v = GetFileAttributes(start_path_data);
if (v == INVALID_FILE_ATTRIBUTES || !(v & FILE_ATTRIBUTE_DIRECTORY) || start_data <= 0)
strcpy(start_path_data, start_path_exe);
extern int mouseactive, focus;
extern int ignore_messages_all;
#define WINUAEBETA 1
-#define WINUAEBETASTR " Beta 5"
+#define WINUAEBETASTR " Beta 6"
extern char start_path_exe[MAX_DPATH];
extern char start_path_data[MAX_DPATH];
extern int screen_is_picasso;
extern HINSTANCE hInst;
extern int win_x_diff, win_y_diff;
+extern int af_path_2005, af_path_old, winuae_path;
+extern char start_path_af[MAX_DPATH];
extern void sleep_millis (int ms);
extern void sleep_millis_busy (int ms);
void exit_gui (int);
void fetch_path (char *name, char *out, int size);
void set_path (char *name, char *path);
-void read_rom_list (int);
+void read_rom_list (void);
#define WIN32_PLUGINDIR "plugins\\"
HMODULE WIN32_LoadLibrary (const char *);
if (ret)
set_path ("KickstartPath", path);
}
- read_rom_list (0);
+ read_rom_list ();
show_rom_list ();
return ret;
}
RegDeleteValue (hWinUAEKey, "QuickStartHostConfig");
}
+int path_type;
static INT_PTR CALLBACK PathsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int recursive;
- char tmp[MAX_DPATH];
+ static int ptypes[3], numtypes;
+ int val, selpath = 0;
+ char tmp[MAX_DPATH], pathmode[32];
switch (msg)
{
#if !WINUAEBETA
ShowWindow (GetDlgItem (hDlg, IDC_RESETREGISTRY), FALSE);
#endif
+ numtypes = 0;
+ SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_RESETCONTENT, 0, 0L);
+ if (af_path_2005) {
+ SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_ADDSTRING, 0, (LPARAM)"AmigaForever 2005");
+ if (path_type == 2005)
+ selpath = numtypes;
+ ptypes[numtypes++] = 2005;
+ }
+ if (af_path_old) {
+ SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_ADDSTRING, 0, (LPARAM)"AmigaForever (old)");
+ if (path_type == 1)
+ selpath = numtypes;
+ ptypes[numtypes++] = 1;
+ }
+ if (winuae_path) {
+ SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_ADDSTRING, 0, (LPARAM)"WinUAE default");
+ if (path_type == 0)
+ selpath = numtypes;
+ ptypes[numtypes++] = 0;
+ }
+ SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_SETCURSEL, selpath, 0);
+ if (numtypes > 1) {
+ EnableWindow(GetDlgItem (hDlg, IDC_PATHS_DEFAULTTYPE), TRUE);
+ ShowWindow(GetDlgItem (hDlg, IDC_PATHS_DEFAULTTYPE), TRUE);
+ } else {
+ EnableWindow(GetDlgItem (hDlg, IDC_PATHS_DEFAULTTYPE), FALSE);
+ ShowWindow(GetDlgItem (hDlg, IDC_PATHS_DEFAULTTYPE), FALSE);
+ }
values_to_pathsdialog (hDlg);
recursive--;
return TRUE;
GetWindowText (GetDlgItem (hDlg, IDC_PATHS_AVIOUTPUT), tmp, sizeof (tmp));
set_path ("VideoPath", tmp);
break;
- case IDC_PATHS_DEFAULT:
- set_path ("KickstartPath", NULL);
- set_path ("ConfigurationPath", NULL);
- set_path ("ScreenshotPath", NULL);
- set_path ("StatefilePath", NULL);
- set_path ("SaveimagePath", NULL);
- set_path ("VideoPath", NULL);
- values_to_pathsdialog (hDlg);
- FreeConfigStore ();
+ case IDC_PATHS_DEFAULT:
+ val = SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_GETCURSEL, 0, 0L);
+ if (val != CB_ERR && val >= 0 && val < numtypes) {
+ char *p = my_strdup (start_path_data);
+ int pp1 = af_path_2005, pp2 = af_path_old;
+ val = ptypes[val];
+ if (val == 0) {
+ strcpy (start_path_data, start_path_exe);
+ af_path_2005 = af_path_old = 0;
+ path_type = 0;
+ strcpy (pathmode, "WinUAE");
+ } else if (val == 1) {
+ strcpy (start_path_data, start_path_exe);
+ af_path_2005 = 0;
+ strcpy (pathmode, "AF");
+ path_type = 1;
+ } else {
+ strcpy (pathmode, "AF2005");
+ path_type = 2005;
+ strcpy (start_path_data, start_path_af);
+ }
+ if (hWinUAEKey)
+ RegSetValueEx (hWinUAEKey, "PathMode", 0, REG_SZ, (CONST BYTE *)pathmode, strlen(pathmode) + 1);
+ set_path ("KickstartPath", NULL);
+ set_path ("ConfigurationPath", NULL);
+ set_path ("ScreenshotPath", NULL);
+ set_path ("StatefilePath", NULL);
+ set_path ("SaveimagePath", NULL);
+ set_path ("VideoPath", NULL);
+ values_to_pathsdialog (hDlg);
+ FreeConfigStore ();
+ strcpy (start_path_data, p);
+ xfree (p);
+ af_path_2005 = pp1;
+ af_path_old = pp2;
+ }
break;
case IDC_ROM_RESCAN:
scan_roms (NULL);
EnableWindow (GetDlgItem (hDlg, IDC_NOSOUND), TRUE);
EnableWindow (GetDlgItem (hDlg, IDC_NOOVERLAY), FALSE);
EnableWindow (GetDlgItem (hDlg, IDC_DOSAVESTATE), TRUE);
- EnableWindow (GetDlgItem (hDlg, IDC_ASPI), FALSE);
+ EnableWindow (GetDlgItem (hDlg, IDC_SCSIMODE), FALSE);
EnableWindow (GetDlgItem (hDlg, IDC_SCSIDEVICE), FALSE);
EnableWindow (GetDlgItem (hDlg, IDC_CLOCKSYNC), FALSE);
EnableWindow (GetDlgItem (hDlg, IDC_CATWEASEL), FALSE);
EnableWindow (GetDlgItem (hDlg, IDC_DOSAVESTATE), FALSE);
EnableWindow (GetDlgItem (hDlg, IDC_STATE_RATE), workprefs.statecapture ? TRUE : FALSE);
EnableWindow (GetDlgItem (hDlg, IDC_STATE_BUFFERSIZE), workprefs.statecapture ? TRUE : FALSE);
+ EnableWindow (GetDlgItem (hDlg, IDC_SCSIMODE), workprefs.scsi ? TRUE : FALSE);
}
}
SendDlgItemMessage (hDlg, v, CB_SETCURSEL, pri, 0);
}
+extern char *get_nero_aspi_path(void);
+
+static void misc_scsi(HWND hDlg)
+{
+ char txt[100];
+ HANDLE al;
+
+ SendDlgItemMessage (hDlg, IDC_SCSIMODE, CB_RESETCONTENT, 0, 0);
+ strcpy (txt, "(SPTI)");
+ if (os_winnt && os_winnt_admin)
+ strcpy (txt, "SPTI");
+ SendDlgItemMessage (hDlg, IDC_SCSIMODE, CB_ADDSTRING, 0, (LPARAM)txt);
+ strcpy (txt, "(AdaptecASPI)");
+ al = LoadLibrary("wnaspi32.dll");
+ if (al) {
+ FreeLibrary(al);
+ strcpy (txt, "AdaptecASPI");
+ }
+ SendDlgItemMessage (hDlg, IDC_SCSIMODE, CB_ADDSTRING, 0, (LPARAM)txt);
+ strcpy (txt, "(NeroASPI)");
+ if (get_nero_aspi_path())
+ strcpy (txt, "NeroASPI");
+ SendDlgItemMessage (hDlg, IDC_SCSIMODE, CB_ADDSTRING, 0, (LPARAM)txt);
+ SendDlgItemMessage (hDlg, IDC_SCSIMODE, CB_SETCURSEL, workprefs.win32_uaescsimode, 0);
+}
+
static void values_to_miscdlg (HWND hDlg)
{
char txt[100];
CheckDlgButton (hDlg, IDC_SCSIDEVICE, workprefs.scsi);
CheckDlgButton (hDlg, IDC_NOTASKBARBUTTON, workprefs.win32_notaskbarbutton);
CheckDlgButton (hDlg, IDC_ALWAYSONTOP, workprefs.win32_alwaysontop);
- CheckDlgButton (hDlg, IDC_ASPI, workprefs.win32_aspi);
CheckDlgButton (hDlg, IDC_CLOCKSYNC, workprefs.tod_hack);
cw = catweasel_detect();
EnableWindow (GetDlgItem (hDlg, IDC_CATWEASEL), cw);
misc_addpri (hDlg, IDC_INACTIVE_PRIORITY, workprefs.win32_inactive_priority);
misc_addpri (hDlg, IDC_MINIMIZED_PRIORITY, workprefs.win32_iconified_priority);
-
SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)"1");
SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)"5");
SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)"100");
sprintf (txt, "%d", workprefs.statecapturebuffersize / (1024 * 1024));
SendDlgItemMessage( hDlg, IDC_STATE_BUFFERSIZE, WM_SETTEXT, 0, (LPARAM)txt);
+
+ misc_scsi(hDlg);
}
static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
char txt[100];
+ int v;
switch (msg)
{
case IDC_STATE_BUFFERSIZE:
getcbn (hDlg, IDC_STATE_BUFFERSIZE, txt, sizeof (txt));
break;
+ case IDC_SCSIMODE:
+ v = SendDlgItemMessage(hDlg, IDC_SCSIMODE, CB_GETCURSEL, 0, 0L);
+ if (v != CB_ERR)
+ workprefs.win32_uaescsimode = v;
+ break;
}
}
} else if (currentpage == MISC2_ID) {
break;
case IDC_SCSIDEVICE:
workprefs.scsi = IsDlgButtonChecked (hDlg, IDC_SCSIDEVICE);
- break;
- case IDC_ASPI:
- workprefs.win32_aspi = IsDlgButtonChecked (hDlg, IDC_ASPI);
+ enable_for_miscdlg (hDlg);
break;
case IDC_CLOCKSYNC:
workprefs.tod_hack = IsDlgButtonChecked (hDlg, IDC_CLOCKSYNC);
static void updatejoyport (HWND hDlg)
{
int i, j;
- char tmp[MAX_DPATH];
+ char tmp[MAX_DPATH], tmp2[MAX_DPATH];
enable_for_portsdlg (hDlg);
if (joy0previous < 0)
SendDlgItemMessage (hDlg, id, CB_RESETCONTENT, 0, 0L);
SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)"");
+ WIN32GUI_LoadUIString (IDS_NONE, tmp, sizeof (tmp) - 3);
+ sprintf (tmp2, "<%s>", tmp);
+ SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)tmp2);
WIN32GUI_LoadUIString (IDS_KEYJOY, tmp, sizeof (tmp));
strcat (tmp, "\n");
p1 = tmp;
SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)inputdevice_get_device_name(IDTYPE_JOYSTICK, j));
for (j = 0; j < inputdevice_get_device_total (IDTYPE_MOUSE); j++, total++)
SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)inputdevice_get_device_name(IDTYPE_MOUSE, j));
- if (v >= JSEM_MICE) {
+ if (v < 0) {
+ idx = -1;
+ } else if (v >= JSEM_MICE) {
idx = v - JSEM_MICE;
if (idx >= inputdevice_get_device_total (IDTYPE_MOUSE))
idx = 0;
} else {
idx = v - JSEM_KBDLAYOUT;
}
- idx++;
+ idx+=2;
if (idx >= total)
idx = 0;
SendDlgItemMessage (hDlg, id, CB_SETCURSEL, idx, 0);
int id = i == 0 ? IDC_PORT0_JOYS : IDC_PORT1_JOYS;
LRESULT v = SendDlgItemMessage (hDlg, id, CB_GETCURSEL, 0, 0L);
if (v != CB_ERR && v > 0) {
- v--;
- if (v < JSEM_LASTKBD)
+ v-=2;
+ if (v < 0)
+ *port = -1;
+ else if (v < JSEM_LASTKBD)
*port = JSEM_KBDLAYOUT + (int)v;
else if (v >= JSEM_LASTKBD + inputdevice_get_device_total (IDTYPE_JOYSTICK))
*port = JSEM_MICE + (int)v - inputdevice_get_device_total (IDTYPE_JOYSTICK) - JSEM_LASTKBD;
fixjport (&workprefs.jport1, workprefs.jport0);
}
- item = SendDlgItemMessage( hDlg, IDC_PRINTERLIST, CB_GETCURSEL, 0, 0L );
- if( item != CB_ERR )
+ item = SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_GETCURSEL, 0, 0L);
+ if(item != CB_ERR)
{
int got = 0;
strcpy (tmp, workprefs.prtname);
{
int ret;
+ read_rom_list();
ret = GetSettings(1, currprefs.win32_notaskbarbutton ? hHiddenWnd : GetDesktopWindow());
if (ret > 0) {
#ifdef AVIOUTPUT
Name="winuae"
ProjectGUID="{4ADAA943-1AC8-4FB5-82E5-4FB753B6C2DA}"
RootNamespace="winuae"
+ SignManifests="true"
>
<Platforms>
<Platform
AdditionalOptions=""
Optimization="0"
AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep"
- PreprocessorDefinitions="WINVER=0x0500,_DEBUG,WIN32,_WINDOWS,_WIN32_IE 0x0500,UNIX"
+ PreprocessorDefinitions="WINVER=0x0500,_DEBUG,WIN32,_WINDOWS,_WIN32_IE=0x0500,UNIX"
ExceptionHandling="0"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
- AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib zlib.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib capsimg.lib dxerr8.lib shlwapi.lib"
+ AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib capsimg.lib dxerr8.lib shlwapi.lib zlibstat.lib"
+ ShowProgress="0"
OutputFile="d:\amiga\winuae.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
OmitFramePointers="true"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep"
- PreprocessorDefinitions="WINVER=0x0500,WIN32,NDEBUG,_WINDOWS,_WIN32_IE 0x0500,UNIX"
+ PreprocessorDefinitions="WINVER=0x0500,WIN32,NDEBUG,_WINDOWS,_WIN32_IE=0x0500,UNIX"
StringPooling="true"
ExceptionHandling="0"
BasicRuntimeChecks="0"
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr8.lib shlwapi.lib zlib.lib"
+ AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr8.lib shlwapi.lib zlibstat.lib"
OutputFile="d:\amiga\winuae.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
dev->aunit = unitnum;
unitnum++;
}
- write_log ("%s = %s:%d\n", dev->di.label, UAEDEV_SCSI, dev->aunit);
+ write_log ("%s:%d = '%s'\n", UAEDEV_SCSI, dev->aunit, dev->di.label);
}
xfree(dev->di.label);
dev->di.label = NULL;
Read unzip.h for more info
*/
+#define ZLIB_WINAPI
+
#include "sysconfig.h"
#include "sysdeps.h"
* 2002-2004 Toni Wilen
*/
+#define ZLIB_WINAPI
+
#include "sysconfig.h"
#include "sysdeps.h"
#include "dms/pfile.h"
#include "gui.h"
#include "crc32.h"
-
#include <zlib.h>
struct zfile {