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 2, 2024
2 parents 13dc109 + 0afeeaa commit eb00e66
Show file tree
Hide file tree
Showing 18 changed files with 251 additions and 37 deletions.
13 changes: 11 additions & 2 deletions data/plugins/GTAIV.EFLC.FusionFix.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ ForceNoMemRestrict = 1 // forces -nomemrestrict commandli
ExtraDynamicShadows = 2 // adds some missing shadows | 1: for fences and grates | 2: for fences, grates and vegetation
DynamicShadowForTrees = 1 // replaces static tree shadows with dynamic ones
OverrideCascadeRanges = 1 // increases shadow view distance and improves quality at lower settings
ShadowBlendRange = 0.3 // controls the size of the cascade blending regions | [0.0; 1.0]
ShadowSoftnessBlendRange = 0.3 // size of the cascade blur blending region | [0.0; 1.0]
ShadowBiasBlendRange = 0.3 // size of the cascade bias blending region, needs to be equal to or larger than softness blend | [0.0; 1.0]
ForceShadowFilter = 0 // 0 : shadow filter tied to definition | 1 : force 4 sample filter | 2 : force 16 sample filter
HighResolutionShadows = 0 // doubles cascaded shadowmap resolution, very GPU intensive
HighResolutionNightShadows = 0 // increases night shadows resolution, extremely GPU intensive

[SHADOWFILTERSHARP] // CE-like shadows
ShadowSoftness = 1.5 // controls shadow blur
Expand All @@ -19,6 +19,13 @@ ShadowBias = 5.0 // controls shadow bias, adjust ac
ShadowSoftness = 3.0 // controls shadow blur
ShadowBias = 8.0 // controls shadow bias, adjust according to softness

[SHADOWFILTERCHSS] // CHSS / PCSS
ShadowSoftness = 1.5 // controls minimum shadow blur
ShadowBias = 5.0 // controls shadow bias, adjust according to minimum softness
MaxSoftness = 10.0 // controls maximum shadow blur
LightSize = 500.0 // how quickly the maximum blur is reached
ExtraBias = 2.0 // extra bias for large penumbras

[NIGHTSHADOWS] // WARNING: enabling this option is not recommended
VehicleNightShadows = 0 // 1: with Headlight Shadows option, casts vehicle night shadows and disables player shadow(to avoid bugs), without Headlight Shadows enables shadows cast by vehicles from artificial lights

Expand All @@ -38,6 +45,8 @@ FixAutoExposure = 1 // restores auto exposure from con
TreeAlphaPC = 0.625
TreeAlphaConsole = 4.0
CoronaReflectionIntensity = 1.0 // controls intensity of coronas in reflections
ConsoleCarReflectionsAndDirt = 1
AlwaysDisplayHealthOnReticle = 1

[BudgetedIV]
VehicleBudget = 0 // may cause issues, set to e.g. 260000000 to increase budget limit
Expand Down
9 changes: 5 additions & 4 deletions data/update/TBoGT/common/data/frontend_menus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,9 @@
<options text="360" action="ACTION_NONE" value="12" />
</menupc>
<menupc enum="MENU_DISPLAY_SHADOWFILTER">
<options text="Soft" action="ACTION_NONE" value="1" />
<options text="Sharp" action="ACTION_NONE" value="2" />
<options text="Sharp" action="ACTION_NONE" value="1" />
<options text="Soft" action="ACTION_NONE" value="2" />
<options text="CHSS" action="ACTION_NONE" value="3" />
</menupc>
<menupc enum="MENU_DISPLAY_DOF">
<options text="MO_OFF" action="ACTION_NONE" value="1" />
Expand Down Expand Up @@ -1110,7 +1111,7 @@
<!--optionspc action="MENUOPT_ADJUST" label="MO_DOF" value="PREF_DOF" scaler="2" displayValue="MENU_DISPLAY_ON_OFF" /-->
<optionspc action="MENUOPT_ADJUST" label="MO_VSYNC" value="PREF_VSYNC" scaler="2" displayValue="MENU_DISPLAY_ON_OFF" />
<options action="MENUOPT_NONE" label="" value="PREF_NULL" scaler="0" displayValue="MENU_DISPLAY_NONE" />
<optionspc action="MENUOPT_ADJUST" label="Shadow Filter" value="PREF_SHADOWFILTER" scaler="5" displayValue="MENU_DISPLAY_SHADOWFILTER" />
<optionspc action="MENUOPT_ADJUST" label="Shadow Filter" value="PREF_SHADOWFILTER" scaler="6" displayValue="MENU_DISPLAY_SHADOWFILTER" />
<optionspc action="MENUOPT_ADJUST" label="Sun Shafts" value="PREF_SUNSHAFTS" scaler="2" displayValue="MENU_DISPLAY_ON_OFF" />
<optionspc action="MENUOPT_ADJUST" label="Antialiasing" value="PREF_ANTIALIASING" scaler="8" displayValue="MENU_DISPLAY_ANTIALIASING" />
<optionspc action="MENUOPT_ADJUST" label="FPS Limiter" value="PREF_FPS_LIMIT_PRESET" scaler="15" displayValue="MENU_DISPLAY_FRAMELIMIT" />
Expand Down Expand Up @@ -1164,7 +1165,7 @@
<optionspc action="MENUOPT_ADJUST" label="MO_CARS" value="PREF_DOF" scaler="2" displayValue="MENU_DISPLAY_ON_OFF" />
<optionspc action="MENUOPT_ADJUST" label="MO_VSYNC" value="PREF_VSYNC" scaler="2" displayValue="MENU_DISPLAY_ON_OFF" />
<options action="MENUOPT_NONE" label="" value="PREF_NULL" scaler="0" displayValue="MENU_DISPLAY_NONE" />
<optionspc action="MENUOPT_ADJUST" label="Shadow Filter" value="PREF_SHADOWFILTER" scaler="5" displayValue="MENU_DISPLAY_SHADOWFILTER" />
<optionspc action="MENUOPT_ADJUST" label="Shadow Filter" value="PREF_SHADOWFILTER" scaler="6" displayValue="MENU_DISPLAY_SHADOWFILTER" />
<optionspc action="MENUOPT_ADJUST" label="Sun Shafts" value="PREF_SUNSHAFTS" scaler="2" displayValue="MENU_DISPLAY_ON_OFF" />
<optionspc action="MENUOPT_ADJUST" label="Antialiasing" value="PREF_ANTIALIASING" scaler="8" displayValue="MENU_DISPLAY_ANTIALIASING" />
<optionspc action="MENUOPT_ADJUST" label="FPS Limiter" value="PREF_FPS_LIMIT_PRESET" scaler="15" displayValue="MENU_DISPLAY_FRAMELIMIT" />
Expand Down
9 changes: 5 additions & 4 deletions data/update/TLAD/common/data/frontend_menus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,9 @@
<options text="360" action="ACTION_NONE" value="12" />
</menupc>
<menupc enum="MENU_DISPLAY_SHADOWFILTER">
<options text="Soft" action="ACTION_NONE" value="1" />
<options text="Sharp" action="ACTION_NONE" value="2" />
<options text="Sharp" action="ACTION_NONE" value="1" />
<options text="Soft" action="ACTION_NONE" value="2" />
<options text="CHSS" action="ACTION_NONE" value="3" />
</menupc>
<menupc enum="MENU_DISPLAY_DOF">
<options text="MO_OFF" action="ACTION_NONE" value="1" />
Expand Down Expand Up @@ -1183,7 +1184,7 @@
<!--optionspc action="MENUOPT_ADJUST" label="MO_DOF" value="PREF_DOF" scaler="2" displayValue="MENU_DISPLAY_ON_OFF" /-->
<optionspc action="MENUOPT_ADJUST" label="MO_VSYNC" value="PREF_VSYNC" scaler="2" displayValue="MENU_DISPLAY_ON_OFF" />
<options action="MENUOPT_NONE" label="" value="PREF_NULL" scaler="0" displayValue="MENU_DISPLAY_NONE" />
<optionspc action="MENUOPT_ADJUST" label="Shadow Filter" value="PREF_SHADOWFILTER" scaler="5" displayValue="MENU_DISPLAY_SHADOWFILTER" />
<optionspc action="MENUOPT_ADJUST" label="Shadow Filter" value="PREF_SHADOWFILTER" scaler="6" displayValue="MENU_DISPLAY_SHADOWFILTER" />
<optionspc action="MENUOPT_ADJUST" label="Sun Shafts" value="PREF_SUNSHAFTS" scaler="2" displayValue="MENU_DISPLAY_ON_OFF" />
<optionspc action="MENUOPT_ADJUST" label="Antialiasing" value="PREF_ANTIALIASING" scaler="8" displayValue="MENU_DISPLAY_ANTIALIASING" />
<optionspc action="MENUOPT_ADJUST" label="FPS Limiter" value="PREF_FPS_LIMIT_PRESET" scaler="15" displayValue="MENU_DISPLAY_FRAMELIMIT" />
Expand All @@ -1210,7 +1211,7 @@
<!--optionspc action="MENUOPT_ADJUST" label="MO_DOF" value="PREF_DOF" scaler="2" displayValue="MENU_DISPLAY_ON_OFF" /-->
<optionspc action="MENUOPT_ADJUST" label="MO_VSYNC" value="PREF_VSYNC" scaler="2" displayValue="MENU_DISPLAY_ON_OFF" />
<options action="MENUOPT_NONE" label="" value="PREF_NULL" scaler="0" displayValue="MENU_DISPLAY_NONE" />
<optionspc action="MENUOPT_ADJUST" label="Shadow Filter" value="PREF_SHADOWFILTER" scaler="5" displayValue="MENU_DISPLAY_SHADOWFILTER" />
<optionspc action="MENUOPT_ADJUST" label="Shadow Filter" value="PREF_SHADOWFILTER" scaler="6" displayValue="MENU_DISPLAY_SHADOWFILTER" />
<optionspc action="MENUOPT_ADJUST" label="Sun Shafts" value="PREF_SUNSHAFTS" scaler="2" displayValue="MENU_DISPLAY_ON_OFF" />
<optionspc action="MENUOPT_ADJUST" label="Antialiasing" value="PREF_ANTIALIASING" scaler="8" displayValue="MENU_DISPLAY_ANTIALIASING" />
<optionspc action="MENUOPT_ADJUST" label="FPS Limiter" value="PREF_FPS_LIMIT_PRESET" scaler="15" displayValue="MENU_DISPLAY_FRAMELIMIT" />
Expand Down
9 changes: 5 additions & 4 deletions data/update/common/data/frontend_menus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,9 @@
</menupc>

