From eef494452ad0ea5f880e9b3a0c64fadd6ec834e3 Mon Sep 17 00:00:00 2001 From: Yimura Date: Thu, 25 Aug 2022 22:06:34 +0200 Subject: [PATCH] fix(CI): Compiled in folders and use relative include dirs (#27) --- .devcontainer/Dockerfile | 7 +++++ .devcontainer/devcontainer.json | 20 ++++++++++++++ .gitignore | 1 + CMakeLists.txt | 3 ++- base/CBaseModelInfo.hpp | 2 +- base/CNavigation.hpp | 2 +- base/CObject.hpp | 2 +- base/fwExtensibleBase.hpp | 6 +++-- datanodes/door/CDoorCreationDataNode.hpp | 2 +- datanodes/object/CObjectCreationDataNode.hpp | 4 +-- datanodes/ped/CPedAppearanceDataNode.hpp | 4 +-- datanodes/ped/CPedAttachDataNode.hpp | 4 +-- .../physical/CPhysicalAttachDataNode.hpp | 4 +-- .../CPickupPlacementCreationDataNode.hpp | 4 +-- .../player/CPlayerAppearanceDataNode.hpp | 4 +-- datanodes/player/CPlayerSectorPosNode.hpp | 4 +-- network/CNetGamePlayer.hpp | 6 ++--- network/CNetworkPlayerMgr.hpp | 4 +-- network/netObject.hpp | 4 +-- network/netPlayer.hpp | 2 +- ped/CPed.hpp | 12 ++++----- ped/CPedFactory.hpp | 2 +- ped/CPedWeaponManager.hpp | 2 +- player/CNonPhysicalPlayerData.hpp | 2 +- player/CPlayerInfo.hpp | 2 +- rage/fwEntity.hpp | 11 ++++---- rage/joaat.hpp | 27 +++++++++++++++++++ socialclub/FriendRegistry.hpp | 2 +- vehicle/CAutomobile.hpp | 8 +++--- vehicle/CHandlingData.hpp | 2 +- vehicle/CVehicleModelInfo.hpp | 4 +-- weapon/CAmmoInfo.hpp | 2 +- weapon/CWeaponInfo.hpp | 4 +-- 33 files changed, 113 insertions(+), 56 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 rage/joaat.hpp diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..775e95f --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,7 @@ +FROM ubuntu:devel + +RUN apt clean && apt update && apt install gcc g++ cmake make -y + +WORKDIR /app + +COPY . . diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..dd5a09e --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,20 @@ +{ + "name": "C++", + "build": { + "dockerfile": "Dockerfile", + "args": { } + }, + + "workspaceMount": "source=${localWorkspaceFolder},target=/app,type=bind,consistency=delegated", + "workspaceFolder": "/app", + + "runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined", "--network=host"], + "settings": {}, + "extensions": [ + "ms-vscode.cpptools", + "ms-vscode.cmake-tools", + "ms-vscode.cpptools-extension-pack", + "WakaTime.vscode-wakatime" + ], + //"remoteUser": "vscode", +} diff --git a/.gitignore b/.gitignore index 326acf8..ff61067 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .vscode +build/ *.suo *.db *.db-shm diff --git a/CMakeLists.txt b/CMakeLists.txt index ed2c50d..d0f94e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ set(CMAKE_REQUIRED_QUIET ON) set(OK TRUE) -file(GLOB HEADERS "*.hpp") +file(GLOB_RECURSE HEADERS "*.hpp") message(STATUS "") @@ -34,3 +34,4 @@ if(NOT OK) file(READ "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeError.log" LOG) message(STATUS ${LOG}) endif() + diff --git a/base/CBaseModelInfo.hpp b/base/CBaseModelInfo.hpp index 5b9bcda..56faad1 100644 --- a/base/CBaseModelInfo.hpp +++ b/base/CBaseModelInfo.hpp @@ -1,6 +1,6 @@ #pragma once -#include "rage/vector.hpp" +#include "../rage/vector.hpp" #include diff --git a/base/CNavigation.hpp b/base/CNavigation.hpp index 99031d7..219fc63 100644 --- a/base/CNavigation.hpp +++ b/base/CNavigation.hpp @@ -1,6 +1,6 @@ #pragma once -#include "rage/vector.hpp" +#include "../rage/vector.hpp" class CNavigation { diff --git a/base/CObject.hpp b/base/CObject.hpp index 83c7800..10078cc 100644 --- a/base/CObject.hpp +++ b/base/CObject.hpp @@ -1,5 +1,5 @@ #pragma once -#include "rage/fwEntity.hpp" +#include "../rage/fwEntity.hpp" class CObject : public rage::fwEntity {}; //Size: 0x018C diff --git a/base/fwExtensibleBase.hpp b/base/fwExtensibleBase.hpp index f7a7f3b..41024d4 100644 --- a/base/fwExtensibleBase.hpp +++ b/base/fwExtensibleBase.hpp @@ -1,11 +1,13 @@ #pragma once +#include #include "fwRefAwareBase.hpp" #include "fwExtensionContainer.hpp" +#include "../rage/joaat.hpp" + namespace rage { - class fwExtensibleBase : public fwRefAwareBase { public: @@ -26,4 +28,4 @@ namespace rage }; //Size: 0x0020 static_assert(sizeof(fwExtensibleBase) == 0x20); -} \ No newline at end of file +} diff --git a/datanodes/door/CDoorCreationDataNode.hpp b/datanodes/door/CDoorCreationDataNode.hpp index 839443d..585a09b 100644 --- a/datanodes/door/CDoorCreationDataNode.hpp +++ b/datanodes/door/CDoorCreationDataNode.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "rage/vector.hpp" +#include "../../rage/vector.hpp" #pragma pack(push, 4) class CDoorCreationDataNode diff --git a/datanodes/object/CObjectCreationDataNode.hpp b/datanodes/object/CObjectCreationDataNode.hpp index 083bb01..5ad768d 100644 --- a/datanodes/object/CObjectCreationDataNode.hpp +++ b/datanodes/object/CObjectCreationDataNode.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "rage/vector.hpp" +#include "../../rage/vector.hpp" #pragma pack(push,8) class CObjectCreationDataNode @@ -38,4 +38,4 @@ public: bool unk_016B; //0x016B }; //Size: 0x016C static_assert(sizeof(CObjectCreationDataNode) == 0x16C); -#pragma pack(pop) \ No newline at end of file +#pragma pack(pop) diff --git a/datanodes/ped/CPedAppearanceDataNode.hpp b/datanodes/ped/CPedAppearanceDataNode.hpp index 6a14cc5..94754ad 100644 --- a/datanodes/ped/CPedAppearanceDataNode.hpp +++ b/datanodes/ped/CPedAppearanceDataNode.hpp @@ -1,6 +1,6 @@ #pragma once -#include "CPedComponents.hpp" +#include "../CPedComponents.hpp" #pragma pack(push, 4) class CPedAppearanceDataNode @@ -31,4 +31,4 @@ public: uint8_t unk_0x1E1; //0x1E1 }; static_assert(sizeof(CPedAppearanceDataNode) == 0x1E4); -#pragma pack(pop) \ No newline at end of file +#pragma pack(pop) diff --git a/datanodes/ped/CPedAttachDataNode.hpp b/datanodes/ped/CPedAttachDataNode.hpp index 9812b77..694b632 100644 --- a/datanodes/ped/CPedAttachDataNode.hpp +++ b/datanodes/ped/CPedAttachDataNode.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "vector.hpp" +#include "../../rage/vector.hpp" #pragma pack(push,4) class CPedAttachDataNode @@ -20,4 +20,4 @@ public: bool unk_00F1; //0x00F1 }; static_assert(sizeof(CPedAttachDataNode) == 0xF4); -#pragma pack(pop) \ No newline at end of file +#pragma pack(pop) diff --git a/datanodes/physical/CPhysicalAttachDataNode.hpp b/datanodes/physical/CPhysicalAttachDataNode.hpp index 7881d5e..c931a01 100644 --- a/datanodes/physical/CPhysicalAttachDataNode.hpp +++ b/datanodes/physical/CPhysicalAttachDataNode.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "vector.hpp" +#include "../../rage/vector.hpp" #pragma pack(push,4) class CPhysicalAttachDataNode @@ -29,4 +29,4 @@ public: bool m_is_cargo_vehicle; //0x0116 }; //Size: 0x0118 static_assert(sizeof(CPhysicalAttachDataNode) == 0x118); -#pragma pack(pop) \ No newline at end of file +#pragma pack(pop) diff --git a/datanodes/pickup_placement/CPickupPlacementCreationDataNode.hpp b/datanodes/pickup_placement/CPickupPlacementCreationDataNode.hpp index 06227ed..4b44534 100644 --- a/datanodes/pickup_placement/CPickupPlacementCreationDataNode.hpp +++ b/datanodes/pickup_placement/CPickupPlacementCreationDataNode.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "rage/vector.hpp" +#include "../../rage/vector.hpp" #pragma pack(push, 8) class CPickupPlacementCreationDataNode @@ -22,4 +22,4 @@ public: uint64_t *unk_struct_0108; //0x0108 }; //Size: 0x0110 static_assert(sizeof(CPickupPlacementCreationDataNode) == 0x110); -#pragma pack(pop) \ No newline at end of file +#pragma pack(pop) diff --git a/datanodes/player/CPlayerAppearanceDataNode.hpp b/datanodes/player/CPlayerAppearanceDataNode.hpp index b888665..d88a5e4 100644 --- a/datanodes/player/CPlayerAppearanceDataNode.hpp +++ b/datanodes/player/CPlayerAppearanceDataNode.hpp @@ -1,6 +1,6 @@ #pragma once -#include "CPedComponents.hpp" +#include "../CPedComponents.hpp" #pragma pack(push, 4) class CPlayerAppearanceDataNode @@ -91,4 +91,4 @@ public: uint32_t unk_0x456; //0x456 }; static_assert(sizeof(CPlayerAppearanceDataNode) == 0x45C); -#pragma pack(pop) \ No newline at end of file +#pragma pack(pop) diff --git a/datanodes/player/CPlayerSectorPosNode.hpp b/datanodes/player/CPlayerSectorPosNode.hpp index cf03b3c..bfcaf61 100644 --- a/datanodes/player/CPlayerSectorPosNode.hpp +++ b/datanodes/player/CPlayerSectorPosNode.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "vector.hpp" +#include "../../rage/vector.hpp" #pragma pack(push,4) class CPlayerSectorPosNode @@ -20,4 +20,4 @@ public: uint32_t m_stealth_noise; //0x00F4 }; //Size: 0x00F8 static_assert(sizeof(CPlayerSectorPosNode) == 0xF8); -#pragma pack(pop) \ No newline at end of file +#pragma pack(pop) diff --git a/network/CNetGamePlayer.hpp b/network/CNetGamePlayer.hpp index 097bcf0..f422a50 100644 --- a/network/CNetGamePlayer.hpp +++ b/network/CNetGamePlayer.hpp @@ -1,9 +1,9 @@ #pragma once -#include "player/CPlayerInfo.hpp" -#include "player/CNonPhysicalPlayerData.hpp" +#include "../player/CPlayerInfo.hpp" +#include "../player/CNonPhysicalPlayerData.hpp" -#include "network/netPlayer.hpp" +#include "netPlayer.hpp" #include diff --git a/network/CNetworkPlayerMgr.hpp b/network/CNetworkPlayerMgr.hpp index 3fe3536..6b420be 100644 --- a/network/CNetworkPlayerMgr.hpp +++ b/network/CNetworkPlayerMgr.hpp @@ -1,7 +1,7 @@ #pragma once -#include "network/CNetGamePlayer.hpp" -#include "player/CNonPhysicalPlayerData.hpp" +#include "CNetGamePlayer.hpp" +#include "../player/CNonPhysicalPlayerData.hpp" #include diff --git a/network/netObject.hpp b/network/netObject.hpp index c8df338..66bfdf6 100644 --- a/network/netObject.hpp +++ b/network/netObject.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "rage/netSyncTree.hpp" +#include "../rage/netSyncTree.hpp" class CObject; namespace rage @@ -127,4 +127,4 @@ namespace rage virtual void UpdatePendingVisibilityChanges() = 0; }; //Size: 0x0050 static_assert(sizeof(netObject) == 0x50); -} \ No newline at end of file +} diff --git a/network/netPlayer.hpp b/network/netPlayer.hpp index 9b615ba..f62c6f5 100644 --- a/network/netPlayer.hpp +++ b/network/netPlayer.hpp @@ -1,6 +1,6 @@ #pragma once -#include "network/netPlayerData.hpp" +#include "netPlayerData.hpp" namespace rage { diff --git a/ped/CPed.hpp b/ped/CPed.hpp index 5593258..498ba88 100644 --- a/ped/CPed.hpp +++ b/ped/CPed.hpp @@ -1,12 +1,12 @@ #pragma once -#include "vehicle/CAutomobile.hpp" -#include "ped/CPedModelInfo.hpp" -#include "ped/CPedWeaponManager.hpp" -#include "player/CPlayerInfo.hpp" +#include "../vehicle/CAutomobile.hpp" +#include "../player/CPlayerInfo.hpp" +#include "CPedModelInfo.hpp" +#include "CPedWeaponManager.hpp" -#include "rage/fwEntity.hpp" -#include "rage/vector.hpp" +#include "../rage/fwEntity.hpp" +#include "../rage/vector.hpp" #include diff --git a/ped/CPedFactory.hpp b/ped/CPedFactory.hpp index 9a4281d..a6bede5 100644 --- a/ped/CPedFactory.hpp +++ b/ped/CPedFactory.hpp @@ -1,6 +1,6 @@ #pragma once -#include "ped/CPed.hpp" +#include "CPed.hpp" class CPedFactory { diff --git a/ped/CPedWeaponManager.hpp b/ped/CPedWeaponManager.hpp index 893b6ca..b1d29a0 100644 --- a/ped/CPedWeaponManager.hpp +++ b/ped/CPedWeaponManager.hpp @@ -1,6 +1,6 @@ #pragma once -#include "weapon/CWeaponInfo.hpp" +#include "../weapon/CWeaponInfo.hpp" #include diff --git a/player/CNonPhysicalPlayerData.hpp b/player/CNonPhysicalPlayerData.hpp index d27817a..617f36d 100644 --- a/player/CNonPhysicalPlayerData.hpp +++ b/player/CNonPhysicalPlayerData.hpp @@ -1,6 +1,6 @@ #pragma once -#include "rage/vector.hpp" +#include "../rage/vector.hpp" #include diff --git a/player/CPlayerInfo.hpp b/player/CPlayerInfo.hpp index 2ab34b1..53b3cf6 100644 --- a/player/CPlayerInfo.hpp +++ b/player/CPlayerInfo.hpp @@ -1,6 +1,6 @@ #pragma once -#include "network/netPlayerData.hpp" +#include "../network/netPlayerData.hpp" #include diff --git a/rage/fwEntity.hpp b/rage/fwEntity.hpp index 2e5cfbd..a62629a 100644 --- a/rage/fwEntity.hpp +++ b/rage/fwEntity.hpp @@ -1,11 +1,10 @@ #pragma once -#include "base/CBaseModelInfo.hpp" -#include "base/CNavigation.hpp" -#include "base/fwExtensibleBase.hpp" - -#include "rage/fwDrawData.hpp" -#include "network/netObject.hpp" +#include "../base/CBaseModelInfo.hpp" +#include "../base/CNavigation.hpp" +#include "../base/fwExtensibleBase.hpp" +#include "../network/netObject.hpp" +#include "fwDrawData.hpp" #include diff --git a/rage/joaat.hpp b/rage/joaat.hpp new file mode 100644 index 0000000..3f7c340 --- /dev/null +++ b/rage/joaat.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include +#include + +namespace rage +{ + using joaat_t = std::uint32_t; + inline constexpr char joaat_to_lower(char c) + { + return (c >= 'A' && c <= 'Z') ? c + ('a' - 'A') : c; + } + + inline joaat_t joaat(std::string_view str) + { + joaat_t hash = 0; + for (auto c : str) { + hash += joaat_to_lower(c); + hash += (hash << 10); + hash ^= (hash >> 6); + } + hash += (hash << 3); + hash ^= (hash >> 11); + hash += (hash << 15); + return hash; + } +}; diff --git a/socialclub/FriendRegistry.hpp b/socialclub/FriendRegistry.hpp index d68ca93..7b18413 100644 --- a/socialclub/FriendRegistry.hpp +++ b/socialclub/FriendRegistry.hpp @@ -1,6 +1,6 @@ #pragma once -#include "socialclub/FriendInfo.hpp" +#include "FriendInfo.hpp" #include diff --git a/vehicle/CAutomobile.hpp b/vehicle/CAutomobile.hpp index 4060034..53db9dc 100644 --- a/vehicle/CAutomobile.hpp +++ b/vehicle/CAutomobile.hpp @@ -1,10 +1,10 @@ #pragma once -#include "vehicle/CHandlingData.hpp" -#include "vehicle/CVehicleDrawHandler.hpp" -#include "vehicle/CVehicleModelInfo.hpp" +#include "CHandlingData.hpp" +#include "CVehicleDrawHandler.hpp" +#include "CVehicleModelInfo.hpp" -#include "rage/fwEntity.hpp" +#include "../rage/fwEntity.hpp" #include diff --git a/vehicle/CHandlingData.hpp b/vehicle/CHandlingData.hpp index 50bb7da..b38879e 100644 --- a/vehicle/CHandlingData.hpp +++ b/vehicle/CHandlingData.hpp @@ -1,6 +1,6 @@ #pragma once -#include "rage/vector.hpp" +#include "../rage/vector.hpp" #include diff --git a/vehicle/CVehicleModelInfo.hpp b/vehicle/CVehicleModelInfo.hpp index 63c7ca6..03956fe 100644 --- a/vehicle/CVehicleModelInfo.hpp +++ b/vehicle/CVehicleModelInfo.hpp @@ -1,6 +1,6 @@ #pragma once -#include "base/CBaseModelInfo.hpp" +#include "../base/CBaseModelInfo.hpp" #include @@ -27,7 +27,7 @@ enum class eVehicleType : std::uint32_t class CVehicleModelInfo : public CBaseModelInfo { public: - char pad_00B0[76]; //0x00B0 + char pad_00B0[72]; //0x00B0 uint8_t m_primary_color_combinations[25]; //0x00F8 uint8_t m_secondary_color_combinations[25]; //0x0111 uint8_t m_unk_color_combos1[25]; //0x012A diff --git a/weapon/CAmmoInfo.hpp b/weapon/CAmmoInfo.hpp index 2fa7e71..cf24be2 100644 --- a/weapon/CAmmoInfo.hpp +++ b/weapon/CAmmoInfo.hpp @@ -1,6 +1,6 @@ #pragma once -#include "weapon/CItemInfo.hpp" +#include "CItemInfo.hpp" #include diff --git a/weapon/CWeaponInfo.hpp b/weapon/CWeaponInfo.hpp index 6b0a099..e7c76c6 100644 --- a/weapon/CWeaponInfo.hpp +++ b/weapon/CWeaponInfo.hpp @@ -1,7 +1,7 @@ #pragma once -#include "weapon/CAmmoInfo.hpp" -#include "weapon/CItemInfo.hpp" +#include "CAmmoInfo.hpp" +#include "CItemInfo.hpp" #include