diff --git a/README.md b/README.md
index e22e8b7c5c..2b6e48ef90 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,17 @@
-#
FiveM
+#
Cfx.re (FiveM/RedM)
-[FiveM](https://fivem.net/) is a dual-purpose (SP/MP) modification framework for the PC version of Grand Theft Auto V as released by Rockstar Games.
+This repository contains the code for the Cfx.re projects, among which are the following:
-On the multiplayer aspect, it differs from other similar modifications by utilizing the embedded game networking frameworks, building a modification framework around them, and expanding the game's functionality on an end-to-end level, directly binding to the RAGE Technology Group's base frameworks and Rockstar North's GTA codebase.
+* [FiveM](https://fivem.net/), a dual-purpose (SP/MP) modification framework for the PC version of Grand Theft Auto V as released by Rockstar Games.
+* [RedM](https://redm.gg/), a modification framework for the PC version of Red Dead Redemption 2 as released by Rockstar Games.
+* FXServer, the server component for multiplayer services on the Cfx.re projects.
+
+On the multiplayer aspect, the GTA/RAGE modifications differ from other similar modifications by utilizing the embedded game networking frameworks, building a modification framework around them, and expanding the game's functionality on an end-to-end level, directly binding to the RAGE Technology Group's base frameworks and Rockstar North's GTA codebase.
## Getting started
To play FiveM, simply download the launcher binaries from the [website](https://fivem.net).
-To develop FiveM, please follow the documentation in `docs/` in the repository.
+To develop FiveM, please follow the documentation in [docs/](https://github.com/citizenfx/fivem/tree/master/docs) in the repository.
## License
-FiveM is licensed under a dual license, details of which are in the `code/LICENSE` file in the repository.
+FiveM is licensed under a dual license, details of which are in the [code/LICENSE](https://github.com/citizenfx/fivem/blob/master/code/LICENSE) file in the repository.
diff --git a/code/.gitignore b/code/.gitignore
index 681fdd3501..382af952e6 100644
--- a/code/.gitignore
+++ b/code/.gitignore
@@ -1 +1,3 @@
[Bb]in/
+/build
+/package-lock.json
\ No newline at end of file
diff --git a/code/LICENSE b/code/LICENSE
index f50e11364d..88f0c2c08c 100644
--- a/code/LICENSE
+++ b/code/LICENSE
@@ -1,9 +1,9 @@
- CitizenFX/FiveM are (c) 2017 the CitizenFX Collective.
+ CitizenFX/FiveM are (c) 2017-2020 the CitizenFX Collective.
Use of this source code is subject to the terms provided on the CitizenFX
-Collective web site, currently versioned (1) at the following web URL:
+Collective web site, currently versioned (4) at the following web URL:
- https://runtime.fivem.net/fivem-service-agreement-1.pdf
+ https://fivem.net/terms
The following files, as long as they are marked as licensed under the
CitizenFX Project license, are optionally available under the LGPLv2, as in
@@ -28,6 +28,9 @@ PSA.
This project is based on the original CitizenFX framework by NTAuthority,
the original permission notice of which is reproduced below.
+ Please note that this permission notice does not apply to any changes made
+since 2016.
+
Copyright (c) 2014 Bas Timmer/NTAuthority et al.
Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/code/README.md b/code/README.md
new file mode 100644
index 0000000000..0c2e25ec59
--- /dev/null
+++ b/code/README.md
@@ -0,0 +1,12 @@
+# CitizenFX Native Project
+
+This directory contains the primary native CitizenFX project.
+
+* [**client/**](./client): A historical misnomer, contains common code shared across projects, as well as the client launcher logic.
+* [**components/**](./components): Contains most of the code as part of a 'component' system.
+* [**deplibs/**](./deplibs): Legacy manually-vendored-in includes/lib files.
+* [**server/**](./server): Contains the server launcher logic.
+* [**shared/**](./shared): A confusing cognate to `client/shared/`, contains lower-level shared code.
+* [**tests/**](./tests): Unused since 2014, a prototype of unit/integration tests for the framework.
+* [**tools/**](./tools): Tooling used for building the native CitizenFX project.
+* [**vendor/**](./vendor): Premake vendor definition files and non-submoduled dependent includes/source files.
\ No newline at end of file
diff --git a/code/client/README.md b/code/client/README.md
new file mode 100644
index 0000000000..0a45a7a106
--- /dev/null
+++ b/code/client/README.md
@@ -0,0 +1,14 @@
+# `client/`
+
+Shared CitizenFX framework code.
+
+* [**citicore/**](./citicore): CitizenFX Runtime, handles loading components and implements the CitizenFX Object Model.
+* [**citigame/**](./citigame): Auxiliary component for client-side lifecycle after bootstrapping.
+* [**clrcore/**](./clrcore): CitizenFX.Core C# library.
+* [**clrref/**](./clrref): Reference generation for the CitizenFX.Core library.
+* [**common/**](./common): Shared source files included in all projects.
+* [**console/**](./console): `FiveM.com` console launcher.
+* [**diag/**](./diag): `CfxDiag` utility.
+* [**ipfsdl/**](./ipfsdl): IPFS download API wrapper.
+* [**launcher/**](./launcher): Main client entry point/bootstrapper.
+* [**shared/**](./shared): Shared includes and source files.
\ No newline at end of file
diff --git a/code/client/launcher/premake5.lua b/code/client/launcher/premake5.lua
index 1b95949e91..62759a8150 100644
--- a/code/client/launcher/premake5.lua
+++ b/code/client/launcher/premake5.lua
@@ -32,7 +32,7 @@ local function launcherpersonality(name)
defines("LAUNCHER_PERSONALITY_" .. name:upper())
- flags "NoManifest"
+ flags { "NoManifest", "NoImportLib" }
symbols "Full"
diff --git a/code/client/shared/premake5.lua b/code/client/shared/premake5.lua
index f9a19a9d1f..55b380580e 100644
--- a/code/client/shared/premake5.lua
+++ b/code/client/shared/premake5.lua
@@ -6,6 +6,10 @@
targetname(libc and "shared_libc" or "shared")
language "C++"
kind "StaticLib"
+
+ if os.istarget('windows') then
+ dependson { 'CfxPrebuild' }
+ end
if libc then
staticruntime "On"
diff --git a/code/components/README.md b/code/components/README.md
new file mode 100644
index 0000000000..d8d7669a9d
--- /dev/null
+++ b/code/components/README.md
@@ -0,0 +1,105 @@
+# `components/`
+
+CitizenFX implementation components.
+
+## List
+
+### Common
+* [**citizen-game-ipc/**](./citizen-game-ipc): IPC wrapper for CfxGL.
+* [**citizen-game-main/**](./citizen-game-main): Main entry point for CfxGL.
+* [**citizen-legacy-net-resources/**](./citizen-legacy-net-resources): Binds `net` to the `citizen:resources:client` resource system.
+* [**citizen-resources-client/**](./citizen-resources-client): Resources system, client-specific functionality.
+* [**citizen-resources-core/**](./citizen-resources-core): Resources system, core functionality.
+* [**citizen-resources-gta/**](./citizen-resources-gta): Resource system, GTA-specific functionality.
+* [**citizen-resources-metadata-lua/**](./citizen-resources-metadata-lua): Loader for `fxmanifest.lua` and `__resource.lua` files.
+* [**citizen-scripting-core/**](./citizen-scripting-core): Core scripting runtime (ScRT) functionality.
+* [**citizen-scripting-lua/**](./citizen-scripting-lua): Lua ScRT.
+* [**citizen-scripting-mono/**](./citizen-scripting-mono): Mono ScRT loader. Most of the implementation is in `CitizenFX.Core.dll`.
+* [**citizen-scripting-v8/**](./citizen-scripting-v8): V8 ScRT.
+* [**comptest/**](./comptest): Testing component.
+* [**conhost-posh/**](./conhost-posh): Deprecated PowerShell console host.
+* [**conhost-v2/**](./conhost-v2): dear ImGui-based console host.
+* [**debug-net/**](./debug-net): Debug visualizations for `net`.
+* [**debug-script/**](./debug-script): Script debugging functionality.
+* [**devcon/**](./devcon): VConsole2 server.
+* [**discord/**](./discord): Discord integration.
+* [**font-renderer/**](./font-renderer): Watermark renderer and DirectWrite font client.
+* [**glue/**](./glue): High-level 'glue' to link other components together.
+* [**http-client/**](./http-client): Async cURL wrapper library.
+* [**legacy-game-re3/**](./legacy-game-re3): ...
+* [**lovely-script/**](./lovely-script): Background script.
+* [**n19ui/**](./n19ui): Jupiter-based UI. Not currently used.
+* [**net/**](./net): Network client for game servers.
+* [**net-base/**](./net-base): Base networking library for client/server projects.
+* [**net-http-server/**](./net-http-server): HTTP server for `net:tcp-server`.
+* [**net-tcp-server/**](./net-tcp-server): Generic transport-agnostic TCP server framework.
+* [**nui-core/**](./nui-core): NUI core library.
+* [**nui-gsclient/**](./nui-gsclient): NUI game server client, for the server list.
+* [**nui-profiles/**](./nui-profiles): NUI user profile functionality.
+* [**nui-resources/**](./nui-resources): NUI bindings to the resource system.
+* [**profiles/**](./profiles): User profile functionality.
+* [**rage-formats-x/**](./rage-formats-x): RAGE file format library.
+* [**scrbind-base/**](./scrbind-base): High-level C++ class script binding support.
+* [**scrbind-formats/**](./scrbind-formats): Uses scrBind to bind to rage:formats:x.
+* [**scripthookv/**](./scripthookv): ScriptHookV compatibility library.
+* [**scripting-gta/**](./scripting-gta): Scripting implementation wrapper to `rage:scripting`.
+* [**steam/**](./steam): Steam integration.
+* [**sticky/**](./sticky): Surrogate for private `adhesive` component.
+* [**template/**](./template): Template for use with new components.
+* [**tool-formats/**](./tool-formats): Tool component for `rage:formats:x`.
+* [**tool-vehrec/**](./tool-vehrec): Tool component to generate .#vr files.
+* [**vfs-core/**](./vfs-core): Virtual File System, core library.
+* [**vfs-impl-rage/**](./vfs-impl-rage): Virtual File System, RAGE implementation.
+* [**voip-mumble/**](./voip-mumble): Mumble client.
+
+### Server
+* [**citizen-server-impl/**](./citizen-server-impl): Server core implementation. This is a single component due to ABI limitations
+ on Linux.
+* [**citizen-server-instance/**](./citizen-server-instance): Server `instance` wrapper. Factored out for dependencies.
+* [**citizen-server-main/**](./citizen-server-main): Server entry point.
+* [**citizen-server-monitor/**](./citizen-server-monitor): Server entry point for txAdmin monitor mode.
+* [**citizen-server-net/**](./citizen-server-net): Server `net` wrapper. Factored out for dependencies.
+* [**citizen-ssh-server/**](./citizen-ssh-server): ...
+* [**conhost-server/**](./conhost-server): Dummy `conhost` implementation for the server.
+* [**scripting-server/**](./scripting-server): Standalone scripting implementation for use in the server.
+* [**vfs-impl-server/**](./vfs-impl-server): Standalone VFS implementation for use in the server.
+* [**voip-server-mumble/**](./voip-server-mumble): Mumble server.
+
+### GTA5
+* [**asi-five/**](./asi-five): ASI loader.
+* [**citizen-level-loader-five/**](./citizen-level-loader-five): SP level loading support.
+* [**citizen-mod-loader-five/**](./citizen-mod-loader-five): .oiv mod loading support.
+* [**citizen-playernames-five/**](./citizen-playernames-five): Player name overrides.
+* [**devtools-five/**](./devtools-five): Developer tools.
+* [**extra-natives-five/**](./extra-natives-five): High-level game-specific natives.
+* [**gta-core-five/**](./gta-core-five): Low-level GTA project wrappers.
+* [**gta-game-five/**](./gta-game-five): High-level GTA project wrappers.
+* [**gta-mission-cleanup-five/**](./gta-mission-cleanup-five): Bindings to GTA mission cleanup.
+* [**gta-net-five/**](./gta-net-five): Network functionality for GTA.
+* [**gta-streaming-five/**](./gta-streaming-five): Streaming functionality for GTA.
+* [**handling-loader-five/**](./handling-loader-five): Handling loader.
+* [**loading-screens-five/**](./loading-screens-five): Loading screen override functionality.
+* [**rage-allocator-five/**](./rage-allocator-five): Wraps RAGE allocators.
+* [**rage-device-five/**](./rage-device-five): Wraps RAGE VFS.
+* [**rage-graphics-five/**](./rage-graphics-five): Wraps RAGE grcore.
+* [**rage-input-five/**](./rage-input-five): Wraps RAGE grcore input.
+* [**rage-nutsnbolts-five/**](./rage-nutsnbolts-five): Generic 'nuts and bolts' for RAGE.
+* [**rage-scripting-five/**](./rage-scripting-five): Wraps RAGE scripting.
+* [**ros-patches-five/**](./ros-patches-five): ROS compatibility.
+
+### RDR2
+* [**citizen-level-loader-rdr3/**](./citizen-level-loader-rdr3): SP level loading support.
+* [**citizen-playernames-rdr3/**](./citizen-playernames-rdr3): Player name overrides.
+* [**extra-natives-rdr3/**](./extra-natives-rdr3): High-level game-specific natives.
+* [**gta-core-rdr3/**](./gta-core-rdr3): Low-level GTA project wrappers. (RDR3 is built atop GTA/RAGE)
+* [**gta-game-rdr3/**](./gta-game-rdr3): High-level GTA project wrappers.
+* [**gta-mission-cleanup-rdr3/**](./gta-mission-cleanup-rdr3): ...
+* [**gta-net-rdr3/**](./gta-net-rdr3): ...
+* [**gta-streaming-rdr3/**](./gta-streaming-rdr3): ...
+* [**rage-allocator-rdr3/**](./rage-allocator-rdr3): ...
+* [**rage-device-rdr3/**](./rage-device-rdr3): ...
+* [**rage-graphics-rdr3/**](./rage-graphics-rdr3): ...
+* [**rage-input-rdr3/**](./rage-input-rdr3): ...
+* [**rage-nutsnbolts-rdr3/**](./rage-nutsnbolts-rdr3): ...
+* [**rage-scripting-rdr3/**](./rage-scripting-rdr3): ...
+* [**ros-patches-rdr3/**](./ros-patches-rdr3): Symlinked ROS compatibility.
\ No newline at end of file
diff --git a/code/components/ros-patches-five/component.lua b/code/components/ros-patches-five/component.lua
index 24bb86ebe4..123b75d033 100644
--- a/code/components/ros-patches-five/component.lua
+++ b/code/components/ros-patches-five/component.lua
@@ -8,8 +8,6 @@ links { "libcef_dll", "delayimp", "libGLESv2" }
links { "libcef" }
-flags { 'Maps' }
-
filter 'architecture:x64'
links { "steam_api64" }
diff --git a/code/components/ros-patches-rdr3/component.lua b/code/components/ros-patches-rdr3/component.lua
index 24bb86ebe4..123b75d033 100644
--- a/code/components/ros-patches-rdr3/component.lua
+++ b/code/components/ros-patches-rdr3/component.lua
@@ -8,8 +8,6 @@ links { "libcef_dll", "delayimp", "libGLESv2" }
links { "libcef" }
-flags { 'Maps' }
-
filter 'architecture:x64'
links { "steam_api64" }
diff --git a/code/premake5.lua b/code/premake5.lua
index 87cf291c0c..7cab675ab9 100644
--- a/code/premake5.lua
+++ b/code/premake5.lua
@@ -107,6 +107,12 @@ workspace "CitizenMP"
buildoptions '-mpclmul -maes -mssse3 -mavx2 -mrtm'
buildoptions '-fsanitize=address -fsanitize-recover=address'
end
+
+ filter { 'action:vs*' }
+ implibdir "$(IntDir)/lib/"
+ symbolspath "$(TargetDir)dbg/$(TargetName).pdb"
+
+ filter {}
-- debug output
configuration "Debug*"
@@ -166,10 +172,14 @@ workspace "CitizenMP"
else
include 'server/launcher'
end
+
+ if os.istarget('windows') then
+ include 'premake5_layout.lua'
+ end
-- TARGET: corert
include 'client/citicore'
-
+
if _OPTIONS['game'] ~= 'server' then
include 'client/ipfsdl'
@@ -205,6 +215,12 @@ premake.override(premake.vstudio.dotnetbase, 'debugProps', function(base, cfg)
_p(2,'%s', iif(premake.config.isOptimizedBuild(cfg), "true", "false"))
end)
+premake.override(premake.vstudio.vc2010, 'ignoreImportLibrary', function(base, cfg)
+ if cfg.flags.NoImportLib then
+ premake.vstudio.vc2010.element("IgnoreImportLibrary", nil, "true")
+ end
+end)
+
premake.override(premake.vstudio.vc2010, 'importLanguageTargets', function(base, prj)
base(prj)
diff --git a/code/premake5_layout.lua b/code/premake5_layout.lua
new file mode 100644
index 0000000000..1f9fcc690f
--- /dev/null
+++ b/code/premake5_layout.lua
@@ -0,0 +1,35 @@
+-- setup pre-build and post-build layouts
+project 'CfxPrebuild'
+ kind 'Utility'
+
+ prebuildcommands {
+ ('"%s"'):format(
+ path.getabsolute('tools/build/run_prebuild.cmd')
+ )
+ }
+
+project 'CfxPostbuild'
+ kind 'Utility'
+
+ if _OPTIONS['game'] ~= 'launcher' then
+ dependson { 'glue' }
+ else
+ dependson { 'citizen-game-main' }
+ end
+
+ files {
+ 'tools/build/run_postbuild.ps1'
+ }
+
+ filter 'files:**.ps1'
+ buildmessage 'Preparing application to run from layout...'
+
+ buildcommands {
+ -- directly use $(TargetDir) and remove trailing \ so pwsh doesn't get upset
+ ([["%s" "$(TargetDir.TrimEnd('\'))" %s]]):format(
+ path.getabsolute('tools/build/run_postbuild.cmd'),
+ _OPTIONS['game']
+ )
+ }
+
+ buildoutputs { 'tools/build/dummy_dont_generate.txt' }
\ No newline at end of file
diff --git a/code/tools/README.md b/code/tools/README.md
new file mode 100644
index 0000000000..4bfaf56584
--- /dev/null
+++ b/code/tools/README.md
@@ -0,0 +1,8 @@
+# `tools/`
+CitizenFX build infrastructure.
+
+* [**build/**](./build): Premake5 build tool helpers.
+* [**ci/**](./ci): CI scripts. Confused about the build process? Look here.
+* [**dbg/**](./dbg): Wrappers for adding debug info to game clients.
+* [**ext/**](./ext): External data.
+* [**idl/**](./idl): `xpidl` fork.
\ No newline at end of file
diff --git a/code/tools/build/run_postbuild.cmd b/code/tools/build/run_postbuild.cmd
new file mode 100644
index 0000000000..e36ab89a56
--- /dev/null
+++ b/code/tools/build/run_postbuild.cmd
@@ -0,0 +1,4 @@
+@echo off
+set ROOT=%~dp0
+
+powershell -ExecutionPolicy Bypass %ROOT%\run_postbuild.ps1 %*
\ No newline at end of file
diff --git a/code/tools/build/run_postbuild.ps1 b/code/tools/build/run_postbuild.ps1
new file mode 100644
index 0000000000..e6d4bfe4dd
--- /dev/null
+++ b/code/tools/build/run_postbuild.ps1
@@ -0,0 +1,80 @@
+param (
+ [Parameter()]
+ [string]
+ $LayoutDir,
+
+ [Parameter()]
+ [string]
+ $Game
+)
+
+$LayoutDir = Resolve-Path $LayoutDir
+
+$InstRoot = "$PSScriptRoot\..\..\..\"
+$ErrorActionPreference = "Stop"
+
+if ($env:CI) {
+ return
+}
+
+# Maybe unify with build.ps1?
+$WorkDir = "$InstRoot"
+
+$IsRDR = $false
+$IsLauncher = $false
+
+if ($Game -eq "rdr3") {
+ $IsRDR = $true
+} elseif ($Game -eq "launcher") {
+ $IsLauncher = $true
+}
+
+## build UI
+Push-Location $WorkDir
+$UICommit = (git rev-list -1 HEAD ext/ui-build/ ext/cfx-ui/)
+Pop-Location
+
+Push-Location $WorkDir\ext\ui-build
+
+if (!(Test-Path data\.commit) -or $UICommit -ne (Get-Content data\.commit)) {
+ .\build.cmd
+
+ $UICommit | Out-File -Encoding ascii -NoNewline data\.commit
+}
+
+if ($?) {
+ Copy-Item -Force $WorkDir\ext\ui-build\data.zip $LayoutDir\citizen\ui.zip
+ Copy-Item -Force $WorkDir\ext\ui-build\data_big.zip $LayoutDir\citizen\ui-big.zip
+}
+
+Pop-Location
+
+## setup layout
+New-Item -ItemType Directory -Force $LayoutDir\bin
+
+Copy-Item -Force -Recurse $WorkDir\vendor\cef\Release\*.dll $LayoutDir\bin\
+Copy-Item -Force -Recurse $WorkDir\vendor\cef\Release\*.bin $LayoutDir\bin\
+
+New-Item -ItemType Directory -Force $LayoutDir\bin\cef
+
+Copy-Item -Force -Recurse $WorkDir\vendor\cef\Resources\icudtl.dat $LayoutDir\bin\
+Copy-Item -Force -Recurse $WorkDir\vendor\cef\Resources\*.pak $LayoutDir\bin\cef\
+Copy-Item -Force -Recurse $WorkDir\vendor\cef\Resources\locales\en-US.pak $LayoutDir\bin\cef\
+
+if (!$IsLauncher -and !$IsRDR) {
+ Copy-Item -Force -Recurse $WorkDir\data\shared\* $LayoutDir\
+ Copy-Item -Force -Recurse $WorkDir\data\client\* $LayoutDir\
+} elseif ($IsLauncher) {
+ Copy-Item -Force -Recurse $WorkDir\data\launcher\* $LayoutDir\
+ Copy-Item -Force -Recurse $WorkDir\data\client\bin\* $LayoutDir\bin\
+ Copy-Item -Force -Recurse $WorkDir\data\client\citizen\resources\* $LayoutDir\citizen\resources\
+} elseif ($IsRDR) {
+ Copy-Item -Force -Recurse $WorkDir\data\shared\* $LayoutDir\
+ Copy-Item -Force -Recurse $WorkDir\data\client\*.dll $LayoutDir\
+ Copy-Item -Force -Recurse $WorkDir\data\client\bin\* $LayoutDir\bin\
+ Copy-Item -Force -Recurse $WorkDir\data\client\citizen\clr2 $LayoutDir\citizen\
+ Copy-Item -Force -Recurse $WorkDir\data\client\citizen\*.ttf $LayoutDir\citizen\
+ Copy-Item -Force -Recurse $WorkDir\data\client\citizen\ros $LayoutDir\citizen\
+ Copy-Item -Force -Recurse $WorkDir\data\client\citizen\resources $LayoutDir\citizen\
+ Copy-Item -Force -Recurse $WorkDir\data\client_rdr\* $LayoutDir\
+}
diff --git a/code/tools/build/run_prebuild.cmd b/code/tools/build/run_prebuild.cmd
new file mode 100644
index 0000000000..d25b26176b
--- /dev/null
+++ b/code/tools/build/run_prebuild.cmd
@@ -0,0 +1,4 @@
+@echo off
+set ROOT=%~dp0
+
+powershell -ExecutionPolicy Bypass %ROOT%\run_prebuild.ps1
\ No newline at end of file
diff --git a/code/tools/build/run_prebuild.ps1 b/code/tools/build/run_prebuild.ps1
new file mode 100644
index 0000000000..e052055e2e
--- /dev/null
+++ b/code/tools/build/run_prebuild.ps1
@@ -0,0 +1,20 @@
+$InstRoot = "$PSScriptRoot\..\..\..\"
+$ErrorActionPreference = "Stop"
+
+if (([string](python --version)).StartsWith("Python 3")) {
+ "PREBUILD : error PY27 : `python` in PATH is Python 3, not Python 2.
+Please set PATH for MSBuild/VS to contain Python 2.7 before Python 3.x." | Write-Host
+ return 1;
+}
+
+if (!(Test-Path $InstRoot\code\client\clrcore\NativesFive.cs)) {
+ Invoke-Expression "$InstRoot\prebuild_natives.cmd"
+}
+
+if (!(Test-Path $InstRoot\vendor\udis86\libudis86\itab.c)) {
+ Invoke-Expression "$InstRoot\code\prebuild_udis86.cmd"
+}
+
+if (!(Test-Path $InstRoot\code\tools\idl\deps)) {
+ Invoke-Expression "$InstRoot\code\prebuild_misc.cmd"
+}
\ No newline at end of file
diff --git a/code/tools/build/versioning.lua b/code/tools/build/versioning.lua
index cac28e17b7..9a948d11ad 100644
--- a/code/tools/build/versioning.lua
+++ b/code/tools/build/versioning.lua
@@ -19,6 +19,11 @@ if os.istarget('windows') then
'%{prj.location}/%{prj.name}.res'
}
+ lastLang = nil
+ lastKind = nil
+ elseif lastKind == 'StaticLib' then
+ targetdir '$(IntDir)/out/'
+
lastLang = nil
lastKind = nil
end
diff --git a/code/vendor/mojo.lua b/code/vendor/mojo.lua
index 78d3cef53a..4804535da3 100644
--- a/code/vendor/mojo.lua
+++ b/code/vendor/mojo.lua
@@ -38,34 +38,34 @@ function files(x)
for _, v in ipairs(x) do
if v:endswith('.mojom') or v:endswith('.typemap') then
if not added then
- includedirs { '%{cfg and (cfg.linktarget.directory .. "/gen/") or ""}', '%{cfg and (cfg.linktarget.directory .. "/gen/vendor/chromium/") or ""}', '%{cfg and (cfg.linktarget.directory .. "/code/") or ""}' }
+ includedirs { '%{cfg and (cfg.buildtarget.directory .. "/gen/") or ""}', '%{cfg and (cfg.buildtarget.directory .. "/gen/vendor/chromium/") or ""}', '%{cfg and (cfg.buildtarget.directory .. "/code/") or ""}' }
filter 'files:**.typemap'
buildcommands {
table.concat({
- 'if exist %{path.getabsolute(cfg.linktarget.directory .. "/gen/typemap_" .. prj.name)} (',
+ 'if exist %{path.getabsolute(cfg.buildtarget.directory .. "/gen/typemap_" .. prj.name)} (',
'python',
'"' .. prj_root .. '/../vendor/chromium/mojo/public/tools/bindings/generate_type_mappings.py"',
'%{gen_typemap_args(file.abspath)}',
'--dependency',
- '%{cfg.linktarget.directory .. "/gen/typemap_" .. prj.name}',
+ '%{cfg.buildtarget.directory .. "/gen/typemap_" .. prj.name}',
'--output',
- '%{cfg.linktarget.directory .. "/gen/typemap_" .. prj.name}',
+ '%{cfg.buildtarget.directory .. "/gen/typemap_" .. prj.name}',
')'
}, ' '),
table.concat({
- 'if not exist %{path.getabsolute(cfg.linktarget.directory .. "/gen/typemap_" .. prj.name)} (',
+ 'if not exist %{path.getabsolute(cfg.buildtarget.directory .. "/gen/typemap_" .. prj.name)} (',
'python',
'"' .. prj_root .. '/../vendor/chromium/mojo/public/tools/bindings/generate_type_mappings.py"',
'%{gen_typemap_args(file.abspath)}',
'--output',
- '%{cfg.linktarget.directory .. "/gen/typemap_" .. prj.name}',
+ '%{cfg.buildtarget.directory .. "/gen/typemap_" .. prj.name}',
')'
}, ' '),
}
- buildoutputs { '%{cfg.linktarget.directory .. "/gen/typemap_" .. prj.name}' }
+ buildoutputs { '%{cfg.buildtarget.directory .. "/gen/typemap_" .. prj.name}' }
filter 'files:**.mojom'
@@ -76,7 +76,7 @@ function files(x)
'"' .. prj_root .. '/../vendor/chromium/mojo/public/tools/bindings/mojom_bindings_generator.py"',
'parse',
'-o',
- '%{path.getrelative(".", cfg.linktarget.directory .. "/gen/")}',
+ '%{path.getrelative(".", cfg.buildtarget.directory .. "/gen/")}',
'--enable_feature',
'file_path_is_string16',
'-d',
@@ -85,7 +85,7 @@ function files(x)
}, ' '),
}
- buildoutputs { '%{cfg.linktarget.directory .. "/gen/" .. path.getrelative("' .. prj_root .. '/../", file.abspath):gsub(".mojom$", "")}.p' }
+ buildoutputs { '%{cfg.buildtarget.directory .. "/gen/" .. path.getrelative("' .. prj_root .. '/../", file.abspath):gsub(".mojom$", "")}.p' }
filter 'files:**.p'
@@ -97,19 +97,19 @@ function files(x)
'-g',
'c++',
'--bytecode_path',
- '%{path.getrelative(".", cfg.linktarget.directory .. "/gen/")}',
+ '%{path.getrelative(".", cfg.buildtarget.directory .. "/gen/")}',
'--gen_dir',
- '%{path.getrelative(".", cfg.linktarget.directory .. "/gen/")}',
+ '%{path.getrelative(".", cfg.buildtarget.directory .. "/gen/")}',
'-d',
'%{path.getrelative(".", "' .. prj_root .. '/../")}',
'--typemap',
- '%{cfg.linktarget.directory .. "/gen/typemap_" .. prj.name}',
+ '%{cfg.buildtarget.directory .. "/gen/typemap_" .. prj.name}',
'-o',
- '%{path.getrelative(".", cfg.linktarget.directory .. "/gen/")}',
+ '%{path.getrelative(".", cfg.buildtarget.directory .. "/gen/")}',
arg or '',
'%{process_includedirs_mojo(prj.location, prj.includedirs):remove_null()}',
-- path reorder hell! we want to change from bin/five/debug/gen/* to ../../../*
- '%{(file and (path.getrelative(prj.location, path.getabsolute(path.getrelative(cfg.linktarget.directory .. "/gen/", file.abspath:gsub(".p$", ".mojom")), "' .. prj_root .. '/../"))) or ""):remove_null()}'
+ '%{(file and (path.getrelative(prj.location, path.getabsolute(path.getrelative(cfg.buildtarget.directory .. "/gen/", file.abspath:gsub(".p$", ".mojom")), "' .. prj_root .. '/../"))) or ""):remove_null()}'
}, ' ')
end
@@ -120,7 +120,7 @@ function files(x)
gen_cmd('--generate_non_variant_code --generate_message_ids')
}
- buildinputs { '%{cfg.linktarget.directory .. "/gen/typemap_" .. prj.name}' }
+ buildinputs { '%{cfg.buildtarget.directory .. "/gen/typemap_" .. prj.name}' }
buildoutputs { '%{file.abspath:gsub(".p$", ".mojom")}.cc' }
@@ -131,9 +131,9 @@ function files(x)
if v:endswith('.mojom') then
old_files {
- '%{cfg.linktarget.directory .. "/gen/"}' .. path.getrelative(prj_root .. '/../', path.getabsolute('.', v)):gsub('.mojom$', '') .. '.p',
- '%{cfg.linktarget.directory .. "/gen/"}' .. path.getrelative(prj_root .. '/../', path.getabsolute('.', v)) .. '.cc',
- '%{cfg.linktarget.directory .. "/gen/"}' .. path.getrelative(prj_root .. '/../', path.getabsolute('.', v)) .. '-shared.cc'
+ '%{cfg.buildtarget.directory .. "/gen/"}' .. path.getrelative(prj_root .. '/../', path.getabsolute('.', v)):gsub('.mojom$', '') .. '.p',
+ '%{cfg.buildtarget.directory .. "/gen/"}' .. path.getrelative(prj_root .. '/../', path.getabsolute('.', v)) .. '.cc',
+ '%{cfg.buildtarget.directory .. "/gen/"}' .. path.getrelative(prj_root .. '/../', path.getabsolute('.', v)) .. '-shared.cc'
}
end
end
@@ -157,13 +157,13 @@ return {
links { 'ws2_32', 'userenv', 'delayimp' }
prebuildcommands {
- '{MKDIR} %{path.getrelative(".", cfg.linktarget.directory .. "/gen/")}',
+ '{MKDIR} %{path.getrelative(".", cfg.buildtarget.directory .. "/gen/")}',
table.concat({
'python',
'"' .. prj_root .. '/../vendor/chromium/mojo/public/tools/bindings/mojom_bindings_generator.py"',
'precompile',
'-o',
- '%{path.getrelative(".", cfg.linktarget.directory .. "/gen/")}',
+ '%{path.getrelative(".", cfg.buildtarget.directory .. "/gen/")}',
}, ' '),
}
diff --git a/data/README.md b/data/README.md
new file mode 100644
index 0000000000..333536ed33
--- /dev/null
+++ b/data/README.md
@@ -0,0 +1,14 @@
+# CitizenFX Runtime Data
+
+This directory contains data which will be copied to the project layout directory on build, and is required at runtime.
+
+## data/
+* [**client/**](./client/): Shared data for all game clients, and full data for FiveM.
+* [**client_rdr/**](./client_rdr/): Specific runtime data for RedM.
+* [**launcher/**](./launcher/): Specific runtime data for the Cfx.re Compositing Launcher.
+* [**server/**](./server/): Shared runtime data for FXServer.
+* [**server_linux/**](./server_linux/): Shared runtime data for FXServer on Linux.
+* [**server_proot/**](./server_proot/): Runtime data for the Alpine root build of FXServer on Linux.
+* [**server_windows/**](./server_windows/): Runtime data for FXServer on Windows.
+* [**shared/**](./shared/): Shared runtime data for all builds. Also includes canonical ScRT high-level source code for
+ Lua/JS runtimes.
\ No newline at end of file
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 0000000000..81f5c3410b
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1,6 @@
+# Cfx.re Developer Documentation
+
+This directory contains developer documentation for the Cfx.re projects.
+
+* [Building Cfx.re Native codebase](./building.md)
+* [Source code layout](./layout.md)
\ No newline at end of file
diff --git a/docs/building.md b/docs/building.md
index 3e98ff50b0..b675c552cd 100644
--- a/docs/building.md
+++ b/docs/building.md
@@ -1,8 +1,8 @@
-# Building FiveM
+# Building Cfx.re
## Generate solution
-To build FiveM or RedM you need the following dependencies:
+To build FiveM, RedM or FXServer on Windows you need the following dependencies:
* A Windows machine with Visual Studio 2019 (Build Tools/Community is fine) installed with the following workloads:
- .NET desktop environment
@@ -25,7 +25,6 @@ git clone https://github.com/citizenfx/fivem.git
cd fivem
git submodule init
git submodule update --recursive
-prebuild
cd code
:: or --game=server/--game=rdr3
@@ -36,25 +35,7 @@ cd code
### Set up data files for `five`
-After building the FiveM client, you should create the following files in the `/code/bin/five/debug` directory:
-
-- `FiveM.exe.formaldev`
-- `nobootstrap.txt`
-
-If you don't do this, FiveM will auto-update using the official binaries.
-
-**CEF**
-
-1. Create `cef` folder inside `/code/bin/five/debug/bin`. This is our "CEF directory".
-2. Copy `*.pak` files from `/vendor/cef/Resources` into our CEF directory.
-3. Copy `/vendor/cef/Resources/locales/en-US.pak` into our CEF directory. (Don't create a nested `locales` directory.)
-5. Copy `/vendor/cef/Resources/icudtl.dat` to `/code/bin/five/debug/bin/icudtl.dat`
-6. Copy `.dll` and `.bin` that are _directly inside_ `/vendor/cef/Release` to `/code/bin/five/debug/bin`.
-
-**Additional data files**
-
-1. Copy contents of `/data/shared` into `/code/bin/five/debug`.
-2. Copy contents of `/data/client` into `/code/bin/five/debug`.
+After building the FiveM client, you should be having files such as `/code/bin/five/debug/v8.dll` exist automatically. Manual copying is no longer required.
**Symlink `cache` directory** (optional)
@@ -74,7 +55,7 @@ If you don't know how to do that, here's how:
This directory is probably missing: `/code/bin/five/debug/citizen/ui`.
- We still need to add instructions on how to build the UI (`/ext/ui-build`), so for now, just copy this directory `%LocalAppData%/FiveM/FiveM.app/citizen/ui` from your main installation of FiveM.
+ UI building might have failed, but you can copy this directory `%LocalAppData%/FiveM/FiveM.app/citizen/ui` from your main installation of FiveM.
- Windows error code 126, or some issues with other DLLs.
It's possible that you accidentally missed a step or skipped a file that should have been copied. Start this section over from scratch; do not pass go, do not collect £200.
diff --git a/docs/layout.md b/docs/layout.md
new file mode 100644
index 0000000000..ca97defb5d
--- /dev/null
+++ b/docs/layout.md
@@ -0,0 +1,12 @@
+# Source code layout for Cfx.re/CitizenFX
+
+The CitizenFX codebase is a vast set of multiple components, many of which having nested README.md files explaining
+their purpose further in the codebase.
+
+This document is a general guideline towards these directories.
+
+## Root
+* [**code/**](../code/): Core native project code, and the root of the native build.
+* [**data/**](../data/): Runtime data for the projects to use.
+* [**ext/**](../ext/): Extra supporting projects, generally either standalone or otherwise only depending on files/data in `ext`/ itself.
+* [**vendor/**](../vendor/): Submodules for project dependencies.
\ No newline at end of file
diff --git a/ext/README.md b/ext/README.md
new file mode 100644
index 0000000000..369d2cef04
--- /dev/null
+++ b/ext/README.md
@@ -0,0 +1,20 @@
+# CitizenFX External Projects
+
+This directory contains external projects which are _generally_ part of the core build in some way, but not considered
+part of the main project.
+
+## ext/
+* [**cfx-ui/**](./cfx-ui): The main menu interface for the game clients.
+* [**event-doc-gen/**](./event-doc-gen): Generation tooling for _event_ documentation.
+* [**monitor/**](./monitor): A legacy version of a built-in server monitor. See `system-resources/`.
+* [**native-decls/**](./native-decls): Native function declarations for `CFX/` natives defined in the main project.
+* [**native-doc-gen/**](./native-doc-gen): Scripts to generate `native-decls` using the `native-doc-tooling` submodule.
+* [**native-doc-tooling/**](./native-doc-tooling): A submodule for the latest version of `native-doc-tooling`, which is used to generate native definitions from the documentation in `native-decls`.
+* [**natives/**](./natives): Code generation tooling to convert a native function database in 'intermediate' Lua format to runnable Lua/JS/C# and other intermediate formats.
+* [**nuget/**](./nuget): Build files for the `CitizenFX.Core.Client` and `CitizenFX.Core.Server` NuGet packages.
+* [**symbol-upload/**](./symbol-upload): A tool to collect Linux build symbols to upload to a .NET Core-style symbol server.
+* [**system-resources/**](./system-resources): System resources bundled with FXServer by default.
+* [**txAdmin/**](./txAdmin): A local snapshot of [txAdmin](https://github.com/tabarra/txAdmin), the official server monitor/management dashboard.
+* [**typings/**](./typings): Build files for the `@citizenfx/client` and `@citizenfx/server` NPM packages.
+* [**ui-build/**](./ui-build): Scripts and data files for building `citizen/ui.zip` including root helpers, legacy UI scripts and a packed version of `cfx-ui`.
+* [**webadmin/**](./webadmin): In-process web dashboard system resource.
\ No newline at end of file
diff --git a/ext/cfx-ui/README.md b/ext/cfx-ui/README.md
index b846e4bf01..5c6ec6bc90 100644
--- a/ext/cfx-ui/README.md
+++ b/ext/cfx-ui/README.md
@@ -1,28 +1,16 @@
-# CfxUi
+# cfx-ui
-This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.0.0.
+`cfx-ui` is an Angular application containing the main menu for the Cfx.re game clients, as well as the web server lists
+on `servers.fivem.net` and `servers.redm.gg`.
-## Development server
+## Building
+See [ui-build](../ui-build/) for building a full version of `cfx-ui`.
-Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
+## Developing (game)
+```
+yarn
+node_modules\.bin\ng serve -c game --host %COMPUTERNAME%
+```
-## Code scaffolding
-
-Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class/module`.
-
-## Build
-
-Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
-
-## Running unit tests
-
-Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
-
-## Running end-to-end tests
-
-Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
-Before running the tests make sure you are serving the app via `ng serve`.
-
-## Further help
-
-To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
+Then run FiveM/RedM with `+set ui_url http://COMPUTERNAME:4200/`, where `COMPUTERNAME` is your local computer name.
+Due to NUI policy, `localhost` is not supported.
\ No newline at end of file
diff --git a/ext/event-doc-gen/README.md b/ext/event-doc-gen/README.md
new file mode 100644
index 0000000000..87b1edb2e5
--- /dev/null
+++ b/ext/event-doc-gen/README.md
@@ -0,0 +1,42 @@
+# `event-doc-gen`
+
+Generates event documentation using TypeDoc from embedded TypeScript definitions in project source code.
+
+Still a work in progress.
+
+## Documentation format
+
+### Example
+```cpp
+ /*NETEV playerEnteredScope SERVER
+ /#*
+ * A server-side event that is triggered when a player enters another player's scope.
+ *
+ * @param data - Data containing the players entering each other's scope.
+ #/
+ declare function playerEnteredScope(data: {
+ /#*
+ * The player that is entering the scope.
+ #/
+ player: string,
+
+ /#*
+ * The player for which the scope is being entered.
+ #/
+ for: string
+ }): void;
+ */
+```
+
+### Explanation
+
+* **Start marker**: `/* NETEV [subset]`
+* Followed by a TypeScript specification with TSDoc annotations.
+* `/*` and `*/` in TypeScript are replaced with `/#` and `#/` to not conflict with the C++ comment marker.
+
+## Building
+```
+node index.js ../../code/
+```
+
+This'll generate an `out/` directory containing client and server event documentation.
\ No newline at end of file
diff --git a/ext/natives/README.md b/ext/natives/README.md
new file mode 100644
index 0000000000..29c6a6ec7e
--- /dev/null
+++ b/ext/natives/README.md
@@ -0,0 +1,55 @@
+# Native codegen
+A suite of Lua tools to transform native function declarations into actual code.
+
+## Invoking
+* `make` on Windows (use MSYS2 Make).
+* Manual command invocation on Linux (see Linux build script)
+
+## Manually invoking
+```
+lua53 codegen.lua [subset]
+```
+
+* **stashfile**: An input file.
+* **outtype**: See the section below.
+* **subset**: Usually `server` or not specified.
+
+## Input format
+The input format is defined most clearly in `native-doc-tooling`'s `views/lua.twig`, and should not be manually written
+by users.
+
+### Example
+```lua
+native "GET_PLAYER_PED"
+ hash "0x43A66C31C68491C0"
+ jhash (0x6E31E993)
+ arguments {
+ Player "playerId",
+ }
+ ns "PLAYER"
+ returns "Ped"
+ doc [[!
+
+ returns the players ped used in many functions
+
+ ]]
+```
+
+## Output types
+* `cs`: C# `API` class for Natives*.cs.
+* `dts`: .d.ts file.
+* `enum`: C# `Hash` enum content.
+* `js`: .js file.
+* `json`: NativeDB `natives.json`-style file
+* `lua`: Singular monolithic .lua wrappers.
+* `markdown`: `native-doc-tooling`-style Markdown files.
+* `native_lua`: C++ Lua wrappers. Currently unused.
+* `rpc`: Runtime file for RPC natives.
+* `slua`: Split lazy-loaded .lua files to save Lua state memory. Usually packed as .zip.
+
+## RPC natives
+`rpc_spec_natives.lua` contains a number of natives to expose to server builds as well as client RPC definitions for use
+with OneSync.
+
+## Types
+See `codegen_types.lua`.
\ No newline at end of file
diff --git a/ext/nuget/README.md b/ext/nuget/README.md
new file mode 100644
index 0000000000..4d07d02082
--- /dev/null
+++ b/ext/nuget/README.md
@@ -0,0 +1,2 @@
+# `nuget`
+Don't use directly, this is taken in by build scripts.
\ No newline at end of file
diff --git a/ext/symbol-upload/README.md b/ext/symbol-upload/README.md
new file mode 100644
index 0000000000..0d8b829b25
--- /dev/null
+++ b/ext/symbol-upload/README.md
@@ -0,0 +1,4 @@
+# `symbol-upload`
+
+A .NET Core project to gather stripped debug symbols from the Linux server build. See the Linux build script for more
+information.
\ No newline at end of file
diff --git a/ext/system-resources/README.md b/ext/system-resources/README.md
new file mode 100644
index 0000000000..5652a7382c
--- /dev/null
+++ b/ext/system-resources/README.md
@@ -0,0 +1,3 @@
+# `system-resources`
+
+Build scripts for bundled system resources.
\ No newline at end of file
diff --git a/ext/typings/README.md b/ext/typings/README.md
new file mode 100644
index 0000000000..a0bf4d2997
--- /dev/null
+++ b/ext/typings/README.md
@@ -0,0 +1,2 @@
+# `typings`
+Don't use directly, this is taken in by build scripts.
\ No newline at end of file
diff --git a/ext/ui-build/README.md b/ext/ui-build/README.md
new file mode 100644
index 0000000000..79e1095bff
--- /dev/null
+++ b/ext/ui-build/README.md
@@ -0,0 +1,4 @@
+# `ui-build`
+Run `build.cmd` to generate a production build of `ui.zip` and `ui-big.zip` as `data.zip` and `data_big.zip`.
+
+This should automatically be done by either the CI build script or the VS project file.
\ No newline at end of file