<menupc enum="MENU_DISPLAY_SHADOWFILTER">
<options text="Soft" action="ACTION_NONE" value="1" />
<options text="Sharp" action="ACTION_NONE" value="2" />
<options text="Sharp" action="ACTION_NONE" value="1" />
<options text="Soft" action="ACTION_NONE" value="2" />
<options text="CHSS" action="ACTION_NONE" value="3" />
</menupc>

<menupc enum="MENU_DISPLAY_DOF">
Expand Down Expand Up @@ -775,7 +776,7 @@
<!--optionspc action="MENUOPT_ADJUST" label="MO_DOF" value="PREF_DOF" scaler="2" displayValue="MENU_DISPLAY_ON_OFF" /-->
<optionspc action="MENUOPT_ADJUST" label="MO_VSYNC" value="PREF_VSYNC" scaler="2" displayValue="MENU_DISPLAY_ON_OFF" />
<options action="MENUOPT_NONE" label="" value="PREF_NULL" scaler="0" displayValue="MENU_DISPLAY_NONE" />
<optionspc action="MENUOPT_ADJUST" label="Shadow Filter" value="PREF_SHADOWFILTER" scaler="5" displayValue="MENU_DISPLAY_SHADOWFILTER" />
<optionspc action="MENUOPT_ADJUST" label="Shadow Filter" value="PREF_SHADOWFILTER" scaler="6" displayValue="MENU_DISPLAY_SHADOWFILTER" />
<optionspc action="MENUOPT_ADJUST" label="Sun Shafts" value="PREF_SUNSHAFTS" scaler="2" displayValue="MENU_DISPLAY_ON_OFF"/>
<optionspc action="MENUOPT_ADJUST" label="Antialiasing" value="PREF_ANTIALIASING" scaler="8" displayValue="MENU_DISPLAY_ANTIALIASING" />
<optionspc action="MENUOPT_ADJUST" label="FPS Limiter" value="PREF_FPS_LIMIT_PRESET" scaler="15" displayValue="MENU_DISPLAY_FRAMELIMIT" />
Expand Down Expand Up @@ -803,7 +804,7 @@
<!--optionspc action="MENUOPT_ADJUST" label="MO_DOF" value="PREF_DOF" scaler="2" displayValue="MENU_DISPLAY_ON_OFF" /-->
<optionspc action="MENUOPT_ADJUST" label="MO_VSYNC" value="PREF_VSYNC" scaler="2" displayValue="MENU_DISPLAY_ON_OFF" />
<options action="MENUOPT_NONE" label="" value="PREF_NULL" scaler="0" displayValue="MENU_DISPLAY_NONE" />
<optionspc action="MENUOPT_ADJUST" label="Shadow Filter" value="PREF_SHADOWFILTER" scaler="5" displayValue="MENU_DISPLAY_SHADOWFILTER" />
<optionspc action="MENUOPT_ADJUST" label="Shadow Filter" value="PREF_SHADOWFILTER" scaler="6" displayValue="MENU_DISPLAY_SHADOWFILTER" />
<optionspc action="MENUOPT_ADJUST" label="Sun Shafts" value="PREF_SUNSHAFTS" scaler="2" displayValue="MENU_DISPLAY_ON_OFF"/>
<optionspc action="MENUOPT_ADJUST" label="Antialiasing" value="PREF_ANTIALIASING" scaler="8" displayValue="MENU_DISPLAY_ANTIALIASING" />
<optionspc action="MENUOPT_ADJUST" label="FPS Limiter" value="PREF_FPS_LIMIT_PRESET" scaler="15" displayValue="MENU_DISPLAY_FRAMELIMIT" />
Expand Down
2 changes: 1 addition & 1 deletion premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ workspace "GTAIV.EFLC.FusionFix"
language "C++"
targetdir "bin/%{cfg.buildcfg}"
targetextension ".asi"
buildoptions { "/dxifcInlineFunctions-" }
buildoptions { "/dxifcInlineFunctions- /Zc:__cplusplus /utf-8" }
staticruntime "On"
characterset ("Unicode")

