Skip to content

Commit

Permalink
Merge to upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
SandeMC committed Nov 8, 2024
2 parents f2a6219 + b2d474c commit 7ba9410
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 35 deletions.
1 change: 1 addition & 0 deletions data/plugins/GTAIV.EFLC.FusionFix.ini
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ TreeAlphaConsole = 4.0
CoronaReflectionIntensity = 1.0 // controls intensity of coronas in reflections
ConsoleCarReflectionsAndDirt = 1
AlwaysDisplayHealthOnReticle = 1
SmoothShorelines = 1 // improves water transparency

[BudgetedIV]
VehicleBudget = 0 // may cause issues, set to e.g. 260000000 to increase budget limit
Expand Down
4 changes: 2 additions & 2 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ workspace "GTAIV.EFLC.FusionFix"
defines { "rsc_CompanyName=\"GTAIV.EFLC.FusionFix\"" }
defines { "rsc_LegalCopyright=\"GTAIV.EFLC.FusionFix\""}
defines { "rsc_InternalName=\"%{prj.name}\"", "rsc_ProductName=\"%{prj.name}\"", "rsc_OriginalFilename=\"%{prj.name}.dll\"" }
defines { "rsc_FileDescription=\"GTAIV.EFLC.FusionFix\"" }
defines { "rsc_UpdateUrl=\"https://github.com/ThirteenAG/GTAIV.EFLC.FusionFix\"" }
defines { "rsc_FileDescription=\"GTAIV.EFLC.FusionFix (GFWLMin ver.)\"" }
defines { "rsc_UpdateUrl=\"https://github.com/gillian-guide/GTAIV.EFLC.FusionFix-GFWLMin\"" }

local major = 1
local minor = 0
Expand Down
22 changes: 5 additions & 17 deletions source/fixes.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,11 @@ public:
}

// Water Foam Height Weirdness
{
auto pattern = hook::pattern("F3 0F 58 0D ? ? ? ? 83 EC 08 F3 0F 59 05");
if (!pattern.empty())
injector::MakeNOP(pattern.get_first(0), 8, true);
}
//{
// auto pattern = hook::pattern("F3 0F 58 0D ? ? ? ? 83 EC 08 F3 0F 59 05");
// if (!pattern.empty())
// injector::MakeNOP(pattern.get_first(0), 8, true);
//}

// Render LOD lights during cutscenes (console behavior)
{
Expand Down Expand Up @@ -463,18 +463,6 @@ public:
}
}

// Enable the "first person" reticle (Annihilator, Buzzard) on gamepads as well, this used to be a keyboard & mouse feature only.
{
auto pattern = hook::pattern("85 F6 0F 84 ? ? ? ? 80 BE ? ? ? ? ? 0F 84 ? ? ? ? 85 C9 0F 84");
if (!pattern.empty())
injector::MakeNOP(pattern.get_first(0), 21, true);
else
{
pattern = hook::pattern("8B 4C 24 24 85 C9 0F 84 ? ? ? ? 80 B9 ? ? ? ? ? 0F 84");
injector::MakeNOP(pattern.get_first(0), 25, true);
}
}

