]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
2100b16
authorToni Wilen <twilen@winuae.net>
Wed, 10 Mar 2010 17:09:08 +0000 (19:09 +0200)
committerToni Wilen <twilen@winuae.net>
Wed, 10 Mar 2010 17:09:08 +0000 (19:09 +0200)
18 files changed:
disk.cpp
drawing.cpp
include/disk.h
include/inputdevice.h
include/keyboard.h
inputdevice.cpp
inputevents.def
od-win32/direct3d.cpp
od-win32/direct3d.h
od-win32/keyboard_win32.cpp
od-win32/resources/resource
od-win32/resources/winuae.rc
od-win32/srcrelease.cmd
od-win32/win32.cpp
od-win32/win32.h
od-win32/win32gfx.cpp
od-win32/win32gui.cpp
sampler.cpp

index 4d27ed54e1ce3ffae73e74e6578166bd0ec3f288..895ad688e41b111259e683d133555bac9cedb3bc 100644 (file)
--- a/disk.cpp
+++ b/disk.cpp
@@ -3579,61 +3579,173 @@ uae_u8 *save_floppy(int *len, uae_u8 *dstptr)
 
 #endif /* SAVESTATE */
 
-static int getnextdisk (TCHAR *img)
+#define MAX_DISKENTRIES 4
+int disk_prevnext_name (TCHAR *imgp, int dir)
 {
-       TCHAR *ext, *p, *dst;
+       TCHAR img[MAX_DPATH], *ext, *p, *p2, *ps, *dst[MAX_DISKENTRIES];
        int num = -1;
+       int cnt, i;
+       TCHAR imgl[MAX_DPATH];
+       int ret, gotone, wrapped;
+       TCHAR *old;
+
+       old = my_strdup (imgp);
+
+       struct zfile *zf = zfile_fopen (imgp, L"rb", ZFD_NORMAL);
+       if (zf) {
+               _tcscpy (img, zfile_getname (zf));
+               zfile_fclose (zf);
+               zf = zfile_fopen (img, L"rb", ZFD_NORMAL);
+               if (!zf) // oops, no directory support in this archive type
+                       _tcscpy (img, imgp);
+               zfile_fclose (zf);
+       } else {
+               _tcscpy (img, imgp);
+       }
 
-       dst = NULL;
+       wrapped = 0;
+retry:
+       _tcscpy (imgl, img);
+       to_lower (imgl, sizeof imgl / sizeof (TCHAR));
+       gotone = 0;
+       ret = 0;
+       ps = imgl;
+       cnt = 0;
+       dst[cnt] = NULL;
        for (;;) {
                // disk x of y
-               p = _tcsstr (img, L"disk ");
-               if (p && _istdigit (p[5])) {
-                       num = _tstoi (p + 5);
-                       dst = p + 5;
-               } else {
-                       ext = _tcsrchr (img, '.');
-                       if (!ext || ext - img < 4)
+               p = _tcsstr (ps, L"(disk ");
+               if (p && _istdigit (p[6])) {
+                       p2 = p - imgl + img;
+                       num = _tstoi (p + 6);
+                       dst[cnt++] = p2 + 6;
+                       if (cnt >= MAX_DISKENTRIES - 1)
                                break;
-                       // name_<non numeric character>x.ext
-                       if (ext[-3] == '_' && !_istdigit (ext[-2]) && _istdigit (ext[-1])) {
-                               num = _tstoi (ext - 1);
-                               dst = ext - 1;
-                       // name_x.ext
-                       } else if (ext[-2] == '_' && _istdigit (ext[-1])) {
-                               num = _tstoi (ext - 1);
-                               dst = ext - 1;
-                       // name_a.ext
-                       } else if (ext[-2] == '_' && ext[-1] >= 'a' && ext[-1] <= 'z') {
-                               num = ext[-1] - 'a';
-                               dst = ext - 1;
-                       }
+                       gotone = 1;
+                       ps = p + 6;
+                       continue;
+               }
+               if (gotone)
+                        break;
+               p = _tcsstr (ps, L"disk");
+               if (p && _istdigit (p[4])) {
+                       p2 = p - imgl + img;
+                       num = _tstoi (p + 4);
+                       dst[cnt++] = p2 + 4;
+                       if (cnt >= MAX_DISKENTRIES - 1)
+                               break;
+                       gotone = 1;
+                       ps = p + 4;
+                       continue;
+               }
+               if (gotone)
+                        break;
+               ext = _tcsrchr (ps, '.');
+               if (!ext || ext - ps < 4)
+                       break;
+               TCHAR *ext2 = ext - imgl + img;
+               // name_<non numeric character>x.ext
+               if (ext[-3] == '_' && !_istdigit (ext[-2]) && _istdigit (ext[-1])) {
+                       num = _tstoi (ext - 1);
+                       dst[cnt++] = ext2 - 1;
+               // name_x.ext, name-x.ext, name x.ext
+               } else if ((ext[-2] == '_' || ext[-2] == '-' || ext[-2] == ' ') && _istdigit (ext[-1])) {
+                       num = _tstoi (ext - 1);
+                       dst[cnt++] = ext2 - 1;
+               // name_a.ext, name-a.ext, name a .ext
+               } else if ((ext[-2] == '_' || ext[-2] == '-' || ext[-2] == ' ') && ext[-1] >= 'a' && ext[-1] <= 'z') {
+                       num = ext[-1] - 'a' + 1;
+                       dst[cnt++] = ext2 - 1;
+               // nameA.ext
+               } else if (ext2[-2] >= 'a' && ext2[-2] <= 'z' && ext2[-1] >= 'A' && ext2[-1] <= 'Z') {
+                       num = ext[-1] - 'a' + 1;
+                       dst[cnt++] = ext2 - 1;
+               // namex.ext
+               } else if (!_istdigit (ext2[-2]) && _istdigit (ext[-1])) {
+                       num = ext[-1] - '0';
+                       dst[cnt++] = ext2 - 1;
                }
                break;
        }
+       dst[cnt] = NULL;
        if (num <= 0 || num >= 19)
-               return 0;
+               goto end;
+       num += dir;
        if (num > 9)
-               return 0;
+               goto end;
        if (num == 9)
-               num = 0;
-       if (!_istdigit (dst[0]))
-               dst[0] = num + 'a';
-       else
-               dst[0] = num + '0';
-       return 0;
+               num = 1;
+       else if (num == 0)
+               num = 9;
+       for (i = 0; i < cnt; i++) {
+               if (!_istdigit (dst[i][0])) {
+                       int capital = dst[i][0] >= 'A' && dst[i][0] <= 'Z';
+                       dst[i][0] = (num - 1) + (capital ? 'A' : 'a');
+               } else {
+                       dst[i][0] = num + '0';
+               }
+       }
+       if (zfile_exists (img)) {
+               ret = 1;
+               goto end;
+       }
+       if (gotone) { // was (disk x but no match, perhaps there are extra tags..
+               TCHAR *old2 = my_strdup (img);
+               for (;;) {
+                       ext = _tcsrchr (img, '.');
+                       if (!ext)
+                               break;
+                       if (ext == img)
+                               break;
+                       if (ext[-1] != ']')
+                               break;
+                       TCHAR *t = _tcsrchr (img, '[');
+                       if (!t)
+                               break;
+                       t[0] = 0;
+                       if (zfile_exists (img)) {
+                               ret = 1;
+                               goto end;
+                       }
+               }
+               _tcscpy (img, old2);
+               xfree (old2);
+       }
+       if (!wrapped) {
+               for (i = 0; i < cnt; i++) {
+                       if (!_istdigit (dst[i][0]))
+                               dst[i][0] = dst[i][0] >= 'A' && dst[i][0] <= 'Z' ? 'A' : 'a';
+                       else
+                               dst[i][0] = '1';
+                       if (dir < 0)
+                               dst[i][0] += 8;
+               }
+               wrapped++;
+       }
+       if (zfile_exists (img)) {
+               ret = -1;
+               goto end;
+       }
+       if (dir < 0 && wrapped < 2)
+               goto retry;
+       _tcscpy (img, old);
+
+end:
+       _tcscpy (imgp, img);
+       xfree (old);
+       return ret;
 }
 
-int disk_next (int drive)
+int disk_prevnext (int drive, int dir)
 {
        TCHAR img[MAX_DPATH];
 
         _tcscpy (img, currprefs.df[drive]);
-        to_lower (img, sizeof img / sizeof (TCHAR));
 
-       if (img[0])
+       if (!img[0])
                return 0;
-       getnextdisk (img);
+       disk_prevnext_name (img, dir);
+       _tcscpy (changed_prefs.df[drive], img);
        return 1;
 }
 
index e5f5cc321f1748ca31e8162a285c608ec83846ad..e065974462c7887ef59b5b0133476e62989bf7d2 100644 (file)
@@ -1811,7 +1811,7 @@ STATIC_INLINE void do_flush_screen (int start, int stop)
        unlockscr ();
        if (start <= stop)
                flush_screen (start, stop);
-       else if ((currprefs.gfx_afullscreen && currprefs.gfx_avsync) || currprefs.gfx_filter == 8)
+       else if (currprefs.gfx_afullscreen && currprefs.gfx_avsync)
                flush_screen (0, 0); /* vsync mode */
 }
 
index c561594f781f66191b345d1c950699ee6d91474d..5f1eae4652465b4e4a7691a89f93fd85680648c9 100644 (file)
@@ -34,6 +34,8 @@ extern TCHAR *DISK_history_get (int idx, int type);
 int DISK_examine_image (struct uae_prefs *p, int num, uae_u32 *crc32);
 extern TCHAR *DISK_get_saveimagepath (const TCHAR *name);
 extern void DISK_reinsert (int num);
+extern int disk_prevnext (int drive, int dir);
+extern int disk_prevnext_name (TCHAR *img, int dir);
 
 extern void DSKLEN (uae_u16 v, int hpos);
 extern uae_u16 DSKBYTR (int hpos);
index 0931b198acec8c2e3a03a59f499dc2587d312f7f..10bb70629268d886d9477f426e5babc7421debd1 100644 (file)
@@ -108,10 +108,11 @@ extern int getjoystickstate (int mouse);
 void setmousestate (int mouse, int axis, int data, int isabs);
 extern int getmousestate (int mouse);
 extern void inputdevice_updateconfig (struct uae_prefs *prefs);
+extern void inputdevice_mergeconfig (struct uae_prefs *prefs);
 extern void inputdevice_devicechange (struct uae_prefs *prefs);
 
 extern int inputdevice_translatekeycode (int keyboard, int scancode, int state);
-extern void inputdevice_setkeytranslation (struct uae_input_device_kbr_default *trans);
+extern void inputdevice_setkeytranslation (struct uae_input_device_kbr_default *trans, int **kbmaps);
 extern int handle_input_event (int nr, int state, int max, int autofire);
 extern void inputdevice_do_keyboard (int code, int state);
 extern int inputdevice_iskeymapped (int keyboard, int scancode);
index 9714e34ce8072ba328c6824e0f12b88634157931..8e1e346a139c2fd4487e2de8c633eb35459b02e3 100644 (file)
@@ -155,6 +155,8 @@ enum aks { AKS_ENTERGUI = 0x200, AKS_SCREENSHOT, AKS_FREEZEBUTTON,
     AKS_INPUT_CONFIG_1,AKS_INPUT_CONFIG_2,AKS_INPUT_CONFIG_3,AKS_INPUT_CONFIG_4,
     AKS_DISKSWAPPER_NEXT,AKS_DISKSWAPPER_PREV,
     AKS_DISKSWAPPER_INSERT0,AKS_DISKSWAPPER_INSERT1,AKS_DISKSWAPPER_INSERT2,AKS_DISKSWAPPER_INSERT3,
+       AKS_DISK_PREV0, AKS_DISK_PREV1, AKS_DISK_PREV2, AKS_DISK_PREV3,
+       AKS_DISK_NEXT0, AKS_DISK_NEXT1, AKS_DISK_NEXT2, AKS_DISK_NEXT3
 };
 
 extern int target_checkcapslock (int, int *);
\ No newline at end of file
index 25b05bde2be7374e84f14194f24c746fc37f9d90..a2fdd6bb73d2d3bf1124c5cdaf2fad546091204b 100644 (file)
@@ -398,6 +398,7 @@ static struct uae_input_device *joysticks;
 static struct uae_input_device *mice;
 static struct uae_input_device *keyboards;
 static struct uae_input_device_kbr_default *keyboard_default;
+static int **keyboard_default_kbmaps;
 
 static int mouse_axis[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS];
 static int oldm_axis[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS];
@@ -2360,6 +2361,18 @@ void inputdevice_handle_inputcode (void)
                changed_prefs.input_selected_setting = currprefs.input_selected_setting = code - AKS_INPUT_CONFIG_1 + 1;
                inputdevice_updateconfig (&currprefs);
                break;
+       case AKS_DISK_PREV0:
+       case AKS_DISK_PREV1:
+       case AKS_DISK_PREV2:
+       case AKS_DISK_PREV3:
+               disk_prevnext (code - AKS_DISK_PREV0, -1);
+               break;
+       case AKS_DISK_NEXT0:
+       case AKS_DISK_NEXT1:
+       case AKS_DISK_NEXT2:
+       case AKS_DISK_NEXT3:
+               disk_prevnext (code - AKS_DISK_NEXT0, 1);
+               break;
        }
 }
 
@@ -3084,6 +3097,237 @@ static void setcd32 (int joy, int n)
 
 int compatibility_device[MAX_JPORTS];
 
+
+static int ip_joy1[] = {
+       INPUTEVENT_JOY1_UP, INPUTEVENT_JOY1_LEFT, INPUTEVENT_JOY1_RIGHT, INPUTEVENT_JOY1_DOWN,
+       INPUTEVENT_JOY1_FIRE_BUTTON, INPUTEVENT_JOY1_2ND_BUTTON, INPUTEVENT_JOY1_3RD_BUTTON,
+       -1
+};
+static int ip_joy2[] = {
+       INPUTEVENT_JOY2_UP, INPUTEVENT_JOY2_LEFT, INPUTEVENT_JOY2_RIGHT, INPUTEVENT_JOY2_DOWN,
+       INPUTEVENT_JOY2_FIRE_BUTTON, INPUTEVENT_JOY2_2ND_BUTTON, INPUTEVENT_JOY2_3RD_BUTTON,
+       -1
+};
+static int ip_joycd321[] = {
+       INPUTEVENT_JOY1_CD32_RED, INPUTEVENT_JOY1_CD32_BLUE, INPUTEVENT_JOY1_CD32_GREEN, INPUTEVENT_JOY1_CD32_YELLOW,
+       INPUTEVENT_JOY1_CD32_RWD, INPUTEVENT_JOY1_CD32_FFW, INPUTEVENT_JOY1_CD32_PLAY,
+       -1
+};
+static int ip_joycd322[] = {
+       INPUTEVENT_JOY2_CD32_RED, INPUTEVENT_JOY2_CD32_BLUE, INPUTEVENT_JOY2_CD32_GREEN, INPUTEVENT_JOY2_CD32_YELLOW,
+       INPUTEVENT_JOY2_CD32_RWD, INPUTEVENT_JOY2_CD32_FFW, INPUTEVENT_JOY2_CD32_PLAY,
+       -1
+};
+static int ip_parjoy1[] = {
+       INPUTEVENT_PAR_JOY1_UP, INPUTEVENT_PAR_JOY1_LEFT, INPUTEVENT_PAR_JOY1_RIGHT, INPUTEVENT_PAR_JOY1_DOWN,
+       INPUTEVENT_PAR_JOY1_FIRE_BUTTON,
+       -1
+};
+static int ip_parjoy2[] = {
+       INPUTEVENT_PAR_JOY2_UP, INPUTEVENT_PAR_JOY2_LEFT, INPUTEVENT_PAR_JOY2_RIGHT, INPUTEVENT_PAR_JOY2_DOWN,
+       INPUTEVENT_PAR_JOY2_FIRE_BUTTON,
+       -1
+};
+static int ip_mouse1[] = {
+       INPUTEVENT_MOUSE1_UP, INPUTEVENT_MOUSE1_LEFT, INPUTEVENT_MOUSE1_RIGHT, INPUTEVENT_MOUSE1_DOWN,
+       INPUTEVENT_JOY1_FIRE_BUTTON, INPUTEVENT_JOY1_2ND_BUTTON, INPUTEVENT_JOY1_3RD_BUTTON,
+       -1
+};
+static int ip_mouse2[] = {
+       INPUTEVENT_MOUSE2_UP, INPUTEVENT_MOUSE2_LEFT, INPUTEVENT_MOUSE2_RIGHT, INPUTEVENT_MOUSE2_DOWN,
+       INPUTEVENT_JOY2_FIRE_BUTTON, INPUTEVENT_JOY2_2ND_BUTTON, INPUTEVENT_JOY2_3RD_BUTTON,
+       -1
+};
+
+static void checkcompakb (int *kb, int *srcmap)
+{
+       int found = 0, avail = 0;
+       int j, k;
+
+       k = j = 0;
+       while (kb[j] >= 0) {
+               struct uae_input_device *uid = &keyboards[0];
+               while (kb[j] >= 0 && srcmap[k] >= 0) {
+                       int id = kb[j];
+                       for (int l = 0; l < MAX_INPUT_DEVICE_EVENTS; l++) {
+                               if (uid->extra[l][0] == id) {
+                                       avail++;
+                                       if (uid->eventid[l][0] == srcmap[k])
+                                               found++;
+                                       break;
+                               }
+                       }
+                       j++;
+               }
+               j++;
+               k++;
+       }
+       if (avail != found || avail == 0)
+               return;
+       k = j = 0;
+       while (kb[j] >= 0) {
+               struct uae_input_device *uid = &keyboards[0];
+               while (kb[j] >= 0) {
+                       int id = kb[j];
+                       int evt = 0;
+                       k = 0;
+                       while (keyboard_default[k].scancode >= 0) {
+                               if (keyboard_default[k].scancode == kb[j]) {
+                                       evt = keyboard_default[k].event;
+                                       break;
+                               }
+                               k++;
+                       }
+                       for (int l = 0; l < MAX_INPUT_DEVICE_EVENTS; l++) {
+                               if (uid->extra[l][0] == id) {
+                                       uid->eventid[l][0] = evt;
+                                       break;
+                               }
+                       }
+                       j++;
+               }
+               j++;
+       }
+}
+
+static void setcompakb (int *kb, int *srcmap)
+{
+       int j, k;
+       k = j = 0;
+       while (kb[j] >= 0 && srcmap[k] >= 0) {
+               struct uae_input_device *uid = &keyboards[0];
+               while (kb[j] >= 0) {
+                       int id = kb[j];
+                       for (int l = 0; l < MAX_INPUT_DEVICE_EVENTS; l++) {
+                               if (uid->extra[l][0] == id) {
+                                       uid->eventid[l][0] = srcmap[k];
+                                       uid->flags[l][0] = 0;
+                                       xfree (uid->custom[l][0]);
+                                       uid->custom[l][0] = NULL;
+                                       break;
+                               }
+                       }
+                       j++;
+               }
+               j++;
+               k++;
+       }
+}
+
+// merge gameport settings with current input configuration
+static void compatibility_copy (struct uae_prefs *prefs)
+{
+       int used[MAX_INPUT_DEVICES] = { 0 };
+       int i, joy;
+
+       for (i = 0; i < 2; i++) {
+               int mode = prefs->jports[i].mode;
+               if ((joy = jsem_ismouse (i, prefs)) >= 0) {
+                       switch (mode)
+                       {
+                       case JSEM_MODE_DEFAULT:
+                       case JSEM_MODE_MOUSE:
+                       default:
+                               input_get_default_mouse (mice, joy, i);
+                               break;
+                       case JSEM_MODE_LIGHTPEN:
+                               input_get_default_lightpen (mice, joy, i);
+                               break;
+                       }
+               }
+       }
+       for (i = 1; i >= 0; i--) {
+               int mode = prefs->jports[i].mode;
+               joy = jsem_isjoy (i, prefs);
+               if (joy >= 0) {
+                       switch (mode)
+                       {
+                       case JSEM_MODE_DEFAULT:
+                       case JSEM_MODE_JOYSTICK:
+                       case JSEM_MODE_JOYSTICK_CD32:
+                       default:
+                               input_get_default_joystick (joysticks, joy, i, (mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd)));
+                               break;
+                       case JSEM_MODE_JOYSTICK_ANALOG:
+                               input_get_default_joystick_analog (joysticks, joy, i);
+                               break;
+                       case JSEM_MODE_MOUSE:
+                               input_get_default_mouse (joysticks, joy, i);
+                               break;
+                       case JSEM_MODE_LIGHTPEN:
+                               input_get_default_lightpen (joysticks, joy, i);
+                               break;
+                       }
+                       used[joy] = 1;
+               }
+       }
+
+       // replace possible old mappings with default keyboard mapping
+       checkcompakb (keyboard_default_kbmaps[0], ip_joy2);
+       checkcompakb (keyboard_default_kbmaps[0], ip_joy1);
+       checkcompakb (keyboard_default_kbmaps[0], ip_parjoy2);
+       checkcompakb (keyboard_default_kbmaps[0], ip_parjoy1);
+       checkcompakb (keyboard_default_kbmaps[0], ip_mouse2);
+       checkcompakb (keyboard_default_kbmaps[0], ip_mouse1);
+       checkcompakb (keyboard_default_kbmaps[1], ip_joy2);
+       checkcompakb (keyboard_default_kbmaps[1], ip_joy1);
+       checkcompakb (keyboard_default_kbmaps[1], ip_parjoy2);
+       checkcompakb (keyboard_default_kbmaps[1], ip_parjoy1);
+       checkcompakb (keyboard_default_kbmaps[1], ip_mouse2);
+       checkcompakb (keyboard_default_kbmaps[1], ip_mouse1);
+       checkcompakb (keyboard_default_kbmaps[2], ip_joy2);
+       checkcompakb (keyboard_default_kbmaps[2], ip_joy1);
+       checkcompakb (keyboard_default_kbmaps[2], ip_parjoy2);
+       checkcompakb (keyboard_default_kbmaps[2], ip_parjoy1);
+       checkcompakb (keyboard_default_kbmaps[2], ip_mouse2);
+       checkcompakb (keyboard_default_kbmaps[2], ip_mouse1);
+       checkcompakb (keyboard_default_kbmaps[5], ip_joycd321);
+       checkcompakb (keyboard_default_kbmaps[5], ip_joycd322);
+
+       for (i = 0; i < 2; i++) {
+               int *kb;
+               int mode = prefs->jports[i].mode;
+               for (joy = 0; used[joy]; joy++);
+               if (JSEM_ISANYKBD (i, prefs)) {
+                       if (JSEM_ISNUMPAD (i, prefs))
+                               kb = keyboard_default_kbmaps[0];
+                       else if (JSEM_ISCURSOR (i, prefs))
+                               kb = keyboard_default_kbmaps[1];
+                       else
+                               kb = keyboard_default_kbmaps[2];
+                       switch (mode)
+                       {
+                       case JSEM_MODE_JOYSTICK:
+                       case JSEM_MODE_JOYSTICK_CD32:
+                       case JSEM_MODE_DEFAULT:
+                               setcompakb (kb, i ? ip_joy2 : ip_joy1);
+                               if (mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd))
+                                       setcompakb (keyboard_default_kbmaps[5], i ? ip_joycd322 : ip_joycd321);
+                               break;
+                       case JSEM_MODE_MOUSE:
+                               setcompakb (kb, i ? ip_mouse2 : ip_mouse1);
+                               break;
+                       }
+                       used[joy] = 1;
+               }
+       }
+       // parport
+       for (i = 2; i < 4; i++) {
+               int *kb;
+               for (joy = 0; used[joy]; joy++);
+               if (JSEM_ISANYKBD (i, prefs)) {
+                       if (JSEM_ISNUMPAD (i, prefs))
+                               kb = keyboard_default_kbmaps[0];
+                       else if (JSEM_ISCURSOR (i, prefs))
+                               kb = keyboard_default_kbmaps[1];
+                       else
+                               kb = keyboard_default_kbmaps[2];
+                       setcompakb (kb, i ? ip_parjoy2 : ip_parjoy1);
+                       used[joy] = 1;
+               }
+       }
+}
+
 static void compatibility_mode (struct uae_prefs *prefs)
 {
        int joy, i;
@@ -3292,7 +3536,7 @@ static void matchdevices_all (struct uae_prefs *prefs)
        }
 }
 
-void inputdevice_updateconfig (struct uae_prefs *prefs)
+static void inputdevice_updateconfig2 (struct uae_prefs *prefs, int domerge)
 {
        int i;
 
@@ -3346,6 +3590,8 @@ void inputdevice_updateconfig (struct uae_prefs *prefs)
        memset (mice2, 0, sizeof (mice2));
        if (prefs->input_selected_setting == 0)
                compatibility_mode (prefs);
+       else if (domerge)
+               compatibility_copy (prefs);
 
        joystick_setting_changed ();
 
@@ -3361,6 +3607,16 @@ void inputdevice_updateconfig (struct uae_prefs *prefs)
 #endif
 }
 
+void inputdevice_mergeconfig (struct uae_prefs *prefs)
+{
+       inputdevice_updateconfig2 (prefs, 1);
+}
+void inputdevice_updateconfig (struct uae_prefs *prefs)
+{
+       inputdevice_updateconfig2 (prefs, 0);
+}
+
+
 /* called when devices get inserted or removed
 * store old devices temporarily, enumerate all devices
 * restore old devices back (order may have changed)
@@ -3488,9 +3744,10 @@ void inputdevice_default_prefs (struct uae_prefs *p)
        }
 }
 
-void inputdevice_setkeytranslation (struct uae_input_device_kbr_default *trans)
+void inputdevice_setkeytranslation (struct uae_input_device_kbr_default *trans, int **kbmaps)
 {
        keyboard_default = trans;
+       keyboard_default_kbmaps = kbmaps;
 }
 
 int inputdevice_iskeymapped (int keyboard, int scancode)
index 198e0046a73ed4efdb1517c22ca67010edd53cee..48d575ae95113f42a17f756fa0f8a6cad98d01a0 100644 (file)
@@ -341,6 +341,15 @@ DEFEVENT(SPC_DISKSWAPPER_INSERT1,L"Insert disk in current Disk Swapper slot in D
 DEFEVENT(SPC_DISKSWAPPER_INSERT2,L"Insert disk in current Disk Swapper slot in DF2:",AM_K,0,0,AKS_DISKSWAPPER_INSERT2)
 DEFEVENT(SPC_DISKSWAPPER_INSERT3,L"Insert disk in current Disk Swapper slot in DF3:",AM_K,0,0,AKS_DISKSWAPPER_INSERT3)
 
+DEFEVENT(SPC_DISK_PREV0,L"Previous disk image in DF0:",AM_K,0,0,AKS_DISK_PREV0)
+DEFEVENT(SPC_DISK_PREV1,L"Previous disk image in DF1:",AM_K,0,0,AKS_DISK_PREV1)
+DEFEVENT(SPC_DISK_PREV2,L"Previous disk image in DF2:",AM_K,0,0,AKS_DISK_PREV2)
+DEFEVENT(SPC_DISK_PREV3,L"Previous disk image in DF3:",AM_K,0,0,AKS_DISK_PREV3)
+DEFEVENT(SPC_DISK_NEXT0,L"Next disk image in DF0:",AM_K,0,0,AKS_DISK_NEXT0)
+DEFEVENT(SPC_DISK_NEXT1,L"Next disk image in DF1:",AM_K,0,0,AKS_DISK_NEXT1)
+DEFEVENT(SPC_DISK_NEXT2,L"Next disk image in DF2:",AM_K,0,0,AKS_DISK_NEXT2)
+DEFEVENT(SPC_DISK_NEXT3,L"Next disk image in DF3:",AM_K,0,0,AKS_DISK_NEXT3)
+
 DEFEVENT(SPC_INPUT_CONFIG1,L"Select Input Configuration #1",AM_K,0,0,AKS_INPUT_CONFIG_1)
 DEFEVENT(SPC_INPUT_CONFIG2,L"Select Input Configuration #2",AM_K,0,0,AKS_INPUT_CONFIG_2)
 DEFEVENT(SPC_INPUT_CONFIG3,L"Select Input Configuration #3",AM_K,0,0,AKS_INPUT_CONFIG_3)
index 605ff1e224fbddc77c22832ee380e31676557b7c..5d3aa33e019f96e50f90a58b9ec19d7476ca4e99 100644 (file)
@@ -1046,10 +1046,7 @@ static void setupscenecoords (void)
 
        float sw = dw * tin_w / window_w + 0.5f;
        float sh = dh * tin_h / window_h + 0.5f;
-       MatrixScaling (&m_matWorld,
-               sw,
-               sh,
-               1.0f);
+       MatrixScaling (&m_matWorld, sw, sh, 1.0f);
 
        // ratio between Amiga texture and overlay texture
        maskmult.x = sw * maskmult_x / w;
@@ -1834,15 +1831,10 @@ void D3D_unlocktexture (void)
        if (locked)
                hr = texture->UnlockRect (0);
        locked = 0;
-
-       D3D_render2 ();
-       if (vsync2 && !currprefs.turbo_emulation)
-               D3D_render2 ();
 }
 
 uae_u8 *D3D_locktexture (int *pitch)
 {
-       static int frameskip;
        D3DLOCKED_RECT lock;
        HRESULT hr;
 
@@ -1850,9 +1842,6 @@ uae_u8 *D3D_locktexture (int *pitch)
                return NULL;
        if (!isd3d ())
                return NULL;
-       if (currprefs.turbo_emulation && isfullscreen () > 0 && frameskip-- > 0)
-               return NULL;
-       frameskip = 50;
 
        lock.pBits = NULL;
        lock.Pitch = 0;
@@ -1871,6 +1860,19 @@ uae_u8 *D3D_locktexture (int *pitch)
        return (uae_u8*)lock.pBits;
 }
 
+void D3D_flip (void)
+{
+       static int frameskip;
+       if (!isd3d ())
+               return;
+       if (currprefs.turbo_emulation && isfullscreen () > 0 && frameskip-- > 0)
+               return;
+       frameskip = 50;
+       D3D_render2 ();
+       if (vsync2 && !currprefs.turbo_emulation)
+               D3D_render2 ();
+}
+
 void D3D_refresh (void)
 {
        if (!isd3d ())
index 488240408162a6d3adee5c9f3ce525fd4c186f6a..dc1af060d61a2d60cac84654d3aa404ffde66533 100644 (file)
@@ -3,6 +3,7 @@ extern void D3D_free (void);
 extern const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth);
 extern void D3D_getpixelformat (int depth,int *rb, int *bb, int *gb, int *rs, int *bs, int *gs, int *ab, int *ar, int *a);
 extern void D3D_refresh (void);
+extern void D3D_flip (void);
 extern uae_u8 *D3D_locktexture(int*);
 extern void D3D_unlocktexture(void);
 extern void D3D_guimode (int guion);
index 2125e2c5b9284cb433058f5fef44d9f3edcc66dc..bdb5400dd80f9c211bc0abcb0d76865f087c27cd 100644 (file)
@@ -177,6 +177,13 @@ static struct uae_input_device_kbr_default keytrans[] = {
        { -1, 0 }
 };
 
+static int kb_np[] = { DIK_NUMPAD8, -1, DIK_NUMPAD4, -1, DIK_NUMPAD6, -1, DIK_NUMPAD2, -1, DIK_NUMPAD0, DIK_NUMPAD5, -1, DIK_DECIMAL, DIK_DIVIDE, DIK_NUMPADENTER, -1, -1 };
+static int kb_ck[] = { DIK_UP, -1, DIK_LEFT, -1, DIK_RIGHT, -1, DIK_DOWN, -1, DIK_RCONTROL, DIK_RMENU, -1, DIK_RSHIFT, -1, -1 };
+static int kb_se[] = { DIK_W, -1, DIK_A, -1, DIK_D, -1, DIK_S, -1, DIK_LMENU, -1, DIK_LSHIFT, -1, -1 };
+static int kb_empty[] = { -1, -1 };
+static int kb_cd32[] = { DIK_NUMPAD1, -1, DIK_NUMPAD3, -1, DIK_NUMPAD7, -1, DIK_NUMPAD9, -1, DIK_DIVIDE, -1, DIK_SUBTRACT, -1, DIK_MULTIPLY, -1, -1 };
+static int *kbmaps[] = { kb_np, kb_ck, kb_se, kb_empty, kb_empty, kb_cd32 };
+
 extern int ispressed (int key);
 
 static int specialkeycode (void)
@@ -409,9 +416,10 @@ void my_kbd_handler (int keyboard, int scancode, int newstate)
                case DIK_F5:
 #if 0
                        {
-                               extern int crap;
-                               crap++;
-                               write_log (L"%d\n", crap);
+                               disk_prevnext (0, -1);
+                               return;
+                               //crap++;
+                               //write_log (L"%d\n", crap);
                        }
 #endif
                        if (specialpressed ()) {
@@ -567,7 +575,7 @@ void my_kbd_handler (int keyboard, int scancode, int newstate)
 
 void keyboard_settrans (void)
 {
-       inputdevice_setkeytranslation (keytrans);
+       inputdevice_setkeytranslation (keytrans, kbmaps);
 }
 
 
index ca0e1022a781b292e84a784debba483d3d8affa8..e30fd9a245c5d5e16342e72ec878eb689afe1339 100644 (file)
 #define IDC_RTG_VBLANKRATE              1793
 #define IDC_DF0WPTEXTQ                  1793
 #define IDC_DF1WPTEXTQ                  1794
+#define IDC_INPUTENABLEGAMEPORTS        1796
 #define ID__FLOPPYDRIVES                40004
 #define ID_FLOPPYDRIVES_DF0             40005
 #define ID_ST_CONFIGURATION             40010
 #define _APS_3D_CONTROLS                     1
 #define _APS_NEXT_RESOURCE_VALUE        354
 #define _APS_NEXT_COMMAND_VALUE         40045
-#define _APS_NEXT_CONTROL_VALUE         1796
+#define _APS_NEXT_CONTROL_VALUE         1797
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
index 29de096600f8b7c278ac63e86768dd572273cb7d..5b5425826a5fa5ad9ed55e58576448eb75a6c0f5 100644 (file)
@@ -705,17 +705,17 @@ BEGIN
     CONTROL         "List1",IDC_INPUTLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,5,22,290,146\r
     COMBOBOX        IDC_INPUTAMIGACNT,5,174,24,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
     COMBOBOX        IDC_INPUTAMIGA,33,174,262,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "Joystick dead zone (%):",-1,7,196,79,10,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_INPUTDEADZONE,92,195,25,12,ES_NUMBER\r
-    RTEXT           "Autofire rate (frames):",-1,10,212,76,10,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_INPUTAUTOFIRERATE,92,210,25,12,ES_NUMBER\r
-    RTEXT           "Digital joy-mouse speed:",-1,124,196,84,10,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_INPUTSPEEDD,215,195,25,12,ES_NUMBER\r
-    RTEXT           "Analog joy-mouse speed:",-1,120,212,88,10,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_INPUTSPEEDA,215,211,25,12,ES_NUMBER\r
-    PUSHBUTTON      "Copy from:",IDC_INPUTCOPY,249,195,45,14\r
-    COMBOBOX        IDC_INPUTCOPYFROM,249,211,45,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "Swap 1<>2",IDC_INPUTSWAP,249,226,45,14\r
+    RTEXT           "Joystick dead zone (%):",-1,4,196,79,10,SS_CENTERIMAGE\r
+    EDITTEXT        IDC_INPUTDEADZONE,88,195,25,12,ES_NUMBER\r
+    RTEXT           "Autofire rate (frames):",-1,4,212,79,10,SS_CENTERIMAGE\r
+    EDITTEXT        IDC_INPUTAUTOFIRERATE,88,210,25,12,ES_NUMBER\r
+    RTEXT           "Digital joy-mouse speed:",-1,117,196,88,10,SS_CENTERIMAGE\r
+    EDITTEXT        IDC_INPUTSPEEDD,210,195,25,12,ES_NUMBER\r
+    RTEXT           "Analog joy-mouse speed:",-1,117,212,88,10,SS_CENTERIMAGE\r
+    EDITTEXT        IDC_INPUTSPEEDA,210,211,25,12,ES_NUMBER\r
+    PUSHBUTTON      "Copy from:",IDC_INPUTCOPY,240,195,56,14\r
+    COMBOBOX        IDC_INPUTCOPYFROM,240,211,55,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
+    PUSHBUTTON      "Swap 1<>2",IDC_INPUTSWAP,240,226,56,14\r
 END\r
 \r
 IDD_FILTER DIALOGEX 0, 0, 296, 241\r
@@ -1150,14 +1150,26 @@ IDB_LCD160X43           BITMAP                  "lcd.bmp"
 #ifdef APSTUDIO_INVOKED\r
 GUIDELINES DESIGNINFO\r
 BEGIN\r
+    IDD_CPU, DIALOG\r
+    BEGIN\r
+    END\r
+\r
     IDD_MISC1, DIALOG\r
     BEGIN\r
     END\r
 \r
+    IDD_INPUT, DIALOG\r
+    BEGIN\r
+    END\r
+\r
     IDD_FILTER, DIALOG\r
     BEGIN\r
         BOTTOMMARGIN, 237\r
     END\r
+\r
+    IDD_DISK, DIALOG\r
+    BEGIN\r
+    END\r
 END\r
 #endif    // APSTUDIO_INVOKED\r
 \r
index a77c2d4602a694ed576c2e1ec2c48bdd718ab397..5dce91d9017560e192a9536eb07f35c86ecaf859 100644 (file)
@@ -56,6 +56,12 @@ rm -rf release
 rm -rf fullrelease
 cd ..
 
+cd prowizard
+rm -rf debug
+rm -rf release
+rm -rf x64
+cd ..
+
 cd genlinetoscr_msvc
 rm -f genlinetoscr.exe
 rm -rf debug
index fa809256abd79752aa8d25bfe0df887ed1c66372..360de0c787ed77234d936f4bbdff980c50991da7 100644 (file)
@@ -4218,21 +4218,6 @@ static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR
        TCHAR **argv = NULL, **argv2 = NULL, **argv3;
        int argc, i;
 
-#if 0
-#ifdef _DEBUG
-       {
-               int tmp = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
-               //tmp &= 0xffff;
-               tmp |= _CRTDBG_CHECK_ALWAYS_DF;
-               tmp |= _CRTDBG_CHECK_CRT_DF;
-#ifdef MEMDEBUG
-               tmp |=_CRTDBG_CHECK_EVERY_16_DF;
-               tmp |= _CRTDBG_DELAY_FREE_MEM_DF;
-#endif
-               _CrtSetDbgFlag(tmp);
-       }
-#endif
-#endif
        if (!osdetect ())
                return 0;
        if (!dxdetect ())
@@ -4925,6 +4910,21 @@ int PASCAL wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdL
        DWORD_PTR sys_aff;
        HANDLE thread;
 
+#if 0
+#ifdef _DEBUG
+       {
+               int tmp = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
+               //tmp &= 0xffff;
+               tmp |= _CRTDBG_CHECK_ALWAYS_DF;
+               tmp |= _CRTDBG_CHECK_CRT_DF;
+#ifdef MEMDEBUG
+               tmp |=_CRTDBG_CHECK_EVERY_16_DF;
+               tmp |= _CRTDBG_DELAY_FREE_MEM_DF;
+#endif
+               _CrtSetDbgFlag(tmp);
+       }
+#endif
+#endif
        /* Make sure we do an InitCommonControls() to get some advanced controls */
        InitCommonControls ();
 
index b05631bfdc91d1adbe8268c54337d4bb7a9a52bb..9710d1e6e6f2b61ed0e6559915b61d526e73637a 100644 (file)
@@ -18,8 +18,8 @@
 #define WINUAEPUBLICBETA 1
 #define LANG_DLL 1
 
-#define WINUAEBETA L"15"
-#define WINUAEDATE MAKEBD(2010, 3, 6)
+#define WINUAEBETA L"16"
+#define WINUAEDATE MAKEBD(2010, 3, 10)
 #define WINUAEEXTRA L""
 #define WINUAEREV L""
 
index f5842561a945b0b54ff2b0f31fa03c63dc15dd06..2e3fbadc95bec94800c9ebe585b53d8e2b7b1039 100644 (file)
@@ -58,7 +58,6 @@
 
 #define DM_DX_FULLSCREEN 1
 #define DM_W_FULLSCREEN 2
-#define DM_OPENGL 8
 #define DM_D3D_FULLSCREEN 16
 #define DM_PICASSO96 32
 #define DM_DDRAW 64
@@ -153,7 +152,7 @@ int isfullscreen (void)
 
 int is3dmode (void)
 {
-       return currentmode->flags & (DM_D3D | DM_OPENGL);
+       return currentmode->flags & (DM_D3D);
 }
 
 int WIN32GFX_GetDepth (int real)
@@ -797,13 +796,10 @@ void flush_screen (int a, int b)
 {
        if (dx_islost ())
                return;
-       if (currentmode->flags & DM_OPENGL) {
-#ifdef OPENGL
-               OGL_render ();
-#endif
-       } else if (currentmode->flags & DM_D3D) {
+       if (currentmode->flags & DM_D3D) {
                if ((currentmode->flags & DM_SWSCALE) && usedfilter->type != UAE_FILTER_NULL)
                        S2X_render ();
+               D3D_flip ();
                return;
 #ifdef GFXFILTER
        } else if (currentmode->flags & DM_SWSCALE) {
@@ -860,7 +856,9 @@ void unlockscr (void)
        if (currentmode->flags & DM_D3D) {
                if ((currentmode->flags & DM_SWSCALE) && usedfilter->type != UAE_FILTER_NULL)
                        return;
+#ifdef D3D
                D3D_unlocktexture ();
+#endif
        } else if (currentmode->flags & DM_SWSCALE) {
                return;
        } else if (currentmode->flags & DM_DDRAW) {
@@ -1005,6 +1003,7 @@ void gfx_unlock_picasso (void)
 {
        if (currprefs.gfx_api) {
                D3D_unlocktexture ();
+               D3D_flip ();
        } else {
                DirectDraw_SurfaceUnlock ();
                if (p96_double_buffer_needs_flushing) {
@@ -1512,7 +1511,7 @@ void init_colors (void)
 #endif
        }
 
-       if (!(currentmode->flags & (DM_OPENGL|DM_D3D))) {
+       if (!(currentmode->flags & (DM_D3D))) {
                if (currentmode->current_depth != currentmode->native_depth) {
                        if (currentmode->current_depth == 16) {
                                red_bits = 5; green_bits = 6; blue_bits = 5;
@@ -2337,11 +2336,11 @@ static BOOL doInit (void)
                write_log (L"W=%d H=%d B=%d CT=%d\n",
                        DirectDraw_CurrentWidth (), DirectDraw_CurrentHeight (), DirectDraw_GetCurrentDepth (), colortype);
 
-               if (isfullscreen() <= 0 && !(currentmode->flags & (DM_OPENGL | DM_D3D))) {
+               if (isfullscreen() <= 0 && !(currentmode->flags & (DM_D3D))) {
                        currentmode->current_depth = DirectDraw_GetCurrentDepth ();
                        updatemodes ();
                }
-               if (!(currentmode->flags & (DM_OPENGL | DM_D3D)) && DirectDraw_GetCurrentDepth () == currentmode->current_depth) {
+               if (!(currentmode->flags & (DM_D3D)) && DirectDraw_GetCurrentDepth () == currentmode->current_depth) {
                        updatemodes ();
                }
 
@@ -2383,7 +2382,7 @@ static BOOL doInit (void)
 #endif
                        currentmode->native_depth = currentmode->current_depth;
 #if defined (GFXFILTER)
-                       if (currentmode->flags & (DM_OPENGL | DM_D3D | DM_SWSCALE)) {
+                       if (currentmode->flags & (DM_D3D | DM_SWSCALE)) {
                                currentmode->amiga_width = AMIGA_WIDTH_MAX << currprefs.gfx_resolution;
                                currentmode->amiga_height = AMIGA_HEIGHT_MAX << (currprefs.gfx_linedbl ? 1 : 0);
                                if (usedfilter) {
@@ -2432,7 +2431,7 @@ static BOOL doInit (void)
        gfxvidinfo.bufmem = NULL;
 
        if (!screen_is_picasso) {
-               if ((currentmode->flags & DM_DDRAW) && !(currentmode->flags & (DM_D3D | DM_SWSCALE | DM_OPENGL))) {
+               if ((currentmode->flags & DM_DDRAW) && !(currentmode->flags & (DM_D3D | DM_SWSCALE))) {
 
                        ;
 
@@ -2511,11 +2510,7 @@ void updatedisplayarea (void)
        if (picasso_on)
                return;
 #if defined (GFXFILTER)
-       if (currentmode->flags & DM_OPENGL) {
-#if defined (OPENGL)
-               OGL_refresh ();
-#endif
-       } else if (currentmode->flags & DM_D3D) {
+       if (currentmode->flags & DM_D3D) {
 #if defined (D3D)
                D3D_refresh ();
 #endif
index 205824d6bd8f015e7027ac1017bf29308b398b0f..1c2798fb8ef6d7e84e3acf627b39b9a7e5dcfbf8 100644 (file)
@@ -515,39 +515,51 @@ static int getcbn (HWND hDlg, int v, TCHAR *out, int len)
        }
 }
 
+
+struct favitems
+{
+       TCHAR *value;
+       TCHAR *path;
+       int type;
+};
+
 #define MAXFAVORITES 30
-static void writefavoritepaths (int num, TCHAR **values, TCHAR **paths)
+static void writefavoritepaths (int num, struct favitems *fitem)
 {
-       int i;
+       int i, idx;
        UAEREG *fkey;
 
        fkey = regcreatetree (NULL, L"FavoritePaths");
        if (fkey == NULL)
                return;
+       idx = 0;
        for (i = 0; i < num; i++) {
                TCHAR str[MAX_DPATH];
                TCHAR key[100];
-               if (!_tcscmp (values[i], paths[i]))
-                       _tcscpy (str, values[i]);
+               if (fitem[i].type != 1)
+                       continue;
+               if (!_tcscmp (fitem[i].value, fitem[i].path))
+                       _tcscpy (str, fitem[i].value);
                else
-                       _stprintf (str, L"%s \"%s\"", values[i], paths[i]);
-               _stprintf (key, L"PATH_ALL_%02d", i + 1);
+                       _stprintf (str, L"%s \"%s\"", fitem[i].value, fitem[i].path);
+               _stprintf (key, L"PATH_ALL_%02d", idx + 1);
+               idx++;
                regsetstr (fkey, key, str);
-               xfree (values[i]);
-               xfree (paths[i]);
+               xfree (fitem[i].value);
+               xfree (fitem[i].path);
        }
-       while (i < MAXFAVORITES) {
+       while (idx < MAXFAVORITES) {
                TCHAR key[100];
-               _stprintf (key, L"PATH_ALL_%02d", i + 1);
+               _stprintf (key, L"PATH_ALL_%02d", idx + 1);
                regdelete (fkey, key);
-               i++;
+               idx++;
        }
        regclosetree (fkey);
 }
 
 
 static int askinputcustom (HWND hDlg, TCHAR *custom, int maxlen, DWORD titleid);
-static int addfavoritepath (HWND hDlg, int num, TCHAR **values, TCHAR **paths)
+static int addfavoritepath (HWND hDlg, int num, struct favitems *fitem)
 {
        TCHAR name[MAX_DPATH];
        const GUID favoriteguid = 
@@ -577,29 +589,30 @@ static int addfavoritepath (HWND hDlg, int num, TCHAR **values, TCHAR **paths)
                return 0;
        _tcscpy (name, stored_path);
        if (askinputcustom (hDlg, name, sizeof name / sizeof (TCHAR), IDS_SB_FAVORITENAME)) {
-               values[num] = my_strdup (name);
-               paths[num] = my_strdup (stored_path);
+               fitem[num].value = my_strdup (name);
+               fitem[num].path = my_strdup (stored_path);
+               fitem[num].type = 1;
                num++;
-               writefavoritepaths (num, values, paths);
+               writefavoritepaths (num, fitem);
        }
        return 1;
 }
-static void removefavoritepath (int idx, int num, TCHAR **values, TCHAR **paths)
+static void removefavoritepath (int idx, int num, struct favitems *fitem)
 {
        int i;
 
-       xfree (values[idx]);
-       xfree (paths[idx]);
-       values[idx] = paths[idx] = NULL;
+       xfree (fitem[idx].value);
+       xfree (fitem[idx].path);
+       fitem[idx].value = fitem[idx].path = NULL;
        for (i = idx; i < num - 1; i++) {
-               values[i] = values[i + 1];
-               paths[i] = paths[i + 1];
+               fitem[i].value = fitem[i + 1].value;
+               fitem[i].path = fitem[i + 1].path;
        }
        num--;
-       writefavoritepaths (num, values, paths);
+       writefavoritepaths (num, fitem);
 }
 
-static void addeditmenu (HMENU menu, TCHAR **items)
+static void addeditmenu (HMENU menu, struct favitems *fitem)
 {
        int i;
        HMENU emenu = CreatePopupMenu ();
@@ -621,15 +634,17 @@ static void addeditmenu (HMENU menu, TCHAR **items)
        mii.wID = 1000;
        InsertMenuItem (emenu, -1, TRUE, &mii);
        i = 0;
-       while (items[i]) {
-               mii.fMask = MIIM_STRING | MIIM_ID;
-               mii.fType = MFT_STRING;
-               mii.fState = MFS_ENABLED;
-               mii.wID = 1001 + i;
-               _stprintf (newpath, L"Remove '%s'", items[i]);
-               mii.dwTypeData = newpath;
-               mii.cch = _tcslen (mii.dwTypeData);
-               InsertMenuItem (emenu, -1, TRUE, &mii);
+       while (fitem[i].type) {
+               if (fitem[i].type == 1) {
+                       mii.fMask = MIIM_STRING | MIIM_ID;
+                       mii.fType = MFT_STRING;
+                       mii.fState = MFS_ENABLED;
+                       mii.wID = 1001 + i;
+                       _stprintf (newpath, L"Remove '%s'", fitem[i].value);
+                       mii.dwTypeData = newpath;
+                       mii.cch = _tcslen (mii.dwTypeData);
+                       InsertMenuItem (emenu, -1, TRUE, &mii);
+               }
                i++;
        }
 
@@ -642,24 +657,52 @@ static void addeditmenu (HMENU menu, TCHAR **items)
        InsertMenuItem (menu, -1, TRUE, &mii);
 }
 
-static int popupmenu (HWND hwnd, TCHAR **items)
+static int popupmenu (HWND hwnd, struct favitems *items)
 {
-       int i, item;
+       int i, item, got;
        HMENU menu;
        POINT pt;
 
        menu = CreatePopupMenu ();
+       got = 0;
        i = 0;
-       while (items[i]) {
+       while (items[i].type) {
+               if (items[i].type == 2) {
+                       MENUITEMINFO mii = { 0 };
+                       mii.cbSize = sizeof mii;
+                       mii.fMask = MIIM_STRING | MIIM_ID;
+                       mii.fType = MFT_STRING;
+                       mii.fState = MFS_ENABLED;
+                       mii.wID = 1 + i;
+                       mii.dwTypeData = items[i].value;
+                       mii.cch = _tcslen (mii.dwTypeData);
+                       InsertMenuItem (menu, -1, TRUE, &mii);
+                       got = 1;
+               }
+               i++;
+       }
+       if (got) {
                MENUITEMINFO mii = { 0 };
                mii.cbSize = sizeof mii;
-               mii.fMask = MIIM_STRING | MIIM_ID;
-               mii.fType = MFT_STRING;
+
+               mii.fMask = MIIM_FTYPE;
+               mii.fType = MFT_SEPARATOR;
                mii.fState = MFS_ENABLED;
-               mii.wID = 1 + i;
-               mii.dwTypeData = items[i];
-               mii.cch = _tcslen (mii.dwTypeData);
                InsertMenuItem (menu, -1, TRUE, &mii);
+       }
+       i = 0;
+       while (items[i].type) {
+               if (items[i].type == 1) {
+                       MENUITEMINFO mii = { 0 };
+                       mii.cbSize = sizeof mii;
+                       mii.fMask = MIIM_STRING | MIIM_ID;
+                       mii.fType = MFT_STRING;
+                       mii.fState = MFS_ENABLED;
+                       mii.wID = 1 + i;
+                       mii.dwTypeData = items[i].value;
+                       mii.cch = _tcslen (mii.dwTypeData);
+                       InsertMenuItem (menu, -1, TRUE, &mii);
+               }
                i++;
        }
        addeditmenu (menu, items);
@@ -670,12 +713,11 @@ static int popupmenu (HWND hwnd, TCHAR **items)
        DestroyMenu (menu);
        return item;
 }
-static TCHAR *favoritepopup (HWND hwnd)
+static TCHAR *favoritepopup (HWND hwnd, int drive)
 {
        UAEREG *fkey;
        int idx, idx2;
-       TCHAR *values[MAXFAVORITES + 1];
-       TCHAR *paths[MAXFAVORITES + 1];
+       struct favitems fitem[MAXFAVORITES + 1];
        int ret, i, j, num;
 
        for (;;) {
@@ -710,8 +752,9 @@ static TCHAR *favoritepopup (HWND hwnd)
                                                str = my_strdup (tmp2);
                                                fname = my_strdup (tmp2);
                                        }
-                                       paths[idx2] = fname;
-                                       values[idx2] = str;
+                                       fitem[idx2].path = fname;
+                                       fitem[idx2].value = str;
+                                       fitem[idx2].type = 1;
                                }
                        }
                        idx++;
@@ -719,39 +762,81 @@ static TCHAR *favoritepopup (HWND hwnd)
                regclosetree (fkey);
                for (i = 0; i < idx; i++) {
                        for (j = i + 1; j < idx; j++) {
-                               if (_tcscmp (values[i], values[j]) > 0) {
-                                       TCHAR *tmp = values[i];
-                                       values[i] = values[j];
-                                       values[j] = tmp;
-                                       tmp = paths[i];
-                                       paths[i] = paths[j];
-                                       paths[j] = tmp;
+                               if (_tcscmp (fitem[i].value, fitem[j].value) > 0) {
+                                       struct favitems tmp;
+                                       memcpy (&tmp, &fitem[i], sizeof tmp);
+                                       memcpy (&fitem[i], &fitem[j], sizeof tmp);
+                                       memcpy (&fitem[j], &tmp, sizeof tmp);
+                               }
+                       }
+               }
+               fitem[idx].type = 0;
+
+               if (drive >= 0) {
+                       TCHAR name[MAX_DPATH];
+                       _tcscpy (name, currprefs.df[drive]);
+                       int previdx = idx;
+                       for (;;) {
+                               if (!disk_prevnext_name (name, 1))
+                                       break;
+                               for (i = previdx; i < idx; i++) {
+                                       if (!_tcsicmp (fitem[i].value, name))
+                                               break;
+                               }
+                               if (i < idx)
+                                       break;
+                               fitem[idx].value = my_strdup (name);
+                               fitem[idx].path = NULL;
+                               fitem[idx].type = 2;
+                               idx++;
+                               if (!_tcscmp (name, currprefs.df[drive]))
+                                       break;
+                       }
+                       for (i = previdx; i < idx; i++) {
+                               for (j = i + 1; j < idx; j++) {
+                                       if (_tcscmp (fitem[i].value, fitem[j].value) > 0) {
+                                               struct favitems tmp;
+                                               memcpy (&tmp, &fitem[i], sizeof tmp);
+                                               memcpy (&fitem[i], &fitem[j], sizeof tmp);
+                                               memcpy (&fitem[j], &tmp, sizeof tmp);
+                                       }
                                }
                        }
+                       fitem[idx].type = 0;
                }
-               values[idx] = NULL;
-               ret = popupmenu (hwnd, values);
+
+
+               ret = popupmenu (hwnd, fitem);
                if (ret == 0)
                        break;
-               if (ret <= idx)
+               if (ret <= idx) {
+                       if (fitem[ret - 1].type == 2) {
+                               _tcscpy (workprefs.df[drive], fitem[ret - 1].value);
+                               ret = 0;
+                       }
                        break;
+               }
                if (ret == 1000) {
-                       if (!addfavoritepath (hwnd, idx, values, paths)) {
+                       if (!addfavoritepath (hwnd, idx, fitem)) {
                                ret = 0;
                                break;
                        }
                } else if (ret > 1000) {
-                       removefavoritepath (ret - 1001, idx, values, paths);
+                       removefavoritepath (ret - 1001, idx, fitem);
                }
        }
        for (i = 0; i < idx; i++) {
-               xfree (values[i]);
+               xfree (fitem[i].value);
                if (i != ret - 1)
-                       xfree (paths[i]);
+                       xfree (fitem[i].path);
        }
        if (ret == 0)
                return NULL;
-       return paths[ret - 1];
+       return fitem[ret - 1].path;
+}
+static TCHAR *favoritepopup (HWND hwnd)
+{
+       return favoritepopup (hwnd, -1);
 }
 
 /* base Drag'n'Drop code borrowed from http://www.codeproject.com/listctrl/jianghong.asp */
@@ -4437,6 +4522,19 @@ static void testimage (HWND hDlg, int num)
 
 static INT_PTR CALLBACK FloppyDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
 static int diskselectmenu (HWND hDlg, WPARAM wParam);
+static void addallfloppies (HWND hDlg);
+
+static void setfloppytexts (HWND hDlg, int qs)
+{
+       SetDlgItemText (hDlg, IDC_DF0TEXT, workprefs.df[0]);
+       SetDlgItemText (hDlg, IDC_DF1TEXT, workprefs.df[1]);
+       SetDlgItemText (hDlg, IDC_DF2TEXT, workprefs.df[2]);
+       SetDlgItemText (hDlg, IDC_DF3TEXT, workprefs.df[3]);
+       SetDlgItemText (hDlg, IDC_DF0TEXTQ, workprefs.df[0]);
+       SetDlgItemText (hDlg, IDC_DF1TEXTQ, workprefs.df[1]);
+       if (!qs)
+               addallfloppies (hDlg);
+}
 
 static INT_PTR CALLBACK QuickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 {
@@ -4457,8 +4555,7 @@ static INT_PTR CALLBACK QuickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, L
                        pages[QUICKSTART_ID] = hDlg;
                        currentpage = QUICKSTART_ID;
                        enable_for_quickstart (hDlg);
-                       _tcscpy (df0, workprefs.df[0]);
-                       _tcscpy (df1, workprefs.df[1]);
+                       setfloppytexts (hDlg, true);
                        setmultiautocomplete (hDlg, ids);
                        doinit = 1;
                        break;
@@ -4479,6 +4576,7 @@ static INT_PTR CALLBACK QuickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, L
 
        case WM_CONTEXTMENU:
                diskselectmenu (hDlg, wParam);
+               setfloppytexts (hDlg, true);
                break;
 
        case WM_COMMAND:
@@ -9053,7 +9151,7 @@ static int diskselectmenu (HWND hDlg, WPARAM wParam)
                break;
        }
        if (num >= 0) {
-               TCHAR *s = favoritepopup (hDlg);
+               TCHAR *s = favoritepopup (hDlg, num);
                if (s) {
                        int num = id == IDC_DF0QQ ? 0 : 1;
                        TCHAR tmp[MAX_DPATH];
@@ -9112,22 +9210,19 @@ static INT_PTR CALLBACK FloppyDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA
                }
        case WM_USER:
                recursive++;
-               SetDlgItemText (hDlg, IDC_DF0TEXT, workprefs.df[0]);
-               SetDlgItemText (hDlg, IDC_DF1TEXT, workprefs.df[1]);
-               SetDlgItemText (hDlg, IDC_DF2TEXT, workprefs.df[2]);
-               SetDlgItemText (hDlg, IDC_DF3TEXT, workprefs.df[3]);
-               SetDlgItemText (hDlg, IDC_DF0TEXTQ, workprefs.df[0]);
-               SetDlgItemText (hDlg, IDC_DF1TEXTQ, workprefs.df[1]);
+               setfloppytexts (hDlg, false);
                SetDlgItemText (hDlg, IDC_CREATE_NAME, diskname);
                SendDlgItemMessage (hDlg, IDC_FLOPPYSPD, TBM_SETPOS, TRUE,
                        workprefs.floppy_speed ? exact_log2 ((workprefs.floppy_speed) / 100) + 1 : 0);
                out_floppyspeed (hDlg);
-               addallfloppies (hDlg);
                recursive--;
                break;
 
        case WM_CONTEXTMENU:
+               recursive++;
                diskselectmenu (hDlg, wParam);
+               setfloppytexts (hDlg, false);
+               recursive--;
                break;
 
        case WM_COMMAND:
@@ -10350,12 +10445,15 @@ static void init_inputdlg (HWND hDlg)
 
        SendDlgItemMessage (hDlg, IDC_INPUTCOPYFROM, CB_RESETCONTENT, 0, 0L);
        WIN32GUI_LoadUIString (IDS_INPUT_COPY_DEFAULT, buf, sizeof (buf) / sizeof (TCHAR));
+       SendDlgItemMessage (hDlg, IDC_INPUTCOPYFROM, CB_ADDSTRING, 0, (LPARAM)L"GamePorts");
        SendDlgItemMessage (hDlg, IDC_INPUTCOPYFROM, CB_ADDSTRING, 0, (LPARAM)buf);
        WIN32GUI_LoadUIString (IDS_INPUT_COPY_CUSTOM, buf, sizeof (buf) / sizeof (TCHAR));
        for (i = 0; i < 4; i++) {
                _stprintf (txt, buf, i + 1);
                SendDlgItemMessage (hDlg, IDC_INPUTCOPYFROM, CB_ADDSTRING, 0, (LPARAM)txt);
        }
+       SendDlgItemMessage (hDlg, IDC_INPUTCOPYFROM, CB_SETCURSEL, 0, 0);
+
 
        SendDlgItemMessage (hDlg, IDC_INPUTAMIGACNT, CB_RESETCONTENT, 0, 0L);
        for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) {
@@ -10531,7 +10629,13 @@ static void input_copy (HWND hDlg)
        LRESULT src = SendDlgItemMessage (hDlg, IDC_INPUTCOPYFROM, CB_GETCURSEL, 0, 0L);
        if (src == CB_ERR)
                return;
-       inputdevice_copy_single_config (&workprefs, (int)src, workprefs.input_selected_setting, input_selected_device);
+       int v = (int)src;
+       if (v == 0) {
+               inputdevice_mergeconfig (&workprefs);
+       } else if (v >= 1 && v <= 5) {
+               v--;
+               inputdevice_copy_single_config (&workprefs, v, workprefs.input_selected_setting, input_selected_device);
+       }
        init_inputdlg (hDlg);
 }
 #endif
index 51ab261a4d9524d1e45afa08599e574f07232298..022706d0586492706f3bb7b6ab39943f99b5b064 100644 (file)
@@ -116,7 +116,7 @@ int sampler_init (void)
 {
        if (!currprefs.parallel_sampler)
                return 0;
-       return 0;
+       return 1;
 }
 
 void sampler_free (void)