Skip to content

Commit

Permalink
Merge branch 'master' into 061024_onClientBrowserConsoleMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
Dutchman101 authored Dec 21, 2024
2 parents 10ff47b + c0376c9 commit 96e3825
Show file tree
Hide file tree
Showing 109 changed files with 2,014 additions and 1,470 deletions.
8 changes: 4 additions & 4 deletions Client/cefweb/CWebView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,10 +936,10 @@ void CWebView::OnBeforeClose(CefRefPtr<CefBrowser> browser)
// //
// //
////////////////////////////////////////////////////////////////////
bool CWebView::OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, const CefString& target_url, const CefString& target_frame_name,
CefLifeSpanHandler::WindowOpenDisposition target_disposition, bool user_gesture, const CefPopupFeatures& popupFeatures,
CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings, CefRefPtr<CefDictionaryValue>& extra_info,
bool* no_javascript_access)
bool CWebView::OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, int popup_id, const CefString& target_url,
const CefString& target_frame_name, CefLifeSpanHandler::WindowOpenDisposition target_disposition, bool user_gesture,
const CefPopupFeatures& popupFeatures, CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings,
CefRefPtr<CefDictionaryValue>& extra_info, bool* no_javascript_access)
{
// ATTENTION: This method is called on the IO thread

Expand Down
8 changes: 4 additions & 4 deletions Client/cefweb/CWebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ class CWebView : public CWebViewInterface,

// CefLifeSpawnHandler methods
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) override;
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, const CefString& target_url, const CefString& target_frame_name,
CefLifeSpanHandler::WindowOpenDisposition target_disposition, bool user_gesture, const CefPopupFeatures& popupFeatures,
CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings, CefRefPtr<CefDictionaryValue>& extra_info,
bool* no_javascript_access) override;
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, int popup_id, const CefString& target_url,
const CefString& target_frame_name, CefLifeSpanHandler::WindowOpenDisposition target_disposition, bool user_gesture,
const CefPopupFeatures& popupFeatures, CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings,
CefRefPtr<CefDictionaryValue>& extra_info, bool* no_javascript_access) override;
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) override;

// CefJSDialogHandler methods
Expand Down
1 change: 0 additions & 1 deletion Client/core/CConsole.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class CConsole : public CConsoleInterface
bool IsInputActive();
void ActivateInput();

void HandleTextAccepted(bool bHandled);
void GetCommandInfo(const std::string& strIn, std::string& strCmdOut, std::string& strCmdLineOut);

void ResetHistoryChanges();
Expand Down
2 changes: 1 addition & 1 deletion Client/core/CQueryReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ SQueryInfo CQueryReceiver::GetServerResponse()

// Recover server ping status if present
const SString strPingStatus = strBuildNumber.Right(strBuildNumber.length() - strlen(strBuildNumber) - 1);
CCore::GetSingleton().GetNetwork()->UpdatePingStatus(*strPingStatus, info.players, info.isStatusVerified);
CCore::GetSingleton().GetNetwork()->UpdatePingStatus(strPingStatus.c_str(), strPingStatus.length(), info.players, info.isStatusVerified);

