mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 09:40:06 +00:00
(menu_shader.c) Refactor away some strcmp usage
This commit is contained in:
parent
d70d838ab1
commit
068f3cf8bc
@ -191,6 +191,10 @@ extern "C" {
|
||||
#define MENU_VALUE_DIR 0x0af95f55U
|
||||
#define MENU_VALUE_NO_CORE 0x7d5472cbU
|
||||
#define MENU_VALUE_DETECT 0xab8da89eU
|
||||
#define MENU_VALUE_GLSLP 0x0f840c87U
|
||||
#define MENU_VALUE_CGP 0x0b8865bfU
|
||||
#define MENU_VALUE_GLSL 0x7c976537U
|
||||
#define MENU_VALUE_CG 0x0059776fU
|
||||
|
||||
#define MENU_LABEL_CONTENT_ACTIONS 0xa0d76970U
|
||||
#define MENU_LABEL_DETECT_CORE_LIST 0xaa07c341U
|
||||
|
@ -18,8 +18,10 @@
|
||||
|
||||
#include <compat/strl.h>
|
||||
#include <file/file_path.h>
|
||||
#include <rhash.h>
|
||||
|
||||
#include "menu.h"
|
||||
#include "menu_hash.h"
|
||||
#include "menu_shader.h"
|
||||
#include "menu_setting.h"
|
||||
#include "../configuration.h"
|
||||
@ -32,6 +34,7 @@
|
||||
void menu_shader_manager_init(menu_handle_t *menu)
|
||||
{
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
uint32_t ext_hash;
|
||||
char preset_path[PATH_MAX_LENGTH];
|
||||
const char *ext = NULL;
|
||||
struct video_shader *shader = NULL;
|
||||
@ -71,8 +74,12 @@ void menu_shader_manager_init(menu_handle_t *menu)
|
||||
}
|
||||
|
||||
ext = path_get_extension(settings->video.shader_path);
|
||||
if (strcmp(ext, "glslp") == 0 || strcmp(ext, "cgp") == 0)
|
||||
ext_hash = djb2_calculate(ext);
|
||||
|
||||
switch (ext_hash)
|
||||
{
|
||||
case MENU_VALUE_GLSLP:
|
||||
case MENU_VALUE_CGP:
|
||||
conf = config_file_new(settings->video.shader_path);
|
||||
if (conf)
|
||||
{
|
||||
@ -83,14 +90,14 @@ void menu_shader_manager_init(menu_handle_t *menu)
|
||||
}
|
||||
config_file_free(conf);
|
||||
}
|
||||
}
|
||||
else if (strcmp(ext, "glsl") == 0 || strcmp(ext, "cg") == 0)
|
||||
{
|
||||
break;
|
||||
case MENU_VALUE_GLSL:
|
||||
case MENU_VALUE_CG:
|
||||
strlcpy(shader->pass[0].source.path, settings->video.shader_path,
|
||||
sizeof(shader->pass[0].source.path));
|
||||
shader->passes = 1;
|
||||
}
|
||||
else
|
||||
break;
|
||||
default:
|
||||
{
|
||||
const char *shader_dir = *settings->video.shader_dir ?
|
||||
settings->video.shader_dir : settings->system_directory;
|
||||
@ -114,6 +121,8 @@ void menu_shader_manager_init(menu_handle_t *menu)
|
||||
config_file_free(conf);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user