Skip to content

Commit

Permalink
rev2: change logo option
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirteenAG committed Jan 17, 2025
1 parent 51c4b6a commit 81b6ec3
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ DisableDamageOverlay = 1
DisableFilmGrain = 1
DisableFade = 0 // Not recommended
FOVFactor = 1.0
DisableCreateQuery = 0 // Use for potential performance improvement
DisableCreateQuery = 0 // Use for potential performance improvement
ForceLogo = 0 // 0: Default, 1: Biohazard (r), 2 or 4: Resident Evil (r), 3: Resident Evil (tm)
76 changes: 49 additions & 27 deletions source/ResidentEvilRevelations2.FusionFix/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ void __fastcall sub_96C410(int _this, int edx, int a2, int a3)
v9 = v10;

if (IsSplitScreenActive())
a2 += (int32_t)(720.0f * GetAspectRatio()) - (1280.0f / (1280.0f / GetNativeSplitScreenResX()));
a2 += (int32_t)((720.0f * GetAspectRatio()) - (1280.0f / (1280.0f / GetNativeSplitScreenResX())));
else
a2 += (int32_t)(((720.0f * GetAspectRatio()) - 1280.0f) / 2.0f);

Expand Down Expand Up @@ -356,12 +356,12 @@ void __fastcall sub_E18040(int _this, int edx, int a2)
*((uint32_t*)v2 + 81) |= 1u;
if (v13)
{
v14 = 2.0 / (float)(v28 - v19);
v15 = -2.0 / (float)(v21 - v29);
v14 = 2.0f / (float)(v28 - v19);
v15 = -2.0f / (float)(v21 - v29);
v13[0] = v14 * v4;
v13[1] = v15 * v5;
v13[2] = (float)(v14 * v6) - 1.0;
v13[3] = (float)(v15 * v7) + 1.0;
v13[2] = (float)(v14 * v6) - 1.0f;
v13[3] = (float)(v15 * v7) + 1.0f;
*((uint32_t*)v2 + 19) &= ~2u;

switch (edx)
Expand All @@ -373,42 +373,42 @@ void __fastcall sub_E18040(int _this, int edx, int a2)
{
if (v21 == GetCurrentSplitScreenResY() || v21 == (GetCurrentSplitScreenResY() + 1))
{
v14 = 2.0 / (float)(v28 - v19);
v15 = -2.0 / (float)(v21 - v29);
v14 = 2.0f / (float)(v28 - v19);
v15 = -2.0f / (float)(v21 - v29);
v13[0] = v14 * v4 * ((edx == SUBTITLES) ? (1.0f / GetDiff()) : 1.0f);
v13[1] = v15 * v5;
v13[2] = (float)(v14 * v6) - (1.0f / GetDiff());
v13[3] = (float)(v15 * v7) + 1.0;
v13[3] = (float)(v15 * v7) + 1.0f;
}
else if (v21 == GetResY())
{
v14 = 2.0 / (float)(v28 - v19);
v15 = -2.0 / (float)(v21 - v29);
v14 = 2.0f / (float)(v28 - v19);
v15 = -2.0f / (float)(v21 - v29);
v13[0] = v14 * v4 * ((edx == SUBTITLES) ? (1.0f / GetDiff()) : 1.0f);
v13[1] = v15 * v5;
v13[2] = (float)(v14 * v6) - (1.0f / (GetAspectRatio() / defaultAspectRatio));
v13[3] = (float)(v15 * v7) + 1.0;
v13[3] = (float)(v15 * v7) + 1.0f;
}
}
else
{
v14 = 2.0 / (float)(v28 - v19);
v15 = -2.0 / (float)(v21 - v29);
v14 = 2.0f / (float)(v28 - v19);
v15 = -2.0f / (float)(v21 - v29);
v13[0] = v14 * v4 * ((edx == SUBTITLES) ? (1.0f / GetDiff()) : 1.0f);
v13[1] = v15 * v5;
v13[2] = (float)(v14 * v6) - (1.0f / GetDiff());
v13[3] = (float)(v15 * v7) + 1.0;
v13[3] = (float)(v15 * v7) + 1.0f;
}
}
break;
case STRETCH:
{
v14 = (2.0 * GetDiff()) / (float)(v28 - v19);
v15 = -2.0 / (float)(v21 - v29);
v14 = (2.0f * GetDiff()) / (float)(v28 - v19);
v15 = -2.0f / (float)(v21 - v29);
v13[0] = v14 * v4;
v13[1] = v15 * v5;
v13[2] = -1.0f; //(float)(v14 * v6) - fDiffInv;
v13[3] = (float)(v15 * v7) + 1.0;
v13[3] = (float)(v15 * v7) + 1.0f;
}
break;
case OFFSET:
Expand All @@ -417,33 +417,33 @@ void __fastcall sub_E18040(int _this, int edx, int a2)
{
if (v21 == GetCurrentSplitScreenResY() || v21 == (GetCurrentSplitScreenResY() + 1))
{
v14 = 2.0 / (float)(v28 - v19);
v15 = -2.0 / (float)(v21 - v29);
v14 = 2.0f / (float)(v28 - v19);
v15 = -2.0f / (float)(v21 - v29);
v13[0] = v14 * v4;
v13[1] = v15 * v5;
v13[2] = (float)(v14 * v6) - (1.0f / GetDiff());
v13[3] = (float)(v15 * v7) + 1.0;
v13[3] = (float)(v15 * v7) + 1.0f;
}
else if (v21 == GetResY())
{
v14 = 2.0 / (float)(v28 - v19);
v15 = -2.0 / (float)(v21 - v29);
v14 = 2.0f / (float)(v28 - v19);
v15 = -2.0f / (float)(v21 - v29);
v13[0] = v14 * v4;
v13[1] = v15 * v5;
v13[2] = (float)(v14 * v6) - (1.0f / (GetAspectRatio() / defaultAspectRatio));
v13[3] = (float)(v15 * v7) + 1.0;
v13[3] = (float)(v15 * v7) + 1.0f;
}
}
else
{
if (v21 == GetResY())
{
v14 = 2.0 / (float)(v28 - v19);
v15 = -2.0 / (float)(v21 - v29);
v14 = 2.0f / (float)(v28 - v19);
v15 = -2.0f / (float)(v21 - v29);
v13[0] = v14 * v4;
v13[1] = v15 * v5;
v13[2] = (float)(v14 * v6) - (1.0f / GetDiff());
v13[3] = (float)(v15 * v7) + 1.0;
v13[3] = (float)(v15 * v7) + 1.0f;
}
}
}
Expand Down Expand Up @@ -476,7 +476,7 @@ void __fastcall sub_E18040(int _this, int edx, int a2)
{
goto LABEL_18;
}
v18 = v20 + 0.25;
v18 = v20 + 0.25f;
LABEL_19:
v16 = a2;
LABEL_20:
Expand Down Expand Up @@ -777,6 +777,12 @@ DWORD WINAPI XInputGetStateHook(DWORD dwUserIndex, XINPUT_STATE* pState)
return ret;
}

int nForceLogo = 0;
int sub_984240()
{
return nForceLogo - 1;
}

void Init()
{
CIniReader iniReader("");
Expand All @@ -790,6 +796,7 @@ void Init()
if (fFOVFactor <= 0.0f) fFOVFactor = 1.0f;
bDisableCreateQuery = iniReader.ReadInteger("MAIN", "DisableCreateQuery", 0) != 0;
auto bAutoclicker = iniReader.ReadInteger("MAIN", "Autoclicker", 0) != 0;
nForceLogo = std::clamp(iniReader.ReadInteger("MAIN", "ForceLogo", 0), 0, 4);

if (bSkipIntro)
{
Expand Down Expand Up @@ -979,6 +986,21 @@ void Init()
hb_954B40.fun = injector::MakeCALL(pattern.get_first(), sub_954B40, true).get();
}

if (nForceLogo)
{
auto pattern = hook::pattern("E8 ? ? ? ? 83 F8 03 77 ? FF 24 85 ? ? ? ? 6A 01 68 04 8F 39 01");
injector::MakeCALL(pattern.get_first(), sub_984240, true);

pattern = hook::pattern("E8 ? ? ? ? 83 F8 03 0F 87 ? ? ? ? FF 24 85 ? ? ? ? 68 E8 8E 39 01");
injector::MakeCALL(pattern.get_first(), sub_984240, true);

pattern = hook::pattern("E8 ? ? ? ? 83 F8 03 77 ? FF 24 85 ? ? ? ? 6A 01 68 E8 EC 3B 01");
injector::MakeCALL(pattern.get_first(), sub_984240, true);

pattern = hook::pattern("E8 ? ? ? ? 83 F8 03 0F 87 ? ? ? ? FF 24 85 ? ? ? ? 68 B4 EC 3B 01");
injector::MakeCALL(pattern.get_first(), sub_984240, true);
}

{
static auto sPlayerPtr = *hook::get_pattern<void*>("8B 0D ? ? ? ? 56 E8 ? ? ? ? 85 C0 74 7B 8B C8", 2);

Expand Down

0 comments on commit 81b6ec3

Please sign in to comment.