Files
djhackersdev_bemanitools/src/main/util/winerr.c
T
icex2 5f9aaeddf9 feat: nvgpu tool for tweaking nvidia gpu driver settings
An open source re-implementation of the “NvDisplayConfigLDJ"
tool with additional enhancements.

This can be used to tweak your nvidia GPU driver settings to
create custom display timings to address IIDX’s requirement
if expecting proper display timings. This can also be used for
any legacy IIDX versions that even expect very specific display
timings, e.g. 59.95 or 60.05 hz.

Furthermore, creating application profiles allows further tweaks
to important GPU settings such as the current performance mode
setting. This is crucial to ensure the GPU is not going into any
kind of power saving states which results in non-smooth
scrolling during gameplay and micro stuttering that cannot
be measured on application level.
Summary:

Test Plan:
2025-02-07 12:59:28 +01:00

38 lines
989 B
C

#include <windows.h>
#include "util/mem.h"
#include "util/str.h"
#include "util/winerr.h"
char* util_winerr_format_last_error_code()
{
return util_winerr_format_error_code(GetLastError());
}
char* util_winerr_format_error_code(int err_code)
{
// Max size according to docs
char buffer[64 * 1024];
char *buffer_dyn;
DWORD format_flags;
DWORD language_id;
size_t len;
format_flags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS;
language_id = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US);
len = FormatMessageA(format_flags, NULL, err_code, language_id, buffer, sizeof(buffer), NULL);
if (len > 0) {
// Have this on the heap by don't use the dynamic allocation provided by
// the function because it's on a different heap and can't be free'd
// with free()
buffer_dyn = xmalloc(len);
str_cpy(buffer_dyn, len, buffer);
return buffer_dyn;
} else {
return NULL;
}
}