Skip to content

Commit

Permalink
cleanup settings names/order
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Sep 12, 2024
1 parent 43eadc5 commit f690749
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 48 deletions.
16 changes: 8 additions & 8 deletions inc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,25 @@ typedef struct CNCDDRAWCONFIG

/* Undocumented settings */

BOOL releasealt;
BOOL fixnotresponding;
int hook;
BOOL fix_alt_key_stuck;
BOOL fix_not_responding;
BOOL no_compat_warning;
BOOL wine_allow_resize;
int guard_lines;
int max_resolutions;
BOOL lock_surfaces;
BOOL flipclear;
BOOL fixmousehook;
BOOL rgb555;
BOOL no_dinput_hook;
int refresh_rate;
char inject_resolution[128];
BOOL direct3d_passthrough;
BOOL center_cursor_fix;
char fake_mode[128];
BOOL wine_allow_resize;
BOOL lock_mouse_top_left;
BOOL no_compat_warning;
BOOL remove_menu;
char win_version[32];
int hook;
BOOL remove_menu;
int refresh_rate;

/* Hotkeys */

Expand All @@ -103,6 +102,7 @@ typedef struct CNCDDRAWCONFIG
BOOL tlc_hack;
BOOL homm_hack;
BOOL carma95_hack;
BOOL sirtech_hack;

} CNCDDRAWCONFIG;

Expand Down
71 changes: 35 additions & 36 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,30 +70,29 @@ void cfg_load()
GET_INT(g_config.resolutions, "resolutions", RESLIST_NORMAL);
GET_INT(g_config.fixchilds, "fixchilds", FIX_CHILDS_DETECT_PAINT);
GET_BOOL(g_config.hook_peekmessage, "hook_peekmessage", FALSE);
GET_STRING("win_version", "", g_config.win_version, sizeof(g_config.win_version));

/* Undocumented settings */

GET_BOOL(g_config.releasealt, "releasealt", FALSE);
GET_BOOL(g_config.fix_alt_key_stuck, "fix_alt_key_stuck", FALSE);
GET_BOOL(GameHandlesClose, "game_handles_close", FALSE);
GET_BOOL(g_config.fixnotresponding, "fixnotresponding", FALSE);
GET_INT(g_config.hook, "hook", 4);
GET_BOOL(g_config.fix_not_responding, "fix_not_responding", FALSE);
GET_BOOL(g_config.no_compat_warning, "no_compat_warning", FALSE);
GET_BOOL(g_config.wine_allow_resize, "wine_allow_resize", FALSE);
GET_INT(g_config.guard_lines, "guard_lines", 200);
GET_INT(g_config.max_resolutions, "max_resolutions", 0);
GET_BOOL(g_config.lock_surfaces, "lock_surfaces", FALSE);
GET_BOOL(g_config.flipclear, "flipclear", FALSE);
GET_BOOL(g_config.fixmousehook, "fixmousehook", FALSE);
GET_BOOL(g_config.rgb555, "rgb555", FALSE);
GET_BOOL(g_config.no_dinput_hook, "no_dinput_hook", FALSE);
GET_INT(g_config.refresh_rate, "refresh_rate", 0);
GET_STRING("inject_resolution", "", g_config.inject_resolution, sizeof(g_config.inject_resolution));
GET_BOOL(g_config.direct3d_passthrough, "direct3d_passthrough", FALSE);
GET_BOOL(g_config.center_cursor_fix, "center_cursor_fix", FALSE);
GET_STRING("fake_mode", "", g_config.fake_mode, sizeof(g_config.fake_mode));
GET_BOOL(g_config.wine_allow_resize, "wine_allow_resize", FALSE);
GET_BOOL(g_config.lock_mouse_top_left, "lock_mouse_top_left", FALSE);
GET_BOOL(g_config.no_compat_warning, "no_compat_warning", FALSE);
GET_STRING("win_version", "", g_config.win_version, sizeof(g_config.win_version));
GET_INT(g_config.hook, "hook", 4);
GET_BOOL(g_config.remove_menu, "remove_menu", FALSE);
GET_INT(g_config.refresh_rate, "refresh_rate", 0);

