diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
new file mode 100644
index 0000000..a16511d
--- /dev/null
+++ b/.github/CONTRIBUTING.md
@@ -0,0 +1 @@
+## TODO
\ No newline at end of file
diff --git a/.github/ISSUE_TEMPLATE/BUG-REPORT.yml b/.github/ISSUE_TEMPLATE/BUG-REPORT.yml
new file mode 100644
index 0000000..9a6b3cc
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/BUG-REPORT.yml
@@ -0,0 +1,37 @@
+name: "Bug Report"
+description: Create a new ticket for a bug.
+title: "Bug -
"
+labels: [
+ "bug"
+]
+body:
+ - type: checkboxes
+ attributes:
+ label: Chaos Mod Components
+ description: What parts of ChaosMod were you using at the time of the bug?
+ options:
+ - label: This effect is related to a "Chaos Effect"
+ - label: This effect is related to the randomizer/patch notes
+ - label: This effect only occurs during a mission
+ - label: I can reliably reproduce this bug
+ - type: textarea
+ id: description
+ attributes:
+ label: "Description"
+ description: Please enter an explicit description of your issue
+ placeholder: Short and explicit description of your issue.
+ validations:
+ required: true
+ - type: textarea
+ id: reprod
+ attributes:
+ label: "Reproduction steps"
+ description: If possible explain how to reproduce this issue
+ value: |
+ 1. Go to '...'
+ 2. Click on '....'
+ 3. Scroll down to '....'
+ 4. See error
+ render: bash
+ validations:
+ required: false
\ No newline at end of file
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 0000000..ec4bb38
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1 @@
+blank_issues_enabled: false
\ No newline at end of file
diff --git a/.github/workflows/build-installer.yml b/.github/workflows/build-installer.yml
new file mode 100644
index 0000000..f28f70c
--- /dev/null
+++ b/.github/workflows/build-installer.yml
@@ -0,0 +1,105 @@
+name: Build Installer
+on:
+ push:
+ branches: [ master ]
+
+jobs:
+ build:
+ env:
+ VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
+ runs-on: windows-latest
+ steps:
+ - name: Export GitHub Actions cache environment variables
+ uses: actions/github-script@v6
+ with:
+ script: |
+ core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
+ core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
+ - uses: actions/checkout@v4
+ with:
+ submodules: 'recursive'
+
+ - name: Set Work ENVs
+ id: vars
+ run: |
+ echo "::set-output name=date::$(date +'%Y-%m-%d-%H-%M')"
+ WIN_HOME=$(echo $HOME | tr '/' '\\')
+ WIN_HOME="${WIN_HOME:1:1}:${WIN_HOME:2:${#WIN_HOME}-1}"
+ WIN_HOME=${WIN_HOME^}
+ echo $WIN_HOME
+ echo DX9_SDK=$WIN_HOME/dx9
+ echo "DX9_SDK=$WIN_HOME/dx9" >> $GITHUB_ENV
+ shell: bash
+
+ - run: vcpkg integrate install
+
+ - uses: ilammy/msvc-dev-cmd@v1.10.0
+ with:
+ arch: x86
+
+ - name: "Install Inno"
+ run: choco install innosetup --acceptlicense
+
+ - name: "Restore DX9 Cache"
+ id: dx9-cache
+ uses: actions/cache@v4
+ with:
+ path: ~/dx9
+ key: dx9-cache
+
+ - name: "Restore HD Installer"
+ id: hde-cache
+ uses: actions/cache@v4
+ with:
+ path: ${{ github.workspace }}/Installer/Assets/External
+ key: hde-cache
+
+ - name: "Cache DX9 SDK"
+ if: steps.dx9-cache.outputs.cache-hit != 'true'
+ run: |
+ echo Downloading DXSDK June 2010
+ curl -s -L -o "_DX2010_.exe" "https://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe"
+ echo Extracting include files
+ 7z x _DX2010_.exe DXSDK/Include -o_DX2010_ > nul
+ echo Extracting lib files
+ 7z x _DX2010_.exe DXSDK/Lib/x86 -o_DX2010_ > nul
+ echo Moving SDK to home directory
+ mkdir $DX9_SDK
+ mv _DX2010_/DXSDK/* $DX9_SDK
+ echo Cleaning up install files
+ rm -fR _DX*_ _DX*_.exe
+ shell: bash
+
+ - name: "Download HDE Installer"
+ if: steps.hde-cache.outputs.cache-hit != 'true'
+ run:
+ curl -s -o ${{ github.workspace }}/Installer/Assets/External/FreelancerHDESetup_v06_silent_test.exe https://f003.backblazeb2.com/b2api/v2/b2_download_file_by_id?fileId=4_z0d41f4d9e10a9adf85d20013_f212668fac620798a_d20240305_m125353_c003_v0312019_t0022_u01709643233941
+
+ - name: Compile ChaosMod
+ run: msbuild.exe "${env:GITHUB_WORKSPACE}\FreelancerChaosMod.sln" /t:Build /p:Configuration=Release /p:Platform=x86
+
+ - name: "Pre-Build Installer"
+ run: |
+ cd ${{ github.workspace }}
+ mkdir Archive
+ Get-ChildItem -Path ".\Assets" | Move-Item -Destination ".\Archive"
+ Get-ChildItem -Path ".\Release" -Filter ".dll" -Recurse | Move-Item -Destination ".\Archive\EXE"
+ 7z a -r ./chaosmod.7z ./Archive/*
+ Copy-Item -Path .\chaosmod.7z -Destination ./Installer/Assets/Mod
+
+ - name: "Build Installer"
+ run: |
+ cd ${{ github.workspace }}/Installer
+ & "${env:programfiles(x86)}\Inno Setup 6\iscc.exe" /O+ ".\setup.iss"
+ cd ..
+ 7z a -r .\Installer.7z .\Installer/Output*
+ Rename-Item -Path .\chaosmod.7z -NewName Assets.7z
+
+ - name: Create Release
+ id: create_release
+ uses: ncipollo/release-action@v1
+ with:
+ artifacts: "${{ github.workspace }}/*.7z"
+ body: "Automatically generated"
+ tag: ${{ steps.vars.outputs.date }}
+
\ No newline at end of file
diff --git a/Assets/EXE/avcodec-59.dll b/Assets/EXE/avcodec-59.dll
deleted file mode 100644
index 677a06b..0000000
Binary files a/Assets/EXE/avcodec-59.dll and /dev/null differ
diff --git a/Assets/EXE/avformat-59.dll b/Assets/EXE/avformat-59.dll
deleted file mode 100644
index b00d398..0000000
Binary files a/Assets/EXE/avformat-59.dll and /dev/null differ
diff --git a/Assets/EXE/avutil-57.dll b/Assets/EXE/avutil-57.dll
deleted file mode 100644
index 8271b9a..0000000
Binary files a/Assets/EXE/avutil-57.dll and /dev/null differ
diff --git a/Assets/EXE/swresample-4.dll b/Assets/EXE/swresample-4.dll
deleted file mode 100644
index 6d3bf23..0000000
Binary files a/Assets/EXE/swresample-4.dll and /dev/null differ
diff --git a/Assets/EXE/swscale-6.dll b/Assets/EXE/swscale-6.dll
deleted file mode 100644
index 47b0e19..0000000
Binary files a/Assets/EXE/swscale-6.dll and /dev/null differ
diff --git a/ChaosMod/ChaosMod.vcxproj b/ChaosMod/ChaosMod.vcxproj
index a7cb316..6eb0a94 100644
--- a/ChaosMod/ChaosMod.vcxproj
+++ b/ChaosMod/ChaosMod.vcxproj
@@ -73,14 +73,14 @@
true
$(ProjectName)
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)vendor\flhook-sdk\vendor;$(SolutionDir)vendor\flhook-sdk\include;$(SolutionDir)vendor;C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include;$(ProjectDir);$(SolutionDir)Include
- $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(SolutionDir)vendor\flhook-sdk\lib;$(SolutionDir)vcpkg_installed\x86-windows\x86-windows\lib;C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)vendor\flhook-sdk\vendor;$(SolutionDir)vendor\flhook-sdk\include;$(SolutionDir)vendor;$(DX9_SDK)\Include;$(ProjectDir);$(SolutionDir)Include
+ $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(SolutionDir)vendor\flhook-sdk\lib;$(SolutionDir)vcpkg_installed\x86-windows\x86-windows\lib;$(DX9_SDK)\Lib\x86
false
$(ProjectName)
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)vendor\flhook-sdk\vendor;$(SolutionDir)vendor\flhook-sdk\include;$(SolutionDir)vendor;C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include;$(ProjectDir);$(SolutionDir)Include
- $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(SolutionDir)vendor\flhook-sdk\lib;$(SolutionDir)vcpkg_installed\x86-windows\x86-windows\lib;C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)vendor\flhook-sdk\vendor;$(SolutionDir)vendor\flhook-sdk\include;$(SolutionDir)vendor;$(DX9_SDK)\Include;$(ProjectDir);$(SolutionDir)Include
+ $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(SolutionDir)vendor\flhook-sdk\lib;$(SolutionDir)vcpkg_installed\x86-windows\x86-windows\lib;$(DX9_SDK)\Lib\x86
true
@@ -145,10 +145,10 @@
true
-
- copy /Y "$(TargetDir)*.dll" "$(FL_CHAOS_MOD)"
- powershell -ExecutionPolicy Bypass -File $(SolutionDir)CopyChaosAssets.ps1
-
+ if defined FL_CHAOS_MOD (
+ copy /Y "$(TargetDir)*.dll" "$(FL_CHAOS_MOD)"
+ powershell -ExecutionPolicy Bypass -File $(SolutionDir)CopyChaosAssets.ps1 -NoLaunch true -NoXml true
+)
diff --git a/ChaosMod/PCH.cpp b/ChaosMod/PCH.cpp
index 565f41c..8d5098e 100644
--- a/ChaosMod/PCH.cpp
+++ b/ChaosMod/PCH.cpp
@@ -13,6 +13,7 @@ void Log(const std::string& log)
auto now = std::chrono::system_clock::now();
file << std::format("{0:%F_%T}: ", now) << log << std::endl;
}
+
void Assert(const bool cond, const std::string& text, const std::string& file, const int line)
{
if (!cond)
diff --git a/ChaosMod/PCH.hpp b/ChaosMod/PCH.hpp
index c7bac4e..7a886a6 100644
--- a/ChaosMod/PCH.hpp
+++ b/ChaosMod/PCH.hpp
@@ -63,7 +63,12 @@ enum class Language
std::string GetInfocardName(uint ids);
void SetLanguage(Language lang);
-#define ASSERT(cond, text) Assert(cond, text, __FILE__, __LINE__)
+// ReSharper disable twice CppInconsistentNaming
+#ifdef DEBUG
+ #define ASSERT(cond, text) Assert(cond, text, __FILE__, __LINE__)
+#else
+ #define ASSERT
+#endif
struct Weight : refl::attr::usage::field
{
diff --git a/ChaosMod/main.cpp b/ChaosMod/main.cpp
index 5d730c3..20e6fd8 100644
--- a/ChaosMod/main.cpp
+++ b/ChaosMod/main.cpp
@@ -22,8 +22,8 @@
#include
#include
-const st6_malloc_t st6_malloc = reinterpret_cast(GetProcAddress(GetModuleHandleA("msvcrt.dll"), "malloc"));
-const st6_free_t st6_free = reinterpret_cast(GetProcAddress(GetModuleHandleA("msvcrt.dll"), "free"));
+const st6_malloc_t st6_malloc = reinterpret_cast(GetProcAddress(GetModuleHandleA("msvcrt.dll"), "malloc")); // NOLINT
+const st6_free_t st6_free = reinterpret_cast(GetProcAddress(GetModuleHandleA("msvcrt.dll"), "free")); // NOLINT
typedef void*(__cdecl* ScriptLoadPtr)(const char*);
typedef void (*GlobalTimeFunc)(double delta);
@@ -70,11 +70,11 @@ uint CreateIdDetour(const char* string)
#ifdef _DEBUG
if (!hashFile)
{
- fopen_s(&hashFile, "hashmap.csv", "wb");
+ (void)fopen_s(&hashFile, "hashmap.csv", "wb");
}
- fprintf_s(hashFile, "%s,%u,0x%X\n", string, hash, hash);
- fflush(hashFile);
+ (void)fprintf_s(hashFile, "%s,%u,0x%X\n", string, hash, hash);
+ (void)fflush(hashFile);
#endif
}
@@ -175,17 +175,17 @@ void PatchResolution()
// Disable the reading of the znear/zfar/fovy parameters.
{
BYTE patch1[] = { 0x00 };
- MemUtils::WriteProcMem((char*)0x5C8994, &patch1, 1);
- MemUtils::WriteProcMem((char*)0x5C899C, &patch1, 1);
- MemUtils::WriteProcMem((char*)0x5C89A4, &patch1, 1);
+ MemUtils::WriteProcMem(0x5C8994, &patch1, 1);
+ MemUtils::WriteProcMem(0x5C899C, &patch1, 1);
+ MemUtils::WriteProcMem(0x5C89A4, &patch1, 1);
}
// Force the fovx to predefined values.
{
BYTE patch6[] = { 0x90, 0xE9 };
- MemUtils::WriteProcMem((char*)0x40f617, &patch6, 2);
- PBYTE fpFovx = (PBYTE)HkCb_Fovx_Naked - 0x40f618 - 5;
- MemUtils::WriteProcMem((char*)0x40f618 + 1, &fpFovx, 4);
+ MemUtils::WriteProcMem(0x40f617, &patch6, 2);
+ PBYTE fovX = reinterpret_cast(HkCb_Fovx_Naked) - 0x40f618 - 5;
+ MemUtils::WriteProcMem(0x40f618 + 1, &fovX, 4);
}
// Set the FOV for the UI elements on the main screen.
@@ -521,10 +521,10 @@ void SetupHack()
// Setup hooks
const HMODULE common = GetModuleHandleA("common");
- timingDetour =
- std::make_unique>(reinterpret_cast(GetProcAddress(common, "?UpdateGlobalTime@Timing@@YAXN@Z")));
- thornLoadDetour =
- std::make_unique>(reinterpret_cast(GetProcAddress(common, "?ThornScriptLoad@@YAPAUIScriptEngine@@PBD@Z")));
+ timingDetour = std::make_unique>(
+ reinterpret_cast(GetProcAddress(common, "?UpdateGlobalTime@Timing@@YAXN@Z"))); // NOLINT
+ thornLoadDetour = std::make_unique>(
+ reinterpret_cast(GetProcAddress(common, "?ThornScriptLoad@@YAPAUIScriptEngine@@PBD@Z"))); // NOLINT
timingDetour->Detour(Update);
thornLoadDetour->Detour(ScriptLoadHook);
diff --git a/Installer/Assets/External/7za.exe b/Installer/Assets/External/7za.exe
new file mode 100644
index 0000000..2bdd57d
Binary files /dev/null and b/Installer/Assets/External/7za.exe differ
diff --git a/Installer/Assets/External/HexToBinary.dll b/Installer/Assets/External/HexToBinary.dll
new file mode 100644
index 0000000..8d373cb
Binary files /dev/null and b/Installer/Assets/External/HexToBinary.dll differ
diff --git a/Installer/Assets/External/utf-8-bom-remover.exe b/Installer/Assets/External/utf-8-bom-remover.exe
new file mode 100644
index 0000000..8b08453
Binary files /dev/null and b/Installer/Assets/External/utf-8-bom-remover.exe differ
diff --git a/README.md b/README.md
index 391c686..87333b7 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,9 @@
## TODO Readme
+## Contributing
+
+See [contributing guidelines]("./.github/CONTRIBUTING.md) for more information.
+
## Credits
### Direct