Merge git://github.com/DHrpcs3/rpcs3

This commit is contained in:
boxingcow 2014-07-18 19:13:27 +01:00
commit c7e4c90cb5
37 changed files with 440 additions and 508 deletions

2
.gitignore vendored
View File

@ -61,7 +61,7 @@ rpcs3/git-version.h
!/bin/dev_hdd0/game/TEST12345/
# Ignore other system generated files
bin/dev_hdd0/log.txt
bin/dev_hdd0/*.txt
x64/Debug/emucore.lib
x64/Release/emucore.lib

View File

@ -63,24 +63,6 @@ class be_t
public:
typedef T type;
#ifdef _WIN32
be_t(){}
#else
be_t() noexcept = default;
#endif
be_t(const be_t<T,size>& value) = default;
be_t(const T& value)
{
FromLE(value);
}
template<typename T1>
explicit be_t(const be_t<T1>& value)
{
FromBE(value.ToBE());
}
const T& ToBE() const
{
@ -130,7 +112,18 @@ public:
operator const be_t<T1>() const
{
be_t<T1> res;
res.FromBE(ToBE());
if (sizeof(T1) < sizeof(T))
{
res.FromBE(ToBE() >> ((sizeof(T)-sizeof(T1)) * 8));
}
else if (sizeof(T1) > sizeof(T))
{
res.FromLE(ToLE());
}
else
{
res.FromBE(ToBE());
}
return res;
}

View File

@ -36,5 +36,5 @@ __forceinline u32 SM_GetCurrentCPUThreadId()
__forceinline be_t<u32> SM_GetCurrentCPUThreadIdBE()
{
return SM_GetCurrentCPUThreadId();
return be_t<u32>::MakeFromLE(SM_GetCurrentCPUThreadId());
}

View File

@ -22,8 +22,8 @@ enum SMutexResult
template
<
typename T,
u64 free_value = 0,
u64 dead_value = 0xffffffff,
const u64 free_value = 0,
const u64 dead_value = 0xffffffffffffffffull,
void (*wait)() = SM_Sleep
>
class SMutexBase
@ -32,20 +32,31 @@ class SMutexBase
std::atomic<T> owner;
public:
SMutexBase()
: owner((T)free_value)
static const T GetFreeValue()
{
static const u64 value = free_value;
return (const T&)value;
}
static const T GetDeadValue()
{
static const u64 value = dead_value;
return (const T&)value;
}
void initialize()
{
(T&)owner = free_value;
owner = GetFreeValue();
}
~SMutexBase()
SMutexBase()
{
lock((T)dead_value);
owner = (T)dead_value;
initialize();
}
void finalize()
{
owner = GetDeadValue();
}
__forceinline T GetOwner() const
@ -53,23 +64,13 @@ public:
return (T&)owner;
}
__forceinline T GetFreeValue() const
{
return (T)free_value;
}
__forceinline T GetDeadValue() const
{
return (T)dead_value;
}
SMutexResult trylock(T tid)
{
if (Emu.IsStopped())
{
return SMR_ABORT;
}
T old = (T)free_value;
T old = GetFreeValue();
if (!owner.compare_exchange_strong(old, tid))
{
@ -77,7 +78,7 @@ public:
{
return SMR_DEADLOCK;
}
if (old == (T)dead_value)
if (old == GetDeadValue())
{
return SMR_DESTROYED;
}
@ -87,7 +88,7 @@ public:
return SMR_OK;
}
SMutexResult unlock(T tid, T to = (T)free_value)
SMutexResult unlock(T tid, T to = GetFreeValue())
{
if (Emu.IsStopped())
{
@ -97,11 +98,11 @@ public:
if (!owner.compare_exchange_strong(old, to))
{
if (old == (T)free_value)
if (old == GetFreeValue())
{
return SMR_FAILED;
}
if (old == (T)dead_value)
if (old == GetDeadValue())
{
return SMR_DESTROYED;
}

View File

@ -113,8 +113,9 @@ int Decrypt(rFile& pkg_f, rFile& dec_pkg_f, PKGHeader* m_header)
{
aes_crypt_ecb(&c, AES_ENCRYPT, iv, ctr+j*HASH_LEN);
be_t<u64> hi = *(be_t<u64>*)&iv[0];
be_t<u64> lo = *(be_t<u64>*)&iv[8] + 1;
be_t<u64> hi = be_t<u64>::MakeFromBE(*(u64*)&iv[0]);
be_t<u64> lo = be_t<u64>::MakeFromBE(*(u64*)&iv[8]);
lo++;
if (lo == 0)
hi += 1;

View File

@ -11,7 +11,6 @@
#include "Emu/ARMv7/ARMv7Thread.h"
CPUThreadManager::CPUThreadManager()
: m_raw_spu_num(0)
{
}
@ -22,7 +21,6 @@ CPUThreadManager::~CPUThreadManager()
void CPUThreadManager::Close()
{
m_raw_spu_num = 0;
while(m_threads.size()) RemoveThread(m_threads[0]->GetId());
}
@ -34,10 +32,26 @@ CPUThread& CPUThreadManager::AddThread(CPUThreadType type)
switch(type)
{
case CPU_THREAD_PPU: new_thread = new PPUThread(); break;
case CPU_THREAD_SPU: new_thread = new SPUThread(); break;
case CPU_THREAD_RAW_SPU: new_thread = new RawSPUThread(m_raw_spu_num++); break;
case CPU_THREAD_ARMv7: new_thread = new ARMv7Thread(); break;
case CPU_THREAD_PPU:
{
new_thread = new PPUThread();
break;
}
case CPU_THREAD_SPU:
{
new_thread = new SPUThread();
break;
}
case CPU_THREAD_RAW_SPU:
{
new_thread = new RawSPUThread();
break;
}
case CPU_THREAD_ARMv7:
{
new_thread = new ARMv7Thread();
break;
}
default: assert(0);
}

View File

@ -7,7 +7,6 @@ class CPUThreadManager
{
std::vector<CPUThread*> m_threads;
std::mutex m_mtx_thread;
u32 m_raw_spu_num;
public:
CPUThreadManager();

View File

@ -7,12 +7,11 @@
#include "Emu/Cell/RawSPUThread.h"
RawSPUThread::RawSPUThread(u32 index, CPUThreadType type)
RawSPUThread::RawSPUThread(CPUThreadType type)
: SPUThread(type)
, MemoryBlock()
, m_index(index)
{
Memory.InitRawSPU(SetRange(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * index, RAW_SPU_PROB_OFFSET), m_index);
m_index = Memory.InitRawSPU(this);
Reset();
}
@ -23,75 +22,20 @@ RawSPUThread::~RawSPUThread()
bool RawSPUThread::Read32(const u64 addr, u32* value)
{
if(addr < GetStartAddr() + RAW_SPU_PROB_OFFSET)
{
return MemoryBlock::Read32(addr, value);
}
const u64 offset = addr - GetStartAddr() - RAW_SPU_PROB_OFFSET;
const u32 offset = addr - GetStartAddr() - RAW_SPU_PROB_OFFSET;
switch(offset)
switch (offset)
{
case MFC_LSA_offs:
{
LOG_ERROR(Log::SPU, "RawSPUThread[%d]: Read32(MFC_LSA)", m_index);
*value = MFC2.LSA.GetValue();
break;
}
case MFC_EAH_offs:
{
LOG_ERROR(Log::SPU, "RawSPUThread[%d]: Read32(MFC_EAH)", m_index);
*value = MFC2.EAH.GetValue();
break;
}
case MFC_EAL_offs:
{
LOG_ERROR(Log::SPU, "RawSPUThread[%d]: Read32(MFC_EAL)", m_index);
*value = MFC2.EAL.GetValue();
break;
}
case MFC_Size_Tag_offs:
{
LOG_ERROR(Log::SPU, "RawSPUThread[%d]: Read32(MFC_Size_Tag)", m_index);
*value = MFC2.Size_Tag.GetValue();
break;
}
case MFC_CMDStatus_offs:
{
LOG_ERROR(Log::SPU, "RawSPUThread[%d]: Read32(MFC_CMDStatus)", m_index);
*value = MFC2.CMDStatus.GetValue();
break;
}
case MFC_QStatus_offs:
{
LOG_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(MFC_QStatus)", m_index);
*value = MFC2.QStatus.GetValue();
break;
}
case Prxy_QueryType_offs:
{
LOG_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(Prxy_QueryType)", m_index);
*value = Prxy.QueryType.GetValue();
break;
}
case Prxy_QueryMask_offs:
{
LOG_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(Prxy_QueryMask)", m_index);
*value = Prxy.QueryMask.GetValue();
break;
}
case Prxy_TagStatus_offs:
{
LOG_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(Prxy_TagStatus)", m_index);
*value = Prxy.TagStatus.GetValue();
// TagStatus is not used: mask is written directly
*value = MFC2.QueryMask.GetValue();
break;
}
@ -101,62 +45,23 @@ bool RawSPUThread::Read32(const u64 addr, u32* value)
SPU.Out_MBox.PopUncond(*value);
break;
}
case SPU_In_MBox_offs:
{
LOG_ERROR(Log::SPU, "RawSPUThread[%d]: Read32(SPU_In_MBox)", m_index);
while (!SPU.In_MBox.Pop(*value) && !Emu.IsStopped())
std::this_thread::sleep_for(std::chrono::milliseconds(1));
break;
}
case SPU_MBox_Status_offs:
{
//LOG_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(SPU_MBox_Status)", m_index);
//SPU.MBox_Status.SetValue(SPU.Out_MBox.GetCount() ? SPU.MBox_Status.GetValue() | 1 : SPU.MBox_Status.GetValue() & ~1);
SPU.MBox_Status.SetValue((SPU.Out_MBox.GetCount() & 0xff) | (SPU.In_MBox.GetFreeCount() << 8));
*value = SPU.MBox_Status.GetValue();
*value = (SPU.Out_MBox.GetCount() & 0xff) | (SPU.In_MBox.GetFreeCount() << 8);
break;
}
case SPU_RunCntl_offs:
{
LOG_ERROR(Log::SPU, "RawSPUThread[%d]: Read32(SPU_RunCntl)", m_index);
*value = (u32)IsRunning();
break;
}
case SPU_Status_offs:
{
*value = SPU.Status.GetValue();
break;
}
case SPU_NPC_offs:
{
LOG_ERROR(Log::SPU, "RawSPUThread[%d]: Read32(SPU_NPC)", m_index);
*value = SPU.NPC.GetValue();
break;
}
case SPU_RdSigNotify1_offs:
{
LOG_ERROR(Log::SPU, "RawSPUThread[%d]: Read32(SPU_RdSigNotify1)", m_index);
*value = SPU.SNR[0].GetValue();
break;
}
case SPU_RdSigNotify2_offs:
{
LOG_ERROR(Log::SPU, "RawSPUThread[%d]: Read32(SPU_RdSigNotify2)", m_index);
*value = SPU.SNR[1].GetValue();
break;
}
default:
{
LOG_ERROR(Log::SPU, "RawSPUThread[%d]: Read32(0x%x)", m_index, offset);
Emu.Pause();
// TODO: read value from LS if necessary (not important)
LOG_ERROR(Log::SPU, "RawSPUThread[%d]: Read32(0x%llx)", m_index, offset);
return false;
}
}
@ -166,14 +71,9 @@ bool RawSPUThread::Read32(const u64 addr, u32* value)
bool RawSPUThread::Write32(const u64 addr, const u32 value)
{
if(addr < GetStartAddr() + RAW_SPU_PROB_OFFSET)
{
return MemoryBlock::Write32(addr, value);
}
const u64 offset = addr - GetStartAddr() - RAW_SPU_PROB_OFFSET;
const u32 offset = addr - GetStartAddr() - RAW_SPU_PROB_OFFSET;
switch(offset)
switch (offset)
{
case MFC_LSA_offs:
{
@ -206,53 +106,26 @@ bool RawSPUThread::Write32(const u64 addr, const u32 value)
break;
}
case MFC_QStatus_offs:
{
LOG_ERROR(Log::SPU, "RawSPUThread[%d]: Write32(MFC_QStatus, 0x%x)", m_index, value);
//MFC2.QStatus.SetValue(value);
break;
}
case Prxy_QueryType_offs:
{
LOG_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(Prxy_QueryType, 0x%x)", m_index, value);
Prxy.QueryType.SetValue(value);
switch(value)
{
case 2:
LOG_WARNING(Log::SPU, "RawSPUThread[%d]: Prxy Query Immediate.", m_index);
break;
case 2: break;
default:
{
LOG_ERROR(Log::SPU, "RawSPUThread[%d]: Unknown Prxy Query Type. (prxy_query=0x%x)", m_index, value);
break;
return false;
}
}
Prxy.QueryType.SetValue(0);
MFC2.QStatus.SetValue(Prxy.QueryMask.GetValue());
MFC2.QueryType.SetValue(value); // not used
break;
}
case Prxy_QueryMask_offs:
{
LOG_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(Prxy_QueryMask, 0x%x)", m_index, value);
Prxy.QueryMask.SetValue(value);
break;
}
case Prxy_TagStatus_offs:
{
LOG_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(Prxy_TagStatus, 0x%x)", m_index, value);
Prxy.TagStatus.SetValue(value);
break;
}
case SPU_Out_MBox_offs:
{
LOG_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(SPU_Out_MBox, 0x%x)", m_index, value);
while (!SPU.Out_MBox.Push(value) && !Emu.IsStopped())
std::this_thread::sleep_for(std::chrono::milliseconds(1));
MFC2.QueryMask.SetValue(value); // TagStatus is not used
break;
}
@ -262,13 +135,6 @@ bool RawSPUThread::Write32(const u64 addr, const u32 value)
SPU.In_MBox.PushUncond(value);
break;
}
case SPU_MBox_Status_offs:
{
LOG_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(SPU_MBox_Status, 0x%x)", m_index, value);
SPU.MBox_Status.SetValue(value);
break;
}
case SPU_RunCntl_offs:
{
@ -290,39 +156,29 @@ bool RawSPUThread::Write32(const u64 addr, const u32 value)
break;
}
case SPU_Status_offs:
{
LOG_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(SPU_Status, 0x%x)", m_index, value);
SPU.Status.SetValue(value);
break;
}
case SPU_NPC_offs:
{
LOG_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(SPU_NPC, 0x%x)", m_index, value);
SPU.NPC.SetValue(value);
break;
}
case SPU_RdSigNotify1_offs:
{
LOG_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(SPU_RdSigNotify1, 0x%x)", m_index, value);
SPU.SNR[0].SetValue(value);
WriteSNR(0, value);
break;
}
case SPU_RdSigNotify2_offs:
{
LOG_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(SPU_RdSigNotify2, 0x%x)", m_index, value);
SPU.SNR[1].SetValue(value);
WriteSNR(1, value);
break;
}
default:
{
LOG_ERROR(Log::SPU, "RawSPUThread[%d]: Write32(0x%x, 0x%x)", m_index, offset, value);
Emu.Pause();
break;
// TODO: write value to LS if necessary (not important)
LOG_ERROR(Log::SPU, "RawSPUThread[%d]: Write32(0x%llx, 0x%x)", m_index, offset, value);
return false;
}
}
@ -344,7 +200,7 @@ void RawSPUThread::Task()
{
PC = SPU.NPC.GetValue();
CPUThread::Task();
SPUThread::Task();
SPU.NPC.SetValue(PC);
}

View File

@ -19,7 +19,7 @@ class RawSPUThread
u32 m_index;
public:
RawSPUThread(u32 index, CPUThreadType type = CPU_THREAD_RAW_SPU);
RawSPUThread(CPUThreadType type = CPU_THREAD_RAW_SPU);
virtual ~RawSPUThread();
virtual bool Read32(const u64 addr, u32* value) override;

View File

@ -503,29 +503,50 @@ private:
void ROTQBI(u32 rt, u32 ra, u32 rb)
{
const int t = CPU.GPR[rb]._u32[3] & 0x7;
const SPU_GPR_hdr temp = CPU.GPR[ra];
CPU.GPR[rt]._u32[0] = (temp._u32[0] << t) | (temp._u32[3] >> (32 - t));
CPU.GPR[rt]._u32[1] = (temp._u32[1] << t) | (temp._u32[0] >> (32 - t));
CPU.GPR[rt]._u32[2] = (temp._u32[2] << t) | (temp._u32[1] >> (32 - t));
CPU.GPR[rt]._u32[3] = (temp._u32[3] << t) | (temp._u32[2] >> (32 - t));
if (t) // not an optimization, it fixes shifts
{
const SPU_GPR_hdr temp = CPU.GPR[ra];
CPU.GPR[rt]._u32[0] = (temp._u32[0] << t) | (temp._u32[3] >> (32 - t));
CPU.GPR[rt]._u32[1] = (temp._u32[1] << t) | (temp._u32[0] >> (32 - t));
CPU.GPR[rt]._u32[2] = (temp._u32[2] << t) | (temp._u32[1] >> (32 - t));
CPU.GPR[rt]._u32[3] = (temp._u32[3] << t) | (temp._u32[2] >> (32 - t));
}
else
{
CPU.GPR[rt] = CPU.GPR[ra];
}
}
void ROTQMBI(u32 rt, u32 ra, u32 rb)
{
const int t = (0 - CPU.GPR[rb]._u32[3]) & 0x7;
const SPU_GPR_hdr temp = CPU.GPR[ra];
CPU.GPR[rt]._u32[0] = (temp._u32[0] >> t) | (temp._u32[1] << (32 - t));
CPU.GPR[rt]._u32[1] = (temp._u32[1] >> t) | (temp._u32[2] << (32 - t));
CPU.GPR[rt]._u32[2] = (temp._u32[2] >> t) | (temp._u32[3] << (32 - t));
CPU.GPR[rt]._u32[3] = (temp._u32[3] >> t);
if (t) // not an optimization, it fixes shifts
{
const SPU_GPR_hdr temp = CPU.GPR[ra];
CPU.GPR[rt]._u32[0] = (temp._u32[0] >> t) | (temp._u32[1] << (32 - t));
CPU.GPR[rt]._u32[1] = (temp._u32[1] >> t) | (temp._u32[2] << (32 - t));
CPU.GPR[rt]._u32[2] = (temp._u32[2] >> t) | (temp._u32[3] << (32 - t));
CPU.GPR[rt]._u32[3] = (temp._u32[3] >> t);
}
else
{
CPU.GPR[rt] = CPU.GPR[ra];
}
}
void SHLQBI(u32 rt, u32 ra, u32 rb)
{
const int t = CPU.GPR[rb]._u32[3] & 0x7;
const SPU_GPR_hdr temp = CPU.GPR[ra];
CPU.GPR[rt]._u32[0] = (temp._u32[0] << t);
CPU.GPR[rt]._u32[1] = (temp._u32[1] << t) | (temp._u32[0] >> (32 - t));
CPU.GPR[rt]._u32[2] = (temp._u32[2] << t) | (temp._u32[1] >> (32 - t));
CPU.GPR[rt]._u32[3] = (temp._u32[3] << t) | (temp._u32[2] >> (32 - t));
if (t) // not an optimization, it fixes shifts
{
const SPU_GPR_hdr temp = CPU.GPR[ra];
CPU.GPR[rt]._u32[0] = (temp._u32[0] << t);
CPU.GPR[rt]._u32[1] = (temp._u32[1] << t) | (temp._u32[0] >> (32 - t));
CPU.GPR[rt]._u32[2] = (temp._u32[2] << t) | (temp._u32[1] >> (32 - t));
CPU.GPR[rt]._u32[3] = (temp._u32[3] << t) | (temp._u32[2] >> (32 - t));
}
else
{
CPU.GPR[rt] = CPU.GPR[ra];
}
}
void ROTQBY(u32 rt, u32 ra, u32 rb)
{
@ -591,29 +612,50 @@ private:
void ROTQBII(u32 rt, u32 ra, s32 i7)
{
const int s = i7 & 0x7;
const SPU_GPR_hdr temp = CPU.GPR[ra];
CPU.GPR[rt]._u32[0] = (temp._u32[0] << s) | (temp._u32[3] >> (32 - s));
CPU.GPR[rt]._u32[1] = (temp._u32[1] << s) | (temp._u32[0] >> (32 - s));
CPU.GPR[rt]._u32[2] = (temp._u32[2] << s) | (temp._u32[1] >> (32 - s));
CPU.GPR[rt]._u32[3] = (temp._u32[3] << s) | (temp._u32[2] >> (32 - s));
if (s) // not an optimization, it fixes shifts
{
const SPU_GPR_hdr temp = CPU.GPR[ra];
CPU.GPR[rt]._u32[0] = (temp._u32[0] << s) | (temp._u32[3] >> (32 - s));
CPU.GPR[rt]._u32[1] = (temp._u32[1] << s) | (temp._u32[0] >> (32 - s));
CPU.GPR[rt]._u32[2] = (temp._u32[2] << s) | (temp._u32[1] >> (32 - s));
CPU.GPR[rt]._u32[3] = (temp._u32[3] << s) | (temp._u32[2] >> (32 - s));
}
else
{
CPU.GPR[rt] = CPU.GPR[ra];
}
}
void ROTQMBII(u32 rt, u32 ra, s32 i7)
{
const int s = (0 - i7) & 0x7;
const SPU_GPR_hdr temp = CPU.GPR[ra];
CPU.GPR[rt]._u32[0] = (temp._u32[0] >> s) | (temp._u32[1] << (32 - s));
CPU.GPR[rt]._u32[1] = (temp._u32[1] >> s) | (temp._u32[2] << (32 - s));
CPU.GPR[rt]._u32[2] = (temp._u32[2] >> s) | (temp._u32[3] << (32 - s));
CPU.GPR[rt]._u32[3] = (temp._u32[3] >> s);
if (s) // not an optimization, it fixes shifts
{
const SPU_GPR_hdr temp = CPU.GPR[ra];
CPU.GPR[rt]._u32[0] = (temp._u32[0] >> s) | (temp._u32[1] << (32 - s));
CPU.GPR[rt]._u32[1] = (temp._u32[1] >> s) | (temp._u32[2] << (32 - s));
CPU.GPR[rt]._u32[2] = (temp._u32[2] >> s) | (temp._u32[3] << (32 - s));
CPU.GPR[rt]._u32[3] = (temp._u32[3] >> s);
}
else
{
CPU.GPR[rt] = CPU.GPR[ra];
}
}
void SHLQBII(u32 rt, u32 ra, s32 i7)
{
const int s = i7 & 0x7;
const SPU_GPR_hdr temp = CPU.GPR[ra];
CPU.GPR[rt]._u32[0] = (temp._u32[0] << s);
CPU.GPR[rt]._u32[1] = (temp._u32[1] << s) | (temp._u32[0] >> (32 - s));
CPU.GPR[rt]._u32[2] = (temp._u32[2] << s) | (temp._u32[1] >> (32 - s));
CPU.GPR[rt]._u32[3] = (temp._u32[3] << s) | (temp._u32[2] >> (32 - s));
if (s) // not an optimization, it fixes shifts
{
const SPU_GPR_hdr temp = CPU.GPR[ra];
CPU.GPR[rt]._u32[0] = (temp._u32[0] << s);
CPU.GPR[rt]._u32[1] = (temp._u32[1] << s) | (temp._u32[0] >> (32 - s));
CPU.GPR[rt]._u32[2] = (temp._u32[2] << s) | (temp._u32[1] >> (32 - s));
CPU.GPR[rt]._u32[3] = (temp._u32[3] << s) | (temp._u32[2] >> (32 - s));
}
else
{
CPU.GPR[rt] = CPU.GPR[ra];
}
}
void ROTQBYI(u32 rt, u32 ra, s32 i7)
{
@ -747,24 +789,27 @@ private:
}
void FA(u32 rt, u32 ra, u32 rb)
{
CPU.GPR[rt]._f[0] = CPU.GPR[ra]._f[0] + CPU.GPR[rb]._f[0];
CPU.GPR[rt]._f[1] = CPU.GPR[ra]._f[1] + CPU.GPR[rb]._f[1];
CPU.GPR[rt]._f[2] = CPU.GPR[ra]._f[2] + CPU.GPR[rb]._f[2];
CPU.GPR[rt]._f[3] = CPU.GPR[ra]._f[3] + CPU.GPR[rb]._f[3];
for (int w = 0; w < 4; w++)
{
CPU.GPR[rt]._f[w] = CPU.GPR[ra]._f[w] + CPU.GPR[rb]._f[w];
//if (CPU.GPR[rt]._f[w] == -0.0f) CPU.GPR[rt]._f[w] = 0.0f;
}
}
void FS(u32 rt, u32 ra, u32 rb)
{
CPU.GPR[rt]._f[0] = CPU.GPR[ra]._f[0] - CPU.GPR[rb]._f[0];
CPU.GPR[rt]._f[1] = CPU.GPR[ra]._f[1] - CPU.GPR[rb]._f[1];
CPU.GPR[rt]._f[2] = CPU.GPR[ra]._f[2] - CPU.GPR[rb]._f[2];
CPU.GPR[rt]._f[3] = CPU.GPR[ra]._f[3] - CPU.GPR[rb]._f[3];
for (int w = 0; w < 4; w++)
{
CPU.GPR[rt]._f[w] = CPU.GPR[ra]._f[w] - CPU.GPR[rb]._f[w];
//if (CPU.GPR[rt]._f[w] == -0.0f) CPU.GPR[rt]._f[w] = 0.0f;
}
}
void FM(u32 rt, u32 ra, u32 rb)
{
CPU.GPR[rt]._f[0] = CPU.GPR[ra]._f[0] * CPU.GPR[rb]._f[0];
CPU.GPR[rt]._f[1] = CPU.GPR[ra]._f[1] * CPU.GPR[rb]._f[1];
CPU.GPR[rt]._f[2] = CPU.GPR[ra]._f[2] * CPU.GPR[rb]._f[2];
CPU.GPR[rt]._f[3] = CPU.GPR[ra]._f[3] * CPU.GPR[rb]._f[3];
for (int w = 0; w < 4; w++)
{
CPU.GPR[rt]._f[w] = CPU.GPR[ra]._f[w] * CPU.GPR[rb]._f[w];
//if (CPU.GPR[rt]._f[w] == -0.0f) CPU.GPR[rt]._f[w] = 0.0f;
}
}
void CLGTH(u32 rt, u32 ra, u32 rb)
{
@ -1513,24 +1558,27 @@ private:
}
void FNMS(u32 rt, u32 ra, u32 rb, u32 rc)
{
CPU.GPR[rt]._f[0] = CPU.GPR[rc]._f[0] - CPU.GPR[ra]._f[0] * CPU.GPR[rb]._f[0];
CPU.GPR[rt]._f[1] = CPU.GPR[rc]._f[1] - CPU.GPR[ra]._f[1] * CPU.GPR[rb]._f[1];
CPU.GPR[rt]._f[2] = CPU.GPR[rc]._f[2] - CPU.GPR[ra]._f[2] * CPU.GPR[rb]._f[2];
CPU.GPR[rt]._f[3] = CPU.GPR[rc]._f[3] - CPU.GPR[ra]._f[3] * CPU.GPR[rb]._f[3];
for (int w = 0; w < 4; w++)
{
CPU.GPR[rt]._f[w] = CPU.GPR[rc]._f[w] - CPU.GPR[ra]._f[w] * CPU.GPR[rb]._f[w];
//if (CPU.GPR[rt]._f[w] == -0.0f) CPU.GPR[rt]._f[w] = 0.0f;
}
}
void FMA(u32 rt, u32 ra, u32 rb, u32 rc)
{
CPU.GPR[rt]._f[0] = CPU.GPR[ra]._f[0] * CPU.GPR[rb]._f[0] + CPU.GPR[rc]._f[0];
CPU.GPR[rt]._f[1] = CPU.GPR[ra]._f[1] * CPU.GPR[rb]._f[1] + CPU.GPR[rc]._f[1];
CPU.GPR[rt]._f[2] = CPU.GPR[ra]._f[2] * CPU.GPR[rb]._f[2] + CPU.GPR[rc]._f[2];
CPU.GPR[rt]._f[3] = CPU.GPR[ra]._f[3] * CPU.GPR[rb]._f[3] + CPU.GPR[rc]._f[3];
for (int w = 0; w < 4; w++)
{
CPU.GPR[rt]._f[w] = CPU.GPR[rc]._f[w] + CPU.GPR[ra]._f[w] * CPU.GPR[rb]._f[w];
//if (CPU.GPR[rt]._f[w] == -0.0f) CPU.GPR[rt]._f[w] = 0.0f;
}
}
void FMS(u32 rt, u32 ra, u32 rb, u32 rc)
{
CPU.GPR[rt]._f[0] = CPU.GPR[ra]._f[0] * CPU.GPR[rb]._f[0] - CPU.GPR[rc]._f[0];
CPU.GPR[rt]._f[1] = CPU.GPR[ra]._f[1] * CPU.GPR[rb]._f[1] - CPU.GPR[rc]._f[1];
CPU.GPR[rt]._f[2] = CPU.GPR[ra]._f[2] * CPU.GPR[rb]._f[2] - CPU.GPR[rc]._f[2];
CPU.GPR[rt]._f[3] = CPU.GPR[ra]._f[3] * CPU.GPR[rb]._f[3] - CPU.GPR[rc]._f[3];
for (int w = 0; w < 4; w++)
{
CPU.GPR[rt]._f[w] = CPU.GPR[ra]._f[w] * CPU.GPR[rb]._f[w] - CPU.GPR[rc]._f[w];
//if (CPU.GPR[rt]._f[w] == -0.0f) CPU.GPR[rt]._f[w] = 0.0f;
}
}
void UNK(u32 code, u32 opcode, u32 gcode)

View File

@ -1485,8 +1485,8 @@ private:
c.movdqa(vr.get(), XmmConst(_mm_set_epi32(0x10111213, 0x14151617, 0x18191a1b, 0x1c1d1e1f)));
XmmFinalize(vr, rt);
XmmInvalidate(rt);
c.mov(dword_ptr(*cpu_var, *addr, 0, offsetof(SPUThread, GPR[rt]._u32[0])), 0x00010203);
c.mov(dword_ptr(*cpu_var, *addr, 0, offsetof(SPUThread, GPR[rt]._u32[1])), 0x04050607);
c.mov(dword_ptr(*cpu_var, *addr, 0, offsetof(SPUThread, GPR[rt]._u32[0])), 0x04050607);
c.mov(dword_ptr(*cpu_var, *addr, 0, offsetof(SPUThread, GPR[rt]._u32[1])), 0x00010203);
LOG_OPCODE();
}
void ROTQBI(u32 rt, u32 ra, u32 rb)
@ -1628,8 +1628,8 @@ private:
c.movdqa(vr.get(), XmmConst(_mm_set_epi32(0x10111213, 0x14151617, 0x18191a1b, 0x1c1d1e1f)));
XmmFinalize(vr, rt);
XmmInvalidate(rt);
c.mov(dword_ptr(*cpu_var, *addr, 0, offsetof(SPUThread, GPR[rt]._u32[0])), 0x00010203);
c.mov(dword_ptr(*cpu_var, *addr, 0, offsetof(SPUThread, GPR[rt]._u32[1])), 0x04050607);
c.mov(dword_ptr(*cpu_var, *addr, 0, offsetof(SPUThread, GPR[rt]._u32[0])), 0x04050607);
c.mov(dword_ptr(*cpu_var, *addr, 0, offsetof(SPUThread, GPR[rt]._u32[1])), 0x00010203);
LOG_OPCODE();
}
void ROTQBII(u32 rt, u32 ra, s32 i7)

View File

@ -10,6 +10,8 @@
#include "Emu/Cell/SPUDisAsm.h"
#include "Emu/Cell/SPURecompiler.h"
#include <cfenv>
SPUThread& GetCurrentSPUThread()
{
PPCThread* thread = GetCurrentPPCThread();
@ -35,6 +37,19 @@ SPUThread::~SPUThread()
{
}
void SPUThread::Task()
{
const int round = std::fegetround();
std::fesetround(FE_TOWARDZERO);
CPUThread::Task();
if (std::fegetround() != FE_TOWARDZERO)
{
LOG_ERROR(Log::SPU, "Rounding mode has changed(%d)", std::fegetround());
}
std::fesetround(round);
}
void SPUThread::DoReset()
{
PPCThread::DoReset();
@ -60,9 +75,13 @@ void SPUThread::InitRegs()
dmac.queue_lock = 0;*/
SPU.Status.SetValue(SPU_STATUS_STOPPED);
Prxy.QueryType.SetValue(0);
// TODO: check initialization if necessary
MFC2.QueryType.SetValue(0); // prxy
MFC1.CMDStatus.SetValue(0);
MFC2.CMDStatus.SetValue(0);
MFC1.TagStatus.SetValue(0);
MFC2.TagStatus.SetValue(0);
//PC = SPU.NPC.GetValue();
}

