]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc0990b12.zip
authorToni Wilen <twilen@winuae.net>
Tue, 20 Jul 2004 10:28:03 +0000 (13:28 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:23:59 +0000 (21:23 +0200)
17 files changed:
akiko.c
cfgfile.c
cia.c
custom.c
include/inputdevice.h
include/memory.h
include/xwin.h
inputdevice.c
memory.c
od-win32/dinput.c
od-win32/resources/resource.h
od-win32/resources/winuae.rc
od-win32/win32.c
od-win32/win32.h
od-win32/win32gfx.c
od-win32/win32gui.c
zfile.c

diff --git a/akiko.c b/akiko.c
index 31f7f581956cd540e6a5440d95b97784d0cd8ba6..cfdeb81df3ce3e4abe9bdc9dccc6f99f6f312eb0 100755 (executable)
--- a/akiko.c
+++ b/akiko.c
@@ -359,6 +359,8 @@ static int sector_buffer_sector_1, sector_buffer_sector_2;
 static uae_u8 *sector_buffer_info_1, *sector_buffer_info_2;
 
 static int unitnum = -1;
+static int cdromok = 0;
+
 
 static uae_u8 frombcd (uae_u8 v)
 {
@@ -1251,6 +1253,22 @@ void akiko_lput (uaecptr addr, uae_u32 v)
 
 static uae_thread_id akiko_tid;
 
+static void akiko_cdrom_free (void)
+{
+    if (unitnum >= 0)
+       sys_cddev_close ();
+    unitnum = -1;
+    free (sector_buffer_1);
+    free (sector_buffer_2);
+    free (sector_buffer_info_1);
+    free (sector_buffer_info_2);
+    sector_buffer_1 = 0;
+    sector_buffer_2 = 0;
+    sector_buffer_info_1 = 0;
+    sector_buffer_info_2 = 0;
+    cdromok = 0;
+}
+
 void akiko_reset (void)
 {
     cdaudiostop ();
@@ -1268,6 +1286,7 @@ void akiko_reset (void)
            Sleep (10);
        akiko_thread_running = 0;
     }
+    akiko_cdrom_free ();
 }
 
 extern uae_u32 extendedkickmemory;
@@ -1291,23 +1310,10 @@ static void patchrom (void)
     write_log ("couldn't patch extended rom\n");
 }
 
-static int cdromok = 0;
-
 void akiko_free (void)
 {
     akiko_reset ();
-    if (unitnum >= 0)
-       sys_cddev_close ();
-    unitnum = -1;
-    free (sector_buffer_1);
-    free (sector_buffer_2);
-    free (sector_buffer_info_1);
-    free (sector_buffer_info_2);
-    sector_buffer_1 = 0;
-    sector_buffer_2 = 0;
-    sector_buffer_info_1 = 0;
-    sector_buffer_info_2 = 0;
-    cdromok = 0;
+    akiko_cdrom_free ();
 }
 
 int akiko_init (void)
index c0920e17aa19e5cf5e0ff83f68984c9a9826ddb2..932c58a16cd7a9289397741d760527e87d322678 100755 (executable)
--- a/cfgfile.c
+++ b/cfgfile.c
@@ -291,11 +291,11 @@ void save_options (FILE *f, struct uae_prefs *p, int type)
        int v = i == 0 ? p->jport0 : p->jport1;
         char tmp1[100], tmp2[50];
         if (v < JSEM_JOYS)
-           sprintf (tmp2, "kbd%d", v);
+           sprintf (tmp2, "kbd%d", v + 1);
        else if (v < JSEM_MICE)
-           sprintf (tmp2, "joy%d", v - JSEM_JOYS);
+           sprintf (tmp2, "joy%d", v - JSEM_JOYS + 1);
        else
-           sprintf (tmp2, "mouse%d", v - JSEM_MICE);
+           sprintf (tmp2, "mouse%d", v - JSEM_MICE + 1);
        sprintf (tmp1, "joyport%d=%s\n", i, tmp2);
        cfgfile_write (f, tmp1);
     }
@@ -717,12 +717,10 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value)
     if (strcmp (option, "joyport0") == 0 || strcmp (option, "joyport1") == 0) {
        int port = strcmp (option, "joyport0") == 0 ? 0 : 1;
        int start = -1;
-       int kbdl = 0;
        char *pp = 0;
        if (strncmp (value, "kbd", 3) == 0) {
            start = JSEM_KBDLAYOUT;
            pp = value + 3;
-           kbdl = 1;
        } else if (strncmp (value, "joy", 3) == 0) {
            start = JSEM_JOYS;
            pp = value + 3;
@@ -731,13 +729,15 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value)
            pp = value + 5;
        }
        if (pp) {
-           start += atol (pp);
-           if (kbdl && start > 0)
-               start--;
-           if (port)
-               p->jport1 = start;
-           else
-               p->jport0 = start;
+           int v = atol (pp);
+           if (start >= 0 && v > 0) {
+               v--;
+               start += v;
+               if (port)
+                   p->jport1 = start;
+               else
+                   p->jport0 = start;
+           }
        }
        return 1;
     }
@@ -1917,8 +1917,10 @@ void default_prefs (struct uae_prefs *p, int type)
        p->optcount[5] = 0;
     }
     p->gfx_framerate = 1;
-    p->gfx_width_win = p->gfx_width_fs = 800;
-    p->gfx_height_win = p->gfx_height_fs = 600;
+    p->gfx_width_fs = 800;
+    p->gfx_height_fs = 600;
+    p->gfx_width_win = 720;
+    p->gfx_height_win = 568;
     p->gfx_lores = 0;
     p->gfx_linedbl = 1;
     p->gfx_afullscreen = 0;
@@ -2110,8 +2112,8 @@ static int bip_a1000 (struct uae_prefs *p, int config, int compa, int romcheck)
 {
     int roms[4];
 
-    roms[0] = 23;
-    roms[1] = 24;
+    roms[0] = 24;
+    roms[1] = 23;
     roms[2] = -1;
     p->chipset_mask = 0;
     p->bogomem_size = 0;
diff --git a/cia.c b/cia.c
index 80506ed1982b6a8dd464441128c8620c5cd20835..a0af6062a3593fb45317d18c9f4112b165d35e21 100755 (executable)
--- a/cia.c
+++ b/cia.c
@@ -28,6 +28,7 @@
 #include "inputdevice.h"
 #include "zfile.h"
 #include "ar.h"
+#include "parallel.h"
 #ifdef CD32
 #include "akiko.h"
 #endif
index 3ff7276b783bf72a6bbd4d2ebae07c57954809ae..9d60e242a2ee0bfc6c633ad015420b9b47d65aef 100755 (executable)
--- a/custom.c
+++ b/custom.c
@@ -104,7 +104,6 @@ struct ev eventtab[ev_max];
 
 volatile frame_time_t vsynctime, vsyncmintime;
 
-int ievent_alive = 0;
 #ifdef JIT
 extern uae_u8* compiled_code;
 #endif
@@ -4218,8 +4217,6 @@ static void vsync_handler (void)
 
     init_hardware_frame ();
 
-    if (ievent_alive > 0)
-       ievent_alive--;
     if (timehack_alive > 0)
        timehack_alive--;
     inputdevice_vsync ();
@@ -4537,16 +4534,7 @@ void customreset (void)
 
     vpos = 0;
 
-    if (needmousehack ()) {
-#if 0
-       mousehack_set (mousehack_follow);
-#else
-       mousehack_set (mousehack_dontcare);
-#endif
-    } else {
-       mousehack_set (mousehack_normal);
-    }
-    ievent_alive = 0;
+    inputdevice_reset ();
     timehack_alive = 0;
 
     curr_sprite_entries = 0;
index 130a73ce540b1f28e5c814aacfa4485c8f689ca9..ddfb41d0bf11c9197cfeabce382c9e53d1cb36e9 100755 (executable)
@@ -75,18 +75,22 @@ INPUTEVENT_END
 };
 #undef DEFEVENT
 
