diff --git a/nier.cpp b/nier.cpp index c02f28c..b0be7f7 100644 --- a/nier.cpp +++ b/nier.cpp @@ -19,8 +19,9 @@ sk::ParameterFactory far_factory; -iSK_INI* far_prefs = nullptr; -sk::ParameterInt* far_gi_workgroups = nullptr; +iSK_INI* far_prefs = nullptr; +wchar_t far_prefs_file [MAX_PATH] = { L'\0' }; +sk::ParameterInt* far_gi_workgroups = nullptr; // (Presumable) Size of compute shader workgroup @@ -30,7 +31,7 @@ extern void __stdcall SK_SetPluginName (std::wstring name); -#define FAR_VERSION_NUM L"0.1.0" +#define FAR_VERSION_NUM L"0.1.1" #define FAR_VERSION_STR L"FAR v " FAR_VERSION_NUM @@ -176,8 +177,6 @@ SK_FAR_InitPlugin (void) if (far_prefs == nullptr) { - wchar_t far_prefs_file [MAX_PATH] = { L'\0' }; - lstrcatW (far_prefs_file, SK_GetConfigPath ()); lstrcatW (far_prefs_file, L"FAR.ini"); @@ -192,7 +191,7 @@ SK_FAR_InitPlugin (void) L"FAR.Lighting", L"GlobalIlluminationWorkgroups" ); - if ( far_prefs->get_section (L"FAR.Lighting").contains_key (L"GlobalIlluminationWorkgroups") ) + if (far_gi_workgroups->load ()) __FAR_GlobalIllumWorkGroupSize = far_gi_workgroups->get_value (); far_gi_workgroups->set_value (__FAR_GlobalIllumWorkGroupSize); @@ -220,14 +219,55 @@ void __stdcall SK_FAR_ControlPanel (void) { - if (ImGui::CollapsingHeader("NieR: Automata")) + bool changed = false; + + if (ImGui::CollapsingHeader("NieR: Automata", ImGuiTreeNodeFlags_DefaultOpen)) { - if (ImGui::SliderInt ("Global Illumination Workgroup Size", &__FAR_GlobalIllumWorkGroupSize, 0, 128)) + int quality = 0; + + if (__FAR_GlobalIllumWorkGroupSize < 16) + quality = 0; + else if (__FAR_GlobalIllumWorkGroupSize < 32) + quality = 1; + else if (__FAR_GlobalIllumWorkGroupSize < 128) + quality = 2; + else + quality = 3; + + if ( ImGui::Combo ( "Global Illumination Quality", &quality, "Off (High Performance)\0" + "Low\0" + "Medium\0" + "High (Game Default)\0\0", 4 ) ) { - if (__FAR_GlobalIllumWorkGroupSize % 16 > 0) - __FAR_GlobalIllumWorkGroupSize += 16 - (__FAR_GlobalIllumWorkGroupSize % 16); + changed = true; + + switch (quality) + { + case 0: + __FAR_GlobalIllumWorkGroupSize = 0; + break; + + case 1: + __FAR_GlobalIllumWorkGroupSize = 16; + break; + + case 2: + __FAR_GlobalIllumWorkGroupSize = 32; + break; + + default: + case 3: + __FAR_GlobalIllumWorkGroupSize = 128; + break; + } } + + far_gi_workgroups->set_value (__FAR_GlobalIllumWorkGroupSize); + far_gi_workgroups->store (); } + + if (changed) + far_prefs->write (far_prefs_file); } bool @@ -235,4 +275,4 @@ __stdcall SK_FAR_IsPlugIn (void) { return far_prefs != nullptr; -} \ No newline at end of file +}