View File

@ -523,16 +523,11 @@ public:
Channel<1> EAL;
Channel<1> Size_Tag;
Channel<1> CMDStatus;
Channel<1> QStatus;
} MFC1, MFC2;
struct
{
Channel<1> QueryType;
Channel<1> QueryType; // only for prxy
Channel<1> QueryMask;
Channel<1> TagStatus;
Channel<1> AtomicStat;
} Prxy;
} MFC1, MFC2;
struct StalledList
{
@ -555,7 +550,6 @@ public:
Channel<1> Out_MBox;
Channel<1> Out_IntrMBox;
Channel<4> In_MBox;
Channel<1> MBox_Status;
Channel<1> Status;
Channel<1> NPC;
Channel<1> SNR[2];
@ -831,7 +825,7 @@ public:
reservation.data[i] = *(u128*)&Memory[(u32)ea + i * 16];
*(u128*)&Memory[dmac.ls_offset + lsa + i * 16] = reservation.data[i];
}
Prxy.AtomicStat.PushUncond(MFC_GETLLAR_SUCCESS);
MFCArgs.AtomicStat.PushUncond(MFC_GETLLAR_SUCCESS);
}
else if (op == MFC_PUTLLC_CMD) // store conditional
{
@ -854,7 +848,7 @@ public:
}
if (changed == 0) // nothing changed?
{
Prxy.AtomicStat.PushUncond(MFC_PUTLLC_SUCCESS);
MFCArgs.AtomicStat.PushUncond(MFC_PUTLLC_SUCCESS);
}
else if (changed == 1)
{
@ -862,7 +856,7 @@ public:
{
LOG_ERROR(Log::SPU, "MFC_PUTLLC_CMD: TODO: 128bit compare and swap");
Emu.Pause();
Prxy.AtomicStat.PushUncond(MFC_PUTLLC_SUCCESS);
MFCArgs.AtomicStat.PushUncond(MFC_PUTLLC_SUCCESS);
}
else
{
@ -871,11 +865,11 @@ public:
if (InterlockedCompareExchange64((volatile long long*)(Memory + (u32)ea + last * 16 + last_q * 8),
buf[last]._u64[last_q], reservation.data[last]._u64[last_q]) == reservation.data[last]._u64[last_q])
{
Prxy.AtomicStat.PushUncond(MFC_PUTLLC_SUCCESS);
MFCArgs.AtomicStat.PushUncond(MFC_PUTLLC_SUCCESS);
}
else
{
Prxy.AtomicStat.PushUncond(MFC_PUTLLC_FAILURE);
MFCArgs.AtomicStat.PushUncond(MFC_PUTLLC_FAILURE);
}
/*u32 last_d = last_q * 2;
if (buf[last]._u32[last_d] == reservation.data[last]._u32[last_d] && buf[last]._u32[last_d+1] != reservation.data[last]._u32[last_d+1])
@ -890,7 +884,7 @@ public:
{
LOG_ERROR(Log::SPU, "MFC_PUTLLC_CMD: TODO: 64bit compare and swap");
Emu.Pause();
Prxy.AtomicStat.PushUncond(MFC_PUTLLC_SUCCESS);
MFCArgs.AtomicStat.PushUncond(MFC_PUTLLC_SUCCESS);
}*/
}
}
@ -900,18 +894,18 @@ public:
LOG_ERROR(Log::SPU, "MFC_PUTLLC_CMD: Reservation Error: impossibru (~ 16x%d (mask=0x%x)) (opcode=0x%x, cmd=0x%x, lsa = 0x%x, ea = 0x%llx, tag = 0x%x, size = 0x%x)",
changed, mask, op, cmd, lsa, ea, tag, size);
Emu.Pause();
Prxy.AtomicStat.PushUncond(MFC_PUTLLC_SUCCESS);
MFCArgs.AtomicStat.PushUncond(MFC_PUTLLC_SUCCESS);
}
}
else
{
Prxy.AtomicStat.PushUncond(MFC_PUTLLC_FAILURE);
MFCArgs.AtomicStat.PushUncond(MFC_PUTLLC_FAILURE);
}
reservation.clear();
}
else // failed
{
Prxy.AtomicStat.PushUncond(MFC_PUTLLC_FAILURE);
MFCArgs.AtomicStat.PushUncond(MFC_PUTLLC_FAILURE);
}
}
else // store unconditional
@ -920,7 +914,7 @@ public:
ProcessCmd(MFC_PUT_CMD, tag, lsa, ea, 128);
if (op == MFC_PUTLLUC_CMD)
{
Prxy.AtomicStat.PushUncond(MFC_PUTLLUC_SUCCESS);
MFCArgs.AtomicStat.PushUncond(MFC_PUTLLUC_SUCCESS);
}
if ((reservation.addr + reservation.size > ea && reservation.addr <= ea + size) ||
(ea + size > reservation.addr && ea <= reservation.addr + reservation.size))
@ -944,12 +938,12 @@ public:
{
case SPU_WrOutMbox: return SPU.Out_MBox.GetFreeCount();
case SPU_RdInMbox: return SPU.In_MBox.GetCount();
case MFC_RdTagStat: return Prxy.TagStatus.GetCount();
case MFC_RdTagStat: return MFC1.TagStatus.GetCount();
case MFC_RdListStallStat: return StallStat.GetCount();
case MFC_WrTagUpdate: return Prxy.TagStatus.GetCount(); // hack
case MFC_WrTagUpdate: return MFC1.TagStatus.GetCount(); // hack
case SPU_RdSigNotify1: return SPU.SNR[0].GetCount();
case SPU_RdSigNotify2: return SPU.SNR[1].GetCount();
case MFC_RdAtomicStat: return Prxy.AtomicStat.GetCount();
case MFC_RdAtomicStat: return MFC1.AtomicStat.GetCount();
default:
{
@ -1115,14 +1109,14 @@ public:
case MFC_WrTagMask:
{
//ConLog.Warning("%s: %s = 0x%x", __FUNCTION__, spu_ch_name[ch], v);
Prxy.QueryMask.SetValue(v);
MFC1.QueryMask.SetValue(v);
break;
}
case MFC_WrTagUpdate:
{
//ConLog.Warning("%s: %s = 0x%x", __FUNCTION__, spu_ch_name[ch], v);
Prxy.TagStatus.PushUncond(Prxy.QueryMask.GetValue());
MFC1.TagStatus.PushUncond(MFC1.QueryMask.GetValue());
break;
}
@ -1184,7 +1178,7 @@ public:
case SPU_WrDec:
{
m_dec_start = get_system_time();
m_dec_start = get_time();
m_dec_value = v;
break;
}
@ -1215,7 +1209,7 @@ public:
case MFC_RdTagStat:
{
while (!Prxy.TagStatus.Pop(v) && !Emu.IsStopped()) std::this_thread::sleep_for(std::chrono::milliseconds(1));
while (!MFC1.TagStatus.Pop(v) && !Emu.IsStopped()) std::this_thread::sleep_for(std::chrono::milliseconds(1));
//ConLog.Warning("%s: 0x%x = %s", __FUNCTION__, v, spu_ch_name[ch]);
break;
}
@ -1236,7 +1230,7 @@ public:
case MFC_RdAtomicStat:
{
while (!Prxy.AtomicStat.Pop(v) && !Emu.IsStopped()) std::this_thread::sleep_for(std::chrono::milliseconds(1));
while (!MFC1.AtomicStat.Pop(v) && !Emu.IsStopped()) std::this_thread::sleep_for(std::chrono::milliseconds(1));
break;
}
@ -1248,8 +1242,7 @@ public:
case SPU_RdDec:
{
// decrementer freq is probably 80 MHz
v = m_dec_value - (u32)(get_system_time() - m_dec_start) * 80;
v = m_dec_value - (u32)(get_time() - m_dec_start);
break;
}
@ -1444,6 +1437,7 @@ public:
public:
virtual void InitRegs();
virtual u64 GetFreeStackSize() const;
virtual void Task();
protected:
virtual void DoReset();

View File

@ -251,10 +251,10 @@ std::string GLFragmentDecompilerThread::BuildCode()
static const std::pair<std::string, std::string> table[] =
{
{ "ocol0", m_ctrl & 0x40 ? "r0" : "h0" },
{ "ocol1", m_ctrl & 0x40 ? "r1" : "h2" },
{ "ocol2", m_ctrl & 0x40 ? "r2" : "h4" },
{ "ocol3", m_ctrl & 0x40 ? "r3" : "h6" },
{ "ocol4", m_ctrl & 0x40 ? "r4" : "h8" },
{ "ocol1", m_ctrl & 0x40 ? "r2" : "h2" },
{ "ocol2", m_ctrl & 0x40 ? "r3" : "h4" },
{ "ocol3", m_ctrl & 0x40 ? "r4" : "h6" },
{ "ocol4", m_ctrl & 0x40 ? "r5" : "h8" },
};
for (int i = 0; i < sizeof(table) / sizeof(*table); ++i)
@ -263,19 +263,19 @@ std::string GLFragmentDecompilerThread::BuildCode()
AddCode(m_parr.AddParam(PARAM_OUT, "vec4", table[i].first, i) + " = " + table[i].second + ";");
}
if(m_ctrl & 0xe) main += "\tgl_FragDepth = r1.z;\n";
if (m_ctrl & 0xe) main += "\tgl_FragDepth = r1.z;\n";
std::string p;
for(u32 i=0; i<m_parr.params.size(); ++i)
for (u32 i = 0; i<m_parr.params.size(); ++i)
{
p += m_parr.params[i].Format();
}
return std::string("#version 330\n"
"\n"
+ p + "\n"
"void main()\n{\n" + main + "}\n");
"\n"
+ p + "\n"
"void main()\n{\n" + main + "}\n");
}
void GLFragmentDecompilerThread::Task()

