From 5b4467d548775de898244bedac388202dec21edd Mon Sep 17 00:00:00 2001 From: Davide Beatrici Date: Wed, 1 Jun 2022 08:47:39 +0200 Subject: [PATCH 1/4] feat: Add CMake project to make sure that headers can be compiled, individually --- CMakeLists.txt | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..ed2c50d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.11) + +project(GTAV-Classes) + +include(CheckIncludeFileCXX) + +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CMAKE_REQUIRED_QUIET ON) + +set(OK TRUE) + +file(GLOB HEADERS "*.hpp") + +message(STATUS "") + +foreach(HEADER ${HEADERS}) + get_filename_component(FILENAME ${HEADER} NAME) + check_include_file_cxx("${HEADER}" ${FILENAME}_OK) + + if(${FILENAME}_OK) + message(STATUS "${FILENAME} OK!") + else() + set(OK FALSE) + message(SEND_ERROR "${FILENAME} failed to compile!") + endif() +endforeach() + +message(STATUS "") + +if(NOT OK) + file(READ "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeError.log" LOG) + message(STATUS ${LOG}) +endif() From dac4d228824ca75c505c6f5a305e47adef706b02 Mon Sep 17 00:00:00 2001 From: Davide Beatrici Date: Wed, 1 Jun 2022 08:35:52 +0200 Subject: [PATCH 2/4] feat: Add GitHub Actions workflow, for automated compile check --- .github/workflows/build.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..edc35e6 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,17 @@ +name: Build + +on: [push, pull_request] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + + steps: + - uses: actions/checkout@v3 + + - name: Configure + run: cmake -B ${{github.workspace}}/build From a49ab7749dbc34836775f4be6d22a6182d7bfbc7 Mon Sep 17 00:00:00 2001 From: Davide Beatrici Date: Wed, 1 Jun 2022 07:49:36 +0200 Subject: [PATCH 3/4] fix: Add missing include, divide includes by category --- CAmmoInfo.hpp | 3 +++ CAutomobile.hpp | 4 ++++ CBaseModelInfo.hpp | 2 ++ CHandlingData.hpp | 3 +++ CItemInfo.hpp | 2 ++ CNavigation.hpp | 1 + CNetGamePlayer.hpp | 4 ++++ CNetworkPlayerMgr.hpp | 3 +++ CNonPhysicalPlayerData.hpp | 3 +++ CPed.hpp | 4 ++++ CPedFactory.hpp | 1 + CPedModelInfo.hpp | 2 ++ CPedWeaponManager.hpp | 3 +++ CPlayerInfo.hpp | 3 +++ CVehicleDrawHandler.hpp | 2 ++ CVehicleModelInfo.hpp | 2 ++ CWeaponInfo.hpp | 3 +++ FriendInfo.hpp | 2 ++ FriendRegistry.hpp | 3 +++ ScInfo.hpp | 2 ++ fwDrawData.hpp | 2 ++ fwEntity.hpp | 4 ++++ netObject.hpp | 2 ++ netPlayer.hpp | 1 + netPlayerData.hpp | 2 ++ 25 files changed, 63 insertions(+) diff --git a/CAmmoInfo.hpp b/CAmmoInfo.hpp index 61adb3e..cf24be2 100644 --- a/CAmmoInfo.hpp +++ b/CAmmoInfo.hpp @@ -1,6 +1,9 @@ #pragma once + #include "CItemInfo.hpp" +#include + enum class eAmmoSpecialType : int32_t { None, diff --git a/CAutomobile.hpp b/CAutomobile.hpp index e7a887f..324a102 100644 --- a/CAutomobile.hpp +++ b/CAutomobile.hpp @@ -1,9 +1,13 @@ #pragma once + #include "CHandlingData.hpp" #include "CVehicleDrawHandler.hpp" #include "CVehicleModelInfo.hpp" + #include "fwEntity.hpp" +#include + #pragma pack(push, 4) class CAutomobile : public rage::fwEntity { diff --git a/CBaseModelInfo.hpp b/CBaseModelInfo.hpp index 779faac..779a095 100644 --- a/CBaseModelInfo.hpp +++ b/CBaseModelInfo.hpp @@ -1,5 +1,7 @@ #pragma once +#include + enum class eModelType : std::uint8_t { UNK_0, diff --git a/CHandlingData.hpp b/CHandlingData.hpp index 0e93756..6712211 100644 --- a/CHandlingData.hpp +++ b/CHandlingData.hpp @@ -1,6 +1,9 @@ #pragma once + #include "vector.hpp" +#include + class CHandlingData { public: diff --git a/CItemInfo.hpp b/CItemInfo.hpp index a7f0a1b..cadf912 100644 --- a/CItemInfo.hpp +++ b/CItemInfo.hpp @@ -1,5 +1,7 @@ #pragma once +#include + class CItemInfo { public: diff --git a/CNavigation.hpp b/CNavigation.hpp index be6f785..db03b85 100644 --- a/CNavigation.hpp +++ b/CNavigation.hpp @@ -1,4 +1,5 @@ #pragma once + #include "vector.hpp" class CNavigation diff --git a/CNetGamePlayer.hpp b/CNetGamePlayer.hpp index 4ea919a..13a04ac 100644 --- a/CNetGamePlayer.hpp +++ b/CNetGamePlayer.hpp @@ -1,8 +1,12 @@ #pragma once + #include "CPlayerInfo.hpp" #include "CNonPhysicalPlayerData.hpp" + #include "netPlayer.hpp" +#include + #pragma pack(push, 1) class CNetGamePlayer : public rage::netPlayer diff --git a/CNetworkPlayerMgr.hpp b/CNetworkPlayerMgr.hpp index 028e5be..06ca7a4 100644 --- a/CNetworkPlayerMgr.hpp +++ b/CNetworkPlayerMgr.hpp @@ -1,7 +1,10 @@ #pragma once + #include "CNetGamePlayer.hpp" #include "CNonPhysicalPlayerData.hpp" +#include + namespace rage { class netPlayerMgrBase diff --git a/CNonPhysicalPlayerData.hpp b/CNonPhysicalPlayerData.hpp index 905295b..a3b14c7 100644 --- a/CNonPhysicalPlayerData.hpp +++ b/CNonPhysicalPlayerData.hpp @@ -1,6 +1,9 @@ #pragma once + #include "vector.hpp" +#include + namespace rage { class nonPhysicalPlayerDataBase diff --git a/CPed.hpp b/CPed.hpp index b29a434..ea5edaa 100644 --- a/CPed.hpp +++ b/CPed.hpp @@ -1,11 +1,15 @@ #pragma once + #include "CAutomobile.hpp" #include "CPedModelInfo.hpp" #include "CPedWeaponManager.hpp" #include "CPlayerInfo.hpp" + #include "fwEntity.hpp" #include "vector.hpp" +#include + #pragma pack(push, 1) class CPed : public rage::fwEntity diff --git a/CPedFactory.hpp b/CPedFactory.hpp index 678bfeb..a6bede5 100644 --- a/CPedFactory.hpp +++ b/CPedFactory.hpp @@ -1,4 +1,5 @@ #pragma once + #include "CPed.hpp" class CPedFactory diff --git a/CPedModelInfo.hpp b/CPedModelInfo.hpp index ecac9a4..c326a81 100644 --- a/CPedModelInfo.hpp +++ b/CPedModelInfo.hpp @@ -1,5 +1,7 @@ #pragma once +#include + class CPedModelInfo { public: diff --git a/CPedWeaponManager.hpp b/CPedWeaponManager.hpp index d7cad5a..c5602d5 100644 --- a/CPedWeaponManager.hpp +++ b/CPedWeaponManager.hpp @@ -1,6 +1,9 @@ #pragma once + #include "CWeaponInfo.hpp" +#include + class CPedWeaponManager { public: diff --git a/CPlayerInfo.hpp b/CPlayerInfo.hpp index 0e3cd22..2217d9f 100644 --- a/CPlayerInfo.hpp +++ b/CPlayerInfo.hpp @@ -1,6 +1,9 @@ #pragma once + #include "netPlayerData.hpp" +#include + enum class eGameState : int32_t { Invalid = -1, diff --git a/CVehicleDrawHandler.hpp b/CVehicleDrawHandler.hpp index b52de46..c5caf3b 100644 --- a/CVehicleDrawHandler.hpp +++ b/CVehicleDrawHandler.hpp @@ -1,5 +1,7 @@ #pragma once +#include + class CVehicleDrawHandler { public: diff --git a/CVehicleModelInfo.hpp b/CVehicleModelInfo.hpp index 24514cb..b34381e 100644 --- a/CVehicleModelInfo.hpp +++ b/CVehicleModelInfo.hpp @@ -1,5 +1,7 @@ #pragma once +#include + class CVehicleModelInfo { public: diff --git a/CWeaponInfo.hpp b/CWeaponInfo.hpp index 3a5512e..eeb9ae8 100644 --- a/CWeaponInfo.hpp +++ b/CWeaponInfo.hpp @@ -1,7 +1,10 @@ #pragma once + #include "CAmmoInfo.hpp" #include "CItemInfo.hpp" +#include + enum class eDamageType : int32_t { Unknown, diff --git a/FriendInfo.hpp b/FriendInfo.hpp index 7e3c146..9b8481f 100644 --- a/FriendInfo.hpp +++ b/FriendInfo.hpp @@ -1,5 +1,7 @@ #pragma once +#include + #pragma pack(push, 1) class FriendInfo { diff --git a/FriendRegistry.hpp b/FriendRegistry.hpp index 10eee76..34e2e1a 100644 --- a/FriendRegistry.hpp +++ b/FriendRegistry.hpp @@ -1,6 +1,9 @@ #pragma once + #include "FriendInfo.hpp" +#include + class FriendList { public: diff --git a/ScInfo.hpp b/ScInfo.hpp index 9549847..be0e7a6 100644 --- a/ScInfo.hpp +++ b/ScInfo.hpp @@ -1,5 +1,7 @@ #pragma once +#include + #pragma pack(push, 1) class ScInfo { diff --git a/fwDrawData.hpp b/fwDrawData.hpp index 0ff2471..8c587e3 100644 --- a/fwDrawData.hpp +++ b/fwDrawData.hpp @@ -1,5 +1,7 @@ #pragma once +#include + namespace rage { class fwDrawData diff --git a/fwEntity.hpp b/fwEntity.hpp index a308f40..bf29f72 100644 --- a/fwEntity.hpp +++ b/fwEntity.hpp @@ -1,9 +1,13 @@ #pragma once + #include "CBaseModelInfo.hpp" #include "CNavigation.hpp" + #include "fwDrawData.hpp" #include "netObject.hpp" +#include + namespace rage { #pragma pack(push, 4) diff --git a/netObject.hpp b/netObject.hpp index 51f0ba2..21fac06 100644 --- a/netObject.hpp +++ b/netObject.hpp @@ -1,5 +1,7 @@ #pragma once +#include + namespace rage { class netObject diff --git a/netPlayer.hpp b/netPlayer.hpp index 0314c49..f62c6f5 100644 --- a/netPlayer.hpp +++ b/netPlayer.hpp @@ -1,4 +1,5 @@ #pragma once + #include "netPlayerData.hpp" namespace rage diff --git a/netPlayerData.hpp b/netPlayerData.hpp index a791fbb..40160a3 100644 --- a/netPlayerData.hpp +++ b/netPlayerData.hpp @@ -1,5 +1,7 @@ #pragma once +#include + namespace rage { class netAddress From b2c13927589f955982d2c5ae6545d1ed7371f990 Mon Sep 17 00:00:00 2001 From: Davide Beatrici Date: Wed, 1 Jun 2022 07:59:39 +0200 Subject: [PATCH 4/4] fix(fwEntity): Remove "class" specifier for rage::fvector3 fwEntity.hpp:29:21: error: typedef 'fvector3' cannot be referenced with a class specifier class rage::fvector3 m_right //0x0060 ^ vector.hpp:12:28: note: declared here typedef vector3 fvector3 ^ --- fwEntity.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fwEntity.hpp b/fwEntity.hpp index bf29f72..3c98701 100644 --- a/fwEntity.hpp +++ b/fwEntity.hpp @@ -25,13 +25,13 @@ namespace rage char pad_0038[16]; //0x0038 class rage::fwDrawData *m_draw_data; //0x0048 char pad_0050[16]; //0x0050 - class rage::fvector3 m_right; //0x0060 + rage::fvector3 m_right; //0x0060 char pad_006C[4]; //0x006C - class rage::fvector3 m_forward; //0x0070 + rage::fvector3 m_forward; //0x0070 char pad_007C[4]; //0x007C - class rage::fvector3 m_up; //0x0080 + rage::fvector3 m_up; //0x0080 char pad_008C[4]; //0x008C - class rage::fvector3 m_position; //0x0090 + rage::fvector3 m_position; //0x0090 char pad_009C[52]; //0x009C class rage::netObject *m_net_object; //0x00D0 char pad_00D8[176]; //0x00D8