Skip to content

Commit

Permalink
Optimize size of GameDependencies initialization code and const data
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkrupinski committed Sep 24, 2024
1 parent 2f6fca5 commit 8f6d02a
Show file tree
Hide file tree
Showing 13 changed files with 189 additions and 193 deletions.
1 change: 0 additions & 1 deletion Source/CS2/Classes/Entities/CBaseAnimGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace cs2
{

struct CBaseAnimGraph : C_BaseEntity {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVCBaseAnimGraph@@", "14CBaseAnimGraph")};
};

}
2 changes: 0 additions & 2 deletions Source/CS2/Classes/Entities/C_CSPlayerPawn.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ struct CCSPlayer_HostageServices;
struct CCSPlayer_WeaponServices;

struct C_CSPlayerPawn : C_BaseEntity {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_CSPlayerPawn@@", "14C_CSPlayerPawn")};

using m_bGunGameImmunity = bool;
using m_pWeaponServices = CCSPlayer_WeaponServices*;
using m_hController = CEntityHandle;
Expand Down
5 changes: 0 additions & 5 deletions Source/CS2/Classes/Entities/GrenadeProjectiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,16 @@ namespace cs2
{

struct C_HEGrenadeProjectile : C_BaseCSGrenadeProjectile {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_HEGrenadeProjectile@@", "21C_HEGrenadeProjectile")};
};

struct C_SmokeGrenadeProjectile : C_BaseCSGrenadeProjectile {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_SmokeGrenadeProjectile@@", "24C_SmokeGrenadeProjectile")};

using m_bDidSmokeEffect = bool;
};

struct C_MolotovProjectile : C_BaseCSGrenadeProjectile {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_MolotovProjectile@@", "19C_MolotovProjectile")};
};

struct C_FlashbangProjectile : C_BaseCSGrenadeProjectile {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_FlashbangProjectile@@", "21C_FlashbangProjectile")};
};

}
38 changes: 0 additions & 38 deletions Source/CS2/Classes/Entities/WeaponEntities.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,155 +7,117 @@ namespace cs2
{

struct C_WeaponGlock : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponGlock@@", "13C_WeaponGlock")};
};

struct C_WeaponHKP2000 : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponHKP2000@@", "15C_WeaponHKP2000")};
};

struct C_WeaponElite : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponElite@@", "13C_WeaponElite")};
};

struct C_WeaponP250 : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponP250@@", "12C_WeaponP250")};
};

struct C_WeaponTec9 : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponTec9@@", "12C_WeaponTec9")};
};

struct C_WeaponFiveSeven : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponFiveSeven@@", "17C_WeaponFiveSeven")};
};

struct C_DEagle : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_DEagle@@", "8C_DEagle")};
};

struct C_WeaponMAC10 : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponMAC10@@", "13C_WeaponMAC10")};
};

struct C_WeaponMP7 : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponMP7@@", "11C_WeaponMP7")};
};

struct C_WeaponMP9 : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponMP9@@", "11C_WeaponMP9")};
};

struct C_WeaponUMP45 : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponUMP45@@", "13C_WeaponUMP45")};
};

struct C_WeaponP90 : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponP90@@", "11C_WeaponP90")};
};

struct C_WeaponBizon : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponBizon@@", "13C_WeaponBizon")};
};

struct C_WeaponMag7 : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponMag7@@", "12C_WeaponMag7")};
};

struct C_WeaponSawedoff : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponSawedoff@@", "16C_WeaponSawedoff")};
};

struct C_WeaponXM1014 : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponXM1014@@", "14C_WeaponXM1014")};
};

struct C_WeaponNOVA : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponNOVA@@", "12C_WeaponNOVA")};
};

struct C_WeaponM249 : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponM249@@", "12C_WeaponM249")};
};

struct C_WeaponNegev : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponNegev@@", "13C_WeaponNegev")};
};

struct C_WeaponGalilAR : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponGalilAR@@", "15C_WeaponGalilAR")};
};

struct C_WeaponFamas : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponFamas@@", "13C_WeaponFamas")};
};

struct C_AK47 : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_AK47@@", "6C_AK47")};
};

