launcher: avoid crashing with original version of GLUT, move cuInit call into ui.h (function setup in framework.h), allow changing resolution of borderless mode

This commit is contained in:
somewhatlurker
2019-08-05 08:07:23 +10:00
parent fe2828a730
commit f8eefbf6bc
3 changed files with 25 additions and 22 deletions
@@ -257,4 +257,14 @@ void PrependFile(LPCSTR newStr, LPCWSTR fileName)
fileStream.seekg(0, std::ios::beg);
fileStream << outStr;
fileStream.close();
}
}
// used to trick Optimus into switching to the NVIDIA GPU
HMODULE nvcudaModule = LoadLibraryW(L"nvcuda.dll");
// cuInit actually returns a CUresult, but we don't really care about it
void(WINAPI * cuInit)(unsigned int flags) = (void(WINAPI*)(unsigned int flags))GetProcAddress(nvcudaModule, "cuInit");
// needed to close the OpenGL window (freeglut only)
HMODULE glutModule = LoadLibraryW(L"glut32.dll");
void(__stdcall * glutMainLoopEventDynamic)() = (void(__stdcall*)())GetProcAddress(glutModule, "glutMainLoopEventDynamic");