]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc0992b4.zip
authorToni Wilen <twilen@winuae.net>
Sat, 23 Oct 2004 16:46:04 +0000 (19:46 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:24:30 +0000 (21:24 +0200)
22 files changed:
blitter.c
bsdsocket.c
cfgfile.c
cia.c
custom.c
driveclick.c
include/driveclick.h
include/inputdevice.h
include/keyboard.h
include/options.h
inputdevice.c
inputevents.def
keybuf.c
newcpu.c
od-win32/bsdsock.c
od-win32/dinput.c
od-win32/parser.c
od-win32/resources/resource.h
od-win32/resources/winuae.rc
od-win32/win32.h
od-win32/win32_filesys.c
od-win32/win32gui.c

index 1c8495dd9d3649576c1acfaaab2e7e7d76da698d..01208940d251d4d7a4bb1ab9c3e08370d9f00c3b 100755 (executable)
--- a/blitter.c
+++ b/blitter.c
@@ -885,6 +885,9 @@ void reset_blit (int bltcon)
 void do_blitter (int hpos)
 {
     int cycles;
+#ifdef BLITTER_DEBUG
+    int oldstate = bltstate;
+#endif
 
     blt_info.blitzero = 1;
     bltstate = BLT_init;
@@ -915,6 +918,8 @@ void do_blitter (int hpos)
 #ifdef BLITTER_DEBUG
     blitter_dontdo = 0;
     if (1) {
+       if (oldstate != BLT_done)
+           write_log ("blitter was already active!\n");
        write_log("blitstart: v=%03.3d h=%03.3d %dx%d %d (%d) d=%d f=%02.2X n=%d pc=%p l=%d dma=%d\n",
            vpos, hpos, blt_info.hblitsize, blt_info.vblitsize, cycles, blit_ch,
            blitdesc ? 1 : 0, blitfill,
index 63dd7c77f5fe467a45177314858ee8b7ebbda1f2..0fac4b1fcf10d7b64086c31c358a056085a386d3 100755 (executable)
@@ -224,6 +224,21 @@ int getsock (SB, int sd)
 
        return -1;
     }
+       if (sb->dtable[sd -1] == INVALID_SOCKET)
+               {
+               struct socketbase *sb1,*nsb;
+               // Fix for Newsrog (All Tasks of Newsrog using the same dtable)
+           for (sb1 = socketbases; sb1; sb1 = nsb) 
+                       {
+                       if (strcmp(get_real_address (get_long (sb1->ownertask + 10)),get_real_address (get_long (sb->ownertask + 10))) == 0)
+                               { // Task with same name already exists -> use same dtable 
+                               if (sb1->dtable[sd-1] != INVALID_SOCKET)
+                                       return sb1->dtable[sd-1];
+                               }       
+       
+                       nsb = sb1->next;
+                       }
+               }
     return sb->dtable[sd - 1];
 }
 
index d38c84b3f21dfdf8794d3dd64b479bf26a3938e1..8366bc9906d09e6069d75a2d21d08157318f414d 100755 (executable)
--- a/cfgfile.c
+++ b/cfgfile.c
@@ -313,6 +313,7 @@ static void save_options (struct zfile *f, struct uae_prefs *p, int type)
     cfgfile_write (f, "parallel_postscript_emulation=%s\n", p->parallel_postscript_emulation ? "yes" : "no");
     cfgfile_write (f, "parallel_postscript_detection=%s\n", p->parallel_postscript_detection ? "yes" : "no");
     cfgfile_write (f, "ghostscript_parameters=%s\n", p->ghostscript_parameters);
+    cfgfile_write (f, "parallel_autoflush=%d\n", p->parallel_autoflush_time);
 
     cfgfile_write (f, "gfx_display=%d\n", p->gfx_display);
     cfgfile_write (f, "gfx_framerate=%d\n", p->gfx_framerate);
@@ -877,6 +878,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu
        || cfgfile_intval (option, value, "floppy2type", &p->dfxtype[2], 1)
        || cfgfile_intval (option, value, "floppy3type", &p->dfxtype[3], 1)
        || cfgfile_intval (option, value, "maprom", &p->maprom, 1)
+       || cfgfile_intval (option, value, "parallel_autoflush", &p->parallel_autoflush_time, 1)
        || cfgfile_intval (option, value, "catweasel_io", &p->catweasel_io, 1))
        return 1;
     if (cfgfile_strval (option, value, "comp_trustbyte", &p->comptrustbyte, compmode, 0)
diff --git a/cia.c b/cia.c
index e2e9e8e20f6a142834b2dc78e7a9b1b33533758f..fdce3d83edb8f3c81876af477d67e1300f1b943d 100755 (executable)
--- a/cia.c
+++ b/cia.c
@@ -953,7 +953,7 @@ void CIA_reset (void)
        ciaaicr = ciabicr = ciaaimask = ciabimask = 0;
        ciaacra = ciaacrb = ciabcra = ciabcrb = 0x4; /* outmode = toggle; */
        ciaala = ciaalb = ciabla = ciablb = ciaata = ciaatb = ciabta = ciabtb = 0xFFFF;
-       ciaaalarm = ciabalarm = 0xffffff;
+       ciaaalarm = ciabalarm = currprefs.cpu_cycle_exact ? 0 : 0xffffff;
        ciabpra = 0x8C; ciabdra = 0;
        div10 = 0;
        ciaasdr_cnt = 0; ciaasdr = 0;
index 80c3dedaa20e789f71f2c3f680a4f1372ec896c8..c2f760430eeb55ac1a017b2e769c8cd8e355da0a 100755 (executable)
--- a/custom.c
+++ b/custom.c
@@ -11,8 +11,8 @@
 //#define CUSTOM_DEBUG
 #define DEBUG_COPPER 0
 #define SPRITE_DEBUG 0
-#define SPRITE_DEBUG_MINY 50
-#define SPRITE_DEBUG_MAXY 101
+#define SPRITE_DEBUG_MINY 0
+#define SPRITE_DEBUG_MAXY 401
 //#define SPRITE_MASK 0
 #define SPRITE_MASK (1|2|4|8|16|32|64|128)
 #define SPR0_HPOS 0x15
@@ -1459,6 +1459,7 @@ STATIC_INLINE void update_fetch (int until, int fm)
                compute_delay_offset ();
                compute_toscr_delay_1 ();
            }
+
            do_long_fetch (pos, count >> (3 - toscr_res), dma, fm);
 
            /* This must come _after_ do_long_fetch so as not to confuse flush_display
@@ -1475,6 +1476,10 @@ STATIC_INLINE void update_fetch (int until, int fm)
            pos += count;
            fetch_cycle += count;
        }
+    } else {
+#endif
+       //maybe_first_bpl1dat (pos);
+#ifdef SPEEDUP
     }
 #endif
     for (; pos < until; pos++) {
@@ -1917,7 +1922,8 @@ 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 (ctl & 0x80) {
+    if ((sprctl[num] & 0x80) || (sprctl[num ^ 1] & 0x80)) {
+//    if (ctl & 0x80) {
        uae_u32 state = 0x01010101 << (num & ~1);
        uae_u32 *stbuf = spixstate.words + (word_offs >> 2);
        uae_u8 *stb1 = spixstate.bytes + word_offs;     
@@ -3491,7 +3497,7 @@ static int isagnus[]= {
     1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0, /* 32 0xa0 - 0xde
     /* BPLxPTH/BPLxPTL */
     1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 16 */
-    0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0, /* 16 */
+    0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0, /* 16 */
     /* SPRxPTH/SPRxPTL */
     1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 16 */
     /* SPRxPOS/SPRxCTL/SPRxDATA/SPRxDATB */
@@ -3883,7 +3889,10 @@ STATIC_INLINE void do_sprites_1 (int num, int cycle, int hpos)
     int dma, posctl = 0;
     uae_u16 data;
 
-#if SPRITE_DEBUG > 2
+    if (vpos == sprite_vblank_endline)
+       spr_arm (num, 0);
+
+#if SPRITE_DEBUG > 3
     if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY)
        write_log("%d:%d:slot%d:%d\n", vpos, hpos, num, cycle);
 #endif