View File

@ -79,16 +79,16 @@ struct GLFragmentDecompilerThread : public ThreadBase
struct
{
u32 else_offset : 31;
u32 : 1;
u32 : 1;
};
struct
{
u32 : 2;
u32 rep1 : 8;
u32 rep2 : 8;
u32 : 1;
u32 rep3 : 8;
u32 : 2;
u32 rep1 : 8;
u32 rep2 : 8;
u32 : 1;
u32 rep3 : 8;
};
} src1;

View File

@ -353,7 +353,7 @@ std::string GLVertexDecompilerThread::BuildCode()
{ "tc6", true, "dst_reg13", "", false },
{ "tc7", true, "dst_reg14", "", false },
{ "tc8", true, "dst_reg15", "", false },
{ "tc9", true, "dst_reg6", "", false }
{ "tc9", true, "dst_reg16", "", false }
};
std::string f;

View File

@ -10,26 +10,26 @@ struct GLVertexDecompilerThread : public ThreadBase
struct
{
u32 addr_swz : 2;
u32 mask_w : 2;
u32 mask_z : 2;
u32 mask_y : 2;
u32 mask_x : 2;
u32 cond : 3;
u32 cond_test_enable : 1;
u32 cond_update_enable_0 : 1;
u32 dst_tmp : 6;
u32 src0_abs : 1;
u32 src1_abs : 1;
u32 src2_abs : 1;
u32 addr_reg_sel_1 : 1;
u32 cond_reg_sel_1 : 1;
u32 staturate : 1;
u32 index_input : 1;
u32 : 1;
u32 cond_update_enable_1 : 1;
u32 vec_result : 1;
u32 : 1;
u32 addr_swz : 2;
u32 mask_w : 2;
u32 mask_z : 2;
u32 mask_y : 2;
u32 mask_x : 2;
u32 cond : 3;
u32 cond_test_enable : 1;
u32 cond_update_enable_0 : 1;
u32 dst_tmp : 6;
u32 src0_abs : 1;
u32 src1_abs : 1;
u32 src2_abs : 1;
u32 addr_reg_sel_1 : 1;
u32 cond_reg_sel_1 : 1;
u32 staturate : 1;
u32 index_input : 1;
u32 : 1;
u32 cond_update_enable_1 : 1;
u32 vec_result : 1;
u32 : 1;
};
} d0;
@ -39,11 +39,11 @@ struct GLVertexDecompilerThread : public ThreadBase
struct
{
u32 src0h : 8;
u32 input_src : 4;
u32 const_src : 10;
u32 vec_opcode : 5;
u32 sca_opcode : 5;
u32 src0h : 8;
u32 input_src : 4;
u32 const_src : 10;
u32 vec_opcode : 5;
u32 sca_opcode : 5;
};
} d1;
@ -53,14 +53,14 @@ struct GLVertexDecompilerThread : public ThreadBase
struct
{
u32 src2h : 6;
u32 src1 : 17;
u32 src0l : 9;
u32 src2h : 6;
u32 src1 : 17;
u32 src0l : 9;
};
struct
{
u32 iaddrh : 6;
u32 : 26;
u32 iaddrh : 6;
u32 : 26;
};
} d2;
@ -70,10 +70,10 @@ struct GLVertexDecompilerThread : public ThreadBase
struct
{
u32 end : 1;
u32 index_const : 1;
u32 dst : 5;
u32 sca_dst_tmp : 6;
u32 end : 1;
u32 index_const : 1;
u32 dst : 5;
u32 sca_dst_tmp : 6;
u32 vec_writemask_w : 1;
u32 vec_writemask_z : 1;
u32 vec_writemask_y : 1;
@ -82,12 +82,12 @@ struct GLVertexDecompilerThread : public ThreadBase
u32 sca_writemask_z : 1;
u32 sca_writemask_y : 1;
u32 sca_writemask_x : 1;
u32 src2l : 11;
u32 src2l : 11;
};
struct
{
u32 : 29;
u32 iaddrl : 3;
u32 : 29;
u32 iaddrl : 3;
};
} d3;
@ -99,31 +99,31 @@ struct GLVertexDecompilerThread : public ThreadBase
struct
{
u32 src0l : 9;
u32 src0h : 8;
u32 src0l : 9;
u32 src0h : 8;
};
struct
{
u32 src1 : 17;
u32 src1 : 17;
};
struct
{
u32 src2l : 11;
u32 src2h : 6;
u32 src2l : 11;
u32 src2h : 6;
};
};
struct
{
u32 reg_type : 2;
u32 tmp_src : 6;
u32 swz_w : 2;
u32 swz_z : 2;
u32 swz_y : 2;
u32 swz_x : 2;
u32 neg : 1;
u32 reg_type : 2;
u32 tmp_src : 6;
u32 swz_w : 2;
u32 swz_z : 2;
u32 swz_y : 2;
u32 swz_x : 2;
u32 neg : 1;
};
} src[3];

View File

@ -1677,12 +1677,12 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t args, const u32
{
const u32 a0 = ARGS(0);
m_set_clip_plane = true;
m_clip_plane_0 = a0 & 0xf;
m_clip_plane_1 = (a0 >> 4) & 0xf;
m_clip_plane_2 = (a0 >> 8) & 0xf;
m_clip_plane_3 = (a0 >> 12) & 0xf;
m_clip_plane_4 = (a0 >> 16) & 0xf;
m_clip_plane_5 = a0 >> 20;
m_clip_plane_0 = (a0 & 0xf) ? true : false;
m_clip_plane_1 = ((a0 >> 4)) & 0xf ? true : false;
m_clip_plane_2 = ((a0 >> 8)) & 0xf ? true : false;
m_clip_plane_3 = ((a0 >> 12)) & 0xf ? true : false;
m_clip_plane_4 = ((a0 >> 16)) & 0xf ? true : false;
m_clip_plane_5 = (a0 >> 20) ? true : false;
}
break;

View File

@ -348,12 +348,12 @@ public:
// Clip plane
bool m_set_clip_plane;
u32 m_clip_plane_0;
u32 m_clip_plane_1;
u32 m_clip_plane_2;
u32 m_clip_plane_3;
u32 m_clip_plane_4;
u32 m_clip_plane_5;
bool m_clip_plane_0;
bool m_clip_plane_1;
bool m_clip_plane_2;
bool m_clip_plane_3;
bool m_clip_plane_4;
bool m_clip_plane_5;
// Surface
bool m_set_surface_format;

