Permalink
Browse files

Merge branch 'master' into bugfix/resource-load-perf

  • Loading branch information...
botder committed Jan 5, 2019
2 parents 183607b + 22e9ca1 commit fe924a4748b44efec7b95a5e0b35c5804ae7f971
Showing 1,039 changed files with 14,147 additions and 293,307 deletions.
@@ -11,6 +11,7 @@

#include "StdInc.h"
#include <game/CGame.h>
#include <multiplayer/CMultiplayer.h>

#define LOG_EVENT_SIZE 200

@@ -472,6 +473,13 @@ void CCrashDumpWriter::DumpMiniDump(_EXCEPTION_POINTERS* pException, CExceptionI
reportLogContent.LoadFromFile(PathJoin(GetMTADataPath(), "report.log"));
AppendToDumpFile(strPathFilename, reportLogContent, 'REPs', 'REPe');
SetApplicationSetting("diagnostics", "last-dump-extra", "added-report");

// Try to append current animation and task to dump file
SetApplicationSetting("diagnostics", "last-dump-extra", "try-anim-task");
CBuffer currentAnimTaskInfo;
GetCurrentAnimTaskInfo(currentAnimTaskInfo);
AppendToDumpFile(strPathFilename, currentAnimTaskInfo, 'CATs', 'CATe');
SetApplicationSetting("diagnostics", "last-dump-extra", "added-anim-task");
}
}

@@ -1012,6 +1020,24 @@ void CCrashDumpWriter::GetMemoryInfo(CBuffer& buffer)
}
}

void CCrashDumpWriter::GetCurrentAnimTaskInfo(CBuffer& buffer)
{
CBufferWriteStream stream(buffer);

// Write info version
stream.Write(1);
stream.WriteString("-- ** Current Animation Task Info -- **\n\n");

CMultiplayer* pMultiplayer = g_pCore->GetMultiplayer();
if (pMultiplayer)
{
stream.WriteString ( SString (
"Last Animation Added: group ID = %u, animation ID = %u\n",
pMultiplayer->GetLastStaticAnimationGroupID(), pMultiplayer->GetLastStaticAnimationID()
));
}
}

///////////////////////////////////////////////////////////////
//
// CCrashDumpWriter::GetCrashAvertedStatsSoFar
@@ -44,6 +44,7 @@ class CCrashDumpWriter
static void GetLogInfo(CBuffer& buffer);
static void GetDxInfo(CBuffer& buffer);
static void GetMemoryInfo(CBuffer& buffer);
static void GetCurrentAnimTaskInfo(CBuffer& buffer);
static void GetMiscInfo(CBuffer& buffer);
static void OnCrashAverted(uint uiId);
static void OnEnterCrashZone(uint uiId);
@@ -109,6 +109,7 @@ CCredits::CCredits(void)
"Robin \"robhol\" Holm\n"
"Patrik \"myonlake\" Juvonen\n"
"Gabrielius \"Dezash\" Laurinavicius\n"
"Nikita \"StrixG\" Obrecht\n"
"Adam \"50p\" Telega\n"
"Ilya \"Kenix\" Volkov\n"
"Gothem\n"
@@ -137,7 +137,7 @@ void CSettings::CreateGUI(void)
m_pBindsList = reinterpret_cast<CGUIGridList*>(pManager->CreateGridList(pTabBinds, false));
m_pBindsList->SetPosition(CVector2D(10, 15));
m_pBindsList->SetSize(CVector2D(620, 357));
m_pBindsList->SetSorting(false);
m_pBindsList->SetSortingEnabled(false);
m_pBindsList->SetSelectionMode(SelectionModes::CellSingle);
m_pBindsList->SetDoubleClickHandler(GUI_CALLBACK(&CSettings::OnBindsListClick, this));

@@ -69,11 +69,16 @@ CGUIGridList_Impl::~CGUIGridList_Impl(void)
DestroyElement();
}

void CGUIGridList_Impl::SetSorting(bool bEnabled)
void CGUIGridList_Impl::SetSortingEnabled(bool bEnabled)
{
reinterpret_cast<CEGUI::MultiColumnList*>(m_pWindow)->setUserSortControlEnabled(bEnabled);
}

bool CGUIGridList_Impl::IsSortingEnabled(void)
{
return reinterpret_cast<CEGUI::MultiColumnList*>(m_pWindow)->isUserSortControlEnabled();
}

void CGUIGridList_Impl::RemoveColumn(unsigned int uiColumn)
{
try
@@ -383,7 +388,7 @@ int CGUIGridList_Impl::SetItemText(int iRow, int hColumn, const char* szText, bo
}
else
{
pItem->SetFont("default-normal");
pItem->SetFont(win->getFont()->getName().c_str()); // Reset font to the font of the item's parent (the gridlist)
pItem->SetDisabled(false);

if (GetColumnIndex(hColumn) == 0)
@@ -667,6 +672,11 @@ void CGUIGridList_Impl::SetSelectionMode(SelectionMode mode)
}
}

SelectionMode CGUIGridList_Impl::GetSelectionMode(void)
{
return (SelectionMode)reinterpret_cast<CEGUI::MultiColumnList*>(m_pWindow)->getSelectionMode();
}

void CGUIGridList_Impl::GetVisibleRowRange(int& iFirst, int& iLast)
{
reinterpret_cast<CEGUI::MultiColumnList*>(m_pWindow)->getVisibleRowRange(iFirst, iLast);
@@ -30,8 +30,9 @@ class CGUIGridList_Impl : public CGUIGridList, public CGUIElement_Impl
void SetColumnTitle(int hColumn, const char* szTitle);
const char* GetColumnTitle(int hColumn);

void SetSelectionMode(SelectionMode mode);
int SetRowItemsText(int iRow, std::vector<std::pair<SString, bool> >* m_items);
void SetSelectionMode(SelectionMode mode);
SelectionMode GetSelectionMode(void);
int SetRowItemsText(int iRow, std::vector<std::pair<SString, bool> >* m_items);

void ForceUpdate(void);
int AddRow(bool bFast = false, std::vector<std::pair<SString, bool> >* m_items = NULL);
@@ -49,7 +50,8 @@ class CGUIGridList_Impl : public CGUIGridList, public CGUIElement_Impl

void SetHorizontalScrollBar(bool bEnabled);
void SetVerticalScrollBar(bool bEnabled);
void SetSorting(bool bEnabled);
void SetSortingEnabled(bool bEnabled);
bool IsSortingEnabled(void);
void SetItemImage(int iRow, int hColumn, CGUIStaticImage* pImage);

float GetHorizontalScrollPosition(void);
@@ -559,6 +559,26 @@ double CBassAudio::GetLength(void)
return 0;
}

// Streams only
double CBassAudio::GetBufferLength(void)
{
if (m_bStream && m_pSound)
{
QWORD length = BASS_ChannelGetLength(m_pSound, BASS_POS_BYTE);
if (length != -1)
{
QWORD fileSize = BASS_StreamGetFilePosition(m_pSound, BASS_FILEPOS_SIZE);
if (fileSize > 0)
{
QWORD bufferPosition = (BASS_StreamGetFilePosition(m_pSound, BASS_FILEPOS_START) + BASS_StreamGetFilePosition(m_pSound, BASS_FILEPOS_BUFFER));
QWORD bufferLength = static_cast<QWORD>(static_cast<double>(length) / fileSize * bufferPosition);
return BASS_ChannelBytes2Seconds(m_pSound, bufferLength);
}
}
}
return 0;
}

// Streams only
SString CBassAudio::GetMetaTags(const SString& strFormat)
{
@@ -57,6 +57,7 @@ class CBassAudio
void SetPlayPosition(double dPosition);
double GetPlayPosition(void);
double GetLength(void);
double GetBufferLength(void);
void SetVolume(float fVolume);
void SetPlaybackSpeed(float fSpeed);
void SetPosition(const CVector& vecPosition);
@@ -398,8 +398,8 @@ void CClientMarker::Callback_OnLeave(CClientColShape& Shape, CClientEntity& Enti
{
// Call the marker hit event
CLuaArguments Arguments;
Arguments.PushElement(&Entity); // player that hit it
Arguments.PushBoolean((Shape.GetDimension() == Entity.GetDimension())); // matching dimension?
Arguments.PushElement(&Entity); // player that hit it
Arguments.PushBoolean((GetDimension() == Entity.GetDimension())); // matching dimension?
CallEvent("onClientMarkerLeave", Arguments, true);
}
}
@@ -737,6 +737,7 @@ void CClientPed::Spawn(const CVector& vecPosition, float fRotation, unsigned sho
SetMoveSpeed(CVector());
SetInterior(ucInterior);
SetFootBloodEnabled(false);
SetIsDead(false);
}

void CClientPed::ResetInterpolation(void)
@@ -1813,15 +1814,11 @@ bool CClientPed::IsDead(void)
if (m_pPlayerPed)
{
CTask* pTask = m_pTaskManager->GetTask(TASK_PRIORITY_EVENT_RESPONSE_NONTEMP);

if (pTask)
{
if (pTask->GetTaskType() == TASK_SIMPLE_DEAD)
{
return true;
}
}
return false;
return pTask->GetTaskType() == TASK_SIMPLE_DEAD;
}

return m_bDead;
}

@@ -2114,13 +2111,21 @@ bool CClientPed::SetCurrentWeaponSlot(eWeaponSlot weaponSlot)
DWORD ammoInClip = oldWeapon->GetAmmoInClip();
DWORD ammoInTotal = oldWeapon->GetAmmoTotal();
eWeaponType weaponType = oldWeapon->GetType();
RemoveWeapon(oldWeapon->GetType());

bool isGoggles = currentSlot == WEAPONSLOT_TYPE_PARACHUTE && (weaponType == WEAPONTYPE_NIGHTVISION || weaponType == WEAPONTYPE_INFRARED);
if (!isGoggles)
{
RemoveWeapon(oldWeapon->GetType());
}

m_pPlayerPed->SetCurrentWeaponSlot(WEAPONSLOT_TYPE_UNARMED);

CWeapon* newWeapon = GiveWeapon(weaponType, ammoInTotal);
newWeapon->SetAmmoInClip(ammoInClip);
newWeapon->SetAmmoTotal(ammoInTotal);
if (!isGoggles)
{
CWeapon* newWeapon = GiveWeapon(weaponType, ammoInTotal);
newWeapon->SetAmmoInClip(ammoInClip);
newWeapon->SetAmmoTotal(ammoInTotal);
}

// Don't allow doing gang driveby while unarmed
if (IsDoingGangDriveby())
@@ -356,6 +356,15 @@ double CClientSound::GetLength(bool bAvoidLoad)
return m_dLength;
}

double CClientSound::GetBufferLength()
{
if (m_bStream && m_pAudio)
{
return m_pAudio->GetBufferLength();
}
return 0;
}

float CClientSound::GetVolume(void)
{
return m_fVolume;
@@ -732,4 +741,4 @@ bool CClientSound::SetPan(float fPan)
}

return false;
}
}
@@ -43,6 +43,7 @@ class CClientSound : public CClientEntity
double GetPlayPosition(void);

double GetLength(bool bAvoidLoad = false);
double GetBufferLength();

