mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-29 18:32:47 +00:00
Merge branch 'master' of https://github.com/DHrpcs3/rpcs3
Conflicts: rpcs3/rpcs3.vcxproj.filters Conflicts fixed
This commit is contained in:
commit
62df7eb499
18
README.md
18
README.md
@ -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).
|
||||
|
||||
### Dependencies
|
||||
|
||||
* [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
|
||||
|
||||
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)
|
||||
|
||||
__Linux__
|
||||
* Debian & Ubuntu: `sudo apt-get install libopenal-dev libwxgtk3.0-dev build-essential`
|
||||
|
||||
|
||||
### 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`
|
||||
|
@ -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];
|
||||
@ -278,106 +55,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
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:
|
||||
|
@ -57,17 +57,18 @@ public:
|
||||
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;
|
||||
@ -126,11 +127,7 @@ public:
|
||||
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; }
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
#if defined(__GNUG__)
|
||||
#include <cmath>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#define _fpclass(x) std::fpclassify(x)
|
||||
#define __forceinline __attribute__((always_inline))
|
||||
#define _byteswap_ushort(x) __builtin_bswap16(x)
|
||||
@ -13,7 +16,8 @@
|
||||
#define _CRT_ALIGN(x) __attribute__((aligned(x)))
|
||||
#define InterlockedCompareExchange(ptr,new_val,old_val) __sync_val_compare_and_swap(ptr,old_val,new_val)
|
||||
#define InterlockedCompareExchange64(ptr,new_val,old_val) __sync_val_compare_and_swap(ptr,old_val,new_val)
|
||||
#define _aligned_malloc(size,alignment) aligned_alloc(alignment,size)
|
||||
#define _aligned_free(pointer) free(pointer)
|
||||
#define _aligned_malloc(size,alignment) memalign(alignment,size)
|
||||
#define _aligned_free free
|
||||
#define DWORD int32_t
|
||||
#endif
|
||||
|
||||
|
@ -50,6 +50,14 @@ struct ID
|
||||
{
|
||||
}
|
||||
|
||||
ID(ID&& other)
|
||||
{
|
||||
m_name = other.m_name;
|
||||
m_attr = other.m_attr;
|
||||
m_data = other.m_data;
|
||||
other.m_data = nullptr;
|
||||
}
|
||||
|
||||
void Kill()
|
||||
{
|
||||
delete m_data;
|
||||
|
@ -35,6 +35,8 @@ ThreadBase::~ThreadBase()
|
||||
{
|
||||
if(IsAlive())
|
||||
Stop(false);
|
||||
|
||||
safe_delete(m_executor);
|
||||
}
|
||||
|
||||
void ThreadBase::Start()
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "Array.h"
|
||||
#include <functional>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
#include <atomic>
|
||||
#include <condition_variable>
|
||||
@ -73,7 +74,7 @@ template<typename T> class MTPacketBuffer
|
||||
protected:
|
||||
volatile bool m_busy;
|
||||
volatile u32 m_put, m_get;
|
||||
Array<u8> m_buffer;
|
||||
std::vector<u8> m_buffer;
|
||||
u32 m_max_buffer_size;
|
||||
mutable std::recursive_mutex m_cs_main;
|
||||
|
||||
@ -98,7 +99,7 @@ public:
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(m_cs_main);
|
||||
m_put = m_get = 0;
|
||||
m_buffer.Clear();
|
||||
m_buffer.clear();
|
||||
m_busy = false;
|
||||
}
|
||||
|
||||
|
96
rpcs3.sln
96
rpcs3.sln
@ -84,12 +84,18 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asmjit", "asmjit.vcxproj",
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug - MemLeak|Win32 = Debug - MemLeak|Win32
|
||||
Debug - MemLeak|x64 = Debug - MemLeak|x64
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -98,6 +104,10 @@ Global
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Release|Win32.Build.0 = Release|Win32
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Release|x64.ActiveCfg = Release|x64
|
||||
{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Release|x64.Build.0 = Release|x64
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -106,6 +116,10 @@ Global
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Release|Win32.Build.0 = Release|Win32
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Release|x64.ActiveCfg = Release|x64
|
||||
{6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Release|x64.Build.0 = Release|x64
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -114,6 +128,10 @@ Global
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Release|Win32.Build.0 = Release|Win32
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Release|x64.ActiveCfg = Release|x64
|
||||
{7047EE97-7F80-A70D-6147-BC11102DB6F4}.Release|x64.Build.0 = Release|x64
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -122,6 +140,10 @@ Global
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Release|Win32.Build.0 = Release|Win32
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Release|x64.ActiveCfg = Release|x64
|
||||
{3111D679-7796-23C4-BA0C-271F1145DA24}.Release|x64.Build.0 = Release|x64
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -130,6 +152,10 @@ Global
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Release|Win32.Build.0 = Release|Win32
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Release|x64.ActiveCfg = Release|x64
|
||||
{067D9406-2A93-DACA-9449-93A2D356357D}.Release|x64.Build.0 = Release|x64
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -138,6 +164,10 @@ Global
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Release|Win32.Build.0 = Release|Win32
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Release|x64.ActiveCfg = Release|x64
|
||||
{9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Release|x64.Build.0 = Release|x64
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -146,6 +176,10 @@ Global
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Release|Win32.Build.0 = Release|Win32
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Release|x64.ActiveCfg = Release|x64
|
||||
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Release|x64.Build.0 = Release|x64
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -154,6 +188,10 @@ Global
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Release|Win32.Build.0 = Release|Win32
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Release|x64.ActiveCfg = Release|x64
|
||||
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Release|x64.Build.0 = Release|x64
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -162,6 +200,10 @@ Global
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Release|Win32.Build.0 = Release|Win32
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Release|x64.ActiveCfg = Release|x64
|
||||
{A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Release|x64.Build.0 = Release|x64
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -170,6 +212,10 @@ Global
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Release|Win32.Build.0 = Release|Win32
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Release|x64.ActiveCfg = Release|x64
|
||||
{CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Release|x64.Build.0 = Release|x64
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -178,6 +224,10 @@ Global
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Release|Win32.Build.0 = Release|Win32
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Release|x64.ActiveCfg = Release|x64
|
||||
{22B14659-C5B6-B775-868D-A49198FEAD4A}.Release|x64.Build.0 = Release|x64
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -186,6 +236,10 @@ Global
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Release|Win32.Build.0 = Release|Win32
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Release|x64.ActiveCfg = Release|x64
|
||||
{FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Release|x64.Build.0 = Release|x64
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -194,6 +248,10 @@ Global
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Release|Win32.Build.0 = Release|Win32
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Release|x64.ActiveCfg = Release|x64
|
||||
{46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Release|x64.Build.0 = Release|x64
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -202,6 +260,10 @@ Global
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Release|Win32.Build.0 = Release|Win32
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Release|x64.ActiveCfg = Release|x64
|
||||
{5C363C34-4741-7036-861C-2E2279CF552E}.Release|x64.Build.0 = Release|x64
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -210,6 +272,10 @@ Global
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Release|Win32.Build.0 = Release|Win32
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Release|x64.ActiveCfg = Release|x64
|
||||
{76169FE8-0814-4F36-6409-699EF1A23001}.Release|x64.Build.0 = Release|x64
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -218,6 +284,10 @@ Global
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Release|Win32.Build.0 = Release|Win32
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Release|x64.ActiveCfg = Release|x64
|
||||
{949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Release|x64.Build.0 = Release|x64
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -226,6 +296,10 @@ Global
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Release|Win32.Build.0 = Release|Win32
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Release|x64.ActiveCfg = Release|x64
|
||||
{B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Release|x64.Build.0 = Release|x64
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -234,6 +308,10 @@ Global
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Release|Win32.Build.0 = Release|Win32
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Release|x64.ActiveCfg = Release|x64
|
||||
{AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Release|x64.Build.0 = Release|x64
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -242,6 +320,10 @@ Global
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Release|Win32.Build.0 = Release|Win32
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Release|x64.ActiveCfg = Release|x64
|
||||
{6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Release|x64.Build.0 = Release|x64
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -250,6 +332,10 @@ Global
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Release|Win32.Build.0 = Release|Win32
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Release|x64.ActiveCfg = Release|x64
|
||||
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Release|x64.Build.0 = Release|x64
|
||||
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -258,6 +344,10 @@ Global
|
||||
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Release|Win32.Build.0 = Release|Win32
|
||||
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Release|x64.ActiveCfg = Release|x64
|
||||
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Release|x64.Build.0 = Release|x64
|
||||
{23E1C437-A951-5943-8639-A17F3CF2E606}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{23E1C437-A951-5943-8639-A17F3CF2E606}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{23E1C437-A951-5943-8639-A17F3CF2E606}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{23E1C437-A951-5943-8639-A17F3CF2E606}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{23E1C437-A951-5943-8639-A17F3CF2E606}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{23E1C437-A951-5943-8639-A17F3CF2E606}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{23E1C437-A951-5943-8639-A17F3CF2E606}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -266,6 +356,10 @@ Global
|
||||
{23E1C437-A951-5943-8639-A17F3CF2E606}.Release|Win32.Build.0 = Release|Win32
|
||||
{23E1C437-A951-5943-8639-A17F3CF2E606}.Release|x64.ActiveCfg = Release|x64
|
||||
{23E1C437-A951-5943-8639-A17F3CF2E606}.Release|x64.Build.0 = Release|x64
|
||||
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug - MemLeak|Win32.Build.0 = Debug|Win32
|
||||
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug - MemLeak|x64.Build.0 = Debug|x64
|
||||
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -274,6 +368,8 @@ Global
|
||||
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Release|Win32.Build.0 = Release|Win32
|
||||
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Release|x64.ActiveCfg = Release|x64
|
||||
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Release|x64.Build.0 = Release|x64
|
||||
{AC40FF01-426E-4838-A317-66354CEFAE88}.Debug - MemLeak|Win32.ActiveCfg = Debug|Win32
|
||||
{AC40FF01-426E-4838-A317-66354CEFAE88}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
|
||||
{AC40FF01-426E-4838-A317-66354CEFAE88}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{AC40FF01-426E-4838-A317-66354CEFAE88}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{AC40FF01-426E-4838-A317-66354CEFAE88}.Debug|x64.ActiveCfg = Debug|x64
|
||||
|
@ -3,21 +3,21 @@
|
||||
|
||||
AppConnector::~AppConnector()
|
||||
{
|
||||
for(uint i=0; i<m_connect_arr.GetCount(); ++i)
|
||||
for(auto& connection : m_connect_arr)
|
||||
{
|
||||
wxGetApp().Disconnect(
|
||||
m_connect_arr[i].winid,
|
||||
m_connect_arr[i].lastId,
|
||||
m_connect_arr[i].eventType,
|
||||
m_connect_arr[i].func,
|
||||
m_connect_arr[i].userData,
|
||||
m_connect_arr[i].eventSink);
|
||||
connection.winid,
|
||||
connection.lastId,
|
||||
connection.eventType,
|
||||
connection.func,
|
||||
connection.userData,
|
||||
connection.eventSink);
|
||||
}
|
||||
}
|
||||
|
||||
void AppConnector::Connect(int winid, int lastId, int eventType, wxObjectEventFunction func, wxObject* userData, wxEvtHandler* eventSink)
|
||||
{
|
||||
m_connect_arr.Move(new ConnectInfo(winid, lastId, eventType, func, userData, eventSink));
|
||||
m_connect_arr.emplace_back(winid, lastId, eventType, func, userData, eventSink);
|
||||
wxGetApp().Connect(winid, lastId, eventType, func, userData, eventSink);
|
||||
}
|
||||
|
||||
@ -29,4 +29,4 @@ void AppConnector::Connect(int winid, int eventType, wxObjectEventFunction func,
|
||||
void AppConnector::Connect(int eventType, wxObjectEventFunction func, wxObject* userData, wxEvtHandler* eventSink)
|
||||
{
|
||||
Connect(wxID_ANY, wxID_ANY, eventType, func, userData, eventSink);
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class AppConnector
|
||||
}
|
||||
};
|
||||
|
||||
Array<ConnectInfo> m_connect_arr;
|
||||
std::vector<ConnectInfo> m_connect_arr;
|
||||
|
||||
public:
|
||||
~AppConnector();
|
||||
@ -30,4 +30,4 @@ public:
|
||||
void Connect(int winid, int lastId, int eventType, wxObjectEventFunction func, wxObject* userData = nullptr, wxEvtHandler* eventSink = nullptr);
|
||||
void Connect(int winid, int eventType, wxObjectEventFunction func, wxObject* userData = nullptr, wxEvtHandler* eventSink = nullptr);
|
||||
void Connect(int eventType, wxObjectEventFunction func, wxObject* userData = nullptr, wxEvtHandler* eventSink = nullptr);
|
||||
};
|
||||
};
|
||||
|
@ -11,7 +11,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_definitions(-msse2)
|
||||
endif()
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules)
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules")
|
||||
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/../bin")
|
||||
|
||||
add_definitions(-DGL_GLEXT_PROTOTYPES)
|
||||
@ -34,28 +34,28 @@ endif()
|
||||
include_directories(
|
||||
${wxWidgets_INCLUDE_DIRS}
|
||||
${OPENAL_INCLUDE_DIR}
|
||||
${CMAKE_SOURCE_DIR}/../ffmpeg/${PLATFORM_ARCH}/include
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_SOURCE_DIR}/Emu
|
||||
${CMAKE_SOURCE_DIR}/Gui
|
||||
${CMAKE_SOURCE_DIR}/Loader
|
||||
${CMAKE_SOURCE_DIR}/Crypto
|
||||
${CMAKE_SOURCE_DIR}/..
|
||||
"${CMAKE_SOURCE_DIR}/../ffmpeg/${PLATFORM_ARCH}/include"
|
||||
"${CMAKE_SOURCE_DIR}"
|
||||
"${CMAKE_SOURCE_DIR}/Emu"
|
||||
"${CMAKE_SOURCE_DIR}/Gui"
|
||||
"${CMAKE_SOURCE_DIR}/Loader"
|
||||
"${CMAKE_SOURCE_DIR}/Crypto"
|
||||
"${CMAKE_SOURCE_DIR}/.."
|
||||
)
|
||||
|
||||
link_directories(${CMAKE_SOURCE_DIR}/../ffmpeg/${PLATFORM_ARCH}/lib)
|
||||
link_directories("${CMAKE_SOURCE_DIR}/../ffmpeg/${PLATFORM_ARCH}/lib")
|
||||
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
RPCS3_SRC
|
||||
${CMAKE_SOURCE_DIR}/rpcs3.cpp
|
||||
${CMAKE_SOURCE_DIR}/AppConnector.cpp
|
||||
${CMAKE_SOURCE_DIR}/Ini.cpp
|
||||
${CMAKE_SOURCE_DIR}/Emu/*
|
||||
${CMAKE_SOURCE_DIR}/Gui/*
|
||||
${CMAKE_SOURCE_DIR}/Loader/*
|
||||
${CMAKE_SOURCE_DIR}/Crypto/*
|
||||
${CMAKE_SOURCE_DIR}/../Utilities/*
|
||||
"${CMAKE_SOURCE_DIR}/rpcs3.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/AppConnector.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/Ini.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/Emu/*"
|
||||
"${CMAKE_SOURCE_DIR}/Gui/*"
|
||||
"${CMAKE_SOURCE_DIR}/Loader/*"
|
||||
"${CMAKE_SOURCE_DIR}/Crypto/*"
|
||||
"${CMAKE_SOURCE_DIR}/../Utilities/*"
|
||||
)
|
||||
|
||||
add_executable(rpcs3 ${RPCS3_SRC})
|
||||
|
1724
rpcs3/Crypto/aes.cpp
1724
rpcs3/Crypto/aes.cpp
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "utils.h"
|
||||
|
||||
#pragma once
|
||||
#include "utils.h"
|
||||
|
||||
enum SELF_KEY_TYPE {
|
||||
KEY_LV0 = 1,
|
||||
KEY_LV1,
|
||||
@ -22,7 +22,7 @@ struct SELF_KEY {
|
||||
u8 priv[0x15];
|
||||
u32 curve_type;
|
||||
|
||||
SELF_KEY(u64 ver, u16 rev, u32 type, const std::string& e, const std::string& r, const std::string& pb, const std::string& pr, u32 ct)
|
||||
SELF_KEY(u64 ver, u16 rev, u32 type, const std::string& e, const std::string& r, const std::string& pb, const std::string& pr, u32 ct)
|
||||
{
|
||||
version = ver;
|
||||
revision = rev;
|
||||
@ -35,12 +35,12 @@ struct SELF_KEY {
|
||||
}
|
||||
};
|
||||
|
||||
static u8 PKG_AES_KEY[0x10] = {
|
||||
0x2e, 0x7b, 0x71, 0xd7, 0xc9, 0xc9, 0xa1, 0x4e, 0xa3, 0x22, 0x1f, 0x18, 0x88, 0x28, 0xb8, 0xf8
|
||||
static u8 PKG_AES_KEY[0x10] = {
|
||||
0x2e, 0x7b, 0x71, 0xd7, 0xc9, 0xc9, 0xa1, 0x4e, 0xa3, 0x22, 0x1f, 0x18, 0x88, 0x28, 0xb8, 0xf8
|
||||
};
|
||||
|
||||
static u8 NP_IDPS[0x10] = {
|
||||
0x5E, 0x06, 0xE0, 0x4F, 0xD9, 0x4A, 0x71, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01
|
||||
static u8 NP_IDPS[0x10] = {
|
||||
0x5E, 0x06, 0xE0, 0x4F, 0xD9, 0x4A, 0x71, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01
|
||||
};
|
||||
|
||||
static u8 NP_KLIC_FREE[0x10] = {
|
||||
@ -114,43 +114,43 @@ static u8 EDAT_HASH_1[0x10] = {
|
||||
static u8 EDAT_IV[0x10] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
class KeyVault
|
||||
{
|
||||
Array<SELF_KEY> sk_LV0_arr;
|
||||
Array<SELF_KEY> sk_LV1_arr;
|
||||
Array<SELF_KEY> sk_LV2_arr;
|
||||
Array<SELF_KEY> sk_APP_arr;
|
||||
Array<SELF_KEY> sk_ISO_arr;
|
||||
Array<SELF_KEY> sk_LDR_arr;
|
||||
Array<SELF_KEY> sk_UNK7_arr;
|
||||
Array<SELF_KEY> sk_NPDRM_arr;
|
||||
u8 klicensee_key[0x10];
|
||||
|
||||
public:
|
||||
KeyVault();
|
||||
SELF_KEY FindSelfKey(u32 type, u16 revision, u64 version);
|
||||
void SetKlicenseeKey(u8 *key);
|
||||
u8 *GetKlicenseeKey();
|
||||
|
||||
private:
|
||||
void LoadSelfLV0Keys();
|
||||
void LoadSelfLDRKeys();
|
||||
void LoadSelfLV1Keys();
|
||||
void LoadSelfLV2Keys();
|
||||
void LoadSelfISOKeys();
|
||||
void LoadSelfAPPKeys();
|
||||
void LoadSelfUNK7Keys();
|
||||
void LoadSelfNPDRMKeys();
|
||||
SELF_KEY GetSelfLV0Key();
|
||||
SELF_KEY GetSelfLDRKey();
|
||||
SELF_KEY GetSelfLV1Key(u64 version);
|
||||
SELF_KEY GetSelfLV2Key(u64 version);
|
||||
SELF_KEY GetSelfISOKey(u16 revision, u64 version);
|
||||
SELF_KEY GetSelfAPPKey(u16 revision);
|
||||
SELF_KEY GetSelfUNK7Key(u64 version);
|
||||
SELF_KEY GetSelfNPDRMKey(u16 revision);
|
||||
};
|
||||
|
||||
|
||||
class KeyVault
|
||||
{
|
||||
std::vector<SELF_KEY> sk_LV0_arr;
|
||||
std::vector<SELF_KEY> sk_LV1_arr;
|
||||
std::vector<SELF_KEY> sk_LV2_arr;
|
||||
std::vector<SELF_KEY> sk_APP_arr;
|
||||
std::vector<SELF_KEY> sk_ISO_arr;
|
||||
std::vector<SELF_KEY> sk_LDR_arr;
|
||||
std::vector<SELF_KEY> sk_UNK7_arr;
|
||||
std::vector<SELF_KEY> sk_NPDRM_arr;
|
||||
u8 klicensee_key[0x10];
|
||||
|
||||
public:
|
||||
KeyVault();
|
||||
SELF_KEY FindSelfKey(u32 type, u16 revision, u64 version);
|
||||
void SetKlicenseeKey(u8 *key);
|
||||
u8 *GetKlicenseeKey();
|
||||
|
||||
private:
|
||||
void LoadSelfLV0Keys();
|
||||
void LoadSelfLDRKeys();
|
||||
void LoadSelfLV1Keys();
|
||||
void LoadSelfLV2Keys();
|
||||
void LoadSelfISOKeys();
|
||||
void LoadSelfAPPKeys();
|
||||
void LoadSelfUNK7Keys();
|
||||
void LoadSelfNPDRMKeys();
|
||||
SELF_KEY GetSelfLV0Key();
|
||||
SELF_KEY GetSelfLDRKey();
|
||||
SELF_KEY GetSelfLV1Key(u64 version);
|
||||
SELF_KEY GetSelfLV2Key(u64 version);
|
||||
SELF_KEY GetSelfISOKey(u16 revision, u64 version);
|
||||
SELF_KEY GetSelfAPPKey(u16 revision);
|
||||
SELF_KEY GetSelfUNK7Key(u64 version);
|
||||
SELF_KEY GetSelfNPDRMKey(u16 revision);
|
||||
};
|
||||
|
||||
// RAP to RIF function.
|
||||
void rap_to_rif(unsigned char* rap, unsigned char* rif);
|
||||
void rap_to_rif(unsigned char* rap, unsigned char* rif);
|
||||
|
@ -36,7 +36,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32)
|
||||
// Read ELF program headers.
|
||||
if (isElf32)
|
||||
{
|
||||
phdr32_arr.Clear();
|
||||
phdr32_arr.clear();
|
||||
if(elf32_hdr.e_phoff == 0 && elf32_hdr.e_phnum)
|
||||
{
|
||||
ConLog.Error("SELF: ELF program header offset is null!");
|
||||
@ -45,14 +45,13 @@ bool SELFDecrypter::LoadHeaders(bool isElf32)
|
||||
self_f.Seek(self_hdr.se_phdroff);
|
||||
for(u32 i = 0; i < elf32_hdr.e_phnum; ++i)
|
||||
{
|
||||
Elf32_Phdr* phdr = new Elf32_Phdr();
|
||||
phdr->Load(self_f);
|
||||
phdr32_arr.Move(phdr);
|
||||
phdr32_arr.emplace_back();
|
||||
phdr32_arr.back().Load(self_f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
phdr64_arr.Clear();
|
||||
phdr64_arr.clear();
|
||||
if(elf64_hdr.e_phoff == 0 && elf64_hdr.e_phnum)
|
||||
{
|
||||
ConLog.Error("SELF: ELF program header offset is null!");
|
||||
@ -61,22 +60,20 @@ bool SELFDecrypter::LoadHeaders(bool isElf32)
|
||||
self_f.Seek(self_hdr.se_phdroff);
|
||||
for(u32 i = 0; i < elf64_hdr.e_phnum; ++i)
|
||||
{
|
||||
Elf64_Phdr* phdr = new Elf64_Phdr();
|
||||
phdr->Load(self_f);
|
||||
phdr64_arr.Move(phdr);
|
||||
phdr64_arr.emplace_back();
|
||||
phdr64_arr.back().Load(self_f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Read section info.
|
||||
secinfo_arr.Clear();
|
||||
secinfo_arr.clear();
|
||||
self_f.Seek(self_hdr.se_secinfoff);
|
||||
|
||||
for(u32 i = 0; i < ((isElf32) ? elf32_hdr.e_phnum : elf64_hdr.e_phnum); ++i)
|
||||
{
|
||||
SectionInfo* sinfo = new SectionInfo();
|
||||
sinfo->Load(self_f);
|
||||
secinfo_arr.Move(sinfo);
|
||||
secinfo_arr.emplace_back();
|
||||
secinfo_arr.back().Load(self_f);
|
||||
}
|
||||
|
||||
// Read SCE version info.
|
||||
@ -84,22 +81,22 @@ bool SELFDecrypter::LoadHeaders(bool isElf32)
|
||||
scev_info.Load(self_f);
|
||||
|
||||
// Read control info.
|
||||
ctrlinfo_arr.Clear();
|
||||
ctrlinfo_arr.clear();
|
||||
self_f.Seek(self_hdr.se_controloff);
|
||||
|
||||
u32 i = 0;
|
||||
while(i < self_hdr.se_controlsize)
|
||||
{
|
||||
ControlInfo* cinfo = new ControlInfo();
|
||||
cinfo->Load(self_f);
|
||||
i += cinfo->size;
|
||||
ctrlinfo_arr.Move(cinfo);
|
||||
ctrlinfo_arr.emplace_back();
|
||||
ControlInfo &cinfo = ctrlinfo_arr.back();
|
||||
cinfo.Load(self_f);
|
||||
i += cinfo.size;
|
||||
}
|
||||
|
||||
// Read ELF section headers.
|
||||
if (isElf32)
|
||||
{
|
||||
shdr32_arr.Clear();
|
||||
shdr32_arr.clear();
|
||||
if(elf32_hdr.e_shoff == 0 && elf32_hdr.e_shnum)
|
||||
{
|
||||
ConLog.Warning("SELF: ELF section header offset is null!");
|
||||
@ -108,14 +105,13 @@ bool SELFDecrypter::LoadHeaders(bool isElf32)
|
||||
self_f.Seek(self_hdr.se_shdroff);
|
||||
for(u32 i = 0; i < elf32_hdr.e_shnum; ++i)
|
||||
{
|
||||
Elf32_Shdr* shdr = new Elf32_Shdr();
|
||||
shdr->Load(self_f);
|
||||
shdr32_arr.Move(shdr);
|
||||
shdr32_arr.emplace_back();
|
||||
shdr32_arr.back().Load(self_f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
shdr64_arr.Clear();
|
||||
shdr64_arr.clear();
|
||||
if(elf64_hdr.e_shoff == 0 && elf64_hdr.e_shnum)
|
||||
{
|
||||
ConLog.Warning("SELF: ELF section header offset is null!");
|
||||
@ -124,9 +120,8 @@ bool SELFDecrypter::LoadHeaders(bool isElf32)
|
||||
self_f.Seek(self_hdr.se_shdroff);
|
||||
for(u32 i = 0; i < elf64_hdr.e_shnum; ++i)
|
||||
{
|
||||
Elf64_Shdr* shdr = new Elf64_Shdr();
|
||||
shdr->Load(self_f);
|
||||
shdr64_arr.Move(shdr);
|
||||
shdr64_arr.emplace_back();
|
||||
shdr64_arr.back().Load(self_f);
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,12 +148,12 @@ void SELFDecrypter::ShowHeaders(bool isElf32)
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("ELF program headers");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
for(unsigned int i = 0; i < ((isElf32) ? phdr32_arr.GetCount() : phdr64_arr.GetCount()); i++)
|
||||
for(unsigned int i = 0; i < ((isElf32) ? phdr32_arr.size() : phdr64_arr.size()); i++)
|
||||
isElf32 ? phdr32_arr[i].Show() : phdr64_arr[i].Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("Section info");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
for(unsigned int i = 0; i < secinfo_arr.GetCount(); i++)
|
||||
for(unsigned int i = 0; i < secinfo_arr.size(); i++)
|
||||
secinfo_arr[i].Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("SCE version info");
|
||||
@ -167,12 +162,12 @@ void SELFDecrypter::ShowHeaders(bool isElf32)
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("Control info");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
for(unsigned int i = 0; i < ctrlinfo_arr.GetCount(); i++)
|
||||
for(unsigned int i = 0; i < ctrlinfo_arr.size(); i++)
|
||||
ctrlinfo_arr[i].Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("ELF section headers");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
for(unsigned int i = 0; i < ((isElf32) ? shdr32_arr.GetCount() : shdr64_arr.GetCount()); i++)
|
||||
for(unsigned int i = 0; i < ((isElf32) ? shdr32_arr.size() : shdr64_arr.size()); i++)
|
||||
isElf32 ? shdr32_arr[i].Show() : shdr64_arr[i].Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
}
|
||||
@ -185,7 +180,7 @@ bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size)
|
||||
u8 npdrm_iv[0x10];
|
||||
|
||||
// Parse the control info structures to find the NPDRM control info.
|
||||
for(unsigned int i = 0; i < ctrlinfo_arr.GetCount(); i++)
|
||||
for(unsigned int i = 0; i < ctrlinfo_arr.size(); i++)
|
||||
{
|
||||
if (ctrlinfo_arr[i].type == 3)
|
||||
{
|
||||
@ -307,12 +302,11 @@ bool SELFDecrypter::LoadMetadata()
|
||||
meta_hdr.Load(metadata_headers);
|
||||
|
||||
// Load the metadata section headers.
|
||||
meta_shdr.Clear();
|
||||
meta_shdr.clear();
|
||||
for (unsigned int i = 0; i < meta_hdr.section_count; i++)
|
||||
{
|
||||
MetadataSectionHeader* m_shdr = new MetadataSectionHeader();
|
||||
m_shdr->Load(metadata_headers + sizeof(meta_hdr) + sizeof(MetadataSectionHeader) * i);
|
||||
meta_shdr.Move(m_shdr);
|
||||
meta_shdr.emplace_back();
|
||||
meta_shdr.back().Load(metadata_headers + sizeof(meta_hdr) + sizeof(MetadataSectionHeader) * i);
|
||||
}
|
||||
|
||||
// Copy the decrypted data keys.
|
||||
|
@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
#include "utils.h"
|
||||
#include "key_vault.h"
|
||||
#include "Loader/ELF.h"
|
||||
#include "Loader/SELF.h"
|
||||
#include <wx/mstream.h>
|
||||
#include <wx/zstream.h>
|
||||
|
||||
#pragma once
|
||||
#include "utils.h"
|
||||
#include "key_vault.h"
|
||||
#include "Loader/ELF.h"
|
||||
#include "Loader/SELF.h"
|
||||
#include <wx/mstream.h>
|
||||
#include <wx/zstream.h>
|
||||
|
||||
struct AppInfo
|
||||
{
|
||||
u64 authid;
|
||||
@ -14,20 +14,20 @@ struct AppInfo
|
||||
u64 version;
|
||||
u64 padding;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
authid = Read64(f);
|
||||
vendor_id = Read32(f);
|
||||
self_type = Read32(f);
|
||||
version = Read64(f);
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
authid = Read64(f);
|
||||
vendor_id = Read32(f);
|
||||
self_type = Read32(f);
|
||||
version = Read64(f);
|
||||
padding = Read64(f);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
ConLog.Write("AuthID: 0x%llx", authid);
|
||||
ConLog.Write("VendorID: 0x%08x", vendor_id);
|
||||
ConLog.Write("SELF type: 0x%08x", self_type);
|
||||
void Show()
|
||||
{
|
||||
ConLog.Write("AuthID: 0x%llx", authid);
|
||||
ConLog.Write("VendorID: 0x%08x", vendor_id);
|
||||
ConLog.Write("SELF type: 0x%08x", self_type);
|
||||
ConLog.Write("Version: 0x%llx", version);
|
||||
}
|
||||
};
|
||||
@ -41,21 +41,21 @@ struct SectionInfo
|
||||
u32 unknown2;
|
||||
u32 encrypted;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
offset = Read64(f);
|
||||
size = Read64(f);
|
||||
compressed = Read32(f);
|
||||
unknown1 = Read32(f);
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
offset = Read64(f);
|
||||
size = Read64(f);
|
||||
compressed = Read32(f);
|
||||
unknown1 = Read32(f);
|
||||
unknown2 = Read32(f);
|
||||
encrypted = Read32(f);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
ConLog.Write("Offset: 0x%llx", offset);
|
||||
ConLog.Write("Size: 0x%llx", size);
|
||||
ConLog.Write("Compressed: 0x%08x", compressed);
|
||||
void Show()
|
||||
{
|
||||
ConLog.Write("Offset: 0x%llx", offset);
|
||||
ConLog.Write("Size: 0x%llx", size);
|
||||
ConLog.Write("Compressed: 0x%08x", compressed);
|
||||
ConLog.Write("Unknown1: 0x%08x", unknown1);
|
||||
ConLog.Write("Unknown2: 0x%08x", unknown2);
|
||||
ConLog.Write("Encrypted: 0x%08x", encrypted);
|
||||
@ -69,19 +69,19 @@ struct SCEVersionInfo
|
||||
u32 size;
|
||||
u32 unknown;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
subheader_type = Read32(f);
|
||||
present = Read32(f);
|
||||
size = Read32(f);
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
subheader_type = Read32(f);
|
||||
present = Read32(f);
|
||||
size = Read32(f);
|
||||
unknown = Read32(f);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
ConLog.Write("Sub-header type: 0x%08x", subheader_type);
|
||||
ConLog.Write("Present: 0x%08x", present);
|
||||
ConLog.Write("Size: 0x%08x", size);
|
||||
void Show()
|
||||
{
|
||||
ConLog.Write("Sub-header type: 0x%08x", subheader_type);
|
||||
ConLog.Write("Present: 0x%08x", present);
|
||||
ConLog.Write("Size: 0x%08x", size);
|
||||
ConLog.Write("Unknown: 0x%08x", unknown);
|
||||
}
|
||||
};
|
||||
@ -133,9 +133,9 @@ struct ControlInfo
|
||||
} npdrm;
|
||||
};
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
type = Read32(f);
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
type = Read32(f);
|
||||
size = Read32(f);
|
||||
next = Read64(f);
|
||||
|
||||
@ -179,10 +179,10 @@ struct ControlInfo
|
||||
}
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
ConLog.Write("Type: 0x%08x", type);
|
||||
ConLog.Write("Size: 0x%08x", size);
|
||||
void Show()
|
||||
{
|
||||
ConLog.Write("Type: 0x%08x", type);
|
||||
ConLog.Write("Size: 0x%08x", size);
|
||||
ConLog.Write("Next: 0x%llx", next);
|
||||
|
||||
if (type == 1)
|
||||
@ -259,11 +259,11 @@ struct MetadataInfo
|
||||
u8 iv[0x10];
|
||||
u8 iv_pad[0x10];
|
||||
|
||||
void Load(u8* in)
|
||||
{
|
||||
memcpy(key, in, 0x10);
|
||||
memcpy(key_pad, in + 0x10, 0x10);
|
||||
memcpy(iv, in + 0x20, 0x10);
|
||||
void Load(u8* in)
|
||||
{
|
||||
memcpy(key, in, 0x10);
|
||||
memcpy(key_pad, in + 0x10, 0x10);
|
||||
memcpy(iv, in + 0x20, 0x10);
|
||||
memcpy(iv_pad, in + 0x30, 0x10);
|
||||
}
|
||||
|
||||
@ -298,11 +298,11 @@ struct MetadataHeader
|
||||
u32 unknown2;
|
||||
u32 unknown3;
|
||||
|
||||
void Load(u8* in)
|
||||
{
|
||||
memcpy(&signature_input_length, in, 8);
|
||||
memcpy(&unknown1, in + 8, 4);
|
||||
memcpy(§ion_count, in + 12, 4);
|
||||
void Load(u8* in)
|
||||
{
|
||||
memcpy(&signature_input_length, in, 8);
|
||||
memcpy(&unknown1, in + 8, 4);
|
||||
memcpy(§ion_count, in + 12, 4);
|
||||
memcpy(&key_count, in + 16, 4);
|
||||
memcpy(&opt_header_size, in + 20, 4);
|
||||
memcpy(&unknown2, in + 24, 4);
|
||||
@ -318,11 +318,11 @@ struct MetadataHeader
|
||||
unknown3 = swap32(unknown3);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
ConLog.Write("Signature input length: 0x%llx", signature_input_length);
|
||||
ConLog.Write("Unknown1: 0x%08x", unknown1);
|
||||
ConLog.Write("Section count: 0x%08x", section_count);
|
||||
void Show()
|
||||
{
|
||||
ConLog.Write("Signature input length: 0x%llx", signature_input_length);
|
||||
ConLog.Write("Unknown1: 0x%08x", unknown1);
|
||||
ConLog.Write("Section count: 0x%08x", section_count);
|
||||
ConLog.Write("Key count: 0x%08x", key_count);
|
||||
ConLog.Write("Optional header size: 0x%08x", opt_header_size);
|
||||
ConLog.Write("Unknown2: 0x%08x", unknown2);
|
||||
@ -343,17 +343,17 @@ struct MetadataSectionHeader
|
||||
u32 iv_idx;
|
||||
u32 compressed;
|
||||
|
||||
void Load(u8* in)
|
||||
{
|
||||
memcpy(&data_offset, in, 8);
|
||||
memcpy(&data_size, in + 8, 8);
|
||||
memcpy(&type, in + 16, 4);
|
||||
memcpy(&program_idx, in + 20, 4);
|
||||
memcpy(&hashed, in + 24, 4);
|
||||
memcpy(&sha1_idx, in + 28, 4);
|
||||
memcpy(&encrypted, in + 32, 4);
|
||||
memcpy(&key_idx, in + 36, 4);
|
||||
memcpy(&iv_idx, in + 40, 4);
|
||||
void Load(u8* in)
|
||||
{
|
||||
memcpy(&data_offset, in, 8);
|
||||
memcpy(&data_size, in + 8, 8);
|
||||
memcpy(&type, in + 16, 4);
|
||||
memcpy(&program_idx, in + 20, 4);
|
||||
memcpy(&hashed, in + 24, 4);
|
||||
memcpy(&sha1_idx, in + 28, 4);
|
||||
memcpy(&encrypted, in + 32, 4);
|
||||
memcpy(&key_idx, in + 36, 4);
|
||||
memcpy(&iv_idx, in + 40, 4);
|
||||
memcpy(&compressed, in + 44, 4);
|
||||
|
||||
// Endian swap.
|
||||
@ -369,11 +369,11 @@ struct MetadataSectionHeader
|
||||
compressed = swap32(compressed);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
ConLog.Write("Data offset: 0x%llx", data_offset);
|
||||
ConLog.Write("Data size: 0x%llx", data_size);
|
||||
ConLog.Write("Type: 0x%08x", type);
|
||||
void Show()
|
||||
{
|
||||
ConLog.Write("Data offset: 0x%llx", data_offset);
|
||||
ConLog.Write("Data size: 0x%llx", data_size);
|
||||
ConLog.Write("Type: 0x%08x", type);
|
||||
ConLog.Write("Program index: 0x%08x", program_idx);
|
||||
ConLog.Write("Hashed: 0x%08x", hashed);
|
||||
ConLog.Write("SHA1 index: 0x%08x", sha1_idx);
|
||||
@ -389,10 +389,10 @@ struct SectionHash {
|
||||
u8 padding[12];
|
||||
u8 hmac_key[64];
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
f.Read(sha1, 20);
|
||||
f.Read(padding, 12);
|
||||
f.Read(padding, 12);
|
||||
f.Read(hmac_key, 64);
|
||||
}
|
||||
};
|
||||
@ -409,12 +409,12 @@ struct CapabilitiesInfo
|
||||
u32 unknown4;
|
||||
u32 unknown5;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
type = Read32(f);
|
||||
capabilities_size = Read32(f);
|
||||
next = Read32(f);
|
||||
unknown1 = Read32(f);
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
type = Read32(f);
|
||||
capabilities_size = Read32(f);
|
||||
next = Read32(f);
|
||||
unknown1 = Read32(f);
|
||||
unknown2 = Read64(f);
|
||||
unknown3 = Read64(f);
|
||||
flags = Read64(f);
|
||||
@ -429,10 +429,10 @@ struct Signature
|
||||
u8 s[21];
|
||||
u8 padding[6];
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
f.Read(r, 21);
|
||||
f.Read(s, 21);
|
||||
f.Read(s, 21);
|
||||
f.Read(padding, 6);
|
||||
}
|
||||
};
|
||||
@ -443,65 +443,65 @@ struct SelfSection
|
||||
u64 size;
|
||||
u64 offset;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
*data = Read32(f);
|
||||
size = Read64(f);
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
*data = Read32(f);
|
||||
size = Read64(f);
|
||||
offset = Read64(f);
|
||||
}
|
||||
};
|
||||
|
||||
class SELFDecrypter
|
||||
{
|
||||
// Main SELF file stream.
|
||||
vfsStream& self_f;
|
||||
|
||||
// SCE, SELF and APP headers.
|
||||
SceHeader sce_hdr;
|
||||
SelfHeader self_hdr;
|
||||
AppInfo app_info;
|
||||
|
||||
// ELF64 header and program header/section header arrays.
|
||||
Elf64_Ehdr elf64_hdr;
|
||||
Array<Elf64_Shdr> shdr64_arr;
|
||||
Array<Elf64_Phdr> phdr64_arr;
|
||||
|
||||
// ELF32 header and program header/section header arrays.
|
||||
Elf32_Ehdr elf32_hdr;
|
||||
Array<Elf32_Shdr> shdr32_arr;
|
||||
Array<Elf32_Phdr> phdr32_arr;
|
||||
|
||||
// Decryption info structs.
|
||||
Array<SectionInfo> secinfo_arr;
|
||||
SCEVersionInfo scev_info;
|
||||
Array<ControlInfo> ctrlinfo_arr;
|
||||
|
||||
// Metadata structs.
|
||||
MetadataInfo meta_info;
|
||||
MetadataHeader meta_hdr;
|
||||
Array<MetadataSectionHeader> meta_shdr;
|
||||
|
||||
// Internal data buffers.
|
||||
u8 *data_keys;
|
||||
u32 data_keys_length;
|
||||
u8 *data_buf;
|
||||
u32 data_buf_length;
|
||||
|
||||
// Main key vault instance.
|
||||
KeyVault key_v;
|
||||
|
||||
public:
|
||||
SELFDecrypter(vfsStream& s);
|
||||
bool MakeElf(const std::string& elf, bool isElf32);
|
||||
bool LoadHeaders(bool isElf32);
|
||||
void ShowHeaders(bool isElf32);
|
||||
bool LoadMetadata();
|
||||
bool DecryptData();
|
||||
bool DecryptNPDRM(u8 *metadata, u32 metadata_size);
|
||||
bool GetKeyFromRap(u8 *content_id, u8 *npdrm_key);
|
||||
};
|
||||
|
||||
extern bool IsSelf(const std::string& path);
|
||||
extern bool IsSelfElf32(const std::string& path);
|
||||
extern bool CheckDebugSelf(const std::string& self, const std::string& elf);
|
||||
extern bool DecryptSelf(const std::string& elf, const std::string& self);
|
||||
};
|
||||
|
||||
class SELFDecrypter
|
||||
{
|
||||
// Main SELF file stream.
|
||||
vfsStream& self_f;
|
||||
|
||||
// SCE, SELF and APP headers.
|
||||
SceHeader sce_hdr;
|
||||
SelfHeader self_hdr;
|
||||
AppInfo app_info;
|
||||
|
||||
// ELF64 header and program header/section header arrays.
|
||||
Elf64_Ehdr elf64_hdr;
|
||||
std::vector<Elf64_Shdr> shdr64_arr;
|
||||
std::vector<Elf64_Phdr> phdr64_arr;
|
||||
|
||||
// ELF32 header and program header/section header arrays.
|
||||
Elf32_Ehdr elf32_hdr;
|
||||
std::vector<Elf32_Shdr> shdr32_arr;
|
||||
std::vector<Elf32_Phdr> phdr32_arr;
|
||||
|
||||
// Decryption info structs.
|
||||
std::vector<SectionInfo> secinfo_arr;
|
||||
SCEVersionInfo scev_info;
|
||||
std::vector<ControlInfo> ctrlinfo_arr;
|
||||
|
||||
// Metadata structs.
|
||||
MetadataInfo meta_info;
|
||||
MetadataHeader meta_hdr;
|
||||
std::vector<MetadataSectionHeader> meta_shdr;
|
||||
|
||||
// Internal data buffers.
|
||||
u8 *data_keys;
|
||||
u32 data_keys_length;
|
||||
u8 *data_buf;
|
||||
u32 data_buf_length;
|
||||
|
||||
// Main key vault instance.
|
||||
KeyVault key_v;
|
||||
|
||||
public:
|
||||
SELFDecrypter(vfsStream& s);
|
||||
bool MakeElf(const std::string& elf, bool isElf32);
|
||||
bool LoadHeaders(bool isElf32);
|
||||
void ShowHeaders(bool isElf32);
|
||||
bool LoadMetadata();
|
||||
bool DecryptData();
|
||||
bool DecryptNPDRM(u8 *metadata, u32 metadata_size);
|
||||
bool GetKeyFromRap(u8 *content_id, u8 *npdrm_key);
|
||||
};
|
||||
|
||||
extern bool IsSelf(const std::string& path);
|
||||
extern bool IsSelfElf32(const std::string& path);
|
||||
extern bool CheckDebugSelf(const std::string& self, const std::string& elf);
|
||||
extern bool DecryptSelf(const std::string& elf, const std::string& self);
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include "stdafx.h"
|
||||
#include "utils.h"
|
||||
|
||||
// Endian swap auxiliary functions.
|
||||
#include "stdafx.h"
|
||||
#include "utils.h"
|
||||
|
||||
// Endian swap auxiliary functions.
|
||||
u16 swap16(u16 i)
|
||||
{
|
||||
return ((i & 0xFF00) >> 8) | ((i & 0xFF) << 8);
|
||||
}
|
||||
|
||||
{
|
||||
return ((i & 0xFF00) >> 8) | ((i & 0xFF) << 8);
|
||||
}
|
||||
|
||||
u32 swap32(u32 i)
|
||||
{
|
||||
return ((i & 0xFF000000) >> 24) | ((i & 0xFF0000) >> 8) | ((i & 0xFF00) << 8) | ((i & 0xFF) << 24);
|
||||
@ -28,32 +28,32 @@ void xor_(unsigned char *dest, unsigned char *src1, unsigned char *src2, int siz
|
||||
dest[i] = src1[i] ^ src2[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Hex string conversion auxiliary functions.
|
||||
u64 hex_to_u64(const char* hex_str)
|
||||
{
|
||||
u32 length = strlen(hex_str);
|
||||
u64 tmp = 0;
|
||||
u64 result = 0;
|
||||
char c;
|
||||
|
||||
while (length--)
|
||||
{
|
||||
c = *hex_str++;
|
||||
if((c >= '0') && (c <= '9'))
|
||||
tmp = c - '0';
|
||||
else if((c >= 'a') && (c <= 'f'))
|
||||
tmp = c - 'a' + 10;
|
||||
else if((c >= 'A') && (c <= 'F'))
|
||||
tmp = c - 'A' + 10;
|
||||
else
|
||||
tmp = 0;
|
||||
result |= (tmp << (length * 4));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Hex string conversion auxiliary functions.
|
||||
u64 hex_to_u64(const char* hex_str)
|
||||
{
|
||||
u32 length = strlen(hex_str);
|
||||
u64 tmp = 0;
|
||||
u64 result = 0;
|
||||
char c;
|
||||
|
||||
while (length--)
|
||||
{
|
||||
c = *hex_str++;
|
||||
if((c >= '0') && (c <= '9'))
|
||||
tmp = c - '0';
|
||||
else if((c >= 'a') && (c <= 'f'))
|
||||
tmp = c - 'a' + 10;
|
||||
else if((c >= 'A') && (c <= 'F'))
|
||||
tmp = c - 'A' + 10;
|
||||
else
|
||||
tmp = 0;
|
||||
result |= (tmp << (length * 4));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void hex_to_bytes(unsigned char *data, const char *hex_str)
|
||||
{
|
||||
u32 str_length = strlen(hex_str);
|
||||
@ -101,19 +101,19 @@ bool hmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int i
|
||||
{
|
||||
unsigned char *out = new unsigned char[key_len];
|
||||
|
||||
sha1_hmac(key, key_len, in, in_len, out);
|
||||
|
||||
for (int i = 0; i < 0x10; i++)
|
||||
{
|
||||
if (out[i] != hash[i])
|
||||
sha1_hmac(key, key_len, in, in_len, out);
|
||||
|
||||
for (int i = 0; i < 0x10; i++)
|
||||
{
|
||||
if (out[i] != hash[i])
|
||||
{
|
||||
delete[] out;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
delete[] out;
|
||||
|
||||
delete[] out;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
delete[] out;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -123,19 +123,19 @@ bool cmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int i
|
||||
|
||||
aes_context ctx;
|
||||
aes_setkey_enc(&ctx, key, 128);
|
||||
aes_cmac(&ctx, in_len, in, out);
|
||||
|
||||
for (int i = 0; i < key_len; i++)
|
||||
{
|
||||
if (out[i] != hash[i])
|
||||
aes_cmac(&ctx, in_len, in, out);
|
||||
|
||||
for (int i = 0; i < key_len; i++)
|
||||
{
|
||||
if (out[i] != hash[i])
|
||||
{
|
||||
delete[] out;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
delete[] out;
|
||||
|
||||
delete[] out;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
delete[] out;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -744,4 +744,4 @@ int lz_decompress(unsigned char *out, unsigned char *in, unsigned int size)
|
||||
delete[] tmp;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
#include "aes.h"
|
||||
#include "sha1.h"
|
||||
|
||||
// Auxiliary functions (endian swap and xor).
|
||||
u16 swap16(u16 i);
|
||||
u32 swap32(u32 i);
|
||||
u64 swap64(u64 i);
|
||||
#include "sha1.h"
|
||||
|
||||
// Auxiliary functions (endian swap and xor).
|
||||
u16 swap16(u16 i);
|
||||
u32 swap32(u32 i);
|
||||
u64 swap64(u64 i);
|
||||
void xor_(unsigned char *dest, unsigned char *src1, unsigned char *src2, int size);
|
||||
|
||||
// Hex string conversion auxiliary functions.
|
||||
u64 hex_to_u64(const char* hex_str);
|
||||
void hex_to_bytes(unsigned char *data, const char *hex_str);
|
||||
|
||||
// Hex string conversion auxiliary functions.
|
||||
u64 hex_to_u64(const char* hex_str);
|
||||
void hex_to_bytes(unsigned char *data, const char *hex_str);
|
||||
|
||||
// Crypto functions (AES128-CBC, AES128-ECB, SHA1-HMAC and AES-CMAC).
|
||||
void aescbc128_decrypt(unsigned char *key, unsigned char *iv, unsigned char *in, unsigned char *out, int len);
|
||||
@ -19,4 +19,4 @@ bool hmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int i
|
||||
bool cmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash);
|
||||
|
||||
// Reverse-engineered custom Lempel–Ziv–Markov based compression (unknown variant of LZRC).
|
||||
int lz_decompress(unsigned char *out, unsigned char *in, unsigned int size);
|
||||
int lz_decompress(unsigned char *out, unsigned char *in, unsigned int size);
|
||||
|
@ -98,7 +98,7 @@ struct AudioConfig //custom structure
|
||||
u32 m_port_in_use;
|
||||
u64 counter;
|
||||
u64 start_time;
|
||||
Array<u64> m_keys;
|
||||
std::vector<u64> m_keys;
|
||||
|
||||
AudioConfig()
|
||||
: m_is_audio_initialized(false)
|
||||
|
@ -7,15 +7,15 @@ class CPUDecoder
|
||||
{
|
||||
public:
|
||||
virtual u8 DecodeMemory(const u64 address)=0;
|
||||
|
||||
virtual ~CPUDecoder() = default;
|
||||
};
|
||||
|
||||
template<typename TO>
|
||||
class InstrCaller
|
||||
{
|
||||
public:
|
||||
virtual ~InstrCaller<TO>()
|
||||
{
|
||||
}
|
||||
virtual ~InstrCaller<TO>() = default;
|
||||
|
||||
virtual void operator ()(TO* op, u32 code) const = 0;
|
||||
|
||||
@ -334,6 +334,17 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
virtual ~InstrBase()
|
||||
{
|
||||
if (m_args) {
|
||||
// m_args contains pointers to statically allocated CodeFieldBase objects
|
||||
// We shouldn't call delete on these, they aren't allocated with new
|
||||
|
||||
// The m_args array itself, however, should be deleted
|
||||
delete[] m_args;
|
||||
}
|
||||
}
|
||||
|
||||
__forceinline const std::string& GetName() const
|
||||
{
|
||||
return m_name;
|
||||
@ -355,13 +366,13 @@ public:
|
||||
decode(op, code);
|
||||
}
|
||||
|
||||
u32 operator()(const Array<u32>& args) const
|
||||
u32 operator()(const std::vector<u32>& args) const
|
||||
{
|
||||
return encode(args);
|
||||
}
|
||||
|
||||
virtual void decode(TO* op, u32 code) const=0;
|
||||
virtual u32 encode(const Array<u32>& args) const=0;
|
||||
virtual u32 encode(const std::vector<u32>& args) const=0;
|
||||
};
|
||||
|
||||
template<int _count, typename TO>
|
||||
@ -396,12 +407,54 @@ public:
|
||||
|
||||
virtual ~InstrList()
|
||||
{
|
||||
for(int i=0; i<count; ++i)
|
||||
bool deletedErrorFunc = false;
|
||||
|
||||
// Clean up m_instrs
|
||||
for(int i = 0; i < count; ++i)
|
||||
{
|
||||
delete m_instrs[i];
|
||||
InstrCaller<TO>* deleteMe = m_instrs[i];
|
||||
|
||||
if (deleteMe) { // deleteMe will be a nullptr if we've already deleted it through another reference
|
||||
// Remove any instances of pointers to this instruction caller from our m_instrs list
|
||||
m_instrs[i] = nullptr;
|
||||
for (int j = i + 1; j < count; j++) {
|
||||
if (m_instrs[j] == deleteMe) {
|
||||
m_instrs[j] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// If we're deleting the error handler here, remember it so we don't try to delete it again later
|
||||
if (deleteMe == m_error_func) {
|
||||
deletedErrorFunc = true;
|
||||
}
|
||||
|
||||
// Delete the instruction caller
|
||||
delete deleteMe;
|
||||
}
|
||||
}
|
||||
|
||||
delete m_error_func;
|
||||
// Clean up m_instrs_info
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
InstrBase<TO>* deleteMe = m_instrs_info[i];
|
||||
|
||||
if (deleteMe) {
|
||||
m_instrs_info[i] = nullptr;
|
||||
for (int j = i + 1; j < count; j++) {
|
||||
if (m_instrs_info[j] == deleteMe) {
|
||||
m_instrs[j] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
delete deleteMe;
|
||||
}
|
||||
}
|
||||
|
||||
// If we haven't already deleted our error handler, and we have one, then delete it now
|
||||
if (!deletedErrorFunc && m_error_func)
|
||||
{
|
||||
delete m_error_func;
|
||||
}
|
||||
}
|
||||
|
||||
void set_parent(InstrCaller<TO>* parent, int opcode)
|
||||
@ -508,9 +561,9 @@ public:
|
||||
m_list.decode(op, opcode, code);
|
||||
}
|
||||
|
||||
virtual u32 encode(const Array<u32>& args) const
|
||||
virtual u32 encode(const std::vector<u32>& args) const
|
||||
{
|
||||
assert(args.GetCount() == InstrBase<TO>::m_args_count);
|
||||
assert(args.size() == InstrBase<TO>::m_args_count);
|
||||
return m_list.encode(opcode);
|
||||
}
|
||||
|
||||
@ -547,9 +600,9 @@ public:
|
||||
m_list.decode(op, opcode, code);
|
||||
}
|
||||
|
||||
virtual u32 encode(const Array<u32>& args) const
|
||||
virtual u32 encode(const std::vector<u32>& args) const
|
||||
{
|
||||
assert(args.GetCount() == InstrBase<TO>::m_args_count);
|
||||
assert(args.size() == InstrBase<TO>::m_args_count);
|
||||
return m_list.encode(opcode) | (*InstrBase<TO>::m_args[0])[args[0]];
|
||||
}
|
||||
|
||||
@ -588,9 +641,9 @@ public:
|
||||
m_list.decode(op, opcode, code);
|
||||
}
|
||||
|
||||
virtual u32 encode(const Array<u32>& args) const
|
||||
virtual u32 encode(const std::vector<u32>& args) const
|
||||
{
|
||||
assert(args.GetCount() == InstrBase<TO>::m_args_count);
|
||||
assert(args.size() == InstrBase<TO>::m_args_count);
|
||||
return m_list.encode(opcode) | (*InstrBase<TO>::m_args[0])[args[0]] | (*InstrBase<TO>::m_args[1])[args[1]];
|
||||
}
|
||||
|
||||
@ -631,9 +684,9 @@ public:
|
||||
m_list.decode(op, opcode, code);
|
||||
}
|
||||
|
||||
virtual u32 encode(const Array<u32>& args) const
|
||||
virtual u32 encode(const std::vector<u32>& args) const
|
||||
{
|
||||
assert(args.GetCount() == InstrBase<TO>::m_args_count);
|
||||
assert(args.size() == InstrBase<TO>::m_args_count);
|
||||
return m_list.encode(opcode) | (*InstrBase<TO>::m_args[0])[args[0]] | (*InstrBase<TO>::m_args[1])[args[1]] | (*InstrBase<TO>::m_args[2])[args[2]];
|
||||
}
|
||||
|
||||
@ -676,9 +729,9 @@ public:
|
||||
m_list.decode(op, opcode, code);
|
||||
}
|
||||
|
||||
virtual u32 encode(const Array<u32>& args) const
|
||||
virtual u32 encode(const std::vector<u32>& args) const
|
||||
{
|
||||
assert(args.GetCount() == InstrBase<TO>::m_args_count);
|
||||
assert(args.size() == InstrBase<TO>::m_args_count);
|
||||
return m_list.encode(opcode) |
|
||||
(*InstrBase<TO>::m_args[0])[args[0]] |
|
||||
(*InstrBase<TO>::m_args[1])[args[1]] |
|
||||
@ -731,9 +784,9 @@ public:
|
||||
m_list.decode(op, opcode, code);
|
||||
}
|
||||
|
||||
virtual u32 encode(const Array<u32>& args) const
|
||||
virtual u32 encode(const std::vector<u32>& args) const
|
||||
{
|
||||
assert(args.GetCount() == InstrBase<TO>::m_args_count);
|
||||
assert(args.size() == InstrBase<TO>::m_args_count);
|
||||
return m_list.encode(opcode) |
|
||||
(*InstrBase<TO>::m_args[0])[args[0]] |
|
||||
(*InstrBase<TO>::m_args[1])[args[1]] |
|
||||
@ -790,9 +843,9 @@ public:
|
||||
m_list.decode(op, opcode, code);
|
||||
}
|
||||
|
||||
virtual u32 encode(const Array<u32>& args) const
|
||||
virtual u32 encode(const std::vector<u32>& args) const
|
||||
{
|
||||
assert(args.GetCount() == InstrBase<TO>::m_args_count);
|
||||
assert(args.size() == InstrBase<TO>::m_args_count);
|
||||
return m_list.encode(opcode) |
|
||||
(*InstrBase<TO>::m_args[0])[args[0]] |
|
||||
(*InstrBase<TO>::m_args[1])[args[1]] |
|
||||
|
@ -26,6 +26,7 @@ CPUThread::CPUThread(CPUThreadType type)
|
||||
|
||||
CPUThread::~CPUThread()
|
||||
{
|
||||
safe_delete(m_dec);
|
||||
}
|
||||
|
||||
void CPUThread::Close()
|
||||
@ -298,11 +299,11 @@ void CPUThread::Task()
|
||||
{
|
||||
if (Ini.HLELogging.GetValue()) ConLog.Write("%s enter", CPUThread::GetFName().c_str());
|
||||
|
||||
const Array<u64>& bp = Emu.GetBreakPoints();
|
||||
const std::vector<u64>& bp = Emu.GetBreakPoints();
|
||||
|
||||
try
|
||||
{
|
||||
for(uint i=0; i<bp.GetCount(); ++i)
|
||||
for(uint i=0; i<bp.size(); ++i)
|
||||
{
|
||||
if(bp[i] == m_offset + PC)
|
||||
{
|
||||
@ -335,7 +336,7 @@ void CPUThread::Task()
|
||||
break;
|
||||
}
|
||||
|
||||
for(uint i=0; i<bp.GetCount(); ++i)
|
||||
for(uint i=0; i<bp.size(); ++i)
|
||||
{
|
||||
if(bp[i] == PC)
|
||||
{
|
||||
|
@ -196,13 +196,13 @@ public:
|
||||
u64 branch_pc;
|
||||
};
|
||||
|
||||
Stack<CallStackItem> m_call_stack;
|
||||
std::vector<CallStackItem> m_call_stack;
|
||||
|
||||
std::string CallStackToString()
|
||||
{
|
||||
std::string ret = "Call Stack:\n==========\n";
|
||||
|
||||
for(uint i=0; i<m_call_stack.GetCount(); ++i)
|
||||
for(uint i=0; i<m_call_stack.size(); ++i)
|
||||
{
|
||||
ret += fmt::Format("0x%llx -> 0x%llx\n", m_call_stack[i].pc, m_call_stack[i].branch_pc);
|
||||
}
|
||||
@ -212,21 +212,25 @@ public:
|
||||
|
||||
void CallStackBranch(u64 pc)
|
||||
{
|
||||
for(int i=m_call_stack.GetCount() - 1; i >= 0; --i)
|
||||
{
|
||||
if(CallStackGetNextPC(m_call_stack[i].pc) == pc)
|
||||
//look if we're jumping back and if so pop the stack back to that position
|
||||
auto res = std::find_if(m_call_stack.rbegin(), m_call_stack.rend(),
|
||||
[&pc, this](CallStackItem &it)
|
||||
{
|
||||
m_call_stack.RemoveAt(i, m_call_stack.GetCount() - i);
|
||||
return;
|
||||
}
|
||||
return CallStackGetNextPC(it.pc) == pc;
|
||||
});
|
||||
if (res != m_call_stack.rend())
|
||||
{
|
||||
m_call_stack.erase((res + 1).base(), m_call_stack.end());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//add a new entry otherwise
|
||||
CallStackItem new_item;
|
||||
|
||||
|
||||
new_item.branch_pc = pc;
|
||||
new_item.pc = PC;
|
||||
|
||||
m_call_stack.Push(new_item);
|
||||
|
||||
m_call_stack.push_back(new_item);
|
||||
}
|
||||
|
||||
virtual u64 CallStackGetNextPC(u64 pc)
|
||||
|
@ -18,7 +18,7 @@ CPUThreadManager::~CPUThreadManager()
|
||||
void CPUThreadManager::Close()
|
||||
{
|
||||
m_raw_spu_num = 0;
|
||||
while(m_threads.GetCount()) RemoveThread(m_threads[0].GetId());
|
||||
while(m_threads.size()) RemoveThread(m_threads[0]->GetId());
|
||||
}
|
||||
|
||||
CPUThread& CPUThreadManager::AddThread(CPUThreadType type)
|
||||
@ -38,7 +38,7 @@ CPUThread& CPUThreadManager::AddThread(CPUThreadType type)
|
||||
|
||||
new_thread->SetId(Emu.GetIdManager().GetNewID(fmt::Format("%s Thread", new_thread->GetTypeString().c_str()), new_thread));
|
||||
|
||||
m_threads.Add(new_thread);
|
||||
m_threads.push_back(new_thread);
|
||||
#ifndef QT_UI
|
||||
wxGetApp().SendDbgCommand(DID_CREATE_THREAD, new_thread);
|
||||
#endif
|
||||
@ -50,26 +50,34 @@ void CPUThreadManager::RemoveThread(const u32 id)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mtx_thread);
|
||||
|
||||
for(u32 i=0; i<m_threads.GetCount(); ++i)
|
||||
CPUThread* thr = nullptr;
|
||||
u32 thread_index = 0;
|
||||
|
||||
for (u32 i = 0; i < m_threads.size(); ++i)
|
||||
{
|
||||
if(m_threads[i].m_wait_thread_id == id)
|
||||
if (m_threads[i]->m_wait_thread_id == id)
|
||||
{
|
||||
m_threads[i].Wait(false);
|
||||
m_threads[i].m_wait_thread_id = -1;
|
||||
m_threads[i]->Wait(false);
|
||||
m_threads[i]->m_wait_thread_id = -1;
|
||||
}
|
||||
|
||||
if(m_threads[i].GetId() != id) continue;
|
||||
if (m_threads[i]->GetId() != id) continue;
|
||||
|
||||
CPUThread* thr = &m_threads[i];
|
||||
thr = m_threads[i];
|
||||
thread_index = i;
|
||||
}
|
||||
|
||||
if (thr)
|
||||
{
|
||||
#ifndef QT_UI
|
||||
wxGetApp().SendDbgCommand(DID_REMOVE_THREAD, thr);
|
||||
#endif
|
||||
thr->Close();
|
||||
|
||||
m_threads.RemoveFAt(i);
|
||||
break;
|
||||
m_threads.erase(m_threads.begin() + thread_index);
|
||||
}
|
||||
|
||||
// Removing the ID should trigger the actual deletion of the thread
|
||||
Emu.GetIdManager().RemoveID(id);
|
||||
Emu.CheckStatus();
|
||||
}
|
||||
@ -80,10 +88,10 @@ s32 CPUThreadManager::GetThreadNumById(CPUThreadType type, u32 id)
|
||||
|
||||
s32 num = 0;
|
||||
|
||||
for(u32 i=0; i<m_threads.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_threads.size(); ++i)
|
||||
{
|
||||
if(m_threads[i].GetId() == id) return num;
|
||||
if(m_threads[i].GetType() == type) num++;
|
||||
if(m_threads[i]->GetId() == id) return num;
|
||||
if(m_threads[i]->GetType() == type) num++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
@ -104,8 +112,8 @@ void CPUThreadManager::Exec()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mtx_thread);
|
||||
|
||||
for(u32 i=0; i<m_threads.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_threads.size(); ++i)
|
||||
{
|
||||
m_threads[i].Exec();
|
||||
m_threads[i]->Exec();
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,9 @@ enum CPUThreadType : unsigned char;
|
||||
|
||||
class CPUThreadManager
|
||||
{
|
||||
ArrayF<CPUThread> m_threads;
|
||||
std::vector<CPUThread*> m_threads;
|
||||
std::mutex m_mtx_thread;
|
||||
wxSemaphore m_sem_task;
|
||||
Stack<u32> m_delete_threads;
|
||||
u32 m_raw_spu_num;
|
||||
|
||||
public:
|
||||
@ -19,7 +18,7 @@ public:
|
||||
CPUThread& AddThread(CPUThreadType type);
|
||||
void RemoveThread(const u32 id);
|
||||
|
||||
ArrayF<CPUThread>& GetThreads() { return m_threads; }
|
||||
std::vector<CPUThread*>& GetThreads() { return m_threads; }
|
||||
s32 GetThreadNumById(CPUThreadType type, u32 id);
|
||||
CPUThread* GetThread(u32 id);
|
||||
|
||||
|
@ -8,6 +8,8 @@ public:
|
||||
virtual void Decode(const u32 code)=0;
|
||||
|
||||
virtual u8 DecodeMemory(const u64 address);
|
||||
|
||||
virtual ~PPCDecoder() = default;
|
||||
};
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@ class PPCThread : public CPUThread
|
||||
{
|
||||
protected:
|
||||
u64 m_args[4];
|
||||
Array<u64> m_argv_addr;
|
||||
std::vector<u64> m_argv_addr;
|
||||
|
||||
public:
|
||||
virtual void InitRegs()=0;
|
||||
@ -30,4 +30,4 @@ protected:
|
||||
virtual void DoReset() override;
|
||||
};
|
||||
|
||||
PPCThread* GetCurrentPPCThread();
|
||||
PPCThread* GetCurrentPPCThread();
|
||||
|
@ -17,7 +17,7 @@ PPCThreadManager::~PPCThreadManager()
|
||||
|
||||
void PPCThreadManager::Close()
|
||||
{
|
||||
while(m_threads.GetCount()) RemoveThread(m_threads[0].GetId());
|
||||
while(m_threads.size()) RemoveThread(m_threads[0]->GetId());
|
||||
}
|
||||
|
||||
PPCThread& PPCThreadManager::AddThread(PPCThreadType type)
|
||||
@ -36,7 +36,7 @@ PPCThread& PPCThreadManager::AddThread(PPCThreadType type)
|
||||
|
||||
new_thread->SetId(Emu.GetIdManager().GetNewID(fmt::Format("%s Thread", name), new_thread));
|
||||
|
||||
m_threads.Add(new_thread);
|
||||
m_threads.push_back(new_thread);
|
||||
wxGetApp().SendDbgCommand(DID_CREATE_THREAD, new_thread);
|
||||
|
||||
return *new_thread;
|
||||
@ -46,17 +46,17 @@ void PPCThreadManager::RemoveThread(const u32 id)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mtx_thread);
|
||||
|
||||
for(u32 i=0; i<m_threads.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_threads.size(); ++i)
|
||||
{
|
||||
if(m_threads[i].m_wait_thread_id == id)
|
||||
if(m_threads[i]->m_wait_thread_id == id)
|
||||
{
|
||||
m_threads[i].Wait(false);
|
||||
m_threads[i].m_wait_thread_id = -1;
|
||||
m_threads[i]->Wait(false);
|
||||
m_threads[i]->m_wait_thread_id = -1;
|
||||
}
|
||||
|
||||
if(m_threads[i].GetId() != id) continue;
|
||||
if(m_threads[i]->GetId() != id) continue;
|
||||
|
||||
PPCThread* thr = &m_threads[i];
|
||||
PPCThread* thr = m_threads[i];
|
||||
wxGetApp().SendDbgCommand(DID_REMOVE_THREAD, thr);
|
||||
if(thr->IsAlive())
|
||||
{
|
||||
@ -69,7 +69,7 @@ void PPCThreadManager::RemoveThread(const u32 id)
|
||||
}
|
||||
|
||||
|
||||
m_threads.RemoveFAt(i);
|
||||
m_threads.erase(m_threads.begin() + i);
|
||||
i--;
|
||||
}
|
||||
|
||||
@ -81,10 +81,10 @@ s32 PPCThreadManager::GetThreadNumById(PPCThreadType type, u32 id)
|
||||
{
|
||||
s32 num = 0;
|
||||
|
||||
for(u32 i=0; i<m_threads.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_threads.size(); ++i)
|
||||
{
|
||||
if(m_threads[i].GetId() == id) return num;
|
||||
if(m_threads[i].GetType() == type) num++;
|
||||
if(m_threads[i]->GetId() == id) return num;
|
||||
if(m_threads[i]->GetType() == type) num++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
@ -92,9 +92,9 @@ s32 PPCThreadManager::GetThreadNumById(PPCThreadType type, u32 id)
|
||||
|
||||
PPCThread* PPCThreadManager::GetThread(u32 id)
|
||||
{
|
||||
for(u32 i=0; i<m_threads.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_threads.size(); ++i)
|
||||
{
|
||||
if(m_threads[i].GetId() == id) return &m_threads[i];
|
||||
if(m_threads[i]->GetId() == id) return m_threads[i];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@ -102,9 +102,9 @@ PPCThread* PPCThreadManager::GetThread(u32 id)
|
||||
|
||||
void PPCThreadManager::Exec()
|
||||
{
|
||||
for(u32 i=0; i<m_threads.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_threads.size(); ++i)
|
||||
{
|
||||
m_threads[i].Exec();
|
||||
m_threads[i]->Exec();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -13,10 +13,9 @@ class PPCThreadManager
|
||||
//IdManager m_threads_id;
|
||||
//ArrayF<PPUThread> m_ppu_threads;
|
||||
//ArrayF<SPUThread> m_spu_threads;
|
||||
ArrayF<PPCThread> m_threads;
|
||||
std::vector<PPCThread *> m_threads;
|
||||
std::mutex m_mtx_thread;
|
||||
wxSemaphore m_sem_task;
|
||||
Stack<u32> m_delete_threads;
|
||||
u32 m_raw_spu_num;
|
||||
|
||||
public:
|
||||
@ -28,7 +27,7 @@ public:
|
||||
PPCThread& AddThread(PPCThreadType type);
|
||||
void RemoveThread(const u32 id);
|
||||
|
||||
ArrayF<PPCThread>& GetThreads() { return m_threads; }
|
||||
std::vector<PPCThread *>& GetThreads() { return m_threads; }
|
||||
s32 GetThreadNumById(PPCThreadType type, u32 id);
|
||||
PPCThread* GetThread(u32 id);
|
||||
//IdManager& GetIDs() {return m_threads_id;}
|
||||
|
@ -9,11 +9,11 @@ class PPUDecoder : public PPCDecoder
|
||||
PPUOpcodes* m_op;
|
||||
|
||||
public:
|
||||
PPUDecoder(PPUOpcodes& op) : m_op(&op)
|
||||
PPUDecoder(PPUOpcodes* op) : m_op(op)
|
||||
{
|
||||
}
|
||||
|
||||
~PPUDecoder()
|
||||
virtual ~PPUDecoder()
|
||||
{
|
||||
delete m_op;
|
||||
}
|
||||
|
@ -203,7 +203,9 @@ namespace PPU_instr
|
||||
|
||||
static CodeField<9, 10> STRM;
|
||||
|
||||
static auto main_list = new_list(OPCD, instr_bind(&PPUOpcodes::UNK, GetCode, OPCD, OPCD));
|
||||
//static auto main_list = new_list(OPCD, instr_bind(&PPUOpcodes::UNK, GetCode, OPCD, OPCD));
|
||||
static InstrList<1 << CodeField<0, 5>::size, ::PPUOpcodes> main_list_obj(OPCD, instr_bind(&PPUOpcodes::UNK, GetCode, OPCD, OPCD));
|
||||
static auto main_list = &main_list_obj;
|
||||
static auto g04_list = new_list(main_list, PPU_opcodes::G_04, GD_04);
|
||||
static auto g04_0_list = new_list(g04_list, GD_04_0, instr_bind(&PPUOpcodes::UNK, GetCode, OPCD, GD_04_0));
|
||||
static auto g13_list = new_list(main_list, PPU_opcodes::G_13, GD_13, instr_bind(&PPUOpcodes::UNK, GetCode, OPCD, GD_13));
|
||||
|
@ -2099,7 +2099,7 @@ private:
|
||||
if (Ini.HLELogging.GetValue())
|
||||
{
|
||||
ConLog.Write("'%s' done with code[0x%llx]! #pc: 0x%llx",
|
||||
g_static_funcs_list[CPU.GPR[11]].name, CPU.GPR[3], CPU.PC);
|
||||
g_static_funcs_list[CPU.GPR[11]]->name, CPU.GPR[3], CPU.PC);
|
||||
}
|
||||
break;
|
||||
case 0x22: UNK("HyperCall LV1"); break;
|
||||
|
@ -1455,9 +1455,9 @@ void CompilePPUProgram::Compile()
|
||||
u32 code;
|
||||
|
||||
{
|
||||
Array<u32> args;
|
||||
args.SetCount(m_args.size());
|
||||
for(uint i=0; i<args.GetCount(); ++i)
|
||||
std::vector<u32> args;
|
||||
args.resize(m_args.size());
|
||||
for(uint i=0; i<args.size(); ++i)
|
||||
{
|
||||
args[i] = m_args[i].value;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ void PPUThread::AddArgv(const std::string& arg)
|
||||
{
|
||||
m_stack_point -= arg.length() + 1;
|
||||
m_stack_point = Memory.AlignAddr(m_stack_point, 0x10) - 0x10;
|
||||
m_argv_addr.AddCpy(m_stack_point);
|
||||
m_argv_addr.push_back(m_stack_point);
|
||||
Memory.WriteString(m_stack_point, arg);
|
||||
}
|
||||
|
||||
@ -98,9 +98,9 @@ void PPUThread::InitRegs()
|
||||
GPR[i] = (i+1) * 0x10000;
|
||||
}
|
||||
*/
|
||||
if(m_argv_addr.GetCount())
|
||||
if(m_argv_addr.size())
|
||||
{
|
||||
u64 argc = m_argv_addr.GetCount();
|
||||
u64 argc = m_argv_addr.size();
|
||||
m_stack_point -= 0xc + 4 * argc;
|
||||
u64 argv = m_stack_point;
|
||||
|
||||
@ -150,7 +150,8 @@ void PPUThread::DoRun()
|
||||
|
||||
case 1:
|
||||
case 2:
|
||||
m_dec = new PPUDecoder(*new PPUInterpreter(*this));
|
||||
auto ppui = new PPUInterpreter(*this);
|
||||
m_dec = new PPUDecoder(ppui);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -204,4 +205,4 @@ int FPRdouble::Cmp(PPCdouble a, PPCdouble b)
|
||||
if(a == b) return CR_EQ;
|
||||
|
||||
return CR_SO;
|
||||
}
|
||||
}
|
||||
|
@ -648,14 +648,14 @@ public:
|
||||
{
|
||||
switch(n)
|
||||
{
|
||||
case 0: value ? CR.cr0 |= bit : CR.cr0 &= ~bit; break;
|
||||
case 1: value ? CR.cr1 |= bit : CR.cr1 &= ~bit; break;
|
||||
case 2: value ? CR.cr2 |= bit : CR.cr2 &= ~bit; break;
|
||||
case 3: value ? CR.cr3 |= bit : CR.cr3 &= ~bit; break;
|
||||
case 4: value ? CR.cr4 |= bit : CR.cr4 &= ~bit; break;
|
||||
case 5: value ? CR.cr5 |= bit : CR.cr5 &= ~bit; break;
|
||||
case 6: value ? CR.cr6 |= bit : CR.cr6 &= ~bit; break;
|
||||
case 7: value ? CR.cr7 |= bit : CR.cr7 &= ~bit; break;
|
||||
case 0: CR.cr0 = (value ? CR.cr0 | bit : CR.cr0 & ~bit); break;
|
||||
case 1: CR.cr1 = (value ? CR.cr1 | bit : CR.cr1 & ~bit); break;
|
||||
case 2: CR.cr2 = (value ? CR.cr2 | bit : CR.cr2 & ~bit); break;
|
||||
case 3: CR.cr3 = (value ? CR.cr3 | bit : CR.cr3 & ~bit); break;
|
||||
case 4: CR.cr4 = (value ? CR.cr4 | bit : CR.cr4 & ~bit); break;
|
||||
case 5: CR.cr5 = (value ? CR.cr5 | bit : CR.cr5 & ~bit); break;
|
||||
case 6: CR.cr6 = (value ? CR.cr6 | bit : CR.cr6 & ~bit); break;
|
||||
case 7: CR.cr7 = (value ? CR.cr7 | bit : CR.cr7 & ~bit); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,11 +253,11 @@ void RawSPUThread::Task()
|
||||
{
|
||||
if (Ini.HLELogging.GetValue()) ConLog.Write("%s enter", PPCThread::GetFName().c_str());
|
||||
|
||||
const Array<u64>& bp = Emu.GetBreakPoints();
|
||||
const std::vector<u64>& bp = Emu.GetBreakPoints();
|
||||
|
||||
try
|
||||
{
|
||||
for(uint i=0; i<bp.GetCount(); ++i)
|
||||
for(uint i=0; i<bp.size(); ++i)
|
||||
{
|
||||
if(bp[i] == m_offset + PC)
|
||||
{
|
||||
@ -315,7 +315,7 @@ void RawSPUThread::Task()
|
||||
continue;
|
||||
}
|
||||
|
||||
for(uint i=0; i<bp.GetCount(); ++i)
|
||||
for(uint i=0; i<bp.size(); ++i)
|
||||
{
|
||||
if(bp[i] == PC)
|
||||
{
|
||||
|
@ -39,7 +39,9 @@ namespace SPU_instr
|
||||
static CodeField<18, 31> L_18_31;
|
||||
static CodeField<11> L_11;
|
||||
|
||||
static auto rrr_list = new_list<SPUOpcodes>(RRR);
|
||||
// static auto rrr_list = new_list<SPUOpcodes>(RRR);
|
||||
static InstrList<1 << CodeField<0, 3>::size, SPUOpcodes> rrr_list_obj(RRR, nullptr);
|
||||
static auto rrr_list = &rrr_list_obj;
|
||||
static auto ri18_list = new_list(rrr_list, RI18);
|
||||
static auto ri10_list = new_list(ri18_list, RI10);
|
||||
static auto ri16_list = new_list(ri10_list, RI16);
|
||||
|
@ -553,7 +553,7 @@ public:
|
||||
{
|
||||
// SPU Thread Group MMIO (LS and SNR)
|
||||
u32 num = (ea & SYS_SPU_THREAD_BASE_MASK) / SYS_SPU_THREAD_OFFSET; // thread number in group
|
||||
if (num >= group->list.GetCount() || !group->list[num])
|
||||
if (num >= group->list.size() || !group->list[num])
|
||||
{
|
||||
ConLog.Error("DMAC::ProcessCmd(): SPU Thread Group MMIO Access (ea=0x%llx): invalid thread", ea);
|
||||
return false;
|
||||
@ -1288,7 +1288,7 @@ public:
|
||||
reg_value0 = std::stoull(value.substr(16, 31), 0, 16);
|
||||
reg_value1 = std::stoull(value.substr(0, 15), 0, 16);
|
||||
}
|
||||
catch (std::invalid_argument& e)
|
||||
catch (std::invalid_argument& /*e*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -26,6 +26,11 @@ DbgConsole::~DbgConsole()
|
||||
{
|
||||
ThreadBase::Stop();
|
||||
m_dbg_buffer.Flush();
|
||||
|
||||
safe_delete(m_console);
|
||||
safe_delete(m_color_white);
|
||||
safe_delete(m_color_red);
|
||||
safe_delete(m_output);
|
||||
}
|
||||
|
||||
void DbgConsole::Write(int ch, const std::string& text)
|
||||
|
@ -31,7 +31,7 @@ struct _DbgBuffer : public MTPacketBuffer<DbgPacket>
|
||||
{
|
||||
const u32 stext = data.m_text.length();
|
||||
|
||||
m_buffer.Reserve(sizeof(int) + sizeof(u32) + stext);
|
||||
m_buffer.resize(m_buffer.size() + sizeof(int) + sizeof(u32) + stext);
|
||||
|
||||
u32 c_put = m_put;
|
||||
|
||||
@ -88,4 +88,4 @@ public:
|
||||
private:
|
||||
void OnQuit(wxCloseEvent& event);
|
||||
DECLARE_EVENT_TABLE();
|
||||
};
|
||||
};
|
||||
|
@ -14,14 +14,19 @@ int sort_devices(const void* _a, const void* _b)
|
||||
return 0;
|
||||
}
|
||||
|
||||
VFS::~VFS()
|
||||
{
|
||||
UnMountAll();
|
||||
}
|
||||
|
||||
void VFS::Mount(const std::string& ps3_path, const std::string& local_path, vfsDevice* device)
|
||||
{
|
||||
UnMount(ps3_path);
|
||||
|
||||
device->SetPath(ps3_path, local_path);
|
||||
m_devices.Add(device);
|
||||
m_devices.push_back(device);
|
||||
|
||||
if(m_devices.GetCount() > 1)
|
||||
if(m_devices.size() > 1)
|
||||
{
|
||||
//std::qsort(m_devices.GetPtr(), m_devices.GetCount(), sizeof(vfsDevice*), sort_devices);
|
||||
}
|
||||
@ -29,12 +34,12 @@ void VFS::Mount(const std::string& ps3_path, const std::string& local_path, vfsD
|
||||
|
||||
void VFS::UnMount(const std::string& ps3_path)
|
||||
{
|
||||
for(u32 i=0; i<m_devices.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_devices.size(); ++i)
|
||||
{
|
||||
if(!m_devices[i].GetPs3Path().compare(ps3_path))
|
||||
if(!m_devices[i]->GetPs3Path().compare(ps3_path))
|
||||
{
|
||||
delete &m_devices[i];
|
||||
m_devices.RemoveFAt(i);
|
||||
delete m_devices[i];
|
||||
m_devices.erase(m_devices.begin() +i);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -43,11 +48,12 @@ void VFS::UnMount(const std::string& ps3_path)
|
||||
|
||||
void VFS::UnMountAll()
|
||||
{
|
||||
for(u32 i=0; i<m_devices.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_devices.size(); ++i)
|
||||
{
|
||||
delete &m_devices[i];
|
||||
m_devices.RemoveFAt(i);
|
||||
delete m_devices[i];
|
||||
}
|
||||
|
||||
m_devices.clear();
|
||||
}
|
||||
|
||||
vfsFileBase* VFS::OpenFile(const std::string& ps3_path, vfsOpenMode mode) const
|
||||
@ -214,9 +220,9 @@ vfsDevice* VFS::GetDevice(const std::string& ps3_path, std::string& path) const
|
||||
u32 max_eq;
|
||||
s32 max_i=-1;
|
||||
|
||||
for(u32 i=0; i<m_devices.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_devices.size(); ++i)
|
||||
{
|
||||
const u32 eq = m_devices[i].CmpPs3Path(ps3_path);
|
||||
const u32 eq = m_devices[i]->CmpPs3Path(ps3_path);
|
||||
|
||||
if(max_i < 0 || eq > max_eq)
|
||||
{
|
||||
@ -226,8 +232,8 @@ vfsDevice* VFS::GetDevice(const std::string& ps3_path, std::string& path) const
|
||||
}
|
||||
|
||||
if(max_i < 0) return nullptr;
|
||||
path = vfsDevice::GetWinPath(m_devices[max_i].GetLocalPath(), ps3_path.substr(max_eq, ps3_path.length() - max_eq));
|
||||
return &m_devices[max_i];
|
||||
path = vfsDevice::GetWinPath(m_devices[max_i]->GetLocalPath(), ps3_path.substr(max_eq, ps3_path.length() - max_eq));
|
||||
return m_devices[max_i];
|
||||
}
|
||||
|
||||
vfsDevice* VFS::GetDeviceLocal(const std::string& local_path, std::string& path) const
|
||||
@ -239,9 +245,9 @@ vfsDevice* VFS::GetDeviceLocal(const std::string& local_path, std::string& path)
|
||||
file_path.Normalize();
|
||||
std::string mormalized_path = fmt::ToUTF8(file_path.GetFullPath());
|
||||
|
||||
for(u32 i=0; i<m_devices.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_devices.size(); ++i)
|
||||
{
|
||||
const u32 eq = m_devices[i].CmpLocalPath(mormalized_path);
|
||||
const u32 eq = m_devices[i]->CmpLocalPath(mormalized_path);
|
||||
|
||||
if(max_i < 0 || eq > max_eq)
|
||||
{
|
||||
@ -252,8 +258,8 @@ vfsDevice* VFS::GetDeviceLocal(const std::string& local_path, std::string& path)
|
||||
|
||||
if(max_i < 0) return nullptr;
|
||||
|
||||
path = vfsDevice::GetPs3Path(m_devices[max_i].GetPs3Path(), local_path.substr(max_eq, local_path.length() - max_eq));
|
||||
return &m_devices[max_i];
|
||||
path = vfsDevice::GetPs3Path(m_devices[max_i]->GetPs3Path(), local_path.substr(max_eq, local_path.length() - max_eq));
|
||||
return m_devices[max_i];
|
||||
}
|
||||
|
||||
void VFS::Init(const std::string& path)
|
||||
|
@ -41,7 +41,14 @@ struct VFSManagerEntry
|
||||
|
||||
struct VFS
|
||||
{
|
||||
ArrayF<vfsDevice> m_devices;
|
||||
~VFS();
|
||||
|
||||
//TODO: find out where these are supposed to be deleted or just make it shared_ptr
|
||||
//and also make GetDevice and GetDeviceLocal return shared_ptr then.
|
||||
// A vfsDevice will be deleted when they're unmounted or the VFS struct is destroyed.
|
||||
// This will cause problems if other code stores the pointer returned by GetDevice/GetDeviceLocal
|
||||
// and tries to use it after the device is unmounted.
|
||||
std::vector<vfsDevice *> m_devices;
|
||||
void Mount(const std::string& ps3_path, const std::string& local_path, vfsDevice* device);
|
||||
void UnMount(const std::string& ps3_path);
|
||||
void UnMountAll();
|
||||
@ -62,4 +69,4 @@ struct VFS
|
||||
|
||||
void Init(const std::string& path);
|
||||
void SaveLoadDevices(std::vector<VFSManagerEntry>& res, bool is_load);
|
||||
};
|
||||
};
|
||||
|
@ -33,7 +33,7 @@ bool vfsDir::IsExists(const std::string& path) const
|
||||
return m_stream->IsExists(path); // Crash (Access violation reading location 0x0000000000000000)
|
||||
}
|
||||
|
||||
const Array<DirEntryInfo>& vfsDir::GetEntries() const
|
||||
const std::vector<DirEntryInfo>& vfsDir::GetEntries() const
|
||||
{
|
||||
return m_stream->GetEntries();
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public:
|
||||
virtual bool Open(const std::string& path) override;
|
||||
virtual bool IsOpened() const override;
|
||||
virtual bool IsExists(const std::string& path) const override;
|
||||
virtual const Array<DirEntryInfo>& GetEntries() const override;
|
||||
virtual const std::vector<DirEntryInfo>& GetEntries() const override;
|
||||
virtual void Close() override;
|
||||
virtual std::string GetPath() const override;
|
||||
|
||||
@ -22,4 +22,4 @@ public:
|
||||
virtual bool Rename(const std::string& from, const std::string& to) override;
|
||||
virtual bool Remove(const std::string& path) override;
|
||||
virtual const DirEntryInfo* Read() override;
|
||||
};
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ bool vfsDirBase::IsExists(const std::string& path) const
|
||||
return wxDirExists(fmt::FromUTF8(path));
|
||||
}
|
||||
|
||||
const Array<DirEntryInfo>& vfsDirBase::GetEntries() const
|
||||
const std::vector<DirEntryInfo>& vfsDirBase::GetEntries() const
|
||||
{
|
||||
return m_entries;
|
||||
}
|
||||
@ -42,7 +42,7 @@ const Array<DirEntryInfo>& vfsDirBase::GetEntries() const
|
||||
void vfsDirBase::Close()
|
||||
{
|
||||
m_cwd = "";
|
||||
m_entries.Clear();
|
||||
m_entries.clear();
|
||||
}
|
||||
|
||||
std::string vfsDirBase::GetPath() const
|
||||
@ -52,8 +52,8 @@ std::string vfsDirBase::GetPath() const
|
||||
|
||||
const DirEntryInfo* vfsDirBase::Read()
|
||||
{
|
||||
if (m_pos >= m_entries.GetCount())
|
||||
if (m_pos >= m_entries.size())
|
||||
return nullptr;
|
||||
|
||||
return &m_entries[m_pos++];
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ class vfsDirBase
|
||||
{
|
||||
protected:
|
||||
std::string m_cwd;
|
||||
Array<DirEntryInfo> m_entries;
|
||||
std::vector<DirEntryInfo> m_entries;
|
||||
uint m_pos;
|
||||
vfsDevice* m_device;
|
||||
|
||||
@ -42,7 +42,7 @@ public:
|
||||
virtual bool Open(const std::string& path);
|
||||
virtual bool IsOpened() const;
|
||||
virtual bool IsExists(const std::string& path) const;
|
||||
virtual const Array<DirEntryInfo>& GetEntries() const;
|
||||
virtual const std::vector<DirEntryInfo>& GetEntries() const;
|
||||
virtual void Close();
|
||||
virtual std::string GetPath() const;
|
||||
|
||||
@ -51,4 +51,4 @@ public:
|
||||
virtual bool Rename(const std::string& from, const std::string& to) = 0;
|
||||
virtual bool Remove(const std::string& path) = 0;
|
||||
virtual const DirEntryInfo* Read();
|
||||
};
|
||||
};
|
||||
|
@ -24,7 +24,8 @@ bool vfsLocalDir::Open(const std::string& path)
|
||||
{
|
||||
wxString dir_path = fmt::FromUTF8(path) + name;
|
||||
|
||||
DirEntryInfo& info = m_entries[m_entries.Move(new DirEntryInfo())];
|
||||
m_entries.emplace_back();
|
||||
DirEntryInfo& info = m_entries.back();
|
||||
info.name = fmt::ToUTF8(name);
|
||||
|
||||
info.flags |= dir.Exists(dir_path) ? DirEntry_TypeDir : DirEntry_TypeFile;
|
||||
|
@ -20,7 +20,7 @@ void GLBufferObject::Create(GLuint type, u32 count)
|
||||
{
|
||||
if(IsCreated()) return;
|
||||
|
||||
m_id.InsertRoomEnd(count);
|
||||
m_id.resize(count);
|
||||
glGenBuffers(count, &m_id[0]);
|
||||
m_type = type;
|
||||
}
|
||||
@ -29,14 +29,14 @@ void GLBufferObject::Delete()
|
||||
{
|
||||
if(!IsCreated()) return;
|
||||
|
||||
glDeleteBuffers(m_id.GetCount(), &m_id[0]);
|
||||
m_id.Clear();
|
||||
glDeleteBuffers(m_id.size(), &m_id[0]);
|
||||
m_id.clear();
|
||||
m_type = 0;
|
||||
}
|
||||
|
||||
void GLBufferObject::Bind(u32 type, u32 num)
|
||||
{
|
||||
assert(num < m_id.GetCount());
|
||||
assert(num < m_id.size());
|
||||
glBindBuffer(type, m_id[num]);
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ void GLBufferObject::SetAttribPointer(int location, int size, int type, int poin
|
||||
|
||||
bool GLBufferObject::IsCreated() const
|
||||
{
|
||||
return m_id.GetCount() != 0;
|
||||
return m_id.size() != 0;
|
||||
}
|
||||
|
||||
GLvbo::GLvbo()
|
||||
@ -135,20 +135,20 @@ GLrbo::~GLrbo()
|
||||
|
||||
void GLrbo::Create(u32 count)
|
||||
{
|
||||
if(m_id.GetCount() == count)
|
||||
if(m_id.size() == count)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Delete();
|
||||
|
||||
m_id.SetCount(count);
|
||||
glGenRenderbuffers(count, m_id.GetPtr());
|
||||
m_id.resize(count);
|
||||
glGenRenderbuffers(count, m_id.data());
|
||||
}
|
||||
|
||||
void GLrbo::Bind(u32 num) const
|
||||
{
|
||||
assert(num < m_id.GetCount());
|
||||
assert(num < m_id.size());
|
||||
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_id[num]);
|
||||
}
|
||||
@ -170,18 +170,18 @@ void GLrbo::Delete()
|
||||
return;
|
||||
}
|
||||
|
||||
glDeleteRenderbuffers(m_id.GetCount(), m_id.GetPtr());
|
||||
m_id.Clear();
|
||||
glDeleteRenderbuffers(m_id.size(), m_id.data());
|
||||
m_id.clear();
|
||||
}
|
||||
|
||||
bool GLrbo::IsCreated() const
|
||||
{
|
||||
return m_id.GetCount();
|
||||
return m_id.size();
|
||||
}
|
||||
|
||||
u32 GLrbo::GetId(u32 num) const
|
||||
{
|
||||
assert(num < m_id.GetCount());
|
||||
assert(num < m_id.size());
|
||||
return m_id[num];
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
struct GLBufferObject
|
||||
{
|
||||
protected:
|
||||
Array<GLuint> m_id;
|
||||
std::vector<GLuint> m_id;
|
||||
GLuint m_type;
|
||||
|
||||
public:
|
||||
@ -51,7 +51,7 @@ public:
|
||||
class GLrbo
|
||||
{
|
||||
protected:
|
||||
Array<GLuint> m_id;
|
||||
std::vector<GLuint> m_id;
|
||||
|
||||
public:
|
||||
GLrbo();
|
||||
@ -88,4 +88,4 @@ public:
|
||||
static void Unbind(u32 type);
|
||||
void Delete();
|
||||
bool IsCreated() const;
|
||||
};
|
||||
};
|
||||
|
@ -229,20 +229,11 @@ std::string GLFragmentDecompilerThread::BuildCode()
|
||||
|
||||
std::string p;
|
||||
|
||||
for(u32 i=0; i<m_parr.params.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_parr.params.size(); ++i)
|
||||
{
|
||||
p += m_parr.params[i].Format();
|
||||
}
|
||||
|
||||
//return "#version 330\n\
|
||||
\n\
|
||||
out vec3 color;\n\
|
||||
in vec4 tc1;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
color = tc1.rgb;\n\
|
||||
}";
|
||||
return std::string("#version 330\n"
|
||||
"\n"
|
||||
+ p + "\n"
|
||||
@ -348,12 +339,12 @@ void GLFragmentDecompilerThread::Task()
|
||||
|
||||
m_shader = BuildCode();
|
||||
main.clear();
|
||||
m_parr.params.Clear();
|
||||
m_parr.params.clear();
|
||||
}
|
||||
|
||||
GLShaderProgram::GLShaderProgram()
|
||||
: m_decompiler_thread(nullptr)
|
||||
, id(0)
|
||||
, m_id(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -374,11 +365,22 @@ GLShaderProgram::~GLShaderProgram()
|
||||
Delete();
|
||||
}
|
||||
|
||||
void GLShaderProgram::Wait()
|
||||
{
|
||||
if(m_decompiler_thread && m_decompiler_thread->IsAlive())
|
||||
{
|
||||
m_decompiler_thread->Join();
|
||||
}
|
||||
}
|
||||
|
||||
void GLShaderProgram::Decompile(RSXShaderProgram& prog)
|
||||
{
|
||||
#if 0
|
||||
FragmentDecompilerThread(shader, parr, addr).Entry();
|
||||
#else
|
||||
GLFragmentDecompilerThread decompiler(m_shader, m_parr, prog.addr, prog.size, prog.ctrl);
|
||||
decompiler.Task();
|
||||
}
|
||||
|
||||
void GLShaderProgram::DecompileAsync(RSXShaderProgram& prog)
|
||||
{
|
||||
if(m_decompiler_thread)
|
||||
{
|
||||
Wait();
|
||||
@ -391,59 +393,59 @@ void GLShaderProgram::Decompile(RSXShaderProgram& prog)
|
||||
m_decompiler_thread = nullptr;
|
||||
}
|
||||
|
||||
m_decompiler_thread = new GLFragmentDecompilerThread(shader, parr, prog.addr, prog.size, prog.ctrl);
|
||||
m_decompiler_thread = new GLFragmentDecompilerThread(m_shader, m_parr, prog.addr, prog.size, prog.ctrl);
|
||||
m_decompiler_thread->Start();
|
||||
#endif
|
||||
}
|
||||
|
||||
void GLShaderProgram::Compile()
|
||||
{
|
||||
if(id) glDeleteShader(id);
|
||||
if (m_id) glDeleteShader(m_id);
|
||||
|
||||
id = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
m_id = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
|
||||
const char* str = shader.c_str();
|
||||
const int strlen = shader.length();
|
||||
const char* str = m_shader.c_str();
|
||||
const int strlen = m_shader.length();
|
||||
|
||||
glShaderSource(id, 1, &str, &strlen);
|
||||
glCompileShader(id);
|
||||
glShaderSource(m_id, 1, &str, &strlen);
|
||||
glCompileShader(m_id);
|
||||
|
||||
GLint r = GL_FALSE;
|
||||
glGetShaderiv(id, GL_COMPILE_STATUS, &r);
|
||||
if(r != GL_TRUE)
|
||||
GLint compileStatus = GL_FALSE;
|
||||
glGetShaderiv(m_id, GL_COMPILE_STATUS, &compileStatus); // Determine the result of the glCompileShader call
|
||||
if (compileStatus != GL_TRUE) // If the shader failed to compile...
|
||||
{
|
||||
glGetShaderiv(id, GL_INFO_LOG_LENGTH, &r);
|
||||
GLint infoLength;
|
||||
glGetShaderiv(m_id, GL_INFO_LOG_LENGTH, &infoLength); // Retrieve the length in bytes (including trailing NULL) of the shader info log
|
||||
|
||||
if(r)
|
||||
if (infoLength > 0)
|
||||
{
|
||||
char* buf = new char[r+1];
|
||||
GLsizei len;
|
||||
memset(buf, 0, r+1);
|
||||
glGetShaderInfoLog(id, r, &len, buf);
|
||||
ConLog.Error("Failed to compile shader: %s", buf);
|
||||
char* buf = new char[infoLength]; // Buffer to store infoLog
|
||||
|
||||
glGetShaderInfoLog(m_id, infoLength, &len, buf); // Retrieve the shader info log into our buffer
|
||||
ConLog.Error("Failed to compile shader: %s", buf); // Write log to the console
|
||||
|
||||
delete[] buf;
|
||||
}
|
||||
|
||||
ConLog.Write(shader.c_str());
|
||||
Emu.Pause();
|
||||
ConLog.Write(m_shader.c_str()); // Log the text of the shader that failed to compile
|
||||
Emu.Pause(); // Pause the emulator, we can't really continue from here
|
||||
}
|
||||
//else ConLog.Write("Shader compiled successfully!");
|
||||
}
|
||||
|
||||
void GLShaderProgram::Delete()
|
||||
{
|
||||
for(u32 i=0; i<parr.params.GetCount(); ++i)
|
||||
for (u32 i = 0; i<m_parr.params.size(); ++i)
|
||||
{
|
||||
parr.params[i].items.Clear();
|
||||
parr.params[i].type.clear();
|
||||
m_parr.params[i].items.clear();
|
||||
m_parr.params[i].type.clear();
|
||||
}
|
||||
|
||||
parr.params.Clear();
|
||||
shader.clear();
|
||||
m_parr.params.clear();
|
||||
m_shader.clear();
|
||||
|
||||
if(id)
|
||||
if (m_id)
|
||||
{
|
||||
glDeleteShader(id);
|
||||
id = 0;
|
||||
glDeleteShader(m_id);
|
||||
m_id = 0;
|
||||
}
|
||||
}
|
||||
|
@ -138,28 +138,65 @@ struct GLFragmentDecompilerThread : public ThreadBase
|
||||
u32 GetData(const u32 d) const { return d << 16 | d >> 16; }
|
||||
};
|
||||
|
||||
struct GLShaderProgram
|
||||
/** Storage for an Fragment Program in the process of of recompilation.
|
||||
* This class calls OpenGL functions and should only be used from the RSX/Graphics thread.
|
||||
*/
|
||||
class GLShaderProgram
|
||||
{
|
||||
public:
|
||||
GLShaderProgram();
|
||||
~GLShaderProgram();
|
||||
|
||||
GLFragmentDecompilerThread* m_decompiler_thread;
|
||||
|
||||
GLParamArray parr;
|
||||
|
||||
std::string shader;
|
||||
|
||||
u32 id;
|
||||
|
||||
void Wait()
|
||||
{
|
||||
if(m_decompiler_thread && m_decompiler_thread->IsAlive())
|
||||
{
|
||||
m_decompiler_thread->Join();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Decompile a fragment shader located in the PS3's Memory. This function operates synchronously.
|
||||
* @param prog RSXShaderProgram specifying the location and size of the shader in memory
|
||||
*/
|
||||
void Decompile(RSXShaderProgram& prog);
|
||||
|
||||
/**
|
||||
* Asynchronously decompile a fragment shader located in the PS3's Memory.
|
||||
* When this function is called you must call Wait before GetShaderText() will return valid data.
|
||||
* @param prog RSXShaderProgram specifying the location and size of the shader in memory
|
||||
*/
|
||||
void DecompileAsync(RSXShaderProgram& prog);
|
||||
|
||||
/** Wait for the decompiler task to complete decompilation. */
|
||||
void Wait();
|
||||
|
||||
/** Compile the decompiled fragment shader into a format we can use with OpenGL. */
|
||||
void Compile();
|
||||
|
||||
/** Get the source text for this shader */
|
||||
inline const std::string& GetShaderText() const { return m_shader; }
|
||||
|
||||
/**
|
||||
* Set the source text for this shader
|
||||
* @param shaderText supplied shader text
|
||||
*/
|
||||
inline void SetShaderText(const std::string& shaderText) { m_shader = shaderText; }
|
||||
|
||||
/** Get the OpenGL id this shader is bound to */
|
||||
inline u32 GetId() const { return m_id; }
|
||||
|
||||
/**
|
||||
* Set the OpenGL id this shader is bound to
|
||||
* @param id supplied id
|
||||
*/
|
||||
inline void SetId(const u32 id) { m_id = id; }
|
||||
|
||||
private:
|
||||
/** Threaded fragment shader decompiler responsible for decompiling this program */
|
||||
GLFragmentDecompilerThread* m_decompiler_thread;
|
||||
|
||||
/** Shader parameter storage */
|
||||
GLParamArray m_parr;
|
||||
|
||||
/** Text of our decompiler shader */
|
||||
std::string m_shader;
|
||||
|
||||
/** OpenGL id this shader is bound to */
|
||||
u32 m_id;
|
||||
|
||||
/** Deletes the shader and any stored information */
|
||||
void Delete();
|
||||
};
|
||||
};
|
||||
|
@ -136,11 +136,11 @@ void GLGSRender::EnableVertexData(bool indexed_draw)
|
||||
if(!m_vertex_data[i].IsEnabled() || !m_vertex_data[i].addr) continue;
|
||||
|
||||
const size_t item_size = m_vertex_data[i].GetTypeSize() * m_vertex_data[i].size;
|
||||
const size_t data_size = m_vertex_data[i].data.GetCount() - data_offset * item_size;
|
||||
const u32 pos = m_vdata.GetCount();
|
||||
const size_t data_size = m_vertex_data[i].data.size() - data_offset * item_size;
|
||||
const u32 pos = m_vdata.size();
|
||||
|
||||
cur_offset += data_size;
|
||||
m_vdata.InsertRoomEnd(data_size);
|
||||
m_vdata.resize(m_vdata.size() + data_size);
|
||||
memcpy(&m_vdata[pos], &m_vertex_data[i].data[data_offset * item_size], data_size);
|
||||
}
|
||||
|
||||
@ -150,12 +150,12 @@ void GLGSRender::EnableVertexData(bool indexed_draw)
|
||||
|
||||
m_vbo.Create(indexed_draw ? 2 : 1);
|
||||
m_vbo.Bind(0);
|
||||
m_vbo.SetData(&m_vdata[0], m_vdata.GetCount());
|
||||
m_vbo.SetData(&m_vdata[0], m_vdata.size());
|
||||
|
||||
if(indexed_draw)
|
||||
{
|
||||
m_vbo.Bind(GL_ELEMENT_ARRAY_BUFFER, 1);
|
||||
m_vbo.SetData(GL_ELEMENT_ARRAY_BUFFER, &m_indexed_array.m_data[0], m_indexed_array.m_data.GetCount());
|
||||
m_vbo.SetData(GL_ELEMENT_ARRAY_BUFFER, &m_indexed_array.m_data[0], m_indexed_array.m_data.size());
|
||||
}
|
||||
|
||||
checkForGlError("initializing vbo");
|
||||
@ -173,7 +173,7 @@ void GLGSRender::EnableVertexData(bool indexed_draw)
|
||||
switch(m_vertex_data[i].type)
|
||||
{
|
||||
case 1:
|
||||
for(u32 j = 0; j<m_vertex_data[i].data.GetCount(); j+=2)
|
||||
for(u32 j = 0; j<m_vertex_data[i].data.size(); j+=2)
|
||||
{
|
||||
dump.Write(wxString::Format("%d\n", *(u16*)&m_vertex_data[i].data[j]));
|
||||
if(!(((j+2) / 2) % m_vertex_data[i].size)) dump.Write("\n");
|
||||
@ -181,7 +181,7 @@ void GLGSRender::EnableVertexData(bool indexed_draw)
|
||||
break;
|
||||
|
||||
case 2:
|
||||
for(u32 j = 0; j<m_vertex_data[i].data.GetCount(); j+=4)
|
||||
for(u32 j = 0; j<m_vertex_data[i].data.size(); j+=4)
|
||||
{
|
||||
dump.Write(wxString::Format("%.01f\n", *(float*)&m_vertex_data[i].data[j]));
|
||||
if(!(((j+4) / 4) % m_vertex_data[i].size)) dump.Write("\n");
|
||||
@ -189,7 +189,7 @@ void GLGSRender::EnableVertexData(bool indexed_draw)
|
||||
break;
|
||||
|
||||
case 3:
|
||||
for(u32 j = 0; j<m_vertex_data[i].data.GetCount(); j+=2)
|
||||
for(u32 j = 0; j<m_vertex_data[i].data.size(); j+=2)
|
||||
{
|
||||
dump.Write(wxString::Format("%.01f\n", *(float*)&m_vertex_data[i].data[j]));
|
||||
if(!(((j+2) / 2) % m_vertex_data[i].size)) dump.Write("\n");
|
||||
@ -197,7 +197,7 @@ void GLGSRender::EnableVertexData(bool indexed_draw)
|
||||
break;
|
||||
|
||||
case 4:
|
||||
for(u32 j = 0; j<m_vertex_data[i].data.GetCount(); ++j)
|
||||
for(u32 j = 0; j<m_vertex_data[i].data.size(); ++j)
|
||||
{
|
||||
dump.Write(wxString::Format("%d\n", m_vertex_data[i].data[j]));
|
||||
if(!((j+1) % m_vertex_data[i].size)) dump.Write("\n");
|
||||
@ -205,7 +205,7 @@ void GLGSRender::EnableVertexData(bool indexed_draw)
|
||||
break;
|
||||
|
||||
case 5:
|
||||
for(u32 j = 0; j<m_vertex_data[i].data.GetCount(); j+=2)
|
||||
for(u32 j = 0; j<m_vertex_data[i].data.size(); j+=2)
|
||||
{
|
||||
dump.Write(wxString::Format("%d\n", *(u16*)&m_vertex_data[i].data[j]));
|
||||
if(!(((j+2) / 2) % m_vertex_data[i].size)) dump.Write("\n");
|
||||
@ -213,7 +213,7 @@ void GLGSRender::EnableVertexData(bool indexed_draw)
|
||||
break;
|
||||
|
||||
case 7:
|
||||
for(u32 j = 0; j<m_vertex_data[i].data.GetCount(); ++j)
|
||||
for(u32 j = 0; j<m_vertex_data[i].data.size(); ++j)
|
||||
{
|
||||
dump.Write(wxString::Format("%d\n", m_vertex_data[i].data[j]));
|
||||
if(!((j+1) % m_vertex_data[i].size)) dump.Write("\n");
|
||||
@ -299,7 +299,7 @@ void GLGSRender::EnableVertexData(bool indexed_draw)
|
||||
|
||||
void GLGSRender::DisableVertexData()
|
||||
{
|
||||
m_vdata.Clear();
|
||||
m_vdata.clear();
|
||||
for(u32 i=0; i<m_vertex_count; ++i)
|
||||
{
|
||||
if(!m_vertex_data[i].IsEnabled() || !m_vertex_data[i].addr) continue;
|
||||
@ -317,7 +317,7 @@ void GLGSRender::InitVertexData()
|
||||
0.0f, 0.0f, 0.0f, 1.0f};
|
||||
int l;
|
||||
|
||||
for(u32 i=0; i<m_transform_constants.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_transform_constants.size(); ++i)
|
||||
{
|
||||
const RSXTransformConstant& c = m_transform_constants[i];
|
||||
const std::string name = fmt::Format("vc%u", c.id);
|
||||
@ -354,7 +354,7 @@ void GLGSRender::InitFragmentData()
|
||||
return;
|
||||
}
|
||||
|
||||
for(u32 i=0; i<m_fragment_constants.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_fragment_constants.size(); ++i)
|
||||
{
|
||||
const RSXTransformConstant& c = m_fragment_constants[i];
|
||||
|
||||
@ -397,12 +397,11 @@ bool GLGSRender::LoadProgram()
|
||||
{
|
||||
ConLog.Warning("FP not found in buffer!");
|
||||
m_shader_prog.Decompile(*m_cur_shader_prog);
|
||||
m_shader_prog.Wait();
|
||||
m_shader_prog.Compile();
|
||||
checkForGlError("m_shader_prog.Compile");
|
||||
|
||||
wxFile f(wxGetCwd() + "/FragmentProgram.txt", wxFile::write);
|
||||
f.Write(m_shader_prog.shader);
|
||||
f.Write(m_shader_prog.GetShaderText());
|
||||
}
|
||||
|
||||
if(m_vp_buf_num == -1)
|
||||
@ -433,7 +432,7 @@ bool GLGSRender::LoadProgram()
|
||||
{
|
||||
// TODO: This isn't working perfectly. Is there any better/shorter way to update the program
|
||||
m_vertex_prog.shader = program.vp_shader;
|
||||
m_shader_prog.shader = program.fp_shader;
|
||||
m_shader_prog.SetShaderText(program.fp_shader);
|
||||
m_vertex_prog.Wait();
|
||||
m_vertex_prog.Compile();
|
||||
checkForGlError("m_vertex_prog.Compile");
|
||||
@ -441,13 +440,13 @@ bool GLGSRender::LoadProgram()
|
||||
m_shader_prog.Compile();
|
||||
checkForGlError("m_shader_prog.Compile");
|
||||
glAttachShader(m_program.id, m_vertex_prog.id);
|
||||
glAttachShader(m_program.id, m_shader_prog.id);
|
||||
glAttachShader(m_program.id, m_shader_prog.GetId());
|
||||
glLinkProgram(m_program.id);
|
||||
checkForGlError("glLinkProgram");
|
||||
glDetachShader(m_program.id, m_vertex_prog.id);
|
||||
glDetachShader(m_program.id, m_shader_prog.id);
|
||||
glDetachShader(m_program.id, m_shader_prog.GetId());
|
||||
program.vp_id = m_vertex_prog.id;
|
||||
program.fp_id = m_shader_prog.id;
|
||||
program.fp_id = m_shader_prog.GetId();
|
||||
program.modified = false;
|
||||
}
|
||||
}
|
||||
@ -456,7 +455,7 @@ bool GLGSRender::LoadProgram()
|
||||
}
|
||||
else
|
||||
{
|
||||
m_program.Create(m_vertex_prog.id, m_shader_prog.id);
|
||||
m_program.Create(m_vertex_prog.id, m_shader_prog.GetId());
|
||||
checkForGlError("m_program.Create");
|
||||
m_prog_buffer.Add(m_program, m_shader_prog, *m_cur_shader_prog, m_vertex_prog, *m_cur_vertex_prog);
|
||||
checkForGlError("m_prog_buffer.Add");
|
||||
@ -468,9 +467,9 @@ bool GLGSRender::LoadProgram()
|
||||
RSXDebuggerProgram program;
|
||||
program.id = m_program.id;
|
||||
program.vp_id = m_vertex_prog.id;
|
||||
program.fp_id = m_shader_prog.id;
|
||||
program.fp_id = m_shader_prog.GetId();
|
||||
program.vp_shader = m_vertex_prog.shader;
|
||||
program.fp_shader = m_shader_prog.shader;
|
||||
program.fp_shader = m_shader_prog.GetShaderText();
|
||||
m_debug_programs.push_back(program);
|
||||
}
|
||||
}
|
||||
@ -1134,12 +1133,12 @@ void GLGSRender::Flip()
|
||||
else if(m_fbo.IsCreated())
|
||||
{
|
||||
format = GL_RGBA;
|
||||
static Array<u8> pixels;
|
||||
pixels.SetCount(RSXThread::m_width * RSXThread::m_height * 4);
|
||||
static std::vector<u8> pixels;
|
||||
pixels.resize(RSXThread::m_width * RSXThread::m_height * 4);
|
||||
m_fbo.Bind(GL_READ_FRAMEBUFFER);
|
||||
glReadPixels(0, 0, RSXThread::m_width, RSXThread::m_height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, pixels.GetPtr());
|
||||
glReadPixels(0, 0, RSXThread::m_width, RSXThread::m_height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, pixels.data());
|
||||
|
||||
src_buffer = pixels.GetPtr();
|
||||
src_buffer = pixels.data();
|
||||
width = RSXThread::m_width;
|
||||
height = RSXThread::m_height;
|
||||
}
|
||||
@ -1199,7 +1198,7 @@ void GLGSRender::Flip()
|
||||
if(m_fbo.IsCreated())
|
||||
m_fbo.Bind();
|
||||
|
||||
for(uint i=0; i<m_post_draw_objs.GetCount(); ++i)
|
||||
for(uint i=0; i<m_post_draw_objs.size(); ++i)
|
||||
{
|
||||
m_post_draw_objs[i].Draw();
|
||||
}
|
||||
|
@ -78,7 +78,6 @@ public:
|
||||
int format = tex.GetFormat() & ~(0x20 | 0x40);
|
||||
bool is_swizzled = !(tex.GetFormat() & CELL_GCM_TEXTURE_LN);
|
||||
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, tex.m_pitch);
|
||||
char* pixels = (char*)Memory.GetMemFromAddr(GetAddress(tex.GetOffset(), tex.GetLocation()));
|
||||
char* unswizzledPixels;
|
||||
|
||||
@ -255,7 +254,9 @@ public:
|
||||
{
|
||||
if(!m_id || !tex.GetOffset() || !tex.GetWidth() || !tex.GetHeight()) return;
|
||||
|
||||
u32* alldata = new u32[tex.GetWidth() * tex.GetHeight()];
|
||||
const u32 texPixelCount = tex.GetWidth() * tex.GetHeight();
|
||||
|
||||
u32* alldata = new u32[texPixelCount];
|
||||
|
||||
Bind();
|
||||
|
||||
@ -276,15 +277,15 @@ public:
|
||||
|
||||
{
|
||||
wxFile f(name + ".raw", wxFile::write);
|
||||
f.Write(alldata, tex.GetWidth() * tex.GetHeight() * 4);
|
||||
f.Write(alldata, texPixelCount * 4);
|
||||
}
|
||||
u8* data = new u8[tex.GetWidth() * tex.GetHeight() * 3];
|
||||
u8* alpha = new u8[tex.GetWidth() * tex.GetHeight()];
|
||||
u8* data = new u8[texPixelCount * 3];
|
||||
u8* alpha = new u8[texPixelCount];
|
||||
|
||||
u8* src = (u8*)alldata;
|
||||
u8* dst_d = data;
|
||||
u8* dst_a = alpha;
|
||||
for(u32 i=0; i<tex.GetWidth()*tex.GetHeight();i++)
|
||||
for (u32 i = 0; i < texPixelCount; i++)
|
||||
{
|
||||
*dst_d++ = *src++;
|
||||
*dst_d++ = *src++;
|
||||
@ -384,7 +385,7 @@ public:
|
||||
InitializeShaders();
|
||||
m_fp.Compile();
|
||||
m_vp.Compile();
|
||||
m_program.Create(m_vp.id, m_fp.id);
|
||||
m_program.Create(m_vp.id, m_fp.GetId());
|
||||
m_program.Use();
|
||||
InitializeLocations();
|
||||
}
|
||||
@ -499,7 +500,7 @@ public:
|
||||
" gl_Position = in_pos;\n"
|
||||
"}\n";
|
||||
|
||||
m_fp.shader =
|
||||
m_fp.SetShaderText(
|
||||
"#version 330\n"
|
||||
"\n"
|
||||
"in vec2 tc;\n"
|
||||
@ -509,7 +510,7 @@ public:
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" res = texture(tex0, tc);\n"
|
||||
"}\n";
|
||||
"}\n");
|
||||
}
|
||||
|
||||
void SetTexture(void* pixels, int width, int height)
|
||||
@ -540,8 +541,8 @@ class GLGSRender
|
||||
, public GSRender
|
||||
{
|
||||
private:
|
||||
Array<u8> m_vdata;
|
||||
ArrayF<PostDrawObj> m_post_draw_objs;
|
||||
std::vector<u8> m_vdata;
|
||||
std::vector<PostDrawObj> m_post_draw_objs;
|
||||
|
||||
GLProgram m_program;
|
||||
int m_fp_buf_num;
|
||||
|
@ -8,7 +8,7 @@ GLProgram::GLProgram() : id(0)
|
||||
|
||||
int GLProgram::GetLocation(const std::string& name)
|
||||
{
|
||||
for(u32 i=0; i<m_locations.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_locations.size(); ++i)
|
||||
{
|
||||
if(!m_locations[i].name.compare(name))
|
||||
{
|
||||
@ -16,7 +16,8 @@ int GLProgram::GetLocation(const std::string& name)
|
||||
}
|
||||
}
|
||||
|
||||
u32 pos = m_locations.Move(new Location());
|
||||
m_locations.emplace_back();
|
||||
u32 pos = m_locations.size()-1;
|
||||
m_locations[pos].name = name;
|
||||
|
||||
m_locations[pos].loc = glGetUniformLocation(id, name.c_str());
|
||||
@ -84,7 +85,7 @@ void GLProgram::Create(const u32 vp, const u32 fp)
|
||||
void GLProgram::UnUse()
|
||||
{
|
||||
id = 0;
|
||||
m_locations.Clear();
|
||||
m_locations.clear();
|
||||
}
|
||||
|
||||
void GLProgram::Use()
|
||||
@ -105,5 +106,5 @@ void GLProgram::Delete()
|
||||
if(!IsCreated()) return;
|
||||
glDeleteProgram(id);
|
||||
id = 0;
|
||||
m_locations.Clear();
|
||||
m_locations.clear();
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ private:
|
||||
std::string name;
|
||||
};
|
||||
|
||||
Array<Location> m_locations;
|
||||
std::vector<Location> m_locations;
|
||||
|
||||
public:
|
||||
u32 id;
|
||||
@ -25,4 +25,4 @@ public:
|
||||
void UnUse();
|
||||
void SetTex(u32 index);
|
||||
void Delete();
|
||||
};
|
||||
};
|
||||
|
@ -3,12 +3,12 @@
|
||||
|
||||
int GLProgramBuffer::SearchFp(const RSXShaderProgram& rsx_fp, GLShaderProgram& gl_fp)
|
||||
{
|
||||
for(u32 i=0; i<m_buf.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_buf.size(); ++i)
|
||||
{
|
||||
if(memcmp(&m_buf[i].fp_data[0], &Memory[rsx_fp.addr], m_buf[i].fp_data.GetCount()) != 0) continue;
|
||||
if(memcmp(&m_buf[i].fp_data[0], &Memory[rsx_fp.addr], m_buf[i].fp_data.size()) != 0) continue;
|
||||
|
||||
gl_fp.id = m_buf[i].fp_id;
|
||||
gl_fp.shader = m_buf[i].fp_shader;
|
||||
gl_fp.SetId(m_buf[i].fp_id);
|
||||
gl_fp.SetShaderText(m_buf[i].fp_shader);
|
||||
|
||||
return i;
|
||||
}
|
||||
@ -18,10 +18,10 @@ int GLProgramBuffer::SearchFp(const RSXShaderProgram& rsx_fp, GLShaderProgram& g
|
||||
|
||||
int GLProgramBuffer::SearchVp(const RSXVertexProgram& rsx_vp, GLVertexProgram& gl_vp)
|
||||
{
|
||||
for(u32 i=0; i<m_buf.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_buf.size(); ++i)
|
||||
{
|
||||
if(m_buf[i].vp_data.GetCount() != rsx_vp.data.GetCount()) continue;
|
||||
if(memcmp(m_buf[i].vp_data.GetPtr(), rsx_vp.data.GetPtr(), rsx_vp.data.GetCount() * 4) != 0) continue;
|
||||
if(m_buf[i].vp_data.size() != rsx_vp.data.size()) continue;
|
||||
if(memcmp(m_buf[i].vp_data.data(), rsx_vp.data.data(), rsx_vp.data.size() * 4) != 0) continue;
|
||||
|
||||
gl_vp.id = m_buf[i].vp_id;
|
||||
gl_vp.shader = m_buf[i].vp_shader.c_str();
|
||||
@ -34,14 +34,14 @@ int GLProgramBuffer::SearchVp(const RSXVertexProgram& rsx_vp, GLVertexProgram& g
|
||||
|
||||
bool GLProgramBuffer::CmpVP(const u32 a, const u32 b) const
|
||||
{
|
||||
if(m_buf[a].vp_data.GetCount() != m_buf[b].vp_data.GetCount()) return false;
|
||||
return memcmp(m_buf[a].vp_data.GetPtr(), m_buf[b].vp_data.GetPtr(), m_buf[a].vp_data.GetCount() * 4) == 0;
|
||||
if(m_buf[a].vp_data.size() != m_buf[b].vp_data.size()) return false;
|
||||
return memcmp(m_buf[a].vp_data.data(), m_buf[b].vp_data.data(), m_buf[a].vp_data.size() * 4) == 0;
|
||||
}
|
||||
|
||||
bool GLProgramBuffer::CmpFP(const u32 a, const u32 b) const
|
||||
{
|
||||
if(m_buf[a].fp_data.GetCount() != m_buf[b].fp_data.GetCount()) return false;
|
||||
return memcmp(m_buf[a].fp_data.GetPtr(), m_buf[b].fp_data.GetPtr(), m_buf[a].fp_data.GetCount()) == 0;
|
||||
if(m_buf[a].fp_data.size() != m_buf[b].fp_data.size()) return false;
|
||||
return memcmp(m_buf[a].fp_data.data(), m_buf[b].fp_data.data(), m_buf[a].fp_data.size()) == 0;
|
||||
}
|
||||
|
||||
u32 GLProgramBuffer::GetProg(u32 fp, u32 vp) const
|
||||
@ -60,7 +60,7 @@ u32 GLProgramBuffer::GetProg(u32 fp, u32 vp) const
|
||||
return m_buf[fp].prog_id;
|
||||
}
|
||||
|
||||
for(u32 i=0; i<m_buf.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_buf.size(); ++i)
|
||||
{
|
||||
if(i == fp || i == vp) continue;
|
||||
|
||||
@ -84,46 +84,46 @@ u32 GLProgramBuffer::GetProg(u32 fp, u32 vp) const
|
||||
|
||||
void GLProgramBuffer::Add(GLProgram& prog, GLShaderProgram& gl_fp, RSXShaderProgram& rsx_fp, GLVertexProgram& gl_vp, RSXVertexProgram& rsx_vp)
|
||||
{
|
||||
GLBufferInfo& new_buf = *new GLBufferInfo();
|
||||
GLBufferInfo new_buf;
|
||||
|
||||
ConLog.Write("Add program (%d):", m_buf.GetCount());
|
||||
ConLog.Write("Add program (%d):", m_buf.size());
|
||||
ConLog.Write("*** prog id = %d", prog.id);
|
||||
ConLog.Write("*** vp id = %d", gl_vp.id);
|
||||
ConLog.Write("*** fp id = %d", gl_fp.id);
|
||||
ConLog.Write("*** vp data size = %d", rsx_vp.data.GetCount() * 4);
|
||||
ConLog.Write("*** fp id = %d", gl_fp.GetId());
|
||||
ConLog.Write("*** vp data size = %d", rsx_vp.data.size() * 4);
|
||||
ConLog.Write("*** fp data size = %d", rsx_fp.size);
|
||||
|
||||
ConLog.Write("*** vp shader = \n%s", gl_vp.shader.c_str());
|
||||
ConLog.Write("*** fp shader = \n%s", gl_fp.shader.c_str());
|
||||
ConLog.Write("*** fp shader = \n%s", gl_fp.GetShaderText().c_str());
|
||||
|
||||
|
||||
new_buf.prog_id = prog.id;
|
||||
new_buf.vp_id = gl_vp.id;
|
||||
new_buf.fp_id = gl_fp.id;
|
||||
new_buf.fp_id = gl_fp.GetId();
|
||||
|
||||
new_buf.fp_data.AddCpy(&Memory[rsx_fp.addr], rsx_fp.size);
|
||||
new_buf.vp_data.CopyFrom(rsx_vp.data);
|
||||
new_buf.fp_data.insert(new_buf.fp_data.end(),&Memory[rsx_fp.addr], &Memory[rsx_fp.addr] + rsx_fp.size);
|
||||
new_buf.vp_data = rsx_vp.data;
|
||||
|
||||
new_buf.vp_shader = gl_vp.shader;
|
||||
new_buf.fp_shader = gl_fp.shader;
|
||||
new_buf.fp_shader = gl_fp.GetShaderText();
|
||||
|
||||
m_buf.Move(&new_buf);
|
||||
m_buf.push_back(new_buf);
|
||||
}
|
||||
|
||||
void GLProgramBuffer::Clear()
|
||||
{
|
||||
for(u32 i=0; i<m_buf.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_buf.size(); ++i)
|
||||
{
|
||||
glDeleteProgram(m_buf[i].prog_id);
|
||||
glDeleteShader(m_buf[i].fp_id);
|
||||
glDeleteShader(m_buf[i].vp_id);
|
||||
|
||||
m_buf[i].fp_data.Clear();
|
||||
m_buf[i].vp_data.Clear();
|
||||
m_buf[i].fp_data.clear();
|
||||
m_buf[i].vp_data.clear();
|
||||
|
||||
m_buf[i].vp_shader.clear();
|
||||
m_buf[i].fp_shader.clear();
|
||||
}
|
||||
|
||||
m_buf.Clear();
|
||||
m_buf.clear();
|
||||
}
|
||||
|
@ -6,15 +6,15 @@ struct GLBufferInfo
|
||||
u32 prog_id;
|
||||
u32 fp_id;
|
||||
u32 vp_id;
|
||||
Array<u8> fp_data;
|
||||
Array<u32> vp_data;
|
||||
std::vector<u8> fp_data;
|
||||
std::vector<u32> vp_data;
|
||||
std::string fp_shader;
|
||||
std::string vp_shader;
|
||||
};
|
||||
|
||||
struct GLProgramBuffer
|
||||
{
|
||||
Array<GLBufferInfo> m_buf;
|
||||
std::vector<GLBufferInfo> m_buf;
|
||||
|
||||
int SearchFp(const RSXShaderProgram& rsx_fp, GLShaderProgram& gl_fp);
|
||||
int SearchVp(const RSXVertexProgram& rsx_vp, GLVertexProgram& gl_vp);
|
||||
@ -26,4 +26,4 @@ struct GLProgramBuffer
|
||||
|
||||
void Add(GLProgram& prog, GLShaderProgram& gl_fp, RSXShaderProgram& rsx_fp, GLVertexProgram& gl_vp, RSXVertexProgram& rsx_vp);
|
||||
void Clear();
|
||||
};
|
||||
};
|
||||
|
@ -31,7 +31,7 @@ struct GLParamType
|
||||
{
|
||||
const GLParamFlag flag;
|
||||
std::string type;
|
||||
Array<GLParamItem> items;
|
||||
std::vector<GLParamItem> items;
|
||||
|
||||
GLParamType(const GLParamFlag _flag, const std::string& _type)
|
||||
: flag(_flag)
|
||||
@ -41,7 +41,7 @@ struct GLParamType
|
||||
|
||||
bool SearchName(const std::string& name)
|
||||
{
|
||||
for(u32 i=0; i<items.GetCount(); ++i)
|
||||
for(u32 i=0; i<items.size(); ++i)
|
||||
{
|
||||
if(items[i].name.compare(name) == 0) return true;
|
||||
}
|
||||
@ -53,7 +53,7 @@ struct GLParamType
|
||||
{
|
||||
std::string ret = "";
|
||||
|
||||
for(u32 n=0; n<items.GetCount(); ++n)
|
||||
for(u32 n=0; n<items.size(); ++n)
|
||||
{
|
||||
ret += items[n].location + type + " " + items[n].name;
|
||||
if(!items[n].value.empty())
|
||||
@ -69,11 +69,11 @@ struct GLParamType
|
||||
|
||||
struct GLParamArray
|
||||
{
|
||||
Array<GLParamType> params;
|
||||
std::vector<GLParamType> params;
|
||||
|
||||
GLParamType* SearchParam(const std::string& type)
|
||||
{
|
||||
for(u32 i=0; i<params.GetCount(); ++i)
|
||||
for(u32 i=0; i<params.size(); ++i)
|
||||
{
|
||||
if (params[i].type.compare(type) == 0)
|
||||
return ¶ms[i];
|
||||
@ -109,13 +109,13 @@ struct GLParamArray
|
||||
|
||||
if(t)
|
||||
{
|
||||
if(!t->SearchName(name)) t->items.Move(new GLParamItem(name, -1, value));
|
||||
if(!t->SearchName(name)) t->items.emplace_back(name, -1, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
const u32 num = params.GetCount();
|
||||
params.Move(new GLParamType(flag, type));
|
||||
params[num].items.Move(new GLParamItem(name, -1, value));
|
||||
const u32 num = params.size();
|
||||
params.emplace_back(flag, type);
|
||||
params[num].items.emplace_back(name, -1, value);
|
||||
}
|
||||
|
||||
return name;
|
||||
@ -128,15 +128,15 @@ struct GLParamArray
|
||||
|
||||
if(t)
|
||||
{
|
||||
if(!t->SearchName(name)) t->items.Move(new GLParamItem(name, location));
|
||||
if(!t->SearchName(name)) t->items.emplace_back(name, location);
|
||||
}
|
||||
else
|
||||
{
|
||||
const u32 num = params.GetCount();
|
||||
params.Move(new GLParamType(flag, type));
|
||||
params[num].items.Move(new GLParamItem(name, location));
|
||||
const u32 num = params.size();
|
||||
params.emplace_back(flag, type);
|
||||
params[num].items.emplace_back(name, location);
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -248,15 +248,16 @@ std::string GLVertexDecompilerThread::GetFunc()
|
||||
u32 offset = (d2.iaddrh << 3) | d3.iaddrl;
|
||||
std::string name = fmt::Format("func%u", offset);
|
||||
|
||||
for(uint i=0; i<m_funcs.GetCount(); ++i)
|
||||
for(uint i=0; i<m_funcs.size(); ++i)
|
||||
{
|
||||
if(m_funcs[i].name.compare(name) == 0)
|
||||
return name + "()";
|
||||
}
|
||||
|
||||
uint idx = m_funcs.Add(new FuncInfo());
|
||||
m_funcs[idx].offset = offset;
|
||||
m_funcs[idx].name = name;
|
||||
m_funcs.emplace_back();
|
||||
FuncInfo &idx = m_funcs.back();
|
||||
idx.offset = offset;
|
||||
idx.name = name;
|
||||
|
||||
return name + "()";
|
||||
}
|
||||
@ -280,7 +281,7 @@ std::string GLVertexDecompilerThread::BuildFuncBody(const FuncInfo& func)
|
||||
if(i != func.offset)
|
||||
{
|
||||
uint call_func = -1;
|
||||
for(uint j=0; j<m_funcs.GetCount(); ++j)
|
||||
for(uint j=0; j<m_funcs.size(); ++j)
|
||||
{
|
||||
if(m_funcs[j].offset == i)
|
||||
{
|
||||
@ -306,14 +307,14 @@ std::string GLVertexDecompilerThread::BuildCode()
|
||||
{
|
||||
std::string p;
|
||||
|
||||
for(u32 i=0; i<m_parr.params.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_parr.params.size(); ++i)
|
||||
{
|
||||
p += m_parr.params[i].Format();
|
||||
}
|
||||
|
||||
std::string fp;
|
||||
|
||||
for(int i=m_funcs.GetCount() - 1; i>0; --i)
|
||||
for(int i=m_funcs.size() - 1; i>0; --i)
|
||||
{
|
||||
fp += fmt::Format("void %s();\n", m_funcs[i].name.c_str());
|
||||
}
|
||||
@ -323,7 +324,7 @@ std::string GLVertexDecompilerThread::BuildCode()
|
||||
f += fmt::Format("void %s()\n{\n\tgl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);\n\t%s();\n\tgl_Position = gl_Position * scaleOffsetMat;\n}\n",
|
||||
m_funcs[0].name.c_str(), m_funcs[1].name.c_str());
|
||||
|
||||
for(uint i=1; i<m_funcs.GetCount(); ++i)
|
||||
for(uint i=1; i<m_funcs.size(); ++i)
|
||||
{
|
||||
f += fmt::Format("\nvoid %s()\n{\n%s}\n", m_funcs[i].name.c_str(), BuildFuncBody(m_funcs[i]).c_str());
|
||||
}
|
||||
@ -341,7 +342,7 @@ std::string GLVertexDecompilerThread::BuildCode()
|
||||
|
||||
void GLVertexDecompilerThread::Task()
|
||||
{
|
||||
m_parr.params.Clear();
|
||||
m_parr.params.clear();
|
||||
|
||||
for(u32 i=0, intsCount=0;;intsCount++)
|
||||
{
|
||||
@ -426,7 +427,7 @@ void GLVertexDecompilerThread::Task()
|
||||
|
||||
if(d3.end)
|
||||
{
|
||||
if(i < m_data.GetCount())
|
||||
if(i < m_data.size())
|
||||
ConLog.Error("Program end before buffer end.");
|
||||
|
||||
break;
|
||||
@ -436,7 +437,10 @@ void GLVertexDecompilerThread::Task()
|
||||
m_shader = BuildCode();
|
||||
|
||||
m_body.clear();
|
||||
m_funcs.RemoveAt(2, m_funcs.GetCount() - 2);
|
||||
if (m_funcs.size() > 2)
|
||||
{
|
||||
m_funcs.erase(m_funcs.begin()+2, m_funcs.end());
|
||||
}
|
||||
}
|
||||
|
||||
GLVertexProgram::GLVertexProgram()
|
||||
@ -521,7 +525,7 @@ void GLVertexProgram::Compile()
|
||||
|
||||
void GLVertexProgram::Delete()
|
||||
{
|
||||
parr.params.Clear();
|
||||
parr.params.clear();
|
||||
shader.clear();
|
||||
|
||||
if(id)
|
||||
|
@ -135,23 +135,23 @@ struct GLVertexDecompilerThread : public ThreadBase
|
||||
|
||||
std::vector<std::string> m_body;
|
||||
|
||||
ArrayF<FuncInfo> m_funcs;
|
||||
std::vector<FuncInfo> m_funcs;
|
||||
|
||||
//wxString main;
|
||||
std::string& m_shader;
|
||||
Array<u32>& m_data;
|
||||
std::vector<u32>& m_data;
|
||||
GLParamArray& m_parr;
|
||||
|
||||
GLVertexDecompilerThread(Array<u32>& data, std::string& shader, GLParamArray& parr)
|
||||
GLVertexDecompilerThread(std::vector<u32>& data, std::string& shader, GLParamArray& parr)
|
||||
: ThreadBase("Vertex Shader Decompiler Thread")
|
||||
, m_data(data)
|
||||
, m_shader(shader)
|
||||
, m_parr(parr)
|
||||
{
|
||||
m_funcs.Add(new FuncInfo());
|
||||
m_funcs.emplace_back();
|
||||
m_funcs[0].offset = 0;
|
||||
m_funcs[0].name = "main";
|
||||
m_funcs.Add(new FuncInfo());
|
||||
m_funcs.emplace_back();
|
||||
m_funcs[1].offset = 0;
|
||||
m_funcs[1].name = "func0";
|
||||
//m_cur_func->body = "\tgl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);\n";
|
||||
|
@ -36,7 +36,7 @@ void RSXVertexData::Reset()
|
||||
size = 0;
|
||||
type = 0;
|
||||
addr = 0;
|
||||
data.ClearF();
|
||||
data.clear();
|
||||
}
|
||||
|
||||
void RSXVertexData::Load(u32 start, u32 count)
|
||||
@ -45,7 +45,7 @@ void RSXVertexData::Load(u32 start, u32 count)
|
||||
|
||||
const u32 tsize = GetTypeSize();
|
||||
|
||||
data.SetCount((start + count) * tsize * size);
|
||||
data.resize((start + count) * tsize * size);
|
||||
|
||||
for(u32 i=start; i<start + count; ++i)
|
||||
{
|
||||
@ -181,6 +181,8 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
|
||||
|
||||
u32 index = 0;
|
||||
|
||||
m_used_gcm_commands.insert(cmd);
|
||||
|
||||
//static u32 draw_array_count = 0;
|
||||
|
||||
switch(cmd)
|
||||
@ -236,10 +238,10 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
|
||||
m_vertex_data[index].Reset();
|
||||
m_vertex_data[index].size = 4;
|
||||
m_vertex_data[index].type = 4;
|
||||
m_vertex_data[index].data.AddCpy(v0);
|
||||
m_vertex_data[index].data.AddCpy(v1);
|
||||
m_vertex_data[index].data.AddCpy(v2);
|
||||
m_vertex_data[index].data.AddCpy(v3);
|
||||
m_vertex_data[index].data.push_back(v0);
|
||||
m_vertex_data[index].data.push_back(v1);
|
||||
m_vertex_data[index].data.push_back(v2);
|
||||
m_vertex_data[index].data.push_back(v3);
|
||||
//ConLog.Warning("index = %d, v0 = 0x%x, v1 = 0x%x, v2 = 0x%x, v3 = 0x%x", index, v0, v1, v2, v3);
|
||||
}
|
||||
break;
|
||||
@ -255,7 +257,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
|
||||
m_vertex_data[index].Reset();
|
||||
m_vertex_data[index].type = 2;
|
||||
m_vertex_data[index].size = 2;
|
||||
m_vertex_data[index].data.SetCount(sizeof(float) * 2);
|
||||
m_vertex_data[index].data.resize(sizeof(float) * 2);
|
||||
(float&)m_vertex_data[index].data[sizeof(float)*0] = v0;
|
||||
(float&)m_vertex_data[index].data[sizeof(float)*1] = v1;
|
||||
|
||||
@ -278,7 +280,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
|
||||
m_vertex_data[index].Reset();
|
||||
m_vertex_data[index].type = 2;
|
||||
m_vertex_data[index].size = 4;
|
||||
m_vertex_data[index].data.SetCount(sizeof(float) * 4);
|
||||
m_vertex_data[index].data.resize(sizeof(float) * 4);
|
||||
(float&)m_vertex_data[index].data[sizeof(float)*0] = v0;
|
||||
(float&)m_vertex_data[index].data[sizeof(float)*1] = v1;
|
||||
(float&)m_vertex_data[index].data[sizeof(float)*2] = v2;
|
||||
@ -299,7 +301,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
|
||||
u32 a0 = ARGS(0);
|
||||
u32 pitch = a0 & 0xFFFFF;
|
||||
u16 depth = a0 >> 20;
|
||||
tex.SetControl3(pitch, depth);
|
||||
tex.SetControl3(depth, pitch);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -325,6 +327,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
|
||||
case_16(NV4097_SET_TEXTURE_BORDER_COLOR,0x20):
|
||||
{
|
||||
}
|
||||
break;
|
||||
|
||||
case NV4097_SET_SURFACE_FORMAT:
|
||||
{
|
||||
@ -528,7 +531,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
|
||||
const u32 addr = GetAddress(ARGS(0) & 0x7fffffff, ARGS(0) >> 31);
|
||||
CMD_LOG("num=%d, addr=0x%x", index, addr);
|
||||
m_vertex_data[index].addr = addr;
|
||||
m_vertex_data[index].data.ClearF();
|
||||
m_vertex_data[index].data.clear();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -592,8 +595,8 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
int pos = m_indexed_array.m_data.GetCount();
|
||||
m_indexed_array.m_data.InsertRoomEnd(4);
|
||||
int pos = m_indexed_array.m_data.size();
|
||||
m_indexed_array.m_data.resize(m_indexed_array.m_data.size() + 4);
|
||||
index = Memory.Read32(m_indexed_array.m_addr + i * 4);
|
||||
*(u32*)&m_indexed_array.m_data[pos] = index;
|
||||
//ConLog.Warning("index 4: %d", *(u32*)&m_indexed_array.m_data[pos]);
|
||||
@ -602,8 +605,8 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
|
||||
|
||||
case 1:
|
||||
{
|
||||
int pos = m_indexed_array.m_data.GetCount();
|
||||
m_indexed_array.m_data.InsertRoomEnd(2);
|
||||
int pos = m_indexed_array.m_data.size();
|
||||
m_indexed_array.m_data.resize(m_indexed_array.m_data.size() + 2);
|
||||
index = Memory.Read16(m_indexed_array.m_addr + i * 2);
|
||||
//ConLog.Warning("index 2: %d", index);
|
||||
*(u16*)&m_indexed_array.m_data[pos] = index;
|
||||
@ -684,7 +687,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
|
||||
//ConLog.Warning("NV4097_SET_TRANSFORM_PROGRAM_LOAD: prog = %d", ARGS(0));
|
||||
|
||||
m_cur_vertex_prog = &m_vertex_progs[ARGS(0)];
|
||||
m_cur_vertex_prog->data.Clear();
|
||||
m_cur_vertex_prog->data.clear();
|
||||
|
||||
if(count == 2)
|
||||
{
|
||||
@ -705,7 +708,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
|
||||
break;
|
||||
}
|
||||
|
||||
for(u32 i=0; i<count; ++i) m_cur_vertex_prog->data.AddCpy(ARGS(i));
|
||||
for(u32 i=0; i<count; ++i) m_cur_vertex_prog->data.push_back(ARGS(i));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -745,7 +748,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
|
||||
RSXTransformConstant c(id, (float&)x, (float&)y, (float&)z, (float&)w);
|
||||
|
||||
CMD_LOG("SET_TRANSFORM_CONSTANT_LOAD[%d : %d] = (%f, %f, %f, %f)", i, id, c.x, c.y, c.z, c.w);
|
||||
m_transform_constants.AddCpy(c);
|
||||
m_transform_constants.push_back(c);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1252,7 +1255,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
|
||||
}
|
||||
|
||||
//ConLog.Warning("NV308A_COLOR: [%d]: %f, %f, %f, %f", c.id, c.x, c.y, c.z, c.w);
|
||||
m_fragment_constants.AddCpy(c);
|
||||
m_fragment_constants.push_back(c);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1489,7 +1492,7 @@ void RSXThread::Begin(u32 draw_mode)
|
||||
m_draw_array_count = 0;
|
||||
m_draw_array_first = ~0;
|
||||
|
||||
if(Emu.GetCallbackManager().m_exit_callback.m_callbacks.GetCount())
|
||||
if(Emu.GetCallbackManager().m_exit_callback.m_callbacks.size())
|
||||
{
|
||||
//Emu.GetCallbackManager().m_exit_callback.Handle(0x0121, 0);
|
||||
}
|
||||
@ -1499,14 +1502,14 @@ void RSXThread::End()
|
||||
{
|
||||
ExecCMD();
|
||||
|
||||
if(Emu.GetCallbackManager().m_exit_callback.m_callbacks.GetCount())
|
||||
if(Emu.GetCallbackManager().m_exit_callback.m_callbacks.size())
|
||||
{
|
||||
//Emu.GetCallbackManager().m_exit_callback.Handle(0x0122, 0);
|
||||
}
|
||||
|
||||
m_indexed_array.Reset();
|
||||
m_fragment_constants.Clear();
|
||||
m_transform_constants.Clear();
|
||||
m_fragment_constants.clear();
|
||||
m_transform_constants.clear();
|
||||
m_cur_shader_prog_num = 0;
|
||||
//m_cur_shader_prog = nullptr;
|
||||
|
||||
@ -1562,7 +1565,7 @@ void RSXThread::Task()
|
||||
}
|
||||
if(cmd & CELL_GCM_METHOD_FLAG_CALL)
|
||||
{
|
||||
m_call_stack.Push(get + 4);
|
||||
m_call_stack.push(get + 4);
|
||||
u32 offs = cmd & ~CELL_GCM_METHOD_FLAG_CALL;
|
||||
u32 addr = Memory.RSXIOMem.GetStartAddr() + offs;
|
||||
//ConLog.Warning("rsx call(0x%x) #0x%x - 0x%x - 0x%x", offs, addr, cmd, get);
|
||||
@ -1572,7 +1575,8 @@ void RSXThread::Task()
|
||||
if(cmd == CELL_GCM_METHOD_FLAG_RETURN)
|
||||
{
|
||||
//ConLog.Warning("rsx return!");
|
||||
u32 get = m_call_stack.Pop();
|
||||
u32 get = m_call_stack.top();
|
||||
m_call_stack.pop();
|
||||
//ConLog.Warning("rsx return(0x%x)", get);
|
||||
m_ctrl->get = get;
|
||||
continue;
|
||||
|
@ -5,6 +5,9 @@
|
||||
#include "RSXFragmentProgram.h"
|
||||
#include "Emu/SysCalls/Callback.h"
|
||||
|
||||
#include <stack>
|
||||
#include <set> // For tracking a list of used gcm commands
|
||||
|
||||
enum Method
|
||||
{
|
||||
CELL_GCM_METHOD_FLAG_NON_INCREMENT = 0x40000000,
|
||||
@ -25,7 +28,7 @@ struct RSXVertexData
|
||||
u32 addr;
|
||||
u32 constant_count;
|
||||
|
||||
Array<u8> data;
|
||||
std::vector<u8> data;
|
||||
|
||||
RSXVertexData();
|
||||
|
||||
@ -38,7 +41,7 @@ struct RSXVertexData
|
||||
|
||||
struct RSXIndexArrayData
|
||||
{
|
||||
Array<u8> m_data;
|
||||
std::vector<u8> m_data;
|
||||
int m_type;
|
||||
u32 m_first;
|
||||
u32 m_count;
|
||||
@ -59,7 +62,7 @@ struct RSXIndexArrayData
|
||||
m_addr = 0;
|
||||
index_min = ~0;
|
||||
index_max = 0;
|
||||
m_data.Clear();
|
||||
m_data.clear();
|
||||
}
|
||||
};
|
||||
|
||||
@ -95,7 +98,7 @@ public:
|
||||
static const uint m_tiles_count = 15;
|
||||
|
||||
protected:
|
||||
Stack<u32> m_call_stack;
|
||||
std::stack<u32> m_call_stack;
|
||||
CellGcmControl* m_ctrl;
|
||||
|
||||
public:
|
||||
@ -103,8 +106,8 @@ public:
|
||||
RSXTexture m_textures[m_textures_count];
|
||||
RSXVertexData m_vertex_data[m_vertex_count];
|
||||
RSXIndexArrayData m_indexed_array;
|
||||
Array<RSXTransformConstant> m_fragment_constants;
|
||||
Array<RSXTransformConstant> m_transform_constants;
|
||||
std::vector<RSXTransformConstant> m_fragment_constants;
|
||||
std::vector<RSXTransformConstant> m_transform_constants;
|
||||
|
||||
u32 m_cur_shader_prog_num;
|
||||
RSXShaderProgram m_shader_progs[m_fragment_count];
|
||||
@ -382,6 +385,8 @@ public:
|
||||
u8 m_begin_end;
|
||||
bool m_read_buffer;
|
||||
|
||||
std::set<u32> m_used_gcm_commands;
|
||||
|
||||
protected:
|
||||
RSXThread()
|
||||
: ThreadBase("RSXThread")
|
||||
@ -536,6 +541,8 @@ public:
|
||||
m_cur_shader_prog = nullptr;
|
||||
m_cur_shader_prog_num = 0;
|
||||
|
||||
m_used_gcm_commands.clear();
|
||||
|
||||
OnInit();
|
||||
ThreadBase::Start();
|
||||
}
|
||||
|
@ -2,5 +2,5 @@
|
||||
|
||||
struct RSXVertexProgram
|
||||
{
|
||||
Array<u32> data;
|
||||
};
|
||||
std::vector<u32> data;
|
||||
};
|
||||
|
@ -202,9 +202,9 @@ protected:
|
||||
std::vector<Pad> m_pads;
|
||||
|
||||
public:
|
||||
virtual ~PadHandlerBase() = default;
|
||||
virtual void Init(const u32 max_connect)=0;
|
||||
virtual void Close()=0;
|
||||
virtual ~PadHandlerBase() = default;
|
||||
|
||||
void Key(const u32 code, bool pressed)
|
||||
{
|
||||
|
@ -2,8 +2,8 @@
|
||||
//DynamicMemoryBlockBase
|
||||
template<typename PT>
|
||||
DynamicMemoryBlockBase<PT>::DynamicMemoryBlockBase()
|
||||
: PT()
|
||||
, m_max_size(0)
|
||||
: PT()
|
||||
, m_max_size(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ const u32 DynamicMemoryBlockBase<PT>::GetUsedSize() const
|
||||
|
||||
u32 size = 0;
|
||||
|
||||
for(u32 i=0; i<m_allocated.GetCount(); ++i)
|
||||
for (u32 i = 0; i<m_allocated.size(); ++i)
|
||||
{
|
||||
size += m_allocated[i].size;
|
||||
}
|
||||
@ -53,10 +53,10 @@ MemoryBlock* DynamicMemoryBlockBase<PT>::SetRange(const u64 start, const u32 siz
|
||||
MemoryBlock::SetRange(start, 0);
|
||||
|
||||
const u32 page_count = m_max_size >> 12;
|
||||
m_pages.SetCount(page_count);
|
||||
m_locked.SetCount(page_count);
|
||||
memset(m_pages.GetPtr(), 0, sizeof(u8*) * page_count);
|
||||
memset(m_locked.GetPtr(), 0, sizeof(u8*) * page_count);
|
||||
m_pages.resize(page_count);
|
||||
m_locked.resize(page_count);
|
||||
memset(m_pages.data(), 0, sizeof(u8*) * page_count);
|
||||
memset(m_locked.data(), 0, sizeof(u8*) * page_count);
|
||||
|
||||
return this;
|
||||
}
|
||||
@ -66,11 +66,11 @@ void DynamicMemoryBlockBase<PT>::Delete()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_lock);
|
||||
|
||||
m_allocated.Clear();
|
||||
m_allocated.clear();
|
||||
m_max_size = 0;
|
||||
|
||||
m_pages.Clear();
|
||||
m_locked.Clear();
|
||||
m_pages.clear();
|
||||
m_locked.clear();
|
||||
|
||||
MemoryBlock::Delete();
|
||||
}
|
||||
@ -82,22 +82,22 @@ bool DynamicMemoryBlockBase<PT>::AllocFixed(u64 addr, u32 size)
|
||||
|
||||
addr &= ~4095; // align start address
|
||||
|
||||
if(!IsInMyRange(addr, size))
|
||||
if (!IsInMyRange(addr, size))
|
||||
{
|
||||
assert(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(IsMyAddress(addr) || IsMyAddress(addr + size - 1))
|
||||
if (IsMyAddress(addr) || IsMyAddress(addr + size - 1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_lock);
|
||||
|
||||
for(u32 i=0; i<m_allocated.GetCount(); ++i)
|
||||
for (u32 i = 0; i<m_allocated.size(); ++i)
|
||||
{
|
||||
if(addr >= m_allocated[i].addr && addr < m_allocated[i].addr + m_allocated[i].size) return false;
|
||||
if (addr >= m_allocated[i].addr && addr < m_allocated[i].addr + m_allocated[i].size) return false;
|
||||
}
|
||||
|
||||
AppendMem(addr, size);
|
||||
@ -108,7 +108,9 @@ bool DynamicMemoryBlockBase<PT>::AllocFixed(u64 addr, u32 size)
|
||||
template<typename PT>
|
||||
void DynamicMemoryBlockBase<PT>::AppendMem(u64 addr, u32 size) /* private */
|
||||
{
|
||||
u8* pointer = (u8*)m_allocated[m_allocated.Move(new MemBlockInfo(addr, size))].mem;
|
||||
//u8* pointer = (u8*)m_allocated[m_allocated.Move(new MemBlockInfo(addr, size))].mem;
|
||||
m_allocated.emplace_back(addr, size);
|
||||
u8* pointer = (u8*) m_allocated.back().mem;
|
||||
|
||||
const u32 first = MemoryBlock::FixAddr(addr) >> 12;
|
||||
|
||||
@ -141,13 +143,13 @@ u64 DynamicMemoryBlockBase<PT>::AllocAlign(u32 size, u32 align)
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_lock);
|
||||
|
||||
for(u64 addr = MemoryBlock::GetStartAddr(); addr <= MemoryBlock::GetEndAddr() - exsize;)
|
||||
for (u64 addr = MemoryBlock::GetStartAddr(); addr <= MemoryBlock::GetEndAddr() - exsize;)
|
||||
{
|
||||
bool is_good_addr = true;
|
||||
|
||||
for(u32 i=0; i<m_allocated.GetCount(); ++i)
|
||||
for (u32 i = 0; i<m_allocated.size(); ++i)
|
||||
{
|
||||
if((addr >= m_allocated[i].addr && addr < m_allocated[i].addr + m_allocated[i].size) ||
|
||||
if ((addr >= m_allocated[i].addr && addr < m_allocated[i].addr + m_allocated[i].size) ||
|
||||
(m_allocated[i].addr >= addr && m_allocated[i].addr < addr + exsize))
|
||||
{
|
||||
is_good_addr = false;
|
||||
@ -156,7 +158,7 @@ u64 DynamicMemoryBlockBase<PT>::AllocAlign(u32 size, u32 align)
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_good_addr) continue;
|
||||
if (!is_good_addr) continue;
|
||||
|
||||
if (align)
|
||||
{
|
||||
@ -182,7 +184,7 @@ bool DynamicMemoryBlockBase<PT>::Free(u64 addr)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_lock);
|
||||
|
||||
for (u32 num = 0; num < m_allocated.GetCount(); num++)
|
||||
for (u32 num = 0; num < m_allocated.size(); num++)
|
||||
{
|
||||
if (addr == m_allocated[num].addr)
|
||||
{
|
||||
@ -205,13 +207,13 @@ bool DynamicMemoryBlockBase<PT>::Free(u64 addr)
|
||||
m_locked[i] = nullptr;
|
||||
}
|
||||
|
||||
m_allocated.RemoveAt(num);
|
||||
m_allocated.erase(m_allocated.begin() + num);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
ConLog.Error("DynamicMemoryBlock::Free(addr=0x%llx): failed", addr);
|
||||
for (u32 i = 0; i < m_allocated.GetCount(); i++)
|
||||
for (u32 i = 0; i < m_allocated.size(); i++)
|
||||
{
|
||||
ConLog.Write("*** Memory Block: addr = 0x%llx, size = 0x%x", m_allocated[i].addr, m_allocated[i].size);
|
||||
}
|
||||
@ -223,7 +225,7 @@ u8* DynamicMemoryBlockBase<PT>::GetMem(u64 addr) const // lock-free, addr is fix
|
||||
{
|
||||
const u32 index = addr >> 12;
|
||||
|
||||
if (index < m_pages.GetCount())
|
||||
if (index < m_pages.size())
|
||||
{
|
||||
if (u8* res = m_pages[index])
|
||||
{
|
||||
@ -243,7 +245,7 @@ bool DynamicMemoryBlockBase<PT>::IsLocked(u64 addr) // lock-free
|
||||
{
|
||||
const u32 index = MemoryBlock::FixAddr(addr) >> 12;
|
||||
|
||||
if (index < m_locked.GetCount())
|
||||
if (index < m_locked.size())
|
||||
{
|
||||
if (m_locked[index]) return true;
|
||||
}
|
||||
@ -259,13 +261,13 @@ bool DynamicMemoryBlockBase<PT>::Lock(u64 addr, u32 size)
|
||||
|
||||
addr &= ~4095; // align start address
|
||||
|
||||
if(!IsInMyRange(addr, size))
|
||||
if (!IsInMyRange(addr, size))
|
||||
{
|
||||
assert(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(IsMyAddress(addr) || IsMyAddress(addr + size - 1))
|
||||
if (IsMyAddress(addr) || IsMyAddress(addr + size - 1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -291,18 +293,18 @@ bool DynamicMemoryBlockBase<PT>::Lock(u64 addr, u32 size)
|
||||
|
||||
template<typename PT>
|
||||
bool DynamicMemoryBlockBase<PT>::Unlock(u64 addr, u32 size)
|
||||
{
|
||||
{
|
||||
size = PAGE_4K(size); // align size
|
||||
|
||||
addr &= ~4095; // align start address
|
||||
|
||||
if(!IsInMyRange(addr, size))
|
||||
if (!IsInMyRange(addr, size))
|
||||
{
|
||||
assert(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(IsMyAddress(addr) || IsMyAddress(addr + size - 1))
|
||||
if (IsMyAddress(addr) || IsMyAddress(addr + size - 1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ bool VirtualMemoryBlock::IsInMyRange(const u64 addr, const u32 size)
|
||||
|
||||
bool VirtualMemoryBlock::IsMyAddress(const u64 addr)
|
||||
{
|
||||
for(u32 i=0; i<m_mapped_memory.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_mapped_memory.size(); ++i)
|
||||
{
|
||||
if(addr >= m_mapped_memory[i].addr && addr < m_mapped_memory[i].addr + m_mapped_memory[i].size)
|
||||
{
|
||||
@ -577,7 +577,7 @@ u64 VirtualMemoryBlock::Map(u64 realaddr, u32 size, u64 addr)
|
||||
if(!IsInMyRange(addr, size) && (IsMyAddress(addr) || IsMyAddress(addr + size - 1)))
|
||||
return 0;
|
||||
|
||||
m_mapped_memory.Move(new VirtualMemInfo(addr, realaddr, size));
|
||||
m_mapped_memory.emplace_back(addr, realaddr, size);
|
||||
return addr;
|
||||
}
|
||||
else
|
||||
@ -587,7 +587,7 @@ u64 VirtualMemoryBlock::Map(u64 realaddr, u32 size, u64 addr)
|
||||
bool is_good_addr = true;
|
||||
|
||||
// check if address is already mapped
|
||||
for(u32 i=0; i<m_mapped_memory.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_mapped_memory.size(); ++i)
|
||||
{
|
||||
if((addr >= m_mapped_memory[i].addr && addr < m_mapped_memory[i].addr + m_mapped_memory[i].size) ||
|
||||
(m_mapped_memory[i].addr >= addr && m_mapped_memory[i].addr < addr + size))
|
||||
@ -600,7 +600,7 @@ u64 VirtualMemoryBlock::Map(u64 realaddr, u32 size, u64 addr)
|
||||
|
||||
if(!is_good_addr) continue;
|
||||
|
||||
m_mapped_memory.Move(new VirtualMemInfo(addr, realaddr, size));
|
||||
m_mapped_memory.emplace_back(addr, realaddr, size);
|
||||
|
||||
return addr;
|
||||
}
|
||||
@ -611,12 +611,12 @@ u64 VirtualMemoryBlock::Map(u64 realaddr, u32 size, u64 addr)
|
||||
|
||||
u32 VirtualMemoryBlock::UnmapRealAddress(u64 realaddr)
|
||||
{
|
||||
for(u32 i=0; i<m_mapped_memory.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_mapped_memory.size(); ++i)
|
||||
{
|
||||
if(m_mapped_memory[i].realAddress == realaddr && IsInMyRange(m_mapped_memory[i].addr, m_mapped_memory[i].size))
|
||||
{
|
||||
u32 size = m_mapped_memory[i].size;
|
||||
m_mapped_memory.RemoveAt(i);
|
||||
m_mapped_memory.erase(m_mapped_memory.begin() + i);
|
||||
return size;
|
||||
}
|
||||
}
|
||||
@ -626,12 +626,12 @@ u32 VirtualMemoryBlock::UnmapRealAddress(u64 realaddr)
|
||||
|
||||
u32 VirtualMemoryBlock::UnmapAddress(u64 addr)
|
||||
{
|
||||
for(u32 i=0; i<m_mapped_memory.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_mapped_memory.size(); ++i)
|
||||
{
|
||||
if(m_mapped_memory[i].addr == addr && IsInMyRange(m_mapped_memory[i].addr, m_mapped_memory[i].size))
|
||||
{
|
||||
u32 size = m_mapped_memory[i].size;
|
||||
m_mapped_memory.RemoveAt(i);
|
||||
m_mapped_memory.erase(m_mapped_memory.begin() + i);
|
||||
return size;
|
||||
}
|
||||
}
|
||||
@ -711,7 +711,7 @@ bool VirtualMemoryBlock::Write128(const u64 addr, const u128 value)
|
||||
|
||||
u64 VirtualMemoryBlock::getRealAddr(u64 addr)
|
||||
{
|
||||
for(u32 i=0; i<m_mapped_memory.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_mapped_memory.size(); ++i)
|
||||
{
|
||||
if(addr >= m_mapped_memory[i].addr && addr < m_mapped_memory[i].addr + m_mapped_memory[i].size)
|
||||
{
|
||||
@ -724,7 +724,7 @@ u64 VirtualMemoryBlock::getRealAddr(u64 addr)
|
||||
|
||||
u64 VirtualMemoryBlock::getMappedAddress(u64 realAddress)
|
||||
{
|
||||
for(u32 i=0; i<m_mapped_memory.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_mapped_memory.size(); ++i)
|
||||
{
|
||||
if(realAddress >= m_mapped_memory[i].realAddress && realAddress < m_mapped_memory[i].realAddress + m_mapped_memory[i].size)
|
||||
{
|
||||
@ -737,7 +737,7 @@ u64 VirtualMemoryBlock::getMappedAddress(u64 realAddress)
|
||||
|
||||
void VirtualMemoryBlock::Delete()
|
||||
{
|
||||
m_mapped_memory.Clear();
|
||||
m_mapped_memory.clear();
|
||||
|
||||
MemoryBlock::Delete();
|
||||
}
|
||||
@ -763,4 +763,4 @@ bool VirtualMemoryBlock::Unreserve(u32 size)
|
||||
u32 VirtualMemoryBlock::GetResevedAmount()
|
||||
{
|
||||
return m_reserve_size;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,8 @@
|
||||
#include "MemoryBlock.h"
|
||||
#include <vector>
|
||||
|
||||
using std::nullptr_t;
|
||||
|
||||
enum MemoryType
|
||||
{
|
||||
Memory_PS3,
|
||||
@ -488,7 +490,8 @@ public:
|
||||
u8* operator + (const u64 vaddr)
|
||||
{
|
||||
u8* ret = GetMemFromAddr(vaddr);
|
||||
if(!ret) throw fmt::Format("GetMemFromAddr(0x%llx)", vaddr);
|
||||
if(ret == nullptr)
|
||||
throw fmt::Format("GetMemFromAddr(0x%x)", vaddr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ struct MemInfo
|
||||
|
||||
struct MemBlockInfo : public MemInfo
|
||||
{
|
||||
void* mem;
|
||||
void *mem;
|
||||
|
||||
MemBlockInfo(u64 _addr, u32 _size)
|
||||
: MemInfo(_addr, PAGE_4K(_size))
|
||||
@ -31,13 +31,27 @@ struct MemBlockInfo : public MemInfo
|
||||
ConLog.Error("Not enought free memory.");
|
||||
assert(0);
|
||||
}
|
||||
|
||||
memset(mem, 0, size);
|
||||
}
|
||||
|
||||
MemBlockInfo(MemBlockInfo &other) = delete;
|
||||
MemBlockInfo(MemBlockInfo &&other) : MemInfo(other.addr,other.size) ,mem(other.mem)
|
||||
{
|
||||
other.mem = nullptr;
|
||||
}
|
||||
MemBlockInfo& operator =(MemBlockInfo &other) = delete;
|
||||
MemBlockInfo& operator =(MemBlockInfo &&other){
|
||||
this->addr = other.addr;
|
||||
this->size = other.size;
|
||||
if (this->mem) _aligned_free(mem);
|
||||
this->mem = other.mem;
|
||||
other.mem = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
~MemBlockInfo()
|
||||
{
|
||||
_aligned_free(mem);
|
||||
if(mem) _aligned_free(mem);
|
||||
mem = nullptr;
|
||||
}
|
||||
};
|
||||
@ -193,9 +207,9 @@ template<typename PT>
|
||||
class DynamicMemoryBlockBase : public PT
|
||||
{
|
||||
mutable std::mutex m_lock;
|
||||
Array<MemBlockInfo> m_allocated; // allocation info
|
||||
Array<u8*> m_pages; // real addresses of every 4096 byte pages (array size should be fixed)
|
||||
Array<u8*> m_locked; // locked pages should be moved here
|
||||
std::vector<MemBlockInfo> m_allocated; // allocation info
|
||||
std::vector<u8*> m_pages; // real addresses of every 4096 byte pages (array size should be fixed)
|
||||
std::vector<u8*> m_locked; // locked pages should be moved here
|
||||
|
||||
u32 m_max_size;
|
||||
|
||||
@ -229,7 +243,7 @@ private:
|
||||
|
||||
class VirtualMemoryBlock : public MemoryBlock
|
||||
{
|
||||
Array<VirtualMemInfo> m_mapped_memory;
|
||||
std::vector<VirtualMemInfo> m_mapped_memory;
|
||||
u32 m_reserve_size;
|
||||
|
||||
public:
|
||||
@ -283,3 +297,4 @@ public:
|
||||
|
||||
typedef DynamicMemoryBlockBase<MemoryBlock> DynamicMemoryBlock;
|
||||
typedef DynamicMemoryBlockBase<MemoryBlockLE> DynamicMemoryBlockLE;
|
||||
|
||||
|
@ -44,7 +44,7 @@ struct Callback3 : public Callback
|
||||
|
||||
struct Callbacks
|
||||
{
|
||||
Array<Callback> m_callbacks;
|
||||
std::vector<Callback> m_callbacks;
|
||||
bool m_in_manager;
|
||||
|
||||
Callbacks() : m_in_manager(false)
|
||||
@ -58,11 +58,11 @@ struct Callbacks
|
||||
|
||||
void Unregister(u32 slot)
|
||||
{
|
||||
for(u32 i=0; i<m_callbacks.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_callbacks.size(); ++i)
|
||||
{
|
||||
if(m_callbacks[i].GetSlot() == slot)
|
||||
{
|
||||
m_callbacks.RemoveAt(i);
|
||||
m_callbacks.erase(m_callbacks.begin() + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -74,7 +74,7 @@ struct Callbacks
|
||||
{
|
||||
bool handled = false;
|
||||
|
||||
for(u32 i=0; i<m_callbacks.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_callbacks.size(); ++i)
|
||||
{
|
||||
if(m_callbacks[i].HasData())
|
||||
{
|
||||
@ -96,12 +96,13 @@ struct Callbacks2 : public Callbacks
|
||||
void Register(u32 slot, u64 addr, u64 userdata)
|
||||
{
|
||||
Callbacks::Register(slot, addr, userdata);
|
||||
m_callbacks.Move(new Callback2(slot, addr, userdata));
|
||||
Callback2 callback(slot, addr, userdata);
|
||||
m_callbacks.push_back(callback);
|
||||
}
|
||||
|
||||
void Handle(u64 a1, u64 a2)
|
||||
{
|
||||
for(u32 i=0; i<m_callbacks.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_callbacks.size(); ++i)
|
||||
{
|
||||
((Callback2&)m_callbacks[i]).Handle(a1);
|
||||
}
|
||||
@ -117,12 +118,13 @@ struct Callbacks3 : public Callbacks
|
||||
void Register(u32 slot, u64 addr, u64 userdata)
|
||||
{
|
||||
Callbacks::Register(slot, addr, userdata);
|
||||
m_callbacks.Move(new Callback3(slot, addr, userdata));
|
||||
Callback3 callback(slot, addr, userdata);
|
||||
m_callbacks.push_back(callback);
|
||||
}
|
||||
|
||||
void Handle(u64 a1, u64 a2)
|
||||
{
|
||||
for(u32 i=0; i<m_callbacks.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_callbacks.size(); ++i)
|
||||
{
|
||||
((Callback3&)m_callbacks[i]).Handle(a1, a2);
|
||||
}
|
||||
@ -131,7 +133,7 @@ struct Callbacks3 : public Callbacks
|
||||
|
||||
struct CallbackManager
|
||||
{
|
||||
ArrayF<Callbacks> m_callbacks;
|
||||
std::vector<Callbacks *> m_callbacks;
|
||||
Callbacks3 m_exit_callback;
|
||||
|
||||
void Add(Callbacks& c)
|
||||
@ -139,7 +141,7 @@ struct CallbackManager
|
||||
if(c.m_in_manager) return;
|
||||
|
||||
c.m_in_manager = true;
|
||||
m_callbacks.Add(c);
|
||||
m_callbacks.push_back(&c);
|
||||
}
|
||||
|
||||
void Init()
|
||||
@ -149,12 +151,12 @@ struct CallbackManager
|
||||
|
||||
void Clear()
|
||||
{
|
||||
for(u32 i=0; i<m_callbacks.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_callbacks.size(); ++i)
|
||||
{
|
||||
m_callbacks[i].m_callbacks.Clear();
|
||||
m_callbacks[i].m_in_manager = false;
|
||||
m_callbacks[i]->m_callbacks.clear();
|
||||
m_callbacks[i]->m_in_manager = false;
|
||||
}
|
||||
|
||||
m_callbacks.ClearF();
|
||||
m_callbacks.clear();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -3,12 +3,13 @@
|
||||
#include "SC_FUNC.h"
|
||||
#include <mutex>
|
||||
|
||||
|
||||
Module* g_modules[3][0xff] = {0};
|
||||
uint g_max_module_id = 0;
|
||||
uint g_module_2_count = 0;
|
||||
ArrayF<ModuleFunc> g_modules_funcs_list;
|
||||
std::vector<ModuleFunc *> g_modules_funcs_list;
|
||||
std::mutex g_funcs_lock;
|
||||
ArrayF<SFunc> g_static_funcs_list;
|
||||
std::vector<SFunc *> g_static_funcs_list;
|
||||
|
||||
struct ModuleInfo
|
||||
{
|
||||
@ -116,25 +117,50 @@ static const g_module_list[] =
|
||||
{0xf034, "cellSailRec"},
|
||||
{0xf035, "sceNpTrophy"},
|
||||
{0xf053, "cellAdecAt3multi"},
|
||||
{0xf054, "cellLibatrac3multi"},
|
||||
{0xf054, "cellLibatrac3multi"}
|
||||
};
|
||||
|
||||
struct _InitNullModules
|
||||
{
|
||||
std::vector<Module*> m_modules;
|
||||
|
||||
_InitNullModules()
|
||||
{
|
||||
for(auto& m : g_module_list)
|
||||
{
|
||||
new Module(m.id, m.name);
|
||||
m_modules.push_back(new Module(m.id, m.name));
|
||||
}
|
||||
}
|
||||
|
||||
~_InitNullModules()
|
||||
{
|
||||
for (int i = 0; i < m_modules.size(); ++i)
|
||||
{
|
||||
delete m_modules[i];
|
||||
}
|
||||
}
|
||||
} InitNullModules;
|
||||
|
||||
/** HACK: Used to delete SFunc objects that get added to the global static function array (g_static_funcs_list).
|
||||
* The destructor of this static object gets called when the program shuts down.
|
||||
*/
|
||||
struct StaticFunctionListCleaner_t
|
||||
{
|
||||
StaticFunctionListCleaner_t() {}
|
||||
~StaticFunctionListCleaner_t()
|
||||
{
|
||||
for (int i = 0; i < g_static_funcs_list.size(); ++i)
|
||||
{
|
||||
delete g_static_funcs_list[i];
|
||||
}
|
||||
}
|
||||
} StaticFunctionListCleaner;
|
||||
|
||||
bool IsLoadedFunc(u32 id)
|
||||
{
|
||||
for(u32 i=0; i<g_modules_funcs_list.GetCount(); ++i)
|
||||
for(u32 i=0; i<g_modules_funcs_list.size(); ++i)
|
||||
{
|
||||
if(g_modules_funcs_list[i].id == id)
|
||||
if(g_modules_funcs_list[i]->id == id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -149,11 +175,11 @@ bool CallFunc(u32 num)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(g_funcs_lock);
|
||||
|
||||
for(u32 i=0; i<g_modules_funcs_list.GetCount(); ++i)
|
||||
for(u32 i=0; i<g_modules_funcs_list.size(); ++i)
|
||||
{
|
||||
if(g_modules_funcs_list[i].id == num)
|
||||
if(g_modules_funcs_list[i]->id == num)
|
||||
{
|
||||
func = g_modules_funcs_list[i].func;
|
||||
func = g_modules_funcs_list[i]->func;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -170,11 +196,11 @@ bool UnloadFunc(u32 id)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(g_funcs_lock);
|
||||
|
||||
for(u32 i=0; i<g_modules_funcs_list.GetCount(); ++i)
|
||||
for(u32 i=0; i<g_modules_funcs_list.size(); ++i)
|
||||
{
|
||||
if(g_modules_funcs_list[i].id == id)
|
||||
if(g_modules_funcs_list[i]->id == id)
|
||||
{
|
||||
g_modules_funcs_list.RemoveFAt(i);
|
||||
g_modules_funcs_list.erase(g_modules_funcs_list.begin() +i);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -202,7 +228,7 @@ void UnloadModules()
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(g_funcs_lock);
|
||||
g_modules_funcs_list.Clear();
|
||||
g_modules_funcs_list.clear();
|
||||
}
|
||||
|
||||
Module* GetModuleByName(const std::string& name)
|
||||
@ -268,13 +294,13 @@ void SetModule(int id, Module* module, bool with_data)
|
||||
if(with_data)
|
||||
{
|
||||
module->SetName(g_modules[index][(u8)id]->GetName());
|
||||
delete g_modules[index][(u8)id];
|
||||
// delete g_modules[index][(u8)id];
|
||||
g_modules[index][(u8)id] = module;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_modules[index][(u8)id]->SetName(module->GetName());
|
||||
delete module;
|
||||
// delete module;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -324,6 +350,16 @@ Module::Module(u16 id, void (*init)(), void (*load)(), void (*unload)())
|
||||
if(init) init();
|
||||
}
|
||||
|
||||
Module::~Module()
|
||||
{
|
||||
UnLoad();
|
||||
|
||||
for (int i = 0; i < m_funcs_list.size(); i++)
|
||||
{
|
||||
delete m_funcs_list[i];
|
||||
}
|
||||
}
|
||||
|
||||
void Module::Load()
|
||||
{
|
||||
if(IsLoaded())
|
||||
@ -331,13 +367,13 @@ void Module::Load()
|
||||
|
||||
if(m_load_func) m_load_func();
|
||||
|
||||
for(u32 i=0; i<m_funcs_list.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_funcs_list.size(); ++i)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(g_funcs_lock);
|
||||
|
||||
if(IsLoadedFunc(m_funcs_list[i].id)) continue;
|
||||
if(IsLoadedFunc(m_funcs_list[i]->id)) continue;
|
||||
|
||||
g_modules_funcs_list.Add(m_funcs_list[i]);
|
||||
g_modules_funcs_list.push_back(m_funcs_list[i]);
|
||||
}
|
||||
|
||||
SetLoaded(true);
|
||||
@ -350,9 +386,9 @@ void Module::UnLoad()
|
||||
|
||||
if(m_unload_func) m_unload_func();
|
||||
|
||||
for(u32 i=0; i<m_funcs_list.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_funcs_list.size(); ++i)
|
||||
{
|
||||
UnloadFunc(m_funcs_list[i].id);
|
||||
UnloadFunc(m_funcs_list[i]->id);
|
||||
}
|
||||
|
||||
SetLoaded(false);
|
||||
@ -364,11 +400,11 @@ bool Module::Load(u32 id)
|
||||
|
||||
if(IsLoadedFunc(id)) return false;
|
||||
|
||||
for(u32 i=0; i<m_funcs_list.GetCount(); ++i)
|
||||
for(u32 i=0; i<m_funcs_list.size(); ++i)
|
||||
{
|
||||
if(m_funcs_list[i].id == id)
|
||||
if(m_funcs_list[i]->id == id)
|
||||
{
|
||||
g_modules_funcs_list.Add(m_funcs_list[i]);
|
||||
g_modules_funcs_list.push_back(m_funcs_list[i]);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -470,3 +506,4 @@ bool Module::CheckID(u32 id, ID*& _id) const
|
||||
{
|
||||
return Emu.GetIdManager().CheckID(id) && (_id = &Emu.GetIdManager().GetID(id))->m_name == GetName();
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,7 @@
|
||||
#pragma once
|
||||
#include "Modules/cellResc.h"
|
||||
#include "Modules/cellPngDec.h"
|
||||
#include "Modules/cellJpgDec.h"
|
||||
#include "Modules/cellGifDec.h"
|
||||
|
||||
#define declCPU PPUThread& CPU = GetCurrentPPUThread
|
||||
|
||||
class func_caller
|
||||
{
|
||||
public:
|
||||
virtual void operator()() = 0;
|
||||
};
|
||||
|
||||
//TODO
|
||||
struct ModuleFunc
|
||||
@ -23,6 +14,11 @@ struct ModuleFunc
|
||||
, func(func)
|
||||
{
|
||||
}
|
||||
|
||||
~ModuleFunc()
|
||||
{
|
||||
safe_delete(func);
|
||||
}
|
||||
};
|
||||
|
||||
struct SFuncOp
|
||||
@ -36,12 +32,17 @@ struct SFunc
|
||||
func_caller* func;
|
||||
void* ptr;
|
||||
char* name;
|
||||
Array<SFuncOp> ops;
|
||||
std::vector<SFuncOp> ops;
|
||||
u64 group;
|
||||
u32 found;
|
||||
|
||||
~SFunc()
|
||||
{
|
||||
safe_delete(func);
|
||||
}
|
||||
};
|
||||
|
||||
extern ArrayF<SFunc> g_static_funcs_list;
|
||||
extern std::vector<SFunc *> g_static_funcs_list;
|
||||
|
||||
class Module
|
||||
{
|
||||
@ -52,12 +53,14 @@ class Module
|
||||
void (*m_unload_func)();
|
||||
|
||||
public:
|
||||
Array<ModuleFunc> m_funcs_list;
|
||||
std::vector<ModuleFunc*> m_funcs_list;
|
||||
|
||||
Module(u16 id, const char* name);
|
||||
Module(const char* name, void (*init)(), void (*load)() = nullptr, void (*unload)() = nullptr);
|
||||
Module(u16 id, void (*init)(), void (*load)() = nullptr, void (*unload)() = nullptr);
|
||||
|
||||
~Module();
|
||||
|
||||
void Load();
|
||||
void UnLoad();
|
||||
bool Load(u32 id);
|
||||
@ -120,7 +123,7 @@ public:
|
||||
template<typename T>
|
||||
__forceinline void Module::AddFunc(u32 id, T func)
|
||||
{
|
||||
m_funcs_list.Move(new ModuleFunc(id, bind_func(func)));
|
||||
m_funcs_list.emplace_back(new ModuleFunc(id, bind_func(func)));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@ -128,8 +131,9 @@ __forceinline void Module::AddFuncSub(const char group[8], const u64 ops[], char
|
||||
{
|
||||
if (!ops[0]) return;
|
||||
|
||||
//TODO: track down where this is supposed to be deleted
|
||||
SFunc* sf = new SFunc;
|
||||
sf->ptr = func;
|
||||
sf->ptr = (void *)func;
|
||||
sf->func = bind_func(func);
|
||||
sf->name = name;
|
||||
sf->group = *(u64*)group;
|
||||
@ -145,9 +149,9 @@ __forceinline void Module::AddFuncSub(const char group[8], const u64 ops[], char
|
||||
if (op.mask) op.crc &= op.mask;
|
||||
op.mask = re(op.mask);
|
||||
op.crc = re(op.crc);
|
||||
sf->ops.AddCpy(op);
|
||||
sf->ops.push_back(op);
|
||||
}
|
||||
g_static_funcs_list.Add(sf);
|
||||
g_static_funcs_list.push_back(sf);
|
||||
}
|
||||
|
||||
bool IsLoadedFunc(u32 id);
|
||||
@ -157,3 +161,4 @@ void UnloadModules();
|
||||
u32 GetFuncNumById(u32 id);
|
||||
Module* GetModuleByName(const std::string& name);
|
||||
Module* GetModuleById(u16 id);
|
||||
|
||||
|
@ -65,7 +65,7 @@ int cellAudioInit()
|
||||
}
|
||||
queue.Clear();
|
||||
|
||||
Array<u64> keys;
|
||||
std::vector<u64> keys;
|
||||
|
||||
if(m_audio_out)
|
||||
{
|
||||
@ -354,10 +354,10 @@ int cellAudioInit()
|
||||
index = (position + 1) % port.block; // write new value
|
||||
}
|
||||
// load keys:
|
||||
keys.SetCount(m_config.m_keys.GetCount());
|
||||
memcpy(keys.GetPtr(), m_config.m_keys.GetPtr(), sizeof(u64) * keys.GetCount());
|
||||
keys.resize(m_config.m_keys.size());
|
||||
memcpy(keys.data(), m_config.m_keys.data(), sizeof(u64) * keys.size());
|
||||
}
|
||||
for (u32 i = 0; i < keys.GetCount(); i++)
|
||||
for (u32 i = 0; i < keys.size(); i++)
|
||||
{
|
||||
// TODO: check event source
|
||||
Emu.GetEventManager().SendEvent(keys[i], 0x10103000e010e07, 0, 0, 0);
|
||||
@ -402,7 +402,7 @@ abort:
|
||||
|
||||
m_config.m_is_audio_initialized = false;
|
||||
|
||||
m_config.m_keys.Clear();
|
||||
m_config.m_keys.clear();
|
||||
for (u32 i = 0; i < m_config.AUDIO_PORT_COUNT; i++)
|
||||
{
|
||||
AudioPortConfig& port = m_config.m_ports[i];
|
||||
@ -736,14 +736,14 @@ int cellAudioSetNotifyEventQueue(u64 key)
|
||||
|
||||
SMutexGeneralLocker lock(audioMutex);
|
||||
|
||||
for (u32 i = 0; i < m_config.m_keys.GetCount(); i++) // check for duplicates
|
||||
for (u32 i = 0; i < m_config.m_keys.size(); i++) // check for duplicates
|
||||
{
|
||||
if (m_config.m_keys[i] == key)
|
||||
{
|
||||
return CELL_AUDIO_ERROR_PARAM;
|
||||
}
|
||||
}
|
||||
m_config.m_keys.AddCpy(key);
|
||||
m_config.m_keys.push_back(key);
|
||||
|
||||
/*EventQueue* eq;
|
||||
if (!Emu.GetEventManager().GetEventQueue(key, eq))
|
||||
@ -769,11 +769,11 @@ int cellAudioRemoveNotifyEventQueue(u64 key)
|
||||
SMutexGeneralLocker lock(audioMutex);
|
||||
|
||||
bool found = false;
|
||||
for (u32 i = 0; i < m_config.m_keys.GetCount(); i++)
|
||||
for (u32 i = 0; i < m_config.m_keys.size(); i++)
|
||||
{
|
||||
if (m_config.m_keys[i] == key)
|
||||
{
|
||||
m_config.m_keys.RemoveAt(i);
|
||||
m_config.m_keys.erase(m_config.m_keys.begin() + i);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@ -862,4 +862,4 @@ void cellAudio_init()
|
||||
cellAudio.AddFunc(0xdab029aa, cellAudioAddData);
|
||||
cellAudio.AddFunc(0xe4046afe, cellAudioGetPortBlockTag);
|
||||
cellAudio.AddFunc(0xff3626fd, cellAudioRemoveNotifyEventQueue);
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,9 @@
|
||||
#include "stblib/stb_truetype.h"
|
||||
|
||||
void cellFont_init();
|
||||
void cellFont_load();
|
||||
void cellFont_unload();
|
||||
Module cellFont(0x0019, cellFont_init, nullptr, cellFont_unload);
|
||||
Module cellFont(0x0019, cellFont_init, cellFont_load, cellFont_unload);
|
||||
|
||||
// Font Set Types
|
||||
enum
|
||||
@ -226,7 +227,7 @@ struct CCellFontInternal //Module cellFont
|
||||
}
|
||||
};
|
||||
|
||||
CCellFontInternal* s_fontInternalInstance = new CCellFontInternal();
|
||||
CCellFontInternal* s_fontInternalInstance = nullptr;
|
||||
|
||||
// Functions
|
||||
int cellFontInitializeWithRevision(u64 revisionFlags, mem_ptr_t<CellFontConfig> config)
|
||||
@ -899,8 +900,14 @@ void cellFont_init()
|
||||
cellFont.AddFunc(0xb015a84e, cellFontGetRevisionFlags);
|
||||
}
|
||||
|
||||
void cellFont_load()
|
||||
{
|
||||
s_fontInternalInstance = new CCellFontInternal();
|
||||
}
|
||||
|
||||
void cellFont_unload()
|
||||
{
|
||||
s_fontInternalInstance->m_bInitialized = false;
|
||||
s_fontInternalInstance->m_bFontGcmInitialized = false;
|
||||
// s_fontInternalInstance->m_bInitialized = false;
|
||||
// s_fontInternalInstance->m_bFontGcmInitialized = false;
|
||||
delete s_fontInternalInstance;
|
||||
}
|
@ -4,7 +4,9 @@
|
||||
#include "cellFont.h"
|
||||
|
||||
void cellFontFT_init();
|
||||
Module cellFontFT(0x001a, cellFontFT_init);
|
||||
void cellFontFT_load();
|
||||
void cellFontFT_unload();
|
||||
Module cellFontFT(0x001a, cellFontFT_init, cellFontFT_load, cellFontFT_unload);
|
||||
|
||||
struct CellFontLibraryConfigFT
|
||||
{
|
||||
@ -33,7 +35,7 @@ struct CCellFontFTInternal
|
||||
}
|
||||
};
|
||||
|
||||
CCellFontFTInternal* s_fontFtInternalInstance = new CCellFontFTInternal();
|
||||
CCellFontFTInternal* s_fontFtInternalInstance = nullptr;
|
||||
|
||||
int cellFontInitLibraryFreeTypeWithRevision(u64 revisionFlags, mem_ptr_t<CellFontLibraryConfigFT> config, u32 lib_addr_addr)
|
||||
{
|
||||
@ -67,4 +69,14 @@ void cellFontFT_init()
|
||||
cellFontFT.AddFunc(0x7a0a83c4, cellFontInitLibraryFreeTypeWithRevision);
|
||||
cellFontFT.AddFunc(0xec89a187, cellFontFTGetRevisionFlags);
|
||||
cellFontFT.AddFunc(0xfa0c2de0, cellFontFTGetInitializedRevisionFlags);
|
||||
}
|
||||
|
||||
void cellFontFT_load()
|
||||
{
|
||||
s_fontFtInternalInstance = new CCellFontFTInternal();
|
||||
}
|
||||
|
||||
void cellFontFT_unload()
|
||||
{
|
||||
delete s_fontFtInternalInstance;
|
||||
}
|
@ -164,7 +164,11 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
|
||||
|
||||
//Decode PNG file. (TODO: Is there any faster alternative? Can we do it without external libraries?)
|
||||
int width, height, actual_components;
|
||||
std::shared_ptr<unsigned char> image(stbi_load_from_memory(png.GetPtr(), fileSize, &width, &height, &actual_components, 4));
|
||||
auto image = std::unique_ptr<unsigned char,decltype(&::free)>
|
||||
(
|
||||
stbi_load_from_memory(png.GetPtr(), fileSize, &width, &height, &actual_components, 4),
|
||||
&::free
|
||||
);
|
||||
if (!image) return CELL_PNGDEC_ERROR_STREAM_FORMAT;
|
||||
|
||||
uint image_size = width * height;
|
||||
|
@ -5,8 +5,9 @@
|
||||
#include "cellResc.h"
|
||||
|
||||
void cellResc_init();
|
||||
void cellResc_load();
|
||||
void cellResc_unload();
|
||||
Module cellResc(0x001f, cellResc_init, nullptr, cellResc_unload);
|
||||
Module cellResc(0x001f, cellResc_init, cellResc_load, cellResc_unload);
|
||||
|
||||
// Error Codes
|
||||
enum
|
||||
@ -71,7 +72,7 @@ struct CCellRescInternal
|
||||
};
|
||||
|
||||
|
||||
CCellRescInternal* s_rescInternalInstance = new CCellRescInternal();
|
||||
CCellRescInternal* s_rescInternalInstance = nullptr;
|
||||
|
||||
// Extern Functions
|
||||
extern int cellGcmSetFlipMode(u32 mode);
|
||||
@ -810,7 +811,13 @@ void cellResc_init()
|
||||
//cellResc.AddFunc(0xe0cef79e, cellRescCreateInterlaceTable);
|
||||
}
|
||||
|
||||
void cellResc_load()
|
||||
{
|
||||
s_rescInternalInstance = new CCellRescInternal();
|
||||
}
|
||||
|
||||
void cellResc_unload()
|
||||
{
|
||||
s_rescInternalInstance->m_bInitialized = false;
|
||||
// s_rescInternalInstance->m_bInitialized = false;
|
||||
delete s_rescInternalInstance;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ int cellUserInfoGetStat(u32 id, mem_ptr_t<CellUserInfoUserStat> stat)
|
||||
memset(name, 0, CELL_USERINFO_USERNAME_SIZE);
|
||||
stream->Read(name, CELL_USERINFO_USERNAME_SIZE);
|
||||
stream->Close();
|
||||
delete stream;
|
||||
|
||||
stat->id = id;
|
||||
memcpy(stat->name, name, CELL_USERINFO_USERNAME_SIZE);
|
||||
|
@ -803,4 +803,4 @@ void cellVdec_init()
|
||||
|
||||
av_register_all();
|
||||
avcodec_register_all();
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
|
||||
return CELL_VPOST_ERROR_E_ARG_CTRL_INVALID;
|
||||
}
|
||||
|
||||
u32 w = ctrlParam->inWidth;
|
||||
s32 w = ctrlParam->inWidth;
|
||||
u32 h = ctrlParam->inHeight;
|
||||
u32 ow = ctrlParam->outWidth;
|
||||
u32 oh = ctrlParam->outHeight;
|
||||
@ -193,7 +193,7 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
|
||||
u8* in_data[4] = { pY, pU, pV, pA };
|
||||
int in_line[4] = { w, w/2, w/2, w };
|
||||
u8* out_data[4] = { (u8*)res, NULL, NULL, NULL };
|
||||
int out_line[4] = { ow*4, 0, 0, 0 };
|
||||
int out_line[4] = { static_cast<int>(ow*4), 0, 0, 0 };
|
||||
|
||||
sws_scale(sws, in_data, in_line, 0, h, out_data, out_line);
|
||||
|
||||
@ -225,4 +225,4 @@ void cellVpost_init()
|
||||
cellVpost.AddFunc(0x40524325, cellVpostOpenEx);
|
||||
cellVpost.AddFunc(0x10ef39f6, cellVpostClose);
|
||||
cellVpost.AddFunc(0xabb8cc3d, cellVpostExec);
|
||||
}
|
||||
}
|
||||
|
@ -51,12 +51,12 @@ int sceNpDrmIsAvailable(u32 k_licensee_addr, u32 drm_path_addr)
|
||||
sceNp.Warning("sceNpDrmIsAvailable: Can't find RAP file for DRM!");
|
||||
else
|
||||
{
|
||||
Array<DirEntryInfo> entries = raps_dir->GetEntries();
|
||||
for (unsigned int i = 0; i < entries.GetCount(); i++)
|
||||
const std::vector<DirEntryInfo> &entries = raps_dir->GetEntries();
|
||||
for (auto &entry: entries)
|
||||
{
|
||||
if (entries[i].name.find(fmt::ToUTF8(titleID)) != std::string::npos )
|
||||
if (entry.name.find(fmt::ToUTF8(titleID)) != std::string::npos )
|
||||
{
|
||||
rap_file_path += fmt::FromUTF8(entries[i].name);
|
||||
rap_file_path += fmt::FromUTF8(entry.name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,18 @@ struct sceNpTrophyInternalContext
|
||||
vfsStream* trp_stream;
|
||||
|
||||
TROPUSRLoader* tropusr;
|
||||
|
||||
sceNpTrophyInternalContext()
|
||||
: trp_stream(nullptr),
|
||||
tropusr(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
~sceNpTrophyInternalContext()
|
||||
{
|
||||
safe_delete(trp_stream);
|
||||
safe_delete(tropusr);
|
||||
}
|
||||
};
|
||||
|
||||
struct sceNpTrophyInternal
|
||||
@ -132,8 +144,10 @@ int sceNpTrophyRegisterContext(u32 context, u32 handle, u32 statusCb_addr, u32 a
|
||||
return SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE;
|
||||
|
||||
// Rename or discard certain entries based on the files found
|
||||
char target [32];
|
||||
sprintf(target, "TROP_%02d.SFM", Ini.SysLanguage.GetValue());
|
||||
const size_t kTargetBufferLength = 31;
|
||||
char target[kTargetBufferLength+1];
|
||||
target[kTargetBufferLength] = 0;
|
||||
snprintf(target, kTargetBufferLength, "TROP_%02d.SFM", Ini.SysLanguage.GetValue());
|
||||
|
||||
if (trp.ContainsEntry(target)) {
|
||||
trp.RemoveEntry("TROPCONF.SFM");
|
||||
@ -150,7 +164,7 @@ int sceNpTrophyRegisterContext(u32 context, u32 handle, u32 statusCb_addr, u32 a
|
||||
|
||||
// Discard unnecessary TROP_XX.SFM files
|
||||
for (int i=0; i<=18; i++) {
|
||||
sprintf(target, "TROP_%02d.SFM", i);
|
||||
snprintf(target, kTargetBufferLength, "TROP_%02d.SFM", i);
|
||||
if (i != Ini.SysLanguage.GetValue())
|
||||
trp.RemoveEntry(target);
|
||||
}
|
||||
@ -288,7 +302,7 @@ int sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, mem32_t plati
|
||||
// TODO: There are other possible errors
|
||||
|
||||
sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context];
|
||||
if (trophyId >= ctxt.tropusr->GetTrophiesCount())
|
||||
if (trophyId >= (s32)ctxt.tropusr->GetTrophiesCount())
|
||||
return SCE_NP_TROPHY_ERROR_INVALID_TROPHY_ID;
|
||||
if (ctxt.tropusr->GetTrophyUnlockState(trophyId))
|
||||
return SCE_NP_TROPHY_ERROR_ALREADY_UNLOCKED;
|
||||
|
@ -80,7 +80,11 @@ s32 getLastError()
|
||||
return errno;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
using pck_len_t = s32;
|
||||
#else
|
||||
using pck_len_t = u32;
|
||||
#endif
|
||||
|
||||
// Functions
|
||||
int sys_net_accept(s32 s, mem_ptr_t<sys_net_sockaddr> addr, mem32_t paddrlen)
|
||||
@ -89,7 +93,7 @@ int sys_net_accept(s32 s, mem_ptr_t<sys_net_sockaddr> addr, mem32_t paddrlen)
|
||||
sockaddr _addr;
|
||||
memcpy(&_addr, Memory.VirtualToRealAddr(addr.GetAddr()), sizeof(sockaddr));
|
||||
_addr.sa_family = addr->sa_family;
|
||||
s32 *_paddrlen = (s32 *)Memory.VirtualToRealAddr(paddrlen.GetAddr());
|
||||
pck_len_t *_paddrlen = (pck_len_t *) Memory.VirtualToRealAddr(paddrlen.GetAddr());
|
||||
int ret = accept(s, &_addr, _paddrlen);
|
||||
g_lastError = getLastError();
|
||||
return ret;
|
||||
@ -227,7 +231,7 @@ int sys_net_recvfrom(s32 s, u32 buf_addr, u32 len, s32 flags, mem_ptr_t<sys_net_
|
||||
sockaddr _addr;
|
||||
memcpy(&_addr, Memory.VirtualToRealAddr(addr.GetAddr()), sizeof(sockaddr));
|
||||
_addr.sa_family = addr->sa_family;
|
||||
s32 *_paddrlen = (s32 *)Memory.VirtualToRealAddr(paddrlen.GetAddr());
|
||||
pck_len_t *_paddrlen = (pck_len_t *) Memory.VirtualToRealAddr(paddrlen.GetAddr());
|
||||
int ret = recvfrom(s, _buf_addr, len, flags, &_addr, _paddrlen);
|
||||
g_lastError = getLastError();
|
||||
return ret;
|
||||
|
@ -1,8 +1,14 @@
|
||||
#pragma once
|
||||
#include "Modules.h"
|
||||
|
||||
#define RESULT(x) SC_ARGS_1 = (x)
|
||||
|
||||
class func_caller
|
||||
{
|
||||
public:
|
||||
virtual void operator()() = 0;
|
||||
};
|
||||
|
||||
|
||||
template<bool is_in_sp, bool is_fp, bool is_ptr, typename T, int i>
|
||||
struct get_arg;
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
extern ArrayF<SFunc> g_static_funcs_list;
|
||||
extern std::vector<SFunc*> g_static_funcs_list;
|
||||
|
||||
void StaticAnalyse(void* ptr, u32 size, u32 base)
|
||||
{
|
||||
@ -15,13 +15,13 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
||||
// TODO: optimize search
|
||||
for (u32 i = 0; i < size; i++)
|
||||
{
|
||||
for (u32 j = 0; j < g_static_funcs_list.GetCount(); j++)
|
||||
for (u32 j = 0; j < g_static_funcs_list.size(); j++)
|
||||
{
|
||||
if ((data[i] & g_static_funcs_list[j].ops[0].mask) == g_static_funcs_list[j].ops[0].crc)
|
||||
if ((data[i] & g_static_funcs_list[j]->ops[0].mask) == g_static_funcs_list[j]->ops[0].crc)
|
||||
{
|
||||
bool found = true;
|
||||
u32 can_skip = 0;
|
||||
for (u32 k = i, x = 0; x + 1 <= g_static_funcs_list[j].ops.GetCount(); k++, x++)
|
||||
for (u32 k = i, x = 0; x + 1 <= g_static_funcs_list[j]->ops.size(); k++, x++)
|
||||
{
|
||||
if (k >= size)
|
||||
{
|
||||
@ -36,8 +36,8 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
||||
continue;
|
||||
}
|
||||
|
||||
const u32 mask = g_static_funcs_list[j].ops[x].mask;
|
||||
const u32 crc = g_static_funcs_list[j].ops[x].crc;
|
||||
const u32 mask = g_static_funcs_list[j]->ops[x].mask;
|
||||
const u32 crc = g_static_funcs_list[j]->ops[x].crc;
|
||||
|
||||
if (!mask)
|
||||
{
|
||||
@ -83,8 +83,8 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
ConLog.Write("Function '%s' hooked (addr=0x%x)", g_static_funcs_list[j].name, i * 4 + base);
|
||||
g_static_funcs_list[j].found++;
|
||||
ConLog.Write("Function '%s' hooked (addr=0x%x)", g_static_funcs_list[j]->name, i * 4 + base);
|
||||
g_static_funcs_list[j]->found++;
|
||||
data[i+0] = re32(0x39600000 | j); // li r11, j
|
||||
data[i+1] = se32(0x44000003); // sc 3
|
||||
data[i+2] = se32(0x4e800020); // blr
|
||||
@ -95,11 +95,11 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
||||
}
|
||||
|
||||
// check function groups
|
||||
for (u32 i = 0; i < g_static_funcs_list.GetCount(); i++)
|
||||
for (u32 i = 0; i < g_static_funcs_list.size(); i++)
|
||||
{
|
||||
if (g_static_funcs_list[i].found) // start from some group
|
||||
if (g_static_funcs_list[i]->found) // start from some group
|
||||
{
|
||||
const u64 group = g_static_funcs_list[i].group;
|
||||
const u64 group = g_static_funcs_list[i]->group;
|
||||
|
||||
enum GroupSearchResult : u32
|
||||
{
|
||||
@ -110,24 +110,24 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
||||
u32 res = GSR_SUCCESS;
|
||||
|
||||
// analyse
|
||||
for (u32 j = 0; j < g_static_funcs_list.GetCount(); j++) if (g_static_funcs_list[j].group == group)
|
||||
for (u32 j = 0; j < g_static_funcs_list.size(); j++) if (g_static_funcs_list[j]->group == group)
|
||||
{
|
||||
u32 count = g_static_funcs_list[j].found;
|
||||
u32 count = g_static_funcs_list[j]->found;
|
||||
|
||||
if (count == 0) // not found
|
||||
{
|
||||
// check if this function has been found with different pattern
|
||||
for (u32 k = 0; k < g_static_funcs_list.GetCount(); k++) if (g_static_funcs_list[k].group == group)
|
||||
for (u32 k = 0; k < g_static_funcs_list.size(); k++) if (g_static_funcs_list[k]->group == group)
|
||||
{
|
||||
if (k != j && g_static_funcs_list[k].ptr == g_static_funcs_list[j].ptr)
|
||||
if (k != j && g_static_funcs_list[k]->ptr == g_static_funcs_list[j]->ptr)
|
||||
{
|
||||
count += g_static_funcs_list[k].found;
|
||||
count += g_static_funcs_list[k]->found;
|
||||
}
|
||||
}
|
||||
if (count == 0)
|
||||
{
|
||||
res |= GSR_MISSING;
|
||||
ConLog.Error("Function '%s' not found", g_static_funcs_list[j].name);
|
||||
ConLog.Error("Function '%s' not found", g_static_funcs_list[j]->name);
|
||||
}
|
||||
else if (count > 1)
|
||||
{
|
||||
@ -137,14 +137,14 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
||||
else if (count == 1) // found
|
||||
{
|
||||
// ensure that this function has NOT been found with different pattern
|
||||
for (u32 k = 0; k < g_static_funcs_list.GetCount(); k++) if (g_static_funcs_list[k].group == group)
|
||||
for (u32 k = 0; k < g_static_funcs_list.size(); k++) if (g_static_funcs_list[k]->group == group)
|
||||
{
|
||||
if (k != j && g_static_funcs_list[k].ptr == g_static_funcs_list[j].ptr)
|
||||
if (k != j && g_static_funcs_list[k]->ptr == g_static_funcs_list[j]->ptr)
|
||||
{
|
||||
if (g_static_funcs_list[k].found)
|
||||
if (g_static_funcs_list[k]->found)
|
||||
{
|
||||
res |= GSR_EXCESS;
|
||||
ConLog.Error("Function '%s' hooked twice", g_static_funcs_list[j].name);
|
||||
ConLog.Error("Function '%s' hooked twice", g_static_funcs_list[j]->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -152,14 +152,14 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
||||
else
|
||||
{
|
||||
res |= GSR_EXCESS;
|
||||
ConLog.Error("Function '%s' hooked twice", g_static_funcs_list[j].name);
|
||||
ConLog.Error("Function '%s' hooked twice", g_static_funcs_list[j]->name);
|
||||
}
|
||||
}
|
||||
|
||||
// clear data
|
||||
for (u32 j = 0; j < g_static_funcs_list.GetCount(); j++)
|
||||
for (u32 j = 0; j < g_static_funcs_list.size(); j++)
|
||||
{
|
||||
if (g_static_funcs_list[j].group == group) g_static_funcs_list[j].found = 0;
|
||||
if (g_static_funcs_list[j]->group == group) g_static_funcs_list[j]->found = 0;
|
||||
}
|
||||
|
||||
char name[9] = "????????";
|
||||
@ -182,9 +182,9 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
||||
|
||||
void StaticExecute(u32 code)
|
||||
{
|
||||
if (code < g_static_funcs_list.GetCount())
|
||||
if (code < g_static_funcs_list.size())
|
||||
{
|
||||
(*g_static_funcs_list[code].func)();
|
||||
(*g_static_funcs_list[code]->func)();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -194,5 +194,5 @@ void StaticExecute(u32 code)
|
||||
|
||||
void StaticFinalize()
|
||||
{
|
||||
g_static_funcs_list.Clear();
|
||||
}
|
||||
g_static_funcs_list.clear();
|
||||
}
|
||||
|
@ -13,7 +13,9 @@ namespace detail{
|
||||
void default_syscall();
|
||||
static func_caller *null_func = bind_func(default_syscall);
|
||||
|
||||
static func_caller* sc_table[1024] =
|
||||
static const int kSyscallTableLength = 1024;
|
||||
|
||||
static func_caller* sc_table[kSyscallTableLength] =
|
||||
{
|
||||
null_func,
|
||||
bind_func(sys_process_getpid), //1 (0x001)
|
||||
@ -502,6 +504,24 @@ static func_caller* sc_table[1024] =
|
||||
null_func, null_func, null_func, bind_func(cellGcmCallback), //1024
|
||||
};
|
||||
|
||||
/** HACK: Used to delete func_caller objects that get allocated and stored in sc_table (above).
|
||||
* The destructor of this static object gets called when the program shuts down.
|
||||
*/
|
||||
struct SyscallTableCleaner_t
|
||||
{
|
||||
SyscallTableCleaner_t() {}
|
||||
~SyscallTableCleaner_t()
|
||||
{
|
||||
for (int i = 0; i < kSyscallTableLength; ++i)
|
||||
{
|
||||
if (sc_table[i] != null_func)
|
||||
delete sc_table[i];
|
||||
}
|
||||
|
||||
delete null_func;
|
||||
}
|
||||
} SyscallTableCleaner_t;
|
||||
|
||||
void default_syscall()
|
||||
{
|
||||
declCPU();
|
||||
|
@ -77,7 +77,7 @@ int sys_event_queue_destroy(u32 equeue_id, int mode)
|
||||
eq->sq.m_mutex.lock();
|
||||
eq->owner.lock(tid);
|
||||
// check if some threads are waiting for an event
|
||||
if (!mode && eq->sq.list.GetCount())
|
||||
if (!mode && eq->sq.list.size())
|
||||
{
|
||||
eq->owner.unlock(tid);
|
||||
eq->sq.m_mutex.unlock();
|
||||
@ -85,7 +85,7 @@ int sys_event_queue_destroy(u32 equeue_id, int mode)
|
||||
}
|
||||
eq->owner.unlock(tid, ~0);
|
||||
eq->sq.m_mutex.unlock();
|
||||
while (eq->sq.list.GetCount())
|
||||
while (eq->sq.list.size())
|
||||
{
|
||||
Sleep(1);
|
||||
if (Emu.IsStopped())
|
||||
@ -138,7 +138,7 @@ int sys_event_queue_tryreceive(u32 equeue_id, mem_ptr_t<sys_event_data> event_ar
|
||||
|
||||
eq->sq.m_mutex.lock();
|
||||
eq->owner.lock(tid);
|
||||
if (eq->sq.list.GetCount())
|
||||
if (eq->sq.list.size())
|
||||
{
|
||||
number = 0;
|
||||
eq->owner.unlock(tid);
|
||||
|
@ -50,7 +50,7 @@ int sys_event_flag_destroy(u32 eflag_id)
|
||||
EventFlag* ef;
|
||||
if(!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
if (ef->waiters.GetCount()) // ???
|
||||
if (ef->waiters.size()) // ???
|
||||
{
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
@ -89,7 +89,7 @@ int sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64
|
||||
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
if (ef->m_type == SYS_SYNC_WAITER_SINGLE && ef->waiters.GetCount() > 0)
|
||||
if (ef->m_type == SYS_SYNC_WAITER_SINGLE && ef->waiters.size() > 0)
|
||||
{
|
||||
return CELL_EPERM;
|
||||
}
|
||||
@ -97,13 +97,13 @@ int sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64
|
||||
rec.bitptn = bitptn;
|
||||
rec.mode = mode;
|
||||
rec.tid = tid;
|
||||
ef->waiters.AddCpy(rec);
|
||||
ef->waiters.push_back(rec);
|
||||
|
||||
if (ef->check() == tid)
|
||||
{
|
||||
u64 flags = ef->flags;
|
||||
|
||||
ef->waiters.RemoveAt(ef->waiters.GetCount() - 1);
|
||||
ef->waiters.erase(ef->waiters.end() - 1);
|
||||
|
||||
if (mode & SYS_EVENT_FLAG_WAIT_CLEAR)
|
||||
{
|
||||
@ -141,11 +141,11 @@ int sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64
|
||||
|
||||
u64 flags = ef->flags;
|
||||
|
||||
for (u32 i = 0; i < ef->waiters.GetCount(); i++)
|
||||
for (u32 i = 0; i < ef->waiters.size(); i++)
|
||||
{
|
||||
if (ef->waiters[i].tid == tid)
|
||||
{
|
||||
ef->waiters.RemoveAt(i);
|
||||
ef->waiters.erase(ef->waiters.begin() +i);
|
||||
|
||||
if (mode & SYS_EVENT_FLAG_WAIT_CLEAR)
|
||||
{
|
||||
@ -179,11 +179,11 @@ int sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
|
||||
for (u32 i = 0; i < ef->waiters.GetCount(); i++)
|
||||
for (u32 i = 0; i < ef->waiters.size(); i++)
|
||||
{
|
||||
if (ef->waiters[i].tid == tid)
|
||||
{
|
||||
ef->waiters.RemoveAt(i);
|
||||
ef->waiters.erase(ef->waiters.begin() + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -300,19 +300,19 @@ int sys_event_flag_cancel(u32 eflag_id, mem32_t num)
|
||||
EventFlag* ef;
|
||||
if(!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
Array<u32> tids;
|
||||
std::vector<u32> tids;
|
||||
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
tids.SetCount(ef->waiters.GetCount());
|
||||
for (u32 i = 0; i < ef->waiters.GetCount(); i++)
|
||||
tids.resize(ef->waiters.size());
|
||||
for (u32 i = 0; i < ef->waiters.size(); i++)
|
||||
{
|
||||
tids[i] = ef->waiters[i].tid;
|
||||
}
|
||||
ef->waiters.Clear();
|
||||
ef->waiters.clear();
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < tids.GetCount(); i++)
|
||||
for (u32 i = 0; i < tids.size(); i++)
|
||||
{
|
||||
if (Emu.IsStopped()) break;
|
||||
ef->signal.lock(tids[i]);
|
||||
@ -326,7 +326,7 @@ int sys_event_flag_cancel(u32 eflag_id, mem32_t num)
|
||||
|
||||
if (num.IsGood())
|
||||
{
|
||||
num = tids.GetCount();
|
||||
num = tids.size();
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -352,4 +352,4 @@ int sys_event_flag_get(u32 eflag_id, mem64_t flags)
|
||||
flags = ef->flags; // ???
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ struct EventFlag
|
||||
{
|
||||
SMutex m_mutex;
|
||||
u64 flags;
|
||||
Array<EventFlagWaiter> waiters;
|
||||
std::vector<EventFlagWaiter> waiters;
|
||||
SMutex signal;
|
||||
const u32 m_protocol;
|
||||
const int m_type;
|
||||
@ -51,7 +51,7 @@ struct EventFlag
|
||||
|
||||
u32 target = 0;
|
||||
|
||||
for (u32 i = 0; i < waiters.GetCount(); i++)
|
||||
for (u32 i = 0; i < waiters.size(); i++)
|
||||
{
|
||||
if (((waiters[i].mode & SYS_EVENT_FLAG_WAIT_AND) && (flags & waiters[i].bitptn) == waiters[i].bitptn) ||
|
||||
((waiters[i].mode & SYS_EVENT_FLAG_WAIT_OR) && (flags & waiters[i].bitptn)))
|
||||
@ -61,7 +61,7 @@ struct EventFlag
|
||||
target = waiters[i].tid;
|
||||
break;
|
||||
}
|
||||
sq.list.AddCpy(waiters[i].tid);
|
||||
sq.list.push_back(waiters[i].tid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,4 +72,4 @@ struct EventFlag
|
||||
|
||||
return target;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -94,7 +94,8 @@ int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size)
|
||||
{
|
||||
_oflags &= ~CELL_O_TRUNC;
|
||||
//truncate file before opening it as read/write
|
||||
Emu.GetVFS().OpenFile(ppath, vfsWrite);
|
||||
auto filePtr = Emu.GetVFS().OpenFile(ppath, vfsWrite);
|
||||
delete filePtr;
|
||||
}
|
||||
o_mode = vfsReadWrite;
|
||||
break;
|
||||
@ -110,6 +111,7 @@ int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size)
|
||||
|
||||
if(!stream || !stream->IsOpened())
|
||||
{
|
||||
delete stream;
|
||||
sys_fs.Error("\"%s\" not found! flags: 0x%08x", ppath.c_str(), flags);
|
||||
return CELL_ENOENT;
|
||||
}
|
||||
|
@ -228,11 +228,11 @@ int sys_lwcond_wait(mem_ptr_t<sys_lwcond_t> lwcond, u64 timeout)
|
||||
switch (mutex->lock(tid, 0))
|
||||
{
|
||||
case CELL_OK: break;
|
||||
case CELL_EDEADLK: sys_lwcond.Warning("sys_lwcond_wait(id=%d): associated mutex was locked",
|
||||
case static_cast<int>(CELL_EDEADLK): sys_lwcond.Warning("sys_lwcond_wait(id=%d): associated mutex was locked",
|
||||
(u32)lwcond->lwcond_queue); return CELL_OK;
|
||||
case CELL_ESRCH: sys_lwcond.Warning("sys_lwcond_wait(id=%d): associated mutex not found (%d)",
|
||||
case static_cast<int>(CELL_ESRCH): sys_lwcond.Warning("sys_lwcond_wait(id=%d): associated mutex not found (%d)",
|
||||
(u32)lwcond->lwcond_queue, (u32)mutex->sleep_queue); return CELL_ESRCH;
|
||||
case CELL_EINVAL: goto abort;
|
||||
case static_cast<int>(CELL_EINVAL): goto abort;
|
||||
}
|
||||
|
||||
mutex->recursive_count = 1;
|
||||
|
@ -100,7 +100,7 @@ int sys_lwmutex_unlock(mem_ptr_t<sys_lwmutex_t> lwmutex)
|
||||
void SleepQueue::push(u32 tid)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
list.AddCpy(tid);
|
||||
list.push_back(tid);
|
||||
}
|
||||
|
||||
u32 SleepQueue::pop() // SYS_SYNC_FIFO
|
||||
@ -109,10 +109,10 @@ u32 SleepQueue::pop() // SYS_SYNC_FIFO
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (list.GetCount())
|
||||
if (list.size())
|
||||
{
|
||||
u32 res = list[0];
|
||||
list.RemoveAt(0);
|
||||
list.erase(list.begin());
|
||||
if (res && Emu.GetIdManager().CheckID(res))
|
||||
// check thread
|
||||
{
|
||||
@ -129,11 +129,11 @@ u32 SleepQueue::pop_prio() // SYS_SYNC_PRIORITY
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (list.GetCount())
|
||||
if (list.size())
|
||||
{
|
||||
u32 highest_prio = ~0;
|
||||
u32 sel = 0;
|
||||
for (u32 i = 0; i < list.GetCount(); i++)
|
||||
for (u32 i = 0; i < list.size(); i++)
|
||||
{
|
||||
CPUThread* t = Emu.GetCPU().GetThread(list[i]);
|
||||
if (!t)
|
||||
@ -150,7 +150,7 @@ u32 SleepQueue::pop_prio() // SYS_SYNC_PRIORITY
|
||||
}
|
||||
}
|
||||
u32 res = list[sel];
|
||||
list.RemoveAt(sel);
|
||||
list.erase(list.begin() + sel);
|
||||
/* if (Emu.GetIdManager().CheckID(res)) */
|
||||
if (res)
|
||||
// check thread
|
||||
@ -173,11 +173,11 @@ bool SleepQueue::invalidate(u32 tid)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
if (tid) for (u32 i = 0; i < list.GetCount(); i++)
|
||||
if (tid) for (u32 i = 0; i < list.size(); i++)
|
||||
{
|
||||
if (list[i] == tid)
|
||||
{
|
||||
list.RemoveAt(i);
|
||||
list.erase(list.begin() + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -189,7 +189,7 @@ bool SleepQueue::finalize()
|
||||
{
|
||||
if (!m_mutex.try_lock()) return false;
|
||||
|
||||
for (u32 i = 0; i < list.GetCount(); i++)
|
||||
for (u32 i = 0; i < list.size(); i++)
|
||||
{
|
||||
if (list[i])
|
||||
{
|
||||
@ -299,7 +299,7 @@ int sys_lwmutex_t::lock(be_t<u32> tid, u64 timeout)
|
||||
{
|
||||
switch (int res = trylock(tid))
|
||||
{
|
||||
case CELL_EBUSY: break;
|
||||
case static_cast<int>(CELL_EBUSY): break;
|
||||
default: return res;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ struct SleepQueue
|
||||
u64 prio;
|
||||
q_rec(u32 tid, u64 prio): tid(tid), prio(prio) {}
|
||||
}; */
|
||||
Array<u32> list;
|
||||
std::vector<u32> list;
|
||||
std::mutex m_mutex;
|
||||
u64 m_name;
|
||||
|
||||
|
@ -44,11 +44,11 @@ struct Mutex
|
||||
|
||||
if (!m_queue.m_mutex.try_lock()) return;
|
||||
|
||||
for (u32 i = 0; i < m_queue.list.GetCount(); i++)
|
||||
for (u32 i = 0; i < m_queue.list.size(); i++)
|
||||
{
|
||||
if (u32 owner = m_queue.list[i]) ConLog.Write("Mutex(%d) was waited by thread %d", id, owner);
|
||||
}
|
||||
|
||||
m_queue.m_mutex.unlock();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -42,7 +42,7 @@ int sys_rwlock_destroy(u32 rw_lock_id)
|
||||
|
||||
std::lock_guard<std::mutex> lock(rw->m_lock);
|
||||
|
||||
if (rw->wlock_queue.GetCount() || rw->rlock_list.GetCount() || rw->wlock_thread) return CELL_EBUSY;
|
||||
if (rw->wlock_queue.size() || rw->rlock_list.size() || rw->wlock_thread) return CELL_EBUSY;
|
||||
|
||||
Emu.GetIdManager().RemoveID(rw_lock_id);
|
||||
|
||||
|
@ -20,8 +20,8 @@ struct RWLock
|
||||
{
|
||||
std::mutex m_lock; // internal lock
|
||||
u32 wlock_thread; // write lock owner
|
||||
Array<u32> wlock_queue; // write lock queue
|
||||
Array<u32> rlock_list; // read lock list
|
||||
std::vector<u32> wlock_queue; // write lock queue
|
||||
std::vector<u32> rlock_list; // read lock list
|
||||
u32 m_protocol; // TODO
|
||||
|
||||
union
|
||||
@ -41,9 +41,9 @@ struct RWLock
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_lock);
|
||||
|
||||
if (!wlock_thread && !wlock_queue.GetCount())
|
||||
if (!wlock_thread && !wlock_queue.size())
|
||||
{
|
||||
rlock_list.AddCpy(tid);
|
||||
rlock_list.push_back(tid);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -53,11 +53,11 @@ struct RWLock
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_lock);
|
||||
|
||||
for (u32 i = rlock_list.GetCount() - 1; ~i; i--)
|
||||
for (u32 i = rlock_list.size() - 1; ~i; i--)
|
||||
{
|
||||
if (rlock_list[i] == tid)
|
||||
{
|
||||
rlock_list.RemoveAt(i);
|
||||
rlock_list.erase(rlock_list.begin() + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -72,7 +72,7 @@ struct RWLock
|
||||
{
|
||||
return false; // deadlock
|
||||
}
|
||||
for (u32 i = rlock_list.GetCount() - 1; ~i; i--)
|
||||
for (u32 i = rlock_list.size() - 1; ~i; i--)
|
||||
{
|
||||
if (rlock_list[i] == tid)
|
||||
{
|
||||
@ -86,31 +86,31 @@ struct RWLock
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_lock);
|
||||
|
||||
if (wlock_thread || rlock_list.GetCount()) // already locked
|
||||
if (wlock_thread || rlock_list.size()) // already locked
|
||||
{
|
||||
if (!enqueue)
|
||||
{
|
||||
return false; // do not enqueue
|
||||
}
|
||||
for (u32 i = wlock_queue.GetCount() - 1; ~i; i--)
|
||||
for (u32 i = wlock_queue.size() - 1; ~i; i--)
|
||||
{
|
||||
if (wlock_queue[i] == tid)
|
||||
{
|
||||
return false; // already enqueued
|
||||
}
|
||||
}
|
||||
wlock_queue.AddCpy(tid); // enqueue new thread
|
||||
wlock_queue.push_back(tid); // enqueue new thread
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wlock_queue.GetCount())
|
||||
if (wlock_queue.size())
|
||||
{
|
||||
// SYNC_FIFO only yet
|
||||
if (wlock_queue[0] == tid)
|
||||
{
|
||||
wlock_thread = tid;
|
||||
wlock_queue.RemoveAt(0);
|
||||
wlock_queue.erase(wlock_queue.begin());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -119,14 +119,14 @@ struct RWLock
|
||||
{
|
||||
return false; // do not enqueue
|
||||
}
|
||||
for (u32 i = wlock_queue.GetCount() - 1; ~i; i--)
|
||||
for (u32 i = wlock_queue.size() - 1; ~i; i--)
|
||||
{
|
||||
if (wlock_queue[i] == tid)
|
||||
{
|
||||
return false; // already enqueued
|
||||
}
|
||||
}
|
||||
wlock_queue.AddCpy(tid); // enqueue new thread
|
||||
wlock_queue.push_back(tid); // enqueue new thread
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -149,4 +149,4 @@ struct RWLock
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -91,7 +91,7 @@ int sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t<
|
||||
}
|
||||
}
|
||||
|
||||
if(spu_num >= group_info->list.GetCount())
|
||||
if(spu_num >= group_info->list.size())
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
@ -204,7 +204,7 @@ int sys_spu_thread_group_destroy(u32 id)
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < group_info->list.GetCount(); i++)
|
||||
for (u32 i = 0; i < group_info->list.size(); i++)
|
||||
{
|
||||
// TODO: disconnect all event ports
|
||||
|
||||
@ -228,7 +228,7 @@ int sys_spu_thread_group_start(u32 id)
|
||||
|
||||
// TODO: check group state
|
||||
|
||||
for (u32 i = 0; i < group_info->list.GetCount(); i++)
|
||||
for (u32 i = 0; i < group_info->list.size(); i++)
|
||||
{
|
||||
CPUThread* t;
|
||||
if (t = Emu.GetCPU().GetThread(group_info->list[i]))
|
||||
@ -253,7 +253,7 @@ int sys_spu_thread_group_suspend(u32 id)
|
||||
|
||||
// TODO: check group state
|
||||
|
||||
for (u32 i = 0; i < group_info->list.GetCount(); i++)
|
||||
for (u32 i = 0; i < group_info->list.size(); i++)
|
||||
{
|
||||
if (CPUThread* t = Emu.GetCPU().GetThread(group_info->list[i]))
|
||||
{
|
||||
@ -277,7 +277,7 @@ int sys_spu_thread_group_resume(u32 id)
|
||||
|
||||
// TODO: check group state
|
||||
|
||||
for (u32 i = 0; i < group_info->list.GetCount(); i++)
|
||||
for (u32 i = 0; i < group_info->list.size(); i++)
|
||||
{
|
||||
if (CPUThread* t = Emu.GetCPU().GetThread(group_info->list[i]))
|
||||
{
|
||||
@ -331,7 +331,7 @@ int sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status)
|
||||
cause = SYS_SPU_THREAD_GROUP_JOIN_ALL_THREADS_EXIT;
|
||||
status = 0; //unspecified because of ALL_THREADS_EXIT
|
||||
|
||||
for (u32 i = 0; i < group_info->list.GetCount(); i++)
|
||||
for (u32 i = 0; i < group_info->list.size(); i++)
|
||||
{
|
||||
while (CPUThread* t = Emu.GetCPU().GetThread(group_info->list[i]))
|
||||
{
|
||||
@ -725,7 +725,7 @@ int sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq, u64 req, u32
|
||||
}
|
||||
|
||||
/*
|
||||
for(u32 i=0; i<group->list.GetCount(); ++i)
|
||||
for(u32 i=0; i<group->list.size(); ++i)
|
||||
{
|
||||
CPUThread* t;
|
||||
if(t = Emu.GetCPU().GetThread(group->list[i]))
|
||||
@ -754,4 +754,4 @@ int sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup)
|
||||
sc_spu.Error("sys_spu_thread_group_disconnect_event_all_threads(id=%d, spup=%d)", id, spup);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ struct sys_spu_segment
|
||||
|
||||
struct SpuGroupInfo
|
||||
{
|
||||
Array<u32> list;
|
||||
std::vector<u32> list;
|
||||
std::atomic<u32> lock;
|
||||
std::string m_name;
|
||||
int m_prio;
|
||||
@ -73,10 +73,10 @@ struct SpuGroupInfo
|
||||
, lock(0)
|
||||
{
|
||||
num = 256;
|
||||
list.SetCount(num);
|
||||
list.resize(num);
|
||||
for (u32 i = 0; i < num; i++)
|
||||
{
|
||||
list[i] = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -17,7 +17,7 @@ static const u16 bpdb_version = 0x1000;
|
||||
|
||||
ModuleInitializer::ModuleInitializer()
|
||||
{
|
||||
Emu.AddModuleInit(this);
|
||||
Emu.AddModuleInit(std::move(std::unique_ptr<ModuleInitializer>(this)));
|
||||
}
|
||||
|
||||
Emulator::Emulator()
|
||||
@ -32,10 +32,10 @@ Emulator::Emulator()
|
||||
|
||||
void Emulator::Init()
|
||||
{
|
||||
while(m_modules_init.GetCount())
|
||||
while(m_modules_init.size())
|
||||
{
|
||||
m_modules_init[0].Init();
|
||||
m_modules_init.RemoveAt(0);
|
||||
m_modules_init[0]->Init();
|
||||
m_modules_init.erase(m_modules_init.begin());
|
||||
}
|
||||
//if(m_memory_viewer) m_memory_viewer->Close();
|
||||
//m_memory_viewer = new MemoryViewerPanel(wxGetApp().m_MainFrame);
|
||||
@ -54,17 +54,17 @@ void Emulator::SetTitleID(const std::string& id)
|
||||
|
||||
void Emulator::CheckStatus()
|
||||
{
|
||||
ArrayF<CPUThread>& threads = GetCPU().GetThreads();
|
||||
if(!threads.GetCount())
|
||||
std::vector<CPUThread *>& threads = GetCPU().GetThreads();
|
||||
if(!threads.size())
|
||||
{
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
bool IsAllPaused = true;
|
||||
for(u32 i=0; i<threads.GetCount(); ++i)
|
||||
for(u32 i=0; i<threads.size(); ++i)
|
||||
{
|
||||
if(threads[i].IsPaused()) continue;
|
||||
if(threads[i]->IsPaused()) continue;
|
||||
IsAllPaused = false;
|
||||
break;
|
||||
}
|
||||
@ -76,9 +76,9 @@ void Emulator::CheckStatus()
|
||||
}
|
||||
|
||||
bool IsAllStoped = true;
|
||||
for(u32 i=0; i<threads.GetCount(); ++i)
|
||||
for(u32 i=0; i<threads.size(); ++i)
|
||||
{
|
||||
if(threads[i].IsStopped()) continue;
|
||||
if(threads[i]->IsStopped()) continue;
|
||||
IsAllStoped = false;
|
||||
break;
|
||||
}
|
||||
@ -147,9 +147,9 @@ void Emulator::Load()
|
||||
|
||||
ConLog.SkipLn();
|
||||
ConLog.Write("Mount info:");
|
||||
for(uint i=0; i<m_vfs.m_devices.GetCount(); ++i)
|
||||
for(uint i=0; i<m_vfs.m_devices.size(); ++i)
|
||||
{
|
||||
ConLog.Write("%s -> %s", m_vfs.m_devices[i].GetPs3Path().c_str(), m_vfs.m_devices[i].GetLocalPath().c_str());
|
||||
ConLog.Write("%s -> %s", m_vfs.m_devices[i]->GetPs3Path().c_str(), m_vfs.m_devices[i]->GetLocalPath().c_str());
|
||||
}
|
||||
ConLog.SkipLn();
|
||||
|
||||
@ -377,8 +377,8 @@ void Emulator::Stop()
|
||||
m_rsx_callback = 0;
|
||||
|
||||
SavePoints(BreakPointsDBName);
|
||||
m_break_points.Clear();
|
||||
m_marked_points.Clear();
|
||||
m_break_points.clear();
|
||||
m_marked_points.clear();
|
||||
|
||||
m_vfs.UnMountAll();
|
||||
|
||||
@ -407,8 +407,8 @@ void Emulator::SavePoints(const std::string& path)
|
||||
{
|
||||
std::ofstream f(path, std::ios::binary | std::ios::trunc);
|
||||
|
||||
u32 break_count = m_break_points.GetCount();
|
||||
u32 marked_count = m_marked_points.GetCount();
|
||||
u32 break_count = m_break_points.size();
|
||||
u32 marked_count = m_marked_points.size();
|
||||
|
||||
f << bpdb_version << break_count << marked_count;
|
||||
|
||||
@ -447,13 +447,13 @@ void Emulator::LoadPoints(const std::string& path)
|
||||
|
||||
if(break_count > 0)
|
||||
{
|
||||
m_break_points.SetCount(break_count);
|
||||
m_break_points.resize(break_count);
|
||||
f.read(reinterpret_cast<char*>(&m_break_points[0]), sizeof(u64) * break_count);
|
||||
}
|
||||
|
||||
if(marked_count > 0)
|
||||
{
|
||||
m_marked_points.SetCount(marked_count);
|
||||
m_marked_points.resize(marked_count);
|
||||
f.read(reinterpret_cast<char*>(&m_marked_points[0]), sizeof(u64) * marked_count);
|
||||
}
|
||||
}
|
||||
|
@ -76,10 +76,10 @@ class Emulator
|
||||
u32 m_ppu_thr_exit;
|
||||
MemoryViewerPanel* m_memory_viewer;
|
||||
//ArrayF<CPUThread> m_cpu_threads;
|
||||
ArrayF<ModuleInitializer> m_modules_init;
|
||||
std::vector<std::unique_ptr<ModuleInitializer>> m_modules_init;
|
||||
|
||||
Array<u64> m_break_points;
|
||||
Array<u64> m_marked_points;
|
||||
std::vector<u64> m_break_points;
|
||||
std::vector<u64> m_marked_points;
|
||||
|
||||
CPUThreadManager m_thread_manager;
|
||||
PadManager m_pad_manager;
|
||||
@ -118,14 +118,14 @@ public:
|
||||
AudioManager& GetAudioManager() { return m_audio_manager; }
|
||||
CallbackManager& GetCallbackManager() { return m_callback_manager; }
|
||||
VFS& GetVFS() { return m_vfs; }
|
||||
Array<u64>& GetBreakPoints() { return m_break_points; }
|
||||
Array<u64>& GetMarkedPoints() { return m_marked_points; }
|
||||
std::vector<u64>& GetBreakPoints() { return m_break_points; }
|
||||
std::vector<u64>& GetMarkedPoints() { return m_marked_points; }
|
||||
CPUThread& GetCallbackThread() { return *m_ppu_callback_thr; }
|
||||
EventManager& GetEventManager() { return *m_event_manager; }
|
||||
|
||||
void AddModuleInit(ModuleInitializer* m)
|
||||
void AddModuleInit(std::unique_ptr<ModuleInitializer> m)
|
||||
{
|
||||
m_modules_init.Add(m);
|
||||
m_modules_init.push_back(std::move(m));
|
||||
}
|
||||
|
||||
void SetTLSData(const u64 addr, const u64 filesz, const u64 memsz)
|
||||
@ -162,4 +162,4 @@ public:
|
||||
__forceinline bool IsReady() const { return m_status == Ready; }
|
||||
};
|
||||
|
||||
extern Emulator Emu;
|
||||
extern Emulator Emu;
|
||||
|
@ -69,7 +69,7 @@ struct EventPort
|
||||
|
||||
class EventRingBuffer
|
||||
{
|
||||
Array<sys_event_data> data;
|
||||
std::vector<sys_event_data> data;
|
||||
SMutex m_lock;
|
||||
u32 buf_pos;
|
||||
u32 buf_count;
|
||||
@ -82,7 +82,7 @@ public:
|
||||
, buf_pos(0)
|
||||
, buf_count(0)
|
||||
{
|
||||
data.SetCount(size);
|
||||
data.resize(size);
|
||||
}
|
||||
|
||||
void clear()
|
||||
@ -151,7 +151,7 @@ public:
|
||||
|
||||
class EventPortList
|
||||
{
|
||||
Array<EventPort*> data;
|
||||
std::vector<EventPort*> data;
|
||||
SMutex m_lock;
|
||||
|
||||
public:
|
||||
@ -159,28 +159,28 @@ public:
|
||||
void clear()
|
||||
{
|
||||
SMutexLocker lock(m_lock);
|
||||
for (u32 i = 0; i < data.GetCount(); i++)
|
||||
for (u32 i = 0; i < data.size(); i++)
|
||||
{
|
||||
SMutexLocker lock2(data[i]->mutex);
|
||||
data[i]->eq = nullptr; // force all ports to disconnect
|
||||
}
|
||||
data.Clear();
|
||||
data.clear();
|
||||
}
|
||||
|
||||
void add(EventPort* port)
|
||||
{
|
||||
SMutexLocker lock(m_lock);
|
||||
data.AddCpy(port);
|
||||
data.push_back(port);
|
||||
}
|
||||
|
||||
void remove(EventPort* port)
|
||||
{
|
||||
SMutexLocker lock(m_lock);
|
||||
for (u32 i = 0; i < data.GetCount(); i++)
|
||||
for (u32 i = 0; i < data.size(); i++)
|
||||
{
|
||||
if (data[i] == port)
|
||||
{
|
||||
data.RemoveAt(i);
|
||||
data.erase(data.begin() + i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -226,4 +226,4 @@ public:
|
||||
bool GetEventQueue(u64 key, EventQueue*& data);
|
||||
bool UnregisterKey(u64 key);
|
||||
bool SendEvent(u64 key, u64 source, u64 d1, u64 d2, u64 d3);
|
||||
};
|
||||
};
|
||||
|
@ -46,7 +46,7 @@ struct _LogBuffer : public MTPacketBuffer<LogPacket>
|
||||
const u32 stext = data.m_text.length();
|
||||
const u32 scolour = data.m_colour.length();
|
||||
|
||||
m_buffer.Reserve(
|
||||
m_buffer.resize( m_buffer.size() +
|
||||
sizeof(u32) + sprefix +
|
||||
sizeof(u32) + stext +
|
||||
sizeof(u32) + scolour);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user