-enum mousestate { mousehack_unknown, mousehack_normal, mousehack_dontcare, mousehack_follow };
-
 extern void handle_cd32_joystick_cia (uae_u8, uae_u8);
 extern uae_u8 handle_parport_joystick (int port, uae_u8 pra, uae_u8 dra);
 extern uae_u8 handle_joystick_buttons (uae_u8);
 extern int getbuttonstate (int joy, int button);
 extern int getjoystate (int joy);
 
+enum mousestate { mousehack_unknown, mousehack_normal, mousehack_dontcare, mousehack_follow };
+
 extern void mousehack_set (enum mousestate);
 extern int mousehack_get (void);
 extern uae_u32 mousehack_helper (void);
 extern void mousehack_handle (int sprctl, int sprpos);
+extern int needmousehack (void);
+extern void togglemouse (void);
+extern int mousehack_alive (void);
+extern int mousehack_allowed (void);
 
 extern void setmousebuttonstateall (int mouse, uae_u32 buttonbits, uae_u32 buttonmask);
 extern void setjoybuttonstateall (int joy, uae_u32 buttonbits, uae_u32 buttonmask);
@@ -112,6 +116,7 @@ extern uae_u16 JOY1DAT (void);
 
 extern void inputdevice_vsync (void);
 extern void inputdevice_hsync (void);
+extern void inputdevice_reset (void);
 
 extern void write_inputdevice_config (struct uae_prefs *p, FILE *f);
 extern void read_inputdevice_config (struct uae_prefs *p, char *option, char *value);
@@ -121,7 +126,7 @@ extern void inputdevice_init (void);
 extern void inputdevice_close (void);
 extern void inputdevice_default_prefs (struct uae_prefs *p);
 
-extern void inputdevice_acquire (int);
+extern void inputdevice_acquire (void);
 extern void inputdevice_unacquire (void);
 
 extern void indicator_leds (int num, int state);
@@ -145,3 +150,4 @@ extern int compatibility_device[2];
 extern int jsem_isjoy (int port, struct uae_prefs *p);
 extern int jsem_ismouse (int port, struct uae_prefs *p);
 extern int jsem_iskbdjoy (int port, struct uae_prefs *p);
