]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1450b15.zip
authorToni Wilen <twilen@winuae.net>
Sun, 2 Dec 2007 12:46:46 +0000 (14:46 +0200)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:37:23 +0000 (21:37 +0200)
20 files changed:
akiko.c
autoconf.c
cdtv.c
cfgfile.c
cia.c
custom.c
debug.c
drawing.c
expansion.c
include/amax.h
include/debug.h
include/options.h
memory.c
od-win32/cloanto/RetroPlatformIPC.h
od-win32/rp.c
od-win32/win32.c
od-win32/win32.h
od-win32/win32gfx.c
od-win32/winuaechangelog.txt
sana2.c

diff --git a/akiko.c b/akiko.c
index f0e404e51b342f6b656d1002ad668cf873bca1f9..fa55d9ec6f628129c93dae794997cd03c4525b4d 100644 (file)
--- a/akiko.c
+++ b/akiko.c
@@ -455,36 +455,27 @@ static void cdaudiostop (void)
 static uae_u32 last_play_end;
 static int cd_play_audio (uae_u32 startmsf, uae_u32 endmsf, int scan)
 {
-#if 0
+#if 1
     uae_u8 *buf = cdrom_toc_cd_buffer;
     uae_u8 *s;
     uae_u32 addr;
-    int i, changed;
+    int i;
 
-    changed = 0;
     for (i = 0; i < cdrom_toc_entries; i++) {
        s = buf + 4 + i * 11;
        addr = (s[8] << 16) | (s[9] << 8) | (s[10] << 0);
        if (s[3] > 0 && s[3] < 100 && addr >= startmsf)
            break;
     }
-    addr = lsn2msf (cdrom_leadout);
-    if (i + 1 < cdrom_toc_entries) { 
+    if ((s[1] & 0x0c) == 0x04) {
+       write_log ("tried to play data track %d!\n", s[3]);
        s += 11;
-       addr =(s[8] << 16) | (s[9] << 8) | (s[10] << 0);
-    }
-    if (endmsf >= addr) {
-       endmsf = addr;
-       changed = 1;
-    }
-    if (endmsf >= lsn2msf (cdrom_leadout)) {
-       endmsf = lsn2msf (cdrom_leadout);
-       changed = 1;
+       startmsf = (s[8] << 16) | (s[9] << 8) | (s[10] << 0);
+       s += 11;
+       endmsf = (s[8] << 16) | (s[9] << 8) | (s[10] << 0);
+       //cdrom_audiotimeout = 312;
+       return 0;
     }
-#if AKIKO_DEBUG_IO_CMD
-    if (changed)
-       write_log ("Adjusted from %06.6X to %06.6X\n", startmsf, endmsf);
-#endif
 #endif
     last_play_end = endmsf;
     cdrom_audiotimeout = 0;
@@ -784,8 +775,8 @@ static int cdrom_command_multi (void)
        int cdrom_data_offset_end = msf2lsn (endpos);
        cdrom_data_offset = msf2lsn (seekpos);
 #if AKIKO_DEBUG_IO_CMD
-       write_log ("READ DATA FROM %06.6X (%d) TO %06.6X (%d) SPEED=%dx\n",
-           seekpos, cdrom_data_offset, endpos, cdrom_data_offset_end, cdrom_speed);
+       write_log ("READ DATA %06.6X (%d) - %06.6X (%d) SPD=%dx PC=%08X\n",
+           seekpos, cdrom_data_offset, endpos, cdrom_data_offset_end, cdrom_speed, M68K_GETPC);
 #endif
        cdrom_result_buffer[1] |= 0x02;
     } else if (cdrom_command_buffer[10] & 4) { /* play audio */
index 054e097ab64ca86779ebaefd0573c469391905e4..cf599e66301b301ecec8fe3fd1c875d936f34fd8 100644 (file)
@@ -28,7 +28,7 @@ uaecptr EXPANSION_bootcode, EXPANSION_nullfunc;
 /* ROM tag area memory access */
 
 uae_u8 *rtarea;
-uaecptr rtarea_base = 0xf00000;
+uaecptr rtarea_base;
 
 static uae_u32 REGPARAM3 rtarea_lget (uaecptr) REGPARAM;
 static uae_u32 REGPARAM3 rtarea_wget (uaecptr) REGPARAM;
diff --git a/cdtv.c b/cdtv.c
index 9e6bdb22c335a9fd91c518cfb53b26e66c9a6f0f..58fdf0518000a120a208ba8f34ebb84bc22b742b 100644 (file)
--- a/cdtv.c
+++ b/cdtv.c
@@ -974,7 +974,7 @@ void CDTV_hsync_handler(void)
        do_stch();
 }
 
-static void do_stch(void)
+static void do_stch (void)
 {
     static int stch_cnt;
     if ((tp_cr & 1) && !(tp_air & (1 << 2)) && (tp_cd & (1 << 2))) {
@@ -985,7 +985,7 @@ static void do_stch(void)
     }
 }
 
-void bleh(void)
+void bleh (void)
 {
 #if 0
     cd_playing = cd_finished = cd_motor = cd_media = 1;
index 8e307bcc697a71420887215408bdd4d38df9db5d..6b182f04073f8537bdc0112fd81203aa0f98dddc 100644 (file)
--- a/cfgfile.c
+++ b/cfgfile.c
@@ -840,6 +840,9 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value)
        || cfgfile_intval (option, value, "gfx_refreshrate", &p->gfx_refreshrate, 1)
        || cfgfile_intval (option, value, "gfx_autoresolution", &p->gfx_autoresolution, 1)
 
+       || cfgfile_intval (option, value, "gfx_center_horizontal_adjust", &p->gfx_xcenter_adjust, 1)
+       || cfgfile_intval (option, value, "gfx_center_vertical_adjust", &p->gfx_ycenter_adjust, 1)
+
 #ifdef GFXFILTER
        || cfgfile_intval (option, value, "gfx_filter_vert_zoom", &p->gfx_filter_vert_zoom, 1)
        || cfgfile_intval (option, value, "gfx_filter_horiz_zoom", &p->gfx_filter_horiz_zoom, 1)
@@ -2831,8 +2834,8 @@ void default_prefs (struct uae_prefs *p, int type)
     p->gfx_afullscreen = 0;
     p->gfx_pfullscreen = 0;
     p->gfx_correct_aspect = 0;
-    p->gfx_xcenter = 0;
-    p->gfx_ycenter = 0;
+    p->gfx_xcenter = 0; p->gfx_xcenter_adjust = 0;
+    p->gfx_ycenter = 0; p->gfx_ycenter_adjust = 0;
     p->color_mode = 2;
 
     p->x11_use_low_bandwidth = 0;
diff --git a/cia.c b/cia.c
index 6c14ef10df4da398e28923437312c8e350975ebc..faa8b54e89befae1d9f4a4fc8f9986f166904e12 100644 (file)
--- a/cia.c
+++ b/cia.c
@@ -32,6 +32,7 @@
 #include "debug.h"
 #include "arcadia.h"
 #include "audio.h"
+#include "amax.h"
 
 //#define CIAA_DEBUG_R
 //#define CIAA_DEBUG_W
@@ -1260,25 +1261,27 @@ static uae_u32 REGPARAM2 clock_wget (uaecptr addr)
 
 static uae_u32 REGPARAM2 clock_bget (uaecptr addr)
 {
-    time_t t = time(0);
+    time_t t;
     struct tm *ct;
 
 #ifdef JIT
     special_mem |= S_READ;
 #endif
-    t += currprefs.cs_rtc_adjust;
+    //write_log("R: %x (%x), PC=%08x\n", addr, addr >> 2, M68K_GETPC);
 #ifdef CDTV
     if (currprefs.cs_cdtvram && addr >= 0xdc8000)
        return cdtv_battram_read (addr);
 #endif
-    ct = localtime (&t);
     addr &= 0x3f;
-    if ((addr & 3) == 2 || (addr & 3) == 0) {
+    if ((addr & 3) == 2 || (addr & 3) == 0 || currprefs.cs_rtc == 0) {
        int v = 0;
        if (currprefs.cpu_model == 68000 && currprefs.cpu_compatible)
            v = regs.irc >> 8;
        return v;
     }
+    t = time (0);
+    t += currprefs.cs_rtc_adjust;
+    ct = localtime (&t);
     addr >>= 2;
     if (currprefs.cs_rtc == 1) { /* MSM6242B */
        switch (addr) {
@@ -1345,6 +1348,7 @@ static void REGPARAM2 clock_bput (uaecptr addr, uae_u32 value)
 #ifdef JIT
     special_mem |= S_WRITE;
 #endif
+    //write_log("W: %x: %x, PC=%08x\n", addr, value & 0xff, M68K_GETPC);
 #ifdef CDTV
     if (currprefs.cs_cdtvram && addr >= 0xdc8000) {
        cdtv_battram_write (addr, value);
@@ -1352,7 +1356,7 @@ static void REGPARAM2 clock_bput (uaecptr addr, uae_u32 value)
     }
 #endif
     addr &= 0x3f;
-    if ((addr & 3) != 3)
+    if ((addr & 1) != 1 || currprefs.cs_rtc == 0)
        return;
     addr >>= 2;
     value &= 0x0f;
index 2b4588f4b85bef42cc5079a3f4fe083942e8ad51..847671ad6bb6a8b2bd1d474702f0c2be3e4b419f 100644 (file)
--- a/custom.c
+++ b/custom.c
@@ -4516,7 +4516,7 @@ static void hsync_handler (void)
     {
        //extern void uaenet_fake_int_handler (void);
        extern int volatile uaenet_int_requested;
-       extern int uaenet_vsync_requested;
+       extern int volatile uaenet_vsync_requested;
        if (uaenet_int_requested || (uaenet_vsync_requested && vpos == 10)) {
            INTREQ (0x8000 | 0x2000);
            //uaenet_fake_int_handler ();
diff --git a/debug.c b/debug.c
index 3d9821e8f7493c4869ffeee94ac4ee2a5e01fd01..195839f890bd2ecfac7865b579ebd76bbdd12aff 100644 (file)
--- a/debug.c
+++ b/debug.c
@@ -1287,6 +1287,7 @@ static int memwatch_func (uaecptr addr, int rwi, int size, uae_u32 *valp)
                }
                return 0;
            }
+           mwhit.pc = M68K_GETPC;
            mwhit.addr = addr;
            mwhit.rwi = rwi;
            mwhit.size = size;
@@ -2562,7 +2563,7 @@ void debug (void)
                            seglist = BPTR2APTR(get_long (activetask + 128));
                            seglist = BPTR2APTR(get_long (seglist + 12));
                        }
-                       if (activetask == processptr || (processname && (!stricmp(name, processname) || (command && command[0] && !strnicmp(command + 1, processname, command[0] && processname[command[0]+1] == 0))))) {
+                       if (activetask == processptr || (processname && (!stricmp(name, processname) || (command && command[0] && !strnicmp(command + 1, processname, command[0]) && processname[command[0]+1] == 0)))) {
                            while (seglist) {
                                uae_u32 size = get_long (seglist - 4) - 4;
                                if (pc >= (seglist + 4) && pc < (seglist + size)) {
@@ -2602,10 +2603,10 @@ void debug (void)
            }
        }
     } else {
-       console_out ("Memwatch %d: break at %08.8X.%c %c%c%c %08.8X\n", memwatch_triggered - 1, mwhit.addr,
+       console_out ("Memwatch %d: break at %08X.%c %c%c%c %08.8X PC=%08X\n", memwatch_triggered - 1, mwhit.addr,
            mwhit.size == 1 ? 'B' : (mwhit.size == 2 ? 'W' : 'L'),
            (mwhit.rwi & 1) ? 'R' : ' ', (mwhit.rwi & 2) ? 'W' : ' ', (mwhit.rwi & 4) ? 'I' : ' ',
-           mwhit.val);
+           mwhit.val, mwhit.pc);
        memwatch_triggered = 0;
     }
     if (skipaddr_doskip > 0) {
index 3f3f5e406f6210d22bd41034eae4467c94bb7129..e5cf9beb8bcae204eaebe7e13f0ee7fd6b492fa0 100644 (file)
--- a/drawing.c
+++ b/drawing.c
@@ -1974,6 +1974,9 @@ static void center_image (void)
        if (doublescan)
            visible_left_border = (max_diwlastword - 48) / 2 - gfxvidinfo.width;
     }
+    visible_left_border += currprefs.gfx_xcenter_adjust;
+    visible_left_border &= ~((xshift (1, lores_shift)) - 1);
+
     if (visible_left_border > max_diwlastword - 32)
        visible_left_border = max_diwlastword - 32;
     if (visible_left_border < 0)
@@ -2001,12 +2004,14 @@ static void center_image (void)
                && prev_y_adjust + max_drawn_amiga_line > thisframe_last_drawn_line)
                thisframe_y_adjust = prev_y_adjust;
        }
-       /* Make sure the value makes sense */
-       if (thisframe_y_adjust + max_drawn_amiga_line > maxvpos_max)
-           thisframe_y_adjust = maxvpos_max - max_drawn_amiga_line;
-       if (thisframe_y_adjust < minfirstline)
-           thisframe_y_adjust = minfirstline;
     }
+    thisframe_y_adjust += currprefs.gfx_ycenter_adjust;
+    /* Make sure the value makes sense */
+    if (thisframe_y_adjust + max_drawn_amiga_line > maxvpos_max)
+        thisframe_y_adjust = maxvpos_max - max_drawn_amiga_line;
+    if (thisframe_y_adjust < minfirstline)
+        thisframe_y_adjust = minfirstline;
+
     thisframe_y_adjust_real = thisframe_y_adjust << (linedbl ? 1 : 0);
     tmp = (maxvpos_max - thisframe_y_adjust) << (linedbl ? 1 : 0);
     if (tmp != max_ypos_thisframe) {
index 424f58895b8b8906bad9923790f7267e10a9a180..f57efa2d8a4712dc0dc12ff8a77db006b9a70e0b 100644 (file)
@@ -1063,11 +1063,15 @@ static void allocate_expamem (void)
 
 uaecptr need_uae_boot_rom(void)
 {
+    int i;
     uaecptr b = 0xf00000;
     if (currprefs.cs_cdtvcd || currprefs.cs_cdtvscsi)
        b = 0xe70000;
-    if (nr_units() > 0)
-       return b;
+    for (i = 0; i < currprefs.mountitems; i++) {
+       struct uaedev_config_info *uci = &currprefs.mountconfig[i];
+       if (uci->controller == 0)
+           return b;
+    }
     if (currprefs.socket_emu)
        return b;
     if (currprefs.uaeserial)
index 42269646f2a53573f5b4badc5e9facc389eca551..311c36347b6cd57deea6956a664e94d533717c70 100644 (file)
@@ -4,4 +4,4 @@ void amax_bfe001_write (uae_u8 pra, uae_u8 dra);
 uae_u8 amax_disk_status (void);
 void amax_disk_select (uae_u8 v, uae_u8 ov);
 void amax_reset (void);
-void amax_init (void);
\ No newline at end of file
+void amax_init (void);
index 198d11c47f07cb9100df367540dc586f14a447c2..f825d891be463ce92faaeeb62b54583009faaa2a 100644 (file)
@@ -51,6 +51,7 @@ struct memwatch_node {
     uae_u32 modval;
     int modval_written;
     int frozen;
+    uaecptr pc;
 };
 extern struct memwatch_node mwnodes[MEMWATCH_TOTAL];
 
index 7ae4d8b6d6de52dbd45266491be677f4fa153974..9032390e5d1039aef8a1140c32523fdbbf50d7fd 100644 (file)
@@ -156,8 +156,8 @@ struct uae_prefs {
     int gfx_linedbl;
     int gfx_correct_aspect;
     int gfx_afullscreen, gfx_pfullscreen;
-    int gfx_xcenter;
-    int gfx_ycenter;
+    int gfx_xcenter, gfx_xcenter_adjust;
+    int gfx_ycenter, gfx_ycenter_adjust;
     int gfx_saturation, gfx_luminance, gfx_contrast, gfx_gamma;
     int color_mode;
 
index f605d43d03348ebc510303cd49907694f020bb6d..cbc9de3009194b7f64df0fab05c1723a29592a95 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -2613,7 +2613,7 @@ void memory_reset (void)
            map_banks (&gayle_bank, 0xDD, 1, 0);
        }
     }
-    if (currprefs.cs_rtc)
+    if (currprefs.cs_rtc || currprefs.cs_cdtvram)
        map_banks (&clock_bank, 0xDC, 1, 0);
     if (currprefs.cs_fatgaryrev >= 0 || currprefs.cs_ramseyrev >= 0)
        map_banks (&mbres_bank, 0xDE, 1, 0);
index 0ef307359a2c8145d9fcc6fbec08db117c828be6..f2b5814836abdf92545cce2c542d7a607e154065 100644 (file)
 //
 #define RPIPCHM_VOLUME (WM_APP + 209)
 
+// Message:
+//    RPIPCHM_RELEASEMOUSEKEY
+// Description:
+//    the host uses the RPIPCHM_RELEASEMOUSEKEY message
+//    to change the release mouse key information
+// Data sent:
+//    WPARAM = VK_* identifier of the mouse-release key
+//             (e.g. "0x1B" for the Esc key - see VK_* constants in winuser.h)
+//    LPARAM = milliseconds value
+//             (amount of time the user has to hold the above key to release the mouse)
+// Response:
+//    LRESULT = non-zero if the guest accepted the new settings
+//
+#define RPIPCHM_RELEASEMOUSEKEY        (WM_APP + 210)
+
+// Message:
+//    RPIPCHM_EVENT
+// Description:
+//    the host uses the RPIPCHM_EVENT message
+//    to simulate keyboard, mouse, joystick (press/release)
+//    and other guest-specific events
+// Data sent:
+//    pData = (Unicode) event string (guest-specific)
+// Response:
+//    LRESULT = non-zero if the guest simulated the specified event
+//
+#define RPIPCHM_EVENT  (WM_APP + 211)
+
 
 
 // ****************************************************************************
index f6d814872666566ca6c7f1d761542983502ef6b8..de463258dc7cbc1d52ded575e1c8bcbaad7294e1 100644 (file)
@@ -36,7 +36,19 @@ static int default_width, default_height;
 static int hwndset;
 static int minimized;
 
-const char *getmsg (int msg)
+
+static char *ua (const WCHAR *s)
+{
+    char *d;
+    int len = WideCharToMultiByte (CP_ACP, 0, s, -1, NULL, 0, 0, FALSE);
+    if (!len)
+       return my_strdup ("");
+    d = xmalloc (len + 1);
+    WideCharToMultiByte (CP_ACP, 0, s, -1, d, len, 0, FALSE);
+    return d;
+}
+
+static const char *getmsg (int msg)
 {
     switch (msg)
     {
@@ -71,6 +83,7 @@ const char *getmsg (int msg)
        case RPIPCHM_TURBO: return "RPIPCHM_TURBO";
        case RPIPCHM_INPUTMODE: return "RPIPCHM_INPUTMODE";
        case RPIPCHM_VOLUME: return "RPIPCHM_VOLUME";
+       case RPIPCHM_EVENT: return "RPIPCHM_EVENT";
 
        default: return "UNKNOWN";
     }
@@ -99,17 +112,6 @@ BOOL RPSendMessagex(UINT uMessage, WPARAM wParam, LPARAM lParam,
     return v;
 }
 
-static char *ua (WCHAR *s)
-{
-    char *d;
-    int len = WideCharToMultiByte (CP_ACP, 0, s, -1, NULL, 0, 0, FALSE);
-    if (!len)
-       return "";
-    d = xmalloc (len + 1);
-    WideCharToMultiByte (CP_ACP, 0, s, -1, d, len, 0, FALSE);
-    return d;
-}
-
 static int winok(void)
 {
     if (!initialized)
@@ -197,6 +199,23 @@ static LRESULT CALLBACK RPHostMsgFunction(UINT uMessage, WPARAM wParam, LPARAM l
            hwndset = 0;
            return (LRESULT)INVALID_HANDLE_VALUE;
        }
+       case RPIPCHM_EVENT:
+       {
+           char out[256];
+           char *s = ua ((WCHAR*)pData);
+           int idx = -1;
+           for (;;) {
+               int ret;
+               out[0] = 0;
+               ret = cfgfile_modify (idx++, s, strlen (s), out, sizeof out);
+               if (ret >= 0)
+                   break;
+           }
+           xfree (s);
+           return TRUE;
+       }
+
+
     }
     return FALSE;
 }
index e74f862d5f353e026ee8d01ff26a7f31c22478fb..d5ba4bac5d3ceadc7863c4170fff5cf6b5186270 100644 (file)
@@ -73,6 +73,9 @@
 #include "rp.h"
 #endif
 
+extern int harddrive_dangerous, do_rdbdump, aspi_allow_all, no_rawinput;
+int log_scsi, log_net;
+
 extern FILE *debugfile;
 extern int console_logging;
 static OSVERSIONINFO osVersion;
@@ -88,6 +91,7 @@ HMODULE hUIDLL = NULL;
 HWND (WINAPI *pHtmlHelp)(HWND, LPCSTR, UINT, LPDWORD) = NULL;
 HWND hAmigaWnd, hMainWnd, hHiddenWnd;
 RECT amigawin_rect;
+static int mouseposx, mouseposy;
 static UINT TaskbarRestart;
 static int TaskbarRestartOk;
 static int forceroms;
@@ -129,9 +133,6 @@ char start_path_new1[MAX_DPATH]; /* AF2005 */
 char start_path_new2[MAX_DPATH]; /* AMIGAFOREVERDATA */
 char help_file[MAX_DPATH];
 int af_path_2005, af_path_old;
-
-extern int harddrive_dangerous, do_rdbdump, aspi_allow_all, no_rawinput;
-int log_scsi, log_net;
 DWORD quickstart = 1;
 
 static int timeend (void)
@@ -442,8 +443,12 @@ static void setcursor(int oldx, int oldy)
 {
     int x = (amigawin_rect.right - amigawin_rect.left) / 2;
     int y = (amigawin_rect.bottom - amigawin_rect.top) / 2;
-    if (oldx == x && oldy == y)
+    mouseposx = oldx - x;
+    mouseposy = oldy - y;
+    if (abs (mouseposx) < 50 && abs (mouseposy) < 50)
        return;
+    mouseposx = 0;
+    mouseposy = 0;
     SetCursorPos (amigawin_rect.left + x, amigawin_rect.top + y);
 }
 
@@ -532,7 +537,7 @@ void setpriority (struct threadpriorities *pri)
     if (os_winnt)
        err = SetPriorityClass (GetCurrentProcess (), pri->classvalue);
     else
-       err = SetThreadPriority (GetCurrentThread(), pri->value);
+       err = SetThreadPriority (GetCurrentThread (), pri->value);
     if (!err)
        write_log ("priority set failed, %08.8X\n", GetLastError ());
 }
@@ -540,10 +545,13 @@ void setpriority (struct threadpriorities *pri)
 void setmouseactive (int active)
 {
 
-    if (mouseactive == active)
+    if (mouseactive == active && active >= 0)
        return;
+    if (active < 0)
+       active = 1;
     mouseactive = active;
 
+    mouseposx = mouseposy = 0;
     //write_log ("setmouseactive(%d)\n", active);
     if (showcursor) {
        ClipCursor(NULL);
@@ -560,9 +568,21 @@ void setmouseactive (int active)
 #endif
     inputdevice_unacquire ();
 
-    setmaintitle (hMainWnd);
     if (mouseactive > 0)
        focus = 1;
+    if (focus) {
+       int donotfocus = 0;
+       if (SetForegroundWindow (hMainWnd) == FALSE)
+           donotfocus = 1;
+#ifdef RETROPLATFORM
+       if (rp_isactive ())
+           donotfocus = 0;
+#endif
+       if (donotfocus) {
+           focus = 0;
+           mouseactive = 0;
+       }
+    }
     if (mouseactive) {
        if (focus) {
            if (!showcursor) {
@@ -577,6 +597,7 @@ void setmouseactive (int active)
     }
     if (!active)
        checkpause ();
+    setmaintitle (hMainWnd);
 #ifdef RETROPLATFORM
     rp_mousecapture (active);
 #endif
@@ -608,10 +629,8 @@ static void winuae_active (HWND hWnd, int minimized)
 #endif
     setpriority (pri);
 
-    if (!minimized) {
-       if (!avioutput_video) {
-           clear_inhibit_frame (IHF_WINDOWHIDDEN);
-       }
+    if (!avioutput_video) {
+        clear_inhibit_frame (IHF_WINDOWHIDDEN);
     }
     if (emulation_paused > 0)
        emulation_paused = -1;
@@ -640,7 +659,7 @@ static void winuae_inactive (HWND hWnd, int minimized)
     struct threadpriorities *pri;
     int wasfocus = focus;
 
-    //write_log("winuae_inactive(%d)\n", minimized);
+    write_log("winuae_inactive(%d)\n", minimized);
     if (minimized)
        exit_gui (0);
     focus = 0;
@@ -725,7 +744,7 @@ static void handleXbutton (WPARAM wParam, int updown)
        setmousebuttonstate (dinput_winmouse(), num, updown);
 }
 
-#define MSGDEBUG 0
+#define MSGDEBUG 1
 
 static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
@@ -746,71 +765,14 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
     switch (message)
     {
 
-
-#if 0
-    case WM_SIZE:
-    {
-       if (recursive)
-           return 0;
-       recursive++;
-#if MSGDEBUG
-       write_log ("WM_SIZE %x %d %d\n", hWnd, wParam, minimized);
-#endif
-       if (isfullscreen () > 0) {
-           v = minimized;
-           switch (wParam)
-           {
-               case SIZE_MAXIMIZED:
-               case SIZE_RESTORED:
-               v = FALSE;
-               break;
-               default:
-               v = TRUE;
-               break;
-           }
-           exit_gui (0);
-           if (v != minimized) {
-               minimized = v;
-               if (v) {
-                   winuae_inactive (hWnd, wParam == SIZE_MINIMIZED);
-               } else {
-                   pausemode (0);
-                   winuae_active (hWnd, minimized);
-               }
-           }
-       }
-       recursive--;
-       return 0;
-    }
-    break;
-#endif
-
     case WM_SETFOCUS:
-#if MSGDEBUG
-       write_log ("**** WM_SETFOCUS %d\n", minimized);
-#endif
-       if (!minimized)
-           winuae_active (hWnd, minimized);
+        winuae_active (hWnd, minimized);
         minimized = 0;
        return 0;
-    case WM_KILLFOCUS:
-#if MSGDEBUG
-       write_log ("**** WM_KILLFOCUS %d\n", minimized);
-#endif
-       winuae_inactive (hWnd, 0);
-       return 0;
     case WM_ACTIVATE:
-       if (!minimized) {
+        if (LOWORD (wParam) == WA_INACTIVE) {
            minimized = HIWORD (wParam) ? 1 : 0;
-           if (minimized) {
-#if MSGDEBUG
-               write_log("**** minimize\n");
-#endif
-               winuae_inactive (hWnd, minimized);
-           }
-       } else {
-           winuae_active (hWnd, minimized);
-           minimized = 0;
+           winuae_inactive (hWnd, minimized);
        }
        return 0;
 #ifdef RETROPLATFORM
@@ -819,62 +781,6 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
        return 0;
 #endif
 
-#if 0
-    case WM_ACTIVATE:
-       if (recursive)
-           return 0;
-       recursive++;
-#if MSGDEBUG
-       write_log ("WM_ACTIVATE %x %d %d %d\n", hWnd, HIWORD (wParam), LOWORD (wParam), minimized);
-#endif
-       if (isfullscreen () <= 0) {
-           minimized = HIWORD (wParam);
-           if (LOWORD (wParam) != WA_INACTIVE) {
-               winuae_active (hWnd, minimized);
-           } else {
-               winuae_inactive (hWnd, minimized);
-           }
-       } else {
-           if (LOWORD (wParam) == WA_INACTIVE) {
-               minimized = HIWORD (wParam);
-               winuae_inactive (hWnd, minimized);
-           } else {
-               if (!minimized)
-                   winuae_active (hWnd, minimized);
-               if (is3dmode() && normal_display_change_starting == 0)
-                   normal_display_change_starting = 10;
-           }
-       }
-       recursive--;
-       return 0;
-
-    case WM_ACTIVATEAPP:
-    {
-       if (recursive)
-           return 0;
-       recursive++;
-#if MSGDEBUG
-       write_log ("WM_ACTIVATEAPP %x %d %d\n", hWnd, wParam, minimized);
-#endif
-       activateapp = wParam;
-       if (!wParam) {
-           setmouseactive (0);
-           normal_display_change_starting = 0;
-       } else {
-           if (minimized)
-               minimized = 0;
-           winuae_active (hWnd, minimized);
-           if (is3dmode () && normal_display_change_starting == 1) {
-               WIN32GFX_DisplayChangeRequested ();
-               normal_display_change_starting = -1;
-           }
-       }
-       manual_palette_refresh_needed = 1;
-       recursive--;
-       return 0;
-    }
-#endif
-
     case WM_PALETTECHANGED:
        if ((HWND)wParam != hWnd)
            manual_palette_refresh_needed = 1;
@@ -893,9 +799,9 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
     case WM_LBUTTONDBLCLK:
        if (!mouseactive && isfullscreen() <= 0 && !gui_active) {
            setmouseactive (1);
-       }
-       if (dinput_winmouse () >= 0)
+       } else if (dinput_winmouse () >= 0) {
            setmousebuttonstate (dinput_winmouse(), 0, 1);
+       }
     return 0;
     case WM_RBUTTONUP:
        if (dinput_winmouse () >= 0)
@@ -1025,27 +931,31 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
     {
        mx = (signed short) LOWORD (lParam);
        my = (signed short) HIWORD (lParam);
+       mx -= mouseposx;
+       my -= mouseposy;
        if (recapture && isfullscreen() <= 0) {
            setmouseactive(1);
            setamigamouse(mx, my);
            return 0;
        }
-       if (normal_display_change_starting)
-           return 0;
+        if (dinput_winmouse () >= 0 && !focus) {
+            if (dinput_winmousemode ()) {
+               /* absolete + mousehack */
+               setmousestate (dinput_winmouse (), 0, mx, 1);
+               setmousestate (dinput_winmouse (), 1, my, 1);
+               return 0;
+           }
+           return DefWindowProc (hWnd, message, wParam, lParam);
+       }
        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);
+           if (dinput_winmousemode () == 0) {
+               /* 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() <= 0) {
            setmousestate (0, 0, mx, 1);
@@ -1053,8 +963,9 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
        }
        if (showcursor || mouseactive)
            setcursor (LOWORD (lParam), HIWORD (lParam));
+       return 0;
     }
-    return 0;
+    break;
 
     case WM_MOVING:
     {
@@ -3196,6 +3107,9 @@ static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
     SetCurrentDirectory (start_path_data);
 
     logging_init ();
+    write_log ("params:\n");
+    for (i = 1; i < __argc; i++)
+       write_log ("%d: '%s'\n", i, __argv[i]);
 
     if(WIN32_RegisterClasses() && WIN32_InitLibraries() && DirectDraw_Start(NULL)) {
        DEVMODE devmode;
index 35d4b5acf241ce9206a48bcd404ef85f7d55cf04..ddcc47b1b2f1a3e79296f2e1df8aa01f59411e39 100644 (file)
@@ -15,9 +15,9 @@
 #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
 #define GETBDD(x) ((x) % 100)
 
-#define WINUAEBETA 14
+#define WINUAEBETA 15
 #define WINUAEPUBLICBETA 1
-#define WINUAEDATE MAKEBD(2007, 11, 29)
+#define WINUAEDATE MAKEBD(2007, 12, 2)
 #define WINUAEEXTRA ""
 #define WINUAEREV ""
 
index 00305dc8fa4a2aa0564dec16db88998a12327982..d6419021006091b4ad3c66cd06067124b05a0606 100644 (file)
@@ -1082,7 +1082,7 @@ static int open_windows (void)
     } while (ret < 0);
 
     setpriority(&priorities[currprefs.win32_active_priority]);
-    setmouseactive (1);
+    setmouseactive (-1);
     for (i = 0; i < NUM_LEDS; i++)
        gui_led (i, 0);
     gui_fps (0, 0);
@@ -1199,10 +1199,14 @@ int check_prefs_changed_gfx (void)
     }
 
     if (currprefs.gfx_correct_aspect != changed_prefs.gfx_correct_aspect ||
+       currprefs.gfx_xcenter_adjust != changed_prefs.gfx_xcenter_adjust ||
+       currprefs.gfx_ycenter_adjust != changed_prefs.gfx_ycenter_adjust ||
        currprefs.gfx_xcenter != changed_prefs.gfx_xcenter ||
        currprefs.gfx_ycenter != changed_prefs.gfx_ycenter)
     {
        currprefs.gfx_correct_aspect = changed_prefs.gfx_correct_aspect;
+       currprefs.gfx_xcenter_adjust = changed_prefs.gfx_xcenter_adjust;
+       currprefs.gfx_ycenter_adjust = changed_prefs.gfx_ycenter_adjust;
        currprefs.gfx_xcenter = changed_prefs.gfx_xcenter;
        currprefs.gfx_ycenter = changed_prefs.gfx_ycenter;
        return 1;
@@ -2091,11 +2095,11 @@ static int create_windows (void)
        ShowWindow (hMainWnd, SW_SHOWNORMAL);
        UpdateWindow (hMainWnd);
     }
-    UpdateWindow (hAmigaWnd);
     ShowWindow (hAmigaWnd, SW_SHOWNORMAL);
 #ifdef RETROPLATFORM
     rp_set_hwnd ();
 #endif
+    UpdateWindow (hAmigaWnd);
     return 1;
 }
 
index 5fd284e264fde72673c74448805a432c4dc3a6c9..c6f7e4406f9b3c8929c28cf17f49120714b39931 100644 (file)
@@ -1,4 +1,12 @@
 
+Beta 15:
+
+- fullscreen switching should work correctly again
+- mouse moves are now ignored if winuae is not active
+- do not get in "semi mouse captured" mode if WinUAE opens without
+  focus (for example other program got focus before WinUAE opened)
+- some uaenet.device tweaks
+
 Beta 14:
 
 - BPLCON3 BRDRBLNK-bit didn't work when chipset was ECS Denise
@@ -28,7 +36,7 @@ Beta 14:
   - some (bad) software firewalls may block some/all packets..
     (at least Vista x64 + eset smart security fw seems to eat all
     non-broadcast packets..)
-  - fixed bug in dropped packet (packet that nobody wanted) handing
+  - fixed bug in dropped packet (packet that nobody wanted) handling
 
   *) Vista note: winpcap kernel mode driver will be loaded when it is
   first required. This needs admin privileges (only once after boot)
diff --git a/sana2.c b/sana2.c
index 6e727e94e54114a48a9a13314cc7ec9ced76eb12..270682944f819663a3c6199fecfa0d09c232e66e 100644 (file)
--- a/sana2.c
+++ b/sana2.c
@@ -143,7 +143,7 @@ struct s2packet {
 };
 
 volatile int uaenet_int_requested;
-int uaenet_vsync_requested;
+volatile int uaenet_vsync_requested;
 
 static uaecptr timerdevname;
 
@@ -381,7 +381,7 @@ static uae_u32 REGPARAM2 dev_open_2 (TrapContext *context)
     if (kickstart_version >= 36) {
        m68k_areg (&context->regs, 0) = get_long (4) + 350;
        m68k_areg (&context->regs, 1) = timerdevname;
-       CallLib (context, get_long (4), -0x114); /*FindName() */
+       CallLib (context, get_long (4), -0x114); /* FindName('timer.device') */
        pdev->timerbase = m68k_dreg (&context->regs, 0);
     }
 
@@ -784,7 +784,7 @@ void uaenet_gotdata (struct devstruct *dev, const uae_u8 *d, int len)
     if (!dev->online)
        return;
     /* drop if bogus size */
-    if (len <= ETH_HEADER_SIZE + 2 || len >= dev->td->mtu + ETH_HEADER_SIZE + 2)
+    if (len < ETH_HEADER_SIZE  || len >= dev->td->mtu + ETH_HEADER_SIZE + 2)
        return;
     /* drop if dst == broadcast and src == me */
     if (isbroadcast (d) && !memcmp (d + 6, dev->td->mac, ADDR_SIZE))
@@ -937,7 +937,6 @@ static void flush (struct priv_devstruct *pdev)
     struct asyncreq *ar;
     struct devstruct *dev;
 
-    uae_sem_wait (&async_sem);
     dev = getdevstruct (pdev->unit);
     ar = dev->ar;
     while (ar) {
@@ -947,7 +946,6 @@ static void flush (struct priv_devstruct *pdev)
        }
        ar = ar->next;
    }
-   uae_sem_post (&async_sem);
 }
 
 static int dev_do_io (struct devstruct *dev, uaecptr request, int quick)
@@ -1026,7 +1024,9 @@ static int dev_do_io (struct devstruct *dev, uaecptr request, int quick)
        case CMD_FLUSH:
            if (log_net)
                write_log ("flush started %08x\n", request);
+           uae_sem_wait (&async_sem);
            flush (pdev);
+           uae_sem_post (&async_sem);
            async = 1;
            uaenet_vsync_requested++;
        break;
@@ -1458,12 +1458,26 @@ static uae_u32 REGPARAM2 uaenet_int_handler (TrapContext *ctx)
                    dev->online = 1;
                    write_comm_pipe_u32 (&dev->requests, request, 1);
                    uaenet_vsync_requested--;
-               } else if (command == CMD_FLUSH && dev->ar->next == NULL) {
-                   /* do not reply CMD_FLUSH until all others are gone */
-                   if (log_net)
-                       write_log ("flush replied %08x\n", request);
-                   write_comm_pipe_u32 (&dev->requests, request, 1);
-                   uaenet_vsync_requested--;
+               } else if (command == CMD_FLUSH) {
+                   /* do not reply CMD_FLUSH until all other requests are gone */
+                   if (dev->ar->next == NULL) {
+                       if (log_net)
+                           write_log ("flush replied %08x\n", request);
+                       write_comm_pipe_u32 (&dev->requests, request, 1);
+                       uaenet_vsync_requested--;
+                   } else {
+                       static int cnt;
+                       struct priv_devstruct *pdev = getpdevstruct (request);
+                       if (pdev) {
+                           cnt--;
+                           if (cnt <= 0) {
+                               if (log_net)
+                                   write_log ("flushing %08x..\n", request);
+                               cnt = 25;
+                               flush (pdev);
+                           }
+                       }
+                   }
                }
            }
            ar = ar->next;