Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into autohook/buildainfile.cpp
  • Loading branch information
ASpoonPlaysGames committed Sep 28, 2024
2 parents 82f89c2 + 6737a34 commit b341fdd
Show file tree
Hide file tree
Showing 97 changed files with 2,332 additions and 1,654 deletions.
6 changes: 3 additions & 3 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ AccessModifierOffset: -4
AlignTrailingComments: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortFunctionsOnASingleLine: Empty
AllowShortFunctionsOnASingleLine: Inline
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: No
Expand Down Expand Up @@ -35,5 +35,5 @@ IndentExternBlock: Indent
PointerAlignment: Left
SortIncludes: false
NamespaceIndentation: All
PackConstructorInitializers: NextLine
BreakConstructorInitializersBeforeComma: true
PackConstructorInitializers: Never
BreakConstructorInitializers: BeforeComma
6 changes: 6 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@

# Folder rename
f9bc3c9d1834cb8bd5f872b749b057c33e8b0102

# Clang format change: one-line inline functions
5b2c608b22ba272e4ab1a45adc1f43b60b1aea79

# Clang format change: see PR #775
6e9792f3651d1e0c7045c5d67312c10f91ce6962
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Configures dependabot

version: 2
updates:
# GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
9 changes: 9 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Add 'needs code review' label to any changes within the entire repository
needs code review:
- changed-files:
- any-glob-to-any-file: '**'

# Add 'needs testing' label to any changes within the entire repository
needs testing:
- changed-files:
- any-glob-to-any-file: '**'
8 changes: 8 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@ Note that commit messages in PRs will generally be squashed to keep commit histo
-->

Replace this line with a description of your change (and screenshots/screenrecordings if applicable).

### Code review:

Replace this line with anything specific to look out for during code reviews.

### Testing:

Replace this line with instructions on how to test your pull request. The more detailed, the easier it is for reviewers to test, the faster your PR gets merged.
14 changes: 14 additions & 0 deletions .github/workflows/auto-label-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Auto-Labeler
on:
pull_request_target:
types:
- opened

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Setup msvc
uses: ilammy/msvc-dev-cmd@v1
- name: Configure cmake
run: cmake -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="${{ env.BUILD_PROFILE }}"
run: cmake -G "Ninja" -B build -DCMAKE_BUILD_TYPE:STRING="${{ env.BUILD_PROFILE }}"
- name: Setup resource file version
shell: bash
run: |
Expand All @@ -33,7 +33,7 @@ jobs:
FILEVERSION=$(echo ${{ env.NORTHSTAR_VERSION }} | tr '.' ',' | sed -E 's/-rc[0-9]+//' | tr -d '[:alpha:]')
sed -i "s/0,0,0,1/${FILEVERSION}/g" primedev/ns_version.h
- name: Build
run: cmake --build .
run: cmake --build build/
- name: Extract Short Commit Hash
id: extract
shell: bash
Expand All @@ -43,13 +43,13 @@ jobs:
with:
name: NorthstarLauncher-${{ matrix.config.name }}-${{ steps.extract.outputs.commit }}
path: |
game/
build/game/
format-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DoozyX/clang-format-lint-action@v0.16.2
- uses: DoozyX/clang-format-lint-action@v0.18.2
with:
source: 'primedev'
exclude: 'primedev/include primedev/thirdparty primedev/wsockproxy'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/merge-conflict-auto-label.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Merge Conflict Auto Label
on:
workflow_dispatch: # Manual run
push:
branches:
- main
schedule:
- cron: "10 21 * * *"
- cron: "10 21 * * *" # Runs at 21:10; time was chosen based on contributor activity and low GitHub Actions cron load.

