-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reverse traffic / seasons stuffs (#78)
* Reverse traffic / seasons stuffs * Fix E_TrafficVehicleFlags 0x800000 * fix pad name * fix pads * Return void for C_StreamingTrafficModule::SetMaxHumanElements * Set fields as public * Fixed used notation --------- Co-authored-by: Segfault <5221072+Segfaultd@users.noreply.github.com>
- Loading branch information
Showing
7 changed files
with
126 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
#include <utils/hooking/hooking.h> | ||
#include "sdk/patterns.h" | ||
|
||
#include <utils/hooking/hook_function.h> | ||
|
||
static InitFunction init([]() { | ||
//Disable traffic | ||
const auto OpenSeasonAddr = hook::pattern("40 55 41 56 48 83 EC 48 83 B9 ? ? ? ? ?").get_first(); | ||
hook::return_function(OpenSeasonAddr); | ||
/** | ||
* Disable traffic | ||
* | ||
* Traffic is automaticaly loaded by the game via C_StreamingTrafficModule::OpenSeason | ||
* after C_StreamMap::OpenPart("freeride") is called. | ||
*/ | ||
hook::return_function(SDK::gPatterns.C_StreamingTrafficModule__OpenSeason); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
code/client/src/sdk/ue/game/traffic/c_streaming_traffic_module.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include "c_streaming_traffic_module.h" | ||
|
||
namespace SDK { | ||
namespace ue::game::traffic { | ||
void C_StreamingTrafficModule::CloseSeason(bool destroyActorItems) { | ||
hook::this_call<void>(gPatterns.C_StreamingTrafficModule__CloseSeason, this, destroyActorItems); | ||
} | ||
|
||
int C_StreamingTrafficModule::GetCurrentSeasonID() { | ||
return m_iSeasonID; | ||
} | ||
|
||
int C_StreamingTrafficModule::GetMaxHumanElements() { | ||
return m_iMaxHumanElements; | ||
} | ||
|
||
int C_StreamingTrafficModule::GetPreviousSeasonID() { | ||
return m_iPrevSeasonID; | ||
} | ||
|
||
bool C_StreamingTrafficModule::GetSeasonOpened() { | ||
return m_iSeasonID != -1; | ||
} | ||
|
||
void C_StreamingTrafficModule::OpenSeason(unsigned int seasonID, bool unk2) { | ||
hook::this_call<void>(gPatterns.C_StreamingTrafficModule__OpenSeason, this, seasonID, unk2); | ||
} | ||
|
||
void C_StreamingTrafficModule::SetMaxHumanElements(int maxHumanElements) { | ||
hook::this_call<void>(gPatterns.C_StreamingTrafficModule__SetMaxHumanElements, this, maxHumanElements); | ||
} | ||
} // namespace ue::game::traffic | ||
} // namespace SDK |
56 changes: 56 additions & 0 deletions
56
code/client/src/sdk/ue/game/traffic/c_streaming_traffic_module.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#pragma once | ||
|
||
#include "../../../c_ticked_module.h" | ||
|
||
#include "../../../patterns.h" | ||
|
||
namespace SDK { | ||
namespace ue::game::traffic { | ||
class C_StreamingTrafficModule: public C_TickedModule { | ||
public: | ||
char pad0[0x8C]; // 0008 - 0094 | ||
int m_iSeasonID; // 0094 - 0098 | ||
int m_iPrevSeasonID; // 0098 - 009C | ||
char pad1[0x64]; // 009C - 0100 | ||
int m_iMaxHumanElements; // 0100 - 0104 | ||
|
||
public: | ||
/** | ||
* @param destroyActorItems see mafia::streaming::C_ActorsSlotWrapper::Close | ||
*/ | ||
void CloseSeason(bool destroyActorItems); | ||
|
||
/** | ||
* Custom method | ||
*/ | ||
int GetCurrentSeasonID(); | ||
|
||
/** | ||
* Custom method | ||
*/ | ||
int GetMaxHumanElements(); | ||
|
||
/** | ||
* Custom method | ||
*/ | ||
int GetPreviousSeasonID(); | ||
|
||
/** | ||
* Check if any season is opened (seasonID != -1) | ||
*/ | ||
bool GetSeasonOpened(); | ||
|
||
/** | ||
* If the current season is not -1, you must close the current season | ||
* with C_StreamingTrafficModule::CloseSeason before using it. | ||
*/ | ||
void OpenSeason(unsigned int seasonID, bool unk2); | ||
|
||
void SetMaxHumanElements(int maxHumanElements); | ||
|
||
static C_StreamingTrafficModule *GetInstance() { | ||
return hook::call<C_StreamingTrafficModule *>(gPatterns.C_StreamingTrafficModule__GetInstance); | ||
} | ||
}; | ||
} // namespace ue::game::traffic | ||
} // namespace SDK |