Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
KionX committed Mar 26, 2022
0 parents commit e23e4ea
Show file tree
Hide file tree
Showing 52 changed files with 7,438 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: 'Release Version'
required: true

jobs:
build:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW32

- name: Install MinGW
run: |
pacman --noconfirm -S mingw-w64-i686-gcc
- uses: actions/checkout@v2

- name: Download Patcher
run: curl -L "https://github.com/FAForever/FA_Patcher/releases/latest/download/FaP.exe" -o FaP.exe

- name: Download Baseline
run: curl -L "https://content.faforever.com/build/ForgedAlliance_base.exe" -o ForgedAlliance_base.exe

- name: Patch Binary
run: ./FaP.exe

- name: Create Draft Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.inputs.version }}
release_name: v${{ github.event.inputs.version }}
draft: true
prerelease: true
243 changes: 243 additions & 0 deletions FALuaFuncs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
namespace gpg
{
class RRef {public: void* d; void* t;};
};

namespace LuaPlus
{
class __thiscall LuaObject
{// 0x14 bytes
public:
LuaObject* m_next;
LuaObject* m_prev;
LuaState* m_state;
lua_TObject m_object;

LuaObject(const LuaObject&); //0x908a40
LuaObject(const LuaStackObject&); //0x908a70
LuaObject(LuaState*); //0x908970
LuaObject(LuaState*, int); //0x9089c0
LuaObject(LuaState*, const TObject*); //0x9089f0
LuaObject(); //0x9072a0
~LuaObject(); //0x9075d0
LuaObject& operator=(const LuaObject&); //0x908ab0
LuaObject& operator=(const LuaStackObject&); //0x908b00
LuaObject operator[](int) const; //0x9091e0
LuaObject operator[](const char*) const; //0x908f60
bool GetBoolean() const; //0x907c90
bool IsBoolean() const; //0x9078d0
bool IsConvertibleToString() const; //0x9077c0
bool IsFunction() const; //0x907810
bool IsInteger() const; //0x907350
bool IsNil() const; //0x9072f0
bool IsNumber() const; //0x907360
bool IsString() const; //0x907370
bool IsTable() const; //0x907310
bool IsUserData() const; //0x907320
LuaObject Clone() const; //0x90a180
LuaObject CreateTable(const char*, int, int) const; //0x908c10
LuaObject CreateTable(int, int, int) const; //0x908ca0
LuaObject GetByIndex(int) const; //0x908df0
LuaObject GetByName(const char*) const; //0x90a160
LuaObject GetByObject(const LuaObject&) const; //0x908e70
LuaObject GetMetaTable() const; //0x908ba0
LuaObject Lookup(const char*) const; //0x9093b0
LuaStackObject PushStack(LuaState*) const; //0x907d80
LuaState* GetActiveState() const; //0x9072b0
const char* GetString() const; //0x907a90
const char* ToString(); //0x9073e0
const char* TypeName() const; //0x908b50
float GetNumber() const; //0x907970
float GetNumber() const; //0x907a30
float ToNumber(); //0x9073b0
gpg::RRef AssignNewUserData(LuaState*, const gpg::RRef&); //0x909840
gpg::RRef AssignNewUserData(LuaState*, const gpg::RType*); //0x9097d0
gpg::RRef GetUserData() const; //0x907bc0
int GetCount() const; //0x907f50
int GetInteger() const; //0x907910
int GetN() const; //0x907e50
int GetTableCount() const; //0x90a410
int IsPassed() const; //0x907440
int Type() const; //0x9076d0
int __cdecl Error(const char*, ...); //0x90c1d0
lua_State* GetActiveCState() const; //0x9072c0
void AddToUsedList(LuaState*); //0x908890
void AddToUsedList(LuaState*, const TObject&); //0x9088e0
void AssignBoolean(LuaState*, bool); //0x909600
void AssignInteger(LuaState*, int); //0x909650
void AssignNewTable(LuaState*, int, int); //0x909940
void AssignNil(LuaState*); //0x9095c0
void AssignNumber(LuaState*, float); //0x9096a0
void AssignString(LuaState*, const char*); //0x909750
void AssignTObject(LuaState*, const TObject*); //0x9099b0
void AssignThread(LuaState*); //0x9096f0
void Insert(const LuaObject&) const; //0x909af0
void Insert(int, const LuaObject&) const; //0x909ce0
void PushStack(lua_State*) const; //0x907d10
void Register(const char*, int (__cdecl*)(lua_State*), int); //0x907630
void Reset(); //0x9075f0
void SetBoolean(const char*, bool) const; //0x9080c0
void SetInteger(const char*, int) const; //0x9081f0
void SetInteger(int, int) const; //0x908240
void SetMetaTable(const LuaObject&); //0x907e00
void SetN(int) const; //0x907ed0
void SetNil(const char*) const; //0x907fa0
void SetNil(int) const; //0x907ff0
void SetNumber(const char*, float) const; //0x908320
void SetNumber(int, float) const; //0x908370
void SetObject(const LuaObject&, const LuaObject&) const; //0x908810
void SetObject(const char*, const LuaObject&) const; //0x908760
void SetObject(int, const LuaObject&) const; //0x9087a0
void SetString(const char*, const char*) const; //0x908450
void SetString(int, const char*) const; //0x9084e0
void TypeError(const char*) const; //0x9072d0

protected:
void SetTableHelper(const char*, const TObject&) const; //0x9074b0
};

class __thiscall LuaState
{// 0x34 bytes
public:
lua_State* m_state;
void* ForMultipleThreads;
bool m_ownState;
LuaObject m_threadObj;
LuaState* m_rootState;
struct MiniLuaObject {
LuaObject* m_next; // only valid when in free list
LuaObject* m_prev; // only valid when in used list
} m_headObject, m_tailObject;

LuaState(LuaState*); //0x90a520
LuaState(enum StandardLibraries); //0x90ac10
LuaState(enum UnattachedTag); //0x90a5d0
~LuaState(); //0x90a600
LuaObject GetGlobal(const char*); //0x4579d0
LuaObject GetGlobals(); //0x90a690
LuaState* GetActiveState(); //0x90bee0
const char* CheckString(int); //0x912d10
int ArgError(int, const char*); //0x90bf70
lua_State* GetActiveCState(); //0x90bef0
void CheckAny(int); //0x923f20
void CollectGarbage(); //0x911e90
void CollectGarbage(); //0x9176f0
void CollectGarbage(); //0x917710

private:
void Init(enum StandardLibraries); //0x90aad0
};
}

bool __cdecl LuaPlus::LuaPlusH_next(LuaState*, const LuaObject*, LuaObject*, LuaObject*); //0x90a6b0
bool __cdecl lua_toboolean(lua_State*, int); //0x90ca40
TObject* __cdecl negindex(lua_State*, int); //0x90c340
char* __cdecl luaL_prepbuffer(luaL_Buffer*); //0x90e260
const char* __cdecl luaL_checklstring(lua_State*, int, unsigned int*); //0x90eaa0
const char* __cdecl luaL_optlstring(lua_State*, int, const char*, unsigned int*); //0x90eb10
const char* __cdecl lua_getlocal(lua_State*, const lua_Debug*, int); //0x912680
const char* __cdecl lua_getupvalue(lua_State*, int, int); //0x90d9a0
const char* __cdecl lua_pushfstring(lua_State*, const char*, ...); //0x90ce90
const char* __cdecl lua_pushvfstring(lua_State*, const char*, char*); //0x90ce50
const char* __cdecl lua_setlocal(lua_State*, const lua_Debug*, int); //0x9126f0
const char* __cdecl lua_setupvalue(lua_State*, int, int); //0x90da00
const char* __cdecl lua_tostring(lua_State*, int); //0x90ca90
const char* __cdecl lua_typename(lua_State*, int); //0x90c780
float __cdecl luaL_checknumber(lua_State*, int); //0x90eb70
float __cdecl luaL_optnumber(lua_State*, int, float); //0x90ebf0
float __cdecl lua_tonumber(lua_State*, int); //0x90c9f0
gpg::RRef __cdecl lua_newuserdata(lua_State*, const gpg::RRef&); //0x90d7e0
gpg::RRef __cdecl lua_touserdata(lua_State*, int); //0x90cbb0
int __cdecl luaL_argerror(lua_State*, int, const char*); //0x90e900
int __cdecl luaL_callmeta(lua_State*, int, const char*); //0x90dda0
int __cdecl luaL_error(lua_State*, const char*, ...); //0x90dbf0
int __cdecl luaL_findstring(const char*, const char* const* const); //0x90dc20
int __cdecl luaL_getmetafield(lua_State*, int, const char*); //0x90dd40
int __cdecl luaL_getn(lua_State*, int); //0x90e090
int __cdecl luaL_loadbuffer(lua_State*, const char*, unsigned int, const char*); //0x90e760
int __cdecl luaL_loadfile(lua_State*, const char*); //0x90e5d0
int __cdecl luaL_newmetatable(lua_State*, const char*); //0x90dc70
int __cdecl luaL_typerror(lua_State*, int, const char*); //0x90e9a0
int __cdecl lua_checkstack(lua_State*, int); //0x90c460
int __cdecl lua_dobuffer(lua_State*, const char*, unsigned int, const char*); //0x90e870
int __cdecl lua_dostring(lua_State*, const char*); //0x90e8d0
int __cdecl lua_error(lua_State*); //0x90d6c0
int __cdecl lua_getgccount(lua_State*); //0x90d660
int __cdecl lua_getgcthreshold(lua_State*); //0x90d650
int __cdecl lua_gethookcount(lua_State*); //0x9125d0
int __cdecl lua_gethookmask(lua_State*); //0x9125c0
int __cdecl lua_getinfo(lua_State*, const char*, lua_Debug*); //0x9132f0
int __cdecl lua_getmetatable(lua_State*, int); //0x90d180
int __cdecl lua_getn(lua_State*, int); //0x90ad30
int __cdecl lua_getstack(lua_State*, int, lua_Debug*); //0x9125e0
int __cdecl lua_gettop(lua_State*); //0x90c590
int __cdecl lua_isnumber(lua_State*, int); //0x90c7a0
int __cdecl lua_isstring(lua_State*, int); //0x90c800
int __cdecl lua_lessthan(lua_State*, int, int); //0x90c980
int __cdecl lua_load(lua_State*, const char* (__cdecl*)(lua_State*, void*, unsigned int*), void*, const char*); //0x90d5c0
int __cdecl lua_next(lua_State*, int); //0x90d6d0
int __cdecl lua_pcall(lua_State*, int, int); //0x90d430
int __cdecl lua_rawequal(lua_State*, int, int); //0x90c890
int __cdecl lua_resume(lua_State*, int); //0x914610
int __cdecl lua_setfenv(lua_State*, int); //0x90d3b0
int __cdecl lua_sethook(lua_State*, void (__cdecl*)(lua_State*, lua_Debug*), int, int); //0x912560
int __cdecl lua_setmetatable(lua_State*, int); //0x90d340
int __cdecl lua_traceback(lua_State*, const char*, int); //0x911ea0
int __cdecl lua_type(lua_State*, int); //0x90c740
int __cdecl lua_yield(lua_State*, int); //0x913e40
int __cdecl luaopen_base(lua_State*); //0x90fd90
int __cdecl luaopen_debug(lua_State*); //0x9124c0
int __cdecl luaopen_loadlib(lua_State*); //0x91a4b0
int __cdecl luaopen_math(lua_State*); //0x91a110
int __cdecl luaopen_serialize(lua_State*); //0x923690
int __cdecl luaopen_string(lua_State*); //0x926ef0
lua_State* __cdecl lua_newthread(lua_State*); //0x90c530
lua_State* __cdecl lua_open(); //0x9246d0
lua_State* __cdecl lua_tothread(lua_State*, int); //0x90cc50
unsigned int __cdecl lua_strlen(lua_State*, int); //0x90cb10
void (__cdecl*__cdecl lua_gethook(lua_State*))(lua_State*, lua_Debug*); //0x9125b0
void __cdecl luaL_addlstring(luaL_Buffer*, const char*, unsigned int); //0x90e2a0
void __cdecl luaL_addstring(luaL_Buffer*, const char*); //0x90e300
void __cdecl luaL_addvalue(luaL_Buffer*); //0x90e370
void __cdecl luaL_buffinit(lua_State*, luaL_Buffer*); //0x90e400
void __cdecl luaL_checkany(lua_State*, int); //0x90ea70
void __cdecl luaL_checkstack(lua_State*, int, const char*); //0x90dd10
void __cdecl luaL_checktype(lua_State*, int, int); //0x90ea20
void __cdecl luaL_getmetatable(lua_State*, const char*); //0x90dcf0
void __cdecl luaL_openlib(lua_State*, const char*, const luaL_reg*, int); //0x90de00
void __cdecl luaL_pushresult(luaL_Buffer*); //0x90e330
void __cdecl luaL_setn(lua_State*, int, int); //0x90dfb0
void __cdecl luaL_where(lua_State*, int); //0x90db80
void __cdecl lua_call(lua_State*, int, int); //0x90d400
void __cdecl lua_close(lua_State*); //0x9243e0
void __cdecl lua_concat(lua_State*, int); //0x90d740
void __cdecl lua_getfenv(lua_State*, int); //0x90d1f0
void __cdecl lua_gettable(lua_State*, int); //0x90d000
void __cdecl lua_insert(lua_State*, int); //0x90c640
void __cdecl lua_newtable(lua_State*); //0x90d110
void __cdecl lua_pushboolean(lua_State*, int); //0x90cf80
void __cdecl lua_pushcclosure(lua_State*, int (__cdecl*)(lua_State*), int); //0x90ced0
void __cdecl lua_pushlightuserdata(lua_State*, void*); //0x90cfc0
void __cdecl lua_pushlstring(lua_State*, const char*, unsigned int); //0x90cd80
void __cdecl lua_pushnil(lua_State*); //0x90cd00
void __cdecl lua_pushnumber(lua_State*, float); //0x90cd40
void __cdecl lua_pushstring(lua_State*, const char*); //0x90cdf0
void __cdecl lua_pushvalue(lua_State*, int); //0x90c6e0
void __cdecl lua_rawget(lua_State*, int); //0x90d050
void __cdecl lua_rawgeti(lua_State*, int, int); //0x90d0a0
void __cdecl lua_rawset(lua_State*, int); //0x90d2a0
void __cdecl lua_rawseti(lua_State*, int, int); //0x90d2f0
void __cdecl lua_remove(lua_State*, int); //0x90c5f0
void __cdecl lua_replace(lua_State*, int); //0x90c690
void __cdecl lua_setdefaultmetatable(lua_State*, int); //0x90ad00
void __cdecl lua_setgcthreshold(lua_State*, int); //0x90d670
void __cdecl lua_setglobaluserdata(lua_State*, void*); //0x924060
void __cdecl lua_setstateuserdata(lua_State*, void*); //0x9240b0
void __cdecl lua_settable(lua_State*, int); //0x90d260
void __cdecl lua_settop(lua_State*, int); //0x90c5a0
void __cdecl lua_setusergcfunction(lua_State*, void (__cdecl*)(void*)); //0x924080
void __cdecl lua_xmove(lua_State*, lua_State*, int); //0x90c4c0
void const* __cdecl lua_topointer(lua_State*, int); //0x90cc90
void* __cdecl lua_getglobaluserdata(lua_State*); //0x924050
void* __cdecl lua_getstateuserdata(lua_State*); //0x9240a0
void* __cdecl lua_tolightuserdata(lua_State*, int); //0x90cc10
82 changes: 82 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# FA Engine Patches Repository