jobs:
triage:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup msvc
uses: ilammy/msvc-dev-cmd@v1
- name: Configure cmake
run: cmake -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Release"
run: cmake -G "Ninja" -B build -DCMAKE_BUILD_TYPE:STRING="Release"
- name: Setup resource file version
shell: bash
run: |
Expand All @@ -30,22 +30,22 @@ jobs:
FILEVERSION=$(echo ${{ env.NORTHSTAR_VERSION }} | tr '.' ',' | sed -E 's/-rc[0-9]+//' | tr -d '[:alpha:]')
sed -i "s/0,0,0,1/${FILEVERSION}/g" primedev/ns_version.h
- name: Build
run: cmake --build .
run: cmake --build build/
- name: Upload launcher build as artifact
uses: actions/upload-artifact@v3
with:
name: northstar-launcher
path: |
game/*.exe
game/*.dll
game/bin/x64_retail/*.dll
build/game/*.exe
build/game/*.dll
build/game/bin/x64_retail/*.dll
- name: Upload debug build artifact
uses: actions/upload-artifact@v3
with:
name: launcher-debug-files
path: |
game/*.pdb
game/bin/x64_retail/*.pdb
build/game/*.pdb
build/game/bin/x64_retail/*.pdb
upload-launcher-to-release:
if: startsWith(github.ref, 'refs/tags/v')
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mono_crash.*

# CMake output
out/
game/
build/game/
build/
CMakeFiles/
cmake_install.cmake
Expand Down
12 changes: 6 additions & 6 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ Developers who can work a command line may be interested in using [Visual Studio

- Follow the same steps as above for Visual Studio Build Tools, but instead of opening in Visual Studio, run the Command Prompt for VS 2022 and navigate to the NorthstarLauncher.

- Run `cmake . -G "Ninja"` to generate build files.
- Run `cmake . -G "Ninja" -B build` to generate build files.

- Run `cmake --build .` to build the project.
- Run `cmake --build build/` to build the project.

## Linux
### Steps
1. Clone the GitHub repo
2. Use `cd` to navigate to the cloned repo's directory
3. Then, run the following commands in order:
* `docker build --rm -t northstar-build-fedora .`
* `docker run --rm -it -e CC=cl -e CXX=cl --mount type=bind,source="$(pwd)",destination=/build northstar-build-fedora cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Windows -G "Ninja"`
* `docker run --rm -it -e CC=cl -e CXX=cl --mount type=bind,source="$(pwd)",destination=/build northstar-build-fedora cmake --build .`
* `docker run --rm -it -e CC=cl -e CXX=cl --mount type=bind,source="$(pwd)",destination=/build northstar-build-fedora cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Windows -G "Ninja" -B build`
* `docker run --rm -it -e CC=cl -e CXX=cl --mount type=bind,source="$(pwd)",destination=/build northstar-build-fedora cmake --build build/`

#### Podman

Expand All @@ -57,5 +57,5 @@ When using [`podman`](https://podman.io/) instead of Docker on an SELinux enable
As such the corresponding commands are

* `podman build --rm -t northstar-build-fedora .`
* `podman run --rm -it -e CC=cl -e CXX=cl --mount type=bind,source="$(pwd)",destination=/build,z northstar-build-fedora cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Windows -G "Ninja"`
* `podman run --rm -it -e CC=cl -e CXX=cl --mount type=bind,source="$(pwd)",destination=/build,z northstar-build-fedora cmake --build .`
* `podman run --rm -it -e CC=cl -e CXX=cl --mount type=bind,source="$(pwd)",destination=/build,z northstar-build-fedora cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Windows -G "Ninja" -B build`
* `podman run --rm -it -e CC=cl -e CXX=cl --mount type=bind,source="$(pwd)",destination=/build,z northstar-build-fedora cmake --build build/`
24 changes: 12 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
FROM registry.fedoraproject.org/fedora-toolbox:38
RUN dnf update -y && \
dnf install -y \
git \
wine \
wine-mono \
python3 \
msitools \
python3-simplejson \
python3-six \
cmake \
ninja-build \
make \
samba \
libunwind && \
git \
wine \
wine-mono \
python3 \
msitools \
python3-simplejson \
python3-six \
cmake \
ninja-build \
make \
samba \
libunwind && \
dnf clean all && \
mkdir /opt/msvc/ /build

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ Check [BUILD.md](BUILD.md) for instructions on how to compile, you can also down

## Format

For project coding standards check out [STANDARDS.md](STANDARDS.md).

This project uses [clang-format](https://clang.llvm.org/docs/ClangFormat.html), make sure you run `clang-format -i --style=file --exclude=primedev/include primedev/*.cpp primedev/*.h` when opening a Pull Request. Check the tool's website for instructions on how to integrate it with your IDE.
53 changes: 53 additions & 0 deletions STANDARDS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Code standards

There are exceptions, ask for them!

### Preamble

You are more than welcome to reformat any existing files using these rules should they fail to match them but please SPLIT your formatting changes from the rest by making a separate PR!

### General rules

> Basic rules that apply all the time.
Always assert your assumptions!

Use PascalCase for all names.

Suffix structs with `_t`.

Prefix classes with `C` (class) and `I` (abstract class).

Prefix all class member variables with `m_`.

Prefixes `g_` for global variables and `s_` for static variables are welcome.

For hooking we use `o_<function name>` for function pointers pointing to the original implementation and `h_<function name>` for functions we replace them with.

Document all function implementations and their arguments (if the argument is self explanatory you don't need to document it) valve style:
```
//-----------------------------------------------------------------------------
// Purpose: MH_MakeHook wrapper
// Input : *ppOriginal - Original function being detoured
// pDetour - Detour function
// Output : true on success, false otherwise
//-----------------------------------------------------------------------------
```

Don't overcomment your code unless nescessary, expect the reader to have limited knowledge.

Use `FIXME` comments for possible improvements/issues, `NOTE` for important information one might want to look into.

### Valve source files

> Rules that apply to all files from original valve code base.
When adding or just modifying a file that's present in valve source place it where valve put it.

Always use hungarian notation in these files.

### New files

> Rules that apply to Respawn or our own files.
When adding new files follow the general rules, you don't have to use hungarian notation. Put the file where you think it makes the most sense.
22 changes: 21 additions & 1 deletion primedev/Northstar.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ add_library(
"dedicated/dedicatedlogtoclient.cpp"
"dedicated/dedicatedlogtoclient.h"
"dedicated/dedicatedmaterialsystem.cpp"
"engine/gl_matsysiface.cpp"
"engine/host.cpp"
"engine/hoststate.cpp"
"engine/hoststate.h"
"engine/r2engine.cpp"
"engine/r2engine.h"
"engine/runframe.cpp"
"game/client/clientmode_shared.cpp"
"logging/crashhandler.cpp"
"logging/crashhandler.h"
"logging/logging.cpp"
Expand Down Expand Up @@ -150,7 +152,6 @@ add_library(
"squirrel/squirrelautobind.cpp"
"squirrel/squirrelautobind.h"
"squirrel/squirrelclasstypes.h"
"squirrel/squirreldatatypes.h"
"util/printcommands.cpp"
"util/printcommands.h"
"util/printmaps.cpp"
Expand All @@ -161,6 +162,25 @@ add_library(
"util/version.h"
"util/wininfo.cpp"
"util/wininfo.h"
"vscript/languages/squirrel_re/include/squirrel.h"
"vscript/languages/squirrel_re/squirrel/sqarray.h"
"vscript/languages/squirrel_re/squirrel/sqclosure.h"
"vscript/languages/squirrel_re/squirrel/sqcompiler.h"
"vscript/languages/squirrel_re/squirrel/sqfunctionproto.h"
"vscript/languages/squirrel_re/squirrel/sqlexer.h"
"vscript/languages/squirrel_re/squirrel/sqobject.h"
"vscript/languages/squirrel_re/squirrel/sqopcodes.h"
"vscript/languages/squirrel_re/squirrel/sqstate.h"
"vscript/languages/squirrel_re/squirrel/sqstring.h"
"vscript/languages/squirrel_re/squirrel/sqstruct.h"
"vscript/languages/squirrel_re/squirrel/sqtable.h"
"vscript/languages/squirrel_re/squirrel/squserdata.h"
"vscript/languages/squirrel_re/squirrel/sqvector.h"
"vscript/languages/squirrel_re/squirrel/sqvm.h"
"vscript/languages/squirrel_re/vsquirrel.h"
"vscript/vscript.h"
"windows/libsys.cpp"
"windows/libsys.h"
"dllmain.cpp"
"ns_version.h"
"Northstar.def"
Expand Down
Loading

0 comments on commit b341fdd

Please sign in to comment.