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

View file

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