Skip to content

Commit

Permalink
add new .ini setting "terminate_process"
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Jan 2, 2025
1 parent 7df6a4e commit ed85841
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions inc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ typedef struct CNCDDRAWCONFIG
BOOL limit_gdi_handles;
BOOL remove_menu;
int refresh_rate;
int terminate_process;

/* Hotkeys */

Expand Down
2 changes: 2 additions & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ void cfg_load()
GET_BOOL(g_config.limit_gdi_handles, "limit_gdi_handles", FALSE);
GET_BOOL(g_config.remove_menu, "remove_menu", FALSE);
GET_INT(g_config.refresh_rate, "refresh_rate", 0);
GET_BOOL(g_config.terminate_process, "terminate_process", FALSE);

/* Hotkeys */

Expand Down Expand Up @@ -336,6 +337,7 @@ static void cfg_create_ini()
"limit_gdi_handles=false\n"
"remove_menu=false\n"
"refresh_rate=0\n"
"terminate_process=false\n"
"\n"
"\n"
"\n"
Expand Down
3 changes: 3 additions & 0 deletions src/dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
if (g_dbg_exception_handle && remove_handler)
remove_handler(g_dbg_exception_handle);

if (g_config.terminate_process == 2)
TerminateProcess(GetCurrentProcess(), 0);

break;
}
case DLL_THREAD_ATTACH:
Expand Down
3 changes: 3 additions & 0 deletions src/wndproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,9 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam

if (wParam == SC_CLOSE && !GameHandlesClose)
{
if (g_config.terminate_process)
g_config.terminate_process = 2;

ExitProcess(0);
//_exit(0);
}
Expand Down

0 comments on commit ed85841

Please sign in to comment.