Delegate ultrawide fix init to reshade present event
This commit is contained in:
@@ -13,6 +13,7 @@ typedef void (*SetFloatFn)(GameSetting, float);
|
||||
|
||||
static HMODULE fixLib = nullptr;
|
||||
static LONG g_coreInitialized = 0;
|
||||
static LONG g_Patched = 0;
|
||||
static SetBoolFn SetFixEnabled = nullptr;
|
||||
static SetFixesFn SetFixes = nullptr;
|
||||
static SetFloatFn SetValues = nullptr;
|
||||
@@ -79,9 +80,7 @@ static void LoadFixDLL(reshade::api::effect_runtime* runtime) {
|
||||
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
|
||||
if (SetFixes) {
|
||||
SetFixes(GameFixes::FOV, fov_fix_enabled);
|
||||
SetFixes(GameFixes::UltraWide, ultrawide_fix_enabled);
|
||||
SetFixes(GameFixes::Camera, camera_fix_enabled);
|
||||
SetFixes(GameFixes::None, false);
|
||||
}
|
||||
|
||||
sliders[0] = { "In game additional FOV", "##FOVValue", SliderType::Int, &worldFOVvalue, -20, 50, GameSetting::FOV, SetValues };
|
||||
@@ -229,6 +228,16 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) {
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
static void on_present(reshade::api::command_queue* queue, reshade::api::swapchain* swapchain,
|
||||
const reshade::api::rect* source_rect, const reshade::api::rect* dest_rect,
|
||||
uint32_t dirty_rect_count, const reshade::api::rect* dirty_rects) {
|
||||
if (InterlockedCompareExchange(&g_Patched, 1, 0) != 0) return;
|
||||
if (SetFixes) {
|
||||
SetFixes(GameFixes::UltraWide, true);
|
||||
SetFixes(GameFixes::None, false);
|
||||
}
|
||||
}
|
||||
|
||||
// Main dll intrance
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID) {
|
||||
switch (ul_reason_for_call) {
|
||||
@@ -238,10 +247,12 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID) {
|
||||
LoadSettings();
|
||||
|
||||
reshade::register_overlay("Death Stranding 2: On The Beach", &on_overlay_draw);
|
||||
reshade::register_event<reshade::addon_event::present>(&on_present);
|
||||
reshade::register_event<reshade::addon_event::init_effect_runtime>(&LoadFixDLL);
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
reshade::unregister_overlay("Death Stranding 2: On The Beach", &on_overlay_draw);
|
||||
reshade::unregister_event<reshade::addon_event::present>(&on_present);
|
||||
reshade::unregister_event<reshade::addon_event::init_effect_runtime>(&LoadFixDLL);
|
||||
reshade::unregister_addon(hinstDLL);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user