Skip to content

Commit

Permalink
Fix weak tables not being garbage collected (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
4z0t committed Mar 31, 2024
1 parent baab2e7 commit 189eed5
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -39,6 +39,8 @@ These don't matter except for other assembly patches
- hooks/aiinitattack.cpp

## Bugs
- 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
Expand Down
41 changes: 41 additions & 0 deletions hooks/weakgcmarkerFix.cpp
@@ -0,0 +1,41 @@
#include "../define.h"

asm(
"; arg_0 = 4;"
"; limit = 8;"
";.section h0; .set h0,0x00915A00 "
"; push ebp "
"; mov ebp, [esp+4+arg_0]"
"; push esi "
"; mov esi, eax "
"; mov eax, [esi]"
"; push edi "
"; xor edi, edi "
"; cmp eax, ebx "
"; jz short loc_915A3B "
";loc_915A11:"
"; mov cl, [eax+5]"
"; movzx edx, cl "
"; and edx, -7 " //the fixing line
"; cmp edx, [esp+0x0C+limit]"
"; jle short loc_915A27 "
"; and cl, 0x0FE "
"; mov [eax+5], cl "
"; mov esi, eax "
"; jmp short loc_915A35 "
";loc_915A27:"
"; mov ecx, [eax]"
"; mov [esi], ecx "
"; mov ecx, ebp "
"; add edi, 1 "
"; call 0x915950 "
";loc_915A35:"
"; mov eax, [esi]"
"; cmp eax, ebx "
"; jnz short loc_915A11 "
";loc_915A3B:"
"; mov eax, edi "
"; pop edi "
"; pop esi "
"; pop ebp "
"; ret ");

0 comments on commit 189eed5

Please sign in to comment.