Skip to content

Commit e4e34b1

Browse files
sTc2201RaphaelK12
andauthored
dark phone fix (#621)
Co-authored-by: RaphaelK12 <[email protected]>
1 parent 8d4d5aa commit e4e34b1

File tree

2 files changed

+69
-69
lines changed

2 files changed

+69
-69
lines changed

source/fixes.ixx

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -452,44 +452,44 @@ public:
452452
}
453453
}
454454

455-
// Skybox Black Bottom Fix
456-
{
457-
auto PatchVertices = [](float* ptr)
458-
{
459-
for (auto i = 0; i < ((6156 / 4) / 3); i++)
460-
{
461-
auto pVertex = (ptr + i * 3);
462-
if (i < 32)
463-
{
464-
if (pVertex[1] < 0.0f)
465-
{
466-
injector::WriteMemory<float>(pVertex, 0.0f, true);
467-
injector::WriteMemory<float>(pVertex + 2, 0.0f, true);
468-
}
469-
}
470-
else
471-
{
472-
injector::WriteMemory<float>(pVertex + 1, (pVertex[1] - 0.16037700f) * 1.78f - 1.0f, true);
473-
}
474-
}
475-
};
476-
477-
auto pattern = hook::pattern("C7 44 24 ? ? ? ? ? C7 44 24 ? ? ? ? ? E8 ? ? ? ? 8B 44 24 44");
478-
if (!pattern.empty())
479-
{
480-
auto addr = pattern.get_first<float*>(4);
481-
PatchVertices(*addr);
482-
}
483-
else
484-
{
485-
pattern = hook::pattern("C7 46 ? ? ? ? ? C7 46 ? ? ? ? ? 5E 59 C3");
486-
if (!pattern.empty())
487-
{
488-
auto addr = pattern.get_first<float*>(3);
489-
PatchVertices(*addr);
490-
}
491-
}
492-
}
455+
// Skybox Black Bottom Fix -- causes holes in the map to be more visible.
456+
// {
457+
// auto PatchVertices = [](float* ptr)
458+
// {
459+
// for (auto i = 0; i < ((6156 / 4) / 3); i++)
460+
// {
461+
// auto pVertex = (ptr + i * 3);
462+
// if (i < 32)
463+
// {
464+
// if (pVertex[1] < 0.0f)
465+
// {
466+
// injector::WriteMemory<float>(pVertex, 0.0f, true);
467+
// injector::WriteMemory<float>(pVertex + 2, 0.0f, true);
468+
// }
469+
// }
470+
// else
471+
// {
472+
// injector::WriteMemory<float>(pVertex + 1, (pVertex[1] - 0.16037700f) * 1.78f - 1.0f, true);
473+
// }
474+
// }
475+
// };
476+
477+
// auto pattern = hook::pattern("C7 44 24 ? ? ? ? ? C7 44 24 ? ? ? ? ? E8 ? ? ? ? 8B 44 24 44");
478+
// if (!pattern.empty())
479+
// {
480+
// auto addr = pattern.get_first<float*>(4);
481+
// PatchVertices(*addr);
482+
// }
483+
// else
484+
// {
485+
// pattern = hook::pattern("C7 46 ? ? ? ? ? C7 46 ? ? ? ? ? 5E 59 C3");
486+
// if (!pattern.empty())
487+
// {
488+
// auto addr = pattern.get_first<float*>(3);
489+
// PatchVertices(*addr);
490+
// }
491+
// }
492+
// }
493493
};
494494
}
495495
} Fixes;

source/postfx.ixx

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,30 +1056,6 @@ private:
10561056
}
10571057
}
10581058

1059-
// game postfx
1060-
{
1061-
for(int i = 0; i < 4; i++) {
1062-
pDevice->SetTexture(i, PostFxResources.prePostFx[i]);
1063-
pDevice->SetSamplerState(i, D3DSAMP_MAGFILTER, PostFxResources.Samplers[i]);
1064-
}
1065-
1066-
if(UsePostFxAA->get() > FusionFixSettings.AntialiasingText.eMO_OFF)
1067-
pDevice->SetRenderTarget(0, PostFxResources.renderTargetSurf);
1068-
else
1069-
pDevice->SetRenderTarget(0, PostFxResources.backBuffer);
1070-
pDevice->SetTexture(9, PostFxResources.blueNoiseVolume);
1071-
pDevice->SetTexture(2, PostFxResources.textureRead);
1072-
pDevice->Clear(0, 0, D3DCLEAR_TARGET, 0, 0, 0);
1073-
1074-
pDevice->SetPixelShader(pShader);
1075-
pDevice->SetVertexShader(vShader);
1076-
//hr = pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2);
1077-
hbDrawPrimitivePostFX.fun();
1078-
if(UsePostFxAA->get() > FusionFixSettings.AntialiasingText.eMO_OFF)
1079-
PostFxResources.swapbuffers();
1080-
1081-
pDevice->SetTexture(9, 0);
1082-
}
10831059
// This implementation has some problems with cuts in some
10841060
// places (when smoothing some diagonal lines there are pixels that break the smoothing),
10851061
// I didn't find the reason, but using antialiasing.ixx it works almost perfectly despite being
@@ -1090,13 +1066,13 @@ private:
10901066
pDevice->GetRenderState(D3DRS_SRGBWRITEENABLE, &OldSRGB); // save srgb state
10911067
pDevice->SetPixelShader(PostFxResources.FxaaPS);
10921068

