]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
3600b18
authorToni Wilen <twilen@winuae.net>
Fri, 12 Jan 2018 17:14:01 +0000 (19:14 +0200)
committerToni Wilen <twilen@winuae.net>
Fri, 12 Jan 2018 17:14:01 +0000 (19:14 +0200)
include/options.h
od-win32/direct3d11.cpp
od-win32/resources/resource.h
od-win32/resources/winuae.rc
od-win32/win32.cpp
od-win32/win32.h
od-win32/win32gfx.cpp
od-win32/win32gui.cpp
od-win32/winuaechangelog.txt
scsi.cpp

index e066cebe7b21e29f5c0fb91a0b0eda02d1dd1e54..d9fdad1fef7cb6689324acaeb12485df6cc9dc20 100644 (file)
@@ -782,6 +782,7 @@ struct uae_prefs {
        TCHAR win32_guipage[32];
        TCHAR win32_guiactivepage[32];
        bool win32_filesystem_mangle_reserved_names;
+       bool win32_shutdown_notification;
        bool right_control_is_right_win_key;
 #ifdef WITH_SLIRP
        struct slirp_redir slirp_redirs[MAX_SLIRP_REDIRS];
index cc114a401e7c890baf24ebd9732c5109ab157f2a..cbc00ef925b64316accdd0ad29b78425c884ab81 100644 (file)
@@ -163,6 +163,8 @@ struct d3d11sprite
 struct d3d11struct
 {
        IDXGISwapChain1 *m_swapChain;
+       IDXGISwapChain2 *m_swapChain2;
+       HANDLE FrameLatencyHandle;
        ID3D11Device *m_device;
        ID3D11DeviceContext *m_deviceContext;
        ID3D11RenderTargetView *m_renderTargetView;
@@ -390,7 +392,7 @@ static bool psEffect_ParseParameters(struct d3d11struct *d3d, ID3DX11Effect *eff
                return false;
 
        if (!effectDesc.Techniques) {
-               write_log(_T("D3D11: No techniques found!\n"));
+               write_log(_T("D3D11 No techniques found!\n"));
                return false;
        }
 
@@ -923,7 +925,7 @@ static bool psEffect_LoadEffect(struct d3d11struct *d3d, const TCHAR *shaderfile
        char *name = NULL;
 
        if (!pD3DCompileFromFile || !ppD3DCompile) {
-               write_log(_T("D3D11: No shader compiler available (D3DCompiler_46.dll or D3DCompiler_47.dll).\n"));
+               write_log(_T("D3D11 No shader compiler available (D3DCompiler_46.dll or D3DCompiler_47.dll).\n"));
                return false;
        }
 
@@ -1132,7 +1134,7 @@ static int psEffect_SetTextures(ID3D11Texture2D *lpSourceTex, ID3D11ShaderResour
        D3DXVECTOR4 fDims, fTexelSize;
 
        if (!s->m_SourceTextureEffectHandle) {
-               write_log(_T("D3D11: Texture with SOURCETEXTURE semantic not found\n"));
+               write_log(_T("D3D11 Texture with SOURCETEXTURE semantic not found\n"));
                return 0;
        }
        s->m_SourceTextureEffectHandle->SetResource(lpSourcerv);
@@ -1894,7 +1896,7 @@ static bool CreateTexture(struct d3d11struct *d3d)
        d3d->cursor_scale = false;
        allocsprite(d3d, &d3d->hwsprite, CURSORMAXWIDTH, CURSORMAXHEIGHT, true);
 
-       write_log(_T("D3D11: %dx%d main texture allocated\n"), d3d->m_bitmapWidth, d3d->m_bitmapHeight);
+       write_log(_T("D3D11 %dx%d main texture allocated\n"), d3d->m_bitmapWidth, d3d->m_bitmapHeight);
 
        return true;
 }
@@ -1919,7 +1921,7 @@ static bool allocshadertex(struct d3d11struct *d3d, struct shadertex *t, int w,
 
        hr = d3d->m_device->CreateTexture2D(&desc, NULL, &t->tex);
        if (FAILED(hr)) {
-               write_log(_T("D3D11: Failed to create working texture: %08x:%d\n"), hr, idx);
+               write_log(_T("D3D11 Failed to create working texture: %08x:%d\n"), hr, idx);
                return 0;
        }
 
@@ -1951,7 +1953,7 @@ static bool allocextratextures(struct d3d11struct *d3d, struct shaderdata11 *s,
        if (!allocshadertex(d3d, &s->lpWorkTexture2, w, h, s - &d3d->shaders[0]))
                return false;
 
-       write_log(_T("D3D11: %d*%d working texture:%d\n"), w, h, s - &d3d->shaders[0]);
+       write_log(_T("D3D11 %d*%d working texture:%d\n"), w, h, s - &d3d->shaders[0]);
        return true;
 }
 
@@ -1995,7 +1997,7 @@ static bool createextratextures(struct d3d11struct *d3d, int ow, int oh, int win
                        d3d->shaders[i].targettex_height = h2;
                        if (!allocshadertex(d3d, &s->lpTempTexture, w2, h2, s - &d3d->shaders[0]))
                                return false;
-                       write_log(_T("D3D11: %d*%d temp texture:%d:%d\n"), w2, h2, i, d3d->shaders[i].type);
+                       write_log(_T("D3D11 %d*%d temp texture:%d:%d\n"), w2, h2, i, d3d->shaders[i].type);
                        d3d->shaders[i].worktex_width = w;
                        d3d->shaders[i].worktex_height = h;
                }
@@ -2003,7 +2005,7 @@ static bool createextratextures(struct d3d11struct *d3d, int ow, int oh, int win
        if (haveafter) {
                if (!allocshadertex(d3d, &d3d->lpPostTempTexture, d3d->m_screenWidth, d3d->m_screenHeight, -1))
                        return 0;
-               write_log(_T("D3D11: %d*%d after texture\n"), d3d->m_screenWidth, d3d->m_screenHeight);
+               write_log(_T("D3D11 %d*%d after texture\n"), d3d->m_screenWidth, d3d->m_screenHeight);
        }
        return 1;
 }
@@ -2799,9 +2801,12 @@ static void setswapchainmode(struct d3d11struct *d3d, int fs)
        if (d3d->m_tearingSupport && (d3d->swapChainDesc.SwapEffect == DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL || d3d->swapChainDesc.SwapEffect == DXGI_SWAP_EFFECT_FLIP_DISCARD) && !apm->gfx_vflip && apm->gfx_backbuffers == 0) {
                d3d->swapChainDesc.Flags |= DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
        }
+       if (0 && os_win8 > 1 && fs <= 0) {
+               d3d->swapChainDesc.Flags |= DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT;
+       }
        d3d->swapChainDesc.Flags &= ~DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
        // tearing flag is not fullscreen compatible
-       if (fs) {
+       if (fs > 0) {
                d3d->swapChainDesc.Flags |= DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
                d3d->swapChainDesc.Flags &= ~DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
        }
@@ -2933,12 +2938,17 @@ static void do_present(struct d3d11struct *d3d, int black)
                d3d->m_deviceContext->ClearRenderTargetView(d3d->m_renderTargetView, color);
        }
 
+       if (d3d->FrameLatencyHandle) {
+               WaitForSingleObjectEx(d3d->FrameLatencyHandle, 100, TRUE);
+       }
+
        struct apmode *apm = picasso_on ? &currprefs.gfx_apmode[APMODE_RTG] : &currprefs.gfx_apmode[APMODE_NATIVE];
        int vsync = isvsync();
+       UINT syncinterval = d3d->vblankintervals;
        if (d3d->m_tearingSupport && (d3d->swapChainDesc.Flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING)) {
                presentFlags |= DXGI_PRESENT_ALLOW_TEARING;
+               syncinterval = 0;
        }
-       UINT syncinterval = d3d->vblankintervals;
        d3d->flipped = true;
        if (!vsync) {
                if (apm->gfx_backbuffers == 0 || (presentFlags & DXGI_PRESENT_ALLOW_TEARING) || (apm->gfx_vflip == 0 && isfs(d3d) <= 0) || (isfs(d3d) > 0 && apm->gfx_vsyncmode))
@@ -3022,7 +3032,7 @@ static int xxD3D11_init2(HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int dep
        DXGI_MODE_DESC1* displayModeList;
        DXGI_ADAPTER_DESC adapterDesc;
 
-       write_log(_T("D3D11: init start. (%d*%d) (%d*%d) RTG=%d Depth=%d.\n"), w_w, w_h, t_w, t_h, picasso_on, depth);
+       write_log(_T("D3D11 init start. (%d*%d) (%d*%d) RTG=%d Depth=%d.\n"), w_w, w_h, t_w, t_h, picasso_on, depth);
 
        filterd3didx = picasso_on;
        filterd3d = &currprefs.gf[filterd3didx];
@@ -3149,23 +3159,29 @@ static int xxD3D11_init2(HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int dep
        // When a match is found store the numerator and denominator of the refresh rate for that monitor.
        d3d->fsSwapChainDesc.RefreshRate.Denominator = 0;
        d3d->fsSwapChainDesc.RefreshRate.Numerator = 0;
+       d3d->fsSwapChainDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE;
        for (int i = 0; i < numModes; i++)
        {
                DXGI_MODE_DESC1 *m = &displayModeList[i];
                if (m->Format != d3d->scrformat)
                        continue;
-               if (apm->gfx_interlaced && !(m->ScanlineOrdering & DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST))
+               if (apm->gfx_interlaced && m->ScanlineOrdering != DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST)
+                       continue;
+               if (!apm->gfx_interlaced && m->ScanlineOrdering != DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE)
                        continue;
                if (m->Width == w_w && m->Height == w_h) {
                        d3d->fsSwapChainDesc.ScanlineOrdering = m->ScanlineOrdering;
                        d3d->fsSwapChainDesc.Scaling = m->Scaling;
-                       if (!hz)
+                       if (!hz) {
+                               write_log(_T("D3D11 found matching fullscreen mode. SLO=%d S=%d. Default refresh rate.\n"), m->ScanlineOrdering, m->Scaling);
                                break;
+                       }
                        if (isfs(d3d) > 0) {
                                double mhz = (double)m->RefreshRate.Numerator / m->RefreshRate.Denominator;
                                if ((int)(mhz + 0.5) == hz || (int)(mhz) == hz) {
                                        d3d->fsSwapChainDesc.RefreshRate.Denominator = m->RefreshRate.Denominator;
                                        d3d->fsSwapChainDesc.RefreshRate.Numerator = m->RefreshRate.Numerator;
+                                       write_log(_T("D3D11 found matching fullscreen refresh rate %d/%d=%.2f. SLO=%d\n"), m->RefreshRate.Denominator, m->RefreshRate.Numerator, (float)mhz, m->ScanlineOrdering);
                                        *freq = hz;
                                        break;
                                }
@@ -3186,6 +3202,9 @@ static int xxD3D11_init2(HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int dep
                        d3d->fsSwapChainDesc.RefreshRate.Denominator = md2.RefreshRate.Denominator;
                        d3d->fsSwapChainDesc.RefreshRate.Numerator = md2.RefreshRate.Numerator;
                        *freq = md2.RefreshRate.Numerator / md2.RefreshRate.Denominator;
+                       write_log(_T("D3D11 FindClosestMatchingMode1() %d/%d=%.2f SLO=%d W=%d H=%d\n"),
+                               md2.RefreshRate.Denominator, md2.RefreshRate.Numerator, (float)md2.RefreshRate.Numerator / md2.RefreshRate.Denominator, md1.ScanlineOrdering,
+                               md2.Width, md2.Height);
                }
        }
 
@@ -3300,6 +3319,7 @@ static int xxD3D11_init2(HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int dep
        if (apm->gfx_vsyncmode && isfs(d3d) > 0 && !os_win10) {
                d3d->swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
        }
+
        d3d->needvblankevent = false;
        if (apm->gfx_vsyncmode && isfs(d3d) > 0) {
                d3d->needvblankevent = true;
@@ -3307,15 +3327,13 @@ static int xxD3D11_init2(HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int dep
 
        d3d->swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED;
 
-       setswapchainmode(d3d, isfs(d3d) > 0);
+       setswapchainmode(d3d, isfs(d3d));
 
        d3d->swapChainDesc.Scaling = (d3d->swapChainDesc.SwapEffect == DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL || d3d->swapChainDesc.SwapEffect == DXGI_SWAP_EFFECT_FLIP_DISCARD) ? DXGI_SCALING_NONE : DXGI_SCALING_STRETCH;
 
        d3d->vblankintervals = 1;
        d3d->blackscreen = false;
-       if (apm->gfx_backbuffers == 0) {
-               d3d->vblankintervals = 0;
-       } else {
+       if (!apm->gfx_backbuffers) {
                int hzmult = 0;
                getvsyncrate(*freq, &hzmult);
                if (hzmult < 0) {
@@ -3345,6 +3363,12 @@ static int xxD3D11_init2(HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int dep
                return 0;
        }
 
+       d3d->m_swapChain2 = NULL;
+       if (d3d->swapChainDesc.Flags &  DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT) {
+               result = d3d->m_swapChain->QueryInterface(__uuidof(IDXGISwapChain2), (void**)&d3d->m_swapChain2);
+               d3d->FrameLatencyHandle = d3d->m_swapChain2->GetFrameLatencyWaitableObject();
+       }
+
        IDXGIFactory1 *pFactory = NULL;
        result = d3d->m_swapChain->GetParent(__uuidof (IDXGIFactory1), (void **)&pFactory);
        if (SUCCEEDED(result)) {
@@ -3360,13 +3384,13 @@ static int xxD3D11_init2(HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int dep
 
        initthread(d3d);
 
-       write_log(_T("D3D11: %d %08x %08x\n"), d3d->swapChainDesc.BufferCount, d3d->swapChainDesc.Flags, d3d->swapChainDesc.Format);
+       write_log(_T("D3D11 %d %08x %08x\n"), d3d->swapChainDesc.BufferCount, d3d->swapChainDesc.Flags, d3d->swapChainDesc.Format);
 
        if (isfs(d3d) > 0)
                D3D_resize(1);
        D3D_resize(0);
 
-       write_log(_T("D3D11: init end\n"));
+       write_log(_T("D3D11 init end\n"));
        return 1;
 }
 
@@ -3466,7 +3490,7 @@ static void xD3D11_free(bool immediate)
 {
        struct d3d11struct *d3d = &d3d11data[0];
 
-       write_log(_T("D3D11: free start\n"));
+       write_log(_T("D3D11 free start\n"));
 
        freethread(d3d);
 
@@ -3478,6 +3502,10 @@ static void xD3D11_free(bool immediate)
                d3d->m_swapChain->Release();
                d3d->m_swapChain = NULL;
        }
+       if (d3d->m_swapChain2) {
+               d3d->m_swapChain2->Release();
+               d3d->m_swapChain2 = NULL;
+       }
        if (d3d->m_deviceContext) {
                d3d->m_deviceContext->ClearState();
                d3d->m_deviceContext->Flush();
@@ -3500,7 +3528,7 @@ static void xD3D11_free(bool immediate)
        changed_prefs.leds_on_screen &= ~STATUSLINE_TARGET;
        currprefs.leds_on_screen &= ~STATUSLINE_TARGET;
 
-       write_log(_T("D3D11: free end\n"));
+       write_log(_T("D3D11 free end\n"));
 }
 
 static int xxD3D11_init(HWND ahwnd, int w_w, int w_h, int depth, int *freq, int mmult)
@@ -3979,12 +4007,12 @@ static bool restore(struct d3d11struct *d3d)
                        desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
                        hr = d3d->m_device->CreateTexture3D(&desc, NULL, &d3d->shaders[i].lpHq2xLookupTexture);
                        if (FAILED(hr)) {
-                               write_log(_T("D3D11: Failed to create volume texture: %08x:%d\n"), hr, i);
+                               write_log(_T("D3D11 Failed to create volume texture: %08x:%d\n"), hr, i);
                                return false;
                        }
                        hr = d3d->m_deviceContext->Map(d3d->shaders[i].lpHq2xLookupTexture, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
                        if (FAILED(hr)) {
-                               write_log(_T("D3D11: Failed to lock box of volume texture: %08x:%d\n"), hr, i);
+                               write_log(_T("D3D11 Failed to lock box of volume texture: %08x:%d\n"), hr, i);
                                return false;
                        }
                        write_log(_T("HQ2X texture (%dx%d) (%dx%d):%d\n"), w2, h2, w, h, i);
@@ -3999,13 +4027,13 @@ static bool restore(struct d3d11struct *d3d)
                        srvDesc.Format = d3d->scrformat;
                        hr = d3d->m_device->CreateShaderResourceView(d3d->shaders[i].lpHq2xLookupTexture, &srvDesc, &d3d->shaders[i].lpHq2xLookupTexturerv);
                        if (FAILED(hr)) {
-                               write_log(_T("D3D11: Failed to create volume texture resource view: %08x:%d\n"), hr, i);
+                               write_log(_T("D3D11 Failed to create volume texture resource view: %08x:%d\n"), hr, i);
                                return false;
                        }
                }
        }
 
-       write_log(_T("D3D11: Shader and extra textures restored\n"));
+       write_log(_T("D3D11 Shader and extra textures restored\n"));
 
        return true;
 }
@@ -4185,14 +4213,7 @@ static void xD3D11_unlocktexture(void)
                updateleds(d3d);
        }
 
-       D3D11_BOX box;
-       box.front = 0;
-       box.back = 1;
-       box.left = 0;
-       box.right = d3d->m_bitmapWidth;
-       box.top = 0;
-       box.bottom = d3d->m_bitmapHeight;
-       d3d->m_deviceContext->CopySubresourceRegion(d3d->texture2d, 0, 0, 0, 0, d3d->texture2dstaging, 0, &box);
+       d3d->m_deviceContext->CopyResource(d3d->texture2d, d3d->texture2dstaging);
 }
 
 static void xD3D11_flushtexture(int miny, int maxy)
@@ -4511,6 +4532,10 @@ double d3d11_get_hz(void)
 bool d3d11_vsync_isdone(void)
 {
        struct d3d11struct *d3d = &d3d11data[0];
+       if (d3d->FrameLatencyHandle) {
+               if (WaitForSingleObject(d3d->FrameLatencyHandle, 0) != WAIT_OBJECT_0)
+                       return false;
+       }
        if (vblankevent) {
                if (WaitForSingleObject(vblankevent, 0) == WAIT_OBJECT_0)
                        return true;
index 4f25a83c78d86d394f928efdb1427f80b1a5061d..739be5074ba5d713fa4c30591b44147ab2af7d64 100644 (file)
 #define IDS_MOUSE_UNTRAP_MODE           413
 #define IDS_TABLET_MODE                 414
 #define IDC_HARDDRIVE_ID                415
+#define IDS_MISCLISTITEMS4              416
+#define IDS_SHUTDOWN_NOTIFICATION       417
 #define IDS_QS_MODELS                   1000
 #define IDS_QS_MODEL_A500               1001
 #define IDS_QS_MODEL_A500P              1002
index 7907bf066b75c1f9d2d1ef43127d9490a3ee255b..5ca5aee21e60fc2ecf455c3fa9875bd9e482dbb8 100644 (file)
@@ -2129,6 +2129,12 @@ BEGIN
     IDS_SLIRP_INBOUND       "SLIRP + Open ports (21-23,80)"
 END
 
+STRINGTABLE
+BEGIN
+    IDS_MISCLISTITEMS4      "Windows shutdown/logoff notification\n"
+    IDS_SHUTDOWN_NOTIFICATION "Emulation session active"
+END
+
 STRINGTABLE
 BEGIN
     IDS_FILTER_PAL_EXTRA    "Brightness\nContrast\nSaturation\nGamma\nScanlines\nBlurriness\nNoise\n"
index 5eba68ab905a733867a06c57cf0944cee41f4fc6..f91a895ddf27d5a86a494d7a3d6cfdab7b2818a3 100644 (file)
@@ -1545,6 +1545,15 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
 
        switch (message)
        {
+       case WM_QUERYENDSESSION:
+       {
+               if (hWnd == hMainWnd && currprefs.win32_shutdown_notification && !rp_isactive()) {
+                       return FALSE;
+               }
+               return TRUE;
+       }
+       case WM_ENDSESSION:
+               return FALSE;
        case WM_INPUT:
                monitor_off = 0;
                handle_rawinput (lParam);
@@ -1568,19 +1577,19 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
        {
 
        case WM_SETFOCUS:
-               winuae_active (hWnd, minimized);
-               unsetminimized ();
-               dx_check ();
+               winuae_active(hWnd, minimized);
+               unsetminimized();
+               dx_check();
                break;
        case WM_SIZE:
                //write_log (_T("WM_SIZE %d\n"), wParam);
                if (hStatusWnd)
-                       SendMessage (hStatusWnd, WM_SIZE, wParam, lParam);
+                       SendMessage(hStatusWnd, WM_SIZE, wParam, lParam);
                if (wParam == SIZE_MINIMIZED && !minimized) {
-                       setminimized ();
-                       winuae_inactive (hWnd, minimized);
+                       setminimized();
+                       winuae_inactive(hWnd, minimized);
                }
-               if (D3D_resize)  {
+               if (D3D_resize) {
                        if (isfullscreen() > 0 && wParam == SIZE_RESTORED) {
                                write_log(_T("WM_SIZE restored\n"));
                                D3D_resize(1);
@@ -1598,14 +1607,14 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
                                unsetminimized();
                        winuae_inactive(hWnd, minimized);
                }
-               dx_check ();
+               dx_check();
                break;
        case WM_MOUSEACTIVATE:
-               if (isfocus () == 0)
+               if (isfocus() == 0)
                        ignorelbutton = true;
                break;
        case WM_ACTIVATEAPP:
-               D3D_restore ();
+               D3D_restore();
                if (!wParam && isfullscreen() > 0 && D3D_resize && !gui_active) {
                        write_log(_T("WM_ACTIVATEAPP inactive %p\n"), hWnd);
                        D3D_resize(-1);
@@ -1618,52 +1627,52 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
                        minimizewindow();
                }
 #ifdef RETROPLATFORM
-               rp_activate (wParam, lParam);
+               rp_activate(wParam, lParam);
 #endif
-               dx_check ();
+               dx_check();
                break;
 
        case WM_KEYDOWN:
-               if (dinput_wmkey ((uae_u32)lParam))
-                       inputdevice_add_inputcode (AKS_ENTERGUI, 1, NULL);
+               if (dinput_wmkey((uae_u32)lParam))
+                       inputdevice_add_inputcode(AKS_ENTERGUI, 1, NULL);
                return 0;
 
        case WM_LBUTTONUP:
-               if (dinput_winmouse () >= 0 && isfocus ())
-                       setmousebuttonstate (dinput_winmouse (), 0, 0);
+               if (dinput_winmouse() >= 0 && isfocus())
+                       setmousebuttonstate(dinput_winmouse(), 0, 0);
                return 0;
        case WM_LBUTTONDOWN:
        case WM_LBUTTONDBLCLK:
-               if (!mouseactive && !gui_active && (!mousehack_alive () || currprefs.input_tablet != TABLET_MOUSEHACK || (currprefs.input_tablet == TABLET_MOUSEHACK && !(currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC)) || isfullscreen () > 0)) {
+               if (!mouseactive && !gui_active && (!mousehack_alive() || currprefs.input_tablet != TABLET_MOUSEHACK || (currprefs.input_tablet == TABLET_MOUSEHACK && !(currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC)) || isfullscreen() > 0)) {
                        // borderless = do not capture with single-click
                        if (ignorelbutton) {
                                ignorelbutton = 0;
                                return 0;
                        }
-                       if (message == WM_LBUTTONDOWN && isfullscreen () == 0 && currprefs.win32_borderless && !rp_isactive ()) {
+                       if (message == WM_LBUTTONDOWN && isfullscreen() == 0 && currprefs.win32_borderless && !rp_isactive()) {
                                // full-window drag
-                               SendMessage (hAmigaWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0);
+                               SendMessage(hAmigaWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0);
                                return 0;
                        }
                        if (!pause_emulation || currprefs.win32_active_nocapture_pause)
-                               setmouseactive ((message == WM_LBUTTONDBLCLK || isfullscreen() > 0) ? 2 : 1);
-               } else if (dinput_winmouse () >= 0 && isfocus ()) {
-                       setmousebuttonstate (dinput_winmouse (), 0, 1);
+                               setmouseactive((message == WM_LBUTTONDBLCLK || isfullscreen() > 0) ? 2 : 1);
+               } else if (dinput_winmouse() >= 0 && isfocus()) {
+                       setmousebuttonstate(dinput_winmouse(), 0, 1);
                }
                return 0;
        case WM_RBUTTONUP:
-               if (dinput_winmouse () >= 0 && isfocus ())
-                       setmousebuttonstate (dinput_winmouse (), 1, 0);
+               if (dinput_winmouse() >= 0 && isfocus())
+                       setmousebuttonstate(dinput_winmouse(), 1, 0);
                return 0;
        case WM_RBUTTONDOWN:
        case WM_RBUTTONDBLCLK:
-               if (dinput_winmouse () >= 0 && isfocus () > 0)
-                       setmousebuttonstate (dinput_winmouse (), 1, 1);
+               if (dinput_winmouse() >= 0 && isfocus() > 0)
+                       setmousebuttonstate(dinput_winmouse(), 1, 1);
                return 0;
        case WM_MBUTTONUP:
                if (!(currprefs.input_mouse_untrap & MOUSEUNTRAP_MIDDLEBUTTON)) {
-                       if (dinput_winmouse () >= 0 && isfocus ())
-                               setmousebuttonstate (dinput_winmouse (), 2, 0);
+                       if (dinput_winmouse() >= 0 && isfocus())
+                               setmousebuttonstate(dinput_winmouse(), 2, 0);
                }
                return 0;
        case WM_MBUTTONDOWN:
@@ -1671,65 +1680,65 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
                if (currprefs.input_mouse_untrap & MOUSEUNTRAP_MIDDLEBUTTON) {
                        activationtoggle(true);
                } else {
-                       if (dinput_winmouse () >= 0 && isfocus () > 0)
-                               setmousebuttonstate (dinput_winmouse (), 2, 1);
+                       if (dinput_winmouse() >= 0 && isfocus() > 0)
+                               setmousebuttonstate(dinput_winmouse(), 2, 1);
                }
                return 0;
        case WM_XBUTTONUP:
-               if (dinput_winmouse () >= 0 && isfocus ()) {
-                       handleXbutton (wParam, 0);
+               if (dinput_winmouse() >= 0 && isfocus()) {
+                       handleXbutton(wParam, 0);
                        return TRUE;
                }
                return 0;
        case WM_XBUTTONDOWN:
        case WM_XBUTTONDBLCLK:
-               if (dinput_winmouse () >= 0 && isfocus () > 0) {
-                       handleXbutton (wParam, 1);
+               if (dinput_winmouse() >= 0 && isfocus() > 0) {
+                       handleXbutton(wParam, 1);
                        return TRUE;
                }
                return 0;
        case WM_MOUSEWHEEL:
-               if (dinput_winmouse () >= 0 && isfocus () > 0) {
-                       int val = ((short)HIWORD (wParam));
-                       setmousestate (dinput_winmouse (), 2, val, 0);
+               if (dinput_winmouse() >= 0 && isfocus() > 0) {
+                       int val = ((short)HIWORD(wParam));
+                       setmousestate(dinput_winmouse(), 2, val, 0);
                        if (val < 0)
-                               setmousebuttonstate (dinput_winmouse (), dinput_wheelbuttonstart () + 0, -1);
+                               setmousebuttonstate(dinput_winmouse(), dinput_wheelbuttonstart() + 0, -1);
                        else if (val > 0)
-                               setmousebuttonstate (dinput_winmouse (), dinput_wheelbuttonstart () + 1, -1);
+                               setmousebuttonstate(dinput_winmouse(), dinput_wheelbuttonstart() + 1, -1);
                        return TRUE;
                }
                return 0;
        case WM_MOUSEHWHEEL:
-               if (dinput_winmouse () >= 0 && isfocus () > 0) {
-                       int val = ((short)HIWORD (wParam));
-                       setmousestate (dinput_winmouse (), 3, val, 0);
+               if (dinput_winmouse() >= 0 && isfocus() > 0) {
+                       int val = ((short)HIWORD(wParam));
+                       setmousestate(dinput_winmouse(), 3, val, 0);
                        if (val < 0)
-                               setmousebuttonstate (dinput_winmouse (), dinput_wheelbuttonstart () + 2, -1);
+                               setmousebuttonstate(dinput_winmouse(), dinput_wheelbuttonstart() + 2, -1);
                        else if (val > 0)
-                               setmousebuttonstate (dinput_winmouse (), dinput_wheelbuttonstart () + 3, -1);
+                               setmousebuttonstate(dinput_winmouse(), dinput_wheelbuttonstart() + 3, -1);
                        return TRUE;
                }
                return 0;
 
        case WM_PAINT:
-               {
-                       static int recursive = 0;
-                       if (recursive == 0) {
-                               PAINTSTRUCT ps;
-                               recursive++;
-                               notice_screen_contents_lost ();
-                               hDC = BeginPaint (hWnd, &ps);
-                               /* Check to see if this WM_PAINT is coming while we've got the GUI visible */
-                               if (manual_painting_needed)
-                                       updatedisplayarea ();
-                               EndPaint (hWnd, &ps);
-                               recursive--;
-                       }
+       {
+               static int recursive = 0;
+               if (recursive == 0) {
+                       PAINTSTRUCT ps;
+                       recursive++;
+                       notice_screen_contents_lost();
+                       hDC = BeginPaint(hWnd, &ps);
+                       /* Check to see if this WM_PAINT is coming while we've got the GUI visible */
+                       if (manual_painting_needed)
+                               updatedisplayarea();
+                       EndPaint(hWnd, &ps);
+                       recursive--;
                }
-               return 0;
+       }
+       return 0;
 
        case WM_DROPFILES:
-               dragdrop (hWnd, (HDROP)wParam, &changed_prefs, -2);
+               dragdrop(hWnd, (HDROP)wParam, &changed_prefs, -2);
                return 0;
 
        case WM_TIMER:
@@ -1743,7 +1752,7 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
                                for (int i = 0; i < MEDIA_INSERT_QUEUE_SIZE; i++) {
                                        if (media_insert_queue[i]) {
                                                TCHAR *drvname = media_insert_queue[i];
-                                               int r = my_getvolumeinfo (drvname);
+                                               int r = my_getvolumeinfo(drvname);
                                                if (r < 0) {
                                                        if (media_insert_queue_type[i] > 0) {
                                                                write_log(_T("Mounting %s but drive is not ready, %d.. retrying %d..\n"), drvname, r, media_insert_queue_type[i]);
@@ -1758,7 +1767,7 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
                                                        DWORD type = GetDriveType(drvname);
                                                        if (type == DRIVE_CDROM)
                                                                inserted = -1;
-                                                       r = filesys_media_change (drvname, inserted, NULL);
+                                                       r = filesys_media_change(drvname, inserted, NULL);
                                                        if (r < 0) {
                                                                write_log(_T("Mounting %s but previous media change is still in progress..\n"), drvname);
                                                                restart = true;
@@ -1781,254 +1790,254 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
                } else if (wParam == 4) {
                        device_change_timer = 0;
                        KillTimer(hWnd, 4);
-                       inputdevice_devicechange (&changed_prefs);
+                       inputdevice_devicechange(&changed_prefs);
                        inputdevice_copyjports(&changed_prefs, &workprefs);
                } else if (wParam == 1) {
 #ifdef PARALLEL_PORT
-                       finishjob ();
+                       finishjob();
 #endif
                }
                return 0;
 
        case WM_CREATE:
 #ifdef RETROPLATFORM
-               rp_set_hwnd (hWnd);
+               rp_set_hwnd(hWnd);
 #endif
-               DragAcceptFiles (hWnd, TRUE);
-               normalcursor = LoadCursor (NULL, IDC_ARROW);
-               hwndNextViewer = SetClipboardViewer (hWnd); 
-               clipboard_init (hWnd);
+               DragAcceptFiles(hWnd, TRUE);
+               normalcursor = LoadCursor(NULL, IDC_ARROW);
+               hwndNextViewer = SetClipboardViewer(hWnd);
+               clipboard_init(hWnd);
                return 0;
 
        case WM_DESTROY:
                if (device_change_timer)
                        KillTimer(hWnd, 4);
                device_change_timer = 0;
-               ChangeClipboardChain (hWnd, hwndNextViewer); 
-               wait_keyrelease ();
-               inputdevice_unacquire ();
-               dinput_window ();
+               ChangeClipboardChain(hWnd, hwndNextViewer);
+               wait_keyrelease();
+               inputdevice_unacquire();
+               dinput_window();
                return 0;
 
        case WM_CLOSE:
-               uae_quit ();
+               uae_quit();
                return 0;
 
        case WM_WINDOWPOSCHANGED:
-               {
-                       WINDOWPOS *wp = (WINDOWPOS*)lParam;
-                       if (isfullscreen () <= 0) {
-                               if (!IsIconic (hWnd) && hWnd == hAmigaWnd) {
-                                       updatewinrect (false);
-                                       updatemouseclip ();
-                               }
+       {
+               WINDOWPOS *wp = (WINDOWPOS*)lParam;
+               if (isfullscreen() <= 0) {
+                       if (!IsIconic(hWnd) && hWnd == hAmigaWnd) {
+                               updatewinrect(false);
+                               updatemouseclip();
                        }
                }
-               break;
+       }
+       break;
 
        case WM_SETCURSOR:
-               {
-                       if ((HWND)wParam == hAmigaWnd && currprefs.input_tablet > 0 && (currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC) && isfullscreen () <= 0) {
-                               if (mousehack_alive ()) {
-                                       setcursorshape ();
-                                       return 1;
-                               }
+       {
+               if ((HWND)wParam == hAmigaWnd && currprefs.input_tablet > 0 && (currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC) && isfullscreen() <= 0) {
+                       if (mousehack_alive()) {
+                               setcursorshape();
+                               return 1;
                        }
-                       break;
                }
+               break;
+       }
 
        case WM_MOUSELEAVE:
                mouseinside = false;
                return 0;
 
        case WM_MOUSEMOVE:
-               {
-                       int wm = dinput_winmouse ();
-                       
-                       monitor_off = 0;
-                       if (!mouseinside) {
-                               TRACKMOUSEEVENT tme = { 0 };
-                               mouseinside = true;
-                               tme.cbSize = sizeof tme;
-                               tme.dwFlags = TME_LEAVE;
-                               tme.hwndTrack = hAmigaWnd;
-                               TrackMouseEvent (&tme);
-                       }
+       {
+               int wm = dinput_winmouse();
+
+               monitor_off = 0;
+               if (!mouseinside) {
+                       TRACKMOUSEEVENT tme = { 0 };
+                       mouseinside = true;
+                       tme.cbSize = sizeof tme;
+                       tme.dwFlags = TME_LEAVE;
+                       tme.hwndTrack = hAmigaWnd;
+                       TrackMouseEvent(&tme);
+               }
 
-                       mx = (signed short) LOWORD (lParam);
-                       my = (signed short) HIWORD (lParam);
+               mx = (signed short)LOWORD(lParam);
+               my = (signed short)HIWORD(lParam);
 
 #if 0
-                       setmousestate (0, 0, mx, 1);
-                       setmousestate (0, 1, my, 1);
-                       return 0;
+               setmousestate(0, 0, mx, 1);
+               setmousestate(0, 1, my, 1);
+               return 0;
 #endif
 
-                       //write_log (_T("%d %d %d %d %d %d %dx%d %dx%d\n"), wm, mouseactive, focus, showcursor, recapture, isfullscreen (), mx, my, mouseposx, mouseposy);
-                       mx -= mouseposx;
-                       my -= mouseposy;
+               //write_log (_T("%d %d %d %d %d %d %dx%d %dx%d\n"), wm, mouseactive, focus, showcursor, recapture, isfullscreen (), mx, my, mouseposx, mouseposy);
+               mx -= mouseposx;
+               my -= mouseposy;
 
-                       if (recapture && isfullscreen () <= 0) {
-                               enablecapture ();
-                               return 0;
-                       }
-                       if (wm < 0 && (istablet || currprefs.input_tablet >= TABLET_MOUSEHACK)) {
+               if (recapture && isfullscreen() <= 0) {
+                       enablecapture();
+                       return 0;
+               }
+               if (wm < 0 && (istablet || currprefs.input_tablet >= TABLET_MOUSEHACK)) {
+                       /* absolute */
+                       setmousestate(0, 0, mx, 1);
+                       setmousestate(0, 1, my, 1);
+                       return 0;
+               }
+               if (wm >= 0) {
+                       if (istablet || currprefs.input_tablet >= TABLET_MOUSEHACK) {
                                /* absolute */
-                               setmousestate (0, 0, mx, 1);
-                               setmousestate (0, 1, my, 1);
+                               setmousestate(dinput_winmouse(), 0, mx, 1);
+                               setmousestate(dinput_winmouse(), 1, my, 1);
                                return 0;
                        }
-                       if (wm >= 0) {
-                               if (istablet || currprefs.input_tablet >= TABLET_MOUSEHACK) {
-                                       /* absolute */
-                                       setmousestate (dinput_winmouse (), 0, mx, 1);
-                                       setmousestate (dinput_winmouse (), 1, my, 1);
-                                       return 0;
-                               }
-                               if (!focus || !mouseactive)
-                                       return DefWindowProc (hWnd, message, wParam, lParam);
-                               /* relative */
-                               int mxx = (amigawinclip_rect.left - amigawin_rect.left) + (amigawinclip_rect.right - amigawinclip_rect.left) / 2;
-                               int myy = (amigawinclip_rect.top - amigawin_rect.top) + (amigawinclip_rect.bottom - amigawinclip_rect.top) / 2;
-                               mx = mx - mxx;
-                               my = my - myy;
-                               setmousestate (dinput_winmouse (), 0, mx, 0);
-                               setmousestate (dinput_winmouse (), 1, my, 0);
-                       } else if (isfocus () < 0 && (istablet || currprefs.input_tablet >= TABLET_MOUSEHACK)) {
-                               setmousestate (0, 0, mx, 1);
-                               setmousestate (0, 1, my, 1);
-                       }
-                       if (showcursor || mouseactive)
-                               setcursor (LOWORD (lParam), HIWORD (lParam));
-                       return 0;
-               }
-               break;
+                       if (!focus || !mouseactive)
+                               return DefWindowProc(hWnd, message, wParam, lParam);
+                       /* relative */
+                       int mxx = (amigawinclip_rect.left - amigawin_rect.left) + (amigawinclip_rect.right - amigawinclip_rect.left) / 2;
+                       int myy = (amigawinclip_rect.top - amigawin_rect.top) + (amigawinclip_rect.bottom - amigawinclip_rect.top) / 2;
+                       mx = mx - mxx;
+                       my = my - myy;
+                       setmousestate(dinput_winmouse(), 0, mx, 0);
+                       setmousestate(dinput_winmouse(), 1, my, 0);
+               } else if (isfocus() < 0 && (istablet || currprefs.input_tablet >= TABLET_MOUSEHACK)) {
+                       setmousestate(0, 0, mx, 1);
+                       setmousestate(0, 1, my, 1);
+               }
+               if (showcursor || mouseactive)
+                       setcursor(LOWORD(lParam), HIWORD(lParam));
+               return 0;
+       }
+       break;
 
        case WM_MOVING:
-               {
-                       LRESULT lr = DefWindowProc (hWnd, message, wParam, lParam);
-                       return lr;
-               }
+       {
+               LRESULT lr = DefWindowProc(hWnd, message, wParam, lParam);
+               return lr;
+       }
        case WM_MOVE:
                return FALSE;
 
        case WM_ENABLE:
-               rp_set_enabledisable (wParam ? 1 : 0);
+               rp_set_enabledisable(wParam ? 1 : 0);
                return FALSE;
 
 #ifdef FILESYS
        case WM_USER + 2:
-               {
-                       LONG lEvent;
-                       PIDLIST_ABSOLUTE *ppidl;
-                       HANDLE lock = SHChangeNotification_Lock((HANDLE)wParam, (DWORD)lParam, &ppidl, &lEvent);
-                       if (lock) {
-                               if (lEvent == SHCNE_MEDIAINSERTED || lEvent == SHCNE_DRIVEADD || lEvent == SHCNE_MEDIAREMOVED || lEvent == SHCNE_DRIVEREMOVED) {
-                                       TCHAR drvpath[MAX_DPATH + 1];
-                                       if (SHGetPathFromIDList(ppidl[0], drvpath)) {
-                                               int inserted = (lEvent == SHCNE_MEDIAINSERTED || lEvent == SHCNE_DRIVEADD) ? 1 : 0;
-                                               write_log (_T("Shell Notification %d '%s'\n"), inserted, drvpath);
-                                               if (!win32_hardfile_media_change (drvpath, inserted)) { 
-                                                       if (inserted) {
-                                                               add_media_insert_queue(hWnd, drvpath, 5);
+       {
+               LONG lEvent;
+               PIDLIST_ABSOLUTE *ppidl;
+               HANDLE lock = SHChangeNotification_Lock((HANDLE)wParam, (DWORD)lParam, &ppidl, &lEvent);
+               if (lock) {
+                       if (lEvent == SHCNE_MEDIAINSERTED || lEvent == SHCNE_DRIVEADD || lEvent == SHCNE_MEDIAREMOVED || lEvent == SHCNE_DRIVEREMOVED) {
+                               TCHAR drvpath[MAX_DPATH + 1];
+                               if (SHGetPathFromIDList(ppidl[0], drvpath)) {
+                                       int inserted = (lEvent == SHCNE_MEDIAINSERTED || lEvent == SHCNE_DRIVEADD) ? 1 : 0;
+                                       write_log(_T("Shell Notification %d '%s'\n"), inserted, drvpath);
+                                       if (!win32_hardfile_media_change(drvpath, inserted)) {
+                                               if (inserted) {
+                                                       add_media_insert_queue(hWnd, drvpath, 5);
+                                               } else {
+                                                       if (is_in_media_queue(drvpath) >= 0) {
+                                                               write_log(_T("Insertion queued, removal event dropped\n"));
                                                        } else {
-                                                               if (is_in_media_queue(drvpath) >= 0) {
-                                                                       write_log(_T("Insertion queued, removal event dropped\n"));
-                                                               } else {
-                                                                       filesys_media_change (drvpath, inserted, NULL);
-                                                               }
+                                                               filesys_media_change(drvpath, inserted, NULL);
                                                        }
                                                }
                                        }
                                }
-                               SHChangeNotification_Unlock(lock);
                        }
+                       SHChangeNotification_Unlock(lock);
                }
-               return TRUE;
+       }
+       return TRUE;
        case WM_DEVICECHANGE:
-               {
-                       extern bool win32_spti_media_change (TCHAR driveletter, int insert);
-                       extern bool win32_ioctl_media_change (TCHAR driveletter, int insert);
-                       DEV_BROADCAST_HDR *pBHdr = (DEV_BROADCAST_HDR *)lParam;
-                       int devicechange = 0;
-                       if (pBHdr && pBHdr->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) {
-                               bool ignore = false;
-                               DEV_BROADCAST_DEVICEINTERFACE *dbd = (DEV_BROADCAST_DEVICEINTERFACE*)lParam;
-                               GUID *g = &dbd->dbcc_classguid;
-                               const GUID *ghid = &GUID_DEVINTERFACE_HID;
-                               // if HID and rawhid active: ignore this event
-                               if (!memcmp(g, ghid, sizeof(GUID))) {
-                                       if (is_hid_rawinput())
-                                               ignore = true;
-                               }
-                               if (!ignore) {
-                                       if (wParam == DBT_DEVICEREMOVECOMPLETE)
-                                               devicechange = 1;
-                                       else if (wParam == DBT_DEVICEARRIVAL)
-                                               devicechange = 1;
-                               }
-                       } else if (pBHdr && pBHdr->dbch_devicetype == DBT_DEVTYP_VOLUME) {
-                               DEV_BROADCAST_VOLUME *pBVol = (DEV_BROADCAST_VOLUME *)lParam;
-                               if (wParam == DBT_DEVICEARRIVAL || wParam == DBT_DEVICEREMOVECOMPLETE) {
-                                       if (pBVol->dbcv_unitmask) {
-                                               int inserted, i;
-                                               TCHAR drive;
-                                               UINT errormode = SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
-                                               for (i = 0; i <= 'Z'-'A'; i++) {
-                                                       if (pBVol->dbcv_unitmask & (1 << i)) {
-                                                               TCHAR drvname[10];
-                                                               int type;
-
-                                                               drive = 'A' + i;
-                                                               _stprintf (drvname, _T("%c:\\"), drive);
-                                                               type = GetDriveType (drvname);
-                                                               if (wParam == DBT_DEVICEARRIVAL)
-                                                                       inserted = 1;
-                                                               else
-                                                                       inserted = 0;
-                                                               if (pBVol->dbcv_flags & DBTF_MEDIA) {
-                                                                       bool matched = false;
-                                                                       matched |= win32_spti_media_change (drive, inserted);
-                                                                       matched |= win32_ioctl_media_change (drive, inserted);
-                                                               }
-                                                               if (type == DRIVE_REMOVABLE || type == DRIVE_CDROM || !inserted) {
-                                                                       write_log (_T("WM_DEVICECHANGE '%s' type=%d inserted=%d\n"), drvname, type, inserted);
-                                                                       if (!win32_hardfile_media_change (drvname, inserted)) {
-                                                                               if (inserted) {
-                                                                                       add_media_insert_queue(hWnd, drvname, 0);
+       {
+               extern bool win32_spti_media_change(TCHAR driveletter, int insert);
+               extern bool win32_ioctl_media_change(TCHAR driveletter, int insert);
+               DEV_BROADCAST_HDR *pBHdr = (DEV_BROADCAST_HDR *)lParam;
+               int devicechange = 0;
+               if (pBHdr && pBHdr->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) {
+                       bool ignore = false;
+                       DEV_BROADCAST_DEVICEINTERFACE *dbd = (DEV_BROADCAST_DEVICEINTERFACE*)lParam;
+                       GUID *g = &dbd->dbcc_classguid;
+                       const GUID *ghid = &GUID_DEVINTERFACE_HID;
+                       // if HID and rawhid active: ignore this event
+                       if (!memcmp(g, ghid, sizeof(GUID))) {
+                               if (is_hid_rawinput())
+                                       ignore = true;
+                       }
+                       if (!ignore) {
+                               if (wParam == DBT_DEVICEREMOVECOMPLETE)
+                                       devicechange = 1;
+                               else if (wParam == DBT_DEVICEARRIVAL)
+                                       devicechange = 1;
+                       }
+               } else if (pBHdr && pBHdr->dbch_devicetype == DBT_DEVTYP_VOLUME) {
+                       DEV_BROADCAST_VOLUME *pBVol = (DEV_BROADCAST_VOLUME *)lParam;
+                       if (wParam == DBT_DEVICEARRIVAL || wParam == DBT_DEVICEREMOVECOMPLETE) {
+                               if (pBVol->dbcv_unitmask) {
+                                       int inserted, i;
+                                       TCHAR drive;
+                                       UINT errormode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
+                                       for (i = 0; i <= 'Z' - 'A'; i++) {
+                                               if (pBVol->dbcv_unitmask & (1 << i)) {
+                                                       TCHAR drvname[10];
+                                                       int type;
+
+                                                       drive = 'A' + i;
+                                                       _stprintf(drvname, _T("%c:\\"), drive);
+                                                       type = GetDriveType(drvname);
+                                                       if (wParam == DBT_DEVICEARRIVAL)
+                                                               inserted = 1;
+                                                       else
+                                                               inserted = 0;
+                                                       if (pBVol->dbcv_flags & DBTF_MEDIA) {
+                                                               bool matched = false;
+                                                               matched |= win32_spti_media_change(drive, inserted);
+                                                               matched |= win32_ioctl_media_change(drive, inserted);
+                                                       }
+                                                       if (type == DRIVE_REMOVABLE || type == DRIVE_CDROM || !inserted) {
+                                                               write_log(_T("WM_DEVICECHANGE '%s' type=%d inserted=%d\n"), drvname, type, inserted);
+                                                               if (!win32_hardfile_media_change(drvname, inserted)) {
+                                                                       if (inserted) {
+                                                                               add_media_insert_queue(hWnd, drvname, 0);
+                                                                       } else {
+                                                                               if (is_in_media_queue(drvname) >= 0) {
+                                                                                       write_log(_T("Insertion queued, removal event dropped\n"));
                                                                                } else {
-                                                                                       if (is_in_media_queue(drvname) >= 0) {
-                                                                                               write_log(_T("Insertion queued, removal event dropped\n"));
-                                                                                       } else {
-                                                                                               filesys_media_change (drvname, inserted, NULL);
-                                                                                       }
+                                                                                       filesys_media_change(drvname, inserted, NULL);
                                                                                }
                                                                        }
                                                                }
                                                        }
                                                }
-                                               SetErrorMode (errormode);
                                        }
+                                       SetErrorMode(errormode);
                                }
                        }
-                       if (devicechange) { // && !is_hid_rawinput()) {
-                               if (device_change_timer)
-                                       KillTimer(hWnd, 4);
-                               device_change_timer = 1;
-                               SetTimer(hWnd, 4, 2000, NULL);
-                       }
                }
+               if (devicechange) { // && !is_hid_rawinput()) {
+                       if (device_change_timer)
+                               KillTimer(hWnd, 4);
+                       device_change_timer = 1;
+                       SetTimer(hWnd, 4, 2000, NULL);
+               }
+       }
 #endif
-               return TRUE;
+       return TRUE;
 
        case WM_SYSCOMMAND:
                switch (wParam & 0xfff0) // Check System Calls
                {
-               // SetThreadExecutionState handles this now
+                       // SetThreadExecutionState handles this now
                case SC_SCREENSAVE: // Screensaver Trying To Start?
                        break;
                case SC_MONITORPOWER: // Monitor Trying To Enter Powersave?
-                       write_log (_T("SC_MONITORPOWER=%d"), lParam);
+                       write_log(_T("SC_MONITORPOWER=%d"), lParam);
                        if ((int)lParam < 0)
                                monitor_off = 0;
                        else if ((int)lParam > 0)
@@ -2036,145 +2045,145 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
                        break;
 
                default:
-                       {
-                               LRESULT lr;
+               {
+                       LRESULT lr;
 
 #ifdef RETROPLATFORM
-                               if ((wParam & 0xfff0) == SC_CLOSE) {
-                                       if (rp_close ())
-                                               return 0;
-                               }
+                       if ((wParam & 0xfff0) == SC_CLOSE) {
+                               if (rp_close())
+                                       return 0;
+                       }
 #endif
-                               lr = DefWindowProc (hWnd, message, wParam, lParam);
-                               switch (wParam & 0xfff0)
-                               {
-                               case SC_MINIMIZE:
-                                       winuae_inactive (hWnd, 1);
-                                       break;
-                               case SC_RESTORE:
-                                       break;
-                               case SC_CLOSE:
-                                       PostQuitMessage (0);
-                                       break;
-                               }
-                               return lr;
+                       lr = DefWindowProc(hWnd, message, wParam, lParam);
+                       switch (wParam & 0xfff0)
+                       {
+                       case SC_MINIMIZE:
+                               winuae_inactive(hWnd, 1);
+                               break;
+                       case SC_RESTORE:
+                               break;
+                       case SC_CLOSE:
+                               PostQuitMessage(0);
+                               break;
                        }
+                       return lr;
+               }
                }
                break;
 
        case WM_SYSKEYDOWN:
-               if(currprefs.win32_ctrl_F11_is_quit && wParam == VK_F4)
+               if (currprefs.win32_ctrl_F11_is_quit && wParam == VK_F4)
                        return 0;
                break;
 
        case WM_NOTIFY:
-               {
-                       LPNMHDR nm = (LPNMHDR)lParam;
-                       if (nm->hwndFrom == hStatusWnd) {
-                               switch (nm->code)
-                               {
-                                       /* status bar clicks */
-                                       case NM_CLICK:
-                                       case NM_RCLICK:
-                                       {
-                                               LPNMMOUSE lpnm = (LPNMMOUSE) lParam;
-                                               int num = (int)lpnm->dwItemSpec;
-                                               int df0 = 9;
-                                               if (num >= df0 && num <= df0 + 3) { // DF0-DF3
-                                                       num -= df0;
-                                                       if (nm->code == NM_RCLICK) {
-                                                               disk_eject (num);
-                                                       } else if (changed_prefs.floppyslots[num].dfxtype >= 0) {
-                                                               DiskSelection (hWnd, IDC_DF0 + num, 0, &changed_prefs, NULL, NULL);
-                                                               disk_insert (num, changed_prefs.floppyslots[num].df);
-                                                       }
-                                               } else if (num == 5) {
-                                                       if (nm->code == NM_CLICK) // POWER
-                                                               inputdevice_add_inputcode (AKS_ENTERGUI, 1, NULL);
-                                                       else
-                                                               uae_reset (0, 1);
-                                               } else if (num == 4) {
-                                                       if (pause_emulation) {
-                                                               resumepaused (9);
-                                                               setmouseactive (1);
-                                                       }
-                                               }
-                                               return TRUE;
+       {
+               LPNMHDR nm = (LPNMHDR)lParam;
+               if (nm->hwndFrom == hStatusWnd) {
+                       switch (nm->code)
+                       {
+                               /* status bar clicks */
+                       case NM_CLICK:
+                       case NM_RCLICK:
+                       {
+                               LPNMMOUSE lpnm = (LPNMMOUSE)lParam;
+                               int num = (int)lpnm->dwItemSpec;
+                               int df0 = 9;
+                               if (num >= df0 && num <= df0 + 3) { // DF0-DF3
+                                       num -= df0;
+                                       if (nm->code == NM_RCLICK) {
+                                               disk_eject(num);
+                                       } else if (changed_prefs.floppyslots[num].dfxtype >= 0) {
+                                               DiskSelection(hWnd, IDC_DF0 + num, 0, &changed_prefs, NULL, NULL);
+                                               disk_insert(num, changed_prefs.floppyslots[num].df);
+                                       }
+                               } else if (num == 5) {
+                                       if (nm->code == NM_CLICK) // POWER
+                                               inputdevice_add_inputcode(AKS_ENTERGUI, 1, NULL);
+                                       else
+                                               uae_reset(0, 1);
+                               } else if (num == 4) {
+                                       if (pause_emulation) {
+                                               resumepaused(9);
+                                               setmouseactive(1);
                                        }
                                }
+                               return TRUE;
+                       }
                        }
                }
-               break;
+       }
+       break;
 
-       case WM_CHANGECBCHAIN: 
-               if ((HWND) wParam == hwndNextViewer) 
-                       hwndNextViewer = (HWND) lParam; 
-               else if (hwndNextViewer != NULL) 
-                       SendMessage (hwndNextViewer, message, wParam, lParam); 
+       case WM_CHANGECBCHAIN:
+               if ((HWND)wParam == hwndNextViewer)
+                       hwndNextViewer = (HWND)lParam;
+               else if (hwndNextViewer != NULL)
+                       SendMessage(hwndNextViewer, message, wParam, lParam);
                return 0;
        case WM_DRAWCLIPBOARD:
-               clipboard_changed (hWnd);
-               SendMessage (hwndNextViewer, message, wParam, lParam); 
+               clipboard_changed(hWnd);
+               SendMessage(hwndNextViewer, message, wParam, lParam);
                return 0;
 
        case WM_WTSSESSION_CHANGE:
+       {
+               static int wasactive;
+               switch (wParam)
                {
-                       static int wasactive;
-                       switch (wParam)
-                       {
-                       case WTS_CONSOLE_CONNECT:
-                       case WTS_SESSION_UNLOCK:
-                               if (wasactive)
-                                       winuae_active (hWnd, 0);
-                               wasactive = 0;
-                               break;
-                       case WTS_CONSOLE_DISCONNECT:
-                       case WTS_SESSION_LOCK:
-                               wasactive = mouseactive;
-                               winuae_inactive (hWnd, 0);
-                               break;
-                       }
+               case WTS_CONSOLE_CONNECT:
+               case WTS_SESSION_UNLOCK:
+                       if (wasactive)
+                               winuae_active(hWnd, 0);
+                       wasactive = 0;
+                       break;
+               case WTS_CONSOLE_DISCONNECT:
+               case WTS_SESSION_LOCK:
+                       wasactive = mouseactive;
+                       winuae_inactive(hWnd, 0);
+                       break;
                }
+       }
 
        case WT_PROXIMITY:
-               {
-                       send_tablet_proximity (LOWORD (lParam) ? 1 : 0);
+       {
+               send_tablet_proximity(LOWORD(lParam) ? 1 : 0);
+               return 0;
+       }
+       case WT_PACKET:
+       {
+               typedef BOOL(API* WTPACKET)(HCTX, UINT, LPVOID);
+               extern WTPACKET pWTPacket;
+               PACKET pkt;
+               if (inputdevice_is_tablet() <= 0 && !currprefs.tablet_library && !is_touch_lightpen()) {
+                       close_tablet(tablet);
+                       tablet = NULL;
                        return 0;
                }
-       case WT_PACKET:
-               {
-                       typedef BOOL(API* WTPACKET)(HCTX, UINT, LPVOID);
-                       extern WTPACKET pWTPacket;
-                       PACKET pkt;
-                       if (inputdevice_is_tablet () <= 0 && !currprefs.tablet_library && !is_touch_lightpen()) {
-                               close_tablet (tablet);
-                               tablet = NULL;
-                               return 0;
-                       }
-                       if (pWTPacket ((HCTX)lParam, wParam, &pkt)) {
-                               int x, y, z, pres, proxi;
-                               DWORD buttons;
-                               ORIENTATION ori;
-                               ROTATION rot;
-
-                               x = pkt.pkX;
-                               y = pkt.pkY;
-                               z = pkt.pkZ;
-                               pres = pkt.pkNormalPressure;
-                               ori = pkt.pkOrientation;
-                               rot = pkt.pkRotation;
-                               buttons = pkt.pkButtons;
-                               proxi = pkt.pkStatus;
-                               send_tablet (x, y, z, pres, buttons, proxi, ori.orAzimuth, ori.orAltitude, ori.orTwist, rot.roPitch, rot.roRoll, rot.roYaw, &amigawin_rect);
+               if (pWTPacket((HCTX)lParam, wParam, &pkt)) {
+                       int x, y, z, pres, proxi;
+                       DWORD buttons;
+                       ORIENTATION ori;
+                       ROTATION rot;
+
+                       x = pkt.pkX;
+                       y = pkt.pkY;
+                       z = pkt.pkZ;
+                       pres = pkt.pkNormalPressure;
+                       ori = pkt.pkOrientation;
+                       rot = pkt.pkRotation;
+                       buttons = pkt.pkButtons;
+                       proxi = pkt.pkStatus;
+                       send_tablet(x, y, z, pres, buttons, proxi, ori.orAzimuth, ori.orAltitude, ori.orTwist, rot.roPitch, rot.roRoll, rot.roYaw, &amigawin_rect);
 
-                       }
-                       return 0;
                }
+               return 0;
+       }
 
 #if TOUCH_SUPPORT
        case WM_TOUCH:
-       processtouch(hWnd, wParam, lParam);
-       break;
+               processtouch(hWnd, wParam, lParam);
+               break;
 #endif
 
        default:
@@ -2286,6 +2295,8 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam,
 #if TOUCH_SUPPORT
        case WM_TOUCH:
 #endif
+       case WM_QUERYENDSESSION:
+       case WM_ENDSESSION:
                return AmigaWindowProc (hWnd, message, wParam, lParam);
 #if 0
        case WM_DISPLAYCHANGE:
@@ -2534,10 +2545,13 @@ static LRESULT CALLBACK HiddenWindowProc (HWND hWnd, UINT message, WPARAM wParam
                        SetForegroundWindow (hGUIWnd ? hGUIWnd : hMainWnd);
                        break;
                case WM_LBUTTONDBLCLK:
+               case NIN_SELECT:
                        if (!gui_active)
                                inputdevice_add_inputcode (AKS_ENTERGUI, 1, NULL);
                        break;
                case WM_RBUTTONDOWN:
+               case WM_CONTEXTMENU:
+               case NIN_KEYSELECT:
                        if (!gui_active)
                                systraymenu (hWnd);
                        else
@@ -3910,6 +3924,7 @@ void target_save_options (struct zfile *f, struct uae_prefs *p)
        cfgfile_target_dwrite_str (f, _T("gui_active_page"), p->win32_guiactivepage);
        cfgfile_target_dwrite_bool(f, _T("filesystem_mangle_reserved_names"), p->win32_filesystem_mangle_reserved_names);
        cfgfile_target_dwrite_bool(f, _T("right_control_is_right_win"), p->right_control_is_right_win_key);
+       cfgfile_target_dwrite_bool(f, _T("windows_shutdown_notification"), p->win32_shutdown_notification);
 
        cfgfile_target_dwrite(f, _T("extraframewait"), _T("%d"), extraframewait);
        cfgfile_target_dwrite(f, _T("extraframewait_us"), _T("%d"), extraframewait2);
@@ -4031,6 +4046,7 @@ int target_parse_option (struct uae_prefs *p, const TCHAR *option, const TCHAR *
                || cfgfile_intval(option, value, _T("kbledmode"), &p->win32_kbledmode, 1)
                || cfgfile_yesno(option, value, _T("filesystem_mangle_reserved_names"), &p->win32_filesystem_mangle_reserved_names)
                || cfgfile_yesno(option, value, _T("right_control_is_right_win"), &p->right_control_is_right_win_key)
+               || cfgfile_yesno(option, value, _T("windows_shutdown_notification"), &p->win32_shutdown_notification)
                || cfgfile_intval(option, value, _T("extraframewait"), &extraframewait, 1)
                || cfgfile_intval(option, value, _T("extraframewait_us"), &extraframewait2, 1)
                || cfgfile_intval(option, value, _T("framelatency"), &forcedframelatency, 1)
@@ -5280,6 +5296,8 @@ static int osdetect (void)
                        os_win7 = 1;
                if (osVersion.dwMajorVersion >= 7 || (osVersion.dwMajorVersion == 6 && osVersion.dwMinorVersion >= 2))
                        os_win8 = 1;
+               if (osVersion.dwMajorVersion >= 7 || (osVersion.dwMajorVersion == 6 && osVersion.dwMinorVersion >= 3))
+                       os_win8 = 2;
                if (osVersion.dwMajorVersion >= 10)
                        os_win10 = 1;
                if (SystemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
@@ -6562,7 +6580,7 @@ int execute_command (TCHAR *cmd)
 #endif
 
 #include "driveclick.h"
-static int drvsampleres[] = {
+static const int drvsampleres[] = {
        IDR_DRIVE_CLICK_A500_1, DS_CLICK,
        IDR_DRIVE_SPIN_A500_1, DS_SPIN,
        IDR_DRIVE_SPINND_A500_1, DS_SPINND,
@@ -6905,16 +6923,29 @@ void systray (HWND hwnd, int remove)
        nid.cbSize = sizeof (nid);
        nid.hWnd = hwnd;
        nid.hIcon = LoadIcon (hInst, (LPCWSTR)MAKEINTRESOURCE (IDI_APPICON));
-       nid.uFlags = NIF_ICON | NIF_MESSAGE | (os_win8 ? NIF_GUID : 0);
+       nid.uFlags = NIF_ICON | NIF_MESSAGE | (os_win7 ? NIF_GUID : 0);
        nid.uCallbackMessage = WM_USER + 1;
-       if (os_win8) {
+       nid.uVersion = os_win7 ? NOTIFYICON_VERSION_4 : NOTIFYICON_VERSION;
+       nid.dwInfoFlags = NIIF_USER;
+       _tcscpy(nid.szInfo, _T("WinUAE"));
+       _tcscpy(nid.szInfoTitle, _T("WinUAE"));
+       nid.hBalloonIcon = nid.hIcon;
+       if (os_win7) {
                nid.guidItem = iconguid;
+               if (!remove) {
+                       // if guid identifier: always remove first.
+                       // old icon may not have been removed due to crash etc
+                       Shell_NotifyIcon(NIM_DELETE, &nid);
+               }
        }
        v = Shell_NotifyIcon (remove ? NIM_DELETE : NIM_ADD, &nid);
        //write_log (_T("notif: Shell_NotifyIcon returned %d\n"), v);
        if (v) {
-               if (remove)
+               if (remove) {
                        TaskbarRestartHWND = NULL;
+               } else {
+                       v = Shell_NotifyIcon(NIM_SETVERSION, &nid);
+               }
        } else {
                DWORD err = GetLastError ();
                write_log (_T("Notify error code = %x (%d)\n"),  err, err);
index 0c7d037a455edb0130d325ad091df0ee9fac91f1..622b917fce21181caf4ee0c570797caad07626db 100644 (file)
 #define LANG_DLL_FULL_VERSION_MATCH 1
 
 #if WINUAEPUBLICBETA
-#define WINUAEBETA _T("17")
+#define WINUAEBETA _T("18")
 #else
 #define WINUAEBETA _T("")
 #endif
 
-#define WINUAEDATE MAKEBD(2018, 1, 6)
+#define WINUAEDATE MAKEBD(2018, 1, 12)
 
 //#define WINUAEEXTRA _T("AmiKit Preview")
 //#define WINUAEEXTRA _T("Amiga Forever Edition")
index 3390afe442354e3b692dd6e1e1d185dd51ef03d3..7b7653b20d01df23ca1e62eb7de832aa4274e0f5 100644 (file)
@@ -4434,6 +4434,20 @@ static int create_windows_2 (void)
        setDwmEnableMMCSS (true);
        prevsbheight = sbheight;
        rawinput_alloc();
+
+       if (currprefs.win32_shutdown_notification && !rp_isactive()) {
+               typedef BOOL(WINAPI *SHUTDOWNBLOCKREASONCREATE)(HWND, LPCWSTR);
+               SHUTDOWNBLOCKREASONCREATE pShutdownBlockReasonCreate;
+               pShutdownBlockReasonCreate = (SHUTDOWNBLOCKREASONCREATE)GetProcAddress(GetModuleHandle(_T("user32.dll")), "ShutdownBlockReasonCreate");
+               if (pShutdownBlockReasonCreate) {
+                       TCHAR tmp[MAX_DPATH];
+                       WIN32GUI_LoadUIString(IDS_SHUTDOWN_NOTIFICATION, tmp, MAX_DPATH);
+                       if (!pShutdownBlockReasonCreate(hMainWnd, tmp)) {
+                               write_log(_T("ShutdownBlockReasonCreate %08x\n"), GetLastError());
+                       }
+               }
+       }
+
        return 1;
 }
 
index b3d424bd48e15857203f88476864866c0f665bf6..613116f2aad65d6adb8e5af310c0549b1ad6cff5 100644 (file)
@@ -4378,6 +4378,7 @@ static const struct miscentry misclist[] = {
        { 0, 0, _T("Master harddrive write protection"), &workprefs.harddrive_read_only },
        { 0, 0, _T("Hide all UAE autoconfig boards"), &workprefs.uae_hide_autoconfig },
        { 0, 1, _T("Right Control = Right Windows key"), &workprefs.right_control_is_right_win_key },
+       { 0, 0, _T("Windows shutdown/logoff notification"), &workprefs.win32_shutdown_notification },
        { 0, NULL }
 };
 
index d2ead9676f171c57de9b37b1a93c65e2dfbcef08..2c054a3fcb23aee46cf1d50b2c70f5d4c4daa187 100644 (file)
@@ -5,6 +5,14 @@ JIT Direct current rules are less complex now. It automatically switches off onl
   Note that in 64-bit version RTG VRAM must be inside of reserved natmem space. (Outside = error message and return back to GUI)\r
 \r
 \r
+- Added real CHS-only IDE drive HDF imaging support that works with some (single? all?) USB adapters that don't natively support CHS only drives (Drive appears as having zero byte capacity in Windows Disk Manager and SCSI READ CAPACITY returns FFFFFFFF00000200) Imager first asks for drive's CHS geometry and then uses standard Direct SCSI mode READ (10) to read correct blocks. This works as long as adapter blindly copies SCSI LBA fields to ATA CHS/LBA registers internally.\r
+- Default D3D11 fullscreen refresh rate may have incorrectly chosen native interlaced mode if it was available.\r
+- D3D11 no buffer fullscreen vsync does not update as fast as possible anymore.\r
+- Restored norawinput keyboard and mouse modes (-norawinput_all disables all, -norawinput_keyboard and -norawinput_mouse to only disable mouse or keyboard rawinput mode). They were removed in 3.3 but apparently RDP does not support rawinput keyboard.\r
+- BCD instruction V-flag fix, 68020+ BCD instructions don't do undocumented V-flag modifications, only 68000/010, previously it was only done if 68040+.\r
+- Notification icon handling updated, previous Windows 7 workaround removed.\r
+- Added Misc panel option to show WinUAE in Windows shutdown/logoff screen (Vista or newer) if emulation session is active.\r
+\r
 Beta 17:\r
 \r
 - Added Profex HD3300 emulation and boot ROM.\r
index 13bb903cc91fc2b72f19175bad7a3cb4cf23cc63..6d04d1a1871f0b28881a37923611448dace4bcf4 100644 (file)
--- a/scsi.cpp
+++ b/scsi.cpp
@@ -74,7 +74,7 @@ extern int log_scsiemu;
 
 static const int outcmd[] = { 0x04, 0x0a, 0x0c, 0x11, 0x2a, 0xaa, 0x15, 0x55, 0x0f, -1 };
 static const int incmd[] = { 0x01, 0x03, 0x08, 0x0e, 0x12, 0x1a, 0x5a, 0x25, 0x28, 0x34, 0x37, 0x42, 0x43, 0xa8, 0x51, 0x52, 0xb9, 0xbd, 0xd8, 0xd9, 0xbe, -1 };
-static const int nonecmd[] = { 0x00, 0x05, 0x06, 0x07, 0x09, 0x0b, 0x10, 0x11, 0x16, 0x17, 0x19, 0x1b, 0x1d, 0x1e, 0x2b, 0x35, 0x45, 0x47, 0x48, 0x49, 0x4b, 0x4e, 0xa5, 0xa9, 0xba, 0xbc, 0xe0, 0xe3, 0xe4, -1 };
+static const int nonecmd[] = { 0x00, 0x05, 0x06, 0x07, 0x09, 0x0b, 0x10, 0x16, 0x17, 0x19, 0x1b, 0x1d, 0x1e, 0x2b, 0x35, 0x45, 0x47, 0x48, 0x49, 0x4b, 0x4e, 0xa5, 0xa9, 0xba, 0xbc, 0xe0, 0xe3, 0xe4, -1 };
 static const int scsicmdsizes[] = { 6, 10, 10, 12, 16, 12, 10, 6 };
 
 static void scsi_illegal_command(struct scsi_data *sd)