Expand Down
1 change: 1 addition & 0 deletions source/comvars.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,7 @@ export bool bEnableSnow = false;
export bool bEnableHall = false;
export bool bFixAutoExposure = true;
export bool bHeadlightShadows = false;
export bool bHighResolutionShadows = false;

export inline LONG getWindowWidth()
{
Expand Down
11 changes: 11 additions & 0 deletions source/extrainfo.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ public:
extra += FF_WARN5[0] ? FF_WARN5 : L"~r~WARNING: Detail Distance slider above 31 may cause object pop-in.";
}

if (FusionFixSettings.Get("PREF_SHADOWFILTER") == FusionFixSettings.ShadowFilterText.eCHSS)
{
if (FusionFixSettings.Get("PREF_SHADOW_QUALITY") < 4) // Very High
{
extra += L"~n~";
extra += L" ";
auto FF_WARN6 = CText::getText("FF_WARN6");
extra += FF_WARN6[0] ? FF_WARN6 : L"~r~WARNING: CHSS only takes effect with Shadow Quality set to Very High.";
}
}

regs.eax = (uintptr_t)extra.c_str();
}
});
Expand Down
73 changes: 73 additions & 0 deletions source/fixes.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public:
//[MISC]
bool bDefaultCameraAngleInTLAD = iniReader.ReadInteger("MISC", "DefaultCameraAngleInTLAD", 0) != 0;

bool bAlwaysDisplayHealthOnReticle = iniReader.ReadInteger("MISC", "AlwaysDisplayHealthOnReticle", 0) != 0;