// Recover server http port if present
const SString strNetRoute = strPingStatus.Right(strPingStatus.length() - strlen(strPingStatus) - 1);
Expand Down
12 changes: 11 additions & 1 deletion Client/game_sa/CBuildingsPoolSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ CBuilding* CBuildingsPoolSA::AddBuilding(CClientBuilding* pClientBuilding, uint1
if (!HasFreeBuildingSlot())
return nullptr;

auto modelInfo = pGame->GetModelInfo(modelId);

// Change the properties group to force dynamic models to be created as buildings instead of dummies
auto prevGroup = modelInfo->GetObjectPropertiesGroup();
if (prevGroup != MODEL_PROPERTIES_GROUP_STATIC)
modelInfo->SetObjectPropertiesGroup(MODEL_PROPERTIES_GROUP_STATIC);

// Load building
SFileObjectInstance instance;
instance.modelID = modelId;
Expand All @@ -70,9 +77,12 @@ CBuilding* CBuildingsPoolSA::AddBuilding(CClientBuilding* pClientBuilding, uint1
pBuilding->m_pLod = nullptr;
pBuilding->m_iplIndex = 0;

// Restore changed properties group
if (prevGroup != MODEL_PROPERTIES_GROUP_STATIC)
modelInfo->SetObjectPropertiesGroup(prevGroup);

// Always stream model collosion
// TODO We can setup collison bounding box and use GTA streamer for it
auto modelInfo = pGame->GetModelInfo(modelId);
modelInfo->AddColRef();

// Add building in world
Expand Down
2 changes: 1 addition & 1 deletion Client/game_sa/CEntitySA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ bool CEntitySA::GetBonePosition(eBone boneId, CVector& position)
return false;

const RwV3d& pos = rwBoneMatrix->pos;
position = {pos.x, pos.y, pos.z};
position = CVector(pos.x, pos.y, pos.z);
return true;
}

Expand Down
66 changes: 46 additions & 20 deletions Client/game_sa/CGameSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ CGameSA::CGameSA()
m_pAESoundManager = new CAESoundManagerSA((CAESoundManagerSAInterface*)CLASS_CAESoundManager);
m_pAudioContainer = new CAudioContainerSA();
m_pWorld = new CWorldSA();
m_pPools = new CPoolsSA();
m_Pools = std::make_unique<CPoolsSA>();
m_pClock = new CClockSA();
m_pRadar = new CRadarSA();
m_pCamera = new CCameraSA((CCameraSAInterface*)CLASS_CCamera);
Expand All @@ -125,7 +125,7 @@ CGameSA::CGameSA()
m_pControllerConfigManager = new CControllerConfigManagerSA();
m_pProjectileInfo = new CProjectileInfoSA();
m_pRenderWare = new CRenderWareSA();
m_pHandlingManager = new CHandlingManagerSA();
m_HandlingManager = std::make_unique<CHandlingManagerSA>();
m_pEventList = new CEventListSA();
m_pGarages = new CGaragesSA((CGaragesSAInterface*)CLASS_CGarages);
m_pTasks = new CTasksSA((CTaskManagementSystemSA*)m_pTaskManagementSystem);
Expand Down Expand Up @@ -208,17 +208,17 @@ CGameSA::CGameSA()
m_Cheats[CHEAT_HEALTARMORMONEY] = new SCheatSA((BYTE*)VAR_HealthArmorMoney, false);

// Change pool sizes here
m_pPools->SetPoolCapacity(TASK_POOL, 5000); // Default is 500
m_pPools->SetPoolCapacity(OBJECT_POOL, MAX_OBJECTS); // Default is 350
m_pPools->SetPoolCapacity(EVENT_POOL, 5000); // Default is 200
m_pPools->SetPoolCapacity(COL_MODEL_POOL, 12000); // Default is 10150
m_pPools->SetPoolCapacity(ENV_MAP_MATERIAL_POOL, 16000); // Default is 4096
m_pPools->SetPoolCapacity(ENV_MAP_ATOMIC_POOL, 4000); // Default is 1024
m_pPools->SetPoolCapacity(SPEC_MAP_MATERIAL_POOL, 16000); // Default is 4096
m_pPools->SetPoolCapacity(ENTRY_INFO_NODE_POOL, MAX_ENTRY_INFO_NODES); // Default is 500
m_pPools->SetPoolCapacity(POINTER_SINGLE_LINK_POOL, MAX_POINTER_SINGLE_LINKS); // Default is 70000
m_pPools->SetPoolCapacity(POINTER_DOUBLE_LINK_POOL, MAX_POINTER_DOUBLE_LINKS); // Default is 3200
dassert(m_pPools->GetPoolCapacity(POINTER_SINGLE_LINK_POOL) == MAX_POINTER_SINGLE_LINKS);
m_Pools->SetPoolCapacity(TASK_POOL, 5000); // Default is 500
m_Pools->SetPoolCapacity(OBJECT_POOL, MAX_OBJECTS); // Default is 350
m_Pools->SetPoolCapacity(EVENT_POOL, 5000); // Default is 200
m_Pools->SetPoolCapacity(COL_MODEL_POOL, 12000); // Default is 10150
m_Pools->SetPoolCapacity(ENV_MAP_MATERIAL_POOL, 16000); // Default is 4096
m_Pools->SetPoolCapacity(ENV_MAP_ATOMIC_POOL, 4000); // Default is 1024
m_Pools->SetPoolCapacity(SPEC_MAP_MATERIAL_POOL, 16000); // Default is 4096
m_Pools->SetPoolCapacity(ENTRY_INFO_NODE_POOL, MAX_ENTRY_INFO_NODES); // Default is 500
m_Pools->SetPoolCapacity(POINTER_SINGLE_LINK_POOL, MAX_POINTER_SINGLE_LINKS); // Default is 70000
m_Pools->SetPoolCapacity(POINTER_DOUBLE_LINK_POOL, MAX_POINTER_DOUBLE_LINKS); // Default is 3200
dassert(m_Pools->GetPoolCapacity(POINTER_SINGLE_LINK_POOL) == MAX_POINTER_SINGLE_LINKS);

// Increase streaming object instances list size
MemPut<WORD>(0x05B8E55, MAX_RWOBJECT_INSTANCES * 12); // Default is 1000 * 12
Expand Down Expand Up @@ -261,7 +261,6 @@ CGameSA::~CGameSA()
delete reinterpret_cast<CAnimManagerSA*>(m_pAnimManager);
delete reinterpret_cast<CTasksSA*>(m_pTasks);
delete reinterpret_cast<CTaskManagementSystemSA*>(m_pTaskManagementSystem);
delete reinterpret_cast<CHandlingManagerSA*>(m_pHandlingManager);
delete reinterpret_cast<CStatsSA*>(m_pStats);
delete reinterpret_cast<CWeatherSA*>(m_pWeather);
delete reinterpret_cast<CAERadioTrackManagerSA*>(m_pCAERadioTrackManager);
Expand All @@ -276,7 +275,6 @@ CGameSA::~CGameSA()
delete reinterpret_cast<CCameraSA*>(m_pCamera);
delete reinterpret_cast<CRadarSA*>(m_pRadar);
delete reinterpret_cast<CClockSA*>(m_pClock);
delete reinterpret_cast<CPoolsSA*>(m_pPools);
delete reinterpret_cast<CWorldSA*>(m_pWorld);
delete reinterpret_cast<CAudioEngineSA*>(m_pAudioEngine);
delete reinterpret_cast<CAEAudioHardwareSA*>(m_pAEAudioHardware);
Expand Down Expand Up @@ -848,6 +846,34 @@ void CGameSA::SetRoadSignsTextEnabled(bool isEnabled)
m_isRoadSignsTextEnabled = isEnabled;
}

