mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 05:51:27 +12:00
- Implemented HDD manager.
- Implemented VFS manager. - Implemented MFC. - Fixed ELF Compiler. - Improved HLE Func binder.
This commit is contained in:
parent
559852a8fc
commit
81e874c9e2
52 changed files with 2684 additions and 468 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
template<typename T> class Array
|
||||
{
|
||||
protected:
|
||||
u32 m_count;
|
||||
T* m_array;
|
||||
|
||||
|
@ -120,7 +121,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 +136,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;
|
||||
if(m_count >= count) return;
|
||||
|
||||
_InsertRoomEnd(count - GetCount());
|
||||
_InsertRoomEnd(count - m_count);
|
||||
|
||||
if(memzero) memset(m_array + GetCount(), 0, count - GetCount());
|
||||
if(memzero) memset(m_array + m_count - count, 0, sizeof(T) * (m_count - count));
|
||||
}
|
||||
|
||||
void Reserve(const u32 count)
|
||||
|
@ -162,6 +169,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 +193,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>()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue