Skip to content

Commit

Permalink
Merge branch 'master' into TableFunctions
Browse files Browse the repository at this point in the history
  • Loading branch information
4z0t authored Nov 14, 2024
2 parents fe07019 + 276d0fc commit c6ae0b2
Show file tree
Hide file tree
Showing 55 changed files with 3,897 additions and 3,764 deletions.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/1-contribution-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Contribution template
description: Template for an extensive description, to enable other contributors to discuss about and implement a feature to improve the FAForever experience of our players.
labels: ["status: novel issue"]

body:
- type: textarea
id: description
attributes:
label: Description
- type: textarea
id: action
attributes:
label: Course of Action
- type: textarea
id: test
attributes:
label: Test Plan
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
contact_links:
- name: FAForever Discord Server
url: https://discord.gg/GEseYDXVRA
about: Discuss the game, report bugs, and get help with modding and development!
- name: FAForever Forums
url: https://forum.faforever.com/
about: Discuss the game and learn about the latest tournaments or news in the community!
- name: Looking for contributors
url: https://discord.gg/Rnpv8RwhdU
about: There's so much to do - we're always looking for contributors to help out with the project!
- name: Repository with binary patcher
url: https://github.com/FAForever/fa-python-binary-patcher
about: This Python-based patcher is used to apply the binary patches to the game executable.

3 changes: 2 additions & 1 deletion .github/workflows/release-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ on:

jobs:
release:
environment: deploy
runs-on: windows-latest
permissions:
contents: write
Expand Down Expand Up @@ -67,7 +68,7 @@ jobs:
# This is the practical test - if it patches, then we're good
- name: Patch base executable
run: |
echo "#define gitsha \"${{ github.sha }}\"" > workflow.cpp
echo '#define gitsha "${{ github.sha }}"' > workflow.cpp
mkdir build
python ./fa-python-binary-patcher/main.py "$(pwd)" clang++ ld g++
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ jobs:
# This is the practical test - if it patches, then we're good
- name: Patch base executable
run: |
echo "#define gitsha \"${{ github.sha }}\"" > workflow.cpp
echo '#define gitsha "${{ github.sha }}"' > workflow.cpp
mkdir build
python ./fa-python-binary-patcher/main.py "$(pwd)" clang++ ld g++
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ section.cpp
*.til
*.nam

.vscode
.vscode

section.ld
section/main.cpp
section/main.cxx
237 changes: 19 additions & 218 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,230 +1,31 @@
# FA Engine Patches Repository
# Binary engine patches

This are some binary patches for Supreme Commander Forged Alliance.
This repository contains documentation about the executable and various binary patches written in assembly and/or C++.