+
index 485d9b25156a7d756dd70bd6d073788d7632e987..a244ce8356e8af00dba3340e5ae7093353a1f894 100755 (executable)
@@ -257,6 +257,7 @@ struct romdata {
 extern struct romdata *getromdatabycrc (uae_u32 crc32);
 extern struct romdata *getromdatabydata (uae_u8 *rom, int size);
 extern struct romdata *getromdatabyid (int id);
+extern struct romdata *getromdatabyzfile (struct zfile *f);
 extern void getromname (struct romdata*, char*);
 extern struct romdata *getromdatabyname (char*);
 extern void romlist_add (char *path, struct romdata *rd);
index 81f71843c5ddf50d42267db87f2b00072197667e..659c7dbd0f71fc9d61441281af178c95b1137b0e 100755 (executable)
@@ -12,11 +12,6 @@ typedef int (*allocfunc_type)(int, int, int, xcolnr *);
 
 extern xcolnr xcolors[4096];
 
-extern int buttonstate[3];
-extern int newmousecounters;
-extern int lastmx, lastmy;
-extern int ievent_alive;
-
 extern int graphics_setup (void);
 extern int graphics_init (void);
 extern void graphics_leave (void);
@@ -33,8 +28,6 @@ extern int lockscr (void);
 extern void unlockscr (void);
 
 extern int debuggable (void);
-extern int needmousehack (void);
-extern void togglemouse (void);
 extern void LED (int);
 extern void screenshot (int);
 
index d9bd31a04147c8026e12fa4cffd57a2a0c70fa23..05e6f494b72218319bfa31c64c6bbf432918e604 100755 (executable)
@@ -479,6 +479,7 @@ static int lastsampledmx, lastsampledmy;
 static int lastspr0x,lastspr0y,lastdiffx,lastdiffy,spr0pos,spr0ctl;
 static int mstepx,mstepy,xoffs=defxoffs,yoffs=defyoffs;
 static int sprvbfl;
+static int ievent_alive = 0;
 
 static enum mousestate mousestate;
 
@@ -500,7 +501,6 @@ static void mousehack_setdontcare (void)
 {
     if (mousestate == mousehack_dontcare)
        return;
-
     write_log ("Don't care mouse mode set\n");
     mousestate = mousehack_dontcare;
     lastspr0x = lastmx; lastspr0y = lastmy;
@@ -511,6 +511,10 @@ static void mousehack_setfollow (void)
 {
     if (mousestate == mousehack_follow)
        return;
+    if (!mousehack_allowed ()) {
+       mousehack_set (mousehack_normal);
+       return;
+    }
     write_log ("Follow sprite mode set\n");
     mousestate = mousehack_follow;
     lastdiffx = lastdiffy = 0;
@@ -521,6 +525,8 @@ static void mousehack_setfollow (void)
 
 void mousehack_set (int state)
 {
+    int oldstate = mousestate;
+
     switch (state)
     {
        case mousehack_dontcare:
@@ -533,6 +539,9 @@ void mousehack_set (int state)
        mousestate = state;
        break;
     }
+    if ((oldstate == mousehack_follow && state != mousehack_follow) ||
+       (oldstate != mousehack_follow && state == mousehack_follow))
+        inputdevice_acquire ();
 }
 
 int mousehack_get (void)
@@ -540,6 +549,11 @@ int mousehack_get (void)
     return mousestate;
 }
 
+int mousehack_alive (void)
+{
+    return ievent_alive > 0;
+}
+
 uae_u32 mousehack_helper (void)
 {
     int mousexpos, mouseypos;
@@ -562,8 +576,12 @@ uae_u32 mousehack_helper (void)
        return ievent_alive ? -1 : needmousehack ();
     case 1:
        ievent_alive = 10;
+       if (!mousehack_allowed ())
+           return 0;
        return mousexpos;
     case 2:
+       if (!mousehack_allowed ())
+           return 0;
        return mouseypos;
     }
     return 0;
@@ -835,11 +853,22 @@ uae_u8 handle_parport_joystick (int port, uae_u8 pra, uae_u8 dra)
 uae_u8 handle_joystick_buttons (uae_u8 dra)
 {
     uae_u8 but = 0;
-    if (!getbuttonstate (0, JOYBUTTON_1) && !getbuttonstate (0, JOYBUTTON_CD32_RED))
-        but |= 0x40;
-    if (!getbuttonstate (1, JOYBUTTON_1) && !getbuttonstate (1, JOYBUTTON_CD32_RED))
-        but |= 0x80;
-    //write_log("%02.2X %02.2X %08.8X\n", but, dra, m68k_getpc());
+    int i;
+    
+    for (i = 0; i < 2; i++) {
+        if (cd32_pad_enabled[i]) {
+           uae_u16 p5dir = 0x0200 << (i * 4);
+           uae_u16 p5dat = 0x0100 << (i * 4);
+           but |= 0x40 << i;
+           /* Red button is connected to fire when p5 is 1 or floating */
+           if (!(potgo_value & p5dir) || ((potgo_value & p5dat) && (potgo_value & p5dir))) {
+               if (getbuttonstate (i, JOYBUTTON_CD32_RED))
+                   but &= ~(0x40 << i);
+           }
+       } else if (!getbuttonstate (i, JOYBUTTON_1)) {
+           but |= 0x40 << i;
+       }
+    }
     return but;
 }
 
@@ -847,54 +876,23 @@ uae_u8 handle_joystick_buttons (uae_u8 dra)
 void handle_cd32_joystick_cia (uae_u8 pra, uae_u8 dra)
 {
     static int oldstate[2];
-    if ((dra & 0x80) && (pra & 0x80) != oldstate[1]) {
-       if (!(pra & 0x80))
-           cd32_shifter[1]--;
-       if (cd32_shifter[1] < 0)
-           cd32_shifter[1] = 8;
-       oldstate[1] = pra & 0x80;
-    }
-    if ((dra & 0x40) && (pra & 0x40) != oldstate[0]) {
-       if (!(pra & 0x40))
-           cd32_shifter[0]--;
-       if (cd32_shifter[0] < 0)
-           cd32_shifter[0] = 8;
-       oldstate[0] = pra & 0x40;
-    }
-}
-
-/* joystick port 1 button 3 is used as a output for clearing shift register */
-static void handle_cd32_joystick_potgo (uae_u16 potgo)
-{
-
-    if (potgo & 0x2000) {
-        if (!(potgo & 0x1000))
-           cd32_shifter[1] = 8;
-    }
-    if (potgo & 0x0200) {
-        if (!(potgo & 0x0100))
-           cd32_shifter[0] = 8;
-    }
-#if 0
-    int v;
-    static int oldstate[2];
-    if (potgo & 0x2000) {
-       v = potgo & 0x1000;
-       if (v != oldstate[1]) {
-           if (v == 0x0000)
-               cd32_shifter[1] = 8;
-           oldstate[1] = v;
-       }
-    }
-    if (potgo & 0x0200) {
-       v = potgo & 0x0100;
-       if (v != oldstate[0]) {
-           if (v == 0x0000)
-               cd32_shifter[0] = 8;
-           oldstate[0] = v;
+    int i; 
+    
+    for (i = 0; i < 2; i++) {
+       uae_u8 but = 0x40 << i;
+       uae_u16 p5dir = 0x0200 << (i * 4); /* output enable P5 */
+       uae_u16 p5dat = 0x0100 << (i * 4); /* data P5 */
+       if (!(potgo_value & p5dir) || !(potgo_value & p5dat)) {
+           if ((dra & but) && (pra & but) != oldstate[i]) {
+               if (!(pra & but)) {
+                   cd32_shifter[i]--;
+                   if (cd32_shifter[i] < 0)
+                       cd32_shifter[i] = 0;
+               }
+           }
        }
+       oldstate[i] = pra & but;
     }
-#endif
 }
 
 /* joystick port 1 button 2 is input for button state */
@@ -903,43 +901,49 @@ static uae_u16 handle_joystick_potgor (uae_u16 potgor)
     int i;
 
     for (i = 0; i < 2; i++) {
-       uae_u16 mask8 = 0x0800 << (i * 4);
-       uae_u16 mask4 = 0x0400 << (i * 4);
-       uae_u16 mask2 = 0x0200 << (i * 4);
-       uae_u16 mask1 = 0x0100 << (i * 4);
+       uae_u16 p9dir = 0x0800 << (i * 4); /* output enable P9 */
+       uae_u16 p9dat = 0x0400 << (i * 4); /* data P9 */
+       uae_u16 p5dir = 0x0200 << (i * 4); /* output enable P5 */
+       uae_u16 p5dat = 0x0100 << (i * 4); /* data P5 */
 
        if (mouse_port[i]) {
            /* mouse has pull-up resistors in button lines */
-           if (!(potgor & mask2))
-               potgor |= mask1;
-           if (!(potgor & mask8))
-               potgor |= mask4;
+           if (!(potgo_value & p5dir))
+               potgor |= p5dir;
+           if (!(potgo_value & p9dir))
+               potgor |= p9dat;
        }
         if (potgo_hsync < 0) {
            /* first 10 or so lines after potgo has started
             * forces input-lines to zero
             */
-           if (!(potgor & mask2))
-               potgor &= ~mask1;
-           if (!(potgor & mask8))
-               potgor &= ~mask4;
+           if (!(potgo_value & p5dir))
+               potgor &= ~p5dir;
+           if (!(potgo_value & p9dir))
+               potgor &= ~p9dat;
        }
 
        if (cd32_pad_enabled[i]) {
-           if (!(potgor & mask8))
-               potgor |= mask4;
-           if (!(potgor & mask1) || !(potgor & mask8)) {
-               if (cd32_shifter[i] <= 0)
-                   potgor &= ~mask4;
-               if (cd32_shifter[i] >= 2 && (joybutton[i] & ((1 << JOYBUTTON_CD32_PLAY) << (cd32_shifter[i] - 2))))
-                   potgor &= ~mask4;
-           }
+           /* p5 is floating in input-mode */
+           potgor &= ~p5dat;
+           potgor |= potgo_value & p5dat;
+           if (!(potgo_value & p9dir))
+               potgor |= p9dat;
+           /* P5 output and 1 -> shift register is kept reset (Blue button) */
+           if ((potgo_value & p5dir) && (potgo_value & p5dat))
+               cd32_shifter[i] = 8;
+           /* shift at zero == return one, >1 = return button states */
+           if (cd32_shifter[i] == 0)
+               potgor &= ~p9dat; /* shift at one == return zero */
+           if (cd32_shifter[i] >= 2 && (joybutton[i] & ((1 << JOYBUTTON_CD32_PLAY) << (cd32_shifter[i] - 2))))
+               potgor &= ~p9dat;
+           //write_log ("%d:%04.4X %08.8X\n", cd32_shifter[i], potgor, m68k_getpc());
        } else {
            if (getbuttonstate (i, JOYBUTTON_3))
-               potgor &= ~mask1;
+               potgor &= ~p5dir;
+           if (getbuttonstate (i, JOYBUTTON_2))
+               potgor &= ~p9dat;
        }
-       if (getbuttonstate (i, JOYBUTTON_2) || getbuttonstate (i, JOYBUTTON_CD32_BLUE))
-           potgor &= ~mask4;
     }
     return potgor;
 }
@@ -1029,11 +1033,18 @@ void POTGO (uae_u16 v)
            potgo_value |= v & data;
        }
     }
+    for (i = 0; i < 2; i++) {
+       if (cd32_pad_enabled[i]) {
+           uae_u16 p5dir = 0x0200 << (i * 4); /* output enable P5 */
+           uae_u16 p5dat = 0x0100 << (i * 4); /* data P5 */
+           if ((potgo_value & p5dir) && (potgo_value & p5dat))
+               cd32_shifter[i] = 8;
+       }
+    }
     if (v & 1) {
        potdats[0] = potdats[1] = 0;
        potgo_hsync = -15;
     }
-    handle_cd32_joystick_potgo (v);
 }
 
 uae_u16 POTGOR (void)
@@ -1363,6 +1374,17 @@ void inputdevice_vsync (void)
     input_read = 1;
     input_vpos = 0;
     inputdevice_handle_inputcode ();
+    if (ievent_alive > 0)
+       ievent_alive--;
+}
+
+void inputdevice_reset (void)
+{
+    if (needmousehack ())
+       mousehack_set (mousehack_dontcare);
+    else
+       mousehack_set (mousehack_normal);
+    ievent_alive = 0;
 }
 
 static void setbuttonstateall (struct uae_input_device *id, struct uae_input_device2 *id2, int button, int state)
@@ -1519,6 +1541,19 @@ static void scanevents(struct uae_prefs *p)
     }
 }
 
