]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1100b6.zip
authorToni Wilen <twilen@winuae.net>
Mon, 5 Sep 2005 15:31:44 +0000 (18:31 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:26:33 +0000 (21:26 +0200)
28 files changed:
blitter.c
blkdev.c
cfgfile.c
cia.c
compemu_raw_x86.c
custom.c
debug.c
drawing.c
filesys.c
gencpu.c
include/cpu_prefetch.h
include/options.h
main.c
memory.c
od-win32/blkdev_win32_aspi.c
od-win32/blkdev_win32_spti.c
od-win32/direct3d.c
od-win32/hardfile_win32.c
od-win32/mman.c
od-win32/resources/resource.h
od-win32/resources/winuae.rc
od-win32/win32.c
od-win32/win32.h
od-win32/win32gui.c
od-win32/winuae_msvc/winuae_msvc.vcproj
scsiemul.c
unzip.c
zfile.c

index 5a0c8c9ea7021b4d2dc55f1990223900bce94c22..e0ddb0dd024ae25cdfcd1a9b64a376c7ada0c1c0 100755 (executable)
--- a/blitter.c
+++ b/blitter.c
@@ -57,7 +57,7 @@ static int blit_cyclecounter, blit_maxcyclecounter, blit_slowdown;
 static int blit_linecyclecounter, blit_misscyclecounter;
 
 #ifdef CPUEMU_6
-extern uae_u8 cycle_line[];
+extern int cycle_line[];
 #endif
 
 static long blit_firstline_cycles;
@@ -251,8 +251,12 @@ STATIC_INLINE int channel_state (int 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;
 }
 
@@ -581,7 +585,7 @@ static void decide_blitter_line (int hpos)
                    break;
                }
 #if 1
-               if (c && !canblit(blit_last_hpos))
+               if (c && canblit(blit_last_hpos) <= 0)
                    break;
 #endif
 #if 1
@@ -812,13 +816,20 @@ void decide_blitter (int hpos)
            }
 #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;
                }
@@ -1066,8 +1077,9 @@ void maybe_blit (int hpos, int hack)
 #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) {
index c730369acd7e9e5d5f07b3ecf754100187d59a19..2125eaff41eb2fa0a65558cc58f82c15284222ea 100755 (executable)
--- a/blkdev.c
+++ b/blkdev.c
@@ -35,7 +35,7 @@ static void install_driver (int flags)
        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;
     }
index d9eb96b343bc1944561097d88409d1a199179742..63afbc98e6f6cb180eb86e70dd71aa4d7072d74d 100755 (executable)
--- a/cfgfile.c
+++ b/cfgfile.c
@@ -149,7 +149,7 @@ static const char *obsolete[] = {
     "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
 };
 
@@ -311,7 +311,9 @@ static void save_options (struct zfile *f, struct uae_prefs *p, int type)
     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);
@@ -752,31 +754,41 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value)
 
     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;
     }
diff --git a/cia.c b/cia.c
index d18a23e8e7a2ef41733eb7f53ca25bbda740691e..69586a79aadafd4089aa6372cab9f7aacfc490ec 100755 (executable)
--- a/cia.c
+++ b/cia.c
@@ -1041,7 +1041,7 @@ static void cia_wait_pre (void)
     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;
index aa331717560515faab14c050bb37646ceb333ec2..049f8eebe7f401553b63c705a7b7ea15e14ac45b 100755 (executable)
@@ -2432,17 +2432,6 @@ enum {
   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;
@@ -2450,7 +2439,7 @@ static struct ptt {
   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 },
@@ -2458,7 +2447,8 @@ x86_alignments[X86_PROCESSOR_max] = {
   { 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
@@ -2613,16 +2603,6 @@ static void raw_init_cpu(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);
@@ -2644,9 +2624,8 @@ static void raw_init_cpu(void)
        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
index 48ba59679fbb0b47ba240898234a99e85824c31f..d86fe00c00d2a917bf4c931662b96ea6902b7266 100755 (executable)
--- a/custom.c
+++ b/custom.c
@@ -187,7 +187,7 @@ static int last_sprite_point, nr_armed;
 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;
@@ -419,6 +419,16 @@ STATIC_INLINE void setclr (uae_u16 *p, uae_u16 val)
        *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;
@@ -535,29 +545,15 @@ static void decide_diw (int hpos)
 }
 
 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... */
@@ -643,11 +639,11 @@ static int fetchunits[] = { 8,8,8,0, 16,8,8,0, 32,16,8,0 };
 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)
 {
@@ -675,9 +671,9 @@ 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++) {
@@ -702,6 +698,12 @@ static void create_cycle_diagram_table(void)
                }
                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;
            }
        }
     }
@@ -756,23 +758,32 @@ static int toscr_delay1x, toscr_delay2x, toscr_delay1, toscr_delay2;
    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)
@@ -1553,7 +1564,7 @@ static void maybe_start_bpl_dma (int hpos)
        return;
     if (hpos <= plfstrt)
        return;
-    if (hpos > plfstop)
+    if (hpos > plfstop - fetchunit)
        return;
     if (ddfstate != DIW_waiting_start)
        passed_plfstop = 1;
@@ -1858,7 +1869,7 @@ STATIC_INLINE void record_sprite_1 (uae_u16 *buf, uae_u32 datab, int num, int db
    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;
@@ -1920,8 +1931,7 @@ static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16
 
     /* 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;
@@ -1991,7 +2001,7 @@ static void decide_sprites (int hpos)
     }
     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;
 }
@@ -2353,6 +2363,7 @@ static void calcdiw (void)
 /* display mode changed (lores, doubling etc..), recalculate everything */
 void init_custom (void)
 {
+    create_cycle_diagram_table ();
     reset_drawing ();
     init_hz ();
     calcdiw ();
@@ -2439,6 +2450,8 @@ STATIC_INLINE uae_u16 VPOSR (void)
 #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)
@@ -2458,6 +2471,8 @@ STATIC_INLINE uae_u16 VHPOSR (void)
     uae_u16 v = GETVPOS() << 8;
     uae_u16 hp = GETHPOS();
     v |= hp;
+    if (currprefs.cpu_level >= 2)
+       hsyncdelay();
     return v;
 }
 
@@ -2486,7 +2501,7 @@ static void COPJMP (int num)
     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;
     }
@@ -4274,7 +4289,7 @@ static void hsync_handler (void)
 #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;
@@ -5000,7 +5015,7 @@ void REGPARAM2 custom_wput (uaecptr addr, uae_u32 value)
 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;
@@ -5446,16 +5461,15 @@ STATIC_INLINE decide_fetch_ce (int hpos)
        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);
@@ -5467,9 +5481,8 @@ STATIC_INLINE int dma_cycle(void)
                break;
            }
            decide_blitter (hpos);
-           bnasty++;
-       } else if (bpldma || cycle_line[hpos]) {
-           bnasty++;
+           if (dmaen(DMA_BLITTER))
+               bnasty++;
        }
        if (cycle_line[hpos] == 0 && !bpldma)
            break;
@@ -5477,7 +5490,6 @@ STATIC_INLINE int dma_cycle(void)
     }
     bnasty = 0;
     cycle_line[hpos] |= CYCLE_CPU;
-    return cycles;
 }
 
 uae_u32 wait_cpu_cycle_read (uaecptr addr, int mode)
@@ -5492,6 +5504,7 @@ 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;
@@ -5503,6 +5516,7 @@ uae_u32 wait_cpu_cycle_read_cycles (uaecptr addr, int mode, int *cycles)
     do_cycles (1 * CYCLE_UNIT);
     return v;
 }
+#endif
 
 void wait_cpu_cycle_write (uaecptr addr, int mode, uae_u32 v)
 {
@@ -5516,7 +5530,7 @@ 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;
@@ -5524,9 +5538,7 @@ void do_cycles_ce (long cycles)
        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);
     }
 }
 
diff --git a/debug.c b/debug.c
index 898d97b0a53b192c6f09bced00b761d3af7b1951..90e897de04021e35c8c6ce3535a923fc49f6e95f 100755 (executable)
--- a/debug.c
+++ b/debug.c
@@ -83,7 +83,7 @@ static char help[] = {
     "  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"
@@ -298,21 +298,24 @@ static void dump_custom_regs (void)
     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");
@@ -1217,7 +1220,7 @@ static void m68k_modify (char **inptr)
 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;
@@ -1233,7 +1236,12 @@ static void debug_1 (void)
        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);
index 7d0ba1df3e2fae11019bb5e37f977a663d032af8..7e9b2be17ab8582fcdb38e442a30c4edda9ac074 100755 (executable)
--- a/drawing.c
+++ b/drawing.c
@@ -1033,15 +1033,15 @@ STATIC_INLINE void pfield_doline_1 (uae_u32 *pixels, int wordcount, int planes)
        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);
index aa2c036c072c81a35b9d497063108d93b7e61fe3..2b4ea4a1929955fb9103abb9cf4d2a903bf46473 100755 (executable)
--- a/filesys.c
+++ b/filesys.c
@@ -214,10 +214,20 @@ static char *set_filesys_unit_1 (struct uaedev_mount_info *mountinfo, int nr,
 {
     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;
@@ -1743,7 +1753,7 @@ static void free_lock (Unit *unit, uaecptr lock)
 }
 
 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;
@@ -1800,23 +1810,23 @@ static void action_free_lock (Unit *unit, dpacket packet)
     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
@@ -1824,11 +1834,20 @@ action_dup_lock (Unit *unit, dpacket packet)
     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 */
@@ -2257,6 +2276,20 @@ static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallb
     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)
 {
@@ -3356,6 +3389,7 @@ static int handle_packet (Unit *unit, dpacket pck)
      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;
@@ -3364,7 +3398,6 @@ static int handle_packet (Unit *unit, dpacket pck)
      /* 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:
index f3a0bc0e99c592f533b119acb935ca06feedd196..d49f03d3d58a062a85a0628ce4c6acd2ef76bc28 100755 (executable)
--- a/gencpu.c
+++ b/gencpu.c
@@ -206,9 +206,10 @@ static void gen_nextilong (char *type, char *name, int norefill)
                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);
@@ -335,6 +336,7 @@ static void fill_prefetch_next (void)
     fill_prefetch_next_1 ();
 }
 
+#if 0
 static void fill_prefetch_next_delay (int extracycles)
 {
     if (!using_prefetch)
@@ -353,6 +355,7 @@ static void fill_prefetch_next_delay (int extracycles)
        fill_prefetch_next ();
     }
 }
+#endif
 
 static void fill_prefetch_finish (void)
 {
@@ -1167,8 +1170,8 @@ static void gen_opcode (unsigned long int opcode)
        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:
@@ -1178,7 +1181,8 @@ static void gen_opcode (unsigned long int opcode)
        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;
@@ -1188,7 +1192,8 @@ static void gen_opcode (unsigned long int opcode)
        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;
@@ -1197,9 +1202,9 @@ static void gen_opcode (unsigned long int opcode)
        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");
@@ -1210,9 +1215,10 @@ static void gen_opcode (unsigned long int opcode)
        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");
@@ -1221,8 +1227,8 @@ static void gen_opcode (unsigned long int opcode)
        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");
@@ -1253,9 +1259,9 @@ static void gen_opcode (unsigned long int opcode)
        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");
@@ -1266,9 +1272,10 @@ static void gen_opcode (unsigned long int opcode)
        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");
@@ -1277,8 +1284,8 @@ static void gen_opcode (unsigned long int opcode)
        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");
@@ -1307,16 +1314,18 @@ static void gen_opcode (unsigned long int opcode)
        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");
@@ -1325,8 +1334,9 @@ static void gen_opcode (unsigned long int opcode)
        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");
@@ -1343,15 +1353,17 @@ static void gen_opcode (unsigned long int opcode)
        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", "", "");
@@ -1365,8 +1377,9 @@ static void gen_opcode (unsigned long int opcode)
     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
@@ -1376,8 +1389,9 @@ static void gen_opcode (unsigned long int opcode)
     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
@@ -1389,8 +1403,9 @@ static void gen_opcode (unsigned long int opcode)
     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
@@ -1402,8 +1417,9 @@ static void gen_opcode (unsigned long int opcode)
     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
@@ -1424,9 +1440,9 @@ static void gen_opcode (unsigned long int opcode)
        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;
@@ -1435,9 +1451,9 @@ static void gen_opcode (unsigned long int opcode)
        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;
@@ -1446,7 +1462,6 @@ static void gen_opcode (unsigned long int opcode)
     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");
@@ -1462,6 +1477,7 @@ static void gen_opcode (unsigned long int opcode)
                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));
@@ -1485,28 +1501,41 @@ static void gen_opcode (unsigned long int opcode)
        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");
@@ -1516,13 +1545,13 @@ static void gen_opcode (unsigned long int opcode)
     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:
@@ -1536,7 +1565,8 @@ static void gen_opcode (unsigned long int opcode)
     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;
@@ -1808,17 +1838,20 @@ static void gen_opcode (unsigned long int opcode)
        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);
@@ -1863,7 +1896,7 @@ static void gen_opcode (unsigned long int opcode)
        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");
@@ -1996,7 +2029,8 @@ static void gen_opcode (unsigned long int opcode)
        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");
@@ -2697,8 +2731,8 @@ static void gen_opcode (unsigned long int opcode)
        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;
index f30f05f35f5726e68d40ca1a31905b0f5c8050a9..2025582fec9634d339e665968435e24e4e953734 100755 (executable)
@@ -13,6 +13,8 @@ STATIC_INLINE uae_u32 get_long_prefetch (int o)
 }
 
 #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)) {
@@ -23,6 +25,8 @@ STATIC_INLINE uae_u32 mem_access_delay_word_read_cycles (uaecptr addr, int *cycl
     }
     return get_word (addr);
 }
+#endif
+
 STATIC_INLINE uae_u32 mem_access_delay_word_read (uaecptr addr)
 {
     if (addr < 0x200000 || (addr >= 0xc00000 && addr < 0xe00000)) {
@@ -79,12 +83,14 @@ STATIC_INLINE uae_u32 get_word_ce_prefetch (int o)
     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)
 {
index ebd972daf6433775e8ca73bfeb8027d464d9ccda..6cc6c3b6d73aa6b04faad72da1c3be0bcf95889f 100755 (executable)
@@ -222,7 +222,7 @@ struct uae_prefs {
     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;
diff --git a/main.c b/main.c
index 3d52c2d39aeb1105d566fb3de08ca04c5bb89a2d..fa2043b8c9f0942f49af1360126868bae1a48b4a 100755 (executable)
--- a/main.c
+++ b/main.c
@@ -149,7 +149,8 @@ void fixup_prefs (struct uae_prefs *p)
     {
        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;
     }
@@ -398,6 +399,9 @@ static void parse_cmdline (int argc, char **argv)
            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 */
index 4f043c278b3dffc7b473214744ed2a553b0d8f6b..c7a9d6618f3353e2253f40cab36bb000fda38352 100755 (executable)
--- a/memory.c
+++ b/memory.c
@@ -230,6 +230,7 @@ uae_u8 *load_keyfile (struct uae_prefs *p, char *path, int *size)
        }
     }
     if (f) {
+       write_log("ROM.key loaded '%s'\n", tmp);
        zfile_fseek (f, 0, SEEK_END);
        keysize = zfile_ftell (f);
        if (keysize > 0) {
@@ -1569,6 +1570,10 @@ static int load_kickstart (void)
                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 {
index ab7e1c8e15ad2b576ce8444d53ec7774af7431ab..c607b975200600f884f2b2600f8e3bb88d1bb84a 100755 (executable)
@@ -9,6 +9,7 @@
 
 #include "sysconfig.h"
 #include "sysdeps.h"
+#include "options.h"
 
 #include "memory.h"
 
@@ -45,6 +46,30 @@ struct scsi_info {
 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;
@@ -71,9 +96,6 @@ static int open_driver (SCSI *scgp)
     BYTE ASPIStatus;
     int i;
     int nero;
-    HKEY key;
-    DWORD type = REG_SZ;
-    DWORD size = sizeof (path);
 
     /*
      * Check if ASPI library is already loaded yet
@@ -83,10 +105,10 @@ static int open_driver (SCSI *scgp)
 
     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;
        }
     }
@@ -584,7 +606,7 @@ static void scan_scsi_bus (SCSI *scgp, int flags)
                        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 {
index db31acd3fe2431377d434567a1550e503766040a..bd9443ec8a77d36dcc6bd2879a5dd5f8667220bc 100755 (executable)
@@ -8,6 +8,9 @@
   */
 
 
+#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>
 
 
@@ -40,35 +45,44 @@ static int unitcnt = 0;
 
 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);
@@ -112,7 +126,7 @@ static int execscsicmd (int unitnum, uae_u8 *data, int len, uae_u8 *inbuf, int i
     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)
@@ -164,7 +178,7 @@ static int execscsicmd_direct (int unitnum, uaecptr acmd)
     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 */
@@ -221,18 +235,26 @@ static uae_u8 *execscsicmd_in (int unitnum, uae_u8 *data, int len, int *outlen)
 
 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;
 }
@@ -296,11 +318,18 @@ static int open_scsi_bus (int flags)
 
 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];
@@ -308,16 +337,22 @@ static int isatapi (int unitnum)
     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;
@@ -333,47 +368,69 @@ static int mediacheck (int unitnum)
     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;
@@ -388,7 +445,6 @@ static struct device_info *info_device (int unitnum, struct device_info *di)
 
 void win32_spti_media_change (char driveletter, int insert)
 {
-#if 1
     int i, now;
 
     for (i = 0; i < total_devices; i++) {
@@ -401,17 +457,6 @@ void win32_spti_media_change (char driveletter, int insert)
            }
        }
     }
