Skip to content

Commit

Permalink
Add DEADLOCK support (#51)
Browse files Browse the repository at this point in the history
* 🎪

Initial deadlock game supporting. Aint finished

* Add supporting Deadlock in CMakeLists, Add app id for Deadlock

* 🎪

Initial deadlock game supporting. Aint finished

* 🎪

* docs: add DEADLOCK to the supported games list

---------

Co-authored-by: Arsenii es3n1n <[email protected]>
  • Loading branch information
cpz and es3n1n authored Aug 25, 2024
1 parent 8eb2a0d commit f548b0f
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 14 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ set(SOURCE2GEN_SUPPORTED_GAMES
DESKJOB
HL_ALYX
THE_LAB_ROBOT_REPAIR
DEADLOCK
)

option(SOURCE2GEN_GAME "Game to generate" "CS2")
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ git clone --recurse-submodules https://github.com/neverlosecc/source2gen.git

Before building the project in Visual Studio, you will need to update the game definition.
The default definition is `CS2`. \
Possible options are: `CS2`, `SBOX`, `ARTIFACT2`, `ARTIFACT1`, `DOTA2`, `UNDERLORDS`, `DESKJOB`.
Possible options are: `CS2`, `SBOX`, `ARTIFACT2`, `ARTIFACT1`, `DOTA2`, `UNDERLORDS`, `DESKJOB`, `DEADLOCK`.

When using CMake, you can set `cmake -DSOURCE2GEN_GAME=CS2`

Expand Down
2 changes: 2 additions & 0 deletions source2gen-loader/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ namespace {
546560
#elif defined(THE_LAB_ROBOT_REPAIR)
450390
#elif defined(DEADLOCK)
1422450
#else
#error
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "CThreadMutex.h"
#include <type_traits>

#if defined(CS2) || defined(DOTA2)
#if defined(CS2) || defined(DOTA2) || defined(DEADLOCK)
constexpr auto kThreadSpinMutex = 2;
#else
constexpr auto kThreadSpinMutex = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <sdk/interfaces/common/CTSList.h>
#include <type_traits>

#if defined(CS2) || defined(DOTA2)
#if defined(CS2) || defined(DOTA2) || defined(DEADLOCK)
constexpr auto kUtlMemoryPoolBaseVersion = 2;
#else
constexpr auto kUtlMemoryPoolBaseVersion = 1;
Expand Down
8 changes: 4 additions & 4 deletions source2gen/include/sdk/interfaces/common/CUtlTSHash.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <cstdint>
#include <type_traits>

#if defined(CS2) || defined(DOTA2)
#if defined(CS2) || defined(DOTA2) || defined(DEADLOCK)
constexpr auto kUtlTsHashVersion = 2;
#else
constexpr auto kUtlTsHashVersion = 1;
Expand Down Expand Up @@ -166,7 +166,7 @@ class CUtlTSHashV1 {
CUtlMemoryPoolBase m_EntryMemory;
std::array<HashBucket_t, BucketCount> m_aBuckets;

#if defined(DOTA2)
#if defined(DOTA2) || defined(DEADLOCK)
bool m_bNeedsCommit;
CInterlockedInt m_ContentionCheck;
#endif
Expand Down Expand Up @@ -308,7 +308,7 @@ std::vector<T> CUtlTSHashV2<T, Keytype, BucketCount, HashFuncs>::GetElements(int
/// @note: @og: basically, its hacky-way to obtain first-time commited information to memory
#if defined(CS2_OLD)
n_count = PeakAlloc();
#elif defined(DOTA2) || defined(CS2)
#elif defined(DOTA2) || defined(CS2) || defined(DEADLOCK)
n_count = PeakAlloc() - BlocksAllocated();
#endif
std::vector<T> unAllocatedList;
Expand All @@ -329,7 +329,7 @@ std::vector<T> CUtlTSHashV2<T, Keytype, BucketCount, HashFuncs>::GetElements(int

#if defined(CS2_OLD)
return unAllocatedList.size() > AllocatedList.size() ? unAllocatedList : AllocatedList;
#elif defined(DOTA2) || defined(CS2)
#elif defined(DOTA2) || defined(CS2) || defined(DEADLOCK)
return merge_without_duplicates(AllocatedList, unAllocatedList, ptr_compare<T>);
#endif
}
Expand Down
14 changes: 7 additions & 7 deletions source2gen/include/sdk/interfaces/schemasystem/schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ enum {
#error unimplemented
#elif defined(THE_LAB_ROBOT_REPAIR)
#error unimplemented
#elif defined(DOTA2) || defined(CS2)
#elif defined(DOTA2) || defined(CS2) || defined(DEADLOCK)

constexpr auto kSchemaSystemVersion = platform_specific{.windows = 2, .linux = 1}.get();
constexpr auto kSchemaSystem_PAD0 = platform_specific{.windows = 0x188, .linux = 0x188 + 0x68}.get();
Expand Down Expand Up @@ -184,7 +184,7 @@ using CSchemaClassBinding = CSchemaClassInfo;
// @note: @og: now CSchemaEnumBinding is the same class\structure as CSchemaEnumInfoData\SchemaEnumInfoData_t
using CSchemaEnumBinding = CSchemaEnumInfo;

#if defined(CS2) || defined(DOTA2)
#if defined(CS2) || defined(DOTA2) || defined(DEADLOCK)
enum SchemaClassFlags_t {
SCHEMA_CF1_HAS_VIRTUAL_MEMBERS = (1 << 0),
SCHEMA_CF1_IS_ABSTRACT = (1 << 1),
Expand Down Expand Up @@ -385,15 +385,15 @@ class CSchemaType {
[[nodiscard]] CSchemaType* GetRefClass();

[[nodiscard]] ETypeCategory GetTypeCategory() const {
#if defined(CS2) || defined(DOTA2)
#if defined(CS2) || defined(DOTA2) || defined(DEADLOCK)
return m_unTypeCategory;
#else
return Virtual::Get<ETypeCategory (*)(CSchemaType*)>(this, 0)(this);
#endif
}

[[nodiscard]] EAtomicCategory GetAtomicCategory() const {
#if defined(CS2) || defined(DOTA2)
#if defined(CS2) || defined(DOTA2) || defined(DEADLOCK)
return m_unAtomicCategory;
#else
return Virtual::Get<EAtomicCategory (*)(CSchemaType*)>(this, 1)(this);
Expand All @@ -406,7 +406,7 @@ class CSchemaType {

CSchemaSystemTypeScope* m_pTypeScope; // 0x0010

#if defined(CS2) || defined(DOTA2)
#if defined(CS2) || defined(DOTA2) || defined(DEADLOCK)
ETypeCategory m_unTypeCategory; // 0x0018
EAtomicCategory m_unAtomicCategory; // 0x0019
IF_LINUX(char _pad_0x20[0x02];)
Expand Down Expand Up @@ -755,7 +755,7 @@ class CSchemaPtrMap {
char pad_0x28[0x08];
#endif

#if !defined(DOTA2) && !defined(CS2)
#if !defined(DOTA2) && !defined(CS2) && !defined(DEADLOCK)
CThreadFastMutex m_Mutex;
#endif
};
Expand Down Expand Up @@ -901,7 +901,7 @@ class CSchemaSystemTypeScope {
CSchemaPtrMap<TypeAndCountInfo_t, CSchemaType_FixedArray*> m_FixedArrays; // 0x0558
CSchemaPtrMap<int, CSchemaType_Bitfield*> m_Bitfields; // 0x0588

#if !defined(DOTA2) && !defined(CS2)
#if !defined(DOTA2) && !defined(CS2) && !defined(DEADLOCK)
CSchemaType_NoschemaType m_pNoschemaType = {};
#endif

Expand Down

0 comments on commit f548b0f

Please sign in to comment.