From 924a5254a8f30a9ed432d27fff79e2c5cd45cc10 Mon Sep 17 00:00:00 2001
From: Toni Spets <toni.spets@iki.fi>
Date: Mon, 15 Nov 2010 20:36:22 +0200
Subject: [PATCH] Allow disabling mouse hacks

---
 main.c  | 15 ++++++++++++++-
 main.h  |  1 +
 mouse.c |  9 ++++++---
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/main.c b/main.c
index fea258b..bcbc469 100644
--- a/main.c
+++ b/main.c
@@ -537,6 +537,8 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
             "filter=nearest\n"
             "; mouse sensitivity scaling\n"
             "adjmouse=false\n"
+            "; enable C&C/RA mouse hack\n"
+            "mhack=true\n"
         , fh);
         fclose(fh);
     }
@@ -578,7 +580,8 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
     {
         This->render.filter = 0;
     }
-    GetPrivateProfileStringA("ddraw", "adjmouse", "TRUE", tmp, sizeof(tmp), ini_path);
+
+    GetPrivateProfileStringA("ddraw", "adjmouse", "FALSE", tmp, sizeof(tmp), ini_path);
     if(tolower(tmp[0]) == 'y' || tolower(tmp[0]) == 't' || tmp[0] == '1')
     {
         This->adjmouse = TRUE;
@@ -588,6 +591,16 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
         This->adjmouse = FALSE;
     }
 
+    GetPrivateProfileStringA("ddraw", "mhack", "TRUE", tmp, sizeof(tmp), ini_path);
+    if(tolower(tmp[0]) == 'y' || tolower(tmp[0]) == 't' || tmp[0] == '1')
+    {
+        This->mhack = TRUE;
+    }
+    else
+    {
+        This->mhack = FALSE;
+    }
+
     This->Ref = 0;
     ddraw_AddRef(This);
 
diff --git a/main.h b/main.h
index c24fb10..f218a87 100644
--- a/main.h
+++ b/main.h
@@ -69,6 +69,7 @@ typedef struct IDirectDrawImpl
     RECT cursorclip;
     BOOL locked;
     BOOL adjmouse;
+    BOOL mhack;
 
     BOOL key_ctrl;
     BOOL key_tab;
diff --git a/mouse.c b/mouse.c
index f5f371c..bea2baa 100644
--- a/mouse.c
+++ b/mouse.c
@@ -168,7 +168,10 @@ void mouse_unlock()
 
 void mouse_init(HWND hWnd)
 {
-    SetCursor(LoadCursor(NULL, IDC_ARROW));
-    hack_iat(&hacks[0]);
-    mouse_active = TRUE;
+    if(ddraw->mhack)
+    {
+        SetCursor(LoadCursor(NULL, IDC_ARROW));
+        hack_iat(&hacks[0]);
+        mouse_active = TRUE;
+    }
 }