Skip to content

Commit

Permalink
Fix a desync caused by ForceAltFootprint (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
4z0t authored Nov 23, 2024
1 parent 8ff7188 commit 63718d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
14 changes: 0 additions & 14 deletions hooks/EntityGetFootprint.cpp

This file was deleted.

10 changes: 10 additions & 0 deletions hooks/EntityGetFootprint.hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//Moho::SSTIEntityVariableData::SSTIEntityVariableData
0x00558823:
mov dword ptr [eax+0x0A4], ecx // 0x0A5 bool forceAltFootprint


// Moho::Entity::GetFootprint
0x006788A5:
jmp @asm__GetFootprint
nop
nop
4 changes: 2 additions & 2 deletions section/EntityGetFootprint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int ForceAltFootprint(lua_State *L)
void *unit = res.object;
bool flag = lua_toboolean(L, 2);

GetField<bool>(unit, 8+0x1F9) = flag; // bool forceAltFootprint
GetField<bool>(unit, 8+0x11D) = flag; // bool forceAltFootprint

return 0;
}
Expand All @@ -32,7 +32,7 @@ void asm__GetFootprint()
asm(
"cmp byte ptr [ecx+0x11C], 0;" // this->sstiData.usingAltFp
"jnz 0x006788AE;"
"cmp byte ptr [ecx+0x1F9], 0;" // bool forceAltFootprint
"cmp byte ptr [ecx+0x11D], 0;" // bool forceAltFootprint
"jnz 0x006788AE;"
"jmp 0x006788C2;"
);
Expand Down

0 comments on commit 63718d1

Please sign in to comment.