Start replacing getOnlinecores with libretro-common equivalent

This commit is contained in:
twinaphex 2016-08-16 08:29:02 +02:00 committed by zeromus
parent 2d0852aaf9
commit a607264086
5 changed files with 8 additions and 35 deletions

View File

@ -102,6 +102,8 @@ libdesmume_a_SOURCES = \
desmume_config.cpp desmume_config.h \
libretro-common/compat/compat_getopt.c \
libretro-common/file/file_path.c \
libretro-common/compat/compat_strl.c \
libretro-common/features/features_cpu.c \
libretro-common/file/retro_dirent.c \
libretro-common/file/retro_stat.c \
libretro-common/rthreads/async_job.c \

View File

@ -23,6 +23,8 @@
#include <math.h>
#include <zlib.h>
#include <features/features_cpu.h>
#include "utils/decrypt/decrypt.h"
#include "utils/decrypt/crc.h"
#include "utils/decrypt/header.h"
@ -116,7 +118,8 @@ void Desmume_InitOnce()
int NDS_GetCPUCoreCount()
{
return getOnlineCores();
int amount = cpu_features_get_core_amount();
return amount;
}
void NDS_SetupDefaultFirmware()

View File

@ -21,36 +21,6 @@
#include "task.h"
#include <rthreads/rthreads.h>
#ifdef HOST_WINDOWS
#include <windows.h>
#else
#if defined HOST_LINUX
#include <unistd.h>
#elif defined HOST_BSD || defined HOST_DARWIN
#include <sys/sysctl.h>
#endif
#endif // HOST_WINDOWS
// http://stackoverflow.com/questions/150355/programmatically-find-the-number-of-cores-on-a-machine
int getOnlineCores (void)
{
#ifdef HOST_WINDOWS
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
return sysinfo.dwNumberOfProcessors;
#elif defined HOST_LINUX
return sysconf(_SC_NPROCESSORS_ONLN);
#elif defined HOST_BSD || defined HOST_DARWIN
int cores;
int mib[4] = { CTL_HW, HW_NCPU, 0, 0 };
size_t len = sizeof(cores); //don't make this const, i guess sysctl can't take a const *
sysctl(mib, 2, &cores, &len, NULL, 0);
return (cores < 1) ? 1 : cores;
#else
return 1;
#endif
}
class Task::Impl {
private:
sthread_t* _thread;

View File

@ -45,6 +45,4 @@ public:
};
int getOnlineCores (void);
#endif

View File

@ -119,6 +119,7 @@
<ClCompile Include="..\libretro-common\lists\string_list.c" />
<ClCompile Include="..\libretro-common\rthreads\rsemaphore.c" />
<ClCompile Include="..\libretro-common\rthreads\rthreads.c" />
<ClCompile Include="..\libretro-common\features\features_cpu.c" />
<ClCompile Include="..\libretro-common\streams\file_stream.c" />
<ClCompile Include="..\libretro-common\streams\memory_stream.c" />
<ClCompile Include="..\lua-engine.cpp" />
@ -368,7 +369,6 @@
<ClInclude Include="..\GPU_osd.h" />
<ClInclude Include="..\instructions.h" />
<ClInclude Include="..\instruction_attributes.h" />
<ClInclude Include="..\libretro-common\formats\png\rpng_internal.h" />
<ClInclude Include="..\libretro-common\include\boolean.h" />
<ClInclude Include="..\libretro-common\include\compat\getopt.h" />
<ClInclude Include="..\libretro-common\include\compat\msvc.h" />
@ -694,4 +694,4 @@
<UserProperties RESOURCE_FILE="resources.rc" />
</VisualStudio>
</ProjectExtensions>
</Project>
</Project>