@@ -3936,6 +3945,8 @@ STATIC_INLINE void do_sprites_1 (int num, int cycle, int hpos)
            s->dmacycle = 1;
        } else {
            SPRxCTL_1 (data, num, hpos);
+           s->dmastate = 0;
+           sprstartstop (s);
        }
     }
     if (s->dmastate && !posctl) {
@@ -5622,6 +5633,7 @@ STATIC_INLINE int dma_cycle(void)
         hpos = current_hpos ();
        sync_copper (hpos);
        decide_line (hpos);
+        decide_fetch (hpos);
        bpldma = is_bitplane_dma (hpos);
        if (cycle_line[hpos] == 0 && !bpldma) {
            if (bltstate == BLT_done || bnasty >= 3)
@@ -5683,6 +5695,7 @@ void do_cycles_ce (long cycles)
         hpos = current_hpos ();
        sync_copper (hpos);
        decide_line (hpos);
+        decide_fetch (hpos);
        bpldma = is_bitplane_dma (hpos);
        if (cycle_line[hpos] == 0 && !bpldma)
            decide_blitter (hpos);
index ebd23f57402e49204043cca667ba85a0acb9e490..9ac446a45c268ea7db588204e5d35c4d6b76d1ae 100755 (executable)
@@ -20,8 +20,6 @@
 
 #include "driveclick.h"
 
-#define CLICK_TRACKS 84
-
 static struct drvsample drvs[4][DS_END];
 static int freq = 44100;
 
@@ -66,11 +64,17 @@ static int loadsample (char *path, struct drvsample *ds)
     struct zfile *f;
     uae_u8 *buf;
     int size;
+    char name[MAX_DPATH];
 
     f = zfile_fopen (path, "rb");
     if (!f) {
-       write_log ("driveclick: can't open '%s'\n", path);
-       return 0;
+       strcpy (name, path);
+       strcat (name, ".wav");
+       f = zfile_fopen (name, "rb");
+       if (!f) {
+           write_log ("driveclick: can't open '%s' (or '%s')\n", path, name);
+           return 0;
+       }
     }
     zfile_fseek (f, 0, SEEK_END);
     size = zfile_ftell (f);
@@ -90,6 +94,44 @@ static void freesample (struct drvsample *s)
     s->p = 0;
 }
 
+static void processclicks(struct drvsample *ds) 
+{
+    unsigned int n = 0;
+    unsigned int nClick = 0;
+
+    for (n = 0; n < CLICK_TRACKS; n++)  {
+       ds->indexes[n] = 0;
+       ds->lengths[n] = 0;
+    }
+    for(n = 0; n < ds->len; n++) {
+       uae_s16 smp = ds->p[n];
+       if ((smp > 0x6ff0) && (nClick < CLICK_TRACKS))  {
+               ds->indexes[nClick] = n - 128;
+               ds->lengths[nClick] = 2800;
+               nClick ++;
+               n += 3000;
+       }
+    }
+    if (nClick == 0) {
+        for(n = 0; n < CLICK_TRACKS; n++) {
+            ds->indexes[n] = 0;
+            ds->lengths[n] = ds->len;
+        }
+    } else {
+        if (nClick == 1) {     
+           ds->lengths[0] = ds->len - ds->indexes[0];
+           for(n = 1; n < CLICK_TRACKS; n++) {
+               ds->indexes[n] = ds->indexes[0];
+               ds->lengths[n] = ds->lengths[0];
+           }
+       } else  {
+           for(n = nClick; n < CLICK_TRACKS; n++) {
+               ds->indexes[n] = ds->indexes[nClick-1];
+               ds->lengths[n] = ds->lengths[nClick-1]; 
+           }
+       }
+    }
+}
 void driveclick_init(void)
 {
     int v, vv, i, j;
@@ -98,14 +140,24 @@ void driveclick_init(void)
     driveclick_free ();
     vv = 0;
     for (i = 0; i < 4; i++) {
+       for (j = 0; j < CLICK_TRACKS; j++)  {
+           drvs[i][DS_CLICK].indexes[j] = 0;
+           drvs[i][DS_CLICK].lengths[j] = 0;
+       }
        if (currprefs.dfxclick[i]) {
            if (currprefs.dfxclick[i] > 0) {
                v = 0;
                if (driveclick_loadresource (drvs[i], currprefs.dfxclick[i]))
                    v = 3;
+               for (j = 0; j < CLICK_TRACKS; j++)  {
+                   drvs[i][DS_CLICK].indexes[j] = 0;
+                   drvs[i][DS_CLICK].lengths[j] = drvs[i][DS_CLICK].len >> DS_SHIFT;
+               }
            } else if (currprefs.dfxclick[i] == -1) {
                sprintf (tmp, "%suae_data%cdrive_click_%s", start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]);
                v = loadsample (tmp, &drvs[i][DS_CLICK]);
+               if (v)
+                   processclicks (&drvs[i][DS_CLICK]);
                sprintf (tmp, "%suae_data%cdrive_spin_%s", start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]);
                v += loadsample (tmp, &drvs[i][DS_SPIN]);
                sprintf (tmp, "%suae_data%cdrive_spinnd_%s", start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]);
@@ -127,10 +179,6 @@ void driveclick_init(void)
                drvs[i][j].len <<= DS_SHIFT;
            drvs[i][DS_CLICK].pos = drvs[i][DS_CLICK].len;
            drvs[i][DS_SNATCH].pos = drvs[i][DS_SNATCH].len;
-           if (drvs[i][DS_CLICK].len > (100000 << DS_SHIFT)) {
-               drvs[i][DS_CLICK].multisize = drvs[i][DS_CLICK].len / CLICK_TRACKS;
-               drvs[i][DS_CLICK].multilen = (drvs[i][DS_CLICK].multisize * 9) / 10;
-           }
        }
     }
     if (vv > 0) {
@@ -259,19 +307,17 @@ void driveclick_mix (uae_s16 *sndbuffer, int size)
 
 void driveclick_click (int drive, int cyl)
 {
+    static int prevcyl[4];
     if (!click_initialized)
        return;
     if (!currprefs.dfxclick[drive])
        return;
+    if (prevcyl[drive] == 0 && cyl == 0) // "noclick" check
+       return;
+    prevcyl[drive] = cyl;
     mix();
-    if (drvs[drive][DS_CLICK].multisize) {
-       drvs[drive][DS_CLICK].pos = drvs[drive][DS_CLICK].multisize * cyl;
-       drvs[drive][DS_CLICK].len = drvs[drive][DS_CLICK].pos + drvs[drive][DS_CLICK].multilen;
-    } else {
-       drvs[drive][DS_CLICK].pos = (cyl * 4) << DS_SHIFT;
-       if (drvs[drive][DS_CLICK].pos > drvs[drive][DS_CLICK].len / 2)
-           drvs[drive][DS_CLICK].pos = drvs[drive][DS_CLICK].len / 2;
-    }
+    drvs[drive][DS_CLICK].pos = drvs[drive][DS_CLICK].indexes[cyl] << DS_SHIFT;
+    drvs[drive][DS_CLICK].len = (drvs[drive][DS_CLICK].indexes[cyl] + (drvs[drive][DS_CLICK].lengths[cyl] / 2)) << DS_SHIFT;
 }
 
 void driveclick_motor (int drive, int running)
index 757a9bdc1f75516906b9f176b10f33726b03cc4c..e8c91792a947f3d28fa58581eb505fd49ed1fdc6 100755 (executable)
@@ -7,11 +7,14 @@
   */
 
 
+#define CLICK_TRACKS 84
+
 struct drvsample {
     unsigned int len;
     unsigned pos;
     uae_s16 *p;
-    unsigned int multisize, multilen;
+    unsigned int indexes[CLICK_TRACKS];
+    unsigned int lengths[CLICK_TRACKS];
 };
 
 #define DS_CLICK 0
index 47f95cccfda7a084028debf34c5b6150ece16f1a..d9766c41c15570eb2dd31c55cde26b256c3baabc 100755 (executable)
@@ -145,6 +145,10 @@ extern void inputdevice_handle_inputcode (void);
 #define JSEM_ISNUMPAD(port,p) (jsem_iskbdjoy(port,p) == JSEM_KBDLAYOUT)
 #define JSEM_ISCURSOR(port,p) (jsem_iskbdjoy(port,p) == JSEM_KBDLAYOUT + 1)
 #define JSEM_ISSOMEWHEREELSE(port,p) (jsem_iskbdjoy(port,p) == JSEM_KBDLAYOUT + 2)
+#define JSEM_ISXARCADE1(port,p) (jsem_iskbdjoy(port,p) == JSEM_KBDLAYOUT + 3)
+#define JSEM_ISXARCADE2(port,p) (jsem_iskbdjoy(port,p) == JSEM_KBDLAYOUT + 4)
+#define JSEM_LASTKBD 5
+#define JSEM_ISANYKBD(port,p) (jsem_iskbdjoy(port,p) >= JSEM_KBDLAYOUT && jsem_iskbdjoy(port,p) < JSEM_KBDLAYOUT + JSEM_LASTKBD)
 extern int compatibility_device[2];
 
 extern int jsem_isjoy (int port, struct uae_prefs *p);
index 5f06208f304f0d07a96d15600991fe956cca0968..c5c19ea244167611d9cedd404a732dc70935a7da 100755 (executable)
@@ -135,6 +135,7 @@ enum aks { AKS_ENTERGUI = 0x200, AKS_SCREENSHOT, AKS_FREEZEBUTTON,
     AKS_TOGGLEFULLSCREEN, AKS_ENTERDEBUGGER, AKS_IRQ7,
     AKS_PAUSE, AKS_WARP, AKS_INHIBITSCREEN, AKS_STATEREWIND,
     AKS_VOLDOWN, AKS_VOLUP, AKS_VOLMUTE, AKS_QUIT,
+    AKS_HARDRESET, AKS_SOFTRESET,
     AKS_STATESAVEQUICK, AKS_STATERESTOREQUICK,
     AKS_STATESAVEQUICK1, AKS_STATERESTOREQUICK1,
     AKS_STATESAVEQUICK2, AKS_STATERESTOREQUICK2,
index 1f7af5db0e323bc32a84c71a1057fa64ee0171de..a26e7f91cb6e93d0e4c9e3ae11645cd586c10a20 100755 (executable)
@@ -65,6 +65,7 @@ struct uae_prefs {
     int parallel_demand;
     int parallel_postscript_emulation;
     int parallel_postscript_detection;
+    int parallel_autoflush_time;
     char ghostscript_parameters[256];
     int use_gfxlib;
     int socket_emu;
index 5ce12139f744465b0b7db3f828659902683d5f98..906568551780fb3cd2afa2f88d3683646888f264 100755 (executable)
@@ -350,8 +350,8 @@ void reset_inputdevice_config (struct uae_prefs *pr)
 
 static void clear_id (struct uae_input_device *id)
 {
-    int i, j;
 #ifndef _DEBUG
+    int i, j;
     for (i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) {
        for (j = 0; j < MAX_INPUT_SUB_EVENT; j++)
            xfree (id->custom[i][j]);
@@ -1242,6 +1242,12 @@ void inputdevice_handle_inputcode (void)
        case AKS_QUIT:
        uae_quit ();
        break;
+       case AKS_SOFTRESET:
+       uae_reset (0);
+       break;
+       case AKS_HARDRESET:
+       uae_reset (1);
+       break;
        case AKS_STATESAVEQUICK:
        case AKS_STATESAVEQUICK1:
        case AKS_STATESAVEQUICK2:
@@ -1672,7 +1678,7 @@ static void compatibility_mode (struct uae_prefs *prefs)
     }
 
     for (joy = 0; used[joy]; joy++);
-    if (JSEM_ISNUMPAD (0, prefs) || JSEM_ISCURSOR (0, prefs) || JSEM_ISSOMEWHEREELSE (0, prefs)) {
+    if (JSEM_ISANYKBD (0, prefs)) {
         joysticks[joy].eventid[ID_AXIS_OFFSET +  0][0] = INPUTEVENT_JOY1_HORIZ;
        joysticks[joy].eventid[ID_AXIS_OFFSET +  1][0] = INPUTEVENT_JOY1_VERT;
        joysticks[joy].eventid[ID_BUTTON_OFFSET + 0][0] = INPUTEVENT_JOY1_FIRE_BUTTON;
@@ -1683,7 +1689,7 @@ static void compatibility_mode (struct uae_prefs *prefs)
        compatibility_device[0] = joy;
     }
     for (joy = 0; used[joy]; joy++);
-    if (JSEM_ISNUMPAD (1, prefs) || JSEM_ISCURSOR (1, prefs) || JSEM_ISSOMEWHEREELSE (1, prefs)) {
+    if (JSEM_ISANYKBD (1, prefs)) {
         joysticks[joy].eventid[ID_AXIS_OFFSET +  0][0] = INPUTEVENT_JOY2_HORIZ;
        joysticks[joy].eventid[ID_AXIS_OFFSET +  1][0] = INPUTEVENT_JOY2_VERT;
        joysticks[joy].eventid[ID_BUTTON_OFFSET + 0][0] = INPUTEVENT_JOY2_FIRE_BUTTON;
@@ -2442,12 +2448,10 @@ int jsem_iskbdjoy (int port, struct uae_prefs *p)
     if (v < JSEM_KBDLAYOUT)
        return -1;
     v -= JSEM_KBDLAYOUT;
-    if (v >= 3)
+    if (v >= JSEM_LASTKBD)
        return -1;
     return v;
 }
 
-
-
 extern int jsem_ismouse (int v, struct uae_prefs*);
 extern int jsem_iskbd (int v, struct uae_prefs*);
index 42c4a1513451ce70e5e139abf8091ce60fe8ef09..98841b05e42c4933bc99eea6d9795fd1002f6728 100755 (executable)
@@ -269,6 +269,8 @@ DEFEVENT(SPC_VOLUME_DOWN,"Decrease volume level",AM_K,0,0,AKS_VOLDOWN)
 DEFEVENT(SPC_VOLUME_UP,"Increase volume level",AM_K,0,0,AKS_VOLUP)
 DEFEVENT(SPC_VOLUME_MUTE,"Mute/unmute volume",AM_K,0,0,AKS_VOLMUTE)
 DEFEVENT(SPC_QUIT,"Quit emulator",AM_K,0,0,AKS_QUIT)
+DEFEVENT(SPC_SOFTRESET,"Reset emulation",AM_K,0,0,AKS_SOFTRESET)
+DEFEVENT(SPC_HARDRESET,"Hard reset emulation",AM_K,0,0,AKS_HARDRESET)
 DEFEVENT(SPC_STATESAVE,"Quick save state",AM_K,0,0,AKS_STATESAVEQUICK)
 DEFEVENT(SPC_STATERESTORE,"Quick restore state",AM_K,0,0,AKS_STATERESTOREQUICK)
 DEFEVENT(SPC_STATESAVEDIALOG,"Save state",AM_K,0,0,AKS_STATESAVEDIALOG)
index 9ee5296581a8f704fa50b68b80f9ed10e1360dfd..b3483d1f9ccdd23b740330cf11349f99e5dc4a7b 100755 (executable)
--- a/keybuf.c
+++ b/keybuf.c
 #include "custom.h"
 #include "savestate.h"
 
-static int fakestate[4][6] = { { 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0 } };
+static int fakestate[2][7] = { {0},{0} };
 
-static int *fs_np;
-static int *fs_ck;
-static int *fs_se;
+static int *fs_np, *fs_ck, *fs_se, *fs_xa1, *fs_xa2;
 
 /* Not static so the DOS code can mess with them */
 int kpb_first, kpb_last;
@@ -62,12 +60,15 @@ static void do_fake (int nr)
     setjoystickstate (nr, 1, fake[0] ? -100 : (fake[3] ? 100 : 0), 100);
     setjoybuttonstate (nr, 0, fake[4]);
     setjoybuttonstate (nr, 1, fake[5]);
+    setjoybuttonstate (nr, 2, fake[6]);
 }
 
 void record_key (int kc)
 {
     int fs = 0;
     int kpb_next = kpb_first + 1;
+    int k = kc >> 1;
+    int b = !(kc & 1);
 
     //write_log ("got kc %02.2X\n", ((kc << 7) | (kc >> 1)) & 0xff);
     if (kpb_next == 256)
@@ -76,41 +77,64 @@ void record_key (int kc)
        write_log ("Keyboard buffer overrun. Congratulations.\n");
        return;
     }
+
     if (fs_np != 0) {
-       switch (kc >> 1) {
-       case AK_NP8: fs = 1; fs_np[0] = !(kc & 1); break;
-       case AK_NP4: fs = 1; fs_np[1] = !(kc & 1); break;
-       case AK_NP6: fs = 1; fs_np[2] = !(kc & 1); break;
-       case AK_NP2: fs = 1; fs_np[3] = !(kc & 1); break;
-       case AK_NP0: case AK_NP5: fs = 1; fs_np[4] = !(kc & 1); break;
-       case AK_NPDEL: case AK_NPDIV: case AK_ENT: fs = 1; fs_np[5] = !(kc & 1); break;
+       switch (k) {
+       case AK_NP8: fs = 1; fs_np[0] = b; break;
+       case AK_NP4: fs = 1; fs_np[1] = b; break;
+       case AK_NP6: fs = 1; fs_np[2] = b; break;
+       case AK_NP2: fs = 1; fs_np[3] = b; break;
+       case AK_NP0: case AK_NP5: fs = 1; fs_np[4] = b; break;
+       case AK_NPDEL: case AK_NPDIV: case AK_ENT: fs = 1; fs_np[5] = b; break;
        }
     }
     if (fs_ck != 0) {
-       switch (kc >> 1) {
-       case AK_UP: fs = 1; fs_ck[0] = !(kc & 1); break;
-       case AK_LF: fs = 1; fs_ck[1] = !(kc & 1); break;
-       case AK_RT: fs = 1; fs_ck[2] = !(kc & 1); break;
-       case AK_DN: fs = 1; fs_ck[3] = !(kc & 1); break;
-       case AK_RCTRL: case AK_RALT: fs = 1; fs_ck[4] = !(kc & 1); break;
-       case AK_RSH: fs = 1; fs_ck[5] = !(kc & 1); break;
+       switch (k) {
+       case AK_UP: fs = 1; fs_ck[0] = b; break;
+       case AK_LF: fs = 1; fs_ck[1] = b; break;
+       case AK_RT: fs = 1; fs_ck[2] = b; break;
+       case AK_DN: fs = 1; fs_ck[3] = b; break;
+       case AK_RCTRL: case AK_RALT: fs = 1; fs_ck[4] = b; break;
+       case AK_RSH: fs = 1; fs_ck[5] = b; break;
        }
     }
     if (fs_se != 0) {
-       switch (kc >> 1) {
-       case AK_T: fs = 1; fs_se[0] = !(kc & 1); break;
-       case AK_F: fs = 1; fs_se[1] = !(kc & 1); break;
-       case AK_H: fs = 1; fs_se[2] = !(kc & 1); break;
-       case AK_B: fs = 1; fs_se[3] = !(kc & 1); break;
-       case AK_LALT: fs = 1; fs_se[4] = !(kc & 1); break;
-       case AK_LSH: fs = 1; fs_se[5] = !(kc & 1); break;
+       switch (k) {
+       case AK_T: fs = 1; fs_se[0] = b; break;
+       case AK_F: fs = 1; fs_se[1] = b; break;
+       case AK_H: fs = 1; fs_se[2] = b; break;
+       case AK_B: fs = 1; fs_se[3] = b; break;
+       case AK_LALT: fs = 1; fs_se[4] = b; break;
+       case AK_LSH: fs = 1; fs_se[5] = b; break;
+       }
+    }
+    if (fs_xa1 != 0) {
+       switch (k) {
+       case AK_NP8: fs = 1; fs_xa1[0] = b; break;
+       case AK_NP4: fs = 1; fs_xa1[1] = b; break;
+       case AK_NP6: fs = 1; fs_xa1[2] = b; break;
+       case AK_NP2: fs = 1; fs_xa1[3] = b; break;
+       case AK_RCTRL: fs = 1; fs_xa1[4] = b; break;
+       case AK_RALT: fs = 1; fs_xa1[5] = b; break;
+       case AK_SPC: fs = 1; fs_xa1[6] = b; break;
+       }
+    }
+    if (fs_xa2 != 0) {
+       switch (k) {
+       case AK_R: fs = 1; fs_xa2[0] = b; break;
+       case AK_D: fs = 1; fs_xa2[1] = b; break;
+       case AK_G: fs = 1; fs_xa2[2] = b; break;
+       case AK_F: fs = 1; fs_xa2[3] = b; break;
+       case AK_A: fs = 1; fs_xa2[4] = b; break;
+       case AK_S: fs = 1; fs_xa2[5] = b; break;
+       case AK_Q: fs = 1; fs_xa2[6] = b; break;
        }
     }
 
     if (fs && currprefs.input_selected_setting == 0) {
-       if (JSEM_ISNUMPAD (0, &currprefs) || JSEM_ISCURSOR (0, &currprefs) || JSEM_ISSOMEWHEREELSE (0, &currprefs))
+       if (JSEM_ISANYKBD (0, &currprefs))
            do_fake (0);
-       if (JSEM_ISNUMPAD (1, &currprefs) || JSEM_ISCURSOR (1, &currprefs) || JSEM_ISSOMEWHEREELSE (1, &currprefs))
+       if (JSEM_ISANYKBD (1, &currprefs))
            do_fake (1);
        return;
     } else {
@@ -118,6 +142,23 @@ void record_key (int kc)
            kc ^= AK_RCTRL << 1;
            kc ^= AK_CTRL << 1;
        }
+       if (fs_xa1 || fs_xa2) {
+           int k2 = k;
+           if (k == AK_3)
+               k2 = AK_LALT;
+           if (k == AK_4)
+               k2 = AK_RALT;
+           if (k == AK_6)
+               k2 = AK_DN;
+           if (k == AK_1)
+               k2 = AK_F1;
+           if (k == AK_2)
+               k2 = AK_F2;
+           if (k == AK_X || k == AK_LBRACKET)
+               k2 = AK_SPC;
+           if (k != k2)
+               kc = (k2 << 1) | (b ? 0 : 1);
+       }
     }
 
     keybuf[kpb_first] = kc;
@@ -126,7 +167,7 @@ void record_key (int kc)
 
 void joystick_setting_changed (void)
 {
-    fs_np = fs_ck = fs_se = 0;
+    fs_np = fs_ck = fs_se = fs_xa1 = fs_xa2 = 0;
 
     if (JSEM_ISNUMPAD (0, &currprefs))
        fs_np = fakestate[0];
@@ -143,6 +184,16 @@ void joystick_setting_changed (void)
     else if (JSEM_ISSOMEWHEREELSE (1, &currprefs))
        fs_se = fakestate[1];
 
+    if (JSEM_ISXARCADE1 (0, &currprefs))
+       fs_xa1 = fakestate[0];
+    else if (JSEM_ISXARCADE1 (1, &currprefs))
+       fs_xa1 = fakestate[1];
+
+    if (JSEM_ISXARCADE2 (0, &currprefs))
+       fs_xa2 = fakestate[0];
+    else if (JSEM_ISXARCADE2 (1, &currprefs))
+       fs_xa2 = fakestate[1];
+
  }
 
 void keybuf_init (void)
index 88c09b8c16a2ab4f734459264ca984ea6abf2be3..6b87b7f934cf726c8381ee81e765de68783e7dc4 100755 (executable)
--- a/newcpu.c
+++ b/newcpu.c
@@ -2510,6 +2510,7 @@ uae_u8 *restore_cpu (uae_u8 *src)
               model / 1000, flags & 1 ? "EC" : "", model % 1000, regs.pc);
 
     init_m68k_full ();
+    m68k_setpc (regs.pc);
     return src;
 }
 
index 2d4fb5593abcc5ede316ad8c2f798cc16d37d28a..196920c234b6dee770cd172c90ca1b98a0fc5d82 100755 (executable)
@@ -1730,8 +1730,8 @@ static void makesockbitfield(SB, uae_u32 fd_set_amiga, struct fd_set *fd_set_win
                
                for (i = 0; i < 32; i++, mask <<= 1)
                {
-                       if ((currsock = sb->dtable[n+i]) != INVALID_SOCKET)
-                       {
+                       if ((currsock = getsock(sb, n+i+1)) != INVALID_SOCKET)
+                       { // Do not use sb->dtable directly because of Newsrog
                                for (j = fd_set_win->fd_count; j--; )
                                {
                                        if (fd_set_win->fd_array[j] == currsock)
@@ -1827,7 +1827,6 @@ static unsigned int __stdcall thread_WaitSelect(void *index2)
                                {
                        sb->needAbort = 0;
                                }
-
                    if (sb->resultval == SOCKET_ERROR)
                    {
                            SETERRNO;
index 9861b3773112919bc231701f27eb9a80822faeaf..0534d6287a7aa522516eca6d62d1becd868ff82b 100755 (executable)
@@ -999,7 +999,7 @@ static int get_kb_widget_first (int kb, int type)
 static int get_kb_widget_type (int kb, int num, char *name, uae_u32 *code)
 {
     if (name)
-       strcpy (name, di_keyboard[kb].buttonname[num]);
+       sprintf (name, "[%02.2X] %s", di_keyboard[kb].buttonmappings[num], di_keyboard[kb].buttonname[num]);
     if (code)
        *code = di_keyboard[kb].buttonmappings[num];
     return IDEV_WIDGET_KEY;
index 2d68611116822756316ce44e0bbfc675ef8c8271..4aaf06e980cec61a94d0ae0e63d3e04bd971bb20 100755 (executable)
@@ -58,6 +58,7 @@ static int prtopen;
 extern void flushpixels(void);
 void DoSomeWeirdPrintingStuff( char val );
 static int uartbreak;
+static int parflush;
 
 static uae_thread_id prt_tid;
 static volatile int prt_running;
@@ -433,6 +434,7 @@ void closeprinter( void )
 #ifdef PRINT_DUMP
     zfile_fclose (prtdump);
 #endif
+    parflush = 0;
     psmode = 0;
     if (hPrt != INVALID_HANDLE_VALUE) {
        EndPagePrinter (hPrt);
@@ -460,6 +462,7 @@ static void putprinter (char val)
 
 int doprinter (uae_u8 val)
 {
+    parflush = 0;
     if (!prtopen)
        openprinter ();
     if (prtopen)
@@ -798,7 +801,7 @@ void hsyncstuff(void)
     if(keycheck==1000)
     {
         flushprtbuf ();
-       {
+       {
            extern flashscreen;
            int DX_Fill( int , int , int, int, uae_u32 , enum RGBFTYPE  );
            //extern int warned_JIT_0xF10000;
@@ -810,5 +813,12 @@ void hsyncstuff(void)
        }
        keycheck = 0;
     }
+    if (currprefs.parallel_autoflush_time) {
+        parflush++;
+        if (parflush / ((currprefs.ntscmode ? MAXVPOS_NTSC : MAXVPOS_PAL) * MAXHPOS_PAL / maxhpos) >= currprefs.parallel_autoflush_time * 50) {
+           flushprinter ();
+           parflush = 0;
+       }
+    }
 #endif
 }
index db95a3c626d48bedfa34a275a2e81d5f293a7a2c..4cefdb032d6581cd29112273a291d72eed8fef70 100755 (executable)
 #define IDC_PFULLSCREEN                 1192
 #define IDC_P96MEM                      1193
 #define IDC_DA_SLIDER                   1193
+#define IDC_FRAMERATE2                  1194
+#define IDC_RATE2TEXT                   1195
 #define IDC_CPU0                        1200
 #define IDC_CPU1                        1201
 #define IDC_CPU2                        1202
 #define IDC_PORT0_KBDA                  1303
 #define IDC_PORT0_KBDB                  1304
 #define IDC_PORT0_KBDC                  1305
+#define IDC_PORT0_KBDD                  1306
+#define IDC_PORT0_KBDE                  1307
 #define IDC_PORT1_JOYSC                 1308
 #define IDC_PORT1_KBDA                  1309
 #define IDC_PORT1_KBDB                  1310
 #define IDC_PORT1_KBDC                  1311
-#define IDC_PORT0                       1312
-#define IDC_PORT1                       1313
+#define IDC_PORT1_KBDD                  1312
+#define IDC_PORT1_KBDE                  1313
+#define IDC_PORT0                       1342
+#define IDC_PORT1                       1343
 #define IDC_MIDIFRAME                   1314
 #define IDC_SERPARFRAME                 1315
 #define IDC_SERIALFRAME                 1316
 #define IDC_DISABLE1                    1516
 #define IDC_DF1WP                       1516
 #define IDC_QUICKSTART_COMPA            1516
+#define IDC_REFRESH2TEXT                1516
 #define IDC_DISABLE2                    1517
 #define IDC_DF2WP                       1517
 #define IDC_QUICKSTART_DF               1517
 #define IDC_PS_PARAMS                   1695
 #define IDC_FILTERHZV                   1696
 #define IDC_HF_TYPE                     1696
+#define IDC_PRINTERAUTOFLUSH            1697
+#define IDC_PRINTERAUTOFLUSHTXT         1698
 #define ID__FLOPPYDRIVES                40004
 #define ID_FLOPPYDRIVES_DF0             40005
 #define ID_ST_CONFIGURATION             40010
 #define _APS_3D_CONTROLS                     1
 #define _APS_NEXT_RESOURCE_VALUE        245
 #define _APS_NEXT_COMMAND_VALUE         40021
-#define _APS_NEXT_CONTROL_VALUE         1697
+#define _APS_NEXT_CONTROL_VALUE         1699
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
index 4bcc43137d3241ef34e3ccbc7f38242e73cc513b..3f4128ada74e6b44ae0cb851207c6fee88ebd1e2 100755 (executable)
@@ -61,7 +61,7 @@ BEGIN
     PUSHBUTTON      "...",IDC_FLASHCHOOSER,280,110,10,15
 END
 
-IDD_DISPLAY DIALOGEX 0, 0, 300, 194
+IDD_DISPLAY DIALOGEX 0, 0, 300, 202
 STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN
@@ -79,7 +79,7 @@ BEGIN
     EDITTEXT        IDC_YSIZE,103,48,35,12,ES_NUMBER
     CONTROL         "VSync",IDC_VSYNC,"Button",BS_AUTOCHECKBOX | BS_LEFT | 
                     WS_TABSTOP,145,49,54,10
-    GROUPBOX        "Settings",IDC_SETTINGSTEXT,12,77,199,73
+    GROUPBOX        "Settings",IDC_SETTINGSTEXT,12,77,199,89
     CONTROL         "Full Screen",IDC_AFULLSCREEN,"Button",BS_AUTOCHECKBOX | 
                     BS_LEFT | WS_TABSTOP,35,89,90,10
     CONTROL         "Full Screen RTG",IDC_PFULLSCREEN,"Button",
@@ -105,13 +105,17 @@ BEGIN
                     BS_LEFT | WS_TABSTOP,233,105,41,10
     CONTROL         "Scanline",IDC_LM_SCANLINES,"Button",BS_AUTORADIOBUTTON | 
                     BS_LEFT | WS_TABSTOP,233,121,40,10
-    COMBOBOX        IDC_DA_MODE,35,163,58,150,CBS_DROPDOWNLIST | 
+    COMBOBOX        IDC_DA_MODE,35,183,58,150,CBS_DROPDOWNLIST | 
                     CBS_HASSTRINGS | NOT WS_VISIBLE | WS_VSCROLL | 
                     WS_TABSTOP
     CONTROL         "",IDC_DA_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | 
-                    TBS_TOP | NOT WS_VISIBLE | WS_TABSTOP,97,161,101,20
-    PUSHBUTTON      "Detect pixel format",IDC_TEST16BIT,210,161,73,14,0,0,
+                    TBS_TOP | NOT WS_VISIBLE | WS_TABSTOP,99,179,101,20
+    PUSHBUTTON      "Detect pixel format",IDC_TEST16BIT,210,181,73,14,0,0,
                     HIDC_TEST16BIT
+    LTEXT           "FPS Adj.",IDC_REFRESH2TEXT,18,149,28,8
+    CONTROL         "",IDC_FRAMERATE2,"msctls_trackbar32",TBS_AUTOTICKS | 
+                    TBS_TOP | WS_TABSTOP,46,144,127,20
+    EDITTEXT        IDC_RATE2TEXT,177,148,26,12,ES_CENTER | ES_READONLY
 END
 
 IDD_MEMORY DIALOGEX 0, 0, 300, 175
@@ -399,6 +403,21 @@ STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN
     GROUPBOX        "Parallel Port",IDC_SERPARFRAME,5,2,291,68
+    RTEXT           "Printer:",IDC_STATIC,12,15,25,15,SS_CENTERIMAGE
+    COMBOBOX        IDC_PRINTERLIST,49,15,153,134,CBS_DROPDOWNLIST | 
+                    WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Flush print job",IDC_FLUSHPRINTER,220,14,58,12
+    CONTROL         "PostScript detection",IDC_PSPRINTERDETECT,"Button",
+                    BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,11,33,78,12
+    CONTROL         "PostScript printer emulation",IDC_PSPRINTER,"Button",
+                    BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,93,33,100,12
+    RTEXT           "Autoflush timeout []Time in seconds after pending print job is automatically flushed.",
+                    IDC_PRINTERAUTOFLUSHTXT,202,32,57,15,SS_CENTERIMAGE
+    EDITTEXT        IDC_PRINTERAUTOFLUSH,263,33,25,12,ES_NUMBER
+    RTEXT           "Ghostscript extra parameters:",IDC_STATIC,12,49,91,15,
+                    SS_CENTERIMAGE
+    EDITTEXT        IDC_PS_PARAMS,120,50,169,12,ES_AUTOHSCROLL
+    GROUPBOX        "Serial Port",IDC_SERIALFRAME,4,72,292,29
     COMBOBOX        IDC_SERIAL,19,83,95,65,CBS_DROPDOWNLIST | WS_VSCROLL | 
                     WS_TABSTOP
     CONTROL         "Shared",IDC_SHARED,"Button",BS_AUTOCHECKBOX | 
@@ -407,10 +426,6 @@ BEGIN
                     BS_VCENTER | WS_TABSTOP,185,83,53,12
     CONTROL         "Direct",IDC_SERIAL_DIRECT,"Button",BS_AUTOCHECKBOX | 
                     BS_VCENTER | WS_TABSTOP,243,83,46,12
-    RTEXT           "Printer:",IDC_STATIC,15,15,25,15,SS_CENTERIMAGE
-    COMBOBOX        IDC_PRINTERLIST,49,15,153,134,CBS_DROPDOWNLIST | 
-                    WS_VSCROLL | WS_TABSTOP
-    PUSHBUTTON      "Flush print job",IDC_FLUSHPRINTER,220,14,58,12
     GROUPBOX        "MIDI",IDC_MIDIFRAME,4,104,292,33
     RTEXT           "Out:",IDC_MIDI,10,115,34,15,SS_CENTERIMAGE
     COMBOBOX        IDC_MIDIOUTLIST,50,115,95,130,CBS_DROPDOWNLIST | 
@@ -418,43 +433,43 @@ BEGIN
     RTEXT           "In:",IDC_MIDI2,150,115,29,15,SS_CENTERIMAGE
     COMBOBOX        IDC_MIDIINLIST,185,115,95,134,CBS_DROPDOWNLIST | 
                     WS_VSCROLL | WS_TABSTOP
-    GROUPBOX        "Amiga Mouse/Joystick Port 0",IDC_PORT0,4,141,141,78
+    GROUPBOX        "Amiga Mouse/Joystick Port 0",IDC_PORT0,4,139,142,97
     CONTROL         "",IDC_PORT0_JOYSC,"Button",BS_AUTORADIOBUTTON | 
                     WS_GROUP | WS_TABSTOP,10,156,9,11
     CONTROL         "Keyboard Layout ""A"" []Numeric keypad, 0 and 5 = fire",
                     IDC_PORT0_KBDA,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
-                    10,176,90,10
+                    10,173,90,10
     CONTROL         "Keyboard Layout ""B"" []Cursor keys, right CTRL and ALT = fire",
                     IDC_PORT0_KBDB,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
-                    10,191,90,10
+                    10,186,90,10
     CONTROL         "Keyboard Layout ""C"" []T = up, B = down, F = left, H = right, left ALT = fire",
                     IDC_PORT0_KBDC,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
-                    10,205,90,10
-    COMBOBOX        IDC_PORT0_JOYS,23,155,117,130,CBS_DROPDOWNLIST | 
+                    10,198,90,10
+    CONTROL         "X-Arcade (left)",IDC_PORT0_KBDD,"Button",
+                    BS_AUTORADIOBUTTON | WS_TABSTOP,10,210,90,10
+    CONTROL         "X-Arcade (right)",IDC_PORT0_KBDE,"Button",
+                    BS_AUTORADIOBUTTON | WS_TABSTOP,10,222,90,10
+    COMBOBOX        IDC_PORT0_JOYS,23,153,117,130,CBS_DROPDOWNLIST | 
                     WS_VSCROLL | WS_TABSTOP
-    GROUPBOX        "Amiga Joystick/Mouse Port 1",IDC_PORT1,150,141,146,78
+    GROUPBOX        "Amiga Joystick/Mouse Port 1",IDC_PORT1,150,139,146,98
     CONTROL         "",IDC_PORT1_JOYSC,"Button",BS_AUTORADIOBUTTON | 
                     WS_GROUP | WS_TABSTOP,155,156,9,11
     CONTROL         "Keyboard Layout ""A"" []Numeric keypad, 0 and 5 = fire",
                     IDC_PORT1_KBDA,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
-                    155,176,90,10
+                    155,173,90,10
     CONTROL         "Keyboard Layout ""B"" []Cursor keys, right CTRL and ALT = fire",
                     IDC_PORT1_KBDB,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
-                    155,191,90,10
+                    155,186,90,10
     CONTROL         "Keyboard Layout ""C"" []T = up, B = down, F = left, H = right, left ALT = fire",
                     IDC_PORT1_KBDC,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
-                    155,205,90,10
-    COMBOBOX        IDC_PORT1_JOYS,168,155,123,130,CBS_DROPDOWNLIST | 
+                    155,198,90,10
+    CONTROL         "X-Arcade (left)",IDC_PORT1_KBDD,"Button",
+                    BS_AUTORADIOBUTTON | WS_TABSTOP,155,210,90,10
+    CONTROL         "X-Arcade (right)",IDC_PORT1_KBDE,"Button",
+                    BS_AUTORADIOBUTTON | WS_TABSTOP,155,222,90,10
+    COMBOBOX        IDC_PORT1_JOYS,168,153,123,130,CBS_DROPDOWNLIST | 
                     WS_VSCROLL | WS_TABSTOP
-    PUSHBUTTON      "Swap ports",IDC_SWAP,119,225,54,14
-    CONTROL         "PostScript printer emulation",IDC_PSPRINTER,"Button",
-                    BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,18,32,103,12
-    CONTROL         "PostScript detection",IDC_PSPRINTERDETECT,"Button",
-                    BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,122,32,103,12
-    EDITTEXT        IDC_PS_PARAMS,121,50,165,12,ES_AUTOHSCROLL
-    GROUPBOX        "Serial Port",IDC_SERIALFRAME,4,72,292,29
-    RTEXT           "Ghostscript extra parameters:",IDC_STATIC,15,49,91,15,
-                    SS_CENTERIMAGE
+    PUSHBUTTON      "Swap",IDC_SWAP,256,213,33,14
 END
 
 IDD_CONTRIBUTORS DIALOGEX 0, 0, 411, 242
index 49e72954211f928f18fcb2416839f1686f933a63..a851395dfad3221fcd14e687970816ee73defb90 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 3"
+#define WINUAEBETASTR " Beta 4"
 
 extern void my_kbd_handler (int, int, int);
 extern void clearallkeys(void);
index 615a0bbd7a4d2813c54db97207eb8ec2e547931e..c1b1a7a9ad18fbdca8871790142fe8f16756bb89 100755 (executable)
@@ -125,7 +125,7 @@ void filesys_init( void )
 
                    result = add_filesys_unit (currprefs.mountinfo, 0, volumename, volumepath, 0, 0, 0, 0, 0, 0, 0);
                    if( result )
-                       write_log( result );
+                       write_log ("%s\n", result);
                }
             } /* if drivemask */
             dwDriveMask >>= 1;
index efc8b56a73addf2c23cdc3cbc4191e516a3f1d71..0f6b98a367c005be49c026779bdbd2695ce73e91 100755 (executable)
@@ -667,12 +667,12 @@ void gui_display( int shortcut )
            savestate_state = 0;
        }
     } else if (shortcut >= 0 && shortcut < 4) {
-        DiskSelection( hAmigaWnd, IDC_DF0+shortcut, 0, &changed_prefs, 0 );
+        DiskSelection (hAmigaWnd, IDC_DF0+shortcut, 0, &changed_prefs, 0);
     } else if (shortcut == 5) {
-        if (DiskSelection( hAmigaWnd, IDC_DOSAVESTATE, 9, &changed_prefs, 0 ))
+        if (DiskSelection (hAmigaWnd, IDC_DOSAVESTATE, 9, &changed_prefs, 0))
            save_state (savestate_fname, "Description!");
     } else if (shortcut == 4) {
-        if (DiskSelection( hAmigaWnd, IDC_DOLOADSTATE, 10, &changed_prefs, 0 ))
+        if (DiskSelection (hAmigaWnd, IDC_DOLOADSTATE, 10, &changed_prefs, 0))
            savestate_state = STATE_DORESTORE;
     }
     manual_painting_needed--; /* So that WM_PAINT doesn't need to use custom refreshing */
@@ -766,17 +766,19 @@ int DirectorySelection(HWND hDlg, int flag, char *path)
 // flag = 12 for loading anything
 // flag = 13 for selecting path
 // flag = 14 for loading filesystem
-int DiskSelection( HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, char *path_out)
+int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, char *path_out, int *multi)
 {
     OPENFILENAME openFileName;
     char full_path[MAX_DPATH] = "";
+    char full_path2[MAX_DPATH];
     char file_name[MAX_DPATH] = "";
     char init_path[MAX_DPATH] = "";
     BOOL result = FALSE;
     char *amiga_path = NULL;
     char description[ CFG_DESCRIPTION_LENGTH ] = "";
-    char *p;
+    char *p, *nextp;
     int all = 1;
+    int next;
 
     char szTitle[ MAX_DPATH ];
     char szFormat[ MAX_DPATH ];
@@ -952,7 +954,8 @@ int DiskSelection( HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs,
        p += strlen(p) + 1;
        *p = 0;
     }
-    openFileName.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_LONGNAMES | OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
+    openFileName.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST |
+       OFN_LONGNAMES | OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
     openFileName.lpstrCustomFilter = NULL;
     openFileName.nMaxCustFilter = 0;
     openFileName.nFilterIndex = 0;
@@ -964,28 +967,45 @@ int DiskSelection( HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs,
     openFileName.lpfnHook = NULL;
     openFileName.lpTemplateName = NULL;
     openFileName.lCustData = 0;
-    if (flag == 1 || flag == 3 || flag == 5 || flag == 9 || flag == 11)
-    {
-       if( !(result = GetSaveFileName (&openFileName)) )
+    if (multi)
+       openFileName.Flags |= OFN_ALLOWMULTISELECT;
+    if (flag == 1 || flag == 3 || flag == 5 || flag == 9 || flag == 11) {
+       if (!(result = GetSaveFileName (&openFileName)))
            write_log ("GetSaveFileName() failed.\n");
-    }
-    else
-    {
-       if( !(result = GetOpenFileName (&openFileName)) )
+    } else {
+       if (!(result = GetOpenFileName (&openFileName)))
            write_log ("GetOpenFileName() failed.\n");
     }
-    if (result)
+    memcpy (full_path2, full_path, sizeof (full_path));
+    next = 0;
+    nextp = full_path2 + openFileName.nFileOffset;
+    if (path_out) {
+       if (multi) {
+           while (nextp[0])
+               nextp += strlen (nextp) + 1;
+           memcpy (path_out, full_path2, nextp - full_path2 + 1);
+       } else {
+           strcpy (path_out, full_path2);
+       }
+    }
+    nextp = full_path2 + openFileName.nFileOffset;
+    while (result && next >= 0)
     {
+       next = -1;
+       if (multi) {
+           if (nextp[0] == 0)
+               break;
+           sprintf (full_path, "%s\\%s", full_path2, nextp);
+           nextp += strlen (nextp) + 1;
+       }
        switch (wParam) 
         {
        case IDC_PATH_NAME:
        case IDC_PATH_FILESYS:
-           if( flag == 8 )
-           {
-               if( strstr( full_path, "Configurations\\" ) )
-               {
-                   strcpy( full_path, init_path );
-                   strcat( full_path, file_name );
+           if (flag == 8) {
+               if(strstr(full_path, "Configurations\\")) {
+                   strcpy(full_path, init_path);
+                   strcat(full_path, file_name);
                }
            }
            SetDlgItemText (hDlg, wParam, full_path);
@@ -993,23 +1013,26 @@ int DiskSelection( HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs,
        case IDC_DF0:
        case IDC_DF0QQ:
            SetDlgItemText (hDlg, IDC_DF0TEXT, full_path);
-           strcpy( prefs->df[0], full_path );
+           strcpy(prefs->df[0], full_path);
            DISK_history_add (full_path, -1);
+           next = IDC_DF1;
             break;
        case IDC_DF1:
        case IDC_DF1QQ:
            SetDlgItemText (hDlg, IDC_DF1TEXT, full_path);
-           strcpy( prefs->df[1], full_path );
+           strcpy(prefs->df[1], full_path);
            DISK_history_add (full_path, -1);
+           next = IDC_DF2;
             break;
        case IDC_DF2:
            SetDlgItemText (hDlg, IDC_DF2TEXT, full_path);
-           strcpy( prefs->df[2], full_path );
+           strcpy(prefs->df[2], full_path);
            DISK_history_add (full_path, -1);
+           next = IDC_DF3;
             break;
        case IDC_DF3:
            SetDlgItemText (hDlg, IDC_DF3TEXT, full_path);
-           strcpy( prefs->df[3], full_path );
+           strcpy(prefs->df[3], full_path);
            DISK_history_add (full_path, -1);
             break;
        case IDC_DOSAVESTATE:
@@ -1023,21 +1046,18 @@ int DiskSelection( HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs,
            disk_creatediskfile( full_path, 1, SendDlgItemMessage( hDlg, IDC_FLOPPYTYPE, CB_GETCURSEL, 0, 0L ));
            break;
        case IDC_LOAD:
-           if (target_cfgfile_load(&workprefs, full_path, 0, 0) == 0)
-           {
+           if (target_cfgfile_load(&workprefs, full_path, 0, 0) == 0) {
                char szMessage[MAX_DPATH];
                WIN32GUI_LoadUIString (IDS_COULDNOTLOADCONFIG, szMessage, MAX_DPATH);
                pre_gui_message (szMessage);
-           }
-           else
-           {
+           } else {
                SetDlgItemText (hDlg, IDC_EDITDESCRIPTION, workprefs.description);
                SetDlgItemText (hDlg, IDC_EDITNAME, full_path);
                SetDlgItemText (hDlg, IDC_CONFIGLINK, workprefs.config_host_path);
            }
             break;
        case IDC_SAVE:
-           SetDlgItemText( hDlg, IDC_EDITNAME, full_path );
+           SetDlgItemText (hDlg, IDC_EDITNAME, full_path);
             cfgfile_save (&workprefs, full_path, 0);
             break;
        case IDC_ROMFILE:
@@ -1053,31 +1073,49 @@ int DiskSelection( HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs,
            strcpy (workprefs.cartfile, full_path);
            break;
         }
-        if (path_out)
-           strcpy (path_out, full_path);
-        if( flag == 0 || flag == 1 )
-        {
-            amiga_path = strstr( openFileName.lpstrFile, openFileName.lpstrFileTitle );
-            if( amiga_path && amiga_path != openFileName.lpstrFile )
-            {
+        if (flag == 0 || flag == 1) {
+            amiga_path = strstr (openFileName.lpstrFile, openFileName.lpstrFileTitle);
+            if (amiga_path && amiga_path != openFileName.lpstrFile) {
                 *amiga_path = 0;
-                if( hWinUAEKey )
-                    RegSetValueEx( hWinUAEKey, "FloppyPath", 0, REG_SZ, (CONST BYTE *)openFileName.lpstrFile, strlen( openFileName.lpstrFile ) + 1 );
+                if (hWinUAEKey)
+                    RegSetValueEx (hWinUAEKey, "FloppyPath", 0, REG_SZ, (CONST BYTE *)openFileName.lpstrFile, strlen(openFileName.lpstrFile) + 1);
             }
-        }
-        else if( flag == 2 || flag == 3 )
-        {
-            amiga_path = strstr( openFileName.lpstrFile, openFileName.lpstrFileTitle );
-            if( amiga_path && amiga_path != openFileName.lpstrFile )
-            {
+        } else if (flag == 2 || flag == 3) {
+            amiga_path = strstr (openFileName.lpstrFile, openFileName.lpstrFileTitle);
+            if (amiga_path && amiga_path != openFileName.lpstrFile) {
                 *amiga_path = 0;
                 if( hWinUAEKey )
-                    RegSetValueEx( hWinUAEKey, "hdfPath", 0, REG_SZ, (CONST BYTE *)openFileName.lpstrFile, strlen( openFileName.lpstrFile ) + 1 );
+                    RegSetValueEx(hWinUAEKey, "hdfPath", 0, REG_SZ, (CONST BYTE *)openFileName.lpstrFile, strlen(openFileName.lpstrFile) + 1);
             }
         }
+        if (next >= 0)
+           wParam = next;
     }
     return result;
 }
+int DiskSelection (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, char *path_out)
+{
+    return DiskSelection_2 (hDlg, wParam, flag, prefs, path_out, NULL);
+}
+int MultiDiskSelection (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, char *path_out)
+{
+    int multi = 0;
+    return DiskSelection_2 (hDlg, wParam, flag, prefs, path_out, &multi);
+}
+static int loopmulti (char *s, char *out)
+{
+    static int index;
+
+    if (!out) {
+       index = strlen (s) + 1;
+       return 1;
+    }
+    if (!s[index])
+       return 0;
+    sprintf (out, "%s\\%s", s, s + index);
+    index += strlen (s + index) + 1;
+    return 1;
+}
 
 static BOOL CreateHardFile (HWND hDlg, UINT hfsizem, char *dostype)
 {
@@ -1497,7 +1535,7 @@ static void set_lventry_input (HWND list, int index)
     if (flags & IDEV_MAPPED_AUTOFIRE_SET)
         WIN32GUI_LoadUIString (IDS_YES, af, sizeof (af));
     else if (flags & IDEV_MAPPED_AUTOFIRE_POSSIBLE)
-        WIN32GUI_LoadUIString (IDS_YES, af, sizeof (af));
+        WIN32GUI_LoadUIString (IDS_NO, af, sizeof (af));
     else
        strcpy (af,"-");
     ListView_SetItemText(list, index, 1, custom[0] ? custom : name);
@@ -3043,19 +3081,17 @@ static void enable_for_displaydlg (HWND hDlg)
 #ifndef PICASSO96
     rtg = FALSE;
 #endif
-    EnableWindow( GetDlgItem( hDlg, IDC_PFULLSCREEN ), rtg);
-    if (! full_property_sheet) 
-    {
+    EnableWindow (GetDlgItem (hDlg, IDC_PFULLSCREEN), rtg);
+    if (! full_property_sheet)  {
        /* Disable certain controls which are only to be set once at start-up... */
         EnableWindow (GetDlgItem (hDlg, IDC_TEST16BIT), FALSE);
-    }
-    else
-    {
+    } else {
         CheckDlgButton( hDlg, IDC_VSYNC, workprefs.gfx_vsync);
         EnableWindow (GetDlgItem (hDlg, IDC_XCENTER), TRUE);
         EnableWindow (GetDlgItem (hDlg, IDC_YCENTER), TRUE);
         EnableWindow (GetDlgItem (hDlg, IDC_LM_SCANLINES), TRUE);
     }
+    EnableWindow (GetDlgItem (hDlg, IDC_FRAMERATE2), !workprefs.gfx_vsync);
 }
 
 static void enable_for_chipsetdlg (HWND hDlg)
@@ -3156,7 +3192,7 @@ static void init_frequency_combo (HWND hDlg, int dmode)
     hz[0] = hz2[0] = 0;
     SendDlgItemMessage(hDlg, IDC_REFRESHRATE, CB_RESETCONTENT, 0, 0);
     WIN32GUI_LoadUIString (IDS_VSYNC_DEFAULT, txt, sizeof (txt));
-    SendDlgItemMessage( hDlg, IDC_REFRESHRATE, CB_ADDSTRING, 0, (LPARAM)txt);
+    SendDlgItemMessage(hDlg, IDC_REFRESHRATE, CB_ADDSTRING, 0, (LPARAM)txt);
     for (i = 0; i < index; i++) {
        freq = storedrefreshrates[i];
        if (freq < 0) {
@@ -3171,14 +3207,14 @@ static void init_frequency_combo (HWND hDlg, int dmode)
            strcat (hz, " NTSC");
        if (abs(workprefs.gfx_refreshrate) == freq)
            strcpy (hz2, hz);
-       SendDlgItemMessagehDlg, IDC_REFRESHRATE, CB_ADDSTRING, 0, (LPARAM)hz);
+       SendDlgItemMessage (hDlg, IDC_REFRESHRATE, CB_ADDSTRING, 0, (LPARAM)hz);
     }
     index = CB_ERR;
     if (hz2[0] >= 0)
-       index = SendDlgItemMessage( hDlg, IDC_REFRESHRATE, CB_SELECTSTRING, 0, (LPARAM)hz2 );
+       index = SendDlgItemMessage (hDlg, IDC_REFRESHRATE, CB_SELECTSTRING, 0, (LPARAM)hz2);
     if (index == CB_ERR) {
         WIN32GUI_LoadUIString (IDS_VSYNC_DEFAULT, txt, sizeof (txt));
-       SendDlgItemMessage( hDlg, IDC_REFRESHRATE, CB_SELECTSTRING, i, (LPARAM)txt);
+       SendDlgItemMessage(hDlg, IDC_REFRESHRATE, CB_SELECTSTRING, i, (LPARAM)txt);
        workprefs.gfx_refreshrate = 0;
     }
 }
@@ -3332,13 +3368,19 @@ static void values_to_displaydlg (HWND hDlg)
     char Nth[ MAX_NTH_LENGTH ];
     LPSTR blah[1] = { Nth };
     LPTSTR string = NULL;
+    int v;
 
     init_display_mode (hDlg);
 
-    SetDlgItemInt( hDlg, IDC_XSIZE, workprefs.gfx_width_win, FALSE );
-    SetDlgItemInt( hDlg, IDC_YSIZE, workprefs.gfx_height_win, FALSE );
+    SetDlgItemInt (hDlg, IDC_XSIZE, workprefs.gfx_width_win, FALSE);
+    SetDlgItemInt (hDlg, IDC_YSIZE, workprefs.gfx_height_win, FALSE);
 
     SendDlgItemMessage (hDlg, IDC_FRAMERATE, TBM_SETPOS, TRUE, workprefs.gfx_framerate);
+    v = workprefs.chipset_refreshrate;
+    if (v == 0)
+       v = currprefs.ntscmode ? 60 : 50;
+
+    SendDlgItemMessage (hDlg, IDC_FRAMERATE2, TBM_SETPOS, TRUE, v);
 
     WIN32GUI_LoadUIString( IDS_FRAMERATE, buffer, MAX_FRAMERATE_LENGTH );
     LoadNthString( workprefs.gfx_framerate - 1, Nth, MAX_NTH_LENGTH );
@@ -3354,6 +3396,8 @@ static void values_to_displaydlg (HWND hDlg)
        SetDlgItemText( hDlg, IDC_RATETEXT, string );
        LocalFree( string );
     }
+    sprintf (buffer, "%d", v);
+    SetDlgItemText (hDlg, IDC_RATE2TEXT, buffer);
 
     CheckRadioButton( hDlg, IDC_LM_NORMAL, IDC_LM_SCANLINES, IDC_LM_NORMAL + workprefs.gfx_linedbl );
     CheckDlgButton (hDlg, IDC_AFULLSCREEN, workprefs.gfx_afullscreen);
@@ -3362,7 +3406,7 @@ static void values_to_displaydlg (HWND hDlg)
     CheckDlgButton (hDlg, IDC_LORES, workprefs.gfx_linedbl ? FALSE : TRUE);
     CheckDlgButton (hDlg, IDC_LORES, workprefs.gfx_lores);
     CheckDlgButton (hDlg, IDC_VSYNC, workprefs.gfx_vsync);
-    
+
     CheckDlgButton (hDlg, IDC_XCENTER, workprefs.gfx_xcenter);
     CheckDlgButton (hDlg, IDC_YCENTER, workprefs.gfx_ycenter);
 
@@ -3408,6 +3452,7 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
                               IsDlgButtonChecked( hDlg, IDC_LM_DOUBLED ) ? 1 : 0 );
 
     workprefs.gfx_framerate = SendDlgItemMessage (hDlg, IDC_FRAMERATE, TBM_GETPOS, 0, 0);
+    workprefs.chipset_refreshrate = SendDlgItemMessage (hDlg, IDC_FRAMERATE2, TBM_GETPOS, 0, 0);
     workprefs.gfx_vsync = IsDlgButtonChecked (hDlg, IDC_VSYNC);
 
     {
@@ -3430,6 +3475,8 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
            SetDlgItemText( hDlg, IDC_RATETEXT, string );
            LocalFree( string );
        }
+        sprintf (buffer, "%d", workprefs.chipset_refreshrate);
+       SetDlgItemText (hDlg, IDC_RATE2TEXT, buffer);
        workprefs.gfx_width_win  = GetDlgItemInt( hDlg, IDC_XSIZE, &success, FALSE );
         if( !success )
             workprefs.gfx_width_win = 800;
@@ -3437,6 +3484,8 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
         if( !success )
             workprefs.gfx_height_win = 600;
     }
+    if (workprefs.chipset_refreshrate == (currprefs.ntscmode ? 60 : 50))
+       workprefs.chipset_refreshrate = 0;
     workprefs.gfx_xcenter = (IsDlgButtonChecked (hDlg, IDC_XCENTER) ? 2 : 0 ); /* Smart centering */
     workprefs.gfx_ycenter = (IsDlgButtonChecked (hDlg, IDC_YCENTER) ? 2 : 0 ); /* Smart centering */
 
@@ -3474,8 +3523,8 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
                break;
            }
            /* Set the Int boxes */
-           SetDlgItemInt( hDlg, IDC_XSIZE, workprefs.gfx_width_win, FALSE );
-           SetDlgItemInt( hDlg, IDC_YSIZE, workprefs.gfx_height_win, FALSE );
+           SetDlgItemInt (hDlg, IDC_XSIZE, workprefs.gfx_width_win, FALSE);
+           SetDlgItemInt (hDlg, IDC_YSIZE, workprefs.gfx_height_win, FALSE);
            init_frequency_combo (hDlg, posn);
        } else if (LOWORD (wParam) == IDC_REFRESHRATE) {
            LONG posn1, posn2;
@@ -3491,6 +3540,7 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
                posn1--;
                workprefs.gfx_refreshrate = storedrefreshrates[posn1];
            }
+           values_to_displaydlg (hDlg);
 #if 0
        } else if (LOWORD (wParam) == IDC_DA_MODE) {
            da_mode_selected = SendDlgItemMessage (hDlg, IDC_DA_MODE, CB_GETCURSEL, 0, 0);
@@ -3520,6 +3570,8 @@ static BOOL CALLBACK DisplayDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
        currentpage = DISPLAY_ID;
        SendDlgItemMessage (hDlg, IDC_FRAMERATE, TBM_SETPAGESIZE, 0, 1);
        SendDlgItemMessage (hDlg, IDC_FRAMERATE, TBM_SETRANGE, TRUE, MAKELONG (MIN_REFRESH_RATE, MAX_REFRESH_RATE));
+       SendDlgItemMessage (hDlg, IDC_FRAMERATE2, TBM_SETPAGESIZE, 0, 1);
+       SendDlgItemMessage (hDlg, IDC_FRAMERATE2, TBM_SETRANGE, TRUE, MAKELONG (5, 99));
        init_displays_combo( hDlg );
        init_resolution_combo( hDlg );
 #if 0
@@ -4643,11 +4695,14 @@ static void sound_loaddrivesamples (void)
                    char *oldp = p;
                    len += 2000;
                    drivesounds = p = realloc (drivesounds, len);
-                   if (oldp)
-                       p = p + strlen (p) + 1;
+                   if (oldp) {
+                       do {
+                           p = p + strlen (p) + 1;
+                       } while (p[0]);
+                   }
                }
                strcpy (p, name + strlen (DS_NAME_CLICK));
-               p[strlen(name) - 4] = 0;
+               p[strlen(name + strlen (DS_NAME_CLICK)) - 4] = 0;
                p += strlen (p);
                *p++ = 0;
                *p = 0;
@@ -5796,6 +5851,16 @@ static void deletesaveimage (HWND hDlg, int num)
     }
 }
 
+static void diskselect (HWND hDlg, WPARAM wParam, struct uae_prefs *p, int drv)
+{
+    MultiDiskSelection (hDlg, wParam, 0, &workprefs, NULL);
+    disk_insert (drv, p->df[0]);
+    disk_insert (drv, p->df[1]);
+    disk_insert (drv, p->df[2]);
+    disk_insert (drv, p->df[3]);
+    addfloppytype (hDlg, drv);
+}
+
 static BOOL CALLBACK FloppyDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 {
     static int recursive = 0;
@@ -5904,25 +5969,17 @@ static BOOL CALLBACK FloppyDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
            break;
        case IDC_DF0:
        case IDC_DF0QQ:
-           DiskSelection (hDlg, wParam, 0, &workprefs, 0);
-           disk_insert (0, workprefs.df[0]);
-           addfloppytype (hDlg, 0);
+           diskselect (hDlg, wParam, &workprefs, 0);
            break;
        case IDC_DF1:
        case IDC_DF1QQ:
-           DiskSelection (hDlg, wParam, 0, &workprefs, 0);
-           disk_insert (1, workprefs.df[1]);
-           addfloppytype (hDlg, 1);
+           diskselect (hDlg, wParam, &workprefs, 1);
            break;
        case IDC_DF2:
-           DiskSelection (hDlg, wParam, 0, &workprefs, 0);
-           disk_insert (2, workprefs.df[2]);
-           addfloppytype (hDlg, 2);
+           diskselect (hDlg, wParam, &workprefs, 2);
            break;
        case IDC_DF3:
-           DiskSelection (hDlg, wParam, 0, &workprefs, 0);
-           disk_insert (3, workprefs.df[3]);
-           addfloppytype (hDlg, 3);
+           diskselect (hDlg, wParam, &workprefs, 3);
            break;
        case IDC_EJECT0:
        case IDC_EJECT0Q:
@@ -6011,6 +6068,21 @@ static void swapperhili (int entry)
         LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
 }
 
+static void addswapperfile (HWND hDlg, int entry)
+{
+    char path[MAX_DPATH];
+    if (MultiDiskSelection (hDlg, -1, 0, &changed_prefs, path)) {
+        char dpath[MAX_DPATH];
+        loopmulti (path, NULL);
+        while (loopmulti(path, dpath) && entry < MAX_SPARE_DRIVES - 1) {
+            strcpy (workprefs.dfxlist[entry], dpath);
+            entry++;
+        }
+        InitializeListView (hDlg);
+        swapperhili (entry);
+    }
+}
+
 static BOOL CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 {
     static int recursive = 0;
@@ -6131,12 +6203,7 @@ static BOOL CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
            break;
            case 10209:
            {
-               char path[MAX_DPATH];
-               if (DiskSelection (hDlg, -1, 0, &changed_prefs, path)) {
-                   strcpy (workprefs.dfxlist[entry], path);
-                   InitializeListView (hDlg);
-                   swapperhili (entry);
-               }
+               addswapperfile (hDlg, entry);
            }
            break;
        
@@ -6194,12 +6261,8 @@ static BOOL CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                            InitializeListView (hDlg);
                        swapperhili (entry);
                    } else if (col == 1) {
-                       char path[MAX_DPATH];
-                       if (dblclick && DiskSelection (hDlg, -1, 0, &changed_prefs, path)) {
-                           strcpy (workprefs.dfxlist[entry], path);
-                           InitializeListView (hDlg);
-                           swapperhili (entry);
-                       }
+                       if (dblclick)
+                           addswapperfile (hDlg, entry);
                    }
                }
                break;
@@ -6216,13 +6279,15 @@ static DWORD dwEnumeratedPrinters = 0;
 static char comports[MAX_SERIALS][8];
 static int ghostscript_available;
 
+#define NUM_JOYKBD 5
+
 static int joy0idc[] = {
-    IDC_PORT0_JOYSC, IDC_PORT0_KBDA, IDC_PORT0_KBDB, IDC_PORT0_KBDC,
+    IDC_PORT0_JOYSC, IDC_PORT0_KBDA, IDC_PORT0_KBDB, IDC_PORT0_KBDC, IDC_PORT0_KBDD, IDC_PORT0_KBDE,
     IDC_PORT0_JOYS, -1
 };
 
 static int joy1idc[] = {
-    IDC_PORT1_JOYSC, IDC_PORT1_KBDA, IDC_PORT1_KBDB, IDC_PORT1_KBDC,
+    IDC_PORT1_JOYSC, IDC_PORT1_KBDA, IDC_PORT1_KBDB, IDC_PORT1_KBDC, IDC_PORT1_KBDD, IDC_PORT1_KBDE,
     IDC_PORT1_JOYS, -1
 };
 static int joy0previous, joy1previous;
@@ -6257,6 +6322,7 @@ static void enable_for_portsdlg( HWND hDlg )
     EnableWindow( GetDlgItem( hDlg, IDC_FLUSHPRINTER), FALSE );
     EnableWindow( GetDlgItem( hDlg, IDC_PSPRINTER), FALSE );
     EnableWindow( GetDlgItem( hDlg, IDC_PS_PARAMS), FALSE );
+    EnableWindow( GetDlgItem( hDlg, IDC_PRINTER_AUTOFLUSH), FALSE );
 #else
     EnableWindow( GetDlgItem( hDlg, IDC_FLUSHPRINTER), isprinteropen () ? TRUE : FALSE );
     EnableWindow( GetDlgItem( hDlg, IDC_PSPRINTER), full_property_sheet && ghostscript_available ? TRUE : FALSE );
@@ -6278,11 +6344,11 @@ static void updatejoyport (HWND hDlg)
            v = 0;
        else
            v++;
-       CheckRadioButton (hDlg, idcs1[0], idcs1[3], idcs1[v]);
-       for (j = 1; j < 4; j++)
+       CheckRadioButton (hDlg, idcs1[0], idcs1[NUM_JOYKBD], idcs1[v]);
+       for (j = 1; j < NUM_JOYKBD + 2; j++)
            EnableWindow (GetDlgItem (hDlg, idcs2[j]), workprefs.input_selected_setting == 0 && j != v);
     }
-    
+
     if (joy0previous < 0)
        joy0previous = inputdevice_get_device_total (IDTYPE_JOYSTICK) + 1;
     if (joy1previous < 0)
@@ -6305,7 +6371,7 @@ static void updatejoyport (HWND hDlg)
                idx = 0;
            else
                idx += inputdevice_get_device_total (IDTYPE_JOYSTICK);
-       }else if (v >= JSEM_JOYS) {
+       } else if (v >= JSEM_JOYS) {
            idx = v - JSEM_JOYS + 1;
            if (idx > inputdevice_get_device_total (IDTYPE_JOYSTICK))
                idx = 0;
@@ -6340,18 +6406,19 @@ static void fixjport (int *port, int v)
 
 static void values_from_portsdlg (HWND hDlg)
 {
-    int item, i, j, lastside = 0, changed = 0;
+    int item, i, j, lastside = 0, changed = 0, v;
     char tmp[256];
+    BOOL success;
     
     for (i = 0; i < 2; i++) {
        int *idcs = i == 0 ? joy0idc : joy1idc;
        int *port = i == 0 ? &workprefs.jport0 : &workprefs.jport1;
        int prevport = *port;
        int *joyprev = i == 0 ? &joy0previous : &joy1previous;
-        int v = SendDlgItemMessage (hDlg, idcs[4], CB_GETCURSEL, 0, 0L);
+        int v = SendDlgItemMessage (hDlg, idcs[NUM_JOYKBD + 1], CB_GETCURSEL, 0, 0L);
        if (v != CB_ERR)
            *joyprev = v;
-       for (j = 0; j < 4; j++) {
+       for (j = 0; j < NUM_JOYKBD + 1; j++) {
            if (IsDlgButtonChecked (hDlg, idcs[j])) {
                if (j > 0) {
                    *port = JSEM_KBDLAYOUT + j - 1;
@@ -6453,6 +6520,9 @@ static void values_from_portsdlg (HWND hDlg)
     if (IsDlgButtonChecked (hDlg, IDC_SERIAL_DIRECT))
         workprefs.serial_direct = 1;
     GetDlgItemText (hDlg, IDC_PS_PARAMS, workprefs.ghostscript_parameters, 256);
+    v  = GetDlgItemInt (hDlg, IDC_PRINTERAUTOFLUSH, &success, FALSE);
+    if (success)
+       workprefs.parallel_autoflush_time = v;
 
 }
 
@@ -6487,6 +6557,7 @@ static void values_to_portsdlg (HWND hDlg)
            result = 0;
        }
     }
+    SetDlgItemInt( hDlg, IDC_PRINTERAUTOFLUSH, workprefs.parallel_autoflush_time, FALSE );
     CheckDlgButton( hDlg, IDC_PSPRINTER, workprefs.parallel_postscript_emulation );
     CheckDlgButton( hDlg, IDC_PSPRINTERDETECT, workprefs.parallel_postscript_detection );
     SetDlgItemText (hDlg, IDC_PS_PARAMS, workprefs.ghostscript_parameters);