Skip to content

Commit

Permalink
Merge branch 'main' into fixes/memory-leak-hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Alystrasz authored Nov 1, 2024
2 parents c13bcbf + 10041ca commit f4029b0
Show file tree
Hide file tree
Showing 80 changed files with 1,861 additions and 1,225 deletions.
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
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/`
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ include_directories(primedev/thirdparty)

# Targets
add_subdirectory(primedev)
# Forces Minizip to not use functions that are not available in Win 7 libraries.
if(WIN32)
target_compile_definitions(minizip PUBLIC -D_WIN32_WINNT=0x0601)
endif()
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.
20 changes: 18 additions & 2 deletions primedev/Northstar.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ add_library(
"core/memalloc.cpp"
"core/memalloc.h"
"core/sourceinterface.cpp"
"core/sourceinterface.h"
"core/tier0.cpp"
"core/tier0.h"
"core/tier1.cpp"
Expand All @@ -69,6 +68,7 @@ add_library(
"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 @@ -151,7 +151,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 @@ -162,6 +161,23 @@ 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"
Expand Down
Loading

0 comments on commit f4029b0

Please sign in to comment.