/* Hotkeys */

Expand All @@ -113,6 +112,7 @@ void cfg_load()
GET_BOOL(g_config.tlc_hack, "tlc_hack", FALSE);
GET_BOOL(g_config.homm_hack, "homm_hack", FALSE);
GET_BOOL(g_config.carma95_hack, "carma95_hack", FALSE);
GET_BOOL(g_config.sirtech_hack, "sirtech_hack", FALSE);

GameHandlesClose = GameHandlesClose || g_config.infantryhack;

Expand Down Expand Up @@ -303,28 +303,27 @@ static void cfg_create_ini()
"hook_peekmessage=false\n"
"\n"
"\n"
"; Undocumented settings - You may or may not change these (You should rather focus on the settings above)\n"
"releasealt=false\n"
"; Undocumented compatibility settings - These will probably not solve your problem, you should rather focus on the settings above\n"
"fix_alt_key_stuck=false\n"
"game_handles_close=false\n"
"fixnotresponding=false\n"
"hook=4\n"
"fix_not_responding=false\n"
"no_compat_warning=false\n"
"wine_allow_resize=false\n"
"guard_lines=200\n"
"max_resolutions=0\n"
"lock_surfaces=false\n"
"flipclear=false\n"
"fixmousehook=false\n"
"rgb555=false\n"
"no_dinput_hook=false\n"
"refresh_rate=0\n"
";inject_resolution=960x540\n"
"direct3d_passthrough=false\n"
"center_cursor_fix=false\n"
";fake_mode=640x480x32\n"
"wine_allow_resize=false\n"
"lock_mouse_top_left=false\n"
"no_compat_warning=false\n"
"remove_menu=false\n"
";win_version=95\n"
"hook=4\n"
"remove_menu=false\n"
"refresh_rate=0\n"
"\n"
"\n"
"\n"
Expand Down Expand Up @@ -833,7 +832,7 @@ static void cfg_create_ini()
"; Economic War\n"
"[EcoW]\n"
"maxgameticks=60\n"
"fixnotresponding=true\n"
"fix_not_responding=true\n"
"\n"
"; Emperor: Rise of the Middle Kingdom\n"
"[Emperor]\n"
Expand Down Expand Up @@ -896,7 +895,7 @@ static void cfg_create_ini()
"\n"
"; Glover\n"
"[glover]\n"
"fixnotresponding=true\n"
"fix_not_responding=true\n"
"\n"
"; G-Police\n"
"[GPOLICE]\n"
Expand Down Expand Up @@ -1010,32 +1009,32 @@ static void cfg_create_ini()
"; Jagged Alliance 2\n"
"[ja2]\n"
"singlecpu=false\n"
"fixmousehook=true\n"
"releasealt=true\n"
"sirtech_hack=true\n"
"fix_alt_key_stuck=true\n"
"\n"
"; Jagged Alliance 2: Unfinished Business\n"
"[JA2UB]\n"
"singlecpu=false\n"
"fixmousehook=true\n"
"releasealt=true\n"
"sirtech_hack=true\n"
"fix_alt_key_stuck=true\n"
"\n"
"; Jagged Alliance 2: Wildfire\n"
"[WF6]\n"
"singlecpu=false\n"
"fixmousehook=true\n"
"releasealt=true\n"
"sirtech_hack=true\n"
"fix_alt_key_stuck=true\n"
"\n"
"; Jagged Alliance 2 - UC mod\n"
"[JA2_UC]\n"
"singlecpu=false\n"
"fixmousehook=true\n"
"releasealt=true\n"
"sirtech_hack=true\n"
"fix_alt_key_stuck=true\n"
"\n"
"; Jagged Alliance 2 - Vengeance Reloaded mod\n"
"[JA2_Vengeance]\n"
"singlecpu=false\n"
"fixmousehook=true\n"
"releasealt=true\n"
"sirtech_hack=true\n"
"fix_alt_key_stuck=true\n"
"\n"
"; Jedi Knight Dark Forces 2\n"
"[JK]\n"
Expand Down Expand Up @@ -1180,7 +1179,7 @@ static void cfg_create_ini()
"\n"
"; Moorhuhn 2\n"
"[Moorhuhn2]\n"
"releasealt=true\n"
"fix_alt_key_stuck=true\n"
"\n"
"; New Robinson\n"
"[ROBY]\n"
Expand Down Expand Up @@ -1361,17 +1360,17 @@ static void cfg_create_ini()
"[Game/4]\n"
"checkfile=.\\Robin Hood.exe\n"
"singlecpu=false\n"
"fixnotresponding=true\n"
"fix_not_responding=true\n"
"\n"
"; Robin Hood - The Legend of Sherwood (Steam)\n"
"[_rh]\n"
"singlecpu=false\n"
"fixnotresponding=true\n"
"fix_not_responding=true\n"
"\n"
"; Robin Hood - The Legend of Sherwood\n"
"[Robin Hood]\n"
"singlecpu=false\n"
"fixnotresponding=true\n"
"fix_not_responding=true\n"
"\n"
"; Scooby-Doo(TM), Case File #1 The Glowing Bug Man - NOT WORKING YET\n"
"[Case File #1]\n"
Expand Down Expand Up @@ -1512,7 +1511,7 @@ static void cfg_create_ini()
"\n"
"; The Jungle Book Groove Party\n"
"[Jungle_vr]\n"
"fixnotresponding=true\n"
"fix_not_responding=true\n"
"\n"
"; Three Kingdoms: Fate of the Dragon\n"
"[sanguo]\n"
Expand Down Expand Up @@ -1574,8 +1573,8 @@ static void cfg_create_ini()
"\n"
"; Wizardry 8\n"
"[Wiz8]\n"
"fixmousehook=true\n"
"releasealt=true\n"
"sirtech_hack=true\n"
"fix_alt_key_stuck=true\n"
"\n"
"; Worms 2\n"
"[worms2]\n"
Expand Down
2 changes: 1 addition & 1 deletion src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ HMODULE WINAPI util_enumerate_modules(_In_opt_ HMODULE hModuleLast)

void util_pull_messages()
{
if (g_config.fixnotresponding &&
if (g_config.fix_not_responding &&
g_ddraw.hwnd &&
g_ddraw.last_msg_pull_tick + 1000 < timeGetTime() &&
GetCurrentThreadId() == g_ddraw.gui_thread_id &&
Expand Down
2 changes: 1 addition & 1 deletion src/winapi_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ HHOOK WINAPI fake_SetWindowsHookExA(int idHook, HOOKPROC lpfn, HINSTANCE hmod, D
return NULL;
}

if (idHook == WH_MOUSE && lpfn && !hmod && !g_mouse_hook && g_config.fixmousehook)
if (idHook == WH_MOUSE && lpfn && !hmod && !g_mouse_hook && g_config.sirtech_hack)
{
g_mouse_proc = lpfn;
return g_mouse_hook = real_SetWindowsHookExA(idHook, mouse_hook_proc, hmod, dwThreadId);
Expand Down
4 changes: 2 additions & 2 deletions src/wndproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
}
}

if (wParam && g_config.releasealt)
if (wParam && g_config.fix_alt_key_stuck)
{
INPUT ip;
memset(&ip, 0, sizeof(ip));
Expand Down Expand Up @@ -707,7 +707,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
break;
}

if (wParam && g_ddraw.alt_key_down && !g_config.releasealt)
if (wParam && g_ddraw.alt_key_down && !g_config.fix_alt_key_stuck)
{
PostMessageA(g_ddraw.hwnd, WM_SYSKEYUP, VK_MENU, 0);
g_ddraw.alt_key_down = FALSE;
Expand Down

0 comments on commit f690749

Please sign in to comment.