+#ifdef CD32
+static void setcd32 (int joy, int n)
+{
+    joysticks[joy].eventid[ID_BUTTON_OFFSET + 0][0] = n ? INPUTEVENT_JOY2_CD32_RED : INPUTEVENT_JOY1_CD32_RED;
+    joysticks[joy].eventid[ID_BUTTON_OFFSET + 1][0] = n ? INPUTEVENT_JOY2_CD32_BLUE : INPUTEVENT_JOY1_CD32_BLUE;
+    joysticks[joy].eventid[ID_BUTTON_OFFSET + 2][0] = n ? INPUTEVENT_JOY2_CD32_YELLOW : INPUTEVENT_JOY1_CD32_YELLOW;
+    joysticks[joy].eventid[ID_BUTTON_OFFSET + 3][0] = n ? INPUTEVENT_JOY2_CD32_GREEN : INPUTEVENT_JOY1_CD32_GREEN;
+    joysticks[joy].eventid[ID_BUTTON_OFFSET + 4][0] = n ? INPUTEVENT_JOY2_CD32_FFW : INPUTEVENT_JOY1_CD32_FFW;
+    joysticks[joy].eventid[ID_BUTTON_OFFSET + 5][0] = n ? INPUTEVENT_JOY2_CD32_RWD : INPUTEVENT_JOY1_CD32_RWD;
+    joysticks[joy].eventid[ID_BUTTON_OFFSET + 6][0] = n ? INPUTEVENT_JOY2_CD32_PLAY :  INPUTEVENT_JOY1_CD32_PLAY;
+}
+#endif
+
 int compatibility_device[2];
 static void compatibility_mode (struct uae_prefs *prefs)
 {
@@ -1559,27 +1594,16 @@ static void compatibility_mode (struct uae_prefs *prefs)
        joysticks[joy].eventid[ID_AXIS_OFFSET + 0][0] = INPUTEVENT_JOY2_HORIZ;
         joysticks[joy].eventid[ID_AXIS_OFFSET + 1][0] = INPUTEVENT_JOY2_VERT;
        used[joy] = 1;
+       joysticks[joy].eventid[ID_BUTTON_OFFSET + 0][0] = INPUTEVENT_JOY2_FIRE_BUTTON;
+       joysticks[joy].eventid[ID_BUTTON_OFFSET + 1][0] = INPUTEVENT_JOY2_2ND_BUTTON;
+       joysticks[joy].eventid[ID_BUTTON_OFFSET + 2][0] = INPUTEVENT_JOY2_3RD_BUTTON;
 #ifdef CD32
-       if (cd32_enabled) {
-           joysticks[joy].eventid[ID_BUTTON_OFFSET + 0][0] = INPUTEVENT_JOY2_FIRE_BUTTON;
-           joysticks[joy].eventid[ID_BUTTON_OFFSET + 1][0] = INPUTEVENT_JOY2_CD32_RED;
-           joysticks[joy].eventid[ID_BUTTON_OFFSET + 2][0] = INPUTEVENT_JOY2_CD32_BLUE;
-           joysticks[joy].eventid[ID_BUTTON_OFFSET + 3][0] = INPUTEVENT_JOY2_CD32_YELLOW;
-           joysticks[joy].eventid[ID_BUTTON_OFFSET + 4][0] = INPUTEVENT_JOY2_CD32_GREEN;
-           joysticks[joy].eventid[ID_BUTTON_OFFSET + 5][0] = INPUTEVENT_JOY2_CD32_FFW;
-           joysticks[joy].eventid[ID_BUTTON_OFFSET + 6][0] = INPUTEVENT_JOY2_CD32_RWD;
-           joysticks[joy].eventid[ID_BUTTON_OFFSET + 7][0] = INPUTEVENT_JOY2_CD32_PLAY;
-       } else {
-#endif
-           joysticks[joy].eventid[ID_BUTTON_OFFSET + 0][0] = INPUTEVENT_JOY2_FIRE_BUTTON;
-           joysticks[joy].eventid[ID_BUTTON_OFFSET + 1][0] = INPUTEVENT_JOY2_2ND_BUTTON;
-           joysticks[joy].eventid[ID_BUTTON_OFFSET + 2][0] = INPUTEVENT_JOY2_3RD_BUTTON;
-#ifdef CD32
-       }
+       if (cd32_enabled)
+           setcd32 (joy, 1);
 #endif
        joysticks[joy].enabled = 1;
     }