1093-
//pDevice->SetRenderTarget(0, PostFxResources.renderTargetSurf);
1094-
pDevice->SetRenderTarget(0, PostFxResources.backBuffer);
1069+
pDevice->SetRenderTarget(0, PostFxResources.renderTargetSurf);
1070+
// pDevice->SetRenderTarget(0, PostFxResources.backBuffer);
10951071

10961072
pDevice->SetTexture(2, PostFxResources.textureRead);
10971073
hr = pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2);
1098-
pDevice->SetTexture(2, PostFxResources.renderTargetTex);
1099-
//PostFxResources.swapbuffers();
1074+
// pDevice->SetTexture(2, PostFxResources.renderTargetTex);
1075+
PostFxResources.swapbuffers();
11001076
pDevice->SetSamplerState(2, D3DSAMP_SRGBTEXTURE, 0);
11011077
//pDevice->SetTexture(2, 0);
11021078
pDevice->SetPixelShader(pShader);
@@ -1152,8 +1128,8 @@ private:
11521128
vec4[3] = 4.0f;
11531129
pDevice->SetPixelShaderConstantF(5, vec4, 1);
11541130

1155-
//pDevice->SetRenderTarget(0, PostFxResources.renderTargetSurf);
1156-
pDevice->SetRenderTarget(0, PostFxResources.backBuffer);
1131+
pDevice->SetRenderTarget(0, PostFxResources.renderTargetSurf);
1132+
// pDevice->SetRenderTarget(0, PostFxResources.backBuffer);
11571133
pDevice->SetSamplerState(2, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
11581134

11591135
//pDevice->SetTexture(2, textureRead);
@@ -1162,7 +1138,7 @@ private:
11621138
pDevice->SetTexture(4, PostFxResources.blendTex->mD3DTexture);
11631139
pDevice->SetRenderState(D3DRS_SRGBWRITEENABLE, 0);
11641140
pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2);
1165-
//PostFxResources.swapbuffers();
1141+
PostFxResources.swapbuffers();
11661142
pDevice->SetTexture(0, PostFxResources.prePostFx[0]);
11671143
pDevice->SetTexture(1, PostFxResources.prePostFx[1]);
11681144
pDevice->SetTexture(2, PostFxResources.textureRead);
@@ -1174,6 +1150,30 @@ private:
11741150
}
11751151
}
11761152

1153+
// game postfx
1154+
{
1155+
for(int i = 0; i < 4; i++) {
1156+
pDevice->SetTexture(i, PostFxResources.prePostFx[i]);
1157+
pDevice->SetSamplerState(i, D3DSAMP_MAGFILTER, PostFxResources.Samplers[i]);
1158+
}
1159+
1160+
// if(UsePostFxAA->get() > FusionFixSettings.AntialiasingText.eMO_OFF)
1161+
// pDevice->SetRenderTarget(0, PostFxResources.renderTargetSurf);
1162+
// else
1163+
pDevice->SetRenderTarget(0, PostFxResources.backBuffer);
1164+
pDevice->SetTexture(9, PostFxResources.blueNoiseVolume);
1165+
pDevice->SetTexture(2, PostFxResources.textureRead);
1166+
pDevice->Clear(0, 0, D3DCLEAR_TARGET, 0, 0, 0);
1167+
1168+
pDevice->SetPixelShader(pShader);
1169+
pDevice->SetVertexShader(vShader);
1170+
//hr = pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2);
1171+
hbDrawPrimitivePostFX.fun();
1172+
// if(UsePostFxAA->get() > FusionFixSettings.AntialiasingText.eMO_OFF)
1173+
// PostFxResources.swapbuffers();
1174+
1175+
pDevice->SetTexture(9, 0);
1176+
}
11771177
for(int i = 0; i < PostfxTextureCount; i++) {
11781178
pDevice->SetTexture(i, PostFxResources.prePostFx[i]);
11791179
pDevice->SetSamplerState(i, D3DSAMP_MAGFILTER, PostFxResources.Samplers[i]);

0 commit comments

Comments
 (0)