Skip to content

Commit

Permalink
Fixed some issues after removing jna
Browse files Browse the repository at this point in the history
  • Loading branch information
mcrcortex authored and mcrcortex committed May 16, 2024
1 parent 149aa6c commit 7181955
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,13 @@ private static void queryAdapterInfo(long fptr, int handle, int type, ByteBuffer
}

public static List<GraphicsAdapterInfo> findAdaptersWindowsD3DKMT() {
//(Its ok to leave open as it is only used once and used by other things)
SharedLibrary gdi32 = Library.loadNative(GraphicsAdapterProbe.class, "org.lwjgl", "gdi32");
long D3DKMTQueryAdapterInfo = apiGetFunctionAddress(gdi32, "D3DKMTQueryAdapterInfo");
long D3DKMTCloseAdapter = apiGetFunctionAddress(gdi32, "D3DKMTCloseAdapter");
long D3DKMTEnumAdapters2 = -1;
try {
D3DKMTEnumAdapters2 = apiGetFunctionAddress(gdi32, "D3DKMTEnumAdapters2");
} catch (UnsatisfiedLinkError e) {
long D3DKMTEnumAdapters2 = apiGetFunctionAddress(gdi32, "D3DKMTEnumAdapters2");
if (D3DKMTQueryAdapterInfo == 0 || D3DKMTCloseAdapter == 0 || D3DKMTEnumAdapters2 == 0) {
//Could not load D3DKMTEnumAdapters2 meaning < windows 8, fallback to cross-platform
gdi32.close();
LOGGER.warn("Unable to find D3DKMTEnumAdapters2. running windows 7 or earlier, using fallback probe");
return findAdaptersCrossPlatform();
}
Expand Down

0 comments on commit 7181955

Please sign in to comment.