-   
+
     joy = jsem_isjoy (0, prefs);
     if (joy >= 0) {
        used[joy] = 1;
@@ -1609,6 +1633,10 @@ static void compatibility_mode (struct uae_prefs *prefs)
        joysticks[joy].eventid[ID_BUTTON_OFFSET + 0][0] = INPUTEVENT_JOY2_FIRE_BUTTON;
        joysticks[joy].eventid[ID_BUTTON_OFFSET + 1][0] = INPUTEVENT_JOY2_2ND_BUTTON;
        joysticks[joy].eventid[ID_BUTTON_OFFSET + 2][0] = INPUTEVENT_JOY2_3RD_BUTTON;
+#ifdef CD32
+       if (cd32_enabled)
+           setcd32 (joy, 1);
+#endif
        joysticks[joy].enabled = 1;
        used[joy] = 1;
        compatibility_device[1] = joy;
@@ -2131,7 +2159,7 @@ void inputdevice_copy_single_config (struct uae_prefs *p, int src, int dst, int
        memcpy (p->keyboard_settings[dst], p->keyboard_settings[src], sizeof (struct uae_input_device) * MAX_INPUT_DEVICES);
 }
 
-void inputdevice_acquire (int exclusive)
+void inputdevice_acquire (void)
 {
     int i;
 
@@ -2263,7 +2291,7 @@ void setmousestate (int mouse, int axis, int data, int isabs)
        d = data - (int)(*oldm_p);
        *oldm_p = data;
        *mouse_p += d;
-       if (mouse == 0) {
+       if (mousehack_allowed () && needmousehack ()) {
            if (axis == 0)
                lastmx = data;
            else
index 4a85629be7d096cac32413fed6eaaee380a2e715..15d6d1ae8fada1bfd847eec317830b257f7aca99 100755 (executable)
--- a/memory.c
+++ b/memory.c
@@ -134,6 +134,87 @@ static struct romdata roms[] = {
     { 0 }
 };
 
+void decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size, uae_u8 *key, int keysize)
+{
+    long cnt, t;
+    for (t = cnt = 0; cnt < size; cnt++, t = (t + 1) % keysize)  {
+        mem[cnt] ^= key[t];
+        if (real_size == cnt + 1)
+           t = keysize - 1;
+    }
+}
+
+uae_u8 *load_keyfile (struct uae_prefs *p, char *path, int *size)
+{
+    struct zfile *f;
+    uae_u8 *keybuf = 0;
+    int keysize = 0;
+    char tmp[MAX_PATH];
+    tmp[0] = 0;
+    if (path)
+       strcpy (tmp, path);
+    strcat (tmp, "rom.key");
+    f = zfile_fopen (tmp, "rb");
+    if (!f) {
+       struct romdata *rd = getromdatabyid (0);
+        char *s = romlist_get (rd);
+        if (s)
+           f = zfile_fopen (s, "rb");
+       if (!f) {
+           strcpy (tmp, p->path_rom);
+           strcat (tmp, "rom.key");
+           f = zfile_fopen (tmp, "rb");
+           if (!f) {
+               f = zfile_fopen ("roms\\rom.key", "rb");
+               if (!f) {
+                   strcpy (tmp, start_path);
+                   strcat (tmp, "rom.key");
+                   f = zfile_fopen(tmp, "rb");
+                   if (!f) {
+                       strcpy (tmp, start_path);
+                       strcat (tmp, "..\\shared\\rom\\rom.key");
+                       f = zfile_fopen(tmp, "rb");
+                   }
+               }
+           }
+       }
+    }
+    if (f) {
+       zfile_fseek (f, 0, SEEK_END);
+       keysize = zfile_ftell (f);
+       if (keysize > 0) {
+           zfile_fseek (f, 0, SEEK_SET);
+           keybuf = xmalloc (keysize);
+           zfile_fread (keybuf, 1, keysize, f);
+       }
+       zfile_fclose (f);
+    }
+    *size = keysize;
+    return keybuf;
+}
+void free_keyfile (uae_u8 *key)
+{
+    xfree (key);
+}
+
+static int decode_cloanto_rom (uae_u8 *mem, int size, int real_size)
+{
+    uae_u8 *p;
+    int keysize;
+
+    p = load_keyfile (&currprefs, NULL, &keysize);
+    if (!p) {
+#ifndef SINGLEFILE
+       notify_user (NUMSG_NOROMKEY);
+#endif
+       return 0;
+    }
+    decode_cloanto_rom_do (mem, size, real_size, p, keysize);
+    free_keyfile (p);
+    return 1;
+}
+
 struct romdata *getromdatabyname (char *name)
 {
     char tmp[MAX_PATH];
@@ -174,7 +255,16 @@ struct romdata *getromdatabydata (uae_u8 *rom, int size)
     int i;
     uae_u32 crc32a, crc32b, crc32c;
     uae_u8 tmp[4];
-
+    uae_u8 *tmpbuf = NULL;
+
+    if (size > 11 && !memcmp (rom, "AMIROMTYPE1", 11)) {
+       uae_u8 *tmpbuf = xmalloc (size);
+       int tmpsize = size - 11;
+       memcpy (tmpbuf, rom + 11, tmpsize);
+       decode_cloanto_rom (tmpbuf, tmpsize, tmpsize);
+       rom = tmpbuf;
+       size = tmpsize;
+    }
     crc32a = get_crc32 (rom, size);
     crc32b = get_crc32 (rom, size / 2);
      /* ignore AR IO-port range until we have full dump */
@@ -190,9 +280,31 @@ struct romdata *getromdatabydata (uae_u8 *rom, int size)
            return &roms[i];
        i++;
     }
+    xfree (tmpbuf);
     return 0;
 }
 
+struct romdata *getromdatabyzfile (struct zfile *f)
+{
+    int pos, size;
+    uae_u8 *p;
+    struct romdata *rd;
+
+    pos = zfile_ftell (f);
+    zfile_fseek (f, 0, SEEK_END);
+    size = zfile_ftell (f);
+    p = xmalloc (size);
+    if (!p)
+       return 0;
+    memset (p, 0, size);
+    zfile_fseek (f, 0, SEEK_SET);
+    zfile_fread (p, 1, size, f);
+    zfile_fseek (f, pos, SEEK_SET);        
+    rd = getromdatabydata (p, size);
+    xfree (p);
+    return rd;
+}
+
 void getromname (struct romdata *rd, char *name)
 {
     strcpy (name, rd->name);
@@ -1111,87 +1223,6 @@ addrbank extendedkickmem_bank = {
     extendedkickmem_xlate, extendedkickmem_check, NULL
 };
 
-void decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size, uae_u8 *key, int keysize)
-{
-    long cnt, t;
-    for (t = cnt = 0; cnt < size; cnt++, t = (t + 1) % keysize)  {
-        mem[cnt] ^= key[t];
-        if (real_size == cnt + 1)
-           t = keysize - 1;
-    }
-}
-
-uae_u8 *load_keyfile (struct uae_prefs *p, char *path, int *size)
-{
-    struct zfile *f;
-    uae_u8 *keybuf = 0;
-    int keysize = 0;
-    char tmp[MAX_PATH];
-    tmp[0] = 0;
-    if (path)
-       strcpy (tmp, path);
-    strcat (tmp, "rom.key");
-    f = zfile_fopen (tmp, "rb");
-    if (!f) {
-       struct romdata *rd = getromdatabyid (0);
-        char *s = romlist_get (rd);
-        if (s)
-           f = zfile_fopen (s, "rb");
-       if (!f) {
-           strcpy (tmp, p->path_rom);
-           strcat (tmp, "rom.key");
-           f = zfile_fopen (tmp, "rb");
-           if (!f) {
-               f = zfile_fopen ("roms\\rom.key", "rb");
-               if (!f) {
-                   strcpy (tmp, start_path);
-                   strcat (tmp, "rom.key");
-                   f = zfile_fopen(tmp, "rb");
-                   if (!f) {
-                       strcpy (tmp, start_path);
-                       strcat (tmp, "..\\shared\\rom\\rom.key");
-                       f = zfile_fopen(tmp, "rb");
-                   }
-               }
-           }
-       }
-    }
-    if (f) {
-       zfile_fseek (f, 0, SEEK_END);
-       keysize = zfile_ftell (f);
-       if (keysize > 0) {
-           zfile_fseek (f, 0, SEEK_SET);
-           keybuf = xmalloc (keysize);
-           zfile_fread (keybuf, 1, keysize, f);
-       }
-       zfile_fclose (f);
-    }
-    *size = keysize;
-    return keybuf;
-}
-void free_keyfile (uae_u8 *key)
-{
-    xfree (key);
-}
-
-static int decode_cloanto_rom (uae_u8 *mem, int size, int real_size)
-{
-    uae_u8 *p;
-    int keysize;
-
-    p = load_keyfile (&currprefs, NULL, &keysize);
-    if (!p) {
-#ifndef SINGLEFILE
-       notify_user (NUMSG_NOROMKEY);
-#endif
-       return 0;
-    }
-    decode_cloanto_rom_do (mem, size, real_size, p, keysize);
-    free_keyfile (p);
-    return 1;
-}
-
 static int kickstart_checksum (uae_u8 *mem, int size)
 {
     uae_u32 cksum = 0, prevck = 0;
index 740a499f6f9bf7e08ee2122c38a1d1b8df4c6579..5a3765c1de89e09cf3c2d581af290d3f31fc0a47 100755 (executable)
@@ -81,7 +81,7 @@ static int dd_inited, mouse_inited, keyboard_inited, joystick_inited;
 static int stopoutput;
 static HANDLE kbhandle = INVALID_HANDLE_VALUE;
 static int oldleds, oldusedleds, newleds, usbledmode, oldusbleds;
-static int normalmouse, supermouse, rawmouse, winmouse, winmousenumber;
+static int normalmouse, supermouse, rawmouse, winmouse, winmousenumber, winmousemode;
 static int normalkb, superkb, rawkb;
 
 int no_rawinput;
@@ -92,6 +92,12 @@ int dinput_winmouse (void)
        return winmousenumber;
     return -1;
 }
+int dinput_winmousemode (void)
+{
+    if (winmouse)
+       return winmousemode;
+    return 0;
+}
 
 typedef BOOL (CALLBACK* REGISTERRAWINPUTDEVICES)
     (PCRAWINPUTDEVICE, UINT, UINT);
@@ -298,39 +304,43 @@ static int initialize_rawinput (void)
 static void initialize_windowsmouse (void)
 {
     struct didata *did = di_mouse;
-    char tmp[100];
-    int j;
+    char tmp[100], *name;
+    int i, j;
 
-    if (num_mouse >= MAX_INPUT_DEVICES)
-       return;
     did += num_mouse;
-    num_mouse++;
-    did->name = my_strdup ("Windows mouse");
-    did->sortname = my_strdup ("Windows mouse");
-    did->buttons = GetSystemMetrics (SM_CMOUSEBUTTONS);
-    if (did->buttons > 5)
-       did->buttons = 5; /* no non-direcinput support for >5 buttons */
-    if (did->buttons > 3 && !os_winnt)
-       did->buttons = 3; /* Windows 98/ME support max 3 non-DI buttons */
-    did->axles = GetSystemMetrics (SM_MOUSEWHEELPRESENT) ? 3 : 2;
-    did->axistype[0] = 1;
-    did->axissort[0] = 0;
-    did->axisname[0] = my_strdup ("X-Axis");
-    did->axistype[1] = 1;
-    did->axissort[1] = 1;
-    did->axisname[1] = my_strdup ("Y-Axis");
-    if (did->axles > 2) {
-       did->axistype[2] = 1;
-       did->axissort[2] = 2;
-       did->axisname[2] = my_strdup ("Wheel");
-    }
-    for (j = 0; j < did->buttons; j++) {
-        did->buttonsort[j] = j;
-        sprintf (tmp, "Button %d", j + 1);
-        did->buttonname[j] = my_strdup (tmp);
+    for (i = 0; i < 2; i++) {
+        if (num_mouse >= MAX_INPUT_DEVICES)
+           return;
+       num_mouse++;
+       name = (i == 0) ? "Windows mouse" : "Mousehack mouse";
+       did->name = my_strdup (i ? "Mousehack mouse" : "Windows mouse");
+       did->sortname = my_strdup (i ? "Windowsmouse2" : "Windowsmouse1");
+       did->buttons = GetSystemMetrics (SM_CMOUSEBUTTONS);
+       if (did->buttons > 5)
+           did->buttons = 5; /* no non-direcinput support for >5 buttons */
+       if (did->buttons > 3 && !os_winnt)
+           did->buttons = 3; /* Windows 98/ME support max 3 non-DI buttons */
+       did->axles = GetSystemMetrics (SM_MOUSEWHEELPRESENT) ? 3 : 2;
+       did->axistype[0] = 1;
+       did->axissort[0] = 0;
+       did->axisname[0] = my_strdup ("X-Axis");
+       did->axistype[1] = 1;
+       did->axissort[1] = 1;
+       did->axisname[1] = my_strdup ("Y-Axis");
+       if (did->axles > 2) {
+           did->axistype[2] = 1;
+           did->axissort[2] = 2;
+           did->axisname[2] = my_strdup ("Wheel");
+       }
+       for (j = 0; j < did->buttons; j++) {
+           did->buttonsort[j] = j;
+           sprintf (tmp, "Button %d", j + 1);
+           did->buttonname[j] = my_strdup (tmp);
+       }
+       did->priority = 2;
+       did->wininput = i + 1;
+       did++;
     }
-    did->priority = 2;
-    did->wininput = 1;
 }
 
 static void handle_rawinput_2 (RAWINPUT *raw)
@@ -841,12 +851,11 @@ static void close_mouse (void)
 static int acquire_mouse (int num, int flags)
 {
     LPDIRECTINPUTDEVICE8 lpdi = di_mouse[num].lpdi;
+    struct didata *did = &di_mouse[num];
     DIPROPDWORD dipdw;
     HRESULT hr;
 
     unacquire (lpdi, "mouse");
-    if (mousehack_get () == mousehack_follow)
-       return 0;
     if (lpdi) {
        setcoop (lpdi, flags ? (DISCL_FOREGROUND | DISCL_EXCLUSIVE) : (DISCL_BACKGROUND | DISCL_NONEXCLUSIVE), "mouse");
        dipdw.diph.dwSize = sizeof(DIPROPDWORD);
@@ -869,6 +878,7 @@ static int acquire_mouse (int num, int flags)
        else if (di_mouse[num].wininput) {
            winmouse++;
            winmousenumber = num;
+           winmousemode = di_mouse[num].wininput == 2;
        } else
            normalmouse++;
     }
@@ -939,13 +949,11 @@ static void read_mouse (void)
                            }
                        }
                    }
-                   if (i == 0 && dimofs == DIMOFS_BUTTON2 && state) {
-                       if (currprefs.win32_middle_mouse) {
-                           if (isfullscreen ())
-                               minimizewindow ();
-                           if (mouseactive)
-                               setmouseactive(0);
-                       }
+                   if (currprefs.win32_middle_mouse && dimofs == DIMOFS_BUTTON2 && state) {
+                       if (isfullscreen ())
+                           minimizewindow ();
+                       if (mouseactive)
+                           setmouseactive(0);
                    }
                }
            }
