diff --git a/Makefile.common b/Makefile.common
index b50813c6f0..b3e7b9b184 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -95,6 +95,7 @@ OBJ += frontend/frontend.o \
ui/drivers/ui_null.o \
libretro_version_1.o \
retroarch.o \
+ retroarch_info.o \
command_event.o \
runloop.o \
runloop_data.o \
diff --git a/griffin/griffin.c b/griffin/griffin.c
index 84924f6599..f9a0d08f2b 100644
--- a/griffin/griffin.c
+++ b/griffin/griffin.c
@@ -655,6 +655,7 @@ RETROARCH
============================================================ */
#include "../libretro_version_1.c"
#include "../retroarch.c"
+#include "../retroarch_info.c"
#include "../runloop.c"
#include "../runloop_data.c"
diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c
index d3940ea451..2a8aae2094 100644
--- a/menu/menu_entries_cbs_deferred_push.c
+++ b/menu/menu_entries_cbs_deferred_push.c
@@ -22,7 +22,6 @@
#include "../file_ext.h"
#include "../retroarch.h"
#include "../settings.h"
-#include "../performance.h"
#ifdef HAVE_LIBRETRODB
#include "../database_info.h"
@@ -170,50 +169,16 @@ static int deferred_push_system_information(void *data, void *userdata,
MENU_SETTINGS_CORE_INFO_NONE, 0);
#endif
- rarch_print_compiler(tmp, sizeof(tmp));
- menu_list_push(list, tmp, "",
- MENU_SETTINGS_CORE_INFO_NONE, 0);
+ rarch_info_get_capabilities(RARCH_CAPABILITIES_COMPILER, tmp, sizeof(tmp));
+ menu_list_push(list, tmp, "", MENU_SETTINGS_CORE_INFO_NONE, 0);
{
char cpu_str[PATH_MAX_LENGTH];
- uint64_t cpu = rarch_get_cpu_features();
snprintf(cpu_str, sizeof(cpu_str), "CPU Features: ");
- if (cpu & RETRO_SIMD_MMX)
- strlcat(cpu_str, "MMX ", sizeof(cpu_str));
- if (cpu & RETRO_SIMD_MMXEXT)
- strlcat(cpu_str, "MMXEXT ", sizeof(cpu_str));
- if (cpu & RETRO_SIMD_SSE)
- strlcat(cpu_str, "SSE1 ", sizeof(cpu_str));
- if (cpu & RETRO_SIMD_SSE2)
- strlcat(cpu_str, "SSE2 ", sizeof(cpu_str));
- if (cpu & RETRO_SIMD_SSE3)
- strlcat(cpu_str, "SSE3 ", sizeof(cpu_str));
- if (cpu & RETRO_SIMD_SSSE3)
- strlcat(cpu_str, "SSSE3 ", sizeof(cpu_str));
- if (cpu & RETRO_SIMD_SSE4)
- strlcat(cpu_str, "SSE4 ", sizeof(cpu_str));
- if (cpu & RETRO_SIMD_SSE42)
- strlcat(cpu_str, "SSE4.2 ", sizeof(cpu_str));
- if (cpu & RETRO_SIMD_AVX)
- strlcat(cpu_str, "AVX ", sizeof(cpu_str));
- if (cpu & RETRO_SIMD_AVX2)
- strlcat(cpu_str, "AVX2 ", sizeof(cpu_str));
- if (cpu & RETRO_SIMD_VFPU)
- strlcat(cpu_str, "VFPU ", sizeof(cpu_str));
- if (cpu & RETRO_SIMD_NEON)
- strlcat(cpu_str, "NEON ", sizeof(cpu_str));
- if (cpu & RETRO_SIMD_PS)
- strlcat(cpu_str, "PS ", sizeof(cpu_str));
- if (cpu & RETRO_SIMD_AES)
- strlcat(cpu_str, "AES ", sizeof(cpu_str));
- if (cpu & RETRO_SIMD_VMX)
- strlcat(cpu_str, "VMX ", sizeof(cpu_str));
- if (cpu & RETRO_SIMD_VMX128)
- strlcat(cpu_str, "VMX128 ", sizeof(cpu_str));
- menu_list_push(list, cpu_str, "",
- MENU_SETTINGS_CORE_INFO_NONE, 0);
+ rarch_info_get_capabilities(RARCH_CAPABILITIES_CPU, cpu_str, sizeof(cpu_str));
+ menu_list_push(list, cpu_str, "", MENU_SETTINGS_CORE_INFO_NONE, 0);
}
if (frontend)
diff --git a/retroarch.c b/retroarch.c
index 684ad25780..f1b4133b82 100644
--- a/retroarch.c
+++ b/retroarch.c
@@ -142,36 +142,6 @@ static void print_features(void)
}
#undef _PSUPP
-/**
- * rarch_print_compiler:
- *
- * Prints compiler that was used for compiling RetroArch.
- **/
-void rarch_print_compiler(char *str, size_t sizeof_str)
-{
-#if defined(_MSC_VER)
- snprintf(str, sizeof_str, "Compiler: MSVC (%d) %u-bit", _MSC_VER, (unsigned)
- (CHAR_BIT * sizeof(size_t)));
-#elif defined(__SNC__)
- snprintf(str, sizeof_str, "Compiler: SNC (%d) %u-bit",
- __SN_VER__, (unsigned)(CHAR_BIT * sizeof(size_t)));
-#elif defined(_WIN32) && defined(__GNUC__)
- snprintf(str, sizeof_str, "Compiler: MinGW (%d.%d.%d) %u-bit",
- __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__, (unsigned)
- (CHAR_BIT * sizeof(size_t)));
-#elif defined(__clang__)
- snprintf(str, sizeof_str, "Compiler: Clang/LLVM (%s) %u-bit",
- __clang_version__, (unsigned)(CHAR_BIT * sizeof(size_t)));
-#elif defined(__GNUC__)
- snprintf(str, sizeof_str, "Compiler: GCC (%d.%d.%d) %u-bit",
- __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__, (unsigned)
- (CHAR_BIT * sizeof(size_t)));
-#else
- snprintf(str, sizeof_str, "Unknown compiler %u-bit",
- (unsigned)(CHAR_BIT * sizeof(size_t)));
-#endif
-}
-
/**
* print_help:
*
@@ -187,7 +157,7 @@ static void print_help(void)
#else
puts(RETRO_FRONTEND ": Frontend for libretro -- v" PACKAGE_VERSION " --");
#endif
- rarch_print_compiler(str, sizeof(str));
+ rarch_info_get_capabilities(RARCH_CAPABILITIES_COMPILER, str, sizeof(str));
fprintf(stdout, "%s", str);
fprintf(stdout, "Built: %s\n", __DATE__);
puts("===================================================================");
@@ -1149,7 +1119,7 @@ int rarch_main_init(int argc, char *argv[])
char str[PATH_MAX_LENGTH];
RARCH_LOG_OUTPUT("=== Build =======================================");
- rarch_print_compiler(str, sizeof(str));
+ rarch_info_get_capabilities(RARCH_CAPABILITIES_CPU, str, sizeof(str));
fprintf(stderr, "%s", str);
fprintf(stderr, "Built: %s\n", __DATE__);
RARCH_LOG_OUTPUT("Version: %s\n", PACKAGE_VERSION);
diff --git a/retroarch.h b/retroarch.h
index 0be81acfd4..845cf0f850 100644
--- a/retroarch.h
+++ b/retroarch.h
@@ -35,6 +35,13 @@ enum action_state
RARCH_ACTION_STATE_FORCE_QUIT,
};
+enum rarch_capabilities
+{
+ RARCH_CAPABILITIES_NONE = 0,
+ RARCH_CAPABILITIES_CPU,
+ RARCH_CAPABILITIES_COMPILER,
+};
+
struct rarch_main_wrap
{
const char *content_path;
@@ -169,12 +176,7 @@ void rarch_set_paths(const char *path);
void set_paths_redirect(const char *path);
-/**
- * rarch_print_compiler:
- *
- * Prints compiler that was used for compiling RetroArch.
- **/
-void rarch_print_compiler(char *str, size_t sizeof_str);
+int rarch_info_get_capabilities(enum rarch_capabilities type, char *s, size_t len);
char orig_savestate_dir[PATH_MAX_LENGTH];
char orig_savefile_dir[PATH_MAX_LENGTH];
diff --git a/retroarch_info.c b/retroarch_info.c
new file mode 100644
index 0000000000..68ce5fde08
--- /dev/null
+++ b/retroarch_info.c
@@ -0,0 +1,92 @@
+/* RetroArch - A frontend for libretro.
+ * Copyright (C) 2011-2015 - Daniel De Matteis
+ *
+ * RetroArch is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Found-
+ * ation, either version 3 of the License, or (at your option) any later version.
+ *
+ * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with RetroArch.
+ * If not, see .
+ */
+
+#include
+
+#include "performance.h"
+#include "retroarch.h"
+
+int rarch_info_get_capabilities(enum rarch_capabilities type, char *s, size_t len)
+{
+ switch (type)
+ {
+ case RARCH_CAPABILITIES_CPU:
+ {
+ uint64_t cpu = rarch_get_cpu_features();
+
+ if (cpu & RETRO_SIMD_MMX)
+ strlcat(s, "MMX ", len);
+ if (cpu & RETRO_SIMD_MMXEXT)
+ strlcat(s, "MMXEXT ", len);
+ if (cpu & RETRO_SIMD_SSE)
+ strlcat(s, "SSE1 ", len);
+ if (cpu & RETRO_SIMD_SSE2)
+ strlcat(s, "SSE2 ", len);
+ if (cpu & RETRO_SIMD_SSE3)
+ strlcat(s, "SSE3 ", len);
+ if (cpu & RETRO_SIMD_SSSE3)
+ strlcat(s, "SSSE3 ", len);
+ if (cpu & RETRO_SIMD_SSE4)
+ strlcat(s, "SSE4 ", len);
+ if (cpu & RETRO_SIMD_SSE42)
+ strlcat(s, "SSE4.2 ", len);
+ if (cpu & RETRO_SIMD_AVX)
+ strlcat(s, "AVX ", len);
+ if (cpu & RETRO_SIMD_AVX2)
+ strlcat(s, "AVX2 ", len);
+ if (cpu & RETRO_SIMD_VFPU)
+ strlcat(s, "VFPU ", len);
+ if (cpu & RETRO_SIMD_NEON)
+ strlcat(s, "NEON ", len);
+ if (cpu & RETRO_SIMD_PS)
+ strlcat(s, "PS ", len);
+ if (cpu & RETRO_SIMD_AES)
+ strlcat(s, "AES ", len);
+ if (cpu & RETRO_SIMD_VMX)
+ strlcat(s, "VMX ", len);
+ if (cpu & RETRO_SIMD_VMX128)
+ strlcat(s, "VMX128 ", len);
+ }
+ break;
+ case RARCH_CAPABILITIES_COMPILER:
+#if defined(_MSC_VER)
+ snprintf(s, len, "Compiler: MSVC (%d) %u-bit", _MSC_VER, (unsigned)
+ (CHAR_BIT * sizeof(size_t)));
+#elif defined(__SNC__)
+ snprintf(s, len, "Compiler: SNC (%d) %u-bit",
+ __SN_VER__, (unsigned)(CHAR_BIT * sizeof(size_t)));
+#elif defined(_WIN32) && defined(__GNUC__)
+ snprintf(s, len, "Compiler: MinGW (%d.%d.%d) %u-bit",
+ __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__, (unsigned)
+ (CHAR_BIT * sizeof(size_t)));
+#elif defined(__clang__)
+ snprintf(s, len, "Compiler: Clang/LLVM (%s) %u-bit",
+ __clang_version__, (unsigned)(CHAR_BIT * sizeof(size_t)));
+#elif defined(__GNUC__)
+ snprintf(s, len, "Compiler: GCC (%d.%d.%d) %u-bit",
+ __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__, (unsigned)
+ (CHAR_BIT * sizeof(size_t)));
+#else
+ snprintf(s, len, "Unknown compiler %u-bit",
+ (unsigned)(CHAR_BIT * sizeof(size_t)));
+#endif
+ break;
+ default:
+ case RARCH_CAPABILITIES_NONE:
+ break;
+ }
+
+ return 0;
+}