DS2Revival/mods/common/gfxcfg.h

26 lines
1.3 KiB
C++

// The Remix-profile test DS2Widescreen and DS2Graphics both make (they must agree).
//
// [Graphics] Renderer=auto (default) | remix | d3d9 (older files: [Display]). NVIDIA RTX Remix replaces d3d9.dll and keeps
// its 64-bit renderer in a ".trex" folder beside the game exe; auto = remix when ".trex\NvRemixBridge.exe" is there. The Remix
// profile leaves the Direct3D device to DS2Widescreen's remix.cpp alone: DS2Graphics does nothing in it. Renderer selects the
// d3d9 path for both plugins, so it lives in [Graphics] with the other GPU options (the Remix* keys of remix.cpp, which only
// DS2Widescreen reads, sit there too).
#pragma once
#include "patch.h"
namespace ds2 {
// renderer = the [Graphics] Renderer value (each plugin reads the key itself; the settings test scans the plugin sources).
inline bool RemixProfile(const char* r) {
if (_stricmp(r, "remix") == 0) return true;
if (_stricmp(r, "auto") != 0) return false;
char path[MAX_PATH];
DWORD n = GetModuleFileNameA(nullptr, path, MAX_PATH);
char* slash = n && n < MAX_PATH ? std::strrchr(path, '\\') : nullptr;
if (!slash) return false;
*slash = '\0';
strncat_s(path, "\\.trex\\NvRemixBridge.exe", _TRUNCATE);
return GetFileAttributesA(path) != INVALID_FILE_ATTRIBUTES;
}
} // namespace ds2