mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-04 04:04:17 +01:00
Modules: return bool to indicate whether the detection is succeeded
This commit is contained in:
+19
-14
@@ -5,14 +5,14 @@
|
||||
#include "modules/vulkan/vulkan.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
void ffPrintVulkan(FFVulkanOptions* options)
|
||||
bool ffPrintVulkan(FFVulkanOptions* options)
|
||||
{
|
||||
const FFVulkanResult* vulkan = ffDetectVulkan();
|
||||
|
||||
if(vulkan->error)
|
||||
{
|
||||
ffPrintError(FF_VULKAN_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "%s", vulkan->error);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(options->moduleArgs.outputFormat.length == 0)
|
||||
@@ -23,21 +23,22 @@ void ffPrintVulkan(FFVulkanOptions* options)
|
||||
{
|
||||
ffStrbufWriteTo(&vulkan->instanceVersion, stdout);
|
||||
puts(" [Software only]");
|
||||
return;
|
||||
}
|
||||
|
||||
if(vulkan->apiVersion.length > 0)
|
||||
else
|
||||
{
|
||||
ffStrbufWriteTo(&vulkan->apiVersion, stdout);
|
||||
if(vulkan->apiVersion.length > 0)
|
||||
{
|
||||
ffStrbufWriteTo(&vulkan->apiVersion, stdout);
|
||||
|
||||
if(vulkan->driver.length > 0)
|
||||
fputs(" - ", stdout);
|
||||
}
|
||||
|
||||
if(vulkan->driver.length > 0)
|
||||
fputs(" - ", stdout);
|
||||
ffStrbufWriteTo(&vulkan->driver, stdout);
|
||||
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
if(vulkan->driver.length > 0)
|
||||
ffStrbufWriteTo(&vulkan->driver, stdout);
|
||||
|
||||
putchar('\n');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -48,6 +49,8 @@ void ffPrintVulkan(FFVulkanOptions* options)
|
||||
FF_FORMAT_ARG(vulkan->instanceVersion, "instance-version"),
|
||||
}));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffParseVulkanJsonObject(FFVulkanOptions* options, yyjson_val* module)
|
||||
@@ -68,14 +71,14 @@ void ffGenerateVulkanJsonConfig(FFVulkanOptions* options, yyjson_mut_doc* doc, y
|
||||
ffJsonConfigGenerateModuleArgsConfig(doc, module, &options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffGenerateVulkanJsonResult(FF_MAYBE_UNUSED FFVulkanOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
bool ffGenerateVulkanJsonResult(FF_MAYBE_UNUSED FFVulkanOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
{
|
||||
const FFVulkanResult* result = ffDetectVulkan();
|
||||
|
||||
if(result->error)
|
||||
{
|
||||
yyjson_mut_obj_add_str(doc, module, "error", result->error);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
yyjson_mut_val* obj = yyjson_mut_obj_add_obj(doc, module, "result");
|
||||
@@ -123,6 +126,8 @@ void ffGenerateVulkanJsonResult(FF_MAYBE_UNUSED FFVulkanOptions* options, yyjson
|
||||
|
||||
yyjson_mut_obj_add_uint(doc, gpuObj, "deviceId", vulkanGpu->deviceId);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffInitVulkanOptions(FFVulkanOptions* options)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#define FF_VULKAN_MODULE_NAME "Vulkan"
|
||||
|
||||
void ffPrintVulkan(FFVulkanOptions* options);
|
||||
bool ffPrintVulkan(FFVulkanOptions* options);
|
||||
void ffInitVulkanOptions(FFVulkanOptions* options);
|
||||
void ffDestroyVulkanOptions(FFVulkanOptions* options);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user