Skip to content

Commit 12d6fce

Browse files
authored
Merge branch 'multitheftauto:master' into patch-6
2 parents 0ae7cf2 + 6230161 commit 12d6fce

File tree

112 files changed

+101020
-99574
lines changed

Some content is hidden

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

112 files changed

+101020
-99574
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,10 @@ jobs:
7070
strategy:
7171
matrix:
7272
architecture: [x64, arm64]
73-
include:
74-
- architecture: x64
75-
image-tag: latest
76-
- architecture: arm64
77-
image-tag: arm64
7873
name: linux-${{ matrix.architecture }}
7974
runs-on: ubuntu-latest
8075
container:
81-
image: docker://ghcr.io/multitheftauto/mtasa-blue-build:${{ matrix.image-tag }}
76+
image: docker://ghcr.io/multitheftauto/mtasa-blue-build:latest
8277
steps:
8378
- uses: actions/checkout@v4
8479

.github/workflows/dockerimage.yaml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,17 @@
11
name: Docker Image
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- master
78
paths:
89
- '.github/workflows/build.yaml'
910
- '.github/workflows/dockerimage.yaml'
10-
- 'utils/compat/**'
11-
- 'Dockerfile'
12-
- 'Dockerfile.i386'
13-
- 'Dockerfile.armhf'
14-
- 'Dockerfile.arm64'
11+
- 'utils/docker/**'
1512

1613
jobs:
1714
build:
18-
strategy:
19-
matrix:
20-
include:
21-
- tag: latest
22-
dockerfile: Dockerfile
23-
- tag: i386
24-
dockerfile: Dockerfile.i386
25-
- tag: armhf
26-
dockerfile: Dockerfile.armhf
27-
- tag: arm64
28-
dockerfile: Dockerfile.arm64
2915
if: github.event.repository.fork == false
3016
runs-on: ubuntu-latest
3117
steps:
@@ -39,5 +25,5 @@ jobs:
3925
- uses: docker/build-push-action@v5
4026
with:
4127
push: true
42-
file: ./${{ matrix.dockerfile }}
43-
tags: ghcr.io/multitheftauto/mtasa-blue-build:${{ matrix.tag }}
28+
context: utils/docker
29+
tags: ghcr.io/multitheftauto/mtasa-blue-build:latest

Client/core/CClientVariables.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ void CClientVariables::LoadDefaults()
358358
DEFAULT("discord_rpc_share_data_firsttime", false); // Display the user data sharing consent dialog box - for the first time
359359
DEFAULT("browser_enable_gpu", true); // Enable GPU in CEF? (allows stuff like WebGL to function)
360360
DEFAULT("process_cpu_affinity", true); // Set CPU 0 affinity to improve game performance and fix the known issue in single-threaded games
361+
DEFAULT("ask_before_disconnect", true); // Ask before disconnecting from a server
361362

362363
if (!Exists("locale"))
363364
{

Client/core/CMainMenu.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,14 @@ bool CMainMenu::OnMenuClick(CGUIMouseEventArgs Args)
842842
case MENU_ITEM_MAP_EDITOR:
843843
AskUserIfHeWantsToDisconnect(m_pHoveredItem->menuType);
844844
return true;
845+
case MENU_ITEM_DISCONNECT:
846+
if (g_pCore->GetCVars()->GetValue("ask_before_disconnect", true))
847+
{
848+
AskUserIfHeWantsToDisconnect(m_pHoveredItem->menuType);
849+
return true;
850+
}
851+
852+
break;
845853
default:
846854
break;
847855
}
@@ -863,7 +871,7 @@ bool CMainMenu::OnMenuClick(CGUIMouseEventArgs Args)
863871
switch (m_pHoveredItem->menuType)
864872
{
865873
case MENU_ITEM_DISCONNECT:
866-
OnDisconnectButtonClick(pElement);
874+
OnDisconnectButtonClick();
867875
break;
868876
case MENU_ITEM_QUICK_CONNECT:
869877
OnQuickConnectButtonClick(pElement, Args.button == LeftButton);
@@ -948,7 +956,7 @@ void CMainMenu::HideServerInfo()
948956
m_ServerInfo.Hide();
949957
}
950958

951-
bool CMainMenu::OnDisconnectButtonClick(CGUIElement* pElement)
959+
bool CMainMenu::OnDisconnectButtonClick()
952960
{
953961
// Return if we haven't faded in yet
954962
if (m_ucFade != FADE_VISIBLE)
@@ -1251,6 +1259,9 @@ void CMainMenu::WantsToDisconnectCallBack(void* pData, uint uiButton)
12511259
case MENU_ITEM_MAP_EDITOR:
12521260
OnEditorButtonClick();
12531261
break;
1262+
case MENU_ITEM_DISCONNECT:
1263+
OnDisconnectButtonClick();
1264+
break;
12541265
default:
12551266
break;
12561267
}

Client/core/CMainMenu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class CMainMenu
8989
bool OnResumeButtonClick(CGUIElement* pElement);
9090
bool OnBrowseServersButtonClick(CGUIElement* pElement);
9191
bool OnHostGameButtonClick();
92-
bool OnDisconnectButtonClick(CGUIElement* pElement);
92+
bool OnDisconnectButtonClick();
9393
bool OnEditorButtonClick();
9494
bool OnSettingsButtonClick(CGUIElement* pElement);
9595
bool OnAboutButtonClick(CGUIElement* pElement);

