1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-24 17:49:52 +01:00

Revert "remove "handlemouse" setting"

This reverts commit f1bcff220deee72552ea26c7695195409714f8e3.
This commit is contained in:
FunkyFr3sh 2021-06-16 07:47:15 +02:00
parent 6043bc9061
commit abdb74942b
10 changed files with 181 additions and 175 deletions

View File

@ -104,6 +104,7 @@ typedef struct CNCDDRAW
BOOL fullscreen; BOOL fullscreen;
BOOL maintas; BOOL maintas;
BOOL noactivateapp; BOOL noactivateapp;
BOOL handlemouse;
char shader[MAX_PATH]; char shader[MAX_PATH];
BOOL wine; BOOL wine;
BOOL altenter; BOOL altenter;
@ -130,7 +131,6 @@ typedef struct CNCDDRAW
int mouse_y_adjust; int mouse_y_adjust;
void* last_freed_palette; /* Dungeon Keeper hack */ void* last_freed_palette; /* Dungeon Keeper hack */
BOOL child_window_exists; BOOL child_window_exists;
BOOL got_child_windows;
DWORD last_set_window_pos_tick; /* WINE hack */ DWORD last_set_window_pos_tick; /* WINE hack */
BOOL show_driver_warning; BOOL show_driver_warning;
SPEEDLIMITER ticks_limiter; SPEEDLIMITER ticks_limiter;

View File

@ -40,7 +40,7 @@ void cfg_load()
g_ddraw->border = cfg_get_bool("border", TRUE); g_ddraw->border = cfg_get_bool("border", TRUE);
g_ddraw->boxing = cfg_get_bool("boxing", FALSE); g_ddraw->boxing = cfg_get_bool("boxing", FALSE);
g_ddraw->maintas = cfg_get_bool("maintas", FALSE); g_ddraw->maintas = cfg_get_bool("maintas", FALSE);
g_ddraw->adjmouse = cfg_get_bool("adjmouse", TRUE); g_ddraw->adjmouse = cfg_get_bool("adjmouse", FALSE);
g_ddraw->devmode = cfg_get_bool("devmode", FALSE); g_ddraw->devmode = cfg_get_bool("devmode", FALSE);
g_ddraw->vsync = cfg_get_bool("vsync", FALSE); g_ddraw->vsync = cfg_get_bool("vsync", FALSE);
g_ddraw->noactivateapp = cfg_get_bool("noactivateapp", FALSE); g_ddraw->noactivateapp = cfg_get_bool("noactivateapp", FALSE);
@ -112,6 +112,11 @@ void cfg_load()
g_config.window_rect.left = g_config.window_rect.top = -32000; g_config.window_rect.left = g_config.window_rect.top = -32000;
} }
if (!(g_ddraw->handlemouse = cfg_get_bool("handlemouse", TRUE)))
{
g_ddraw->adjmouse = TRUE;
}
if (cfg_get_bool("singlecpu", TRUE)) if (cfg_get_bool("singlecpu", TRUE))
{ {
SetProcessAffinityMask(GetCurrentProcess(), 1); SetProcessAffinityMask(GetCurrentProcess(), 1);
@ -239,10 +244,10 @@ static void cfg_create_ini()
"; Run in windowed mode rather than going fullscreen\n" "; Run in windowed mode rather than going fullscreen\n"
"windowed=false\n" "windowed=false\n"
"\n" "\n"
"; Maintain aspect ratio\n" "; Maintain aspect ratio - (Requires 'handlemouse=true')\n"
"maintas=false\n" "maintas=false\n"
"\n" "\n"
"; Windowboxing / Integer Scaling\n" "; Windowboxing / Integer Scaling - (Requires 'handlemouse=true')\n"
"boxing=false\n" "boxing=false\n"
"\n" "\n"
"; Real rendering rate, -1 = screen rate, 0 = unlimited, n = cap\n" "; Real rendering rate, -1 = screen rate, 0 = unlimited, n = cap\n"
@ -253,9 +258,9 @@ static void cfg_create_ini()
"; Note: vsync=true can fix tearing but it will cause input lag\n" "; Note: vsync=true can fix tearing but it will cause input lag\n"
"vsync=false\n" "vsync=false\n"
"\n" "\n"
"; Automatic mouse sensitivity scaling\n" "; Automatic mouse sensitivity scaling - (Requires 'handlemouse=true')\n"
"; Note: Only works if stretching is enabled. Sensitivity will be adjusted according to the size of the window\n" "; Note: Only works if stretching is enabled. Sensitivity will be adjusted according to the size of the window\n"
"adjmouse=true\n" "adjmouse=false\n"
"\n" "\n"
"; Preliminary libretro shader support - (Requires 'renderer=opengl') https://github.com/libretro/glsl-shaders\n" "; Preliminary libretro shader support - (Requires 'renderer=opengl') https://github.com/libretro/glsl-shaders\n"
"; 2x scaling example: https://imgur.com/a/kxsM1oY - 4x scaling example: https://imgur.com/a/wjrhpFV\n" "; 2x scaling example: https://imgur.com/a/kxsM1oY - 4x scaling example: https://imgur.com/a/wjrhpFV\n"
@ -301,6 +306,10 @@ static void cfg_create_ini()
"; Note: Usually one of the following values will work: 60 / 30 / 25 / 20 / 15 (lower value = slower game speed)\n" "; Note: Usually one of the following values will work: 60 / 30 / 25 / 20 / 15 (lower value = slower game speed)\n"
"maxgameticks=0\n" "maxgameticks=0\n"
"\n" "\n"
"; Gives cnc-ddraw full control over the mouse cursor (required for adjmouse/boxing/maintas)\n"
"; Note: Set this to 'false' if your cursor becomes invisible at some places in the game\n"
"handlemouse=true\n"
"\n"
"; Windows API Hooking, Possible values: 0 = disabled, 1 = IAT Hooking, 2 = Microsoft Detours, 3 = IAT+Detours Hooking (All Modules), 4 = IAT Hooking (All Modules)\n" "; Windows API Hooking, Possible values: 0 = disabled, 1 = IAT Hooking, 2 = Microsoft Detours, 3 = IAT+Detours Hooking (All Modules), 4 = IAT Hooking (All Modules)\n"
"; Note: Change this value if windowed mode or upscaling isn't working properly\n" "; Note: Change this value if windowed mode or upscaling isn't working properly\n"
"; Note: 'hook=2' will usually work for problematic games, but 'hook=2' should be combined with renderer=gdi\n" "; Note: 'hook=2' will usually work for problematic games, but 'hook=2' should be combined with renderer=gdi\n"
@ -336,7 +345,7 @@ static void cfg_create_ini()
"renderer=opengl\n" "renderer=opengl\n"
"nonexclusive=true\n" "nonexclusive=true\n"
"fixpitch=true\n" "fixpitch=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"resolutions=2\n" "resolutions=2\n"
"\n" "\n"
"; Age of Empires: The Rise of Rome\n" "; Age of Empires: The Rise of Rome\n"
@ -344,7 +353,7 @@ static void cfg_create_ini()
"renderer=opengl\n" "renderer=opengl\n"
"nonexclusive=true\n" "nonexclusive=true\n"
"fixpitch=true\n" "fixpitch=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"resolutions=2\n" "resolutions=2\n"
"\n" "\n"
"; Age of Empires II\n" "; Age of Empires II\n"
@ -352,14 +361,14 @@ static void cfg_create_ini()
"renderer=opengl\n" "renderer=opengl\n"
"nonexclusive=true\n" "nonexclusive=true\n"
"fixpitch=true\n" "fixpitch=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Age of Empires II: The Conquerors\n" "; Age of Empires II: The Conquerors\n"
"[age2_x1]\n" "[age2_x1]\n"
"renderer=opengl\n" "renderer=opengl\n"
"nonexclusive=true\n" "nonexclusive=true\n"
"fixpitch=true\n" "fixpitch=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; American Conquest\n" "; American Conquest\n"
"[DMCR]\n" "[DMCR]\n"
@ -382,17 +391,17 @@ static void cfg_create_ini()
"; Anstoss 3\n" "; Anstoss 3\n"
"[anstoss3]\n" "[anstoss3]\n"
"renderer=gdi\n" "renderer=gdi\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Anno 1602\n" "; Anno 1602\n"
"[1602]\n" "[1602]\n"
"adjmouse=true\n" "handlemouse=false\n"
"renderer=gdi\n" "renderer=gdi\n"
"hook=2\n" "hook=2\n"
"\n" "\n"
"; Alien Nations\n" "; Alien Nations\n"
"[AN]\n" "[AN]\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Atlantis\n" "; Atlantis\n"
"[ATLANTIS]\n" "[ATLANTIS]\n"
@ -453,125 +462,107 @@ static void cfg_create_ini()
"[game]\n" "[game]\n"
"checkfile=.\\blowfish.dll\n" "checkfile=.\\blowfish.dll\n"
"noactivateapp=true\n" "noactivateapp=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"maxfps=60\n" "maxfps=60\n"
"minfps=-1\n" "minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n" "\n"
"; Command & Conquer: Tiberian Sun Demo\n" "; Command & Conquer: Tiberian Sun Demo\n"
"[SUN]\n" "[SUN]\n"
"noactivateapp=true\n" "noactivateapp=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"maxfps=60\n" "maxfps=60\n"
"minfps=-1\n" "minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n" "\n"
"; Command & Conquer: Tiberian Sun - CnCNet\n" "; Command & Conquer: Tiberian Sun - CnCNet\n"
"[ts-spawn]\n" "[ts-spawn]\n"
"noactivateapp=true\n" "noactivateapp=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"maxfps=60\n" "maxfps=60\n"
"minfps=-1\n" "minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n" "\n"
"; Command & Conquer: Red Alert 2 - XWIS\n" "; Command & Conquer: Red Alert 2 - XWIS\n"
"[ra2]\n" "[ra2]\n"
"noactivateapp=true\n" "noactivateapp=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"maxfps=60\n" "maxfps=60\n"
"minfps=-1\n" "minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n" "\n"
"; Command & Conquer: Red Alert 2 - XWIS\n" "; Command & Conquer: Red Alert 2 - XWIS\n"
"[Red Alert 2]\n" "[Red Alert 2]\n"
"noactivateapp=true\n" "noactivateapp=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"maxfps=60\n" "maxfps=60\n"
"minfps=-1\n" "minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n" "\n"
"; Command & Conquer: Red Alert 2: Yuri's Revenge\n" "; Command & Conquer: Red Alert 2: Yuri's Revenge\n"
"[gamemd]\n" "[gamemd]\n"
"noactivateapp=true\n" "noactivateapp=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"maxfps=60\n" "maxfps=60\n"
"minfps=-1\n" "minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n" "\n"
"; Command & Conquer: Red Alert 2: Yuri's Revenge - ?ModExe?\n" "; Command & Conquer: Red Alert 2: Yuri's Revenge - ?ModExe?\n"
"[ra2md]\n" "[ra2md]\n"
"noactivateapp=true\n" "noactivateapp=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"maxfps=60\n" "maxfps=60\n"
"minfps=-1\n" "minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n" "\n"
"; Command & Conquer: Red Alert 2: Yuri's Revenge - CnCNet\n" "; Command & Conquer: Red Alert 2: Yuri's Revenge - CnCNet\n"
"[gamemd-spawn]\n" "[gamemd-spawn]\n"
"noactivateapp=true\n" "noactivateapp=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"maxfps=60\n" "maxfps=60\n"
"minfps=-1\n" "minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n" "\n"
"; Command & Conquer: Red Alert 2: Yuri's Revenge - XWIS\n" "; Command & Conquer: Red Alert 2: Yuri's Revenge - XWIS\n"
"[Yuri's Revenge]\n" "[Yuri's Revenge]\n"
"noactivateapp=true\n" "noactivateapp=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"maxfps=60\n" "maxfps=60\n"
"minfps=-1\n" "minfps=-1\n"
"maintas=false\n"
"boxing=false\n"
"\n" "\n"
"; Caesar III\n" "; Caesar III\n"
"[c3]\n" "[c3]\n"
"nonexclusive=true\n" "nonexclusive=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Chris Sawyer's Locomotion\n" "; Chris Sawyer's Locomotion\n"
"[LOCO]\n" "[LOCO]\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Cultures 2\n" "; Cultures 2\n"
"[Cultures2]\n" "[Cultures2]\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Cultures 2 MP\n" "; Cultures 2 MP\n"
"[Cultures2MP]\n" "[Cultures2MP]\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Close Combat 2: A Bridge Too Far\n" "; Close Combat 2: A Bridge Too Far\n"
"[cc2]\n" "[cc2]\n"
"adjmouse=true\n" "handlemouse=false\n"
"fixpitch=true\n" "fixpitch=true\n"
"renderer=opengl\n" "renderer=opengl\n"
"nonexclusive=true\n" "nonexclusive=true\n"
"\n" "\n"
"; Close Combat 3: The Russian Front\n" "; Close Combat 3: The Russian Front\n"
"[cc3]\n" "[cc3]\n"
"adjmouse=true\n" "handlemouse=false\n"
"fixpitch=true\n" "fixpitch=true\n"
"renderer=opengl\n" "renderer=opengl\n"
"nonexclusive=true\n" "nonexclusive=true\n"
"\n" "\n"
"; Close Combat 4: The Battle of the Bulge\n" "; Close Combat 4: The Battle of the Bulge\n"
"[cc4]\n" "[cc4]\n"
"adjmouse=true\n" "handlemouse=false\n"
"fixpitch=true\n" "fixpitch=true\n"
"renderer=opengl\n" "renderer=opengl\n"
"nonexclusive=true\n" "nonexclusive=true\n"
"\n" "\n"
"; Close Combat 5: Invasion: Normandy\n" "; Close Combat 5: Invasion: Normandy\n"
"[cc5]\n" "[cc5]\n"
"adjmouse=true\n" "handlemouse=false\n"
"fixpitch=true\n" "fixpitch=true\n"
"renderer=opengl\n" "renderer=opengl\n"
"nonexclusive=true\n" "nonexclusive=true\n"
@ -586,7 +577,7 @@ static void cfg_create_ini()
"\n" "\n"
"; Corsairs Gold\n" "; Corsairs Gold\n"
"[corsairs]\n" "[corsairs]\n"
"adjmouse=true\n" "handlemouse=false\n"
"renderer=gdi\n" "renderer=gdi\n"
"hook=2\n" "hook=2\n"
"\n" "\n"
@ -609,12 +600,10 @@ static void cfg_create_ini()
"\n" "\n"
"; Future Cop - L.A.P.D.\n" "; Future Cop - L.A.P.D.\n"
"[FCopLAPD]\n" "[FCopLAPD]\n"
"adjmouse=true\n" "handlemouse=false\n"
"renderer=gdi\n" "renderer=gdi\n"
"hook=2\n" "hook=2\n"
"passthrough=false\n" "passthrough=false\n"
"maintas=false\n"
"boxing=false\n"
"\n" "\n"
"; G-Police\n" "; G-Police\n"
"[GPOLICE]\n" "[GPOLICE]\n"
@ -622,7 +611,7 @@ static void cfg_create_ini()
"\n" "\n"
"; Gangsters: Organized Crime\n" "; Gangsters: Organized Crime\n"
"[gangsters]\n" "[gangsters]\n"
"adjmouse=true\n" "handlemouse=false\n"
"renderer=opengl\n" "renderer=opengl\n"
"nonexclusive=true\n" "nonexclusive=true\n"
"\n" "\n"
@ -646,7 +635,7 @@ static void cfg_create_ini()
"\n" "\n"
"; Heroes of Might and Magic II: The Succession Wars\n" "; Heroes of Might and Magic II: The Succession Wars\n"
"[HEROES2W]\n" "[HEROES2W]\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Hard Truck: Road to Victory\n" "; Hard Truck: Road to Victory\n"
"[htruck]\n" "[htruck]\n"
@ -656,13 +645,13 @@ static void cfg_create_ini()
"\n" "\n"
"; Invictus\n" "; Invictus\n"
"[Invictus]\n" "[Invictus]\n"
"adjmouse=true\n" "handlemouse=false\n"
"fixwndprochook=true\n" "fixwndprochook=true\n"
"renderer=opengl\n" "renderer=opengl\n"
"\n" "\n"
"; Interstate 76\n" "; Interstate 76\n"
"[i76]\n" "[i76]\n"
"adjmouse=true\n" "handlemouse=false\n"
"renderer=opengl\n" "renderer=opengl\n"
"\n" "\n"
"; Jagged Alliance 2\n" "; Jagged Alliance 2\n"
@ -699,11 +688,11 @@ static void cfg_create_ini()
"\n" "\n"
"; Majesty Gold HD\n" "; Majesty Gold HD\n"
"[MajestyHD]\n" "[MajestyHD]\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Majesty Gold HD\n" "; Majesty Gold HD\n"
"[MajestyHD - Old]\n" "[MajestyHD - Old]\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Moorhuhn\n" "; Moorhuhn\n"
"[Moorhuhn]\n" "[Moorhuhn]\n"
@ -718,12 +707,12 @@ static void cfg_create_ini()
"[olwin]\n" "[olwin]\n"
"noactivateapp=true\n" "noactivateapp=true\n"
"maxgameticks=60\n" "maxgameticks=60\n"
"adjmouse=true\n" "handlemouse=false\n"
"renderer=gdi\n" "renderer=gdi\n"
"\n" "\n"
"; Pharaoh\n" "; Pharaoh\n"
"[Pharaoh]\n" "[Pharaoh]\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Pacific General\n" "; Pacific General\n"
"[PACGEN]\n" "[PACGEN]\n"
@ -736,42 +725,40 @@ static void cfg_create_ini()
"\n" "\n"
"; Railroad Tycoon II\n" "; Railroad Tycoon II\n"
"[RT2]\n" "[RT2]\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; ROAD RASH\n" "; ROAD RASH\n"
"[RoadRash]\n" "[RoadRash]\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Star Trek - Armada\n" "; Star Trek - Armada\n"
"[Armada]\n" "[Armada]\n"
"armadahack=true\n" "armadahack=true\n"
"renderer=opengl\n" "renderer=opengl\n"
"nonexclusive=true\n" "nonexclusive=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"maintas=false\n"
"boxing=false\n"
"\n" "\n"
"; Star Wars: Galactic Battlegrounds\n" "; Star Wars: Galactic Battlegrounds\n"
"[battlegrounds]\n" "[battlegrounds]\n"
"fixpitch=true\n" "fixpitch=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Star Wars: Galactic Battlegrounds: Clone Campaigns\n" "; Star Wars: Galactic Battlegrounds: Clone Campaigns\n"
"[battlegrounds_x1]\n" "[battlegrounds_x1]\n"
"fixpitch=true\n" "fixpitch=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Stronghold Crusader HD\n" "; Stronghold Crusader HD\n"
"[Stronghold Crusader]\n" "[Stronghold Crusader]\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Stronghold Crusader Extreme HD\n" "; Stronghold Crusader Extreme HD\n"
"[Stronghold_Crusader_Extreme]\n" "[Stronghold_Crusader_Extreme]\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Stronghold HD\n" "; Stronghold HD\n"
"[Stronghold]\n" "[Stronghold]\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Steel Panthers: World At War\n" "; Steel Panthers: World At War\n"
"[MECH]\n" "[MECH]\n"
@ -780,15 +767,13 @@ static void cfg_create_ini()
"; Shadow Watch\n" "; Shadow Watch\n"
"[sw]\n" "[sw]\n"
"fixpitch=true\n" "fixpitch=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Shadow Flare\n" "; Shadow Flare\n"
"[ShadowFlare]\n" "[ShadowFlare]\n"
"renderer=opengl\n" "renderer=opengl\n"
"nonexclusive=true\n" "nonexclusive=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"maintas=false\n"
"boxing=false\n"
"\n" "\n"
"; Three Kingdoms: Fate of the Dragon\n" "; Three Kingdoms: Fate of the Dragon\n"
"[sanguo]\n" "[sanguo]\n"
@ -808,26 +793,24 @@ static void cfg_create_ini()
"renderer=opengl\n" "renderer=opengl\n"
"nonexclusive=true\n" "nonexclusive=true\n"
"maxgameticks=60\n" "maxgameticks=60\n"
"adjmouse=true\n" "handlemouse=false\n"
"fixchildwindows=false\n" "fixchildwindows=false\n"
"maintas=false\n"
"boxing=false\n"
"\n" "\n"
"; Tzar: The Burden of the Crown\n" "; Tzar: The Burden of the Crown\n"
"; Note: Must set 'DIRECTXDEVICE=0' in 'Tzar.ini'\n" "; Note: Must set 'DIRECTXDEVICE=0' in 'Tzar.ini'\n"
"[Tzar]\n" "[Tzar]\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Uprising\n" "; Uprising\n"
"[uprising]\n" "[uprising]\n"
"renderer=opengl\n" "renderer=opengl\n"
"fixpitch=true\n" "fixpitch=true\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Uprising 2\n" "; Uprising 2\n"
"[Uprising 2]\n" "[Uprising 2]\n"
"renderer=opengl\n" "renderer=opengl\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
"; Warlords 3\n" "; Warlords 3\n"
"[Darklord]\n" "[Darklord]\n"
@ -839,7 +822,7 @@ static void cfg_create_ini()
"\n" "\n"
"; Worms Armageddon\n" "; Worms Armageddon\n"
"[WA]\n" "[WA]\n"
"adjmouse=true\n" "handlemouse=false\n"
"width=0\n" "width=0\n"
"height=0\n" "height=0\n"
"resizable=false\n" "resizable=false\n"
@ -855,7 +838,7 @@ static void cfg_create_ini()
"\n" "\n"
"; Zeus and Poseidon\n" "; Zeus and Poseidon\n"
"[Zeus]\n" "[Zeus]\n"
"adjmouse=true\n" "handlemouse=false\n"
"\n" "\n"
, fh); , fh);

View File

@ -513,6 +513,8 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, BOOL setBy
g_ddraw->render.mode.dmBitsPerPel = g_ddraw->render.bpp; g_ddraw->render.mode.dmBitsPerPel = g_ddraw->render.bpp;
} }
BOOL maintas = g_ddraw->maintas;
if (!g_ddraw->windowed) if (!g_ddraw->windowed)
{ {
/* Making sure the chosen resolution is valid */ /* Making sure the chosen resolution is valid */
@ -562,6 +564,9 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, BOOL setBy
old_height, old_height,
g_ddraw->mode.dmPelsWidth, g_ddraw->mode.dmPelsWidth,
g_ddraw->mode.dmPelsHeight); g_ddraw->mode.dmPelsHeight);
if (found_res)
maintas = TRUE;
} }
g_ddraw->render.width = res.cx; g_ddraw->render.width = res.cx;
@ -590,6 +595,8 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, BOOL setBy
g_ddraw->windowed = TRUE; g_ddraw->windowed = TRUE;
} }
else
maintas = TRUE;
} }
} }
} }
@ -601,6 +608,11 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, BOOL setBy
g_ddraw->render.height++; g_ddraw->render.height++;
} }
if (!g_ddraw->handlemouse)
{
g_ddraw->boxing = maintas = FALSE;
}
g_ddraw->render.viewport.width = g_ddraw->render.width; g_ddraw->render.viewport.width = g_ddraw->render.width;
g_ddraw->render.viewport.height = g_ddraw->render.height; g_ddraw->render.viewport.height = g_ddraw->render.height;
g_ddraw->render.viewport.x = 0; g_ddraw->render.viewport.x = 0;
@ -624,7 +636,7 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, BOOL setBy
g_ddraw->render.viewport.y = g_ddraw->render.height / 2 - g_ddraw->render.viewport.height / 2; g_ddraw->render.viewport.y = g_ddraw->render.height / 2 - g_ddraw->render.viewport.height / 2;
g_ddraw->render.viewport.x = g_ddraw->render.width / 2 - g_ddraw->render.viewport.width / 2; g_ddraw->render.viewport.x = g_ddraw->render.width / 2 - g_ddraw->render.viewport.width / 2;
} }
else if (g_ddraw->maintas) else if (maintas)
{ {
g_ddraw->render.viewport.width = g_ddraw->render.width; g_ddraw->render.viewport.width = g_ddraw->render.width;
g_ddraw->render.viewport.height = g_ddraw->render.viewport.height =
@ -819,19 +831,14 @@ HRESULT dd_SetCooperativeLevel(HWND hwnd, DWORD dwFlags)
SetPixelFormat(g_ddraw->render.hdc, ChoosePixelFormat(g_ddraw->render.hdc, &pfd), &pfd); SetPixelFormat(g_ddraw->render.hdc, ChoosePixelFormat(g_ddraw->render.hdc, &pfd), &pfd);
} }
/* Make sure the cursor is visible in windowed mode initially */ if (g_ddraw->handlemouse && g_ddraw->windowed)
if (g_ddraw->windowed)
{ {
CURSORINFO ci = { .cbSize = sizeof(CURSORINFO) }; while (real_ShowCursor(FALSE) > 0); /* workaround for direct input games */
if (real_GetCursorInfo(&ci) && ci.flags == 0) while (real_ShowCursor(TRUE) < 0);
{
g_ddraw->hidecursor = TRUE;
while (real_ShowCursor(TRUE) < 0);
}
real_SetCursor(LoadCursor(NULL, IDC_ARROW));
} }
real_SetCursor(LoadCursor(NULL, IDC_ARROW));
GetWindowText(g_ddraw->hwnd, (LPTSTR)&g_ddraw->title, sizeof(g_ddraw->title)); GetWindowText(g_ddraw->hwnd, (LPTSTR)&g_ddraw->title, sizeof(g_ddraw->title));
g_ddraw->isredalert = strcmp(g_ddraw->title, "Red Alert") == 0; g_ddraw->isredalert = strcmp(g_ddraw->title, "Red Alert") == 0;