index 0339e3b41f317d0154df0b24167dd0714c995d35..a6887a172c96530a4d1fdf744ba4931bb67126bd 100755 (executable)
 #define IDS_ROMSCANNOROMS               324
 #define IDS_NUMSG_KICKREP               325
 #define IDS_NUMSG_KICKREPNO             326
-#define IDS_STRING19                    327
 #define IDS_NUMSG_NOROM                 327
 #define IDS_QS_MODELS                   1000
 #define IDS_QS_MODEL_A500               1001
 #define IDC_DF1Q                        1679
 #define IDC_QUICKSTART_HOSTCONFIG       1679
 #define IDC_DF1QQ                       1680
+#define IDC_DF1QQ2                      1681
+#define IDC_QUICKSTART_SETCONFIG        1681
 #define IDC_CONFIGAUTO                  1682
 #define IDC_DF0TEXTQ                    1683
 #define IDC_CONFIGNOLINK                1683
index 7c926618105ba3af67b2c92f22419cb9e027b447..a49857d1c5c284c1e1457968e7e9738278f3623e 100755 (executable)
@@ -946,6 +946,8 @@ BEGIN
     GROUPBOX        "Compatibility vs required CPU power ",
                     IDC_QUICKSTART_COMPA,3,56,294,33
     GROUPBOX        "Mode",IDC_STATIC,190,211,107,27,BS_LEFT
+    PUSHBUTTON      "Set Configuration",IDC_QUICKSTART_SETCONFIG,9,219,72,15,
+                    NOT WS_VISIBLE
 END
 
 
index a8867b93c7dfef2fe25dec50db1ce9ce275fd654..dbda486cfe7798047c300643ca4852df3e2156c8 100755 (executable)
@@ -359,19 +359,13 @@ static void setcursor(int oldx, int oldy)
     SetCursorPos (amigawin_rect.left + x, amigawin_rect.top + y);
 }
 
-static void movehackmouse (int x, int y)
-{
-    setmousestate (0, 0, x, 1);
-    setmousestate (0, 1, y, 1);
-}
-
 void setmouseactive (int active)
 {
     int oldactive = mouseactive;
     static int mousecapture, showcursor;
     char txt[100], txt2[110];
 
-    if (active > 0 && ievent_alive > 0) {
+    if (active > 0 && mousehack_allowed () && mousehack_alive ()) {
        mousehack_set (mousehack_follow);
        if (!isfullscreen ())
            return;
@@ -379,8 +373,6 @@ void setmouseactive (int active)
        mousehack_set (mousehack_dontcare);
     }
     inputdevice_unacquire ();
-    //mousehack_width = GetSystemMetrics (SM_CXVIRTUALSCREEN);
-    //mousehack_height = GetSystemMetrics (SM_CYVIRTUALSCREEN);
 
     mouseactive = active;
     strcpy (txt, "WinUAE");
@@ -415,7 +407,7 @@ void setmouseactive (int active)
            }
            setcursor (-1, -1);
        }
-       inputdevice_acquire (mouseactive);
+       inputdevice_acquire ();
     }
 }
 
@@ -478,9 +470,9 @@ static void winuae_active (HWND hWnd, int minimized)
     if (WIN32GFX_IsPicassoScreen ())
        WIN32GFX_EnablePicasso();
     getcapslock ();
-    inputdevice_acquire (mouseactive);
+    inputdevice_acquire ();
     wait_keyrelease ();
-    inputdevice_acquire (mouseactive);
+    inputdevice_acquire ();
     if (isfullscreen())
        setmouseactive (1);
     manual_palette_refresh_needed = 1;
@@ -602,12 +594,12 @@ static long FAR PASCAL AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
                break;
            }
            if (v != minimized) {
+               minimized = v;
                if (v)
                    winuae_inactive (hWnd, wParam == SIZE_MINIMIZED);
                else
                    winuae_active (hWnd, minimized);
            }
-           minimized = v;
            return 0;
        }
     }
