Merge remote-tracking branch 'upstream/master'

Conflicts:
	rpcs3/Emu/GS/GL/GLGSRender.cpp
	rpcs3/Gui/InterpreterDisAsm.cpp
	rpcs3/Gui/MainFrame.cpp
This commit is contained in:
Cornee Traas 2013-09-03 19:26:31 +02:00
commit f4b98074b0
117 changed files with 11008 additions and 2535 deletions

View file

@ -2,6 +2,7 @@
template<typename T> class Array
{
protected:
u32 m_count;
T* m_array;
@ -87,11 +88,14 @@ public:
return m_count - 1;
}
inline bool AddCpy(const u32 pos, const T* data, u64 count = 1)
inline bool AddCpy(const u32 pos, const T* data, u32 count = 1)
{
if(!InsertRoom(pos, count)) return false;
memcpy(m_array + pos, data, sizeof(T) * count);
for(u32 i=0; i<count; ++i)
{
new (m_array + pos + i) T(data[i]);
}
return true;
}
@ -101,11 +105,14 @@ public:
return AddCpy(pos, &data);
}
inline u32 AddCpy(const T* data, u64 count = 1)
inline u32 AddCpy(const T* data, u32 count = 1)
{
_InsertRoomEnd(count);
memcpy(m_array + m_count - count, data, sizeof(T)*count);
for(u32 i=0; i<count; ++i)
{
new (m_array + m_count - count + i) T(data[i]);
}
return m_count - count;
}
@ -120,7 +127,13 @@ public:
u32 count = m_count;
m_count = 0;
for(u32 i=0; i<count; ++i) m_array[i].~T();
safe_delete(m_array);
safe_free(m_array);
}
inline void ClearF()
{
m_count = 0;
safe_free(m_array);
}
inline T& Get(u32 num)
@ -129,15 +142,15 @@ public:
return m_array[num];
}
u32 GetCount() const { return m_count; }
virtual u32 GetCount() const { return m_count; }
void SetCount(const u32 count, bool memzero = true)
virtual void SetCount(const u32 count, bool memzero = true)
{
if(GetCount() >= count) return;
_InsertRoomEnd(count - GetCount());
if(m_count >= count) return;
if(memzero) memset(m_array + GetCount(), 0, count - GetCount());
_InsertRoomEnd(count - m_count);
if(memzero) memset(m_array + m_count - count, 0, sizeof(T) * (m_count - count));
}
void Reserve(const u32 count)
@ -162,6 +175,7 @@ public:
}
inline T* GetPtr() { return m_array; }
inline const T* GetPtr() const { return m_array; }
T& operator[](u32 num) const { return m_array[num]; }
@ -185,6 +199,96 @@ protected:
}
};
class ArrayString : public Array<char>
{
public:
ArrayString() : Array()
{
}
ArrayString(const wxString& value) : Array()
{
*this = value;
}
ArrayString(const char* value) : Array()
{
*this = value;
}
virtual u32 GetCount() const
{
return m_array ? strlen(m_array) : 0;
}
virtual void SetCount(const u32 count, bool memzero = true)
{
if(m_count && count < m_count - 1)
{
m_array[count] = '\0';
}
else
{
Array::SetCount(count + 1, memzero);
}
}
ArrayString& operator = (const char* right)
{
Clear();
if(right)
{
size_t len = strlen(right);
if(len)
{
SetCount(len);
memcpy(m_array, right, len * sizeof(char));
m_array[len] = '\0';
}
}
return *this;
}
ArrayString& operator = (const ArrayString& right)
{
Clear();
if(size_t len = right.GetCount())
{
SetCount(len);
memcpy(m_array, right.GetPtr(), len * sizeof(char));
m_array[len] = '\0';
}
return *this;
}
ArrayString& operator = (const wxString& right)
{
Clear();
if(size_t len = right.Len())
{
SetCount(len);
memcpy(m_array, right.c_str(), len * sizeof(char));
m_array[len] = '\0';
}
return *this;
}
ArrayString* Clone() const
{
ArrayString* new_array = new ArrayString();
(*new_array) = m_array;
return new_array;
}
};
template<typename T> struct Stack : public Array<T>
{
Stack() : Array<T>()
@ -209,6 +313,61 @@ template<typename T> struct Stack : public Array<T>
}
};
template<typename T, size_t size> class SizedStack
{
T m_ptr[size];
uint m_count;
public:
SizedStack()
{
Clear();
}
~SizedStack()
{
Clear();
}
void Clear()
{
m_count = 0;
}
bool Pop(T& dst)
{
if(!m_count)
return false;
dst = m_ptr[--m_count];
return true;
}
bool Push(const T& src)
{
if(m_count + 1 > size)
return false;
m_ptr[m_count++] = src;
return true;
}
size_t GetFreeCount() const
{
return size - m_count;
}
size_t GetCount() const
{
return m_count;
}
size_t GetMaxCount() const
{
return size;
}
};
template<typename T> class ArrayF
{
u32 m_count;

View file

@ -1,5 +1,9 @@
#pragma once
#include "Array.h"
#include <functional>
#include <thread>
#include <mutex>
#include <condition_variable>
class ThreadExec;
@ -59,7 +63,7 @@ public:
m_parent = nullptr;
//if(wait)
if(wait)
{
Delete();
//wxCriticalSectionLocker lock(m_wait_for_exit);