void CGameSA::SetIgnoreFireStateEnabled(bool isEnabled)
{
if (isEnabled == m_isIgnoreFireStateEnabled)
return;

if (isEnabled)
{
MemSet((void*)0x6511B9, 0x90, 10); // CCarEnterExit::IsVehicleStealable
MemSet((void*)0x643A95, 0x90, 14); // CTaskComplexEnterCar::CreateFirstSubTask
MemSet((void*)0x6900B5, 0x90, 14); // CTaskComplexCopInCar::ControlSubTask
MemSet((void*)0x64F3DB, 0x90, 14); // CCarEnterExit::IsPlayerToQuitCarEnter

MemSet((void*)0x685A7F, 0x90, 14); // CTaskSimplePlayerOnFoot::ProcessPlayerWeapon
}
else
{
// Restore original bytes
MemCpy((void*)0x6511B9, "\x88\x86\x90\x04\x00\x00\x85\xC0\x75\x3E", 10);
MemCpy((void*)0x643A95, "\x8B\x88\x90\x04\x00\x00\x85\xC9\x0F\x85\x99\x01\x00\x00", 14);
MemCpy((void*)0x6900B5, "\x8B\x81\x90\x04\x00\x00\x85\xC0\x0F\x85\x1A\x01\x00\x00", 14);
MemCpy((void*)0x64F3DB, "\x8B\x85\x90\x04\x00\x00\x85\xC0\x0F\x85\x1B\x01\x00\x00", 14);

MemCpy((void*)0x685A7F, "\x8B\x86\x30\x07\x00\x00\x85\xC0\x0F\x85\x1D\x01\x00\x00", 14);
}

m_isIgnoreFireStateEnabled = isEnabled;
}