// Always display the ped health on the reticle with free-aim while on foot, used to be a gamepad + multiplayer only feature (PC is always free-aim unless it's melee combat).
if (bAlwaysDisplayHealthOnReticle)
{
Expand Down
20 changes: 8 additions & 12 deletions source/frameratevigilante.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,27 @@ public:
auto pattern = find_pattern("E8 ? ? ? ? D9 5C 24 7C F3 0F 10 4C 24", "E8 ? ? ? ? D9 5C 24 70 F3 0F 10 44 24 ? F3 0F 58 86");
hbsub_A18510.fun = injector::MakeCALL(pattern.get_first(0), sub_A18510).get();

// By Sergeanur
pattern = hook::pattern("F3 0F 10 45 ? 51 8B CF F3 0F 11 04 24 E8 ? ? ? ? 8A 8F");
pattern = hook::pattern("F3 0F 58 05 ? ? ? ? F3 0F 2A 0D");
if (!pattern.empty())
{
struct FramerateVigilanteHook1
struct LoadingTextSparks
{
void operator()(injector::reg_pack& regs)
{
float f = std::clamp(*(float*)(regs.ebp + 0x08), 1.0f / 150.0f, FLT_MAX);
*(float*)(regs.ebp + 0x08) = f;
regs.xmm0.f32[0] = f;
regs.xmm1.f32[0] += 0.085f * *CTimer::fTimeStep;
}
}; injector::MakeInline<FramerateVigilanteHook1>(pattern.get_first(0));
}; injector::MakeInline<LoadingTextSparks>(pattern.get_first(0), pattern.get_first(8));
}
else
{
pattern = hook::pattern("8B BE ? ? ? ? 33 C9 85 FF 7E 47 8A 5D 0C 33 D2 8D A4 24 ? ? ? ? 3B CF 7D 0A 8B 86 ? ? ? ? 03 C2 EB 02 33 C0 F6 80 ? ? ? ? ? 74 11 83 B8 ? ? ? ? ? 74 08 84 DB 0F 85 ? ? ? ? 83 C1 01 81 C2 ? ? ? ? 3B 8E ? ? ? ? 7C C5 D9 45 08 51 8B CE D9 1C 24 E8 ? ? ? ? 8A 86");
struct FramerateVigilanteHook1
pattern = hook::pattern("F3 0F 58 0D ? ? ? ? 0F 5B C0 F3 0F 11 0D");
struct LoadingTextSparks
{
void operator()(injector::reg_pack& regs)
{
regs.edi = *(uint32_t*)(regs.esi + 0xFD4);
*(float*)(regs.ebp + 0x08) = std::clamp(*(float*)(regs.ebp + 0x08), 1.0f / 150.0f, FLT_MAX);
regs.xmm0.f32[0] += 0.085f * *CTimer::fTimeStep;
}
}; injector::MakeInline<FramerateVigilanteHook1>(pattern.get_first(0), pattern.get_first(6));
}; injector::MakeInline<LoadingTextSparks>(pattern.get_first(0), pattern.get_first(8));
}
};
}
Expand Down
8 changes: 7 additions & 1 deletion source/modupdater.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ public:
{
FusionFix::onInitEventAsync() += []()
{
return;
if (FusionFixSettings.Get("PREF_UPDATE"))
Initialize();

FusionFixSettings.SetCallback("PREF_UPDATE", [](int32_t value) {
if (value)
Initialize();
});
};
}
} ModUpdater;
4 changes: 2 additions & 2 deletions source/settings.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -422,15 +422,15 @@ public:
enum eShadowFilterText {
eRadio, eSequential, eShuffle, eSharp, eSoft, eCHSS
};
std::vector<const char*> data = { "Radio", "Sequential", "Shuffle", "Sharp", "Soft", "CHSS",};
std::vector<const char*> data = { "Radio", "Sequential", "Shuffle", "Sharp", "Soft", "CHSS" };
} ShadowFilterText;

struct
{
enum eDofText {
eAuto, e43, e54, e159, e169, eOff, eCutscenesOnly, eLow, eMedium, eHigh, eVeryHigh
};
std::vector<const char*> data = { "Auto", "4:3", "5:4", "15:9", "16:9", "Off", "Cutscenes Only", "Low", "Medium", "High", "Very High"};
std::vector<const char*> data = { "Auto", "4:3", "5:4", "15:9", "16:9", "Off", "Cutscenes Only", "Low", "Medium", "High", "Very High" };
} DofText;

struct
Expand Down
5 changes: 4 additions & 1 deletion source/shaders.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public:

static int nForceShadowFilter = 0;

static bool bSmoothShorelines = true;

FusionFix::onInitEvent() += []()
{
CIniReader iniReader("");
Expand All @@ -90,6 +92,7 @@ public:
fShadowBiasBlendRange = std::clamp(iniReader.ReadFloat("SHADOWS", "ShadowBiasBlendRange", 0.3f), 0.0f, 1.0f);
nForceShadowFilter = std::clamp(iniReader.ReadInteger("SHADOWS", "ForceShadowFilter", 0), 0, 2);
bool bConsoleCarReflectionsAndDirt = iniReader.ReadInteger("MISC", "ConsoleCarReflectionsAndDirt", 1) != 0;
bSmoothShorelines = iniReader.ReadInteger("MISC", "SmoothShorelines", 1) != 0;

// Redirect path to one unified folder
auto pattern = hook::pattern("8B 04 8D ? ? ? ? A3 ? ? ? ? 8B 44 24 04");
Expand Down Expand Up @@ -310,7 +313,7 @@ public:
static auto mblur = FusionFixSettings.GetRef("PREF_MOTIONBLUR");
static float arr3[4];
arr3[0] = (bFixAutoExposure ? 1.0f : 0.0f);
arr3[1] = 0.0f;
arr3[1] = (bSmoothShorelines ? 1.0f : 0.0f);
arr3[2] = static_cast<float>(gamma->get());
arr3[3] = static_cast<float>(mblur->get());
pDevice->SetPixelShaderConstantF(222, &arr3[0], 1);
Expand Down

0 comments on commit 7ba9410

Please sign in to comment.