-#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)
@@ -425,6 +470,473 @@ struct device_functions devicefunc_win32_spti = {
     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;
@@ -475,34 +987,29 @@ static int getCDROMProperty(int idx, HDEVINFO DevInfo, const GUID *guid)
     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;
@@ -510,8 +1017,31 @@ static int rescan(void)
            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
index af0a6e0a7e97270ee80c6704a106c90764b9519a..a7b5606173cda5bdc15472e7367e99d9ef58d532 100755 (executable)
@@ -375,7 +375,7 @@ static void BlitRect(LPDIRECT3DDEVICE9 dev, LPDIRECT3DTEXTURE9 src,
     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));
 
index 637d83d3222d1d34c887f0e7dd4bf4758f36c09d..7cbd905db52c2543854e36264d5af2ab3ba27f01 100755 (executable)
@@ -263,7 +263,11 @@ int hdf_dup (struct hardfiledata *hfd, void *src)
 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 ();
index cdc76ed3f92c97fbddaf31f3e6555c9487020d9e..41211f7615e1f4b2c7ff21584e823c316b1fbe3e 100755 (executable)
@@ -53,6 +53,7 @@ void init_shm(void)
     uae_u32 size;
     uae_u32 add = 0x11000000;
     uae_u32 inc = 0x100000;
+    uae_u64 size64, total64;
     MEMORYSTATUS memstats;
 
 #ifdef CPU_64_BIT
@@ -68,14 +69,19 @@ void init_shm(void)
 
     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;
index 3d11233757b00362837a7764b47438e98e1ae176..ad4ef779678f869ee50e92b735bcf1a926036adc 100755 (executable)
 #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
index 07baef9cee9d0ac9524b746afe908023841ee067..682d97eabbb86e4bdabe90754cd06c8a5f704a0b 100755 (executable)
@@ -351,7 +351,7 @@ IDD_MISC1 DIALOGEX 0, 0, 300, 219
 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
@@ -360,26 +360,26 @@ BEGIN
     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
@@ -631,7 +631,7 @@ BEGIN
     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
@@ -653,9 +653,10 @@ 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
index e9c527f21a92799c3ac5a1e2183580b3072e9dcf..8a57a8c2a71c68439843db8f53de99ae7193019d 100755 (executable)
@@ -80,6 +80,7 @@ HWND hAmigaWnd, hMainWnd, hHiddenWnd;
 RECT amigawin_rect;
 static UINT TaskbarRestart;
 static int TaskbarRestartOk;
+static int forceroms;
 
 char VersionStr[256];
 
@@ -108,7 +109,9 @@ static HANDLE timehandle;
 
 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;
@@ -1166,8 +1169,9 @@ void remove_brkhandler (void)
 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);
@@ -1651,6 +1655,8 @@ void logging_cleanup( void )
     debugfile = 0;
 }
 