View File

@ -12,23 +12,27 @@ void mouse_lock()
return; return;
if (g_ddraw->devmode) if (g_ddraw->devmode)
{
if (g_ddraw->handlemouse)
while (real_ShowCursor(FALSE) >= 0);
return; return;
}
if (g_hook_active && !g_ddraw->locked) if (g_hook_active && !g_ddraw->locked)
{ {
/* Get the window client area */
real_GetClientRect(g_ddraw->hwnd, &rc);
if (g_ddraw->adjmouse) if (g_ddraw->adjmouse)
{ {
rc.top = g_ddraw->render.viewport.y; rc.right = g_ddraw->render.viewport.width;
rc.left = g_ddraw->render.viewport.x; rc.bottom = g_ddraw->render.viewport.height;
rc.right = g_ddraw->render.viewport.width + g_ddraw->render.viewport.x;
rc.bottom = g_ddraw->render.viewport.height + g_ddraw->render.viewport.y;
} }
else else
{ {
rc.top = g_ddraw->render.viewport.y; rc.right = g_ddraw->width;
rc.left = g_ddraw->render.viewport.x; rc.bottom = g_ddraw->height;
rc.right = g_ddraw->width + g_ddraw->render.viewport.x;
rc.bottom = g_ddraw->height + g_ddraw->render.viewport.y;
} }
/* Convert the client area to screen coordinates */ /* Convert the client area to screen coordinates */
@ -53,15 +57,23 @@ void mouse_lock()
real_SetCursorPos(rc.left + g_ddraw->cursor.x, rc.top + g_ddraw->cursor.y - g_ddraw->mouse_y_adjust); real_SetCursorPos(rc.left + g_ddraw->cursor.x, rc.top + g_ddraw->cursor.y - g_ddraw->mouse_y_adjust);
} }
real_SetCursor(g_ddraw->old_cursor); if (g_ddraw->handlemouse)
if (g_ddraw->hidecursor)
{ {
g_ddraw->hidecursor = FALSE; real_ClipCursor(&rc);
real_ShowCursor(FALSE); while (real_ShowCursor(FALSE) >= 0);
} }
else
{
real_SetCursor(g_ddraw->old_cursor);
real_ClipCursor(&rc); if (g_ddraw->hidecursor)
{
g_ddraw->hidecursor = FALSE;
real_ShowCursor(FALSE);
}
real_ClipCursor(&rc);
}
g_ddraw->locked = TRUE; g_ddraw->locked = TRUE;
} }
@ -72,10 +84,17 @@ void mouse_unlock()
RECT rc; RECT rc;
if (g_ddraw->devmode) if (g_ddraw->devmode)
{
if (g_ddraw->handlemouse)
while (real_ShowCursor(TRUE) < 0);
return; return;
}
if (!g_hook_active) if (!g_hook_active)
{
return; return;
}
if (g_ddraw->locked) if (g_ddraw->locked)
{ {
@ -93,11 +112,19 @@ void mouse_unlock()
SetRect(&rc, pt.x, pt.y, pt2.x, pt2.y); SetRect(&rc, pt.x, pt.y, pt2.x, pt2.y);
CURSORINFO ci = { .cbSize = sizeof(CURSORINFO) }; if (g_ddraw->handlemouse)
if (real_GetCursorInfo(&ci) && ci.flags == 0)
{ {
g_ddraw->hidecursor = TRUE;
while (real_ShowCursor(TRUE) < 0); while (real_ShowCursor(TRUE) < 0);
real_SetCursor(LoadCursor(NULL, IDC_ARROW));
}
else
{
CURSORINFO ci = { .cbSize = sizeof(CURSORINFO) };
if (real_GetCursorInfo(&ci) && ci.flags == 0)
{
g_ddraw->hidecursor = TRUE;
while (real_ShowCursor(TRUE) < 0);
}
} }
real_SetCursor(LoadCursor(NULL, IDC_ARROW)); real_SetCursor(LoadCursor(NULL, IDC_ARROW));

View File

@ -391,22 +391,25 @@ DWORD WINAPI d3d9_render_main(void)
} }
} }
g_ddraw->child_window_exists = FALSE; if (!g_ddraw->handlemouse)
EnumChildWindows(g_ddraw->hwnd, util_enum_child_proc, (LPARAM)g_ddraw->primary);
if (g_ddraw->render.width != g_ddraw->width || g_ddraw->render.height != g_ddraw->height)
{ {
if (g_ddraw->child_window_exists) g_ddraw->child_window_exists = FALSE;
{ EnumChildWindows(g_ddraw->hwnd, util_enum_child_proc, (LPARAM)g_ddraw->primary);
IDirect3DDevice9_Clear(g_d3d9.device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
if (!needs_update && d3d9_update_vertices(FALSE, FALSE)) if (g_ddraw->render.width != g_ddraw->width || g_ddraw->render.height != g_ddraw->height)
needs_update = TRUE;
}
else if (needs_update)
{ {
if (d3d9_update_vertices(FALSE, TRUE)) if (g_ddraw->child_window_exists)
needs_update = FALSE; {
IDirect3DDevice9_Clear(g_d3d9.device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
if (!needs_update && d3d9_update_vertices(FALSE, FALSE))
needs_update = TRUE;
}
else if (needs_update)
{
if (d3d9_update_vertices(FALSE, TRUE))
needs_update = FALSE;
}
} }
} }
} }

