Reshade dependency update
This commit is contained in:
55
external/reshade/include/reshade.hpp
vendored
55
external/reshade/include/reshade.hpp
vendored
@@ -8,10 +8,9 @@
|
||||
#include "reshade_events.hpp"
|
||||
#include "reshade_overlay.hpp"
|
||||
#include <charconv>
|
||||
#include <Windows.h>
|
||||
|
||||
// Current version of the ReShade API
|
||||
#define RESHADE_API_VERSION 17
|
||||
#define RESHADE_API_VERSION 18
|
||||
|
||||
// Optionally import ReShade API functions when 'RESHADE_API_LIBRARY' is defined instead of using header-only mode
|
||||
#if defined(RESHADE_API_LIBRARY) || defined(RESHADE_API_LIBRARY_EXPORT)
|
||||
@@ -23,26 +22,26 @@
|
||||
#define RESHADE_API_LIBRARY_DECL extern "C" __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeLogMessage(HMODULE module, int level, const char *message);
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeLogMessage(void *module, int level, const char *message);
|
||||
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeGetBasePath(char *path, size_t *path_size);
|
||||
|
||||
RESHADE_API_LIBRARY_DECL bool ReShadeGetConfigValue(HMODULE module, reshade::api::effect_runtime *runtime, const char *section, const char *key, char *value, size_t *value_size);
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeSetConfigValue(HMODULE module, reshade::api::effect_runtime *runtime, const char *section, const char *key, const char *value);
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeSetConfigArray(HMODULE module, reshade::api::effect_runtime *runtime, const char *section, const char *key, const char *value, size_t value_size);
|
||||
RESHADE_API_LIBRARY_DECL bool ReShadeGetConfigValue(void *module, reshade::api::effect_runtime *runtime, const char *section, const char *key, char *value, size_t *value_size);
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeSetConfigValue(void *module, reshade::api::effect_runtime *runtime, const char *section, const char *key, const char *value);
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeSetConfigArray(void *module, reshade::api::effect_runtime *runtime, const char *section, const char *key, const char *value, size_t value_size);
|
||||
|
||||
RESHADE_API_LIBRARY_DECL bool ReShadeRegisterAddon(HMODULE module, uint32_t api_version);
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeUnregisterAddon(HMODULE module);
|
||||
RESHADE_API_LIBRARY_DECL bool ReShadeRegisterAddon(void *module, uint32_t api_version);
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeUnregisterAddon(void *module);
|
||||
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeRegisterEvent(reshade::addon_event ev, void *callback);
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeRegisterEventForAddon(HMODULE module, reshade::addon_event ev, void *callback);
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeRegisterEventForAddon(void *module, reshade::addon_event ev, void *callback);
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeUnregisterEvent(reshade::addon_event ev, void *callback);
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeUnregisterEventForAddon(HMODULE module, reshade::addon_event ev, void *callback);
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeUnregisterEventForAddon(void *module, reshade::addon_event ev, void *callback);
|
||||
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeRegisterOverlay(const char *title, void(*callback)(reshade::api::effect_runtime *runtime));
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeRegisterOverlayForAddon(HMODULE module, const char *title, void(*callback)(reshade::api::effect_runtime *runtime));
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeRegisterOverlayForAddon(void *module, const char *title, void(*callback)(reshade::api::effect_runtime *runtime));
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeUnregisterOverlay(const char *title, void(*callback)(reshade::api::effect_runtime *runtime));
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeUnregisterOverlayForAddon(HMODULE module, const char *title, void(*callback)(reshade::api::effect_runtime *runtime));
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeUnregisterOverlayForAddon(void *module, const char *title, void(*callback)(reshade::api::effect_runtime *runtime));
|
||||
|
||||
RESHADE_API_LIBRARY_DECL bool ReShadeCreateEffectRuntime(reshade::api::device_api api, void *opaque_device, void *opaque_command_queue, void *opaque_swapchain, const char *config_path, reshade::api::effect_runtime **out_runtime);
|
||||
RESHADE_API_LIBRARY_DECL void ReShadeDestroyEffectRuntime(reshade::api::effect_runtime *runtime);
|
||||
@@ -50,6 +49,8 @@ RESHADE_API_LIBRARY_DECL void ReShadeUpdateAndPresentEffectRuntime(reshade::api:
|
||||
|
||||
#else
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
// Use the kernel32 variant of module enumeration functions so it can be safely called from 'DllMain'
|
||||
extern "C" BOOL WINAPI K32EnumProcessModules(HANDLE hProcess, HMODULE *lphModule, DWORD cb, LPDWORD lpcbNeeded);
|
||||
|
||||
@@ -133,7 +134,7 @@ namespace reshade
|
||||
#if defined(RESHADE_API_LIBRARY)
|
||||
ReShadeLogMessage(nullptr, static_cast<int>(level), message);
|
||||
#else
|
||||
static const auto func = reinterpret_cast<void(*)(HMODULE, int, const char *)>(
|
||||
static const auto func = reinterpret_cast<void(*)(void *, int, const char *)>(
|
||||
GetProcAddress(internal::get_reshade_module_handle(), "ReShadeLogMessage"));
|
||||
func(internal::get_current_module_handle(), static_cast<int>(level), message);
|
||||
#endif
|
||||
@@ -172,7 +173,7 @@ namespace reshade
|
||||
#if defined(RESHADE_API_LIBRARY)
|
||||
return ReShadeGetConfigValue(nullptr, runtime, section, key, value, value_size);
|
||||
#else
|
||||
static const auto func = reinterpret_cast<bool(*)(HMODULE, api::effect_runtime *, const char *, const char *, char *, size_t *)>(
|
||||
static const auto func = reinterpret_cast<bool(*)(void *, api::effect_runtime *, const char *, const char *, char *, size_t *)>(
|
||||
GetProcAddress(internal::get_reshade_module_handle(), "ReShadeGetConfigValue"));
|
||||
return func(internal::get_current_module_handle(), runtime, section, key, value, value_size);
|
||||
#endif
|
||||
@@ -210,7 +211,7 @@ namespace reshade
|
||||
#if defined(RESHADE_API_LIBRARY)
|
||||
ReShadeSetConfigValue(nullptr, runtime, section, key, value);
|
||||
#else
|
||||
static const auto func = reinterpret_cast<void(*)(HMODULE, api::effect_runtime *, const char *, const char *, const char *)>(
|
||||
static const auto func = reinterpret_cast<void(*)(void *, api::effect_runtime *, const char *, const char *, const char *)>(
|
||||
GetProcAddress(internal::get_reshade_module_handle(), "ReShadeSetConfigValue"));
|
||||
func(internal::get_current_module_handle(), runtime, section, key, value);
|
||||
#endif
|
||||
@@ -234,7 +235,7 @@ namespace reshade
|
||||
#if defined(RESHADE_API_LIBRARY)
|
||||
ReShadeSetConfigArray(nullptr, runtime, section, key, value, value_size);
|
||||
#else
|
||||
static const auto func = reinterpret_cast<void(*)(HMODULE, api::effect_runtime *, const char *, const char *, const char *, size_t)>(
|
||||
static const auto func = reinterpret_cast<void(*)(void *, api::effect_runtime *, const char *, const char *, const char *, size_t)>(
|
||||
GetProcAddress(internal::get_reshade_module_handle(), "ReShadeSetConfigArray"));
|
||||
func(internal::get_current_module_handle(), runtime, section, key, value, value_size);
|
||||
#endif
|
||||
@@ -246,26 +247,26 @@ namespace reshade
|
||||
/// </summary>
|
||||
/// <param name="addon_module">Handle of the current module.</param>
|
||||
/// <param name="reshade_module">Handle of the ReShade module in the process, or <see langword="nullptr"/> to find it automatically.</param>
|
||||
inline bool register_addon(HMODULE addon_module, [[maybe_unused]] HMODULE reshade_module = nullptr)
|
||||
inline bool register_addon(void *addon_module, [[maybe_unused]] void *reshade_module = nullptr)
|
||||
{
|
||||
#if defined(RESHADE_API_LIBRARY)
|
||||
return ReShadeRegisterAddon(addon_module, RESHADE_API_VERSION);
|
||||
#else
|
||||
addon_module = internal::get_current_module_handle(addon_module);
|
||||
reshade_module = internal::get_reshade_module_handle(reshade_module);
|
||||
addon_module = internal::get_current_module_handle(static_cast<HMODULE>(addon_module));
|
||||
reshade_module = internal::get_reshade_module_handle(static_cast<HMODULE>(reshade_module));
|
||||
|
||||
if (reshade_module == nullptr)
|
||||
return false;
|
||||
|
||||
const auto func = reinterpret_cast<bool(*)(HMODULE, uint32_t)>(
|
||||
GetProcAddress(reshade_module, "ReShadeRegisterAddon"));
|
||||
const auto func = reinterpret_cast<bool(*)(void *, uint32_t)>(
|
||||
GetProcAddress(static_cast<HMODULE>(reshade_module), "ReShadeRegisterAddon"));
|
||||
// Check that the ReShade module supports the used API
|
||||
if (func == nullptr || !func(addon_module, RESHADE_API_VERSION))
|
||||
return false;
|
||||
|
||||
#if defined(IMGUI_VERSION_NUM)
|
||||
const auto imgui_func = reinterpret_cast<const imgui_function_table *(*)(uint32_t)>(
|
||||
GetProcAddress(reshade_module, "ReShadeGetImGuiFunctionTable"));
|
||||
GetProcAddress(static_cast<HMODULE>(reshade_module), "ReShadeGetImGuiFunctionTable"));
|
||||
// Check that the ReShade module was built with Dear ImGui support and supports the used version
|
||||
if (imgui_func == nullptr || !(imgui_function_table_instance() = imgui_func(IMGUI_VERSION_NUM)))
|
||||
return false;
|
||||
@@ -280,19 +281,19 @@ namespace reshade
|
||||
/// </summary>
|
||||
/// <param name="addon_module">Handle of the current module.</param>
|
||||
/// <param name="reshade_module">Handle of the ReShade module in the process, or <see langword="nullptr"/> to find it automatically.</param>
|
||||
inline void unregister_addon(HMODULE addon_module, [[maybe_unused]] HMODULE reshade_module = nullptr)
|
||||
inline void unregister_addon(void *addon_module, [[maybe_unused]] void *reshade_module = nullptr)
|
||||
{
|
||||
#if defined(RESHADE_API_LIBRARY)
|
||||
ReShadeUnregisterAddon(addon_module);
|
||||
#else
|
||||
addon_module = internal::get_current_module_handle(addon_module);
|
||||
reshade_module = internal::get_reshade_module_handle(reshade_module);
|
||||
addon_module = internal::get_current_module_handle(static_cast<HMODULE>(addon_module));
|
||||
reshade_module = internal::get_reshade_module_handle(static_cast<HMODULE>(reshade_module));
|
||||
|
||||
if (reshade_module == nullptr)
|
||||
return;
|
||||
|
||||
const auto func = reinterpret_cast<bool(*)(HMODULE)>(
|
||||
GetProcAddress(reshade_module, "ReShadeUnregisterAddon"));
|
||||
const auto func = reinterpret_cast<bool(*)(void *)>(
|
||||
GetProcAddress(static_cast<HMODULE>(reshade_module), "ReShadeUnregisterAddon"));
|
||||
if (func != nullptr)
|
||||
func(addon_module);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user