This are some binary patches for Supreme Commander Forged Alliance.

To apply them build or get the patcher itself from here

https://github.com/FAForever/FA_Patcher

This are just the patch files for this game. I decided to separate them from patcher source code.

# Change List
## Fixes
- Prevents the crash with 'None' collisions of air. #3235
- hooks/AirNoneCollisionFix.cpp
- Prevents commander exploding for no reason. #3406
- hooks/NegativeIncomeFix.cpp
- Range ring performance improvement (don't render each ring twice)
- hooks/RangeRings.cpp
- section/RangeRings.cpp
- Camera performance improvements
- hooks/CameraPerf.cpp
- Fix replays desyncing when a player leaves the game
- hooks/DesyncFix.cpp
- section/ext_sector.cpp
- section/gpg_net.cpp
- section/moho_decode.cpp
- section/moho_input.cpp
- Kill exception during map loading
- hooks/Kill_maploader_except.cpp
- Make xact3d the error message print once
- hooks/xact_3dapply.cpp
- section/ext_sector.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
- Stop the engine calling lua every time a plane turns
- hooks/OnMotionTurnEvent.cpp
- Optimised some AI actions
- hooks/aiinitattack.cpp
- Fix a crash when units arrive at waypoints
- hooks/WayPointArrive.cpp

## Additions
- Console command: "cam_DefaultMiniLOD 0" now completely disable mesh renderer for minimap
- hooks/MinimapMesh.cpp
- section/MinimapMesh.cpp
- Allow players to double-click to select Walls
- hooks/Walls.cpp
- Similar to GetSystemTimeSecondsOnlyForProfileUse
Allows to deal with the loss of accuracy. It is present in the Sim and UI
- section/GetTimeForProfile.cpp
- section/ext_sector.cpp
- Adds optimized table.getsize2(~25 times faster) and table.empty2
Added getn2 as alias getn. Entry point to math functions queue
- hooks/GetTableSize.cpp
- section/ext_sector.cpp
- Maximum sim rate up to 50
- hooks/DelClampMaxSimRate.cpp
- Adds an amphibious mode toggle to the Salem
- hooks/luaSimGetStat.cpp
- section/luaSimGetStat.cpp
- Make `LOWSELECTPRIO` apply to units under construction
- hooks/selectionPriority.cpp
- section/selectionPriority.cpp
- Allow the getting of Mass or Energy spots around a location & Entry point to ui functions queue
- hooks/UserGetDepositsAroundPoint.cpp
- section/SimGetDepositsAroundPoint.cpp
- section/ext_sector.cpp
- Allow devs to write console commands to the log
- hooks/ConsoleLog.cpp
- section/ConsoleLog.cpp
- Unlock an "Ultra" graphics preset
- hooks/UnlockUltraPreset.cpp
- Allow armies to be shared by multiple players & Entry point to sim functions queue
- hooks/SimSetFocusArmy.cpp
- section/SimSetFocusArmy.cpp
- Allow upgrades to be queued on units under construction
- hooks/BuildUnit.cpp
- section/BuildUnit.cpp
- section/SelectUnit.cpp
- section/SimArmyCreate.cpp
4 changes: 4 additions & 0 deletions config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
oldfile ForgedAlliance_base.exe
newfile ForgedAlliance_exxt.exe
newsect .exxt
sectsize 0x80000
9 changes: 9 additions & 0 deletions hooks/AirNoneCollisionFix.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
asm
(
".section h0; .set h0,0x6C018B;"
"JMP .+0x30;" //0x6C01BB
"NOP;"
"NOP;"
"NOP;"
"NOP;"
);
Loading

0 comments on commit e23e4ea

Please sign in to comment.