Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/DHrpcs3/rpcs3
Browse files Browse the repository at this point in the history
Conflicts:
	rpcs3/rpcs3.vcxproj.filters

Conflicts fixed
  • Loading branch information
Nekotekina committed Apr 18, 2014
2 parents 5d09141 + ef108ae commit 62df7eb
Show file tree
Hide file tree
Showing 122 changed files with 3,225 additions and 3,112 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,25 @@ 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).


### Development

If you want to contribute please take a took at the [Coding Style](https://github.com/DHrpcs3/rpcs3/wiki/Coding-Style), [Roadmap](https://github.com/DHrpcs3/rpcs3/wiki/Roadmap) and [Developer Information](https://github.com/DHrpcs3/rpcs3/wiki/Developer-Information) pages. You should as well contact any of the developers in the forum in order to know about the current situation of the emulator.


### Dependencies

__Windows__
* [Visual C++ Redistributable Packages for Visual Studio 2013](http://www.microsoft.com/en-us/download/details.aspx?id=40784)
* [OpenAL32.dll](http://www.mediafire.com/?nwt3ilty2mo)

### Development
__Linux__
* Debian & Ubuntu: `sudo apt-get install libopenal-dev libwxgtk3.0-dev build-essential`

If you want to contribute please take a took at the [Coding Style](https://github.com/DHrpcs3/rpcs3/wiki/Coding-Style), [Roadmap](https://github.com/DHrpcs3/rpcs3/wiki/Roadmap) and [Developer Information](https://github.com/DHrpcs3/rpcs3/wiki/Developer-Information) pages. You should as well contact any of the developers in the forum in order to know about the current situation of the emulator.

### Building

To initialize the repository don't forget to execute `git submodule update --init` to pull the wxWidgets source.
* __Windows__: Install *Visual Studio 2013*. Then open the *.SLN* file, and press *Build* > *Rebuild Solution*.
* __Linux__: *TODO*
* __Linux__:
`cd rpcs3 && cmake CMakeLists.txt && make && cd ../` Then run with `cd bin && ./rpcs3`
323 changes: 0 additions & 323 deletions Utilities/Array.h
Original file line number Diff line number Diff line change
@@ -1,228 +1,5 @@
#pragma once

template<typename T> class Array
{
protected:
u32 m_count;
T* m_array;

public:
Array()
: m_count(0)
, m_array(NULL)
{
}

~Array()
{
Clear();
}

inline bool RemoveAt(const u32 from, const u32 count = 1)
{
if(!GetCount()) return false;
const u32 to = from + count;
if(to > GetCount()) return false;

for(u32 i=0; i<count; ++i) m_array[from + i].~T();
memmove(m_array + from, m_array + to, (m_count-to) * sizeof(T));
m_count -= count;

return true;
}

void InsertRoomEnd(const u32 size)
{
_InsertRoomEnd(size);
}

bool InsertRoom(const u32 pos, const u32 size)
{
if(pos >= m_count) return false;

_InsertRoomEnd(size);
memmove(m_array + pos + size, m_array + pos, sizeof(T) * (m_count - size - pos));

return true;
}

inline bool Move(const u32 pos, T* data)
{
if(!InsertRoom(pos, 1)) return false;

memcpy(m_array + pos, data, sizeof(T));
free(data);

return true;
}

inline u32 Move(T* data)
{
_InsertRoomEnd(1);

memcpy(m_array + GetCount() - 1, data, sizeof(T));
free(data);

return m_count - 1;
}

inline bool Add(const u32 pos, T*& data)
{
if(!InsertRoom(pos, 1)) return false;

memcpy(m_array + pos, data, sizeof(T));
free(data);
data = m_array + pos;

return true;
}

inline u32 Add(T*& data)
{
_InsertRoomEnd(1);

memcpy(m_array + GetCount() - 1, data, sizeof(T));
free(data);
data = m_array + GetCount() - 1;

return m_count - 1;
}

inline bool AddCpy(const u32 pos, const T* data, u32 count = 1)
{
if(!InsertRoom(pos, count)) return false;

for(u32 i=0; i<count; ++i)
{
new (m_array + pos + i) T(data[i]);
}

return true;
}

inline bool AddCpy(const u32 pos, const T& data)
{
return AddCpy(pos, &data);
}

inline u32 AddCpy(const T* data, u32 count = 1)
{
_InsertRoomEnd(count);

for(u32 i=0; i<count; ++i)
{
new (m_array + m_count - count + i) T(data[i]);
}

return m_count - count;
}

inline u32 AddCpy(const T& data)
{
return AddCpy(&data);
}

inline void Clear()
{
u32 count = m_count;
m_count = 0;
for(u32 i=0; i<count; ++i) m_array[i].~T();
safe_free(m_array);
}

inline void ClearF()
{
m_count = 0;
safe_free(m_array);
}

inline T& Get(u32 num)
{
//if(num >= GetCount()) return *new T();
return m_array[num];
}

u32 GetCount() const { return m_count; }

void SetCount(const u32 count, bool memzero = true)
{
if(m_count >= count) return;

_InsertRoomEnd(count - m_count);

if(memzero) memset(m_array + m_count - count, 0, sizeof(T) * (m_count - count));
}

void Reserve(const u32 count)
{
SetCount(GetCount() + count);
}

void AppendFrom(const Array<T>& src)
{
if(!src.GetCount()) return;

Reserve(src.GetCount());

memcpy(m_array, &src[0], GetCount() * sizeof(T));
}

void CopyFrom(const Array<T>& src)
{
Clear();

AppendFrom(src);
}

inline T* GetPtr() { return m_array; }
inline const T* GetPtr() const { return m_array; }

T& operator[](u32 num) const { return m_array[num]; }

T* operator + (u32 right) const
{
return m_array + right;
}

T* operator ->()
{
return m_array;
}

protected:
void _InsertRoomEnd(const u32 size)
{
if(!size) return;

m_array = m_count ? (T*)realloc(m_array, sizeof(T) * (m_count + size)) : (T*)malloc(sizeof(T) * size);
m_count += size;
}
};

template<typename T> struct Stack : public Array<T>
{
Stack() : Array<T>()
{
}

~Stack()
{
Array<T>::Clear();
}

void Push(const T data) { Array<T>::AddCpy(data); }

T Pop()
{
const u32 pos = Array<T>::GetCount() - 1;

const T ret = Array<T>::Get(pos);
Array<T>::RemoveAt(pos);

return ret;
}
};

template<typename T, size_t size> class SizedStack
{
T m_ptr[size];
Expand Down Expand Up @@ -278,106 +55,6 @@ template<typename T, size_t size> class SizedStack
}
};

template<typename T> class ArrayF
{
u32 m_count;
T** m_array;

public:
ArrayF()
: m_count(0)
, m_array(NULL)
{
}

virtual ~ArrayF()
{
Clear();
}

inline bool RemoveFAt(const u32 from, const u32 count = 1)
{
if(from + count > m_count) return false;

memmove(&m_array[from], &m_array[from+count], (m_count-(from+count)) * sizeof(T**));

m_count -= count;
return true;
}

inline bool RemoveAt(const u32 from, const u32 count = 1)
{
if(from + count > m_count) return false;

for(uint i = from; i < from + count; ++i)
{
free(m_array[i]);
}

return RemoveFAt(from, count);
}

inline u32 Add(T& data)
{
return Add(&data);
}

inline u32 Add(T* data)
{
if(!m_array)
{
m_array = (T**)malloc(sizeof(T*));
}
else
{
m_array = (T**)realloc(m_array, sizeof(T*) * (m_count + 1));
}

m_array[m_count] = data;
return m_count++;
}

inline void ClearF()
{
if(m_count == 0) return;

m_count = 0;
m_array = NULL;
}

inline void Clear()
{
if(m_count == 0) return;

m_count = 0;
safe_free(m_array);
}

inline T& Get(const u64 num)
{
//if(m_count <= num) *m_array[0]; //TODO
return *m_array[num];
}

T** operator + (u32 right) const
{
return m_array + right;
}

T* operator ->()
{
return *m_array;
}

inline T** GetPtr()
{
return m_array;
}

inline u32 GetCount() const { return m_count; }
T& operator[](u32 num) const { return *m_array[num]; }
};

template<typename T> struct ScopedPtr
{
private:
Expand Down
11 changes: 4 additions & 7 deletions Utilities/BEType.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,18 @@ class be_t
be_t() noexcept = default;
#endif

be_t(const be_t<T,size>& value) = default;
be_t(const T& value)
{
FromLE(value);
}

template<typename T1>
be_t(const be_t<T1>& value)
explicit be_t(const be_t<T1>& value)
{
FromBE(value.ToBE());
}

const T& ToBE() const
{
return m_data;
Expand Down Expand Up @@ -126,11 +127,7 @@ class be_t
return *this;
}

be_t& operator = (const be_t& right)
{
m_data = right.m_data;
return *this;
}
be_t<T,size>& operator = (const be_t<T,size>& right) = default;

template<typename T1> be_t& operator += (T1 right) { return *this = T(*this) + right; }
template<typename T1> be_t& operator -= (T1 right) { return *this = T(*this) - right; }
Expand Down
Loading

0 comments on commit 62df7eb

Please sign in to comment.