@@ -625,6 +617,8 @@ static long FAR PASCAL AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
            return 0;
        } else if (LOWORD (wParam) == WA_INACTIVE) {
            minimized = 1;
+           if (isfullscreen ())
+               winuae_inactive (hWnd, minimized);
            if (ignorenextactivateapp > 0)
                ignorenextactivateapp--;
        } else if (!minimized && LOWORD (wParam) != WA_INACTIVE) {
@@ -641,6 +635,10 @@ static long FAR PASCAL AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
                exit_gui (0);
            setmouseactive (0);
        } else {
+           if (minimized) {
+               minimized = 0;
+               winuae_active (hWnd, minimized);
+           }   
            if (!ignorenextactivateapp && isfullscreen () && is3dmode ()) {
                WIN32GFX_DisplayChangeRequested ();
                ignorenextactivateapp = 3;
@@ -662,7 +660,7 @@ static long FAR PASCAL AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
     return 0;
 
     case WM_LBUTTONUP:
-       if (dinput_winmouse () > 0 || mousehack_get () == mousehack_follow)
+       if (dinput_winmouse () >= 0)
            setmousebuttonstate (dinput_winmouse(), 0, 0);
     return 0;
     case WM_LBUTTONDOWN:
@@ -670,42 +668,42 @@ static long FAR PASCAL AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
        if (!mouseactive && !isfullscreen()) {
            setmouseactive (1);
        }
-       if (dinput_winmouse () > 0 || mousehack_get () == mousehack_follow)
+       if (dinput_winmouse () >= 0)
            setmousebuttonstate (dinput_winmouse(), 0, 1);
     return 0;
     case WM_RBUTTONUP:
-       if (dinput_winmouse () > 0 || mousehack_get () == mousehack_follow)
+       if (dinput_winmouse () >= 0)
            setmousebuttonstate (dinput_winmouse(), 1, 0);
     return 0;
     case WM_RBUTTONDOWN:
     case WM_RBUTTONDBLCLK:
-       if (dinput_winmouse () > 0 || mousehack_get () == mousehack_follow)
+       if (dinput_winmouse () >= 0)
            setmousebuttonstate (dinput_winmouse(), 1, 1);
     return 0;
     case WM_MBUTTONUP:
-       if (dinput_winmouse () > 0 || mousehack_get () == mousehack_follow)
+       if (dinput_winmouse () >= 0)
            setmousebuttonstate (dinput_winmouse(), 2, 0);
     return 0;
     case WM_MBUTTONDOWN:
     case WM_MBUTTONDBLCLK:
-       if (dinput_winmouse () > 0 || mousehack_get () == mousehack_follow)
+       if (dinput_winmouse () >= 0)
            setmousebuttonstate (dinput_winmouse(), 2, 1);
     return 0;
     case WM_XBUTTONUP:
-       if (dinput_winmouse () > 0 || mousehack_get () == mousehack_follow) {
+       if (dinput_winmouse () >= 0) {
            handleXbutton (wParam, 0);
            return TRUE;
        }
     return 0;
     case WM_XBUTTONDOWN:
     case WM_XBUTTONDBLCLK:
-       if (dinput_winmouse () > 0 || mousehack_get () == mousehack_follow) {
+       if (dinput_winmouse () >= 0) {
            handleXbutton (wParam, 1);
            return TRUE;
        }
     return 0;
     case WM_MOUSEWHEEL:
-       if (dinput_winmouse () > 0 || mousehack_get () == mousehack_follow)
+       if (dinput_winmouse () >= 0)
            setmousestate (dinput_winmouse(), 2, ((short)HIWORD(wParam)), 0);
     return 0;
 
@@ -751,16 +749,21 @@ static long FAR PASCAL AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
     case WM_MOUSEMOVE:
         mx = (signed short) LOWORD (lParam);
         my = (signed short) HIWORD (lParam);
-       if (mousehack_get () == mousehack_follow) {
-           movehackmouse (mx, my);
-           return 0;
-       } else if (dinput_winmouse () > 0) {
-           int mxx = (amigawin_rect.right - amigawin_rect.left) / 2;
-           int myy = (amigawin_rect.bottom - amigawin_rect.top) / 2;
-           mx = mx - mxx;
-           my = my - myy;
-           setmousestate (dinput_winmouse (), 0, mx, 0);
-           setmousestate (dinput_winmouse (), 1, my, 0);
+       if (dinput_winmouse () >= 0) {
+           if (dinput_winmousemode ()) {
+               /* absolete + mousehack */
+               setmousestate (dinput_winmouse (), 0, mx, 1);
+               setmousestate (dinput_winmouse (), 1, my, 1);
+               return 0;
+           } else {
+               /* relative */
+               int mxx = (amigawin_rect.right - amigawin_rect.left) / 2;
+               int myy = (amigawin_rect.bottom - amigawin_rect.top) / 2;
+               mx = mx - mxx;
+               my = my - myy;
+               setmousestate (dinput_winmouse (), 0, mx, 0);
+               setmousestate (dinput_winmouse (), 1, my, 0);
+           }
         } else if ((!mouseactive && !isfullscreen())) {
            setmousestate (0, 0, mx, 1);
            setmousestate (0, 1, my, 1);
@@ -1452,6 +1455,10 @@ int needmousehack (void)
 {
     return 1;
 }
+int mousehack_allowed (void)
+{
+    return dinput_winmouse () > 0 && dinput_winmousemode ();
+}
 
 void logging_init( void )
 {
index c070d17e5a3ec0c93e22a7f520d36b560aef1c9c..f36d171cbfaa4ec89c4ae34e0a1c8a777d1d9fd5 100755 (executable)
@@ -81,6 +81,7 @@ extern void setpriority (struct threadpriorities *pri);
 
 extern int dinput_wmkey (uae_u32 key);
 extern int dinput_winmouse (void);
+extern int dinput_winmousemode (void);
 
 void systray (HWND hwnd, int remove);
 void systraymenu (HWND hwnd);
index 6a67559e7f9136e96cde353c2e97bd351f794b96..b06d77b37d7a31c952403550f8272e44aba3c048 100755 (executable)
@@ -1012,7 +1012,7 @@ int check_prefs_changed_gfx (void)
        init_hz ();
        pause_sound ();
        resume_sound ();
-       inputdevice_acquire (mouseactive);
+       inputdevice_acquire ();
        return 1;
     }
     if (currprefs.gfx_correct_aspect != changed_prefs.gfx_correct_aspect ||
@@ -1056,7 +1056,7 @@ int check_prefs_changed_gfx (void)
         currprefs.keyboard_leds_in_use = currprefs.keyboard_leds[0] | currprefs.keyboard_leds[1] | currprefs.keyboard_leds[2];
        pause_sound ();
        resume_sound ();
-       inputdevice_acquire (mouseactive);
+       inputdevice_acquire ();
 #ifndef _DEBUG
        setpriority (&priorities[currprefs.win32_active_priority]);
 #endif
@@ -1784,8 +1784,8 @@ static void setoverlay(void)
     dr.right -= mi.rcMonitor.left;
     dr.bottom -= mi.rcMonitor.top;
 
-    w = currentmode->current_width; // * (currprefs.gfx_filter_horiz_zoom + 100) / 100;
-    h = currentmode->current_height; // * (currprefs.gfx_filter_vert_zoom + 100) / 100;
+    w = currentmode->current_width;
+    h = currentmode->current_height;
 
     sr.left = 0;
     sr.top = 0;
index 1cae830f85e8fa6169dc4f5c81bee9358601f2ff..0a93d13dd4a19cf461b50e229ce03824f1cf184f 100755 (executable)
@@ -540,7 +540,7 @@ void gui_display( int shortcut )
     inputdevice_copyconfig (&changed_prefs, &currprefs);
     inputdevice_config_change_test ();
     clearallkeys ();
-    inputdevice_acquire (mouseactive);
+    inputdevice_acquire ();
 #ifdef CD32
     akiko_exitgui ();
 #endif
@@ -2435,6 +2435,7 @@ static void enable_for_quickstart (HWND hDlg)
 {
     int v = quickstart_ok && quickstart_ok_floppy ? TRUE : FALSE;
     EnableWindow (GetDlgItem (guiDlg, IDC_RESETAMIGA), !full_property_sheet ? TRUE : FALSE);
+    ShowWindow (GetDlgItem (hDlg, IDC_QUICKSTART_SETCONFIG), quickstart ? SW_HIDE : SW_SHOW);
 }
 
 static void load_quickstart (HWND hDlg, int romcheck)
@@ -2645,7 +2646,7 @@ static void testimage (HWND hDlg, int num)
        WIN32GUI_LoadUIString (messageid, tmp, sizeof (tmp));
        gui_message (tmp);
     }
-    if (reload) {
+    if (reload && quickstart) {
        load_quickstart (hDlg, 1);
        init_quickstartdlg (hDlg);
     }
@@ -2668,6 +2669,7 @@ static BOOL CALLBACK QuickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
        case WM_INITDIALOG:
            pages[QUICKSTART_ID] = hDlg;
            currentpage = QUICKSTART_ID;
+           enable_for_quickstart (hDlg);
            doinit = 1;
            break;
        case WM_NULL:
@@ -2678,7 +2680,6 @@ static BOOL CALLBACK QuickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
                addfloppytype (hDlg, 0);
                addfloppytype (hDlg, 1);
                init_quickstartdlg (hDlg);
-               enable_for_quickstart (hDlg);
            }
            doinit = 0;
            recursive--;
@@ -2705,7 +2706,8 @@ static BOOL CALLBACK QuickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
                    if (i != quickstart_model) {
                        quickstart_model = i;
                        init_quickstartdlg (hDlg);
-                       load_quickstart (hDlg, 1);
+                       if (quickstart)
+                           load_quickstart (hDlg, 1);
                        if (quickstart && !full_property_sheet)
                            qs_request_reset = 2;
                    }
@@ -2716,7 +2718,8 @@ static BOOL CALLBACK QuickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
                if (val != CB_ERR && val != quickstart_conf) {
                    quickstart_conf = val;
                    init_quickstartdlg (hDlg);
-                   load_quickstart (hDlg, 1);
+                   if (quickstart)
+                       load_quickstart (hDlg, 1);
                    if (quickstart && !full_property_sheet)
                        qs_request_reset = 2;
                }
@@ -2742,6 +2745,7 @@ static BOOL CALLBACK QuickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
                    init_quickstartdlg (hDlg);
                    load_quickstart (hDlg, 0);
                }
+               enable_for_quickstart (hDlg);
                break;
            }
        }
@@ -2757,7 +2761,10 @@ static BOOL CALLBACK QuickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
            case IDC_DF1QQ:
            ret = FloppyDlgProc (hDlg, msg, wParam, lParam);
            break;
-       }   
+           case IDC_QUICKSTART_SETCONFIG:
+           load_quickstart (hDlg, 1);
+           break;
+       }
        recursive--;
        case WM_HSCROLL:
        if (recursive > 0)
@@ -2767,7 +2774,8 @@ static BOOL CALLBACK QuickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
        if (val >= 0 && val != quickstart_compa) {
            quickstart_compa = val;
            init_quickstartdlg (hDlg);
-           load_quickstart (hDlg, 0);
+           if (quickstart)
+               load_quickstart (hDlg, 0);
        }
        recursive--;
        break;
@@ -5821,7 +5829,7 @@ static int joy1idc[] = {
     IDC_PORT1_JOYSC, IDC_PORT1_KBDA, IDC_PORT1_KBDB, IDC_PORT1_KBDC,
     IDC_PORT1_JOYS, -1
 };
-static int joy0previous = -1, joy1previous = -1;
+static int joy0previous, joy1previous;
 
 static BOOL bNoMidiIn = FALSE;
 
@@ -5875,24 +5883,27 @@ static void updatejoyport (HWND hDlg)
     }
     
     if (joy0previous < 0)
