Skip to content

Commit

Permalink
update constants
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirteenAG committed Mar 22, 2024
1 parent 5d863d3 commit 1546d10
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 12 deletions.
13 changes: 7 additions & 6 deletions source/settings.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ 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 },
/*UNUSED*/{ 0, "PREF_CUTSCENE_DOF", "MISC", "DistantBlurUnused", "", 1, nullptr, 0, 1 },
{ 0, "PREF_CONSOLE_SHADOWS", "SHADOWS", "ConsoleShadows", "", 1, nullptr, 0, 1 },
{ 0, "PREF_SHADOW_FILTER", "SHADOWS", "ShadowFilter", "MENU_DISPLAY_SHADOWFILTER", 3, nullptr, ShadowFilterText.eSharp, std::distance(std::begin(ShadowFilterText.data), std::end(ShadowFilterText.data)) - 1 },
{ 0, "PREF_BLOOM", "MAIN", "Bloom", "MENU_DISPLAY_BLOOM", 3, nullptr, BloomText.eOff, std::distance(std::begin(BloomText.data), std::end(BloomText.data)) - 1 },
{ 0, "PREF_TREE_LIGHTING", "MISC", "TreeLighting", "MENU_DISPLAY_TREE_LIGHTING", 8, 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 },
{ 0, "PREF_LEDILLUMINATION", "MISC", "LightSyncRGB", "", 0, nullptr, 0, 1 },
{ 0, "PREF_DEFINITION", "MAIN", "Definition", "MENU_DISPLAY_DEFINITION", 6, nullptr, DefinitionText.eClassic, std::distance(std::begin(DefinitionText.data), std::end(DefinitionText.data)) - 1 },
{ 0, "PREF_BLOOM", "MAIN", "Bloom", "", 1, nullptr, 0, 1 },
{ 0, "PREF_PCSS", "SHADOWS", "PCSS", "", 1, nullptr, 0, 1 },
{ 0, "PREF_FPSCOUNTER", "FRAMELIMIT", "DisplayFpsCounter", "", 0, nullptr, 0, 1 },
{ 0, "PREF_ALWAYSRUN", "MISC", "AlwaysRun", "", 0, nullptr, 0, 1 },
{ 0, "PREF_ALTDIALOGUE", "MISC", "AltDialogue", "", 0, nullptr, 0, 1 },
Expand All @@ -166,6 +166,7 @@ public:
{ 0, "PREF_LETTERBOX", "MISC", "Letterbox", "", 1, nullptr, 0, 1 },
{ 0, "PREF_PILLARBOX", "MISC", "Pillarbox", "", 1, nullptr, 0, 1 },
{ 0, "PREF_ANTIALIASING", "MISC", "Antialiasing", "MENU_DISPLAY_ANTIALIASING", 1, nullptr, AntialiasingText.eMO_OFF, std::distance(std::begin(AntialiasingText.data), std::end(AntialiasingText.data)) - 1 },
// Enums are at capacity, to use more enums, replace multiplayer ones. On/Off toggles should still be possible to add.
};

auto i = firstCustomID;
Expand Down Expand Up @@ -343,11 +344,11 @@ public:

struct
{
enum eShadowFilterText {
eRadio, eSequential, eShuffle, eSharp, eSoft, eSofter, eSoftest, PCSS
enum eBloomText {
eRadio, eSequential, eShuffle, eOff, eCross, eCircle
};
std::vector<const char*> data = { "Radio", "Sequential", "Shuffle", "Sharp", "Soft", "Softer", "Softest", "PCSS" };
} ShadowFilterText;
std::vector<const char*> data = { "Radio", "Sequential", "Shuffle", "Off", "Cross", "Circle" };
} BloomText;

struct
{
Expand Down
30 changes: 24 additions & 6 deletions source/shaders.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public:
static UINT oldCascadesHeight = 0;
static IDirect3DTexture9* pHDRTexQuarter = nullptr;
static bool bFixAutoExposure = false;
static auto bFixCascadedShadowMapResolution = false;

FusionFix::onInitEvent() += []()
{
Expand Down Expand Up @@ -126,10 +127,27 @@ public:
// Current Settings
{
static float arr5[4];
arr5[0] = static_cast<float>(FusionFixSettings.Get("PREF_WATER_QUALITY"));
arr5[1] = static_cast<float>(FusionFixSettings.Get("PREF_SHADOW_QUALITY"));
arr5[2] = Natives::Timestep();
arr5[3] = 0.0f;

switch (FusionFixSettings.Get("PREF_WATER_QUALITY"))
{
case 0:
arr5[0] = 2.0f;
break;
case 1:
arr5[0] = 1.0f;
break;
case 2:
arr5[0] = 0.5f;
break;
case 3:
default:
arr5[0] = 0.25f;
break;
}

arr5[1] = static_cast<float>(FusionFixSettings.Get("PREF_PCSS"));
arr5[2] = 1.0f / (30.0f * Natives::Timestep());
arr5[3] = bFixCascadedShadowMapResolution ? 2.0f : 1.0f;
pDevice->SetPixelShaderConstantF(221, &arr5[0], 1);
}

Expand All @@ -156,7 +174,7 @@ public:
static auto definition = FusionFixSettings.GetRef("PREF_DEFINITION");
static float arr4[4];
arr4[0] = static_cast<float>(tree_lighting->get() - FusionFixSettings.TreeFxText.ePC);
arr4[1] = static_cast<float>(shadowFilter->get() - FusionFixSettings.ShadowFilterText.eSharp);
arr4[1] = 0.0f;
arr4[2] = static_cast<float>(definition->get() - FusionFixSettings.DefinitionText.eClassic);
arr4[3] = (((hour == 6 && minute >= 45) || (hour > 6)) && ((hour == 19 && minute < 15) || (hour < 19))) ? 0.0f : 1.0f;
pDevice->SetPixelShaderConstantF(223, &arr4[0], 1);
Expand All @@ -168,7 +186,7 @@ public:
FusionFix::onInitEvent() += []()
{
CIniReader iniReader("");
static auto bFixCascadedShadowMapResolution = iniReader.ReadInteger("SHADOWS", "FixCascadedShadowMapResolution", 0) != 0;
bFixCascadedShadowMapResolution = iniReader.ReadInteger("SHADOWS", "FixCascadedShadowMapResolution", 0) != 0;

static auto bFixRainDrops = iniReader.ReadInteger("MISC", "FixRainDrops", 1) != 0;
static auto nRainDropsBlur = iniReader.ReadInteger("MISC", "RainDropsBlur", 2);
Expand Down

0 comments on commit 1546d10

Please sign in to comment.