Skip to content

Commit ac725bc

Browse files
Synchronize changes from 1.6 master branch [ci skip]
9f87408 Fix postbuildcommands for CEF a6c0027 Use job object to kill CEF process on exit (Fixes #4032) 3a7fa32 Minor refactor for CEFLauncher 4f48500 Remove dead CFileSystemHook code
2 parents fd145f8 + 9f87408 commit ac725bc

File tree

6 files changed

+28
-21
lines changed

6 files changed

+28
-21
lines changed

Client/ceflauncher/Main.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
/*****************************************************************************
22
*
3-
* PROJECT: Multi Theft Auto v1.0
4-
* (Shared logic for modifications)
3+
* PROJECT: Multi Theft Auto
54
* LICENSE: See LICENSE in the top level directory
65
* FILE: ceflauncher/Main.cpp
76
* PURPOSE: CEF launcher entry point
87
*
8+
* Multi Theft Auto is available from https://multitheftauto.com/
9+
*
910
*****************************************************************************/
10-
#define WIN32_LEAN_AND_MEAN
11-
#include <Windows.h>
12-
#include <string>
1311

1412
/*
1513
IMPORTANT
@@ -24,7 +22,10 @@
2422

2523
int _declspec(dllimport) InitCEF();
2624

27-
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdShow, int nCmdShow)
25+
using HINSTANCE = struct HINSTANCE__*;
26+
using LPSTR = char*;
27+
28+
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdShow, int nCmdShow)
2829
{
2930
return InitCEF();
3031
}

Client/ceflauncher/premake5.lua

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,15 @@ project "CEFLauncher"
33
kind "WindowedApp"
44
targetname "CEFLauncher"
55
targetdir(buildpath("mta/cef"))
6-
76
includedirs { "../sdk" }
8-
97
links { "CEFLauncher DLL"}
10-
entrypoint "WinMainCRTStartup"
118

129
vpaths {
1310
["Headers/*"] = "**.h",
1411
["Sources/*"] = "**.cpp",
1512
["*"] = "premake5.lua"
1613
}
1714

18-
1915
files {
2016
"premake5.lua",
2117
"*.h",

Client/ceflauncher_DLL/Main.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
/*****************************************************************************
22
*
3-
* PROJECT: Multi Theft Auto v1.0
4-
* (Shared logic for modifications)
3+
* PROJECT: Multi Theft Auto
54
* LICENSE: See LICENSE in the top level directory
65
* FILE: ceflauncher/Main.cpp
76
* PURPOSE: CEF launcher entry point
87
*
8+
* Multi Theft Auto is available from https://multitheftauto.com/
9+
*
910
*****************************************************************************/
11+
1012
#define WIN32_LEAN_AND_MEAN
1113
#include <Windows.h>
1214
#include <delayimp.h>
@@ -44,5 +46,20 @@ int _declspec(dllexport) InitCEF()
4446
sandboxInfo = scopedSandbox.sandbox_info();
4547
#endif
4648

49+
if (HANDLE job = CreateJobObjectW(nullptr, nullptr); job != nullptr)
50+
{
51+
JOBOBJECT_EXTENDED_LIMIT_INFORMATION limits{};
52+
limits.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
53+
54+
if (SetInformationJobObject(job, JobObjectExtendedLimitInformation, &limits, sizeof(limits)))
55+
{
56+
AssignProcessToJobObject(job, GetCurrentProcess());
57+
}
58+
else
59+
{
60+
CloseHandle(job);
61+
}
62+
}
63+
4764
return CefExecuteProcess(mainArgs, app, sandboxInfo);
4865
}

Client/core/CCore.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ CCore::CCore()
136136
m_pMouseControl = new CMouseControl();
137137

138138
// Create our hook objects.
139-
// m_pFileSystemHook = new CFileSystemHook ( );
140139
m_pDirect3DHookManager = new CDirect3DHookManager();
141140
m_pDirectInputHookManager = new CDirectInputHookManager();
142141
m_pMessageLoopHook = new CMessageLoopHook();
@@ -210,7 +209,6 @@ CCore::~CCore()
210209

211210
// Delete hooks.
212211
delete m_pSetCursorPosHook;
213-
// delete m_pFileSystemHook;
214212
delete m_pDirect3DHookManager;
215213
delete m_pDirectInputHookManager;
216214

@@ -839,12 +837,8 @@ void CCore::ApplyHooks()
839837
// Create our hooks.
840838
m_pDirectInputHookManager->ApplyHook();
841839
// m_pDirect3DHookManager->ApplyHook ( );
842-
// m_pFileSystemHook->ApplyHook ( );
843840
m_pSetCursorPosHook->ApplyHook();
844841

845-
// Redirect basic files.
846-
// m_pFileSystemHook->RedirectFile ( "main.scm", "../../mta/gtafiles/main.scm" );
847-
848842
// Remove useless DirectPlay dependency (dpnhpast.dll) @ 0x745701
849843
// We have to patch here as multiplayer_sa and game_sa are loaded too late
850844
DetourLibraryFunction("kernel32.dll", "LoadLibraryA", Win32LoadLibraryA, SkipDirectPlay_LoadLibraryA);

Client/core/CCore.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,7 @@ class CCore : public CCoreInterface, public CSingleton<CCore>
314314
CMessageLoopHook* m_pMessageLoopHook;
315315
CDirectInputHookManager* m_pDirectInputHookManager;
316316
CDirect3DHookManager* m_pDirect3DHookManager;
317-
// CFileSystemHook * m_pFileSystemHook;
318-
CSetCursorPosHook* m_pSetCursorPosHook;
317+
CSetCursorPosHook* m_pSetCursorPosHook;
319318

320319
bool m_bLastFocused;
321320
int m_iUnminimizeFrameCounter;

vendor/cef3/premake5.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ project "CEF"
1818
local path = buildpath(".")
1919
local cef_path = "%{wks.location}/../Vendor/cef3/cef/"
2020
postbuildcommands {
21-
"{COPY} \""..cef_path.."Release/*\" \""..path.."mta\"",
21+
"robocopy \""..cef_path.."Release\" \""..path.."mta\" /S /IT /NFL /NDL /NJH /XF d3dcompiler_47.dll /XF *.lib",
2222
"{COPY} \""..cef_path.."Resources/icudtl.dat\" \""..path.."mta\"",
2323
"{COPY} \""..cef_path.."Resources/*.pak\" \""..path.."mta\"",
2424
"{COPY} \""..cef_path.."Resources/locales/*\" \""..path.."mta/cef/locales\""

0 commit comments

Comments
 (0)