mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-09-22 21:35:51 +00:00
Enable info level logs by default
also truncate logs, it might make some older games harder to debug but will deal with that when we get there
This commit is contained in:
@@ -3,38 +3,40 @@
|
||||
|
||||
namespace nvd {
|
||||
NvAPI_Status __cdecl NvAPI_Initialize() {
|
||||
IDXGIFactory1* pFactory = nullptr;
|
||||
if (FAILED(CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&pFactory))) {
|
||||
spdlog::error("Failed to create DXGI Factory");
|
||||
return Error();
|
||||
}
|
||||
if (!deviceId) {
|
||||
IDXGIFactory1* pFactory = nullptr;
|
||||
if (FAILED(CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&pFactory))) {
|
||||
spdlog::error("Failed to create DXGI Factory");
|
||||
return Error();
|
||||
}
|
||||
|
||||
IDXGIAdapter1* pAdapter = nullptr;
|
||||
if (FAILED(pFactory->EnumAdapters1(0, &pAdapter))) {
|
||||
spdlog::error("Failed to enumerate adapters");
|
||||
pFactory->Release();
|
||||
return Error();
|
||||
}
|
||||
IDXGIAdapter1* pAdapter = nullptr;
|
||||
if (FAILED(pFactory->EnumAdapters1(0, &pAdapter))) {
|
||||
spdlog::error("Failed to enumerate adapters");
|
||||
pFactory->Release();
|
||||
return Error();
|
||||
}
|
||||
|
||||
DXGI_ADAPTER_DESC1 adapterDesc;
|
||||
if (FAILED(pAdapter->GetDesc1(&adapterDesc))) {
|
||||
spdlog::error("Failed to get adapter description");
|
||||
pAdapter->Release();
|
||||
pFactory->Release();
|
||||
return Error();
|
||||
}
|
||||
|
||||
luid = adapterDesc.AdapterLuid;
|
||||
deviceId = adapterDesc.DeviceId;
|
||||
vendorId = adapterDesc.VendorId;
|
||||
subSysId = adapterDesc.SubSysId;
|
||||
revisionId = adapterDesc.Revision;
|
||||
|
||||
DXGI_ADAPTER_DESC1 adapterDesc;
|
||||
if (FAILED(pAdapter->GetDesc1(&adapterDesc))) {
|
||||
spdlog::error("Failed to get adapter description");
|
||||
pAdapter->Release();
|
||||
pFactory->Release();
|
||||
return Error();
|
||||
|
||||
lowlatency_ctx.init_lfx();
|
||||
}
|
||||
|
||||
luid = adapterDesc.AdapterLuid;
|
||||
deviceId = adapterDesc.DeviceId;
|
||||
vendorId = adapterDesc.VendorId;
|
||||
subSysId = adapterDesc.SubSysId;
|
||||
revisionId = adapterDesc.Revision;
|
||||
|
||||
pAdapter->Release();
|
||||
pFactory->Release();
|
||||
|
||||
lowlatency_ctx.init_lfx();
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace nvd {
|
||||
static auto drsSession = reinterpret_cast<NvDRSSessionHandle>(&drs);
|
||||
static auto drsProfile = reinterpret_cast<NvDRSProfileHandle>(&drs);
|
||||
|
||||
static LUID luid;
|
||||
static UINT deviceId;
|
||||
static UINT vendorId;
|
||||
static UINT subSysId;
|
||||
static UINT revisionId;
|
||||
static LUID luid = {};
|
||||
static UINT deviceId = {};
|
||||
static UINT vendorId = {};
|
||||
static UINT subSysId = {};
|
||||
static UINT revisionId = {};
|
||||
|
||||
static LowLatency lowlatency_ctx;
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ NvAPI_Status Error(NvAPI_Status status, const std::source_location& location) {
|
||||
void prepareLogging(spdlog::level::level_enum level) {
|
||||
try {
|
||||
if (level != spdlog::level::off) {
|
||||
auto logger = spdlog::basic_logger_mt("basic_logger", "fakenvapi.log");
|
||||
spdlog::set_default_logger(logger);
|
||||
auto logger = spdlog::basic_logger_mt("basic_logger", "fakenvapi.log", true);
|
||||
spdlog::set_default_logger(std::move(logger));
|
||||
if (level == spdlog::level::trace)
|
||||
spdlog::set_pattern("[%H:%M:%S.%f] [%L] [thread %t] %v");
|
||||
else
|
||||
|
||||
@@ -18,11 +18,13 @@
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
|
||||
switch (fdwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
if (get_config(L"fakenvapi", L"enable_log", false))
|
||||
prepareLogging(spdlog::level::trace);
|
||||
if (get_config(L"fakenvapi", L"enable_logs", true))
|
||||
if (get_config(L"fakenvapi", L"enable_trace_logs", false))
|
||||
prepareLogging(spdlog::level::trace);
|
||||
else
|
||||
prepareLogging(spdlog::level::info);
|
||||
else
|
||||
prepareLogging(spdlog::level::off);
|
||||
spdlog::critical("----------------");
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
closeLogging();
|
||||
|
||||
Reference in New Issue
Block a user