forked from kyx0r/FA-Binary-Patches
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
KionX
committed
Jul 23, 2022
1 parent
828138e
commit d860211
Showing
6 changed files
with
61 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.exe | ||
/build | ||
define.h | ||
patch.ld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "../define.h" | ||
asm | ||
( | ||
".section h0; .set h0,0x73D4A0;" | ||
"CALL "QU(HeightCylinders)";" | ||
|
||
".section h1; .set h1,0x7EE2BC;" | ||
".4byte "QU(MinCHeight)";" | ||
|
||
".section h2; .set h2,0x7EE33A;" | ||
".4byte "QU(MaxCHeight)";" | ||
|
||
".section h3; .set h3,0x81C38E;" | ||
".4byte "QU(MinCHeight)";" | ||
|
||
".section h4; .set h4,0x81C3C5;" | ||
".4byte "QU(MaxCHeight)";" | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <cstdint> | ||
|
||
float MinCHeight, MaxCHeight; | ||
|
||
void* _thiscall HeightCylinders(char* this_) | ||
{ | ||
auto Sim = reinterpret_cast<char* (_thiscall *)(void*)>(0x7433B0)(this_); | ||
auto STIMap = *(uint32_t*)(Sim + 0x8CC); | ||
auto MapData = *(uint32_t*)STIMap; | ||
auto Heights = (uint16_t*)*(uint32_t*)MapData; | ||
auto SizeX = *(int*)(MapData + 0x4); | ||
auto SizeY = *(int*)(MapData + 0x8); | ||
uint16_t MinH = -1, MaxH = 0; | ||
for (auto I = 0; I < SizeX * SizeY; I++) { | ||
if (*Heights < MinH) MinH = *Heights; | ||
if (*Heights > MaxH) MaxH = *Heights; | ||
Heights++; | ||
} | ||
MinCHeight = MinH * 0.0078125 - 5; | ||
MaxCHeight = MaxH * 0.0078125; | ||
this_ = (char*)*(uint32_t*)(0x10C7C28); | ||
reinterpret_cast<void (_thiscall *)(void*)>(0x7EDFE0)(this_ + 0x37C); | ||
reinterpret_cast<void (_thiscall *)(void*)>(0x81C0C0)(this_ + 0x410); | ||
return Sim; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters