mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
Merge branch 'master' into wii-network
Conflicts: Source/Core/Core/CMakeLists.txt
This commit is contained in:
@ -32,6 +32,7 @@
|
||||
#include <list>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
#include "Common.h"
|
||||
#include "FileUtil.h"
|
||||
@ -139,11 +140,17 @@ public:
|
||||
template <typename T>
|
||||
void Do(T& x)
|
||||
{
|
||||
// TODO: Bad, Do(some_non_POD) will compile and fail at runtime
|
||||
// type_traits are not fully supported everywhere yet
|
||||
// Ideally this would be std::is_trivially_copyable, but not enough support yet
|
||||
static_assert(std::is_pod<T>::value, "Only sane for POD types");
|
||||
|
||||
DoVoid((void*)&x, sizeof(x));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void DoPOD(T& x)
|
||||
{
|
||||
DoVoid((void*)&x, sizeof(x));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void DoPointer(T*& x, T* const base)
|
||||
|
@ -66,23 +66,26 @@ _mm_shuffle_epi8(__m128i a, __m128i mask)
|
||||
#define Crash() {asm ("int $3");}
|
||||
#endif
|
||||
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
|
||||
|
||||
// GCC 4.8 defines all the rotate functions now
|
||||
// Small issue with GCC's lrotl/lrotr intrinsics is they are still 32bit while we require 64bit
|
||||
#ifndef _rotl
|
||||
inline u32 _rotl(u32 x, int shift) {
|
||||
shift &= 31;
|
||||
if (!shift) return x;
|
||||
return (x << shift) | (x >> (32 - shift));
|
||||
}
|
||||
|
||||
inline u64 _rotl64(u64 x, unsigned int shift){
|
||||
unsigned int n = shift % 64;
|
||||
return (x << n) | (x >> (64 - n));
|
||||
}
|
||||
|
||||
inline u32 _rotr(u32 x, int shift) {
|
||||
shift &= 31;
|
||||
if (!shift) return x;
|
||||
return (x >> shift) | (x << (32 - shift));
|
||||
}
|
||||
#endif
|
||||
|
||||
inline u64 _rotl64(u64 x, unsigned int shift){
|
||||
unsigned int n = shift % 64;
|
||||
return (x << n) | (x >> (64 - n));
|
||||
}
|
||||
|
||||
inline u64 _rotr64(u64 x, unsigned int shift){
|
||||
unsigned int n = shift % 64;
|
||||
|
@ -36,15 +36,16 @@ public:
|
||||
return (0 == m_size);
|
||||
}
|
||||
|
||||
const T& Front() const
|
||||
T& Front() const
|
||||
{
|
||||
return *m_read_ptr->current;
|
||||
}
|
||||
|
||||
void Push(const T& t)
|
||||
template <typename Arg>
|
||||
void Push(Arg&& t)
|
||||
{
|
||||
// create the element, add it to the queue
|
||||
m_write_ptr->current = new T(t);
|
||||
m_write_ptr->current = new T(std::forward<Arg>(t));
|
||||
// set the next pointer to a new element ptr
|
||||
// then advance the write pointer
|
||||
m_write_ptr = m_write_ptr->next = new ElementPtr();
|
||||
@ -67,7 +68,7 @@ public:
|
||||
if (Empty())
|
||||
return false;
|
||||
|
||||
t = Front();
|
||||
t = std::move(Front());
|
||||
Pop();
|
||||
|
||||
return true;
|
||||
|
@ -124,7 +124,7 @@ bool Delete(const std::string &filename)
|
||||
// being there, not the actual delete.
|
||||
if (!Exists(filename))
|
||||
{
|
||||
WARN_LOG(COMMON, "Delete: %s does not exists", filename.c_str());
|
||||
WARN_LOG(COMMON, "Delete: %s does not exist", filename.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -216,7 +216,7 @@ bool CreateFullPath(const std::string &fullPath)
|
||||
panicCounter--;
|
||||
if (panicCounter <= 0)
|
||||
{
|
||||
ERROR_LOG(COMMON, "CreateFullPath: directory structure too deep");
|
||||
ERROR_LOG(COMMON, "CreateFullPath: directory structure is too deep");
|
||||
return false;
|
||||
}
|
||||
position++;
|
||||
@ -324,7 +324,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
// close flushs
|
||||
// close files
|
||||
fclose(input);
|
||||
fclose(output);
|
||||
return true;
|
||||
@ -669,7 +669,7 @@ std::string GetSysDirectory()
|
||||
|
||||
// Returns a string with a Dolphin data dir or file in the user's home
|
||||
// directory. To be used in "multi-user" mode (that is, installed).
|
||||
std::string &GetUserPath(const unsigned int DirIDX, const std::string &newPath)
|
||||
const std::string& GetUserPath(const unsigned int DirIDX, const std::string &newPath)
|
||||
{
|
||||
static std::string paths[NUM_PATH_INDICES];
|
||||
|
||||
@ -724,11 +724,11 @@ std::string &GetUserPath(const unsigned int DirIDX, const std::string &newPath)
|
||||
if (!newPath.empty())
|
||||
{
|
||||
if(DirIDX != D_WIIROOT_IDX)
|
||||
PanicAlert("trying to change user path other than wii root");
|
||||
PanicAlert("Trying to change user path other than Wii root");
|
||||
|
||||
if (!File::IsDirectory(newPath))
|
||||
{
|
||||
WARN_LOG(COMMON, "Invalid path specified %s, wii user path will be set to default", newPath.c_str());
|
||||
WARN_LOG(COMMON, "Invalid path specified %s, Wii user path will be set to default", newPath.c_str());
|
||||
paths[D_WIIROOT_IDX] = paths[D_USER_IDX] + WII_USER_DIR;
|
||||
}
|
||||
else
|
||||
@ -744,6 +744,19 @@ std::string &GetUserPath(const unsigned int DirIDX, const std::string &newPath)
|
||||
return paths[DirIDX];
|
||||
}
|
||||
|
||||
std::string GetThemeDir(const std::string& theme_name)
|
||||
{
|
||||
std::string dir = File::GetUserPath(D_THEMES_IDX) + theme_name + "/";
|
||||
|
||||
#if !defined(_WIN32)
|
||||
// If theme does not exist in user's dir load from shared directory
|
||||
if (!File::Exists(dir))
|
||||
dir = SHARED_USER_DIR THEMES_DIR "/" + theme_name + "/";
|
||||
#endif
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
bool WriteStringToFile(bool text_file, const std::string &str, const char *filename)
|
||||
{
|
||||
return File::IOFile(filename, text_file ? "w" : "wb").WriteBytes(str.data(), str.size());
|
||||
|
@ -133,7 +133,10 @@ bool SetCurrentDir(const std::string &directory);
|
||||
|
||||
// Returns a pointer to a string with a Dolphin data dir in the user's home
|
||||
// directory. To be used in "multi-user" mode (that is, installed).
|
||||
std::string &GetUserPath(const unsigned int DirIDX, const std::string &newPath="");
|
||||
const std::string& GetUserPath(const unsigned int DirIDX, const std::string &newPath="");
|
||||
|
||||
// probably doesn't belong here
|
||||
std::string GetThemeDir(const std::string& theme_name);
|
||||
|
||||
// Returns the path to where the sys file are
|
||||
std::string GetSysDirectory();
|
||||
|
@ -120,6 +120,7 @@ LogManager::~LogManager()
|
||||
|
||||
delete m_fileLog;
|
||||
delete m_consoleLog;
|
||||
delete m_debuggerLog;
|
||||
}
|
||||
|
||||
void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
|
||||
void Log(LogTypes::LOG_LEVELS, const char *msg);
|
||||
|
||||
bool IsValid() { return (m_logfile != NULL); }
|
||||
bool IsValid() { return (bool)m_logfile; }
|
||||
bool IsEnabled() const { return m_enable; }
|
||||
void SetEnable(bool enable) { m_enable = enable; }
|
||||
|
||||
|
@ -5,9 +5,26 @@
|
||||
#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
|
||||
#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
|
||||
|
||||
#ifndef __has_include
|
||||
#define __has_include(s) 0
|
||||
#endif
|
||||
|
||||
#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !ANDROID
|
||||
|
||||
// GCC 4.4 provides <condition_variable>
|
||||
#include <condition_variable>
|
||||
|
||||
#elif __has_include(<condition_variable>)
|
||||
|
||||
// clang and libc++ provide <condition_variable> on OSX. However, the version
|
||||
// of libc++ bundled with OSX 10.7 and 10.8 is buggy: it uses _ as a variable.
|
||||
//
|
||||
// We work around this issue by undefining and redefining _.
|
||||
|
||||
#undef _
|
||||
#include <condition_variable>
|
||||
#define _(s) wxGetTranslation((s))
|
||||
|
||||
#else
|
||||
|
||||
// partial std::condition_variable implementation for win32/pthread
|
||||
|
@ -5,9 +5,16 @@
|
||||
#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
|
||||
#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
|
||||
|
||||
#ifndef __has_include
|
||||
#define __has_include(s) 0
|
||||
#endif
|
||||
|
||||
#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !ANDROID
|
||||
// GCC 4.4 provides <mutex>
|
||||
#include <mutex>
|
||||
#elif __has_include(<mutex>)
|
||||
// Clang + libc++
|
||||
#include <mutex>
|
||||
#else
|
||||
|
||||
// partial <mutex> implementation for win32/pthread
|
||||
|
@ -5,12 +5,19 @@
|
||||
#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
|
||||
#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
|
||||
|
||||
#ifndef __has_include
|
||||
#define __has_include(s) 0
|
||||
#endif
|
||||
|
||||
#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !ANDROID
|
||||
// GCC 4.4 provides <thread>
|
||||
#ifndef _GLIBCXX_USE_SCHED_YIELD
|
||||
#define _GLIBCXX_USE_SCHED_YIELD
|
||||
#endif
|
||||
#include <thread>
|
||||
#elif __has_include(<thread>)
|
||||
// Clang + libc++
|
||||
#include <thread>
|
||||
#else
|
||||
|
||||
// partial std::thread implementation for win32/pthread
|
||||
|
@ -18,9 +18,9 @@
|
||||
#ifndef _THREAD_H_
|
||||
#define _THREAD_H_
|
||||
|
||||
#include "StdThread.h"
|
||||
#include "StdMutex.h"
|
||||
#include "StdConditionVariable.h"
|
||||
#include "StdMutex.h"
|
||||
#include "StdThread.h"
|
||||
|
||||
// Don't include common.h here as it will break LogManager
|
||||
#include "CommonTypes.h"
|
||||
|
Reference in New Issue
Block a user