Set render adapter for virtual display driver w/ show detailed virtual display driver status on config
This commit is contained in:
@@ -5,6 +5,10 @@
|
||||
#include <initguid.h>
|
||||
#include <combaseapi.h>
|
||||
#include <thread>
|
||||
|
||||
#include <wrl/client.h>
|
||||
#include <dxgi.h>
|
||||
|
||||
#include "virtual_display.h"
|
||||
|
||||
using namespace SUDOVDA;
|
||||
@@ -163,6 +167,38 @@ bool startPingThread(std::function<void()> failCb) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool setRenderAdapterByName(const std::wstring& adapterName) {
|
||||
if (SUDOVDA_DRIVER_HANDLE == INVALID_HANDLE_VALUE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Microsoft::WRL::ComPtr<IDXGIFactory1> factory;
|
||||
if (!SUCCEEDED(CreateDXGIFactory1(IID_PPV_ARGS(&factory)))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Microsoft::WRL::ComPtr<IDXGIAdapter> adapter;
|
||||
DXGI_ADAPTER_DESC desc;
|
||||
int i = 0;
|
||||
while (SUCCEEDED(factory->EnumAdapters(i, &adapter))) {
|
||||
i += 1;
|
||||
|
||||
if (!SUCCEEDED(adapter->GetDesc(&desc))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (std::wstring_view(desc.Description) != adapterName) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (SetRenderAdapter(SUDOVDA_DRIVER_HANDLE, desc.AdapterLuid)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::wstring createVirtualDisplay(
|
||||
const char* s_client_uid,
|
||||
const char* s_client_name,
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace VDISPLAY {
|
||||
void closeVDisplayDevice();
|
||||
DRIVER_STATUS openVDisplayDevice();
|
||||
bool startPingThread(std::function<void()> failCb);
|
||||
bool setRenderAdapterByName(const std::wstring& adapterName);
|
||||
std::wstring createVirtualDisplay(
|
||||
const char* s_client_uid,
|
||||
const char* s_client_name,
|
||||
|
||||
@@ -16,7 +16,7 @@ BEGIN
|
||||
BEGIN
|
||||
BLOCK "040904E4"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "YukiWorkshop\0"
|
||||
VALUE "CompanyName", "SudoMaker\0"
|
||||
VALUE "FileDescription", "Apollo\0"
|
||||
VALUE "FileVersion", "@PROJECT_VERSION@\0"
|
||||
VALUE "InternalName", "Apollo\0"
|
||||
|
||||
Reference in New Issue
Block a user