To apply the patches you can use the upload action or do it local via the [patcher](https://github.com/FAForever/FA_Patcher)
## Changelog

# Change List
You can learn more about the changes in the [changelog](./changelog.md). All notable changes to this project will be documented there.

## Signature patches
- See `SigPatches.txt`
## Piracy concerns

## Technical patches
These don't matter except for other assembly patches
Due to piracy concerns we can at no point upload the executable as an artifact. We do not want the lua-compatible executable available to the public without verification that they own the game. The compatible executable is distributed via the [Official client](https://github.com/FAForever/downlords-faf-client). Before a user can use such end points his or her account needs to be verified. An account can be verified by linking it to a [Steam](https://www.faforever.com/account/link) and/or [GOG](https://www.faforever.com/account/linkGog) account that owns a copy of Supreme Commander: Forged Alliance.

- Adds `lua_createtable`
- section/lua_createtable.cpp
- Adds registrators for Sim and UI Lua funcs.
- hooks/LuaFuncRegs.cpp
- section/LuaFuncRegs.cpp
## Related repositories

## Optimizations
- Optimize `VDist3` function
- hooks/VDist3.cpp
- section/VDist3.cpp
- Reduce call sim beat of UI
- hooks/HUIReduceCallSimBeat.cpp
- Zeroing GuardScanRadius if the unit's order is not Patrol/AttackMove. Increases performance.
- hooks/HGuardFix.cpp
- section/GuardFix.cpp
- Range ring performance improvement (reducing height cylinders)
- hooks/HRangeRings2.cpp
- section/RangeRings2.cpp
- Range ring performance improvement (don't render each ring twice)
- hooks/RangeRings.cpp
- section/RangeRings.cpp
- Camera performance improvements
- hooks/CameraPerf.cpp
- Optimised some AI actions
- hooks/aiinitattack.cpp
- Reduce overhead of population of Lua tables in C code. Affected functions:
* UI
* EntityCategoryFilterOut
* EntityCategoryFilterDown
* SelectUnits
* Sim
* EntityCategoryFilterDown
- hooks/TableInsertFix.cpp
- Remove result table in `SelectUnits`
- hooks/SelecUnitsTableFix.cpp
### Game and Campaign/ co-op content

## Bugs
- Remove lingering transport load factor calcuation at aircraft initialization
- hooks/RemoveTransportLoadFactor.cpp
- Fix `RolloverInfo` returning integer economy values.
- hooks/GetRolloverInfoFix.cpp
- Fix [problem described here](https://www.lua.org/bugs.html#5.0.2-5)
- hooks/weakgcmarkerFix.cpp
- Fix CUIWorldMesh:GetInterpolatedAlignedBox return table to properly store `ymax` and `zMax`
- hooks/FixGetInterpolatedAlignedBox.cpp
- Make `TestCommandCaps` test commands caps instead of toggle caps
- hooks/FixTestCommandCaps.cpp
- Reduce terrain collision distance-based offset to 1%;
- Prevent projectile layer changes on terrain collisions;
- Allows multiple collisions to be processed during collision checks.
- hooks/FixCollisions.cpp
- Fix `CMauiControl:SetAlpha`: don't change color part and check for 3rd argument as boolean.
- hooks/SetAlpha.cpp
- section/SetAlpha.cpp
- Fix `UserDecal:SetPosition` argument.
- hooks/DecalSetPositionFix.cpp
- Fix `ForkThread` function. Allow only lua function to be passed as first argument.
- hooks/ForkThreadFix.cpp
- section/ForkThreadFix.cpp
- Fix `Unit:SetStat` function, crashed before. Now returns true if value must be set.
- hooks/SetStatFix.cpp
- section/SetStatFix.cpp
- Upgrade Progress Fix
- hooks/HUpgradeProgressFix.cpp
- section/UpgradeProgressFix.cpp
- Prevents the crash with 'None' collisions of air. #3235
- hooks/AirNoneCollisionFix.cpp
- Prevents commander exploding for no reason. #3406
- hooks/NegativeIncomeFix.cpp
- Fix replays desyncing when a player leaves the game
- hooks/DesyncFix.cpp
- section/gpg_net.cpp
- section/moho_decode.cpp
- section/moho_input.cpp
- section/include/desync_fix_global.h
- Kill exception during map loading
- hooks/Kill_maploader_except.cpp
- Prevent blueprint editor being used without cheat mode
- hooks/FixOpenBPEditor.cpp
- Can't become an observer while your human allies are still alive
- hooks/ObserverFix.cpp
- Fix a crash when units arrive at waypoints
- hooks/WayPointArrive.cpp
- [FA Lua](https://github.com/FAForever/fa)
- [Campaign/co-op featured mod](https://github.com/FAForever/fa-coop)
- [Campaign/co-op maps](https://github.com/FAForever/faf-coop-maps)

## Improvements
- Allows to use 4GB on x64
- hooks/HFix4GB.cpp
- Make xact3d the error message print once
- hooks/xact_3dapply.cpp
- section/xact_3d_fix.cpp
- Improvements to lua messages
- hooks/LuaMessages.cpp
- Adds the ability to bind the side mouse buttons (XButton1 and XButton2)
- hooks/OnWindowMessage.cpp
- section/OnWindowMessage.cpp
### Lua plugin

## Gameplay
- Change tick intel update interval from every 30 ticks to every 1 tick
- hooks/IntelUpdate.cpp
- Removing CTRL formations
- hooks/HRemovingCTRLFormations.cpp
- Ignore empty reclaim orders
- hooks/HIgnoreEmptyReclaim.cpp
- Stops reclaim if unit is paused (similar to 'build', 'assist' etc.)
- hooks/StopReclaimWhenPaused.cpp
- section/StopReclaimWhenPaused.cpp
- section/selectionPriority.cpp
- Allows changing army of ACUs
- hooks/HTransferACUs.cpp
- Allow players to double-click to select Walls
- hooks/WallSelection.cpp
- Make `LOWSELECTPRIO` apply to units under construction
- hooks/selectionPriority.cpp
- Allow mass extractor template snapping
- hooks/BuildTemplateSnap.cpp
- section/BuildTemplateSnap.cpp
- Change how silos process their build progress (make it float instead of integer)
- hooks/SiloProgress.cpp
- section/SiloProgress.cpp
- [FA Lua intellisense extension](https://github.com/FAForever/fa-lua-vscode-extension)
- [FA Lua intellisense language server](https://github.com/FAForever/fa-lua-language-server)

## Lua
- Change `SUBCOMMANDER` category name to `SACU_BEHAVIOR` (FAF makes this transparent)
- hooks/CategoryRenames.cpp
- Stop the engine calling lua every time a plane turns
- hooks/OnMotionTurnEvent.cpp
### Assembly patches

## Additions
These new features have been added in a backwards compatible manner

- Enable unused console commands: ren_Steering, dbg_Ballistics, dbg_EfxBeams, dbg_Trail, dbg_CollisionBeam, dbg_Projectile
- hooks/EnableConsoleCommands.cpp
- Adds `GetHighlightCommand() - return table of command or nil` to UI (section/GetHighlightCommand.cpp)
- Adds new methods to the the `Projectile` class (section/ProjectileNewMethods.cpp):
- `Projectile:SetNewTargetGroundXYZ(x, y, z)`
- `x, y, z = Projectile:GetCurrentTargetPositionXYZ()`
- `frequency = Projectile:GetZigZagFrequency()`
- `maxzigzag = Projectile:GetMaxZigZag()`
- Adds Custom World Rendering (hooks: `HDraw.cpp`, `GetFPS.cpp`; section: `DrawFunc.cpp`, `DrawCircleSetColor.cpp`,`WorldView.cpp`)
- `UI_DrawRect(pos:vector, size:float, color:string, thickness?=0.15:float)`
- `UI_DrawCircle(pos:vector, radius:float, color:string, thickness?=0.15:float)`

Both functions must be called within `WorldView:OnRenderWorld(delta_time)`. To enable CWR call `WorldView:SetCustomRender(true)` of WorldView you want to draw in. To disable call `WorldView:SetCustomRender(false)` respectively.
- Adds Strategic icon scale support:
- hooks/IconScale.cpp
- section/IconScale.cpp
- Adds new method to `WorldView` (section/WorldView.cpp):
- `ProjectMultiple` projects multiple vectors at once
- Adds new methods for `UserUnit` (section/UserUnit.cpp):
- `GetInterpolatedPosition` returns position of a unit interpolated by current frame
- `GetFractionComplete` returns float from 0 to 1
- Adds method `MauiBitmap` (section/MauiBitmap.cpp):
- `SetColorMask`- sets color mask for bitmap
- Adds 5th argument for `IssueMobileBuild` as flag whether to pick all units for build order
- hooks/IssueMobileBuild.cpp
- section/IssueMobileBuild.cpp
- Adds GetProcessAffinityMask, SetProcessAffinityMask, SetProcessPriority to "init.lua"
- hooks/OnCreateInitLuaState.cpp
- section/OnCreateInitLuaState.cpp
- Adds the commandType, position, targetId and blueprintId to sim unit:GetCommandQueue
- hooks/SimGetCommandQueue.cpp
- section/SimGetCommandQueue.cpp
- Adds new category 'CANLANDONWATER' for air units to be able to land on water
- hooks/CanLandOnWater.cpp
- section/Categories.cpp
- Adds new category 'OBSTRUCTSBUILDING' for props to block buildings from being build on top of those
- hooks/Reclaimable.cpp
- section/Categories.cpp
- Allows customize colors for team color mode
- hooks/TeamColorMode.cpp
- section/TeamColorMode.cpp
- Adds the order ID to the UserUnit:GetCommandQueue output
- hooks/HOrderIDOutput.cpp
- section/OrderIDOutput.cpp
- GetSessionClients also output maximum sim speed(maxSP)
- hooks/HOutputMaxSP.cpp
- section/OutputMaxSP.cpp
- Console command: "cam_DefaultMiniLOD 0" now disable mesh renderer for minimap
- hooks/MinimapMesh.cpp
- section/MinimapMesh.cpp
- Adds GetTimeForProfile to Sim and UI. Allows to deal with the loss of accuracy
- section/GetTimeForProfile.cpp
- section/LuaFuncRegs.cpp
- Adds optimized table.getsize2(~25 times faster) and table.empty2
Adds getn2 as alias getn. Entry point to math functions queue
- hooks/GetTableSize.cpp
- section/LuaFuncRegs.cpp
- Maximum sim rate up to 50
- hooks/DelClampMaxSimRate.cpp
- Adds GetDepositsAroundPoint to Sim and UI
- section/SimGetDepositsAroundPoint.cpp
- section/LuaFuncRegs.cpp
- Adds SetInvertMidMouseButton to UI
- section/InvertMidMouseButton.cpp
- section/LuaFuncRegs.cpp
- Unlock an "Ultra" graphics preset
- hooks/UnlockUltraPreset.cpp
- Adds SetCommandSource to Sim. Allow armies to be shared by multiple players
- section/SimSetCommandSource.cpp
- section/LuaFuncRegs.cpp
- Adds GetMouseWorldPos to Sim
- section/SimGetMouseWorldPos.cpp
- section/LuaFuncRegs.cpp
- Adds SessionIsReplay to Sim
- section/SimIsReplay.cpp
- section/LuaFuncRegs.cpp
- Adds SetFocusArmy to Sim. Sets focus without restrictions
- section/SimSetFocusArmy.cpp
- section/LuaFuncRegs.cpp
- Allow upgrades to be queued on units under construction
- hooks/BuildUnit.cpp
- section/BuildUnit.cpp
- section/SelectUnit.cpp
- section/SimArmyCreate.cpp
- Add `Unit:ForceAltFootPrint` that forces game to use AltFootprint for the unit (applied to Salem in particular)
- hooks/EntityGetFootprint.cpp
- section/EntityGetFootprint.cpp
- [Executable patcher](https://github.com/FAForever/FA_Patcher)
- [Executable Python patcher](https://github.com/FAForever/fa-python-binary-patcher)
- [Executable patches](https://github.com/FAForever/FA-Binary-Patches)
- [Exception debugger](https://github.com/FAForever/FADeepProbe)
Loading

0 comments on commit c6ae0b2

Please sign in to comment.