View File

@ -72,8 +72,11 @@ DWORD WINAPI gdi_render_main(void)
if (g_ddraw->vhack) if (g_ddraw->vhack)
InterlockedExchange(&g_ddraw->upscale_hack_active, upscale_hack); InterlockedExchange(&g_ddraw->upscale_hack_active, upscale_hack);
g_ddraw->child_window_exists = FALSE; if (!g_ddraw->handlemouse)
EnumChildWindows(g_ddraw->hwnd, util_enum_child_proc, (LPARAM)g_ddraw->primary); {
g_ddraw->child_window_exists = FALSE;
EnumChildWindows(g_ddraw->hwnd, util_enum_child_proc, (LPARAM)g_ddraw->primary);
}
if (g_ddraw->primary->palette) if (g_ddraw->primary->palette)
{ {

View File

@ -664,28 +664,31 @@ static void ogl_render()
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
} }
g_ddraw->child_window_exists = FALSE; if (!g_ddraw->handlemouse)
EnumChildWindows(g_ddraw->hwnd, util_enum_child_proc, (LPARAM)g_ddraw->primary);
if (g_ddraw->render.width != g_ddraw->width || g_ddraw->render.height != g_ddraw->height)
{ {
if (g_ddraw->child_window_exists) g_ddraw->child_window_exists = FALSE;
{ EnumChildWindows(g_ddraw->hwnd, util_enum_child_proc, (LPARAM)g_ddraw->primary);
glClear(GL_COLOR_BUFFER_BIT);
if (!needs_update) if (g_ddraw->render.width != g_ddraw->width || g_ddraw->render.height != g_ddraw->height)
{
if (g_ddraw->child_window_exists)
{ {
glViewport(0, g_ddraw->render.height - g_ddraw->height, g_ddraw->width, g_ddraw->height); glClear(GL_COLOR_BUFFER_BIT);
needs_update = TRUE;
}
}
else if (needs_update)
{
glViewport(
g_ddraw->render.viewport.x, g_ddraw->render.viewport.y,
g_ddraw->render.viewport.width, g_ddraw->render.viewport.height);
needs_update = FALSE; if (!needs_update)
{
glViewport(0, g_ddraw->render.height - g_ddraw->height, g_ddraw->width, g_ddraw->height);
needs_update = TRUE;
}
}
else if (needs_update)
{
glViewport(
g_ddraw->render.viewport.x, g_ddraw->render.viewport.y,
g_ddraw->render.viewport.width, g_ddraw->render.viewport.height);
needs_update = FALSE;
}
} }
} }
} }

