Skip to content

Commit 22a2a6e

Browse files
authored
Merge branch 'master' into startstop
2 parents 4660045 + c7d40e8 commit 22a2a6e

File tree

528 files changed

+118486
-100201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

528 files changed

+118486
-100201
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;

Client/game_sa/CDirectorySA.cpp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*****************************************************************************
2+
*
3+
* PROJECT: Multi Theft Auto
4+
* LICENSE: See LICENSE in the top level directory
5+
* FILE: game_sa/CDirectorySA.cpp
6+
*
7+
* Multi Theft Auto is available from https://www.multitheftauto.com/
8+
*
9+
*****************************************************************************/
10+
11+
#include "StdInc.h"
12+
#include "CDirectorySA.h"
13+
14+
DirectoryInfoSA* CDirectorySAInterface::GetModelEntry(std::uint16_t modelId)
15+
{
16+
if (m_nNumEntries <= 0)
17+
return nullptr;
18+
19+
DirectoryInfoSA* entry = m_pEntries + modelId;
20+
21+
if (!entry)
22+
return nullptr;
23+
24+
return entry;
25+
}
26+
27+
bool CDirectorySAInterface::SetModelStreamingSize(std::uint16_t modelId, std::uint16_t size)
28+
{
29+
DirectoryInfoSA* entry = GetModelEntry(modelId);
30+
31+
if (!entry)
32+
return false;
33+
34+
if (entry->m_nStreamingSize == size)
35+
return false;
36+
37+
entry->m_nStreamingSize = size;
38+
return true;
39+
}
40+
41+
42+
std::uint16_t CDirectorySAInterface::GetModelStreamingSize(std::uint16_t modelId)
43+
{
44+
DirectoryInfoSA* entry = GetModelEntry(modelId);
45+
46+
if (!entry)
47+
return 0;
48+
49+
return entry->m_nStreamingSize;
50+
}

Client/game_sa/CDirectorySA.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*****************************************************************************
2+
*
3+
* PROJECT: Multi Theft Auto
4+
* LICENSE: See LICENSE in the top level directory
5+
* FILE: game_sa/CDirectorySA.h
6+
*
7+
* Multi Theft Auto is available from https://www.multitheftauto.com/
8+
*
9+
*****************************************************************************/
10+
11+
#pragma once
12+
13+
struct DirectoryInfoSA
14+
{
15+
std::uint32_t m_nOffset;
16+
std::uint16_t m_nStreamingSize;
17+
std::uint16_t m_nSizeInArchive;
18+
char m_szName[24];
19+
};
20+
21+
class CDirectorySAInterface
22+
{
23+
public:
24+
DirectoryInfoSA* GetModelEntry(std::uint16_t modelId);
25+
bool SetModelStreamingSize(std::uint16_t modelId, std::uint16_t size);
26+
std::uint16_t GetModelStreamingSize(std::uint16_t modelId);
27+
28+
private:
29+
DirectoryInfoSA* m_pEntries{};
30+
std::uint32_t m_nCapacity{};
31+
std::uint32_t m_nNumEntries{};
32+
bool m_bOwnsEntries{};
33+
};

Client/game_sa/CFireSA.cpp

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
#include "CFireSA.h"
1515
#include "CGameSA.h"
1616
#include "CPoolsSA.h"
17-
#include <game/CTaskManager.h>
18-
#include <game/TaskTypes.h>
1917

2018
extern CGameSA* pGame;
2119

@@ -211,49 +209,3 @@ void CFireSA::SetNumGenerationsAllowed(char generations)
211209
{
212210
internalInterface->nNumGenerationsAllowed = generations;
213211
}
214-
215-
////////////////////////////////////////////////////////////////////////
216-
// CFire::Extinguish
217-
//
218-
// Fix GH #3249 (PLAYER_ON_FIRE task is not aborted after the fire is extinguished)
219-
////////////////////////////////////////////////////////////////////////
220-
static void AbortFireTask(CEntitySAInterface* entityOnFire, DWORD returnAddress)
221-
{
222-
// We can't and shouldn't remove the task if we're in CTaskSimplePlayerOnFire::ProcessPed. Otherwise we will crash.
223-
if (returnAddress == 0x633783)
224-
return;
225-
226-
auto ped = pGame->GetPools()->GetPed(reinterpret_cast<DWORD*>(entityOnFire));
227-
if (!ped || !ped->pEntity)
228-
return;
229-
230-
CTaskManager* taskManager = ped->pEntity->GetPedIntelligence()->GetTaskManager();
231-
if (!taskManager)
232-
return;
233-
234-
taskManager->RemoveTaskSecondary(TASK_SECONDARY_PARTIAL_ANIM, TASK_SIMPLE_PLAYER_ON_FIRE);
235-
}
236-
237-
#define HOOKPOS_CFire_Extinguish 0x539429
238-
#define HOOKSIZE_CFire_Extinguish 6
239-
static constexpr std::uintptr_t CONTINUE_CFire_Extinguish = 0x53942F;
240-
static void _declspec(naked) HOOK_CFire_Extinguish()
241-
{
242-
_asm
243-
{
244-
mov [eax+730h], edi
245-
mov ebx, [esp+8]
246-
247-
push ebx
248-
push eax
249-
call AbortFireTask
250-
add esp, 8
251-
252-
jmp CONTINUE_CFire_Extinguish
253-
}
254-
}
255-
256-
void CFireSA::StaticSetHooks()
257-
{
258-
EZHookInstall(CFire_Extinguish);
259-
}

Client/game_sa/CFireSA.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,4 @@ class CFireSA : public CFire
6464
void SetStrength(float fStrength);
6565
void SetNumGenerationsAllowed(char generations);
6666
CFireSAInterface* GetInterface() { return internalInterface; }
67-
68-
static void StaticSetHooks();
6967
};

Client/game_sa/CGameSA.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ CGameSA::CGameSA()
246246
CVehicleSA::StaticSetHooks();
247247
CCheckpointSA::StaticSetHooks();
248248
CHudSA::StaticSetHooks();
249-
CFireSA::StaticSetHooks();
250249
CPtrNodeSingleLinkPoolSA::StaticSetHooks();
251250
}
252251
catch (const std::bad_alloc& e)

0 commit comments

Comments
 (0)