Client/core/CSettings.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,11 @@ void CSettings::CreateGUI()
411411
m_pPhotoSavingCheckbox->GetPosition(vecTemp, false);
412412
m_pPhotoSavingCheckbox->AutoSize(NULL, 20.0f);
413413

414+
m_pCheckBoxAskBeforeDisconnect = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabMultiplayer, _("Ask before disconnecting from server using main menu"), true));
415+
m_pCheckBoxAskBeforeDisconnect->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 20.0f));
416+
m_pCheckBoxAskBeforeDisconnect->GetPosition(vecTemp, false);
417+
m_pCheckBoxAskBeforeDisconnect->AutoSize(NULL, 20.0f);
418+
414419
m_pCheckBoxCustomizedSAFiles = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabMultiplayer, _("Use customized GTA:SA files"), true));
415420
m_pCheckBoxCustomizedSAFiles->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 20.0f));
416421
m_pCheckBoxCustomizedSAFiles->GetPosition(vecTemp, false);
@@ -3080,6 +3085,10 @@ void CSettings::LoadData()
30803085
CVARS_GET("allow_discord_rpc", bAllowDiscordRPC);
30813086
m_pCheckBoxAllowDiscordRPC->SetSelected(bAllowDiscordRPC);
30823087

3088+
bool bAskBeforeDisconnect;
3089+
CVARS_GET("ask_before_disconnect", bAskBeforeDisconnect);
3090+
m_pCheckBoxAskBeforeDisconnect->SetSelected(bAskBeforeDisconnect);
3091+
30833092
// Customized sa files
30843093
m_pCheckBoxCustomizedSAFiles->SetSelected(GetApplicationSettingInt("customized-sa-files-request") != 0);
30853094
m_pCheckBoxCustomizedSAFiles->SetVisible(GetApplicationSettingInt("customized-sa-files-show") != 0);
@@ -3557,6 +3566,9 @@ void CSettings::SaveData()
35573566
}
35583567
}
35593568

3569+
bool bAskBeforeDisconnect = m_pCheckBoxAskBeforeDisconnect->GetSelected();
3570+
CVARS_SET("ask_before_disconnect", bAskBeforeDisconnect);
3571+
35603572
// Grass
35613573
bool bGrassEnabled = m_pCheckBoxGrass->GetSelected();
35623574
CVARS_SET("grass", bGrassEnabled);

Client/core/CSettings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ class CSettings
216216
CGUICheckBox* m_pWin8ColorCheckBox;
217217
CGUICheckBox* m_pWin8MouseCheckBox;
218218
CGUICheckBox* m_pPhotoSavingCheckbox;
219+
CGUICheckBox* m_pCheckBoxAskBeforeDisconnect;
219220
CGUICheckBox* m_pProcessAffinityCheckbox;
220221
CGUILabel* m_pUpdateBuildTypeLabel;
221222
CGUIComboBox* m_pUpdateBuildTypeCombo;

Client/game_sa/CFireSA.cpp

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

1820
extern CGameSA* pGame;
1921

@@ -209,3 +211,52 @@ void CFireSA::SetNumGenerationsAllowed(char generations)
209211
{
210212
internalInterface->nNumGenerationsAllowed = generations;
211213
}
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+
246+
push ebx
247+
mov ebx, [esp+0Ch]
248+
249+
push ebx
250+
push eax
251+
call AbortFireTask
252+
add esp, 8
253+
254+
pop ebx
255+
jmp CONTINUE_CFire_Extinguish
256+
}
257+
}
258+
259+
void CFireSA::StaticSetHooks()
260+
{
261+
EZHookInstall(CFire_Extinguish);
262+
}

Client/game_sa/CFireSA.h

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

Client/game_sa/CGameSA.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ CGameSA::CGameSA()
247247
CVehicleSA::StaticSetHooks();
248248
CCheckpointSA::StaticSetHooks();
249249
CHudSA::StaticSetHooks();
250+
CFireSA::StaticSetHooks();
250251
CPtrNodeSingleLinkPoolSA::StaticSetHooks();
251252
CVehicleAudioSettingsManagerSA::StaticSetHooks();
252253
}
@@ -889,6 +890,9 @@ void CGameSA::SetIgnoreFireStateEnabled(bool isEnabled)
889890
MemSet((void*)0x64F3DB, 0x90, 14); // CCarEnterExit::IsPlayerToQuitCarEnter
890891

891892
MemSet((void*)0x685A7F, 0x90, 14); // CTaskSimplePlayerOnFoot::ProcessPlayerWeapon
893+
894+
MemSet((void*)0x53A899, 0x90, 5); // CFire::ProcessFire
895+
MemSet((void*)0x53A990, 0x90, 5); // CFire::ProcessFire
892896
}
893897
else
894898
{
@@ -899,6 +903,9 @@ void CGameSA::SetIgnoreFireStateEnabled(bool isEnabled)
899903
MemCpy((void*)0x64F3DB, "\x8B\x85\x90\x04\x00\x00\x85\xC0\x0F\x85\x1B\x01\x00\x00", 14);
900904

901905
MemCpy((void*)0x685A7F, "\x8B\x86\x30\x07\x00\x00\x85\xC0\x0F\x85\x1D\x01\x00\x00", 14);
906+
907+
MemCpy((void*)0x53A899, "\xE8\x82\xF7\x0C\x00", 5);
908+
MemCpy((void*)0x53A990, "\xE8\x8B\xF6\x0C\x00", 5);
902909
}
903910

904911
m_isIgnoreFireStateEnabled = isEnabled;

0 commit comments

Comments
 (0)