void SetVolume(float fVolume, bool bStore = true);
float GetVolume(void);
@@ -94,7 +94,7 @@ CLocalServer::CLocalServer(const char* szConfig)
m_pResourcesCur = reinterpret_cast<CGUIGridList*>(m_pGUI->CreateGridList(m_pTabResources, false));
m_pResourcesCur->SetPosition(CVector2D(0.03f, 0.06f), true);
m_pResourcesCur->SetSize(CVector2D(0.45f, 0.5f), true);
m_pResourcesCur->SetSorting(false);
m_pResourcesCur->SetSortingEnabled(false);
m_pResourcesCur->SetSelectionMode(SelectionModes::CellSingle);
m_hResourcesCur = m_pResourcesCur->AddColumn(_("Selected"), 0.80f);

@@ -111,7 +111,7 @@ CLocalServer::CLocalServer(const char* szConfig)
m_pResourcesAll = reinterpret_cast<CGUIGridList*>(m_pGUI->CreateGridList(m_pTabResources, false));
m_pResourcesAll->SetPosition(CVector2D(0.52f, 0.06f), true);
m_pResourcesAll->SetSize(CVector2D(0.45f, 0.9f), true);
m_pResourcesAll->SetSorting(false);
m_pResourcesAll->SetSortingEnabled(false);
m_pResourcesAll->SetSelectionMode(SelectionModes::CellSingle);
m_hResourcesAll = m_pResourcesAll->AddColumn(_("All"), 0.80f);

@@ -751,7 +751,7 @@ void CPacketHandler::Packet_PlayerList(NetBitStreamInterface& bitStream)
}

// Player flags
bool bIsDead = bitStream.ReadBit(); // Unused.
bool bIsDead = bitStream.ReadBit();
bool bIsSpawned = bitStream.ReadBit(); // Indicates extra info in packet. Always true for newer server builds.
bool bInVehicle = bitStream.ReadBit();
bool bHasJetPack = bitStream.ReadBit();
@@ -863,7 +863,14 @@ void CPacketHandler::Packet_PlayerList(NetBitStreamInterface& bitStream)

// Store the nick and if he's dead
pPlayer->SetNick(szNickBuffer);
pPlayer->SetDeadOnNetwork(false);
pPlayer->SetDeadOnNetwork(bIsDead);
pPlayer->SetIsDead(bIsDead);

if (bIsDead)
{
pPlayer->LockHealth(0.0f);
pPlayer->LockArmor(0.0f);
}

if (!strNametagText.empty())
pPlayer->SetNametagText(strNametagText);
@@ -5918,7 +5918,7 @@ void CStaticFunctionDefinitions::GUIGridListSetSortingEnabled(CClientEntity& Ent
if (IS_CGUIELEMENT_GRIDLIST(&GUIElement))
{
// Set sorting is enabled
static_cast<CGUIGridList*>(GUIElement.GetCGUIElement())->SetSorting(bEnabled);
static_cast<CGUIGridList*>(GUIElement.GetCGUIElement())->SetSortingEnabled(bEnabled);
}
}
}
@@ -7640,6 +7640,16 @@ bool CStaticFunctionDefinitions::GetSoundLength(CClientPlayer& Player, double& d
return false;
}

bool CStaticFunctionDefinitions::GetSoundBufferLength(CClientSound& Sound, double& dBufferLength)
{
if (Sound.IsSoundStream())
{
dBufferLength = Sound.GetBufferLength();
return true;
}
return false;
}

bool CStaticFunctionDefinitions::SetSoundPaused(CClientSound& Sound, bool bPaused)
{
Sound.SetPaused(bPaused);
@@ -718,6 +718,7 @@ class CStaticFunctionDefinitions
static bool SetSoundPosition(CClientSound& Sound, double dPosition);
static bool GetSoundPosition(CClientSound& Sound, double& dPosition);
static bool GetSoundLength(CClientSound& Sound, double& dLength);
static bool GetSoundBufferLength(CClientSound& Sound, double& dBufferLength);
static bool SetSoundPaused(CClientSound& Sound, bool bPaused);
static bool IsSoundPaused(CClientSound& Sound, bool& bPaused);
static bool SetSoundVolume(CClientSound& Sound, float fVolume);
Oops, something went wrong.

0 comments on commit fe924a4

Please sign in to comment.