//fix for zoom flag in tbogt
if (nAimingZoomFix)
{
Expand Down Expand Up @@ -448,6 +450,77 @@ public:
// }
// }
// }

// HACK: Visually hide the mouse cursor when using a gamepad, doesn't actually disable the cursor so it might still interact with UI, also still shows in the start menu because...??
{
auto pattern = hook::pattern("75 1B 83 3D ? ? ? ? ? 75 12 6A 00 E8");
if (!pattern.empty())
{
auto ptr = (uintptr_t)hook::get_pattern("C6 05 ? ? ? ? ? 5F 5E 5D 5B 83 C4 2C C3", 7) - (uintptr_t)pattern.get_first(6);
injector::WriteMemory<uint16_t>(pattern.get_first(0), 0x840F, true); // jnz short -> jz long
injector::WriteMemory(pattern.get_first(2), ptr, true);
injector::MakeNOP(pattern.get_first(6), 23, true);
}
}

// 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)
{
auto pattern = hook::pattern("80 3D ? ? ? ? ? 75 64 A1 ? ? ? ? 8B 0C 85");
if (!pattern.empty())
{
static auto loc_5C8E93 = (uintptr_t)pattern.get_first(0);

pattern = hook::pattern("80 BB ? ? ? ? ? 74 61 56 57 E8");
struct ReticleHealthHook
{
void operator()(injector::reg_pack& regs)
{
if (!(*(uint8_t*)(regs.ebx + 12941)) || !(*(uint8_t*)(regs.ebx + 12940)))
*(uintptr_t*)(regs.esp - 4) = loc_5C8E93;
}
}; injector::MakeInline<ReticleHealthHook>(pattern.get_first(0), pattern.get_first(9));

pattern = hook::pattern("75 0C 38 83 ? ? ? ? 0F 84");
injector::WriteMemory<uint8_t>(pattern.get_first(0), 0xEB, true);
}
else
{
static auto loc_5C8E93 = (uintptr_t)hook::get_pattern("80 3D ? ? ? ? ? 75 6A A1 ? ? ? ? 8B 04 85");

pattern = hook::pattern("80 B9 ? ? ? ? ? 74 6D 56 57 E8");
struct ReticleHealthHook
{
void operator()(injector::reg_pack& regs)
{
if (!(*(uint8_t*)(regs.ecx + 12941)) || !(*(uint8_t*)(regs.ecx + 12940)))
*(uintptr_t*)(regs.esp - 4) = loc_5C8E93;
}
}; injector::MakeInline<ReticleHealthHook>(pattern.get_first(0), pattern.get_first(9));

pattern = hook::pattern("75 0C 38 86 ? ? ? ? 0F 84");
injector::WriteMemory<uint8_t>(pattern.get_first(0), 0xEB, true);
}
}

// Radio reset fix
{
auto pattern = hook::pattern("74 ? 85 C9 75 ? 32 C0 50");
if (!pattern.empty())
injector::WriteMemory<uint8_t>(pattern.get_first(0), 0xEB, true); // jz -> jmp
}
};
}
} Fixes;
6 changes: 3 additions & 3 deletions source/settings.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public:
{ 0, "PREF_TIMECYC", "MISC", "ScreenFilter", "MENU_DISPLAY_TIMECYC", 5, nullptr, TimecycText.eMO_DEF, std::distance(std::begin(TimecycText.data), std::end(TimecycText.data)) - 1 },
{ 0, "PREF_WINDOWED", "MAIN", "Windowed", "", 1, nullptr, 0, 1 },
{ 0, "PREF_DEFINITION", "MAIN", "Definition", "", 1, nullptr, 0, 1 },
{ 0, "PREF_SHADOWFILTER", "SHADOWS", "ShadowFilter", "MENU_DISPLAY_SHADOWFILTER", 5, nullptr, ShadowFilterText.eSoft, std::distance(std::begin(ShadowFilterText.data), std::end(ShadowFilterText.data)) - 1 },
{ 0, "PREF_SHADOWFILTER", "SHADOWS", "ShadowFilter", "MENU_DISPLAY_SHADOWFILTER", 3, nullptr, ShadowFilterText.eSharp, std::distance(std::begin(ShadowFilterText.data), std::end(ShadowFilterText.data)) - 1 },
{ 0, "PREF_TREE_LIGHTING", "MISC", "TreeLighting", "MENU_DISPLAY_TREE_LIGHTING", 7, nullptr, TreeFxText.ePC, std::distance(std::begin(TreeFxText.data), std::end(TreeFxText.data)) - 1 },
{ 0, "PREF_TCYC_DOF", "MISC", "DepthOfField", "MENU_DISPLAY_DOF", 7, nullptr, DofText.eOff, std::distance(std::begin(DofText.data), std::end(DofText.data)) - 1 },
{ 0, "PREF_MOTIONBLUR", "MAIN", "MotionBlur", "", 0, nullptr, 0, 1 },
Expand Down Expand Up @@ -420,9 +420,9 @@ public:
struct
{
enum eShadowFilterText {
eRadio, eSequential, eShuffle, eSoft, eSharp
eRadio, eSequential, eShuffle, eSharp, eSoft, eCHSS
};
std::vector<const char*> data = { "Radio", "Sequential", "Shuffle", "Soft", "Sharp", };
std::vector<const char*> data = { "Radio", "Sequential", "Shuffle", "Sharp", "Soft", "CHSS",};
} ShadowFilterText;

struct
Expand Down
Loading

0 comments on commit eb00e66

Please sign in to comment.