View File

@ -325,7 +325,7 @@ BOOL CALLBACK util_enum_child_proc(HWND hwnd, LPARAM lparam)
if (real_GetClientRect(hwnd, &size) && real_GetWindowRect(hwnd, &pos) && size.right > 1 && size.bottom > 1) if (real_GetClientRect(hwnd, &size) && real_GetWindowRect(hwnd, &pos) && size.right > 1 && size.bottom > 1)
{ {
g_ddraw->got_child_windows = g_ddraw->child_window_exists = TRUE; g_ddraw->child_window_exists = TRUE;
if (g_ddraw->fixchildwindows) if (g_ddraw->fixchildwindows)
{ {

View File

@ -28,9 +28,6 @@ BOOL WINAPI fake_GetCursorPos(LPPOINT lpPoint)
int max_width = g_ddraw->adjmouse ? g_ddraw->render.viewport.width : g_ddraw->width; int max_width = g_ddraw->adjmouse ? g_ddraw->render.viewport.width : g_ddraw->width;
int max_height = g_ddraw->adjmouse ? g_ddraw->render.viewport.height : g_ddraw->height; int max_height = g_ddraw->adjmouse ? g_ddraw->render.viewport.height : g_ddraw->height;
pt.x -= g_ddraw->render.viewport.x;
pt.y -= g_ddraw->render.viewport.y;
if (pt.x < 0) if (pt.x < 0)
{ {
diffx = pt.x; diffx = pt.x;
@ -116,7 +113,7 @@ int WINAPI fake_ShowCursor(BOOL bShow)
{ {
static int count; static int count;
if (g_ddraw) if (g_ddraw && !g_ddraw->handlemouse)
return real_ShowCursor(bShow); return real_ShowCursor(bShow);
return bShow ? ++count : --count; return bShow ? ++count : --count;
@ -127,7 +124,7 @@ HCURSOR WINAPI fake_SetCursor(HCURSOR hCursor)
if (g_ddraw) if (g_ddraw)
g_ddraw->old_cursor = hCursor; g_ddraw->old_cursor = hCursor;
if (g_ddraw && (g_ddraw->locked || g_ddraw->devmode)) if (g_ddraw && !g_ddraw->handlemouse && (g_ddraw->locked || g_ddraw->devmode))
return real_SetCursor(hCursor); return real_SetCursor(hCursor);
return NULL; return NULL;
@ -304,18 +301,12 @@ BOOL WINAPI fake_MoveWindow(HWND hWnd, int X, int Y, int nWidth, int nHeight, BO
LRESULT WINAPI fake_SendMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) LRESULT WINAPI fake_SendMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{ {
if (g_ddraw && g_ddraw->hwnd == hWnd && Msg == WM_MOUSEMOVE) if (g_ddraw && g_ddraw->hwnd == hWnd && g_ddraw->adjmouse && Msg == WM_MOUSEMOVE)
{ {
int x = GET_X_LPARAM(lParam); int x = (int)(GET_X_LPARAM(lParam) * g_ddraw->render.scale_w);
int y = GET_Y_LPARAM(lParam); int y = (int)(GET_Y_LPARAM(lParam) * g_ddraw->render.scale_h);
if (g_ddraw->adjmouse) lParam = MAKELPARAM(x, y);
{
x = (int)(x * g_ddraw->render.scale_w);
y = (int)(y * g_ddraw->render.scale_h);
}
lParam = MAKELPARAM(x + g_ddraw->render.viewport.x, y + g_ddraw->render.viewport.y);
} }
if (g_ddraw && g_ddraw->hwnd == hWnd && Msg == WM_SIZE && g_hook_method != 2) if (g_ddraw && g_ddraw->hwnd == hWnd && Msg == WM_SIZE && g_hook_method != 2)

View File

@ -374,7 +374,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
} }
} }
if (g_ddraw->got_child_windows) if (!g_ddraw->handlemouse)
{ {
redraw_count = 2; redraw_count = 2;
RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);
@ -404,7 +404,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
} }
} }
if (g_ddraw->got_child_windows) if (!g_ddraw->handlemouse)
RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);
return DefWindowProc(hWnd, uMsg, wParam, lParam); /* Carmageddon fix */ return DefWindowProc(hWnd, uMsg, wParam, lParam); /* Carmageddon fix */
@ -483,7 +483,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
{ {
if (wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE) if (wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE)
{ {
if (g_ddraw->got_child_windows) if (!g_ddraw->handlemouse)
RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);
} }
@ -530,7 +530,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
/* let it pass through once (tiberian sun) */ /* let it pass through once (tiberian sun) */
static BOOL one_time; static BOOL one_time;
if (wParam && !one_time && g_ddraw->noactivateapp) if (wParam && !one_time && !g_ddraw->handlemouse && g_ddraw->noactivateapp)
{ {
one_time = TRUE; one_time = TRUE;
break; break;
@ -664,17 +664,6 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
case WM_MBUTTONDOWN: case WM_MBUTTONDOWN:
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
{ {
int x = GET_X_LPARAM(lParam) - g_ddraw->render.viewport.x;
int y = GET_Y_LPARAM(lParam) - g_ddraw->render.viewport.y;
if (x < 0)
x = 0;
if (y < 0)
y = 0;
lParam = MAKELPARAM(x, y);
if (!g_ddraw->devmode) if (!g_ddraw->devmode)
{ {
if (!g_ddraw->locked) if (!g_ddraw->locked)
@ -748,7 +737,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
} }
case WM_PAINT: case WM_PAINT:
{ {
if (redraw_count > 0) if (!g_ddraw->handlemouse && redraw_count > 0)
{ {
redraw_count--; redraw_count--;
RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);