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 <initguid.h>
|
||||||
#include <combaseapi.h>
|
#include <combaseapi.h>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
#include <wrl/client.h>
|
||||||
|
#include <dxgi.h>
|
||||||
|
|
||||||
#include "virtual_display.h"
|
#include "virtual_display.h"
|
||||||
|
|
||||||
using namespace SUDOVDA;
|
using namespace SUDOVDA;
|
||||||
@@ -163,6 +167,38 @@ bool startPingThread(std::function<void()> failCb) {
|
|||||||
return true;
|
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(
|
std::wstring createVirtualDisplay(
|
||||||
const char* s_client_uid,
|
const char* s_client_uid,
|
||||||
const char* s_client_name,
|
const char* s_client_name,
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ namespace VDISPLAY {
|
|||||||
void closeVDisplayDevice();
|
void closeVDisplayDevice();
|
||||||
DRIVER_STATUS openVDisplayDevice();
|
DRIVER_STATUS openVDisplayDevice();
|
||||||
bool startPingThread(std::function<void()> failCb);
|
bool startPingThread(std::function<void()> failCb);
|
||||||
|
bool setRenderAdapterByName(const std::wstring& adapterName);
|
||||||
std::wstring createVirtualDisplay(
|
std::wstring createVirtualDisplay(
|
||||||
const char* s_client_uid,
|
const char* s_client_uid,
|
||||||
const char* s_client_name,
|
const char* s_client_name,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ BEGIN
|
|||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "040904E4"
|
BLOCK "040904E4"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "YukiWorkshop\0"
|
VALUE "CompanyName", "SudoMaker\0"
|
||||||
VALUE "FileDescription", "Apollo\0"
|
VALUE "FileDescription", "Apollo\0"
|
||||||
VALUE "FileVersion", "@PROJECT_VERSION@\0"
|
VALUE "FileVersion", "@PROJECT_VERSION@\0"
|
||||||
VALUE "InternalName", "Apollo\0"
|
VALUE "InternalName", "Apollo\0"
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ namespace proc {
|
|||||||
if (vDisplayDriverStatus == VDISPLAY::DRIVER_STATUS::OK) {
|
if (vDisplayDriverStatus == VDISPLAY::DRIVER_STATUS::OK) {
|
||||||
if (!VDISPLAY::startPingThread(onVDisplayWatchdogFailed)) {
|
if (!VDISPLAY::startPingThread(onVDisplayWatchdogFailed)) {
|
||||||
onVDisplayWatchdogFailed();
|
onVDisplayWatchdogFailed();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -249,6 +250,11 @@ namespace proc {
|
|||||||
if (vDisplayDriverStatus == VDISPLAY::DRIVER_STATUS::OK) {
|
if (vDisplayDriverStatus == VDISPLAY::DRIVER_STATUS::OK) {
|
||||||
std::wstring prevPrimaryDisplayName = VDISPLAY::getPrimaryDisplay();
|
std::wstring prevPrimaryDisplayName = VDISPLAY::getPrimaryDisplay();
|
||||||
|
|
||||||
|
// Try set the render adapter matching the capture adapter if user has specified one
|
||||||
|
if (!config::video.adapter_name.empty()) {
|
||||||
|
VDISPLAY::setRenderAdapterByName(platf::from_utf8(config::video.adapter_name));
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(&launch_session->display_guid, &http::uuid, sizeof(GUID));
|
memcpy(&launch_session->display_guid, &http::uuid, sizeof(GUID));
|
||||||
|
|
||||||
std::wstring vdisplayName = VDISPLAY::createVirtualDisplay(
|
std::wstring vdisplayName = VDISPLAY::createVirtualDisplay(
|
||||||
|
|||||||
@@ -132,7 +132,7 @@
|
|||||||
restarted: false,
|
restarted: false,
|
||||||
config: null,
|
config: null,
|
||||||
currentTab: "general",
|
currentTab: "general",
|
||||||
vdisplayStatus: false,
|
vdisplayStatus: "1",
|
||||||
global_prep_cmd: [],
|
global_prep_cmd: [],
|
||||||
tabs: [ // TODO: Move the options to each Component instead, encapsulate.
|
tabs: [ // TODO: Move the options to each Component instead, encapsulate.
|
||||||
{
|
{
|
||||||
@@ -311,7 +311,7 @@
|
|||||||
delete this.config.status;
|
delete this.config.status;
|
||||||
delete this.config.version;
|
delete this.config.version;
|
||||||
|
|
||||||
this.vdisplayStatus = this.config.vdisplayStatus === 'true';
|
this.vdisplayStatus = this.config.vdisplayStatus;
|
||||||
delete this.config.vdisplayStatus;
|
delete this.config.vdisplayStatus;
|
||||||
|
|
||||||
// TODO: let each tab's Component handle it's own data instead of doing it here
|
// TODO: let each tab's Component handle it's own data instead of doing it here
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const config = ref(props.config)
|
|||||||
<div class="form-text">
|
<div class="form-text">
|
||||||
<PlatformLayout :platform="platform">
|
<PlatformLayout :platform="platform">
|
||||||
<template #windows>
|
<template #windows>
|
||||||
{{ $t('config.adapter_name_desc_win') }}<br>
|
{{ $t('config.adapter_name_desc_windows') }}<br>
|
||||||
<pre>tools\dxgi-info.exe</pre>
|
<pre>tools\dxgi-info.exe</pre>
|
||||||
</template>
|
</template>
|
||||||
<template #linux>
|
<template #linux>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { $tp } from '../../../platform-i18n'
|
import { $tp } from '../../../platform-i18n'
|
||||||
import PlatformLayout from '../../../PlatformLayout.vue'
|
import PlatformLayout from '../../../PlatformLayout.vue'
|
||||||
|
|
||||||
@@ -12,6 +12,16 @@ const props = defineProps([
|
|||||||
|
|
||||||
const config = ref(props.config)
|
const config = ref(props.config)
|
||||||
|
|
||||||
|
const sudovdaStatus = {
|
||||||
|
'1': 'Unknown',
|
||||||
|
'0': 'Ready',
|
||||||
|
'-1': 'Uninitialized',
|
||||||
|
'-2': 'Version Incompatible',
|
||||||
|
'-3': 'Watchdog Failed'
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentDriverStatus = computed(() => sudovdaStatus[props.vdisplay])
|
||||||
|
|
||||||
const resIn = ref("")
|
const resIn = ref("")
|
||||||
const fpsIn = ref("")
|
const fpsIn = ref("")
|
||||||
</script>
|
</script>
|
||||||
@@ -25,9 +35,10 @@ const fpsIn = ref("")
|
|||||||
<div class="form-text">{{ $t('config.min_fps_factor_desc') }}</div>
|
<div class="form-text">{{ $t('config.min_fps_factor_desc') }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="alert" :class="[vdisplay ? 'alert-success' : 'alert-warning']">
|
<div class="alert" :class="[vdisplay === '0' ? 'alert-success' : 'alert-warning']">
|
||||||
<label><i class="fa-solid fa-xl fa-circle-info"></i> SudoVDA Driver status: {{vdisplay && "Ready" || "Not Ready"}}</label>
|
<label><i class="fa-solid fa-xl fa-circle-info"></i> SudoVDA Driver status: {{currentDriverStatus}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-text" v-if="vdisplay !== '0'">Please ensure SudoVDA driver is installed to the latest version and enabled properly.</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user