-       joy0previous = inputdevice_get_device_total (IDTYPE_JOYSTICK);
+       joy0previous = inputdevice_get_device_total (IDTYPE_JOYSTICK) + 1;
     if (joy1previous < 0)
-       joy1previous = 0;
+       joy1previous = 1;
     for (i = 0; i < 2; i++) {
+       int total = 0;
        int idx = i == 0 ? joy0previous : joy1previous;
        int id1 = i == 0 ? IDC_PORT0_JOYS : IDC_PORT1_JOYS;
        int id2 = i == 0 ? IDC_PORT0_JOYSC : IDC_PORT1_JOYSC;
        int v = i == 0 ? workprefs.jport0 : workprefs.jport1;
        SendDlgItemMessage (hDlg, id1, CB_RESETCONTENT, 0, 0L);
        SendDlgItemMessage (hDlg, id1, CB_ADDSTRING, 0, (LPARAM)"");
-        for (j = 0; j < inputdevice_get_device_total (IDTYPE_JOYSTICK); j++)
+        for (j = 0; j < inputdevice_get_device_total (IDTYPE_JOYSTICK); j++, total++)
            SendDlgItemMessage (hDlg, id1, CB_ADDSTRING, 0, (LPARAM)inputdevice_get_device_name(IDTYPE_JOYSTICK, j));
-        for (j = 0; j < inputdevice_get_device_total (IDTYPE_MOUSE); j++)
+        for (j = 0; j < inputdevice_get_device_total (IDTYPE_MOUSE); j++, total++)
            SendDlgItemMessage (hDlg, id1, CB_ADDSTRING, 0, (LPARAM)inputdevice_get_device_name(IDTYPE_MOUSE, j));
        if (v >= JSEM_MICE)
            idx = inputdevice_get_device_total (IDTYPE_JOYSTICK) + (v - JSEM_MICE) + 1;
        else if (v >= JSEM_JOYS)
            idx = v - JSEM_JOYS + 1;
+       if (idx >= total)
+           idx = 0;
        SendDlgItemMessage (hDlg, id1, CB_SETCURSEL, idx, 0);
     }
 }
@@ -6120,10 +6131,10 @@ static void init_portsdlg( HWND hDlg )
     int port, portcnt, numdevs;
     COMMCONFIG cc;
     DWORD size = sizeof(COMMCONFIG);
-
     MIDIOUTCAPS midiOutCaps;
     MIDIINCAPS midiInCaps;
 
+    joy0previous = joy1previous = -1;
     SendDlgItemMessage (hDlg, IDC_SERIAL, CB_RESETCONTENT, 0, 0L);
     SendDlgItemMessage (hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)szNone );
     portcnt = 0;
@@ -7549,6 +7560,7 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage)
        z = zfile_fopen (file, "rb");
        if (z) {
            int type = zfile_gettype (z);
+           struct romdata *rd = getromdatabyzfile (z);
            zfile_fclose (z);
            switch (type)
            {
@@ -7583,7 +7595,16 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage)
                    }
                break;
                case ZFILE_ROM:
-                   strcpy (prefs->romfile, file);
+                   if (rd) {
+                       if (rd->type == ROMTYPE_KICK || rd->type == ROMTYPE_KICKCD32)
+                           strcpy (prefs->romfile, file);
+                       if (rd->type == ROMTYPE_EXTCD32 || rd->type == ROMTYPE_EXTCDTV)
+                           strcpy (prefs->romextfile, file);
+                       if (rd->type == ROMTYPE_AR)
+                           strcpy (prefs->cartfile, file);
+                   } else {
+                       strcpy (prefs->romfile, file);
+                   }
                break;
                case ZFILE_NVR:
                    strcpy (prefs->flashfile, file);
diff --git a/zfile.c b/zfile.c
index d8da787b2a512733b65bf5c2678e764cc024f9b0..f2109760217ce205c8ce0a9561ebcf9479cc8390 100755 (executable)
--- a/zfile.c
+++ b/zfile.c
@@ -832,20 +832,24 @@ char *zfile_getname (struct zfile *f)
 uae_u32 zfile_crc32 (struct zfile *f)
 {
     uae_u8 *p;
-    int pos = f->seek;
+    int pos, size;
     uae_u32 crc;
 
     if (!f)
        return 0;
     if (f->data)
        return get_crc32 (f->data, f->size);
-    p = xmalloc (f->size);
+    pos = zfile_ftell (f);
+    zfile_fseek (f, 0, SEEK_END);
+    size = zfile_ftell (f);
+    p = xmalloc (size);
     if (!p)
        return 0;
+    memset (p, 0, size);
     zfile_fseek (f, 0, SEEK_SET);
-    zfile_fread (p, 1, f->size, f);
+    zfile_fread (p, 1, size, f);
     zfile_fseek (f, pos, SEEK_SET);        
-    crc = get_crc32 (f->data, f->size);
+    crc = get_crc32 (p, size);
     xfree (p);
     return crc;
 }