bool CGameSA::PerformChecks()
{
std::map<std::string, SCheatSA*>::iterator it;
Expand Down Expand Up @@ -1011,8 +1037,8 @@ void CGameSA::RemoveAllBuildings()
{
m_pIplStore->SetDynamicIplStreamingEnabled(false);

m_pPools->GetDummyPool().RemoveAllBuildingLods();
m_pPools->GetBuildingsPool().RemoveAllBuildings();
m_Pools->GetDummyPool().RemoveAllBuildingLods();
m_Pools->GetBuildingsPool().RemoveAllBuildings();

auto pBuildingRemoval = static_cast<CBuildingRemovalSA*>(m_pBuildingRemoval);
pBuildingRemoval->DropCaches();
Expand All @@ -1022,8 +1048,8 @@ void CGameSA::RemoveAllBuildings()

void CGameSA::RestoreGameBuildings()
{
m_pPools->GetBuildingsPool().RestoreAllBuildings();
m_pPools->GetDummyPool().RestoreAllBuildingsLods();
m_Pools->GetBuildingsPool().RestoreAllBuildings();
m_Pools->GetDummyPool().RestoreAllBuildingsLods();

m_pIplStore->SetDynamicIplStreamingEnabled(true, [](CIplSAInterface* ipl) { return memcmp("barriers", ipl->name, 8) != 0; });
m_isBuildingsRemoved = false;
Expand All @@ -1041,7 +1067,7 @@ bool CGameSA::SetBuildingPoolSize(size_t size)
static_cast<CBuildingRemovalSA*>(m_pBuildingRemoval)->DropCaches();
}

bool status = m_pPools->GetBuildingsPool().Resize(size);
bool status = m_Pools->GetBuildingsPool().Resize(size);

if (shouldRemoveBuilding)
{
Expand Down
79 changes: 41 additions & 38 deletions Client/game_sa/CGameSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class CGameSA : public CGame
CGameSA();
~CGameSA();

CPools* GetPools() { return m_pPools; }
CPools* GetPools() const noexcept { return m_Pools.get(); }
CPlayerInfo* GetPlayerInfo() { return m_pPlayerInfo; }
CProjectileInfo* GetProjectileInfo() { return m_pProjectileInfo; }
CRadar* GetRadar() { return m_pRadar; }
Expand Down Expand Up @@ -155,7 +155,7 @@ class CGameSA : public CGame
CCarEnterExit* GetCarEnterExit() { return m_pCarEnterExit; }
CControllerConfigManager* GetControllerConfigManager() { return m_pControllerConfigManager; }
CRenderWare* GetRenderWare() { return m_pRenderWare; }
CHandlingManager* GetHandlingManager() { return m_pHandlingManager; }
CHandlingManager* GetHandlingManager() const noexcept { return m_HandlingManager.get(); }
CAnimManager* GetAnimManager() { return m_pAnimManager; }
CStreaming* GetStreaming() { return m_pStreaming; }
CVisibilityPlugins* GetVisibilityPlugins() { return m_pVisibilityPlugins; }
Expand Down Expand Up @@ -249,6 +249,8 @@ class CGameSA : public CGame
bool IsTunnelWeatherBlendEnabled() const noexcept override { return m_isTunnelWeatherBlendEnabled; }
void SetTunnelWeatherBlendEnabled(bool isEnabled) override;

bool IsIgnoreFireStateEnabled() const noexcept override { return m_isIgnoreFireStateEnabled; }
void SetIgnoreFireStateEnabled(bool isEnabled) override;

unsigned long GetMinuteDuration();
void SetMinuteDuration(unsigned long ulTime);
Expand Down Expand Up @@ -311,42 +313,42 @@ class CGameSA : public CGame
bool SetBuildingPoolSize(size_t size);

private:
CPools* m_pPools;
CPlayerInfo* m_pPlayerInfo;
CProjectileInfo* m_pProjectileInfo;
CRadar* m_pRadar;
CClock* m_pClock;
CCoronas* m_pCoronas;
CCheckpoints* m_pCheckpoints;
CEventList* m_pEventList;
CFireManager* m_pFireManager;
CGarages* m_pGarages;
CHud* m_pHud;
CWeather* m_pWeather;
CWorld* m_pWorld;
CCamera* m_pCamera;
CModelInfo* m_pModelInfo;
CPickups* m_pPickups;
CWeaponInfo* m_pWeaponInfo;
CExplosionManager* m_pExplosionManager;
C3DMarkers* m_p3DMarkers;
CRenderWareSA* m_pRenderWare;
CHandlingManager* m_pHandlingManager;
CAnimManager* m_pAnimManager;
CStreaming* m_pStreaming;
CVisibilityPlugins* m_pVisibilityPlugins;
CKeyGen* m_pKeyGen;
CRopes* m_pRopes;
CFx* m_pFx;
CFxManagerSA* m_pFxManager;
CWaterManager* m_pWaterManager;
CWeaponStatManager* m_pWeaponStatsManager;
CPointLights* m_pPointLights;
CColStore* m_collisionStore;
CObjectGroupPhysicalProperties* m_pObjectGroupPhysicalProperties;
CCoverManagerSA* m_pCoverManager;
CPlantManagerSA* m_pPlantManager;
CBuildingRemoval* m_pBuildingRemoval;
std::unique_ptr<CPools> m_Pools;
CPlayerInfo* m_pPlayerInfo;
CProjectileInfo* m_pProjectileInfo;
CRadar* m_pRadar;
CClock* m_pClock;
CCoronas* m_pCoronas;
CCheckpoints* m_pCheckpoints;
CEventList* m_pEventList;
CFireManager* m_pFireManager;
CGarages* m_pGarages;
CHud* m_pHud;
CWeather* m_pWeather;
CWorld* m_pWorld;
CCamera* m_pCamera;
CModelInfo* m_pModelInfo;
CPickups* m_pPickups;
CWeaponInfo* m_pWeaponInfo;
CExplosionManager* m_pExplosionManager;
C3DMarkers* m_p3DMarkers;
CRenderWareSA* m_pRenderWare;
std::unique_ptr<CHandlingManager> m_HandlingManager;
CAnimManager* m_pAnimManager;
CStreaming* m_pStreaming;
CVisibilityPlugins* m_pVisibilityPlugins;
CKeyGen* m_pKeyGen;
CRopes* m_pRopes;
CFx* m_pFx;
CFxManagerSA* m_pFxManager;
CWaterManager* m_pWaterManager;
CWeaponStatManager* m_pWeaponStatsManager;
CPointLights* m_pPointLights;
CColStore* m_collisionStore;
CObjectGroupPhysicalProperties* m_pObjectGroupPhysicalProperties;
CCoverManagerSA* m_pCoverManager;
CPlantManagerSA* m_pPlantManager;
CBuildingRemoval* m_pBuildingRemoval;

std::unique_ptr<CRendererSA> m_pRenderer;

Expand Down Expand Up @@ -378,6 +380,7 @@ class CGameSA : public CGame
bool m_isRoadSignsTextEnabled{true};
bool m_isBuildingsRemoved{false};
bool m_isExtendedWaterCannonsEnabled{false};
bool m_isIgnoreFireStateEnabled{false};

static unsigned int& ClumpOffset;

Expand Down
Loading

0 comments on commit 96e3825

Please sign in to comment.