Add -noenumerate arg to play it safe by skipping device enumeration for video and sound drivers.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5922 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2021-07-01 01:15:52 +00:00
parent be25f43c89
commit 2ce0947948
2 changed files with 6 additions and 3 deletions

View File

@ -2456,6 +2456,7 @@ static void R_UpdateRendererOptsNow(int iarg, void *data)
struct videnumctx_s e = {NULL};
size_t i;
struct sortedrenderers_s sorted[countof(rendererinfo)];
qboolean safe = COM_CheckParm("-noenumerate") || COM_CheckParm("-safe");
if (!rendereroptsupdated)
return; //multiple got queued...
rendereroptsupdated = false;
@ -2478,7 +2479,7 @@ static void R_UpdateRendererOptsNow(int iarg, void *data)
if (r->rtype == QR_HEADLESS || r->rtype == QR_NONE)
continue; //skip these, they're kinda dangerous.
e.apiname = r->name[0];
if (!r->VID_EnumerateDevices || !r->VID_EnumerateDevices(&e, R_DeviceEnumerated))
if (safe || !r->VID_EnumerateDevices || !r->VID_EnumerateDevices(&e, R_DeviceEnumerated))
R_DeviceEnumerated(&e, r->name[0], "", r->description);
}
}

View File

@ -2070,6 +2070,8 @@ void S_EnumerateDevices(void)
{
int i;
sounddriver_t *sd;
qboolean safe = COM_CheckParm("-noenumerate") || COM_CheckParm("-safe");
Cvar_ForceSet(&snd_device_opts, "");
S_EnumeratedOutDevice("", NULL, "Default");
S_EnumeratedOutDevice("none", NULL, "None");
@ -2079,7 +2081,7 @@ void S_EnumerateDevices(void)
sd = outputdrivers[i];
if (sd && sd->name)
{
if (!sd->Enumerate || !sd->Enumerate(S_EnumeratedOutDevice))
if (safe || !sd->Enumerate || !sd->Enumerate(S_EnumeratedOutDevice))
S_EnumeratedOutDevice(sd->name, "", va("Default %s", sd->name));
}
}
@ -2091,7 +2093,7 @@ void S_EnumerateDevices(void)
{
if (!capturedrivers[i]->Init)
continue;
if (!capturedrivers[i]->Enumerate || !capturedrivers[i]->Enumerate(S_Voip_EnumeratedCaptureDevice))
if (safe || !capturedrivers[i]->Enumerate || !capturedrivers[i]->Enumerate(S_Voip_EnumeratedCaptureDevice))
S_Voip_EnumeratedCaptureDevice(capturedrivers[i]->drivername, NULL, va("Default %s", capturedrivers[i]->drivername));
}
#endif