Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions .github/workflows/Build_Plugin_GTA_SA_clang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Plugin GTA SA (Clang)

on:
workflow_dispatch:

push:
paths:
- "!**.dll"
- "!**.md"
- "!**.txt"
- "tools/premake/**"
- "hooking/**"
- "injector/**"
- "modutils/**"
- "safetyhook/**"
- "shared/**"
- "plugin_sa/**"

pull_request:
paths:
- "!**.dll"
- "!**.md"
- "!**.txt"
- "tools/premake/**"
- "hooking/**"
- "injector/**"
- "modutils/**"
- "safetyhook/**"
- "shared/**"
- "plugin_sa/**"

jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "recursive"

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y wget gnupg software-properties-common lsb-release g++-mingw-w64-i686
# Download LLVM installer script
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
# Install Clang 23
sudo ./llvm.sh 23
- name: Verify Clang
run: |
clang-23 --version
clang++-23 --version
- name: Build SDK
run: |
echo "::group::Setup directories"
mkdir -p output/lib
for dir in shared plugin_sa safetyhook; do
find "$dir" -type d -exec mkdir -p "obj/{}" \;
done
echo "::groupEnd::"
FLAGS="-I. -Ishared -Ishared/game -Iplugin_sa -Iplugin_sa/game_sa -Iplugin_sa/game_sa/rw -Isafetyhook -DGTASA -DPLUGIN_SGV_10US -DRW"
CLANG_FLAGS="--target=i686-w64-mingw32 -fpermissive -fcommon -fms-extensions -Wno-microsoft-include -Wno-invalid-offsetof -Wno-builtin-macro-redefined -O2 -D__cpp_concepts=202202L"
echo "::group::Compile C++ files"
find shared plugin_sa safetyhook -name '*.cpp' -print0 | \
xargs -0 -P$(nproc) -I{} clang++-23 $CLANG_FLAGS -std=c++2b $FLAGS -c {} -o obj/{}.o
echo "::groupEnd::"
echo "::group::Compile C files"
find safetyhook -name '*.c' -print0 | \
xargs -0 -P$(nproc) -I{} clang-23 $CLANG_FLAGS $FLAGS -c {} -o obj/{}.o
echo "::groupEnd::"
echo "::group::Archive SDK"
find obj -name '*.o' | xargs i686-w64-mingw32-ar rcs output/lib/libplugin.a
echo "::groupEnd::"
- name: Build test plugin
run: |
echo "::group::Build test plugin"
# Setup object directories for the test plugin
find examples/Test -type d -exec mkdir -p "obj/{}" \;
mkdir -p output/examples
TEST_FLAGS="-I. -Ishared -Ishared/game -Iplugin_sa -Iplugin_sa/game_sa -Iplugin_sa/game_sa/rw -Isafetyhook -DGTASA -DPLUGIN_SGV_10US -DRW"
TEST_CLANG_FLAGS="--target=i686-w64-mingw32 -fpermissive -fcommon -fms-extensions -Wno-microsoft-include -Wno-invalid-offsetof -Wno-builtin-macro-redefined -O2 -D__cpp_concepts=202202L"
# Compile
find examples/Test -name '*.cpp' -print0 | \
xargs -0 -P$(nproc) -I{} clang++-23 $TEST_CLANG_FLAGS -std=c++2b $TEST_FLAGS -c {} -o obj/{}.o
# Link into ASI
clang++-23 --target=i686-w64-mingw32 -shared -o output/examples/Test.asi $(find obj/examples/Test -name '*.o') -Loutput/lib -lplugin -static-libgcc -static-libstdc++ -Wl,--enable-stdcall-fixup
echo "::groupEnd::"
2 changes: 1 addition & 1 deletion examples/Test/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct Main
Main()
{
// register event callbacks
Events::gameProcessEvent += []{ gInstance.OnGameProcess(); };
Events::gameProcessEvent += [this]{ OnGameProcess(); };
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was that needed?

}

void OnGameProcess()
Expand Down
2 changes: 1 addition & 1 deletion injector/injector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ namespace injector
template <class T>
static T *get()
{
return get().get<T>();
return get().template get<T>();
}

private:
Expand Down
1 change: 1 addition & 0 deletions plugin_sa/game_sa/CAEPedSpeechAudioEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum eAudioPedType {
PED_TYPE_SPC = 5
};

class CPed;

class CAEPedSpeechAudioEntity : public CAEAudioEntity {
public:
Expand Down
2 changes: 1 addition & 1 deletion plugin_sa/game_sa/CBike.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#pragma once
#include "PluginBase.h"
#include "CVehicle.h"
#include "eSkidmarkType.h"
#include "tBikeHandlingData.h"


enum eBikeNodes {
BIKE_NODE_NONE = 0,
BIKE_CHASSIS = 1,
Expand Down
2 changes: 2 additions & 0 deletions plugin_sa/game_sa/CPostEffects.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "RenderWare.h"
#include "CRGBA.h"

class CPed;

class CPostEffects {
public:
static void Initialise();
Expand Down
13 changes: 12 additions & 1 deletion plugin_sa/game_sa/CTaskSimpleHoldEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,19 @@
#pragma once

#include "PluginBase.h"
#include "CTaskSimple.h"
#include "CAEAudioEntity.h"
#include "CAnimBlock.h"
#include "CTaskSimple.h"
#include "CVector.h"
#include "eAnimations.h"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not alphabetical order.


class CEntity;
class CAnimBlendAssociation;
class CAnimBlendHierarchy;

#ifndef _MSC_VER
class CVector;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary? CVector should be seen as struct everywhere now.

#endif

class PLUGIN_API CTaskSimpleHoldEntity : public CTaskSimple {
protected:
Expand Down
Binary file added tools/premake/linux-clang-example/premake5
Binary file not shown.
1 change: 1 addition & 0 deletions tools/premake/linux-clang-example/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ project "plugin_sa"
"-fpermissive",
"-fcommon",
"-fms-extensions",
"-Wno-invalid-offsetof",
"-Wno-microsoft-include" ,
"-static",
}
Expand Down
Loading