+extern char *get_nero_aspi_path(void);
+
 void target_default_options (struct uae_prefs *p, int type)
 {
     if (type == 2 || type == 0) {
@@ -1672,6 +1678,7 @@ void target_default_options (struct uae_prefs *p, int type)
        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;
@@ -1679,6 +1686,8 @@ void target_default_options (struct uae_prefs *p, int type)
     }
 }
 
+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");
@@ -1700,14 +1709,16 @@ void target_save_options (struct zfile *f, struct uae_prefs *p)
     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)
 {
@@ -1727,7 +1738,6 @@ static const char *obsolete[] = {
     0
 };
 
-
 int target_parse_option (struct uae_prefs *p, char *option, char *value)
 {
     int i, v;
@@ -1737,7 +1747,6 @@ int target_parse_option (struct uae_prefs *p, char *option, char *value)
            || 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)
@@ -1756,6 +1765,18 @@ int target_parse_option (struct uae_prefs *p, char *option, char *value)
            || 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;
@@ -1868,6 +1889,13 @@ void set_path (char *name, char *path)
        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, "\\");
 
@@ -1885,7 +1913,7 @@ static void initpath (char *name, char *path)
 }
 
 extern int scan_roms (char*);
-void read_rom_list (int force)
+void read_rom_list (void)
 {
     char tmp2[1000];
     DWORD size2;
@@ -1901,8 +1929,9 @@ void read_rom_list (int force)
        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;
@@ -1968,7 +1997,6 @@ static void WIN32_HandleRegistryStuff( void )
     char version[100];
     HKEY hWinUAEKeyLocal = NULL;
     HKEY fkey;
-    int forceroms = 0;
     HKEY rkey;
     char rpath1[MAX_DPATH], rpath2[MAX_DPATH], rpath3[MAX_DPATH];
 
@@ -2041,11 +2069,13 @@ static void WIN32_HandleRegistryStuff( void )
            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)
@@ -2056,6 +2086,7 @@ static void WIN32_HandleRegistryStuff( void )
                forceroms = 1;
        }
        
+       dwType = REG_DWORD;
        RegQueryValueEx(hWinUAEKey, "DisplayInfo", 0, &dwType, (LPBYTE)&colortype, &dwDisplayInfoSize);
        if (colortype == 0) /* No color information stored in the registry yet */
        {
@@ -2074,6 +2105,7 @@ static void WIN32_HandleRegistryStuff( void )
            WIN32GFX_FigurePixelFormats(colortype);
        }
        size = sizeof (quickstart);
+       dwType = REG_DWORD;
        RegQueryValueEx(hWinUAEKey, "QuickStartMode", 0, &dwType, (LPBYTE)&quickstart, &size);
     }
     fetch_path ("ConfigurationPath", path, sizeof (path));
@@ -2091,7 +2123,7 @@ static void WIN32_HandleRegistryStuff( void )
     fkey = read_disk_history ();
     if (fkey)
        RegCloseKey (fkey);
-    read_rom_list (forceroms);
+    read_rom_list ();
 }
 
 static void betamessage (void)
@@ -2212,14 +2244,29 @@ static int osdetect (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(
@@ -2227,14 +2274,60 @@ static void getstartpaths(int start_data)
     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)
@@ -2242,12 +2335,23 @@ static void getstartpaths(int start_data)
        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);
index 6854b165a951b55c94310383734c35fc995fd2b4..ef083436770729194b13c0c31093b63da793ba03 100755 (executable)
@@ -22,7 +22,7 @@ extern int manual_palette_refresh_needed;
 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];
@@ -65,6 +65,8 @@ extern HKEY hWinUAEKey;
 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);
@@ -92,7 +94,7 @@ void systraymenu (HWND hwnd);
 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 *);
index 8a472d297337906ecacc1aa9e8e59a6f9c6e73b5..06743d769b203ac2d5893b2b3eba051263867b7b 100755 (executable)
@@ -569,7 +569,7 @@ int scan_roms (char *pathp)
        if (ret)
            set_path ("KickstartPath", path);
     }
-    read_rom_list (0);
+    read_rom_list ();
     show_rom_list ();
     return ret;
 }
