mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-04-04 14:08:30 +00:00
Improved GameViewer
GameViewer use VFS. Implemented be_t increment / decrement Implemented se Improved sys_fs syscalls.
This commit is contained in:
parent
d6fe398f79
commit
05184d2e71
13 changed files with 178 additions and 120 deletions
|
|
@ -2,17 +2,14 @@
|
|||
|
||||
#include "Utilities/GNU.h"
|
||||
|
||||
#define se16(x) const_se_t<u16, x>::value
|
||||
#define se32(x) const_se_t<u32, x>::value
|
||||
#define se64(x) const_se_t<u64, x>::value
|
||||
|
||||
template<typename T, int size = sizeof(T)> struct se_t;
|
||||
template<typename T> struct se_t<T, 1> { static __forceinline void func(T& dst, const T src) { (u8&)dst = (u8&)src; } };
|
||||
template<typename T> struct se_t<T, 2> { static __forceinline void func(T& dst, const T src) { (u16&)dst = _byteswap_ushort((u16&)src); } };
|
||||
template<typename T> struct se_t<T, 4> { static __forceinline void func(T& dst, const T src) { (u32&)dst = _byteswap_ulong((u32&)src); } };
|
||||
template<typename T> struct se_t<T, 8> { static __forceinline void func(T& dst, const T src) { (u64&)dst = _byteswap_uint64((u64&)src); } };
|
||||
|
||||
template<typename T, s64 _value, int size = sizeof(T)> struct const_se_t;;
|
||||
|
||||
template<typename T, s64 _value, int size = sizeof(T)> struct const_se_t;
|
||||
template<typename T, s64 _value> struct const_se_t<T, _value, 1>
|
||||
{
|
||||
static const T value = (T)_value;
|
||||
|
|
@ -52,6 +49,8 @@ class be_t
|
|||
T m_data;
|
||||
|
||||
public:
|
||||
typedef T type;
|
||||
|
||||
be_t()
|
||||
{
|
||||
}
|
||||
|
|
@ -91,6 +90,20 @@ public:
|
|||
se_t<T>::func(m_data, value);
|
||||
}
|
||||
|
||||
static be_t MakeFromLE(const T value)
|
||||
{
|
||||
be_t res;
|
||||
res.FromLE(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
static be_t MakeFromBE(const T value)
|
||||
{
|
||||
be_t res;
|
||||
res.FromBE(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
//template<typename T1>
|
||||
operator const T() const
|
||||
{
|
||||
|
|
@ -154,4 +167,17 @@ public:
|
|||
template<typename T1> bool operator < (const be_t<T1>& right) const { return (T1)ToLE() < right.ToLE(); }
|
||||
template<typename T1> bool operator >= (const be_t<T1>& right) const { return (T1)ToLE() >= right.ToLE(); }
|
||||
template<typename T1> bool operator <= (const be_t<T1>& right) const { return (T1)ToLE() <= right.ToLE(); }
|
||||
|
||||
be_t operator++ (int) { be_t res = *this; *this += 1; return res; }
|
||||
be_t operator-- (int) { be_t res = *this; *this -= 1; return res; }
|
||||
be_t& operator++ () { *this += 1; return *this; }
|
||||
be_t& operator-- () { *this -= 1; return *this; }
|
||||
};
|
||||
|
||||
template<typename T, typename T1, T1 value> struct _se : public const_se_t<T, value> {};
|
||||
template<typename T, typename T1, T1 value> struct _se<be_t<T>, T1, value> : public const_se_t<T, value> {};
|
||||
|
||||
#define se(t, x) _se<decltype(t), decltype(x), x>::value
|
||||
#define se16(x) _se<u16, decltype(x), x>::value
|
||||
#define se32(x) _se<u32, decltype(x), x>::value
|
||||
#define se64(x) _se<u64, decltype(x), x>::value
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ public:
|
|||
struct ID
|
||||
{
|
||||
std::string m_name;
|
||||
u8 m_attr;
|
||||
u32 m_attr;
|
||||
IDData* m_data;
|
||||
|
||||
template<typename T>
|
||||
ID(const std::string& name, T* data, const u8 attr)
|
||||
ID(const std::string& name, T* data, const u32 attr)
|
||||
: m_name(name)
|
||||
, m_attr(attr)
|
||||
{
|
||||
|
|
@ -97,7 +97,7 @@ public:
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
ID_TYPE GetNewID(const std::string& name = "", T* data = nullptr, const u8 attr = 0)
|
||||
ID_TYPE GetNewID(const std::string& name = "", T* data = nullptr, const u32 attr = 0)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mtx_main);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue