Skip to content

Commit 123df22

Browse files
committed
fix tilt
1 parent 185ba01 commit 123df22

3 files changed

Lines changed: 41 additions & 0 deletions

File tree

skScreen/binaryFix.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,45 @@ void BinaryFix::setUIRatio()
8686
OutputDebugString("skScreen: UI screen ratio was set");
8787
}
8888

89+
90+
void BinaryFix::setTextTiltRatio()
91+
{
92+
uint32_t address = 0;
93+
94+
// TODO remowrk to use getAPI and getRelease? But we do memory patching, so hash is the best option here for now
95+
std::string hash = gameVersion.getGameHash();
96+
97+
//search for 1.332999945
98+
if (hash == "E4BAF3E5CACD51AFCE61007F72781167") {
99+
// International DirectX
100+
address = 0x46e6ec;
101+
}
102+
else if (hash == "C5801F89E46C53A67AC8D7C18A94ACD8") {
103+
// International Glide
104+
address = 0x46d7ac;
105+
}
106+
else if (hash == "CE9A034310D45EED6D6E2C1B6014376E") {
107+
// Polish DirectX
108+
address = 0x46f68c;
109+
}
110+
else if (hash == "7D7EB6DFB099CF06FEF28F436CAE6E52") {
111+
// Polish Glide
112+
address = 0x46d754;
113+
}
114+
115+
std::stringstream ss;
116+
ss << "got hash: " << hash << " with res " << gameConfig.getWidth() << "x" << gameConfig.getHeight();
117+
OutputDebugString(ss.str().c_str());
118+
119+
if (!address) {
120+
throw std::runtime_error("skScreen: unknown game version");
121+
}
122+
// 0.0000520833345945 is a magic value, the game by default sets 640x480 resolution
123+
float ratio = 0.0000520833345945f * (480.0f / static_cast<float>(gameConfig.getHeight()));
124+
replaceMemory(address, ratio);
125+
OutputDebugString("skScreen: 3D screen ratio was set");
126+
}
127+
89128
void BinaryFix::removeResolutionLimit()
90129
{
91130
uint32_t addressX = 0;

skScreen/binaryFix.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class BinaryFix {
1414

1515
void set3DRatio();
1616
void setUIRatio();
17+
void setTextTiltRatio();
1718

1819
void removeResolutionLimit();
1920
void fixRadeon();

skScreen/init.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ BOOL Initialize()
1919

2020
binaryFix.set3DRatio();
2121
binaryFix.setUIRatio();
22+
binaryFix.setTextTiltRatio();
2223

2324
binaryFix.removeResolutionLimit();
2425

0 commit comments

Comments
 (0)