View File

@ -223,15 +223,15 @@ enum CellVideoOutRGBOutputRange
static const CellVideoOutResolution ResolutionTable[] =
{
{(u16)-1, (u16)-1}, //0 - 0
{1920, 1080}, //1 - 1
{1280, 720}, //2 - 2
{720, 480}, //4 - 3
{720, 576}, //5 - 4
{1600, 1080}, //10 - 5
{1440, 1080}, //11 - 6
{1280, 1080}, //12 - 7
{960, 1080}, //13 - 8
{ be_t<u16>::MakeFromBE(se16(0xffff)), be_t<u16>::MakeFromBE(se16(0xffff)) }, //0 - 0
{ be_t<u16>::MakeFromBE(se16(1920)), be_t<u16>::MakeFromBE(se16(1080)) }, //1 - 1
{ be_t<u16>::MakeFromBE(se16(1280)), be_t<u16>::MakeFromBE(se16(720)) }, //2 - 2
{ be_t<u16>::MakeFromBE(se16(720)), be_t<u16>::MakeFromBE(se16(480)) }, //4 - 3
{ be_t<u16>::MakeFromBE(se16(720)), be_t<u16>::MakeFromBE(se16(576)) }, //5 - 4
{ be_t<u16>::MakeFromBE(se16(1600)), be_t<u16>::MakeFromBE(se16(1080)) }, //10 - 5
{ be_t<u16>::MakeFromBE(se16(1440)), be_t<u16>::MakeFromBE(se16(1080)) }, //11 - 6
{ be_t<u16>::MakeFromBE(se16(1280)), be_t<u16>::MakeFromBE(se16(1080)) }, //12 - 7
{ be_t<u16>::MakeFromBE(se16(960)), be_t<u16>::MakeFromBE(se16(1080)) }, //13 - 8
};
inline static u32 ResolutionIdToNum(u32 id)