struct C_WeaponM4A1 : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponM4A1@@", "12C_WeaponM4A1")};
};

struct C_WeaponSG556 : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponSG556@@", "13C_WeaponSG556")};
};

struct C_WeaponAug : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponAug@@", "11C_WeaponAug")};
};

struct C_WeaponSSG08 : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponSSG08@@", "13C_WeaponSSG08")};
};

struct C_WeaponAWP : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponAWP@@", "11C_WeaponAWP")};
};

struct C_WeaponG3SG1 : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponG3SG1@@", "13C_WeaponG3SG1")};
};

struct C_WeaponSCAR20 : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponSCAR20@@", "14C_WeaponSCAR20")};
};

struct C_WeaponTaser : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_WeaponTaser@@", "13C_WeaponTaser")};
};

struct C_Knife : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_Knife@@", "7C_Knife")};
};

struct C_Flashbang : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_Flashbang@@", "11C_Flashbang")};
};

struct C_HEGrenade : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_HEGrenade@@", "11C_HEGrenade")};
};

struct C_SmokeGrenade : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_SmokeGrenade@@", "14C_SmokeGrenade")};
};

struct C_MolotovGrenade : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_MolotovGrenade@@", "16C_MolotovGrenade")};
};

struct C_IncendiaryGrenade : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_IncendiaryGrenade@@", "19C_IncendiaryGrenade")};
};

struct C_DecoyGrenade : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_DecoyGrenade@@", "14C_DecoyGrenade")};
};

struct C_C4 : C_CSWeaponBase {
static constexpr auto kMangledTypeName{WIN64_LINUX(".?AVC_C4@@", "4C_C4")};
};

}
56 changes: 56 additions & 0 deletions Source/CS2/Constants/EntityTypeNames.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#pragma once

#include <CS2/Classes/Entities/WeaponEntities.h>
#include <Platform/Macros/PlatformSpecific.h>
#include <Utils/TypedStaticStringPool.h>