@@ -2587,10 +2587,13 @@ static void resetregistry (void)
     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)
     {
@@ -2601,6 +2604,34 @@ static INT_PTR CALLBACK PathsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
 #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;
@@ -2683,15 +2714,42 @@ static INT_PTR CALLBACK PathsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
            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);
@@ -4199,7 +4257,7 @@ static void enable_for_miscdlg (HWND hDlg)
        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);
@@ -4221,6 +4279,7 @@ static void enable_for_miscdlg (HWND hDlg)
        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);
     }
 }
 
@@ -4268,6 +4327,32 @@ static void misc_addpri (HWND hDlg, int v, int pri)
     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];
@@ -4288,7 +4373,6 @@ static void values_to_miscdlg (HWND hDlg)
     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);
@@ -4310,7 +4394,6 @@ static void values_to_miscdlg (HWND hDlg)
     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");
@@ -4328,11 +4411,14 @@ static void values_to_miscdlg (HWND hDlg)
     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) 
     {
@@ -4364,6 +4450,11 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
                    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) {
@@ -4431,9 +4522,7 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
            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);
@@ -6481,7 +6570,7 @@ static void enable_for_portsdlg( HWND hDlg )
 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)
@@ -6497,6 +6586,9 @@ static void updatejoyport (HWND hDlg)
 
        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;
@@ -6513,7 +6605,9 @@ static void updatejoyport (HWND hDlg)
            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;
@@ -6528,7 +6622,7 @@ static void updatejoyport (HWND hDlg)
        } else {
            idx = v - JSEM_KBDLAYOUT;
        }
-       idx++;
+       idx+=2;
        if (idx >= total)
            idx = 0;
        SendDlgItemMessage (hDlg, id, CB_SETCURSEL, idx, 0);
@@ -6578,8 +6672,10 @@ static void values_from_portsdlg (HWND hDlg)
        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;
@@ -6598,8 +6694,8 @@ static void values_from_portsdlg (HWND hDlg)
            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);
@@ -8638,6 +8734,7 @@ int gui_init (void)
 {
     int ret;
     
+    read_rom_list();
     ret = GetSettings(1, currprefs.win32_notaskbarbutton ? hHiddenWnd : GetDesktopWindow());
     if (ret > 0) {
 #ifdef AVIOUTPUT
index 240ce5336d30bdd91c6e3bd78e0e6c5831c2a874..1d899f71ef50c6eca44376f9605fe5bf50b626a6 100755 (executable)
@@ -5,6 +5,7 @@
        Name="winuae"
        ProjectGUID="{4ADAA943-1AC8-4FB5-82E5-4FB753B6C2DA}"
        RootNamespace="winuae"
+       SignManifests="true"
        >
        <Platforms>
                <Platform
@@ -52,7 +53,7 @@
                                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"
@@ -84,7 +85,8 @@
                        <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"
index 4135bfdad9d805f9f960455799351a9b15683364..342d60066cef818642b99df3891f5bbb5838e200 100755 (executable)
@@ -685,7 +685,7 @@ static void dev_reset (void)
                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;
diff --git a/unzip.c b/unzip.c
index 495480afc7a6c9badfc5a5c3b8297dc68e33a54f..fae371154af08123f09fa92c247de30632f78b02 100755 (executable)
--- a/unzip.c
+++ b/unzip.c
@@ -4,6 +4,8 @@
    Read unzip.h for more info
 */
 
+#define ZLIB_WINAPI
+
 #include "sysconfig.h"
 #include "sysdeps.h"
 
diff --git a/zfile.c b/zfile.c
index 59b664e7d1ceae164c7ab71eab7fb124eb55c95e..0292a9966367ac9e2c991a8251b477d07c99fa22 100755 (executable)
--- a/zfile.c
+++ b/zfile.c
@@ -7,6 +7,8 @@
   *     2002-2004 Toni Wilen
   */
 
+#define ZLIB_WINAPI
+
 #include "sysconfig.h"
 #include "sysdeps.h"
 
@@ -18,7 +20,6 @@
 #include "dms/pfile.h"
 #include "gui.h"
 #include "crc32.h"
-
 #include <zlib.h>
 
 struct zfile {