diff --git a/README.md b/README.md
index b63652fffb..24c073a32b 100644
--- a/README.md
+++ b/README.md
@@ -2,11 +2,14 @@ RPCS3
=====
[](https://travis-ci.org/DHrpcs3/rpcs3)
+
+[](https://coveralls.io/r/DHrpcs3/rpcs3)
+
An open-source PlayStation 3 emulator/debugger written in C++.
You can find some basic information in the [FAQ](https://github.com/DHrpcs3/rpcs3/wiki/FAQ). For discussion about this emulator and PS3 emulation please visit the [official forums](http://www.emunewz.net/forum/forumdisplay.php?fid=162).
diff --git a/Utilities/BEType.h b/Utilities/BEType.h
index 27997618bd..4965eac336 100644
--- a/Utilities/BEType.h
+++ b/Utilities/BEType.h
@@ -708,7 +708,7 @@ class to_be_t
public:
//true if need swap endianes for be
- static const bool value = (sizeof(T2) > 1) && (std::is_arithmetic::value || std::is_enum::value);
+ static const bool value = std::is_arithmetic::value || std::is_enum::value;
//be_t if need swap endianes, T otherwise
typedef typename _be_type_selector< T, T2, value >::type type;
@@ -716,26 +716,58 @@ public:
typedef typename _be_type_selector< T, T2, !is_be_t::value >::type forced_type;
};
+template
+class to_be_t
+{
+public:
+ static const bool value = to_be_t::value;
+ typedef const typename to_be_t::type type;
+ typedef const typename to_be_t::forced_type forced_type;
+};
+
template
class to_be_t
{
public:
- //true if need swap endianes for be
static const bool value = false;
-
- //be_t if need swap endianes, T otherwise
typedef void type;
+ typedef void forced_type;
};
template
-class to_be_t
+class to_be_t
{
public:
- //true if need swap endianes for be
static const bool value = false;
+ typedef u8 type;
+ typedef u8 forced_type;
+};
- //be_t if need swap endianes, T otherwise
- typedef const void type;
+template
+class to_be_t
+{
+public:
+ static const bool value = false;
+ typedef s8 type;
+ typedef s8 forced_type;
+};
+
+template
+class to_be_t
+{
+public:
+ static const bool value = false;
+ typedef char type;
+ typedef char forced_type;
+};
+
+template
+class to_be_t
+{
+public:
+ static const bool value = false;
+ typedef bool type;
+ typedef bool forced_type;
};
template
diff --git a/Utilities/GNU.h b/Utilities/GNU.h
index b1988b4dfa..a8db7f8703 100644
--- a/Utilities/GNU.h
+++ b/Utilities/GNU.h
@@ -14,6 +14,12 @@
#define __noinline __attribute__((noinline))
#endif
+#ifdef _WIN32
+#define __safebuffers __declspec(safebuffers)
+#else
+#define __safebuffers
+#endif
+
template
void strcpy_trunc(char(&dst)[size], const std::string& src)
{
diff --git a/Utilities/Log.h b/Utilities/Log.h
index d1710f05cf..5ff8504ce7 100644
--- a/Utilities/Log.h
+++ b/Utilities/Log.h
@@ -132,5 +132,5 @@ void log_message(Log::LogType type, Log::LogSeverity sev, std::string text);
template
__noinline void log_message(Log::LogType type, Log::LogSeverity sev, const char* fmt, Targs... args)
{
- log_message(type, sev, fmt::detail::format(fmt, strlen(fmt), fmt::do_unveil(args)...));
+ log_message(type, sev, fmt::detail::format(fmt, fmt::do_unveil(args)...));
}
diff --git a/Utilities/StrFmt.cpp b/Utilities/StrFmt.cpp
index 4c8c43cdf2..6ae236b922 100644
--- a/Utilities/StrFmt.cpp
+++ b/Utilities/StrFmt.cpp
@@ -96,9 +96,9 @@ size_t fmt::detail::get_fmt_len(const char* fmt, size_t len)
fmt += 2;
len -= 2;
- if (fmt[1] == '1')
+ if (fmt[0] == '1')
{
- assert(len >= 3 && fmt[2] - '0' < 7);
+ assert(len >= 3 && fmt[1] - '0' < 7);
res++;
fmt++;
len--;
@@ -144,8 +144,9 @@ size_t fmt::detail::get_fmt_precision(const char* fmt, size_t len)
return 1;
}
-std::string fmt::detail::format(const char* fmt, size_t len)
+std::string fmt::detail::format(const char* fmt)
{
+ const size_t len = strlen(fmt);
const size_t fmt_start = get_fmt_start(fmt, len);
if (fmt_start != len)
{
@@ -157,7 +158,7 @@ std::string fmt::detail::format(const char* fmt, size_t len)
extern const std::string fmt::placeholder = "???";
-std::string replace_first(const std::string& src, const std::string& from, const std::string& to)
+std::string fmt::replace_first(const std::string& src, const std::string& from, const std::string& to)
{
auto pos = src.find(from);
@@ -169,11 +170,12 @@ std::string replace_first(const std::string& src, const std::string& from, const
return (pos ? src.substr(0, pos) + to : to) + std::string(src.c_str() + pos + from.length());
}
-std::string replace_all(std::string src, const std::string& from, const std::string& to)
+std::string fmt::replace_all(const std::string &src, const std::string& from, const std::string& to)
{
- for (auto pos = src.find(from); pos != std::string::npos; src.find(from, pos + 1))
+ std::string target = src;
+ for (auto pos = target.find(from); pos != std::string::npos; pos = target.find(from, pos + 1))
{
- src = (pos ? src.substr(0, pos) + to : to) + std::string(src.c_str() + pos + from.length());
+ target = (pos ? target.substr(0, pos) + to : to) + std::string(target.c_str() + pos + from.length());
pos += to.length();
}
diff --git a/Utilities/StrFmt.h b/Utilities/StrFmt.h
index 36a1ee4abb..bd4059ab86 100644
--- a/Utilities/StrFmt.h
+++ b/Utilities/StrFmt.h
@@ -123,7 +123,7 @@ namespace fmt
}
std::string replace_first(const std::string& src, const std::string& from, const std::string& to);
- std::string replace_all(std::string src, const std::string& from, const std::string& to);
+ std::string replace_all(const std::string &src, const std::string& from, const std::string& to);
template
std::string replace_all(std::string src, const std::pair(&list)[list_size])
@@ -198,7 +198,7 @@ namespace fmt
{
return to_hex(arg, get_fmt_precision(fmt, len));
}
- else if (fmt[len - 1] == 'd')
+ else if (fmt[len - 1] == 'd' || fmt[len - 1] == 'u')
{
return to_udec(arg);
}
@@ -206,8 +206,6 @@ namespace fmt
{
throw "Invalid formatting (u8): " + std::string(fmt, len);
}
-
- return{};
}
};
@@ -220,7 +218,7 @@ namespace fmt
{
return to_hex(arg, get_fmt_precision(fmt, len));
}
- else if (fmt[len - 1] == 'd')
+ else if (fmt[len - 1] == 'd' || fmt[len - 1] == 'u')
{
return to_udec(arg);
}
@@ -228,8 +226,6 @@ namespace fmt
{
throw "Invalid formatting (u16): " + std::string(fmt, len);
}
-
- return{};
}
};
@@ -242,7 +238,7 @@ namespace fmt
{
return to_hex(arg, get_fmt_precision(fmt, len));
}
- else if (fmt[len - 1] == 'd')
+ else if (fmt[len - 1] == 'd' || fmt[len - 1] == 'u')
{
return to_udec(arg);
}
@@ -250,8 +246,6 @@ namespace fmt
{
throw "Invalid formatting (u32): " + std::string(fmt, len);
}
-
- return{};
}
};
@@ -264,7 +258,7 @@ namespace fmt
{
return to_hex(arg, get_fmt_precision(fmt, len));
}
- else if (fmt[len - 1] == 'd')
+ else if (fmt[len - 1] == 'd' || fmt[len - 1] == 'u')
{
return to_udec(arg);
}
@@ -272,8 +266,6 @@ namespace fmt
{
throw "Invalid formatting (u64): " + std::string(fmt, len);
}
-
- return{};
}
};
@@ -294,8 +286,6 @@ namespace fmt
{
throw "Invalid formatting (s8): " + std::string(fmt, len);
}
-
- return{};
}
};
@@ -316,8 +306,6 @@ namespace fmt
{
throw "Invalid formatting (s16): " + std::string(fmt, len);
}
-
- return{};
}
};
@@ -338,8 +326,6 @@ namespace fmt
{
throw "Invalid formatting (s32): " + std::string(fmt, len);
}
-
- return{};
}
};
@@ -360,8 +346,6 @@ namespace fmt
{
throw "Invalid formatting (s64): " + std::string(fmt, len);
}
-
- return{};
}
};
@@ -382,8 +366,6 @@ namespace fmt
{
throw "Invalid formatting (float): " + std::string(fmt, len);
}
-
- return{};
}
};
@@ -404,8 +386,6 @@ namespace fmt
{
throw "Invalid formatting (double): " + std::string(fmt, len);
}
-
- return{};
}
};
@@ -418,7 +398,7 @@ namespace fmt
{
return to_hex(arg, get_fmt_precision(fmt, len));
}
- else if (fmt[len - 1] == 'd')
+ else if (fmt[len - 1] == 'd' || fmt[len - 1] == 'u')
{
return arg ? "1" : "0";
}
@@ -430,26 +410,6 @@ namespace fmt
{
throw "Invalid formatting (bool): " + std::string(fmt, len);
}
-
- return{};
- }
- };
-
- template<>
- struct get_fmt
- {
- static std::string text(const char* fmt, size_t len, char* arg)
- {
- if (fmt[len - 1] == 's')
- {
- return arg;
- }
- else
- {
- throw "Invalid formatting (char*): " + std::string(fmt, len);
- }
-
- return{};
}
};
@@ -466,75 +426,20 @@ namespace fmt
{
throw "Invalid formatting (const char*): " + std::string(fmt, len);
}
-
- return{};
}
};
- //template
- //struct get_fmt
- //{
- // static std::string text(const char* fmt, size_t len, const char(&arg)[size])
- // {
- // if (fmt[len - 1] == 's')
- // {
- // return std::string(arg, size);
- // }
- // else
- // {
- // throw "Invalid formatting (char[size]): " + std::string(fmt, len);
- // }
-
- // return{};
- // }
- //};
-
- //template
- //struct get_fmt
- //{
- // static std::string text(const char* fmt, size_t len, const char(&arg)[size])
- // {
- // if (fmt[len - 1] == 's')
- // {
- // return std::string(arg, size);
- // }
- // else
- // {
- // throw "Invalid formatting (const char[size]): " + std::string(fmt, len);
- // }
-
- // return{};
- // }
- //};
-
- template<>
- struct get_fmt
- {
- static std::string text(const char* fmt, size_t len, const std::string& arg)
- {
- if (fmt[len - 1] == 's')
- {
- return arg;
- }
- else
- {
- throw "Invalid formatting (std::string): " + std::string(fmt, len);
- }
-
- return{};
- }
- };
-
- std::string format(const char* fmt, size_t len); // terminator
+ std::string format(const char* fmt); // terminator
template
- std::string format(const char* fmt, size_t len, const T& arg, Args... args)
+ std::string format(const char* fmt, const T& arg, Args... args)
{
+ const size_t len = strlen(fmt);
const size_t fmt_start = get_fmt_start(fmt, len);
const size_t fmt_len = get_fmt_len(fmt + fmt_start, len - fmt_start);
const size_t fmt_end = fmt_start + fmt_len;
- return std::string(fmt, fmt_start) + get_fmt::text(fmt + fmt_start, fmt_len, arg) + format(fmt + fmt_end, len - fmt_end, args...);
+ return std::string(fmt, fmt_start) + get_fmt::text(fmt + fmt_start, fmt_len, arg) + format(fmt + fmt_end, args...);
}
};
@@ -549,6 +454,17 @@ namespace fmt
}
};
+ template<>
+ struct unveil
+ {
+ typedef const char* result_type;
+
+ __forceinline static result_type get_value(const char* arg)
+ {
+ return arg;
+ }
+ };
+
template
struct unveil
{
@@ -563,11 +479,11 @@ namespace fmt
template<>
struct unveil
{
- typedef const std::string& result_type;
+ typedef const char* result_type;
__forceinline static result_type get_value(const std::string& arg)
{
- return arg;
+ return arg.c_str();
}
};
@@ -613,8 +529,9 @@ namespace fmt
float (%x, %f)
double (%x, %f)
bool (%x, %d, %s)
- char*, const char*, std::string (%s)
+ char* (%s)
+ std::string forced to .c_str() (fmt::unveil)
be_t<> of any appropriate type in this list (fmt::unveil)
enum of any appropriate type in this list (fmt::unveil)
@@ -635,9 +552,9 @@ namespace fmt
Other features are not supported.
*/
template
- __forceinline std::string format(const char* fmt, Args... args)
+ __forceinline __safebuffers std::string format(const char* fmt, Args... args)
{
- return detail::format(fmt, strlen(fmt), do_unveil(args)...);
+ return detail::format(fmt, do_unveil(args)...);
}
//convert a wxString to a std::string encoded in utf8
diff --git a/Utilities/rFile.cpp b/Utilities/rFile.cpp
index e6f657d39e..39fa91eceb 100644
--- a/Utilities/rFile.cpp
+++ b/Utilities/rFile.cpp
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "Log.h"
+#pragma warning(disable : 4996)
#include
#include
#include
diff --git a/Utilities/rMsgBox.cpp b/Utilities/rMsgBox.cpp
index cd3a46be0d..cf4c027096 100644
--- a/Utilities/rMsgBox.cpp
+++ b/Utilities/rMsgBox.cpp
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "restore_new.h"
+#pragma warning(disable : 4996)
#include
#include "define_new_memleakdetect.h"
#include "rMsgBox.h"
diff --git a/Utilities/rPlatform.cpp b/Utilities/rPlatform.cpp
index a947b7a00f..57a32e1425 100644
--- a/Utilities/rPlatform.cpp
+++ b/Utilities/rPlatform.cpp
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "restore_new.h"
+#pragma warning(disable : 4996)
#include
#include "define_new_memleakdetect.h"
diff --git a/Utilities/rTime.cpp b/Utilities/rTime.cpp
index fccb0ac7df..194394317c 100644
--- a/Utilities/rTime.cpp
+++ b/Utilities/rTime.cpp
@@ -1,6 +1,6 @@
#include "stdafx.h"
#include "rTime.h"
-
+#pragma warning(disable : 4996)
#include
std::string rDefaultDateTimeFormat = "%c";
diff --git a/rpcs3/Crypto/unpkg.cpp b/rpcs3/Crypto/unpkg.cpp
index 65e1d3e394..b4d18eb92d 100644
--- a/rpcs3/Crypto/unpkg.cpp
+++ b/rpcs3/Crypto/unpkg.cpp
@@ -5,6 +5,7 @@
#include "key_vault.h"
#include "unpkg.h"
#include "restore_new.h"
+#pragma warning(disable : 4996)
#include
#include "define_new_memleakdetect.h"
diff --git a/rpcs3/Crypto/unself.cpp b/rpcs3/Crypto/unself.cpp
index 28b464c100..954f29eb22 100644
--- a/rpcs3/Crypto/unself.cpp
+++ b/rpcs3/Crypto/unself.cpp
@@ -6,7 +6,7 @@
#include "utils.h"
#include "Emu/FS/vfsLocalFile.h"
#include "unself.h"
-
+#pragma warning(disable : 4996)
#include
#include
diff --git a/rpcs3/Emu/ARMv7/ARMv7Callback.h b/rpcs3/Emu/ARMv7/ARMv7Callback.h
new file mode 100644
index 0000000000..18c39fe49d
--- /dev/null
+++ b/rpcs3/Emu/ARMv7/ARMv7Callback.h
@@ -0,0 +1,18 @@
+#pragma once
+#include "Emu/Memory/Memory.h"
+#include "Emu/ARMv7/PSVFuncList.h"
+
+namespace vm
+{
+ template
+ __forceinline RT _ptr_base