View File

@ -214,12 +214,22 @@ public:
}
}
void InitRawSPU(MemoryBlock* raw_spu, const u32 num)
u32 InitRawSPU(MemoryBlock* raw_spu)
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
MemoryBlocks.push_back(raw_spu);
if (num < sizeof(RawSPUMem) / sizeof(RawSPUMem[0])) RawSPUMem[num] = raw_spu;
u32 index;
for (index = 0; index < sizeof(RawSPUMem) / sizeof(RawSPUMem[0]); index++)
{
if (!RawSPUMem[index])
{
RawSPUMem[index] = raw_spu;
break;
}
}
MemoryBlocks.push_back(raw_spu->SetRange(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * index, RAW_SPU_PROB_OFFSET));
return index;
}
void CloseRawSPU(MemoryBlock* raw_spu, const u32 num)
@ -391,7 +401,10 @@ public:
}
else
{
RawSPUMem[(addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET]->Write32(addr, data);
if (!RawSPUMem[(addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET]->Write32(addr, data))
{
*(u32*)((u8*)GetBaseAddr() + addr) = re32(data);
}
}
}
else
@ -464,7 +477,10 @@ public:
else
{
u32 res;
RawSPUMem[(addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET]->Read32(addr, &res);
if (!RawSPUMem[(addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET]->Read32(addr, &res))
{
res = re32(*(u32*)((u8*)GetBaseAddr() + addr));
}
return res;
}
}
@ -501,29 +517,29 @@ public:
}
}
bool CopyToReal(void* real, u64 from, u32 count)
template<typename T> bool CopyToReal(void* real, T from, u32 count)
{
if (!IsGoodAddr(from, count)) return false;
if (!IsGoodAddr<T>(from, count)) return false;
memcpy(real, GetMemFromAddr(from), count);
memcpy(real, GetMemFromAddr<T>(from), count);
return true;
}
bool CopyFromReal(u64 to, const void* real, u32 count)
template<typename T> bool CopyFromReal(T to, const void* real, u32 count)
{
if (!IsGoodAddr(to, count)) return false;
if (!IsGoodAddr<T>(to, count)) return false;
memcpy(GetMemFromAddr(to), real, count);
memcpy(GetMemFromAddr<T>(to), real, count);
return true;
}
bool Copy(u64 to, u64 from, u32 count)
template<typename T1, typename T2> bool Copy(T1 to, T2 from, u32 count)
{
if (!IsGoodAddr(to, count) || !IsGoodAddr(from, count)) return false;
if (!IsGoodAddr<T1>(to, count) || !IsGoodAddr<T2>(from, count)) return false;
memmove(GetMemFromAddr(to), GetMemFromAddr(from), count);
memmove(GetMemFromAddr<T1>(to), GetMemFromAddr<T2>(from), count);
return true;
}
@ -548,14 +564,14 @@ public:
for (u32 i = 0; i < size; ++i) Write8(addr + (size - 1 - i), src[i]);
}
template<typename T> void WriteData(const u64 addr, const T* data)
template<typename T, typename Td> void WriteData(const T addr, const Td* data)
{
memcpy(GetMemFromAddr(addr), data, sizeof(T));
memcpy(GetMemFromAddr<T>(addr), data, sizeof(Td));
}
template<typename T> void WriteData(const u64 addr, const T data)
template<typename T, typename Td> void WriteData(const T addr, const Td data)
{
*(T*)GetMemFromAddr(addr) = data;
*(Td*)GetMemFromAddr<T>(addr) = data;
}
std::string ReadString(const u64 addr, const u64 len)

View File

@ -366,25 +366,6 @@ public:
}
};
class NullMemoryBlock : public MemoryBlock
{
public:
virtual bool IsNULL() { return true; }
virtual bool IsMyAddress(const u64 addr) { return true; }
virtual bool Read8(const u64 addr, u8* value);
virtual bool Read16(const u64 addr, u16* value);
virtual bool Read32(const u64 addr, u32* value);
virtual bool Read64(const u64 addr, u64* value);
virtual bool Read128(const u64 addr, u128* value);
virtual bool Write8(const u64 addr, const u8 value);
virtual bool Write16(const u64 addr, const u16 value);
virtual bool Write32(const u64 addr, const u32 value);
virtual bool Write64(const u64 addr, const u64 value);
virtual bool Write128(const u64 addr, const u128 value);
};
template<typename PT>
class DynamicMemoryBlockBase : public PT
{

View File

@ -332,6 +332,8 @@ int cellPadGetInfo2(u32 info_addr)
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
CellPadInfo2 info = {};
//sys_io->Warning("*** info{}: max_connect=0x%x, now_connect=0x%x, system_info=0x%x, port_status[0]=0x%x, port_setting[0]=0x%x",
// (u32)info.max_connect, (u32)info.now_connect, (u32)info.system_info, (u32)info.port_status[0], (u32)info.port_setting[0]);
const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
info.max_connect = rinfo.max_connect;

View File

@ -178,7 +178,7 @@ void getSaveDataStat(SaveDataEntry entry, mem_ptr_t<CellSaveDataStatGet> statGet
memcpy(statGet->getParam.listParam, entry.listParam.c_str(), CELL_SAVEDATA_SYSP_LPARAM_SIZE);
statGet->fileNum = 0;
statGet->fileList.SetAddr(0);
statGet->fileList.SetAddr(be_t<u32>::MakeFromBE(0));
statGet->fileListNum = 0;
std::string saveDir = "/dev_hdd0/home/00000001/savedata/" + entry.dirName; // TODO: Get the path of the current user
vfsDir dir(saveDir);
@ -210,7 +210,7 @@ void getSaveDataStat(SaveDataEntry entry, mem_ptr_t<CellSaveDataStatGet> statGet
}
}
statGet->fileList.SetAddr(Memory.Alloc(sizeof(CellSaveDataFileStat) * fileEntries.size(), sizeof(CellSaveDataFileStat)));
statGet->fileList.SetAddr(be_t<u32>::MakeFromLE(Memory.Alloc(sizeof(CellSaveDataFileStat)* fileEntries.size(), sizeof(CellSaveDataFileStat))));
for (u32 i=0; i<fileEntries.size(); i++)
memcpy(&statGet->fileList[i], &fileEntries[i], sizeof(CellSaveDataFileStat));
}

View File

@ -213,7 +213,7 @@ int cellSSPlayerSetWave(u32 handle, mem_ptr_t<CellSSPlayerWaveParam> waveInfo, m
ssp[handle].m_addr = waveInfo->addr;
ssp[handle].m_samples = waveInfo->samples;
ssp[handle].m_loop_start = waveInfo->loopStartOffset - 1;
ssp[handle].m_loop_mode = commonInfo.GetAddr() ? commonInfo->loopMode : CELL_SSPLAYER_ONESHOT;
ssp[handle].m_loop_mode = commonInfo.GetAddr() ? (u32)commonInfo->loopMode : CELL_SSPLAYER_ONESHOT;
ssp[handle].m_position = waveInfo->startOffset - 1;
return CELL_OK;

View File

@ -189,7 +189,7 @@ s32 sys_lwcond_wait(mem_ptr_t<sys_lwcond_t> lwcond, u64 timeout)
mem_ptr_t<sys_lwmutex_t> mutex(lwcond->lwmutex);
u32 tid_le = GetCurrentPPUThread().GetId();
be_t<u32> tid = tid_le;
be_t<u32> tid = be_t<u32>::MakeFromLE(tid_le);
SleepQueue* sq = nullptr;
Emu.GetIdManager().GetIDData((u32)mutex->sleep_queue, sq);
@ -211,7 +211,7 @@ s32 sys_lwcond_wait(mem_ptr_t<sys_lwcond_t> lwcond, u64 timeout)
if (sq)
{
mutex->mutex.unlock(tid, mutex->attribute.ToBE() == se32(SYS_SYNC_PRIORITY) ? sq->pop_prio() : sq->pop());
mutex->mutex.unlock(tid, be_t<u32>::MakeFromLE(mutex->attribute.ToBE() == se32(SYS_SYNC_PRIORITY) ? sq->pop_prio() : sq->pop()));
}
else if (mutex->attribute.ToBE() == se32(SYS_SYNC_RETRY))
{

View File

@ -77,7 +77,7 @@ s32 sys_lwmutex_lock(mem_ptr_t<sys_lwmutex_t> lwmutex, u64 timeout)
//ConLog.Write("*** lock mutex (addr=0x%x, attr=0x%x, Nrec=%d, owner=%d, waiter=%d)",
//lwmutex.GetAddr(), (u32)lwmutex->attribute, (u32)lwmutex->recursive_count, lwmutex->vars.parts.owner.GetOwner(), (u32)lwmutex->waiter);
return lwmutex->lock(GetCurrentPPUThread().GetId(), timeout ? ((timeout < 1000) ? 1 : (timeout / 1000)) : 0);
return lwmutex->lock(be_t<u32>::MakeFromLE(GetCurrentPPUThread().GetId()), timeout ? ((timeout < 1000) ? 1 : (timeout / 1000)) : 0);
}
s32 sys_lwmutex_trylock(mem_ptr_t<sys_lwmutex_t> lwmutex)
@ -86,7 +86,7 @@ s32 sys_lwmutex_trylock(mem_ptr_t<sys_lwmutex_t> lwmutex)
if (!lwmutex.IsGood()) return CELL_EFAULT;
return lwmutex->trylock(GetCurrentPPUThread().GetId());
return lwmutex->trylock(be_t<u32>::MakeFromLE(GetCurrentPPUThread().GetId()));
}
s32 sys_lwmutex_unlock(mem_ptr_t<sys_lwmutex_t> lwmutex)
@ -98,7 +98,7 @@ s32 sys_lwmutex_unlock(mem_ptr_t<sys_lwmutex_t> lwmutex)
//ConLog.Write("*** unlocking mutex (addr=0x%x, attr=0x%x, Nrec=%d, owner=%d, waiter=%d)",
//lwmutex.GetAddr(), (u32)lwmutex->attribute, (u32)lwmutex->recursive_count, (u32)lwmutex->vars.parts.owner.GetOwner(), (u32)lwmutex->waiter);
return lwmutex->unlock(GetCurrentPPUThread().GetId());
return lwmutex->unlock(be_t<u32>::MakeFromLE(GetCurrentPPUThread().GetId()));
}
void SleepQueue::push(u32 tid)
@ -294,7 +294,7 @@ int sys_lwmutex_t::unlock(be_t<u32> tid)
recursive_count -= 1;
if (!recursive_count.ToBE())
{
be_t<u32> target = 0;
be_t<u32> target = be_t<u32>::MakeFromBE(se32(0));
switch (attribute.ToBE() & se32(SYS_SYNC_ATTR_PROTOCOL_MASK))
{
case se32(SYS_SYNC_FIFO):

View File

@ -209,8 +209,8 @@ void sys_ppu_thread_once(mem_ptr_t<std::atomic<be_t<u32>>> once_ctrl, u32 entry)
{
sysPrxForUser->Warning("sys_ppu_thread_once(once_ctrl_addr=0x%x, entry=0x%x)", once_ctrl.GetAddr(), entry);
be_t<u32> old = SYS_PPU_THREAD_ONCE_INIT;
if (once_ctrl->compare_exchange_weak(old, SYS_PPU_THREAD_DONE_INIT))
be_t<u32> old = be_t<u32>::MakeFromBE(se32(SYS_PPU_THREAD_ONCE_INIT));
if (once_ctrl->compare_exchange_weak(old, be_t<u32>::MakeFromBE(se32(SYS_PPU_THREAD_DONE_INIT))))
{
CPUThread& new_thread = Emu.GetCPU().AddThread(CPU_THREAD_PPU);
new_thread.SetEntry(entry);

View File

@ -19,7 +19,7 @@ void sys_spinlock_lock(mem_ptr_t<spinlock> lock)
{
sys_spinlock.Log("sys_spinlock_lock(lock_addr=0x%x)", lock.GetAddr());
be_t<u32> tid = GetCurrentPPUThread().GetId();
be_t<u32> tid = be_t<u32>::MakeFromLE(GetCurrentPPUThread().GetId());
switch (lock->mutex.lock(tid))
{
case SMR_ABORT: LOG_WARNING(HLE, "sys_spinlock_lock(0x%x) aborted", lock.GetAddr()); break;
@ -32,7 +32,7 @@ s32 sys_spinlock_trylock(mem_ptr_t<spinlock> lock)
{
sys_spinlock.Log("sys_spinlock_trylock(lock_addr=0x%x)", lock.GetAddr());
be_t<u32> tid = GetCurrentPPUThread().GetId();
be_t<u32> tid = be_t<u32>::MakeFromLE(GetCurrentPPUThread().GetId());
switch (lock->mutex.trylock(tid))
{
case SMR_FAILED: return CELL_EBUSY;

View File

@ -18,46 +18,12 @@ u32 LoadSpuImage(vfsStream& stream, u32& spu_ep)
{
ELFLoader l(stream);
l.LoadInfo();
const u32 alloc_size = 256 * 1024 /*0x1000000 - stream.GetSize()*/;
const u32 alloc_size = 256 * 1024;
u32 spu_offset = Memory.MainMem.AllocAlign(alloc_size);
l.LoadData(spu_offset);
spu_ep = l.GetEntry();
return spu_offset;
}
/*u64 g_last_spu_offset = 0;
static const u64 g_spu_alloc_size = 0x1000000;
u32 LoadSpuImage(vfsStream& stream, u64 address)
{
ELFLoader l(stream);
l.LoadInfo();
l.LoadData(address);
return address + l.GetEntry();
}
u32 LoadSpuImage(vfsStream& stream)
{
g_last_spu_offset = Memory.MainMem.Alloc(g_spu_alloc_size);
return LoadSpuImage(stream, g_last_spu_offset);
}*/
/*u32 _max_usable_spu = 0;
u32 _max_raw_spu = 0;
s32 sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu)
{
sc_spu.Log("sys_spu_initialize(max_usable_spu=%d, max_raw_spu=%d)", max_usable_spu, max_raw_spu);
_max_usable_spu = max_usable_spu;
_max_raw_spu = max_raw_spu;
return CELL_OK;
}
s32 sys_raw_spu_create(u32 id_addr, u32 attr_addr)
{
Memory.Write32(id_addr, Emu.GetIdManager().GetNewID("raw_spu"));
return CELL_OK;
}*/
//156
s32 sys_spu_image_open(mem_ptr_t<sys_spu_image> img, u32 path_addr)
@ -349,13 +315,23 @@ s32 sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status)
return CELL_ESRCH;
}
if (cause.GetAddr() && !cause.IsGood())
{
return CELL_EFAULT;
}
if (status.GetAddr() && !status.IsGood())
{
return CELL_EFAULT;
}
if (group_info->lock.exchange(1)) // acquire lock
{
return CELL_EBUSY;
}
cause = SYS_SPU_THREAD_GROUP_JOIN_ALL_THREADS_EXIT;
status = 0; //unspecified because of ALL_THREADS_EXIT
if (cause.GetAddr()) cause = SYS_SPU_THREAD_GROUP_JOIN_ALL_THREADS_EXIT;
if (status.GetAddr()) status = 0; //unspecified because of ALL_THREADS_EXIT
for (u32 i = 0; i < group_info->list.size(); i++)
{
@ -796,24 +772,38 @@ s32 sys_raw_spu_create(mem32_t id, u32 attr_addr)
{
sc_spu.Warning("sys_raw_spu_create(id_addr=0x%x, attr_addr=0x%x)", id.GetAddr(), attr_addr);
//Emu.GetIdManager().GetNewID("sys_raw_spu", new u32(attr_addr));
CPUThread& new_thread = Emu.GetCPU().AddThread(CPU_THREAD_RAW_SPU);
if (((RawSPUThread&)new_thread).GetIndex() >= 5)
{
Emu.GetCPU().RemoveThread(new_thread.GetId());
return CELL_EAGAIN;
}
id = ((RawSPUThread&)new_thread).GetIndex();
new_thread.Run();
return CELL_OK;
}
s32 sys_raw_spu_destroy(u32 id)
{
sc_spu.Error("sys_raw_spu_destroy(id=%d)", id);
sc_spu.Warning("sys_raw_spu_destroy(id=%d)", id);
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
if (!t)
{
return CELL_ESRCH;
}
// TODO: check if busy
Emu.GetCPU().RemoveThread(t->GetId());
return CELL_OK;
}
s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, mem32_t intrtag)
{
sc_spu.Error("sys_raw_spu_create_interrupt_tag(id=%d, class_id=%d, hwthread=0x%x, intrtag_addr=0x%x)", id, class_id, hwthread, intrtag.GetAddr());
sc_spu.Warning("sys_raw_spu_create_interrupt_tag(id=%d, class_id=%d, hwthread=0x%x, intrtag_addr=0x%x)", id, class_id, hwthread, intrtag.GetAddr());
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);

View File

@ -14,22 +14,33 @@
SysCallBase sys_time("sys_time");
//static const u64 timebase_frequency = 79800000;
static const u64 timebase_frequency = /*79800000*/ 80000000; // 80 Mhz
extern int cellSysutilGetSystemParamInt(int id, mem32_t value);
// Auxiliary functions
u64 get_time()
{
#ifdef _WIN32
static struct PerformanceFreqHolder
{
u64 value;
PerformanceFreqHolder()
{
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);
value = freq.QuadPart;
}
} freq;
LARGE_INTEGER cycle;
LARGE_INTEGER freq;
QueryPerformanceCounter(&cycle);
QueryPerformanceFrequency(&freq);
return cycle.QuadPart * 10000000 / freq.QuadPart;
u64 sec = cycle.QuadPart / freq.value;
return sec * timebase_frequency + (cycle.QuadPart % freq.value) * timebase_frequency / freq.value;
#else
struct timespec ts;
if (!clock_gettime(CLOCK_MONOTONIC, &ts))
return ts.tv_sec * (s64)10000000 + (s64)ts.tv_nsec / (s64)100;
return ts.tv_sec * (s64)timebase_frequency + (s64)ts.tv_nsec * (s64)timebase_frequency / 1000000000;
// Should never occur.
assert(0);
@ -40,7 +51,7 @@ u64 get_time()
// Returns some relative time in microseconds, don't change this fact
u64 get_system_time()
{
return get_time() / 10;
return get_time() / (timebase_frequency / MHZ);
}
@ -61,8 +72,8 @@ s32 sys_time_get_current_time(u32 sec_addr, u32 nsec_addr)
u64 time = get_time();
Memory.Write64(sec_addr, time / 10000000);
Memory.Write64(nsec_addr, (time % 10000000) * 100);
Memory.Write64(sec_addr, time / timebase_frequency);
Memory.Write64(nsec_addr, (time % timebase_frequency) * 1000000000 / (s64)(timebase_frequency));
return CELL_OK;
}
@ -76,5 +87,5 @@ s64 sys_time_get_system_time()
u64 sys_time_get_timebase_frequency()
{
sys_time.Log("sys_time_get_timebase_frequency()");
return 10000000;
return timebase_frequency;
}

View File

@ -1,5 +1,7 @@
#pragma once
#define MHZ (10000000)
// Auxiliary functions
u64 get_time();
u64 get_system_time();

View File

@ -139,10 +139,10 @@ VFSManagerDialog::VFSManagerDialog(wxWindow* parent)
m_list->Bind(wxEVT_LIST_ITEM_ACTIVATED, &VFSManagerDialog::OnEntryConfig, this);
m_list->Bind(wxEVT_RIGHT_DOWN, &VFSManagerDialog::OnRightClick, this);
Bind(wxEVT_MENU, &VFSManagerDialog::OnAdd, this, id_add);
Bind(wxEVT_MENU, &VFSManagerDialog::OnRemove, this, id_remove);
Bind(wxEVT_MENU, &VFSManagerDialog::OnEntryConfig, this, id_config);
Bind(wxEVT_CLOSE_WINDOW, &VFSManagerDialog::OnClose, this, wxID_OK);
Bind(wxEVT_MENU, &VFSManagerDialog::OnAdd, this, id_add);
Bind(wxEVT_MENU, &VFSManagerDialog::OnRemove, this, id_remove);
Bind(wxEVT_MENU, &VFSManagerDialog::OnEntryConfig, this, id_config);
Bind(wxEVT_BUTTON, &VFSManagerDialog::OnOK, this, wxID_OK);
LoadEntries();
UpdateList();
@ -214,7 +214,7 @@ void VFSManagerDialog::OnRemove(wxCommandEvent& event)
UpdateList();
}
void VFSManagerDialog::OnClose(wxCloseEvent& event)
void VFSManagerDialog::OnOK(wxCommandEvent& event)
{
SaveEntries();
event.Skip();

View File

@ -33,7 +33,7 @@ public:
void OnAdd(wxCommandEvent& event);
void OnRemove(wxCommandEvent& event);
void OnClose(wxCloseEvent& event);
void OnOK(wxCommandEvent& event);
void LoadEntries();
void SaveEntries();
};
};

View File

@ -406,7 +406,7 @@ VHDDManagerDialog::VHDDManagerDialog(wxWindow* parent)
Bind(wxEVT_MENU, &VHDDManagerDialog::OnOpen, this, id_open);
Bind(wxEVT_MENU, &VHDDManagerDialog::OnRemove, this, id_remove);
Bind(wxEVT_MENU, &VHDDManagerDialog::OnCreateHDD, this, id_create_hdd);
Bind(wxEVT_CLOSE_WINDOW, &VHDDManagerDialog::OnClose, this, wxID_OK);
Bind(wxEVT_BUTTON, &VHDDManagerDialog::OnOk, this, wxID_OK);
LoadPaths();
UpdateList();
}
@ -521,7 +521,7 @@ void VHDDManagerDialog::OnCreateHDD(wxCommandEvent& event)
}
}
void VHDDManagerDialog::OnClose(wxCloseEvent& event)
void VHDDManagerDialog::OnOk(wxCommandEvent& event)
{
SavePaths();
event.Skip();

View File

@ -82,7 +82,7 @@ public:
void OnRemove(wxCommandEvent& event);
void OnCreateHDD(wxCommandEvent& event);
void OnClose(wxCloseEvent& event);
void OnOk(wxCommandEvent& event);
void LoadPaths();
void SavePaths();
};

View File

@ -143,8 +143,11 @@ bool TROPUSRLoader::Generate(const std::string& filepath, const std::string& con
default: trophy_grade = 0;
}
TROPUSREntry4 entry4 = {4, sizeof(TROPUSREntry4)-0x10, m_table4.size(), 0, trophy_id, trophy_grade, 0xFFFFFFFF};
TROPUSREntry6 entry6 = {6, sizeof(TROPUSREntry6)-0x10, m_table6.size(), 0, trophy_id, 0, 0, 0, 0, 0};
TROPUSREntry4 entry4 = { be_t<u32>::MakeFromBE(se32(4)), be_t<u32>::MakeFromBE(se32(sizeof(TROPUSREntry4) - 0x10)),
be_t<u32>::MakeFromLE(m_table4.size()), be_t<u32>::MakeFromBE(se32(0)), be_t<u32>::MakeFromLE(trophy_id),
be_t<u32>::MakeFromLE(trophy_grade), be_t<u32>::MakeFromBE(se32(0xFFFFFFFF)) };
TROPUSREntry6 entry6 = { be_t<u32>::MakeFromBE(se32(6)), be_t<u32>::MakeFromBE(se32(sizeof(TROPUSREntry6) - 0x10)),
be_t<u32>::MakeFromLE(m_table6.size()), be_t<u32>::MakeFromBE(0), be_t<u32>::MakeFromLE(trophy_id) };
m_table4.push_back(entry4);
m_table6.push_back(entry6);
@ -152,9 +155,11 @@ bool TROPUSRLoader::Generate(const std::string& filepath, const std::string& con
}
u64 offset = sizeof(TROPUSRHeader) + 2 * sizeof(TROPUSRTableHeader);
TROPUSRTableHeader table4header = {4, sizeof(TROPUSREntry4)-0x10, 1, m_table4.size(), offset, 0};
TROPUSRTableHeader table4header = { be_t<u32>::MakeFromBE(se32(4)), be_t<u32>::MakeFromBE(se32(sizeof(TROPUSREntry4)-0x10)),
be_t<u32>::MakeFromBE(se32(1)), be_t<u32>::MakeFromLE(m_table4.size()), be_t<u64>::MakeFromLE(offset) };
offset += m_table4.size() * sizeof(TROPUSREntry4);
TROPUSRTableHeader table6header = {6, sizeof(TROPUSREntry6)-0x10, 1, m_table6.size(), offset, 0};
TROPUSRTableHeader table6header = { be_t<u32>::MakeFromBE(se32(6)), be_t<u32>::MakeFromBE(se32(sizeof(TROPUSREntry6)-0x10)),
be_t<u32>::MakeFromBE(se32(1)), be_t<u32>::MakeFromLE(m_table6.size()), be_t<u64>::MakeFromLE(offset) };
offset += m_table6.size() * sizeof(TROPUSREntry6);
m_tableHeaders.clear();