namespace cs2
{

constexpr auto kEntityTypeNames = TypedStaticStringPool{}
.add<C_CSPlayerPawn>(WIN64_LINUX(".?AVC_CSPlayerPawn@@", "14C_CSPlayerPawn"))
.add<C_WeaponGlock>(WIN64_LINUX(".?AVC_WeaponGlock@@", "13C_WeaponGlock"))
.add<C_WeaponHKP2000>(WIN64_LINUX(".?AVC_WeaponHKP2000@@", "15C_WeaponHKP2000"))
.add<C_WeaponElite>(WIN64_LINUX(".?AVC_WeaponElite@@", "13C_WeaponElite"))
.add<C_WeaponP250>(WIN64_LINUX(".?AVC_WeaponP250@@", "12C_WeaponP250"))
.add<C_WeaponTec9>(WIN64_LINUX(".?AVC_WeaponTec9@@", "12C_WeaponTec9"))
.add<C_WeaponFiveSeven>(WIN64_LINUX(".?AVC_WeaponFiveSeven@@", "17C_WeaponFiveSeven"))
.add<C_DEagle>(WIN64_LINUX(".?AVC_DEagle@@", "8C_DEagle"))
.add<C_WeaponMAC10>(WIN64_LINUX(".?AVC_WeaponMAC10@@", "13C_WeaponMAC10"))
.add<C_WeaponMP7>(WIN64_LINUX(".?AVC_WeaponMP7@@", "11C_WeaponMP7"))
.add<C_WeaponMP9>(WIN64_LINUX(".?AVC_WeaponMP9@@", "11C_WeaponMP9"))
.add<C_WeaponBizon>(WIN64_LINUX(".?AVC_WeaponBizon@@", "13C_WeaponBizon"))
.add<C_WeaponP90>(WIN64_LINUX(".?AVC_WeaponP90@@", "11C_WeaponP90"))
.add<C_WeaponUMP45>(WIN64_LINUX(".?AVC_WeaponUMP45@@", "13C_WeaponUMP45"))
.add<C_WeaponMag7>(WIN64_LINUX(".?AVC_WeaponMag7@@", "12C_WeaponMag7"))
.add<C_WeaponSawedoff>(WIN64_LINUX(".?AVC_WeaponSawedoff@@", "16C_WeaponSawedoff"))
.add<C_WeaponXM1014>(WIN64_LINUX(".?AVC_WeaponXM1014@@", "14C_WeaponXM1014"))
.add<C_WeaponNOVA>(WIN64_LINUX(".?AVC_WeaponNOVA@@", "12C_WeaponNOVA"))
.add<C_WeaponM249>(WIN64_LINUX(".?AVC_WeaponM249@@", "12C_WeaponM249"))
.add<C_WeaponNegev>(WIN64_LINUX(".?AVC_WeaponNegev@@", "13C_WeaponNegev"))
.add<C_WeaponGalilAR>(WIN64_LINUX(".?AVC_WeaponGalilAR@@", "15C_WeaponGalilAR"))
.add<C_WeaponFamas>(WIN64_LINUX(".?AVC_WeaponFamas@@", "13C_WeaponFamas"))
.add<C_AK47>(WIN64_LINUX(".?AVC_AK47@@", "6C_AK47"))
.add<C_WeaponM4A1>(WIN64_LINUX(".?AVC_WeaponM4A1@@", "12C_WeaponM4A1"))
.add<C_WeaponSG556>(WIN64_LINUX(".?AVC_WeaponSG556@@", "13C_WeaponSG556"))
.add<C_WeaponAug>(WIN64_LINUX(".?AVC_WeaponAug@@", "11C_WeaponAug"))
.add<C_WeaponSSG08>(WIN64_LINUX(".?AVC_WeaponSSG08@@", "13C_WeaponSSG08"))
.add<C_WeaponAWP>(WIN64_LINUX(".?AVC_WeaponAWP@@", "11C_WeaponAWP"))
.add<C_WeaponG3SG1>(WIN64_LINUX(".?AVC_WeaponG3SG1@@", "13C_WeaponG3SG1"))
.add<C_WeaponSCAR20>(WIN64_LINUX(".?AVC_WeaponSCAR20@@", "14C_WeaponSCAR20"))
.add<C_WeaponTaser>(WIN64_LINUX(".?AVC_WeaponTaser@@", "13C_WeaponTaser"))
.add<C_Knife>(WIN64_LINUX(".?AVC_Knife@@", "7C_Knife"))
.add<C_Flashbang>(WIN64_LINUX(".?AVC_Flashbang@@", "11C_Flashbang"))
.add<C_HEGrenade>(WIN64_LINUX(".?AVC_HEGrenade@@", "11C_HEGrenade"))
.add<C_SmokeGrenade>(WIN64_LINUX(".?AVC_SmokeGrenade@@", "14C_SmokeGrenade"))
.add<C_MolotovGrenade>(WIN64_LINUX(".?AVC_MolotovGrenade@@", "16C_MolotovGrenade"))
.add<C_IncendiaryGrenade>(WIN64_LINUX(".?AVC_IncendiaryGrenade@@", "19C_IncendiaryGrenade"))
.add<C_DecoyGrenade>(WIN64_LINUX(".?AVC_DecoyGrenade@@", "14C_DecoyGrenade"))
.add<CBaseAnimGraph>(WIN64_LINUX(".?AVCBaseAnimGraph@@", "14CBaseAnimGraph"))
.add<C_HEGrenadeProjectile>(WIN64_LINUX(".?AVC_HEGrenadeProjectile@@", "21C_HEGrenadeProjectile"))
.add<C_SmokeGrenadeProjectile>(WIN64_LINUX(".?AVC_SmokeGrenadeProjectile@@", "24C_SmokeGrenadeProjectile"))
.add<C_MolotovProjectile>(WIN64_LINUX(".?AVC_MolotovProjectile@@", "19C_MolotovProjectile"))
.add<C_FlashbangProjectile>(WIN64_LINUX(".?AVC_FlashbangProjectile@@", "21C_FlashbangProjectile"))
.add<C_C4>(WIN64_LINUX(".?AVC_C4@@", "4C_C4"));

}
26 changes: 26 additions & 0 deletions Source/CS2/Constants/StylePropertySymbolNames.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#pragma once

#include <CS2/Panorama/StyleProperties.h>
#include <Utils/TypedStaticStringPool.h>

namespace cs2
{

constexpr auto kStylePropertySymbolNames = TypedStaticStringPool{}
.add<CStylePropertyWidth>("width")
.add<CStylePropertyOpacity>("opacity")
.add<CStylePropertyZIndex>("z-index")
.add<CStylePropertyHeight>("height")
.add<CStylePropertyImageShadow>("img-shadow")
.add<CStylePropertyPosition>("position")
.add<CStylePropertyTransformOrigin>("transform-origin")
.add<CStylePropertyAlign>("align")
.add<CStylePropertyWashColor>("wash-color")
.add<CStylePropertyFlowChildren>("flow-children")
.add<CStylePropertyFont>("font")
.add<CStylePropertyTextShadow>("text-shadow")
.add<CStylePropertyMargin>("margin")
.add<CStylePropertyMixBlendMode>("-s2-mix-blend-mode")
.add<CStylePropertyTextAlign>("text-align");

}
27 changes: 27 additions & 0 deletions Source/CS2/Constants/StylePropertyTypeNames.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#pragma once

#include <CS2/Panorama/StyleProperties.h>
#include <Platform/Macros/PlatformSpecific.h>
#include <Utils/TypedStaticStringPool.h>

namespace cs2
{

constexpr auto kStylePropertyTypeNames = TypedStaticStringPool{}
.add<CStylePropertyWidth>(WIN64_LINUX(".?AVCStylePropertyWidth@panorama@@", "N8panorama19CStylePropertyWidthE"))
.add<CStylePropertyOpacity>(WIN64_LINUX(".?AVCStylePropertyOpacity@panorama@@", "N8panorama21CStylePropertyOpacityE"))
.add<CStylePropertyZIndex>(WIN64_LINUX(".?AVCStylePropertyZIndex@panorama@@", "N8panorama20CStylePropertyZIndexE"))
.add<CStylePropertyHeight>(WIN64_LINUX(".?AVCStylePropertyHeight@panorama@@", "N8panorama20CStylePropertyHeightE"))
.add<CStylePropertyImageShadow>(WIN64_LINUX(".?AVCStylePropertyImageShadow@panorama@@", "N8panorama25CStylePropertyImageShadowE"))
.add<CStylePropertyPosition>(WIN64_LINUX(".?AVCStylePropertyPosition@panorama@@", "N8panorama22CStylePropertyPositionE"))
.add<CStylePropertyTransformOrigin>(WIN64_LINUX(".?AVCStylePropertyTransformOrigin@panorama@@", "N8panorama29CStylePropertyTransformOriginE"))
.add<CStylePropertyAlign>(WIN64_LINUX(".?AVCStylePropertyAlign@panorama@@", "N8panorama19CStylePropertyAlignE"))
.add<CStylePropertyWashColor>(WIN64_LINUX(".?AVCStylePropertyWashColor@panorama@@", "N8panorama23CStylePropertyWashColorE"))
.add<CStylePropertyFlowChildren>(WIN64_LINUX(".?AVCStylePropertyFlowChildren@panorama@@", "N8panorama26CStylePropertyFlowChildrenE"))
.add<CStylePropertyFont>(WIN64_LINUX(".?AVCStylePropertyFont@panorama@@", "N8panorama18CStylePropertyFontE"))
.add<CStylePropertyTextShadow>(WIN64_LINUX(".?AVCStylePropertyTextShadow@panorama@@", "N8panorama24CStylePropertyTextShadowE"))
.add<CStylePropertyMargin>(WIN64_LINUX(".?AVCStylePropertyMargin@panorama@@", "N8panorama20CStylePropertyMarginE"))
.add<CStylePropertyMixBlendMode>(WIN64_LINUX(".?AVCStylePropertyMixBlendMode@panorama@@", "N8panorama26CStylePropertyMixBlendModeE"))
.add<CStylePropertyTextAlign>(WIN64_LINUX(".?AVCStylePropertyTextAlign@panorama@@", "N8panorama23CStylePropertyTextAlignE"));

}
Loading

0 comments on commit 8f6d02a

Please sign in to comment.