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
160 changes: 160 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
name: Build and verify

on:
push:
branches:
- main
- "codex/**"
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
public-checks:
name: Public source checks
runs-on: ubuntu-latest
steps:
- name: Checkout public source
uses: actions/checkout@v7
with:
submodules: false
persist-credentials: false

- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: 22
cache: npm

- name: Run public source checks
run: scripts/ci/run-public-source-checks.sh

- name: Upload authoring-tool packages
uses: actions/upload-artifact@v7
with:
name: PalSchema-authoring-tools
if-no-files-found: error
retention-days: 7
path: |
dist/palschema-vscode-*.vsix
dist/palschema-tools-*.tgz

windows-msvc-shipping:
name: Windows MSVC Shipping baseline
if: >-
vars.PRIVATE_SUBMODULES_AVAILABLE == 'true' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/main'
runs-on: windows-latest
defaults:
run:
shell: pwsh
steps:
- name: Checkout authorized recursive dependencies
uses: actions/checkout@v7
with:
fetch-depth: 0
submodules: recursive
token: ${{ secrets.UEPSEUDO_TOKEN }}
Comment thread
LAP87 marked this conversation as resolved.
persist-credentials: false

- name: Set up MSVC
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1
with:
arch: x64
Comment thread
LAP87 marked this conversation as resolved.

- name: Add LLVM tools to PATH
run: |
$llvmPath = "C:\Program Files\LLVM\bin"
if (-not (Test-Path $llvmPath)) {
throw "LLVM was not found at $llvmPath"
}
$llvmPath | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: Install Rust target
run: rustup target add x86_64-pc-windows-msvc

- name: Configure
run: cmake --preset win64-msvc-ci-shipping

- name: Build PalSchema
run: cmake --build --preset win64-msvc-ci-shipping --target PalSchema
Comment thread
LAP87 marked this conversation as resolved.

- name: Verify PE contract
run: >-
python scripts/verify-win64-artifact.py
build/win64-msvc-ci-shipping/PalSchema.dll
--json-output build/win64-msvc-ci-shipping/pe-contract.json

- name: Upload public build outputs
uses: actions/upload-artifact@v7
with:
name: PalSchema-Win64-MSVC-Shipping
if-no-files-found: error
retention-days: 7
path: |
build/win64-msvc-ci-shipping/PalSchema.dll
build/win64-msvc-ci-shipping/pe-contract.json

linux-xwin:
name: Linux-hosted Win64 Dev and Shipping
if: >-
vars.PRIVATE_SUBMODULES_AVAILABLE == 'true' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout authorized recursive dependencies
uses: actions/checkout@v7
with:
fetch-depth: 0
submodules: recursive
token: ${{ secrets.UEPSEUDO_TOKEN }}
persist-credentials: false

- name: Install Linux cross-build tools
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
clang clang-tools cmake lld llvm ninja-build \
python3 util-linux zip

- name: Prepare isolated Rust and Microsoft SDK caches
run: >-
scripts/bootstrap-linux.sh
--install-rust-toolchain
--install-xwin
--prepare-sdk
--accept-microsoft-license

- name: Build and verify Linux-hosted Win64 artifact
run: |
scripts/build-linux.sh dev
python3 scripts/verify-win64-artifact.py \
build/win64-xwin-dev/PalSchema.dll \
--json-output build/win64-xwin-dev/pe-contract.json
scripts/package-linux.sh dev --output-dir dist
scripts/build-linux.sh shipping
python3 scripts/verify-win64-artifact.py \
build/win64-xwin-shipping/PalSchema.dll \
--json-output build/win64-xwin-shipping/pe-contract.json
scripts/package-linux.sh shipping --output-dir dist
for archive in dist/PalSchema_*_Win64*.zip; do
unzip -l "$archive"
done

- name: Upload Linux-hosted Win64 outputs
uses: actions/upload-artifact@v7
with:
name: PalSchema-Win64-Linux-xwin
if-no-files-found: error
retention-days: 7
path: |
build/win64-xwin-dev/PalSchema.dll
build/win64-xwin-dev/PalSchema.pdb
build/win64-xwin-dev/pe-contract.json
build/win64-xwin-shipping/PalSchema.dll
build/win64-xwin-shipping/pe-contract.json
dist/PalSchema_*_Win64*.zip
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ RC*

# CMake
build/
dist/
.xwin-cache/
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
Expand All @@ -24,4 +26,11 @@ install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
CMakeUserPresets.json
CMakeUserPresets.json

# Node authoring tools
node_modules/

# Python verification cache
__pycache__/
*.pyc
39 changes: 36 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
cmake_minimum_required(VERSION 3.22)

project(PalSchema LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

add_subdirectory(deps)

set(TARGET PalSchema)
project(${TARGET})

file(GLOB SRC_FILES CONFIGURE_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/src/dllmain.cpp"
Expand Down Expand Up @@ -34,7 +37,37 @@ file(GLOB SRC_FILES CONFIGURE_DEPENDS
)

add_library(${TARGET} SHARED ${SRC_FILES})
target_include_directories(${TARGET} PRIVATE
if(WIN32)
target_sources(${TARGET} PRIVATE version.rc)

# The RE-UE4SS xwin toolchain configures SDK headers for clang-cl, but
# CMake's llvm-rc preprocessing step needs the include paths separately.
if(CMAKE_CROSSCOMPILING AND DEFINED XWIN_CACHE_DIR)
set_property(
SOURCE version.rc
APPEND PROPERTY INCLUDE_DIRECTORIES
"${XWIN_CACHE_DIR}/crt/include"
"${XWIN_CACHE_DIR}/sdk/include/ucrt"
"${XWIN_CACHE_DIR}/sdk/include/shared"
"${XWIN_CACHE_DIR}/sdk/include/um"
"${XWIN_CACHE_DIR}/sdk/include/winrt"
)
endif()
endif()

target_include_directories(${TARGET} PRIVATE
include/
)
target_link_libraries(${TARGET} PRIVATE Zydis Zycore safetyhook nlohmann_json::nlohmann_json glaze::glaze UE4SS efsw)
target_compile_definitions(${TARGET} PRIVATE PALSCHEMA_BUILDING_DLL=1)
target_link_libraries(${TARGET} PRIVATE Zydis Zycore safetyhook nlohmann_json::nlohmann_json glaze::glaze UE4SS efsw)

if(MSVC)
# Keep Shipping DLLs reproducible across build times and checkout paths.
# /Brepro replaces the wall-clock PE/PDB identity with a content-derived
# value, while the alternate PDB path prevents the absolute build root
# from leaking into the CodeView record embedded in the DLL.
target_link_options(${TARGET} PRIVATE
"/Brepro"
"/PDBALTPATH:PalSchema.pdb"
)
endif()
73 changes: 73 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"version": 6,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Lower the preset schema or raise the CMake minimum

The project and build documentation advertise CMake 3.22, but the CMake presets manual lists preset schema version 6 as added in CMake 3.25. On a supported 3.22–3.24 installation, every documented cmake --preset ... command therefore fails while reading this file, before cmakeMinimumRequired or the project can be evaluated. Use a preset schema supported by 3.22 or consistently require CMake 3.25 or newer.

Useful? React with 👍 / 👎.

"cmakeMinimumRequired": {
"major": 3,
"minor": 22,
"patch": 0
},
"configurePresets": [
{
"name": "win64-xwin-base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"toolchainFile": "${sourceDir}/cmake/toolchains/xwin-clang-cl.cmake",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "win64-xwin-dev",
"displayName": "Win64 Dev (Linux host, xwin + clang-cl)",
"description": "Cross-compile the PalSchema development DLL for Palworld under Proton.",
"inherits": "win64-xwin-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Game__Debug__Win64"
}
},
{
"name": "win64-xwin-shipping",
"displayName": "Win64 Shipping (Linux host, xwin + clang-cl)",
"description": "Cross-compile the PalSchema shipping DLL for Palworld under Proton.",
"inherits": "win64-xwin-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Game__Shipping__Win64"
}
},
{
"name": "win64-msvc-ci-shipping",
"displayName": "Win64 Shipping (Windows CI, MSVC)",
"description": "Build the Windows baseline used to compare the Linux-hosted cross-build.",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Game__Shipping__Win64",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
}
],
"buildPresets": [
{
"name": "win64-xwin-dev",
"configurePreset": "win64-xwin-dev"
},
{
"name": "win64-xwin-shipping",
"configurePreset": "win64-xwin-shipping"
},
{
"name": "win64-msvc-ci-shipping",
"configurePreset": "win64-msvc-ci-shipping"
}
]
}
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,23 @@ or with Ninja (single-configuration, faster)
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Game__Shipping__Win64
```

## Building the Win64 DLL from Linux

PalSchema can be cross-compiled on Linux for the Windows Palworld client
running under Proton. The supported path uses xwin, clang-cl, LLD, Ninja, and
the repository-pinned RE-UE4SS toolchain.

See [Building the Win64 PalSchema DLL on Linux](docs/linux/building-win64.md).
For a locked, interruption-recoverable install with a recorded rollback path, see
[Safe deployment to Palworld under Proton or Wine](docs/linux/proton-deployment.md).
For a separately managed Win64 dedicated server on a Linux host, see
[Dedicated server development on Linux](docs/linux/dedicated-server.md).
For the cross-platform JSON/JSONC validator, language server, and VS Code
extension, see [PalSchema authoring tools](docs/linux/authoring-tools.md).

UE4SS remains a separate runtime installation and is not bundled with
PalSchema.

# Mods using PalSchema

I'll only include one mod per author to avoid cluttering the list too much.
Expand Down
54 changes: 31 additions & 23 deletions assets/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
{
"json.schemas": [
{
"fileMatch": ["items/*.json"],
"url": "./schemas/items.schema.json"
},
{
"fileMatch": ["pals/*.json"],
"url": "./schemas/pals.schema.json"
},
{
"fileMatch": ["skins/*.json"],
"url": "./schemas/skins.schema.json"
},
{
"fileMatch": ["buildings/*.json"],
"url": "./schemas/buildings.schema.json"
},
{
"fileMatch": ["raw/*.json"],
"url": "./schemas/raw.schema.json"
},
]
}
"json.schemas": [
{
"fileMatch": [
"**/items/**/*.json",
"**/items/**/*.jsonc"
],
"url": "./schemas/items.schema.json"
},
{
"fileMatch": [
"**/pals/**/*.json",
"**/pals/**/*.jsonc"
],
"url": "./schemas/pals.schema.json"
},
{
"fileMatch": [
"**/skins/**/*.json",
"**/skins/**/*.jsonc"
],
"url": "./schemas/skins.schema.json"
},
{
"fileMatch": [
"**/buildings/**/*.json",
"**/buildings/**/*.jsonc"
],
"url": "./schemas/buildings.schema.json"
}
]
}
Loading